@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
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import type { RunStatus } from "./status.js";
|
|
2
|
-
export declare const RUN_RETENTION_SCHEMA_VERSION = 1;
|
|
3
|
-
export declare const RUN_DELETION_MANIFEST_KIND = "aex.run_deletion_manifest.v1";
|
|
4
|
-
export declare const RUN_DELETION_JOB_KIND = "aex.run_deletion_job.v1";
|
|
5
|
-
export declare const RUN_DELETION_MANIFEST_CONTENT_TYPE = "application/json; charset=utf-8";
|
|
6
|
-
export declare const RUN_RETENTION_REDACTION_SCANNER_VERSION = 1;
|
|
7
|
-
export declare const RUN_DELETION_REASONS: readonly ["manual_delete", "retention_gc"];
|
|
8
|
-
export type RunDeletionReason = (typeof RUN_DELETION_REASONS)[number];
|
|
9
|
-
export declare const RUN_DELETION_MANIFEST_MODES: readonly ["dry_run", "final"];
|
|
10
|
-
export type RunDeletionManifestMode = (typeof RUN_DELETION_MANIFEST_MODES)[number];
|
|
11
|
-
export declare const RUN_DELETION_CANDIDATE_STATUSES: readonly ["selected", "blocked"];
|
|
12
|
-
export type RunDeletionCandidateStatus = (typeof RUN_DELETION_CANDIDATE_STATUSES)[number];
|
|
13
|
-
export declare const RUN_DELETION_BLOCKERS: readonly ["non_terminal", "retention_policy_disabled", "unexpired", "held", "retention_exempt", "unresolved_cleanup", "unresolved_custody"];
|
|
14
|
-
export type RunDeletionBlocker = (typeof RUN_DELETION_BLOCKERS)[number];
|
|
15
|
-
export declare const RUN_DELETION_COUNT_CLASSES: readonly ["object_store_objects", "outputs", "logs", "events", "assets", "db_event_rows", "db_output_rows", "capture_failures", "storage_samples", "custody_manifests"];
|
|
16
|
-
export type RunDeletionCountClass = (typeof RUN_DELETION_COUNT_CLASSES)[number];
|
|
17
|
-
export declare const RUN_DELETION_COUNT_STATUSES: readonly ["counted", "not_counted", "partial", "failed"];
|
|
18
|
-
export type RunDeletionCountStatus = (typeof RUN_DELETION_COUNT_STATUSES)[number];
|
|
19
|
-
export declare const RUN_DELETION_JOB_STATUSES: readonly ["queued", "planning", "blocked", "manifest_written", "deleting", "delete_failed", "completed", "failed"];
|
|
20
|
-
export type RunDeletionJobStatus = (typeof RUN_DELETION_JOB_STATUSES)[number];
|
|
21
|
-
export declare const RUN_DELETION_PROOF_STATUSES: readonly ["not_started", "running", "completed", "failed"];
|
|
22
|
-
export type RunDeletionProofStatus = (typeof RUN_DELETION_PROOF_STATUSES)[number];
|
|
23
|
-
export declare const RUN_DELETION_WRITE_STATUSES: readonly ["not_written", "written", "write_failed"];
|
|
24
|
-
export type RunDeletionWriteStatus = (typeof RUN_DELETION_WRITE_STATUSES)[number];
|
|
25
|
-
export declare const RUN_RETENTION_EXCLUDED_VALUE_CLASSES: readonly ["raw_paths", "object_keys", "filenames", "object_sizes", "hashes", "provider_ids", "vault_ids", "resource_ids", "resource_handles", "signed_urls"];
|
|
26
|
-
export type RunRetentionExcludedValueClass = (typeof RUN_RETENTION_EXCLUDED_VALUE_CLASSES)[number];
|
|
27
|
-
export interface RunRetentionPolicyV1 {
|
|
28
|
-
readonly mode: "retain_indefinitely" | "delete_after_days";
|
|
29
|
-
readonly manualDelete: "enabled";
|
|
30
|
-
readonly automaticDeletion: "disabled" | "enabled";
|
|
31
|
-
readonly retentionDays?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface RunRetentionPolicyInput {
|
|
34
|
-
readonly automaticDeletion?: boolean;
|
|
35
|
-
readonly retentionDays?: number;
|
|
36
|
-
}
|
|
37
|
-
export interface RunDeletionCandidateRunV1 {
|
|
38
|
-
readonly runId: string;
|
|
39
|
-
readonly workspaceId: string;
|
|
40
|
-
readonly status: RunStatus | string;
|
|
41
|
-
readonly createdAt?: string;
|
|
42
|
-
readonly terminalAt?: string;
|
|
43
|
-
readonly held?: boolean;
|
|
44
|
-
readonly retentionExempt?: boolean;
|
|
45
|
-
readonly unresolvedCleanup?: boolean;
|
|
46
|
-
readonly unresolvedCustody?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface RunDeletionBlockerV1 {
|
|
49
|
-
readonly code: RunDeletionBlocker;
|
|
50
|
-
readonly observedAt: string;
|
|
51
|
-
}
|
|
52
|
-
export interface RunDeletionCandidateV1 {
|
|
53
|
-
readonly status: RunDeletionCandidateStatus;
|
|
54
|
-
readonly reason: RunDeletionReason;
|
|
55
|
-
readonly evaluatedAt: string;
|
|
56
|
-
readonly eligibleAt?: string;
|
|
57
|
-
readonly blockers: readonly RunDeletionBlockerV1[];
|
|
58
|
-
}
|
|
59
|
-
export interface RunDeletionCandidateInput {
|
|
60
|
-
readonly run: RunDeletionCandidateRunV1;
|
|
61
|
-
readonly reason: RunDeletionReason;
|
|
62
|
-
readonly policy?: RunRetentionPolicyV1 | RunRetentionPolicyInput;
|
|
63
|
-
readonly now: string;
|
|
64
|
-
}
|
|
65
|
-
export interface RunDeletionCountV1 {
|
|
66
|
-
readonly class: RunDeletionCountClass | string;
|
|
67
|
-
readonly count: number;
|
|
68
|
-
readonly status: RunDeletionCountStatus;
|
|
69
|
-
readonly countedAt?: string;
|
|
70
|
-
readonly errorClass?: string;
|
|
71
|
-
}
|
|
72
|
-
export interface RunDeletionManifestRunV1 {
|
|
73
|
-
readonly runId: string;
|
|
74
|
-
readonly workspaceId: string;
|
|
75
|
-
readonly status: RunStatus | string;
|
|
76
|
-
readonly createdAt?: string;
|
|
77
|
-
readonly terminalAt?: string;
|
|
78
|
-
readonly eligibleAt?: string;
|
|
79
|
-
}
|
|
80
|
-
export interface RunDeletionManifestRequestV1 {
|
|
81
|
-
readonly reason: RunDeletionReason;
|
|
82
|
-
readonly actorClass: "user" | "api_key" | "system" | "operator";
|
|
83
|
-
}
|
|
84
|
-
export interface RunDeletionManifestSummaryV1 {
|
|
85
|
-
readonly totalCount: number;
|
|
86
|
-
readonly failedCountClasses: number;
|
|
87
|
-
readonly partialCountClasses: number;
|
|
88
|
-
readonly blockerCount: number;
|
|
89
|
-
readonly counts: readonly RunDeletionCountV1[];
|
|
90
|
-
}
|
|
91
|
-
export interface RunDeletionManifestRedactionV1 {
|
|
92
|
-
readonly policy: "counts_status_timestamps_only";
|
|
93
|
-
readonly scannerVersion: typeof RUN_RETENTION_REDACTION_SCANNER_VERSION;
|
|
94
|
-
readonly excludes: readonly RunRetentionExcludedValueClass[];
|
|
95
|
-
}
|
|
96
|
-
export interface RunDeletionManifestV1 {
|
|
97
|
-
readonly schemaVersion: typeof RUN_RETENTION_SCHEMA_VERSION;
|
|
98
|
-
readonly kind: typeof RUN_DELETION_MANIFEST_KIND;
|
|
99
|
-
readonly generatedAt: string;
|
|
100
|
-
readonly mode: RunDeletionManifestMode;
|
|
101
|
-
readonly run: RunDeletionManifestRunV1;
|
|
102
|
-
readonly request: RunDeletionManifestRequestV1;
|
|
103
|
-
readonly candidate: RunDeletionCandidateV1;
|
|
104
|
-
readonly summary: RunDeletionManifestSummaryV1;
|
|
105
|
-
readonly redaction: RunDeletionManifestRedactionV1;
|
|
106
|
-
}
|
|
107
|
-
export interface RunDeletionManifestInput {
|
|
108
|
-
readonly generatedAt: string;
|
|
109
|
-
readonly mode: RunDeletionManifestMode;
|
|
110
|
-
readonly run: RunDeletionCandidateRunV1;
|
|
111
|
-
readonly request: RunDeletionManifestRequestV1;
|
|
112
|
-
readonly candidate?: RunDeletionCandidateV1;
|
|
113
|
-
readonly policy?: RunRetentionPolicyV1 | RunRetentionPolicyInput;
|
|
114
|
-
readonly counts?: readonly RunDeletionCountV1[];
|
|
115
|
-
}
|
|
116
|
-
export interface RunDeletionManifestProofV1 {
|
|
117
|
-
readonly status: RunDeletionWriteStatus;
|
|
118
|
-
readonly mode?: RunDeletionManifestMode;
|
|
119
|
-
readonly writtenAt?: string;
|
|
120
|
-
}
|
|
121
|
-
export interface RunDeletionPurgeProofV1 {
|
|
122
|
-
readonly status: RunDeletionProofStatus;
|
|
123
|
-
readonly startedAt?: string;
|
|
124
|
-
readonly completedAt?: string;
|
|
125
|
-
readonly deletedObjectCount?: number;
|
|
126
|
-
}
|
|
127
|
-
export interface RunDeletionOrderProofV1 {
|
|
128
|
-
readonly manifest: RunDeletionManifestProofV1;
|
|
129
|
-
readonly purge: RunDeletionPurgeProofV1;
|
|
130
|
-
}
|
|
131
|
-
export interface RunDeletionJobV1 {
|
|
132
|
-
readonly schemaVersion: typeof RUN_RETENTION_SCHEMA_VERSION;
|
|
133
|
-
readonly kind: typeof RUN_DELETION_JOB_KIND;
|
|
134
|
-
readonly jobId: string;
|
|
135
|
-
readonly runId: string;
|
|
136
|
-
readonly workspaceId: string;
|
|
137
|
-
readonly reason: RunDeletionReason;
|
|
138
|
-
readonly mode: RunDeletionManifestMode;
|
|
139
|
-
readonly status: RunDeletionJobStatus;
|
|
140
|
-
readonly createdAt: string;
|
|
141
|
-
readonly updatedAt?: string;
|
|
142
|
-
readonly order: RunDeletionOrderProofV1;
|
|
143
|
-
readonly candidate?: RunDeletionCandidateV1;
|
|
144
|
-
readonly summary?: RunDeletionManifestSummaryV1;
|
|
145
|
-
}
|
|
146
|
-
export interface RunDeletionJobInput {
|
|
147
|
-
readonly jobId: string;
|
|
148
|
-
readonly runId: string;
|
|
149
|
-
readonly workspaceId: string;
|
|
150
|
-
readonly reason: RunDeletionReason;
|
|
151
|
-
readonly mode: RunDeletionManifestMode;
|
|
152
|
-
readonly status: RunDeletionJobStatus;
|
|
153
|
-
readonly createdAt: string;
|
|
154
|
-
readonly updatedAt?: string;
|
|
155
|
-
readonly order: RunDeletionOrderProofV1;
|
|
156
|
-
readonly candidate?: RunDeletionCandidateV1;
|
|
157
|
-
readonly summary?: RunDeletionManifestSummaryV1;
|
|
158
|
-
}
|
|
159
|
-
export interface RunDeletionManifestWriteObject {
|
|
160
|
-
readonly runId: string;
|
|
161
|
-
readonly workspaceId: string;
|
|
162
|
-
readonly contentType: typeof RUN_DELETION_MANIFEST_CONTENT_TYPE;
|
|
163
|
-
readonly manifest: RunDeletionManifestV1;
|
|
164
|
-
}
|
|
165
|
-
export interface RunDeletionManifestObjectStore {
|
|
166
|
-
putRunDeletionManifestObject(object: RunDeletionManifestWriteObject): Promise<void>;
|
|
167
|
-
}
|
|
168
|
-
export interface RunDeletionManifestWriteResult {
|
|
169
|
-
readonly status: "written";
|
|
170
|
-
readonly schemaVersion: typeof RUN_RETENTION_SCHEMA_VERSION;
|
|
171
|
-
readonly runId: string;
|
|
172
|
-
readonly workspaceId: string;
|
|
173
|
-
readonly writtenAt: string;
|
|
174
|
-
readonly mode: RunDeletionManifestMode;
|
|
175
|
-
}
|
|
176
|
-
export interface RunDeletionManifestWriter {
|
|
177
|
-
writeRunDeletionManifest(input: RunDeletionManifestInput): Promise<RunDeletionManifestWriteResult>;
|
|
178
|
-
}
|
|
179
|
-
export type RunRetentionRedactionReason = "forbidden_field_name" | "signed_url" | "object_store_key" | "vault_id" | "private_resource_handle" | "hash_like_value";
|
|
180
|
-
export interface RunRetentionRedactionFinding {
|
|
181
|
-
readonly path: string;
|
|
182
|
-
readonly reason: RunRetentionRedactionReason;
|
|
183
|
-
readonly valueLength?: number;
|
|
184
|
-
}
|
|
185
|
-
export declare class RunRetentionValidationError extends Error {
|
|
186
|
-
readonly code = "run_retention_contract_invalid";
|
|
187
|
-
constructor(message: string);
|
|
188
|
-
}
|
|
189
|
-
export declare class RunRetentionRedactionError extends Error {
|
|
190
|
-
readonly code = "run_retention_payload_not_public_safe";
|
|
191
|
-
readonly findings: readonly RunRetentionRedactionFinding[];
|
|
192
|
-
constructor(findings: readonly RunRetentionRedactionFinding[]);
|
|
193
|
-
}
|
|
194
|
-
export declare class FakeRunDeletionManifestObjectStore implements RunDeletionManifestObjectStore {
|
|
195
|
-
#private;
|
|
196
|
-
putRunDeletionManifestObject(object: RunDeletionManifestWriteObject): Promise<void>;
|
|
197
|
-
getByRunId(runId: string): RunDeletionManifestV1 | undefined;
|
|
198
|
-
get(runId: string): RunDeletionManifestV1 | undefined;
|
|
199
|
-
listRunIds(): readonly string[];
|
|
200
|
-
}
|
|
201
|
-
export declare function createRunDeletionManifestWriter(store: RunDeletionManifestObjectStore): RunDeletionManifestWriter;
|
|
202
|
-
export declare function writeRunDeletionManifest(store: RunDeletionManifestObjectStore, input: RunDeletionManifestInput): Promise<RunDeletionManifestWriteResult>;
|
|
203
|
-
export declare function buildRunRetentionPolicy(input?: RunRetentionPolicyInput): RunRetentionPolicyV1;
|
|
204
|
-
export declare function evaluateRunDeletionCandidate(input: RunDeletionCandidateInput): RunDeletionCandidateV1;
|
|
205
|
-
export declare function buildRunDeletionManifest(input: RunDeletionManifestInput): RunDeletionManifestV1;
|
|
206
|
-
export declare function assertRunDeletionOrder(proof: RunDeletionOrderProofV1): void;
|
|
207
|
-
export declare function buildRunDeletionJob(input: RunDeletionJobInput): RunDeletionJobV1;
|
|
208
|
-
export declare function scanRunRetentionPayloadForSensitiveValues(input: unknown): readonly RunRetentionRedactionFinding[];
|
|
209
|
-
export declare function assertPublicSafeRunRetentionPayload(input: unknown): void;
|
package/docs/outputs.md
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Outputs
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Outputs
|
|
6
|
-
|
|
7
|
-
Every session produces durable metadata (status, events, cleanup state) and an outputs namespace. By default, managed runs capture the regular files present in the container when the agent exits, EXCLUDING the inputs the platform itself materialized for you (your mounted `files`/`skills`) — those are excluded by IDENTITY (their exact destination paths and skill-dir prefixes), not by any before/after timing comparison. There is no default or official output directory. Use `outputs.allowedDirs` only when you want to narrow capture to specific roots, and `outputs.deniedDirs` to subtract noise. `session.download()` returns the public session record — metadata, typed events, and captured output bytes — as a zip; the per-namespace verbs (`session.outputs().download()` / `session.events().download()` / `session.downloadMetadata()`) return one slice each.
|
|
8
|
-
|
|
9
|
-
The output verbs below hang off the session's `outputs()` accessor
|
|
10
|
-
(`session.outputs().list()`, `.read()`, `.download()`, …). Reach a handle from a
|
|
11
|
-
live session (`openSession` / `run`) or reopen one later with
|
|
12
|
-
`aex.openSession(sessionId)`; the client also exposes cross-session reads under
|
|
13
|
-
`aex.sessions.*`.
|
|
14
|
-
|
|
15
|
-
## Quickstart
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { Models } from "@aexhq/sdk";
|
|
19
|
-
|
|
20
|
-
const session = await aex.openSession({
|
|
21
|
-
model: Models.CLAUDE_HAIKU_4_5,
|
|
22
|
-
apiKeys: { anthropic: apiKey }
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
await session.send("Produce a report and save it as a file.").done();
|
|
26
|
-
await session.wait();
|
|
27
|
-
await session.download({ to: "./session.zip" });
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npx aex download <session-id> --out ./session.zip --api-key …
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## The three namespaces
|
|
35
|
-
|
|
36
|
-
A session's downloadable content is organised into three logical namespaces, each with a matching verb. Every zip is assembled **client-side** from the public read endpoints (session record + `session.events().list()` + `session.outputs().list()` + per-output `/download`) — there is no server-side archive route.
|
|
37
|
-
|
|
38
|
-
| Namespace | What it holds | Verb | CLI |
|
|
39
|
-
| --- | --- | --- | --- |
|
|
40
|
-
| `outputs` | The session's real deliverables. | `session.outputs().download()` | `download <id> --only outputs` |
|
|
41
|
-
| `events` | Typed event-channel records (`events.jsonl`) plus a namespace manifest. | `session.events().download()` | `download <id> --only events` |
|
|
42
|
-
| `metadata` | The session record (`run.json`) plus a namespace manifest. | `session.downloadMetadata()` | `download <id> --only metadata` |
|
|
43
|
-
|
|
44
|
-
Platform diagnostics are stored outside the public archive under `runs/<runId>/internal/logs/` for internal/admin access only. They are not exposed by the SDK download helpers or the public CLI.
|
|
45
|
-
|
|
46
|
-
## What `session.download()` returns
|
|
47
|
-
|
|
48
|
-
`session.download()` is the **whole-session** verb — it bundles the public namespaces as top-level folders. It is distinct from `session.outputs().download(selector)`, which fetches a single file. Layout:
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
metadata/run.json # run record (status, runId, timestamps, snapshot)
|
|
52
|
-
metadata/submission.json # public-safe submission snapshot, when available
|
|
53
|
-
metadata/cost.json # public cost telemetry, when available
|
|
54
|
-
events/events.jsonl # typed event-channel records, ordered
|
|
55
|
-
outputs/<name> # one file per deliverable
|
|
56
|
-
manifest.json # RunRecordManifestV1
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
`manifest.json` is the versioned `RunRecordManifestV1` described in [Run record](run-record.md). It carries:
|
|
60
|
-
|
|
61
|
-
| Field | Meaning |
|
|
62
|
-
| --- | --- |
|
|
63
|
-
| `schemaVersion` / `runRecordSchemaVersion` | Manifest and run-record contract versions. |
|
|
64
|
-
| `runId` | The run the zip was assembled for. |
|
|
65
|
-
| `namespaces[]` / `files[]` | Namespace inventory and per-file presence state. Optional submission/cost files are marked `present` only when the client assembled actual entries; custody remains `pending` until its writer/read path exists. |
|
|
66
|
-
| `outputs[]` | `{ id, filename, sizeBytes?, contentType? }` — one row per file successfully written under `outputs/`. |
|
|
67
|
-
| `errors[]` | `{ namespace, id, filename, message }` — per-artifact byte fetches that failed during assembly. Best-effort: a failure records an entry here and is skipped from the tree rather than aborting the whole zip. |
|
|
68
|
-
|
|
69
|
-
The single-namespace verbs return the same per-file bytes at the zip root (e.g. `session.outputs().download()` -> `report.txt` + `manifest.json`; `session.events().download()` -> `events.jsonl` + `manifest.json`; `session.downloadMetadata()` -> `run.json` + `manifest.json`).
|
|
70
|
-
|
|
71
|
-
## Downloading one output
|
|
72
|
-
|
|
73
|
-
`session.outputs().download(selector)` returns a `Uint8Array`. Omit the selector to download the whole outputs namespace as a zip; pass an output from `session.outputs().list()`, an `{ id }`, or a path selector against the listed `Output.filename` values to download one file:
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
const allOutputs = await session.outputs().download();
|
|
77
|
-
await session.outputs().download(undefined, { to: "./outputs.zip" });
|
|
78
|
-
|
|
79
|
-
const report = await session.outputs().download({ path: "reports/report.txt" });
|
|
80
|
-
console.log(new TextDecoder().decode(report));
|
|
81
|
-
|
|
82
|
-
const looseReport = await session.outputs().download({ path: "report.txt", match: "suffix" });
|
|
83
|
-
console.log(looseReport.byteLength);
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Reading one output as text
|
|
87
|
-
|
|
88
|
-
`session.outputs().read(selector, options?)` reads ONE output file as byte-capped, decoded UTF-8 text. It streams the file and stops at `options.maxBytes` (default 50 KB, ceiling 10 MB), so a large deliverable never fully buffers — this is the read built for handing a session's output to an LLM tool. Select the file by `{ path }` (suffix-matchable) or `{ id }`. To read from a session id without a live handle, use `aex.sessions.outputs(sessionId).read(selector, options?)` — the same accessor, addressed by id.
|
|
89
|
-
|
|
90
|
-
```ts
|
|
91
|
-
const { text, truncated, totalBytes } = await session.outputs().read(
|
|
92
|
-
{ path: "report.md", match: "suffix" },
|
|
93
|
-
{ maxBytes: 50_000, grep: "error" }
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
if (truncated) {
|
|
97
|
-
// text is a prefix of a larger file — narrow with `grep` or a tighter `path`.
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Check `truncated` before treating `text` as complete. Pass `options.grep` (a substring or `RegExp`) to keep only matching lines of the capped text. The returned `output` is the matched `Output` record, and `totalBytes` is the file's full size when the server reports it.
|
|
102
|
-
|
|
103
|
-
## Finding outputs
|
|
104
|
-
|
|
105
|
-
`session.outputs().list(query?)` can filter the captured output list client-side. Use `session.outputs().find(query)` when you want discovery to be explicit, or `session.outputs().findOne(query)` when exactly one file is expected:
|
|
106
|
-
|
|
107
|
-
```ts
|
|
108
|
-
const images = await session.outputs().find({ type: "image" });
|
|
109
|
-
const jsonReports = await session.outputs().list({
|
|
110
|
-
dir: "reports",
|
|
111
|
-
extension: ".json"
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
const report = await session.outputs().findOne({
|
|
115
|
-
filename: "summary.json",
|
|
116
|
-
contentType: "application/json"
|
|
117
|
-
});
|
|
118
|
-
if (report) {
|
|
119
|
-
const bytes = await session.outputs().download(report);
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Query fields compose with AND semantics:
|
|
124
|
-
|
|
125
|
-
| Field | Match |
|
|
126
|
-
| --- | --- |
|
|
127
|
-
| `path` | Exact normalized output path. Leading `/` and `outputs/` are ignored. |
|
|
128
|
-
| `filename` | Basename match, as a string or `RegExp`. |
|
|
129
|
-
| `dir` / `recursive` | Directory prefix. `recursive` defaults to `true`; set `false` for direct children only. |
|
|
130
|
-
| `extension` | Case-insensitive extension, with or without a leading dot. |
|
|
131
|
-
| `contentType` | Exact content type or a prefix wildcard such as `image/*`. |
|
|
132
|
-
| `type` | High-level type: `text`, `json`, `image`, `audio`, `video`, `pdf`, `archive`, `binary`, or `unknown`. |
|
|
133
|
-
|
|
134
|
-
`session.outputs().findOne(query)` returns `null` when nothing matches and throws `RunStateError` when the query matches more than one output.
|
|
135
|
-
|
|
136
|
-
## Searching outputs
|
|
137
|
-
|
|
138
|
-
Search is metadata-only (reference hits — filename / extension / content type — no bytes). `filename` accepts a `string` (case-insensitive substring) or a `RegExp`. A content-shaped query (`content`/`text`/…) throws a typed "content search unsupported" rather than silently returning zero hits.
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
// One session's outputs:
|
|
142
|
-
const hits = await session.outputs().search({ filename: /report/i });
|
|
143
|
-
|
|
144
|
-
// Across every run in the workspace (or scope with runIds):
|
|
145
|
-
const all = await aex.outputs.search({ extension: "md", runIds: ["run-a", "run-b"] });
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Each hit is `{ runId, outputId, filename?, sizeBytes?, contentType? }`; read the bytes with `session.outputs().read(...)` / `.download(...)`.
|
|
149
|
-
|
|
150
|
-
## CLI
|
|
151
|
-
|
|
152
|
-
The `aex outputs` verb is a thin pass-through over the same SDK accessor, so every per-file operation has a subcommand (`npx aex` on a local install):
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
npx aex outputs <session-id> # list captured outputs (NDJSON)
|
|
156
|
-
npx aex outputs read <session-id> <path> # read one file as capped text (JSON)
|
|
157
|
-
npx aex outputs download <session-id> <path> --out f # download one file's raw bytes
|
|
158
|
-
npx aex outputs link <session-id> <path> # mint a temporary download URL (JSON)
|
|
159
|
-
npx aex outputs find <session-id> --name S --ext E --type T
|
|
160
|
-
npx aex outputs search --query S --ext E --run-id ID # cross-run metadata search
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
`aex outputs search` (no session id) is the cross-run search (`aex.outputs.search`); the whole-namespace zip stays `aex download <session-id>`.
|
|
164
|
-
|
|
165
|
-
## Temporary output links
|
|
166
|
-
|
|
167
|
-
Use `session.outputs().link(selectorOrQuery, options?)` when another process, browser, media tag, or downloader needs a direct artifact URL instead of bytes buffered through the SDK.
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
const link = await session.outputs().link(
|
|
171
|
-
{ path: "reports/summary.json" },
|
|
172
|
-
{ expiresIn: "15m" }
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
console.log(link.url, link.expiresAt);
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
Selectors can be an output id, an `Output` object, a path selector, or an `OutputQuery`. `expiresIn` accepts seconds or `"15m"`, `"1h"`, or `"1d"`; the default is `"1h"`.
|
|
179
|
-
|
|
180
|
-
The returned URL is a reusable bearer URL until it expires. Anyone who has it can read that artifact during the TTL. aex does not promise one-time use or early revocation for these direct artifact URLs.
|
|
181
|
-
|
|
182
|
-
For large files, `session.outputs().fetch()` mints the same temporary URL and returns the `Response` from fetching it directly, without adding the SDK API key to that second request:
|
|
183
|
-
|
|
184
|
-
```ts
|
|
185
|
-
const response = await session.outputs().fetch({ type: "video", filename: /clip\.mp4$/ });
|
|
186
|
-
const stream = response.body;
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Lifecycle behaviour
|
|
190
|
-
|
|
191
|
-
`session.download()` works at any session state — it reads whatever the public endpoints currently expose, so the zip reflects the session as of the call:
|
|
192
|
-
|
|
193
|
-
| Run state | Behaviour |
|
|
194
|
-
| --- | --- |
|
|
195
|
-
| `queued` / `claiming` / `provisioning` | `metadata/run.json` reflects the early state; `events/` and `outputs/` are typically empty. |
|
|
196
|
-
| `provider_running`, mid-session / `capturing_outputs` / `cleaning_up` | Whatever events + outputs have been captured so far. Call again after the session parks for the complete set. |
|
|
197
|
-
| `idle` / `suspended` (parked between turns) | The complete archive for every turn sent so far; a later turn appends to it. |
|
|
198
|
-
| `succeeded` / `failed` / `timed_out` / `cancelled` | The complete typed event archive + all captured outputs. |
|
|
199
|
-
|
|
200
|
-
## `outputs.allowedDirs` — override capture roots
|
|
201
|
-
|
|
202
|
-
```ts
|
|
203
|
-
aex.openSession({
|
|
204
|
-
/* ... */
|
|
205
|
-
outputs: {
|
|
206
|
-
allowedDirs: ["/workspace/reports", "/workspace/state"]
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
When omitted, aex captures the whole filesystem delta. When supplied, `outputs.allowedDirs` is a whitelist that replaces that default with the listed roots. In other words, explicit `outputs.allowedDirs` narrows capture; it does not add paths on top of `/`.
|
|
212
|
-
|
|
213
|
-
Validation:
|
|
214
|
-
|
|
215
|
-
- absolute UNIX paths only (`/...`),
|
|
216
|
-
- no `..` segments, no NUL bytes,
|
|
217
|
-
- maximum 32 entries,
|
|
218
|
-
- maximum 512 bytes per entry.
|
|
219
|
-
|
|
220
|
-
Runtime notes:
|
|
221
|
-
|
|
222
|
-
- The managed runtime captures the regular files under the capture roots at terminal time, EXCLUDING the inputs the platform itself materialized (your mounted `files`/`skills`) by IDENTITY — their exact destination paths and skill-dir prefixes are threaded into the capture filter, so an untouched mounted input is never re-emitted as an output regardless of path policy or timing.
|
|
223
|
-
- If you pass an explicit root that does not exist by terminal time, that root contributes no files.
|
|
224
|
-
|
|
225
|
-
## `outputs.deniedDirs` — subtract noise
|
|
226
|
-
|
|
227
|
-
```ts
|
|
228
|
-
aex.openSession({
|
|
229
|
-
/* ... */
|
|
230
|
-
outputs: {
|
|
231
|
-
deniedDirs: ["node_modules", "/var/cache", "*.tmp"]
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
`outputs.deniedDirs` is subtracted from the capture roots. Entries may be an absolute subtree (`/var/cache`), a bare path segment (`node_modules`), or a `*.ext` extension match. Denied entries beat allowed roots. Platform-mandatory excludes, including pseudo-filesystems and secret/platform paths, always apply and cannot be re-included.
|
|
237
|
-
|
|
238
|
-
Mechanism (no platform-magical paths — this is honest):
|
|
239
|
-
|
|
240
|
-
1. The hosted platform materializes the workspace (your mounted `files`/`skills`) and records the exact destination paths + skill-dir prefixes it wrote.
|
|
241
|
-
2. The agent runs normally. There is no extra model turn and no synthetic sync instruction.
|
|
242
|
-
3. When the agent exits, the runner scans the capture roots and drops any file whose path is a materialized INPUT (exact path or under a materialized skill dir) — inputs are excluded by WHO PUT THEM THERE (the platform), not by timing.
|
|
243
|
-
4. The runner uploads the remaining regular files to durable run artifact storage. Diagnostic log paths are routed to internal diagnostics under `runs/<runId>/internal/logs/`; other paths are routed to `outputs`.
|
|
244
|
-
|
|
245
|
-
Cost: output capture does not add a model turn. The runner pays a filesystem scan and upload cost near the end of the run.
|
|
246
|
-
|
|
247
|
-
Capture notes:
|
|
248
|
-
|
|
249
|
-
- Files over a configured per-file size cap are skipped.
|
|
250
|
-
- Once total file or byte caps are reached, remaining changed files are dropped from upload.
|
|
251
|
-
- Files that vanish between scan and upload are skipped.
|
|
252
|
-
- Upload failures are recorded in runner diagnostics. The zip's `manifest.errors[]` only records byte fetches that failed while assembling the download archive.
|
|
253
|
-
|
|
254
|
-
## Runs without explicit `outputs.allowedDirs`
|
|
255
|
-
|
|
256
|
-
Metadata still gets the full treatment. aex captures every regular file the run created or modified outside mandatory platform excludes. A run that produces no files still returns a whole-session zip with `metadata/run.json`, `events/events.jsonl`, and `manifest.json` (manifest `outputs: []`).
|
|
257
|
-
|
|
258
|
-
## Mid-session download semantics
|
|
259
|
-
|
|
260
|
-
Mid-session calls are **best-effort and side-effect-free**: they expose whatever artifacts have already been uploaded. Files written by the agent are normally uploaded near terminal, after the runner scans the capture roots. If you need the full output set, wait for the session to park and call `session.download()` again.
|
|
261
|
-
|
|
262
|
-
## Safety
|
|
263
|
-
|
|
264
|
-
- Filenames are sanitized for cross-platform safety; collisions are disambiguated with a short id suffix before the extension.
|
|
265
|
-
- Downloads stay within the requested local directory.
|
|
266
|
-
- The archive endpoint is workspace-scoped (`outputs:read` scope) and rate-limited (`AEX_RATE_LIMIT_RUN_ARCHIVE_PER_MINUTE`, default 30/min/workspace).
|
|
267
|
-
- `manifest.json` never contains file bytes — only ids, paths, sizes, content types.
|
package/docs/run-config.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Run configuration
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Run configuration
|
|
6
|
-
|
|
7
|
-
A run config is the credential-free subset of the session options (`openSession` / `run`) that you can keep in code or load from a JSON file. It is not a platform object, saved definition, DSL, trigger, or persistent agent profile. aex only stores the immutable session record created when the session lands.
|
|
8
|
-
|
|
9
|
-
Allowed fields:
|
|
10
|
-
|
|
11
|
-
- `model` - required.
|
|
12
|
-
- `system` - optional system message.
|
|
13
|
-
- `mcpServers` - array of `McpServerRef`; headers are split into the vaulted secrets channel server-side.
|
|
14
|
-
- `environment` - `{ networking?, packages?, variables? }`. Networking is open by default; set `networking.mode` to `limited` only when you want an allowlist. `variables` are merged into the in-container `RUNTIME.env` / `RUNTIME.json` mounts. (Run secrets go in `environment.secrets`, which carries live `Secret` instances and is not part of a shareable config.)
|
|
15
|
-
- `runtime` - optional managed-runtime preset. Prefer `Sizes` in TypeScript.
|
|
16
|
-
- `metadata` - non-secret structured metadata.
|
|
17
|
-
- `overrides` - `{ idleTtl?, timeout?, maxSpendUsd?, maxTurns? }`. `timeout` is an optional session deadline (e.g. `"30m"`, `"2h"`); `maxSpendUsd` stops the session once its spend would exceed the cap; `maxTurns` caps the agent's iteration count for the turn (a positive integer — omit to accept the platform default of 20, clamped to the ceiling). See [Limits & quotas](limits-and-quotas.md).
|
|
18
|
-
|
|
19
|
-
`message` (the one-shot `run` input), `agentsMd`, `files`, `outputs`, `tools`, `skills`, `includeBuiltinTools`, and `outputMode` are `openSession` / `run` options, not reusable run-config fields. They carry the turn input, bytes, capture behavior, or agent tool/output controls that belong on a concrete call. Skill bundles are `skills` entries built with `Skill.fromDir(...)`, `Skill.fromUrl(...)`, or the other `Skill.from*` factories, so they too are SDK-code options rather than config fields. Subagents are session-internal (the in-run `subagent` tool — see [Subagents](concepts/subagents.md)); there is no `parentRunId` option. The wire contract carries a per-run `limits` object (the exported `RunLimits` type: `maxConcurrentChildRuns`, `maxSubagentDepth`, `maxSpendUsd`, `maxTurns`), and the session surface exposes its spend and iteration dials via `overrides.maxSpendUsd` and `overrides.maxTurns`; the subagent depth/breadth dials are not settable per-session today and take the platform defaults.
|
|
20
|
-
|
|
21
|
-
Secrets never live in run config. Pass provider keys through the top-level
|
|
22
|
-
`apiKeys` map and runtime secrets through `environment.secrets` in the SDK, or
|
|
23
|
-
the equivalent host-mode flags (`--anthropic-api-key`, `--mcp-auth`) in the CLI.
|
|
24
|
-
See [Secrets](secrets.md) for secret lifecycles and [Credentials](credentials.md)
|
|
25
|
-
for credential handling.
|
|
26
|
-
|
|
27
|
-
## Reuse in code
|
|
28
|
-
|
|
29
|
-
Use an ordinary function when you want reusable typed parameters. aex does not store or execute this function; it only receives the parameters you pass.
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
import { Models } from "@aexhq/sdk";
|
|
33
|
-
|
|
34
|
-
function summarise(topic: string) {
|
|
35
|
-
return {
|
|
36
|
-
model: Models.CLAUDE_HAIKU_4_5,
|
|
37
|
-
system: "You are a concise automation agent.",
|
|
38
|
-
message: `Write a short answer about ${topic}.`
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
await aex.run({
|
|
43
|
-
...summarise("agent-first SDK design"),
|
|
44
|
-
apiKeys: { anthropic: apiKey }
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## CLI
|
|
49
|
-
|
|
50
|
-
The `aex run` host subcommand accepts the same run config either as a JSON file:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
aex run --config ./run.json \
|
|
54
|
-
--api-key "$AEX_API_KEY" \
|
|
55
|
-
--anthropic-api-key "$ANTHROPIC_API_KEY"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
...or as explicit flags (`--model`, `--system`, `--prompt`, `--mcp`, `--mcp-auth`, `--runtime-size`, `--run-timeout`, `--metadata`). The two modes are mutually exclusive. Composition inputs attach with repeatable flags that map onto the SDK's `Skill`/`Tool`/`AgentsMd`/`File` factories: `--skill @bundle` (workspace skill), `--tool @tool.js` (custom tool module), `--agents-md @AGENTS.md`, and `--file @path` (mount a file into `/workspace`).
|
|
File without changes
|