@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,618 +0,0 @@
|
|
|
1
|
-
import type * as z from "zod/mini";
|
|
2
|
-
import type { SessionStatus, SessionTerminalOutcome } from "./status.js";
|
|
3
|
-
import type { RuntimeSize } from "./runtime-sizes.js";
|
|
4
|
-
import type { RuntimeKind } from "./runtime-kind.js";
|
|
5
|
-
import type { SessionCostProviderUsage } from "./session-cost.js";
|
|
6
|
-
import type { ProviderFault } from "./provider-fault.js";
|
|
7
|
-
import type { BillingAdmissionState } from "./billing-admission.js";
|
|
8
|
-
import type { PlatformInlineSecrets, PlatformSubmission, SessionLimits, SessionWebhookSpec } from "./submission.js";
|
|
9
|
-
import type { SessionDeleteResponseSchema, SessionFileSchema, SessionFileLinkResponseSchema, SessionWireSchema } from "./schemas/response-sessions.js";
|
|
10
|
-
/** Public run phases. Internal finalization remains behind the consistency barrier. */
|
|
11
|
-
export declare const SESSION_RUN_PHASES: readonly ["queued", "starting", "running", "finished", "error"];
|
|
12
|
-
export type SessionRunPhase = (typeof SESSION_RUN_PHASES)[number];
|
|
13
|
-
export type SessionRunOutcome = SessionTerminalOutcome;
|
|
14
|
-
export interface SessionRun {
|
|
15
|
-
readonly sessionId: string;
|
|
16
|
-
readonly turnSeq: number;
|
|
17
|
-
readonly runId: string;
|
|
18
|
-
readonly phase: SessionRunPhase;
|
|
19
|
-
readonly outcome?: SessionRunOutcome;
|
|
20
|
-
readonly startedAt?: string;
|
|
21
|
-
readonly finishedAt?: string;
|
|
22
|
-
readonly checkpoint?: import("./session-artifacts.js").SessionCheckpointRevision;
|
|
23
|
-
readonly eventCursor?: number;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The execution runtime a session runs on. Both fields are optional (the
|
|
27
|
-
* platform applies defaults): `kind` selects the backend
|
|
28
|
-
* (`spot_container` (default — see
|
|
29
|
-
* {@link import("./runtime-kind.js").DEFAULT_RUNTIME_KIND}) | `container` |
|
|
30
|
-
* `lambda`), `size` selects the managed box preset. Grouped so the SDK surface
|
|
31
|
-
* reads `runtime: { kind: "spot_container", size: Sizes.CPU_2_8GB }`.
|
|
32
|
-
*/
|
|
33
|
-
export interface SessionRuntime {
|
|
34
|
-
readonly kind?: RuntimeKind;
|
|
35
|
-
readonly size?: RuntimeSize;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The session projection **exactly as the data plane serves it**.
|
|
39
|
-
*
|
|
40
|
-
* Derived from `SessionWireSchema`, the schema the C4 harness validates real
|
|
41
|
-
* bytes against, so this type and that schema cannot disagree. The wire carries
|
|
42
|
-
* FLAT `runtimeKind` + `runtimeSize`; there is no grouped `runtime` object on
|
|
43
|
-
* it. `normalizeSessionRuntime` in `operations.ts` folds the pair into
|
|
44
|
-
* {@link Session} before any SDK caller sees a session, which is why both shapes
|
|
45
|
-
* are declared: they are two different things, and calling them both `Session`
|
|
46
|
-
* is what let three fields disagree with the server unnoticed.
|
|
47
|
-
*
|
|
48
|
-
* Nobody outside `operations.ts` should consume this. It exists so the
|
|
49
|
-
* transform is a named, checkable step instead of an undocumented mutation.
|
|
50
|
-
*/
|
|
51
|
-
export type SessionWire = z.infer<typeof SessionWireSchema>;
|
|
52
|
-
/**
|
|
53
|
-
* A session as the SDK hands it to a caller — {@link SessionWire} with the flat
|
|
54
|
-
* `runtimeKind`/`runtimeSize` pair folded into {@link SessionRuntime}. Nothing
|
|
55
|
-
* else is added, removed or renamed by the fold.
|
|
56
|
-
*/
|
|
57
|
-
export interface Session {
|
|
58
|
-
readonly id: string;
|
|
59
|
-
readonly status: SessionStatus;
|
|
60
|
-
readonly workspaceId?: string;
|
|
61
|
-
readonly model?: PlatformSubmission["model"];
|
|
62
|
-
/** The upstream model provider the session ran on, when the server records one. */
|
|
63
|
-
readonly provider?: string;
|
|
64
|
-
/**
|
|
65
|
-
* Execution runtime: the backend (`kind`) and box size (`size`) it runs on.
|
|
66
|
-
* CLIENT-SIDE SHAPE — the server sends `runtimeKind` and `runtimeSize` as two
|
|
67
|
-
* top-level fields (see {@link SessionWire}); the SDK groups them here.
|
|
68
|
-
*/
|
|
69
|
-
readonly runtime?: SessionRuntime;
|
|
70
|
-
readonly acceptsMessages: boolean;
|
|
71
|
-
readonly currentRun?: SessionRun;
|
|
72
|
-
readonly lastRun?: SessionRun;
|
|
73
|
-
/** How long the session may remain idle before it is suspended. */
|
|
74
|
-
readonly idleTtl?: string;
|
|
75
|
-
readonly idleTtlMs?: number;
|
|
76
|
-
readonly createdAt?: string;
|
|
77
|
-
readonly updatedAt?: string;
|
|
78
|
-
readonly idleAt?: string | null;
|
|
79
|
-
readonly suspendedAt?: string | null;
|
|
80
|
-
readonly activeDurationMs?: number;
|
|
81
|
-
readonly retainedStorageBytes?: number;
|
|
82
|
-
readonly costUsd?: number;
|
|
83
|
-
/**
|
|
84
|
-
* Cost and usage telemetry for the settled session. **This is where token
|
|
85
|
-
* counts live** — `costTelemetry.providerUsage`, projected by
|
|
86
|
-
* {@link usageFromProviderUsage}. There is no top-level `usage` field; the
|
|
87
|
-
* server has never sent one.
|
|
88
|
-
*/
|
|
89
|
-
readonly costTelemetry?: import("./session-cost.js").SessionCostTelemetry;
|
|
90
|
-
readonly errorMessage?: string | null;
|
|
91
|
-
/**
|
|
92
|
-
* Failure taxonomy for the most recent failed run (e.g.
|
|
93
|
-
* `provider-permanent`, `budget_exhausted`) — the class a caller can branch
|
|
94
|
-
* on, complementing the human-readable `errorMessage`.
|
|
95
|
-
*/
|
|
96
|
-
readonly failureClass?: string | null;
|
|
97
|
-
/** Structured, redaction-safe provider detail for the most recent failed run. */
|
|
98
|
-
readonly providerFault?: ProviderFault;
|
|
99
|
-
/**
|
|
100
|
-
* Content-retention lifecycle (WS4). `"active"` — the default when absent —
|
|
101
|
-
* means the session's CONTENT (events, messages, files, manifest, archive) is
|
|
102
|
-
* still readable. `"metadata_only"` means the content-retention window elapsed
|
|
103
|
-
* and the content was tombstoned: this session RECORD still reads, but every
|
|
104
|
-
* content endpoint now answers HTTP 410 `content_deleted` (surfaced by the SDK
|
|
105
|
-
* as `ContentDeletedError`). Optional and forward-compatible: an older
|
|
106
|
-
* deployment omits it and the session parses as active.
|
|
107
|
-
*/
|
|
108
|
-
readonly dataState?: "active" | "metadata_only";
|
|
109
|
-
/** When the content was purged (ISO 8601). Present once `dataState` is `"metadata_only"`. */
|
|
110
|
-
readonly contentPurgedAt?: string;
|
|
111
|
-
/** What triggered the content purge: `"retention"` (window elapsed) or `"user"` (explicit delete). */
|
|
112
|
-
readonly contentDeletedBy?: "retention" | "user";
|
|
113
|
-
}
|
|
114
|
-
export interface SessionSummary {
|
|
115
|
-
readonly id: string;
|
|
116
|
-
readonly status: SessionStatus;
|
|
117
|
-
/** Execution runtime: the backend (`kind`) and box size (`size`) it runs on. */
|
|
118
|
-
readonly runtime?: SessionRuntime;
|
|
119
|
-
readonly acceptsMessages: boolean;
|
|
120
|
-
readonly currentRun?: SessionRun;
|
|
121
|
-
readonly lastRun?: SessionRun;
|
|
122
|
-
/** How long the session may remain idle before it is suspended. */
|
|
123
|
-
readonly idleTtl?: string;
|
|
124
|
-
readonly idleTtlMs?: number;
|
|
125
|
-
readonly createdAt: string;
|
|
126
|
-
readonly updatedAt: string;
|
|
127
|
-
readonly idleAt?: string | null;
|
|
128
|
-
readonly suspendedAt?: string | null;
|
|
129
|
-
readonly activeDurationMs?: number;
|
|
130
|
-
readonly retainedStorageBytes?: number;
|
|
131
|
-
readonly costUsd?: number;
|
|
132
|
-
}
|
|
133
|
-
export interface SessionListQuery {
|
|
134
|
-
readonly status?: SessionStatus;
|
|
135
|
-
readonly since?: string;
|
|
136
|
-
readonly limit?: number;
|
|
137
|
-
readonly cursor?: string;
|
|
138
|
-
}
|
|
139
|
-
export interface SessionListPage {
|
|
140
|
-
readonly sessions: readonly SessionSummary[];
|
|
141
|
-
readonly nextCursor?: string;
|
|
142
|
-
}
|
|
143
|
-
export interface SessionRetentionPolicy {
|
|
144
|
-
/** How long the session may remain idle before it is suspended. */
|
|
145
|
-
readonly idleTtl?: string;
|
|
146
|
-
}
|
|
147
|
-
export type SessionSubmission = Omit<PlatformSubmission, "prompt"> & {
|
|
148
|
-
readonly prompt?: readonly string[];
|
|
149
|
-
};
|
|
150
|
-
export interface SessionCreateRequest {
|
|
151
|
-
readonly submission: SessionSubmission;
|
|
152
|
-
readonly runtimeSize?: RuntimeSize;
|
|
153
|
-
readonly runtimeKind?: RuntimeKind;
|
|
154
|
-
readonly timeout?: string;
|
|
155
|
-
readonly limits?: SessionLimits;
|
|
156
|
-
readonly retention?: SessionRetentionPolicy;
|
|
157
|
-
readonly webhook?: SessionWebhookSpec;
|
|
158
|
-
readonly secrets: PlatformInlineSecrets;
|
|
159
|
-
}
|
|
160
|
-
export interface SessionMessageRequest {
|
|
161
|
-
readonly input: string | readonly string[];
|
|
162
|
-
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
163
|
-
}
|
|
164
|
-
export interface SessionMessageAccepted {
|
|
165
|
-
readonly session: Session;
|
|
166
|
-
readonly run: SessionRun;
|
|
167
|
-
readonly eventCursor?: number;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* The senders the projected transcript actually carries.
|
|
171
|
-
*
|
|
172
|
-
* Narrowed from a four-member union that also listed `system` and `tool`. The
|
|
173
|
-
* message projection emits only these two — tool activity and system text reach
|
|
174
|
-
* a caller as events, not transcript messages — and
|
|
175
|
-
* `SessionMessagesPageResponseSchema` is strict, so a third value would fail C4
|
|
176
|
-
* rather than pass unnoticed.
|
|
177
|
-
*/
|
|
178
|
-
export type SessionMessageSender = "user" | "assistant";
|
|
179
|
-
/**
|
|
180
|
-
* One projected transcript message.
|
|
181
|
-
*
|
|
182
|
-
* Required-ness follows the wire rather than caution: the projection always
|
|
183
|
-
* emits `timestamp`, `sequence` and `content`, and declaring them optional made
|
|
184
|
-
* callers guard a case the server does not produce. The index signature is gone
|
|
185
|
-
* for the same reason the other twelve went — it let an undeclared field pass
|
|
186
|
-
* unnoticed, which is the thing the response schemas exist to catch.
|
|
187
|
-
*/
|
|
188
|
-
export interface SessionMessage {
|
|
189
|
-
readonly id: string;
|
|
190
|
-
readonly sender: SessionMessageSender;
|
|
191
|
-
readonly text: string;
|
|
192
|
-
readonly timestamp: string;
|
|
193
|
-
readonly sequence: number;
|
|
194
|
-
readonly content: readonly unknown[];
|
|
195
|
-
readonly turnSeq?: number;
|
|
196
|
-
readonly messageId?: string;
|
|
197
|
-
}
|
|
198
|
-
export interface SessionMessagesQuery {
|
|
199
|
-
readonly limit?: number;
|
|
200
|
-
readonly cursor?: string;
|
|
201
|
-
readonly since?: string;
|
|
202
|
-
}
|
|
203
|
-
export interface SessionMessagesPage {
|
|
204
|
-
readonly messages: readonly SessionMessage[];
|
|
205
|
-
readonly nextCursor?: string;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* The body every session state-change route answers with: suspend, cancel,
|
|
209
|
-
* resume, approve, deny and request-approval.
|
|
210
|
-
*
|
|
211
|
-
* The envelope is `{ session }` and NOTHING ELSE. It used to declare an optional
|
|
212
|
-
* `run` and `eventCursor`; no state-change handler has ever emitted either, and
|
|
213
|
-
* a declared-but-never-sent field is indistinguishable from a field the server
|
|
214
|
-
* dropped. The run-bearing envelope is {@link SessionMessageAccepted}, which is
|
|
215
|
-
* a different route.
|
|
216
|
-
*/
|
|
217
|
-
export interface SessionStateChangeAccepted {
|
|
218
|
-
readonly session: Session;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* `DELETE /api/sessions/{id}` — a 200 **with a body**, not a 204.
|
|
222
|
-
*
|
|
223
|
-
* Beyond the deleted session the server reports the footprint cleanup it
|
|
224
|
-
* attempted. That cleanup is best-effort: `cleanupComplete: false` means the
|
|
225
|
-
* session row is gone but some stored objects were not purged and a later sweep
|
|
226
|
-
* must finish the job, so a caller that needs the bytes actually gone has to
|
|
227
|
-
* read it.
|
|
228
|
-
*/
|
|
229
|
-
export interface SessionDeleteAccepted {
|
|
230
|
-
readonly session: Session;
|
|
231
|
-
/** How many stored session-file objects the delete purged. */
|
|
232
|
-
readonly purgedSessionFileObjects: number;
|
|
233
|
-
/** False when a cleanup leg failed and the footprint is only partly purged. */
|
|
234
|
-
readonly cleanupComplete: boolean;
|
|
235
|
-
}
|
|
236
|
-
/** The wire form of {@link SessionDeleteAccepted} (flat runtime fields on `session`). */
|
|
237
|
-
export type SessionDeleteResponseWire = z.infer<typeof SessionDeleteResponseSchema>;
|
|
238
|
-
export interface UsageSummary {
|
|
239
|
-
readonly inputTokens?: number;
|
|
240
|
-
readonly outputTokens?: number;
|
|
241
|
-
readonly cacheReadInputTokens?: number;
|
|
242
|
-
readonly cacheCreationInputTokens?: number;
|
|
243
|
-
readonly totalTokens?: number;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Project a {@link UsageSummary} from the terminal event's
|
|
247
|
-
* {@link SessionCostProviderUsage} entries — the SINGLE server source of token
|
|
248
|
-
* usage ({@link Session.costTelemetry}`.providerUsage`). Sums each field across all
|
|
249
|
-
* provider entries; a field is present only when at least one entry carried it.
|
|
250
|
-
* This retires the dead `session.usage` / `aex.usage`-event usage path: the SDK
|
|
251
|
-
* derives usage from cost telemetry, never re-reads a dual-written top-level
|
|
252
|
-
* `usage`. Pure.
|
|
253
|
-
*/
|
|
254
|
-
export declare function usageFromProviderUsage(providerUsage: readonly SessionCostProviderUsage[] | undefined): UsageSummary;
|
|
255
|
-
/** Consistent result exposed after a RUN_FINISHED or RUN_ERROR barrier. */
|
|
256
|
-
export interface TurnResult {
|
|
257
|
-
readonly status: SessionRunOutcome;
|
|
258
|
-
/** True only when the run completed successfully. */
|
|
259
|
-
readonly ok: boolean;
|
|
260
|
-
/** AEX showback estimate (USD, >= 0). Includes managed-gateway model tokens. */
|
|
261
|
-
readonly costUsd: number;
|
|
262
|
-
/** Aggregate token usage, derived from `costTelemetry.providerUsage`. */
|
|
263
|
-
readonly usage: UsageSummary;
|
|
264
|
-
/** Terminal failure message (from the terminal `RUN_ERROR` event) when `!ok`. */
|
|
265
|
-
readonly error?: string;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* The reason a schema-constrained decode did not yield a value:
|
|
269
|
-
* - `schema_violation` — the model output failed schema validation.
|
|
270
|
-
* - `uncertain` — the model signalled low confidence / declined to commit.
|
|
271
|
-
* - `refused` — the model refused the request.
|
|
272
|
-
*/
|
|
273
|
-
export type TurnRefusalReason = "schema_violation" | "uncertain" | "refused";
|
|
274
|
-
/**
|
|
275
|
-
* The typed outcome of a `start<T>({ responseFormat })`: EITHER a schema-valid
|
|
276
|
-
* decoded value OR a typed refusal — there is no untyped path that silently
|
|
277
|
-
* yields a hallucinated object. `T` is the decoded value type.
|
|
278
|
-
*/
|
|
279
|
-
export type TurnOutcome<T = unknown> = {
|
|
280
|
-
readonly kind: "decoded";
|
|
281
|
-
readonly value: T;
|
|
282
|
-
} | {
|
|
283
|
-
readonly kind: "refused";
|
|
284
|
-
readonly reason: TurnRefusalReason;
|
|
285
|
-
readonly detail?: string;
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* A subagent child session, enumerated under its parent via `GET /api/sessions/:id/children`.
|
|
289
|
-
* This is a read-only lineage snapshot. Its `id` addresses the child's events,
|
|
290
|
-
* checkpointed files, and descendants, but not the top-level session get/control
|
|
291
|
-
* routes.
|
|
292
|
-
*/
|
|
293
|
-
export interface ChildSessionRef {
|
|
294
|
-
readonly id: string;
|
|
295
|
-
/** The parent session this child was spawned by. */
|
|
296
|
-
readonly parentSessionId: string;
|
|
297
|
-
/** The child's session status. */
|
|
298
|
-
readonly status: SessionStatus;
|
|
299
|
-
/** Subagent nesting depth (1 = direct child of the top-level session). */
|
|
300
|
-
readonly depth?: number;
|
|
301
|
-
/** Final AEX showback estimate (USD) for the child, when present. */
|
|
302
|
-
readonly costUsd?: number;
|
|
303
|
-
readonly createdAt: string;
|
|
304
|
-
readonly updatedAt: string;
|
|
305
|
-
readonly terminalAt?: string | null;
|
|
306
|
-
readonly lastRun?: SessionRun;
|
|
307
|
-
}
|
|
308
|
-
/** Status of a run-terminal webhook delivery. Terminal: delivered/exhausted/invalid. */
|
|
309
|
-
export type SessionWebhookDeliveryStatus = "pending" | "delivering" | "retrying" | "delivered" | "exhausted" | "invalid";
|
|
310
|
-
/** CloudEvents type matching the finalized AG-UI run terminal. */
|
|
311
|
-
export type SessionRunWebhookEventType = "run.finished" | "run.error";
|
|
312
|
-
/** Public run facts frozen into every run-terminal webhook delivery. */
|
|
313
|
-
export interface SessionRunWebhookData {
|
|
314
|
-
readonly sessionId: string;
|
|
315
|
-
readonly runId: string;
|
|
316
|
-
readonly turnSeq: number;
|
|
317
|
-
readonly outcome: SessionRunOutcome;
|
|
318
|
-
readonly terminalAt: string;
|
|
319
|
-
readonly checkpoint?: import("./session-artifacts.js").SessionCheckpointRevision;
|
|
320
|
-
readonly reason: string | null;
|
|
321
|
-
readonly failureClass: string | null;
|
|
322
|
-
readonly costTelemetry?: {
|
|
323
|
-
readonly billedCostUsd: number;
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
interface SessionRunWebhookEnvelope {
|
|
327
|
-
readonly specversion: "1.0";
|
|
328
|
-
/** Deterministic run-scoped delivery id; also sent as the `webhook-id` header. */
|
|
329
|
-
readonly id: string;
|
|
330
|
-
readonly source: "aex";
|
|
331
|
-
/** The run id. Session/thread identity remains available as `data.sessionId`. */
|
|
332
|
-
readonly subject: string;
|
|
333
|
-
readonly time: string;
|
|
334
|
-
readonly data: SessionRunWebhookData;
|
|
335
|
-
}
|
|
336
|
-
/** Finalized successful run, mapped from AG-UI `RUN_FINISHED`. */
|
|
337
|
-
export interface SessionRunFinishedWebhookPayload extends SessionRunWebhookEnvelope {
|
|
338
|
-
readonly type: "run.finished";
|
|
339
|
-
}
|
|
340
|
-
/** Finalized unsuccessful run, mapped from AG-UI `RUN_ERROR`. */
|
|
341
|
-
export interface SessionRunErrorWebhookPayload extends SessionRunWebhookEnvelope {
|
|
342
|
-
readonly type: "run.error";
|
|
343
|
-
}
|
|
344
|
-
/** The no-alias public webhook envelope for a finalized session run. */
|
|
345
|
-
export type SessionRunWebhookPayload = SessionRunFinishedWebhookPayload | SessionRunErrorWebhookPayload;
|
|
346
|
-
/**
|
|
347
|
-
* One run-scoped row in a session's webhook delivery ledger. `id` is stable
|
|
348
|
-
* across retries and manual redelivery; `runId` + `turnSeq` identify which run
|
|
349
|
-
* produced the frozen payload. Optional attempt fields appear after delivery.
|
|
350
|
-
*/
|
|
351
|
-
export interface SessionWebhookDelivery {
|
|
352
|
-
readonly id: string;
|
|
353
|
-
readonly runId: string;
|
|
354
|
-
readonly turnSeq: number;
|
|
355
|
-
readonly eventType: SessionRunWebhookEventType;
|
|
356
|
-
readonly status: SessionWebhookDeliveryStatus;
|
|
357
|
-
readonly attemptCount: number;
|
|
358
|
-
readonly lastStatusCode?: number;
|
|
359
|
-
readonly lastError?: string;
|
|
360
|
-
readonly nextAttemptAt?: string;
|
|
361
|
-
readonly createdAt: string;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* One captured session file, as `GET /api/sessions/{id}/files` and the file-link
|
|
365
|
-
* route project it. Use `session.files.link(...)` to mint a temporary direct
|
|
366
|
-
* download URL.
|
|
367
|
-
*
|
|
368
|
-
* The workspace-relative path is `filename` here. The writer-token
|
|
369
|
-
* {@link ChildResultFile} projection of the same concept calls it `path` — two
|
|
370
|
-
* server projections of one thing that differ in exactly that key name.
|
|
371
|
-
*
|
|
372
|
-
* `filename`, `contentType` and `createdAt` are declared optional but the server
|
|
373
|
-
* sends all three unconditionally. They stay optional because this type doubles
|
|
374
|
-
* as a caller-supplied {@link SessionFileSelector}, where requiring metadata a
|
|
375
|
-
* caller does not have would make the selector unusable.
|
|
376
|
-
*/
|
|
377
|
-
export interface SessionFile {
|
|
378
|
-
readonly id: string;
|
|
379
|
-
/** Checkpoint this file record is pinned to. */
|
|
380
|
-
readonly checkpointId: string;
|
|
381
|
-
/** Workspace-relative path. Always sent by the server; see the note above. */
|
|
382
|
-
readonly filename?: string;
|
|
383
|
-
/** Exact byte length recorded by the committed checkpoint. */
|
|
384
|
-
readonly sizeBytes: number;
|
|
385
|
-
/** Lowercase SHA-256 digest of the committed bytes. */
|
|
386
|
-
readonly sha256: string;
|
|
387
|
-
readonly contentType?: string;
|
|
388
|
-
readonly createdAt?: string;
|
|
389
|
-
}
|
|
390
|
-
/** The wire form of {@link SessionFile}: every field unconditional. */
|
|
391
|
-
export type SessionFileWire = z.infer<typeof SessionFileSchema>;
|
|
392
|
-
/** A complete file listing and the immutable checkpoint it was read from. */
|
|
393
|
-
export interface SessionFilesSnapshot {
|
|
394
|
-
readonly revision: import("./session-artifacts.js").SessionCheckpointRevision;
|
|
395
|
-
readonly files: readonly SessionFile[];
|
|
396
|
-
}
|
|
397
|
-
export type SessionFilePathMatch = "exact" | "suffix";
|
|
398
|
-
export type SessionFileType = "text" | "json" | "image" | "audio" | "video" | "pdf" | "archive" | "binary" | "unknown";
|
|
399
|
-
export interface SessionFileQuery {
|
|
400
|
-
/** Exact normalized file path. Leading `/` and `files/` are ignored. */
|
|
401
|
-
readonly path?: string;
|
|
402
|
-
/** Basename match. A RegExp is tested against the basename only. */
|
|
403
|
-
readonly filename?: string | RegExp;
|
|
404
|
-
/**
|
|
405
|
-
* Directory prefix. Leading `/` and `files/` are ignored.
|
|
406
|
-
* `recursive` defaults to true.
|
|
407
|
-
*/
|
|
408
|
-
readonly dir?: string;
|
|
409
|
-
readonly recursive?: boolean;
|
|
410
|
-
/** File extension, with or without a leading dot. Case-insensitive. */
|
|
411
|
-
readonly extension?: string;
|
|
412
|
-
/** Exact content type or a prefix wildcard such as `image/*`. */
|
|
413
|
-
readonly contentType?: string;
|
|
414
|
-
/** High-level type inferred from content type first, then extension. */
|
|
415
|
-
readonly type?: SessionFileType;
|
|
416
|
-
}
|
|
417
|
-
/** File filters plus an optional immutable checkpoint selector. */
|
|
418
|
-
export interface SessionFilesQuery extends SessionFileQuery {
|
|
419
|
-
readonly checkpointId?: string;
|
|
420
|
-
}
|
|
421
|
-
export interface SessionFilePathSelector {
|
|
422
|
-
readonly path: string;
|
|
423
|
-
readonly match?: SessionFilePathMatch;
|
|
424
|
-
}
|
|
425
|
-
export interface SessionFileIdSelector {
|
|
426
|
-
readonly id: string;
|
|
427
|
-
readonly checkpointId: string;
|
|
428
|
-
}
|
|
429
|
-
export type SessionFileSelector = SessionFile | SessionFileIdSelector | SessionFilePathSelector;
|
|
430
|
-
export interface SessionFileDownload {
|
|
431
|
-
readonly file: SessionFile;
|
|
432
|
-
readonly bytes: Uint8Array;
|
|
433
|
-
}
|
|
434
|
-
/** Options for `session.files.read` / {@link import("./operations.js").readSessionFileText}. */
|
|
435
|
-
export interface ReadSessionFileTextOptions {
|
|
436
|
-
/** Checkpoint to read. Defaults to the selected file's checkpoint. */
|
|
437
|
-
readonly checkpointId?: string;
|
|
438
|
-
/**
|
|
439
|
-
* Stop reading after this many bytes. Defaults to 50_000; clamped server-side
|
|
440
|
-
* of the SDK to [1, 10_000_000]. The read streams and cancels once the cap is
|
|
441
|
-
* reached, so the remainder of a large file is never transferred.
|
|
442
|
-
*/
|
|
443
|
-
readonly maxBytes?: number;
|
|
444
|
-
/**
|
|
445
|
-
* Per-attempt timeout for fetching and reading the selected file body.
|
|
446
|
-
* Defaults to 30_000ms; idempotent file reads retry once on timeout before
|
|
447
|
-
* surfacing a structured NETWORK_ERROR.
|
|
448
|
-
*/
|
|
449
|
-
readonly timeoutMs?: number;
|
|
450
|
-
/**
|
|
451
|
-
* When set, return only the lines of the (capped) text matching this pattern.
|
|
452
|
-
* A string is matched literally (case-insensitive); a RegExp is used as given.
|
|
453
|
-
*/
|
|
454
|
-
readonly grep?: string | RegExp;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* A byte-capped, decoded text read of one session file, as returned by
|
|
458
|
-
* `session.files.read`. Built for feeding session deliverables to an LLM
|
|
459
|
-
* without loading the whole (possibly very large) file into memory or context:
|
|
460
|
-
* the read streams and stops at `maxBytes`, so `text` is at most that many bytes
|
|
461
|
-
* decoded as UTF-8. Check {@link truncated} before treating `text` as complete.
|
|
462
|
-
*/
|
|
463
|
-
export interface SessionFileText {
|
|
464
|
-
readonly file: SessionFile;
|
|
465
|
-
/** Decoded UTF-8, capped to the requested `maxBytes`. */
|
|
466
|
-
readonly text: string;
|
|
467
|
-
/** True when the file is larger than `maxBytes` (so `text` is a prefix). */
|
|
468
|
-
readonly truncated: boolean;
|
|
469
|
-
/** Exact full size recorded by the authoritative checkpoint. */
|
|
470
|
-
readonly totalBytes: number;
|
|
471
|
-
}
|
|
472
|
-
export type SessionFileLinkExpiresIn = number | "15m" | "1h" | "1d";
|
|
473
|
-
export interface SessionFileLinkOptions {
|
|
474
|
-
/** Seconds or one of the documented presets. Defaults to `"1h"`. */
|
|
475
|
-
readonly expiresIn?: SessionFileLinkExpiresIn;
|
|
476
|
-
/** Checkpoint to bind the signed link to. */
|
|
477
|
-
readonly checkpointId?: string;
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* A minted direct-download link, as the SDK returns it.
|
|
481
|
-
*
|
|
482
|
-
* `expiresAt` is NOT on the wire: the server sends `{ url, expiresInSeconds }`
|
|
483
|
-
* (plus `file` on the file-link route) and `sessionFileLink()` synthesises the
|
|
484
|
-
* absolute timestamp from the mint time — which is why it is required here and
|
|
485
|
-
* absent from {@link SessionFileLinkWire}. `file` is optional because the event
|
|
486
|
-
* archive link (`POST .../events/link`) mints a URL for a generated archive that
|
|
487
|
-
* has no file record.
|
|
488
|
-
*/
|
|
489
|
-
export interface SessionFileLink {
|
|
490
|
-
readonly url: string;
|
|
491
|
-
/** Synthesised client-side from the mint time; the server sends no absolute time. */
|
|
492
|
-
readonly expiresAt: string;
|
|
493
|
-
readonly expiresInSeconds: number;
|
|
494
|
-
/** The file the URL points at. Absent on the event-archive link. */
|
|
495
|
-
readonly file?: SessionFile;
|
|
496
|
-
}
|
|
497
|
-
/** `POST /api/sessions/{id}/files/{fileId}/link` exactly as served. */
|
|
498
|
-
export type SessionFileLinkWire = z.infer<typeof SessionFileLinkResponseSchema>;
|
|
499
|
-
/**
|
|
500
|
-
* Identity of a CONTROL-plane account principal (a PAT / device session),
|
|
501
|
-
* as returned by the dashboard BFF `GET /api/whoami` when the bearer is an
|
|
502
|
-
* account token (`aexu_...`). Distinct from {@link WhoAmI} (a data-plane
|
|
503
|
-
* workspace key): an account principal spans orgs and carries no workspace or
|
|
504
|
-
* data-plane limits. Used by `aex login --api-key <account PAT>` to validate a
|
|
505
|
-
* PAT before persisting it, and by any control-plane identity probe.
|
|
506
|
-
*/
|
|
507
|
-
export interface AccountWhoAmI {
|
|
508
|
-
readonly ok: true;
|
|
509
|
-
readonly principalType: "account_token";
|
|
510
|
-
/** The app user the token authenticates as. */
|
|
511
|
-
readonly appUserId: string;
|
|
512
|
-
readonly scopes: readonly string[];
|
|
513
|
-
/** Org the token is scoped to, when the server reports one. */
|
|
514
|
-
readonly orgId?: string;
|
|
515
|
-
readonly tokenId?: string;
|
|
516
|
-
readonly tokenName?: string;
|
|
517
|
-
/** e.g. `"account"` — the account-token kind reported by the server. */
|
|
518
|
-
readonly tokenKind?: string;
|
|
519
|
-
}
|
|
520
|
-
export interface WhoAmI {
|
|
521
|
-
readonly ok: true;
|
|
522
|
-
readonly principalType: "api_key";
|
|
523
|
-
/**
|
|
524
|
-
* The PUBLIC workspace id, `wsp_<32 hex>` — the handler renders it through
|
|
525
|
-
* `publicWorkspaceId`. {@link McpServerRecord.workspaceId} matches this;
|
|
526
|
-
* {@link BillingLedgerEntry.workspaceId} and {@link WorkspaceEraseResult} do
|
|
527
|
-
* NOT — they carry the raw id. One concept, two renderings on the same API.
|
|
528
|
-
*/
|
|
529
|
-
readonly workspaceId: string;
|
|
530
|
-
readonly scopes: readonly string[];
|
|
531
|
-
/**
|
|
532
|
-
* Authenticated runtime availability for this workspace. Optional only for
|
|
533
|
-
* compatibility with deployments predating capability discovery; when
|
|
534
|
-
* present it is validated as one complete, non-contradictory runtime set.
|
|
535
|
-
*/
|
|
536
|
-
readonly runtimeCapabilities?: RuntimeCapabilities;
|
|
537
|
-
/** Effective workspace limits from the same read models used by admission. */
|
|
538
|
-
readonly limits: {
|
|
539
|
-
/** Effective live-run concurrency cap. One more live run past it fails with `429 workspace_concurrency_exceeded`. */
|
|
540
|
-
readonly maxConcurrentSessions: number;
|
|
541
|
-
/** Effective submit-velocity cap per minute; `0` = unlimited (disabled). Past it: `429 workspace_submit_rate_exceeded`. */
|
|
542
|
-
readonly submitRatePerMinute: number;
|
|
543
|
-
/** Effective monthly spend cap in USD; `0` = unlimited. Once `monthSpendUsd` reaches it: `402 workspace_spend_cap_exceeded`. */
|
|
544
|
-
readonly spendCapUsd: number;
|
|
545
|
-
/** Accrued spend in the current UTC calendar month — the value the spend gate compares. */
|
|
546
|
-
readonly monthSpendUsd: number;
|
|
547
|
-
/** Prepaid credit balance in USD — one of the two things the credit gate compares. */
|
|
548
|
-
readonly balanceUsd: number;
|
|
549
|
-
/** Submit floor the balance is compared against; only meaningful when {@link creditGateActive}. */
|
|
550
|
-
readonly balanceGraceFloorUsd: number;
|
|
551
|
-
/**
|
|
552
|
-
* The OTHER half of the credit predicate: free model-usage allowance left
|
|
553
|
-
* this UTC month, in USD. A submit is admitted while EITHER this or
|
|
554
|
-
* {@link balanceUsd} is positive; both at zero is `402 insufficient_credits`.
|
|
555
|
-
*/
|
|
556
|
-
readonly llmTokenAllowanceRemainingUsd: number;
|
|
557
|
-
/** Whether the prepaid credit gate applies to this workspace. */
|
|
558
|
-
readonly creditGateActive: boolean;
|
|
559
|
-
readonly paymentMethodStatus: "none" | "active";
|
|
560
|
-
/** What the gates sized this workspace at — card presence is the lever, not a plan. */
|
|
561
|
-
readonly admissionState: BillingAdmissionState;
|
|
562
|
-
/** True when auto-recharge is on, i.e. exhaustion triggers a top-up instead of a 402. */
|
|
563
|
-
readonly autoTopupEnabled: boolean;
|
|
564
|
-
readonly accountType: "standard" | "internal";
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
/** The closed capability vocabulary a runtime profile declares. */
|
|
568
|
-
export declare const RUNTIME_CAPABILITY_NAMES: readonly ["toolExecution", "workspaceCheckpoint", "workspaceFileCapture", "streamingDeltas", "approvalGate", "postHook", "mcpTools", "scheduledWait", "customerSecrets", "containedEgress"];
|
|
569
|
-
export type RuntimeCapabilityName = (typeof RUNTIME_CAPABILITY_NAMES)[number];
|
|
570
|
-
/** Two states only. There is no partial state: a runtime performs a capability or refuses it. */
|
|
571
|
-
export type RuntimeCapabilityState = "supported" | "unsupported";
|
|
572
|
-
/**
|
|
573
|
-
* What one runtime will actually do. Runtime choice is not free of behavioral
|
|
574
|
-
* consequences and this contract does not pretend otherwise: a submission that
|
|
575
|
-
* exceeds the selected profile is refused before execution, never degraded.
|
|
576
|
-
*/
|
|
577
|
-
export interface RuntimeProfile {
|
|
578
|
-
readonly schemaVersion: 1;
|
|
579
|
-
readonly runtimeKind: RuntimeKind;
|
|
580
|
-
readonly capabilities: Readonly<Record<RuntimeCapabilityName, RuntimeCapabilityState>>;
|
|
581
|
-
readonly limits: {
|
|
582
|
-
/** Hard ceiling on one session's lifetime, in ms. */
|
|
583
|
-
readonly maxSessionMs: number;
|
|
584
|
-
/** Hard ceiling on ONE atomic LLM call or tool call, in ms. */
|
|
585
|
-
readonly maxSingleEffectMs: number;
|
|
586
|
-
/** Hard ceiling on the sandbox workspace, in bytes. */
|
|
587
|
-
readonly maxWorkspaceBytes: number;
|
|
588
|
-
readonly maxConcurrentToolCalls: number;
|
|
589
|
-
};
|
|
590
|
-
readonly delivery: {
|
|
591
|
-
/**
|
|
592
|
-
* `at-least-once` means a reclaim can replay an interrupted step, so a tool
|
|
593
|
-
* with an external side effect may run more than once.
|
|
594
|
-
*/
|
|
595
|
-
readonly toolExecution: "at-least-once" | "exactly-once";
|
|
596
|
-
readonly coldStartClass: "warm" | "cold-seconds" | "cold-tens-of-seconds";
|
|
597
|
-
/** `zero` bills nothing while a session is parked or waiting. */
|
|
598
|
-
readonly idleBilling: "wall-clock" | "zero";
|
|
599
|
-
};
|
|
600
|
-
readonly computeBasis: "wall_clock" | "microvm_running";
|
|
601
|
-
}
|
|
602
|
-
export interface RuntimeCapabilities {
|
|
603
|
-
readonly schemaVersion: 1;
|
|
604
|
-
readonly capabilityVersion: string;
|
|
605
|
-
readonly capabilityHash: `sha256:${string}`;
|
|
606
|
-
readonly availableRuntimeKinds: readonly RuntimeKind[];
|
|
607
|
-
readonly sizesByRuntimeKind: Partial<Record<RuntimeKind, readonly RuntimeSize[]>>;
|
|
608
|
-
readonly unavailable: Partial<Record<RuntimeKind, {
|
|
609
|
-
readonly code: string;
|
|
610
|
-
}>>;
|
|
611
|
-
/**
|
|
612
|
-
* TOTAL over every runtime kind, including ones this workspace may not name.
|
|
613
|
-
* Availability and capability are different questions: deciding whether to ask
|
|
614
|
-
* for access to a runtime requires knowing what it would do for you.
|
|
615
|
-
*/
|
|
616
|
-
readonly profilesByRuntimeKind: Record<RuntimeKind, RuntimeProfile>;
|
|
617
|
-
}
|
|
618
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/** Public run phases. Internal finalization remains behind the consistency barrier. */
|
|
2
|
-
export const SESSION_RUN_PHASES = [
|
|
3
|
-
"queued",
|
|
4
|
-
"starting",
|
|
5
|
-
"running",
|
|
6
|
-
"finished",
|
|
7
|
-
"error"
|
|
8
|
-
];
|
|
9
|
-
/**
|
|
10
|
-
* Project a {@link UsageSummary} from the terminal event's
|
|
11
|
-
* {@link SessionCostProviderUsage} entries — the SINGLE server source of token
|
|
12
|
-
* usage ({@link Session.costTelemetry}`.providerUsage`). Sums each field across all
|
|
13
|
-
* provider entries; a field is present only when at least one entry carried it.
|
|
14
|
-
* This retires the dead `session.usage` / `aex.usage`-event usage path: the SDK
|
|
15
|
-
* derives usage from cost telemetry, never re-reads a dual-written top-level
|
|
16
|
-
* `usage`. Pure.
|
|
17
|
-
*/
|
|
18
|
-
export function usageFromProviderUsage(providerUsage) {
|
|
19
|
-
if (!providerUsage || providerUsage.length === 0)
|
|
20
|
-
return {};
|
|
21
|
-
let inputTokens;
|
|
22
|
-
let outputTokens;
|
|
23
|
-
let cacheReadInputTokens;
|
|
24
|
-
let cacheCreationInputTokens;
|
|
25
|
-
let totalTokens;
|
|
26
|
-
const add = (acc, value) => value === undefined ? acc : (acc ?? 0) + value;
|
|
27
|
-
for (const entry of providerUsage) {
|
|
28
|
-
inputTokens = add(inputTokens, entry.inputTokens);
|
|
29
|
-
outputTokens = add(outputTokens, entry.outputTokens);
|
|
30
|
-
cacheReadInputTokens = add(cacheReadInputTokens, entry.cacheReadInputTokens);
|
|
31
|
-
cacheCreationInputTokens = add(cacheCreationInputTokens, entry.cacheCreationInputTokens);
|
|
32
|
-
totalTokens = add(totalTokens, entry.totalTokens);
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
...(inputTokens !== undefined ? { inputTokens } : {}),
|
|
36
|
-
...(outputTokens !== undefined ? { outputTokens } : {}),
|
|
37
|
-
...(cacheReadInputTokens !== undefined ? { cacheReadInputTokens } : {}),
|
|
38
|
-
...(cacheCreationInputTokens !== undefined ? { cacheCreationInputTokens } : {}),
|
|
39
|
-
...(totalTokens !== undefined ? { totalTokens } : {})
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/** The closed capability vocabulary a runtime profile declares. */
|
|
43
|
-
export const RUNTIME_CAPABILITY_NAMES = [
|
|
44
|
-
"toolExecution",
|
|
45
|
-
"workspaceCheckpoint",
|
|
46
|
-
"workspaceFileCapture",
|
|
47
|
-
"streamingDeltas",
|
|
48
|
-
"approvalGate",
|
|
49
|
-
"postHook",
|
|
50
|
-
"mcpTools",
|
|
51
|
-
"scheduledWait",
|
|
52
|
-
"customerSecrets",
|
|
53
|
-
"containedEgress"
|
|
54
|
-
];
|
|
55
|
-
// The ACCOUNT and WORKSPACE-MANAGEMENT record types — workspace secret
|
|
56
|
-
// metadata, billing, the control-plane org/workspace/API-key surface, and the
|
|
57
|
-
// response-derived route families — live in `account-types.ts`. Same public
|
|
58
|
-
// barrel, different file: this module stays about the session lifecycle.
|