antpath 0.1.1 → 0.2.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.
- package/README.md +40 -4
- package/dist/cli.mjs +367 -0
- package/dist/cli.mjs.sha256 +1 -0
- package/dist/client.js +4 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/platform/client.d.ts +138 -7
- package/dist/platform/client.js +98 -2
- package/dist/platform/client.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/docs/credentials.md +84 -2
- package/docs/events.md +129 -0
- package/docs/skills.md +2 -0
- package/package.json +5 -2
- package/references/architecture-decisions.md +110 -64
- package/references/implementation-plan.md +66 -44
package/README.md
CHANGED
|
@@ -6,12 +6,30 @@ title: antpath
|
|
|
6
6
|
|
|
7
7
|
antpath is a TypeScript-first SDK for running autonomous Claude Managed Agents sessions from code-defined, secret-free Templates.
|
|
8
8
|
|
|
9
|
-
|
|
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)
|
|
10
29
|
|
|
11
|
-
- SDK-only.
|
|
12
30
|
- Claude Managed Agents only.
|
|
13
|
-
- Caller-held provider key.
|
|
14
|
-
- No
|
|
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.
|
|
15
33
|
- Manual cleanup by default.
|
|
16
34
|
|
|
17
35
|
## Quickstart
|
|
@@ -43,6 +61,23 @@ await handle.downloadOutputs("./outputs");
|
|
|
43
61
|
await handle.cleanup();
|
|
44
62
|
```
|
|
45
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
|
+
|
|
46
81
|
## Test commands
|
|
47
82
|
|
|
48
83
|
```text
|
|
@@ -61,6 +96,7 @@ Unit tests are deterministic and may use fakes or sanitized recorded snapshots.
|
|
|
61
96
|
- [MCP](docs/mcp.md)
|
|
62
97
|
- [Skills](docs/skills.md)
|
|
63
98
|
- [Outputs](docs/outputs.md)
|
|
99
|
+
- [Events](docs/events.md)
|
|
64
100
|
- [Cleanup](docs/cleanup.md)
|
|
65
101
|
- [Testing](docs/testing.md)
|
|
66
102
|
- [Release](docs/release.md)
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// dist/cli.js
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
// ../shared/dist/config.js
|
|
6
|
+
var DEFAULT_CAPS = {
|
|
7
|
+
maxRunDurationMs: 5 * 60 * 1e3,
|
|
8
|
+
maxActiveRunsPerWorkspace: 1,
|
|
9
|
+
maxActiveRunsPerUserOrToken: 1,
|
|
10
|
+
pollingBaseIntervalMs: 5e3,
|
|
11
|
+
pollingMaxIntervalMs: 6e4,
|
|
12
|
+
pollingJitterRatio: 0.2,
|
|
13
|
+
providerCreateTokensPerMinute: 20,
|
|
14
|
+
providerDeleteTokensPerMinute: 30,
|
|
15
|
+
providerPollTokensPerMinute: 60,
|
|
16
|
+
providerRetryBackoffMs: 5e3,
|
|
17
|
+
leaseDurationMs: 6e4,
|
|
18
|
+
leaseRenewalThresholdMs: 2e4,
|
|
19
|
+
maxProviderAttempts: 1,
|
|
20
|
+
cleanupRetryCount: 3,
|
|
21
|
+
cleanupRetryBackoffMs: 1e4,
|
|
22
|
+
outputDownloadSafetyCapBytes: 1024 * 1024 * 1024,
|
|
23
|
+
workspaceStorageCapBytes: 5 * 1024 * 1024 * 1024,
|
|
24
|
+
signedUrlTtlSeconds: 300
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// ../shared/dist/proxy-protocol.js
|
|
28
|
+
var PROXY_PROTOCOL_VERSION = "1";
|
|
29
|
+
var PROXY_PROTOCOL_HEADER = "x-antpath-proxy-protocol";
|
|
30
|
+
var PROXY_METHOD_HEADER = "x-antpath-method";
|
|
31
|
+
var PROXY_PATH_HEADER = "x-antpath-path";
|
|
32
|
+
var PROXY_QUERY_HEADER = "x-antpath-query";
|
|
33
|
+
var PROXY_HEADERS_HEADER = "x-antpath-headers";
|
|
34
|
+
var PROXY_RESPONSE_MODE_HEADER = "x-antpath-response-mode";
|
|
35
|
+
var PROXY_RESPONSE_MODES = ["status_only", "headers_only", "full"];
|
|
36
|
+
|
|
37
|
+
// ../shared/dist/status.js
|
|
38
|
+
var TERMINAL_RUN_STATUSES = [
|
|
39
|
+
"succeeded",
|
|
40
|
+
"failed",
|
|
41
|
+
"timed_out",
|
|
42
|
+
"cancelled",
|
|
43
|
+
"cleanup_failed",
|
|
44
|
+
"pending_delete",
|
|
45
|
+
"deleted"
|
|
46
|
+
];
|
|
47
|
+
var terminalRunStatuses = new Set(TERMINAL_RUN_STATUSES);
|
|
48
|
+
|
|
49
|
+
// ../shared/dist/submission.js
|
|
50
|
+
var PROXY_ENDPOINT_DEFAULTS = {
|
|
51
|
+
allowHeaders: [],
|
|
52
|
+
responseMode: "headers_only",
|
|
53
|
+
maxRequestBytes: 64 * 1024,
|
|
54
|
+
maxResponseBytes: 1024 * 1024,
|
|
55
|
+
timeoutMs: 1e4,
|
|
56
|
+
perCallBudget: 60,
|
|
57
|
+
responseByteBudget: 1024 * 1024
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// dist/internal.js
|
|
61
|
+
var ANTPATH_INDEX_PATH = "/antpath/index.json";
|
|
62
|
+
var ANTPATH_RUN_TOKEN_PATH = "/antpath/run-token";
|
|
63
|
+
|
|
64
|
+
// dist/run.js
|
|
65
|
+
var SUCCESS = { code: 0 };
|
|
66
|
+
var USAGE_ERR = { code: 2 };
|
|
67
|
+
var RUNTIME_ERR = { code: 1 };
|
|
68
|
+
async function runCli(io2) {
|
|
69
|
+
const args = io2.argv.slice(2);
|
|
70
|
+
try {
|
|
71
|
+
const exit = await dispatch(io2, args);
|
|
72
|
+
io2.exit(exit.code);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
const body = { error: "internal_error", message: err.message ?? "unknown error" };
|
|
75
|
+
io2.stderr(JSON.stringify(body) + "\n");
|
|
76
|
+
io2.exit(RUNTIME_ERR.code);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function dispatch(io2, args) {
|
|
80
|
+
if (args.length === 0 || args[0] === "--help" || args[0] === "-h") {
|
|
81
|
+
return await printGlobalHelp(io2);
|
|
82
|
+
}
|
|
83
|
+
const sub = args[0];
|
|
84
|
+
const rest = args.slice(1);
|
|
85
|
+
switch (sub) {
|
|
86
|
+
case "proxy":
|
|
87
|
+
return await runProxy(io2, rest);
|
|
88
|
+
default:
|
|
89
|
+
io2.stderr(`unknown subcommand: ${sub}
|
|
90
|
+
`);
|
|
91
|
+
io2.stderr("run `antpath --help` for usage\n");
|
|
92
|
+
return USAGE_ERR;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function printGlobalHelp(io2) {
|
|
96
|
+
const manifest = await tryReadManifest(io2);
|
|
97
|
+
io2.stdout("antpath \u2014 managed proxy CLI for skill scripts\n\n");
|
|
98
|
+
io2.stdout("Usage:\n");
|
|
99
|
+
io2.stdout(" antpath proxy <endpoint-name> [flags]\n");
|
|
100
|
+
io2.stdout(" antpath --help\n\n");
|
|
101
|
+
if (manifest) {
|
|
102
|
+
if (manifest.endpoints.length === 0) {
|
|
103
|
+
io2.stdout("This run declared no proxy endpoints.\n");
|
|
104
|
+
} else {
|
|
105
|
+
io2.stdout("Declared proxy endpoints for this run:\n");
|
|
106
|
+
for (const ep of manifest.endpoints) {
|
|
107
|
+
io2.stdout(` \u2022 ${ep.name} (${ep.allowMethods.join("/")} ${ep.allowPathPrefixes.join(",")}, mode=${ep.responseMode})
|
|
108
|
+
`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
io2.stdout(`
|
|
112
|
+
Protocol version: ${manifest.protocolVersion}
|
|
113
|
+
`);
|
|
114
|
+
} else {
|
|
115
|
+
io2.stdout("(no manifest mounted \u2014 run `antpath proxy --help` for details)\n");
|
|
116
|
+
}
|
|
117
|
+
return SUCCESS;
|
|
118
|
+
}
|
|
119
|
+
async function printProxyHelp(io2) {
|
|
120
|
+
io2.stdout("antpath proxy \u2014 call an upstream HTTP endpoint via the managed proxy.\n\n");
|
|
121
|
+
io2.stdout("Usage:\n");
|
|
122
|
+
io2.stdout(" antpath proxy <endpoint-name> [flags]\n\n");
|
|
123
|
+
io2.stdout("Flags:\n");
|
|
124
|
+
io2.stdout(" --method <verb> HTTP method (default: GET)\n");
|
|
125
|
+
io2.stdout(" --path <path> Caller-supplied path; must match policy prefixes\n");
|
|
126
|
+
io2.stdout(` --query <json> JSON object of query parameters (e.g. '{"q":"x"}')
|
|
127
|
+
`);
|
|
128
|
+
io2.stdout(" --header K=V Add a caller header (repeatable)\n");
|
|
129
|
+
io2.stdout(" --data <value> Request body. Use '-' for stdin, '@<file>' for file content\n");
|
|
130
|
+
io2.stdout(" --response-mode <mode> status_only | headers_only | full (may only narrow policy)\n");
|
|
131
|
+
io2.stdout(" --help Show this message\n\n");
|
|
132
|
+
const manifest = await tryReadManifest(io2);
|
|
133
|
+
if (manifest && manifest.endpoints.length > 0) {
|
|
134
|
+
io2.stdout("Declared endpoints:\n");
|
|
135
|
+
for (const ep of manifest.endpoints) {
|
|
136
|
+
io2.stdout(` \u2022 ${ep.name}: ${ep.allowMethods.join(",")} ${ep.allowPathPrefixes.join(",")} (mode=${ep.responseMode}, budget=${ep.perCallBudget}/run)
|
|
137
|
+
`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return SUCCESS;
|
|
141
|
+
}
|
|
142
|
+
function parseProxyFlags(rest) {
|
|
143
|
+
let endpointName = null;
|
|
144
|
+
let method = "GET";
|
|
145
|
+
let path = "/";
|
|
146
|
+
let query = null;
|
|
147
|
+
const headers = /* @__PURE__ */ new Map();
|
|
148
|
+
let dataSpec = null;
|
|
149
|
+
let responseMode = null;
|
|
150
|
+
let showHelp = false;
|
|
151
|
+
for (let i = 0; i < rest.length; i++) {
|
|
152
|
+
const arg = rest[i];
|
|
153
|
+
if (arg === "--help" || arg === "-h") {
|
|
154
|
+
showHelp = true;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (arg === "--method") {
|
|
158
|
+
method = expect(rest, ++i, "--method");
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (arg === "--path") {
|
|
162
|
+
path = expect(rest, ++i, "--path");
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (arg === "--query") {
|
|
166
|
+
query = expect(rest, ++i, "--query");
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (arg === "--header") {
|
|
170
|
+
const kv = expect(rest, ++i, "--header");
|
|
171
|
+
const eq = kv.indexOf("=");
|
|
172
|
+
if (eq <= 0)
|
|
173
|
+
return { ok: false, reason: "--header must be in the form KEY=VALUE" };
|
|
174
|
+
headers.set(kv.slice(0, eq).toLowerCase(), kv.slice(eq + 1));
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (arg === "--data") {
|
|
178
|
+
dataSpec = expect(rest, ++i, "--data");
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (arg === "--response-mode") {
|
|
182
|
+
responseMode = expect(rest, ++i, "--response-mode");
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (arg.startsWith("--")) {
|
|
186
|
+
return { ok: false, reason: `unknown flag: ${arg}` };
|
|
187
|
+
}
|
|
188
|
+
if (endpointName === null) {
|
|
189
|
+
endpointName = arg;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
return { ok: false, reason: `unexpected positional argument: ${arg}` };
|
|
193
|
+
}
|
|
194
|
+
return { ok: true, flags: { endpointName, method, path, query, headers, dataSpec, responseMode, showHelp } };
|
|
195
|
+
}
|
|
196
|
+
function expect(arr, idx, flag) {
|
|
197
|
+
const v = arr[idx];
|
|
198
|
+
if (v === void 0) {
|
|
199
|
+
throw new CliUsageError(`${flag} requires a value`);
|
|
200
|
+
}
|
|
201
|
+
return v;
|
|
202
|
+
}
|
|
203
|
+
var CliUsageError = class extends Error {
|
|
204
|
+
};
|
|
205
|
+
async function runProxy(io2, rest) {
|
|
206
|
+
let parsed;
|
|
207
|
+
try {
|
|
208
|
+
parsed = parseProxyFlags(rest);
|
|
209
|
+
} catch (err) {
|
|
210
|
+
if (err instanceof CliUsageError) {
|
|
211
|
+
io2.stderr(`${err.message}
|
|
212
|
+
`);
|
|
213
|
+
return USAGE_ERR;
|
|
214
|
+
}
|
|
215
|
+
throw err;
|
|
216
|
+
}
|
|
217
|
+
if (!parsed.ok) {
|
|
218
|
+
io2.stderr(`${parsed.reason}
|
|
219
|
+
`);
|
|
220
|
+
return USAGE_ERR;
|
|
221
|
+
}
|
|
222
|
+
const f = parsed.flags;
|
|
223
|
+
if (f.showHelp) {
|
|
224
|
+
return await printProxyHelp(io2);
|
|
225
|
+
}
|
|
226
|
+
if (!f.endpointName) {
|
|
227
|
+
io2.stderr("missing endpoint-name\n");
|
|
228
|
+
io2.stderr("usage: antpath proxy <endpoint-name> [flags]\n");
|
|
229
|
+
return USAGE_ERR;
|
|
230
|
+
}
|
|
231
|
+
if (f.responseMode && !PROXY_RESPONSE_MODES.includes(f.responseMode)) {
|
|
232
|
+
io2.stderr(`--response-mode must be one of: ${PROXY_RESPONSE_MODES.join(", ")}
|
|
233
|
+
`);
|
|
234
|
+
return USAGE_ERR;
|
|
235
|
+
}
|
|
236
|
+
const manifest = await tryReadManifest(io2);
|
|
237
|
+
if (!manifest) {
|
|
238
|
+
emitError(io2, {
|
|
239
|
+
error: "internal_error",
|
|
240
|
+
message: "manifest not mounted; this CLI must run inside an antpath-managed run"
|
|
241
|
+
});
|
|
242
|
+
return RUNTIME_ERR;
|
|
243
|
+
}
|
|
244
|
+
if (!manifest.proxyBaseUrl) {
|
|
245
|
+
emitError(io2, {
|
|
246
|
+
error: "endpoint_not_found",
|
|
247
|
+
message: "this run has no proxy endpoints declared",
|
|
248
|
+
endpointName: f.endpointName
|
|
249
|
+
});
|
|
250
|
+
return RUNTIME_ERR;
|
|
251
|
+
}
|
|
252
|
+
let token;
|
|
253
|
+
try {
|
|
254
|
+
token = (await io2.readFile(ANTPATH_RUN_TOKEN_PATH)).trim();
|
|
255
|
+
} catch {
|
|
256
|
+
emitError(io2, {
|
|
257
|
+
error: "unauthorized",
|
|
258
|
+
message: "run token file missing; this run has no proxy bearer"
|
|
259
|
+
});
|
|
260
|
+
return RUNTIME_ERR;
|
|
261
|
+
}
|
|
262
|
+
if (!token) {
|
|
263
|
+
emitError(io2, { error: "unauthorized", message: "run token is empty" });
|
|
264
|
+
return RUNTIME_ERR;
|
|
265
|
+
}
|
|
266
|
+
let body;
|
|
267
|
+
if (f.dataSpec !== null) {
|
|
268
|
+
try {
|
|
269
|
+
body = await resolveBody(io2, f.dataSpec);
|
|
270
|
+
} catch (err) {
|
|
271
|
+
io2.stderr(`failed to read request body: ${err.message}
|
|
272
|
+
`);
|
|
273
|
+
return RUNTIME_ERR;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const url = `${manifest.proxyBaseUrl.replace(/\/+$/, "")}/${encodeURIComponent(f.endpointName)}`;
|
|
277
|
+
const requestHeaders = new Headers();
|
|
278
|
+
requestHeaders.set("authorization", `Bearer ${token}`);
|
|
279
|
+
requestHeaders.set(PROXY_PROTOCOL_HEADER, PROXY_PROTOCOL_VERSION);
|
|
280
|
+
requestHeaders.set(PROXY_METHOD_HEADER, f.method.toUpperCase());
|
|
281
|
+
requestHeaders.set(PROXY_PATH_HEADER, f.path);
|
|
282
|
+
if (f.query) {
|
|
283
|
+
requestHeaders.set(PROXY_QUERY_HEADER, f.query);
|
|
284
|
+
}
|
|
285
|
+
if (f.headers.size > 0) {
|
|
286
|
+
requestHeaders.set(PROXY_HEADERS_HEADER, JSON.stringify(Object.fromEntries(f.headers)));
|
|
287
|
+
}
|
|
288
|
+
if (f.responseMode) {
|
|
289
|
+
requestHeaders.set(PROXY_RESPONSE_MODE_HEADER, f.responseMode);
|
|
290
|
+
}
|
|
291
|
+
if (body !== void 0) {
|
|
292
|
+
requestHeaders.set("content-length", String(body.byteLength));
|
|
293
|
+
}
|
|
294
|
+
const init = {
|
|
295
|
+
method: "POST",
|
|
296
|
+
headers: requestHeaders,
|
|
297
|
+
redirect: "manual"
|
|
298
|
+
};
|
|
299
|
+
if (body !== void 0) {
|
|
300
|
+
init.body = body;
|
|
301
|
+
}
|
|
302
|
+
let response;
|
|
303
|
+
try {
|
|
304
|
+
response = await io2.fetchImpl(url, init);
|
|
305
|
+
} catch (err) {
|
|
306
|
+
emitError(io2, {
|
|
307
|
+
error: "upstream_error",
|
|
308
|
+
message: `proxy request failed: ${err.message}`,
|
|
309
|
+
endpointName: f.endpointName
|
|
310
|
+
});
|
|
311
|
+
return RUNTIME_ERR;
|
|
312
|
+
}
|
|
313
|
+
const text = await response.text();
|
|
314
|
+
let parsedBody;
|
|
315
|
+
try {
|
|
316
|
+
parsedBody = text ? JSON.parse(text) : {};
|
|
317
|
+
} catch {
|
|
318
|
+
emitError(io2, {
|
|
319
|
+
error: "internal_error",
|
|
320
|
+
message: "proxy returned non-JSON response",
|
|
321
|
+
endpointName: f.endpointName
|
|
322
|
+
});
|
|
323
|
+
return RUNTIME_ERR;
|
|
324
|
+
}
|
|
325
|
+
if (!response.ok) {
|
|
326
|
+
io2.stderr(JSON.stringify(parsedBody) + "\n");
|
|
327
|
+
return RUNTIME_ERR;
|
|
328
|
+
}
|
|
329
|
+
io2.stdout(JSON.stringify(parsedBody) + "\n");
|
|
330
|
+
return SUCCESS;
|
|
331
|
+
}
|
|
332
|
+
async function resolveBody(io2, spec) {
|
|
333
|
+
if (spec === "-") {
|
|
334
|
+
const data = await io2.readFile("/dev/stdin");
|
|
335
|
+
return new Uint8Array(Buffer.from(data, "utf8"));
|
|
336
|
+
}
|
|
337
|
+
if (spec.startsWith("@")) {
|
|
338
|
+
const path = spec.slice(1);
|
|
339
|
+
if (!path)
|
|
340
|
+
throw new Error("--data @<file> requires a path");
|
|
341
|
+
const data = await io2.readFile(path);
|
|
342
|
+
return new Uint8Array(Buffer.from(data, "utf8"));
|
|
343
|
+
}
|
|
344
|
+
return new Uint8Array(Buffer.from(spec, "utf8"));
|
|
345
|
+
}
|
|
346
|
+
function emitError(io2, body) {
|
|
347
|
+
io2.stderr(JSON.stringify(body) + "\n");
|
|
348
|
+
}
|
|
349
|
+
async function tryReadManifest(io2) {
|
|
350
|
+
try {
|
|
351
|
+
const raw = await io2.readFile(ANTPATH_INDEX_PATH);
|
|
352
|
+
return JSON.parse(raw);
|
|
353
|
+
} catch {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// dist/cli.js
|
|
359
|
+
var io = {
|
|
360
|
+
readFile: (path) => readFile(path, "utf8"),
|
|
361
|
+
fetchImpl: fetch,
|
|
362
|
+
stdout: (chunk) => process.stdout.write(chunk),
|
|
363
|
+
stderr: (chunk) => process.stderr.write(chunk),
|
|
364
|
+
exit: (code) => process.exit(code),
|
|
365
|
+
argv: process.argv
|
|
366
|
+
};
|
|
367
|
+
await runCli(io);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e4adb3ee5b4053a78a8ddaf9cd653fbaf6a0ddf98432411308964c8fd40909f8 cli.mjs
|
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,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;
|
|
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,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/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { AntpathClient } from "./client.js";
|
|
2
|
-
export { AntpathPlatformClient, PlatformApiError } from "./platform/index.js";
|
|
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";
|
|
3
4
|
export { AnthropicManagedAgentsProvider } from "./providers/anthropic/provider.js";
|
|
4
5
|
export type { ManagedAgentProvider, ProviderSkillRef, SessionResourceInput, UploadFileInput } from "./providers/types.js";
|
|
5
|
-
export
|
|
6
|
-
export { compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string, type TemplateDefinition, type TemplateVariableDefinition } from "./template/index.js";
|
|
7
|
-
export type { CleanupPolicy, CleanupResult, CredentialInput, DownloadOutputsOptions, DownloadOutputsResult, Logger, OutputManifest, ProviderEvent, ProviderFile, ProviderResourceIds, RunEvent, RunHandle, RunOptions, RunResult, RunStatus, UsageSummary } from "./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";
|
|
8
9
|
export { SecretString, redactSecrets } from "./utils/secrets.js";
|
|
9
10
|
export { AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./errors.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { AntpathClient } from "./client.js";
|
|
2
|
-
export { AntpathPlatformClient, PlatformApiError } from "./platform/index.js";
|
|
2
|
+
export { AntpathPlatformClient, PlatformApiError, validateProxyAuth, buildPlatformAllowedHosts, resetDefaultSecretsDeprecationWarning } from "./platform/index.js";
|
|
3
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";
|
|
4
5
|
export { compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string } from "./template/index.js";
|
|
5
6
|
export { SecretString, redactSecrets } from "./utils/secrets.js";
|
|
6
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,
|
|
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"}
|
|
@@ -11,28 +11,124 @@ export interface PlatformTemplateSubmission {
|
|
|
11
11
|
readonly messages: readonly string[];
|
|
12
12
|
readonly metadata?: Record<string, PlatformJsonValue>;
|
|
13
13
|
}
|
|
14
|
-
export interface PlatformOutputPolicy {
|
|
15
|
-
readonly capture: boolean;
|
|
16
|
-
readonly globs?: readonly string[];
|
|
17
|
-
}
|
|
18
14
|
export type PlatformClaudeSessionCleanup = "retain" | "delete";
|
|
19
15
|
export interface PlatformCleanupPolicy {
|
|
16
|
+
readonly session?: PlatformClaudeSessionCleanup;
|
|
20
17
|
readonly claudeSession?: PlatformClaudeSessionCleanup;
|
|
21
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
|
+
*/
|
|
22
99
|
export interface PlatformRunSubmissionRequest {
|
|
23
100
|
readonly workspaceId: string;
|
|
24
|
-
readonly providerConnectionId: string;
|
|
25
101
|
readonly idempotencyKey: string;
|
|
26
102
|
readonly template: PlatformTemplateSubmission;
|
|
27
103
|
readonly variables?: Record<string, PlatformJsonValue>;
|
|
28
|
-
readonly credentialReferences?: Record<string, string>;
|
|
29
|
-
readonly output?: PlatformOutputPolicy;
|
|
30
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[];
|
|
31
116
|
}
|
|
32
117
|
export interface AntpathPlatformClientOptions {
|
|
33
118
|
readonly baseUrl: string;
|
|
34
119
|
readonly apiToken: string;
|
|
35
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;
|
|
36
132
|
}
|
|
37
133
|
export interface PlatformRun {
|
|
38
134
|
readonly id: string;
|
|
@@ -60,6 +156,7 @@ export declare class AntpathPlatformClient {
|
|
|
60
156
|
private readonly baseUrl;
|
|
61
157
|
private readonly apiToken;
|
|
62
158
|
private readonly fetchImpl;
|
|
159
|
+
private readonly defaultSecrets?;
|
|
63
160
|
constructor(options: AntpathPlatformClientOptions);
|
|
64
161
|
submitRun(request: PlatformRunSubmissionRequest): Promise<PlatformRun>;
|
|
65
162
|
getRun(workspaceId: string, runId: string): Promise<PlatformRun>;
|
|
@@ -70,4 +167,38 @@ export declare class AntpathPlatformClient {
|
|
|
70
167
|
deleteRun(workspaceId: string, runId: string): Promise<void>;
|
|
71
168
|
private request;
|
|
72
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[];
|
|
73
204
|
export {};
|