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

Method appendToHistory

src/node/services/historyService.ts:1513–1523  ·  view source on GitHub ↗
(workspaceId: string, message: MuxMessage)

Source from the content-addressed store, hash-verified

1511 }
1512
1513 async appendToHistory(workspaceId: string, message: MuxMessage): Promise<Result<void>> {
1514 return this.fileLocks.withLock(workspaceId, async () => {
1515 const result = await this._appendToHistoryUnlocked(workspaceId, message);
1516 if (result.success) {
1517 // A new durable boundary seals the previous epoch — rotate it out of
1518 // chat.jsonl so subsequent reads/rewrites stay O(active epoch).
1519 await this.rotateAfterBoundaryWriteUnlocked(workspaceId, message);
1520 }
1521 return result;
1522 });
1523 }
1524
1525 /**
1526 * Update an existing message in history by historySequence

Calls 3

withLockMethod · 0.80

Tested by 15

appendUserHistoryMessageFunction · 0.64
finalizeChildReportFunction · 0.64
seedCompactionEpochFunction · 0.64
seedImageMessageFunction · 0.64
seedHistoryFunction · 0.64
appendNumberedMessagesFunction · 0.64
createSessionFunction · 0.64
seedHistoryWithToolCallsFunction · 0.64