@aexhq/sdk 0.46.4-canary → 0.50.0
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/LICENSE +201 -0
- package/NOTICE +38 -0
- package/README.md +23 -31
- package/dist/client/aex.d.ts +33 -0
- package/dist/client/aex.js +98 -0
- package/dist/client/aex.js.map +1 -0
- package/dist/client/credentials.d.ts +25 -0
- package/dist/client/credentials.js +97 -0
- package/dist/client/credentials.js.map +1 -0
- package/dist/client/routing.d.ts +7 -0
- package/dist/client/routing.js +29 -0
- package/dist/client/routing.js.map +1 -0
- package/dist/downloads/download.d.ts +25 -0
- package/dist/downloads/download.js +53 -0
- package/dist/downloads/download.js.map +1 -0
- package/dist/generated/errors.d.ts +12 -0
- package/dist/generated/errors.js +81 -0
- package/dist/generated/errors.js.map +1 -0
- package/dist/generated/resources.d.ts +730 -0
- package/dist/generated/resources.js +606 -0
- package/dist/generated/resources.js.map +1 -0
- package/dist/generated/routes.d.ts +42 -0
- package/dist/generated/routes.js +2101 -0
- package/dist/generated/routes.js.map +1 -0
- package/dist/index.d.ts +20 -50
- package/dist/index.js +11 -62
- package/dist/index.js.map +1 -1
- package/dist/observations/stream.d.ts +1 -0
- package/dist/observations/stream.js +18 -0
- package/dist/observations/stream.js.map +1 -0
- package/dist/transport/errors.d.ts +60 -0
- package/dist/transport/errors.js +107 -0
- package/dist/transport/errors.js.map +1 -0
- package/dist/transport/pagination.d.ts +8 -0
- package/dist/transport/pagination.js +34 -0
- package/dist/transport/pagination.js.map +1 -0
- package/dist/transport/retry.d.ts +21 -0
- package/dist/transport/retry.js +37 -0
- package/dist/transport/retry.js.map +1 -0
- package/dist/transport/transport.d.ts +25 -0
- package/dist/transport/transport.js +28 -0
- package/dist/transport/transport.js.map +1 -0
- package/package.json +63 -30
- package/dist/_contracts/account-operations.d.ts +0 -101
- package/dist/_contracts/account-operations.js +0 -242
- package/dist/_contracts/account-types.d.ts +0 -461
- package/dist/_contracts/account-types.js +0 -1
- package/dist/_contracts/api-key.d.ts +0 -61
- package/dist/_contracts/api-key.js +0 -101
- package/dist/_contracts/api-routes.d.ts +0 -20
- package/dist/_contracts/api-routes.js +0 -109
- package/dist/_contracts/archive-limits.d.ts +0 -3
- package/dist/_contracts/archive-limits.js +0 -23
- package/dist/_contracts/asset-authoring.d.ts +0 -22
- package/dist/_contracts/asset-authoring.js +0 -106
- package/dist/_contracts/asset-bundle.d.ts +0 -64
- package/dist/_contracts/asset-bundle.js +0 -263
- package/dist/_contracts/asset-upload-helper.d.ts +0 -31
- package/dist/_contracts/asset-upload-helper.js +0 -84
- package/dist/_contracts/billing-admission.d.ts +0 -29
- package/dist/_contracts/billing-admission.js +0 -28
- package/dist/_contracts/bundle-manifest.d.ts +0 -89
- package/dist/_contracts/bundle-manifest.js +0 -158
- package/dist/_contracts/canonical-sha256.d.ts +0 -8
- package/dist/_contracts/canonical-sha256.js +0 -8
- package/dist/_contracts/connection-ticket.d.ts +0 -22
- package/dist/_contracts/connection-ticket.js +0 -54
- package/dist/_contracts/continuation-event.d.ts +0 -31
- package/dist/_contracts/continuation-event.js +0 -6
- package/dist/_contracts/contract-parse-error.d.ts +0 -12
- package/dist/_contracts/contract-parse-error.js +0 -51
- package/dist/_contracts/error-codes.d.ts +0 -26
- package/dist/_contracts/error-codes.js +0 -116
- package/dist/_contracts/error-factory.d.ts +0 -32
- package/dist/_contracts/error-factory.js +0 -174
- package/dist/_contracts/event-envelope.d.ts +0 -471
- package/dist/_contracts/event-envelope.js +0 -501
- package/dist/_contracts/event-stream-client.d.ts +0 -122
- package/dist/_contracts/event-stream-client.js +0 -445
- package/dist/_contracts/event-view.d.ts +0 -44
- package/dist/_contracts/event-view.js +0 -69
- package/dist/_contracts/failure-class.d.ts +0 -29
- package/dist/_contracts/failure-class.js +0 -73
- package/dist/_contracts/http.d.ts +0 -135
- package/dist/_contracts/http.js +0 -434
- package/dist/_contracts/ids.d.ts +0 -66
- package/dist/_contracts/ids.js +0 -119
- package/dist/_contracts/index.d.ts +0 -42
- package/dist/_contracts/index.js +0 -52
- package/dist/_contracts/internal.d.ts +0 -55
- package/dist/_contracts/internal.js +0 -113
- package/dist/_contracts/models.d.ts +0 -30
- package/dist/_contracts/models.js +0 -28
- package/dist/_contracts/operation-core.d.ts +0 -36
- package/dist/_contracts/operation-core.js +0 -70
- package/dist/_contracts/operations.d.ts +0 -218
- package/dist/_contracts/operations.js +0 -1496
- package/dist/_contracts/otlp-projection.d.ts +0 -78
- package/dist/_contracts/otlp-projection.js +0 -171
- package/dist/_contracts/post-hook.d.ts +0 -31
- package/dist/_contracts/post-hook.js +0 -61
- package/dist/_contracts/provider-fault.d.ts +0 -34
- package/dist/_contracts/provider-fault.js +0 -68
- package/dist/_contracts/retry-core.d.ts +0 -29
- package/dist/_contracts/retry-core.js +0 -79
- package/dist/_contracts/runner-event.d.ts +0 -117
- package/dist/_contracts/runner-event.js +0 -172
- package/dist/_contracts/runtime-kind.d.ts +0 -60
- package/dist/_contracts/runtime-kind.js +0 -70
- package/dist/_contracts/runtime-manifest.d.ts +0 -121
- package/dist/_contracts/runtime-manifest.js +0 -83
- package/dist/_contracts/runtime-security-profile.d.ts +0 -26
- package/dist/_contracts/runtime-security-profile.js +0 -73
- package/dist/_contracts/runtime-sizes.d.ts +0 -104
- package/dist/_contracts/runtime-sizes.js +0 -111
- package/dist/_contracts/runtime-types.d.ts +0 -618
- package/dist/_contracts/runtime-types.js +0 -58
- package/dist/_contracts/schemas/asset-bundle.d.ts +0 -70
- package/dist/_contracts/schemas/asset-bundle.js +0 -107
- package/dist/_contracts/schemas/asset-ref.d.ts +0 -61
- package/dist/_contracts/schemas/asset-ref.js +0 -118
- package/dist/_contracts/schemas/bundle-manifest.d.ts +0 -66
- package/dist/_contracts/schemas/bundle-manifest.js +0 -77
- package/dist/_contracts/schemas/index.d.ts +0 -32
- package/dist/_contracts/schemas/index.js +0 -30
- package/dist/_contracts/schemas/mcp-server.d.ts +0 -99
- package/dist/_contracts/schemas/mcp-server.js +0 -209
- package/dist/_contracts/schemas/models.d.ts +0 -29
- package/dist/_contracts/schemas/models.js +0 -51
- package/dist/_contracts/schemas/numeric.d.ts +0 -18
- package/dist/_contracts/schemas/numeric.js +0 -28
- package/dist/_contracts/schemas/post-hook.d.ts +0 -45
- package/dist/_contracts/schemas/post-hook.js +0 -68
- package/dist/_contracts/schemas/response-assets.d.ts +0 -75
- package/dist/_contracts/schemas/response-assets.js +0 -81
- package/dist/_contracts/schemas/response-billing.d.ts +0 -208
- package/dist/_contracts/schemas/response-billing.js +0 -139
- package/dist/_contracts/schemas/response-common.d.ts +0 -132
- package/dist/_contracts/schemas/response-common.js +0 -162
- package/dist/_contracts/schemas/response-identity.d.ts +0 -648
- package/dist/_contracts/schemas/response-identity.js +0 -131
- package/dist/_contracts/schemas/response-mcp-servers.d.ts +0 -51
- package/dist/_contracts/schemas/response-mcp-servers.js +0 -32
- package/dist/_contracts/schemas/response-secrets.d.ts +0 -50
- package/dist/_contracts/schemas/response-secrets.js +0 -32
- package/dist/_contracts/schemas/response-sessions-internal.d.ts +0 -200
- package/dist/_contracts/schemas/response-sessions-internal.js +0 -142
- package/dist/_contracts/schemas/response-sessions.d.ts +0 -1598
- package/dist/_contracts/schemas/response-sessions.js +0 -377
- package/dist/_contracts/schemas/response-webhooks.d.ts +0 -76
- package/dist/_contracts/schemas/response-webhooks.js +0 -42
- package/dist/_contracts/schemas/response-workspace.d.ts +0 -225
- package/dist/_contracts/schemas/response-workspace.js +0 -99
- package/dist/_contracts/schemas/runtime-kind.d.ts +0 -31
- package/dist/_contracts/schemas/runtime-kind.js +0 -29
- package/dist/_contracts/schemas/runtime-security-profile.d.ts +0 -28
- package/dist/_contracts/schemas/runtime-security-profile.js +0 -26
- package/dist/_contracts/schemas/runtime-sizes.d.ts +0 -70
- package/dist/_contracts/schemas/runtime-sizes.js +0 -127
- package/dist/_contracts/schemas/session-limits.d.ts +0 -34
- package/dist/_contracts/schemas/session-limits.js +0 -39
- package/dist/_contracts/schemas/session-machine.d.ts +0 -23
- package/dist/_contracts/schemas/session-machine.js +0 -24
- package/dist/_contracts/schemas/session-request-config.d.ts +0 -58
- package/dist/_contracts/schemas/session-request-config.js +0 -134
- package/dist/_contracts/schemas/session-webhook.d.ts +0 -11
- package/dist/_contracts/schemas/session-webhook.js +0 -38
- package/dist/_contracts/schemas/side-effect-audit.d.ts +0 -98
- package/dist/_contracts/schemas/side-effect-audit.js +0 -102
- package/dist/_contracts/schemas/submission-assets.d.ts +0 -117
- package/dist/_contracts/schemas/submission-assets.js +0 -147
- package/dist/_contracts/schemas/submission-body.d.ts +0 -251
- package/dist/_contracts/schemas/submission-body.js +0 -378
- package/dist/_contracts/schemas/submission-environment.d.ts +0 -79
- package/dist/_contracts/schemas/submission-environment.js +0 -179
- package/dist/_contracts/schemas/submission-request.d.ts +0 -158
- package/dist/_contracts/schemas/submission-request.js +0 -49
- package/dist/_contracts/schemas/submission-secrets.d.ts +0 -47
- package/dist/_contracts/schemas/submission-secrets.js +0 -108
- package/dist/_contracts/schemas/wire.d.ts +0 -118
- package/dist/_contracts/schemas/wire.js +0 -171
- package/dist/_contracts/schemas/workspace-resources.d.ts +0 -50
- package/dist/_contracts/schemas/workspace-resources.js +0 -87
- package/dist/_contracts/sdk-errors.d.ts +0 -212
- package/dist/_contracts/sdk-errors.js +0 -313
- package/dist/_contracts/sdk-secrets.d.ts +0 -67
- package/dist/_contracts/sdk-secrets.js +0 -427
- package/dist/_contracts/session-archive.d.ts +0 -16
- package/dist/_contracts/session-archive.js +0 -92
- package/dist/_contracts/session-artifacts.d.ts +0 -189
- package/dist/_contracts/session-artifacts.js +0 -264
- package/dist/_contracts/session-config.d.ts +0 -373
- package/dist/_contracts/session-config.js +0 -562
- package/dist/_contracts/session-cost-types.d.ts +0 -211
- package/dist/_contracts/session-cost-types.js +0 -69
- package/dist/_contracts/session-cost.d.ts +0 -8
- package/dist/_contracts/session-cost.js +0 -582
- package/dist/_contracts/session-custody.d.ts +0 -165
- package/dist/_contracts/session-custody.js +0 -345
- package/dist/_contracts/session-file-query.d.ts +0 -14
- package/dist/_contracts/session-file-query.js +0 -178
- package/dist/_contracts/session-record.d.ts +0 -112
- package/dist/_contracts/session-record.js +0 -165
- package/dist/_contracts/session-retention.d.ts +0 -201
- package/dist/_contracts/session-retention.js +0 -450
- package/dist/_contracts/side-effect-audit.d.ts +0 -126
- package/dist/_contracts/side-effect-audit.js +0 -520
- package/dist/_contracts/sse.d.ts +0 -74
- package/dist/_contracts/sse.js +0 -227
- package/dist/_contracts/stable.d.ts +0 -45
- package/dist/_contracts/stable.js +0 -62
- package/dist/_contracts/status.d.ts +0 -25
- package/dist/_contracts/status.js +0 -57
- package/dist/_contracts/submission-limits.d.ts +0 -61
- package/dist/_contracts/submission-limits.js +0 -60
- package/dist/_contracts/submission.d.ts +0 -547
- package/dist/_contracts/submission.js +0 -812
- package/dist/_contracts/suggest.d.ts +0 -15
- package/dist/_contracts/suggest.js +0 -53
- package/dist/_contracts/testing/response-bindings.d.ts +0 -45
- package/dist/_contracts/testing/response-bindings.js +0 -256
- package/dist/_contracts/testing/wire-conformance-entry.d.ts +0 -10
- package/dist/_contracts/testing/wire-conformance-entry.js +0 -8
- package/dist/_contracts/testing/wire-conformance.d.ts +0 -169
- package/dist/_contracts/testing/wire-conformance.js +0 -276
- package/dist/_contracts/turn-trace.d.ts +0 -28
- package/dist/_contracts/turn-trace.js +0 -1
- package/dist/_contracts/unknown-field-error.d.ts +0 -13
- package/dist/_contracts/unknown-field-error.js +0 -21
- package/dist/_contracts/value-guards.d.ts +0 -20
- package/dist/_contracts/value-guards.js +0 -34
- package/dist/_contracts/webhook-verify.d.ts +0 -34
- package/dist/_contracts/webhook-verify.js +0 -93
- package/dist/_contracts/wire-observer.d.ts +0 -49
- package/dist/_contracts/wire-observer.js +0 -34
- package/dist/_contracts/workflow-status.d.ts +0 -7
- package/dist/_contracts/workflow-status.js +0 -43
- package/dist/_contracts/workspace-resources.d.ts +0 -98
- package/dist/_contracts/workspace-resources.js +0 -39
- package/dist/archive-limits.d.ts +0 -1
- package/dist/archive-limits.js +0 -2
- package/dist/archive-limits.js.map +0 -1
- package/dist/asset-upload.d.ts +0 -47
- package/dist/asset-upload.js +0 -269
- package/dist/asset-upload.js.map +0 -1
- package/dist/bundle.d.ts +0 -9
- package/dist/bundle.js +0 -20
- package/dist/bundle.js.map +0 -1
- package/dist/canonical-zip.d.ts +0 -68
- package/dist/canonical-zip.js +0 -355
- package/dist/canonical-zip.js.map +0 -1
- package/dist/cli.mjs +0 -12048
- package/dist/cli.mjs.sha256 +0 -1
- package/dist/client-types.d.ts +0 -192
- package/dist/client-types.js +0 -2
- package/dist/client-types.js.map +0 -1
- package/dist/client.d.ts +0 -464
- package/dist/client.js +0 -1207
- package/dist/client.js.map +0 -1
- package/dist/event-projection.d.ts +0 -22
- package/dist/event-projection.js +0 -380
- package/dist/event-projection.js.map +0 -1
- package/dist/fetch-archive.d.ts +0 -16
- package/dist/fetch-archive.js +0 -252
- package/dist/fetch-archive.js.map +0 -1
- package/dist/file.d.ts +0 -96
- package/dist/file.js +0 -272
- package/dist/file.js.map +0 -1
- package/dist/instructions.d.ts +0 -20
- package/dist/instructions.js +0 -40
- package/dist/instructions.js.map +0 -1
- package/dist/legacy-session-provider-fault.d.ts +0 -7
- package/dist/legacy-session-provider-fault.js +0 -38
- package/dist/legacy-session-provider-fault.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -84
- package/dist/mcp-server.js +0 -117
- package/dist/mcp-server.js.map +0 -1
- package/dist/node-fs.d.ts +0 -29
- package/dist/node-fs.js +0 -19
- package/dist/node-fs.js.map +0 -1
- package/dist/node-walk.d.ts +0 -69
- package/dist/node-walk.js +0 -151
- package/dist/node-walk.js.map +0 -1
- package/dist/path-basename.d.ts +0 -5
- package/dist/path-basename.js +0 -9
- package/dist/path-basename.js.map +0 -1
- package/dist/retry.d.ts +0 -70
- package/dist/retry.js +0 -155
- package/dist/retry.js.map +0 -1
- package/dist/secret.d.ts +0 -65
- package/dist/secret.js +0 -110
- package/dist/secret.js.map +0 -1
- package/dist/session-validate.d.ts +0 -100
- package/dist/session-validate.js +0 -303
- package/dist/session-validate.js.map +0 -1
- package/dist/skill.d.ts +0 -99
- package/dist/skill.js +0 -169
- package/dist/skill.js.map +0 -1
- package/dist/submission-wire.d.ts +0 -13
- package/dist/submission-wire.js +0 -69
- package/dist/submission-wire.js.map +0 -1
- package/dist/tool.d.ts +0 -41
- package/dist/tool.js +0 -76
- package/dist/tool.js.map +0 -1
- package/dist/version.d.ts +0 -9
- package/dist/version.js +0 -10
- package/dist/version.js.map +0 -1
- package/docs/authentication.md +0 -125
- package/docs/billing.md +0 -164
- package/docs/cleanup.md +0 -27
- package/docs/concepts/agent-tools.md +0 -47
- package/docs/concepts/composition.md +0 -60
- package/docs/concepts/providers-and-runtimes.md +0 -121
- package/docs/concepts/sessions.md +0 -51
- package/docs/concepts/subagents.md +0 -35
- package/docs/credentials.md +0 -116
- package/docs/defaults.md +0 -51
- package/docs/errors.md +0 -258
- package/docs/events.md +0 -143
- package/docs/files.md +0 -130
- package/docs/limits-and-quotas.md +0 -114
- package/docs/limits.md +0 -51
- package/docs/mcp.md +0 -47
- package/docs/networking.md +0 -114
- package/docs/provider-runtime-capabilities.md +0 -32
- package/docs/public-surface.json +0 -73
- package/docs/quickstart.md +0 -135
- package/docs/release.md +0 -44
- package/docs/retries.md +0 -108
- package/docs/secrets.md +0 -141
- package/docs/session-config.md +0 -51
- package/docs/session-record.md +0 -58
- package/docs/skills.md +0 -65
- package/docs/telemetry.md +0 -66
- package/docs/testing.md +0 -35
- package/docs/vision-skills.md +0 -94
- package/docs/webhooks.md +0 -143
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shape gates for the canonical asset-bundle pipeline.
|
|
3
|
-
*
|
|
4
|
-
* These schemas cover the parts of bundling that are genuinely *shape*
|
|
5
|
-
* questions — is this a files map, is this entry bytes, is this fidelity
|
|
6
|
-
* metadata an object — and stop there. Three kinds of rule deliberately stay in
|
|
7
|
-
* `asset-bundle.ts`:
|
|
8
|
-
*
|
|
9
|
-
* - **Graph rules.** Duplicate paths, an `exec` entry that names no regular
|
|
10
|
-
* file, a symlink colliding with a leaf, and the leaf-prefix walk are
|
|
11
|
-
* relations *between* entries. A schema sees one value at a time.
|
|
12
|
-
* - **Accounting.** The cumulative decompressed budget fails on the entry that
|
|
13
|
-
* crosses it, so it is a fold over the traversal, not a per-value predicate.
|
|
14
|
-
* - **Anything downstream of canonicalisation.** `parseSkillBundleEntry`
|
|
15
|
-
* normalises a path, and the symlink-target diagnostics quote the *canonical*
|
|
16
|
-
* path. Per D4 a schema never transforms, so those checks necessarily run
|
|
17
|
-
* after the normaliser rather than inside a schema.
|
|
18
|
-
*
|
|
19
|
-
* Every factory takes the `kind`/`source` prefix its caller already computed,
|
|
20
|
-
* because the two bundle kinds word the same failure differently ("Skill files
|
|
21
|
-
* map is required" against "Skill bundle exceeds …"), and the fidelity
|
|
22
|
-
* diagnostics are reused verbatim by the restore-side splitter.
|
|
23
|
-
*
|
|
24
|
-
* Nothing here is strict: bundle inputs are open maps keyed by caller-chosen
|
|
25
|
-
* paths, and fidelity metadata must tolerate keys a newer SDK adds.
|
|
26
|
-
*/
|
|
27
|
-
import * as z from "zod/mini";
|
|
28
|
-
/**
|
|
29
|
-
* The files map handed to a bundle factory: present, non-empty, within the
|
|
30
|
-
* entry ceiling.
|
|
31
|
-
*
|
|
32
|
-
* Each check aborts, so the ladder reports the same single failure the
|
|
33
|
-
* sequential guard clauses did — a missing map never also reports as empty.
|
|
34
|
-
*/
|
|
35
|
-
export declare function bundleFilesMapSchema(kind: string, source: string, maxFiles: number): z.ZodMiniUnknown;
|
|
36
|
-
/**
|
|
37
|
-
* One authored file's contents, before the caller encodes a string to bytes.
|
|
38
|
-
*
|
|
39
|
-
* The encode stays outside: it is a transform, and the original guard tested
|
|
40
|
-
* the coerced value only to catch what was neither a string nor bytes to begin
|
|
41
|
-
* with, which is exactly this union.
|
|
42
|
-
*/
|
|
43
|
-
export declare function bundleFileContentsSchema(kind: string, rawPath: string): z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
|
|
44
|
-
/** One entry of an already-unzipped archive, which is bytes and never a string. */
|
|
45
|
-
export declare function archiveFileBytesSchema(source: string, rawPath: string): z.ZodMiniCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
|
|
46
|
-
/**
|
|
47
|
-
* The fidelity metadata envelope: an object whose `exec` and `symlinks`, when
|
|
48
|
-
* present, are arrays.
|
|
49
|
-
*
|
|
50
|
-
* Element shape is deliberately `unknown` here. The per-element rules run
|
|
51
|
-
* *after* the entry-count ceilings that sit between this gate and the traversal,
|
|
52
|
-
* and reporting an element failure ahead of a count failure would invert the
|
|
53
|
-
* order the guard clauses established.
|
|
54
|
-
*/
|
|
55
|
-
export declare function bundleFidelityMetaSchema(source: string): z.ZodMiniObject<{
|
|
56
|
-
exec: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
57
|
-
symlinks: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
58
|
-
}, z.core.$strip>;
|
|
59
|
-
/**
|
|
60
|
-
* One `symlinks` element, checked for object-ness only.
|
|
61
|
-
*
|
|
62
|
-
* Its `path` and `target` are validated by the two schemas below, in the order
|
|
63
|
-
* canonicalisation forces: the target diagnostics quote the canonical path, so
|
|
64
|
-
* the path must be normalised before the target can be described.
|
|
65
|
-
*/
|
|
66
|
-
export declare function bundleSymlinkRecordSchema(source: string): z.ZodMiniObject<{}, z.core.$strip>;
|
|
67
|
-
/** A fidelity metadata path as supplied, before canonicalisation. */
|
|
68
|
-
export declare function bundleMetadataPathSchema(source: string, kind: "executable" | "symlink"): z.ZodMiniString<string>;
|
|
69
|
-
/** A captured symlink target, reported against the canonical link path. */
|
|
70
|
-
export declare function bundleSymlinkTargetSchema(source: string, path: string, maxLength: number): z.ZodMiniString<string>;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shape gates for the canonical asset-bundle pipeline.
|
|
3
|
-
*
|
|
4
|
-
* These schemas cover the parts of bundling that are genuinely *shape*
|
|
5
|
-
* questions — is this a files map, is this entry bytes, is this fidelity
|
|
6
|
-
* metadata an object — and stop there. Three kinds of rule deliberately stay in
|
|
7
|
-
* `asset-bundle.ts`:
|
|
8
|
-
*
|
|
9
|
-
* - **Graph rules.** Duplicate paths, an `exec` entry that names no regular
|
|
10
|
-
* file, a symlink colliding with a leaf, and the leaf-prefix walk are
|
|
11
|
-
* relations *between* entries. A schema sees one value at a time.
|
|
12
|
-
* - **Accounting.** The cumulative decompressed budget fails on the entry that
|
|
13
|
-
* crosses it, so it is a fold over the traversal, not a per-value predicate.
|
|
14
|
-
* - **Anything downstream of canonicalisation.** `parseSkillBundleEntry`
|
|
15
|
-
* normalises a path, and the symlink-target diagnostics quote the *canonical*
|
|
16
|
-
* path. Per D4 a schema never transforms, so those checks necessarily run
|
|
17
|
-
* after the normaliser rather than inside a schema.
|
|
18
|
-
*
|
|
19
|
-
* Every factory takes the `kind`/`source` prefix its caller already computed,
|
|
20
|
-
* because the two bundle kinds word the same failure differently ("Skill files
|
|
21
|
-
* map is required" against "Skill bundle exceeds …"), and the fidelity
|
|
22
|
-
* diagnostics are reused verbatim by the restore-side splitter.
|
|
23
|
-
*
|
|
24
|
-
* Nothing here is strict: bundle inputs are open maps keyed by caller-chosen
|
|
25
|
-
* paths, and fidelity metadata must tolerate keys a newer SDK adds.
|
|
26
|
-
*/
|
|
27
|
-
import * as z from "zod/mini";
|
|
28
|
-
/** Count the own enumerable keys of an already-validated map-shaped value. */
|
|
29
|
-
function keyCount(value) {
|
|
30
|
-
return Object.keys(value).length;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* The files map handed to a bundle factory: present, non-empty, within the
|
|
34
|
-
* entry ceiling.
|
|
35
|
-
*
|
|
36
|
-
* Each check aborts, so the ladder reports the same single failure the
|
|
37
|
-
* sequential guard clauses did — a missing map never also reports as empty.
|
|
38
|
-
*/
|
|
39
|
-
export function bundleFilesMapSchema(kind, source, maxFiles) {
|
|
40
|
-
return z.unknown().check(z.refine((value) => Boolean(value) && typeof value === "object", {
|
|
41
|
-
error: `${kind} files map is required`,
|
|
42
|
-
abort: true
|
|
43
|
-
}), z.refine((value) => keyCount(value) > 0, {
|
|
44
|
-
error: `${kind} files map cannot be empty`,
|
|
45
|
-
abort: true
|
|
46
|
-
}), z.refine((value) => keyCount(value) <= maxFiles, {
|
|
47
|
-
error: (issue) => `${source} exceeds ${maxFiles} file limit (got ${keyCount(issue.input)})`,
|
|
48
|
-
abort: true
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* One authored file's contents, before the caller encodes a string to bytes.
|
|
53
|
-
*
|
|
54
|
-
* The encode stays outside: it is a transform, and the original guard tested
|
|
55
|
-
* the coerced value only to catch what was neither a string nor bytes to begin
|
|
56
|
-
* with, which is exactly this union.
|
|
57
|
-
*/
|
|
58
|
-
export function bundleFileContentsSchema(kind, rawPath) {
|
|
59
|
-
return z.union([z.string(), z.instanceof(Uint8Array)], {
|
|
60
|
-
error: `${kind} file "${rawPath}" must be a string or Uint8Array`
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/** One entry of an already-unzipped archive, which is bytes and never a string. */
|
|
64
|
-
export function archiveFileBytesSchema(source, rawPath) {
|
|
65
|
-
return z.instanceof(Uint8Array, {
|
|
66
|
-
error: `${source} file ${JSON.stringify(rawPath)} must be a Uint8Array`
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* The fidelity metadata envelope: an object whose `exec` and `symlinks`, when
|
|
71
|
-
* present, are arrays.
|
|
72
|
-
*
|
|
73
|
-
* Element shape is deliberately `unknown` here. The per-element rules run
|
|
74
|
-
* *after* the entry-count ceilings that sit between this gate and the traversal,
|
|
75
|
-
* and reporting an element failure ahead of a count failure would invert the
|
|
76
|
-
* order the guard clauses established.
|
|
77
|
-
*/
|
|
78
|
-
export function bundleFidelityMetaSchema(source) {
|
|
79
|
-
return z.object({
|
|
80
|
-
exec: z.optional(z.array(z.unknown(), { error: `${source} fidelity metadata exec must be an array` })),
|
|
81
|
-
symlinks: z.optional(z.array(z.unknown(), { error: `${source} fidelity metadata symlinks must be an array` }))
|
|
82
|
-
}, { error: `${source} fidelity metadata must be an object` });
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* One `symlinks` element, checked for object-ness only.
|
|
86
|
-
*
|
|
87
|
-
* Its `path` and `target` are validated by the two schemas below, in the order
|
|
88
|
-
* canonicalisation forces: the target diagnostics quote the canonical path, so
|
|
89
|
-
* the path must be normalised before the target can be described.
|
|
90
|
-
*/
|
|
91
|
-
export function bundleSymlinkRecordSchema(source) {
|
|
92
|
-
return z.object({}, { error: `${source} fidelity metadata contains a malformed symlink` });
|
|
93
|
-
}
|
|
94
|
-
/** A fidelity metadata path as supplied, before canonicalisation. */
|
|
95
|
-
export function bundleMetadataPathSchema(source, kind) {
|
|
96
|
-
const message = `${source} ${kind} path must be a non-empty string`;
|
|
97
|
-
return z.string({ error: message }).check(z.minLength(1, { error: message, abort: true }));
|
|
98
|
-
}
|
|
99
|
-
/** A captured symlink target, reported against the canonical link path. */
|
|
100
|
-
export function bundleSymlinkTargetSchema(source, path, maxLength) {
|
|
101
|
-
return z
|
|
102
|
-
.string({ error: `${source} symlink ${JSON.stringify(path)} target must be a string` })
|
|
103
|
-
.check(z.maxLength(maxLength, {
|
|
104
|
-
error: `${source} symlink ${JSON.stringify(path)} target exceeds ${maxLength} characters`,
|
|
105
|
-
abort: true
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schemas for the storage-neutral uploaded-asset wire reference and the
|
|
3
|
-
* container directory it unzips into.
|
|
4
|
-
*
|
|
5
|
-
* The id pattern, the mount-path pattern and the mount-path assert are declared
|
|
6
|
-
* here, next to the schema that enforces them, and re-exported by
|
|
7
|
-
* `session-config.ts` under their published names — same reason as the sibling
|
|
8
|
-
* vocabularies: the parser module imports this one, so the constants cannot live
|
|
9
|
-
* there without a cycle.
|
|
10
|
-
*/
|
|
11
|
-
import * as z from "zod/mini";
|
|
12
|
-
import type { AssetRef } from "../session-config.js";
|
|
13
|
-
/**
|
|
14
|
-
* Asset ids are storage-neutral product ids. Current uploads derive the id from
|
|
15
|
-
* the content digest (`asset_<sha256hex>`), but callers must treat it as opaque.
|
|
16
|
-
*/
|
|
17
|
-
export declare const ASSET_ID_PATTERN: RegExp;
|
|
18
|
-
/**
|
|
19
|
-
* A `mountPath` is an ABSOLUTE container directory under the workspace. It must
|
|
20
|
-
* start with `/`, contain no `..`/`.` traversal or NUL/backslash, and stay
|
|
21
|
-
* within {@link MOUNT_PATH_MAX_LENGTH}. The managed runtime rebases it under the
|
|
22
|
-
* workspace root, so a path outside `/workspace` is clamped there — the pattern
|
|
23
|
-
* just rejects obviously-malformed input at the SDK/BFF boundary. A trailing
|
|
24
|
-
* slash is allowed (it is a directory) but not required.
|
|
25
|
-
*/
|
|
26
|
-
export declare const MOUNT_PATH_PATTERN: RegExp;
|
|
27
|
-
export declare const MOUNT_PATH_MAX_LENGTH = 512;
|
|
28
|
-
/**
|
|
29
|
-
* Validate a `File.mountPath` (an absolute container directory). Shared by the
|
|
30
|
-
* SDK `File` builders and the BFF asset-ref parser so both reject the same
|
|
31
|
-
* malformed input. Throws with `field` context on failure.
|
|
32
|
-
*
|
|
33
|
-
* Kept as an assert rather than folded into {@link mountPath}: the SDK `File`
|
|
34
|
-
* builders and the workspace-resource parsers call it directly on a value they
|
|
35
|
-
* already hold, with their own field name, and never through a schema.
|
|
36
|
-
*/
|
|
37
|
-
export declare function assertValidMountPath(value: string, field: string): void;
|
|
38
|
-
/**
|
|
39
|
-
* Wire shape of any `kind: "asset"` ref (file / tool bundle), mounted at `path`.
|
|
40
|
-
*
|
|
41
|
-
* Declaration order is the order the checks report in, matching the sequential
|
|
42
|
-
* assetId/name/mountPath ladder this replaces. Built per path rather than
|
|
43
|
-
* memoised because callers mount it at indexed positions.
|
|
44
|
-
*/
|
|
45
|
-
export declare function assetRefSchema(path: string): z.ZodMiniObject<{
|
|
46
|
-
kind: z.ZodMiniOptional<z.ZodMiniLiteral<"asset">>;
|
|
47
|
-
assetId: z.ZodMiniString<string>;
|
|
48
|
-
name: z.ZodMiniString<string>;
|
|
49
|
-
mountPath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
50
|
-
}, z.core.$strict>;
|
|
51
|
-
export type AssetRefWire = z.infer<ReturnType<typeof assetRefSchema>>;
|
|
52
|
-
/** Validate an asset ref mounted at `path`, in the family's own words. */
|
|
53
|
-
export declare function parseAssetRefWire(record: unknown, path: string): AssetRefWire;
|
|
54
|
-
/**
|
|
55
|
-
* Stamp the discriminator and drop an absent `mountPath`.
|
|
56
|
-
*
|
|
57
|
-
* Separate from the schema per D4: `z.toJSONSchema(s, {io:"output"})` throws on
|
|
58
|
-
* any `.transform()`, which would make the response half of the generated spec
|
|
59
|
-
* ungenerable. Schemas validate; `normalize*()` functions transform.
|
|
60
|
-
*/
|
|
61
|
-
export declare function normalizeAssetRef(wire: AssetRefWire): AssetRef;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schemas for the storage-neutral uploaded-asset wire reference and the
|
|
3
|
-
* container directory it unzips into.
|
|
4
|
-
*
|
|
5
|
-
* The id pattern, the mount-path pattern and the mount-path assert are declared
|
|
6
|
-
* here, next to the schema that enforces them, and re-exported by
|
|
7
|
-
* `session-config.ts` under their published names — same reason as the sibling
|
|
8
|
-
* vocabularies: the parser module imports this one, so the constants cannot live
|
|
9
|
-
* there without a cycle.
|
|
10
|
-
*/
|
|
11
|
-
import * as z from "zod/mini";
|
|
12
|
-
import { parseWire, wireObject } from "./wire.js";
|
|
13
|
-
/**
|
|
14
|
-
* Asset ids are storage-neutral product ids. Current uploads derive the id from
|
|
15
|
-
* the content digest (`asset_<sha256hex>`), but callers must treat it as opaque.
|
|
16
|
-
*/
|
|
17
|
-
export const ASSET_ID_PATTERN = /^asset_[A-Za-z0-9_-]{8,128}$/;
|
|
18
|
-
/**
|
|
19
|
-
* A `mountPath` is an ABSOLUTE container directory under the workspace. It must
|
|
20
|
-
* start with `/`, contain no `..`/`.` traversal or NUL/backslash, and stay
|
|
21
|
-
* within {@link MOUNT_PATH_MAX_LENGTH}. The managed runtime rebases it under the
|
|
22
|
-
* workspace root, so a path outside `/workspace` is clamped there — the pattern
|
|
23
|
-
* just rejects obviously-malformed input at the SDK/BFF boundary. A trailing
|
|
24
|
-
* slash is allowed (it is a directory) but not required.
|
|
25
|
-
*/
|
|
26
|
-
export const MOUNT_PATH_PATTERN = /^\/(?:[^/\0\\]+\/?)*$/;
|
|
27
|
-
export const MOUNT_PATH_MAX_LENGTH = 512;
|
|
28
|
-
/**
|
|
29
|
-
* Validate a `File.mountPath` (an absolute container directory). Shared by the
|
|
30
|
-
* SDK `File` builders and the BFF asset-ref parser so both reject the same
|
|
31
|
-
* malformed input. Throws with `field` context on failure.
|
|
32
|
-
*
|
|
33
|
-
* Kept as an assert rather than folded into {@link mountPath}: the SDK `File`
|
|
34
|
-
* builders and the workspace-resource parsers call it directly on a value they
|
|
35
|
-
* already hold, with their own field name, and never through a schema.
|
|
36
|
-
*/
|
|
37
|
-
export function assertValidMountPath(value, field) {
|
|
38
|
-
if (value.length === 0 || value.length > MOUNT_PATH_MAX_LENGTH) {
|
|
39
|
-
throw new Error(`${field} must be 1..${MOUNT_PATH_MAX_LENGTH} chars`);
|
|
40
|
-
}
|
|
41
|
-
if (!value.startsWith("/")) {
|
|
42
|
-
throw new Error(`${field} must be an absolute path starting with '/'`);
|
|
43
|
-
}
|
|
44
|
-
if (value.includes("\0") || value.includes("\\")) {
|
|
45
|
-
throw new Error(`${field} must not contain NUL or backslash`);
|
|
46
|
-
}
|
|
47
|
-
if (value.split("/").some((seg) => seg === "..")) {
|
|
48
|
-
throw new Error(`${field} must not contain '..' traversal segments`);
|
|
49
|
-
}
|
|
50
|
-
if (!MOUNT_PATH_PATTERN.test(value)) {
|
|
51
|
-
throw new Error(`${field} must match ${MOUNT_PATH_PATTERN.source}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* {@link assertValidMountPath} reused as both the verdict and the wording of a
|
|
56
|
-
* schema check, so the five-rung ladder is stated once.
|
|
57
|
-
*/
|
|
58
|
-
function mountPathFailure(value, field) {
|
|
59
|
-
try {
|
|
60
|
-
assertValidMountPath(value, field);
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
return error.message;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/** An optional absolute container directory, reported under `field`. */
|
|
68
|
-
function mountPath(field) {
|
|
69
|
-
return z.optional(z.string({ error: `${field}, when provided, must be a string` }).check(z.refine((value) => mountPathFailure(value, field) === null, {
|
|
70
|
-
error: (issue) => mountPathFailure(issue.input, field) ?? "",
|
|
71
|
-
abort: true
|
|
72
|
-
})));
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Wire shape of any `kind: "asset"` ref (file / tool bundle), mounted at `path`.
|
|
76
|
-
*
|
|
77
|
-
* Declaration order is the order the checks report in, matching the sequential
|
|
78
|
-
* assetId/name/mountPath ladder this replaces. Built per path rather than
|
|
79
|
-
* memoised because callers mount it at indexed positions.
|
|
80
|
-
*/
|
|
81
|
-
export function assetRefSchema(path) {
|
|
82
|
-
const assetId = `${path}.assetId must match ${ASSET_ID_PATTERN.source}`;
|
|
83
|
-
const name = `${path}.name must be a non-empty string (<= 128 chars)`;
|
|
84
|
-
return wireObject(path, {
|
|
85
|
-
// Optional, because the normaliser stamps `kind: "asset"` on the way out
|
|
86
|
-
// and a caller that omits it is complete. Not unread, though: `AssetRef`
|
|
87
|
-
// declares `kind: "asset"` and nothing else, so a ref labelled anything
|
|
88
|
-
// else is a caller mistake and is now told so rather than silently
|
|
89
|
-
// relabelled.
|
|
90
|
-
kind: z.optional(z.literal("asset", { error: `${path}.kind, when provided, must be "asset"` })),
|
|
91
|
-
assetId: z.string({ error: assetId }).check(z.regex(ASSET_ID_PATTERN, { error: assetId })),
|
|
92
|
-
name: z
|
|
93
|
-
.string({ error: name })
|
|
94
|
-
.check(z.minLength(1, { error: name }), z.maxLength(128, { error: name })),
|
|
95
|
-
mountPath: mountPath(`${path}.mountPath`)
|
|
96
|
-
}, {
|
|
97
|
-
unknownKey: (objectPath, key) => `${objectPath} contains unexpected field for asset ref: ${key}`
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/** Validate an asset ref mounted at `path`, in the family's own words. */
|
|
101
|
-
export function parseAssetRefWire(record, path) {
|
|
102
|
-
return parseWire(assetRefSchema(path), record);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Stamp the discriminator and drop an absent `mountPath`.
|
|
106
|
-
*
|
|
107
|
-
* Separate from the schema per D4: `z.toJSONSchema(s, {io:"output"})` throws on
|
|
108
|
-
* any `.transform()`, which would make the response half of the generated spec
|
|
109
|
-
* ungenerable. Schemas validate; `normalize*()` functions transform.
|
|
110
|
-
*/
|
|
111
|
-
export function normalizeAssetRef(wire) {
|
|
112
|
-
return {
|
|
113
|
-
kind: "asset",
|
|
114
|
-
assetId: wire.assetId,
|
|
115
|
-
name: wire.name,
|
|
116
|
-
...(wire.mountPath !== undefined ? { mountPath: wire.mountPath } : {})
|
|
117
|
-
};
|
|
118
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schemas for the `.aexmeta.json` bundle fidelity sidecar.
|
|
3
|
-
*
|
|
4
|
-
* Two schemas, because the sidecar is read under different rules than it is
|
|
5
|
-
* written:
|
|
6
|
-
*
|
|
7
|
-
* - {@link bundleManifestSidecarSchema} gates bytes that arrived from an
|
|
8
|
-
* untrusted zip. It carries **no messages**: `tryParseBundleManifest` reports
|
|
9
|
-
* a rejected sidecar as `null`, never as a thrown diagnostic, and a message no
|
|
10
|
-
* caller can observe is a message that will drift.
|
|
11
|
-
* - {@link serializableBundleManifestSchema} gates a manifest on its way out and
|
|
12
|
-
* *does* throw, so it states exactly the two limits the serializer already
|
|
13
|
-
* enforced and nothing more. It deliberately does not re-validate the shape:
|
|
14
|
-
* its input is `BundleManifest`, and widening an output guard into a full
|
|
15
|
-
* structural check would reject values the type system already admitted.
|
|
16
|
-
*
|
|
17
|
-
* Both are factories over their limits rather than importers of them, so
|
|
18
|
-
* `bundle-manifest.ts` stays the single site that decides what the caps are and
|
|
19
|
-
* this module stays free of a cycle back into it.
|
|
20
|
-
*
|
|
21
|
-
* Neither schema is strict. An unknown key in a sidecar written by a newer SDK
|
|
22
|
-
* must be ignored, not rejected — that forward-compatibility is the whole point
|
|
23
|
-
* of the `v` field.
|
|
24
|
-
*/
|
|
25
|
-
import * as z from "zod/mini";
|
|
26
|
-
/**
|
|
27
|
-
* A v1 sidecar: `exec` paths and `symlinks` leaves, each array bounded before
|
|
28
|
-
* the graph that consumes it is built.
|
|
29
|
-
*
|
|
30
|
-
* An unknown `v` fails the literal and therefore yields `null`, which is the
|
|
31
|
-
* forward-compatible outcome: metadata is dropped and the restore proceeds
|
|
32
|
-
* content-only.
|
|
33
|
-
*/
|
|
34
|
-
export declare function bundleManifestSidecarSchema(maxRecords: number, maxSymlinkTargetLength: number): z.ZodMiniObject<{
|
|
35
|
-
v: z.ZodMiniLiteral<1>;
|
|
36
|
-
exec: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
37
|
-
symlinks: z.ZodMiniArray<z.ZodMiniObject<{
|
|
38
|
-
path: z.ZodMiniString<string>;
|
|
39
|
-
target: z.ZodMiniString<string>;
|
|
40
|
-
}, z.core.$strip>>;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
export type BundleManifestSidecarSchema = ReturnType<typeof bundleManifestSidecarSchema>;
|
|
43
|
-
export type BundleManifestSidecar = z.infer<BundleManifestSidecarSchema>;
|
|
44
|
-
/**
|
|
45
|
-
* Parse a decoded sidecar value, collapsing every rejection to `null`.
|
|
46
|
-
*
|
|
47
|
-
* The `null`-returning counterpart to `parseWire`. It lives here rather than in
|
|
48
|
-
* `wire.ts` because a nullable outcome is this family's convention, not the
|
|
49
|
-
* package's: every other wire parser throws.
|
|
50
|
-
*/
|
|
51
|
-
export declare function tryParseBundleManifestSidecar(schema: BundleManifestSidecarSchema, value: unknown): BundleManifestSidecar | null;
|
|
52
|
-
/**
|
|
53
|
-
* The two limits `serializeBundleManifest` refuses to encode past.
|
|
54
|
-
*
|
|
55
|
-
* Both arrays share the record-limit wording, and `exec` is declared first, so
|
|
56
|
-
* the shallowest-issue rule in `errorFromZod` reproduces the original
|
|
57
|
-
* `exec.length > max || symlinks.length > max` short-circuit. A too-long target
|
|
58
|
-
* sits two levels deeper and therefore still loses to either record limit,
|
|
59
|
-
* matching the order the guard clauses ran in.
|
|
60
|
-
*/
|
|
61
|
-
export declare function serializableBundleManifestSchema(maxRecords: number, maxSymlinkTargetLength: number): z.ZodMiniObject<{
|
|
62
|
-
exec: z.ZodMiniArray<z.ZodMiniUnknown>;
|
|
63
|
-
symlinks: z.ZodMiniArray<z.ZodMiniObject<{
|
|
64
|
-
target: z.ZodMiniString<string>;
|
|
65
|
-
}, z.core.$strip>>;
|
|
66
|
-
}, z.core.$strip>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schemas for the `.aexmeta.json` bundle fidelity sidecar.
|
|
3
|
-
*
|
|
4
|
-
* Two schemas, because the sidecar is read under different rules than it is
|
|
5
|
-
* written:
|
|
6
|
-
*
|
|
7
|
-
* - {@link bundleManifestSidecarSchema} gates bytes that arrived from an
|
|
8
|
-
* untrusted zip. It carries **no messages**: `tryParseBundleManifest` reports
|
|
9
|
-
* a rejected sidecar as `null`, never as a thrown diagnostic, and a message no
|
|
10
|
-
* caller can observe is a message that will drift.
|
|
11
|
-
* - {@link serializableBundleManifestSchema} gates a manifest on its way out and
|
|
12
|
-
* *does* throw, so it states exactly the two limits the serializer already
|
|
13
|
-
* enforced and nothing more. It deliberately does not re-validate the shape:
|
|
14
|
-
* its input is `BundleManifest`, and widening an output guard into a full
|
|
15
|
-
* structural check would reject values the type system already admitted.
|
|
16
|
-
*
|
|
17
|
-
* Both are factories over their limits rather than importers of them, so
|
|
18
|
-
* `bundle-manifest.ts` stays the single site that decides what the caps are and
|
|
19
|
-
* this module stays free of a cycle back into it.
|
|
20
|
-
*
|
|
21
|
-
* Neither schema is strict. An unknown key in a sidecar written by a newer SDK
|
|
22
|
-
* must be ignored, not rejected — that forward-compatibility is the whole point
|
|
23
|
-
* of the `v` field.
|
|
24
|
-
*/
|
|
25
|
-
import * as z from "zod/mini";
|
|
26
|
-
/**
|
|
27
|
-
* A v1 sidecar: `exec` paths and `symlinks` leaves, each array bounded before
|
|
28
|
-
* the graph that consumes it is built.
|
|
29
|
-
*
|
|
30
|
-
* An unknown `v` fails the literal and therefore yields `null`, which is the
|
|
31
|
-
* forward-compatible outcome: metadata is dropped and the restore proceeds
|
|
32
|
-
* content-only.
|
|
33
|
-
*/
|
|
34
|
-
export function bundleManifestSidecarSchema(maxRecords, maxSymlinkTargetLength) {
|
|
35
|
-
return z.object({
|
|
36
|
-
v: z.literal(1),
|
|
37
|
-
exec: z.array(z.string().check(z.minLength(1))).check(z.maxLength(maxRecords)),
|
|
38
|
-
symlinks: z
|
|
39
|
-
.array(z.object({
|
|
40
|
-
path: z.string().check(z.minLength(1)),
|
|
41
|
-
target: z.string().check(z.maxLength(maxSymlinkTargetLength))
|
|
42
|
-
}))
|
|
43
|
-
.check(z.maxLength(maxRecords))
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Parse a decoded sidecar value, collapsing every rejection to `null`.
|
|
48
|
-
*
|
|
49
|
-
* The `null`-returning counterpart to `parseWire`. It lives here rather than in
|
|
50
|
-
* `wire.ts` because a nullable outcome is this family's convention, not the
|
|
51
|
-
* package's: every other wire parser throws.
|
|
52
|
-
*/
|
|
53
|
-
export function tryParseBundleManifestSidecar(schema, value) {
|
|
54
|
-
const result = z.safeParse(schema, value);
|
|
55
|
-
return result.success ? result.data : null;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* The two limits `serializeBundleManifest` refuses to encode past.
|
|
59
|
-
*
|
|
60
|
-
* Both arrays share the record-limit wording, and `exec` is declared first, so
|
|
61
|
-
* the shallowest-issue rule in `errorFromZod` reproduces the original
|
|
62
|
-
* `exec.length > max || symlinks.length > max` short-circuit. A too-long target
|
|
63
|
-
* sits two levels deeper and therefore still loses to either record limit,
|
|
64
|
-
* matching the order the guard clauses ran in.
|
|
65
|
-
*/
|
|
66
|
-
export function serializableBundleManifestSchema(maxRecords, maxSymlinkTargetLength) {
|
|
67
|
-
const recordLimit = `bundle fidelity metadata exceeds the ${maxRecords}-record limit`;
|
|
68
|
-
const targetLimit = `bundle fidelity symlink target exceeds ${maxSymlinkTargetLength} characters`;
|
|
69
|
-
return z.object({
|
|
70
|
-
exec: z.array(z.unknown()).check(z.maxLength(maxRecords, { error: recordLimit })),
|
|
71
|
-
symlinks: z
|
|
72
|
-
.array(z.object({
|
|
73
|
-
target: z.string().check(z.maxLength(maxSymlinkTargetLength, { error: targetLimit }))
|
|
74
|
-
}))
|
|
75
|
-
.check(z.maxLength(maxRecords, { error: recordLimit }))
|
|
76
|
-
});
|
|
77
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire schemas, published as the supported validation surface.
|
|
3
|
-
*
|
|
4
|
-
* **Depend on `~standard`, not on Zod.** Every schema here implements
|
|
5
|
-
* [Standard Schema](https://standardschema.dev) v1, so a consumer can validate
|
|
6
|
-
* against it without importing — or agreeing with — our schema library:
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { SessionWebhookSchema } from "@aexhq/contracts";
|
|
10
|
-
*
|
|
11
|
-
* const result = await SessionWebhookSchema["~standard"].validate(input);
|
|
12
|
-
* if (result.issues) { /* … *\/ }
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* That indirection is what keeps the choice of Zod reversible: if it is ever
|
|
16
|
-
* replaced, the published interface does not move — only what sits behind
|
|
17
|
-
* `~standard` does.
|
|
18
|
-
*
|
|
19
|
-
* These schemas follow the same semver contract as the exported types: widening
|
|
20
|
-
* one is a minor, tightening one is a breaking change.
|
|
21
|
-
*
|
|
22
|
-
* Note for tooling authors: `~standard.jsonSchema` is **absent** here. These are
|
|
23
|
-
* `zod/mini` schemas and the JSON Schema converter is tree-shaken out of that
|
|
24
|
-
* entrypoint. JSON Schema conversion is a build-time concern — the OpenAPI
|
|
25
|
-
* generator imports full `zod` off these same objects, which works because both
|
|
26
|
-
* entrypoints construct the same core classes.
|
|
27
|
-
*/
|
|
28
|
-
export { SessionWebhookSchema } from "./session-webhook.js";
|
|
29
|
-
export { SessionLimitsSchema, normalizeSessionLimits } from "./session-limits.js";
|
|
30
|
-
export type { SessionLimitsWire } from "./session-limits.js";
|
|
31
|
-
export { SessionMachineSchema, normalizeSessionMachine } from "./session-machine.js";
|
|
32
|
-
export type { SessionMachineWire } from "./session-machine.js";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire schemas, published as the supported validation surface.
|
|
3
|
-
*
|
|
4
|
-
* **Depend on `~standard`, not on Zod.** Every schema here implements
|
|
5
|
-
* [Standard Schema](https://standardschema.dev) v1, so a consumer can validate
|
|
6
|
-
* against it without importing — or agreeing with — our schema library:
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { SessionWebhookSchema } from "@aexhq/contracts";
|
|
10
|
-
*
|
|
11
|
-
* const result = await SessionWebhookSchema["~standard"].validate(input);
|
|
12
|
-
* if (result.issues) { /* … *\/ }
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* That indirection is what keeps the choice of Zod reversible: if it is ever
|
|
16
|
-
* replaced, the published interface does not move — only what sits behind
|
|
17
|
-
* `~standard` does.
|
|
18
|
-
*
|
|
19
|
-
* These schemas follow the same semver contract as the exported types: widening
|
|
20
|
-
* one is a minor, tightening one is a breaking change.
|
|
21
|
-
*
|
|
22
|
-
* Note for tooling authors: `~standard.jsonSchema` is **absent** here. These are
|
|
23
|
-
* `zod/mini` schemas and the JSON Schema converter is tree-shaken out of that
|
|
24
|
-
* entrypoint. JSON Schema conversion is a build-time concern — the OpenAPI
|
|
25
|
-
* generator imports full `zod` off these same objects, which works because both
|
|
26
|
-
* entrypoints construct the same core classes.
|
|
27
|
-
*/
|
|
28
|
-
export { SessionWebhookSchema } from "./session-webhook.js";
|
|
29
|
-
export { SessionLimitsSchema, normalizeSessionLimits } from "./session-limits.js";
|
|
30
|
-
export { SessionMachineSchema, normalizeSessionMachine } from "./session-machine.js";
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schemas for the two MCP server declarations on the request side: the
|
|
3
|
-
* non-secret `McpServerRef` that enters the hashed submission, and the
|
|
4
|
-
* `SessionConfigMcpServer` a `session.json` may carry with inline `headers`.
|
|
5
|
-
*
|
|
6
|
-
* Two rules are DEFERRED BACK to `session-config.ts` through {@link McpWirePolicy}
|
|
7
|
-
* rather than moved here, and that is deliberate:
|
|
8
|
-
* `scripts/cicd/check-parser-ratchet.mjs`'s sibling gate
|
|
9
|
-
* `scripts/cicd/check-contract-parity.mjs` locates the SSRF host deny-list
|
|
10
|
-
* inside `session-config.ts` — it slices the file from `denyReasonForHostIp` to
|
|
11
|
-
* `parseRemoteMcpTransport` and byte-compares that region against
|
|
12
|
-
* `platform/packages/shared/src/blueprint.ts`. Moving either function here would
|
|
13
|
-
* break the only cross-repo check that keeps the two deny-lists identical, so
|
|
14
|
-
* the schema takes them as parameters instead.
|
|
15
|
-
*/
|
|
16
|
-
import * as z from "zod/mini";
|
|
17
|
-
import type { McpServerRef, RemoteMcpTransport, SessionConfigMcpServer } from "../session-config.js";
|
|
18
|
-
export declare const MCP_SERVER_NAME_PATTERN: RegExp;
|
|
19
|
-
/**
|
|
20
|
-
* Canonical error string for any attempt to declare a stdio-shaped MCP
|
|
21
|
-
* server (`transport: "stdio"`, or a stdio-only field like `command` /
|
|
22
|
-
* `args` / `env`). Pinned in source so every surface — shared parser,
|
|
23
|
-
* SDK builder, CLI flag parser, dashboard form — surfaces the same
|
|
24
|
-
* message and a user can find it via grep.
|
|
25
|
-
*/
|
|
26
|
-
export declare const REMOTE_MCP_STDIO_REJECTED_MESSAGE = "stdio MCP servers are not supported by Aex. Aex supports remote MCP servers over HTTP/SSE only.";
|
|
27
|
-
/**
|
|
28
|
-
* The host and transport rules the MCP schemas defer to.
|
|
29
|
-
*
|
|
30
|
-
* See the module header for why these are injected rather than imported.
|
|
31
|
-
*/
|
|
32
|
-
export interface McpWirePolicy {
|
|
33
|
-
/** Reason this URL's host must be refused, or `null` when it is acceptable. */
|
|
34
|
-
readonly denyReasonForHost: (url: URL) => string | null;
|
|
35
|
-
/** Throws when `input` is neither absent nor a supported remote transport. */
|
|
36
|
-
readonly parseTransport: (input: unknown, field: string) => RemoteMcpTransport | undefined;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A remote-only precondition on any MCP declaration, whatever else is wrong
|
|
40
|
-
* with it.
|
|
41
|
-
*
|
|
42
|
-
* Deliberately its own schema, parsed BEFORE the strict object rather than
|
|
43
|
-
* carried on it as a `.check()`. Zod raises `unrecognized_keys` while parsing
|
|
44
|
-
* the object body and skips the object's own checks once the body has issues
|
|
45
|
-
* (measured), and `errorFromZod` ranks a rejected key ahead of every other issue
|
|
46
|
-
* at the same depth — so no rule expressed on the object can outrank an unknown
|
|
47
|
-
* key. `{ command: "local", unknown: true }` must report stdio, not `unknown`,
|
|
48
|
-
* which is exactly the sequencing the hand-written parser had: reject the stdio
|
|
49
|
-
* shape, then apply the allow-list.
|
|
50
|
-
*/
|
|
51
|
-
export declare const RemoteMcpShapeSchema: z.ZodMiniUnknown;
|
|
52
|
-
/**
|
|
53
|
-
* Throw the canonical stdio-rejected error if the record carries any
|
|
54
|
-
* stdio-only marker (`transport: "stdio"`, `command`, `args`, `env`).
|
|
55
|
-
* Used by both the shared parser and the SDK `McpServer.remote`
|
|
56
|
-
* builder so every entry point surfaces the same message.
|
|
57
|
-
*/
|
|
58
|
-
export declare function rejectStdioMcpShape(record: Record<string, unknown>): void;
|
|
59
|
-
/**
|
|
60
|
-
* Wire shape of the NON-SECRET half of an MCP server declaration.
|
|
61
|
-
*
|
|
62
|
-
* Headers belong on `SessionConfigMcpServer`, and the wire
|
|
63
|
-
* `submission.mcpServers` must NEVER contain them, so anything other than
|
|
64
|
-
* `{name, url, transport}` is rejected explicitly — a caller accidentally
|
|
65
|
-
* inlining `headers` into the non-secret half fails loudly instead of having the
|
|
66
|
-
* field silently dropped.
|
|
67
|
-
*/
|
|
68
|
-
export declare function mcpServerRefSchema(path: string, policy: McpWirePolicy): z.ZodMiniObject<{
|
|
69
|
-
name: z.ZodMiniString<string>;
|
|
70
|
-
url: z.ZodMiniString<string>;
|
|
71
|
-
transport: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
72
|
-
}, z.core.$strict>;
|
|
73
|
-
/**
|
|
74
|
-
* Wire shape of a session-config MCP entry: the non-secret ref plus the inline
|
|
75
|
-
* `headers` the SDK splits out at submission time, so config loaded from
|
|
76
|
-
* `--config session.json` cannot smuggle unrelated fields past the parser.
|
|
77
|
-
*/
|
|
78
|
-
export declare function sessionConfigMcpServerSchema(path: string, policy: McpWirePolicy): z.ZodMiniObject<{
|
|
79
|
-
name: z.ZodMiniString<string>;
|
|
80
|
-
url: z.ZodMiniString<string>;
|
|
81
|
-
transport: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
82
|
-
headers: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
83
|
-
}, z.core.$strict>;
|
|
84
|
-
export type McpServerRefWire = z.infer<ReturnType<typeof mcpServerRefSchema>>;
|
|
85
|
-
export type SessionConfigMcpServerWire = z.infer<ReturnType<typeof sessionConfigMcpServerSchema>>;
|
|
86
|
-
/** Reject a stdio shape, then validate the non-secret ref mounted at `path`. */
|
|
87
|
-
export declare function parseMcpServerRefWire(input: unknown, path: string, policy: McpWirePolicy): McpServerRefWire;
|
|
88
|
-
/** Reject a stdio shape, then validate a session-config entry mounted at `path`. */
|
|
89
|
-
export declare function parseSessionConfigMcpServerWire(input: unknown, path: string, policy: McpWirePolicy): SessionConfigMcpServerWire;
|
|
90
|
-
/**
|
|
91
|
-
* Drop an absent `transport` so an omitted field never lands as an explicit
|
|
92
|
-
* `undefined` on the hashed payload.
|
|
93
|
-
*
|
|
94
|
-
* Separate from the schema per D4 — see
|
|
95
|
-
* {@link import("./asset-ref.js").normalizeAssetRef}.
|
|
96
|
-
*/
|
|
97
|
-
export declare function normalizeMcpServerRef(wire: McpServerRefWire): McpServerRef;
|
|
98
|
-
/** As {@link normalizeMcpServerRef}, preserving inline `headers` when supplied. */
|
|
99
|
-
export declare function normalizeSessionConfigMcpServer(wire: SessionConfigMcpServerWire): SessionConfigMcpServer;
|