@wjarka/cezarion 0.14.5 → 0.14.6-pr476.729

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 (124) 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/automations/types.d.ts +2 -0
  6. package/dist/ci-wait/client.d.ts +4 -0
  7. package/dist/ci-wait/client.js +67 -0
  8. package/dist/ci-wait/client.js.map +1 -0
  9. package/dist/ci-wait/controller.d.ts +78 -0
  10. package/dist/ci-wait/controller.js +148 -0
  11. package/dist/ci-wait/controller.js.map +1 -0
  12. package/dist/ci-wait/github.d.ts +61 -0
  13. package/dist/ci-wait/github.js +209 -0
  14. package/dist/ci-wait/github.js.map +1 -0
  15. package/dist/ci-wait/injection.d.ts +3 -0
  16. package/dist/ci-wait/injection.js +26 -0
  17. package/dist/ci-wait/injection.js.map +1 -0
  18. package/dist/ci-wait/mcp.d.ts +97 -0
  19. package/dist/ci-wait/mcp.js +35 -0
  20. package/dist/ci-wait/mcp.js.map +1 -0
  21. package/dist/ci-wait/resources.d.ts +7 -0
  22. package/dist/ci-wait/resources.js +32 -0
  23. package/dist/ci-wait/resources.js.map +1 -0
  24. package/dist/ci-wait/supervisor.d.ts +21 -0
  25. package/dist/ci-wait/supervisor.js +163 -0
  26. package/dist/ci-wait/supervisor.js.map +1 -0
  27. package/dist/contract/automations.d.ts +8 -0
  28. package/dist/contract/ci-wait.d.ts +151 -0
  29. package/dist/contract/delegation.d.ts +1 -0
  30. package/dist/contract/index.d.ts +1 -0
  31. package/dist/contract/index.js +1010 -931
  32. package/dist/contract/runs.d.ts +452 -0
  33. package/dist/contract/skills.d.ts +90 -0
  34. package/dist/contract/workflows.d.ts +6 -0
  35. package/dist/core/agent-env.js +2 -0
  36. package/dist/core/agent-env.js.map +1 -1
  37. package/dist/core/agent-runner.d.ts +6 -0
  38. package/dist/core/agent-runner.js +1 -0
  39. package/dist/core/agent-runner.js.map +1 -1
  40. package/dist/core/claude-cli-runner.js +10 -0
  41. package/dist/core/claude-cli-runner.js.map +1 -1
  42. package/dist/core/codex-app-server-runner.js +5 -1
  43. package/dist/core/codex-app-server-runner.js.map +1 -1
  44. package/dist/core/codex-app-server-transport.js +3 -1
  45. package/dist/core/codex-app-server-transport.js.map +1 -1
  46. package/dist/core/cursor-acp-runner.js +9 -1
  47. package/dist/core/cursor-acp-runner.js.map +1 -1
  48. package/dist/core/opencode-server-runner.js +6 -2
  49. package/dist/core/opencode-server-runner.js.map +1 -1
  50. package/dist/core/pi-runner.js +7 -1
  51. package/dist/core/pi-runner.js.map +1 -1
  52. package/dist/delegation/cli.js +5 -3
  53. package/dist/delegation/cli.js.map +1 -1
  54. package/dist/delegation/execution-identity.d.ts +92 -4
  55. package/dist/delegation/execution-identity.js +40 -10
  56. package/dist/delegation/execution-identity.js.map +1 -1
  57. package/dist/delegation/provision.js +5 -2
  58. package/dist/delegation/provision.js.map +1 -1
  59. package/dist/delegation/routes.d.ts +51 -50
  60. package/dist/delegation/service.js +95 -13
  61. package/dist/delegation/service.js.map +1 -1
  62. package/dist/delegation/transport.d.ts +1 -0
  63. package/dist/runs/run-index.js +2 -3
  64. package/dist/runs/run-index.js.map +1 -1
  65. package/dist/runs/store.d.ts +503 -1
  66. package/dist/runs/store.js +66 -2
  67. package/dist/runs/store.js.map +1 -1
  68. package/dist/server/server.d.ts +1378 -12
  69. package/dist/workflows/load.d.ts +2 -0
  70. package/dist/workflows/load.js +5 -0
  71. package/dist/workflows/load.js.map +1 -1
  72. package/dist/workflows/run.d.ts +54 -2
  73. package/dist/workflows/run.js +522 -72
  74. package/dist/workflows/run.js.map +1 -1
  75. package/dist/workflows/types.d.ts +5 -1
  76. package/dist/workflows/types.js +6 -2
  77. package/dist/workflows/types.js.map +1 -1
  78. package/package.json +4 -3
  79. package/scripts/mock-ci-tool.mjs +53 -0
  80. package/scripts/mock-claude.mjs +8 -0
  81. package/scripts/mock-codex-app-server.mjs +212 -0
  82. package/scripts/mock-cursor-acp.mjs +6 -2
  83. package/scripts/mock-opencode-serve.mjs +392 -0
  84. package/scripts/mock-pi-rpc.mjs +7 -0
  85. package/scripts/pi-ci-wait.mjs +14 -0
  86. package/web/dist/assets/{agent-accounts-4EqNShyp.js → agent-accounts-CcLnBjyZ.js} +1 -1
  87. package/web/dist/assets/{alert-dialog-CVF_qvQ8.js → alert-dialog-8mwoA2x7.js} +1 -1
  88. package/web/dist/assets/{collapsible-DVDGHZAE.js → collapsible-MG78rfvM.js} +1 -1
  89. package/web/dist/assets/{commit-list-BuNsBn8P.js → commit-list-DVE7GY1U.js} +1 -1
  90. package/web/dist/assets/{compare-variants-BnQ1O8Ix.js → compare-variants-YXmJ0hYU.js} +1 -1
  91. package/web/dist/assets/{diff-DWmKlqw52.js → diff-CUF4w4o22.js} +2 -2
  92. package/web/dist/assets/{diff-controls-CuqRa-63.js → diff-controls-JUh2cGNp.js} +1 -1
  93. package/web/dist/assets/{diff-stat-BXriPIds.js → diff-stat-DICnDppG.js} +1 -1
  94. package/web/dist/assets/{diff-view-DLPDcgEV.js → diff-view-CBXBGnV7.js} +1 -1
  95. package/web/dist/assets/{dropdown-menu-IsTcumXE.js → dropdown-menu-B1kwkIE_.js} +1 -1
  96. package/web/dist/assets/{git-toolbar-BjMzETip.js → git-toolbar-BAjZOv8F.js} +1 -1
  97. package/web/dist/assets/{github-BvowTAuy.js → github-DqsXdy1k.js} +1 -1
  98. package/web/dist/assets/{image-preview-WXKTY8KT.js → image-preview-B8NqPLMA.js} +1 -1
  99. package/web/dist/assets/{index-Cz3N9b18.js → index-6GppeygG.js} +3 -3
  100. package/web/dist/assets/index-Bp0HvDLr.css +1 -0
  101. package/web/dist/assets/{markdown-gFxX4dDH.js → markdown-CZxhNOQh.js} +1 -1
  102. package/web/dist/assets/{pill-BlaWNkHk.js → pill-DQT1rWZP.js} +1 -1
  103. package/web/dist/assets/{project-router-CX1jLqj-.js → project-router-YQ1GYp7a.js} +1 -1
  104. package/web/dist/assets/{prompt-templates-DwdQcfSc.js → prompt-templates-Bb1w9Dwd.js} +1 -1
  105. package/web/dist/assets/{repo-git-DnbE8dR5.js → repo-git-DgpVLdMQ.js} +1 -1
  106. package/web/dist/assets/{run-diff-Mfc85irR.js → run-diff-ClikDq3i.js} +1 -1
  107. package/web/dist/assets/{run-header-CSaJIGXl.css → run-header-BJQfFL2l.css} +1 -1
  108. package/web/dist/assets/run-header-DuupVgSH.js +1 -0
  109. package/web/dist/assets/{skills-DHfsyXTQ.js → skills-CLR6yR6h.js} +1 -1
  110. package/web/dist/assets/{tab-link-DhREnUYE.js → tab-link-BBR-zpVB.js} +1 -1
  111. package/web/dist/assets/{task-changes-Cfo-vtEl.js → task-changes-DsziIjXe.js} +1 -1
  112. package/web/dist/assets/{task-commits-CvK4flXT.js → task-commits-CwqC2kgi.js} +1 -1
  113. package/web/dist/assets/{task-files-BwVGUObK.js → task-files-Bpbt08WD.js} +1 -1
  114. package/web/dist/assets/{task-thread-g1vc4tKn.js → task-thread-FH1Ra9LN.js} +1 -1
  115. package/web/dist/assets/{textarea-DCP8bOOf.js → textarea-CgTC9C9v.js} +1 -1
  116. package/web/dist/assets/{thread-loading-D9DbIsIS.js → thread-loading-BQ30Dlqm.js} +1 -1
  117. package/web/dist/assets/{token-metrics-PSnNTJZF.js → token-metrics-DNeNvbf_.js} +1 -1
  118. package/web/dist/assets/utils-BH4UcIc1.js +64 -0
  119. package/web/dist/assets/{workflows-BDdUJIFT.js → workflows-DtEkn_QK.js} +3 -3
  120. package/web/dist/assets/{zoomable-image-yNqiuVu7.js → zoomable-image-D7AC8scA.js} +1 -1
  121. package/web/dist/index.html +14 -14
  122. package/web/dist/assets/index-DK0Mkv2m.css +0 -1
  123. package/web/dist/assets/run-header-CDO3LV4z.js +0 -1
  124. package/web/dist/assets/utils-DNvmfH6b.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.
@@ -472,6 +504,7 @@ The provisioned command has these forms (the session instructions supply the abs
472
504
  ```sh
473
505
  cez worker spawn --baseline parent-head --request-id <UUID> 'Implement the assigned change'
474
506
  cez worker spawn --baseline parent-head --request-id <UUID> --backend codex --effort high --context-file ./selected-context.txt 'Review the parser'
507
+ cez worker spawn --baseline parent-head --request-id <UUID> --workflow review 'Review the parser change'
475
508
  cez worker inspect <worker-id>
476
509
  cez worker steer <worker-id> 'Consider this additional constraint'
477
510
  cez worker diff <worker-id>
@@ -492,7 +525,9 @@ cez worker stop <worker-id>
492
525
  cez worker destroy <worker-id>
493
526
  ```
494
527
 
495
- Use `cez worker --help` to list operations and flags, or `cez worker <operation> --help` for one operation. Explicit help prints human-readable text and exits successfully without an active delegation session. Commands otherwise return bounded JSON and a nonzero exit on failure or incomplete cleanup. Spawn requires a committed baseline (`parent-head` or an explicit ref) and pins its SHA at acceptance; dirty parent edits are excluded. Optional `--context '<text>'` or `--context-file <UTF-8-file>` supplies selected context, not the parent's conversation. The two flags are mutually exclusive, and combined task/context text is limited to 100,000 characters. The API also accepts up to 32 pinned-baseline file or parent-attachment references, with at most 8 MiB of copied attachments. Inspect reports worker-local input locations. Reuse a request ID only with the same task, baseline, context, backend, model and effort when retrying a lost response. There are at most 32 accepted creations per parent, counting destroyed workers, and 32 undelivered steering messages per worker.
528
+ Use `cez worker --help` to list operations and flags, or `cez worker <operation> --help` for one operation. Explicit help prints human-readable text and exits successfully without an active delegation session. Commands otherwise return bounded JSON and a nonzero exit on failure or incomplete cleanup. Spawn requires a committed baseline (`parent-head` or an explicit ref) and pins its SHA at acceptance; dirty parent edits are excluded. Optional `--context '<text>'` or `--context-file <UTF-8-file>` supplies selected context, not the parent's conversation. The two flags are mutually exclusive, and combined task/context text is limited to 100,000 characters. The API also accepts up to 32 pinned-baseline file or parent-attachment references, with at most 8 MiB of copied attachments. Inspect reports worker-local input locations. Reuse a request ID only with the same task, baseline, context, backend, model, effort and workflow when retrying a lost response. There are at most 32 accepted creations per parent, counting destroyed workers, and 32 undelivered steering messages per worker.
529
+
530
+ `--workflow <name>` runs a catalog workflow inside the worker: the built-in `quick-task` or any `.ai/cezar/workflows/*.yaml` by name, with its agent and check steps, `skill:` bodies and `onFail` loops, so a repo's `review.yaml` becomes a dedicated reviewer. Omitted `--workflow` runs `quick-task` exactly as before. `--backend`, `--model` and `--effort` fill only the steps that leave those fields unset; a step's own `allowedTools`/`bashAllowlist` narrow the parent's grants and never widen them. An unknown name is refused. Agent steps may mix runners: at spawn every agent step is resolved and pinned separately, so an implement-with-codex, review-with-claude chain runs each step under its own runner, account, model, effort and grants. A step's optional `agentProfile` names the account it runs under (an id the registry does not know is refused); same-backend steps otherwise inherit the parent's account and other runners resolve their project/default one. Run-level columns show the first agent step.
496
531
 
497
532
  Omitted `--backend` inherits the parent's active backend. Same-backend workers inherit omitted model/account/effort; `--backend <claude|codex|opencode|pi|cursor>` selecting another backend resolves that backend's project/default account and model without forwarding another provider's settings. `--model <model>` selects a supported model, subject to existing locks. `--effort <low|medium|high|xhigh|max>` pins reasoning effort on same-backend and mixed-backend spawn; omitted `--effort` still inherits the parent pin on same-backend spawn and drops it on mixed-backend spawn. Accepted identity and grants remain fixed across queuing, restart and Continue, including explicit empty grants. Changing or deleting an account registry entry does not rebind a worker. Missing accepted identity evidence or account homes, incompatible Claude state-file layouts, and conflicting later model locks refuse execution explicitly. Credentials and vendor configuration are never copied; each worker receives its own delegation credential, and unspecified native models stay unspecified.
498
533
 
@@ -573,7 +608,7 @@ Useful environment variables:
573
608
  |---|---|
574
609
  | `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. |
575
610
  | `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. |
576
- | `CEZ_DRY_RUN=1` | Use the bundled mock instead of the real `claude` CLI — the entire cockpit works offline, for demos and development. |
611
+ | `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. |
577
612
  | `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. |
578
613
  | `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`). |
579
614
  | `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,EAAE,MAAM,gBAAgB,CAAC;AAOnD,iFAAiF;AACjF,SAAS,uBAAuB,CAAC,KAAa;IAC5C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAE,CAAC;QAChC,IAAI,QAAQ,EAAE,CAAC;YACb,GAAG,IAAI,SAAS,CAAC;YACjB,IAAI,OAAO;gBAAE,OAAO,GAAG,KAAK,CAAC;iBACxB,IAAI,SAAS,KAAK,IAAI;gBAAE,OAAO,GAAG,IAAI,CAAC;iBACvC,IAAI,SAAS,KAAK,GAAG;gBAAE,QAAQ,GAAG,KAAK,CAAC;YAC7C,SAAS;QACX,CAAC;QACD,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YACtB,QAAQ,GAAG,IAAI,CAAC;YAChB,GAAG,IAAI,SAAS,CAAC;YACjB,SAAS;QACX,CAAC;QACD,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YACtB,IAAI,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;YAC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AO,QAAQ,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -32,6 +32,7 @@ export declare const automationTaskSchema: z.ZodObject<{
32
32
  opencode: "opencode";
33
33
  pi: "pi";
34
34
  }>>;
35
+ agentProfile: z.ZodOptional<z.ZodString>;
35
36
  allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
37
  bashAllowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
38
  command: z.ZodOptional<z.ZodString>;
@@ -95,6 +96,7 @@ export declare const automationDefinitionSchema: z.ZodObject<{
95
96
  opencode: "opencode";
96
97
  pi: "pi";
97
98
  }>>;
99
+ agentProfile: z.ZodOptional<z.ZodString>;
98
100
  allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
101
  bashAllowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
100
102
  command: z.ZodOptional<z.ZodString>;
@@ -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=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AC,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"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE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@ -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
+ }