@corca-org/ceal-host-win32-x64 1.0.23 → 1.0.25

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.
@@ -88,7 +88,7 @@ var client_wire_contract_default = {
88
88
  },
89
89
  command_request: {
90
90
  schema_name: "ceal.command_request",
91
- fields: ["schema_version", "argv", "operation", "client_nonce", "context_token", "request_context"],
91
+ fields: ["schema_version", "argv", "operation", "client_nonce", "context_token", "request_context", "materialize_result"],
92
92
  absolute_transport_max_bytes: 65536
93
93
  },
94
94
  command_resolution: {
@@ -134,7 +134,7 @@ var client_wire_contract_default = {
134
134
  },
135
135
  command_response: {
136
136
  schema_name: "ceal.command_response",
137
- fields: ["schema_version", "exit_code", "document", "operation_id", "visible_output_max_bytes", "local_delivery", "verified_artifact", "request_context"],
137
+ fields: ["schema_version", "exit_code", "document", "operation_id", "visible_output_max_bytes", "local_delivery", "verified_artifact", "request_context", "result_file"],
138
138
  descriptor_field: "verified_artifact",
139
139
  request_context_field: "request_context",
140
140
  required_fields: [
@@ -147,7 +147,8 @@ var client_wire_contract_default = {
147
147
  "visible_output_max_bytes",
148
148
  "local_delivery",
149
149
  "verified_artifact",
150
- "request_context"
150
+ "request_context",
151
+ "result_file"
151
152
  ],
152
153
  bare_document_fields: [
153
154
  "invocation",
@@ -276,6 +277,12 @@ var CALLER_RECOVERABLE_NEXT_ACTION_VALUES = [
276
277
  // (never connected, revoked, or expired). The caller runs that exact
277
278
  // Operation, completes the consent it hands back, and retries the same call.
278
279
  "connect_personal_account",
280
+ // The refusal names the caller's own preferences update step: the read
281
+ // needs a personal connection the caller holds but has not selected in
282
+ // Ceal preferences, or has not confirmed through the initial review. The
283
+ // caller reads personal.preferences.get, runs personal.preferences.update
284
+ // at the current revision to select it, and retries the same call.
285
+ "update_personal_preferences",
279
286
  // The provider or Gateway named a bounded wait; the caller waits that long
280
287
  // and submits the same read again.
281
288
  "retry_after",
@@ -416,6 +423,9 @@ var CEAL_OPERATION_READINESS_VALUES = vocabulary(["ready", "degraded", "unavaila
416
423
  var CEAL_TARGET_REQUIREMENTS = vocabulary(["required", "optional", "none"]);
417
424
  var CEAL_AUDIT_OUTCOMES = vocabulary(["succeeded", "denied", "failed"]);
418
425
  var CEAL_GATEWAY_PROVIDER_STEP_OUTCOMES = vocabulary(["completed", "rejected", "throttled", "failed"]);
426
+ var CEAL_GATEWAY_CORPUS_READ_PROVIDERS = vocabulary(["slack", "google_drive", "notion"]);
427
+ var CEAL_GATEWAY_CORPUS_READ_OUTCOMES = vocabulary(["answered_from_corpus", "live_fallback"]);
428
+ var CEAL_GATEWAY_CORPUS_READ_FALLBACK_REASONS = vocabulary(["uncovered_window", "stale", "not_organization_public", "partition_missing"]);
419
429
  var CEAL_GATEWAY_READ_REUSE_DISPOSITIONS = vocabulary(["response_cache_hit", "corpus_hit", "corpus_hit_after_revalidation", "corpus_partial_provider_supplement", "provider_direct", "provider_continuation", "reuse_unavailable"]);
420
430
  var CEAL_GATEWAY_READ_REUSE_UNAVAILABLE_REASONS = vocabulary(["not_reported", "storage_unavailable", "coverage_incomplete", "freshness_refresh_required", "not_reusable", "bypassed"]);
421
431
  var CEAL_GATEWAY_DERIVED_STORE_FAILURE_CLASSES = vocabulary(["storage_unavailable", "decode_mismatch", "write_conflict", "quota", "store_error"]);
@@ -456,6 +466,21 @@ var CEAL_GATEWAY_ORGANIZATION_ROUTE_FACT_CALL_KEYS = Object.freeze([
456
466
  ]);
457
467
 
458
468
  // packages/ceal-client-protocol/src/gateway-validation-primitives.ts
469
+ var POSIX_HOME_ROOTS = [["/", "home"].join(""), ["/", "Users"].join("")];
470
+ var WINDOWS_HOME_ROOT = ["C:", "\\", "Users"].join("");
471
+ var USER_SEGMENT_BODY = "[^/\\\\ \\t\\r\\n\"'`${}]+";
472
+ var POSIX_SEGMENT_END = "(?:/|$|(?=[\\s\"'`]))";
473
+ var WINDOWS_SEGMENT_END = "(?:\\\\+|$|(?=[\\s\"'`]))";
474
+ var WINDOWS_USER_SEGMENT_BODY = "[^\\\\ \\t\\r\\n\"'`${}]+";
475
+ var ABSOLUTE_PATH_BOUNDARY = "(?<![A-Za-z0-9_])";
476
+ function escapePathPattern(value) {
477
+ return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
478
+ }
479
+ function machineHomePathPatterns(flags) {
480
+ const posix4 = `${ABSOLUTE_PATH_BOUNDARY}(?:${POSIX_HOME_ROOTS.map(escapePathPattern).join("|")})/${USER_SEGMENT_BODY}${POSIX_SEGMENT_END}`;
481
+ const windows = `${ABSOLUTE_PATH_BOUNDARY}${escapePathPattern(WINDOWS_HOME_ROOT)}\\\\+${WINDOWS_USER_SEGMENT_BODY}${WINDOWS_SEGMENT_END}`;
482
+ return [new RegExp(posix4, flags), new RegExp(windows, flags)];
483
+ }
459
484
  var CealProtocolValidationError = class extends Error {
460
485
  name = "CealProtocolValidationError";
461
486
  code;
@@ -804,10 +829,13 @@ var LOCAL_COMMAND_INVALID = "The local command or argument is invalid.";
804
829
  var LOCAL_TRANSPORT_INCOMPLETE = "The local Ceal transport could not complete; report this as a gap.";
805
830
  var GATEWAY_TRANSPORT_UNAVAILABLE = "The Gateway transport is unavailable; ask an administrator to restore Gateway availability.";
806
831
  var HOST_AUTHENTICATION_UNAVAILABLE = "The Host could not authenticate this invocation; report this as a gap.";
807
- var CLIENT_HOST_RELEASE_MISMATCH = "Install or upgrade the Ceal CLI and Host Relay to the same release as the Gateway, then retry.";
832
+ var CEAL_CLIENT_UPGRADE_COMMAND = "npm install -g @corca-org/ceal";
833
+ var CLIENT_HOST_RELEASE_MISMATCH = `Install or upgrade the Ceal CLI and Host Relay to the same release as the Gateway, then retry. Update with \`${CEAL_CLIENT_UPGRADE_COMMAND}\`.`;
808
834
  var HOST_INSTALL_REPAIR = "The local Host or Relay is missing, stale, or unavailable. Run `ceal-host install`, then `ceal-host discovery sync`, and retry from a new producer conversation.";
809
- var HOST_CONTEXT_UNAVAILABLE = "The Host could not select this turn; reason uncertain. Host mode is unavailable in an ephemeral side conversation. When you know you are in one, `ceal --standalone ...` uses your configured Ceal session/Gateway permissions, without Host session/turn correlation or Host usage attribution. Unknown-outcome `repeat_request` needs the same Host turn or explicit `--request-context`. Otherwise return to the original regular conversation. Host refusal never switches modes; report intended Host calls as a gap.";
835
+ var HOST_CONTEXT_UNAVAILABLE = "The Host could not select this turn right now; the Host may be restarting. Wait briefly and retry the same command. If you know you are in an ephemeral side conversation, `ceal --standalone ...` uses your configured Ceal session/Gateway permissions without Host session/turn correlation. Otherwise return to the original regular conversation. Host refusal never switches modes. If the retry still fails, report intended Host calls as a gap.";
836
+ var HOST_RELAY_RESTARTING = "The Host Relay is temporarily unavailable while the Host restarts; wait briefly and retry the same command. If the retry still fails, report this as a gap.";
810
837
  var SESSION_CONTEXT_UNAVAILABLE = "The local Gateway session context is unavailable.";
838
+ var SESSION_ADOPT_RECOVERY = "The refresh Session is no longer usable. Run `ceal session adopt --gateway <origin> --email <email>` to complete mailbox-confirmed recovery.";
811
839
  function guidance(message, next_action, http_status, retryable = false, redaction_class = "model_safe") {
812
840
  return Object.freeze({ message, next_action, http_status, retryable, redaction_class });
813
841
  }
@@ -828,13 +856,21 @@ var CEAL_FAILURE_GUIDANCE_TABLE = Object.freeze({
828
856
  context_not_selected: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
829
857
  context_store_invalid: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
830
858
  context_store_conflict: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
831
- refresh_invalid: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
832
- refresh_expired: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
833
- refresh_replayed: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
834
- refresh_revoked: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
835
- person_inactive: guidance("The Person is inactive, so the Gateway refused this refresh without revoking the Session family.", "ask_admin", 403),
836
- principal_inactive: guidance("The Principal is inactive, so the Gateway refused this refresh without revoking the Session family.", "ask_admin", 403),
837
- refresh_recovery_unavailable: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
859
+ refresh_invalid: guidance(SESSION_ADOPT_RECOVERY, "repair_or_adopt_session", 401),
860
+ refresh_expired: guidance(SESSION_ADOPT_RECOVERY, "repair_or_adopt_session", 401),
861
+ refresh_replayed: guidance(SESSION_ADOPT_RECOVERY, "repair_or_adopt_session", 401),
862
+ refresh_revoked: guidance(SESSION_ADOPT_RECOVERY, "repair_or_adopt_session", 401),
863
+ person_inactive: guidance("The Person is inactive, so the Gateway refused this refresh without revoking the Session family. Ask an Admin to reactivate the Person, then retry this same session refresh.", "ask_admin", 403),
864
+ principal_inactive: guidance("The Principal is inactive, so the Gateway refused this refresh without revoking the Session family. Ask an Admin to reactivate the Principal, then retry this same session refresh.", "ask_admin", 403),
865
+ authority_replaced: guidance("The Gateway authority has been replaced; this session is no longer valid here. Run `ceal session adopt --gateway <origin> --email <email>` against the current Gateway to complete mailbox-confirmed recovery.", "repair_or_adopt_session", 409),
866
+ // A stored session that predates the authority-epoch commitment carries no
867
+ // epoch to compare, so it can never refresh: adopt a fresh session instead.
868
+ authority_epoch_unknown: guidance(SESSION_ADOPT_RECOVERY, "repair_or_adopt_session", 401),
869
+ refresh_inactive: guidance(SESSION_ADOPT_RECOVERY, "repair_or_adopt_session", 410),
870
+ refresh_recovery_unavailable: guidance("The Gateway's durable refresh-recovery key is unavailable. Retry the same refresh attempt after the key is available.", "retry", 503, true),
871
+ refresh_recovery_outcome_unavailable: guidance("The Gateway could not safely recover the outcome of a prior refresh. Ask an administrator to inspect the Gateway session state before retrying or adopting this session.", "ask_admin", 503),
872
+ refresh_state_unavailable: guidance("The Gateway session state store is temporarily unavailable; retry the same refresh attempt when it is available.", "retry", 503, true),
873
+ refresh_recovery_expired: guidance(SESSION_ADOPT_RECOVERY, "repair_or_adopt_session", 410),
838
874
  refresh_custody_invalid: guidance(SESSION_CONTEXT_UNAVAILABLE, "repair_or_adopt_session", 401),
839
875
  session_store_unwritable: guidance("The Ceal client could not write its local session store; the operating system refused the write (EACCES, EPERM, or EROFS). rerun_outside_agent_sandbox reruns it with escalated execution.", "rerun_outside_agent_sandbox", 500),
840
876
  local_output_exists: guidance("The selected local output path already exists; nothing was written to it.", "choose_new_output_path", 400),
@@ -849,10 +885,8 @@ var CEAL_FAILURE_GUIDANCE_TABLE = Object.freeze({
849
885
  resource_stream_failed: guidance("The provider resource stream failed; ask an administrator to inspect the Gateway failure log.", "ask_admin", 500),
850
886
  gateway_unavailable: guidance(GATEWAY_TRANSPORT_UNAVAILABLE, "ask_admin", 503, true),
851
887
  contract_mismatch: guidance(CLIENT_HOST_RELEASE_MISMATCH, "upgrade_ceal_client", 409),
852
- // `gateway_starting` is the one retryable envelope the serving gate answers on every route while starting
853
- // (`cli/internal/client/gateway_startup_wait.go` re-drives it); the sentence is the client default that renders
854
- // when the wait ends still unserved, moved from the `localFailureText` default branch.
855
- [CEAL_GATEWAY_STARTING_FAILURE_CODE]: guidance(LOCAL_TRANSPORT_INCOMPLETE, "answer_with_gap", 503, true),
888
+ // The serving gate answers before refresh execution, so retrying the same attempt is safe.
889
+ [CEAL_GATEWAY_STARTING_FAILURE_CODE]: guidance("The Gateway is still starting; the refresh was not attempted and the refresh token was not consumed. Retry the same refresh attempt after the Gateway is serving.", "retry", 503, true),
856
890
  gateway_internal_error: guidance("The Gateway failed without exposing internal state; report this as a gap.", "answer_with_gap", 500),
857
891
  // The serving gate emits this code with no message; the sentence is the owner-normalized form of the
858
892
  // `gateway_internal_error` guidance (decided with the operator 2026-10-13).
@@ -864,6 +898,8 @@ var CEAL_FAILURE_GUIDANCE_TABLE = Object.freeze({
864
898
  // The safe move varies by request. Keep the sentence conditional on the
865
899
  // same `retryable` and `next_action` facts the response exposes.
866
900
  unknown_outcome: guidance("The transport outcome is unknown; use retryable and next_action to decide whether it can be repeated.", "answer_with_gap", 500),
901
+ // A provider write the Gateway command deadline cut after its dispatch: the write left and its receipt is still settling, so the caller reads the receipt instead of repeating the write.
902
+ write_in_progress: guidance("The provider write was dispatched but the Gateway command deadline cut the wait before its outcome settled. Do not repeat the write; read the durable receipt named by write_request_ref with write_receipt.get.", "write_receipt.get", 500),
867
903
  // Restored verbatim from the retired `localFailureText`
868
904
  // `refresh_unknown_outcome` case: a refresh that ends unknown leaves the
869
905
  // session context unavailable, so the caller repairs or adopts the
@@ -954,7 +990,7 @@ var CEAL_FAILURE_GUIDANCE_TABLE = Object.freeze({
954
990
  host_session_unavailable: guidance(HOST_AUTHENTICATION_UNAVAILABLE, "answer_with_gap", 401),
955
991
  // The bounded Host reason does not prove ephemerality. A Host refusal never
956
992
  // changes mode; standalone remains the separate Client authority path.
957
- host_context_unavailable: guidance(HOST_CONTEXT_UNAVAILABLE, "answer_with_gap", 401),
993
+ host_context_unavailable: guidance(HOST_CONTEXT_UNAVAILABLE, "retry", 401, true),
958
994
  host_context_activation_wait_exhausted: guidance("The Host selected this turn, but its invocation context did not activate before the bounded wait ended. Wait for the supplied retry_after_ms value, then retry the same command.", "retry_after", 401, true),
959
995
  host_invocation_context_stale: guidance("The Host turn changed while this invocation was authenticating. Its command cannot be rebound safely; report this invocation as a gap.", "answer_with_gap", 401),
960
996
  host_invocation_context_expired: guidance("The Host invocation context expired before authentication completed. This invocation cannot be retried in the expired turn; report it as a gap.", "answer_with_gap", 401),
@@ -971,7 +1007,7 @@ var CEAL_FAILURE_GUIDANCE_TABLE = Object.freeze({
971
1007
  // Moved from the retired `CEAL_HOST_AUTHENTICATION_POLICY` remedy: the
972
1008
  // sandboxed Relay socket names the run-alone retry.
973
1009
  host_relay_permission_denied: guidance("An agent sandbox denied the Host Relay socket; run `ceal` as the only command, with no pipe, redirect, or `&&`, so the Host allow rule runs it outside the sandbox.", "rerun_outside_agent_sandbox", 403),
974
- host_relay_unavailable: guidance(HOST_AUTHENTICATION_UNAVAILABLE, "answer_with_gap", 503),
1010
+ host_relay_unavailable: guidance(HOST_RELAY_RESTARTING, "retry", 503, true),
975
1011
  host_mint_transient_retryable: guidance(HOST_AUTHENTICATION_UNAVAILABLE, "retry", 503, true),
976
1012
  host_mint_failed: guidance(HOST_AUTHENTICATION_UNAVAILABLE, "answer_with_gap", 500),
977
1013
  host_relay_failed: guidance(HOST_INSTALL_REPAIR, "install_ceal_host", 502),
@@ -1229,7 +1265,7 @@ var CEAL_OPERATION_JSON_SCHEMA_BUDGET = Object.freeze({
1229
1265
  max_literal_nodes: 512
1230
1266
  });
1231
1267
 
1232
- // packages/ceal-client-protocol/src/operation-json-schema.ts
1268
+ // packages/ceal-client-protocol/src/operation-json-schema-leaf-validators.ts
1233
1269
  var JSON_DESCRIPTION_CONTROL_CHARACTER = new RegExp("\\p{Cc}", "u");
1234
1270
 
1235
1271
  // packages/ceal-client-protocol/src/operation-contract-validation.ts
@@ -1383,7 +1419,8 @@ var CEAL_OPERATION_ID_PLACEHOLDER = "<operation-id>";
1383
1419
  var CEAL_OPERATION_INPUT_PLACEHOLDER = "<json-object>";
1384
1420
  var MODEL_INVOCATION_BASE_ARGUMENTS = [CEAL_OPERATION_INVOKE_COMMAND, CEAL_OPERATION_ID_PLACEHOLDER].join(" ");
1385
1421
  var CEAL_MODEL_INVOCATION_ARGUMENTS = [MODEL_INVOCATION_BASE_ARGUMENTS, CEAL_OPERATION_INPUT_FLAG, shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)].join(" ");
1386
- var CEAL_MODEL_INPUT_SOURCE_GUIDANCE = `For caller-owned fields, add ${CEAL_OPERATION_INPUT_FLAG} ${shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)}. Use inline JSON for short input; for longer or generated input, put exactly one JSON object in a caller-owned regular non-symlink UTF-8 JSON file and pass --input @path; relative paths resolve from the command working directory.`;
1422
+ var CEAL_MODEL_INPUT_SOURCE_BASE_GUIDANCE = `For caller-owned fields, add ${CEAL_OPERATION_INPUT_FLAG} ${shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)}. Use inline JSON for short input; for longer or generated input, put exactly one JSON object in a caller-owned regular non-symlink UTF-8 JSON file and pass --input @path; relative paths resolve from the command working directory.`;
1423
+ var CEAL_MODEL_INPUT_SOURCE_GUIDANCE = `${CEAL_MODEL_INPUT_SOURCE_BASE_GUIDANCE} On Windows, write the JSON file first; use the program's .cmd launcher with --input and only one quoted @path argument.`;
1387
1424
  function shellSingleQuoted(value) {
1388
1425
  return `'${value.replaceAll("'", "'\\''")}'`;
1389
1426
  }
@@ -1530,6 +1567,8 @@ var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
1530
1567
  "review_submitted",
1531
1568
  "comment_created",
1532
1569
  "reaction_created",
1570
+ "pull_request_merged",
1571
+ "release_published",
1533
1572
  "ceal_write_completed",
1534
1573
  "event_start",
1535
1574
  "all_day_start",
@@ -1541,7 +1580,7 @@ var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
1541
1580
  "page_last_edited",
1542
1581
  "resource_modified"
1543
1582
  ]);
1544
- var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
1583
+ var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "google-mail", "notion"]);
1545
1584
  var CEAL_ACTIVITY_UNSUPPORTED_EVENT_KIND_CODE = "unsupported_event_kind";
1546
1585
  var CEAL_ACTIVITY_GAP_CODES = vocabulary([
1547
1586
  "provider_page_budget",
@@ -1562,6 +1601,8 @@ var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
1562
1601
  "github.pull_request.opened",
1563
1602
  "github.issue.edited",
1564
1603
  "github.pull_request.edited",
1604
+ "github.pull_request.merged",
1605
+ "github.release.published",
1565
1606
  "github.review.submitted",
1566
1607
  "github.issue_comment.created",
1567
1608
  "github.review_comment.created",
@@ -1575,6 +1616,7 @@ var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
1575
1616
  "drive.file.created",
1576
1617
  "drive.file.modified",
1577
1618
  "drive.file.viewed",
1619
+ "mail.sent",
1578
1620
  "notion.page.created",
1579
1621
  "notion.page.edited"
1580
1622
  ]);
@@ -1588,6 +1630,8 @@ var CEAL_ACTIVITY_EVENT_TIMESTAMP_BASIS_MAP = Object.freeze({
1588
1630
  "github.review_comment.created": "comment_created",
1589
1631
  "github.issue.opened": "resource_created",
1590
1632
  "github.pull_request.opened": "resource_created",
1633
+ "github.pull_request.merged": "pull_request_merged",
1634
+ "github.release.published": "release_published",
1591
1635
  "github.issue.edited": "resource_modified",
1592
1636
  "github.pull_request.edited": "resource_modified",
1593
1637
  "github.reaction.created": "reaction_created",
@@ -1598,6 +1642,7 @@ var CEAL_ACTIVITY_EVENT_TIMESTAMP_BASIS_MAP = Object.freeze({
1598
1642
  "drive.file.created": "file_created",
1599
1643
  "drive.file.modified": "file_modified_by_me",
1600
1644
  "drive.file.viewed": "file_viewed_by_me",
1645
+ "mail.sent": "message_created",
1601
1646
  "notion.page.created": "page_created",
1602
1647
  "notion.page.edited": "page_last_edited"
1603
1648
  });
@@ -1708,6 +1753,8 @@ var CEAL_REFRESH_FAILURE_CODES = vocabulary([
1708
1753
  "principal_inactive",
1709
1754
  "authority_replaced",
1710
1755
  "refresh_recovery_unavailable",
1756
+ "refresh_recovery_outcome_unavailable",
1757
+ "refresh_state_unavailable",
1711
1758
  "refresh_recovery_expired",
1712
1759
  // The serving gate answers this while the Gateway is still starting and the
1713
1760
  // refresh was never attempted; the same attempt stays retryable. It is never
@@ -2112,9 +2159,11 @@ var CEAL_HOST_AUTHENTICATION_POLICY = Object.freeze({
2112
2159
  invalid_arguments: Object.freeze({ classification: "host_arguments_invalid", next_action: "answer_with_gap" }),
2113
2160
  options_invalid: Object.freeze({ classification: "host_configuration_invalid", next_action: "answer_with_gap" }),
2114
2161
  session_unavailable: Object.freeze({ classification: "host_session_unavailable", next_action: "answer_with_gap" }),
2115
- // This reason cannot distinguish a Codex side conversation from a missing
2116
- // context in a regular session, so guidance must leave that choice to the caller.
2117
- context_unavailable: Object.freeze({ classification: "host_context_unavailable", next_action: "answer_with_gap" }),
2162
+ // A missing turn right after a Host restart clears by itself once the
2163
+ // watcher reactivates the turn, so the caller waits briefly and retries;
2164
+ // a caller that knows it is in an ephemeral side conversation keeps the
2165
+ // standalone fallback the guidance names second.
2166
+ context_unavailable: Object.freeze({ classification: "host_context_unavailable", next_action: "retry" }),
2118
2167
  activation_wait_exhausted: Object.freeze({ classification: "host_context_activation_wait_exhausted", next_action: "retry_after" }),
2119
2168
  context_replaced: Object.freeze({ classification: "host_invocation_context_stale", next_action: "answer_with_gap" }),
2120
2169
  // `no_binding` now means the producer has no real current Host session. The
@@ -2131,7 +2180,7 @@ var CEAL_HOST_AUTHENTICATION_POLICY = Object.freeze({
2131
2180
  gateway_response_invalid: Object.freeze({ classification: "host_mint_gateway_response_invalid", next_action: "answer_with_gap" }),
2132
2181
  producer_frame_invalid: Object.freeze({ classification: "host_producer_frame_invalid", next_action: "ask_admin" }),
2133
2182
  relay_permission_denied: Object.freeze({ classification: "host_relay_permission_denied", next_action: "rerun_outside_agent_sandbox" }),
2134
- relay_unavailable: Object.freeze({ classification: "host_relay_unavailable", next_action: "answer_with_gap" }),
2183
+ relay_unavailable: Object.freeze({ classification: "host_relay_unavailable", next_action: "retry" }),
2135
2184
  transient_retryable: Object.freeze({ classification: "host_mint_transient_retryable", next_action: "retry" }),
2136
2185
  mint_failed: Object.freeze({ classification: "host_mint_failed", next_action: "answer_with_gap" }),
2137
2186
  relay_failed: Object.freeze({ classification: "host_relay_failed", next_action: "install_ceal_host" }),
@@ -2236,6 +2285,9 @@ var CEAL_SUPPORTED_GATEWAY_PROTOCOL_RANGE = Object.freeze({
2236
2285
  maximum: CEAL_PROTOCOL_VERSION
2237
2286
  });
2238
2287
 
2288
+ // packages/ceal-client-protocol/src/operator-diagnostic.ts
2289
+ var OPERATOR_DIAGNOSTIC_HOME_PATHS = machineHomePathPatterns("gu");
2290
+
2239
2291
  // packages/ceal-client-protocol/src/admin-projection-vocabulary.ts
2240
2292
  var ADMIN_PROJECTION_STATES = vocabulary(["ready", "empty", "partial", "unknown"]);
2241
2293
  var ADMIN_VIEW_KINDS = vocabulary(["request_detail", "resource_access_timeline", "weekly_usage"]);
@@ -2335,14 +2387,86 @@ function errorCode(error) {
2335
2387
 
2336
2388
  // host/service-log.ts
2337
2389
  import { copyFile, mkdir, stat, truncate, appendFile } from "node:fs/promises";
2338
- import { dirname as dirname2, isAbsolute, posix, win32 as win322 } from "node:path";
2390
+ import { dirname as dirname2, isAbsolute as isAbsolute2, posix, win32 as win322 } from "node:path";
2339
2391
 
2340
2392
  // host/secure-file.ts
2341
2393
  import { execFile } from "node:child_process";
2342
2394
  import { constants } from "node:fs";
2343
2395
  import { lstat, open } from "node:fs/promises";
2344
- import { dirname, join as join2, win32 } from "node:path";
2396
+ import { dirname, join as join3, win32 } from "node:path";
2345
2397
  import { fileURLToPath } from "node:url";
2398
+
2399
+ // host/spawn-working-directory.ts
2400
+ import { mkdirSync } from "node:fs";
2401
+ import { tmpdir } from "node:os";
2402
+ import { isAbsolute, join as join2, normalize, parse, sep } from "node:path";
2403
+ function resolveCealSpawnWorkingDirectory(stateRoot, keepOutside = []) {
2404
+ const candidates = [];
2405
+ const explicit = candidateDir(stateRoot);
2406
+ if (explicit !== void 0) candidates.push(explicit);
2407
+ const fallback = defaultHostStateRoot();
2408
+ if (fallback !== void 0 && !candidates.some((candidate) => sameDir(candidate, fallback))) candidates.push(fallback);
2409
+ const temporary = candidateDir(join2(tmpdir(), "ceal-spawn-cwd"));
2410
+ if (temporary !== void 0 && !candidates.some((candidate) => sameDir(candidate, temporary))) candidates.push(temporary);
2411
+ for (const dir of candidates) {
2412
+ if (!keptOutside(dir, keepOutside)) continue;
2413
+ try {
2414
+ mkdirSync(dir, { recursive: true, mode: 448 });
2415
+ return dir;
2416
+ } catch {
2417
+ continue;
2418
+ }
2419
+ }
2420
+ return tmpdir();
2421
+ }
2422
+ function candidateDir(dir) {
2423
+ if (dir === void 0 || dir === "") return void 0;
2424
+ if (!isAbsolute(dir) || normalize(dir) !== dir || parse(dir).root === dir) return void 0;
2425
+ return normalize(dir);
2426
+ }
2427
+ function defaultHostStateRoot() {
2428
+ if (process.platform === "win32") {
2429
+ const localAppData = nonEmptyEnv("LOCALAPPDATA");
2430
+ if (localAppData === void 0) return void 0;
2431
+ return candidateDir(join2(localAppData, "Ceal", "Host"));
2432
+ }
2433
+ if (process.platform === "darwin") {
2434
+ const home2 = nonEmptyEnv("HOME");
2435
+ if (home2 === void 0) return void 0;
2436
+ return candidateDir(join2(home2, "Library", "Application Support", "Ceal", "Host"));
2437
+ }
2438
+ const xdg = nonEmptyEnv("XDG_STATE_HOME");
2439
+ if (xdg !== void 0) {
2440
+ const root = candidateDir(join2(xdg, "ceal", "host"));
2441
+ if (root !== void 0) return root;
2442
+ }
2443
+ const home = nonEmptyEnv("HOME");
2444
+ if (home === void 0) return void 0;
2445
+ return candidateDir(join2(home, ".local", "state", "ceal", "host"));
2446
+ }
2447
+ function nonEmptyEnv(name) {
2448
+ const value = process.env[name];
2449
+ return value === void 0 || value === "" ? void 0 : value;
2450
+ }
2451
+ function keptOutside(dir, keepOutside) {
2452
+ for (const tree of keepOutside) {
2453
+ const clean = candidateDir(tree);
2454
+ if (clean === void 0) continue;
2455
+ if (insideDir(dir, clean)) return false;
2456
+ }
2457
+ return true;
2458
+ }
2459
+ function insideDir(dir, tree) {
2460
+ if (sameDir(dir, tree)) return true;
2461
+ if (process.platform === "win32") return dir.toLowerCase().startsWith(tree.toLowerCase() + sep);
2462
+ return dir.startsWith(tree + sep);
2463
+ }
2464
+ function sameDir(left, right) {
2465
+ if (process.platform === "win32") return left.toLowerCase() === right.toLowerCase();
2466
+ return left === right;
2467
+ }
2468
+
2469
+ // host/secure-file.ts
2346
2470
  var SecureFileCustodyError = class extends Error {
2347
2471
  name = "SecureFileCustodyError";
2348
2472
  reason;
@@ -2442,7 +2566,7 @@ async function runSecurefsCommand(args, maxBytes, custody, stdin) {
2442
2566
  const executable = custody.securefs_executable ?? resolveInstalledHostExecutable(process.platform);
2443
2567
  const processArgs = [...custody.securefs_args_prefix ?? [], ...args];
2444
2568
  return await new Promise((resolve, reject) => {
2445
- const child = execFile(executable, processArgs, { encoding: "buffer", windowsHide: true, timeout: WINDOWS_SECUREFS_TIMEOUT_MS, maxBuffer: maxBytes + WINDOWS_SECUREFS_DIAGNOSTIC_BYTES }, (error, stdout, stderr) => {
2569
+ const child = execFile(executable, processArgs, { encoding: "buffer", windowsHide: true, timeout: WINDOWS_SECUREFS_TIMEOUT_MS, maxBuffer: maxBytes + WINDOWS_SECUREFS_DIAGNOSTIC_BYTES, cwd: resolveCealSpawnWorkingDirectory() }, (error, stdout, stderr) => {
2446
2570
  const exitCode = error === null ? 0 : typeof error.code === "number" ? error.code : null;
2447
2571
  if (exitCode === null) {
2448
2572
  reject(new SecureFileCustodyError("unavailable", "The installed Windows Host securefs command could not run."));
@@ -2471,7 +2595,7 @@ function securefsRefusal(stderr) {
2471
2595
  }
2472
2596
  function resolveInstalledHostExecutable(platform) {
2473
2597
  const privateRuntimeRoot = dirname(fileURLToPath(import.meta.url));
2474
- return platform === "win32" ? win32.join(privateRuntimeRoot, "..", "..", "bin", "ceal-host.exe") : join2(privateRuntimeRoot, "..", "..", "bin", "ceal-host");
2598
+ return platform === "win32" ? win32.join(privateRuntimeRoot, "..", "..", "bin", "ceal-host.exe") : join3(privateRuntimeRoot, "..", "..", "bin", "ceal-host");
2475
2599
  }
2476
2600
  function isRecord(value) {
2477
2601
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -2653,7 +2777,7 @@ async function rotateHostServiceLog(path, maxBytes = HOST_SERVICE_LOG_MAX_BYTES)
2653
2777
  }
2654
2778
  function boundHostServiceLog(environment = process.env) {
2655
2779
  const path = environment[HOST_SERVICE_LOG_ENVIRONMENT];
2656
- if (path === void 0 || !isAbsolute(path)) return () => void 0;
2780
+ if (path === void 0 || !isAbsolute2(path)) return () => void 0;
2657
2781
  let reported = false;
2658
2782
  const ready = ensureHostServiceLogDirectory(path);
2659
2783
  const check = () => {
@@ -2688,7 +2812,7 @@ async function persistHostServiceLogLine(line, environment = process.env) {
2688
2812
  await appendHostServiceLogLine(path, line).catch(() => void 0);
2689
2813
  }
2690
2814
  async function appendHostServiceLogLine(path, line) {
2691
- if (!isAbsolute(path)) return;
2815
+ if (!isAbsolute2(path)) return;
2692
2816
  await ensureHostServiceLogDirectory(path);
2693
2817
  await appendFile(path, line);
2694
2818
  }
@@ -2785,7 +2909,7 @@ function assertHostRelaySourcePaths(stateRoot, config, platform = process.platfo
2785
2909
  // host/relay/src/host-relay-runtime.ts
2786
2910
  import { randomUUID } from "node:crypto";
2787
2911
  import { constants as constants4 } from "node:fs";
2788
- import { dirname as dirname8, join as join7 } from "node:path";
2912
+ import { dirname as dirname8, join as join8 } from "node:path";
2789
2913
 
2790
2914
  // host/abortable-wait.ts
2791
2915
  function waitForAbort(signal, milliseconds) {
@@ -3038,7 +3162,7 @@ function exactOptional(value, required, optional) {
3038
3162
 
3039
3163
  // host/relay/src/relay-admission-store.ts
3040
3164
  import { readFile as readFile2 } from "node:fs/promises";
3041
- import { join as join4 } from "node:path";
3165
+ import { join as join5 } from "node:path";
3042
3166
 
3043
3167
  // host/relay/src/durable-atomic-replacement.ts
3044
3168
  import { lstat as lstat2, mkdir as mkdir2, open as open2, rename, unlink } from "node:fs/promises";
@@ -3174,7 +3298,7 @@ function errorCode3(error) {
3174
3298
  // host/relay/src/relay-quarantine-store.ts
3175
3299
  import { createHash as createHash5 } from "node:crypto";
3176
3300
  import { readFile } from "node:fs/promises";
3177
- import { join as join3 } from "node:path";
3301
+ import { join as join4 } from "node:path";
3178
3302
  var RELAY_QUARANTINE_SCHEMA = "ceal.host_relay_quarantine_state.v1";
3179
3303
  var RELAY_QUARANTINE_MAX_RECORDS = 512;
3180
3304
  var RELAY_QUARANTINE_MAX_BYTES = 16 * 1024 * 1024;
@@ -3228,14 +3352,14 @@ var RelayQuarantineStore = class {
3228
3352
  const records = state.producers[producerId];
3229
3353
  records.push(record6);
3230
3354
  while (records.length > this.maxRecords || totalBytes(records) > this.maxBytes) records.shift();
3231
- await durableAtomicReplace(join3(this.root, "quarantine.json"), JSON.stringify(state));
3355
+ await durableAtomicReplace(join4(this.root, "quarantine.json"), JSON.stringify(state));
3232
3356
  });
3233
3357
  this.tail = run.then(() => void 0, () => void 0);
3234
3358
  await run;
3235
3359
  }
3236
3360
  async readState() {
3237
3361
  try {
3238
- return decodeState(JSON.parse(await readFile(join3(this.root, "quarantine.json"), "utf8")));
3362
+ return decodeState(JSON.parse(await readFile(join4(this.root, "quarantine.json"), "utf8")));
3239
3363
  } catch (error) {
3240
3364
  if (errorCode4(error) === "ENOENT") return emptyState();
3241
3365
  throw error;
@@ -3300,7 +3424,7 @@ var RelayAdmissionStore = class {
3300
3424
  quarantine;
3301
3425
  limits;
3302
3426
  faultHooks;
3303
- constructor(root, limits = DEFAULT_LIMITS, faultHooks = {}, quarantine = new RelayQuarantineStore(join4(root, "quarantine"))) {
3427
+ constructor(root, limits = DEFAULT_LIMITS, faultHooks = {}, quarantine = new RelayQuarantineStore(join5(root, "quarantine"))) {
3304
3428
  this.root = root;
3305
3429
  this.quarantine = quarantine;
3306
3430
  this.limits = limits;
@@ -3412,14 +3536,14 @@ var RelayAdmissionStore = class {
3412
3536
  }
3413
3537
  async read() {
3414
3538
  try {
3415
- return decodeState2(JSON.parse(await readFile2(join4(this.root, "admission.json"), "utf8")));
3539
+ return decodeState2(JSON.parse(await readFile2(join5(this.root, "admission.json"), "utf8")));
3416
3540
  } catch (error) {
3417
3541
  if (errorCode5(error) === "ENOENT") return { schema_version: "ceal.host_relay_admission_state.v1", installations: {}, entries: [] };
3418
3542
  throw error;
3419
3543
  }
3420
3544
  }
3421
3545
  async write(state) {
3422
- await durableAtomicReplace(join4(this.root, "admission.json"), JSON.stringify(state));
3546
+ await durableAtomicReplace(join5(this.root, "admission.json"), JSON.stringify(state));
3423
3547
  }
3424
3548
  };
3425
3549
  function installationKey(frame) {
@@ -3562,7 +3686,7 @@ function poisonSequenceInRange(entryValue, installation2) {
3562
3686
  import { createHmac, randomBytes } from "node:crypto";
3563
3687
  import { constants as constants2 } from "node:fs";
3564
3688
  import { link, unlink as unlink2 } from "node:fs/promises";
3565
- import { dirname as dirname4, join as join5 } from "node:path";
3689
+ import { dirname as dirname4, join as join6 } from "node:path";
3566
3690
  var RELAY_PIPE_HANDSHAKE_TIMEOUT_MS = 5e3;
3567
3691
  var RELAY_PIPE_KEY_BYTES = 32;
3568
3692
  var RELAY_PIPE_KEY_FILENAME = "relay-pipe.key";
@@ -3582,7 +3706,7 @@ var RelayPipeHandshakeError = class extends Error {
3582
3706
  }
3583
3707
  };
3584
3708
  function relayPipeKeyPath(relayStateRoot) {
3585
- return join5(relayStateRoot, RELAY_PIPE_KEY_FILENAME);
3709
+ return join6(relayStateRoot, RELAY_PIPE_KEY_FILENAME);
3586
3710
  }
3587
3711
  async function loadRelayPipeKey(relayStateRoot, platform = process.platform, custody = {}) {
3588
3712
  const path = relayPipeKeyPath(relayStateRoot);
@@ -3972,7 +4096,7 @@ async function unlinkRelayEndpoint(endpoint) {
3972
4096
  // host/relay/src/relay-ipc.ts
3973
4097
  import { chmod, lstat as lstat4, rename as rename2, unlink as unlink4 } from "node:fs/promises";
3974
4098
  import { createConnection as createConnection2, createServer } from "node:net";
3975
- import { dirname as dirname6, join as join6 } from "node:path";
4099
+ import { dirname as dirname6, join as join7 } from "node:path";
3976
4100
  var HOST_RELAY_IPC_RESPONSE_SCHEMA = "ceal.host_relay_admission.v1";
3977
4101
  var HOST_RELAY_INVOCATION_CONTEXT_QUERY_SCHEMA = "ceal.host_relay_invocation_context_query.v2";
3978
4102
  var HOST_RELAY_INVOCATION_CONTEXT_RESULT_SCHEMA = "ceal.host_relay_invocation_context_result.v3";
@@ -4287,7 +4411,7 @@ function stagingRelayEndpoint(canonical) {
4287
4411
  const parent = dirname6(canonical);
4288
4412
  const pid = process.pid.toString(36);
4289
4413
  const sequence = (relayStagingSequence++ % (36 * 36)).toString(36);
4290
- return join6(parent, `.r${pid}${sequence}`);
4414
+ return join7(parent, `.r${pid}${sequence}`);
4291
4415
  }
4292
4416
  async function readStagingRelayEndpointIdentity(staging) {
4293
4417
  let created;
@@ -4622,7 +4746,7 @@ function reportInvocationMintLine(line) {
4622
4746
  writeHostServiceLogLine(line);
4623
4747
  }
4624
4748
  async function serveHostRelay(config, signal, dependencies) {
4625
- const admission = new RelayAdmissionStore(join7(config.state_root, "admission"));
4749
+ const admission = new RelayAdmissionStore(join8(config.state_root, "admission"));
4626
4750
  let server;
4627
4751
  try {
4628
4752
  const pipeKey = process.platform === "win32" ? await loadRelayPipeKey(config.state_root, process.platform, dependencies.custody) : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corca-org/ceal-host-win32-x64",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -3,12 +3,12 @@
3
3
  "product": "ceal-host",
4
4
  "version_source": {
5
5
  "product": "ceal-host",
6
- "version": "1.0.23"
6
+ "version": "1.0.25"
7
7
  },
8
8
  "source": {
9
9
  "repository": "corca-ai/ceal",
10
- "commit": "8dd53b15fc12b0fcb6d9a3440255d7daad8041ab",
11
- "tree": "b3e18c4870f960405c9ef03145dccf3d119502a3"
10
+ "commit": "e657cfb442e5f69f8e1e0c2a6eea82d149ee9f6f",
11
+ "tree": "a9f22b4d14a1504054b0f4f9e611be735918beeb"
12
12
  },
13
13
  "target": "windows-x64",
14
14
  "required_features": [],
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "executable": true,
21
21
  "path": "bin/ceal-host.exe",
22
- "sha256": "d9c96dc21324b9f64abe939b6e27a64f7d1e609467c5a616c9bc17dae132f68a"
22
+ "sha256": "c104f88c83fbf12683783dbe3f241e0aa132cd2a183e1468d0bc16bf717de773"
23
23
  },
24
24
  {
25
25
  "owners": [
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "executable": true,
31
31
  "path": "libexec/ceal-host/ceal-host-background.exe",
32
- "sha256": "a2b33ad0a9bc813107f0ce06298f664d9b0e415f08aad492796bc8e7f851b54a"
32
+ "sha256": "da3096edeca2dd3b42313d09224401605762be34c621871ef1ec603e7634402e"
33
33
  },
34
34
  {
35
35
  "owners": [
@@ -37,7 +37,7 @@
37
37
  ],
38
38
  "executable": false,
39
39
  "path": "libexec/ceal-host/claude-hook.mjs",
40
- "sha256": "f2b96db751d2abcb3fe7f1eaf4933953faa679fffd3bb575e19749b47b95d458"
40
+ "sha256": "d11d59321e5c3a5c463f13426762e6784011fa9810a15706aed58cfaad8f1761"
41
41
  },
42
42
  {
43
43
  "owners": [
@@ -45,7 +45,7 @@
45
45
  ],
46
46
  "executable": false,
47
47
  "path": "libexec/ceal-host/claude-invocation-authentication.mjs",
48
- "sha256": "95840c98460710bd4c444592f42474ab1718f8e5d0b82ab38c91f306ee801d11"
48
+ "sha256": "97243923624249ea81176a156ea4e919dcb0aa18905f1d3a8ac4150f81df8e83"
49
49
  },
50
50
  {
51
51
  "owners": [
@@ -53,7 +53,7 @@
53
53
  ],
54
54
  "executable": false,
55
55
  "path": "libexec/ceal-host/claude-producer.mjs",
56
- "sha256": "5825d6c50e0db889d8f7a9d68c7fff35ba9548c97a149045430b3d760c8c72dd"
56
+ "sha256": "74060f9bc526fe74ee71cd617c99d68342247393c1a97f26443fe72fea9d574a"
57
57
  },
58
58
  {
59
59
  "owners": [
@@ -61,7 +61,7 @@
61
61
  ],
62
62
  "executable": false,
63
63
  "path": "libexec/ceal-host/codex-hook.mjs",
64
- "sha256": "4d1fd24544337805c1b955ba4c19446e103c50d5268dc031a6bac3d0c99c85d6"
64
+ "sha256": "85160fdd7690a0677468913ff7c5ca2373a94d3dc5e8bff24964b1f9d9ab0337"
65
65
  },
66
66
  {
67
67
  "owners": [
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "executable": false,
71
71
  "path": "libexec/ceal-host/codex-invocation-authentication.mjs",
72
- "sha256": "0f78482ddf8bc171e85f0ff3b29e0761a673334d7b71ef528b6172a62520ac95"
72
+ "sha256": "c371dbc01c43804f49aee05934aa4ffb17eb1d550fc7f8c355d9b74d69806611"
73
73
  },
74
74
  {
75
75
  "owners": [
@@ -77,7 +77,7 @@
77
77
  ],
78
78
  "executable": false,
79
79
  "path": "libexec/ceal-host/codex-producer.mjs",
80
- "sha256": "9278a6e7f60953a1e3dfbbccf29dec77c392c4eb34fc0b33197afd2a2863c143"
80
+ "sha256": "9fbf3f6b82f67f16f83f111acb0a66c811f35959adff5e183deb03ee3b6d2ce4"
81
81
  },
82
82
  {
83
83
  "owners": [
@@ -85,7 +85,7 @@
85
85
  ],
86
86
  "executable": false,
87
87
  "path": "libexec/ceal-host/control.mjs",
88
- "sha256": "9d58e8e4c9af9182dbf8aa52501d36541048be5dd5c97f3555bf7d2a2df77ec5"
88
+ "sha256": "d7b2b8a4bf3559d42f46380fbfab47a63283721b9578e7450e63d6a648cf9516"
89
89
  },
90
90
  {
91
91
  "owners": [
@@ -101,7 +101,7 @@
101
101
  ],
102
102
  "executable": false,
103
103
  "path": "libexec/ceal-host/relay.mjs",
104
- "sha256": "cef094c2b4901625edd879bbdcf8adff7a3036860d00b1ee7a0acae43cb29621"
104
+ "sha256": "f822016d40f8196dd80c28e1e3691edc2598a7ed44a1f6609caa32dea1505b31"
105
105
  }
106
106
  ]
107
107
  }