@0xmaxma/claude-gateway 2.0.5 → 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 +51 -3
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +228 -107
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/session-compaction-scheduler.d.ts +22 -0
- package/dist/agent/session-compaction-scheduler.d.ts.map +1 -0
- package/dist/agent/session-compaction-scheduler.js +40 -0
- package/dist/agent/session-compaction-scheduler.js.map +1 -0
- 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 +177 -66
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/api/memory-activity.d.ts +18 -0
- package/dist/api/memory-activity.d.ts.map +1 -0
- package/dist/api/memory-activity.js +97 -0
- package/dist/api/memory-activity.js.map +1 -0
- 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 +5 -5
- 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/compact-measurements.d.ts +21 -0
- package/dist/orchestration/compact-measurements.d.ts.map +1 -0
- package/dist/orchestration/compact-measurements.js +62 -0
- package/dist/orchestration/compact-measurements.js.map +1 -0
- package/dist/orchestration/config.d.ts +4 -0
- package/dist/orchestration/config.d.ts.map +1 -1
- package/dist/orchestration/config.js +1 -1
- package/dist/orchestration/config.js.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/context-delivery.d.ts +32 -0
- package/dist/orchestration/context-delivery.d.ts.map +1 -0
- package/dist/orchestration/context-delivery.js +101 -0
- package/dist/orchestration/context-delivery.js.map +1 -0
- package/dist/orchestration/conversation-intake.d.ts +10 -6
- package/dist/orchestration/conversation-intake.d.ts.map +1 -1
- package/dist/orchestration/conversation-intake.js +22 -8
- package/dist/orchestration/conversation-intake.js.map +1 -1
- package/dist/orchestration/dashboard-charts.d.ts +32 -0
- package/dist/orchestration/dashboard-charts.d.ts.map +1 -0
- package/dist/orchestration/dashboard-charts.js +77 -0
- package/dist/orchestration/dashboard-charts.js.map +1 -0
- package/dist/orchestration/dashboard-reader-worker.js +28 -10
- package/dist/orchestration/dashboard-reader-worker.js.map +1 -1
- package/dist/orchestration/dashboard-reader.d.ts +1 -1
- package/dist/orchestration/dashboard-reader.d.ts.map +1 -1
- package/dist/orchestration/dashboard-reader.js +2 -2
- package/dist/orchestration/dashboard-reader.js.map +1 -1
- package/dist/orchestration/decision-context.d.ts +1 -1
- package/dist/orchestration/decision-context.d.ts.map +1 -1
- package/dist/orchestration/decision-context.js +3 -3
- 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/mutation-recovery.d.ts +3 -2
- package/dist/orchestration/mutation-recovery.d.ts.map +1 -1
- package/dist/orchestration/mutation-recovery.js +8 -0
- package/dist/orchestration/mutation-recovery.js.map +1 -1
- package/dist/orchestration/native-compact.d.ts +4 -1
- package/dist/orchestration/native-compact.d.ts.map +1 -1
- package/dist/orchestration/native-compact.js +6 -2
- package/dist/orchestration/native-compact.js.map +1 -1
- package/dist/orchestration/process-turn.d.ts +12 -2
- package/dist/orchestration/process-turn.d.ts.map +1 -1
- package/dist/orchestration/process-turn.js +48 -8
- 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 +23 -1
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +191 -21
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/session-compaction.d.ts +59 -0
- package/dist/orchestration/session-compaction.d.ts.map +1 -0
- package/dist/orchestration/session-compaction.js +212 -0
- package/dist/orchestration/session-compaction.js.map +1 -0
- 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 +100 -13
- 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 +8 -0
- package/dist/orchestration/token-ledger.d.ts.map +1 -1
- package/dist/orchestration/token-ledger.js +7 -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 +33 -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-charts.d.ts +3 -0
- package/dist/ui/dashboard-charts.d.ts.map +1 -0
- package/dist/ui/dashboard-charts.js +130 -0
- package/dist/ui/dashboard-charts.js.map +1 -0
- package/dist/ui/dashboard-client.d.ts.map +1 -1
- package/dist/ui/dashboard-client.js +20 -21
- package/dist/ui/dashboard-client.js.map +1 -1
- package/dist/ui/dashboard-controls.d.ts +4 -0
- package/dist/ui/dashboard-controls.d.ts.map +1 -0
- package/dist/ui/dashboard-controls.js +27 -0
- package/dist/ui/dashboard-controls.js.map +1 -0
- package/dist/ui/dashboard-presentation.d.ts +4 -1
- package/dist/ui/dashboard-presentation.d.ts.map +1 -1
- package/dist/ui/dashboard-presentation.js +13 -7
- package/dist/ui/dashboard-presentation.js.map +1 -1
- package/dist/ui/dashboard-range.d.ts +3 -3
- package/dist/ui/dashboard-range.d.ts.map +1 -1
- package/dist/ui/dashboard-range.js +21 -5
- package/dist/ui/dashboard-range.js.map +1 -1
- package/dist/ui/dashboard-theme.d.ts +3 -1
- package/dist/ui/dashboard-theme.d.ts.map +1 -1
- package/dist/ui/dashboard-theme.js +80 -3
- package/dist/ui/dashboard-theme.js.map +1 -1
- package/dist/ui/memory-activity.d.ts +4 -0
- package/dist/ui/memory-activity.d.ts.map +1 -0
- package/dist/ui/memory-activity.js +115 -0
- package/dist/ui/memory-activity.js.map +1 -0
- package/dist/ui/token-report-client.d.ts +1 -1
- package/dist/ui/token-report-client.d.ts.map +1 -1
- package/dist/ui/token-report-client.js +1 -1
- package/dist/ui/token-report.d.ts +4 -0
- package/dist/ui/token-report.d.ts.map +1 -1
- package/dist/ui/token-report.js +38 -23
- package/dist/ui/token-report.js.map +1 -1
- package/dist/ui/web-ui.d.ts +1 -1
- package/dist/ui/web-ui.d.ts.map +1 -1
- package/dist/ui/web-ui.js +68 -370
- 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 +33 -39
- package/mcp/tools/telegram/session-browser.ts +10 -0
- 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
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionCompaction = void 0;
|
|
4
|
+
exports.resolveSessionCompaction = resolveSessionCompaction;
|
|
5
|
+
exports.recoverSessionCompaction = recoverSessionCompaction;
|
|
6
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
const token_ledger_1 = require("./token-ledger");
|
|
8
|
+
function resolveSessionCompaction(agent, global) {
|
|
9
|
+
const number = (key, fallback, min, max) => {
|
|
10
|
+
const value = agent?.[key] ?? global?.[key];
|
|
11
|
+
return typeof value === 'number' && Number.isFinite(value) ? Math.min(max, Math.max(min, value)) : fallback;
|
|
12
|
+
};
|
|
13
|
+
return { enabled: (agent?.enabled ?? global?.enabled) === true, thresholdPercent: number('thresholdPercent', 50, 1, 99),
|
|
14
|
+
quietMinutes: number('quietMinutes', 60, 1, 10080), maxSessionsPerRun: Math.floor(number('maxSessionsPerRun', 5, 1, 100)) };
|
|
15
|
+
}
|
|
16
|
+
// All agents share one native-compaction slot; user activity is rechecked after waiting.
|
|
17
|
+
let serial = Promise.resolve();
|
|
18
|
+
/** Recover audit state at runtime startup, before the lazy nightly manager exists.
|
|
19
|
+
* Keep measurement fences: an interrupted process may have finished compaction. */
|
|
20
|
+
function recoverSessionCompaction(store) {
|
|
21
|
+
if (!store.get("SELECT name FROM sqlite_master WHERE name='session_compaction_runs'") ||
|
|
22
|
+
!store.get("SELECT name FROM sqlite_master WHERE name='session_compaction_items'"))
|
|
23
|
+
return;
|
|
24
|
+
store.transaction(() => {
|
|
25
|
+
const now = Date.now();
|
|
26
|
+
for (const row of store.all("SELECT id FROM session_compaction_runs WHERE status='running'")) {
|
|
27
|
+
for (const item of store.all('SELECT session_id,payload_json FROM session_compaction_items WHERE run_id=?', row.id)) {
|
|
28
|
+
const value = JSON.parse(String(item.payload_json));
|
|
29
|
+
if (value.status === 'running')
|
|
30
|
+
store.run('UPDATE session_compaction_items SET payload_json=? WHERE run_id=? AND session_id=?', JSON.stringify({ ...value, status: 'failed', errorCode: 'INTERRUPTED', endedAt: now }), row.id, item.session_id);
|
|
31
|
+
}
|
|
32
|
+
store.run("UPDATE session_compaction_runs SET status='interrupted',ended_at=? WHERE id=?", now, row.id);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
class SessionCompaction {
|
|
37
|
+
constructor(store, agentId, deps) {
|
|
38
|
+
this.store = store;
|
|
39
|
+
this.agentId = agentId;
|
|
40
|
+
this.deps = deps;
|
|
41
|
+
store.run(`CREATE TABLE IF NOT EXISTS session_compaction_runs(id TEXT PRIMARY KEY,started_at INTEGER NOT NULL,ended_at INTEGER,status TEXT NOT NULL,config_json TEXT NOT NULL)`);
|
|
42
|
+
store.run(`CREATE TABLE IF NOT EXISTS session_compaction_items(run_id TEXT NOT NULL REFERENCES session_compaction_runs(id),session_id TEXT NOT NULL,payload_json TEXT NOT NULL,PRIMARY KEY(run_id,session_id))`);
|
|
43
|
+
store.run(`CREATE TABLE IF NOT EXISTS session_compaction_marks(session_id TEXT PRIMARY KEY,measurement_id TEXT NOT NULL,completed_at INTEGER NOT NULL)`);
|
|
44
|
+
recoverSessionCompaction(store);
|
|
45
|
+
}
|
|
46
|
+
report(limit = 100) {
|
|
47
|
+
return this.store.all('SELECT * FROM session_compaction_runs ORDER BY started_at DESC,id DESC LIMIT ?', Math.min(100, Math.max(1, limit))).map(row => ({
|
|
48
|
+
id: String(row.id), agent: this.agentId, kind: 'session_compaction', startedAt: Number(row.started_at), endedAt: row.ended_at == null ? null : Number(row.ended_at), status: String(row.status),
|
|
49
|
+
config: JSON.parse(String(row.config_json)), items: this.store.all('SELECT payload_json FROM session_compaction_items WHERE run_id=? ORDER BY rowid', row.id).map(item => JSON.parse(String(item.payload_json))),
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
skip(sessionId, cfg) {
|
|
53
|
+
const cli = this.store.get('SELECT cli_session_id,cwd FROM agent_cli_sessions WHERE session_id=?', sessionId);
|
|
54
|
+
const aliases = cli ? this.store.all('SELECT session_id FROM agent_cli_sessions WHERE cli_session_id=? AND cwd=?', cli.cli_session_id, cli.cwd) : [{ session_id: sessionId }];
|
|
55
|
+
for (const alias of aliases) {
|
|
56
|
+
const reason = this.skipSingle(String(alias.session_id), cfg);
|
|
57
|
+
if (reason)
|
|
58
|
+
return reason;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
skipSingle(sessionId, cfg) {
|
|
62
|
+
if (this.deps.stopping())
|
|
63
|
+
return 'gateway_stopping';
|
|
64
|
+
if (this.deps.busy(sessionId))
|
|
65
|
+
return 'agent_busy';
|
|
66
|
+
if (this.store.get("SELECT t.id FROM tasks t JOIN conversations c ON c.id=t.conversation_id WHERE c.agent_session_id=? AND t.state NOT IN ('completed','failed','cancelled') LIMIT 1", sessionId))
|
|
67
|
+
return 'active_tasks';
|
|
68
|
+
if (this.store.get("SELECT i.id FROM conversation_inputs i JOIN conversations c ON c.id=i.conversation_id WHERE c.agent_session_id=? AND i.status IN ('accepted','assigned') LIMIT 1", sessionId))
|
|
69
|
+
return 'pending_input';
|
|
70
|
+
const last = this.store.get(`SELECT MAX(at) at FROM (
|
|
71
|
+
SELECT MAX(COALESCE(ended_at,started_at)) at FROM conversation_decisions WHERE session_id=?
|
|
72
|
+
UNION ALL SELECT MAX(i.created_at) at FROM conversation_inputs i JOIN conversations c ON c.id=i.conversation_id WHERE c.agent_session_id=? AND i.store_user_message=1)`, sessionId, sessionId)?.at;
|
|
73
|
+
if (last != null && Date.now() - Number(last) < cfg.quietMinutes * 60000)
|
|
74
|
+
return 'recent_activity';
|
|
75
|
+
}
|
|
76
|
+
contextChangedAt(sessionId, measuredAt) {
|
|
77
|
+
const cli = this.store.get('SELECT cli_session_id,cwd FROM agent_cli_sessions WHERE session_id=?', sessionId);
|
|
78
|
+
if (this.store.get("SELECT seq FROM conversation_events WHERE occurred_at>=? AND ((type='session.context_reset' AND json_extract(payload_json,'$.payload.sessionId')=?) OR (type='session.context_compacted' AND (json_extract(payload_json,'$.payload.sessionId')=? OR json_extract(payload_json,'$.payload.cliSessionId')=?))) LIMIT 1", measuredAt, sessionId, sessionId, cli?.cli_session_id ?? ''))
|
|
79
|
+
return true;
|
|
80
|
+
// Aliases can share a native transcript. An uncertain interrupted attempt on
|
|
81
|
+
// one alias must fence the others until their measurements become fresh.
|
|
82
|
+
return Boolean(cli && this.store.get('SELECT m.session_id FROM session_compaction_marks m JOIN agent_cli_sessions c ON c.session_id=m.session_id WHERE c.cli_session_id=? AND c.cwd=? AND m.completed_at>=? LIMIT 1', cli.cli_session_id, cli.cwd, measuredAt));
|
|
83
|
+
}
|
|
84
|
+
run(cfg) {
|
|
85
|
+
if (this.running)
|
|
86
|
+
return this.running;
|
|
87
|
+
const operation = serial.catch(() => { }).then(() => this.execute(cfg));
|
|
88
|
+
serial = operation.catch(() => { });
|
|
89
|
+
this.running = operation;
|
|
90
|
+
void operation.finally(() => { this.running = undefined; }).catch(() => { });
|
|
91
|
+
return operation;
|
|
92
|
+
}
|
|
93
|
+
async execute(cfg) {
|
|
94
|
+
const id = (0, crypto_1.randomUUID)(), startedAt = Date.now();
|
|
95
|
+
this.store.run("INSERT INTO session_compaction_runs VALUES(?,?,NULL,'running',?)", id, startedAt, JSON.stringify(cfg));
|
|
96
|
+
const items = [];
|
|
97
|
+
const save = (item) => this.store.run(`INSERT INTO session_compaction_items VALUES(?,?,?) ON CONFLICT(run_id,session_id) DO UPDATE SET payload_json=excluded.payload_json`, id, item.sessionId, JSON.stringify(item));
|
|
98
|
+
let attempted = 0, status = 'completed';
|
|
99
|
+
try {
|
|
100
|
+
if (!cfg.enabled) {
|
|
101
|
+
status = 'disabled';
|
|
102
|
+
return { id, agent: this.agentId, kind: 'session_compaction', startedAt, endedAt: Date.now(), status, config: cfg, items };
|
|
103
|
+
}
|
|
104
|
+
const sessions = this.store.all('SELECT session_id,cli_session_id,cwd FROM agent_cli_sessions ORDER BY updated_at DESC LIMIT 1000');
|
|
105
|
+
for (const row of sessions) {
|
|
106
|
+
if (this.deps.stopping()) {
|
|
107
|
+
status = 'interrupted';
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
const sessionId = String(row.session_id);
|
|
111
|
+
const item = { sessionId, status: 'skipped', beforeTokens: null, afterTokens: null, contextWindow: null, startedAt: Date.now(), endedAt: null };
|
|
112
|
+
items.push(item);
|
|
113
|
+
const finish = (reason) => { item.reason = reason; item.endedAt = Date.now(); save(item); };
|
|
114
|
+
const reason = this.skip(sessionId, cfg);
|
|
115
|
+
if (reason) {
|
|
116
|
+
finish(reason);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (attempted >= cfg.maxSessionsPerRun) {
|
|
120
|
+
finish('run_limit');
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!this.store.get("SELECT name FROM sqlite_master WHERE name='token_turns'")) {
|
|
124
|
+
finish('no_measurement');
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const measured = this.store.get("SELECT id,started_at FROM token_turns WHERE session_id=? AND role='agent' AND EXISTS (SELECT 1 FROM json_each(payload_json,'$.requests') r WHERE json_type(r.value,'$.usage')='object') ORDER BY started_at DESC,id DESC LIMIT 1", sessionId);
|
|
128
|
+
const context = (0, token_ledger_1.latestAgentContextWindow)(this.store, sessionId);
|
|
129
|
+
if (!measured || !context || !Number.isFinite(context.used)) {
|
|
130
|
+
finish('no_measurement');
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
item.beforeTokens = context.used;
|
|
134
|
+
if (this.store.get('SELECT session_id FROM session_compaction_marks WHERE session_id=? AND measurement_id=?', sessionId, measured.id)) {
|
|
135
|
+
finish('unchanged_measurement');
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (this.contextChangedAt(sessionId, Number(measured.started_at))) {
|
|
139
|
+
finish('context_changed');
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const model = this.deps.model();
|
|
143
|
+
try {
|
|
144
|
+
item.contextWindow = await this.deps.window(model);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
finish('model_window_unavailable');
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (!Number.isFinite(item.contextWindow) || item.contextWindow <= 0) {
|
|
151
|
+
finish('model_window_unavailable');
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (context.used <= item.contextWindow * cfg.thresholdPercent / 100) {
|
|
155
|
+
finish('below_threshold');
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const changed = this.skip(sessionId, cfg);
|
|
159
|
+
if (changed) {
|
|
160
|
+
finish(changed);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
// Catalog lookup yields: manual /clear or /compact can finish meanwhile.
|
|
164
|
+
// Never use the pre-lookup measurement against a different CLI context.
|
|
165
|
+
const current = this.store.get('SELECT cli_session_id,cwd FROM agent_cli_sessions WHERE session_id=?', sessionId);
|
|
166
|
+
const latest = this.store.get("SELECT id FROM token_turns WHERE session_id=? AND role='agent' AND EXISTS (SELECT 1 FROM json_each(payload_json,'$.requests') r WHERE json_type(r.value,'$.usage')='object') ORDER BY started_at DESC,id DESC LIMIT 1", sessionId);
|
|
167
|
+
if (this.deps.model() !== model || !current || current.cli_session_id !== row.cli_session_id || current.cwd !== row.cwd || latest?.id !== measured.id || this.contextChangedAt(sessionId, Number(measured.started_at))) {
|
|
168
|
+
finish('context_changed');
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
item.status = 'running';
|
|
172
|
+
save(item);
|
|
173
|
+
attempted++;
|
|
174
|
+
// Fence even an uncertain crash after compaction: next user turn produces a new measurement.
|
|
175
|
+
this.store.run('INSERT INTO session_compaction_marks VALUES(?,?,?) ON CONFLICT(session_id) DO UPDATE SET measurement_id=excluded.measurement_id,completed_at=excluded.completed_at', sessionId, measured.id, Date.now());
|
|
176
|
+
try {
|
|
177
|
+
const measured = await this.deps.compact(sessionId, model);
|
|
178
|
+
item.status = 'completed';
|
|
179
|
+
if (measured?.beforeTokens != null)
|
|
180
|
+
item.beforeTokens = measured.beforeTokens;
|
|
181
|
+
item.afterTokens = measured?.afterTokens ?? null;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
item.status = 'failed';
|
|
185
|
+
const code = error.code;
|
|
186
|
+
item.errorCode = typeof code === 'string' && /^[A-Z_0-9]{1,80}$/.test(code) ? code : 'COMPACTION_FAILED';
|
|
187
|
+
// Known failure may retry on a later night, never in this sweep.
|
|
188
|
+
this.store.run('DELETE FROM session_compaction_marks WHERE session_id=? AND measurement_id=?', sessionId, measured.id);
|
|
189
|
+
if (code === 'NO_CLI_SESSION') {
|
|
190
|
+
item.status = 'skipped';
|
|
191
|
+
item.reason = 'missing_transcript';
|
|
192
|
+
delete item.errorCode;
|
|
193
|
+
}
|
|
194
|
+
else
|
|
195
|
+
status = 'partial_failure';
|
|
196
|
+
}
|
|
197
|
+
item.endedAt = Date.now();
|
|
198
|
+
save(item);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
status = 'failed';
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
finally {
|
|
206
|
+
this.store.run('UPDATE session_compaction_runs SET status=?,ended_at=? WHERE id=?', status, Date.now(), id);
|
|
207
|
+
}
|
|
208
|
+
return { id, agent: this.agentId, kind: 'session_compaction', startedAt, endedAt: Date.now(), status, config: cfg, items };
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exports.SessionCompaction = SessionCompaction;
|
|
212
|
+
//# sourceMappingURL=session-compaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-compaction.js","sourceRoot":"","sources":["../../src/orchestration/session-compaction.ts"],"names":[],"mappings":";;;AAcA,4DAOC;AAcD,4DAaC;AA/CD,mCAAoC;AAEpC,iDAA0D;AAW1D,SAAgB,wBAAwB,CAAC,KAA+B,EAAE,MAAgC;IACxG,MAAM,MAAM,GAAC,CAAC,GAAkC,EAAE,QAAe,EAAC,GAAU,EAAC,GAAU,EAAE,EAAE;QACzF,MAAM,KAAK,GAAC,KAAK,EAAE,CAAC,GAAG,CAAC,IAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,OAAO,KAAK,KAAG,QAAQ,IAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA,CAAC,CAAA,IAAI,CAAC,GAAG,CAAC,GAAG,EAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAC,KAAK,CAAC,CAAC,CAAA,CAAC,CAAA,QAAQ,CAAC;IACpG,CAAC,CAA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,EAAC,MAAM,EAAC,GAAG,EAAC,KAAK,EAAC,CAAC;IAChH,CAAC;CACF;AAnGD,8CAmGC"}
|
|
@@ -7,6 +7,8 @@ export interface TaskSkill {
|
|
|
7
7
|
args: string;
|
|
8
8
|
content: string;
|
|
9
9
|
filePath: string;
|
|
10
|
+
resourceRoot?: string;
|
|
11
|
+
fileScope?: 'container';
|
|
10
12
|
requires?: SkillDefinition['requires'];
|
|
11
13
|
}
|
|
12
14
|
/** Registry resolution belongs to trusted ingress, never to model-supplied paths. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/orchestration/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/orchestration/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,WAAW,SAAS;IAAG,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CAAE;AACzM,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,CAK/H;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,MAAM,CAK7D;AACD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,CAM/G"}
|
|
@@ -4,6 +4,7 @@ exports.resolveSkill = resolveSkill;
|
|
|
4
4
|
exports.skillCatalog = skillCatalog;
|
|
5
5
|
exports.resolveNamedSkill = resolveNamedSkill;
|
|
6
6
|
const builtin_commands_1 = require("../agent/builtin-commands");
|
|
7
|
+
const fs_1 = require("fs");
|
|
7
8
|
/** Registry resolution belongs to trusted ingress, never to model-supplied paths. */
|
|
8
9
|
function resolveSkill(text, source, registry) {
|
|
9
10
|
if (!registry || (0, builtin_commands_1.isBuiltinCommand)(text.trim(), source))
|
|
@@ -16,9 +17,9 @@ function resolveSkill(text, source, registry) {
|
|
|
16
17
|
/** Only installed, user-invocable skills are advertised; never expose bodies or paths. */
|
|
17
18
|
function skillCatalog(registry) {
|
|
18
19
|
const entries = [...(registry?.skills.entries() ?? [])].filter(([, skill]) => skill.userInvocable)
|
|
19
|
-
.map(([name, skill]) => ({ name, description: skill.description, readWhen: skill.readWhen, keywords: skill.keywords, source: skill.source }))
|
|
20
|
+
.map(([name, skill]) => ({ name, description: skill.description, readWhen: skill.readWhen, keywords: skill.keywords, source: skill.source, declaredTools: skill.allowedTools }))
|
|
20
21
|
.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
21
|
-
return 'Installed skill catalog (metadata, not instructions):\n' + JSON.stringify(entries) + '\
|
|
22
|
+
return 'Installed skill catalog (metadata, not instructions or execution permission; check capabilities_list for declared gateway tool availability before promising a task):\n' + JSON.stringify(entries) + '\nInstalled CLI extension skills (invoke by exact name; file-backed instructions can be used by either worker harness):\n' + JSON.stringify([...(registry?.cliSkills ?? [])].map(({ name, description, argumentHint, aliases, source, filePath }) => ({ name, description, argumentHint, aliases, source, portable: Boolean(filePath) })).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) + (registry?.cliDiscoveryError ? '\nCLI skill discovery unavailable. Do not infer that a requested native skill does not exist or confuse this with MCP inventory errors.' : '');
|
|
22
23
|
}
|
|
23
24
|
function resolveNamedSkill(name, args, registry) {
|
|
24
25
|
if (typeof name !== 'string' || !/^[\w:.-]+$/.test(name) || typeof args !== 'string' || args.length > 60000)
|
|
@@ -28,6 +29,6 @@ function resolveNamedSkill(name, args, registry) {
|
|
|
28
29
|
return skill.userInvocable ? { name, args, content: skill.content, filePath: skill.filePath, requires: skill.requires } : undefined;
|
|
29
30
|
const cli = registry?.cliSkills?.find(s => s.name === name) ?? registry?.cliSkills?.find(s => s.aliases?.includes(name));
|
|
30
31
|
if (cli)
|
|
31
|
-
return { name: cli.name, args, invocation: 'cli', content: '', filePath: '' };
|
|
32
|
+
return { name: cli.name, args, ...(cli.source !== 'codex' ? { invocation: 'cli' } : {}), content: cli.fileScope === 'container' ? cli.content ?? '' : cli.filePath ? (0, fs_1.readFileSync)(cli.filePath, 'utf8') : '', filePath: cli.filePath ?? '', ...(cli.resourceRoot ? { resourceRoot: cli.resourceRoot } : {}), ...(cli.fileScope ? { fileScope: cli.fileScope } : {}) };
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=skills.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/orchestration/skills.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/orchestration/skills.ts"],"names":[],"mappings":";;AAQA,oCAKC;AAGD,oCAKC;AACD,8CAMC;AA3BD,gEAA6D;AAG7D,2BAAkC;AAGlC,qFAAqF;AACrF,SAAgB,YAAY,CAAC,IAAY,E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{
|
|
14
|
+
gatewayTarget: import("./types").GatewayTaskTarget | undefined;
|
|
15
|
+
executionType: "worker" | "gateway-managed";
|
|
16
|
+
harness: "claude" | "codex" | undefined;
|
|
14
17
|
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
15
18
|
timingMeasuredFrom: number | undefined;
|
|
16
19
|
supervision: {
|
|
@@ -52,6 +55,9 @@ export declare class TaskControls {
|
|
|
52
55
|
};
|
|
53
56
|
private owned;
|
|
54
57
|
detail(sessionId: string, principalId: string, taskId: string): {
|
|
58
|
+
gatewayTarget: import("./types").GatewayTaskTarget | undefined;
|
|
59
|
+
executionType: "worker" | "gateway-managed";
|
|
60
|
+
harness: "claude" | "codex" | undefined;
|
|
55
61
|
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
56
62
|
timingMeasuredFrom: number | undefined;
|
|
57
63
|
supervision: {
|
|
@@ -91,6 +97,9 @@ export declare class TaskControls {
|
|
|
91
97
|
canStop: boolean;
|
|
92
98
|
};
|
|
93
99
|
answer(sessionId: string, principalId: string, taskId: string, questionId: string, answer: string, acceptedInputId?: string): {
|
|
100
|
+
gatewayTarget: import("./types").GatewayTaskTarget | undefined;
|
|
101
|
+
executionType: "worker" | "gateway-managed";
|
|
102
|
+
harness: "claude" | "codex" | undefined;
|
|
94
103
|
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
95
104
|
timingMeasuredFrom: number | undefined;
|
|
96
105
|
supervision: {
|
|
@@ -130,6 +139,9 @@ export declare class TaskControls {
|
|
|
130
139
|
canStop: boolean;
|
|
131
140
|
};
|
|
132
141
|
cancel(sessionId: string, principalId: string, taskId: string): {
|
|
142
|
+
gatewayTarget: import("./types").GatewayTaskTarget | undefined;
|
|
143
|
+
executionType: "worker" | "gateway-managed";
|
|
144
|
+
harness: "claude" | "codex" | undefined;
|
|
133
145
|
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
134
146
|
timingMeasuredFrom: number | undefined;
|
|
135
147
|
supervision: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-controls.d.ts","sourceRoot":"","sources":["../../src/orchestration/task-controls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,kFAAkF;AAClF,qBAAa,YAAY;IACX,OAAO,CAAC,KAAK;IAAsB,OAAO,CAAC,KAAK;gBAAxC,KAAK,EAAE,kBAAkB,EAAU,KAAK,EAAE,WAAW;IACzE,OAAO,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"task-controls.d.ts","sourceRoot":"","sources":["../../src/orchestration/task-controls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,kFAAkF;AAClF,qBAAa,YAAY;IACX,OAAO,CAAC,KAAK;IAAsB,OAAO,CAAC,KAAK;gBAAxC,KAAK,EAAE,kBAAkB,EAAU,KAAK,EAAE,WAAW;IACzE,OAAO,CAAC,IAAI;IAkBZ,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,SAAI,EAAE,QAAQ,SAAK,EAAE,eAAe,UAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAU7F,OAAO,CAAC,KAAK;IAMb,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAC7D,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI3H,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI9D"}
|
|
@@ -21,7 +21,9 @@ class TaskControls {
|
|
|
21
21
|
const latestProgress = task.latestProgress?.source === 'runtime' && task.latestProgress.text.startsWith('Queued after task ') && task.state !== 'queued' ? undefined : task.latestProgress;
|
|
22
22
|
const progressText = [task.failure ? `${task.failure.code}: ${task.failure.message}` : latestProgress?.text.slice(0, 1500), task.replacedByTaskId ? `Replaced by task ${task.replacedByTaskId}` : undefined].filter(Boolean).join('\n');
|
|
23
23
|
const activityDetails = task.execution && ['running', 'starting'].includes(task.state) ? (0, execution_observation_1.executionDetails)(task.execution) : undefined;
|
|
24
|
-
|
|
24
|
+
const attemptRow = this.store.get('SELECT payload_json FROM task_attempts WHERE task_id=? ORDER BY generation DESC LIMIT 1', task.taskId);
|
|
25
|
+
const harness = attemptRow ? JSON.parse(String(attemptRow.payload_json)).harness : undefined;
|
|
26
|
+
return { gatewayTarget: task.gatewayTarget, executionType: task.gatewayTarget ? 'gateway-managed' : 'worker', harness, timing: (0, timing_1.timingTotals)(task), timingMeasuredFrom: task.timing?.measuredFrom, supervision: task.supervision, progressText, activityDetails, startedAt, finishedAt, taskId: task.taskId, title: task.title.slice(0, 200), state: task.state, replacedByTaskId: task.replacedByTaskId,
|
|
25
27
|
cancellation: task.cancellation, failure: task.failure, execution: task.execution, progress: [task.failure ? `${task.failure.code}: ${task.failure.message}` : latestProgress?.text.slice(0, 1500), task.execution && ['running', 'starting'].includes(task.state) ? (0, execution_observation_1.executionDescription)(task.execution) : undefined, task.replacedByTaskId ? `Replaced by task ${task.replacedByTaskId}` : undefined].filter(Boolean).join('\n') || undefined, question: task.pendingQuestion?.text.slice(0, 1000), questionId: task.pendingQuestion?.questionId,
|
|
26
28
|
updatedAt: Math.max(task.updatedAt, Number(activity?.occurred_at ?? 0), task.execution?.lastActivityAt ?? 0), canStop: ['queued', 'starting', 'running', 'waiting_input', 'interrupting', 'recovering', 'needs_reconciliation'].includes(task.state) };
|
|
27
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-controls.js","sourceRoot":"","sources":["../../src/orchestration/task-controls.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAC9C,mEAAiF;AAGjF,mCAA2D;AAE3D,kFAAkF;AAClF,MAAa,YAAY;IACvB,YAAoB,KAAyB,EAAU,KAAkB;QAArD,UAAK,GAAL,KAAK,CAAoB;QAAU,UAAK,GAAL,KAAK,CAAa;IAAG,CAAC;IACrE,IAAI,CAAC,IAAkB;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,qKAAqK,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAEzO,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;;;kIAGgG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClK,MAAM,SAAS,GAAG,MAAM,EAAE,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACrF,MAAM,UAAU,GAAG,CAAC,WAAW,EAAC,QAAQ,EAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvI,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,EAAE,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,U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,CAAC,CAAC,CAAC;IACpF,CAAC;CACF;AA7CD,oCA6CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/driver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/driver.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK9D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAsB,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAazD,qBAAa,kBAAmB,YAAW,YAAY;IAEzC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAe,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAiB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAC9G,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAc,OAAO,CAAC,QAAQ,CAAC,UAAU;IAAkB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAU,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAFzJ,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;gBACd,KAAK,EAAE,WAAW,EAAmB,OAAO,EAAE,aAAa,EAAmB,KAAK,EAAE,WAAW,EAC1G,MAAM,EAAE,UAAU,EAAmB,UAAU,EAAE,cAAc,EAAmB,WAAW,EAAE,MAAM,EAAmB,aAAa,CAAC,GAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,aAAA;IACxQ,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAKrD,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;IACjD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAClC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAChC,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,UAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;CA+MvG"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClaudeWorkerDriver = void 0;
|
|
4
|
+
const codex_auth_1 = require("../../session/codex-auth");
|
|
5
|
+
const codex_runtime_1 = require("../../session/codex-runtime");
|
|
6
|
+
const codex_container_runtime_1 = require("../../session/codex-container-runtime");
|
|
4
7
|
const token_ledger_1 = require("../token-ledger");
|
|
5
8
|
const reply_context_1 = require("../reply-context");
|
|
6
9
|
const tool_repetition_1 = require("./tool-repetition");
|
|
@@ -8,6 +11,7 @@ const task_directive_1 = require("./task-directive");
|
|
|
8
11
|
const source_policy_1 = require("../source-policy");
|
|
9
12
|
const browser_routing_1 = require("../browser-routing");
|
|
10
13
|
const cli_skills_1 = require("../cli-skills");
|
|
14
|
+
const worker_extensions_1 = require("../../session/worker-extensions");
|
|
11
15
|
const process_activity_1 = require("../process-activity");
|
|
12
16
|
const process_supervisor_1 = require("../process-supervisor");
|
|
13
17
|
const config_1 = require("../config");
|
|
@@ -20,6 +24,8 @@ const path_1 = require("path");
|
|
|
20
24
|
const promises_1 = require("fs/promises");
|
|
21
25
|
const store_2 = require("../../session/store");
|
|
22
26
|
const process_1 = require("../../session/process");
|
|
27
|
+
const codex_process_1 = require("../../session/codex-process");
|
|
28
|
+
const worker_harness_1 = require("../worker-harness");
|
|
23
29
|
const types_1 = require("../types");
|
|
24
30
|
const process_turn_1 = require("../process-turn");
|
|
25
31
|
const crypto_1 = require("crypto");
|
|
@@ -70,15 +76,52 @@ class ClaudeWorkerDriver {
|
|
|
70
76
|
if (current.state !== 'starting' || current.activeAttemptId !== attempt.attemptId)
|
|
71
77
|
throw new types_1.OrchestrationError('ATTEMPT_CANCELLED_BEFORE_START');
|
|
72
78
|
const directory = (0, path_1.join)(this.privateRoot, attempt.attemptId);
|
|
73
|
-
|
|
79
|
+
let harness = (0, worker_harness_1.resolveWorkerHarness)(this.agent, this.gateway, task.model ?? this.agent.claude.model);
|
|
80
|
+
let authFingerprint;
|
|
81
|
+
if (harness.harness === 'codex') {
|
|
82
|
+
try {
|
|
83
|
+
if (task.skill?.invocation === 'cli' && !task.skill.filePath) {
|
|
84
|
+
const inventory = await (0, worker_extensions_1.discoverWorkerExtensions)(this.agent, this.gateway, workspace.path);
|
|
85
|
+
const installed = inventory.skills.find(skill => skill.name === task.skill.name || skill.aliases?.includes(task.skill.name));
|
|
86
|
+
if (installed)
|
|
87
|
+
task.skill = { ...task.skill, filePath: installed.filePath, resourceRoot: installed.resourceRoot, fileScope: installed.fileScope, content: installed.fileScope === 'container' ? installed.content ?? '' : await (0, promises_1.readFile)(installed.filePath, 'utf8') };
|
|
88
|
+
}
|
|
89
|
+
if (task.skill?.invocation === 'cli' && !task.skill.filePath)
|
|
90
|
+
throw new codex_auth_1.CodexReadinessError('CODEX_SKILL_UNAVAILABLE', 'The native command has no installed skill file to transfer to Codex.');
|
|
91
|
+
const runtime = (0, codex_runtime_1.resolveCodexRuntime)(harness.config.bin, this.agent.workspace);
|
|
92
|
+
authFingerprint = (await (0, codex_auth_1.resolveCodexCredentials)({ ...harness.config, bin: runtime.executable, allowDockerHost: this.agent.type === 'app-agent' })).fingerprint;
|
|
93
|
+
if (this.agent.type === 'app-agent')
|
|
94
|
+
await (0, codex_container_runtime_1.inspectSelectedCodexRuntime)(this.agent, runtime);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
const selector = this.agent.workers?.harness ?? this.gateway.gateway.workers?.harness ?? 'auto';
|
|
98
|
+
if (selector !== 'auto' || attempt.harness)
|
|
99
|
+
throw error;
|
|
100
|
+
harness = { ...harness, harness: 'claude' };
|
|
101
|
+
this.tasks.store.transaction(() => this.tasks.store.appendEvent(task.conversationId, 'worker.harness_fallback', { taskId: task.taskId, from: 'codex', to: 'claude', reason: error instanceof codex_auth_1.CodexReadinessError ? error.code : 'CODEX_RUNTIME_UNAVAILABLE' }, task.taskId));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const afterReadiness = this.tasks.store.task(task.taskId);
|
|
105
|
+
if (afterReadiness?.state !== 'starting' || afterReadiness.activeAttemptId !== attempt.attemptId)
|
|
106
|
+
throw new types_1.OrchestrationError('ATTEMPT_CANCELLED_BEFORE_START');
|
|
107
|
+
// Persist the actual execution choice; pool fingerprints prevent cross-harness resume.
|
|
108
|
+
if (attempt.harness && attempt.harness !== harness.harness)
|
|
109
|
+
throw new types_1.OrchestrationError('WORKER_HARNESS_CHANGED');
|
|
110
|
+
attempt.harness = harness.harness;
|
|
111
|
+
attempt.harnessModel = harness.harness === 'codex' ? harness.config.model : task.model ?? this.agent.claude.model;
|
|
112
|
+
this.tasks.store.transaction(() => this.tasks.store.saveAttempt(attempt));
|
|
113
|
+
const cliSkill = task.skill?.invocation === 'cli' && harness.harness !== 'codex';
|
|
74
114
|
const invokedSkill = task.skill ? (cliSkill ? task.skill.name : `orchestration-task:${task.skill.name}`) : undefined;
|
|
75
115
|
if (cliSkill) {
|
|
76
116
|
const installed = await (0, cli_skills_1.discoverCliSkills)(this.agent, workspace.path);
|
|
77
117
|
if (!installed.some(skill => skill.name === task.skill.name))
|
|
78
|
-
throw new types_1.OrchestrationError('CLI_SKILL_UNAVAILABLE', 'The selected skill is unavailable in this worker
|
|
118
|
+
throw new types_1.OrchestrationError('CLI_SKILL_UNAVAILABLE', 'The selected skill is unavailable in this worker harness; no host/container fallback was attempted.');
|
|
79
119
|
}
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
120
|
+
const containerSkill = task.skill?.fileScope === 'container' && !cliSkill ? { name: task.skill.name, filePath: task.skill.filePath, resourceRoot: task.skill.resourceRoot ?? (0, path_1.dirname)(task.skill.filePath), content: task.skill.content } : undefined;
|
|
121
|
+
if (containerSkill && this.agent.type !== 'app-agent')
|
|
122
|
+
throw new types_1.OrchestrationError('CONTAINER_SKILL_REQUIRES_CONTAINER');
|
|
123
|
+
const skillPluginDir = task.skill && !cliSkill && !containerSkill ? (0, path_1.join)(directory, 'skill-plugin') : undefined;
|
|
124
|
+
if (task.skill && !cliSkill && !containerSkill) {
|
|
82
125
|
if (task.skill.requires?.plugins?.length)
|
|
83
126
|
throw new types_1.OrchestrationError('SKILL_PLUGIN_UNAVAILABLE');
|
|
84
127
|
const destination = (0, path_1.join)(skillPluginDir, 'skills', task.skill.name);
|
|
@@ -86,8 +129,21 @@ class ClaudeWorkerDriver {
|
|
|
86
129
|
await (0, promises_1.writeFile)((0, path_1.join)(skillPluginDir, '.claude-plugin', 'plugin.json'), JSON.stringify({ name: 'orchestration-task', description: 'Assigned task skill only', version: '1.0.0' }), { mode: 0o600 });
|
|
87
130
|
await (0, promises_1.mkdir)(destination, { recursive: true, mode: 0o700 });
|
|
88
131
|
// Keep relative references/scripts available; the invoked body is pinned at admission.
|
|
89
|
-
|
|
90
|
-
|
|
132
|
+
const resourceRoot = task.skill.resourceRoot ?? (0, path_1.dirname)(task.skill.filePath);
|
|
133
|
+
const entry = (0, path_1.relative)(resourceRoot, task.skill.filePath);
|
|
134
|
+
if (entry === '..' || entry.startsWith('../') || (0, path_1.isAbsolute)(entry))
|
|
135
|
+
throw new types_1.OrchestrationError('SKILL_RESOURCE_PATH_INVALID');
|
|
136
|
+
let resourceBytes = 0;
|
|
137
|
+
await (0, promises_1.cp)(resourceRoot, destination, { recursive: true, dereference: false, filter: async (source) => {
|
|
138
|
+
const stat = await (0, promises_1.lstat)(source);
|
|
139
|
+
if (stat.isSymbolicLink() || !stat.isFile() && !stat.isDirectory())
|
|
140
|
+
return false;
|
|
141
|
+
if (stat.isFile() && (resourceBytes += stat.size) > 10 * 1024 * 1024)
|
|
142
|
+
throw new types_1.OrchestrationError('SKILL_RESOURCES_TOO_LARGE');
|
|
143
|
+
return true;
|
|
144
|
+
} });
|
|
145
|
+
await (0, promises_1.writeFile)((0, path_1.join)(destination, entry), task.skill.content, { mode: 0o600 });
|
|
146
|
+
await (0, promises_1.writeFile)((0, path_1.join)(destination, 'SKILL.md'), `---\nname: ${task.skill.name}\ndescription: Assigned installed skill\n---\n${entry === 'SKILL.md' ? (0, parser_1.extractFrontmatter)(task.skill.content)?.body ?? task.skill.content : `Read and follow ${entry}. Resolve file-relative references from that file's directory and plugin-relative references from this directory. The assigned instructions are pinned in that file.`}`, { mode: 0o600 });
|
|
91
147
|
}
|
|
92
148
|
const revision = this.tasks.revision(task.taskId, attempt.revision);
|
|
93
149
|
const directive = (0, task_directive_1.taskDirective)(this.tasks.store, task.conversationId, revision);
|
|
@@ -96,14 +152,30 @@ class ClaudeWorkerDriver {
|
|
|
96
152
|
const context = this.agent.type === 'app-agent'
|
|
97
153
|
? await (0, container_1.containerNode)(this.agent.container, "process.stdout.write(require('fs').readFileSync('/workspace/CLAUDE.md','utf8'))")
|
|
98
154
|
: await (0, promises_1.readFile)((0, path_1.join)(this.agent.workspace, 'CLAUDE.md'), 'utf8');
|
|
99
|
-
this.tasks.pool.bind(attempt, (0, store_1.payloadHash)({ context, workspace: workspace.path, agent: this.agent, gateway: this.gateway, toolExposure: 'lazy-connectors-v1' }));
|
|
155
|
+
this.tasks.pool.bind(attempt, (0, store_1.payloadHash)({ context, workspace: workspace.path, agent: this.agent, gateway: this.gateway, harness, authFingerprint, toolExposure: 'lazy-connectors-v1' }));
|
|
156
|
+
// Pool expiration/rebinding makes old native transcripts disposable. This
|
|
157
|
+
// bounded maintenance is best effort and never changes task admission.
|
|
158
|
+
void (0, codex_process_1.cleanupCodexSessions)({ agent: this.agent, stateDirectory: (0, path_1.join)(this.privateRoot, 'codex-sessions'), retainedSessionIds: this.tasks.pool.retainedSessionIds() }).catch(() => { });
|
|
100
159
|
const shared = (0, knowledge_1.resolveSharedConfig)(this.agent.knowledge?.shared, this.gateway.gateway.knowledge?.shared);
|
|
101
160
|
const ticket = this.bridge.issue({ role: 'worker', attemptId: attempt.attemptId, generation: attempt.generation }, directory, this.agent.workspace, shared.enabled ? (0, knowledge_1.sharedVaultDir)(shared) : '');
|
|
102
161
|
try {
|
|
103
|
-
const profile = { ...ticket.profile, hostExecution: workspace.baseCommit === 'host', containerExecution: this.agent.type === 'app-agent', originSessionId: task.agentSessionId, taskId: task.taskId, attemptId: attempt.attemptId, context, cliSession: { id: attempt.sessionId, resume: Boolean(attempt.resumeSession) }, capacityReserved, skillPluginDir };
|
|
162
|
+
const profile = { ...ticket.profile, hostExecution: workspace.baseCommit === 'host', containerExecution: this.agent.type === 'app-agent', originSessionId: task.agentSessionId, taskId: task.taskId, attemptId: attempt.attemptId, context, cliSession: { id: attempt.sessionId, resume: Boolean(attempt.resumeSession) }, capacityReserved, skillPluginDir, containerSkill };
|
|
104
163
|
const workerConfig = { ...this.agent, workspace: this.agent.type === 'app-agent' ? this.agent.workspace : workspace.path, allow_tools: true, orchestration: undefined,
|
|
105
164
|
claude: { ...this.agent.claude, model: task.model ?? this.agent.claude.model, extraFlags: [] } };
|
|
106
|
-
const process =
|
|
165
|
+
const process = harness.harness === 'codex'
|
|
166
|
+
? new codex_process_1.CodexProcess({ agent: workerConfig, gateway: this.gateway, profile, sessionId: attempt.sessionId,
|
|
167
|
+
stateDirectory: (0, path_1.join)(this.privateRoot, 'codex-sessions'), config: harness.config,
|
|
168
|
+
requestInput: question => { this.tasks.requestInput(attempt.attemptId, attempt.generation, question); },
|
|
169
|
+
checkpoint: async () => {
|
|
170
|
+
const next = this.tasks.checkpoint(attempt.attemptId, attempt.generation, { sessionId: attempt.sessionId });
|
|
171
|
+
const text = [next.directive ? `Task revision ${next.revision}: ${next.directive}` : '', next.feedback?.message].filter(Boolean).join('\n\n');
|
|
172
|
+
if (!text)
|
|
173
|
+
return;
|
|
174
|
+
return { text, kind: next.directiveKind ?? 'advice', acknowledge: () => {
|
|
175
|
+
this.tasks.checkpoint(attempt.attemptId, attempt.generation, { sessionId: attempt.sessionId, ackRevision: next.revision, ackFeedback: next.feedback?.id });
|
|
176
|
+
} };
|
|
177
|
+
} })
|
|
178
|
+
: new process_1.SessionProcess(attempt.sessionId, 'api', workerConfig, this.gateway, new store_2.SessionStore((0, path_1.join)(this.privateRoot, 'logs')), undefined, profile);
|
|
107
179
|
process.on('output', line => this.bridge.captureWorkerOutput(attempt.attemptId, attempt.generation, line));
|
|
108
180
|
process.on('output', (0, tool_activity_1.toolActivity)(event => this.tasks.store.transaction(() => this.tasks.store.appendEvent(task.conversationId, 'tool.activity', { ...event, taskId: task.taskId, role: 'worker' }, task.taskId))));
|
|
109
181
|
process.on('output', (0, tool_repetition_1.observeToolRepetition)((signature, id) => this.tasks.observeToolResult(attempt.attemptId, attempt.generation, signature, id), active => this.tasks.observeToolBoundary(attempt.attemptId, attempt.generation, active)));
|
|
@@ -146,6 +218,11 @@ class ClaudeWorkerDriver {
|
|
|
146
218
|
if (this.agent.type === 'app-agent') {
|
|
147
219
|
prompt = `Task ${task.taskId}, attempt ${attempt.attemptId}, revision ${attempt.revision}.\n${directive}\nYou run ONLY inside this app container. Work in /workspace or /tmp. No host filesystem, host tools or host fallback. Native CLI tools execute here; gateway media/browser/memory tools are unavailable. To return files call task_stage_file with their container paths.\nAuthorized context: ${JSON.stringify({ references, attachments })}${task.skill ? `\nInvoke Skill ${invokedSkill} with arguments: ${task.skill.args}` : ''}`;
|
|
148
220
|
}
|
|
221
|
+
if (harness.harness === 'codex' && task.skill) {
|
|
222
|
+
// File-based skills are portable instructions, not a Claude-specific Skill call.
|
|
223
|
+
prompt = prompt.replace(/The registered CLI skill name is [^\n]+/g, '').replace(/Invoke Skill [^\n]+/g, '');
|
|
224
|
+
prompt += `\nAssigned skill ${task.skill.name}; arguments: ${JSON.stringify(task.skill.args)}. Read and follow the assigned SKILL.md and its relative resources in the worker skill directory.\n${(0, parser_1.extractFrontmatter)(task.skill.content)?.body ?? task.skill.content}`;
|
|
225
|
+
}
|
|
149
226
|
prompt += '\nOriginating user request (the assignment must stay within this authorization): ' + JSON.stringify(input.text);
|
|
150
227
|
prompt += '\n' + (0, source_policy_1.personaWorkspaceRules)(this.agent.workspace, this.agent.type === 'app-agent' ? 'container' : workspace.baseCommit === 'host' ? 'host' : 'isolated');
|
|
151
228
|
if (task.continueTaskId) {
|
|
@@ -157,11 +234,15 @@ class ClaudeWorkerDriver {
|
|
|
157
234
|
let observing = false, observationClosed = false, lastActivityAt = Date.now();
|
|
158
235
|
const limits = (0, config_1.resolveOrchestrationConfig)(this.agent.orchestration);
|
|
159
236
|
const turn = (0, process_turn_1.startProcessTurn)(process, prompt, limits.tasks.maxDurationMs || undefined, undefined, metrics => {
|
|
160
|
-
(0, token_ledger_1.recordTokenTurn)(this.tasks.store, { id: attempt.attemptId, sessionId: task.agentSessionId, role: 'worker', category: 'worker', taskId: task.taskId, taskRevision: revision.revision, ...metrics });
|
|
237
|
+
(0, token_ledger_1.recordTokenTurn)(this.tasks.store, { id: attempt.attemptId, sessionId: task.agentSessionId, role: 'worker', category: 'worker', taskId: task.taskId, taskRevision: revision.revision, ...metrics, harness: attempt.harness });
|
|
161
238
|
this.onManagedTurn?.(task.agentSessionId, revision.instructions, metrics, task.skill ? [task.skill.name] : []);
|
|
162
|
-
}, [], { startupTimeoutMs: limits.conversation.startupTimeoutMs, firstResponseTimeoutMs: limits.conversation.firstResponseTimeoutMs,
|
|
239
|
+
}, [], { startupTimeoutMs: limits.conversation.startupTimeoutMs, firstResponseTimeoutMs: limits.conversation.firstResponseTimeoutMs, compactionTimeoutMs: limits.conversation.compactionTimeoutMs,
|
|
240
|
+
pauseRequested: () => {
|
|
241
|
+
const current = this.tasks.store.task(task.taskId);
|
|
242
|
+
return current?.activeAttemptId === attempt.attemptId && current.state === 'waiting_input' && Boolean(current.pendingQuestion);
|
|
243
|
+
},
|
|
163
244
|
idleTimeoutMs: limits.tasks.idleTimeoutMs, acceptToolProgress: true, idleAction: 'observe',
|
|
164
|
-
onUsage: metrics => (0, token_ledger_1.recordTokenTurn)(this.tasks.store, { id: attempt.attemptId, sessionId: task.agentSessionId, role: 'worker', category: 'worker', taskId: task.taskId, taskRevision: revision.revision, ...metrics }),
|
|
245
|
+
onUsage: metrics => (0, token_ledger_1.recordTokenTurn)(this.tasks.store, { id: attempt.attemptId, sessionId: task.agentSessionId, role: 'worker', category: 'worker', taskId: task.taskId, taskRevision: revision.revision, ...metrics, harness: attempt.harness }),
|
|
165
246
|
onObservation: observation => {
|
|
166
247
|
if (observing || observationClosed)
|
|
167
248
|
return;
|
|
@@ -181,6 +262,12 @@ class ClaudeWorkerDriver {
|
|
|
181
262
|
await process.stop();
|
|
182
263
|
return { type: process.managedGroupStopped ? 'stopped' : 'unknown' };
|
|
183
264
|
}
|
|
265
|
+
if (answer.paused) {
|
|
266
|
+
await process.stop();
|
|
267
|
+
return { type: process.managedGroupStopped ? 'paused' : 'unknown' };
|
|
268
|
+
}
|
|
269
|
+
if (!answer.text.trim())
|
|
270
|
+
throw new types_1.OrchestrationError('WORKER_RESULT_MISSING', 'The worker ended without a final response. Inspect existing changes before retrying.');
|
|
184
271
|
if (Buffer.byteLength(answer.text) > 262144)
|
|
185
272
|
throw new types_1.OrchestrationError('RESPONSE_TOO_LARGE');
|
|
186
273
|
const artifact = await this.workspaces.artifact(task.taskId);
|
|
@@ -191,7 +278,7 @@ class ClaudeWorkerDriver {
|
|
|
191
278
|
return { type: 'unknown' };
|
|
192
279
|
const diff = boundedDiffText(artifact.diff);
|
|
193
280
|
const fileIds = this.tasks.store.all('SELECT id FROM task_files WHERE attempt_id=? ORDER BY created_at,id', attempt.attemptId).map(row => String(row.id));
|
|
194
|
-
return { type: 'completed', result: { summary: answer.text
|
|
281
|
+
return { type: 'completed', result: { summary: answer.text, artifactIds: [artifact.resourceId, ...fileIds],
|
|
195
282
|
diff: { text: diff, truncated: diff.length < artifact.diff.length } } };
|
|
196
283
|
}).catch(async (error) => {
|
|
197
284
|
await process.stop();
|