@agenticdiagrams/schema 0.1.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 Agentic Diagrams
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,90 @@
1
+ # @agenticdiagrams/schema
2
+
3
+ TypeScript types, JSON Schema, and validation for [`.agentic.yaml`](docs/spec.md) diagram files.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @agenticdiagrams/schema
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Types
14
+
15
+ ```ts
16
+ import type { AgenticYaml, AgenticNode, AgenticEdge } from '@agenticdiagrams/schema';
17
+ ```
18
+
19
+ ### Validation
20
+
21
+ Validate a parsed YAML object against the schema:
22
+
23
+ ```ts
24
+ import * as yaml from 'js-yaml';
25
+ import { validate } from '@agenticdiagrams/schema';
26
+
27
+ const doc = yaml.load(yamlString);
28
+ const result = validate(doc);
29
+
30
+ if (!result.valid) {
31
+ console.error(result.errors);
32
+ }
33
+ ```
34
+
35
+ ### JSON Schema
36
+
37
+ Use the JSON Schema directly for editor support or other tools:
38
+
39
+ ```ts
40
+ import schema from '@agenticdiagrams/schema/schema.json';
41
+ ```
42
+
43
+ Or reference it by URL: `https://agenticdiagrams.com/schemas/agentic/0.1.json`
44
+
45
+ ## What's in the box
46
+
47
+ | Export | Description |
48
+ |--------|-------------|
49
+ | `AgenticYaml` | Root document type |
50
+ | `AgenticNode` | Node definition |
51
+ | `AgenticEdge` | Edge (connection) definition |
52
+ | `AgenticScenario` | Flow scenario with steps |
53
+ | `AgenticLayout` | Layout hints (positions, sizes, styles) |
54
+ | `validate()` | Structural validation against JSON Schema |
55
+
56
+ ## Spec
57
+
58
+ See the full [Agentic YAML Specification v0.1](docs/spec.md).
59
+
60
+ ## Examples
61
+
62
+ The [`examples/`](examples/) directory contains complete `.agentic.yaml` files:
63
+
64
+ - **[simple-agent](examples/simple-agent.agentic.yaml)** — Support bot with knowledge base search
65
+ - **[multi-agent-with-guardrails](examples/multi-agent-with-guardrails.agentic.yaml)** — Pipeline with input/output guardrails and human approval
66
+ - **[kitchen-manager](examples/kitchen-manager.agentic.yaml)** — Multi-agent system with MCP tools and parallel scenarios
67
+
68
+ ## Minimum valid document
69
+
70
+ ```yaml
71
+ agentic: "0.1"
72
+ ```
73
+
74
+ A practical minimum:
75
+
76
+ ```yaml
77
+ agentic: "0.1"
78
+ nodes:
79
+ my-agent:
80
+ type: agent
81
+ edges:
82
+ - to: my-tool
83
+ my-tool:
84
+ type: tool
85
+ sub_type: mcp
86
+ ```
87
+
88
+ ## License
89
+
90
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,327 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ validate: () => validate
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/validate.ts
38
+ var import__ = __toESM(require("ajv/dist/2020.js"), 1);
39
+ var import_ajv_formats = __toESM(require("ajv-formats"), 1);
40
+
41
+ // schema/agentic.v0.1.json
42
+ var agentic_v0_1_default = {
43
+ $schema: "https://json-schema.org/draft/2020-12/schema",
44
+ $id: "https://agenticdiagrams.com/schemas/agentic/0.1.json",
45
+ title: "Agentic Diagram",
46
+ description: "Schema for .agentic.yaml diagram files (spec v0.1)",
47
+ type: "object",
48
+ required: ["agentic"],
49
+ additionalProperties: false,
50
+ properties: {
51
+ agentic: {
52
+ type: "string",
53
+ const: "0.1",
54
+ description: "Spec version"
55
+ },
56
+ diagram: { $ref: "#/$defs/diagram" },
57
+ nodes: {
58
+ type: "object",
59
+ description: "Node definitions keyed by stable id",
60
+ additionalProperties: { $ref: "#/$defs/node" }
61
+ },
62
+ edges: {
63
+ type: "array",
64
+ description: "Connections between nodes (type defaults to request)",
65
+ items: { $ref: "#/$defs/edge" }
66
+ },
67
+ scenarios: {
68
+ type: "object",
69
+ description: "Flow definitions keyed by id",
70
+ additionalProperties: { $ref: "#/$defs/scenario" }
71
+ },
72
+ layout: { $ref: "#/$defs/layout" }
73
+ },
74
+ $defs: {
75
+ diagram: {
76
+ type: "object",
77
+ description: "Diagram metadata. All fields optional, name defaults to Untitled",
78
+ additionalProperties: false,
79
+ properties: {
80
+ name: { type: "string", default: "Untitled" },
81
+ description: { type: "string" },
82
+ type: { type: "string", enum: ["system", "component"] },
83
+ active_scenario: { type: "string" },
84
+ parent_diagram: { type: "string", description: "Parent diagram id for drill-down hierarchy" },
85
+ created: { type: "string", format: "date-time" },
86
+ updated: { type: "string", format: "date-time" }
87
+ }
88
+ },
89
+ nodeType: {
90
+ type: "string",
91
+ enum: [
92
+ "agent",
93
+ "tool",
94
+ "component",
95
+ "backend",
96
+ "generic",
97
+ "note",
98
+ "system",
99
+ "memory",
100
+ "gateway",
101
+ "skill",
102
+ "channel",
103
+ "waypoint",
104
+ "router",
105
+ "human",
106
+ "trigger",
107
+ "guardrail",
108
+ "model",
109
+ "aggregator",
110
+ "observability",
111
+ "group",
112
+ "block",
113
+ "image",
114
+ "prompt",
115
+ "user",
116
+ "output",
117
+ "knowledge_base",
118
+ "environment",
119
+ "text_label",
120
+ "divider"
121
+ ]
122
+ },
123
+ node: {
124
+ type: "object",
125
+ description: "Node definition. Label defaults to the node id when omitted",
126
+ required: ["type"],
127
+ additionalProperties: false,
128
+ properties: {
129
+ type: { $ref: "#/$defs/nodeType" },
130
+ label: { type: "string", description: "Display name (defaults to node id)" },
131
+ sub_title: { type: "string", description: "Secondary display text below label" },
132
+ description: { type: "string" },
133
+ sub_type: { type: "string" },
134
+ url: { type: "string", format: "uri" },
135
+ group: { type: "string", description: "Parent group node id" },
136
+ linked_diagram: { type: "string", description: "Drill-down target diagram id or file path" },
137
+ is_looping: { type: "boolean" },
138
+ auth: { type: "string" },
139
+ auth_detail: { type: "string" },
140
+ provider: { type: "string" },
141
+ content: { type: "string" },
142
+ example_response: { type: "string" },
143
+ edges: {
144
+ type: "array",
145
+ description: "Inline edge definitions (from is inferred as this node)",
146
+ items: { $ref: "#/$defs/inlineEdge" }
147
+ }
148
+ }
149
+ },
150
+ edgeType: {
151
+ type: "string",
152
+ description: "Edge semantic type. Defaults to request when omitted",
153
+ enum: ["default", "request", "response", "async", "streaming", "event", "error"]
154
+ },
155
+ pathType: {
156
+ type: "string",
157
+ enum: ["bezier", "straight", "step", "smooth_step", "simple_bezier"]
158
+ },
159
+ handlePosition: {
160
+ type: "string",
161
+ enum: ["top", "right", "bottom", "left"],
162
+ description: "Which side of the node the edge connects to"
163
+ },
164
+ edge: {
165
+ type: "object",
166
+ required: ["from", "to"],
167
+ additionalProperties: false,
168
+ properties: {
169
+ from: { type: "string", description: "Source node id" },
170
+ to: { type: "string", description: "Target node id" },
171
+ type: { $ref: "#/$defs/edgeType" },
172
+ label: { type: "string" },
173
+ animated: { type: "boolean", description: "Show animated flow on connection" },
174
+ path: { $ref: "#/$defs/pathType" },
175
+ source_handle: { $ref: "#/$defs/handlePosition" },
176
+ target_handle: { $ref: "#/$defs/handlePosition" }
177
+ }
178
+ },
179
+ inlineEdge: {
180
+ type: "object",
181
+ description: "Edge defined on a node (from is inferred as the parent node id)",
182
+ required: ["to"],
183
+ additionalProperties: false,
184
+ properties: {
185
+ to: { type: "string", description: "Target node id" },
186
+ type: { $ref: "#/$defs/edgeType" },
187
+ label: { type: "string" },
188
+ animated: { type: "boolean", description: "Show animated flow on connection" },
189
+ path: { $ref: "#/$defs/pathType" },
190
+ source_handle: { $ref: "#/$defs/handlePosition" },
191
+ target_handle: { $ref: "#/$defs/handlePosition" }
192
+ }
193
+ },
194
+ stepType: {
195
+ type: "string",
196
+ description: "Step semantic type. Defaults to call when omitted",
197
+ enum: ["call", "return", "async", "event", "error"]
198
+ },
199
+ fragmentType: {
200
+ type: "string",
201
+ enum: ["alt", "opt", "loop", "par"]
202
+ },
203
+ fragment: {
204
+ type: "object",
205
+ required: ["type", "position"],
206
+ additionalProperties: false,
207
+ properties: {
208
+ type: { $ref: "#/$defs/fragmentType" },
209
+ label: { type: "string" },
210
+ position: { type: "string", enum: ["start", "else", "end"] }
211
+ }
212
+ },
213
+ note: {
214
+ type: "object",
215
+ required: ["text", "position"],
216
+ additionalProperties: false,
217
+ properties: {
218
+ text: { type: "string" },
219
+ position: { type: "string", enum: ["left", "right", "over"] }
220
+ }
221
+ },
222
+ step: {
223
+ type: "object",
224
+ required: ["from", "to"],
225
+ additionalProperties: false,
226
+ properties: {
227
+ from: { type: "string", description: "Source node id" },
228
+ to: { type: "string", description: "Target node id" },
229
+ type: { $ref: "#/$defs/stepType" },
230
+ label: { type: "string" },
231
+ payload: { type: "string" },
232
+ duration: { type: "number", minimum: 0 },
233
+ fragment: { $ref: "#/$defs/fragment" },
234
+ note: { $ref: "#/$defs/note" }
235
+ }
236
+ },
237
+ scenario: {
238
+ type: "object",
239
+ required: ["name"],
240
+ additionalProperties: false,
241
+ properties: {
242
+ name: { type: "string" },
243
+ description: { type: "string" },
244
+ steps: {
245
+ type: "array",
246
+ items: { $ref: "#/$defs/step" }
247
+ }
248
+ }
249
+ },
250
+ point2d: {
251
+ type: "array",
252
+ items: { type: "number" },
253
+ minItems: 2,
254
+ maxItems: 2
255
+ },
256
+ size2d: {
257
+ type: "array",
258
+ items: { type: "number", minimum: 0 },
259
+ minItems: 2,
260
+ maxItems: 2
261
+ },
262
+ viewport: {
263
+ type: "array",
264
+ items: { type: "number" },
265
+ minItems: 3,
266
+ maxItems: 3,
267
+ description: "[x, y, zoom]"
268
+ },
269
+ nodeStyle: {
270
+ type: "object",
271
+ additionalProperties: false,
272
+ properties: {
273
+ borderless: { type: "boolean" },
274
+ icon_url: { type: "string", format: "uri" },
275
+ icon_layout: { type: "string", enum: ["left", "right", "top", "bottom"] },
276
+ image_url: { type: "string", format: "uri" }
277
+ }
278
+ },
279
+ direction: {
280
+ type: "string",
281
+ description: "Auto-layout flow direction. Defaults to TB",
282
+ enum: ["TB", "LR", "BT", "RL"]
283
+ },
284
+ layout: {
285
+ type: "object",
286
+ additionalProperties: false,
287
+ properties: {
288
+ direction: { $ref: "#/$defs/direction" },
289
+ viewport: { $ref: "#/$defs/viewport" },
290
+ positions: {
291
+ type: "object",
292
+ additionalProperties: { $ref: "#/$defs/point2d" }
293
+ },
294
+ sizes: {
295
+ type: "object",
296
+ additionalProperties: { $ref: "#/$defs/size2d" }
297
+ },
298
+ node_styles: {
299
+ type: "object",
300
+ additionalProperties: { $ref: "#/$defs/nodeStyle" }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ };
306
+
307
+ // src/validate.ts
308
+ var ajv = new import__.default({ allErrors: true });
309
+ (0, import_ajv_formats.default)(ajv);
310
+ var compiledValidate = ajv.compile(agentic_v0_1_default);
311
+ function validate(data) {
312
+ const valid = compiledValidate(data);
313
+ if (valid) {
314
+ return { valid: true, errors: [] };
315
+ }
316
+ const errors = (compiledValidate.errors ?? []).map((err) => {
317
+ const path = err.instancePath || "/";
318
+ const message = err.message || "unknown error";
319
+ return `${path}: ${message}`;
320
+ });
321
+ return { valid: false, errors };
322
+ }
323
+ // Annotate the CommonJS export names for ESM import in node:
324
+ 0 && (module.exports = {
325
+ validate
326
+ });
327
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/validate.ts","../schema/agentic.v0.1.json"],"sourcesContent":["export type {\n AgenticYaml,\n AgenticDiagram,\n AgenticNode,\n AgenticInlineEdge,\n AgenticEdge,\n AgenticStep,\n AgenticScenario,\n AgenticNodeStyle,\n AgenticLayout,\n} from './types';\n\nexport { validate } from './validate';\nexport type { ValidationResult } from './validate';\n","import Ajv2020 from 'ajv/dist/2020.js';\nimport addFormats from 'ajv-formats';\nimport schema from '../schema/agentic.v0.1.json';\n\nexport interface ValidationResult {\n valid: boolean;\n errors: string[];\n}\n\nconst ajv = new Ajv2020({ allErrors: true });\naddFormats(ajv);\nconst compiledValidate = ajv.compile(schema);\n\n/**\n * Validate a parsed YAML object against the agentic schema v0.1.\n *\n * This validates structure only — it does not parse YAML strings.\n * Use your preferred YAML parser (js-yaml, yaml, etc.) first.\n *\n * @example\n * ```ts\n * import * as yaml from 'js-yaml';\n * import { validate } from '@agenticdiagrams/schema';\n *\n * const doc = yaml.load(yamlString);\n * const result = validate(doc);\n * if (!result.valid) {\n * console.error(result.errors);\n * }\n * ```\n */\nexport function validate(data: unknown): ValidationResult {\n const valid = compiledValidate(data);\n\n if (valid) {\n return { valid: true, errors: [] };\n }\n\n const errors = (compiledValidate.errors ?? []).map((err) => {\n const path = err.instancePath || '/';\n const message = err.message || 'unknown error';\n return `${path}: ${message}`;\n });\n\n return { valid: false, errors };\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://agenticdiagrams.com/schemas/agentic/0.1.json\",\n \"title\": \"Agentic Diagram\",\n \"description\": \"Schema for .agentic.yaml diagram files (spec v0.1)\",\n \"type\": \"object\",\n \"required\": [\"agentic\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"agentic\": {\n \"type\": \"string\",\n \"const\": \"0.1\",\n \"description\": \"Spec version\"\n },\n \"diagram\": { \"$ref\": \"#/$defs/diagram\" },\n \"nodes\": {\n \"type\": \"object\",\n \"description\": \"Node definitions keyed by stable id\",\n \"additionalProperties\": { \"$ref\": \"#/$defs/node\" }\n },\n \"edges\": {\n \"type\": \"array\",\n \"description\": \"Connections between nodes (type defaults to request)\",\n \"items\": { \"$ref\": \"#/$defs/edge\" }\n },\n \"scenarios\": {\n \"type\": \"object\",\n \"description\": \"Flow definitions keyed by id\",\n \"additionalProperties\": { \"$ref\": \"#/$defs/scenario\" }\n },\n \"layout\": { \"$ref\": \"#/$defs/layout\" }\n },\n \"$defs\": {\n \"diagram\": {\n \"type\": \"object\",\n \"description\": \"Diagram metadata. All fields optional, name defaults to Untitled\",\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": { \"type\": \"string\", \"default\": \"Untitled\" },\n \"description\": { \"type\": \"string\" },\n \"type\": { \"type\": \"string\", \"enum\": [\"system\", \"component\"] },\n \"active_scenario\": { \"type\": \"string\" },\n \"parent_diagram\": { \"type\": \"string\", \"description\": \"Parent diagram id for drill-down hierarchy\" },\n \"created\": { \"type\": \"string\", \"format\": \"date-time\" },\n \"updated\": { \"type\": \"string\", \"format\": \"date-time\" }\n }\n },\n \"nodeType\": {\n \"type\": \"string\",\n \"enum\": [\n \"agent\", \"tool\", \"component\", \"backend\", \"generic\", \"note\",\n \"system\", \"memory\", \"gateway\", \"skill\", \"channel\", \"waypoint\",\n \"router\", \"human\", \"trigger\", \"guardrail\", \"model\", \"aggregator\",\n \"observability\", \"group\", \"block\", \"image\", \"prompt\", \"user\",\n \"output\", \"knowledge_base\", \"environment\", \"text_label\", \"divider\"\n ]\n },\n \"node\": {\n \"type\": \"object\",\n \"description\": \"Node definition. Label defaults to the node id when omitted\",\n \"required\": [\"type\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"$ref\": \"#/$defs/nodeType\" },\n \"label\": { \"type\": \"string\", \"description\": \"Display name (defaults to node id)\" },\n \"sub_title\": { \"type\": \"string\", \"description\": \"Secondary display text below label\" },\n \"description\": { \"type\": \"string\" },\n \"sub_type\": { \"type\": \"string\" },\n \"url\": { \"type\": \"string\", \"format\": \"uri\" },\n \"group\": { \"type\": \"string\", \"description\": \"Parent group node id\" },\n \"linked_diagram\": { \"type\": \"string\", \"description\": \"Drill-down target diagram id or file path\" },\n \"is_looping\": { \"type\": \"boolean\" },\n \"auth\": { \"type\": \"string\" },\n \"auth_detail\": { \"type\": \"string\" },\n \"provider\": { \"type\": \"string\" },\n \"content\": { \"type\": \"string\" },\n \"example_response\": { \"type\": \"string\" },\n \"edges\": {\n \"type\": \"array\",\n \"description\": \"Inline edge definitions (from is inferred as this node)\",\n \"items\": { \"$ref\": \"#/$defs/inlineEdge\" }\n }\n }\n },\n \"edgeType\": {\n \"type\": \"string\",\n \"description\": \"Edge semantic type. Defaults to request when omitted\",\n \"enum\": [\"default\", \"request\", \"response\", \"async\", \"streaming\", \"event\", \"error\"]\n },\n \"pathType\": {\n \"type\": \"string\",\n \"enum\": [\"bezier\", \"straight\", \"step\", \"smooth_step\", \"simple_bezier\"]\n },\n \"handlePosition\": {\n \"type\": \"string\",\n \"enum\": [\"top\", \"right\", \"bottom\", \"left\"],\n \"description\": \"Which side of the node the edge connects to\"\n },\n \"edge\": {\n \"type\": \"object\",\n \"required\": [\"from\", \"to\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"from\": { \"type\": \"string\", \"description\": \"Source node id\" },\n \"to\": { \"type\": \"string\", \"description\": \"Target node id\" },\n \"type\": { \"$ref\": \"#/$defs/edgeType\" },\n \"label\": { \"type\": \"string\" },\n \"animated\": { \"type\": \"boolean\", \"description\": \"Show animated flow on connection\" },\n \"path\": { \"$ref\": \"#/$defs/pathType\" },\n \"source_handle\": { \"$ref\": \"#/$defs/handlePosition\" },\n \"target_handle\": { \"$ref\": \"#/$defs/handlePosition\" }\n }\n },\n \"inlineEdge\": {\n \"type\": \"object\",\n \"description\": \"Edge defined on a node (from is inferred as the parent node id)\",\n \"required\": [\"to\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"to\": { \"type\": \"string\", \"description\": \"Target node id\" },\n \"type\": { \"$ref\": \"#/$defs/edgeType\" },\n \"label\": { \"type\": \"string\" },\n \"animated\": { \"type\": \"boolean\", \"description\": \"Show animated flow on connection\" },\n \"path\": { \"$ref\": \"#/$defs/pathType\" },\n \"source_handle\": { \"$ref\": \"#/$defs/handlePosition\" },\n \"target_handle\": { \"$ref\": \"#/$defs/handlePosition\" }\n }\n },\n \"stepType\": {\n \"type\": \"string\",\n \"description\": \"Step semantic type. Defaults to call when omitted\",\n \"enum\": [\"call\", \"return\", \"async\", \"event\", \"error\"]\n },\n \"fragmentType\": {\n \"type\": \"string\",\n \"enum\": [\"alt\", \"opt\", \"loop\", \"par\"]\n },\n \"fragment\": {\n \"type\": \"object\",\n \"required\": [\"type\", \"position\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"type\": { \"$ref\": \"#/$defs/fragmentType\" },\n \"label\": { \"type\": \"string\" },\n \"position\": { \"type\": \"string\", \"enum\": [\"start\", \"else\", \"end\"] }\n }\n },\n \"note\": {\n \"type\": \"object\",\n \"required\": [\"text\", \"position\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"text\": { \"type\": \"string\" },\n \"position\": { \"type\": \"string\", \"enum\": [\"left\", \"right\", \"over\"] }\n }\n },\n \"step\": {\n \"type\": \"object\",\n \"required\": [\"from\", \"to\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"from\": { \"type\": \"string\", \"description\": \"Source node id\" },\n \"to\": { \"type\": \"string\", \"description\": \"Target node id\" },\n \"type\": { \"$ref\": \"#/$defs/stepType\" },\n \"label\": { \"type\": \"string\" },\n \"payload\": { \"type\": \"string\" },\n \"duration\": { \"type\": \"number\", \"minimum\": 0 },\n \"fragment\": { \"$ref\": \"#/$defs/fragment\" },\n \"note\": { \"$ref\": \"#/$defs/note\" }\n }\n },\n \"scenario\": {\n \"type\": \"object\",\n \"required\": [\"name\"],\n \"additionalProperties\": false,\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" },\n \"steps\": {\n \"type\": \"array\",\n \"items\": { \"$ref\": \"#/$defs/step\" }\n }\n }\n },\n \"point2d\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"number\" },\n \"minItems\": 2,\n \"maxItems\": 2\n },\n \"size2d\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"number\", \"minimum\": 0 },\n \"minItems\": 2,\n \"maxItems\": 2\n },\n \"viewport\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"number\" },\n \"minItems\": 3,\n \"maxItems\": 3,\n \"description\": \"[x, y, zoom]\"\n },\n \"nodeStyle\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"borderless\": { \"type\": \"boolean\" },\n \"icon_url\": { \"type\": \"string\", \"format\": \"uri\" },\n \"icon_layout\": { \"type\": \"string\", \"enum\": [\"left\", \"right\", \"top\", \"bottom\"] },\n \"image_url\": { \"type\": \"string\", \"format\": \"uri\" }\n }\n },\n \"direction\": {\n \"type\": \"string\",\n \"description\": \"Auto-layout flow direction. Defaults to TB\",\n \"enum\": [\"TB\", \"LR\", \"BT\", \"RL\"]\n },\n \"layout\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"properties\": {\n \"direction\": { \"$ref\": \"#/$defs/direction\" },\n \"viewport\": { \"$ref\": \"#/$defs/viewport\" },\n \"positions\": {\n \"type\": \"object\",\n \"additionalProperties\": { \"$ref\": \"#/$defs/point2d\" }\n },\n \"sizes\": {\n \"type\": \"object\",\n \"additionalProperties\": { \"$ref\": \"#/$defs/size2d\" }\n },\n \"node_styles\": {\n \"type\": \"object\",\n \"additionalProperties\": { \"$ref\": \"#/$defs/nodeStyle\" }\n }\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,eAAoB;AACpB,yBAAuB;;;ACDvB;AAAA,EACE,SAAW;AAAA,EACX,KAAO;AAAA,EACP,OAAS;AAAA,EACT,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,UAAY,CAAC,SAAS;AAAA,EACtB,sBAAwB;AAAA,EACxB,YAAc;AAAA,IACZ,SAAW;AAAA,MACT,MAAQ;AAAA,MACR,OAAS;AAAA,MACT,aAAe;AAAA,IACjB;AAAA,IACA,SAAW,EAAE,MAAQ,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Q,oBAAoB;AAAA,QACxD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ADtOA,IAAM,MAAM,IAAI,SAAAA,QAAQ,EAAE,WAAW,KAAK,CAAC;AAAA,IAC3C,mBAAAC,SAAW,GAAG;AACd,IAAM,mBAAmB,IAAI,QAAQ,oBAAM;AAoBpC,SAAS,SAAS,MAAiC;AACxD,QAAM,QAAQ,iBAAiB,IAAI;AAEnC,MAAI,OAAO;AACT,WAAO,EAAE,OAAO,MAAM,QAAQ,CAAC,EAAE;AAAA,EACnC;AAEA,QAAM,UAAU,iBAAiB,UAAU,CAAC,GAAG,IAAI,CAAC,QAAQ;AAC1D,UAAM,OAAO,IAAI,gBAAgB;AACjC,UAAM,UAAU,IAAI,WAAW;AAC/B,WAAO,GAAG,IAAI,KAAK,OAAO;AAAA,EAC5B,CAAC;AAED,SAAO,EAAE,OAAO,OAAO,OAAO;AAChC;","names":["Ajv2020","addFormats"]}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * TypeScript types matching the agentic YAML spec v0.1.
3
+ * These represent the parsed YAML structure, not any editor-specific model.
4
+ */
5
+ interface AgenticYaml {
6
+ agentic: '0.1';
7
+ diagram?: AgenticDiagram;
8
+ nodes?: Record<string, AgenticNode>;
9
+ edges?: AgenticEdge[];
10
+ scenarios?: Record<string, AgenticScenario>;
11
+ layout?: AgenticLayout;
12
+ }
13
+ interface AgenticDiagram {
14
+ name?: string;
15
+ description?: string;
16
+ type?: 'system' | 'component';
17
+ active_scenario?: string;
18
+ parent_diagram?: string;
19
+ created?: string;
20
+ updated?: string;
21
+ }
22
+ interface AgenticNode {
23
+ type: string;
24
+ label?: string;
25
+ sub_title?: string;
26
+ description?: string;
27
+ sub_type?: string;
28
+ url?: string;
29
+ group?: string;
30
+ linked_diagram?: string;
31
+ is_looping?: boolean;
32
+ auth?: string;
33
+ auth_detail?: string;
34
+ provider?: string;
35
+ content?: string;
36
+ example_response?: string;
37
+ edges?: AgenticInlineEdge[];
38
+ }
39
+ interface AgenticInlineEdge {
40
+ to: string;
41
+ type?: string;
42
+ label?: string;
43
+ animated?: boolean;
44
+ path?: string;
45
+ source_handle?: string;
46
+ target_handle?: string;
47
+ }
48
+ interface AgenticEdge {
49
+ from: string;
50
+ to: string;
51
+ type?: string;
52
+ label?: string;
53
+ animated?: boolean;
54
+ path?: string;
55
+ source_handle?: string;
56
+ target_handle?: string;
57
+ }
58
+ interface AgenticStep {
59
+ from: string;
60
+ to: string;
61
+ type?: string;
62
+ label?: string;
63
+ payload?: string;
64
+ duration?: number;
65
+ fragment?: {
66
+ type: 'alt' | 'opt' | 'loop' | 'par';
67
+ label?: string;
68
+ position: 'start' | 'else' | 'end';
69
+ };
70
+ note?: {
71
+ text: string;
72
+ position: 'left' | 'right' | 'over';
73
+ };
74
+ }
75
+ interface AgenticScenario {
76
+ name: string;
77
+ description?: string;
78
+ steps?: AgenticStep[];
79
+ }
80
+ interface AgenticNodeStyle {
81
+ borderless?: boolean;
82
+ icon_url?: string;
83
+ icon_layout?: string;
84
+ image_url?: string;
85
+ }
86
+ interface AgenticLayout {
87
+ direction?: 'TB' | 'LR' | 'BT' | 'RL';
88
+ viewport?: [number, number, number];
89
+ positions?: Record<string, [number, number]>;
90
+ sizes?: Record<string, [number, number]>;
91
+ node_styles?: Record<string, AgenticNodeStyle>;
92
+ }
93
+
94
+ interface ValidationResult {
95
+ valid: boolean;
96
+ errors: string[];
97
+ }
98
+ /**
99
+ * Validate a parsed YAML object against the agentic schema v0.1.
100
+ *
101
+ * This validates structure only — it does not parse YAML strings.
102
+ * Use your preferred YAML parser (js-yaml, yaml, etc.) first.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * import * as yaml from 'js-yaml';
107
+ * import { validate } from '@agenticdiagrams/schema';
108
+ *
109
+ * const doc = yaml.load(yamlString);
110
+ * const result = validate(doc);
111
+ * if (!result.valid) {
112
+ * console.error(result.errors);
113
+ * }
114
+ * ```
115
+ */
116
+ declare function validate(data: unknown): ValidationResult;
117
+
118
+ export { type AgenticDiagram, type AgenticEdge, type AgenticInlineEdge, type AgenticLayout, type AgenticNode, type AgenticNodeStyle, type AgenticScenario, type AgenticStep, type AgenticYaml, type ValidationResult, validate };