@aexhq/sdk 0.28.1 → 0.30.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 +80 -7
- package/dist/_contracts/event-guards.d.ts +67 -0
- package/dist/_contracts/event-guards.js +36 -0
- package/dist/_contracts/index.d.ts +2 -0
- package/dist/_contracts/index.js +6 -0
- package/dist/_contracts/run-config.d.ts +3 -3
- package/dist/_contracts/run-config.js +2 -2
- package/dist/_contracts/run-trace.d.ts +7 -0
- package/dist/_contracts/run-trace.js +9 -0
- package/dist/_contracts/runtime-sizes.d.ts +25 -79
- package/dist/_contracts/runtime-sizes.js +18 -39
- package/dist/_contracts/runtime-types.d.ts +31 -0
- package/dist/_contracts/submission.d.ts +40 -17
- package/dist/_contracts/submission.js +45 -18
- package/dist/agents-md.d.ts +4 -1
- package/dist/agents-md.js +10 -9
- package/dist/agents-md.js.map +1 -1
- package/dist/cli.mjs +17823 -3963
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +96 -17
- package/dist/client.js +238 -79
- package/dist/client.js.map +1 -1
- package/dist/data-tools.d.ts +23 -0
- package/dist/data-tools.js +102 -13
- package/dist/data-tools.js.map +1 -1
- package/dist/file.d.ts +4 -1
- package/dist/file.js +10 -9
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/skill.d.ts +8 -6
- package/dist/skill.js +14 -14
- package/dist/skill.js.map +1 -1
- package/dist/tool.d.ts +4 -1
- package/dist/tool.js +10 -8
- package/dist/tool.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/concepts/agent-tools.md +7 -3
- package/docs/concepts/runs.md +1 -1
- package/docs/defaults.md +3 -2
- package/docs/events.md +32 -9
- package/docs/limits-and-quotas.md +2 -2
- package/docs/networking.md +141 -0
- package/docs/quickstart.md +19 -10
- package/docs/run-config.md +2 -2
- package/examples/chat-corpus.ts +85 -0
- package/package.json +2 -2
package/dist/cli.mjs.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
88682d1f64442fabb34e7f3645f950c2a109b192183b100cd75dbaf92fd8f385 cli.mjs
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpClient, SecretString, type AexEvent, type AgentsMdRecord, type CredentialMode, type DebugSink, type FetchLike, type FileRecord, type Output, type OutputFileType, type OutputLink, type OutputLinkOptions, type OutputQuery, type OutputText, type OutputMode, type ReadOutputTextOptions, type RunListPage, type RunListQuery, type PlatformEnvironmentInput, type PlatformSubmission, type PlatformInlineSecrets, type PlatformProxyEndpoint, type PlatformProxyEndpointAuth, type PlatformPostHookInput, type Run, type RunModel, type RunEvent, type RunLimits, type RunWebhookDelivery, type RunProvider, type
|
|
1
|
+
import { HttpClient, SecretString, type AexEvent, type AgentsMdRecord, type CredentialMode, type DebugSink, type FetchLike, type FileRecord, type Output, type OutputFileType, type OutputLink, type OutputLinkOptions, type OutputQuery, type OutputText, type OutputMode, type ReadOutputTextOptions, type RunListPage, type RunListQuery, type OutputSearchQuery, type OutputSearchPage, type PlatformEnvironmentInput, type PlatformSubmission, type PlatformInlineSecrets, type PlatformProxyEndpoint, type PlatformProxyEndpointAuth, type PlatformPostHookInput, type Run, type RunModel, type RunEvent, type RunTrace, type UsageSummary, type RunLimits, type RunWebhookDelivery, type RunProvider, type Region, type SecretRecord, type SecretReveal, type RunUnit, type BuiltinToolName, type RuntimeSize, type RuntimeKind, type Skill as SkillRecord, 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 } from "./file.js";
|
|
@@ -40,8 +40,9 @@ export interface AgentExecutorOptions {
|
|
|
40
40
|
* secret is bundled into the constructor and split into
|
|
41
41
|
* `secrets.proxyEndpointAuth` server-side; the public submission
|
|
42
42
|
* only carries the declaration (`{ name, baseUrl, authShape, … }`).
|
|
43
|
-
* - `
|
|
44
|
-
*
|
|
43
|
+
* - `apiKey` / `credentials` / `secrets` — the BYOK provider key(s). A key for
|
|
44
|
+
* the selected provider is REQUIRED; the simplest call passes just `apiKey`.
|
|
45
|
+
* Use `credentials` (or `secrets.apiKeys`) to carry keys for additional
|
|
45
46
|
* providers so subagents spawned with a different-family model can use them
|
|
46
47
|
* (the child inherits the parent's keys server-side). The platform never
|
|
47
48
|
* holds a long-lived provider key on your behalf.
|
|
@@ -77,11 +78,11 @@ export interface SubmitOptions {
|
|
|
77
78
|
*/
|
|
78
79
|
readonly runtime?: RuntimeKind;
|
|
79
80
|
/**
|
|
80
|
-
* Optional hosted-platform placement
|
|
81
|
-
*
|
|
82
|
-
* configured region and fall back when no hint matches.
|
|
81
|
+
* Optional hosted-platform placement region for this run. These are
|
|
82
|
+
* product-level tokens, not exact city guarantees; omit to let the platform
|
|
83
|
+
* infer a configured region and fall back when no hint matches.
|
|
83
84
|
*/
|
|
84
|
-
readonly region?:
|
|
85
|
+
readonly region?: Region;
|
|
85
86
|
/**
|
|
86
87
|
* Closed public model id. Prefer the {@link Models} symbol const, e.g.
|
|
87
88
|
* `Models.CLAUDE_HAIKU_4_5`. Pair it with an explicit {@link Providers} value
|
|
@@ -121,7 +122,7 @@ export interface SubmitOptions {
|
|
|
121
122
|
/**
|
|
122
123
|
* Managed runtime size. One of the closed {@link RuntimeSize} preset tokens.
|
|
123
124
|
* Prefer the {@link RuntimeSizes} symbol const, e.g.
|
|
124
|
-
* `RuntimeSizes.
|
|
125
|
+
* `RuntimeSizes.SHARED_2X_8GB`.
|
|
125
126
|
*/
|
|
126
127
|
readonly runtimeSize?: RuntimeSize;
|
|
127
128
|
/**
|
|
@@ -171,7 +172,26 @@ export interface SubmitOptions {
|
|
|
171
172
|
* typing UIs.
|
|
172
173
|
*/
|
|
173
174
|
readonly outputMode?: OutputMode;
|
|
174
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Single-provider BYOK key sugar — the key for the run's selected `provider`.
|
|
177
|
+
* The simplest call passes just `apiKey` (no nested `secrets` envelope). When
|
|
178
|
+
* several sources name a key for the same provider they must agree (else submit
|
|
179
|
+
* throws); resolution precedence is
|
|
180
|
+
* `secrets.apiKeys[provider] ?? secrets.apiKey ?? credentials[provider] ?? apiKey`.
|
|
181
|
+
*/
|
|
182
|
+
readonly apiKey?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Multi-provider BYOK key map — the clean way to supply keys for more than one
|
|
185
|
+
* provider (e.g. so a subagent spawned with a different-family model inherits a
|
|
186
|
+
* key server-side). Folded into the `secrets.apiKeys` wire shape.
|
|
187
|
+
*/
|
|
188
|
+
readonly credentials?: Partial<Record<RunProvider, string>>;
|
|
189
|
+
/**
|
|
190
|
+
* Advanced inline secrets bundle (per-provider `apiKeys`, MCP headers, proxy
|
|
191
|
+
* auth, env secrets). OPTIONAL — the common case uses `apiKey` / `credentials`.
|
|
192
|
+
* `secrets.apiKey` / `secrets.apiKeys` keep working unchanged.
|
|
193
|
+
*/
|
|
194
|
+
readonly secrets?: PlatformInlineSecrets;
|
|
175
195
|
readonly idempotencyKey?: string;
|
|
176
196
|
/**
|
|
177
197
|
* Lineage parent (agent-session §9). When set, the server admits this run as
|
|
@@ -205,6 +225,42 @@ export interface SubmitOptions {
|
|
|
205
225
|
}
|
|
206
226
|
/** @deprecated Renamed to {@link SubmitOptions}. Kept for one release. */
|
|
207
227
|
export type SubmitRunOptions = SubmitOptions;
|
|
228
|
+
/**
|
|
229
|
+
* The settle-consistent result of {@link AgentExecutor.run} / `runAndCollect`:
|
|
230
|
+
* the terminal run record plus its settle-bracketed events, decoded trace,
|
|
231
|
+
* assistant text, and captured outputs — everything a "do it and give me the
|
|
232
|
+
* result" caller needs without hand-rolling a poll loop.
|
|
233
|
+
*/
|
|
234
|
+
export interface RunResult {
|
|
235
|
+
readonly runId: string;
|
|
236
|
+
/** The full terminal run record (status, costTelemetry, timings). */
|
|
237
|
+
readonly run: Run;
|
|
238
|
+
readonly status: string;
|
|
239
|
+
/** `true` when `status === "succeeded"`. */
|
|
240
|
+
readonly ok: boolean;
|
|
241
|
+
/** The assistant's final text (decoded over the settled events). */
|
|
242
|
+
readonly text: string;
|
|
243
|
+
/** The settle-bracketed event stream (RUN_STARTED … terminal). */
|
|
244
|
+
readonly events: readonly RunEvent[];
|
|
245
|
+
/** Decoded view of the events: tool calls + usage + assistant text. */
|
|
246
|
+
readonly trace: RunTrace;
|
|
247
|
+
/** The run's captured output files. */
|
|
248
|
+
readonly outputs: readonly Output[];
|
|
249
|
+
/** Aggregate token usage when the deployment exposes it on the record. */
|
|
250
|
+
readonly usage?: UsageSummary;
|
|
251
|
+
/** Settle-time showback estimate (USD), from `run.costTelemetry`. */
|
|
252
|
+
readonly costUsd?: number;
|
|
253
|
+
/** The run's error message when `!ok`. */
|
|
254
|
+
readonly error?: string;
|
|
255
|
+
}
|
|
256
|
+
/** Options for {@link AgentExecutor.run} / `runAndCollect`. */
|
|
257
|
+
export interface RunCollectOptions {
|
|
258
|
+
/** Overall wait budget (ms) for the run to reach a terminal record. */
|
|
259
|
+
readonly timeoutMs?: number;
|
|
260
|
+
readonly signal?: AbortSignal;
|
|
261
|
+
/** Throw a {@link RunStateError} when the run does not succeed. Default false. */
|
|
262
|
+
readonly throwOnFailure?: boolean;
|
|
263
|
+
}
|
|
208
264
|
export interface StreamEventsOptions {
|
|
209
265
|
/** Poll interval in ms for the `RunEvent` snapshot loop. Default 1000. */
|
|
210
266
|
readonly intervalMs?: number;
|
|
@@ -463,15 +519,26 @@ export declare class AgentExecutor {
|
|
|
463
519
|
readonly contentType?: string;
|
|
464
520
|
}): Promise<UploadedAsset>;
|
|
465
521
|
/**
|
|
466
|
-
* Submit a run
|
|
467
|
-
* "do it and give me the result"
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
522
|
+
* Submit a run, wait until its RECORD is terminal, and collect the full
|
|
523
|
+
* {@link RunResult} — the settle-consistent "do it and give me the result"
|
|
524
|
+
* primitive. Folds the poll loop every consumer hand-rolled into one call:
|
|
525
|
+
* submit → {@link waitForRun} (polls `getRun`, NOT the earlier RUN_FINISHED
|
|
526
|
+
* event) → poll `listEvents` until the snapshot is settle-bracketed
|
|
527
|
+
* (RUN_STARTED + a terminal event present) → `listOutputs` → decode the trace
|
|
528
|
+
* and assistant text. On resolve, `getRun`/`listOutputs` are guaranteed
|
|
529
|
+
* consistent.
|
|
530
|
+
*
|
|
531
|
+
* Uses polling (portable across backends), NOT the coordinator WebSocket. By
|
|
532
|
+
* default a failed run resolves with `ok: false` and a populated `error`; pass
|
|
533
|
+
* `{ throwOnFailure: true }` to throw instead. For live events prefer `submit`
|
|
534
|
+
* + `streamEnvelopes(runId, { settleConsistent: true })`.
|
|
535
|
+
*/
|
|
536
|
+
run(options: SubmitOptions, opts?: RunCollectOptions): Promise<RunResult>;
|
|
537
|
+
/**
|
|
538
|
+
* Explicit, discoverable alias for {@link run}: submit, wait, and collect the
|
|
539
|
+
* full {@link RunResult} in one call.
|
|
473
540
|
*/
|
|
474
|
-
|
|
541
|
+
runAndCollect(options: SubmitOptions, opts?: RunCollectOptions): Promise<RunResult>;
|
|
475
542
|
/**
|
|
476
543
|
* Submit a run and return its run id immediately. Use that id with
|
|
477
544
|
* `wait`, `stream`, `outputs`, `download`, `cancel`, or `delete`.
|
|
@@ -503,6 +570,18 @@ export declare class AgentExecutor {
|
|
|
503
570
|
* `listOutputs` / `readOutputText` to reach any run's deliverables.
|
|
504
571
|
*/
|
|
505
572
|
listRuns(query?: RunListQuery): Promise<RunListPage>;
|
|
573
|
+
/**
|
|
574
|
+
* Find output files across runs by filename / extension / content type.
|
|
575
|
+
* Returns lean REFERENCE hits (runId, outputId, filename, size, content type)
|
|
576
|
+
* — never bytes; fetch content with {@link readOutputText}. Scope the search
|
|
577
|
+
* to a corpus with `query.runIds`; omit it to scan the whole workspace (needs
|
|
578
|
+
* the owner-gated `listRuns`). Composed client-side for the MVP (per-run
|
|
579
|
+
* `listOutputs` + the contracts output filter), so it works against any
|
|
580
|
+
* already-terminal run with no new server endpoint. Bounded by
|
|
581
|
+
* `query.limit` (default 100) — for very large corpora prefer the deferred
|
|
582
|
+
* server-side index.
|
|
583
|
+
*/
|
|
584
|
+
searchOutputs(query?: OutputSearchQuery): Promise<OutputSearchPage>;
|
|
506
585
|
/**
|
|
507
586
|
* Fetch the self-contained `RunUnit`: parsed submission inputs,
|
|
508
587
|
* attempts, indexed events (inline + cursor for the tail), raw
|