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

Method buildPartialAssistantMessage

src/node/services/streamManager.ts:2090–2117  ·  view source on GitHub ↗
(
    streamInfo: WorkspaceStreamInfo,
    options: { metadata?: Partial<MuxMetadata>; parts?: MuxMessage["parts"] } = {}
  )

Source from the content-addressed store, hash-verified

2088 }
2089
2090 private buildPartialAssistantMessage(
2091 streamInfo: WorkspaceStreamInfo,
2092 options: { metadata?: Partial<MuxMetadata>; parts?: MuxMessage["parts"] } = {}
2093 ): MuxMessage {
2094 const canonicalModel = normalizeToCanonical(streamInfo.model);
2095 const routedThroughGateway =
2096 streamInfo.initialMetadata?.routedThroughGateway ??
2097 streamInfo.model.startsWith("mux-gateway:");
2098
2099 return {
2100 id: streamInfo.messageId,
2101 role: "assistant",
2102 metadata: {
2103 historySequence: streamInfo.historySequence,
2104 timestamp: streamInfo.startTime,
2105 ...streamInfo.initialMetadata,
2106 model: canonicalModel,
2107 metadataModel: streamInfo.metadataModel,
2108 routedThroughGateway,
2109 ...(streamInfo.thinkingLevel && {
2110 thinkingLevel: streamInfo.thinkingLevel as ThinkingLevel,
2111 }),
2112 partial: true,
2113 ...options.metadata,
2114 },
2115 parts: options.parts ?? streamInfo.parts,
2116 };
2117 }
2118
2119 private buildPartialRefusalContinuationMessage(
2120 streamInfo: WorkspaceStreamInfo,

Callers 3

flushPartialWriteMethod · 0.95
persistStreamErrorMethod · 0.95

Calls 1

normalizeToCanonicalFunction · 0.90

Tested by

no test coverage detected