@corca-org/ceal-host-linux-arm64 1.0.16 → 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.
@@ -2329,7 +2329,7 @@ var CEAL_GATEWAY_DERIVED_STORE_FAILURE_CLASSES = vocabulary(["storage_unavailabl
2329
2329
  var CEAL_POLICY_DECISIONS = vocabulary(["allowed", "denied", "not_evaluated"]);
2330
2330
  var CEAL_CONNECTOR_ROUTE_PHASES = vocabulary(["scope_observation", "target_selection", "route_resolution"]);
2331
2331
  var CEAL_CONNECTOR_ROUTE_CAUSES = vocabulary(["provider_throttled", "provider_unavailable", "binding_invalid", "scope_limit_exceeded"]);
2332
- var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "agent_lease_admission", "provider_authenticated_event"]);
2332
+ var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "provider_authenticated_event"]);
2333
2333
  var CEAL_REFRESH_DELIVERIES = vocabulary(["initial", "recovery", "replay", "terminal_failure", "recovery_unavailable"]);
2334
2334
  var CEAL_CLIENT_OPERATIONS = vocabulary(["handshake", "discover", "call", "readback"]);
2335
2335
  var CEAL_WRITE_IDEMPOTENCY_POSTURES = vocabulary(["required", "optional", "not_required"]);
@@ -2482,6 +2482,7 @@ var CEAL_OPERATION_WITHHELD_CAUSES = vocabulary(["provider_permission", "access_
2482
2482
  // packages/ceal-client-protocol/src/operation-contract-types.ts
2483
2483
  var CEAL_JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
2484
2484
  var CEAL_OPERATION_ERROR_SCHEMA_VERSION = "ceal.operation_error.v1";
2485
+ var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
2485
2486
  var CEAL_RETRY_AFTER_MAX_MS = 60 * 60 * 1e3;
2486
2487
  var CEAL_JSON_SCHEMA_TYPES = vocabulary(["object", "array", "string", "integer", "number", "boolean", "null"]);
2487
2488
  var OBSERVATION_POSTURES = vocabulary(["direct_readback", "approved_no_readback", "operator_mediated", "excluded"]);
@@ -2855,9 +2856,6 @@ var CEAL_OPERATION_AUTHORITY_POLICY_KEYS = Object.freeze(["access_group", "insta
2855
2856
  var MAX_OPERATION_INPUT_RESOLVER_BINDINGS = 96;
2856
2857
  var CEAL_OPERATION_DESCRIPTOR_REQUIRED_ENVELOPE_KEYS = Object.freeze(["schema_version", "id", "input_contract", "result_contract", "policy"]);
2857
2858
  var CEAL_OPERATION_DESCRIPTOR_OPTIONAL_ENVELOPE_KEYS = Object.freeze(["input_resolution", "summary"]);
2858
- var CEAL_OPERATION_RESULT_KEYS = vocabulary(["ok", "operation_id", "operation_receipt", "schema_version", "value"]);
2859
- var CEAL_OPERATION_COMPACT_RESULT_KEYS = vocabulary(["ok", "operation_evidence", "operation_id", "schema_version", "value"]);
2860
- var CEAL_OPERATION_RESULT_OPTIONAL_KEYS = vocabulary(["model_disclosure", "result_complete", "resume"]);
2861
2859
 
2862
2860
  // packages/ceal-client-protocol/src/operation-catalog.ts
2863
2861
  var CEAL_OPERATION_CATALOG_SCHEMA_VERSION = "ceal.catalog.v3";
@@ -2921,10 +2919,6 @@ var CEAL_SCHEMA_LITERALS = [
2921
2919
  "ceal.host_observation.v1",
2922
2920
  "ceal.host_registration_request.v1",
2923
2921
  "ceal.host_registration_result.v1",
2924
- "ceal.leased-resource-stream.v1",
2925
- "ceal.leased_consumer_attachment_stream_frame.v1",
2926
- "ceal.leased_consumer_attachment_stream_request.v1",
2927
- "ceal.leased_consumer_attachment_stream_transport.v1",
2928
2922
  "ceal.operation_descriptor.v1",
2929
2923
  "ceal.operation_error.v1",
2930
2924
  "ceal.operation_failure.v1",
@@ -2950,12 +2944,6 @@ var CEAL_SCHEMA_LITERAL_SET = new Set(CEAL_SCHEMA_LITERALS);
2950
2944
  // packages/ceal-client-protocol/src/bounded-series.ts
2951
2945
  import { join } from "node:path";
2952
2946
  var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
2953
- usage_record: (root) => join(root, "run-usage.jsonl"),
2954
- control_commit: (root) => join(root, "control-auto-commit.jsonl"),
2955
- engagement_signal: (root) => join(root, "runtime-state", "slack-feedback.jsonl"),
2956
- runtime_error: (root) => join(root, "runtime-state", "runtime-errors.jsonl"),
2957
- turn_bridge_request: (root) => join(root, ".ceal", "turn-bridge", "requests.jsonl"),
2958
- thread_run_events: (root) => join(root, "run-events.jsonl"),
2959
2947
  bounded_store_sidecar: (root) => `${root}.jsonl`,
2960
2948
  gateway_audit_archive: (root) => `${root}.jsonl`,
2961
2949
  gateway_access_group_connector_control_audit: (root) => `${root}.audit.jsonl`,
@@ -2989,35 +2977,6 @@ var CEAL_HOST_INSTALLATION_REF_PATTERN = new RegExp(`^host-installation:${CEAL_L
2989
2977
  var CEAL_HOST_SOURCE_REF_PATTERN = new RegExp(`^host-source:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
2990
2978
  var CEAL_HOST_ACCESS_TOKEN_PATTERN = /^ceal_host_[A-Za-z0-9_-]{43}$/u;
2991
2979
 
2992
- // packages/ceal-client-protocol/src/agent-session-handoff.ts
2993
- var CEAL_AGENT_ADMISSION_PHASES = vocabulary([
2994
- "incumbent_admitted",
2995
- "incumbent_draining",
2996
- "drained",
2997
- "candidate_admitted",
2998
- "candidate_draining",
2999
- "rollback_admitted"
3000
- ]);
3001
- var CEAL_AGENT_SERVICE_SESSION_RECORD_KEYS = vocabulary([
3002
- "admission_fence",
3003
- "admission_state",
3004
- "admission_state_generation",
3005
- "bearer",
3006
- "consumer_ref",
3007
- "credential_generation",
3008
- "expires_at",
3009
- "gateway_instance",
3010
- "gateway_origin",
3011
- "gateway_serving_generation",
3012
- "issued_at",
3013
- "record_sha256",
3014
- "renew_after",
3015
- "renew_by",
3016
- "schema_version",
3017
- "session_revision"
3018
- ]);
3019
- var CEAL_AGENT_SESSION_COMMIT_KEYS = vocabulary(["attempt_ref", "expected_session_revision", "session_revision"]);
3020
-
3021
2980
  // packages/ceal-client-protocol/src/operation-result-completeness.ts
3022
2981
  var CEAL_READ_VALUE_CONTINUATION_KEYS = vocabulary(["continuation", "continuation_ref", "next_cursor"]);
3023
2982
 
@@ -3028,7 +2987,9 @@ var CEAL_OPERATION_INVOKE_COMMAND = "invoke";
3028
2987
  var CEAL_OPERATION_INPUT_FLAG = "--input";
3029
2988
  var CEAL_OPERATION_ID_PLACEHOLDER = "<operation-id>";
3030
2989
  var CEAL_OPERATION_INPUT_PLACEHOLDER = "<json-object>";
3031
- var CEAL_MODEL_INVOCATION_ARGUMENTS = [CEAL_OPERATION_INVOKE_COMMAND, CEAL_OPERATION_ID_PLACEHOLDER, CEAL_OPERATION_INPUT_FLAG, shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)].join(" ");
2990
+ var MODEL_INVOCATION_BASE_ARGUMENTS = [CEAL_OPERATION_INVOKE_COMMAND, CEAL_OPERATION_ID_PLACEHOLDER].join(" ");
2991
+ var CEAL_MODEL_INVOCATION_ARGUMENTS = [MODEL_INVOCATION_BASE_ARGUMENTS, CEAL_OPERATION_INPUT_FLAG, shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)].join(" ");
2992
+ 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.`;
3032
2993
  function shellSingleQuoted(value) {
3033
2994
  return `'${value.replaceAll("'", "'\\''")}'`;
3034
2995
  }
@@ -3060,6 +3021,45 @@ var CEAL_VERIFIED_ARTIFACT_DESCRIPTOR_JSON_SCHEMA = Object.freeze({
3060
3021
  }
3061
3022
  });
3062
3023
 
3024
+ // packages/ceal-client-protocol/src/provider-operation-vocabulary.ts
3025
+ var CEAL_FILE_TYPE_FAMILIES = vocabulary(["all", "image", "pdf"]);
3026
+ var CEAL_GITHUB_ISSUE_STATES = vocabulary(["open", "closed", "all"]);
3027
+ var CEAL_NOTION_UPDATABLE_BLOCK_TYPES = vocabulary([
3028
+ "paragraph",
3029
+ "heading_1",
3030
+ "heading_2",
3031
+ "heading_3",
3032
+ "bulleted_list_item",
3033
+ "numbered_list_item",
3034
+ "to_do",
3035
+ "code"
3036
+ ]);
3037
+ var CEAL_NOTION_NEUTRAL_TYPES = vocabulary([
3038
+ "text",
3039
+ "number",
3040
+ "boolean",
3041
+ "date",
3042
+ "select",
3043
+ "multi_select",
3044
+ "people",
3045
+ "url",
3046
+ "email",
3047
+ "phone",
3048
+ "unsupported"
3049
+ ]);
3050
+ var CEAL_NOTION_IDENTITY_GAP_REASONS = vocabulary([
3051
+ "identity_unavailable",
3052
+ "identity_stale",
3053
+ "identity_ambiguous",
3054
+ "identity_revoked",
3055
+ "identity_unlinked"
3056
+ ]);
3057
+ var CEAL_NOTION_STRING_VALUE_TYPES = vocabulary(["text", "select", "url", "email", "phone"]);
3058
+
3059
+ // packages/ceal-client-protocol/src/opaque-reference.ts
3060
+ var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "block", "object"]);
3061
+ var CEAL_OPAQUE_REF_KINDS = vocabulary([...CEAL_OPAQUE_HANDLE_KINDS, "result", "operation-receipt", "reply-receipt", "field", "notion-data-source"]);
3062
+
3063
3063
  // packages/ceal-client-protocol/src/bare-document.ts
3064
3064
  var REQUIRED_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_fields;
3065
3065
  var OPTIONAL_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_optional_fields;
@@ -3067,15 +3067,30 @@ var OPTIONAL_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_o
3067
3067
  // packages/ceal-client-protocol/src/runtime-executable-paths.ts
3068
3068
  var CEAL_SYSTEMCTL_EXECUTABLE_PATH = "/usr/bin/systemctl";
3069
3069
 
3070
- // packages/ceal-client-protocol/src/leased-consumer-vocabulary.ts
3071
- var CEAL_TERMINAL_DISPOSITIONS = vocabulary(["completed", "failed", "cancelled"]);
3072
- var CEAL_LEASE_DISPOSITIONS = vocabulary([...CEAL_TERMINAL_DISPOSITIONS, "deferred"]);
3073
- var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["initial"]);
3074
- var CEAL_LEASED_MESSAGE_DELIVERY_OPERATION_IDS = vocabulary(["message.send", "message.update", "message.delete"]);
3070
+ // packages/ceal-client-protocol/src/resource-row.ts
3071
+ var CEAL_RESOURCE_SEARCH_ORDERS = vocabulary(["relevance", "modified", "viewed", "created"]);
3072
+ var CEAL_RESOURCE_SEARCH_DIRECTIONS = vocabulary(["ascending", "descending"]);
3073
+ 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"]);
3074
+ var CEAL_RESOURCE_TIME_BASES = vocabulary(["created", "modified", "viewed"]);
3075
3075
  var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
3076
- var CEAL_RESULT_DELIVERY_OFFERS = vocabulary(["pending", "offered", "transport_lost"]);
3077
- var CEAL_RESULT_DELIVERY_STATES = vocabulary(["unavailable", ...CEAL_RESULT_DELIVERY_OFFERS]);
3078
- var CEAL_PROVIDER_OUTCOMES = vocabulary(["not_attempted", "outcome_unknown", "verified"]);
3076
+ var CEAL_ACTIVITY_V3_KINDS = vocabulary(["authored", "edited", "messaged", "responded"]);
3077
+ var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
3078
+ "message_created",
3079
+ "commit_authored",
3080
+ "resource_created",
3081
+ "review_submitted",
3082
+ "comment_created",
3083
+ "event_start",
3084
+ "all_day_start",
3085
+ "file_created",
3086
+ "file_modified",
3087
+ "file_modified_by_me",
3088
+ "file_viewed_by_me",
3089
+ "page_created",
3090
+ "page_last_edited",
3091
+ "resource_modified"
3092
+ ]);
3093
+ var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
3079
3094
  var CEAL_ACTIVITY_GAP_CODES = vocabulary([
3080
3095
  "provider_page_budget",
3081
3096
  "call_deadline",
@@ -3086,8 +3101,6 @@ var CEAL_ACTIVITY_GAP_CODES = vocabulary([
3086
3101
  "unsupported_event_kind",
3087
3102
  "direct_messages_excluded"
3088
3103
  ]);
3089
- var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
3090
- var CEAL_ACTIVITY_COVERAGE_STATUSES = vocabulary(["complete_for_target", "continuation_required", "blocked"]);
3091
3104
  var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
3092
3105
  "slack.message",
3093
3106
  "slack.reply",
@@ -3128,73 +3141,6 @@ var CEAL_ACTIVITY_EVENT_TIMESTAMP_BASIS_MAP = Object.freeze({
3128
3141
  "notion.page.created": "page_created",
3129
3142
  "notion.page.edited": "page_last_edited"
3130
3143
  });
3131
- var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
3132
- "message_created",
3133
- "commit_authored",
3134
- "resource_created",
3135
- "review_submitted",
3136
- "comment_created",
3137
- "event_start",
3138
- "all_day_start",
3139
- "file_created",
3140
- "file_modified",
3141
- "file_modified_by_me",
3142
- "file_viewed_by_me",
3143
- "page_created",
3144
- "page_last_edited",
3145
- "resource_modified"
3146
- ]);
3147
- var CEAL_ACTIVITY_V3_KINDS = vocabulary(["authored", "edited", "messaged", "responded"]);
3148
- var CEAL_RESOURCE_TIME_BASES = vocabulary(["created", "modified", "viewed"]);
3149
- var CEAL_RESOURCE_SEARCH_ORDERS = vocabulary(["relevance", "modified", "viewed", "created"]);
3150
- var CEAL_RESOURCE_SEARCH_DIRECTIONS = vocabulary(["ascending", "descending"]);
3151
- 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"]);
3152
- var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
3153
- var CEAL_READ_ITEM_KINDS = vocabulary(["conversation", "identity", "usergroup", "message", "file", "document"]);
3154
- var CEAL_LEASED_MESSAGE_SEARCH_COMPLETENESS = vocabulary(["complete", "continuation_available", "truncated"]);
3155
- var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "block", "object"]);
3156
- var CEAL_OPAQUE_REF_KINDS = vocabulary([...CEAL_OPAQUE_HANDLE_KINDS, "result", "operation-receipt", "reply-receipt", "field", "notion-data-source"]);
3157
- var CEAL_WRITE_OBJECT_KINDS = vocabulary(["document", "comment", "cell_range"]);
3158
- var CEAL_CONVERSATION_KINDS = vocabulary(["channel", "dm", "group"]);
3159
- var CEAL_FILE_TYPE_FAMILIES = vocabulary(["all", "image", "pdf"]);
3160
- var CEAL_GITHUB_ISSUE_STATES = vocabulary(["open", "closed", "all"]);
3161
- var CEAL_NOTION_UPDATABLE_BLOCK_TYPES = vocabulary([
3162
- "paragraph",
3163
- "heading_1",
3164
- "heading_2",
3165
- "heading_3",
3166
- "bulleted_list_item",
3167
- "numbered_list_item",
3168
- "to_do",
3169
- "code"
3170
- ]);
3171
- var CEAL_NOTION_NEUTRAL_TYPES = vocabulary([
3172
- "text",
3173
- "number",
3174
- "boolean",
3175
- "date",
3176
- "select",
3177
- "multi_select",
3178
- "people",
3179
- "url",
3180
- "email",
3181
- "phone",
3182
- "unsupported"
3183
- ]);
3184
- var CEAL_NOTION_IDENTITY_GAP_REASONS = vocabulary([
3185
- "identity_unavailable",
3186
- "identity_stale",
3187
- "identity_ambiguous",
3188
- "identity_revoked",
3189
- "identity_unlinked"
3190
- ]);
3191
- var CEAL_NOTION_STRING_VALUE_TYPES = vocabulary(["text", "select", "url", "email", "phone"]);
3192
- var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
3193
- var CEAL_PLAN_ITEM_STATUSES = vocabulary(["pending", "active", "completed"]);
3194
- var CEAL_FINAL_PRESENTATION_INTENTS = vocabulary(["final", "stop", "transient_notice"]);
3195
- var CEAL_PRESENTATION_INTENTS = vocabulary(["progress", ...CEAL_FINAL_PRESENTATION_INTENTS]);
3196
-
3197
- // packages/ceal-client-protocol/src/resource-row.ts
3198
3144
  var CEAL_DATED_NOTE_BASES = vocabulary(["recording", "calendar_event", "created_time"]);
3199
3145
  var CEAL_DATED_NOTE_TRANSCRIPT_STATES = vocabulary(["present", "absent", "unestablished"]);
3200
3146
  var CEAL_READ_SEARCH_COST_CLASSES = vocabulary(["native_index", "scan"]);
@@ -3279,17 +3225,6 @@ var CEAL_REFRESH_FAILURE_CODES = vocabulary([
3279
3225
  "refresh_recovery_expired"
3280
3226
  ]);
3281
3227
 
3282
- // packages/ceal-client-protocol/src/leased-artifact-contract.ts
3283
- var CEAL_LEASED_CONSUMER_ARTIFACT_CHUNK_MAX_BYTES = 12 * 1024;
3284
-
3285
- // packages/ceal-client-protocol/src/leased-resource-stream.ts
3286
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAGIC = new Uint8Array([67, 69, 65, 76, 82, 83, 50, 0]);
3287
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_RECORD_PREFIX_BYTES = 8;
3288
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAX_HEADER_BYTES = 16 * 1024;
3289
- var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_CHUNK_BYTES = 64 * 1024;
3290
- 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;
3291
- var CEAL_ATTACHMENT_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "digest_mismatch"]);
3292
-
3293
3228
  // packages/ceal-client-protocol/src/request-validation-primitives.ts
3294
3229
  import { createHash as createHash2 } from "node:crypto";
3295
3230
  var DIGEST = /^[a-f0-9]{64}$/u;
@@ -3457,6 +3392,10 @@ var CEAL_REQUEST_RUN_BATCH_JSON_SCHEMA = {
3457
3392
 
3458
3393
  // packages/ceal-client-protocol/src/host-observation.ts
3459
3394
  var CEAL_LOCAL_HOST_CAPABILITIES_SCHEMA_VERSION = "ceal.local_host_capabilities.v7";
3395
+ var CEAL_HOST_INPUT_KINDS = vocabulary(["human", "host_automatic"]);
3396
+ function isCealHostInputKind(value) {
3397
+ return typeof value === "string" && CEAL_HOST_INPUT_KINDS.some((kind) => kind === value);
3398
+ }
3460
3399
  var CEAL_HOST_OBSERVATION_REF_PREFIX = "host-observation:";
3461
3400
  var HOST_OBSERVATION_PRODUCER = /^[a-z][a-z0-9]{0,31}$/u;
3462
3401
  var HOST_OBSERVATION_DIGEST = /^[a-f0-9]{8,64}$/u;
@@ -3519,12 +3458,6 @@ var OWNER_WRITE_STATES = Object.freeze(["attempt_started", "provider_acknowledge
3519
3458
  var OWNER_EFFECT_STATES = Object.freeze(["none", "applied", "failed", "unknown", "reconciled"]);
3520
3459
  var OWNER_RECEIPT_STATES = Object.freeze(["pending", "available", "failed", "unknown", "reconciled"]);
3521
3460
 
3522
- // packages/ceal-client-protocol/src/thread-excerpt.ts
3523
- var CEAL_THREAD_RECENT_WINDOW = 6;
3524
- var CEAL_THREAD_LAST_APP_MESSAGES_WINDOW = 3;
3525
- var CEAL_THREAD_OLDER_SUMMARY_WINDOW = 4;
3526
- var CEAL_FED_THREAD_MESSAGE_LIMIT = CEAL_THREAD_RECENT_WINDOW + CEAL_THREAD_OLDER_SUMMARY_WINDOW + CEAL_THREAD_LAST_APP_MESSAGES_WINDOW;
3527
-
3528
3461
  // packages/ceal-client-protocol/src/request-graph-readiness.ts
3529
3462
  var REQUEST_GRAPH_PRODUCER_TO_APPEND_SCHEMA = {
3530
3463
  type: "object",
@@ -3614,27 +3547,15 @@ var CEAL_HOST_INVOCATION_AUTHENTICATION_RESULT_MAX_BYTES = new TextEncoder().enc
3614
3547
  `).byteLength;
3615
3548
 
3616
3549
  // packages/ceal-client-protocol/src/client-result-materialization.ts
3550
+ var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
3617
3551
  var CEAL_MODEL_VISIBLE_COMMAND_OUTPUT_MAX_BYTES = 32 * 1024;
3618
3552
  var REQUIRED_FIELDS2 = Object.freeze(["schema_version", "operation_id"]);
3619
3553
  var FIELDS = /* @__PURE__ */ new Set([...REQUIRED_FIELDS2, "read_argv", "local_result_root", "continue_argv", "model_disclosure", "item_read_argv"]);
3620
3554
 
3621
3555
  // packages/ceal-client-protocol/src/session-start-affordance.ts
3622
3556
  var CEAL_SESSION_ENTRY_INVOCATION = "ceal";
3623
- 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.`;
3624
3557
  var HOST_HOOK_TIMEOUT_SECONDS = 1;
3625
3558
 
3626
- // packages/ceal-client-protocol/src/conversation-contracts.ts
3627
- var CEAL_APPROVAL_POLICY_KINDS = vocabulary(["requester_only", "named_users", "role_based"]);
3628
- var CEAL_APPROVAL_TARGET_KINDS = vocabulary([
3629
- "repo_change",
3630
- "investigation",
3631
- "skill_creation",
3632
- "command_creation",
3633
- "connector_creation",
3634
- "generic"
3635
- ]);
3636
- var CEAL_PROGRESS_PHASES = vocabulary(["request_review", "information_gathering", "work_execution", "result_check"]);
3637
-
3638
3559
  // packages/ceal-client-protocol/src/gateway-cache-origin-validation.ts
3639
3560
  var CEAL_MAX_CACHE_ORIGIN_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
3640
3561
 
@@ -3883,13 +3804,13 @@ function validTurn(value) {
3883
3804
  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);
3884
3805
  }
3885
3806
  function validInput(value) {
3886
- 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);
3807
+ 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);
3887
3808
  }
3888
3809
  function validInputObservations(value) {
3889
3810
  return validObservations(value) && Array.isArray(value) && value.filter((item) => record(item) && item.observation_kind === "prompt").length === 1;
3890
3811
  }
3891
3812
  function validInputOptionals(value) {
3892
- return validDecision(value.decision) && optionalRefs(value.local_turn_aliases) && (value.context_expires_at === void 0 || timestamp(value.context_expires_at));
3813
+ return optionalRefs(value.local_turn_aliases) && (value.context_expires_at === void 0 || timestamp(value.context_expires_at));
3893
3814
  }
3894
3815
  function validTerminal(value) {
3895
3816
  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);
@@ -3900,9 +3821,6 @@ function validTerminalDisposition(state, reason) {
3900
3821
  function validStatus(value) {
3901
3822
  return exactOptional(value, ["status", "reason_code"], ["detail"]) && ["ready", "degraded", "stopping"].includes(String(value.status)) && safeRef(value.reason_code) && optionalText(value.detail, 4096);
3902
3823
  }
3903
- function validDecision(value) {
3904
- return value === void 0 || record(value) && exactKeys(value, ["decision", "approval_ref"]) && (value.decision === "approved" || value.decision === "denied") && safeRef(value.approval_ref);
3905
- }
3906
3824
  function optionalText(value, maxLength) {
3907
3825
  return value === void 0 || typeof value === "string" && value.length > 0 && value.length <= maxLength;
3908
3826
  }
@@ -5103,10 +5021,6 @@ var CodexOutboxStore = class {
5103
5021
  await removeOwnerState(this.registrationPath(registration.host_source_ref, registration.host_session_ref), "registration");
5104
5022
  await removeOwnerState(this.cursorPath(registration.host_source_ref, registration.host_session_ref), "cursor");
5105
5023
  }
5106
- async relayWakeDirectories() {
5107
- await this.prepare();
5108
- return { entries: this.entriesDirectory, registrations: this.registrationsDirectory };
5109
- }
5110
5024
  async listTranscriptRegistrations() {
5111
5025
  await this.prepare();
5112
5026
  const registrations = [];
@@ -5296,7 +5210,7 @@ async function readPrivateFile(path) {
5296
5210
  }
5297
5211
  function validateEnvelope(value) {
5298
5212
  if (!isRecord3(value)) throw storageError("Codex outbox entry is malformed.");
5299
- 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")}).`);
5213
+ 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")}).`);
5300
5214
  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}`)}).`);
5301
5215
  validateIdentity4(value.identity);
5302
5216
  validateEnvelopeReferences(value);
@@ -5305,6 +5219,7 @@ function validateEnvelope(value) {
5305
5219
  }
5306
5220
  function validateEnvelopeReferences(value) {
5307
5221
  if (!SAFE_REF6.test(String(value.host_input_ref))) throw storageError("Codex outbox input reference is malformed.");
5222
+ if (!isCealHostInputKind(value.input_kind)) throw storageError("Codex outbox input provenance is malformed.");
5308
5223
  if (!SAFE_REF6.test(String(value.prompt_ref))) throw storageError("Codex outbox references are malformed.");
5309
5224
  if (!SAFE_REF6.test(String(value.submission_ref))) throw storageError("Codex outbox references are malformed.");
5310
5225
  if (value.request_ref !== void 0 && !SAFE_REF6.test(String(value.request_ref))) throw storageError("Codex outbox Request reference is malformed.");
@@ -5544,6 +5459,7 @@ var CodexProducer = class {
5544
5459
  local_session_ref: envelope.identity.host_session_ref,
5545
5460
  local_turn_ref: localTurnRef(envelope),
5546
5461
  local_input_ref: envelope.host_input_ref,
5462
+ input_kind: envelope.input_kind,
5547
5463
  origin_input: envelope.origin_input,
5548
5464
  observations: [prompt],
5549
5465
  local_turn_aliases: envelope.codex_turn_id === void 0 ? void 0 : [envelope.codex_turn_id],
@@ -5791,18 +5707,24 @@ function decodeTokenUsage(value) {
5791
5707
  function decodeResponseItem(payload, ordinal, timestamp7) {
5792
5708
  if (payload.type !== "message" || payload.role !== "user") return { kind: "ignored", ordinal, timestamp: timestamp7 };
5793
5709
  const metadata = userMessageMetadata(payload.internal_chat_message_metadata_passthrough);
5794
- const kinds = metadata.content_item_kinds;
5795
- if (kinds.length !== 1 || kinds[0] !== "user.text") return { kind: "ignored", ordinal, timestamp: timestamp7 };
5710
+ const inputKind = inputKindFromContentItems(metadata.content_item_kinds);
5711
+ if (inputKind === void 0) return { kind: "ignored", ordinal, timestamp: timestamp7 };
5796
5712
  const prompt = userTextContent(payload.content);
5797
5713
  return {
5798
5714
  kind: "user_text",
5799
5715
  ordinal,
5800
5716
  timestamp: timestamp7,
5801
5717
  prompt,
5718
+ input_kind: inputKind,
5802
5719
  message_id: safeRef5(payload.id, "Codex user message identity is invalid."),
5803
5720
  turn_id: safeRef5(metadata.turn_id, "Codex user message task identity is invalid.")
5804
5721
  };
5805
5722
  }
5723
+ function inputKindFromContentItems(kinds) {
5724
+ if (kinds.length !== 1) return void 0;
5725
+ if (kinds[0] === "user.text") return "human";
5726
+ return kinds[0] === "goal.internal_context" ? "host_automatic" : void 0;
5727
+ }
5806
5728
  function userMessageMetadata(value) {
5807
5729
  if (!isRecord5(value) || !Array.isArray(value.content_item_kinds)) reject("Codex user message provenance is malformed.");
5808
5730
  return { ...value, content_item_kinds: value.content_item_kinds };
@@ -6387,6 +6309,7 @@ var CodexTranscriptWatcher = class {
6387
6309
  schema_version: "ceal.codex_observation_outbox.v1",
6388
6310
  identity,
6389
6311
  host_input_ref: hostInputRef,
6312
+ input_kind: record8.input_kind,
6390
6313
  prompt_ref: promptRef,
6391
6314
  observations,
6392
6315
  codex_turn_id: record8.turn_id,
@@ -6413,6 +6336,7 @@ var CodexTranscriptWatcher = class {
6413
6336
  schema_version: "ceal.codex_observation_outbox.v1",
6414
6337
  identity,
6415
6338
  host_input_ref: activeTask.origin_host_input_ref,
6339
+ input_kind: "host_automatic",
6416
6340
  prompt_ref: activeTask.prompt_ref,
6417
6341
  observations,
6418
6342
  codex_turn_id: record8.turn_id,
@@ -6819,9 +6743,9 @@ function hookDriftRemedy(reasons) {
6819
6743
  }
6820
6744
 
6821
6745
  // host/host-entry-links.ts
6822
- import { lstat as lstat7, mkdir as mkdir6, readlink, rename as rename5, rm as rm2, symlink } from "node:fs/promises";
6746
+ import { lstat as lstat7, mkdir as mkdir6, readlink, realpath, rename as rename5, rm as rm2, stat, symlink } from "node:fs/promises";
6823
6747
  import { homedir } from "node:os";
6824
- import { basename, dirname as dirname5, isAbsolute as isAbsolute2, join as join7 } from "node:path";
6748
+ import { basename, dirname as dirname5, isAbsolute as isAbsolute2, join as join7, normalize, parse } from "node:path";
6825
6749
  var HOST_ENTRY_RUNTIME_LINK = "runtime";
6826
6750
  var HOST_ENTRY_SERVICES_LINK = "services";
6827
6751
  var HOST_ENTRY_DIRECTORY = [".ceal", "host-entry"];
@@ -7380,9 +7304,7 @@ function validateOptionalInstallerPaths(options) {
7380
7304
  }
7381
7305
  var CODEX_LOCAL_CAPABILITY_OWNER = CODEX_HOOK_OWNER;
7382
7306
  function resolveCodexLocalCapabilityPath(configPath) {
7383
- const configDirectory = dirname7(configPath);
7384
- const userRoot = basename2(configDirectory) === ".codex" ? dirname7(configDirectory) : configDirectory;
7385
- return join10(userRoot, ".ceal", "local-capabilities", "codex.json");
7307
+ return join10(resolveHostEntryRoot(dirname7(configPath), ".codex"), "..", "local-capabilities", "codex.json");
7386
7308
  }
7387
7309
  function resolveLocalCapabilityInstallation(options, configPath) {
7388
7310
  return { authenticationCommand: { executable: options.invocation_authentication_executable ?? resolveRepoCodexInvocationAuthenticationExecutable(), args: options.invocation_authentication_arguments ?? [] }, localCapabilityPath: options.local_capability_path ?? resolveCodexLocalCapabilityPath(configPath) };
@@ -8200,7 +8122,7 @@ import { createHash as createHash9 } from "node:crypto";
8200
8122
 
8201
8123
  // host/service-log.ts
8202
8124
  import { constants as constants3 } from "node:fs";
8203
- import { copyFile as copyFile3, open as open10, stat, truncate } from "node:fs/promises";
8125
+ import { copyFile as copyFile3, open as open10, stat as stat2, truncate } from "node:fs/promises";
8204
8126
  var HOST_SERVICE_LOG_ENVIRONMENT = "CEAL_HOST_SERVICE_LOG";
8205
8127
  var HOST_SERVICE_LOG_MAX_BYTES = 1024 * 1024;
8206
8128
  function hostServiceLogPreviousPath(path) {
@@ -8955,11 +8877,10 @@ function createLinuxUserSystemdAdapter(options) {
8955
8877
  const previousByComponent = serviceMap(previous);
8956
8878
  const targetByComponent = serviceMap(target);
8957
8879
  await ensurePrivateUnitDirectory(unitDirectory);
8958
- const ownedUnits = await ownedHostUnits(unitDirectory);
8880
+ const removableUnits = await ownedHostUnits(unitDirectory, identity);
8959
8881
  for (const service of target.services) await replaceOwnedUnit(unitDirectory, identity, service);
8960
- const removableUnits = target.services.length === 0 ? ownedUnits.filter((unit) => unit.identity === identity) : ownedUnits;
8961
8882
  for (const unit of removableUnits) {
8962
- if (unit.identity === identity && targetByComponent.has(unit.component)) continue;
8883
+ if (targetByComponent.has(unit.component)) continue;
8963
8884
  await invokeSystemctl(run, systemctl, ["--user", "disable", "--now", unitName(unit.identity, unit.component)]);
8964
8885
  await removeOwnedUnit(unitDirectory, unit.identity, unit.component);
8965
8886
  }
@@ -8970,7 +8891,7 @@ function createLinuxUserSystemdAdapter(options) {
8970
8891
  if (previousByComponent.has(service.component)) await invokeSystemctl(run, systemctl, ["--user", "restart", name]);
8971
8892
  await requireExpectedReadback(run, systemctl, unitDirectory, identity, service, "running");
8972
8893
  }
8973
- for (const unit of removableUnits) if (unit.identity !== identity || !targetByComponent.has(unit.component)) await requireAbsentReadback(run, systemctl, unitDirectory, unit.identity, unit.component);
8894
+ for (const unit of removableUnits) if (!targetByComponent.has(unit.component)) await requireAbsentReadback(run, systemctl, unitDirectory, unit.identity, unit.component);
8974
8895
  },
8975
8896
  async restart({ target, service }) {
8976
8897
  const identity = prefixIdentity(target.prefix);
@@ -9020,15 +8941,15 @@ function unitPath(directory, identity, component) {
9020
8941
  function serviceMap(set) {
9021
8942
  return new Map(set.services.map((service) => [service.component, service]));
9022
8943
  }
9023
- async function ownedHostUnits(directory) {
8944
+ async function ownedHostUnits(directory, identity) {
9024
8945
  const owned = [];
9025
8946
  for (const name of await readdir3(directory)) {
9026
8947
  const match = /^ceal-host-([a-f0-9]{64})-(lifecycle|relay|codex|claude)\.service$/u.exec(name);
9027
8948
  if (match === null) continue;
9028
- const identity = match[1];
8949
+ const unitIdentity = match[1];
9029
8950
  const component = match[2];
9030
- if (identity === void 0 || !UNIT_ID_PATTERN.test(identity) || !isHostRuntimeServiceComponent(component)) continue;
9031
- if (await ownedUnitPresent(unitPath(directory, identity, component), identity, component)) owned.push({ identity, component });
8951
+ if (unitIdentity !== identity || !UNIT_ID_PATTERN.test(unitIdentity) || !isHostRuntimeServiceComponent(component)) continue;
8952
+ if (await ownedUnitPresent(unitPath(directory, unitIdentity, component), unitIdentity, component)) owned.push({ identity: unitIdentity, component });
9032
8953
  }
9033
8954
  return owned.sort((left, right) => unitName(left.identity, left.component).localeCompare(unitName(right.identity, right.component)));
9034
8955
  }
@@ -9038,8 +8959,8 @@ function isHostRuntimeServiceComponent(value) {
9038
8959
  async function ensurePrivateUnitDirectory(directory) {
9039
8960
  try {
9040
8961
  await mkdir10(directory, { recursive: true, mode: 448 });
9041
- const stat2 = await lstat12(directory);
9042
- if (!stat2.isDirectory() || stat2.isSymbolicLink() || typeof process.getuid === "function" && stat2.uid !== process.getuid()) throw projectionError();
8962
+ const stat3 = await lstat12(directory);
8963
+ if (!stat3.isDirectory() || stat3.isSymbolicLink() || typeof process.getuid === "function" && stat3.uid !== process.getuid()) throw projectionError();
9043
8964
  await chmod3(directory, 448);
9044
8965
  } catch (error) {
9045
8966
  if (isAdapterError(error)) throw error;
@@ -9048,8 +8969,8 @@ async function ensurePrivateUnitDirectory(directory) {
9048
8969
  }
9049
8970
  async function ownedUnitPresent(path, identity, component) {
9050
8971
  try {
9051
- const stat2 = await lstat12(path);
9052
- if (!stat2.isFile() || stat2.isSymbolicLink() || (stat2.mode & 63) !== 0 || typeof process.getuid === "function" && stat2.uid !== process.getuid()) throw projectionError();
8972
+ const stat3 = await lstat12(path);
8973
+ if (!stat3.isFile() || stat3.isSymbolicLink() || (stat3.mode & 63) !== 0 || typeof process.getuid === "function" && stat3.uid !== process.getuid()) throw projectionError();
9053
8974
  const bytes = await readFile6(path);
9054
8975
  if (bytes.byteLength > MAX_COMMAND_OUTPUT_BYTES) throw projectionError(refusalFact("unit_bytes", bytes.byteLength, `at most ${MAX_COMMAND_OUTPUT_BYTES}`));
9055
8976
  if (!bytes.toString("utf8").startsWith(ownerPreamble(identity, component))) throw projectionError(refusalFact("owner_preamble", ownerPreamble(identity, component), "the first line of the projected unit"));