@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,4 @@
|
|
|
1
|
-
import type { UiServiceDeps, UiService, QueryScope, MutateOp, Result, QueryParams, QueryReturn, MutateArgs, MutateReturn } from './types.js';
|
|
1
|
+
import type { UiServiceDeps, UiService, QueryScope, MutateOp, Result, QueryParams, QueryReturn, MutateArgs, MutateReturn, UiCallContext } from './types.js';
|
|
2
2
|
import { handleSystemCheckUpdate } from './mutate/system.js';
|
|
3
3
|
/** One handler per query scope; a missing or mistyped handler fails compilation. */
|
|
4
4
|
export type QueryHandlerMap = {
|
|
@@ -6,7 +6,7 @@ export type QueryHandlerMap = {
|
|
|
6
6
|
};
|
|
7
7
|
/** One handler per mutate op; a missing or mistyped handler fails compilation. */
|
|
8
8
|
export type MutateHandlerMap = {
|
|
9
|
-
[O in MutateOp]: (deps: UiServiceDeps, args: MutateArgs<O
|
|
9
|
+
[O in MutateOp]: (deps: UiServiceDeps, args: MutateArgs<O>, ctx: UiCallContext) => Promise<Result<MutateReturn<O>>>;
|
|
10
10
|
};
|
|
11
11
|
export declare const queryHandlers: {
|
|
12
12
|
'projects.list': (deps: UiServiceDeps) => Promise<import("./types.js").ProjectConduitInfo[]>;
|
|
@@ -81,6 +81,7 @@ export declare const queryHandlers: {
|
|
|
81
81
|
}) => Promise<import("./types.js").LoginFlowState>;
|
|
82
82
|
'auth.customProviders': (deps: UiServiceDeps, params: Record<string, never>) => Promise<import("./types.js").CustomProviderView[]>;
|
|
83
83
|
'usageSharing.get': (deps: UiServiceDeps, params: Record<string, never>) => Promise<import("./types.js").UsageSharingSettings>;
|
|
84
|
+
'telemetry.info': (deps: UiServiceDeps, params: Record<string, never>) => Promise<import("./types.js").TelemetryInfo>;
|
|
84
85
|
'models.catalog': (deps: UiServiceDeps, params: Record<string, never>) => Promise<import("./types.js").ModelCatalogSnapshot>;
|
|
85
86
|
'hooks.list': (deps: UiServiceDeps, params: Record<string, never>) => Promise<import("./types.js").HooksOverview>;
|
|
86
87
|
'machines.list': (deps: UiServiceDeps, params: Record<string, never>) => Promise<import("./types.js").MachineInfo[]>;
|
|
@@ -118,9 +119,6 @@ export declare const mutateHandlers: {
|
|
|
118
119
|
}) => Promise<Result<import("./types.js").ProjectCreateReturn>>;
|
|
119
120
|
'sessions.create': (deps: UiServiceDeps, args: {
|
|
120
121
|
projectId?: string;
|
|
121
|
-
browser?: {
|
|
122
|
-
device: string;
|
|
123
|
-
};
|
|
124
122
|
}) => Promise<Result<import("./types.js").SessionsCreateReturn>>;
|
|
125
123
|
'sessions.send': (deps: UiServiceDeps, args: {
|
|
126
124
|
sessionId: string;
|
|
@@ -139,37 +137,18 @@ export declare const mutateHandlers: {
|
|
|
139
137
|
'sessions.compact': (deps: UiServiceDeps, args: {
|
|
140
138
|
sessionId: string;
|
|
141
139
|
}) => Promise<Result<import("./types.js").SessionsCompactReturn>>;
|
|
142
|
-
'sessions.setProfile': (deps: UiServiceDeps, args: {
|
|
143
|
-
sessionId: string;
|
|
144
|
-
profileName: string;
|
|
145
|
-
}) => Promise<Result<import("./types.js").SessionsSetProfileReturn>>;
|
|
146
140
|
'sessions.setAgent': (deps: UiServiceDeps, args: {
|
|
147
141
|
sessionId: string;
|
|
148
142
|
agentName?: string;
|
|
149
143
|
}) => Promise<Result<import("./types.js").SessionsSetAgentReturn>>;
|
|
150
144
|
'sessions.setSelection': (deps: UiServiceDeps, args: {
|
|
151
145
|
sessionId: string;
|
|
152
|
-
|
|
153
|
-
selection?: {
|
|
154
|
-
model?: string;
|
|
155
|
-
provider?: string;
|
|
156
|
-
thinking?: string;
|
|
157
|
-
mode?: string;
|
|
158
|
-
};
|
|
146
|
+
selection: import("./types.js").EngineSelection;
|
|
159
147
|
}) => Promise<Result<import("./types.js").SessionsSetSelectionReturn>>;
|
|
160
148
|
'sessions.createAndSend': (deps: UiServiceDeps, args: {
|
|
161
149
|
projectId: string;
|
|
162
|
-
profileName?: string;
|
|
163
150
|
agentName?: string;
|
|
164
|
-
selection?:
|
|
165
|
-
model?: string;
|
|
166
|
-
provider?: string;
|
|
167
|
-
thinking?: string;
|
|
168
|
-
mode?: string;
|
|
169
|
-
};
|
|
170
|
-
browser?: {
|
|
171
|
-
device: string;
|
|
172
|
-
};
|
|
151
|
+
selection?: import("./types.js").EngineSelection;
|
|
173
152
|
text: string;
|
|
174
153
|
draftUploadId?: string;
|
|
175
154
|
attachments?: {
|
|
@@ -223,6 +202,11 @@ export declare const mutateHandlers: {
|
|
|
223
202
|
turnIndex: number;
|
|
224
203
|
text: string;
|
|
225
204
|
}) => Promise<Result<import("./types.js").SessionsRewindReturn>>;
|
|
205
|
+
'sessions.resolveMedia': (deps: UiServiceDeps, args: {
|
|
206
|
+
sessionId: string;
|
|
207
|
+
ts: string;
|
|
208
|
+
src: string;
|
|
209
|
+
}) => Promise<Result<import("./inline-media-types.js").ResolveMediaResult>>;
|
|
226
210
|
'executions.cancel': (deps: UiServiceDeps, args: {
|
|
227
211
|
executionId: string;
|
|
228
212
|
}) => Promise<Result<import("./types.js").ExecutionsCancelReturn>>;
|
|
@@ -242,7 +226,7 @@ export declare const mutateHandlers: {
|
|
|
242
226
|
type: "daily" | "interval" | "once" | "weekly";
|
|
243
227
|
message: string;
|
|
244
228
|
projectId?: string;
|
|
245
|
-
|
|
229
|
+
selection?: import("./types.js").EngineSelection;
|
|
246
230
|
intervalMs?: number;
|
|
247
231
|
time?: string;
|
|
248
232
|
dayOfWeek?: number;
|
|
@@ -252,7 +236,7 @@ export declare const mutateHandlers: {
|
|
|
252
236
|
scheduleId: string;
|
|
253
237
|
message?: string;
|
|
254
238
|
projectId?: string;
|
|
255
|
-
|
|
239
|
+
selection?: import("./types.js").EngineSelection;
|
|
256
240
|
intervalMs?: number;
|
|
257
241
|
time?: string;
|
|
258
242
|
dayOfWeek?: number;
|
|
@@ -305,11 +289,6 @@ export declare const mutateHandlers: {
|
|
|
305
289
|
daily_usd: number;
|
|
306
290
|
monthly_usd: number;
|
|
307
291
|
};
|
|
308
|
-
} | {
|
|
309
|
-
section: "profiles";
|
|
310
|
-
value: {
|
|
311
|
-
defaultProfile: string;
|
|
312
|
-
};
|
|
313
292
|
} | {
|
|
314
293
|
section: "settings";
|
|
315
294
|
value: Record<string, string | number | boolean | string[]>;
|
|
@@ -388,6 +367,33 @@ export declare const mutateHandlers: {
|
|
|
388
367
|
org?: string;
|
|
389
368
|
email?: string;
|
|
390
369
|
}) => Promise<Result<import("./types.js").UsageSharingSettings>>;
|
|
370
|
+
'telemetry.report': (deps: UiServiceDeps, args: {
|
|
371
|
+
kind: "crash";
|
|
372
|
+
crashKind: "renderError" | "unhandledRejection" | "windowError";
|
|
373
|
+
errorName: string;
|
|
374
|
+
message: string;
|
|
375
|
+
stack: string;
|
|
376
|
+
route?: string;
|
|
377
|
+
buildStamp?: string;
|
|
378
|
+
uptimeS?: number;
|
|
379
|
+
} | {
|
|
380
|
+
kind: "native_crash";
|
|
381
|
+
component: "android" | "desktop";
|
|
382
|
+
at: string;
|
|
383
|
+
message: string;
|
|
384
|
+
stack: string;
|
|
385
|
+
appVersion: string;
|
|
386
|
+
} | {
|
|
387
|
+
kind: "load";
|
|
388
|
+
ttfbMs?: number;
|
|
389
|
+
firstRenderMs?: number;
|
|
390
|
+
interactiveMs?: number;
|
|
391
|
+
} | {
|
|
392
|
+
kind: "sse_reconnect";
|
|
393
|
+
count: number;
|
|
394
|
+
}, ctx: UiCallContext) => Promise<Result<{
|
|
395
|
+
ok: true;
|
|
396
|
+
}>>;
|
|
391
397
|
'hooks.create': (deps: UiServiceDeps, args: {
|
|
392
398
|
event: string;
|
|
393
399
|
matcher?: string;
|
|
@@ -397,7 +403,7 @@ export declare const mutateHandlers: {
|
|
|
397
403
|
timeoutSec?: number;
|
|
398
404
|
backends?: ("claude" | "pi")[];
|
|
399
405
|
requiresTool?: string;
|
|
400
|
-
result?: "
|
|
406
|
+
result?: "none" | "stdout-as-prompt";
|
|
401
407
|
enabled?: boolean;
|
|
402
408
|
id: string;
|
|
403
409
|
}) => Promise<Result<import("./types.js").HooksCreateReturn>>;
|
|
@@ -410,7 +416,7 @@ export declare const mutateHandlers: {
|
|
|
410
416
|
timeoutSec?: number;
|
|
411
417
|
backends?: ("claude" | "pi")[];
|
|
412
418
|
requiresTool?: string;
|
|
413
|
-
result?: "
|
|
419
|
+
result?: "none" | "stdout-as-prompt";
|
|
414
420
|
enabled?: boolean;
|
|
415
421
|
id: string;
|
|
416
422
|
}) => Promise<Result<import("./types.js").HooksUpdateReturn>>;
|
|
@@ -425,27 +431,23 @@ export declare const mutateHandlers: {
|
|
|
425
431
|
id: string;
|
|
426
432
|
payload: string;
|
|
427
433
|
}) => Promise<Result<import("./types.js").HooksTestReturn>>;
|
|
428
|
-
'
|
|
429
|
-
|
|
430
|
-
backend?: "claude" | "pi";
|
|
431
|
-
mode?: string;
|
|
434
|
+
'models.favorites.add': (deps: UiServiceDeps, args: {
|
|
435
|
+
backend: "claude" | "pi";
|
|
432
436
|
provider?: string;
|
|
433
|
-
thinking?: string;
|
|
434
|
-
extraOption?: Record<string, string>;
|
|
435
|
-
name: string;
|
|
436
|
-
}) => Promise<Result<import("./types.js").ProfilesCreateReturn>>;
|
|
437
|
-
'profiles.update': (deps: UiServiceDeps, args: {
|
|
438
437
|
model: string;
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
}) => Promise<Result<import("./types.js").ModelsMutationReturn>>;
|
|
439
|
+
'models.favorites.remove': (deps: UiServiceDeps, args: {
|
|
440
|
+
backend: "claude" | "pi";
|
|
441
441
|
provider?: string;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
442
|
+
model: string;
|
|
443
|
+
}) => Promise<Result<import("./types.js").ModelsMutationReturn>>;
|
|
444
|
+
'models.setDefault': (deps: UiServiceDeps, args: {
|
|
445
|
+
selection: import("./types.js").EngineSelection;
|
|
446
|
+
}) => Promise<Result<import("./types.js").ModelsMutationReturn>>;
|
|
447
|
+
'models.setThinking': (deps: UiServiceDeps, args: {
|
|
448
|
+
ref: import("./types.js").ModelRef;
|
|
449
|
+
thinking: string | null;
|
|
450
|
+
}) => Promise<Result<import("./types.js").ModelsMutationReturn>>;
|
|
449
451
|
'plugins.assign': (deps: UiServiceDeps, args: {
|
|
450
452
|
target: {
|
|
451
453
|
kind: "agent";
|
|
@@ -502,6 +504,7 @@ export declare const mutateHandlers: {
|
|
|
502
504
|
env?: Record<string, string>;
|
|
503
505
|
headers?: Record<string, string>;
|
|
504
506
|
}[];
|
|
507
|
+
baseHash: string;
|
|
505
508
|
}) => Promise<Result<import("./types.js").PluginsMcpRead>>;
|
|
506
509
|
'environments.validate': (deps: UiServiceDeps, args: {
|
|
507
510
|
name: string;
|
|
@@ -15,6 +15,8 @@ import { handleConfigGet } from './query/config.js';
|
|
|
15
15
|
import { handleAuthFlowState, handleAuthStatus } from './query/auth.js';
|
|
16
16
|
import { handleCustomProvidersList } from './query/custom-providers.js';
|
|
17
17
|
import { handleUsageSharingGet } from './query/usage-sharing.js';
|
|
18
|
+
import { handleTelemetryInfo } from './query/telemetry.js';
|
|
19
|
+
import { handleTelemetryReport } from './mutate/telemetry.js';
|
|
18
20
|
import { handleModelsCatalog } from './query/models.js';
|
|
19
21
|
import { handleHooksList } from './query/hooks.js';
|
|
20
22
|
import { handleMachinesList } from './query/machines.js';
|
|
@@ -26,12 +28,12 @@ import { handleEnvironmentsList, handleEnvironmentsGet } from './query/environme
|
|
|
26
28
|
import { handleSystemDaemonStatus, handleSystemRateLimitStatus, handleSystemUsageStatus, handleSystemNotices, handleSystemUpdateStatus, } from './query/system.js';
|
|
27
29
|
import { handleConfigSet, handleConfigSetProviderRateLimitPolicy, } from './mutate/config.js';
|
|
28
30
|
import { handleHooksCreate, handleHooksUpdate, handleHooksSetEnabled, handleHooksRemove, handleHooksTest, } from './mutate/hooks.js';
|
|
29
|
-
import {
|
|
31
|
+
import { handleModelsFavoriteAdd, handleModelsFavoriteRemove, handleModelsSetDefault, handleModelsSetThinking, } from './mutate/models.js';
|
|
30
32
|
import { handleEnvironmentsValidate, handleEnvironmentsSave, handleEnvironmentsDelete, handleEnvironmentsSavePrompt, } from './mutate/environments.js';
|
|
31
33
|
import { handlePluginsAssign } from './mutate/plugins.js';
|
|
32
34
|
import { handlePluginsSkillWrite, handlePluginsSkillCreate, handlePluginsSkillMove, handlePluginsSkillRemove, handlePluginsSkillRevert, handlePluginsCreate, handlePluginsRemove, handlePluginsConvertToPortable, handlePluginsMcpWrite, } from './mutate/plugin-packages.js';
|
|
33
35
|
import { handleCreateProject } from './mutate/projects.js';
|
|
34
|
-
import { handleCreateSession, handleSendSession, handleCancelSession, handleCompactSession,
|
|
36
|
+
import { handleCreateSession, handleSendSession, handleCancelSession, handleCompactSession, handleSetAgent, handleSetSelection, handleCreateAndSend, handleMarkReadSession, handleMarkManyReadSessions, handleAnswerQuestion, handleRespondPlan, handleRespondDecision, handleCancelResume, handleRewindSession } from './mutate/sessions.js';
|
|
35
37
|
import { handleCancelExecution } from './mutate/executions.js';
|
|
36
38
|
import { handleCancelWaitpoint } from './mutate/waitpoints.js';
|
|
37
39
|
import { handlePauseSchedule, handleResumeSchedule, handleRemoveSchedule, handleAddSchedule, handleUpdateSchedule, } from './mutate/schedules.js';
|
|
@@ -44,6 +46,7 @@ import { handleCustomProviderRemove, handleCustomProviderUpsert, } from './mutat
|
|
|
44
46
|
import { handleUsageSharingSet } from './mutate/usage-sharing.js';
|
|
45
47
|
import { createSubscription } from './subscribe.js';
|
|
46
48
|
import { AssistantSnapshots } from './assistant-snapshots.js';
|
|
49
|
+
import { handleResolveMedia } from './mutate/resolve-media.js';
|
|
47
50
|
export const queryHandlers = {
|
|
48
51
|
'projects.list': (deps) => handleProjectsList(deps),
|
|
49
52
|
'sessions.list': (deps, params) => handleSessionsList(deps, params),
|
|
@@ -70,6 +73,7 @@ export const queryHandlers = {
|
|
|
70
73
|
'auth.flowState': (deps, params) => handleAuthFlowState(params, deps.authLogin?.getState),
|
|
71
74
|
'auth.customProviders': (deps, params) => handleCustomProvidersList(deps, params),
|
|
72
75
|
'usageSharing.get': (deps, params) => handleUsageSharingGet(deps, params),
|
|
76
|
+
'telemetry.info': (deps, params) => handleTelemetryInfo(deps, params),
|
|
73
77
|
'models.catalog': (deps, params) => handleModelsCatalog(deps, params),
|
|
74
78
|
'hooks.list': (deps, params) => handleHooksList(deps, params),
|
|
75
79
|
'machines.list': (deps, params) => handleMachinesList(deps, params),
|
|
@@ -93,7 +97,6 @@ export const mutateHandlers = {
|
|
|
93
97
|
'sessions.send': (deps, args) => handleSendSession(deps, args),
|
|
94
98
|
'sessions.cancel': (deps, args) => handleCancelSession(deps, args),
|
|
95
99
|
'sessions.compact': (deps, args) => handleCompactSession(deps, args),
|
|
96
|
-
'sessions.setProfile': (deps, args) => handleSetProfile(deps, args),
|
|
97
100
|
'sessions.setAgent': (deps, args) => handleSetAgent(deps, args),
|
|
98
101
|
'sessions.setSelection': (deps, args) => handleSetSelection(deps, args),
|
|
99
102
|
'sessions.createAndSend': (deps, args) => handleCreateAndSend(deps, args),
|
|
@@ -106,6 +109,7 @@ export const mutateHandlers = {
|
|
|
106
109
|
'sessions.respondDecision': (deps, args) => handleRespondDecision(deps, args),
|
|
107
110
|
'sessions.cancelResume': (_deps, args) => handleCancelResume(args),
|
|
108
111
|
'sessions.rewind': (deps, args) => handleRewindSession(deps, args),
|
|
112
|
+
'sessions.resolveMedia': (deps, args) => handleResolveMedia(deps, args),
|
|
109
113
|
'executions.cancel': (deps, args) => handleCancelExecution(deps, args),
|
|
110
114
|
'waitpoints.cancel': (deps, args) => handleCancelWaitpoint(deps, args),
|
|
111
115
|
'schedules.pause': (deps, args) => handlePauseSchedule(deps, args),
|
|
@@ -134,14 +138,16 @@ export const mutateHandlers = {
|
|
|
134
138
|
'auth.upsertCustomProvider': (deps, args) => handleCustomProviderUpsert(deps, args),
|
|
135
139
|
'auth.removeCustomProvider': (deps, args) => handleCustomProviderRemove(deps, args),
|
|
136
140
|
'usageSharing.set': (deps, args) => handleUsageSharingSet(deps, args),
|
|
141
|
+
'telemetry.report': (deps, args, ctx) => handleTelemetryReport(deps, args, ctx),
|
|
137
142
|
'hooks.create': (deps, args) => handleHooksCreate(deps, args),
|
|
138
143
|
'hooks.update': (deps, args) => handleHooksUpdate(deps, args),
|
|
139
144
|
'hooks.setEnabled': (deps, args) => handleHooksSetEnabled(deps, args),
|
|
140
145
|
'hooks.remove': (deps, args) => handleHooksRemove(deps, args),
|
|
141
146
|
'hooks.test': (deps, args) => handleHooksTest(deps, args),
|
|
142
|
-
'
|
|
143
|
-
'
|
|
144
|
-
'
|
|
147
|
+
'models.favorites.add': (deps, args) => handleModelsFavoriteAdd(deps, args),
|
|
148
|
+
'models.favorites.remove': (deps, args) => handleModelsFavoriteRemove(deps, args),
|
|
149
|
+
'models.setDefault': (deps, args) => handleModelsSetDefault(deps, args),
|
|
150
|
+
'models.setThinking': (deps, args) => handleModelsSetThinking(deps, args),
|
|
145
151
|
'plugins.assign': (deps, args) => handlePluginsAssign(deps, args),
|
|
146
152
|
'plugins.skillWrite': (deps, args) => handlePluginsSkillWrite(deps, args),
|
|
147
153
|
'plugins.skillCreate': (deps, args) => handlePluginsSkillCreate(deps, args),
|
|
@@ -169,6 +175,7 @@ const AUDIT_REDACTORS = {
|
|
|
169
175
|
'auth.respondPrompt': ({ flowId }) => ({ flowId }),
|
|
170
176
|
'auth.upsertCustomProvider': ({ apiKey: _upstreamKey, ...safe }) => safe,
|
|
171
177
|
'usageSharing.set': ({ enabled }) => ({ enabled }),
|
|
178
|
+
'telemetry.report': ({ kind }) => ({ kind }),
|
|
172
179
|
};
|
|
173
180
|
function dropNoteText({ text: _privateText, ...safe }) {
|
|
174
181
|
return safe;
|
|
@@ -181,6 +188,7 @@ export function redactMutationAuditArgs(op, args) {
|
|
|
181
188
|
const redact = AUDIT_REDACTORS[op] ?? (op.startsWith('notes.') ? dropNoteText : undefined);
|
|
182
189
|
return redact ? redact(args) : args;
|
|
183
190
|
}
|
|
191
|
+
const NO_CALL_CONTEXT = { client: null };
|
|
184
192
|
export function createUiService(deps) {
|
|
185
193
|
const assistantSnapshots = new AssistantSnapshots(deps.bus);
|
|
186
194
|
return {
|
|
@@ -198,32 +206,27 @@ export function createUiService(deps) {
|
|
|
198
206
|
return { ok: false, code, message: err?.message || String(err) };
|
|
199
207
|
}
|
|
200
208
|
},
|
|
201
|
-
async mutate(op, args) {
|
|
209
|
+
async mutate(op, args, ctx = NO_CALL_CONTEXT) {
|
|
202
210
|
const handler = mutateHandlers[op];
|
|
203
211
|
if (!handler) {
|
|
204
212
|
return { ok: false, code: 'invalid-args', message: `Unknown mutate op: ${op}` };
|
|
205
213
|
}
|
|
214
|
+
let result;
|
|
206
215
|
try {
|
|
207
|
-
|
|
208
|
-
// Publish audit event before returning
|
|
209
|
-
deps.bus.publish({
|
|
210
|
-
type: 'ui.mutate-invoked',
|
|
211
|
-
op,
|
|
212
|
-
args: redactMutationAuditArgs(op, args),
|
|
213
|
-
result: result.ok ? { ok: true } : { ok: false, code: result.code },
|
|
214
|
-
});
|
|
215
|
-
return result;
|
|
216
|
+
result = await handler(deps, args, ctx);
|
|
216
217
|
}
|
|
217
218
|
catch (err) {
|
|
218
|
-
|
|
219
|
-
deps.bus.publish({
|
|
220
|
-
type: 'ui.mutate-invoked',
|
|
221
|
-
op,
|
|
222
|
-
args: redactMutationAuditArgs(op, args),
|
|
223
|
-
result: { ok: false, code: 'internal' },
|
|
224
|
-
});
|
|
225
|
-
return errResult;
|
|
219
|
+
result = { ok: false, code: 'internal', message: err?.message || String(err) };
|
|
226
220
|
}
|
|
221
|
+
// Publish audit event before returning
|
|
222
|
+
deps.bus.publish({
|
|
223
|
+
type: 'ui.mutate-invoked',
|
|
224
|
+
op,
|
|
225
|
+
args: redactMutationAuditArgs(op, args),
|
|
226
|
+
result: result.ok ? { ok: true } : { ok: false, code: result.code },
|
|
227
|
+
client: ctx.client,
|
|
228
|
+
});
|
|
229
|
+
return result;
|
|
227
230
|
},
|
|
228
231
|
subscribe(filter) {
|
|
229
232
|
return createSubscription(deps.bus, filter, assistantSnapshots);
|
package/dist/entry/app.js
CHANGED
|
@@ -21,9 +21,15 @@ import { registerCommands } from '../orchestration/routing/commands/index.js';
|
|
|
21
21
|
import { buildAuthRequiredLoginAction } from '../orchestration/routing/commands/login-notice.js';
|
|
22
22
|
import { usageResetNoticeActions } from '../orchestration/routing/commands/usage-reset.js';
|
|
23
23
|
import { recoverWaitpoints, startWaitpointSweep } from '../orchestration/waitpoint-sweep.js';
|
|
24
|
+
import { startCacheKeepWarm } from '../orchestration/cache-keep-warm.js';
|
|
25
|
+
import { startClaudeWindowWarmup } from '../orchestration/claude-window-warmup.js';
|
|
24
26
|
import { projectStore } from '../domain/projects/index.js';
|
|
25
27
|
import { sendStartupDmIfConfigured } from './startup-notify.js';
|
|
26
28
|
import { installSigtermShutdown } from './shutdown.js';
|
|
29
|
+
import { installEarlyTelemetry, installTelemetryCollectors, startTelemetryService, telemetryEventLoopObserver, } from './telemetry-wiring.js';
|
|
30
|
+
import { markBootPhase, recordStartup } from '../domain/telemetry/usage.js';
|
|
31
|
+
import { captureProcessCrash } from '../domain/telemetry/crash.js';
|
|
32
|
+
import { recordMigrationFailure } from '../domain/telemetry/upgrade.js';
|
|
27
33
|
import { buildUiService } from './ui-service-wiring.js';
|
|
28
34
|
import { startPlatformAdapters } from './platform-connect.js';
|
|
29
35
|
import { subscribeDaemonNotices } from './daemon-notice.js';
|
|
@@ -71,10 +77,11 @@ import { initResumeRegistry, getResumeCount, pendingDirectTrackSessionIds } from
|
|
|
71
77
|
import { dispatchPendingResumes, registerResumeWakeOnAgentSettle, } from '../orchestration/resume-dispatcher.js';
|
|
72
78
|
import { providerStateRepo } from '../store/provider-state-repo.js';
|
|
73
79
|
import { runMigrations, migrateAistatusConfigLocation } from '../store/version-migrations.js';
|
|
80
|
+
import { reloadAgentState } from '../domain/agents/config.js';
|
|
74
81
|
import { loadHookRegistry } from '../store/hook-registry.js';
|
|
75
82
|
import { emitCortexEvent, initHookBus } from '../core/hook-bus.js';
|
|
76
83
|
import { CORTEX_VERSION } from '../core/version.js';
|
|
77
|
-
import {
|
|
84
|
+
import { getModelsConfigRevision, MODELS_FILE, modelsRepo, startModelsWatcher, setAdminNotifier as setModelsNotifier } from '../store/models-repo.js';
|
|
78
85
|
import { startBoardWatcher } from '../domain/boards/board-watcher.js';
|
|
79
86
|
import { sessionStore } from '../store/session-registry-repo.js';
|
|
80
87
|
import { retentionCandidateRepo } from '../store/retention-candidate-repo.js';
|
|
@@ -106,9 +113,12 @@ import { registerAuthWatch } from '../domain/auth/auth-watch.js';
|
|
|
106
113
|
import { onLoginSuccess } from '../domain/auth/login-flow.js';
|
|
107
114
|
import { syncGatewayFromBackends } from '../domain/auth/gateway-sync.js';
|
|
108
115
|
import { createSessionRetentionController } from '../orchestration/session-retention-controller.js';
|
|
116
|
+
import { ensureOwnBinsOnPath } from '../domain/system/own-bin-path.js';
|
|
117
|
+
import { defaultTerminalCliContext, syncTerminalCli } from '../domain/system/terminal-cli/index.js';
|
|
109
118
|
// Static imports are evaluated before this line, so this is how long module loading took.
|
|
110
119
|
const importsMs = Math.round(performance.now());
|
|
111
120
|
loadRuntimeDotenv(path.join(CONFIG_DIR, '.env'));
|
|
121
|
+
ensureOwnBinsOnPath();
|
|
112
122
|
await migrateEnvToSettings();
|
|
113
123
|
// Ensure the WebSocket + webhook bearer tokens exist before either server starts. Generates
|
|
114
124
|
// and persists them to .env on first run (fail-closed auth — see core/auth.ts). Must run after
|
|
@@ -163,6 +173,19 @@ async function runRetentionSweep(retentionDays, signal) {
|
|
|
163
173
|
const attachmentsPruned = result.stopped ? 0 : await pruneInboundAttachments(retentionDays);
|
|
164
174
|
log.info(`Retention sweep${result.stopped ? ' stopped early' : ''}: registry=${result.registryCommitted} history=${result.historyOrphanDeleted} pi=${result.piOrphanDeleted} capture=${result.claudeCaptureDeleted} toolImages=${result.toolImagesDeleted} attachments=${attachmentsPruned} errors=${result.errors.length} in ${Date.now() - startedAt}ms`);
|
|
165
175
|
}
|
|
176
|
+
/** Deferred past startup: the first Windows install calls PowerShell synchronously. */
|
|
177
|
+
function syncTerminalCommand() {
|
|
178
|
+
setTimeout(() => {
|
|
179
|
+
try {
|
|
180
|
+
const result = syncTerminalCli(defaultTerminalCliContext(DATA_DIR));
|
|
181
|
+
if (result.files.length)
|
|
182
|
+
log.info(`Terminal command ${result.action}: ${result.files.join(', ')}`);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
log.warn(`Terminal command setup failed; retrying at next start: ${error.message}`);
|
|
186
|
+
}
|
|
187
|
+
}, 0);
|
|
188
|
+
}
|
|
166
189
|
const retentionController = createSessionRetentionController({
|
|
167
190
|
getRetentionDays: () => getSettings().sessionRetentionDays,
|
|
168
191
|
onSettingsChange,
|
|
@@ -183,18 +206,17 @@ function initConfiguredHooks() {
|
|
|
183
206
|
const cortexCount = enabled.filter((entry) => entry.event.startsWith('cortex:')).length;
|
|
184
207
|
log.info(`Startup: mounted ${enabled.length} hooks (${ccCount} cc / ${cortexCount} cortex)`);
|
|
185
208
|
}
|
|
186
|
-
/** Preload the PI SDK at boot when
|
|
209
|
+
/** Preload the PI SDK at boot when the default or any favorite uses it, so the first PI session of this
|
|
187
210
|
* process does not wait out its multi-second module import. */
|
|
188
211
|
function prewarmPiBackend() {
|
|
189
212
|
try {
|
|
190
|
-
const
|
|
191
|
-
const usesPi =
|
|
192
|
-
|| profile.fallback?.some((entry) => entry.backend === 'pi'));
|
|
213
|
+
const models = modelsRepo.readIfPresent();
|
|
214
|
+
const usesPi = models?.default?.backend === 'pi' || models?.favorites?.some(ref => ref.backend === 'pi');
|
|
193
215
|
if (usesPi)
|
|
194
216
|
prewarmPiSdk();
|
|
195
217
|
}
|
|
196
218
|
catch (error) {
|
|
197
|
-
log.warn(`Startup: PI preload skipped (
|
|
219
|
+
log.warn(`Startup: PI preload skipped (models unreadable): ${error.message}`);
|
|
198
220
|
}
|
|
199
221
|
}
|
|
200
222
|
// --- Singleton lock ---
|
|
@@ -217,9 +239,14 @@ else {
|
|
|
217
239
|
process.exit(1);
|
|
218
240
|
}
|
|
219
241
|
process.on('exit', () => releaseSingletonLock(APP_PID_FILE));
|
|
242
|
+
// Error digest, the crash the daemon just recovered from, and upgrade confirmation: before the
|
|
243
|
+
// migrations, so their failures are counted too.
|
|
244
|
+
installEarlyTelemetry();
|
|
220
245
|
// Cross-file migrations must finish before adapters, ports, and background services
|
|
221
246
|
// become externally visible. Provider-state extraction runs before schedule cleanup.
|
|
222
|
-
await runMigrations();
|
|
247
|
+
await runMigrations({ onMigrationFailure: recordMigrationFailure });
|
|
248
|
+
markBootPhase('migrations');
|
|
249
|
+
reloadAgentState();
|
|
223
250
|
await migrateBuiltinJobSchedules();
|
|
224
251
|
// Before any Claude spawn: a fresh Cortex Claude config dir takes its model/effort/context
|
|
225
252
|
// settings over from the terminal's once, so the first sessions behave as they did before.
|
|
@@ -238,6 +265,7 @@ process.on('unhandledRejection', (reason) => {
|
|
|
238
265
|
_inExceptionHandler = true;
|
|
239
266
|
try {
|
|
240
267
|
log.error(`unhandledRejection: ${reason instanceof Error ? reason.stack : String(reason)}`);
|
|
268
|
+
captureProcessCrash('server', 'unhandledRejection', reason);
|
|
241
269
|
}
|
|
242
270
|
catch { /* swallow secondary failure */ }
|
|
243
271
|
finally {
|
|
@@ -250,6 +278,7 @@ process.on('uncaughtException', (err) => {
|
|
|
250
278
|
_inExceptionHandler = true;
|
|
251
279
|
try {
|
|
252
280
|
log.error(`uncaughtException: ${err?.stack ?? err}`);
|
|
281
|
+
captureProcessCrash('server', 'uncaughtException', err);
|
|
253
282
|
}
|
|
254
283
|
catch { /* swallow secondary failure */ }
|
|
255
284
|
finally {
|
|
@@ -259,11 +288,12 @@ process.on('uncaughtException', (err) => {
|
|
|
259
288
|
// --- EventBus + logger ---
|
|
260
289
|
const bus = new EventBus();
|
|
261
290
|
createEventLogger(bus);
|
|
291
|
+
installTelemetryCollectors(bus);
|
|
262
292
|
initAuthEvents(bus);
|
|
263
293
|
// A login only becomes useful once the models it unlocks are routable, and that mapping is derived
|
|
264
294
|
// by scanning local backend state. Re-derive it whenever a login lands, so a user who authenticates
|
|
265
|
-
// from the workbench gets
|
|
266
|
-
// Merge-aware and non-throwing (see gateway-sync.ts) —
|
|
295
|
+
// from the workbench gets usable models without dropping to a terminal for `cortex setup-gateway`.
|
|
296
|
+
// Merge-aware and non-throwing (see gateway-sync.ts) — the existing default is never overwritten.
|
|
267
297
|
onLoginSuccess((event) => {
|
|
268
298
|
void syncGatewayFromBackends({ backends: [event.backend] }).then((result) => {
|
|
269
299
|
if (!result.configured && result.reason !== 'no-endpoints') {
|
|
@@ -319,7 +349,7 @@ if (tuiGateway) {
|
|
|
319
349
|
const notifyAdmin = (text) => {
|
|
320
350
|
void emitSystemNotice(adapter, { text });
|
|
321
351
|
};
|
|
322
|
-
|
|
352
|
+
setModelsNotifier(notifyAdmin);
|
|
323
353
|
setMachineNotifier(notifyAdmin);
|
|
324
354
|
setMachineReloadListener(() => {
|
|
325
355
|
void releaseUnregisteredDevices().catch((e) => log.error(`Releasing removed machines failed: ${e.message}`));
|
|
@@ -353,7 +383,7 @@ scheduler.setAdminNotifier(notifyAdmin);
|
|
|
353
383
|
// awaited sequence (initRateLimitRecovery).
|
|
354
384
|
initDiskMonitor(adapter);
|
|
355
385
|
// Agent sessions run in this process, so a stalled loop degrades all of them at once.
|
|
356
|
-
startEventLoopMonitor();
|
|
386
|
+
startEventLoopMonitor({ onReading: telemetryEventLoopObserver });
|
|
357
387
|
const commandRouter = new CommandActionRouter();
|
|
358
388
|
const dispatchCommand = registerCommands({
|
|
359
389
|
scheduler,
|
|
@@ -391,7 +421,7 @@ registerInteractionHandlers(adapter);
|
|
|
391
421
|
// --- Register message handler ---
|
|
392
422
|
registerMessageHandler(adapter, { dispatchCommand, handleMessageEdit });
|
|
393
423
|
// --- Graceful shutdown ---
|
|
394
|
-
// Boot fills in the platform connections, the Web UI host and the
|
|
424
|
+
// Boot fills in the platform connections, the Web UI host and the models watcher as it starts them.
|
|
395
425
|
const shutdownHandles = {
|
|
396
426
|
bus, outboundQueue: oq, scheduler, retention: retentionController,
|
|
397
427
|
};
|
|
@@ -408,6 +438,7 @@ installSigtermShutdown(shutdownHandles);
|
|
|
408
438
|
// An in-process execution dies with the server, so stale it immediately — otherwise a
|
|
409
439
|
// 'running' dispatch record poisons a dispatch concurrency slot until the reconciler's next tick.
|
|
410
440
|
await executionRegistry.markMissingRunningExecutionsStale();
|
|
441
|
+
markBootPhase('executions');
|
|
411
442
|
// A server restart closes every in-process injection window. Commit any durable orphan before
|
|
412
443
|
// the UI transport starts so the first transcript snapshot cannot expose a forever-pending row.
|
|
413
444
|
const recoveredPending = await recoverPendingInjections().catch((error) => {
|
|
@@ -438,10 +469,12 @@ installSigtermShutdown(shutdownHandles);
|
|
|
438
469
|
catch (e) {
|
|
439
470
|
log.warn(`CORTEX_UI_HTTP is set but the Web UI transport failed to load: ${e.message}`);
|
|
440
471
|
}
|
|
472
|
+
markBootPhase('uiHttp');
|
|
441
473
|
// Binds the TUI gateway; Slack/Feishu connect in the background with bounded retries, and a
|
|
442
474
|
// platform that fails or stalls ends in a system notice rather than a stalled boot. Nothing below
|
|
443
475
|
// needs their sockets: every outbound post, including the notices, goes through their HTTP APIs.
|
|
444
476
|
shutdownHandles.platformConnections = await startPlatformAdapters(adapter);
|
|
477
|
+
markBootPhase('platforms');
|
|
445
478
|
// Let the supervisor reach the operator through us — it has no platform adapter of its own.
|
|
446
479
|
subscribeDaemonNotices(adapter);
|
|
447
480
|
void sendStartupDmIfConfigured(adapter, {
|
|
@@ -466,11 +499,11 @@ installSigtermShutdown(shutdownHandles);
|
|
|
466
499
|
startEnvironmentWatcher();
|
|
467
500
|
initializeProductionAttemptIdentity({
|
|
468
501
|
configurationRevision: () => ({
|
|
469
|
-
|
|
502
|
+
models: getModelsConfigRevision(), environments: getEnvironmentRevision(),
|
|
470
503
|
}),
|
|
471
504
|
});
|
|
472
|
-
shutdownHandles.
|
|
473
|
-
bus.publish({ type: 'config.changed', section: '
|
|
505
|
+
shutdownHandles.stopModelsWatcher = startModelsWatcher(modelsRepo, MODELS_FILE, () => {
|
|
506
|
+
bus.publish({ type: 'config.changed', section: 'models' });
|
|
474
507
|
});
|
|
475
508
|
// Open boards refresh live: their directories and the user stylesheet are watched.
|
|
476
509
|
shutdownHandles.stopBoardWatcher = startBoardWatcher(bus);
|
|
@@ -511,6 +544,7 @@ installSigtermShutdown(shutdownHandles);
|
|
|
511
544
|
retentionController.start();
|
|
512
545
|
// M1: Initialize project registry (scaffolds general/, scans PROJECTS_DIR, starts fs.watch watcher)
|
|
513
546
|
await projectStore.initialize();
|
|
547
|
+
markBootPhase('projects');
|
|
514
548
|
startGateway();
|
|
515
549
|
prewarmPiBackend();
|
|
516
550
|
startClientManager(parseInt(process.env.CORTEX_CLIENT_PORT || '3002', 10), process.env.CORTEX_CLIENT_HOST);
|
|
@@ -528,6 +562,7 @@ installSigtermShutdown(shutdownHandles);
|
|
|
528
562
|
const dailyUpdateCheck = setInterval(() => { void runUpdateCheck(); }, 24 * 60 * 60 * 1000);
|
|
529
563
|
dailyUpdateCheck.unref?.();
|
|
530
564
|
await scheduler.start();
|
|
565
|
+
markBootPhase('scheduler');
|
|
531
566
|
// Daily store archival: move week-old terminal execution records to data/archive/*.jsonl.
|
|
532
567
|
// Keeps the hot stores small — their full-map sync stringify on every persist is the main
|
|
533
568
|
// event-loop stall source when they grow to multi-MB.
|
|
@@ -543,6 +578,10 @@ installSigtermShutdown(shutdownHandles);
|
|
|
543
578
|
// S13: register hook-bridge event subscribers (bodies extracted to orch/routing/hook-bridge-subscribers.ts)
|
|
544
579
|
registerHookBridgeSubscribers(bus, adapter, planApprovals);
|
|
545
580
|
installTeamDelivery(bus);
|
|
581
|
+
// Claude prompt caches of idle sessions that still expect a wake, read before their hour runs out.
|
|
582
|
+
startCacheKeepWarm();
|
|
583
|
+
// Claude's five-hour window, reopened after it closes while Claude sits idle (when enabled).
|
|
584
|
+
startClaudeWindowWarmup();
|
|
546
585
|
// Worker reports a restart kept from their leads: delivered now that sessions and the adapter are up.
|
|
547
586
|
void flushTeamOutbox()
|
|
548
587
|
.then((n) => { if (n > 0)
|
|
@@ -555,17 +594,19 @@ installSigtermShutdown(shutdownHandles);
|
|
|
555
594
|
// Waitpoints: drains the signal spool, ages out expired waitpoints and retries any wake whose
|
|
556
595
|
// delivery failed. Every in-memory fast path dies with the process; this does not.
|
|
557
596
|
startWaitpointSweep();
|
|
597
|
+
startTelemetryService();
|
|
558
598
|
startBuiltinJobs();
|
|
559
599
|
void emitCortexEvent('cortex:server.start', {
|
|
560
600
|
version: CORTEX_VERSION,
|
|
561
601
|
pid: process.pid,
|
|
562
602
|
}).catch(() => { });
|
|
563
|
-
//
|
|
564
|
-
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
? `profile: ${bootConfig.profileName} · backend: ${bootConfig.profile.backend}`
|
|
603
|
+
// Show the selection an unconfigured channel will use.
|
|
604
|
+
const bootConfig = modelsRepo.readIfPresent()?.default ? resolveConfiguredDefaultRun() : null;
|
|
605
|
+
const selectionSummary = bootConfig
|
|
606
|
+
? `model: ${bootConfig.model} · backend: ${bootConfig.backend}`
|
|
568
607
|
: 'provider setup required';
|
|
569
|
-
log.info(`Cortex agent is running (${adapter.name}) — ${
|
|
608
|
+
log.info(`Cortex agent is running (${adapter.name}) — ${selectionSummary}`
|
|
570
609
|
+ ` · boot ${Math.round(performance.now())}ms (imports ${importsMs}ms)`);
|
|
610
|
+
recordStartup(importsMs);
|
|
611
|
+
syncTerminalCommand();
|
|
571
612
|
})();
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface ParsedBrowserArgs {
|
|
2
|
+
help: boolean;
|
|
3
|
+
device: string | null;
|
|
4
|
+
args: string[];
|
|
5
|
+
command: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare class BrowserUsageError extends Error {
|
|
8
|
+
}
|
|
9
|
+
export declare function parseBrowserArgs(argv: string[]): ParsedBrowserArgs;
|
|
10
|
+
/** Does this command run without a browser (help, version, bundled skills)? */
|
|
11
|
+
export declare function isLocalCommand(parsed: ParsedBrowserArgs): boolean;
|
|
12
|
+
/** Make the file arguments of file-writing commands absolute against the caller's directory. */
|
|
13
|
+
export declare function absolutizePaths(args: string[], cwd: string): string[];
|
|
14
|
+
export interface LeaseData {
|
|
15
|
+
device: string;
|
|
16
|
+
cdpEndpoint: string;
|
|
17
|
+
abSession: string;
|
|
18
|
+
bin: string;
|
|
19
|
+
env: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export interface BrowserCliOptions {
|
|
22
|
+
env?: NodeJS.ProcessEnv;
|
|
23
|
+
cwd?: string;
|
|
24
|
+
post?: (url: string, body: unknown, headers: Record<string, string>) => Promise<{
|
|
25
|
+
status: number;
|
|
26
|
+
body: any;
|
|
27
|
+
}>;
|
|
28
|
+
/** Run agent-browser with stdout passed through (discarded when `quiet`); resolves its exit code
|
|
29
|
+
* and captured stderr. */
|
|
30
|
+
exec?: (bin: string, args: string[], env: Record<string, string>, cwd: string, quiet?: boolean) => Promise<{
|
|
31
|
+
code: number;
|
|
32
|
+
stderr: string;
|
|
33
|
+
}>;
|
|
34
|
+
writeErr?: (text: string) => void;
|
|
35
|
+
/** Delay before telling the caller the browser is still starting. */
|
|
36
|
+
slowNoticeMs?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function runBrowserCli(argv: string[], options?: BrowserCliOptions): Promise<number>;
|
|
39
|
+
export declare function main(argv?: string[]): Promise<void>;
|