antpath 0.1.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 +67 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.js +36 -0
- package/dist/client.js.map +1 -0
- package/dist/credentials.d.ts +3 -0
- package/dist/credentials.js +27 -0
- package/dist/credentials.js.map +1 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.js +39 -0
- package/dist/errors.js.map +1 -0
- package/dist/files/downloader.d.ts +3 -0
- package/dist/files/downloader.js +35 -0
- package/dist/files/downloader.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/anthropic/provider.d.ts +30 -0
- package/dist/providers/anthropic/provider.js +302 -0
- package/dist/providers/anthropic/provider.js.map +1 -0
- package/dist/providers/types.d.ts +42 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/run/controller.d.ts +27 -0
- package/dist/run/controller.js +224 -0
- package/dist/run/controller.js.map +1 -0
- package/dist/skills/packager.d.ts +11 -0
- package/dist/skills/packager.js +76 -0
- package/dist/skills/packager.js.map +1 -0
- package/dist/template/compiler.d.ts +28 -0
- package/dist/template/compiler.js +116 -0
- package/dist/template/compiler.js.map +1 -0
- package/dist/template/index.d.ts +10 -0
- package/dist/template/index.js +14 -0
- package/dist/template/index.js.map +1 -0
- package/dist/template/types.d.ts +67 -0
- package/dist/template/types.js +2 -0
- package/dist/template/types.js.map +1 -0
- package/dist/types.d.ts +129 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/events.d.ts +6 -0
- package/dist/utils/events.js +41 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/paths.d.ts +3 -0
- package/dist/utils/paths.js +21 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/secrets.d.ts +10 -0
- package/dist/utils/secrets.js +59 -0
- package/dist/utils/secrets.js.map +1 -0
- package/dist/utils/stable.d.ts +2 -0
- package/dist/utils/stable.js +20 -0
- package/dist/utils/stable.js.map +1 -0
- package/docs/cleanup.md +15 -0
- package/docs/credentials.md +23 -0
- package/docs/mcp.md +18 -0
- package/docs/outputs.md +16 -0
- package/docs/quickstart.md +13 -0
- package/docs/release.md +22 -0
- package/docs/skills.md +16 -0
- package/docs/templates.md +24 -0
- package/docs/testing.md +27 -0
- package/examples/mcp-static-bearer.ts +30 -0
- package/examples/quickstart.ts +23 -0
- package/package.json +51 -0
- package/references/architecture-decisions.md +203 -0
- package/references/implementation-plan.md +527 -0
- package/references/research-sources.md +30 -0
- package/references/testing-strategy.md +108 -0
package/README.md
ADDED
|
@@ -0,0 +1,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
|
+
## MVP boundaries
|
|
10
|
+
|
|
11
|
+
- SDK-only.
|
|
12
|
+
- Claude Managed Agents only.
|
|
13
|
+
- Caller-held provider key.
|
|
14
|
+
- No stored provider keys, MCP credentials, or output file contents.
|
|
15
|
+
- Manual cleanup by default.
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { AntpathClient, defineTemplate, string } from "antpath";
|
|
21
|
+
|
|
22
|
+
const client = new AntpathClient({
|
|
23
|
+
anthropicApiKey: process.env.ANTHROPIC_API_KEY
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const template = defineTemplate({
|
|
27
|
+
name: "hello",
|
|
28
|
+
model: "claude-haiku-4-5",
|
|
29
|
+
system: "You are a concise automation agent.",
|
|
30
|
+
messages: ["Write a short answer about {{topic}}."],
|
|
31
|
+
variables: {
|
|
32
|
+
topic: string()
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const handle = await client.run(template, {
|
|
37
|
+
variables: { topic: "test-first SDK design" }
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const result = await handle.wait();
|
|
41
|
+
console.log(result.status, await handle.usage());
|
|
42
|
+
await handle.downloadOutputs("./outputs");
|
|
43
|
+
await handle.cleanup();
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Test commands
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
npm run test:unit
|
|
50
|
+
npm run test:integration:components
|
|
51
|
+
npm run test:integration:api
|
|
52
|
+
npm run test:e2e:live
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Live e2e tests require `.env.local` and `RUN_LIVE_ANTPATH_TESTS=1`.
|
|
56
|
+
|
|
57
|
+
## Guides
|
|
58
|
+
|
|
59
|
+
- [Quickstart](docs/quickstart.md)
|
|
60
|
+
- [Templates](docs/templates.md)
|
|
61
|
+
- [Credentials](docs/credentials.md)
|
|
62
|
+
- [MCP](docs/mcp.md)
|
|
63
|
+
- [Skills](docs/skills.md)
|
|
64
|
+
- [Outputs](docs/outputs.md)
|
|
65
|
+
- [Cleanup](docs/cleanup.md)
|
|
66
|
+
- [Testing](docs/testing.md)
|
|
67
|
+
- [Release](docs/release.md)
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ManagedAgentProvider } from "./providers/types.js";
|
|
2
|
+
import type { TemplateDefinition } from "./template/types.js";
|
|
3
|
+
import type { CleanupPolicy, RunHandle, RunOptions } from "./types.js";
|
|
4
|
+
import { SecretString } from "./utils/secrets.js";
|
|
5
|
+
export interface AntpathClientOptions {
|
|
6
|
+
anthropicApiKey?: string | SecretString;
|
|
7
|
+
provider?: ManagedAgentProvider;
|
|
8
|
+
cleanupPolicy?: CleanupPolicy;
|
|
9
|
+
}
|
|
10
|
+
export declare class AntpathClient {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(options: AntpathClientOptions);
|
|
13
|
+
run(template: TemplateDefinition, options?: RunOptions): Promise<RunHandle>;
|
|
14
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { validateCredentials } from "./credentials.js";
|
|
2
|
+
import { AnthropicManagedAgentsProvider } from "./providers/anthropic/provider.js";
|
|
3
|
+
import { RunController } from "./run/controller.js";
|
|
4
|
+
import { compileTemplate } from "./template/compiler.js";
|
|
5
|
+
export class AntpathClient {
|
|
6
|
+
#provider;
|
|
7
|
+
#cleanupPolicy;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
if (options.provider) {
|
|
10
|
+
this.#provider = options.provider;
|
|
11
|
+
}
|
|
12
|
+
else if (options.anthropicApiKey) {
|
|
13
|
+
this.#provider = new AnthropicManagedAgentsProvider({ apiKey: options.anthropicApiKey });
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
throw new Error("AntpathClient requires anthropicApiKey or provider");
|
|
17
|
+
}
|
|
18
|
+
this.#cleanupPolicy = options.cleanupPolicy ?? "manual";
|
|
19
|
+
}
|
|
20
|
+
async run(template, options = {}) {
|
|
21
|
+
const resolved = compileTemplate(template, options.variables ?? {});
|
|
22
|
+
validateCredentials(resolved, options.credentials ?? {});
|
|
23
|
+
const controller = new RunController({
|
|
24
|
+
provider: this.#provider,
|
|
25
|
+
template: resolved,
|
|
26
|
+
credentials: options.credentials ?? {},
|
|
27
|
+
cleanupPolicy: options.cleanupPolicy ?? this.#cleanupPolicy,
|
|
28
|
+
timeoutMs: options.timeoutMs,
|
|
29
|
+
signal: options.signal,
|
|
30
|
+
logger: options.logger
|
|
31
|
+
});
|
|
32
|
+
await controller.start();
|
|
33
|
+
return controller;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA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M;SACvB,CAAC,CAAC;QACH,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CredentialValidationError } from "./errors.js";
|
|
2
|
+
export function validateCredentials(template, credentials = {}) {
|
|
3
|
+
for (const [key, requirement] of Object.entries(template.credentialRequirements)) {
|
|
4
|
+
const credential = credentials[key];
|
|
5
|
+
if (!credential) {
|
|
6
|
+
throw new CredentialValidationError(`Missing credential for MCP server '${key}'`);
|
|
7
|
+
}
|
|
8
|
+
if (credential.type !== requirement.type) {
|
|
9
|
+
throw new CredentialValidationError(`Credential for MCP server '${key}' must be '${requirement.type}'`);
|
|
10
|
+
}
|
|
11
|
+
validateCredentialValue(key, credential);
|
|
12
|
+
}
|
|
13
|
+
for (const key of Object.keys(credentials)) {
|
|
14
|
+
if (!template.credentialRequirements[key]) {
|
|
15
|
+
throw new CredentialValidationError(`Credential provided for unknown MCP server '${key}'`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function validateCredentialValue(key, credential) {
|
|
20
|
+
if (credential.type === "static_bearer" && !credential.token) {
|
|
21
|
+
throw new CredentialValidationError(`Static bearer credential for '${key}' requires token`);
|
|
22
|
+
}
|
|
23
|
+
if (credential.type === "oauth_access_token" && !credential.accessToken) {
|
|
24
|
+
throw new CredentialValidationError(`OAuth credential for '${key}' requires accessToken`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +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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R" | "RUN_STATE_ERROR" | "CLEANUP_ERROR";
|
|
2
|
+
export declare class AntpathError extends Error {
|
|
3
|
+
readonly code: AntpathErrorCode;
|
|
4
|
+
readonly details?: unknown;
|
|
5
|
+
constructor(code: AntpathErrorCode, message: string, details?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare class TemplateValidationError extends AntpathError {
|
|
8
|
+
constructor(message: string, details?: unknown);
|
|
9
|
+
}
|
|
10
|
+
export declare class CredentialValidationError extends AntpathError {
|
|
11
|
+
constructor(message: string, details?: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare class ProviderError extends AntpathError {
|
|
14
|
+
readonly status: number | undefined;
|
|
15
|
+
constructor(message: string, options?: {
|
|
16
|
+
status?: number;
|
|
17
|
+
details?: unknown;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export declare class RunStateError extends AntpathError {
|
|
21
|
+
constructor(message: string, details?: unknown);
|
|
22
|
+
}
|
|
23
|
+
export declare class CleanupError extends AntpathError {
|
|
24
|
+
constructor(message: string, details?: unknown);
|
|
25
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { redactSecrets } from "./utils/secrets.js";
|
|
2
|
+
export class AntpathError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
details;
|
|
5
|
+
constructor(code, message, details) {
|
|
6
|
+
super(redactSecrets(message));
|
|
7
|
+
this.name = this.constructor.name;
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.details = details === undefined ? undefined : redactSecrets(details);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class TemplateValidationError extends AntpathError {
|
|
13
|
+
constructor(message, details) {
|
|
14
|
+
super("TEMPLATE_INVALID", message, details);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class CredentialValidationError extends AntpathError {
|
|
18
|
+
constructor(message, details) {
|
|
19
|
+
super("CREDENTIAL_INVALID", message, details);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export class ProviderError extends AntpathError {
|
|
23
|
+
status;
|
|
24
|
+
constructor(message, options = {}) {
|
|
25
|
+
super("PROVIDER_ERROR", message, options.details);
|
|
26
|
+
this.status = options.status;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class RunStateError extends AntpathError {
|
|
30
|
+
constructor(message, details) {
|
|
31
|
+
super("RUN_STATE_ERROR", message, details);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export class CleanupError extends AntpathError {
|
|
35
|
+
constructor(message, details) {
|
|
36
|
+
super("CLEANUP_ERROR", message, details);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASnD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,CAAmB;IACvB,OAAO,CAAW;IAE3B,YAAY,IAAsB,EAAE,OAAe,EAAE,OAAiB;QACpE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IACvD,YAAY,OAAe,EAAE,OAAiB;QAC5C,KAAK,CAAC,kBAAkB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,YAAY;IACzD,YAAY,OAAe,EAAE,OAAiB;QAC5C,KAAK,CAAC,oBAAoB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,YAAY;IACpC,MAAM,CAAqB;IAEpC,YAAY,OAAe,EAAE,UAAkD,EAAE;QAC/E,KAAK,CAAC,gBAAgB,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C,YAAY,OAAe,EAAE,OAAiB;QAC5C,KAAK,CAAC,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C,YAAY,OAAe,EAAE,OAAiB;QAC5C,KAAK,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DownloadOutputsOptions, DownloadOutputsResult } from "../types.js";
|
|
2
|
+
import type { ManagedAgentProvider } from "../providers/types.js";
|
|
3
|
+
export declare function downloadOutputs(provider: ManagedAgentProvider, sessionId: string, options: DownloadOutputsOptions): Promise<DownloadOutputsResult>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { writeFileSafe } from "../utils/paths.js";
|
|
2
|
+
const DEFAULT_MAX_FILES = 100;
|
|
3
|
+
const DEFAULT_MAX_BYTES = 250 * 1024 * 1024;
|
|
4
|
+
export async function downloadOutputs(provider, sessionId, options) {
|
|
5
|
+
const files = filterFiles(await provider.listFiles(sessionId), options);
|
|
6
|
+
if (files.length > (options.maxFiles ?? DEFAULT_MAX_FILES)) {
|
|
7
|
+
throw new Error(`Refusing to download ${files.length} files; maxFiles exceeded`);
|
|
8
|
+
}
|
|
9
|
+
const totalBytes = files.reduce((sum, file) => sum + (file.sizeBytes ?? 0), 0);
|
|
10
|
+
if (totalBytes > (options.maxTotalBytes ?? DEFAULT_MAX_BYTES)) {
|
|
11
|
+
throw new Error(`Refusing to download ${totalBytes} bytes; maxTotalBytes exceeded`);
|
|
12
|
+
}
|
|
13
|
+
const manifest = { directory: options.directory, files: [] };
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
const content = await provider.downloadFile(file.id);
|
|
16
|
+
const localPath = await writeFileSafe(options.directory, file.filename, content);
|
|
17
|
+
const entry = {
|
|
18
|
+
providerFileId: file.id,
|
|
19
|
+
filename: file.filename,
|
|
20
|
+
localPath
|
|
21
|
+
};
|
|
22
|
+
manifest.files.push(file.sizeBytes === undefined ? entry : { ...entry, sizeBytes: file.sizeBytes });
|
|
23
|
+
}
|
|
24
|
+
return { manifest };
|
|
25
|
+
}
|
|
26
|
+
function filterFiles(files, options) {
|
|
27
|
+
if (!options.include) {
|
|
28
|
+
return files;
|
|
29
|
+
}
|
|
30
|
+
if (options.include instanceof RegExp) {
|
|
31
|
+
return files.filter((file) => options.include instanceof RegExp && options.include.test(file.filename));
|
|
32
|
+
}
|
|
33
|
+
return files.filter(options.include);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=downloader.js.map
|
|
@@ -0,0 +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,CAA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AAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,YAAY,MAAM,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,YAAY,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
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AntpathClient } from "./client.js";
|
|
2
|
+
export { compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string, type TemplateDefinition, type TemplateVariableDefinition } from "./template/index.js";
|
|
3
|
+
export type { CleanupPolicy, CredentialInput, DownloadOutputsOptions, DownloadOutputsResult, Logger, OutputManifest, RunEvent, RunHandle, RunOptions, RunResult, RunStatus, UsageSummary } from "./types.js";
|
|
4
|
+
export { SecretString, redactSecrets } from "./utils/secrets.js";
|
|
5
|
+
export { AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./errors.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AntpathClient } from "./client.js";
|
|
2
|
+
export { compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string } from "./template/index.js";
|
|
3
|
+
export { SecretString, redactSecrets } from "./utils/secrets.js";
|
|
4
|
+
export { AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./errors.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,EAGP,MAAM,qBAAqB,CAAC;AAe7B,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,30 @@
|
|
|
1
|
+
import type { CredentialInput, ProviderEvent, ProviderFile, ProviderResourceIds, UsageSummary } from "../../types.js";
|
|
2
|
+
import { SecretString } from "../../utils/secrets.js";
|
|
3
|
+
import type { ResolvedTemplate } from "../../template/compiler.js";
|
|
4
|
+
import type { CleanupResult } from "../../types.js";
|
|
5
|
+
import type { CreatedCredential, ManagedAgentProvider, ProviderSkillRef, SessionResourceInput, UploadFileInput } from "../types.js";
|
|
6
|
+
export interface AnthropicManagedAgentsProviderOptions {
|
|
7
|
+
apiKey: string | SecretString;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
fetch?: typeof fetch;
|
|
10
|
+
}
|
|
11
|
+
export declare class AnthropicManagedAgentsProvider implements ManagedAgentProvider {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(options: AnthropicManagedAgentsProviderOptions);
|
|
14
|
+
createEnvironment(template: ResolvedTemplate): Promise<string>;
|
|
15
|
+
uploadFile(input: UploadFileInput): Promise<string>;
|
|
16
|
+
createAgent(template: ResolvedTemplate, providerSkillRefs: ProviderSkillRef[]): Promise<string>;
|
|
17
|
+
createVault(displayName: string, metadata?: Record<string, string>): Promise<string>;
|
|
18
|
+
createCredential(vaultId: string, serverUrl: string, credential: CredentialInput): Promise<CreatedCredential>;
|
|
19
|
+
createSession(agentId: string, environmentId: string, vaultIds: string[], resources: SessionResourceInput[]): Promise<string>;
|
|
20
|
+
sendUserMessage(sessionId: string, message: string): Promise<void>;
|
|
21
|
+
streamEvents(sessionId: string, signal?: AbortSignal): AsyncIterable<ProviderEvent>;
|
|
22
|
+
getSession(sessionId: string): Promise<{
|
|
23
|
+
status?: string | undefined;
|
|
24
|
+
usage?: UsageSummary | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
listFiles(sessionId: string): Promise<ProviderFile[]>;
|
|
27
|
+
downloadFile(fileId: string): Promise<Uint8Array>;
|
|
28
|
+
terminateSession(sessionId: string): Promise<void>;
|
|
29
|
+
cleanup(ids: ProviderResourceIds, policy?: string): Promise<CleanupResult>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { ProviderError } from "../../errors.js";
|
|
2
|
+
import { redactSecrets, SecretString } from "../../utils/secrets.js";
|
|
3
|
+
const DEFAULT_BASE_URL = "https://api.anthropic.com";
|
|
4
|
+
const ANTHROPIC_VERSION = "2023-06-01";
|
|
5
|
+
const BETA_HEADER = "managed-agents-2026-04-01,files-api-2025-04-14,skills-2025-10-02";
|
|
6
|
+
export class AnthropicManagedAgentsProvider {
|
|
7
|
+
#apiKey;
|
|
8
|
+
#baseUrl;
|
|
9
|
+
#fetch;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.#apiKey = options.apiKey instanceof SecretString ? options.apiKey : new SecretString(options.apiKey, "anthropicApiKey");
|
|
12
|
+
this.#baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
|
|
13
|
+
this.#fetch = options.fetch ?? fetch;
|
|
14
|
+
}
|
|
15
|
+
async createEnvironment(template) {
|
|
16
|
+
const body = {
|
|
17
|
+
name: `${template.name}-${template.hash.slice(0, 8)}`,
|
|
18
|
+
config: {
|
|
19
|
+
type: "cloud",
|
|
20
|
+
networking: mapNetworking(template),
|
|
21
|
+
packages: template.environment.packages ? { type: "packages", ...template.environment.packages } : undefined
|
|
22
|
+
},
|
|
23
|
+
metadata: template.metadata
|
|
24
|
+
};
|
|
25
|
+
const response = await this.#json("/v1/environments", { method: "POST", body });
|
|
26
|
+
return response.id;
|
|
27
|
+
}
|
|
28
|
+
async uploadFile(input) {
|
|
29
|
+
const form = new FormData();
|
|
30
|
+
form.append("file", new Blob([input.data], { type: input.mimeType ?? "application/octet-stream" }), input.filename);
|
|
31
|
+
const response = await this.#request("/v1/files", {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: form
|
|
34
|
+
});
|
|
35
|
+
return response.id;
|
|
36
|
+
}
|
|
37
|
+
async createAgent(template, providerSkillRefs) {
|
|
38
|
+
const tools = [
|
|
39
|
+
{
|
|
40
|
+
type: "agent_toolset_20260401",
|
|
41
|
+
default_config: {
|
|
42
|
+
enabled: true,
|
|
43
|
+
permission_policy: { type: "always_allow" }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
...template.mcpServers.map((server) => ({
|
|
47
|
+
type: "mcp_toolset",
|
|
48
|
+
mcp_server_name: server.name,
|
|
49
|
+
default_config: {
|
|
50
|
+
enabled: server.tools?.allow ? false : true,
|
|
51
|
+
permission_policy: { type: "always_allow" }
|
|
52
|
+
},
|
|
53
|
+
configs: [
|
|
54
|
+
...(server.tools?.allow ?? []).map((name) => ({
|
|
55
|
+
name,
|
|
56
|
+
enabled: true,
|
|
57
|
+
permission_policy: { type: "always_allow" }
|
|
58
|
+
})),
|
|
59
|
+
...(server.tools?.deny ?? []).map((name) => ({
|
|
60
|
+
name,
|
|
61
|
+
enabled: false,
|
|
62
|
+
permission_policy: { type: "always_allow" }
|
|
63
|
+
}))
|
|
64
|
+
]
|
|
65
|
+
}))
|
|
66
|
+
];
|
|
67
|
+
const response = await this.#json("/v1/agents", {
|
|
68
|
+
method: "POST",
|
|
69
|
+
body: {
|
|
70
|
+
name: `${template.name}-${template.hash.slice(0, 8)}`,
|
|
71
|
+
model: template.model,
|
|
72
|
+
system: template.system,
|
|
73
|
+
mcp_servers: template.mcpServers.map((server) => ({ type: "url", name: server.name, url: server.url })),
|
|
74
|
+
skills: providerSkillRefs,
|
|
75
|
+
tools,
|
|
76
|
+
metadata: template.metadata
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return response.id;
|
|
80
|
+
}
|
|
81
|
+
async createVault(displayName, metadata) {
|
|
82
|
+
const response = await this.#json("/v1/vaults", {
|
|
83
|
+
method: "POST",
|
|
84
|
+
body: { display_name: displayName, metadata }
|
|
85
|
+
});
|
|
86
|
+
return response.id;
|
|
87
|
+
}
|
|
88
|
+
async createCredential(vaultId, serverUrl, credential) {
|
|
89
|
+
const auth = credential.type === "static_bearer"
|
|
90
|
+
? { type: "static_bearer", mcp_server_url: serverUrl, token: credential.token }
|
|
91
|
+
: { type: "mcp_oauth", mcp_server_url: serverUrl, access_token: credential.accessToken, expires_at: credential.expiresAt };
|
|
92
|
+
const response = await this.#json(`/v1/vaults/${vaultId}/credentials`, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
body: { auth }
|
|
95
|
+
});
|
|
96
|
+
return { id: response.id };
|
|
97
|
+
}
|
|
98
|
+
async createSession(agentId, environmentId, vaultIds, resources) {
|
|
99
|
+
const response = await this.#json("/v1/sessions", {
|
|
100
|
+
method: "POST",
|
|
101
|
+
body: {
|
|
102
|
+
agent: agentId,
|
|
103
|
+
environment_id: environmentId,
|
|
104
|
+
vault_ids: vaultIds,
|
|
105
|
+
resources: resources.map((resource) => ({
|
|
106
|
+
type: "file",
|
|
107
|
+
file_id: resource.fileId,
|
|
108
|
+
mount_path: resource.mountPath
|
|
109
|
+
}))
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return response.id;
|
|
113
|
+
}
|
|
114
|
+
async sendUserMessage(sessionId, message) {
|
|
115
|
+
await this.#json(`/v1/sessions/${sessionId}/events?beta=true`, {
|
|
116
|
+
method: "POST",
|
|
117
|
+
body: {
|
|
118
|
+
events: [
|
|
119
|
+
{
|
|
120
|
+
type: "user.message",
|
|
121
|
+
content: [{ type: "text", text: message }]
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
async *streamEvents(sessionId, signal) {
|
|
128
|
+
const init = {
|
|
129
|
+
method: "GET",
|
|
130
|
+
headers: { Accept: "text/event-stream" }
|
|
131
|
+
};
|
|
132
|
+
if (signal)
|
|
133
|
+
init.signal = signal;
|
|
134
|
+
const response = await this.#raw(`/v1/sessions/${sessionId}/events/stream?beta=true`, init);
|
|
135
|
+
if (!response.body) {
|
|
136
|
+
throw new ProviderError("Provider returned an empty event stream");
|
|
137
|
+
}
|
|
138
|
+
const reader = response.body.getReader();
|
|
139
|
+
const decoder = new TextDecoder();
|
|
140
|
+
let buffer = "";
|
|
141
|
+
let data = "";
|
|
142
|
+
while (true) {
|
|
143
|
+
const { done, value } = await reader.read();
|
|
144
|
+
if (done) {
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
buffer += decoder.decode(value, { stream: true });
|
|
148
|
+
const lines = buffer.split(/\r?\n/);
|
|
149
|
+
buffer = lines.pop() ?? "";
|
|
150
|
+
for (const line of lines) {
|
|
151
|
+
if (line.startsWith("data:")) {
|
|
152
|
+
data += `${line.slice(5).trim()}\n`;
|
|
153
|
+
}
|
|
154
|
+
if (line === "" && data.trim()) {
|
|
155
|
+
yield JSON.parse(data);
|
|
156
|
+
data = "";
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async getSession(sessionId) {
|
|
162
|
+
const session = await this.#json(`/v1/sessions/${sessionId}`, { method: "GET" });
|
|
163
|
+
const output = {};
|
|
164
|
+
if (typeof session.status === "string")
|
|
165
|
+
output.status = session.status;
|
|
166
|
+
output.usage = mapUsage(session.usage);
|
|
167
|
+
return output;
|
|
168
|
+
}
|
|
169
|
+
async listFiles(sessionId) {
|
|
170
|
+
const response = await this.#json(`/v1/files?scope_id=${encodeURIComponent(sessionId)}`, { method: "GET" });
|
|
171
|
+
return (response.data ?? []).map((file) => {
|
|
172
|
+
const mapped = {
|
|
173
|
+
id: String(file.id),
|
|
174
|
+
filename: String(file.filename ?? file.id)
|
|
175
|
+
};
|
|
176
|
+
if (typeof file.size_bytes === "number")
|
|
177
|
+
mapped.sizeBytes = file.size_bytes;
|
|
178
|
+
if (typeof file.downloadable === "boolean")
|
|
179
|
+
mapped.downloadable = file.downloadable;
|
|
180
|
+
return mapped;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
async downloadFile(fileId) {
|
|
184
|
+
const response = await this.#raw(`/v1/files/${fileId}/content`, { method: "GET" });
|
|
185
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
186
|
+
}
|
|
187
|
+
async terminateSession(sessionId) {
|
|
188
|
+
await this.#json(`/v1/sessions/${sessionId}/events`, {
|
|
189
|
+
method: "POST",
|
|
190
|
+
body: { events: [{ type: "user.interrupt" }] }
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
async cleanup(ids, policy = "manual") {
|
|
194
|
+
if (policy === "manual") {
|
|
195
|
+
return { state: "pending", operations: [{ operation: "manual_cleanup", status: "skipped" }] };
|
|
196
|
+
}
|
|
197
|
+
const operations = [];
|
|
198
|
+
const attempt = async (operation, path, method = "DELETE") => {
|
|
199
|
+
try {
|
|
200
|
+
await this.#json(path, { method });
|
|
201
|
+
operations.push({ operation, status: "success" });
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
operations.push({ operation, status: "failed", error: error instanceof Error ? error.message : String(error) });
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
for (const credentialId of ids.credentialIds) {
|
|
208
|
+
if (ids.vaultId) {
|
|
209
|
+
await attempt("delete_credential", `/v1/vaults/${ids.vaultId}/credentials/${credentialId}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (ids.vaultId)
|
|
213
|
+
await attempt("delete_vault", `/v1/vaults/${ids.vaultId}`);
|
|
214
|
+
if (policy !== "credentials-only" && ids.sessionId)
|
|
215
|
+
await attempt("delete_session", `/v1/sessions/${ids.sessionId}`);
|
|
216
|
+
if (policy !== "credentials-only" && ids.agentId)
|
|
217
|
+
await attempt("archive_agent", `/v1/agents/${ids.agentId}/archive`, "POST");
|
|
218
|
+
if (policy !== "credentials-only" && ids.environmentId)
|
|
219
|
+
await attempt("archive_environment", `/v1/environments/${ids.environmentId}/archive`, "POST");
|
|
220
|
+
return {
|
|
221
|
+
operations,
|
|
222
|
+
state: operations.some((operation) => operation.status === "failed") ? "partial" : "cleaned_up"
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async #json(path, init) {
|
|
226
|
+
const requestInit = {
|
|
227
|
+
method: init.method,
|
|
228
|
+
headers: {
|
|
229
|
+
"content-type": "application/json",
|
|
230
|
+
...init.headers
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
if (init.body !== undefined)
|
|
234
|
+
requestInit.body = JSON.stringify(init.body);
|
|
235
|
+
if (init.signal)
|
|
236
|
+
requestInit.signal = init.signal;
|
|
237
|
+
return this.#request(path, requestInit);
|
|
238
|
+
}
|
|
239
|
+
async #request(path, init) {
|
|
240
|
+
const response = await this.#raw(path, init);
|
|
241
|
+
if (response.status === 204) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
return await response.json();
|
|
245
|
+
}
|
|
246
|
+
async #raw(path, init) {
|
|
247
|
+
const response = await this.#fetch(`${this.#baseUrl}${path}`, {
|
|
248
|
+
...init,
|
|
249
|
+
headers: {
|
|
250
|
+
"x-api-key": this.#apiKey.unwrap(),
|
|
251
|
+
"anthropic-version": ANTHROPIC_VERSION,
|
|
252
|
+
"anthropic-beta": BETA_HEADER,
|
|
253
|
+
...init.headers
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
if (!response.ok) {
|
|
257
|
+
const body = await response.text().catch(() => "");
|
|
258
|
+
throw new ProviderError(`Anthropic API request failed: ${response.status} ${redactSecrets(body)}`, { status: response.status });
|
|
259
|
+
}
|
|
260
|
+
return response;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function mapNetworking(template) {
|
|
264
|
+
const network = template.environment.network ?? "restricted";
|
|
265
|
+
if (network === "unrestricted") {
|
|
266
|
+
return { type: "unrestricted" };
|
|
267
|
+
}
|
|
268
|
+
if (network === "restricted") {
|
|
269
|
+
return { type: "limited", allow_mcp_servers: true, allow_package_managers: false, allowed_hosts: [] };
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
type: "limited",
|
|
273
|
+
allow_mcp_servers: network.allowMcpServers ?? true,
|
|
274
|
+
allow_package_managers: network.allowPackageManagers ?? false,
|
|
275
|
+
allowed_hosts: network.allowedHosts ?? []
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function mapUsage(input) {
|
|
279
|
+
if (!input || typeof input !== "object") {
|
|
280
|
+
return undefined;
|
|
281
|
+
}
|
|
282
|
+
const usage = input;
|
|
283
|
+
const inputTokens = typeof usage.input_tokens === "number" ? usage.input_tokens : undefined;
|
|
284
|
+
const outputTokens = typeof usage.output_tokens === "number" ? usage.output_tokens : undefined;
|
|
285
|
+
const cacheReadInputTokens = typeof usage.cache_read_input_tokens === "number" ? usage.cache_read_input_tokens : undefined;
|
|
286
|
+
const cacheCreationInputTokens = typeof usage.cache_creation_input_tokens === "number" ? usage.cache_creation_input_tokens : undefined;
|
|
287
|
+
const summary = {
|
|
288
|
+
totalTokens: [inputTokens, outputTokens, cacheReadInputTokens, cacheCreationInputTokens]
|
|
289
|
+
.filter((value) => typeof value === "number")
|
|
290
|
+
.reduce((sum, value) => sum + value, 0)
|
|
291
|
+
};
|
|
292
|
+
if (inputTokens !== undefined)
|
|
293
|
+
summary.inputTokens = inputTokens;
|
|
294
|
+
if (outputTokens !== undefined)
|
|
295
|
+
summary.outputTokens = outputTokens;
|
|
296
|
+
if (cacheReadInputTokens !== undefined)
|
|
297
|
+
summary.cacheReadInputTokens = cacheReadInputTokens;
|
|
298
|
+
if (cacheCreationInputTokens !== undefined)
|
|
299
|
+
summary.cacheCreationInputTokens = cacheCreationInputTokens;
|
|
300
|
+
return summary;
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/providers/anthropic/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKrE,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,WAAW,GAAG,kEAAkE,CAAC;AAQvF,MAAM,OAAO,8BAA8B;IAChC,OAAO,CAAe;IACtB,QAAQ,CAAS;IACjB,MAAM,CAAe;IAE9B,YAAY,OAA8C;QACxD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,YAAY,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QAC7H,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,QAA0B;QAChD,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;YACrD,MAAM,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC;gBACnC,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,EA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