@wjarka/cezarion 0.15.1 → 0.16.0
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 +167 -46
- package/dist/agent-config/catalog.d.ts +6 -2
- package/dist/agent-config/catalog.js +78 -3
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/shared.js +6 -3
- package/dist/agent-config/model-settings/shared.js.map +1 -1
- package/dist/agent-config/models.js +4 -0
- package/dist/agent-config/models.js.map +1 -1
- package/dist/agent-config/validate.js +6 -0
- package/dist/agent-config/validate.js.map +1 -1
- package/dist/artifacts/cli.js +10 -2
- package/dist/artifacts/cli.js.map +1 -1
- package/dist/automations/coordinator.d.ts +7 -0
- package/dist/automations/coordinator.js +22 -2
- package/dist/automations/coordinator.js.map +1 -1
- package/dist/automations/github-poller.d.ts +4 -4
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/schedule-runner.d.ts +130 -0
- package/dist/automations/schedule-runner.js +326 -0
- package/dist/automations/schedule-runner.js.map +1 -0
- package/dist/automations/scheduler.d.ts +38 -7
- package/dist/automations/scheduler.js +90 -22
- package/dist/automations/scheduler.js.map +1 -1
- package/dist/automations/store.d.ts +80 -3
- package/dist/automations/store.js +208 -16
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/task-template.d.ts +42 -6
- package/dist/automations/task-template.js +152 -24
- package/dist/automations/task-template.js.map +1 -1
- package/dist/automations/types.d.ts +142 -6
- package/dist/automations/types.js +64 -6
- package/dist/automations/types.js.map +1 -1
- package/dist/autosave-holders.js +8 -12
- package/dist/autosave-holders.js.map +1 -1
- package/dist/ci-wait/client.d.ts +8 -1
- package/dist/ci-wait/client.js +43 -1
- package/dist/ci-wait/client.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +83 -4
- package/dist/ci-wait/controller.js +76 -11
- package/dist/ci-wait/controller.js.map +1 -1
- package/dist/ci-wait/errors.d.ts +7 -1
- package/dist/ci-wait/errors.js +36 -0
- package/dist/ci-wait/errors.js.map +1 -1
- package/dist/ci-wait/github.d.ts +2 -0
- package/dist/ci-wait/github.js +3 -1
- package/dist/ci-wait/github.js.map +1 -1
- package/dist/ci-wait/mcp.d.ts +2 -98
- package/dist/ci-wait/mcp.js +11 -25
- package/dist/ci-wait/mcp.js.map +1 -1
- package/dist/ci-wait/supervisor.d.ts +2 -1
- package/dist/ci-wait/supervisor.js +2 -1
- package/dist/ci-wait/supervisor.js.map +1 -1
- package/dist/ci-wait/tools.d.ts +307 -0
- package/dist/ci-wait/tools.js +63 -0
- package/dist/ci-wait/tools.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +5 -0
- package/dist/contract/agent-profiles.d.ts +15 -0
- package/dist/contract/automation-schedule.d.ts +60 -0
- package/dist/contract/automations.d.ts +208 -36
- package/dist/contract/delegation.d.ts +96 -0
- package/dist/contract/discovery.d.ts +7 -0
- package/dist/contract/github.d.ts +1 -0
- package/dist/contract/health.d.ts +6 -0
- package/dist/contract/index.d.ts +3 -0
- package/dist/contract/index.js +1445 -745
- package/dist/contract/preview.d.ts +508 -0
- package/dist/contract/runs.d.ts +716 -15
- package/dist/contract/skills.d.ts +39 -0
- package/dist/contract/workflows.d.ts +6 -0
- package/dist/contract/workspace.d.ts +65 -0
- package/dist/contract/zoned-time.d.ts +35 -0
- package/dist/core/agent-env.d.ts +11 -0
- package/dist/core/agent-env.js +27 -5
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.js +7 -0
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +49 -1
- package/dist/core/agent-runner.js +2 -1
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +3 -2
- package/dist/core/backend-detect.js +27 -1
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +1 -0
- package/dist/core/claude-cli-runner.js +69 -19
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.d.ts +1 -0
- package/dist/core/codex-app-server-runner.js +200 -25
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.d.ts +7 -3
- package/dist/core/codex-app-server-transport.js +11 -9
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/cursor-acp-runner.d.ts +1 -0
- package/dist/core/cursor-acp-runner.js +24 -9
- package/dist/core/cursor-acp-runner.js.map +1 -1
- package/dist/core/host-model-catalog.js +2 -0
- package/dist/core/host-model-catalog.js.map +1 -1
- package/dist/core/managed-session.js +2 -0
- package/dist/core/managed-session.js.map +1 -1
- package/dist/core/model-identity.js +2 -0
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +3 -0
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/omp-model-catalog.d.ts +43 -0
- package/dist/core/omp-model-catalog.js +205 -0
- package/dist/core/omp-model-catalog.js.map +1 -0
- package/dist/core/omp-runner.d.ts +73 -0
- package/dist/core/omp-runner.js +990 -0
- package/dist/core/omp-runner.js.map +1 -0
- package/dist/core/omp-ui-mapper.d.ts +106 -0
- package/dist/core/omp-ui-mapper.js +882 -0
- package/dist/core/omp-ui-mapper.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +18 -4
- package/dist/core/opencode-server-runner.js +337 -96
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/opencode-session-error.d.ts +11 -0
- package/dist/core/opencode-session-error.js +26 -0
- package/dist/core/opencode-session-error.js.map +1 -0
- package/dist/core/opencode-ui-mapper.js +4 -36
- package/dist/core/opencode-ui-mapper.js.map +1 -1
- package/dist/core/pi-runner.d.ts +1 -0
- package/dist/core/pi-runner.js +75 -12
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +9 -2
- package/dist/core/provider-auth.js +43 -6
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-factory.js +3 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-model-catalog.js +1 -0
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/runner-stderr.d.ts +2 -0
- package/dist/core/runner-stderr.js +20 -0
- package/dist/core/runner-stderr.js.map +1 -0
- package/dist/core/session-process.d.ts +22 -0
- package/dist/core/session-process.js +202 -0
- package/dist/core/session-process.js.map +1 -0
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/core/usage-limit.js +3 -60
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/data-gitignore.d.ts +6 -0
- package/dist/data-gitignore.js +57 -0
- package/dist/data-gitignore.js.map +1 -0
- package/dist/delegation/capacity.d.ts +19 -0
- package/dist/delegation/capacity.js +34 -0
- package/dist/delegation/capacity.js.map +1 -0
- package/dist/delegation/cli.js +13 -4
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/conversations.d.ts +4 -2
- package/dist/delegation/conversations.js +8 -12
- package/dist/delegation/conversations.js.map +1 -1
- package/dist/delegation/credentials.d.ts +2 -0
- package/dist/delegation/credentials.js +10 -0
- package/dist/delegation/credentials.js.map +1 -1
- package/dist/delegation/destroy-observation.d.ts +42 -0
- package/dist/delegation/destroy-observation.js +115 -0
- package/dist/delegation/destroy-observation.js.map +1 -0
- package/dist/delegation/execution-identity.d.ts +6 -0
- package/dist/delegation/execution-identity.js +1 -1
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/policy.d.ts +3 -2
- package/dist/delegation/policy.js +7 -5
- package/dist/delegation/policy.js.map +1 -1
- package/dist/delegation/process-liveness.d.ts +57 -20
- package/dist/delegation/process-liveness.js +114 -92
- package/dist/delegation/process-liveness.js.map +1 -1
- package/dist/delegation/provision.js +6 -6
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/results.js +4 -2
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/retry-backoff.d.ts +23 -0
- package/dist/delegation/retry-backoff.js +18 -0
- package/dist/delegation/retry-backoff.js.map +1 -0
- package/dist/delegation/routes.d.ts +64 -58
- package/dist/delegation/scratch-cleanup.d.ts +29 -0
- package/dist/delegation/scratch-cleanup.js +143 -0
- package/dist/delegation/scratch-cleanup.js.map +1 -0
- package/dist/delegation/service.d.ts +20 -1
- package/dist/delegation/service.js +233 -70
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +12 -6
- package/dist/delegation/workspace.d.ts +23 -4
- package/dist/delegation/workspace.js +147 -31
- package/dist/delegation/workspace.js.map +1 -1
- package/dist/git-worktree-lock-helper.js +8 -3
- package/dist/git-worktree-lock-helper.js.map +1 -1
- package/dist/git-worktree-lock.d.ts +6 -1
- package/dist/git-worktree-lock.js +10 -4
- package/dist/git-worktree-lock.js.map +1 -1
- package/dist/git-worktree-release.d.ts +20 -0
- package/dist/git-worktree-release.js +27 -0
- package/dist/git-worktree-release.js.map +1 -0
- package/dist/git-worktree.d.ts +8 -2
- package/dist/git-worktree.js +19 -2
- package/dist/git-worktree.js.map +1 -1
- package/dist/handoff.d.ts +2 -2
- package/dist/handoff.js +1 -1
- package/dist/index.js +109 -76
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +5 -1
- package/dist/paths.js.map +1 -1
- package/dist/preview/cdp.d.ts +13 -0
- package/dist/preview/cdp.js +69 -0
- package/dist/preview/cdp.js.map +1 -0
- package/dist/preview/chromium.d.ts +75 -0
- package/dist/preview/chromium.js +394 -0
- package/dist/preview/chromium.js.map +1 -0
- package/dist/preview/dev-server.d.ts +68 -0
- package/dist/preview/dev-server.js +341 -0
- package/dist/preview/dev-server.js.map +1 -0
- package/dist/preview/host.d.ts +154 -0
- package/dist/preview/host.js +681 -0
- package/dist/preview/host.js.map +1 -0
- package/dist/preview/registration.d.ts +63 -0
- package/dist/preview/registration.js +109 -0
- package/dist/preview/registration.js.map +1 -0
- package/dist/preview/session.d.ts +73 -0
- package/dist/preview/session.js +347 -0
- package/dist/preview/session.js.map +1 -0
- package/dist/preview/url.d.ts +6 -0
- package/dist/preview/url.js +17 -0
- package/dist/preview/url.js.map +1 -0
- package/dist/runs/agent-tmpdir-removal.d.ts +15 -0
- package/dist/runs/agent-tmpdir-removal.js +60 -0
- package/dist/runs/agent-tmpdir-removal.js.map +1 -0
- package/dist/runs/agent-tmpdir.d.ts +12 -1
- package/dist/runs/agent-tmpdir.js +123 -34
- package/dist/runs/agent-tmpdir.js.map +1 -1
- package/dist/runs/delegation-state.d.ts +5 -1
- package/dist/runs/delegation-state.js +9 -0
- package/dist/runs/delegation-state.js.map +1 -1
- package/dist/runs/event-history.d.ts +4 -4
- package/dist/runs/event-history.js +97 -117
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/history-compressor.d.ts +29 -0
- package/dist/runs/history-compressor.js +116 -0
- package/dist/runs/history-compressor.js.map +1 -0
- package/dist/runs/history-file.d.ts +36 -0
- package/dist/runs/history-file.js +463 -0
- package/dist/runs/history-file.js.map +1 -0
- package/dist/runs/human-ask-summary.js +18 -13
- package/dist/runs/human-ask-summary.js.map +1 -1
- package/dist/runs/legacy-index.d.ts +62 -0
- package/dist/runs/legacy-index.js +168 -0
- package/dist/runs/legacy-index.js.map +1 -0
- package/dist/runs/raw-record.d.ts +52 -0
- package/dist/runs/raw-record.js +145 -0
- package/dist/runs/raw-record.js.map +1 -0
- package/dist/runs/retention.d.ts +13 -6
- package/dist/runs/retention.js +42 -13
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/run-claims.d.ts +23 -0
- package/dist/runs/run-claims.js +24 -0
- package/dist/runs/run-claims.js.map +1 -0
- package/dist/runs/run-database.d.ts +385 -0
- package/dist/runs/run-database.js +930 -0
- package/dist/runs/run-database.js.map +1 -0
- package/dist/runs/run-index.d.ts +35 -9
- package/dist/runs/run-index.js +200 -25
- package/dist/runs/run-index.js.map +1 -1
- package/dist/runs/run-row.d.ts +44 -0
- package/dist/runs/run-row.js +84 -0
- package/dist/runs/run-row.js.map +1 -0
- package/dist/runs/run-search.d.ts +29 -0
- package/dist/runs/run-search.js +63 -0
- package/dist/runs/run-search.js.map +1 -0
- package/dist/runs/store-open-error.d.ts +24 -0
- package/dist/runs/store-open-error.js +61 -0
- package/dist/runs/store-open-error.js.map +1 -0
- package/dist/runs/store.d.ts +667 -32
- package/dist/runs/store.js +2153 -324
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/transcript-facts.d.ts +77 -0
- package/dist/runs/transcript-facts.js +302 -0
- package/dist/runs/transcript-facts.js.map +1 -0
- package/dist/runs/webhook.js +5 -4
- package/dist/runs/webhook.js.map +1 -1
- package/dist/runs/worker-execution.d.ts +22 -0
- package/dist/runs/worker-execution.js +30 -0
- package/dist/runs/worker-execution.js.map +1 -0
- package/dist/server/capabilities.d.ts +1 -0
- package/dist/server/capabilities.js +2 -0
- package/dist/server/capabilities.js.map +1 -1
- package/dist/server/cockpit-ownership.d.ts +8 -0
- package/dist/server/cockpit-ownership.js +19 -0
- package/dist/server/cockpit-ownership.js.map +1 -1
- package/dist/server/forge/github.d.ts +1 -4
- package/dist/server/forge/github.js +47 -23
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/git.js +1 -1
- package/dist/server/git.js.map +1 -1
- package/dist/server/open-in-app.js +1 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/preview-socket.d.ts +36 -0
- package/dist/server/preview-socket.js +126 -0
- package/dist/server/preview-socket.js.map +1 -0
- package/dist/server/project-context.d.ts +31 -4
- package/dist/server/project-context.js +73 -9
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/provider-action-gate.js +1 -0
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/repo-branches.d.ts +4 -3
- package/dist/server/repo-branches.js +5 -4
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/server.d.ts +4500 -2727
- package/dist/server/server.js +651 -202
- package/dist/server/server.js.map +1 -1
- package/dist/server/upgrade-router.d.ts +23 -0
- package/dist/server/upgrade-router.js +53 -0
- package/dist/server/upgrade-router.js.map +1 -0
- package/dist/server/validators.d.ts +6 -1
- package/dist/server/validators.js +4 -4
- package/dist/server/validators.js.map +1 -1
- package/dist/server/ws.d.ts +16 -16
- package/dist/server/ws.js +56 -54
- package/dist/server/ws.js.map +1 -1
- package/dist/skills-remote.d.ts +14 -0
- package/dist/skills-remote.js +91 -15
- package/dist/skills-remote.js.map +1 -1
- package/dist/task-cli/cli.js +40 -16
- package/dist/task-cli/cli.js.map +1 -1
- package/dist/task-cli/discovery.d.ts +4 -3
- package/dist/task-cli/discovery.js +4 -3
- package/dist/task-cli/discovery.js.map +1 -1
- package/dist/task-cli/http.d.ts +2 -0
- package/dist/task-cli/http.js +10 -4
- package/dist/task-cli/http.js.map +1 -1
- package/dist/task-cli/projections.d.ts +5 -2
- package/dist/task-cli/projections.js +13 -0
- package/dist/task-cli/projections.js.map +1 -1
- package/dist/task-cli/watch.d.ts +15 -2
- package/dist/task-cli/watch.js +31 -9
- package/dist/task-cli/watch.js.map +1 -1
- package/dist/ui-state.d.ts +4 -3
- package/dist/ui-state.js +8 -3
- package/dist/ui-state.js.map +1 -1
- package/dist/workflows/grouped-command.d.ts +31 -0
- package/dist/workflows/grouped-command.js +143 -0
- package/dist/workflows/grouped-command.js.map +1 -0
- package/dist/workflows/run.d.ts +223 -42
- package/dist/workflows/run.js +1316 -398
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +12 -0
- package/dist/workflows/types.js +20 -0
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +5 -1
- package/dist/workspace/agent-accounts.js +1 -0
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.js +1 -1
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +3 -1
- package/dist/workspace/config.js +1 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/worktree-setup.d.ts +85 -0
- package/dist/worktree-setup.js +164 -0
- package/dist/worktree-setup.js.map +1 -0
- package/package.json +7 -5
- package/scripts/benchmark-run-store-fixture.ts +428 -0
- package/scripts/benchmark-run-store.ts +743 -0
- package/scripts/benchmark-stuck-destroys.ts +143 -0
- package/scripts/mock-autonomous.mjs +11 -0
- package/scripts/mock-ci-tool.mjs +20 -5
- package/scripts/mock-claude.mjs +110 -1
- package/scripts/mock-codex-app-server.mjs +117 -2
- package/scripts/mock-codex-coalesce-steer.mjs +59 -0
- package/scripts/mock-codex-reverse-steer.mjs +130 -0
- package/scripts/mock-cursor-acp.mjs +75 -1
- package/scripts/mock-omp-rpc.mjs +605 -0
- package/scripts/mock-opencode-serve.mjs +312 -22
- package/scripts/mock-pi-rpc.mjs +109 -3
- package/scripts/mock-runner-crash.mjs +42 -0
- package/scripts/mock-silent-tail.mjs +78 -0
- package/scripts/mock-turn-messages.mjs +5 -0
- package/scripts/omp-ci-wait.mjs +29 -0
- package/scripts/omp-restrict-delegation.yml +4 -0
- package/scripts/pi-ci-wait.mjs +12 -9
- package/scripts/seed-archive-profile.ts +3 -3
- package/web/dist/assets/agent-accounts-CFOBMVHc.js +1 -0
- package/web/dist/assets/alert-dialog-BrpNUwMt.js +1 -0
- package/web/dist/assets/app-window-CSHwDX9N.js +1 -0
- package/web/dist/assets/button-C_rd7CPp.js +43 -0
- package/web/dist/assets/compare-variants-D6WXhvXA.js +1 -0
- package/web/dist/assets/diff-DrEARXTV.js +3 -0
- package/web/dist/assets/diff-controls-B1-j7nFg.js +1 -0
- package/web/dist/assets/{diff-view-DPn6bQ5W.js → diff-view-DvGLjdTk.js} +3 -3
- package/web/dist/assets/dropdown-menu-BegOZFrj.js +1 -0
- package/web/dist/assets/format-DpNe3S0A.js +1 -0
- package/web/dist/assets/git-toolbar-Cw4ljmhB.js +1 -0
- package/web/dist/assets/github-CfV5sqL0.js +1 -0
- package/web/dist/assets/{image-preview-DJ8cgb1Z.js → image-preview-FOEfqpZP.js} +1 -1
- package/web/dist/assets/index-DgWWlOLy.js +13 -0
- package/web/dist/assets/index-fBFnuvxu.css +1 -0
- package/web/dist/assets/{nav-row-styles-3j64kH5s.js → nav-row-styles-vp2JbhuJ.js} +1 -1
- package/web/dist/assets/play-CmVAj_fu.js +1 -0
- package/web/dist/assets/popover-BohP6WTx.js +1 -0
- package/web/dist/assets/preview-pane-connected-qTA5KNoJ.js +3 -0
- package/web/dist/assets/preview-state-vuMviq6q.js +1 -0
- package/web/dist/assets/prompt-templates-Cubdut_C.js +15 -0
- package/web/dist/assets/repo-git-Cf4t5PD0.js +1 -0
- package/web/dist/assets/{run-diff-5-RRdcVz.js → run-diff-BpkUW37Z.js} +3 -3
- package/web/dist/assets/run-header-68WHf9wV.js +1 -0
- package/web/dist/assets/skills-DiVIgKeU.js +1 -0
- package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
- package/web/dist/assets/status-dot-CqTJHSP9.js +1 -0
- package/web/dist/assets/{tab-link-K0hjzEXR.js → tab-link-B07Hu4QX.js} +1 -1
- package/web/dist/assets/task-changes--lQF6EYf.js +1 -0
- package/web/dist/assets/task-commits-Cx0qy4DN.js +1 -0
- package/web/dist/assets/task-files-D50s-gKW.js +2 -0
- package/web/dist/assets/task-github-item-DaqmSwYT.js +1 -0
- package/web/dist/assets/task-thread-BPQ64lui.js +7 -0
- package/web/dist/assets/{task-thread-Bw_nQuTx.css → task-thread-zNE2Q9E-.css} +1 -1
- package/web/dist/assets/textarea-D20O4Pw0.js +1 -0
- package/web/dist/assets/thread-state-DWcFMrvb.js +4 -0
- package/web/dist/assets/use-hand-to-agent-state-BLIGmwbd.css +1 -0
- package/web/dist/assets/use-hand-to-agent-state-Cy9eyyfL.js +1 -0
- package/web/dist/assets/{utils-fzNfbPzA.js → utils-JsL3ZsJf.js} +1 -1
- package/web/dist/assets/workflows-jwG7uxqi.js +11 -0
- package/web/dist/assets/{zoomable-image-CDmZ_Rtl.js → zoomable-image-BJJ64KGc.js} +1 -1
- package/web/dist/cezarion-lockup-dark.svg +1 -13
- package/web/dist/cezarion-lockup-light.svg +1 -13
- package/web/dist/cezarion-mark-dark.svg +1 -12
- package/web/dist/cezarion-mark-light.svg +1 -12
- package/web/dist/index.html +16 -21
- package/web/dist/assets/agent-accounts-CU2ZDv24.js +0 -1
- package/web/dist/assets/alert-dialog-C-xYE_dg.js +0 -43
- package/web/dist/assets/chevron-right-BENZ-1ZN.js +0 -1
- package/web/dist/assets/collapsible-DD9J91Iv.js +0 -1
- package/web/dist/assets/compare-variants-5FmqpFSN.js +0 -1
- package/web/dist/assets/diff-controls-Bj0YrioE.js +0 -1
- package/web/dist/assets/diff-rE8rm75J2.js +0 -3
- package/web/dist/assets/diff-stat-BKDCSVfJ.js +0 -1
- package/web/dist/assets/dropdown-menu-Ch5BYQh_.js +0 -1
- package/web/dist/assets/format-dBiNDNVe.js +0 -1
- package/web/dist/assets/git-toolbar-ClVvf5iF.js +0 -1
- package/web/dist/assets/github-BkNOyour.css +0 -1
- package/web/dist/assets/github-DeZMeMwJ.js +0 -1
- package/web/dist/assets/github-item-detail-W5F6GVjF.js +0 -1
- package/web/dist/assets/github-sidebar-model-DcMu-IK2.js +0 -1
- package/web/dist/assets/highlighter-CdHqIwFr.js +0 -3
- package/web/dist/assets/index-CatemBEL.js +0 -8
- package/web/dist/assets/index-MvfD8bZJ.css +0 -1
- package/web/dist/assets/markdown-zdKeLIYA.js +0 -2
- package/web/dist/assets/mobile-run-bar-BCfmFi8V.js +0 -1
- package/web/dist/assets/prompt-templates-CBPp39IU.js +0 -15
- package/web/dist/assets/reference-chip-D6owncJT.js +0 -1
- package/web/dist/assets/repo-git-CtdkZFey.js +0 -1
- package/web/dist/assets/run-header-BcjoDi0W.js +0 -1
- package/web/dist/assets/sheet-ChnYVrp1.js +0 -1
- package/web/dist/assets/skills-C8YKp2vr.js +0 -1
- package/web/dist/assets/task-changes-BW8YdWG8.js +0 -1
- package/web/dist/assets/task-commits-q2kB2y6L.js +0 -1
- package/web/dist/assets/task-files-pPL6_3Cr.js +0 -2
- package/web/dist/assets/task-github-item-BXF5R52U.js +0 -1
- package/web/dist/assets/task-thread-DtkFL3EC.js +0 -10
- package/web/dist/assets/textarea-DxlkE-Yd.js +0 -1
- package/web/dist/assets/token-metrics-DIAjrPlM.js +0 -1
- package/web/dist/assets/use-desktop-CrDny2uG.js +0 -1
- package/web/dist/assets/use-submit-shortcut-KWJsC906.js +0 -1
- package/web/dist/assets/workflows-TmcPEj2K.js +0 -11
- /package/web/dist/assets/{lib-BQXq3kEf2.js → lib-BQXq3kEf.js} +0 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { closeSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, rmSync, statSync, truncateSync, appendFileSync, writeFileSync, fstatSync } from 'node:fs';
|
|
4
|
+
import { Socket } from 'node:net';
|
|
5
|
+
import { join, resolve } from 'node:path';
|
|
6
|
+
import { buildCommandEnv } from '../core/agent-env.js';
|
|
7
|
+
import { processStartToken, recordedProcessLive } from '../delegation/process-liveness.js';
|
|
8
|
+
import { CHROMIUM_PID_FILE } from './chromium.js';
|
|
9
|
+
/**
|
|
10
|
+
* Supervisor for one cezar-owned dev server (#781, spec 2026-10-02-live-preview-v1): spawn the
|
|
11
|
+
* registered command in its own process group, TCP-probe until the port answers, and kill the
|
|
12
|
+
* whole group on stop so a command that forks (`npm` -> `node` -> `vite`) frees its port.
|
|
13
|
+
*/
|
|
14
|
+
export const PREVIEW_PORT_WAIT_MS = 2 * 60_000;
|
|
15
|
+
export const PREVIEW_PROBE_MS = 2_000;
|
|
16
|
+
const PROBE_CONNECT_MS = 500;
|
|
17
|
+
const KILL_GRACE_MS = 5_000;
|
|
18
|
+
/** How long a SIGKILLed group gets to disappear before the stop resolves anyway. */
|
|
19
|
+
const KILL_SETTLE_MS = 2_000;
|
|
20
|
+
const LOG_TRIM_ABOVE = 5 * 1024 * 1024;
|
|
21
|
+
const LOG_KEEP = 1024 * 1024;
|
|
22
|
+
const LOG_CHECK_MS = 60_000;
|
|
23
|
+
const TAIL_READ = 64 * 1024;
|
|
24
|
+
function connects(host, port) {
|
|
25
|
+
return new Promise(resolveConnect => {
|
|
26
|
+
const socket = new Socket();
|
|
27
|
+
const done = (up) => { socket.destroy(); resolveConnect(up); };
|
|
28
|
+
socket.setTimeout(PROBE_CONNECT_MS);
|
|
29
|
+
socket.once('connect', () => done(true));
|
|
30
|
+
socket.once('timeout', () => done(false));
|
|
31
|
+
socket.once('error', () => done(false));
|
|
32
|
+
socket.connect(port, host);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Does anything answer on `port`? Vite resolves `localhost` to `::1` on some hosts, so both loopbacks count. */
|
|
36
|
+
export async function probePort(port) {
|
|
37
|
+
return (await connects('127.0.0.1', port)) || (await connects('::1', port));
|
|
38
|
+
}
|
|
39
|
+
const sleep = (ms) => new Promise(resolveSleep => setTimeout(resolveSleep, ms));
|
|
40
|
+
function signalGroup(pgid, signal) {
|
|
41
|
+
if (process.platform === 'win32') {
|
|
42
|
+
return spawnSync('taskkill', ['/pid', String(pgid), '/t', '/f'], { windowsHide: true, timeout: 5_000 }).status === 0;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
process.kill(-pgid, signal);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function groupAlive(pgid) {
|
|
53
|
+
if (process.platform === 'win32')
|
|
54
|
+
return false;
|
|
55
|
+
try {
|
|
56
|
+
process.kill(-pgid, 0);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return error.code === 'EPERM';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** SIGTERM one process, SIGKILL it if it is still there after the grace period. */
|
|
64
|
+
async function terminatePid(pid) {
|
|
65
|
+
try {
|
|
66
|
+
process.kill(pid, 'SIGTERM');
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const alive = () => { try {
|
|
72
|
+
process.kill(pid, 0);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return false;
|
|
77
|
+
} };
|
|
78
|
+
const deadline = Date.now() + KILL_GRACE_MS;
|
|
79
|
+
while (alive() && Date.now() < deadline)
|
|
80
|
+
await sleep(50);
|
|
81
|
+
if (alive()) {
|
|
82
|
+
try {
|
|
83
|
+
process.kill(pid, 'SIGKILL');
|
|
84
|
+
}
|
|
85
|
+
catch { /* gone meanwhile */ }
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** SIGTERM the group, SIGKILL whatever is still there after the grace period. */
|
|
89
|
+
async function terminateGroup(pgid) {
|
|
90
|
+
if (!signalGroup(pgid, 'SIGTERM'))
|
|
91
|
+
return;
|
|
92
|
+
const deadline = Date.now() + KILL_GRACE_MS;
|
|
93
|
+
while (groupAlive(pgid) && Date.now() < deadline)
|
|
94
|
+
await sleep(50);
|
|
95
|
+
if (!groupAlive(pgid))
|
|
96
|
+
return;
|
|
97
|
+
signalGroup(pgid, 'SIGKILL');
|
|
98
|
+
// SIGKILL is delivered, not done: until the kernel tears the processes down they still hold
|
|
99
|
+
// their sockets. Return once the group is gone, so "stopped" means the port is free.
|
|
100
|
+
const killDeadline = Date.now() + KILL_SETTLE_MS;
|
|
101
|
+
while (groupAlive(pgid) && Date.now() < killDeadline)
|
|
102
|
+
await sleep(20);
|
|
103
|
+
}
|
|
104
|
+
/** Keep the last 1 MiB once the log passes 5 MiB. The child holds the file open in append mode, so it keeps writing at the end. */
|
|
105
|
+
export function trimLog(path) {
|
|
106
|
+
try {
|
|
107
|
+
if (statSync(path).size <= LOG_TRIM_ABOVE)
|
|
108
|
+
return;
|
|
109
|
+
const fd = openSync(path, 'r');
|
|
110
|
+
const tail = Buffer.alloc(LOG_KEEP);
|
|
111
|
+
try {
|
|
112
|
+
readSync(fd, tail, 0, LOG_KEEP, fstatSync(fd).size - LOG_KEEP);
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
closeSync(fd);
|
|
116
|
+
}
|
|
117
|
+
truncateSync(path, 0);
|
|
118
|
+
appendFileSync(path, tail);
|
|
119
|
+
}
|
|
120
|
+
catch { /* a log we cannot trim only grows */ }
|
|
121
|
+
}
|
|
122
|
+
function readTail(path, lines) {
|
|
123
|
+
try {
|
|
124
|
+
const fd = openSync(path, 'r');
|
|
125
|
+
try {
|
|
126
|
+
const size = fstatSync(fd).size;
|
|
127
|
+
const length = Math.min(size, TAIL_READ);
|
|
128
|
+
const buffer = Buffer.alloc(length);
|
|
129
|
+
readSync(fd, buffer, 0, length, size - length);
|
|
130
|
+
return buffer.toString('utf8').split('\n').filter(line => line.trim()).slice(-lines);
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
closeSync(fd);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export class DevServer extends EventEmitter {
|
|
141
|
+
state = 'starting';
|
|
142
|
+
exitCode;
|
|
143
|
+
attempts = 0;
|
|
144
|
+
stopReason;
|
|
145
|
+
server;
|
|
146
|
+
worktreePath;
|
|
147
|
+
dir;
|
|
148
|
+
probeMs;
|
|
149
|
+
waitMs;
|
|
150
|
+
child;
|
|
151
|
+
childExited;
|
|
152
|
+
probeTimer;
|
|
153
|
+
waitTimer;
|
|
154
|
+
logTimer;
|
|
155
|
+
probing = false;
|
|
156
|
+
stopping;
|
|
157
|
+
constructor(opts) {
|
|
158
|
+
super();
|
|
159
|
+
this.server = opts.server;
|
|
160
|
+
this.worktreePath = opts.worktreePath;
|
|
161
|
+
this.dir = opts.dir;
|
|
162
|
+
this.probeMs = opts.probeMs ?? PREVIEW_PROBE_MS;
|
|
163
|
+
this.waitMs = opts.waitMs ?? PREVIEW_PORT_WAIT_MS;
|
|
164
|
+
}
|
|
165
|
+
get pidPath() { return join(this.dir, `${this.server.port}.pid.json`); }
|
|
166
|
+
get logPath() { return join(this.dir, `${this.server.port}.log`); }
|
|
167
|
+
start() {
|
|
168
|
+
if (this.child)
|
|
169
|
+
return;
|
|
170
|
+
mkdirSync(this.dir, { recursive: true });
|
|
171
|
+
// One log per start: after Start again, 5.8 must show this run's failure, not the last one's tail.
|
|
172
|
+
writeFileSync(this.logPath, '', { mode: 0o600 });
|
|
173
|
+
const logFd = openSync(this.logPath, 'a');
|
|
174
|
+
const cwd = resolve(this.worktreePath, this.server.cwd ?? '.');
|
|
175
|
+
// stdin is closed: nobody can answer a prompt from the cockpit, so one fails fast into `exited` with its log.
|
|
176
|
+
// The command is the agent's and runs outside its sandbox: it gets the curated env, never cezar's secrets (#427).
|
|
177
|
+
const env = buildCommandEnv();
|
|
178
|
+
const child = process.platform === 'win32'
|
|
179
|
+
? spawn(this.server.command, { cwd, env, shell: true, windowsHide: true, stdio: ['ignore', logFd, logFd] })
|
|
180
|
+
: spawn('/bin/sh', ['-c', this.server.command], { cwd, env, detached: true, stdio: ['ignore', logFd, logFd] });
|
|
181
|
+
closeSync(logFd);
|
|
182
|
+
this.child = child;
|
|
183
|
+
this.childExited = new Promise(resolveExit => {
|
|
184
|
+
child.once('error', error => {
|
|
185
|
+
try {
|
|
186
|
+
appendFileSync(this.logPath, `cezar could not start the command: ${error.message}\n`);
|
|
187
|
+
}
|
|
188
|
+
catch { /* log is best effort */ }
|
|
189
|
+
resolveExit();
|
|
190
|
+
this.finish('exited');
|
|
191
|
+
});
|
|
192
|
+
child.once('exit', (code) => {
|
|
193
|
+
resolveExit();
|
|
194
|
+
if (code !== null)
|
|
195
|
+
this.exitCode = code;
|
|
196
|
+
const pid = child.pid;
|
|
197
|
+
if (this.stopping || pid === undefined)
|
|
198
|
+
return this.finish(this.stopping ? 'stopped' : 'exited');
|
|
199
|
+
// A leader that dies on its own can leave a forked server holding the port. Reap the group
|
|
200
|
+
// the way a stop does (SIGKILL after the grace period, so a holder that ignores SIGTERM goes
|
|
201
|
+
// too), and keep the pid record until the group is gone: `stop()` awaits the same cleanup.
|
|
202
|
+
this.finish('exited', { keepRecord: true });
|
|
203
|
+
this.stopping = terminateGroup(pid).finally(() => this.removeRecord(pid));
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
if (child.pid !== undefined) {
|
|
207
|
+
writeFileSync(this.pidPath, JSON.stringify({ pid: child.pid, pgid: child.pid, startToken: processStartToken(child.pid) }), { mode: 0o600 });
|
|
208
|
+
this.beginWaiting();
|
|
209
|
+
this.logTimer = setInterval(() => trimLog(this.logPath), LOG_CHECK_MS);
|
|
210
|
+
this.logTimer.unref();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/** The owner pressed "keep waiting" on a stalled server: probe again for another full window. */
|
|
214
|
+
keepWaiting() {
|
|
215
|
+
if (this.state !== 'stalled')
|
|
216
|
+
return;
|
|
217
|
+
this.setState('starting');
|
|
218
|
+
this.beginWaiting();
|
|
219
|
+
}
|
|
220
|
+
stop(reason) {
|
|
221
|
+
if (this.stopping)
|
|
222
|
+
return this.stopping;
|
|
223
|
+
if (this.state === 'exited' || this.state === 'stopped')
|
|
224
|
+
return Promise.resolve();
|
|
225
|
+
this.stopping ??= this.terminate(reason);
|
|
226
|
+
return this.stopping;
|
|
227
|
+
}
|
|
228
|
+
logTail(lines = 4) {
|
|
229
|
+
return readTail(this.logPath, lines);
|
|
230
|
+
}
|
|
231
|
+
async terminate(reason) {
|
|
232
|
+
this.stopReason = reason;
|
|
233
|
+
const pid = this.child?.pid;
|
|
234
|
+
if (pid === undefined) {
|
|
235
|
+
this.finish('stopped');
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
await terminateGroup(pid);
|
|
239
|
+
await this.childExited;
|
|
240
|
+
this.finish('stopped');
|
|
241
|
+
}
|
|
242
|
+
beginWaiting() {
|
|
243
|
+
this.endWaiting();
|
|
244
|
+
this.probeTimer = setInterval(() => { void this.probeOnce(); }, this.probeMs);
|
|
245
|
+
this.waitTimer = setTimeout(() => {
|
|
246
|
+
if (this.state !== 'starting')
|
|
247
|
+
return;
|
|
248
|
+
this.endWaiting();
|
|
249
|
+
this.setState('stalled');
|
|
250
|
+
}, this.waitMs);
|
|
251
|
+
}
|
|
252
|
+
endWaiting() {
|
|
253
|
+
clearInterval(this.probeTimer);
|
|
254
|
+
clearTimeout(this.waitTimer);
|
|
255
|
+
this.probeTimer = this.waitTimer = undefined;
|
|
256
|
+
}
|
|
257
|
+
async probeOnce() {
|
|
258
|
+
if (this.probing || this.state !== 'starting')
|
|
259
|
+
return;
|
|
260
|
+
this.probing = true;
|
|
261
|
+
this.attempts += 1;
|
|
262
|
+
this.emit('attempt', this.attempts);
|
|
263
|
+
const up = await probePort(this.server.port);
|
|
264
|
+
this.probing = false;
|
|
265
|
+
if (up && this.state === 'starting') {
|
|
266
|
+
this.endWaiting();
|
|
267
|
+
this.setState('up');
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/** A terminal state: the process is gone, so timers and (unless its group is still being reaped) the pid record go with it. */
|
|
271
|
+
finish(state, opts = {}) {
|
|
272
|
+
if (this.state === 'exited' || this.state === 'stopped')
|
|
273
|
+
return;
|
|
274
|
+
this.endWaiting();
|
|
275
|
+
clearInterval(this.logTimer);
|
|
276
|
+
if (!opts.keepRecord && this.child?.pid !== undefined)
|
|
277
|
+
this.removeRecord(this.child.pid);
|
|
278
|
+
this.setState(state);
|
|
279
|
+
}
|
|
280
|
+
/** Only our own record: a Start again on the same port may already have written its successor's. */
|
|
281
|
+
removeRecord(pid) {
|
|
282
|
+
try {
|
|
283
|
+
if (JSON.parse(readFileSync(this.pidPath, 'utf8')).pid !== pid)
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
catch { /* missing or unreadable: nothing of ours to keep */ }
|
|
287
|
+
rmSync(this.pidPath, { force: true });
|
|
288
|
+
}
|
|
289
|
+
setState(state) {
|
|
290
|
+
this.state = state;
|
|
291
|
+
this.emit('state', state);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Boot sweep: a crashed cezar leaves pid records behind, `<port>.pid.json` for each dev server and
|
|
296
|
+
* `chromium.pid.json` for the task's browser. Kill only when the recorded pid is still the process
|
|
297
|
+
* we started (an exactly matching start token), so a reused pid is never hit; a missing or
|
|
298
|
+
* unreadable token means skip. A dev server's whole group goes; Chromium shares cezar's group, so
|
|
299
|
+
* only its pid is signalled.
|
|
300
|
+
* The record goes either way, except one `keep` claims: a server or browser the live host still runs.
|
|
301
|
+
* Returns how many processes were killed.
|
|
302
|
+
*/
|
|
303
|
+
export async function sweepPreviewLeftovers(dataDir, opts = {}) {
|
|
304
|
+
const root = join(dataDir, 'preview');
|
|
305
|
+
if (!existsSync(root))
|
|
306
|
+
return 0;
|
|
307
|
+
const kills = [];
|
|
308
|
+
for (const run of readdirSync(root, { withFileTypes: true })) {
|
|
309
|
+
if (!run.isDirectory())
|
|
310
|
+
continue;
|
|
311
|
+
for (const file of readdirSync(join(root, run.name))) {
|
|
312
|
+
if (!file.endsWith('.pid.json'))
|
|
313
|
+
continue;
|
|
314
|
+
const what = file === CHROMIUM_PID_FILE ? 'browser' : Number(file.slice(0, -'.pid.json'.length));
|
|
315
|
+
if (opts.keep?.(run.name, what))
|
|
316
|
+
continue;
|
|
317
|
+
const path = join(root, run.name, file);
|
|
318
|
+
let record;
|
|
319
|
+
try {
|
|
320
|
+
record = JSON.parse(readFileSync(path, 'utf8'));
|
|
321
|
+
}
|
|
322
|
+
catch { /* unreadable: nothing to kill */ }
|
|
323
|
+
rmSync(path, { force: true });
|
|
324
|
+
const { pid, pgid, startToken } = (record ?? {});
|
|
325
|
+
if (typeof pid !== 'number' || typeof startToken !== 'string')
|
|
326
|
+
continue;
|
|
327
|
+
// A dev server leads its own group. The token verifies the pid only, so a record naming
|
|
328
|
+
// another group is not one cezar wrote, and that group is never signalled.
|
|
329
|
+
if (what !== 'browser' && pgid !== pid)
|
|
330
|
+
continue;
|
|
331
|
+
// `recordedProcessLive` answers "alive" on any uncertainty; a kill needs an exact token match,
|
|
332
|
+
// so a record without a token, or a pid whose token cannot be read now, is skipped.
|
|
333
|
+
if (!recordedProcessLive({ pid, startToken }) || processStartToken(pid) !== startToken)
|
|
334
|
+
continue;
|
|
335
|
+
kills.push(what === 'browser' ? terminatePid(pid) : terminateGroup(pid));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
await Promise.all(kills);
|
|
339
|
+
return kills.length;
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=dev-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/preview/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAqB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpL,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;GAIG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,MAAM,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;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oFAAoF;YACpF,IAAI,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,UAAU;gBAAE,SAAS;YACjG,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO,KAAK,CAAC,MAAM,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { PreviewStopRequest, PreviewStopResult, PreviewClientMessage, PreviewServer } from '../contract/index.js';
|
|
2
|
+
import type { RunStore } from '../runs/store.ts';
|
|
3
|
+
import { type Cdp } from './cdp.ts';
|
|
4
|
+
import { DevServer, type DevServerState } from './dev-server.ts';
|
|
5
|
+
import { type PreviewHostLike } from './registration.ts';
|
|
6
|
+
import { type Viewer } from './session.ts';
|
|
7
|
+
/**
|
|
8
|
+
* The workspace-wide preview host (#781, spec 2026-10-02-live-preview-v1): one per server process,
|
|
9
|
+
* because ports are host-global. Keyed by run id, it owns every cezar-started dev server and every
|
|
10
|
+
* task's Chromium, and every exit in the spec's lifecycle table: idle timers, release on worktree
|
|
11
|
+
* removal or run deletion, and shutdown. It starts commands only on owner approval or agent reuse of that unchanged approval.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PREVIEW_SERVER_IDLE_MS: number;
|
|
14
|
+
export declare const PREVIEW_BROWSER_IDLE_MS: number;
|
|
15
|
+
export type RunContext = {
|
|
16
|
+
runId: string;
|
|
17
|
+
title: string;
|
|
18
|
+
worktreePath: string;
|
|
19
|
+
dataDir: string;
|
|
20
|
+
store: Pick<RunStore, 'getRun' | 'appendEvent'>;
|
|
21
|
+
};
|
|
22
|
+
export type PreviewTarget = {
|
|
23
|
+
port: number;
|
|
24
|
+
} | {
|
|
25
|
+
url: string;
|
|
26
|
+
};
|
|
27
|
+
export type BrowserExit = {
|
|
28
|
+
signal?: string;
|
|
29
|
+
stderrTail: string;
|
|
30
|
+
};
|
|
31
|
+
/** A launched Chromium with its page's CDP connection. `exited` settles when the process is gone. */
|
|
32
|
+
export type BrowserHandle = {
|
|
33
|
+
cdp: Cdp;
|
|
34
|
+
exited: Promise<BrowserExit>;
|
|
35
|
+
close(): void;
|
|
36
|
+
};
|
|
37
|
+
/** What the host uses of a `DevServer`: its state, its controls and its two events. */
|
|
38
|
+
export type DevServerLike = Pick<DevServer, 'state' | 'attempts' | 'exitCode' | 'stopReason' | 'start' | 'stop' | 'keepWaiting' | 'logTail'> & {
|
|
39
|
+
on(event: 'state', listener: (state: DevServerState) => void): unknown;
|
|
40
|
+
on(event: 'attempt', listener: (attempts: number) => void): unknown;
|
|
41
|
+
};
|
|
42
|
+
export type PreviewHostDeps = {
|
|
43
|
+
probe?: (port: number) => Promise<boolean>;
|
|
44
|
+
createServer?: (opts: {
|
|
45
|
+
server: PreviewServer;
|
|
46
|
+
worktreePath: string;
|
|
47
|
+
dir: string;
|
|
48
|
+
}) => DevServerLike;
|
|
49
|
+
launchBrowser?: (profileDir: string) => Promise<BrowserHandle>;
|
|
50
|
+
download?: (opts: {
|
|
51
|
+
signal: AbortSignal;
|
|
52
|
+
onProgress(received: number, total: number): void;
|
|
53
|
+
}) => Promise<string>;
|
|
54
|
+
env?: NodeJS.ProcessEnv;
|
|
55
|
+
platform?: string;
|
|
56
|
+
arch?: string;
|
|
57
|
+
/** /etc/os-release, for the install command. */
|
|
58
|
+
osRelease?: () => string;
|
|
59
|
+
};
|
|
60
|
+
/** No Chromium anywhere `resolveChromium` looks: the pane offers the download or the OS command. */
|
|
61
|
+
export declare class ChromiumMissingError extends Error {
|
|
62
|
+
}
|
|
63
|
+
export declare class PreviewHost implements PreviewHostLike {
|
|
64
|
+
private readonly stopping;
|
|
65
|
+
private readonly entries;
|
|
66
|
+
private readonly deps;
|
|
67
|
+
/** Chromium lands in one shared cache, so there is one download for the whole host. */
|
|
68
|
+
private download?;
|
|
69
|
+
constructor(deps?: PreviewHostDeps);
|
|
70
|
+
/**
|
|
71
|
+
* A pane asks for a server or a URL. A registered port is probed again now: answering is
|
|
72
|
+
* adopted and streamed, silent asks for approval. Nothing here spawns a command.
|
|
73
|
+
*/
|
|
74
|
+
open(ctx: RunContext, viewer: Viewer, target: PreviewTarget): Promise<void>;
|
|
75
|
+
/** The owner's approval, also reused by stopPreview after checking the saved approval. */
|
|
76
|
+
run(runId: string, port: number): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* The agent re-registered `port` with a different command, cwd or path. A server cezar runs
|
|
79
|
+
* from the old registration stops, an adoption is forgotten, and a pane on that port is asked
|
|
80
|
+
* to approve the new command: nothing runs it until the owner does.
|
|
81
|
+
*/
|
|
82
|
+
replaced(runId: string, port: number): Promise<void>;
|
|
83
|
+
/** Stops a cezar-owned server. An adopted one is not cezar's to stop: refused with `false`. */
|
|
84
|
+
stop(runId: string, port: number, reason: 'user' | 'idle'): Promise<boolean>;
|
|
85
|
+
/** Reuse only the approval attached to this exact owned process, including after a crash. */
|
|
86
|
+
stopPreview(runId: string, request: PreviewStopRequest, signal?: AbortSignal): Promise<PreviewStopResult>;
|
|
87
|
+
private stopServer;
|
|
88
|
+
keepWaiting(runId: string, port: number): void;
|
|
89
|
+
/** The socket closed. The last viewer leaving starts both idle timers. */
|
|
90
|
+
detach(runId: string, viewer: Viewer): void;
|
|
91
|
+
/** Agent restarts without a viewer need a bound even after the previous idle timer fired. */
|
|
92
|
+
private armServerIdle;
|
|
93
|
+
/** Every message a connected pane sends, already validated against the contract. */
|
|
94
|
+
handle(ctx: RunContext, viewer: Viewer, msg: PreviewClientMessage): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* The run's worktree is going, or the run itself: stop its servers, close its browser, tell the
|
|
97
|
+
* pane. The profile survives unless `deleteProfile` (run deletion), which removes the whole
|
|
98
|
+
* `<dataDir>/preview/<runId>/`. `dataDir` covers a run this process never opened.
|
|
99
|
+
*/
|
|
100
|
+
release(runId: string, opts?: {
|
|
101
|
+
deleteProfile?: boolean;
|
|
102
|
+
dataDir?: string;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
/** The task whose cezar-owned dev server holds `port`. Adopted ports belong to nobody. */
|
|
105
|
+
portOwner(port: number): {
|
|
106
|
+
runId: string;
|
|
107
|
+
title: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
/** Whether this host runs the dev server `<runId>/<port>.pid.json` records: the sweep spares it. */
|
|
110
|
+
ownsServer(runId: string, port: number): boolean;
|
|
111
|
+
/** Whether this host runs the run's Chromium (`<runId>/chromium.pid.json`): the sweep spares it. */
|
|
112
|
+
ownsBrowser(runId: string): boolean;
|
|
113
|
+
probe(port: number): Promise<boolean>;
|
|
114
|
+
/** cezar shuts down: every run is released and every pane closed. */
|
|
115
|
+
close(): Promise<void>;
|
|
116
|
+
private entryFor;
|
|
117
|
+
/** One viewer per run: a second one takes over, and the first is told by whom. */
|
|
118
|
+
private claim;
|
|
119
|
+
/** Tells the pane `port-held` when another task's cezar-owned server holds `server.port`. */
|
|
120
|
+
private heldByOther;
|
|
121
|
+
private registration;
|
|
122
|
+
private runDir;
|
|
123
|
+
private onServerState;
|
|
124
|
+
/** `preview.server-state`, on transitions only. A run already deleted takes no events. */
|
|
125
|
+
private recordState;
|
|
126
|
+
/** The pane's view of a cezar-owned server that is not streaming. */
|
|
127
|
+
private report;
|
|
128
|
+
/** Where a server's page reopens: the page the owner was last on when it is this server's, else the registered root. */
|
|
129
|
+
private serverPage;
|
|
130
|
+
/**
|
|
131
|
+
* Streams a registered server. With `resume`, a live page already on that server is kept as it
|
|
132
|
+
* is: a reconnect, a takeover or a reopen inside the browser idle window must not throw the owner
|
|
133
|
+
* back to the root and lose their form state. Re-attaching restarts the screencast, so the first
|
|
134
|
+
* frame still announces `streaming`.
|
|
135
|
+
*/
|
|
136
|
+
private showServer;
|
|
137
|
+
/** Browser, then page, then the first frame (which the session announces as `streaming`). */
|
|
138
|
+
private show;
|
|
139
|
+
private ensureSession;
|
|
140
|
+
private launch;
|
|
141
|
+
private launchFailed;
|
|
142
|
+
/** Chromium died under us: say so with the server's state, and wait for the owner's Retry. */
|
|
143
|
+
private browserExited;
|
|
144
|
+
private retryBrowser;
|
|
145
|
+
private serverUp;
|
|
146
|
+
private missingState;
|
|
147
|
+
private startDownload;
|
|
148
|
+
/** `first` watches before the download starts, so no progress report is lost. */
|
|
149
|
+
private beginDownload;
|
|
150
|
+
private closeBrowser;
|
|
151
|
+
private clearIdle;
|
|
152
|
+
private releaseEntry;
|
|
153
|
+
private tell;
|
|
154
|
+
}
|