(sessionId: string, mode: OrchestrationMode)
| 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, |
nothing calls this directly
no test coverage detected