@wjarka/cezarion 0.10.0-pr30.54
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/LICENSE +21 -0
- package/README.md +838 -0
- package/dist/agent-config/account-identity.d.ts +44 -0
- package/dist/agent-config/account-identity.js +128 -0
- package/dist/agent-config/account-identity.js.map +1 -0
- package/dist/agent-config/catalog.d.ts +72 -0
- package/dist/agent-config/catalog.js +223 -0
- package/dist/agent-config/catalog.js.map +1 -0
- package/dist/agent-config/files.d.ts +46 -0
- package/dist/agent-config/files.js +119 -0
- package/dist/agent-config/files.js.map +1 -0
- package/dist/agent-config/model-settings/claude.d.ts +2 -0
- package/dist/agent-config/model-settings/claude.js +11 -0
- package/dist/agent-config/model-settings/claude.js.map +1 -0
- package/dist/agent-config/model-settings/codex.d.ts +2 -0
- package/dist/agent-config/model-settings/codex.js +16 -0
- package/dist/agent-config/model-settings/codex.js.map +1 -0
- package/dist/agent-config/model-settings/opencode.d.ts +2 -0
- package/dist/agent-config/model-settings/opencode.js +8 -0
- package/dist/agent-config/model-settings/opencode.js.map +1 -0
- package/dist/agent-config/model-settings/pi.d.ts +12 -0
- package/dist/agent-config/model-settings/pi.js +18 -0
- package/dist/agent-config/model-settings/pi.js.map +1 -0
- package/dist/agent-config/model-settings/shared.d.ts +9 -0
- package/dist/agent-config/model-settings/shared.js +93 -0
- package/dist/agent-config/model-settings/shared.js.map +1 -0
- package/dist/agent-config/model-settings/types.d.ts +9 -0
- package/dist/agent-config/model-settings/types.js +2 -0
- package/dist/agent-config/model-settings/types.js.map +1 -0
- package/dist/agent-config/models.d.ts +9 -0
- package/dist/agent-config/models.js +32 -0
- package/dist/agent-config/models.js.map +1 -0
- package/dist/agent-config/seed.d.ts +7 -0
- package/dist/agent-config/seed.js +90 -0
- package/dist/agent-config/seed.js.map +1 -0
- package/dist/agent-config/service.d.ts +44 -0
- package/dist/agent-config/service.js +71 -0
- package/dist/agent-config/service.js.map +1 -0
- package/dist/agent-config/validate.d.ts +21 -0
- package/dist/agent-config/validate.js +76 -0
- package/dist/agent-config/validate.js.map +1 -0
- package/dist/automations/coordinator.d.ts +26 -0
- package/dist/automations/coordinator.js +66 -0
- package/dist/automations/coordinator.js.map +1 -0
- package/dist/automations/github-poller.d.ts +74 -0
- package/dist/automations/github-poller.js +234 -0
- package/dist/automations/github-poller.js.map +1 -0
- package/dist/automations/scheduler.d.ts +42 -0
- package/dist/automations/scheduler.js +192 -0
- package/dist/automations/scheduler.js.map +1 -0
- package/dist/automations/store.d.ts +65 -0
- package/dist/automations/store.js +298 -0
- package/dist/automations/store.js.map +1 -0
- package/dist/automations/task-template.d.ts +18 -0
- package/dist/automations/task-template.js +95 -0
- package/dist/automations/task-template.js.map +1 -0
- package/dist/automations/types.d.ts +255 -0
- package/dist/automations/types.js +159 -0
- package/dist/automations/types.js.map +1 -0
- package/dist/config.d.ts +77 -0
- package/dist/config.js +242 -0
- package/dist/config.js.map +1 -0
- package/dist/contract/agent-config.d.ts +153 -0
- package/dist/contract/agent-profiles.d.ts +347 -0
- package/dist/contract/automations.d.ts +935 -0
- package/dist/contract/events.d.ts +104 -0
- package/dist/contract/github.d.ts +556 -0
- package/dist/contract/health.d.ts +102 -0
- package/dist/contract/index.d.ts +16 -0
- package/dist/contract/index.js +1895 -0
- package/dist/contract/projects.d.ts +210 -0
- package/dist/contract/repo.d.ts +234 -0
- package/dist/contract/runs.d.ts +1473 -0
- package/dist/contract/skills.d.ts +232 -0
- package/dist/contract/workflows.d.ts +218 -0
- package/dist/contract/workspace.d.ts +579 -0
- package/dist/core/agent-env.d.ts +31 -0
- package/dist/core/agent-env.js +371 -0
- package/dist/core/agent-env.js.map +1 -0
- package/dist/core/agent-model-policy.d.ts +10 -0
- package/dist/core/agent-model-policy.js +36 -0
- package/dist/core/agent-model-policy.js.map +1 -0
- package/dist/core/agent-profiles.d.ts +62 -0
- package/dist/core/agent-profiles.js +90 -0
- package/dist/core/agent-profiles.js.map +1 -0
- package/dist/core/agent-runner.d.ts +211 -0
- package/dist/core/agent-runner.js +68 -0
- package/dist/core/agent-runner.js.map +1 -0
- package/dist/core/ask.d.ts +105 -0
- package/dist/core/ask.js +187 -0
- package/dist/core/ask.js.map +1 -0
- package/dist/core/backend-detect.d.ts +16 -0
- package/dist/core/backend-detect.js +155 -0
- package/dist/core/backend-detect.js.map +1 -0
- package/dist/core/claude-cli-runner.d.ts +59 -0
- package/dist/core/claude-cli-runner.js +483 -0
- package/dist/core/claude-cli-runner.js.map +1 -0
- package/dist/core/claude-ui-mapper.d.ts +80 -0
- package/dist/core/claude-ui-mapper.js +598 -0
- package/dist/core/claude-ui-mapper.js.map +1 -0
- package/dist/core/codex-app-server-runner.d.ts +41 -0
- package/dist/core/codex-app-server-runner.js +584 -0
- package/dist/core/codex-app-server-runner.js.map +1 -0
- package/dist/core/codex-app-server-transport.d.ts +35 -0
- package/dist/core/codex-app-server-transport.js +150 -0
- package/dist/core/codex-app-server-transport.js.map +1 -0
- package/dist/core/codex-model-catalog.d.ts +10 -0
- package/dist/core/codex-model-catalog.js +110 -0
- package/dist/core/codex-model-catalog.js.map +1 -0
- package/dist/core/codex-ui-mapper.d.ts +112 -0
- package/dist/core/codex-ui-mapper.js +766 -0
- package/dist/core/codex-ui-mapper.js.map +1 -0
- package/dist/core/model-identity.d.ts +125 -0
- package/dist/core/model-identity.js +132 -0
- package/dist/core/model-identity.js.map +1 -0
- package/dist/core/model-presets.d.ts +21 -0
- package/dist/core/model-presets.js +81 -0
- package/dist/core/model-presets.js.map +1 -0
- package/dist/core/ndjson.d.ts +6 -0
- package/dist/core/ndjson.js +23 -0
- package/dist/core/ndjson.js.map +1 -0
- package/dist/core/opencode-model-catalog.d.ts +32 -0
- package/dist/core/opencode-model-catalog.js +153 -0
- package/dist/core/opencode-model-catalog.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +32 -0
- package/dist/core/opencode-server-runner.js +882 -0
- package/dist/core/opencode-server-runner.js.map +1 -0
- package/dist/core/opencode-ui-mapper.d.ts +137 -0
- package/dist/core/opencode-ui-mapper.js +800 -0
- package/dist/core/opencode-ui-mapper.js.map +1 -0
- package/dist/core/pi-model-catalog.d.ts +31 -0
- package/dist/core/pi-model-catalog.js +152 -0
- package/dist/core/pi-model-catalog.js.map +1 -0
- package/dist/core/pi-runner.d.ts +24 -0
- package/dist/core/pi-runner.js +403 -0
- package/dist/core/pi-runner.js.map +1 -0
- package/dist/core/pi-ui-mapper.d.ts +36 -0
- package/dist/core/pi-ui-mapper.js +304 -0
- package/dist/core/pi-ui-mapper.js.map +1 -0
- package/dist/core/process-usage.d.ts +66 -0
- package/dist/core/process-usage.js +193 -0
- package/dist/core/process-usage.js.map +1 -0
- package/dist/core/provider-auth.d.ts +154 -0
- package/dist/core/provider-auth.js +509 -0
- package/dist/core/provider-auth.js.map +1 -0
- package/dist/core/provider-availability.d.ts +3 -0
- package/dist/core/provider-availability.js +14 -0
- package/dist/core/provider-availability.js.map +1 -0
- package/dist/core/runner-factory.d.ts +8 -0
- package/dist/core/runner-factory.js +25 -0
- package/dist/core/runner-factory.js.map +1 -0
- package/dist/core/runner-model-catalog.d.ts +29 -0
- package/dist/core/runner-model-catalog.js +78 -0
- package/dist/core/runner-model-catalog.js.map +1 -0
- package/dist/core/secret-redaction.d.ts +37 -0
- package/dist/core/secret-redaction.js +115 -0
- package/dist/core/secret-redaction.js.map +1 -0
- package/dist/core/shell-env.d.ts +28 -0
- package/dist/core/shell-env.js +56 -0
- package/dist/core/shell-env.js.map +1 -0
- package/dist/core/tool-display.d.ts +31 -0
- package/dist/core/tool-display.js +179 -0
- package/dist/core/tool-display.js.map +1 -0
- package/dist/core/ui-events.d.ts +335 -0
- package/dist/core/ui-events.js +25 -0
- package/dist/core/ui-events.js.map +1 -0
- package/dist/core/usage-limit.d.ts +42 -0
- package/dist/core/usage-limit.js +209 -0
- package/dist/core/usage-limit.js.map +1 -0
- package/dist/core/usage.d.ts +11 -0
- package/dist/core/usage.js +15 -0
- package/dist/core/usage.js.map +1 -0
- package/dist/core/v1-text-coalescer.d.ts +36 -0
- package/dist/core/v1-text-coalescer.js +72 -0
- package/dist/core/v1-text-coalescer.js.map +1 -0
- package/dist/git-diff-base.d.ts +85 -0
- package/dist/git-diff-base.js +180 -0
- package/dist/git-diff-base.js.map +1 -0
- package/dist/git-refs.d.ts +11 -0
- package/dist/git-refs.js +14 -0
- package/dist/git-refs.js.map +1 -0
- package/dist/git-worktree.d.ts +161 -0
- package/dist/git-worktree.js +508 -0
- package/dist/git-worktree.js.map +1 -0
- package/dist/handoff.d.ts +62 -0
- package/dist/handoff.js +154 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +680 -0
- package/dist/index.js.map +1 -0
- package/dist/install-as-command.d.ts +40 -0
- package/dist/install-as-command.js +52 -0
- package/dist/install-as-command.js.map +1 -0
- package/dist/pack-check.d.ts +17 -0
- package/dist/pack-check.js +27 -0
- package/dist/pack-check.js.map +1 -0
- package/dist/paths.d.ts +140 -0
- package/dist/paths.js +192 -0
- package/dist/paths.js.map +1 -0
- package/dist/planner.d.ts +27 -0
- package/dist/planner.js +268 -0
- package/dist/planner.js.map +1 -0
- package/dist/release/manifests.d.ts +81 -0
- package/dist/release/manifests.js +74 -0
- package/dist/release/manifests.js.map +1 -0
- package/dist/release/snapshot.d.ts +67 -0
- package/dist/release/snapshot.js +97 -0
- package/dist/release/snapshot.js.map +1 -0
- package/dist/release/stable.d.ts +38 -0
- package/dist/release/stable.js +55 -0
- package/dist/release/stable.js.map +1 -0
- package/dist/runs/agent-tmpdir.d.ts +41 -0
- package/dist/runs/agent-tmpdir.js +183 -0
- package/dist/runs/agent-tmpdir.js.map +1 -0
- package/dist/runs/auto-name.d.ts +75 -0
- package/dist/runs/auto-name.js +179 -0
- package/dist/runs/auto-name.js.map +1 -0
- package/dist/runs/event-history.d.ts +50 -0
- package/dist/runs/event-history.js +613 -0
- package/dist/runs/event-history.js.map +1 -0
- package/dist/runs/retention.d.ts +60 -0
- package/dist/runs/retention.js +86 -0
- package/dist/runs/retention.js.map +1 -0
- package/dist/runs/review-gate.d.ts +18 -0
- package/dist/runs/review-gate.js +21 -0
- package/dist/runs/review-gate.js.map +1 -0
- package/dist/runs/run-index.d.ts +19 -0
- package/dist/runs/run-index.js +43 -0
- package/dist/runs/run-index.js.map +1 -0
- package/dist/runs/store.d.ts +446 -0
- package/dist/runs/store.js +1118 -0
- package/dist/runs/store.js.map +1 -0
- package/dist/runs/task-markers.d.ts +28 -0
- package/dist/runs/task-markers.js +74 -0
- package/dist/runs/task-markers.js.map +1 -0
- package/dist/runs/task-refs.d.ts +25 -0
- package/dist/runs/task-refs.js +74 -0
- package/dist/runs/task-refs.js.map +1 -0
- package/dist/runs/ui-event-sink.d.ts +81 -0
- package/dist/runs/ui-event-sink.js +210 -0
- package/dist/runs/ui-event-sink.js.map +1 -0
- package/dist/server/app-type.d.ts +21 -0
- package/dist/server/app-type.js +2 -0
- package/dist/server/app-type.js.map +1 -0
- package/dist/server/capabilities.d.ts +70 -0
- package/dist/server/capabilities.js +152 -0
- package/dist/server/capabilities.js.map +1 -0
- package/dist/server/checkout.d.ts +128 -0
- package/dist/server/checkout.js +296 -0
- package/dist/server/checkout.js.map +1 -0
- package/dist/server/forge/github.d.ts +513 -0
- package/dist/server/forge/github.js +2364 -0
- package/dist/server/forge/github.js.map +1 -0
- package/dist/server/forge/index.d.ts +40 -0
- package/dist/server/forge/index.js +72 -0
- package/dist/server/forge/index.js.map +1 -0
- package/dist/server/forge/types.d.ts +242 -0
- package/dist/server/forge/types.js +2 -0
- package/dist/server/forge/types.js.map +1 -0
- package/dist/server/fs-browse.d.ts +105 -0
- package/dist/server/fs-browse.js +182 -0
- package/dist/server/fs-browse.js.map +1 -0
- package/dist/server/git-changes.d.ts +213 -0
- package/dist/server/git-changes.js +555 -0
- package/dist/server/git-changes.js.map +1 -0
- package/dist/server/git.d.ts +28 -0
- package/dist/server/git.js +112 -0
- package/dist/server/git.js.map +1 -0
- package/dist/server/github.d.ts +9 -0
- package/dist/server/github.js +8 -0
- package/dist/server/github.js.map +1 -0
- package/dist/server/launch-key.d.ts +7 -0
- package/dist/server/launch-key.js +33 -0
- package/dist/server/launch-key.js.map +1 -0
- package/dist/server/open-in-app.d.ts +66 -0
- package/dist/server/open-in-app.js +211 -0
- package/dist/server/open-in-app.js.map +1 -0
- package/dist/server/open-in-terminal.d.ts +70 -0
- package/dist/server/open-in-terminal.js +179 -0
- package/dist/server/open-in-terminal.js.map +1 -0
- package/dist/server/pr.d.ts +7 -0
- package/dist/server/pr.js +7 -0
- package/dist/server/pr.js.map +1 -0
- package/dist/server/project-context.d.ts +120 -0
- package/dist/server/project-context.js +182 -0
- package/dist/server/project-context.js.map +1 -0
- package/dist/server/provider-action-gate.d.ts +8 -0
- package/dist/server/provider-action-gate.js +56 -0
- package/dist/server/provider-action-gate.js.map +1 -0
- package/dist/server/provider-auth-runtime.d.ts +21 -0
- package/dist/server/provider-auth-runtime.js +66 -0
- package/dist/server/provider-auth-runtime.js.map +1 -0
- package/dist/server/server.d.ts +13138 -0
- package/dist/server/server.js +5263 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/static-ui.d.ts +49 -0
- package/dist/server/static-ui.js +92 -0
- package/dist/server/static-ui.js.map +1 -0
- package/dist/server/validators.d.ts +97 -0
- package/dist/server/validators.js +86 -0
- package/dist/server/validators.js.map +1 -0
- package/dist/server/ws.d.ts +85 -0
- package/dist/server/ws.js +218 -0
- package/dist/server/ws.js.map +1 -0
- package/dist/server/wsl.d.ts +25 -0
- package/dist/server/wsl.js +92 -0
- package/dist/server/wsl.js.map +1 -0
- package/dist/server-install/engine.d.ts +50 -0
- package/dist/server-install/engine.js +324 -0
- package/dist/server-install/engine.js.map +1 -0
- package/dist/server-install/platforms/macosx-ngrok.d.ts +6 -0
- package/dist/server-install/platforms/macosx-ngrok.js +345 -0
- package/dist/server-install/platforms/macosx-ngrok.js.map +1 -0
- package/dist/server-install/platforms/ubuntu-vps.d.ts +78 -0
- package/dist/server-install/platforms/ubuntu-vps.js +1016 -0
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -0
- package/dist/server-install/state.d.ts +52 -0
- package/dist/server-install/state.js +182 -0
- package/dist/server-install/state.js.map +1 -0
- package/dist/server-install/steps.d.ts +109 -0
- package/dist/server-install/steps.js +334 -0
- package/dist/server-install/steps.js.map +1 -0
- package/dist/server-install/strategies.d.ts +4 -0
- package/dist/server-install/strategies.js +20 -0
- package/dist/server-install/strategies.js.map +1 -0
- package/dist/server-install/types.d.ts +287 -0
- package/dist/server-install/types.js +121 -0
- package/dist/server-install/types.js.map +1 -0
- package/dist/server-install/ui.d.ts +42 -0
- package/dist/server-install/ui.js +130 -0
- package/dist/server-install/ui.js.map +1 -0
- package/dist/skills-banner.d.ts +22 -0
- package/dist/skills-banner.js +41 -0
- package/dist/skills-banner.js.map +1 -0
- package/dist/skills-remote.d.ts +84 -0
- package/dist/skills-remote.js +468 -0
- package/dist/skills-remote.js.map +1 -0
- package/dist/skills-update.d.ts +88 -0
- package/dist/skills-update.js +392 -0
- package/dist/skills-update.js.map +1 -0
- package/dist/skills.d.ts +82 -0
- package/dist/skills.js +251 -0
- package/dist/skills.js.map +1 -0
- package/dist/todos.d.ts +48 -0
- package/dist/todos.js +201 -0
- package/dist/todos.js.map +1 -0
- package/dist/ui-state.d.ts +26 -0
- package/dist/ui-state.js +38 -0
- package/dist/ui-state.js.map +1 -0
- package/dist/update-check.d.ts +12 -0
- package/dist/update-check.js +41 -0
- package/dist/update-check.js.map +1 -0
- package/dist/workflows/load.d.ts +15 -0
- package/dist/workflows/load.js +56 -0
- package/dist/workflows/load.js.map +1 -0
- package/dist/workflows/run.d.ts +758 -0
- package/dist/workflows/run.js +3389 -0
- package/dist/workflows/run.js.map +1 -0
- package/dist/workflows/types.d.ts +153 -0
- package/dist/workflows/types.js +212 -0
- package/dist/workflows/types.js.map +1 -0
- package/dist/workspace/agent-accounts.d.ts +153 -0
- package/dist/workspace/agent-accounts.js +304 -0
- package/dist/workspace/agent-accounts.js.map +1 -0
- package/dist/workspace/agent-profiles.d.ts +78 -0
- package/dist/workspace/agent-profiles.js +115 -0
- package/dist/workspace/agent-profiles.js.map +1 -0
- package/dist/workspace/config.d.ts +169 -0
- package/dist/workspace/config.js +379 -0
- package/dist/workspace/config.js.map +1 -0
- package/dist/workspace/migrations.d.ts +45 -0
- package/dist/workspace/migrations.js +147 -0
- package/dist/workspace/migrations.js.map +1 -0
- package/dist/workspace/projects-cli.d.ts +25 -0
- package/dist/workspace/projects-cli.js +172 -0
- package/dist/workspace/projects-cli.js.map +1 -0
- package/dist/workspace/projects.d.ts +109 -0
- package/dist/workspace/projects.js +250 -0
- package/dist/workspace/projects.js.map +1 -0
- package/dist/workspace/semaphore.d.ts +179 -0
- package/dist/workspace/semaphore.js +195 -0
- package/dist/workspace/semaphore.js.map +1 -0
- package/dist/workspace/ui-state.d.ts +34 -0
- package/dist/workspace/ui-state.js +53 -0
- package/dist/workspace/ui-state.js.map +1 -0
- package/package.json +70 -0
- package/scripts/check-pack.mjs +46 -0
- package/scripts/inline-contract.mjs +112 -0
- package/scripts/install-as-command.mjs +120 -0
- package/scripts/mock-claude.mjs +520 -0
- package/scripts/mock-pi-rpc.mjs +83 -0
- package/scripts/sync-readme.mjs +20 -0
- package/scripts/test-process-usage.mjs +47 -0
- package/web/dist/assets/alert-dialog-B4Ofsgv7.js +1 -0
- package/web/dist/assets/arrow-down-Dy8dup7j.js +1 -0
- package/web/dist/assets/arrow-left-BJaucbhn.js +1 -0
- package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
- package/web/dist/assets/centered-state-duPW0phQ.js +43 -0
- package/web/dist/assets/chevron-right-Be4A5TCS.js +1 -0
- package/web/dist/assets/chunk-BO2N2NFS-DE6qKn3r.js +131 -0
- package/web/dist/assets/collapsible-DdcNBdSk.js +1 -0
- package/web/dist/assets/commit-list-CgvN9vec.js +1 -0
- package/web/dist/assets/compare-variants-CQA2nd65.js +1 -0
- package/web/dist/assets/core-BCsw8oQw.js +12 -0
- package/web/dist/assets/css-BsVw1vtW.js +1 -0
- package/web/dist/assets/diff-B6Agp5Hl.js +3 -0
- package/web/dist/assets/diff-stat-BoXuGkgq.js +1 -0
- package/web/dist/assets/diff-view-CD8XI-fj.js +6 -0
- package/web/dist/assets/diff-woXpYk--.js +1 -0
- package/web/dist/assets/dropdown-menu-B3SYw-k5.js +1 -0
- package/web/dist/assets/editable-title-B-hjp5wl.js +1 -0
- package/web/dist/assets/ellipsis-vertical-BYwzw0xl.js +1 -0
- package/web/dist/assets/engine-javascript-FQvzRocB.js +141 -0
- package/web/dist/assets/file-BRj5eISx.js +1 -0
- package/web/dist/assets/folder-z4oT5981.js +1 -0
- package/web/dist/assets/git-toolbar-owSEkYld.js +1 -0
- package/web/dist/assets/github-Bz2VgRX3.js +1 -0
- package/web/dist/assets/go-rLFTqkRN.js +1 -0
- package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
- package/web/dist/assets/highlighter-CdHqIwFr.js +3 -0
- package/web/dist/assets/html-BY76lXLH.js +1 -0
- package/web/dist/assets/image-preview-h3WFluuy.js +1 -0
- package/web/dist/assets/index-BbcQNT92.css +2 -0
- package/web/dist/assets/index-EtQQQ6Kj.js +7 -0
- package/web/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/web/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/web/dist/assets/javascript-BgS3c2Ky.js +1 -0
- package/web/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/web/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/web/dist/assets/json-qhed-kSA.js +1 -0
- package/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
- package/web/dist/assets/jsx-Bz0zcwM4.js +1 -0
- package/web/dist/assets/lib-BQXq3kEf.js +1 -0
- package/web/dist/assets/lib-BxQXEXDF.js +1 -0
- package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/web/dist/assets/markdown-DqBKYPiB.js +2 -0
- package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
- package/web/dist/assets/new-task-form-BdJKRBJX.js +1 -0
- package/web/dist/assets/pill-BQfmfpYp.js +1 -0
- package/web/dist/assets/project-router-DxgFZY1l.js +1 -0
- package/web/dist/assets/prompt-templates-B6m16gq-.js +15 -0
- package/web/dist/assets/python-gzcpVVnB.js +1 -0
- package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
- package/web/dist/assets/refresh-cw-mhSpxf2a.js +1 -0
- package/web/dist/assets/repo-git-CUNRxR3_.js +1 -0
- package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/web/dist/assets/run-diff-DsmmDVfx.js +3 -0
- package/web/dist/assets/run-header-BkhrseLJ.js +1 -0
- package/web/dist/assets/rust-Cfkwpbl8.js +1 -0
- package/web/dist/assets/search-x-BqDMB2g8.js +1 -0
- package/web/dist/assets/shellscript-CLZ0U2zV.js +1 -0
- package/web/dist/assets/skill-empty-hint-BWEvTggc.js +1 -0
- package/web/dist/assets/skills-9oR_oHse.js +1 -0
- package/web/dist/assets/skills-DwIxnnWO.js +1 -0
- package/web/dist/assets/sparkles-DIoTQpyx.js +1 -0
- package/web/dist/assets/sql-BsFa4tDR.js +1 -0
- package/web/dist/assets/square-terminal-Cc7CuQxc.js +1 -0
- package/web/dist/assets/tab-link-D1fQgpmO.js +1 -0
- package/web/dist/assets/task-changes-BKeLlDpK.js +1 -0
- package/web/dist/assets/task-commits-gcEFZIa5.js +1 -0
- package/web/dist/assets/task-files-BGAqoXTW.js +2 -0
- package/web/dist/assets/task-thread-DT8aUYTS.js +9 -0
- package/web/dist/assets/textarea-BOVbfy5C.js +1 -0
- package/web/dist/assets/thread-loading-CypW73KD.js +1 -0
- package/web/dist/assets/toml-CcmNWLt0.js +1 -0
- package/web/dist/assets/trash-2-CJq6LHWn.js +1 -0
- package/web/dist/assets/triangle-alert-CjDFvU27.js +1 -0
- package/web/dist/assets/tsx-udAQXfEw.js +1 -0
- package/web/dist/assets/typescript-bsJCZSQ-.js +1 -0
- package/web/dist/assets/upload-CPDZlJeK.js +1 -0
- package/web/dist/assets/use-desktop-5JsLmi0a.js +1 -0
- package/web/dist/assets/use-submit-shortcut-CHVFevty.js +1 -0
- package/web/dist/assets/utils-DiO6zyJd.js +64 -0
- package/web/dist/assets/workflows-rQDFzWRt.js +11 -0
- package/web/dist/assets/yaml-rwi0_p6S.js +1 -0
- package/web/dist/assets/zoomable-image-COWqb11v.js +1 -0
- package/web/dist/index.html +80 -0
- package/web/dist/open-mercato.svg +11 -0
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
import type { RunnerId } from '../core/agent-runner.ts';
|
|
2
|
+
import type { ContentBlock } from '../core/agent-runner.ts';
|
|
3
|
+
import { type Skill } from '../skills.ts';
|
|
4
|
+
import type { QueuedMessage, RunRecord, RunStore } from '../runs/store.ts';
|
|
5
|
+
import { WorkspaceSemaphore, type AccountHolds } from '../workspace/semaphore.ts';
|
|
6
|
+
import { type WorkflowDef } from './types.ts';
|
|
7
|
+
/** An interactive session that hears nothing from the user closes itself. */
|
|
8
|
+
export declare const IDLE_TIMEOUT_MS: number;
|
|
9
|
+
/**
|
|
10
|
+
* Preserve boundaries between complete assistant text blocks while a turn is
|
|
11
|
+
* accumulated for marker parsing. The runners join these same v1 blocks with
|
|
12
|
+
* newlines in `AgentRunResult`; matching that contract here prevents a
|
|
13
|
+
* trailing `CEZ:TITLE=` block from absorbing later commentary (#623).
|
|
14
|
+
*/
|
|
15
|
+
export declare function appendTurnText(current: string, next: string): string;
|
|
16
|
+
/** Periodic "cezar autosave" commit in the task worktree (spec 006). */
|
|
17
|
+
export declare const AUTOSAVE_INTERVAL_MS = 90000;
|
|
18
|
+
/** The periodic autosave timer is opt-in (#471): off, a task branch carries only the
|
|
19
|
+
* agent's own commits plus the turn-end/pre-PR flushes — no mid-run "cezar autosave"
|
|
20
|
+
* noise interleaving PR history. The flushes (`autosaveCommit` at turn end and before
|
|
21
|
+
* a draft PR) are NOT gated: the branch must still end holding the finished state. */
|
|
22
|
+
export declare function periodicAutosaveEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Explicitly opt out of the repository-root lease for runs that execute in the
|
|
25
|
+
* current checkout. This covers explicit worktree opt-out, non-Git degradation,
|
|
26
|
+
* and continuations whose worktree cannot be restored (spec 006 hardening, #438).
|
|
27
|
+
* This is intentionally unsafe: concurrent agents may overwrite each other's
|
|
28
|
+
* files or Git state. Isolated worktree runs are unaffected.
|
|
29
|
+
*/
|
|
30
|
+
export declare function repositoryRootLockDisabled(env?: NodeJS.ProcessEnv): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Auto-resume after a provider usage limit (spec 2026-08-03-auto-resume-after-usage-limit).
|
|
33
|
+
*
|
|
34
|
+
* The wait is the provider's own reset instant plus this grace: resuming AT the boundary races the
|
|
35
|
+
* provider's clock (and its rounding), and one failed resume costs the whole window over again.
|
|
36
|
+
* Thirty seconds is cheap next to five hours and long enough to be past any sane skew.
|
|
37
|
+
*/
|
|
38
|
+
export declare const AUTO_RESUME_GRACE_MS = 30000;
|
|
39
|
+
/**
|
|
40
|
+
* Consecutive automatic resumes allowed without a human turn. A resume can only fire after a real
|
|
41
|
+
* reset instant, so this is not a throttle — it is the backstop for the pathological case (a
|
|
42
|
+
* provider that answers "limit reached, retry now" in a loop), and it is deliberately generous
|
|
43
|
+
* enough to sit through a couple of days of five-hour windows.
|
|
44
|
+
*/
|
|
45
|
+
export declare const MAX_AUTO_RESUMES = 12;
|
|
46
|
+
/**
|
|
47
|
+
* How long a missed deadline stays worth acting on. The promise is "we pick this up when the
|
|
48
|
+
* window reopens" — kept across a restart or an overnight close, which is the case the feature
|
|
49
|
+
* exists for. A day later it is no longer that promise: the user has moved on, and a task
|
|
50
|
+
* springing back to life is a surprise rather than a service. Such a deadline is retired with a
|
|
51
|
+
* note instead of fired, so the only tasks a sweep can revive are ones someone is still waiting on.
|
|
52
|
+
*/
|
|
53
|
+
export declare const AUTO_RESUME_MISSED_WINDOW_MS: number;
|
|
54
|
+
/**
|
|
55
|
+
* How often the queue checks that it is not wedged.
|
|
56
|
+
*
|
|
57
|
+
* A hold is the only thing in the engine that can make an idle queue CORRECT, so it is also the
|
|
58
|
+
* only thing that can make a wedged one look correct. This tick is the way out: cheap (a few
|
|
59
|
+
* in-memory checks), unref'd, and it only ever acts when idling has no justification left.
|
|
60
|
+
*/
|
|
61
|
+
export declare const QUEUE_WATCHDOG_MS = 60000;
|
|
62
|
+
/**
|
|
63
|
+
* Which agent ACCOUNT a run's work runs on — the thing a provider usage limit actually closes
|
|
64
|
+
* (spec 2026-08-03-auto-resume-after-usage-limit).
|
|
65
|
+
*
|
|
66
|
+
* Backend plus agent account, because those are the two axes a limit is scoped to: a Claude
|
|
67
|
+
* limit must never stall a Codex task, and a second Claude login is a second budget. A record
|
|
68
|
+
* that names no runner has not started yet and will take the configured default, which is what
|
|
69
|
+
* `fallbackRunner` carries; a run that HAS started always carries its resolved runner (execute
|
|
70
|
+
* persists it), and only started runs can be holding.
|
|
71
|
+
*/
|
|
72
|
+
export declare function runAccountKey(run: Pick<RunRecord, 'runner' | 'agentProfile'>, fallbackRunner: RunnerId): string;
|
|
73
|
+
export interface StartRunInput {
|
|
74
|
+
task: string;
|
|
75
|
+
model?: string;
|
|
76
|
+
/** Agent backend chosen for this task (GUI). Unset = the config default. */
|
|
77
|
+
runner?: RunnerId;
|
|
78
|
+
/** Agent account for this task (spec 2026-07-29-agent-profiles), applying to steps that run
|
|
79
|
+
* on `runner`. Unset = the project's own selection. Persisted on the record so the choice
|
|
80
|
+
* survives into resume and Continue, and so the thread can say which account did the work. */
|
|
81
|
+
agentProfile?: string;
|
|
82
|
+
/** Screenshots pasted into the new-task form — persisted when the run is
|
|
83
|
+
* created and delivered once, with the first agent step's opening message. */
|
|
84
|
+
images?: ContentBlock[];
|
|
85
|
+
/** Per-run system-prompt override (`POST /api/runs`, programmatic callers).
|
|
86
|
+
* Replaces the `config.json` default for this run — see
|
|
87
|
+
* `resolveExtraSystemPrompt` for the precedence contract. */
|
|
88
|
+
systemPrompt?: string;
|
|
89
|
+
/** Composer opt-out (#worktree-toggle): `false` runs the task in the repo
|
|
90
|
+
* working tree instead of an isolated worktree. Undefined/`true` keeps the
|
|
91
|
+
* default per-task worktree. Ignored for variants (they always isolate). */
|
|
92
|
+
worktree?: boolean;
|
|
93
|
+
/** Autonomous mode (#autonomous): the run never parks at `waiting` for the
|
|
94
|
+
* user — turn-ends auto-continue until the agent signals done or the safety
|
|
95
|
+
* cap is hit. No "needs you" is ever raised. */
|
|
96
|
+
autonomous?: boolean;
|
|
97
|
+
/** Follow-up inbox generation (spec 007, #444). Omitted means enabled for
|
|
98
|
+
* compatibility; the handoff journal runs either way. */
|
|
99
|
+
generateFollowups?: boolean;
|
|
100
|
+
/** Attachments from the queued prompt stack (#472), re-encoded from disk by
|
|
101
|
+
* `hydrateQueuedInput` at dequeue. Kept separate from `images` because those
|
|
102
|
+
* are persisted into `taskImages` by `startRun()` — folding
|
|
103
|
+
* the stack's (already-persisted) files in there would write duplicate files
|
|
104
|
+
* and make the task bubble render the stack's images as its own. In-memory
|
|
105
|
+
* only: rebuilt from the record on every hydration, never persisted. */
|
|
106
|
+
stackedImages?: ContentBlock[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The effective "extra" system prompt for a run (spec §protocol v2, R2 2.3):
|
|
110
|
+
* the per-run override (`POST /api/runs` `systemPrompt`) REPLACES the
|
|
111
|
+
* `config.json` default — they are the same knob at two scopes, so the more
|
|
112
|
+
* specific one wins outright; they never concatenate. Whichever wins is
|
|
113
|
+
* ADDITIVE to the skill body and the handoff contract, which always ride
|
|
114
|
+
* along (see `composeSystemPrompt`). Blank strings count as unset.
|
|
115
|
+
*/
|
|
116
|
+
export declare function resolveExtraSystemPrompt(override: string | undefined, configDefault: string | undefined): string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Joins the parts of one agent step's system prompt in fixed order — skill
|
|
119
|
+
* body (most task-specific), then the run's extra prompt (user guidance, can
|
|
120
|
+
* amend the skill), then the handoff contract (always last, never optional in
|
|
121
|
+
* practice). Blank parts drop out; survivors join with the same `\n\n---\n\n`
|
|
122
|
+
* divider the skill+handoff composition has always used.
|
|
123
|
+
*/
|
|
124
|
+
export declare function composeSystemPrompt(...parts: Array<string | undefined>): string;
|
|
125
|
+
/**
|
|
126
|
+
* The directories a spawned agent may reach outside its worktree: the run-state
|
|
127
|
+
* folder that holds its handoff file, plus its own temp directory when this run
|
|
128
|
+
* got one (#785). Handing an agent a `TMPDIR` its file tools are not allowed to
|
|
129
|
+
* write would trade one silent failure for another, so the two travel together;
|
|
130
|
+
* under `CEZ_AGENT_TMPDIR=0` there is no per-run directory and the list is
|
|
131
|
+
* exactly what it always was.
|
|
132
|
+
*/
|
|
133
|
+
export declare function agentDirectories(runsDir: string, env: Record<string, string>): string[];
|
|
134
|
+
/**
|
|
135
|
+
* Materialized pasted attachment: the on-disk name/serving-URL pair the
|
|
136
|
+
* transcript already used, plus the absolute path that lets the agent
|
|
137
|
+
* operate on the file itself — save it, `cp` it, attach it to a GitHub
|
|
138
|
+
* issue/PR (#357). `path` is only ever an absolute path under
|
|
139
|
+
* `.ai/cezar/runs/<runId>-images/` (see `RunManager.persistImage`).
|
|
140
|
+
*/
|
|
141
|
+
/** Inverse of `persistImage`'s extension mapping (#472) — a persisted attachment
|
|
142
|
+
* is re-encoded from disk at dequeue and needs its media type back. */
|
|
143
|
+
export declare function mediaTypeFor(name: string): string;
|
|
144
|
+
/** Highest `<prefix>-<n>.<ext>` suffix already present in a run's image dir (#472).
|
|
145
|
+
* `screenshot-*` and `pasted-*` share one numbering space, so this scans both and
|
|
146
|
+
* returns 0 for a missing/empty directory. */
|
|
147
|
+
export declare function highestImageSeq(dir: string): number;
|
|
148
|
+
export interface PersistedAttachment {
|
|
149
|
+
name: string;
|
|
150
|
+
url: string;
|
|
151
|
+
path: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Plain-text note listing the absolute paths of pasted attachments, appended
|
|
155
|
+
* to the message that carries them (#357). The base64 image blocks stay in
|
|
156
|
+
* the message for the model to *view*; this note is what lets it *use* the
|
|
157
|
+
* files as files — and the only usable reference on backends (codex,
|
|
158
|
+
* opencode) whose `textOf()` drops image blocks before reaching the model.
|
|
159
|
+
*/
|
|
160
|
+
export declare function pastedAttachmentsText(attachments: PersistedAttachment[]): string;
|
|
161
|
+
/** Same note as `pastedAttachmentsText`, wrapped as a trailing `ContentBlock`
|
|
162
|
+
* ready to append to a message's content array. */
|
|
163
|
+
export declare function pastedAttachmentsNote(attachments: PersistedAttachment[]): ContentBlock;
|
|
164
|
+
/** Variant letters + the fixed diversification hints (spec 010). A runs the
|
|
165
|
+
* task verbatim; B/C get one constant sentence each — zero configuration. */
|
|
166
|
+
export declare const VARIANT_LETTERS: readonly ['A', 'B', 'C'];
|
|
167
|
+
/**
|
|
168
|
+
* The mini workflow engine: executes a `WorkflowDef` against a repo, one step
|
|
169
|
+
* at a time, persisting every event to the RunStore (which the SSE endpoints
|
|
170
|
+
* relay live to the GUI). No GitHub choreography — agent steps and shell
|
|
171
|
+
* checks with bounded retry loops, plus live sessions: the last agent step
|
|
172
|
+
* stays open for follow-ups (`waiting`) until "finish", idle timeout, or
|
|
173
|
+
* cancel. Runs queue behind the workspace-wide `maxParallel` slots (the shared
|
|
174
|
+
* `WorkspaceSemaphore`, spec 2026-07-20 step 2.5) and each run executes in its
|
|
175
|
+
* own git worktree on a `cez/<id8>` branch (spec 006), autosave-committed at
|
|
176
|
+
* turn end and before a draft PR — plus every 90 s when opted in via
|
|
177
|
+
* CEZ_AUTOSAVE=1 (#471). Each autosave records its trigger in the commit
|
|
178
|
+
* subject, so the always-on flushes are not mistaken for the opt-in timer.
|
|
179
|
+
* The user's working tree is never touched.
|
|
180
|
+
*/
|
|
181
|
+
export declare class RunManager {
|
|
182
|
+
private readonly store;
|
|
183
|
+
private readonly repoRoot;
|
|
184
|
+
private readonly active;
|
|
185
|
+
private readonly queue;
|
|
186
|
+
private readonly starting;
|
|
187
|
+
private readonly waiting;
|
|
188
|
+
/** Durable monitoring subset. Only the configured number receives the waiting-slot exemption. */
|
|
189
|
+
private readonly monitoring;
|
|
190
|
+
private readonly pendingJobs;
|
|
191
|
+
/** Interrupted agent turns recovered after a process restart. Unlike an
|
|
192
|
+
* explicit user Continue, these are bulk scheduler work and must re-enter
|
|
193
|
+
* through `pump()` so both workspace and per-project caps are honored. */
|
|
194
|
+
private readonly pendingContinuations;
|
|
195
|
+
/** Per-run image counter behind `pasted-<n>` / `screenshot-<n>` (#472). Lives on
|
|
196
|
+
* the manager rather than the `ActiveRun` so a *queued* run — which has no
|
|
197
|
+
* `ActiveRun` at all — can persist attachments. Seeded lazily from disk. */
|
|
198
|
+
private readonly queuedImageSeq;
|
|
199
|
+
/** Messages that landed in the dequeue → session-open gap (#472), flushed as
|
|
200
|
+
* ordinary follow-up turns the moment the session opens. In-memory only. */
|
|
201
|
+
private readonly deferredMessages;
|
|
202
|
+
/** Armed usage-limit resumes, keyed by run id (spec
|
|
203
|
+
* 2026-08-03-auto-resume-after-usage-limit). The DEADLINE itself lives on the record
|
|
204
|
+
* (`autoResumeAt`) — this map holds only the process-local timer, so a restart rebuilds it
|
|
205
|
+
* from the record rather than losing the wait. Runs here are `failed` and therefore NOT in
|
|
206
|
+
* `active`, which is why the timer cannot live on an `ActiveRun` like the monitoring one. */
|
|
207
|
+
private readonly autoResumeTimers;
|
|
208
|
+
private pumping;
|
|
209
|
+
/** A pump that arrived while one was in flight — replayed by `pump()`'s own
|
|
210
|
+
* loop so a slot freed mid-sweep is never a lost wakeup. */
|
|
211
|
+
private pumpAgain;
|
|
212
|
+
/**
|
|
213
|
+
* Runs normally isolate in worktrees and may execute in parallel. When that
|
|
214
|
+
* isolation is unavailable (or explicitly disabled), access to `repoRoot` is
|
|
215
|
+
* serialized by default so two agents cannot edit/revert the same files
|
|
216
|
+
* (#438). `CEZ_DISABLE_REPO_LOCK=1` deliberately bypasses this safety lease.
|
|
217
|
+
*/
|
|
218
|
+
private repoRootTail;
|
|
219
|
+
/** `.ai/cezar` — where the per-task handoff files and todos.json live. */
|
|
220
|
+
private readonly dataDir;
|
|
221
|
+
/** Runs currently being paused by the memory guard — dedupes the ~2 s samples so one breach
|
|
222
|
+
* triggers one pause, not a burst. Cleared in dropActive when the run leaves the registry. */
|
|
223
|
+
private readonly memoryPausing;
|
|
224
|
+
/** Unsubscribe handle for the constructor's `onUsage` subscription — released
|
|
225
|
+
* by dispose() so a torn-down manager stops receiving sampler ticks. */
|
|
226
|
+
private readonly offUsage;
|
|
227
|
+
/** The stalled-queue watchdog (see `rescueStalledQueue`). */
|
|
228
|
+
private readonly queueWatchdog;
|
|
229
|
+
/** Set by the watchdog for exactly one sweep: ignore the usage-limit hold and make progress. */
|
|
230
|
+
private forceNextPump;
|
|
231
|
+
/** Runs the watchdog started despite the hold. The spawn-time gate (`requeueWhileHeld`) would
|
|
232
|
+
* otherwise hand them straight back and the rescue would undo itself in a millisecond. */
|
|
233
|
+
private readonly forceStarted;
|
|
234
|
+
/** The workspace-wide parallel-cap semaphore + cached resource config
|
|
235
|
+
* (spec 2026-07-20, step 2.5). Boot constructs ONE and every manager shares
|
|
236
|
+
* it; the private fallback keeps single-manager callers and tests working. */
|
|
237
|
+
private readonly semaphore;
|
|
238
|
+
/** Unregister handle for this manager's semaphore membership — released by
|
|
239
|
+
* dispose() so a torn-down project stops counting against the cap. */
|
|
240
|
+
private readonly offSemaphore;
|
|
241
|
+
constructor(store: RunStore, repoRoot: string, options?: {
|
|
242
|
+
semaphore?: WorkspaceSemaphore;
|
|
243
|
+
});
|
|
244
|
+
/**
|
|
245
|
+
* Release everything this manager owns without touching run records
|
|
246
|
+
* (multi-project workspace, spec 2026-07-20: a removed project's context is
|
|
247
|
+
* torn down while the process lives on). Unsubscribes the shared usage
|
|
248
|
+
* sampler — before dispose() existed that subscription lived for the whole
|
|
249
|
+
* process — clears every per-run idle/autosave timer, releases any held
|
|
250
|
+
* repo-root locks, and empties the queued state so nothing fires later.
|
|
251
|
+
* Live sessions are NOT ended here: run lifecycle stays the caller's policy;
|
|
252
|
+
* dispose only guarantees the manager makes no further moves on its own.
|
|
253
|
+
*/
|
|
254
|
+
dispose(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Pause any active run whose whole process tree exceeds the WORKSPACE
|
|
257
|
+
* `resources.memoryLimitMb`, freeing its slot so the queue advances
|
|
258
|
+
* (#memory-guard). "Pause" closes the session — freeing the tree's
|
|
259
|
+
* memory — and leaves the run resumable via Continue; a loud warning explains why. No-op when
|
|
260
|
+
* no limit is set or the sampler has no data (e.g. `ps`/PowerShell unavailable).
|
|
261
|
+
*/
|
|
262
|
+
private enforceMemoryLimit;
|
|
263
|
+
/** Env the spawned claude gets so the agent can find its handoff file and
|
|
264
|
+
* the global inbox (spec 007; the inbox only when the run opted in).
|
|
265
|
+
*
|
|
266
|
+
* `CEZ_TODOS_FILE` is set to `''` rather than omitted when follow-ups are
|
|
267
|
+
* off: runners spawn with `{ ...process.env, ...spec.env }`, so omitting the
|
|
268
|
+
* key would let a value inherited from *this* process through — a nested
|
|
269
|
+
* cezar (an agent running `cez serve`/`cez run`/the test suite) would then
|
|
270
|
+
* write follow-ups into the parent's inbox despite the opt-out. Empty is the
|
|
271
|
+
* established "absent" spelling — consumers guard with `if (todosFile)`.
|
|
272
|
+
*
|
|
273
|
+
* `TMPDIR`/`TEMP`/`TMP` (#785) point at this run's own scratch directory
|
|
274
|
+
* instead of the machine-wide one every agent used to share. Created and
|
|
275
|
+
* write-probed here, on the last common path before a spawn, so an unusable
|
|
276
|
+
* temp directory throws `AgentTempDirError` at the caller rather than
|
|
277
|
+
* turning into empty command output inside a running agent. */
|
|
278
|
+
private agentEnv;
|
|
279
|
+
/**
|
|
280
|
+
* `agentEnv` plus the agent-account variable for the profile this STEP runs under (spec
|
|
281
|
+
* 2026-07-29-agent-profiles), and the id it resolved to so the caller can record it.
|
|
282
|
+
*
|
|
283
|
+
* Resolved per step, not per run, because a workflow can mix backends: an override naming a
|
|
284
|
+
* Claude account says nothing about which Codex account a codex step should use. Resolution
|
|
285
|
+
* order, most specific first:
|
|
286
|
+
*
|
|
287
|
+
* 1. the step's ALREADY-RECORDED `profileId` — a resume or Continue must reattach to the
|
|
288
|
+
* account that created the session, whatever the project has since been switched to;
|
|
289
|
+
* 2. the run's composer override, but only for steps on the run's own runner;
|
|
290
|
+
* 3. the project's stored selection, and failing that the discovered default.
|
|
291
|
+
*
|
|
292
|
+
* Read fresh every time. `~/.cezar/config.json` is shared by every cezar process on this
|
|
293
|
+
* machine, so a cached snapshot is a staleness bug, and one small JSON read is free next to
|
|
294
|
+
* spawning a CLI. Never throws: an unreadable home degrades to the default profile, which is
|
|
295
|
+
* exactly the behaviour that predates profiles.
|
|
296
|
+
*/
|
|
297
|
+
private agentEnvForStep;
|
|
298
|
+
startRun(workflow: WorkflowDef, input: StartRunInput, group?: {
|
|
299
|
+
groupId: string;
|
|
300
|
+
variant: string;
|
|
301
|
+
}): RunRecord;
|
|
302
|
+
/**
|
|
303
|
+
* Parallel variants (spec 010): N runs of the same workflow on the same
|
|
304
|
+
* task, sharing a groupId. Variant A gets the task verbatim; B and C get a
|
|
305
|
+
* fixed one-line approach hint appended to the *task input* (not the step
|
|
306
|
+
* template), so diversification works with any workflow. The normal queue
|
|
307
|
+
* applies — with maxParallel=2 a third variant simply waits.
|
|
308
|
+
*/
|
|
309
|
+
startVariants(workflow: WorkflowDef, input: StartRunInput, count: number): RunRecord[];
|
|
310
|
+
/**
|
|
311
|
+
* Slots this manager holds against the workspace-wide cap. `waiting` runs
|
|
312
|
+
* don't hold a slot (#347): an idle claude process costs memory but no
|
|
313
|
+
* tokens, queued work progressing matters more, and the idle timeout already
|
|
314
|
+
* bounds how long a session can sit open. Because the exemption lives HERE —
|
|
315
|
+
* in the count, not in any acquire path — a message into a `waiting` run
|
|
316
|
+
* (sendMessage) resumes it immediately even when that momentarily exceeds
|
|
317
|
+
* `maxParallel`, including when other projects saturate the cap.
|
|
318
|
+
*/
|
|
319
|
+
private busySlots;
|
|
320
|
+
/** Epoch ms of this manager's oldest queued run (the semaphore's fairness
|
|
321
|
+
* key when a freed slot is broadcast), or null when nothing is queued.
|
|
322
|
+
* `queue` is FIFO — `startRun` pushes and `recover()` re-queues by
|
|
323
|
+
* `createdAt` — so the head is the oldest. */
|
|
324
|
+
private oldestQueuedAt;
|
|
325
|
+
/**
|
|
326
|
+
* A slot this manager held just came free. Pump the whole WORKSPACE, not
|
|
327
|
+
* just this manager: `maxParallel` is counted across every project, so the
|
|
328
|
+
* run that should take the slot is the workspace's oldest queued one — which
|
|
329
|
+
* usually sits in another project's queue. Pumping only `this` is what left
|
|
330
|
+
* a queued run in project B stuck at `queued` while project A's runs came
|
|
331
|
+
* and went. `release()` pumps this manager too, so it replaces the local
|
|
332
|
+
* `pump()` at every slot-freeing transition.
|
|
333
|
+
*/
|
|
334
|
+
private releaseSlot;
|
|
335
|
+
/**
|
|
336
|
+
* Start queued runs while parallel slots are free. A run starts only under
|
|
337
|
+
* BOTH ceilings: the WORKSPACE `resources.maxParallel` (default 2, counted
|
|
338
|
+
* across every manager — spec 2026-07-20, step 2.5) AND this project's own
|
|
339
|
+
* per-project `maxParallel` when the registry sets one (spec 2026-07-22,
|
|
340
|
+
* inherits the workspace cap when unset). Legacy per-repo `maxParallel` keys
|
|
341
|
+
* are ignored. A non-git directory degrades to 1 sequential run in the repo
|
|
342
|
+
* root (spec 006 degradation rule), which is always the tighter bound.
|
|
343
|
+
*/
|
|
344
|
+
private pump;
|
|
345
|
+
/**
|
|
346
|
+
* Make one `queued` RECORD executable again — the engine half a queued run needs but does not
|
|
347
|
+
* persist (`pendingJobs` / `pendingContinuations` are process-local, the record is not).
|
|
348
|
+
*
|
|
349
|
+
* Two callers, one path: boot recovery re-adopts everything the previous process was holding,
|
|
350
|
+
* and the queue watchdog re-adopts anything the running process has somehow lost. A queued
|
|
351
|
+
* record with no work item behind it is invisible to `pump()` and would sit there for good,
|
|
352
|
+
* which is the worst failure this engine has — the task is neither running nor failed, just
|
|
353
|
+
* silently never going to happen.
|
|
354
|
+
*
|
|
355
|
+
* A continuation is reconstructed first: its executable details are gone, but the pending
|
|
356
|
+
* `continue-N` step and the session before it are durable, which is enough. Otherwise the
|
|
357
|
+
* workflow is revived from the record. A run that can be neither is failed loudly rather than
|
|
358
|
+
* left in the queue as a ghost.
|
|
359
|
+
*/
|
|
360
|
+
private reviveQueuedRun;
|
|
361
|
+
/**
|
|
362
|
+
* Startup recovery (#367) — re-adopt runs that were live when the previous
|
|
363
|
+
* cezar process exited (requires the store opened with `keepLive`):
|
|
364
|
+
* - `queued` → back into the queue (FIFO by createdAt), from the persisted
|
|
365
|
+
* workflowDef (or the catalog by name for older records);
|
|
366
|
+
* - `waiting` → the turn was over and the ball was in the user's court —
|
|
367
|
+
* settle exactly like a closed session (review/done, Continue still works);
|
|
368
|
+
* - `running` → mark interrupted, then immediately resume the last agent
|
|
369
|
+
* session via the Continue path, pointing the agent at its handoff file.
|
|
370
|
+
* Call once, before the server starts taking requests.
|
|
371
|
+
*/
|
|
372
|
+
recover(): Promise<void>;
|
|
373
|
+
/** The persisted definition when it looks sane, else the catalog by name. */
|
|
374
|
+
private reviveWorkflow;
|
|
375
|
+
/** Remove a run from the live registries — keeps `waiting ⊆ active`. */
|
|
376
|
+
private dropActive;
|
|
377
|
+
/**
|
|
378
|
+
* A run just failed: if the provider said "usage limit, back at T", promise to resume it at
|
|
379
|
+
* `T + AUTO_RESUME_GRACE_MS` instead of leaving the task dead until someone notices.
|
|
380
|
+
*
|
|
381
|
+
* Every refusal below is silent-but-honest — the run stays `failed` with its Continue button,
|
|
382
|
+
* which is exactly the pre-feature behavior — except the safety cap, which says so on the
|
|
383
|
+
* transcript, because a run that stops resuming itself needs to explain why.
|
|
384
|
+
*/
|
|
385
|
+
private scheduleAutoResumeIfLimited;
|
|
386
|
+
/** Publish the deadline on the record (the cockpit's only source) and arm the timer for it. */
|
|
387
|
+
private armAutoResume;
|
|
388
|
+
/**
|
|
389
|
+
* The window has reopened. Re-check the record synchronously — hours may have passed, and the
|
|
390
|
+
* user may have continued, deleted or cancelled the run in them — then hand the resume to the
|
|
391
|
+
* ordinary queued-continuation path so it obeys both concurrency caps like any other work.
|
|
392
|
+
*/
|
|
393
|
+
private fireAutoResume;
|
|
394
|
+
/**
|
|
395
|
+
* Make the armed timers agree with the records and the current setting. Runs on every `pump()`
|
|
396
|
+
* — which is where a settings change lands (a config PUT refreshes the shared semaphore, which
|
|
397
|
+
* pumps every manager) — and once from `recover()`.
|
|
398
|
+
*
|
|
399
|
+
* It is a RECONCILE rather than a one-shot restore because the deadline is durable state and
|
|
400
|
+
* the timer is not: a restart, a rebuilt project context, a manager disposed mid-wait, or a
|
|
401
|
+
* refusal all leave a record promising a resume that no timer is holding. Rebuilding from the
|
|
402
|
+
* record covers every one of those at once — the alternative is a hint counting down to a time
|
|
403
|
+
* that has already passed, which is exactly the failure this method exists to make impossible.
|
|
404
|
+
*
|
|
405
|
+
* Cheap: an in-memory scan, and arming is skipped for every run already held.
|
|
406
|
+
*/
|
|
407
|
+
private reconcileAutoResumes;
|
|
408
|
+
/**
|
|
409
|
+
* Hand a run that has not spawned anything back to the queue, when the account it would run on
|
|
410
|
+
* went into a usage-limit hold (spec 2026-08-03-auto-resume-after-usage-limit).
|
|
411
|
+
*
|
|
412
|
+
* The dequeue-time gate in `pump()` cannot be the only one: a run can sit between dequeue and
|
|
413
|
+
* spawn for a long time — an in-place run waiting for the exclusive repo-root lease is the
|
|
414
|
+
* measured case — and the account can close in that gap. This is the last honest moment to
|
|
415
|
+
* refuse, because everything after it costs a real agent turn.
|
|
416
|
+
*
|
|
417
|
+
* "Untouched" is the contract: the run has created no session and no worktree, so it goes back
|
|
418
|
+
* as plain `queued` with its `startedAt` cleared, and `pump()` will pick it up when the window
|
|
419
|
+
* reopens. Returns true when the caller must abandon the run.
|
|
420
|
+
*/
|
|
421
|
+
private requeueWhileHeld;
|
|
422
|
+
/**
|
|
423
|
+
* The failsafe: a queue must never be able to wedge.
|
|
424
|
+
*
|
|
425
|
+
* Everything else in this file makes an idle queue CORRECT under some condition — a slot cap, a
|
|
426
|
+
* repo-root lease, and now a usage-limit hold. That is also what makes a wedged queue look
|
|
427
|
+
* correct, and the hold has already produced one in the field: two resumes fired together, each
|
|
428
|
+
* holding the account the other was waiting on, and the whole workspace stopped with every task
|
|
429
|
+
* `queued`. That specific bug is fixed and tested, but "the queue stopped and nothing will ever
|
|
430
|
+
* restart it" is too expensive a failure mode to leave resting on any single fix being right.
|
|
431
|
+
*
|
|
432
|
+
* The test is deliberately about JUSTIFICATION rather than about any particular bug: idling is
|
|
433
|
+
* legitimate while work is running (here or in another project), or while a real appointment is
|
|
434
|
+
* still ahead — a scheduled resume that will fire and pump on its own. Anything else is a
|
|
435
|
+
* queue with work in it, nothing running anywhere, and no event coming to wake it. That gets one
|
|
436
|
+
* forced sweep, which starts work under the ordinary caps and lets the account's real state
|
|
437
|
+
* re-assert itself: if the window truly is shut, that task meets the limit and re-establishes an
|
|
438
|
+
* honest hold, with a real deadline behind it this time.
|
|
439
|
+
*
|
|
440
|
+
* Public so a test can drive the wedge directly instead of waiting out the interval.
|
|
441
|
+
*/
|
|
442
|
+
rescueStalledQueue(now?: number): Promise<void>;
|
|
443
|
+
/**
|
|
444
|
+
* The accounts this project is currently holding: one key per run parked on a usage-limit
|
|
445
|
+
* resume that has not come due yet (spec 2026-08-03-auto-resume-after-usage-limit).
|
|
446
|
+
*
|
|
447
|
+
* Published to the shared semaphore so the hold spans PROJECTS — one Claude account can be
|
|
448
|
+
* driving tasks in three repos, and a limit closes it for all of them. Derived from the
|
|
449
|
+
* records on every ask rather than tracked as state: a deadline that passes, a resume that
|
|
450
|
+
* fires, a cancel, an archive and a delete all lift the hold with no bookkeeping.
|
|
451
|
+
*
|
|
452
|
+
* Deliberately excludes a deadline that has already passed — that run is about to resume, and
|
|
453
|
+
* holding the queue for it would only stall the very work the window reopened for.
|
|
454
|
+
*/
|
|
455
|
+
accountHolds(now?: number): AccountHolds;
|
|
456
|
+
/**
|
|
457
|
+
* The PER-TASK off switch (`DELETE /api/v1/runs/:id/auto-resume`, and the archive route):
|
|
458
|
+
* stop resuming THIS task, without touching the workspace setting or any other task.
|
|
459
|
+
*
|
|
460
|
+
* Idempotent — a run with nothing pending answers the same way, because "this task will not
|
|
461
|
+
* resume itself" is equally true either way. Returns false only when the run does not exist,
|
|
462
|
+
* which is the route's 404.
|
|
463
|
+
*/
|
|
464
|
+
cancelAutoResume(runId: string): boolean;
|
|
465
|
+
/** Retire a pending resume — timer, deadline and counter. The counter goes too because every
|
|
466
|
+
* caller is a fresh epoch: a human Continue, or a resume that re-stamps its own count. */
|
|
467
|
+
private clearAutoResume;
|
|
468
|
+
/** Reclaim finished worktrees beyond the keep-limit (#483) — directory only,
|
|
469
|
+
* `cez/<id8>` branch kept. Best-effort; a failure never affects run
|
|
470
|
+
* lifecycle. `review`/live runs are excluded by the selector. */
|
|
471
|
+
private enforceRetention;
|
|
472
|
+
/** Last live-refresh namer inputs per run — unchanged inputs skip the call. */
|
|
473
|
+
private lastNamerKey;
|
|
474
|
+
/**
|
|
475
|
+
* Acquire the one-at-a-time lease for runs executing in `repoRoot`.
|
|
476
|
+
*
|
|
477
|
+
* A lease waiter is idle, so it parks in `waiting` and gives its
|
|
478
|
+
* `maxParallel` slot back (the #347 rule): isolated worktrees keep using
|
|
479
|
+
* every configured slot while root runs line up. The store status stays
|
|
480
|
+
* `running` — only the queue's busy count changes, so the GUI never shows a
|
|
481
|
+
* lease-blocked run as awaiting user input.
|
|
482
|
+
*
|
|
483
|
+
* The lease is held for the run's whole lifetime, including the idle
|
|
484
|
+
* `waiting` parks between agent turns. A parked session is still live and
|
|
485
|
+
* writes to the working tree the moment it resumes, so handing the tree to
|
|
486
|
+
* another run there would reintroduce the concurrent-edit bug (#438) this
|
|
487
|
+
* lease exists to prevent.
|
|
488
|
+
*
|
|
489
|
+
* Returns false when the run was cancelled while waiting: the lease was
|
|
490
|
+
* never granted and the caller must not touch the working tree.
|
|
491
|
+
*/
|
|
492
|
+
private acquireRepoRoot;
|
|
493
|
+
cancel(runId: string): boolean;
|
|
494
|
+
isActive(runId: string): boolean;
|
|
495
|
+
/**
|
|
496
|
+
* Fold a queued run's persisted prompt — `run.task` plus everything stacked
|
|
497
|
+
* onto it (#472) — into the job input that is about to execute.
|
|
498
|
+
*
|
|
499
|
+
* Called from `pump()` immediately before `execute()`, which makes the RECORD
|
|
500
|
+
* the single source of truth for a queued run's prompt. Before this, the
|
|
501
|
+
* executing copy lived in `pendingJobs` (memory) while the record held a
|
|
502
|
+
* second one, so an edit that PATCHed the record silently did nothing until a
|
|
503
|
+
* restart. `recover()` rebuilds through the same helper, so both paths agree.
|
|
504
|
+
*
|
|
505
|
+
* **Read-only, and that is load-bearing.** It composes into the in-memory
|
|
506
|
+
* `input` and never writes the folded string back to `RunRecord.task`; the
|
|
507
|
+
* task and its stack stay separate on disk for the life of the run. Writing
|
|
508
|
+
* back would re-append the whole stack on every recovery and compound without
|
|
509
|
+
* bound — asserted directly by a test.
|
|
510
|
+
*/
|
|
511
|
+
private hydrateQueuedInput;
|
|
512
|
+
/** Apply edits and messages made while a restart continuation waits for
|
|
513
|
+
* capacity. The durable record remains the source of truth, just as it is for
|
|
514
|
+
* an ordinary queued workflow (#472), so a second restart reconstructs and
|
|
515
|
+
* hydrates the same amendments instead of dropping them. */
|
|
516
|
+
private hydrateQueuedContinuation;
|
|
517
|
+
private readPersistedImages;
|
|
518
|
+
/**
|
|
519
|
+
* Still waiting for a slot? Checked against the engine's own queue rather than
|
|
520
|
+
* the record's `status` (#472): the record is written by `execute()` a tick
|
|
521
|
+
* after `pump()` dequeues, so a status read can see `queued` for a run that has
|
|
522
|
+
* already started. The pending maps are deleted synchronously at dequeue, so
|
|
523
|
+
* they are the authoritative answer for "can this prompt still be amended".
|
|
524
|
+
*/
|
|
525
|
+
private isQueued;
|
|
526
|
+
/** Split `ContentBlock[]` into the persisted shape a stacked message holds. */
|
|
527
|
+
private toQueuedMessage;
|
|
528
|
+
/**
|
|
529
|
+
* Append a prompt message onto a still-queued run (#472). Returns the stored
|
|
530
|
+
* entry, or null when the run has already started — the caller then falls
|
|
531
|
+
* through to `deferMessage`.
|
|
532
|
+
*/
|
|
533
|
+
enqueueMessage(runId: string, content: ContentBlock[]): QueuedMessage | null;
|
|
534
|
+
/** Edit a stacked message in place. Omitted fields retain their current value. */
|
|
535
|
+
editQueuedMessage(runId: string, msgId: string, edit: {
|
|
536
|
+
text?: string;
|
|
537
|
+
images?: ContentBlock[];
|
|
538
|
+
}): QueuedMessage | null;
|
|
539
|
+
/** Remove a stacked message and its now-orphaned attachments. */
|
|
540
|
+
removeQueuedMessage(runId: string, msgId: string): boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Delete image files no longer referenced by anything (#472). Best effort — a
|
|
543
|
+
* leftover file is harmless and goes with the run. Never touches a URL still
|
|
544
|
+
* referenced by another stacked entry or by the initial prompt's `taskImages`.
|
|
545
|
+
*/
|
|
546
|
+
private dropOrphanImages;
|
|
547
|
+
/**
|
|
548
|
+
* Edit the initial prompt of a still-queued run (#472). Re-derives the
|
|
549
|
+
* heuristic title and the PR/issue chips, but never re-runs the LLM namer —
|
|
550
|
+
* it already fired at creation and a second model call per edit is unjustified.
|
|
551
|
+
*/
|
|
552
|
+
editTask(runId: string, task: string): boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Buffer a message that arrived in the gap between dequeue and session-open
|
|
555
|
+
* (#472). `pump()` has already folded the stack and `execute()` is spawning the
|
|
556
|
+
* backend, so there is nothing left to amend and no session to deliver into —
|
|
557
|
+
* without this rung the message would 409, a genuinely dropped message in the
|
|
558
|
+
* feature built to stop dropping them. Flushed as an ordinary follow-up turn
|
|
559
|
+
* the instant the session opens; dropped if the run never starts, which the
|
|
560
|
+
* existing error path already surfaces.
|
|
561
|
+
*
|
|
562
|
+
* The buffer lives on the manager rather than the `ActiveRun` because the
|
|
563
|
+
* `ActiveRun` does not exist yet for part of this window.
|
|
564
|
+
*/
|
|
565
|
+
deferMessage(runId: string, content: ContentBlock[]): boolean;
|
|
566
|
+
/** Deliver anything `deferMessage` buffered, once the session is live. */
|
|
567
|
+
private flushDeferred;
|
|
568
|
+
/**
|
|
569
|
+
* Deliver a user message into the run's live claude session (mid-turn or
|
|
570
|
+
* while `waiting`). Returns false when there is no open session — the GUI
|
|
571
|
+
* then offers "Continue" instead.
|
|
572
|
+
*/
|
|
573
|
+
sendMessage(runId: string, content: ContentBlock[]): boolean;
|
|
574
|
+
/** Shared live-session delivery. Synthetic scheduler prompts reuse lifecycle
|
|
575
|
+
* bookkeeping without masquerading as user-authored transcript messages. */
|
|
576
|
+
private deliverMessage;
|
|
577
|
+
/** Close the open session gracefully — the run then completes as `done`
|
|
578
|
+
* (or rests at `review` when the worktree holds changes, spec 009).
|
|
579
|
+
* On a run already resting at `review` (no session — the engine loop is
|
|
580
|
+
* over), "Finish" is the third review exit: accept the changes without a
|
|
581
|
+
* PR and flip straight to `done`. */
|
|
582
|
+
finish(runId: string): boolean;
|
|
583
|
+
/**
|
|
584
|
+
* "Continue" (spec 003): reopen a finished run's claude session in-process
|
|
585
|
+
* (`claude --resume <sessionId>`) as a new synthetic step. The session then
|
|
586
|
+
* behaves exactly like an interactive step: `waiting` after each turn,
|
|
587
|
+
* messages via sendMessage, closed by finish/idle/cancel.
|
|
588
|
+
*/
|
|
589
|
+
continueRun(runId: string, opts?: {
|
|
590
|
+
text?: string;
|
|
591
|
+
images?: ContentBlock[];
|
|
592
|
+
runner?: RunnerId;
|
|
593
|
+
model?: string;
|
|
594
|
+
/** Agent account for the reopened session (spec 2026-07-29-agent-profiles). Omitted = the
|
|
595
|
+
* account the run is already on. */
|
|
596
|
+
agentProfile?: string;
|
|
597
|
+
},
|
|
598
|
+
/** Restart recovery may discover several interrupted tasks at once. Those
|
|
599
|
+
* continuations are queued; an explicit user Continue remains immediate. */
|
|
600
|
+
deferForCapacity?: boolean): {
|
|
601
|
+
ok: boolean;
|
|
602
|
+
error?: string;
|
|
603
|
+
};
|
|
604
|
+
private runContinuation;
|
|
605
|
+
private execute;
|
|
606
|
+
/** Returns an error message, or null on success. */
|
|
607
|
+
private runAgentStep;
|
|
608
|
+
/**
|
|
609
|
+
* Protocol-v2 sink for one agent session (R2 step 2.1): the runner's
|
|
610
|
+
* `onUiEvent` stream flows through here. Persisted snapshots ride the same
|
|
611
|
+
* NDJSON file as v1 (the store stamps `seq`/`ts`, `appendEvent` fans them
|
|
612
|
+
* out live too); coalesced `item.delta` flushes go out live-only via
|
|
613
|
+
* `emitEphemeral` — raw deltas never hit disk (spec §performance
|
|
614
|
+
* guardrails). One sink per session: cumulative usage dedup and the
|
|
615
|
+
* item-shape cache are session-scoped, like the mapper state feeding them.
|
|
616
|
+
*/
|
|
617
|
+
private makeUiSink;
|
|
618
|
+
/** Native backend asks arrive before turn-end. Persist and park immediately
|
|
619
|
+
* so the cockpit shows attention and the run releases its workspace slot. */
|
|
620
|
+
private handleRunnerUiEvent;
|
|
621
|
+
/** Persist the invocation checkpoint before launching a runner. A throw or
|
|
622
|
+
* process exit before `turn.started` therefore leaves a durable mismatch. */
|
|
623
|
+
private beginUsageInvocation;
|
|
624
|
+
/** Fold backend-neutral completed-turn usage into the current step exactly
|
|
625
|
+
* once. Invocation/turn counters are written before the event reaches the
|
|
626
|
+
* NDJSON sink so crashes cannot preserve a falsely complete subtotal. */
|
|
627
|
+
private recordUsageUiEvent;
|
|
628
|
+
/** Usage completeness is a crash boundary, unlike high-frequency token
|
|
629
|
+
* snapshots: the checkpoint must reach `runs.json` before the runner starts
|
|
630
|
+
* or the matching UI event is persisted and forwarded. */
|
|
631
|
+
private persistUsageCheckpoint;
|
|
632
|
+
/**
|
|
633
|
+
* Turn-end bookkeeping (#389), shared by `runAgentStep` and
|
|
634
|
+
* `runContinuation` — called (fire-and-forget) from every `turn-end` event:
|
|
635
|
+
*
|
|
636
|
+
* - `titleSummary`: derived from the turn's text, set ONCE — only while the
|
|
637
|
+
* record has none. A user's inline edit also lands in `titleSummary`
|
|
638
|
+
* (see `PATCH /api/runs/:id`), so an edit is never overwritten either.
|
|
639
|
+
* - `diffStat`: cheap `git diff --shortstat` vs the base, refreshed every
|
|
640
|
+
* turn. Async and best-effort — a git failure becomes at most a `note`
|
|
641
|
+
* event, NEVER a run failure. `updateRun` fans the record out over SSE,
|
|
642
|
+
* so the list views pick both up with no extra wiring.
|
|
643
|
+
*
|
|
644
|
+
* Not `private` so the integration tests can drive a turn-end directly —
|
|
645
|
+
* a real agent session is the only other way to reach this path.
|
|
646
|
+
*/
|
|
647
|
+
/**
|
|
648
|
+
* The namer's apply path (task auto-naming spec). Fire-and-forget: called
|
|
649
|
+
* without await from `startRun` (creation) and `recordTurnEnd` (live
|
|
650
|
+
* refresh). A user-owned title (`titleOrigin: 'user'`) is never overwritten;
|
|
651
|
+
* namer-owned titles may be replaced by fresher namer results.
|
|
652
|
+
*/
|
|
653
|
+
private autoNameRun;
|
|
654
|
+
recordTurnEnd(runId: string, turnText: string): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* In-band declarations from the finished turn (spec
|
|
657
|
+
* 2026-07-18-task-ref-markers): the main thread's own `CEZ:PR=` /
|
|
658
|
+
* `CEZ:ISSUE=` / `CEZ:TITLE=` lines, parsed from the accumulated turn text
|
|
659
|
+
* like `CEZ:DONE` — never from tool output. Declared numbers overwrite the
|
|
660
|
+
* regex/namer display tier (the store re-resolves the referenced-PR chip);
|
|
661
|
+
* a declared title takes `titleOrigin: 'marker'`, which beats the namer but
|
|
662
|
+
* never a user rename, and silences the live refresh below.
|
|
663
|
+
*/
|
|
664
|
+
private applyTurnMarkers;
|
|
665
|
+
/**
|
|
666
|
+
* Live title refresh (task auto-naming spec, step 3): re-run the namer with
|
|
667
|
+
* the turn's context. Skips: toggle off (`liveTitleUpdates` config over
|
|
668
|
+
* `CEZ_TITLE_UPDATES` env, default ON), user-owned title, marker-owned title
|
|
669
|
+
* (the agent declares via `CEZ:TITLE` — the token-saving fast path), dry-run
|
|
670
|
+
* mocks (canned answers add nothing), empty turn text, unchanged namer inputs.
|
|
671
|
+
*/
|
|
672
|
+
private maybeRefreshTitle;
|
|
673
|
+
/**
|
|
674
|
+
* End-of-session telemetry (#348): stop sampling the run's process tree and
|
|
675
|
+
* fold the session's peaks into the run record. `max` with existing values —
|
|
676
|
+
* a run can hold several sessions (multiple agent steps, Continue) and the
|
|
677
|
+
* record keeps the highest water mark across all of them.
|
|
678
|
+
*/
|
|
679
|
+
private recordUsagePeaks;
|
|
680
|
+
/**
|
|
681
|
+
* Diff-first review gate (spec 009), shared by `execute` and
|
|
682
|
+
* `runContinuation`: a *successful* run whose worktree holds changes rests
|
|
683
|
+
* at `review` instead of `done` — the user inspects the diff first, then
|
|
684
|
+
* sends feedback back, opens a draft PR, or just finishes. Failed/cancelled
|
|
685
|
+
* runs never enter review; no worktree or an empty diff means plain `done`.
|
|
686
|
+
*
|
|
687
|
+
* The gate is opt-in (#489): the review park happens only when it is enabled
|
|
688
|
+
* (`reviewGateEnabled` — config toggle over the `CEZ_REVIEW_GATE` env, default
|
|
689
|
+
* OFF) AND the run is not autonomous. Autonomous runs — and runs with the gate
|
|
690
|
+
* off — settle straight to `done`, leaving the diff in the worktree untouched.
|
|
691
|
+
*/
|
|
692
|
+
private settleSuccess;
|
|
693
|
+
/**
|
|
694
|
+
* Agent screenshot (an image block inside a tool result) or a user-pasted
|
|
695
|
+
* attachment: the base64 data never enters the NDJSON event log — it lands
|
|
696
|
+
* as a file under `.ai/cezar/runs/<id>-images/` and the transcript event
|
|
697
|
+
* carries only the name + serving URL. `namePrefix` distinguishes the two
|
|
698
|
+
* origins on disk (`screenshot-<n>.<ext>` for agent tool screenshots,
|
|
699
|
+
* `pasted-<n>.<ext>` for user-pasted attachments, #357) and the absolute
|
|
700
|
+
* `path` lets the agent operate on the file directly (save/attach/upload).
|
|
701
|
+
* Best effort: on failure the attachment is dropped, the transcript still
|
|
702
|
+
* shows the tool result's `[screenshot]` placeholder (or the image count).
|
|
703
|
+
*/
|
|
704
|
+
private persistImage;
|
|
705
|
+
private armIdleTimer;
|
|
706
|
+
private clearIdleTimer;
|
|
707
|
+
private reconcileMonitoringWakeTimers;
|
|
708
|
+
private armMonitoringWakeTimer;
|
|
709
|
+
private clearMonitoringWakeTimer;
|
|
710
|
+
/** Autosave-commit the worktree every 90 s while the run lives (spec 006).
|
|
711
|
+
* Opt-in via CEZ_AUTOSAVE=1 (#471) — see periodicAutosaveEnabled. */
|
|
712
|
+
private armAutosave;
|
|
713
|
+
private clearAutosaveTimer;
|
|
714
|
+
private runCheckStep;
|
|
715
|
+
private finishStep;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Immediate title shown while a run is queued. The namer's `titleSummary`
|
|
719
|
+
* replaces it once the model answers; this is the honest, permanent fallback
|
|
720
|
+
* when no model is available (#432, spec 2026-07-17-task-auto-naming). When
|
|
721
|
+
* the task references a PR/issue, the number leads: `469: /om-auto-review-pr`.
|
|
722
|
+
*/
|
|
723
|
+
export declare function makeRunTitle(task: string, workflow: WorkflowDef): string;
|
|
724
|
+
/**
|
|
725
|
+
* Skill identity is context, while the Markdown body remains instructions.
|
|
726
|
+
*
|
|
727
|
+
* For an on-disk skill we also hand the agent the ABSOLUTE directory of the
|
|
728
|
+
* installed copy. A run executes in an isolated worktree that has no local
|
|
729
|
+
* `.agents/skills` (gitignored, absent in a fresh checkout), so without this
|
|
730
|
+
* the agent cannot read the skill's companion files (`references/*.md`) — or,
|
|
731
|
+
* worse, reads a stale copy materialized from the team-repo cache. The path
|
|
732
|
+
* resolves against the MAIN project root (`discoverSkills(repoRoot)`), i.e. the
|
|
733
|
+
* current `npx skills`-installed copy, so a worktree agent and the main
|
|
734
|
+
* checkout read the exact same, up-to-date files. Team skills are omitted here:
|
|
735
|
+
* they are materialized into the worktree separately (see the call site).
|
|
736
|
+
*/
|
|
737
|
+
export declare function skillSystemPrompt(skill: Pick<Skill, 'name' | 'description' | 'body'> & Partial<Pick<Skill, 'path' | 'source'>>): string;
|
|
738
|
+
/**
|
|
739
|
+
* Expand a registry-backed slash skill in one prompt string before it reaches a
|
|
740
|
+
* backend. Claude otherwise intercepts an unknown leading slash command, and
|
|
741
|
+
* Codex/OpenCode have no native slash-skill lookup at all (#676).
|
|
742
|
+
*
|
|
743
|
+
* Only a match at character zero counts, and unknown commands pass through
|
|
744
|
+
* byte-for-byte — a backend's OWN slash commands must keep working. The caller
|
|
745
|
+
* persists the original user text before applying this delivery-only rewrite.
|
|
746
|
+
*
|
|
747
|
+
* Both delivery seams route through here: live-session messages via
|
|
748
|
+
* `expandRegistrySlashSkill`, and a continuation's opening prompt, which becomes
|
|
749
|
+
* the session's `userPrompt` and never passes through `deliverMessage` at all
|
|
750
|
+
* (#811).
|
|
751
|
+
*/
|
|
752
|
+
export declare function expandRegistrySlashSkillText(text: string, skills: readonly Skill[]): string;
|
|
753
|
+
/**
|
|
754
|
+
* `expandRegistrySlashSkillText` over a live chat message: only the first text
|
|
755
|
+
* block is eligible, and an unchanged block returns the caller's array
|
|
756
|
+
* identity untouched.
|
|
757
|
+
*/
|
|
758
|
+
export declare function expandRegistrySlashSkill(content: ContentBlock[], skills: readonly Skill[]): ContentBlock[];
|