@cortex-agent/server 2026.10.2 → 2026.10.6
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 +31 -31
- package/defaults/AGENTS.md +3 -3
- package/defaults/config/{thread-templates/agents/direct.json → environments/main.json} +2 -2
- package/defaults/context/AGENTS.md +0 -2
- package/defaults/context/projects/AGENTS.md +0 -2
- package/defaults/context/user/AGENTS.md +1 -1
- package/defaults/hooks/cortex-hook-api.mjs +1 -3
- package/defaults/hooks/new-session-hook.mjs +2 -3
- package/defaults/hooks/status-md-guard.mjs +5 -5
- package/defaults/plugins/cortex-system/.claude-plugin/plugin.json +2 -2
- package/defaults/plugins/cortex-system/plugin.json +2 -2
- package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +4 -4
- package/defaults/plugins/cortex-system/skills/schedule/SKILL.md +11 -13
- package/defaults/plugins/cortex-system/skills/user-learn/SKILL.md +1 -1
- package/defaults/prompts/systemPrompts/web-opus-4-6.md +2 -2
- package/defaults/prompts/systemPrompts/web-sonnet-4-6.md +2 -2
- package/defaults/rules/issues-md.md +2 -2
- package/defaults/rules/meta-conventions.md +1 -2
- package/defaults/rules/mission-md.md +1 -1
- package/defaults/rules/overview-md.md +1 -1
- package/defaults/rules/roadmap-md.md +1 -1
- package/defaults/rules/status-md.md +4 -4
- package/dist/agent-adapter/claude/adapter.d.ts +6 -1
- package/dist/agent-adapter/claude/adapter.js +15 -4
- package/dist/agent-adapter/claude/compact-window.d.ts +11 -3
- package/dist/agent-adapter/claude/compact-window.js +12 -3
- package/dist/agent-adapter/claude/defaults.d.ts +0 -1
- package/dist/agent-adapter/claude/defaults.js +0 -1
- package/dist/agent-adapter/claude/event-translator.d.ts +2 -2
- package/dist/agent-adapter/claude/event-translator.js +2 -1
- package/dist/agent-adapter/claude/hooks-builder.d.ts +0 -5
- package/dist/agent-adapter/claude/hooks-builder.js +0 -13
- package/dist/agent-adapter/claude/spawn-args.d.ts +5 -12
- package/dist/agent-adapter/claude/spawn-args.js +45 -38
- package/dist/agent-adapter/claude/turn-machine.d.ts +2 -2
- package/dist/agent-adapter/claude/turn-machine.js +6 -3
- package/dist/agent-adapter/continuation-phase.js +2 -1
- package/dist/agent-adapter/normalize/event-types.d.ts +4 -1
- package/dist/agent-adapter/normalize/tool-result-images.d.ts +11 -0
- package/dist/agent-adapter/normalize/tool-result-images.js +32 -0
- package/dist/agent-adapter/pi/child-events.js +3 -0
- package/dist/agent-adapter/pi/child-runner.d.ts +1 -2
- package/dist/agent-adapter/pi/child-runner.js +6 -6
- package/dist/agent-adapter/pi/child-session.d.ts +1 -1
- package/dist/agent-adapter/pi/event-parser.d.ts +13 -2
- package/dist/agent-adapter/pi/event-parser.js +38 -11
- package/dist/agent-adapter/pi/mcp-bridge-logic.d.ts +0 -1
- package/dist/agent-adapter/pi/mcp-bridge-logic.js +0 -3
- package/dist/agent-adapter/pi/mcp-bridge.js +4 -4
- package/dist/agent-adapter/pi/pi-session.d.ts +4 -2
- package/dist/agent-adapter/pi/pi-session.js +18 -9
- package/dist/agent-adapter/pi/runtime-settings.d.ts +7 -0
- package/dist/agent-adapter/pi/runtime-settings.js +23 -0
- package/dist/agent-adapter/pi/runtime.d.ts +2 -3
- package/dist/agent-adapter/pi/session-options.d.ts +4 -1
- package/dist/agent-adapter/pi/session-options.js +13 -21
- package/dist/agent-adapter/pi/session-support.d.ts +2 -0
- package/dist/agent-adapter/run-events.d.ts +3 -1
- package/dist/agent-adapter/types.d.ts +6 -12
- package/dist/agent-adapter/types.js +2 -4
- package/dist/core/agents/roles.d.ts +1 -1
- package/dist/core/agents/subagent/attribution.js +1 -0
- package/dist/core/agents/subagent/catalog.d.ts +8 -0
- package/dist/core/agents/subagent/catalog.js +21 -10
- package/dist/core/agents/subagent/types.d.ts +4 -1
- package/dist/core/config-generator.d.ts +0 -6
- package/dist/core/config-generator.js +1 -35
- package/dist/core/icons.d.ts +33 -33
- package/dist/core/locales/en.d.ts +863 -1030
- package/dist/core/locales/slices/commands.d.ts +282 -349
- package/dist/core/locales/slices/commands.js +20 -160
- package/dist/core/locales/slices/init.d.ts +152 -152
- package/dist/core/locales/slices/interactions.d.ts +44 -45
- package/dist/core/locales/slices/interactions.js +0 -4
- package/dist/core/locales/slices/lang.d.ts +5 -5
- package/dist/core/locales/slices/notices.d.ts +75 -118
- package/dist/core/locales/slices/notices.js +13 -99
- package/dist/core/locales/slices/scheduling.d.ts +31 -31
- package/dist/core/locales/slices/startup.d.ts +5 -5
- package/dist/core/locales/slices/status.d.ts +43 -43
- package/dist/core/locales/slices/tui.d.ts +91 -114
- package/dist/core/locales/slices/tui.js +0 -46
- package/dist/core/locales/slices/uiextra.d.ts +41 -61
- package/dist/core/locales/slices/uiextra.js +11 -51
- package/dist/core/locales/slices/uimsg.d.ts +86 -99
- package/dist/core/locales/slices/uimsg.js +6 -32
- package/dist/core/mcp-bundles.d.ts +1 -1
- package/dist/core/mcp-bundles.js +7 -5
- package/dist/core/mcp-tool-gate.js +8 -5
- package/dist/core/platform-settings-spec.d.ts +3 -3
- package/dist/core/production-benchmark-evidence.d.ts +1 -9
- package/dist/core/production-benchmark-evidence.js +0 -22
- package/dist/core/rebuild-progress.d.ts +3 -2
- package/dist/core/rebuild-progress.js +5 -2
- package/dist/core/run-registry.d.ts +7 -28
- package/dist/core/run-registry.js +6 -51
- package/dist/core/session-retention-liveness.d.ts +0 -2
- package/dist/core/session-retention-liveness.js +0 -13
- package/dist/core/session-state.d.ts +1 -2
- package/dist/core/session-state.js +2 -3
- package/dist/core/settings-spec.d.ts +19 -60
- package/dist/core/settings-spec.js +30 -60
- package/dist/core/status-format.d.ts +0 -14
- package/dist/core/status-format.js +2 -24
- package/dist/core/types/agent-types.d.ts +26 -9
- package/dist/core/types/benchmark-types.d.ts +17 -0
- package/dist/core/types/environment-types.d.ts +64 -0
- package/dist/core/types/environment-types.js +1 -0
- package/dist/core/utils.d.ts +14 -4
- package/dist/core/utils.js +32 -6
- package/dist/domain/agents/agent-switch.js +2 -4
- package/dist/domain/agents/config.js +1 -1
- package/dist/domain/agents/environments/entities.d.ts +49 -0
- package/dist/domain/agents/environments/entities.js +94 -0
- package/dist/domain/agents/environments/file-refs.d.ts +19 -0
- package/dist/domain/agents/environments/file-refs.js +48 -0
- package/dist/domain/agents/environments/index.d.ts +6 -0
- package/dist/domain/agents/environments/index.js +8 -0
- package/dist/domain/agents/environments/paths.d.ts +7 -0
- package/dist/domain/agents/environments/paths.js +9 -0
- package/dist/domain/{threads/template-resolver.js → agents/environments/prompt-includes.js} +2 -2
- package/dist/domain/agents/environments/registry.d.ts +17 -0
- package/dist/domain/agents/environments/registry.js +159 -0
- package/dist/domain/agents/environments/schema.d.ts +68 -0
- package/dist/domain/agents/environments/schema.js +111 -0
- package/dist/domain/agents/environments/schema.parity.d.ts +1 -0
- package/dist/domain/agents/environments/schema.parity.js +7 -0
- package/dist/domain/agents/environments/slot-config.d.ts +14 -0
- package/dist/domain/agents/environments/slot-config.js +78 -0
- package/dist/domain/agents/model-selection.d.ts +3 -0
- package/dist/domain/agents/model-selection.js +1 -1
- package/dist/domain/agents/subagent/runner.js +3 -2
- package/dist/domain/benchmark/accounting-reconciliation.d.ts +1 -1
- package/dist/domain/benchmark/atif.d.ts +4 -4
- package/dist/domain/benchmark/atif.js +7 -7
- package/dist/domain/benchmark/attempt-record.d.ts +16 -55
- package/dist/domain/benchmark/attempt-record.js +3 -17
- package/dist/domain/benchmark/composite-manifest.d.ts +4 -4
- package/dist/domain/benchmark/composite-manifest.js +5 -11
- package/dist/domain/benchmark/journal.d.ts +6 -4
- package/dist/domain/benchmark/journal.js +6 -4
- package/dist/domain/benchmark/manifest-contract.d.ts +1 -1
- package/dist/domain/benchmark/production-attempt-identity.d.ts +11 -16
- package/dist/domain/benchmark/production-attempt-identity.js +31 -94
- package/dist/domain/benchmark/production-attempt-journal.js +14 -7
- package/dist/domain/benchmark/production-evidence-journal.js +8 -6
- package/dist/domain/benchmark/production-evidence-projection.d.ts +1 -11
- package/dist/domain/benchmark/production-evidence-projection.js +32 -143
- package/dist/domain/benchmark/session-evidence.d.ts +6 -0
- package/dist/domain/benchmark/session-evidence.js +27 -0
- package/dist/domain/costs/cost-tracker.d.ts +1 -7
- package/dist/domain/costs/cost-tracker.js +0 -4
- package/dist/domain/costs/resume-registry.d.ts +9 -20
- package/dist/domain/costs/resume-registry.js +24 -39
- package/dist/domain/executions/registry.d.ts +3 -18
- package/dist/domain/executions/registry.js +4 -158
- package/dist/domain/mcp/bundled-server.js +20 -27
- package/dist/domain/mcp/tools/commission-tools.js +0 -1
- package/dist/domain/mcp/tools/context.d.ts +2 -9
- package/dist/domain/mcp/tools/context.js +2 -7
- package/dist/domain/mcp/tools/executions.js +6 -19
- package/dist/domain/mcp/tools/interaction-ask.js +0 -1
- package/dist/domain/mcp/tools/interaction-plan.d.ts +0 -1
- package/dist/domain/mcp/tools/interaction-plan.js +0 -2
- package/dist/domain/mcp/tools/{task-ops.d.ts → remote-ops.d.ts} +1 -1
- package/dist/domain/mcp/tools/{task-ops.js → remote-ops.js} +1 -1
- package/dist/domain/mcp/tools/schedule.d.ts +3 -3
- package/dist/domain/mcp/tools/schedule.js +10 -32
- package/dist/domain/mcp/tools/subagent.d.ts +4 -0
- package/dist/domain/mcp/tools/subagent.js +10 -8
- package/dist/domain/mcp/tools/ui-view.js +3 -2
- package/dist/domain/mcp/tools/waitpoint.js +2 -3
- package/dist/domain/mcp/tools/{thread-ops.d.ts → workers.d.ts} +1 -1
- package/dist/domain/mcp/tools/workers.js +84 -0
- package/dist/domain/memory/user-context.d.ts +2 -3
- package/dist/domain/memory/user-context.js +2 -3
- package/dist/domain/monitor/gpu-monitor.js +1 -1
- package/dist/domain/pi-providers/custom-provider-model.d.ts +1 -1
- package/dist/domain/projects/project-store.d.ts +1 -2
- package/dist/domain/projects/project-store.js +1 -9
- package/dist/domain/remote/client-manager.d.ts +1 -1
- package/dist/domain/remote/client-manager.js +1 -1
- package/dist/domain/remote/client-remove.d.ts +1 -1
- package/dist/domain/remote/machine-registry.d.ts +54 -0
- package/dist/domain/{tasks/dispatch-utils.js → remote/machine-registry.js} +1 -61
- package/dist/domain/runs/attempt.js +3 -8
- package/dist/domain/runs/builders.d.ts +2 -3
- package/dist/domain/runs/builders.js +2 -3
- package/dist/domain/runs/engine-spec.js +3 -10
- package/dist/domain/runs/fallback.d.ts +1 -3
- package/dist/domain/runs/fallback.js +1 -3
- package/dist/domain/runs/observers/resume-recorder.d.ts +0 -15
- package/dist/domain/runs/observers/resume-recorder.js +0 -17
- package/dist/domain/runs/prompt.d.ts +23 -8
- package/dist/domain/runs/prompt.js +31 -5
- package/dist/domain/runs/request.d.ts +6 -15
- package/dist/domain/runs/run.js +0 -2
- package/dist/domain/runs/service.js +0 -2
- package/dist/domain/runs/spec-loader.d.ts +4 -6
- package/dist/domain/runs/spec-loader.js +3 -5
- package/dist/domain/scheduling/builtin-job-migration.js +3 -3
- package/dist/domain/scheduling/builtin-jobs.js +0 -13
- package/dist/domain/scheduling/job-registry.d.ts +12 -27
- package/dist/domain/scheduling/job-registry.js +2 -3
- package/dist/domain/scheduling/jobs/scheduled-task.d.ts +18 -6
- package/dist/domain/scheduling/jobs/scheduled-task.js +66 -125
- package/dist/domain/scheduling/run-guards.d.ts +6 -0
- package/dist/domain/scheduling/run-guards.js +18 -0
- package/dist/domain/scheduling/runner.d.ts +0 -1
- package/dist/domain/scheduling/runner.js +0 -1
- package/dist/domain/scheduling/schedule-cli.js +1 -1
- package/dist/domain/scheduling/scheduler.d.ts +0 -4
- package/dist/domain/scheduling/scheduler.js +2 -6
- package/dist/domain/sessions/session-hooks.d.ts +2 -2
- package/dist/domain/sessions/session-lifecycle.d.ts +23 -9
- package/dist/domain/sessions/session-lifecycle.js +27 -15
- package/dist/domain/sessions/session-retention.d.ts +8 -0
- package/dist/domain/sessions/session-retention.js +139 -34
- package/dist/domain/sessions/team.d.ts +18 -0
- package/dist/domain/sessions/team.js +21 -0
- package/dist/domain/system/install-cli.js +5 -5
- package/dist/domain/system/rebuild-hold.d.ts +1 -1
- package/dist/domain/system/server-update-check.js +2 -1
- package/dist/domain/ui-service/app-router.d.ts +41 -154
- package/dist/domain/ui-service/app-router.js +9 -30
- package/dist/domain/ui-service/input-schemas.d.ts +64 -205
- package/dist/domain/ui-service/input-schemas.js +26 -71
- package/dist/domain/ui-service/mutate/environments.d.ts +23 -0
- package/dist/domain/ui-service/mutate/environments.js +51 -0
- package/dist/domain/ui-service/mutate/plugin-packages.js +3 -9
- package/dist/domain/ui-service/mutate/plugins.js +7 -109
- package/dist/domain/ui-service/mutate/schedules.js +1 -2
- package/dist/domain/ui-service/plugins-shared.d.ts +0 -3
- package/dist/domain/ui-service/plugins-shared.js +0 -14
- package/dist/domain/ui-service/query/config.js +10 -13
- package/dist/domain/ui-service/query/environments.d.ts +12 -0
- package/dist/domain/ui-service/query/environments.js +72 -0
- package/dist/domain/ui-service/query/executions.js +1 -1
- package/dist/domain/ui-service/query/hooks.d.ts +1 -1
- package/dist/domain/ui-service/query/hooks.js +13 -24
- package/dist/domain/ui-service/query/memory.js +1 -1
- package/dist/domain/ui-service/query/plugins.js +6 -82
- package/dist/domain/ui-service/query/schedules.js +0 -1
- package/dist/domain/ui-service/query/sessions.js +23 -5
- package/dist/domain/ui-service/query/system.js +0 -1
- package/dist/domain/ui-service/query-input-schemas.d.ts +5 -26
- package/dist/domain/ui-service/query-input-schemas.js +0 -18
- package/dist/domain/ui-service/types.d.ts +68 -330
- package/dist/domain/ui-service/ui-service.js +7 -23
- package/dist/domain/waitpoints/notices.d.ts +1 -1
- package/dist/domain/waitpoints/notices.js +1 -1
- package/dist/entry/app.js +70 -146
- package/dist/entry/cli-help.js +0 -1
- package/dist/entry/cli.js +1 -6
- package/dist/entry/daemon.d.ts +27 -23
- package/dist/entry/daemon.js +61 -49
- package/dist/entry/fast-install.d.ts +13 -2
- package/dist/entry/fast-install.js +43 -11
- package/dist/entry/hook-cli.d.ts +0 -1
- package/dist/entry/hook-cli.js +20 -49
- package/dist/entry/init.js +8 -11
- package/dist/entry/local-ui.d.ts +1 -1
- package/dist/entry/platform-connect.d.ts +23 -0
- package/dist/entry/platform-connect.js +94 -0
- package/dist/entry/production-evidence-export-cli.js +0 -2
- package/dist/events/event-logger.js +1 -0
- package/dist/events/event-types.d.ts +13 -62
- package/dist/hooks/cortex-hook-api.mjs +1 -3
- package/dist/hooks/new-session-hook.mjs +2 -3
- package/dist/hooks/status-md-guard.mjs +5 -5
- package/dist/orchestration/agent-runner.d.ts +3 -0
- package/dist/orchestration/agent-runner.js +21 -19
- package/dist/orchestration/agent-view-send.d.ts +7 -0
- package/dist/orchestration/agent-view-send.js +12 -0
- package/dist/orchestration/benchmark-session-webhook.d.ts +19 -0
- package/dist/orchestration/benchmark-session-webhook.js +130 -0
- package/dist/orchestration/conversation-request.d.ts +39 -1
- package/dist/orchestration/conversation-request.js +71 -15
- package/dist/orchestration/interactions/answer-question.d.ts +16 -0
- package/dist/orchestration/interactions/answer-question.js +38 -0
- package/dist/orchestration/interactions/ask-user-question.d.ts +2 -3
- package/dist/orchestration/interactions/ask-user-question.js +1 -3
- package/dist/orchestration/interactions/ask-user-resume.d.ts +1 -3
- package/dist/orchestration/interactions/ask-user-resume.js +2 -14
- package/dist/orchestration/interactions/interaction-handlers.js +6 -35
- package/dist/orchestration/interactions/plan-response.d.ts +2 -1
- package/dist/orchestration/interactions/plan-response.js +2 -2
- package/dist/orchestration/orchestrator.d.ts +1 -7
- package/dist/orchestration/orchestrator.js +2 -11
- package/dist/orchestration/resume-dispatcher.d.ts +0 -22
- package/dist/orchestration/resume-dispatcher.js +8 -72
- package/dist/orchestration/routing/commands/cancel.d.ts +1 -7
- package/dist/orchestration/routing/commands/cancel.js +17 -37
- package/dist/orchestration/routing/commands/channel.js +1 -1
- package/dist/orchestration/routing/commands/device.js +1 -1
- package/dist/orchestration/routing/commands/index.d.ts +0 -7
- package/dist/orchestration/routing/commands/index.js +1 -9
- package/dist/orchestration/routing/commands/mode.js +7 -7
- package/dist/orchestration/routing/commands/nvtop.js +1 -1
- package/dist/orchestration/routing/commands/sendfile.js +1 -1
- package/dist/orchestration/routing/commands/status.js +8 -14
- package/dist/orchestration/routing/hook-bridge-subscribers.d.ts +4 -1
- package/dist/orchestration/routing/hook-bridge-subscribers.js +19 -12
- package/dist/orchestration/routing/hook-bridge.d.ts +3 -3
- package/dist/orchestration/routing/hook-bridge.js +9 -9
- package/dist/orchestration/routing/message-router.js +2 -25
- package/dist/orchestration/routing/webhook.js +24 -350
- package/dist/orchestration/session-events.d.ts +13 -0
- package/dist/orchestration/session-events.js +8 -0
- package/dist/orchestration/session-gateway.d.ts +4 -2
- package/dist/orchestration/session-gateway.js +17 -12
- package/dist/orchestration/session-retention-controller.d.ts +5 -2
- package/dist/orchestration/session-retention-controller.js +7 -4
- package/dist/orchestration/status-helpers.d.ts +1 -4
- package/dist/orchestration/status-helpers.js +3 -5
- package/dist/orchestration/team-delivery.d.ts +64 -0
- package/dist/orchestration/team-delivery.js +224 -0
- package/dist/orchestration/team-state.d.ts +48 -0
- package/dist/orchestration/team-state.js +146 -0
- package/dist/orchestration/team-webhook.d.ts +48 -0
- package/dist/orchestration/team-webhook.js +295 -0
- package/dist/orchestration/transcript-sink.d.ts +18 -4
- package/dist/orchestration/transcript-sink.js +31 -3
- package/dist/orchestration/turn/background-hold.d.ts +2 -2
- package/dist/orchestration/turn/background-hold.js +1 -1
- package/dist/orchestration/turn/hold-render-platform.d.ts +2 -2
- package/dist/orchestration/turn/hold-render-platform.js +2 -2
- package/dist/orchestration/turn/hold-render-web.d.ts +3 -3
- package/dist/orchestration/turn/hold-render-web.js +2 -2
- package/dist/orchestration/turn/terminal.d.ts +5 -2
- package/dist/orchestration/turn/terminal.js +11 -10
- package/dist/orchestration/turn/turn.d.ts +13 -1
- package/dist/orchestration/turn/turn.js +58 -15
- package/dist/platform/adapters/composite-adapter.d.ts +2 -0
- package/dist/platform/adapters/composite-adapter.js +7 -4
- package/dist/platform/adapters/feishu.d.ts +6 -0
- package/dist/platform/adapters/feishu.js +50 -4
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.js +1 -1
- package/dist/platform/tui/protocol.d.ts +2 -2
- package/dist/platform/types.d.ts +3 -3
- package/dist/platform/types.js +3 -3
- package/dist/store/conversation-history-reader.js +17 -3
- package/dist/store/conversation-history-repo.d.ts +18 -4
- package/dist/store/conversation-history-repo.js +14 -5
- package/dist/store/conversation-ledger-repo.js +1 -16
- package/dist/store/execution-repo.d.ts +17 -40
- package/dist/store/execution-repo.js +46 -116
- package/dist/store/hook-registry.d.ts +4 -16
- package/dist/store/hook-registry.js +5 -65
- package/dist/store/plugin-sync.js +4 -0
- package/dist/store/profile-repo.js +1 -1
- package/dist/store/prompt-migration-replacements.d.ts +0 -1
- package/dist/store/prompt-migration-replacements.js +0 -49
- package/dist/store/retention-candidate-repo.d.ts +2 -0
- package/dist/store/retention-candidate-repo.js +5 -0
- package/dist/store/schedule-repo.d.ts +3 -15
- package/dist/store/schedule-repo.js +18 -4
- package/dist/store/session-registry-journal.d.ts +15 -0
- package/dist/store/session-registry-journal.js +68 -10
- package/dist/store/session-registry-repo.d.ts +13 -0
- package/dist/store/session-registry-repo.js +74 -21
- package/dist/store/session-totals.d.ts +3 -3
- package/dist/store/session-totals.js +3 -3
- package/dist/store/team-outbox-repo.d.ts +20 -0
- package/dist/store/team-outbox-repo.js +39 -0
- package/dist/store/tool-image-files.d.ts +12 -0
- package/dist/store/tool-image-files.js +40 -0
- package/dist/store/version-migrations.d.ts +31 -8
- package/dist/store/version-migrations.js +307 -87
- package/dist/store/waitpoint-repo.d.ts +0 -2
- package/dist/tui/App.js +1 -1
- package/dist/tui/components/Dashboard.js +0 -8
- package/dist/tui/components/InputBox.js +1 -7
- package/dist/tui/components/StatusLine.js +1 -1
- package/dist/tui/hooks/useDashboardData.d.ts +1 -1
- package/dist/tui/hooks/useDashboardData.js +0 -4
- package/dist/tui/hooks/useNotifications.d.ts +1 -1
- package/dist/tui/slash-commands.js +1 -4
- package/package.json +4 -5
- package/web/dist/assets/index-BU_kY1rV.js +449 -0
- package/web/dist/assets/{index-zvUjPRjt.js → index-CDjsmgsy.js} +1 -1
- package/web/dist/assets/index-DzPDbcY1.css +1 -0
- package/web/dist/index.html +2 -2
- package/defaults/config/hooks/02-tasks-yaml-guard.json +0 -11
- package/defaults/config/hooks/11-task-status-check.json +0 -14
- package/defaults/config/thread-templates/agents/coder-reviewer.json +0 -17
- package/defaults/config/thread-templates/agents/coder.json +0 -17
- package/defaults/config/thread-templates/agents/direct-review.json +0 -14
- package/defaults/config/thread-templates/agents/direct-web.json +0 -14
- package/defaults/config/thread-templates/agents/director.json +0 -11
- package/defaults/config/thread-templates/agents/doc-reviewer.json +0 -13
- package/defaults/config/thread-templates/agents/doc-writer.json +0 -24
- package/defaults/config/thread-templates/agents/executor-reviewer.json +0 -13
- package/defaults/config/thread-templates/agents/executor.json +0 -24
- package/defaults/config/thread-templates/agents/main.json +0 -14
- package/defaults/config/thread-templates/agents/manager.json +0 -14
- package/defaults/config/thread-templates/agents/scheduler-main.json +0 -13
- package/defaults/config/thread-templates/shells/worker-review.json +0 -12
- package/defaults/config/thread-templates/templates/coder-review.json +0 -20
- package/defaults/config/thread-templates/templates/default.json +0 -10
- package/defaults/config/thread-templates/templates/doc-review.json +0 -6
- package/defaults/config/thread-templates/templates/execute-review.json +0 -6
- package/defaults/config/thread-templates/templates/manager.json +0 -11
- package/defaults/config/thread-templates/templates/scheduler.json +0 -10
- package/defaults/hooks/task-status-check.mjs +0 -166
- package/defaults/hooks/tasks-yaml-guard.mjs +0 -225
- package/defaults/plugins/cortex-system/skills/task/SKILL.md +0 -547
- package/defaults/plugins/cortex-system/skills/thread/SKILL.md +0 -505
- package/defaults/prompts/directives/coder-reviewer.md +0 -7
- package/defaults/prompts/directives/coder.md +0 -7
- package/defaults/prompts/directives/director.md +0 -7
- package/defaults/prompts/directives/doc-reviewer.md +0 -6
- package/defaults/prompts/directives/doc-writer.md +0 -7
- package/defaults/prompts/directives/executor-reviewer.md +0 -6
- package/defaults/prompts/directives/executor.md +0 -7
- package/defaults/prompts/directives/manager.md +0 -24
- package/defaults/prompts/systemPrompts/coder.md +0 -10
- package/defaults/prompts/systemPrompts/worker.md +0 -10
- package/defaults/rules/task-system.md +0 -53
- package/dist/core/task-node.d.ts +0 -7
- package/dist/core/task-node.js +0 -21
- package/dist/core/task-parser.d.ts +0 -86
- package/dist/core/task-parser.js +0 -436
- package/dist/core/types/thread-types.d.ts +0 -506
- package/dist/domain/benchmark/production-evidence-topology.d.ts +0 -14
- package/dist/domain/benchmark/production-evidence-topology.js +0 -257
- package/dist/domain/mcp/tools/manager-qa.d.ts +0 -4
- package/dist/domain/mcp/tools/manager-qa.js +0 -63
- package/dist/domain/mcp/tools/task-monitor.d.ts +0 -3
- package/dist/domain/mcp/tools/task-monitor.js +0 -92
- package/dist/domain/mcp/tools/thread-ops.js +0 -73
- package/dist/domain/scheduling/jobs/register-thread-session.d.ts +0 -15
- package/dist/domain/scheduling/jobs/register-thread-session.js +0 -32
- package/dist/domain/scheduling/jobs/target-dispatch.d.ts +0 -30
- package/dist/domain/scheduling/jobs/target-dispatch.js +0 -33
- package/dist/domain/scheduling/jobs/task-archive.d.ts +0 -2
- package/dist/domain/scheduling/jobs/task-archive.js +0 -16
- package/dist/domain/scheduling/jobs/task-dispatch.d.ts +0 -12
- package/dist/domain/scheduling/jobs/task-dispatch.js +0 -402
- package/dist/domain/tasks/acceptance-ledger.d.ts +0 -39
- package/dist/domain/tasks/acceptance-ledger.js +0 -133
- package/dist/domain/tasks/archiver.d.ts +0 -10
- package/dist/domain/tasks/archiver.js +0 -133
- package/dist/domain/tasks/claim-recovery.d.ts +0 -9
- package/dist/domain/tasks/claim-recovery.js +0 -54
- package/dist/domain/tasks/dispatch-utils.d.ts +0 -117
- package/dist/domain/tasks/dispatcher.d.ts +0 -49
- package/dist/domain/tasks/dispatcher.js +0 -305
- package/dist/domain/tasks/lint.d.ts +0 -12
- package/dist/domain/tasks/lint.js +0 -130
- package/dist/domain/tasks/mutator.d.ts +0 -39
- package/dist/domain/tasks/mutator.js +0 -176
- package/dist/domain/tasks/production-topology-ledger.d.ts +0 -106
- package/dist/domain/tasks/production-topology-ledger.js +0 -161
- package/dist/domain/tasks/system/task-cli.d.ts +0 -7
- package/dist/domain/tasks/system/task-cli.js +0 -991
- package/dist/domain/tasks/system/task-completion.d.ts +0 -44
- package/dist/domain/tasks/system/task-completion.js +0 -262
- package/dist/domain/tasks/system/task-file-input.d.ts +0 -10
- package/dist/domain/tasks/system/task-file-input.js +0 -53
- package/dist/domain/tasks/system/task-id-utils.d.ts +0 -24
- package/dist/domain/tasks/system/task-id-utils.js +0 -90
- package/dist/domain/tasks/system/task-lifecycle-edit.d.ts +0 -40
- package/dist/domain/tasks/system/task-lifecycle-edit.js +0 -419
- package/dist/domain/tasks/system/task-lock.d.ts +0 -44
- package/dist/domain/tasks/system/task-lock.js +0 -137
- package/dist/domain/tasks/system/task-mutations.d.ts +0 -86
- package/dist/domain/tasks/system/task-mutations.js +0 -336
- package/dist/domain/tasks/system/task-state.d.ts +0 -140
- package/dist/domain/tasks/system/task-state.js +0 -287
- package/dist/domain/threads/artifact-io.d.ts +0 -4
- package/dist/domain/threads/artifact-io.js +0 -57
- package/dist/domain/threads/contract.d.ts +0 -17
- package/dist/domain/threads/contract.js +0 -54
- package/dist/domain/threads/evidence-context.d.ts +0 -2
- package/dist/domain/threads/evidence-context.js +0 -40
- package/dist/domain/threads/hook-runner.d.ts +0 -7
- package/dist/domain/threads/hook-runner.js +0 -237
- package/dist/domain/threads/index.d.ts +0 -7
- package/dist/domain/threads/index.js +0 -13
- package/dist/domain/threads/pending-user-inputs.d.ts +0 -3
- package/dist/domain/threads/pending-user-inputs.js +0 -33
- package/dist/domain/threads/prompt-builder.d.ts +0 -55
- package/dist/domain/threads/prompt-builder.js +0 -245
- package/dist/domain/threads/runner.d.ts +0 -150
- package/dist/domain/threads/runner.js +0 -832
- package/dist/domain/threads/shell-templates.d.ts +0 -9
- package/dist/domain/threads/shell-templates.js +0 -108
- package/dist/domain/threads/state-machine.d.ts +0 -96
- package/dist/domain/threads/state-machine.js +0 -646
- package/dist/domain/threads/template-loader.d.ts +0 -37
- package/dist/domain/threads/template-loader.js +0 -487
- package/dist/domain/threads/template-validate.d.ts +0 -287
- package/dist/domain/threads/template-validate.js +0 -575
- package/dist/domain/threads/template-validate.parity.d.ts +0 -1
- package/dist/domain/threads/template-validate.parity.js +0 -39
- package/dist/domain/threads/template-writer.d.ts +0 -57
- package/dist/domain/threads/template-writer.js +0 -126
- package/dist/domain/threads/thread-transcript.d.ts +0 -60
- package/dist/domain/threads/thread-transcript.js +0 -117
- package/dist/domain/threads/tree.d.ts +0 -46
- package/dist/domain/threads/tree.js +0 -196
- package/dist/domain/threads/utils.d.ts +0 -24
- package/dist/domain/threads/utils.js +0 -55
- package/dist/domain/ui-service/mutate/tasks.d.ts +0 -23
- package/dist/domain/ui-service/mutate/tasks.js +0 -58
- package/dist/domain/ui-service/mutate/thread-templates.d.ts +0 -4
- package/dist/domain/ui-service/mutate/thread-templates.js +0 -46
- package/dist/domain/ui-service/mutate/threads.d.ts +0 -4
- package/dist/domain/ui-service/mutate/threads.js +0 -19
- package/dist/domain/ui-service/query/task-verification.d.ts +0 -2
- package/dist/domain/ui-service/query/task-verification.js +0 -58
- package/dist/domain/ui-service/query/tasks.d.ts +0 -3
- package/dist/domain/ui-service/query/tasks.js +0 -73
- package/dist/domain/ui-service/query/thread-template-detail.d.ts +0 -2
- package/dist/domain/ui-service/query/thread-template-detail.js +0 -57
- package/dist/domain/ui-service/query/thread-templates.d.ts +0 -15
- package/dist/domain/ui-service/query/thread-templates.js +0 -79
- package/dist/domain/ui-service/query/threads.d.ts +0 -3
- package/dist/domain/ui-service/query/threads.js +0 -180
- package/dist/hooks/task-status-check.mjs +0 -166
- package/dist/hooks/tasks-yaml-guard.mjs +0 -225
- package/dist/orchestration/dispatch-reconciler.d.ts +0 -1
- package/dist/orchestration/dispatch-reconciler.js +0 -19
- package/dist/orchestration/human-answer-backstop.d.ts +0 -36
- package/dist/orchestration/human-answer-backstop.js +0 -69
- package/dist/orchestration/manager-qa.d.ts +0 -66
- package/dist/orchestration/manager-qa.js +0 -356
- package/dist/orchestration/routing/commands/dispatch.d.ts +0 -2
- package/dist/orchestration/routing/commands/dispatch.js +0 -48
- package/dist/orchestration/routing/commands/task.d.ts +0 -4
- package/dist/orchestration/routing/commands/task.js +0 -140
- package/dist/orchestration/routing/commands/thread-handlers.d.ts +0 -2
- package/dist/orchestration/routing/commands/thread-handlers.js +0 -152
- package/dist/orchestration/thread-callback.d.ts +0 -107
- package/dist/orchestration/thread-callback.js +0 -555
- package/dist/orchestration/thread-delivery.d.ts +0 -40
- package/dist/orchestration/thread-delivery.js +0 -76
- package/dist/orchestration/thread-executor.d.ts +0 -25
- package/dist/orchestration/thread-executor.js +0 -180
- package/dist/orchestration/thread-input.d.ts +0 -15
- package/dist/orchestration/thread-input.js +0 -50
- package/dist/orchestration/thread-notices.d.ts +0 -43
- package/dist/orchestration/thread-notices.js +0 -195
- package/dist/orchestration/thread-run/index.d.ts +0 -3
- package/dist/orchestration/thread-run/index.js +0 -2
- package/dist/orchestration/thread-run/render-summary.d.ts +0 -57
- package/dist/orchestration/thread-run/render-summary.js +0 -109
- package/dist/orchestration/thread-run/render-task.d.ts +0 -94
- package/dist/orchestration/thread-run/render-task.js +0 -154
- package/dist/orchestration/thread-run/settle.d.ts +0 -11
- package/dist/orchestration/thread-run/settle.js +0 -18
- package/dist/orchestration/thread-run/thread-run.d.ts +0 -114
- package/dist/orchestration/thread-run/thread-run.js +0 -181
- package/dist/orchestration/thread-run/thread-surface.d.ts +0 -41
- package/dist/orchestration/thread-run/thread-surface.js +0 -23
- package/dist/orchestration/thread-run/verdict.d.ts +0 -11
- package/dist/orchestration/thread-run/verdict.js +0 -20
- package/dist/store/plugin-retirement.d.ts +0 -37
- package/dist/store/plugin-retirement.js +0 -144
- package/dist/store/task-repo.d.ts +0 -43
- package/dist/store/task-repo.js +0 -143
- package/dist/store/thread-repo.d.ts +0 -65
- package/dist/store/thread-repo.js +0 -294
- package/dist/tui/components/DashboardTasksTab.d.ts +0 -12
- package/dist/tui/components/DashboardTasksTab.js +0 -196
- package/dist/tui/components/DashboardThreadsTab.d.ts +0 -11
- package/dist/tui/components/DashboardThreadsTab.js +0 -96
- package/web/dist/assets/index-C9sEss8T.css +0 -1
- package/web/dist/assets/index-fVf_wSMQ.js +0 -447
- /package/defaults/config/{thread-templates/agents → environments}/creative.json +0 -0
- /package/dist/core/types/{thread-types.js → benchmark-types.js} +0 -0
- /package/dist/domain/{threads/template-resolver.d.ts → agents/environments/prompt-includes.d.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as path from 'node:path';
|
|
2
2
|
import * as fs from 'node:fs/promises';
|
|
3
3
|
import * as os from 'node:os';
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
4
5
|
import { CORTEX_VERSION, CORTEX_DOCS_URL } from '../core/version.js';
|
|
5
6
|
import { DATA_DIR, DEFAULTS_DIR } from '../core/paths.js';
|
|
6
7
|
import { atomicWrite } from '../core/atomic-write.js';
|
|
@@ -8,7 +9,7 @@ import { createLogger } from '../core/log.js';
|
|
|
8
9
|
import { validateHookEntry } from './hook-registry.js';
|
|
9
10
|
import { migrateProviderStateFromSchedules } from './provider-state-repo.js';
|
|
10
11
|
import { importLegacySessionStores } from './session-registry-import.js';
|
|
11
|
-
import { CODER_COMMIT_POLICY_REPLACEMENTS, CODER_REVIEWER_COMMIT_POLICY_REPLACEMENTS,
|
|
12
|
+
import { CODER_COMMIT_POLICY_REPLACEMENTS, CODER_REVIEWER_COMMIT_POLICY_REPLACEMENTS, STATUS_REGISTER_REPLACEMENTS, } from './prompt-migration-replacements.js';
|
|
12
13
|
const log = createLogger('version-migrations');
|
|
13
14
|
// ── CalVer comparison ──────────────────────────────────────────
|
|
14
15
|
// CalVer format: YYYY.M.D (no zero-padding, e.g. 2026.5.23).
|
|
@@ -34,14 +35,20 @@ export function compareCalVer(a, b) {
|
|
|
34
35
|
// clobbering user customizations: a versioned, marker-delimited block is upserted
|
|
35
36
|
// (replaced in place if present, appended otherwise). Bumping the block version token
|
|
36
37
|
// makes a future migration replace an older block cleanly.
|
|
37
|
-
const DOCS_BLOCK_VERSION = 'v1';
|
|
38
|
-
const DOCS_MARKER_START = `<!-- cortex:docs ${DOCS_BLOCK_VERSION} -->`;
|
|
39
38
|
const DOCS_MARKER_END = '<!-- /cortex:docs -->';
|
|
39
|
+
/** The first shipped docs block. It named tasks and threads, which no longer exist; a copy still
|
|
40
|
+
* byte-identical to it is upgraded to {@link DOCS_BLOCK}, a customized one is left alone. */
|
|
41
|
+
const DOCS_BLOCK_V1 = [
|
|
42
|
+
'<!-- cortex:docs v1 -->',
|
|
43
|
+
'# Cortex documentation',
|
|
44
|
+
`For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: ${CORTEX_DOCS_URL}`,
|
|
45
|
+
DOCS_MARKER_END,
|
|
46
|
+
].join('\n');
|
|
40
47
|
/** The canonical Cortex-docs block inserted into system prompts and AGENTS.md. */
|
|
41
48
|
const DOCS_BLOCK = [
|
|
42
|
-
|
|
49
|
+
'<!-- cortex:docs v2 -->',
|
|
43
50
|
'# Cortex documentation',
|
|
44
|
-
`For how to use Cortex —
|
|
51
|
+
`For how to use Cortex — sessions, scheduling, memory, skills, safety & approvals — consult the docs: ${CORTEX_DOCS_URL}`,
|
|
45
52
|
DOCS_MARKER_END,
|
|
46
53
|
].join('\n');
|
|
47
54
|
/** Replace any existing `<!-- cortex:docs ... -->` … `<!-- /cortex:docs -->` region with
|
|
@@ -136,42 +143,6 @@ const PI_SUBAGENT_ROLE_REPLACEMENTS = [
|
|
|
136
143
|
// Add new migrations here. The runner groups them by filePath and applies
|
|
137
144
|
// pending ones in version-ascending order.
|
|
138
145
|
const migrations = [
|
|
139
|
-
// M1: Backfill systemPrompt on user agents that are missing it.
|
|
140
|
-
// Agents that exist in both user config and defaults, but whose user version
|
|
141
|
-
// has no systemPrompt field, get the default agent's systemPrompt value copied.
|
|
142
|
-
// Agents that already have systemPrompt are left untouched. User-only agents
|
|
143
|
-
// (not in defaults) are skipped.
|
|
144
|
-
{
|
|
145
|
-
filePath: 'config/thread-templates.json',
|
|
146
|
-
version: '2026.5.23',
|
|
147
|
-
migrate(data, defaultsData) {
|
|
148
|
-
if (!defaultsData || typeof defaultsData !== 'object' || defaultsData === null)
|
|
149
|
-
return data;
|
|
150
|
-
if (typeof data !== 'object' || data === null)
|
|
151
|
-
return data;
|
|
152
|
-
const d = data;
|
|
153
|
-
const defs = defaultsData;
|
|
154
|
-
const userAgents = d.agents;
|
|
155
|
-
const defaultAgents = defs.agents;
|
|
156
|
-
if (!userAgents || !defaultAgents)
|
|
157
|
-
return data;
|
|
158
|
-
let changed = false;
|
|
159
|
-
for (const [name, defAgent] of Object.entries(defaultAgents)) {
|
|
160
|
-
const userAgent = userAgents[name];
|
|
161
|
-
if (!userAgent || typeof userAgent !== 'object')
|
|
162
|
-
continue; // agent not in user config
|
|
163
|
-
const ua = userAgent;
|
|
164
|
-
const da = defAgent;
|
|
165
|
-
if (ua.systemPrompt === undefined && da.systemPrompt !== undefined) {
|
|
166
|
-
ua.systemPrompt = da.systemPrompt;
|
|
167
|
-
changed = true;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (changed)
|
|
171
|
-
d.agents = userAgents;
|
|
172
|
-
return data;
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
146
|
// M2: Backfill `provider` on pi profiles that predate the gateway-routing split (6e50225f).
|
|
176
147
|
// That commit made `provider` REQUIRED for backend='pi' with no default — so any pre-upgrade
|
|
177
148
|
// profiles.json with a pi profile lacking `provider` now fails the whole-file validation in
|
|
@@ -292,6 +263,21 @@ const migrations = [
|
|
|
292
263
|
return upsertMarkerBlock(data, DOCS_BLOCK);
|
|
293
264
|
},
|
|
294
265
|
})),
|
|
266
|
+
// M4b: the stock docs block named tasks and threads, both since removed. Only the exact stock
|
|
267
|
+
// block is rewritten, so a block the user edited (or a prompt that ships its own wording) stays.
|
|
268
|
+
...[
|
|
269
|
+
'AGENTS.md',
|
|
270
|
+
'prompts/systemPrompts/web-opus-4-6.md',
|
|
271
|
+
'prompts/systemPrompts/web-sonnet-4-6.md',
|
|
272
|
+
'prompts/systemPrompts/worker.md',
|
|
273
|
+
'prompts/systemPrompts/coder.md',
|
|
274
|
+
].map((filePath) => ({
|
|
275
|
+
filePath,
|
|
276
|
+
version: '2026.10.2',
|
|
277
|
+
format: 'text',
|
|
278
|
+
migrate: (data) => typeof data === 'string'
|
|
279
|
+
? applyReplacements(data, [[DOCS_BLOCK_V1, DOCS_BLOCK]]) : data,
|
|
280
|
+
})),
|
|
295
281
|
// M5: De-personalize the coder / coder-reviewer directives. The shipped wording
|
|
296
282
|
// hardcoded Cortex's own toolchain (a non-negotiable TDD mandate, `npm test` as THE
|
|
297
283
|
// test command, the dependency-cruiser linter by name) — fine for this repo, wrong as
|
|
@@ -340,12 +326,6 @@ const migrations = [
|
|
|
340
326
|
migrate: (data) => typeof data === 'string'
|
|
341
327
|
? applyReplacements(data, CODER_REVIEWER_COMMIT_POLICY_REPLACEMENTS) : data,
|
|
342
328
|
},
|
|
343
|
-
// M8: Move stock manager task creation off shell-interpolated arguments.
|
|
344
|
-
{
|
|
345
|
-
filePath: 'prompts/directives/manager.md', version: '2026.7.31', format: 'text',
|
|
346
|
-
migrate: (data) => typeof data === 'string'
|
|
347
|
-
? applyReplacements(data, MANAGER_TASK_FILE_REPLACEMENTS) : data,
|
|
348
|
-
},
|
|
349
329
|
// M9: Align coder commit instructions with repository privacy policy.
|
|
350
330
|
{
|
|
351
331
|
filePath: 'prompts/directives/coder.md', version: '2026.7.31', format: 'text',
|
|
@@ -353,13 +333,12 @@ const migrations = [
|
|
|
353
333
|
? applyReplacements(data, CODER_COMMIT_POLICY_REPLACEMENTS) : data,
|
|
354
334
|
},
|
|
355
335
|
// M10: STATUS.md register semantics. Stock prompts mandated unconditional
|
|
356
|
-
// STATUS.md updates (worker exit checklist
|
|
336
|
+
// STATUS.md updates (worker exit checklist) and a
|
|
357
337
|
// `## Milestone Verdict` STATUS section (director); the register convention
|
|
358
338
|
// makes STATUS updates conditional and keeps verdicts in the gate artifact.
|
|
359
339
|
// Idempotent via applyReplacements; customized copies don't match → no-op.
|
|
360
340
|
...[
|
|
361
341
|
'prompts/systemPrompts/worker.md',
|
|
362
|
-
'prompts/directives/manager.md',
|
|
363
342
|
'prompts/directives/director.md',
|
|
364
343
|
].map((filePath) => ({
|
|
365
344
|
filePath,
|
|
@@ -486,7 +465,277 @@ const stepMigrations = [
|
|
|
486
465
|
version: '2026.9.15',
|
|
487
466
|
run: async ({ dataDir }) => { await renameIndexRuleFile(dataDir); },
|
|
488
467
|
},
|
|
468
|
+
// S5: execution environments live in config/environments/ rather than among the thread agents.
|
|
469
|
+
// An install without that directory gets one holding the two environments that are kept, `main`
|
|
470
|
+
// and `creative`: the install's own copies from config/thread-templates/agents/ where they
|
|
471
|
+
// exist, the shipped environments otherwise. Copy only — S6 archives thread-templates later.
|
|
472
|
+
{
|
|
473
|
+
key: 'config/environments',
|
|
474
|
+
version: '2026.10.2',
|
|
475
|
+
run: async ({ dataDir, defaultsDir }) => { await seedEnvironmentsFromThreadAgents(dataDir, defaultsDir); },
|
|
476
|
+
},
|
|
477
|
+
// S6: threads and the task queue were removed. Their config and state are moved aside into
|
|
478
|
+
// config/archive/ and data/archive/ (never deleted), and the settings, MCP configs and tool
|
|
479
|
+
// allowlists stop naming them. Runs after S5 so the environments are seeded from the thread
|
|
480
|
+
// agents before those are archived.
|
|
481
|
+
{
|
|
482
|
+
key: 'sentinel:retire-threads-tasks',
|
|
483
|
+
version: '2026.10.2',
|
|
484
|
+
run: async ({ dataDir, storeDir, defaultsDir }) => {
|
|
485
|
+
await retireThreadAndTaskState(dataDir, storeDir, defaultsDir);
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
];
|
|
489
|
+
// ── Execution environments (S5) ────────────────────────────────
|
|
490
|
+
const KEPT_ENVIRONMENTS = ['main', 'creative'];
|
|
491
|
+
/** SHA-256 of every thread agent Cortex shipped under these names. An install's copy that matches
|
|
492
|
+
* one is stock rather than the user's own, so it is replaced by the shipped environment. The
|
|
493
|
+
* thread agents no longer ship, so the hashes are what remains of them. */
|
|
494
|
+
export const STOCK_THREAD_AGENT_SHA256 = {
|
|
495
|
+
main: [
|
|
496
|
+
'492a151f11a2376ffb714579a6950b6bc11e469d0852102935a6d0f1261c3eeb',
|
|
497
|
+
'b8358bb5ba5bef0998c3e4fc545150372fee98b503b1baf6fc210a8313d21271',
|
|
498
|
+
'c1d70e3b77b12fd611d4fbf7dcb7dcfcbbd16ed2d325597dc2e328d82a7c18f1',
|
|
499
|
+
],
|
|
500
|
+
creative: ['d0edb06aeeab32427dd9c6d649501b7b2078168e38d47bcac10700d32f3611dc'],
|
|
501
|
+
};
|
|
502
|
+
function sha256(text) {
|
|
503
|
+
return createHash('sha256').update(text, 'utf8').digest('hex');
|
|
504
|
+
}
|
|
505
|
+
async function readTextOrNull(filePath) {
|
|
506
|
+
try {
|
|
507
|
+
return await fs.readFile(filePath, 'utf8');
|
|
508
|
+
}
|
|
509
|
+
catch (error) {
|
|
510
|
+
if (error.code === 'ENOENT')
|
|
511
|
+
return null;
|
|
512
|
+
throw error;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
async function pathExists(filePath) {
|
|
516
|
+
try {
|
|
517
|
+
await fs.lstat(filePath);
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
520
|
+
catch (error) {
|
|
521
|
+
if (error.code === 'ENOENT')
|
|
522
|
+
return false;
|
|
523
|
+
throw error;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Build config/environments/ from the thread agents an install already has. The user's own file is
|
|
528
|
+
* copied verbatim; one still byte-identical to a shipped thread agent is replaced by the shipped
|
|
529
|
+
* environment, which drops the thread-only artifact instruction from its prompt template. The
|
|
530
|
+
* directory is assembled beside its final name and renamed into place, so an interrupted run leaves
|
|
531
|
+
* nothing that would make the retry skip. A home whose config is sealed is left alone.
|
|
532
|
+
*
|
|
533
|
+
* @returns the environment names written (empty when the directory already existed).
|
|
534
|
+
*/
|
|
535
|
+
export async function seedEnvironmentsFromThreadAgents(dataDir, defaultsDir, stockHashes = STOCK_THREAD_AGENT_SHA256) {
|
|
536
|
+
if (process.env.CORTEX_CONFIG_IMMUTABLE === '1')
|
|
537
|
+
return [];
|
|
538
|
+
const envDir = path.join(dataDir, 'config', 'environments');
|
|
539
|
+
if (await pathExists(envDir))
|
|
540
|
+
return [];
|
|
541
|
+
const agentsDir = path.join(dataDir, 'config', 'thread-templates', 'agents');
|
|
542
|
+
const shippedEnvDir = path.join(defaultsDir, 'config', 'environments');
|
|
543
|
+
const staging = `${envDir}.partial`;
|
|
544
|
+
await fs.rm(staging, { recursive: true, force: true });
|
|
545
|
+
await fs.mkdir(staging, { recursive: true });
|
|
546
|
+
const written = [];
|
|
547
|
+
for (const name of KEPT_ENVIRONMENTS) {
|
|
548
|
+
const file = `${name}.json`;
|
|
549
|
+
const own = await readTextOrNull(path.join(agentsDir, file));
|
|
550
|
+
const stock = own !== null && (stockHashes[name] ?? []).includes(sha256(own));
|
|
551
|
+
const content = own !== null && !stock ? own : await readTextOrNull(path.join(shippedEnvDir, file));
|
|
552
|
+
if (content === null)
|
|
553
|
+
continue;
|
|
554
|
+
await fs.writeFile(path.join(staging, file), content, 'utf8');
|
|
555
|
+
written.push(name);
|
|
556
|
+
}
|
|
557
|
+
await fs.rename(staging, envDir);
|
|
558
|
+
log.info(`Created config/environments with ${written.join(', ') || 'no environments'}`);
|
|
559
|
+
return written;
|
|
560
|
+
}
|
|
561
|
+
// ── Retired threads and task queue (S6) ────────────────────────
|
|
562
|
+
/** Generated MCP configs for the removed thread, task and manager-Q&A surfaces. */
|
|
563
|
+
const RETIRED_MCP_CONFIG_FILES = ['mcp-config-thread.json', 'mcp-config-tasks.json', 'mcp-config-manager-qa.json'];
|
|
564
|
+
const RETIRED_MCP_BUNDLES = new Set(['cortex-tasks', 'cortex-manager-qa', 'cortex-thread', 'cortex-benchmark-thread']);
|
|
565
|
+
const RETIRED_MCP_TOOLS = new Set([
|
|
566
|
+
'task_status', 'task_result', 'task_list', 'answer_subtask',
|
|
567
|
+
'thread_abort', 'thread_split', 'thread_wait', 'ask_manager', 'thread_run',
|
|
568
|
+
]);
|
|
569
|
+
const RETIRED_SETTING_KEYS = new Set([
|
|
570
|
+
'dispatchReconcilerEnabled', 'taskArtifactTemplates', 'managerRotateSteps', 'threadMaxDepth', 'waitingSweepMs',
|
|
571
|
+
]);
|
|
572
|
+
const RETIRED_SCHEDULE_TYPES = new Set(['task-dispatch', 'task-archive']);
|
|
573
|
+
/** Thread and task state under the store directory. */
|
|
574
|
+
const RETIRED_STORE_PATHS = [
|
|
575
|
+
'threads.json', path.join('archive', 'threads-archive.jsonl'), 'production-topology',
|
|
576
|
+
'pending-tasks.json', 'task-mutation-locks',
|
|
489
577
|
];
|
|
578
|
+
const MCP_BUNDLES_ENV_KEY = 'CORTEX_MCP_BUNDLES';
|
|
579
|
+
const MCP_TOOL_ALLOWLIST_ENV_KEY = 'CORTEX_MCP_TOOL_ALLOWLIST';
|
|
580
|
+
function isRetiredSettingKey(key) {
|
|
581
|
+
return key.startsWith('taskDispatch') || key.startsWith('taskArchive') || RETIRED_SETTING_KEYS.has(key);
|
|
582
|
+
}
|
|
583
|
+
/** UTC timestamp safe in a file name, e.g. `20261003T221500Z`. */
|
|
584
|
+
function archiveStamp(now) {
|
|
585
|
+
return now.toISOString().replace(/[-:]/g, '').replace(/\.\d+Z$/, 'Z');
|
|
586
|
+
}
|
|
587
|
+
/** Move `source` to `target` when it exists. Refuses to overwrite, so nothing archived earlier is
|
|
588
|
+
* ever replaced; the throw leaves the step unbumped and it retries next boot. */
|
|
589
|
+
async function moveAside(source, target) {
|
|
590
|
+
if (!await pathExists(source))
|
|
591
|
+
return false;
|
|
592
|
+
if (await pathExists(target))
|
|
593
|
+
throw new Error(`archive target already exists: ${target}`);
|
|
594
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
595
|
+
await fs.rename(source, target);
|
|
596
|
+
log.info(`Archived ${source} -> ${target}`);
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
async function readJsonOrNull(filePath) {
|
|
600
|
+
const text = await readTextOrNull(filePath);
|
|
601
|
+
if (text === null)
|
|
602
|
+
return null;
|
|
603
|
+
try {
|
|
604
|
+
return JSON.parse(text);
|
|
605
|
+
}
|
|
606
|
+
catch {
|
|
607
|
+
log.warn(`Leaving ${filePath} alone: not valid JSON`);
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function isRecord(value) {
|
|
612
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
613
|
+
}
|
|
614
|
+
/** Drop retired names from a JSON-encoded string array. Returns null when `raw` is not one, or
|
|
615
|
+
* when nothing was dropped. */
|
|
616
|
+
function withoutRetired(raw, retired) {
|
|
617
|
+
if (typeof raw !== 'string')
|
|
618
|
+
return null;
|
|
619
|
+
let parsed;
|
|
620
|
+
try {
|
|
621
|
+
parsed = JSON.parse(raw);
|
|
622
|
+
}
|
|
623
|
+
catch {
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
if (!Array.isArray(parsed) || parsed.some((value) => typeof value !== 'string'))
|
|
627
|
+
return null;
|
|
628
|
+
const kept = parsed.filter((value) => !retired.has(value));
|
|
629
|
+
return kept.length === parsed.length ? null : JSON.stringify(kept);
|
|
630
|
+
}
|
|
631
|
+
/** Strip the retired bundles and tools from one MCP config document. True when it changed. */
|
|
632
|
+
function stripRetiredMcpSurface(document) {
|
|
633
|
+
if (!isRecord(document) || !isRecord(document.mcpServers))
|
|
634
|
+
return false;
|
|
635
|
+
const servers = document.mcpServers;
|
|
636
|
+
let changed = false;
|
|
637
|
+
for (const name of Object.keys(servers)) {
|
|
638
|
+
if (RETIRED_MCP_BUNDLES.has(name)) {
|
|
639
|
+
delete servers[name];
|
|
640
|
+
changed = true;
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
const server = servers[name];
|
|
644
|
+
if (!isRecord(server))
|
|
645
|
+
continue;
|
|
646
|
+
if (Array.isArray(server.args)) {
|
|
647
|
+
for (let index = 0; index < server.args.length; index += 1) {
|
|
648
|
+
const next = withoutRetired(server.args[index], RETIRED_MCP_BUNDLES);
|
|
649
|
+
if (next !== null) {
|
|
650
|
+
server.args[index] = next;
|
|
651
|
+
changed = true;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
if (isRecord(server.env)) {
|
|
656
|
+
const bundles = withoutRetired(server.env[MCP_BUNDLES_ENV_KEY], RETIRED_MCP_BUNDLES);
|
|
657
|
+
if (bundles !== null) {
|
|
658
|
+
server.env[MCP_BUNDLES_ENV_KEY] = bundles;
|
|
659
|
+
changed = true;
|
|
660
|
+
}
|
|
661
|
+
const tools = withoutRetired(server.env[MCP_TOOL_ALLOWLIST_ENV_KEY], RETIRED_MCP_TOOLS);
|
|
662
|
+
if (tools !== null) {
|
|
663
|
+
server.env[MCP_TOOL_ALLOWLIST_ENV_KEY] = tools;
|
|
664
|
+
changed = true;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return changed;
|
|
669
|
+
}
|
|
670
|
+
async function stripMcpConfigFile(filePath) {
|
|
671
|
+
const document = await readJsonOrNull(filePath);
|
|
672
|
+
if (!stripRetiredMcpSurface(document))
|
|
673
|
+
return;
|
|
674
|
+
await atomicWrite(filePath, `${JSON.stringify(document, null, 2)}\n`);
|
|
675
|
+
log.info(`Removed retired MCP bundles and tools from ${filePath}`);
|
|
676
|
+
}
|
|
677
|
+
async function stripRetiredSettings(filePath) {
|
|
678
|
+
const settings = await readJsonOrNull(filePath);
|
|
679
|
+
if (!isRecord(settings))
|
|
680
|
+
return;
|
|
681
|
+
const retired = Object.keys(settings).filter(isRetiredSettingKey);
|
|
682
|
+
if (retired.length === 0)
|
|
683
|
+
return;
|
|
684
|
+
for (const key of retired)
|
|
685
|
+
delete settings[key];
|
|
686
|
+
await atomicWrite(filePath, `${JSON.stringify(settings, null, 2)}\n`);
|
|
687
|
+
log.info(`Removed retired settings from ${filePath}: ${retired.join(', ')}`);
|
|
688
|
+
}
|
|
689
|
+
async function dropRetiredSchedules(filePath) {
|
|
690
|
+
const data = await readJsonOrNull(filePath);
|
|
691
|
+
if (!isRecord(data) || !Array.isArray(data.tasks))
|
|
692
|
+
return;
|
|
693
|
+
const kept = data.tasks.filter((task) => !(isRecord(task) && RETIRED_SCHEDULE_TYPES.has(String(task.dispatchType))));
|
|
694
|
+
if (kept.length === data.tasks.length)
|
|
695
|
+
return;
|
|
696
|
+
data.tasks = kept;
|
|
697
|
+
await atomicWrite(filePath, `${JSON.stringify(data, null, 2)}\n`);
|
|
698
|
+
log.info(`Removed retired task-queue schedules from ${filePath}`);
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Move the removed thread runtime and task queue out of an install. Everything is moved, never
|
|
702
|
+
* deleted: config into `config/archive/` (the thread templates as `thread-templates-<stamp>/`, the
|
|
703
|
+
* rest under `retired-threads-tasks-<stamp>/`) and state into `data/archive/retired-threads-tasks-
|
|
704
|
+
* <stamp>/`. Settings, generated MCP configs and gated tool allowlists drop the names that no longer
|
|
705
|
+
* exist, and the task-queue jobs leave the schedule. A sealed config is left as it is; its state is
|
|
706
|
+
* still moved. Idempotent: a second run finds nothing left to move or strip.
|
|
707
|
+
*/
|
|
708
|
+
export async function retireThreadAndTaskState(dataDir, storeDir, defaultsDir, now = new Date()) {
|
|
709
|
+
// The environments come from the thread agents, so they must exist before those move away.
|
|
710
|
+
await seedEnvironmentsFromThreadAgents(dataDir, defaultsDir);
|
|
711
|
+
const stamp = archiveStamp(now);
|
|
712
|
+
const configDir = path.join(dataDir, 'config');
|
|
713
|
+
if (process.env.CORTEX_CONFIG_IMMUTABLE !== '1') {
|
|
714
|
+
const templatesArchive = path.join(configDir, 'archive', `thread-templates-${stamp}`);
|
|
715
|
+
await moveAside(path.join(configDir, 'thread-templates'), templatesArchive);
|
|
716
|
+
for (const legacy of ['thread-templates.json', 'thread-templates.json.migrated-bak']) {
|
|
717
|
+
await moveAside(path.join(configDir, legacy), path.join(templatesArchive, legacy));
|
|
718
|
+
}
|
|
719
|
+
const configArchive = path.join(configDir, 'archive', `retired-threads-tasks-${stamp}`);
|
|
720
|
+
for (const file of RETIRED_MCP_CONFIG_FILES) {
|
|
721
|
+
await moveAside(path.join(configDir, file), path.join(configArchive, file));
|
|
722
|
+
}
|
|
723
|
+
await moveAside(path.join(dataDir, 'rules', 'task-system.md'), path.join(configArchive, 'rules', 'task-system.md'));
|
|
724
|
+
await moveAside(path.join(dataDir, 'hooks', 'post-task-hook.mjs'), path.join(configArchive, 'hooks', 'post-task-hook.mjs'));
|
|
725
|
+
await stripMcpConfigFile(path.join(configDir, 'mcp-config.json'));
|
|
726
|
+
const gatesDir = path.join(configDir, 'mcp-tool-gates');
|
|
727
|
+
const gates = await fs.readdir(gatesDir).catch(() => []);
|
|
728
|
+
for (const file of gates.filter((name) => name.endsWith('.json'))) {
|
|
729
|
+
await stripMcpConfigFile(path.join(gatesDir, file));
|
|
730
|
+
}
|
|
731
|
+
await stripRetiredSettings(path.join(configDir, 'settings.json'));
|
|
732
|
+
}
|
|
733
|
+
await dropRetiredSchedules(path.join(storeDir, 'schedules.json'));
|
|
734
|
+
const stateArchive = path.join(storeDir, 'archive', `retired-threads-tasks-${stamp}`);
|
|
735
|
+
for (const relative of RETIRED_STORE_PATHS) {
|
|
736
|
+
await moveAside(path.join(storeDir, relative), path.join(stateArchive, path.basename(relative)));
|
|
737
|
+
}
|
|
738
|
+
}
|
|
490
739
|
// ── AGENTS.md rename (S3) ──────────────────────────────────────
|
|
491
740
|
const MEMORY_FILE_RENAMES = [
|
|
492
741
|
['CORTEX.md', 'AGENTS.md'],
|
|
@@ -631,8 +880,7 @@ export async function renameIndexRuleFile(dataDir) {
|
|
|
631
880
|
return changed;
|
|
632
881
|
}
|
|
633
882
|
// ── Versions file I/O ──────────────────────────────────────────
|
|
634
|
-
/**
|
|
635
|
-
* in the same versions.json. Keeping one reader means one definition of "corrupt → reset". */
|
|
883
|
+
/** The one reader of versions.json, so there is one definition of "corrupt → reset". */
|
|
636
884
|
export async function loadVersionsFrom(filePath) {
|
|
637
885
|
try {
|
|
638
886
|
const raw = await fs.readFile(filePath, 'utf8');
|
|
@@ -659,36 +907,6 @@ export async function loadVersionsFrom(filePath) {
|
|
|
659
907
|
export async function saveVersionsTo(filePath, versions) {
|
|
660
908
|
await atomicWrite(filePath, JSON.stringify(versions, null, 2) + '\n');
|
|
661
909
|
}
|
|
662
|
-
// ── Defaults loader ────────────────────────────────────────────
|
|
663
|
-
/** Map of target filePath → corresponding defaults filePath (relative to DEFAULTS_DIR).
|
|
664
|
-
* When a migration needs defaults data, the runner looks up the defaults path here,
|
|
665
|
-
* reads it once, and passes it to every pending migration for that target file. */
|
|
666
|
-
const DEFAULTS_MAP = {
|
|
667
|
-
'config/thread-templates.json': 'config/thread-templates.json',
|
|
668
|
-
};
|
|
669
|
-
async function loadDefaultsForWith(filePath, defaultsDir) {
|
|
670
|
-
const defaultsRel = DEFAULTS_MAP[filePath];
|
|
671
|
-
if (!defaultsRel)
|
|
672
|
-
return undefined;
|
|
673
|
-
const defaultsPath = path.join(defaultsDir, defaultsRel);
|
|
674
|
-
try {
|
|
675
|
-
const raw = await fs.readFile(defaultsPath, 'utf8');
|
|
676
|
-
return JSON.parse(raw);
|
|
677
|
-
}
|
|
678
|
-
catch (err) {
|
|
679
|
-
const e = err;
|
|
680
|
-
if (e.code === 'ENOENT') {
|
|
681
|
-
log.warn(`Defaults file not found: ${defaultsPath}; migrations for ${filePath} may be skipped`);
|
|
682
|
-
}
|
|
683
|
-
else if (err instanceof SyntaxError) {
|
|
684
|
-
log.warn(`Defaults file corrupt (${defaultsPath}): ${e.message}`);
|
|
685
|
-
}
|
|
686
|
-
else {
|
|
687
|
-
log.warn(`Could not load defaults for ${filePath}: ${e.message}`);
|
|
688
|
-
}
|
|
689
|
-
return undefined;
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
910
|
// ── Runner ─────────────────────────────────────────────────────
|
|
693
911
|
export async function runMigrations(opts = {}) {
|
|
694
912
|
const dataDir = opts.dataDir ?? DATA_DIR;
|
|
@@ -740,15 +958,13 @@ export async function runMigrations(opts = {}) {
|
|
|
740
958
|
}
|
|
741
959
|
throw err;
|
|
742
960
|
}
|
|
743
|
-
// Load defaults once for this file (if any)
|
|
744
|
-
const defaultsData = await loadDefaultsForWith(filePath, defaultsDir);
|
|
745
961
|
// Apply all pending migrations in version order
|
|
746
962
|
let changed = false;
|
|
747
963
|
let anyFailed = false;
|
|
748
964
|
for (const m of pending) {
|
|
749
965
|
const before = serialize(data);
|
|
750
966
|
try {
|
|
751
|
-
data = m.migrate(data
|
|
967
|
+
data = m.migrate(data);
|
|
752
968
|
}
|
|
753
969
|
catch (err) {
|
|
754
970
|
log.error(`Migration ${m.version} for ${filePath} failed: ${err.message}; skipping remaining migrations for this file`);
|
|
@@ -783,7 +999,7 @@ export async function runMigrations(opts = {}) {
|
|
|
783
999
|
if (!pending)
|
|
784
1000
|
continue;
|
|
785
1001
|
try {
|
|
786
|
-
await step.run({ dataDir, storeDir });
|
|
1002
|
+
await step.run({ dataDir, storeDir, defaultsDir });
|
|
787
1003
|
versions[step.key] = step.version;
|
|
788
1004
|
log.info(`Step migration ${step.version} applied for ${step.key}`);
|
|
789
1005
|
}
|
|
@@ -1043,6 +1259,9 @@ const RETIRED_HOOK_ENTRIES = [
|
|
|
1043
1259
|
// CORTEX.md-named copy alongside the new one and inject every rule file twice.
|
|
1044
1260
|
{ file: '08-cortex-md-injector-post-tool.json', id: 'cortex-md-injector-post-tool', script: 'cortex-md-injector.mjs' },
|
|
1045
1261
|
{ file: '10-cortex-md-injector-session-start.json', id: 'cortex-md-injector-session-start', script: 'cortex-md-injector.mjs' },
|
|
1262
|
+
// The task queue they guarded and reported on was removed.
|
|
1263
|
+
{ file: '02-tasks-yaml-guard.json', id: 'tasks-yaml-guard', script: 'tasks-yaml-guard.mjs' },
|
|
1264
|
+
{ file: '11-task-status-check.json', id: 'task-status-check', script: 'task-status-check.mjs' },
|
|
1046
1265
|
];
|
|
1047
1266
|
async function removeIfPresent(filePath, label) {
|
|
1048
1267
|
try {
|
|
@@ -1094,8 +1313,9 @@ async function isRetiredScriptOrphaned(registryDir, script) {
|
|
|
1094
1313
|
* the session whatever `--tools` lists (plan approval and questions now run through the
|
|
1095
1314
|
* interaction-bridge MCP tools against the same webhook endpoints), and the PermissionRequest
|
|
1096
1315
|
* auto-allow matched an event Claude never emits under the `bypassPermissions` mode every Cortex
|
|
1097
|
-
* spawn runs in. The
|
|
1098
|
-
* under new filenames, and leaving the old pair deployed would double every injection.
|
|
1316
|
+
* spawn runs in. The next two are a rename: the CORTEX.md injector became the AGENTS.md injector
|
|
1317
|
+
* under new filenames, and leaving the old pair deployed would double every injection. The last
|
|
1318
|
+
* two served the task queue, which no longer exists.
|
|
1099
1319
|
* `syncManagedHooks` only adds and upgrades files, so without this the dead entries would linger
|
|
1100
1320
|
* in every upgraded registry. Idempotent, and a no-op once the files are gone.
|
|
1101
1321
|
*
|
|
@@ -14,8 +14,6 @@ export interface WaitpointOwner {
|
|
|
14
14
|
sessionId: string;
|
|
15
15
|
/** The conduit the wake turn is delivered to. Find-or-creates a session if it is gone. */
|
|
16
16
|
channel: string;
|
|
17
|
-
/** Recorded only; v1 never wakes a thread directly. */
|
|
18
|
-
threadId?: string | null;
|
|
19
17
|
project?: string | null;
|
|
20
18
|
}
|
|
21
19
|
export interface WaitpointSignal {
|
package/dist/tui/App.js
CHANGED
|
@@ -101,7 +101,7 @@ export function App({ sendFrame, connectionState, ack, onReconnect, onDisconnect
|
|
|
101
101
|
return () => { stdout.off('resize', onResize); };
|
|
102
102
|
}, [stdout]);
|
|
103
103
|
// Active tab for dashboard
|
|
104
|
-
const [activeTab, setActiveTab] = useState('
|
|
104
|
+
const [activeTab, setActiveTab] = useState('schedules');
|
|
105
105
|
// Route non-mutate frames to the appropriate handler
|
|
106
106
|
const routeFrame = useCallback((frame) => {
|
|
107
107
|
// Any agent reply / stream frame means the turn is being answered — unblock
|
|
@@ -2,8 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
import { Box, Text, useInput } from 'ink';
|
|
4
4
|
import { TAB_SCOPES } from '../hooks/useDashboardData.js';
|
|
5
|
-
import { DashboardThreadsTab } from './DashboardThreadsTab.js';
|
|
6
|
-
import { DashboardTasksTab } from './DashboardTasksTab.js';
|
|
7
5
|
import { DashboardSchedulesTab } from './DashboardSchedulesTab.js';
|
|
8
6
|
import { DashboardExecutionsTab } from './DashboardExecutionsTab.js';
|
|
9
7
|
import { DashboardCostTab } from './DashboardCostTab.js';
|
|
@@ -13,8 +11,6 @@ function tab(key) {
|
|
|
13
11
|
return { key, get label() { return t(`tui.dash.tab.${key}`); } };
|
|
14
12
|
}
|
|
15
13
|
export const DASHBOARD_TABS = [
|
|
16
|
-
tab('threads'),
|
|
17
|
-
tab('tasks'),
|
|
18
14
|
tab('schedules'),
|
|
19
15
|
tab('executions'),
|
|
20
16
|
tab('cost'),
|
|
@@ -65,10 +61,6 @@ function TabContent({ tab, active, sendFrame, mutate, projectId, dashState, onRe
|
|
|
65
61
|
}
|
|
66
62
|
}, [dashState.tabs[tab].loading, tab, projectId]);
|
|
67
63
|
switch (tab) {
|
|
68
|
-
case 'threads':
|
|
69
|
-
return _jsx(DashboardThreadsTab, { data: dashState.tabs.threads, mutate: mutate, active: active });
|
|
70
|
-
case 'tasks':
|
|
71
|
-
return _jsx(DashboardTasksTab, { data: dashState.tabs.tasks, mutate: mutate, projectId: projectId ?? undefined, active: active });
|
|
72
64
|
case 'schedules':
|
|
73
65
|
return _jsx(DashboardSchedulesTab, { data: dashState.tabs.schedules, mutate: mutate, active: active });
|
|
74
66
|
case 'executions':
|
|
@@ -251,13 +251,7 @@ function InputBoxImpl({ onSubmit, onCommand, commands = SLASH_COMMANDS, awaiting
|
|
|
251
251
|
insertText(input);
|
|
252
252
|
}
|
|
253
253
|
}, { isActive: focus });
|
|
254
|
-
return (
|
|
255
|
-
// flexShrink={0}: the input must NEVER be squeezed by the transcript. If the transcript's line
|
|
256
|
-
// slice momentarily exceeds its flex height (a transition where reservedRows lags the actual
|
|
257
|
-
// bottom height), Ink would otherwise shrink the input's content box to 0 — leaving the two
|
|
258
|
-
// borders touching with "Type a message..." overrunning the bottom border. Pinning the input's
|
|
259
|
-
// size forces the (flex-end) transcript to absorb the overflow by clipping its top instead.
|
|
260
|
-
_jsxs(Box, { flexDirection: "column", marginTop: 1, flexShrink: 0, children: [menuOpen ? _jsx(SlashMenu, { commands: matches, selectedIndex: safeSelected }) : null, toast ? _jsx(Text, { color: "cyan", dimColor: true, children: toast })
|
|
254
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, flexShrink: 0, children: [menuOpen ? _jsx(SlashMenu, { commands: matches, selectedIndex: safeSelected }) : null, toast ? _jsx(Text, { color: "cyan", dimColor: true, children: toast })
|
|
261
255
|
: statusLine ? _jsx(Text, { dimColor: true, children: statusLine })
|
|
262
256
|
: null, _jsx(Box, { borderStyle: "single", borderDimColor: true, paddingX: 1, children: _jsx(Box, { flexDirection: "column", flexGrow: 1, children: value.length === 0 && !focus ? (_jsx(Text, { dimColor: true, children: t('tui.input.placeholder') })) : value.length === 0 ? (_jsxs(Text, { children: [_jsx(Text, { inverse: true, children: " " }), _jsx(Text, { dimColor: true, children: t('tui.input.placeholder') })] })) : (
|
|
263
257
|
// Multi-line aware: render each logical line; on the cursor's row draw the inverse
|
|
@@ -5,7 +5,7 @@ export interface TabData {
|
|
|
5
5
|
error: string | null;
|
|
6
6
|
lastUpdated: number | null;
|
|
7
7
|
}
|
|
8
|
-
export type TabName = '
|
|
8
|
+
export type TabName = 'schedules' | 'executions' | 'cost';
|
|
9
9
|
export interface DashState {
|
|
10
10
|
tabs: Record<TabName, TabData>;
|
|
11
11
|
}
|
|
@@ -3,16 +3,12 @@ import { t } from '../../core/i18n.js';
|
|
|
3
3
|
const INITIAL_TAB = { data: [], loading: false, error: null, lastUpdated: null };
|
|
4
4
|
export const EMPTY_DASH_STATE = {
|
|
5
5
|
tabs: {
|
|
6
|
-
threads: { ...INITIAL_TAB },
|
|
7
|
-
tasks: { ...INITIAL_TAB },
|
|
8
6
|
schedules: { ...INITIAL_TAB },
|
|
9
7
|
executions: { ...INITIAL_TAB },
|
|
10
8
|
cost: { ...INITIAL_TAB },
|
|
11
9
|
},
|
|
12
10
|
};
|
|
13
11
|
export const TAB_SCOPES = {
|
|
14
|
-
threads: { queryId: 'dash-threads', events: ['thread.created', 'thread.completed', 'thread.transitioned', 'thread.failed'] },
|
|
15
|
-
tasks: { queryId: 'dash-tasks', events: ['task.claimed', 'task.unclaimed', 'task.completed', 'task.dispatched', 'task.blocked', 'task.unblocked'] },
|
|
16
12
|
schedules: { queryId: 'dash-schedules', events: ['scheduler.tick'] },
|
|
17
13
|
executions: { queryId: 'dash-executions', events: ['agent.started', 'agent.completed', 'agent.failed', 'agent.superseded'] },
|
|
18
14
|
cost: { queryId: 'dash-cost', events: ['agent.completed'] },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Notification } from '../../platform/tui/protocol.js';
|
|
2
2
|
export interface NotificationEntry {
|
|
3
3
|
id: string;
|
|
4
|
-
kind: 'project-report' | 'system-notice'
|
|
4
|
+
kind: 'project-report' | 'system-notice';
|
|
5
5
|
projectId: string;
|
|
6
6
|
sessionId?: string | null;
|
|
7
7
|
title: string;
|
|
@@ -23,12 +23,9 @@ export const SLASH_COMMANDS = [
|
|
|
23
23
|
// Cost / budget
|
|
24
24
|
cmd('cost'),
|
|
25
25
|
cmd('budget'),
|
|
26
|
-
//
|
|
27
|
-
cmd('tasks'),
|
|
28
|
-
cmd('thread'),
|
|
26
|
+
// Agents / scheduling
|
|
29
27
|
cmd('agent'),
|
|
30
28
|
cmd('schedule'),
|
|
31
|
-
cmd('dispatch'),
|
|
32
29
|
// Mode / model / profile
|
|
33
30
|
cmd('mode'),
|
|
34
31
|
cmd('model'),
|