antpath 0.4.2 → 0.6.2

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.
@@ -0,0 +1,59 @@
1
+ import type { ProviderSkillRef, Skill as SkillRecord, SkillRef } from "./_shared/index.js";
2
+ /**
3
+ * Workspace `Skill` and provider `Skill` are both modeled by ONE class with
4
+ * a discriminated wire shape under `.ref`. Keeping a single class means
5
+ * `submitRun({ skills: [...] })` accepts a uniform array; the SDK
6
+ * normalises every entry to its `ref` before sending the wire payload.
7
+ *
8
+ * Three workspace constructors:
9
+ *
10
+ * - `Skill.fromId("skl_abc123")` — reference an existing workspace
11
+ * skill without re-uploading. Useful for sharing a skill across many
12
+ * `submitRun` calls or in a `defineRun` factory.
13
+ * - `client.skills.upload({ name, files })` — inline files map (UTF-8
14
+ * strings or `Uint8Array`); SDK zips and uploads.
15
+ * - `client.skills.fromPath("./dir", { name })` — local directory; SDK
16
+ * reads, zips, and uploads (Node only).
17
+ *
18
+ * One provider constructor:
19
+ *
20
+ * - `Skill.provider({ vendor, skillId, version? })` — references a
21
+ * provider built-in skill (e.g. Anthropic web-search). Provider
22
+ * skills are NOT uploaded to your workspace and have no
23
+ * soft-delete semantics.
24
+ *
25
+ * Instances are immutable. The wire `ref` is the only state and never
26
+ * carries credentials.
27
+ */
28
+ export declare class Skill {
29
+ /** Workspace skill record returned by the BFF (only set for workspace-uploaded skills). */
30
+ readonly record: SkillRecord | undefined;
31
+ readonly ref: SkillRef;
32
+ /**
33
+ * Internal constructor. Use `Skill.fromId`, `Skill.provider`, or
34
+ * `client.skills.upload` / `client.skills.fromPath` to create
35
+ * instances.
36
+ */
37
+ constructor(ref: SkillRef, record?: SkillRecord);
38
+ /**
39
+ * Reference an existing workspace skill by its id (e.g. `skl_abc123`).
40
+ * Does NOT validate the skill exists — that check happens on the next
41
+ * `submitRun`, where the BFF rejects unknown / soft-deleted ids before
42
+ * inserting the run row.
43
+ */
44
+ static fromId(id: string): Skill;
45
+ /**
46
+ * Reference a provider built-in skill. The vendor decides what the
47
+ * `skillId` and `version` mean; the SDK only forwards the values
48
+ * verbatim to the platform.
49
+ */
50
+ static provider(args: {
51
+ readonly vendor: ProviderSkillRef["vendor"];
52
+ readonly skillId: string;
53
+ readonly version?: string;
54
+ }): Skill;
55
+ /** True for `Skill.fromId(...)` and skills returned by `client.skills.upload(...)`. */
56
+ get isWorkspace(): boolean;
57
+ /** True for `Skill.provider(...)`. */
58
+ get isProvider(): boolean;
59
+ }
package/dist/skill.js ADDED
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Workspace `Skill` and provider `Skill` are both modeled by ONE class with
3
+ * a discriminated wire shape under `.ref`. Keeping a single class means
4
+ * `submitRun({ skills: [...] })` accepts a uniform array; the SDK
5
+ * normalises every entry to its `ref` before sending the wire payload.
6
+ *
7
+ * Three workspace constructors:
8
+ *
9
+ * - `Skill.fromId("skl_abc123")` — reference an existing workspace
10
+ * skill without re-uploading. Useful for sharing a skill across many
11
+ * `submitRun` calls or in a `defineRun` factory.
12
+ * - `client.skills.upload({ name, files })` — inline files map (UTF-8
13
+ * strings or `Uint8Array`); SDK zips and uploads.
14
+ * - `client.skills.fromPath("./dir", { name })` — local directory; SDK
15
+ * reads, zips, and uploads (Node only).
16
+ *
17
+ * One provider constructor:
18
+ *
19
+ * - `Skill.provider({ vendor, skillId, version? })` — references a
20
+ * provider built-in skill (e.g. Anthropic web-search). Provider
21
+ * skills are NOT uploaded to your workspace and have no
22
+ * soft-delete semantics.
23
+ *
24
+ * Instances are immutable. The wire `ref` is the only state and never
25
+ * carries credentials.
26
+ */
27
+ export class Skill {
28
+ /** Workspace skill record returned by the BFF (only set for workspace-uploaded skills). */
29
+ record;
30
+ ref;
31
+ /**
32
+ * Internal constructor. Use `Skill.fromId`, `Skill.provider`, or
33
+ * `client.skills.upload` / `client.skills.fromPath` to create
34
+ * instances.
35
+ */
36
+ constructor(ref, record) {
37
+ this.ref = ref;
38
+ this.record = record;
39
+ }
40
+ /**
41
+ * Reference an existing workspace skill by its id (e.g. `skl_abc123`).
42
+ * Does NOT validate the skill exists — that check happens on the next
43
+ * `submitRun`, where the BFF rejects unknown / soft-deleted ids before
44
+ * inserting the run row.
45
+ */
46
+ static fromId(id) {
47
+ if (typeof id !== "string" || !id) {
48
+ throw new Error("Skill.fromId: id is required");
49
+ }
50
+ const ref = { kind: "workspace", id };
51
+ return new Skill(ref);
52
+ }
53
+ /**
54
+ * Reference a provider built-in skill. The vendor decides what the
55
+ * `skillId` and `version` mean; the SDK only forwards the values
56
+ * verbatim to the platform.
57
+ */
58
+ static provider(args) {
59
+ if (!args || typeof args !== "object") {
60
+ throw new Error("Skill.provider: args is required");
61
+ }
62
+ if (typeof args.vendor !== "string" || !args.vendor) {
63
+ throw new Error("Skill.provider: vendor is required");
64
+ }
65
+ if (typeof args.skillId !== "string" || !args.skillId) {
66
+ throw new Error("Skill.provider: skillId is required");
67
+ }
68
+ const ref = args.version
69
+ ? { kind: "provider", vendor: args.vendor, skillId: args.skillId, version: args.version }
70
+ : { kind: "provider", vendor: args.vendor, skillId: args.skillId };
71
+ return new Skill(ref);
72
+ }
73
+ /** True for `Skill.fromId(...)` and skills returned by `client.skills.upload(...)`. */
74
+ get isWorkspace() {
75
+ return this.ref.kind === "workspace";
76
+ }
77
+ /** True for `Skill.provider(...)`. */
78
+ get isProvider() {
79
+ return this.ref.kind === "provider";
80
+ }
81
+ }
82
+ //# sourceMappingURL=skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,KAAK;IAChB,2FAA2F;IAClF,MAAM,CAA0B;IAChC,GAAG,CAAW;IAEvB;;;;OAIG;IACH,YAAY,GAAa,EAAE,MAAoB;QAC7C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM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AW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC;IACvC,CAAC;IAED,sCAAsC;IACtC,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC;IACtC,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antpath",
3
- "version": "0.4.2",
3
+ "version": "0.6.2",
4
4
  "description": "TypeScript SDK for running autonomous Claude Managed Agents sessions.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,6 +30,9 @@
30
30
  "engines": {
31
31
  "node": ">=20"
32
32
  },
33
+ "dependencies": {
34
+ "fflate": "0.8.2"
35
+ },
33
36
  "scripts": {
34
37
  "build": "pnpm --filter @antpath/cli run build && pnpm --filter @antpath/shared run build && tsc -p tsconfig.build.json && node ./scripts/bundle-cli.mjs && node ./scripts/inline-shared.mjs",
35
38
  "lint": "tsc --noEmit",
@@ -37,9 +40,8 @@
37
40
  "test:unit": "vitest run test/unit",
38
41
  "test:unit:recorded": "vitest run test/unit/recorded",
39
42
  "test:load:replay": "vitest run test/unit/recorded/anthropic-replay-resilience.test.ts",
40
- "test:property": "vitest run property",
43
+ "test:property": "vitest run --passWithNoTests property",
41
44
  "test:coverage": "vitest run --coverage test/unit",
42
- "test:e2e:live": "vitest run test/e2e/live",
43
45
  "fixtures:record:anthropic": "tsx scripts/record-api-fixtures.ts",
44
46
  "fixtures:sanitize": "tsx scripts/sanitize-api-fixtures.ts",
45
47
  "publish:dry-run": "pnpm publish --dry-run --no-git-checks"