@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,80 +1,18 @@
|
|
|
1
|
-
//
|
|
2
|
-
// A run is not one call to a backend: a profile may name fallbacks, and each attempt can be
|
|
3
|
-
// skipped before it spawns (its provider/mode is already rate-limited) or retired after it
|
|
4
|
-
// returns (rate-limited result, transient error). This module owns that sequence and nothing
|
|
5
|
-
// else — no events, no notices, no process. `AgentRun` walks the plan; `notices.ts` narrates it.
|
|
6
|
-
import { isThrottled } from '../costs/rate-limit-throttle.js';
|
|
7
|
-
import { resolveProfileConfig } from '../agents/profile-manager.js';
|
|
8
1
|
import { configIsRateLimited, resolveRateLimitProvider } from '../agents/provider-run-lifecycle.js';
|
|
9
2
|
export { configIsRateLimited, rateLimitedResult, resolveRateLimitProvider } from '../agents/provider-run-lifecycle.js';
|
|
10
3
|
export { isRetryableError, isRetryableResult } from './retryable-errors.js';
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* The head is the profile's own engine selection with `name`/`fallback` dropped — a profile IS its
|
|
15
|
-
* first attempt, which is why `ResolvedProfileConfig` extends {@link RunAttemptConfig}. Building
|
|
16
|
-
* the list here (rather than at each caller) is what makes "attempt index" a meaningful number.
|
|
17
|
-
*/
|
|
18
|
-
export function planAttempts(profile) {
|
|
19
|
-
const head = {
|
|
20
|
-
model: profile.model,
|
|
21
|
-
backend: profile.backend,
|
|
22
|
-
mode: profile.mode,
|
|
23
|
-
provider: profile.provider,
|
|
24
|
-
extraEnv: profile.extraEnv,
|
|
25
|
-
extraOption: profile.extraOption,
|
|
26
|
-
thinking: profile.thinking,
|
|
27
|
-
maxOutputTokens: profile.maxOutputTokens,
|
|
28
|
-
};
|
|
29
|
-
return [head, ...(profile.fallback ?? [])];
|
|
4
|
+
/** A person waiting on a run bypasses cached throttle state. */
|
|
5
|
+
export function shouldSkipAttempt(selection, opts) {
|
|
6
|
+
return configIsRateLimited(selection) && !opts.isUserInitiated;
|
|
30
7
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export function attemptLabel(attempt) {
|
|
34
|
-
return `${attempt.model}/${attempt.mode || 'default'}`;
|
|
8
|
+
export function attemptProvider(selection) {
|
|
9
|
+
return resolveRateLimitProvider(selection);
|
|
35
10
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* decline to claim work instead of spawning a backend that will only come back 429.
|
|
39
|
-
* Cheap-exits on the global throttle flag: with nothing throttled there is nothing to check.
|
|
40
|
-
*/
|
|
41
|
-
export function allConfigsRateLimited(profileName) {
|
|
42
|
-
if (!isThrottled())
|
|
43
|
-
return false;
|
|
44
|
-
try {
|
|
45
|
-
return planAttempts(resolveProfileConfig(profileName)).every(configIsRateLimited);
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Whether this attempt should be skipped without spawning. A user-initiated run always spawns:
|
|
53
|
-
* the person is waiting, and a stale throttle entry must not silently swallow their turn.
|
|
54
|
-
*/
|
|
55
|
-
export function shouldSkipAttempt(attempt, opts) {
|
|
56
|
-
return configIsRateLimited(attempt) && !opts.isUserInitiated;
|
|
57
|
-
}
|
|
58
|
-
/** The provider an attempt's rate-limit windows and cost rows are attributed to. */
|
|
59
|
-
export function attemptProvider(attempt) {
|
|
60
|
-
return resolveRateLimitProvider(attempt);
|
|
61
|
-
}
|
|
62
|
-
/** The credential an attempt ran on: Claude's `api` mode uses the API key and its other modes the
|
|
63
|
-
* subscription. A PI provider's credential type is not visible from the attempt. */
|
|
64
|
-
export function attemptAuthType(attempt) {
|
|
65
|
-
if (attempt.backend !== 'claude')
|
|
11
|
+
export function attemptAuthType(selection) {
|
|
12
|
+
if (selection.backend !== 'claude')
|
|
66
13
|
return null;
|
|
67
|
-
return
|
|
14
|
+
return selection.mode === 'api' ? 'api_key' : 'oauth';
|
|
68
15
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* selection at all.
|
|
72
|
-
*
|
|
73
|
-
* An unknown profile name deliberately resolves to a synthetic config with an empty model
|
|
74
|
-
* (`config-resolver.syntheticProfile`) so the execution record can be opened with a truthful
|
|
75
|
-
* backend and the run itself rejects the name. Attributing that attempt's failure to a provider
|
|
76
|
-
* would open an outage window against a provider that was never called.
|
|
77
|
-
*/
|
|
78
|
-
export function attemptProviderOrNull(attempt) {
|
|
79
|
-
return attempt.model ? resolveRateLimitProvider(attempt) : null;
|
|
16
|
+
export function attemptProviderOrNull(selection) {
|
|
17
|
+
return selection.model ? resolveRateLimitProvider(selection) : null;
|
|
80
18
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { AgentResult, ChatNoticeLevel, NoticeAction } from '../../core/types/agent-types.js';
|
|
2
2
|
import type { ToolUseSubagent } from '../../agent-adapter/normalize/event-types.js';
|
|
3
|
-
import type { RunAttemptConfig } from '../agents/profile-manager.js';
|
|
4
|
-
import { type FallbackReason } from './retryable-errors.js';
|
|
5
3
|
/** `API Error:` prose is the backend reporting its own failure, not the agent talking. */
|
|
6
4
|
export declare function assistantNoticeLevel(text: string): ChatNoticeLevel | undefined;
|
|
7
5
|
/** A backend's own error text is already user-facing; anything else gets the generic wrapper. */
|
|
@@ -19,8 +17,7 @@ export interface NoticeContext {
|
|
|
19
17
|
export type NoticeEmit = (text: string, blockId?: string, level?: ChatNoticeLevel, action?: NoticeAction, subagent?: ToolUseSubagent) => void;
|
|
20
18
|
/**
|
|
21
19
|
* Tracks error notices within one attempt so terminal handling is durable but not noisy: an
|
|
22
|
-
* attempt that already showed an error card does not get a second one
|
|
23
|
-
* fresh dedupe window so the new provider's failure is not hidden by the old provider's notice.
|
|
20
|
+
* attempt that already showed an error card does not get a second one.
|
|
24
21
|
*/
|
|
25
22
|
export declare class AttemptNoticeTracker {
|
|
26
23
|
private readonly ctx;
|
|
@@ -42,13 +39,6 @@ export declare class AttemptNoticeTracker {
|
|
|
42
39
|
settleSuccess(): void;
|
|
43
40
|
private emitTerminal;
|
|
44
41
|
private emitAutoResume;
|
|
45
|
-
/** This attempt is over and another one follows: its held card is now terminal for that
|
|
46
|
-
* provider, and the next attempt starts with a clean dedupe window. */
|
|
47
|
-
transitionToFallback(current: Pick<RunAttemptConfig, 'model' | 'mode'>, next: Pick<RunAttemptConfig, 'model' | 'mode'>, reason: FallbackReason): void;
|
|
48
42
|
emitTerminalError(error: unknown): void;
|
|
49
|
-
/** A failure the chain chose not to retry is told as is: its message already carries the
|
|
50
|
-
* provider's own error and says why nothing was retried, so neither a held card nor an earlier
|
|
51
|
-
* error line (which say less) stands in for it, and a rate limit in it is not auto-resumed. */
|
|
52
|
-
private emitNotRetried;
|
|
53
43
|
emitTerminalRateLimit(result: AgentResult): void;
|
|
54
44
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Two jobs, both about narration rather than execution:
|
|
3
3
|
//
|
|
4
4
|
// 1. Classify assistant prose the backend emits (`API Error:` → an error notice).
|
|
5
|
-
// 2. Synthesize lines the backend never sends: "
|
|
5
|
+
// 2. Synthesize lines the backend never sends: "context compacted",
|
|
6
6
|
// "rate-limited, will auto-resume".
|
|
7
7
|
//
|
|
8
8
|
// The subtle part is a HELD rate-limit card. A backend surfaces a 429 as an assistant message
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
// pause the resume registry already owns (show the auto-resume warning instead). So this sits in
|
|
11
11
|
// the event path and can swallow a line, not beside it as a passive observer.
|
|
12
12
|
import { t } from '../../core/i18n.js';
|
|
13
|
-
import { isApiRateLimitError
|
|
13
|
+
import { isApiRateLimitError } from './retryable-errors.js';
|
|
14
14
|
import { isProviderRateLimited } from '../costs/rate-limit-throttle.js';
|
|
15
|
-
import { attemptLabel } from './fallback.js';
|
|
16
15
|
/** `API Error:` prose is the backend reporting its own failure, not the agent talking. */
|
|
17
16
|
export function assistantNoticeLevel(text) {
|
|
18
17
|
return text.startsWith('API Error:') ? 'error' : undefined;
|
|
@@ -23,8 +22,7 @@ export function terminalErrorText(message) {
|
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* Tracks error notices within one attempt so terminal handling is durable but not noisy: an
|
|
26
|
-
* attempt that already showed an error card does not get a second one
|
|
27
|
-
* fresh dedupe window so the new provider's failure is not hidden by the old provider's notice.
|
|
25
|
+
* attempt that already showed an error card does not get a second one.
|
|
28
26
|
*/
|
|
29
27
|
export class AttemptNoticeTracker {
|
|
30
28
|
ctx;
|
|
@@ -86,17 +84,6 @@ export class AttemptNoticeTracker {
|
|
|
86
84
|
}
|
|
87
85
|
return true;
|
|
88
86
|
}
|
|
89
|
-
/** This attempt is over and another one follows: its held card is now terminal for that
|
|
90
|
-
* provider, and the next attempt starts with a clean dedupe window. */
|
|
91
|
-
transitionToFallback(current, next, reason) {
|
|
92
|
-
this.flushHeldError();
|
|
93
|
-
if (this.synthesize) {
|
|
94
|
-
const key = reason === 'rate-limited'
|
|
95
|
-
? 'notify.attemptFallback.rateLimited' : 'notify.attemptFallback.transportError';
|
|
96
|
-
this.observe(t(key, { from: attemptLabel(current), to: attemptLabel(next) }), undefined, 'warning');
|
|
97
|
-
}
|
|
98
|
-
this.attemptHasErrorNotice = false;
|
|
99
|
-
}
|
|
100
87
|
emitTerminalError(error) {
|
|
101
88
|
const value = error;
|
|
102
89
|
if (value?.cancelled)
|
|
@@ -104,26 +91,12 @@ export class AttemptNoticeTracker {
|
|
|
104
91
|
const message = typeof value?.message === 'string' && value.message.length > 0
|
|
105
92
|
? value.message
|
|
106
93
|
: String(error);
|
|
107
|
-
if (isNotRetriedFailure(error)) {
|
|
108
|
-
this.emitNotRetried(message);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
94
|
const resumableDirectError = this.ctx.trigger !== 'edit-retry'
|
|
112
95
|
&& isApiRateLimitError(message)
|
|
113
96
|
&& this.emitAutoResume(value?.rateLimitProvider);
|
|
114
97
|
if (!resumableDirectError)
|
|
115
98
|
this.emitTerminal(message);
|
|
116
99
|
}
|
|
117
|
-
/** A failure the chain chose not to retry is told as is: its message already carries the
|
|
118
|
-
* provider's own error and says why nothing was retried, so neither a held card nor an earlier
|
|
119
|
-
* error line (which say less) stands in for it, and a rate limit in it is not auto-resumed. */
|
|
120
|
-
emitNotRetried(message) {
|
|
121
|
-
this.heldError = null;
|
|
122
|
-
if (!this.synthesize || !this.emit)
|
|
123
|
-
return;
|
|
124
|
-
this.attemptHasErrorNotice = true;
|
|
125
|
-
this.emit(terminalErrorText(message), undefined, 'error');
|
|
126
|
-
}
|
|
127
100
|
emitTerminalRateLimit(result) {
|
|
128
101
|
if (this.emitAutoResume(result.rateLimitProvider))
|
|
129
102
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentProcessSpawner, McpComposition, UserMessage } from '../../agent-adapter/types.js';
|
|
2
2
|
import type { AgentResult } from '../../core/types/agent-types.js';
|
|
3
3
|
import type { ProductionBenchmarkEvidenceContext } from '../benchmark/benchmark-types.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { EngineSelection } from '../agents/engine-selection.js';
|
|
5
5
|
import type { RunEvent } from './events.js';
|
|
6
6
|
import type { AgentSpec } from './spec-loader.js';
|
|
7
7
|
/** Re-exported so `@domain/runs/request.js` stays the one import for the request contract; the
|
|
@@ -21,7 +21,9 @@ export interface RunRequest {
|
|
|
21
21
|
/** Pool key: session id, `thr:<id>:<slot>` or `<sessionId>::hook`. */
|
|
22
22
|
engineKey: string;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
selection: EngineSelection;
|
|
25
|
+
/** Benchmark-only output cap; ignored unless benchmark evidence is present and backend is PI. */
|
|
26
|
+
benchmarkMaxOutputTokens?: number;
|
|
25
27
|
spec: AgentSpec;
|
|
26
28
|
/** Working directory the engine runs in. Omitted (undefined) means the server's own cwd, which
|
|
27
29
|
* is what every surface except a subagent child wants. Mirrors `EngineSpec.cwd` (plan §3.3). */
|
|
@@ -65,7 +67,6 @@ export interface RunRequest {
|
|
|
65
67
|
settingSources?: string[];
|
|
66
68
|
mcpComposition: McpComposition;
|
|
67
69
|
mcpToolAllowlist?: string[];
|
|
68
|
-
browserCdpEndpoint?: string | null;
|
|
69
70
|
captureTranscripts: boolean;
|
|
70
71
|
};
|
|
71
72
|
/** Present only on a production benchmark session's runs: the trial facts each attempt is
|
|
@@ -3,16 +3,3 @@ export declare function isRetryableResult(result: {
|
|
|
3
3
|
rateLimited?: boolean;
|
|
4
4
|
} | null): boolean;
|
|
5
5
|
export declare function isRetryableError(error: Error | null | undefined): boolean;
|
|
6
|
-
/** Why a retryable outcome moves the chain on to a fallback. */
|
|
7
|
-
export type FallbackReason = 'rate-limited' | 'transport-error';
|
|
8
|
-
/** A retryable thrown failure is either the provider refusing on quota or the request failing on
|
|
9
|
-
* its way (connection reset, 5xx, timeout). Only call this on an `isRetryableError` failure. */
|
|
10
|
-
export declare function fallbackReasonOf(error: Error): FallbackReason;
|
|
11
|
-
/**
|
|
12
|
-
* A retryable failure the chain deliberately did not retry: the attempt had already started a tool
|
|
13
|
-
* call, and re-running the turn on a fallback would run that tool again. It ends the turn as a
|
|
14
|
-
* plain failure — no fallback, and no automatic resume either, which is what a rate-limit message
|
|
15
|
-
* would otherwise get. The message itself says what happened and asks the user to send again.
|
|
16
|
-
*/
|
|
17
|
-
export declare function notRetriedFailure(message: string): Error;
|
|
18
|
-
export declare function isNotRetriedFailure(error: unknown): boolean;
|
|
@@ -11,6 +11,7 @@ const PERMANENT_PROVIDER_ERROR = /(?:invalid[_ ]request|forbidden|not found|requ
|
|
|
11
11
|
const TRANSIENT_HTTP_STATUS = /(?:^(?:error\s*)?(?:408|500|502|503|504)\b|\bhttp(?: status)?\s*[:=]?\s*(?:408|500|502|503|504)\b|\bstatus(?: code)?\s*[:=]?\s*(?:408|500|502|503|504)\b)/i;
|
|
12
12
|
const TRANSIENT_TRANSPORT_ERROR = /(?:fetch failed|econnreset|econnrefused|etimedout|eai_again|enotfound|socket hang up|connection (?:reset|refused|terminated|error)|upstream connection error|temporary failure in name resolution|(?:request|connection|connect|network|socket|tls|upstream).*tim(?:ed? out|eout))/i;
|
|
13
13
|
const TRANSIENT_PROVIDER_GUIDANCE = /\byou can retry your request\b/i;
|
|
14
|
+
const TRANSIENT_MACHINE_ERROR = /\b(?:ENOSPC|EMFILE|ENFILE|EAGAIN)\b/i;
|
|
14
15
|
export function isRetryableError(error) {
|
|
15
16
|
const message = error?.message;
|
|
16
17
|
if (!message || classifyAuthError(message) || PERMANENT_PROVIDER_ERROR.test(message))
|
|
@@ -18,22 +19,6 @@ export function isRetryableError(error) {
|
|
|
18
19
|
return isApiRateLimitError(message)
|
|
19
20
|
|| TRANSIENT_HTTP_STATUS.test(message)
|
|
20
21
|
|| TRANSIENT_TRANSPORT_ERROR.test(message)
|
|
21
|
-
|| TRANSIENT_PROVIDER_GUIDANCE.test(message)
|
|
22
|
-
|
|
23
|
-
/** A retryable thrown failure is either the provider refusing on quota or the request failing on
|
|
24
|
-
* its way (connection reset, 5xx, timeout). Only call this on an `isRetryableError` failure. */
|
|
25
|
-
export function fallbackReasonOf(error) {
|
|
26
|
-
return isApiRateLimitError(error.message) ? 'rate-limited' : 'transport-error';
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* A retryable failure the chain deliberately did not retry: the attempt had already started a tool
|
|
30
|
-
* call, and re-running the turn on a fallback would run that tool again. It ends the turn as a
|
|
31
|
-
* plain failure — no fallback, and no automatic resume either, which is what a rate-limit message
|
|
32
|
-
* would otherwise get. The message itself says what happened and asks the user to send again.
|
|
33
|
-
*/
|
|
34
|
-
export function notRetriedFailure(message) {
|
|
35
|
-
return Object.assign(new Error(message), { notRetried: true });
|
|
36
|
-
}
|
|
37
|
-
export function isNotRetriedFailure(error) {
|
|
38
|
-
return typeof error === 'object' && error !== null && error.notRetried === true;
|
|
22
|
+
|| TRANSIENT_PROVIDER_GUIDANCE.test(message)
|
|
23
|
+
|| TRANSIENT_MACHINE_ERROR.test(message);
|
|
39
24
|
}
|
|
@@ -3,7 +3,7 @@ import { Capability } from '../../agent-adapter/capabilities.js';
|
|
|
3
3
|
import type { UserMessage } from '../../agent-adapter/types.js';
|
|
4
4
|
import type { RunEvent, RunPhase } from '../../agent-adapter/run-events.js';
|
|
5
5
|
import { type RunSpend } from './spend.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { EngineSelection } from '../agents/engine-selection.js';
|
|
7
7
|
import type { RunObserver, RunRequest, RunResult } from './request.js';
|
|
8
8
|
/** How a run ends. `rate-limited` stays its own outcome; the execution record files it as a failure
|
|
9
9
|
* that names the rate limit (`executions/registry.ts` teardownExecution). */
|
|
@@ -20,15 +20,11 @@ export interface AgentRun {
|
|
|
20
20
|
readonly numTurns: number | null;
|
|
21
21
|
readonly attempt: {
|
|
22
22
|
index: number;
|
|
23
|
-
config:
|
|
23
|
+
config: EngineSelection;
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
26
|
-
* The session's resume target: the backend session id on the session's OWN backend (the
|
|
27
|
-
* profile's). A fallback attempt on another backend never names it — its id would be resumed by
|
|
28
|
-
* the wrong CLI next turn — so across such a fallback this keeps the primary's id.
|
|
29
|
-
*/
|
|
25
|
+
/** The session's resume target on the selected backend. */
|
|
30
26
|
readonly backendSessionId: string | null;
|
|
31
|
-
/** What the
|
|
27
|
+
/** What the selected backend can do. */
|
|
32
28
|
readonly capabilities: ReadonlySet<Capability>;
|
|
33
29
|
/** The awaited foreground turn's result. */
|
|
34
30
|
readonly result: Promise<RunResult>;
|
|
@@ -72,9 +68,7 @@ export interface RunTerminalInfo {
|
|
|
72
68
|
/** What the run had produced when it ended — the foreground turn plus every continuation that
|
|
73
69
|
* settled, also on a cancelled or failed run, so the spend already incurred is not lost. */
|
|
74
70
|
result: RunResult | null;
|
|
75
|
-
/** Everything the run spent,
|
|
76
|
-
* the session totals carry. The attempts the chain moved past count by the cost rows they
|
|
77
|
-
* streamed (the rows the ledger got); the last one by `result` when there is one. */
|
|
71
|
+
/** Everything the run spent, including background continuations. */
|
|
78
72
|
spend: RunSpend;
|
|
79
73
|
error?: Error;
|
|
80
74
|
durationS: number;
|
|
@@ -107,9 +101,6 @@ export declare class AgentRunImpl implements AgentRun {
|
|
|
107
101
|
/** Continuation results seen so far. The live tally and a run that ends before its attempt
|
|
108
102
|
* settles (Stop, failure) read them; a settled attempt reports its own merged result. */
|
|
109
103
|
private readonly continuations;
|
|
110
|
-
/** What each attempt the chain moved past had spent. Each entry keeps counting until the run
|
|
111
|
-
* ends: a retired attempt's late cost rows still reach the ledger, so they count here too. */
|
|
112
|
-
private readonly retiredSpend;
|
|
113
104
|
/** What the running attempt has streamed so far: a run that ends with no result still cost it. */
|
|
114
105
|
private liveSpend;
|
|
115
106
|
private readonly observers;
|
|
@@ -118,9 +109,7 @@ export declare class AgentRunImpl implements AgentRun {
|
|
|
118
109
|
private readonly startedAt;
|
|
119
110
|
private readonly settleDeferred;
|
|
120
111
|
private readonly resultDeferred;
|
|
121
|
-
/**
|
|
122
|
-
private readonly plan;
|
|
123
|
-
/** Narrates the chain. It sits IN the event path because it can swallow a line. */
|
|
112
|
+
/** Narrates the attempt. It sits in the event path because it can swallow a line. */
|
|
124
113
|
private readonly notices;
|
|
125
114
|
/** Mirrors the old dispatcher's `active`: once the foreground turn is over, the run stops
|
|
126
115
|
* synthesizing notices about itself — the background phase is not a new turn to announce. */
|
|
@@ -134,7 +123,7 @@ export declare class AgentRunImpl implements AgentRun {
|
|
|
134
123
|
constructor(args: CreateAgentRunArgs);
|
|
135
124
|
get attempt(): {
|
|
136
125
|
index: number;
|
|
137
|
-
config:
|
|
126
|
+
config: EngineSelection;
|
|
138
127
|
};
|
|
139
128
|
get status(): RunStatus;
|
|
140
129
|
get phase(): RunPhase;
|
|
@@ -150,29 +139,11 @@ export declare class AgentRunImpl implements AgentRun {
|
|
|
150
139
|
claimBackgroundTranscript(): void;
|
|
151
140
|
/** Begin the run. Called exactly once by `startRun`, synchronously. */
|
|
152
141
|
start(): void;
|
|
153
|
-
/**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
* The whole chain is one run: the same runId, the same observers, one execution record. Only
|
|
159
|
-
* `attempt.index` moves.
|
|
160
|
-
*/
|
|
161
|
-
private walkChain;
|
|
162
|
-
/**
|
|
163
|
-
* One attempt. Returns 'settled' when the run is over, or why the chain should advance.
|
|
164
|
-
*
|
|
165
|
-
* A fallback re-runs the whole turn in a fresh backend conversation. That is only safe before
|
|
166
|
-
* the turn started any tool call — a rate limit or a transport failure alike; after one, the
|
|
167
|
-
* re-run would repeat its side effects, so the turn ends with an error that says why it was not
|
|
168
|
-
* retried. The last attempt has nothing to fall back to and settles as it always did.
|
|
169
|
-
*/
|
|
170
|
-
private runAttempt;
|
|
171
|
-
/** The route (base URL + credentials) this attempt runs under. Per-attempt, because a fallback
|
|
172
|
-
* may be a different mode entirely. */
|
|
142
|
+
/** One selection, at most one spawn. Background work never waits for a throttled provider. */
|
|
143
|
+
private runOnce;
|
|
144
|
+
private openAttempt;
|
|
145
|
+
/** The route (base URL + credentials) this run uses. */
|
|
173
146
|
private routeFor;
|
|
174
|
-
/** The chain moved on. Report it on the stream; the surface renders the notice. */
|
|
175
|
-
private advanceAttempt;
|
|
176
147
|
/** Every attempt that reached a backend settles here: provider attribution and the auth
|
|
177
148
|
* lifecycle apply to the WHOLE attempt, background phase included, which is why they are done
|
|
178
149
|
* on the settled value rather than wrapped around the foreground promise. */
|
|
@@ -182,8 +153,7 @@ export declare class AgentRunImpl implements AgentRun {
|
|
|
182
153
|
* record open forever, because nothing ever emitted the engine's terminal `phase`.) */
|
|
183
154
|
private settleBlocked;
|
|
184
155
|
private onAttemptError;
|
|
185
|
-
/** Stamp the
|
|
186
|
-
* selection (an unknown profile name) names no provider: see `attemptProviderOrNull`. */
|
|
156
|
+
/** Stamp the selected provider onto a result that did not name one. */
|
|
187
157
|
private attribute;
|
|
188
158
|
private attributeError;
|
|
189
159
|
/** Auth is a property of the provider, not of the turn: a run that came back without a rate
|