MCPcopy
hub / github.com/coder/mux / queueMessage

Method queueMessage

src/node/services/agentSession.ts:5041–5066  ·  view source on GitHub ↗
(
    message: string,
    options?: SendMessageOptions & { fileParts?: FilePart[] },
    internal?: {
      synthetic?: boolean;
      agentInitiated?: boolean;
      onAccepted?: () => Promise<void> | void;
      onAcceptedPreStreamFailure?: (error: SendMessageError) => Promise<void> | void;
      onCanceled?: (reason: string) => Promise<void> | void;
    }
  )

Source from the content-addressed store, hash-verified

5039 }
5040
5041 queueMessage(
5042 message: string,
5043 options?: SendMessageOptions & { fileParts?: FilePart[] },
5044 internal?: {
5045 synthetic?: boolean;
5046 agentInitiated?: boolean;
5047 onAccepted?: () => Promise<void> | void;
5048 onAcceptedPreStreamFailure?: (error: SendMessageError) => Promise<void> | void;
5049 onCanceled?: (reason: string) => Promise<void> | void;
5050 }
5051 ): "tool-end" | "turn-end" | null {
5052 this.assertNotDisposed("queueMessage");
5053 const didEnqueue = this.messageQueue.add(message, options, internal);
5054 if (!didEnqueue) {
5055 return null;
5056 }
5057 this.emitQueuedMessageChanged();
5058 // Signal to bash_output that it should return early to process queued messages
5059 // only for tool-end dispatches.
5060 const effectiveDispatchMode = this.messageQueue.getQueueDispatchMode();
5061 this.backgroundProcessManager.setMessageQueued(
5062 this.workspaceId,
5063 effectiveDispatchMode === "tool-end"
5064 );
5065 return effectiveDispatchMode;
5066 }
5067
5068 clearQueue(cancelReason = "Queued message cleared before dispatch."): void {
5069 this.assertNotDisposed("clearQueue");

Calls 5

assertNotDisposedMethod · 0.95
addMethod · 0.80
getQueueDispatchModeMethod · 0.80
setMessageQueuedMethod · 0.80

Tested by

no test coverage detected