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

Method emitStreamStart

src/node/services/streamManager.ts:1886–1917  ·  view source on GitHub ↗
(
    workspaceId: WorkspaceId,
    streamInfo: WorkspaceStreamInfo,
    historySequence: number,
    options?: { replay?: boolean }
  )

Source from the content-addressed store, hash-verified

1884 }
1885
1886 private emitStreamStart(
1887 workspaceId: WorkspaceId,
1888 streamInfo: WorkspaceStreamInfo,
1889 historySequence: number,
1890 options?: { replay?: boolean }
1891 ): void {
1892 const streamStartAgentId = streamInfo.initialMetadata?.agentId;
1893 const streamStartMode = this.getStreamMode(streamInfo.initialMetadata);
1894 const canonicalModel = normalizeToCanonical(streamInfo.model);
1895 const routedThroughGateway =
1896 streamInfo.initialMetadata?.routedThroughGateway ??
1897 streamInfo.model.startsWith("mux-gateway:");
1898 const routeProvider = streamInfo.initialMetadata?.routeProvider;
1899
1900 this.emit("stream-start", {
1901 type: "stream-start",
1902 workspaceId: workspaceId as string,
1903 messageId: streamInfo.messageId,
1904 ...(options?.replay && { replay: true }),
1905 model: canonicalModel,
1906 routedThroughGateway,
1907 ...(routeProvider != null && { routeProvider }),
1908 historySequence,
1909 startTime: streamInfo.startTime,
1910 ...(streamStartAgentId && { agentId: streamStartAgentId }),
1911 ...(streamStartMode && { mode: streamStartMode }),
1912 ...(streamInfo.thinkingLevel && { thinkingLevel: streamInfo.thinkingLevel }),
1913 ...(streamInfo.initialMetadata?.acpPromptId != null
1914 ? { acpPromptId: streamInfo.initialMetadata.acpPromptId }
1915 : {}),
1916 } as StreamStartEvent);
1917 }
1918
1919 private emitStreamAbort(
1920 workspaceId: WorkspaceId,

Callers 2

replayStreamMethod · 0.95

Calls 3

getStreamModeMethod · 0.95
normalizeToCanonicalFunction · 0.90
emitMethod · 0.65

Tested by

no test coverage detected