@aexhq/sdk 0.40.15 → 0.41.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/README.md +25 -25
- package/dist/_contracts/api-key.d.ts +6 -4
- package/dist/_contracts/api-key.js +20 -7
- package/dist/_contracts/asset-upload-helper.d.ts +2 -2
- package/dist/_contracts/asset-upload-helper.js +2 -2
- package/dist/_contracts/connection-ticket.d.ts +5 -5
- package/dist/_contracts/connection-ticket.js +7 -7
- package/dist/_contracts/error-codes.d.ts +1 -1
- package/dist/_contracts/error-codes.js +4 -4
- package/dist/_contracts/error-factory.js +1 -1
- package/dist/_contracts/event-envelope.d.ts +41 -41
- package/dist/_contracts/event-envelope.js +49 -49
- package/dist/_contracts/event-stream-client.d.ts +9 -9
- package/dist/_contracts/event-stream-client.js +5 -5
- package/dist/_contracts/event-view.d.ts +6 -6
- package/dist/_contracts/event-view.js +12 -12
- package/dist/_contracts/http.js +1 -1
- package/dist/_contracts/index.d.ts +10 -10
- package/dist/_contracts/index.js +9 -9
- package/dist/_contracts/models.d.ts +17 -17
- package/dist/_contracts/models.js +14 -14
- package/dist/_contracts/operations.d.ts +79 -82
- package/dist/_contracts/operations.js +233 -243
- package/dist/_contracts/provider-support.d.ts +2 -2
- package/dist/_contracts/runner-event.d.ts +8 -8
- package/dist/_contracts/runner-event.js +9 -9
- package/dist/_contracts/runtime-manifest.d.ts +12 -12
- package/dist/_contracts/runtime-manifest.js +1 -1
- package/dist/_contracts/runtime-sizes.d.ts +12 -12
- package/dist/_contracts/runtime-sizes.js +18 -18
- package/dist/_contracts/runtime-types.d.ts +117 -117
- package/dist/_contracts/runtime-types.js +2 -2
- package/dist/_contracts/sdk-errors.d.ts +3 -3
- package/dist/_contracts/sdk-errors.js +4 -4
- package/dist/_contracts/sdk-secrets.js +10 -10
- package/dist/_contracts/session-artifacts.d.ts +151 -0
- package/dist/_contracts/session-artifacts.js +234 -0
- package/dist/_contracts/{run-config.d.ts → session-config.d.ts} +29 -29
- package/dist/_contracts/{run-config.js → session-config.js} +37 -37
- package/dist/_contracts/session-cost.d.ts +140 -0
- package/dist/_contracts/{run-cost.js → session-cost.js} +94 -94
- package/dist/_contracts/{run-custody.d.ts → session-custody.d.ts} +16 -16
- package/dist/_contracts/{run-custody.js → session-custody.js} +42 -42
- package/dist/_contracts/session-record.d.ts +112 -0
- package/dist/_contracts/{run-record.js → session-record.js} +23 -23
- package/dist/_contracts/session-retention.d.ts +209 -0
- package/dist/_contracts/{run-retention.js → session-retention.js} +116 -116
- package/dist/_contracts/{run-unit.d.ts → session-unit.d.ts} +38 -38
- package/dist/_contracts/{run-unit.js → session-unit.js} +33 -33
- package/dist/_contracts/side-effect-audit.d.ts +14 -14
- package/dist/_contracts/side-effect-audit.js +38 -38
- package/dist/_contracts/sse.d.ts +1 -1
- package/dist/_contracts/sse.js +0 -0
- package/dist/_contracts/stable.d.ts +1 -1
- package/dist/_contracts/stable.js +1 -1
- package/dist/_contracts/status.d.ts +18 -18
- package/dist/_contracts/status.js +19 -19
- package/dist/_contracts/submission.d.ts +101 -99
- package/dist/_contracts/submission.js +96 -96
- package/dist/_contracts/{run-trace.d.ts → turn-trace.d.ts} +1 -1
- package/dist/_contracts/webhook-verify.d.ts +1 -1
- package/dist/_contracts/webhook-verify.js +1 -1
- package/dist/agents-md.d.ts +4 -4
- package/dist/agents-md.js +5 -5
- package/dist/agents-md.js.map +1 -1
- package/dist/bundle.d.ts +1 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/dist/cli.mjs +580 -623
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +141 -155
- package/dist/client.js +236 -245
- package/dist/client.js.map +1 -1
- package/dist/fetch-archive.js +3 -3
- package/dist/file.d.ts +7 -7
- package/dist/file.js +8 -8
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.d.ts +1 -1
- package/dist/retry.d.ts +1 -1
- package/dist/secret.d.ts +6 -6
- package/dist/secret.js +6 -6
- package/dist/secret.js.map +1 -1
- package/dist/skill.d.ts +2 -2
- package/dist/skill.js +3 -3
- package/dist/skill.js.map +1 -1
- package/dist/tool.js +2 -2
- package/dist/tool.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/docs/authentication.md +11 -11
- package/docs/billing.md +3 -3
- package/docs/cleanup.md +5 -5
- package/docs/concepts/agent-tools.md +5 -5
- package/docs/concepts/composition.md +3 -3
- package/docs/concepts/providers-and-runtimes.md +3 -3
- package/docs/concepts/{runs.md → sessions.md} +8 -8
- package/docs/concepts/subagents.md +16 -16
- package/docs/credentials.md +7 -7
- package/docs/defaults.md +14 -14
- package/docs/errors.md +10 -10
- package/docs/events.md +26 -26
- package/docs/files.md +267 -0
- package/docs/limits-and-quotas.md +35 -35
- package/docs/limits.md +6 -6
- package/docs/mcp.md +3 -3
- package/docs/networking.md +24 -24
- package/docs/provider-runtime-capabilities.md +1 -1
- package/docs/public-surface.json +6 -6
- package/docs/quickstart.md +13 -13
- package/docs/release.md +5 -5
- package/docs/retries.md +3 -3
- package/docs/secrets.md +16 -16
- package/docs/session-config.md +58 -0
- package/docs/{run-record.md → session-record.md} +16 -16
- package/docs/skills.md +9 -9
- package/docs/vision-skills.md +7 -7
- package/docs/webhooks.md +11 -11
- package/examples/feature-tour.ts +17 -17
- package/examples/spike-settle-latency.ts +11 -11
- package/package.json +1 -1
- package/dist/_contracts/run-artifacts.d.ts +0 -49
- package/dist/_contracts/run-artifacts.js +0 -102
- package/dist/_contracts/run-cost.d.ts +0 -140
- package/dist/_contracts/run-record.d.ts +0 -116
- package/dist/_contracts/run-retention.d.ts +0 -209
- package/docs/outputs.md +0 -267
- package/docs/run-config.md +0 -58
- /package/dist/_contracts/{run-trace.js → turn-trace.js} +0 -0
package/dist/cli.mjs.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b55fdfa4ea2269e666c3232ae406e9f691422193792a6258af7373ce2756d31e cli.mjs
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpClient, SecretString, type AexEventView, type AgentsMdRecord, type ApprovalGate, type BatchResult, type BillingCheckoutRequest, type BillingHostedSession, type BillingLedgerPage, type BillingLedgerQuery, type BillingPortalRequest, type BillingSummary, type
|
|
1
|
+
import { HttpClient, SecretString, type AexEventView, type AgentsMdRecord, type ApprovalGate, type BatchResult, type BillingCheckoutRequest, type BillingHostedSession, type BillingLedgerPage, type BillingLedgerQuery, type BillingPortalRequest, type BillingSummary, type ChildSessionRef, type DebugSink, type FetchLike, type FileRecord, type SessionFile, type SessionFileType, type SessionFileLink, type SessionFileLinkOptions, type SessionFileQuery, type SessionFileText, type OutputMode, type ReadSessionFileTextOptions, type ResponseFormat, type SessionFileSearchQuery, type SessionFileSearchPage, type TurnOutcome, type Session, type SessionCreateRequest, type SessionListPage, type SessionListQuery, type SessionMessage, type SessionStateChangeAccepted, type SessionTerminalOutcome, type SessionTurn, type SettledResult, type PlatformEnvironmentInput, type PlatformSubmission, type SessionRecord, type ModelName, type TurnTrace, type SessionWebhookDelivery, type ProviderName, type SecretRecord, type SessionUnit, type BuiltinToolName, type RuntimeSize, type SkillRecord, type WebhookSigningSecret, type WebSocketFactory, type WhoAmI } from "./_contracts/index.js";
|
|
2
2
|
import { AgentsMd } from "./agents-md.js";
|
|
3
3
|
import { type UploadedAsset } from "./asset-upload.js";
|
|
4
4
|
import { File, type ZipStreamDriver } from "./file.js";
|
|
@@ -28,7 +28,7 @@ export interface AexOptions {
|
|
|
28
28
|
* Built-in transport retry policy. Every BFF request is retried on transient
|
|
29
29
|
* failures (HTTP 429/500/502/503/504/529 and network errors) with bounded
|
|
30
30
|
* exponential backoff + jitter, honoring `Retry-After`. Billable submits carry
|
|
31
|
-
* a stable idempotency key, so a retry never creates a duplicate billable
|
|
31
|
+
* a stable idempotency key, so a retry never creates a duplicate billable session turn.
|
|
32
32
|
*
|
|
33
33
|
* Omit for sensible defaults (4 attempts, ~2 min budget); pass an object to
|
|
34
34
|
* tune `maxAttempts` / delays / `maxElapsedMs`; pass `false` to disable.
|
|
@@ -36,26 +36,24 @@ export interface AexOptions {
|
|
|
36
36
|
readonly retry?: RetryOptions | false;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* The unified SETTLED result of {@link Aex.
|
|
40
|
-
* {@link SettledResult} (the ONE settled shape `
|
|
39
|
+
* The unified SETTLED result of {@link Aex.start}. Extends the contracts
|
|
40
|
+
* {@link SettledResult} (the ONE settled shape `start()` and `done()` share), so
|
|
41
41
|
* the terminal `status` (a {@link SessionTerminalOutcome}), `ok`, `costUsd`
|
|
42
|
-
* (`number`, `>= 0`), and `usage` are ALWAYS present — `
|
|
43
|
-
* commit by default. Adds the one-shot conveniences: the
|
|
44
|
-
* events, decoded trace, assistant text, and captured
|
|
42
|
+
* (`number`, `>= 0`), and `usage` are ALWAYS present — `start()` awaits the settle
|
|
43
|
+
* commit by default. Adds the one-shot conveniences: the session-record-compatible record,
|
|
44
|
+
* events, decoded trace, assistant text, and captured files.
|
|
45
45
|
*
|
|
46
|
-
* `T` is the `responseFormat` decode type: when the
|
|
46
|
+
* `T` is the `responseFormat` decode type: when the session was submitted with a
|
|
47
47
|
* `json_schema` `responseFormat`, {@link outcome} carries the typed decoded
|
|
48
48
|
* value or a typed refusal.
|
|
49
49
|
*/
|
|
50
|
-
export interface
|
|
51
|
-
readonly
|
|
52
|
-
/**
|
|
53
|
-
readonly
|
|
54
|
-
/** Run-compatible view of the underlying session record. */
|
|
55
|
-
readonly run: Run;
|
|
50
|
+
export interface SessionResult<T = unknown> extends SettledResult {
|
|
51
|
+
readonly sessionId: string;
|
|
52
|
+
/** Session-record view of the underlying session. */
|
|
53
|
+
readonly record: SessionRecord;
|
|
56
54
|
/** The underlying resumable session record (its lifecycle `status` is idle/suspended when resumable). */
|
|
57
55
|
readonly session?: Session;
|
|
58
|
-
/** The turn accepted for this one-shot
|
|
56
|
+
/** The turn accepted for this one-shot session. */
|
|
59
57
|
readonly turn?: SessionTurn;
|
|
60
58
|
/** The assistant's final text. */
|
|
61
59
|
readonly text: string;
|
|
@@ -64,27 +62,27 @@ export interface RunResult<T = unknown> extends SettledResult {
|
|
|
64
62
|
/** The session turn event stream — each event carries the `is*()` type-guard methods. */
|
|
65
63
|
readonly events: readonly AexEventView[];
|
|
66
64
|
/** Decoded view of the events: tool calls + usage + assistant text. */
|
|
67
|
-
readonly trace:
|
|
68
|
-
/** The
|
|
69
|
-
readonly
|
|
65
|
+
readonly trace: TurnTrace;
|
|
66
|
+
/** The session's captured files. */
|
|
67
|
+
readonly files: readonly SessionFile[];
|
|
70
68
|
/**
|
|
71
|
-
* The typed schema-decode outcome — present only when the
|
|
69
|
+
* The typed schema-decode outcome — present only when the session was submitted
|
|
72
70
|
* with a `json_schema` `responseFormat`: `{ kind:'decoded', value }` or
|
|
73
71
|
* `{ kind:'refused', reason }`. There is no untyped path that yields a
|
|
74
72
|
* hallucinated object.
|
|
75
73
|
*/
|
|
76
|
-
readonly outcome?:
|
|
74
|
+
readonly outcome?: TurnOutcome<T>;
|
|
77
75
|
}
|
|
78
76
|
/** How a one-shot / turn resolves: at the render-complete park, or (default) at the settle commit. */
|
|
79
77
|
export type SettleAwait = "park" | "settle";
|
|
80
|
-
/** Options for {@link Aex.
|
|
81
|
-
export interface
|
|
78
|
+
/** Options for {@link Aex.start}. */
|
|
79
|
+
export interface StartSessionOptions {
|
|
82
80
|
/** Overall wait budget (ms) for the one-shot session turn to park. */
|
|
83
81
|
readonly timeoutMs?: number;
|
|
84
82
|
readonly webSocketFactory?: WebSocketFactory;
|
|
85
83
|
readonly idleTimeoutMs?: number;
|
|
86
84
|
readonly pingIntervalMs?: number;
|
|
87
|
-
/** Throw a {@link
|
|
85
|
+
/** Throw a {@link SessionStateError} when the session does not succeed. Default false. */
|
|
88
86
|
readonly throwOnFailure?: boolean;
|
|
89
87
|
/**
|
|
90
88
|
* When the result resolves. `'settle'` (DEFAULT) waits (bounded) for the
|
|
@@ -95,9 +93,9 @@ export interface RunCollectOptions {
|
|
|
95
93
|
*/
|
|
96
94
|
readonly await?: SettleAwait;
|
|
97
95
|
}
|
|
98
|
-
/** The result of {@link Aex.submit}: the
|
|
96
|
+
/** The result of {@link Aex.submit}: the session id + a resumable session handle. */
|
|
99
97
|
export interface SubmitResult {
|
|
100
|
-
readonly
|
|
98
|
+
readonly sessionId: string;
|
|
101
99
|
readonly session: SessionHandle;
|
|
102
100
|
}
|
|
103
101
|
/** Options for {@link Aex.batch}. */
|
|
@@ -117,7 +115,7 @@ export interface SessionOverrides {
|
|
|
117
115
|
readonly timeout?: string;
|
|
118
116
|
readonly maxSpendUsd?: number;
|
|
119
117
|
/**
|
|
120
|
-
* Per-
|
|
118
|
+
* Per-session iteration cap (agent loop turns). Defaults + ceiling are enforced
|
|
121
119
|
* server-side; omit to accept the platform default. A positive integer.
|
|
122
120
|
*/
|
|
123
121
|
readonly maxTurns?: number;
|
|
@@ -148,12 +146,12 @@ export interface SessionCreateOptions {
|
|
|
148
146
|
* {@link Providers} symbol const, e.g. `provider: Providers.DEEPSEEK`. When
|
|
149
147
|
* omitted it is derived from `model`; if supplied it MUST serve the model.
|
|
150
148
|
*/
|
|
151
|
-
readonly provider?:
|
|
149
|
+
readonly provider?: ProviderName;
|
|
152
150
|
/**
|
|
153
151
|
* Closed public model id. Prefer the {@link Models} symbol const, e.g.
|
|
154
152
|
* `Models.CLAUDE_HAIKU_4_5`.
|
|
155
153
|
*/
|
|
156
|
-
readonly model:
|
|
154
|
+
readonly model: ModelName;
|
|
157
155
|
readonly system?: string;
|
|
158
156
|
/**
|
|
159
157
|
* Tools available to the agent. Each entry is a custom {@link Tool} bundle or
|
|
@@ -171,11 +169,11 @@ export interface SessionCreateOptions {
|
|
|
171
169
|
readonly files?: readonly File[];
|
|
172
170
|
readonly mcpServers?: readonly McpServer[];
|
|
173
171
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* roots narrow capture
|
|
172
|
+
* File capture policy for the session's captured files. Omit `allowedDirs`
|
|
173
|
+
* to expose regular workspace files from the latest complete checkpoint;
|
|
174
|
+
* listed roots narrow capture, and `deniedDirs` subtracts noise.
|
|
177
175
|
*/
|
|
178
|
-
readonly
|
|
176
|
+
readonly fileCapture?: {
|
|
179
177
|
readonly allowedDirs?: readonly string[];
|
|
180
178
|
readonly deniedDirs?: readonly string[];
|
|
181
179
|
readonly captureTimeoutMs?: number;
|
|
@@ -205,7 +203,7 @@ export interface SessionCreateOptions {
|
|
|
205
203
|
* Structured-output policy. `{ kind:'text' }` (default) is free-form;
|
|
206
204
|
* `{ kind:'json_schema', schema, strict?, name? }` requests provider-native
|
|
207
205
|
* constrained decode against `schema`. The typed outcome is read from
|
|
208
|
-
* `
|
|
206
|
+
* `start<T>()`'s `result.outcome` (`{ kind:'decoded', value }` or
|
|
209
207
|
* `{ kind:'refused', reason }`) — never an untyped hallucinated object.
|
|
210
208
|
*/
|
|
211
209
|
readonly responseFormat?: ResponseFormat;
|
|
@@ -219,7 +217,7 @@ export interface SessionCreateOptions {
|
|
|
219
217
|
readonly metadata?: PlatformSubmission["metadata"];
|
|
220
218
|
readonly idempotencyKey?: string;
|
|
221
219
|
/** BYOK provider key(s), keyed by provider. */
|
|
222
|
-
readonly apiKeys?: Partial<Record<
|
|
220
|
+
readonly apiKeys?: Partial<Record<ProviderName, string>>;
|
|
223
221
|
readonly environment?: SessionEnvironmentOptions;
|
|
224
222
|
/**
|
|
225
223
|
* Managed runtime size. One of the closed {@link RuntimeSize} preset tokens.
|
|
@@ -250,7 +248,7 @@ export interface SessionSendOptions {
|
|
|
250
248
|
*/
|
|
251
249
|
readonly await?: SettleAwait;
|
|
252
250
|
}
|
|
253
|
-
export interface
|
|
251
|
+
export interface SessionStartOptions extends SessionCreateOptions {
|
|
254
252
|
readonly message: SessionInput;
|
|
255
253
|
readonly deleteAfter?: boolean;
|
|
256
254
|
readonly messageIdempotencyKey?: string;
|
|
@@ -259,7 +257,7 @@ export interface SessionRunOptions extends SessionCreateOptions {
|
|
|
259
257
|
/**
|
|
260
258
|
* The unified SETTLED result of one turn (`session.send(...).done()`). Extends
|
|
261
259
|
* the contracts {@link SettledResult}, so `done()` returns the SAME shape as
|
|
262
|
-
* `
|
|
260
|
+
* `start()`: the terminal `status` (a {@link SessionTerminalOutcome}), `ok`,
|
|
263
261
|
* `costUsd`, and `usage` are always present (the turn awaits settle by default).
|
|
264
262
|
*/
|
|
265
263
|
export interface SessionTurnResult<T = unknown> extends SettledResult {
|
|
@@ -268,16 +266,16 @@ export interface SessionTurnResult<T = unknown> extends SettledResult {
|
|
|
268
266
|
readonly turn: SessionTurn;
|
|
269
267
|
readonly text: string;
|
|
270
268
|
readonly events: readonly AexEventView[];
|
|
271
|
-
readonly
|
|
269
|
+
readonly files: readonly SessionFile[];
|
|
272
270
|
readonly messages: readonly Message[];
|
|
273
271
|
/** The typed schema-decode outcome when a `json_schema` `responseFormat` was set. */
|
|
274
|
-
readonly outcome?:
|
|
272
|
+
readonly outcome?: TurnOutcome<T>;
|
|
275
273
|
}
|
|
276
|
-
export interface
|
|
274
|
+
export interface SessionStartResult extends SessionTurnResult {
|
|
277
275
|
}
|
|
278
276
|
export declare class SessionTurnStream implements AsyncIterable<AexEventView> {
|
|
279
277
|
#private;
|
|
280
|
-
constructor(
|
|
278
|
+
constructor(stream: () => AsyncGenerator<AexEventView, SessionTurnResult, void>);
|
|
281
279
|
[Symbol.asyncIterator](): AsyncIterator<AexEventView>;
|
|
282
280
|
done(): Promise<SessionTurnResult>;
|
|
283
281
|
}
|
|
@@ -307,40 +305,40 @@ export interface SessionEvents {
|
|
|
307
305
|
first(): Promise<AexEventView | undefined>;
|
|
308
306
|
stream(options?: StreamEventsOptions): AsyncIterable<AexEventView>;
|
|
309
307
|
streamEnvelopes(options?: StreamEnvelopesOptions): AsyncIterable<AexEventView>;
|
|
310
|
-
archiveLink(options?:
|
|
308
|
+
archiveLink(options?: SessionFileLinkOptions): Promise<SessionFileLink>;
|
|
311
309
|
/** Download the events-namespace archive as a zip. */
|
|
312
|
-
download(options?:
|
|
310
|
+
download(options?: DownloadOptions): Promise<Uint8Array>;
|
|
313
311
|
}
|
|
314
312
|
/**
|
|
315
|
-
* Accessor over the session's captured
|
|
313
|
+
* Accessor over the session's captured files (`session.files()`):
|
|
316
314
|
* enumerate, read one as capped text, locate/resolve, and download.
|
|
317
315
|
*/
|
|
318
|
-
export interface
|
|
319
|
-
list(query?:
|
|
320
|
-
last(): Promise<
|
|
321
|
-
first(): Promise<
|
|
322
|
-
read(selector:
|
|
323
|
-
find(query:
|
|
324
|
-
findOne(query:
|
|
325
|
-
/**
|
|
326
|
-
* Search THIS session's captured
|
|
316
|
+
export interface SessionFiles {
|
|
317
|
+
list(query?: SessionFileQuery): Promise<readonly SessionFile[]>;
|
|
318
|
+
last(): Promise<SessionFile | undefined>;
|
|
319
|
+
first(): Promise<SessionFile | undefined>;
|
|
320
|
+
read(selector: SessionFileSelector, options?: ReadSessionFileTextOptions): Promise<SessionFileText>;
|
|
321
|
+
find(query: SessionFileQuery): Promise<readonly SessionFile[]>;
|
|
322
|
+
findOne(query: SessionFileQuery): Promise<SessionFile | null>;
|
|
323
|
+
/**
|
|
324
|
+
* Search THIS session's captured files by filename (`string | RegExp`) /
|
|
327
325
|
* extension / content type. Metadata-only (reference hits, no bytes). A
|
|
328
326
|
* content-shaped query throws a typed "content search unsupported" rather than
|
|
329
327
|
* silently returning 0 hits.
|
|
330
328
|
*/
|
|
331
|
-
search(query?:
|
|
332
|
-
link(selectorOrQuery:
|
|
333
|
-
fetch(selectorOrQuery:
|
|
334
|
-
/** No selector =
|
|
335
|
-
download(selector?:
|
|
329
|
+
search(query?: PerSessionFileSearchQuery): Promise<SessionFileSearchPage>;
|
|
330
|
+
link(selectorOrQuery: SessionFileLinkSelector, options?: SessionFileLinkOptions): Promise<SessionFileLink>;
|
|
331
|
+
fetch(selectorOrQuery: SessionFileLinkSelector, options?: SessionFileLinkOptions): Promise<Response>;
|
|
332
|
+
/** No selector = files-namespace zip; with selector = one file's raw bytes. */
|
|
333
|
+
download(selector?: SessionFileSelector, options?: DownloadOptions): Promise<Uint8Array>;
|
|
336
334
|
}
|
|
337
|
-
/** A per-session
|
|
338
|
-
export type
|
|
335
|
+
/** A per-session file search — {@link SessionFileSearchQuery} without the cross-session `sessionIds` corpus. */
|
|
336
|
+
export type PerSessionFileSearchQuery = Omit<SessionFileSearchQuery, "sessionIds">;
|
|
339
337
|
/**
|
|
340
338
|
* Accessor over the session's webhook delivery ledger (`session.webhooks()`).
|
|
341
339
|
*/
|
|
342
340
|
export interface SessionWebhooks {
|
|
343
|
-
list(): Promise<readonly
|
|
341
|
+
list(): Promise<readonly SessionWebhookDelivery[]>;
|
|
344
342
|
redeliver(deliveryId: string): Promise<void>;
|
|
345
343
|
}
|
|
346
344
|
export declare class SessionHandle {
|
|
@@ -373,12 +371,12 @@ export declare class SessionHandle {
|
|
|
373
371
|
/** Deny an `awaiting_approval` session so the held turn is cancelled (→ cancelled). */
|
|
374
372
|
deny(options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<SessionStateChangeAccepted>;
|
|
375
373
|
/**
|
|
376
|
-
* Enumerate this
|
|
377
|
-
* a {@link
|
|
374
|
+
* Enumerate this session's subagent CHILD sessions (`GET /sessions/:id/children`). Each is
|
|
375
|
+
* a {@link ChildSessionHandle} backed by the RUN facade (getSessionRecord/events/files) —
|
|
378
376
|
* NOT `openSession` — so every child the platform hands you is resolvable, with
|
|
379
|
-
* its lineage (`
|
|
377
|
+
* its lineage (`parentSessionId`/`depth`) and terminal outcome exposed.
|
|
380
378
|
*/
|
|
381
|
-
children(): Promise<readonly
|
|
379
|
+
children(): Promise<readonly ChildSessionHandle[]>;
|
|
382
380
|
/**
|
|
383
381
|
* Accessor for the session's assistant messages. `all()` returns them
|
|
384
382
|
* oldest-first; `last()`/`first()` return a single entry or `undefined` when
|
|
@@ -394,12 +392,12 @@ export declare class SessionHandle {
|
|
|
394
392
|
*/
|
|
395
393
|
events(): SessionEvents;
|
|
396
394
|
/**
|
|
397
|
-
* Accessor for the session's captured
|
|
395
|
+
* Accessor for the session's captured files: `list`/`last`/`first`
|
|
398
396
|
* enumerate them; `read` streams one as capped text; `find`/`findOne`/`link`/
|
|
399
|
-
* `fetch` locate and resolve them; `download` fetches the
|
|
397
|
+
* `fetch` locate and resolve them; `download` fetches the files-namespace
|
|
400
398
|
* zip (no selector) or one file's raw bytes (with selector).
|
|
401
399
|
*/
|
|
402
|
-
|
|
400
|
+
files(): SessionFiles;
|
|
403
401
|
/**
|
|
404
402
|
* Accessor for the session's webhook delivery ledger: `list()` returns the
|
|
405
403
|
* delivery attempts; `redeliver(id)` re-sends the frozen payload under the
|
|
@@ -410,31 +408,31 @@ export declare class SessionHandle {
|
|
|
410
408
|
refresh(): Promise<Session>;
|
|
411
409
|
/**
|
|
412
410
|
* Poll the session record until it reaches a parked/terminal status (idle,
|
|
413
|
-
* suspended, error, or any terminal
|
|
411
|
+
* suspended, error, or any terminal session status). Throws if `timeoutMs`
|
|
414
412
|
* elapses first. Updates the stored record.
|
|
415
413
|
*/
|
|
416
|
-
wait(options?:
|
|
414
|
+
wait(options?: WaitForSessionOptions): Promise<Session>;
|
|
417
415
|
/**
|
|
418
|
-
* Fetch the self-contained `
|
|
419
|
-
* attempts, indexed events,
|
|
416
|
+
* Fetch the self-contained `SessionUnit` for this session: parsed submission,
|
|
417
|
+
* attempts, indexed events, session files, capture failures, proxy-call audit, and
|
|
420
418
|
* resolved skills. Use this when you need fields beyond the session record.
|
|
421
419
|
*
|
|
422
420
|
* On the managed plane this is a LEAN summary — the aggregate collections
|
|
423
|
-
* (`attempts` / `events.entries` / `
|
|
424
|
-
* empty. For authoritative per-
|
|
421
|
+
* (`attempts` / `events.entries` / `sessionFiles` / `rawEventPages`) default to
|
|
422
|
+
* empty. For authoritative per-session data use `files()` / `events()` /
|
|
425
423
|
* `messages()`. The returned shape is always type-valid (never `undefined`
|
|
426
424
|
* where the type promises an array/page), so array/page access is safe.
|
|
427
425
|
*/
|
|
428
|
-
unit(): Promise<
|
|
426
|
+
unit(): Promise<SessionUnit>;
|
|
429
427
|
/**
|
|
430
428
|
* Download EVERYTHING public about this session as one zip, assembled
|
|
431
429
|
* client-side from the public read endpoints. Organised into `metadata/`,
|
|
432
|
-
* `events/`, and `
|
|
430
|
+
* `events/`, and `files/` folders, plus a `manifest.json`. Pass `to` to
|
|
433
431
|
* also write the bytes to a file path while still returning them.
|
|
434
432
|
*/
|
|
435
|
-
download(options?:
|
|
433
|
+
download(options?: DownloadOptions): Promise<Uint8Array>;
|
|
436
434
|
/** Download only the session record (the `metadata` namespace) as a zip. */
|
|
437
|
-
downloadMetadata(options?:
|
|
435
|
+
downloadMetadata(options?: DownloadOptions): Promise<Uint8Array>;
|
|
438
436
|
}
|
|
439
437
|
export declare class SessionClient {
|
|
440
438
|
#private;
|
|
@@ -445,66 +443,54 @@ export declare class SessionClient {
|
|
|
445
443
|
delete(sessionId: string, options?: Pick<SessionSendOptions, "idempotencyKey">): Promise<void>;
|
|
446
444
|
list(query?: SessionListQuery): Promise<SessionListPage>;
|
|
447
445
|
/**
|
|
448
|
-
* Accessor over one session's captured
|
|
449
|
-
* opening a handle. Returns the SAME rich {@link
|
|
450
|
-
* `session.
|
|
446
|
+
* Accessor over one session's captured files, addressed by id without
|
|
447
|
+
* opening a handle. Returns the SAME rich {@link SessionFiles} surface as
|
|
448
|
+
* `session.files()` — `aex.sessions.files(id).list()` /
|
|
451
449
|
* `.read(selector)` / `.download()` / … — so the workspace client and the
|
|
452
450
|
* live handle share one accessor convention.
|
|
453
451
|
*/
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Cross-run output search (`aex.outputs`). Composed client-side (per-run
|
|
459
|
-
* `listSessionOutputs` + the contracts output filter): scope a corpus with
|
|
460
|
-
* `query.runIds`, or omit it to scan every run in the workspace. Metadata-only
|
|
461
|
-
* (reference hits, no bytes); a content-shaped query throws a typed
|
|
462
|
-
* "content search unsupported".
|
|
463
|
-
*/
|
|
464
|
-
export declare class OutputsClient {
|
|
465
|
-
#private;
|
|
466
|
-
constructor(http: HttpClient);
|
|
467
|
-
search(query?: OutputSearchQuery): Promise<OutputSearchPage>;
|
|
452
|
+
files(sessionId: string): SessionFiles;
|
|
453
|
+
start(options: SessionStartOptions): Promise<SessionStartResult>;
|
|
468
454
|
}
|
|
469
|
-
/**
|
|
470
|
-
export interface
|
|
455
|
+
/** Child-session events accessor (list + polling stream) keyed on a session id. */
|
|
456
|
+
export interface ChildSessionEvents {
|
|
471
457
|
list(): Promise<readonly AexEventView[]>;
|
|
472
458
|
stream(options?: StreamEventsOptions): AsyncIterable<AexEventView>;
|
|
473
459
|
}
|
|
474
|
-
/** A
|
|
475
|
-
export interface
|
|
476
|
-
list(query?:
|
|
477
|
-
find(query:
|
|
478
|
-
findOne(query:
|
|
479
|
-
read(selector:
|
|
480
|
-
link(selectorOrQuery:
|
|
481
|
-
download(selector?:
|
|
460
|
+
/** A session facade files accessor (a subset of {@link SessionFiles}) keyed on a session id. */
|
|
461
|
+
export interface SessionFiles {
|
|
462
|
+
list(query?: SessionFileQuery): Promise<readonly SessionFile[]>;
|
|
463
|
+
find(query: SessionFileQuery): Promise<readonly SessionFile[]>;
|
|
464
|
+
findOne(query: SessionFileQuery): Promise<SessionFile | null>;
|
|
465
|
+
read(selector: SessionFileSelector, options?: ReadSessionFileTextOptions): Promise<SessionFileText>;
|
|
466
|
+
link(selectorOrQuery: SessionFileLinkSelector, options?: SessionFileLinkOptions): Promise<SessionFileLink>;
|
|
467
|
+
download(selector?: SessionFileSelector, options?: DownloadOptions): Promise<Uint8Array>;
|
|
482
468
|
}
|
|
483
469
|
/**
|
|
484
|
-
* A first-class, lineage-discoverable SUBAGENT
|
|
485
|
-
* `session.children()
|
|
486
|
-
* (
|
|
487
|
-
* is resolvable through this handle; its lineage (`
|
|
470
|
+
* A first-class, lineage-discoverable SUBAGENT child session — handed out by
|
|
471
|
+
* `session.children()`, backed by the session-record facade
|
|
472
|
+
* (getSessionRecord/events/files), NOT `openSession`. Every child the platform hands you
|
|
473
|
+
* is resolvable through this handle; its lineage (`parentSessionId`/`depth`) and
|
|
488
474
|
* terminal outcome (`status`) are first-class.
|
|
489
475
|
*/
|
|
490
|
-
export declare class
|
|
476
|
+
export declare class ChildSessionHandle {
|
|
491
477
|
#private;
|
|
492
|
-
constructor(http: HttpClient, ref:
|
|
478
|
+
constructor(http: HttpClient, ref: ChildSessionRef, fetch?: FetchLike);
|
|
493
479
|
get id(): string;
|
|
494
|
-
get
|
|
480
|
+
get parentSessionId(): string;
|
|
495
481
|
get depth(): number | undefined;
|
|
496
|
-
/** The child's
|
|
482
|
+
/** The child's session status (a real session terminal outcome once settled). */
|
|
497
483
|
get status(): string;
|
|
498
|
-
get ref():
|
|
499
|
-
/** Re-read the child
|
|
500
|
-
get(): Promise<
|
|
501
|
-
/** The child's events over the
|
|
502
|
-
events():
|
|
503
|
-
/** The child's captured
|
|
504
|
-
|
|
484
|
+
get ref(): ChildSessionRef;
|
|
485
|
+
/** Re-read the child session record (status, lineage, costTelemetry). */
|
|
486
|
+
get(): Promise<SessionRecord>;
|
|
487
|
+
/** The child's events over the session-record facade (`/sessions/:id/events`). */
|
|
488
|
+
events(): ChildSessionEvents;
|
|
489
|
+
/** The child's captured files over the session-record facade (`/sessions/:id/files`). */
|
|
490
|
+
files(): SessionFiles;
|
|
505
491
|
/** This child's own subagent children (recursive lineage). */
|
|
506
|
-
children(): Promise<readonly
|
|
507
|
-
/** Cancel the child
|
|
492
|
+
children(): Promise<readonly ChildSessionHandle[]>;
|
|
493
|
+
/** Cancel the child session (session record facade `POST /sessions/:id/cancel`). */
|
|
508
494
|
cancel(): Promise<void>;
|
|
509
495
|
}
|
|
510
496
|
/**
|
|
@@ -547,40 +533,40 @@ export interface StreamEnvelopesOptions {
|
|
|
547
533
|
readonly terminalDrainGraceMs?: number;
|
|
548
534
|
/**
|
|
549
535
|
* End the stream settle-consistently. By default the iterator ends on the
|
|
550
|
-
* AG-UI terminal event (
|
|
536
|
+
* AG-UI terminal event (TURN_FINISHED / TURN_ERROR) or the managed-session
|
|
551
537
|
* terminal park (`aex.session.succeeded` / failed / timed_out / cancelled /
|
|
552
538
|
* idle / suspended). These are render-complete UX signals, emitted before the
|
|
553
|
-
* platform commit is necessarily read-consistent, so a `
|
|
539
|
+
* platform commit is necessarily read-consistent, so a `getSessionRecord` immediately
|
|
554
540
|
* after can still read `running`. With `settleConsistent: true` the iterator
|
|
555
541
|
* keeps reading PAST the render terminal until the post-mirror
|
|
556
|
-
* `aex.
|
|
557
|
-
* fallback otherwise. When it ends a subsequent `
|
|
558
|
-
* terminal and `
|
|
559
|
-
* Note:
|
|
560
|
-
* the
|
|
542
|
+
* `aex.session.settled` barrier when the plane emits it, or a session park
|
|
543
|
+
* fallback otherwise. When it ends a subsequent `getSessionRecord` is guaranteed
|
|
544
|
+
* terminal and `listSessionFiles` is complete.
|
|
545
|
+
* Note: files are durable at the TURN_FINISHED event already; this only adds
|
|
546
|
+
* the session-record consistency barrier.
|
|
561
547
|
*/
|
|
562
548
|
readonly settleConsistent?: boolean;
|
|
563
549
|
}
|
|
564
|
-
export interface
|
|
550
|
+
export interface WaitForSessionOptions {
|
|
565
551
|
readonly intervalMs?: number;
|
|
566
552
|
readonly timeoutMs?: number;
|
|
567
553
|
readonly signal?: AbortSignal;
|
|
568
554
|
}
|
|
569
|
-
export type
|
|
570
|
-
export interface
|
|
555
|
+
export type SessionFilePathMatch = "exact" | "suffix";
|
|
556
|
+
export interface SessionFilePathSelector {
|
|
571
557
|
readonly path: string;
|
|
572
|
-
readonly match?:
|
|
558
|
+
readonly match?: SessionFilePathMatch;
|
|
573
559
|
}
|
|
574
|
-
export interface
|
|
560
|
+
export interface SessionFileIdSelector {
|
|
575
561
|
readonly id: string;
|
|
576
562
|
}
|
|
577
|
-
export type
|
|
578
|
-
export type
|
|
579
|
-
export interface
|
|
563
|
+
export type SessionFileSelector = SessionFile | SessionFileIdSelector | SessionFilePathSelector;
|
|
564
|
+
export type SessionFileLinkSelector = string | SessionFileSelector | SessionFileQuery;
|
|
565
|
+
export interface DownloadOptions {
|
|
580
566
|
readonly to?: string;
|
|
581
567
|
/**
|
|
582
|
-
* Per-attempt timeout for fetching and reading the selected
|
|
583
|
-
* Defaults to 30_000ms; idempotent
|
|
568
|
+
* Per-attempt timeout for fetching and reading the selected file body.
|
|
569
|
+
* Defaults to 30_000ms; idempotent file downloads retry once on timeout.
|
|
584
570
|
*/
|
|
585
571
|
readonly timeoutMs?: number;
|
|
586
572
|
}
|
|
@@ -613,6 +599,8 @@ export declare class FilesClient {
|
|
|
613
599
|
list(): Promise<readonly FileRecord[]>;
|
|
614
600
|
get(fileId: string): Promise<FileRecord>;
|
|
615
601
|
delete(fileId: string): Promise<void>;
|
|
602
|
+
/** Cross-session captured-file metadata search. */
|
|
603
|
+
search(query?: SessionFileSearchQuery): Promise<SessionFileSearchPage>;
|
|
616
604
|
}
|
|
617
605
|
/**
|
|
618
606
|
* Workspace skill registry operations exposed under `client.skills`.
|
|
@@ -632,7 +620,7 @@ export declare class SkillsClient {
|
|
|
632
620
|
* Workspace secret management exposed under `client.secrets`, mirroring
|
|
633
621
|
* `client.agentsMd` / `client.files`.
|
|
634
622
|
*
|
|
635
|
-
* Lifecycle parity with assets: a `Secret.value(...)` is per-
|
|
623
|
+
* Lifecycle parity with assets: a `Secret.value(...)` is per-session and
|
|
636
624
|
* gone at terminal; `set` (or promoting an ephemeral via `secret.upload`)
|
|
637
625
|
* persists a named, searchable workspace secret you can `get` (metadata),
|
|
638
626
|
* `rotate`, `list`, and `delete`. The identity is the `name`; the value rotates
|
|
@@ -675,7 +663,7 @@ export declare class SecretsClient {
|
|
|
675
663
|
* Unified user-facing client for the aex platform. The same class
|
|
676
664
|
* powers the published `@aexhq/sdk` SDK and (under the hood) every host-side
|
|
677
665
|
* subcommand of the in-container `aex` CLI. All operations talk to
|
|
678
|
-
* the dashboard BFF and operate on durable
|
|
666
|
+
* the dashboard BFF and operate on durable session records.
|
|
679
667
|
*
|
|
680
668
|
* The SDK never asks the caller for a workspace id — workspace identity
|
|
681
669
|
* is derived server-side from the API key on every request. Use
|
|
@@ -689,8 +677,6 @@ export declare class Aex {
|
|
|
689
677
|
readonly skills: SkillsClient;
|
|
690
678
|
readonly secrets: SecretsClient;
|
|
691
679
|
readonly sessions: SessionClient;
|
|
692
|
-
/** Cross-run output search (`aex.outputs.search(...)`). */
|
|
693
|
-
readonly outputs: OutputsClient;
|
|
694
680
|
constructor(apiKey: string, options?: Omit<AexOptions, "apiKey">);
|
|
695
681
|
constructor(options: AexOptions);
|
|
696
682
|
/**
|
|
@@ -732,7 +718,7 @@ export declare class Aex {
|
|
|
732
718
|
/**
|
|
733
719
|
* Internal: upsert already-uploaded skill metadata into the workspace registry.
|
|
734
720
|
* The bytes are staged through `_uploadAsset`; this call binds the content hash
|
|
735
|
-
* to a mutable workspace skill name before the
|
|
721
|
+
* to a mutable workspace skill name before the session references that name.
|
|
736
722
|
*/
|
|
737
723
|
_upsertSkill(args: {
|
|
738
724
|
readonly name: string;
|
|
@@ -746,31 +732,31 @@ export declare class Aex {
|
|
|
746
732
|
* Convenience one-shot on top of the canonical session API:
|
|
747
733
|
* open a session, send `message` as the first turn, stream until the session
|
|
748
734
|
* parks (`idle` / `suspended` / `error`), then return the collected text,
|
|
749
|
-
* events,
|
|
750
|
-
* so callers can resume later with `openSession(
|
|
735
|
+
* events, files, and session record. The returned `sessionId` is the session id,
|
|
736
|
+
* so callers can resume later with `openSession(sessionId)`.
|
|
751
737
|
*/
|
|
752
|
-
|
|
738
|
+
start<T = unknown>(options: SessionStartOptions, opts?: StartSessionOptions): Promise<SessionResult<T>>;
|
|
753
739
|
/**
|
|
754
740
|
* Fire-and-forget: create the session and POST its first turn WITHOUT awaiting
|
|
755
|
-
* settle (the honest counterpart to await-settle `
|
|
756
|
-
* `
|
|
757
|
-
* a `webhook`, the event stream, or `openSession(
|
|
741
|
+
* settle (the honest counterpart to await-settle `start()`). Resolves with the
|
|
742
|
+
* `sessionId` + a resumable {@link SessionHandle} immediately; observe the session via
|
|
743
|
+
* a `webhook`, the event stream, or `openSession(sessionId)`.
|
|
758
744
|
*/
|
|
759
|
-
submit(options:
|
|
745
|
+
submit(options: SessionStartOptions): Promise<SubmitResult>;
|
|
760
746
|
/**
|
|
761
|
-
*
|
|
747
|
+
* SessionRecord a batch of one-shot items with a bounded worker pool, returning every
|
|
762
748
|
* item's settled result PLUS a REAL cost/usage rollup. The rollup is honest
|
|
763
|
-
* because each `
|
|
749
|
+
* because each `start()` awaits settle, so each item's `costUsd`/`usage` is
|
|
764
750
|
* populated — a failed item lands in `failed[]`, never a silent `$0` success.
|
|
765
751
|
* Concurrency is clamped below the workspace tier cap.
|
|
766
752
|
*/
|
|
767
|
-
batch<T = unknown>(items: readonly
|
|
753
|
+
batch<T = unknown>(items: readonly SessionStartOptions[], options?: BatchOptions): Promise<BatchResult<T>>;
|
|
768
754
|
openSession(options: SessionCreateOptions): Promise<SessionHandle>;
|
|
769
755
|
openSession(sessionId: string): Promise<SessionHandle>;
|
|
770
756
|
/**
|
|
771
757
|
* Delete a workspace asset blob from the shared content-addressed store
|
|
772
758
|
* (`assets/<workspaceId>/<hash>`). Accepts `sha256:<hex>` or a bare
|
|
773
|
-
* 64-hex digest.
|
|
759
|
+
* 64-hex digest. Sessions that already snapshotted the asset are unaffected.
|
|
774
760
|
*/
|
|
775
761
|
deleteWorkspaceAsset(hash: string): Promise<void>;
|
|
776
762
|
whoami(): Promise<WhoAmI>;
|
|
@@ -816,4 +802,4 @@ export declare class Aex {
|
|
|
816
802
|
* public SDK surface (index.ts controls that).
|
|
817
803
|
*/
|
|
818
804
|
export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
819
|
-
export type {
|
|
805
|
+
export type { SessionFileType, SessionFileLink, SessionFileLinkOptions, SessionFileQuery };
|