Abstract Class: ProceduralAgentConnector<TBus, TConfig>
Makaio Framework / ai-adapters-core / ProceduralAgentConnector
Abstract Class: ProceduralAgentConnector<TBus, TConfig>
Section titled “Abstract Class: ProceduralAgentConnector<TBus, TConfig>”Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:89
Abstract base class for procedural (non-event-driven) agent connectors.
Procedural adapters (OpenAI, Copilot, Gemini) share common patterns:
- wireSessionEvents: subscribe to turn lifecycle events and update processing state
- processUserMessages: initialize session, enqueue, transition to active, process queue
- complete: poll processing state until idle/paused
- start: delegate to sendMessage and return AgentStartResult
- acceptsImmediate: delegate to session’s current turn
Subclasses must implement:
getSession()/ensureSession()for session access and lazy initializationgetSessionQueue()for the adapter’s UserMessageQueue instancegetTurnSubjects()for namespace-specific turn subjectssendMessage(),abort(),close(),interrupt(),getAdapterSessionId()
Subclasses may override:
getWireSessionConfig()for custom turn_finished behavior (e.g., Copilot multi-turn)
Extends
Section titled “Extends”AIAgentConnector<TBus,TConfig>
Type Parameters
Section titled “Type Parameters”TBus extends ScopedBus<string> = ScopedBus<string>
Scoped bus type for adapter namespace
TConfig
Section titled “TConfig”TConfig extends BaseAgentConnectorConfig<TBus> = BaseAgentConnectorConfig<TBus>
Configuration type extending BaseAgentConnectorConfig
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”
protectednew ProceduralAgentConnector<TBus,TConfig>(config):ProceduralAgentConnector<TBus,TConfig>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:119
Parameters
Section titled “Parameters”config
Section titled “config”BaseAgentConnectorConfig<TBus, object> & object
Returns
Section titled “Returns”ProceduralAgentConnector<TBus, TConfig>
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”adapterId
Section titled “adapterId”
readonlyadapterId:string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:91
Adapter identifier shared across instances of the same adapter type.
Inherited from
Section titled “Inherited from”adapterName
Section titled “adapterName”
protectedreadonlyadapterName:string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:115
Adapter type name for event identification.
Inherited from
Section titled “Inherited from”adapterSessionId?
Section titled “adapterSessionId?”
optionaladapterSessionId?:string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:70
Session ID from the provider (set after connection/start).
Inherited from
Section titled “Inherited from”AIAgentConnector.adapterSessionId
agentId
Section titled “agentId”
protectedreadonlyagentId:string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:68
Unique identifier for this agent instance.
Inherited from
Section titled “Inherited from”config
Section titled “config”
protectedreadonlyconfig:TConfig&object
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:95
Type Declaration
Section titled “Type Declaration”adapterId
Section titled “adapterId”adapterId:
string
Inherited from
Section titled “Inherited from”currentReasoningEffort
Section titled “currentReasoningEffort”currentReasoningEffort:
"none"|"low"|"medium"|"high"|"extra-high"|undefined
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:103
Current reasoning effort level, updated by changeReasoningInPlace.
Inherited from
Section titled “Inherited from”AIAgentConnector.currentReasoningEffort
cwd:
string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:101
Working directory for agent execution
Inherited from
Section titled “Inherited from”deferredInterrupt
Section titled “deferredInterrupt”
protecteddeferredInterrupt:DeferredPromise<void> |undefined
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:82
Deferred promise for interrupt coordination.
Inherited from
Section titled “Inherited from”AIAgentConnector.deferredInterrupt
protectedreadonlyenv:Record<string,string>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:109
Inherited from
Section titled “Inherited from”errorHandler?
Section titled “errorHandler?”
protectedreadonlyoptionalerrorHandler?: (error,terminate) =>void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:80
Optional error handler callback.
Parameters
Section titled “Parameters”Error
terminate
Section titled “terminate”boolean
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”lastResult
Section titled “lastResult”
protectedlastResult:MessageResult|null=null
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:94
Inherited from
Section titled “Inherited from”model:
string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:97
Model used for this agent (subclasses may update when SDK confirms actual model)
Inherited from
Section titled “Inherited from”pendingMessageHandle?
Section titled “pendingMessageHandle?”
protectedoptionalpendingMessageHandle?:MessageHandle
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:74
Currently active message handle waiting for completion.
Inherited from
Section titled “Inherited from”AIAgentConnector.pendingMessageHandle
providerConfigId?
Section titled “providerConfigId?”
optionalproviderConfigId?:string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:99
ProviderConfig UUID used during agent creation, carried for runtime introspection
Inherited from
Section titled “Inherited from”AIAgentConnector.providerConfigId
sessionId?
Section titled “sessionId?”
protectedreadonlyoptionalsessionId?:string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:72
Makaio session ID for cross-session correlation and approval routing.
Inherited from
Section titled “Inherited from”supportedReasoningLevels
Section titled “supportedReasoningLevels”supportedReasoningLevels: {
extra-high?:string|number;high?:string|number;low?:string|number;medium?:string|number;none?:string|number; } |undefined
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:108
Reasoning levels supported by the current model, forwarded from the config factory.
undefined when the model does not declare reasoning support.
Inherited from
Section titled “Inherited from”AIAgentConnector.supportedReasoningLevels
systemPrompt?
Section titled “systemPrompt?”
protectedoptionalsystemPrompt?:string| {content:string;mode:"append"; }
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:117
Runtime system prompt from start/initialize options.
Inherited from
Section titled “Inherited from”timeouts
Section titled “timeouts”
protectedreadonlytimeouts:TrackedTimeoutConfig
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:93
Resolved timeout configuration with provenance tracking.
Inherited from
Section titled “Inherited from”Accessors
Section titled “Accessors”currentTurnNumber
Section titled “currentTurnNumber”Get Signature
Section titled “Get Signature”get
protectedcurrentTurnNumber():number
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:344
Current turn number (read-only). Use consumeTurnNumber to advance.
Returns
Section titled “Returns”number
The current turn number
Inherited from
Section titled “Inherited from”AIAgentConnector.currentTurnNumber
pendingTurnNumber
Section titled “pendingTurnNumber”Get Signature
Section titled “Get Signature”get
protectedpendingTurnNumber():number|undefined
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:352
Staged canonical turn number, or undefined if none was staged.
Returns
Section titled “Returns”number | undefined
The pending canonical turn number
Inherited from
Section titled “Inherited from”AIAgentConnector.pendingTurnNumber
Methods
Section titled “Methods”abort()
Section titled “abort()”
abstractabort():void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:246
Abort the agent and cleanup resources (panic mode). Triggers AbortController which may cause provider errors. Use close() for graceful shutdown instead.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”acceptsImmediate()
Section titled “acceptsImmediate()”
protectedacceptsImmediate():boolean
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:276
Returns true if current turn can accept immediate messages.
Returns
Section titled “Returns”boolean
True if turn can accept immediate, false otherwise
captureSystemPrompt()
Section titled “captureSystemPrompt()”
protectedcaptureSystemPrompt(prompt):void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:167
Store runtime system prompt for session creation. Subclasses may override to apply SDK-specific side effects (e.g., Gemini’s setSystemInstruction).
Parameters
Section titled “Parameters”prompt
Section titled “prompt”string | { content: string; mode: "append"; } | undefined
System prompt from start/initialize options
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AIAgentConnector.captureSystemPrompt
changeCwdInPlace()
Section titled “changeCwdInPlace()”changeCwdInPlace(
_newCwd):Promise<boolean>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:385
Attempt to change the working directory without a connector swap. Subclasses override when the adapter supports in-place cwd changes (e.g., stateless APIs). Base implementation returns false (swap required).
Mutation contract: Implementations MUST NOT mutate this.cwd directly.
The caller (AIAgent.handleCwdChange) owns the this.cwd field update after
a successful in-place change. Implementations only update SDK-internal state.
Parameters
Section titled “Parameters”_newCwd
Section titled “_newCwd”string
The working directory path to switch to
Returns
Section titled “Returns”Promise<boolean>
true if changed in-place, false if swap needed. Exceptions are caught by the caller and treated as false (automatic swap fallback), so implementations need not guard.
Inherited from
Section titled “Inherited from”AIAgentConnector.changeCwdInPlace
changeModelInPlace()
Section titled “changeModelInPlace()”changeModelInPlace(
_newModel):Promise<boolean>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:369
Attempt to change the model without a connector swap. Subclasses override when the SDK supports in-place model changes. Base implementation returns false (swap required).
Mutation contract: Implementations MUST NOT mutate this.model directly.
The caller (AIAgent.handleModelChange) owns the this.model field update after
a successful in-place change. Implementations only configure the SDK-internal model
(e.g., query.setModel(), geminiConfig.setModel()).
Parameters
Section titled “Parameters”_newModel
Section titled “_newModel”string
The model identifier to switch to
Returns
Section titled “Returns”Promise<boolean>
true if changed in-place, false if swap needed. Exceptions are caught by the caller and treated as false (automatic swap fallback), so implementations need not guard.
Inherited from
Section titled “Inherited from”AIAgentConnector.changeModelInPlace
changeReasoningInPlace()
Section titled “changeReasoningInPlace()”changeReasoningInPlace(
_newLevel):Promise<boolean>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:402
Attempt to change reasoning effort without swapping the connector.
Override in subclasses that support in-place reasoning changes (e.g., adapters
that pass reasoning parameters per-request rather than at session-creation time).
The base implementation returns false so callers fall back to a connector swap.
Mutation contract: Implementations MUST NOT mutate this.currentReasoningEffort
directly. The caller owns the currentReasoningEffort field update after a successful
in-place change. Implementations only configure the SDK-internal reasoning parameter.
Parameters
Section titled “Parameters”_newLevel
Section titled “_newLevel”"none" | "low" | "medium" | "high" | "extra-high"
The new reasoning effort level to apply
Returns
Section titled “Returns”Promise<boolean>
true if the change was applied in-place, false if a connector swap is needed
Inherited from
Section titled “Inherited from”AIAgentConnector.changeReasoningInPlace
close()
Section titled “close()”
abstractclose():Promise<void>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:253
Gracefully close the agent session. Unlike abort(), this doesn’t trigger AbortController errors. Use this for normal shutdown; use abort() for emergency termination.
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”complete()
Section titled “complete()”complete():
Promise<MessageResult|null>
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:265
Complete the agent session by waiting for all messages to finish.
Returns
Section titled “Returns”Promise<MessageResult | null>
Last message result or null if no messages processed
Overrides
Section titled “Overrides”consumeTurnNumber()
Section titled “consumeTurnNumber()”
protectedconsumeTurnNumber():number
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:330
Advance to the next turn number, consuming any pending canonical value. Orchestrator-staged values win; otherwise the local counter increments by one.
Returns
Section titled “Returns”number
The current turn number after advancement
Inherited from
Section titled “Inherited from”AIAgentConnector.consumeTurnNumber
createMessageHandle()
Section titled “createMessageHandle()”
protectedcreateMessageHandle(message,options?):MessageHandle
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:279
Create a MessageHandle with standard initialization.
Centralizes the pattern used by all connectors:
- Generate messageId (use provided or generate UUID)
- Create MessageHandle instance
- Set adapterSessionId
- Call onMessageSent callback
Parameters
Section titled “Parameters”message
Section titled “message”Normalized user message
options?
Section titled “options?”MessageHandleOptions
Optional message options (id, delivery mode, history, and turn context)
Returns
Section titled “Returns”Initialized MessageHandle ready for enqueueing
Inherited from
Section titled “Inherited from”AIAgentConnector.createMessageHandle
emit()
Section titled “emit()”
protectedemit<TSubject>(subject,payload):Promise<void>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:527
Emit an event via the scoped bus with auto-injected metadata.
Wraps scopedBus.emit() to automatically include connector identity
(adapterName, agentId, adapterId, adapterSessionId) in the payload.
Type Parameters
Section titled “Type Parameters”TSubject
Section titled “TSubject”TSubject extends ScopedSubjectDefinition<TBus["namespace"]>
Parameters
Section titled “Parameters”subject
Section titled “subject”TSubject
Subject definition for the event
payload
Section titled “payload”Forbid<TSubject["$meta"]["payload"], ForbiddenKeys>
Event payload (metadata fields are forbidden and auto-injected)
Returns
Section titled “Returns”Promise<void>
Promise that resolves when the event is emitted
Inherited from
Section titled “Inherited from”ensureSession()
Section titled “ensureSession()”
abstractprotectedensureSession():Promise<ProceduralConnectorSession>
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:107
Initialize and return the adapter’s session. Must be idempotent (no-op if already initialized).
Returns
Section titled “Returns”Promise<ProceduralConnectorSession>
The initialized session
getAdapterName()
Section titled “getAdapterName()”getAdapterName():
string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:456
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”AIAgentConnector.getAdapterName
getAdapterSessionId()
Section titled “getAdapterSessionId()”
abstractgetAdapterSessionId():Promise<string>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:259
Get session ID, waiting for provider to generate it if not yet available.
Returns
Section titled “Returns”Promise<string>
Session ID from provider
Inherited from
Section titled “Inherited from”AIAgentConnector.getAdapterSessionId
getAgentId()
Section titled “getAgentId()”getAgentId():
string
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:452
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”getProcessingState()
Section titled “getProcessingState()”getProcessingState():
ProcessingState
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:149
Get the current processing state of the agent.
Returns
Section titled “Returns”The current processing state
Inherited from
Section titled “Inherited from”AIAgentConnector.getProcessingState
getSession()
Section titled “getSession()”
abstractprotectedgetSession():ProceduralConnectorSession|undefined
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:100
Get the adapter’s session instance (may be undefined if not yet initialized).
Returns
Section titled “Returns”ProceduralConnectorSession | undefined
The session or undefined
getSessionQueue()
Section titled “getSessionQueue()”
abstractprotectedgetSessionQueue():UserMessageQueue
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:113
Get the adapter’s UserMessageQueue instance.
Returns
Section titled “Returns”The message queue
getTimeoutMs()
Section titled “getTimeoutMs()”getTimeoutMs(
category):number
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:465
Get timeout value for a specific category.
Parameters
Section titled “Parameters”category
Section titled “category”Timeout category (initialization, acknowledgement, completion, toolApproval, eventWait)
Returns
Section titled “Returns”number
Timeout value in milliseconds
Inherited from
Section titled “Inherited from”getTurnSubjects()
Section titled “getTurnSubjects()”
abstractprotectedgetTurnSubjects():WireSessionSubjects<TBus["namespace"]>
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:119
Get the adapter’s namespace-specific turn subjects for wireSessionEvents.
Returns
Section titled “Returns”WireSessionSubjects<TBus["namespace"]>
Turn subject definitions
getWireSessionConfig()
Section titled “getWireSessionConfig()”
protectedgetWireSessionConfig():WireSessionConfig|undefined
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:127
Get optional wire session configuration for custom turn_finished behavior. Override in subclasses that need non-standard turn_finished handling (e.g., Copilot multi-turn message completion).
Returns
Section titled “Returns”WireSessionConfig | undefined
Wire session configuration, or undefined for default behavior
handleError()
Section titled “handleError()”handleError(
error,terminate?):void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:418
Internal
Marks pending message as failed, calls error handler, resolves completion promise.
Parameters
Section titled “Parameters”unknown
Error that occurred
terminate?
Section titled “terminate?”boolean = false
Whether to abort the agent after handling error
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”handlePause()
Section titled “handlePause()”
protectedhandlePause(_reason):void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:158
Handle pause after rejection or error. Subclasses should clear pending messages as appropriate.
Parameters
Section titled “Parameters”_reason
Section titled “_reason”"error" | "rejection"
Reason for pause (‘rejection’ | ‘error’); available for subclass overrides
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”handleToolApprovalDenied()
Section titled “handleToolApprovalDenied()”
protectedhandleToolApprovalDenied(abort,details?):void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:444
Parameters
Section titled “Parameters”"handled" | "not_requested" | "not_supported"
details?
Section titled “details?”string
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AIAgentConnector.handleToolApprovalDenied
initialize()
Section titled “initialize()”initialize(
options?):Promise<void>
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:236
Initialize the connector’s SDK session without sending a message. Must set adapterSessionId before returning. Called by createAgent for idle agent setup. Implementations MUST be idempotent (no-op if already initialized).
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional start options (e.g., systemPrompt)
Returns
Section titled “Returns”Promise<void>
Overrides
Section titled “Overrides”interrupt()
Section titled “interrupt()”
abstractinterrupt():Promise<void>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:410
Interrupt the current message processing.
Returns
Section titled “Returns”Promise<void>
Promise that resolves when interrupt is handled
Inherited from
Section titled “Inherited from”logLowLevelEvent()
Section titled “logLowLevelEvent()”
protectedlogLowLevelEvent(_event):void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:572
Parameters
Section titled “Parameters”_event
Section titled “_event”unknown
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AIAgentConnector.logLowLevelEvent
markToolRefreshPending()
Section titled “markToolRefreshPending()”markToolRefreshPending():
void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:302
Signal that MCP tools have changed and should be refreshed at the next turn boundary.
Called by the AIAgent layer when receiving MCP bus events (mcp.tools.updated,
mcp.tools.enabled). Connectors that support direct-inject tool refresh (e.g.,
BaseStreamConnector) override this to set an internal pending-refresh flag.
The default implementation is a no-op so connectors that do not manage MCP tools
directly are unaffected.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”AIAgentConnector.markToolRefreshPending
on<
Subject>(subject,handler,options?): () =>void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:549
Subscribe to events on the filtered bus (pre-filtered by agentId).
Uses filteredBus which only delivers events matching this connector’s agentId.
Type Parameters
Section titled “Type Parameters”Subject
Section titled “Subject”Subject extends ScopedSubjectDefinition<TBus["namespace"]>
Parameters
Section titled “Parameters”subject
Section titled “subject”Subject
Subject definition to subscribe to
handler
Section titled “handler”HandlerForSubjectDefinition<Subject>
Event handler receiving the event context
options?
Section titled “options?”Optional subscription options (e.g., priority)
Returns
Section titled “Returns”Unsubscribe function
() => void
Inherited from
Section titled “Inherited from”once()
Section titled “once()”once<
Subject>(subject,options?):Promise<never>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:565
Wait for a single event on the filtered bus (pre-filtered by agentId).
Uses filteredBus which only delivers events matching this connector’s agentId.
Type Parameters
Section titled “Type Parameters”Subject
Section titled “Subject”Subject extends ScopedSubjectDefinition<TBus["namespace"]>
Parameters
Section titled “Parameters”subject
Section titled “subject”Subject
Subject definition to wait for
options?
Section titled “options?”OnceOptions<ScopedSubjectDefinition<TBus["namespace"]>>
Optional options (e.g., predicate filter, timeout)
Returns
Section titled “Returns”Promise<never>
Promise resolving to the event context
Inherited from
Section titled “Inherited from”onceProcessingStateChanged()
Section titled “onceProcessingStateChanged()”onceProcessingStateChanged(
predicate?):Promise<ProcessingState>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:206
Wait for a single processing state change matching an optional predicate.
Parameters
Section titled “Parameters”predicate?
Section titled “predicate?”(eventData) => boolean
Optional filter, e.g., (e) => !e.isProcessing for idle
Returns
Section titled “Returns”Promise<ProcessingState>
Promise resolving to { isProcessing: boolean }
Inherited from
Section titled “Inherited from”AIAgentConnector.onceProcessingStateChanged
onProcessingStateChanged()
Section titled “onProcessingStateChanged()”onProcessingStateChanged(
handler):UnsubscribeFunction
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:195
Subscribe to processing state changes (idle ↔ processing transitions).
Parameters
Section titled “Parameters”handler
Section titled “handler”(payload) => void | Promise<void>
Called with { isProcessing: boolean } on each state change
Returns
Section titled “Returns”UnsubscribeFunction
Unsubscribe function
Inherited from
Section titled “Inherited from”AIAgentConnector.onProcessingStateChanged
processUserMessages()
Section titled “processUserMessages()”
protectedprocessUserMessages(messageHandles):Promise<Set<MessageHandle>>
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:212
Process queued user messages by delegating to Session.
Shared flow:
- Initialize session if not yet created
- Enqueue the message
- Set adapterSessionId on handle
- Transition to active if currently idle/paused
- Process queue via session
Parameters
Section titled “Parameters”messageHandles
Section titled “messageHandles”Array of message handles to process
Returns
Section titled “Returns”Promise<Set<MessageHandle>>
Set of message handles that were processed
requestToolApproval()
Section titled “requestToolApproval()”
protectedrequestToolApproval<TSubject>(subject,payload):Promise<TSubject["$meta"]["payload"]["response"]>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:478
Request tool approval via the scoped bus with auto-injected metadata.
Wraps scopedBus.request() to automatically include connector identity
(adapterName, agentId, adapterId, adapterSessionId) in the payload.
Type Parameters
Section titled “Type Parameters”TSubject
Section titled “TSubject”TSubject extends ScopedSubjectDefinition<TBus["namespace"]>
Parameters
Section titled “Parameters”subject
Section titled “subject”TSubject
Subject definition for the tool approval request
payload
Section titled “payload”Forbid<TSubject["$meta"]["payload"]["request"], ForbiddenKeys>
Request payload (metadata fields are forbidden and auto-injected)
Returns
Section titled “Returns”Promise<TSubject["$meta"]["payload"]["response"]>
Promise resolving to the approval response
Inherited from
Section titled “Inherited from”AIAgentConnector.requestToolApproval
requestToolApprovalWithHandling()
Section titled “requestToolApprovalWithHandling()”
protectedrequestToolApprovalWithHandling<TSubject>(subject,payload):Promise<TSubject["$meta"]["payload"]["response"]>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:502
Execute a tool approval request with the shared diagnostics wrapper.
Handles the common RequestError/NoHandlerError path by logging a helpful
message via handleError and re-throwing so callers can decide whether to
surface the failure or fall back to a denial.
Type Parameters
Section titled “Type Parameters”TSubject
Section titled “TSubject”TSubject extends ScopedSubjectDefinition<TBus["namespace"]>
Parameters
Section titled “Parameters”subject
Section titled “subject”TSubject
Scoped subject definition for the tool approval request
payload
Section titled “payload”Forbid<TSubject["$meta"]["payload"]["request"], ForbiddenKeys>
Payload that must not include adapter metadata
Returns
Section titled “Returns”Promise<TSubject["$meta"]["payload"]["response"]>
Tool approval response payload
Inherited from
Section titled “Inherited from”AIAgentConnector.requestToolApprovalWithHandling
sendMessage()
Section titled “sendMessage()”
abstractsendMessage(message,options?):Promise<MessageHandle>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:236
Send a message to the agent. For initial message, use start() instead.
Parameters
Section titled “Parameters”message
Section titled “message”Normalized message content
options?
Section titled “options?”Send options (e.g., delivery mode, message ID)
Returns
Section titled “Returns”Promise<MessageHandle>
Message handle for tracking
Inherited from
Section titled “Inherited from”setCanonicalTurnNumber()
Section titled “setCanonicalTurnNumber()”setCanonicalTurnNumber(
turnNumber):void
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:312
Stage the canonical orchestrator-assigned turn number for consumption by the next consumeTurnNumber call. The counter is monotonically increasing.
Parameters
Section titled “Parameters”turnNumber
Section titled “turnNumber”number
Canonical 1-based turn number from SessionOrchestrator
Returns
Section titled “Returns”void
Throws
Section titled “Throws”RangeError when the value is invalid, regresses, or downgrades a staged value
Inherited from
Section titled “Inherited from”AIAgentConnector.setCanonicalTurnNumber
start()
Section titled “start()”start(
message,options?):Promise<AgentStartResult>
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:248
Start session with initial message.
Parameters
Section titled “Parameters”message
Section titled “message”The initial message to send
options?
Section titled “options?”Optional send message options
Returns
Section titled “Returns”Promise<AgentStartResult>
The agent start result with session ID and message handle
Overrides
Section titled “Overrides”updateProcessingState()
Section titled “updateProcessingState()”
protectedupdateProcessingState(state):Promise<void>
Defined in: ../../../adapters/core/src/connector/agent-connector.ts:177
Update the agent’s processing state. State transitions trigger events via emittery.
Parameters
Section titled “Parameters”New processing state
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”AIAgentConnector.updateProcessingState
wireSessionEvents()
Section titled “wireSessionEvents()”
protectedwireSessionEvents():void
Defined in: ../../../adapters/core/src/connector/procedural-agent-connector.ts:140
Wire Session turn events to Connector state updates.
Session emits typed events, Connector subscribes and updates processing state. This maintains separation of concerns - Session does not know about Connector state.
Default turn_finished behavior: transition through processing_finished to idle,
or drain the queue if messages are pending. Override via getWireSessionConfig().
Returns
Section titled “Returns”void