talon-agent 5.18.2 → 5.19.1
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/README.md +2 -1
- package/package.json +2 -2
- package/prompts/system/agent-brief.md +20 -3
- package/src/app.ts +13 -0
- package/src/backend/claude-sdk/handler.ts +4 -4
- package/src/backend/claude-sdk/mcp-ready.ts +16 -2
- package/src/backend/claude-sdk/one-shot.ts +32 -2
- package/src/backend/claude-sdk/stream.ts +2 -2
- package/src/backend/codex/auth.ts +1 -1
- package/src/backend/codex/handler/message.ts +11 -11
- package/src/backend/codex/init.ts +4 -9
- package/src/backend/codex/mcp-config.ts +1 -2
- package/src/backend/codex/oauth-incompat.ts +8 -4
- package/src/backend/codex/one-shot.ts +1 -1
- package/src/backend/openai-agents/builtins.ts +55 -27
- package/src/backend/openai-agents/factory.ts +3 -3
- package/src/backend/openai-agents/handler/message.ts +3 -5
- package/src/backend/openai-agents/mcp-pool.ts +10 -27
- package/src/backend/remote-server/chat-turn.ts +6 -6
- package/src/backend/remote-server/events.ts +1 -5
- package/src/backend/remote-server/index.ts +0 -1
- package/src/backend/remote-server/messages.ts +3 -7
- package/src/backend/remote-server/one-shot.ts +1 -3
- package/src/backend/remote-server/session-helpers.ts +1 -4
- package/src/backend/remote-server/sse-stream.ts +8 -9
- package/src/backend/runtime/metrics.ts +7 -13
- package/src/backend/runtime/sleep.ts +1 -2
- package/src/backend/runtime/turn/handle-retry.ts +48 -2
- package/src/backend/runtime/turn/handler-to-events.ts +3 -4
- package/src/bootstrap.ts +9 -1
- package/src/cli/doctor.ts +3 -0
- package/src/cli/index.ts +8 -10
- package/src/cli/logs.ts +148 -9
- package/src/cli/setup.ts +9 -11
- package/src/cli/status.ts +29 -0
- package/src/core/agent-runtime/README.md +5 -19
- package/src/core/agent-runtime/events.ts +3 -39
- package/src/core/agent-runtime/model-ref.ts +0 -8
- package/src/core/agents/registry.ts +65 -2
- package/src/core/auth/expiry-monitor.ts +9 -1
- package/src/core/auth/login-flow.ts +9 -1
- package/src/core/auth/status.ts +31 -3
- package/src/core/background/cron/scheduler.ts +25 -5
- package/src/core/background/dream/index.ts +29 -10
- package/src/core/background/failure-backoff.ts +30 -0
- package/src/core/background/heartbeat/agent.ts +2 -27
- package/src/core/background/heartbeat/index.ts +0 -2
- package/src/core/background/heartbeat/scheduler.ts +21 -13
- package/src/core/background/heartbeat/state.ts +10 -2
- package/src/core/background/isolated-agent.ts +6 -2
- package/src/core/background/pulse/pulse.ts +9 -0
- package/src/core/background/triggers/exit.ts +54 -0
- package/src/core/background/triggers/index.ts +1 -3
- package/src/core/background/triggers/resume.ts +2 -4
- package/src/core/backup/archive/tar.ts +14 -4
- package/src/core/backup/plan.ts +1 -0
- package/src/core/backup/restore.ts +21 -13
- package/src/core/backup/scheduler.ts +28 -9
- package/src/core/backup/snapshot.ts +43 -10
- package/src/core/backup/store.ts +7 -19
- package/src/core/backup/targets.ts +69 -17
- package/src/core/config/index.ts +14 -0
- package/src/core/daemon/crash-marker.ts +141 -0
- package/src/core/daemon/crash.ts +9 -2
- package/src/core/daemon/handoff.ts +15 -0
- package/src/core/daemon/health-alerts.ts +297 -0
- package/src/core/daemon/log-reader.ts +289 -0
- package/src/core/doctor/index.ts +18 -2
- package/src/core/doctor/logs.ts +124 -0
- package/src/core/doctor/types.ts +1 -1
- package/src/core/engine/backend-controller/index.ts +1 -13
- package/src/core/engine/backend-router/router.ts +1 -1
- package/src/core/engine/dispatcher.ts +55 -2
- package/src/core/engine/fault-text.ts +40 -0
- package/src/core/engine/gateway-actions/agents/index.ts +3 -2
- package/src/core/engine/gateway-actions/agents/report.ts +62 -0
- package/src/core/engine/gateway-actions/history.ts +2 -4
- package/src/core/engine/gateway-actions/mesh.ts +26 -14
- package/src/core/engine/gateway-actions/native/exec.ts +13 -16
- package/src/core/engine/gateway-actions/native/teleport.ts +1 -1
- package/src/core/engine/gateway.ts +60 -1
- package/src/core/engine/turn-health.ts +222 -0
- package/src/core/errors.ts +2 -2
- package/src/core/frontend-runtime/admin-notify.ts +1 -1
- package/src/core/frontend-runtime/alerts.ts +130 -0
- package/src/core/mcp-hub/children.ts +78 -29
- package/src/core/mcp-hub/index.ts +21 -18
- package/src/core/mcp-hub/proxy-server.ts +8 -4
- package/src/core/mcp-hub/talon-server.ts +5 -12
- package/src/core/mesh/credentials/store.ts +16 -1
- package/src/core/mesh/devices/registry.ts +1 -17
- package/src/core/mesh/devices/service.ts +49 -17
- package/src/core/mesh/devices/teleport.ts +14 -2
- package/src/core/mesh/links/node-binaries.ts +13 -6
- package/src/core/mesh/persist.ts +22 -10
- package/src/core/mesh/transfers/device-files.ts +5 -23
- package/src/core/mesh/transfers/transfers.ts +16 -3
- package/src/core/models/active-model.ts +2 -55
- package/src/core/plugin/actions.ts +19 -20
- package/src/core/plugin/builtins.ts +80 -90
- package/src/core/plugin/index.ts +1 -4
- package/src/core/plugin/loader.ts +25 -33
- package/src/core/plugin/mcp.ts +3 -5
- package/src/core/plugin/registry.ts +19 -35
- package/src/core/plugin/types.ts +2 -5
- package/src/core/prompt/assemble.ts +15 -3
- package/src/core/scripts/lua.ts +6 -2
- package/src/core/tasks/table.ts +8 -2
- package/src/core/tools/bridge.ts +2 -4
- package/src/core/tools/chat/cross-send.ts +1 -1
- package/src/core/tools/chat/messaging.ts +1 -1
- package/src/core/tools/index.ts +2 -2
- package/src/core/tools/mcp-env.ts +2 -59
- package/src/core/tools/ops/agents.ts +22 -1
- package/src/core/tools/schemas.ts +4 -9
- package/src/core/vfs/fusefs.ts +0 -5
- package/src/core/vfs/index.ts +9 -2
- package/src/core/vfs/mounts/diagnostics.ts +109 -0
- package/src/core/vfs/mounts/proc.ts +17 -1
- package/src/core/vfs/workspace.ts +7 -3
- package/src/core/weaver/shuttle.ts +8 -1
- package/src/core/weaver/turn-log.ts +320 -0
- package/src/core/weaver/weaver.ts +48 -5
- package/src/frontend/discord/actions/index.ts +8 -1
- package/src/frontend/discord/diagnostics.ts +82 -6
- package/src/frontend/discord/handlers/index.ts +0 -2
- package/src/frontend/discord/middleware.ts +7 -13
- package/src/frontend/discord/runtime.ts +1 -3
- package/src/frontend/health/delivery.ts +115 -0
- package/src/frontend/health/outage.ts +116 -0
- package/src/frontend/native/bridge/routes/chats.ts +3 -5
- package/src/frontend/native/bridge/server.ts +106 -21
- package/src/frontend/native/index.ts +1 -1
- package/src/frontend/native/media/media.ts +5 -1
- package/src/frontend/native/runtime.ts +12 -7
- package/src/frontend/native/surface/handlers.ts +1 -1
- package/src/frontend/native/surface/memory.ts +1 -1
- package/src/frontend/native/surface/models.ts +3 -3
- package/src/frontend/native/surface/settings.ts +20 -8
- package/src/frontend/native/turn/context.ts +6 -8
- package/src/frontend/native/turn/turn-meta.ts +2 -5
- package/src/frontend/native/turn/turn.ts +8 -10
- package/src/frontend/presentation/format.ts +2 -4
- package/src/frontend/presentation/session-status.ts +2 -6
- package/src/frontend/teams/actions.ts +8 -1
- package/src/frontend/teams/graph.ts +0 -1
- package/src/frontend/teams/index.ts +1 -4
- package/src/frontend/teams/poll.ts +40 -2
- package/src/frontend/teams/runtime.ts +14 -5
- package/src/frontend/telegram/actions/index.ts +4 -1
- package/src/frontend/telegram/actions/send.ts +8 -0
- package/src/frontend/telegram/handlers/context.ts +13 -2
- package/src/frontend/telegram/handlers/delivery.ts +12 -9
- package/src/frontend/telegram/handlers/index.ts +0 -2
- package/src/frontend/telegram/index.ts +35 -9
- package/src/frontend/telegram/polling/poll-health.ts +110 -0
- package/src/frontend/telegram/userbot.ts +100 -36
- package/src/frontend/terminal/builtins/session.ts +2 -2
- package/src/frontend/terminal/index.ts +1 -3
- package/src/frontend/terminal/renderer.ts +2 -18
- package/src/frontend/whatsapp/actions/index.ts +12 -1
- package/src/frontend/whatsapp/actions/messaging.ts +7 -2
- package/src/frontend/whatsapp/connection/connection.ts +29 -9
- package/src/frontend/whatsapp/connection/health.ts +89 -0
- package/src/frontend/whatsapp/connection/identity.ts +4 -4
- package/src/frontend/whatsapp/runtime.ts +11 -5
- package/src/native/blake3.ts +28 -2
- package/src/native/fusefs.ts +23 -5
- package/src/native/registry.ts +1 -1
- package/src/native/warden.ts +33 -5
- package/src/plugins/github/index.ts +0 -1
- package/src/plugins/mempalace/index.ts +9 -3
- package/src/plugins/playwright/index.ts +2 -4
- package/src/plugins/playwright/provision.ts +12 -4
- package/src/storage/chat-settings.ts +6 -1
- package/src/storage/cron.ts +29 -4
- package/src/storage/daily-log.ts +43 -47
- package/src/storage/db.ts +61 -33
- package/src/storage/history.ts +6 -1
- package/src/storage/journal.ts +9 -2
- package/src/storage/kv.ts +19 -6
- package/src/storage/media-index.ts +28 -6
- package/src/storage/repositories/chat-settings-repo.ts +8 -2
- package/src/storage/repositories/sessions-repo.ts +10 -3
- package/src/storage/scripts.ts +24 -13
- package/src/storage/sessions.ts +11 -2
- package/src/storage/skills.ts +21 -2
- package/src/storage/stickers.ts +17 -3
- package/src/storage/triggers.ts +8 -3
- package/src/storage/turn-meta.ts +25 -7
- package/src/util/log.ts +189 -6
- package/src/util/logging/turn-scope.ts +85 -0
- package/src/util/time.ts +3 -3
- package/src/util/watchdog.ts +30 -0
- package/src/core/engine/backend-controller/legacy.ts +0 -111
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Legacy single-active aliases (chat role).
|
|
3
|
-
*
|
|
4
|
-
* Preserved so consumers that pre-date the pool refactor stay green.
|
|
5
|
-
* All route to the chat role — the canonical "default" backend.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { Backend } from "../../agent-runtime/capabilities.js";
|
|
9
|
-
import type { TalonConfig } from "../../config/index.js";
|
|
10
|
-
import { type BackendInitContext } from "../../agent-runtime/backend-registry.js";
|
|
11
|
-
import { log } from "../../../util/log.js";
|
|
12
|
-
import { roleHolder } from "./holders.js";
|
|
13
|
-
import { pool, bindings, ctx, ensurePoolEntry } from "./state.js";
|
|
14
|
-
import {
|
|
15
|
-
getBackendForRole,
|
|
16
|
-
getBackendIdForRole,
|
|
17
|
-
getBackendLabelForRole,
|
|
18
|
-
cleanupBackendPool,
|
|
19
|
-
resetBackendPoolForTest,
|
|
20
|
-
} from "./pool.js";
|
|
21
|
-
import { rebindRole } from "./rebind.js";
|
|
22
|
-
import type { RebindResult } from "./types.js";
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Initialise the controller with a single backend bound to the chat
|
|
26
|
-
* role. Convenience for tests; production should use `initBackendPool`.
|
|
27
|
-
*/
|
|
28
|
-
export async function initBackendController(
|
|
29
|
-
id: string,
|
|
30
|
-
config: TalonConfig,
|
|
31
|
-
initContext: BackendInitContext,
|
|
32
|
-
): Promise<Backend> {
|
|
33
|
-
ctx.initCtx = initContext;
|
|
34
|
-
ctx.poolConfig = config;
|
|
35
|
-
const entry = await ensurePoolEntry(id, config);
|
|
36
|
-
const holder = roleHolder("chat");
|
|
37
|
-
entry.holders.add(holder);
|
|
38
|
-
bindings.set(holder, id);
|
|
39
|
-
log("backend-controller", `Active backend (chat): ${entry.label} (${id})`);
|
|
40
|
-
return entry.backend;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** Equivalent to `getBackendForRole("chat")`. Legacy alias. */
|
|
44
|
-
export function getActiveBackend(): Backend {
|
|
45
|
-
if (!bindings.has(roleHolder("chat"))) {
|
|
46
|
-
throw new Error(
|
|
47
|
-
"Backend controller not initialised — call initBackendController first",
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
return getBackendForRole("chat");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** Whether the chat role has been bound. Legacy alias. */
|
|
54
|
-
export function hasActiveBackend(): boolean {
|
|
55
|
-
return bindings.has(roleHolder("chat"));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Like `getActiveBackend` but returns `null` instead of throwing. */
|
|
59
|
-
export function getActiveBackendOrNull(): Backend | null {
|
|
60
|
-
if (!bindings.has(roleHolder("chat"))) return null;
|
|
61
|
-
try {
|
|
62
|
-
return getBackendForRole("chat");
|
|
63
|
-
} catch {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Id of the chat-role backend. Legacy alias. */
|
|
69
|
-
export function getActiveBackendId(): string {
|
|
70
|
-
if (!bindings.has(roleHolder("chat"))) {
|
|
71
|
-
throw new Error("Backend controller not initialised");
|
|
72
|
-
}
|
|
73
|
-
return getBackendIdForRole("chat");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** Label of the chat-role backend. Legacy alias. */
|
|
77
|
-
export function getActiveBackendLabel(): string {
|
|
78
|
-
if (!bindings.has(roleHolder("chat"))) {
|
|
79
|
-
throw new Error("Backend controller not initialised");
|
|
80
|
-
}
|
|
81
|
-
return getBackendLabelForRole("chat");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** Rebind the chat role. Legacy alias for `rebindRole("chat", id, config)`. */
|
|
85
|
-
export async function switchBackend(
|
|
86
|
-
id: string,
|
|
87
|
-
config: TalonConfig,
|
|
88
|
-
): Promise<RebindResult> {
|
|
89
|
-
if (!bindings.has(roleHolder("chat"))) {
|
|
90
|
-
return { ok: false, error: "Backend controller not initialised" };
|
|
91
|
-
}
|
|
92
|
-
const current = bindings.get(roleHolder("chat"));
|
|
93
|
-
if (current === id) {
|
|
94
|
-
const entry = pool.get(current);
|
|
95
|
-
return {
|
|
96
|
-
ok: false,
|
|
97
|
-
error: `Already on ${entry?.label ?? current}`,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
return rebindRole("chat", id, config);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** Tear down the entire pool. Legacy alias for `cleanupBackendPool`. */
|
|
104
|
-
export async function cleanupBackendController(): Promise<void> {
|
|
105
|
-
await cleanupBackendPool();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Reset state. Test-only. Legacy alias. */
|
|
109
|
-
export function resetBackendControllerForTest(): void {
|
|
110
|
-
resetBackendPoolForTest();
|
|
111
|
-
}
|