@amsterdamdatalabs/adl-agent-control-darwin-arm64 0.1.72 → 0.1.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/adl CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/bin/adl
3
- size: 63753136 bytes
4
- sha256: b5724bc076fdc8a82f9a1133ebcfff64284dacb347218dd5fea47f9f5bf04ec6
3
+ size: 63769552 bytes
4
+ sha256: 9403739aa801535382b8fb5e3a87b635bc29e693a5b6cbd7827be70c44fbde27
@@ -21,24 +21,29 @@ if ! jq -e '
21
21
  def nonneg: type == "number" and . >= 0 and floor == .;
22
22
  def nes: type == "string" and length > 0;
23
23
  def guid: type == "string" and test("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
24
+ def caps: type == "object" and all(.[]; type == "string");
24
25
  def aca_pool: type == "object" and
25
- ((keys - ["capabilities"]) | sort) == ["cpu", "disk", "disk_image_id", "memory", "region", "resource_group", "sandbox_group", "sp_client_id", "sp_tenant_id", "subscription_id"] and
26
+ (keys | sort) == ["capabilities", "cpu", "disk", "disk_image_id", "max_sandboxes", "memory", "region", "resource_group", "sandbox_group", "sp_client_id", "sp_tenant_id", "subscription_id"] and
26
27
  (.subscription_id | guid) and (.resource_group | nes) and (.sandbox_group | nes) and (.region | nes) and
27
28
  (.disk_image_id | nes) and (.cpu | nes) and (.memory | nes) and (.disk | nes) and
28
29
  (.sp_client_id | . == "UNSET" or guid) and (.sp_tenant_id | guid) and
29
- ((has("capabilities") | not) or (.capabilities | type == "object" and all(.[]; type == "string")));
30
+ (.max_sandboxes | nonneg) and (.capabilities | caps);
31
+ def hetzner_pool: type == "object" and
32
+ (keys | sort) == ["agents_per_server", "capabilities", "location", "max_servers", "server_type", "snapshot_label_selector"] and
33
+ (.server_type | nes) and (.location | nes) and (.snapshot_label_selector | nes) and
34
+ (.agents_per_server | posint) and (.max_servers | nonneg) and (.capabilities | caps);
30
35
  def agent_pool: type == "object" and
31
- ((keys - ["aca"]) | sort) == ["agents_per_server", "backend", "capabilities", "hour_end_window_minutes", "identity", "location", "max_lifetime_minutes", "max_servers", "org", "parallel_jobs", "poll_seconds", "project", "queue_id", "queue_wait_minutes", "register_timeout_minutes", "server_type", "snapshot_label_selector"] and
32
- (.backend | . == "hetzner" or . == "aca-sandbox") and
33
- ((.backend != "aca-sandbox") or (has("aca") and (.aca | has("capabilities")))) and
36
+ ((keys - ["aca", "hetzner"]) | sort) == ["backends", "hour_end_window_minutes", "identity", "max_lifetime_minutes", "org", "parallel_jobs", "poll_seconds", "project", "queue_id", "queue_wait_minutes", "register_timeout_minutes"] and
37
+ (.backends | type == "array" and length > 0 and (unique | length) == length and all(.[]; . == "hetzner" or . == "aca-sandbox")) and
38
+ ((.backends | index("hetzner") | not) or has("hetzner")) and
39
+ ((.backends | index("aca-sandbox") | not) or has("aca")) and
40
+ ((has("hetzner") | not) or (.hetzner | hetzner_pool)) and
34
41
  ((has("aca") | not) or (.aca | aca_pool)) and
35
42
  (.org | nes) and (.project | nes) and (.queue_id | posint) and
36
43
  (.identity | . == "agent-tarun" or . == "agent-vivek" or . == "agent-reviewer") and
37
- (.server_type | nes) and (.location | nes) and (.snapshot_label_selector | nes) and
38
- (.agents_per_server | posint) and (.max_servers | posint) and (.max_lifetime_minutes | posint) and
44
+ (.max_lifetime_minutes | posint) and
39
45
  (.register_timeout_minutes | posint) and (.poll_seconds | posint) and (.queue_wait_minutes | nonneg) and
40
- (.parallel_jobs | posint) and (.hour_end_window_minutes | nonneg and . <= 59) and
41
- (.capabilities | type == "object" and all(.[]; type == "string"));
46
+ (.parallel_jobs | posint) and (.hour_end_window_minutes | nonneg and . <= 59);
42
47
  def agent_pool_services: type == "object" and (keys - ["agent_pool"] | length) == 0 and
43
48
  ((has("agent_pool") | not) or (.agent_pool | agent_pool));
44
49
  # services.pool_reaper (mac devices): the backup reaper of the linux pool host. pool_host must be a linux device
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amsterdamdatalabs/adl-agent-control-darwin-arm64",
3
- "version": "0.1.72",
3
+ "version": "0.1.74",
4
4
  "description": "adl CLI binary for darwin/arm64 (agent identity + Azure DevOps front door — see docs/architecture/cli-design.md)",
5
5
  "license": "UNLICENSED",
6
6
  "os": [
@@ -526,3 +526,23 @@ the deployed file by hand; re-run `adl install`.
526
526
  still runs for claude/codex/cursor/kimi through their own carriers.
527
527
  - Source of truth for hook commands is `assets/hooks.json`; the generated arrays
528
528
  carry `command`, `matcher`, `timeoutMs` and `fallbackFor` per entry.
529
+
530
+ ## Codex's PreToolUse contract (verified 2026-11-06, `codex-cli 0.166.0`)
531
+
532
+ Checked against the installed Codex and its own runtime
533
+ (`codex-rs/hooks/src/engine/output_parser.rs`), because Codex validates hook
534
+ output strictly where Claude is lenient — a shape Codex rejects fails the hook
535
+ run and the error surfaces in the agent's UI:
536
+
537
+ | Envelope | Codex |
538
+ |---|---|
539
+ | `permissionDecision: "allow"` alone | **rejected** — "PreToolUse hook returned unsupported permissionDecision:allow"; the run is marked FAILED. `"allow"` is honoured ONLY together with `updatedInput`. |
540
+ | `permissionDecision: "allow"` + `updatedInput` | accepted — the rewrite envelope (the only Codex-native "allow"). |
541
+ | `permissionDecision: "ask"` | parsed but **not supported** — the run is marked failed and the tool call CONTINUES, so an ask fails OPEN. Rendered as a deny. |
542
+ | `permissionDecision: "deny"` + a non-empty `permissionDecisionReason` | accepted — blocks the call, and Codex surfaces the reason to the model. A deny with an empty reason does not block. |
543
+ | no `permissionDecision` (e.g. `{}`) | accepted — no opinion, the call proceeds. This is what a hook with nothing to say must send. |
544
+ | `{"passed":true}` (the legacy crg payload) | rejected — Codex's wire type denies unknown fields ("hook returned invalid pre-tool-use JSON output"). |
545
+
546
+ So `src/hosts/impl/codex.ts` never emits a bare `"allow"` and never emits
547
+ `"ask"`, and `src/hooks/crg/index.ts` sends Codex the empty object rather
548
+ than the legacy `{"passed":true}` payload the other hosts get.
@@ -169,9 +169,17 @@ async function preCommit(run: Runner, inv: HookInvocation): Promise<HookResult>
169
169
  return { stdout: '', stderr: '', exitCode: 0 }
170
170
  }
171
171
  const result = await runCrg(run, inv, ['detect-changes', '--brief'])
172
- const stdout = inv.host === 'codex'
173
- ? `${JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'allow' } })}\n`
174
- : '{"passed":true}\n'
172
+ // Codex's PreToolUse output contract has no "allow" verdict of its own:
173
+ // `permissionDecision: "allow"` is only honoured TOGETHER WITH
174
+ // `updatedInput` (the rewrite envelope), and on its own Codex marks the
175
+ // hook run FAILED with "PreToolUse hook returned unsupported
176
+ // permissionDecision:allow" — the error this hook shipped until
177
+ // 2026-11-06. The legacy `{"passed":true}` payload is not parseable by
178
+ // Codex either (its wire type denies unknown fields), so Codex gets the
179
+ // empty object: no decision, so the call proceeds — exactly what this
180
+ // always-passing check means. Verified against `codex-cli 0.166.0`'s
181
+ // `codex-rs/hooks/src/engine/output_parser.rs`.
182
+ const stdout = inv.host === 'codex' ? '{}\n' : '{"passed":true}\n'
175
183
  return { stdout, stderr: missingBinaryNote('pre-commit', result), exitCode: 0 }
176
184
  }
177
185
 
@@ -10,6 +10,33 @@
10
10
  * `CODEX_MCP_MARKERS`) — see `../spec.ts`'s header for why those were
11
11
  * removed. Only `renderDecision`, called from
12
12
  * `../../pre-tool-use/handler.ts`, ever runs outside a test.
13
+ *
14
+ * Codex's PreToolUse output contract, verified 2026-11-06 against the
15
+ * installed `codex-cli 0.166.0` and its own runtime source
16
+ * (`codex-rs/hooks/src/engine/output_parser.rs`,
17
+ * `unsupported_pre_tool_use_hook_specific_output`):
18
+ *
19
+ * - `permissionDecision: "deny"` — a BLOCK. Codex REQUIRES a non-empty
20
+ * `permissionDecisionReason`: without one it reports
21
+ * "permissionDecision:deny without a non-empty permissionDecisionReason"
22
+ * and, having no usable reason, does NOT block.
23
+ * - `permissionDecision: "allow"` — honoured ONLY together with
24
+ * `updatedInput` (the rewrite envelope). On its own Codex reports
25
+ * "PreToolUse hook returned unsupported permissionDecision:allow" and
26
+ * marks the hook run FAILED. So this spec never renders a bare "allow":
27
+ * there is no Codex-native "just allow it" verdict on PreToolUse, and
28
+ * the guard's non-blocked path already short-circuits to `{}` before it
29
+ * ever reaches a host spec (`renderFor` in
30
+ * `../../pre-tool-use/handler.ts`).
31
+ * - `permissionDecision: "ask"` — parsed but NOT supported: Codex marks the
32
+ * hook run failed and continues the tool call, so an "ask" would fail
33
+ * OPEN. Codex enforces only a deny, so an "ask" collapses to one here,
34
+ * the same collapse Kimi's spec already makes.
35
+ *
36
+ * The legacy `{"passed":true}` payload the crg hook emits for the other
37
+ * hosts is NOT a valid Codex PreToolUse output either (Codex's wire type
38
+ * denies unknown fields), which is why the crg hook renders this host's own
39
+ * envelope — see `../../hooks/crg/index.ts`.
13
40
  */
14
41
 
15
42
  import type { Decision, HostSpec } from '../spec.ts'
@@ -18,11 +45,21 @@ export const codexSpec: HostSpec = {
18
45
  id: 'codex',
19
46
 
20
47
  renderDecision(d: Decision): unknown {
48
+ // An "allow" has no Codex-native envelope (see the header): the empty
49
+ // object is the "no decision, proceed" reading that `{}` already
50
+ // carries everywhere else in this package.
51
+ if (d.verdict === 'allow') return {}
52
+ // "deny" and "ask" both render as a deny — Codex cannot enforce an ask
53
+ // (it would fail open), so an ask is expressed as the block it is.
54
+ // The reason must be non-empty: Codex rejects a deny without one, and
55
+ // a rejected deny does not block. `agentMessage` is the agent-facing
56
+ // text and `reason` the human-facing one, so an empty agent message
57
+ // falls back to the human message rather than to nothing.
21
58
  return {
22
59
  hookSpecificOutput: {
23
60
  hookEventName: 'PreToolUse',
24
- permissionDecision: d.verdict === 'allow' ? 'allow' : d.verdict === 'ask' ? 'ask' : 'deny',
25
- permissionDecisionReason: d.agentMessage ?? d.reason,
61
+ permissionDecision: 'deny',
62
+ permissionDecisionReason: d.agentMessage || d.reason,
26
63
  },
27
64
  }
28
65
  },
@@ -36,6 +73,11 @@ export const codexSpec: HostSpec = {
36
73
  // 2026-09-28 against https://developers.openai.com/codex/hooks. This is
37
74
  // the incident host's missing piece: mcp__lean_ctx__ctx_shell git pushes
38
75
  // now arrive carrying the session identity.
76
+ //
77
+ // This is the ONLY shape in which Codex accepts "allow" — an "allow"
78
+ // without `updatedInput` is rejected outright
79
+ // ("PreToolUse hook returned unsupported permissionDecision:allow"),
80
+ // which is the bug this file's own header describes.
39
81
  return {
40
82
  hookSpecificOutput: {
41
83
  hookEventName: 'PreToolUse',
@@ -218,19 +218,21 @@
218
218
  "project": "Enact-Now-AI-AzDo",
219
219
  "queue_id": 80,
220
220
  "identity": "agent-tarun",
221
- "backend": "aca-sandbox",
222
- "server_type": "cpx52",
223
- "location": "fsn1",
224
- "snapshot_label_selector": "adl-pool-image=enact",
225
- "agents_per_server": 1,
226
- "max_servers": 2,
221
+ "backends": ["aca-sandbox", "hetzner"],
227
222
  "max_lifetime_minutes": 360,
228
223
  "register_timeout_minutes": 15,
229
224
  "poll_seconds": 60,
230
225
  "queue_wait_minutes": 5,
231
226
  "parallel_jobs": 6,
232
227
  "hour_end_window_minutes": 10,
233
- "capabilities": {"Agent.OS": "Linux", "docker": "present"},
228
+ "hetzner": {
229
+ "server_type": "cpx52",
230
+ "location": "fsn1",
231
+ "snapshot_label_selector": "adl-pool-image=enact",
232
+ "agents_per_server": 2,
233
+ "max_servers": 1,
234
+ "capabilities": {"Agent.OS": "Linux", "docker": "present"}
235
+ },
234
236
  "aca": {
235
237
  "subscription_id": "3ca1de39-2e87-4ba3-8a47-b3ecc4775697",
236
238
  "resource_group": "enact-neu-d-rg",
@@ -242,6 +244,7 @@
242
244
  "disk": "40Gi",
243
245
  "sp_client_id": "f34d1cd9-4fa1-47bb-9e82-ad9f5cb78a11",
244
246
  "sp_tenant_id": "49d4be4b-06f2-42b7-91bc-a17ccde6f0ce",
247
+ "max_sandboxes": 2,
245
248
  "capabilities": {"Agent.OS": "Linux"}
246
249
  }
247
250
  }
@@ -298,33 +298,44 @@
298
298
  "properties": {
299
299
  "agent_pool": {
300
300
  "type": "object",
301
- "description": "Feature 758: `adl pool run --host NAME`, the elastic Azure Pipelines agent poller (Hetzner servers or Azure Container Apps Sandboxes, per `backend`). Maps 1:1 onto PoolConfig (packages/agent-pool/src/types.ts) in snake_case, plus `backend`, `aca`, `project` (the Azure DevOps project of the queue).",
301
+ "description": "Feature 758: `adl pool run --host NAME`, the elastic Azure Pipelines agent poller. Every backend listed in `backends` is active at once (Hetzner servers and/or Azure Container Apps Sandboxes), in priority order for scale-up. Shared keys map 1:1 onto PoolConfig (packages/agent-pool/src/types.ts) in snake_case, plus `project` (the Azure DevOps project of the queue); each backend has its own settings block.",
302
302
  "additionalProperties": false,
303
- "allOf": [{"if": {"properties": {"backend": {"const": "aca-sandbox"}}}, "then": {"required": ["aca"], "properties": {"aca": {"required": ["capabilities"]}}}}],
304
- "required": ["org", "project", "queue_id", "identity", "backend", "server_type", "location", "snapshot_label_selector", "agents_per_server", "max_servers", "max_lifetime_minutes", "register_timeout_minutes", "poll_seconds", "queue_wait_minutes", "parallel_jobs", "hour_end_window_minutes", "capabilities"],
303
+ "allOf": [
304
+ {"if": {"properties": {"backends": {"contains": {"const": "hetzner"}}}}, "then": {"required": ["hetzner"]}},
305
+ {"if": {"properties": {"backends": {"contains": {"const": "aca-sandbox"}}}}, "then": {"required": ["aca"]}}
306
+ ],
307
+ "required": ["org", "project", "queue_id", "identity", "backends", "max_lifetime_minutes", "register_timeout_minutes", "poll_seconds", "queue_wait_minutes", "parallel_jobs", "hour_end_window_minutes"],
305
308
  "properties": {
306
309
  "org": {"type": "string", "minLength": 1},
307
310
  "project": {"type": "string", "minLength": 1},
308
311
  "queue_id": {"type": "integer", "minimum": 1},
309
312
  "identity": {"enum": ["agent-tarun", "agent-vivek", "agent-reviewer"]},
310
- "backend": {"description": "Where pool machines run: Hetzner servers or ephemeral Azure Container Apps Sandboxes (one sandbox = one agent = one job; needs the `aca` block).", "enum": ["hetzner", "aca-sandbox"]},
311
- "server_type": {"type": "string", "minLength": 1},
312
- "location": {"type": "string", "minLength": 1},
313
- "snapshot_label_selector": {"type": "string", "minLength": 1},
314
- "agents_per_server": {"type": "integer", "minimum": 1},
315
- "max_servers": {"type": "integer", "minimum": 1},
313
+ "backends": {"description": "Active compute backends in scale-up priority order: a waiting job goes to the first backend that can serve it and has room. Each listed backend needs its settings block.", "type": "array", "minItems": 1, "uniqueItems": true, "items": {"enum": ["hetzner", "aca-sandbox"]}},
316
314
  "max_lifetime_minutes": {"type": "integer", "minimum": 1},
317
315
  "register_timeout_minutes": {"type": "integer", "minimum": 1},
318
316
  "poll_seconds": {"type": "integer", "minimum": 1},
319
317
  "queue_wait_minutes": {"description": "A pending job counts as demand only after it has queued this many minutes.", "type": "integer", "minimum": 0},
320
- "parallel_jobs": {"description": "Azure DevOps runs at most this many self-hosted jobs at once across all pools; the pool never creates past the free slots.", "type": "integer", "minimum": 1},
318
+ "parallel_jobs": {"description": "Azure DevOps runs at most this many self-hosted jobs at once across all pools; the pool never creates past the free slots, counted across all backends.", "type": "integer", "minimum": 1},
321
319
  "hour_end_window_minutes": {"type": "integer", "minimum": 0, "maximum": 59},
322
- "capabilities": {"type": "object", "additionalProperties": {"type": "string"}},
320
+ "hetzner": {
321
+ "type": "object",
322
+ "description": "Hetzner backend settings; required when `backends` lists `hetzner` (checked by bin/validate-manifest and `adl pool`). Servers are named adl-pool-<unixms>-<i>, agents hz-*.",
323
+ "additionalProperties": false,
324
+ "required": ["server_type", "location", "snapshot_label_selector", "agents_per_server", "max_servers", "capabilities"],
325
+ "properties": {
326
+ "server_type": {"type": "string", "minLength": 1},
327
+ "location": {"type": "string", "minLength": 1},
328
+ "snapshot_label_selector": {"type": "string", "minLength": 1},
329
+ "agents_per_server": {"type": "integer", "minimum": 1},
330
+ "max_servers": {"description": "Hard cap on concurrently existing Hetzner servers; 0 creates none (drain a backend before removing it) while its machines are still reaped.", "type": "integer", "minimum": 0},
331
+ "capabilities": {"description": "Capabilities the golden image provides; matched against job demands.", "type": "object", "additionalProperties": {"type": "string"}}
332
+ }
333
+ },
323
334
  "aca": {
324
335
  "type": "object",
325
- "description": "Azure Container Apps Sandboxes backend settings; required when `backend` is `aca-sandbox` (checked by bin/validate-manifest and `adl pool`). `disk_image_id` and `sp_client_id` are the literal UNSET until Tarun fills them (`pool run` refuses while UNSET).",
336
+ "description": "Azure Container Apps Sandboxes backend settings; required when `backends` lists `aca-sandbox` (checked by bin/validate-manifest and `adl pool`). Sandboxes are named adl-sbx-<unixms>-<i>, agents sbx-*, one agent per sandbox. `disk_image_id` and `sp_client_id` are the literal UNSET until Tarun fills them (`pool run` refuses while UNSET and aca-sandbox is listed).",
326
337
  "additionalProperties": false,
327
- "required": ["subscription_id", "resource_group", "sandbox_group", "region", "disk_image_id", "cpu", "memory", "disk", "sp_client_id", "sp_tenant_id"],
338
+ "required": ["subscription_id", "resource_group", "sandbox_group", "region", "disk_image_id", "cpu", "memory", "disk", "sp_client_id", "sp_tenant_id", "max_sandboxes", "capabilities"],
328
339
  "properties": {
329
340
  "subscription_id": {"type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"},
330
341
  "resource_group": {"type": "string", "minLength": 1},
@@ -336,7 +347,8 @@
336
347
  "disk": {"type": "string", "minLength": 1},
337
348
  "sp_client_id": {"description": "Application (client) id of the Entra service principal that calls the sandbox data plane (scope https://dynamicsessions.io/.default).", "type": "string", "pattern": "^(UNSET|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"},
338
349
  "sp_tenant_id": {"type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"},
339
- "capabilities": {"description": "Capabilities the sandbox image really has (no docker); required when `backend` is `aca-sandbox`, where it replaces the pool `capabilities` for the servable-job filter.", "type": "object", "additionalProperties": {"type": "string"}}
350
+ "max_sandboxes": {"description": "Hard cap on concurrently existing sandboxes; each runs exactly one agent.", "type": "integer", "minimum": 0},
351
+ "capabilities": {"description": "Capabilities the sandbox image really has (no docker); matched against job demands.", "type": "object", "additionalProperties": {"type": "string"}}
340
352
  }
341
353
  }
342
354
  }