antpath 0.1.0 → 0.2.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 +102 -67
- package/dist/client.js +4 -1
- package/dist/client.js.map +1 -1
- package/dist/credentials.js +34 -5
- package/dist/credentials.js.map +1 -1
- package/dist/files/downloader.js +8 -0
- package/dist/files/downloader.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/platform/client.d.ts +204 -0
- package/dist/platform/client.js +203 -0
- package/dist/platform/client.js.map +1 -0
- package/dist/platform/index.d.ts +1 -0
- package/dist/platform/index.js +2 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/providers/anthropic/provider.d.ts +6 -0
- package/dist/providers/anthropic/provider.js +90 -12
- package/dist/providers/anthropic/provider.js.map +1 -1
- package/dist/providers/known-events.d.ts +60 -0
- package/dist/providers/known-events.js +64 -0
- package/dist/providers/known-events.js.map +1 -0
- package/dist/run/controller.d.ts +4 -1
- package/dist/run/controller.js +103 -13
- package/dist/run/controller.js.map +1 -1
- package/dist/template/index.d.ts +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/utils/events.d.ts +21 -0
- package/dist/utils/events.js +97 -18
- package/dist/utils/events.js.map +1 -1
- package/dist/utils/paths.js +9 -3
- package/dist/utils/paths.js.map +1 -1
- package/docs/cleanup.md +15 -15
- package/docs/credentials.md +105 -23
- package/docs/events.md +129 -0
- package/docs/mcp.md +18 -18
- package/docs/outputs.md +16 -16
- package/docs/quickstart.md +13 -13
- package/docs/release.md +22 -22
- package/docs/skills.md +18 -16
- package/docs/templates.md +24 -24
- package/docs/testing.md +26 -27
- package/examples/mcp-static-bearer.ts +30 -30
- package/examples/quickstart.ts +23 -23
- package/package.json +46 -51
- package/references/architecture-decisions.md +473 -203
- package/references/implementation-plan.md +452 -527
- package/references/research-sources.md +41 -30
- package/references/testing-strategy.md +29 -108
package/README.md
CHANGED
|
@@ -1,67 +1,102 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: antpath
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# antpath
|
|
6
|
-
|
|
7
|
-
antpath is a TypeScript-first SDK for running autonomous Claude Managed Agents sessions from code-defined, secret-free Templates.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
1
|
+
---
|
|
2
|
+
title: antpath
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# antpath
|
|
6
|
+
|
|
7
|
+
antpath is a TypeScript-first SDK for running autonomous Claude Managed Agents sessions from code-defined, secret-free Templates.
|
|
8
|
+
|
|
9
|
+
Everything ships from a single import path:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {
|
|
13
|
+
AntpathClient, // direct in-process Claude runs (caller-held key)
|
|
14
|
+
AntpathPlatformClient, // submit durable runs to an antpath dashboard
|
|
15
|
+
defineTemplate,
|
|
16
|
+
string,
|
|
17
|
+
validateProxyAuth // helper for per-run proxy endpoint auth
|
|
18
|
+
} from "antpath";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
There is no `antpath/platform`, `antpath/proxy`, or other sub-path. The two
|
|
22
|
+
clients are distinct classes for distinct use cases but live behind the same
|
|
23
|
+
single agent-visible surface — see [Agent-first surface design](../../references/development-principles.md#agent-first-surface-design).
|
|
24
|
+
|
|
25
|
+
- **Direct (`AntpathClient`)** — runs Claude in your own process with a caller-held key. This README covers the direct surface.
|
|
26
|
+
- **Platform (`AntpathPlatformClient`)** — submits durable runs to an antpath dashboard. Every submission carries an inline `secrets` bundle (Anthropic key, optional MCP credentials, optional skill references, and optional per-run proxy endpoint auth); the dashboard vaults the bundle for the lifetime of one run and deletes it at cleanup. Per-run named secrets accessed through the managed HTTP proxy are declared via the `proxyEndpoints` submission field and authenticated via `secrets.proxyEndpointAuth` — see [Credentials](docs/credentials.md). The same npm package also ships the `antpath` CLI as its `bin` entry; the worker mounts that CLI at `/antpath/antpath` in every run for skills to invoke (`node /antpath/antpath proxy …`).
|
|
27
|
+
|
|
28
|
+
## MVP boundaries (direct SDK)
|
|
29
|
+
|
|
30
|
+
- Claude Managed Agents only.
|
|
31
|
+
- Caller-held provider key — the direct SDK never persists keys.
|
|
32
|
+
- No SDK-side storage of provider keys, MCP credentials, or output file contents.
|
|
33
|
+
- Manual cleanup by default.
|
|
34
|
+
|
|
35
|
+
## Quickstart
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { AntpathClient, defineTemplate, string } from "antpath";
|
|
39
|
+
|
|
40
|
+
const client = new AntpathClient({
|
|
41
|
+
anthropicApiKey: process.env.ANTHROPIC_API_KEY
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const template = defineTemplate({
|
|
45
|
+
name: "hello",
|
|
46
|
+
model: "claude-haiku-4-5",
|
|
47
|
+
system: "You are a concise automation agent.",
|
|
48
|
+
messages: ["Write a short answer about {{topic}}."],
|
|
49
|
+
variables: {
|
|
50
|
+
topic: string()
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const handle = await client.run(template, {
|
|
55
|
+
variables: { topic: "test-first SDK design" }
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const result = await handle.wait();
|
|
59
|
+
console.log(result.status, await handle.usage());
|
|
60
|
+
await handle.downloadOutputs("./outputs");
|
|
61
|
+
await handle.cleanup();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Observe events live by passing `onEvent` in `RunOptions`:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const handle = await client.run(template, {
|
|
68
|
+
onEvent: (event) => {
|
|
69
|
+
if (event.type === "provider.event") {
|
|
70
|
+
// event.event is a ProviderEvent (raw type stays `unknown`).
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
await handle.wait();
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
By the time `wait()` returns, every `onEvent` invocation triggered before
|
|
78
|
+
terminal status has settled. See [Events](docs/events.md) for the full
|
|
79
|
+
contract and a list of typed helpers.
|
|
80
|
+
|
|
81
|
+
## Test commands
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
npm run test:unit
|
|
85
|
+
npm run test:unit:recorded
|
|
86
|
+
npm run test:e2e:live
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Unit tests are deterministic and may use fakes or sanitized recorded snapshots. Live e2e tests run when `pnpm test:e2e:live` is invoked with `.env.local` containing `ANTHROPIC_API_KEY`.
|
|
90
|
+
|
|
91
|
+
## Guides
|
|
92
|
+
|
|
93
|
+
- [Quickstart](docs/quickstart.md)
|
|
94
|
+
- [Templates](docs/templates.md)
|
|
95
|
+
- [Credentials](docs/credentials.md)
|
|
96
|
+
- [MCP](docs/mcp.md)
|
|
97
|
+
- [Skills](docs/skills.md)
|
|
98
|
+
- [Outputs](docs/outputs.md)
|
|
99
|
+
- [Events](docs/events.md)
|
|
100
|
+
- [Cleanup](docs/cleanup.md)
|
|
101
|
+
- [Testing](docs/testing.md)
|
|
102
|
+
- [Release](docs/release.md)
|
package/dist/client.js
CHANGED
|
@@ -27,7 +27,10 @@ export class AntpathClient {
|
|
|
27
27
|
cleanupPolicy: options.cleanupPolicy ?? this.#cleanupPolicy,
|
|
28
28
|
timeoutMs: options.timeoutMs,
|
|
29
29
|
signal: options.signal,
|
|
30
|
-
logger: options.logger
|
|
30
|
+
logger: options.logger,
|
|
31
|
+
onEvent: options.onEvent,
|
|
32
|
+
onEventAbortOnError: options.onEventAbortOnError ?? false,
|
|
33
|
+
sessionResources: options.sessionResources ?? []
|
|
31
34
|
});
|
|
32
35
|
await controller.start();
|
|
33
36
|
return controller;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAWzD,MAAM,OAAO,aAAa;IACf,SAAS,CAAuB;IAChC,cAAc,CAAgB;IAEvC,YAAY,OAA6B;QACvC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;QACpC,CAAC;aAAM,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,IAAI,8BAA8B,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;QAC3F,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,C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O,CAAC,eAAe,EAAE,CAAC,CAAC;QAC3F,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,IAAI,QAAQ,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAA4B,EAAE,UAAsB,EAAE;QAC9D,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACpE,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QACzD,MAAM,UAAU,GAAG,IAAI,aAAa,CAAC;YACnC,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;YACtC,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,cAAc;YAC3D,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,KAAK;YACzD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;SACjD,CAAC,CAAC;QACH,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
|
package/dist/credentials.js
CHANGED
|
@@ -2,9 +2,12 @@ import { CredentialValidationError } from "./errors.js";
|
|
|
2
2
|
export function validateCredentials(template, credentials = {}) {
|
|
3
3
|
for (const [key, requirement] of Object.entries(template.credentialRequirements)) {
|
|
4
4
|
const credential = credentials[key];
|
|
5
|
-
if (
|
|
5
|
+
if (credential === undefined) {
|
|
6
6
|
throw new CredentialValidationError(`Missing credential for MCP server '${key}'`);
|
|
7
7
|
}
|
|
8
|
+
if (!isRecord(credential)) {
|
|
9
|
+
throw new CredentialValidationError(`Credential for MCP server '${key}' must be an object`);
|
|
10
|
+
}
|
|
8
11
|
if (credential.type !== requirement.type) {
|
|
9
12
|
throw new CredentialValidationError(`Credential for MCP server '${key}' must be '${requirement.type}'`);
|
|
10
13
|
}
|
|
@@ -17,11 +20,37 @@ export function validateCredentials(template, credentials = {}) {
|
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
function validateCredentialValue(key, credential) {
|
|
20
|
-
if (
|
|
21
|
-
throw new CredentialValidationError(`
|
|
23
|
+
if (!isRecord(credential)) {
|
|
24
|
+
throw new CredentialValidationError(`Credential for MCP server '${key}' must be an object`);
|
|
25
|
+
}
|
|
26
|
+
if (credential.type === "static_bearer") {
|
|
27
|
+
assertAllowedFields(key, credential, ["type", "token"]);
|
|
28
|
+
if (typeof credential.token !== "string" || credential.token.length === 0) {
|
|
29
|
+
throw new CredentialValidationError(`Static bearer credential for '${key}' requires token`);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
22
32
|
}
|
|
23
|
-
if (credential.type === "oauth_access_token"
|
|
24
|
-
|
|
33
|
+
if (credential.type === "oauth_access_token") {
|
|
34
|
+
assertAllowedFields(key, credential, ["type", "accessToken", "expiresAt"]);
|
|
35
|
+
if (typeof credential.accessToken !== "string" || credential.accessToken.length === 0) {
|
|
36
|
+
throw new CredentialValidationError(`OAuth credential for '${key}' requires accessToken`);
|
|
37
|
+
}
|
|
38
|
+
if (credential.expiresAt !== undefined && (typeof credential.expiresAt !== "string" || credential.expiresAt.length === 0)) {
|
|
39
|
+
throw new CredentialValidationError(`OAuth credential for '${key}' has invalid expiresAt`);
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
25
42
|
}
|
|
43
|
+
throw new CredentialValidationError(`Credential for MCP server '${key}' has unsupported type`);
|
|
44
|
+
}
|
|
45
|
+
function assertAllowedFields(key, credential, allowed) {
|
|
46
|
+
const allowedSet = new Set(allowed);
|
|
47
|
+
for (const field of Object.keys(credential)) {
|
|
48
|
+
if (!allowedSet.has(field)) {
|
|
49
|
+
throw new CredentialValidationError(`Credential for MCP server '${key}' contains unsupported field '${field}'`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function isRecord(input) {
|
|
54
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
26
55
|
}
|
|
27
56
|
//# sourceMappingURL=credentials.js.map
|
package/dist/credentials.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAIxD,MAAM,UAAU,mBAAmB,CAAC,QAA0B,EAAE,cAA+C,EAAE;IAC/G,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;QACjF,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAIxD,MAAM,UAAU,mBAAmB,CAAC,QAA0B,EAAE,cAA+C,EAAE;IAC/G,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;QACjF,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAY,CAAC;QAC/C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,yBAAyB,CAAC,sCAAsC,GAAG,GAAG,CAAC,CAAC;QACpF,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,UAAU,C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aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;QAC3E,IAAI,OAAO,UAAU,CAAC,WAAW,KAAK,QAAQ,IAAI,UAAU,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtF,MAAM,IAAI,yBAAyB,CAAC,yBAAyB,GAAG,wBAAwB,CAAC,CAAC;QAC5F,CAAC;QACD,IAAI,UAAU,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,OAAO,UAAU,CAAC,SAAS,KAAK,QAAQ,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YAC1H,MAAM,IAAI,yBAAyB,CAAC,yBAAyB,GAAG,yBAAyB,CAAC,CAAC;QAC7F,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,IAAI,yBAAyB,CAAC,8BAA8B,GAAG,wBAAwB,CAAC,CAAC;AACjG,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW,EAAE,UAAmC,EAAE,OAA0B;IACvG,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,yBAAyB,CAAC,8BAA8B,GAAG,iCAAiC,KAAK,GAAG,CAAC,CAAC;QAClH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/dist/files/downloader.js
CHANGED
|
@@ -11,8 +11,16 @@ export async function downloadOutputs(provider, sessionId, options) {
|
|
|
11
11
|
throw new Error(`Refusing to download ${totalBytes} bytes; maxTotalBytes exceeded`);
|
|
12
12
|
}
|
|
13
13
|
const manifest = { directory: options.directory, files: [] };
|
|
14
|
+
let downloadedBytes = 0;
|
|
14
15
|
for (const file of files) {
|
|
15
16
|
const content = await provider.downloadFile(file.id);
|
|
17
|
+
if (file.sizeBytes !== undefined && content.byteLength !== file.sizeBytes) {
|
|
18
|
+
throw new Error(`Downloaded byte size for ${file.id} did not match provider metadata`);
|
|
19
|
+
}
|
|
20
|
+
downloadedBytes += content.byteLength;
|
|
21
|
+
if (downloadedBytes > (options.maxTotalBytes ?? DEFAULT_MAX_BYTES)) {
|
|
22
|
+
throw new Error(`Downloaded outputs exceeded maxTotalBytes`);
|
|
23
|
+
}
|
|
16
24
|
const localPath = await writeFileSafe(options.directory, file.filename, content);
|
|
17
25
|
const entry = {
|
|
18
26
|
providerFileId: file.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloader.js","sourceRoot":"","sources":["../../src/files/downloader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,iBAAiB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAA8B,EAC9B,SAAiB,EACjB,OAA+B;IAE/B,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;IACxE,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,iBAAiB,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,MAAM,2BAA2B,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,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AY,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1G,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export { AntpathClient } from "./client.js";
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
2
|
+
export { AntpathPlatformClient, PlatformApiError, validateProxyAuth, buildPlatformAllowedHosts, resetDefaultSecretsDeprecationWarning } from "./platform/index.js";
|
|
3
|
+
export type { PlatformEvent, PlatformOutput, PlatformRun, SignedOutputLink, PlatformInlineSecrets, PlatformRunSubmissionRequest, PlatformProxyEndpoint, PlatformProxyEndpointAuth, PlatformProxyAuthShape, PlatformProxyMethod, PlatformProxyResponseMode, AntpathPlatformClientOptions } from "./platform/index.js";
|
|
4
|
+
export { AnthropicManagedAgentsProvider } from "./providers/anthropic/provider.js";
|
|
5
|
+
export type { ManagedAgentProvider, ProviderSkillRef, SessionResourceInput, UploadFileInput } from "./providers/types.js";
|
|
6
|
+
export { isAgentEvent, isAgentCustomToolUse, isAgentMcpToolResult, isAgentMcpToolUse, isAgentMessage, isAgentThinking, isAgentToolResult, isAgentToolUse, isSessionError, isSessionEvent, isSessionStatusIdle, isSessionStatusRescheduled, isSessionStatusRunning, isSessionStatusTerminated, isSpanEvent, isUserEvent, isUserMessage } from "./providers/known-events.js";
|
|
7
|
+
export { compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string, type EnvironmentDefinition, type ResolvedTemplate, type TemplateDefinition, type TemplateVariableDefinition } from "./template/index.js";
|
|
8
|
+
export type { CleanupPolicy, CleanupResult, CredentialInput, DownloadOutputsOptions, DownloadOutputsResult, Logger, OutputManifest, ProviderEvent, ProviderFile, ProviderResourceIds, RunEvent, RunEventHandler, RunHandle, RunOptions, RunResult, RunStatus, SessionResourceUpload, UsageSummary } from "./types.js";
|
|
4
9
|
export { SecretString, redactSecrets } from "./utils/secrets.js";
|
|
5
10
|
export { AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./errors.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { AntpathClient } from "./client.js";
|
|
2
|
+
export { AntpathPlatformClient, PlatformApiError, validateProxyAuth, buildPlatformAllowedHosts, resetDefaultSecretsDeprecationWarning } from "./platform/index.js";
|
|
3
|
+
export { AnthropicManagedAgentsProvider } from "./providers/anthropic/provider.js";
|
|
4
|
+
export { isAgentEvent, isAgentCustomToolUse, isAgentMcpToolResult, isAgentMcpToolUse, isAgentMessage, isAgentThinking, isAgentToolResult, isAgentToolUse, isSessionError, isSessionEvent, isSessionStatusIdle, isSessionStatusRescheduled, isSessionStatusRunning, isSessionStatusTerminated, isSpanEvent, isUserEvent, isUserMessage } from "./providers/known-events.js";
|
|
2
5
|
export { compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string } from "./template/index.js";
|
|
3
6
|
export { SecretString, redactSecrets } from "./utils/secrets.js";
|
|
4
7
|
export { AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./errors.js";
|
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;AAC5C,OAAO,EACL,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,qCAAqC,EACtC,MAAM,qBAAqB,CAAC;AAe7B,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAEnF,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,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,6BAA6B,CAAC;AACrC,OAAO,EACL,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,MAAM,EAKP,MAAM,qBAAqB,CAAC;AAqB7B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,uBAAuB,EACxB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
2
|
+
export type PlatformJsonPrimitive = string | number | boolean | null;
|
|
3
|
+
export type PlatformJsonValue = PlatformJsonPrimitive | readonly PlatformJsonValue[] | {
|
|
4
|
+
readonly [key: string]: PlatformJsonValue;
|
|
5
|
+
};
|
|
6
|
+
export interface PlatformTemplateSubmission {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly model: string;
|
|
9
|
+
readonly templateHash: string;
|
|
10
|
+
readonly system?: string;
|
|
11
|
+
readonly messages: readonly string[];
|
|
12
|
+
readonly metadata?: Record<string, PlatformJsonValue>;
|
|
13
|
+
}
|
|
14
|
+
export type PlatformClaudeSessionCleanup = "retain" | "delete";
|
|
15
|
+
export interface PlatformCleanupPolicy {
|
|
16
|
+
readonly session?: PlatformClaudeSessionCleanup;
|
|
17
|
+
readonly claudeSession?: PlatformClaudeSessionCleanup;
|
|
18
|
+
}
|
|
19
|
+
export interface PlatformAnthropicSecrets {
|
|
20
|
+
readonly apiKey: string;
|
|
21
|
+
readonly baseUrl?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PlatformMcpServerSecret {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly url: string;
|
|
26
|
+
readonly headers?: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
export interface PlatformSkillReference {
|
|
29
|
+
readonly skillId: string;
|
|
30
|
+
readonly version?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PlatformInlineSecrets {
|
|
33
|
+
readonly anthropic: PlatformAnthropicSecrets;
|
|
34
|
+
readonly mcpServers?: readonly PlatformMcpServerSecret[];
|
|
35
|
+
readonly skills?: readonly PlatformSkillReference[];
|
|
36
|
+
/**
|
|
37
|
+
* Auth values for proxy endpoints declared at the top level of the
|
|
38
|
+
* submission. Each entry's `name` must match a declared
|
|
39
|
+
* `proxyEndpoints[i].name` and its `value.type` must match the
|
|
40
|
+
* declared `authShape.type`. Validate eagerly with
|
|
41
|
+
* {@link validateProxyAuth}.
|
|
42
|
+
*/
|
|
43
|
+
readonly proxyEndpointAuth?: readonly PlatformProxyEndpointAuth[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Structural description of how the upstream endpoint expects auth.
|
|
47
|
+
* The actual value lives in {@link PlatformProxyEndpointAuth.value} and
|
|
48
|
+
* is supplied separately so it never enters the idempotency hash.
|
|
49
|
+
*/
|
|
50
|
+
export type PlatformProxyAuthShape = {
|
|
51
|
+
readonly type: "bearer";
|
|
52
|
+
} | {
|
|
53
|
+
readonly type: "basic";
|
|
54
|
+
} | {
|
|
55
|
+
readonly type: "header";
|
|
56
|
+
readonly name: string;
|
|
57
|
+
} | {
|
|
58
|
+
readonly type: "query";
|
|
59
|
+
readonly name: string;
|
|
60
|
+
};
|
|
61
|
+
export type PlatformProxyMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
62
|
+
export type PlatformProxyResponseMode = "full" | "status_only" | "headers_only";
|
|
63
|
+
export interface PlatformProxyEndpoint {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly baseUrl: string;
|
|
66
|
+
readonly authShape: PlatformProxyAuthShape;
|
|
67
|
+
readonly allowMethods: readonly PlatformProxyMethod[];
|
|
68
|
+
readonly allowPathPrefixes: readonly string[];
|
|
69
|
+
readonly allowHeaders?: readonly string[];
|
|
70
|
+
readonly responseMode?: PlatformProxyResponseMode;
|
|
71
|
+
readonly maxRequestBytes?: number;
|
|
72
|
+
readonly maxResponseBytes?: number;
|
|
73
|
+
readonly timeoutMs?: number;
|
|
74
|
+
readonly perCallBudget?: number;
|
|
75
|
+
readonly responseByteBudget?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface PlatformProxyEndpointAuth {
|
|
78
|
+
readonly name: string;
|
|
79
|
+
readonly value: {
|
|
80
|
+
readonly type: "bearer";
|
|
81
|
+
readonly token: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly type: "basic";
|
|
84
|
+
readonly username: string;
|
|
85
|
+
readonly password: string;
|
|
86
|
+
} | {
|
|
87
|
+
readonly type: "header";
|
|
88
|
+
readonly value: string;
|
|
89
|
+
} | {
|
|
90
|
+
readonly type: "query";
|
|
91
|
+
readonly value: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Submission shape accepted by `AntpathPlatformClient.submitRun`. The `secrets`
|
|
96
|
+
* block may be omitted at the call site if a client-level default was provided
|
|
97
|
+
* to the constructor; the merged value is always sent on the wire.
|
|
98
|
+
*/
|
|
99
|
+
export interface PlatformRunSubmissionRequest {
|
|
100
|
+
readonly workspaceId: string;
|
|
101
|
+
readonly idempotencyKey: string;
|
|
102
|
+
readonly template: PlatformTemplateSubmission;
|
|
103
|
+
readonly variables?: Record<string, PlatformJsonValue>;
|
|
104
|
+
readonly cleanup?: PlatformCleanupPolicy;
|
|
105
|
+
readonly secrets?: PlatformInlineSecrets;
|
|
106
|
+
/**
|
|
107
|
+
* HTTP endpoints reachable via the antpath managed proxy during this
|
|
108
|
+
* run. Each entry declares the policy (URL, allow lists, caps); the
|
|
109
|
+
* corresponding auth value goes in
|
|
110
|
+
* `secrets.proxyEndpointAuth[i]` with a matching `name`.
|
|
111
|
+
*
|
|
112
|
+
* Empty / omitted → no proxy surface is provisioned (the in-container
|
|
113
|
+
* `/antpath/index.json` reports `endpoints: []`).
|
|
114
|
+
*/
|
|
115
|
+
readonly proxyEndpoints?: readonly PlatformProxyEndpoint[];
|
|
116
|
+
}
|
|
117
|
+
export interface AntpathPlatformClientOptions {
|
|
118
|
+
readonly baseUrl: string;
|
|
119
|
+
readonly apiToken: string;
|
|
120
|
+
readonly fetch?: FetchLike;
|
|
121
|
+
/**
|
|
122
|
+
* Optional default secrets applied to every submission that does not
|
|
123
|
+
* override the `secrets` block per-call.
|
|
124
|
+
*
|
|
125
|
+
* @deprecated The agent-first invariant requires every secret-bearing
|
|
126
|
+
* field to be visible at the call site. Pass `secrets` explicitly on
|
|
127
|
+
* each `submitRun` call instead; this option will be removed in a
|
|
128
|
+
* future release. See
|
|
129
|
+
* `references/development-principles.md` (Agent-first surface design).
|
|
130
|
+
*/
|
|
131
|
+
readonly defaultSecrets?: PlatformInlineSecrets;
|
|
132
|
+
}
|
|
133
|
+
export interface PlatformRun {
|
|
134
|
+
readonly id: string;
|
|
135
|
+
readonly status: string;
|
|
136
|
+
readonly [key: string]: unknown;
|
|
137
|
+
}
|
|
138
|
+
export interface PlatformEvent {
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly [key: string]: unknown;
|
|
141
|
+
}
|
|
142
|
+
export interface PlatformOutput {
|
|
143
|
+
readonly id: string;
|
|
144
|
+
readonly [key: string]: unknown;
|
|
145
|
+
}
|
|
146
|
+
export interface SignedOutputLink {
|
|
147
|
+
readonly url: string;
|
|
148
|
+
readonly [key: string]: unknown;
|
|
149
|
+
}
|
|
150
|
+
export declare class PlatformApiError extends Error {
|
|
151
|
+
readonly status: number;
|
|
152
|
+
readonly details: unknown;
|
|
153
|
+
constructor(status: number, message: string, details: unknown);
|
|
154
|
+
}
|
|
155
|
+
export declare class AntpathPlatformClient {
|
|
156
|
+
private readonly baseUrl;
|
|
157
|
+
private readonly apiToken;
|
|
158
|
+
private readonly fetchImpl;
|
|
159
|
+
private readonly defaultSecrets?;
|
|
160
|
+
constructor(options: AntpathPlatformClientOptions);
|
|
161
|
+
submitRun(request: PlatformRunSubmissionRequest): Promise<PlatformRun>;
|
|
162
|
+
getRun(workspaceId: string, runId: string): Promise<PlatformRun>;
|
|
163
|
+
listRunEvents(workspaceId: string, runId: string): Promise<readonly PlatformEvent[]>;
|
|
164
|
+
listOutputs(workspaceId: string, runId: string): Promise<readonly PlatformOutput[]>;
|
|
165
|
+
createOutputLink(workspaceId: string, runId: string, outputId: string): Promise<SignedOutputLink>;
|
|
166
|
+
cancelRun(workspaceId: string, runId: string): Promise<void>;
|
|
167
|
+
deleteRun(workspaceId: string, runId: string): Promise<void>;
|
|
168
|
+
private request;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Test-only: reset the "warn once" guard for the `defaultSecrets`
|
|
172
|
+
* deprecation message. Production code should not call this.
|
|
173
|
+
*
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
export declare function resetDefaultSecretsDeprecationWarning(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Cross-validate a `proxyEndpoints` policy list against a
|
|
179
|
+
* `secrets.proxyEndpointAuth` value list. Throws on the first
|
|
180
|
+
* mismatch with an actionable, field-named error message.
|
|
181
|
+
*
|
|
182
|
+
* Mirrors the BFF's authoritative validator so misconfigured
|
|
183
|
+
* submissions fail fast in the SDK before going over the wire. Use it
|
|
184
|
+
* directly in tests or wrappers — `submitRun` already invokes it when
|
|
185
|
+
* `proxyEndpoints` is non-empty.
|
|
186
|
+
*/
|
|
187
|
+
export declare function validateProxyAuth(endpoints: readonly PlatformProxyEndpoint[], auth: readonly PlatformProxyEndpointAuth[] | undefined): void;
|
|
188
|
+
/**
|
|
189
|
+
* Build an `allowedHosts` list for `environment.network` that includes
|
|
190
|
+
* the antpath proxy host (and optionally Anthropic's MCP host) when
|
|
191
|
+
* the caller is hand-rolling networking. The worker auto-injects the
|
|
192
|
+
* proxy host server-side when proxy endpoints are declared; use this
|
|
193
|
+
* helper when you also want client-side template validation parity
|
|
194
|
+
* (e.g. to assert at build time that a `limited` config can reach the
|
|
195
|
+
* surfaces you intended).
|
|
196
|
+
*
|
|
197
|
+
* The proxy host is derived from the dashboard URL. Pass the same
|
|
198
|
+
* value you used for the `AntpathPlatformClient` `baseUrl`.
|
|
199
|
+
*/
|
|
200
|
+
export declare function buildPlatformAllowedHosts(input: {
|
|
201
|
+
readonly dashboardBaseUrl: string;
|
|
202
|
+
readonly extraHosts?: readonly string[];
|
|
203
|
+
}): readonly string[];
|
|
204
|
+
export {};
|