antpath 0.2.1 → 0.4.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 +54 -40
- package/dist/_shared/cleanup-policy.d.ts +8 -0
- package/dist/_shared/cleanup-policy.js +24 -0
- package/dist/_shared/config.d.ts +47 -0
- package/dist/_shared/config.js +150 -0
- package/dist/_shared/dev-stack.d.ts +19 -0
- package/dist/_shared/dev-stack.js +105 -0
- package/dist/_shared/errors.d.ts +8 -0
- package/dist/_shared/errors.js +18 -0
- package/dist/_shared/http.d.ts +25 -0
- package/dist/_shared/http.js +93 -0
- package/dist/_shared/index.d.ts +17 -0
- package/dist/_shared/index.js +20 -0
- package/dist/{providers → _shared}/known-events.d.ts +10 -10
- package/dist/{providers → _shared}/known-events.js +9 -9
- package/dist/_shared/operations.d.ts +24 -0
- package/dist/_shared/operations.js +47 -0
- package/dist/_shared/proxy-protocol.d.ts +148 -0
- package/dist/_shared/proxy-protocol.js +113 -0
- package/dist/_shared/proxy-validation.d.ts +19 -0
- package/dist/_shared/proxy-validation.js +51 -0
- package/dist/_shared/runtime-types.d.ts +90 -0
- package/dist/_shared/runtime-types.js +2 -0
- package/dist/{errors.d.ts → _shared/sdk-errors.d.ts} +10 -1
- package/dist/{errors.js → _shared/sdk-errors.js} +15 -2
- package/dist/{utils/secrets.js → _shared/sdk-secrets.js} +1 -1
- package/dist/_shared/secrets.d.ts +7 -0
- package/dist/_shared/secrets.js +20 -0
- package/dist/_shared/stable.d.ts +16 -0
- package/dist/{utils → _shared}/stable.js +14 -0
- package/dist/_shared/status.d.ts +8 -0
- package/dist/_shared/status.js +46 -0
- package/dist/_shared/submission.d.ts +157 -0
- package/dist/_shared/submission.js +681 -0
- package/dist/{template → _shared/template}/compiler.js +3 -3
- package/dist/{template/index.d.ts → _shared/template/helpers.d.ts} +0 -2
- package/dist/{template/index.js → _shared/template/helpers.js} +1 -2
- package/dist/_shared/template/index.d.ts +4 -0
- package/dist/_shared/template/index.js +4 -0
- package/dist/_shared/template/mapper.d.ts +11 -0
- package/dist/_shared/template/mapper.js +70 -0
- package/dist/cli.mjs +1223 -64
- package/dist/cli.mjs.sha256 +1 -1
- package/dist/client.d.ts +100 -8
- package/dist/client.js +193 -30
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +16 -10
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/docs/cleanup.md +7 -4
- package/docs/credentials.md +10 -12
- package/docs/events.md +19 -82
- package/docs/outputs.md +15 -4
- package/docs/quickstart.md +40 -6
- package/docs/release.md +57 -12
- package/docs/skills.md +1 -1
- package/docs/templates.md +1 -1
- package/docs/testing.md +11 -8
- package/examples/mcp-static-bearer.ts +12 -9
- package/examples/quickstart.ts +6 -6
- package/package.json +5 -7
- package/dist/credentials.d.ts +0 -3
- package/dist/credentials.js +0 -56
- package/dist/credentials.js.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/files/downloader.d.ts +0 -3
- package/dist/files/downloader.js +0 -43
- package/dist/files/downloader.js.map +0 -1
- package/dist/platform/client.d.ts +0 -204
- package/dist/platform/client.js +0 -203
- package/dist/platform/client.js.map +0 -1
- package/dist/platform/index.d.ts +0 -1
- package/dist/platform/index.js +0 -2
- package/dist/platform/index.js.map +0 -1
- package/dist/providers/anthropic/provider.d.ts +0 -36
- package/dist/providers/anthropic/provider.js +0 -380
- package/dist/providers/anthropic/provider.js.map +0 -1
- package/dist/providers/known-events.js.map +0 -1
- package/dist/providers/types.d.ts +0 -42
- package/dist/providers/types.js.map +0 -1
- package/dist/run/controller.d.ts +0 -30
- package/dist/run/controller.js +0 -314
- package/dist/run/controller.js.map +0 -1
- package/dist/skills/packager.d.ts +0 -11
- package/dist/skills/packager.js +0 -76
- package/dist/skills/packager.js.map +0 -1
- package/dist/template/compiler.js.map +0 -1
- package/dist/template/index.js.map +0 -1
- package/dist/template/types.js +0 -2
- package/dist/template/types.js.map +0 -1
- package/dist/types.d.ts +0 -149
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/events.d.ts +0 -27
- package/dist/utils/events.js +0 -120
- package/dist/utils/events.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -3
- package/dist/utils/paths.js +0 -27
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/secrets.js.map +0 -1
- package/dist/utils/stable.d.ts +0 -2
- package/dist/utils/stable.js.map +0 -1
- package/references/architecture-decisions.md +0 -473
- package/references/implementation-plan.md +0 -452
- package/references/research-sources.md +0 -41
- package/references/testing-strategy.md +0 -29
- /package/dist/{utils/secrets.d.ts → _shared/sdk-secrets.d.ts} +0 -0
- /package/dist/{template → _shared/template}/compiler.d.ts +0 -0
- /package/dist/{template → _shared/template}/types.d.ts +0 -0
- /package/dist/{providers → _shared/template}/types.js +0 -0
package/dist/cli.mjs.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a602b27fb33ed22e122096a17bbe0a1f132a6981e55db03ace316dddc048eac2 cli.mjs
|
package/dist/client.d.ts
CHANGED
|
@@ -1,14 +1,106 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { TemplateDefinition } from "./template/types.js";
|
|
3
|
-
import type { CleanupPolicy, RunHandle, RunOptions } from "./types.js";
|
|
4
|
-
import { SecretString } from "./utils/secrets.js";
|
|
1
|
+
import { type FetchLike, type Output, type PlatformInlineSecrets, type PlatformProxyEndpoint, type ResolvedTemplate, type Run, type RunEvent, type SignedOutputLink, type TemplateDefinition, type WhoAmI } from "./_shared/index.js";
|
|
5
2
|
export interface AntpathClientOptions {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/** Workspace-scoped SDK API token. */
|
|
4
|
+
readonly apiToken: string;
|
|
5
|
+
/**
|
|
6
|
+
* Dashboard BFF root, e.g. `https://antpath.example.com`. Optional —
|
|
7
|
+
* defaults to the canonical hosted URL (`https://antpath.ai`).
|
|
8
|
+
* Self-hosted deployments override; the default lives in source so
|
|
9
|
+
* the agent reading the SDK call site can see exactly where the call
|
|
10
|
+
* goes.
|
|
11
|
+
*/
|
|
12
|
+
readonly baseUrl?: string;
|
|
13
|
+
/** Optional `fetch` override for testing. */
|
|
14
|
+
readonly fetch?: FetchLike;
|
|
9
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Per-run submission options. `secrets.anthropic.apiKey` is REQUIRED on
|
|
18
|
+
* every call — the dashboard does not store provider credentials on
|
|
19
|
+
* your behalf. Optional `mcpServers`, `skills`, and `proxyEndpointAuth`
|
|
20
|
+
* round out the session-scoped credential bundle.
|
|
21
|
+
*/
|
|
22
|
+
export interface RunSubmitOptions {
|
|
23
|
+
readonly variables?: Record<string, string>;
|
|
24
|
+
readonly secrets: PlatformInlineSecrets;
|
|
25
|
+
readonly proxyEndpoints?: readonly PlatformProxyEndpoint[];
|
|
26
|
+
readonly cleanup?: {
|
|
27
|
+
readonly session?: "retain" | "delete";
|
|
28
|
+
};
|
|
29
|
+
readonly idempotencyKey?: string;
|
|
30
|
+
readonly signal?: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
export interface StreamEventsOptions {
|
|
33
|
+
readonly intervalMs?: number;
|
|
34
|
+
readonly signal?: AbortSignal;
|
|
35
|
+
}
|
|
36
|
+
export interface WaitForRunOptions {
|
|
37
|
+
readonly intervalMs?: number;
|
|
38
|
+
readonly timeoutMs?: number;
|
|
39
|
+
readonly signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Lightweight reference to a submitted run. All read-back operations
|
|
43
|
+
* delegate to the same `AntpathClient` and the same operations module
|
|
44
|
+
* the CLI uses, so SDK and CLI never drift.
|
|
45
|
+
*/
|
|
46
|
+
export declare class RunRef {
|
|
47
|
+
#private;
|
|
48
|
+
readonly runId: string;
|
|
49
|
+
constructor(client: AntpathClient, runId: string);
|
|
50
|
+
get(): Promise<Run>;
|
|
51
|
+
events(): Promise<readonly RunEvent[]>;
|
|
52
|
+
stream(options?: StreamEventsOptions): AsyncIterable<RunEvent>;
|
|
53
|
+
wait(options?: WaitForRunOptions): Promise<Run>;
|
|
54
|
+
outputs(): Promise<readonly Output[]>;
|
|
55
|
+
cancel(): Promise<void>;
|
|
56
|
+
delete(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Unified user-facing client for the antpath platform. The same class
|
|
60
|
+
* powers the published `antpath` SDK and (under the hood) every host-side
|
|
61
|
+
* subcommand of the in-container `antpath` CLI. All operations talk to
|
|
62
|
+
* the dashboard BFF and operate on durable run records.
|
|
63
|
+
*
|
|
64
|
+
* The SDK never asks the caller for a workspace id — workspace identity
|
|
65
|
+
* is derived server-side from the API token on every request. Use
|
|
66
|
+
* `client.whoami()` if you want to introspect which workspace the
|
|
67
|
+
* token resolves to.
|
|
68
|
+
*/
|
|
10
69
|
export declare class AntpathClient {
|
|
11
70
|
#private;
|
|
12
71
|
constructor(options: AntpathClientOptions);
|
|
13
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Submit a run and wait for it to reach a terminal state. Returns the
|
|
74
|
+
* final `Run` record. For long-running flows, prefer `submitRun` +
|
|
75
|
+
* `streamEvents` + `waitForRun`.
|
|
76
|
+
*/
|
|
77
|
+
run(template: TemplateDefinition, options: RunSubmitOptions): Promise<Run>;
|
|
78
|
+
/**
|
|
79
|
+
* Submit a run and return a `RunRef` immediately. Use the ref to
|
|
80
|
+
* stream events, fetch outputs, cancel, or delete the run.
|
|
81
|
+
*/
|
|
82
|
+
submitRun(template: TemplateDefinition, options: RunSubmitOptions): Promise<RunRef>;
|
|
83
|
+
/**
|
|
84
|
+
* Same as `submitRun` but accepts an already-compiled `ResolvedTemplate`.
|
|
85
|
+
* Useful when consuming a `.json` template directly.
|
|
86
|
+
*/
|
|
87
|
+
submitResolvedRun(template: ResolvedTemplate, options: RunSubmitOptions): Promise<RunRef>;
|
|
88
|
+
getRun(runId: string): Promise<Run>;
|
|
89
|
+
listEvents(runId: string): Promise<readonly RunEvent[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Poll the events endpoint and yield new events as they arrive. Stops
|
|
92
|
+
* when the run reaches a terminal state, when the signal is aborted,
|
|
93
|
+
* or when the caller breaks out of the iterator.
|
|
94
|
+
*/
|
|
95
|
+
streamEvents(runId: string, options?: StreamEventsOptions): AsyncIterable<RunEvent>;
|
|
96
|
+
/**
|
|
97
|
+
* Poll the run record until it reaches a terminal status (succeeded,
|
|
98
|
+
* failed, terminated). Throws if `timeoutMs` elapses first.
|
|
99
|
+
*/
|
|
100
|
+
waitForRun(runId: string, options?: WaitForRunOptions): Promise<Run>;
|
|
101
|
+
listOutputs(runId: string): Promise<readonly Output[]>;
|
|
102
|
+
createOutputLink(runId: string, outputId: string): Promise<SignedOutputLink>;
|
|
103
|
+
cancelRun(runId: string): Promise<void>;
|
|
104
|
+
deleteRun(runId: string): Promise<void>;
|
|
105
|
+
whoami(): Promise<WhoAmI>;
|
|
14
106
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,39 +1,202 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { HttpClient, operations, toPlatformSubmissionTemplate, validateProxyAuth, compileTemplate } from "./_shared/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lightweight reference to a submitted run. All read-back operations
|
|
4
|
+
* delegate to the same `AntpathClient` and the same operations module
|
|
5
|
+
* the CLI uses, so SDK and CLI never drift.
|
|
6
|
+
*/
|
|
7
|
+
export class RunRef {
|
|
8
|
+
runId;
|
|
9
|
+
#client;
|
|
10
|
+
constructor(client, runId) {
|
|
11
|
+
this.#client = client;
|
|
12
|
+
this.runId = runId;
|
|
13
|
+
}
|
|
14
|
+
get() {
|
|
15
|
+
return this.#client.getRun(this.runId);
|
|
16
|
+
}
|
|
17
|
+
events() {
|
|
18
|
+
return this.#client.listEvents(this.runId);
|
|
19
|
+
}
|
|
20
|
+
stream(options) {
|
|
21
|
+
return this.#client.streamEvents(this.runId, options);
|
|
22
|
+
}
|
|
23
|
+
wait(options) {
|
|
24
|
+
return this.#client.waitForRun(this.runId, options);
|
|
25
|
+
}
|
|
26
|
+
outputs() {
|
|
27
|
+
return this.#client.listOutputs(this.runId);
|
|
28
|
+
}
|
|
29
|
+
cancel() {
|
|
30
|
+
return this.#client.cancelRun(this.runId);
|
|
31
|
+
}
|
|
32
|
+
delete() {
|
|
33
|
+
return this.#client.deleteRun(this.runId);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Unified user-facing client for the antpath platform. The same class
|
|
38
|
+
* powers the published `antpath` SDK and (under the hood) every host-side
|
|
39
|
+
* subcommand of the in-container `antpath` CLI. All operations talk to
|
|
40
|
+
* the dashboard BFF and operate on durable run records.
|
|
41
|
+
*
|
|
42
|
+
* The SDK never asks the caller for a workspace id — workspace identity
|
|
43
|
+
* is derived server-side from the API token on every request. Use
|
|
44
|
+
* `client.whoami()` if you want to introspect which workspace the
|
|
45
|
+
* token resolves to.
|
|
46
|
+
*/
|
|
5
47
|
export class AntpathClient {
|
|
6
|
-
#
|
|
7
|
-
#cleanupPolicy;
|
|
48
|
+
#http;
|
|
8
49
|
constructor(options) {
|
|
9
|
-
if (options.
|
|
10
|
-
|
|
50
|
+
if (!options.apiToken) {
|
|
51
|
+
throw new Error("AntpathClient: apiToken is required");
|
|
11
52
|
}
|
|
12
|
-
|
|
13
|
-
|
|
53
|
+
this.#http = new HttpClient({
|
|
54
|
+
...(options.baseUrl ? { baseUrl: options.baseUrl } : {}),
|
|
55
|
+
apiToken: options.apiToken,
|
|
56
|
+
...(options.fetch ? { fetch: options.fetch } : {})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Submit a run and wait for it to reach a terminal state. Returns the
|
|
61
|
+
* final `Run` record. For long-running flows, prefer `submitRun` +
|
|
62
|
+
* `streamEvents` + `waitForRun`.
|
|
63
|
+
*/
|
|
64
|
+
async run(template, options) {
|
|
65
|
+
const ref = await this.submitRun(template, options);
|
|
66
|
+
return ref.wait(options.signal ? { signal: options.signal } : {});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Submit a run and return a `RunRef` immediately. Use the ref to
|
|
70
|
+
* stream events, fetch outputs, cancel, or delete the run.
|
|
71
|
+
*/
|
|
72
|
+
async submitRun(template, options) {
|
|
73
|
+
const resolved = compileTemplate(template, options.variables ?? {});
|
|
74
|
+
return this.submitResolvedRun(resolved, options);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Same as `submitRun` but accepts an already-compiled `ResolvedTemplate`.
|
|
78
|
+
* Useful when consuming a `.json` template directly.
|
|
79
|
+
*/
|
|
80
|
+
async submitResolvedRun(template, options) {
|
|
81
|
+
if (!options.secrets || !options.secrets.anthropic?.apiKey) {
|
|
82
|
+
throw new Error("AntpathClient.submitRun: secrets.anthropic.apiKey is required");
|
|
14
83
|
}
|
|
15
|
-
|
|
16
|
-
|
|
84
|
+
if (options.proxyEndpoints && options.proxyEndpoints.length > 0) {
|
|
85
|
+
validateProxyAuth(options.proxyEndpoints, options.secrets.proxyEndpointAuth);
|
|
17
86
|
}
|
|
18
|
-
|
|
87
|
+
// The BFF derives `workspaceId` from the API token; the SDK never
|
|
88
|
+
// names it. See `references/development-principles.md`
|
|
89
|
+
// (Agent-first surface design, Concrete rule 3).
|
|
90
|
+
const submission = {
|
|
91
|
+
idempotencyKey: options.idempotencyKey ?? generateIdempotencyKey(),
|
|
92
|
+
template: toPlatformSubmissionTemplate(template),
|
|
93
|
+
...(options.variables ? { variables: options.variables } : {}),
|
|
94
|
+
...(options.cleanup ? { cleanup: options.cleanup } : {}),
|
|
95
|
+
secrets: options.secrets,
|
|
96
|
+
...(options.proxyEndpoints && options.proxyEndpoints.length > 0
|
|
97
|
+
? { proxyEndpoints: options.proxyEndpoints }
|
|
98
|
+
: {})
|
|
99
|
+
};
|
|
100
|
+
const run = await operations.submitRun(this.#http, submission);
|
|
101
|
+
return new RunRef(this, run.id);
|
|
19
102
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
103
|
+
getRun(runId) {
|
|
104
|
+
return operations.getRun(this.#http, runId);
|
|
105
|
+
}
|
|
106
|
+
listEvents(runId) {
|
|
107
|
+
return operations.listRunEvents(this.#http, runId);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Poll the events endpoint and yield new events as they arrive. Stops
|
|
111
|
+
* when the run reaches a terminal state, when the signal is aborted,
|
|
112
|
+
* or when the caller breaks out of the iterator.
|
|
113
|
+
*/
|
|
114
|
+
async *streamEvents(runId, options = {}) {
|
|
115
|
+
const intervalMs = options.intervalMs ?? 1_000;
|
|
116
|
+
const signal = options.signal;
|
|
117
|
+
let seenIds = new Set();
|
|
118
|
+
while (!signal?.aborted) {
|
|
119
|
+
const events = await this.listEvents(runId);
|
|
120
|
+
for (const event of events) {
|
|
121
|
+
if (!seenIds.has(event.id)) {
|
|
122
|
+
seenIds.add(event.id);
|
|
123
|
+
yield event;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const run = await this.getRun(runId);
|
|
127
|
+
if (isTerminal(run.status))
|
|
128
|
+
return;
|
|
129
|
+
await sleep(intervalMs, signal);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Poll the run record until it reaches a terminal status (succeeded,
|
|
134
|
+
* failed, terminated). Throws if `timeoutMs` elapses first.
|
|
135
|
+
*/
|
|
136
|
+
async waitForRun(runId, options = {}) {
|
|
137
|
+
const intervalMs = options.intervalMs ?? 1_500;
|
|
138
|
+
const timeoutMs = options.timeoutMs;
|
|
139
|
+
const signal = options.signal;
|
|
140
|
+
const deadline = typeof timeoutMs === "number" ? Date.now() + timeoutMs : Number.POSITIVE_INFINITY;
|
|
141
|
+
while (!signal?.aborted) {
|
|
142
|
+
const run = await this.getRun(runId);
|
|
143
|
+
if (isTerminal(run.status))
|
|
144
|
+
return run;
|
|
145
|
+
if (Date.now() >= deadline) {
|
|
146
|
+
throw new Error(`AntpathClient.waitForRun: timeout after ${timeoutMs}ms`);
|
|
147
|
+
}
|
|
148
|
+
await sleep(intervalMs, signal);
|
|
149
|
+
}
|
|
150
|
+
throw new Error("AntpathClient.waitForRun: aborted");
|
|
151
|
+
}
|
|
152
|
+
listOutputs(runId) {
|
|
153
|
+
return operations.listOutputs(this.#http, runId);
|
|
154
|
+
}
|
|
155
|
+
createOutputLink(runId, outputId) {
|
|
156
|
+
return operations.createOutputLink(this.#http, runId, outputId);
|
|
37
157
|
}
|
|
158
|
+
cancelRun(runId) {
|
|
159
|
+
return operations.cancelRun(this.#http, runId);
|
|
160
|
+
}
|
|
161
|
+
deleteRun(runId) {
|
|
162
|
+
return operations.deleteRun(this.#http, runId);
|
|
163
|
+
}
|
|
164
|
+
whoami() {
|
|
165
|
+
return operations.whoami(this.#http);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const TERMINAL_STATUSES = new Set([
|
|
169
|
+
"succeeded",
|
|
170
|
+
"failed",
|
|
171
|
+
"terminated",
|
|
172
|
+
"cancelled",
|
|
173
|
+
"canceled",
|
|
174
|
+
"cleaned_up"
|
|
175
|
+
]);
|
|
176
|
+
function isTerminal(status) {
|
|
177
|
+
return typeof status === "string" && TERMINAL_STATUSES.has(status);
|
|
178
|
+
}
|
|
179
|
+
function sleep(ms, signal) {
|
|
180
|
+
return new Promise((resolve, reject) => {
|
|
181
|
+
if (signal?.aborted) {
|
|
182
|
+
reject(new Error("aborted"));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const timer = setTimeout(() => {
|
|
186
|
+
signal?.removeEventListener("abort", onAbort);
|
|
187
|
+
resolve();
|
|
188
|
+
}, ms);
|
|
189
|
+
const onAbort = () => {
|
|
190
|
+
clearTimeout(timer);
|
|
191
|
+
reject(new Error("aborted"));
|
|
192
|
+
};
|
|
193
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function generateIdempotencyKey() {
|
|
197
|
+
const cryptoObj = globalThis.crypto;
|
|
198
|
+
if (cryptoObj?.randomUUID)
|
|
199
|
+
return cryptoObj.randomUUID();
|
|
200
|
+
return `idem-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
38
201
|
}
|
|
39
202
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,4BAA4B,EAC5B,iBAAiB,EACjB,eAAe,EAYhB,MAAM,iBAAiB,CAAC;AA2CzB;;;;GAIG;AACH,MAAM,OAAO,MAAM;IACR,KAAK,CAAS;IACd,OAAO,CAAgB;IAEhC,YAAY,MAAqB,EAAE,KAAa;QAC9C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,OAA6B;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,CAAC,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AAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB;IAC7B,MAAM,SAAS,GAAI,UAAyD,CAAC,MAAM,CAAC;IACpF,IAAI,SAAS,EAAE,UAAU;QAAE,OAAO,SAAS,CAAC,UAAU,EAAE,CAAC;IACzD,OAAO,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAClF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export { AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the `antpath` SDK.
|
|
3
|
+
*
|
|
4
|
+
* ONE class (`AntpathClient`) talks to the dashboard BFF. The CLI exposes
|
|
5
|
+
* the SAME operations via subcommands. Everything else is types, errors,
|
|
6
|
+
* template helpers, and event type guards re-exported from `@antpath/shared`.
|
|
7
|
+
*/
|
|
8
|
+
export { AntpathClient, RunRef } from "./client.js";
|
|
9
|
+
export type { AntpathClientOptions, RunSubmitOptions, StreamEventsOptions, WaitForRunOptions } from "./client.js";
|
|
10
|
+
export { AntpathApiError, AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./_shared/index.js";
|
|
11
|
+
export { buildPlatformAllowedHosts, compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string, toPlatformSubmissionTemplate, validateProxyAuth } from "./_shared/index.js";
|
|
12
|
+
export type { CredentialRequirement, EnvironmentDefinition, McpServerDefinition, OutputDefinition, ResolvedTemplate, ResolvedMcpServer, SkillDefinition, TemplateDefinition, TemplateVariableDefinition } from "./_shared/index.js";
|
|
13
|
+
export type { Output, ProviderEvent, Run, RunEvent, RunSubmissionInput, SignedOutputLink, UsageSummary, WhoAmI } from "./_shared/index.js";
|
|
14
|
+
export type { PlatformAnthropicSecrets as AnthropicSecrets, PlatformInlineSecrets as InlineSecrets, PlatformMcpServerSecret as McpServerSecret, PlatformProxyEndpoint as ProxyEndpoint, PlatformProxyEndpointAuth as ProxyEndpointAuth, PlatformProxyAuthValue as ProxyAuthValue, PlatformRunSubmissionRequest as RunSubmissionRequest, PlatformSkillReference as SkillReference, PlatformTemplateSubmission as TemplateSubmission, ProxyAuthShape, ProxyMethod, ProxyResponseMode } from "./_shared/index.js";
|
|
15
|
+
export { isAgentCustomToolUse, isAgentEvent, isAgentMcpToolResult, isAgentMcpToolUse, isAgentMessage, isAgentThinking, isAgentToolResult, isAgentToolUse, isSessionError, isSessionEvent, isSessionStatusIdle, isSessionStatusRescheduled, isSessionStatusRunning, isSessionStatusTerminated, isSpanEvent, isUserEvent, isUserMessage } from "./_shared/index.js";
|
|
16
|
+
export { SecretString, redactSecrets } from "./_shared/index.js";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the `antpath` SDK.
|
|
3
|
+
*
|
|
4
|
+
* ONE class (`AntpathClient`) talks to the dashboard BFF. The CLI exposes
|
|
5
|
+
* the SAME operations via subcommands. Everything else is types, errors,
|
|
6
|
+
* template helpers, and event type guards re-exported from `@antpath/shared`.
|
|
7
|
+
*/
|
|
8
|
+
export { AntpathClient, RunRef } from "./client.js";
|
|
9
|
+
// Errors
|
|
10
|
+
export { AntpathApiError, AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./_shared/index.js";
|
|
11
|
+
// Template helpers
|
|
12
|
+
export { buildPlatformAllowedHosts, compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string, toPlatformSubmissionTemplate, validateProxyAuth } from "./_shared/index.js";
|
|
13
|
+
// Event type guards
|
|
14
|
+
export { isAgentCustomToolUse, isAgentEvent, isAgentMcpToolResult, isAgentMcpToolUse, isAgentMessage, isAgentThinking, isAgentToolResult, isAgentToolUse, isSessionError, isSessionEvent, isSessionStatusIdle, isSessionStatusRescheduled, isSessionStatusRunning, isSessionStatusTerminated, isSpanEvent, isUserEvent, isUserMessage } from "./_shared/index.js";
|
|
15
|
+
// Secret utilities
|
|
16
|
+
export { SecretString, redactSecrets } from "./_shared/index.js";
|
|
8
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQpD,SAAS;AACT,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAEzB,mBAAmB;AACnB,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,MAAM,EACN,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AA4CzB,oBAAoB;AACpB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
package/docs/cleanup.md
CHANGED
|
@@ -4,12 +4,15 @@ title: Cleanup
|
|
|
4
4
|
|
|
5
5
|
# Cleanup
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
By default, the worker cleans up Claude resources after a run reaches a terminal status (`succeeded`, `failed`, `terminated`). Skip cleanup explicitly when you need provider-side files/events for inspection:
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
await
|
|
10
|
+
const ref = await client.submitRun(template, {
|
|
11
|
+
secrets: { anthropic: { apiKey: process.env.ANTHROPIC_API_KEY! } },
|
|
12
|
+
cleanup: { session: "retain" }
|
|
13
|
+
});
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
The corresponding CLI flag is `--cleanup retain` (default `delete`).
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
A retained session remains visible to Anthropic until the workspace's retention policy reclaims it. The dashboard records `cleanupStatus` (`succeeded` for delete, `retained` for retain, `failed` for crash-stranded resources) and `provider_resources` rows so a future repair operation can recover orphaned resources when needed.
|
package/docs/credentials.md
CHANGED
|
@@ -4,11 +4,11 @@ title: Credentials
|
|
|
4
4
|
|
|
5
5
|
# Credentials
|
|
6
6
|
|
|
7
|
-
antpath does not store provider keys or MCP credential values.
|
|
7
|
+
antpath does not store provider keys or MCP credential values across runs.
|
|
8
8
|
|
|
9
|
-
The caller
|
|
9
|
+
The caller passes a workspace-scoped SDK token and provider key inline on every `submitRun` call. The dashboard vaults the bundle for the lifetime of a single run and destroys it at cleanup. MCP credentials and skill references travel the same way.
|
|
10
10
|
|
|
11
|
-
MVP credential types:
|
|
11
|
+
MVP credential types for MCP auth:
|
|
12
12
|
|
|
13
13
|
- `static_bearer`;
|
|
14
14
|
- `oauth_access_token`.
|
|
@@ -29,13 +29,12 @@ The platform's managed HTTP proxy is the agent-first alternative. The caller dec
|
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
31
|
import {
|
|
32
|
-
|
|
32
|
+
AntpathClient,
|
|
33
33
|
validateProxyAuth,
|
|
34
34
|
buildPlatformAllowedHosts
|
|
35
35
|
} from "antpath";
|
|
36
36
|
|
|
37
|
-
const client = new
|
|
38
|
-
baseUrl: "https://dashboard.antpath.dev",
|
|
37
|
+
const client = new AntpathClient({
|
|
39
38
|
apiToken: "ant_..."
|
|
40
39
|
});
|
|
41
40
|
|
|
@@ -65,8 +64,7 @@ const proxyEndpointAuth = [
|
|
|
65
64
|
// Fail fast at submission time when policy and auth disagree.
|
|
66
65
|
validateProxyAuth(proxyEndpoints, proxyEndpointAuth);
|
|
67
66
|
|
|
68
|
-
const
|
|
69
|
-
templateId: "tmpl_xxx",
|
|
67
|
+
const ref = await client.submitRun(template, {
|
|
70
68
|
proxyEndpoints,
|
|
71
69
|
secrets: {
|
|
72
70
|
anthropic: { apiKey: process.env.ANTHROPIC_API_KEY! },
|
|
@@ -78,7 +76,7 @@ const run = await client.submitRun({
|
|
|
78
76
|
Inside the run container, every session has the platform CLI mounted at `/antpath/antpath` (a Node ESM bundle) and a manifest at `/antpath/index.json` describing the declared endpoints. The skill calls the proxy via the CLI:
|
|
79
77
|
|
|
80
78
|
```bash
|
|
81
|
-
|
|
79
|
+
/antpath/antpath proxy stripe \
|
|
82
80
|
--method GET \
|
|
83
81
|
--path /v1/charges/ch_123 \
|
|
84
82
|
--response-mode headers_only
|
|
@@ -86,7 +84,7 @@ node /antpath/antpath proxy stripe \
|
|
|
86
84
|
|
|
87
85
|
The CLI reads the per-run bearer from `/antpath/run-token`, attaches the `X-Antpath-Proxy-Protocol` header, and the BFF injects the bearer/header/query/basic credential before dispatching the outbound call. Only the response (subject to `responseMode` and `maxResponseBytes`) reaches the container. `--response-mode` can only narrow below the policy ceiling.
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
`/antpath/antpath --help` reads endpoint details from `/antpath/index.json`. Runs that do not declare any `proxyEndpoints` still have the CLI and an empty manifest mounted, so agents never need to introspect whether the surface exists.
|
|
90
88
|
|
|
91
89
|
### Networking
|
|
92
90
|
|
|
@@ -99,7 +97,7 @@ const allowedHosts = buildPlatformAllowedHosts({
|
|
|
99
97
|
});
|
|
100
98
|
```
|
|
101
99
|
|
|
102
|
-
###
|
|
100
|
+
### Secrets are always explicit at the call site
|
|
103
101
|
|
|
104
|
-
`
|
|
102
|
+
There is no `defaultSecrets` and no client-held secret state. Every `submitRun` call carries its full `secrets` bundle (Anthropic key + optional MCP credentials + optional skill references + 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.
|
|
105
103
|
|