@aexhq/sdk 0.13.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +160 -0
- package/dist/_contracts/connection-ticket.d.ts +21 -0
- package/dist/_contracts/connection-ticket.js +49 -0
- package/dist/_contracts/event-envelope.d.ts +276 -0
- package/dist/_contracts/event-envelope.js +324 -0
- package/dist/_contracts/event-stream-client.d.ts +47 -0
- package/dist/_contracts/event-stream-client.js +141 -0
- package/dist/_contracts/http.d.ts +35 -0
- package/dist/_contracts/http.js +114 -0
- package/dist/_contracts/index.d.ts +28 -0
- package/dist/_contracts/index.js +29 -0
- package/dist/_contracts/managed-key.d.ts +74 -0
- package/dist/_contracts/managed-key.js +110 -0
- package/dist/_contracts/operations.d.ts +237 -0
- package/dist/_contracts/operations.js +632 -0
- package/dist/_contracts/provider-support.d.ts +220 -0
- package/dist/_contracts/provider-support.js +90 -0
- package/dist/_contracts/proxy-protocol.d.ts +257 -0
- package/dist/_contracts/proxy-protocol.js +234 -0
- package/dist/_contracts/proxy-validation.d.ts +19 -0
- package/dist/_contracts/proxy-validation.js +51 -0
- package/dist/_contracts/run-artifacts.d.ts +47 -0
- package/dist/_contracts/run-artifacts.js +101 -0
- package/dist/_contracts/run-config.d.ts +304 -0
- package/dist/_contracts/run-config.js +659 -0
- package/dist/_contracts/run-cost.d.ts +125 -0
- package/dist/_contracts/run-cost.js +616 -0
- package/dist/_contracts/run-custody.d.ts +226 -0
- package/dist/_contracts/run-custody.js +465 -0
- package/dist/_contracts/run-record.d.ts +127 -0
- package/dist/_contracts/run-record.js +177 -0
- package/dist/_contracts/run-retention.d.ts +213 -0
- package/dist/_contracts/run-retention.js +484 -0
- package/dist/_contracts/run-unit.d.ts +194 -0
- package/dist/_contracts/run-unit.js +215 -0
- package/dist/_contracts/runner-event.d.ts +114 -0
- package/dist/_contracts/runner-event.js +187 -0
- package/dist/_contracts/runtime-manifest.d.ts +106 -0
- package/dist/_contracts/runtime-manifest.js +98 -0
- package/dist/_contracts/runtime-security-profile.d.ts +27 -0
- package/dist/_contracts/runtime-security-profile.js +82 -0
- package/dist/_contracts/runtime-sizes.d.ts +144 -0
- package/dist/_contracts/runtime-sizes.js +136 -0
- package/dist/_contracts/runtime-types.d.ts +212 -0
- package/dist/_contracts/runtime-types.js +2 -0
- package/dist/_contracts/sdk-errors.d.ts +34 -0
- package/dist/_contracts/sdk-errors.js +52 -0
- package/dist/_contracts/sdk-secrets.d.ts +31 -0
- package/dist/_contracts/sdk-secrets.js +220 -0
- package/dist/_contracts/side-effect-audit.d.ts +129 -0
- package/dist/_contracts/side-effect-audit.js +494 -0
- package/dist/_contracts/sse.d.ts +74 -0
- package/dist/_contracts/sse.js +0 -0
- package/dist/_contracts/stable.d.ts +26 -0
- package/dist/_contracts/stable.js +44 -0
- package/dist/_contracts/status.d.ts +19 -0
- package/dist/_contracts/status.js +61 -0
- package/dist/_contracts/submission.d.ts +383 -0
- package/dist/_contracts/submission.js +1380 -0
- package/dist/agents-md.d.ts +46 -0
- package/dist/agents-md.js +83 -0
- package/dist/agents-md.js.map +1 -0
- package/dist/asset-upload.d.ts +66 -0
- package/dist/asset-upload.js +168 -0
- package/dist/asset-upload.js.map +1 -0
- package/dist/bundle.d.ts +33 -0
- package/dist/bundle.js +89 -0
- package/dist/bundle.js.map +1 -0
- package/dist/cli.mjs +4140 -0
- package/dist/cli.mjs.sha256 +1 -0
- package/dist/client.d.ts +460 -0
- package/dist/client.js +857 -0
- package/dist/client.js.map +1 -0
- package/dist/fetch-archive.d.ts +16 -0
- package/dist/fetch-archive.js +170 -0
- package/dist/fetch-archive.js.map +1 -0
- package/dist/file.d.ts +57 -0
- package/dist/file.js +153 -0
- package/dist/file.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +84 -0
- package/dist/mcp-server.js +114 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/node-fs.d.ts +12 -0
- package/dist/node-fs.js +44 -0
- package/dist/node-fs.js.map +1 -0
- package/dist/proxy-endpoint.d.ts +131 -0
- package/dist/proxy-endpoint.js +147 -0
- package/dist/proxy-endpoint.js.map +1 -0
- package/dist/skill.d.ts +117 -0
- package/dist/skill.js +169 -0
- package/dist/skill.js.map +1 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.js +10 -0
- package/dist/version.js.map +1 -0
- package/docs/cleanup.md +38 -0
- package/docs/credentials.md +153 -0
- package/docs/events.md +76 -0
- package/docs/mcp.md +47 -0
- package/docs/outputs.md +157 -0
- package/docs/product-boundaries.md +57 -0
- package/docs/provider-runtime-capabilities.md +103 -0
- package/docs/quickstart.md +110 -0
- package/docs/release.md +99 -0
- package/docs/run-config.md +53 -0
- package/docs/run-record.md +39 -0
- package/docs/skills.md +139 -0
- package/docs/testing.md +29 -0
- package/package.json +47 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny SSE (text/event-stream) parser used by the SDK / CLI to consume
|
|
3
|
+
* the dashboard's `/api/runs/:id/events/stream` endpoint without
|
|
4
|
+
* pulling in a DOM `EventSource` dependency. Node's `fetch` returns a
|
|
5
|
+
* web `ReadableStream<Uint8Array>` body; this parser turns that into
|
|
6
|
+
* an async iterable of `SseFrame`s.
|
|
7
|
+
*
|
|
8
|
+
* The wire grammar follows the WHATWG HTML spec § Server-sent events:
|
|
9
|
+
*
|
|
10
|
+
* - Lines are separated by `\n`, `\r`, or `\r\n`.
|
|
11
|
+
* - A `:` prefix marks a comment — ignored.
|
|
12
|
+
* - `field: value` (or `field:value`, with no space) — leading space
|
|
13
|
+
* after the colon is stripped.
|
|
14
|
+
* - Recognised fields: `event`, `data`, `id`, `retry`.
|
|
15
|
+
* - Multiple `data:` lines join with `\n`.
|
|
16
|
+
* - A blank line dispatches the current frame and resets the buffer.
|
|
17
|
+
* - `event:` defaults to `"message"` when absent.
|
|
18
|
+
*
|
|
19
|
+
* The parser is deliberately a free function so it can be unit-tested
|
|
20
|
+
* against synthesized chunk boundaries (one byte at a time, mid-frame,
|
|
21
|
+
* across UTF-8 multi-byte sequences) without spinning up a real
|
|
22
|
+
* connection.
|
|
23
|
+
*/
|
|
24
|
+
export interface SseFrame {
|
|
25
|
+
readonly id?: string;
|
|
26
|
+
readonly event: string;
|
|
27
|
+
readonly data: string;
|
|
28
|
+
readonly retry?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Stateful parser: feed in chunks (in any size), pull out completed
|
|
32
|
+
* frames. Designed for `for await` consumption — see `iterateSse`.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SseParser {
|
|
35
|
+
#private;
|
|
36
|
+
/**
|
|
37
|
+
* Push a chunk of raw bytes through the parser. Returns any frames
|
|
38
|
+
* that completed during this chunk. Chunks may contain zero, one,
|
|
39
|
+
* or many frame boundaries — the parser handles partial trailing
|
|
40
|
+
* data internally.
|
|
41
|
+
*/
|
|
42
|
+
pushBytes(chunk: Uint8Array): readonly SseFrame[];
|
|
43
|
+
/**
|
|
44
|
+
* Push a text chunk directly. Used by the parser tests so they can
|
|
45
|
+
* exercise byte-boundary edge cases without manufacturing a
|
|
46
|
+
* `TextDecoder` round-trip.
|
|
47
|
+
*/
|
|
48
|
+
pushText(text: string): readonly SseFrame[];
|
|
49
|
+
/**
|
|
50
|
+
* Indicate end-of-stream. Returns any final frame that the dispatcher
|
|
51
|
+
* was holding when the stream closed mid-frame (no trailing blank
|
|
52
|
+
* line). The dispatcher pattern is: blank line dispatches; if the
|
|
53
|
+
* remote closes after a partial frame, that frame is dropped per the
|
|
54
|
+
* spec.
|
|
55
|
+
*/
|
|
56
|
+
flush(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Current "last event id" — the cursor the SSE spec instructs the
|
|
59
|
+
* client to replay on automatic reconnection. Callers use this to
|
|
60
|
+
* resume after a disconnect.
|
|
61
|
+
*/
|
|
62
|
+
get lastEventId(): string | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Convert a web `ReadableStream<Uint8Array>` (the body of a fetch
|
|
66
|
+
* Response) into an async iterable of SSE frames. The stream is
|
|
67
|
+
* consumed exactly once; the caller is responsible for cancelling
|
|
68
|
+
* the underlying reader on abort.
|
|
69
|
+
*
|
|
70
|
+
* The reader is raced against the abort signal so a long-blocked
|
|
71
|
+
* server (no chunks for many seconds) still releases the loop
|
|
72
|
+
* promptly when the consumer aborts.
|
|
73
|
+
*/
|
|
74
|
+
export declare function iterateSse(body: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncIterable<SseFrame>;
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical hosted aex API plane URL. Used as the default `baseUrl`
|
|
3
|
+
* for the SDK `AexClient` and the host-side CLI `--aex-url`
|
|
4
|
+
* flag.
|
|
5
|
+
*
|
|
6
|
+
* Pinned to `api.aex.dev` on purpose: the dashboard at
|
|
7
|
+
* `aex.dev` is the human UX surface, while `api.aex.dev`
|
|
8
|
+
* owns the runtime/API plane (run submission, provider proxy, MCP
|
|
9
|
+
* proxy, runner callbacks). Both the apex `aex.dev` and `www.` host
|
|
10
|
+
* may issue redirects, and HTTP clients strip the `Authorization`
|
|
11
|
+
* header on cross-origin redirects (WHATWG Fetch §5.5) — hitting them
|
|
12
|
+
* would make authenticated calls land as 401s. Always go direct to
|
|
13
|
+
* the API plane.
|
|
14
|
+
*
|
|
15
|
+
* A single canonical default is not a "footnote mode" — it is the
|
|
16
|
+
* canonical product. Self-hosted deployments override via the
|
|
17
|
+
* explicit `baseUrl` / `--aex-url` parameter. The value lives in
|
|
18
|
+
* source (no env-var override) so the agent reading the SDK call site
|
|
19
|
+
* can see exactly where the call goes.
|
|
20
|
+
*
|
|
21
|
+
* Kept in source with no env-var override so callers and agents can see the
|
|
22
|
+
* exact default API plane.
|
|
23
|
+
*/
|
|
24
|
+
export declare const AEX_DEFAULT_BASE_URL = "https://api.aex.dev";
|
|
25
|
+
export declare function stableStringify(value: unknown): string;
|
|
26
|
+
export declare function sha256(value: unknown): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical hosted aex API plane URL. Used as the default `baseUrl`
|
|
4
|
+
* for the SDK `AexClient` and the host-side CLI `--aex-url`
|
|
5
|
+
* flag.
|
|
6
|
+
*
|
|
7
|
+
* Pinned to `api.aex.dev` on purpose: the dashboard at
|
|
8
|
+
* `aex.dev` is the human UX surface, while `api.aex.dev`
|
|
9
|
+
* owns the runtime/API plane (run submission, provider proxy, MCP
|
|
10
|
+
* proxy, runner callbacks). Both the apex `aex.dev` and `www.` host
|
|
11
|
+
* may issue redirects, and HTTP clients strip the `Authorization`
|
|
12
|
+
* header on cross-origin redirects (WHATWG Fetch §5.5) — hitting them
|
|
13
|
+
* would make authenticated calls land as 401s. Always go direct to
|
|
14
|
+
* the API plane.
|
|
15
|
+
*
|
|
16
|
+
* A single canonical default is not a "footnote mode" — it is the
|
|
17
|
+
* canonical product. Self-hosted deployments override via the
|
|
18
|
+
* explicit `baseUrl` / `--aex-url` parameter. The value lives in
|
|
19
|
+
* source (no env-var override) so the agent reading the SDK call site
|
|
20
|
+
* can see exactly where the call goes.
|
|
21
|
+
*
|
|
22
|
+
* Kept in source with no env-var override so callers and agents can see the
|
|
23
|
+
* exact default API plane.
|
|
24
|
+
*/
|
|
25
|
+
export const AEX_DEFAULT_BASE_URL = "https://api.aex.dev";
|
|
26
|
+
export function stableStringify(value) {
|
|
27
|
+
return JSON.stringify(sortValue(value));
|
|
28
|
+
}
|
|
29
|
+
export function sha256(value) {
|
|
30
|
+
return createHash("sha256").update(typeof value === "string" ? value : stableStringify(value)).digest("hex");
|
|
31
|
+
}
|
|
32
|
+
function sortValue(value) {
|
|
33
|
+
if (Array.isArray(value)) {
|
|
34
|
+
return value.map(sortValue);
|
|
35
|
+
}
|
|
36
|
+
if (value && typeof value === "object") {
|
|
37
|
+
return Object.fromEntries(Object.entries(value)
|
|
38
|
+
.filter(([, item]) => item !== undefined)
|
|
39
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
40
|
+
.map(([key, item]) => [key, sortValue(item)]));
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=stable.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const RUN_STATUSES: readonly ["queued", "claiming", "provisioning", "session_created", "dispatched", "provider_running", "provider_idle", "provider_rescheduled", "cancelling", "capturing_outputs", "cleaning_up", "succeeded", "failed", "timed_out", "cancelled", "cleanup_failed", "pending_delete", "deleted"];
|
|
2
|
+
export type RunStatus = typeof RUN_STATUSES[number];
|
|
3
|
+
export type RunStatusKind = "active" | "terminal";
|
|
4
|
+
export declare const TERMINAL_RUN_STATUSES: readonly ["succeeded", "failed", "timed_out", "cancelled", "cleanup_failed", "pending_delete", "deleted"];
|
|
5
|
+
export declare function isTerminalRunStatus(status: RunStatus): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The closed set of terminal OUTCOMES the run-lifecycle funnel writes via
|
|
8
|
+
* `markRunTerminal` (and that a `run/terminal` event carries). This is a
|
|
9
|
+
* STRICT SUBSET of {@link TERMINAL_RUN_STATUSES}: the read-terminal set also
|
|
10
|
+
* includes the post-terminal housekeeping states (`cleanup_failed`,
|
|
11
|
+
* `pending_delete`, `deleted`) which the funnel never writes as an outcome.
|
|
12
|
+
* The worker's `TerminalRunStatus` and the workflow `TerminalOutcome` both
|
|
13
|
+
* derive from this so the four call sites can't drift.
|
|
14
|
+
*/
|
|
15
|
+
export declare const RUN_TERMINAL_OUTCOMES: readonly ["succeeded", "failed", "timed_out", "cancelled"];
|
|
16
|
+
export type RunTerminalOutcome = typeof RUN_TERMINAL_OUTCOMES[number];
|
|
17
|
+
export declare function getRunStatusKind(status: RunStatus): RunStatusKind;
|
|
18
|
+
export declare const CLEANUP_STATUSES: readonly ["not_started", "pending", "running", "succeeded", "failed_retryable", "failed_terminal", "skipped"];
|
|
19
|
+
export type CleanupStatus = typeof CLEANUP_STATUSES[number];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const RUN_STATUSES = [
|
|
2
|
+
"queued",
|
|
3
|
+
"claiming",
|
|
4
|
+
"provisioning",
|
|
5
|
+
"session_created",
|
|
6
|
+
"dispatched",
|
|
7
|
+
"provider_running",
|
|
8
|
+
"provider_idle",
|
|
9
|
+
"provider_rescheduled",
|
|
10
|
+
"cancelling",
|
|
11
|
+
"capturing_outputs",
|
|
12
|
+
"cleaning_up",
|
|
13
|
+
"succeeded",
|
|
14
|
+
"failed",
|
|
15
|
+
"timed_out",
|
|
16
|
+
"cancelled",
|
|
17
|
+
"cleanup_failed",
|
|
18
|
+
"pending_delete",
|
|
19
|
+
"deleted"
|
|
20
|
+
];
|
|
21
|
+
export const TERMINAL_RUN_STATUSES = [
|
|
22
|
+
"succeeded",
|
|
23
|
+
"failed",
|
|
24
|
+
"timed_out",
|
|
25
|
+
"cancelled",
|
|
26
|
+
"cleanup_failed",
|
|
27
|
+
"pending_delete",
|
|
28
|
+
"deleted"
|
|
29
|
+
];
|
|
30
|
+
const terminalRunStatuses = new Set(TERMINAL_RUN_STATUSES);
|
|
31
|
+
export function isTerminalRunStatus(status) {
|
|
32
|
+
return terminalRunStatuses.has(status);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The closed set of terminal OUTCOMES the run-lifecycle funnel writes via
|
|
36
|
+
* `markRunTerminal` (and that a `run/terminal` event carries). This is a
|
|
37
|
+
* STRICT SUBSET of {@link TERMINAL_RUN_STATUSES}: the read-terminal set also
|
|
38
|
+
* includes the post-terminal housekeeping states (`cleanup_failed`,
|
|
39
|
+
* `pending_delete`, `deleted`) which the funnel never writes as an outcome.
|
|
40
|
+
* The worker's `TerminalRunStatus` and the workflow `TerminalOutcome` both
|
|
41
|
+
* derive from this so the four call sites can't drift.
|
|
42
|
+
*/
|
|
43
|
+
export const RUN_TERMINAL_OUTCOMES = [
|
|
44
|
+
"succeeded",
|
|
45
|
+
"failed",
|
|
46
|
+
"timed_out",
|
|
47
|
+
"cancelled"
|
|
48
|
+
];
|
|
49
|
+
export function getRunStatusKind(status) {
|
|
50
|
+
return isTerminalRunStatus(status) ? "terminal" : "active";
|
|
51
|
+
}
|
|
52
|
+
export const CLEANUP_STATUSES = [
|
|
53
|
+
"not_started",
|
|
54
|
+
"pending",
|
|
55
|
+
"running",
|
|
56
|
+
"succeeded",
|
|
57
|
+
"failed_retryable",
|
|
58
|
+
"failed_terminal",
|
|
59
|
+
"skipped"
|
|
60
|
+
];
|
|
61
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { PROXY_ENDPOINT_DEFAULTS, type ProxyAuthShape, type ProxyMethod, type ProxyResponseMode } from "./proxy-protocol.js";
|
|
2
|
+
export { PROXY_ENDPOINT_DEFAULTS };
|
|
3
|
+
import type { AgentsMdRef, FileRef, McpServerRef, SkillRef } from "./run-config.js";
|
|
4
|
+
import { type RuntimeSize } from "./runtime-sizes.js";
|
|
5
|
+
import { type RuntimeSecurityProfileName } from "./runtime-security-profile.js";
|
|
6
|
+
import { type CredentialMode, type ManagedKeyPolicyV1 } from "./managed-key.js";
|
|
7
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
8
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
9
|
+
readonly [key: string]: JsonValue;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Networking + runtime-package snapshot carried inside a flat submission
|
|
13
|
+
* so the worker can deep-clone and mutate it per run (e.g. injecting the
|
|
14
|
+
* proxy hostname into `allowed_hosts`) without sharing state across
|
|
15
|
+
* concurrent runs.
|
|
16
|
+
*
|
|
17
|
+
* `envVars` is the customer-controlled key/value bag delivered into the
|
|
18
|
+
* managed container process and mirrored in the mounted `RUNTIME.env` /
|
|
19
|
+
* `RUNTIME.json` files. The same keys become `__KEY__` substitution targets
|
|
20
|
+
* in agent-facing markdown inside skill / agentsmd / file bundles. Aex-set
|
|
21
|
+
* runtime keys use the reserved `AEX_*` prefix; customer keys MUST NOT
|
|
22
|
+
* collide with that prefix.
|
|
23
|
+
*/
|
|
24
|
+
export interface PlatformEnvironment {
|
|
25
|
+
readonly networking?: PlatformNetworking;
|
|
26
|
+
readonly packages?: readonly PlatformPackage[];
|
|
27
|
+
readonly envVars?: Readonly<Record<string, string>>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reserved prefix for aex-set runtime env vars (`AEX_CLI`,
|
|
31
|
+
* `AEX_RUNTIME_JSON`, …). Customer `environment.envVars` keys carrying this
|
|
32
|
+
* prefix are rejected at submission parse time so platform-set values
|
|
33
|
+
* cannot be silently overwritten.
|
|
34
|
+
*/
|
|
35
|
+
export declare const AEX_RESERVED_ENV_PREFIX = "AEX_";
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of `environment.envVars` entries accepted per
|
|
38
|
+
* submission. Picked to be generous for real customer config bags
|
|
39
|
+
* (the broll case ships a handful — `BROLL_STORE`, `BROLL_OUTPUTS`,
|
|
40
|
+
* `BROLL_MODE`, …) while still bounding the size of every RUNTIME
|
|
41
|
+
* file we mount into the container.
|
|
42
|
+
*/
|
|
43
|
+
export declare const ENV_VARS_MAX_ENTRIES = 64;
|
|
44
|
+
/** Maximum byte length of a single `environment.envVars` value. */
|
|
45
|
+
export declare const ENV_VARS_MAX_VALUE_BYTES = 4096;
|
|
46
|
+
/** Maximum total byte length of all `environment.envVars` keys+values combined. */
|
|
47
|
+
export declare const ENV_VARS_MAX_TOTAL_BYTES = 65536;
|
|
48
|
+
export interface PlatformNetworking {
|
|
49
|
+
readonly mode: "limited" | "open";
|
|
50
|
+
/** Lowercase host names. The worker always appends the proxy host. */
|
|
51
|
+
readonly allowedHosts?: readonly string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Package-manager ecosystems accepted by the public submission schema.
|
|
55
|
+
* The customer encodes the target manager as a `name` prefix
|
|
56
|
+
* `"<eco>:<pkg>"` (e.g. "pip:pandas", "npm:express", "apt:ffmpeg"); an
|
|
57
|
+
* UNPREFIXED name defaults to `apt`. After parsing, `PlatformPackage.name`
|
|
58
|
+
* is the bare package and `PlatformPackage.ecosystem` is the resolved
|
|
59
|
+
* manager.
|
|
60
|
+
*/
|
|
61
|
+
export declare const PLATFORM_PACKAGE_ECOSYSTEMS: readonly ["apt", "npm", "pip"];
|
|
62
|
+
export type PlatformPackageEcosystem = (typeof PLATFORM_PACKAGE_ECOSYSTEMS)[number];
|
|
63
|
+
export interface PlatformPackage {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly version?: string;
|
|
66
|
+
readonly ecosystem: PlatformPackageEcosystem;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Render a parsed {@link PlatformPackage} as the version-embedded install
|
|
70
|
+
* string used by runtime materialization. The join differs per manager:
|
|
71
|
+
* - pip → `name==version`
|
|
72
|
+
* - npm → `name@version`
|
|
73
|
+
* - apt → `name=version`
|
|
74
|
+
* With no `version`, just the bare `name`. Pure; used by the managed runner
|
|
75
|
+
* package installer.
|
|
76
|
+
*/
|
|
77
|
+
export declare function packageInstallString(pkg: PlatformPackage): string;
|
|
78
|
+
export interface PlatformAnthropicSecrets {
|
|
79
|
+
readonly apiKey: string;
|
|
80
|
+
readonly baseUrl?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface PlatformDeepseekSecrets {
|
|
83
|
+
readonly apiKey: string;
|
|
84
|
+
readonly baseUrl?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface PlatformOpenAISecrets {
|
|
87
|
+
readonly apiKey: string;
|
|
88
|
+
readonly baseUrl?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface PlatformGeminiSecrets {
|
|
91
|
+
readonly apiKey: string;
|
|
92
|
+
readonly baseUrl?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface PlatformMistralSecrets {
|
|
95
|
+
readonly apiKey: string;
|
|
96
|
+
readonly baseUrl?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Run-time provider selector. Aex exposes one customer interface
|
|
100
|
+
* for every provider. All new submissions execute through the managed
|
|
101
|
+
* runtime; provider selection only decides which upstream model route
|
|
102
|
+
* the managed provider-proxy uses.
|
|
103
|
+
*/
|
|
104
|
+
export declare const RUN_PROVIDERS: readonly ["anthropic", "deepseek", "openai", "gemini", "mistral"];
|
|
105
|
+
export type RunProvider = (typeof RUN_PROVIDERS)[number];
|
|
106
|
+
export declare const DEFAULT_RUN_PROVIDER: RunProvider;
|
|
107
|
+
/**
|
|
108
|
+
* Customer-facing runtime selector. Optional on the wire; absent resolves
|
|
109
|
+
* to the same managed runtime as `"managed"`. `"native"` is no longer an
|
|
110
|
+
* accepted submission value and fails schema validation.
|
|
111
|
+
*/
|
|
112
|
+
export declare const RUNTIME_KINDS: readonly ["managed"];
|
|
113
|
+
export type RuntimeKind = (typeof RUNTIME_KINDS)[number];
|
|
114
|
+
/** Outcome of the centralized runtime-support check. */
|
|
115
|
+
export interface RuntimeSupportCheck {
|
|
116
|
+
readonly ok: boolean;
|
|
117
|
+
readonly message?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Centralized runtime-support validator. Native is removed from the public
|
|
121
|
+
* runtime enum, so an absent runtime and `"managed"` are the only supported
|
|
122
|
+
* inputs. Schema parsing rejects other runtime strings before this helper is
|
|
123
|
+
* reached, but the result type remains for SDK preflight checks.
|
|
124
|
+
*/
|
|
125
|
+
export declare function checkRuntimeSupported(provider: RunProvider, runtime: RuntimeKind | undefined): RuntimeSupportCheck;
|
|
126
|
+
export interface PlatformMcpServerSecret {
|
|
127
|
+
readonly name: string;
|
|
128
|
+
readonly url: string;
|
|
129
|
+
readonly headers?: Record<string, string>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Per-run auth value for a declared proxy endpoint. The `name` must
|
|
133
|
+
* match a `proxyEndpoints[i].name` in the same submission, and `value`'s
|
|
134
|
+
* shape must match that endpoint's `authShape.type`. The cross-validation
|
|
135
|
+
* lives in `parseRunSubmissionRequest`.
|
|
136
|
+
*/
|
|
137
|
+
export interface PlatformProxyEndpointAuth {
|
|
138
|
+
readonly name: string;
|
|
139
|
+
readonly value: PlatformProxyAuthValue;
|
|
140
|
+
}
|
|
141
|
+
export type PlatformProxyAuthValue = {
|
|
142
|
+
readonly type: "bearer";
|
|
143
|
+
readonly token: string;
|
|
144
|
+
} | {
|
|
145
|
+
readonly type: "basic";
|
|
146
|
+
readonly username: string;
|
|
147
|
+
readonly password: string;
|
|
148
|
+
} | {
|
|
149
|
+
readonly type: "header";
|
|
150
|
+
readonly value: string;
|
|
151
|
+
} | {
|
|
152
|
+
readonly type: "query";
|
|
153
|
+
readonly value: string;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Per-run inline secrets bundle. Exactly one of `anthropic` | `deepseek`
|
|
157
|
+
* | `openai` | `gemini` | `mistral` is required, matching the run's
|
|
158
|
+
* `provider`; the cross-provider coupling is enforced in
|
|
159
|
+
* `parseRunSubmissionRequest` so the wire shape stays simple and
|
|
160
|
+
* individual provider keys remain optional in the type system.
|
|
161
|
+
* `mcpServers` and `proxyEndpointAuth` are cross-provider (an MCP
|
|
162
|
+
* credential is the same secret whether Anthropic or another model is
|
|
163
|
+
* driving the MCP client).
|
|
164
|
+
*/
|
|
165
|
+
export interface PlatformInlineSecrets {
|
|
166
|
+
readonly anthropic?: PlatformAnthropicSecrets;
|
|
167
|
+
readonly deepseek?: PlatformDeepseekSecrets;
|
|
168
|
+
readonly openai?: PlatformOpenAISecrets;
|
|
169
|
+
readonly gemini?: PlatformGeminiSecrets;
|
|
170
|
+
readonly mistral?: PlatformMistralSecrets;
|
|
171
|
+
readonly mcpServers?: readonly PlatformMcpServerSecret[];
|
|
172
|
+
readonly proxyEndpointAuth?: readonly PlatformProxyEndpointAuth[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Per-run named HTTP proxy endpoint. The `authShape` describes how the
|
|
176
|
+
* upstream expects auth; the actual value is supplied separately via
|
|
177
|
+
* `secrets.proxyEndpointAuth`. The auth value never enters the
|
|
178
|
+
* container — the BFF proxy injects it on outbound calls.
|
|
179
|
+
*
|
|
180
|
+
* Caps and allow-lists below are intentionally pessimistic by default
|
|
181
|
+
* so a misconfigured endpoint can't accidentally permit a wide attack
|
|
182
|
+
* surface; raise per endpoint if needed.
|
|
183
|
+
*/
|
|
184
|
+
export interface PlatformProxyEndpoint {
|
|
185
|
+
readonly name: string;
|
|
186
|
+
readonly baseUrl: string;
|
|
187
|
+
readonly authShape: ProxyAuthShape;
|
|
188
|
+
readonly allowMethods: readonly ProxyMethod[];
|
|
189
|
+
readonly allowPathPrefixes: readonly string[];
|
|
190
|
+
readonly allowHeaders?: readonly string[];
|
|
191
|
+
readonly responseMode?: ProxyResponseMode;
|
|
192
|
+
readonly maxRequestBytes?: number;
|
|
193
|
+
readonly maxResponseBytes?: number;
|
|
194
|
+
readonly timeoutMs?: number;
|
|
195
|
+
readonly perCallBudget?: number;
|
|
196
|
+
readonly responseByteBudget?: number;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The proxy body-redactor refuses to mask any derived target string shorter
|
|
200
|
+
* than this many bytes — masking a 1-byte literal would corrupt the response
|
|
201
|
+
* body. This is the floor for the *derived* redaction targets (e.g.
|
|
202
|
+
* `Bearer <token>`, base64 fragments), used by
|
|
203
|
+
* the hosted proxy redactor, which imports this constant so the two sides can
|
|
204
|
+
* never silently diverge.
|
|
205
|
+
*/
|
|
206
|
+
export declare const MIN_REDACTION_TARGET_BYTES = 4;
|
|
207
|
+
/**
|
|
208
|
+
* Wire-level submission posted to /api/runs in the flat surface. The
|
|
209
|
+
* `prompt` is always an array internally so the worker, the audit log,
|
|
210
|
+
* and the BFF idempotency hash all see one shape. `mcpServers` carries
|
|
211
|
+
* only the non-secret half; bearer headers travel in
|
|
212
|
+
* `secrets.mcpServers` keyed by `name`.
|
|
213
|
+
*
|
|
214
|
+
* `skills` is a list of `SkillRef`s — workspace refs point at
|
|
215
|
+
* `skill_bundles.id` (validated by the BFF before acceptance and pinned
|
|
216
|
+
* into `run_skill_snapshots`), provider refs pass through unchanged.
|
|
217
|
+
*/
|
|
218
|
+
export interface PlatformSubmission {
|
|
219
|
+
readonly model: string;
|
|
220
|
+
readonly system?: string;
|
|
221
|
+
readonly prompt: readonly string[];
|
|
222
|
+
readonly skills: readonly SkillRef[];
|
|
223
|
+
readonly agentsMd: readonly AgentsMdRef[];
|
|
224
|
+
readonly files: readonly FileRef[];
|
|
225
|
+
readonly mcpServers: readonly McpServerRef[];
|
|
226
|
+
readonly environment?: PlatformEnvironment;
|
|
227
|
+
readonly securityProfile?: RuntimeSecurityProfileName;
|
|
228
|
+
readonly metadata?: Record<string, JsonValue>;
|
|
229
|
+
/**
|
|
230
|
+
* Output capture policy. Omit `outputs.allowedDirs` to capture the whole
|
|
231
|
+
* filesystem delta; provide it to narrow capture to the listed roots.
|
|
232
|
+
* `outputs.deniedDirs` subtracts denied roots/patterns from the allowed set.
|
|
233
|
+
*/
|
|
234
|
+
readonly outputs?: PlatformOutputCaptureConfig;
|
|
235
|
+
/**
|
|
236
|
+
* Optional override for the Goose builtin extensions enabled inside
|
|
237
|
+
* the runner container. Each entry is the bare name accepted by
|
|
238
|
+
* `goose run --with-builtin <NAME>` (see Goose v1.34.1's
|
|
239
|
+
* `crates/goose-cli/src/cli.rs` `with-builtin` flag). The platform
|
|
240
|
+
* default is `["developer"]` which gives the agent shell + write +
|
|
241
|
+
* edit + tree tools (bash, grep via shell, file read via shell or
|
|
242
|
+
* editor, file edit). To opt in to more tools (e.g. web search via
|
|
243
|
+
* the `computercontroller` extension), pass the full list. To opt
|
|
244
|
+
* out of all builtins (pure-MCP setup), pass an empty array.
|
|
245
|
+
*
|
|
246
|
+
* Validation:
|
|
247
|
+
* - Each entry matches /^[a-z][a-z0-9_-]{0,63}$/ (Goose builtin
|
|
248
|
+
* naming convention).
|
|
249
|
+
* - Max 16 entries.
|
|
250
|
+
* - Deduplicated.
|
|
251
|
+
*
|
|
252
|
+
* The dispatcher accepts and persists it for snapshot fidelity.
|
|
253
|
+
*/
|
|
254
|
+
readonly builtins?: readonly string[];
|
|
255
|
+
/**
|
|
256
|
+
* Platform-injection controls. The platform prepends a small system
|
|
257
|
+
* prompt (see `platformSystemPrompt`) ahead of `system` to explain
|
|
258
|
+
* managed-run expectations such as durable file capture. Set
|
|
259
|
+
* `systemPrompt: "off"` to suppress that injection and have the runtime
|
|
260
|
+
* see only the customer's own `system`. Omitting the field (or
|
|
261
|
+
* `systemPrompt: "default"`) keeps the injection on.
|
|
262
|
+
*
|
|
263
|
+
* This does not change output capture scope. Omitted
|
|
264
|
+
* `outputs.allowedDirs` means capture all created/modified files; explicit
|
|
265
|
+
* `outputs.allowedDirs` narrows it.
|
|
266
|
+
*/
|
|
267
|
+
readonly platform?: PlatformInjectionConfig;
|
|
268
|
+
}
|
|
269
|
+
export interface PlatformOutputCaptureConfig {
|
|
270
|
+
/**
|
|
271
|
+
* Allowed capture roots. Omit or pass an empty list to use the default
|
|
272
|
+
* whole-filesystem delta capture. Entries are absolute UNIX paths.
|
|
273
|
+
*/
|
|
274
|
+
readonly allowedDirs?: readonly string[];
|
|
275
|
+
/**
|
|
276
|
+
* Denied capture roots/patterns. These are subtracted from the allowed roots;
|
|
277
|
+
* platform-mandatory denies always apply and cannot be re-included.
|
|
278
|
+
*/
|
|
279
|
+
readonly deniedDirs?: readonly string[];
|
|
280
|
+
}
|
|
281
|
+
export interface PlatformInjectionConfig {
|
|
282
|
+
readonly systemPrompt?: "default" | "off";
|
|
283
|
+
}
|
|
284
|
+
export interface PlatformRunSubmissionRequest {
|
|
285
|
+
readonly workspaceId: string;
|
|
286
|
+
readonly idempotencyKey: string;
|
|
287
|
+
/**
|
|
288
|
+
* Credential source for upstream provider access. Omitted means
|
|
289
|
+
* `"byok"` for compatibility with the current production path.
|
|
290
|
+
* `"managed"` is a public contract value but remains fail-closed until
|
|
291
|
+
* credential resolution and billing admission are available.
|
|
292
|
+
*/
|
|
293
|
+
readonly credentialMode: CredentialMode;
|
|
294
|
+
/**
|
|
295
|
+
* Provider selector. Always populated after parsing — absent on the
|
|
296
|
+
* wire means {@link DEFAULT_RUN_PROVIDER}. All providers are dispatched
|
|
297
|
+
* through the managed runtime.
|
|
298
|
+
*/
|
|
299
|
+
readonly provider: RunProvider;
|
|
300
|
+
/**
|
|
301
|
+
* Customer's explicit runtime choice. `undefined` and `"managed"` both
|
|
302
|
+
* resolve to the managed runtime. Other runtime values are rejected by
|
|
303
|
+
* `parseRunSubmissionRequest`.
|
|
304
|
+
*/
|
|
305
|
+
readonly runtime?: RuntimeKind;
|
|
306
|
+
readonly submission: PlatformSubmission;
|
|
307
|
+
readonly secrets: PlatformInlineSecrets;
|
|
308
|
+
readonly proxyEndpoints?: readonly PlatformProxyEndpoint[];
|
|
309
|
+
/**
|
|
310
|
+
* Managed runtime size. One of the closed {@link RuntimeSize} preset tokens
|
|
311
|
+
* or absent (downstream applies the default).
|
|
312
|
+
*/
|
|
313
|
+
readonly runtimeSize?: RuntimeSize;
|
|
314
|
+
/**
|
|
315
|
+
* Run deadline in milliseconds, normalised by the parser from the wire
|
|
316
|
+
* `timeout` duration string (bounded to [1m, 6h]). Absent ⇒
|
|
317
|
+
* {@link DEFAULT_RUN_TIMEOUT_MS} (1h). Applies to the managed runner's
|
|
318
|
+
* terminal wait window and self-kill deadline.
|
|
319
|
+
*/
|
|
320
|
+
readonly timeoutMs?: number;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Wire shape posted by the SDK and CLI. `workspaceId` is **omitted by
|
|
324
|
+
* design** — token-authenticated clients never name the workspace
|
|
325
|
+
* because it is derived from their API token on the server. The BFF
|
|
326
|
+
* route resolves the workspace from the token and injects it before
|
|
327
|
+
* calling the parser. The dashboard UI (Auth.js user principal,
|
|
328
|
+
* multi-workspace) is the only caller that supplies `workspaceId`
|
|
329
|
+
* itself.
|
|
330
|
+
*
|
|
331
|
+
* `provider` is also optional on the wire — absent means
|
|
332
|
+
* {@link DEFAULT_RUN_PROVIDER} (`anthropic`). The parser fills it in
|
|
333
|
+
* before the value enters the run snapshot.
|
|
334
|
+
*/
|
|
335
|
+
export type PlatformRunSubmissionInput = Omit<PlatformRunSubmissionRequest, "workspaceId" | "credentialMode" | "provider" | "runtime" | "timeoutMs"> & {
|
|
336
|
+
readonly workspaceId?: string;
|
|
337
|
+
readonly credentialMode?: CredentialMode;
|
|
338
|
+
readonly provider?: RunProvider;
|
|
339
|
+
/**
|
|
340
|
+
* Optional runtime selector. Set `"managed"` explicitly or omit the
|
|
341
|
+
* field; both resolve to the managed runtime. `"native"` is no longer
|
|
342
|
+
* accepted.
|
|
343
|
+
*/
|
|
344
|
+
readonly runtime?: RuntimeKind;
|
|
345
|
+
/**
|
|
346
|
+
* Run deadline as a human duration string (`"1h"`, `"90m"`, `"30s"`).
|
|
347
|
+
* Parsed + bounded to [1m, 6h] server-side into
|
|
348
|
+
* {@link PlatformRunSubmissionRequest.timeoutMs}. Absent ⇒ 1h default.
|
|
349
|
+
*/
|
|
350
|
+
readonly timeout?: string;
|
|
351
|
+
};
|
|
352
|
+
export interface ParseRunSubmissionOptions {
|
|
353
|
+
readonly managedKeyPolicy?: ManagedKeyPolicyV1;
|
|
354
|
+
}
|
|
355
|
+
export declare function parseRunSubmissionRequest(input: unknown, options?: ParseRunSubmissionOptions): PlatformRunSubmissionRequest;
|
|
356
|
+
/**
|
|
357
|
+
* Codes emitted when a submission contains features the active runtime cannot
|
|
358
|
+
* serve. Code values are stable so dashboard / SDK error rendering can branch
|
|
359
|
+
* on them.
|
|
360
|
+
*/
|
|
361
|
+
export declare const RUNTIME_VALIDATION_CODES: readonly ["feature_runtime_mismatch"];
|
|
362
|
+
export type RuntimeValidationCode = (typeof RUNTIME_VALIDATION_CODES)[number];
|
|
363
|
+
/**
|
|
364
|
+
* Thrown by `parseRunSubmissionRequest` and `selectRuntime` when the submitted
|
|
365
|
+
* run cannot be served by the active managed runtime. The `code` field is part
|
|
366
|
+
* of the public contract; keep it stable when phrasing changes.
|
|
367
|
+
*/
|
|
368
|
+
export declare class RuntimeValidationError extends Error {
|
|
369
|
+
readonly code: RuntimeValidationCode;
|
|
370
|
+
constructor(code: RuntimeValidationCode, message: string);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Walk the parsed submission and collect features that the active managed
|
|
374
|
+
* runtime cannot serve. Provider-hosted skill refs (`Skill.provider(...)`) are
|
|
375
|
+
* rejected now that new submissions only dispatch through managed runs.
|
|
376
|
+
*/
|
|
377
|
+
export declare function collectManagedUnsupportedFeatures(req: PlatformRunSubmissionRequest): string[];
|
|
378
|
+
/**
|
|
379
|
+
* Backward-incompatible replacement for the old dual-runtime dispatcher. It is
|
|
380
|
+
* kept as a pure helper so SDK, CLI, and tests can resolve the runtime without
|
|
381
|
+
* I/O.
|
|
382
|
+
*/
|
|
383
|
+
export declare function selectRuntime(req: PlatformRunSubmissionRequest): RuntimeKind;
|