@parcha/agentrun-dsl 0.1.0-beta.20 → 0.1.0-beta.200

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.
Files changed (76) hide show
  1. package/NOTICE +2 -0
  2. package/README.md +141 -21
  3. package/dist/author-references.d.ts +8 -0
  4. package/dist/author-references.js +8 -0
  5. package/dist/author.d.ts +4 -3
  6. package/dist/author.js +19 -10
  7. package/dist/authoring.js +4 -3
  8. package/dist/cli.js +13 -12
  9. package/dist/code-exec.d.ts +19 -0
  10. package/dist/code-exec.js +54 -5
  11. package/dist/decision-provider.d.ts +166 -0
  12. package/dist/decision-provider.js +238 -0
  13. package/dist/decision-receipts.d.ts +64 -3
  14. package/dist/decision-receipts.js +50 -8
  15. package/dist/dry-run.d.ts +31 -1
  16. package/dist/dry-run.js +122 -16
  17. package/dist/edit.d.ts +149 -0
  18. package/dist/edit.js +1415 -0
  19. package/dist/evidence.d.ts +19 -0
  20. package/dist/evidence.js +63 -0
  21. package/dist/graph.d.ts +91 -5
  22. package/dist/graph.js +212 -10
  23. package/dist/index.d.ts +17 -12
  24. package/dist/index.js +16 -10
  25. package/dist/inspection.d.ts +5 -0
  26. package/dist/inspection.js +14 -1
  27. package/dist/pattern-screen.d.ts +14 -0
  28. package/dist/pattern-screen.js +451 -0
  29. package/dist/predicates.d.ts +29 -0
  30. package/dist/predicates.js +62 -3
  31. package/dist/record.d.ts +4 -0
  32. package/dist/record.js +6 -0
  33. package/dist/recovery/binding.js +2 -1
  34. package/dist/recovery/call-key.d.ts +0 -4
  35. package/dist/recovery/call-key.js +0 -7
  36. package/dist/recovery/driver.d.ts +61 -24
  37. package/dist/recovery/driver.js +193 -68
  38. package/dist/recovery/frozen-snapshot.d.ts +33 -3
  39. package/dist/recovery/frozen-snapshot.js +28 -12
  40. package/dist/recovery/handoff-receipts.d.ts +0 -35
  41. package/dist/recovery/handoff-receipts.js +2 -44
  42. package/dist/recovery/index.d.ts +4 -8
  43. package/dist/recovery/index.js +4 -7
  44. package/dist/recovery/with-recovery.d.ts +9 -3
  45. package/dist/recovery/with-recovery.js +72 -15
  46. package/dist/submit-envelope.d.ts +9 -0
  47. package/dist/submit-envelope.js +44 -0
  48. package/dist/system-one.d.ts +21 -2
  49. package/dist/system-one.js +96 -18
  50. package/dist/testing/decision-provider.d.ts +32 -0
  51. package/dist/testing/decision-provider.js +183 -0
  52. package/dist/testing/index.d.ts +1 -0
  53. package/dist/testing/index.js +2 -0
  54. package/dist/vocabulary.d.ts +11 -3
  55. package/dist/vocabulary.js +18 -8
  56. package/dist/workflow-shape.js +34 -7
  57. package/dist/workflow.d.ts +128 -19
  58. package/dist/workflow.js +772 -238
  59. package/dist/zod-json-contract.js +6 -8
  60. package/package.json +16 -4
  61. package/schema/workflow.schema.json +352 -1
  62. package/skills/author/SKILL.md +4 -1
  63. package/skills/author/references/jev-decisions.md +50 -5
  64. package/skills/author/references/language.md +17 -12
  65. package/dist/recovery/effect-failure.d.ts +0 -34
  66. package/dist/recovery/effect-failure.js +0 -62
  67. package/dist/recovery/handoff-block.d.ts +0 -36
  68. package/dist/recovery/handoff-block.js +0 -148
  69. package/dist/recovery/handoff-digest.d.ts +0 -58
  70. package/dist/recovery/handoff-digest.js +0 -195
  71. package/dist/recovery/handoff-files.d.ts +0 -54
  72. package/dist/recovery/handoff-files.js +0 -162
  73. package/dist/recovery/handoff-redact.d.ts +0 -12
  74. package/dist/recovery/handoff-redact.js +0 -44
  75. package/dist/recovery/handoff.d.ts +0 -44
  76. package/dist/recovery/handoff.js +0 -46
@@ -0,0 +1,19 @@
1
+ import type { DecisionEvidence } from "./decision-provider.js";
2
+ /** The longest title an item keeps, in code points. */
3
+ export declare const EVIDENCE_TITLE_MAX = 300;
4
+ /** The longest passage an item keeps, in code points. */
5
+ export declare const EVIDENCE_EXCERPT_MAX = 4096;
6
+ /** The most passages one item keeps. */
7
+ export declare const EVIDENCE_EXCERPTS_PER_ITEM = 5;
8
+ /** The most items a decision's evidence keeps. */
9
+ export declare const EVIDENCE_ITEMS_MAX = 20;
10
+ /** The most code points of titles and passages a decision's evidence keeps, all items together. */
11
+ export declare const EVIDENCE_TEXT_MAX: number;
12
+ /** What a caller keeps of each citation: `excerpts: false` keeps none of its passages. */
13
+ export type EvidenceOptions = {
14
+ excerpts?: boolean;
15
+ };
16
+ /** Raw citations as a decision's evidence. Items in order, each kept or dropped by its URL, its text plain and cut, until
17
+ * the item count or the code-point budget is reached. With `excerpts: false` no item keeps a passage. Idempotent: clean
18
+ * evidence comes back as it went in. */
19
+ export declare function evidenceOf(raw: unknown, { excerpts: withExcerpts }?: EvidenceOptions): DecisionEvidence[];
@@ -0,0 +1,63 @@
1
+ import { isRecord } from "./record.js";
2
+ /** The longest title an item keeps, in code points. */
3
+ export const EVIDENCE_TITLE_MAX = 300;
4
+ /** The longest passage an item keeps, in code points. */
5
+ export const EVIDENCE_EXCERPT_MAX = 4096;
6
+ /** The most passages one item keeps. */
7
+ export const EVIDENCE_EXCERPTS_PER_ITEM = 5;
8
+ /** The most items a decision's evidence keeps. */
9
+ export const EVIDENCE_ITEMS_MAX = 20;
10
+ /** The most code points of titles and passages a decision's evidence keeps, all items together. */
11
+ export const EVIDENCE_TEXT_MAX = 32 * 1024;
12
+ /** The longest `scope` an item keeps, in code points. */
13
+ const SCOPE_MAX = 64;
14
+ // C0 controls but tab, newline and return; DEL and the C1 controls; the Unicode direction marks, overrides and isolates.
15
+ const CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f‎‏‪-‮⁦-⁩]/g;
16
+ const codePoints = (text) => Array.from(text).length;
17
+ /** `text` with its control characters gone, cut to `max` code points (an ellipsis marking a cut). */
18
+ function plain(text, max) {
19
+ const clean = text.replace(CONTROL, "");
20
+ const chars = Array.from(clean);
21
+ return chars.length <= max ? clean : `${chars.slice(0, Math.max(0, max - 1)).join("")}…`;
22
+ }
23
+ /** The URL as the parser normalizes it, if it is http(s) with no user or password; else undefined, and its item is dropped. */
24
+ function webUrl(url) {
25
+ if (typeof url !== "string")
26
+ return undefined;
27
+ const parsed = URL.parse(url);
28
+ if (!parsed || (parsed.protocol !== "http:" && parsed.protocol !== "https:") || parsed.username || parsed.password)
29
+ return undefined;
30
+ return parsed.href;
31
+ }
32
+ /** Raw citations as a decision's evidence. Items in order, each kept or dropped by its URL, its text plain and cut, until
33
+ * the item count or the code-point budget is reached. With `excerpts: false` no item keeps a passage. Idempotent: clean
34
+ * evidence comes back as it went in. */
35
+ export function evidenceOf(raw, { excerpts: withExcerpts = true } = {}) {
36
+ const kept = [];
37
+ let left = EVIDENCE_TEXT_MAX;
38
+ for (const item of Array.isArray(raw) ? raw : []) {
39
+ if (kept.length >= EVIDENCE_ITEMS_MAX || left <= 0)
40
+ break;
41
+ if (!isRecord(item))
42
+ continue;
43
+ const { url: rawUrl, title: rawTitle, excerpts: rawExcerpts, scope: rawScope } = item;
44
+ const url = webUrl(rawUrl);
45
+ if (!url)
46
+ continue;
47
+ const title = typeof rawTitle === "string" ? plain(rawTitle, Math.min(EVIDENCE_TITLE_MAX, left)) : null;
48
+ left -= title === null ? 0 : codePoints(title);
49
+ const excerpts = [];
50
+ for (const excerpt of withExcerpts && Array.isArray(rawExcerpts) ? rawExcerpts : []) {
51
+ if (excerpts.length >= EVIDENCE_EXCERPTS_PER_ITEM || left <= 0)
52
+ break;
53
+ if (typeof excerpt !== "string")
54
+ continue;
55
+ const text = plain(excerpt, Math.min(EVIDENCE_EXCERPT_MAX, left));
56
+ excerpts.push(text);
57
+ left -= codePoints(text);
58
+ }
59
+ const scope = typeof rawScope === "string" && rawScope ? plain(rawScope, SCOPE_MAX) : "call";
60
+ kept.push({ url, title, excerpts, scope });
61
+ }
62
+ return kept;
63
+ }
package/dist/graph.d.ts CHANGED
@@ -1,12 +1,36 @@
1
1
  /** One node of the workflow as written. `path` is a JSON Pointer (RFC 6901) into the document: `/root` is the root,
2
2
  * `/root/steps/1` a chain's second step, `/root/branches/<name>/body` a route's branch, `/root/body` a map's or a
3
3
  * loop's body, `/root/workflow/root` a child workflow's root: the pointers `inspectWorkflow` and a validation issue
4
- * use for the same node. `label` is the node's label, or its kind when it has none. `via` is a `call` node's transport. */
4
+ * use for the same node. `label` is the node's label, or its kind when it has none. `via` is a `call` node's transport.
5
+ * `changeCheck` detects a change to the node's own fields from one graph to another: 8 hex digits, the FNV-1a hash of
6
+ * the canonical JSON (keys sorted) of the node with its children left out as the walk leaves them out (a chain's steps,
7
+ * a parallel's branches, a map's or a loop's body, each route branch's body, a child workflow's root). A route's branch
8
+ * names are its own fields, since they decide which branch runs, so a route that gains or loses a branch is rewritten. It
9
+ * is not an identity and not a saved revision's sha256: two nodes with the same check are not the same node, and a check
10
+ * that stayed only means no change was seen. A graph built by hand may leave it out. */
5
11
  export type GraphNode = {
6
12
  path: string;
7
13
  kind: string;
8
14
  label: string;
9
15
  via?: string;
16
+ changeCheck?: string;
17
+ } & GraphDecision;
18
+ /** One typed question a decision node asks, as a viewer shows it: its id, its type (`unknown` when its schema is not a
19
+ * question the reader recognizes), its instructions, and a choice's options. */
20
+ export type GraphQuestion = {
21
+ id: string;
22
+ type: "noul" | "choice" | "score" | "unknown";
23
+ instructions: string;
24
+ options?: string[];
25
+ };
26
+ /** What a decision node (judge, pick, sift, a judged route, or a loop or escalate whose predicate is `ask`) says about
27
+ * its decision, read from the document: the provider and model it names (absent when it names none), its questions, and
28
+ * the tokens of the images it sends. A graph of another node carries none of these. */
29
+ export type GraphDecision = {
30
+ provider?: string;
31
+ model?: string;
32
+ questions?: GraphQuestion[];
33
+ images?: string[];
10
34
  };
11
35
  /** How control reaches `to` from `from`.
12
36
  * - `next`: a chain enters its first step and each step is followed by the next; a loop enters its body, which runs again
@@ -33,8 +57,9 @@ export declare function workflowGraph(workflow: unknown): WorkflowGraph;
33
57
  * only those that started, so it is `done` only once the map or loop is: until then it is `working`, and a done node never
34
58
  * goes back. A container (chain, parallel, map, loop, route, workflow) is `working` while some of
35
59
  * its descendants are, or some are done and it is not; a node a run never reached, a branch a route did not take among
36
- * them, is `not-run`. */
37
- export type NodeState = "done" | "working" | "failed" | "not-run";
60
+ * them, is `not-run`. `escalated` is where the run ended on an escalation: the escalate node that fired and each container
61
+ * on its path. It is read from the run's terminal result, never from the frame, which holds no mark for that node. */
62
+ export type NodeState = "done" | "working" | "failed" | "not-run" | "escalated";
38
63
  type Frame = {
39
64
  done?: unknown;
40
65
  steps?: unknown;
@@ -48,11 +73,21 @@ export type ItemRecordLike = {
48
73
  status?: unknown;
49
74
  frame?: Frame;
50
75
  };
76
+ /** The part of a run's terminal result the status reads: its `status` and, for an escalation, the execution path of the
77
+ * node it stopped at (`escalation.executionPath`, as `runWorkflow` returns it). */
78
+ export type TerminalResultLike = {
79
+ status?: unknown;
80
+ escalation?: {
81
+ executionPath?: unknown;
82
+ };
83
+ };
51
84
  /** What `nodeStatus` reads: a driver frame (the `pin` of a frozen snapshot: `done`, `steps`, `inputs`), a frozen snapshot
52
- * (its `pin`), or the map items' records, alone or together with the driver's record (`{ pin, items }`). */
85
+ * (its `pin`), or the map items' records, alone or together with the driver's record (`{ pin, items }`), and with it the
86
+ * run's terminal `result` once the run has ended. */
53
87
  export type StatusSource = Frame | {
54
88
  pin: Frame;
55
89
  items?: readonly ItemRecordLike[];
90
+ result?: TerminalResultLike | null;
56
91
  } | readonly ItemRecordLike[];
57
92
  /** `item`: the source is one map item's (or loop iteration's) record, read on its own, and this is its execution path
58
93
  * (`<map path>/items/<index>`, `<loop path>/iterations/<index>`). That item is then the instance, not one of many: its body is done
@@ -62,7 +97,9 @@ export type StatusOptions = {
62
97
  };
63
98
  /** For every node of `graph`, the state the record shows. `source` is what the driver kept: its frame and, in the keyed
64
99
  * layout, the records of the map items (a run's whole story is the frame and the items together). A source that is not
65
- * one of those shows no node run. */
100
+ * one of those shows no node run. With the run's terminal `result`, an escalation that names a node of the graph marks
101
+ * that node and every container on its path `escalated`, and the maps and loops on that path have ended, so what finished
102
+ * inside them is done; without one, or when it names no node of the graph, nothing else changes. */
66
103
  export declare function nodeStatus(graph: WorkflowGraph, source: StatusSource, options?: StatusOptions): Record<string, NodeState>;
67
104
  /** Where an execution path is in the graph: the node it ran at (`path`, a node of the graph) and the map items and loop
68
105
  * iterations it ran in, outermost first. */
@@ -80,4 +117,53 @@ export type GraphNodeAt = {
80
117
  * a path the graph does not have, or one that is not an execution path (a map's `body` without an item, an item without
81
118
  * its `body`). */
82
119
  export declare function graphNodeOf(graph: WorkflowGraph, executionPath: string): GraphNodeAt | undefined;
120
+ /** A node as `graphDiff` reports it: its path in the graph it is in, its kind and its label. */
121
+ export type GraphDiffNode = {
122
+ path: string;
123
+ kind: string;
124
+ label: string;
125
+ };
126
+ /** What changed from one graph to the next. `added` holds nodes of `next` only (paths in `next`), `removed` nodes of `prev`
127
+ * only (paths in `prev`); `changed` the same node at the same path with a new kind or label; `moved` the same node at a
128
+ * new path; `rewritten` the same node, its kind and label as they were, with other own fields changed (its `changeCheck`
129
+ * differs: new instructions, a new budget), at its path in each graph; `edges.added` edges of `next` only and
130
+ * `edges.removed` edges of `prev` only, each in its own graph's paths. */
131
+ export type GraphDiff = {
132
+ added: GraphDiffNode[];
133
+ removed: GraphDiffNode[];
134
+ changed: {
135
+ prev: string;
136
+ next: string;
137
+ was: {
138
+ kind: string;
139
+ label: string;
140
+ };
141
+ now: {
142
+ kind: string;
143
+ label: string;
144
+ };
145
+ }[];
146
+ moved: {
147
+ prev: string;
148
+ next: string;
149
+ }[];
150
+ rewritten: {
151
+ prev: string;
152
+ next: string;
153
+ kind: string;
154
+ label: string;
155
+ }[];
156
+ edges: {
157
+ added: GraphEdge[];
158
+ removed: GraphEdge[];
159
+ };
160
+ };
161
+ /** What changed between two graphs of a workflow, such as two saved revisions of one. A node is the same in both when its
162
+ * `(kind, label)` is unique in each graph, wherever it is: a step inserted before others is one `added` node and the rest
163
+ * `moved`, never a run of changes. A node whose `(kind, label)` repeats in either graph, or is in one only, is the same
164
+ * as the other graph's node at its path, unless that node is already matched by its identity; with a new kind or label
165
+ * it is `changed`. A matched node with its kind and label as they were and another `changeCheck` is `rewritten`; a node
166
+ * without a check in either graph is never reported rewritten. An edge is the same when both its ends are the same nodes
167
+ * and its kind is the same. Every list is in its graph's node or edge order. */
168
+ export declare function graphDiff(prev: WorkflowGraph, next: WorkflowGraph): GraphDiff;
83
169
  export {};
package/dist/graph.js CHANGED
@@ -2,28 +2,73 @@
2
2
  // (the static viewer inlines it) and the pi session's text view draw the same graph; nothing here validates, runs or
3
3
  // reads a store. `workflowGraph` reads the workflow JSON as written; `nodeStatus` reads the driver's record of a run
4
4
  // (the `agentrun.driver` frame of the frozen snapshot, and the `agentrun.items` of a keyed-layout run) and says, for
5
- // each node of that graph, whether it is done, working, failed or not run; `graphNodeOf` names the node an execution path ran
6
- // at, and the map items and loop iterations around it.
5
+ // each node of that graph, whether it is done, working, failed or not run, or, given the run's terminal result, where an
6
+ // escalation stopped it; `graphNodeOf` names the node an execution path ran
7
+ // at, and the map items and loop iterations around it; `graphDiff` says what changed between two graphs of a workflow.
7
8
  const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8
9
  const pointer = (part) => part.replace(/~/g, "~0").replace(/\//g, "~1");
9
10
  /** The nesting depth `validateWorkflow` and `inspectWorkflow` accept (128 JSON levels): a node nests at least one level deeper than its parent, so every node of such a document is within it. */
10
11
  const MAX_DEPTH = 128;
12
+ /** A value as canonical JSON: object keys sorted, undefined members left out, other values as JSON writes them. Deeper
13
+ * than `MAX_DEPTH` a value is written as one marker, so a value that is not JSON (a cycle) still ends. A leaf JSON
14
+ * cannot encode (a bigint, a symbol) is written as a marker of its type, so changeCheck is total: `workflowGraph` never
15
+ * throws on a node the validator accepts, and such a leaf still changes the check when it changes value. */
16
+ const leaf = (value) => {
17
+ try {
18
+ return JSON.stringify(value) ?? "null";
19
+ }
20
+ catch {
21
+ return JSON.stringify(`[${typeof value}:${String(value)}]`);
22
+ }
23
+ };
24
+ const canonicalJson = (value, depth = 0) => {
25
+ if (depth > MAX_DEPTH)
26
+ return '"…"';
27
+ if (Array.isArray(value))
28
+ return `[${value.map((item) => canonicalJson(item, depth + 1)).join(",")}]`;
29
+ if (isObject(value))
30
+ return `{${Object.keys(value).filter((key) => value[key] !== undefined).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key], depth + 1)}`).join(",")}}`;
31
+ return leaf(value);
32
+ };
33
+ /** FNV-1a (32 bits) over the UTF-16 code units of `text`, as 8 hex digits. */
34
+ const fnv1a = (text) => {
35
+ let hash = 0x811c9dc5;
36
+ for (let i = 0; i < text.length; i += 1)
37
+ hash = Math.imul(hash ^ text.charCodeAt(i), 0x01000193);
38
+ return (hash >>> 0).toString(16).padStart(8, "0");
39
+ };
40
+ const without = (value, key) => Object.fromEntries(Object.entries(value).filter(([name]) => name !== key));
41
+ /** A node's own fields: the node with the children the walk visits left out. */
42
+ const ownFields = (node) => {
43
+ switch (node.node) {
44
+ case "chain": return without(node, "steps");
45
+ case "parallel": return without(node, "branches");
46
+ case "map":
47
+ case "loop": return without(node, "body");
48
+ case "route": return isObject(node.branches)
49
+ ? { ...node, branches: Object.fromEntries(Object.entries(node.branches).map(([name, branch]) => [name, isObject(branch) ? without(branch, "body") : branch])) }
50
+ : node;
51
+ case "workflow": return isObject(node.workflow) ? { ...node, workflow: without(node.workflow, "root") } : node;
52
+ default: return node;
53
+ }
54
+ };
11
55
  /** The graph of `workflow`, computed from its JSON alone: nodes in document order (a node, then its descendants), and the
12
56
  * edges between them. A value that is not a workflow, or a node the walk does not know, adds nothing and never throws:
13
57
  * validation is `validateWorkflow`'s. */
14
58
  export function workflowGraph(workflow) {
15
59
  const nodes = [];
16
60
  const edges = [];
17
- const visit = (node, path, depth) => {
61
+ const visit = (node, path, depth, schemas) => {
18
62
  if (!isObject(node) || typeof node.node !== "string" || depth > MAX_DEPTH)
19
63
  return;
20
64
  nodes.push({ path, kind: node.node, label: typeof node.label === "string" ? node.label : node.node,
21
- ...(node.node === "call" && typeof node.via === "string" ? { via: node.via } : {}) });
22
- const child = (target, at, kind, from = path) => {
65
+ ...(node.node === "call" && typeof node.via === "string" ? { via: node.via } : {}), changeCheck: fnv1a(canonicalJson(ownFields(node))),
66
+ ...decisionOf(node, schemas) });
67
+ const child = (target, at, kind, from = path, inner = schemas) => {
23
68
  if (!isObject(target) || typeof target.node !== "string" || depth + 1 > MAX_DEPTH)
24
69
  return;
25
70
  edges.push({ from, to: at, kind });
26
- visit(target, at, depth + 1);
71
+ visit(target, at, depth + 1, inner);
27
72
  };
28
73
  switch (node.node) {
29
74
  case "chain":
@@ -48,20 +93,86 @@ export function workflowGraph(workflow) {
48
93
  break;
49
94
  case "workflow":
50
95
  if (isObject(node.workflow))
51
- child(node.workflow.root, `${path}/workflow/root`, "child");
96
+ child(node.workflow.root, `${path}/workflow/root`, "child", path, isObject(node.workflow.schemas) ? node.workflow.schemas : {});
52
97
  break;
53
98
  }
54
99
  };
55
- visit(isObject(workflow) ? workflow.root : undefined, "/root", 0);
100
+ visit(isObject(workflow) ? workflow.root : undefined, "/root", 0, isObject(workflow) && isObject(workflow.schemas) ? workflow.schemas : {});
56
101
  return { nodes, edges };
57
102
  }
103
+ /** The questions of a question schema (`out` of a judge or sift): a flat object whose properties are the questions, a
104
+ * string enum a choice, a boolean a noul, an integer a score; a local `#/definitions/<id>` reference is followed. */
105
+ const schemaQuestions = (schemaId, schemas) => {
106
+ const root = typeof schemaId === "string" && Object.hasOwn(schemas, schemaId) ? schemas[schemaId] : undefined;
107
+ const resolve = (spec) => {
108
+ for (let hops = 0; isObject(spec) && typeof spec.$ref === "string" && hops < 8; hops += 1) {
109
+ const id = /^#\/definitions\/(.+)$/.exec(spec.$ref)?.[1];
110
+ const inline = isObject(root) && isObject(root.definitions) ? root.definitions : {};
111
+ spec = id === undefined ? undefined : Object.hasOwn(inline, id) ? inline[id] : Object.hasOwn(schemas, id) ? schemas[id] : undefined;
112
+ }
113
+ return spec;
114
+ };
115
+ const object = resolve(root);
116
+ if (!isObject(object) || !isObject(object.properties))
117
+ return [];
118
+ return Object.entries(object.properties).map(([id, raw]) => {
119
+ const spec = resolve(raw);
120
+ const instructions = isObject(spec) && typeof spec.description === "string" ? spec.description : "";
121
+ const types = isObject(spec) ? (Array.isArray(spec.type) ? spec.type : [spec.type]).filter((type) => type !== "null") : [];
122
+ if (isObject(spec) && Array.isArray(spec.enum))
123
+ return { id, type: "choice", instructions, options: spec.enum.map(String) };
124
+ if (types.length === 1 && types[0] === "boolean")
125
+ return { id, type: "noul", instructions };
126
+ if (types.length === 1 && types[0] === "integer")
127
+ return { id, type: "score", instructions };
128
+ return { id, type: "unknown", instructions };
129
+ });
130
+ };
131
+ /** A decision node's provider, model, questions and image tokens, as written. */
132
+ const decisionOf = (node, schemas) => {
133
+ let source = node;
134
+ let questions;
135
+ const text = (value) => typeof value === "string" ? value : "";
136
+ switch (node.node) {
137
+ case "judge":
138
+ case "sift":
139
+ questions = schemaQuestions(node.out, schemas);
140
+ break;
141
+ case "pick":
142
+ questions = [{ id: "pick", type: "choice", instructions: text(node.instructions) }];
143
+ break;
144
+ case "route":
145
+ if (node.valuePath !== undefined)
146
+ return {};
147
+ questions = [{ id: "branch", type: "choice", instructions: text(node.instructions), options: isObject(node.branches) ? Object.keys(node.branches) : [] }];
148
+ break;
149
+ case "loop":
150
+ case "escalate": {
151
+ const predicate = node.node === "loop" ? node.until : node.when;
152
+ if (!isObject(predicate) || predicate.predicate !== "ask")
153
+ return {};
154
+ source = predicate;
155
+ questions = [{ id: "holds", type: "noul", instructions: text(predicate.instructions) }];
156
+ break;
157
+ }
158
+ default: return {};
159
+ }
160
+ return {
161
+ ...(typeof source.provider === "string" ? { provider: source.provider } : {}),
162
+ ...(typeof source.model === "string" ? { model: source.model } : {}),
163
+ questions,
164
+ ...(isObject(source.images) && Object.keys(source.images).length ? { images: Object.keys(source.images) } : {}),
165
+ };
166
+ };
58
167
  /** The execution path an instance of a node ran at, as the node's path in the document: a map's item and a loop's
59
168
  * iteration have no node of their own. */
60
169
  const definitionPath = (path) => path.replace(/\/items\/\d+\/body/g, "/body").replace(/\/iterations\/\d+(?=\/|$)/g, "");
61
170
  const RANK = { working: 1, done: 2, failed: 3 };
62
171
  /** For every node of `graph`, the state the record shows. `source` is what the driver kept: its frame and, in the keyed
63
172
  * layout, the records of the map items (a run's whole story is the frame and the items together). A source that is not
64
- * one of those shows no node run. */
173
+ * one of those shows no node run. With the run's terminal `result`, an escalation that names a node of the graph marks
174
+ * that node and every container on its path `escalated`, and the maps and loops on that path have ended, so what finished
175
+ * inside them is done; without one, or when it names no node of the graph, nothing else changes. */
65
176
  export function nodeStatus(graph, source, options = {}) {
66
177
  const instances = new Map();
67
178
  const note = (path, state) => {
@@ -108,6 +219,19 @@ export function nodeStatus(graph, source, options = {}) {
108
219
  }
109
220
  else
110
221
  readFrame(raw);
222
+ // The node a run's escalation ended at, from its terminal result: by its execution path, as the node it ran as.
223
+ const result = isObject(raw) && isObject(raw.pin) && isObject(raw.result) ? raw.result : undefined;
224
+ const escalation = result?.status === "escalated" && isObject(result.escalation) ? result.escalation : undefined;
225
+ const escalatedExecPath = typeof escalation?.executionPath === "string" ? escalation.executionPath : undefined;
226
+ // When one map item or loop iteration is read on its own (`options.item`), the escalation belongs to this view only if
227
+ // it fired inside that same instance: another item's escalation, reduced to the shared body, must not mark this one's
228
+ // body escalated. The item index is in the raw execution path, which `definitionPath` then strips.
229
+ const itemScope = typeof options.item === "string" ? options.item.replace(/\/$/, "") : undefined;
230
+ const inThisItem = escalatedExecPath !== undefined
231
+ && (itemScope === undefined || escalatedExecPath === itemScope || escalatedExecPath.startsWith(`${itemScope}/`));
232
+ const stoppedAt = escalatedExecPath !== undefined && inThisItem ? definitionPath(escalatedExecPath) : undefined;
233
+ const ended = stoppedAt !== undefined && graph.nodes.some((node) => node.path === stoppedAt) ? stoppedAt : undefined;
234
+ const onPath = (path) => ended !== undefined && (path === ended || ended.startsWith(`${path}/`));
111
235
  // A done mark outranks a working one at the same path (a step's record stays after its node commits); a failure outranks both.
112
236
  const byNode = new Map();
113
237
  for (const [path, state] of instances) {
@@ -147,7 +271,8 @@ export function nodeStatus(graph, source, options = {}) {
147
271
  // The map or loop an `item` belongs to is the exception, and so is every one that encloses it: that item is the instance, and
148
272
  // the source holds nothing of the items around it. A map or loop inside the item still stands for its own items.
149
273
  const owner = typeof options.item === "string" ? definitionPath(options.item.replace(/\/(?:items|iterations)\/\d+$/, "")) : undefined;
150
- const containers = graph.nodes.filter((node) => (node.kind === "map" || node.kind === "loop")
274
+ // A map or loop on an escalation's path has ended: no other item or iteration will run, so what finished inside it is done.
275
+ const containers = graph.nodes.filter((node) => (node.kind === "map" || node.kind === "loop") && !onPath(node.path)
151
276
  && !(owner !== undefined && (node.path === owner || owner.startsWith(`${node.path}/body`))));
152
277
  for (const node of graph.nodes) {
153
278
  if (out[node.path] !== "done")
@@ -155,6 +280,11 @@ export function nodeStatus(graph, source, options = {}) {
155
280
  if (containers.some((container) => node.path.startsWith(`${container.path}/body`) && out[container.path] !== "done"))
156
281
  out[node.path] = "working";
157
282
  }
283
+ // The run ended at the escalate node that fired, and in each container on its path; a failure recorded below a container
284
+ // still shows.
285
+ for (const node of graph.nodes)
286
+ if (onPath(node.path) && (node.path === ended || out[node.path] !== "failed"))
287
+ out[node.path] = "escalated";
158
288
  return out;
159
289
  }
160
290
  /** An item or iteration index as an execution path writes it: a whole number with no sign and no leading zero. */
@@ -229,3 +359,75 @@ export function graphNodeOf(graph, executionPath) {
229
359
  }
230
360
  return { path, at };
231
361
  }
362
+ /** What changed between two graphs of a workflow, such as two saved revisions of one. A node is the same in both when its
363
+ * `(kind, label)` is unique in each graph, wherever it is: a step inserted before others is one `added` node and the rest
364
+ * `moved`, never a run of changes. A node whose `(kind, label)` repeats in either graph, or is in one only, is the same
365
+ * as the other graph's node at its path, unless that node is already matched by its identity; with a new kind or label
366
+ * it is `changed`. A matched node with its kind and label as they were and another `changeCheck` is `rewritten`; a node
367
+ * without a check in either graph is never reported rewritten. An edge is the same when both its ends are the same nodes
368
+ * and its kind is the same. Every list is in its graph's node or edge order. */
369
+ export function graphDiff(prev, next) {
370
+ const identity = (node) => JSON.stringify([node.kind, node.label]);
371
+ const counts = (graph) => {
372
+ const count = new Map();
373
+ for (const node of graph.nodes)
374
+ count.set(identity(node), (count.get(identity(node)) ?? 0) + 1);
375
+ return count;
376
+ };
377
+ const [inPrev, inNext] = [counts(prev), counts(next)];
378
+ const unique = (node) => inPrev.get(identity(node)) === 1 && inNext.get(identity(node)) === 1;
379
+ // The matched nodes, each way: a path of `next` to its node's path in `prev`, and back.
380
+ const prevOf = new Map();
381
+ const nextOf = new Map();
382
+ const match = (from, to) => { prevOf.set(to, from); nextOf.set(from, to); };
383
+ const uniqueInPrev = new Map(prev.nodes.filter(unique).map((node) => [identity(node), node.path]));
384
+ for (const node of next.nodes) {
385
+ const at = unique(node) ? uniqueInPrev.get(identity(node)) : undefined;
386
+ if (at !== undefined)
387
+ match(at, node.path);
388
+ }
389
+ const prevAt = new Map(prev.nodes.map((node) => [node.path, node]));
390
+ const changed = [];
391
+ for (const node of next.nodes) {
392
+ const old = prevAt.get(node.path);
393
+ if (prevOf.has(node.path) || old === undefined || nextOf.has(old.path))
394
+ continue;
395
+ match(old.path, node.path);
396
+ if (old.kind !== node.kind || old.label !== node.label) {
397
+ changed.push({ prev: old.path, next: node.path, was: { kind: old.kind, label: old.label }, now: { kind: node.kind, label: node.label } });
398
+ }
399
+ }
400
+ const rewritten = [];
401
+ for (const node of next.nodes) {
402
+ const from = prevOf.get(node.path);
403
+ const old = from === undefined ? undefined : prevAt.get(from);
404
+ if (old === undefined || old.kind !== node.kind || old.label !== node.label)
405
+ continue;
406
+ if (old.changeCheck !== undefined && node.changeCheck !== undefined && old.changeCheck !== node.changeCheck) {
407
+ rewritten.push({ prev: old.path, next: node.path, kind: node.kind, label: node.label });
408
+ }
409
+ }
410
+ const reported = ({ path, kind, label }) => ({ path, kind, label });
411
+ const edgeKey = (from, to, kind) => JSON.stringify([from, to, kind]);
412
+ const prevEdges = new Set(prev.edges.map((edge) => edgeKey(edge.from, edge.to, edge.kind)));
413
+ const nextEdges = new Set(next.edges.map((edge) => edgeKey(edge.from, edge.to, edge.kind)));
414
+ // Whether the other graph has this edge: both its ends matched there, joined by an edge of the same kind.
415
+ const theirs = (edge, map, edges) => {
416
+ const [from, to] = [map.get(edge.from), map.get(edge.to)];
417
+ return from !== undefined && to !== undefined && edges.has(edgeKey(from, to, edge.kind));
418
+ };
419
+ return {
420
+ added: next.nodes.filter((node) => !prevOf.has(node.path)).map(reported),
421
+ removed: prev.nodes.filter((node) => !nextOf.has(node.path)).map(reported),
422
+ changed,
423
+ moved: next.nodes.flatMap((node) => {
424
+ const from = prevOf.get(node.path);
425
+ return from !== undefined && from !== node.path ? [{ prev: from, next: node.path }] : [];
426
+ }),
427
+ rewritten,
428
+ edges: {
429
+ added: next.edges.filter((edge) => !theirs(edge, prevOf, prevEdges)).map(({ from, to, kind }) => ({ from, to, kind })),
430
+ removed: prev.edges.filter((edge) => !theirs(edge, nextOf, nextEdges)).map(({ from, to, kind }) => ({ from, to, kind })),
431
+ },
432
+ };
433
+ }
package/dist/index.d.ts CHANGED
@@ -1,23 +1,28 @@
1
1
  export { defineWorkflow, runTypedWorkflow, WorkflowSchemaConversionError } from "./authoring.js";
2
2
  export type { StandardJSONSchema, AuthoringSchema, TypedWorkflow, TypedWorkflowRunResult, WorkflowInput, WorkflowOutput, } from "./authoring.js";
3
- export { runWorkflow, validateWorkflow, workflowSha256, WorkflowInvalidError, WorkflowInputInvalidError, WorkflowOutputInvalidError, WorkflowCodeError, WorkflowStateError, WorkflowVerificationError, WorkflowDecisionRecordError, EffectFailure, EffectDeadlineExceededError, EffectOutcomeUnknownError, EscalationSignal, routesByValue, isItemFailure, } from "./workflow.js";
3
+ export { runWorkflow, validateWorkflow, workflowSha256, WorkflowInvalidError, WorkflowInputInvalidError, WorkflowOutputInvalidError, WorkflowCodeError, WorkflowStateError, WorkflowVerificationError, WorkflowDecisionRecordError, EffectFailure, EffectDeadlineExceededError, EffectOutcomeUnknownError, EscalationSignal, routesByValue, isItemFailure, MAP_LIMITS, } from "./workflow.js";
4
4
  export { defineJob } from "./job.js";
5
5
  export type { Job } from "./job.js";
6
- export { DECISION_RECEIPT_VERSION, rederiveDecision } from "./decision-receipts.js";
7
- export type { DecisionKind, DecisionReceipt, DecisionRule } from "./decision-receipts.js";
8
- export type { Workflow, WorkflowNode, NodeMetadata, WorkflowDeps, WorkflowEvent, WorkflowRunResult, HostPolicy, HostPolicyContext, Escalation, EffectSettlement, MapItem, MapItemFailure, DecisionExchange, LlmNode, JudgeNode, PickNode, SiftNode, RouteNode, RouteByJudgmentNode, RouteByValueNode, WorkflowInvocation, ArtifactNode, ArtifactState, CallNode, CodeNode, CallRetryClass, EffectFailureCode, CallPredicate, PollClause, ModelTier, AgentContext, WorkflowEffort, WorkflowThinking, VerifyClause, AskPredicate, MechanicalPredicate, Predicate, ValidationCode, ValidationIssue, } from "./workflow.js";
9
- export { dryRunWorkflow, synthesizeInstance } from "./dry-run.js";
6
+ export { DECISION_RECEIPT_VERSION, DECISION_INTERRUPTED, DECISION_REFUSED, DECISION_STATE_MAX_BYTES, rederiveDecision } from "./decision-receipts.js";
7
+ export type { DecisionImageDigest, DecisionKind, DecisionReceipt, DecisionRule, DecisionStateCut, DecisionStateSent } from "./decision-receipts.js";
8
+ export type { Workflow, WorkflowNode, NodeMetadata, WorkflowDeps, MapLimits, WorkflowEvent, WorkflowRunResult, HostPolicy, HostPolicyContext, Escalation, EffectSettlement, MapItem, MapItemFailure, DecisionExchange, LlmNode, JudgeNode, PickNode, SiftNode, RouteNode, RouteByJudgmentNode, RouteByValueNode, WorkflowInvocation, ArtifactNode, ArtifactState, CallNode, CodeNode, CallRetryClass, EffectFailureCode, CallPredicate, PollClause, ModelTier, AgentContext, WorkflowEffort, WorkflowThinking, VerifyClause, AskPredicate, DecisionEvidenceMode, DecisionImages, MechanicalPredicate, Predicate, ValidationCode, ValidationIssue, ValidateWorkflowOptions, } from "./workflow.js";
9
+ export { dryRunWorkflow, SYNTHESIS_BUDGET, SynthesisTooLarge, synthesizeInstance, type SynthesisBudget } from "./dry-run.js";
10
10
  export type { DryRunOptions, DryRunResult } from "./dry-run.js";
11
- export { compileQuestions, validateAnswers, answersToValue, answersSidecar, answerConfidence, synthesizeAnswers, SYSTEM_ONE_LIMITS, SystemOneError, isSystemOneResponseReason, } from "./system-one.js";
12
- export type { SystemOneQuestion, SystemOneAnswer, SystemOneBox, SystemOneResult, SystemOneRetryClass, SystemOneResponseReason, CompiledQuestions, AnswersSidecar, } from "./system-one.js";
11
+ export { compileQuestions, validateAnswers, answersToValue, answersSidecar, answerConfidence, synthesizeAnswers, SYSTEM_ONE_LIMITS, SystemOneError, isSystemOneResponseReason, deriveConfidence, completeConfidence, refusedQuestions, } from "./system-one.js";
12
+ export type { SystemOneQuestion, SystemOneAnswer, SystemOneBox, SystemOneResult, SystemOneRetryClass, SystemOneResponseReason, CompiledQuestions, AnswersSidecar, ConfidenceSource, } from "./system-one.js";
13
+ export { judgeFromProvider, judgeFromProviders, checkCapabilities, chargedCost, DecisionProviderError, imageDimensions } from "./decision-provider.js";
14
+ export { evidenceOf, EVIDENCE_EXCERPT_MAX, EVIDENCE_EXCERPTS_PER_ITEM, EVIDENCE_ITEMS_MAX, EVIDENCE_TEXT_MAX, EVIDENCE_TITLE_MAX, type EvidenceOptions } from "./evidence.js";
15
+ export type { DecisionProvider, DecisionCapabilities, DecisionInput, DecisionRequest, DecisionContext, DecisionEvidence, DecisionOutcome, ProviderAnswer, CostBasis, DecisionProviderErrorCode, DecisionImage, LoadImage, JudgeFromProviderOptions, } from "./decision-provider.js";
13
16
  export { inspectWorkflow, formatWorkflowTree } from "./inspection.js";
14
17
  export type { WorkflowInspection, WorkflowInspectionNode } from "./inspection.js";
15
- export { runWorkflowSlice, assertWorkflowCapabilities, desugarWorkflow, stageSchemaForNode, submissionSchemaForNode, mergeStageDelta, REPORT_SCHEMA, SHELL_RESULT_SCHEMA, childSteps, declaredWrites, terminalArtifactType, artifactNodeIsProse, schemaProblems, HOST_STATE_KEY, buildReferenceContext, normalizeStringNullsForSchema, parseCsvRows, } from "./workflow.js";
16
- export { compileTransform, compileTransformSyntax, deniedGlobalReferences } from "./code-exec.js";
18
+ export { runWorkflowSlice, assertWorkflowCapabilities, desugarWorkflow, stageSchemaForNode, submissionSchemaForNode, mergeStageDelta, REPORT_SCHEMA, SHELL_RESULT_SCHEMA, childSteps, declaredWrites, artifactNodeIsProse, schemaProblems, HOST_STATE_KEY, normalizeStringNullsForSchema, placeholderValue, placeholdersOf, } from "./workflow.js";
19
+ export { compileTransform, compileTransformSyntax, deniedGlobalReferences, type TransformOutcome, transformScript } from "./code-exec.js";
17
20
  export { resolveSchemaForWorkflow } from "./schema-references.js";
21
+ export { patternRisk, PATTERN_SCREEN_LIMITS } from "./pattern-screen.js";
22
+ export { submitParameters } from "./submit-envelope.js";
18
23
  export { getPath, predicateMatches } from "./predicates.js";
19
24
  export type { StopPredicate, AcceptPredicate } from "./predicates.js";
20
- export { authorContract, renderAuthorContract, renderAuthorHostAddendum, candidatePolicyErrors, applyHostOutputTypes, authorWorkflow, AUTHOR_SKILL_NAME, authorSkillDirectory, loadAuthorReference, loadAuthorSkillBundle, } from "./author.js";
25
+ export { authorContract, renderAuthorContract, renderAuthorHostAddendum, applyHostOutputTypes, authorWorkflow, authorSkillDirectory, loadAuthorReference, loadAuthorSkillBundle, } from "./author.js";
21
26
  export type { AuthorHostAddendum, CandidatePolicyOptions, AuthorWorkflowOptions, AuthoredWorkflow, HostOutputTypeOptions } from "./author.js";
22
- export { WORKFLOW_NODE_KINDS, GENERATIVE_NODE_KINDS, JUDGMENT_NODE_KINDS, NODE_FIELDS, HOST_NODE_FIELDS, IGNORED_NODE_FIELDS, MECHANICAL_PREDICATES, WORKFLOW_PREDICATES, PREDICATE_FIELDS, EFFORT_LEVELS, THINKING_LEVELS, MODEL_TIERS, AGENT_CONTEXTS, CALL_TRANSPORTS, CALL_RETRY_CLASSES, EFFECT_FAILURE_CODES, PROSE_ARTIFACT_TYPES, } from "./vocabulary.js";
23
- export type { WorkflowNodeKind, WorkflowPredicateName } from "./vocabulary.js";
27
+ export { GENERATIVE_NODE_KINDS, JUDGMENT_NODE_KINDS, NODE_FIELDS, HOST_NODE_FIELDS, IGNORED_NODE_FIELDS, MECHANICAL_PREDICATES, WORKFLOW_PREDICATES, PREDICATE_FIELDS, FIELD_TYPES, EFFORT_LEVELS, THINKING_LEVELS, MODEL_TIERS, AGENT_CONTEXTS, CALL_TRANSPORTS, CALL_RETRY_CLASSES, EFFECT_FAILURE_CODES, PROSE_ARTIFACT_TYPES, } from "./vocabulary.js";
28
+ export type { WorkflowNodeKind, WorkflowPredicateName, FieldType } from "./vocabulary.js";
package/dist/index.js CHANGED
@@ -1,17 +1,23 @@
1
1
  export { defineWorkflow, runTypedWorkflow, WorkflowSchemaConversionError } from "./authoring.js";
2
- export { runWorkflow, validateWorkflow, workflowSha256, WorkflowInvalidError, WorkflowInputInvalidError, WorkflowOutputInvalidError, WorkflowCodeError, WorkflowStateError, WorkflowVerificationError, WorkflowDecisionRecordError, EffectFailure, EffectDeadlineExceededError, EffectOutcomeUnknownError, EscalationSignal, routesByValue, isItemFailure, } from "./workflow.js";
2
+ export { runWorkflow, validateWorkflow, workflowSha256, WorkflowInvalidError, WorkflowInputInvalidError, WorkflowOutputInvalidError, WorkflowCodeError, WorkflowStateError, WorkflowVerificationError, WorkflowDecisionRecordError, EffectFailure, EffectDeadlineExceededError, EffectOutcomeUnknownError, EscalationSignal, routesByValue, isItemFailure, MAP_LIMITS, } from "./workflow.js";
3
3
  export { defineJob } from "./job.js";
4
- export { DECISION_RECEIPT_VERSION, rederiveDecision } from "./decision-receipts.js";
5
- export { dryRunWorkflow, synthesizeInstance } from "./dry-run.js";
6
- export { compileQuestions, validateAnswers, answersToValue, answersSidecar, answerConfidence, synthesizeAnswers, SYSTEM_ONE_LIMITS, SystemOneError, isSystemOneResponseReason, } from "./system-one.js";
4
+ export { DECISION_RECEIPT_VERSION, DECISION_INTERRUPTED, DECISION_REFUSED, DECISION_STATE_MAX_BYTES, rederiveDecision } from "./decision-receipts.js";
5
+ export { dryRunWorkflow, SYNTHESIS_BUDGET, SynthesisTooLarge, synthesizeInstance } from "./dry-run.js";
6
+ export { compileQuestions, validateAnswers, answersToValue, answersSidecar, answerConfidence, synthesizeAnswers, SYSTEM_ONE_LIMITS, SystemOneError, isSystemOneResponseReason, deriveConfidence, completeConfidence, refusedQuestions, } from "./system-one.js";
7
+ export { judgeFromProvider, judgeFromProviders, checkCapabilities, chargedCost, DecisionProviderError, imageDimensions } from "./decision-provider.js";
8
+ export { evidenceOf, EVIDENCE_EXCERPT_MAX, EVIDENCE_EXCERPTS_PER_ITEM, EVIDENCE_ITEMS_MAX, EVIDENCE_TEXT_MAX, EVIDENCE_TITLE_MAX } from "./evidence.js";
7
9
  export { inspectWorkflow, formatWorkflowTree } from "./inspection.js";
8
10
  export { runWorkflowSlice, assertWorkflowCapabilities, desugarWorkflow, stageSchemaForNode, submissionSchemaForNode, mergeStageDelta, REPORT_SCHEMA, SHELL_RESULT_SCHEMA,
9
11
  // Document helpers a host facade needs to speak about a workflow without re-implementing the walk.
10
- childSteps, declaredWrites, terminalArtifactType, artifactNodeIsProse, schemaProblems, HOST_STATE_KEY,
11
- // Host-side data helpers the interpreter itself uses: the same normalization and reference shaping.
12
- buildReferenceContext, normalizeStringNullsForSchema, parseCsvRows, } from "./workflow.js";
13
- export { compileTransform, compileTransformSyntax, deniedGlobalReferences } from "./code-exec.js";
12
+ childSteps, declaredWrites, artifactNodeIsProse, schemaProblems, HOST_STATE_KEY,
13
+ // The host-side normalization the interpreter itself uses.
14
+ normalizeStringNullsForSchema,
15
+ // Interpolation's placeholders in a string and its lookup order for one, for a host check of what a step reads.
16
+ placeholderValue, placeholdersOf, } from "./workflow.js";
17
+ export { compileTransform, compileTransformSyntax, deniedGlobalReferences, transformScript } from "./code-exec.js";
14
18
  export { resolveSchemaForWorkflow } from "./schema-references.js";
19
+ export { patternRisk, PATTERN_SCREEN_LIMITS } from "./pattern-screen.js";
20
+ export { submitParameters } from "./submit-envelope.js";
15
21
  export { getPath, predicateMatches } from "./predicates.js";
16
- export { authorContract, renderAuthorContract, renderAuthorHostAddendum, candidatePolicyErrors, applyHostOutputTypes, authorWorkflow, AUTHOR_SKILL_NAME, authorSkillDirectory, loadAuthorReference, loadAuthorSkillBundle, } from "./author.js";
17
- export { WORKFLOW_NODE_KINDS, GENERATIVE_NODE_KINDS, JUDGMENT_NODE_KINDS, NODE_FIELDS, HOST_NODE_FIELDS, IGNORED_NODE_FIELDS, MECHANICAL_PREDICATES, WORKFLOW_PREDICATES, PREDICATE_FIELDS, EFFORT_LEVELS, THINKING_LEVELS, MODEL_TIERS, AGENT_CONTEXTS, CALL_TRANSPORTS, CALL_RETRY_CLASSES, EFFECT_FAILURE_CODES, PROSE_ARTIFACT_TYPES, } from "./vocabulary.js";
22
+ export { authorContract, renderAuthorContract, renderAuthorHostAddendum, applyHostOutputTypes, authorWorkflow, authorSkillDirectory, loadAuthorReference, loadAuthorSkillBundle, } from "./author.js";
23
+ export { GENERATIVE_NODE_KINDS, JUDGMENT_NODE_KINDS, NODE_FIELDS, HOST_NODE_FIELDS, IGNORED_NODE_FIELDS, MECHANICAL_PREDICATES, WORKFLOW_PREDICATES, PREDICATE_FIELDS, FIELD_TYPES, EFFORT_LEVELS, THINKING_LEVELS, MODEL_TIERS, AGENT_CONTEXTS, CALL_TRANSPORTS, CALL_RETRY_CLASSES, EFFECT_FAILURE_CODES, PROSE_ARTIFACT_TYPES, } from "./vocabulary.js";
@@ -11,6 +11,11 @@ export type WorkflowInspectionNode = {
11
11
  /** Effective selection from completed map-item state; absent means whole item state. */
12
12
  resultPath?: string;
13
13
  childWorkflow?: string;
14
+ /** A decision node's (or an `ask` predicate's) provider and pinned model, when it names them, and the tokens of the
15
+ * images it sends. */
16
+ provider?: string;
17
+ model?: string;
18
+ images?: string[];
14
19
  };
15
20
  export type WorkflowInspection = {
16
21
  name: string;