@0xmaxma/claude-gateway 2.0.6 → 2.0.7
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 +14 -1
- package/dist/agent/builtin-commands.js +5 -5
- package/dist/agent/builtin-commands.js.map +1 -1
- package/dist/agent/command-help.d.ts +9 -0
- package/dist/agent/command-help.d.ts.map +1 -0
- package/dist/agent/command-help.js +50 -0
- package/dist/agent/command-help.js.map +1 -0
- package/dist/agent/dreaming/index.d.ts +6 -3
- package/dist/agent/dreaming/index.d.ts.map +1 -1
- package/dist/agent/dreaming/index.js +21 -1
- package/dist/agent/dreaming/index.js.map +1 -1
- package/dist/agent/knowledge/reflection.d.ts +7 -4
- package/dist/agent/knowledge/reflection.d.ts.map +1 -1
- package/dist/agent/knowledge/reflection.js +19 -1
- package/dist/agent/knowledge/reflection.js.map +1 -1
- package/dist/agent/runner.d.ts +37 -3
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +164 -47
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/session-confirmations.d.ts +12 -0
- package/dist/agent/session-confirmations.d.ts.map +1 -0
- package/dist/agent/session-confirmations.js +43 -0
- package/dist/agent/session-confirmations.js.map +1 -0
- package/dist/agent/session-status.d.ts +7 -0
- package/dist/agent/session-status.d.ts.map +1 -0
- package/dist/agent/session-status.js +16 -0
- package/dist/agent/session-status.js.map +1 -0
- package/dist/agent/skill-learning/index.d.ts +5 -1
- package/dist/agent/skill-learning/index.d.ts.map +1 -1
- package/dist/agent/skill-learning/index.js +23 -1
- package/dist/agent/skill-learning/index.js.map +1 -1
- package/dist/agent/skill-learning/notifier.d.ts +2 -1
- package/dist/agent/skill-learning/notifier.d.ts.map +1 -1
- package/dist/agent/skill-learning/notifier.js +1 -0
- package/dist/agent/skill-learning/notifier.js.map +1 -1
- package/dist/api/apps-router.d.ts.map +1 -1
- package/dist/api/apps-router.js +1 -3
- package/dist/api/apps-router.js.map +1 -1
- package/dist/api/cron-router.d.ts +1 -1
- package/dist/api/cron-router.d.ts.map +1 -1
- package/dist/api/cron-router.js +4 -4
- package/dist/api/cron-router.js.map +1 -1
- package/dist/api/dashboard-processes.d.ts +86 -0
- package/dist/api/dashboard-processes.d.ts.map +1 -0
- package/dist/api/dashboard-processes.js +155 -0
- package/dist/api/dashboard-processes.js.map +1 -0
- package/dist/api/dashboard-sessions.d.ts +15 -0
- package/dist/api/dashboard-sessions.d.ts.map +1 -0
- package/dist/api/dashboard-sessions.js +66 -0
- package/dist/api/dashboard-sessions.js.map +1 -0
- package/dist/api/gateway-router.d.ts +3 -4
- package/dist/api/gateway-router.d.ts.map +1 -1
- package/dist/api/gateway-router.js +77 -56
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/api/oauth-connectors-router.d.ts +1 -1
- package/dist/api/oauth-connectors-router.d.ts.map +1 -1
- package/dist/api/oauth-connectors-router.js +11 -21
- package/dist/api/oauth-connectors-router.js.map +1 -1
- package/dist/api/router.d.ts +1 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +3 -9
- package/dist/api/router.js.map +1 -1
- package/dist/api/share-router.d.ts +1 -1
- package/dist/api/share-router.d.ts.map +1 -1
- package/dist/api/share-router.js +1 -1
- package/dist/api/share-router.js.map +1 -1
- package/dist/api/slack-webhook-router.js +1 -1
- package/dist/api/slack-webhook-router.js.map +1 -1
- package/dist/api/voice-router.d.ts +1 -0
- package/dist/api/voice-router.d.ts.map +1 -1
- package/dist/api/voice-router.js +7 -0
- package/dist/api/voice-router.js.map +1 -1
- package/dist/apps/agent-container-migration.d.ts +2 -0
- package/dist/apps/agent-container-migration.d.ts.map +1 -1
- package/dist/apps/agent-container-migration.js +59 -2
- package/dist/apps/agent-container-migration.js.map +1 -1
- package/dist/apps/agent-manager.d.ts +4 -2
- package/dist/apps/agent-manager.d.ts.map +1 -1
- package/dist/apps/agent-manager.js +39 -3
- package/dist/apps/agent-manager.js.map +1 -1
- package/dist/apps/installer.d.ts +4 -3
- package/dist/apps/installer.d.ts.map +1 -1
- package/dist/apps/installer.js +8 -4
- package/dist/apps/installer.js.map +1 -1
- package/dist/build-provenance.json +8 -0
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/app.d.ts.map +1 -1
- package/dist/cli/commands/app.js +39 -3
- package/dist/cli/commands/app.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +6 -2
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/safemode.d.ts +2 -0
- package/dist/cli/commands/safemode.d.ts.map +1 -0
- package/dist/cli/commands/safemode.js +279 -0
- package/dist/cli/commands/safemode.js.map +1 -0
- package/dist/cli/dependencies.d.ts +2 -0
- package/dist/cli/dependencies.d.ts.map +1 -1
- package/dist/cli/dependencies.js +81 -0
- package/dist/cli/dependencies.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +11 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/manager.d.ts.map +1 -1
- package/dist/cli/manager.js +4 -1
- package/dist/cli/manager.js.map +1 -1
- package/dist/config/agent-lifecycle.d.ts +26 -0
- package/dist/config/agent-lifecycle.d.ts.map +1 -0
- package/dist/config/agent-lifecycle.js +63 -0
- package/dist/config/agent-lifecycle.js.map +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +11 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/reload-policy.d.ts +9 -0
- package/dist/config/reload-policy.d.ts.map +1 -0
- package/dist/config/reload-policy.js +62 -0
- package/dist/config/reload-policy.js.map +1 -0
- package/dist/config/watcher.d.ts +3 -2
- package/dist/config/watcher.d.ts.map +1 -1
- package/dist/config/watcher.js +34 -51
- package/dist/config/watcher.js.map +1 -1
- package/dist/cron/tool-schemas.d.ts +296 -0
- package/dist/cron/tool-schemas.d.ts.map +1 -0
- package/dist/cron/tool-schemas.js +122 -0
- package/dist/cron/tool-schemas.js.map +1 -0
- package/dist/index.js +141 -158
- package/dist/index.js.map +1 -1
- package/dist/orchestration/agent-tool-schemas.js +4 -4
- package/dist/orchestration/agent-tool-schemas.js.map +1 -1
- package/dist/orchestration/background-work.d.ts +9 -0
- package/dist/orchestration/background-work.d.ts.map +1 -0
- package/dist/orchestration/background-work.js +49 -0
- package/dist/orchestration/background-work.js.map +1 -0
- package/dist/orchestration/bridge.d.ts +6 -15
- package/dist/orchestration/bridge.d.ts.map +1 -1
- package/dist/orchestration/bridge.js +67 -32
- package/dist/orchestration/bridge.js.map +1 -1
- package/dist/orchestration/capabilities.d.ts.map +1 -1
- package/dist/orchestration/capabilities.js +18 -10
- package/dist/orchestration/capabilities.js.map +1 -1
- package/dist/orchestration/capacity.d.ts +3 -2
- package/dist/orchestration/capacity.d.ts.map +1 -1
- package/dist/orchestration/capacity.js +7 -0
- package/dist/orchestration/capacity.js.map +1 -1
- package/dist/orchestration/channel-controls.d.ts.map +1 -1
- package/dist/orchestration/channel-controls.js +3 -2
- package/dist/orchestration/channel-controls.js.map +1 -1
- package/dist/orchestration/cli-skills.d.ts +5 -0
- package/dist/orchestration/cli-skills.d.ts.map +1 -1
- package/dist/orchestration/container-tool-schemas.d.ts +37 -0
- package/dist/orchestration/container-tool-schemas.d.ts.map +1 -0
- package/dist/orchestration/container-tool-schemas.js +27 -0
- package/dist/orchestration/container-tool-schemas.js.map +1 -0
- package/dist/orchestration/container.d.ts.map +1 -1
- package/dist/orchestration/container.js +7 -0
- package/dist/orchestration/container.js.map +1 -1
- package/dist/orchestration/dashboard-reader-worker.js +7 -7
- package/dist/orchestration/dashboard-reader-worker.js.map +1 -1
- package/dist/orchestration/decision-context.js +1 -1
- package/dist/orchestration/decision-context.js.map +1 -1
- package/dist/orchestration/gateway-tasks/controller.d.ts +29 -0
- package/dist/orchestration/gateway-tasks/controller.d.ts.map +1 -0
- package/dist/orchestration/gateway-tasks/controller.js +139 -0
- package/dist/orchestration/gateway-tasks/controller.js.map +1 -0
- package/dist/orchestration/gateway-tasks/safemode.d.ts +19 -0
- package/dist/orchestration/gateway-tasks/safemode.d.ts.map +1 -0
- package/dist/orchestration/gateway-tasks/safemode.js +128 -0
- package/dist/orchestration/gateway-tasks/safemode.js.map +1 -0
- package/dist/orchestration/process-turn.d.ts +11 -2
- package/dist/orchestration/process-turn.d.ts.map +1 -1
- package/dist/orchestration/process-turn.js +47 -7
- package/dist/orchestration/process-turn.js.map +1 -1
- package/dist/orchestration/recovery.d.ts.map +1 -1
- package/dist/orchestration/recovery.js +4 -2
- package/dist/orchestration/recovery.js.map +1 -1
- package/dist/orchestration/runtime.d.ts +10 -0
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +31 -4
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/skills.d.ts +2 -0
- package/dist/orchestration/skills.d.ts.map +1 -1
- package/dist/orchestration/skills.js +4 -3
- package/dist/orchestration/skills.js.map +1 -1
- package/dist/orchestration/task-controls.d.ts +12 -0
- package/dist/orchestration/task-controls.d.ts.map +1 -1
- package/dist/orchestration/task-controls.js +3 -1
- package/dist/orchestration/task-controls.js.map +1 -1
- package/dist/orchestration/tasks/driver.d.ts.map +1 -1
- package/dist/orchestration/tasks/driver.js +99 -12
- package/dist/orchestration/tasks/driver.js.map +1 -1
- package/dist/orchestration/tasks/pool.d.ts +2 -0
- package/dist/orchestration/tasks/pool.d.ts.map +1 -1
- package/dist/orchestration/tasks/pool.js +4 -0
- package/dist/orchestration/tasks/pool.js.map +1 -1
- package/dist/orchestration/tasks/scheduler.d.ts.map +1 -1
- package/dist/orchestration/tasks/scheduler.js +4 -0
- package/dist/orchestration/tasks/scheduler.js.map +1 -1
- package/dist/orchestration/tasks/service.d.ts +4 -0
- package/dist/orchestration/tasks/service.d.ts.map +1 -1
- package/dist/orchestration/tasks/service.js +38 -8
- package/dist/orchestration/tasks/service.js.map +1 -1
- package/dist/orchestration/token-ledger.d.ts +1 -0
- package/dist/orchestration/token-ledger.d.ts.map +1 -1
- package/dist/orchestration/token-ledger.js +6 -2
- package/dist/orchestration/token-ledger.js.map +1 -1
- package/dist/orchestration/token-usage.d.ts +3 -0
- package/dist/orchestration/token-usage.d.ts.map +1 -1
- package/dist/orchestration/token-usage.js +12 -3
- package/dist/orchestration/token-usage.js.map +1 -1
- package/dist/orchestration/types.d.ts +19 -1
- package/dist/orchestration/types.d.ts.map +1 -1
- package/dist/orchestration/types.js.map +1 -1
- package/dist/orchestration/worker-crons.d.ts +5 -0
- package/dist/orchestration/worker-crons.d.ts.map +1 -0
- package/dist/orchestration/worker-crons.js +84 -0
- package/dist/orchestration/worker-crons.js.map +1 -0
- package/dist/orchestration/worker-harness.d.ts +15 -0
- package/dist/orchestration/worker-harness.d.ts.map +1 -0
- package/dist/orchestration/worker-harness.js +72 -0
- package/dist/orchestration/worker-harness.js.map +1 -0
- package/dist/safemode/config.d.ts +7 -0
- package/dist/safemode/config.d.ts.map +1 -0
- package/dist/safemode/config.js +67 -0
- package/dist/safemode/config.js.map +1 -0
- package/dist/safemode/context.d.ts +7 -0
- package/dist/safemode/context.d.ts.map +1 -0
- package/dist/safemode/context.js +397 -0
- package/dist/safemode/context.js.map +1 -0
- package/dist/safemode/external-owners.d.ts +19 -0
- package/dist/safemode/external-owners.d.ts.map +1 -0
- package/dist/safemode/external-owners.js +229 -0
- package/dist/safemode/external-owners.js.map +1 -0
- package/dist/safemode/native.d.ts +38 -0
- package/dist/safemode/native.d.ts.map +1 -0
- package/dist/safemode/native.js +220 -0
- package/dist/safemode/native.js.map +1 -0
- package/dist/safemode/params.d.ts +10 -0
- package/dist/safemode/params.d.ts.map +1 -0
- package/dist/safemode/params.js +86 -0
- package/dist/safemode/params.js.map +1 -0
- package/dist/safemode/provenance.d.ts +45 -0
- package/dist/safemode/provenance.d.ts.map +1 -0
- package/dist/safemode/provenance.js +153 -0
- package/dist/safemode/provenance.js.map +1 -0
- package/dist/safemode/runner.d.ts +17 -0
- package/dist/safemode/runner.d.ts.map +1 -0
- package/dist/safemode/runner.js +398 -0
- package/dist/safemode/runner.js.map +1 -0
- package/dist/safemode/store.d.ts +56 -0
- package/dist/safemode/store.d.ts.map +1 -0
- package/dist/safemode/store.js +451 -0
- package/dist/safemode/store.js.map +1 -0
- package/dist/session/codex-auth.d.ts +37 -0
- package/dist/session/codex-auth.d.ts.map +1 -0
- package/dist/session/codex-auth.js +266 -0
- package/dist/session/codex-auth.js.map +1 -0
- package/dist/session/codex-container-runtime.d.ts +15 -0
- package/dist/session/codex-container-runtime.d.ts.map +1 -0
- package/dist/session/codex-container-runtime.js +85 -0
- package/dist/session/codex-container-runtime.js.map +1 -0
- package/dist/session/codex-context-defaults.json +5 -0
- package/dist/session/codex-context.d.ts +13 -0
- package/dist/session/codex-context.d.ts.map +1 -0
- package/dist/session/codex-context.js +27 -0
- package/dist/session/codex-context.js.map +1 -0
- package/dist/session/codex-extension-discovery.d.ts +21 -0
- package/dist/session/codex-extension-discovery.d.ts.map +1 -0
- package/dist/session/codex-extension-discovery.js +132 -0
- package/dist/session/codex-extension-discovery.js.map +1 -0
- package/dist/session/codex-native-mcp-client.d.ts +37 -0
- package/dist/session/codex-native-mcp-client.d.ts.map +1 -0
- package/dist/session/codex-native-mcp-client.js +164 -0
- package/dist/session/codex-native-mcp-client.js.map +1 -0
- package/dist/session/codex-policy.d.ts +6 -0
- package/dist/session/codex-policy.d.ts.map +1 -0
- package/dist/session/codex-policy.js +17 -0
- package/dist/session/codex-policy.js.map +1 -0
- package/dist/session/codex-process.d.ts +114 -0
- package/dist/session/codex-process.d.ts.map +1 -0
- package/dist/session/codex-process.js +759 -0
- package/dist/session/codex-process.js.map +1 -0
- package/dist/session/codex-runtime.d.ts +20 -0
- package/dist/session/codex-runtime.d.ts.map +1 -0
- package/dist/session/codex-runtime.js +182 -0
- package/dist/session/codex-runtime.js.map +1 -0
- package/dist/session/codex-tool-capture.d.ts +35 -0
- package/dist/session/codex-tool-capture.d.ts.map +1 -0
- package/dist/session/codex-tool-capture.js +178 -0
- package/dist/session/codex-tool-capture.js.map +1 -0
- package/dist/session/container-connectors.d.ts +10 -0
- package/dist/session/container-connectors.d.ts.map +1 -0
- package/dist/session/container-connectors.js +41 -0
- package/dist/session/container-connectors.js.map +1 -0
- package/dist/session/container-extensions.d.ts +4 -0
- package/dist/session/container-extensions.d.ts.map +1 -0
- package/dist/session/container-extensions.js +45 -0
- package/dist/session/container-extensions.js.map +1 -0
- package/dist/session/managed-connectors.d.ts +16 -0
- package/dist/session/managed-connectors.d.ts.map +1 -0
- package/dist/session/managed-connectors.js +25 -0
- package/dist/session/managed-connectors.js.map +1 -0
- package/dist/session/process-diagnostics.d.ts +14 -0
- package/dist/session/process-diagnostics.d.ts.map +1 -0
- package/dist/session/process-diagnostics.js +39 -0
- package/dist/session/process-diagnostics.js.map +1 -0
- package/dist/session/process.d.ts +4 -0
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +21 -16
- package/dist/session/process.js.map +1 -1
- package/dist/session/request-tool-capture.d.ts +1 -1
- package/dist/session/request-tool-capture.d.ts.map +1 -1
- package/dist/session/runtime-profile.d.ts +8 -0
- package/dist/session/runtime-profile.d.ts.map +1 -1
- package/dist/session/runtime-profile.js +3 -2
- package/dist/session/runtime-profile.js.map +1 -1
- package/dist/session/worker-environment.d.ts +5 -0
- package/dist/session/worker-environment.d.ts.map +1 -0
- package/dist/session/worker-environment.js +27 -0
- package/dist/session/worker-environment.js.map +1 -0
- package/dist/session/worker-extensions.d.ts +20 -0
- package/dist/session/worker-extensions.d.ts.map +1 -0
- package/dist/session/worker-extensions.js +322 -0
- package/dist/session/worker-extensions.js.map +1 -0
- package/dist/skills/loader.d.ts +2 -0
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js.map +1 -1
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/codex-context.d.ts +4 -0
- package/dist/ui/codex-context.d.ts.map +1 -0
- package/dist/ui/codex-context.js +15 -0
- package/dist/ui/codex-context.js.map +1 -0
- package/dist/ui/dashboard-client.d.ts.map +1 -1
- package/dist/ui/dashboard-client.js +14 -11
- package/dist/ui/dashboard-client.js.map +1 -1
- package/dist/ui/dashboard-presentation.d.ts +1 -1
- package/dist/ui/dashboard-presentation.d.ts.map +1 -1
- package/dist/ui/dashboard-presentation.js +2 -2
- package/dist/ui/dashboard-presentation.js.map +1 -1
- package/dist/ui/token-report.d.ts +3 -0
- package/dist/ui/token-report.d.ts.map +1 -1
- package/dist/ui/token-report.js +22 -10
- package/dist/ui/token-report.js.map +1 -1
- package/dist/ui/web-ui.d.ts.map +1 -1
- package/dist/ui/web-ui.js +53 -132
- package/dist/ui/web-ui.js.map +1 -1
- package/mcp/capability-catalog.ts +2 -0
- package/mcp/extension-catalog.ts +18 -0
- package/mcp/lazy-connector.ts +4 -2
- package/mcp/lazy-tools.test.ts +29 -0
- package/mcp/modules.ts +1 -0
- package/mcp/server.ts +2 -2
- package/mcp/tools/cron/module.ts +8 -114
- package/mcp/tools/discord/commands.ts +4 -1
- package/mcp/tools/safemode/module.test.ts +29 -0
- package/mcp/tools/telegram/receiver-server.ts +2 -22
- package/mcp/tools/telegram/task-detail.ts +2 -1
- package/package.json +3 -2
- package/scripts/orchestration/audit-codex-context.cjs +83 -0
- package/scripts/orchestration/benchmark-worker-harnesses.cjs +112 -0
- package/scripts/orchestration/smoke-codex-extensions.ts +29 -0
- package/scripts/orchestration/smoke-codex-worker.cjs +166 -0
- package/scripts/orchestration/smoke-safemode-codex.cjs +66 -0
|
@@ -11,12 +11,14 @@ function recoverOrchestration(store) {
|
|
|
11
11
|
store.run("UPDATE assistant_responses SET state='interrupted',completed_at=? WHERE state='generating'", now);
|
|
12
12
|
const inputs = Number(store.run("UPDATE conversation_inputs SET status='accepted' WHERE status='assigned'").changes);
|
|
13
13
|
store.run("UPDATE notifications SET status='pending',decision_id=NULL WHERE status='assigned'");
|
|
14
|
+
let uncertainTasks = 0;
|
|
14
15
|
const rows = store.all('SELECT snapshot_json FROM tasks WHERE active_attempt_id IS NOT NULL');
|
|
15
16
|
for (const row of rows) {
|
|
16
17
|
const task = JSON.parse(String(row.snapshot_json));
|
|
17
|
-
if (task.state === 'needs_reconciliation')
|
|
18
|
+
if (task.state === 'needs_reconciliation' || task.gatewayTarget)
|
|
18
19
|
continue;
|
|
19
20
|
const attempt = store.attempt(task.activeAttemptId);
|
|
21
|
+
uncertainTasks++;
|
|
20
22
|
attempt.state = 'unknown';
|
|
21
23
|
task.state = 'needs_reconciliation';
|
|
22
24
|
task.latestProgress = { source: 'runtime', observedAt: now, text: 'Gateway restarted; process liveness and side effects require reconciliation.' };
|
|
@@ -29,7 +31,7 @@ function recoverOrchestration(store) {
|
|
|
29
31
|
store.run("UPDATE deliveries SET state='unknown',updated_at=? WHERE state='sending'", now);
|
|
30
32
|
store.run("UPDATE task_resources SET lifecycle_state='cleanup_unknown' WHERE lifecycle_state='archiving'");
|
|
31
33
|
store.run("UPDATE outbox SET state='pending',lease_owner=NULL,lease_expires_at=NULL WHERE state='processing' AND kind!='delivery'");
|
|
32
|
-
return { inputs, uncertainTasks
|
|
34
|
+
return { inputs, uncertainTasks };
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
//# sourceMappingURL=recovery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../src/orchestration/recovery.ts"],"names":[],"mappings":";;AAKA,
|
|
1
|
+
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../src/orchestration/recovery.ts"],"names":[],"mappings":";;AAKA,oDA2BC;AA7BD;iFACiF;AACjF,SAAgB,oBAAoB,CAAC,KAAyB;IAC5D,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,CAAC,GAAG,CAAC,mJAAmJ,CAAC,CAAC;QAC/J,KAAK,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AAC;QAC3G,KAAK,CAAC,GAAG,CAAC,wHAAwH,CAAC,CAAC;QACpI,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -53,6 +53,7 @@ export declare class AgentOrchestrationRuntime {
|
|
|
53
53
|
private readonly history;
|
|
54
54
|
private readonly delivery;
|
|
55
55
|
private readonly scheduler;
|
|
56
|
+
private gatewayTasks?;
|
|
56
57
|
private nextQuestionCheck;
|
|
57
58
|
private readonly scheduledReports;
|
|
58
59
|
private readonly seenSessions;
|
|
@@ -136,6 +137,8 @@ export declare class AgentOrchestrationRuntime {
|
|
|
136
137
|
compactSession(sessionId: string, model?: string): Promise<CompactMeasurements | null>;
|
|
137
138
|
private compactionMaintenance;
|
|
138
139
|
runSessionCompaction(config: ResolvedSessionCompaction, window: (model: string) => Promise<number>): Promise<import("./session-compaction").CompactionRun>;
|
|
140
|
+
/** Lightweight live ownership only: no transcript or token-ledger scans. */
|
|
141
|
+
processOwners(): import('../api/dashboard-processes').ProcessOwner[];
|
|
139
142
|
sessionContextWindow(sessionId: string): {
|
|
140
143
|
used: number;
|
|
141
144
|
total: number | null;
|
|
@@ -209,6 +212,8 @@ export declare class AgentOrchestrationRuntime {
|
|
|
209
212
|
sessionId: string | number | null;
|
|
210
213
|
state: string | number | null;
|
|
211
214
|
title: any;
|
|
215
|
+
executionType: string;
|
|
216
|
+
gatewayTarget: any;
|
|
212
217
|
execution: any;
|
|
213
218
|
workerId: string | undefined;
|
|
214
219
|
workstreamId: any;
|
|
@@ -216,6 +221,7 @@ export declare class AgentOrchestrationRuntime {
|
|
|
216
221
|
resumed: boolean | undefined;
|
|
217
222
|
attemptId: string | undefined;
|
|
218
223
|
workerSessionId: string | undefined;
|
|
224
|
+
targetSessionId: any;
|
|
219
225
|
hostProcessId: number | undefined;
|
|
220
226
|
container: string | undefined;
|
|
221
227
|
lastTool: {
|
|
@@ -250,6 +256,8 @@ export declare class AgentOrchestrationRuntime {
|
|
|
250
256
|
sessionId: string | number | null;
|
|
251
257
|
state: string | number | null;
|
|
252
258
|
title: any;
|
|
259
|
+
executionType: string;
|
|
260
|
+
gatewayTarget: any;
|
|
253
261
|
execution: any;
|
|
254
262
|
workerId: string | undefined;
|
|
255
263
|
workstreamId: any;
|
|
@@ -257,6 +265,7 @@ export declare class AgentOrchestrationRuntime {
|
|
|
257
265
|
resumed: boolean | undefined;
|
|
258
266
|
attemptId: string | undefined;
|
|
259
267
|
workerSessionId: string | undefined;
|
|
268
|
+
targetSessionId: any;
|
|
260
269
|
hostProcessId: number | undefined;
|
|
261
270
|
container: string | undefined;
|
|
262
271
|
lastTool: {
|
|
@@ -311,6 +320,7 @@ export declare class AgentOrchestrationRuntime {
|
|
|
311
320
|
private run;
|
|
312
321
|
stopResponse(sessionId: string, reason?: 'user' | 'barge-in'): boolean;
|
|
313
322
|
flushHistory(): Promise<void>;
|
|
323
|
+
hasPendingWork(): boolean;
|
|
314
324
|
drain(): void;
|
|
315
325
|
canReturnToLegacy(): boolean;
|
|
316
326
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/orchestration/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/orchestration/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAA+C,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAMrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAejD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAA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GAAG,OAAO,CAAC,MAAM,CAAC;IAiB1I,4FAA4F;IAC5F,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAkB/C,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,aAAa,CAAC;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;IA8B1N,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,WAAW;YA0CL,GAAG;IA2iBjB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,UAAmB,GAAG,OAAO;IASxE,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAGnC,cAAc,IAAI,OAAO;IAGzB,KAAK,IAAI,IAAI;IAIb,iBAAiB,IAAI,OAAO;IAItB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAyB7B"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AgentOrchestrationRuntime = void 0;
|
|
4
|
+
const controller_1 = require("./gateway-tasks/controller");
|
|
5
|
+
const safemode_1 = require("./gateway-tasks/safemode");
|
|
6
|
+
const worker_crons_1 = require("./worker-crons");
|
|
4
7
|
const compact_measurements_1 = require("./compact-measurements");
|
|
5
8
|
const session_compaction_1 = require("./session-compaction");
|
|
6
9
|
const context_delivery_1 = require("./context-delivery");
|
|
@@ -72,6 +75,7 @@ const task_files_1 = require("./task-files");
|
|
|
72
75
|
const worker_shares_1 = require("./worker-shares");
|
|
73
76
|
/** Stable instructions are carried in the system prefix, not appended to every
|
|
74
77
|
* resumed user turn. Per-turn authorization flags remain explicit below it. */
|
|
78
|
+
const GATEWAY_TASK_INSTRUCTIONS = 'For safemode discovery use capabilities_list(scope=safemode); this creates no task. For authorized work on a discovered session use task_spawn(target_profile=gateway-managed, gateway_target={adapter:safemode,session_id:...}). Gateway-managed tasks are followed by the gateway and report results automatically; never spawn a polling worker.';
|
|
75
79
|
const CONTEXT_DELIVERY_INSTRUCTIONS = 'Worker profiles: default-worker is the general-purpose worker for research, files, browser/API operations, services, calculations and code. In host mode it uses the Agent working environment; no Git or projectRoot is required. In container mode it stays inside the app container. Only explicitly configured isolated-worktree mode requires Git for default-worker; media-worker remains available for standalone scratch work in isolated modes. State the authorized working directory in task instructions; workers may change directories only within their execution boundary. Serialize conflicting edits to the same shared files; continue related work with continue_task_id. Task context is incremental within a resumed CLI conversation. Omission means unchanged, not deleted. On a fresh context only active/waiting tasks and current reports are bootstrapped; use task_status for other past work or full results. Receipt recovery is evidence, not authorization to replay a command. Previously supplied materials remain in the resumed context; preserve their references when assigning workers. Never infer that missing image bytes mean a missing attachment if its ref was already supplied.';
|
|
76
80
|
class AgentOrchestrationRuntime {
|
|
77
81
|
setBrowserVoice(sessionId, principalId, enabled) {
|
|
@@ -184,7 +188,9 @@ class AgentOrchestrationRuntime {
|
|
|
184
188
|
}
|
|
185
189
|
const tasks = new service_1.TaskService(store, agent.orchestration, agent.workspace);
|
|
186
190
|
const files = new task_files_1.TaskFiles(store, (0, path_1.join)(agent.workspace, '../..'), agent.type === 'app-agent' ? (0, path_1.join)(root, 'container-files') : undefined, agent.workspace);
|
|
187
|
-
const
|
|
191
|
+
const safemodeAllowed = () => agent.type !== 'app-agent' && Boolean(gateway.safemode?.allowedAgentIds?.includes(agent.id));
|
|
192
|
+
const gatewayAdapters = new Map(agent.type === 'app-agent' ? [] : [['safemode', new safemode_1.SafemodeTaskAdapter(agent.id, safemodeAllowed)]]);
|
|
193
|
+
const bridge = new bridge_1.TaskBridge(tasks, files, (0, worker_shares_1.workerShares)(files, agent, gateway), host.skills ? () => host.skills() : undefined, agent.type === 'app-agent' ? { agent, spool: (0, path_1.join)(root, 'container-files') } : undefined, (0, worker_crons_1.workerCrons)(files, agent, gateway), gatewayAdapters);
|
|
188
194
|
const personalRetention = (0, config_1.resolveDreamingConfig)(agent.dreaming, gateway.gateway.dreaming, gateway.gateway.timezone).staleness;
|
|
189
195
|
const sharedRetention = (0, knowledge_1.resolveSharedConfig)(agent.knowledge?.shared, gateway.gateway.knowledge?.shared).staleness;
|
|
190
196
|
bridge.recordRetrievals = (personalRetention.enabled && personalRetention.recordRetrievals) || (sharedRetention.enabled && sharedRetention.recordRetrievals);
|
|
@@ -195,6 +201,8 @@ class AgentOrchestrationRuntime {
|
|
|
195
201
|
// their global capacity conservatively as well as the per-agent slots.
|
|
196
202
|
const recoveredReservations = new Map();
|
|
197
203
|
for (const row of store.all("SELECT id FROM tasks WHERE state='needs_reconciliation' AND active_attempt_id IS NOT NULL")) {
|
|
204
|
+
if (store.task(String(row.id))?.gatewayTarget)
|
|
205
|
+
continue;
|
|
198
206
|
recoveredReservations.set(String(row.id), (0, capacity_1.gatewayCapacity)(gateway).acquireWorker(agent.id, String(row.id), false));
|
|
199
207
|
}
|
|
200
208
|
if (agent.orchestration?.enabled)
|
|
@@ -222,6 +230,8 @@ class AgentOrchestrationRuntime {
|
|
|
222
230
|
runtime.drain();
|
|
223
231
|
await runtime.flushHistory();
|
|
224
232
|
scheduler.start();
|
|
233
|
+
runtime.gatewayTasks = new controller_1.GatewayTaskController(tasks, gatewayAdapters);
|
|
234
|
+
runtime.gatewayTasks.start();
|
|
225
235
|
runtime.mailboxTimer = setInterval(() => {
|
|
226
236
|
try {
|
|
227
237
|
runtime.pumpMailbox();
|
|
@@ -423,6 +433,18 @@ class AgentOrchestrationRuntime {
|
|
|
423
433
|
void operation.finally(() => this.pending.delete(operation)).catch(() => { });
|
|
424
434
|
return operation;
|
|
425
435
|
}
|
|
436
|
+
/** Lightweight live ownership only: no transcript or token-ledger scans. */
|
|
437
|
+
processOwners() {
|
|
438
|
+
return this.store.all(`SELECT t.snapshot_json,a.payload_json FROM tasks t JOIN task_attempts a
|
|
439
|
+
ON a.id=t.active_attempt_id WHERE t.active_attempt_id IS NOT NULL`).flatMap(row => {
|
|
440
|
+
const task = JSON.parse(String(row.snapshot_json)), attempt = JSON.parse(String(row.payload_json));
|
|
441
|
+
const pid = attempt.processIdentity?.pid;
|
|
442
|
+
return Number.isInteger(pid) ? [{ pid, startTicks: attempt.processIdentity?.startTicks, group: 'worker', agentId: this.agent.id,
|
|
443
|
+
sessionId: task.agentSessionId, taskId: task.taskId, title: task.title,
|
|
444
|
+
harness: attempt.harness ?? 'claude', model: attempt.harnessModel ?? task.model,
|
|
445
|
+
container: this.agent.type === 'app-agent' ? this.agent.container : undefined }] : [];
|
|
446
|
+
});
|
|
447
|
+
}
|
|
426
448
|
sessionContextWindow(sessionId) {
|
|
427
449
|
if (!this.store.get("SELECT name FROM sqlite_master WHERE name='token_turns'"))
|
|
428
450
|
return null;
|
|
@@ -447,8 +469,8 @@ class AgentOrchestrationRuntime {
|
|
|
447
469
|
const tool = event ? JSON.parse(String(event.payload_json)).payload : undefined;
|
|
448
470
|
const measured = (0, token_ledger_1.summarizeTokenTurns)((0, token_ledger_1.measuredTurns)(this.store, String(row.agent_session_id)).filter(turn => turn.id === attempt?.attemptId));
|
|
449
471
|
return { tokenSummary: { totalTokens: measured.totalTokens }, contextTools: measured.contextTools, loadedTools: measured.loadedTools, usedTools: measured.usedTools, taskId: row.id, sessionId: row.agent_session_id, state: row.state, title: snapshot.title,
|
|
450
|
-
execution: snapshot.execution, workerId: attempt?.workerId, workstreamId: snapshot.workstreamId, continueTaskId: snapshot.continueTaskId, resumed: attempt?.resumeSession,
|
|
451
|
-
attemptId: attempt?.attemptId, workerSessionId: attempt?.sessionId, hostProcessId: row.active_attempt_id ? attempt?.processIdentity?.pid : undefined,
|
|
472
|
+
executionType: snapshot.gatewayTarget ? 'gateway-managed' : 'worker', gatewayTarget: snapshot.gatewayTarget, execution: snapshot.execution, workerId: attempt?.workerId, workstreamId: snapshot.workstreamId, continueTaskId: snapshot.continueTaskId, resumed: attempt?.resumeSession,
|
|
473
|
+
attemptId: attempt?.attemptId, workerSessionId: snapshot.gatewayTarget ? undefined : attempt?.sessionId, targetSessionId: snapshot.gatewayTarget?.sessionId, hostProcessId: row.active_attempt_id ? attempt?.processIdentity?.pid : undefined,
|
|
452
474
|
container: this.agent.type === 'app-agent' ? this.agent.container : undefined,
|
|
453
475
|
lastTool: tool ? { name: tool.name, type: tool.type, is_error: tool.is_error } : undefined };
|
|
454
476
|
});
|
|
@@ -1106,7 +1128,7 @@ class AgentOrchestrationRuntime {
|
|
|
1106
1128
|
// produced, while speech and review turns fill the optional fields their per-turn overlay
|
|
1107
1129
|
// asks for. This restores the structured-output guarantee without a per-turn tools diff.
|
|
1108
1130
|
ticket.profile.responseSchema = response_schema_1.ORCHESTRATION_RESPONSE_SCHEMA;
|
|
1109
|
-
ticket.profile.overlay += `\n\n${CONTEXT_DELIVERY_INSTRUCTIONS}\n\nOnly when the current turn explicitly enables semantic intake, apply these rules:\n${conversation_intake_1.INTAKE_OVERLAY}`;
|
|
1131
|
+
ticket.profile.overlay += `\n\n${CONTEXT_DELIVERY_INSTRUCTIONS}${this.agent.type !== 'app-agent' && this.gateway.safemode?.allowedAgentIds?.includes(this.agent.id) ? '\n' + GATEWAY_TASK_INSTRUCTIONS : ''}\n\nOnly when the current turn explicitly enables semantic intake, apply these rules:\n${conversation_intake_1.INTAKE_OVERLAY}`;
|
|
1110
1132
|
// Continue the CLI session this agent session already has a transcript for. Each decision
|
|
1111
1133
|
// turn is still its own process; resuming is what lets the next one reuse the previous
|
|
1112
1134
|
// turn's cached prefix instead of paying a full cache write, and it replaces the flattened
|
|
@@ -1129,6 +1151,7 @@ class AgentOrchestrationRuntime {
|
|
|
1129
1151
|
ticket.profile.excludedHistoryOperationIds = this.store.all(`SELECT r.id FROM assistant_responses r
|
|
1130
1152
|
JOIN conversation_decisions d ON d.id=r.decision_id WHERE d.session_id=? AND r.state='failed'`, sessionId)
|
|
1131
1153
|
.map(row => `response:${row.id}`);
|
|
1154
|
+
ticket.profile.responseId = decision.responseId;
|
|
1132
1155
|
agentSession = await this.host.createAgentSession(sessionId, ticket.profile, options.model, input.scope);
|
|
1133
1156
|
const reportingTasks = new Set(this.store.all("SELECT task_id FROM notifications WHERE decision_id=? AND status='assigned'", decision.decisionId).map(row => String(row.task_id)));
|
|
1134
1157
|
const taskCandidates = this.tasks.context(receipt.conversationId, input.scope.principalId, decision.decisionId)
|
|
@@ -1410,6 +1433,9 @@ class AgentOrchestrationRuntime {
|
|
|
1410
1433
|
for (const row of this.store.all("SELECT operation_id FROM history_operations WHERE state='pending' ORDER BY updated_at LIMIT 200"))
|
|
1411
1434
|
await this.history.write(String(row.operation_id));
|
|
1412
1435
|
}
|
|
1436
|
+
hasPendingWork() {
|
|
1437
|
+
return !!(this.active.size || this.pending.size || this.store.get("SELECT id FROM conversation_inputs WHERE status IN ('accepted','assigned') LIMIT 1") || this.store.get("SELECT id FROM tasks WHERE state NOT IN ('completed','failed','cancelled') LIMIT 1"));
|
|
1438
|
+
}
|
|
1413
1439
|
drain() {
|
|
1414
1440
|
this.draining = true;
|
|
1415
1441
|
this.store.run("UPDATE conversations SET status='draining' WHERE status='active'");
|
|
@@ -1437,6 +1463,7 @@ class AgentOrchestrationRuntime {
|
|
|
1437
1463
|
this.drain();
|
|
1438
1464
|
for (const sessionId of this.active.keys())
|
|
1439
1465
|
this.stopResponse(sessionId);
|
|
1466
|
+
await this.gatewayTasks?.close();
|
|
1440
1467
|
await this.scheduler.close();
|
|
1441
1468
|
await this.settleResources();
|
|
1442
1469
|
await Promise.allSettled([...this.pending]);
|