@markusylisiurunen/tau 0.3.99 → 0.3.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/code_mode/agents.js +2 -0
- package/dist/core/code_mode/agents.js.map +1 -1
- package/dist/core/code_mode/history.js +7 -0
- package/dist/core/code_mode/history.js.map +1 -1
- package/dist/core/code_mode/models.js.map +1 -1
- package/dist/core/code_mode/web.js.map +1 -1
- package/dist/core/config/content_loader.js.map +1 -1
- package/dist/core/config/index.js +2 -1
- package/dist/core/config/index.js.map +1 -1
- package/dist/core/config/ownership.js +71 -0
- package/dist/core/config/ownership.js.map +1 -0
- package/dist/core/config/runtime.js +22 -10
- package/dist/core/config/runtime.js.map +1 -1
- package/dist/core/config/runtime_config_snapshot.js +2 -2
- package/dist/core/config/runtime_config_snapshot.js.map +1 -1
- package/dist/core/config/schema.js +3 -2
- package/dist/core/config/schema.js.map +1 -1
- package/dist/core/history/agent_history_recorder.js +64 -0
- package/dist/core/history/agent_history_recorder.js.map +1 -0
- package/dist/core/history/cli.js +2 -2
- package/dist/core/history/cli.js.map +1 -1
- package/dist/core/history/config.js.map +1 -1
- package/dist/core/history/history_manager.js +14 -29
- package/dist/core/history/history_manager.js.map +1 -1
- package/dist/core/history/local_history_store.js +43 -10
- package/dist/core/history/local_history_store.js.map +1 -1
- package/dist/core/history/migrations.js +1 -1
- package/dist/core/history/migrations.js.map +1 -1
- package/dist/core/history/remote_history_client.js +2 -0
- package/dist/core/history/remote_history_client.js.map +1 -1
- package/dist/core/history/setup.js +10 -8
- package/dist/core/history/setup.js.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/runtime/agent_model.js.map +1 -1
- package/dist/core/runtime/chat_runtime.js +1 -0
- package/dist/core/runtime/chat_runtime.js.map +1 -1
- package/dist/core/static/code_mode/history/documentation.md +22 -4
- package/dist/core/static/tau_docs/code-mode.md +1 -1
- package/dist/core/static/tau_docs/config-reference.md +22 -8
- package/dist/core/static/tau_docs/configuration.md +13 -2
- package/dist/core/static/tau_docs/credentials.md +1 -1
- package/dist/core/static/tau_docs/history.md +42 -2
- package/dist/core/static/tau_docs/models.md +1 -1
- package/dist/core/static/tau_docs/node-sdk.md +4 -4
- package/dist/core/static/tau_docs/ownership-and-scope.md +7 -5
- package/dist/core/static/tau_docs/personas.md +1 -1
- package/dist/core/static/tau_docs/remote-sessions.md +2 -1
- package/dist/core/static/tau_docs/security.md +11 -3
- package/dist/core/static/tau_docs/session-protocol-methods.md +1 -1
- package/dist/core/static/tau_docs/session-protocol.md +20 -10
- package/dist/core/static/tau_docs/sessions.md +2 -2
- package/dist/core/static/tau_docs/subagents.md +13 -13
- package/dist/core/static/tau_docs/telegram-projects.md +62 -4
- package/dist/core/static/tau_docs/telegram.md +9 -6
- package/dist/core/static/tau_docs/troubleshooting.md +5 -3
- package/dist/core/static/tau_docs/tui.md +23 -4
- package/dist/core/subagents/agent_supervisor.js +5 -1
- package/dist/core/subagents/agent_supervisor.js.map +1 -1
- package/dist/core/subagents/claude_code_runner.mjs +49 -49
- package/dist/core/subagents/native_subagent_runtime.js +6 -1
- package/dist/core/subagents/native_subagent_runtime.js.map +1 -1
- package/dist/core/subagents/runtime.js.map +1 -1
- package/dist/core/telegram/adapter.js +17 -20
- package/dist/core/telegram/adapter.js.map +1 -1
- package/dist/core/telegram/cli.js +24 -12
- package/dist/core/telegram/cli.js.map +1 -1
- package/dist/core/telegram/config.js +2 -0
- package/dist/core/telegram/config.js.map +1 -1
- package/dist/core/telegram/local_session_client.js +2 -2
- package/dist/core/telegram/local_session_client.js.map +1 -1
- package/dist/core/telegram/runtime.js +10 -1
- package/dist/core/telegram/runtime.js.map +1 -1
- package/dist/core/telegram/session_manager.js +12 -0
- package/dist/core/telegram/session_manager.js.map +1 -1
- package/dist/core/telegram/workspace.js +21 -0
- package/dist/core/telegram/workspace.js.map +1 -1
- package/dist/core/tools/catalog.js.map +1 -1
- package/dist/core/utils/model_notices.js.map +1 -1
- package/dist/core/utils/speech_to_text_keywords.js +10 -4
- package/dist/core/utils/speech_to_text_keywords.js.map +1 -1
- package/dist/core/version.js +2 -2
- package/dist/core/version.js.map +1 -1
- package/dist/diff_tool/app/dist/assets/{core-D8lOlLN2.js → core-3PFMkRLP.js} +1 -1
- package/dist/diff_tool/app/dist/assets/engine-oniguruma-C5P09Ghe.js +1 -0
- package/dist/diff_tool/app/dist/assets/{highlights-B80gocb2.js → highlights-Bi-VwGCO.js} +2 -2
- package/dist/diff_tool/app/dist/assets/index-DhaXI7F3.js +221 -0
- package/dist/diff_tool/app/dist/assets/langs-CDbZNx2R.js +1 -0
- package/dist/diff_tool/app/dist/assets/lib-BKZ5ZaMU.js +1 -0
- package/dist/diff_tool/app/dist/assets/shiki-BArE1NVK.js +2 -0
- package/dist/diff_tool/app/dist/assets/{stream-tokenizer-BkuDYA48.js → stream-tokenizer-DFTZfQ1S.js} +4 -4
- package/dist/diff_tool/app/dist/assets/{themes-BaMgiyFz.js → themes-Dzo-2cM5.js} +2 -2
- package/dist/diff_tool/app/dist/assets/wasm-4KdTHw0F.js +1 -0
- package/dist/diff_tool/app/dist/index.html +2 -2
- package/dist/history/worker/index.js +140 -15
- package/dist/history/worker/index.js.map +1 -1
- package/dist/history/worker/migrations/0002_parent_session.sql +3 -0
- package/dist/history/worker/viewer.css +10 -1
- package/dist/host/local_session_host.js +86 -62
- package/dist/host/local_session_host.js.map +1 -1
- package/dist/host/session_bootstrap.js +53 -0
- package/dist/host/session_bootstrap.js.map +1 -0
- package/dist/main.js +48 -95
- package/dist/main.js.map +1 -1
- package/dist/protocol/environment_variables.d.ts +2 -0
- package/dist/protocol/environment_variables.js +7 -0
- package/dist/protocol/environment_variables.js.map +1 -0
- package/dist/protocol/session_protocol.d.ts +9 -2
- package/dist/protocol/session_protocol.js +14 -7
- package/dist/protocol/session_protocol.js.map +1 -1
- package/dist/sdk/client.js +2 -2
- package/dist/sdk/client.js.map +1 -1
- package/dist/sdk/local_client.d.ts +2 -2
- package/dist/sdk/local_client.js +11 -66
- package/dist/sdk/local_client.js.map +1 -1
- package/dist/sdk/types.d.ts +4 -0
- package/dist/store/session_snapshot_migrations.js +19 -1
- package/dist/store/session_snapshot_migrations.js.map +1 -1
- package/dist/tui/chat_view.js +5 -0
- package/dist/tui/chat_view.js.map +1 -1
- package/dist/tui/host_diagnostic_relay.js +44 -0
- package/dist/tui/host_diagnostic_relay.js.map +1 -0
- package/dist/tui/index.js +1 -0
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/listen_capture.js +7 -9
- package/dist/tui/listen_capture.js.map +1 -1
- package/dist/tui/session_chat_app.js +2 -2
- package/dist/tui/session_chat_app.js.map +1 -1
- package/dist/tui/session_chat_controller.js +89 -13
- package/dist/tui/session_chat_controller.js.map +1 -1
- package/dist/tui/terminal.js +13 -2
- package/dist/tui/terminal.js.map +1 -1
- package/package.json +9 -9
- package/dist/diff_tool/app/dist/assets/index-DSKn9aHV.js +0 -205
- package/dist/diff_tool/app/dist/assets/langs-Cb6u03GG.js +0 -1
- package/dist/diff_tool/app/dist/assets/lib-BFrBoEqQ.js +0 -9
- package/dist/diff_tool/app/dist/assets/shiki-DaptjTao.js +0 -2
- package/dist/diff_tool/app/dist/assets/wasm-BnjxR4X6.js +0 -1
|
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
import { resolvePromptTemplateWithBackend } from "../core/config/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { AgentHistoryRecorder } from "../core/history/agent_history_recorder.js";
|
|
6
6
|
import { McpManager } from "../core/mcp/manager.js";
|
|
7
7
|
import { resolvePersonaSelection } from "../core/persona_selection.js";
|
|
8
8
|
import { ChatRuntime } from "../core/runtime/chat_runtime.js";
|
|
@@ -29,13 +29,11 @@ export class LocalSessionHost {
|
|
|
29
29
|
historyRemote;
|
|
30
30
|
onShutdown;
|
|
31
31
|
clientToolBroker = new ClientToolBroker();
|
|
32
|
-
mcp;
|
|
33
32
|
sessionOptions;
|
|
34
33
|
shutdownPromise;
|
|
35
34
|
shuttingDown = false;
|
|
36
35
|
constructor(options) {
|
|
37
|
-
const { store, history, historyRemote,
|
|
38
|
-
this.mcp = new McpManager(mcpServers);
|
|
36
|
+
const { store, history, historyRemote, onShutdown, ...sessionOptions } = options;
|
|
39
37
|
this.store = store;
|
|
40
38
|
this.history = history;
|
|
41
39
|
this.historyRemote = historyRemote;
|
|
@@ -150,16 +148,27 @@ export class LocalSessionHost {
|
|
|
150
148
|
discoveredSkills: bootstrap.discoveredSkills,
|
|
151
149
|
includeAgentContext: this.sessionOptions.includeAgentContext,
|
|
152
150
|
});
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
151
|
+
const mcp = new McpManager(executionEnvironment.snapshot().kind === "local" ? bootstrap.config.mcpServers : {});
|
|
152
|
+
const mcpState = executionEnvironment.snapshot().kind === "local"
|
|
153
|
+
? {
|
|
154
|
+
status: "available",
|
|
155
|
+
servers: mcp
|
|
156
|
+
.listServers()
|
|
157
|
+
.map(({ name }) => name)
|
|
158
|
+
.sort(),
|
|
159
|
+
}
|
|
160
|
+
: { status: "unavailable", reason: "remote-execution" };
|
|
161
|
+
const catalog = createContentCatalogSnapshot(bootstrap, mcpState);
|
|
162
|
+
return this.createLocalSessionHandleFromRuntimeContext(executionEnvironment, runtimeContext, bootstrap, catalog, mcp, remoteCatalog, committedSnapshot, createParams, forceNextSnapshotRevision);
|
|
163
|
+
}
|
|
164
|
+
async createLocalSessionHandleFromRuntimeContext(executionEnvironment, runtimeContext, bootstrap, catalog, mcp, remoteCatalog, committedSnapshot, createParams, forceNextSnapshotRevision = false) {
|
|
160
165
|
let hostedSession;
|
|
161
166
|
const sessionId = committedSnapshot?.sessionId ?? randomUUID();
|
|
162
167
|
const createdAt = committedSnapshot?.createdAt ?? this.sessionOptions.environment.now();
|
|
168
|
+
const attributes = committedSnapshot?.attributes ?? createParams?.attributes;
|
|
169
|
+
if (!attributes) {
|
|
170
|
+
throw new Error("session attributes are required");
|
|
171
|
+
}
|
|
163
172
|
const runtime = ChatRuntime.create({
|
|
164
173
|
sessionId,
|
|
165
174
|
createdAt,
|
|
@@ -178,11 +187,24 @@ export class LocalSessionHost {
|
|
|
178
187
|
eventSink: async (event) => await hostedSession.enqueueRuntimeEvent(event),
|
|
179
188
|
subagentEventSink: async (event) => await hostedSession.recordSubagentEvent(event),
|
|
180
189
|
history: this.history.query(this.historyRemote),
|
|
181
|
-
|
|
190
|
+
openSubagentHistory: (child) => {
|
|
191
|
+
const recorder = new AgentHistoryRecorder(this.history.openSession({
|
|
192
|
+
sessionId: child.sessionId,
|
|
193
|
+
parentSessionId: sessionId,
|
|
194
|
+
attributes: { ...attributes, cwd: child.workingDirectory },
|
|
195
|
+
createdAt: child.createdAt,
|
|
196
|
+
}, this.historyRemote));
|
|
197
|
+
return async (event) => {
|
|
198
|
+
const failure = recorder.record(event);
|
|
199
|
+
if (failure)
|
|
200
|
+
await hostedSession.recordSubagentHistoryFailure(failure);
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
mcp,
|
|
182
204
|
initialPromptComposition: committedSnapshot
|
|
183
205
|
? promptCompositionFromSnapshot(committedSnapshot)
|
|
184
206
|
: undefined,
|
|
185
|
-
config: bootstrap.config
|
|
207
|
+
config: bootstrap.config,
|
|
186
208
|
recordUsage: this.sessionOptions.recordUsage,
|
|
187
209
|
deps: this.sessionOptions.deps,
|
|
188
210
|
});
|
|
@@ -191,21 +213,11 @@ export class LocalSessionHost {
|
|
|
191
213
|
: createParams?.autoCompactThresholdTokens !== undefined
|
|
192
214
|
? createParams.autoCompactThresholdTokens
|
|
193
215
|
: (bootstrap.initialAutoCompactThresholdTokens ?? null));
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
throw new Error("session attributes are required");
|
|
197
|
-
}
|
|
198
|
-
hostedSession = new LocalHostedSessionHandle(runtime, runtimeContext.promptBootstrap, catalog, bootstrap, remoteCatalog, this.sessionOptions.getRemoteModelCatalog, this.sessionOptions.includeAgentContext, executionEnvironment, this.store, this.history, this.historyRemote, attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, this.sessionOptions.recordUsage ?? appendUsageLogEntry, (session) => {
|
|
216
|
+
const historyWriter = this.history.openSession({ sessionId, attributes, createdAt }, this.historyRemote);
|
|
217
|
+
hostedSession = new LocalHostedSessionHandle(runtime, runtimeContext.promptBootstrap, catalog, mcp, bootstrap, remoteCatalog, this.sessionOptions.getRemoteModelCatalog, this.sessionOptions.includeAgentContext, executionEnvironment, this.store, new AgentHistoryRecorder(historyWriter), attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, this.sessionOptions.recordUsage ?? appendUsageLogEntry, (session) => {
|
|
199
218
|
this.sessions.delete(session);
|
|
200
219
|
this.sessionReferences.delete(session);
|
|
201
|
-
this.history.forgetSession(session.sessionId);
|
|
202
220
|
});
|
|
203
|
-
const historyFailure = this.history.registerSession({
|
|
204
|
-
sessionId: committedSnapshot?.sessionId ?? hostedSession.sessionId,
|
|
205
|
-
attributes,
|
|
206
|
-
createdAt,
|
|
207
|
-
}, this.historyRemote);
|
|
208
|
-
await hostedSession.recordHistoryFailure(historyFailure);
|
|
209
221
|
this.sessions.add(hostedSession);
|
|
210
222
|
return hostedSession;
|
|
211
223
|
}
|
|
@@ -417,12 +429,6 @@ export class LocalSessionHost {
|
|
|
417
429
|
}
|
|
418
430
|
}
|
|
419
431
|
this.sessionEvictions.clear();
|
|
420
|
-
try {
|
|
421
|
-
await this.mcp.close();
|
|
422
|
-
}
|
|
423
|
-
catch (error) {
|
|
424
|
-
errors.push(error);
|
|
425
|
-
}
|
|
426
432
|
try {
|
|
427
433
|
await this.history.flush();
|
|
428
434
|
}
|
|
@@ -466,14 +472,14 @@ class LocalHostedSessionHandle {
|
|
|
466
472
|
runtime;
|
|
467
473
|
promptBootstrap;
|
|
468
474
|
catalog;
|
|
475
|
+
mcp;
|
|
469
476
|
bootstrap;
|
|
470
477
|
remoteCatalog;
|
|
471
478
|
getLatestRemoteModelCatalog;
|
|
472
479
|
includeAgentContext;
|
|
473
480
|
executionEnvironment;
|
|
474
481
|
store;
|
|
475
|
-
|
|
476
|
-
historyRemote;
|
|
482
|
+
historyRecorder;
|
|
477
483
|
attributes;
|
|
478
484
|
createdAt;
|
|
479
485
|
recordUsage;
|
|
@@ -508,26 +514,28 @@ class LocalHostedSessionHandle {
|
|
|
508
514
|
disposePromise;
|
|
509
515
|
disposing = false;
|
|
510
516
|
costTotal = 0;
|
|
517
|
+
boundMcpServers;
|
|
511
518
|
forceNextSnapshotRevision;
|
|
512
519
|
projectionFailure;
|
|
513
520
|
disposed = false;
|
|
514
|
-
constructor(runtime, promptBootstrap, catalog, bootstrap, remoteCatalog, getLatestRemoteModelCatalog, includeAgentContext, executionEnvironment, store,
|
|
521
|
+
constructor(runtime, promptBootstrap, catalog, mcp, bootstrap, remoteCatalog, getLatestRemoteModelCatalog, includeAgentContext, executionEnvironment, store, historyRecorder, attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, recordUsage, removeFromHost = () => { }) {
|
|
515
522
|
this.runtime = runtime;
|
|
516
523
|
this.promptBootstrap = promptBootstrap;
|
|
517
524
|
this.catalog = catalog;
|
|
525
|
+
this.mcp = mcp;
|
|
518
526
|
this.bootstrap = bootstrap;
|
|
519
527
|
this.remoteCatalog = remoteCatalog;
|
|
520
528
|
this.getLatestRemoteModelCatalog = getLatestRemoteModelCatalog;
|
|
521
529
|
this.includeAgentContext = includeAgentContext;
|
|
522
530
|
this.executionEnvironment = executionEnvironment;
|
|
523
531
|
this.store = store;
|
|
524
|
-
this.
|
|
525
|
-
this.historyRemote = historyRemote;
|
|
532
|
+
this.historyRecorder = historyRecorder;
|
|
526
533
|
this.attributes = attributes;
|
|
527
534
|
this.createdAt = createdAt;
|
|
528
535
|
this.recordUsage = recordUsage;
|
|
529
536
|
this.removeFromHost = removeFromHost;
|
|
530
537
|
this.session = runtime;
|
|
538
|
+
this.boundMcpServers = structuredClone(catalog.mcp.status === "available" ? bootstrap.config.mcpServers : {});
|
|
531
539
|
this.persistedSnapshot = committedSnapshot
|
|
532
540
|
? cloneSessionProtocolSnapshot(committedSnapshot)
|
|
533
541
|
: undefined;
|
|
@@ -875,7 +883,7 @@ class LocalHostedSessionHandle {
|
|
|
875
883
|
modelResolver: runtimeConfig.bootstrap.modelResolver.resolveModel,
|
|
876
884
|
config: runtimeConfig.config,
|
|
877
885
|
};
|
|
878
|
-
this.catalog = createContentCatalogSnapshot(this.bootstrap, this.catalog.
|
|
886
|
+
this.catalog = createContentCatalogSnapshot(this.bootstrap, this.catalog.mcp);
|
|
879
887
|
const snapshot = await this.commitSnapshot();
|
|
880
888
|
this.emitSnapshotReset("configuration", snapshot);
|
|
881
889
|
return snapshot;
|
|
@@ -912,12 +920,20 @@ class LocalHostedSessionHandle {
|
|
|
912
920
|
modelResolver: runtimeConfig.bootstrap.modelResolver.resolveModel,
|
|
913
921
|
config: runtimeConfig.config,
|
|
914
922
|
};
|
|
915
|
-
this.catalog = createContentCatalogSnapshot(this.bootstrap, this.catalog.
|
|
923
|
+
this.catalog = createContentCatalogSnapshot(this.bootstrap, this.catalog.mcp);
|
|
916
924
|
const snapshot = await this.commitSnapshot();
|
|
917
925
|
this.emitSnapshotReset("configuration", snapshot);
|
|
918
926
|
return {
|
|
919
927
|
snapshot,
|
|
920
|
-
warnings:
|
|
928
|
+
warnings: [
|
|
929
|
+
...runtimeConfig.warnings,
|
|
930
|
+
...(this.catalog.mcp.status === "available" &&
|
|
931
|
+
!isDeepStrictEqual(this.boundMcpServers, runtimeConfig.config.mcpServers)
|
|
932
|
+
? [
|
|
933
|
+
"MCP configuration changed; new definitions take effect after this session unloads and is opened again.",
|
|
934
|
+
]
|
|
935
|
+
: []),
|
|
936
|
+
],
|
|
921
937
|
counts: {
|
|
922
938
|
personas: runtimeConfig.personas.length,
|
|
923
939
|
prompts: runtimeConfig.prompts.length,
|
|
@@ -1166,6 +1182,12 @@ class LocalHostedSessionHandle {
|
|
|
1166
1182
|
catch (error) {
|
|
1167
1183
|
errors.push(error);
|
|
1168
1184
|
}
|
|
1185
|
+
try {
|
|
1186
|
+
await this.mcp.close();
|
|
1187
|
+
}
|
|
1188
|
+
catch (error) {
|
|
1189
|
+
errors.push(error);
|
|
1190
|
+
}
|
|
1169
1191
|
try {
|
|
1170
1192
|
await this.executionEnvironment.dispose();
|
|
1171
1193
|
}
|
|
@@ -1529,7 +1551,10 @@ class LocalHostedSessionHandle {
|
|
|
1529
1551
|
await this.enqueueMutation(() => this.applySubagentEvent(event));
|
|
1530
1552
|
}
|
|
1531
1553
|
async enqueueRuntimeEvent(event) {
|
|
1532
|
-
await this.enqueueMutation(() =>
|
|
1554
|
+
await this.enqueueMutation(async () => {
|
|
1555
|
+
await this.recordRuntimeEvent(event);
|
|
1556
|
+
await this.recordHistoryFailure(this.historyRecorder.record(event));
|
|
1557
|
+
});
|
|
1533
1558
|
}
|
|
1534
1559
|
removeToolRun(tool, changes) {
|
|
1535
1560
|
this.tools.delete(tool.id);
|
|
@@ -1541,6 +1566,16 @@ class LocalHostedSessionHandle {
|
|
|
1541
1566
|
}
|
|
1542
1567
|
changes.push({ type: "tool.remove", id: tool.id }, { type: "timeline.remove", id: timelineItemId });
|
|
1543
1568
|
}
|
|
1569
|
+
async recordSubagentHistoryFailure(reason) {
|
|
1570
|
+
if (this.disposing || this.disposed)
|
|
1571
|
+
return;
|
|
1572
|
+
try {
|
|
1573
|
+
await this.enqueueMutation(() => this.recordHistoryFailure(reason));
|
|
1574
|
+
}
|
|
1575
|
+
catch {
|
|
1576
|
+
// A history diagnostic must not fail a worker when its parent is unavailable.
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1544
1579
|
async recordHistoryFailure(reason) {
|
|
1545
1580
|
if (!reason || this.timeline.items.some((item) => item.id === HISTORY_UNAVAILABLE_NOTICE_ID)) {
|
|
1546
1581
|
return;
|
|
@@ -1571,15 +1606,13 @@ class LocalHostedSessionHandle {
|
|
|
1571
1606
|
if (tool.status === "queued" || tool.status === "running") {
|
|
1572
1607
|
throw new Error(`transcript tool call '${tool.toolCallId}' is not terminal`);
|
|
1573
1608
|
}
|
|
1574
|
-
await this.recordHistoryFailure(this.
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
}),
|
|
1582
|
-
], this.historyRemote));
|
|
1609
|
+
await this.recordHistoryFailure(this.historyRecorder.recordTool({
|
|
1610
|
+
callHistoryEntryId: tool.call.messageId,
|
|
1611
|
+
resultHistoryEntryId,
|
|
1612
|
+
call,
|
|
1613
|
+
result,
|
|
1614
|
+
outcome: tool.status,
|
|
1615
|
+
}));
|
|
1583
1616
|
}
|
|
1584
1617
|
agentStateChange() {
|
|
1585
1618
|
const state = this.session.snapshot();
|
|
@@ -1722,7 +1755,6 @@ class LocalHostedSessionHandle {
|
|
|
1722
1755
|
},
|
|
1723
1756
|
},
|
|
1724
1757
|
], { persist: true });
|
|
1725
|
-
await this.recordHistoryFailure(this.history.append(this.sessionId, [systemHistoryEntry(event.historyEntryId, event.message)], this.historyRemote));
|
|
1726
1758
|
return;
|
|
1727
1759
|
}
|
|
1728
1760
|
case "user_message": {
|
|
@@ -1755,7 +1787,6 @@ class LocalHostedSessionHandle {
|
|
|
1755
1787
|
if (turn) {
|
|
1756
1788
|
this.pendingAcceptedTurnHistoryEntryIds.delete(event.historyEntryId);
|
|
1757
1789
|
}
|
|
1758
|
-
await this.recordHistoryFailure(this.history.append(this.sessionId, [userHistoryEntry(event.historyEntryId, event.message)], this.historyRemote));
|
|
1759
1790
|
return;
|
|
1760
1791
|
}
|
|
1761
1792
|
case "history_rewound": {
|
|
@@ -1767,7 +1798,6 @@ class LocalHostedSessionHandle {
|
|
|
1767
1798
|
this.timeline.items = this.timeline.items.filter((item) => item.sequence <= cutoffSequence);
|
|
1768
1799
|
const snapshot = await this.commitSnapshot({ removeMissingAgents: true });
|
|
1769
1800
|
this.emitSnapshotReset({ type: "rewind", epoch: this.timeline.epoch, cutoffSequence }, snapshot);
|
|
1770
|
-
await this.recordHistoryFailure(this.history.truncateFromSources(this.sessionId, event.removedEntryIds, this.historyRemote));
|
|
1771
1801
|
return;
|
|
1772
1802
|
}
|
|
1773
1803
|
case "assistant_final": {
|
|
@@ -1815,7 +1845,6 @@ class LocalHostedSessionHandle {
|
|
|
1815
1845
|
: []),
|
|
1816
1846
|
...toolChanges,
|
|
1817
1847
|
]);
|
|
1818
|
-
await this.recordHistoryFailure(this.history.append(this.sessionId, assistantHistoryEntries(event.historyEntryId, event.message), this.historyRemote));
|
|
1819
1848
|
return;
|
|
1820
1849
|
}
|
|
1821
1850
|
case "tool_run_queued":
|
|
@@ -1873,7 +1902,6 @@ class LocalHostedSessionHandle {
|
|
|
1873
1902
|
},
|
|
1874
1903
|
{ type: "tool.set", tool: structuredClone(nextTool) },
|
|
1875
1904
|
]);
|
|
1876
|
-
await this.appendToolHistory(existing, event.historyEntryId, event.message);
|
|
1877
1905
|
return;
|
|
1878
1906
|
}
|
|
1879
1907
|
await this.emitPatch("tool-result", [
|
|
@@ -1903,7 +1931,6 @@ class LocalHostedSessionHandle {
|
|
|
1903
1931
|
},
|
|
1904
1932
|
},
|
|
1905
1933
|
];
|
|
1906
|
-
const historyTools = [];
|
|
1907
1934
|
for (const toolResult of event.toolResults) {
|
|
1908
1935
|
const existing = this.tools.get(toolResult.toolCallId);
|
|
1909
1936
|
if (!existing || existing.status === "streaming") {
|
|
@@ -1917,12 +1944,8 @@ class LocalHostedSessionHandle {
|
|
|
1917
1944
|
};
|
|
1918
1945
|
this.tools.set(nextTool.id, nextTool);
|
|
1919
1946
|
changes.push({ type: "tool.set", tool: structuredClone(nextTool) });
|
|
1920
|
-
historyTools.push({ tool: existing, result: toolResult });
|
|
1921
1947
|
}
|
|
1922
1948
|
await this.emitPatch({ type: "resync" }, changes);
|
|
1923
|
-
for (const { tool, result } of historyTools) {
|
|
1924
|
-
await this.appendToolHistory(tool, event.historyEntryId, result);
|
|
1925
|
-
}
|
|
1926
1949
|
return;
|
|
1927
1950
|
}
|
|
1928
1951
|
case "feedback": {
|
|
@@ -2567,10 +2590,10 @@ function cloneResolvedBootstrap(bootstrap) {
|
|
|
2567
2590
|
personas: bootstrap.personas.map(clonePersona),
|
|
2568
2591
|
prompts: structuredClone(bootstrap.prompts),
|
|
2569
2592
|
modelResolver: bootstrap.modelResolver,
|
|
2570
|
-
|
|
2593
|
+
config: structuredClone(bootstrap.config),
|
|
2571
2594
|
};
|
|
2572
2595
|
}
|
|
2573
|
-
function createContentCatalogSnapshot(bootstrap,
|
|
2596
|
+
function createContentCatalogSnapshot(bootstrap, mcp) {
|
|
2574
2597
|
return {
|
|
2575
2598
|
personas: bootstrap.personas.map(personaSnapshotFromPersona),
|
|
2576
2599
|
prompts: bootstrap.prompts.map((prompt) => ({
|
|
@@ -2582,7 +2605,8 @@ function createContentCatalogSnapshot(bootstrap, mcpServers) {
|
|
|
2582
2605
|
description: skill.description,
|
|
2583
2606
|
path: skill.path,
|
|
2584
2607
|
})),
|
|
2585
|
-
|
|
2608
|
+
mcp: structuredClone(mcp),
|
|
2609
|
+
speechVocabulary: [...bootstrap.config.speechVocabulary],
|
|
2586
2610
|
};
|
|
2587
2611
|
}
|
|
2588
2612
|
function clonePersona(persona) {
|