@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
|
@@ -1,293 +1,124 @@
|
|
|
1
1
|
import { Icons } from '../../../core/icons.js';
|
|
2
2
|
import { t } from '../../../core/i18n.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { getChannelAgents, getDefaultAgent, setDefaultAgent, switchChannelAgent, clearChannelAgentSelection } from '../../../domain/agents/index.js';
|
|
4
|
+
import { applyChannelSelection } from '../../../domain/agents/model-selection.js';
|
|
5
|
+
import { getDefaultSelection, getDefaultSelectionForBackend, listFavorites, resolveModelRef, selectionForModel } from '../../../domain/agents/models.js';
|
|
6
|
+
import { isValidThinkingLevel } from '../../../domain/agents/engine-selection.js';
|
|
7
|
+
import { resolveRunSelection } from '../../../domain/runs/config-resolver.js';
|
|
6
8
|
import { listSkillGroups } from '../../../domain/plugins/catalog.js';
|
|
7
9
|
import { conversationPluginDirs } from '../../../domain/plugins/conversation-skills.js';
|
|
8
10
|
import { getSessionAsync } from '../../../domain/sessions/session.js';
|
|
9
11
|
import { sessionStore } from '../../../store/session-registry-repo.js';
|
|
10
12
|
import { getEnvironment, listEnvironments } from '../../../domain/agents/environments/registry.js';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const globalActive = getActiveProfile();
|
|
14
|
-
const channelActive = channel ? getActiveProfile(channel) : globalActive;
|
|
15
|
-
const defaultName = getDefaultProfileName();
|
|
16
|
-
return listProfiles().map(profile => {
|
|
17
|
-
const markers = [];
|
|
18
|
-
if (profile.name === defaultName)
|
|
19
|
-
markers.push(t('cmd.profile.markerDefault'));
|
|
20
|
-
if (profile.name === (globalActive || defaultName))
|
|
21
|
-
markers.push(t('cmd.profile.markerGlobal'));
|
|
22
|
-
if (channel && channelActive !== globalActive && profile.name === channelActive)
|
|
23
|
-
markers.push(t('cmd.profile.markerChannel'));
|
|
24
|
-
const suffix = markers.length ? ` (${markers.join(', ')})` : '';
|
|
25
|
-
const backend = profile.backend || 'claude';
|
|
26
|
-
const mode = profile.mode || '-';
|
|
27
|
-
return `• *${profile.name}* → \`${profile.model}\` · ${backend} · ${mode}${suffix}`;
|
|
28
|
-
}).join('\n');
|
|
13
|
+
function destination(channel) {
|
|
14
|
+
return { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
29
15
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
* It used to flip a daemon-wide plan/api flag. That flag stopped routing anything the moment the
|
|
34
|
-
* run path started resolving `mode` from the profile: `configureRunRoute` builds the gateway URL
|
|
35
|
-
* from `config.mode`, which is the profile's, so the toggle moved a field nobody read. Rather than
|
|
36
|
-
* keep a control that silently does nothing, the command now says where the value comes from.
|
|
37
|
-
*/
|
|
38
|
-
export async function handleModeCmd(channel, adapter) {
|
|
39
|
-
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
40
|
-
const { profileName, profile } = resolveRunConfig({ channel });
|
|
41
|
-
const mode = profile.mode === 'plan' ? t('cmd.mode.planLabel') : t('cmd.mode.apiLabel');
|
|
42
|
-
await adapter.postMessage(dest, {
|
|
43
|
-
text: t('cmd.mode.fromProfile', { mode, profile: profileName }),
|
|
44
|
-
});
|
|
16
|
+
function selectionText(selection) {
|
|
17
|
+
return `${selection.backend} · ${selection.provider ? `${selection.provider}/` : ''}${selection.model} · ${selection.thinking ?? t('cmd.thinking.none')} · ${selection.mode}`;
|
|
45
18
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* Before D5 this flipped a daemon-wide `backend` field that the run path then contradicted with
|
|
50
|
-
* the channel's own profile. There is no such field any more: a backend is a property of a
|
|
51
|
-
* profile, so switching backend means switching profile, and it goes through exactly the rule
|
|
52
|
-
* `!profile` uses — including the refusal to move a conversation that already has history, which
|
|
53
|
-
* no backend can resume on the other side.
|
|
54
|
-
*/
|
|
55
|
-
export async function handleBackendCmd(channel, adapter, trimmedMessage) {
|
|
56
|
-
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
57
|
-
const arg = trimmedMessage.split(/\s+/)[1];
|
|
58
|
-
const current = resolveRunConfig({ channel });
|
|
59
|
-
// No argument keeps the old affordance: toggle to the other backend.
|
|
60
|
-
const target = arg === 'claude' || arg === 'pi'
|
|
61
|
-
? arg
|
|
62
|
-
: (current.profile.backend === 'claude' ? 'pi' : 'claude');
|
|
63
|
-
if (arg && arg !== 'claude' && arg !== 'pi') {
|
|
64
|
-
await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.backend.usage')}` });
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const label = target === 'claude' ? t('cmd.backend.claudeLabel') : t('cmd.backend.piLabel');
|
|
68
|
-
if (current.resolved && current.profile.backend === target) {
|
|
69
|
-
await adapter.postMessage(dest, {
|
|
70
|
-
text: t('cmd.backend.already', { backend: label, profile: current.profileName }),
|
|
71
|
-
});
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const name = getDefaultProfileForBackend(target);
|
|
75
|
-
if (!name) {
|
|
76
|
-
await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.backend.noProfile', { backend: label })}` });
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
await adapter.postMessage(dest, { text: await switchChannelProfileReply(channel, name) });
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* `!thinking` — show, set or clear THIS CHANNEL's thinking level (the composer picker's chat twin).
|
|
83
|
-
*
|
|
84
|
-
* The same channel-scoped override the picker writes, one field over. The level IS validated (by
|
|
85
|
-
* the selection rule), unlike the model: an id the backend does not know is the backend's business
|
|
86
|
-
* to refuse, but an effort word it does not know is rejected by the CLI before the turn starts,
|
|
87
|
-
* which reads as the agent dying. Clearing drops only the level.
|
|
88
|
-
*/
|
|
89
|
-
export async function handleThinkingCmd(channel, adapter, trimmedMessage) {
|
|
90
|
-
const args = trimmedMessage.split(/\s+/).slice(1);
|
|
91
|
-
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
92
|
-
const config = resolveRunConfig({ channel });
|
|
93
|
-
const arg = args.join(' ').trim();
|
|
94
|
-
let text;
|
|
95
|
-
if (args.length === 0)
|
|
96
|
-
text = thinkingStatusText(config);
|
|
97
|
-
// 'off' is a real pi level, so it only means "clear" on a backend that has no such rung.
|
|
98
|
-
else if (arg === 'reset' || arg === 'clear' || (arg === 'off' && !isValidThinkingLevel(config.profile.backend, 'off'))) {
|
|
99
|
-
text = await clearThinking(channel, config);
|
|
19
|
+
function selectionFailure(result, requested) {
|
|
20
|
+
if (result.reason === 'cross-backend-live-session') {
|
|
21
|
+
return t('cmd.selection.crossBackendBlocked', { name: requested.model ?? result.model, target: result.targetBackend ?? '', current: result.currentBackend ?? '' });
|
|
100
22
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
function declaredThinking(config) {
|
|
106
|
-
return config.profile.thinking ?? t('cmd.thinking.none');
|
|
23
|
+
if (result.reason === 'invalid-mode')
|
|
24
|
+
return t('cmd.mode.invalid', { mode: requested.mode ?? '', routes: (result.allowed ?? []).join(', ') });
|
|
25
|
+
return t('cmd.error', { error: result.reason ?? '' });
|
|
107
26
|
}
|
|
108
|
-
function
|
|
109
|
-
const
|
|
110
|
-
return
|
|
111
|
-
? t('cmd.
|
|
112
|
-
:
|
|
27
|
+
async function selectReply(channel, selection) {
|
|
28
|
+
const result = await applyChannelSelection({ channel, ...selection, seedDefault: false });
|
|
29
|
+
return result.ok
|
|
30
|
+
? `${Icons.ok} ${t('cmd.model.set', { model: selectionText(result) })}`
|
|
31
|
+
: `${Icons.error} ${selectionFailure(result, selection)}`;
|
|
113
32
|
}
|
|
114
|
-
async function
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
33
|
+
export async function handleModeCmd(channel, adapter, message = '!mode') {
|
|
34
|
+
const mode = message.split(/\s+/).slice(1).join(' ').trim();
|
|
35
|
+
const text = mode
|
|
36
|
+
? await selectReply(channel, { mode })
|
|
37
|
+
: t('cmd.mode.current', { mode: resolveRunSelection({ channel }).mode });
|
|
38
|
+
await adapter.postMessage(destination(channel), { text });
|
|
120
39
|
}
|
|
121
|
-
async function
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
})}
|
|
40
|
+
export async function handleBackendCmd(channel, adapter, message) {
|
|
41
|
+
const arg = message.split(/\s+/)[1];
|
|
42
|
+
const current = resolveRunSelection({ channel });
|
|
43
|
+
const target = arg === 'claude' || arg === 'pi' ? arg : (current.backend === 'claude' ? 'pi' : 'claude');
|
|
44
|
+
if (arg && arg !== 'claude' && arg !== 'pi') {
|
|
45
|
+
await adapter.postMessage(destination(channel), { text: `${Icons.error} ${t('cmd.backend.usage')}` });
|
|
46
|
+
return;
|
|
127
47
|
}
|
|
128
|
-
|
|
48
|
+
const selection = getDefaultSelectionForBackend(target);
|
|
49
|
+
const text = selection
|
|
50
|
+
? await selectReply(channel, selection)
|
|
51
|
+
: `${Icons.error} ${t('cmd.backend.noFavorite', { backend: target })}`;
|
|
52
|
+
await adapter.postMessage(destination(channel), { text });
|
|
129
53
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
*
|
|
137
|
-
* The value is not validated here: which ids a backend accepts is the backend's business, and its
|
|
138
|
-
* own rejection names the problem better than a guess would.
|
|
139
|
-
*
|
|
140
|
-
* `!model` and `!thinking` write through `applyChannelSelection`, the rule every selection surface
|
|
141
|
-
* shares, with `seedDefault: false`: a channel-scoped command does not decide what the next new
|
|
142
|
-
* Web conversation opens on.
|
|
143
|
-
*/
|
|
144
|
-
export async function handleModelCmd(channel, adapter, trimmedMessage) {
|
|
145
|
-
const args = trimmedMessage.split(/\s+/).slice(1);
|
|
146
|
-
const dest = { type: 'interactive-reply', conduit: channel, sessionId: '' };
|
|
147
|
-
const config = resolveRunConfig({ channel });
|
|
148
|
-
const arg = args.join(' ').trim();
|
|
149
|
-
let text;
|
|
150
|
-
if (args.length === 0)
|
|
151
|
-
text = modelStatusText(config);
|
|
152
|
-
else if (arg === 'reset' || arg === 'clear' || arg === 'off')
|
|
153
|
-
text = await clearModel(channel, config);
|
|
154
|
-
else if (!arg)
|
|
155
|
-
text = `${Icons.error} ${t('cmd.model.usage')}`;
|
|
156
|
-
else {
|
|
157
|
-
await applyChannelSelection({ channel, model: arg, seedDefault: false });
|
|
158
|
-
text = `${Icons.ok} ${t('cmd.model.set', { model: arg, profile: config.profileName })}`;
|
|
54
|
+
export async function handleThinkingCmd(channel, adapter, message) {
|
|
55
|
+
const arg = message.split(/\s+/).slice(1).join(' ').trim();
|
|
56
|
+
const current = resolveRunSelection({ channel });
|
|
57
|
+
if (!arg) {
|
|
58
|
+
await adapter.postMessage(destination(channel), { text: t('cmd.thinking.current', { thinking: current.thinking ?? t('cmd.thinking.none') }) });
|
|
59
|
+
return;
|
|
159
60
|
}
|
|
160
|
-
|
|
61
|
+
const clear = arg === 'reset' || arg === 'clear' || (arg === 'off' && !isValidThinkingLevel(current.backend, 'off'));
|
|
62
|
+
const result = await applyChannelSelection({ channel, thinking: clear ? null : arg, seedDefault: false });
|
|
63
|
+
const text = result.ok
|
|
64
|
+
? `${Icons.ok} ${t('cmd.thinking.set', { thinking: result.thinking ?? t('cmd.thinking.none') })}`
|
|
65
|
+
: `${Icons.error} ${t('cmd.thinking.invalid', { thinking: arg, backend: result.backend, levels: (result.allowed ?? []).join(', ') })}`;
|
|
66
|
+
await adapter.postMessage(destination(channel), { text });
|
|
161
67
|
}
|
|
162
|
-
function modelStatusText(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
167
|
-
: t('cmd.model.current', { model: config.profile.model, profile: config.profileName });
|
|
68
|
+
function modelStatusText(channel) {
|
|
69
|
+
const current = t('cmd.model.current', { model: selectionText(resolveRunSelection({ channel })) });
|
|
70
|
+
const favorites = listFavorites().map(ref => `• ${selectionText(selectionForModel(ref))}`);
|
|
71
|
+
return [current, ...favorites].join('\n');
|
|
168
72
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
: t('cmd.model.noOverride', vars);
|
|
73
|
+
function modelButtons(channel) {
|
|
74
|
+
return listFavorites().slice(0, 10).map((ref, index) => ({
|
|
75
|
+
type: 'button', text: ref.model, actionId: `cmd:model:set-${index}`,
|
|
76
|
+
value: JSON.stringify({ ref, channel }),
|
|
77
|
+
}));
|
|
175
78
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const res = await switchChannelProfile({ channel, name });
|
|
183
|
-
if (res.ok) {
|
|
184
|
-
return `${Icons.ok} ${t('cmd.profile.channelSet', { name })}\n${formatProfileList(channel)}`;
|
|
79
|
+
async function modelArgumentReply(channel, arg) {
|
|
80
|
+
try {
|
|
81
|
+
const selection = arg === 'reset'
|
|
82
|
+
? getDefaultSelection()
|
|
83
|
+
: selectionForModel(resolveModelRef(arg, resolveRunSelection({ channel }).backend));
|
|
84
|
+
return await selectReply(channel, selection);
|
|
185
85
|
}
|
|
186
|
-
|
|
187
|
-
return `${Icons.error} ${
|
|
86
|
+
catch (error) {
|
|
87
|
+
return `${Icons.error} ${error.message}`;
|
|
188
88
|
}
|
|
189
|
-
return `${Icons.error} ${t('notice.profile.unknown', { name })}`;
|
|
190
|
-
}
|
|
191
|
-
function buildProfileText(channel) {
|
|
192
|
-
const effective = getActiveProfile(channel) || getDefaultProfileName();
|
|
193
|
-
const globalProfile = getActiveProfile() || getDefaultProfileName();
|
|
194
|
-
const isOverridden = channel && effective !== globalProfile;
|
|
195
|
-
const header = isOverridden
|
|
196
|
-
? t('cmd.profile.channelHeader', { effective, global: globalProfile })
|
|
197
|
-
: t('cmd.profile.activeHeader', { effective });
|
|
198
|
-
return `${header}\n${formatProfileList(channel)}`;
|
|
199
89
|
}
|
|
200
|
-
function
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
text:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}));
|
|
90
|
+
export async function handleModelCmd(channel, adapter, message) {
|
|
91
|
+
const arg = message.split(/\s+/).slice(1).join(' ').trim();
|
|
92
|
+
const text = arg ? await modelArgumentReply(channel, arg) : modelStatusText(channel);
|
|
93
|
+
const richBlocks = arg ? undefined : [
|
|
94
|
+
{ type: 'section', text }, { type: 'actions', elements: modelButtons(channel) },
|
|
95
|
+
];
|
|
96
|
+
await adapter.postMessage(destination(channel), { text, richBlocks });
|
|
208
97
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (ctx.messageRef) {
|
|
219
|
-
await adapter.updateMessage(ctx.messageRef, {
|
|
220
|
-
text,
|
|
221
|
-
richBlocks: [
|
|
222
|
-
{ type: 'section', text },
|
|
223
|
-
{ type: 'actions', elements: buildProfileButtons(channel) },
|
|
224
|
-
],
|
|
225
|
-
}).catch(() => { });
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
if (ctx.messageRef) {
|
|
230
|
-
await adapter.updateMessage(ctx.messageRef, {
|
|
231
|
-
text: `${Icons.error} ${error.message}`,
|
|
232
|
-
}).catch(() => { });
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
router.registerCommand('profile', {
|
|
237
|
-
actions: Array.from({ length: MAX_PROFILE_BUTTONS }, (_, i) => ({
|
|
238
|
-
actionId: `set-${i}`,
|
|
239
|
-
handler: setHandler,
|
|
240
|
-
})),
|
|
98
|
+
async function pickFavorite(router, ctx) {
|
|
99
|
+
const adapter = router.getAdapter();
|
|
100
|
+
if (!adapter || !ctx.messageRef)
|
|
101
|
+
return;
|
|
102
|
+
try {
|
|
103
|
+
const { ref, channel } = JSON.parse(ctx.value);
|
|
104
|
+
const text = await selectReply(channel, selectionForModel(ref));
|
|
105
|
+
await adapter.updateMessage(ctx.messageRef, {
|
|
106
|
+
text, richBlocks: [{ type: 'section', text }, { type: 'actions', elements: modelButtons(channel) }],
|
|
241
107
|
});
|
|
242
108
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
await adapter.postMessage(dest, { text: `${Icons.error} ${t('cmd.profile.globalUsage')}` });
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const profileName = args[1];
|
|
260
|
-
try {
|
|
261
|
-
resolveProfile(profileName);
|
|
262
|
-
setActiveProfile(profileName);
|
|
263
|
-
await adapter.postMessage(dest, { text: `${Icons.ok} ${t('cmd.profile.globalSet', { name: profileName })}\n${formatProfileList(channel)}` });
|
|
264
|
-
await handleNewCmd(channel, adapter, { skipHook: true });
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
await adapter.postMessage(dest, { text: `${Icons.error} ${error.message}` });
|
|
268
|
-
}
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
const profileName = args[0];
|
|
272
|
-
try {
|
|
273
|
-
const text = await switchChannelProfileReply(channel, profileName);
|
|
274
|
-
await adapter.postMessage(dest, { text });
|
|
275
|
-
}
|
|
276
|
-
catch (error) {
|
|
277
|
-
await adapter.postMessage(dest, { text: `${Icons.error} ${error.message}` });
|
|
278
|
-
}
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const text = buildProfileText(channel);
|
|
282
|
-
if (!router) {
|
|
283
|
-
await adapter.postMessage(dest, { text });
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
return {
|
|
287
|
-
text,
|
|
288
|
-
richBlocks: [{ type: 'section', text }],
|
|
289
|
-
actions: buildProfileButtons(channel),
|
|
290
|
-
};
|
|
109
|
+
catch (error) {
|
|
110
|
+
await adapter.updateMessage(ctx.messageRef, { text: `${Icons.error} ${error.message}` }).catch(() => { });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export function createModelHandler(router) {
|
|
114
|
+
router?.registerCommand('model', {
|
|
115
|
+
actions: Array.from({ length: 10 }, (_, i) => ({ actionId: `set-${i}`, handler: (ctx) => pickFavorite(router, ctx) })),
|
|
116
|
+
});
|
|
117
|
+
return async (channel, adapter, message) => {
|
|
118
|
+
if (message.trim() !== '!model' || !router)
|
|
119
|
+
return handleModelCmd(channel, adapter, message);
|
|
120
|
+
const text = modelStatusText(channel);
|
|
121
|
+
return { text, richBlocks: [{ type: 'section', text }], actions: modelButtons(channel) };
|
|
291
122
|
};
|
|
292
123
|
}
|
|
293
124
|
async function channelPluginDirs(channel) {
|
|
@@ -314,11 +145,11 @@ export async function handleSkillsCmd(channel, adapter) {
|
|
|
314
145
|
await adapter.postMessage(dest, { text: lines.join('\n') });
|
|
315
146
|
}
|
|
316
147
|
const MAX_AGENT_BUTTONS = 10;
|
|
317
|
-
/**
|
|
148
|
+
/** The environment an agent runs under. */
|
|
318
149
|
function agentDetail(name) {
|
|
319
150
|
const agentDef = getEnvironment(name);
|
|
320
151
|
const claudeAgentStr = agentDef?.claudeAgent ? ` · agent:${agentDef.claudeAgent}` : '';
|
|
321
|
-
return `${
|
|
152
|
+
return `${name}${claudeAgentStr}`;
|
|
322
153
|
}
|
|
323
154
|
/**
|
|
324
155
|
* What `!agent` reports: this conversation's agent, the global default it would fall back to, and
|
|
@@ -369,11 +200,6 @@ async function switchChannelAgentReply(channel, name) {
|
|
|
369
200
|
// `res.ok === false` rather than `!res.ok`: this project compiles non-strict, where a boolean
|
|
370
201
|
// discriminant narrows only through an explicit comparison.
|
|
371
202
|
if (res.ok === false) {
|
|
372
|
-
if (res.reason === 'cross-backend-live-session') {
|
|
373
|
-
return `${Icons.error} ${t('cmd.agent.crossBackendBlocked', {
|
|
374
|
-
name, target: res.targetBackend ?? '?', current: res.currentBackend ?? '?',
|
|
375
|
-
})}`;
|
|
376
|
-
}
|
|
377
203
|
const available = listEnvironments().map(a => `\`${a.name}\``).join(', ');
|
|
378
204
|
return `${Icons.error} ${t('cmd.agent.unknown', { name, available })}`;
|
|
379
205
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isScheduleType, normalizeScheduleSpec, ScheduleSpecError, } from '../../../domain/scheduling/schedule-spec.js';
|
|
2
2
|
import { formatDuration } from '../../../core/format-duration.js';
|
|
3
|
-
import {
|
|
3
|
+
import { listFavorites } from '../../../domain/agents/models.js';
|
|
4
|
+
import { resolveScheduleSelection } from '../../../domain/scheduling/schedule-selection.js';
|
|
4
5
|
import { channelToProjectId } from '../../../store/schedule-repo.js';
|
|
5
6
|
import { Icons } from '../../../core/icons.js';
|
|
6
7
|
import { t } from '../../../core/i18n.js';
|
|
@@ -21,12 +22,12 @@ function formatTimeUntilCompact(ms) {
|
|
|
21
22
|
}
|
|
22
23
|
function formatTaskLine(task, now) {
|
|
23
24
|
const id = `\`${task.id}\``;
|
|
24
|
-
const
|
|
25
|
+
const model = task.selection ? ` · ${task.selection.backend} · ${task.selection.model}` : '';
|
|
25
26
|
const paused = task.isPaused ? ` · *${t('cmd.schedule.paused')}*` : '';
|
|
26
27
|
const nextMs = (task.nextRun || task.runAt || 0) - now;
|
|
27
28
|
const next = task.isPaused ? '' : ` · ${t('cmd.schedule.nextLabel')}: ${formatTimeUntilCompact(nextMs)}`;
|
|
28
29
|
const msg = task.message.length > 40 ? task.message.slice(0, 37) + '...' : task.message;
|
|
29
|
-
return `${id} ${task.type}${
|
|
30
|
+
return `${id} ${task.type}${model}${paused}${next} · "${msg}"`;
|
|
30
31
|
}
|
|
31
32
|
function taskButton(task, index) {
|
|
32
33
|
if (task.type === 'once') {
|
|
@@ -79,12 +80,12 @@ const FMT_OPTS = { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-d
|
|
|
79
80
|
const fmtTime = (ts) => new Date(ts).toLocaleString('en-US', FMT_OPTS);
|
|
80
81
|
const WEEKDAY_LABELS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
81
82
|
function scheduleHelp() {
|
|
82
|
-
const
|
|
83
|
+
const modelNames = listFavorites().map(({ provider, model }) => `\`${provider ? `${provider}/` : ''}${model}\``).join(', ');
|
|
83
84
|
const keys = [
|
|
84
85
|
'schedule.help.title', 'schedule.help.addInterval', 'schedule.help.addDaily', 'schedule.help.addWeekly',
|
|
85
86
|
'schedule.help.addOnce', 'schedule.help.list', 'schedule.help.pause', 'schedule.help.resume', 'schedule.help.remove',
|
|
86
87
|
];
|
|
87
|
-
return [...keys.map((key) => t(key)), t('schedule.help.
|
|
88
|
+
return [...keys.map((key) => t(key)), t('schedule.help.availableModels', { modelNames })].join('\n');
|
|
88
89
|
}
|
|
89
90
|
function normalizeTaskId(id) {
|
|
90
91
|
const trimmed = id?.trim();
|
|
@@ -133,18 +134,27 @@ const SPEC_ERROR_TEXT = {
|
|
|
133
134
|
dayOfWeek: (day) => t('schedule.invalidDay', { day }),
|
|
134
135
|
};
|
|
135
136
|
function specErrorText(error, type) {
|
|
137
|
+
if (error.field === 'thinking')
|
|
138
|
+
return error.message;
|
|
136
139
|
const text = SPEC_ERROR_TEXT[error.field];
|
|
137
140
|
return text && error.value !== undefined ? text(String(error.value), type) : t(ADD_USAGE[type]);
|
|
138
141
|
}
|
|
139
|
-
/**
|
|
140
|
-
function
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
/** Leading model/thinking flags precede the free-form message; retired flags are rejected. */
|
|
143
|
+
function splitSelection(words) {
|
|
144
|
+
const flags = {};
|
|
145
|
+
let i = 0;
|
|
146
|
+
while (words[i]?.startsWith('--')) {
|
|
147
|
+
const flag = words[i];
|
|
148
|
+
if (flag !== '--model' && flag !== '--thinking') {
|
|
149
|
+
throw new Error(`Unknown option '${flag}'. Use --model [provider/]model [--thinking L].`);
|
|
150
|
+
}
|
|
151
|
+
const value = words[i + 1];
|
|
152
|
+
if (!value || value.startsWith('--'))
|
|
153
|
+
throw new Error(`Missing value for ${flag}.`);
|
|
154
|
+
flags[flag] = value;
|
|
155
|
+
i += 2;
|
|
156
|
+
}
|
|
157
|
+
return { selection: resolveScheduleSelection(flags['--model'], flags['--thinking']), message: words.slice(i).join(' ') };
|
|
148
158
|
}
|
|
149
159
|
const SCHEDULED_TEXT = {
|
|
150
160
|
interval: (s) => t('schedule.add.scheduledInterval', { duration: formatDuration(s.intervalMs), message: s.message }),
|
|
@@ -154,11 +164,11 @@ const SCHEDULED_TEXT = {
|
|
|
154
164
|
};
|
|
155
165
|
function scheduledText(spec, task) {
|
|
156
166
|
const summary = SCHEDULED_TEXT[spec.type](spec);
|
|
157
|
-
const
|
|
167
|
+
const model = task.selection ? `\nmodel: *${task.selection.backend} · ${task.selection.model}*` : '';
|
|
158
168
|
const firstRun = task.type === 'once' ? task.runAt : task.nextRun;
|
|
159
169
|
const label = task.type === 'once' ? 'runs at' : 'first run';
|
|
160
170
|
const when = firstRun ? ` | ${label}: ${fmtTime(firstRun)}` : '';
|
|
161
|
-
return `${Icons.ok} ${summary}\nid: \`${task.id}\`${
|
|
171
|
+
return `${Icons.ok} ${summary}\nid: \`${task.id}\`${model}${when}`;
|
|
162
172
|
}
|
|
163
173
|
const handleAdd = async ([type, ...words], { channel, scheduler }) => {
|
|
164
174
|
if (!type)
|
|
@@ -168,8 +178,9 @@ const handleAdd = async ([type, ...words], { channel, scheduler }) => {
|
|
|
168
178
|
const [arity, timing] = TIMING_ARGS[type];
|
|
169
179
|
let spec;
|
|
170
180
|
try {
|
|
171
|
-
|
|
172
|
-
|
|
181
|
+
spec = normalizeScheduleSpec({
|
|
182
|
+
type, ...timing(words.slice(0, arity)), ...splitSelection(words.slice(arity)), projectId: channelToProjectId(channel),
|
|
183
|
+
});
|
|
173
184
|
}
|
|
174
185
|
catch (error) {
|
|
175
186
|
return reply(error instanceof ScheduleSpecError ? specErrorText(error, type) : `${Icons.error} ${error.message}`);
|
|
@@ -2,7 +2,7 @@ import { createLogger } from '../../../core/log.js';
|
|
|
2
2
|
import { Icons } from '../../../core/icons.js';
|
|
3
3
|
import { t } from '../../../core/i18n.js';
|
|
4
4
|
import { formatTimeAgo } from './time-ago.js';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveRunSelection } from '../../../domain/runs/config-resolver.js';
|
|
6
6
|
import { engines } from '../../../domain/runs/engines.js';
|
|
7
7
|
import { fireAndForgetPreCloseHook, resolveOnNewThreadAnchor } from '../../../domain/sessions/session-hooks.js';
|
|
8
8
|
import { sessionStore } from '../../../store/session-registry-repo.js';
|
|
@@ -18,7 +18,7 @@ export async function handleNewCmd(channel, adapter, opts = {}, threadAnchorId)
|
|
|
18
18
|
void fireAndForgetPreCloseHook(channel, adapter, resolvedThreadTs);
|
|
19
19
|
}
|
|
20
20
|
void engines.close(channel);
|
|
21
|
-
const
|
|
21
|
+
const selection = resolveRunSelection({ channel });
|
|
22
22
|
await resetChannelSession(channel);
|
|
23
23
|
const cleared = planApprovals.clearByChannel(channel);
|
|
24
24
|
if (cleared > 0)
|
|
@@ -27,7 +27,7 @@ export async function handleNewCmd(channel, adapter, opts = {}, threadAnchorId)
|
|
|
27
27
|
// resolves (broadcasts session.interaction) instead of dangling.
|
|
28
28
|
void interactionRecords.resolvePendingByChannel(channel, 'cancelled', 'command');
|
|
29
29
|
log.info('New conversation started in channel:', channel);
|
|
30
|
-
await adapter.postMessage(dest, { text: t('cmd.session.newConversation', {
|
|
30
|
+
await adapter.postMessage(dest, { text: t('cmd.session.newConversation', { selection: `${selection.backend} · ${selection.model}` }) });
|
|
31
31
|
}
|
|
32
32
|
const MAX_RESUME_BUTTONS = 10;
|
|
33
33
|
/** Full ID wins; a prefix must be long enough and identify exactly one live record. */
|
|
@@ -61,11 +61,11 @@ export function createResumeHandler(router) {
|
|
|
61
61
|
}
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
await attachExistingSession(ctx.channelId, { sessionId: record.sessionId, backend: record.backend,
|
|
65
|
-
const
|
|
64
|
+
await attachExistingSession(ctx.channelId, { sessionId: record.sessionId, backend: record.backend, selection: record.selection });
|
|
65
|
+
const selectionNote = record.selection ? ` (${record.selection.backend} · ${record.selection.model})` : '';
|
|
66
66
|
if (ctx.messageRef) {
|
|
67
67
|
await adapter.updateMessage(ctx.messageRef, {
|
|
68
|
-
text: `${Icons.refresh} ${t('cmd.session.switched', { name: shortSessionId(record.sessionId),
|
|
68
|
+
text: `${Icons.refresh} ${t('cmd.session.switched', { name: shortSessionId(record.sessionId), selectionNote })}`,
|
|
69
69
|
}).catch(() => { });
|
|
70
70
|
}
|
|
71
71
|
};
|
|
@@ -91,9 +91,9 @@ export function createResumeHandler(router) {
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
const { record } = resolved;
|
|
94
|
-
await attachExistingSession(channel, { sessionId: record.sessionId, backend: record.backend,
|
|
95
|
-
const
|
|
96
|
-
await adapter.postMessage(dest, { text: `${Icons.refresh} ${t('cmd.session.switched', { name: shortSessionId(record.sessionId),
|
|
94
|
+
await attachExistingSession(channel, { sessionId: record.sessionId, backend: record.backend, selection: record.selection });
|
|
95
|
+
const selectionNote = record.selection ? ` (${record.selection.backend} · ${record.selection.model})` : '';
|
|
96
|
+
await adapter.postMessage(dest, { text: `${Icons.refresh} ${t('cmd.session.switched', { name: shortSessionId(record.sessionId), selectionNote })}` });
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
const sessions = await sessionStore.listRecentSessions(10);
|
|
@@ -58,7 +58,7 @@ function configHelpCategory() {
|
|
|
58
58
|
return {
|
|
59
59
|
label: t('cmd.help.catConfig'),
|
|
60
60
|
commands: [t('cmd.help.config.mode'), t('cmd.help.config.backend'),
|
|
61
|
-
t('cmd.help.config.model'), t('cmd.help.config.thinking'),
|
|
61
|
+
t('cmd.help.config.model'), t('cmd.help.config.thinking'),
|
|
62
62
|
t('cmd.help.config.agent'), t('cmd.help.config.skills')],
|
|
63
63
|
};
|
|
64
64
|
}
|
|
@@ -24,6 +24,9 @@ function formatEpoch(epochSeconds) {
|
|
|
24
24
|
export function windowLabel(window) {
|
|
25
25
|
if (window.type === 'model_scoped' && window.label)
|
|
26
26
|
return window.label;
|
|
27
|
+
if (window.type === 'seven_day_overage_included' && window.label) {
|
|
28
|
+
return t('cmd.usage.window.sevenDayModel', { model: window.label });
|
|
29
|
+
}
|
|
27
30
|
const key = WINDOW_LABEL_KEYS[window.type];
|
|
28
31
|
return key ? t(key) : window.label ?? window.type;
|
|
29
32
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from '../../core/log.js';
|
|
2
2
|
import { extractForwardedContent } from '../status-helpers.js';
|
|
3
|
+
import { countMessage, platformChannel } from '../../domain/telemetry/usage.js';
|
|
3
4
|
const log = createLogger('app');
|
|
4
5
|
import { orchestrator } from '../orchestrator.js';
|
|
5
6
|
const COMMAND_MENTION_TOKEN = /(^|\s+)(?:<@[^>\s]+>|@[^\s@]+)(?=\s|$)/g;
|
|
@@ -19,6 +20,7 @@ async function routeIncomingMessage(message, adapter, dispatchCommand) {
|
|
|
19
20
|
if (!userMessage && !hasFiles && !forwardedContent)
|
|
20
21
|
return;
|
|
21
22
|
const channel = message.ref.conduit;
|
|
23
|
+
countMessage(platformChannel(channel));
|
|
22
24
|
const threadAnchorId = message.ref.threadId || null;
|
|
23
25
|
const commandMessage = normalizeCommandMentions(userMessage?.trim());
|
|
24
26
|
if (dispatchCommand(commandMessage, channel, adapter, threadAnchorId))
|