@agenticdiagrams/schema 0.1.7 → 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 -105
- package/dist/index.d.ts +103 -105
- package/dist/index.js +494 -374
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs.map
CHANGED
|
@@ -1 +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 AgenticNodeMetadata,\n AgenticInlineEdge,\n AgenticEdge,\n AgenticEdgeArrows,\n AgenticEdgeMetadata,\n AgenticStep,\n AgenticStepDetail,\n AgenticMessageStep,\n AgenticHighlightStep,\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\": {\n \"type\": \"string\",\n \"description\": \"Parent diagram id for drill-down hierarchy\"\n },\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\",\n \"tool\",\n \"component\",\n \"backend\",\n \"generic\",\n \"note\",\n \"system\",\n \"memory\",\n \"gateway\",\n \"skill\",\n \"channel\",\n \"waypoint\",\n \"router\",\n \"human\",\n \"trigger\",\n \"guardrail\",\n \"model\",\n \"aggregator\",\n \"observability\",\n \"group\",\n \"block\",\n \"image\",\n \"prompt\",\n \"user\",\n \"output\",\n \"knowledge_base\",\n \"environment\",\n \"text_label\",\n \"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 \"badge\": {\n \"type\": \"string\",\n \"description\": \"Short tag shown on the node, e.g. NEW or beta\"\n },\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\": {\n \"type\": \"string\",\n \"description\": \"Drill-down target diagram id or file path\"\n },\n \"is_looping\": { \"type\": \"boolean\" },\n \"auth\": { \"type\": \"string\" },\n \"auth_detail\": { \"type\": \"string\" },\n \"provider\": { \"type\": \"string\" },\n \"model\": {\n \"type\": \"string\",\n \"description\": \"Model identifier, e.g. claude-sonnet-4-6. Primarily for agent and model nodes.\"\n },\n \"content\": { \"type\": \"string\" },\n \"example_response\": { \"type\": \"string\" },\n \"input_schema\": {\n \"type\": \"string\",\n \"description\": \"Input schema, usually JSON Schema serialised as a string. Primarily for tool nodes.\"\n },\n \"output_schema\": {\n \"type\": \"string\",\n \"description\": \"Output schema, usually JSON Schema serialised as a string. Primarily for tool nodes.\"\n },\n \"ttl\": {\n \"type\": \"string\",\n \"description\": \"Retention lifetime. Primarily for memory nodes. Preset values: session, 24h, permanent. Freeform strings (e.g. 7d) are accepted.\"\n },\n \"scope\": {\n \"type\": \"string\",\n \"description\": \"Audience scope. Primarily for memory nodes. Preset values: per-user, per-session, global. Freeform strings accepted.\"\n },\n \"metadata\": { \"$ref\": \"#/$defs/nodeMetadata\" },\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 \"nodeMetadata\": {\n \"type\": \"object\",\n \"description\": \"Freeform node properties the spec does not model, such as extra typed fields or editor hints. Values are strings, numbers or booleans.\",\n \"additionalProperties\": {\n \"anyOf\": [{ \"type\": \"string\" }, { \"type\": \"number\" }, { \"type\": \"boolean\" }]\n }\n },\n \"edgeType\": {\n \"type\": \"string\",\n \"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.\",\n \"enum\": [\n \"default\",\n \"request\",\n \"response\",\n \"async\",\n \"streaming\",\n \"event\",\n \"error\",\n \"data\",\n \"control\",\n \"stream\",\n \"tool\"\n ]\n },\n \"pathType\": {\n \"type\": \"string\",\n \"enum\": [\"bezier\", \"straight\", \"step\", \"smooth_step\", \"simple_bezier\"]\n },\n \"handlePosition\": {\n \"type\": \"string\",\n \"pattern\": \"^(?:top|right|bottom|left)(?:-\\\\d+(?:-t)?)?$\",\n \"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.\"\n },\n \"edgeMetadata\": {\n \"type\": \"object\",\n \"description\": \"Freeform presentation hints for an edge (editor cosmetics). Known keys are typed; unknown keys are allowed.\",\n \"additionalProperties\": true,\n \"properties\": {\n \"label_pos\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"maximum\": 1,\n \"description\": \"Label position along the edge as a fraction of its length (0 = source end, 1 = target end). Defaults to 0.5.\"\n }\n }\n },\n \"edgeArrows\": {\n \"enum\": [\"none\", \"start\", \"end\", \"both\"],\n \"description\": \"Which ends of an edge show an arrowhead: none, start (source), end (target), or both. Defaults to 'end'.\"\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 \"condition\": {\n \"type\": \"string\",\n \"description\": \"Branch condition expression, e.g. 'approved', 'score > 0.8', 'default'\"\n },\n \"animated\": { \"type\": \"boolean\", \"description\": \"Show animated flow on connection\" },\n \"arrows\": { \"$ref\": \"#/$defs/edgeArrows\" },\n \"path\": { \"$ref\": \"#/$defs/pathType\" },\n \"source_handle\": { \"$ref\": \"#/$defs/handlePosition\" },\n \"target_handle\": { \"$ref\": \"#/$defs/handlePosition\" },\n \"metadata\": { \"$ref\": \"#/$defs/edgeMetadata\" }\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 \"condition\": {\n \"type\": \"string\",\n \"description\": \"Branch condition expression, e.g. 'approved', 'score > 0.8', 'default'\"\n },\n \"animated\": { \"type\": \"boolean\", \"description\": \"Show animated flow on connection\" },\n \"arrows\": { \"$ref\": \"#/$defs/edgeArrows\" },\n \"path\": { \"$ref\": \"#/$defs/pathType\" },\n \"source_handle\": { \"$ref\": \"#/$defs/handlePosition\" },\n \"target_handle\": { \"$ref\": \"#/$defs/handlePosition\" },\n \"metadata\": { \"$ref\": \"#/$defs/edgeMetadata\" }\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 \"description\": \"A playback step: either a from/to pair (a message between two nodes) or a nodes list (nodes highlighted together), never both.\",\n \"additionalProperties\": false,\n \"oneOf\": [\n { \"required\": [\"from\", \"to\"], \"not\": { \"required\": [\"nodes\"] } },\n {\n \"required\": [\"nodes\"],\n \"not\": { \"anyOf\": [{ \"required\": [\"from\"] }, { \"required\": [\"to\"] }] }\n }\n ],\n \"properties\": {\n \"from\": { \"type\": \"string\", \"description\": \"Source node id\" },\n \"to\": { \"type\": \"string\", \"description\": \"Target node id\" },\n \"nodes\": {\n \"type\": \"array\",\n \"description\": \"Node ids highlighted together at this step. Use instead of from/to when a step involves one node, or more than two.\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1,\n \"uniqueItems\": true\n },\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 \"description\": \"[width, height], or [width] alone to let the node's height follow its content\",\n \"items\": { \"type\": \"number\", \"minimum\": 0 },\n \"minItems\": 1,\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,EAC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"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Ajv2020","addFormats","schema"],"sources":["../schema/agentic.v0.1.json","../src/validate.ts"],"sourcesContent":["","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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACSA,MAAM,MAAM,IAAIA,iBAAAA,QAAQ,EAAE,WAAW,KAAK,CAAC;CAC3CC,GAAAA,YAAAA,QAAAA,CAAW,GAAG;AACd,MAAM,mBAAmB,IAAI,QAAQC,oBAAM;;;;;;;;;;;;;;;;;;;AAoB3C,SAAgB,SAAS,MAAiC;CAGxD,IAFc,iBAAiB,IAEvB,GACN,OAAO;EAAE,OAAO;EAAM,QAAQ,CAAC;CAAE;CASnC,OAAO;EAAE,OAAO;EAAO,SANP,iBAAiB,UAAU,CAAC,EAAA,CAAG,KAAK,QAAQ;GAG1D,OAAO,GAFM,IAAI,gBAAgB,IAElB,IADC,IAAI,WAAW;EAEjC,CAE4B;CAAE;AAChC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -3,52 +3,52 @@
|
|
|
3
3
|
* These represent the parsed YAML structure, not any editor-specific model.
|
|
4
4
|
*/
|
|
5
5
|
interface AgenticYaml {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
agentic: '0.1';
|
|
7
|
+
diagram?: AgenticDiagram;
|
|
8
|
+
nodes?: Record<string, AgenticNode>;
|
|
9
|
+
edges?: AgenticEdge[];
|
|
10
|
+
scenarios?: Record<string, AgenticScenario>;
|
|
11
|
+
layout?: AgenticLayout;
|
|
12
12
|
}
|
|
13
13
|
interface AgenticDiagram {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
21
|
}
|
|
22
22
|
interface AgenticNode {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
type: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
sub_title?: string;
|
|
26
|
+
/** Short tag shown on the node, e.g. `NEW` or `beta`. */
|
|
27
|
+
badge?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
sub_type?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
group?: string;
|
|
32
|
+
linked_diagram?: string;
|
|
33
|
+
is_looping?: boolean;
|
|
34
|
+
auth?: string;
|
|
35
|
+
auth_detail?: string;
|
|
36
|
+
provider?: string;
|
|
37
|
+
/** Model identifier, e.g. `claude-sonnet-4-6` — primarily for agent and model nodes. */
|
|
38
|
+
model?: string;
|
|
39
|
+
content?: string;
|
|
40
|
+
example_response?: string;
|
|
41
|
+
/** Input schema, usually JSON Schema serialised as a string — primarily for tool nodes. */
|
|
42
|
+
input_schema?: string;
|
|
43
|
+
/** Output schema, usually JSON Schema serialised as a string — primarily for tool nodes. */
|
|
44
|
+
output_schema?: string;
|
|
45
|
+
edges?: AgenticInlineEdge[];
|
|
46
|
+
/** Retention lifetime — primarily for memory nodes. Preset values: 'session' | '24h' | 'permanent'. Freeform strings (e.g. '7d') are accepted. */
|
|
47
|
+
ttl?: string;
|
|
48
|
+
/** Audience scope — primarily for memory nodes. Preset values: 'per-user' | 'per-session' | 'global'. Freeform strings accepted. */
|
|
49
|
+
scope?: string;
|
|
50
|
+
/** Freeform properties the spec does not model (extra typed fields, editor hints). */
|
|
51
|
+
metadata?: AgenticNodeMetadata;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Freeform node properties the spec does not model — extra typed fields or
|
|
@@ -56,7 +56,7 @@ interface AgenticNode {
|
|
|
56
56
|
* Values are limited to strings, numbers and booleans.
|
|
57
57
|
*/
|
|
58
58
|
interface AgenticNodeMetadata {
|
|
59
|
-
|
|
59
|
+
[key: string]: string | number | boolean;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Freeform presentation hints for an edge (editor cosmetics). Known keys are
|
|
@@ -64,91 +64,90 @@ interface AgenticNodeMetadata {
|
|
|
64
64
|
* without a schema change.
|
|
65
65
|
*/
|
|
66
66
|
interface AgenticEdgeMetadata {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/** Label position along the edge as a fraction of its length (0 = source end, 1 = target end). Defaults to 0.5. */
|
|
68
|
+
label_pos?: number;
|
|
69
|
+
[key: string]: unknown;
|
|
70
70
|
}
|
|
71
71
|
/** Which ends of an edge show an arrowhead. Defaults to `'end'` (arrow at the target). */
|
|
72
72
|
type AgenticEdgeArrows = 'none' | 'start' | 'end' | 'both';
|
|
73
73
|
interface AgenticInlineEdge {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
to: string;
|
|
75
|
+
type?: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
condition?: string;
|
|
78
|
+
animated?: boolean;
|
|
79
|
+
arrows?: AgenticEdgeArrows;
|
|
80
|
+
path?: string;
|
|
81
|
+
source_handle?: string;
|
|
82
|
+
target_handle?: string;
|
|
83
|
+
metadata?: AgenticEdgeMetadata;
|
|
84
84
|
}
|
|
85
85
|
interface AgenticEdge {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
from: string;
|
|
87
|
+
to: string;
|
|
88
|
+
type?: string;
|
|
89
|
+
label?: string;
|
|
90
|
+
condition?: string;
|
|
91
|
+
animated?: boolean;
|
|
92
|
+
arrows?: AgenticEdgeArrows;
|
|
93
|
+
path?: string;
|
|
94
|
+
source_handle?: string;
|
|
95
|
+
target_handle?: string;
|
|
96
|
+
metadata?: AgenticEdgeMetadata;
|
|
97
97
|
}
|
|
98
98
|
/** Fields shared by both step forms. */
|
|
99
99
|
interface AgenticStepDetail {
|
|
100
|
-
|
|
100
|
+
type?: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
payload?: string;
|
|
103
|
+
duration?: number;
|
|
104
|
+
fragment?: {
|
|
105
|
+
type: 'alt' | 'opt' | 'loop' | 'par';
|
|
101
106
|
label?: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
note?: {
|
|
110
|
-
text: string;
|
|
111
|
-
position: 'left' | 'right' | 'over';
|
|
112
|
-
};
|
|
107
|
+
position: 'start' | 'else' | 'end';
|
|
108
|
+
};
|
|
109
|
+
note?: {
|
|
110
|
+
text: string;
|
|
111
|
+
position: 'left' | 'right' | 'over';
|
|
112
|
+
};
|
|
113
113
|
}
|
|
114
114
|
/** A step that is a message between two nodes. */
|
|
115
115
|
interface AgenticMessageStep extends AgenticStepDetail {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
from: string;
|
|
117
|
+
to: string;
|
|
118
|
+
nodes?: never;
|
|
119
119
|
}
|
|
120
120
|
/** A step that highlights nodes together — one node, or more than two. */
|
|
121
121
|
interface AgenticHighlightStep extends AgenticStepDetail {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
/** Node ids highlighted at this step (at least one, no duplicates). */
|
|
123
|
+
nodes: string[];
|
|
124
|
+
from?: never;
|
|
125
|
+
to?: never;
|
|
126
126
|
}
|
|
127
127
|
/** A playback step: a `from`/`to` message or a `nodes` highlight, never both. */
|
|
128
128
|
type AgenticStep = AgenticMessageStep | AgenticHighlightStep;
|
|
129
129
|
interface AgenticScenario {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
name: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
steps?: AgenticStep[];
|
|
133
133
|
}
|
|
134
134
|
interface AgenticNodeStyle {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
borderless?: boolean;
|
|
136
|
+
icon_url?: string;
|
|
137
|
+
icon_layout?: string;
|
|
138
|
+
image_url?: string;
|
|
139
139
|
}
|
|
140
140
|
interface AgenticLayout {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
direction?: 'TB' | 'LR' | 'BT' | 'RL';
|
|
142
|
+
viewport?: [number, number, number];
|
|
143
|
+
positions?: Record<string, [number, number]>;
|
|
144
|
+
/** Node id → `[width, height]`, or `[width]` alone when the height follows the node's content. */
|
|
145
|
+
sizes?: Record<string, [number, number] | [number]>;
|
|
146
|
+
node_styles?: Record<string, AgenticNodeStyle>;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
148
|
interface ValidationResult {
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
valid: boolean;
|
|
150
|
+
errors: string[];
|
|
152
151
|
}
|
|
153
152
|
/**
|
|
154
153
|
* Validate a parsed YAML object against the agentic schema v0.1.
|
|
@@ -168,6 +167,5 @@ interface ValidationResult {
|
|
|
168
167
|
* }
|
|
169
168
|
* ```
|
|
170
169
|
*/
|
|
171
|
-
declare function validate(data: unknown): ValidationResult;
|
|
172
|
-
|
|
173
|
-
export { type AgenticDiagram, type AgenticEdge, type AgenticEdgeArrows, type AgenticEdgeMetadata, type AgenticHighlightStep, type AgenticInlineEdge, type AgenticLayout, type AgenticMessageStep, type AgenticNode, type AgenticNodeMetadata, type AgenticNodeStyle, type AgenticScenario, type AgenticStep, type AgenticStepDetail, type AgenticYaml, type ValidationResult, validate };
|
|
170
|
+
export declare function validate(data: unknown): ValidationResult;
|
|
171
|
+
export type { AgenticDiagram, AgenticEdge, AgenticEdgeArrows, AgenticEdgeMetadata, AgenticHighlightStep, AgenticInlineEdge, AgenticLayout, AgenticMessageStep, AgenticNode, AgenticNodeMetadata, AgenticNodeStyle, AgenticScenario, AgenticStep, AgenticStepDetail, AgenticYaml, ValidationResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,52 +3,52 @@
|
|
|
3
3
|
* These represent the parsed YAML structure, not any editor-specific model.
|
|
4
4
|
*/
|
|
5
5
|
interface AgenticYaml {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
agentic: '0.1';
|
|
7
|
+
diagram?: AgenticDiagram;
|
|
8
|
+
nodes?: Record<string, AgenticNode>;
|
|
9
|
+
edges?: AgenticEdge[];
|
|
10
|
+
scenarios?: Record<string, AgenticScenario>;
|
|
11
|
+
layout?: AgenticLayout;
|
|
12
12
|
}
|
|
13
13
|
interface AgenticDiagram {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
21
|
}
|
|
22
22
|
interface AgenticNode {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
type: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
sub_title?: string;
|
|
26
|
+
/** Short tag shown on the node, e.g. `NEW` or `beta`. */
|
|
27
|
+
badge?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
sub_type?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
group?: string;
|
|
32
|
+
linked_diagram?: string;
|
|
33
|
+
is_looping?: boolean;
|
|
34
|
+
auth?: string;
|
|
35
|
+
auth_detail?: string;
|
|
36
|
+
provider?: string;
|
|
37
|
+
/** Model identifier, e.g. `claude-sonnet-4-6` — primarily for agent and model nodes. */
|
|
38
|
+
model?: string;
|
|
39
|
+
content?: string;
|
|
40
|
+
example_response?: string;
|
|
41
|
+
/** Input schema, usually JSON Schema serialised as a string — primarily for tool nodes. */
|
|
42
|
+
input_schema?: string;
|
|
43
|
+
/** Output schema, usually JSON Schema serialised as a string — primarily for tool nodes. */
|
|
44
|
+
output_schema?: string;
|
|
45
|
+
edges?: AgenticInlineEdge[];
|
|
46
|
+
/** Retention lifetime — primarily for memory nodes. Preset values: 'session' | '24h' | 'permanent'. Freeform strings (e.g. '7d') are accepted. */
|
|
47
|
+
ttl?: string;
|
|
48
|
+
/** Audience scope — primarily for memory nodes. Preset values: 'per-user' | 'per-session' | 'global'. Freeform strings accepted. */
|
|
49
|
+
scope?: string;
|
|
50
|
+
/** Freeform properties the spec does not model (extra typed fields, editor hints). */
|
|
51
|
+
metadata?: AgenticNodeMetadata;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Freeform node properties the spec does not model — extra typed fields or
|
|
@@ -56,7 +56,7 @@ interface AgenticNode {
|
|
|
56
56
|
* Values are limited to strings, numbers and booleans.
|
|
57
57
|
*/
|
|
58
58
|
interface AgenticNodeMetadata {
|
|
59
|
-
|
|
59
|
+
[key: string]: string | number | boolean;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Freeform presentation hints for an edge (editor cosmetics). Known keys are
|
|
@@ -64,91 +64,90 @@ interface AgenticNodeMetadata {
|
|
|
64
64
|
* without a schema change.
|
|
65
65
|
*/
|
|
66
66
|
interface AgenticEdgeMetadata {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/** Label position along the edge as a fraction of its length (0 = source end, 1 = target end). Defaults to 0.5. */
|
|
68
|
+
label_pos?: number;
|
|
69
|
+
[key: string]: unknown;
|
|
70
70
|
}
|
|
71
71
|
/** Which ends of an edge show an arrowhead. Defaults to `'end'` (arrow at the target). */
|
|
72
72
|
type AgenticEdgeArrows = 'none' | 'start' | 'end' | 'both';
|
|
73
73
|
interface AgenticInlineEdge {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
to: string;
|
|
75
|
+
type?: string;
|
|
76
|
+
label?: string;
|
|
77
|
+
condition?: string;
|
|
78
|
+
animated?: boolean;
|
|
79
|
+
arrows?: AgenticEdgeArrows;
|
|
80
|
+
path?: string;
|
|
81
|
+
source_handle?: string;
|
|
82
|
+
target_handle?: string;
|
|
83
|
+
metadata?: AgenticEdgeMetadata;
|
|
84
84
|
}
|
|
85
85
|
interface AgenticEdge {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
from: string;
|
|
87
|
+
to: string;
|
|
88
|
+
type?: string;
|
|
89
|
+
label?: string;
|
|
90
|
+
condition?: string;
|
|
91
|
+
animated?: boolean;
|
|
92
|
+
arrows?: AgenticEdgeArrows;
|
|
93
|
+
path?: string;
|
|
94
|
+
source_handle?: string;
|
|
95
|
+
target_handle?: string;
|
|
96
|
+
metadata?: AgenticEdgeMetadata;
|
|
97
97
|
}
|
|
98
98
|
/** Fields shared by both step forms. */
|
|
99
99
|
interface AgenticStepDetail {
|
|
100
|
-
|
|
100
|
+
type?: string;
|
|
101
|
+
label?: string;
|
|
102
|
+
payload?: string;
|
|
103
|
+
duration?: number;
|
|
104
|
+
fragment?: {
|
|
105
|
+
type: 'alt' | 'opt' | 'loop' | 'par';
|
|
101
106
|
label?: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
note?: {
|
|
110
|
-
text: string;
|
|
111
|
-
position: 'left' | 'right' | 'over';
|
|
112
|
-
};
|
|
107
|
+
position: 'start' | 'else' | 'end';
|
|
108
|
+
};
|
|
109
|
+
note?: {
|
|
110
|
+
text: string;
|
|
111
|
+
position: 'left' | 'right' | 'over';
|
|
112
|
+
};
|
|
113
113
|
}
|
|
114
114
|
/** A step that is a message between two nodes. */
|
|
115
115
|
interface AgenticMessageStep extends AgenticStepDetail {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
from: string;
|
|
117
|
+
to: string;
|
|
118
|
+
nodes?: never;
|
|
119
119
|
}
|
|
120
120
|
/** A step that highlights nodes together — one node, or more than two. */
|
|
121
121
|
interface AgenticHighlightStep extends AgenticStepDetail {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
/** Node ids highlighted at this step (at least one, no duplicates). */
|
|
123
|
+
nodes: string[];
|
|
124
|
+
from?: never;
|
|
125
|
+
to?: never;
|
|
126
126
|
}
|
|
127
127
|
/** A playback step: a `from`/`to` message or a `nodes` highlight, never both. */
|
|
128
128
|
type AgenticStep = AgenticMessageStep | AgenticHighlightStep;
|
|
129
129
|
interface AgenticScenario {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
name: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
steps?: AgenticStep[];
|
|
133
133
|
}
|
|
134
134
|
interface AgenticNodeStyle {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
borderless?: boolean;
|
|
136
|
+
icon_url?: string;
|
|
137
|
+
icon_layout?: string;
|
|
138
|
+
image_url?: string;
|
|
139
139
|
}
|
|
140
140
|
interface AgenticLayout {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
direction?: 'TB' | 'LR' | 'BT' | 'RL';
|
|
142
|
+
viewport?: [number, number, number];
|
|
143
|
+
positions?: Record<string, [number, number]>;
|
|
144
|
+
/** Node id → `[width, height]`, or `[width]` alone when the height follows the node's content. */
|
|
145
|
+
sizes?: Record<string, [number, number] | [number]>;
|
|
146
|
+
node_styles?: Record<string, AgenticNodeStyle>;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
148
|
interface ValidationResult {
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
valid: boolean;
|
|
150
|
+
errors: string[];
|
|
152
151
|
}
|
|
153
152
|
/**
|
|
154
153
|
* Validate a parsed YAML object against the agentic schema v0.1.
|
|
@@ -168,6 +167,5 @@ interface ValidationResult {
|
|
|
168
167
|
* }
|
|
169
168
|
* ```
|
|
170
169
|
*/
|
|
171
|
-
declare function validate(data: unknown): ValidationResult;
|
|
172
|
-
|
|
173
|
-
export { type AgenticDiagram, type AgenticEdge, type AgenticEdgeArrows, type AgenticEdgeMetadata, type AgenticHighlightStep, type AgenticInlineEdge, type AgenticLayout, type AgenticMessageStep, type AgenticNode, type AgenticNodeMetadata, type AgenticNodeStyle, type AgenticScenario, type AgenticStep, type AgenticStepDetail, type AgenticYaml, type ValidationResult, validate };
|
|
170
|
+
export declare function validate(data: unknown): ValidationResult;
|
|
171
|
+
export type { AgenticDiagram, AgenticEdge, AgenticEdgeArrows, AgenticEdgeMetadata, AgenticHighlightStep, AgenticInlineEdge, AgenticLayout, AgenticMessageStep, AgenticNode, AgenticNodeMetadata, AgenticNodeStyle, AgenticScenario, AgenticStep, AgenticStepDetail, AgenticYaml, ValidationResult };
|