@qodeca/xezar 0.11.2 → 0.13.1

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 (140) hide show
  1. package/README.md +97 -43
  2. package/dist/agent-config/catalog.d.ts +10 -0
  3. package/dist/agent-config/catalog.js.map +1 -1
  4. package/dist/automations/coordinator.js +8 -0
  5. package/dist/automations/coordinator.js.map +1 -1
  6. package/dist/automations/types.d.ts +2 -0
  7. package/dist/contract/automations.d.ts +8 -0
  8. package/dist/contract/events.test.d.ts +1 -0
  9. package/dist/contract/index.js +87 -3
  10. package/dist/contract/runs.d.ts +25 -0
  11. package/dist/contract/runs.test.d.ts +1 -0
  12. package/dist/contract/skills.d.ts +1 -0
  13. package/dist/contract/workflows.d.ts +6 -0
  14. package/dist/contract/workspace.d.ts +37 -4
  15. package/dist/core/agent-env.js +8 -1
  16. package/dist/core/agent-env.js.map +1 -1
  17. package/dist/core/agent-runner.d.ts +13 -0
  18. package/dist/core/agent-runner.js +22 -0
  19. package/dist/core/agent-runner.js.map +1 -1
  20. package/dist/core/backend-detect.js +11 -1
  21. package/dist/core/backend-detect.js.map +1 -1
  22. package/dist/core/claude-cli-runner.js +8 -2
  23. package/dist/core/claude-cli-runner.js.map +1 -1
  24. package/dist/core/codex-app-server-runner.js +6 -2
  25. package/dist/core/codex-app-server-runner.js.map +1 -1
  26. package/dist/core/opencode-server-runner.d.ts +12 -0
  27. package/dist/core/opencode-server-runner.js +326 -17
  28. package/dist/core/opencode-server-runner.js.map +1 -1
  29. package/dist/core/pi-model-catalog.d.ts +52 -0
  30. package/dist/core/pi-model-catalog.js +135 -0
  31. package/dist/core/pi-model-catalog.js.map +1 -0
  32. package/dist/core/pi-runner.d.ts +3 -0
  33. package/dist/core/pi-runner.js +139 -12
  34. package/dist/core/pi-runner.js.map +1 -1
  35. package/dist/core/pi-ui-mapper.js +39 -3
  36. package/dist/core/pi-ui-mapper.js.map +1 -1
  37. package/dist/core/runner-model-catalog.js +11 -2
  38. package/dist/core/runner-model-catalog.js.map +1 -1
  39. package/dist/index.js +2 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/paths.d.ts +7 -0
  42. package/dist/paths.js +8 -0
  43. package/dist/paths.js.map +1 -1
  44. package/dist/runs/event-corrections.d.ts +12 -0
  45. package/dist/runs/event-corrections.js +141 -0
  46. package/dist/runs/event-corrections.js.map +1 -0
  47. package/dist/runs/event-history.d.ts +5 -1
  48. package/dist/runs/event-history.js +66 -5
  49. package/dist/runs/event-history.js.map +1 -1
  50. package/dist/runs/project-writer.d.ts +11 -0
  51. package/dist/runs/project-writer.js +115 -0
  52. package/dist/runs/project-writer.js.map +1 -0
  53. package/dist/runs/retention.d.ts +1 -1
  54. package/dist/runs/retention.js +1 -1
  55. package/dist/runs/store.d.ts +2 -0
  56. package/dist/runs/store.js +13 -2
  57. package/dist/runs/store.js.map +1 -1
  58. package/dist/runs/task-markers.d.ts +4 -0
  59. package/dist/runs/task-markers.js +63 -5
  60. package/dist/runs/task-markers.js.map +1 -1
  61. package/dist/server/capabilities.d.ts +7 -5
  62. package/dist/server/capabilities.js +11 -7
  63. package/dist/server/capabilities.js.map +1 -1
  64. package/dist/server/project-context.js +2 -0
  65. package/dist/server/project-context.js.map +1 -1
  66. package/dist/server/server.d.ts +199 -47
  67. package/dist/server/server.js +195 -11
  68. package/dist/server/server.js.map +1 -1
  69. package/dist/workflows/run.d.ts +67 -2
  70. package/dist/workflows/run.js +233 -62
  71. package/dist/workflows/run.js.map +1 -1
  72. package/dist/workflows/types.d.ts +41 -0
  73. package/dist/workflows/types.js +72 -0
  74. package/dist/workflows/types.js.map +1 -1
  75. package/dist/workspace/config.d.ts +42 -0
  76. package/dist/workspace/config.js +132 -3
  77. package/dist/workspace/config.js.map +1 -1
  78. package/dist/workspace/semaphore.d.ts +63 -3
  79. package/dist/workspace/semaphore.js +76 -3
  80. package/dist/workspace/semaphore.js.map +1 -1
  81. package/package.json +3 -3
  82. package/web/dist/assets/{alert-dialog-CGskMvgc.js → alert-dialog-BVsVcbFy.js} +1 -1
  83. package/web/dist/assets/arrow-down-CYgAlZtW.js +1 -0
  84. package/web/dist/assets/arrow-left-BOqE0a3k.js +1 -0
  85. package/web/dist/assets/{centered-state-B_V_Ai2h.js → centered-state-Djgly6Ni.js} +1 -1
  86. package/web/dist/assets/chevron-right-Cc9BWnbN.js +1 -0
  87. package/web/dist/assets/{collapsible-B_8uYwHb.js → collapsible-DZ4D-DHG.js} +1 -1
  88. package/web/dist/assets/{commit-list-C4Dv6vUL.js → commit-list-B-z1JL9G.js} +1 -1
  89. package/web/dist/assets/{compare-variants-et0mplGi.js → compare-variants-D62m4j3B.js} +1 -1
  90. package/web/dist/assets/{diff-CbozNUJq.js → diff-BKew9rQX.js} +2 -2
  91. package/web/dist/assets/{diff-stat-btAmKFJr.js → diff-stat-D0mc5V6Z.js} +1 -1
  92. package/web/dist/assets/{diff-view-BpFTcG3R.js → diff-view-xpIcuLIC.js} +1 -1
  93. package/web/dist/assets/{dropdown-menu-Z80KMInL.js → dropdown-menu-CEQziH7X.js} +1 -1
  94. package/web/dist/assets/editable-title-BCX3T2BY.js +1 -0
  95. package/web/dist/assets/{ellipsis-vertical-Bmi2u2TG.js → ellipsis-vertical-ByVdDc4z.js} +1 -1
  96. package/web/dist/assets/{file-DKoYWRsv.js → file-xBSB5hXO.js} +1 -1
  97. package/web/dist/assets/{folder-u01HScRT.js → folder-CldgbZ5A.js} +1 -1
  98. package/web/dist/assets/{git-toolbar-Q2kk2F7v.js → git-toolbar-DJANqg7Y.js} +1 -1
  99. package/web/dist/assets/github-D6vK0jFn.js +1 -0
  100. package/web/dist/assets/{image-preview-BR3iIIhf.js → image-preview-Cv5mZr0n.js} +1 -1
  101. package/web/dist/assets/index-CkmR6h7s.css +2 -0
  102. package/web/dist/assets/index-DVDqF4bM.js +9 -0
  103. package/web/dist/assets/{markdown-5FuCZDA4.js → markdown-CgEEE2ND.js} +1 -1
  104. package/web/dist/assets/{new-task-form-BydHBbef.js → new-task-form-1r2bgsdD.js} +1 -1
  105. package/web/dist/assets/{pill-vNzaaYxj.js → pill-q-x22_ej.js} +1 -1
  106. package/web/dist/assets/{project-router-BbCzrHKs.js → project-router-VDN4jQM8.js} +1 -1
  107. package/web/dist/assets/{prompt-templates-B7Fs2b1S.js → prompt-templates-BmZtCe-L.js} +1 -1
  108. package/web/dist/assets/{refresh-cw-DGliez3E.js → refresh-cw-DcNCj2nu.js} +1 -1
  109. package/web/dist/assets/{repo-git-h1RFfly3.js → repo-git-btG0sdbO.js} +1 -1
  110. package/web/dist/assets/{run-diff-Bq9vkSNK.js → run-diff-vguEMJzh.js} +1 -1
  111. package/web/dist/assets/{run-header-Cd8mSKBG.js → run-header-DM7MiKj9.js} +1 -1
  112. package/web/dist/assets/{search-x-69n_672Y.js → search-x-QmhaAbg5.js} +1 -1
  113. package/web/dist/assets/{skill-empty-hint-CL0g7WBL.js → skill-empty-hint-BrzUwByZ.js} +1 -1
  114. package/web/dist/assets/{skills-BqAzyGS3.js → skills-DMfxQtrD.js} +1 -1
  115. package/web/dist/assets/{sparkles-B8agSxBZ.js → sparkles-CP8QDOgX.js} +1 -1
  116. package/web/dist/assets/{square-terminal-Cf4Og6ct.js → square-terminal-CGypshSD.js} +1 -1
  117. package/web/dist/assets/{tab-link-Cp2-CJS8.js → tab-link-D4lFzzI1.js} +1 -1
  118. package/web/dist/assets/{task-changes-DwXPFXqG.js → task-changes-BtZId14z.js} +1 -1
  119. package/web/dist/assets/{task-commits-Bessua-c.js → task-commits-BoeyJXrv.js} +1 -1
  120. package/web/dist/assets/{task-files-DxFIhRPP.js → task-files-DIy2oUnj.js} +1 -1
  121. package/web/dist/assets/task-thread-CbMPmrWq.js +9 -0
  122. package/web/dist/assets/{textarea--cpYshee.js → textarea-CyBCyKIk.js} +1 -1
  123. package/web/dist/assets/{thread-loading-ZhJref0J.js → thread-loading-Cuq2jchC.js} +1 -1
  124. package/web/dist/assets/{trash-2--ZtrzUx3.js → trash-2-B6Dp3ZNs.js} +1 -1
  125. package/web/dist/assets/{triangle-alert-D5tJwRD2.js → triangle-alert-xBya8FUp.js} +1 -1
  126. package/web/dist/assets/{upload-SnwVxKOA.js → upload-D6MXEB9p.js} +1 -1
  127. package/web/dist/assets/{use-desktop-Sr1QlxhT.js → use-desktop-CPBwzQ7M.js} +1 -1
  128. package/web/dist/assets/{use-submit-shortcut-JY8M_MPL.js → use-submit-shortcut-JTpNzU-u.js} +1 -1
  129. package/web/dist/assets/{utils-Bb8ohcr3.js → utils--z9hRtl3.js} +1 -1
  130. package/web/dist/assets/{workflows-9HC240Wx.js → workflows-DG115scU.js} +3 -3
  131. package/web/dist/assets/{zoomable-image-0G3IBXWC.js → zoomable-image-GTYwLtkS.js} +1 -1
  132. package/web/dist/index.html +23 -23
  133. package/web/dist/assets/arrow-down-G8adPhbu.js +0 -1
  134. package/web/dist/assets/arrow-left-BJsIW6A0.js +0 -1
  135. package/web/dist/assets/chevron-right-CFzn-von.js +0 -1
  136. package/web/dist/assets/editable-title-wS5NWwob.js +0 -1
  137. package/web/dist/assets/github-DjEYCxwt.js +0 -1
  138. package/web/dist/assets/index-BcI5hug3.css +0 -2
  139. package/web/dist/assets/index-Cz4GSAqV.js +0 -7
  140. package/web/dist/assets/task-thread-Dhkupf1-.js +0 -9
@@ -4,7 +4,15 @@ import { type Skill } from '../skills.ts';
4
4
  import type { QueuedMessage, RunRecord, RunStore } from '../runs/store.ts';
5
5
  import { WorkspaceSemaphore, type AccountHolds } from '../workspace/semaphore.ts';
6
6
  import { type WorkflowDef } from './types.ts';
7
- /** An interactive session that hears nothing from the user closes itself. */
7
+ /**
8
+ * An interactive session that hears nothing from the user closes itself.
9
+ *
10
+ * Kept as the module default so `stepTimeoutMs`-style callers and old imports still
11
+ * resolve, but enforcement no longer reads it directly: `armIdleTimer` asks the shared
12
+ * `WorkspaceSemaphore`, so `resources.idleTimeoutMinutes` takes effect on the next park
13
+ * without a restart. This constant IS that setting's default, via
14
+ * `DEFAULT_IDLE_TIMEOUT_MINUTES`.
15
+ */
8
16
  export declare const IDLE_TIMEOUT_MS: number;
9
17
  /**
10
18
  * Preserve boundaries between complete assistant text blocks while a turn is
@@ -28,6 +36,9 @@ export declare function periodicAutosaveEnabled(env?: NodeJS.ProcessEnv): boolea
28
36
  * files or Git state. Isolated worktree runs are unaffected.
29
37
  */
30
38
  export declare function repositoryRootLockDisabled(env?: NodeJS.ProcessEnv): boolean;
39
+ /** Safety cap on autonomous auto-continues per run — stops a stuck agent from nudging forever.
40
+ * Exported so the regression suite pins the bound against the real number instead of a copy. */
41
+ export declare const MAX_AUTO_CONTINUES = 40;
31
42
  /**
32
43
  * Auto-resume after a provider usage limit (spec 2026-08-03-auto-resume-after-usage-limit).
33
44
  *
@@ -254,6 +265,15 @@ export declare class RunManager {
254
265
  private readonly offUsage;
255
266
  /** The stalled-queue watchdog (see `rescueStalledQueue`). */
256
267
  private readonly queueWatchdog;
268
+ /** The rescue sweeps that have STARTED and not settled yet (#125). `clearInterval` cancels the
269
+ * next tick; it cannot cancel the tick already running, and a sweep is async — it awaits
270
+ * `reviveWorkflow` before appending NDJSON. dispose() settles these so a torn-down manager is
271
+ * provably finished writing before its caller removes the data root under it. */
272
+ private readonly rescuesInFlight;
273
+ /** Set by dispose(): this manager makes no further moves. Re-checked at every await boundary a
274
+ * rescue crosses, because a sweep that was already past its first check when dispose() landed
275
+ * would otherwise write an event — and re-populate the queue dispose() had just emptied. */
276
+ private disposed;
257
277
  /** Set by the watchdog for exactly one sweep: ignore the usage-limit hold and make progress. */
258
278
  private forceNextPump;
259
279
  /** Runs the watchdog started despite the hold. The spawn-time gate (`requeueWhileHeld`) would
@@ -278,8 +298,19 @@ export declare class RunManager {
278
298
  * repo-root locks, and empties the queued state so nothing fires later.
279
299
  * Live sessions are NOT ended here: run lifecycle stays the caller's policy;
280
300
  * dispose only guarantees the manager makes no further moves on its own.
301
+ *
302
+ * Every side effect below is SYNCHRONOUS, so a caller that ignores the return value behaves
303
+ * exactly as it did before #125. The returned promise settles the one thing dispose cannot do
304
+ * synchronously: a queue-watchdog rescue that had already started. `clearInterval` stops the
305
+ * next tick, never the running one — the same discipline `AGENTS.md` records for the e2e
306
+ * fixture servers, where `kill()` only delivers the signal and the helper awaits the exit.
307
+ * Await it whenever the data root is about to be removed; a test that deletes its temp
308
+ * directory without awaiting is the ENOENT in #125.
309
+ *
310
+ * It never rejects: a sweep that fails still belongs to whoever started it (the watchdog floats
311
+ * it exactly as before), and teardown must not become a second place that error surfaces.
281
312
  */
282
- dispose(): void;
313
+ dispose(): Promise<void>;
283
314
  /**
284
315
  * Pause any active run whose whole process tree exceeds the WORKSPACE
285
316
  * `resources.memoryLimitMb`, freeing its slot so the queue advances
@@ -384,6 +415,11 @@ export declare class RunManager {
384
415
  * `continue-N` step and the session before it are durable, which is enough. Otherwise the
385
416
  * workflow is revived from the record. A run that can be neither is failed loudly rather than
386
417
  * left in the queue as a ghost.
418
+ *
419
+ * Both effects here — an NDJSON append and a queue push — must not outlive dispose(), so the
420
+ * flag is re-read after `reviveWorkflow`, the one await this method crosses (#125). Bailing
421
+ * leaves the record `queued`, which is exactly what it was: re-adoption is what boot recovery
422
+ * does for the next owner of this data directory.
387
423
  */
388
424
  private reviveQueuedRun;
389
425
  /**
@@ -466,8 +502,14 @@ export declare class RunManager {
466
502
  * honest hold, with a real deadline behind it this time.
467
503
  *
468
504
  * Public so a test can drive the wedge directly instead of waiting out the interval.
505
+ *
506
+ * The sweep itself is `sweepStalledQueue`; this wrapper only publishes it to `rescuesInFlight`
507
+ * so dispose() can settle it (#125). Every entry point goes through here — the interval and the
508
+ * tests alike — so nothing can start a sweep that teardown cannot see. The schedule, the
509
+ * conditions and the effects are untouched.
469
510
  */
470
511
  rescueStalledQueue(now?: number): Promise<void>;
512
+ private sweepStalledQueue;
471
513
  /**
472
514
  * The accounts this project is currently holding: one key per run parked on a usage-limit
473
515
  * resume that has not come due yet (spec 2026-08-03-auto-resume-after-usage-limit).
@@ -639,6 +681,21 @@ export declare class RunManager {
639
681
  error?: string;
640
682
  };
641
683
  private runContinuation;
684
+ /**
685
+ * Autonomous turn end (#489): never hand the ball back to the user — nudge the agent to keep
686
+ * going and report whether the ball stayed with it. `false` means "park normally", which is
687
+ * every non-autonomous run, a run whose pause cleared `autonomous` (the memory-limit
688
+ * suppression above), a cancelled one, a closed session that cannot take the message, and a
689
+ * run that has spent its `MAX_AUTO_CONTINUES` budget.
690
+ *
691
+ * ONE helper, called from BOTH turn-end handlers, because the split is exactly what broke:
692
+ * `execute` set `autonomous` on its `ActiveRun` and its handler never read it, while
693
+ * `runContinuation`'s handler read it and its `ActiveRun` never set it — so the nudge fired
694
+ * nowhere and every autonomous run parked after one turn (#141). AGENTS.md names both traps:
695
+ * grep the TYPE at every construction site, and treat the two near-identical turn-end handlers
696
+ * as one place. Keep this the only sender of `AUTONOMOUS_NUDGE`.
697
+ */
698
+ private autoContinueTurn;
642
699
  private execute;
643
700
  /** Returns an error message, or null on success. */
644
701
  private runAgentStep;
@@ -747,6 +804,14 @@ export declare class RunManager {
747
804
  * shows the tool result's `[screenshot]` placeholder (or the image count).
748
805
  */
749
806
  private persistAttachment;
807
+ /**
808
+ * Arm the idle wall clock for a session that just parked at `waiting`.
809
+ *
810
+ * The duration comes from the shared semaphore's cached `resources.idleTimeoutMinutes`,
811
+ * so a change made in Settings applies to the next park with no restart. `null` means
812
+ * the operator chose "never close on idle": no timer is armed, and the only exits left
813
+ * are a user message and Cancel — both of which a `waiting` run already advertises.
814
+ */
750
815
  private armIdleTimer;
751
816
  private clearIdleTimer;
752
817
  private reconcileMonitoringWakeTimers;