antpath 0.2.1 → 0.3.1

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.
Files changed (105) hide show
  1. package/README.md +55 -40
  2. package/dist/_shared/cleanup-policy.d.ts +8 -0
  3. package/dist/_shared/cleanup-policy.js +24 -0
  4. package/dist/_shared/config.d.ts +47 -0
  5. package/dist/_shared/config.js +150 -0
  6. package/dist/_shared/dev-stack.d.ts +19 -0
  7. package/dist/_shared/dev-stack.js +105 -0
  8. package/dist/_shared/errors.d.ts +8 -0
  9. package/dist/_shared/errors.js +18 -0
  10. package/dist/_shared/http.d.ts +20 -0
  11. package/dist/_shared/http.js +94 -0
  12. package/dist/_shared/index.d.ts +17 -0
  13. package/dist/_shared/index.js +20 -0
  14. package/dist/{providers → _shared}/known-events.d.ts +10 -10
  15. package/dist/{providers → _shared}/known-events.js +9 -9
  16. package/dist/_shared/operations.d.ts +19 -0
  17. package/dist/_shared/operations.js +42 -0
  18. package/dist/_shared/proxy-protocol.d.ts +148 -0
  19. package/dist/_shared/proxy-protocol.js +113 -0
  20. package/dist/_shared/proxy-validation.d.ts +19 -0
  21. package/dist/_shared/proxy-validation.js +51 -0
  22. package/dist/_shared/runtime-types.d.ts +90 -0
  23. package/dist/_shared/runtime-types.js +2 -0
  24. package/dist/{errors.d.ts → _shared/sdk-errors.d.ts} +10 -1
  25. package/dist/{errors.js → _shared/sdk-errors.js} +15 -2
  26. package/dist/{utils/secrets.js → _shared/sdk-secrets.js} +1 -1
  27. package/dist/_shared/secrets.d.ts +7 -0
  28. package/dist/_shared/secrets.js +20 -0
  29. package/dist/_shared/status.d.ts +8 -0
  30. package/dist/_shared/status.js +46 -0
  31. package/dist/_shared/submission.d.ts +142 -0
  32. package/dist/_shared/submission.js +681 -0
  33. package/dist/{template → _shared/template}/compiler.js +3 -3
  34. package/dist/{template/index.d.ts → _shared/template/helpers.d.ts} +0 -2
  35. package/dist/{template/index.js → _shared/template/helpers.js} +1 -2
  36. package/dist/_shared/template/index.d.ts +4 -0
  37. package/dist/_shared/template/index.js +4 -0
  38. package/dist/_shared/template/mapper.d.ts +11 -0
  39. package/dist/_shared/template/mapper.js +70 -0
  40. package/dist/cli.mjs +1234 -64
  41. package/dist/cli.mjs.sha256 +1 -1
  42. package/dist/client.d.ts +93 -8
  43. package/dist/client.js +192 -30
  44. package/dist/client.js.map +1 -1
  45. package/dist/index.d.ts +16 -10
  46. package/dist/index.js +16 -7
  47. package/dist/index.js.map +1 -1
  48. package/docs/cleanup.md +7 -4
  49. package/docs/credentials.md +12 -12
  50. package/docs/events.md +19 -82
  51. package/docs/outputs.md +15 -4
  52. package/docs/quickstart.md +42 -5
  53. package/docs/skills.md +1 -1
  54. package/docs/templates.md +1 -1
  55. package/docs/testing.md +11 -8
  56. package/examples/mcp-static-bearer.ts +14 -9
  57. package/examples/quickstart.ts +8 -6
  58. package/package.json +4 -5
  59. package/references/implementation-plan.md +1 -1
  60. package/dist/credentials.d.ts +0 -3
  61. package/dist/credentials.js +0 -56
  62. package/dist/credentials.js.map +0 -1
  63. package/dist/errors.js.map +0 -1
  64. package/dist/files/downloader.d.ts +0 -3
  65. package/dist/files/downloader.js +0 -43
  66. package/dist/files/downloader.js.map +0 -1
  67. package/dist/platform/client.d.ts +0 -204
  68. package/dist/platform/client.js +0 -203
  69. package/dist/platform/client.js.map +0 -1
  70. package/dist/platform/index.d.ts +0 -1
  71. package/dist/platform/index.js +0 -2
  72. package/dist/platform/index.js.map +0 -1
  73. package/dist/providers/anthropic/provider.d.ts +0 -36
  74. package/dist/providers/anthropic/provider.js +0 -380
  75. package/dist/providers/anthropic/provider.js.map +0 -1
  76. package/dist/providers/known-events.js.map +0 -1
  77. package/dist/providers/types.d.ts +0 -42
  78. package/dist/providers/types.js.map +0 -1
  79. package/dist/run/controller.d.ts +0 -30
  80. package/dist/run/controller.js +0 -314
  81. package/dist/run/controller.js.map +0 -1
  82. package/dist/skills/packager.d.ts +0 -11
  83. package/dist/skills/packager.js +0 -76
  84. package/dist/skills/packager.js.map +0 -1
  85. package/dist/template/compiler.js.map +0 -1
  86. package/dist/template/index.js.map +0 -1
  87. package/dist/template/types.js +0 -2
  88. package/dist/template/types.js.map +0 -1
  89. package/dist/types.d.ts +0 -149
  90. package/dist/types.js +0 -2
  91. package/dist/types.js.map +0 -1
  92. package/dist/utils/events.d.ts +0 -27
  93. package/dist/utils/events.js +0 -120
  94. package/dist/utils/events.js.map +0 -1
  95. package/dist/utils/paths.d.ts +0 -3
  96. package/dist/utils/paths.js +0 -27
  97. package/dist/utils/paths.js.map +0 -1
  98. package/dist/utils/secrets.js.map +0 -1
  99. package/dist/utils/stable.js.map +0 -1
  100. /package/dist/{utils/secrets.d.ts → _shared/sdk-secrets.d.ts} +0 -0
  101. /package/dist/{utils → _shared}/stable.d.ts +0 -0
  102. /package/dist/{utils → _shared}/stable.js +0 -0
  103. /package/dist/{template → _shared/template}/compiler.d.ts +0 -0
  104. /package/dist/{template → _shared/template}/types.d.ts +0 -0
  105. /package/dist/{providers → _shared/template}/types.js +0 -0
@@ -1,204 +0,0 @@
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 {};
@@ -1,203 +0,0 @@
1
- export class PlatformApiError extends Error {
2
- status;
3
- details;
4
- constructor(status, message, details) {
5
- super(message);
6
- this.name = "PlatformApiError";
7
- this.status = status;
8
- this.details = details;
9
- }
10
- }
11
- export class AntpathPlatformClient {
12
- baseUrl;
13
- apiToken;
14
- fetchImpl;
15
- defaultSecrets;
16
- constructor(options) {
17
- const record = options;
18
- if ("anthropicApiKey" in record || "providerApiKey" in record) {
19
- throw new Error("Platform client does not accept provider keys at the client root — pass them inside `defaultSecrets.anthropic` or per-call `secrets.anthropic`");
20
- }
21
- if (!options.apiToken) {
22
- throw new Error("apiToken is required");
23
- }
24
- this.baseUrl = new URL(options.baseUrl.endsWith("/") ? options.baseUrl : `${options.baseUrl}/`);
25
- this.apiToken = options.apiToken;
26
- this.fetchImpl = options.fetch ?? fetch;
27
- if (options.defaultSecrets) {
28
- this.defaultSecrets = options.defaultSecrets;
29
- emitDefaultSecretsDeprecationWarning();
30
- }
31
- }
32
- async submitRun(request) {
33
- const secrets = request.secrets ?? this.defaultSecrets;
34
- if (!secrets) {
35
- throw new Error("submitRun requires `secrets` either per-call or via `defaultSecrets` on the client");
36
- }
37
- if (request.proxyEndpoints && request.proxyEndpoints.length > 0) {
38
- // Catch the most common mistake at submission time so the error
39
- // doesn't only surface deep inside the BFF parser. The BFF still
40
- // performs the same cross-validation authoritatively.
41
- validateProxyAuth(request.proxyEndpoints, secrets.proxyEndpointAuth);
42
- }
43
- const payload = { ...request, secrets };
44
- return this.request("/api/runs", {
45
- method: "POST",
46
- body: JSON.stringify(payload)
47
- });
48
- }
49
- async getRun(workspaceId, runId) {
50
- const response = await this.request(`/api/runs/${encodeURIComponent(runId)}`, {}, { workspaceId });
51
- return hasRun(response) ? response.run : response;
52
- }
53
- async listRunEvents(workspaceId, runId) {
54
- const response = await this.request(`/api/runs/${encodeURIComponent(runId)}/events`, {}, { workspaceId });
55
- return response.events;
56
- }
57
- async listOutputs(workspaceId, runId) {
58
- const response = await this.request(`/api/runs/${encodeURIComponent(runId)}/outputs`, {}, { workspaceId });
59
- return response.outputs;
60
- }
61
- async createOutputLink(workspaceId, runId, outputId) {
62
- return this.request(`/api/runs/${encodeURIComponent(runId)}/outputs/${encodeURIComponent(outputId)}/link`, { method: "POST" }, { workspaceId });
63
- }
64
- async cancelRun(workspaceId, runId) {
65
- await this.request(`/api/runs/${encodeURIComponent(runId)}/cancel`, { method: "POST" }, { workspaceId });
66
- }
67
- async deleteRun(workspaceId, runId) {
68
- await this.request(`/api/runs/${encodeURIComponent(runId)}`, { method: "DELETE" }, { workspaceId });
69
- }
70
- async request(path, init = {}, query = {}) {
71
- const url = new URL(path.replace(/^\//, ""), this.baseUrl);
72
- for (const [key, value] of Object.entries(query)) {
73
- url.searchParams.set(key, value);
74
- }
75
- const headers = {
76
- accept: "application/json",
77
- ...(init.body ? { "content-type": "application/json" } : {}),
78
- authorization: `Bearer ${this.apiToken}`,
79
- ...normalizeHeaders(init.headers)
80
- };
81
- const response = await this.fetchImpl(url, { ...init, headers });
82
- const body = await readJson(response);
83
- if (!response.ok) {
84
- throw new PlatformApiError(response.status, extractErrorMessage(body), body);
85
- }
86
- return body;
87
- }
88
- }
89
- function normalizeHeaders(headers) {
90
- if (!headers) {
91
- return {};
92
- }
93
- if (headers instanceof Headers) {
94
- return Object.fromEntries(headers.entries());
95
- }
96
- if (Array.isArray(headers)) {
97
- return Object.fromEntries(headers);
98
- }
99
- return headers;
100
- }
101
- async function readJson(response) {
102
- const text = await response.text();
103
- if (text.length === 0) {
104
- return {};
105
- }
106
- return JSON.parse(text);
107
- }
108
- function extractErrorMessage(body) {
109
- if (body && typeof body === "object" && "error" in body) {
110
- const error = body.error;
111
- if (error && typeof error === "object" && "message" in error) {
112
- const message = error.message;
113
- if (typeof message === "string") {
114
- return message;
115
- }
116
- }
117
- }
118
- return "Platform request failed";
119
- }
120
- function hasRun(input) {
121
- return Boolean(input && typeof input === "object" && "run" in input);
122
- }
123
- let defaultSecretsWarned = false;
124
- function emitDefaultSecretsDeprecationWarning() {
125
- // Emit once per process to avoid log spam in long-running apps that
126
- // construct many clients (e.g. one per workspace). Tests that need
127
- // to observe the warning can reset the flag via
128
- // {@link resetDefaultSecretsDeprecationWarning}.
129
- if (defaultSecretsWarned)
130
- return;
131
- defaultSecretsWarned = true;
132
- console.warn("[antpath] AntpathPlatformClientOptions.defaultSecrets is deprecated and will be removed in a future release. " +
133
- "Pass `secrets` explicitly on every submitRun call so the active credentials are visible to the agent reading the call site.");
134
- }
135
- /**
136
- * Test-only: reset the "warn once" guard for the `defaultSecrets`
137
- * deprecation message. Production code should not call this.
138
- *
139
- * @internal
140
- */
141
- export function resetDefaultSecretsDeprecationWarning() {
142
- defaultSecretsWarned = false;
143
- }
144
- /**
145
- * Cross-validate a `proxyEndpoints` policy list against a
146
- * `secrets.proxyEndpointAuth` value list. Throws on the first
147
- * mismatch with an actionable, field-named error message.
148
- *
149
- * Mirrors the BFF's authoritative validator so misconfigured
150
- * submissions fail fast in the SDK before going over the wire. Use it
151
- * directly in tests or wrappers — `submitRun` already invokes it when
152
- * `proxyEndpoints` is non-empty.
153
- */
154
- export function validateProxyAuth(endpoints, auth) {
155
- const authList = auth ?? [];
156
- const endpointNames = new Set(endpoints.map((e) => e.name));
157
- const authNames = new Set();
158
- for (const entry of authList) {
159
- if (authNames.has(entry.name)) {
160
- throw new Error(`secrets.proxyEndpointAuth contains duplicate name '${entry.name}'`);
161
- }
162
- authNames.add(entry.name);
163
- if (!endpointNames.has(entry.name)) {
164
- throw new Error(`secrets.proxyEndpointAuth[].name='${entry.name}' has no matching proxyEndpoints[].name`);
165
- }
166
- }
167
- for (const endpoint of endpoints) {
168
- const match = authList.find((a) => a.name === endpoint.name);
169
- if (!match) {
170
- throw new Error(`proxyEndpoints[].name='${endpoint.name}' is missing a matching secrets.proxyEndpointAuth entry`);
171
- }
172
- if (match.value.type !== endpoint.authShape.type) {
173
- throw new Error(`secrets.proxyEndpointAuth[name='${endpoint.name}'].value.type='${match.value.type}' does not match proxyEndpoints[name='${endpoint.name}'].authShape.type='${endpoint.authShape.type}'`);
174
- }
175
- }
176
- }
177
- /**
178
- * Build an `allowedHosts` list for `environment.network` that includes
179
- * the antpath proxy host (and optionally Anthropic's MCP host) when
180
- * the caller is hand-rolling networking. The worker auto-injects the
181
- * proxy host server-side when proxy endpoints are declared; use this
182
- * helper when you also want client-side template validation parity
183
- * (e.g. to assert at build time that a `limited` config can reach the
184
- * surfaces you intended).
185
- *
186
- * The proxy host is derived from the dashboard URL. Pass the same
187
- * value you used for the `AntpathPlatformClient` `baseUrl`.
188
- */
189
- export function buildPlatformAllowedHosts(input) {
190
- const result = [];
191
- try {
192
- result.push(new URL(input.dashboardBaseUrl).host);
193
- }
194
- catch {
195
- throw new Error("buildPlatformAllowedHosts: dashboardBaseUrl must be an absolute URL");
196
- }
197
- for (const host of input.extraHosts ?? []) {
198
- if (!result.includes(host))
199
- result.push(host);
200
- }
201
- return result;
202
- }
203
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/platform/client.ts"],"names":[],"mappings":"AA0JA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,MAAM,CAAS;IACf,OAAO,CAAU;IAE1B,YAAY,MAAc,EAAE,OAAe,EAAE,OAAgB;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,MAAM,OAAO,qBAAqB;IACf,OAAO,CAAM;IACb,QAAQ,CAAS;IACjB,SAAS,CAAY;IACrB,cAAc,CAAyB;IAExD,YAAY,OAAqC;QAC/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-1 +0,0 @@
1
- export * from "./client.js";
@@ -1,2 +0,0 @@
1
- export * from "./client.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,36 +0,0 @@
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 AnthropicProviderRetryOptions {
7
- maxAttempts?: number | undefined;
8
- baseDelayMs?: number | undefined;
9
- maxDelayMs?: number | undefined;
10
- }
11
- export interface AnthropicManagedAgentsProviderOptions {
12
- apiKey: string | SecretString;
13
- baseUrl?: string;
14
- fetch?: typeof fetch;
15
- retry?: AnthropicProviderRetryOptions | undefined;
16
- }
17
- export declare class AnthropicManagedAgentsProvider implements ManagedAgentProvider {
18
- #private;
19
- constructor(options: AnthropicManagedAgentsProviderOptions);
20
- createEnvironment(template: ResolvedTemplate): Promise<string>;
21
- uploadFile(input: UploadFileInput): Promise<string>;
22
- createAgent(template: ResolvedTemplate, providerSkillRefs: ProviderSkillRef[]): Promise<string>;
23
- createVault(displayName: string, metadata?: Record<string, string>): Promise<string>;
24
- createCredential(vaultId: string, serverUrl: string, credential: CredentialInput): Promise<CreatedCredential>;
25
- createSession(agentId: string, environmentId: string, vaultIds: string[], resources: SessionResourceInput[]): Promise<string>;
26
- sendUserMessage(sessionId: string, message: string): Promise<void>;
27
- streamEvents(sessionId: string, signal?: AbortSignal): AsyncIterable<ProviderEvent>;
28
- getSession(sessionId: string): Promise<{
29
- status?: string | undefined;
30
- usage?: UsageSummary | undefined;
31
- }>;
32
- listFiles(sessionId: string): Promise<ProviderFile[]>;
33
- downloadFile(fileId: string): Promise<Uint8Array>;
34
- terminateSession(sessionId: string): Promise<void>;
35
- cleanup(ids: ProviderResourceIds, policy?: string): Promise<CleanupResult>;
36
- }