@open-mercato/cezar 0.1.5-pr506.357
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 +573 -0
- package/dist/config.d.ts +144 -0
- package/dist/config.js +106 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-runner.d.ts +169 -0
- package/dist/core/agent-runner.js +23 -0
- package/dist/core/agent-runner.js.map +1 -0
- package/dist/core/backend-detect.d.ts +16 -0
- package/dist/core/backend-detect.js +118 -0
- package/dist/core/backend-detect.js.map +1 -0
- package/dist/core/claude-cli-runner.d.ts +56 -0
- package/dist/core/claude-cli-runner.js +416 -0
- package/dist/core/claude-cli-runner.js.map +1 -0
- package/dist/core/claude-ui-mapper.d.ts +71 -0
- package/dist/core/claude-ui-mapper.js +567 -0
- package/dist/core/claude-ui-mapper.js.map +1 -0
- package/dist/core/codex-app-server-runner.d.ts +29 -0
- package/dist/core/codex-app-server-runner.js +489 -0
- package/dist/core/codex-app-server-runner.js.map +1 -0
- package/dist/core/codex-ui-mapper.d.ts +63 -0
- package/dist/core/codex-ui-mapper.js +491 -0
- package/dist/core/codex-ui-mapper.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-server-runner.d.ts +30 -0
- package/dist/core/opencode-server-runner.js +488 -0
- package/dist/core/opencode-server-runner.js.map +1 -0
- package/dist/core/opencode-ui-mapper.d.ts +105 -0
- package/dist/core/opencode-ui-mapper.js +588 -0
- package/dist/core/opencode-ui-mapper.js.map +1 -0
- package/dist/core/process-usage.d.ts +63 -0
- package/dist/core/process-usage.js +181 -0
- package/dist/core/process-usage.js.map +1 -0
- package/dist/core/runner-factory.d.ts +8 -0
- package/dist/core/runner-factory.js +22 -0
- package/dist/core/runner-factory.js.map +1 -0
- package/dist/core/tool-display.d.ts +30 -0
- package/dist/core/tool-display.js +156 -0
- package/dist/core/tool-display.js.map +1 -0
- package/dist/core/ui-events.d.ts +308 -0
- package/dist/core/ui-events.js +25 -0
- package/dist/core/ui-events.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/git-worktree.d.ts +88 -0
- package/dist/git-worktree.js +297 -0
- package/dist/git-worktree.js.map +1 -0
- package/dist/handoff.d.ts +62 -0
- package/dist/handoff.js +147 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +466 -0
- package/dist/index.js.map +1 -0
- package/dist/install-as-command.d.ts +39 -0
- package/dist/install-as-command.js +51 -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 +23 -0
- package/dist/paths.js +34 -0
- package/dist/paths.js.map +1 -0
- package/dist/planner.d.ts +17 -0
- package/dist/planner.js +248 -0
- package/dist/planner.js.map +1 -0
- package/dist/release/snapshot.d.ts +64 -0
- package/dist/release/snapshot.js +75 -0
- package/dist/release/snapshot.js.map +1 -0
- package/dist/release/stable.d.ts +46 -0
- package/dist/release/stable.js +57 -0
- package/dist/release/stable.js.map +1 -0
- package/dist/runs/auto-name.d.ts +75 -0
- package/dist/runs/auto-name.js +168 -0
- package/dist/runs/auto-name.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/store.d.ts +408 -0
- package/dist/runs/store.js +526 -0
- package/dist/runs/store.js.map +1 -0
- package/dist/runs/task-refs.d.ts +24 -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/capabilities.d.ts +33 -0
- package/dist/server/capabilities.js +43 -0
- package/dist/server/capabilities.js.map +1 -0
- package/dist/server/forge/github.d.ts +70 -0
- package/dist/server/forge/github.js +375 -0
- package/dist/server/forge/github.js.map +1 -0
- package/dist/server/forge/index.d.ts +24 -0
- package/dist/server/forge/index.js +45 -0
- package/dist/server/forge/index.js.map +1 -0
- package/dist/server/forge/types.d.ts +80 -0
- package/dist/server/forge/types.js +2 -0
- package/dist/server/forge/types.js.map +1 -0
- package/dist/server/git-changes.d.ts +195 -0
- package/dist/server/git-changes.js +497 -0
- package/dist/server/git-changes.js.map +1 -0
- package/dist/server/git.d.ts +26 -0
- package/dist/server/git.js +103 -0
- package/dist/server/git.js.map +1 -0
- package/dist/server/github.d.ts +8 -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 +51 -0
- package/dist/server/open-in-app.js +189 -0
- package/dist/server/open-in-app.js.map +1 -0
- package/dist/server/open-in-terminal.d.ts +25 -0
- package/dist/server/open-in-terminal.js +120 -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/server.d.ts +41 -0
- package/dist/server/server.js +1390 -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/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 +33 -0
- package/dist/server-install/engine.js +314 -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 +39 -0
- package/dist/server-install/platforms/ubuntu-vps.js +746 -0
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -0
- package/dist/server-install/state.d.ts +26 -0
- package/dist/server-install/state.js +125 -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 +330 -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 +597 -0
- package/dist/server-install/types.js +98 -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 +21 -0
- package/dist/skills-banner.js +40 -0
- package/dist/skills-banner.js.map +1 -0
- package/dist/skills-remote.d.ts +35 -0
- package/dist/skills-remote.js +266 -0
- package/dist/skills-remote.js.map +1 -0
- package/dist/skills.d.ts +45 -0
- package/dist/skills.js +182 -0
- package/dist/skills.js.map +1 -0
- package/dist/todos.d.ts +63 -0
- package/dist/todos.js +168 -0
- package/dist/todos.js.map +1 -0
- package/dist/ui-state.d.ts +12 -0
- package/dist/ui-state.js +25 -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 +281 -0
- package/dist/workflows/run.js +1511 -0
- package/dist/workflows/run.js.map +1 -0
- package/dist/workflows/types.d.ts +307 -0
- package/dist/workflows/types.js +171 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +90 -0
- package/scripts/check-pack.mjs +46 -0
- package/scripts/dev.mjs +74 -0
- package/scripts/install-as-command.mjs +120 -0
- package/scripts/mock-claude.mjs +310 -0
- package/scripts/release-snapshot.mjs +130 -0
- package/scripts/release.mjs +119 -0
- package/scripts/test-process-usage.mjs +47 -0
- package/web/dist/assets/arrow-left-BE957rJs.js +1 -0
- package/web/dist/assets/bundle-mjs-DLPpRFyl.js +1 -0
- package/web/dist/assets/centered-state-BddhEEtO.js +43 -0
- package/web/dist/assets/chunk-BO2N2NFS-f5igTtpB.js +131 -0
- package/web/dist/assets/command-CjhFbABo.js +1 -0
- package/web/dist/assets/compare-variants-Cs52IAEG.js +1 -0
- package/web/dist/assets/core-BuMqAF_1.js +12 -0
- package/web/dist/assets/css-BsVw1vtW.js +1 -0
- package/web/dist/assets/dialog-DFvXTkFv.js +1 -0
- package/web/dist/assets/diff-view-C9b8AITq.js +4 -0
- package/web/dist/assets/diff-woXpYk--.js +1 -0
- package/web/dist/assets/dist-FBs4wmIY.js +1 -0
- package/web/dist/assets/dist-o_kVMXjg.js +1 -0
- package/web/dist/assets/engine-javascript-FQvzRocB.js +141 -0
- package/web/dist/assets/file-BVuztAOd.js +1 -0
- package/web/dist/assets/folder-0pJ1NZ_S.js +1 -0
- package/web/dist/assets/git-pull-request-DJkAMT0f.js +1 -0
- package/web/dist/assets/git-toolbar-CwhQdx3J.js +1 -0
- package/web/dist/assets/github-D0rAX4-r.js +1 -0
- package/web/dist/assets/go-rLFTqkRN.js +1 -0
- package/web/dist/assets/highlighted-body-OFNGDK62-DGHHie_q.js +1 -0
- package/web/dist/assets/highlighter-BKVEsACy.js +3 -0
- package/web/dist/assets/html-BY76lXLH.js +1 -0
- package/web/dist/assets/index-CEkI7QxN.css +2 -0
- package/web/dist/assets/index-CO2lH2et.js +11 -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-CNGa3Dig.js +1 -0
- package/web/dist/assets/loader-circle-BV3DO9mE.js +1 -0
- package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/web/dist/assets/markdown-D4-ADgH9.js +1 -0
- package/web/dist/assets/mermaid-GHXKKRXX-DM2VsGBG.js +1 -0
- package/web/dist/assets/open-mercato-toBr6SOa.svg +11 -0
- package/web/dist/assets/prompt-templates-C7ptKvDd.js +15 -0
- package/web/dist/assets/python-gzcpVVnB.js +1 -0
- package/web/dist/assets/react-dom-Ddtik4qM.js +1 -0
- package/web/dist/assets/refresh-cw-DCa-Rlwz.js +1 -0
- package/web/dist/assets/repo-git-DIhryGDx.js +1 -0
- package/web/dist/assets/run-diff-Dyow8B1q.js +3 -0
- package/web/dist/assets/run-header-jx9-18b8.js +1 -0
- package/web/dist/assets/rust-Cfkwpbl8.js +1 -0
- package/web/dist/assets/search-x-CoCyl7zT.js +1 -0
- package/web/dist/assets/shellscript-CLZ0U2zV.js +1 -0
- package/web/dist/assets/skill-detail-DB7x_FQp.js +1 -0
- package/web/dist/assets/skills-98vCroU8.js +1 -0
- package/web/dist/assets/skills-BKIoqD6K.js +1 -0
- package/web/dist/assets/sql-BsFa4tDR.js +1 -0
- package/web/dist/assets/square-terminal-B6PZX4Qp.js +1 -0
- package/web/dist/assets/tab-link-C5--YMQd.js +1 -0
- package/web/dist/assets/task-changes-ejxPGVJw.js +1 -0
- package/web/dist/assets/task-commits-C6GO5qT-.js +1 -0
- package/web/dist/assets/task-files-CatpCBXa.js +2 -0
- package/web/dist/assets/task-thread-BMbXDM3d.js +5 -0
- package/web/dist/assets/tasks-table-dgezlCcg.js +1 -0
- package/web/dist/assets/trash-2-CDtxmmc8.js +1 -0
- package/web/dist/assets/triangle-alert-6su4Js5O.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-Bp7hQxll.js +1 -0
- package/web/dist/assets/use-desktop-CvTwojOJ.js +3 -0
- package/web/dist/assets/utils-rQGbOrwc.js +1 -0
- package/web/dist/assets/workflows-Dy2c6790.js +11 -0
- package/web/dist/assets/x-Br_jIDBw.js +1 -0
- package/web/dist/assets/yaml-rwi0_p6S.js +1 -0
- package/web/dist/index.html +70 -0
- package/web/open-mercato.svg +11 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export type RunStatus = 'queued' | 'running' | 'waiting' | 'review' | 'done' | 'failed' | 'cancelled';
|
|
4
|
+
/**
|
|
5
|
+
* A sub-state of `running` (spec 2026-07-18-subagent-monitoring-status, #490):
|
|
6
|
+
* the agent ended its turn still working on its own downstream work (a sub-agent
|
|
7
|
+
* or a monitored command) and declared it with the `CEZ:MONITORING` marker — so
|
|
8
|
+
* the cockpit shows a non-attention "monitoring" label instead of "needs you".
|
|
9
|
+
* Only ever set while `status === 'running'`; cleared on resume/terminal.
|
|
10
|
+
*/
|
|
11
|
+
export type RunActivity = 'monitoring';
|
|
12
|
+
export type StepStatus = 'pending' | 'running' | 'waiting' | 'review' | 'done' | 'failed' | 'cancelled' | 'skipped';
|
|
13
|
+
declare const stepStateSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
kind: z.ZodEnum<["agent", "check"]>;
|
|
17
|
+
status: z.ZodEnum<["pending", "running", "waiting", "review", "done", "failed", "cancelled", "skipped"]>;
|
|
18
|
+
iterations: z.ZodNumber;
|
|
19
|
+
tokensUsed: z.ZodNumber;
|
|
20
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
21
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
22
|
+
error: z.ZodOptional<z.ZodString>;
|
|
23
|
+
/** Latest claude session id — the user can `claude --resume <id>` with it. */
|
|
24
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
/** Dollar cost reported by the claude CLI for this step's turns. */
|
|
26
|
+
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
status: "running" | "waiting" | "review" | "done" | "failed" | "cancelled" | "pending" | "skipped";
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
kind: "agent" | "check";
|
|
32
|
+
iterations: number;
|
|
33
|
+
tokensUsed: number;
|
|
34
|
+
startedAt?: string | undefined;
|
|
35
|
+
finishedAt?: string | undefined;
|
|
36
|
+
error?: string | undefined;
|
|
37
|
+
sessionId?: string | undefined;
|
|
38
|
+
costUsd?: number | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
status: "running" | "waiting" | "review" | "done" | "failed" | "cancelled" | "pending" | "skipped";
|
|
41
|
+
name: string;
|
|
42
|
+
id: string;
|
|
43
|
+
kind: "agent" | "check";
|
|
44
|
+
iterations: number;
|
|
45
|
+
tokensUsed: number;
|
|
46
|
+
startedAt?: string | undefined;
|
|
47
|
+
finishedAt?: string | undefined;
|
|
48
|
+
error?: string | undefined;
|
|
49
|
+
sessionId?: string | undefined;
|
|
50
|
+
costUsd?: number | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
declare const runRecordSchema: z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
title: z.ZodString;
|
|
55
|
+
/** Display title (#389): the auto-derived summary of the first agent turn,
|
|
56
|
+
* or the user's inline edit (`PATCH /api/runs/:id` sets it together with
|
|
57
|
+
* `title` so edits always win). The UI shows `titleSummary ?? title`. */
|
|
58
|
+
titleSummary: z.ZodOptional<z.ZodString>;
|
|
59
|
+
/** `git diff --shortstat` of the worktree vs its base, refreshed on every
|
|
60
|
+
* turn-end (#389) — what the quick list / table shows without a git call. */
|
|
61
|
+
diffStat: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
adds: z.ZodNumber;
|
|
63
|
+
dels: z.ZodNumber;
|
|
64
|
+
files: z.ZodNumber;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
adds: number;
|
|
67
|
+
dels: number;
|
|
68
|
+
files: number;
|
|
69
|
+
}, {
|
|
70
|
+
adds: number;
|
|
71
|
+
dels: number;
|
|
72
|
+
files: number;
|
|
73
|
+
}>>;
|
|
74
|
+
workflow: z.ZodString;
|
|
75
|
+
task: z.ZodString;
|
|
76
|
+
/** URLs of images attached to the initial task prompt, for the thread's first bubble
|
|
77
|
+
* (#image-display) — persisted like agent screenshots, served from `/images/`. */
|
|
78
|
+
taskImages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
79
|
+
model: z.ZodOptional<z.ZodString>;
|
|
80
|
+
/** Agent backend this run used — drives "open in CLI" resume command. */
|
|
81
|
+
runner: z.ZodOptional<z.ZodEnum<["claude", "codex", "opencode"]>>;
|
|
82
|
+
/** Echo of the extra system prompt this run actually used (R2): the
|
|
83
|
+
* `POST /api/runs` override, or the `config.json` default it fell back to.
|
|
84
|
+
* Deliberately NOT the full composed prompt — skill bodies and the handoff
|
|
85
|
+
* contract are derivable from the persisted workflow and would bloat the
|
|
86
|
+
* index. Resolved at execute time (a queued run picks up config edits). */
|
|
87
|
+
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
88
|
+
/** Per-task follow-up inbox contract (spec 007, #444). Missing on old runs
|
|
89
|
+
* means enabled — the historical behavior. */
|
|
90
|
+
generateFollowups: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
/** Autonomous mode (#489): the run was started with the "autonomous" checkbox,
|
|
92
|
+
* so it never parks at `waiting` (auto-nudge) and — once persisted here —
|
|
93
|
+
* never parks at the terminal `review` gate either (`settleSuccess` + the
|
|
94
|
+
* group-pick winner-park read it). Additive-safe: absent = falsy = not
|
|
95
|
+
* autonomous. Set at creation from `WorkflowInput.autonomous`. */
|
|
96
|
+
autonomous: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
+
status: z.ZodEnum<["queued", "running", "waiting", "review", "done", "failed", "cancelled"]>;
|
|
98
|
+
/** Sub-state of `running` (spec 2026-07-18-subagent-monitoring-status, #490):
|
|
99
|
+
* `monitoring` while the agent is still working on its own downstream work.
|
|
100
|
+
* Optional/absent on old runs; cleared when the run resumes or ends. */
|
|
101
|
+
activity: z.ZodOptional<z.ZodEnum<["monitoring"]>>;
|
|
102
|
+
createdAt: z.ZodString;
|
|
103
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
104
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
105
|
+
tokensUsed: z.ZodNumber;
|
|
106
|
+
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
/** First GitHub PR URL spotted in the transcript (the janitor trick). */
|
|
108
|
+
pullRequestUrl: z.ZodOptional<z.ZodString>;
|
|
109
|
+
/** The PR this task is ABOUT (#407, spec 2026-07-16-pr-autodiscovery):
|
|
110
|
+
* auto-discovered from conversation references for tasks that work on an
|
|
111
|
+
* existing PR (review/continue/merge). Display-only tier — `pullRequestUrl`
|
|
112
|
+
* (the PR this task CREATED) always wins, and action gates ignore this. */
|
|
113
|
+
referencedPullRequestUrl: z.ZodOptional<z.ZodString>;
|
|
114
|
+
/** The PR/issue number this task is ABOUT (spec 2026-07-17-task-auto-naming):
|
|
115
|
+
* regex-extracted from the task prompt, upgradable by the namer's
|
|
116
|
+
* cross-checked output. Display tier — never gates actions. */
|
|
117
|
+
prNumber: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
issueNumber: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
/** Who owns the display title: `user` (PATCH rename — never auto-overwritten)
|
|
120
|
+
* or `auto` (namer-owned — a later namer result may replace it). Missing on
|
|
121
|
+
* old runs = legacy behavior (auto fills only an unset titleSummary). */
|
|
122
|
+
titleOrigin: z.ZodOptional<z.ZodEnum<["user", "auto"]>>;
|
|
123
|
+
/** Distinct PR URLs spotted so far — the referenced tier's working set,
|
|
124
|
+
* persisted so a resumed run keeps disambiguating against the full history
|
|
125
|
+
* instead of re-adopting the next URL as "the only one". Capped. */
|
|
126
|
+
referencedPrCandidates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
127
|
+
/** Task worktree (spec 006) — absent when the run executed in the repo root. */
|
|
128
|
+
worktreePath: z.ZodOptional<z.ZodString>;
|
|
129
|
+
/** The task's own branch (`cez/<id8>`), created off `baseBranch`. */
|
|
130
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
131
|
+
/** Branch (or commit, when HEAD was detached) the worktree was forked from. */
|
|
132
|
+
baseBranch: z.ZodOptional<z.ZodString>;
|
|
133
|
+
/** Set when count-based retention (#483) reclaimed this run's worktree
|
|
134
|
+
* *directory* (the `cez/<id8>` branch is kept). Presence means "materialized
|
|
135
|
+
* dir gone, recoverable via `git worktree add`"; it excludes the run from the
|
|
136
|
+
* retention budget until the dir is re-materialized (resume clears it). */
|
|
137
|
+
worktreeReclaimedAt: z.ZodOptional<z.ZodString>;
|
|
138
|
+
/** Parallel variants (spec 010): tasks sharing a groupId are one group. */
|
|
139
|
+
groupId: z.ZodOptional<z.ZodString>;
|
|
140
|
+
/** Variant letter within the group — 'A' | 'B' | 'C' (kept as a string). */
|
|
141
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
142
|
+
/** Peak resident memory (bytes) / process count observed across the run's
|
|
143
|
+
* agent process trees (#348) — written when a session's telemetry ends.
|
|
144
|
+
* Optional: old runs.json files and `ps`-less platforms have neither. */
|
|
145
|
+
peakRssBytes: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
peakProcCount: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
archived: z.ZodDefault<z.ZodBoolean>;
|
|
148
|
+
archivedAt: z.ZodOptional<z.ZodString>;
|
|
149
|
+
currentStepId: z.ZodOptional<z.ZodString>;
|
|
150
|
+
error: z.ZodOptional<z.ZodString>;
|
|
151
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
kind: z.ZodEnum<["agent", "check"]>;
|
|
155
|
+
status: z.ZodEnum<["pending", "running", "waiting", "review", "done", "failed", "cancelled", "skipped"]>;
|
|
156
|
+
iterations: z.ZodNumber;
|
|
157
|
+
tokensUsed: z.ZodNumber;
|
|
158
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
159
|
+
finishedAt: z.ZodOptional<z.ZodString>;
|
|
160
|
+
error: z.ZodOptional<z.ZodString>;
|
|
161
|
+
/** Latest claude session id — the user can `claude --resume <id>` with it. */
|
|
162
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
/** Dollar cost reported by the claude CLI for this step's turns. */
|
|
164
|
+
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
status: "running" | "waiting" | "review" | "done" | "failed" | "cancelled" | "pending" | "skipped";
|
|
167
|
+
name: string;
|
|
168
|
+
id: string;
|
|
169
|
+
kind: "agent" | "check";
|
|
170
|
+
iterations: number;
|
|
171
|
+
tokensUsed: number;
|
|
172
|
+
startedAt?: string | undefined;
|
|
173
|
+
finishedAt?: string | undefined;
|
|
174
|
+
error?: string | undefined;
|
|
175
|
+
sessionId?: string | undefined;
|
|
176
|
+
costUsd?: number | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
status: "running" | "waiting" | "review" | "done" | "failed" | "cancelled" | "pending" | "skipped";
|
|
179
|
+
name: string;
|
|
180
|
+
id: string;
|
|
181
|
+
kind: "agent" | "check";
|
|
182
|
+
iterations: number;
|
|
183
|
+
tokensUsed: number;
|
|
184
|
+
startedAt?: string | undefined;
|
|
185
|
+
finishedAt?: string | undefined;
|
|
186
|
+
error?: string | undefined;
|
|
187
|
+
sessionId?: string | undefined;
|
|
188
|
+
costUsd?: number | undefined;
|
|
189
|
+
}>, "many">;
|
|
190
|
+
/** Full workflow definition, persisted so a `queued` run can be re-enqueued
|
|
191
|
+
* after a restart (#367) — including ad-hoc "(planned)" chains that exist
|
|
192
|
+
* nowhere else. Kept loose here to avoid an upward import; the run manager
|
|
193
|
+
* validates the shape before reviving it. */
|
|
194
|
+
workflowDef: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
status: "queued" | "running" | "waiting" | "review" | "done" | "failed" | "cancelled";
|
|
197
|
+
id: string;
|
|
198
|
+
tokensUsed: number;
|
|
199
|
+
title: string;
|
|
200
|
+
workflow: string;
|
|
201
|
+
task: string;
|
|
202
|
+
createdAt: string;
|
|
203
|
+
archived: boolean;
|
|
204
|
+
steps: {
|
|
205
|
+
status: "running" | "waiting" | "review" | "done" | "failed" | "cancelled" | "pending" | "skipped";
|
|
206
|
+
name: string;
|
|
207
|
+
id: string;
|
|
208
|
+
kind: "agent" | "check";
|
|
209
|
+
iterations: number;
|
|
210
|
+
tokensUsed: number;
|
|
211
|
+
startedAt?: string | undefined;
|
|
212
|
+
finishedAt?: string | undefined;
|
|
213
|
+
error?: string | undefined;
|
|
214
|
+
sessionId?: string | undefined;
|
|
215
|
+
costUsd?: number | undefined;
|
|
216
|
+
}[];
|
|
217
|
+
baseBranch?: string | undefined;
|
|
218
|
+
systemPrompt?: string | undefined;
|
|
219
|
+
branch?: string | undefined;
|
|
220
|
+
startedAt?: string | undefined;
|
|
221
|
+
finishedAt?: string | undefined;
|
|
222
|
+
error?: string | undefined;
|
|
223
|
+
costUsd?: number | undefined;
|
|
224
|
+
titleSummary?: string | undefined;
|
|
225
|
+
diffStat?: {
|
|
226
|
+
adds: number;
|
|
227
|
+
dels: number;
|
|
228
|
+
files: number;
|
|
229
|
+
} | undefined;
|
|
230
|
+
taskImages?: string[] | undefined;
|
|
231
|
+
model?: string | undefined;
|
|
232
|
+
runner?: "claude" | "codex" | "opencode" | undefined;
|
|
233
|
+
generateFollowups?: boolean | undefined;
|
|
234
|
+
autonomous?: boolean | undefined;
|
|
235
|
+
activity?: "monitoring" | undefined;
|
|
236
|
+
pullRequestUrl?: string | undefined;
|
|
237
|
+
referencedPullRequestUrl?: string | undefined;
|
|
238
|
+
prNumber?: number | undefined;
|
|
239
|
+
issueNumber?: number | undefined;
|
|
240
|
+
titleOrigin?: "user" | "auto" | undefined;
|
|
241
|
+
referencedPrCandidates?: string[] | undefined;
|
|
242
|
+
worktreePath?: string | undefined;
|
|
243
|
+
worktreeReclaimedAt?: string | undefined;
|
|
244
|
+
groupId?: string | undefined;
|
|
245
|
+
variant?: string | undefined;
|
|
246
|
+
peakRssBytes?: number | undefined;
|
|
247
|
+
peakProcCount?: number | undefined;
|
|
248
|
+
archivedAt?: string | undefined;
|
|
249
|
+
currentStepId?: string | undefined;
|
|
250
|
+
workflowDef?: Record<string, unknown> | undefined;
|
|
251
|
+
}, {
|
|
252
|
+
status: "queued" | "running" | "waiting" | "review" | "done" | "failed" | "cancelled";
|
|
253
|
+
id: string;
|
|
254
|
+
tokensUsed: number;
|
|
255
|
+
title: string;
|
|
256
|
+
workflow: string;
|
|
257
|
+
task: string;
|
|
258
|
+
createdAt: string;
|
|
259
|
+
steps: {
|
|
260
|
+
status: "running" | "waiting" | "review" | "done" | "failed" | "cancelled" | "pending" | "skipped";
|
|
261
|
+
name: string;
|
|
262
|
+
id: string;
|
|
263
|
+
kind: "agent" | "check";
|
|
264
|
+
iterations: number;
|
|
265
|
+
tokensUsed: number;
|
|
266
|
+
startedAt?: string | undefined;
|
|
267
|
+
finishedAt?: string | undefined;
|
|
268
|
+
error?: string | undefined;
|
|
269
|
+
sessionId?: string | undefined;
|
|
270
|
+
costUsd?: number | undefined;
|
|
271
|
+
}[];
|
|
272
|
+
baseBranch?: string | undefined;
|
|
273
|
+
systemPrompt?: string | undefined;
|
|
274
|
+
branch?: string | undefined;
|
|
275
|
+
startedAt?: string | undefined;
|
|
276
|
+
finishedAt?: string | undefined;
|
|
277
|
+
error?: string | undefined;
|
|
278
|
+
costUsd?: number | undefined;
|
|
279
|
+
titleSummary?: string | undefined;
|
|
280
|
+
diffStat?: {
|
|
281
|
+
adds: number;
|
|
282
|
+
dels: number;
|
|
283
|
+
files: number;
|
|
284
|
+
} | undefined;
|
|
285
|
+
taskImages?: string[] | undefined;
|
|
286
|
+
model?: string | undefined;
|
|
287
|
+
runner?: "claude" | "codex" | "opencode" | undefined;
|
|
288
|
+
generateFollowups?: boolean | undefined;
|
|
289
|
+
autonomous?: boolean | undefined;
|
|
290
|
+
activity?: "monitoring" | undefined;
|
|
291
|
+
pullRequestUrl?: string | undefined;
|
|
292
|
+
referencedPullRequestUrl?: string | undefined;
|
|
293
|
+
prNumber?: number | undefined;
|
|
294
|
+
issueNumber?: number | undefined;
|
|
295
|
+
titleOrigin?: "user" | "auto" | undefined;
|
|
296
|
+
referencedPrCandidates?: string[] | undefined;
|
|
297
|
+
worktreePath?: string | undefined;
|
|
298
|
+
worktreeReclaimedAt?: string | undefined;
|
|
299
|
+
groupId?: string | undefined;
|
|
300
|
+
variant?: string | undefined;
|
|
301
|
+
peakRssBytes?: number | undefined;
|
|
302
|
+
peakProcCount?: number | undefined;
|
|
303
|
+
archived?: boolean | undefined;
|
|
304
|
+
archivedAt?: string | undefined;
|
|
305
|
+
currentStepId?: string | undefined;
|
|
306
|
+
workflowDef?: Record<string, unknown> | undefined;
|
|
307
|
+
}>;
|
|
308
|
+
export type StepState = z.infer<typeof stepStateSchema>;
|
|
309
|
+
export type RunRecord = z.infer<typeof runRecordSchema>;
|
|
310
|
+
/** One persisted event line; `type` mirrors AgentEvent plus engine lifecycle. */
|
|
311
|
+
export interface RunEvent {
|
|
312
|
+
seq: number;
|
|
313
|
+
ts: string;
|
|
314
|
+
stepId?: string;
|
|
315
|
+
type: string;
|
|
316
|
+
[key: string]: unknown;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* File-backed run store: `runs.json` index (atomic tmp+rename writes, the
|
|
320
|
+
* pattern from @cezar/core's IssueStore) plus one append-only NDJSON event
|
|
321
|
+
* file per run. Also the in-process event bus the SSE endpoints subscribe to:
|
|
322
|
+
* emits `('run', RunRecord)` and `('event', { runId, event: RunEvent })`.
|
|
323
|
+
*/
|
|
324
|
+
export declare class RunStore extends EventEmitter {
|
|
325
|
+
private readonly dataDir;
|
|
326
|
+
private runs;
|
|
327
|
+
private saveTimer;
|
|
328
|
+
private constructor();
|
|
329
|
+
/**
|
|
330
|
+
* `keepLive` (#367): leave `queued`/`running`/`waiting` statuses untouched
|
|
331
|
+
* so the caller can recover them (RunManager.recover re-queues queued runs,
|
|
332
|
+
* resumes interrupted ones). Without it — one-shot CLI paths that never
|
|
333
|
+
* recover — live-looking runs are marked failed so no ghost stays behind.
|
|
334
|
+
*/
|
|
335
|
+
static open(dataDir: string, opts?: {
|
|
336
|
+
keepLive?: boolean;
|
|
337
|
+
}): RunStore;
|
|
338
|
+
listRuns(): RunRecord[];
|
|
339
|
+
getRun(id: string): RunRecord | undefined;
|
|
340
|
+
createRun(input: {
|
|
341
|
+
title: string;
|
|
342
|
+
workflow: string;
|
|
343
|
+
task: string;
|
|
344
|
+
model?: string;
|
|
345
|
+
runner?: 'claude' | 'codex' | 'opencode';
|
|
346
|
+
generateFollowups?: boolean;
|
|
347
|
+
autonomous?: boolean;
|
|
348
|
+
groupId?: string;
|
|
349
|
+
variant?: string;
|
|
350
|
+
steps: Array<Pick<StepState, 'id' | 'name' | 'kind'>>;
|
|
351
|
+
}): RunRecord;
|
|
352
|
+
updateRun(id: string, patch: Partial<Omit<RunRecord, 'id' | 'steps'>>): RunRecord | undefined;
|
|
353
|
+
/** Append a step to an existing run (used by "Continue" — spec 003). */
|
|
354
|
+
addStep(runId: string, step: Pick<StepState, 'id' | 'name' | 'kind'>): void;
|
|
355
|
+
updateStep(runId: string, stepId: string, patch: Partial<Omit<StepState, 'id'>>): void;
|
|
356
|
+
setArchived(id: string, archived: boolean): RunRecord | undefined;
|
|
357
|
+
/** Bulk-archive every finished run; returns how many were archived. */
|
|
358
|
+
archiveFinished(): number;
|
|
359
|
+
appendEvent(runId: string, event: {
|
|
360
|
+
type: string;
|
|
361
|
+
stepId?: string;
|
|
362
|
+
[key: string]: unknown;
|
|
363
|
+
}): RunEvent;
|
|
364
|
+
/**
|
|
365
|
+
* Fold every PR URL in `haystack` into the run's referenced-tier working
|
|
366
|
+
* set and re-resolve `referencedPullRequestUrl` (spec
|
|
367
|
+
* 2026-07-16-pr-autodiscovery). Mutates the record in place — the caller
|
|
368
|
+
* owns persistence/fan-out — and reports whether anything changed.
|
|
369
|
+
*/
|
|
370
|
+
private trackReferencedPrs;
|
|
371
|
+
/**
|
|
372
|
+
* Fan an event out to live subscribers WITHOUT writing it to the NDJSON
|
|
373
|
+
* file — the channel for coalesced `item.delta` flushes (protocol-v2
|
|
374
|
+
* performance guardrail: raw deltas never hit disk; replay = the persisted
|
|
375
|
+
* snapshots). Stamped with `seq`/`ts` like persisted lines so the live
|
|
376
|
+
* wire keeps one ordering axis; the seq simply never appears in a replay
|
|
377
|
+
* (gaps are fine — dedup compares with `>`).
|
|
378
|
+
*/
|
|
379
|
+
emitEphemeral(runId: string, event: {
|
|
380
|
+
type: string;
|
|
381
|
+
stepId?: string;
|
|
382
|
+
[key: string]: unknown;
|
|
383
|
+
}): RunEvent;
|
|
384
|
+
readEvents(runId: string): RunEvent[];
|
|
385
|
+
deleteRun(id: string): boolean;
|
|
386
|
+
/** Write the index out now (used on shutdown). */
|
|
387
|
+
flush(): void;
|
|
388
|
+
private seqs;
|
|
389
|
+
private nextSeq;
|
|
390
|
+
/** After a restart the in-memory counter is empty while the run's NDJSON file
|
|
391
|
+
* keeps the history. Restarting from 1 would collide with the seqs a client
|
|
392
|
+
* already replayed — its `seq > maxSeq` dedup then silently drops every
|
|
393
|
+
* resumed event, even across a reload (the frozen-transcript symptom class
|
|
394
|
+
* of #424). One file read on the first post-restart append per run. */
|
|
395
|
+
private rehydrateSeq;
|
|
396
|
+
private eventsPath;
|
|
397
|
+
/** Same location `handoffPath()` in handoff.ts produces — inlined to keep
|
|
398
|
+
* the store free of upward imports. */
|
|
399
|
+
private handoffPath;
|
|
400
|
+
/** Agent screenshots persisted by the run manager (see persistImage). */
|
|
401
|
+
private imagesDir;
|
|
402
|
+
private touch;
|
|
403
|
+
private pruneOldRuns;
|
|
404
|
+
/** Debounced so token-usage updates don't rewrite the index per event. */
|
|
405
|
+
private scheduleSave;
|
|
406
|
+
private saveNow;
|
|
407
|
+
}
|
|
408
|
+
export {};
|