MCPcopy Create free account
hub / github.com/apache/maka / setOrchestrationMode

Method setOrchestrationMode

packages/runtime/src/session-manager.ts:1876–1896  ·  view source on GitHub ↗
(sessionId: string, mode: OrchestrationMode)

Source from the content-addressed store, hash-verified

1874 }
1875
1876 async setOrchestrationMode(sessionId: string, mode: OrchestrationMode): Promise<SessionSummary> {
1877 const previous = await this.deps.store.readHeader(sessionId);
1878 const from = previous.orchestrationMode ?? 'default';
1879 if (from === mode) return headerToSummary(previous);
1880 if (this.runtimeKernel.hasActiveRuns(sessionId)) {
1881 throw new Error('Cannot change orchestration mode while a turn is running.');
1882 }
1883 if (previous.status === 'waiting_for_user') {
1884 throw new Error('Cannot change orchestration mode while a tool call awaits confirmation.');
1885 }
1886 const next = await this.deps.store.updateHeader(sessionId, { orchestrationMode: mode });
1887 await this.deps.store.appendMessage(sessionId, {
1888 type: 'system_note',
1889 id: this.deps.newId(),
1890 ts: this.deps.now(),
1891 kind: 'mode_change',
1892 data: { dimension: 'orchestration', from, to: mode },
1893 } satisfies SystemNoteMessage);
1894 this.runtimeKernel.updateCachedHeader(sessionId, next);
1895 return headerToSummary(next);
1896 }
1897
1898 async requestPlanRevision(
1899 sessionId: string,

Callers

nothing calls this directly

Calls 8

headerToSummaryFunction · 0.85
readHeaderMethod · 0.65
hasActiveRunsMethod · 0.65
updateHeaderMethod · 0.65
appendMessageMethod · 0.65
newIdMethod · 0.65
nowMethod · 0.65
updateCachedHeaderMethod · 0.65

Tested by

no test coverage detected