@open-mercato/cezar 0.9.2-pr774.1069 → 0.9.2-pr774.1152

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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -7
  3. package/dist/contract/health.d.ts +2 -0
  4. package/dist/contract/index.js +71 -11
  5. package/dist/contract/runs.d.ts +86 -0
  6. package/dist/contract/workspace.d.ts +18 -0
  7. package/dist/core/agent-env.js +16 -1
  8. package/dist/core/agent-env.js.map +1 -1
  9. package/dist/git-diff-base.d.ts +51 -26
  10. package/dist/git-diff-base.js +163 -37
  11. package/dist/git-diff-base.js.map +1 -1
  12. package/dist/git-worktree.d.ts +15 -6
  13. package/dist/git-worktree.js +10 -3
  14. package/dist/git-worktree.js.map +1 -1
  15. package/dist/index.js +1 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/runs/agent-tmpdir.d.ts +41 -0
  18. package/dist/runs/agent-tmpdir.js +183 -0
  19. package/dist/runs/agent-tmpdir.js.map +1 -0
  20. package/dist/runs/run-index.d.ts +19 -0
  21. package/dist/runs/run-index.js +43 -0
  22. package/dist/runs/run-index.js.map +1 -0
  23. package/dist/runs/store.d.ts +34 -7
  24. package/dist/runs/store.js +71 -38
  25. package/dist/runs/store.js.map +1 -1
  26. package/dist/server/capabilities.d.ts +15 -1
  27. package/dist/server/capabilities.js +16 -1
  28. package/dist/server/capabilities.js.map +1 -1
  29. package/dist/server/git-changes.d.ts +7 -5
  30. package/dist/server/git-changes.js +15 -10
  31. package/dist/server/git-changes.js.map +1 -1
  32. package/dist/server/open-in-terminal.d.ts +21 -0
  33. package/dist/server/open-in-terminal.js +34 -6
  34. package/dist/server/open-in-terminal.js.map +1 -1
  35. package/dist/server/server.d.ts +413 -30
  36. package/dist/server/server.js +183 -4
  37. package/dist/server/server.js.map +1 -1
  38. package/dist/workflows/run.d.ts +43 -8
  39. package/dist/workflows/run.js +187 -73
  40. package/dist/workflows/run.js.map +1 -1
  41. package/dist/workspace/config.d.ts +8 -0
  42. package/dist/workspace/config.js +30 -2
  43. package/dist/workspace/config.js.map +1 -1
  44. package/dist/workspace/semaphore.d.ts +7 -1
  45. package/dist/workspace/semaphore.js +10 -4
  46. package/dist/workspace/semaphore.js.map +1 -1
  47. package/dist/workspace/ui-state.d.ts +3 -2
  48. package/dist/workspace/ui-state.js +3 -2
  49. package/dist/workspace/ui-state.js.map +1 -1
  50. package/package.json +3 -3
  51. package/web/dist/assets/{alert-dialog-6dQMgOXw.js → alert-dialog-CSMa0HsT.js} +1 -1
  52. package/web/dist/assets/arrow-down-InSO8M3a.js +1 -0
  53. package/web/dist/assets/arrow-left-B3A8B0hL.js +1 -0
  54. package/web/dist/assets/centered-state-BVi8t9SC.js +43 -0
  55. package/web/dist/assets/chevron-right-DoW920MS.js +1 -0
  56. package/web/dist/assets/circle-check-SoGYTN6x.js +1 -0
  57. package/web/dist/assets/{circle-x-DF_Vyxoz.js → circle-x-B79VY5pL.js} +1 -1
  58. package/web/dist/assets/{collapsible-BJslo1eE.js → collapsible-kudGccHQ.js} +1 -1
  59. package/web/dist/assets/{commit-list-DPoEJ-5l.js → commit-list-BzHnrDcm.js} +1 -1
  60. package/web/dist/assets/{compare-variants-Ddz-oUCA.js → compare-variants-j2iFdnmg.js} +1 -1
  61. package/web/dist/assets/{diff-BdWNf9S7.js → diff-EQ_rwwcv.js} +2 -2
  62. package/web/dist/assets/{diff-stat-CXB01WSy.js → diff-stat-D7yPEDa4.js} +1 -1
  63. package/web/dist/assets/{diff-view-Bsy3QLyj.js → diff-view-DxyDEIvp.js} +1 -1
  64. package/web/dist/assets/{dropdown-menu-B4Epti3u.js → dropdown-menu-DXHcIcFx.js} +1 -1
  65. package/web/dist/assets/{editable-title-CbQ3uoGg.js → editable-title-B-8toBJF.js} +1 -1
  66. package/web/dist/assets/{ellipsis-vertical-BVCmLX8u.js → ellipsis-vertical-OTqlQW9K.js} +1 -1
  67. package/web/dist/assets/{file-Bml0aHqJ.js → file-tcLgzUDA.js} +1 -1
  68. package/web/dist/assets/{folder-CBh3ERAX.js → folder-m1gUM3Td.js} +1 -1
  69. package/web/dist/assets/{git-pull-request-3Jrr-Hnz.js → git-pull-request-B1Ac3Upb.js} +1 -1
  70. package/web/dist/assets/{git-toolbar-Gy4_cPLz.js → git-toolbar-CY8wCKzu.js} +1 -1
  71. package/web/dist/assets/github-gJufK_lG.js +1 -0
  72. package/web/dist/assets/{image-preview-DS7DvehB.js → image-preview-Bceu_tYW.js} +1 -1
  73. package/web/dist/assets/index-BtNBY2IK.js +6 -0
  74. package/web/dist/assets/index-D6LN2Ox9.css +2 -0
  75. package/web/dist/assets/{markdown-B1EknoxI.js → markdown-C-AT0iiM.js} +1 -1
  76. package/web/dist/assets/{new-task-form-1cTj9thS.js → new-task-form-LOjCwAJ2.js} +1 -1
  77. package/web/dist/assets/{pill-BHn0lyG-.js → pill-DIV7_gK1.js} +1 -1
  78. package/web/dist/assets/{project-router-BkbADB0Z.js → project-router-C7OTDOgA.js} +1 -1
  79. package/web/dist/assets/{prompt-templates-D83ZM7XO.js → prompt-templates-De8StQQx.js} +1 -1
  80. package/web/dist/assets/{refresh-cw-DX8Tj6b9.js → refresh-cw-XchSnyiK.js} +1 -1
  81. package/web/dist/assets/{repo-git-CKR1UKRl.js → repo-git-DVGW_Ys-.js} +1 -1
  82. package/web/dist/assets/{run-diff-BKlEMNhf.js → run-diff-Dbsmzd5m.js} +2 -2
  83. package/web/dist/assets/run-header-sLQYfde1.js +1 -0
  84. package/web/dist/assets/{search-x-B1NrVJwd.js → search-x-DukQXe7W.js} +1 -1
  85. package/web/dist/assets/{skill-empty-hint-CLB1FsYI.js → skill-empty-hint-BVMDj1lc.js} +1 -1
  86. package/web/dist/assets/{skills-OLjkJUPE.js → skills-GOfLDD8P.js} +1 -1
  87. package/web/dist/assets/{sparkles-iifrwy2d.js → sparkles-CHlUIlGw.js} +1 -1
  88. package/web/dist/assets/{square-terminal-B7pjoOV-.js → square-terminal-B69cDBuo.js} +1 -1
  89. package/web/dist/assets/{tab-link-CDAMnCm8.js → tab-link-DzUYHf9Y.js} +1 -1
  90. package/web/dist/assets/task-changes-6uLedXj6.js +1 -0
  91. package/web/dist/assets/{task-commits-BCgNsn2-.js → task-commits-DKhVN4_M.js} +1 -1
  92. package/web/dist/assets/{task-files-DbzZ7e5E.js → task-files-BiR1bKx4.js} +2 -2
  93. package/web/dist/assets/{task-thread-D6I003ru.js → task-thread-0Avm18Ui.js} +7 -7
  94. package/web/dist/assets/{textarea-BDfkreJ8.js → textarea-BrVUzPHD.js} +1 -1
  95. package/web/dist/assets/thread-loading-Bj04So1w.js +1 -0
  96. package/web/dist/assets/{trash-2-Bm7yPRlf.js → trash-2-DfL3yKti.js} +1 -1
  97. package/web/dist/assets/{triangle-alert-BoNsVbBe.js → triangle-alert-CJG60C3y.js} +1 -1
  98. package/web/dist/assets/{upload-DNOSu710.js → upload-C_Y-PLjT.js} +1 -1
  99. package/web/dist/assets/{use-desktop-vb6126vH.js → use-desktop-DXPjqExD.js} +1 -1
  100. package/web/dist/assets/{use-submit-shortcut-DyHLUMIa.js → use-submit-shortcut-q752scLj.js} +1 -1
  101. package/web/dist/assets/{utils-CT1niAPs.js → utils-DTj2phIf.js} +1 -1
  102. package/web/dist/assets/{workflows-BJqCaffV.js → workflows-BGh35yB7.js} +3 -3
  103. package/web/dist/assets/{zoomable-image-C7pDSJpR.js → zoomable-image-I8NhtaXC.js} +1 -1
  104. package/web/dist/index.html +23 -23
  105. package/web/dist/assets/arrow-down-9F3rZKJT.js +0 -1
  106. package/web/dist/assets/arrow-left-BOTr2zuB.js +0 -1
  107. package/web/dist/assets/centered-state-QSAdDoHK.js +0 -43
  108. package/web/dist/assets/chevron-right-Bga7k0g0.js +0 -1
  109. package/web/dist/assets/circle-check-CMvUZyJZ.js +0 -1
  110. package/web/dist/assets/github-BcC0R3jc.js +0 -1
  111. package/web/dist/assets/index-B84F80Q8.css +0 -2
  112. package/web/dist/assets/index-BQhkx-lw.js +0 -6
  113. package/web/dist/assets/run-header-BC6ZZQtf.js +0 -1
  114. package/web/dist/assets/task-changes-Dc7u63rJ.js +0 -1
  115. package/web/dist/assets/thread-loading-D6DMmo5_.js +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Patryk Lewczuk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -19,7 +19,7 @@ your phone, working your backlog while you're away.
19
19
 
20
20
  [A look inside](#a-look-inside) · [What cezar does best](#what-cezar-does-best) · [What it solves](#what-it-solves) · [Who it's for](#who-its-for) · [Quick start](#quick-start) · [How it works](#how-it-works) · [Core concepts](#core-concepts) · [Cockpit tour](#cockpit-tour) · [Agent backends](#coding-agent-backends) · [Remote access](#remote-access-host-cezar-on-a-server)
21
21
 
22
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](#license)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
23
23
  ![Node 20+](https://img.shields.io/badge/Node-20%2B-339933)
24
24
  ![TypeScript 7.x](https://img.shields.io/badge/TypeScript-7.x-3178c6)
25
25
  ![Zero config](https://img.shields.io/badge/config-zero-success)
@@ -359,11 +359,12 @@ cezar projects remove api # drop the registry entry; the repo is untouch
359
359
  These read and write `~/.cezar/config.json` directly, so they work with the
360
360
  server stopped, and `CEZ_HOME` selects which workspace they operate on.
361
361
 
362
- Settings split along the same line: **Agents**, **Worktrees**, **Bookmarklets**,
363
- **Prompt templates** and **MCP** describe one repo and live under
364
- `/p/<projectId>/settings`; **Appearance**, **Notifications**, **Resources**,
365
- **Projects** and **Keyboard** are yours or the machine's and live at
366
- `/settings/global`.
362
+ Settings split along the same line: **General** (the project's folder, its
363
+ registry facts, its parallel-task ceiling, and Remove), **Agents**,
364
+ **Worktrees**, **Bookmarklets**, **Prompt templates** and **MCP** describe one
365
+ repo and live under `/p/<projectId>/settings`; **Appearance**,
366
+ **Notifications**, **Resources**, **Projects** and **Keyboard** are yours or the
367
+ machine's and live at `/settings/global`.
367
368
 
368
369
  **Old page URLs keep working.** Every unprefixed page path — `/`, `/tasks/<id>`,
369
370
  `/settings` — still answers, bound to the project cezar was started in; the
@@ -439,6 +440,7 @@ Useful environment variables:
439
440
  | `CEZ_AGENT_MODELS_LOCKED=1` | Globally lock each runner to the model configured in its native Claude/Codex/OpenCode settings while keeping runner selection available. Exact `1` also delegates authentication and provider enablement to those native agents, so Cezar skips its credential probes and provider-disable preferences. Existing Cezar presets are preserved but ignored, and an environment change requires a restart. The config-file equivalent is `"modelsLocked": true` in global `~/.cezar/config.json` or one repository's `.ai/cezar/config.json`; config-file locks do not disable provider checks. |
440
441
  | `CEZ_APPROVAL_GATE=1` | Opt into Claude's interactive approval UI; by default, unapproved tools are denied without interrupting the run. |
441
442
  | `CEZ_FOLLOWUPS=1` | Turn on the global follow-up **Inbox**: agents are asked to leave follow-ups in `todos.json` when they finish, and the Inbox view appears. Off by default — each task's own **Notes** handoff journal runs either way. |
443
+ | `CEZ_AUTOMATIONS=1` | Turn on **GitHub automations**: the Automations view appears and cezar polls GitHub on each enabled automation's interval, launching tasks from what it finds. Off by default, and only the exact value `1` enables it — without it nothing polls GitHub, the automations endpoints answer `409`, and the nav item is absent. Read at boot, so restart after changing it; definitions, receipts and high-watermarks are retained, so unsetting it and restarting restores the feature without migration or data loss. |
442
444
  | `CEZ_AUTOSAVE=1` | Re-enable the periodic (90 s) autosave commit in task worktrees. Off by default (#471) — turn-end and pre-PR flushes always run, so branches still end complete. Every autosave names its trigger in the commit subject (`cezar autosave (periodic)` vs `(turn end)` / `(run finalize)` / `(pre-PR)`), so the flushes you keep are distinguishable from the timer you disabled. |
443
445
  | `CEZ_CLAUDE_BIN=/path/to/claude` | Override which `claude` binary is used. |
444
446
  | `CEZ_CODEX_BIN=/path/to/codex` | Override which `codex` binary is used. |
@@ -449,6 +451,7 @@ Useful environment variables:
449
451
  | `CEZ_SKILLS_AUTO_UPDATE=0` | Disable automatic checks and updates for upstream-CLI-tracked Open Mercato skill installations. On by default; a saved global Skills setting overrides this environment default. Checks are delayed, bounded, cached, and non-blocking. |
450
452
  | `CEZ_AUTONOMOUS_DEFAULT=0` | Seed the New Task Autonomous default (`0` or `1`). Without a seed, skills default on and workflows off; a saved global Resources setting overrides it. |
451
453
  | `CEZ_WORKTREE_DEFAULT=1` | Seed the New Task Worktree default (`0` or `1`). Without a seed, eligible runs default on; a saved global Resources setting overrides it. |
454
+ | `CEZ_DISABLE_REPO_LOCK=1` | **Dangerous escape hatch:** allow any run executing in the repository root — an explicit `worktree=false` run, non-Git degradation, or a continuation whose worktree cannot be restored — to proceed without Cezar’s repository-root lease. Agents can overwrite each other’s files or Git state; isolated worktree runs are unaffected. Off by default; only the exact value `1` enables it. |
452
455
  | `CEZ_SINGLE_PROJECT=1` | Opt into a launch-project-only cockpit: only the exact value `1` enables it. Project add, edit, checkout, folder browsing, and removal are refused and only the launch project is shown. Off by default; stored registry rows are retained, so unsetting it and restarting restores the full multi-project workspace without migration or data loss. |
453
456
  | `CEZ_HIDE_TOKEN_USAGE=1` | Hide raw input/output token counts throughout the browser cockpit while leaving backend-reported cost visible. Only the exact value `1` enables it; telemetry and API payloads are unchanged, and a restart is required after changing it. |
454
457
  | `CEZ_HIDE_COST=1` | Hide backend-reported monetary cost throughout the browser cockpit while leaving raw input/output token counts visible. Only the exact value `1` enables it; telemetry and API payloads are unchanged, and a restart is required after changing it. |
@@ -456,6 +459,7 @@ Useful environment variables:
456
459
  | `GITHUB_TOKEN` | Fallback for GitHub reads/PRs when `gh` isn't authenticated. |
457
460
  | `CEZ_ENV_PASSTHROUGH=A,B` | Forward these extra host env vars to spawned agents. By default agents get a least-privilege env (safe shell/toolchain vars + the backend's own auth + `GITHUB_TOKEN` + `CEZ_*`), not your full environment — use this to add a var an agent needs. |
458
461
  | `CEZ_AGENT_ENV_FULL=1` | Escape hatch: give spawned agents the full host environment (pre-hardening behavior). Off by default; only set it if you understand that this hands every host secret to the agent process. |
462
+ | `CEZ_AGENT_TMPDIR=0` | Stop giving each task its own temp directory and hand agents the host `TMPDIR` again (pre-#785 behavior). On by default: every run gets `TMPDIR`/`TEMP`/`TMP` pointing at `.ai/cezar/tmp/<task-id>`, created and write-probed before the agent spawns and reaped when the run ends, so concurrent tasks stop sharing one directory and a task refuses to start rather than run against a temp directory that silently swallows its shell output (see Troubleshooting below). Only an exact `0` disables it, and it disables the whole thing — the pre-spawn check included, so this stays an escape hatch you can actually take. |
459
463
  | `CEZ_REDACT_SECRETS=0` | Disable scrubbing of credential values/token shapes from the on-disk state (the NDJSON transcript and the free-text fields of `runs.json`). On by default; leave it on. Best-effort defense-in-depth, not a guarantee: it catches known token shapes and the values of your own secret-named env vars, so a credential in neither category can still get through. |
460
464
  | `CEZ_TITLE_UPDATES=0` | Turn off the live task-title refresh (namer re-runs on each turn end). The Settings → Agents toggle overrides this default. |
461
465
  | `CEZ_AUTONAME=0` | Disable ALL LLM task naming (creation + live) — titles stay heuristic (`437: /om-auto-review-pr`). Under `CEZ_DRY_RUN=1` naming is already off unless forced with `CEZ_AUTONAME=1`. |
@@ -463,6 +467,35 @@ Useful environment variables:
463
467
  | `CEZ_NO_BANNER=1` | Skip the `open-mercato/skills` banner on `cezar serve` startup. (The cockpit no longer shows a banner — its skills now live on the Skills page's Manage panel — so this env var is the terminal banner's only switch.) |
464
468
  | `VITE_CEZ_API_BASE=http://localhost:4321` | **Build time only**, and only when the cockpit bundle is deployed apart from the service it talks to. Empty (the default) means "the origin that served this page", which is right for both normal cases: the CLI serves the bundle itself, and `npm run dev` proxies `/api` to the local service. A deployment that must be configured without a rebuild can put `<meta name="cez-api-base" content="…">` in the served HTML instead, which wins over this. |
465
469
 
470
+ ### Troubleshooting: the agent's shell returns nothing
471
+
472
+ **Symptom.** A task on the Claude backend keeps working, but every shell command
473
+ comes back with no output and a spurious non-zero exit status — `echo hello`
474
+ included. Redirecting into a file inside the worktree still produces the right
475
+ content, so the commands genuinely run; only the *capture* is lost. Codex tasks
476
+ on the same machine are unaffected, because that backend streams over stdio
477
+ pipes instead of round-tripping a command's output through a temp file.
478
+
479
+ **Diagnosis.** The temp directory the agent was given is out of space or out of
480
+ quota. One line tells you:
481
+
482
+ ```bash
483
+ echo probe > "${TMPDIR:-/tmp}/probe" # "Disk quota exceeded" / "No space left on device"
484
+ df -i "${TMPDIR:-/tmp}" # a tmpfs can exhaust inodes long before bytes
485
+ ```
486
+
487
+ Under quota the file is *created* and the write then fails, so the backend reads
488
+ back a zero-byte capture file and hands the agent an empty result.
489
+
490
+ **Fix.** Since #785 cezar gives each task its own `TMPDIR` under
491
+ `.ai/cezar/tmp/<task-id>` and write-probes it before spawning, so a broken temp
492
+ directory fails the task with `agent temp directory is not writable: …` on the
493
+ task thread instead of corrupting its work. If you see that error, free space on
494
+ the disk holding the repo. `CEZ_AGENT_TMPDIR=0` turns the whole mechanism off —
495
+ per-task directory and pre-spawn check alike — and hands agents the host
496
+ `TMPDIR` again, which is the way out if the check itself is wrong on your
497
+ platform.
498
+
466
499
  ---
467
500
 
468
501
  ## Coding agent backends
@@ -721,4 +754,4 @@ Start here; graduate to cezar when a team needs shared visibility.
721
754
 
722
755
  ## License
723
756
 
724
- **MIT** © Patryk Lewczuk
757
+ **MIT** © Patryk Lewczuk — full text in [LICENSE](LICENSE).
@@ -38,6 +38,7 @@ export declare const capabilitiesSchema: z.ZodObject<{
38
38
  localHandoff: z.ZodBoolean;
39
39
  followups: z.ZodBoolean;
40
40
  singleProject: z.ZodBoolean;
41
+ automations: z.ZodBoolean;
41
42
  tokenMetrics: z.ZodBoolean;
42
43
  tokenUsageMetrics: z.ZodBoolean;
43
44
  costMetrics: z.ZodBoolean;
@@ -83,6 +84,7 @@ export declare const healthResponseSchema: z.ZodObject<{
83
84
  localHandoff: z.ZodBoolean;
84
85
  followups: z.ZodBoolean;
85
86
  singleProject: z.ZodBoolean;
87
+ automations: z.ZodBoolean;
86
88
  tokenMetrics: z.ZodBoolean;
87
89
  tokenUsageMetrics: z.ZodBoolean;
88
90
  costMetrics: z.ZodBoolean;
@@ -44,6 +44,14 @@ var capabilitiesSchema = z2.object({
44
44
  localHandoff: z2.boolean(),
45
45
  followups: z2.boolean(),
46
46
  singleProject: z2.boolean(),
47
+ /**
48
+ * `true` means `CEZ_AUTOMATIONS=1` opted this server into GitHub automations (#801). Off — the
49
+ * default — the whole feature is absent: no `Automations` nav item anywhere it is rendered, the
50
+ * `/api/v1/…/automations*` family answers `409`, and the workspace scheduler never polls GitHub.
51
+ *
52
+ * REQUIRED for the same reason as `tokenMetrics` below: this server always sends it.
53
+ */
54
+ automations: z2.boolean(),
47
55
  /**
48
56
  * `false` means `CEZ_HIDE_TOKEN_METRICS=1` asks the browser to omit token counts and monetary
49
57
  * cost (#481). The telemetry itself still rides in run/event payloads — this is presentation
@@ -204,11 +212,12 @@ var diffStatSchema = z4.object({
204
212
  adds: z4.number(),
205
213
  dels: z4.number(),
206
214
  files: z4.number(),
207
- /** Additive since #751, and present ONLY when true: the numbers cover uncommitted work
208
- * alone, because the worktree's HEAD had been repointed off the task's own branch (every
209
- * review/QA run does this) and the merge-base anchor would otherwise have reported the
210
- * checked-out branch's entire diff as this task's. Absent on every normal run and on every
211
- * record written before #751 a consumer that ignores it sees exactly the old shape. */
215
+ /** Additive since #751, and present ONLY when true: the numbers were measured against a
216
+ * branch the agent checked out into the task's worktree, as the run found it, because the
217
+ * worktree's HEAD had been repointed off the task's own branch (every review/QA run does
218
+ * this) and the merge-base anchor would otherwise have reported that branch's entire diff
219
+ * as this task's. Absent on every normal run and on every record written before #751 — a
220
+ * consumer that ignores it sees exactly the old shape. */
212
221
  repointed: z4.boolean().optional()
213
222
  });
214
223
  var queuedMessageSchema = z4.object({
@@ -333,7 +342,8 @@ var runRecordSchema = z4.object({
333
342
  /** Read receipt (#unread-done-items): ISO time the cockpit last opened this run's
334
343
  * thread. A finished (`done`/`failed`) run reads as *unread* until seen since it
335
344
  * finished — see `isUnread()` in the cockpit's `lib/read-state.ts`. Absent on old
336
- * runs and on any run not yet opened, both of which count as unread. */
345
+ * runs, on any run not yet opened, and on one deliberately put back to unread via
346
+ * `POST /runs/:id/unread` (#775) — all three count as unread. */
337
347
  seenAt: z4.string().optional(),
338
348
  currentStepId: z4.string().optional(),
339
349
  error: z4.string().optional(),
@@ -355,6 +365,40 @@ var runRecordSchema = z4.object({
355
365
  var apiRunSchema = runRecordSchema.extend({
356
366
  usage: processUsageSchema.optional()
357
367
  });
368
+ var runIndexEntrySchema = z4.object({
369
+ /** The registered project this run belongs to. Joins against `GET /projects`. */
370
+ projectId: z4.string(),
371
+ id: z4.string(),
372
+ title: z4.string(),
373
+ titleSummary: z4.string().optional(),
374
+ titleOrigin: z4.enum(["user", "auto", "marker"]).optional(),
375
+ status: runStatusSchema,
376
+ activity: runActivitySchema.optional(),
377
+ createdAt: z4.string(),
378
+ finishedAt: z4.string().optional(),
379
+ /** With `status`/`finishedAt`/`archived`, the four inputs `isUnread` reads — what lets the
380
+ * palette lead with "finished while you weren't looking" across every project, not just the
381
+ * one you happen to be standing in. */
382
+ seenAt: z4.string().optional(),
383
+ /** Always present, like `RunRecord.archived`: absent would read as "not archived", and the
384
+ * unread rule treats archiving as a stronger "done with this" than reading. */
385
+ archived: z4.boolean(),
386
+ /** A run parked by a provider usage limit is `failed` on the record with a resume booked
387
+ * (spec 2026-08-03-auto-resume-after-usage-limit). Both `deriveAttention` and `isUnread` read
388
+ * it, so without it here a cross-project row would show a red "failed" dot and land in
389
+ * Recently finished for work that is simply waiting for its appointment. */
390
+ autoResumeAt: z4.string().optional()
391
+ });
392
+ var runsIndexResponseSchema = z4.object({
393
+ /** Newest first, across every registered project. Archived runs are included — `GET /runs`
394
+ * carries them for the project you are standing in, and a finder that dropped them elsewhere
395
+ * would make a task vanish the moment you left its project. */
396
+ runs: z4.array(runIndexEntrySchema),
397
+ /** The per-project cap that produced this list. */
398
+ perProjectLimit: z4.number(),
399
+ /** Ids of the projects that had more runs than the cap allowed. */
400
+ truncated: z4.array(z4.string())
401
+ });
358
402
  var createRunResponseSchema = z4.union([
359
403
  runRecordSchema,
360
404
  z4.object({ runs: z4.array(runRecordSchema) })
@@ -934,9 +978,11 @@ var workspaceLastLocationSchema = z8.strictObject({
934
978
  hash: z8.string().max(2048).startsWith("#").optional()
935
979
  });
936
980
  var workspaceUiStateSchema = z8.looseObject({
937
- /** The sidebar's per-project collapse map (step 3.3) `true` collapses a group, `false` pins
938
- * it open, absent means the default (the active project expands, the rest collapse). Loose for
939
- * the same round-trip reason as its parent. */
981
+ /** LEGACY — the sidebar's per-project collapse map (step 3.3). Still accepted and still
982
+ * round-tripped so an older cockpit sharing this home keeps working, but the current cockpit
983
+ * neither reads nor writes it: which groups are shut describes the WINDOW, not the workspace,
984
+ * so it lives in that browser's localStorage (`packages/web/src/lib/sidebar-collapse.ts`).
985
+ * One shared answer meant a phone collapsing a group collapsed it on the desktop too. */
940
986
  sidebar: z8.looseObject({ collapsed: z8.record(z8.string(), z8.boolean()).optional() }).optional(),
941
987
  /** Dismissed runtime-auth incident IDs, keyed by provider. An ID is only dismissed until the
942
988
  * provider reports a different incident, so this stays workspace-global with the browser
@@ -952,8 +998,10 @@ var workspaceUiStateSchema = z8.looseObject({
952
998
  /** Settings → Notifications, GLOBAL since step 3.5 — one answer for the whole workspace, since
953
999
  * the delivering browser is one browser whichever project you are looking at. */
954
1000
  notifications: z8.looseObject({ enabled: z8.boolean().optional() }).optional(),
955
- /** Last settled project-scoped page. Used only when entering at the exact bare root;
956
- * explicit deep links always win. */
1001
+ /** LEGACY, exactly like `sidebar` above the last settled project-scoped page, restored when
1002
+ * entering at the exact bare root. The shape is unchanged and still accepted, but the current
1003
+ * cockpit keeps it in localStorage (`packages/web/src/lib/last-location.ts`): stored here, the
1004
+ * last client to navigate decided where every OTHER client's next launch landed. */
957
1005
  lastLocation: workspaceLastLocationSchema.optional(),
958
1006
  /** The user's curated selection of default (vendor) skills. Tri-state: ABSENT means "not
959
1007
  * curated", so every default skill shows; a PRESENT array (even `[]`) means only those names
@@ -1081,6 +1129,14 @@ var openTargetSchema = z8.object({
1081
1129
  var openTargetsResponseSchema = z8.object({
1082
1130
  targets: z8.array(openTargetSchema)
1083
1131
  });
1132
+ var openProjectInSchema = z8.object({
1133
+ // A short bound (#429): matched against a downstream allowlist, so an app id is never long.
1134
+ target: z8.string().trim().min(1, "target required").max(200)
1135
+ });
1136
+ var openProjectInResponseSchema = z8.object({
1137
+ opened: z8.literal(true),
1138
+ path: z8.string()
1139
+ });
1084
1140
 
1085
1141
  // ../contract/src/skills.ts
1086
1142
  import { z as z9 } from "zod";
@@ -1538,6 +1594,8 @@ export {
1538
1594
  openAgentAccountFileInputSchema,
1539
1595
  openAgentAccountFileResponseSchema,
1540
1596
  openInCliResponseSchema,
1597
+ openProjectInResponseSchema,
1598
+ openProjectInSchema,
1541
1599
  openTargetSchema,
1542
1600
  openTargetsResponseSchema,
1543
1601
  parsedWorkflowSchema,
@@ -1568,12 +1626,14 @@ export {
1568
1626
  runCommitSchema,
1569
1627
  runCommitsResponseSchema,
1570
1628
  runEventSchema,
1629
+ runIndexEntrySchema,
1571
1630
  runRecordSchema,
1572
1631
  runStatusSchema,
1573
1632
  runnerModelCatalogResponseSchema,
1574
1633
  runnerModelOptionSchema,
1575
1634
  runnerModelsSchema,
1576
1635
  runnerSchema,
1636
+ runsIndexResponseSchema,
1577
1637
  saveWorkflowInputSchema,
1578
1638
  saveWorkflowResponseSchema,
1579
1639
  selectAgentProfileInputSchema,
@@ -445,6 +445,92 @@ export declare const apiRunSchema: z.ZodObject<{
445
445
  }, z.core.$strip>>;
446
446
  }, z.core.$strip>;
447
447
  export type ApiRun = z.infer<typeof apiRunSchema>;
448
+ /**
449
+ * One run in the WORKSPACE-level index (`GET /api/v1/workspace/runs-index`) — the ⌘K palette's
450
+ * "find a task in any project" list.
451
+ *
452
+ * Deliberately a separate, slim shape rather than `ApiRun`. The index answers for every
453
+ * registered project at once, and `runRecordSchema` carries `steps[]` and `workflowDef` — a fat
454
+ * record whose cost is fine per project and absurd multiplied by the registry. These are exactly
455
+ * the fields a palette row renders: `runTitle`'s three (`title`, `titleSummary`, `titleOrigin`),
456
+ * `deriveAttention`'s `AttentionInput`, `isUnread`'s `ReadStateInput`, and the timestamps
457
+ * `shortAge` reads. Adding a field here is cheap; adding the whole record is what this exists to
458
+ * avoid — but note that widening either of those two `Pick`s means widening this too, or the
459
+ * palette's cross-project rows silently answer differently from every other surface.
460
+ *
461
+ * `projectId` is the join key, NOT the project name: the registry is already on the client and is
462
+ * authoritative for display names, and duplicating one here would let a renamed project show two
463
+ * different labels in one palette.
464
+ */
465
+ export declare const runIndexEntrySchema: z.ZodObject<{
466
+ projectId: z.ZodString;
467
+ id: z.ZodString;
468
+ title: z.ZodString;
469
+ titleSummary: z.ZodOptional<z.ZodString>;
470
+ titleOrigin: z.ZodOptional<z.ZodEnum<{
471
+ auto: "auto";
472
+ marker: "marker";
473
+ user: "user";
474
+ }>>;
475
+ status: z.ZodEnum<{
476
+ cancelled: "cancelled";
477
+ done: "done";
478
+ failed: "failed";
479
+ queued: "queued";
480
+ review: "review";
481
+ running: "running";
482
+ waiting: "waiting";
483
+ }>;
484
+ activity: z.ZodOptional<z.ZodEnum<{
485
+ monitoring: "monitoring";
486
+ }>>;
487
+ createdAt: z.ZodString;
488
+ finishedAt: z.ZodOptional<z.ZodString>;
489
+ seenAt: z.ZodOptional<z.ZodString>;
490
+ archived: z.ZodBoolean;
491
+ autoResumeAt: z.ZodOptional<z.ZodString>;
492
+ }, z.core.$strip>;
493
+ export type RunIndexEntry = z.infer<typeof runIndexEntrySchema>;
494
+ /**
495
+ * `GET /workspace/runs-index`.
496
+ *
497
+ * `truncated` is not decoration: the index caps each project's contribution, and a capped list
498
+ * that says nothing reads as "your task is not here" when the honest answer is "not in the
499
+ * newest N". Naming the projects that hit the cap is what lets a consumer say so.
500
+ */
501
+ export declare const runsIndexResponseSchema: z.ZodObject<{
502
+ runs: z.ZodArray<z.ZodObject<{
503
+ projectId: z.ZodString;
504
+ id: z.ZodString;
505
+ title: z.ZodString;
506
+ titleSummary: z.ZodOptional<z.ZodString>;
507
+ titleOrigin: z.ZodOptional<z.ZodEnum<{
508
+ auto: "auto";
509
+ marker: "marker";
510
+ user: "user";
511
+ }>>;
512
+ status: z.ZodEnum<{
513
+ cancelled: "cancelled";
514
+ done: "done";
515
+ failed: "failed";
516
+ queued: "queued";
517
+ review: "review";
518
+ running: "running";
519
+ waiting: "waiting";
520
+ }>;
521
+ activity: z.ZodOptional<z.ZodEnum<{
522
+ monitoring: "monitoring";
523
+ }>>;
524
+ createdAt: z.ZodString;
525
+ finishedAt: z.ZodOptional<z.ZodString>;
526
+ seenAt: z.ZodOptional<z.ZodString>;
527
+ archived: z.ZodBoolean;
528
+ autoResumeAt: z.ZodOptional<z.ZodString>;
529
+ }, z.core.$strip>>;
530
+ perProjectLimit: z.ZodNumber;
531
+ truncated: z.ZodArray<z.ZodString>;
532
+ }, z.core.$strip>;
533
+ export type RunsIndexResponse = z.infer<typeof runsIndexResponseSchema>;
448
534
  /**
449
535
  * `POST /runs` (201) — one record for ×1, a group for ×2/×3.
450
536
  *
@@ -470,3 +470,21 @@ export declare const openTargetsResponseSchema: z.ZodObject<{
470
470
  }, z.core.$strip>>;
471
471
  }, z.core.$strip>;
472
472
  export type OpenTargetsResponse = z.infer<typeof openTargetsResponseSchema>;
473
+ /**
474
+ * `POST /api/v1/open-in` — open THIS PROJECT'S root in a detected app (Settings → the project
475
+ * folder row). The path is never sent: it is the scoped project's own registered root, resolved
476
+ * server-side, so the route has no traversal surface at all. `target` is an
477
+ * `/api/v1/open-targets` id; unlike the run route there is no `default`/`cli:` handling, because
478
+ * a repo root is a directory and an agent CLI belongs in a task worktree.
479
+ */
480
+ export declare const openProjectInSchema: z.ZodObject<{
481
+ target: z.ZodString;
482
+ }, z.core.$strip>;
483
+ export type OpenProjectInRequest = z.infer<typeof openProjectInSchema>;
484
+ /** The 200 for the above — `opened` is a literal because every failure is a 409 with `{ error }`,
485
+ * so a `false` would be unreachable and would only invite a client to branch on it. */
486
+ export declare const openProjectInResponseSchema: z.ZodObject<{
487
+ opened: z.ZodLiteral<true>;
488
+ path: z.ZodString;
489
+ }, z.core.$strip>;
490
+ export type OpenProjectInResponse = z.infer<typeof openProjectInResponseSchema>;
@@ -278,12 +278,25 @@ function isTruthy(value) {
278
278
  export function buildChildEnv(opts) {
279
279
  const source = opts.source ?? process.env;
280
280
  const extra = opts.extraEnv ?? {};
281
+ // Names `extra` is about to define, normalized. The host copy of a var the
282
+ // per-run env overrides must be DROPPED, not merely shadowed: env names are
283
+ // matched case-insensitively here (and by Windows itself), so a host `Temp`
284
+ // and a per-run `TEMP` are the same variable spelled two ways — leaving both
285
+ // in the child env hands the backend the host value under one of them. That
286
+ // is exactly the temp-directory bug #785 fixes, so the override has to be
287
+ // total. `extra` is cezar's own, never a host secret, and always wins.
288
+ const overridden = upperSet(Object.keys(extra));
281
289
  // Escape hatch: restore legacy full-inheritance (opt-in, off by default).
282
290
  // Parsed with the same `isTruthy` the Bedrock/Vertex toggles use (#456
283
291
  // review) — an exact `=== '1'` made `CEZ_AGENT_ENV_FULL=true` silently do
284
292
  // nothing, which is a confusing way to fail open-vs-closed.
285
293
  if (isTruthy(readVar(source, 'CEZ_AGENT_ENV_FULL'))) {
286
- return { ...source, ...extra };
294
+ const full = {};
295
+ for (const [name, value] of Object.entries(source)) {
296
+ if (!overridden.has(name.toUpperCase()))
297
+ full[name] = value;
298
+ }
299
+ return { ...full, ...extra };
287
300
  }
288
301
  const backendPrefixes = BACKEND_ALLOW_PREFIXES[opts.backend] ?? BACKEND_ALLOW_PREFIXES.claude;
289
302
  const passthrough = upperSet((readVar(source, 'CEZ_ENV_PASSTHROUGH') ?? '')
@@ -307,6 +320,8 @@ export function buildChildEnv(opts) {
307
320
  for (const [name, value] of Object.entries(source)) {
308
321
  if (value === undefined)
309
322
  continue;
323
+ if (overridden.has(name.toUpperCase()))
324
+ continue; // the per-run value replaces it, whatever the spelling
310
325
  if (allow(name))
311
326
  out[name] = value;
312
327
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/core/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,MAAM,gBAAgB,GAAwB,QAAQ,CAAC;IACrD,gCAAgC;IAChC,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ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AAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/core/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,MAAM,gBAAgB,GAAwB,QAAQ,CAAC;IACrD,gCAAgC;IAChC,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,KAAK;IACL,IAAI;IACJ,SAAS;IACT,MAAM;IACN,UAAU;IACV,qBAAqB;IACrB,MAAM;IACN,UAAU;IACV,WAAW;IACX,SAAS;IACT,OAAO;IACP,UAAU;IACV,aAAa;IACb,UAAU;IACV,SAAS;IACT,iBAAiB;IACjB,YAAY;IACZ,uEAAuE;IACvE,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,UAAU;IACV,oCAAoC;IACpC,WAAW;IACX,YAAY;IACZ,qBAAqB;IACrB,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,yEAAyE;IACzE,YAAY;IACZ,aAAa;IACb,WAAW;IACX,WAAW;IACX,UAAU;IACV,2EAA2E;IAC3E,wEAAwE;I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AC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -6,22 +6,47 @@
6
6
  * to the task's own commits even after the base branch moves on, and even
7
7
  * after the task merges the base back in.
8
8
  *
9
- * The exception is a **repointed HEAD**. cezar hands the agent a worktree on
10
- * the task's own branch, but nothing stops the agent from checking out some
11
- * other branch in it every `review/pr-NNN`, QA, and "continue someone
12
- * else's branch" run does exactly that. Anchoring at the merge-base then
13
- * silently redefines "this task's diff" as *the whole reviewed branch*, which
14
- * is how a task that committed nothing came to report `+22505 −2628`. When
15
- * HEAD is not on the task's branch the honest anchor is `HEAD` itself: the
16
- * uncommitted work in the tree is the only part this task can be said to have
17
- * produced.
18
- *
19
- * #591 established that rule for the Changes tab; #751 found the sidebar and
20
- * Tasks-table numbers still on the old anchor. It lives here so a third
21
- * surface cannot get it wrong again callers hand in their own `git` runner
22
- * (`git-worktree.ts` and `server/git-changes.ts` each own a private one, and
23
- * `git-changes` needs its scratch-`GIT_INDEX_FILE` variant), so this module
24
- * stays a pure decision with no process-spawning of its own.
9
+ * Two things break that answer, and both are fixed here:
10
+ *
11
+ * **A stale local base ref.** `RunRecord.baseBranch` is a NAME (`main`),
12
+ * resolved to a ref once, when the worktree was created. Nothing ever
13
+ * fast-forwards the user's local `main` cezar's agents only ever `git fetch`,
14
+ * which moves `origin/main` so on a repo the user does not pull, the local
15
+ * ref drifts arbitrarily far behind. The merge-base then collapses onto that
16
+ * stale tip and every upstream commit the task forked from or merged in counts
17
+ * as the task's own work: an eight-line fix measured `+59514 −12160` against a
18
+ * `main` that was 98 commits and one monorepo restructure behind origin. So the
19
+ * base is re-resolved to the freshest ref it names at every call
20
+ * (`freshestBaseRef`) the read-time twin of `resolveBaseRef`, which does the
21
+ * same thing at worktree-creation time and cannot know what happens later.
22
+ *
23
+ * **A repointed HEAD.** cezar hands the agent a worktree on the task's own
24
+ * branch, but nothing stops the agent from checking out another branch in it —
25
+ * every `review/pr-NNN` and QA run does exactly that, and so does every skill
26
+ * that opens its work on a named `feat/…` branch. The merge-base then silently
27
+ * redefines "this task's diff" as *the whole checked-out branch*, which is how
28
+ * a task that committed nothing came to report `+22505 −2628`. #591 and #751
29
+ * answered that with `HEAD` — uncommitted work only — which is right for a
30
+ * pure review and badly wrong for the far more common case of an agent that
31
+ * committed real work on a branch it created itself: those runs reported
32
+ * `+0 −0` for changes that were genuinely theirs.
33
+ *
34
+ * The honest anchor for a repointed HEAD is the branch as it stood **when this
35
+ * run first saw it** — its `<branch>@{<run start>}` reflog state. Diffing
36
+ * against that attributes exactly what the run did to the tree and nothing
37
+ * that was already there: a review run gets its `+0`, and a run that branched
38
+ * off the base and committed gets its real numbers. Where that baseline is
39
+ * itself stale — the run merged the base branch in afterwards, dragging the
40
+ * whole upstream delta behind it — the ordinary merge-base is the tighter
41
+ * answer, so the two candidates compete and the one that attributes FEWER
42
+ * CHANGED LINES to the task wins. The reported number is then never more than
43
+ * the least either measure can defend.
44
+ *
45
+ * It lives here so a third surface cannot get it wrong again — callers hand in
46
+ * their own `git` runner (`git-worktree.ts` and `server/git-changes.ts` each
47
+ * own a private one, and `git-changes` needs its scratch-`GIT_INDEX_FILE`
48
+ * variant), so this module stays a pure decision with no process-spawning of
49
+ * its own.
25
50
  */
26
51
  /** What a caller's `git` runner must answer with. Both existing runners are wider than this. */
27
52
  export interface GitRunResult {
@@ -38,23 +63,23 @@ export interface RepointedHead {
38
63
  export interface TaskDiffBase {
39
64
  /** The ref to diff against. */
40
65
  base: string;
41
- /** Present only when HEAD left the task's branch — the reason `base` is `HEAD`. */
66
+ /** Present only when HEAD left the task's branch — the reason `base` is what it is. */
42
67
  repointedHead?: RepointedHead;
43
68
  }
44
69
  /**
45
- * Resolve the diff anchor for a task worktree. Never throws: a failing git
46
- * call degrades to the base branch name, which is what the un-guarded callers
47
- * did before this helper existed.
70
+ * Resolve the diff anchor for a task worktree. Never throws: a failing git call
71
+ * degrades to the base branch name, which is what the un-guarded callers did
72
+ * before this helper existed.
48
73
  *
49
74
  * `taskBranch` is optional because not every caller has one (the main working
50
- * tree has no task branch at all). Without it there is nothing to compare
51
- * HEAD against, so the merge-base anchor is used unchanged — that is the
52
- * pre-#751 behavior, preserved exactly.
75
+ * tree has no task branch at all). Without it there is nothing to compare HEAD
76
+ * against, so the merge-base anchor is used unchanged.
53
77
  *
54
- * A detached HEAD (`rev-parse --abbrev-ref HEAD` `HEAD`) counts as
55
- * repointed: it is by definition not the task's branch, so the same
56
- * uncommitted-only anchor is the honest one.
78
+ * `runStartedAt` is what makes the repointed-HEAD answer a measurement instead
79
+ * of a guess; without it the anchor stays `HEAD` (uncommitted work only), the
80
+ * conservative #751 answer that can never claim someone else's commits.
57
81
  */
58
82
  export declare function resolveTaskDiffBase(runGit: GitRunner, baseBranch: string, opts?: {
59
83
  taskBranch?: string;
84
+ runStartedAt?: string;
60
85
  }): Promise<TaskDiffBase>;