BridgeProtocol class
The main protocol handler for bridge communication.
Manages JSON-RPC 2.0 message flow: sending requests/notifications, dispatching incoming messages to registered handlers, and tracking pending request state.
Constructors
- BridgeProtocol({Duration defaultTimeout = const Duration(seconds: 30)})
Properties
-
errors
→ Stream<
BridgeError> -
Protocol-level errors.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
incomingNotifications
→ Stream<
BridgeNotification> -
Incoming notifications (after dispatch).
no setter
- isInitialized → bool
-
Whether the protocol has completed initialization handshake.
no setter
-
outgoing
→ Stream<
String> -
Outgoing serialized messages to be sent on the transport.
no setter
- pendingRequestCount → int
-
Number of pending outgoing requests.
no setter
-
remoteCapabilities
→ Set<
BridgeCapability> -
Capabilities reported by the remote side.
no setter
- remoteHandshake → BridgeHandshake?
-
Remote side handshake info (available after initialization).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelRequest(
String id) → void - Cancel a pending request on the remote side.
-
dispose(
) → void - Dispose the protocol, cancelling all pending requests.
-
exit(
) → void - Send exit notification.
-
handleMessage(
String raw) → void - Handle a raw incoming message string from the transport layer.
-
hasCapability(
BridgeCapability cap) → bool - Whether the remote side supports a given capability.
-
initialize(
BridgeHandshake handshake) → Future< BridgeResponse> - Initialize the protocol with a handshake.
-
neomageAbort(
{String? conversationId}) → Future< BridgeResponse> - Abort a running Neomage request.
-
neomageChat(
{required String message, String? conversationId, Map< String, dynamic> ? options}) → Future<BridgeResponse> - Send a chat message to Neomage.
-
neomageStatus(
) → Future< BridgeResponse> - Get Neomage status.
-
neomageTools(
{required String toolName, required Map< String, dynamic> toolInput, String? conversationId}) → Future<BridgeResponse> - Invoke a Neomage tool.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
progress(
{required String token, required Map< String, dynamic> value}) → void - Send a progress notification.
-
registerHandler(
String method, RequestHandler handler) → void - Register a handler for incoming requests with a specific method.
-
registerNotificationHandler(
String method, NotificationHandler handler) → void - Register a handler for incoming notifications with a specific method.
-
sendNotification(
String method, [dynamic params]) → void - Send a notification (fire-and-forget, no response expected).
-
sendRequest(
String method, dynamic params, {Duration? timeout}) → Future< BridgeResponse> - Send a request and return a future for the response.
-
shutdown(
) → Future< BridgeResponse> - Shutdown the protocol cleanly.
-
textDocumentCompletion(
{required String uri, required int line, required int character, Map< String, dynamic> ? context}) → Future<BridgeResponse> - Request completion at a position.
-
textDocumentDefinition(
{required String uri, required int line, required int character}) → Future< BridgeResponse> - Request definition of a symbol at a position.
-
textDocumentDidChange(
{required String uri, required int version, required List< Map< contentChanges}) → voidString, dynamic> > - Notify that a text document was changed.
-
textDocumentDidClose(
{required String uri}) → void - Notify that a text document was closed.
-
textDocumentDidOpen(
{required String uri, required String languageId, required int version, required String text}) → void - Notify that a text document was opened.
-
textDocumentDidSave(
{required String uri, String? text}) → void - Notify that a text document was saved.
-
textDocumentFormatting(
{required String uri, int tabSize = 2, bool insertSpaces = true, Map< String, dynamic> ? options}) → Future<BridgeResponse> - Request document formatting.
-
textDocumentHover(
{required String uri, required int line, required int character}) → Future< BridgeResponse> - Request hover info at a position.
-
textDocumentReferences(
{required String uri, required int line, required int character, bool includeDeclaration = false}) → Future< BridgeResponse> - Request references to a symbol at a position.
-
toString(
) → String -
A string representation of this object.
inherited
-
unregisterHandler(
String method) → void - Unregister a request handler.
-
unregisterNotificationHandler(
String method) → void - Unregister a notification handler.
-
windowShowMessage(
{required int type, required String message, List< String> ? actions}) → Future<BridgeResponse> - Show a message to the user.
-
workspaceApplyEdit(
{required Map< String, dynamic> edit, String? label}) → Future<BridgeResponse> - Request to apply a workspace edit.
-
workspaceConfiguration(
{required List< Map< items}) → Future<String, dynamic> >BridgeResponse> - Request workspace configuration.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited