@corca-org/ceal-host-win32-x64 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.
- package/bin/ceal-host.exe +0 -0
- package/libexec/ceal-host/claude-hook.mjs +75 -157
- package/libexec/ceal-host/claude-invocation-authentication.mjs +74 -159
- package/libexec/ceal-host/claude-producer.mjs +74 -159
- package/libexec/ceal-host/codex-hook.mjs +94 -277
- package/libexec/ceal-host/codex-invocation-authentication.mjs +87 -166
- package/libexec/ceal-host/codex-producer.mjs +87 -166
- package/libexec/ceal-host/control.mjs +102 -181
- package/libexec/ceal-host/relay.mjs +103 -172
- package/package.json +1 -1
- package/share/ceal-host/bundle-manifest.json +12 -12
- package/share/ceal-host/bundle-manifest.sigstore.json +1 -1
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
import { createRequire as __cealCreateRequire } from "node:module";
|
|
3
3
|
const require = __cealCreateRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
// host/codex/src/codex-hook-runner.ts
|
|
6
|
-
import { homedir as homedir3 } from "node:os";
|
|
7
|
-
import { join as join6 } from "node:path";
|
|
8
|
-
|
|
9
5
|
// host/codex/src/codex-adapter.ts
|
|
10
6
|
import { homedir } from "node:os";
|
|
11
7
|
import { isAbsolute as isAbsolute3, join as join3, relative, resolve as resolve2 } from "node:path";
|
|
@@ -220,7 +216,7 @@ var CEAL_GATEWAY_DERIVED_STORE_FAILURE_CLASSES = vocabulary(["storage_unavailabl
|
|
|
220
216
|
var CEAL_POLICY_DECISIONS = vocabulary(["allowed", "denied", "not_evaluated"]);
|
|
221
217
|
var CEAL_CONNECTOR_ROUTE_PHASES = vocabulary(["scope_observation", "target_selection", "route_resolution"]);
|
|
222
218
|
var CEAL_CONNECTOR_ROUTE_CAUSES = vocabulary(["provider_throttled", "provider_unavailable", "binding_invalid", "scope_limit_exceeded"]);
|
|
223
|
-
var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "
|
|
219
|
+
var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "provider_authenticated_event"]);
|
|
224
220
|
var CEAL_REFRESH_DELIVERIES = vocabulary(["initial", "recovery", "replay", "terminal_failure", "recovery_unavailable"]);
|
|
225
221
|
var CEAL_CLIENT_OPERATIONS = vocabulary(["handshake", "discover", "call", "readback"]);
|
|
226
222
|
var CEAL_WRITE_IDEMPOTENCY_POSTURES = vocabulary(["required", "optional", "not_required"]);
|
|
@@ -373,6 +369,7 @@ var CEAL_OPERATION_WITHHELD_CAUSES = vocabulary(["provider_permission", "access_
|
|
|
373
369
|
// packages/ceal-client-protocol/src/operation-contract-types.ts
|
|
374
370
|
var CEAL_JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
375
371
|
var CEAL_OPERATION_ERROR_SCHEMA_VERSION = "ceal.operation_error.v1";
|
|
372
|
+
var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
|
|
376
373
|
var CEAL_RETRY_AFTER_MAX_MS = 60 * 60 * 1e3;
|
|
377
374
|
var CEAL_JSON_SCHEMA_TYPES = vocabulary(["object", "array", "string", "integer", "number", "boolean", "null"]);
|
|
378
375
|
var OBSERVATION_POSTURES = vocabulary(["direct_readback", "approved_no_readback", "operator_mediated", "excluded"]);
|
|
@@ -746,9 +743,6 @@ var CEAL_OPERATION_AUTHORITY_POLICY_KEYS = Object.freeze(["access_group", "insta
|
|
|
746
743
|
var MAX_OPERATION_INPUT_RESOLVER_BINDINGS = 96;
|
|
747
744
|
var CEAL_OPERATION_DESCRIPTOR_REQUIRED_ENVELOPE_KEYS = Object.freeze(["schema_version", "id", "input_contract", "result_contract", "policy"]);
|
|
748
745
|
var CEAL_OPERATION_DESCRIPTOR_OPTIONAL_ENVELOPE_KEYS = Object.freeze(["input_resolution", "summary"]);
|
|
749
|
-
var CEAL_OPERATION_RESULT_KEYS = vocabulary(["ok", "operation_id", "operation_receipt", "schema_version", "value"]);
|
|
750
|
-
var CEAL_OPERATION_COMPACT_RESULT_KEYS = vocabulary(["ok", "operation_evidence", "operation_id", "schema_version", "value"]);
|
|
751
|
-
var CEAL_OPERATION_RESULT_OPTIONAL_KEYS = vocabulary(["model_disclosure", "result_complete", "resume"]);
|
|
752
746
|
|
|
753
747
|
// packages/ceal-client-protocol/src/operation-catalog.ts
|
|
754
748
|
var CEAL_OPERATION_CATALOG_SCHEMA_VERSION = "ceal.catalog.v3";
|
|
@@ -812,10 +806,6 @@ var CEAL_SCHEMA_LITERALS = [
|
|
|
812
806
|
"ceal.host_observation.v1",
|
|
813
807
|
"ceal.host_registration_request.v1",
|
|
814
808
|
"ceal.host_registration_result.v1",
|
|
815
|
-
"ceal.leased-resource-stream.v1",
|
|
816
|
-
"ceal.leased_consumer_attachment_stream_frame.v1",
|
|
817
|
-
"ceal.leased_consumer_attachment_stream_request.v1",
|
|
818
|
-
"ceal.leased_consumer_attachment_stream_transport.v1",
|
|
819
809
|
"ceal.operation_descriptor.v1",
|
|
820
810
|
"ceal.operation_error.v1",
|
|
821
811
|
"ceal.operation_failure.v1",
|
|
@@ -841,12 +831,6 @@ var CEAL_SCHEMA_LITERAL_SET = new Set(CEAL_SCHEMA_LITERALS);
|
|
|
841
831
|
// packages/ceal-client-protocol/src/bounded-series.ts
|
|
842
832
|
import { join } from "node:path";
|
|
843
833
|
var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
|
|
844
|
-
usage_record: (root) => join(root, "run-usage.jsonl"),
|
|
845
|
-
control_commit: (root) => join(root, "control-auto-commit.jsonl"),
|
|
846
|
-
engagement_signal: (root) => join(root, "runtime-state", "slack-feedback.jsonl"),
|
|
847
|
-
runtime_error: (root) => join(root, "runtime-state", "runtime-errors.jsonl"),
|
|
848
|
-
turn_bridge_request: (root) => join(root, ".ceal", "turn-bridge", "requests.jsonl"),
|
|
849
|
-
thread_run_events: (root) => join(root, "run-events.jsonl"),
|
|
850
834
|
bounded_store_sidecar: (root) => `${root}.jsonl`,
|
|
851
835
|
gateway_audit_archive: (root) => `${root}.jsonl`,
|
|
852
836
|
gateway_access_group_connector_control_audit: (root) => `${root}.audit.jsonl`,
|
|
@@ -879,35 +863,6 @@ var CEAL_HOST_REGISTRATION_ATTEMPT_REF_PATTERN = new RegExp(`^host-registration-
|
|
|
879
863
|
var CEAL_HOST_INSTALLATION_REF_PATTERN = new RegExp(`^host-installation:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
|
|
880
864
|
var CEAL_HOST_SOURCE_REF_PATTERN = new RegExp(`^host-source:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
|
|
881
865
|
|
|
882
|
-
// packages/ceal-client-protocol/src/agent-session-handoff.ts
|
|
883
|
-
var CEAL_AGENT_ADMISSION_PHASES = vocabulary([
|
|
884
|
-
"incumbent_admitted",
|
|
885
|
-
"incumbent_draining",
|
|
886
|
-
"drained",
|
|
887
|
-
"candidate_admitted",
|
|
888
|
-
"candidate_draining",
|
|
889
|
-
"rollback_admitted"
|
|
890
|
-
]);
|
|
891
|
-
var CEAL_AGENT_SERVICE_SESSION_RECORD_KEYS = vocabulary([
|
|
892
|
-
"admission_fence",
|
|
893
|
-
"admission_state",
|
|
894
|
-
"admission_state_generation",
|
|
895
|
-
"bearer",
|
|
896
|
-
"consumer_ref",
|
|
897
|
-
"credential_generation",
|
|
898
|
-
"expires_at",
|
|
899
|
-
"gateway_instance",
|
|
900
|
-
"gateway_origin",
|
|
901
|
-
"gateway_serving_generation",
|
|
902
|
-
"issued_at",
|
|
903
|
-
"record_sha256",
|
|
904
|
-
"renew_after",
|
|
905
|
-
"renew_by",
|
|
906
|
-
"schema_version",
|
|
907
|
-
"session_revision"
|
|
908
|
-
]);
|
|
909
|
-
var CEAL_AGENT_SESSION_COMMIT_KEYS = vocabulary(["attempt_ref", "expected_session_revision", "session_revision"]);
|
|
910
|
-
|
|
911
866
|
// packages/ceal-client-protocol/src/operation-result-completeness.ts
|
|
912
867
|
var CEAL_READ_VALUE_CONTINUATION_KEYS = vocabulary(["continuation", "continuation_ref", "next_cursor"]);
|
|
913
868
|
|
|
@@ -918,7 +873,9 @@ var CEAL_OPERATION_INVOKE_COMMAND = "invoke";
|
|
|
918
873
|
var CEAL_OPERATION_INPUT_FLAG = "--input";
|
|
919
874
|
var CEAL_OPERATION_ID_PLACEHOLDER = "<operation-id>";
|
|
920
875
|
var CEAL_OPERATION_INPUT_PLACEHOLDER = "<json-object>";
|
|
921
|
-
var
|
|
876
|
+
var MODEL_INVOCATION_BASE_ARGUMENTS = [CEAL_OPERATION_INVOKE_COMMAND, CEAL_OPERATION_ID_PLACEHOLDER].join(" ");
|
|
877
|
+
var CEAL_MODEL_INVOCATION_ARGUMENTS = [MODEL_INVOCATION_BASE_ARGUMENTS, CEAL_OPERATION_INPUT_FLAG, shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)].join(" ");
|
|
878
|
+
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.`;
|
|
922
879
|
function shellSingleQuoted(value) {
|
|
923
880
|
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
924
881
|
}
|
|
@@ -950,19 +907,73 @@ var CEAL_VERIFIED_ARTIFACT_DESCRIPTOR_JSON_SCHEMA = Object.freeze({
|
|
|
950
907
|
}
|
|
951
908
|
});
|
|
952
909
|
|
|
910
|
+
// packages/ceal-client-protocol/src/provider-operation-vocabulary.ts
|
|
911
|
+
var CEAL_FILE_TYPE_FAMILIES = vocabulary(["all", "image", "pdf"]);
|
|
912
|
+
var CEAL_GITHUB_ISSUE_STATES = vocabulary(["open", "closed", "all"]);
|
|
913
|
+
var CEAL_NOTION_UPDATABLE_BLOCK_TYPES = vocabulary([
|
|
914
|
+
"paragraph",
|
|
915
|
+
"heading_1",
|
|
916
|
+
"heading_2",
|
|
917
|
+
"heading_3",
|
|
918
|
+
"bulleted_list_item",
|
|
919
|
+
"numbered_list_item",
|
|
920
|
+
"to_do",
|
|
921
|
+
"code"
|
|
922
|
+
]);
|
|
923
|
+
var CEAL_NOTION_NEUTRAL_TYPES = vocabulary([
|
|
924
|
+
"text",
|
|
925
|
+
"number",
|
|
926
|
+
"boolean",
|
|
927
|
+
"date",
|
|
928
|
+
"select",
|
|
929
|
+
"multi_select",
|
|
930
|
+
"people",
|
|
931
|
+
"url",
|
|
932
|
+
"email",
|
|
933
|
+
"phone",
|
|
934
|
+
"unsupported"
|
|
935
|
+
]);
|
|
936
|
+
var CEAL_NOTION_IDENTITY_GAP_REASONS = vocabulary([
|
|
937
|
+
"identity_unavailable",
|
|
938
|
+
"identity_stale",
|
|
939
|
+
"identity_ambiguous",
|
|
940
|
+
"identity_revoked",
|
|
941
|
+
"identity_unlinked"
|
|
942
|
+
]);
|
|
943
|
+
var CEAL_NOTION_STRING_VALUE_TYPES = vocabulary(["text", "select", "url", "email", "phone"]);
|
|
944
|
+
|
|
945
|
+
// packages/ceal-client-protocol/src/opaque-reference.ts
|
|
946
|
+
var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "block", "object"]);
|
|
947
|
+
var CEAL_OPAQUE_REF_KINDS = vocabulary([...CEAL_OPAQUE_HANDLE_KINDS, "result", "operation-receipt", "reply-receipt", "field", "notion-data-source"]);
|
|
948
|
+
|
|
953
949
|
// packages/ceal-client-protocol/src/bare-document.ts
|
|
954
950
|
var REQUIRED_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_fields;
|
|
955
951
|
var OPTIONAL_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_optional_fields;
|
|
956
952
|
|
|
957
|
-
// packages/ceal-client-protocol/src/
|
|
958
|
-
var
|
|
959
|
-
var
|
|
960
|
-
var
|
|
961
|
-
var
|
|
953
|
+
// packages/ceal-client-protocol/src/resource-row.ts
|
|
954
|
+
var CEAL_RESOURCE_SEARCH_ORDERS = vocabulary(["relevance", "modified", "viewed", "created"]);
|
|
955
|
+
var CEAL_RESOURCE_SEARCH_DIRECTIONS = vocabulary(["ascending", "descending"]);
|
|
956
|
+
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"]);
|
|
957
|
+
var CEAL_RESOURCE_TIME_BASES = vocabulary(["created", "modified", "viewed"]);
|
|
962
958
|
var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
|
|
963
|
-
var
|
|
964
|
-
var
|
|
965
|
-
|
|
959
|
+
var CEAL_ACTIVITY_V3_KINDS = vocabulary(["authored", "edited", "messaged", "responded"]);
|
|
960
|
+
var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
|
|
961
|
+
"message_created",
|
|
962
|
+
"commit_authored",
|
|
963
|
+
"resource_created",
|
|
964
|
+
"review_submitted",
|
|
965
|
+
"comment_created",
|
|
966
|
+
"event_start",
|
|
967
|
+
"all_day_start",
|
|
968
|
+
"file_created",
|
|
969
|
+
"file_modified",
|
|
970
|
+
"file_modified_by_me",
|
|
971
|
+
"file_viewed_by_me",
|
|
972
|
+
"page_created",
|
|
973
|
+
"page_last_edited",
|
|
974
|
+
"resource_modified"
|
|
975
|
+
]);
|
|
976
|
+
var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
|
|
966
977
|
var CEAL_ACTIVITY_GAP_CODES = vocabulary([
|
|
967
978
|
"provider_page_budget",
|
|
968
979
|
"call_deadline",
|
|
@@ -973,8 +984,6 @@ var CEAL_ACTIVITY_GAP_CODES = vocabulary([
|
|
|
973
984
|
"unsupported_event_kind",
|
|
974
985
|
"direct_messages_excluded"
|
|
975
986
|
]);
|
|
976
|
-
var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
|
|
977
|
-
var CEAL_ACTIVITY_COVERAGE_STATUSES = vocabulary(["complete_for_target", "continuation_required", "blocked"]);
|
|
978
987
|
var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
|
|
979
988
|
"slack.message",
|
|
980
989
|
"slack.reply",
|
|
@@ -1015,73 +1024,6 @@ var CEAL_ACTIVITY_EVENT_TIMESTAMP_BASIS_MAP = Object.freeze({
|
|
|
1015
1024
|
"notion.page.created": "page_created",
|
|
1016
1025
|
"notion.page.edited": "page_last_edited"
|
|
1017
1026
|
});
|
|
1018
|
-
var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
|
|
1019
|
-
"message_created",
|
|
1020
|
-
"commit_authored",
|
|
1021
|
-
"resource_created",
|
|
1022
|
-
"review_submitted",
|
|
1023
|
-
"comment_created",
|
|
1024
|
-
"event_start",
|
|
1025
|
-
"all_day_start",
|
|
1026
|
-
"file_created",
|
|
1027
|
-
"file_modified",
|
|
1028
|
-
"file_modified_by_me",
|
|
1029
|
-
"file_viewed_by_me",
|
|
1030
|
-
"page_created",
|
|
1031
|
-
"page_last_edited",
|
|
1032
|
-
"resource_modified"
|
|
1033
|
-
]);
|
|
1034
|
-
var CEAL_ACTIVITY_V3_KINDS = vocabulary(["authored", "edited", "messaged", "responded"]);
|
|
1035
|
-
var CEAL_RESOURCE_TIME_BASES = vocabulary(["created", "modified", "viewed"]);
|
|
1036
|
-
var CEAL_RESOURCE_SEARCH_ORDERS = vocabulary(["relevance", "modified", "viewed", "created"]);
|
|
1037
|
-
var CEAL_RESOURCE_SEARCH_DIRECTIONS = vocabulary(["ascending", "descending"]);
|
|
1038
|
-
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"]);
|
|
1039
|
-
var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
|
|
1040
|
-
var CEAL_READ_ITEM_KINDS = vocabulary(["conversation", "identity", "usergroup", "message", "file", "document"]);
|
|
1041
|
-
var CEAL_LEASED_MESSAGE_SEARCH_COMPLETENESS = vocabulary(["complete", "continuation_available", "truncated"]);
|
|
1042
|
-
var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "block", "object"]);
|
|
1043
|
-
var CEAL_OPAQUE_REF_KINDS = vocabulary([...CEAL_OPAQUE_HANDLE_KINDS, "result", "operation-receipt", "reply-receipt", "field", "notion-data-source"]);
|
|
1044
|
-
var CEAL_WRITE_OBJECT_KINDS = vocabulary(["document", "comment", "cell_range"]);
|
|
1045
|
-
var CEAL_CONVERSATION_KINDS = vocabulary(["channel", "dm", "group"]);
|
|
1046
|
-
var CEAL_FILE_TYPE_FAMILIES = vocabulary(["all", "image", "pdf"]);
|
|
1047
|
-
var CEAL_GITHUB_ISSUE_STATES = vocabulary(["open", "closed", "all"]);
|
|
1048
|
-
var CEAL_NOTION_UPDATABLE_BLOCK_TYPES = vocabulary([
|
|
1049
|
-
"paragraph",
|
|
1050
|
-
"heading_1",
|
|
1051
|
-
"heading_2",
|
|
1052
|
-
"heading_3",
|
|
1053
|
-
"bulleted_list_item",
|
|
1054
|
-
"numbered_list_item",
|
|
1055
|
-
"to_do",
|
|
1056
|
-
"code"
|
|
1057
|
-
]);
|
|
1058
|
-
var CEAL_NOTION_NEUTRAL_TYPES = vocabulary([
|
|
1059
|
-
"text",
|
|
1060
|
-
"number",
|
|
1061
|
-
"boolean",
|
|
1062
|
-
"date",
|
|
1063
|
-
"select",
|
|
1064
|
-
"multi_select",
|
|
1065
|
-
"people",
|
|
1066
|
-
"url",
|
|
1067
|
-
"email",
|
|
1068
|
-
"phone",
|
|
1069
|
-
"unsupported"
|
|
1070
|
-
]);
|
|
1071
|
-
var CEAL_NOTION_IDENTITY_GAP_REASONS = vocabulary([
|
|
1072
|
-
"identity_unavailable",
|
|
1073
|
-
"identity_stale",
|
|
1074
|
-
"identity_ambiguous",
|
|
1075
|
-
"identity_revoked",
|
|
1076
|
-
"identity_unlinked"
|
|
1077
|
-
]);
|
|
1078
|
-
var CEAL_NOTION_STRING_VALUE_TYPES = vocabulary(["text", "select", "url", "email", "phone"]);
|
|
1079
|
-
var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
|
|
1080
|
-
var CEAL_PLAN_ITEM_STATUSES = vocabulary(["pending", "active", "completed"]);
|
|
1081
|
-
var CEAL_FINAL_PRESENTATION_INTENTS = vocabulary(["final", "stop", "transient_notice"]);
|
|
1082
|
-
var CEAL_PRESENTATION_INTENTS = vocabulary(["progress", ...CEAL_FINAL_PRESENTATION_INTENTS]);
|
|
1083
|
-
|
|
1084
|
-
// packages/ceal-client-protocol/src/resource-row.ts
|
|
1085
1027
|
var CEAL_DATED_NOTE_BASES = vocabulary(["recording", "calendar_event", "created_time"]);
|
|
1086
1028
|
var CEAL_DATED_NOTE_TRANSCRIPT_STATES = vocabulary(["present", "absent", "unestablished"]);
|
|
1087
1029
|
var CEAL_READ_SEARCH_COST_CLASSES = vocabulary(["native_index", "scan"]);
|
|
@@ -1166,17 +1108,6 @@ var CEAL_REFRESH_FAILURE_CODES = vocabulary([
|
|
|
1166
1108
|
"refresh_recovery_expired"
|
|
1167
1109
|
]);
|
|
1168
1110
|
|
|
1169
|
-
// packages/ceal-client-protocol/src/leased-artifact-contract.ts
|
|
1170
|
-
var CEAL_LEASED_CONSUMER_ARTIFACT_CHUNK_MAX_BYTES = 12 * 1024;
|
|
1171
|
-
|
|
1172
|
-
// packages/ceal-client-protocol/src/leased-resource-stream.ts
|
|
1173
|
-
var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAGIC = new Uint8Array([67, 69, 65, 76, 82, 83, 50, 0]);
|
|
1174
|
-
var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_RECORD_PREFIX_BYTES = 8;
|
|
1175
|
-
var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAX_HEADER_BYTES = 16 * 1024;
|
|
1176
|
-
var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_CHUNK_BYTES = 64 * 1024;
|
|
1177
|
-
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;
|
|
1178
|
-
var CEAL_ATTACHMENT_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "digest_mismatch"]);
|
|
1179
|
-
|
|
1180
1111
|
// packages/ceal-client-protocol/src/request-validation-primitives.ts
|
|
1181
1112
|
import { createHash } from "node:crypto";
|
|
1182
1113
|
var DIGEST = /^[a-f0-9]{64}$/u;
|
|
@@ -1343,6 +1274,10 @@ var CEAL_REQUEST_RUN_BATCH_JSON_SCHEMA = {
|
|
|
1343
1274
|
};
|
|
1344
1275
|
|
|
1345
1276
|
// packages/ceal-client-protocol/src/host-observation.ts
|
|
1277
|
+
var CEAL_HOST_INPUT_KINDS = vocabulary(["human", "host_automatic"]);
|
|
1278
|
+
function isCealHostInputKind(value) {
|
|
1279
|
+
return typeof value === "string" && CEAL_HOST_INPUT_KINDS.some((kind) => kind === value);
|
|
1280
|
+
}
|
|
1346
1281
|
var CEAL_HOST_OBSERVATION_REF_PREFIX = "host-observation:";
|
|
1347
1282
|
var HOST_OBSERVATION_PRODUCER = /^[a-z][a-z0-9]{0,31}$/u;
|
|
1348
1283
|
var HOST_OBSERVATION_DIGEST = /^[a-f0-9]{8,64}$/u;
|
|
@@ -1405,12 +1340,6 @@ var OWNER_WRITE_STATES = Object.freeze(["attempt_started", "provider_acknowledge
|
|
|
1405
1340
|
var OWNER_EFFECT_STATES = Object.freeze(["none", "applied", "failed", "unknown", "reconciled"]);
|
|
1406
1341
|
var OWNER_RECEIPT_STATES = Object.freeze(["pending", "available", "failed", "unknown", "reconciled"]);
|
|
1407
1342
|
|
|
1408
|
-
// packages/ceal-client-protocol/src/thread-excerpt.ts
|
|
1409
|
-
var CEAL_THREAD_RECENT_WINDOW = 6;
|
|
1410
|
-
var CEAL_THREAD_LAST_APP_MESSAGES_WINDOW = 3;
|
|
1411
|
-
var CEAL_THREAD_OLDER_SUMMARY_WINDOW = 4;
|
|
1412
|
-
var CEAL_FED_THREAD_MESSAGE_LIMIT = CEAL_THREAD_RECENT_WINDOW + CEAL_THREAD_OLDER_SUMMARY_WINDOW + CEAL_THREAD_LAST_APP_MESSAGES_WINDOW;
|
|
1413
|
-
|
|
1414
1343
|
// packages/ceal-client-protocol/src/request-graph-readiness.ts
|
|
1415
1344
|
var REQUEST_GRAPH_PRODUCER_TO_APPEND_SCHEMA = {
|
|
1416
1345
|
type: "object",
|
|
@@ -1499,26 +1428,11 @@ var CEAL_HOST_INVOCATION_AUTHENTICATION_RESULT_MAX_BYTES = new TextEncoder().enc
|
|
|
1499
1428
|
`).byteLength;
|
|
1500
1429
|
|
|
1501
1430
|
// packages/ceal-client-protocol/src/client-result-materialization.ts
|
|
1431
|
+
var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
|
|
1502
1432
|
var CEAL_MODEL_VISIBLE_COMMAND_OUTPUT_MAX_BYTES = 32 * 1024;
|
|
1503
1433
|
var REQUIRED_FIELDS2 = Object.freeze(["schema_version", "operation_id"]);
|
|
1504
1434
|
var FIELDS = /* @__PURE__ */ new Set([...REQUIRED_FIELDS2, "read_argv", "local_result_root", "continue_argv", "model_disclosure", "item_read_argv"]);
|
|
1505
1435
|
|
|
1506
|
-
// packages/ceal-client-protocol/src/session-start-affordance.ts
|
|
1507
|
-
var CEAL_SESSION_ENTRY_INVOCATION = "ceal";
|
|
1508
|
-
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.`;
|
|
1509
|
-
|
|
1510
|
-
// packages/ceal-client-protocol/src/conversation-contracts.ts
|
|
1511
|
-
var CEAL_APPROVAL_POLICY_KINDS = vocabulary(["requester_only", "named_users", "role_based"]);
|
|
1512
|
-
var CEAL_APPROVAL_TARGET_KINDS = vocabulary([
|
|
1513
|
-
"repo_change",
|
|
1514
|
-
"investigation",
|
|
1515
|
-
"skill_creation",
|
|
1516
|
-
"command_creation",
|
|
1517
|
-
"connector_creation",
|
|
1518
|
-
"generic"
|
|
1519
|
-
]);
|
|
1520
|
-
var CEAL_PROGRESS_PHASES = vocabulary(["request_review", "information_gathering", "work_execution", "result_check"]);
|
|
1521
|
-
|
|
1522
1436
|
// packages/ceal-client-protocol/src/gateway-cache-origin-validation.ts
|
|
1523
1437
|
var CEAL_MAX_CACHE_ORIGIN_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
1524
1438
|
|
|
@@ -1996,10 +1910,6 @@ var CodexOutboxStore = class {
|
|
|
1996
1910
|
await removeOwnerState(this.registrationPath(registration.host_source_ref, registration.host_session_ref), "registration");
|
|
1997
1911
|
await removeOwnerState(this.cursorPath(registration.host_source_ref, registration.host_session_ref), "cursor");
|
|
1998
1912
|
}
|
|
1999
|
-
async relayWakeDirectories() {
|
|
2000
|
-
await this.prepare();
|
|
2001
|
-
return { entries: this.entriesDirectory, registrations: this.registrationsDirectory };
|
|
2002
|
-
}
|
|
2003
1913
|
async listTranscriptRegistrations() {
|
|
2004
1914
|
await this.prepare();
|
|
2005
1915
|
const registrations = [];
|
|
@@ -2189,7 +2099,7 @@ async function readPrivateFile(path) {
|
|
|
2189
2099
|
}
|
|
2190
2100
|
function validateEnvelope(value) {
|
|
2191
2101
|
if (!isRecord3(value)) throw storageError("Codex outbox entry is malformed.");
|
|
2192
|
-
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")}).`);
|
|
2102
|
+
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")}).`);
|
|
2193
2103
|
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}`)}).`);
|
|
2194
2104
|
validateIdentity2(value.identity);
|
|
2195
2105
|
validateEnvelopeReferences(value);
|
|
@@ -2198,6 +2108,7 @@ function validateEnvelope(value) {
|
|
|
2198
2108
|
}
|
|
2199
2109
|
function validateEnvelopeReferences(value) {
|
|
2200
2110
|
if (!SAFE_REF3.test(String(value.host_input_ref))) throw storageError("Codex outbox input reference is malformed.");
|
|
2111
|
+
if (!isCealHostInputKind(value.input_kind)) throw storageError("Codex outbox input provenance is malformed.");
|
|
2201
2112
|
if (!SAFE_REF3.test(String(value.prompt_ref))) throw storageError("Codex outbox references are malformed.");
|
|
2202
2113
|
if (!SAFE_REF3.test(String(value.submission_ref))) throw storageError("Codex outbox references are malformed.");
|
|
2203
2114
|
if (value.request_ref !== void 0 && !SAFE_REF3.test(String(value.request_ref))) throw storageError("Codex outbox Request reference is malformed.");
|
|
@@ -2431,18 +2342,24 @@ function decodeTokenUsage(value) {
|
|
|
2431
2342
|
function decodeResponseItem(payload, ordinal, timestamp6) {
|
|
2432
2343
|
if (payload.type !== "message" || payload.role !== "user") return { kind: "ignored", ordinal, timestamp: timestamp6 };
|
|
2433
2344
|
const metadata = userMessageMetadata(payload.internal_chat_message_metadata_passthrough);
|
|
2434
|
-
const
|
|
2435
|
-
if (
|
|
2345
|
+
const inputKind = inputKindFromContentItems(metadata.content_item_kinds);
|
|
2346
|
+
if (inputKind === void 0) return { kind: "ignored", ordinal, timestamp: timestamp6 };
|
|
2436
2347
|
const prompt = userTextContent(payload.content);
|
|
2437
2348
|
return {
|
|
2438
2349
|
kind: "user_text",
|
|
2439
2350
|
ordinal,
|
|
2440
2351
|
timestamp: timestamp6,
|
|
2441
2352
|
prompt,
|
|
2353
|
+
input_kind: inputKind,
|
|
2442
2354
|
message_id: safeRef2(payload.id, "Codex user message identity is invalid."),
|
|
2443
2355
|
turn_id: safeRef2(metadata.turn_id, "Codex user message task identity is invalid.")
|
|
2444
2356
|
};
|
|
2445
2357
|
}
|
|
2358
|
+
function inputKindFromContentItems(kinds) {
|
|
2359
|
+
if (kinds.length !== 1) return void 0;
|
|
2360
|
+
if (kinds[0] === "user.text") return "human";
|
|
2361
|
+
return kinds[0] === "goal.internal_context" ? "host_automatic" : void 0;
|
|
2362
|
+
}
|
|
2446
2363
|
function userMessageMetadata(value) {
|
|
2447
2364
|
if (!isRecord4(value) || !Array.isArray(value.content_item_kinds)) reject2("Codex user message provenance is malformed.");
|
|
2448
2365
|
return { ...value, content_item_kinds: value.content_item_kinds };
|
|
@@ -2727,13 +2644,13 @@ function validTurn(value) {
|
|
|
2727
2644
|
return exactOptional(value, ["local_session_ref", "local_turn_ref"], ["model", "observations"]) && safeRef3(value.local_session_ref) && safeRef3(value.local_turn_ref) && optionalText(value.model, 256) && validObservations(value.observations);
|
|
2728
2645
|
}
|
|
2729
2646
|
function validInput(value) {
|
|
2730
|
-
return exactOptional(value, ["local_session_ref", "local_turn_ref", "local_input_ref", "origin_input", "observations"], ["
|
|
2647
|
+
return exactOptional(value, ["local_session_ref", "local_turn_ref", "local_input_ref", "input_kind", "origin_input", "observations"], ["local_turn_aliases", "context_expires_at"]) && safeRef3(value.local_session_ref) && safeRef3(value.local_turn_ref) && safeRef3(value.local_input_ref) && validInputObservations(value.observations) && isCealHostInputKind(value.input_kind) && typeof value.origin_input === "boolean" && validInputOptionals(value);
|
|
2731
2648
|
}
|
|
2732
2649
|
function validInputObservations(value) {
|
|
2733
2650
|
return validObservations(value) && Array.isArray(value) && value.filter((item) => record(item) && item.observation_kind === "prompt").length === 1;
|
|
2734
2651
|
}
|
|
2735
2652
|
function validInputOptionals(value) {
|
|
2736
|
-
return
|
|
2653
|
+
return optionalRefs(value.local_turn_aliases) && (value.context_expires_at === void 0 || timestamp3(value.context_expires_at));
|
|
2737
2654
|
}
|
|
2738
2655
|
function validTerminal(value) {
|
|
2739
2656
|
return exactOptional(value, ["local_session_ref", "local_turn_ref", "terminal_state"], ["abort_reason", "duration_ms", "time_to_first_token_ms", "usage", "observations"]) && safeRef3(value.local_session_ref) && safeRef3(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);
|
|
@@ -2744,9 +2661,6 @@ function validTerminalDisposition(state, reason) {
|
|
|
2744
2661
|
function validStatus(value) {
|
|
2745
2662
|
return exactOptional(value, ["status", "reason_code"], ["detail"]) && ["ready", "degraded", "stopping"].includes(String(value.status)) && safeRef3(value.reason_code) && optionalText(value.detail, 4096);
|
|
2746
2663
|
}
|
|
2747
|
-
function validDecision(value) {
|
|
2748
|
-
return value === void 0 || record(value) && exactKeys3(value, ["decision", "approval_ref"]) && (value.decision === "approved" || value.decision === "denied") && safeRef3(value.approval_ref);
|
|
2749
|
-
}
|
|
2750
2664
|
function optionalText(value, maxLength) {
|
|
2751
2665
|
return value === void 0 || typeof value === "string" && value.length > 0 && value.length <= maxLength;
|
|
2752
2666
|
}
|
|
@@ -2923,9 +2837,11 @@ function incrementDelivery(counts, outcome) {
|
|
|
2923
2837
|
async function deliverPreparedEntry(entry, prepared, options, store, now, timeoutMs, signal) {
|
|
2924
2838
|
try {
|
|
2925
2839
|
const acknowledgement = await submitWithDeadline(options.gateway, gatewaySubmission(prepared), timeoutMs, signal);
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2840
|
+
if (prepared.request_ref === void 0) {
|
|
2841
|
+
const binding = bindingFor(prepared, acknowledgement, now);
|
|
2842
|
+
await store.writeBinding(binding);
|
|
2843
|
+
await store.bindInvocationContext(binding, now());
|
|
2844
|
+
}
|
|
2929
2845
|
await store.remove(entry);
|
|
2930
2846
|
return "delivered";
|
|
2931
2847
|
} catch (error) {
|
|
@@ -2943,6 +2859,7 @@ function gatewaySubmission(envelope) {
|
|
|
2943
2859
|
return {
|
|
2944
2860
|
identity: envelope.identity,
|
|
2945
2861
|
host_input_ref: envelope.host_input_ref,
|
|
2862
|
+
input_kind: envelope.input_kind,
|
|
2946
2863
|
prompt_ref: envelope.prompt_ref,
|
|
2947
2864
|
observations: envelope.observations,
|
|
2948
2865
|
...envelope.request_ref === void 0 ? {} : { request_ref: envelope.request_ref },
|
|
@@ -3565,6 +3482,7 @@ var CodexProducer = class {
|
|
|
3565
3482
|
local_session_ref: envelope.identity.host_session_ref,
|
|
3566
3483
|
local_turn_ref: localTurnRef(envelope),
|
|
3567
3484
|
local_input_ref: envelope.host_input_ref,
|
|
3485
|
+
input_kind: envelope.input_kind,
|
|
3568
3486
|
origin_input: envelope.origin_input,
|
|
3569
3487
|
observations: [prompt],
|
|
3570
3488
|
local_turn_aliases: envelope.codex_turn_id === void 0 ? void 0 : [envelope.codex_turn_id],
|
|
@@ -4155,6 +4073,7 @@ var CodexTranscriptWatcher = class {
|
|
|
4155
4073
|
schema_version: "ceal.codex_observation_outbox.v1",
|
|
4156
4074
|
identity,
|
|
4157
4075
|
host_input_ref: hostInputRef,
|
|
4076
|
+
input_kind: record3.input_kind,
|
|
4158
4077
|
prompt_ref: promptRef,
|
|
4159
4078
|
observations,
|
|
4160
4079
|
codex_turn_id: record3.turn_id,
|
|
@@ -4181,6 +4100,7 @@ var CodexTranscriptWatcher = class {
|
|
|
4181
4100
|
schema_version: "ceal.codex_observation_outbox.v1",
|
|
4182
4101
|
identity,
|
|
4183
4102
|
host_input_ref: activeTask.origin_host_input_ref,
|
|
4103
|
+
input_kind: "host_automatic",
|
|
4184
4104
|
prompt_ref: activeTask.prompt_ref,
|
|
4185
4105
|
observations,
|
|
4186
4106
|
codex_turn_id: record3.turn_id,
|
|
@@ -4371,84 +4291,6 @@ var CODEX_PRODUCER_DESCRIPTOR = {
|
|
|
4371
4291
|
drain: drainCodexProducerOnce
|
|
4372
4292
|
};
|
|
4373
4293
|
|
|
4374
|
-
// host/codex/src/codex-relay.ts
|
|
4375
|
-
import { O_NOFOLLOW as O_NOFOLLOW4, O_RDONLY as O_RDONLY5 } from "node:constants";
|
|
4376
|
-
import { lstat as lstat4, mkdir as mkdir4, open as open6, readFile as readFile2, rename as rename4, unlink as unlink3 } from "node:fs/promises";
|
|
4377
|
-
import { homedir as homedir2 } from "node:os";
|
|
4378
|
-
import { dirname as dirname2, isAbsolute as isAbsolute4, join as join5 } from "node:path";
|
|
4379
|
-
var CODEX_RELAY_CONFIG_SCHEMA_VERSION = "ceal.codex_relay_config.v1";
|
|
4380
|
-
function resolveCodexRelayConfigPath(codexHome) {
|
|
4381
|
-
const root = codexHome ?? (process.env.CODEX_HOME || join5(homedir2(), ".codex"));
|
|
4382
|
-
if (typeof root !== "string" || root.length === 0) throw new CodexHostAdapterError("configuration", "Codex home is unavailable.");
|
|
4383
|
-
return join5(root, ".ceal", "codex-relay.json");
|
|
4384
|
-
}
|
|
4385
|
-
async function readCodexRelayConfig(path = resolveCodexRelayConfigPath()) {
|
|
4386
|
-
validateConfigPath(path);
|
|
4387
|
-
const value = JSON.parse(await readPrivateFile2(path));
|
|
4388
|
-
return normalizeRelayConfig(value);
|
|
4389
|
-
}
|
|
4390
|
-
function normalizeRelayConfig(value) {
|
|
4391
|
-
if (!isRecord9(value)) throw new CodexHostAdapterError("configuration", "Codex relay configuration is malformed.");
|
|
4392
|
-
if (!sameKeys2(value, ["schema_version", "gateway_origin", "credential_file", "host_source_ref", "outbox_dir"])) throw new CodexHostAdapterError("configuration", `Codex relay configuration key set is malformed (${refusalFact("keys", Object.keys(value), "exactly the relay configuration key set")}).`);
|
|
4393
|
-
if (value.schema_version !== CODEX_RELAY_CONFIG_SCHEMA_VERSION) throw new CodexHostAdapterError("configuration", `Codex relay configuration schema is malformed (${refusalFact("schema_version", value.schema_version, `expected ${CODEX_RELAY_CONFIG_SCHEMA_VERSION}`)}).`);
|
|
4394
|
-
if (!httpsOrigin(value.gateway_origin) || !absolutePath(value.credential_file) || !safeRef4(value.host_source_ref) || !absolutePath(value.outbox_dir)) {
|
|
4395
|
-
throw new CodexHostAdapterError("configuration", `Codex relay configuration fields are malformed (${refusalFacts([
|
|
4396
|
-
{ name: "gateway_origin_valid", value: httpsOrigin(value.gateway_origin), expected: "true" },
|
|
4397
|
-
{ name: "credential_file_absolute", value: absolutePath(value.credential_file), expected: "true" },
|
|
4398
|
-
{ name: "host_source_ref", value: value.host_source_ref, expected: "a safe Host reference" },
|
|
4399
|
-
{ name: "outbox_dir_absolute", value: absolutePath(value.outbox_dir), expected: "true" }
|
|
4400
|
-
])}).`);
|
|
4401
|
-
}
|
|
4402
|
-
return {
|
|
4403
|
-
schema_version: CODEX_RELAY_CONFIG_SCHEMA_VERSION,
|
|
4404
|
-
gateway_origin: value.gateway_origin,
|
|
4405
|
-
credential_file: value.credential_file,
|
|
4406
|
-
host_source_ref: value.host_source_ref,
|
|
4407
|
-
outbox_dir: value.outbox_dir
|
|
4408
|
-
};
|
|
4409
|
-
}
|
|
4410
|
-
async function readPrivateFile2(path) {
|
|
4411
|
-
let handle;
|
|
4412
|
-
try {
|
|
4413
|
-
handle = await open6(path, O_RDONLY5 | O_NOFOLLOW4);
|
|
4414
|
-
const stats = await handle.stat();
|
|
4415
|
-
const uid = typeof process.geteuid === "function" ? process.geteuid() : stats.uid;
|
|
4416
|
-
if (!stats.isFile()) throw new CodexHostAdapterError("storage", `Codex relay state path is not a regular file (${refusalFact("mode", `0o${stats.mode.toString(8)}`, "a regular-file mode (0o100xxx)")}).`);
|
|
4417
|
-
if ((stats.mode & 63) !== 0) throw new CodexHostAdapterError("storage", `Codex relay state file is readable beyond its owner (${refusalFact("permission_bits", `0o${(stats.mode & 511).toString(8)}`, "no group or other bits")}).`);
|
|
4418
|
-
if (stats.uid !== uid) throw new CodexHostAdapterError("storage", `Codex relay state file is owned by another user (${refusalFact("uid", stats.uid, `expected ${uid}`)}).`);
|
|
4419
|
-
return await handle.readFile("utf8");
|
|
4420
|
-
} catch (error) {
|
|
4421
|
-
if (error instanceof CodexHostAdapterError) throw error;
|
|
4422
|
-
throw error;
|
|
4423
|
-
} finally {
|
|
4424
|
-
await handle?.close();
|
|
4425
|
-
}
|
|
4426
|
-
}
|
|
4427
|
-
function validateConfigPath(path) {
|
|
4428
|
-
if (!isAbsolute4(path)) throw new CodexHostAdapterError("configuration", "Codex relay config path must be absolute.");
|
|
4429
|
-
}
|
|
4430
|
-
function httpsOrigin(value) {
|
|
4431
|
-
try {
|
|
4432
|
-
const url = new URL(String(value));
|
|
4433
|
-
return typeof value === "string" && url.protocol === "https:" && url.username === "" && url.password === "" && url.search === "" && url.hash === "";
|
|
4434
|
-
} catch {
|
|
4435
|
-
return false;
|
|
4436
|
-
}
|
|
4437
|
-
}
|
|
4438
|
-
function absolutePath(value) {
|
|
4439
|
-
return typeof value === "string" && isAbsolute4(value) && value.length <= 4096;
|
|
4440
|
-
}
|
|
4441
|
-
function safeRef4(value) {
|
|
4442
|
-
return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u.test(value);
|
|
4443
|
-
}
|
|
4444
|
-
function isRecord9(value) {
|
|
4445
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4446
|
-
}
|
|
4447
|
-
function sameKeys2(value, required, optional = []) {
|
|
4448
|
-
const keys = Object.keys(value);
|
|
4449
|
-
return required.every((key) => Object.hasOwn(value, key)) && keys.every((key) => required.includes(key) || optional.includes(key));
|
|
4450
|
-
}
|
|
4451
|
-
|
|
4452
4294
|
// host/codex/src/codex-hook-runner.ts
|
|
4453
4295
|
var MAX_STDIN_BYTES = 64 * 1024;
|
|
4454
4296
|
async function runCodexHookFromStdin(event, stdin, options) {
|
|
@@ -4460,15 +4302,6 @@ function codexHookEventFromArgs(args) {
|
|
|
4460
4302
|
const event = marker?.slice("--ceal-hook-event=".length);
|
|
4461
4303
|
return isCodexHookEvent(event) ? event : null;
|
|
4462
4304
|
}
|
|
4463
|
-
function defaultCodexHookRunnerOptions(gateway) {
|
|
4464
|
-
const codexHome = process.env.CODEX_HOME || join6(homedir3(), ".codex");
|
|
4465
|
-
return {
|
|
4466
|
-
host_source_ref: process.env.CEAL_CODEX_HOST_SOURCE_REF ?? "codex-host:local",
|
|
4467
|
-
outbox_dir: process.env.CEAL_CODEX_OUTBOX_DIR ?? join6(codexHome, ".ceal", "codex-observation-outbox"),
|
|
4468
|
-
codex_sessions_root: join6(codexHome, "sessions"),
|
|
4469
|
-
gateway
|
|
4470
|
-
};
|
|
4471
|
-
}
|
|
4472
4305
|
async function runCodexHookProcess(args, stdin, options) {
|
|
4473
4306
|
const event = codexHookEventFromArgs(args);
|
|
4474
4307
|
if (event === null) return 0;
|
|
@@ -4506,29 +4339,13 @@ async function runCodexHookCli() {
|
|
|
4506
4339
|
}
|
|
4507
4340
|
};
|
|
4508
4341
|
const args = process.argv.slice(2);
|
|
4509
|
-
const owner =
|
|
4342
|
+
const owner = await installedCodexHookRunnerOptions(args, unavailableGateway);
|
|
4510
4343
|
return runCodexHookProcess(args, process.stdin, owner);
|
|
4511
4344
|
}
|
|
4512
4345
|
async function installedCodexHookRunnerOptions(args, gateway) {
|
|
4513
4346
|
const config = await readHostProducerConfig(CODEX_PRODUCER_DESCRIPTOR, parseHostProducerConfigFlag(args));
|
|
4514
4347
|
return { gateway, host_source_ref: config.host_source_ref, outbox_dir: config.outbox_dir, codex_sessions_root: config.codex_sessions_root };
|
|
4515
4348
|
}
|
|
4516
|
-
async function standaloneCodexHookRunnerOptions(gateway) {
|
|
4517
|
-
const defaults = defaultCodexHookRunnerOptions(gateway);
|
|
4518
|
-
try {
|
|
4519
|
-
const config = await readCodexRelayConfig();
|
|
4520
|
-
return { ...defaults, host_source_ref: config.host_source_ref, outbox_dir: config.outbox_dir };
|
|
4521
|
-
} catch (error) {
|
|
4522
|
-
if (!isNotFound2(error)) throw error;
|
|
4523
|
-
return defaults;
|
|
4524
|
-
}
|
|
4525
|
-
}
|
|
4526
|
-
function hasHostConfigArgument(args) {
|
|
4527
|
-
return args.some((argument) => argument === HOST_PRODUCER_CONFIG_FLAG || argument.startsWith(`${HOST_PRODUCER_CONFIG_FLAG}=`));
|
|
4528
|
-
}
|
|
4529
|
-
function isNotFound2(error) {
|
|
4530
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
4531
|
-
}
|
|
4532
4349
|
|
|
4533
4350
|
// host/codex/bin/ceal-codex-hook.ts
|
|
4534
4351
|
void runCodexHookCli().then((exitCode) => {
|