@corca-org/ceal-host-win32-x64 1.0.8 → 1.0.10
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/README.md +2 -2
- package/bin/ceal-host.exe +0 -0
- package/libexec/ceal-host/claude-hook.mjs +149 -46
- package/libexec/ceal-host/claude-invocation-authentication.mjs +103 -127
- package/libexec/ceal-host/claude-producer.mjs +76 -24
- package/libexec/ceal-host/codex-hook.mjs +148 -47
- package/libexec/ceal-host/codex-invocation-authentication.mjs +136 -131
- package/libexec/ceal-host/codex-producer.mjs +136 -32
- package/libexec/ceal-host/control.mjs +157 -40
- package/libexec/ceal-host/relay.mjs +240 -58
- package/package.json +1 -1
- package/share/ceal-host/bundle-manifest.json +12 -12
- package/share/ceal-host/bundle-manifest.sigstore.json +1 -1
|
@@ -74,11 +74,28 @@ var client_wire_contract_default = {
|
|
|
74
74
|
],
|
|
75
75
|
bare_document_fields: [
|
|
76
76
|
"invocation",
|
|
77
|
-
"
|
|
77
|
+
"required_action_sequence",
|
|
78
|
+
"entrypoints",
|
|
78
79
|
"common_concepts",
|
|
79
80
|
"operations",
|
|
80
81
|
"catalog_revision"
|
|
81
82
|
],
|
|
83
|
+
prompt_field: "prompt",
|
|
84
|
+
prompt_schema_version: "ceal.prompt.v1",
|
|
85
|
+
focused_prompt_document_fields: [
|
|
86
|
+
"catalog_revision",
|
|
87
|
+
"prompt"
|
|
88
|
+
],
|
|
89
|
+
focused_prompt_continuation_document_fields: [
|
|
90
|
+
"catalog_revision",
|
|
91
|
+
"remaining_work",
|
|
92
|
+
"prompt"
|
|
93
|
+
],
|
|
94
|
+
discovery_command: "discovery",
|
|
95
|
+
discovery_manifest_schema_version: "ceal.discovery_manifest.v1",
|
|
96
|
+
discovery_manifest_document_fields: [
|
|
97
|
+
"discovery_manifest"
|
|
98
|
+
],
|
|
82
99
|
exit_code_max: 125,
|
|
83
100
|
bare_document_max_bytes: 65536,
|
|
84
101
|
complete_max_bytes: 66019,
|
|
@@ -105,8 +122,15 @@ var CEAL_VERIFIED_ARTIFACT_MAX_BYTES = artifact.max_bytes;
|
|
|
105
122
|
var CEAL_VERIFIED_ARTIFACT_DESCRIPTOR_MAX_BYTES = artifact.envelope_max_bytes;
|
|
106
123
|
var CEAL_COMMAND_REQUEST_SCHEMA_VERSION = request.schema_version;
|
|
107
124
|
var CEAL_COMMAND_REQUEST_MAX_BYTES = request.absolute_transport_max_bytes;
|
|
108
|
-
var CEAL_COMMAND_RESPONSE_BARE_DOCUMENT_FIELDS = response.bare_document_fields;
|
|
109
125
|
var CEAL_COMMAND_RESPONSE_BARE_DOCUMENT_MAX_BYTES = response.bare_document_max_bytes;
|
|
126
|
+
var CEAL_COMMAND_RESPONSE_PROMPT_FIELD = response.prompt_field;
|
|
127
|
+
var CEAL_COMMAND_RESPONSE_PROMPT_SCHEMA_VERSION = response.prompt_schema_version;
|
|
128
|
+
var CEAL_COMMAND_RESPONSE_PROMPT_DOCUMENT_FIELDS = Object.freeze([...response.bare_document_fields, response.prompt_field]);
|
|
129
|
+
var CEAL_COMMAND_RESPONSE_FOCUSED_PROMPT_DOCUMENT_FIELDS = Object.freeze([...response.focused_prompt_document_fields]);
|
|
130
|
+
var CEAL_COMMAND_RESPONSE_FOCUSED_PROMPT_CONTINUATION_DOCUMENT_FIELDS = Object.freeze([...response.focused_prompt_continuation_document_fields]);
|
|
131
|
+
var CEAL_COMMAND_RESPONSE_DISCOVERY_COMMAND = response.discovery_command;
|
|
132
|
+
var CEAL_COMMAND_RESPONSE_DISCOVERY_MANIFEST_SCHEMA_VERSION = response.discovery_manifest_schema_version;
|
|
133
|
+
var CEAL_COMMAND_RESPONSE_DISCOVERY_MANIFEST_DOCUMENT_FIELDS = Object.freeze([...response.discovery_manifest_document_fields]);
|
|
110
134
|
var CEAL_COMMAND_RESPONSE_MAX_BYTES = response.absolute_transport_max_bytes;
|
|
111
135
|
|
|
112
136
|
// packages/ceal-client-protocol/src/vocabulary.ts
|
|
@@ -142,7 +166,7 @@ var CEAL_OPERATION_RECOVERY_KINDS = vocabulary(["none", "reconcile", "compensate
|
|
|
142
166
|
var CEAL_OPERATION_RECOVERY_STATUSES = vocabulary(["not_started", "active", "completed"]);
|
|
143
167
|
var CEAL_OPERATION_PROVIDER_READBACK_AVAILABILITY = vocabulary(["not_started", "not_applicable", "not_available", "pending", "available"]);
|
|
144
168
|
var CEAL_OPERATION_OFFERED_HANDOFF_STATES = vocabulary(["accepted", "rejected", "unknown"]);
|
|
145
|
-
var CEAL_OPERATION_RECEIPT_AUTHORITY_KEYS = Object.freeze(["instance_ref", "
|
|
169
|
+
var CEAL_OPERATION_RECEIPT_AUTHORITY_KEYS = Object.freeze(["instance_ref", "access_group_ref", "principal_ref", "execution_subject_ref", "authority_revision_ref"]);
|
|
146
170
|
var CEAL_OPERATION_APPROVAL_DISPOSITIONS = vocabulary([
|
|
147
171
|
"approval_not_required_by_policy",
|
|
148
172
|
"interactive_pending",
|
|
@@ -157,6 +181,8 @@ var CEAL_CAPABILITY_READINESS_VALUES = vocabulary(["ready", "degraded", "unavail
|
|
|
157
181
|
var CEAL_TARGET_REQUIREMENTS = vocabulary(["required", "optional", "none"]);
|
|
158
182
|
var CEAL_AUDIT_OUTCOMES = vocabulary(["succeeded", "denied", "failed"]);
|
|
159
183
|
var CEAL_GATEWAY_PROVIDER_STEP_OUTCOMES = vocabulary(["completed", "rejected", "throttled", "failed"]);
|
|
184
|
+
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"]);
|
|
185
|
+
var CEAL_GATEWAY_READ_REUSE_UNAVAILABLE_REASONS = vocabulary(["not_reported", "storage_unavailable", "coverage_incomplete", "freshness_refresh_required", "not_reusable", "bypassed"]);
|
|
160
186
|
var CEAL_POLICY_DECISIONS = vocabulary(["allowed", "denied", "not_evaluated"]);
|
|
161
187
|
var CEAL_CONNECTOR_ROUTE_PHASES = vocabulary(["scope_observation", "target_selection", "route_resolution"]);
|
|
162
188
|
var CEAL_CONNECTOR_ROUTE_CAUSES = vocabulary(["provider_throttled", "provider_unavailable", "binding_invalid", "scope_limit_exceeded"]);
|
|
@@ -429,8 +455,10 @@ function requireIsoTimestamp(value, message) {
|
|
|
429
455
|
var JSON_DESCRIPTION_CONTROL_CHARACTER = new RegExp("\\p{Cc}", "u");
|
|
430
456
|
|
|
431
457
|
// packages/ceal-client-protocol/src/operation-contract-validation.ts
|
|
432
|
-
var CEAL_OPERATION_AUTHORITY_POLICY_KEYS = Object.freeze(["
|
|
458
|
+
var CEAL_OPERATION_AUTHORITY_POLICY_KEYS = Object.freeze(["access_group", "instance_binding", "target", "admission_recheck"]);
|
|
433
459
|
var MAX_OPERATION_INPUT_RESOLVER_BINDINGS = 96;
|
|
460
|
+
var CEAL_OPERATION_DESCRIPTOR_REQUIRED_ENVELOPE_KEYS = Object.freeze(["schema_version", "id", "input_contract", "result_contract", "policy"]);
|
|
461
|
+
var CEAL_OPERATION_DESCRIPTOR_OPTIONAL_ENVELOPE_KEYS = Object.freeze(["input_resolution", "summary"]);
|
|
434
462
|
var CEAL_OPERATION_RESULT_KEYS = vocabulary(["ok", "operation_id", "operation_receipt", "schema_version", "value"]);
|
|
435
463
|
var CEAL_OPERATION_COMPACT_RESULT_KEYS = vocabulary(["ok", "operation_evidence", "operation_id", "schema_version", "value"]);
|
|
436
464
|
|
|
@@ -504,6 +532,7 @@ var CEAL_SCHEMA_LITERALS = [
|
|
|
504
532
|
"ceal.operation_descriptor.v1",
|
|
505
533
|
"ceal.operation_error.v1",
|
|
506
534
|
"ceal.operation_failure.v1",
|
|
535
|
+
"ceal.operation_failure.compact.v1",
|
|
507
536
|
"ceal.operation_receipt.v1",
|
|
508
537
|
"ceal.operation_result.v1",
|
|
509
538
|
"ceal.operation_result.compact.v1",
|
|
@@ -529,17 +558,16 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
|
|
|
529
558
|
engagement_signal: (root) => join(root, "runtime-state", "slack-feedback.jsonl"),
|
|
530
559
|
runtime_error: (root) => join(root, "runtime-state", "runtime-errors.jsonl"),
|
|
531
560
|
turn_bridge_request: (root) => join(root, ".ceal", "turn-bridge", "requests.jsonl"),
|
|
532
|
-
channel_log: (root) => join(root, "log.jsonl"),
|
|
533
561
|
thread_run_events: (root) => join(root, "run-events.jsonl"),
|
|
534
562
|
bounded_store_sidecar: (root) => `${root}.jsonl`,
|
|
535
563
|
gateway_audit_archive: (root) => `${root}.jsonl`,
|
|
536
564
|
gateway_capability_audit: (root) => join(root, "capability-audit.jsonl"),
|
|
537
565
|
gateway_retrieval_waste_partition: (root) => `${root}.jsonl`,
|
|
538
566
|
gateway_access_policy_publication: (root) => join(root, "access-policy-publications.jsonl"),
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
567
|
+
gateway_access_group_connector_control_audit: (root) => `${root}.audit.jsonl`,
|
|
568
|
+
gateway_access_group_connector_scope_audit: (root) => join(root, "profile-connector-scope-audit.jsonl"),
|
|
569
|
+
gateway_access_group_connector_activity_scope_audit: (root) => join(root, "profile-connector-activity-scope-audit.jsonl"),
|
|
570
|
+
gateway_access_group_connector_readiness_audit: (root) => join(root, "profile-connector-readiness.audit.jsonl"),
|
|
543
571
|
gateway_organization_audit_ledger: (root) => join(root, "organization-ledger.jsonl"),
|
|
544
572
|
gateway_personal_client_audit: (root) => join(root, "audit.jsonl"),
|
|
545
573
|
gateway_personal_client_access_audit: (root) => join(root, "access-audit.jsonl"),
|
|
@@ -590,12 +618,6 @@ var CEAL_AGENT_SESSION_COMMIT_KEYS = vocabulary(["attempt_ref", "expected_sessio
|
|
|
590
618
|
// packages/ceal-client-protocol/src/operation-next-actions.ts
|
|
591
619
|
var CALLER_RECOVERABLE_NEXT_ACTION_VALUES = [
|
|
592
620
|
"select_did_you_mean",
|
|
593
|
-
// The graph, not the argument list, is what the caller must change: the
|
|
594
|
-
// resolver that owns this input has no producing node upstream, and no edit
|
|
595
|
-
// to the invocation can conjure one. `resolver_dependency_absent` carried no
|
|
596
|
-
// remedy at all rather than borrow a word that means something else, so the
|
|
597
|
-
// scorer read a fully-diagnosed, caller-fixable refusal as a failed run.
|
|
598
|
-
"request.graph.append",
|
|
599
621
|
"choose_new_output_path",
|
|
600
622
|
"choose_new_idempotency_key",
|
|
601
623
|
"restart_search",
|
|
@@ -647,8 +669,6 @@ var NON_REMEDY_NEXT_ACTION_VALUES = [
|
|
|
647
669
|
"reconcile_occurrence",
|
|
648
670
|
"reduce_request_size",
|
|
649
671
|
"repair_or_adopt_session",
|
|
650
|
-
"request.effect_approval.read",
|
|
651
|
-
"request.run",
|
|
652
672
|
"retry",
|
|
653
673
|
// The owner -- a correlation hook, an approval hook -- is not serving right
|
|
654
674
|
// now. The caller changes nothing and the same call succeeds once the owner
|
|
@@ -745,12 +765,12 @@ var CEAL_REQUEST_JSON_SCHEMA = {
|
|
|
745
765
|
additionalProperties: false,
|
|
746
766
|
properties: {
|
|
747
767
|
instance_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
748
|
-
|
|
768
|
+
access_group_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
749
769
|
principal_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
750
770
|
execution_subject_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
751
771
|
authority_revision_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source }
|
|
752
772
|
},
|
|
753
|
-
required: ["instance_ref", "
|
|
773
|
+
required: ["instance_ref", "access_group_ref", "principal_ref", "execution_subject_ref", "authority_revision_ref"]
|
|
754
774
|
},
|
|
755
775
|
prompt_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
756
776
|
host_session_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
@@ -876,7 +896,7 @@ var CEAL_HOST_OBSERVATION_KINDS = vocabulary(["prompt", "session", "turn", "mode
|
|
|
876
896
|
function isCealHostPromptObservationValue(value) {
|
|
877
897
|
return isOperationRecord(value) && Object.keys(value).length === 1 && isCealDigest(value.body_sha256);
|
|
878
898
|
}
|
|
879
|
-
var HOST_RESERVED_KEY = /^(?:admission|approval|audit|authorization|cancellation|capability|effect|grant|occurrence|operation|policy|profile|provider_readback|receipt|reconciliation|replay|target|write_request)(?:_|$)/iu;
|
|
899
|
+
var HOST_RESERVED_KEY = /^(?:access_group|admission|approval|audit|authorization|cancellation|capability|effect|grant|occurrence|operation|policy|profile|provider_readback|receipt|reconciliation|replay|target|write_request)(?:_|$)/iu;
|
|
880
900
|
function assertHostObservationValue(value, kind) {
|
|
881
901
|
if (value === void 0) invalid("Ceal Host observation value is invalid.");
|
|
882
902
|
if (kind === "prompt" && !isCealHostPromptObservationValue(value)) invalid("Ceal Host prompt observation must contain only its body digest.");
|
|
@@ -896,6 +916,10 @@ function inspectHostKeys(value) {
|
|
|
896
916
|
}
|
|
897
917
|
}
|
|
898
918
|
|
|
919
|
+
// packages/ceal-client-protocol/src/host-prompt-ref.ts
|
|
920
|
+
var CEAL_HOST_PROMPT_DIGEST_PATTERN = "^[a-f0-9]{64}$";
|
|
921
|
+
var PROMPT_DIGEST = new RegExp(CEAL_HOST_PROMPT_DIGEST_PATTERN, "u");
|
|
922
|
+
|
|
899
923
|
// packages/ceal-client-protocol/src/request-effect-approval.ts
|
|
900
924
|
var CEAL_EFFECT_APPROVAL_DECISION_CHECK_PHRASES = Object.freeze([
|
|
901
925
|
"observed after this approval was raised and before it expires",
|
|
@@ -911,6 +935,12 @@ var OWNER_WRITE_STATES = Object.freeze(["attempt_started", "provider_acknowledge
|
|
|
911
935
|
var OWNER_EFFECT_STATES = Object.freeze(["none", "applied", "failed", "unknown", "reconciled"]);
|
|
912
936
|
var OWNER_RECEIPT_STATES = Object.freeze(["pending", "available", "failed", "unknown", "reconciled"]);
|
|
913
937
|
|
|
938
|
+
// packages/ceal-client-protocol/src/thread-excerpt.ts
|
|
939
|
+
var CEAL_THREAD_RECENT_WINDOW = 6;
|
|
940
|
+
var CEAL_THREAD_LAST_APP_MESSAGES_WINDOW = 3;
|
|
941
|
+
var CEAL_THREAD_OLDER_SUMMARY_WINDOW = 4;
|
|
942
|
+
var CEAL_FED_THREAD_MESSAGE_LIMIT = CEAL_THREAD_RECENT_WINDOW + CEAL_THREAD_OLDER_SUMMARY_WINDOW + CEAL_THREAD_LAST_APP_MESSAGES_WINDOW;
|
|
943
|
+
|
|
914
944
|
// packages/ceal-client-protocol/src/request-graph-readiness.ts
|
|
915
945
|
var REQUEST_GRAPH_PRODUCER_TO_APPEND_SCHEMA = {
|
|
916
946
|
type: "object",
|
|
@@ -1016,21 +1046,12 @@ function exactKeys(value, expected) {
|
|
|
1016
1046
|
var REQUIRED_FIELDS = Object.freeze(["schema_version", "operation_id", "local_path", "content_json_pointer", "size_bytes", "sha256", "read_argv"]);
|
|
1017
1047
|
var FIELDS = /* @__PURE__ */ new Set([...REQUIRED_FIELDS, "local_result_root", "model_disclosure"]);
|
|
1018
1048
|
|
|
1019
|
-
// packages/ceal-client-protocol/src/
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
if (!isCealJsonRecord(authority) || typeof authority.instance_ref !== "string" || typeof authority.profile_ref !== "string") return null;
|
|
1026
|
-
return Object.freeze({ instance_ref: authority.instance_ref, profile_ref: authority.profile_ref });
|
|
1027
|
-
}
|
|
1028
|
-
function isProfileReadResult(value) {
|
|
1029
|
-
return isCealJsonRecord(value) && value.schema_version === "ceal.operation_result.v1" && value.ok === true && value.operation_id === "profile.read";
|
|
1030
|
-
}
|
|
1031
|
-
function isUnaffectingAvailableReceipt(value) {
|
|
1032
|
-
return isCealJsonRecord(value) && value.effect === "none" && value.provider_handoff === "not_offered" && isCealJsonRecord(value.terminal) && value.terminal.availability === "available";
|
|
1033
|
-
}
|
|
1049
|
+
// packages/ceal-client-protocol/src/session-start-affordance.ts
|
|
1050
|
+
var CEAL_SESSION_ENTRY_INVOCATION = "ceal";
|
|
1051
|
+
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.`;
|
|
1052
|
+
|
|
1053
|
+
// packages/ceal-client-protocol/src/discovery-manifest.ts
|
|
1054
|
+
var CEAL_DISCOVERY_MANIFEST_CONNECTOR_KINDS = vocabulary(["github", "google-workspace", "notion", "slack"]);
|
|
1034
1055
|
|
|
1035
1056
|
// packages/ceal-client-protocol/src/conversation-contracts.ts
|
|
1036
1057
|
var CEAL_APPROVAL_POLICY_KINDS = vocabulary(["requester_only", "named_users", "role_based"]);
|
|
@@ -1248,7 +1269,7 @@ var CEAL_PRESENTATION_INTENTS = vocabulary(["progress", ...CEAL_FINAL_PRESENTATI
|
|
|
1248
1269
|
|
|
1249
1270
|
// packages/ceal-client-protocol/src/personal-client-vocabulary.ts
|
|
1250
1271
|
var CEAL_PERSONAL_CLIENT_BINDING_KEYS = vocabulary([
|
|
1251
|
-
"
|
|
1272
|
+
"access_group_ref",
|
|
1252
1273
|
"membership_ref",
|
|
1253
1274
|
"registration_ref",
|
|
1254
1275
|
"client_ref",
|
|
@@ -1263,7 +1284,8 @@ var CEAL_REFRESH_FAILURE_CODES = vocabulary([
|
|
|
1263
1284
|
"refresh_replayed",
|
|
1264
1285
|
"refresh_revoked",
|
|
1265
1286
|
"authority_replaced",
|
|
1266
|
-
"refresh_recovery_unavailable"
|
|
1287
|
+
"refresh_recovery_unavailable",
|
|
1288
|
+
"refresh_recovery_expired"
|
|
1267
1289
|
]);
|
|
1268
1290
|
|
|
1269
1291
|
// packages/ceal-client-protocol/src/device-enrollment.ts
|
|
@@ -1290,8 +1312,8 @@ function hostTerminalFailure(error, component) {
|
|
|
1290
1312
|
if (code3 === "ENOENT") return { code: "host_dependency_unavailable", message: `A command or file the ${component} Host needs is unavailable: ${detail}`, next_action: "Install the missing dependency or restore the missing file, then rerun this command." };
|
|
1291
1313
|
if (code3 === "EACCES" || code3 === "EPERM") return { code: "host_permission_denied", message: `The ${component} Host was refused access to a local path: ${detail}`, next_action: "Repair the ownership or mode of the named path, then rerun this command." };
|
|
1292
1314
|
if (code3 === "ENOSPC") return { code: "host_storage_unavailable", message: `The ${component} Host could not write local state: ${detail}`, next_action: "Free local disk space, then rerun this command." };
|
|
1293
|
-
if (code3 !== null && HOST_OWNED_CODE.test(code3)) return { code: code3, message: `The ${component} Host command failed: ${detail}`, next_action: `Resolve the named failure above; run \`ceal-host doctor
|
|
1294
|
-
return { code: "host_failure_unclassified", message: `The ${component} Host command failed for a cause it cannot classify: ${detail}`, next_action: `Run \`ceal-host doctor
|
|
1315
|
+
if (code3 !== null && HOST_OWNED_CODE.test(code3)) return { code: code3, message: `The ${component} Host command failed: ${detail}`, next_action: `Resolve the named failure above; run \`ceal-host doctor\` only if it reports installed ${component} Host drift.` };
|
|
1316
|
+
return { code: "host_failure_unclassified", message: `The ${component} Host command failed for a cause it cannot classify: ${detail}`, next_action: `Run \`ceal-host doctor\`; if it reports no drift then the ${component} Host configuration is not the cause, and the message above is the only evidence of what is.` };
|
|
1295
1317
|
}
|
|
1296
1318
|
var DOCTOR_FLAGS = Object.freeze({
|
|
1297
1319
|
"--expected-sha256": "expected_sha256",
|
|
@@ -1588,12 +1610,19 @@ var RELAY_QUARANTINE_MAX_BYTES = 16 * 1024 * 1024;
|
|
|
1588
1610
|
|
|
1589
1611
|
// host/relay/src/relay-admission-store.ts
|
|
1590
1612
|
var DEFAULT_LIMITS = { global_count: 8192, global_bytes: 64 * 1024 * 1024, producer_count: 4096, producer_bytes: 32 * 1024 * 1024 };
|
|
1613
|
+
var RETRY_SECONDS = [1, 2, 4, 8, 16, 32, 60];
|
|
1614
|
+
var MAX_RETRYABLE_ATTEMPTS = RETRY_SECONDS.length + 10;
|
|
1591
1615
|
|
|
1592
1616
|
// host/relay/src/relay-request-binding-store.ts
|
|
1593
1617
|
var MAX_STATE_BYTES = 8 * 1024 * 1024;
|
|
1594
1618
|
|
|
1595
1619
|
// host/relay/src/relay-ipc.ts
|
|
1596
1620
|
import { createConnection, createServer } from "node:net";
|
|
1621
|
+
|
|
1622
|
+
// host/relay/src/current-prompt-custody.ts
|
|
1623
|
+
var HOST_CURRENT_PROMPT_MAX_BYTES = 256 * 1024;
|
|
1624
|
+
|
|
1625
|
+
// host/relay/src/relay-ipc.ts
|
|
1597
1626
|
var HOST_RELAY_REQUEST_BINDING_KEYS = Object.freeze([
|
|
1598
1627
|
"schema_version",
|
|
1599
1628
|
"producer_id",
|
|
@@ -1610,8 +1639,6 @@ var HOST_RELAY_REQUEST_BINDING_KEYS = Object.freeze([
|
|
|
1610
1639
|
"host_input_ref"
|
|
1611
1640
|
]);
|
|
1612
1641
|
var HOST_RELAY_IPC_RESPONSE_SCHEMA = "ceal.host_relay_admission.v1";
|
|
1613
|
-
var HOST_RELAY_BINDING_QUERY_SCHEMA = "ceal.host_relay_binding_query.v1";
|
|
1614
|
-
var HOST_RELAY_BINDING_RESULT_SCHEMA = "ceal.host_relay_binding_result.v1";
|
|
1615
1642
|
var HOST_RELAY_INVOCATION_CONTEXT_QUERY_SCHEMA = "ceal.host_relay_invocation_context_query.v1";
|
|
1616
1643
|
var HOST_RELAY_INVOCATION_CONTEXT_RESULT_SCHEMA = "ceal.host_relay_invocation_context_result.v1";
|
|
1617
1644
|
var HOST_RELAY_IPC_LENGTH_BYTES = Uint32Array.BYTES_PER_ELEMENT;
|
|
@@ -1624,18 +1651,13 @@ var HostRelayIpcError = class extends Error {
|
|
|
1624
1651
|
this.code = code3;
|
|
1625
1652
|
}
|
|
1626
1653
|
};
|
|
1627
|
-
var
|
|
1654
|
+
var HostRelayInvocationContextPort = class {
|
|
1628
1655
|
endpoint;
|
|
1629
|
-
|
|
1630
|
-
constructor(endpoint, timeoutMs = 5e3) {
|
|
1656
|
+
constructor(endpoint) {
|
|
1631
1657
|
this.endpoint = endpoint;
|
|
1632
|
-
this.timeout_ms = timeoutMs;
|
|
1633
1658
|
}
|
|
1634
|
-
|
|
1635
|
-
return
|
|
1636
|
-
}
|
|
1637
|
-
mintInvocationContext(input) {
|
|
1638
|
-
return queryHostRelayInvocationContext(this.endpoint, input, this.timeout_ms);
|
|
1659
|
+
mintInvocationContext(input, signal) {
|
|
1660
|
+
return queryHostRelayInvocationContext(this.endpoint, input, signal);
|
|
1639
1661
|
}
|
|
1640
1662
|
};
|
|
1641
1663
|
var HostRelayIpcAdmissionPort = class {
|
|
@@ -1654,32 +1676,29 @@ var HostRelayIpcAdmissionPort = class {
|
|
|
1654
1676
|
function submitHostProducerFrame(endpoint, frame, timeoutMs = 5e3) {
|
|
1655
1677
|
return exchange(endpoint, encodeHostProducerFrame(frame), timeoutMs, decodeResponseBuffer);
|
|
1656
1678
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
const response2 = await exchange(endpoint, request2, timeoutMs, decodeBindingResponseBuffer);
|
|
1660
|
-
if (response2.status === "no_binding") return { status: "no_binding" };
|
|
1661
|
-
return { status: "ready", binding: response2.binding };
|
|
1662
|
-
}
|
|
1663
|
-
function decodeHostRelayBindingQueryResult(value) {
|
|
1664
|
-
if (!validBindingResponse(value)) throw new HostRelayIpcError("relay_unavailable", "Host Relay binding response is invalid.");
|
|
1665
|
-
return value.status === "no_binding" ? { status: "no_binding" } : { status: "ready", binding: value.binding };
|
|
1679
|
+
function queryHostRelayInvocationContext(endpoint, query, signal) {
|
|
1680
|
+
return exchange(endpoint, encodeInvocationContextQuery(query), void 0, decodeInvocationContextResponseBuffer, signal);
|
|
1666
1681
|
}
|
|
1667
|
-
function
|
|
1668
|
-
return exchange(endpoint, encodeInvocationContextQuery(query), timeoutMs, decodeInvocationContextResponseBuffer);
|
|
1669
|
-
}
|
|
1670
|
-
function exchange(endpoint, encoded, timeoutMs, decode) {
|
|
1682
|
+
function exchange(endpoint, encoded, timeoutMs, decode, signal) {
|
|
1671
1683
|
return new Promise((resolve, reject) => {
|
|
1672
1684
|
const socket = createConnection(endpoint);
|
|
1673
1685
|
let buffer = Buffer.alloc(0);
|
|
1674
1686
|
let settled = false;
|
|
1687
|
+
const aborted = () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC was cancelled."));
|
|
1675
1688
|
const finish = (error, response2) => {
|
|
1676
1689
|
if (settled) return;
|
|
1677
1690
|
settled = true;
|
|
1691
|
+
signal?.removeEventListener("abort", aborted);
|
|
1678
1692
|
socket.destroy();
|
|
1679
1693
|
if (error !== null) reject(error);
|
|
1680
1694
|
else if (response2 !== void 0) resolve(response2);
|
|
1681
1695
|
};
|
|
1682
|
-
socket.setTimeout(timeoutMs, () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC timed out.")));
|
|
1696
|
+
if (timeoutMs !== void 0) socket.setTimeout(timeoutMs, () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC timed out.")));
|
|
1697
|
+
if (signal?.aborted === true) {
|
|
1698
|
+
aborted();
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
signal?.addEventListener("abort", aborted, { once: true });
|
|
1683
1702
|
socket.once("error", () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC is unavailable.")));
|
|
1684
1703
|
socket.once("connect", () => socket.write(encoded));
|
|
1685
1704
|
socket.on("data", (chunk) => {
|
|
@@ -1732,42 +1751,23 @@ function decodeResponseBuffer(buffer) {
|
|
|
1732
1751
|
if (buffer.length !== length + HOST_RELAY_IPC_LENGTH_BYTES) throw new HostRelayIpcError("relay_unavailable", `Host Relay IPC returned trailing bytes: ${refusalFacts([{ name: "declared_bytes", value: length, expected: `the received message length minus ${HOST_RELAY_IPC_LENGTH_BYTES}` }, { name: "received_bytes", value: buffer.byteLength, expected: `exactly ${length + HOST_RELAY_IPC_LENGTH_BYTES}` }])}.`);
|
|
1733
1752
|
return decodeHostRelayIpcResponse(buffer);
|
|
1734
1753
|
}
|
|
1735
|
-
function decodeBindingResponseBuffer(buffer) {
|
|
1736
|
-
const value = decodeLengthPrefixedJson(buffer, HOST_RELAY_QUERY_RESPONSE_MAX_BYTES);
|
|
1737
|
-
if (value === null) return null;
|
|
1738
|
-
const decoded = decodeHostRelayBindingQueryResult(value);
|
|
1739
|
-
return decoded.status === "no_binding" ? { schema_version: HOST_RELAY_BINDING_RESULT_SCHEMA, status: "no_binding" } : { schema_version: HOST_RELAY_BINDING_RESULT_SCHEMA, status: "ready", binding: decoded.binding };
|
|
1740
|
-
}
|
|
1741
1754
|
function decodeInvocationContextResponseBuffer(buffer) {
|
|
1742
1755
|
const value = decodeLengthPrefixedJson(buffer, HOST_RELAY_QUERY_RESPONSE_MAX_BYTES);
|
|
1743
1756
|
if (value === null) return null;
|
|
1744
1757
|
if (!validInvocationContextResponse(value)) throw new HostRelayIpcError("relay_unavailable", "Host Relay invocation context response is invalid.");
|
|
1745
1758
|
return value;
|
|
1746
1759
|
}
|
|
1747
|
-
function encodeBindingQuery(query) {
|
|
1748
|
-
const value = { schema_version: HOST_RELAY_BINDING_QUERY_SCHEMA, ...query };
|
|
1749
|
-
if (!validBindingQueryRequest(value)) throw new HostRelayIpcError("invalid_frame_shape", "Host Relay binding query is invalid.");
|
|
1750
|
-
return encodeLengthPrefixed(value);
|
|
1751
|
-
}
|
|
1752
1760
|
function encodeInvocationContextQuery(query) {
|
|
1753
1761
|
const value = { schema_version: HOST_RELAY_INVOCATION_CONTEXT_QUERY_SCHEMA, ...query };
|
|
1754
1762
|
if (!validInvocationContextQueryRequest(value)) throw new HostRelayIpcError("invalid_frame_shape");
|
|
1755
1763
|
return encodeLengthPrefixed(value);
|
|
1756
1764
|
}
|
|
1757
|
-
function validBindingQueryRequest(value) {
|
|
1758
|
-
return validQueryIdentity(value, HOST_RELAY_BINDING_QUERY_SCHEMA) && exactKeys3(value, ["schema_version", "producer_id", "producer_installation_ref", "local_session_ref", "local_turn_ref"]);
|
|
1759
|
-
}
|
|
1760
1765
|
function validInvocationContextQueryRequest(value) {
|
|
1761
1766
|
return validQueryIdentity(value, HOST_RELAY_INVOCATION_CONTEXT_QUERY_SCHEMA) && exactKeys3(value, ["schema_version", "producer_id", "producer_installation_ref", "local_session_ref", "local_turn_ref", "client_nonce"]) && typeof value.client_nonce === "string" && CEAL_HOST_CLIENT_NONCE_PATTERN.test(value.client_nonce);
|
|
1762
1767
|
}
|
|
1763
1768
|
function validQueryIdentity(value, schema) {
|
|
1764
1769
|
return record2(value) && value.schema_version === schema && (value.producer_id === "codex" || value.producer_id === "claude") && safeRef2(value.producer_installation_ref) && safeRef2(value.local_session_ref) && safeRef2(value.local_turn_ref);
|
|
1765
1770
|
}
|
|
1766
|
-
function validBindingResponse(value) {
|
|
1767
|
-
if (!record2(value) || value.schema_version !== HOST_RELAY_BINDING_RESULT_SCHEMA) return false;
|
|
1768
|
-
if (value.status === "no_binding") return Object.keys(value).length === 2;
|
|
1769
|
-
return value.status === "ready" && Object.keys(value).length === 3 && validWireBinding(value.binding);
|
|
1770
|
-
}
|
|
1771
1771
|
function validInvocationContextResponse(value) {
|
|
1772
1772
|
if (!record2(value) || value.schema_version !== HOST_RELAY_INVOCATION_CONTEXT_RESULT_SCHEMA) return false;
|
|
1773
1773
|
if (value.status === "no_binding") return Object.keys(value).length === 2;
|
|
@@ -1779,19 +1779,6 @@ function validInvocationContextResponse(value) {
|
|
|
1779
1779
|
return false;
|
|
1780
1780
|
}
|
|
1781
1781
|
}
|
|
1782
|
-
function validWireBinding(value) {
|
|
1783
|
-
if (!record2(value) || value.schema_version !== "ceal.host_relay_request_binding.v1" || value.producer_id !== "codex" && value.producer_id !== "claude") return false;
|
|
1784
|
-
const required = HOST_RELAY_REQUEST_BINDING_KEYS;
|
|
1785
|
-
const keys = Object.keys(value);
|
|
1786
|
-
return required.every((key) => Object.hasOwn(value, key)) && keys.every((key) => required.includes(key) || key === "context_expires_at") && validWireBindingRefs(value) && validWireBindingTimes(value);
|
|
1787
|
-
}
|
|
1788
|
-
function validWireBindingRefs(value) {
|
|
1789
|
-
const tuple = [value.host_source_ref, value.host_session_ref, value.host_turn_ref, value.host_input_ref];
|
|
1790
|
-
return [value.producer_installation_ref, value.local_session_ref, value.local_turn_ref, value.prompt_ref, value.request_ref].every(safeRef2) && Array.isArray(value.local_turn_aliases) && value.local_turn_aliases.length <= 16 && value.local_turn_aliases.every(safeRef2) && tuple.every(safeRef2);
|
|
1791
|
-
}
|
|
1792
|
-
function validWireBindingTimes(value) {
|
|
1793
|
-
return validTimestamp(value.bound_at) && (value.context_expires_at === void 0 || validTimestamp(value.context_expires_at));
|
|
1794
|
-
}
|
|
1795
1782
|
function decodeLengthPrefixedJson(input, maximum) {
|
|
1796
1783
|
if (input.length < HOST_RELAY_IPC_LENGTH_BYTES) return null;
|
|
1797
1784
|
const length = input.readUInt32BE(0);
|
|
@@ -1817,14 +1804,12 @@ function exactKeys3(value, keys) {
|
|
|
1817
1804
|
function safeRef2(value) {
|
|
1818
1805
|
return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u.test(value);
|
|
1819
1806
|
}
|
|
1820
|
-
function validTimestamp(value) {
|
|
1821
|
-
return typeof value === "string" && Number.isFinite(Date.parse(value));
|
|
1822
|
-
}
|
|
1823
1807
|
|
|
1824
1808
|
// host/invocation-authentication-command.ts
|
|
1825
1809
|
var HOST_INVOCATION_AUTHENTICATION_COMMAND_PREFIX = ["authenticate", "--client-nonce"];
|
|
1810
|
+
var REFUSAL_REASON_PATTERN = /^[a-z][a-z0-9_ ]{0,63}$/u;
|
|
1826
1811
|
function installedHostInvocationAuthenticationCommandOptions(config) {
|
|
1827
|
-
const port = new
|
|
1812
|
+
const port = new HostRelayInvocationContextPort(config.relay_endpoint);
|
|
1828
1813
|
return {
|
|
1829
1814
|
host_source_ref: config.host_source_ref,
|
|
1830
1815
|
outbox_dir: config.outbox_dir,
|
|
@@ -1839,15 +1824,19 @@ async function runHostInvocationAuthenticationCommand(descriptor, args, options)
|
|
|
1839
1824
|
sink = resolved.options.output_sink;
|
|
1840
1825
|
writeResult(await authenticateHostInvocation(descriptor, resolved.input, resolved.options), sink);
|
|
1841
1826
|
return 0;
|
|
1842
|
-
} catch {
|
|
1843
|
-
writeResult({ ok: false, code: "invocation_authentication_unavailable" }, sink);
|
|
1827
|
+
} catch (error) {
|
|
1828
|
+
writeResult({ ok: false, code: "invocation_authentication_unavailable", reason: authenticationRefusalReason(error) }, sink);
|
|
1844
1829
|
return 2;
|
|
1845
1830
|
}
|
|
1846
1831
|
}
|
|
1832
|
+
function authenticationRefusalReason(error) {
|
|
1833
|
+
const message = error instanceof Error ? error.message : "";
|
|
1834
|
+
return REFUSAL_REASON_PATTERN.test(message) ? message : "unclassified";
|
|
1835
|
+
}
|
|
1847
1836
|
async function authenticateHostInvocation(descriptor, input, options) {
|
|
1848
1837
|
if (input.length !== HOST_INVOCATION_AUTHENTICATION_COMMAND_PREFIX.length + 1 || input[0] !== HOST_INVOCATION_AUTHENTICATION_COMMAND_PREFIX[0] || input[1] !== HOST_INVOCATION_AUTHENTICATION_COMMAND_PREFIX[1]) throw new TypeError("invalid arguments");
|
|
1849
1838
|
const request2 = decodeCealHostInvocationAuthenticationRequest({ schema_version: CEAL_HOST_INVOCATION_AUTHENTICATION_REQUEST_SCHEMA, client_nonce: input[2] });
|
|
1850
|
-
const config = validateOptions(options
|
|
1839
|
+
const config = validateOptions(options);
|
|
1851
1840
|
const now = (config.now ?? (() => /* @__PURE__ */ new Date()))();
|
|
1852
1841
|
const { store, current } = await currentInvocation(descriptor, config, now);
|
|
1853
1842
|
if (config.mint_invocation_context === void 0) throw new TypeError("mint unavailable");
|
|
@@ -1885,9 +1874,9 @@ async function resolveOptions(descriptor, args, options) {
|
|
|
1885
1874
|
options: installedHostInvocationAuthenticationCommandOptions(await descriptor.read_producer_config(configPath))
|
|
1886
1875
|
};
|
|
1887
1876
|
}
|
|
1888
|
-
function validateOptions(options
|
|
1877
|
+
function validateOptions(options) {
|
|
1889
1878
|
if (typeof options.outbox_dir !== "string" || options.outbox_dir.length === 0 || typeof options.host_source_ref !== "string" || !SAFE_REF.test(options.host_source_ref) || typeof options.producer_installation_ref !== "string" || !SAFE_REF.test(options.producer_installation_ref) || !validOptionalSession(options.session_id)) {
|
|
1890
|
-
throw new TypeError(
|
|
1879
|
+
throw new TypeError("options invalid");
|
|
1891
1880
|
}
|
|
1892
1881
|
return options;
|
|
1893
1882
|
}
|
|
@@ -2072,6 +2061,7 @@ function boundedMilliseconds(value) {
|
|
|
2072
2061
|
import { createHash as createHash2 } from "node:crypto";
|
|
2073
2062
|
|
|
2074
2063
|
// host/claude/src/claude-types.ts
|
|
2064
|
+
var CLAUDE_SESSION_ID_ENVIRONMENT = "CLAUDE_CODE_SESSION_ID";
|
|
2075
2065
|
var CLAUDE_HOST_ERROR_CODES = ["invalid_input", "storage", "configuration"];
|
|
2076
2066
|
function isClaudeHostErrorCode(value) {
|
|
2077
2067
|
return typeof value === "string" && CLAUDE_HOST_ERROR_CODES.some((code3) => code3 === value);
|
|
@@ -2462,10 +2452,9 @@ var CLAUDE_PRODUCER_DESCRIPTOR = {
|
|
|
2462
2452
|
|
|
2463
2453
|
// host/claude/src/claude-invocation-authentication-command.ts
|
|
2464
2454
|
var CLAUDE_INVOCATION_AUTHENTICATION_DESCRIPTOR = {
|
|
2465
|
-
command_name: "ceal-claude-invocation-authentication",
|
|
2466
2455
|
producer_id: "claude",
|
|
2467
2456
|
create_store: (directory) => new ClaudeOutboxStore(directory),
|
|
2468
|
-
session_id_env:
|
|
2457
|
+
session_id_env: CLAUDE_SESSION_ID_ENVIRONMENT,
|
|
2469
2458
|
session_ref: (_hostSourceRef, sessionId) => claudeLocalSessionRef(sessionId),
|
|
2470
2459
|
config_flag: HOST_PRODUCER_CONFIG_FLAG,
|
|
2471
2460
|
parse_config_flag: parseHostProducerConfigFlag,
|
|
@@ -2498,8 +2487,6 @@ async function doctorClient(options = {}, component) {
|
|
|
2498
2487
|
const contextInspection = await inspectCanonicalContext(options, executable, environment, run, component);
|
|
2499
2488
|
if (!contextInspection.ok) return contextInspection.failure;
|
|
2500
2489
|
const selected = contextInspection.value;
|
|
2501
|
-
const readbackFailure = await inspectAuthenticatedReadback(executable, selected, environment, run, component);
|
|
2502
|
-
if (readbackFailure !== null) return readbackFailure;
|
|
2503
2490
|
return {
|
|
2504
2491
|
ok: true,
|
|
2505
2492
|
status: "ready",
|
|
@@ -2510,9 +2497,7 @@ async function doctorClient(options = {}, component) {
|
|
|
2510
2497
|
source_tree: version.source_tree,
|
|
2511
2498
|
context_source: "canonical_user_config",
|
|
2512
2499
|
context_name: selected.name,
|
|
2513
|
-
instance_ref: selected.instance_ref
|
|
2514
|
-
profile_ref: selected.profile_ref,
|
|
2515
|
-
authenticated_readback: "profile.read"
|
|
2500
|
+
instance_ref: selected.instance_ref
|
|
2516
2501
|
};
|
|
2517
2502
|
}
|
|
2518
2503
|
async function inspectExecutable(options, environment, component) {
|
|
@@ -2543,16 +2528,11 @@ function probeCode(code3) {
|
|
|
2543
2528
|
return "ceal_output_unreadable";
|
|
2544
2529
|
}
|
|
2545
2530
|
async function inspectCanonicalContext(options, executable, environment, run, component) {
|
|
2546
|
-
const probe = hostClientProbe(await safeRun(run, executable.path, ["
|
|
2547
|
-
if (probe.kind === "unreachable") return probeFailure(probe, "
|
|
2531
|
+
const probe = hostClientProbe(await safeRun(run, executable.path, ["access-group", "list"], environment), (result) => selectedContext(commandDocument(result)));
|
|
2532
|
+
if (probe.kind === "unreachable") return probeFailure(probe, "access-group list", component, options);
|
|
2548
2533
|
if (probe.kind !== "value" || options.expected_instance_ref !== void 0 && probe.value.instance_ref !== options.expected_instance_ref) return inspectedFailure("canonical_context_unavailable", `The ${component} Host cannot select the intended authenticated context from Ceal's canonical user configuration (${refusalFacts([{ name: "probe_kind", value: probe.kind, expected: "value" }, { name: "instance_ref", value: probe.kind === "value" ? probe.value.instance_ref : "unavailable", expected: options.expected_instance_ref ?? "a selected context" }])}).`, `Run \`ceal session adopt --email <email>\` without CEAL context overrides, then restart ${component}.`);
|
|
2549
2534
|
return { ok: true, value: probe.value };
|
|
2550
2535
|
}
|
|
2551
|
-
async function inspectAuthenticatedReadback(executable, selected, environment, run, component) {
|
|
2552
|
-
const result = await safeRun(run, executable.path, ["profile", "show"], environment);
|
|
2553
|
-
if (result !== null && result.exit_code === 0 && readbackProvesSelectedContext(commandDocument(result), selected)) return null;
|
|
2554
|
-
return failure("gateway_context_unavailable", "The canonical Ceal context could not complete an authenticated Gateway readback.", `Inspect the structured \`ceal profile show\` failure, repair or re-adopt the context, then restart ${component} if its environment changed.`);
|
|
2555
|
-
}
|
|
2556
2536
|
function inspectedFailure(code3, message, nextAction) {
|
|
2557
2537
|
return { ok: false, failure: failure(code3, message, nextAction) };
|
|
2558
2538
|
}
|
|
@@ -2624,25 +2604,21 @@ function commandDocument(result) {
|
|
|
2624
2604
|
}
|
|
2625
2605
|
}
|
|
2626
2606
|
function selectedContext(value) {
|
|
2627
|
-
if (value?.schema_version !== "ceal.
|
|
2607
|
+
if (value?.schema_version !== "ceal.access-group.v1" || value.ok !== true || !Array.isArray(value.contexts)) return null;
|
|
2628
2608
|
const selected = value.contexts.filter((item) => isRecord2(item) && item.selected === true);
|
|
2629
2609
|
if (selected.length !== 1) return null;
|
|
2630
2610
|
return selectedContextRecord(selected[0]);
|
|
2631
2611
|
}
|
|
2632
2612
|
function selectedContextRecord(item) {
|
|
2633
|
-
if (!isRecord2(item) || typeof item.name !== "string" || typeof item.instance_ref !== "string"
|
|
2634
|
-
if (!SAFE_REF6.test(item.instance_ref)
|
|
2635
|
-
return { name: item.name, instance_ref: item.instance_ref
|
|
2613
|
+
if (!isRecord2(item) || typeof item.name !== "string" || typeof item.instance_ref !== "string") return null;
|
|
2614
|
+
if (!SAFE_REF6.test(item.instance_ref)) return null;
|
|
2615
|
+
return { name: item.name, instance_ref: item.instance_ref };
|
|
2636
2616
|
}
|
|
2637
2617
|
function versionIdentity(value) {
|
|
2638
2618
|
if (value?.schema_version !== "ceal.version.v1" || value.ok !== true || typeof value.version !== "string" || typeof value.source_commit !== "string" || typeof value.source_tree !== "string") return null;
|
|
2639
2619
|
if (value.version.length === 0 || !GIT_OID.test(value.source_commit) || !GIT_OID.test(value.source_tree)) return null;
|
|
2640
2620
|
return { version: value.version, source_commit: value.source_commit, source_tree: value.source_tree };
|
|
2641
2621
|
}
|
|
2642
|
-
function readbackProvesSelectedContext(value, selected) {
|
|
2643
|
-
const authority = cealAuthenticatedProfileReadback(value);
|
|
2644
|
-
return authority?.instance_ref === selected.instance_ref && authority.profile_ref === selected.profile_ref;
|
|
2645
|
-
}
|
|
2646
2622
|
function validExpectations(options) {
|
|
2647
2623
|
return (options.expected_sha256 === void 0 || SHA2562.test(options.expected_sha256)) && (options.expected_source_commit === void 0 || GIT_OID.test(options.expected_source_commit)) && (options.expected_instance_ref === void 0 || SAFE_REF6.test(options.expected_instance_ref));
|
|
2648
2624
|
}
|