@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,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the per-session lineage-limit override.
|
|
3
|
-
*
|
|
4
|
-
* A SHAPE/positivity gate only. Clamping to the workspace and platform ceilings
|
|
5
|
-
* is the resolver's job (`resolveSessionLimits` in `@aexhq/shared`) and must not
|
|
6
|
-
* migrate here — a schema that clamped would silently change a caller's request
|
|
7
|
-
* instead of describing it.
|
|
8
|
-
*/
|
|
9
|
-
import * as z from "zod/mini";
|
|
10
|
-
import { type Present } from "./wire.js";
|
|
11
|
-
/**
|
|
12
|
-
* Wire shape of `limits`. Declaration order is the permitted-key order reported
|
|
13
|
-
* on an unknown field, and the order {@link normalizeSessionLimits} emits.
|
|
14
|
-
*/
|
|
15
|
-
export declare const SessionLimitsSchema: z.ZodMiniObject<{
|
|
16
|
-
maxConcurrentChildSessions: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
17
|
-
maxSubagentDepth: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
18
|
-
maxSpendUsd: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
19
|
-
maxTurns: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
20
|
-
maxStepsPerTurn: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
21
|
-
}, z.core.$strict>;
|
|
22
|
-
export type SessionLimitsWire = z.infer<typeof SessionLimitsSchema>;
|
|
23
|
-
/**
|
|
24
|
-
* Collapse a no-signal override to `undefined` and drop absent fields.
|
|
25
|
-
*
|
|
26
|
-
* Deliberately NOT a `.transform()` on the schema: `z.toJSONSchema(s, {io:"output"})`
|
|
27
|
-
* throws on any transform, which would make the response half of the generated
|
|
28
|
-
* spec ungenerable (L1). Schemas validate; `normalize*()` functions transform.
|
|
29
|
-
*
|
|
30
|
-
* `limits: {}` carries no more signal than an absent `limits`, and landing an
|
|
31
|
-
* empty object on the request would make the two distinguishable downstream for
|
|
32
|
-
* no reason. The resolver supplies platform defaults for every absent field.
|
|
33
|
-
*/
|
|
34
|
-
export declare function normalizeSessionLimits(limits: SessionLimitsWire): Present<SessionLimitsWire> | undefined;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the per-session lineage-limit override.
|
|
3
|
-
*
|
|
4
|
-
* A SHAPE/positivity gate only. Clamping to the workspace and platform ceilings
|
|
5
|
-
* is the resolver's job (`resolveSessionLimits` in `@aexhq/shared`) and must not
|
|
6
|
-
* migrate here — a schema that clamped would silently change a caller's request
|
|
7
|
-
* instead of describing it.
|
|
8
|
-
*/
|
|
9
|
-
import * as z from "zod/mini";
|
|
10
|
-
import { positiveInt, positiveNumber } from "./numeric.js";
|
|
11
|
-
import { wireObject } from "./wire.js";
|
|
12
|
-
/**
|
|
13
|
-
* Wire shape of `limits`. Declaration order is the permitted-key order reported
|
|
14
|
-
* on an unknown field, and the order {@link normalizeSessionLimits} emits.
|
|
15
|
-
*/
|
|
16
|
-
export const SessionLimitsSchema = wireObject("limits", {
|
|
17
|
-
maxConcurrentChildSessions: z.optional(positiveInt("limits.maxConcurrentChildSessions")),
|
|
18
|
-
maxSubagentDepth: z.optional(positiveInt("limits.maxSubagentDepth")),
|
|
19
|
-
maxSpendUsd: z.optional(positiveNumber("limits.maxSpendUsd")),
|
|
20
|
-
maxTurns: z.optional(positiveInt("limits.maxTurns")),
|
|
21
|
-
maxStepsPerTurn: z.optional(positiveInt("limits.maxStepsPerTurn"))
|
|
22
|
-
});
|
|
23
|
-
/**
|
|
24
|
-
* Collapse a no-signal override to `undefined` and drop absent fields.
|
|
25
|
-
*
|
|
26
|
-
* Deliberately NOT a `.transform()` on the schema: `z.toJSONSchema(s, {io:"output"})`
|
|
27
|
-
* throws on any transform, which would make the response half of the generated
|
|
28
|
-
* spec ungenerable (L1). Schemas validate; `normalize*()` functions transform.
|
|
29
|
-
*
|
|
30
|
-
* `limits: {}` carries no more signal than an absent `limits`, and landing an
|
|
31
|
-
* empty object on the request would make the two distinguishable downstream for
|
|
32
|
-
* no reason. The resolver supplies platform defaults for every absent field.
|
|
33
|
-
*/
|
|
34
|
-
export function normalizeSessionLimits(limits) {
|
|
35
|
-
const present = Object.entries(limits).filter(([, value]) => value !== undefined);
|
|
36
|
-
return present.length === 0
|
|
37
|
-
? undefined
|
|
38
|
-
: Object.fromEntries(present);
|
|
39
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the per-session capacity intent.
|
|
3
|
-
*
|
|
4
|
-
* Intent only — the managed runtime selects capacity from it. `spot: true` opts
|
|
5
|
-
* into interruptible capacity; absent or `false` requests standard capacity.
|
|
6
|
-
*/
|
|
7
|
-
import * as z from "zod/mini";
|
|
8
|
-
import { type Present } from "./wire.js";
|
|
9
|
-
/** Wire shape of `machine`. */
|
|
10
|
-
export declare const SessionMachineSchema: z.ZodMiniObject<{
|
|
11
|
-
spot: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
12
|
-
}, z.core.$strict>;
|
|
13
|
-
export type SessionMachineWire = z.infer<typeof SessionMachineSchema>;
|
|
14
|
-
/**
|
|
15
|
-
* Collapse a no-signal object (`machine: {}`) to `undefined`; preserve an
|
|
16
|
-
* explicit `spot`, including `false`.
|
|
17
|
-
*
|
|
18
|
-
* Separate from the schema for the same reason as the sibling limits
|
|
19
|
-
* normaliser — see {@link import("./session-limits.js").normalizeSessionLimits}.
|
|
20
|
-
* `false` is signal here: it is a caller explicitly declining interruptible
|
|
21
|
-
* capacity, which is not the same as not having asked.
|
|
22
|
-
*/
|
|
23
|
-
export declare function normalizeSessionMachine(machine: SessionMachineWire): Present<SessionMachineWire> | undefined;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the per-session capacity intent.
|
|
3
|
-
*
|
|
4
|
-
* Intent only — the managed runtime selects capacity from it. `spot: true` opts
|
|
5
|
-
* into interruptible capacity; absent or `false` requests standard capacity.
|
|
6
|
-
*/
|
|
7
|
-
import * as z from "zod/mini";
|
|
8
|
-
import { wireObject } from "./wire.js";
|
|
9
|
-
/** Wire shape of `machine`. */
|
|
10
|
-
export const SessionMachineSchema = wireObject("machine", {
|
|
11
|
-
spot: z.optional(z.boolean({ error: "machine.spot must be a boolean" }))
|
|
12
|
-
});
|
|
13
|
-
/**
|
|
14
|
-
* Collapse a no-signal object (`machine: {}`) to `undefined`; preserve an
|
|
15
|
-
* explicit `spot`, including `false`.
|
|
16
|
-
*
|
|
17
|
-
* Separate from the schema for the same reason as the sibling limits
|
|
18
|
-
* normaliser — see {@link import("./session-limits.js").normalizeSessionLimits}.
|
|
19
|
-
* `false` is signal here: it is a caller explicitly declining interruptible
|
|
20
|
-
* capacity, which is not the same as not having asked.
|
|
21
|
-
*/
|
|
22
|
-
export function normalizeSessionMachine(machine) {
|
|
23
|
-
return machine.spot === undefined ? undefined : { spot: machine.spot };
|
|
24
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the plain JSON `aex start --config <path>` accepts: the
|
|
3
|
-
* credential-free session parameters the CLI folds into a normal `submit`.
|
|
4
|
-
*
|
|
5
|
-
* Every message this family raises is prefixed with the words
|
|
6
|
-
* `session request config` rather than a dotted path, because that is what a
|
|
7
|
-
* user editing a `session.json` sees. The prefix is the schema's mount path, so
|
|
8
|
-
* `wireObject`'s default `notObject` wording already reads correctly.
|
|
9
|
-
*/
|
|
10
|
-
import * as z from "zod/mini";
|
|
11
|
-
import type { SessionConfigMcpServer, SessionRequestConfig } from "../session-config.js";
|
|
12
|
-
import { type McpWirePolicy } from "./mcp-server.js";
|
|
13
|
-
/**
|
|
14
|
-
* Wire shape of a session request config. Declaration order is both the
|
|
15
|
-
* permitted-key order and the order the field checks report in, matching the
|
|
16
|
-
* sequential model/system/prompt/mcpServers ladder this replaces.
|
|
17
|
-
*
|
|
18
|
-
* `mcpServers` is declared as a bare array here and its entries are validated by
|
|
19
|
-
* {@link parseSessionConfigMcpServers} — see that function for why the entries
|
|
20
|
-
* cannot be an element schema.
|
|
21
|
-
*/
|
|
22
|
-
export declare const SessionRequestConfigSchema: z.ZodMiniObject<{
|
|
23
|
-
model: z.ZodMiniString<string>;
|
|
24
|
-
system: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
25
|
-
prompt: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>;
|
|
26
|
-
mcpServers: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnknown>>;
|
|
27
|
-
environment: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
28
|
-
runtimeSize: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
29
|
-
timeout: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
30
|
-
metadata: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
31
|
-
}, z.core.$strict>;
|
|
32
|
-
export type SessionRequestConfigWire = z.infer<typeof SessionRequestConfigSchema>;
|
|
33
|
-
/**
|
|
34
|
-
* Validate each MCP entry at its own indexed path, in order, and reject a
|
|
35
|
-
* repeated name.
|
|
36
|
-
*
|
|
37
|
-
* A loop rather than `z.array(sessionConfigMcpServerSchema(...))` because each
|
|
38
|
-
* entry's stdio rejection has to outrank that entry's own unknown-key error, and
|
|
39
|
-
* inside a single parse it cannot: Zod raises `unrecognized_keys` during the
|
|
40
|
-
* object body and `errorFromZod` ranks it ahead of everything else at the same
|
|
41
|
-
* depth. Sequencing the stdio gate and the object parse per entry is what the
|
|
42
|
-
* hand-written parser did, and it is the only place that precedence can be
|
|
43
|
-
* expressed — see {@link import("./mcp-server.js").RemoteMcpShapeSchema}.
|
|
44
|
-
*/
|
|
45
|
-
export declare function parseSessionConfigMcpServers(entries: readonly unknown[] | undefined, policy: McpWirePolicy): readonly SessionConfigMcpServer[] | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Drop the absent optional fields and restore the declared field order.
|
|
48
|
-
*
|
|
49
|
-
* Separate from the schema per D4 — see
|
|
50
|
-
* {@link import("./asset-ref.js").normalizeAssetRef}. Named for the wire type it
|
|
51
|
-
* consumes so it is not confused with the public
|
|
52
|
-
* `normaliseSessionRequestConfig`, which is a different operation: that one
|
|
53
|
-
* splits a parsed config into the non-secret submission and the secret
|
|
54
|
-
* MCP-headers bundle.
|
|
55
|
-
*/
|
|
56
|
-
export declare function normalizeSessionRequestConfigWire(wire: SessionRequestConfigWire, mcpServers: readonly SessionConfigMcpServer[] | undefined): SessionRequestConfig;
|
|
57
|
-
/** Validate a session request config end to end, in the family's own words. */
|
|
58
|
-
export declare function parseSessionRequestConfigWire(input: unknown, policy: McpWirePolicy): SessionRequestConfig;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the plain JSON `aex start --config <path>` accepts: the
|
|
3
|
-
* credential-free session parameters the CLI folds into a normal `submit`.
|
|
4
|
-
*
|
|
5
|
-
* Every message this family raises is prefixed with the words
|
|
6
|
-
* `session request config` rather than a dotted path, because that is what a
|
|
7
|
-
* user editing a `session.json` sees. The prefix is the schema's mount path, so
|
|
8
|
-
* `wireObject`'s default `notObject` wording already reads correctly.
|
|
9
|
-
*/
|
|
10
|
-
import * as z from "zod/mini";
|
|
11
|
-
import { modelSlugSchema } from "./models.js";
|
|
12
|
-
import { normalizeSessionConfigMcpServer, parseSessionConfigMcpServerWire } from "./mcp-server.js";
|
|
13
|
-
import { parseWire, wireObject } from "./wire.js";
|
|
14
|
-
const CONFIG = "session request config";
|
|
15
|
-
/**
|
|
16
|
-
* `environment`, `runtimeSize`, `timeout` and `metadata` are carried through
|
|
17
|
-
* unvalidated ON PURPOSE: the BFF revalidates them via
|
|
18
|
-
* `parseSessionSubmissionRequest`, and duplicating those parsers here would be a
|
|
19
|
-
* second source of truth for the same rules. The CLI surfaces their structural
|
|
20
|
-
* errors at submission time instead. They are untyped in the generated document
|
|
21
|
-
* as a result — a known gap, not a described one.
|
|
22
|
-
*/
|
|
23
|
-
const passthrough = z.optional(z.unknown());
|
|
24
|
-
/**
|
|
25
|
-
* The prompt ladder, stated once and reported for every rejected shape.
|
|
26
|
-
*
|
|
27
|
-
* The array case names the offending index, which the union's branch issues
|
|
28
|
-
* cannot, so the wording is derived from the input here rather than attached to
|
|
29
|
-
* the branches.
|
|
30
|
-
*/
|
|
31
|
-
function promptMessage(value) {
|
|
32
|
-
if (typeof value === "string") {
|
|
33
|
-
return `${CONFIG} prompt must be a non-empty string`;
|
|
34
|
-
}
|
|
35
|
-
if (Array.isArray(value)) {
|
|
36
|
-
const index = value.findIndex((item) => typeof item !== "string" || item.length === 0);
|
|
37
|
-
return index === -1
|
|
38
|
-
? `${CONFIG} prompt must be a non-empty string or array of strings`
|
|
39
|
-
: `${CONFIG} prompt[${index}] must be a non-empty string`;
|
|
40
|
-
}
|
|
41
|
-
return `${CONFIG} prompt must be a string or array of strings`;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* One turn, or an ordered list of them.
|
|
45
|
-
*
|
|
46
|
-
* Every branch check aborts. That is load-bearing: Zod surfaces a single
|
|
47
|
-
* branch's issues when exactly one branch fails non-abortively, and the union's
|
|
48
|
-
* own `error` only when they all abort (measured). Aborting throughout makes
|
|
49
|
-
* {@link promptMessage} the reported wording in every case.
|
|
50
|
-
*/
|
|
51
|
-
const prompt = z.union([
|
|
52
|
-
z.string().check(z.minLength(1, { abort: true })),
|
|
53
|
-
z.array(z.string().check(z.minLength(1, { abort: true }))).check(z.minLength(1, { abort: true }))
|
|
54
|
-
], { error: (issue) => promptMessage(issue.input) });
|
|
55
|
-
/**
|
|
56
|
-
* Wire shape of a session request config. Declaration order is both the
|
|
57
|
-
* permitted-key order and the order the field checks report in, matching the
|
|
58
|
-
* sequential model/system/prompt/mcpServers ladder this replaces.
|
|
59
|
-
*
|
|
60
|
-
* `mcpServers` is declared as a bare array here and its entries are validated by
|
|
61
|
-
* {@link parseSessionConfigMcpServers} — see that function for why the entries
|
|
62
|
-
* cannot be an element schema.
|
|
63
|
-
*/
|
|
64
|
-
export const SessionRequestConfigSchema = wireObject(CONFIG, {
|
|
65
|
-
model: modelSlugSchema(`${CONFIG} model`),
|
|
66
|
-
system: z.optional(z.string({ error: `${CONFIG} system, when provided, must be a string` })),
|
|
67
|
-
prompt,
|
|
68
|
-
mcpServers: z.optional(z.array(z.unknown(), { error: `${CONFIG} mcpServers must be an array` })),
|
|
69
|
-
environment: passthrough,
|
|
70
|
-
runtimeSize: passthrough,
|
|
71
|
-
timeout: passthrough,
|
|
72
|
-
metadata: passthrough
|
|
73
|
-
}, { unknownKey: (path, key) => `${path} contains unexpected field: ${key}` });
|
|
74
|
-
/**
|
|
75
|
-
* Validate each MCP entry at its own indexed path, in order, and reject a
|
|
76
|
-
* repeated name.
|
|
77
|
-
*
|
|
78
|
-
* A loop rather than `z.array(sessionConfigMcpServerSchema(...))` because each
|
|
79
|
-
* entry's stdio rejection has to outrank that entry's own unknown-key error, and
|
|
80
|
-
* inside a single parse it cannot: Zod raises `unrecognized_keys` during the
|
|
81
|
-
* object body and `errorFromZod` ranks it ahead of everything else at the same
|
|
82
|
-
* depth. Sequencing the stdio gate and the object parse per entry is what the
|
|
83
|
-
* hand-written parser did, and it is the only place that precedence can be
|
|
84
|
-
* expressed — see {@link import("./mcp-server.js").RemoteMcpShapeSchema}.
|
|
85
|
-
*/
|
|
86
|
-
export function parseSessionConfigMcpServers(entries, policy) {
|
|
87
|
-
if (entries === undefined) {
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
const seen = new Set();
|
|
91
|
-
return entries.map((item, index) => {
|
|
92
|
-
const entry = normalizeSessionConfigMcpServer(parseSessionConfigMcpServerWire(item, `${CONFIG} mcpServers[${index}]`, policy));
|
|
93
|
-
if (seen.has(entry.name)) {
|
|
94
|
-
throw new Error(`${CONFIG} mcpServers duplicate name: ${entry.name}`);
|
|
95
|
-
}
|
|
96
|
-
seen.add(entry.name);
|
|
97
|
-
return entry;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Drop the absent optional fields and restore the declared field order.
|
|
102
|
-
*
|
|
103
|
-
* Separate from the schema per D4 — see
|
|
104
|
-
* {@link import("./asset-ref.js").normalizeAssetRef}. Named for the wire type it
|
|
105
|
-
* consumes so it is not confused with the public
|
|
106
|
-
* `normaliseSessionRequestConfig`, which is a different operation: that one
|
|
107
|
-
* splits a parsed config into the non-secret submission and the secret
|
|
108
|
-
* MCP-headers bundle.
|
|
109
|
-
*/
|
|
110
|
-
export function normalizeSessionRequestConfigWire(wire, mcpServers) {
|
|
111
|
-
return {
|
|
112
|
-
model: wire.model,
|
|
113
|
-
...(wire.system !== undefined ? { system: wire.system } : {}),
|
|
114
|
-
prompt: wire.prompt,
|
|
115
|
-
...(mcpServers !== undefined ? { mcpServers } : {}),
|
|
116
|
-
...(wire.environment !== undefined
|
|
117
|
-
? { environment: wire.environment }
|
|
118
|
-
: {}),
|
|
119
|
-
...(wire.runtimeSize !== undefined
|
|
120
|
-
? { runtimeSize: wire.runtimeSize }
|
|
121
|
-
: {}),
|
|
122
|
-
...(wire.timeout !== undefined
|
|
123
|
-
? { timeout: wire.timeout }
|
|
124
|
-
: {}),
|
|
125
|
-
...(wire.metadata !== undefined
|
|
126
|
-
? { metadata: wire.metadata }
|
|
127
|
-
: {})
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/** Validate a session request config end to end, in the family's own words. */
|
|
131
|
-
export function parseSessionRequestConfigWire(input, policy) {
|
|
132
|
-
const wire = parseWire(SessionRequestConfigSchema, input);
|
|
133
|
-
return normalizeSessionRequestConfigWire(wire, parseSessionConfigMcpServers(wire.mcpServers, policy));
|
|
134
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the per-session run-callback registration.
|
|
3
|
-
*
|
|
4
|
-
* Submit-time shape gate only. Delivery-time re-resolution and IP-deny checks
|
|
5
|
-
* live server-side; this rejects the URLs that must never reach that stage.
|
|
6
|
-
*/
|
|
7
|
-
import * as z from "zod/mini";
|
|
8
|
-
/** Wire shape of `webhook` on a session submission request. */
|
|
9
|
-
export declare const SessionWebhookSchema: z.ZodMiniObject<{
|
|
10
|
-
url: z.ZodMiniString<string>;
|
|
11
|
-
}, z.core.$strict>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema for the per-session run-callback registration.
|
|
3
|
-
*
|
|
4
|
-
* Submit-time shape gate only. Delivery-time re-resolution and IP-deny checks
|
|
5
|
-
* live server-side; this rejects the URLs that must never reach that stage.
|
|
6
|
-
*/
|
|
7
|
-
import * as z from "zod/mini";
|
|
8
|
-
import { wireObject } from "./wire.js";
|
|
9
|
-
function toUrl(value) {
|
|
10
|
-
try {
|
|
11
|
-
return new URL(value);
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* An https callback URL with no userinfo — credentials must not ride in a URL
|
|
19
|
-
* the platform stores and later replays.
|
|
20
|
-
*
|
|
21
|
-
* Each check aborts so the reported failure is the first one a reader would
|
|
22
|
-
* hit, matching the sequential `new URL()` / protocol / userinfo ladder this
|
|
23
|
-
* replaces.
|
|
24
|
-
*/
|
|
25
|
-
const callbackUrl = z
|
|
26
|
-
.string({ error: "webhook.url must be a non-empty string" })
|
|
27
|
-
.check(z.minLength(1, { error: "webhook.url must be a non-empty string", abort: true }), z.refine((value) => toUrl(value) !== undefined, {
|
|
28
|
-
error: (issue) => `webhook.url must be a valid absolute URL (got ${JSON.stringify(issue.input)})`,
|
|
29
|
-
abort: true
|
|
30
|
-
}), z.refine((value) => toUrl(value)?.protocol === "https:", {
|
|
31
|
-
error: (issue) => `webhook.url must use https (got ${toUrl(issue.input)?.protocol.replace(/:$/, "") ?? ""})`,
|
|
32
|
-
abort: true
|
|
33
|
-
}), z.refine((value) => {
|
|
34
|
-
const url = toUrl(value);
|
|
35
|
-
return url?.username === "" && url.password === "";
|
|
36
|
-
}, { error: "webhook.url must not contain userinfo (user:pass@host)", abort: true }));
|
|
37
|
-
/** Wire shape of `webhook` on a session submission request. */
|
|
38
|
-
export const SessionWebhookSchema = wireObject("webhook", { url: callbackUrl });
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schemas for the side-effect audit metadata envelope.
|
|
3
|
-
*
|
|
4
|
-
* Audit records are published to consumers that must never see request bodies,
|
|
5
|
-
* raw URLs, or identity, so the envelope is a closed set of containers rather
|
|
6
|
-
* than free-form metadata. These schemas are that closed set: the shape of each
|
|
7
|
-
* one *is* the supported field list it rejects against.
|
|
8
|
-
*
|
|
9
|
-
* Two rules keep the schemas honest about what they do not cover:
|
|
10
|
-
*
|
|
11
|
-
* - **The public-safety scan stays outside.** It raises
|
|
12
|
-
* `SideEffectAuditRedactionError`, a typed error carrying `findings` that
|
|
13
|
-
* callers catch by class, which a schema cannot produce. `../side-effect-audit.ts`
|
|
14
|
-
* scans the whole payload before parsing it and again after building it.
|
|
15
|
-
* - **`counts` and `timestamps` are described as opaque here.** Their keys come
|
|
16
|
-
* from `SIDE_EFFECT_AUDIT_COUNT_NAMES` / `…_TIMESTAMP_NAMES`, which are
|
|
17
|
-
* already the single source of that list; importing them would close an
|
|
18
|
-
* import cycle, and their entries are still checked by the normalisers that
|
|
19
|
-
* own those lists.
|
|
20
|
-
*/
|
|
21
|
-
import * as z from "zod/mini";
|
|
22
|
-
/** Wire shape of `metadata.status`. */
|
|
23
|
-
export declare const SideEffectAuditStatusMetadataSchema: z.ZodMiniObject<{
|
|
24
|
-
status: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
25
|
-
statusCode: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
26
|
-
errorClass: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
27
|
-
denialReason: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
28
|
-
followUpRequired: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
29
|
-
}, z.core.$strict>;
|
|
30
|
-
/** Wire shape of `metadata.dimensions`. */
|
|
31
|
-
export declare const SideEffectAuditDimensionsMetadataSchema: z.ZodMiniObject<{
|
|
32
|
-
provider: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
33
|
-
namespace: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
34
|
-
metadata: "metadata";
|
|
35
|
-
files: "files";
|
|
36
|
-
archive: "archive";
|
|
37
|
-
events: "events";
|
|
38
|
-
logs: "logs";
|
|
39
|
-
}>>;
|
|
40
|
-
method: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
41
|
-
GET: "GET";
|
|
42
|
-
POST: "POST";
|
|
43
|
-
PATCH: "PATCH";
|
|
44
|
-
DELETE: "DELETE";
|
|
45
|
-
PUT: "PUT";
|
|
46
|
-
}>>;
|
|
47
|
-
surface: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
|
-
/**
|
|
50
|
-
* Wire shape of `metadata` on a deletion action.
|
|
51
|
-
*
|
|
52
|
-
* Deletion audits are the record of data going away and are read after the
|
|
53
|
-
* session they describe no longer exists, so they carry no `dimensions`: the
|
|
54
|
-
* provider, namespace, method, and surface of the call are exactly the detail a
|
|
55
|
-
* deletion record must not preserve. The full envelope below adds that
|
|
56
|
-
* container back rather than either shape restating the shared three.
|
|
57
|
-
*/
|
|
58
|
-
export declare const SideEffectAuditDeletionMetadataSchema: z.ZodMiniObject<{
|
|
59
|
-
status: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
60
|
-
status: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
61
|
-
statusCode: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
62
|
-
errorClass: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
63
|
-
denialReason: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
64
|
-
followUpRequired: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
65
|
-
}, z.core.$strict>>;
|
|
66
|
-
counts: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
67
|
-
timestamps: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
68
|
-
}, z.core.$strict>;
|
|
69
|
-
/** Wire shape of `metadata` on every other action. */
|
|
70
|
-
export declare const SideEffectAuditMetadataSchema: z.ZodMiniObject<{
|
|
71
|
-
dimensions: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
72
|
-
provider: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
73
|
-
namespace: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
74
|
-
metadata: "metadata";
|
|
75
|
-
files: "files";
|
|
76
|
-
archive: "archive";
|
|
77
|
-
events: "events";
|
|
78
|
-
logs: "logs";
|
|
79
|
-
}>>;
|
|
80
|
-
method: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
81
|
-
GET: "GET";
|
|
82
|
-
POST: "POST";
|
|
83
|
-
PATCH: "PATCH";
|
|
84
|
-
DELETE: "DELETE";
|
|
85
|
-
PUT: "PUT";
|
|
86
|
-
}>>;
|
|
87
|
-
surface: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
88
|
-
}, z.core.$strict>>;
|
|
89
|
-
status: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
90
|
-
status: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
91
|
-
statusCode: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
92
|
-
errorClass: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
93
|
-
denialReason: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
94
|
-
followUpRequired: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
95
|
-
}, z.core.$strict>>;
|
|
96
|
-
counts: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
97
|
-
timestamps: z.ZodMiniOptional<z.ZodMiniUnknown>;
|
|
98
|
-
}, z.core.$strict>;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schemas for the side-effect audit metadata envelope.
|
|
3
|
-
*
|
|
4
|
-
* Audit records are published to consumers that must never see request bodies,
|
|
5
|
-
* raw URLs, or identity, so the envelope is a closed set of containers rather
|
|
6
|
-
* than free-form metadata. These schemas are that closed set: the shape of each
|
|
7
|
-
* one *is* the supported field list it rejects against.
|
|
8
|
-
*
|
|
9
|
-
* Two rules keep the schemas honest about what they do not cover:
|
|
10
|
-
*
|
|
11
|
-
* - **The public-safety scan stays outside.** It raises
|
|
12
|
-
* `SideEffectAuditRedactionError`, a typed error carrying `findings` that
|
|
13
|
-
* callers catch by class, which a schema cannot produce. `../side-effect-audit.ts`
|
|
14
|
-
* scans the whole payload before parsing it and again after building it.
|
|
15
|
-
* - **`counts` and `timestamps` are described as opaque here.** Their keys come
|
|
16
|
-
* from `SIDE_EFFECT_AUDIT_COUNT_NAMES` / `…_TIMESTAMP_NAMES`, which are
|
|
17
|
-
* already the single source of that list; importing them would close an
|
|
18
|
-
* import cycle, and their entries are still checked by the normalisers that
|
|
19
|
-
* own those lists.
|
|
20
|
-
*/
|
|
21
|
-
import * as z from "zod/mini";
|
|
22
|
-
import { wireObject } from "./wire.js";
|
|
23
|
-
/**
|
|
24
|
-
* This family words both of its own diagnostics the same way — an unsupported
|
|
25
|
-
* container key and an unsupported nested key read identically, which is what
|
|
26
|
-
* lets one text object serve every level of the envelope.
|
|
27
|
-
*/
|
|
28
|
-
const auditText = {
|
|
29
|
-
notObject: (path) => `side-effect audit ${path} must be an object`,
|
|
30
|
-
unknownKey: (path, key) => `side-effect audit ${path}.${key} is not supported`
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* A metadata string. Emptiness is NOT checked here: a falsy value is dropped by
|
|
34
|
-
* the normaliser rather than rejected, and this schema must not turn that drop
|
|
35
|
-
* into a failure. The "non-empty" wording is retained because it is the message
|
|
36
|
-
* `assertSafeMetadataString` raises for the whitespace-only case that survives
|
|
37
|
-
* to the normaliser.
|
|
38
|
-
*/
|
|
39
|
-
function metadataString(path) {
|
|
40
|
-
return z.string({ error: `side-effect audit ${path} must be a non-empty string` });
|
|
41
|
-
}
|
|
42
|
-
/** A non-negative safe integer, worded as this family words it. */
|
|
43
|
-
function nonNegativeSafeInt(path) {
|
|
44
|
-
const message = `side-effect audit ${path} must be a non-negative safe integer`;
|
|
45
|
-
return z
|
|
46
|
-
.number({ error: message })
|
|
47
|
-
.check(z.refine((value) => Number.isSafeInteger(value) && value >= 0, {
|
|
48
|
-
error: message,
|
|
49
|
-
abort: true
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* A closed value set, reported in the same `<what> <value> is not supported`
|
|
54
|
-
* form the action, outcome, and principal-type checks already use.
|
|
55
|
-
*/
|
|
56
|
-
function auditEnum(path, values) {
|
|
57
|
-
return z.enum(values, {
|
|
58
|
-
error: (issue) => `side-effect audit ${path} ${String(issue.input)} is not supported`
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/** Wire shape of `metadata.status`. */
|
|
62
|
-
export const SideEffectAuditStatusMetadataSchema = wireObject("metadata.status", {
|
|
63
|
-
status: z.optional(metadataString("metadata.status.status")),
|
|
64
|
-
statusCode: z.optional(nonNegativeSafeInt("metadata.status.statusCode")),
|
|
65
|
-
errorClass: z.optional(metadataString("metadata.status.errorClass")),
|
|
66
|
-
denialReason: z.optional(metadataString("metadata.status.denialReason")),
|
|
67
|
-
followUpRequired: z.optional(z.boolean({ error: "side-effect audit metadata.status.followUpRequired must be a boolean" }))
|
|
68
|
-
}, auditText);
|
|
69
|
-
/** Wire shape of `metadata.dimensions`. */
|
|
70
|
-
export const SideEffectAuditDimensionsMetadataSchema = wireObject("metadata.dimensions", {
|
|
71
|
-
provider: z.optional(metadataString("metadata.dimensions.provider")),
|
|
72
|
-
namespace: z.optional(auditEnum("metadata.dimensions.namespace", [
|
|
73
|
-
"metadata",
|
|
74
|
-
"events",
|
|
75
|
-
"logs",
|
|
76
|
-
"files",
|
|
77
|
-
"archive"
|
|
78
|
-
])),
|
|
79
|
-
method: z.optional(auditEnum("metadata.dimensions.method", ["GET", "POST", "PUT", "PATCH", "DELETE"])),
|
|
80
|
-
surface: z.optional(metadataString("metadata.dimensions.surface"))
|
|
81
|
-
}, auditText);
|
|
82
|
-
/** The containers every audit action may carry. */
|
|
83
|
-
const undimensionedMetadataShape = {
|
|
84
|
-
status: z.optional(SideEffectAuditStatusMetadataSchema),
|
|
85
|
-
counts: z.optional(z.unknown()),
|
|
86
|
-
timestamps: z.optional(z.unknown())
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Wire shape of `metadata` on a deletion action.
|
|
90
|
-
*
|
|
91
|
-
* Deletion audits are the record of data going away and are read after the
|
|
92
|
-
* session they describe no longer exists, so they carry no `dimensions`: the
|
|
93
|
-
* provider, namespace, method, and surface of the call are exactly the detail a
|
|
94
|
-
* deletion record must not preserve. The full envelope below adds that
|
|
95
|
-
* container back rather than either shape restating the shared three.
|
|
96
|
-
*/
|
|
97
|
-
export const SideEffectAuditDeletionMetadataSchema = wireObject("metadata", undimensionedMetadataShape, auditText);
|
|
98
|
-
/** Wire shape of `metadata` on every other action. */
|
|
99
|
-
export const SideEffectAuditMetadataSchema = wireObject("metadata", {
|
|
100
|
-
...undimensionedMetadataShape,
|
|
101
|
-
dimensions: z.optional(SideEffectAuditDimensionsMetadataSchema)
|
|
102
|
-
}, auditText);
|