@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,4 +1,5 @@
|
|
|
1
1
|
import { createLogger } from '../../core/log.js';
|
|
2
|
+
import { recordWebhookCall } from '../../domain/telemetry/usage.js';
|
|
2
3
|
import { getSettings } from '../../core/settings.js';
|
|
3
4
|
import { AUTH_HEADER, getWebhookToken, timingSafeEqualStr } from '../../core/auth.js';
|
|
4
5
|
import * as http from 'http';
|
|
@@ -17,6 +18,7 @@ import { getCurrentPlanFilePath } from '../../agent-adapter/claude/event-parser.
|
|
|
17
18
|
import { handleSubagentWebhook } from '../subagent-webhook.js';
|
|
18
19
|
import { handleTeamWebhook } from '../team-webhook.js';
|
|
19
20
|
import { handleBoardWebhook } from '../board-webhook.js';
|
|
21
|
+
import { handleBrowserWebhook } from '../browser-webhook.js';
|
|
20
22
|
import { handleBenchmarkSessionWebhook } from '../benchmark-session-webhook.js';
|
|
21
23
|
import { sendAgentFiles } from '../agent-file-send.js';
|
|
22
24
|
import { sendAgentView } from '../agent-view-send.js';
|
|
@@ -90,6 +92,7 @@ function jsonRoute(handler) {
|
|
|
90
92
|
res.end('Bad JSON');
|
|
91
93
|
return;
|
|
92
94
|
}
|
|
95
|
+
recordWebhookCall(req.url, data);
|
|
93
96
|
try {
|
|
94
97
|
await handler(data, res);
|
|
95
98
|
}
|
|
@@ -375,6 +378,9 @@ const POST_ROUTES = {
|
|
|
375
378
|
'/webhook/team': replyRoute(handleTeamWebhook),
|
|
376
379
|
// board_open and cortex_context's board field. Never touches board.html after the scaffold.
|
|
377
380
|
'/webhook/board': replyRoute((data) => handleBoardWebhook(data)),
|
|
381
|
+
// cortex-browser: `lease` starts or renews the session's browser and returns how to reach it;
|
|
382
|
+
// `report` follows each finished command so the UI shows the page it left behind.
|
|
383
|
+
'/webhook/browser': replyRoute((data) => handleBrowserWebhook(data)),
|
|
378
384
|
// Benchmark launcher: `start` returns once the session exists and its task is handed over;
|
|
379
385
|
// `status` is polled.
|
|
380
386
|
'/webhook/benchmark-session': replyRoute(handleBenchmarkSessionWebhook),
|
|
@@ -33,7 +33,6 @@ export interface CompactSessionDeps {
|
|
|
33
33
|
};
|
|
34
34
|
supports(session: {
|
|
35
35
|
backend: string;
|
|
36
|
-
profileName: string | null;
|
|
37
36
|
}): boolean;
|
|
38
37
|
/** Compact the session's live engine, which holds `backendSessionId`. */
|
|
39
38
|
compactAgent(session: Session, backendSessionId: string): Promise<AgentCompactResult>;
|
|
@@ -5,7 +5,6 @@ import { compactAgentContext, isSessionCompactionSupported } from '../domain/run
|
|
|
5
5
|
import { conduitQueues, enqueueAndWait } from './conduit-queue.js';
|
|
6
6
|
import { conversationEngineRequest } from './conversation-request.js';
|
|
7
7
|
import { publishSessionContextCompacted } from './session-events.js';
|
|
8
|
-
import { withTurnBrowser } from './turn/turn-prep.js';
|
|
9
8
|
const defaultDeps = {
|
|
10
9
|
sessions: sessionStore,
|
|
11
10
|
engineBusy: (session) => channelEngineBusy(session.channel, session.sessionId),
|
|
@@ -20,22 +19,21 @@ const defaultDeps = {
|
|
|
20
19
|
};
|
|
21
20
|
/**
|
|
22
21
|
* Compaction asks the pool for the session's engine exactly as the session's next turn would: the
|
|
23
|
-
* same request (agent,
|
|
24
|
-
*
|
|
25
|
-
* and leaving the next turn to respawn it again.
|
|
22
|
+
* same request (agent, selection, policy, route). Anything else is a different identity, and the pool
|
|
23
|
+
* would respawn the process — compacting a fresh one and leaving the next turn to respawn it again.
|
|
26
24
|
*/
|
|
27
25
|
function compactLiveEngine(session, backendSessionId) {
|
|
28
26
|
const { backend, channel } = session;
|
|
29
|
-
return
|
|
27
|
+
return compactAgentContext({
|
|
30
28
|
backend: backend,
|
|
31
29
|
request: conversationEngineRequest({
|
|
32
30
|
ids: {
|
|
33
31
|
sessionId: session.sessionId, backendSessionId,
|
|
34
32
|
projectId: session.projectId ?? 'general',
|
|
35
33
|
},
|
|
36
|
-
channel, session,
|
|
34
|
+
channel, session, trigger: 'manual-compact',
|
|
37
35
|
}),
|
|
38
|
-
})
|
|
36
|
+
});
|
|
39
37
|
}
|
|
40
38
|
function currentUsage(session) {
|
|
41
39
|
return session.contextUsage ?? null;
|
|
@@ -7,7 +7,7 @@ export interface SessionMessagePayload {
|
|
|
7
7
|
sessionId: string;
|
|
8
8
|
channel: string;
|
|
9
9
|
/** `worker-progress`: a team worker's interim reply, shown in its lead's chat (see `worker`). */
|
|
10
|
-
role: 'user' | 'assistant' | 'tool' | 'worker-progress';
|
|
10
|
+
role: 'user' | 'assistant' | 'thinking' | 'tool' | 'worker-progress';
|
|
11
11
|
text: string;
|
|
12
12
|
/** User messages only: Cortex authored this turn (resume signal, backgrounded agent result,
|
|
13
13
|
* waitpoint signal, team hand-off) rather than a human. Chat surfaces render it as a hint
|
|
@@ -102,6 +102,7 @@ export declare function publishSessionMessageDelta(p: {
|
|
|
102
102
|
text: string;
|
|
103
103
|
/** 0-based, per blockId; lets a client notice it missed one. */
|
|
104
104
|
seq: number;
|
|
105
|
+
kind?: 'thinking';
|
|
105
106
|
}): void;
|
|
106
107
|
/** Emit a `session.message.delivered` event: a message injected into a turn already in flight has
|
|
107
108
|
* now been consumed by the model (or its injection window closed without that happening). The
|
|
@@ -3,10 +3,6 @@ export { computeElapsed, formatMetricsSuffix, buildUserProcessingMessage, render
|
|
|
3
3
|
/** Feature gate: the "New (quiet)" status button (=!newq, skips the pre-close hook). */
|
|
4
4
|
export declare function isStatusNewqButtonEnabled(): boolean;
|
|
5
5
|
export declare function buildExecutionStatusReport(): string;
|
|
6
|
-
/** Report an attempt switch on the status message, from the already-rendered `model/mode` labels.
|
|
7
|
-
* The run layer reports a fallback as two labels (`RunEvent.run_fallback`); the callback below
|
|
8
|
-
* renders the same labels out of a pair of attempt configs. */
|
|
9
|
-
export declare function makeFallbackLabelNotifier(statusMsg: MessageRef | null, adapter: PlatformAdapter): (fromLabel: string, toLabel: string, reason: 'rate-limited' | 'transport-error') => Promise<void>;
|
|
10
6
|
/** Build a streaming callback that aggregates assistant messages via OutputStream. */
|
|
11
7
|
export declare function makeStreamingMessageCallback(adapter: PlatformAdapter, destination: Destination, threadAnchorId?: string | null, onMessagePosted?: ((ref: MessageRef) => void) | null, durable?: import('../platform/types.js').DurableHooks | null): ((text: string) => void) & {
|
|
12
8
|
stream: OutputStream;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createLogger } from '../core/log.js';
|
|
2
2
|
import { getSettings } from '../core/settings.js';
|
|
3
|
-
import { Icons } from '../core/icons.js';
|
|
4
3
|
import { t } from '../core/i18n.js';
|
|
5
4
|
import * as executionRegistry from '../domain/executions/registry.js';
|
|
6
5
|
import { durableUpdate, getOutboundQueue } from '../store/outbound-queue.js';
|
|
@@ -22,23 +21,6 @@ export function buildExecutionStatusReport() {
|
|
|
22
21
|
}
|
|
23
22
|
return lines.join('\n');
|
|
24
23
|
}
|
|
25
|
-
/** Report an attempt switch on the status message, from the already-rendered `model/mode` labels.
|
|
26
|
-
* The run layer reports a fallback as two labels (`RunEvent.run_fallback`); the callback below
|
|
27
|
-
* renders the same labels out of a pair of attempt configs. */
|
|
28
|
-
export function makeFallbackLabelNotifier(statusMsg, adapter) {
|
|
29
|
-
return async (fromLabel, toLabel, reason) => {
|
|
30
|
-
log.info(`Fallback (${reason}): ${fromLabel} \u2192 ${toLabel}`);
|
|
31
|
-
if (statusMsg) {
|
|
32
|
-
const key = reason === 'rate-limited' ? 'notice.fallback.rateLimited' : 'notice.fallback.transportError';
|
|
33
|
-
try {
|
|
34
|
-
await adapter.updateMessage(statusMsg, {
|
|
35
|
-
text: `${Icons.warning} ${t(key, { from: fromLabel, to: `*${toLabel}*` })}`,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
catch { }
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
24
|
/** Build a streaming callback that aggregates assistant messages via OutputStream. */
|
|
43
25
|
export function makeStreamingMessageCallback(adapter, destination, threadAnchorId = null, onMessagePosted = null, durable) {
|
|
44
26
|
const stream = adapter.openOutputStream(destination, { threadId: threadAnchorId, onMessagePosted, durable: durable ?? null });
|
|
@@ -1,47 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveProfileConfig } from '../domain/agents/profile-manager.js';
|
|
1
|
+
import { sessionStore } from '../store/session-registry-repo.js';
|
|
3
2
|
import { detachSubagentRun, stopSubagentRun, waitForSubagentRun, } from '../domain/agents/subagent/registry.js';
|
|
4
3
|
import { startDaemonSubagentRun } from '../domain/agents/subagent/service.js';
|
|
5
4
|
import { adoptForegroundRun, settleAdoptedRun } from './subagent-adopt.js';
|
|
6
5
|
import { backgroundNoticeSink, parentNoticeSink } from './subagent-attribution.js';
|
|
7
6
|
import { startBackgroundSubagentRun } from './subagent-delivery.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* The delegating session's own routing, reconstructed from what its MCP sidecar knows about it.
|
|
12
|
-
*
|
|
13
|
-
* The profile is read only to learn what the PARENT is running — it never selects the child, which
|
|
14
|
-
* takes its model from the task or the role. When there is no profile the daemon's current Claude
|
|
15
|
-
* model and mode stand in, which is the same pair an unprofiled turn would have used.
|
|
16
|
-
*/
|
|
17
|
-
function parentContextFor(data) {
|
|
7
|
+
import { resolveRunSelection } from '../domain/runs/config-resolver.js';
|
|
8
|
+
/** The parent's materialized choice supplies routing, not the child's task/role model. */
|
|
9
|
+
async function parentContextFor(data) {
|
|
18
10
|
const channel = typeof data.channel === 'string' ? data.channel : undefined;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const profile = resolveProfileSafely(data.profile) ?? channelDefault;
|
|
23
|
-
const backend = (profile.backend ?? data.backend);
|
|
11
|
+
const sessionId = typeof data.sessionId === 'string' ? data.sessionId : null;
|
|
12
|
+
const session = sessionId ? await sessionStore.getById(sessionId) : null;
|
|
13
|
+
const selection = resolveRunSelection({ channel, session, selection: data.selection });
|
|
24
14
|
return {
|
|
25
|
-
|
|
26
|
-
mode: profile.mode,
|
|
27
|
-
provider: profile.provider ?? null,
|
|
28
|
-
model: profile.model || null,
|
|
29
|
-
channel,
|
|
15
|
+
...selection, channel, sessionId,
|
|
30
16
|
project: typeof data.project === 'string' ? data.project : undefined,
|
|
31
17
|
env: process.env,
|
|
32
18
|
};
|
|
33
19
|
}
|
|
34
|
-
function resolveProfileSafely(name) {
|
|
35
|
-
if (typeof name !== 'string' || !name)
|
|
36
|
-
return null;
|
|
37
|
-
try {
|
|
38
|
-
return resolveProfileConfig(name);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
log.warn(`Subagent parent profile "${name}" could not be resolved: ${error.message}`);
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
20
|
function resultText(result) {
|
|
46
21
|
return result?.content?.map(block => block.text).join('\n') || '(no output)';
|
|
47
22
|
}
|
|
@@ -60,7 +35,7 @@ export async function handleSubagentWebhook(data) {
|
|
|
60
35
|
const sessionId = typeof data.sessionId === 'string' && data.sessionId ? data.sessionId : null;
|
|
61
36
|
try {
|
|
62
37
|
if (data.action === 'start') {
|
|
63
|
-
const parent = parentContextFor(data);
|
|
38
|
+
const parent = await parentContextFor(data);
|
|
64
39
|
const background = !!data.background;
|
|
65
40
|
const request = {
|
|
66
41
|
params: data.params,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Backend } from '../core/types/agent-types.js';
|
|
2
2
|
import { sessionStore } from '../store/session-registry-repo.js';
|
|
3
|
-
import {
|
|
3
|
+
import { applyChannelSelection } from '../domain/agents/index.js';
|
|
4
|
+
import type { EngineSelection } from '../domain/agents/engine-selection.js';
|
|
4
5
|
import { type DeliverToSessionOptions } from './session-gateway.js';
|
|
5
6
|
import { type InteractionRecords } from './interactions/interaction-records.js';
|
|
6
7
|
import { type WorkerView } from './team-state.js';
|
|
@@ -12,12 +13,12 @@ export interface TeamWebhookReply {
|
|
|
12
13
|
type Outcome = 'resolved' | 'already-resolved' | 'not-found';
|
|
13
14
|
export interface TeamWebhookDeps {
|
|
14
15
|
sessions: Pick<typeof sessionStore, 'getById' | 'listWorkers' | 'rename' | 'bindBoard'>;
|
|
15
|
-
/**
|
|
16
|
-
* again only records it on the session; it leaves the channel's selection as written. */
|
|
16
|
+
/** Create the worker with its materialized choice without moving the user's draft seed. */
|
|
17
17
|
createSession: (opts: {
|
|
18
18
|
projectId: string;
|
|
19
19
|
sessionId: string;
|
|
20
|
-
|
|
20
|
+
selection: EngineSelection;
|
|
21
|
+
seedDefault: false;
|
|
21
22
|
teamLeadId: string;
|
|
22
23
|
workerName: string;
|
|
23
24
|
workerBrief: string;
|
|
@@ -34,11 +35,9 @@ export interface TeamWebhookDeps {
|
|
|
34
35
|
}) => Promise<void>;
|
|
35
36
|
deliver: (opts: Pick<DeliverToSessionOptions, 'channel' | 'text' | 'origin'>) => void;
|
|
36
37
|
cancel: (channel: string) => Promise<number>;
|
|
37
|
-
readSelection: (channel: string) =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
providerProfile: (provider: string) => string | null;
|
|
41
|
-
applySelection: (request: ApplySelectionRequest) => Promise<ApplySelectionResult>;
|
|
38
|
+
readSelection: (channel: string) => EngineSelection;
|
|
39
|
+
defaultSelection: (backend: Backend) => EngineSelection | null;
|
|
40
|
+
applySelection: typeof applyChannelSelection;
|
|
42
41
|
interactions: Pick<InteractionRecords, 'get'>;
|
|
43
42
|
answerQuestion: (requestId: string, answers: Record<string, string>) => Outcome;
|
|
44
43
|
/** The question texts of a pending ask, or null when it has no live group. */
|
|
@@ -8,7 +8,7 @@ import { setSessionAsync } from '../domain/sessions/session.js';
|
|
|
8
8
|
import { isTeamLead, isTeamWorker, MAX_RUNNING_WORKERS, WORKER_NAME_RE } from '../domain/sessions/team.js';
|
|
9
9
|
import { sessionState } from '../core/session-state.js';
|
|
10
10
|
import { applyChannelSelection, readChannelSelection, resolveBackendForChannel, } from '../domain/agents/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { getDefaultSelectionForBackend, resolveModelRef } from '../domain/agents/models.js';
|
|
12
12
|
import { parseModelSpec } from '../core/agents/subagent/model-spec.js';
|
|
13
13
|
import { isRebuildHeld } from '../domain/system/rebuild-hold.js';
|
|
14
14
|
import { deliverToSessionDetached } from './session-gateway.js';
|
|
@@ -40,8 +40,7 @@ const defaultDeps = {
|
|
|
40
40
|
deliver: (opts) => deliverToSessionDetached(opts),
|
|
41
41
|
cancel: (channel) => cancelChannelRuns(channel),
|
|
42
42
|
readSelection: (channel) => readChannelSelection(channel),
|
|
43
|
-
|
|
44
|
-
providerProfile: (provider) => findProfileForProvider('pi', provider)?.name ?? null,
|
|
43
|
+
defaultSelection: getDefaultSelectionForBackend,
|
|
45
44
|
applySelection: (request) => applyChannelSelection(request),
|
|
46
45
|
interactions: interactionRecords,
|
|
47
46
|
answerQuestion: (requestId, answers) => answerQuestion(requestId, answers, 'agent'),
|
|
@@ -93,51 +92,25 @@ function refuseWhileRestarting(deps, what) {
|
|
|
93
92
|
function capError() {
|
|
94
93
|
return new TeamError(`${MAX_RUNNING_WORKERS} workers are already running; wait for a report or stop one (worker_stop) first`);
|
|
95
94
|
}
|
|
96
|
-
/**
|
|
97
|
-
* What a new worker runs: the lead's own profile and selection, unless the call names a backend or
|
|
98
|
-
* model. `model` is the `agent` tool's `provider/model[:thinking]`; a field it gives replaces the
|
|
99
|
-
* lead's, a field it omits keeps it. Another backend starts from that backend's default profile,
|
|
100
|
-
* since none of the lead's choices mean anything there.
|
|
101
|
-
*/
|
|
95
|
+
/** Copy the lead's exact choice; another backend starts from its default or first favorite. */
|
|
102
96
|
function resolveWorkerSelection(lead, data, deps) {
|
|
103
|
-
const own = deps.readSelection(lead.channel);
|
|
97
|
+
const own = lead.selection ?? deps.readSelection(lead.channel);
|
|
104
98
|
const requested = str(data.backend);
|
|
105
99
|
if (requested && requested !== 'claude' && requested !== 'pi') {
|
|
106
100
|
throw new TeamError('backend must be "claude" or "pi"');
|
|
107
101
|
}
|
|
108
|
-
const backend = requested || own.backend;
|
|
109
102
|
const spec = parseModelSpec(str(data.model) || undefined);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
if (sibling) {
|
|
118
|
-
return { profileName: sibling, model: spec.model ?? null, provider: null, thinking: spec.thinking ?? null, mode: null };
|
|
119
|
-
}
|
|
120
|
-
if (backend === own.backend) {
|
|
121
|
-
const base = own.override ?? {};
|
|
122
|
-
// A route belongs to its provider's endpoint, so it does not survive a move to another one.
|
|
123
|
-
const movesProvider = spec.provider !== undefined && spec.provider !== own.provider;
|
|
124
|
-
return {
|
|
125
|
-
profileName: own.profileName,
|
|
126
|
-
model: spec.model ?? base.model ?? null,
|
|
127
|
-
provider: spec.provider ?? base.provider ?? null,
|
|
128
|
-
thinking: spec.thinking ?? base.thinking ?? null,
|
|
129
|
-
mode: movesProvider ? null : base.mode ?? null,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
const profileName = deps.defaultProfile(backend);
|
|
133
|
-
if (!profileName)
|
|
134
|
-
throw new TeamError(`no profile is configured for the ${backend} backend`);
|
|
103
|
+
const backend = requested || (spec.provider ? 'pi' : own.backend);
|
|
104
|
+
const base = backend === own.backend ? own : deps.defaultSelection(backend);
|
|
105
|
+
if (!base)
|
|
106
|
+
throw new TeamError(`no default or favorite for the ${backend} backend; favorite a model first`);
|
|
107
|
+
const ref = spec.model ? resolveModelRef(spec.provider && backend === 'pi'
|
|
108
|
+
? `${spec.provider}/${spec.model}` : spec.model, backend) : base;
|
|
109
|
+
const provider = backend === 'pi' ? (spec.provider ?? (backend === own.backend ? own.provider : ref.provider)) : null;
|
|
135
110
|
return {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
thinking: spec.thinking ?? null,
|
|
140
|
-
mode: null,
|
|
111
|
+
...base, backend, provider, model: ref.model,
|
|
112
|
+
thinking: spec.thinking ?? base.thinking,
|
|
113
|
+
mode: backend === 'pi' && provider !== base.provider ? provider ?? base.mode : base.mode,
|
|
141
114
|
};
|
|
142
115
|
}
|
|
143
116
|
async function spawn(lead, data, deps) {
|
|
@@ -167,7 +140,8 @@ async function spawn(lead, data, deps) {
|
|
|
167
140
|
const created = await deps.createSession({
|
|
168
141
|
projectId: lead.projectId,
|
|
169
142
|
sessionId,
|
|
170
|
-
|
|
143
|
+
selection: { backend: applied.backend, provider: applied.provider, model: applied.model, thinking: applied.thinking, mode: applied.mode },
|
|
144
|
+
seedDefault: false,
|
|
171
145
|
teamLeadId: lead.sessionId,
|
|
172
146
|
workerName: name,
|
|
173
147
|
workerBrief: briefOf(prompt),
|
|
@@ -33,11 +33,23 @@ export interface TranscriptSinkDeps extends ToolImageDeps {
|
|
|
33
33
|
appendToolResult: (sessionId: string, opts: Parameters<typeof conversationHistory.appendToolResult>[1]) => Promise<void>;
|
|
34
34
|
appendSubagentEnd: (sessionId: string, opts: Parameters<typeof conversationHistory.appendSubagentEnd>[1]) => Promise<void>;
|
|
35
35
|
appendAssistant: (sessionId: string, opts: Parameters<typeof conversationHistory.appendAssistant>[1]) => Promise<void>;
|
|
36
|
+
appendThinking: (sessionId: string, opts: Parameters<typeof conversationHistory.appendThinking>[1]) => Promise<void>;
|
|
37
|
+
appendUser: (sessionId: string, opts: Parameters<typeof conversationHistory.appendUser>[1]) => Promise<void>;
|
|
38
|
+
/** Open a ledger turn beside a system turn's history row: rewind maps the two by position. */
|
|
39
|
+
beginLedgerTurn: (channel: string, opts: {
|
|
40
|
+
userMessageTs: string;
|
|
41
|
+
userMessageText: string;
|
|
42
|
+
}) => Promise<void>;
|
|
36
43
|
setTodos: (sessionId: string, snapshot: TodoSnapshot) => void;
|
|
37
44
|
publishMessage: typeof publishSessionMessage;
|
|
38
45
|
publishTodos: typeof publishSessionTodos;
|
|
39
46
|
publishDebugUpdated: typeof publishSessionDebugUpdated;
|
|
40
47
|
persistContextUsage: typeof persistSessionContextUsage;
|
|
48
|
+
snapshotMedia: (message: {
|
|
49
|
+
sessionId: string;
|
|
50
|
+
ts: string;
|
|
51
|
+
text: string;
|
|
52
|
+
}) => void;
|
|
41
53
|
/** The worker that raised a request a lead's `worker_answer` names, when known. */
|
|
42
54
|
workerForRequest: (requestId: string) => string | null;
|
|
43
55
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createLogger } from '../core/log.js';
|
|
2
2
|
import { sessionTodos } from '../core/session-todos.js';
|
|
3
3
|
import { conversationHistory, summarizeToolInputForHistory, toolDeviceForHistory } from '../store/conversation-history-repo.js';
|
|
4
|
+
import { conversationLedger } from '../store/conversation-ledger-repo.js';
|
|
4
5
|
import { sessionStore } from '../store/session-registry-repo.js';
|
|
5
6
|
import { subagentSpawnFromAttribution, subagentSpawnsFromToolCall } from '../core/subagent-spawn.js';
|
|
6
7
|
import { teamActionFromToolCall } from '../core/team-action.js';
|
|
@@ -9,6 +10,7 @@ import { publishSessionContextUsage, publishSessionDebugUpdated, publishSessionM
|
|
|
9
10
|
import { subagentPayloadFields, subagentRowRef } from './subagent-rows.js';
|
|
10
11
|
import { writeToolImages } from '../store/tool-image-files.js';
|
|
11
12
|
import { workerNameForRequest } from './team-state.js';
|
|
13
|
+
import { eagerSnapshotInlineMedia } from './inline-media-eager.js';
|
|
12
14
|
const log = createLogger('transcript-sink');
|
|
13
15
|
const defaultContextUsagePersistence = {
|
|
14
16
|
now: () => new Date().toISOString(),
|
|
@@ -48,16 +50,23 @@ const DEFAULT_DEPS = {
|
|
|
48
50
|
appendToolResult: (sessionId, opts) => conversationHistory.appendToolResult(sessionId, opts),
|
|
49
51
|
appendSubagentEnd: (sessionId, opts) => conversationHistory.appendSubagentEnd(sessionId, opts),
|
|
50
52
|
appendAssistant: (sessionId, opts) => conversationHistory.appendAssistant(sessionId, opts),
|
|
53
|
+
appendThinking: (sessionId, opts) => conversationHistory.appendThinking(sessionId, opts),
|
|
54
|
+
appendUser: (sessionId, opts) => conversationHistory.appendUser(sessionId, opts),
|
|
55
|
+
beginLedgerTurn: async (channel, opts) => { await conversationLedger.beginTurn(channel, opts); },
|
|
51
56
|
setTodos: (sessionId, snapshot) => sessionTodos.set(sessionId, snapshot),
|
|
52
57
|
publishMessage: publishSessionMessage,
|
|
53
58
|
publishTodos: publishSessionTodos,
|
|
54
59
|
publishDebugUpdated: publishSessionDebugUpdated,
|
|
55
60
|
persistContextUsage: persistSessionContextUsage,
|
|
61
|
+
snapshotMedia: message => {
|
|
62
|
+
void eagerSnapshotInlineMedia(message).catch(error => log.warn('Inline media snapshot failed:', String(error)));
|
|
63
|
+
},
|
|
56
64
|
workerForRequest: (requestId) => workerNameForRequest(requestId),
|
|
57
65
|
};
|
|
58
66
|
/** The event kinds this sink writes as transcript rows (context usage is stored beside them). */
|
|
59
67
|
const ROW_EVENT_TYPES = new Set([
|
|
60
|
-
'assistant_text', 'tool_use', 'tool_result', 'todo_update', 'subagent_end', 'context_usage',
|
|
68
|
+
'assistant_text', 'assistant_thinking', 'tool_use', 'tool_result', 'todo_update', 'subagent_end', 'context_usage',
|
|
69
|
+
'background_wake',
|
|
61
70
|
]);
|
|
62
71
|
/** A background-phase event this sink would write: what a hold or the injection ledger forwards. */
|
|
63
72
|
export function isBackgroundRowEvent(event) {
|
|
@@ -140,6 +149,27 @@ export function createTranscriptSink(opts) {
|
|
|
140
149
|
subagentId: parentToolUseId, subagentEnded: status,
|
|
141
150
|
});
|
|
142
151
|
}
|
|
152
|
+
/** Finished background tasks woke the agent: a system turn, so the chat starts a new reply at it
|
|
153
|
+
* instead of folding the woken turn into the previous one. The history row is queued before
|
|
154
|
+
* anything the woken turn writes; a channel with no ledger simply has no rewind to keep aligned. */
|
|
155
|
+
function persistBackgroundWake(summaries) {
|
|
156
|
+
const ts = new Date().toISOString();
|
|
157
|
+
const text = summaries.join('\n');
|
|
158
|
+
recordHistory(deps.appendUser(sessionId, { text, ts, systemOrigin: 'background-task' }));
|
|
159
|
+
recordHistory(deps.beginLedgerTurn(channel, { userMessageTs: `bg-wake:${ts}`, userMessageText: text }));
|
|
160
|
+
deps.publishMessage({ sessionId, channel, role: 'user', text, ts, systemOrigin: 'background-task' });
|
|
161
|
+
}
|
|
162
|
+
function persistThinking(text, blockId) {
|
|
163
|
+
if (blockId)
|
|
164
|
+
opts.flushDelta?.(blockId);
|
|
165
|
+
if (!text)
|
|
166
|
+
return;
|
|
167
|
+
const ts = new Date().toISOString();
|
|
168
|
+
recordHistory(deps.appendThinking(sessionId, { text, ts, ...(blockId ? { blockId } : {}) }));
|
|
169
|
+
deps.publishMessage({
|
|
170
|
+
sessionId, channel, role: 'thinking', text, ts, ...(blockId ? { blockId } : {}),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
143
173
|
function persistAssistant(text, blockId, noticeLevel, noticeAction, subagent, phase) {
|
|
144
174
|
// Drain this block's preview FIRST: the authoritative message must never be overtaken by
|
|
145
175
|
// a delta still sitting in the coalescer, or the UI would replace the row and then append
|
|
@@ -165,7 +195,7 @@ export function createTranscriptSink(opts) {
|
|
|
165
195
|
text, ts, noticeLevel, noticeAction,
|
|
166
196
|
...(ref ? { subagent: ref } : {}),
|
|
167
197
|
...(attributedSpawn ? { subagentSpawns: [attributedSpawn] } : {}),
|
|
168
|
-
}));
|
|
198
|
+
}), () => deps.snapshotMedia({ sessionId, ts, text }));
|
|
169
199
|
deps.publishMessage({
|
|
170
200
|
sessionId, channel, role: 'assistant', text, ts,
|
|
171
201
|
...(blockId ? { blockId } : {}),
|
|
@@ -206,6 +236,12 @@ export function createTranscriptSink(opts) {
|
|
|
206
236
|
if (event.phase === 'foreground')
|
|
207
237
|
opts.onTodoUpdate?.(event.snapshot);
|
|
208
238
|
return;
|
|
239
|
+
case 'assistant_thinking':
|
|
240
|
+
persistThinking(event.text, event.blockId);
|
|
241
|
+
return;
|
|
242
|
+
case 'background_wake':
|
|
243
|
+
persistBackgroundWake(event.summaries);
|
|
244
|
+
return;
|
|
209
245
|
case 'assistant_text':
|
|
210
246
|
persistAssistant(event.text, event.blockId, event.noticeLevel, event.noticeAction, event.subagent, event.phase);
|
|
211
247
|
return;
|
|
@@ -7,10 +7,10 @@ import { sessionStore } from '../../store/session-registry-repo.js';
|
|
|
7
7
|
import { conversationLedger } from '../../store/conversation-ledger-repo.js';
|
|
8
8
|
import { runMessageEndForTurn } from '../../domain/sessions/session-hooks.js';
|
|
9
9
|
import * as askUserQuestion from '../interactions/ask-user-question.js';
|
|
10
|
-
import {
|
|
10
|
+
import { resolveRunSelection } from '../../domain/runs/config-resolver.js';
|
|
11
11
|
import { maybeNotifyTurnComplete } from '../turn-notify.js';
|
|
12
12
|
import { recordDirectResume } from '../../domain/runs/observers/resume-recorder.js';
|
|
13
|
-
import { isApiRateLimitError
|
|
13
|
+
import { isApiRateLimitError } from '../../domain/runs/retryable-errors.js';
|
|
14
14
|
import { isProviderRateLimited } from '../../domain/costs/rate-limit-throttle.js';
|
|
15
15
|
import { durablePost, getOutboundQueue } from '../../store/outbound-queue.js';
|
|
16
16
|
const log = createLogger('lifecycle');
|
|
@@ -95,9 +95,8 @@ export async function handleAgentError({ error, channel, adapter, statusMsg, sta
|
|
|
95
95
|
// edit-retry below). The execution record and the live-run registry were already closed by the
|
|
96
96
|
// run's own terminal handler (domain/runs/service); this handler owns the SURFACE. Only when a
|
|
97
97
|
// userMessage is available (direct/TUI turns) — edit callers without it fall through to the
|
|
98
|
-
// normal error path.
|
|
99
|
-
|
|
100
|
-
if (userMessage && !isNotRetriedFailure(error) && isApiRateLimitError(error.message)
|
|
98
|
+
// normal error path.
|
|
99
|
+
if (userMessage && isApiRateLimitError(error.message)
|
|
101
100
|
&& isProviderRateLimited(error.rateLimitProvider)) {
|
|
102
101
|
recordDirectResume({ provider: error.rateLimitProvider, channel, trackSessionId: sessionId, userMessage });
|
|
103
102
|
const rateLimitText = renderTurnStatus({ kind: 'rate-limited' }, { sessionId, elapsedStr });
|
|
@@ -157,7 +156,8 @@ export async function persistErrorSession(args) {
|
|
|
157
156
|
}
|
|
158
157
|
if (!trackSessionId)
|
|
159
158
|
return;
|
|
160
|
-
const
|
|
159
|
+
const selection = resolveRunSelection({ channel });
|
|
160
|
+
const backend = selection.backend;
|
|
161
161
|
await setSessionAsync(channel, trackSessionId);
|
|
162
162
|
// Backfill the ledger's session id: a conversation opened before the backend reported one.
|
|
163
163
|
const conv = await conversationLedger.getConversation(channel);
|
|
@@ -165,7 +165,7 @@ export async function persistErrorSession(args) {
|
|
|
165
165
|
await conversationLedger.updateSessionId(channel, trackSessionId);
|
|
166
166
|
const existing = await sessionStore.getById(trackSessionId);
|
|
167
167
|
if (!existing) {
|
|
168
|
-
await sessionStore.registerSession({ sessionId: trackSessionId, channel, backend, kind: 'local', origin: 'direct',
|
|
168
|
+
await sessionStore.registerSession({ sessionId: trackSessionId, channel, backend, kind: 'local', origin: 'direct', selection, projectId: (await adapter.resolveInboundProject(channel)) ?? 'general' });
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
// --- The conversation path's terminal branch ---
|
|
@@ -31,11 +31,3 @@ export interface TurnFiles {
|
|
|
31
31
|
* Feishu-sent picture simply vanished from the transcript.
|
|
32
32
|
*/
|
|
33
33
|
export declare function collectTurnFiles(message: IncomingMessage, loadPlatformFiles: () => Promise<InboundFiles>): Promise<TurnFiles>;
|
|
34
|
-
/** Run one turn holding the browser its session opted into (`session.browser`), released when the
|
|
35
|
-
* turn is over. The turn receives the CDP endpoint, or null when it runs without one. */
|
|
36
|
-
export declare function withTurnBrowser<T>(args: {
|
|
37
|
-
backend: string;
|
|
38
|
-
browser: {
|
|
39
|
-
device: string;
|
|
40
|
-
} | null;
|
|
41
|
-
}, turn: (cdpEndpoint: string | null) => Promise<T>): Promise<T>;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { inboundAttachmentMeta } from '../attachments-store.js';
|
|
2
|
-
import { createLogger } from '../../core/log.js';
|
|
3
2
|
import { resolveWorkspaceRelPath } from '../../core/paths.js';
|
|
4
3
|
import { sessionStore } from '../../store/session-registry-repo.js';
|
|
5
4
|
import { acquireSessionUse } from '../../domain/sessions/session-use.js';
|
|
6
|
-
import { acquireBrowser, releaseBrowser, backendSupportsBrowser, BROWSER_DEVICE_SERVER } from '../../platform/browser/managed-browser.js';
|
|
7
|
-
import { acquireDeviceBrowser, releaseDeviceBrowser } from '../../domain/remote/device-browser.js';
|
|
8
|
-
const log = createLogger('turn-prep');
|
|
9
5
|
/** Take the session's use lease, or null when the record is gone / pending deletion. The lease is
|
|
10
6
|
* what stops retention from deleting a session out from under a turn that is still opening. */
|
|
11
7
|
export async function acquireSessionUseLease(sessionId) {
|
|
@@ -46,50 +42,3 @@ export async function collectTurnFiles(message, loadPlatformFiles) {
|
|
|
46
42
|
failures,
|
|
47
43
|
};
|
|
48
44
|
}
|
|
49
|
-
/**
|
|
50
|
-
* A browser-enabled session holds the shared Chrome for the duration of its turn. Acquiring outside
|
|
51
|
-
* the adapter keeps the spawn path synchronous and gives us one obvious place to pair with a
|
|
52
|
-
* release. A browser that cannot start degrades the turn to "no browser tools" instead of failing
|
|
53
|
-
* it — the session is still worth running.
|
|
54
|
-
*/
|
|
55
|
-
async function acquireTurnBrowser(args) {
|
|
56
|
-
const { backend, browser } = args;
|
|
57
|
-
if (!browser)
|
|
58
|
-
return { held: null, cdpEndpoint: null };
|
|
59
|
-
if (!backendSupportsBrowser(backend)) {
|
|
60
|
-
log.warn(`session opted into the browser but the ${backend} backend cannot use it — skipping`);
|
|
61
|
-
return { held: null, cdpEndpoint: null };
|
|
62
|
-
}
|
|
63
|
-
const device = browser.device;
|
|
64
|
-
try {
|
|
65
|
-
// `server` is this host's own Chrome; anything else is a Chrome the device launches for us,
|
|
66
|
-
// reachable only because the reverse channel maps its debugging port onto a local one. Both
|
|
67
|
-
// hand back a plain http://127.0.0.1:<port>, so nothing downstream knows the difference.
|
|
68
|
-
const cdpEndpoint = device === BROWSER_DEVICE_SERVER
|
|
69
|
-
? (await acquireBrowser()).cdpEndpoint
|
|
70
|
-
: (await acquireDeviceBrowser(device)).cdpEndpoint;
|
|
71
|
-
return { held: device, cdpEndpoint };
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
log.warn(`browser session requested on "${device}" but Chrome could not start: ${error.message}`);
|
|
75
|
-
return { held: null, cdpEndpoint: null };
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/** Release whatever {@link acquireTurnBrowser} took. No-op when it took nothing. */
|
|
79
|
-
function releaseTurnBrowser(held) {
|
|
80
|
-
if (held === BROWSER_DEVICE_SERVER)
|
|
81
|
-
releaseBrowser();
|
|
82
|
-
else if (held)
|
|
83
|
-
releaseDeviceBrowser(held);
|
|
84
|
-
}
|
|
85
|
-
/** Run one turn holding the browser its session opted into (`session.browser`), released when the
|
|
86
|
-
* turn is over. The turn receives the CDP endpoint, or null when it runs without one. */
|
|
87
|
-
export async function withTurnBrowser(args, turn) {
|
|
88
|
-
const browser = await acquireTurnBrowser(args);
|
|
89
|
-
try {
|
|
90
|
-
return await turn(browser.cdpEndpoint);
|
|
91
|
-
}
|
|
92
|
-
finally {
|
|
93
|
-
releaseTurnBrowser(browser.held);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TurnMutationRelease } from '../turn-mutation-lock.js';
|
|
2
2
|
import { conversationLedger } from '../../store/conversation-ledger-repo.js';
|
|
3
3
|
import * as sessionBackup from '../../domain/sessions/session-backup.js';
|
|
4
|
+
import type { EngineSelection } from '../../domain/agents/engine-selection.js';
|
|
4
5
|
interface TurnTrackingDeps {
|
|
5
|
-
|
|
6
|
-
getProfile(channel: string): string | null;
|
|
6
|
+
getSelection(channel: string, sessionId: string | null): EngineSelection | Promise<EngineSelection>;
|
|
7
7
|
ledger: Pick<typeof conversationLedger, 'initAndBeginTurn' | 'setBackupPath'>;
|
|
8
8
|
backup: Pick<typeof sessionBackup, 'findPISessionFile' | 'backupSessionFile' | 'createBackup'>;
|
|
9
9
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { acquireTurnMutationLock } from '../turn-mutation-lock.js';
|
|
2
2
|
import { conversationLedger } from '../../store/conversation-ledger-repo.js';
|
|
3
3
|
import * as sessionBackup from '../../domain/sessions/session-backup.js';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveRunSelection } from '../../domain/runs/config-resolver.js';
|
|
5
|
+
import { sessionStore } from '../../store/session-registry-repo.js';
|
|
5
6
|
const defaultTurnTrackingDeps = {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
getSelection: async (channel, sessionId) => resolveRunSelection({
|
|
8
|
+
channel, session: sessionId ? await sessionStore.getById(sessionId) : null,
|
|
9
|
+
}),
|
|
8
10
|
ledger: conversationLedger,
|
|
9
11
|
backup: sessionBackup,
|
|
10
12
|
};
|
|
@@ -53,10 +55,11 @@ async function runTurnTracking(args, options, token) {
|
|
|
53
55
|
const release = options.mutationRelease ?? await acquireTurnMutationLock(args.channel);
|
|
54
56
|
try {
|
|
55
57
|
const deps = options.deps ?? defaultTurnTrackingDeps;
|
|
56
|
-
const
|
|
58
|
+
const selection = await deps.getSelection(args.channel, args.trackSessionId);
|
|
59
|
+
const backend = selection.backend;
|
|
57
60
|
const { turnIndex } = await deps.ledger.initAndBeginTurn(args.channel, {
|
|
58
61
|
sessionId: args.trackSessionId || null, backend,
|
|
59
|
-
|
|
62
|
+
selection, userMessageTs: args.userMessageTs,
|
|
60
63
|
userMessageText: args.userMessageText || '', statusMessageTs: args.statusMessageTs,
|
|
61
64
|
});
|
|
62
65
|
const backupPath = await snapshotTurn(deps, backend, args.backendSessionId, turnIndex);
|