@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 +513 -406
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +103 -106
- package/dist/index.d.ts +103 -106
- package/dist/index.js +494 -374
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,421 +1,528 @@
|
|
|
1
|
-
"
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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
|
-
|
|
403
|
-
(0,
|
|
404
|
-
|
|
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
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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
|
-
|
|
418
|
-
|
|
419
|
-
validate
|
|
420
|
-
});
|
|
526
|
+
exports.validate = validate;
|
|
527
|
+
|
|
421
528
|
//# sourceMappingURL=index.cjs.map
|