@cortex-agent/server 2026.10.15 → 2026.10.25
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 +81 -51
- package/defaults/board/board.css +140 -62
- package/defaults/board/scaffold.html +36 -13
- package/defaults/config/environments/creative.json +0 -1
- package/defaults/config/environments/main.json +1 -2
- package/defaults/context/projects/AGENTS.md +1 -1
- package/defaults/gitignore +3 -3
- package/defaults/hooks/new-session-hook.mjs +1 -1
- package/defaults/hooks/status-md-guard.mjs +6 -6
- package/defaults/plugins/cortex-board/skills/board/SKILL.md +30 -22
- package/defaults/plugins/cortex-system/plugin.json +2 -2
- package/defaults/plugins/cortex-system/skills/browser/SKILL.md +56 -0
- package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +16 -9
- package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +2 -2
- package/defaults/rules/agents-md.md +1 -1
- package/defaults/rules/issues-md.md +1 -1
- package/defaults/rules/meta-conventions.md +3 -3
- package/defaults/rules/mission-md.md +1 -1
- package/defaults/rules/status-md.md +1 -1
- package/dist/agent-adapter/claude/adapter.d.ts +2 -5
- package/dist/agent-adapter/claude/adapter.js +6 -5
- package/dist/agent-adapter/claude/assistant-blocks.d.ts +5 -0
- package/dist/agent-adapter/claude/assistant-blocks.js +61 -0
- package/dist/agent-adapter/claude/bg-task-tracker.d.ts +3 -1
- package/dist/agent-adapter/claude/bg-task-tracker.js +6 -2
- package/dist/agent-adapter/claude/cache-refresh.d.ts +58 -0
- package/dist/agent-adapter/claude/cache-refresh.js +145 -0
- package/dist/agent-adapter/claude/cache-touch.d.ts +12 -0
- package/dist/agent-adapter/claude/cache-touch.js +75 -0
- package/dist/agent-adapter/claude/event-parser.d.ts +8 -3
- package/dist/agent-adapter/claude/event-parser.js +33 -17
- package/dist/agent-adapter/claude/event-translator.d.ts +2 -0
- package/dist/agent-adapter/claude/event-translator.js +2 -0
- package/dist/agent-adapter/claude/mcp-config.js +11 -0
- package/dist/agent-adapter/claude/session-options.d.ts +6 -13
- package/dist/agent-adapter/claude/session-options.js +2 -13
- package/dist/agent-adapter/claude/spawn-args.d.ts +4 -21
- package/dist/agent-adapter/claude/spawn-args.js +17 -24
- package/dist/agent-adapter/claude/transcript-clear.d.ts +42 -0
- package/dist/agent-adapter/claude/transcript-clear.js +217 -0
- package/dist/agent-adapter/claude/turn-machine.d.ts +5 -3
- package/dist/agent-adapter/claude/turn-machine.js +29 -73
- package/dist/agent-adapter/claude/window-warmup.d.ts +13 -0
- package/dist/agent-adapter/claude/window-warmup.js +38 -0
- package/dist/agent-adapter/continuation-phase.d.ts +6 -3
- package/dist/agent-adapter/continuation-phase.js +11 -3
- package/dist/agent-adapter/normalize/event-types.d.ts +8 -0
- package/dist/agent-adapter/pi/adapter.d.ts +0 -1
- package/dist/agent-adapter/pi/adapter.js +5 -13
- package/dist/agent-adapter/pi/event-parser.d.ts +1 -1
- package/dist/agent-adapter/pi/event-parser.js +43 -27
- package/dist/agent-adapter/pi/mcp-bridge.d.ts +1 -1
- package/dist/agent-adapter/pi/pi-session.d.ts +2 -0
- package/dist/agent-adapter/pi/pi-session.js +15 -0
- package/dist/agent-adapter/pi/providers-config.d.ts +2 -2
- package/dist/agent-adapter/pi/providers-config.js +1 -1
- package/dist/agent-adapter/pi/quota-sink.d.ts +3 -3
- package/dist/agent-adapter/pi/quota-sink.js +3 -3
- package/dist/agent-adapter/pi/runtime.js +6 -1
- package/dist/agent-adapter/pi/session-options.d.ts +9 -13
- package/dist/agent-adapter/pi/session-options.js +12 -25
- package/dist/agent-adapter/run-events.d.ts +15 -10
- package/dist/agent-adapter/run-events.js +2 -0
- package/dist/agent-adapter/types.d.ts +14 -6
- package/dist/build-info.json +1 -0
- package/dist/client-bundle/client.mjs +10 -5
- package/dist/client-bundle/manifest.json +3 -3
- package/dist/core/claude-credentials.d.ts +6 -0
- package/dist/core/claude-credentials.js +11 -0
- package/dist/core/codex-quota.d.ts +1 -1
- package/dist/core/codex-quota.js +1 -1
- package/dist/core/gateway-generator.d.ts +26 -11
- package/dist/core/gateway-generator.js +73 -62
- package/dist/core/hook-bus.d.ts +1 -1
- package/dist/core/hook-bus.js +1 -8
- package/dist/core/locales/en.d.ts +52 -77
- package/dist/core/locales/slices/commands.d.ts +26 -31
- package/dist/core/locales/slices/commands.js +54 -64
- package/dist/core/locales/slices/init.d.ts +9 -19
- package/dist/core/locales/slices/init.js +19 -53
- package/dist/core/locales/slices/interactions.d.ts +3 -3
- package/dist/core/locales/slices/interactions.js +6 -6
- package/dist/core/locales/slices/notices.d.ts +1 -3
- package/dist/core/locales/slices/notices.js +2 -6
- package/dist/core/locales/slices/scheduling.d.ts +9 -9
- package/dist/core/locales/slices/scheduling.js +18 -18
- package/dist/core/locales/slices/status.d.ts +0 -4
- package/dist/core/locales/slices/status.js +0 -8
- package/dist/core/locales/slices/tui.d.ts +0 -1
- package/dist/core/locales/slices/tui.js +0 -2
- package/dist/core/locales/slices/uimsg.d.ts +4 -7
- package/dist/core/locales/slices/uimsg.js +9 -15
- package/dist/core/log.d.ts +3 -0
- package/dist/core/log.js +18 -1
- package/dist/core/models-generator.d.ts +29 -0
- package/dist/core/models-generator.js +82 -0
- package/dist/core/paths.d.ts +1 -1
- package/dist/core/paths.js +1 -1
- package/dist/core/settings-spec.d.ts +30 -0
- package/dist/core/settings-spec.js +38 -0
- package/dist/core/status-format.d.ts +3 -2
- package/dist/core/status-format.js +2 -2
- package/dist/core/types/agent-types.d.ts +3 -1
- package/dist/core/types/environment-types.d.ts +1 -8
- package/dist/domain/agents/agent-state.d.ts +11 -56
- package/dist/domain/agents/agent-state.js +48 -115
- package/dist/domain/agents/agent-switch.d.ts +2 -24
- package/dist/domain/agents/agent-switch.js +9 -72
- package/dist/domain/agents/config.d.ts +11 -61
- package/dist/domain/agents/config.js +47 -154
- package/dist/domain/agents/engine-selection.d.ts +21 -0
- package/dist/domain/agents/engine-selection.js +37 -0
- package/dist/domain/agents/environments/registry.js +4 -2
- package/dist/domain/agents/environments/resolve.js +0 -1
- package/dist/domain/agents/environments/schema.d.ts +3 -3
- package/dist/domain/agents/environments/schema.js +4 -4
- package/dist/domain/agents/index.d.ts +2 -1
- package/dist/domain/agents/index.js +3 -7
- package/dist/domain/agents/model-selection.d.ts +18 -70
- package/dist/domain/agents/model-selection.js +100 -150
- package/dist/domain/agents/models.d.ts +12 -0
- package/dist/domain/agents/models.js +94 -0
- package/dist/domain/agents/subagent/registry.d.ts +2 -0
- package/dist/domain/agents/subagent/registry.js +8 -0
- package/dist/domain/agents/subagent/runner.d.ts +5 -5
- package/dist/domain/agents/subagent/runner.js +12 -35
- package/dist/domain/auth/auth-status.d.ts +4 -4
- package/dist/domain/auth/auth-status.js +17 -28
- package/dist/domain/auth/auth-watch.js +48 -18
- package/dist/domain/auth/gateway-sync.d.ts +6 -26
- package/dist/domain/auth/gateway-sync.js +31 -75
- package/dist/domain/benchmark/identity.d.ts +3 -5
- package/dist/domain/benchmark/identity.js +0 -1
- package/dist/domain/benchmark/production-attempt-identity.d.ts +6 -5
- package/dist/domain/benchmark/production-attempt-identity.js +32 -35
- package/dist/domain/benchmark/session-evidence.d.ts +2 -1
- package/dist/domain/benchmark/session-evidence.js +8 -1
- package/dist/domain/browser/broker.d.ts +99 -0
- package/dist/domain/browser/broker.js +487 -0
- package/dist/domain/costs/claude-account.js +21 -0
- package/dist/domain/costs/rate-limit-throttle.js +3 -1
- package/dist/domain/costs/reset-account.d.ts +2 -0
- package/dist/domain/costs/usage-service.d.ts +1 -1
- package/dist/domain/costs/usage-service.js +20 -7
- package/dist/domain/mcp/tools/context.d.ts +5 -7
- package/dist/domain/mcp/tools/context.js +17 -4
- package/dist/domain/mcp/tools/subagent.js +1 -1
- package/dist/domain/mcp/tools/ui-file.js +1 -1
- package/dist/domain/monitor/event-loop-monitor.d.ts +2 -0
- package/dist/domain/monitor/event-loop-monitor.js +5 -1
- package/dist/domain/pi-providers/custom-provider-model.d.ts +1 -1
- package/dist/domain/pi-providers/custom-provider-model.js +1 -1
- package/dist/domain/plugins/authoring.d.ts +8 -1
- package/dist/domain/plugins/authoring.js +24 -9
- package/dist/domain/plugins/runtime-gc.d.ts +7 -0
- package/dist/domain/plugins/runtime-gc.js +52 -19
- package/dist/domain/plugins/runtime.js +2 -1
- package/dist/domain/remote/client-bootstrap.js +1 -1
- package/dist/domain/remote/client-manager.js +6 -1
- package/dist/domain/remote/device-browser.js +1 -1
- package/dist/domain/remote/device-chrome-commands.js +2 -0
- package/dist/domain/remote/device-port.js +2 -2
- package/dist/domain/runs/attempt.d.ts +3 -3
- package/dist/domain/runs/attempt.js +2 -3
- package/dist/domain/runs/builders.d.ts +4 -4
- package/dist/domain/runs/builders.js +4 -5
- package/dist/domain/runs/compact.d.ts +4 -17
- package/dist/domain/runs/compact.js +14 -56
- package/dist/domain/runs/config-resolver.d.ts +15 -83
- package/dist/domain/runs/config-resolver.js +24 -150
- package/dist/domain/runs/engine-spec.d.ts +8 -8
- package/dist/domain/runs/engine-spec.js +15 -31
- package/dist/domain/runs/events.d.ts +1 -1
- package/dist/domain/runs/fallback.d.ts +6 -38
- package/dist/domain/runs/fallback.js +10 -72
- package/dist/domain/runs/notices.d.ts +1 -11
- package/dist/domain/runs/notices.js +3 -30
- package/dist/domain/runs/request.d.ts +4 -3
- package/dist/domain/runs/retryable-errors.d.ts +0 -13
- package/dist/domain/runs/retryable-errors.js +3 -18
- package/dist/domain/runs/run.d.ts +12 -42
- package/dist/domain/runs/run.js +40 -147
- package/dist/domain/runs/service.d.ts +0 -9
- package/dist/domain/runs/service.js +33 -14
- package/dist/domain/runs/spec-loader.d.ts +1 -1
- package/dist/domain/runs/spend.d.ts +1 -1
- package/dist/domain/runs/spend.js +1 -1
- package/dist/domain/scheduling/builtin-job-controller.d.ts +3 -1
- package/dist/domain/scheduling/builtin-job-controller.js +5 -2
- package/dist/domain/scheduling/builtin-jobs.js +7 -0
- package/dist/domain/scheduling/jobs/scheduled-task.d.ts +3 -2
- package/dist/domain/scheduling/jobs/scheduled-task.js +25 -19
- package/dist/domain/scheduling/schedule-ops.d.ts +0 -1
- package/dist/domain/scheduling/schedule-ops.js +2 -5
- package/dist/domain/scheduling/schedule-selection.d.ts +3 -0
- package/dist/domain/scheduling/schedule-selection.js +16 -0
- package/dist/domain/scheduling/schedule-spec.d.ts +6 -5
- package/dist/domain/scheduling/schedule-spec.js +6 -6
- package/dist/domain/scheduling/scheduler.d.ts +3 -1
- package/dist/domain/scheduling/scheduler.js +36 -26
- package/dist/domain/sessions/session-hooks.d.ts +5 -4
- package/dist/domain/sessions/session-hooks.js +15 -33
- package/dist/domain/sessions/session-lifecycle.d.ts +19 -51
- package/dist/domain/sessions/session-lifecycle.js +34 -96
- package/dist/domain/system/doctor.d.ts +3 -3
- package/dist/domain/system/doctor.js +22 -26
- package/dist/domain/system/own-bin-path.d.ts +13 -0
- package/dist/domain/system/own-bin-path.js +36 -0
- package/dist/domain/system/server-update-check.js +2 -1
- package/dist/domain/system/terminal-cli/index.d.ts +58 -0
- package/dist/domain/system/terminal-cli/index.js +100 -0
- package/dist/domain/system/terminal-cli/posix-profiles.d.ts +23 -0
- package/dist/domain/system/terminal-cli/posix-profiles.js +74 -0
- package/dist/domain/system/terminal-cli/registrar.d.ts +12 -0
- package/dist/domain/system/terminal-cli/registrar.js +1 -0
- package/dist/domain/system/terminal-cli/shims.d.ts +27 -0
- package/dist/domain/system/terminal-cli/shims.js +108 -0
- package/dist/domain/system/terminal-cli/state.d.ts +7 -0
- package/dist/domain/system/terminal-cli/state.js +36 -0
- package/dist/domain/system/terminal-cli/windows-user-path.d.ts +13 -0
- package/dist/domain/system/terminal-cli/windows-user-path.js +67 -0
- package/dist/domain/telemetry/bus-collector.d.ts +3 -0
- package/dist/domain/telemetry/bus-collector.js +22 -0
- package/dist/domain/telemetry/child-exit.d.ts +11 -0
- package/dist/domain/telemetry/child-exit.js +36 -0
- package/dist/domain/telemetry/client-kind.d.ts +4 -0
- package/dist/domain/telemetry/client-kind.js +7 -0
- package/dist/domain/telemetry/crash-limits.d.ts +15 -0
- package/dist/domain/telemetry/crash-limits.js +50 -0
- package/dist/domain/telemetry/crash.d.ts +25 -0
- package/dist/domain/telemetry/crash.js +70 -0
- package/dist/domain/telemetry/daily-upload.d.ts +5 -0
- package/dist/domain/telemetry/daily-upload.js +20 -0
- package/dist/domain/telemetry/daily.d.ts +5 -0
- package/dist/domain/telemetry/daily.js +104 -0
- package/dist/domain/telemetry/endpoint.d.ts +7 -0
- package/dist/domain/telemetry/endpoint.js +40 -0
- package/dist/domain/telemetry/envelope.d.ts +6 -0
- package/dist/domain/telemetry/envelope.js +35 -0
- package/dist/domain/telemetry/error-digest.d.ts +7 -0
- package/dist/domain/telemetry/error-digest.js +43 -0
- package/dist/domain/telemetry/funnel.d.ts +6 -0
- package/dist/domain/telemetry/funnel.js +22 -0
- package/dist/domain/telemetry/gate.d.ts +19 -0
- package/dist/domain/telemetry/gate.js +67 -0
- package/dist/domain/telemetry/heartbeat.d.ts +17 -0
- package/dist/domain/telemetry/heartbeat.js +49 -0
- package/dist/domain/telemetry/info.d.ts +9 -0
- package/dist/domain/telemetry/info.js +12 -0
- package/dist/domain/telemetry/init-answer.d.ts +12 -0
- package/dist/domain/telemetry/init-answer.js +42 -0
- package/dist/domain/telemetry/install-id.d.ts +5 -0
- package/dist/domain/telemetry/install-id.js +42 -0
- package/dist/domain/telemetry/normalize.d.ts +33 -0
- package/dist/domain/telemetry/normalize.js +88 -0
- package/dist/domain/telemetry/outbox.d.ts +18 -0
- package/dist/domain/telemetry/outbox.js +93 -0
- package/dist/domain/telemetry/panic-group.d.ts +4 -0
- package/dist/domain/telemetry/panic-group.js +51 -0
- package/dist/domain/telemetry/paths.d.ts +7 -0
- package/dist/domain/telemetry/paths.js +11 -0
- package/dist/domain/telemetry/redact.d.ts +18 -0
- package/dist/domain/telemetry/redact.js +109 -0
- package/dist/domain/telemetry/rollup-types.d.ts +81 -0
- package/dist/domain/telemetry/rollup-types.js +31 -0
- package/dist/domain/telemetry/rollup.d.ts +16 -0
- package/dist/domain/telemetry/rollup.js +102 -0
- package/dist/domain/telemetry/schema.d.ts +931 -0
- package/dist/domain/telemetry/schema.js +275 -0
- package/dist/domain/telemetry/service.d.ts +34 -0
- package/dist/domain/telemetry/service.js +146 -0
- package/dist/domain/telemetry/state.d.ts +17 -0
- package/dist/domain/telemetry/state.js +29 -0
- package/dist/domain/telemetry/turns.d.ts +17 -0
- package/dist/domain/telemetry/turns.js +176 -0
- package/dist/domain/telemetry/upgrade.d.ts +14 -0
- package/dist/domain/telemetry/upgrade.js +87 -0
- package/dist/domain/telemetry/uploader.d.ts +21 -0
- package/dist/domain/telemetry/uploader.js +82 -0
- package/dist/domain/telemetry/usage.d.ts +25 -0
- package/dist/domain/telemetry/usage.js +153 -0
- package/dist/domain/telemetry/web-report.d.ts +8 -0
- package/dist/domain/telemetry/web-report.js +15 -0
- package/dist/domain/tui-session/tui-session-service.js +1 -1
- package/dist/domain/tui-session/types.d.ts +2 -2
- package/dist/domain/ui-service/app-router.d.ts +117 -95
- package/dist/domain/ui-service/app-router.js +17 -14
- package/dist/domain/ui-service/assistant-snapshots.js +2 -0
- package/dist/domain/ui-service/contract.parity.d.ts +19 -0
- package/dist/domain/ui-service/contract.parity.js +1 -0
- package/dist/domain/ui-service/inline-media-types.d.ts +18 -0
- package/dist/domain/ui-service/inline-media-types.js +1 -0
- package/dist/domain/ui-service/input-schemas.d.ts +120 -119
- package/dist/domain/ui-service/input-schemas.js +47 -85
- package/dist/domain/ui-service/mutate/approvals.d.ts +3 -2
- package/dist/domain/ui-service/mutate/approvals.js +3 -2
- package/dist/domain/ui-service/mutate/auth.d.ts +1 -1
- package/dist/domain/ui-service/mutate/auth.js +3 -2
- package/dist/domain/ui-service/mutate/config.d.ts +0 -8
- package/dist/domain/ui-service/mutate/config.js +0 -22
- package/dist/domain/ui-service/mutate/models.d.ts +13 -0
- package/dist/domain/ui-service/mutate/models.js +137 -0
- package/dist/domain/ui-service/mutate/plugin-packages.js +1 -1
- package/dist/domain/ui-service/mutate/resolve-media.d.ts +4 -0
- package/dist/domain/ui-service/mutate/resolve-media.js +17 -0
- package/dist/domain/ui-service/mutate/sessions.d.ts +2 -2
- package/dist/domain/ui-service/mutate/sessions.js +29 -126
- package/dist/domain/ui-service/mutate/telemetry.d.ts +5 -0
- package/dist/domain/ui-service/mutate/telemetry.js +6 -0
- package/dist/domain/ui-service/query/approvals.js +4 -3
- package/dist/domain/ui-service/query/config.js +22 -42
- package/dist/domain/ui-service/query/machine-probe.d.ts +1 -1
- package/dist/domain/ui-service/query/machine-probe.js +3 -2
- package/dist/domain/ui-service/query/models.d.ts +3 -0
- package/dist/domain/ui-service/query/models.js +49 -32
- package/dist/domain/ui-service/query/plugin-source.js +4 -3
- package/dist/domain/ui-service/query/schedules.js +1 -1
- package/dist/domain/ui-service/query/sessions.js +8 -13
- package/dist/domain/ui-service/query/telemetry.d.ts +3 -0
- package/dist/domain/ui-service/query/telemetry.js +4 -0
- package/dist/domain/ui-service/trpc.d.ts +8 -3
- package/dist/domain/ui-service/trpc.js +1 -1
- package/dist/domain/ui-service/types.d.ts +71 -179
- package/dist/domain/ui-service/ui-service.d.ts +56 -53
- package/dist/domain/ui-service/ui-service.js +27 -24
- package/dist/entry/app.js +62 -21
- package/dist/entry/browser-cli.d.ts +39 -0
- package/dist/entry/browser-cli.js +317 -0
- package/dist/entry/cli-help.d.ts +1 -0
- package/dist/entry/cli-help.js +64 -20
- package/dist/entry/cli.js +16 -14
- package/dist/entry/daemon.d.ts +1 -1
- package/dist/entry/daemon.js +88 -72
- package/dist/entry/init-auth.js +1 -1
- package/dist/entry/init.d.ts +10 -8
- package/dist/entry/init.js +138 -276
- package/dist/entry/path-cli.d.ts +4 -0
- package/dist/entry/path-cli.js +65 -0
- package/dist/entry/schedule-cli.js +13 -6
- package/dist/entry/shutdown.d.ts +1 -1
- package/dist/entry/shutdown.js +11 -1
- package/dist/entry/signal-cli.js +8 -11
- package/dist/entry/start-ui-http.js +48 -18
- package/dist/entry/telemetry-wiring.d.ts +12 -0
- package/dist/entry/telemetry-wiring.js +56 -0
- package/dist/entry/ui-cli.d.ts +0 -11
- package/dist/entry/ui-cli.js +42 -33
- package/dist/entry/ui-service-wiring.js +8 -10
- package/dist/events/event-types.d.ts +4 -6
- package/dist/orchestration/agent-runner.d.ts +2 -2
- package/dist/orchestration/agent-runner.js +10 -9
- package/dist/orchestration/benchmark-session-webhook.js +13 -1
- package/dist/orchestration/browser-webhook.d.ts +11 -0
- package/dist/orchestration/browser-webhook.js +28 -0
- package/dist/orchestration/cache-keep-warm.d.ts +77 -0
- package/dist/orchestration/cache-keep-warm.js +213 -0
- package/dist/orchestration/claude-window-warmup.d.ts +40 -0
- package/dist/orchestration/claude-window-warmup.js +126 -0
- package/dist/orchestration/conversation-request.d.ts +6 -10
- package/dist/orchestration/conversation-request.js +5 -23
- package/dist/orchestration/delta-coalescer.d.ts +4 -2
- package/dist/orchestration/delta-coalescer.js +5 -5
- package/dist/orchestration/edit-retry.js +9 -11
- package/dist/orchestration/inline-media-eager.d.ts +13 -0
- package/dist/orchestration/inline-media-eager.js +58 -0
- package/dist/orchestration/inline-media.d.ts +22 -0
- package/dist/orchestration/inline-media.js +151 -0
- package/dist/orchestration/interactions/ask-user-resume.js +3 -7
- package/dist/orchestration/interactions/interaction-handlers.js +6 -6
- package/dist/orchestration/mid-turn-inject.d.ts +2 -1
- package/dist/orchestration/mid-turn-inject.js +1 -1
- package/dist/orchestration/pending-injection-recovery.d.ts +2 -1
- package/dist/orchestration/pending-injection-recovery.js +1 -1
- package/dist/orchestration/routing/commands/index.js +4 -4
- package/dist/orchestration/routing/commands/mode.d.ts +5 -44
- package/dist/orchestration/routing/commands/mode.js +98 -272
- package/dist/orchestration/routing/commands/schedule.js +29 -18
- package/dist/orchestration/routing/commands/session.js +9 -9
- package/dist/orchestration/routing/commands/status.js +1 -1
- package/dist/orchestration/routing/commands/usage-format.js +3 -0
- package/dist/orchestration/routing/message-router.js +2 -0
- package/dist/orchestration/routing/webhook.js +6 -0
- package/dist/orchestration/session-compact.d.ts +0 -1
- package/dist/orchestration/session-compact.js +5 -7
- package/dist/orchestration/session-events.d.ts +2 -1
- package/dist/orchestration/session-events.js +1 -0
- package/dist/orchestration/status-helpers.d.ts +0 -4
- package/dist/orchestration/status-helpers.js +0 -18
- package/dist/orchestration/subagent-webhook.js +9 -34
- package/dist/orchestration/team-webhook.d.ts +8 -9
- package/dist/orchestration/team-webhook.js +16 -42
- package/dist/orchestration/transcript-sink.d.ts +12 -0
- package/dist/orchestration/transcript-sink.js +38 -2
- package/dist/orchestration/turn/terminal.js +7 -7
- package/dist/orchestration/turn/turn-prep.d.ts +0 -8
- package/dist/orchestration/turn/turn-prep.js +0 -51
- package/dist/orchestration/turn/turn-tracking.d.ts +2 -2
- package/dist/orchestration/turn/turn-tracking.js +8 -5
- package/dist/orchestration/turn/turn.d.ts +0 -2
- package/dist/orchestration/turn/turn.js +13 -15
- package/dist/orchestration/waitpoint-ingress.js +3 -0
- package/dist/platform/adapters/tui/ports.d.ts +1 -1
- package/dist/platform/adapters/tui/tui-transcript.js +2 -0
- package/dist/platform/browser/agent-browser.d.ts +50 -0
- package/dist/platform/browser/agent-browser.js +165 -0
- package/dist/platform/browser/managed-browser.d.ts +1 -11
- package/dist/platform/browser/managed-browser.js +4 -12
- package/dist/platform/ui-http/browser-stream.d.ts +110 -0
- package/dist/platform/ui-http/browser-stream.js +447 -0
- package/dist/platform/ui-http/ui-auth-routes.d.ts +2 -0
- package/dist/platform/ui-http/ui-auth-routes.js +9 -2
- package/dist/platform/ui-http/ui-device-routes.d.ts +13 -0
- package/dist/platform/ui-http/ui-device-routes.js +81 -0
- package/dist/platform/ui-http/ui-devices.d.ts +24 -0
- package/dist/platform/ui-http/ui-devices.js +107 -0
- package/dist/platform/ui-http/ui-http-server.d.ts +22 -3
- package/dist/platform/ui-http/ui-http-server.js +33 -12
- package/dist/platform/ui-http/ui-pairing.d.ts +25 -0
- package/dist/platform/ui-http/ui-pairing.js +98 -0
- package/dist/store/conversation-history-reader.js +8 -0
- package/dist/store/conversation-history-repo.d.ts +8 -1
- package/dist/store/conversation-history-repo.js +5 -0
- package/dist/store/conversation-ledger-repo.d.ts +6 -6
- package/dist/store/conversation-ledger-repo.js +4 -4
- package/dist/store/gitignore-migration.d.ts +2 -0
- package/dist/store/gitignore-migration.js +16 -0
- package/dist/store/hook-registry.d.ts +1 -1
- package/dist/store/hook-registry.js +11 -6
- package/dist/store/models-repo.d.ts +18 -0
- package/dist/store/models-repo.js +74 -0
- package/dist/store/pending-injection-repo.d.ts +2 -1
- package/dist/store/pending-injection-repo.js +3 -1
- package/dist/store/retire-profiles-migration.d.ts +28 -0
- package/dist/store/retire-profiles-migration.js +335 -0
- package/dist/store/schedule-repo.d.ts +2 -1
- package/dist/store/session-registry-import.js +3 -2
- package/dist/store/session-registry-journal.d.ts +10 -13
- package/dist/store/session-registry-journal.js +51 -25
- package/dist/store/session-registry-repo.d.ts +4 -4
- package/dist/store/session-registry-repo.js +4 -5
- package/dist/store/version-migrations.d.ts +7 -3
- package/dist/store/version-migrations.js +133 -80
- package/dist/tui/components/Dashboard.js +4 -3
- package/dist/tui/hooks/useDashboardData.js +1 -1
- package/dist/tui/slash-commands.js +2 -2
- package/dist/tui/turn-status.js +1 -1
- package/package.json +6 -4
- package/web/dist/assets/board-math-css-spk7yR6n.js +2 -0
- package/web/dist/assets/index-BQ69u-92.css +1 -0
- package/web/dist/assets/{index-CndZZ1IQ.js → index-CKNLatCd.js} +1 -1
- package/web/dist/assets/index-CkzWfC98.js +525 -0
- package/web/dist/index.html +3 -2
- package/web/dist/theme.css +6 -0
- package/dist/agent-adapter/browser-mcp-server.d.ts +0 -13
- package/dist/agent-adapter/browser-mcp-server.js +0 -28
- package/dist/agent-adapter/claude/browser-mcp.d.ts +0 -9
- package/dist/agent-adapter/claude/browser-mcp.js +0 -10
- package/dist/core/profile-generator.d.ts +0 -79
- package/dist/core/profile-generator.js +0 -215
- package/dist/domain/agents/profile-manager.d.ts +0 -103
- package/dist/domain/agents/profile-manager.js +0 -286
- package/dist/domain/agents/profile-switch.d.ts +0 -49
- package/dist/domain/agents/profile-switch.js +0 -62
- package/dist/domain/ui-service/mutate/profiles.d.ts +0 -36
- package/dist/domain/ui-service/mutate/profiles.js +0 -151
- package/dist/store/profile-repo.d.ts +0 -20
- package/dist/store/profile-repo.js +0 -97
- package/web/dist/assets/index-B76ueW3q.js +0 -494
- package/web/dist/assets/index-C8O0yxg8.css +0 -1
|
@@ -241,7 +241,8 @@ function normalizeLegacyRecord(channelMap, raw) {
|
|
|
241
241
|
createdAt: toStringValue(raw.createdAt),
|
|
242
242
|
lastUsedAt: toStringValue(raw.lastUsedAt),
|
|
243
243
|
label,
|
|
244
|
-
|
|
244
|
+
selection: toSelection(raw.selection),
|
|
245
|
+
...(raw.profileName !== undefined ? { profileName: raw.profileName } : {}),
|
|
245
246
|
agentName: toOptionalNullableString(raw.agentName),
|
|
246
247
|
backendSessionId: toOptionalNullableString(raw.backendSessionId),
|
|
247
248
|
lastReadAt: toOptionalNullableString(raw.lastReadAt),
|
|
@@ -318,7 +319,10 @@ function requireField(row, key, lineNo) {
|
|
|
318
319
|
}
|
|
319
320
|
function normalizePatchEvent(row, lineNo) {
|
|
320
321
|
const id = requireId(row, lineNo);
|
|
321
|
-
|
|
322
|
+
const fields = assertPatchFields(row.fields);
|
|
323
|
+
if (Array.isArray(row.unset) && row.unset.includes('profileName'))
|
|
324
|
+
Object.assign(fields, { profileName: undefined });
|
|
325
|
+
return { v: 1, op: 'patch', id, fields, ...normalizeUnset(row.unset, lineNo) };
|
|
322
326
|
}
|
|
323
327
|
function normalizeUnset(raw, lineNo) {
|
|
324
328
|
if (raw === undefined)
|
|
@@ -388,7 +392,8 @@ function assertSessionRecord(raw, expectedId) {
|
|
|
388
392
|
label: toNullableString(row?.label),
|
|
389
393
|
starred: toOptionalBoolean(row?.starred),
|
|
390
394
|
labelRenamed: toOptionalBoolean(row?.labelRenamed),
|
|
391
|
-
|
|
395
|
+
selection: toSelection(row?.selection),
|
|
396
|
+
...(row?.profileName !== undefined ? { profileName: row.profileName } : {}),
|
|
392
397
|
agentName: toOptionalNullableString(row?.agentName),
|
|
393
398
|
backendSessionId: toOptionalNullableString(row?.backendSessionId),
|
|
394
399
|
lastReadAt: toOptionalNullableString(row?.lastReadAt),
|
|
@@ -396,11 +401,12 @@ function assertSessionRecord(raw, expectedId) {
|
|
|
396
401
|
boardId: toOptionalNullableString(row?.boardId ?? row?.commissionId),
|
|
397
402
|
boardBlockFor: toOptionalNullableString(row?.boardBlockFor ?? row?.commissionBlockFor),
|
|
398
403
|
contextUsage: row?.contextUsage,
|
|
399
|
-
browser: toOptionalBrowserValue(row?.browser),
|
|
400
404
|
teamLeadId: toOptionalNullableString(row?.teamLeadId),
|
|
401
405
|
workerName: toOptionalNullableString(row?.workerName),
|
|
402
406
|
workerBrief: toOptionalNullableString(row?.workerBrief),
|
|
403
407
|
};
|
|
408
|
+
if (record.selection)
|
|
409
|
+
delete record.profileName;
|
|
404
410
|
return assertRecordId(record, expectedId);
|
|
405
411
|
}
|
|
406
412
|
function assertRecordId(record, expectedId) {
|
|
@@ -420,6 +426,20 @@ function toNullableString(value) {
|
|
|
420
426
|
throw new Error('Invalid session registry nullable string');
|
|
421
427
|
return value;
|
|
422
428
|
}
|
|
429
|
+
function toSelection(value) {
|
|
430
|
+
if (value === null || value === undefined)
|
|
431
|
+
return null;
|
|
432
|
+
const row = value;
|
|
433
|
+
if (row.backend !== 'claude' && row.backend !== 'pi')
|
|
434
|
+
throw new Error('Invalid session registry selection backend');
|
|
435
|
+
return {
|
|
436
|
+
backend: row.backend,
|
|
437
|
+
provider: toTurnNullableString(row.provider),
|
|
438
|
+
model: toStringValue(row.model),
|
|
439
|
+
thinking: toTurnNullableString(row.thinking),
|
|
440
|
+
mode: toStringValue(row.mode),
|
|
441
|
+
};
|
|
442
|
+
}
|
|
423
443
|
function toOptionalBoolean(value) {
|
|
424
444
|
if (value === undefined)
|
|
425
445
|
return undefined;
|
|
@@ -432,18 +452,6 @@ function toOptionalNullableString(value) {
|
|
|
432
452
|
return undefined;
|
|
433
453
|
return toNullableString(value);
|
|
434
454
|
}
|
|
435
|
-
/** Replay guard for the browser opt-in. Was missing from both asserts (fields not whitelisted
|
|
436
|
-
* here are silently dropped on replay), so every restart lost per-session browser opt-ins. */
|
|
437
|
-
function toOptionalBrowserValue(value) {
|
|
438
|
-
if (value === undefined)
|
|
439
|
-
return undefined;
|
|
440
|
-
if (value === null)
|
|
441
|
-
return null;
|
|
442
|
-
const device = value.device;
|
|
443
|
-
if (typeof device !== 'string' || !device)
|
|
444
|
-
throw new Error('Invalid session registry browser option');
|
|
445
|
-
return { device };
|
|
446
|
-
}
|
|
447
455
|
function toKindValue(value) {
|
|
448
456
|
if (value === 'local' || value === 'scheduled')
|
|
449
457
|
return value;
|
|
@@ -480,7 +488,7 @@ function toTurnStatus(value) {
|
|
|
480
488
|
throw new Error('Invalid session registry turn status');
|
|
481
489
|
}
|
|
482
490
|
/** Whitelist for the `patch` payload. Every field a record can carry (minus identity) has a strict
|
|
483
|
-
* converter here; a key not listed is DROPPED on replay (
|
|
491
|
+
* converter here; a key not listed is DROPPED on replay (§8.1). */
|
|
484
492
|
const PATCH_FIELD_READERS = {
|
|
485
493
|
projectId: toStringValue,
|
|
486
494
|
channel: toStringValue,
|
|
@@ -492,7 +500,7 @@ const PATCH_FIELD_READERS = {
|
|
|
492
500
|
label: toNullableString,
|
|
493
501
|
starred: toOptionalBoolean,
|
|
494
502
|
labelRenamed: toOptionalBoolean,
|
|
495
|
-
|
|
503
|
+
selection: toSelection,
|
|
496
504
|
agentName: toOptionalNullableString,
|
|
497
505
|
backendSessionId: toOptionalNullableString,
|
|
498
506
|
lastReadAt: toOptionalNullableString,
|
|
@@ -500,7 +508,6 @@ const PATCH_FIELD_READERS = {
|
|
|
500
508
|
boardId: toOptionalNullableString,
|
|
501
509
|
boardBlockFor: toOptionalNullableString,
|
|
502
510
|
contextUsage: value => value,
|
|
503
|
-
browser: toOptionalBrowserValue,
|
|
504
511
|
teamLeadId: toOptionalNullableString,
|
|
505
512
|
workerName: toOptionalNullableString,
|
|
506
513
|
workerBrief: toOptionalNullableString,
|
|
@@ -513,12 +520,15 @@ const PATCH_KEY_SET = new Set(PATCH_KEYS);
|
|
|
513
520
|
/** Patch keys written by earlier versions. Journals keep them until compaction, so replay maps them
|
|
514
521
|
* onto current fields (null: dropped). A record row is mapped the same way in assertSessionRecord.
|
|
515
522
|
* A legacy `commissionBlockFor` holds `active:<id>`, which never equals a boardId, so such a session
|
|
516
|
-
* receives the [Board] block once. `workerRetiredAt` went when workers began folding by idle time
|
|
523
|
+
* receives the [Board] block once. `workerRetiredAt` went when workers began folding by idle time;
|
|
524
|
+
* `browser` held a per-session browser opt-in that no longer exists. */
|
|
517
525
|
const LEGACY_PATCH_KEYS = {
|
|
518
526
|
commissionId: 'boardId',
|
|
519
527
|
commissionBlockFor: 'boardBlockFor',
|
|
520
528
|
commissionDraft: null,
|
|
521
529
|
workerRetiredAt: null,
|
|
530
|
+
profileName: null,
|
|
531
|
+
browser: null,
|
|
522
532
|
};
|
|
523
533
|
function patchKeyOf(key) {
|
|
524
534
|
return Object.hasOwn(LEGACY_PATCH_KEYS, key) ? LEGACY_PATCH_KEYS[key] : key;
|
|
@@ -529,6 +539,10 @@ function assertPatchFields(raw) {
|
|
|
529
539
|
const row = raw;
|
|
530
540
|
const fields = {};
|
|
531
541
|
for (const rawKey of Object.keys(row)) {
|
|
542
|
+
if (rawKey === 'profileName') {
|
|
543
|
+
fields[rawKey] = row[rawKey];
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
532
546
|
const key = patchKeyOf(rawKey);
|
|
533
547
|
if (key === null)
|
|
534
548
|
continue;
|
|
@@ -584,11 +598,11 @@ function assertPartialTurn(raw) {
|
|
|
584
598
|
return fields;
|
|
585
599
|
}
|
|
586
600
|
/** Whitelist for the `conversation set` payload. A key not listed is DROPPED on replay (the same
|
|
587
|
-
*
|
|
601
|
+
* trap that silently lost fields, §8.1) — keep in lock-step with the header. */
|
|
588
602
|
const CONVERSATION_FIELD_READERS = {
|
|
589
603
|
sessionId: toTurnNullableString,
|
|
590
604
|
backend: toStringValue,
|
|
591
|
-
|
|
605
|
+
selection: toSelection,
|
|
592
606
|
updatedAt: toStringValue,
|
|
593
607
|
};
|
|
594
608
|
function assertConversationFields(raw) {
|
|
@@ -597,9 +611,13 @@ function assertConversationFields(raw) {
|
|
|
597
611
|
const row = raw;
|
|
598
612
|
const fields = {};
|
|
599
613
|
for (const key of Object.keys(row)) {
|
|
614
|
+
if (key === 'profileName') {
|
|
615
|
+
fields[key] = row[key];
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
600
618
|
const reader = CONVERSATION_FIELD_READERS[key];
|
|
601
619
|
if (key === 'sessionName')
|
|
602
|
-
continue; //
|
|
620
|
+
continue; // Retired display-only field.
|
|
603
621
|
if (!reader)
|
|
604
622
|
throw new Error(`Unknown session registry conversation field: ${key}`);
|
|
605
623
|
fields[key] = reader(row[key]);
|
|
@@ -662,6 +680,8 @@ function applyPatch(state, event) {
|
|
|
662
680
|
const next = { ...record, ...event.fields };
|
|
663
681
|
for (const key of event.unset ?? [])
|
|
664
682
|
delete next[key];
|
|
683
|
+
if (next.selection || next.profileName === undefined)
|
|
684
|
+
delete next.profileName;
|
|
665
685
|
state.live.set(event.id, next);
|
|
666
686
|
}
|
|
667
687
|
/** Free-map bind: never gated on liveness — a channel may bind to an unknown, pending, or already
|
|
@@ -699,8 +719,11 @@ function applyConversation(state, event) {
|
|
|
699
719
|
return;
|
|
700
720
|
}
|
|
701
721
|
const base = state.conversations.get(event.channel)
|
|
702
|
-
?? { sessionId: null, backend: '',
|
|
703
|
-
|
|
722
|
+
?? { sessionId: null, backend: '', selection: null, updatedAt: '' };
|
|
723
|
+
const next = { ...base, ...event.fields };
|
|
724
|
+
if (next.selection)
|
|
725
|
+
delete next.profileName;
|
|
726
|
+
state.conversations.set(event.channel, next);
|
|
704
727
|
}
|
|
705
728
|
function applyPut(state, record) {
|
|
706
729
|
assertPutAllowed(state, record);
|
|
@@ -776,6 +799,9 @@ async function writeReplacementFile(tmp, events) {
|
|
|
776
799
|
}
|
|
777
800
|
}
|
|
778
801
|
async function syncParentDir(filePath) {
|
|
802
|
+
// Windows rejects fsync on a directory handle with EPERM; NTFS journals the rename itself.
|
|
803
|
+
if (process.platform === 'win32')
|
|
804
|
+
return;
|
|
779
805
|
const handle = await fsp.open(path.dirname(filePath), 'r');
|
|
780
806
|
try {
|
|
781
807
|
await handle.sync();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { EngineSelection } from '../domain/agents/engine-selection.js';
|
|
1
2
|
import type { SessionContextUsage } from '../core/types/agent-types.js';
|
|
2
|
-
import { type ConversationFields, type ConversationHeader, type SessionDeleteCleanup, type
|
|
3
|
+
import { type ConversationFields, type ConversationHeader, type SessionDeleteCleanup, type SessionOrigin, type SessionRecord, type SessionRegistryJournalOptions, type TurnRecord } from './session-registry-journal.js';
|
|
3
4
|
export declare const REGISTRY_FILE: string;
|
|
4
5
|
export { type SessionOrigin, type TurnRecord, type ConversationFields, type ConversationHeader, };
|
|
5
6
|
/** In-memory channel→sessionId resolver (never persisted). A resolver that returns a string wins
|
|
@@ -15,7 +16,7 @@ export interface PendingDeletion {
|
|
|
15
16
|
}
|
|
16
17
|
export type SessionRegistryData = Record<string, Session>;
|
|
17
18
|
export type SessionRegistryRepoOptions = SessionRegistryJournalOptions;
|
|
18
|
-
type UpdateFields = Partial<Pick<Session, 'lastUsedAt' | 'label' | '
|
|
19
|
+
type UpdateFields = Partial<Pick<Session, 'lastUsedAt' | 'label' | 'selection' | 'backend' | 'agentName' | 'backendSessionId' | 'contextUsage'>> & {
|
|
19
20
|
sessionId?: never;
|
|
20
21
|
};
|
|
21
22
|
export interface RegisterSessionOpts {
|
|
@@ -26,11 +27,10 @@ export interface RegisterSessionOpts {
|
|
|
26
27
|
origin?: SessionOrigin;
|
|
27
28
|
projectId?: string;
|
|
28
29
|
label?: string | null;
|
|
29
|
-
|
|
30
|
+
selection?: EngineSelection | null;
|
|
30
31
|
agentName?: string | null;
|
|
31
32
|
backendSessionId?: string | null;
|
|
32
33
|
scheduleId?: string | null;
|
|
33
|
-
browser?: SessionBrowserOption | null;
|
|
34
34
|
boardId?: string | null;
|
|
35
35
|
teamLeadId?: string | null;
|
|
36
36
|
workerName?: string | null;
|
|
@@ -30,7 +30,7 @@ function diffRecord(current, next) {
|
|
|
30
30
|
return { fields: fields, unset };
|
|
31
31
|
}
|
|
32
32
|
function cloneSession(record) {
|
|
33
|
-
return { ...record };
|
|
33
|
+
return { ...record, selection: record.selection ? { ...record.selection } : null };
|
|
34
34
|
}
|
|
35
35
|
function toStoredRecord(session) {
|
|
36
36
|
return session;
|
|
@@ -92,11 +92,10 @@ export class SessionRegistryRepo {
|
|
|
92
92
|
createdAt: now,
|
|
93
93
|
lastUsedAt: now,
|
|
94
94
|
label: trimLabel(opts.label),
|
|
95
|
-
|
|
95
|
+
selection: opts.selection ? { ...opts.selection } : null,
|
|
96
96
|
agentName: opts.agentName ?? null,
|
|
97
97
|
backendSessionId: opts.backendSessionId ?? null,
|
|
98
98
|
scheduleId: opts.scheduleId ?? null,
|
|
99
|
-
browser: opts.browser ?? null,
|
|
100
99
|
boardId: opts.boardId ?? null,
|
|
101
100
|
...(opts.teamLeadId
|
|
102
101
|
? {
|
|
@@ -127,12 +126,12 @@ export class SessionRegistryRepo {
|
|
|
127
126
|
...current,
|
|
128
127
|
lastUsedAt: updates.lastUsedAt ?? current.lastUsedAt,
|
|
129
128
|
label: updates.label !== undefined ? trimLabel(updates.label) : current.label,
|
|
130
|
-
|
|
129
|
+
selection: updates.selection !== undefined ? updates.selection : current.selection,
|
|
130
|
+
backend: updates.backend ?? current.backend,
|
|
131
131
|
agentName: updates.agentName !== undefined ? updates.agentName : current.agentName,
|
|
132
132
|
backendSessionId: updates.backendSessionId !== undefined
|
|
133
133
|
? updates.backendSessionId
|
|
134
134
|
: current.backendSessionId,
|
|
135
|
-
browser: updates.browser !== undefined ? updates.browser : current.browser,
|
|
136
135
|
contextUsage: updates.contextUsage !== undefined ? updates.contextUsage : current.contextUsage,
|
|
137
136
|
});
|
|
138
137
|
}
|
|
@@ -19,13 +19,12 @@ export interface StepMigration {
|
|
|
19
19
|
key: string;
|
|
20
20
|
/** CalVer when this step was introduced. Same pending rule as file migrations. */
|
|
21
21
|
version: string;
|
|
22
|
-
/** Idempotent action.
|
|
23
|
-
* bump the key, and continues with the next step — the step retries next boot). */
|
|
22
|
+
/** Idempotent action. Return false to defer without bumping; throw to signal failure. */
|
|
24
23
|
run(ctx: {
|
|
25
24
|
dataDir: string;
|
|
26
25
|
storeDir: string;
|
|
27
26
|
defaultsDir: string;
|
|
28
|
-
}): Promise<void>;
|
|
27
|
+
}): Promise<void | false>;
|
|
29
28
|
}
|
|
30
29
|
/** Replace any existing `<!-- cortex:docs ... -->` … `<!-- /cortex:docs -->` region with
|
|
31
30
|
* `block`, or append `block` (separated by a blank line) when absent. Idempotent: feeding
|
|
@@ -83,6 +82,11 @@ export interface MigrationOptions {
|
|
|
83
82
|
* real `stepMigrations`. Lets tests drive the step-runner contract (bump / skip / throw / order)
|
|
84
83
|
* with probe steps instead of the real S1 import. */
|
|
85
84
|
stepMigrations?: StepMigration[];
|
|
85
|
+
/** Observer of each migration that throws (telemetry); never affects the run. */
|
|
86
|
+
onMigrationFailure?: (failure: {
|
|
87
|
+
migration: string;
|
|
88
|
+
error: unknown;
|
|
89
|
+
}) => void;
|
|
86
90
|
}
|
|
87
91
|
export declare function runMigrations(opts?: MigrationOptions): Promise<void>;
|
|
88
92
|
/** Move the retired singular session hook config into declarative registry files. */
|
|
@@ -6,6 +6,7 @@ import { AISTATUS_DIR, DATA_DIR, DEFAULTS_DIR, PROJECTS_DIR } from '../core/path
|
|
|
6
6
|
import { compareCalVer } from '../core/calver.js';
|
|
7
7
|
import { atomicWrite } from '../core/atomic-write.js';
|
|
8
8
|
import { RETIRED_MCP_TOOLS } from '../core/mcp-tool-gate.js';
|
|
9
|
+
import { migrateRetiredPiUpstreams } from '../core/gateway-generator.js';
|
|
9
10
|
import { createLogger } from '../core/log.js';
|
|
10
11
|
import { validateHookEntry } from './hook-registry.js';
|
|
11
12
|
import { migrateProviderStateFromSchedules } from './provider-state-repo.js';
|
|
@@ -14,6 +15,8 @@ import { importLegacySessionStores } from './session-registry-import.js';
|
|
|
14
15
|
import { migrateClaudeConfigHome } from './claude-transcript-migration.js';
|
|
15
16
|
import { retireCommissions } from './board-migration.js';
|
|
16
17
|
import { migrateToBuiltinOverlay } from './builtin-overlay-migration.js';
|
|
18
|
+
import { retireProfiles } from './retire-profiles-migration.js';
|
|
19
|
+
import { appendMemoryIndexIgnores } from './gitignore-migration.js';
|
|
17
20
|
import { CODER_COMMIT_POLICY_REPLACEMENTS, CODER_REVIEWER_COMMIT_POLICY_REPLACEMENTS, STATUS_REGISTER_REPLACEMENTS, } from './prompt-migration-replacements.js';
|
|
18
21
|
const log = createLogger('version-migrations');
|
|
19
22
|
// ── Marker-block helpers (text migrations) ─────────────────────
|
|
@@ -373,6 +376,11 @@ const migrations = [
|
|
|
373
376
|
return { ...state, providerUsage: kept };
|
|
374
377
|
},
|
|
375
378
|
},
|
|
379
|
+
// M12: anchor the shipped memory-index ignore rules under context/ in existing installs.
|
|
380
|
+
{
|
|
381
|
+
filePath: '.gitignore', version: '2026.10.22', format: 'text',
|
|
382
|
+
migrate: (data) => typeof data === 'string' ? appendMemoryIndexIgnores(data) : data,
|
|
383
|
+
},
|
|
376
384
|
];
|
|
377
385
|
// ── Step migration registry ────────────────────────────────────
|
|
378
386
|
// Add step migrations here. Executed in list order AFTER the file-migration loop.
|
|
@@ -505,6 +513,24 @@ const stepMigrations = [
|
|
|
505
513
|
await migrateToBuiltinOverlay({ dataDir, defaultsDir });
|
|
506
514
|
},
|
|
507
515
|
},
|
|
516
|
+
// S10: materialize engine selections before retiring the named preset snapshot. The helper owns
|
|
517
|
+
// its temporary registry repo and keeps raw names/overrides available until all patches land.
|
|
518
|
+
{
|
|
519
|
+
key: 'sentinel:retire-profiles',
|
|
520
|
+
version: '2026.10.15',
|
|
521
|
+
run: async ({ dataDir, storeDir }) => {
|
|
522
|
+
const report = await retireProfiles({ dataDir, storeDir });
|
|
523
|
+
if (report.skipped === 'immutable')
|
|
524
|
+
return false;
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
// S11: PI 1.3.0 moved Kimi Coding and OpenCode to new base URLs. Gateway routes Cortex wrote for
|
|
528
|
+
// the old ones follow; hand-pointed relays are left alone.
|
|
529
|
+
{
|
|
530
|
+
key: 'sentinel:pi-retired-upstreams',
|
|
531
|
+
version: '2026.10.22',
|
|
532
|
+
run: async () => { migrateRetiredPiUpstreams(path.join(AISTATUS_DIR, 'gateway.yaml')); },
|
|
533
|
+
},
|
|
508
534
|
];
|
|
509
535
|
// ── Execution environments (S5) ────────────────────────────────
|
|
510
536
|
const KEPT_ENVIRONMENTS = ['main', 'creative'];
|
|
@@ -922,106 +948,133 @@ export async function loadVersionsFrom(filePath) {
|
|
|
922
948
|
export async function saveVersionsTo(filePath, versions) {
|
|
923
949
|
await atomicWrite(filePath, JSON.stringify(versions, null, 2) + '\n');
|
|
924
950
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
log.warn(`Could not migrate legacy provider state: ${error.message}`);
|
|
932
|
-
});
|
|
933
|
-
await migrateSessionHooksToRegistry(dataDir);
|
|
934
|
-
await removeRetiredDefaultHooks(dataDir).catch((error) => {
|
|
935
|
-
log.warn(`Could not remove retired default hooks: ${error.message}`);
|
|
936
|
-
});
|
|
937
|
-
const versionsFile = path.join(storeDir, 'versions.json');
|
|
938
|
-
const versions = await loadVersionsFrom(versionsFile);
|
|
939
|
-
// Group migrations by filePath
|
|
951
|
+
function pendingFor(list, trackedVersion) {
|
|
952
|
+
return list
|
|
953
|
+
.filter(m => compareCalVer(trackedVersion, m.version) < 0 && compareCalVer(CORTEX_VERSION, m.version) >= 0)
|
|
954
|
+
.sort((a, b) => compareCalVer(a.version, b.version));
|
|
955
|
+
}
|
|
956
|
+
function groupByFile(list) {
|
|
940
957
|
const byFilePath = new Map();
|
|
941
|
-
for (const m of
|
|
942
|
-
const
|
|
943
|
-
|
|
944
|
-
byFilePath.set(m.filePath,
|
|
958
|
+
for (const m of list) {
|
|
959
|
+
const group = byFilePath.get(m.filePath) ?? [];
|
|
960
|
+
group.push(m);
|
|
961
|
+
byFilePath.set(m.filePath, group);
|
|
945
962
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
let data;
|
|
960
|
-
try {
|
|
961
|
-
const raw = await fs.readFile(absPath, 'utf8');
|
|
962
|
-
data = format === 'text' ? raw : JSON.parse(raw);
|
|
963
|
+
return byFilePath;
|
|
964
|
+
}
|
|
965
|
+
/** The file's current contents, or `undefined` when it is absent or corrupt (skip its migrations). */
|
|
966
|
+
async function readMigrationTarget(absPath, filePath, format) {
|
|
967
|
+
try {
|
|
968
|
+
const raw = await fs.readFile(absPath, 'utf8');
|
|
969
|
+
return format === 'text' ? raw : JSON.parse(raw);
|
|
970
|
+
}
|
|
971
|
+
catch (err) {
|
|
972
|
+
const e = err;
|
|
973
|
+
if (e.code === 'ENOENT') {
|
|
974
|
+
log.info(`Skipping migrations for ${filePath}: file does not exist yet`);
|
|
975
|
+
return undefined;
|
|
963
976
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
log.info(`Skipping migrations for ${filePath}: file does not exist yet`);
|
|
968
|
-
continue;
|
|
969
|
-
}
|
|
970
|
-
if (err instanceof SyntaxError) {
|
|
971
|
-
log.warn(`Skipping migrations for ${filePath}: corrupt JSON (${e.message})`);
|
|
972
|
-
continue;
|
|
973
|
-
}
|
|
974
|
-
throw err;
|
|
977
|
+
if (err instanceof SyntaxError) {
|
|
978
|
+
log.warn(`Skipping migrations for ${filePath}: corrupt JSON (${e.message})`);
|
|
979
|
+
return undefined;
|
|
975
980
|
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
anyFailed = true;
|
|
988
|
-
break;
|
|
989
|
-
}
|
|
990
|
-
if (serialize(data) !== before) {
|
|
991
|
-
log.info(`Migration ${m.version} applied to ${filePath}`);
|
|
992
|
-
changed = true;
|
|
993
|
-
}
|
|
981
|
+
throw err;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
/** Apply pending migrations in order; stops at the first failure. */
|
|
985
|
+
function applyPending(pending, start, filePath, serialize, report) {
|
|
986
|
+
let data = start;
|
|
987
|
+
let changed = false;
|
|
988
|
+
for (const m of pending) {
|
|
989
|
+
const before = serialize(data);
|
|
990
|
+
try {
|
|
991
|
+
data = m.migrate(data);
|
|
994
992
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
993
|
+
catch (err) {
|
|
994
|
+
log.error(`Migration ${m.version} for ${filePath} failed: ${err.message}; skipping remaining migrations for this file`);
|
|
995
|
+
report({ migration: `${m.version}:${filePath}`, error: err });
|
|
996
|
+
return { data, changed: false, failed: true };
|
|
998
997
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
// retry next boot. Idempotent migrations guarantee this is safe.
|
|
1003
|
-
if (!anyFailed) {
|
|
1004
|
-
versions[filePath] = pending[pending.length - 1].version;
|
|
998
|
+
if (serialize(data) !== before) {
|
|
999
|
+
log.info(`Migration ${m.version} applied to ${filePath}`);
|
|
1000
|
+
changed = true;
|
|
1005
1001
|
}
|
|
1006
1002
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
//
|
|
1011
|
-
|
|
1003
|
+
return { data, changed, failed: false };
|
|
1004
|
+
}
|
|
1005
|
+
async function migrateFile(dataDir, filePath, pending, versions, report) {
|
|
1006
|
+
// A file is either JSON or text — take the format from the pending migrations.
|
|
1007
|
+
const format = pending.find(m => m.format === 'text') ? 'text' : 'json';
|
|
1008
|
+
const serialize = (d) => (format === 'text' ? String(d) : JSON.stringify(d));
|
|
1009
|
+
const absPath = path.join(dataDir, filePath);
|
|
1010
|
+
const data = await readMigrationTarget(absPath, filePath, format);
|
|
1011
|
+
if (data === undefined)
|
|
1012
|
+
return;
|
|
1013
|
+
const result = applyPending(pending, data, filePath, serialize, report);
|
|
1014
|
+
if (result.changed) {
|
|
1015
|
+
const out = format === 'text' ? String(result.data) : JSON.stringify(result.data, null, 2) + '\n';
|
|
1016
|
+
await atomicWrite(absPath, out);
|
|
1017
|
+
}
|
|
1018
|
+
// Only bump the tracked version if ALL pending migrations succeeded.
|
|
1019
|
+
// If any failed: we did not write the file (changed=false), so the data on
|
|
1020
|
+
// disk is unchanged. Leave version at the old value → all pending migrations
|
|
1021
|
+
// retry next boot. Idempotent migrations guarantee this is safe.
|
|
1022
|
+
if (!result.failed)
|
|
1023
|
+
versions[filePath] = pending[pending.length - 1].version;
|
|
1024
|
+
}
|
|
1025
|
+
// Step migrations run AFTER the file loop (so a step sees the file rewrites above) with the same
|
|
1026
|
+
// pending rule and the same versions.json, keyed by `key`. A throwing step logs and is skipped
|
|
1027
|
+
// WITHOUT bumping — it retries next boot. S10 is required before runtime state writes. Only a step that
|
|
1028
|
+
// completes (rather than returning false to defer) bumps its key.
|
|
1029
|
+
async function runStepMigrations(steps, ctx, versions, report) {
|
|
1030
|
+
for (const step of steps) {
|
|
1012
1031
|
const tracked = versions[step.key] || '0.0.0';
|
|
1013
1032
|
const pending = compareCalVer(tracked, step.version) < 0 && compareCalVer(CORTEX_VERSION, step.version) >= 0;
|
|
1014
1033
|
if (!pending)
|
|
1015
1034
|
continue;
|
|
1016
1035
|
try {
|
|
1017
|
-
await step.run(
|
|
1036
|
+
if (await step.run(ctx) === false)
|
|
1037
|
+
continue;
|
|
1018
1038
|
versions[step.key] = step.version;
|
|
1019
1039
|
log.info(`Step migration ${step.version} applied for ${step.key}`);
|
|
1020
1040
|
}
|
|
1021
1041
|
catch (err) {
|
|
1022
1042
|
log.error(`Step migration ${step.version} for ${step.key} failed: ${err.message}; not bumping`);
|
|
1043
|
+
report({ migration: `${step.version}:${step.key}`, error: err });
|
|
1044
|
+
// Runtime state writes must not discard the legacy inputs needed to retry this conversion.
|
|
1045
|
+
if (step.key === 'sentinel:retire-profiles')
|
|
1046
|
+
throw err;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
async function runLegacyRelocations(dataDir) {
|
|
1051
|
+
await migrateProviderStateFromSchedules(dataDir).catch((error) => {
|
|
1052
|
+
log.warn(`Could not migrate legacy provider state: ${error.message}`);
|
|
1053
|
+
});
|
|
1054
|
+
await migrateSessionHooksToRegistry(dataDir);
|
|
1055
|
+
await removeRetiredDefaultHooks(dataDir).catch((error) => {
|
|
1056
|
+
log.warn(`Could not remove retired default hooks: ${error.message}`);
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
export async function runMigrations(opts = {}) {
|
|
1060
|
+
const dataDir = opts.dataDir ?? DATA_DIR;
|
|
1061
|
+
const defaultsDir = opts.defaultsDir ?? DEFAULTS_DIR;
|
|
1062
|
+
const storeDir = opts.storeDir ?? path.join(dataDir, 'data');
|
|
1063
|
+
const report = (failure) => {
|
|
1064
|
+
try {
|
|
1065
|
+
opts.onMigrationFailure?.(failure);
|
|
1023
1066
|
}
|
|
1067
|
+
catch { /* an observer never stops migrations */ }
|
|
1068
|
+
};
|
|
1069
|
+
await runLegacyRelocations(dataDir);
|
|
1070
|
+
const versionsFile = path.join(storeDir, 'versions.json');
|
|
1071
|
+
const versions = await loadVersionsFrom(versionsFile);
|
|
1072
|
+
for (const [filePath, fileMigrations] of groupByFile(migrations)) {
|
|
1073
|
+
const pending = pendingFor(fileMigrations, versions[filePath] || '0.0.0');
|
|
1074
|
+
if (pending.length > 0)
|
|
1075
|
+
await migrateFile(dataDir, filePath, pending, versions, report);
|
|
1024
1076
|
}
|
|
1077
|
+
await runStepMigrations(opts.stepMigrations ?? stepMigrations, { dataDir, storeDir, defaultsDir }, versions, report);
|
|
1025
1078
|
await saveVersionsTo(versionsFile, versions);
|
|
1026
1079
|
}
|
|
1027
1080
|
const SESSION_HOOK_DESTINATIONS = {
|
|
@@ -40,9 +40,10 @@ function TabContent({ tab, active, sendFrame, mutate, projectId, dashState, onRe
|
|
|
40
40
|
initialQuerySent.current = true;
|
|
41
41
|
// Send query for initial data
|
|
42
42
|
sendFrameRef.current({ type: 'ui.query', id: queryId, scope: tab === 'cost' ? 'cost.summary' : `${tab}.list`, params: projectId ? { projectId } : {} });
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (scope.events.length > 0) {
|
|
44
|
+
sendFrameRef.current({ type: 'ui.subscribe', id: queryId, filter: { events: scope.events, projectId } });
|
|
45
|
+
onRegisterSubscriptionRef.current(queryId, tab);
|
|
46
|
+
}
|
|
46
47
|
}
|
|
47
48
|
// Cleanup on unmount
|
|
48
49
|
return () => {
|
|
@@ -9,7 +9,7 @@ export const EMPTY_DASH_STATE = {
|
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
11
|
export const TAB_SCOPES = {
|
|
12
|
-
schedules: { queryId: 'dash-schedules', events: [
|
|
12
|
+
schedules: { queryId: 'dash-schedules', events: [] },
|
|
13
13
|
executions: { queryId: 'dash-executions', events: ['agent.started', 'agent.completed', 'agent.failed', 'agent.superseded'] },
|
|
14
14
|
cost: { queryId: 'dash-cost', events: ['agent.completed'] },
|
|
15
15
|
};
|
|
@@ -26,11 +26,11 @@ export const SLASH_COMMANDS = [
|
|
|
26
26
|
// Agents / scheduling
|
|
27
27
|
cmd('agent'),
|
|
28
28
|
cmd('schedule'),
|
|
29
|
-
//
|
|
29
|
+
// Engine selection
|
|
30
30
|
cmd('mode'),
|
|
31
31
|
cmd('model'),
|
|
32
32
|
cmd('backend'),
|
|
33
|
-
cmd('
|
|
33
|
+
cmd('thinking'),
|
|
34
34
|
cmd('skills'),
|
|
35
35
|
// Devices / GPU / logs
|
|
36
36
|
cmd('devices'),
|
package/dist/tui/turn-status.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Source formats (src/core/status-format.ts + orchestration/turn/terminal.ts):
|
|
3
|
-
// processing: "⏳ Processing | <name> · `<uuid>` | <
|
|
3
|
+
// processing: "⏳ Processing | <name> · `<uuid>` | <backend · model> | ⏱️ <dur>[ | 🔁 <n> turns]"
|
|
4
4
|
// done/error: "✅ Done | <name> · `<uuid>` | (<dur> · <n> turns · $<cost>)"
|
|
5
5
|
// Parsing is defensive: any missing field is simply omitted.
|
|
6
6
|
import { t } from '../core/i18n.js';
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortex-agent/server",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Agent workbench for auto research, self-improvement loops, and long-running work — multi-agent teams, persistent project memory, cross-machine GPU training.",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=22.19.0"
|
|
9
9
|
},
|
|
10
10
|
"main": "dist/entry/app.js",
|
|
11
11
|
"bin": {
|
|
12
12
|
"cortex": "dist/entry/cortex-cli.js",
|
|
13
|
+
"cortex-browser": "dist/entry/browser-cli.js",
|
|
13
14
|
"cortex-evidence-export": "dist/entry/production-evidence-export-cli.js",
|
|
14
15
|
"cortex-hook": "dist/entry/hook-cli.js",
|
|
15
16
|
"cortex-signal": "dist/entry/signal-cli.js"
|
|
@@ -42,13 +43,14 @@
|
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"@clack/prompts": "^1.3.0",
|
|
45
|
-
"@earendil-works/pi-ai": "
|
|
46
|
-
"@earendil-works/pi-coding-agent": "
|
|
46
|
+
"@earendil-works/pi-ai": "1.4.0",
|
|
47
|
+
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
47
48
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
48
49
|
"@sinclair/typebox": "^0.34.49",
|
|
49
50
|
"@slack/bolt": "^4.6.0",
|
|
50
51
|
"@slack/web-api": "^7.14.1",
|
|
51
52
|
"@trpc/server": "^11",
|
|
53
|
+
"agent-browser": "0.39.1",
|
|
52
54
|
"aistatus": "~0.0.11",
|
|
53
55
|
"dotenv": "^16.4.7",
|
|
54
56
|
"ink": "^5.2.1",
|