@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,461 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client record types for the ACCOUNT and WORKSPACE-MANAGEMENT surfaces.
|
|
3
|
-
*
|
|
4
|
-
* Split out of `runtime-types.ts`, which keeps the PUBLIC SESSION LIFECYCLE —
|
|
5
|
-
* sessions, runs, messages, files, run webhooks, whoami and runtime
|
|
6
|
-
* capabilities. Nothing in that module describes an org, a plan, a key or a
|
|
7
|
-
* persisted workspace resource, and nothing here is part of a caller's session
|
|
8
|
-
* loop. Three families live below, each behind the section banner it arrived
|
|
9
|
-
* with:
|
|
10
|
-
*
|
|
11
|
-
* 1. workspace secret metadata, billing (customer-facing summary, hosted
|
|
12
|
-
* checkout/portal, credit ledger) and the webhook signing secret;
|
|
13
|
-
* 2. the control-plane resources served by the dashboard BFF — orgs,
|
|
14
|
-
* workspaces, API keys, members, invites;
|
|
15
|
-
* 3. the route families that had NO declared client type, each DERIVED from
|
|
16
|
-
* its response schema rather than restated. That set is kept whole rather
|
|
17
|
-
* than redistributed: it includes the two WRITER-TOKEN child hops, which
|
|
18
|
-
* are session routes but not session-lifecycle types — the in-container
|
|
19
|
-
* runtime reads them with a child's writer token, never a workspace key,
|
|
20
|
-
* and no SDK caller ever holds one.
|
|
21
|
-
*
|
|
22
|
-
* Re-exported from the package root barrel (`index.ts`) exactly as these types
|
|
23
|
-
* were when they lived in `runtime-types.ts`: this is a file boundary, not a
|
|
24
|
-
* surface boundary, and every name below is still public.
|
|
25
|
-
*/
|
|
26
|
-
import type * as z from "zod/mini";
|
|
27
|
-
import type { McpServerRecordSchema, McpServerListResponseSchema } from "./schemas/response-mcp-servers.js";
|
|
28
|
-
import type { WorkspaceWebhookDeliverySchema } from "./schemas/response-webhooks.js";
|
|
29
|
-
import type { WorkspaceEraseResponseSchema } from "./schemas/response-workspace.js";
|
|
30
|
-
import type { AdminBillingAccountTypeResponseSchema, AdminBillingPaymentMethodResponseSchema, AdminBillingTopupResponseSchema } from "./schemas/response-billing.js";
|
|
31
|
-
import type { ChildFinalizeResponseSchema, ChildResultResponseSchema } from "./schemas/response-sessions-internal.js";
|
|
32
|
-
import type { BillingAdmissionState } from "./billing-admission.js";
|
|
33
|
-
/**
|
|
34
|
-
* Wire-level record for a workspace secret as returned by the BFF.
|
|
35
|
-
*
|
|
36
|
-
* Workspace secrets share the lifecycle semantic of skills/files: a
|
|
37
|
-
* `Secret.value(...)` is per-session and gone at terminal, while
|
|
38
|
-
* `aex.workspace.secrets.set(...)` persists a named reusable value. Use
|
|
39
|
-
* `Secret.ref(name)` to bind that persisted value to a session. The
|
|
40
|
-
* identity is the `name` (the handle a `Secret.ref` points at); the value
|
|
41
|
-
* rotates under that stable name, bumping `version`.
|
|
42
|
-
*
|
|
43
|
-
* This record is METADATA ONLY — it never carries the secret value. Persisted
|
|
44
|
-
* values are write-only through the public workspace-secret API.
|
|
45
|
-
*/
|
|
46
|
-
export interface SecretRecord {
|
|
47
|
-
readonly id: string;
|
|
48
|
-
readonly name: string;
|
|
49
|
-
readonly version: number;
|
|
50
|
-
readonly state: "ready";
|
|
51
|
-
/** ISO-8601 with a `Z` suffix. */
|
|
52
|
-
readonly createdAt?: string;
|
|
53
|
-
/** ISO-8601 with a `Z` suffix. */
|
|
54
|
-
readonly updatedAt?: string;
|
|
55
|
-
readonly deletedAt?: string | null;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* One free monthly allowance, as reported by `GET /api/billing`.
|
|
59
|
-
*
|
|
60
|
-
* `dimension`, `unit` and `label` are OPEN strings on purpose. The quantities a
|
|
61
|
-
* free allowance is denominated in, and what each one is worth, are hosted
|
|
62
|
-
* billing policy; this contract states the SHAPE the server reports them in so a
|
|
63
|
-
* client can render the panel without keeping a second copy of the numbers. A
|
|
64
|
-
* closed union here would be exactly the duplication the prepaid model removed.
|
|
65
|
-
* Contrast `admissionState`, which IS a closed union — three states, public
|
|
66
|
-
* contract, not policy.
|
|
67
|
-
*/
|
|
68
|
-
export interface BillingAllowance {
|
|
69
|
-
/** Server-owned dimension key, e.g. `llm_token_usd`. */
|
|
70
|
-
readonly dimension: string;
|
|
71
|
-
/** This period's quota, counted in {@link unit}. */
|
|
72
|
-
readonly quota: number;
|
|
73
|
-
readonly used: number;
|
|
74
|
-
readonly remaining: number;
|
|
75
|
-
/** What the quota counts, e.g. `GB`, `calls`, `USD`. */
|
|
76
|
-
readonly unit: string;
|
|
77
|
-
/** The customer-facing name of the dimension, e.g. `model usage`. */
|
|
78
|
-
readonly label: string;
|
|
79
|
-
/** ISO-8601 instant the allowance resets — the start of the next UTC month. */
|
|
80
|
-
readonly resetAt: string;
|
|
81
|
-
/**
|
|
82
|
-
* What the remaining USD buys in tokens, on the workspace's most-used model.
|
|
83
|
-
* Rides only on the USD-denominated token allowance, and only when there is
|
|
84
|
-
* usage to infer a model from.
|
|
85
|
-
*/
|
|
86
|
-
readonly approximateTokens?: {
|
|
87
|
-
readonly model: string;
|
|
88
|
-
readonly tokens: number;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/** Auto-recharge settings plus the guards a top-up form has to respect. */
|
|
92
|
-
export interface BillingAutoTopup {
|
|
93
|
-
/** Opt-in and OFF by default: a card being on file never enables recharge. */
|
|
94
|
-
readonly enabled: boolean;
|
|
95
|
-
/** Balance below which a recharge is triggered. */
|
|
96
|
-
readonly thresholdUsd: number;
|
|
97
|
-
/** Amount charged per recharge. */
|
|
98
|
-
readonly amountUsd: number;
|
|
99
|
-
/** Smallest accepted top-up; a smaller `amountUsd` is a `400`. */
|
|
100
|
-
readonly minimumAmountUsd: number;
|
|
101
|
-
/** Ceiling on successful automatic recharges per rolling 24h. */
|
|
102
|
-
readonly maxPerDay: number;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* The saved card. `present` is authoritative and decides whether top-up and
|
|
106
|
-
* auto-recharge are reachable at all; `brand`/`last4` are cosmetic and are
|
|
107
|
-
* `null` when the payment provider could not be reached.
|
|
108
|
-
*/
|
|
109
|
-
export interface BillingPaymentMethod {
|
|
110
|
-
readonly present: boolean;
|
|
111
|
-
readonly brand: string | null;
|
|
112
|
-
readonly last4: string | null;
|
|
113
|
-
}
|
|
114
|
-
/** A live block on the organization — new work is refused with `402 account_blocked`. */
|
|
115
|
-
export interface BillingBlock {
|
|
116
|
-
/** ISO-8601 instant the block was applied. */
|
|
117
|
-
readonly at: string;
|
|
118
|
-
readonly reason: string;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Customer-facing billing summary — `GET /api/billing` (scope `billing:read`).
|
|
122
|
-
* All money fields are USD numbers.
|
|
123
|
-
*
|
|
124
|
-
* `planKey`, `subscriptionStatus` and `pastDueAt` are GONE with the catalog they
|
|
125
|
-
* described. What replaces them is the prepaid surface: the period, the
|
|
126
|
-
* card-derived {@link admissionState}, the allowance rows, the auto-recharge
|
|
127
|
-
* block, the saved card, and any live block.
|
|
128
|
-
*
|
|
129
|
-
* This shape used to carry `[key: string]: unknown` as an "additive server
|
|
130
|
-
* fields pass through" promise. That promise is precisely why `accountType` —
|
|
131
|
-
* sent unconditionally — went undeclared for as long as it did, and why no
|
|
132
|
-
* conformance check could notice: an index signature makes every undeclared
|
|
133
|
-
* field structurally legal. It is gone; every field is declared.
|
|
134
|
-
*/
|
|
135
|
-
export interface BillingSummary {
|
|
136
|
-
/** Prepaid balance (authoritative ledger sum). */
|
|
137
|
-
readonly balanceUsd: number;
|
|
138
|
-
/** Accrued spend for the current calendar month. */
|
|
139
|
-
readonly monthSpendUsd: number;
|
|
140
|
-
/** Monthly spend cap enforced on new sessions. */
|
|
141
|
-
readonly spendCapUsd: number;
|
|
142
|
-
/** The UTC allowance period these figures cover, `YYYY-MM`. */
|
|
143
|
-
readonly period: string;
|
|
144
|
-
/** What the money gates sized this workspace at. */
|
|
145
|
-
readonly admissionState: BillingAdmissionState;
|
|
146
|
-
/** `"internal"` marks an account exempt from the standard rate card. */
|
|
147
|
-
readonly accountType: "standard" | "internal";
|
|
148
|
-
/** `"active"` once a payment method is bound. Aurora-authoritative. */
|
|
149
|
-
readonly paymentMethodStatus: "none" | "active";
|
|
150
|
-
readonly autoTopupEnabled: boolean;
|
|
151
|
-
/** `null` when the organization is not blocked. */
|
|
152
|
-
readonly blocked: BillingBlock | null;
|
|
153
|
-
readonly paymentMethod: BillingPaymentMethod;
|
|
154
|
-
readonly autoTopup: BillingAutoTopup;
|
|
155
|
-
/** One entry per free monthly allowance, in the server's canonical order. */
|
|
156
|
-
readonly allowances: readonly BillingAllowance[];
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* `POST /api/billing/topup/checkout`. One hosted Checkout does card capture,
|
|
160
|
-
* address/tax collection and the credit purchase; `amountUsd` is rejected below
|
|
161
|
-
* the server's minimum ({@link BillingAutoTopup.minimumAmountUsd}).
|
|
162
|
-
*/
|
|
163
|
-
export interface BillingTopupCheckoutRequest {
|
|
164
|
-
readonly amountUsd: number;
|
|
165
|
-
/** Optional return URL after successful hosted checkout. */
|
|
166
|
-
readonly successUrl?: string;
|
|
167
|
-
/** Optional return URL after checkout cancellation. */
|
|
168
|
-
readonly cancelUrl?: string;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* `PATCH /api/billing/autotopup`. Every field is optional: an omitted field
|
|
172
|
-
* keeps its stored value. Enabling requires a saved card, and `thresholdUsd`
|
|
173
|
-
* must stay strictly below `amountUsd` — a threshold at or above the amount is a
|
|
174
|
-
* recharge loop.
|
|
175
|
-
*/
|
|
176
|
-
export interface BillingAutoTopupRequest {
|
|
177
|
-
readonly enabled?: boolean;
|
|
178
|
-
readonly thresholdUsd?: number;
|
|
179
|
-
readonly amountUsd?: number;
|
|
180
|
-
}
|
|
181
|
-
/** What `PATCH /api/billing/autotopup` echoes back: the stored settings. */
|
|
182
|
-
export interface BillingAutoTopupUpdate {
|
|
183
|
-
readonly autoTopup: BillingAutoTopup;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* One issued monthly statement as listed by `GET /api/billing/statements`.
|
|
187
|
-
*
|
|
188
|
-
* Only ISSUED periods are listed: a month the generator withheld because it did
|
|
189
|
-
* not reconcile is absent rather than rendered on demand.
|
|
190
|
-
*/
|
|
191
|
-
export interface BillingStatementSummary {
|
|
192
|
-
/** The UTC month the statement covers, `YYYY-MM`. */
|
|
193
|
-
readonly period: string;
|
|
194
|
-
/** ISO-8601 instant the statement was issued. */
|
|
195
|
-
readonly issuedAt: string;
|
|
196
|
-
readonly openingBalanceUsd: number;
|
|
197
|
-
readonly creditsPurchasedUsd: number;
|
|
198
|
-
readonly usageUsd: number;
|
|
199
|
-
readonly adjustmentsUsd: number;
|
|
200
|
-
readonly closingBalanceUsd: number;
|
|
201
|
-
}
|
|
202
|
-
/** `GET /api/billing/statements` — the months a customer can download, newest first. */
|
|
203
|
-
export interface BillingStatementList {
|
|
204
|
-
readonly statements: readonly BillingStatementSummary[];
|
|
205
|
-
}
|
|
206
|
-
export interface BillingPortalRequest {
|
|
207
|
-
/** Optional return URL after leaving the hosted billing portal. */
|
|
208
|
-
readonly returnUrl?: string;
|
|
209
|
-
}
|
|
210
|
-
/** Hosted checkout/portal session. The client should open `url`. One key. */
|
|
211
|
-
export interface BillingHostedSession {
|
|
212
|
-
readonly url: string;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* One row of the ORG credit ledger as returned by `GET /api/billing/ledger`
|
|
216
|
-
* (newest first). `amountUsd` is signed: top-ups are positive, run charges
|
|
217
|
-
* negative.
|
|
218
|
-
*
|
|
219
|
-
* Every field below is selected by the handler on every row, so none is
|
|
220
|
-
* optional; the nullable ones are nullable, which is a different statement. The
|
|
221
|
-
* index signature this shape used to carry is gone for the reason given on
|
|
222
|
-
* {@link BillingSummary}.
|
|
223
|
-
*/
|
|
224
|
-
export interface BillingLedgerEntry {
|
|
225
|
-
readonly id: string;
|
|
226
|
-
/** e.g. `top_up`, `session_charge`. Open server vocabulary. */
|
|
227
|
-
readonly entryType: string;
|
|
228
|
-
readonly amountUsd: number;
|
|
229
|
-
readonly currency: string;
|
|
230
|
-
/** The session this entry charges, `null` for non-run entries. */
|
|
231
|
-
readonly sessionId: string | null;
|
|
232
|
-
/**
|
|
233
|
-
* Cost-attribution tag: the workspace the charge belongs to, `null` for
|
|
234
|
-
* org-level rows such as a top-up.
|
|
235
|
-
*
|
|
236
|
-
* A RAW workspace id (a UUID), not the public `wsp_<hex>` form that
|
|
237
|
-
* `whoami.workspaceId` and the MCP-server records carry. Same concept, two
|
|
238
|
-
* renderings; compare with care.
|
|
239
|
-
*/
|
|
240
|
-
readonly workspaceId: string | null;
|
|
241
|
-
readonly description: string | null;
|
|
242
|
-
readonly createdBy: string;
|
|
243
|
-
/**
|
|
244
|
-
* **NOT ISO-8601** — selected raw, so it arrives as the Aurora Data API's
|
|
245
|
-
* `"YYYY-MM-DD HH:MM:SS"` text, no `T` and no zone. It is the last such field
|
|
246
|
-
* on this surface; every other billing timestamp ({@link BillingAllowance.resetAt},
|
|
247
|
-
* {@link BillingBlock.at}, {@link BillingStatementSummary.issuedAt}) is
|
|
248
|
-
* constructed by its handler and IS ISO-8601 with a `Z`.
|
|
249
|
-
*/
|
|
250
|
-
readonly createdAt: string;
|
|
251
|
-
}
|
|
252
|
-
/** Query for the billing ledger read. `limit` is clamped server-side to [1, 100] (default 25). */
|
|
253
|
-
export interface BillingLedgerQuery {
|
|
254
|
-
readonly limit?: number;
|
|
255
|
-
}
|
|
256
|
-
/** One page of recent ledger rows (newest first). Not cursor-paged — `limit` bounds the read. */
|
|
257
|
-
export interface BillingLedgerPage {
|
|
258
|
-
readonly entries: readonly BillingLedgerEntry[];
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* The workspace webhook signing secret reveal — `POST /api/webhook/signing-secret`.
|
|
262
|
-
* `whsec` is the Standard-Webhooks style `whsec_<base64>` string that
|
|
263
|
-
* `verifyAexWebhook` accepts as `secret`. The endpoint reveals the current
|
|
264
|
-
* secret, CREATING one on first use; it does not rotate (a repeat call returns
|
|
265
|
-
* the same value). POST (not GET) so every reveal is a logged action.
|
|
266
|
-
*/
|
|
267
|
-
export interface WebhookSigningSecret {
|
|
268
|
-
readonly whsec: string;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* One org the caller belongs to — the ownership / billing / roles wrapper ABOVE
|
|
272
|
-
* workspaces. `role` is the caller's own membership role in this org
|
|
273
|
-
* (`admin | member`); billing and the per-org workspace cap live at this level.
|
|
274
|
-
*/
|
|
275
|
-
export interface OrgRecord {
|
|
276
|
-
readonly id: string;
|
|
277
|
-
readonly name: string;
|
|
278
|
-
/** Globally-unique org slug (`/org/<slug>`); omitted by older deployments. */
|
|
279
|
-
readonly slug?: string;
|
|
280
|
-
/** The caller's role in this org: `admin` or `member`. */
|
|
281
|
-
readonly role?: string;
|
|
282
|
-
readonly createdAt?: string;
|
|
283
|
-
}
|
|
284
|
-
/** Request body for {@link createOrg} — a display name; the server assigns id/slug. */
|
|
285
|
-
export interface CreateOrgRequest {
|
|
286
|
-
readonly name: string;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* A workspace as seen from the CONTROL plane (management view): its id, name,
|
|
290
|
-
* and owning org. Distinct from the data-plane view — this never carries the
|
|
291
|
-
* workspace's files/skills/secrets, only the row a dashboard/CLI lists.
|
|
292
|
-
*/
|
|
293
|
-
export interface WorkspaceRecord {
|
|
294
|
-
readonly id: string;
|
|
295
|
-
readonly name: string;
|
|
296
|
-
/** Globally-unique workspace slug (`/workspace/<slug>`); omitted by older deployments. */
|
|
297
|
-
readonly slug?: string;
|
|
298
|
-
/** The org that owns this workspace. */
|
|
299
|
-
readonly orgId: string;
|
|
300
|
-
readonly createdAt?: string;
|
|
301
|
-
}
|
|
302
|
-
/** Request body for {@link createWorkspace}; hosted policy owns any org workspace limit. */
|
|
303
|
-
export interface CreateWorkspaceRequest {
|
|
304
|
-
/** The org to create the workspace under. */
|
|
305
|
-
readonly orgId: string;
|
|
306
|
-
readonly name: string;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* One-time reveal returned by {@link createWorkspace}: the new workspace's id
|
|
310
|
-
* plus its FIRST workspace-scoped, data-plane API key. The key is shown exactly
|
|
311
|
-
* once at creation — the creating (account) principal has no other data-plane
|
|
312
|
-
* access to it, though the owning user can see/delete it in the dashboard
|
|
313
|
-
* (orphan recovery). The SDK wraps `apiKey` in a redacted `SecretString`.
|
|
314
|
-
*/
|
|
315
|
-
export interface NewWorkspace {
|
|
316
|
-
readonly workspaceId: string;
|
|
317
|
-
/** The workspace-scoped API key (`aex_<plane>_…`), revealed ONCE. */
|
|
318
|
-
readonly apiKey: string;
|
|
319
|
-
/** Globally-unique workspace slug, when the server assigns one. */
|
|
320
|
-
readonly slug?: string;
|
|
321
|
-
/** The org that owns the new workspace. */
|
|
322
|
-
readonly orgId?: string;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Metadata for one API key (data-plane workspace key OR account PAT). NEVER
|
|
326
|
-
* carries the secret value — the value is write-only and revealed only once via
|
|
327
|
-
* {@link NewApiKey}. `kind` distinguishes a `workspace` key from an `account`
|
|
328
|
-
* PAT; `workspaceId` is present only for workspace keys.
|
|
329
|
-
*/
|
|
330
|
-
export interface ApiKeyRecord {
|
|
331
|
-
readonly id: string;
|
|
332
|
-
readonly name?: string;
|
|
333
|
-
/** `workspace` (data-plane) or `account` (control-plane PAT). */
|
|
334
|
-
readonly kind?: string;
|
|
335
|
-
/** Present for workspace keys; absent for account PATs. */
|
|
336
|
-
readonly workspaceId?: string;
|
|
337
|
-
readonly scopes?: readonly string[];
|
|
338
|
-
readonly createdAt?: string;
|
|
339
|
-
readonly lastUsedAt?: string | null;
|
|
340
|
-
readonly revokedAt?: string | null;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Request body for {@link createApiKey}. Mint EITHER a workspace-scoped
|
|
344
|
-
* data-plane key (pass `workspaceId`) or an account PAT (`account: true`) — the
|
|
345
|
-
* two are mutually exclusive. Anti-escalation: an account PAT can mint workspace
|
|
346
|
-
* keys but not another PAT (enforced server-side).
|
|
347
|
-
*/
|
|
348
|
-
export interface CreateApiKeyRequest {
|
|
349
|
-
/** Mint a WORKSPACE-scoped data-plane key for this workspace. */
|
|
350
|
-
readonly workspaceId?: string;
|
|
351
|
-
/** Mint an ACCOUNT PAT (control-plane) instead. Mutually exclusive with `workspaceId`. */
|
|
352
|
-
readonly account?: boolean;
|
|
353
|
-
/** Optional human label for the key. */
|
|
354
|
-
readonly name?: string;
|
|
355
|
-
/** Optional scope restriction; defaults server-side. */
|
|
356
|
-
readonly scopes?: readonly string[];
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* One-time reveal returned by {@link createApiKey}: the key id plus the freshly
|
|
360
|
-
* minted secret value, shown exactly once. The SDK wraps `apiKey` in a redacted
|
|
361
|
-
* `SecretString`.
|
|
362
|
-
*/
|
|
363
|
-
export interface NewApiKey {
|
|
364
|
-
readonly id: string;
|
|
365
|
-
/** The freshly minted key value, revealed ONCE. */
|
|
366
|
-
readonly apiKey: string;
|
|
367
|
-
readonly name?: string;
|
|
368
|
-
readonly kind?: string;
|
|
369
|
-
readonly workspaceId?: string;
|
|
370
|
-
readonly scopes?: readonly string[];
|
|
371
|
-
}
|
|
372
|
-
/** One member of an org (from {@link listOrgMembers}). Never carries credentials. */
|
|
373
|
-
export interface OrgMemberRecord {
|
|
374
|
-
/** The member's stable account (app-user) id. */
|
|
375
|
-
readonly appUserId: string;
|
|
376
|
-
readonly email?: string;
|
|
377
|
-
/** `admin` or `member`. */
|
|
378
|
-
readonly role: string;
|
|
379
|
-
/** `active` or `pending` (an unaccepted invite). */
|
|
380
|
-
readonly status?: string;
|
|
381
|
-
readonly createdAt?: string;
|
|
382
|
-
}
|
|
383
|
-
/** Request body for {@link createOrgInvite} — invite an email at a role. */
|
|
384
|
-
export interface CreateOrgInviteRequest {
|
|
385
|
-
readonly email: string;
|
|
386
|
-
/** `admin` or `member`; defaults server-side to `member`. */
|
|
387
|
-
readonly role?: string;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* A pending team invite created by {@link createOrgInvite}. Metadata only — the
|
|
391
|
-
* invite token itself is delivered out-of-band (email), never returned here.
|
|
392
|
-
*/
|
|
393
|
-
export interface OrgInvite {
|
|
394
|
-
readonly id: string;
|
|
395
|
-
readonly orgId: string;
|
|
396
|
-
readonly email: string;
|
|
397
|
-
readonly role: string;
|
|
398
|
-
/** `pending` until accepted. */
|
|
399
|
-
readonly status?: string;
|
|
400
|
-
readonly expiresAt?: string;
|
|
401
|
-
readonly createdAt?: string;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* One persisted workspace MCP server — `POST/GET /api/mcp-servers`,
|
|
405
|
-
* `GET/DELETE /api/mcp-servers/{id}`.
|
|
406
|
-
*
|
|
407
|
-
* `headerShape` lists header NAMES ONLY. The values live in the secret store and
|
|
408
|
-
* are write-only through this API; a `headers` or `authorization` key appearing
|
|
409
|
-
* on a read is a leak, and the response schema fails the suite if one does.
|
|
410
|
-
*
|
|
411
|
-
* `workspaceId` is the PUBLIC `wsp_<hex>` form (the handler runs it through
|
|
412
|
-
* `publicWorkspaceId`), matching `whoami.workspaceId` — and NOT matching
|
|
413
|
-
* {@link BillingLedgerEntry.workspaceId} or {@link WorkspaceEraseResult}, which
|
|
414
|
-
* are raw ids. `createdAt` / `updatedAt` are ISO-8601 with a `Z`.
|
|
415
|
-
*/
|
|
416
|
-
export type McpServerRecord = z.infer<typeof McpServerRecordSchema>;
|
|
417
|
-
/** `GET /api/mcp-servers` — every workspace MCP server, newest first. Not paged. */
|
|
418
|
-
export type McpServerList = z.infer<typeof McpServerListResponseSchema>;
|
|
419
|
-
/**
|
|
420
|
-
* One row of `GET /api/webhook/deliveries` — the WORKSPACE view of the delivery
|
|
421
|
-
* ledger, which is {@link SessionWebhookDelivery} plus the `sessionId` and
|
|
422
|
-
* `callbackUrl` it belongs to. Server-capped at the 100 most recent: no `limit`,
|
|
423
|
-
* no cursor.
|
|
424
|
-
*/
|
|
425
|
-
export type WorkspaceWebhookDelivery = z.infer<typeof WorkspaceWebhookDeliverySchema>;
|
|
426
|
-
/**
|
|
427
|
-
* `DELETE /api/workspaces/{workspaceId}` on the DATA plane — the owner's GDPR
|
|
428
|
-
* hard-erase, answering 200 with counters rather than 204. Idempotent: erasing
|
|
429
|
-
* an absent workspace answers 200 with every counter at zero, indistinguishable
|
|
430
|
-
* from erasing an empty one.
|
|
431
|
-
*
|
|
432
|
-
* NOT the same route as {@link deleteWorkspace}, which is the CONTROL plane's
|
|
433
|
-
* `DELETE /api/workspaces/{id}` and returns no body. Same method, same path
|
|
434
|
-
* pattern, different plane and different response.
|
|
435
|
-
*
|
|
436
|
-
* `workspaceId` here is the RAW id, not the public `wsp_<hex>` form.
|
|
437
|
-
*/
|
|
438
|
-
export type WorkspaceEraseResult = z.infer<typeof WorkspaceEraseResponseSchema>;
|
|
439
|
-
/** `POST /api/admin/billing/topup` — operator credit grant. */
|
|
440
|
-
export type AdminBillingTopupResult = z.infer<typeof AdminBillingTopupResponseSchema>;
|
|
441
|
-
/** `POST /api/admin/billing/payment-method` — operator payment-method override. */
|
|
442
|
-
export type AdminBillingPaymentMethodResult = z.infer<typeof AdminBillingPaymentMethodResponseSchema>;
|
|
443
|
-
/** `POST /api/admin/billing/account-type` — operator account-type override. */
|
|
444
|
-
export type AdminBillingAccountTypeResult = z.infer<typeof AdminBillingAccountTypeResponseSchema>;
|
|
445
|
-
/**
|
|
446
|
-
* `GET /api/sessions/{id}/result` — a subagent child's result, read by the
|
|
447
|
-
* in-container runtime with the child's WRITER TOKEN, not a workspace API key.
|
|
448
|
-
* Either still in flight (`settling` / `running` / `queued`) or `finished` with
|
|
449
|
-
* an outcome.
|
|
450
|
-
*
|
|
451
|
-
* Its files key the workspace-relative path as **`path`**, where the public
|
|
452
|
-
* `/files` routes call the same thing `filename` ({@link SessionFile}). Two
|
|
453
|
-
* server projections of one concept differing in one key name.
|
|
454
|
-
*/
|
|
455
|
-
export type ChildResult = z.infer<typeof ChildResultResponseSchema>;
|
|
456
|
-
/**
|
|
457
|
-
* `POST /api/sessions/{id}/finalize` — the writer-token child settle hop. Note
|
|
458
|
-
* the absence of a `session` envelope: this route is not shaped like the public
|
|
459
|
-
* session routes.
|
|
460
|
-
*/
|
|
461
|
-
export type ChildFinalizeResult = z.infer<typeof ChildFinalizeResponseSchema>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Self-describing API-key codec (SSoT).
|
|
3
|
-
*
|
|
4
|
-
* An aex API key is `aex_<plane>_<regionCode>_<workspaceId>_<secret>_<crc>` —
|
|
5
|
-
* it embeds its own plane and region, CRC-protected. This is the canonical
|
|
6
|
-
* client-side codec: the SDK constructor parses the key to DERIVE the target
|
|
7
|
-
* plane (zero-network) and to fail fast on a plane/baseUrl mismatch instead of
|
|
8
|
-
* surfacing a bare `token_invalid` after a full round-trip.
|
|
9
|
-
*
|
|
10
|
-
* The embedded workspace id is a whole `wsp_<32hex>` id ({@link ID_PREFIXES}),
|
|
11
|
-
* which makes the key SEVEN underscore-separated fields rather than six. The old
|
|
12
|
-
* six-field layout stripped the `wsp_` prefix to fit the workspace id into one
|
|
13
|
-
* field; that strip existed because of this wire format, not because of the
|
|
14
|
-
* database, and it is what let four workspace-id string forms coexist.
|
|
15
|
-
*
|
|
16
|
-
* Pinned to the platform codec (`@aexhq/contract-core/token-codec`) by a
|
|
17
|
-
* cross-repo parity test. Parse-only: it makes NO trust decision (the server
|
|
18
|
-
* still validates the secret).
|
|
19
|
-
*/
|
|
20
|
-
export declare const API_KEY_PLANES: readonly ["dev", "prd"];
|
|
21
|
-
export type ApiKeyPlane = (typeof API_KEY_PLANES)[number];
|
|
22
|
-
/**
|
|
23
|
-
* Supported region → embedded region code. Mirrors
|
|
24
|
-
* `@aexhq/contract-core/src/supported-regions.ts` (`REGION_TOKEN_CODES`), which
|
|
25
|
-
* is exhaustive over the launch region set by `satisfies`; the two are pinned to
|
|
26
|
-
* each other by `platform/scripts/validate/api-key-codec-parity.test.ts`. These
|
|
27
|
-
* codes are FROZEN — a code is a permanent field of every key minted with it.
|
|
28
|
-
*/
|
|
29
|
-
export declare const API_KEY_REGION_TO_CODE: Readonly<Record<string, string>>;
|
|
30
|
-
/** `aex_<plane>_<regionCode>_<wsp>_<hex>_<secret>_<tag>`. */
|
|
31
|
-
export declare const API_KEY_FIELD_COUNT = 7;
|
|
32
|
-
export interface ParsedApiKey {
|
|
33
|
-
readonly plane: ApiKeyPlane;
|
|
34
|
-
readonly regionCode: string;
|
|
35
|
-
readonly region: string;
|
|
36
|
-
/** The workspace id embedded in the key, in its one canonical `wsp_<32hex>` form. */
|
|
37
|
-
readonly workspaceId: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Parse a self-describing API key, or `null` for any opaque or STRUCTURALLY malformed value.
|
|
41
|
-
* Validates the `aex_` prefix, the 7-part shape, a known plane + region code, and that the
|
|
42
|
-
* embedded workspace id is a canonical id. The trailing tag is an HMAC keyed by the server
|
|
43
|
-
* pepper (WS6/P4) which the SDK does not hold, so this is the pure routing parse; authenticity
|
|
44
|
-
* is verified server-side. A tampered tag parses (routes) and is rejected at auth.
|
|
45
|
-
*/
|
|
46
|
-
export declare function tryParseApiKey(token: string): ParsedApiKey | null;
|
|
47
|
-
/** @deprecated Use {@link tryParseApiKey}; this compatibility wrapper is identical. */
|
|
48
|
-
export declare function parseApiKey(token: string): ParsedApiKey | null;
|
|
49
|
-
/**
|
|
50
|
-
* Assemble a valid API key from its parts (the inverse of {@link parseApiKey}).
|
|
51
|
-
* Unlike the server's `mintApiKeyValue` this takes an EXPLICIT `secret` so it is
|
|
52
|
-
* deterministic — used by codec round-trip / cross-repo parity tests. The
|
|
53
|
-
* workspace id must ALREADY be canonical: there is no normalizer, so a dashed
|
|
54
|
-
* uuid or a bare hex string throws instead of being silently reshaped.
|
|
55
|
-
*/
|
|
56
|
-
export declare function formatApiKey(input: {
|
|
57
|
-
readonly plane: ApiKeyPlane;
|
|
58
|
-
readonly region: string;
|
|
59
|
-
readonly workspaceId: string;
|
|
60
|
-
readonly secret: string;
|
|
61
|
-
}): string;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Self-describing API-key codec (SSoT).
|
|
3
|
-
*
|
|
4
|
-
* An aex API key is `aex_<plane>_<regionCode>_<workspaceId>_<secret>_<crc>` —
|
|
5
|
-
* it embeds its own plane and region, CRC-protected. This is the canonical
|
|
6
|
-
* client-side codec: the SDK constructor parses the key to DERIVE the target
|
|
7
|
-
* plane (zero-network) and to fail fast on a plane/baseUrl mismatch instead of
|
|
8
|
-
* surfacing a bare `token_invalid` after a full round-trip.
|
|
9
|
-
*
|
|
10
|
-
* The embedded workspace id is a whole `wsp_<32hex>` id ({@link ID_PREFIXES}),
|
|
11
|
-
* which makes the key SEVEN underscore-separated fields rather than six. The old
|
|
12
|
-
* six-field layout stripped the `wsp_` prefix to fit the workspace id into one
|
|
13
|
-
* field; that strip existed because of this wire format, not because of the
|
|
14
|
-
* database, and it is what let four workspace-id string forms coexist.
|
|
15
|
-
*
|
|
16
|
-
* Pinned to the platform codec (`@aexhq/contract-core/token-codec`) by a
|
|
17
|
-
* cross-repo parity test. Parse-only: it makes NO trust decision (the server
|
|
18
|
-
* still validates the secret).
|
|
19
|
-
*/
|
|
20
|
-
import { assertId, isId } from "./ids.js";
|
|
21
|
-
export const API_KEY_PLANES = ["dev", "prd"];
|
|
22
|
-
/**
|
|
23
|
-
* Supported region → embedded region code. Mirrors
|
|
24
|
-
* `@aexhq/contract-core/src/supported-regions.ts` (`REGION_TOKEN_CODES`), which
|
|
25
|
-
* is exhaustive over the launch region set by `satisfies`; the two are pinned to
|
|
26
|
-
* each other by `platform/scripts/validate/api-key-codec-parity.test.ts`. These
|
|
27
|
-
* codes are FROZEN — a code is a permanent field of every key minted with it.
|
|
28
|
-
*/
|
|
29
|
-
export const API_KEY_REGION_TO_CODE = {
|
|
30
|
-
"eu-west-1": "euw1",
|
|
31
|
-
"us-west-1": "usw1",
|
|
32
|
-
"ap-northeast-1": "apne1"
|
|
33
|
-
};
|
|
34
|
-
const CODE_TO_REGION = Object.fromEntries(Object.entries(API_KEY_REGION_TO_CODE).map(([region, code]) => [code, region]));
|
|
35
|
-
const API_KEY_PLANE_SET = new Set(API_KEY_PLANES);
|
|
36
|
-
/** `aex_<plane>_<regionCode>_<wsp>_<hex>_<secret>_<tag>`. */
|
|
37
|
-
export const API_KEY_FIELD_COUNT = 7;
|
|
38
|
-
/**
|
|
39
|
-
* Parse a self-describing API key, or `null` for any opaque or STRUCTURALLY malformed value.
|
|
40
|
-
* Validates the `aex_` prefix, the 7-part shape, a known plane + region code, and that the
|
|
41
|
-
* embedded workspace id is a canonical id. The trailing tag is an HMAC keyed by the server
|
|
42
|
-
* pepper (WS6/P4) which the SDK does not hold, so this is the pure routing parse; authenticity
|
|
43
|
-
* is verified server-side. A tampered tag parses (routes) and is rejected at auth.
|
|
44
|
-
*/
|
|
45
|
-
export function tryParseApiKey(token) {
|
|
46
|
-
if (typeof token !== "string" || !token.startsWith("aex_"))
|
|
47
|
-
return null;
|
|
48
|
-
const parts = token.split("_");
|
|
49
|
-
if (parts.length !== API_KEY_FIELD_COUNT)
|
|
50
|
-
return null;
|
|
51
|
-
const [prefix, plane, regionCode, workspacePrefix, workspaceBody, secret, tag] = parts;
|
|
52
|
-
if (prefix !== "aex" || !API_KEY_PLANE_SET.has(plane) || !regionCode || !secret || !tag) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
const workspaceId = `${workspacePrefix}_${workspaceBody}`;
|
|
56
|
-
if (!isId("workspace", workspaceId))
|
|
57
|
-
return null;
|
|
58
|
-
// WS6/P4: the tag is an HMAC keyed by the server pepper, which the SDK does not hold — so this is
|
|
59
|
-
// the PURE routing parse (structure only). Authenticity is enforced server-side by verifyTokenTag
|
|
60
|
-
// before any store touch; a tag-tampered token routes and is then rejected at auth.
|
|
61
|
-
const region = CODE_TO_REGION[regionCode];
|
|
62
|
-
if (region === undefined)
|
|
63
|
-
return null;
|
|
64
|
-
return { plane: plane, regionCode, region, workspaceId };
|
|
65
|
-
}
|
|
66
|
-
/** @deprecated Use {@link tryParseApiKey}; this compatibility wrapper is identical. */
|
|
67
|
-
export function parseApiKey(token) {
|
|
68
|
-
return tryParseApiKey(token);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Assemble a valid API key from its parts (the inverse of {@link parseApiKey}).
|
|
72
|
-
* Unlike the server's `mintApiKeyValue` this takes an EXPLICIT `secret` so it is
|
|
73
|
-
* deterministic — used by codec round-trip / cross-repo parity tests. The
|
|
74
|
-
* workspace id must ALREADY be canonical: there is no normalizer, so a dashed
|
|
75
|
-
* uuid or a bare hex string throws instead of being silently reshaped.
|
|
76
|
-
*/
|
|
77
|
-
export function formatApiKey(input) {
|
|
78
|
-
const code = API_KEY_REGION_TO_CODE[input.region];
|
|
79
|
-
if (code === undefined) {
|
|
80
|
-
throw new Error(`API key region is not supported: ${input.region}`);
|
|
81
|
-
}
|
|
82
|
-
const workspaceField = assertId("workspace", input.workspaceId, "API key workspaceId");
|
|
83
|
-
if (!input.secret || input.secret.includes("_")) {
|
|
84
|
-
throw new Error("secret must be non-empty and contain no '_'");
|
|
85
|
-
}
|
|
86
|
-
const body = ["aex", input.plane, code, workspaceField, input.secret].join("_");
|
|
87
|
-
return `${body}_${crc32Base36(body)}`;
|
|
88
|
-
}
|
|
89
|
-
function crc32Base36(input) {
|
|
90
|
-
return crc32(input).toString(36);
|
|
91
|
-
}
|
|
92
|
-
function crc32(input) {
|
|
93
|
-
let crc = 0xffffffff;
|
|
94
|
-
for (const byte of Buffer.from(input, "utf8")) {
|
|
95
|
-
crc ^= byte;
|
|
96
|
-
for (let i = 0; i < 8; i += 1) {
|
|
97
|
-
crc = (crc >>> 1) ^ (0xedb88320 & -(crc & 1));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return (crc ^ 0xffffffff) >>> 0;
|
|
101
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The authenticated data-plane HTTP route table.
|
|
3
|
-
*
|
|
4
|
-
* This is the single machine-readable description of the data-plane surface:
|
|
5
|
-
* the platform api lambda dispatches and scope-gates from it, and the OpenAPI
|
|
6
|
-
* generator in this repo reads the same table. It is declared here exactly
|
|
7
|
-
* once so the two can never drift.
|
|
8
|
-
*
|
|
9
|
-
* Declaration-only and dependency-free: matching, scope lookup and route
|
|
10
|
-
* classification stay with the server that dispatches them.
|
|
11
|
-
*/
|
|
12
|
-
export type RequiredApiScope = string;
|
|
13
|
-
export type AuthenticatedApiRouteDescriptor = {
|
|
14
|
-
readonly name: string;
|
|
15
|
-
readonly method: string;
|
|
16
|
-
readonly pattern: RegExp;
|
|
17
|
-
readonly samplePath: string;
|
|
18
|
-
readonly requiredScope: RequiredApiScope | null;
|
|
19
|
-
};
|
|
20
|
-
export declare const AUTHENTICATED_API_ROUTE_DESCRIPTORS: readonly AuthenticatedApiRouteDescriptor[];
|