@wjarka/cezarion 0.14.6 → 0.14.7-pr487.740

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 (123) hide show
  1. package/README.md +37 -2
  2. package/dist/agent-config/model-settings/shared.d.ts +2 -1
  3. package/dist/agent-config/model-settings/shared.js +1 -1
  4. package/dist/agent-config/model-settings/shared.js.map +1 -1
  5. package/dist/ci-wait/client.d.ts +4 -0
  6. package/dist/ci-wait/client.js +67 -0
  7. package/dist/ci-wait/client.js.map +1 -0
  8. package/dist/ci-wait/controller.d.ts +78 -0
  9. package/dist/ci-wait/controller.js +148 -0
  10. package/dist/ci-wait/controller.js.map +1 -0
  11. package/dist/ci-wait/github.d.ts +61 -0
  12. package/dist/ci-wait/github.js +209 -0
  13. package/dist/ci-wait/github.js.map +1 -0
  14. package/dist/ci-wait/injection.d.ts +3 -0
  15. package/dist/ci-wait/injection.js +26 -0
  16. package/dist/ci-wait/injection.js.map +1 -0
  17. package/dist/ci-wait/mcp.d.ts +97 -0
  18. package/dist/ci-wait/mcp.js +35 -0
  19. package/dist/ci-wait/mcp.js.map +1 -0
  20. package/dist/ci-wait/resources.d.ts +7 -0
  21. package/dist/ci-wait/resources.js +32 -0
  22. package/dist/ci-wait/resources.js.map +1 -0
  23. package/dist/ci-wait/supervisor.d.ts +21 -0
  24. package/dist/ci-wait/supervisor.js +163 -0
  25. package/dist/ci-wait/supervisor.js.map +1 -0
  26. package/dist/contract/ci-wait.d.ts +151 -0
  27. package/dist/contract/conversations.d.ts +7 -0
  28. package/dist/contract/delegation.d.ts +2 -0
  29. package/dist/contract/events.d.ts +3 -0
  30. package/dist/contract/index.d.ts +1 -0
  31. package/dist/contract/index.js +1016 -935
  32. package/dist/contract/runs.d.ts +461 -0
  33. package/dist/contract/skills.d.ts +92 -0
  34. package/dist/core/agent-env.js +2 -0
  35. package/dist/core/agent-env.js.map +1 -1
  36. package/dist/core/agent-runner.d.ts +6 -0
  37. package/dist/core/agent-runner.js +1 -0
  38. package/dist/core/agent-runner.js.map +1 -1
  39. package/dist/core/claude-cli-runner.js +10 -0
  40. package/dist/core/claude-cli-runner.js.map +1 -1
  41. package/dist/core/codex-app-server-runner.js +5 -1
  42. package/dist/core/codex-app-server-runner.js.map +1 -1
  43. package/dist/core/codex-app-server-transport.js +3 -1
  44. package/dist/core/codex-app-server-transport.js.map +1 -1
  45. package/dist/core/cursor-acp-runner.js +9 -1
  46. package/dist/core/cursor-acp-runner.js.map +1 -1
  47. package/dist/core/opencode-server-runner.js +6 -2
  48. package/dist/core/opencode-server-runner.js.map +1 -1
  49. package/dist/core/pi-runner.js +7 -1
  50. package/dist/core/pi-runner.js.map +1 -1
  51. package/dist/delegation/cli.js +8 -4
  52. package/dist/delegation/cli.js.map +1 -1
  53. package/dist/delegation/conversations.js +2 -1
  54. package/dist/delegation/conversations.js.map +1 -1
  55. package/dist/delegation/input.d.ts +6 -0
  56. package/dist/delegation/input.js +22 -0
  57. package/dist/delegation/input.js.map +1 -1
  58. package/dist/delegation/provision.js +3 -1
  59. package/dist/delegation/provision.js.map +1 -1
  60. package/dist/delegation/routes.d.ts +11 -0
  61. package/dist/delegation/service.js +31 -7
  62. package/dist/delegation/service.js.map +1 -1
  63. package/dist/delegation/transport.d.ts +11 -0
  64. package/dist/runs/delegation-state.d.ts +2 -0
  65. package/dist/runs/run-index.js +2 -3
  66. package/dist/runs/run-index.js.map +1 -1
  67. package/dist/runs/store.d.ts +514 -3
  68. package/dist/runs/store.js +85 -6
  69. package/dist/runs/store.js.map +1 -1
  70. package/dist/server/server.d.ts +1376 -12
  71. package/dist/workflows/run.d.ts +25 -1
  72. package/dist/workflows/run.js +470 -43
  73. package/dist/workflows/run.js.map +1 -1
  74. package/package.json +4 -3
  75. package/scripts/mock-ci-tool.mjs +53 -0
  76. package/scripts/mock-claude.mjs +8 -0
  77. package/scripts/mock-codex-app-server.mjs +212 -0
  78. package/scripts/mock-cursor-acp.mjs +6 -2
  79. package/scripts/mock-opencode-serve.mjs +392 -0
  80. package/scripts/mock-pi-rpc.mjs +7 -0
  81. package/scripts/pi-ci-wait.mjs +14 -0
  82. package/web/dist/assets/{agent-accounts-lP_xK83o.js → agent-accounts-BZm_2WAv.js} +1 -1
  83. package/web/dist/assets/{alert-dialog-CmDuefYh.js → alert-dialog-B422RI-k.js} +1 -1
  84. package/web/dist/assets/{collapsible-BqX8REmY.js → collapsible-Cy_Fmkrd.js} +1 -1
  85. package/web/dist/assets/{commit-list-BWvv1H7A.js → commit-list-Dcnk7TnI.js} +1 -1
  86. package/web/dist/assets/{compare-variants-Bg7eLW3z.js → compare-variants-Ciqwvd_f.js} +1 -1
  87. package/web/dist/assets/{diff-controls-HwWHHait.js → diff-controls-BGrXGi7O.js} +1 -1
  88. package/web/dist/assets/{diff-stat-mNkhAc5m.js → diff-stat-Cgnl_hYF.js} +1 -1
  89. package/web/dist/assets/{diff-0GBum40Q2.js → diff-tRE59UNb2.js} +2 -2
  90. package/web/dist/assets/{diff-view-DW64doDY.js → diff-view-DN1ort7Q.js} +1 -1
  91. package/web/dist/assets/{dropdown-menu-sZjYPcLh.js → dropdown-menu-dwDGT8MM.js} +1 -1
  92. package/web/dist/assets/{git-toolbar-DBW5EIcY.js → git-toolbar-UiHnGvE0.js} +1 -1
  93. package/web/dist/assets/{github-CkZ4hWI5.js → github-D-MrkbJ7.js} +1 -1
  94. package/web/dist/assets/{image-preview-DZicGNkU.js → image-preview-C2JGcBlC.js} +1 -1
  95. package/web/dist/assets/{index-DWWI-B9n.js → index-BszfYvBq.js} +3 -3
  96. package/web/dist/assets/index-CWh4pKP3.css +1 -0
  97. package/web/dist/assets/{markdown-AY2K3kIV.js → markdown-C_IcKVQd.js} +1 -1
  98. package/web/dist/assets/{pill-CcJqA1cL.js → pill-BsbO6G7y.js} +1 -1
  99. package/web/dist/assets/{project-router-SwsXRKXs.js → project-router-DbLkll25.js} +1 -1
  100. package/web/dist/assets/{prompt-templates-iV2WD2jy.js → prompt-templates-BlTGJB5W.js} +1 -1
  101. package/web/dist/assets/{repo-git-BW3TOs3U.js → repo-git-Bm3s6Why.js} +1 -1
  102. package/web/dist/assets/{run-diff-DPUNj56q.js → run-diff-CyG0Nciv.js} +1 -1
  103. package/web/dist/assets/{run-header-CSaJIGXl.css → run-header-BJQfFL2l.css} +1 -1
  104. package/web/dist/assets/run-header-IFyIGCey.js +1 -0
  105. package/web/dist/assets/{skills-Dv8Vwv5D.js → skills-C-C4DVFY.js} +1 -1
  106. package/web/dist/assets/{tab-link-DSftvkZS.js → tab-link-BWNp3mLY.js} +1 -1
  107. package/web/dist/assets/{task-changes-CTCuVls1.js → task-changes-D2PHtWUW.js} +1 -1
  108. package/web/dist/assets/{task-commits-weJQ5GSl.js → task-commits-N5u9U0_R.js} +1 -1
  109. package/web/dist/assets/{task-files-B4bUimY8.js → task-files-BS7c7CFm.js} +1 -1
  110. package/web/dist/assets/task-thread-BQFdz1dJ.css +1 -0
  111. package/web/dist/assets/{task-thread-BuXrVB9K.js → task-thread-DGM2dZV-.js} +4 -4
  112. package/web/dist/assets/{textarea-CxRdTWlq.js → textarea-FjaU370i.js} +1 -1
  113. package/web/dist/assets/thread-loading-77sJ8Yu_.js +1 -0
  114. package/web/dist/assets/{token-metrics-Z3UFYbuD.js → token-metrics-Clxh03bE.js} +1 -1
  115. package/web/dist/assets/utils-PYYcpCFZ.js +64 -0
  116. package/web/dist/assets/{workflows-vA27Yi8W.js → workflows-Czl0ZfXH.js} +1 -1
  117. package/web/dist/assets/{zoomable-image-DUE1KFJ0.js → zoomable-image-Z3JDnm0b.js} +1 -1
  118. package/web/dist/index.html +14 -14
  119. package/web/dist/assets/index-DK0Mkv2m.css +0 -1
  120. package/web/dist/assets/run-header-DbDluWoV.js +0 -1
  121. package/web/dist/assets/task-thread-DMRD0IVt.css +0 -1
  122. package/web/dist/assets/thread-loading-JlP6dUpX.js +0 -1
  123. package/web/dist/assets/utils-CUnaAifW.js +0 -64
package/README.md CHANGED
@@ -463,6 +463,38 @@ segment.
463
463
 
464
464
  ---
465
465
 
466
+ ## Waiting for PR checks
467
+
468
+ An agent can call `cezar_wait_for_ci` with a GitHub PR URL to ask Cezar to watch CI
469
+ outside the model. The optional `timeout_seconds` defaults to 1,800 and accepts
470
+ 1–7,200. No authored configuration or worker delegation permission is needed.
471
+ Registration requires `gh`, access to the repository, and a supported GitHub host;
472
+ GitHub Enterprise hosts must already be recognized by the forge/auth configuration.
473
+ Tool startup itself makes no GitHub request.
474
+
475
+ A successful registration returns a durable receipt and an absolute deadline. The
476
+ agent ends its turn to wait, with no marker required. The header keeps the active
477
+ run status during registration, then shows Monitoring with **Waiting for CI —
478
+ owner/repo#N**, a PR link and the deadline. **CI result ready — waiting for capacity**
479
+ means the observation is queued for the agent to resume. Ordinary monitoring keeps
480
+ its existing automatic-check schedule when no CI wait is registered.
481
+
482
+ Cezar reports passed, failed, cancelled or skipped checks, no checks, changed head,
483
+ timeout or an operational error. It watches the registered commit: a new PR head
484
+ is reported separately, and the agent decides whether to wait again. Four watchers
485
+ run concurrently; queued waits retain their original deadline. Results are bounded
486
+ observations, not merge approval or evidence that every expected workflow appeared.
487
+ The agent still decides its next action; CI success never completes the task or
488
+ accepts review. A human message cancels the current wait, and CI never answers a
489
+ pending human question. Controller recovery can replay an observation after an
490
+ ambiguous delivery checkpoint, identified by its stable lifecycle input ID.
491
+
492
+ The adapters are bundled for Claude (including `claude-cli`), Codex, OpenCode,
493
+ Cursor and Pi. Internal socket/capability environment values are runtime wiring,
494
+ not settings to create or share. If the tool is unavailable or denied, its error
495
+ is surfaced while ordinary tasks continue. See [the CI-wait protocol](AGENT_PROTOCOL.md#ci-wait-tool-contract-474)
496
+ for limits and the executable harness verification required before release.
497
+
466
498
  ## Owned workers (opt-in)
467
499
 
468
500
  Start the cockpit or a headless task with `CEZ_DELEGATION=1`. Each eligible parent session receives the absolute bundled Node/CLI invocation and its own environment credentials; no `cez` installation on the agent's PATH, config file, separate daemon, or remembered port is needed. If the private listener cannot start, ordinary tasks keep working without delegation tools. `.env` is never loaded automatically.
@@ -482,6 +514,7 @@ cez worker wait <first-id> <second-id> --mode any --timeout-seconds 600
482
514
  cez worker wait <first-id> <second-id> --mode all --timeout-seconds 600
483
515
  cez worker cancel-wait <wait-id>
484
516
  cez worker send <recipient-run-id> 'Please check this decision' --id <message-UUID> --kind request
517
+ cez worker send <worker-id> 'Correct the returned result' --id <new-message-UUID> --kind request --resume
485
518
  cez worker progress <recipient-run-id> 'Parser tests pass' --id <message-UUID>
486
519
  cez worker follow-up <recipient-run-id> 'Include empty input' --id <message-UUID> --request-id <request-UUID>
487
520
  cez worker reply <recipient-run-id> 'Checked; empty input is covered' --id <message-UUID> --request-id <request-UUID>
@@ -505,7 +538,9 @@ Parents and owned workers can converse in both directions; a worker may address
505
538
 
506
539
  Messages allow 100,000 characters each, with at most 32 undelivered inputs per recipient, 1,024 messages per family, and 32 pending requests. Request deadlines default to 600 seconds, configurable per message with `--timeout-seconds 1–1800`. Request waits use the same limits and `one`/`any`/`all` modes as worker waits, and each run has one active wait. Incoming conversation can interrupt a parked wait without settling its requests. `cancel-request` cancels an obligation; `cancel-wait` only stops waiting. Completion without a reply, failure, cancellation, destruction, timeout, or sender closure settle obligations distinctly. Late replies remain visible without reopening them.
507
540
 
508
- Sending to a review or terminal participant reports `continuation-required`; only explicit human Continue resumes that participant. Destroyed recipients receive no input. Conversation never answers a pending human question. Durable IDs deduplicate accepted queue entries and event replay, but a crash between provider acceptance and its durable delivery checkpoint can leave transport delivery ambiguous; this is not an exactly-once execution guarantee.
541
+ Pending conversations are delivered together at the next safe turn boundary, in order, up to 32 messages and 100,000 formatted characters per batch. A single valid message is never split. Messages arriving during that turn wait for the next boundary. Every message retains its ID, sender, delivery receipt and request outcome. Human questions, active turns and scheduler capacity can delay delivery. The thread's Details distinguish creation, delivery confirmation and event-recording times.
542
+
543
+ Sending to a review or terminal participant without `--resume` reports `not-delivered` and `continuation-required`, with the reason and next command; the CLI exits 1. An active parent can use `worker send --resume` (request or progress) to continue its settled done/review/failed worker with that message as the new instruction. No human Continue is needed for this parent-controlled action. A retry with the same payload and ID never creates another continuation; changing a rejected send to use `--resume` requires a new ID. Stopped or destroyed workers need a new worker. Workers cannot resume parents, and conversation never answers a pending human question. Durable IDs deduplicate accepted queue entries and event replay, but a crash between provider acceptance and its durable delivery checkpoint can leave transport delivery ambiguous; this is not an exactly-once execution guarantee.
509
544
 
510
545
 
511
546
  Collect returns the worker's execution revision, status/outcome, `settled` and `partial` flags, and typed availability for assistant summary, HEAD, bounded diff and artifact descriptors. Missing evidence is explicit; running output is partial. An available `diff.path` points to a **JSON result file** containing `{ result, diffSnapshot }`; its `diffSnapshot` field holds the patch. Read and review that field before applying any changes. The latest collected result is stored under the parent and survives restart. Collection acknowledges observation, not Git integration or successful work. Review desired worker commits and deliberately integrate them into the parent before destroying their worktrees/branches; there is no automatic merge.
@@ -576,7 +611,7 @@ Useful environment variables:
576
611
  |---|---|
577
612
  | `CEZ_DELEGATION=1` | Enable owned workers and the private loopback listener for this controller. Off by default; works with the cockpit and headless `cez run`. Session instructions and credentials are automatic. |
578
613
  | `CEZ_DELEGATION_URL`, `CEZ_DELEGATION_TOKEN` | Internal generated session values; do not configure or copy them. Tokens rotate on Continue/restart and are revoked when the session/controller closes. |
579
- | `CEZ_DRY_RUN=1` | Use the bundled mock instead of the real `claude` CLI — the entire cockpit works offline, for demos and development. |
614
+ | `CEZ_DRY_RUN=1` | Use bundled mocks for all five agent backends — the cockpit works offline for demos and development. Explicit backend binary overrides still win. |
580
615
  | `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. |
581
616
  | `CEZ_APPROVAL_GATE=1` | Opt into Claude's interactive approval UI; by default, unapproved tools are denied without interrupting the run. Ignored when `CEZ_CLAUDE_PERMISSION_MODE` is a recognized value (`dontAsk`, `acceptEdits`, or `bypass`). |
582
617
  | `CEZ_CLAUDE_PERMISSION_MODE` | Claude agent-run permission flag: `dontAsk` (default), `acceptEdits`, or `bypass`. `bypass` passes `--dangerously-skip-permissions` and omits `--permission-mode`. Unset or unknown keeps today's `dontAsk` / `CEZ_APPROVAL_GATE` path. Provider verification commands are never given this flag. |
@@ -1,9 +1,10 @@
1
1
  import type { RunnerId } from '../../core/agent-runner.ts';
2
- import { type ConfigFileDef } from '../catalog.ts';
2
+ import { type ConfigFileDef, type ConfigFormat } from '../catalog.ts';
3
3
  export interface NativeSettingsFile {
4
4
  def: ConfigFileDef;
5
5
  content: string;
6
6
  }
7
+ export declare function parseConfigContent(content: string, format: ConfigFormat): unknown;
7
8
  export declare function readNativeSettingsFiles(runner: RunnerId, repoRoot: string, env: NodeJS.ProcessEnv): Promise<NativeSettingsFile[]>;
8
9
  /** One string-valued key out of a native settings file, or undefined when absent, blank, or unparsable. */
9
10
  export declare function configuredString(file: NativeSettingsFile, path: string): string | undefined;
@@ -42,7 +42,7 @@ function valueAtPath(value, path) {
42
42
  return current[segment];
43
43
  }, value);
44
44
  }
45
- function parseConfigContent(content, format) {
45
+ export function parseConfigContent(content, format) {
46
46
  return format === 'toml'
47
47
  ? parseToml(content)
48
48
  : JSON.parse(format === 'jsonc' ? stripJsonTrailingCommas(stripJsonComments(content)) : content);
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/agent-config/model-settings/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAyC,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,E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AAY;IACrE,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAoC;IACvE,KAAK,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,KAAK,EAAE,CAAC;QACrC,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,QAAS,CAAC,EAAE,CAAC;YACnD,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACrD,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAAoC;IAC1E,KAAK,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,GAAG,CAAC,gBAAgB;YAAE,SAAS;QACpC,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACzE,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type CiWaitReceipt } from '../contract/index.js';
2
+ export declare function callCiWait(input: unknown, env?: NodeJS.ProcessEnv): Promise<CiWaitReceipt>;
3
+ /** Controller pipe death (including SIGKILL) bounds the adapter's lifetime. */
4
+ export declare function monitorCiOwner(onClose: () => void, env?: NodeJS.ProcessEnv): () => void;
@@ -0,0 +1,67 @@
1
+ import { request } from 'node:http';
2
+ import { ciWaitRequestSchema, ciWaitReceiptSchema, ciWaitErrorSchema } from '../contract/index.js';
3
+ const UNAVAILABLE = 'CI tool unavailable: the owning session is closed or the private IPC connection failed.';
4
+ export async function callCiWait(input, env = process.env) {
5
+ const parsed = ciWaitRequestSchema.safeParse(input);
6
+ if (!parsed.success)
7
+ throw new Error('Invalid CI wait arguments: provide a GitHub PR URL and optional timeout_seconds (1–7200).');
8
+ const socketPath = env.CEZ_TOOL_SOCKET;
9
+ const token = env.CEZ_TOOL_TOKEN;
10
+ if (!socketPath || !token)
11
+ throw new Error(UNAVAILABLE);
12
+ return new Promise((resolve, reject) => {
13
+ const req = request({ socketPath, path: '/api/v1/tools/ci-wait', method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' } }, response => {
14
+ const chunks = [];
15
+ let bytes = 0;
16
+ response.on('data', (chunk) => { bytes += chunk.length; if (bytes > 32768)
17
+ req.destroy(new Error(UNAVAILABLE));
18
+ else
19
+ chunks.push(chunk); });
20
+ response.on('error', () => reject(new Error(UNAVAILABLE)));
21
+ response.on('end', () => {
22
+ try {
23
+ const body = JSON.parse(Buffer.concat(chunks).toString('utf8'));
24
+ if (response.statusCode !== 200) {
25
+ const error = ciWaitErrorSchema.safeParse(body);
26
+ reject(new Error(error.success ? `${error.data.code}: ${error.data.message}` : UNAVAILABLE));
27
+ return;
28
+ }
29
+ resolve(ciWaitReceiptSchema.parse(body));
30
+ }
31
+ catch {
32
+ reject(new Error(UNAVAILABLE));
33
+ }
34
+ });
35
+ });
36
+ req.setTimeout(15000, () => req.destroy(new Error(UNAVAILABLE)));
37
+ req.on('error', () => reject(new Error(UNAVAILABLE)));
38
+ req.end(JSON.stringify(parsed.data));
39
+ });
40
+ }
41
+ /** Controller pipe death (including SIGKILL) bounds the adapter's lifetime. */
42
+ export function monitorCiOwner(onClose, env = process.env) {
43
+ let stopped = false;
44
+ const close = () => { if (!stopped) {
45
+ stopped = true;
46
+ onClose();
47
+ } };
48
+ if (!env.CEZ_TOOL_SOCKET || !env.CEZ_TOOL_TOKEN) {
49
+ queueMicrotask(close);
50
+ return () => { stopped = true; };
51
+ }
52
+ const req = request({ socketPath: env.CEZ_TOOL_SOCKET, path: '/api/v1/tools/ci-wait', headers: { authorization: `Bearer ${env.CEZ_TOOL_TOKEN}` } }, response => {
53
+ if (response.statusCode !== 200) {
54
+ response.resume();
55
+ close();
56
+ return;
57
+ }
58
+ response.resume();
59
+ response.on('end', close);
60
+ response.on('error', close);
61
+ response.on('close', close);
62
+ });
63
+ req.on('error', close);
64
+ req.end();
65
+ return () => { stopped = true; req.destroy(); };
66
+ }
67
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/ci-wait/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAsB,MAAM,8BAA8B,CAAC;AAE/H,MAAM,WAAW,GAAG,yFAAyF,CAAC;AAC9G,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAc,EAAE,GAAG,GAAsB,OAAO,CAAC,GAAG;IACnF,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,2FAA2F,CAAC,CAAC;IAClI,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe,CAAC;IAAC,MAAM,KAAK,GAAG,GAAG,CAAC,cAAc,CAAC;IACzE,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;IACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,OAAO,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,c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CAAC;YAAC,KAAK,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QACxE,QAAQ,CAAC,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IAClC,OAAO,GAAG,EAAE,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { type CiWait, type CiWaitRequest } from '../contract/index.js';
2
+ import type { AgentRunSpec } from '../core/agent-runner.ts';
3
+ type Registration = (request: CiWaitRequest, signal: AbortSignal) => Promise<CiWait>;
4
+ type Capability = {
5
+ register: Registration;
6
+ lifetime: AbortController;
7
+ };
8
+ export type CiToolSession = {
9
+ descriptor: NonNullable<AgentRunSpec['cezarTools']>;
10
+ env: Record<string, string>;
11
+ revoke(): void;
12
+ };
13
+ /** Separate from the cockpit and delegation APIs. No TCP listener or durable credentials. */
14
+ export declare class CiToolController {
15
+ private readonly server;
16
+ private readonly address;
17
+ private readonly directory?;
18
+ private readonly capabilities;
19
+ private readonly sockets;
20
+ private closed;
21
+ private constructor();
22
+ static start(): Promise<CiToolController>;
23
+ provision(register: Registration): CiToolSession;
24
+ close(): Promise<void>;
25
+ }
26
+ /** Typed private route inventory: GET holds adapter lifetime; POST registers CI only. */
27
+ export declare function ciToolRoutes(capabilities: Map<string, Capability>): import("hono/hono-base").HonoBase<{
28
+ Variables: {
29
+ capability: Capability;
30
+ };
31
+ }, {
32
+ "/api/v1/tools/ci-wait": {
33
+ $get: {
34
+ output: {};
35
+ outputFormat: string;
36
+ status: import("hono/utils/http-status").StatusCode;
37
+ input: {};
38
+ };
39
+ };
40
+ } & {
41
+ "/api/v1/tools/ci-wait": {
42
+ $post: {
43
+ output: {
44
+ prUrl: string;
45
+ repository: string;
46
+ prNumber: number;
47
+ headSha: string;
48
+ waitId: string;
49
+ registeredAt: string;
50
+ deadline: string;
51
+ phase: "delivered" | "parked" | "registered" | "wake-pending" | "withdrawn";
52
+ };
53
+ outputFormat: "json";
54
+ status: import("hono/utils/http-status").ContentfulStatusCode;
55
+ input: {
56
+ json: {
57
+ pr: string;
58
+ timeout_seconds?: number | undefined;
59
+ };
60
+ };
61
+ } | {
62
+ output: {
63
+ code: "authentication" | "capacity" | "command_failed" | "gh_missing" | "inaccessible_pr" | "invalid_request" | "malformed_data" | "output_limit" | "persistence" | "query_timeout" | "unauthorized" | "unavailable" | "unsupported_host" | "wait_conflict";
64
+ message: string;
65
+ };
66
+ outputFormat: "json";
67
+ status: 503;
68
+ input: {
69
+ json: {
70
+ pr: string;
71
+ timeout_seconds?: number | undefined;
72
+ };
73
+ };
74
+ };
75
+ };
76
+ }, "/", "/api/v1/tools/ci-wait">;
77
+ export type CiToolApp = ReturnType<typeof ciToolRoutes>;
78
+ export {};
@@ -0,0 +1,148 @@
1
+ import { randomBytes, randomUUID } from 'node:crypto';
2
+ import { chmod, mkdtemp, rm } from 'node:fs/promises';
3
+ import { createServer } from 'node:http';
4
+ import { tmpdir } from 'node:os';
5
+ import { join } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { getRequestListener } from '@hono/node-server';
8
+ import { Hono } from 'hono';
9
+ import { bodyLimit } from 'hono/body-limit';
10
+ import { ciWaitRequestSchema, ciWaitReceiptSchema, ciWaitErrorCodeSchema } from '../contract/index.js';
11
+ import { jsonZodValidator } from '../server/validators.js';
12
+ const unavailable = { code: 'unavailable', message: 'CI tool unavailable: session authority expired or registration failed.' };
13
+ /** Separate from the cockpit and delegation APIs. No TCP listener or durable credentials. */
14
+ export class CiToolController {
15
+ server;
16
+ address;
17
+ directory;
18
+ capabilities = new Map();
19
+ sockets = new Set();
20
+ closed = false;
21
+ constructor(server, address, directory) {
22
+ this.server = server;
23
+ this.address = address;
24
+ this.directory = directory;
25
+ }
26
+ static async start() {
27
+ let directory;
28
+ let server;
29
+ try {
30
+ // sockaddr_un is only 104–108 bytes on supported Unix platforms. Agent
31
+ // worktree TMPDIRs can be much longer; the endpoint must not inherit that.
32
+ const temporaryRoot = Buffer.byteLength(tmpdir()) > 64 ? '/tmp' : tmpdir();
33
+ directory = process.platform === 'win32' ? undefined : await mkdtemp(join(temporaryRoot, 'cez-ci-'));
34
+ if (directory)
35
+ await chmod(directory, 0o700);
36
+ const address = directory ? join(directory, 'ipc') : `\\\\.\\pipe\\cezar-ci-${randomUUID()}`;
37
+ server = createServer();
38
+ const controller = new CiToolController(server, address, directory);
39
+ const app = ciToolRoutes(controller.capabilities);
40
+ server.on('request', getRequestListener(app.fetch));
41
+ server.on('connection', socket => { controller.sockets.add(socket); socket.on('close', () => controller.sockets.delete(socket)); });
42
+ server.maxConnections = 64;
43
+ server.headersTimeout = 5000;
44
+ server.requestTimeout = 15000;
45
+ await new Promise((resolve, reject) => { server.once('error', reject); server.listen(address, () => { server.off('error', reject); resolve(); }); });
46
+ if (directory)
47
+ await chmod(address, 0o600);
48
+ server.unref();
49
+ return controller;
50
+ }
51
+ catch {
52
+ server?.close();
53
+ server?.closeAllConnections();
54
+ if (directory)
55
+ await rm(directory, { recursive: true, force: true }).catch(() => { });
56
+ throw new Error('CI tool unavailable: private IPC could not start');
57
+ }
58
+ }
59
+ provision(register) {
60
+ if (this.closed)
61
+ throw new Error(unavailable.message);
62
+ const token = randomBytes(32).toString('hex');
63
+ const capability = { register, lifetime: new AbortController() };
64
+ this.capabilities.set(token, capability);
65
+ const entry = fileURLToPath(new URL('./mcp.js', import.meta.url));
66
+ // Source execution uses tsx already installed by the developer; installed artifacts use plain Node.
67
+ const source = import.meta.url.endsWith('.ts');
68
+ return {
69
+ descriptor: { name: `cezar_ci_${randomUUID().replaceAll('-', '')}`, command: process.execPath, args: source ? ['--import', fileURLToPath(import.meta.resolve('tsx')), entry.replace(/\.js$/, '.ts')] : [entry] },
70
+ env: { CEZ_TOOL_TOKEN: token, CEZ_TOOL_SOCKET: this.address },
71
+ revoke: () => { this.capabilities.delete(token); capability.lifetime.abort(); },
72
+ };
73
+ }
74
+ async close() {
75
+ if (this.closed)
76
+ return;
77
+ this.closed = true;
78
+ for (const capability of this.capabilities.values())
79
+ capability.lifetime.abort();
80
+ this.capabilities.clear();
81
+ const closed = new Promise(resolve => this.server.close(() => resolve()));
82
+ for (const socket of this.sockets)
83
+ socket.destroy();
84
+ await closed;
85
+ if (this.directory)
86
+ await rm(this.directory, { recursive: true, force: true });
87
+ }
88
+ }
89
+ /** Typed private route inventory: GET holds adapter lifetime; POST registers CI only. */
90
+ export function ciToolRoutes(capabilities) {
91
+ return new Hono()
92
+ .use('/api/v1/tools/ci-wait', async (c, next) => {
93
+ const authorization = c.req.header('authorization');
94
+ const token = authorization?.startsWith('Bearer ') ? authorization.slice(7) : undefined;
95
+ const capability = token ? capabilities.get(token) : undefined;
96
+ if (!capability || capability.lifetime.signal.aborted)
97
+ return c.json({ ...unavailable, code: 'unauthorized' }, 401);
98
+ c.set('capability', capability);
99
+ await next();
100
+ // The shared middleware uses the public API error envelope. Normalize this
101
+ // private family to the CI contract without forwarding request contents.
102
+ if (c.res.status === 400)
103
+ c.res = c.json({ code: 'invalid_request', message: 'Invalid CI wait arguments' }, 400);
104
+ })
105
+ .get('/api/v1/tools/ci-wait', c => {
106
+ const signal = c.get('capability').lifetime.signal;
107
+ let release = () => { };
108
+ return new Response(new ReadableStream({ start(stream) {
109
+ stream.enqueue(new TextEncoder().encode('connected\n'));
110
+ const close = () => { try {
111
+ stream.close();
112
+ }
113
+ catch { } };
114
+ signal.addEventListener('abort', close, { once: true });
115
+ release = () => signal.removeEventListener('abort', close);
116
+ }, cancel() { release(); } }), { headers: { 'content-type': 'text/plain', 'cache-control': 'no-store' } });
117
+ })
118
+ .post('/api/v1/tools/ci-wait', bodyLimit({ maxSize: 16_384, onError: c => c.json({ code: 'invalid_request', message: 'CI request exceeds 16 KiB' }, 413) }), jsonZodValidator(ciWaitRequestSchema, { code: 'invalid_input', message: 'Invalid CI wait arguments' }), async (c) => {
119
+ const capability = c.get('capability');
120
+ try {
121
+ const wait = await capability.register(c.req.valid('json'), capability.lifetime.signal);
122
+ capability.lifetime.signal.throwIfAborted();
123
+ const receipt = ciWaitReceiptSchema.parse({ waitId: wait.id, prUrl: wait.prUrl, repository: wait.repository, prNumber: wait.prNumber, headSha: wait.headSha, registeredAt: wait.registeredAt, deadline: wait.deadline, phase: wait.phase });
124
+ return c.json(receipt);
125
+ }
126
+ catch (error) {
127
+ const code = ciWaitErrorCodeSchema.safeParse(error && typeof error === 'object' && 'code' in error ? error.code : undefined);
128
+ if (code.success)
129
+ return c.json({ code: code.data, message: ciErrorMessage(code.data) }, 503);
130
+ return c.json(unavailable, 503);
131
+ }
132
+ });
133
+ }
134
+ function ciErrorMessage(code) {
135
+ const messages = {
136
+ wait_conflict: 'A different CI wait is already active for this run.',
137
+ unsupported_host: 'GitHub Enterprise host is not recognized; use a host configured with the existing GitHub authentication.',
138
+ gh_missing: 'Install GitHub CLI (gh) to wait for CI.',
139
+ authentication: 'Authenticate GitHub CLI with gh auth login and retry.',
140
+ inaccessible_pr: 'The pull request is inaccessible; check its URL and GitHub permissions.',
141
+ capacity: 'CI wait registration capacity is exhausted; retry later.',
142
+ persistence: 'CI wait could not be saved; check local storage and retry.',
143
+ query_timeout: 'GitHub metadata lookup timed out; check connectivity and retry.',
144
+ invalid_request: 'Invalid CI wait arguments.',
145
+ };
146
+ return messages[code] ?? unavailable.message;
147
+ }
148
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/ci-wait/controller.ts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ACpE,gBAAgB,EAAE,0GAA0G;QAC5H,UAAU,EAAE,yCAAyC;QACrD,cAAc,EAAE,uDAAuD;QACvE,eAAe,EAAE,yEAAyE;QAC1F,QAAQ,EAAE,0DAA0D;QACpE,WAAW,EAAE,4DAA4D;QACzE,aAAa,EAAE,iEAAiE;QAChF,eAAe,EAAE,4BAA4B;KAC9C,CAAC;IACF,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { z } from 'zod';
2
+ import { type CiPrIdentity, type CiWaitErrorCode } from '../contract/index.js';
3
+ export declare const CI_QUERY_TIMEOUT_MS = 10000;
4
+ export declare const CI_QUERY_LIMIT = 4;
5
+ export declare const CI_OUTPUT_LIMIT: number;
6
+ export declare const CI_TERMINATE_MS = 2000;
7
+ export declare class CiGithubError extends Error {
8
+ readonly code: CiWaitErrorCode;
9
+ readonly transient: boolean;
10
+ constructor(code: CiWaitErrorCode, message: string, transient?: boolean);
11
+ }
12
+ /** FIFO permits; aborted queued requests never consume a slot. */
13
+ export declare class CiSemaphore {
14
+ private readonly limit;
15
+ private active;
16
+ private readonly queue;
17
+ constructor(limit: number);
18
+ acquire(signal: AbortSignal): Promise<() => void>;
19
+ private release;
20
+ }
21
+ export declare const CI_PROCESS_WRAPPER: string;
22
+ export type CiCommandResult = {
23
+ code: number;
24
+ stdout: string;
25
+ stderr: string;
26
+ };
27
+ export type CiCommandOptions = {
28
+ file: string;
29
+ args: string[];
30
+ };
31
+ /** Environment stays inherited, matching the existing forge gh resolver (including GH_TOKEN/GITHUB_TOKEN). */
32
+ export declare function runCiCommand(command: CiCommandOptions, signal: AbortSignal, discardOutput?: boolean, env?: NodeJS.ProcessEnv, cwd?: string): Promise<CiCommandResult>;
33
+ export declare const githubChecksSchema: z.ZodArray<z.ZodObject<{
34
+ name: z.ZodString;
35
+ state: z.ZodString;
36
+ link: z.ZodString;
37
+ bucket: z.ZodEnum<{
38
+ cancel: "cancel";
39
+ fail: "fail";
40
+ pass: "pass";
41
+ pending: "pending";
42
+ skipping: "skipping";
43
+ }>;
44
+ }, z.core.$strip>>;
45
+ export type GithubCheck = z.infer<typeof githubChecksSchema>[number];
46
+ export declare class GithubCiClient {
47
+ private readonly queries;
48
+ private readonly command;
49
+ private readonly env;
50
+ private readonly cwd?;
51
+ constructor(options?: {
52
+ command?: CiCommandOptions;
53
+ env?: NodeJS.ProcessEnv;
54
+ cwd?: string;
55
+ });
56
+ private query;
57
+ resolve(pr: string, signal: AbortSignal): Promise<CiPrIdentity>;
58
+ head(pr: CiPrIdentity, signal: AbortSignal): Promise<string>;
59
+ checks(pr: CiPrIdentity, signal: AbortSignal): Promise<GithubCheck[]>;
60
+ watch(pr: CiPrIdentity, signal: AbortSignal): Promise<void>;
61
+ }