@aexhq/sdk 0.38.1 → 0.40.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 +23 -17
- package/dist/_contracts/api-key.d.ts +49 -0
- package/dist/_contracts/api-key.js +87 -0
- package/dist/_contracts/bundle-manifest.d.ts +86 -0
- package/dist/_contracts/bundle-manifest.js +157 -0
- package/dist/_contracts/error-codes.d.ts +26 -0
- package/dist/_contracts/error-codes.js +79 -0
- package/dist/_contracts/error-factory.d.ts +32 -0
- package/dist/_contracts/error-factory.js +142 -0
- package/dist/_contracts/event-envelope.d.ts +33 -10
- package/dist/_contracts/event-envelope.js +46 -10
- package/dist/_contracts/event-view.d.ts +123 -0
- package/dist/_contracts/event-view.js +120 -0
- package/dist/_contracts/http.js +12 -3
- package/dist/_contracts/index.d.ts +8 -4
- package/dist/_contracts/index.js +11 -7
- package/dist/_contracts/models.d.ts +15 -0
- package/dist/_contracts/models.js +33 -0
- package/dist/_contracts/operations.d.ts +70 -2
- package/dist/_contracts/operations.js +143 -7
- package/dist/_contracts/run-config.d.ts +35 -10
- package/dist/_contracts/run-config.js +17 -5
- package/dist/_contracts/run-record.d.ts +3 -2
- package/dist/_contracts/runtime-types.d.ts +148 -36
- package/dist/_contracts/runtime-types.js +33 -1
- package/dist/_contracts/sdk-errors.d.ts +61 -2
- package/dist/_contracts/sdk-errors.js +83 -3
- package/dist/_contracts/sdk-secrets.js +31 -6
- package/dist/_contracts/stable.d.ts +14 -0
- package/dist/_contracts/stable.js +14 -0
- package/dist/_contracts/status.d.ts +28 -1
- package/dist/_contracts/status.js +48 -3
- package/dist/_contracts/submission.d.ts +157 -14
- package/dist/_contracts/submission.js +319 -55
- package/dist/_contracts/suggest.d.ts +15 -0
- package/dist/_contracts/suggest.js +54 -0
- package/dist/asset-upload.d.ts +27 -1
- package/dist/asset-upload.js +219 -4
- package/dist/asset-upload.js.map +1 -1
- package/dist/bundle.d.ts +23 -14
- package/dist/bundle.js +39 -20
- package/dist/bundle.js.map +1 -1
- package/dist/canonical-zip.d.ts +68 -0
- package/dist/canonical-zip.js +307 -0
- package/dist/canonical-zip.js.map +1 -0
- package/dist/cli.mjs +1927 -326
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +273 -70
- package/dist/client.js +885 -335
- package/dist/client.js.map +1 -1
- package/dist/fetch-archive.js +14 -14
- package/dist/fetch-archive.js.map +1 -1
- package/dist/file.d.ts +33 -6
- package/dist/file.js +120 -54
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.js +31 -14
- package/dist/index.js.map +1 -1
- package/dist/node-fs.d.ts +26 -9
- package/dist/node-fs.js +13 -38
- package/dist/node-fs.js.map +1 -1
- package/dist/node-walk.d.ts +69 -0
- package/dist/node-walk.js +146 -0
- package/dist/node-walk.js.map +1 -0
- package/dist/retry.d.ts +9 -13
- package/dist/retry.js +18 -17
- package/dist/retry.js.map +1 -1
- package/dist/skill.d.ts +151 -0
- package/dist/skill.js +298 -0
- package/dist/skill.js.map +1 -0
- package/dist/tool.d.ts +14 -2
- package/dist/tool.js +33 -7
- package/dist/tool.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/authentication.md +29 -5
- package/docs/billing.md +6 -0
- package/docs/concepts/agent-tools.md +11 -0
- package/docs/concepts/composition.md +3 -3
- package/docs/defaults.md +1 -0
- package/docs/errors.md +64 -4
- package/docs/events.md +84 -49
- package/docs/limits-and-quotas.md +24 -0
- package/docs/mcp.md +3 -2
- package/docs/networking.md +7 -1
- package/docs/outputs.md +36 -7
- package/docs/provider-runtime-capabilities.md +1 -1
- package/docs/quickstart.md +17 -7
- package/docs/run-config.md +3 -3
- package/docs/secrets.md +14 -0
- package/docs/skills.md +74 -44
- package/docs/vision-skills.md +3 -3
- package/examples/feature-tour.ts +4 -6
- package/examples/spike-settle-latency.ts +125 -0
- package/package.json +4 -3
- package/dist/_contracts/event-guards.d.ts +0 -67
- package/dist/_contracts/event-guards.js +0 -36
- package/dist/skill-tool.d.ts +0 -102
- package/dist/skill-tool.js +0 -190
- package/dist/skill-tool.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentsMdRef, FileRef, McpServerRef,
|
|
1
|
+
import type { AgentsMdRef, FileRef, McpServerRef, ResolvedSkillRef, SkillRef, ToolRef } from "./run-config.js";
|
|
2
2
|
import { type RuntimeSize } from "./runtime-sizes.js";
|
|
3
3
|
import { type RunModel } from "./models.js";
|
|
4
4
|
import { type RuntimeSecurityProfileName } from "./runtime-security-profile.js";
|
|
@@ -207,10 +207,9 @@ export declare function optionalPositiveNumber(input: unknown, field: string): n
|
|
|
207
207
|
* only the non-secret half; bearer headers travel in
|
|
208
208
|
* `secrets.mcpServers` keyed by `name`.
|
|
209
209
|
*
|
|
210
|
-
* `tools` is the union of builtin tool names
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* refs snapshotted into the run-owned prefix before dispatch.
|
|
210
|
+
* `tools` is the union of builtin tool names and custom `ToolRef` bundles;
|
|
211
|
+
* parsing splits them into `tools` and `builtinTools`. Skills are a SEPARATE
|
|
212
|
+
* first-class input on `skills` (by-name refs), NOT part of `tools`.
|
|
214
213
|
*/
|
|
215
214
|
export interface PlatformSubmission {
|
|
216
215
|
readonly model: RunModel;
|
|
@@ -218,13 +217,21 @@ export interface PlatformSubmission {
|
|
|
218
217
|
readonly prompt: readonly string[];
|
|
219
218
|
readonly tools?: readonly ToolRef[];
|
|
220
219
|
/**
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
220
|
+
* Workspace skills referenced BY NAME (`{ kind:"skill", name }`). This is the
|
|
221
|
+
* public ingress shape the SDK sends and the ONLY skill field the idempotency
|
|
222
|
+
* hash covers. The platform resolves each name to the workspace skill's
|
|
223
|
+
* current bytes at submit time; a re-upload under the same name changes what
|
|
224
|
+
* later runs see (the name-only ref, and therefore the hash, is unchanged).
|
|
226
225
|
*/
|
|
227
|
-
readonly
|
|
226
|
+
readonly skills?: readonly SkillRef[];
|
|
227
|
+
/**
|
|
228
|
+
* BOOT-RECORD-ONLY, trusted resolution of {@link skills}. The BFF resolver
|
|
229
|
+
* fills this (name → current `assetId` + `description`) before persisting the
|
|
230
|
+
* boot record; the in-container re-parse and manifest/materialize layers read
|
|
231
|
+
* it. Rejected on public ingress (only accepted under a trusted re-parse) and
|
|
232
|
+
* NOT part of the idempotency hash — it is derived, like sealed secrets.
|
|
233
|
+
*/
|
|
234
|
+
readonly resolvedSkills?: readonly ResolvedSkillRef[];
|
|
228
235
|
readonly agentsMd: readonly AgentsMdRef[];
|
|
229
236
|
readonly files: readonly FileRef[];
|
|
230
237
|
readonly mcpServers: readonly McpServerRef[];
|
|
@@ -268,9 +275,26 @@ export interface PlatformSubmission {
|
|
|
268
275
|
/**
|
|
269
276
|
* Assistant-output granularity. `buffered` (the default) emits one event per
|
|
270
277
|
* assistant message; `stream` emits the agent's per-token text deltas as they
|
|
271
|
-
* arrive
|
|
278
|
+
* arrive, THEN a final coalesced block. Streaming is CAPABILITY-GATED: it is
|
|
279
|
+
* only honored for a streamable provider (see {@link STREAMABLE_SHAPES}) and a
|
|
280
|
+
* `stream` mode on a non-streamable provider is rejected at parse
|
|
281
|
+
* ({@link assertStreamableOutputMode}) — no silent downgrade.
|
|
272
282
|
*/
|
|
273
283
|
readonly outputMode?: OutputMode;
|
|
284
|
+
/**
|
|
285
|
+
* Structured-output policy. `{ kind: 'text' }` (default) is free-form; a
|
|
286
|
+
* `{ kind: 'json_schema', … }` requests provider-native constrained decode.
|
|
287
|
+
* The run's typed outcome is then `decoded | refused` — no untyped path yields
|
|
288
|
+
* a hallucinated object. Fail-closed for a provider lacking the capability.
|
|
289
|
+
*/
|
|
290
|
+
readonly responseFormat?: ResponseFormat;
|
|
291
|
+
/**
|
|
292
|
+
* Declarative HITL write-gate: the platform parks the session
|
|
293
|
+
* `awaiting_approval` BEFORE dispatching any listed tool, holding for an
|
|
294
|
+
* `approve()`/`deny()`. Structural — independent of model prose. Empty/absent
|
|
295
|
+
* ⇒ no gate.
|
|
296
|
+
*/
|
|
297
|
+
readonly approvalGate?: ApprovalGate;
|
|
274
298
|
/**
|
|
275
299
|
* Platform-injection controls. The platform prepends a small system
|
|
276
300
|
* prompt (see `platformSystemPrompt`) ahead of `system` to explain
|
|
@@ -384,6 +408,15 @@ export interface RunLimits {
|
|
|
384
408
|
* single source of truth for that wire→boot name mapping.
|
|
385
409
|
*/
|
|
386
410
|
readonly maxSpendUsd?: number;
|
|
411
|
+
/**
|
|
412
|
+
* Maximum number of agent ITERATIONS (turns) the run may take before the
|
|
413
|
+
* platform parks it terminal. A positive integer; omitted ⇒ the platform
|
|
414
|
+
* default (`RUN_DEFAULT_MAX_TURNS`). Previously a bare server literal absent
|
|
415
|
+
* from both the public contract and the limits SSoT — now a settable dial.
|
|
416
|
+
* Only shape/positivity are validated here; clamping to the ceiling is the
|
|
417
|
+
* resolver's job.
|
|
418
|
+
*/
|
|
419
|
+
readonly maxTurns?: number;
|
|
387
420
|
}
|
|
388
421
|
/**
|
|
389
422
|
* Per-run machine/capacity intent. v1 exposes only `spot`: opt the run into
|
|
@@ -418,6 +451,13 @@ export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "wor
|
|
|
418
451
|
readonly timeout?: string;
|
|
419
452
|
};
|
|
420
453
|
export interface ParseRunSubmissionOptions {
|
|
454
|
+
/**
|
|
455
|
+
* Set by the in-container re-parse of the boot record (`aws-compose.ts`) to
|
|
456
|
+
* accept trusted-only fields the BFF resolver wrote after ingress — currently
|
|
457
|
+
* `submission.resolvedSkills`. On the public ingress path this stays `false`
|
|
458
|
+
* so a caller can never inject a resolved skill (asset + description).
|
|
459
|
+
*/
|
|
460
|
+
readonly trustedReparse?: boolean;
|
|
421
461
|
}
|
|
422
462
|
export declare function parseRunSubmissionRequest(input: unknown, options?: ParseRunSubmissionOptions): PlatformRunSubmissionRequest;
|
|
423
463
|
/**
|
|
@@ -483,11 +523,61 @@ export declare function parseRunProvider(input: unknown): RunProvider;
|
|
|
483
523
|
export declare function enforceCredentialSecretPolicy(secrets: PlatformInlineSecrets, provider: RunProvider, opts?: {
|
|
484
524
|
readonly inheritsFromParent?: boolean;
|
|
485
525
|
}): void;
|
|
486
|
-
export declare function parseSubmission(input: unknown
|
|
526
|
+
export declare function parseSubmission(input: unknown, options?: {
|
|
527
|
+
readonly trustedReparse?: boolean;
|
|
528
|
+
}): PlatformSubmission;
|
|
487
529
|
/** Assistant-output granularity values. Buffered is the platform default. */
|
|
488
530
|
export declare const OUTPUT_MODES: readonly ["buffered", "stream"];
|
|
489
531
|
export type OutputMode = (typeof OUTPUT_MODES)[number];
|
|
490
532
|
export declare const DEFAULT_OUTPUT_MODE: OutputMode;
|
|
533
|
+
/**
|
|
534
|
+
* The provider wire-SHAPES that have a real per-token streaming producer. This
|
|
535
|
+
* const is the contracts-side SSoT, pinned EQUAL to the platform's shape SSoT by
|
|
536
|
+
* a cross-repo parity test so streaming can never be promised for a shape
|
|
537
|
+
* nothing feeds.
|
|
538
|
+
*/
|
|
539
|
+
export declare const STREAMABLE_SHAPES: readonly ["anthropic", "openai_chat"];
|
|
540
|
+
export type StreamableShape = (typeof STREAMABLE_SHAPES)[number];
|
|
541
|
+
/** True when a provider has a streaming producer wired (a {@link STREAMABLE_SHAPES} shape). */
|
|
542
|
+
export declare function isStreamableProvider(provider: RunProvider): boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Fail-closed streaming gate: `outputMode:'stream'` on a NON-streamable provider
|
|
545
|
+
* throws (a HARD reject — no silent downgrade to buffered). Called by
|
|
546
|
+
* {@link parseRunSubmissionRequest} once mode + provider are both known.
|
|
547
|
+
*/
|
|
548
|
+
export declare function assertStreamableOutputMode(outputMode: OutputMode | undefined, provider: RunProvider): void;
|
|
549
|
+
/** Response-format kinds: free-form `text` (default) or provider-native `json_schema`. */
|
|
550
|
+
export declare const RESPONSE_FORMAT_KINDS: readonly ["text", "json_schema"];
|
|
551
|
+
export type ResponseFormatKind = (typeof RESPONSE_FORMAT_KINDS)[number];
|
|
552
|
+
/**
|
|
553
|
+
* Structured-output policy. `{ kind: 'text' }` is free-form; `{ kind:
|
|
554
|
+
* 'json_schema', schema, strict?, name? }` requests provider-native constrained
|
|
555
|
+
* decode against `schema` (a JSON Schema object).
|
|
556
|
+
*/
|
|
557
|
+
export type ResponseFormat = {
|
|
558
|
+
readonly kind: "text";
|
|
559
|
+
} | {
|
|
560
|
+
readonly kind: "json_schema";
|
|
561
|
+
readonly schema: JsonValue;
|
|
562
|
+
readonly strict?: boolean;
|
|
563
|
+
readonly name?: string;
|
|
564
|
+
};
|
|
565
|
+
/**
|
|
566
|
+
* Parse the optional `submission.responseFormat`. Mirrors {@link parseOutputMode}
|
|
567
|
+
* / {@link OUTPUT_MODES}: absent ⇒ undefined; a bad `kind` or unknown subfield is
|
|
568
|
+
* rejected (fail-fast). `json_schema` requires a JSON-object `schema`.
|
|
569
|
+
*/
|
|
570
|
+
export declare function parseResponseFormat(input: unknown): ResponseFormat | undefined;
|
|
571
|
+
/** Declarative HITL write-gate: park `awaiting_approval` before any listed tool. */
|
|
572
|
+
export interface ApprovalGate {
|
|
573
|
+
readonly tools: readonly string[];
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Parse the optional `submission.approvalGate`. Absent / empty tool list ⇒
|
|
577
|
+
* undefined (no gate). Tool names are deduped; the strict allow-list mirrors the
|
|
578
|
+
* sibling parsers.
|
|
579
|
+
*/
|
|
580
|
+
export declare function parseApprovalGate(input: unknown): ApprovalGate | undefined;
|
|
491
581
|
/**
|
|
492
582
|
* The CLOSED set of builtin tool NAMES the managed runtime can inject — one per
|
|
493
583
|
* machine tool the hands implement. This list is the single source of truth for
|
|
@@ -499,7 +589,7 @@ export declare const DEFAULT_OUTPUT_MODE: OutputMode;
|
|
|
499
589
|
* Order mirrors `HANDS_TOOLS`. A builtin tool reference (a bare string in
|
|
500
590
|
* `submission.tools`) must be a member of this set.
|
|
501
591
|
*/
|
|
502
|
-
export declare const BUILTIN_TOOL_NAMES: readonly ["bash", "read_file", "write_file", "edit_file", "grep", "glob", "head", "tail", "todo_write", "subagent", "subagent_result", "web_fetch", "web_search", "bash_output", "bash_kill", "code_execution", "wait", "git"];
|
|
592
|
+
export declare const BUILTIN_TOOL_NAMES: readonly ["bash", "read_file", "write_file", "edit_file", "grep", "glob", "head", "tail", "todo_write", "subagent", "subagent_result", "web_fetch", "web_search", "bash_output", "bash_kill", "code_execution", "wait", "git", "ls", "stat", "wc"];
|
|
503
593
|
export type BuiltinToolName = (typeof BUILTIN_TOOL_NAMES)[number];
|
|
504
594
|
/**
|
|
505
595
|
* Typo-safe accessors for the closed builtin tool set: each key maps to the
|
|
@@ -529,12 +619,51 @@ export declare const BuiltinTools: {
|
|
|
529
619
|
readonly code_execution: "code_execution";
|
|
530
620
|
readonly wait: "wait";
|
|
531
621
|
readonly git: "git";
|
|
622
|
+
readonly ls: "ls";
|
|
623
|
+
readonly stat: "stat";
|
|
624
|
+
readonly wc: "wc";
|
|
532
625
|
};
|
|
533
626
|
/**
|
|
534
627
|
* The default builtin tool set injected when `includeBuiltinTools !== false`.
|
|
535
628
|
* It is the complete closed builtin set.
|
|
536
629
|
*/
|
|
537
630
|
export declare const DEFAULT_BUILTIN_TOOLS: readonly BuiltinToolName[];
|
|
631
|
+
/**
|
|
632
|
+
* Fixed name of the single skills meta-tool. Deliberately NOT a member of
|
|
633
|
+
* {@link BUILTIN_TOOL_NAMES} (that closed set is the customer-cherry-pickable
|
|
634
|
+
* toggle surface, pinned equal to `HANDS_TOOLS`) — the skills tool is IMPLIED by
|
|
635
|
+
* a run having ≥1 skill, not chosen, and is injected platform-side. Kept in
|
|
636
|
+
* lockstep with {@link SKILL_RESERVED_NAMES} so it can never be shadowed by a
|
|
637
|
+
* custom tool or skill of the same name.
|
|
638
|
+
*/
|
|
639
|
+
export declare const SKILLS_TOOL_NAME = "skills";
|
|
640
|
+
/**
|
|
641
|
+
* The single default `skills` meta-tool (list/load) the platform injects when a
|
|
642
|
+
* run references ≥1 workspace skill. Shared by the platform tool composer and
|
|
643
|
+
* kept adjacent to the reserved-name guard so the model-visible contract and the
|
|
644
|
+
* name reservation stay in one place. It replaces the former N per-skill no-arg
|
|
645
|
+
* load-tools with one arg-taking dispatcher.
|
|
646
|
+
*/
|
|
647
|
+
export declare const SKILLS_TOOL_DEFINITION: {
|
|
648
|
+
readonly name: "skills";
|
|
649
|
+
readonly description: string;
|
|
650
|
+
readonly input_schema: {
|
|
651
|
+
readonly type: "object";
|
|
652
|
+
readonly properties: {
|
|
653
|
+
readonly action: {
|
|
654
|
+
readonly type: "string";
|
|
655
|
+
readonly enum: readonly ["list", "load"];
|
|
656
|
+
readonly description: "'list' all skills, or 'load' one by name.";
|
|
657
|
+
};
|
|
658
|
+
readonly name: {
|
|
659
|
+
readonly type: "string";
|
|
660
|
+
readonly description: "Skill name to load (required when action='load').";
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
readonly required: readonly ["action"];
|
|
664
|
+
readonly additionalProperties: false;
|
|
665
|
+
};
|
|
666
|
+
};
|
|
538
667
|
/**
|
|
539
668
|
* Resolve the set of builtin tool NAMES a submission injects, deduplicated and
|
|
540
669
|
* in {@link BUILTIN_TOOL_NAMES} order.
|
|
@@ -548,3 +677,17 @@ export declare const DEFAULT_BUILTIN_TOOLS: readonly BuiltinToolName[];
|
|
|
548
677
|
* union is validated ⊆ the closed set so an invalid name can never leak through.
|
|
549
678
|
*/
|
|
550
679
|
export declare function resolveBuiltinToolNames(includeBuiltinTools: boolean | undefined, toolRefs?: readonly string[]): readonly BuiltinToolName[];
|
|
680
|
+
/**
|
|
681
|
+
* Upper bound on the number of workspace skills a single run may reference.
|
|
682
|
+
* A run's skill list is a discovery surface, not a bulk-mount channel; 64 is
|
|
683
|
+
* generous headroom over any realistic per-run set while capping the meta-tool
|
|
684
|
+
* `list` payload and the submit-time resolution fan-out.
|
|
685
|
+
*/
|
|
686
|
+
export declare const SKILLS_MAX = 64;
|
|
687
|
+
/**
|
|
688
|
+
* Parse `submission.skills`: an array of PUBLIC by-name skill refs
|
|
689
|
+
* (`{ kind:"skill", name }`). Validates each `name` against
|
|
690
|
+
* {@link SKILL_NAME_PATTERN}, rejects the `__` MCP separator and the reserved
|
|
691
|
+
* skills names, dedups by name, and bounds the list at {@link SKILLS_MAX}.
|
|
692
|
+
*/
|
|
693
|
+
export declare function parseSkills(input: unknown): readonly SkillRef[];
|