@agenticdiagrams/schema 0.1.8 → 0.1.9

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/dist/index.cjs CHANGED
@@ -1,421 +1,528 @@
1
- "use strict";
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ // \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  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
9
  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;
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
19
18
  };
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
-
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ let ajv_dist_2020_js = require("ajv/dist/2020.js");
24
+ let ajv_formats = require("ajv-formats");
25
+ ajv_dist_2020_js = __toESM(ajv_dist_2020_js, 1);
26
+ ajv_formats = __toESM(ajv_formats, 1);
41
27
  // schema/agentic.v0.1.json
42
28
  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: {
85
- type: "string",
86
- description: "Parent diagram id for drill-down hierarchy"
87
- },
88
- created: { type: "string", format: "date-time" },
89
- updated: { type: "string", format: "date-time" }
90
- }
91
- },
92
- nodeType: {
93
- type: "string",
94
- enum: [
95
- "agent",
96
- "tool",
97
- "component",
98
- "backend",
99
- "generic",
100
- "note",
101
- "system",
102
- "memory",
103
- "gateway",
104
- "skill",
105
- "channel",
106
- "waypoint",
107
- "router",
108
- "human",
109
- "trigger",
110
- "guardrail",
111
- "model",
112
- "aggregator",
113
- "observability",
114
- "group",
115
- "block",
116
- "image",
117
- "prompt",
118
- "user",
119
- "output",
120
- "knowledge_base",
121
- "environment",
122
- "text_label",
123
- "divider"
124
- ]
125
- },
126
- node: {
127
- type: "object",
128
- description: "Node definition. Label defaults to the node id when omitted",
129
- required: ["type"],
130
- additionalProperties: false,
131
- properties: {
132
- type: { $ref: "#/$defs/nodeType" },
133
- label: { type: "string", description: "Display name (defaults to node id)" },
134
- sub_title: { type: "string", description: "Secondary display text below label" },
135
- badge: {
136
- type: "string",
137
- description: "Short tag shown on the node, e.g. NEW or beta"
138
- },
139
- description: { type: "string" },
140
- sub_type: { type: "string" },
141
- url: { type: "string", format: "uri" },
142
- group: { type: "string", description: "Parent group node id" },
143
- linked_diagram: {
144
- type: "string",
145
- description: "Drill-down target diagram id or file path"
146
- },
147
- is_looping: { type: "boolean" },
148
- auth: { type: "string" },
149
- auth_detail: { type: "string" },
150
- provider: { type: "string" },
151
- model: {
152
- type: "string",
153
- description: "Model identifier, e.g. claude-sonnet-4-6. Primarily for agent and model nodes."
154
- },
155
- content: { type: "string" },
156
- example_response: { type: "string" },
157
- input_schema: {
158
- type: "string",
159
- description: "Input schema, usually JSON Schema serialised as a string. Primarily for tool nodes."
160
- },
161
- output_schema: {
162
- type: "string",
163
- description: "Output schema, usually JSON Schema serialised as a string. Primarily for tool nodes."
164
- },
165
- ttl: {
166
- type: "string",
167
- description: "Retention lifetime. Primarily for memory nodes. Preset values: session, 24h, permanent. Freeform strings (e.g. 7d) are accepted."
168
- },
169
- scope: {
170
- type: "string",
171
- description: "Audience scope. Primarily for memory nodes. Preset values: per-user, per-session, global. Freeform strings accepted."
172
- },
173
- metadata: { $ref: "#/$defs/nodeMetadata" },
174
- edges: {
175
- type: "array",
176
- description: "Inline edge definitions (from is inferred as this node)",
177
- items: { $ref: "#/$defs/inlineEdge" }
178
- }
179
- }
180
- },
181
- nodeMetadata: {
182
- type: "object",
183
- description: "Freeform node properties the spec does not model, such as extra typed fields or editor hints. Values are strings, numbers or booleans.",
184
- additionalProperties: {
185
- anyOf: [{ type: "string" }, { type: "number" }, { type: "boolean" }]
186
- }
187
- },
188
- edgeType: {
189
- type: "string",
190
- description: "Edge semantic type. Defaults to request when omitted. data, control, stream and tool are the connection kinds of the current editor; stream is equivalent to streaming.",
191
- enum: [
192
- "default",
193
- "request",
194
- "response",
195
- "async",
196
- "streaming",
197
- "event",
198
- "error",
199
- "data",
200
- "control",
201
- "stream",
202
- "tool"
203
- ]
204
- },
205
- pathType: {
206
- type: "string",
207
- enum: ["bezier", "straight", "step", "smooth_step", "simple_bezier"]
208
- },
209
- handlePosition: {
210
- type: "string",
211
- pattern: "^(?:top|right|bottom|left)(?:-\\d+(?:-t)?)?$",
212
- description: "Connection point on a node. Plain side name ('bottom') connects at the centre; slot form ('bottom-20') places the anchor at that whole-number percentage (0-100) along that side; '-t' suffix marks a target slot ('top-80-t'). Omit it to let the renderer choose the connection point."
213
- },
214
- edgeMetadata: {
215
- type: "object",
216
- description: "Freeform presentation hints for an edge (editor cosmetics). Known keys are typed; unknown keys are allowed.",
217
- additionalProperties: true,
218
- properties: {
219
- label_pos: {
220
- type: "number",
221
- minimum: 0,
222
- maximum: 1,
223
- description: "Label position along the edge as a fraction of its length (0 = source end, 1 = target end). Defaults to 0.5."
224
- }
225
- }
226
- },
227
- edgeArrows: {
228
- enum: ["none", "start", "end", "both"],
229
- description: "Which ends of an edge show an arrowhead: none, start (source), end (target), or both. Defaults to 'end'."
230
- },
231
- edge: {
232
- type: "object",
233
- required: ["from", "to"],
234
- additionalProperties: false,
235
- properties: {
236
- from: { type: "string", description: "Source node id" },
237
- to: { type: "string", description: "Target node id" },
238
- type: { $ref: "#/$defs/edgeType" },
239
- label: { type: "string" },
240
- condition: {
241
- type: "string",
242
- description: "Branch condition expression, e.g. 'approved', 'score > 0.8', 'default'"
243
- },
244
- animated: { type: "boolean", description: "Show animated flow on connection" },
245
- arrows: { $ref: "#/$defs/edgeArrows" },
246
- path: { $ref: "#/$defs/pathType" },
247
- source_handle: { $ref: "#/$defs/handlePosition" },
248
- target_handle: { $ref: "#/$defs/handlePosition" },
249
- metadata: { $ref: "#/$defs/edgeMetadata" }
250
- }
251
- },
252
- inlineEdge: {
253
- type: "object",
254
- description: "Edge defined on a node (from is inferred as the parent node id)",
255
- required: ["to"],
256
- additionalProperties: false,
257
- properties: {
258
- to: { type: "string", description: "Target node id" },
259
- type: { $ref: "#/$defs/edgeType" },
260
- label: { type: "string" },
261
- condition: {
262
- type: "string",
263
- description: "Branch condition expression, e.g. 'approved', 'score > 0.8', 'default'"
264
- },
265
- animated: { type: "boolean", description: "Show animated flow on connection" },
266
- arrows: { $ref: "#/$defs/edgeArrows" },
267
- path: { $ref: "#/$defs/pathType" },
268
- source_handle: { $ref: "#/$defs/handlePosition" },
269
- target_handle: { $ref: "#/$defs/handlePosition" },
270
- metadata: { $ref: "#/$defs/edgeMetadata" }
271
- }
272
- },
273
- stepType: {
274
- type: "string",
275
- description: "Step semantic type. Defaults to call when omitted",
276
- enum: ["call", "return", "async", "event", "error"]
277
- },
278
- fragmentType: {
279
- type: "string",
280
- enum: ["alt", "opt", "loop", "par"]
281
- },
282
- fragment: {
283
- type: "object",
284
- required: ["type", "position"],
285
- additionalProperties: false,
286
- properties: {
287
- type: { $ref: "#/$defs/fragmentType" },
288
- label: { type: "string" },
289
- position: { type: "string", enum: ["start", "else", "end"] }
290
- }
291
- },
292
- note: {
293
- type: "object",
294
- required: ["text", "position"],
295
- additionalProperties: false,
296
- properties: {
297
- text: { type: "string" },
298
- position: { type: "string", enum: ["left", "right", "over"] }
299
- }
300
- },
301
- step: {
302
- type: "object",
303
- description: "A playback step: either a from/to pair (a message between two nodes) or a nodes list (nodes highlighted together), never both.",
304
- additionalProperties: false,
305
- oneOf: [
306
- { required: ["from", "to"], not: { required: ["nodes"] } },
307
- {
308
- required: ["nodes"],
309
- not: { anyOf: [{ required: ["from"] }, { required: ["to"] }] }
310
- }
311
- ],
312
- properties: {
313
- from: { type: "string", description: "Source node id" },
314
- to: { type: "string", description: "Target node id" },
315
- nodes: {
316
- type: "array",
317
- description: "Node ids highlighted together at this step. Use instead of from/to when a step involves one node, or more than two.",
318
- items: { type: "string" },
319
- minItems: 1,
320
- uniqueItems: true
321
- },
322
- type: { $ref: "#/$defs/stepType" },
323
- label: { type: "string" },
324
- payload: { type: "string" },
325
- duration: { type: "number", minimum: 0 },
326
- fragment: { $ref: "#/$defs/fragment" },
327
- note: { $ref: "#/$defs/note" }
328
- }
329
- },
330
- scenario: {
331
- type: "object",
332
- required: ["name"],
333
- additionalProperties: false,
334
- properties: {
335
- name: { type: "string" },
336
- description: { type: "string" },
337
- steps: {
338
- type: "array",
339
- items: { $ref: "#/$defs/step" }
340
- }
341
- }
342
- },
343
- point2d: {
344
- type: "array",
345
- items: { type: "number" },
346
- minItems: 2,
347
- maxItems: 2
348
- },
349
- size2d: {
350
- type: "array",
351
- description: "[width, height], or [width] alone to let the node's height follow its content",
352
- items: { type: "number", minimum: 0 },
353
- minItems: 1,
354
- maxItems: 2
355
- },
356
- viewport: {
357
- type: "array",
358
- items: { type: "number" },
359
- minItems: 3,
360
- maxItems: 3,
361
- description: "[x, y, zoom]"
362
- },
363
- nodeStyle: {
364
- type: "object",
365
- additionalProperties: false,
366
- properties: {
367
- borderless: { type: "boolean" },
368
- icon_url: { type: "string", format: "uri" },
369
- icon_layout: { type: "string", enum: ["left", "right", "top", "bottom"] },
370
- image_url: { type: "string", format: "uri" }
371
- }
372
- },
373
- direction: {
374
- type: "string",
375
- description: "Auto-layout flow direction. Defaults to TB",
376
- enum: ["TB", "LR", "BT", "RL"]
377
- },
378
- layout: {
379
- type: "object",
380
- additionalProperties: false,
381
- properties: {
382
- direction: { $ref: "#/$defs/direction" },
383
- viewport: { $ref: "#/$defs/viewport" },
384
- positions: {
385
- type: "object",
386
- additionalProperties: { $ref: "#/$defs/point2d" }
387
- },
388
- sizes: {
389
- type: "object",
390
- additionalProperties: { $ref: "#/$defs/size2d" }
391
- },
392
- node_styles: {
393
- type: "object",
394
- additionalProperties: { $ref: "#/$defs/nodeStyle" }
395
- }
396
- }
397
- }
398
- }
29
+ $schema: "https://json-schema.org/draft/2020-12/schema",
30
+ $id: "https://agenticdiagrams.com/schemas/agentic/0.1.json",
31
+ title: "Agentic Diagram",
32
+ description: "Schema for .agentic.yaml diagram files (spec v0.1)",
33
+ type: "object",
34
+ required: ["agentic"],
35
+ additionalProperties: false,
36
+ properties: {
37
+ "agentic": {
38
+ "type": "string",
39
+ "const": "0.1",
40
+ "description": "Spec version"
41
+ },
42
+ "diagram": { "$ref": "#/$defs/diagram" },
43
+ "nodes": {
44
+ "type": "object",
45
+ "description": "Node definitions keyed by stable id",
46
+ "additionalProperties": { "$ref": "#/$defs/node" }
47
+ },
48
+ "edges": {
49
+ "type": "array",
50
+ "description": "Connections between nodes (type defaults to request)",
51
+ "items": { "$ref": "#/$defs/edge" }
52
+ },
53
+ "scenarios": {
54
+ "type": "object",
55
+ "description": "Flow definitions keyed by id",
56
+ "additionalProperties": { "$ref": "#/$defs/scenario" }
57
+ },
58
+ "layout": { "$ref": "#/$defs/layout" }
59
+ },
60
+ $defs: {
61
+ "diagram": {
62
+ "type": "object",
63
+ "description": "Diagram metadata. All fields optional, name defaults to Untitled",
64
+ "additionalProperties": false,
65
+ "properties": {
66
+ "name": {
67
+ "type": "string",
68
+ "default": "Untitled"
69
+ },
70
+ "description": { "type": "string" },
71
+ "type": {
72
+ "type": "string",
73
+ "enum": ["system", "component"]
74
+ },
75
+ "active_scenario": { "type": "string" },
76
+ "parent_diagram": {
77
+ "type": "string",
78
+ "description": "Parent diagram id for drill-down hierarchy"
79
+ },
80
+ "created": {
81
+ "type": "string",
82
+ "format": "date-time"
83
+ },
84
+ "updated": {
85
+ "type": "string",
86
+ "format": "date-time"
87
+ }
88
+ }
89
+ },
90
+ "nodeType": {
91
+ "type": "string",
92
+ "enum": [
93
+ "agent",
94
+ "tool",
95
+ "component",
96
+ "backend",
97
+ "generic",
98
+ "note",
99
+ "system",
100
+ "memory",
101
+ "gateway",
102
+ "skill",
103
+ "channel",
104
+ "waypoint",
105
+ "router",
106
+ "human",
107
+ "trigger",
108
+ "guardrail",
109
+ "model",
110
+ "aggregator",
111
+ "observability",
112
+ "group",
113
+ "block",
114
+ "image",
115
+ "prompt",
116
+ "user",
117
+ "output",
118
+ "knowledge_base",
119
+ "environment",
120
+ "text_label",
121
+ "divider"
122
+ ]
123
+ },
124
+ "node": {
125
+ "type": "object",
126
+ "description": "Node definition. Label defaults to the node id when omitted",
127
+ "required": ["type"],
128
+ "additionalProperties": false,
129
+ "properties": {
130
+ "type": { "$ref": "#/$defs/nodeType" },
131
+ "label": {
132
+ "type": "string",
133
+ "description": "Display name (defaults to node id)"
134
+ },
135
+ "sub_title": {
136
+ "type": "string",
137
+ "description": "Secondary display text below label"
138
+ },
139
+ "badge": {
140
+ "type": "string",
141
+ "description": "Short tag shown on the node, e.g. NEW or beta"
142
+ },
143
+ "description": { "type": "string" },
144
+ "sub_type": { "type": "string" },
145
+ "url": {
146
+ "type": "string",
147
+ "format": "uri"
148
+ },
149
+ "group": {
150
+ "type": "string",
151
+ "description": "Parent group node id"
152
+ },
153
+ "linked_diagram": {
154
+ "type": "string",
155
+ "description": "Drill-down target diagram id or file path"
156
+ },
157
+ "is_looping": { "type": "boolean" },
158
+ "auth": { "type": "string" },
159
+ "auth_detail": { "type": "string" },
160
+ "provider": { "type": "string" },
161
+ "model": {
162
+ "type": "string",
163
+ "description": "Model identifier, e.g. claude-sonnet-4-6. Primarily for agent and model nodes."
164
+ },
165
+ "content": { "type": "string" },
166
+ "example_response": { "type": "string" },
167
+ "input_schema": {
168
+ "type": "string",
169
+ "description": "Input schema, usually JSON Schema serialised as a string. Primarily for tool nodes."
170
+ },
171
+ "output_schema": {
172
+ "type": "string",
173
+ "description": "Output schema, usually JSON Schema serialised as a string. Primarily for tool nodes."
174
+ },
175
+ "ttl": {
176
+ "type": "string",
177
+ "description": "Retention lifetime. Primarily for memory nodes. Preset values: session, 24h, permanent. Freeform strings (e.g. 7d) are accepted."
178
+ },
179
+ "scope": {
180
+ "type": "string",
181
+ "description": "Audience scope. Primarily for memory nodes. Preset values: per-user, per-session, global. Freeform strings accepted."
182
+ },
183
+ "metadata": { "$ref": "#/$defs/nodeMetadata" },
184
+ "edges": {
185
+ "type": "array",
186
+ "description": "Inline edge definitions (from is inferred as this node)",
187
+ "items": { "$ref": "#/$defs/inlineEdge" }
188
+ }
189
+ }
190
+ },
191
+ "nodeMetadata": {
192
+ "type": "object",
193
+ "description": "Freeform node properties the spec does not model, such as extra typed fields or editor hints. Values are strings, numbers or booleans.",
194
+ "additionalProperties": { "anyOf": [
195
+ { "type": "string" },
196
+ { "type": "number" },
197
+ { "type": "boolean" }
198
+ ] }
199
+ },
200
+ "edgeType": {
201
+ "type": "string",
202
+ "description": "Edge semantic type. Defaults to request when omitted. data, control, stream and tool are the connection kinds of the current editor; stream is equivalent to streaming.",
203
+ "enum": [
204
+ "default",
205
+ "request",
206
+ "response",
207
+ "async",
208
+ "streaming",
209
+ "event",
210
+ "error",
211
+ "data",
212
+ "control",
213
+ "stream",
214
+ "tool"
215
+ ]
216
+ },
217
+ "pathType": {
218
+ "type": "string",
219
+ "enum": [
220
+ "bezier",
221
+ "straight",
222
+ "step",
223
+ "smooth_step",
224
+ "simple_bezier"
225
+ ]
226
+ },
227
+ "handlePosition": {
228
+ "type": "string",
229
+ "pattern": "^(?:top|right|bottom|left)(?:-\\d+(?:-t)?)?$",
230
+ "description": "Connection point on a node. Plain side name ('bottom') connects at the centre; slot form ('bottom-20') places the anchor at that whole-number percentage (0-100) along that side; '-t' suffix marks a target slot ('top-80-t'). Omit it to let the renderer choose the connection point."
231
+ },
232
+ "edgeMetadata": {
233
+ "type": "object",
234
+ "description": "Freeform presentation hints for an edge (editor cosmetics). Known keys are typed; unknown keys are allowed.",
235
+ "additionalProperties": true,
236
+ "properties": { "label_pos": {
237
+ "type": "number",
238
+ "minimum": 0,
239
+ "maximum": 1,
240
+ "description": "Label position along the edge as a fraction of its length (0 = source end, 1 = target end). Defaults to 0.5."
241
+ } }
242
+ },
243
+ "edgeArrows": {
244
+ "enum": [
245
+ "none",
246
+ "start",
247
+ "end",
248
+ "both"
249
+ ],
250
+ "description": "Which ends of an edge show an arrowhead: none, start (source), end (target), or both. Defaults to 'end'."
251
+ },
252
+ "edge": {
253
+ "type": "object",
254
+ "required": ["from", "to"],
255
+ "additionalProperties": false,
256
+ "properties": {
257
+ "from": {
258
+ "type": "string",
259
+ "description": "Source node id"
260
+ },
261
+ "to": {
262
+ "type": "string",
263
+ "description": "Target node id"
264
+ },
265
+ "type": { "$ref": "#/$defs/edgeType" },
266
+ "label": { "type": "string" },
267
+ "condition": {
268
+ "type": "string",
269
+ "description": "Branch condition expression, e.g. 'approved', 'score > 0.8', 'default'"
270
+ },
271
+ "animated": {
272
+ "type": "boolean",
273
+ "description": "Show animated flow on connection"
274
+ },
275
+ "arrows": { "$ref": "#/$defs/edgeArrows" },
276
+ "path": { "$ref": "#/$defs/pathType" },
277
+ "source_handle": { "$ref": "#/$defs/handlePosition" },
278
+ "target_handle": { "$ref": "#/$defs/handlePosition" },
279
+ "metadata": { "$ref": "#/$defs/edgeMetadata" }
280
+ }
281
+ },
282
+ "inlineEdge": {
283
+ "type": "object",
284
+ "description": "Edge defined on a node (from is inferred as the parent node id)",
285
+ "required": ["to"],
286
+ "additionalProperties": false,
287
+ "properties": {
288
+ "to": {
289
+ "type": "string",
290
+ "description": "Target node id"
291
+ },
292
+ "type": { "$ref": "#/$defs/edgeType" },
293
+ "label": { "type": "string" },
294
+ "condition": {
295
+ "type": "string",
296
+ "description": "Branch condition expression, e.g. 'approved', 'score > 0.8', 'default'"
297
+ },
298
+ "animated": {
299
+ "type": "boolean",
300
+ "description": "Show animated flow on connection"
301
+ },
302
+ "arrows": { "$ref": "#/$defs/edgeArrows" },
303
+ "path": { "$ref": "#/$defs/pathType" },
304
+ "source_handle": { "$ref": "#/$defs/handlePosition" },
305
+ "target_handle": { "$ref": "#/$defs/handlePosition" },
306
+ "metadata": { "$ref": "#/$defs/edgeMetadata" }
307
+ }
308
+ },
309
+ "stepType": {
310
+ "type": "string",
311
+ "description": "Step semantic type. Defaults to call when omitted",
312
+ "enum": [
313
+ "call",
314
+ "return",
315
+ "async",
316
+ "event",
317
+ "error"
318
+ ]
319
+ },
320
+ "fragmentType": {
321
+ "type": "string",
322
+ "enum": [
323
+ "alt",
324
+ "opt",
325
+ "loop",
326
+ "par"
327
+ ]
328
+ },
329
+ "fragment": {
330
+ "type": "object",
331
+ "required": ["type", "position"],
332
+ "additionalProperties": false,
333
+ "properties": {
334
+ "type": { "$ref": "#/$defs/fragmentType" },
335
+ "label": { "type": "string" },
336
+ "position": {
337
+ "type": "string",
338
+ "enum": [
339
+ "start",
340
+ "else",
341
+ "end"
342
+ ]
343
+ }
344
+ }
345
+ },
346
+ "note": {
347
+ "type": "object",
348
+ "required": ["text", "position"],
349
+ "additionalProperties": false,
350
+ "properties": {
351
+ "text": { "type": "string" },
352
+ "position": {
353
+ "type": "string",
354
+ "enum": [
355
+ "left",
356
+ "right",
357
+ "over"
358
+ ]
359
+ }
360
+ }
361
+ },
362
+ "step": {
363
+ "type": "object",
364
+ "description": "A playback step: either a from/to pair (a message between two nodes) or a nodes list (nodes highlighted together), never both.",
365
+ "additionalProperties": false,
366
+ "oneOf": [{
367
+ "required": ["from", "to"],
368
+ "not": { "required": ["nodes"] }
369
+ }, {
370
+ "required": ["nodes"],
371
+ "not": { "anyOf": [{ "required": ["from"] }, { "required": ["to"] }] }
372
+ }],
373
+ "properties": {
374
+ "from": {
375
+ "type": "string",
376
+ "description": "Source node id"
377
+ },
378
+ "to": {
379
+ "type": "string",
380
+ "description": "Target node id"
381
+ },
382
+ "nodes": {
383
+ "type": "array",
384
+ "description": "Node ids highlighted together at this step. Use instead of from/to when a step involves one node, or more than two.",
385
+ "items": { "type": "string" },
386
+ "minItems": 1,
387
+ "uniqueItems": true
388
+ },
389
+ "type": { "$ref": "#/$defs/stepType" },
390
+ "label": { "type": "string" },
391
+ "payload": { "type": "string" },
392
+ "duration": {
393
+ "type": "number",
394
+ "minimum": 0
395
+ },
396
+ "fragment": { "$ref": "#/$defs/fragment" },
397
+ "note": { "$ref": "#/$defs/note" }
398
+ }
399
+ },
400
+ "scenario": {
401
+ "type": "object",
402
+ "required": ["name"],
403
+ "additionalProperties": false,
404
+ "properties": {
405
+ "name": { "type": "string" },
406
+ "description": { "type": "string" },
407
+ "steps": {
408
+ "type": "array",
409
+ "items": { "$ref": "#/$defs/step" }
410
+ }
411
+ }
412
+ },
413
+ "point2d": {
414
+ "type": "array",
415
+ "items": { "type": "number" },
416
+ "minItems": 2,
417
+ "maxItems": 2
418
+ },
419
+ "size2d": {
420
+ "type": "array",
421
+ "description": "[width, height], or [width] alone to let the node's height follow its content",
422
+ "items": {
423
+ "type": "number",
424
+ "minimum": 0
425
+ },
426
+ "minItems": 1,
427
+ "maxItems": 2
428
+ },
429
+ "viewport": {
430
+ "type": "array",
431
+ "items": { "type": "number" },
432
+ "minItems": 3,
433
+ "maxItems": 3,
434
+ "description": "[x, y, zoom]"
435
+ },
436
+ "nodeStyle": {
437
+ "type": "object",
438
+ "additionalProperties": false,
439
+ "properties": {
440
+ "borderless": { "type": "boolean" },
441
+ "icon_url": {
442
+ "type": "string",
443
+ "format": "uri"
444
+ },
445
+ "icon_layout": {
446
+ "type": "string",
447
+ "enum": [
448
+ "left",
449
+ "right",
450
+ "top",
451
+ "bottom"
452
+ ]
453
+ },
454
+ "image_url": {
455
+ "type": "string",
456
+ "format": "uri"
457
+ }
458
+ }
459
+ },
460
+ "direction": {
461
+ "type": "string",
462
+ "description": "Auto-layout flow direction. Defaults to TB",
463
+ "enum": [
464
+ "TB",
465
+ "LR",
466
+ "BT",
467
+ "RL"
468
+ ]
469
+ },
470
+ "layout": {
471
+ "type": "object",
472
+ "additionalProperties": false,
473
+ "properties": {
474
+ "direction": { "$ref": "#/$defs/direction" },
475
+ "viewport": { "$ref": "#/$defs/viewport" },
476
+ "positions": {
477
+ "type": "object",
478
+ "additionalProperties": { "$ref": "#/$defs/point2d" }
479
+ },
480
+ "sizes": {
481
+ "type": "object",
482
+ "additionalProperties": { "$ref": "#/$defs/size2d" }
483
+ },
484
+ "node_styles": {
485
+ "type": "object",
486
+ "additionalProperties": { "$ref": "#/$defs/nodeStyle" }
487
+ }
488
+ }
489
+ }
490
+ }
399
491
  };
400
-
401
492
  // src/validate.ts
402
- var ajv = new import__.default({ allErrors: true });
403
- (0, import_ajv_formats.default)(ajv);
404
- var compiledValidate = ajv.compile(agentic_v0_1_default);
493
+ const ajv = new ajv_dist_2020_js.default({ allErrors: true });
494
+ (0, ajv_formats.default)(ajv);
495
+ const compiledValidate = ajv.compile(agentic_v0_1_default);
496
+ /**
497
+ * Validate a parsed YAML object against the agentic schema v0.1.
498
+ *
499
+ * This validates structure only — it does not parse YAML strings.
500
+ * Use your preferred YAML parser (js-yaml, yaml, etc.) first.
501
+ *
502
+ * @example
503
+ * ```ts
504
+ * import * as yaml from 'js-yaml';
505
+ * import { validate } from '@agenticdiagrams/schema';
506
+ *
507
+ * const doc = yaml.load(yamlString);
508
+ * const result = validate(doc);
509
+ * if (!result.valid) {
510
+ * console.error(result.errors);
511
+ * }
512
+ * ```
513
+ */
405
514
  function validate(data) {
406
- const valid = compiledValidate(data);
407
- if (valid) {
408
- return { valid: true, errors: [] };
409
- }
410
- const errors = (compiledValidate.errors ?? []).map((err) => {
411
- const path = err.instancePath || "/";
412
- const message = err.message || "unknown error";
413
- return `${path}: ${message}`;
414
- });
415
- return { valid: false, errors };
515
+ if (compiledValidate(data)) return {
516
+ valid: true,
517
+ errors: []
518
+ };
519
+ return {
520
+ valid: false,
521
+ errors: (compiledValidate.errors ?? []).map((err) => {
522
+ return `${err.instancePath || "/"}: ${err.message || "unknown error"}`;
523
+ })
524
+ };
416
525
  }
417
- // Annotate the CommonJS export names for ESM import in node:
418
- 0 && (module.exports = {
419
- validate
420
- });
526
+ exports.validate = validate;
527
+
421
528
  //# sourceMappingURL=index.cjs.map