@corca-org/ceal-host-win32-x64 1.0.4 → 1.0.6

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.
@@ -146,6 +146,7 @@ var CEAL_OPERATION_RECOVERY_KINDS = vocabulary(["none", "reconcile", "compensate
146
146
  var CEAL_OPERATION_RECOVERY_STATUSES = vocabulary(["not_started", "active", "completed"]);
147
147
  var CEAL_OPERATION_PROVIDER_READBACK_AVAILABILITY = vocabulary(["not_started", "not_applicable", "not_available", "pending", "available"]);
148
148
  var CEAL_OPERATION_OFFERED_HANDOFF_STATES = vocabulary(["accepted", "rejected", "unknown"]);
149
+ var CEAL_OPERATION_RECEIPT_AUTHORITY_KEYS = Object.freeze(["instance_ref", "profile_ref", "principal_ref", "execution_subject_ref", "authority_revision_ref"]);
149
150
  var CEAL_OPERATION_APPROVAL_DISPOSITIONS = vocabulary([
150
151
  "approval_not_required_by_policy",
151
152
  "interactive_pending",
@@ -402,7 +403,13 @@ var CEAL_OPERATION_JSON_SCHEMA_BUDGET = Object.freeze({
402
403
  max_string_length: OPERATION_SCHEMA_LITERAL_MAX_BYTES / 4,
403
404
  max_alternatives: 8,
404
405
  max_enum_values: 64,
405
- max_literal_bytes: OPERATION_SCHEMA_LITERAL_MAX_BYTES
406
+ max_literal_bytes: OPERATION_SCHEMA_LITERAL_MAX_BYTES,
407
+ /** @basis our_policy -- bounds explanatory schema prose carried in one catalog. */
408
+ max_description_characters: 1024,
409
+ /** @basis our_policy -- bounds regular-expression compilation input from one schema. */
410
+ max_pattern_characters: 256,
411
+ /** @basis our_policy -- bounds traversal work inside one already byte-bounded schema literal. */
412
+ max_literal_nodes: 512
406
413
  });
407
414
 
408
415
  // packages/ceal-client-protocol/src/operation-validation-primitives.ts
@@ -422,6 +429,9 @@ function requireIsoTimestamp(value, message) {
422
429
  if (typeof value !== "string" || !ISO_TIMESTAMP.test(value) || !Number.isFinite(Date.parse(value))) throw new TypeError(message);
423
430
  }
424
431
 
432
+ // packages/ceal-client-protocol/src/operation-json-schema.ts
433
+ var JSON_DESCRIPTION_CONTROL_CHARACTER = new RegExp("\\p{Cc}", "u");
434
+
425
435
  // packages/ceal-client-protocol/src/operation-contract-validation.ts
426
436
  var CEAL_OPERATION_AUTHORITY_POLICY_KEYS = Object.freeze(["profile", "instance_binding", "target", "admission_recheck"]);
427
437
  var MAX_OPERATION_INPUT_RESOLVER_BINDINGS = 96;
@@ -522,7 +532,6 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
522
532
  control_commit: (root) => join(root, "control-auto-commit.jsonl"),
523
533
  engagement_signal: (root) => join(root, "runtime-state", "slack-feedback.jsonl"),
524
534
  runtime_error: (root) => join(root, "runtime-state", "runtime-errors.jsonl"),
525
- provider_retry: (root) => join(root, "observability", "provider-retry-queue", "queue.jsonl"),
526
535
  turn_bridge_request: (root) => join(root, ".ceal", "turn-bridge", "requests.jsonl"),
527
536
  channel_log: (root) => join(root, "log.jsonl"),
528
537
  thread_run_events: (root) => join(root, "run-events.jsonl"),
@@ -531,8 +540,6 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
531
540
  gateway_capability_audit: (root) => join(root, "capability-audit.jsonl"),
532
541
  gateway_retrieval_waste_partition: (root) => `${root}.jsonl`,
533
542
  gateway_access_policy_publication: (root) => join(root, "access-policy-publications.jsonl"),
534
- gateway_event_lease_journal: (root) => `${root}.journal.jsonl`,
535
- gateway_control_audit: (root) => `${root}.control-audits.jsonl`,
536
543
  gateway_profile_connector_control_audit: (root) => `${root}.audit.jsonl`,
537
544
  gateway_profile_connector_scope_audit: (root) => join(root, "profile-connector-scope-audit.jsonl"),
538
545
  gateway_profile_connector_activity_scope_audit: (root) => join(root, "profile-connector-activity-scope-audit.jsonl"),
@@ -547,6 +554,11 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
547
554
  gateway_admin_access_token: (root) => join(root, "access-tokens.jsonl")
548
555
  });
549
556
 
557
+ // packages/ceal-client-protocol/src/gateway-installation-activation.ts
558
+ var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_DATA_CHARACTERS = 32;
559
+ var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_CHECK_CHARACTERS = 8;
560
+ var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_COMPACT_CHARACTERS = CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_DATA_CHARACTERS + CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_CHECK_CHARACTERS;
561
+
550
562
  // packages/ceal-client-protocol/src/host-registration.ts
551
563
  var CEAL_HOST_REGISTRATION_RESULT_KEYS = Object.freeze(["credential_generation", "host_access_token", "host_installation_ref", "host_source_ref", "ok", "registration_attempt_ref", "schema_version", "status"]);
552
564
 
@@ -1121,7 +1133,7 @@ var CEAL_ACTOR_KINDS = vocabulary(["human", "bot", "app", "unknown"]);
1121
1133
  // packages/ceal-client-protocol/src/leased-consumer-vocabulary.ts
1122
1134
  var CEAL_TERMINAL_DISPOSITIONS = vocabulary(["completed", "failed", "cancelled"]);
1123
1135
  var CEAL_LEASE_DISPOSITIONS = vocabulary([...CEAL_TERMINAL_DISPOSITIONS, "deferred"]);
1124
- var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["reaction", "progress_start", "progress_finish"]);
1136
+ var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["initial"]);
1125
1137
  var CEAL_LEASED_MESSAGE_DELIVERY_CAPABILITY_IDS = vocabulary(["message.create", "message.update", "message.delete"]);
1126
1138
  var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
1127
1139
  var CEAL_RESULT_DELIVERY_OFFERS = vocabulary(["pending", "offered", "transport_lost"]);
@@ -1261,6 +1273,7 @@ function isAbsoluteNormalizedNonRootPath(value, flavor = process.platform, allow
1261
1273
  // host/producer-service.ts
1262
1274
  var MAX_CONFIG_BYTES = 32 * 1024;
1263
1275
  var SAFE_REF2 = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;
1276
+ var HOST_PRODUCER_SERVE_COMMAND_PREFIX = ["serve", "--config"];
1264
1277
  var HostProducerServiceError = class extends Error {
1265
1278
  code;
1266
1279
  constructor(code, message = code) {
@@ -1297,7 +1310,7 @@ function hostProducerError(code, message = code) {
1297
1310
  return new HostProducerServiceError(code, message);
1298
1311
  }
1299
1312
  function parseProducerServeArgs(args, platform, error) {
1300
- if (args.length !== 3 || args[0] !== "serve" || args[1] !== "--config") throw error("invalid_arguments", refusalFact("args", args, "serve --config <absolute path>"));
1313
+ if (args.length !== HOST_PRODUCER_SERVE_COMMAND_PREFIX.length + 1 || args[0] !== HOST_PRODUCER_SERVE_COMMAND_PREFIX[0] || args[1] !== HOST_PRODUCER_SERVE_COMMAND_PREFIX[1]) throw error("invalid_arguments", refusalFact("args", args, "serve --config <absolute path>"));
1301
1314
  assertProducerAbsolutePath(args[2], platform, "config", error);
1302
1315
  return args[2];
1303
1316
  }
@@ -1431,6 +1444,7 @@ function boundedMilliseconds(value) {
1431
1444
  // host/relay/src/producer-frame.ts
1432
1445
  var HOST_PRODUCER_FRAME_SCHEMA = "ceal.host_producer_frame.v1";
1433
1446
  var HOST_PRODUCER_MAX_JSON_BYTES = 262144;
1447
+ var HOST_PRODUCER_FRAME_LENGTH_BYTES = Uint32Array.BYTES_PER_ELEMENT;
1434
1448
  var SAFE_REF3 = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;
1435
1449
  var DIGEST2 = /^[a-f0-9]{64}$/u;
1436
1450
  var PRODUCERS = /* @__PURE__ */ new Set(["codex", "claude"]);
@@ -1450,18 +1464,18 @@ function encodeHostProducerFrame(frame) {
1450
1464
  validateFrame(frame);
1451
1465
  const json = Buffer.from(JSON.stringify(frame), "utf8");
1452
1466
  if (json.byteLength > HOST_PRODUCER_MAX_JSON_BYTES) throw new HostProducerFrameError("frame_too_large", `frame_too_large: ${refusalFact("frame_bytes", json.byteLength, `at most ${HOST_PRODUCER_MAX_JSON_BYTES}`)}`);
1453
- const result = Buffer.allocUnsafe(json.byteLength + 4);
1467
+ const result = Buffer.allocUnsafe(json.byteLength + HOST_PRODUCER_FRAME_LENGTH_BYTES);
1454
1468
  result.writeUInt32BE(json.byteLength, 0);
1455
- json.copy(result, 4);
1469
+ json.copy(result, HOST_PRODUCER_FRAME_LENGTH_BYTES);
1456
1470
  return result;
1457
1471
  }
1458
1472
  function decodeHostProducerFrame(input) {
1459
- if (input.byteLength < 4) throw new HostProducerFrameError("frame_truncated", `frame_truncated: ${refusalFact("frame_bytes", input.byteLength, "at least 4")}`);
1473
+ if (input.byteLength < HOST_PRODUCER_FRAME_LENGTH_BYTES) throw new HostProducerFrameError("frame_truncated", `frame_truncated: ${refusalFact("frame_bytes", input.byteLength, `at least ${HOST_PRODUCER_FRAME_LENGTH_BYTES}`)}`);
1460
1474
  const length = input.readUInt32BE(0);
1461
1475
  if (length > HOST_PRODUCER_MAX_JSON_BYTES) throw new HostProducerFrameError("frame_too_large", `frame_too_large: ${refusalFact("declared_bytes", length, `at most ${HOST_PRODUCER_MAX_JSON_BYTES}`)}`);
1462
1476
  if (length === 0) throw new HostProducerFrameError("invalid_frame_length");
1463
- if (input.byteLength !== length + 4) throw new HostProducerFrameError(input.byteLength < length + 4 ? "frame_truncated" : "invalid_frame_length");
1464
- const bytes = input.subarray(4);
1477
+ if (input.byteLength !== length + HOST_PRODUCER_FRAME_LENGTH_BYTES) throw new HostProducerFrameError(input.byteLength < length + HOST_PRODUCER_FRAME_LENGTH_BYTES ? "frame_truncated" : "invalid_frame_length");
1478
+ const bytes = input.subarray(HOST_PRODUCER_FRAME_LENGTH_BYTES);
1465
1479
  const text = new TextDecoder("utf-8", { fatal: true });
1466
1480
  let value;
1467
1481
  try {
@@ -1608,6 +1622,8 @@ var HOST_RELAY_REQUEST_BINDING_KEYS = Object.freeze([
1608
1622
  "host_input_ref"
1609
1623
  ]);
1610
1624
  var HOST_RELAY_IPC_RESPONSE_SCHEMA = "ceal.host_relay_admission.v1";
1625
+ var HOST_RELAY_IPC_LENGTH_BYTES = Uint32Array.BYTES_PER_ELEMENT;
1626
+ var HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES = 4096;
1611
1627
  var HostRelayIpcError = class extends Error {
1612
1628
  code;
1613
1629
  constructor(code, message = code) {
@@ -1661,12 +1677,12 @@ function exchange(endpoint, encoded, timeoutMs, decode) {
1661
1677
  });
1662
1678
  }
1663
1679
  function decodeHostRelayIpcResponse(input) {
1664
- if (input.length < 4) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response is truncated: ${refusalFact("response_bytes", input.byteLength, "at least 4")}.`);
1680
+ if (input.length < HOST_RELAY_IPC_LENGTH_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response is truncated: ${refusalFact("response_bytes", input.byteLength, `at least ${HOST_RELAY_IPC_LENGTH_BYTES}`)}.`);
1665
1681
  const length = input.readUInt32BE(0);
1666
- if (length === 0 || length > 4096 || input.length !== length + 4) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFacts([{ name: "declared_bytes", value: length, expected: "between 1 and 4096" }, { name: "received_bytes", value: input.byteLength, expected: `exactly ${length + 4}` }])}.`);
1682
+ if (length === 0 || length > HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES || input.length !== length + HOST_RELAY_IPC_LENGTH_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFacts([{ name: "declared_bytes", value: length, expected: `between 1 and ${HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES}` }, { name: "received_bytes", value: input.byteLength, expected: `exactly ${length + HOST_RELAY_IPC_LENGTH_BYTES}` }])}.`);
1667
1683
  let value;
1668
1684
  try {
1669
- value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(input.subarray(4)));
1685
+ value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(input.subarray(HOST_RELAY_IPC_LENGTH_BYTES)));
1670
1686
  } catch {
1671
1687
  throw new HostRelayIpcError("relay_unavailable", "Host Relay IPC response is invalid.");
1672
1688
  }
@@ -1689,11 +1705,11 @@ function record2(value) {
1689
1705
  return value !== null && typeof value === "object" && !Array.isArray(value);
1690
1706
  }
1691
1707
  function decodeResponseBuffer(buffer) {
1692
- if (buffer.length < 4) return null;
1708
+ if (buffer.length < HOST_RELAY_IPC_LENGTH_BYTES) return null;
1693
1709
  const length = buffer.readUInt32BE(0);
1694
- if (length === 0 || length > 4096) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFact("declared_bytes", length, "between 1 and 4096")}.`);
1695
- if (buffer.length < length + 4) return null;
1696
- if (buffer.length !== length + 4) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC returned trailing bytes: ${refusalFacts([{ name: "declared_bytes", value: length, expected: "the received message length minus 4" }, { name: "received_bytes", value: buffer.byteLength, expected: `exactly ${length + 4}` }])}.`);
1710
+ if (length === 0 || length > HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFact("declared_bytes", length, `between 1 and ${HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES}`)}.`);
1711
+ if (buffer.length < length + HOST_RELAY_IPC_LENGTH_BYTES) return null;
1712
+ if (buffer.length !== length + HOST_RELAY_IPC_LENGTH_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC returned trailing bytes: ${refusalFacts([{ name: "declared_bytes", value: length, expected: `the received message length minus ${HOST_RELAY_IPC_LENGTH_BYTES}` }, { name: "received_bytes", value: buffer.byteLength, expected: `exactly ${length + HOST_RELAY_IPC_LENGTH_BYTES}` }])}.`);
1697
1713
  return decodeHostRelayIpcResponse(buffer);
1698
1714
  }
1699
1715
 
@@ -1824,6 +1840,7 @@ function isRecord2(value) {
1824
1840
 
1825
1841
  // host/codex/src/codex-outbox.ts
1826
1842
  var SAFE_REF4 = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;
1843
+ var CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS = 4096;
1827
1844
  var CodexOutboxStore = class {
1828
1845
  directory;
1829
1846
  entriesDirectory;
@@ -2190,13 +2207,13 @@ function validateRegistration(value) {
2190
2207
  }
2191
2208
  function validateRegistrationFields(value) {
2192
2209
  if (![value.host_source_ref, value.host_session_ref, value.codex_session_id].every((candidate) => typeof candidate === "string" && SAFE_REF4.test(candidate))) throw storageError(`Codex transcript registration references are malformed (${refusalFacts([{ name: "host_source_ref", value: value.host_source_ref }, { name: "host_session_ref", value: value.host_session_ref }, { name: "codex_session_id", value: value.codex_session_id }])}).`);
2193
- if (!validRegistrationCwd(value.cwd)) throw storageError(`Codex transcript registration working directory is malformed (${refusalFact("cwd_characters", typeof value.cwd === "string" ? value.cwd.length : 0, "an absolute path of at most 4096 characters")}).`);
2210
+ if (!validRegistrationCwd(value.cwd)) throw storageError(`Codex transcript registration working directory is malformed (${refusalFact("cwd_characters", typeof value.cwd === "string" ? value.cwd.length : 0, `an absolute path of at most ${CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS} characters`)}).`);
2194
2211
  if (typeof value.transcript_path !== "string") throw storageError(`Codex transcript registration path is malformed (${refusalFact("kind", typeof value.transcript_path, "string")}).`);
2195
- if (value.transcript_path.length === 0 || value.transcript_path.length > 4096) throw storageError(`Codex transcript registration path is malformed (${refusalFact("characters", value.transcript_path.length, "from 1 through 4096")}).`);
2212
+ if (value.transcript_path.length === 0 || value.transcript_path.length > CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS) throw storageError(`Codex transcript registration path is malformed (${refusalFact("characters", value.transcript_path.length, `from 1 through ${CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS}`)}).`);
2196
2213
  if (!isTimestamp(value.registered_at) || !isTimestamp(value.expires_at)) throw storageError(`Codex transcript registration timestamps are malformed (${refusalFacts([{ name: "registered_at", value: value.registered_at }, { name: "expires_at", value: value.expires_at }])}).`);
2197
2214
  }
2198
2215
  function validRegistrationCwd(value) {
2199
- return value === void 0 || typeof value === "string" && isAbsolute(value) && value.length <= 4096 && !value.includes("\0");
2216
+ return value === void 0 || typeof value === "string" && isAbsolute(value) && value.length <= CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS && !value.includes("\0");
2200
2217
  }
2201
2218
  function validateCursor(value) {
2202
2219
  if (!isRecord3(value)) throw storageError("Codex transcript cursor is malformed.");
@@ -2176,6 +2176,7 @@ var CEAL_OPERATION_RECOVERY_KINDS = vocabulary(["none", "reconcile", "compensate
2176
2176
  var CEAL_OPERATION_RECOVERY_STATUSES = vocabulary(["not_started", "active", "completed"]);
2177
2177
  var CEAL_OPERATION_PROVIDER_READBACK_AVAILABILITY = vocabulary(["not_started", "not_applicable", "not_available", "pending", "available"]);
2178
2178
  var CEAL_OPERATION_OFFERED_HANDOFF_STATES = vocabulary(["accepted", "rejected", "unknown"]);
2179
+ var CEAL_OPERATION_RECEIPT_AUTHORITY_KEYS = Object.freeze(["instance_ref", "profile_ref", "principal_ref", "execution_subject_ref", "authority_revision_ref"]);
2179
2180
  var CEAL_OPERATION_APPROVAL_DISPOSITIONS = vocabulary([
2180
2181
  "approval_not_required_by_policy",
2181
2182
  "interactive_pending",
@@ -2432,7 +2433,13 @@ var CEAL_OPERATION_JSON_SCHEMA_BUDGET = Object.freeze({
2432
2433
  max_string_length: OPERATION_SCHEMA_LITERAL_MAX_BYTES / 4,
2433
2434
  max_alternatives: 8,
2434
2435
  max_enum_values: 64,
2435
- max_literal_bytes: OPERATION_SCHEMA_LITERAL_MAX_BYTES
2436
+ max_literal_bytes: OPERATION_SCHEMA_LITERAL_MAX_BYTES,
2437
+ /** @basis our_policy -- bounds explanatory schema prose carried in one catalog. */
2438
+ max_description_characters: 1024,
2439
+ /** @basis our_policy -- bounds regular-expression compilation input from one schema. */
2440
+ max_pattern_characters: 256,
2441
+ /** @basis our_policy -- bounds traversal work inside one already byte-bounded schema literal. */
2442
+ max_literal_nodes: 512
2436
2443
  });
2437
2444
 
2438
2445
  // packages/ceal-client-protocol/src/operation-validation-primitives.ts
@@ -2452,6 +2459,9 @@ function requireIsoTimestamp(value, message) {
2452
2459
  if (typeof value !== "string" || !ISO_TIMESTAMP.test(value) || !Number.isFinite(Date.parse(value))) throw new TypeError(message);
2453
2460
  }
2454
2461
 
2462
+ // packages/ceal-client-protocol/src/operation-json-schema.ts
2463
+ var JSON_DESCRIPTION_CONTROL_CHARACTER = new RegExp("\\p{Cc}", "u");
2464
+
2455
2465
  // packages/ceal-client-protocol/src/operation-contract-validation.ts
2456
2466
  var CEAL_OPERATION_AUTHORITY_POLICY_KEYS = Object.freeze(["profile", "instance_binding", "target", "admission_recheck"]);
2457
2467
  var MAX_OPERATION_INPUT_RESOLVER_BINDINGS = 96;
@@ -2552,7 +2562,6 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
2552
2562
  control_commit: (root) => join(root, "control-auto-commit.jsonl"),
2553
2563
  engagement_signal: (root) => join(root, "runtime-state", "slack-feedback.jsonl"),
2554
2564
  runtime_error: (root) => join(root, "runtime-state", "runtime-errors.jsonl"),
2555
- provider_retry: (root) => join(root, "observability", "provider-retry-queue", "queue.jsonl"),
2556
2565
  turn_bridge_request: (root) => join(root, ".ceal", "turn-bridge", "requests.jsonl"),
2557
2566
  channel_log: (root) => join(root, "log.jsonl"),
2558
2567
  thread_run_events: (root) => join(root, "run-events.jsonl"),
@@ -2561,8 +2570,6 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
2561
2570
  gateway_capability_audit: (root) => join(root, "capability-audit.jsonl"),
2562
2571
  gateway_retrieval_waste_partition: (root) => `${root}.jsonl`,
2563
2572
  gateway_access_policy_publication: (root) => join(root, "access-policy-publications.jsonl"),
2564
- gateway_event_lease_journal: (root) => `${root}.journal.jsonl`,
2565
- gateway_control_audit: (root) => `${root}.control-audits.jsonl`,
2566
2573
  gateway_profile_connector_control_audit: (root) => `${root}.audit.jsonl`,
2567
2574
  gateway_profile_connector_scope_audit: (root) => join(root, "profile-connector-scope-audit.jsonl"),
2568
2575
  gateway_profile_connector_activity_scope_audit: (root) => join(root, "profile-connector-activity-scope-audit.jsonl"),
@@ -2577,6 +2584,11 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
2577
2584
  gateway_admin_access_token: (root) => join(root, "access-tokens.jsonl")
2578
2585
  });
2579
2586
 
2587
+ // packages/ceal-client-protocol/src/gateway-installation-activation.ts
2588
+ var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_DATA_CHARACTERS = 32;
2589
+ var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_CHECK_CHARACTERS = 8;
2590
+ var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_COMPACT_CHARACTERS = CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_DATA_CHARACTERS + CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_CHECK_CHARACTERS;
2591
+
2580
2592
  // packages/ceal-client-protocol/src/host-registration.ts
2581
2593
  var CEAL_HOST_REGISTRATION_RESULT_KEYS = Object.freeze(["credential_generation", "host_access_token", "host_installation_ref", "host_source_ref", "ok", "registration_attempt_ref", "schema_version", "status"]);
2582
2594
 
@@ -3152,7 +3164,7 @@ var CEAL_ACTOR_KINDS = vocabulary(["human", "bot", "app", "unknown"]);
3152
3164
  // packages/ceal-client-protocol/src/leased-consumer-vocabulary.ts
3153
3165
  var CEAL_TERMINAL_DISPOSITIONS = vocabulary(["completed", "failed", "cancelled"]);
3154
3166
  var CEAL_LEASE_DISPOSITIONS = vocabulary([...CEAL_TERMINAL_DISPOSITIONS, "deferred"]);
3155
- var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["reaction", "progress_start", "progress_finish"]);
3167
+ var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["initial"]);
3156
3168
  var CEAL_LEASED_MESSAGE_DELIVERY_CAPABILITY_IDS = vocabulary(["message.create", "message.update", "message.delete"]);
3157
3169
  var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
3158
3170
  var CEAL_RESULT_DELIVERY_OFFERS = vocabulary(["pending", "offered", "transport_lost"]);
@@ -3429,6 +3441,7 @@ import { promisify as promisify2 } from "node:util";
3429
3441
  // host/relay/src/producer-frame.ts
3430
3442
  var HOST_PRODUCER_FRAME_SCHEMA = "ceal.host_producer_frame.v1";
3431
3443
  var HOST_PRODUCER_MAX_JSON_BYTES = 262144;
3444
+ var HOST_PRODUCER_FRAME_LENGTH_BYTES = Uint32Array.BYTES_PER_ELEMENT;
3432
3445
  var SAFE_REF3 = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;
3433
3446
  var DIGEST2 = /^[a-f0-9]{64}$/u;
3434
3447
  var PRODUCERS = /* @__PURE__ */ new Set(["codex", "claude"]);
@@ -3448,18 +3461,18 @@ function encodeHostProducerFrame(frame) {
3448
3461
  validateFrame(frame);
3449
3462
  const json = Buffer.from(JSON.stringify(frame), "utf8");
3450
3463
  if (json.byteLength > HOST_PRODUCER_MAX_JSON_BYTES) throw new HostProducerFrameError("frame_too_large", `frame_too_large: ${refusalFact("frame_bytes", json.byteLength, `at most ${HOST_PRODUCER_MAX_JSON_BYTES}`)}`);
3451
- const result = Buffer.allocUnsafe(json.byteLength + 4);
3464
+ const result = Buffer.allocUnsafe(json.byteLength + HOST_PRODUCER_FRAME_LENGTH_BYTES);
3452
3465
  result.writeUInt32BE(json.byteLength, 0);
3453
- json.copy(result, 4);
3466
+ json.copy(result, HOST_PRODUCER_FRAME_LENGTH_BYTES);
3454
3467
  return result;
3455
3468
  }
3456
3469
  function decodeHostProducerFrame(input) {
3457
- if (input.byteLength < 4) throw new HostProducerFrameError("frame_truncated", `frame_truncated: ${refusalFact("frame_bytes", input.byteLength, "at least 4")}`);
3470
+ if (input.byteLength < HOST_PRODUCER_FRAME_LENGTH_BYTES) throw new HostProducerFrameError("frame_truncated", `frame_truncated: ${refusalFact("frame_bytes", input.byteLength, `at least ${HOST_PRODUCER_FRAME_LENGTH_BYTES}`)}`);
3458
3471
  const length = input.readUInt32BE(0);
3459
3472
  if (length > HOST_PRODUCER_MAX_JSON_BYTES) throw new HostProducerFrameError("frame_too_large", `frame_too_large: ${refusalFact("declared_bytes", length, `at most ${HOST_PRODUCER_MAX_JSON_BYTES}`)}`);
3460
3473
  if (length === 0) throw new HostProducerFrameError("invalid_frame_length");
3461
- if (input.byteLength !== length + 4) throw new HostProducerFrameError(input.byteLength < length + 4 ? "frame_truncated" : "invalid_frame_length");
3462
- const bytes = input.subarray(4);
3474
+ if (input.byteLength !== length + HOST_PRODUCER_FRAME_LENGTH_BYTES) throw new HostProducerFrameError(input.byteLength < length + HOST_PRODUCER_FRAME_LENGTH_BYTES ? "frame_truncated" : "invalid_frame_length");
3475
+ const bytes = input.subarray(HOST_PRODUCER_FRAME_LENGTH_BYTES);
3463
3476
  const text = new TextDecoder("utf-8", { fatal: true });
3464
3477
  let value;
3465
3478
  try {
@@ -3680,6 +3693,8 @@ var HOST_RELAY_REQUEST_BINDING_KEYS = Object.freeze([
3680
3693
  "host_input_ref"
3681
3694
  ]);
3682
3695
  var HOST_RELAY_IPC_RESPONSE_SCHEMA = "ceal.host_relay_admission.v1";
3696
+ var HOST_RELAY_IPC_LENGTH_BYTES = Uint32Array.BYTES_PER_ELEMENT;
3697
+ var HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES = 4096;
3683
3698
  var HostRelayIpcError = class extends Error {
3684
3699
  code;
3685
3700
  constructor(code3, message = code3) {
@@ -3733,12 +3748,12 @@ function exchange(endpoint, encoded, timeoutMs, decode) {
3733
3748
  });
3734
3749
  }
3735
3750
  function decodeHostRelayIpcResponse(input) {
3736
- if (input.length < 4) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response is truncated: ${refusalFact("response_bytes", input.byteLength, "at least 4")}.`);
3751
+ if (input.length < HOST_RELAY_IPC_LENGTH_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response is truncated: ${refusalFact("response_bytes", input.byteLength, `at least ${HOST_RELAY_IPC_LENGTH_BYTES}`)}.`);
3737
3752
  const length = input.readUInt32BE(0);
3738
- if (length === 0 || length > 4096 || input.length !== length + 4) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFacts([{ name: "declared_bytes", value: length, expected: "between 1 and 4096" }, { name: "received_bytes", value: input.byteLength, expected: `exactly ${length + 4}` }])}.`);
3753
+ if (length === 0 || length > HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES || input.length !== length + HOST_RELAY_IPC_LENGTH_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFacts([{ name: "declared_bytes", value: length, expected: `between 1 and ${HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES}` }, { name: "received_bytes", value: input.byteLength, expected: `exactly ${length + HOST_RELAY_IPC_LENGTH_BYTES}` }])}.`);
3739
3754
  let value;
3740
3755
  try {
3741
- value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(input.subarray(4)));
3756
+ value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(input.subarray(HOST_RELAY_IPC_LENGTH_BYTES)));
3742
3757
  } catch {
3743
3758
  throw new HostRelayIpcError("relay_unavailable", "Host Relay IPC response is invalid.");
3744
3759
  }
@@ -3761,11 +3776,11 @@ function record2(value) {
3761
3776
  return value !== null && typeof value === "object" && !Array.isArray(value);
3762
3777
  }
3763
3778
  function decodeResponseBuffer(buffer) {
3764
- if (buffer.length < 4) return null;
3779
+ if (buffer.length < HOST_RELAY_IPC_LENGTH_BYTES) return null;
3765
3780
  const length = buffer.readUInt32BE(0);
3766
- if (length === 0 || length > 4096) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFact("declared_bytes", length, "between 1 and 4096")}.`);
3767
- if (buffer.length < length + 4) return null;
3768
- if (buffer.length !== length + 4) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC returned trailing bytes: ${refusalFacts([{ name: "declared_bytes", value: length, expected: "the received message length minus 4" }, { name: "received_bytes", value: buffer.byteLength, expected: `exactly ${length + 4}` }])}.`);
3781
+ if (length === 0 || length > HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC response length is invalid: ${refusalFact("declared_bytes", length, `between 1 and ${HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES}`)}.`);
3782
+ if (buffer.length < length + HOST_RELAY_IPC_LENGTH_BYTES) return null;
3783
+ if (buffer.length !== length + HOST_RELAY_IPC_LENGTH_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC returned trailing bytes: ${refusalFacts([{ name: "declared_bytes", value: length, expected: `the received message length minus ${HOST_RELAY_IPC_LENGTH_BYTES}` }, { name: "received_bytes", value: buffer.byteLength, expected: `exactly ${length + HOST_RELAY_IPC_LENGTH_BYTES}` }])}.`);
3769
3784
  return decodeHostRelayIpcResponse(buffer);
3770
3785
  }
3771
3786
 
@@ -4251,6 +4266,7 @@ function isRecord2(value) {
4251
4266
 
4252
4267
  // host/codex/src/codex-outbox.ts
4253
4268
  var SAFE_REF6 = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;
4269
+ var CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS = 4096;
4254
4270
  var CodexOutboxStore = class {
4255
4271
  directory;
4256
4272
  entriesDirectory;
@@ -4617,13 +4633,13 @@ function validateRegistration(value) {
4617
4633
  }
4618
4634
  function validateRegistrationFields(value) {
4619
4635
  if (![value.host_source_ref, value.host_session_ref, value.codex_session_id].every((candidate) => typeof candidate === "string" && SAFE_REF6.test(candidate))) throw storageError(`Codex transcript registration references are malformed (${refusalFacts([{ name: "host_source_ref", value: value.host_source_ref }, { name: "host_session_ref", value: value.host_session_ref }, { name: "codex_session_id", value: value.codex_session_id }])}).`);
4620
- if (!validRegistrationCwd(value.cwd)) throw storageError(`Codex transcript registration working directory is malformed (${refusalFact("cwd_characters", typeof value.cwd === "string" ? value.cwd.length : 0, "an absolute path of at most 4096 characters")}).`);
4636
+ if (!validRegistrationCwd(value.cwd)) throw storageError(`Codex transcript registration working directory is malformed (${refusalFact("cwd_characters", typeof value.cwd === "string" ? value.cwd.length : 0, `an absolute path of at most ${CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS} characters`)}).`);
4621
4637
  if (typeof value.transcript_path !== "string") throw storageError(`Codex transcript registration path is malformed (${refusalFact("kind", typeof value.transcript_path, "string")}).`);
4622
- if (value.transcript_path.length === 0 || value.transcript_path.length > 4096) throw storageError(`Codex transcript registration path is malformed (${refusalFact("characters", value.transcript_path.length, "from 1 through 4096")}).`);
4638
+ if (value.transcript_path.length === 0 || value.transcript_path.length > CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS) throw storageError(`Codex transcript registration path is malformed (${refusalFact("characters", value.transcript_path.length, `from 1 through ${CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS}`)}).`);
4623
4639
  if (!isTimestamp(value.registered_at) || !isTimestamp(value.expires_at)) throw storageError(`Codex transcript registration timestamps are malformed (${refusalFacts([{ name: "registered_at", value: value.registered_at }, { name: "expires_at", value: value.expires_at }])}).`);
4624
4640
  }
4625
4641
  function validRegistrationCwd(value) {
4626
- return value === void 0 || typeof value === "string" && isAbsolute(value) && value.length <= 4096 && !value.includes("\0");
4642
+ return value === void 0 || typeof value === "string" && isAbsolute(value) && value.length <= CODEX_TRANSCRIPT_PATH_MAX_CHARACTERS && !value.includes("\0");
4627
4643
  }
4628
4644
  function validateCursor(value) {
4629
4645
  if (!isRecord3(value)) throw storageError("Codex transcript cursor is malformed.");
@@ -5978,6 +5994,8 @@ var HOST_REGISTRATION_STATE_KEYS = Object.freeze([
5978
5994
 
5979
5995
  // host/relay/src/host-relay-runtime.ts
5980
5996
  var HOST_RELAY_CONFIG_SCHEMA = "ceal.host_relay_config.v1";
5997
+ var HOST_RELAY_CONFIG_MIN_BYTES = Buffer.byteLength("{}", "utf8");
5998
+ var HOST_RELAY_CONFIG_MAX_BYTES = 65536;
5981
5999
  var HostRelayConfigError = class extends Error {
5982
6000
  name = "HostRelayConfigError";
5983
6001
  code;
@@ -5994,7 +6012,7 @@ async function readHostRelayConfig(path) {
5994
6012
  handle = await open6(path, O_RDONLY4 | O_NOFOLLOW3);
5995
6013
  const stats = await handle.stat();
5996
6014
  if (!stats.isFile() || !ownerPrivate2(stats)) throw new HostRelayConfigError("config_not_private", "Host Relay config file is not owner-private.");
5997
- if (stats.size < 2 || stats.size > 65536) throw new HostRelayConfigError("invalid_config", `invalid_config: Host Relay config size is invalid: ${refusalFact("config_bytes", stats.size, "between 2 and 65536")}.`);
6015
+ if (stats.size < HOST_RELAY_CONFIG_MIN_BYTES || stats.size > HOST_RELAY_CONFIG_MAX_BYTES) throw new HostRelayConfigError("invalid_config", `invalid_config: Host Relay config size is invalid: ${refusalFact("config_bytes", stats.size, `between ${HOST_RELAY_CONFIG_MIN_BYTES} and ${HOST_RELAY_CONFIG_MAX_BYTES}`)}.`);
5998
6016
  const text = await handle.readFile("utf8");
5999
6017
  assertNoDuplicateJsonKeys(text);
6000
6018
  let value;
@@ -6067,7 +6085,7 @@ function exactOptionalKeys(value, required, optional) {
6067
6085
  // host/lifecycle/src/host-runtime-hooks.ts
6068
6086
  import { lstat as lstat8 } from "node:fs/promises";
6069
6087
  import { homedir as homedir4 } from "node:os";
6070
- import { dirname as dirname7, join as join11 } from "node:path";
6088
+ import { basename as basename3, dirname as dirname7, join as join11 } from "node:path";
6071
6089
 
6072
6090
  // host/hook-drift-policy.ts
6073
6091
  var REINSTALL_REPAIRS_PREFIX = ["owned_hook_drifted:"];
@@ -6452,6 +6470,7 @@ import { copyFile as copyFile2, lstat as lstat7, mkdir as mkdir8, open as open8,
6452
6470
  import { homedir as homedir3 } from "node:os";
6453
6471
  import { basename as basename2, dirname as dirname6, isAbsolute as isAbsolute4, join as join9 } from "node:path";
6454
6472
  import { fileURLToPath } from "node:url";
6473
+ var CODEX_HOOK_COMMAND_MAX_CHARACTERS = 4096;
6455
6474
  function codexHooksInstalled(doctor) {
6456
6475
  return doctor.status === "ready" || doctor.status === "installed";
6457
6476
  }
@@ -6704,7 +6723,7 @@ function validateHookHandler(entry) {
6704
6723
  }
6705
6724
  function validateCommandHookHandler(entry) {
6706
6725
  if (typeof entry.command !== "string") throw configurationError(`Codex hook command is malformed (${refusalFact("kind", typeof entry.command, "string")}).`);
6707
- if (entry.command.length === 0 || entry.command.length > 4096) throw configurationError(`Codex hook command is malformed (${refusalFact("characters", entry.command.length, "from 1 through 4096")}).`);
6726
+ if (entry.command.length === 0 || entry.command.length > CODEX_HOOK_COMMAND_MAX_CHARACTERS) throw configurationError(`Codex hook command is malformed (${refusalFact("characters", entry.command.length, `from 1 through ${CODEX_HOOK_COMMAND_MAX_CHARACTERS}`)}).`);
6708
6727
  validateOptionalString(entry.commandWindows, "Codex hook commandWindows is malformed.");
6709
6728
  validateOptionalInteger(entry.timeout, 1, "Codex hook timeout is malformed.");
6710
6729
  validateOptionalBoolean(entry.async, "Codex hook async flag is malformed.");
@@ -7306,13 +7325,17 @@ function claudeLocalCapabilityPath(claudeHome) {
7306
7325
  async function assertRegularRuntimeFile(path, executable) {
7307
7326
  let info;
7308
7327
  const platform = process.platform;
7328
+ const module2 = basename3(path);
7309
7329
  try {
7310
7330
  info = await lstat8(path);
7311
- } catch (error) {
7312
- throw new Error(`The installed Host private runtime is unavailable (${refusalFact("error", error)}).`);
7331
+ } catch {
7332
+ throw runtimeUnavailable(`missing_module:${module2}`);
7313
7333
  }
7314
- if (!info.isFile() || info.isSymbolicLink()) throw new Error(`The installed Host private runtime is unavailable (${refusalFact("mode", `0o${info.mode.toString(8)}`, "a regular-file mode (0o100xxx)")}).`);
7315
- if (executable && platform !== "win32" && (info.mode & 73) === 0) throw new Error(`The installed Host private runtime is unavailable (${refusalFacts([{ name: "mode", value: `0o${info.mode.toString(8)}`, expected: "at least one execute bit" }, { name: "platform", value: platform, expected: "win32, where the execute bit is not required" }])}).`);
7334
+ if (!info.isFile() || info.isSymbolicLink()) throw runtimeUnavailable(`irregular_module:${module2}`);
7335
+ if (executable && platform !== "win32" && (info.mode & 73) === 0) throw runtimeUnavailable(`non_executable_module:${module2}`);
7336
+ }
7337
+ function runtimeUnavailable(reason) {
7338
+ return new HostRuntimeReasonedError("private_runtime_unavailable", [reason]);
7316
7339
  }
7317
7340
  function selectedProducers(selection) {
7318
7341
  return selection.components.filter(isHostBundleProducer);
@@ -7323,7 +7346,7 @@ import { execFile } from "node:child_process";
7323
7346
  import { constants as constants3 } from "node:fs";
7324
7347
  import { chmod as chmod2, lstat as lstat9, mkdir as mkdir9, open as open9, rename as rename8, unlink as unlink5 } from "node:fs/promises";
7325
7348
  import { homedir as homedir5 } from "node:os";
7326
- import { basename as basename3, dirname as dirname8, join as join12 } from "node:path";
7349
+ import { basename as basename4, dirname as dirname8, join as join12 } from "node:path";
7327
7350
  import { promisify } from "node:util";
7328
7351
  import { createHash as createHash7 } from "node:crypto";
7329
7352
 
@@ -7601,7 +7624,7 @@ async function readManagedPlist(path, marker, uid) {
7601
7624
  async function writeManagedPlist(path, marker, text, uid) {
7602
7625
  const current = await readManagedPlist(path, marker, uid);
7603
7626
  if (current === text) return;
7604
- const temporary = join12(dirname8(path), `.${basename3(path)}.${process.pid}.${createHash7("sha256").update(`${Date.now()}:${Math.random()}`).digest("hex").slice(0, 12)}.tmp`);
7627
+ const temporary = join12(dirname8(path), `.${basename4(path)}.${process.pid}.${createHash7("sha256").update(`${Date.now()}:${Math.random()}`).digest("hex").slice(0, 12)}.tmp`);
7605
7628
  try {
7606
7629
  const handle = await open9(temporary, "wx", 384);
7607
7630
  try {
@@ -8227,6 +8250,7 @@ function projectionError(detail) {
8227
8250
  // host/lifecycle/src/host-runtime-composition.ts
8228
8251
  var execFileAsync2 = promisify2(execFile2);
8229
8252
  var STATE_ROOT_ENVIRONMENT = "CEAL_HOST_STATE_ROOT";
8253
+ var HOST_STATE_ROOT_MAX_CHARACTERS = 4096;
8230
8254
  var InstalledHostRuntimeCompositionError = class extends Error {
8231
8255
  code;
8232
8256
  constructor(code3, message) {
@@ -8407,7 +8431,7 @@ function processFailure(error) {
8407
8431
  function resolveStateRoot(environment, platform) {
8408
8432
  const value = environment[STATE_ROOT_ENVIRONMENT];
8409
8433
  const path = platform === "win32" ? win324 : posix3;
8410
- if (value === void 0 || value.length === 0 || value.length > 4096 || value.includes("\0") || !path.isAbsolute(value) || path.normalize(value) !== value || path.parse(value).root === value) throw new InstalledHostRuntimeCompositionError("state_root_unavailable", `The Go-owned Host state root is unavailable (${refusalFact("state_root", value, "a normalized absolute non-root path of at most 4096 characters")}).`);
8434
+ if (value === void 0 || value.length === 0 || value.length > HOST_STATE_ROOT_MAX_CHARACTERS || value.includes("\0") || !path.isAbsolute(value) || path.normalize(value) !== value || path.parse(value).root === value) throw new InstalledHostRuntimeCompositionError("state_root_unavailable", `The Go-owned Host state root is unavailable (${refusalFact("state_root", value, `a normalized absolute non-root path of at most ${HOST_STATE_ROOT_MAX_CHARACTERS} characters`)}).`);
8411
8435
  return value;
8412
8436
  }
8413
8437
  function prefixFromPaths(paths, platform) {