@markusylisiurunen/tau 0.3.55 → 0.3.56
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/auth/credential_store.js +1 -9
- package/dist/core/auth/credential_store.js.map +1 -1
- package/dist/core/cli.js +3 -0
- package/dist/core/cli.js.map +1 -1
- package/dist/core/config/runtime.js +4 -4
- package/dist/core/config/runtime.js.map +1 -1
- package/dist/core/config/runtime_config_snapshot.js +1 -1
- package/dist/core/config/runtime_config_snapshot.js.map +1 -1
- package/dist/core/models/catalog.js +11 -45
- package/dist/core/models/catalog.js.map +1 -1
- package/dist/core/models/cli.js +49 -0
- package/dist/core/models/cli.js.map +1 -0
- package/dist/core/models/remote_catalog.js +394 -0
- package/dist/core/models/remote_catalog.js.map +1 -0
- package/dist/core/personas.js +3 -3
- package/dist/core/static/tau_docs/getting-started.md +5 -1
- package/dist/core/static/tau_docs/models.md +12 -2
- package/dist/core/static/tau_docs/node-sdk.md +4 -1
- package/dist/core/static/tau_docs/security.md +5 -0
- package/dist/core/static/tau_docs/telegram.md +2 -2
- package/dist/core/static/tau_docs/tui.md +2 -2
- package/dist/core/telegram/adapter.js +2 -2
- package/dist/core/telegram/adapter.js.map +1 -1
- package/dist/core/telegram/local_session_client.js +1 -1
- package/dist/core/telegram/local_session_client.js.map +1 -1
- package/dist/core/telegram/tts.js +3 -4
- package/dist/core/telegram/tts.js.map +1 -1
- package/dist/core/utils/gemini_speech.js +435 -150
- package/dist/core/utils/gemini_speech.js.map +1 -1
- package/dist/core/utils/model_stream.js +0 -10
- package/dist/core/utils/model_stream.js.map +1 -1
- package/dist/core/utils/openai_transcription.js +164 -23
- package/dist/core/utils/openai_transcription.js.map +1 -1
- package/dist/core/utils/speech_to_text.js +1 -0
- package/dist/core/utils/speech_to_text.js.map +1 -1
- package/dist/core/version.js +2 -1
- package/dist/core/version.js.map +1 -1
- package/dist/execution/execution_environment.js.map +1 -1
- package/dist/execution/tool_backend_execution_environment.js +2 -1
- package/dist/execution/tool_backend_execution_environment.js.map +1 -1
- package/dist/host/execution_runtime.js +3 -1
- package/dist/host/execution_runtime.js.map +1 -1
- package/dist/host/local_session_host.js +37 -11
- package/dist/host/local_session_host.js.map +1 -1
- package/dist/main.js +52 -6
- package/dist/main.js.map +1 -1
- package/dist/sdk/local_client.d.ts +4 -1
- package/dist/sdk/local_client.js +32 -8
- package/dist/sdk/local_client.js.map +1 -1
- package/dist/sdk/types.d.ts +1 -0
- package/dist/tui/speech_playback.js +145 -82
- package/dist/tui/speech_playback.js.map +1 -1
- package/package.json +4 -4
- package/dist/core/models/tau_extensions.js +0 -27
- package/dist/core/models/tau_extensions.js.map +0 -1
|
@@ -23,15 +23,17 @@ export class LocalSessionHost {
|
|
|
23
23
|
store;
|
|
24
24
|
history;
|
|
25
25
|
historyRemote;
|
|
26
|
+
onShutdown;
|
|
26
27
|
clientToolBroker = new ClientToolBroker();
|
|
27
28
|
sessionOptions;
|
|
28
29
|
shutdownPromise;
|
|
29
30
|
shuttingDown = false;
|
|
30
31
|
constructor(options) {
|
|
31
|
-
const { store, history, historyRemote, ...sessionOptions } = options;
|
|
32
|
+
const { store, history, historyRemote, onShutdown, ...sessionOptions } = options;
|
|
32
33
|
this.store = store;
|
|
33
34
|
this.history = history;
|
|
34
35
|
this.historyRemote = historyRemote;
|
|
36
|
+
this.onShutdown = onShutdown;
|
|
35
37
|
this.sessionOptions = sessionOptions;
|
|
36
38
|
}
|
|
37
39
|
registerClientTools(options) {
|
|
@@ -99,7 +101,8 @@ export class LocalSessionHost {
|
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
async createLocalSessionHandle(executionEnvironment, committedSnapshot, createParams, forceNextSnapshotRevision = false) {
|
|
102
|
-
const
|
|
104
|
+
const remoteCatalog = this.sessionOptions.getRemoteModelCatalog();
|
|
105
|
+
const bootstrap = await this.resolveNewSessionBootstrap(executionEnvironment, remoteCatalog);
|
|
103
106
|
if (committedSnapshot) {
|
|
104
107
|
this.applySnapshotSettingsToBootstrap(bootstrap, committedSnapshot);
|
|
105
108
|
}
|
|
@@ -114,9 +117,9 @@ export class LocalSessionHost {
|
|
|
114
117
|
agentContextFiles: bootstrap.config?.agentContextFiles ?? [],
|
|
115
118
|
});
|
|
116
119
|
const catalog = createContentCatalogSnapshot(bootstrap);
|
|
117
|
-
return this.createLocalSessionHandleFromRuntimeContext(executionEnvironment, runtimeContext, bootstrap, catalog, committedSnapshot, createParams, forceNextSnapshotRevision);
|
|
120
|
+
return this.createLocalSessionHandleFromRuntimeContext(executionEnvironment, runtimeContext, bootstrap, catalog, remoteCatalog, committedSnapshot, createParams, forceNextSnapshotRevision);
|
|
118
121
|
}
|
|
119
|
-
async createLocalSessionHandleFromRuntimeContext(executionEnvironment, runtimeContext, bootstrap, catalog, committedSnapshot, createParams, forceNextSnapshotRevision = false) {
|
|
122
|
+
async createLocalSessionHandleFromRuntimeContext(executionEnvironment, runtimeContext, bootstrap, catalog, remoteCatalog, committedSnapshot, createParams, forceNextSnapshotRevision = false) {
|
|
120
123
|
let hostedSession;
|
|
121
124
|
const sessionId = committedSnapshot?.sessionId ?? randomUUID();
|
|
122
125
|
const createdAt = committedSnapshot?.createdAt ?? this.sessionOptions.environment.now();
|
|
@@ -130,6 +133,7 @@ export class LocalSessionHost {
|
|
|
130
133
|
resolveSubagentPrompts: createExecutionEnvironmentSubagentPromptResolver({
|
|
131
134
|
sessionId,
|
|
132
135
|
executionEnvironment,
|
|
136
|
+
getRemoteModelCatalog: () => hostedSession.getRemoteModelCatalog(),
|
|
133
137
|
includeAgentContext: this.sessionOptions.includeAgentContext,
|
|
134
138
|
sessionStartedAt: createdAt,
|
|
135
139
|
}),
|
|
@@ -153,7 +157,7 @@ export class LocalSessionHost {
|
|
|
153
157
|
if (!attributes) {
|
|
154
158
|
throw new Error("session attributes are required");
|
|
155
159
|
}
|
|
156
|
-
hostedSession = new LocalHostedSessionHandle(runtime, runtimeContext.promptBootstrap, catalog, bootstrap, this.sessionOptions.includeAgentContext, executionEnvironment, this.store, this.history, this.historyRemote, attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, this.sessionOptions.recordUsage ?? appendUsageLogEntry, (session) => this.sessions.delete(session));
|
|
160
|
+
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) => this.sessions.delete(session));
|
|
157
161
|
const historyFailure = this.history.registerSession({
|
|
158
162
|
sessionId: committedSnapshot?.sessionId ?? hostedSession.sessionId,
|
|
159
163
|
attributes,
|
|
@@ -163,12 +167,12 @@ export class LocalSessionHost {
|
|
|
163
167
|
this.sessions.add(hostedSession);
|
|
164
168
|
return hostedSession;
|
|
165
169
|
}
|
|
166
|
-
async resolveNewSessionBootstrap(executionEnvironment) {
|
|
170
|
+
async resolveNewSessionBootstrap(executionEnvironment, remoteCatalog) {
|
|
167
171
|
const resolver = this.sessionOptions.resolveSessionBootstrap;
|
|
168
172
|
if (!resolver) {
|
|
169
173
|
return this.defaultSessionBootstrap();
|
|
170
174
|
}
|
|
171
|
-
const bootstrap = await resolver({ executionEnvironment });
|
|
175
|
+
const bootstrap = await resolver({ executionEnvironment, remoteCatalog });
|
|
172
176
|
return cloneResolvedBootstrap(bootstrap);
|
|
173
177
|
}
|
|
174
178
|
applySnapshotSettingsToBootstrap(bootstrap, snapshot) {
|
|
@@ -286,6 +290,13 @@ export class LocalSessionHost {
|
|
|
286
290
|
}
|
|
287
291
|
async shutdownNow() {
|
|
288
292
|
const errors = [];
|
|
293
|
+
const resourceShutdown = this.onShutdown
|
|
294
|
+
? Promise.resolve()
|
|
295
|
+
.then(this.onShutdown)
|
|
296
|
+
.catch((error) => {
|
|
297
|
+
errors.push(error);
|
|
298
|
+
})
|
|
299
|
+
: undefined;
|
|
289
300
|
const recoveryResults = await Promise.allSettled(this.sessionRecoveryPromises.values());
|
|
290
301
|
for (const result of recoveryResults) {
|
|
291
302
|
if (result.status === "rejected") {
|
|
@@ -316,13 +327,19 @@ export class LocalSessionHost {
|
|
|
316
327
|
}
|
|
317
328
|
}
|
|
318
329
|
this.sessions.clear();
|
|
319
|
-
|
|
330
|
+
try {
|
|
331
|
+
await this.history.flush();
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
errors.push(error);
|
|
335
|
+
}
|
|
320
336
|
try {
|
|
321
337
|
this.history.close();
|
|
322
338
|
}
|
|
323
339
|
catch (error) {
|
|
324
340
|
errors.push(error);
|
|
325
341
|
}
|
|
342
|
+
await resourceShutdown;
|
|
326
343
|
if (errors.length > 0) {
|
|
327
344
|
throw new AggregateError(errors, "failed to shut down local session host");
|
|
328
345
|
}
|
|
@@ -354,6 +371,8 @@ class LocalHostedSessionHandle {
|
|
|
354
371
|
promptBootstrap;
|
|
355
372
|
catalog;
|
|
356
373
|
bootstrap;
|
|
374
|
+
remoteCatalog;
|
|
375
|
+
getLatestRemoteModelCatalog;
|
|
357
376
|
includeAgentContext;
|
|
358
377
|
executionEnvironment;
|
|
359
378
|
store;
|
|
@@ -397,11 +416,13 @@ class LocalHostedSessionHandle {
|
|
|
397
416
|
pendingGoalCommit;
|
|
398
417
|
forceNextSnapshotRevision;
|
|
399
418
|
disposed = false;
|
|
400
|
-
constructor(runtime, promptBootstrap, catalog, bootstrap, includeAgentContext, executionEnvironment, store, history, historyRemote, attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, recordUsage, removeFromHost = () => { }) {
|
|
419
|
+
constructor(runtime, promptBootstrap, catalog, bootstrap, remoteCatalog, getLatestRemoteModelCatalog, includeAgentContext, executionEnvironment, store, history, historyRemote, attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, recordUsage, removeFromHost = () => { }) {
|
|
401
420
|
this.runtime = runtime;
|
|
402
421
|
this.promptBootstrap = promptBootstrap;
|
|
403
422
|
this.catalog = catalog;
|
|
404
423
|
this.bootstrap = bootstrap;
|
|
424
|
+
this.remoteCatalog = remoteCatalog;
|
|
425
|
+
this.getLatestRemoteModelCatalog = getLatestRemoteModelCatalog;
|
|
405
426
|
this.includeAgentContext = includeAgentContext;
|
|
406
427
|
this.executionEnvironment = executionEnvironment;
|
|
407
428
|
this.store = store;
|
|
@@ -422,6 +443,9 @@ class LocalHostedSessionHandle {
|
|
|
422
443
|
this.forceNextSnapshotRevision = forceNextSnapshotRevision;
|
|
423
444
|
this.restoreProtocolState(committedSnapshot);
|
|
424
445
|
}
|
|
446
|
+
getRemoteModelCatalog() {
|
|
447
|
+
return this.remoteCatalog;
|
|
448
|
+
}
|
|
425
449
|
get isTurnRunning() {
|
|
426
450
|
return this.runtime.isTurnRunning;
|
|
427
451
|
}
|
|
@@ -870,7 +894,7 @@ class LocalHostedSessionHandle {
|
|
|
870
894
|
}
|
|
871
895
|
async setPersona(personaId) {
|
|
872
896
|
this.assertActive();
|
|
873
|
-
const runtimeConfig = await this.executionEnvironment.resolveRuntimeConfig(this.executionEnvironment.snapshot().cwd);
|
|
897
|
+
const runtimeConfig = await this.executionEnvironment.resolveRuntimeConfig(this.executionEnvironment.snapshot().cwd, { remoteCatalog: this.remoteCatalog });
|
|
874
898
|
const personas = runtimeConfig.personas.map((persona) => this.normalizeReloadedPersona(persona));
|
|
875
899
|
const persona = personas.find((persona) => persona.id.toLowerCase() === personaId.toLowerCase());
|
|
876
900
|
if (!persona) {
|
|
@@ -906,7 +930,8 @@ class LocalHostedSessionHandle {
|
|
|
906
930
|
}
|
|
907
931
|
async reload() {
|
|
908
932
|
this.assertActive();
|
|
909
|
-
const
|
|
933
|
+
const remoteCatalog = this.getLatestRemoteModelCatalog();
|
|
934
|
+
const runtimeConfig = await this.executionEnvironment.resolveRuntimeConfig(this.executionEnvironment.snapshot().cwd, { remoteCatalog });
|
|
910
935
|
if (runtimeConfig.personas.length === 0) {
|
|
911
936
|
throw new Error("reload failed: no personas available");
|
|
912
937
|
}
|
|
@@ -926,6 +951,7 @@ class LocalHostedSessionHandle {
|
|
|
926
951
|
this.runtime.setPersona(nextPersona, {
|
|
927
952
|
skillsBlock: runtimeContext.promptBootstrap.promptContext.skillsBlock,
|
|
928
953
|
});
|
|
954
|
+
this.remoteCatalog = remoteCatalog;
|
|
929
955
|
this.bootstrap = {
|
|
930
956
|
persona: clonePersona(nextPersona),
|
|
931
957
|
discoveredSkills: structuredClone(runtimeConfig.skills),
|