@agentproto/skill 0.2.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/chunk-GZK4KIZA.mjs +113 -0
- package/dist/chunk-GZK4KIZA.mjs.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.mjs +14 -0
- package/dist/index.mjs.map +1 -0
- package/dist/manifest/index.d.ts +28 -0
- package/dist/manifest/index.mjs +28 -0
- package/dist/manifest/index.mjs.map +1 -0
- package/dist/schema-yW7X0mwK.d.ts +200 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agentproto contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @agentproto/skill
|
|
2
|
+
|
|
3
|
+
AIP-3 `SKILL.md` reference implementation. A markdown + frontmatter format for distributing reusable agent skills as portable, version-controlled files.
|
|
4
|
+
|
|
5
|
+
> **Status: 0.1.0-alpha.** Generated by `scripts/scaffold-aip.mjs` — `build()` and `validate()` bodies are TODOs.
|
|
6
|
+
|
|
7
|
+
Spec: <https://agentproto.sh/docs/aip-3>
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { defineSkill } from "@agentproto/skill"
|
|
13
|
+
|
|
14
|
+
const x = defineSkill({
|
|
15
|
+
id: "my-skill",
|
|
16
|
+
description: "Short purpose.",
|
|
17
|
+
// ...
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createDoctype } from '@agentproto/define-doctype';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @agentproto/skill v0.1.0-alpha
|
|
6
|
+
* AIP-3 SKILL.md `defineSkill` reference implementation.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var NAME_PATTERN = /^[a-z0-9](?:[a-z0-9]|-(?!-))*[a-z0-9]$|^[a-z0-9]$/;
|
|
10
|
+
var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:[-+][a-zA-Z0-9.-]+)?$/;
|
|
11
|
+
var TAG_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
12
|
+
var executionSchema = z.object({
|
|
13
|
+
language: z.enum(["typescript", "javascript", "python", "shell"]).describe("Implementation language. Runtimes MAY refuse languages they don't support."),
|
|
14
|
+
code: z.union([
|
|
15
|
+
z.object({
|
|
16
|
+
file: z.string().min(1).describe(
|
|
17
|
+
"Relative path to the entry file. SHOULD live under `scripts/`. Path traversal segments escaping the skill dir MUST be rejected."
|
|
18
|
+
)
|
|
19
|
+
}).strict(),
|
|
20
|
+
z.object({
|
|
21
|
+
inline: z.string().describe("Inline source. Runtimes MUST sandbox before executing.")
|
|
22
|
+
}).strict()
|
|
23
|
+
]).describe("Exactly one of { file } or { inline }. File paths are relative to SKILL.md."),
|
|
24
|
+
entrypoint: z.string().min(1).optional(),
|
|
25
|
+
runtime: z.object({
|
|
26
|
+
provider: z.string().optional(),
|
|
27
|
+
timeout: z.number().int().positive().optional(),
|
|
28
|
+
memory: z.string().optional()
|
|
29
|
+
}).strict().optional(),
|
|
30
|
+
artifacts: z.object({
|
|
31
|
+
patterns: z.array(z.string()).min(1)
|
|
32
|
+
}).strict().optional(),
|
|
33
|
+
dependencies: z.record(z.string(), z.string()).optional()
|
|
34
|
+
}).strict().describe("Executable bindings. Required when variant=executable.");
|
|
35
|
+
var aip3ExtensionsSchema = z.object({
|
|
36
|
+
schema: z.literal("skills/v1").describe("Schema dispatch tag. Required for AIP-3 conformance."),
|
|
37
|
+
variant: z.enum(["instruction", "executable", "composite"]).default("instruction").describe(
|
|
38
|
+
"Skill variant. `instruction` is prose-only (default); `executable` bundles runnable code via `execution`; `composite` references other skills via `uses`."
|
|
39
|
+
),
|
|
40
|
+
version: z.string().regex(SEMVER_PATTERN).optional().describe("Semver. Bump on breaking changes to the skill's behavior or required tools."),
|
|
41
|
+
tags: z.array(z.string().regex(TAG_PATTERN)).max(12).default([]).describe("Catalog tags. Lowercase kebab-case; no leading symbols. 3\u20136 tags is typical."),
|
|
42
|
+
category: z.string().min(1).max(64).optional().describe(
|
|
43
|
+
"Coarse grouping (e.g. 'productivity', 'creative', 'development'). Free-form; runtimes SHOULD NOT enumerate."
|
|
44
|
+
),
|
|
45
|
+
requires: z.array(z.number().int().positive()).default([]).describe(
|
|
46
|
+
"Other AIPs this skill depends on (e.g. `[9]` for the operator runtime). Runtimes MAY warn when a declared dependency is unsupported."
|
|
47
|
+
),
|
|
48
|
+
author: z.string().max(200).optional().describe(
|
|
49
|
+
"Optional. Conventional shape: 'Name <email>' or stable handle. Mirrors agentskills.io's `metadata.author` convention; if both are present, `metadata.aip3.author` wins for AIP-3 runtimes."
|
|
50
|
+
),
|
|
51
|
+
title: z.string().min(1).max(120).optional().describe(
|
|
52
|
+
"Optional human-readable display title. Headless runtimes that can't render the body H1 MAY use this. The body H1 is preferred."
|
|
53
|
+
),
|
|
54
|
+
uses: z.array(z.string().regex(NAME_PATTERN)).default([]).describe(
|
|
55
|
+
"Skill names this skill composes with. Required and non-empty when variant=composite."
|
|
56
|
+
),
|
|
57
|
+
execution: executionSchema.optional()
|
|
58
|
+
}).loose();
|
|
59
|
+
var skillFrontmatterSchema = z.object({
|
|
60
|
+
name: z.string().min(1).max(64).regex(NAME_PATTERN).describe(
|
|
61
|
+
"Machine identifier. 1\u201364 chars, lowercase alphanumeric and hyphens only, no leading/trailing/consecutive hyphens. MUST equal the parent directory name. Inherited verbatim from agentskills.io."
|
|
62
|
+
),
|
|
63
|
+
description: z.string().min(1).max(1024).describe(
|
|
64
|
+
"One-paragraph purpose. SHOULD describe both what the skill does and when to use it. Inherited from agentskills.io (1024-char cap)."
|
|
65
|
+
),
|
|
66
|
+
license: z.string().max(200).optional().describe(
|
|
67
|
+
"Optional. License identifier (SPDX or pointer to a bundled license file). Inherited from agentskills.io."
|
|
68
|
+
),
|
|
69
|
+
compatibility: z.string().min(1).max(500).optional().describe(
|
|
70
|
+
"Optional. Free-form environment requirements: intended product, system packages, network access, etc. Most skills omit this."
|
|
71
|
+
),
|
|
72
|
+
"allowed-tools": z.string().optional().describe(
|
|
73
|
+
"Optional. Space-separated list of pre-approved tool patterns (e.g. 'Bash(git:*) Read'). Experimental upstream \u2014 runtimes MAY ignore. The field is a request, not a grant."
|
|
74
|
+
),
|
|
75
|
+
metadata: z.object({ aip3: aip3ExtensionsSchema.optional() }).loose().default({}).describe(
|
|
76
|
+
"Free-form key-value mapping. Hosts and standards stash extension fields under namespaced keys (e.g. `metadata.aip3.*`, `metadata.acme.*`). Inherited from agentskills.io."
|
|
77
|
+
)
|
|
78
|
+
}).loose().describe(
|
|
79
|
+
"Validates the YAML frontmatter portion of an AIP-3 SKILL.md manifest. AIP-3 is a profile of agentskills.io."
|
|
80
|
+
);
|
|
81
|
+
var defineSkill = createDoctype({
|
|
82
|
+
aip: 3,
|
|
83
|
+
name: "skill",
|
|
84
|
+
readIdentity: (def) => def.name,
|
|
85
|
+
validate(def) {
|
|
86
|
+
const result = skillFrontmatterSchema.safeParse(def);
|
|
87
|
+
if (!result.success) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`defineSkill (AIP-3): ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
const aip3 = result.data.metadata?.aip3;
|
|
93
|
+
if (!aip3) return;
|
|
94
|
+
const variant = aip3.variant ?? "instruction";
|
|
95
|
+
if (variant === "executable" && !aip3.execution) {
|
|
96
|
+
throw new Error(
|
|
97
|
+
"defineSkill (AIP-3): metadata.aip3.execution is required when metadata.aip3.variant=executable"
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
if (variant === "composite" && (!aip3.uses || aip3.uses.length === 0)) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
"defineSkill (AIP-3): metadata.aip3.uses must be non-empty when metadata.aip3.variant=composite"
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
build(def) {
|
|
107
|
+
return { ...def };
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export { aip3ExtensionsSchema, defineSkill, skillFrontmatterSchema };
|
|
112
|
+
//# sourceMappingURL=chunk-GZK4KIZA.mjs.map
|
|
113
|
+
//# sourceMappingURL=chunk-GZK4KIZA.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"chunk-GZK4KIZA.mjs","sourcesContent":["/**\n * AIP-3 SKILL.md frontmatter zod schema.\n *\n * Mirrors `resources/aip-3/draft/SKILL.schema.json` field-for-field.\n * AIP-3 is a profile of agentskills.io — top-level fields are the\n * canonical agentskills.io frontmatter; AIP-3 extensions live under\n * `metadata.aip3.*` so a skill authored against AIP-3 remains a valid\n * agentskills.io skill in any conformant runtime.\n *\n * Both authoring paths (`define-skill.ts` for TS-authored skills and\n * `manifest/index.ts` for SKILL.md parsing) validate against this\n * schema, so every field-level constraint runs in both paths from a\n * single source of truth.\n *\n * Cross-field rules (variant=executable ⇒ execution required;\n * variant=composite ⇒ uses non-empty) live in `define-skill.ts`'s\n * `validate(def)` body — they're harder to encode in a flat zod\n * schema and want a single error path.\n */\n\nimport { z } from \"zod\"\n\n/** agentskills.io `name` rule: 1–64, kebab, no leading/trailing/consecutive `-`. */\nconst NAME_PATTERN = /^[a-z0-9](?:[a-z0-9]|-(?!-))*[a-z0-9]$|^[a-z0-9]$/\n\nconst SEMVER_PATTERN = /^\\d+\\.\\d+\\.\\d+(?:[-+][a-zA-Z0-9.-]+)?$/\nconst TAG_PATTERN = /^[a-z][a-z0-9-]*$/\n\nconst executionSchema = z\n .object({\n language: z\n .enum([\"typescript\", \"javascript\", \"python\", \"shell\"])\n .describe(\"Implementation language. Runtimes MAY refuse languages they don't support.\"),\n code: z\n .union([\n z\n .object({\n file: z\n .string()\n .min(1)\n .describe(\n \"Relative path to the entry file. SHOULD live under `scripts/`. Path traversal segments escaping the skill dir MUST be rejected.\",\n ),\n })\n .strict(),\n z\n .object({\n inline: z\n .string()\n .describe(\"Inline source. Runtimes MUST sandbox before executing.\"),\n })\n .strict(),\n ])\n .describe(\"Exactly one of { file } or { inline }. File paths are relative to SKILL.md.\"),\n entrypoint: z.string().min(1).optional(),\n runtime: z\n .object({\n provider: z.string().optional(),\n timeout: z.number().int().positive().optional(),\n memory: z.string().optional(),\n })\n .strict()\n .optional(),\n artifacts: z\n .object({\n patterns: z.array(z.string()).min(1),\n })\n .strict()\n .optional(),\n dependencies: z.record(z.string(), z.string()).optional(),\n })\n .strict()\n .describe(\"Executable bindings. Required when variant=executable.\")\n\nexport const aip3ExtensionsSchema = z\n .object({\n schema: z\n .literal(\"skills/v1\")\n .describe(\"Schema dispatch tag. Required for AIP-3 conformance.\"),\n variant: z\n .enum([\"instruction\", \"executable\", \"composite\"])\n .default(\"instruction\")\n .describe(\n \"Skill variant. `instruction` is prose-only (default); `executable` bundles runnable code via `execution`; `composite` references other skills via `uses`.\",\n ),\n version: z\n .string()\n .regex(SEMVER_PATTERN)\n .optional()\n .describe(\"Semver. Bump on breaking changes to the skill's behavior or required tools.\"),\n tags: z\n .array(z.string().regex(TAG_PATTERN))\n .max(12)\n .default([])\n .describe(\"Catalog tags. Lowercase kebab-case; no leading symbols. 3–6 tags is typical.\"),\n category: z\n .string()\n .min(1)\n .max(64)\n .optional()\n .describe(\n \"Coarse grouping (e.g. 'productivity', 'creative', 'development'). Free-form; runtimes SHOULD NOT enumerate.\",\n ),\n requires: z\n .array(z.number().int().positive())\n .default([])\n .describe(\n \"Other AIPs this skill depends on (e.g. `[9]` for the operator runtime). Runtimes MAY warn when a declared dependency is unsupported.\",\n ),\n author: z\n .string()\n .max(200)\n .optional()\n .describe(\n \"Optional. Conventional shape: 'Name <email>' or stable handle. Mirrors agentskills.io's `metadata.author` convention; if both are present, `metadata.aip3.author` wins for AIP-3 runtimes.\",\n ),\n title: z\n .string()\n .min(1)\n .max(120)\n .optional()\n .describe(\n \"Optional human-readable display title. Headless runtimes that can't render the body H1 MAY use this. The body H1 is preferred.\",\n ),\n uses: z\n .array(z.string().regex(NAME_PATTERN))\n .default([])\n .describe(\n \"Skill names this skill composes with. Required and non-empty when variant=composite.\",\n ),\n execution: executionSchema.optional(),\n })\n .loose()\n\nexport const skillFrontmatterSchema = z\n .object({\n name: z\n .string()\n .min(1)\n .max(64)\n .regex(NAME_PATTERN)\n .describe(\n \"Machine identifier. 1–64 chars, lowercase alphanumeric and hyphens only, no leading/trailing/consecutive hyphens. MUST equal the parent directory name. Inherited verbatim from agentskills.io.\",\n ),\n description: z\n .string()\n .min(1)\n .max(1024)\n .describe(\n \"One-paragraph purpose. SHOULD describe both what the skill does and when to use it. Inherited from agentskills.io (1024-char cap).\",\n ),\n license: z\n .string()\n .max(200)\n .optional()\n .describe(\n \"Optional. License identifier (SPDX or pointer to a bundled license file). Inherited from agentskills.io.\",\n ),\n compatibility: z\n .string()\n .min(1)\n .max(500)\n .optional()\n .describe(\n \"Optional. Free-form environment requirements: intended product, system packages, network access, etc. Most skills omit this.\",\n ),\n \"allowed-tools\": z\n .string()\n .optional()\n .describe(\n \"Optional. Space-separated list of pre-approved tool patterns (e.g. 'Bash(git:*) Read'). Experimental upstream — runtimes MAY ignore. The field is a request, not a grant.\",\n ),\n metadata: z\n .object({ aip3: aip3ExtensionsSchema.optional() })\n .loose()\n .default({})\n .describe(\n \"Free-form key-value mapping. Hosts and standards stash extension fields under namespaced keys (e.g. `metadata.aip3.*`, `metadata.acme.*`). Inherited from agentskills.io.\",\n ),\n })\n .loose()\n .describe(\n \"Validates the YAML frontmatter portion of an AIP-3 SKILL.md manifest. AIP-3 is a profile of agentskills.io.\",\n )\n\nexport type SkillFrontmatter = z.infer<typeof skillFrontmatterSchema>\nexport type Aip3Extensions = z.infer<typeof aip3ExtensionsSchema>\n","import { createDoctype } from \"@agentproto/define-doctype\"\nimport { skillFrontmatterSchema } from \"./schema.js\"\nimport type { SkillDefinition, SkillHandle } from \"./types.js\"\n\n/**\n * AIP-3 reference implementation of `defineSkill`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineSkill (AIP-3): …\"\n * error prefix) run uniformly with every other AIP defineX.\n *\n * Field-level validation runs the schema-derived zod from\n * `./schema.ts` against the input. Same source of truth as the .md\n * path uses (`parseSkillManifest`), so a malformed TS-authored\n * definition fails with the same diagnostic as a malformed manifest.\n *\n * Cross-field rules — variant=executable requires `metadata.aip3.execution`;\n * variant=composite requires non-empty `metadata.aip3.uses` — run after\n * the zod check so callers see one consistent error path.\n *\n * Identity / description extractors detected from the JSON Schema:\n * readIdentity: def.name\n * readDescription: def.description.\n */\nexport const defineSkill = createDoctype<SkillDefinition, SkillHandle>({\n aip: 3,\n name: \"skill\",\n readIdentity: (def) => def.name,\n validate(def) {\n const result = skillFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineSkill (AIP-3): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n\n const aip3 = result.data.metadata?.aip3\n if (!aip3) return\n\n const variant = aip3.variant ?? \"instruction\"\n if (variant === \"executable\" && !aip3.execution) {\n throw new Error(\n \"defineSkill (AIP-3): metadata.aip3.execution is required when metadata.aip3.variant=executable\",\n )\n }\n if (variant === \"composite\" && (!aip3.uses || aip3.uses.length === 0)) {\n throw new Error(\n \"defineSkill (AIP-3): metadata.aip3.uses must be non-empty when metadata.aip3.variant=composite\",\n )\n }\n },\n build(def) {\n return { ...def } as SkillHandle\n },\n})\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { S as SkillDefinition } from './schema-yW7X0mwK.js';
|
|
2
|
+
export { A as Aip3Extensions, a as SkillExecution, b as SkillExecutionLanguage, c as SkillFrontmatter, d as SkillHandle, e as SkillVariant, f as aip3ExtensionsSchema, s as skillFrontmatterSchema } from './schema-yW7X0mwK.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AIP-3 reference implementation of `defineSkill`.
|
|
7
|
+
*
|
|
8
|
+
* Built on `createDoctype` so the cross-AIP invariants (id pattern,
|
|
9
|
+
* description length, top-level freeze, "defineSkill (AIP-3): …"
|
|
10
|
+
* error prefix) run uniformly with every other AIP defineX.
|
|
11
|
+
*
|
|
12
|
+
* Field-level validation runs the schema-derived zod from
|
|
13
|
+
* `./schema.ts` against the input. Same source of truth as the .md
|
|
14
|
+
* path uses (`parseSkillManifest`), so a malformed TS-authored
|
|
15
|
+
* definition fails with the same diagnostic as a malformed manifest.
|
|
16
|
+
*
|
|
17
|
+
* Cross-field rules — variant=executable requires `metadata.aip3.execution`;
|
|
18
|
+
* variant=composite requires non-empty `metadata.aip3.uses` — run after
|
|
19
|
+
* the zod check so callers see one consistent error path.
|
|
20
|
+
*
|
|
21
|
+
* Identity / description extractors detected from the JSON Schema:
|
|
22
|
+
* readIdentity: def.name
|
|
23
|
+
* readDescription: def.description.
|
|
24
|
+
*/
|
|
25
|
+
declare const defineSkill: (def: SkillDefinition) => Readonly<SkillDefinition>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @agentproto/skill — AIP-3 SKILL.md `defineSkill` reference impl.
|
|
29
|
+
*
|
|
30
|
+
* A markdown + frontmatter format for distributing reusable agent skills as portable, version-controlled files.
|
|
31
|
+
*
|
|
32
|
+
* Spec: https://agentproto.sh/docs/aip-3
|
|
33
|
+
*
|
|
34
|
+
* Authoring paths:
|
|
35
|
+
* - TS: `defineSkill({...})` → `SkillHandle`
|
|
36
|
+
* - MD: `parseSkillManifest(src) → skillFromManifest({...})` → `SkillHandle`
|
|
37
|
+
*/
|
|
38
|
+
declare const SPEC_NAME: "agentskill/v1";
|
|
39
|
+
declare const SPEC_VERSION: "2.0.0-alpha";
|
|
40
|
+
|
|
41
|
+
export { SPEC_NAME, SPEC_VERSION, SkillDefinition, defineSkill };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { aip3ExtensionsSchema, defineSkill, skillFrontmatterSchema } from './chunk-GZK4KIZA.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @agentproto/skill v0.1.0-alpha
|
|
5
|
+
* AIP-3 SKILL.md `defineSkill` reference implementation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
var SPEC_NAME = "agentskill/v1";
|
|
10
|
+
var SPEC_VERSION = "2.0.0-alpha";
|
|
11
|
+
|
|
12
|
+
export { SPEC_NAME, SPEC_VERSION };
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAYO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["/**\n * @agentproto/skill — AIP-3 SKILL.md `defineSkill` reference impl.\n *\n * A markdown + frontmatter format for distributing reusable agent skills as portable, version-controlled files.\n *\n * Spec: https://agentproto.sh/docs/aip-3\n *\n * Authoring paths:\n * - TS: `defineSkill({...})` → `SkillHandle`\n * - MD: `parseSkillManifest(src) → skillFromManifest({...})` → `SkillHandle`\n */\n\nexport const SPEC_NAME = \"agentskill/v1\" as const\nexport const SPEC_VERSION = \"2.0.0-alpha\" as const\n\nexport { defineSkill } from \"./define-skill.js\"\nexport { skillFrontmatterSchema, aip3ExtensionsSchema } from \"./schema.js\"\nexport type { SkillFrontmatter, Aip3Extensions } from \"./schema.js\"\nexport type {\n SkillDefinition,\n SkillHandle,\n SkillVariant,\n SkillExecution,\n SkillExecutionLanguage,\n} from \"./types.js\"\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { c as SkillFrontmatter, d as SkillHandle } from '../schema-yW7X0mwK.js';
|
|
2
|
+
export { s as skillFrontmatterSchema } from '../schema-yW7X0mwK.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AIP-3 SKILL.md sidecar parser + manifest-to-handle constructor.
|
|
7
|
+
*
|
|
8
|
+
* Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:
|
|
9
|
+
* the .md provides metadata; the TS module supplies any spec-specific
|
|
10
|
+
* runtime bits (schemas, execute bodies, …) that can't live in
|
|
11
|
+
* frontmatter. Both inputs end up in `defineSkill` so the cross-AIP
|
|
12
|
+
* invariants run uniformly.
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* The frontmatter zod schema below was generated from
|
|
16
|
+
* `resources/aip-3/draft/SKILL.schema.json` via json-schema-to-zod.
|
|
17
|
+
* Re-run scaffold-aip to refresh after spec changes (or hand-tune
|
|
18
|
+
* any constraint the converter doesn't capture cleanly).
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface SkillManifest {
|
|
22
|
+
frontmatter: SkillFrontmatter;
|
|
23
|
+
body: string;
|
|
24
|
+
}
|
|
25
|
+
declare function parseSkillManifest(source: string): SkillManifest;
|
|
26
|
+
declare function skillFromManifest(manifest: SkillManifest): SkillHandle;
|
|
27
|
+
|
|
28
|
+
export { SkillFrontmatter, type SkillManifest, parseSkillManifest, skillFromManifest };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { skillFrontmatterSchema, defineSkill } from '../chunk-GZK4KIZA.mjs';
|
|
2
|
+
export { skillFrontmatterSchema } from '../chunk-GZK4KIZA.mjs';
|
|
3
|
+
import matter from 'gray-matter';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @agentproto/skill v0.1.0-alpha
|
|
7
|
+
* AIP-3 SKILL.md `defineSkill` reference implementation.
|
|
8
|
+
*/
|
|
9
|
+
function parseSkillManifest(source) {
|
|
10
|
+
const parsed = matter(source);
|
|
11
|
+
if (Object.keys(parsed.data).length === 0) {
|
|
12
|
+
throw new Error("parseSkillManifest: missing or empty frontmatter");
|
|
13
|
+
}
|
|
14
|
+
const result = skillFrontmatterSchema.safeParse(parsed.data);
|
|
15
|
+
if (!result.success) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`parseSkillManifest: invalid frontmatter \u2014 ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return { frontmatter: result.data, body: parsed.content };
|
|
21
|
+
}
|
|
22
|
+
function skillFromManifest(manifest) {
|
|
23
|
+
return defineSkill(manifest.frontmatter);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { parseSkillManifest, skillFromManifest };
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
28
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/manifest/index.ts"],"names":[],"mappings":";;;;;;;;AA8BO,SAAS,mBAAmB,MAAA,EAA+B;AAChE,EAAA,MAAM,MAAA,GAAS,OAAO,MAAM,CAAA;AAC5B,EAAA,IAAI,OAAO,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA,CAAE,WAAW,CAAA,EAAG;AACzC,IAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,EACpE;AACA,EAAA,MAAM,MAAA,GAAS,sBAAA,CAAuB,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA;AAC3D,EAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,+CAAA,EAA6C,OAAO,KAAA,CAAM,MAAA,CACvD,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,KACf;AAAA,EACF;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,OAAO,OAAA,EAAQ;AAC1D;AAEO,SAAS,kBAAkB,QAAA,EAAsC;AAKtE,EAAA,OAAO,WAAA,CAAY,SAAS,WAAyC,CAAA;AACvE","file":"index.mjs","sourcesContent":["/**\n * AIP-3 SKILL.md sidecar parser + manifest-to-handle constructor.\n *\n * Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:\n * the .md provides metadata; the TS module supplies any spec-specific\n * runtime bits (schemas, execute bodies, …) that can't live in\n * frontmatter. Both inputs end up in `defineSkill` so the cross-AIP\n * invariants run uniformly.\n *\n *\n * The frontmatter zod schema below was generated from\n * `resources/aip-3/draft/SKILL.schema.json` via json-schema-to-zod.\n * Re-run scaffold-aip to refresh after spec changes (or hand-tune\n * any constraint the converter doesn't capture cleanly).\n */\n\nimport matter from \"gray-matter\"\nimport { skillFrontmatterSchema, type SkillFrontmatter } from \"../schema.js\"\nimport { defineSkill } from \"../define-skill.js\"\nimport type { SkillDefinition, SkillHandle } from \"../types.js\"\n\n// Re-export so consumers can import the schema + inferred type either\n// from \"@@agentproto/skill/manifest\" or directly from \"@@agentproto/skill/schema\".\nexport { skillFrontmatterSchema, type SkillFrontmatter }\n\nexport interface SkillManifest {\n frontmatter: SkillFrontmatter\n body: string\n}\n\nexport function parseSkillManifest(source: string): SkillManifest {\n const parsed = matter(source)\n if (Object.keys(parsed.data).length === 0) {\n throw new Error(\"parseSkillManifest: missing or empty frontmatter\")\n }\n const result = skillFrontmatterSchema.safeParse(parsed.data)\n if (!result.success) {\n throw new Error(\n `parseSkillManifest: invalid frontmatter — ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n return { frontmatter: result.data, body: parsed.content }\n}\n\nexport function skillFromManifest(manifest: SkillManifest): SkillHandle {\n // The zod-validated frontmatter is structurally compatible with\n // SkillDefinition; the cast pins the typing once the manifest\n // schema and the TS interface diverge (e.g. handle has frozen fields\n // a literal config doesn't carry yet).\n return defineSkill(manifest.frontmatter as unknown as SkillDefinition)\n}\n"]}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AIP-3 SkillDefinition + SkillHandle.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors `resources/aip-3/draft/SKILL.schema.json`. AIP-3 is a profile
|
|
7
|
+
* of agentskills.io: top-level fields are the canonical agentskills.io
|
|
8
|
+
* frontmatter; AIP-3 extensions live under `metadata.aip3.*`.
|
|
9
|
+
*
|
|
10
|
+
* `SkillHandle` is the readonly view of the same shape; tighten it by
|
|
11
|
+
* hand for fields that get defaults applied in build().
|
|
12
|
+
*/
|
|
13
|
+
type SkillVariant = "instruction" | "executable" | "composite";
|
|
14
|
+
type SkillExecutionLanguage = "typescript" | "javascript" | "python" | "shell";
|
|
15
|
+
interface SkillExecution {
|
|
16
|
+
/** Implementation language. */
|
|
17
|
+
language: SkillExecutionLanguage;
|
|
18
|
+
/** Exactly one of { file } or { inline }. */
|
|
19
|
+
code: {
|
|
20
|
+
file: string;
|
|
21
|
+
} | {
|
|
22
|
+
inline: string;
|
|
23
|
+
};
|
|
24
|
+
/** Optional function name within the entry file. */
|
|
25
|
+
entrypoint?: string;
|
|
26
|
+
/** Optional runtime hints (provider, timeout, memory). */
|
|
27
|
+
runtime?: {
|
|
28
|
+
provider?: string;
|
|
29
|
+
timeout?: number;
|
|
30
|
+
memory?: string;
|
|
31
|
+
};
|
|
32
|
+
/** Glob patterns of output files the runtime should capture. */
|
|
33
|
+
artifacts?: {
|
|
34
|
+
patterns: string[];
|
|
35
|
+
};
|
|
36
|
+
/** Package -> version map. */
|
|
37
|
+
dependencies?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
/** AIP-3 extensions to the agentskills.io baseline. Lives under `metadata.aip3`. */
|
|
40
|
+
interface Aip3Extensions$1 {
|
|
41
|
+
/** Schema dispatch tag. Required for AIP-3 conformance. */
|
|
42
|
+
schema: "skills/v1";
|
|
43
|
+
/** Skill variant. Defaults to "instruction" when omitted. */
|
|
44
|
+
variant?: SkillVariant;
|
|
45
|
+
/** Semver. */
|
|
46
|
+
version?: string;
|
|
47
|
+
/** Catalog tags. Lowercase kebab-case. */
|
|
48
|
+
tags?: string[];
|
|
49
|
+
/** Coarse grouping. Free-form. */
|
|
50
|
+
category?: string;
|
|
51
|
+
/** Other AIPs this skill depends on (e.g. [9] for the operator runtime). */
|
|
52
|
+
requires?: number[];
|
|
53
|
+
/** Author identifier. */
|
|
54
|
+
author?: string;
|
|
55
|
+
/** Optional human-readable display title (body H1 preferred). */
|
|
56
|
+
title?: string;
|
|
57
|
+
/** Skill names this skill composes with. Non-empty when variant=composite. */
|
|
58
|
+
uses?: string[];
|
|
59
|
+
/** Executable bindings. Required when variant=executable. */
|
|
60
|
+
execution?: SkillExecution;
|
|
61
|
+
/** AIP-3 extensions stay open: vendors MAY add namespaced sub-keys. */
|
|
62
|
+
[extension: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* AIP-3 SKILL.md frontmatter. The top-level fields mirror
|
|
66
|
+
* agentskills.io 1:1 so AIP-3 skills are valid agentskills.io skills.
|
|
67
|
+
*/
|
|
68
|
+
interface SkillDefinition {
|
|
69
|
+
/** Machine identifier — kebab, 1–64 chars, matches parent dir. */
|
|
70
|
+
name: string;
|
|
71
|
+
/** One-paragraph purpose, written for the LLM caller. ≤1024 chars. */
|
|
72
|
+
description: string;
|
|
73
|
+
/** Optional license identifier or pointer to a bundled license file. */
|
|
74
|
+
license?: string;
|
|
75
|
+
/** Optional environment requirements. */
|
|
76
|
+
compatibility?: string;
|
|
77
|
+
/** Optional space-separated tool allowlist. Request, not grant. */
|
|
78
|
+
"allowed-tools"?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Free-form key-value map. Houses AIP-3 extensions at
|
|
81
|
+
* `metadata.aip3` and any vendor-namespaced extras.
|
|
82
|
+
*/
|
|
83
|
+
metadata?: {
|
|
84
|
+
aip3?: Aip3Extensions$1;
|
|
85
|
+
[vendor: string]: unknown;
|
|
86
|
+
};
|
|
87
|
+
/** Top-level extension surface preserved for forward compatibility. */
|
|
88
|
+
[extension: string]: unknown;
|
|
89
|
+
}
|
|
90
|
+
type SkillHandle = Readonly<SkillDefinition>;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* AIP-3 SKILL.md frontmatter zod schema.
|
|
94
|
+
*
|
|
95
|
+
* Mirrors `resources/aip-3/draft/SKILL.schema.json` field-for-field.
|
|
96
|
+
* AIP-3 is a profile of agentskills.io — top-level fields are the
|
|
97
|
+
* canonical agentskills.io frontmatter; AIP-3 extensions live under
|
|
98
|
+
* `metadata.aip3.*` so a skill authored against AIP-3 remains a valid
|
|
99
|
+
* agentskills.io skill in any conformant runtime.
|
|
100
|
+
*
|
|
101
|
+
* Both authoring paths (`define-skill.ts` for TS-authored skills and
|
|
102
|
+
* `manifest/index.ts` for SKILL.md parsing) validate against this
|
|
103
|
+
* schema, so every field-level constraint runs in both paths from a
|
|
104
|
+
* single source of truth.
|
|
105
|
+
*
|
|
106
|
+
* Cross-field rules (variant=executable ⇒ execution required;
|
|
107
|
+
* variant=composite ⇒ uses non-empty) live in `define-skill.ts`'s
|
|
108
|
+
* `validate(def)` body — they're harder to encode in a flat zod
|
|
109
|
+
* schema and want a single error path.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
declare const aip3ExtensionsSchema: z.ZodObject<{
|
|
113
|
+
schema: z.ZodLiteral<"skills/v1">;
|
|
114
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
115
|
+
instruction: "instruction";
|
|
116
|
+
executable: "executable";
|
|
117
|
+
composite: "composite";
|
|
118
|
+
}>>;
|
|
119
|
+
version: z.ZodOptional<z.ZodString>;
|
|
120
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
121
|
+
category: z.ZodOptional<z.ZodString>;
|
|
122
|
+
requires: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
123
|
+
author: z.ZodOptional<z.ZodString>;
|
|
124
|
+
title: z.ZodOptional<z.ZodString>;
|
|
125
|
+
uses: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
126
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
language: z.ZodEnum<{
|
|
128
|
+
typescript: "typescript";
|
|
129
|
+
javascript: "javascript";
|
|
130
|
+
python: "python";
|
|
131
|
+
shell: "shell";
|
|
132
|
+
}>;
|
|
133
|
+
code: z.ZodUnion<readonly [z.ZodObject<{
|
|
134
|
+
file: z.ZodString;
|
|
135
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
136
|
+
inline: z.ZodString;
|
|
137
|
+
}, z.core.$strict>]>;
|
|
138
|
+
entrypoint: z.ZodOptional<z.ZodString>;
|
|
139
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
141
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, z.core.$strict>>;
|
|
144
|
+
artifacts: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
patterns: z.ZodArray<z.ZodString>;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
148
|
+
}, z.core.$strict>>;
|
|
149
|
+
}, z.core.$loose>;
|
|
150
|
+
declare const skillFrontmatterSchema: z.ZodObject<{
|
|
151
|
+
name: z.ZodString;
|
|
152
|
+
description: z.ZodString;
|
|
153
|
+
license: z.ZodOptional<z.ZodString>;
|
|
154
|
+
compatibility: z.ZodOptional<z.ZodString>;
|
|
155
|
+
"allowed-tools": z.ZodOptional<z.ZodString>;
|
|
156
|
+
metadata: z.ZodDefault<z.ZodObject<{
|
|
157
|
+
aip3: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
schema: z.ZodLiteral<"skills/v1">;
|
|
159
|
+
variant: z.ZodDefault<z.ZodEnum<{
|
|
160
|
+
instruction: "instruction";
|
|
161
|
+
executable: "executable";
|
|
162
|
+
composite: "composite";
|
|
163
|
+
}>>;
|
|
164
|
+
version: z.ZodOptional<z.ZodString>;
|
|
165
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
166
|
+
category: z.ZodOptional<z.ZodString>;
|
|
167
|
+
requires: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
168
|
+
author: z.ZodOptional<z.ZodString>;
|
|
169
|
+
title: z.ZodOptional<z.ZodString>;
|
|
170
|
+
uses: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
171
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
language: z.ZodEnum<{
|
|
173
|
+
typescript: "typescript";
|
|
174
|
+
javascript: "javascript";
|
|
175
|
+
python: "python";
|
|
176
|
+
shell: "shell";
|
|
177
|
+
}>;
|
|
178
|
+
code: z.ZodUnion<readonly [z.ZodObject<{
|
|
179
|
+
file: z.ZodString;
|
|
180
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
+
inline: z.ZodString;
|
|
182
|
+
}, z.core.$strict>]>;
|
|
183
|
+
entrypoint: z.ZodOptional<z.ZodString>;
|
|
184
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
186
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
memory: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
artifacts: z.ZodOptional<z.ZodObject<{
|
|
190
|
+
patterns: z.ZodArray<z.ZodString>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
193
|
+
}, z.core.$strict>>;
|
|
194
|
+
}, z.core.$loose>>;
|
|
195
|
+
}, z.core.$loose>>;
|
|
196
|
+
}, z.core.$loose>;
|
|
197
|
+
type SkillFrontmatter = z.infer<typeof skillFrontmatterSchema>;
|
|
198
|
+
type Aip3Extensions = z.infer<typeof aip3ExtensionsSchema>;
|
|
199
|
+
|
|
200
|
+
export { type Aip3Extensions as A, type SkillDefinition as S, type SkillExecution as a, type SkillExecutionLanguage as b, type SkillFrontmatter as c, type SkillHandle as d, type SkillVariant as e, aip3ExtensionsSchema as f, skillFrontmatterSchema as s };
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentproto/skill",
|
|
3
|
+
"version": "0.2.0-alpha.0",
|
|
4
|
+
"description": "@agentproto/skill — AIP-3 SKILL.md reference implementation. A markdown + frontmatter format for distributing reusable agent skills as portable, version-controlled files.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agentproto",
|
|
7
|
+
"aip-3",
|
|
8
|
+
"skill",
|
|
9
|
+
"defineSkill",
|
|
10
|
+
"open-standard",
|
|
11
|
+
"agentic"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://agentproto.sh/docs/aip-3",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/agentproto/ts",
|
|
17
|
+
"directory": "packages/skill"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/agentproto/ts/issues"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "dist/index.mjs",
|
|
25
|
+
"module": "dist/index.mjs",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.mjs",
|
|
31
|
+
"default": "./dist/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./manifest": {
|
|
34
|
+
"types": "./dist/manifest/index.d.ts",
|
|
35
|
+
"import": "./dist/manifest/index.mjs",
|
|
36
|
+
"default": "./dist/manifest/index.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"gray-matter": "^4.0.3",
|
|
50
|
+
"zod": "^4.4.3",
|
|
51
|
+
"@agentproto/define-doctype": "0.1.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^25.6.2",
|
|
55
|
+
"tsup": "^8.5.1",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vitest": "^3.2.4",
|
|
58
|
+
"@agentproto/tooling": "0.1.0-alpha.0"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"dev": "tsup --watch",
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"clean": "rm -rf dist",
|
|
64
|
+
"check-types": "tsc --noEmit",
|
|
65
|
+
"test": "vitest run --passWithNoTests",
|
|
66
|
+
"test:watch": "vitest"
|
|
67
|
+
}
|
|
68
|
+
}
|