antpath 0.4.1 → 0.6.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.
@@ -1 +1 @@
1
- 2d4fdd070358ffea5d49c62d5cca10863da0fc6279a88fe78fa7f11eb6eb18d7 cli.mjs
1
+ 0d11c4f9917f04a478449a308c1a5df2384e0281cea00ad6ecc6adcc284bc6b9 cli.mjs
package/dist/client.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import { type FetchLike, type Output, type PlatformInlineSecrets, type PlatformProxyEndpoint, type ResolvedTemplate, type Run, type RunEvent, type SignedOutputLink, type TemplateDefinition, type WhoAmI } from "./_shared/index.js";
1
+ import { HttpClient, type FetchLike, type Output, type PlatformFlatRunSubmissionInput, type PlatformFlatSubmission, type PlatformInlineSecrets, type Run, type RunEvent, type SignedOutputLink, type Skill as SkillRecord, type WhoAmI } from "./_shared/index.js";
2
+ import { type SkillFiles } from "./bundle.js";
3
+ import { McpServer } from "./mcp-server.js";
4
+ import { Skill } from "./skill.js";
2
5
  export interface AntpathClientOptions {
3
6
  /** Workspace-scoped SDK API token. */
4
7
  readonly apiToken: string;
@@ -14,18 +17,31 @@ export interface AntpathClientOptions {
14
17
  readonly fetch?: FetchLike;
15
18
  }
16
19
  /**
17
- * Per-run submission options. `secrets.anthropic.apiKey` is REQUIRED on
18
- * every call the dashboard does not store provider credentials on
19
- * your behalf. Optional `mcpServers`, `skills`, and `proxyEndpointAuth`
20
- * round out the session-scoped credential bundle.
20
+ * Per-run submission options. Everything the user wants to send is
21
+ * spelled out at the call site:
22
+ *
23
+ * - `model` / `system` / `prompt` — the agent's brief.
24
+ * - `skills` — array of `Skill` instances (workspace or provider).
25
+ * - `mcpServers` — array of `McpServer` instances (headers split into
26
+ * `secrets.mcpServers` server-side; the public submission only
27
+ * carries `{ name, url }`).
28
+ * - `secrets.anthropic.apiKey` — REQUIRED. The platform never holds
29
+ * a long-lived Anthropic key on your behalf.
30
+ *
31
+ * `idempotencyKey` is auto-generated when omitted; pass one explicitly
32
+ * if you want client-driven retry safety.
21
33
  */
22
- export interface RunSubmitOptions {
23
- readonly variables?: Record<string, string>;
34
+ export interface SubmitRunOptions {
35
+ readonly model: string;
36
+ readonly system?: string;
37
+ readonly prompt: string | readonly string[];
38
+ readonly skills?: readonly Skill[];
39
+ readonly mcpServers?: readonly McpServer[];
40
+ readonly environment?: PlatformFlatSubmission["environment"];
41
+ readonly metadata?: PlatformFlatSubmission["metadata"];
42
+ readonly cleanup?: PlatformFlatRunSubmissionInput["cleanup"];
43
+ readonly proxyEndpoints?: PlatformFlatRunSubmissionInput["proxyEndpoints"];
24
44
  readonly secrets: PlatformInlineSecrets;
25
- readonly proxyEndpoints?: readonly PlatformProxyEndpoint[];
26
- readonly cleanup?: {
27
- readonly session?: "retain" | "delete";
28
- };
29
45
  readonly idempotencyKey?: string;
30
46
  readonly signal?: AbortSignal;
31
47
  }
@@ -55,6 +71,35 @@ export declare class RunRef {
55
71
  cancel(): Promise<void>;
56
72
  delete(): Promise<void>;
57
73
  }
74
+ /**
75
+ * Workspace skill operations exposed under `client.skills`. These
76
+ * delegate to the same shared `operations.*` functions the CLI uses
77
+ * so SDK and CLI never drift.
78
+ */
79
+ export declare class SkillsClient {
80
+ #private;
81
+ constructor(http: HttpClient);
82
+ /**
83
+ * Upload an inline files map as a workspace skill. The SDK validates
84
+ * basic safety (no path traversal, size caps, has `SKILL.md`) and
85
+ * deterministically zips the bundle before posting; the BFF
86
+ * re-canonicalises and recomputes the hash on receipt.
87
+ */
88
+ upload(args: {
89
+ readonly name: string;
90
+ readonly files: SkillFiles;
91
+ }): Promise<Skill>;
92
+ /**
93
+ * Read a local directory and upload it as a workspace skill. Symlinks
94
+ * and non-regular files are skipped. Node-only.
95
+ */
96
+ fromPath(rootDir: string, args: {
97
+ readonly name: string;
98
+ }): Promise<Skill>;
99
+ list(): Promise<readonly SkillRecord[]>;
100
+ get(skillId: string): Promise<SkillRecord>;
101
+ delete(skillId: string): Promise<void>;
102
+ }
58
103
  /**
59
104
  * Unified user-facing client for the antpath platform. The same class
60
105
  * powers the published `antpath` SDK and (under the hood) every host-side
@@ -68,23 +113,24 @@ export declare class RunRef {
68
113
  */
69
114
  export declare class AntpathClient {
70
115
  #private;
116
+ readonly skills: SkillsClient;
71
117
  constructor(options: AntpathClientOptions);
72
118
  /**
73
119
  * Submit a run and wait for it to reach a terminal state. Returns the
74
120
  * final `Run` record. For long-running flows, prefer `submitRun` +
75
- * `streamEvents` + `waitForRun`.
121
+ * `RunRef.stream()` + `RunRef.wait()`.
76
122
  */
77
- run(template: TemplateDefinition, options: RunSubmitOptions): Promise<Run>;
123
+ run(options: SubmitRunOptions): Promise<Run>;
78
124
  /**
79
125
  * Submit a run and return a `RunRef` immediately. Use the ref to
80
126
  * stream events, fetch outputs, cancel, or delete the run.
127
+ *
128
+ * The SDK splits `mcpServers[i].headers` into `secrets.mcpServers`
129
+ * before sending so credentials never enter the hashed submission or
130
+ * the run snapshot, even when the caller forgets to pass
131
+ * `secrets.mcpServers` explicitly.
81
132
  */
82
- submitRun(template: TemplateDefinition, options: RunSubmitOptions): Promise<RunRef>;
83
- /**
84
- * Same as `submitRun` but accepts an already-compiled `ResolvedTemplate`.
85
- * Useful when consuming a `.json` template directly.
86
- */
87
- submitResolvedRun(template: ResolvedTemplate, options: RunSubmitOptions): Promise<RunRef>;
133
+ submitRun(options: SubmitRunOptions): Promise<RunRef>;
88
134
  getRun(runId: string): Promise<Run>;
89
135
  listEvents(runId: string): Promise<readonly RunEvent[]>;
90
136
  /**
package/dist/client.js CHANGED
@@ -1,4 +1,8 @@
1
- import { HttpClient, operations, toPlatformSubmissionTemplate, validateProxyAuth, compileTemplate } from "./_shared/index.js";
1
+ import { HttpClient, operations, validateProxyAuth } from "./_shared/index.js";
2
+ import { bundleSkillFiles } from "./bundle.js";
3
+ import { McpServer } from "./mcp-server.js";
4
+ import { readDirectoryAsFiles } from "./node-fs.js";
5
+ import { Skill } from "./skill.js";
2
6
  /**
3
7
  * Lightweight reference to a submitted run. All read-back operations
4
8
  * delegate to the same `AntpathClient` and the same operations module
@@ -33,6 +37,56 @@ export class RunRef {
33
37
  return this.#client.deleteRun(this.runId);
34
38
  }
35
39
  }
40
+ /**
41
+ * Workspace skill operations exposed under `client.skills`. These
42
+ * delegate to the same shared `operations.*` functions the CLI uses
43
+ * so SDK and CLI never drift.
44
+ */
45
+ export class SkillsClient {
46
+ #http;
47
+ constructor(http) {
48
+ this.#http = http;
49
+ }
50
+ /**
51
+ * Upload an inline files map as a workspace skill. The SDK validates
52
+ * basic safety (no path traversal, size caps, has `SKILL.md`) and
53
+ * deterministically zips the bundle before posting; the BFF
54
+ * re-canonicalises and recomputes the hash on receipt.
55
+ */
56
+ async upload(args) {
57
+ if (!args || typeof args !== "object") {
58
+ throw new Error("client.skills.upload: args is required");
59
+ }
60
+ if (typeof args.name !== "string" || !args.name) {
61
+ throw new Error("client.skills.upload: name is required");
62
+ }
63
+ const bundled = bundleSkillFiles(args.files);
64
+ const record = await operations.createSkillBundle(this.#http, {
65
+ name: args.name,
66
+ body: bundled.zip,
67
+ contentType: "application/zip",
68
+ filename: `${args.name}.zip`
69
+ });
70
+ return new Skill({ kind: "workspace", id: record.id }, record);
71
+ }
72
+ /**
73
+ * Read a local directory and upload it as a workspace skill. Symlinks
74
+ * and non-regular files are skipped. Node-only.
75
+ */
76
+ async fromPath(rootDir, args) {
77
+ const files = await readDirectoryAsFiles(rootDir);
78
+ return this.upload({ name: args.name, files });
79
+ }
80
+ list() {
81
+ return operations.listSkills(this.#http);
82
+ }
83
+ get(skillId) {
84
+ return operations.getSkill(this.#http, skillId);
85
+ }
86
+ delete(skillId) {
87
+ return operations.deleteSkill(this.#http, skillId);
88
+ }
89
+ }
36
90
  /**
37
91
  * Unified user-facing client for the antpath platform. The same class
38
92
  * powers the published `antpath` SDK and (under the hood) every host-side
@@ -46,6 +100,7 @@ export class RunRef {
46
100
  */
47
101
  export class AntpathClient {
48
102
  #http;
103
+ skills;
49
104
  constructor(options) {
50
105
  if (!options.apiToken) {
51
106
  throw new Error("AntpathClient: apiToken is required");
@@ -55,49 +110,65 @@ export class AntpathClient {
55
110
  apiToken: options.apiToken,
56
111
  ...(options.fetch ? { fetch: options.fetch } : {})
57
112
  });
113
+ this.skills = new SkillsClient(this.#http);
58
114
  }
59
115
  /**
60
116
  * Submit a run and wait for it to reach a terminal state. Returns the
61
117
  * final `Run` record. For long-running flows, prefer `submitRun` +
62
- * `streamEvents` + `waitForRun`.
118
+ * `RunRef.stream()` + `RunRef.wait()`.
63
119
  */
64
- async run(template, options) {
65
- const ref = await this.submitRun(template, options);
120
+ async run(options) {
121
+ const ref = await this.submitRun(options);
66
122
  return ref.wait(options.signal ? { signal: options.signal } : {});
67
123
  }
68
124
  /**
69
125
  * Submit a run and return a `RunRef` immediately. Use the ref to
70
126
  * stream events, fetch outputs, cancel, or delete the run.
127
+ *
128
+ * The SDK splits `mcpServers[i].headers` into `secrets.mcpServers`
129
+ * before sending so credentials never enter the hashed submission or
130
+ * the run snapshot, even when the caller forgets to pass
131
+ * `secrets.mcpServers` explicitly.
71
132
  */
72
- async submitRun(template, options) {
73
- const resolved = compileTemplate(template, options.variables ?? {});
74
- return this.submitResolvedRun(resolved, options);
75
- }
76
- /**
77
- * Same as `submitRun` but accepts an already-compiled `ResolvedTemplate`.
78
- * Useful when consuming a `.json` template directly.
79
- */
80
- async submitResolvedRun(template, options) {
133
+ async submitRun(options) {
134
+ if (!options || typeof options !== "object") {
135
+ throw new Error("AntpathClient.submitRun: options is required");
136
+ }
81
137
  if (!options.secrets || !options.secrets.anthropic?.apiKey) {
82
138
  throw new Error("AntpathClient.submitRun: secrets.anthropic.apiKey is required");
83
139
  }
140
+ if (typeof options.model !== "string" || !options.model) {
141
+ throw new Error("AntpathClient.submitRun: model is required");
142
+ }
143
+ const prompt = normalisePrompt(options.prompt);
84
144
  if (options.proxyEndpoints && options.proxyEndpoints.length > 0) {
85
145
  validateProxyAuth(options.proxyEndpoints, options.secrets.proxyEndpointAuth);
86
146
  }
87
- // The BFF derives `workspaceId` from the API token; the SDK never
88
- // names it. See `references/development-principles.md`
89
- // (Agent-first surface design, Concrete rule 3).
147
+ const skills = (options.skills ?? []).map(toSkillRef);
148
+ const { submissionMcpServers, mergedMcpSecrets } = mergeMcpServers(options.mcpServers ?? [], options.secrets.mcpServers ?? []);
90
149
  const submission = {
150
+ model: options.model,
151
+ ...(options.system ? { system: options.system } : {}),
152
+ prompt,
153
+ skills,
154
+ mcpServers: submissionMcpServers,
155
+ ...(options.environment ? { environment: options.environment } : {}),
156
+ ...(options.metadata ? { metadata: options.metadata } : {})
157
+ };
158
+ const secrets = {
159
+ ...options.secrets,
160
+ ...(mergedMcpSecrets.length > 0 ? { mcpServers: mergedMcpSecrets } : {})
161
+ };
162
+ const request = {
91
163
  idempotencyKey: options.idempotencyKey ?? generateIdempotencyKey(),
92
- template: toPlatformSubmissionTemplate(template),
93
- ...(options.variables ? { variables: options.variables } : {}),
164
+ submission,
94
165
  ...(options.cleanup ? { cleanup: options.cleanup } : {}),
95
- secrets: options.secrets,
166
+ secrets,
96
167
  ...(options.proxyEndpoints && options.proxyEndpoints.length > 0
97
168
  ? { proxyEndpoints: options.proxyEndpoints }
98
169
  : {})
99
170
  };
100
- const run = await operations.submitRun(this.#http, submission);
171
+ const run = await operations.submitRunFlat(this.#http, request);
101
172
  return new RunRef(this, run.id);
102
173
  }
103
174
  getRun(runId) {
@@ -114,7 +185,7 @@ export class AntpathClient {
114
185
  async *streamEvents(runId, options = {}) {
115
186
  const intervalMs = options.intervalMs ?? 1_000;
116
187
  const signal = options.signal;
117
- let seenIds = new Set();
188
+ const seenIds = new Set();
118
189
  while (!signal?.aborted) {
119
190
  const events = await this.listEvents(runId);
120
191
  for (const event of events) {
@@ -199,4 +270,53 @@ function generateIdempotencyKey() {
199
270
  return cryptoObj.randomUUID();
200
271
  return `idem-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
201
272
  }
273
+ function normalisePrompt(input) {
274
+ if (typeof input === "string") {
275
+ if (!input) {
276
+ throw new Error("AntpathClient.submitRun: prompt must be a non-empty string");
277
+ }
278
+ return [input];
279
+ }
280
+ if (!Array.isArray(input) || input.length === 0) {
281
+ throw new Error("AntpathClient.submitRun: prompt must be a non-empty string or string array");
282
+ }
283
+ for (const segment of input) {
284
+ if (typeof segment !== "string" || !segment) {
285
+ throw new Error("AntpathClient.submitRun: prompt segments must be non-empty strings");
286
+ }
287
+ }
288
+ return [...input];
289
+ }
290
+ function toSkillRef(skill, index) {
291
+ if (!(skill instanceof Skill)) {
292
+ throw new Error(`AntpathClient.submitRun: skills[${index}] must be a Skill instance`);
293
+ }
294
+ return skill.ref;
295
+ }
296
+ function mergeMcpServers(inputs, explicitSecrets) {
297
+ const submissionMcpServers = [];
298
+ const secretByName = new Map();
299
+ for (const secret of explicitSecrets) {
300
+ secretByName.set(secret.name, secret);
301
+ }
302
+ for (let i = 0; i < inputs.length; i++) {
303
+ const entry = inputs[i];
304
+ if (!(entry instanceof McpServer)) {
305
+ throw new Error(`AntpathClient.submitRun: mcpServers[${i}] must be an McpServer instance`);
306
+ }
307
+ submissionMcpServers.push(entry.toSubmissionEntry());
308
+ const secret = entry.toSecretEntry();
309
+ if (secret) {
310
+ const existing = secretByName.get(secret.name);
311
+ if (existing && existing.url !== secret.url) {
312
+ throw new Error(`AntpathClient.submitRun: mcpServers[${i}].url conflicts with secrets.mcpServers["${secret.name}"]`);
313
+ }
314
+ secretByName.set(secret.name, secret);
315
+ }
316
+ }
317
+ return {
318
+ submissionMcpServers,
319
+ mergedMcpSecrets: Array.from(secretByName.values())
320
+ };
321
+ }
202
322
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,4BAA4B,EAC5B,iBAAiB,EACjB,eAAe,EAYhB,MAAM,iBAAiB,C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AG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,QAAQ,IAAI,QAAQ,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC;gBAC5C,MAAM,IAAI,KAAK,CACb,uCAAuC,CAAC,4CAA4C,MAAM,CAAC,IAAI,IAAI,CACpG,CAAC;YACJ,CAAC;YACD,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IACD,OAAO;QACL,oBAAoB;QACpB,gBAAgB,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,15 +2,23 @@
2
2
  * Public surface of the `antpath` SDK.
3
3
  *
4
4
  * ONE class (`AntpathClient`) talks to the dashboard BFF. The CLI exposes
5
- * the SAME operations via subcommands. Everything else is types, errors,
6
- * template helpers, and event type guards re-exported from `@antpath/shared`.
5
+ * the SAME operations via subcommands. Composition primitives are
6
+ * `Skill`, `McpServer`, and `defineRun` there is no `Template`
7
+ * wrapper. Everything else is types, errors, and event type guards
8
+ * re-exported from `@antpath/shared`.
7
9
  */
8
- export { AntpathClient, RunRef } from "./client.js";
9
- export type { AntpathClientOptions, RunSubmitOptions, StreamEventsOptions, WaitForRunOptions } from "./client.js";
10
- export { AntpathApiError, AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./_shared/index.js";
11
- export { buildPlatformAllowedHosts, compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string, toPlatformSubmissionTemplate, validateProxyAuth } from "./_shared/index.js";
12
- export type { CredentialRequirement, EnvironmentDefinition, McpServerDefinition, OutputDefinition, ResolvedTemplate, ResolvedMcpServer, SkillDefinition, TemplateDefinition, TemplateVariableDefinition } from "./_shared/index.js";
13
- export type { Output, ProviderEvent, Run, RunEvent, RunSubmissionInput, SignedOutputLink, UsageSummary, WhoAmI } from "./_shared/index.js";
14
- export type { PlatformAnthropicSecrets as AnthropicSecrets, PlatformInlineSecrets as InlineSecrets, PlatformMcpServerSecret as McpServerSecret, PlatformProxyEndpoint as ProxyEndpoint, PlatformProxyEndpointAuth as ProxyEndpointAuth, PlatformProxyAuthValue as ProxyAuthValue, PlatformRunSubmissionRequest as RunSubmissionRequest, PlatformSkillReference as SkillReference, PlatformTemplateSubmission as TemplateSubmission, ProxyAuthShape, ProxyMethod, ProxyResponseMode } from "./_shared/index.js";
10
+ export { AntpathClient, RunRef, SkillsClient } from "./client.js";
11
+ export type { AntpathClientOptions, StreamEventsOptions, SubmitRunOptions, WaitForRunOptions } from "./client.js";
12
+ export { Skill } from "./skill.js";
13
+ export { McpServer } from "./mcp-server.js";
14
+ export { defineRun } from "./blueprint.js";
15
+ export type { Blueprint } from "./blueprint.js";
16
+ export { bundleSkillFiles } from "./bundle.js";
17
+ export type { BundledSkill, SkillFiles } from "./bundle.js";
18
+ export { AntpathApiError, AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError } from "./_shared/index.js";
19
+ export { MCP_SERVER_NAME_PATTERN, SKILL_BUNDLE_LIMITS, SkillBundleValidationError, buildPlatformAllowedHosts, normaliseSkillBundlePath, validateSkillBundleEntry, validateSkillBundleManifest, validateProxyAuth } from "./_shared/index.js";
20
+ export type { McpServerRef, ProviderSkillRef, SkillBundleEntry, SkillBundleManifest, SkillRef, WorkspaceSkillRef } from "./_shared/index.js";
21
+ export type { Output, ProviderEvent, Run, RunEvent, SignedOutputLink, Skill as SkillRecord, UsageSummary, WhoAmI } from "./_shared/index.js";
22
+ export type { PlatformAnthropicSecrets as AnthropicSecrets, PlatformCleanupPolicy as CleanupPolicy, PlatformInlineSecrets as InlineSecrets, PlatformMcpServerSecret as McpServerSecret, PlatformProxyEndpoint as ProxyEndpoint, PlatformProxyEndpointAuth as ProxyEndpointAuth, PlatformProxyAuthValue as ProxyAuthValue, PlatformTemplateEnvironment as RunEnvironment, ProxyAuthShape, ProxyMethod, ProxyResponseMode } from "./_shared/index.js";
15
23
  export { isAgentCustomToolUse, isAgentEvent, isAgentMcpToolResult, isAgentMcpToolUse, isAgentMessage, isAgentThinking, isAgentToolResult, isAgentToolUse, isSessionError, isSessionEvent, isSessionStatusIdle, isSessionStatusRescheduled, isSessionStatusRunning, isSessionStatusTerminated, isSpanEvent, isUserEvent, isUserMessage } from "./_shared/index.js";
16
24
  export { SecretString, redactSecrets } from "./_shared/index.js";
package/dist/index.js CHANGED
@@ -2,14 +2,21 @@
2
2
  * Public surface of the `antpath` SDK.
3
3
  *
4
4
  * ONE class (`AntpathClient`) talks to the dashboard BFF. The CLI exposes
5
- * the SAME operations via subcommands. Everything else is types, errors,
6
- * template helpers, and event type guards re-exported from `@antpath/shared`.
5
+ * the SAME operations via subcommands. Composition primitives are
6
+ * `Skill`, `McpServer`, and `defineRun` there is no `Template`
7
+ * wrapper. Everything else is types, errors, and event type guards
8
+ * re-exported from `@antpath/shared`.
7
9
  */
8
- export { AntpathClient, RunRef } from "./client.js";
10
+ export { AntpathClient, RunRef, SkillsClient } from "./client.js";
11
+ // Composition primitives
12
+ export { Skill } from "./skill.js";
13
+ export { McpServer } from "./mcp-server.js";
14
+ export { defineRun } from "./blueprint.js";
15
+ export { bundleSkillFiles } from "./bundle.js";
9
16
  // Errors
10
- export { AntpathApiError, AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError, TemplateValidationError } from "./_shared/index.js";
11
- // Template helpers
12
- export { buildPlatformAllowedHosts, compileTemplate, defineTemplate, requiredOAuthAccessToken, requiredStaticBearer, string, toPlatformSubmissionTemplate, validateProxyAuth } from "./_shared/index.js";
17
+ export { AntpathApiError, AntpathError, CleanupError, CredentialValidationError, ProviderError, RunStateError } from "./_shared/index.js";
18
+ // Skill / MCP wire types
19
+ export { MCP_SERVER_NAME_PATTERN, SKILL_BUNDLE_LIMITS, SkillBundleValidationError, buildPlatformAllowedHosts, normaliseSkillBundlePath, validateSkillBundleEntry, validateSkillBundleManifest, validateProxyAuth } from "./_shared/index.js";
13
20
  // Event type guards
14
21
  export { isAgentCustomToolUse, isAgentEvent, isAgentMcpToolResult, isAgentMcpToolUse, isAgentMessage, isAgentThinking, isAgentToolResult, isAgentToolUse, isSessionError, isSessionEvent, isSessionStatusIdle, isSessionStatusRescheduled, isSessionStatusRunning, isSessionStatusTerminated, isSpanEvent, isUserEvent, isUserMessage } from "./_shared/index.js";
15
22
  // Secret utilities
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQpD,SAAS;AACT,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAEzB,mBAAmB;AACnB,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,MAAM,EACN,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AA4CzB,oBAAoB;AACpB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQlE,yBAAyB;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,SAAS;AACT,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,yBAAyB;AACzB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAsCzB,oBAAoB;AACpB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EACzB,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,mBAAmB;AACnB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { McpServerRef, PlatformMcpServerSecret } from "./_shared/index.js";
2
+ /**
3
+ * Inline MCP server reference. Headers (typically `Authorization`) are
4
+ * vaulted server-side under `secrets.mcpServers` and excluded from the
5
+ * idempotency hash; the non-secret `{ name, url }` part is hashed.
6
+ *
7
+ * The SDK splits the header bag from the public ref BEFORE the wire
8
+ * payload is built, so a single `McpServer` instance becomes:
9
+ *
10
+ * - a `submission.mcpServers` entry of `{ name, url }`, and
11
+ * - (when `headers` is present) a `secrets.mcpServers` entry of
12
+ * `{ name, headers }`.
13
+ *
14
+ * This keeps `Authorization` out of `runs.flat_snapshot`, audit reads,
15
+ * and the idempotency fingerprint, even if the caller forgets to pass
16
+ * `secrets.mcpServers` explicitly.
17
+ */
18
+ export declare class McpServer {
19
+ readonly name: string;
20
+ readonly url: string;
21
+ readonly headers: Readonly<Record<string, string>> | undefined;
22
+ /** Internal constructor. Use `McpServer.remote(...)`. */
23
+ constructor(args: {
24
+ readonly name: string;
25
+ readonly url: string;
26
+ readonly headers?: Readonly<Record<string, string>>;
27
+ });
28
+ /** Remote MCP server reachable over HTTP(S) by URL. */
29
+ static remote(args: {
30
+ readonly name: string;
31
+ readonly url: string;
32
+ readonly headers?: Readonly<Record<string, string>>;
33
+ }): McpServer;
34
+ /** Wire shape for the non-secret `submission.mcpServers` entry. */
35
+ toSubmissionEntry(): McpServerRef;
36
+ /**
37
+ * Wire shape for the `secrets.mcpServers` entry, or `undefined` when
38
+ * no headers were provided. Returned headers are a defensive copy.
39
+ * The url is required by the BFF's cross-validation rule:
40
+ * `secrets.mcpServers[name=X].url` must equal
41
+ * `submission.mcpServers[name=X].url`.
42
+ */
43
+ toSecretEntry(): PlatformMcpServerSecret | undefined;
44
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Inline MCP server reference. Headers (typically `Authorization`) are
3
+ * vaulted server-side under `secrets.mcpServers` and excluded from the
4
+ * idempotency hash; the non-secret `{ name, url }` part is hashed.
5
+ *
6
+ * The SDK splits the header bag from the public ref BEFORE the wire
7
+ * payload is built, so a single `McpServer` instance becomes:
8
+ *
9
+ * - a `submission.mcpServers` entry of `{ name, url }`, and
10
+ * - (when `headers` is present) a `secrets.mcpServers` entry of
11
+ * `{ name, headers }`.
12
+ *
13
+ * This keeps `Authorization` out of `runs.flat_snapshot`, audit reads,
14
+ * and the idempotency fingerprint, even if the caller forgets to pass
15
+ * `secrets.mcpServers` explicitly.
16
+ */
17
+ export class McpServer {
18
+ name;
19
+ url;
20
+ headers;
21
+ /** Internal constructor. Use `McpServer.remote(...)`. */
22
+ constructor(args) {
23
+ if (!args || typeof args !== "object") {
24
+ throw new Error("McpServer: args is required");
25
+ }
26
+ if (typeof args.name !== "string" || !args.name) {
27
+ throw new Error("McpServer: name is required");
28
+ }
29
+ if (typeof args.url !== "string" || !args.url) {
30
+ throw new Error("McpServer: url is required");
31
+ }
32
+ this.name = args.name;
33
+ this.url = args.url;
34
+ this.headers = args.headers && Object.keys(args.headers).length > 0 ? { ...args.headers } : undefined;
35
+ }
36
+ /** Remote MCP server reachable over HTTP(S) by URL. */
37
+ static remote(args) {
38
+ return new McpServer(args);
39
+ }
40
+ /** Wire shape for the non-secret `submission.mcpServers` entry. */
41
+ toSubmissionEntry() {
42
+ return { name: this.name, url: this.url };
43
+ }
44
+ /**
45
+ * Wire shape for the `secrets.mcpServers` entry, or `undefined` when
46
+ * no headers were provided. Returned headers are a defensive copy.
47
+ * The url is required by the BFF's cross-validation rule:
48
+ * `secrets.mcpServers[name=X].url` must equal
49
+ * `submission.mcpServers[name=X].url`.
50
+ */
51
+ toSecretEntry() {
52
+ if (!this.headers) {
53
+ return undefined;
54
+ }
55
+ return { name: this.name, url: this.url, headers: { ...this.headers } };
56
+ }
57
+ }
58
+ //# sourceMappingURL=mcp-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,SAAS;IACX,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,OAAO,CAA+C;IAE/D,yDAAyD;IACzD,YAAY,IAA0G;QACpH,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACxG,CAAC;IAED,uDAAuD;IACvD,MAAM,CAAC,MAAM,CAAC,IAA0G;QACtH,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,mEAAmE;IACnE,iBAAiB;QACf,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACH,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IAC1E,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import type { SkillFiles } from "./bundle.js";
2
+ /**
3
+ * Walk a local directory and load every regular file into an in-memory
4
+ * `SkillFiles` map. Symlinks and non-regular files are skipped (a
5
+ * symlink that points outside the root would still be skipped because
6
+ * we use `lstat` semantics). Paths are normalised to forward-slash
7
+ * relative form so they can flow into `bundleSkillFiles` directly.
8
+ *
9
+ * Node-only. Browser callers should use `bundleSkillFiles` with a
10
+ * pre-built files map instead.
11
+ */
12
+ export declare function readDirectoryAsFiles(rootDir: string): Promise<SkillFiles>;
@@ -0,0 +1,44 @@
1
+ import { readFile, readdir, stat } from "node:fs/promises";
2
+ import { join, posix, relative, sep } from "node:path";
3
+ /**
4
+ * Walk a local directory and load every regular file into an in-memory
5
+ * `SkillFiles` map. Symlinks and non-regular files are skipped (a
6
+ * symlink that points outside the root would still be skipped because
7
+ * we use `lstat` semantics). Paths are normalised to forward-slash
8
+ * relative form so they can flow into `bundleSkillFiles` directly.
9
+ *
10
+ * Node-only. Browser callers should use `bundleSkillFiles` with a
11
+ * pre-built files map instead.
12
+ */
13
+ export async function readDirectoryAsFiles(rootDir) {
14
+ if (typeof rootDir !== "string" || !rootDir) {
15
+ throw new Error("readDirectoryAsFiles: rootDir is required");
16
+ }
17
+ const rootStat = await stat(rootDir);
18
+ if (!rootStat.isDirectory()) {
19
+ throw new Error(`readDirectoryAsFiles: ${rootDir} is not a directory`);
20
+ }
21
+ const files = {};
22
+ await walk(rootDir, rootDir, files);
23
+ return files;
24
+ }
25
+ async function walk(rootDir, currentDir, out) {
26
+ const entries = await readdir(currentDir, { withFileTypes: true });
27
+ for (const dirent of entries) {
28
+ const full = join(currentDir, dirent.name);
29
+ if (dirent.isSymbolicLink()) {
30
+ continue;
31
+ }
32
+ if (dirent.isDirectory()) {
33
+ await walk(rootDir, full, out);
34
+ continue;
35
+ }
36
+ if (!dirent.isFile()) {
37
+ continue;
38
+ }
39
+ const rel = relative(rootDir, full);
40
+ const posixPath = sep === "/" ? rel : rel.split(sep).join(posix.sep);
41
+ out[posixPath] = await readFile(full);
42
+ }
43
+ }
44
+ //# sourceMappingURL=node-fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-fs.js","sourceRoot":"","sources":["../src/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