@agentproto/design 0.1.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 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/design
2
+
3
+ AIP-4 `DESIGN.md` reference implementation. A markdown + frontmatter format for portable design tokens, and the registry conventions used by designkit.sh to share community kits.
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-4>
8
+
9
+ ## Usage
10
+
11
+ ```ts
12
+ import { defineDesign } from "@agentproto/design"
13
+
14
+ const x = defineDesign({
15
+ id: "my-design",
16
+ description: "Short purpose.",
17
+ // ...
18
+ })
19
+ ```
20
+
21
+ ## License
22
+
23
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { createDoctype } from '@agentproto/define-doctype';
3
+
4
+ /**
5
+ * @agentproto/design v0.1.0-alpha
6
+ * AIP-4 DESIGN.md `defineDesign` reference implementation.
7
+ */
8
+
9
+ var designFrontmatterSchema = z.object({ "schema": z.literal("designkit/v1").describe("Pins the registry schema this kit conforms to. Required for registry submission.").optional(), "kit": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).min(2).max(48).describe("Kebab-case kit identifier. Namespaced by the registry on publish."), "title": z.string().min(1).max(80).describe("Human-readable display name."), "description": z.string().max(500).describe("One-paragraph summary surfaced in registry search results.").optional(), "version": z.string().regex(new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][a-zA-Z0-9.-]+)?$")).describe("Semver of THIS kit. Bump on token change.").optional(), "author": z.string().describe("Display name of the author / maintainer.").optional(), "license": z.string().describe("SPDX identifier or 'proprietary' for private brand kits.").optional(), "homepage": z.string().url().optional(), "preview": z.string().url().describe("URL to a screenshot of the kit applied to a reference surface.").optional(), "tags": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*$"))).min(0).max(12).default([]), "based-on": z.string().describe("URI of a parent DESIGN.md to compose on top of. Depth-limited to 3.").optional(), "mode": z.enum(["light", "dark", "both"]).describe("Default surface mode. 'both' requires a sibling 'variants' block.").default("light"), "colors": z.any(), "typography": z.any(), "spacing": z.any().optional(), "rounded": z.any().optional(), "shadows": z.any().optional(), "motion": z.object({ "duration": z.any().optional(), "easing": z.any().optional() }).strict().optional(), "variants": z.object({ "dark": z.any().optional(), "light": z.any().optional() }).strict().describe("Delta blocks per mode. Only tokens that differ from the base are listed.").optional(), "metadata": z.record(z.string(), z.any()).describe("Host-namespaced extension fields. Other hosts MUST tolerate unknown keys here.").default({}) }).strict().and(z.any()).describe("Validates the YAML frontmatter portion of an AIP-4 DESIGN.md design-token kit.");
10
+ var defineDesign = createDoctype({
11
+ aip: 4,
12
+ name: "design",
13
+ readDescription: (def) => def.title,
14
+ validate(def) {
15
+ const result = designFrontmatterSchema.safeParse(def);
16
+ if (!result.success) {
17
+ throw new Error(
18
+ `defineDesign (AIP-4): ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
19
+ );
20
+ }
21
+ },
22
+ build(def) {
23
+ return { ...def };
24
+ }
25
+ });
26
+
27
+ export { defineDesign, designFrontmatterSchema };
28
+ //# sourceMappingURL=chunk-MKBO32WH.mjs.map
29
+ //# sourceMappingURL=chunk-MKBO32WH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema.ts","../src/define-design.ts"],"names":[],"mappings":";;;;;;;;AAeO,IAAM,uBAAA,GAA0B,CAAA,CAAE,MAAA,CAAO,EAAE,QAAA,EAAU,CAAA,CAAE,OAAA,CAAQ,cAAc,CAAA,CAAE,QAAA,CAAS,kFAAkF,CAAA,CAAE,QAAA,EAAS,EAAG,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,IAAI,MAAA,CAAO,2BAA2B,CAAC,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,EAAE,CAAA,CAAE,QAAA,CAAS,mEAAmE,CAAA,EAAG,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,EAAE,CAAA,CAAE,QAAA,CAAS,8BAA8B,CAAA,EAAG,aAAA,EAAe,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,QAAA,CAAS,4DAA4D,CAAA,CAAE,QAAA,EAAS,EAAG,SAAA,EAAW,CAAA,CAAE,QAAO,CAAE,KAAA,CAAM,IAAI,MAAA,CAAO,6CAA6C,CAAC,CAAA,CAAE,QAAA,CAAS,2CAA2C,CAAA,CAAE,QAAA,EAAS,EAAG,QA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AAC","file":"chunk-MKBO32WH.mjs","sourcesContent":["/**\n * AIP-4 DESIGN.md frontmatter zod schema.\n *\n * Generated from `resources/aip-4/draft/DESIGN.schema.json` via\n * json-schema-to-zod. Imported by both `define-design.ts` (TS path\n * validation) and `manifest/index.ts` (.md path validation) so every\n * field-level constraint runs in both authoring paths from a single\n * source of truth — re-run scaffold-aip to refresh after spec changes.\n *\n * Cross-field rules (if/then/allOf in JSON Schema) don't translate\n * cleanly and live in `define-design.ts`'s `validate(def)` instead.\n */\n\nimport { z } from \"zod\"\n\nexport const designFrontmatterSchema = z.object({ \"schema\": z.literal(\"designkit/v1\").describe(\"Pins the registry schema this kit conforms to. Required for registry submission.\").optional(), \"kit\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(48).describe(\"Kebab-case kit identifier. Namespaced by the registry on publish.\"), \"title\": z.string().min(1).max(80).describe(\"Human-readable display name.\"), \"description\": z.string().max(500).describe(\"One-paragraph summary surfaced in registry search results.\").optional(), \"version\": z.string().regex(new RegExp(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:[-+][a-zA-Z0-9.-]+)?$\")).describe(\"Semver of THIS kit. Bump on token change.\").optional(), \"author\": z.string().describe(\"Display name of the author / maintainer.\").optional(), \"license\": z.string().describe(\"SPDX identifier or 'proprietary' for private brand kits.\").optional(), \"homepage\": z.string().url().optional(), \"preview\": z.string().url().describe(\"URL to a screenshot of the kit applied to a reference surface.\").optional(), \"tags\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\"))).min(0).max(12).default([] as never), \"based-on\": z.string().describe(\"URI of a parent DESIGN.md to compose on top of. Depth-limited to 3.\").optional(), \"mode\": z.enum([\"light\",\"dark\",\"both\"]).describe(\"Default surface mode. 'both' requires a sibling 'variants' block.\").default(\"light\"), \"colors\": z.any(), \"typography\": z.any(), \"spacing\": z.any().optional(), \"rounded\": z.any().optional(), \"shadows\": z.any().optional(), \"motion\": z.object({ \"duration\": z.any().optional(), \"easing\": z.any().optional() }).strict().optional(), \"variants\": z.object({ \"dark\": z.any().optional(), \"light\": z.any().optional() }).strict().describe(\"Delta blocks per mode. Only tokens that differ from the base are listed.\").optional(), \"metadata\": z.record(z.string(), z.any()).describe(\"Host-namespaced extension fields. Other hosts MUST tolerate unknown keys here.\").default({} as never) }).strict().and(z.any()).describe(\"Validates the YAML frontmatter portion of an AIP-4 DESIGN.md design-token kit.\")\n\nexport type DesignFrontmatter = z.infer<typeof designFrontmatterSchema>\n","import { createDoctype } from \"@agentproto/define-doctype\"\nimport { designFrontmatterSchema } from \"./schema.js\"\nimport type { DesignDefinition, DesignHandle } from \"./types.js\"\n\n/**\n * AIP-4 reference implementation of `defineDesign`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineDesign (AIP-4): …\"\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 (`parseDesignManifest`), so a malformed TS-authored\n * definition fails with the same diagnostic as a malformed manifest.\n * Cross-field rules go in `validate(def)` after the zod check.\n *\n * Identity / description extractors detected from the JSON Schema:\n * readIdentity: def.id\n * readDescription: def.title.\n */\nexport const defineDesign = createDoctype<DesignDefinition, DesignHandle>({\n aip: 4,\n name: \"design\",\n readDescription: (def) => def.title,\n validate(def) {\n const result = designFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineDesign (AIP-4): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n // TODO: spec-4-specific cross-field rules (if/then/allOf in\n // the JSON Schema) — those don't translate to zod cleanly and\n // belong here. See @agentproto/operator's autonomy=gated rule.\n },\n build(def) {\n // Default build: spread the validated definition into a fresh object.\n // Hand-tune for nested freezing (Object.freeze on arrays/objects) and\n // for fields that need defaults applied — see @agentproto/operator\n // for a reference shape.\n return { ...def } as DesignHandle\n },\n})\n"]}
@@ -0,0 +1,37 @@
1
+ import { D as DesignDefinition } from './types-BVevIEvK.js';
2
+ export { a as DesignHandle } from './types-BVevIEvK.js';
3
+
4
+ /**
5
+ * AIP-4 reference implementation of `defineDesign`.
6
+ *
7
+ * Built on `createDoctype` so the cross-AIP invariants (id pattern,
8
+ * description length, top-level freeze, "defineDesign (AIP-4): …"
9
+ * error prefix) run uniformly with every other AIP defineX.
10
+ *
11
+ * Field-level validation runs the schema-derived zod from
12
+ * `./schema.ts` against the input. Same source of truth as the .md
13
+ * path uses (`parseDesignManifest`), so a malformed TS-authored
14
+ * definition fails with the same diagnostic as a malformed manifest.
15
+ * Cross-field rules go in `validate(def)` after the zod check.
16
+ *
17
+ * Identity / description extractors detected from the JSON Schema:
18
+ * readIdentity: def.id
19
+ * readDescription: def.title.
20
+ */
21
+ declare const defineDesign: (def: DesignDefinition) => Readonly<DesignDefinition>;
22
+
23
+ /**
24
+ * @agentproto/design — AIP-4 DESIGN.md `defineDesign` reference impl.
25
+ *
26
+ * A markdown + frontmatter format for portable design tokens, and the registry conventions used by designkit.sh to share community kits.
27
+ *
28
+ * Spec: https://agentproto.sh/docs/aip-4
29
+ *
30
+ * Authoring paths:
31
+ * - TS: `defineDesign({...})` → `DesignHandle`
32
+ * - MD: `parseDesignManifest(src) → designFromManifest({...})` → `DesignHandle`
33
+ */
34
+ declare const SPEC_NAME: "agentdesign/v1";
35
+ declare const SPEC_VERSION: "1.0.0-alpha";
36
+
37
+ export { DesignDefinition, SPEC_NAME, SPEC_VERSION, defineDesign };
package/dist/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ export { defineDesign } from './chunk-MKBO32WH.mjs';
2
+
3
+ /**
4
+ * @agentproto/design v0.1.0-alpha
5
+ * AIP-4 DESIGN.md `defineDesign` reference implementation.
6
+ */
7
+
8
+ // src/index.ts
9
+ var SPEC_NAME = "agentdesign/v1";
10
+ var SPEC_VERSION = "1.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/design — AIP-4 DESIGN.md `defineDesign` reference impl.\n *\n * A markdown + frontmatter format for portable design tokens, and the registry conventions used by designkit.sh to share community kits.\n *\n * Spec: https://agentproto.sh/docs/aip-4\n *\n * Authoring paths:\n * - TS: `defineDesign({...})` → `DesignHandle`\n * - MD: `parseDesignManifest(src) → designFromManifest({...})` → `DesignHandle`\n */\n\nexport const SPEC_NAME = \"agentdesign/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineDesign } from \"./define-design.js\"\nexport type { DesignDefinition, DesignHandle } from \"./types.js\"\n"]}
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ import { a as DesignHandle } from '../types-BVevIEvK.js';
3
+
4
+ /**
5
+ * AIP-4 DESIGN.md frontmatter zod schema.
6
+ *
7
+ * Generated from `resources/aip-4/draft/DESIGN.schema.json` via
8
+ * json-schema-to-zod. Imported by both `define-design.ts` (TS path
9
+ * validation) and `manifest/index.ts` (.md path validation) so every
10
+ * field-level constraint runs in both authoring paths from a single
11
+ * source of truth — re-run scaffold-aip to refresh after spec changes.
12
+ *
13
+ * Cross-field rules (if/then/allOf in JSON Schema) don't translate
14
+ * cleanly and live in `define-design.ts`'s `validate(def)` instead.
15
+ */
16
+
17
+ declare const designFrontmatterSchema: z.ZodIntersection<z.ZodObject<{
18
+ schema: z.ZodOptional<z.ZodLiteral<"designkit/v1">>;
19
+ kit: z.ZodString;
20
+ title: z.ZodString;
21
+ description: z.ZodOptional<z.ZodString>;
22
+ version: z.ZodOptional<z.ZodString>;
23
+ author: z.ZodOptional<z.ZodString>;
24
+ license: z.ZodOptional<z.ZodString>;
25
+ homepage: z.ZodOptional<z.ZodString>;
26
+ preview: z.ZodOptional<z.ZodString>;
27
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
28
+ "based-on": z.ZodOptional<z.ZodString>;
29
+ mode: z.ZodDefault<z.ZodEnum<{
30
+ light: "light";
31
+ dark: "dark";
32
+ both: "both";
33
+ }>>;
34
+ colors: z.ZodAny;
35
+ typography: z.ZodAny;
36
+ spacing: z.ZodOptional<z.ZodAny>;
37
+ rounded: z.ZodOptional<z.ZodAny>;
38
+ shadows: z.ZodOptional<z.ZodAny>;
39
+ motion: z.ZodOptional<z.ZodObject<{
40
+ duration: z.ZodOptional<z.ZodAny>;
41
+ easing: z.ZodOptional<z.ZodAny>;
42
+ }, z.core.$strict>>;
43
+ variants: z.ZodOptional<z.ZodObject<{
44
+ dark: z.ZodOptional<z.ZodAny>;
45
+ light: z.ZodOptional<z.ZodAny>;
46
+ }, z.core.$strict>>;
47
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
48
+ }, z.core.$strict>, z.ZodAny>;
49
+ type DesignFrontmatter = z.infer<typeof designFrontmatterSchema>;
50
+
51
+ /**
52
+ * AIP-4 DESIGN.md sidecar parser + manifest-to-handle constructor.
53
+ *
54
+ * Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:
55
+ * the .md provides metadata; the TS module supplies any spec-specific
56
+ * runtime bits (schemas, execute bodies, …) that can't live in
57
+ * frontmatter. Both inputs end up in `defineDesign` so the cross-AIP
58
+ * invariants run uniformly.
59
+ *
60
+ *
61
+ * The frontmatter zod schema below was generated from
62
+ * `resources/aip-4/draft/DESIGN.schema.json` via json-schema-to-zod.
63
+ * Re-run scaffold-aip to refresh after spec changes (or hand-tune
64
+ * any constraint the converter doesn't capture cleanly).
65
+ */
66
+
67
+ interface DesignManifest {
68
+ frontmatter: DesignFrontmatter;
69
+ body: string;
70
+ }
71
+ declare function parseDesignManifest(source: string): DesignManifest;
72
+ declare function designFromManifest(manifest: DesignManifest): DesignHandle;
73
+
74
+ export { type DesignFrontmatter, type DesignManifest, designFromManifest, designFrontmatterSchema, parseDesignManifest };
@@ -0,0 +1,28 @@
1
+ import { designFrontmatterSchema, defineDesign } from '../chunk-MKBO32WH.mjs';
2
+ export { designFrontmatterSchema } from '../chunk-MKBO32WH.mjs';
3
+ import matter from 'gray-matter';
4
+
5
+ /**
6
+ * @agentproto/design v0.1.0-alpha
7
+ * AIP-4 DESIGN.md `defineDesign` reference implementation.
8
+ */
9
+ function parseDesignManifest(source) {
10
+ const parsed = matter(source);
11
+ if (Object.keys(parsed.data).length === 0) {
12
+ throw new Error("parseDesignManifest: missing or empty frontmatter");
13
+ }
14
+ const result = designFrontmatterSchema.safeParse(parsed.data);
15
+ if (!result.success) {
16
+ throw new Error(
17
+ `parseDesignManifest: 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 designFromManifest(manifest) {
23
+ return defineDesign(manifest.frontmatter);
24
+ }
25
+
26
+ export { designFromManifest, parseDesignManifest };
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,oBAAoB,MAAA,EAAgC;AAClE,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,mDAAmD,CAAA;AAAA,EACrE;AACA,EAAA,MAAM,MAAA,GAAS,uBAAA,CAAwB,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA;AAC5D,EAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,gDAAA,EAA8C,OAAO,KAAA,CAAM,MAAA,CACxD,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,mBAAmB,QAAA,EAAwC;AAKzE,EAAA,OAAO,YAAA,CAAa,SAAS,WAA0C,CAAA;AACzE","file":"index.mjs","sourcesContent":["/**\n * AIP-4 DESIGN.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 `defineDesign` so the cross-AIP\n * invariants run uniformly.\n *\n *\n * The frontmatter zod schema below was generated from\n * `resources/aip-4/draft/DESIGN.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 { designFrontmatterSchema, type DesignFrontmatter } from \"../schema.js\"\nimport { defineDesign } from \"../define-design.js\"\nimport type { DesignDefinition, DesignHandle } from \"../types.js\"\n\n// Re-export so consumers can import the schema + inferred type either\n// from \"@@agentproto/design/manifest\" or directly from \"@@agentproto/design/schema\".\nexport { designFrontmatterSchema, type DesignFrontmatter }\n\nexport interface DesignManifest {\n frontmatter: DesignFrontmatter\n body: string\n}\n\nexport function parseDesignManifest(source: string): DesignManifest {\n const parsed = matter(source)\n if (Object.keys(parsed.data).length === 0) {\n throw new Error(\"parseDesignManifest: missing or empty frontmatter\")\n }\n const result = designFrontmatterSchema.safeParse(parsed.data)\n if (!result.success) {\n throw new Error(\n `parseDesignManifest: 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 designFromManifest(manifest: DesignManifest): DesignHandle {\n // The zod-validated frontmatter is structurally compatible with\n // DesignDefinition; 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 defineDesign(manifest.frontmatter as unknown as DesignDefinition)\n}\n"]}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * AIP-4 DesignDefinition + DesignHandle.
3
+ *
4
+ * `DesignDefinition` was generated from
5
+ * `resources/aip-4/draft/DESIGN.schema.json` via json-schema-to-typescript.
6
+ * `DesignHandle` is the readonly view of the same shape; tighten it
7
+ * by hand for fields that get defaults applied in build().
8
+ */
9
+ /**
10
+ * Validates the YAML frontmatter portion of an AIP-4 DESIGN.md design-token kit.
11
+ */
12
+ type DesignDefinition = {
13
+ [k: string]: unknown;
14
+ } & {
15
+ /**
16
+ * Pins the registry schema this kit conforms to. Required for registry submission.
17
+ */
18
+ schema?: "designkit/v1";
19
+ /**
20
+ * Kebab-case kit identifier. Namespaced by the registry on publish.
21
+ */
22
+ kit: string;
23
+ /**
24
+ * Human-readable display name.
25
+ */
26
+ title: string;
27
+ /**
28
+ * One-paragraph summary surfaced in registry search results.
29
+ */
30
+ description?: string;
31
+ /**
32
+ * Semver of THIS kit. Bump on token change.
33
+ */
34
+ version?: string;
35
+ /**
36
+ * Display name of the author / maintainer.
37
+ */
38
+ author?: string;
39
+ /**
40
+ * SPDX identifier or 'proprietary' for private brand kits.
41
+ */
42
+ license?: string;
43
+ homepage?: string;
44
+ /**
45
+ * URL to a screenshot of the kit applied to a reference surface.
46
+ */
47
+ preview?: string;
48
+ /**
49
+ * @minItems 0
50
+ * @maxItems 12
51
+ */
52
+ tags?: [] | [string] | [string, string] | [string, string, string] | [string, string, string, string] | [string, string, string, string, string] | [string, string, string, string, string, string] | [string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string, string, string, string, string];
53
+ /**
54
+ * URI of a parent DESIGN.md to compose on top of. Depth-limited to 3.
55
+ */
56
+ "based-on"?: string;
57
+ /**
58
+ * Default surface mode. 'both' requires a sibling 'variants' block.
59
+ */
60
+ mode?: "light" | "dark" | "both";
61
+ colors: ColorTokens;
62
+ typography: TypographyTokens;
63
+ spacing?: ScaleTokens;
64
+ rounded?: ScaleTokens;
65
+ shadows?: ScaleTokens;
66
+ motion?: {
67
+ duration?: ScaleTokens;
68
+ easing?: ScaleTokens;
69
+ };
70
+ /**
71
+ * Delta blocks per mode. Only tokens that differ from the base are listed.
72
+ */
73
+ variants?: {
74
+ dark?: VariantDelta;
75
+ light?: VariantDelta;
76
+ };
77
+ /**
78
+ * Host-namespaced extension fields. Other hosts MUST tolerate unknown keys here.
79
+ */
80
+ metadata?: {
81
+ [k: string]: unknown;
82
+ };
83
+ };
84
+ interface ColorTokens {
85
+ background: string;
86
+ surface?: string;
87
+ ink: string;
88
+ "ink-muted"?: string;
89
+ primary: string;
90
+ "on-primary"?: string;
91
+ accent?: string;
92
+ "on-accent"?: string;
93
+ muted?: string;
94
+ "muted-foreground"?: string;
95
+ border?: string;
96
+ link?: string;
97
+ success?: string;
98
+ warning?: string;
99
+ danger?: string;
100
+ /**
101
+ * Hex (#RGB / #RRGGBB / #RRGGBBAA), rgb(a), hsl(a), or '{colors.<name>}' reference.
102
+ */
103
+ [k: string]: string | undefined;
104
+ }
105
+ interface TypographyTokens {
106
+ body: TypeStyle;
107
+ h1: TypeStyle;
108
+ h2?: TypeStyle;
109
+ h3?: TypeStyle;
110
+ h4?: TypeStyle;
111
+ code?: TypeStyle;
112
+ small?: TypeStyle;
113
+ [k: string]: TypeStyle | undefined;
114
+ }
115
+ interface TypeStyle {
116
+ family: string;
117
+ size?: string;
118
+ weight?: number | string;
119
+ lineHeight?: number | string;
120
+ letterSpacing?: string;
121
+ }
122
+ interface ScaleTokens {
123
+ [k: string]: string;
124
+ }
125
+ interface VariantDelta {
126
+ colors?: ScaleTokens;
127
+ typography?: {
128
+ [k: string]: TypeStyle | undefined;
129
+ };
130
+ spacing?: ScaleTokens;
131
+ rounded?: ScaleTokens;
132
+ shadows?: ScaleTokens;
133
+ motion?: {
134
+ duration?: ScaleTokens;
135
+ easing?: ScaleTokens;
136
+ };
137
+ }
138
+ type DesignHandle = Readonly<DesignDefinition>;
139
+
140
+ export type { DesignDefinition as D, DesignHandle as a };
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@agentproto/design",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "@agentproto/design — AIP-4 DESIGN.md reference implementation. A markdown + frontmatter format for portable design tokens, and the registry conventions used by designkit.sh to share community kits.",
5
+ "keywords": [
6
+ "agentproto",
7
+ "aip-4",
8
+ "design",
9
+ "defineDesign",
10
+ "open-standard",
11
+ "agentic"
12
+ ],
13
+ "homepage": "https://agentproto.sh/docs/aip-4",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/agentproto/ts",
17
+ "directory": "packages/design"
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
+ }