@aexhq/sdk 0.18.1 → 0.20.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 +2 -2
- package/dist/_contracts/models.d.ts +133 -38
- package/dist/_contracts/models.js +114 -69
- package/dist/_contracts/operations.d.ts +17 -1
- package/dist/_contracts/operations.js +50 -0
- package/dist/_contracts/provider-support.d.ts +68 -0
- package/dist/_contracts/provider-support.js +28 -0
- package/dist/_contracts/run-config.d.ts +1 -1
- package/dist/_contracts/run-cost.d.ts +27 -0
- package/dist/_contracts/run-cost.js +34 -1
- package/dist/_contracts/runtime-types.d.ts +32 -0
- package/dist/_contracts/submission.d.ts +58 -2
- package/dist/_contracts/submission.js +106 -7
- package/dist/agents-md.d.ts +3 -3
- package/dist/agents-md.js +6 -6
- package/dist/agents-md.js.map +1 -1
- package/dist/cli.mjs +116 -86
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +90 -10
- package/dist/client.js +121 -40
- package/dist/client.js.map +1 -1
- package/dist/fetch-archive.js +1 -1
- package/dist/file.d.ts +3 -3
- package/dist/file.js +6 -6
- package/dist/file.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/proxy-endpoint.d.ts +2 -2
- package/dist/proxy-endpoint.js +1 -1
- package/dist/secret.d.ts +102 -0
- package/dist/secret.js +148 -0
- package/dist/secret.js.map +1 -0
- package/dist/skill.d.ts +8 -8
- package/dist/skill.js +10 -10
- package/dist/skill.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/cleanup.md +1 -1
- package/docs/credentials.md +4 -4
- package/docs/events.md +2 -2
- package/docs/outputs.md +3 -3
- package/docs/provider-runtime-capabilities.md +23 -1
- package/docs/quickstart.md +7 -7
- package/docs/run-config.md +4 -4
- package/docs/skills.md +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
* wrapper. Everything else is types, errors, and event type guards re-exported
|
|
8
8
|
* from `@aexhq/contracts`.
|
|
9
9
|
*/
|
|
10
|
-
export { AgentsMdClient, AgentExecutor, FilesClient, SkillsClient } from "./client.js";
|
|
10
|
+
export { AgentsMdClient, AgentExecutor, FilesClient, SecretsClient, SkillsClient } from "./client.js";
|
|
11
11
|
// Composition primitives
|
|
12
12
|
export { Skill } from "./skill.js";
|
|
13
13
|
export { AgentsMd } from "./agents-md.js";
|
|
14
14
|
export { File } from "./file.js";
|
|
15
15
|
export { McpServer } from "./mcp-server.js";
|
|
16
16
|
export { ProxyEndpoint } from "./proxy-endpoint.js";
|
|
17
|
+
export { Secret } from "./secret.js";
|
|
17
18
|
export { bundleSkillFiles, hashSkillBundle } from "./bundle.js";
|
|
18
19
|
// Errors
|
|
19
20
|
export { AexApiError, AexError, CleanupError, CredentialValidationError, ProviderError, RunStateError } from "./_contracts/index.js";
|
|
@@ -31,7 +32,7 @@ export { BUILTINS, Builtins } from "./_contracts/index.js";
|
|
|
31
32
|
// Provider + runtime dispatch surface. Agents and SDK consumers
|
|
32
33
|
// inspect these to know which (provider, runtime) combos are valid
|
|
33
34
|
// and to validate submissions offline before posting.
|
|
34
|
-
export { CREDENTIAL_MODES, DEFAULT_CREDENTIAL_MODE, collectManagedUnsupportedFeatures, DEFAULT_RUN_PROVIDER, RUN_MODELS, RUN_MODELS_BY_PROVIDER, Models, RunModels, providerForModel, isRunModel, parseRunModel, Providers, RUN_PROVIDERS, RUNTIME_KINDS, RUNTIME_VALIDATION_CODES, RuntimeValidationError, selectRuntime } from "./_contracts/index.js";
|
|
35
|
+
export { CREDENTIAL_MODES, DEFAULT_CREDENTIAL_MODE, collectManagedUnsupportedFeatures, DEFAULT_RUN_PROVIDER, RUN_MODELS, RUN_MODELS_BY_PROVIDER, MODEL_PROVIDER_IDS, Models, RunModels, providerForModel, providersForModel, resolveProviderModelId, isRunModel, parseRunModel, Providers, RUN_PROVIDERS, RUNTIME_KINDS, RUNTIME_VALIDATION_CODES, RuntimeValidationError, selectRuntime } from "./_contracts/index.js";
|
|
35
36
|
// Normalized coordinator event guards
|
|
36
37
|
export { AEX_RUN_SETTLED_NAME, isCustom, isEventChannel, isFromSource, isLog, isRunError, isRunFinished, isRunSettled, isRunStarted, isRunTerminal, isTextMessage, isToolCallResult, isToolCallStart } from "./_contracts/index.js";
|
|
37
38
|
// Secret utilities
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAatG,yBAAyB;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGhE,SAAS;AACT,OAAO,EACL,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACb,aAAa,EACd,MAAM,kBAAkB,CAAC;AAE1B,yBAAyB;AACzB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AA4D1B,oEAAoE;AACpE,6EAA6E;AAC7E,6DAA6D;AAC7D,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACb,MAAM,kBAAkB,CAAC;AAG1B,+DAA+D;AAC/D,2CAA2C;AAC3C,mEAAmE;AACnE,4BAA4B;AAC5B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGtD,gEAAgE;AAChE,mEAAmE;AACnE,sDAAsD;AACtD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,iCAAiC,EACjC,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACtB,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACd,MAAM,kBAAkB,CAAC;AAS1B,sCAAsC;AACtC,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,KAAK,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/proxy-endpoint.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { type PlatformProxyAuthValue, type PlatformProxyEndpoint, type PlatformP
|
|
|
16
16
|
* Wire-format unchanged: the SDK splits each `ProxyEndpoint` instance
|
|
17
17
|
* into a `PlatformProxyEndpoint` (the non-secret declaration) plus a
|
|
18
18
|
* `PlatformProxyEndpointAuth` entry (the per-request secret) at
|
|
19
|
-
* `
|
|
19
|
+
* `submit` time, exactly the way `McpServer` already splits
|
|
20
20
|
* `headers` into `secrets.mcpServers`.
|
|
21
21
|
*
|
|
22
22
|
* Five named constructors:
|
|
@@ -116,7 +116,7 @@ export declare class ProxyEndpoint {
|
|
|
116
116
|
/**
|
|
117
117
|
* Split a list of `ProxyEndpoint` instances into the public declarations
|
|
118
118
|
* (`proxyEndpoints[]`) and the per-request auth bundle
|
|
119
|
-
* (`secrets.proxyEndpointAuth[]`). Mirrors the way `
|
|
119
|
+
* (`secrets.proxyEndpointAuth[]`). Mirrors the way `submit` already
|
|
120
120
|
* splits `McpServer.headers` into `secrets.mcpServers[]`.
|
|
121
121
|
*
|
|
122
122
|
* Throws on duplicate endpoint names — names are the cross-reference
|
package/dist/proxy-endpoint.js
CHANGED
|
@@ -65,7 +65,7 @@ export class ProxyEndpoint {
|
|
|
65
65
|
/**
|
|
66
66
|
* Split a list of `ProxyEndpoint` instances into the public declarations
|
|
67
67
|
* (`proxyEndpoints[]`) and the per-request auth bundle
|
|
68
|
-
* (`secrets.proxyEndpointAuth[]`). Mirrors the way `
|
|
68
|
+
* (`secrets.proxyEndpointAuth[]`). Mirrors the way `submit` already
|
|
69
69
|
* splits `McpServer.headers` into `secrets.mcpServers[]`.
|
|
70
70
|
*
|
|
71
71
|
* Throws on duplicate endpoint names — names are the cross-reference
|
package/dist/secret.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { SecretString } from "./_contracts/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Non-secret wire shape for one `secretEnv` entry. A workspace ref carries the
|
|
4
|
+
* handle (hashable, resolved server-side); an ephemeral secret carries only a
|
|
5
|
+
* value-free placeholder — the value is split into the vaulted secrets channel
|
|
6
|
+
* and excluded from the idempotency hash.
|
|
7
|
+
*/
|
|
8
|
+
export type SecretEnvSubmissionEntry = {
|
|
9
|
+
readonly ref: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly ephemeral: true;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Minimal client surface `secret.upload` needs to promote an ephemeral secret
|
|
15
|
+
* into the workspace store. `AgentExecutor` satisfies it via its `secrets`
|
|
16
|
+
* client; defined structurally here so `secret.ts` does not import `client.ts`
|
|
17
|
+
* (which would be circular — `client.ts` imports `Secret`). Mirrors
|
|
18
|
+
* {@link SkillUploader}.
|
|
19
|
+
*/
|
|
20
|
+
export interface SecretUploader {
|
|
21
|
+
_createWorkspaceSecret(args: {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly value: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
readonly name: string;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A secret with the SAME lifecycle semantic as `Skill` / `File` / `AgentsMd`:
|
|
30
|
+
* EPHEMERAL per-run by default, PROMOTABLE to a persisted, name-searchable
|
|
31
|
+
* workspace secret you can reference and reuse.
|
|
32
|
+
*
|
|
33
|
+
* - `Secret.value(v)` — EPHEMERAL per-run: the value is vaulted at submit and
|
|
34
|
+
* excluded from the idempotency hash; only a `{ ephemeral: true }`
|
|
35
|
+
* placeholder rides the (hashed) submission. Deleted when the run finishes.
|
|
36
|
+
* Clean, no workspace dependency. ≙ `Skill.fromFiles(...)` (a draft).
|
|
37
|
+
* - `secret.upload(client, { name })` — PROMOTE that value into the workspace
|
|
38
|
+
* secret store under `name`; resolves to a `Secret.ref`. ≙ `skill.upload(client)`.
|
|
39
|
+
* - `Secret.ref(handle)` — WORKSPACE: only the handle rides the submission;
|
|
40
|
+
* the value is resolved server-side from the workspace secret store. No
|
|
41
|
+
* value ever travels. ≙ `Skill.fromCatalog(record)`.
|
|
42
|
+
*
|
|
43
|
+
* The SDK splits each `Secret` BEFORE the wire payload is built (exactly how
|
|
44
|
+
* `McpServer` splits `headers` into `secrets.mcpServers`): the env-var name keys
|
|
45
|
+
* `submission.secretEnv[name] = toSubmissionEntry()`, and for ephemeral values
|
|
46
|
+
* `secrets.envSecrets[name] = toSecretValue()`.
|
|
47
|
+
*/
|
|
48
|
+
export declare class Secret {
|
|
49
|
+
#private;
|
|
50
|
+
readonly kind: "value" | "ref";
|
|
51
|
+
/** Workspace handle (ref kind only); `undefined` for ephemeral values. */
|
|
52
|
+
readonly handle: string | undefined;
|
|
53
|
+
/** Internal constructor. Use `Secret.value(...)` or `Secret.ref(...)`. */
|
|
54
|
+
constructor(args: {
|
|
55
|
+
readonly kind: "value";
|
|
56
|
+
readonly value: SecretString;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "ref";
|
|
59
|
+
readonly handle: string;
|
|
60
|
+
});
|
|
61
|
+
/** Ephemeral per-run value. Vaulted at submit; never in the spec/hash; gone at terminal. */
|
|
62
|
+
static value(value: string | SecretString): Secret;
|
|
63
|
+
/** Reference a workspace secret by handle; resolved server-side at submit. */
|
|
64
|
+
static ref(handle: string): Secret;
|
|
65
|
+
/** True once this ephemeral secret has been promoted via `upload`. */
|
|
66
|
+
get isConsumed(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Promote this EPHEMERAL secret into the workspace secret store under `name`
|
|
69
|
+
* and return a `Secret.ref(name)` for reuse across runs. Blocking: the store
|
|
70
|
+
* write completes before this resolves. Consumes this instance (an ephemeral
|
|
71
|
+
* value is promoted exactly once), mirroring `Skill.upload`.
|
|
72
|
+
*
|
|
73
|
+
* Only valid on a `Secret.value(...)`; a `Secret.ref(...)` is already
|
|
74
|
+
* persisted.
|
|
75
|
+
*/
|
|
76
|
+
upload(client: SecretUploader, args: {
|
|
77
|
+
readonly name: string;
|
|
78
|
+
}): Promise<Secret>;
|
|
79
|
+
/** Non-secret wire entry for `submission.secretEnv[<envName>]`. */
|
|
80
|
+
toSubmissionEntry(): SecretEnvSubmissionEntry;
|
|
81
|
+
/** Raw value for the vaulted `secrets.envSecrets[<envName>]` (ephemeral only); `undefined` for refs. */
|
|
82
|
+
toSecretValue(): string | undefined;
|
|
83
|
+
/** Redacted — never prints the value. */
|
|
84
|
+
toString(): string;
|
|
85
|
+
/** Redacted — never serialises the value. */
|
|
86
|
+
toJSON(): unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Split `secretEnv: Record<envName, Secret>` into the value-free declarations
|
|
90
|
+
* (`submission.secretEnv`) and the per-run vaulted values
|
|
91
|
+
* (`secrets.envSecrets`). Mirrors {@link splitProxyEndpoints}: declarations ride
|
|
92
|
+
* the hashed submission, ephemeral values ride the secrets channel
|
|
93
|
+
* (hash-excluded). Refs contribute only a declaration.
|
|
94
|
+
*
|
|
95
|
+
* Throws on a non-`Secret` value or an env var name that won't match the
|
|
96
|
+
* platform's `SECRET_ENV_NAME_PATTERN`, so the caller gets a precise error at
|
|
97
|
+
* the call site instead of an HTTP 400 a round-trip later.
|
|
98
|
+
*/
|
|
99
|
+
export declare function splitSecretEnv(secretEnv: Readonly<Record<string, Secret>> | undefined): {
|
|
100
|
+
declarations: Record<string, SecretEnvSubmissionEntry>;
|
|
101
|
+
values: Record<string, string>;
|
|
102
|
+
};
|
package/dist/secret.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { SECRET_ENV_NAME_PATTERN, SECRET_HANDLE_PATTERN, SecretString } from "./_contracts/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* A secret with the SAME lifecycle semantic as `Skill` / `File` / `AgentsMd`:
|
|
4
|
+
* EPHEMERAL per-run by default, PROMOTABLE to a persisted, name-searchable
|
|
5
|
+
* workspace secret you can reference and reuse.
|
|
6
|
+
*
|
|
7
|
+
* - `Secret.value(v)` — EPHEMERAL per-run: the value is vaulted at submit and
|
|
8
|
+
* excluded from the idempotency hash; only a `{ ephemeral: true }`
|
|
9
|
+
* placeholder rides the (hashed) submission. Deleted when the run finishes.
|
|
10
|
+
* Clean, no workspace dependency. ≙ `Skill.fromFiles(...)` (a draft).
|
|
11
|
+
* - `secret.upload(client, { name })` — PROMOTE that value into the workspace
|
|
12
|
+
* secret store under `name`; resolves to a `Secret.ref`. ≙ `skill.upload(client)`.
|
|
13
|
+
* - `Secret.ref(handle)` — WORKSPACE: only the handle rides the submission;
|
|
14
|
+
* the value is resolved server-side from the workspace secret store. No
|
|
15
|
+
* value ever travels. ≙ `Skill.fromCatalog(record)`.
|
|
16
|
+
*
|
|
17
|
+
* The SDK splits each `Secret` BEFORE the wire payload is built (exactly how
|
|
18
|
+
* `McpServer` splits `headers` into `secrets.mcpServers`): the env-var name keys
|
|
19
|
+
* `submission.secretEnv[name] = toSubmissionEntry()`, and for ephemeral values
|
|
20
|
+
* `secrets.envSecrets[name] = toSecretValue()`.
|
|
21
|
+
*/
|
|
22
|
+
export class Secret {
|
|
23
|
+
kind;
|
|
24
|
+
/** Workspace handle (ref kind only); `undefined` for ephemeral values. */
|
|
25
|
+
handle;
|
|
26
|
+
#value;
|
|
27
|
+
/** True once promoted via `upload` — a consumed ephemeral can't be reused. */
|
|
28
|
+
#consumed = false;
|
|
29
|
+
/** Internal constructor. Use `Secret.value(...)` or `Secret.ref(...)`. */
|
|
30
|
+
constructor(args) {
|
|
31
|
+
if (!args || typeof args !== "object") {
|
|
32
|
+
throw new Error("Secret: args is required");
|
|
33
|
+
}
|
|
34
|
+
if (args.kind === "ref") {
|
|
35
|
+
if (typeof args.handle !== "string" || !SECRET_HANDLE_PATTERN.test(args.handle)) {
|
|
36
|
+
throw new Error(`Secret.ref: handle must match ${SECRET_HANDLE_PATTERN.source}`);
|
|
37
|
+
}
|
|
38
|
+
this.kind = "ref";
|
|
39
|
+
this.handle = args.handle;
|
|
40
|
+
this.#value = undefined;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.kind = "value";
|
|
44
|
+
this.handle = undefined;
|
|
45
|
+
this.#value = args.value;
|
|
46
|
+
}
|
|
47
|
+
/** Ephemeral per-run value. Vaulted at submit; never in the spec/hash; gone at terminal. */
|
|
48
|
+
static value(value) {
|
|
49
|
+
const wrapped = value instanceof SecretString ? value : new SecretString(value, "secret");
|
|
50
|
+
if (!wrapped.unwrap()) {
|
|
51
|
+
throw new Error("Secret.value: value must be a non-empty string");
|
|
52
|
+
}
|
|
53
|
+
return new Secret({ kind: "value", value: wrapped });
|
|
54
|
+
}
|
|
55
|
+
/** Reference a workspace secret by handle; resolved server-side at submit. */
|
|
56
|
+
static ref(handle) {
|
|
57
|
+
return new Secret({ kind: "ref", handle });
|
|
58
|
+
}
|
|
59
|
+
/** True once this ephemeral secret has been promoted via `upload`. */
|
|
60
|
+
get isConsumed() {
|
|
61
|
+
return this.#consumed;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Promote this EPHEMERAL secret into the workspace secret store under `name`
|
|
65
|
+
* and return a `Secret.ref(name)` for reuse across runs. Blocking: the store
|
|
66
|
+
* write completes before this resolves. Consumes this instance (an ephemeral
|
|
67
|
+
* value is promoted exactly once), mirroring `Skill.upload`.
|
|
68
|
+
*
|
|
69
|
+
* Only valid on a `Secret.value(...)`; a `Secret.ref(...)` is already
|
|
70
|
+
* persisted.
|
|
71
|
+
*/
|
|
72
|
+
async upload(client, args) {
|
|
73
|
+
if (this.kind !== "value") {
|
|
74
|
+
throw new Error("Secret.upload: only ephemeral Secret.value(...) secrets can be uploaded; a Secret.ref is already persisted");
|
|
75
|
+
}
|
|
76
|
+
if (this.#consumed) {
|
|
77
|
+
throw new Error("Secret.upload: this ephemeral secret was already consumed. Build a fresh Secret.value(...) to re-upload.");
|
|
78
|
+
}
|
|
79
|
+
if (!args || typeof args.name !== "string" || !SECRET_HANDLE_PATTERN.test(args.name)) {
|
|
80
|
+
throw new Error(`Secret.upload: name must match ${SECRET_HANDLE_PATTERN.source}`);
|
|
81
|
+
}
|
|
82
|
+
const value = this.#value.unwrap();
|
|
83
|
+
await client._createWorkspaceSecret({ name: args.name, value });
|
|
84
|
+
this.#consumed = true;
|
|
85
|
+
return Secret.ref(args.name);
|
|
86
|
+
}
|
|
87
|
+
/** Non-secret wire entry for `submission.secretEnv[<envName>]`. */
|
|
88
|
+
toSubmissionEntry() {
|
|
89
|
+
if (this.kind === "ref") {
|
|
90
|
+
return { ref: this.handle };
|
|
91
|
+
}
|
|
92
|
+
if (this.#consumed) {
|
|
93
|
+
throw new Error("Secret: this ephemeral secret was consumed by upload(); reference it via the returned Secret.ref instead");
|
|
94
|
+
}
|
|
95
|
+
return { ephemeral: true };
|
|
96
|
+
}
|
|
97
|
+
/** Raw value for the vaulted `secrets.envSecrets[<envName>]` (ephemeral only); `undefined` for refs. */
|
|
98
|
+
toSecretValue() {
|
|
99
|
+
if (this.kind === "ref") {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
if (this.#consumed) {
|
|
103
|
+
throw new Error("Secret: this ephemeral secret was consumed by upload(); reference it via the returned Secret.ref instead");
|
|
104
|
+
}
|
|
105
|
+
return this.#value?.unwrap();
|
|
106
|
+
}
|
|
107
|
+
/** Redacted — never prints the value. */
|
|
108
|
+
toString() {
|
|
109
|
+
return this.kind === "ref" ? `Secret.ref(${this.handle})` : "Secret.value([REDACTED])";
|
|
110
|
+
}
|
|
111
|
+
/** Redacted — never serialises the value. */
|
|
112
|
+
toJSON() {
|
|
113
|
+
return this.kind === "ref" ? { kind: "ref", handle: this.handle } : { kind: "value", value: "[REDACTED]" };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Split `secretEnv: Record<envName, Secret>` into the value-free declarations
|
|
118
|
+
* (`submission.secretEnv`) and the per-run vaulted values
|
|
119
|
+
* (`secrets.envSecrets`). Mirrors {@link splitProxyEndpoints}: declarations ride
|
|
120
|
+
* the hashed submission, ephemeral values ride the secrets channel
|
|
121
|
+
* (hash-excluded). Refs contribute only a declaration.
|
|
122
|
+
*
|
|
123
|
+
* Throws on a non-`Secret` value or an env var name that won't match the
|
|
124
|
+
* platform's `SECRET_ENV_NAME_PATTERN`, so the caller gets a precise error at
|
|
125
|
+
* the call site instead of an HTTP 400 a round-trip later.
|
|
126
|
+
*/
|
|
127
|
+
export function splitSecretEnv(secretEnv) {
|
|
128
|
+
const declarations = {};
|
|
129
|
+
const values = {};
|
|
130
|
+
if (!secretEnv) {
|
|
131
|
+
return { declarations, values };
|
|
132
|
+
}
|
|
133
|
+
for (const [envName, secret] of Object.entries(secretEnv)) {
|
|
134
|
+
if (!(secret instanceof Secret)) {
|
|
135
|
+
throw new TypeError(`secretEnv[${envName}] must be a Secret built via Secret.value(...) or Secret.ref(...)`);
|
|
136
|
+
}
|
|
137
|
+
if (!SECRET_ENV_NAME_PATTERN.test(envName)) {
|
|
138
|
+
throw new Error(`secretEnv key ${JSON.stringify(envName)} must be a valid env var name matching ${SECRET_ENV_NAME_PATTERN.source}`);
|
|
139
|
+
}
|
|
140
|
+
declarations[envName] = secret.toSubmissionEntry();
|
|
141
|
+
const value = secret.toSecretValue();
|
|
142
|
+
if (value !== undefined) {
|
|
143
|
+
values[envName] = value;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { declarations, values };
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=secret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../src/secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAqBhG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,MAAM;IACR,IAAI,CAAkB;IAC/B,0EAA0E;IACjE,MAAM,CAAqB;IAC3B,MAAM,CAA2B;IAC1C,8EAA8E;IAC9E,SAAS,GAAG,KAAK,CAAC;IAElB,0EAA0E;IAC1E,YAAY,IAAkH;QAC5H,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC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C;QACJ,CAAC;QACD,YAAY,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;QACrC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC"}
|
package/dist/skill.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AssetRef, type FetchLike, type SkillRef } from "./_contracts/index.js";
|
|
2
2
|
import { type SkillFiles } from "./bundle.js";
|
|
3
3
|
/**
|
|
4
|
-
* One `Skill` class for skill bytes. `client.
|
|
4
|
+
* One `Skill` class for skill bytes. `client.submit` materializes the bytes
|
|
5
5
|
* as an uploaded asset before the run lands; the wire ref becomes
|
|
6
6
|
* `kind:"asset"`.
|
|
7
7
|
*
|
|
@@ -30,7 +30,7 @@ export declare class Skill {
|
|
|
30
30
|
/**
|
|
31
31
|
* The wire-level reference. Returns the SDK-private draft shape for
|
|
32
32
|
* un-materialized skills (kind:"draft", with name + contentHash).
|
|
33
|
-
* `client.
|
|
33
|
+
* `client.submit` walks these and uploads them before the run
|
|
34
34
|
* lands.
|
|
35
35
|
*/
|
|
36
36
|
get ref(): AssetRef | DraftSkillRef;
|
|
@@ -41,7 +41,7 @@ export declare class Skill {
|
|
|
41
41
|
* Build a draft Skill from an inline files map. The SDK validates
|
|
42
42
|
* basic safety (no path traversal, size caps, has `SKILL.md`),
|
|
43
43
|
* deterministically zips the bundle, and computes the
|
|
44
|
-
* `sha256:<hex>` content hash. `client.
|
|
44
|
+
* `sha256:<hex>` content hash. `client.submit` materializes
|
|
45
45
|
* these before the run lands.
|
|
46
46
|
*/
|
|
47
47
|
static fromFiles(args: {
|
|
@@ -66,7 +66,7 @@ export declare class Skill {
|
|
|
66
66
|
*
|
|
67
67
|
* The archive must contain `SKILL.md` at its root, or inside a single
|
|
68
68
|
* top-level folder (which is stripped). The signed URL only needs to be valid
|
|
69
|
-
* for this call; `client.
|
|
69
|
+
* for this call; `client.submit` snapshots the bytes into the run.
|
|
70
70
|
*
|
|
71
71
|
* Universal (Node 18+ / browser): requires a global `fetch`, or pass one.
|
|
72
72
|
*/
|
|
@@ -86,7 +86,7 @@ export declare class Skill {
|
|
|
86
86
|
* `Skill` record returned by `client.skills.list()` / `.get()`:
|
|
87
87
|
*
|
|
88
88
|
* const [s] = await client.skills.list();
|
|
89
|
-
* await client.
|
|
89
|
+
* await client.submit({ ..., skills: [Skill.fromCatalog(s)] });
|
|
90
90
|
*
|
|
91
91
|
* The record must be `ready` (it has a content hash). Unlike the draft
|
|
92
92
|
* builders this performs no upload — the bytes already live in the catalog.
|
|
@@ -96,9 +96,9 @@ export declare class Skill {
|
|
|
96
96
|
readonly hash?: string | null;
|
|
97
97
|
}): Skill;
|
|
98
98
|
/**
|
|
99
|
-
* Internal: yield the draft's bytes + metadata so `client.
|
|
99
|
+
* Internal: yield the draft's bytes + metadata so `client.submit`
|
|
100
100
|
* can upload the asset. After this returns, the Skill is marked consumed
|
|
101
|
-
* so a second
|
|
101
|
+
* so a second submit call against the same instance throws
|
|
102
102
|
* (avoid silently re-uploading; explicit re-construction is the
|
|
103
103
|
* supported retry pattern).
|
|
104
104
|
*
|
|
@@ -123,7 +123,7 @@ export declare class Skill {
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* SDK-internal draft skill marker. Never reaches the wire; the
|
|
126
|
-
* materialize step inside `client.
|
|
126
|
+
* materialize step inside `client.submit` converts these to
|
|
127
127
|
* `kind:"asset"` refs.
|
|
128
128
|
*/
|
|
129
129
|
export interface DraftSkillRef {
|
package/dist/skill.js
CHANGED
|
@@ -3,7 +3,7 @@ import { bundleSkillFiles, hashSkillBundle } from "./bundle.js";
|
|
|
3
3
|
import { fetchSkillArchive } from "./fetch-archive.js";
|
|
4
4
|
import { readDirectoryAsFiles } from "./node-fs.js";
|
|
5
5
|
/**
|
|
6
|
-
* One `Skill` class for skill bytes. `client.
|
|
6
|
+
* One `Skill` class for skill bytes. `client.submit` materializes the bytes
|
|
7
7
|
* as an uploaded asset before the run lands; the wire ref becomes
|
|
8
8
|
* `kind:"asset"`.
|
|
9
9
|
*
|
|
@@ -37,7 +37,7 @@ export class Skill {
|
|
|
37
37
|
/**
|
|
38
38
|
* The wire-level reference. Returns the SDK-private draft shape for
|
|
39
39
|
* un-materialized skills (kind:"draft", with name + contentHash).
|
|
40
|
-
* `client.
|
|
40
|
+
* `client.submit` walks these and uploads them before the run
|
|
41
41
|
* lands.
|
|
42
42
|
*/
|
|
43
43
|
get ref() {
|
|
@@ -54,7 +54,7 @@ export class Skill {
|
|
|
54
54
|
* Build a draft Skill from an inline files map. The SDK validates
|
|
55
55
|
* basic safety (no path traversal, size caps, has `SKILL.md`),
|
|
56
56
|
* deterministically zips the bundle, and computes the
|
|
57
|
-
* `sha256:<hex>` content hash. `client.
|
|
57
|
+
* `sha256:<hex>` content hash. `client.submit` materializes
|
|
58
58
|
* these before the run lands.
|
|
59
59
|
*/
|
|
60
60
|
static async fromFiles(args) {
|
|
@@ -92,7 +92,7 @@ export class Skill {
|
|
|
92
92
|
*
|
|
93
93
|
* The archive must contain `SKILL.md` at its root, or inside a single
|
|
94
94
|
* top-level folder (which is stripped). The signed URL only needs to be valid
|
|
95
|
-
* for this call; `client.
|
|
95
|
+
* for this call; `client.submit` snapshots the bytes into the run.
|
|
96
96
|
*
|
|
97
97
|
* Universal (Node 18+ / browser): requires a global `fetch`, or pass one.
|
|
98
98
|
*/
|
|
@@ -120,7 +120,7 @@ export class Skill {
|
|
|
120
120
|
* `Skill` record returned by `client.skills.list()` / `.get()`:
|
|
121
121
|
*
|
|
122
122
|
* const [s] = await client.skills.list();
|
|
123
|
-
* await client.
|
|
123
|
+
* await client.submit({ ..., skills: [Skill.fromCatalog(s)] });
|
|
124
124
|
*
|
|
125
125
|
* The record must be `ready` (it has a content hash). Unlike the draft
|
|
126
126
|
* builders this performs no upload — the bytes already live in the catalog.
|
|
@@ -141,9 +141,9 @@ export class Skill {
|
|
|
141
141
|
return new Skill(ref);
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
|
-
* Internal: yield the draft's bytes + metadata so `client.
|
|
144
|
+
* Internal: yield the draft's bytes + metadata so `client.submit`
|
|
145
145
|
* can upload the asset. After this returns, the Skill is marked consumed
|
|
146
|
-
* so a second
|
|
146
|
+
* so a second submit call against the same instance throws
|
|
147
147
|
* (avoid silently re-uploading; explicit re-construction is the
|
|
148
148
|
* supported retry pattern).
|
|
149
149
|
*
|
|
@@ -151,8 +151,8 @@ export class Skill {
|
|
|
151
151
|
*/
|
|
152
152
|
_takeDraftBundle() {
|
|
153
153
|
if (this.#consumed) {
|
|
154
|
-
throw new Error("Skill: cannot reuse a consumed Skill in
|
|
155
|
-
"Skill.fromPath(...) / Skill.fromFiles(...) per
|
|
154
|
+
throw new Error("Skill: cannot reuse a consumed Skill in submit. Build a fresh Skill via " +
|
|
155
|
+
"Skill.fromPath(...) / Skill.fromFiles(...) per submit call.");
|
|
156
156
|
}
|
|
157
157
|
if (this.#ref.kind !== "draft" || !this.#inlineBytes) {
|
|
158
158
|
return undefined;
|
|
@@ -190,7 +190,7 @@ export class Skill {
|
|
|
190
190
|
toJSON() {
|
|
191
191
|
if (this.#ref.kind === "draft") {
|
|
192
192
|
throw new Error("Skill: draft Skills cannot be JSON-serialised — they only become wire refs when " +
|
|
193
|
-
"client.
|
|
193
|
+
"client.submit uploads the bytes as an asset.");
|
|
194
194
|
}
|
|
195
195
|
return this.#ref;
|
|
196
196
|
}
|
package/dist/skill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAInB,MAAM,kBAAkB,CAAC;A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AG,GAAa,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QACtF,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CACb,kFAAkF;gBAClF,8CAA8C,CAC/C,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/docs/cleanup.md
CHANGED
|
@@ -17,7 +17,7 @@ retention field is rejected if supplied.
|
|
|
17
17
|
```ts
|
|
18
18
|
import { RunModels } from "@aexhq/sdk";
|
|
19
19
|
|
|
20
|
-
const runId = await aex.
|
|
20
|
+
const runId = await aex.submit({
|
|
21
21
|
model: RunModels.CLAUDE_HAIKU_4_5,
|
|
22
22
|
prompt: "...",
|
|
23
23
|
secrets: { apiKey: process.env.ANTHROPIC_API_KEY! }
|
package/docs/credentials.md
CHANGED
|
@@ -6,7 +6,7 @@ title: Credentials
|
|
|
6
6
|
|
|
7
7
|
aex does not store provider keys or MCP credential values across runs.
|
|
8
8
|
|
|
9
|
-
The caller passes a workspace-scoped SDK token and the provider key inline on every `
|
|
9
|
+
The caller passes a workspace-scoped SDK token and the provider key inline on every `submit` call. aex holds the bundle in run-scoped custody for the run lifecycle and attempts terminal cleanup/revocation for the aex-controlled references. MCP credentials and proxy endpoint auth values travel the same way.
|
|
10
10
|
|
|
11
11
|
A run targets exactly one provider (selected by `provider`, default `anthropic`), so the key is a single flat field:
|
|
12
12
|
|
|
@@ -80,7 +80,7 @@ const proxyEndpointAuth = [
|
|
|
80
80
|
// Fail fast at submission time when policy and auth disagree.
|
|
81
81
|
validateProxyAuth(proxyEndpoints, proxyEndpointAuth);
|
|
82
82
|
|
|
83
|
-
const runId = await aex.
|
|
83
|
+
const runId = await aex.submit({
|
|
84
84
|
model: RunModels.CLAUDE_HAIKU_4_5,
|
|
85
85
|
prompt: "…",
|
|
86
86
|
proxyEndpoints,
|
|
@@ -119,7 +119,7 @@ const proxyEndpoints = [
|
|
|
119
119
|
}
|
|
120
120
|
] as const;
|
|
121
121
|
|
|
122
|
-
const runId = await aex.
|
|
122
|
+
const runId = await aex.submit({
|
|
123
123
|
model: RunModels.CLAUDE_HAIKU_4_5,
|
|
124
124
|
prompt: "…",
|
|
125
125
|
proxyEndpoints,
|
|
@@ -155,4 +155,4 @@ const allowedHosts = buildPlatformAllowedHosts({
|
|
|
155
155
|
|
|
156
156
|
### Secrets are always explicit at the call site
|
|
157
157
|
|
|
158
|
-
There is no `defaultSecrets` and no client-held secret state. Every `
|
|
158
|
+
There is no `defaultSecrets` and no client-held secret state. Every `submit` call carries its full `secrets` bundle (one provider key + optional MCP credentials + optional `proxyEndpointAuth`). This is the agent-first invariant: the credentials being used on any given call are visible in the same line of code that submits the run.
|
package/docs/events.md
CHANGED
|
@@ -48,7 +48,7 @@ and `3` when `--timeout` elapses first (a `--timeout` on `events --follow` /
|
|
|
48
48
|
`run --follow` uses the same exit-`3` convention). Durations accept `ms`/`s`/`m`/`h`
|
|
49
49
|
suffixes or a bare millisecond integer.
|
|
50
50
|
|
|
51
|
-
Both surfaces observe the same events. A subscriber attached after `
|
|
51
|
+
Both surfaces observe the same events. A subscriber attached after `submit()` returns replays the events it missed, then continues live.
|
|
52
52
|
|
|
53
53
|
## Terminal events vs. the run record
|
|
54
54
|
|
|
@@ -90,7 +90,7 @@ run's last stream event, immediately after the durable record commits.
|
|
|
90
90
|
|
|
91
91
|
## Event shape
|
|
92
92
|
|
|
93
|
-
Events are typed as the discriminated `RunEvent` union for compatibility and as the versioned coordinator envelope for live consumers. aex records raw runtime/provider payloads **after** secret redaction and structural sanitization, so the bytes you see never contain the provider key, MCP credentials, or proxy bearer that were supplied to `
|
|
93
|
+
Events are typed as the discriminated `RunEvent` union for compatibility and as the versioned coordinator envelope for live consumers. aex records raw runtime/provider payloads **after** secret redaction and structural sanitization, so the bytes you see never contain the provider key, MCP credentials, or proxy bearer that were supplied to `submit`.
|
|
94
94
|
|
|
95
95
|
## Typed helpers
|
|
96
96
|
|
package/docs/outputs.md
CHANGED
|
@@ -11,7 +11,7 @@ Every run produces durable metadata (status, events, snapshots, cleanup state) a
|
|
|
11
11
|
```ts
|
|
12
12
|
import { RunModels } from "@aexhq/sdk";
|
|
13
13
|
|
|
14
|
-
const runId = await aex.
|
|
14
|
+
const runId = await aex.submit({
|
|
15
15
|
model: RunModels.CLAUDE_HAIKU_4_5,
|
|
16
16
|
prompt: "Produce a report and save it as a file.",
|
|
17
17
|
secrets: { apiKey }
|
|
@@ -90,7 +90,7 @@ console.log(looseReport.byteLength);
|
|
|
90
90
|
## `outputs.allowedDirs` — override capture roots
|
|
91
91
|
|
|
92
92
|
```ts
|
|
93
|
-
aex.
|
|
93
|
+
aex.submit({
|
|
94
94
|
/* ... */,
|
|
95
95
|
outputs: {
|
|
96
96
|
allowedDirs: ["/workspace/reports", "/workspace/state"]
|
|
@@ -115,7 +115,7 @@ Runtime notes:
|
|
|
115
115
|
## `outputs.deniedDirs` — subtract noise
|
|
116
116
|
|
|
117
117
|
```ts
|
|
118
|
-
aex.
|
|
118
|
+
aex.submit({
|
|
119
119
|
/* ... */,
|
|
120
120
|
outputs: {
|
|
121
121
|
deniedDirs: ["node_modules", "/var/cache", "*.tmp"]
|