antpath 0.10.14 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +16 -8
  3. package/dist/_shared/blueprint.d.ts +93 -108
  4. package/dist/_shared/blueprint.js +144 -78
  5. package/dist/_shared/cleanup-policy.d.ts +2 -2
  6. package/dist/_shared/cleanup-policy.js +2 -5
  7. package/dist/_shared/http.d.ts +2 -2
  8. package/dist/_shared/index.d.ts +7 -1
  9. package/dist/_shared/index.js +6 -1
  10. package/dist/_shared/mcp-proxy-url.d.ts +55 -0
  11. package/dist/_shared/mcp-proxy-url.js +65 -0
  12. package/dist/_shared/operations.d.ts +55 -8
  13. package/dist/_shared/operations.js +163 -20
  14. package/dist/_shared/provider-proxy-url.d.ts +64 -0
  15. package/dist/_shared/provider-proxy-url.js +73 -0
  16. package/dist/_shared/proxy-validation.d.ts +1 -1
  17. package/dist/_shared/proxy-validation.js +2 -2
  18. package/dist/_shared/run-unit.d.ts +23 -36
  19. package/dist/_shared/run-unit.js +30 -46
  20. package/dist/_shared/runner-event.d.ts +120 -0
  21. package/dist/_shared/runner-event.js +193 -0
  22. package/dist/_shared/runner-job.d.ts +159 -0
  23. package/dist/_shared/runner-job.js +54 -0
  24. package/dist/_shared/runtime-manifest.d.ts +191 -0
  25. package/dist/_shared/runtime-manifest.js +221 -0
  26. package/dist/_shared/runtime-types.d.ts +7 -16
  27. package/dist/_shared/sse.d.ts +74 -0
  28. package/dist/_shared/sse.js +0 -0
  29. package/dist/_shared/stable.d.ts +15 -10
  30. package/dist/_shared/stable.js +15 -10
  31. package/dist/_shared/submission.d.ts +199 -73
  32. package/dist/_shared/submission.js +409 -210
  33. package/dist/_shared/telemetry.d.ts +2 -2
  34. package/dist/_shared/telemetry.js +2 -2
  35. package/dist/_shared/template/index.d.ts +0 -1
  36. package/dist/_shared/template/index.js +0 -1
  37. package/dist/agents-md.d.ts +25 -67
  38. package/dist/agents-md.js +35 -121
  39. package/dist/agents-md.js.map +1 -1
  40. package/dist/asset-upload.d.ts +34 -0
  41. package/dist/asset-upload.js +34 -0
  42. package/dist/asset-upload.js.map +1 -1
  43. package/dist/blueprint.d.ts +3 -3
  44. package/dist/bundle.d.ts +2 -2
  45. package/dist/bundle.js +1 -1
  46. package/dist/cli.mjs +559 -105
  47. package/dist/cli.mjs.sha256 +1 -1
  48. package/dist/client.d.ts +53 -22
  49. package/dist/client.js +196 -130
  50. package/dist/client.js.map +1 -1
  51. package/dist/file.d.ts +28 -94
  52. package/dist/file.js +35 -175
  53. package/dist/file.js.map +1 -1
  54. package/dist/index.d.ts +5 -5
  55. package/dist/index.js +4 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/mcp-server.d.ts +10 -2
  58. package/dist/mcp-server.js +17 -2
  59. package/dist/mcp-server.js.map +1 -1
  60. package/dist/skill.d.ts +44 -214
  61. package/dist/skill.js +50 -284
  62. package/dist/skill.js.map +1 -1
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/dist/version.js.map +1 -1
  66. package/docs/cleanup.md +1 -1
  67. package/docs/credentials.md +2 -2
  68. package/docs/events.md +8 -8
  69. package/docs/outputs.md +2 -0
  70. package/docs/quickstart.md +18 -2
  71. package/docs/skills.md +1 -3
  72. package/docs/templates.md +6 -5
  73. package/package.json +2 -1
  74. package/dist/_shared/secrets.d.ts +0 -7
  75. package/dist/_shared/secrets.js +0 -20
  76. package/dist/_shared/template/mapper.d.ts +0 -11
  77. package/dist/_shared/template/mapper.js +0 -70
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ/F,yBAAyB;AACzB,OAAO,EAA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AAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGhE,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;AAmDzB,gEAAgE;AAChE,mEAAmE;AACnE,sDAAsD;AACtD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAOzB,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,4 +1,4 @@
1
- import type { McpServerRef, PlatformMcpServerSecret } from "./_shared/index.js";
1
+ import { type McpServerRef, type PlatformMcpServerSecret, type RemoteMcpTransport } from "./_shared/index.js";
2
2
  /**
3
3
  * Wire shape for a workspace MCP server ref in `submission.mcpServers[]`.
4
4
  * The BFF resolves this to an inline `{name, url}` before the shared
@@ -35,6 +35,7 @@ export declare class McpServer {
35
35
  readonly kind: "inline" | "workspace";
36
36
  readonly name: string;
37
37
  readonly url: string;
38
+ readonly transport: RemoteMcpTransport | undefined;
38
39
  readonly id: string | undefined;
39
40
  readonly headers: Readonly<Record<string, string>> | undefined;
40
41
  /** Internal constructor. Use `McpServer.remote(...)` or `McpServer.fromId(...)`. */
@@ -43,12 +44,19 @@ export declare class McpServer {
43
44
  readonly id?: string;
44
45
  readonly name?: string;
45
46
  readonly url?: string;
47
+ readonly transport?: RemoteMcpTransport;
46
48
  readonly headers?: Readonly<Record<string, string>>;
47
49
  });
48
- /** Inline remote MCP server reachable over HTTP(S) by URL. */
50
+ /**
51
+ * Inline remote MCP server reachable over HTTP(S) by URL. `transport`
52
+ * defaults to the runtime's choice when omitted; pass it explicitly
53
+ * to pin `"http"` (streamable) or `"sse"` (event-stream). Stdio is
54
+ * not supported — see {@link rejectStdioMcpShape}.
55
+ */
49
56
  static remote(args: {
50
57
  readonly name: string;
51
58
  readonly url: string;
59
+ readonly transport?: RemoteMcpTransport;
52
60
  readonly headers?: Readonly<Record<string, string>>;
53
61
  }): McpServer;
54
62
  /**
@@ -1,3 +1,4 @@
1
+ import { rejectStdioMcpShape } from "./_shared/index.js";
1
2
  const WORKSPACE_MCP_ID_PATTERN = /^mcp_[A-Za-z0-9_-]{8,128}$/;
2
3
  /**
3
4
  * Inline MCP server reference OR a workspace-persistent ref via
@@ -24,6 +25,7 @@ export class McpServer {
24
25
  kind;
25
26
  name;
26
27
  url;
28
+ transport;
27
29
  id;
28
30
  headers;
29
31
  /** Internal constructor. Use `McpServer.remote(...)` or `McpServer.fromId(...)`. */
@@ -31,6 +33,10 @@ export class McpServer {
31
33
  if (!args || typeof args !== "object") {
32
34
  throw new Error("McpServer: args is required");
33
35
  }
36
+ // Defence in depth: any stdio-shaped input that slips past the
37
+ // builder type (callers will reach in with `as never` to feed stdio
38
+ // shapes) is rejected with the canonical error.
39
+ rejectStdioMcpShape(args);
34
40
  if (args.kind === "workspace") {
35
41
  if (typeof args.id !== "string" || !WORKSPACE_MCP_ID_PATTERN.test(args.id)) {
36
42
  throw new Error(`McpServer.fromId: id must match ${WORKSPACE_MCP_ID_PATTERN.source}`);
@@ -42,6 +48,7 @@ export class McpServer {
42
48
  // ref so callers can branch.
43
49
  this.name = "";
44
50
  this.url = "";
51
+ this.transport = undefined;
45
52
  this.headers = undefined;
46
53
  return;
47
54
  }
@@ -55,9 +62,15 @@ export class McpServer {
55
62
  this.id = undefined;
56
63
  this.name = args.name;
57
64
  this.url = args.url;
65
+ this.transport = args.transport;
58
66
  this.headers = args.headers && Object.keys(args.headers).length > 0 ? { ...args.headers } : undefined;
59
67
  }
60
- /** Inline remote MCP server reachable over HTTP(S) by URL. */
68
+ /**
69
+ * Inline remote MCP server reachable over HTTP(S) by URL. `transport`
70
+ * defaults to the runtime's choice when omitted; pass it explicitly
71
+ * to pin `"http"` (streamable) or `"sse"` (event-stream). Stdio is
72
+ * not supported — see {@link rejectStdioMcpShape}.
73
+ */
61
74
  static remote(args) {
62
75
  return new McpServer({ kind: "inline", ...args });
63
76
  }
@@ -75,7 +88,9 @@ export class McpServer {
75
88
  if (this.kind === "workspace") {
76
89
  return { kind: "workspace", id: this.id };
77
90
  }
78
- return { name: this.name, url: this.url };
91
+ return this.transport
92
+ ? { name: this.name, transport: this.transport, url: this.url }
93
+ : { name: this.name, url: this.url };
79
94
  }
80
95
  /**
81
96
  * Wire shape for the `secrets.mcpServers` entry, or `undefined`
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AAEA,MAAM,wBAAwB,GAAG,4BAA4B,CAAC;AAc9D;;;;;;;;;;;;;;;;;;;;GAoBG;A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C,SAAS;YACnB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;YAC/D,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;IACzC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,aAAa;QACX,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC/C,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"}
package/dist/skill.d.ts CHANGED
@@ -1,95 +1,46 @@
1
- import { type ProviderSkillRef, type Skill as SkillRecord, type SkillRef } from "./_shared/index.js";
1
+ import { type ProviderSkillRef, type SkillRef } from "./_shared/index.js";
2
2
  import { type SkillFiles } from "./bundle.js";
3
3
  /**
4
- * One `Skill` class, one mental model, three usage modes:
5
- *
6
- * - **Workspace** — uploaded to the antpath platform and reused across
7
- * runs.
8
- * ```ts
9
- * const persisted = await Skill.fromFiles({ name, files }).upload(client);
10
- * // or
11
- * const ref = Skill.fromId("skl_abc123");
12
- * ```
4
+ * One `Skill` class, two usage modes:
13
5
  *
14
6
  * - **Provider built-in** — references a provider-side skill (e.g.
15
7
  * Anthropic's `pdf` / `xlsx` / `docx` / `pptx` prebuilt Agent
16
- * Skills). Not uploaded to your workspace.
8
+ * Skills). Not uploaded.
17
9
  * ```ts
18
10
  * const pdf = Skill.provider({ vendor: "anthropic", skillId: "pdf" });
19
11
  * ```
20
- * Note: Anthropic web search is a Messages-API *tool*
21
- * (`{ type: "web_search_…" }`), not an Agent Skill — `Skill.provider`
22
- * does not enable it.
23
12
  *
24
- * - **Transient (per-run)** — built from local files, never persisted.
25
- * The bytes ride alongside `submitRun` as a multipart part and the
26
- * BFF tears them down at run terminal.
13
+ * - **Local bytes** — built from local files. `client.submitRun`
14
+ * materializes the bytes to R2 (content-addressable, workspace-
15
+ * scoped) before the run lands; the wire ref becomes `kind:"r2"`.
27
16
  * ```ts
28
17
  * const rules = await Skill.fromFiles({ name: "rules", files: {...} });
29
18
  * await client.submitRun({ skills: [rules], ... });
30
19
  * ```
31
20
  *
32
- * ## Lifecycle of an unstaged transient Skill
33
- *
34
- * After `Skill.fromFiles(...)` returns, the Skill is "unstaged transient":
35
- *
36
- * 1. Passing it to `submitRun` uploads the bytes for that one run only
37
- * and assigns a positional slot id (`transient-0`, `transient-1`, …).
38
- * The same instance may be passed to multiple `submitRun` calls
39
- * until it is consumed by `.upload(...)`.
40
- *
41
- * 2. Calling `await skill.upload(client)` persists the bundle to the
42
- * workspace skill store and returns a **new** `Skill` instance
43
- * whose `.ref.kind === "workspace"`. The **original** is marked
44
- * **consumed**:
45
- * - any further use in `submitRun` throws a clear validation error,
46
- * - `.upload(...)` on the consumed instance throws,
47
- * - `JSON.stringify` / `toJSON()` on the consumed instance throws.
48
- *
49
- * Use the returned (workspace) Skill from then on. The consumed
50
- * reference exists only to surface the mistake loudly the first
51
- * time the user re-uses it; it never silently re-uploads as
52
- * transient.
53
- *
54
- * Unstaged transient Skills do NOT round-trip through JSON (the bytes
55
- * cannot be serialised back). `toJSON()` throws in that state too —
56
- * persist via `.upload(client)` first, or pass the unstaged Skill
57
- * directly to `submitRun`.
58
- *
59
- * The Skill class is the only public way to build a transient bundle;
60
- * the SDK never accepts a raw `TransientSkillRef` object from user code.
21
+ * The workspace pre-upload concept is gone — R2's content-addressable
22
+ * dedup at submit time makes the same bytes a no-op upload on subsequent
23
+ * runs. There is no `Skill.fromId(...)` and no `.upload(client)`.
61
24
  */
62
25
  export declare class Skill {
63
26
  #private;
64
- /** Workspace skill record returned by the BFF (only set for workspace-uploaded skills). */
65
- readonly record: SkillRecord | undefined;
66
27
  /**
67
- * Internal constructor. Use `Skill.fromId`, `Skill.provider`,
68
- * `Skill.fromFiles`, or `Skill.fromPath` to create instances.
28
+ * Internal constructor. Use `Skill.provider`, `Skill.fromFiles`, or
29
+ * `Skill.fromPath` to create instances.
69
30
  */
70
- constructor(ref: SkillRef, record?: SkillRecord, transientBytes?: Uint8Array);
31
+ constructor(ref: SkillRef | DraftSkillRef, inlineBytes?: Uint8Array);
71
32
  /**
72
- * The wire-level reference. For workspace and provider skills this is
73
- * stable. For unstaged transient skills it carries the placeholder
74
- * `slot: "(unstaged)"` `submitRun` rewrites the slot to a real
75
- * positional id (`transient-0`, …) before sending.
76
- *
77
- * For consumed Skills, the getter still returns the original
78
- * transient ref so error messages can be precise — but using a
79
- * consumed Skill in any submit/serialise path throws.
33
+ * The wire-level reference. Returns the SDK-private draft shape for
34
+ * un-materialized skills (kind:"draft", with name + contentHash).
35
+ * `client.submitRun` walks these and uploads to R2 before the run
36
+ * lands.
80
37
  */
81
- get ref(): SkillRef;
82
- /**
83
- * Reference an existing workspace skill by its id (e.g. `skl_abc123`).
84
- * Does NOT validate the skill exists — that check happens on the next
85
- * `submitRun`, where the BFF rejects unknown / soft-deleted ids before
86
- * inserting the run row.
87
- */
88
- static fromId(id: string): Skill;
38
+ get ref(): SkillRef | DraftSkillRef;
39
+ /** True for local-bytes Skills that haven't been uploaded yet. */
40
+ get isDraft(): boolean;
41
+ get isConsumed(): boolean;
89
42
  /**
90
- * Reference a provider built-in skill. The vendor decides what the
91
- * `skillId` and `version` mean; the SDK only forwards the values
92
- * verbatim to the platform.
43
+ * Reference a provider built-in skill (e.g. Anthropic Skills).
93
44
  */
94
45
  static provider(args: {
95
46
  readonly vendor: ProviderSkillRef["vendor"];
@@ -97,168 +48,47 @@ export declare class Skill {
97
48
  readonly version?: string;
98
49
  }): Skill;
99
50
  /**
100
- * Build an unstaged transient Skill from an inline files map. The SDK
101
- * validates basic safety (no path traversal, size caps, has
102
- * `SKILL.md`), deterministically zips the bundle, and computes the
103
- * `sha256:<hex>` content hash that travels in the wire ref.
104
- *
105
- * The returned Skill carries the bytes privately. Pass it to
106
- * `submitRun` for transient (per-run) use, or call `.upload(client)`
107
- * to persist it as a workspace skill.
51
+ * Build a draft Skill from an inline files map. The SDK validates
52
+ * basic safety (no path traversal, size caps, has `SKILL.md`),
53
+ * deterministically zips the bundle, and computes the
54
+ * `sha256:<hex>` content hash. `client.submitRun` materializes
55
+ * these to R2 before the run lands.
108
56
  */
109
57
  static fromFiles(args: {
110
58
  readonly name: string;
111
59
  readonly files: SkillFiles;
112
60
  }): Promise<Skill>;
113
61
  /**
114
- * Read a local directory and build an unstaged transient Skill.
115
- * Symlinks and non-regular files are skipped. Node-only.
116
- *
117
- * The returned Skill behaves identically to one built via
118
- * `Skill.fromFiles` — pass it to `submitRun` for transient use, or
119
- * call `.upload(client)` to persist as a workspace skill.
62
+ * Read a local directory and build a draft Skill. Symlinks and
63
+ * non-regular files are skipped. Node-only.
120
64
  */
121
65
  static fromPath(rootDir: string, args: {
122
66
  readonly name: string;
123
67
  }): Promise<Skill>;
124
68
  /**
125
- * Persist this unstaged transient Skill as a workspace skill and
126
- * return a new `Skill` instance backed by the resulting `skl_*`
127
- * record. After `upload` resolves successfully, the original
128
- * instance is marked **consumed** any further use throws a clear
129
- * validation error.
130
- *
131
- * Only unstaged transient Skills can be uploaded. Calling this on a
132
- * workspace-ref Skill, a provider-ref Skill, or a previously
133
- * consumed Skill throws.
69
+ * Internal: yield the draft's bytes + metadata so `client.submitRun`
70
+ * can upload to R2. After this returns, the Skill is marked consumed
71
+ * so a second submitRun call against the same instance throws
72
+ * (avoid silently re-uploading; explicit re-construction is the
73
+ * supported retry pattern).
134
74
  *
135
- * Accepts either an `AntpathClient` (preferred) or its
136
- * `SkillsClient` if the caller already has a handle to it.
75
+ * Returns undefined for non-draft (provider / already-materialized)
76
+ * Skills.
137
77
  */
138
- upload(client: SkillUploader): Promise<Skill>;
139
- /**
140
- * Persist this unstaged transient Skill as a workspace skill **only
141
- * if** an existing skill with the same `(name, contentHash)` is not
142
- * already live.
143
- *
144
- * Flow:
145
- *
146
- * 1. Hash is already known from `Skill.fromFiles` / `fromPath`.
147
- * 2. Call `client.skills.findByHash({ name, contentHash })`. If a
148
- * live row exists, mark this instance consumed and return a
149
- * new `Skill` backed by that record.
150
- * 3. Otherwise call `upload(client)`.
151
- *
152
- * Returns either the existing or newly-created workspace Skill;
153
- * callers do not need to branch.
154
- *
155
- * Only unstaged transient Skills can be `uploadIfChanged`. Calling
156
- * this on a workspace-ref Skill, a provider-ref Skill, or a
157
- * previously consumed Skill throws.
158
- */
159
- uploadIfChanged(client: SkillUploader & SkillLookup): Promise<Skill>;
160
- /** True for `Skill.fromId(...)` and skills returned by `.upload(...)`. */
161
- get isWorkspace(): boolean;
162
- /** True for `Skill.provider(...)`. */
163
- get isProvider(): boolean;
164
- /** True for any transient Skill (unstaged or consumed). */
165
- get isTransient(): boolean;
166
- /**
167
- * True only while the transient Skill still carries bytes and has
168
- * not been consumed by `.upload(...)`. Unstaged Skills can be passed
169
- * to `submitRun` or `.upload(client)`; consumed ones cannot.
170
- */
171
- get isUnstaged(): boolean;
172
- /** True after a successful `.upload(...)` — using this instance further throws. */
173
- get isConsumed(): boolean;
174
- /**
175
- * Internal: yield the unstaged transient bundle's payload so the
176
- * client's `submitRun` can build a multipart part. Returns undefined
177
- * for non-transient or consumed skills. Throws if the instance is
178
- * marked consumed (a stronger signal than "no bytes").
179
- *
180
- * NOT part of the public API — the `_` prefix is a "do not call from
181
- * user code" marker. Callers within the SDK pass the returned bytes
182
- * into the multipart body once per `submitRun` invocation.
183
- */
184
- _takeUnstagedBundle(): {
78
+ _takeDraftBundle(): {
185
79
  name: string;
186
- bytes: Uint8Array;
187
80
  contentHash: string;
81
+ bytes: Uint8Array;
188
82
  } | undefined;
189
- /**
190
- * JSON serialisation guard. Workspace and provider Skills serialise
191
- * to their `ref`. Unstaged transient Skills throw — the bytes are not
192
- * in the JSON, so a round-trip would silently drop them. Consumed
193
- * Skills also throw, to surface the "you forgot to use the returned
194
- * Skill from `.upload(...)`" mistake at the point it happens.
195
- */
196
83
  toJSON(): SkillRef;
197
84
  }
198
85
  /**
199
- * Anything that can persist a skill bundle. Both `AntpathClient` and
200
- * the internal `SkillsClient` satisfy this shape — `Skill.upload`
201
- * accepts either, but the SDK consumer only ever sees the
202
- * `AntpathClient`-based path.
203
- */
204
- export interface SkillUploader {
205
- readonly _uploadSkillBundle?: (args: {
206
- readonly name: string;
207
- readonly body: Uint8Array;
208
- }) => Promise<SkillRecord>;
209
- readonly skills?: {
210
- readonly _uploadSkillBundle?: (args: {
211
- readonly name: string;
212
- readonly body: Uint8Array;
213
- }) => Promise<SkillRecord>;
214
- };
215
- /**
216
- * Optional chunked-upload entry point. Present on `AntpathClient`
217
- * when the BFF supports `POST /api/assets/upload-init` and
218
- * `POST /api/assets/finalize`. When absent, bundles > 6 MiB throw
219
- * an informative error.
220
- */
221
- readonly _chunkedUpload?: ChunkedUploadClient;
222
- }
223
- /** Internal interface for the three-step TUS upload flow. */
224
- export interface ChunkedUploadClient {
225
- readonly init: (args: {
226
- readonly kind: "skill" | "file";
227
- readonly name: string;
228
- readonly sizeBytes: number;
229
- readonly hash: string;
230
- }) => Promise<{
231
- readonly assetId: string;
232
- readonly storagePath: string;
233
- readonly tusUrl: string;
234
- readonly tusToken: string;
235
- readonly expiresAt: string;
236
- readonly uploadHeaders: Readonly<Record<string, string>>;
237
- }>;
238
- readonly finalize: (args: {
239
- readonly assetId: string;
240
- readonly kind: "skill" | "file";
241
- readonly hash: string;
242
- readonly storagePath: string;
243
- }) => Promise<void>;
244
- }
245
- /**
246
- * Anything that can look up an existing workspace skill by hash. Used
247
- * by `Skill.uploadIfChanged` — both `AntpathClient` (via
248
- * `.skills.findByHash`) and the internal `SkillsClient` satisfy this
249
- * shape. The lookup is optional so test doubles for `upload` need not
250
- * implement it; in that case `uploadIfChanged` simply falls back to
251
- * a plain `upload`.
86
+ * SDK-internal draft skill marker. Never reaches the wire; the
87
+ * materialize step inside `client.submitRun` converts these to
88
+ * `kind:"r2"` refs.
252
89
  */
253
- export interface SkillLookup {
254
- readonly skills?: {
255
- readonly findByHash?: (args: {
256
- readonly name: string;
257
- readonly contentHash: string;
258
- }) => Promise<SkillRecord | null>;
259
- };
260
- readonly findByHash?: (args: {
261
- readonly name: string;
262
- readonly contentHash: string;
263
- }) => Promise<SkillRecord | null>;
90
+ export interface DraftSkillRef {
91
+ readonly kind: "draft";
92
+ readonly name: string;
93
+ readonly contentHash: string;
264
94
  }