@corca-org/ceal-host-linux-arm64 1.0.9 → 1.0.11
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 +0 -0
- package/libexec/ceal-host/claude-hook.mjs +564 -205
- package/libexec/ceal-host/claude-invocation-authentication.mjs +588 -201
- package/libexec/ceal-host/claude-producer.mjs +620 -199
- package/libexec/ceal-host/codex-hook.mjs +1071 -576
- package/libexec/ceal-host/codex-invocation-authentication.mjs +770 -376
- package/libexec/ceal-host/codex-producer.mjs +805 -377
- package/libexec/ceal-host/control.mjs +1587 -777
- package/libexec/ceal-host/relay.mjs +1162 -564
- package/package.json +1 -1
- package/share/ceal-host/bundle-manifest.json +12 -12
- package/share/ceal-host/bundle-manifest.sigstore.json +1 -1
|
@@ -61,6 +61,46 @@ var client_wire_contract_default = {
|
|
|
61
61
|
schema_version: "ceal.command_request.v1",
|
|
62
62
|
absolute_transport_max_bytes: 65536
|
|
63
63
|
},
|
|
64
|
+
command_resolution: {
|
|
65
|
+
schema_version: "ceal.gateway_command_resolution.v1",
|
|
66
|
+
authority: {
|
|
67
|
+
anonymous: {
|
|
68
|
+
state: "anonymous",
|
|
69
|
+
fields: [
|
|
70
|
+
"state"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
authenticated: {
|
|
74
|
+
state: "authenticated",
|
|
75
|
+
fields: [
|
|
76
|
+
"state",
|
|
77
|
+
"principal_kind",
|
|
78
|
+
"organization_ref",
|
|
79
|
+
"instance_ref",
|
|
80
|
+
"access_group_ref",
|
|
81
|
+
"principal_ref",
|
|
82
|
+
"authority_revision_ref"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
semantic_options: {
|
|
87
|
+
inspection: {
|
|
88
|
+
values: [
|
|
89
|
+
"default",
|
|
90
|
+
"full"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
cache_mode: {
|
|
94
|
+
values: [
|
|
95
|
+
"default",
|
|
96
|
+
"bypass"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
compact: {
|
|
100
|
+
type: "boolean"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
64
104
|
command_response: {
|
|
65
105
|
schema_version: "ceal.command_response.v1",
|
|
66
106
|
descriptor_field: "verified_artifact",
|
|
@@ -74,12 +114,15 @@ var client_wire_contract_default = {
|
|
|
74
114
|
],
|
|
75
115
|
bare_document_fields: [
|
|
76
116
|
"invocation",
|
|
77
|
-
"required_action_sequence",
|
|
78
117
|
"entrypoints",
|
|
79
118
|
"common_concepts",
|
|
80
119
|
"operations",
|
|
81
120
|
"catalog_revision"
|
|
82
121
|
],
|
|
122
|
+
bare_document_optional_fields: [
|
|
123
|
+
"required_action_sequence",
|
|
124
|
+
"withheld"
|
|
125
|
+
],
|
|
83
126
|
prompt_field: "prompt",
|
|
84
127
|
prompt_schema_version: "ceal.prompt.v1",
|
|
85
128
|
focused_prompt_document_fields: [
|
|
@@ -92,7 +135,7 @@ var client_wire_contract_default = {
|
|
|
92
135
|
"prompt"
|
|
93
136
|
],
|
|
94
137
|
discovery_command: "discovery",
|
|
95
|
-
discovery_manifest_schema_version: "ceal.discovery_manifest.
|
|
138
|
+
discovery_manifest_schema_version: "ceal.discovery_manifest.v2",
|
|
96
139
|
discovery_manifest_document_fields: [
|
|
97
140
|
"discovery_manifest"
|
|
98
141
|
],
|
|
@@ -100,11 +143,29 @@ var client_wire_contract_default = {
|
|
|
100
143
|
bare_document_max_bytes: 65536,
|
|
101
144
|
complete_max_bytes: 66019,
|
|
102
145
|
absolute_transport_max_bytes: 4194304
|
|
146
|
+
},
|
|
147
|
+
resource_stream: {
|
|
148
|
+
path: "/api/ceal/v2/resources",
|
|
149
|
+
request_schema_version: "ceal.resource_stream_request.v1",
|
|
150
|
+
ref_pattern: "^resource:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
|
|
151
|
+
media_type_pattern: "^[a-z0-9][a-z0-9!#$&^_.+-]{0,63}/[a-z0-9][a-z0-9!#$&^_.+-]{0,63}$",
|
|
152
|
+
filename_max_bytes: 512,
|
|
153
|
+
max_bytes: 9007199254740991,
|
|
154
|
+
deadline_ms: 6e5,
|
|
155
|
+
fetch_argv: [
|
|
156
|
+
"resource",
|
|
157
|
+
"fetch"
|
|
158
|
+
],
|
|
159
|
+
ref_flag: "--ref"
|
|
103
160
|
}
|
|
104
161
|
};
|
|
105
162
|
|
|
106
163
|
// packages/ceal-client-protocol/src/client-wire-contract.ts
|
|
107
164
|
var CEAL_CLIENT_WIRE_CONTRACT = Object.freeze(client_wire_contract_default);
|
|
165
|
+
var commandResolution = CEAL_CLIENT_WIRE_CONTRACT.command_resolution;
|
|
166
|
+
var commandResolutionAuthority = commandResolution.authority;
|
|
167
|
+
var commandResolutionSemanticOptions = commandResolution.semantic_options;
|
|
168
|
+
var CEAL_GATEWAY_COMMAND_RESOLUTION_SCHEMA_VERSION = commandResolution.schema_version;
|
|
108
169
|
var artifact = CEAL_CLIENT_WIRE_CONTRACT.artifact_descriptor;
|
|
109
170
|
var request = CEAL_CLIENT_WIRE_CONTRACT.command_request;
|
|
110
171
|
var response = CEAL_CLIENT_WIRE_CONTRACT.command_response;
|
|
@@ -125,6 +186,7 @@ var CEAL_COMMAND_REQUEST_MAX_BYTES = request.absolute_transport_max_bytes;
|
|
|
125
186
|
var CEAL_COMMAND_RESPONSE_BARE_DOCUMENT_MAX_BYTES = response.bare_document_max_bytes;
|
|
126
187
|
var CEAL_COMMAND_RESPONSE_PROMPT_FIELD = response.prompt_field;
|
|
127
188
|
var CEAL_COMMAND_RESPONSE_PROMPT_SCHEMA_VERSION = response.prompt_schema_version;
|
|
189
|
+
var CEAL_COMMAND_RESPONSE_BARE_DOCUMENT_OPTIONAL_FIELDS = Object.freeze([...response.bare_document_optional_fields]);
|
|
128
190
|
var CEAL_COMMAND_RESPONSE_PROMPT_DOCUMENT_FIELDS = Object.freeze([...response.bare_document_fields, response.prompt_field]);
|
|
129
191
|
var CEAL_COMMAND_RESPONSE_FOCUSED_PROMPT_DOCUMENT_FIELDS = Object.freeze([...response.focused_prompt_document_fields]);
|
|
130
192
|
var CEAL_COMMAND_RESPONSE_FOCUSED_PROMPT_CONTINUATION_DOCUMENT_FIELDS = Object.freeze([...response.focused_prompt_continuation_document_fields]);
|
|
@@ -137,10 +199,54 @@ var CEAL_COMMAND_RESPONSE_MAX_BYTES = response.absolute_transport_max_bytes;
|
|
|
137
199
|
function vocabulary(words) {
|
|
138
200
|
return Object.freeze(words);
|
|
139
201
|
}
|
|
202
|
+
function isVocabularyWord(words, value) {
|
|
203
|
+
return words.some((word) => word === value);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// packages/ceal-client-protocol/src/gateway-response-types.ts
|
|
207
|
+
var CEAL_OPERATION_READINESS_VALUES = vocabulary(["ready", "degraded", "unavailable", "unknown"]);
|
|
208
|
+
var CEAL_TARGET_REQUIREMENTS = vocabulary(["required", "optional", "none"]);
|
|
209
|
+
var CEAL_AUDIT_OUTCOMES = vocabulary(["succeeded", "denied", "failed"]);
|
|
210
|
+
var CEAL_GATEWAY_PROVIDER_STEP_OUTCOMES = vocabulary(["completed", "rejected", "throttled", "failed"]);
|
|
211
|
+
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"]);
|
|
212
|
+
var CEAL_GATEWAY_READ_REUSE_UNAVAILABLE_REASONS = vocabulary(["not_reported", "storage_unavailable", "coverage_incomplete", "freshness_refresh_required", "not_reusable", "bypassed"]);
|
|
213
|
+
var CEAL_POLICY_DECISIONS = vocabulary(["allowed", "denied", "not_evaluated"]);
|
|
214
|
+
var CEAL_CONNECTOR_ROUTE_PHASES = vocabulary(["scope_observation", "target_selection", "route_resolution"]);
|
|
215
|
+
var CEAL_CONNECTOR_ROUTE_CAUSES = vocabulary(["provider_throttled", "provider_unavailable", "binding_invalid", "scope_limit_exceeded"]);
|
|
216
|
+
var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "agent_lease_admission", "provider_authenticated_event"]);
|
|
217
|
+
var CEAL_REFRESH_DELIVERIES = vocabulary(["initial", "recovery", "replay", "terminal_failure", "recovery_unavailable"]);
|
|
218
|
+
var CEAL_CLIENT_OPERATIONS = vocabulary(["handshake", "discover", "call", "readback"]);
|
|
219
|
+
var CEAL_WRITE_IDEMPOTENCY_POSTURES = vocabulary(["required", "optional", "not_required"]);
|
|
220
|
+
var CEAL_WRITE_PROVIDER_READBACK_POSTURES = vocabulary(["required", "best_effort", "not_available"]);
|
|
221
|
+
var CEAL_WRITE_ATTRIBUTIONS = vocabulary(["subject", "requester_event", "connector_integration"]);
|
|
222
|
+
var CEAL_WRITE_RECEIPT_PROVIDER_STATES = vocabulary(["outcome_unknown", "verified", "not_dispatched"]);
|
|
223
|
+
var CEAL_WRITE_RECEIPT_PROVIDER_READBACKS = vocabulary(["outcome_unknown", "verified", "not_applied"]);
|
|
224
|
+
var CEAL_PROTOCOL_VERSION = "1.4.0";
|
|
225
|
+
var CEAL_GATEWAY_ANNOUNCEMENT_SCOPE_STATEMENTS = Object.freeze({
|
|
226
|
+
github_app_installation_repositories: "Repositories in the installed GitHub App installation.",
|
|
227
|
+
slack_public_app_member_channels_only: "Public channels where the installed Slack app is a member, plus direct and multi-person direct messages the requester is a member of, as Slack reports that membership; private channels the administrator has not approved are not declared by this connector.",
|
|
228
|
+
notion_connected_logical_area: "Connected Notion logical area under provider-enforced sharing; descendant inventory is not declared.",
|
|
229
|
+
google_workspace_calendar_read_only: "Approved Calendar availability and event reads only; Calendar mutation is not declared.",
|
|
230
|
+
google_workspace_admitted_drive_target_metadata: "Metadata search for files in the shared drives and directly shared files the Connector reaches and the Organization admits as Targets; file-content read and mutation are not declared.",
|
|
231
|
+
google_workspace_admitted_drive_target_sheet_ranges: "Bounded values reads from Google Sheets in the shared drives and directly shared files the Connector reaches and the Organization admits as Targets; file mutation is not declared.",
|
|
232
|
+
google_workspace_admitted_drive_target_sheet_tabs: "Bounded tab metadata and grid extents from Google Sheets in the shared drives and directly shared files the Connector reaches and the Organization admits as Targets; cell contents and file mutation are not declared.",
|
|
233
|
+
google_workspace_admitted_drive_target_editable_sheet_ranges: "Bounded values updates and clears in editable Google Sheets in the shared drives and directly shared files the Connector reaches and the Organization admits as Targets; Docs, Slides, and other Drive file mutation are not declared."
|
|
234
|
+
});
|
|
235
|
+
var CEAL_OPERATION_ACCESS_SCHEMA_VERSION = "ceal.operation_access.v1";
|
|
236
|
+
var CEAL_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["connector_kind", "phase", "schema_version"]);
|
|
237
|
+
var CEAL_CLASSIFIED_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["cause", ...CEAL_CONNECTOR_ROUTE_FAILURE_KEYS]);
|
|
238
|
+
var CEAL_UNCLASSIFIED_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["connector_kind", "error_class", "phase", "schema_version"]);
|
|
239
|
+
var CEAL_GATEWAY_ORGANIZATION_ROUTE_FACT_CALL_KEYS = Object.freeze([
|
|
240
|
+
"connector_ref",
|
|
241
|
+
"connector_revision",
|
|
242
|
+
"policy_decision_revision"
|
|
243
|
+
]);
|
|
140
244
|
|
|
141
245
|
// packages/ceal-client-protocol/src/operation-contract-types.ts
|
|
142
246
|
var CEAL_JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
143
247
|
var CEAL_OPERATION_ERROR_SCHEMA_VERSION = "ceal.operation_error.v1";
|
|
248
|
+
var CEAL_OPERATION_WITHHELD_CAUSES = vocabulary(["provider_permission", "access_level", "personal_authorization_required"]);
|
|
249
|
+
var CEAL_RETRY_AFTER_MAX_MS = 60 * 60 * 1e3;
|
|
144
250
|
var CEAL_JSON_SCHEMA_TYPES = vocabulary(["object", "array", "string", "integer", "number", "boolean", "null"]);
|
|
145
251
|
var OBSERVATION_POSTURES = vocabulary(["direct_readback", "approved_no_readback", "operator_mediated", "excluded"]);
|
|
146
252
|
var EFFECT_DOMAINS = vocabulary(["none", "gateway_state", "provider", "external_world"]);
|
|
@@ -176,27 +282,6 @@ var CEAL_OPERATION_APPROVAL_DISPOSITIONS = vocabulary([
|
|
|
176
282
|
"interactive_unavailable"
|
|
177
283
|
]);
|
|
178
284
|
|
|
179
|
-
// packages/ceal-client-protocol/src/gateway-response-types.ts
|
|
180
|
-
var CEAL_CAPABILITY_READINESS_VALUES = vocabulary(["ready", "degraded", "unavailable", "unknown"]);
|
|
181
|
-
var CEAL_TARGET_REQUIREMENTS = vocabulary(["required", "optional", "none"]);
|
|
182
|
-
var CEAL_AUDIT_OUTCOMES = vocabulary(["succeeded", "denied", "failed"]);
|
|
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"]);
|
|
186
|
-
var CEAL_POLICY_DECISIONS = vocabulary(["allowed", "denied", "not_evaluated"]);
|
|
187
|
-
var CEAL_CONNECTOR_ROUTE_PHASES = vocabulary(["scope_observation", "target_selection", "route_resolution"]);
|
|
188
|
-
var CEAL_CONNECTOR_ROUTE_CAUSES = vocabulary(["provider_throttled", "provider_unavailable", "binding_invalid", "scope_limit_exceeded"]);
|
|
189
|
-
var CEAL_WRITE_SOURCE_KINDS = vocabulary(["authenticated_registered_client", "agent_lease_admission", "provider_authenticated_event"]);
|
|
190
|
-
var CEAL_REFRESH_DELIVERIES = vocabulary(["initial", "recovery", "replay", "terminal_failure", "recovery_unavailable"]);
|
|
191
|
-
var CEAL_CLIENT_OPERATIONS = vocabulary(["handshake", "discover", "call", "readback"]);
|
|
192
|
-
var CEAL_WRITE_IDEMPOTENCY_POSTURES = vocabulary(["required", "optional", "not_required"]);
|
|
193
|
-
var CEAL_WRITE_PROVIDER_READBACK_POSTURES = vocabulary(["required", "best_effort", "not_available"]);
|
|
194
|
-
var CEAL_WRITE_ATTRIBUTIONS = vocabulary(["subject", "requester_event", "connector_integration"]);
|
|
195
|
-
var CEAL_PROTOCOL_VERSION = "1.4.0";
|
|
196
|
-
var CEAL_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["connector_kind", "phase", "schema_version"]);
|
|
197
|
-
var CEAL_CLASSIFIED_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["cause", ...CEAL_CONNECTOR_ROUTE_FAILURE_KEYS]);
|
|
198
|
-
var CEAL_UNCLASSIFIED_CONNECTOR_ROUTE_FAILURE_KEYS = vocabulary(["connector_kind", "error_class", "phase", "schema_version"]);
|
|
199
|
-
|
|
200
285
|
// packages/ceal-client-protocol/src/gateway-validation-primitives.ts
|
|
201
286
|
var CealProtocolValidationError = class extends Error {
|
|
202
287
|
name = "CealProtocolValidationError";
|
|
@@ -213,6 +298,7 @@ var SAFE_CONNECTOR_KIND = new RegExp(`^[a-z][a-z0-9-]{0,${MAX_SAFE_TOKEN_LENGTH
|
|
|
213
298
|
var FORBIDDEN_SECRET_KEY = /^(?:[a-z0-9_]*(?:token|secret|password|credential(?:s)?|private_?key)|api_?key|authorization|bearer|raw_?provider_?payload|provider_?payload)$/iu;
|
|
214
299
|
var FORBIDDEN_AUTHORITY_KEY = /^(?:actor_?ref|owner_?ref|registration_?ref|runner_?ref|auth_?decision|policy_?decision|host_?decision)$/iu;
|
|
215
300
|
var TEXT_ENCODER = new TextEncoder();
|
|
301
|
+
var CEAL_WIRE_SAFE_ARRAY_MAX_ITEMS = 128;
|
|
216
302
|
var CEAL_WIRE_SAFE_TEXT_MAX_BYTES = 8 * 1024;
|
|
217
303
|
function assertSafeJsonValue(value, options, depth = 0, count = { value: 0 }) {
|
|
218
304
|
count.value += 1;
|
|
@@ -232,12 +318,12 @@ function assertSafeJsonString(value, options) {
|
|
|
232
318
|
if (byteLength(value) > CEAL_WIRE_SAFE_TEXT_MAX_BYTES || firstDisallowedControl(value, "multi_line") !== null) invalidByContext(options);
|
|
233
319
|
}
|
|
234
320
|
function assertSafeJsonArray(value, options, depth, count) {
|
|
235
|
-
if (value.length >
|
|
321
|
+
if (value.length > CEAL_WIRE_SAFE_ARRAY_MAX_ITEMS) invalidByContext(options);
|
|
236
322
|
for (const item of value) assertSafeJsonValue(item, options, depth + 1, count);
|
|
237
323
|
}
|
|
238
324
|
function assertSafeJsonRecord(record6, options, depth, count) {
|
|
239
325
|
const entries = Object.entries(record6);
|
|
240
|
-
if (entries.length >
|
|
326
|
+
if (entries.length > CEAL_WIRE_SAFE_ARRAY_MAX_ITEMS) invalidByContext(options);
|
|
241
327
|
const sourceUrlColumn = options.allowHttpsUrl ? compactSourceUrlColumn(record6.fields) : null;
|
|
242
328
|
for (const [key, child] of entries) {
|
|
243
329
|
if (key === "credential_material_included" && child !== false) invalidByContext(options);
|
|
@@ -263,9 +349,9 @@ function compactSourceUrlColumn(fields) {
|
|
|
263
349
|
return index < 0 ? null : index;
|
|
264
350
|
}
|
|
265
351
|
function assertSafeJsonCompactRows(value, sourceUrlColumn, options, depth, count) {
|
|
266
|
-
if (!Array.isArray(value) || value.length >
|
|
352
|
+
if (!Array.isArray(value) || value.length > CEAL_WIRE_SAFE_ARRAY_MAX_ITEMS) invalidByContext(options);
|
|
267
353
|
for (const row of value) {
|
|
268
|
-
if (!Array.isArray(row) || row.length >
|
|
354
|
+
if (!Array.isArray(row) || row.length > CEAL_WIRE_SAFE_ARRAY_MAX_ITEMS) invalidByContext(options);
|
|
269
355
|
for (const [index, cell] of row.entries()) {
|
|
270
356
|
if (index === sourceUrlColumn && (cell === null || isSafeExternalHttpsUrl(cell))) continue;
|
|
271
357
|
assertSafeJsonValue(cell, options, depth + 2, count);
|
|
@@ -298,6 +384,7 @@ function isSafeResultContent(value, key) {
|
|
|
298
384
|
const maximum = key === "text" ? 8192 : 1024;
|
|
299
385
|
return typeof value === "string" && byteLength(value) <= maximum && firstDisallowedControl(value, "multi_line") === null;
|
|
300
386
|
}
|
|
387
|
+
var CEAL_PUBLIC_DISPLAY_NAME_MAX_BYTES = 512;
|
|
301
388
|
function normalizeCealSingleLineText(value) {
|
|
302
389
|
return value.split("").map((character) => hasControlCharacter(character) ? " " : character).join("").trim();
|
|
303
390
|
}
|
|
@@ -406,6 +493,28 @@ function cut(text) {
|
|
|
406
493
|
return text.length <= REFUSAL_VALUE_MAX_CHARS ? text : `${text.slice(0, REFUSAL_VALUE_MAX_CHARS)}...(+${text.length - REFUSAL_VALUE_MAX_CHARS} chars)`;
|
|
407
494
|
}
|
|
408
495
|
|
|
496
|
+
// packages/ceal-client-protocol/src/operation-access-class.ts
|
|
497
|
+
var CEAL_OPERATION_ACCESS_CLASSES = vocabulary(["read", "write"]);
|
|
498
|
+
|
|
499
|
+
// packages/ceal-client-protocol/src/domain-vocabulary.ts
|
|
500
|
+
var CEAL_INTEGRATION_KINDS = vocabulary(["github", "google-workspace", "notion", "slack"]);
|
|
501
|
+
var CEAL_CONNECTOR_STATUSES = vocabulary(["active", "disabled", "disconnected"]);
|
|
502
|
+
var CEAL_CONNECTOR_CUSTODIES = vocabulary(["organization", "personal"]);
|
|
503
|
+
var CEAL_PROVIDER_BOUNDARY_KINDS = vocabulary([
|
|
504
|
+
"github_account",
|
|
505
|
+
"github_organization",
|
|
506
|
+
"google_workspace_domain",
|
|
507
|
+
"notion_workspace",
|
|
508
|
+
"slack_workspace"
|
|
509
|
+
]);
|
|
510
|
+
var CEAL_PROVIDER_BOUNDARY_EVIDENCE = vocabulary(["provider_readback", "operator_stated"]);
|
|
511
|
+
var CEAL_ACCESS_LEVELS = vocabulary(["none", "read", "read_write"]);
|
|
512
|
+
var CEAL_PERSONAL_ACCESS_CEILINGS = vocabulary(["disabled", "read", "read_write"]);
|
|
513
|
+
var CEAL_TARGET_VISIBILITIES = vocabulary(["public", "private"]);
|
|
514
|
+
var CEAL_PRINCIPAL_KINDS = vocabulary(["human", "service", "runtime"]);
|
|
515
|
+
var CEAL_ORGANIZATION_ROLES = vocabulary(["member", "admin"]);
|
|
516
|
+
var LABEL_EXPECTATION = `public-safe display text of at most ${CEAL_PUBLIC_DISPLAY_NAME_MAX_BYTES} bytes`;
|
|
517
|
+
|
|
409
518
|
// packages/ceal-client-protocol/src/safe-json-budget.ts
|
|
410
519
|
var SAFE_JSON_MIN_BYTES_PER_NODE = 4;
|
|
411
520
|
function safeJsonNodeBudgetForBytes(maxBytes) {
|
|
@@ -435,7 +544,9 @@ var CEAL_OPERATION_JSON_SCHEMA_BUDGET = Object.freeze({
|
|
|
435
544
|
});
|
|
436
545
|
|
|
437
546
|
// packages/ceal-client-protocol/src/operation-validation-primitives.ts
|
|
438
|
-
var ISO_TIMESTAMP =
|
|
547
|
+
var ISO_TIMESTAMP = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?([Zz]|([+-])(\d{2}):(\d{2}))$/u;
|
|
548
|
+
var CEAL_CALENDAR_DATE_PATTERN_SOURCE = "^\\d{4}-\\d{2}-\\d{2}$";
|
|
549
|
+
var CEAL_CALENDAR_DATE = new RegExp(CEAL_CALENDAR_DATE_PATTERN_SOURCE, "u");
|
|
439
550
|
function isOperationRecord(value) {
|
|
440
551
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
441
552
|
const prototype = Object.getPrototypeOf(value);
|
|
@@ -447,8 +558,56 @@ function requireOperationRecord(value, message) {
|
|
|
447
558
|
function requireClosedValue(value, members, message) {
|
|
448
559
|
if (typeof value !== "string" || !members.includes(value)) throw new TypeError(message);
|
|
449
560
|
}
|
|
561
|
+
function isCealIsoTimestamp(value) {
|
|
562
|
+
return typeof value === "string" && parseCealIsoTimestamp(value) !== null;
|
|
563
|
+
}
|
|
564
|
+
function parseCealIsoTimestamp(value) {
|
|
565
|
+
const fields = parseCealIsoTimestampFields(value);
|
|
566
|
+
if (fields === null || !validCalendarDate(fields) || !validClockTime(fields) || !validUtcOffset(fields)) return null;
|
|
567
|
+
const epochMilliseconds = cealFieldsEpochMilliseconds(fields);
|
|
568
|
+
if (!Number.isFinite(epochMilliseconds)) return null;
|
|
569
|
+
return {
|
|
570
|
+
epochNanoseconds: BigInt(epochMilliseconds) * 1000000n + BigInt(fields.fraction.padEnd(9, "0") || "0")
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
function parseCealIsoTimestampFields(value) {
|
|
574
|
+
const match = ISO_TIMESTAMP.exec(value);
|
|
575
|
+
if (match === null) return null;
|
|
576
|
+
return {
|
|
577
|
+
year: Number(match[1]),
|
|
578
|
+
month: Number(match[2]),
|
|
579
|
+
day: Number(match[3]),
|
|
580
|
+
hour: Number(match[4]),
|
|
581
|
+
minute: Number(match[5]),
|
|
582
|
+
second: Number(match[6]),
|
|
583
|
+
fraction: match[7] ?? "",
|
|
584
|
+
offsetSign: match[9] === void 0 ? 0 : match[9] === "+" ? 1 : -1,
|
|
585
|
+
offsetHour: Number(match[10] ?? 0),
|
|
586
|
+
offsetMinute: Number(match[11] ?? 0)
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function validCalendarDate({ year, month, day }) {
|
|
590
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth(year, month);
|
|
591
|
+
}
|
|
592
|
+
function validClockTime({ hour, minute, second }) {
|
|
593
|
+
return hour <= 23 && minute <= 59 && second <= 59;
|
|
594
|
+
}
|
|
595
|
+
function validUtcOffset({ offsetHour, offsetMinute }) {
|
|
596
|
+
return offsetHour <= 23 && offsetMinute <= 59;
|
|
597
|
+
}
|
|
598
|
+
function cealFieldsEpochMilliseconds(fields) {
|
|
599
|
+
const shiftedYear = fields.year < 100 ? fields.year + 400 : fields.year;
|
|
600
|
+
const cycleMilliseconds = fields.year < 100 ? (400 * 365 + 97) * 24 * 60 * 60 * 1e3 : 0;
|
|
601
|
+
const localMilliseconds = Date.UTC(shiftedYear, fields.month - 1, fields.day, fields.hour, fields.minute, fields.second, 0) - cycleMilliseconds;
|
|
602
|
+
const offsetMilliseconds = fields.offsetSign * (fields.offsetHour * 60 + fields.offsetMinute) * 6e4;
|
|
603
|
+
return localMilliseconds - offsetMilliseconds;
|
|
604
|
+
}
|
|
605
|
+
function daysInMonth(year, month) {
|
|
606
|
+
const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
607
|
+
return [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1] ?? 0;
|
|
608
|
+
}
|
|
450
609
|
function requireIsoTimestamp(value, message) {
|
|
451
|
-
if (
|
|
610
|
+
if (!isCealIsoTimestamp(value)) throw new TypeError(message);
|
|
452
611
|
}
|
|
453
612
|
|
|
454
613
|
// packages/ceal-client-protocol/src/operation-json-schema.ts
|
|
@@ -470,7 +629,7 @@ var CLIENT_AUDIENCE_SET = new Set(CLIENT_AUDIENCES);
|
|
|
470
629
|
// packages/ceal-client-protocol/src/schema-literals.ts
|
|
471
630
|
var CEAL_SCHEMA_LITERALS = [
|
|
472
631
|
"ceal.activation_transport.v1",
|
|
473
|
-
|
|
632
|
+
CEAL_OPERATION_ACCESS_SCHEMA_VERSION,
|
|
474
633
|
CEAL_OPERATION_CATALOG_SCHEMA_VERSION,
|
|
475
634
|
"ceal.client_refresh_request.v2",
|
|
476
635
|
"ceal.client_refresh_result.v2",
|
|
@@ -493,7 +652,6 @@ var CEAL_SCHEMA_LITERALS = [
|
|
|
493
652
|
"ceal.enrollment_exchange.v1",
|
|
494
653
|
"ceal.enrollment_result.v1",
|
|
495
654
|
"ceal.first_activation_causal_join.v1",
|
|
496
|
-
"ceal.gateway_aggregate_authorization_snapshot.v2",
|
|
497
655
|
"ceal.gateway_announcement_policy.v1",
|
|
498
656
|
"ceal.gateway_audit_call_detail.v1",
|
|
499
657
|
"ceal.gateway_audit_event.v1",
|
|
@@ -501,7 +659,7 @@ var CEAL_SCHEMA_LITERALS = [
|
|
|
501
659
|
"ceal.gateway_authorization_snapshot.v1",
|
|
502
660
|
"ceal.gateway_cache_origin.v1",
|
|
503
661
|
"ceal.gateway_call_result.v1",
|
|
504
|
-
|
|
662
|
+
CEAL_GATEWAY_COMMAND_RESOLUTION_SCHEMA_VERSION,
|
|
505
663
|
"ceal.gateway_connector_route_failure.v1",
|
|
506
664
|
"ceal.gateway_discovery.v3",
|
|
507
665
|
"ceal.gateway_handshake.v1",
|
|
@@ -536,7 +694,7 @@ var CEAL_SCHEMA_LITERALS = [
|
|
|
536
694
|
"ceal.operation_receipt.v1",
|
|
537
695
|
"ceal.operation_result.v1",
|
|
538
696
|
"ceal.operation_result.compact.v1",
|
|
539
|
-
"ceal.local_result_materialization.
|
|
697
|
+
"ceal.local_result_materialization.v2",
|
|
540
698
|
"ceal.local_result_root.v1",
|
|
541
699
|
"ceal.owner_bootstrap_exchange_request.v1",
|
|
542
700
|
"ceal.owner_bootstrap_exchange_result.v1",
|
|
@@ -546,7 +704,8 @@ var CEAL_SCHEMA_LITERALS = [
|
|
|
546
704
|
"ceal.request_cancellation.v1",
|
|
547
705
|
"ceal.request_graph_revision.v1",
|
|
548
706
|
"ceal.request_occurrence_correlation.v1",
|
|
549
|
-
"ceal.request_projection.v1"
|
|
707
|
+
"ceal.request_projection.v1",
|
|
708
|
+
"ceal.write_safety_finding.v1"
|
|
550
709
|
];
|
|
551
710
|
var CEAL_SCHEMA_LITERAL_SET = new Set(CEAL_SCHEMA_LITERALS);
|
|
552
711
|
|
|
@@ -561,21 +720,14 @@ var CEAL_BOUNDED_SERIES_CATALOG = Object.freeze({
|
|
|
561
720
|
thread_run_events: (root) => join(root, "run-events.jsonl"),
|
|
562
721
|
bounded_store_sidecar: (root) => `${root}.jsonl`,
|
|
563
722
|
gateway_audit_archive: (root) => `${root}.jsonl`,
|
|
564
|
-
gateway_capability_audit: (root) => join(root, "capability-audit.jsonl"),
|
|
565
|
-
gateway_retrieval_waste_partition: (root) => `${root}.jsonl`,
|
|
566
|
-
gateway_access_policy_publication: (root) => join(root, "access-policy-publications.jsonl"),
|
|
567
723
|
gateway_access_group_connector_control_audit: (root) => `${root}.audit.jsonl`,
|
|
568
724
|
gateway_access_group_connector_scope_audit: (root) => join(root, "profile-connector-scope-audit.jsonl"),
|
|
569
725
|
gateway_access_group_connector_activity_scope_audit: (root) => join(root, "profile-connector-activity-scope-audit.jsonl"),
|
|
726
|
+
gateway_access_group_connector_calendar_scope_audit: (root) => join(root, "profile-connector-calendar-scope-audit.jsonl"),
|
|
570
727
|
gateway_access_group_connector_readiness_audit: (root) => join(root, "profile-connector-readiness.audit.jsonl"),
|
|
571
728
|
gateway_organization_audit_ledger: (root) => join(root, "organization-ledger.jsonl"),
|
|
572
729
|
gateway_personal_client_audit: (root) => join(root, "audit.jsonl"),
|
|
573
|
-
gateway_personal_client_access_audit: (root) => join(root, "access-audit.jsonl")
|
|
574
|
-
gateway_admin_enrollment: (root) => join(root, "enrollments.jsonl"),
|
|
575
|
-
gateway_admin_login: (root) => join(root, "logins.jsonl"),
|
|
576
|
-
gateway_admin_family: (root) => join(root, "families.jsonl"),
|
|
577
|
-
gateway_admin_refresh_token: (root) => join(root, "refresh-tokens.jsonl"),
|
|
578
|
-
gateway_admin_access_token: (root) => join(root, "access-tokens.jsonl")
|
|
730
|
+
gateway_personal_client_access_audit: (root) => join(root, "access-audit.jsonl")
|
|
579
731
|
});
|
|
580
732
|
|
|
581
733
|
// packages/ceal-client-protocol/src/gateway-installation-activation.ts
|
|
@@ -583,8 +735,20 @@ var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_DATA_CHARACTERS = 32;
|
|
|
583
735
|
var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_CHECK_CHARACTERS = 8;
|
|
584
736
|
var CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_COMPACT_CHARACTERS = CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_DATA_CHARACTERS + CEAL_GATEWAY_INSTALLATION_ACTIVATION_CODE_CHECK_CHARACTERS;
|
|
585
737
|
|
|
738
|
+
// packages/ceal-client-protocol/src/gateway-entrypoint-commands.ts
|
|
739
|
+
var GATEWAY_ENTRYPOINT_COMMANDS = Object.freeze([
|
|
740
|
+
Object.freeze({ id: "controlPlane", path: Object.freeze(["control-plane"]) }),
|
|
741
|
+
Object.freeze({ id: "originShow", path: Object.freeze(["origin", "show"]) }),
|
|
742
|
+
Object.freeze({ id: "credentialsImport", path: Object.freeze(["credentials", "import"]) }),
|
|
743
|
+
Object.freeze({ id: "initialize", path: Object.freeze(["init"]) })
|
|
744
|
+
]);
|
|
745
|
+
|
|
586
746
|
// packages/ceal-client-protocol/src/host-registration.ts
|
|
587
747
|
var CEAL_HOST_REGISTRATION_RESULT_KEYS = Object.freeze(["credential_generation", "host_access_token", "host_installation_ref", "host_source_ref", "ok", "registration_attempt_ref", "schema_version", "status"]);
|
|
748
|
+
var CEAL_LOWERCASE_UUID_PATTERN = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
749
|
+
var CEAL_HOST_REGISTRATION_ATTEMPT_REF_PATTERN = new RegExp(`^host-registration-attempt:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
|
|
750
|
+
var CEAL_HOST_INSTALLATION_REF_PATTERN = new RegExp(`^host-installation:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
|
|
751
|
+
var CEAL_HOST_SOURCE_REF_PATTERN = new RegExp(`^host-source:${CEAL_LOWERCASE_UUID_PATTERN}$`, "u");
|
|
588
752
|
|
|
589
753
|
// packages/ceal-client-protocol/src/agent-session-handoff.ts
|
|
590
754
|
var CEAL_AGENT_ADMISSION_PHASES = vocabulary([
|
|
@@ -616,12 +780,19 @@ var CEAL_AGENT_SERVICE_SESSION_RECORD_KEYS = vocabulary([
|
|
|
616
780
|
var CEAL_AGENT_SESSION_COMMIT_KEYS = vocabulary(["attempt_ref", "expected_session_revision", "session_revision"]);
|
|
617
781
|
|
|
618
782
|
// packages/ceal-client-protocol/src/operation-next-actions.ts
|
|
783
|
+
var CEAL_REPEAT_REQUEST_NEXT_ACTION = "repeat_request";
|
|
784
|
+
var CEAL_INSPECT_RECEIPT_NEXT_ACTION = "inspect_receipt";
|
|
619
785
|
var CALLER_RECOVERABLE_NEXT_ACTION_VALUES = [
|
|
620
786
|
"select_did_you_mean",
|
|
621
787
|
"choose_new_output_path",
|
|
622
788
|
"choose_new_idempotency_key",
|
|
623
789
|
"restart_search",
|
|
624
790
|
"repeat_original_arguments",
|
|
791
|
+
// The occurrence this call addressed is settled and cannot move again -- a
|
|
792
|
+
// denied effect approval, an expired continuation -- so the caller runs the
|
|
793
|
+
// same call again as a new request. The refusal names the re-request; this
|
|
794
|
+
// word is the re-request.
|
|
795
|
+
CEAL_REPEAT_REQUEST_NEXT_ACTION,
|
|
625
796
|
"choose_new_request_identity",
|
|
626
797
|
// A refusal that names the argument (invalid_argument with `property`) tells the caller exactly what to change.
|
|
627
798
|
"correct_argument",
|
|
@@ -640,10 +811,35 @@ var CALLER_RECOVERABLE_NEXT_ACTION_VALUES = [
|
|
|
640
811
|
"use_original_input",
|
|
641
812
|
// The same mismatch on the Request binding rather than the input: the
|
|
642
813
|
// occurrence was admitted under one binding and the replay presents another.
|
|
643
|
-
"use_original_request_binding"
|
|
814
|
+
"use_original_request_binding",
|
|
815
|
+
// The client's own filesystem write was refused -- EACCES, EPERM, or a
|
|
816
|
+
// read-only mount -- which is how an agent sandbox fences writes outside its
|
|
817
|
+
// workspace. The caller reruns the same command with unsandboxed or escalated
|
|
818
|
+
// execution; re-adopting the session cannot help, because the sandbox refuses
|
|
819
|
+
// that write too.
|
|
820
|
+
"rerun_outside_agent_sandbox",
|
|
821
|
+
// The refusal names the one Operation to read next in `describe_command`:
|
|
822
|
+
// an absent Operation id with a sole catalog-ranked candidate, or a known
|
|
823
|
+
// Operation invoked without its input. Describing only reads the verified
|
|
824
|
+
// contract and dispatches nothing, and the caller then retries with the
|
|
825
|
+
// named Operation or input, so it is guidance the scorer counts.
|
|
826
|
+
"describe_operation",
|
|
827
|
+
// The refusal names the caller's own personal connect Operation in
|
|
828
|
+
// `required_action_sequence`: the Operation asked for, or the credential
|
|
829
|
+
// the call ran on, needs a personal connection the caller does not hold
|
|
830
|
+
// (never connected, revoked, or expired). The caller runs that exact
|
|
831
|
+
// Operation, completes the consent it hands back, and retries the same call.
|
|
832
|
+
"connect_personal_account",
|
|
833
|
+
// The provider or Gateway named a bounded wait; the caller waits that long
|
|
834
|
+
// and submits the same read again.
|
|
835
|
+
"retry_after"
|
|
644
836
|
];
|
|
645
837
|
var CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS = Object.freeze(CALLER_RECOVERABLE_NEXT_ACTION_VALUES);
|
|
646
838
|
var NON_REMEDY_NEXT_ACTION_VALUES = [
|
|
839
|
+
// Only an administrator can take the named step -- approving a place for an
|
|
840
|
+
// Operation, granting a withheld capability -- so a non-administrator asks
|
|
841
|
+
// one. The refusal names the administrator step; this word is the ask.
|
|
842
|
+
"ask_admin",
|
|
647
843
|
"await_pending_approval",
|
|
648
844
|
"check_gateway",
|
|
649
845
|
"inspect_context_store",
|
|
@@ -658,9 +854,13 @@ var NON_REMEDY_NEXT_ACTION_VALUES = [
|
|
|
658
854
|
"inspect_local_command",
|
|
659
855
|
"inspect_local_output",
|
|
660
856
|
"inspect_local_route",
|
|
661
|
-
|
|
857
|
+
CEAL_INSPECT_RECEIPT_NEXT_ACTION,
|
|
662
858
|
"inspect_request",
|
|
663
859
|
"none",
|
|
860
|
+
// The provider refused because of its own configuration -- an API not
|
|
861
|
+
// enabled, an app scope missing -- which an operator changes in that
|
|
862
|
+
// provider's console. No caller edit and no retry fixes it.
|
|
863
|
+
"operator_action",
|
|
664
864
|
"recover",
|
|
665
865
|
"reconcile",
|
|
666
866
|
// Reconciliation of one named occurrence, not of the deployment: a legacy
|
|
@@ -668,6 +868,10 @@ var NON_REMEDY_NEXT_ACTION_VALUES = [
|
|
|
668
868
|
// no edit to the call changes that. `reconcile` is the deployment-wide word.
|
|
669
869
|
"reconcile_occurrence",
|
|
670
870
|
"reduce_request_size",
|
|
871
|
+
// The Host's invocation context for this turn is stale or expired at the
|
|
872
|
+
// Gateway. The Host's next turn rebinds it and the same call then succeeds;
|
|
873
|
+
// nothing in the call changes, so it is not a remedy the scorer may count.
|
|
874
|
+
"refresh_host_invocation_context",
|
|
671
875
|
"repair_or_adopt_session",
|
|
672
876
|
"retry",
|
|
673
877
|
// The owner -- a correlation hook, an approval hook -- is not serving right
|
|
@@ -681,10 +885,23 @@ var NON_REMEDY_NEXT_ACTION_VALUES = [
|
|
|
681
885
|
var CEAL_NON_REMEDY_NEXT_ACTIONS = Object.freeze(NON_REMEDY_NEXT_ACTION_VALUES);
|
|
682
886
|
var DECLARED = /* @__PURE__ */ new Set([...CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS, ...CEAL_NON_REMEDY_NEXT_ACTIONS]);
|
|
683
887
|
var RECOVERABLE = new Set(CEAL_CALLER_RECOVERABLE_NEXT_ACTIONS);
|
|
888
|
+
var CEAL_OPERATION_WITHHELD_NEXT_ACTIONS = Object.freeze({
|
|
889
|
+
provider_permission: "ask_admin",
|
|
890
|
+
access_level: "ask_admin",
|
|
891
|
+
personal_authorization_required: "connect_personal_account"
|
|
892
|
+
});
|
|
684
893
|
|
|
685
894
|
// packages/ceal-client-protocol/src/operation-contract-artifact.ts
|
|
686
895
|
var CATALOG_REVISION = new RegExp(CEAL_VERIFIED_ARTIFACT_CATALOG_REVISION_PATTERN, "u");
|
|
687
896
|
var SHA256 = new RegExp(CEAL_VERIFIED_ARTIFACT_DIGEST_PATTERN, "u");
|
|
897
|
+
var CEAL_OPERATION_INVOKE_COMMAND = "invoke";
|
|
898
|
+
var CEAL_OPERATION_INPUT_FLAG = "--input";
|
|
899
|
+
var CEAL_OPERATION_ID_PLACEHOLDER = "<operation-id>";
|
|
900
|
+
var CEAL_OPERATION_INPUT_PLACEHOLDER = "<json-object>";
|
|
901
|
+
var CEAL_MODEL_INVOCATION_ARGUMENTS = [CEAL_OPERATION_INVOKE_COMMAND, CEAL_OPERATION_ID_PLACEHOLDER, CEAL_OPERATION_INPUT_FLAG, shellSingleQuoted(CEAL_OPERATION_INPUT_PLACEHOLDER)].join(" ");
|
|
902
|
+
function shellSingleQuoted(value) {
|
|
903
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
904
|
+
}
|
|
688
905
|
var CEAL_OPERATION_CONTRACT_REQUIRED_FIELDS = Object.freeze(["input_schema", "result_schema"]);
|
|
689
906
|
var CEAL_OPERATION_CONTRACT_OPTIONAL_FIELDS = Object.freeze(["summary", "input_resolution"]);
|
|
690
907
|
var CEAL_VERIFIED_ARTIFACT_DESCRIPTOR_JSON_SCHEMA = Object.freeze({
|
|
@@ -713,9 +930,178 @@ var CEAL_VERIFIED_ARTIFACT_DESCRIPTOR_JSON_SCHEMA = Object.freeze({
|
|
|
713
930
|
}
|
|
714
931
|
});
|
|
715
932
|
|
|
933
|
+
// packages/ceal-client-protocol/src/bare-document.ts
|
|
934
|
+
var REQUIRED_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_fields;
|
|
935
|
+
var OPTIONAL_FIELDS = CEAL_CLIENT_WIRE_CONTRACT.command_response.bare_document_optional_fields;
|
|
936
|
+
|
|
937
|
+
// packages/ceal-client-protocol/src/leased-consumer-vocabulary.ts
|
|
938
|
+
var CEAL_TERMINAL_DISPOSITIONS = vocabulary(["completed", "failed", "cancelled"]);
|
|
939
|
+
var CEAL_LEASE_DISPOSITIONS = vocabulary([...CEAL_TERMINAL_DISPOSITIONS, "deferred"]);
|
|
940
|
+
var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["initial"]);
|
|
941
|
+
var CEAL_LEASED_MESSAGE_DELIVERY_OPERATION_IDS = vocabulary(["message.send", "message.update", "message.delete"]);
|
|
942
|
+
var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
|
|
943
|
+
var CEAL_RESULT_DELIVERY_OFFERS = vocabulary(["pending", "offered", "transport_lost"]);
|
|
944
|
+
var CEAL_RESULT_DELIVERY_STATES = vocabulary(["unavailable", ...CEAL_RESULT_DELIVERY_OFFERS]);
|
|
945
|
+
var CEAL_PROVIDER_OUTCOMES = vocabulary(["not_attempted", "outcome_unknown", "verified"]);
|
|
946
|
+
var CEAL_ACTIVITY_GAP_CODES = vocabulary([
|
|
947
|
+
"provider_page_budget",
|
|
948
|
+
"call_deadline",
|
|
949
|
+
"related_item_budget",
|
|
950
|
+
"provider_cursor_unavailable",
|
|
951
|
+
"malformed_provider_page",
|
|
952
|
+
"visibility_incomplete",
|
|
953
|
+
"unsupported_event_kind"
|
|
954
|
+
]);
|
|
955
|
+
var CEAL_ACTIVITY_CONNECTOR_KINDS = vocabulary(["slack", "github", "google-calendar", "google-drive", "notion"]);
|
|
956
|
+
var CEAL_ACTIVITY_COVERAGE_STATUSES = vocabulary(["complete_for_target", "continuation_required", "blocked"]);
|
|
957
|
+
var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
|
|
958
|
+
"slack.message",
|
|
959
|
+
"slack.reply",
|
|
960
|
+
"slack.direct_message",
|
|
961
|
+
"github.commit.authored",
|
|
962
|
+
"github.issue.opened",
|
|
963
|
+
"github.pull_request.opened",
|
|
964
|
+
"github.review.submitted",
|
|
965
|
+
"github.issue_comment.created",
|
|
966
|
+
"github.review_comment.created",
|
|
967
|
+
"calendar.organized",
|
|
968
|
+
"calendar.accepted_invite",
|
|
969
|
+
"calendar.recorded",
|
|
970
|
+
"drive.file.created",
|
|
971
|
+
"drive.file.modified",
|
|
972
|
+
"drive.file.viewed",
|
|
973
|
+
"notion.page.created",
|
|
974
|
+
"notion.page.edited"
|
|
975
|
+
]);
|
|
976
|
+
var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
|
|
977
|
+
"message_created",
|
|
978
|
+
"commit_authored",
|
|
979
|
+
"resource_created",
|
|
980
|
+
"review_submitted",
|
|
981
|
+
"comment_created",
|
|
982
|
+
"event_start",
|
|
983
|
+
"all_day_start",
|
|
984
|
+
"file_created",
|
|
985
|
+
"file_modified",
|
|
986
|
+
"file_modified_by_me",
|
|
987
|
+
"file_viewed_by_me",
|
|
988
|
+
"page_created",
|
|
989
|
+
"page_last_edited",
|
|
990
|
+
"resource_modified"
|
|
991
|
+
]);
|
|
992
|
+
var CEAL_ACTIVITY_V3_KINDS = vocabulary(["authored", "edited", "messaged", "responded"]);
|
|
993
|
+
var CEAL_RESOURCE_TIME_BASES = vocabulary(["created", "modified", "viewed"]);
|
|
994
|
+
var CEAL_RESOURCE_SEARCH_ORDERS = vocabulary(["relevance", "modified", "viewed", "created"]);
|
|
995
|
+
var CEAL_RESOURCE_SEARCH_DIRECTIONS = vocabulary(["ascending", "descending"]);
|
|
996
|
+
var CEAL_RESOURCE_SEARCH_FILTERS = vocabulary(["query", "modified_since", "kinds", "container_ref", "addressed_to_me", "unread"]);
|
|
997
|
+
var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
|
|
998
|
+
var CEAL_READ_ITEM_KINDS = vocabulary(["conversation", "identity", "usergroup", "message", "file", "document"]);
|
|
999
|
+
var CEAL_LEASED_MESSAGE_SEARCH_COMPLETENESS = vocabulary(["complete", "continuation_available", "truncated"]);
|
|
1000
|
+
var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "object"]);
|
|
1001
|
+
var CEAL_WRITE_OBJECT_KINDS = vocabulary(["document", "comment", "cell_range"]);
|
|
1002
|
+
var CEAL_CONVERSATION_KINDS = vocabulary(["channel", "dm", "group"]);
|
|
1003
|
+
var CEAL_FILE_TYPE_FAMILIES = vocabulary(["all", "image", "pdf"]);
|
|
1004
|
+
var CEAL_GITHUB_ISSUE_STATES = vocabulary(["open", "closed", "all"]);
|
|
1005
|
+
var CEAL_NOTION_UPDATABLE_BLOCK_TYPES = vocabulary([
|
|
1006
|
+
"paragraph",
|
|
1007
|
+
"heading_1",
|
|
1008
|
+
"heading_2",
|
|
1009
|
+
"heading_3",
|
|
1010
|
+
"bulleted_list_item",
|
|
1011
|
+
"numbered_list_item",
|
|
1012
|
+
"to_do",
|
|
1013
|
+
"code"
|
|
1014
|
+
]);
|
|
1015
|
+
var CEAL_NOTION_NEUTRAL_TYPES = vocabulary([
|
|
1016
|
+
"text",
|
|
1017
|
+
"number",
|
|
1018
|
+
"boolean",
|
|
1019
|
+
"date",
|
|
1020
|
+
"select",
|
|
1021
|
+
"multi_select",
|
|
1022
|
+
"people",
|
|
1023
|
+
"url",
|
|
1024
|
+
"email",
|
|
1025
|
+
"phone",
|
|
1026
|
+
"unsupported"
|
|
1027
|
+
]);
|
|
1028
|
+
var CEAL_NOTION_IDENTITY_GAP_REASONS = vocabulary([
|
|
1029
|
+
"identity_unavailable",
|
|
1030
|
+
"identity_stale",
|
|
1031
|
+
"identity_ambiguous",
|
|
1032
|
+
"identity_revoked",
|
|
1033
|
+
"identity_unlinked"
|
|
1034
|
+
]);
|
|
1035
|
+
var CEAL_NOTION_STRING_VALUE_TYPES = vocabulary(["text", "select", "url", "email", "phone"]);
|
|
1036
|
+
var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
|
|
1037
|
+
var CEAL_PLAN_ITEM_STATUSES = vocabulary(["pending", "active", "completed"]);
|
|
1038
|
+
var CEAL_FINAL_PRESENTATION_INTENTS = vocabulary(["final", "stop", "transient_notice"]);
|
|
1039
|
+
var CEAL_PRESENTATION_INTENTS = vocabulary(["progress", ...CEAL_FINAL_PRESENTATION_INTENTS]);
|
|
1040
|
+
|
|
1041
|
+
// packages/ceal-client-protocol/src/resource-row.ts
|
|
1042
|
+
var RESOURCE_ROW_KEY_RULES = Object.freeze({
|
|
1043
|
+
schema_version: { required: true, timestamp: false },
|
|
1044
|
+
ref: { required: true, timestamp: false },
|
|
1045
|
+
next: { required: true, timestamp: false },
|
|
1046
|
+
kind: { required: true, timestamp: false },
|
|
1047
|
+
title: { required: true, timestamp: false },
|
|
1048
|
+
container_label: { required: true, timestamp: false },
|
|
1049
|
+
container_ref: { required: false, timestamp: false },
|
|
1050
|
+
source: { required: true, timestamp: false },
|
|
1051
|
+
owner: { required: false, timestamp: false },
|
|
1052
|
+
counterparts: { required: false, timestamp: false },
|
|
1053
|
+
created_at: { required: false, timestamp: true },
|
|
1054
|
+
created_at_local: { required: false, timestamp: true },
|
|
1055
|
+
modified_at: { required: false, timestamp: true },
|
|
1056
|
+
modified_at_local: { required: false, timestamp: true },
|
|
1057
|
+
viewed_by_me_at: { required: false, timestamp: true },
|
|
1058
|
+
visibility: { required: false, timestamp: false },
|
|
1059
|
+
start: { required: false, timestamp: false },
|
|
1060
|
+
end: { required: false, timestamp: false },
|
|
1061
|
+
status: { required: false, timestamp: false },
|
|
1062
|
+
snippet: { required: false, timestamp: false },
|
|
1063
|
+
state: { required: true, timestamp: false },
|
|
1064
|
+
timestamp_basis: { required: true, timestamp: false }
|
|
1065
|
+
});
|
|
1066
|
+
var RESOURCE_ROW_REQUIRED_KEYS = Object.entries(RESOURCE_ROW_KEY_RULES).flatMap(([key, rule]) => rule.required ? [key] : []);
|
|
1067
|
+
var RESOURCE_ROW_KEYS = new Set(Object.keys(RESOURCE_ROW_KEY_RULES));
|
|
1068
|
+
var RESOURCE_ROW_TIMESTAMP_KEYS = Object.entries(RESOURCE_ROW_KEY_RULES).flatMap(([key, rule]) => rule.timestamp ? [key] : []);
|
|
1069
|
+
|
|
1070
|
+
// packages/ceal-client-protocol/src/resource-read-result.ts
|
|
1071
|
+
var CEAL_RESOURCE_GET_COVERAGE_NEXT_ACTIONS = vocabulary(["reduce_request_size", "read_resource_again"]);
|
|
1072
|
+
|
|
1073
|
+
// packages/ceal-client-protocol/src/excluded-target-coverage-contract.ts
|
|
1074
|
+
var CEAL_EXCLUDED_TARGET_REASONS = vocabulary(["audience_narrower_than_place", "visibility_unknown"]);
|
|
1075
|
+
|
|
1076
|
+
// packages/ceal-client-protocol/src/excluded-target-coverage.ts
|
|
1077
|
+
var CEAL_EXCLUDED_TARGET_COVERAGE_MAX_ENTRIES = 64;
|
|
1078
|
+
function cealExcludedTargetCoverageJsonSchema() {
|
|
1079
|
+
const target = {
|
|
1080
|
+
target_ref: { type: "string", minLength: 8, maxLength: 134, pattern: "^target:[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$" },
|
|
1081
|
+
connector_kind: { type: "string", minLength: 1, maxLength: 64, pattern: "^[a-z][a-z0-9-]{0,63}$" },
|
|
1082
|
+
label: { type: "string", minLength: 1, maxLength: CEAL_PUBLIC_DISPLAY_NAME_MAX_BYTES },
|
|
1083
|
+
reason: { type: "string", enum: [...CEAL_EXCLUDED_TARGET_REASONS] }
|
|
1084
|
+
};
|
|
1085
|
+
return {
|
|
1086
|
+
type: "array",
|
|
1087
|
+
minItems: 1,
|
|
1088
|
+
maxItems: CEAL_EXCLUDED_TARGET_COVERAGE_MAX_ENTRIES,
|
|
1089
|
+
items: { type: "object", additionalProperties: false, maxProperties: 4, properties: target, required: ["target_ref", "reason"] }
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// packages/ceal-client-protocol/src/write-safety-finding.ts
|
|
1094
|
+
var CEAL_WRITE_SAFETY_FINDING_STATUSES = vocabulary(["warning", "unchecked"]);
|
|
1095
|
+
var CEAL_WRITE_SAFETY_AUDIENCES = vocabulary(["workspace", "person", "members", "unknown"]);
|
|
1096
|
+
var CEAL_WRITE_SAFETY_REFERENCE_REASONS = vocabulary(["not_published_to_audience", "audience_access_unknown"]);
|
|
1097
|
+
var CEAL_WRITE_SAFETY_UNCHECKED_REASONS = vocabulary(["authority_unavailable"]);
|
|
1098
|
+
|
|
716
1099
|
// packages/ceal-client-protocol/src/operation-occurrence.ts
|
|
717
1100
|
var MAX_RECEIPT_REVISION = Number.MAX_SAFE_INTEGER - 1;
|
|
718
1101
|
|
|
1102
|
+
// packages/ceal-client-protocol/src/leased-artifact-contract.ts
|
|
1103
|
+
var CEAL_LEASED_CONSUMER_ARTIFACT_CHUNK_MAX_BYTES = 12 * 1024;
|
|
1104
|
+
|
|
719
1105
|
// packages/ceal-client-protocol/src/leased-resource-stream.ts
|
|
720
1106
|
var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_MAGIC = new Uint8Array([67, 69, 65, 76, 82, 83, 50, 0]);
|
|
721
1107
|
var CEAL_LEASED_CONSUMER_ATTACHMENT_STREAM_RECORD_PREFIX_BYTES = 8;
|
|
@@ -727,6 +1113,7 @@ var CEAL_ATTACHMENT_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_
|
|
|
727
1113
|
// packages/ceal-client-protocol/src/request-validation-primitives.ts
|
|
728
1114
|
import { createHash } from "node:crypto";
|
|
729
1115
|
var DIGEST = /^[a-f0-9]{64}$/u;
|
|
1116
|
+
var CEAL_SHA256_DIGEST_PATTERN = DIGEST.source;
|
|
730
1117
|
function isCealDigest(value) {
|
|
731
1118
|
return typeof value === "string" && DIGEST.test(value);
|
|
732
1119
|
}
|
|
@@ -753,7 +1140,7 @@ var CANCELLATION_STATES = vocabulary(["requested", "cancelled"]);
|
|
|
753
1140
|
var CEAL_REQUEST_KEYS = Object.freeze(["schema_version", "ceal_request_ref", "created_at", "authority", "prompt_ref", "host_session_ref", "host_turn_ref", "host_source_ref"]);
|
|
754
1141
|
var CEAL_REQUEST_JSON_SCHEMA = {
|
|
755
1142
|
type: "object",
|
|
756
|
-
maxProperties:
|
|
1143
|
+
maxProperties: 10,
|
|
757
1144
|
additionalProperties: false,
|
|
758
1145
|
properties: {
|
|
759
1146
|
schema_version: { type: "string", const: CEAL_REQUEST_SCHEMA_VERSION, maxLength: 32 },
|
|
@@ -776,7 +1163,8 @@ var CEAL_REQUEST_JSON_SCHEMA = {
|
|
|
776
1163
|
host_session_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
777
1164
|
host_turn_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
778
1165
|
host_input_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
779
|
-
host_source_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source }
|
|
1166
|
+
host_source_ref: { type: "string", minLength: 1, maxLength: 128, pattern: SAFE_REF.source },
|
|
1167
|
+
requester_timezone: { type: "string", minLength: 1, maxLength: 128, description: "IANA timezone observed for the requester on this Request." }
|
|
780
1168
|
},
|
|
781
1169
|
required: CEAL_REQUEST_KEYS
|
|
782
1170
|
};
|
|
@@ -826,21 +1214,26 @@ var REQUEST_NODE_STANDING_OCCURRENCE_SCHEMA = {
|
|
|
826
1214
|
},
|
|
827
1215
|
required: ["schema_version", "node_ref", "operation_id", "correlation_ref", "occurrence_ref", "graph_revision", "graph_revision_digest", "admitted_input_sha256", "reason"]
|
|
828
1216
|
};
|
|
1217
|
+
var REQUEST_EXECUTION_PREPARE_REFUSAL_PROPERTIES = {
|
|
1218
|
+
schema_version: { type: "string", const: CEAL_OPERATION_ERROR_SCHEMA_VERSION, maxLength: 64 },
|
|
1219
|
+
code: REQUEST_ACTION_SAFE_REF_SCHEMA,
|
|
1220
|
+
message: { type: "string", minLength: 1, maxLength: 2048 },
|
|
1221
|
+
property: { type: "string", minLength: 1, maxLength: 256 },
|
|
1222
|
+
next_action: REQUEST_ACTION_SAFE_REF_SCHEMA,
|
|
1223
|
+
retryable: { type: "boolean" },
|
|
1224
|
+
source: { type: "string", enum: ["provider", "gateway"] },
|
|
1225
|
+
retry_after_ms: { type: "integer", minimum: 0, maximum: CEAL_RETRY_AFTER_MAX_MS },
|
|
1226
|
+
excluded_targets: cealExcludedTargetCoverageJsonSchema(),
|
|
1227
|
+
repaired_input: {},
|
|
1228
|
+
unrepaired_pointers: { type: "array", maxItems: 128, items: { type: "string", minLength: 1, maxLength: 256 } },
|
|
1229
|
+
provider_handoff: { type: "string", const: "not_offered", maxLength: 32 },
|
|
1230
|
+
cause: { type: "string", enum: [...CEAL_OPERATION_WITHHELD_CAUSES] }
|
|
1231
|
+
};
|
|
829
1232
|
var REQUEST_EXECUTION_PREPARE_REFUSAL_SCHEMA = {
|
|
830
1233
|
type: "object",
|
|
831
1234
|
additionalProperties: false,
|
|
832
|
-
maxProperties:
|
|
833
|
-
properties:
|
|
834
|
-
schema_version: { type: "string", const: CEAL_OPERATION_ERROR_SCHEMA_VERSION, maxLength: 64 },
|
|
835
|
-
code: REQUEST_ACTION_SAFE_REF_SCHEMA,
|
|
836
|
-
message: { type: "string", minLength: 1, maxLength: 2048 },
|
|
837
|
-
property: { type: "string", minLength: 1, maxLength: 256 },
|
|
838
|
-
next_action: REQUEST_ACTION_SAFE_REF_SCHEMA,
|
|
839
|
-
retryable: { type: "boolean" },
|
|
840
|
-
repaired_input: {},
|
|
841
|
-
unrepaired_pointers: { type: "array", maxItems: 128, items: { type: "string", minLength: 1, maxLength: 256 } },
|
|
842
|
-
provider_handoff: { type: "string", const: "not_offered", maxLength: 32 }
|
|
843
|
-
},
|
|
1235
|
+
maxProperties: Object.keys(REQUEST_EXECUTION_PREPARE_REFUSAL_PROPERTIES).length,
|
|
1236
|
+
properties: REQUEST_EXECUTION_PREPARE_REFUSAL_PROPERTIES,
|
|
844
1237
|
required: ["schema_version", "code", "message", "next_action", "retryable"]
|
|
845
1238
|
};
|
|
846
1239
|
var CEAL_REQUEST_EXECUTION_ORDERS = vocabulary(["graph_dependency", "caller"]);
|
|
@@ -1043,16 +1436,14 @@ function exactKeys(value, expected) {
|
|
|
1043
1436
|
}
|
|
1044
1437
|
|
|
1045
1438
|
// packages/ceal-client-protocol/src/client-result-materialization.ts
|
|
1046
|
-
var
|
|
1047
|
-
var
|
|
1439
|
+
var CEAL_MODEL_VISIBLE_COMMAND_OUTPUT_MAX_BYTES = 32 * 1024;
|
|
1440
|
+
var REQUIRED_FIELDS2 = Object.freeze(["schema_version", "operation_id", "read_argv"]);
|
|
1441
|
+
var FIELDS = /* @__PURE__ */ new Set([...REQUIRED_FIELDS2, "local_result_root"]);
|
|
1048
1442
|
|
|
1049
1443
|
// packages/ceal-client-protocol/src/session-start-affordance.ts
|
|
1050
1444
|
var CEAL_SESSION_ENTRY_INVOCATION = "ceal";
|
|
1051
1445
|
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
1446
|
|
|
1053
|
-
// packages/ceal-client-protocol/src/discovery-manifest.ts
|
|
1054
|
-
var CEAL_DISCOVERY_MANIFEST_CONNECTOR_KINDS = vocabulary(["github", "google-workspace", "notion", "slack"]);
|
|
1055
|
-
|
|
1056
1447
|
// packages/ceal-client-protocol/src/conversation-contracts.ts
|
|
1057
1448
|
var CEAL_APPROVAL_POLICY_KINDS = vocabulary(["requester_only", "named_users", "role_based"]);
|
|
1058
1449
|
var CEAL_APPROVAL_TARGET_KINDS = vocabulary([
|
|
@@ -1095,38 +1486,18 @@ var CEAL_GATEWAY_ANNOUNCEMENT_POLICY_NON_CLAIMS = vocabulary([
|
|
|
1095
1486
|
|
|
1096
1487
|
// packages/ceal-client-protocol/src/gateway-discovery-response-validation.ts
|
|
1097
1488
|
var ANNOUNCEMENT_POLICY_CAPABILITY_BINDINGS = Object.freeze({
|
|
1098
|
-
"
|
|
1099
|
-
"
|
|
1100
|
-
"github.issue.get": [{ effect: "read", scopeStatementKind: "github_app_installation_repositories", providerAuthorityKind: "github_app" }],
|
|
1101
|
-
"github.pull_request.get": [{ effect: "read", scopeStatementKind: "github_app_installation_repositories", providerAuthorityKind: "github_app" }],
|
|
1489
|
+
"repository.get": [{ effect: "read", scopeStatementKind: "github_app_installation_repositories", providerAuthorityKind: "github_app" }],
|
|
1490
|
+
"resource.search": [{ effect: "read", scopeStatementKind: "github_app_installation_repositories", providerAuthorityKind: "github_app" }],
|
|
1102
1491
|
"github.workflow_run.get": [{ effect: "read", scopeStatementKind: "github_app_installation_repositories", providerAuthorityKind: "github_app" }],
|
|
1103
1492
|
"message.search": [{ effect: "read", scopeStatementKind: "slack_public_app_member_channels_only", providerAuthorityKind: "slack_app" }],
|
|
1104
|
-
"message.get": [{ effect: "read", scopeStatementKind: "slack_public_app_member_channels_only", providerAuthorityKind: "slack_app" }],
|
|
1105
|
-
"resource.resolve": [
|
|
1106
|
-
{ effect: "read", scopeStatementKind: "slack_public_app_member_channels_only", providerAuthorityKind: "slack_app" },
|
|
1107
|
-
{ effect: "read", scopeStatementKind: "notion_connected_logical_area", providerAuthorityKind: "notion_integration" }
|
|
1108
|
-
],
|
|
1109
|
-
"conversation.thread.get": [{ effect: "read", scopeStatementKind: "slack_public_app_member_channels_only", providerAuthorityKind: "slack_app" }],
|
|
1110
1493
|
"notion.search": [{ effect: "read", scopeStatementKind: "notion_connected_logical_area", providerAuthorityKind: "notion_integration" }],
|
|
1111
|
-
"
|
|
1112
|
-
"
|
|
1113
|
-
"
|
|
1114
|
-
"
|
|
1115
|
-
"
|
|
1116
|
-
"
|
|
1117
|
-
"
|
|
1118
|
-
"sheets.values.update": [{ effect: "write", scopeStatementKind: "google_workspace_ceal_drive_or_direct_share_editable_sheet_ranges", providerAuthorityKind: "google_service_account" }],
|
|
1119
|
-
"sheets.values.clear": [{ effect: "write", scopeStatementKind: "google_workspace_ceal_drive_or_direct_share_editable_sheet_clear_ranges", providerAuthorityKind: "google_service_account" }]
|
|
1120
|
-
});
|
|
1121
|
-
var ANNOUNCEMENT_SCOPE_STATEMENTS = Object.freeze({
|
|
1122
|
-
github_app_installation_repositories: "Repositories in the installed GitHub App installation.",
|
|
1123
|
-
slack_public_app_member_channels_only: "Public channels where the installed Slack app is a member; private channels, direct messages, multi-person direct messages, and requester membership are not declared by this connector.",
|
|
1124
|
-
notion_connected_logical_area: "Connected Notion logical area under provider-enforced sharing; descendant inventory is not declared.",
|
|
1125
|
-
google_workspace_calendar_read_only: "Approved Calendar availability and event reads only; Calendar mutation is not declared.",
|
|
1126
|
-
google_workspace_ceal_drive_or_direct_share_metadata: "Metadata search for files in the organization shared drive named Ceal Drive and files directly shared with the provider application; file-content read and mutation are not declared.",
|
|
1127
|
-
google_workspace_ceal_drive_or_direct_share_sheet_ranges: "Bounded values reads from governed Google Sheets in the organization shared drive named Ceal Drive and directly shared files; file mutation is not declared.",
|
|
1128
|
-
google_workspace_ceal_drive_or_direct_share_editable_sheet_ranges: "Bounded values updates in governed editable Google Sheets in the organization shared drive named Ceal Drive and directly shared files; Docs, Slides, and other Drive file mutation are not declared.",
|
|
1129
|
-
google_workspace_ceal_drive_or_direct_share_editable_sheet_clear_ranges: "Bounded values clears in governed editable Google Sheets in the organization shared drive named Ceal Drive and directly shared files; Docs, Slides, and other Drive file mutation are not declared."
|
|
1494
|
+
"resource.get": [{ effect: "read", scopeStatementKind: "notion_connected_logical_area", providerAuthorityKind: "notion_integration" }],
|
|
1495
|
+
"availability.get": [{ effect: "read", scopeStatementKind: "google_workspace_calendar_read_only", providerAuthorityKind: "google_service_account" }],
|
|
1496
|
+
"event.search": [{ effect: "read", scopeStatementKind: "google_workspace_calendar_read_only", providerAuthorityKind: "google_service_account" }],
|
|
1497
|
+
"file.search": [{ effect: "read", scopeStatementKind: "google_workspace_admitted_drive_target_metadata", providerAuthorityKind: "google_service_account" }],
|
|
1498
|
+
"cell_range.get": [{ effect: "read", scopeStatementKind: "google_workspace_admitted_drive_target_sheet_ranges", providerAuthorityKind: "google_service_account" }],
|
|
1499
|
+
"sheet.list": [{ effect: "read", scopeStatementKind: "google_workspace_admitted_drive_target_sheet_tabs", providerAuthorityKind: "google_service_account" }],
|
|
1500
|
+
"cell_range.update": [{ effect: "write", scopeStatementKind: "google_workspace_admitted_drive_target_editable_sheet_ranges", providerAuthorityKind: "google_service_account" }]
|
|
1130
1501
|
});
|
|
1131
1502
|
|
|
1132
1503
|
// packages/ceal-client-protocol/src/gateway-write-identity.ts
|
|
@@ -1183,90 +1554,6 @@ var ADMIN_LINEAGE_NODE_KINDS = vocabulary(["source_read", "synthesis_preview", "
|
|
|
1183
1554
|
// packages/ceal-client-protocol/src/actor-kind.ts
|
|
1184
1555
|
var CEAL_ACTOR_KINDS = vocabulary(["human", "bot", "app", "unknown"]);
|
|
1185
1556
|
|
|
1186
|
-
// packages/ceal-client-protocol/src/leased-consumer-vocabulary.ts
|
|
1187
|
-
var CEAL_TERMINAL_DISPOSITIONS = vocabulary(["completed", "failed", "cancelled"]);
|
|
1188
|
-
var CEAL_LEASE_DISPOSITIONS = vocabulary([...CEAL_TERMINAL_DISPOSITIONS, "deferred"]);
|
|
1189
|
-
var CEAL_AUTOMATIC_FEEDBACK_INTENTS = vocabulary(["initial"]);
|
|
1190
|
-
var CEAL_LEASED_MESSAGE_DELIVERY_CAPABILITY_IDS = vocabulary(["message.create", "message.update", "message.delete"]);
|
|
1191
|
-
var CEAL_REPOSITORY_VISIBILITIES = vocabulary(["public", "private", "internal"]);
|
|
1192
|
-
var CEAL_RESULT_DELIVERY_OFFERS = vocabulary(["pending", "offered", "transport_lost"]);
|
|
1193
|
-
var CEAL_RESULT_DELIVERY_STATES = vocabulary(["unavailable", ...CEAL_RESULT_DELIVERY_OFFERS]);
|
|
1194
|
-
var CEAL_PROVIDER_OUTCOMES = vocabulary(["not_attempted", "outcome_unknown", "verified"]);
|
|
1195
|
-
var CEAL_ACTIVITY_GAP_CODES = vocabulary([
|
|
1196
|
-
"provider_page_budget",
|
|
1197
|
-
"related_item_budget",
|
|
1198
|
-
"provider_cursor_unavailable",
|
|
1199
|
-
"malformed_provider_page",
|
|
1200
|
-
"visibility_incomplete",
|
|
1201
|
-
"unsupported_event_kind"
|
|
1202
|
-
]);
|
|
1203
|
-
var CEAL_ACTIVITY_COVERAGE_STATUSES = vocabulary(["complete_for_target", "continuation_required", "blocked"]);
|
|
1204
|
-
var CEAL_ACTIVITY_EVENT_KINDS = vocabulary([
|
|
1205
|
-
"slack.message",
|
|
1206
|
-
"slack.reply",
|
|
1207
|
-
"github.commit.authored",
|
|
1208
|
-
"github.issue.opened",
|
|
1209
|
-
"github.pull_request.opened",
|
|
1210
|
-
"github.review.submitted",
|
|
1211
|
-
"github.issue_comment.created",
|
|
1212
|
-
"github.review_comment.created",
|
|
1213
|
-
"calendar.organized",
|
|
1214
|
-
"calendar.accepted_invite",
|
|
1215
|
-
"calendar.recorded"
|
|
1216
|
-
]);
|
|
1217
|
-
var CEAL_ACTIVITY_TIMESTAMP_BASES = vocabulary([
|
|
1218
|
-
"message_created",
|
|
1219
|
-
"commit_authored",
|
|
1220
|
-
"resource_created",
|
|
1221
|
-
"review_submitted",
|
|
1222
|
-
"comment_created",
|
|
1223
|
-
"event_start",
|
|
1224
|
-
"all_day_start"
|
|
1225
|
-
]);
|
|
1226
|
-
var CEAL_ARTIFACT_STAGE_TERMINALS = vocabulary(["chunk_accepted", "artifact_ready", "idempotency_replayed"]);
|
|
1227
|
-
var CEAL_READ_ITEM_KINDS = vocabulary(["conversation", "identity", "usergroup", "message", "file", "document"]);
|
|
1228
|
-
var CEAL_RESOURCE_RESOLVE_KINDS = vocabulary(["conversation", "identity", "usergroup", "permalink"]);
|
|
1229
|
-
var CEAL_OPAQUE_HANDLE_KINDS = vocabulary(["target", "message", "thread", "artifact", "document", "object"]);
|
|
1230
|
-
var CEAL_WRITE_OBJECT_KINDS = vocabulary(["document", "comment", "cell_range"]);
|
|
1231
|
-
var CEAL_CONVERSATION_KINDS = vocabulary(["channel", "dm", "group"]);
|
|
1232
|
-
var CEAL_FILE_TYPE_FAMILIES = vocabulary(["all", "image", "pdf"]);
|
|
1233
|
-
var CEAL_GITHUB_ISSUE_STATES = vocabulary(["open", "closed", "all"]);
|
|
1234
|
-
var CEAL_NOTION_UPDATABLE_BLOCK_TYPES = vocabulary([
|
|
1235
|
-
"paragraph",
|
|
1236
|
-
"heading_1",
|
|
1237
|
-
"heading_2",
|
|
1238
|
-
"heading_3",
|
|
1239
|
-
"bulleted_list_item",
|
|
1240
|
-
"numbered_list_item",
|
|
1241
|
-
"to_do",
|
|
1242
|
-
"code"
|
|
1243
|
-
]);
|
|
1244
|
-
var CEAL_NOTION_NEUTRAL_TYPES = vocabulary([
|
|
1245
|
-
"text",
|
|
1246
|
-
"number",
|
|
1247
|
-
"boolean",
|
|
1248
|
-
"date",
|
|
1249
|
-
"select",
|
|
1250
|
-
"multi_select",
|
|
1251
|
-
"people",
|
|
1252
|
-
"url",
|
|
1253
|
-
"email",
|
|
1254
|
-
"phone",
|
|
1255
|
-
"unsupported"
|
|
1256
|
-
]);
|
|
1257
|
-
var CEAL_NOTION_IDENTITY_GAP_REASONS = vocabulary([
|
|
1258
|
-
"identity_unavailable",
|
|
1259
|
-
"identity_stale",
|
|
1260
|
-
"identity_ambiguous",
|
|
1261
|
-
"identity_revoked",
|
|
1262
|
-
"identity_unlinked"
|
|
1263
|
-
]);
|
|
1264
|
-
var CEAL_NOTION_STRING_VALUE_TYPES = vocabulary(["text", "select", "url", "email", "phone"]);
|
|
1265
|
-
var CEAL_UNREAD_REASONS = vocabulary(["blocked", "unavailable", "too_large", "unsupported", "download_failed", "permission_denied"]);
|
|
1266
|
-
var CEAL_PLAN_ITEM_STATUSES = vocabulary(["pending", "active", "completed"]);
|
|
1267
|
-
var CEAL_FINAL_PRESENTATION_INTENTS = vocabulary(["final", "stop", "transient_notice"]);
|
|
1268
|
-
var CEAL_PRESENTATION_INTENTS = vocabulary(["progress", ...CEAL_FINAL_PRESENTATION_INTENTS]);
|
|
1269
|
-
|
|
1270
1557
|
// packages/ceal-client-protocol/src/personal-client-vocabulary.ts
|
|
1271
1558
|
var CEAL_PERSONAL_CLIENT_BINDING_KEYS = vocabulary([
|
|
1272
1559
|
"access_group_ref",
|
|
@@ -1284,11 +1571,12 @@ var CEAL_REFRESH_FAILURE_CODES = vocabulary([
|
|
|
1284
1571
|
"refresh_replayed",
|
|
1285
1572
|
"refresh_revoked",
|
|
1286
1573
|
"authority_replaced",
|
|
1287
|
-
"refresh_recovery_unavailable"
|
|
1574
|
+
"refresh_recovery_unavailable",
|
|
1575
|
+
"refresh_recovery_expired"
|
|
1288
1576
|
]);
|
|
1289
1577
|
|
|
1290
1578
|
// packages/ceal-client-protocol/src/device-enrollment.ts
|
|
1291
|
-
var CEAL_DEVICE_ENROLLMENT_POLL_FAILURE_CODES = Object.freeze(["unsupported_feature", "recovery_required", "expired"]);
|
|
1579
|
+
var CEAL_DEVICE_ENROLLMENT_POLL_FAILURE_CODES = Object.freeze(["unsupported_feature", "recovery_required", "expired", "denied"]);
|
|
1292
1580
|
var POLL_RESULT_KEYS = Object.freeze(["retry_after_ms", "schema_version", "status"]);
|
|
1293
1581
|
|
|
1294
1582
|
// packages/ceal-client-protocol/src/personal-client-session.ts
|
|
@@ -1300,7 +1588,6 @@ var MAX_ARGUMENT_BYTES = 16 * 1024;
|
|
|
1300
1588
|
var HANDSHAKE_IDENTITY_KEYS = Object.freeze(["membership_ref", "registration_ref", "client_ref", "subject_ref", "instance_ref"]);
|
|
1301
1589
|
var AUDIT_IDENTITY_KEYS = Object.freeze(["event_ref", "membership_ref", "registration_ref", "client_ref", "subject_ref", "instance_ref"]);
|
|
1302
1590
|
var FAILURE_RESPONSE_KEYS = Object.freeze(["error", "ok", "proof_ref_or_unavailable", "protocol_version", "request_id"]);
|
|
1303
|
-
var MAX_RECOVERY_RETRY_AFTER_MS = 60 * 60 * 1e3;
|
|
1304
1591
|
|
|
1305
1592
|
// host/invocation-authentication-client-command.ts
|
|
1306
1593
|
var MAX_DETAIL_CHARACTERS = 240;
|
|
@@ -1311,8 +1598,8 @@ function hostTerminalFailure(error, component) {
|
|
|
1311
1598
|
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." };
|
|
1312
1599
|
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." };
|
|
1313
1600
|
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." };
|
|
1314
|
-
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
|
|
1315
|
-
return { code: "host_failure_unclassified", message: `The ${component} Host command failed for a cause it cannot classify: ${detail}`, next_action: `Run \`ceal-host doctor
|
|
1601
|
+
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.` };
|
|
1602
|
+
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.` };
|
|
1316
1603
|
}
|
|
1317
1604
|
var DOCTOR_FLAGS = Object.freeze({
|
|
1318
1605
|
"--expected-sha256": "expected_sha256",
|
|
@@ -1604,6 +1891,9 @@ function errorCode2(error) {
|
|
|
1604
1891
|
return typeof error === "object" && error !== null && "code" in error ? String(error.code) : null;
|
|
1605
1892
|
}
|
|
1606
1893
|
|
|
1894
|
+
// host/relay/src/relay-request-binding-store.ts
|
|
1895
|
+
var MAX_STATE_BYTES = 8 * 1024 * 1024;
|
|
1896
|
+
|
|
1607
1897
|
// host/relay/src/relay-quarantine-store.ts
|
|
1608
1898
|
var RELAY_QUARANTINE_MAX_BYTES = 16 * 1024 * 1024;
|
|
1609
1899
|
|
|
@@ -1612,9 +1902,6 @@ var DEFAULT_LIMITS = { global_count: 8192, global_bytes: 64 * 1024 * 1024, produ
|
|
|
1612
1902
|
var RETRY_SECONDS = [1, 2, 4, 8, 16, 32, 60];
|
|
1613
1903
|
var MAX_RETRYABLE_ATTEMPTS = RETRY_SECONDS.length + 10;
|
|
1614
1904
|
|
|
1615
|
-
// host/relay/src/relay-request-binding-store.ts
|
|
1616
|
-
var MAX_STATE_BYTES = 8 * 1024 * 1024;
|
|
1617
|
-
|
|
1618
1905
|
// host/relay/src/relay-ipc.ts
|
|
1619
1906
|
import { createConnection, createServer } from "node:net";
|
|
1620
1907
|
|
|
@@ -1643,13 +1930,56 @@ var HOST_RELAY_INVOCATION_CONTEXT_RESULT_SCHEMA = "ceal.host_relay_invocation_co
|
|
|
1643
1930
|
var HOST_RELAY_IPC_LENGTH_BYTES = Uint32Array.BYTES_PER_ELEMENT;
|
|
1644
1931
|
var HOST_RELAY_ADMISSION_RESPONSE_MAX_BYTES = 4096;
|
|
1645
1932
|
var HOST_RELAY_QUERY_RESPONSE_MAX_BYTES = 8192;
|
|
1933
|
+
var HOST_RELAY_INVOCATION_MINT_REFUSAL_REASONS = vocabulary([
|
|
1934
|
+
"context_stale",
|
|
1935
|
+
"context_expired",
|
|
1936
|
+
"host_source_refused",
|
|
1937
|
+
"host_credential_refused",
|
|
1938
|
+
"gateway_unavailable",
|
|
1939
|
+
"gateway_refused",
|
|
1940
|
+
"gateway_response_invalid",
|
|
1941
|
+
"deadline",
|
|
1942
|
+
"cancelled",
|
|
1943
|
+
"mint_failed",
|
|
1944
|
+
"relay_failed"
|
|
1945
|
+
]);
|
|
1946
|
+
var HOST_RELAY_INVOCATION_MINT_OUTCOMES = vocabulary(["completed", "caller_cancelled", "deadline", "failed", "no_binding"]);
|
|
1947
|
+
var HOST_RELAY_EXCHANGE_FAILURES = vocabulary([
|
|
1948
|
+
"permission_denied",
|
|
1949
|
+
"socket_missing",
|
|
1950
|
+
"connection_refused",
|
|
1951
|
+
"closed_early",
|
|
1952
|
+
"response_invalid",
|
|
1953
|
+
"timed_out",
|
|
1954
|
+
"cancelled",
|
|
1955
|
+
"unavailable"
|
|
1956
|
+
]);
|
|
1646
1957
|
var HostRelayIpcError = class extends Error {
|
|
1647
1958
|
code;
|
|
1648
|
-
|
|
1959
|
+
/** Set only when the client-side socket exchange itself failed. */
|
|
1960
|
+
failure;
|
|
1961
|
+
constructor(code3, message = code3, failure2) {
|
|
1649
1962
|
super(message);
|
|
1650
1963
|
this.code = code3;
|
|
1964
|
+
this.failure = failure2;
|
|
1651
1965
|
}
|
|
1652
1966
|
};
|
|
1967
|
+
function hostRelayExchangeFailure(error) {
|
|
1968
|
+
return error instanceof HostRelayIpcError ? error.failure : void 0;
|
|
1969
|
+
}
|
|
1970
|
+
function socketErrorFailure(error) {
|
|
1971
|
+
switch (errorCode3(error)) {
|
|
1972
|
+
case "EACCES":
|
|
1973
|
+
case "EPERM":
|
|
1974
|
+
return "permission_denied";
|
|
1975
|
+
case "ENOENT":
|
|
1976
|
+
return "socket_missing";
|
|
1977
|
+
case "ECONNREFUSED":
|
|
1978
|
+
return "connection_refused";
|
|
1979
|
+
default:
|
|
1980
|
+
return "unavailable";
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1653
1983
|
var HostRelayInvocationContextPort = class {
|
|
1654
1984
|
endpoint;
|
|
1655
1985
|
constructor(endpoint) {
|
|
@@ -1683,7 +2013,7 @@ function exchange(endpoint, encoded, timeoutMs, decode, signal) {
|
|
|
1683
2013
|
const socket = createConnection(endpoint);
|
|
1684
2014
|
let buffer = Buffer.alloc(0);
|
|
1685
2015
|
let settled = false;
|
|
1686
|
-
const aborted = () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC was cancelled."));
|
|
2016
|
+
const aborted = () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC was cancelled.", "cancelled"));
|
|
1687
2017
|
const finish = (error, response2) => {
|
|
1688
2018
|
if (settled) return;
|
|
1689
2019
|
settled = true;
|
|
@@ -1692,13 +2022,16 @@ function exchange(endpoint, encoded, timeoutMs, decode, signal) {
|
|
|
1692
2022
|
if (error !== null) reject(error);
|
|
1693
2023
|
else if (response2 !== void 0) resolve(response2);
|
|
1694
2024
|
};
|
|
1695
|
-
if (timeoutMs !== void 0) socket.setTimeout(timeoutMs, () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC timed out.")));
|
|
2025
|
+
if (timeoutMs !== void 0) socket.setTimeout(timeoutMs, () => finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC timed out.", "timed_out")));
|
|
1696
2026
|
if (signal?.aborted === true) {
|
|
1697
2027
|
aborted();
|
|
1698
2028
|
return;
|
|
1699
2029
|
}
|
|
1700
2030
|
signal?.addEventListener("abort", aborted, { once: true });
|
|
1701
|
-
socket.once("error", () =>
|
|
2031
|
+
socket.once("error", (error) => {
|
|
2032
|
+
const failure2 = socketErrorFailure(error);
|
|
2033
|
+
finish(new HostRelayIpcError("relay_unavailable", `Host Relay IPC is unavailable: ${failure2}.`, failure2));
|
|
2034
|
+
});
|
|
1702
2035
|
socket.once("connect", () => socket.write(encoded));
|
|
1703
2036
|
socket.on("data", (chunk) => {
|
|
1704
2037
|
try {
|
|
@@ -1706,11 +2039,11 @@ function exchange(endpoint, encoded, timeoutMs, decode, signal) {
|
|
|
1706
2039
|
const decoded = decode(buffer);
|
|
1707
2040
|
if (decoded !== null) finish(null, decoded);
|
|
1708
2041
|
} catch (error) {
|
|
1709
|
-
finish(error instanceof Error ? error :
|
|
2042
|
+
finish(new HostRelayIpcError("relay_unavailable", error instanceof Error ? error.message : "Host Relay IPC response is invalid.", "response_invalid"));
|
|
1710
2043
|
}
|
|
1711
2044
|
});
|
|
1712
2045
|
socket.once("end", () => {
|
|
1713
|
-
if (!settled) finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC closed without a response."));
|
|
2046
|
+
if (!settled) finish(new HostRelayIpcError("relay_unavailable", "Host Relay IPC closed without a response.", "closed_early"));
|
|
1714
2047
|
});
|
|
1715
2048
|
});
|
|
1716
2049
|
}
|
|
@@ -1770,6 +2103,7 @@ function validQueryIdentity(value, schema) {
|
|
|
1770
2103
|
function validInvocationContextResponse(value) {
|
|
1771
2104
|
if (!record2(value) || value.schema_version !== HOST_RELAY_INVOCATION_CONTEXT_RESULT_SCHEMA) return false;
|
|
1772
2105
|
if (value.status === "no_binding") return Object.keys(value).length === 2;
|
|
2106
|
+
if (value.status === "refused") return Object.keys(value).length === 3 && isVocabularyWord(HOST_RELAY_INVOCATION_MINT_REFUSAL_REASONS, value.reason);
|
|
1773
2107
|
if (value.status !== "ready" || Object.keys(value).length !== 3) return false;
|
|
1774
2108
|
try {
|
|
1775
2109
|
decodeCealHostInvocationAuthenticationResult(value.result);
|
|
@@ -1803,6 +2137,9 @@ function exactKeys3(value, keys) {
|
|
|
1803
2137
|
function safeRef2(value) {
|
|
1804
2138
|
return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u.test(value);
|
|
1805
2139
|
}
|
|
2140
|
+
function errorCode3(error) {
|
|
2141
|
+
return record2(error) && typeof error.code === "string" ? error.code : null;
|
|
2142
|
+
}
|
|
1806
2143
|
|
|
1807
2144
|
// host/invocation-authentication-command.ts
|
|
1808
2145
|
var HOST_INVOCATION_AUTHENTICATION_COMMAND_PREFIX = ["authenticate", "--client-nonce"];
|
|
@@ -1846,12 +2183,22 @@ async function authenticateHostInvocation(descriptor, input, options) {
|
|
|
1846
2183
|
local_turn_ref: current.identity.host_turn_ref,
|
|
1847
2184
|
client_nonce: request2.client_nonce
|
|
1848
2185
|
};
|
|
1849
|
-
const response2 = await config.mint_invocation_context
|
|
1850
|
-
if (response2.status !== "ready") throw new TypeError(response2.status);
|
|
2186
|
+
const response2 = await mintedResult(config.mint_invocation_context, query);
|
|
1851
2187
|
const rechecked = await store.readInvocationContext(current.identity.host_source_ref, current.identity.host_session_ref, (config.now ?? (() => /* @__PURE__ */ new Date()))());
|
|
1852
2188
|
if (rechecked === null || !sameTurn(current, rechecked)) throw new TypeError("context replaced");
|
|
1853
2189
|
return decodeCealHostInvocationAuthenticationResult(response2.result, now);
|
|
1854
2190
|
}
|
|
2191
|
+
async function mintedResult(mint, query) {
|
|
2192
|
+
let response2;
|
|
2193
|
+
try {
|
|
2194
|
+
response2 = await mint(query);
|
|
2195
|
+
} catch (error) {
|
|
2196
|
+
throw new TypeError(`relay ${hostRelayExchangeFailure(error) ?? "unavailable"}`);
|
|
2197
|
+
}
|
|
2198
|
+
if (response2.status === "refused") throw new TypeError(`mint ${response2.reason}`);
|
|
2199
|
+
if (response2.status !== "ready") throw new TypeError(response2.status);
|
|
2200
|
+
return response2;
|
|
2201
|
+
}
|
|
1855
2202
|
async function currentInvocation(descriptor, config, now) {
|
|
1856
2203
|
const store = descriptor.create_store(config.outbox_dir);
|
|
1857
2204
|
const identity = resolveIdentity(descriptor, config);
|
|
@@ -1894,8 +2241,11 @@ function writeResult(value, sink) {
|
|
|
1894
2241
|
}
|
|
1895
2242
|
|
|
1896
2243
|
// host/producer-service.ts
|
|
1897
|
-
import {
|
|
1898
|
-
|
|
2244
|
+
import { posix as posix3, win32 as win323 } from "node:path";
|
|
2245
|
+
|
|
2246
|
+
// host/runtime-source-paths.ts
|
|
2247
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
2248
|
+
import { posix as posix2, win32 as win322 } from "node:path";
|
|
1899
2249
|
|
|
1900
2250
|
// host/absolute-path.ts
|
|
1901
2251
|
import { posix, win32 } from "node:path";
|
|
@@ -1904,7 +2254,35 @@ function isAbsoluteNormalizedNonRootPath(value, flavor = process.platform, allow
|
|
|
1904
2254
|
return typeof value === "string" && value.length <= 4096 && !value.includes("\0") && pathApi.isAbsolute(value) && pathApi.normalize(value) === value && (allowRoot || pathApi.parse(value).root !== value);
|
|
1905
2255
|
}
|
|
1906
2256
|
|
|
2257
|
+
// host/runtime-source-paths.ts
|
|
2258
|
+
var HOST_SOURCE_ID = /^host-source:([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})$/u;
|
|
2259
|
+
function hostSourceUuid(sourceRef) {
|
|
2260
|
+
return HOST_SOURCE_ID.exec(sourceRef)?.[1] ?? null;
|
|
2261
|
+
}
|
|
2262
|
+
function hostRuntimeSourcePaths(stateRoot, sourceRef, platform = process.platform) {
|
|
2263
|
+
const sourceId = hostSourceUuid(sourceRef);
|
|
2264
|
+
if (!isAbsoluteNormalizedNonRootPath(stateRoot, platform) || sourceId === null) throw new TypeError("Host runtime source identity is invalid.");
|
|
2265
|
+
const path = platform === "win32" ? win322 : posix2;
|
|
2266
|
+
const sourcesRoot = path.join(stateRoot, "sources");
|
|
2267
|
+
const sourceRoot = path.join(sourcesRoot, sourceId);
|
|
2268
|
+
const runtimeRoot = path.join(stateRoot, "run");
|
|
2269
|
+
const endpoint = platform === "win32" ? `\\\\.\\pipe\\ceal-host-${createHash2("sha256").update(`${stateRoot}\0${sourceRef}`).digest("hex").slice(0, 24)}` : path.join(runtimeRoot, `${sourceId}.sock`);
|
|
2270
|
+
assertHostRuntimeIpcLength(endpoint, platform);
|
|
2271
|
+
return { sourceId, sourcesRoot, sourceRoot, relayRoot: path.join(sourceRoot, "relay"), codexOutbox: path.join(sourceRoot, "producers", "codex", "outbox"), claudeOutbox: path.join(sourceRoot, "producers", "claude", "outbox"), endpoint, runtimeRoot };
|
|
2272
|
+
}
|
|
2273
|
+
function assertHostRuntimeIpcLength(endpoint, platform) {
|
|
2274
|
+
if (platform === "win32") return;
|
|
2275
|
+
const maximum = platform === "linux" ? 107 : 103;
|
|
2276
|
+
if (Buffer.byteLength(endpoint, "utf8") > maximum) throw Object.assign(new TypeError(`ipc_endpoint_too_long: Host IPC path exceeds ${maximum} bytes; use a shorter Host state root.`), { code: "ipc_endpoint_too_long" });
|
|
2277
|
+
}
|
|
2278
|
+
function assertHostProducerSourcePaths(stateRoot, config, producer, platform = process.platform) {
|
|
2279
|
+
const paths = hostRuntimeSourcePaths(stateRoot, config.host_source_ref, platform);
|
|
2280
|
+
if (config.outbox_dir !== (producer === "codex" ? paths.codexOutbox : paths.claudeOutbox) || config.relay_endpoint !== paths.endpoint) throw new TypeError("Host producer outbox and IPC must belong to its configured source.");
|
|
2281
|
+
}
|
|
2282
|
+
|
|
1907
2283
|
// host/producer-service.ts
|
|
2284
|
+
import { constants } from "node:fs";
|
|
2285
|
+
import { lstat as lstat2, open as open2 } from "node:fs/promises";
|
|
1908
2286
|
var MAX_CONFIG_BYTES = 32 * 1024;
|
|
1909
2287
|
var SAFE_REF3 = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u;
|
|
1910
2288
|
var HOST_PRODUCER_CONFIG_FLAG = "--ceal-host-config";
|
|
@@ -1921,7 +2299,15 @@ function parseHostProducerConfigFlag(args, platform = process.platform) {
|
|
|
1921
2299
|
return parseProducerHostConfigFlag(args, HOST_PRODUCER_CONFIG_FLAG, platform, hostProducerError);
|
|
1922
2300
|
}
|
|
1923
2301
|
async function readHostProducerConfig(descriptor, configPath, platform = process.platform) {
|
|
1924
|
-
|
|
2302
|
+
const config = decodeHostProducerConfigText(descriptor, await readProducerConfigText(configPath, platform, hostProducerError), platform);
|
|
2303
|
+
const path = platform === "win32" ? win323 : posix3;
|
|
2304
|
+
const root = path.resolve(config.outbox_dir, "../../../../..");
|
|
2305
|
+
try {
|
|
2306
|
+
assertHostProducerSourcePaths(root, config, descriptor.producer_id, platform);
|
|
2307
|
+
} catch (error) {
|
|
2308
|
+
throw hostProducerError("invalid_config", error instanceof Error ? error.message : "Host producer source tuple is invalid.");
|
|
2309
|
+
}
|
|
2310
|
+
return config;
|
|
1925
2311
|
}
|
|
1926
2312
|
function decodeHostProducerConfigText(descriptor, text, platform = process.platform) {
|
|
1927
2313
|
const extraPaths = descriptor.extra_paths ?? [];
|
|
@@ -2057,7 +2443,7 @@ function boundedMilliseconds(value) {
|
|
|
2057
2443
|
}
|
|
2058
2444
|
|
|
2059
2445
|
// host/claude/src/claude-decoder.ts
|
|
2060
|
-
import { createHash as
|
|
2446
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
2061
2447
|
|
|
2062
2448
|
// host/claude/src/claude-types.ts
|
|
2063
2449
|
var CLAUDE_SESSION_ID_ENVIRONMENT = "CLAUDE_CODE_SESSION_ID";
|
|
@@ -2084,7 +2470,7 @@ function claudeLocalSessionRef(sessionId) {
|
|
|
2084
2470
|
return `claude-session:${digest(sessionId)}`;
|
|
2085
2471
|
}
|
|
2086
2472
|
function digest(value) {
|
|
2087
|
-
return
|
|
2473
|
+
return createHash3("sha256").update(value, "utf8").digest("hex");
|
|
2088
2474
|
}
|
|
2089
2475
|
|
|
2090
2476
|
// host/claude/src/claude-outbox.ts
|
|
@@ -2438,6 +2824,7 @@ async function drainClaudeProducerOnce(options) {
|
|
|
2438
2824
|
var CLAUDE_PRODUCER_CONFIG_SCHEMA = "ceal.claude_producer_config.v1";
|
|
2439
2825
|
var CLAUDE_PRODUCER_DESCRIPTOR = {
|
|
2440
2826
|
schema: CLAUDE_PRODUCER_CONFIG_SCHEMA,
|
|
2827
|
+
producer_id: "claude",
|
|
2441
2828
|
config: (shared) => shared,
|
|
2442
2829
|
runtime_options: (config) => Object.freeze({
|
|
2443
2830
|
outbox_dir: config.outbox_dir,
|
|
@@ -2464,7 +2851,7 @@ function runClaudeInvocationAuthenticationCommand(args, options) {
|
|
|
2464
2851
|
}
|
|
2465
2852
|
|
|
2466
2853
|
// host/client-doctor.ts
|
|
2467
|
-
import { createHash as
|
|
2854
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
2468
2855
|
import { execFile } from "node:child_process";
|
|
2469
2856
|
import { access, open as open4, readFile as readFile3, realpath, stat } from "node:fs/promises";
|
|
2470
2857
|
import { delimiter, isAbsolute, join as join4 } from "node:path";
|
|
@@ -2549,7 +2936,7 @@ async function resolveCealExecutable(command, environment) {
|
|
|
2549
2936
|
const metadata = await stat(path);
|
|
2550
2937
|
if (!metadata.isFile()) continue;
|
|
2551
2938
|
if (await isLauncher(path)) return resolveLauncherBinary(path, environment);
|
|
2552
|
-
return { path, sha256:
|
|
2939
|
+
return { path, sha256: createHash4("sha256").update(await readFile3(path)).digest("hex") };
|
|
2553
2940
|
} catch {
|
|
2554
2941
|
}
|
|
2555
2942
|
}
|
|
@@ -2579,7 +2966,7 @@ async function resolveLauncherBinary(launcherPath, environment) {
|
|
|
2579
2966
|
const binaryPath = await realpath(parsed.binary_path);
|
|
2580
2967
|
const metadata = await stat(binaryPath);
|
|
2581
2968
|
if (!metadata.isFile()) throw new Error("launcher doctor reported a non-file binary path");
|
|
2582
|
-
return { path: binaryPath, sha256:
|
|
2969
|
+
return { path: binaryPath, sha256: createHash4("sha256").update(await readFile3(binaryPath)).digest("hex") };
|
|
2583
2970
|
}
|
|
2584
2971
|
async function executeCealCommand(executable, args, environment) {
|
|
2585
2972
|
try {
|