@corca-org/ceal-host-linux-arm64 1.0.15 → 1.0.17

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.
@@ -134,7 +134,7 @@ var client_wire_contract_default = {
134
134
  "prompt"
135
135
  ],
136
136
  discovery_command: "discovery",
137
- discovery_manifest_schema_version: "ceal.discovery_manifest.v2",
137
+ discovery_manifest_schema_version: "ceal.discovery_manifest.v1",
138
138
  discovery_manifest_document_fields: [
139
139
  "discovery_manifest"
140
140
  ],
@@ -211,10 +211,11 @@ var CEAL_AUDIT_OUTCOMES = vocabulary(["succeeded", "denied", "failed"]);
211
211
  var CEAL_GATEWAY_PROVIDER_STEP_OUTCOMES = vocabulary(["completed", "rejected", "throttled", "failed"]);
212
212
  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"]);
213
213
  var CEAL_GATEWAY_READ_REUSE_UNAVAILABLE_REASONS = vocabulary(["not_reported", "storage_unavailable", "coverage_incomplete", "freshness_refresh_required", "not_reusable", "bypassed"]);
214
+ var CEAL_GATEWAY_DERIVED_STORE_FAILURE_CLASSES = vocabulary(["storage_unavailable", "decode_mismatch", "write_conflict", "quota", "store_error"]);
214
215
  var CEAL_POLICY_DECISIONS = vocabulary(["allowed", "denied", "not_evaluated"]);
215
216
  var CEAL_CONNECTOR_ROUTE_PHASES = vocabulary(["scope_observation", "target_selection", "route_resolution"]);
216
217
  var CEAL_CONNECTOR_ROUTE_CAUSES = vocabulary(["provider_throttled", "provider_unavailable", "binding_invalid", "scope_limit_exceeded"]);
217
- var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "agent_lease_admission", "provider_authenticated_event"]);
218
+ var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "provider_authenticated_event"]);
218
219
  var CEAL_REFRESH_DELIVERIES = vocabulary(["initial", "recovery", "replay", "terminal_failure", "recovery_unavailable"]);
219
220
  var CEAL_CLIENT_OPERATIONS = vocabulary(["handshake", "discover", "call", "readback"]);
220
221
  var CEAL_WRITE_IDEMPOTENCY_POSTURES = vocabulary(["required", "optional", "not_required"]);
@@ -224,6 +225,17 @@ var CEAL_WRITE_RECEIPT_PROVIDER_STATES = vocabulary(["outcome_unknown", "verifie
224
225
  var CEAL_WRITE_RECEIPT_PROVIDER_READBACKS = vocabulary(["outcome_unknown", "verified", "not_applied"]);
225
226
  var CEAL_PROTOCOL_VERSION = "1.4.0";
226
227
  var CEAL_OPERATION_ACCESS_SCHEMA_VERSION = "ceal.operation_access.v1";
228
+ var CEAL_GATEWAY_ACTIVE_CALL_PHASES = vocabulary([
229
+ "audited_call_pending",
230
+ "continuation_read_pending",
231
+ "continuation_write_pending",
232
+ "provider_pacing_pending",
233
+ "corpus_replay_pending",
234
+ "corpus_append_pending",
235
+ "corpus_fence_pending",
236
+ "corpus_content_pending",
237
+ "corpus_transaction_pending"
238
+ ]);
227
239
  var CEAL_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["connector_kind", "phase", "schema_version"]);
228
240
  var CEAL_CLASSIFIED_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["cause", ...CEAL_CONNECTOR_ROUTE_FAILURE_KEYS]);
229
241
  var CEAL_UNCLASSIFIED_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["connector_kind", "error_class", "phase", "schema_version"]);
@@ -233,10 +245,130 @@ var CEAL_GATEWAY_ORGANIZATION_ROUTE_FACT_CALL_KEYS = Object.freeze([
233
245
  "policy_decision_revision"
234
246
  ]);
235
247
 
248
+ // packages/ceal-client-protocol/src/operation-next-actions.ts
249
+ var CEAL_REPEAT_REQUEST_NEXT_ACTION = "repeat_request";
250
+ var CEAL_INSPECT_RECEIPT_NEXT_ACTION = "inspect_receipt";
251
+ var CALLER_RECOVERABLE_NEXT_ACTION_VALUES = [
252
+ "select_did_you_mean",
253
+ "choose_new_output_path",
254
+ "choose_new_idempotency_key",
255
+ "restart_search",
256
+ "repeat_original_arguments",
257
+ // The occurrence this call addressed is settled and cannot move again -- a
258
+ // denied effect approval, an expired continuation -- so the caller runs the
259
+ // same call again as a new request. The refusal names the re-request; this
260
+ // word is the re-request.
261
+ CEAL_REPEAT_REQUEST_NEXT_ACTION,
262
+ "choose_new_request_identity",
263
+ // A refusal that names the argument (invalid_argument with `property`) tells the caller exactly what to change.
264
+ "correct_argument",
265
+ // A resolver-owned input must move from caller operands into the declared
266
+ // resolver selection field.
267
+ "supply_resolver_selections",
268
+ // The graph names an upstream node whose Operation produces the resolver's
269
+ // occurrence, and it has not produced one yet. The caller runs that node
270
+ // first; the refusal used to share a code with a malformed resolver result,
271
+ // which is not fixable, so neither could carry a remedy.
272
+ "run_resolver_dependency",
273
+ // A replay carries the input the occurrence durably admitted, and this one
274
+ // carries a different one. The caller fixes it by presenting the original
275
+ // invocation, so it is a remedy; the coordinator minted the word at the
276
+ // replay guard and never declared it, which read as unguided to the scorer.
277
+ "use_original_input",
278
+ // The same mismatch on the Request binding rather than the input: the
279
+ // occurrence was admitted under one binding and the replay presents another.
280
+ "use_original_request_binding",
281
+ // The client's own filesystem write was refused -- EACCES, EPERM, or a
282
+ // read-only mount -- which is how an agent sandbox fences writes outside its
283
+ // workspace. The caller reruns the same command with unsandboxed or escalated
284
+ // execution; re-adopting the session cannot help, because the sandbox refuses
285
+ // that write too.
286
+ "rerun_outside_agent_sandbox",
287
+ // The refusal names the one Operation to read next in `describe_command`:
288
+ // an absent Operation id with a sole catalog-ranked candidate, or a known
289
+ // Operation invoked without its input. Describing only reads the verified
290
+ // contract and dispatches nothing, and the caller then retries with the
291
+ // named Operation or input, so it is guidance the scorer counts.
292
+ "describe_operation",
293
+ // The refusal names the caller's own personal connect Operation in
294
+ // `required_action_sequence`: the Operation asked for, or the credential
295
+ // the call ran on, needs a personal connection the caller does not hold
296
+ // (never connected, revoked, or expired). The caller runs that exact
297
+ // Operation, completes the consent it hands back, and retries the same call.
298
+ "connect_personal_account",
299
+ // The provider or Gateway named a bounded wait; the caller waits that long
300
+ // and submits the same read again.
301
+ "retry_after",
302
+ // The ref names a container of rows (a Notion database or data source), which
303
+ // has no body of its own; the caller searches its rows instead of reading it.
304
+ "search_container_rows"
305
+ ];
306
+ var CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS = Object.freeze(CALLER_RECOVERABLE_NEXT_ACTION_VALUES);
307
+ var NON_REMEDY_NEXT_ACTION_VALUES = [
308
+ // Only an administrator can take the named step -- approving a place for an
309
+ // Operation, granting a withheld capability -- so a non-administrator asks
310
+ // one. The refusal names the administrator step; this word is the ask.
311
+ "ask_admin",
312
+ "await_pending_approval",
313
+ "check_gateway",
314
+ "inspect_context_store",
315
+ "inspect_gateway",
316
+ "inspect_local_cache",
317
+ // The thin client prints these on its own behalf, before or after the wire.
318
+ // They were declared only as `CealClientLocalRemedy` keys and, for two of
319
+ // them, only as Go string literals -- a second and third vocabulary for one
320
+ // thing. `CealClientLocalRemedy` derives from this list now, so the client's
321
+ // remedies cannot drift from the words the protocol knows.
322
+ "inspect_local_client",
323
+ "inspect_local_command",
324
+ "inspect_local_output",
325
+ "inspect_local_route",
326
+ CEAL_INSPECT_RECEIPT_NEXT_ACTION,
327
+ "inspect_request",
328
+ "none",
329
+ // The provider refused because of its own configuration -- an API not
330
+ // enabled, an app scope missing -- which an operator changes in that
331
+ // provider's console. No caller edit and no retry fixes it.
332
+ "operator_action",
333
+ "recover",
334
+ "reconcile",
335
+ // Reconciliation of one named occurrence, not of the deployment: an
336
+ // occurrence with no admitted input commitment cannot be replayed safely and
337
+ // no edit to the call changes that. `reconcile` is the deployment-wide word.
338
+ "reconcile_occurrence",
339
+ "reduce_request_size",
340
+ // The Host's invocation context for this turn is stale or expired at the
341
+ // Gateway. The Host's next turn rebinds it and the same call then succeeds;
342
+ // nothing in the call changes, so it is not a remedy the scorer may count.
343
+ "refresh_host_invocation_context",
344
+ "repair_or_adopt_session",
345
+ "retry",
346
+ // The owner -- a correlation hook, an approval hook -- is not serving right
347
+ // now. The caller changes nothing and the same call succeeds once the owner
348
+ // is back, so this is not a remedy the scorer may count as guidance.
349
+ "retry_after_owner_recovery",
350
+ "retry_same_receipt_read",
351
+ "run_file_search_again",
352
+ "select_exact_approval"
353
+ ];
354
+ var CEAL_NON_REMEDY_NEXT_ACTIONS = Object.freeze(NON_REMEDY_NEXT_ACTION_VALUES);
355
+ var DECLARED = /* @__PURE__ */ new Set([...CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS, ...CEAL_NON_REMEDY_NEXT_ACTIONS]);
356
+ var RETRY_PROMISE_NEXT_ACTIONS = ["retry", "retry_after"];
357
+ var RETRY_PROMISE = new Set(RETRY_PROMISE_NEXT_ACTIONS);
358
+ var RECOVERABLE = new Set(CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS);
359
+ var CEAL_OPERATION_WITHHELD_NEXT_ACTIONS = Object.freeze({
360
+ provider_permission: "ask_admin",
361
+ access_level: "ask_admin",
362
+ personal_authorization_required: "connect_personal_account"
363
+ });
364
+
365
+ // packages/ceal-client-protocol/src/operation-withheld-cause.ts
366
+ var CEAL_OPERATION_WITHHELD_CAUSES = vocabulary(["provider_permission", "access_level", "personal_authorization_required"]);
367
+
236
368
  // packages/ceal-client-protocol/src/operation-contract-types.ts
237
369
  var CEAL_JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
238
370
  var CEAL_OPERATION_ERROR_SCHEMA_VERSION = "ceal.operation_error.v1";
239
- var CEAL_OPERATION_WITHHELD_CAUSES = vocabulary(["provider_permission", "access_level", "personal_authorization_required"]);
371
+ var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
240
372
  var CEAL_RETRY_AFTER_MAX_MS = 60 * 60 * 1e3;
241
373
  var CEAL_JSON_SCHEMA_TYPES = vocabulary(["object", "array", "string", "integer", "number", "boolean", "null"]);
242
374
  var OBSERVATION_POSTURES = vocabulary(["direct_readback", "approved_no_readback", "operator_mediated", "excluded"]);
@@ -500,6 +632,8 @@ var CEAL_PROVIDER_BOUNDARY_KINDS = vocabulary([
500
632
  var CEAL_PROVIDER_BOUNDARY_EVIDENCE = vocabulary(["provider_readback", "operator_stated"]);
501
633
  var CEAL_ACCESS_LEVELS = vocabulary(["none", "read", "read_write"]);
502
634
  var CEAL_PERSONAL_ACCESS_CEILINGS = vocabulary(["disabled", "read", "read_write"]);
635
+ var CEAL_TARGET_REF_PATTERN = "^[^\\p{Cc}]+$";
636
+ var TARGET_REF = new RegExp(CEAL_TARGET_REF_PATTERN, "u");
503
637
  var CEAL_TARGET_VISIBILITIES = vocabulary(["public", "private"]);
504
638
  var CEAL_PRINCIPAL_KINDS = vocabulary(["human", "service", "runtime"]);
505
639
  var CEAL_ORGANIZATION_ROLES = vocabulary(["member", "admin"]);
@@ -608,8 +742,6 @@ var CEAL_OPERATION_AUTHORITY_POLICY_KEYS = Object.freeze(["access_group", "insta
608
742
  var MAX_OPERATION_INPUT_RESOLVER_BINDINGS = 96;
609
743
  var CEAL_OPERATION_DESCRIPTOR_REQUIRED_ENVELOPE_KEYS = Object.freeze(["schema_version", "id", "input_contract", "result_contract", "policy"]);
610
744
  var CEAL_OPERATION_DESCRIPTOR_OPTIONAL_ENVELOPE_KEYS = Object.freeze(["input_resolution", "summary"]);
611
- var CEAL_OPERATION_RESULT_KEYS = vocabulary(["ok", "operation_id", "operation_receipt", "schema_version", "value"]);
612
- var CEAL_OPERATION_COMPACT_RESULT_KEYS = vocabulary(["ok", "operation_evidence", "operation_id", "schema_version", "value"]);
613
745
 
614
746
  // packages/ceal-client-protocol/src/operation-catalog.ts
615
747
  var CEAL_OPERATION_CATALOG_SCHEMA_VERSION = "ceal.catalog.v3";
@@ -621,8 +753,8 @@ var CEAL_SCHEMA_LITERALS = [
621
753
  "ceal.activation_transport.v1",
622
754
  CEAL_OPERATION_ACCESS_SCHEMA_VERSION,
623
755
  CEAL_OPERATION_CATALOG_SCHEMA_VERSION,
624
- "ceal.client_refresh_request.v2",
625
- "ceal.client_refresh_result.v2",
756
+ "ceal.client_refresh_request.v1",
757
+ "ceal.client_refresh_result.v1",
626
758
  "ceal.client_revoke_request.v1",
627
759
  "ceal.client_revoke_result.v1",
628
760
  CEAL_COMMAND_REQUEST_SCHEMA_VERSION,
@@ -651,7 +783,7 @@ var CEAL_SCHEMA_LITERALS = [
651
783
  "ceal.gateway_call_result.v1",
652
784
  CEAL_GATEWAY_COMMAND_RESOLUTION_SCHEMA_VERSION,
653
785
  "ceal.gateway_connector_route_failure.v1",
654
- "ceal.gateway_discovery.v3",
786
+ "ceal.gateway_discovery.v1",
655
787
  "ceal.gateway_handshake.v1",
656
788
  "ceal.gateway_installation_activation_code_issue_request.v1",
657
789
  "ceal.gateway_installation_activation_code_issue_result.v1",
@@ -673,10 +805,6 @@ var CEAL_SCHEMA_LITERALS = [
673
805
  "ceal.host_observation.v1",
674
806
  "ceal.host_registration_request.v1",
675
807
  "ceal.host_registration_result.v1",
676
- "ceal.leased-resource-stream.v2",
677
- "ceal.leased_consumer_attachment_stream_frame.v2",
678
- "ceal.leased_consumer_attachment_stream_request.v2",
679
- "ceal.leased_consumer_attachment_stream_transport.v2",
680
808
  "ceal.operation_descriptor.v1",
681
809
  "ceal.operation_error.v1",
682
810
  "ceal.operation_failure.v1",
@@ -684,7 +812,7 @@ var CEAL_SCHEMA_LITERALS = [
684
812
  "ceal.operation_receipt.v1",
685
813
  "ceal.operation_result.v1",
686
814
  "ceal.operation_result.compact.v1",
687
- "ceal.local_result_materialization.v2",
815
+ "ceal.local_result_materialization.v1",
688
816
  "ceal.local_result_root.v1",
689
817
  "ceal.owner_bootstrap_exchange_request.v1",
690
818
  "ceal.owner_bootstrap_exchange_result.v1",
@@ -702,12 +830,6 @@ var CEAL_SCHEMA_LITERAL_SET = new Set(CEAL_SCHEMA_LITERALS);
702
830
  // packages/ceal-client-protocol/src/bounded-series.ts
703
831
  import { join } from "node:path";
704
832
  var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
705
- usage_record: (root) => join(root, "run-usage.jsonl"),
706
- control_commit: (root) => join(root, "control-auto-commit.jsonl"),
707
- engagement_signal: (root) => join(root, "runtime-state", "slack-feedback.jsonl"),
708
- runtime_error: (root) => join(root, "runtime-state", "runtime-errors.jsonl"),
709
- turn_bridge_request: (root) => join(root, ".ceal", "turn-bridge", "requests.jsonl"),
710
- thread_run_events: (root) => join(root, "run-events.jsonl"),
711
833
  bounded_store_sidecar: (root) => `${root}.jsonl`,
712
834
  gateway_audit_archive: (root) => `${root}.jsonl`,
713
835
  gateway_access_group_connector_control_audit: (root) => `${root}.audit.jsonl`,
@@ -740,146 +862,8 @@ var CEAL_HOST_REGISTRATION_ATTEMPT_REF_PATTERN = new RegExp(`^host-registration-
740
862
  var CEAL_HOST_INSTALLATION_REF_PATTERN = new RegExp(`^host-installation:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
741
863
  var CEAL_HOST_SOURCE_REF_PATTERN = new RegExp(`^host-source:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
742
864
 
743
- // packages/ceal-client-protocol/src/agent-session-handoff.ts
744
- var CEAL_AGENT_ADMISSION_PHASES = vocabulary([
745
- "incumbent_admitted",
746
- "incumbent_draining",
747
- "drained",
748
- "candidate_admitted",
749
- "candidate_draining",
750
- "rollback_admitted"
751
- ]);
752
- var CEAL_AGENT_SERVICE_SESSION_RECORD_KEYS = vocabulary([
753
- "admission_fence",
754
- "admission_state",
755
- "admission_state_generation",
756
- "bearer",
757
- "consumer_ref",
758
- "credential_generation",
759
- "expires_at",
760
- "gateway_instance",
761
- "gateway_origin",
762
- "gateway_serving_generation",
763
- "issued_at",
764
- "record_sha256",
765
- "renew_after",
766
- "renew_by",
767
- "schema_version",
768
- "session_revision"
769
- ]);
770
- var CEAL_AGENT_SESSION_COMMIT_KEYS = vocabulary(["attempt_ref", "expected_session_revision", "session_revision"]);
771
-
772
- // packages/ceal-client-protocol/src/operation-next-actions.ts
773
- var CEAL_REPEAT_REQUEST_NEXT_ACTION = "repeat_request";
774
- var CEAL_INSPECT_RECEIPT_NEXT_ACTION = "inspect_receipt";
775
- var CALLER_RECOVERABLE_NEXT_ACTION_VALUES = [
776
- "select_did_you_mean",
777
- "choose_new_output_path",
778
- "choose_new_idempotency_key",
779
- "restart_search",
780
- "repeat_original_arguments",
781
- // The occurrence this call addressed is settled and cannot move again -- a
782
- // denied effect approval, an expired continuation -- so the caller runs the
783
- // same call again as a new request. The refusal names the re-request; this
784
- // word is the re-request.
785
- CEAL_REPEAT_REQUEST_NEXT_ACTION,
786
- "choose_new_request_identity",
787
- // A refusal that names the argument (invalid_argument with `property`) tells the caller exactly what to change.
788
- "correct_argument",
789
- // A resolver-owned input must move from caller operands into the declared
790
- // resolver selection field.
791
- "supply_resolver_selections",
792
- // The graph names an upstream node whose Operation produces the resolver's
793
- // occurrence, and it has not produced one yet. The caller runs that node
794
- // first; the refusal used to share a code with a malformed resolver result,
795
- // which is not fixable, so neither could carry a remedy.
796
- "run_resolver_dependency",
797
- // A replay carries the input the occurrence durably admitted, and this one
798
- // carries a different one. The caller fixes it by presenting the original
799
- // invocation, so it is a remedy; the coordinator minted the word at the
800
- // replay guard and never declared it, which read as unguided to the scorer.
801
- "use_original_input",
802
- // The same mismatch on the Request binding rather than the input: the
803
- // occurrence was admitted under one binding and the replay presents another.
804
- "use_original_request_binding",
805
- // The client's own filesystem write was refused -- EACCES, EPERM, or a
806
- // read-only mount -- which is how an agent sandbox fences writes outside its
807
- // workspace. The caller reruns the same command with unsandboxed or escalated
808
- // execution; re-adopting the session cannot help, because the sandbox refuses
809
- // that write too.
810
- "rerun_outside_agent_sandbox",
811
- // The refusal names the one Operation to read next in `describe_command`:
812
- // an absent Operation id with a sole catalog-ranked candidate, or a known
813
- // Operation invoked without its input. Describing only reads the verified
814
- // contract and dispatches nothing, and the caller then retries with the
815
- // named Operation or input, so it is guidance the scorer counts.
816
- "describe_operation",
817
- // The refusal names the caller's own personal connect Operation in
818
- // `required_action_sequence`: the Operation asked for, or the credential
819
- // the call ran on, needs a personal connection the caller does not hold
820
- // (never connected, revoked, or expired). The caller runs that exact
821
- // Operation, completes the consent it hands back, and retries the same call.
822
- "connect_personal_account",
823
- // The provider or Gateway named a bounded wait; the caller waits that long
824
- // and submits the same read again.
825
- "retry_after"
826
- ];
827
- var CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS = Object.freeze(CALLER_RECOVERABLE_NEXT_ACTION_VALUES);
828
- var NON_REMEDY_NEXT_ACTION_VALUES = [
829
- // Only an administrator can take the named step -- approving a place for an
830
- // Operation, granting a withheld capability -- so a non-administrator asks
831
- // one. The refusal names the administrator step; this word is the ask.
832
- "ask_admin",
833
- "await_pending_approval",
834
- "check_gateway",
835
- "inspect_context_store",
836
- "inspect_gateway",
837
- "inspect_local_cache",
838
- // The thin client prints these on its own behalf, before or after the wire.
839
- // They were declared only as `CealClientLocalRemedy` keys and, for two of
840
- // them, only as Go string literals -- a second and third vocabulary for one
841
- // thing. `CealClientLocalRemedy` derives from this list now, so the client's
842
- // remedies cannot drift from the words the protocol knows.
843
- "inspect_local_client",
844
- "inspect_local_command",
845
- "inspect_local_output",
846
- "inspect_local_route",
847
- CEAL_INSPECT_RECEIPT_NEXT_ACTION,
848
- "inspect_request",
849
- "none",
850
- // The provider refused because of its own configuration -- an API not
851
- // enabled, an app scope missing -- which an operator changes in that
852
- // provider's console. No caller edit and no retry fixes it.
853
- "operator_action",
854
- "recover",
855
- "reconcile",
856
- // Reconciliation of one named occurrence, not of the deployment: an
857
- // occurrence with no admitted input commitment cannot be replayed safely and
858
- // no edit to the call changes that. `reconcile` is the deployment-wide word.
859
- "reconcile_occurrence",
860
- "reduce_request_size",
861
- // The Host's invocation context for this turn is stale or expired at the
862
- // Gateway. The Host's next turn rebinds it and the same call then succeeds;
863
- // nothing in the call changes, so it is not a remedy the scorer may count.
864
- "refresh_host_invocation_context",
865
- "repair_or_adopt_session",
866
- "retry",
867
- // The owner -- a correlation hook, an approval hook -- is not serving right
868
- // now. The caller changes nothing and the same call succeeds once the owner
869
- // is back, so this is not a remedy the scorer may count as guidance.
870
- "retry_after_owner_recovery",
871
- "retry_same_receipt_read",
872
- "run_file_search_again",
873
- "select_exact_approval"
874
- ];
875
- var CEAL_NON_REMEDY_NEXT_ACTIONS = Object.freeze(NON_REMEDY_NEXT_ACTION_VALUES);
876
- var DECLARED = /* @__PURE__ */ new Set([...CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS, ...CEAL_NON_REMEDY_NEXT_ACTIONS]);
877
- var RECOVERABLE = new Set(CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS);
878
- var CEAL_OPERATION_WITHHELD_NEXT_ACTIONS = Object.freeze({
879
- provider_permission: "ask_admin",
880
- access_level: "ask_admin",
881
- personal_authorization_required: "connect_personal_account"
882
- });
865
+ // packages/ceal-client-protocol/src/operation-result-completeness.ts
866
+ var CEAL_READ_VALUE_CONTINUATION_KEYS = vocabulary(["continuation", "continuation_ref", "next_cursor"]);
883
867
 
884
868
  // packages/ceal-client-protocol/src/operation-contract-artifact.ts
885
869
  var CATALOG_REVISION = new RegExp(CEAL_VERIFIED_ARTIFACT_CATALOG_REVISION_PATTERN, "u");
@@ -888,7 +872,9 @@ var CEAL_OPERATION_INVOKE_COMMAND = "invoke";
888
872
  var CEAL_OPERATION_INPUT_FLAG = "--input";
889
873
  var CEAL_OPERATION_ID_PLACEHOLDER = "<operation-id>";
890
874
  var CEAL_OPERATION_INPUT_PLACEHOLDER = "<json-object>";
891
- var CEAL_MODEL_INVOCATION_ARGUMENTS = [CEAL_OPERATION_INVOKE_COMMAND, CEAL_OPERATION_ID_PLACEHOLDER, CEAL_OPERATION_INPUT_FLAG, shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)].join(" ");
875
+ var MODEL_INVOCATION_BASE_ARGUMENTS = [CEAL_OPERATION_INVOKE_COMMAND, CEAL_OPERATION_ID_PLACEHOLDER].join(" ");
876
+ var CEAL_MODEL_INVOCATION_ARGUMENTS = [MODEL_INVOCATION_BASE_ARGUMENTS, CEAL_OPERATION_INPUT_FLAG, shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)].join(" ");
877
+ 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.`;
892
878
  function shellSingleQuoted(value) {
893
879
  return `'${value.replaceAll("'", "'\\''")}'`;
894
880
  }
@@ -920,76 +906,7 @@ var CEAL_VERIFIED_ARTIFACT_DESCRIPTOR_JSON_SCHEMA = Object.freeze({
920
906
  }
921
907
  });
922
908
 
923
- // packages/ceal-client-protocol/src/bare-document.ts
924
- var REQUIRED_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_fields;
925
- var OPTIONAL_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_optional_fields;
926
-
927
- // packages/ceal-client-protocol/src/leased-consumer-vocabulary.ts
928
- var CEAL_TERMINAL_DISPOSITIONS = vocabulary(["completed", "failed", "cancelled"]);
929
- var CEAL_LEASE_DISPOSITIONS = vocabulary([...CEAL_TERMINAL_DISPOSITIONS, "deferred"]);
930
- var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["initial"]);
931
- var CEAL_LEASED_MESSAGE_DELIVERY_OPERATION_IDS = vocabulary(["message.send", "message.update", "message.delete"]);
932
- var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
933
- var CEAL_RESULT_DELIVERY_OFFERS = vocabulary(["pending", "offered", "transport_lost"]);
934
- var CEAL_RESULT_DELIVERY_STATES = vocabulary(["unavailable", ...CEAL_RESULT_DELIVERY_OFFERS]);
935
- var CEAL_PROVIDER_OUTCOMES = vocabulary(["not_attempted", "outcome_unknown", "verified"]);
936
- var CEAL_ACTIVITY_GAP_CODES = vocabulary([
937
- "provider_page_budget",
938
- "call_deadline",
939
- "related_item_budget",
940
- "provider_cursor_unavailable",
941
- "malformed_provider_page",
942
- "visibility_incomplete",
943
- "unsupported_event_kind"
944
- ]);
945
- var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
946
- var CEAL_ACTIVITY_COVERAGE_STATUSES = vocabulary(["complete_for_target", "continuation_required", "blocked"]);
947
- var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
948
- "slack.message",
949
- "slack.reply",
950
- "slack.direct_message",
951
- "github.commit.authored",
952
- "github.issue.opened",
953
- "github.pull_request.opened",
954
- "github.review.submitted",
955
- "github.issue_comment.created",
956
- "github.review_comment.created",
957
- "calendar.organized",
958
- "calendar.accepted_invite",
959
- "calendar.recorded",
960
- "drive.file.created",
961
- "drive.file.modified",
962
- "drive.file.viewed",
963
- "notion.page.created",
964
- "notion.page.edited"
965
- ]);
966
- var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
967
- "message_created",
968
- "commit_authored",
969
- "resource_created",
970
- "review_submitted",
971
- "comment_created",
972
- "event_start",
973
- "all_day_start",
974
- "file_created",
975
- "file_modified",
976
- "file_modified_by_me",
977
- "file_viewed_by_me",
978
- "page_created",
979
- "page_last_edited",
980
- "resource_modified"
981
- ]);
982
- var CEAL_ACTIVITY_V3_KINDS = vocabulary(["authored", "edited", "messaged", "responded"]);
983
- var CEAL_RESOURCE_TIME_BASES = vocabulary(["created", "modified", "viewed"]);
984
- var CEAL_RESOURCE_SEARCH_ORDERS = vocabulary(["relevance", "modified", "viewed", "created"]);
985
- var CEAL_RESOURCE_SEARCH_DIRECTIONS = vocabulary(["ascending", "descending"]);
986
- var CEAL_RESOURCE_SEARCH_FILTERS = vocabulary(["query", "modified_since", "since", "until", "authored_by_me", "include_replies", "kinds", "container_ref", "container_refs", "container_names", "addressed_to_me", "unread"]);
987
- var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
988
- var CEAL_READ_ITEM_KINDS = vocabulary(["conversation", "identity", "usergroup", "message", "file", "document"]);
989
- var CEAL_LEASED_MESSAGE_SEARCH_COMPLETENESS = vocabulary(["complete", "continuation_available", "truncated"]);
990
- var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "object"]);
991
- var CEAL_WRITE_OBJECT_KINDS = vocabulary(["document", "comment", "cell_range"]);
992
- var CEAL_CONVERSATION_KINDS = vocabulary(["channel", "dm", "group"]);
909
+ // packages/ceal-client-protocol/src/provider-operation-vocabulary.ts
993
910
  var CEAL_FILE_TYPE_FAMILIES = vocabulary(["all", "image", "pdf"]);
994
911
  var CEAL_GITHUB_ISSUE_STATES = vocabulary(["open", "closed", "all"]);
995
912
  var CEAL_NOTION_UPDATABLE_BLOCK_TYPES = vocabulary([
@@ -1023,12 +940,92 @@ var CEAL_NOTION_IDENTITY_GAP_REASONS = vocabulary([
1023
940
  "identity_unlinked"
1024
941
  ]);
1025
942
  var CEAL_NOTION_STRING_VALUE_TYPES = vocabulary(["text", "select", "url", "email", "phone"]);
1026
- var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
1027
- var CEAL_PLAN_ITEM_STATUSES = vocabulary(["pending", "active", "completed"]);
1028
- var CEAL_FINAL_PRESENTATION_INTENTS = vocabulary(["final", "stop", "transient_notice"]);
1029
- var CEAL_PRESENTATION_INTENTS = vocabulary(["progress", ...CEAL_FINAL_PRESENTATION_INTENTS]);
943
+
944
+ // packages/ceal-client-protocol/src/opaque-reference.ts
945
+ var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "block", "object"]);
946
+ var CEAL_OPAQUE_REF_KINDS = vocabulary([...CEAL_OPAQUE_HANDLE_KINDS, "result", "operation-receipt", "reply-receipt", "field", "notion-data-source"]);
947
+
948
+ // packages/ceal-client-protocol/src/bare-document.ts
949
+ var REQUIRED_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_fields;
950
+ var OPTIONAL_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_optional_fields;
1030
951
 
1031
952
  // packages/ceal-client-protocol/src/resource-row.ts
953
+ var CEAL_RESOURCE_SEARCH_ORDERS = vocabulary(["relevance", "modified", "viewed", "created"]);
954
+ var CEAL_RESOURCE_SEARCH_DIRECTIONS = vocabulary(["ascending", "descending"]);
955
+ var CEAL_RESOURCE_SEARCH_FILTERS = vocabulary(["query", "modified_since", "since", "until", "authored_by_me", "include_replies", "kinds", "container_ref", "container_refs", "container_names", "addressed_to_me", "unread"]);
956
+ var CEAL_RESOURCE_TIME_BASES = vocabulary(["created", "modified", "viewed"]);
957
+ var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
958
+ var CEAL_ACTIVITY_V3_KINDS = vocabulary(["authored", "edited", "messaged", "responded"]);
959
+ var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
960
+ "message_created",
961
+ "commit_authored",
962
+ "resource_created",
963
+ "review_submitted",
964
+ "comment_created",
965
+ "event_start",
966
+ "all_day_start",
967
+ "file_created",
968
+ "file_modified",
969
+ "file_modified_by_me",
970
+ "file_viewed_by_me",
971
+ "page_created",
972
+ "page_last_edited",
973
+ "resource_modified"
974
+ ]);
975
+ var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
976
+ var CEAL_ACTIVITY_GAP_CODES = vocabulary([
977
+ "provider_page_budget",
978
+ "call_deadline",
979
+ "related_item_budget",
980
+ "provider_cursor_unavailable",
981
+ "malformed_provider_page",
982
+ "visibility_incomplete",
983
+ "unsupported_event_kind",
984
+ "direct_messages_excluded"
985
+ ]);
986
+ var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
987
+ "slack.message",
988
+ "slack.reply",
989
+ "slack.direct_message",
990
+ "github.commit.authored",
991
+ "github.issue.opened",
992
+ "github.pull_request.opened",
993
+ "github.issue.edited",
994
+ "github.pull_request.edited",
995
+ "github.review.submitted",
996
+ "github.issue_comment.created",
997
+ "github.review_comment.created",
998
+ "calendar.organized",
999
+ "calendar.accepted_invite",
1000
+ "calendar.recorded",
1001
+ "drive.file.created",
1002
+ "drive.file.modified",
1003
+ "drive.file.viewed",
1004
+ "notion.page.created",
1005
+ "notion.page.edited"
1006
+ ]);
1007
+ var CEAL_ACTIVITY_EVENT_TIMESTAMP_BASIS_MAP = Object.freeze({
1008
+ "slack.message": "message_created",
1009
+ "slack.reply": "message_created",
1010
+ "slack.direct_message": "message_created",
1011
+ "github.commit.authored": "commit_authored",
1012
+ "github.review.submitted": "review_submitted",
1013
+ "github.issue_comment.created": "comment_created",
1014
+ "github.review_comment.created": "comment_created",
1015
+ "github.issue.opened": "resource_created",
1016
+ "github.pull_request.opened": "resource_created",
1017
+ "github.issue.edited": "resource_modified",
1018
+ "github.pull_request.edited": "resource_modified",
1019
+ "calendar.organized": "resource_created",
1020
+ "drive.file.created": "file_created",
1021
+ "drive.file.modified": "file_modified_by_me",
1022
+ "drive.file.viewed": "file_viewed_by_me",
1023
+ "notion.page.created": "page_created",
1024
+ "notion.page.edited": "page_last_edited"
1025
+ });
1026
+ var CEAL_DATED_NOTE_BASES = vocabulary(["recording", "calendar_event", "created_time"]);
1027
+ var CEAL_DATED_NOTE_TRANSCRIPT_STATES = vocabulary(["present", "absent", "unestablished"]);
1028
+ var CEAL_READ_SEARCH_COST_CLASSES = vocabulary(["native_index", "scan"]);
1032
1029
  var RESOURCE_ROW_KEY_RULES = Object.freeze({
1033
1030
  schema_version: { required: true, timestamp: false },
1034
1031
  ref: { required: true, timestamp: false },
@@ -1041,6 +1038,7 @@ var RESOURCE_ROW_KEY_RULES = Object.freeze({
1041
1038
  source: { required: true, timestamp: false },
1042
1039
  owner: { required: false, timestamp: false },
1043
1040
  counterparts: { required: false, timestamp: false },
1041
+ attachments: { required: false, timestamp: false },
1044
1042
  created_at: { required: false, timestamp: true },
1045
1043
  created_at_local: { required: false, timestamp: true },
1046
1044
  modified_at: { required: false, timestamp: true },
@@ -1051,6 +1049,7 @@ var RESOURCE_ROW_KEY_RULES = Object.freeze({
1051
1049
  end: { required: false, timestamp: false },
1052
1050
  status: { required: false, timestamp: false },
1053
1051
  snippet: { required: false, timestamp: false },
1052
+ dated_notes: { required: false, timestamp: false },
1054
1053
  state: { required: true, timestamp: false },
1055
1054
  timestamp_basis: { required: true, timestamp: false }
1056
1055
  });
@@ -1087,16 +1086,26 @@ var CEAL_WRITE_SAFETY_UNCHECKED_REASONS = vocabulary(["authority_unavailable"]);
1087
1086
  // packages/ceal-client-protocol/src/operation-occurrence.ts
1088
1087
  var MAX_RECEIPT_REVISION = Number.MAX_SAFE_INTEGER - 1;
1089
1088
 
1090
- // packages/ceal-client-protocol/src/leased-artifact-contract.ts
1091
- var CEAL_LEASED_CONSUMER_ARTIFACT_CHUNK_MAX_BYTES = 12 * 1024;
1092
-
1093
- // packages/ceal-client-protocol/src/leased-resource-stream.ts
1094
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAGIC = new Uint8Array([67, 69, 65, 76, 82, 83, 50, 0]);
1095
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_RECORD_PREFIX_BYTES = 8;
1096
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAX_HEADER_BYTES = 16 * 1024;
1097
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_CHUNK_BYTES = 64 * 1024;
1098
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAX_RECORD_BYTES = CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_RECORD_PREFIX_BYTES + CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAX_HEADER_BYTES + CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_CHUNK_BYTES;
1099
- var CEAL_ATTACHMENT_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "digest_mismatch"]);
1089
+ // packages/ceal-client-protocol/src/personal-client-vocabulary.ts
1090
+ var CEAL_PERSONAL_CLIENT_BINDING_KEYS = vocabulary([
1091
+ "access_group_ref",
1092
+ "membership_ref",
1093
+ "registration_ref",
1094
+ "client_ref",
1095
+ "subject_ref",
1096
+ "instance_ref"
1097
+ ]);
1098
+ var CEAL_ENROLLMENT_FAILURE_CODES = vocabulary(["enrollment_invalid", "enrollment_expired", "enrollment_used"]);
1099
+ var CEAL_REFRESH_FAILURE_CODES = vocabulary([
1100
+ "refresh_invalid",
1101
+ "refresh_expired",
1102
+ "refresh_inactive",
1103
+ "refresh_replayed",
1104
+ "refresh_revoked",
1105
+ "authority_replaced",
1106
+ "refresh_recovery_unavailable",
1107
+ "refresh_recovery_expired"
1108
+ ]);
1100
1109
 
1101
1110
  // packages/ceal-client-protocol/src/request-validation-primitives.ts
1102
1111
  import { createHash } from "node:crypto";
@@ -1182,7 +1191,7 @@ var CEAL_REQUEST_MAX_GRAPH_NODES = 128;
1182
1191
 
1183
1192
  // packages/ceal-client-protocol/src/request-run.ts
1184
1193
  var CEAL_REQUEST_NODE_STANDING_OCCURRENCE_SCHEMA_VERSION = "ceal.request_node_standing_occurrence.v1";
1185
- var CEAL_REQUEST_RUN_BATCH_SCHEMA_VERSION = "ceal.request_run_batch.v3";
1194
+ var CEAL_REQUEST_RUN_BATCH_SCHEMA_VERSION = "ceal.request_run_batch.v1";
1186
1195
  var REQUEST_ACTION_SAFE_REF_SCHEMA = { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source };
1187
1196
  var REQUEST_ACTION_DIGEST_SCHEMA = { type: "string", minLength: 64, maxLength: 64, pattern: "^[a-f0-9]{64}$" };
1188
1197
  var REQUEST_NODE_STANDING_OCCURRENCE_SCHEMA = {
@@ -1264,6 +1273,10 @@ var CEAL_REQUEST_RUN_BATCH_JSON_SCHEMA = {
1264
1273
  };
1265
1274
 
1266
1275
  // packages/ceal-client-protocol/src/host-observation.ts
1276
+ var CEAL_HOST_INPUT_KINDS = vocabulary(["human", "host_automatic"]);
1277
+ function isCealHostInputKind(value) {
1278
+ return typeof value === "string" && CEAL_HOST_INPUT_KINDS.some((kind) => kind === value);
1279
+ }
1267
1280
  var CEAL_HOST_OBSERVATION_REF_PREFIX = "host-observation:";
1268
1281
  var HOST_OBSERVATION_PRODUCER = /^[a-z][a-z0-9]{0,31}$/u;
1269
1282
  var HOST_OBSERVATION_DIGEST = /^[a-f0-9]{8,64}$/u;
@@ -1326,12 +1339,6 @@ var OWNER_WRITE_STATES = Object.freeze(["attempt_started", "provider_acknowledge
1326
1339
  var OWNER_EFFECT_STATES = Object.freeze(["none", "applied", "failed", "unknown", "reconciled"]);
1327
1340
  var OWNER_RECEIPT_STATES = Object.freeze(["pending", "available", "failed", "unknown", "reconciled"]);
1328
1341
 
1329
- // packages/ceal-client-protocol/src/thread-excerpt.ts
1330
- var CEAL_THREAD_RECENT_WINDOW = 6;
1331
- var CEAL_THREAD_LAST_APP_MESSAGES_WINDOW = 3;
1332
- var CEAL_THREAD_OLDER_SUMMARY_WINDOW = 4;
1333
- var CEAL_FED_THREAD_MESSAGE_LIMIT = CEAL_THREAD_RECENT_WINDOW + CEAL_THREAD_OLDER_SUMMARY_WINDOW + CEAL_THREAD_LAST_APP_MESSAGES_WINDOW;
1334
-
1335
1342
  // packages/ceal-client-protocol/src/request-graph-readiness.ts
1336
1343
  var REQUEST_GRAPH_PRODUCER_TO_APPEND_SCHEMA = {
1337
1344
  type: "object",
@@ -1441,25 +1448,10 @@ function exactKeys(value, expected) {
1441
1448
  }
1442
1449
 
1443
1450
  // packages/ceal-client-protocol/src/client-result-materialization.ts
1451
+ var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
1444
1452
  var CEAL_MODEL_VISIBLE_COMMAND_OUTPUT_MAX_BYTES = 32 * 1024;
1445
- var REQUIRED_FIELDS2 = Object.freeze(["schema_version", "operation_id", "read_argv"]);
1446
- var FIELDS = /* @__PURE__ */ new Set([...REQUIRED_FIELDS2, "local_result_root", "continue_argv"]);
1447
-
1448
- // packages/ceal-client-protocol/src/session-start-affordance.ts
1449
- var CEAL_SESSION_ENTRY_INVOCATION = "ceal";
1450
- var CEAL_LINK_RESOURCE_PRECEDENCE = `When the user asks to use Ceal or provides a link to information that may be available through installed organizational capabilities, run bare \`${CEAL_SESSION_ENTRY_INVOCATION}\`. The Host supplies the current user prompt without exposing it to the client command, and the Gateway returns the applicable entry in that one response. Treat a supplied link as a candidate Ceal resource rather than a public web-search target. Reach for a generic web fetch or web search only when the Gateway offered nothing.`;
1451
-
1452
- // packages/ceal-client-protocol/src/conversation-contracts.ts
1453
- var CEAL_APPROVAL_POLICY_KINDS = vocabulary(["requester_only", "named_users", "role_based"]);
1454
- var CEAL_APPROVAL_TARGET_KINDS = vocabulary([
1455
- "repo_change",
1456
- "investigation",
1457
- "skill_creation",
1458
- "command_creation",
1459
- "connector_creation",
1460
- "generic"
1461
- ]);
1462
- var CEAL_PROGRESS_PHASES = vocabulary(["request_review", "information_gathering", "work_execution", "result_check"]);
1453
+ var REQUIRED_FIELDS2 = Object.freeze(["schema_version", "operation_id"]);
1454
+ var FIELDS = /* @__PURE__ */ new Set([...REQUIRED_FIELDS2, "read_argv", "local_result_root", "continue_argv", "model_disclosure", "item_read_argv"]);
1463
1455
 
1464
1456
  // packages/ceal-client-protocol/src/gateway-cache-origin-validation.ts
1465
1457
  var CEAL_MAX_CACHE_ORIGIN_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
@@ -1543,27 +1535,6 @@ var ADMIN_LINEAGE_NODE_KINDS = vocabulary(["source_read", "synthesis_preview", "
1543
1535
  // packages/ceal-client-protocol/src/actor-kind.ts
1544
1536
  var CEAL_ACTOR_KINDS = vocabulary(["human", "bot", "app", "unknown"]);
1545
1537
 
1546
- // packages/ceal-client-protocol/src/personal-client-vocabulary.ts
1547
- var CEAL_PERSONAL_CLIENT_BINDING_KEYS = vocabulary([
1548
- "access_group_ref",
1549
- "membership_ref",
1550
- "registration_ref",
1551
- "client_ref",
1552
- "subject_ref",
1553
- "instance_ref"
1554
- ]);
1555
- var CEAL_ENROLLMENT_FAILURE_CODES = vocabulary(["enrollment_invalid", "enrollment_expired", "enrollment_used"]);
1556
- var CEAL_REFRESH_FAILURE_CODES = vocabulary([
1557
- "refresh_invalid",
1558
- "refresh_expired",
1559
- "refresh_inactive",
1560
- "refresh_replayed",
1561
- "refresh_revoked",
1562
- "authority_replaced",
1563
- "refresh_recovery_unavailable",
1564
- "refresh_recovery_expired"
1565
- ]);
1566
-
1567
1538
  // packages/ceal-client-protocol/src/device-enrollment.ts
1568
1539
  var CEAL_DEVICE_ENROLLMENT_POLL_FAILURE_CODES = Object.freeze(["unsupported_feature", "recovery_required", "expired", "denied"]);
1569
1540
  var POLL_RESULT_KEYS = Object.freeze(["retry_after_ms", "schema_version", "status"]);
@@ -1895,13 +1866,13 @@ function validTurn(value) {
1895
1866
  return exactOptional(value, ["local_session_ref", "local_turn_ref"], ["model", "observations"]) && safeRef(value.local_session_ref) && safeRef(value.local_turn_ref) && optionalText(value.model, 256) && validObservations(value.observations);
1896
1867
  }
1897
1868
  function validInput(value) {
1898
- return exactOptional(value, ["local_session_ref", "local_turn_ref", "local_input_ref", "origin_input", "observations"], ["decision", "local_turn_aliases", "context_expires_at"]) && safeRef(value.local_session_ref) && safeRef(value.local_turn_ref) && safeRef(value.local_input_ref) && validInputObservations(value.observations) && typeof value.origin_input === "boolean" && validInputOptionals(value);
1869
+ return exactOptional(value, ["local_session_ref", "local_turn_ref", "local_input_ref", "input_kind", "origin_input", "observations"], ["local_turn_aliases", "context_expires_at"]) && safeRef(value.local_session_ref) && safeRef(value.local_turn_ref) && safeRef(value.local_input_ref) && validInputObservations(value.observations) && isCealHostInputKind(value.input_kind) && typeof value.origin_input === "boolean" && validInputOptionals(value);
1899
1870
  }
1900
1871
  function validInputObservations(value) {
1901
1872
  return validObservations(value) && Array.isArray(value) && value.filter((item) => record(item) && item.observation_kind === "prompt").length === 1;
1902
1873
  }
1903
1874
  function validInputOptionals(value) {
1904
- return validDecision(value.decision) && optionalRefs(value.local_turn_aliases) && (value.context_expires_at === void 0 || timestamp(value.context_expires_at));
1875
+ return optionalRefs(value.local_turn_aliases) && (value.context_expires_at === void 0 || timestamp(value.context_expires_at));
1905
1876
  }
1906
1877
  function validTerminal(value) {
1907
1878
  return exactOptional(value, ["local_session_ref", "local_turn_ref", "terminal_state"], ["abort_reason", "duration_ms", "time_to_first_token_ms", "usage", "observations"]) && safeRef(value.local_session_ref) && safeRef(value.local_turn_ref) && validTerminalDisposition(value.terminal_state, value.abort_reason) && optionalNonNegative(value.duration_ms) && optionalNonNegative(value.time_to_first_token_ms) && (value.usage === void 0 || jsonValue(value.usage)) && validObservations(value.observations);
@@ -1912,9 +1883,6 @@ function validTerminalDisposition(state, reason) {
1912
1883
  function validStatus(value) {
1913
1884
  return exactOptional(value, ["status", "reason_code"], ["detail"]) && ["ready", "degraded", "stopping"].includes(String(value.status)) && safeRef(value.reason_code) && optionalText(value.detail, 4096);
1914
1885
  }
1915
- function validDecision(value) {
1916
- return value === void 0 || record(value) && exactKeys2(value, ["decision", "approval_ref"]) && (value.decision === "approved" || value.decision === "denied") && safeRef(value.approval_ref);
1917
- }
1918
1886
  function optionalText(value, maxLength) {
1919
1887
  return value === void 0 || typeof value === "string" && value.length > 0 && value.length <= maxLength;
1920
1888
  }
@@ -2872,10 +2840,6 @@ var CodexOutboxStore = class {
2872
2840
  await removeOwnerState(this.registrationPath(registration.host_source_ref, registration.host_session_ref), "registration");
2873
2841
  await removeOwnerState(this.cursorPath(registration.host_source_ref, registration.host_session_ref), "cursor");
2874
2842
  }
2875
- async relayWakeDirectories() {
2876
- await this.prepare();
2877
- return { entries: this.entriesDirectory, registrations: this.registrationsDirectory };
2878
- }
2879
2843
  async listTranscriptRegistrations() {
2880
2844
  await this.prepare();
2881
2845
  const registrations = [];
@@ -3065,7 +3029,7 @@ async function readPrivateFile(path) {
3065
3029
  }
3066
3030
  function validateEnvelope(value) {
3067
3031
  if (!isRecord4(value)) throw storageError("Codex outbox entry is malformed.");
3068
- if (!sameKeys(value, ["schema_version", "identity", "host_input_ref", "prompt_ref", "observations", "origin_input", "submission_ref", "created_at", "expires_at"], ["request_ref", "codex_turn_id"])) throw storageError(`Codex outbox entry key set is malformed (${refusalFact("keys", Object.keys(value), "exactly the outbox entry key set")}).`);
3032
+ if (!sameKeys(value, ["schema_version", "identity", "host_input_ref", "input_kind", "prompt_ref", "observations", "origin_input", "submission_ref", "created_at", "expires_at"], ["request_ref", "codex_turn_id"])) throw storageError(`Codex outbox entry key set is malformed (${refusalFact("keys", Object.keys(value), "exactly the outbox entry key set")}).`);
3069
3033
  if (value.schema_version !== CODEX_OUTBOX_SCHEMA_VERSION) throw storageError(`Codex outbox entry is malformed (${refusalFact("schema_version", value.schema_version, `expected ${CODEX_OUTBOX_SCHEMA_VERSION}`)}).`);
3070
3034
  validateIdentity3(value.identity);
3071
3035
  validateEnvelopeReferences(value);
@@ -3074,6 +3038,7 @@ function validateEnvelope(value) {
3074
3038
  }
3075
3039
  function validateEnvelopeReferences(value) {
3076
3040
  if (!SAFE_REF6.test(String(value.host_input_ref))) throw storageError("Codex outbox input reference is malformed.");
3041
+ if (!isCealHostInputKind(value.input_kind)) throw storageError("Codex outbox input provenance is malformed.");
3077
3042
  if (!SAFE_REF6.test(String(value.prompt_ref))) throw storageError("Codex outbox references are malformed.");
3078
3043
  if (!SAFE_REF6.test(String(value.submission_ref))) throw storageError("Codex outbox references are malformed.");
3079
3044
  if (value.request_ref !== void 0 && !SAFE_REF6.test(String(value.request_ref))) throw storageError("Codex outbox Request reference is malformed.");
@@ -3316,6 +3281,7 @@ var CodexProducer = class {
3316
3281
  local_session_ref: envelope.identity.host_session_ref,
3317
3282
  local_turn_ref: localTurnRef(envelope),
3318
3283
  local_input_ref: envelope.host_input_ref,
3284
+ input_kind: envelope.input_kind,
3319
3285
  origin_input: envelope.origin_input,
3320
3286
  observations: [prompt],
3321
3287
  local_turn_aliases: envelope.codex_turn_id === void 0 ? void 0 : [envelope.codex_turn_id],
@@ -3533,18 +3499,24 @@ function decodeTokenUsage(value) {
3533
3499
  function decodeResponseItem(payload, ordinal, timestamp5) {
3534
3500
  if (payload.type !== "message" || payload.role !== "user") return { kind: "ignored", ordinal, timestamp: timestamp5 };
3535
3501
  const metadata = userMessageMetadata(payload.internal_chat_message_metadata_passthrough);
3536
- const kinds = metadata.content_item_kinds;
3537
- if (kinds.length !== 1 || kinds[0] !== "user.text") return { kind: "ignored", ordinal, timestamp: timestamp5 };
3502
+ const inputKind = inputKindFromContentItems(metadata.content_item_kinds);
3503
+ if (inputKind === void 0) return { kind: "ignored", ordinal, timestamp: timestamp5 };
3538
3504
  const prompt = userTextContent(payload.content);
3539
3505
  return {
3540
3506
  kind: "user_text",
3541
3507
  ordinal,
3542
3508
  timestamp: timestamp5,
3543
3509
  prompt,
3510
+ input_kind: inputKind,
3544
3511
  message_id: safeRef4(payload.id, "Codex user message identity is invalid."),
3545
3512
  turn_id: safeRef4(metadata.turn_id, "Codex user message task identity is invalid.")
3546
3513
  };
3547
3514
  }
3515
+ function inputKindFromContentItems(kinds) {
3516
+ if (kinds.length !== 1) return void 0;
3517
+ if (kinds[0] === "user.text") return "human";
3518
+ return kinds[0] === "goal.internal_context" ? "host_automatic" : void 0;
3519
+ }
3548
3520
  function userMessageMetadata(value) {
3549
3521
  if (!isRecord6(value) || !Array.isArray(value.content_item_kinds)) reject("Codex user message provenance is malformed.");
3550
3522
  return { ...value, content_item_kinds: value.content_item_kinds };
@@ -4129,6 +4101,7 @@ var CodexTranscriptWatcher = class {
4129
4101
  schema_version: "ceal.codex_observation_outbox.v1",
4130
4102
  identity,
4131
4103
  host_input_ref: hostInputRef,
4104
+ input_kind: record3.input_kind,
4132
4105
  prompt_ref: promptRef,
4133
4106
  observations,
4134
4107
  codex_turn_id: record3.turn_id,
@@ -4155,6 +4128,7 @@ var CodexTranscriptWatcher = class {
4155
4128
  schema_version: "ceal.codex_observation_outbox.v1",
4156
4129
  identity,
4157
4130
  host_input_ref: activeTask.origin_host_input_ref,
4131
+ input_kind: "host_automatic",
4158
4132
  prompt_ref: activeTask.prompt_ref,
4159
4133
  observations,
4160
4134
  codex_turn_id: record3.turn_id,