@parcha/agentrun-dsl 0.1.0-beta.28 → 0.1.0-beta.281
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/NOTICE +2 -0
- package/README.md +22 -17
- package/dist/author-references.d.ts +2 -2
- package/dist/author-references.js +2 -2
- package/dist/author.d.ts +0 -2
- package/dist/author.js +12 -7
- package/dist/authoring.js +3 -2
- package/dist/cli.js +13 -12
- package/dist/code-exec.d.ts +19 -0
- package/dist/code-exec.js +54 -5
- package/dist/decision-provider.d.ts +166 -0
- package/dist/decision-provider.js +238 -0
- package/dist/decision-receipts.d.ts +60 -2
- package/dist/decision-receipts.js +13 -3
- package/dist/dry-run.d.ts +31 -1
- package/dist/dry-run.js +120 -14
- package/dist/edit.d.ts +158 -0
- package/dist/edit.js +1486 -0
- package/dist/evidence.d.ts +19 -0
- package/dist/evidence.js +63 -0
- package/dist/graph.d.ts +17 -0
- package/dist/graph.js +71 -6
- package/dist/index.d.ts +17 -12
- package/dist/index.js +16 -10
- package/dist/inspection.d.ts +5 -0
- package/dist/inspection.js +14 -1
- package/dist/pattern-screen.d.ts +14 -0
- package/dist/pattern-screen.js +451 -0
- package/dist/pointer-warning.d.ts +14 -0
- package/dist/pointer-warning.js +22 -0
- package/dist/predicates.d.ts +32 -2
- package/dist/predicates.js +66 -6
- package/dist/record.d.ts +4 -0
- package/dist/record.js +6 -0
- package/dist/recovery/binding.js +2 -1
- package/dist/recovery/call-key.d.ts +0 -4
- package/dist/recovery/call-key.js +0 -7
- package/dist/recovery/driver.d.ts +48 -20
- package/dist/recovery/driver.js +150 -41
- package/dist/recovery/frozen-snapshot.d.ts +30 -1
- package/dist/recovery/frozen-snapshot.js +26 -8
- package/dist/recovery/handoff-receipts.d.ts +0 -35
- package/dist/recovery/handoff-receipts.js +2 -44
- package/dist/recovery/index.d.ts +4 -8
- package/dist/recovery/index.js +4 -7
- package/dist/recovery/item-state.d.ts +2 -1
- package/dist/recovery/item-state.js +7 -13
- package/dist/recovery/with-recovery.d.ts +9 -3
- package/dist/recovery/with-recovery.js +72 -15
- package/dist/submit-envelope.d.ts +2 -1
- package/dist/submit-envelope.js +12 -5
- package/dist/system-one.d.ts +21 -2
- package/dist/system-one.js +96 -18
- package/dist/testing/decision-provider.d.ts +32 -0
- package/dist/testing/decision-provider.js +183 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/vocabulary.d.ts +16 -3
- package/dist/vocabulary.js +22 -7
- package/dist/workflow-shape.js +4 -2
- package/dist/workflow.d.ts +131 -15
- package/dist/workflow.js +807 -233
- package/dist/zod-json-contract.js +6 -8
- package/package.json +12 -4
- package/schema/workflow.schema.json +346 -1
- package/skills/author/references/jev-decisions.md +50 -5
- package/skills/author/references/language.md +14 -9
- package/dist/recovery/effect-failure.d.ts +0 -34
- package/dist/recovery/effect-failure.js +0 -62
- package/dist/recovery/handoff-block.d.ts +0 -36
- package/dist/recovery/handoff-block.js +0 -148
- package/dist/recovery/handoff-digest.d.ts +0 -58
- package/dist/recovery/handoff-digest.js +0 -195
- package/dist/recovery/handoff-files.d.ts +0 -54
- package/dist/recovery/handoff-files.js +0 -162
- package/dist/recovery/handoff-redact.d.ts +0 -12
- package/dist/recovery/handoff-redact.js +0 -44
- package/dist/recovery/handoff.d.ts +0 -44
- package/dist/recovery/handoff.js +0 -46
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { isRecord } from "./record.js";
|
|
1
2
|
/** Zod documents _zod.def as the traversal interface for schema tools:
|
|
2
|
-
* https://zod.dev/packages/core. Keep this
|
|
3
|
-
* constructs: the JSON interpreter cannot execute a schema library's parser hooks. */
|
|
3
|
+
* https://zod.dev/packages/core. Keep this free of any schema library's code (it reads Zod's documented `_zod.def`,
|
|
4
|
+
* never Zod itself) and fail closed on new constructs: the JSON interpreter cannot execute a schema library's parser hooks. */
|
|
4
5
|
const TYPES = new Set([
|
|
5
6
|
"string", "number", "boolean", "null", "literal", "enum", "object", "array",
|
|
6
7
|
"tuple", "record", "union", "intersection", "optional", "nullable", "nonoptional",
|
|
@@ -19,16 +20,13 @@ const SCHEMA_KEYWORDS = new Set([
|
|
|
19
20
|
"exclusiveMaximum", "multipleOf", "minLength", "maxLength", "pattern", "format", "minItems", "maxItems",
|
|
20
21
|
"uniqueItems", "minProperties", "maxProperties", "contentEncoding", "contentMediaType", "contentSchema",
|
|
21
22
|
]);
|
|
22
|
-
function record(value) {
|
|
23
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
24
|
-
}
|
|
25
23
|
export function assertZodJsonContract(schema, inputRoot = false) {
|
|
26
24
|
const seen = new Set();
|
|
27
25
|
const fail = (path, reason) => {
|
|
28
26
|
throw new Error(`${path}: ${reason}; use JSON-representable Zod schemas and put parsing or custom checks in an explicit workflow step`);
|
|
29
27
|
};
|
|
30
28
|
const check = (value, path) => {
|
|
31
|
-
if (!
|
|
29
|
+
if (!isRecord(value) || !isRecord(value._zod) || !isRecord(value._zod.def))
|
|
32
30
|
fail(path, "unsupported Zod check representation");
|
|
33
31
|
const def = value._zod.def;
|
|
34
32
|
if (!CHECKS.has(String(def.check)))
|
|
@@ -42,7 +40,7 @@ export function assertZodJsonContract(schema, inputRoot = false) {
|
|
|
42
40
|
fail(path, "URL normalization and custom URL constraints do not survive JSON Schema conversion");
|
|
43
41
|
};
|
|
44
42
|
const visit = (value, path) => {
|
|
45
|
-
if (!
|
|
43
|
+
if (!isRecord(value) || !isRecord(value._zod) || !isRecord(value._zod.def))
|
|
46
44
|
fail(path, "unsupported Zod schema representation");
|
|
47
45
|
const node = value;
|
|
48
46
|
if (seen.has(node))
|
|
@@ -67,7 +65,7 @@ export function assertZodJsonContract(schema, inputRoot = false) {
|
|
|
67
65
|
def.checks.forEach((entry, index) => check(entry, `${path}.checks[${index}]`));
|
|
68
66
|
}
|
|
69
67
|
if (def.type === "object") {
|
|
70
|
-
if (!
|
|
68
|
+
if (!isRecord(def.shape))
|
|
71
69
|
fail(path, "unsupported Zod object shape");
|
|
72
70
|
for (const [key, child] of Object.entries(def.shape))
|
|
73
71
|
visit(child, `${path}.${key}`);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-dsl",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.281",
|
|
4
4
|
"description": "Composable, typed workflows for agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"bin": {
|
|
8
|
-
"agentrun": "./dist/cli.js"
|
|
8
|
+
"agentrun-dsl": "./dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"types": "./dist/graph.d.ts",
|
|
17
17
|
"import": "./dist/graph.js"
|
|
18
18
|
},
|
|
19
|
+
"./edit": {
|
|
20
|
+
"types": "./dist/edit.d.ts",
|
|
21
|
+
"import": "./dist/edit.js"
|
|
22
|
+
},
|
|
19
23
|
"./demo": {
|
|
20
24
|
"types": "./dist/demo.d.ts",
|
|
21
25
|
"import": "./dist/demo.js"
|
|
@@ -32,6 +36,10 @@
|
|
|
32
36
|
"types": "./dist/recovery/testing/index.d.ts",
|
|
33
37
|
"import": "./dist/recovery/testing/index.js"
|
|
34
38
|
},
|
|
39
|
+
"./testing": {
|
|
40
|
+
"types": "./dist/testing/index.d.ts",
|
|
41
|
+
"import": "./dist/testing/index.js"
|
|
42
|
+
},
|
|
35
43
|
"./schema": "./schema/workflow.schema.json"
|
|
36
44
|
},
|
|
37
45
|
"files": [
|
|
@@ -43,7 +51,7 @@
|
|
|
43
51
|
"skills"
|
|
44
52
|
],
|
|
45
53
|
"engines": {
|
|
46
|
-
"node": ">=22.
|
|
54
|
+
"node": ">=24.22.3"
|
|
47
55
|
},
|
|
48
56
|
"scripts": {
|
|
49
57
|
"build": "tsc -p tsconfig.json",
|
|
@@ -51,7 +59,7 @@
|
|
|
51
59
|
"test": "node --test test/*.test.mjs"
|
|
52
60
|
},
|
|
53
61
|
"dependencies": {
|
|
54
|
-
"typebox": "1.3.
|
|
62
|
+
"typebox": "1.3.27"
|
|
55
63
|
},
|
|
56
64
|
"devDependencies": {
|
|
57
65
|
"esbuild": "0.28.2"
|
|
@@ -873,6 +873,33 @@
|
|
|
873
873
|
},
|
|
874
874
|
"title": "requires"
|
|
875
875
|
},
|
|
876
|
+
"provider": {
|
|
877
|
+
"type": "string",
|
|
878
|
+
"title": "provider"
|
|
879
|
+
},
|
|
880
|
+
"model": {
|
|
881
|
+
"type": "string",
|
|
882
|
+
"title": "model"
|
|
883
|
+
},
|
|
884
|
+
"evidence": {
|
|
885
|
+
"description": "What a decision node asks of its provider's evidence: none, whatever it gives, or some (a provider that gives none is refused before the run).",
|
|
886
|
+
"enum": [
|
|
887
|
+
"if_supported",
|
|
888
|
+
"off",
|
|
889
|
+
"required"
|
|
890
|
+
],
|
|
891
|
+
"type": "string",
|
|
892
|
+
"title": "evidence"
|
|
893
|
+
},
|
|
894
|
+
"timeoutMs": {
|
|
895
|
+
"type": "number",
|
|
896
|
+
"title": "timeoutMs"
|
|
897
|
+
},
|
|
898
|
+
"images": {
|
|
899
|
+
"description": "The images a decision node sends with its request: each key is a token (such as `\"<page1>\"`) that appears literally in\nthe node's `state` or in a question's text, and each value is a reference to the image, written as a `state` value is\n(`\"{item.pages.0.image}\"`, or a literal path), that resolves to a string the host loads (a run-relative file path).",
|
|
900
|
+
"$ref": "#/definitions/DecisionImages",
|
|
901
|
+
"title": "images"
|
|
902
|
+
},
|
|
876
903
|
"metadata": {
|
|
877
904
|
"description": "Host-owned markers on a node: any JSON object. The engine admits, carries and hashes it with the\ndocument and never reads it; it never reaches state, events, prompts or effect identities.",
|
|
878
905
|
"type": "object",
|
|
@@ -932,6 +959,33 @@
|
|
|
932
959
|
},
|
|
933
960
|
"title": "requires"
|
|
934
961
|
},
|
|
962
|
+
"provider": {
|
|
963
|
+
"type": "string",
|
|
964
|
+
"title": "provider"
|
|
965
|
+
},
|
|
966
|
+
"model": {
|
|
967
|
+
"type": "string",
|
|
968
|
+
"title": "model"
|
|
969
|
+
},
|
|
970
|
+
"evidence": {
|
|
971
|
+
"description": "What a decision node asks of its provider's evidence: none, whatever it gives, or some (a provider that gives none is refused before the run).",
|
|
972
|
+
"enum": [
|
|
973
|
+
"if_supported",
|
|
974
|
+
"off",
|
|
975
|
+
"required"
|
|
976
|
+
],
|
|
977
|
+
"type": "string",
|
|
978
|
+
"title": "evidence"
|
|
979
|
+
},
|
|
980
|
+
"timeoutMs": {
|
|
981
|
+
"type": "number",
|
|
982
|
+
"title": "timeoutMs"
|
|
983
|
+
},
|
|
984
|
+
"images": {
|
|
985
|
+
"description": "The images a decision node sends with its request: each key is a token (such as `\"<page1>\"`) that appears literally in\nthe node's `state` or in a question's text, and each value is a reference to the image, written as a `state` value is\n(`\"{item.pages.0.image}\"`, or a literal path), that resolves to a string the host loads (a run-relative file path).",
|
|
986
|
+
"$ref": "#/definitions/DecisionImages",
|
|
987
|
+
"title": "images"
|
|
988
|
+
},
|
|
935
989
|
"metadata": {
|
|
936
990
|
"description": "Host-owned markers on a node: any JSON object. The engine admits, carries and hashes it with the\ndocument and never reads it; it never reaches state, events, prompts or effect identities.",
|
|
937
991
|
"type": "object",
|
|
@@ -1005,6 +1059,33 @@
|
|
|
1005
1059
|
},
|
|
1006
1060
|
"title": "requires"
|
|
1007
1061
|
},
|
|
1062
|
+
"provider": {
|
|
1063
|
+
"type": "string",
|
|
1064
|
+
"title": "provider"
|
|
1065
|
+
},
|
|
1066
|
+
"model": {
|
|
1067
|
+
"type": "string",
|
|
1068
|
+
"title": "model"
|
|
1069
|
+
},
|
|
1070
|
+
"evidence": {
|
|
1071
|
+
"description": "What a decision node asks of its provider's evidence: none, whatever it gives, or some (a provider that gives none is refused before the run).",
|
|
1072
|
+
"enum": [
|
|
1073
|
+
"if_supported",
|
|
1074
|
+
"off",
|
|
1075
|
+
"required"
|
|
1076
|
+
],
|
|
1077
|
+
"type": "string",
|
|
1078
|
+
"title": "evidence"
|
|
1079
|
+
},
|
|
1080
|
+
"timeoutMs": {
|
|
1081
|
+
"type": "number",
|
|
1082
|
+
"title": "timeoutMs"
|
|
1083
|
+
},
|
|
1084
|
+
"images": {
|
|
1085
|
+
"description": "The images a decision node sends with its request: each key is a token (such as `\"<page1>\"`) that appears literally in\nthe node's `state` or in a question's text, and each value is a reference to the image, written as a `state` value is\n(`\"{item.pages.0.image}\"`, or a literal path), that resolves to a string the host loads (a run-relative file path).",
|
|
1086
|
+
"$ref": "#/definitions/DecisionImages",
|
|
1087
|
+
"title": "images"
|
|
1088
|
+
},
|
|
1008
1089
|
"metadata": {
|
|
1009
1090
|
"description": "Host-owned markers on a node: any JSON object. The engine admits, carries and hashes it with the\ndocument and never reads it; it never reaches state, events, prompts or effect identities.",
|
|
1010
1091
|
"type": "object",
|
|
@@ -1090,6 +1171,33 @@
|
|
|
1090
1171
|
},
|
|
1091
1172
|
"title": "requires"
|
|
1092
1173
|
},
|
|
1174
|
+
"provider": {
|
|
1175
|
+
"type": "string",
|
|
1176
|
+
"title": "provider"
|
|
1177
|
+
},
|
|
1178
|
+
"model": {
|
|
1179
|
+
"type": "string",
|
|
1180
|
+
"title": "model"
|
|
1181
|
+
},
|
|
1182
|
+
"evidence": {
|
|
1183
|
+
"description": "What a decision node asks of its provider's evidence: none, whatever it gives, or some (a provider that gives none is refused before the run).",
|
|
1184
|
+
"enum": [
|
|
1185
|
+
"if_supported",
|
|
1186
|
+
"off",
|
|
1187
|
+
"required"
|
|
1188
|
+
],
|
|
1189
|
+
"type": "string",
|
|
1190
|
+
"title": "evidence"
|
|
1191
|
+
},
|
|
1192
|
+
"timeoutMs": {
|
|
1193
|
+
"type": "number",
|
|
1194
|
+
"title": "timeoutMs"
|
|
1195
|
+
},
|
|
1196
|
+
"images": {
|
|
1197
|
+
"description": "The images a decision node sends with its request: each key is a token (such as `\"<page1>\"`) that appears literally in\nthe node's `state` or in a question's text, and each value is a reference to the image, written as a `state` value is\n(`\"{item.pages.0.image}\"`, or a literal path), that resolves to a string the host loads (a run-relative file path).",
|
|
1198
|
+
"$ref": "#/definitions/DecisionImages",
|
|
1199
|
+
"title": "images"
|
|
1200
|
+
},
|
|
1093
1201
|
"metadata": {
|
|
1094
1202
|
"description": "Host-owned markers on a node: any JSON object. The engine admits, carries and hashes it with the\ndocument and never reads it; it never reaches state, events, prompts or effect identities.",
|
|
1095
1203
|
"type": "object",
|
|
@@ -1515,6 +1623,64 @@
|
|
|
1515
1623
|
"predicate",
|
|
1516
1624
|
"values"
|
|
1517
1625
|
]
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
"type": "object",
|
|
1629
|
+
"properties": {
|
|
1630
|
+
"predicate": {
|
|
1631
|
+
"type": "string",
|
|
1632
|
+
"const": "field_type",
|
|
1633
|
+
"title": "predicate"
|
|
1634
|
+
},
|
|
1635
|
+
"path": {
|
|
1636
|
+
"type": "string",
|
|
1637
|
+
"title": "path"
|
|
1638
|
+
},
|
|
1639
|
+
"type": {
|
|
1640
|
+
"$ref": "#/definitions/FieldType",
|
|
1641
|
+
"title": "type"
|
|
1642
|
+
}
|
|
1643
|
+
},
|
|
1644
|
+
"required": [
|
|
1645
|
+
"path",
|
|
1646
|
+
"predicate",
|
|
1647
|
+
"type"
|
|
1648
|
+
]
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
"description": "Holds when a quote at `path` is in none of the page text at `pages`. `path` names a quote (a string) or a list of them;\nwith `field`, a list (or one record) of records, each holding its quote at `field`. Each of `pages` names a state value\nthis run wrote, a call's result most often: every string under it is page text.",
|
|
1652
|
+
"type": "object",
|
|
1653
|
+
"properties": {
|
|
1654
|
+
"predicate": {
|
|
1655
|
+
"type": "string",
|
|
1656
|
+
"const": "quote_missing",
|
|
1657
|
+
"title": "predicate"
|
|
1658
|
+
},
|
|
1659
|
+
"path": {
|
|
1660
|
+
"type": "string",
|
|
1661
|
+
"title": "path"
|
|
1662
|
+
},
|
|
1663
|
+
"field": {
|
|
1664
|
+
"type": "string",
|
|
1665
|
+
"title": "field"
|
|
1666
|
+
},
|
|
1667
|
+
"pages": {
|
|
1668
|
+
"type": "array",
|
|
1669
|
+
"items": {
|
|
1670
|
+
"type": "string"
|
|
1671
|
+
},
|
|
1672
|
+
"title": "pages"
|
|
1673
|
+
}
|
|
1674
|
+
},
|
|
1675
|
+
"required": [
|
|
1676
|
+
"pages",
|
|
1677
|
+
"path",
|
|
1678
|
+
"predicate"
|
|
1679
|
+
]
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
"$ref": "#/definitions/NotPredicate",
|
|
1683
|
+
"description": "Holds when `of` does not. `of` is mechanical: a judged question never sits inside a negation."
|
|
1518
1684
|
}
|
|
1519
1685
|
],
|
|
1520
1686
|
"title": "fail_when"
|
|
@@ -1791,6 +1957,64 @@
|
|
|
1791
1957
|
"values"
|
|
1792
1958
|
]
|
|
1793
1959
|
},
|
|
1960
|
+
{
|
|
1961
|
+
"type": "object",
|
|
1962
|
+
"properties": {
|
|
1963
|
+
"predicate": {
|
|
1964
|
+
"type": "string",
|
|
1965
|
+
"const": "field_type",
|
|
1966
|
+
"title": "predicate"
|
|
1967
|
+
},
|
|
1968
|
+
"path": {
|
|
1969
|
+
"type": "string",
|
|
1970
|
+
"title": "path"
|
|
1971
|
+
},
|
|
1972
|
+
"type": {
|
|
1973
|
+
"$ref": "#/definitions/FieldType",
|
|
1974
|
+
"title": "type"
|
|
1975
|
+
}
|
|
1976
|
+
},
|
|
1977
|
+
"required": [
|
|
1978
|
+
"path",
|
|
1979
|
+
"predicate",
|
|
1980
|
+
"type"
|
|
1981
|
+
]
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
"description": "Holds when a quote at `path` is in none of the page text at `pages`. `path` names a quote (a string) or a list of them;\nwith `field`, a list (or one record) of records, each holding its quote at `field`. Each of `pages` names a state value\nthis run wrote, a call's result most often: every string under it is page text.",
|
|
1985
|
+
"type": "object",
|
|
1986
|
+
"properties": {
|
|
1987
|
+
"predicate": {
|
|
1988
|
+
"type": "string",
|
|
1989
|
+
"const": "quote_missing",
|
|
1990
|
+
"title": "predicate"
|
|
1991
|
+
},
|
|
1992
|
+
"path": {
|
|
1993
|
+
"type": "string",
|
|
1994
|
+
"title": "path"
|
|
1995
|
+
},
|
|
1996
|
+
"field": {
|
|
1997
|
+
"type": "string",
|
|
1998
|
+
"title": "field"
|
|
1999
|
+
},
|
|
2000
|
+
"pages": {
|
|
2001
|
+
"type": "array",
|
|
2002
|
+
"items": {
|
|
2003
|
+
"type": "string"
|
|
2004
|
+
},
|
|
2005
|
+
"title": "pages"
|
|
2006
|
+
}
|
|
2007
|
+
},
|
|
2008
|
+
"required": [
|
|
2009
|
+
"pages",
|
|
2010
|
+
"path",
|
|
2011
|
+
"predicate"
|
|
2012
|
+
]
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
"$ref": "#/definitions/NotPredicate",
|
|
2016
|
+
"description": "Holds when `of` does not. `of` is mechanical: a judged question never sits inside a negation."
|
|
2017
|
+
},
|
|
1794
2018
|
{
|
|
1795
2019
|
"type": "object",
|
|
1796
2020
|
"properties": {
|
|
@@ -1824,6 +2048,33 @@
|
|
|
1824
2048
|
"gte": {
|
|
1825
2049
|
"type": "number",
|
|
1826
2050
|
"title": "gte"
|
|
2051
|
+
},
|
|
2052
|
+
"provider": {
|
|
2053
|
+
"type": "string",
|
|
2054
|
+
"title": "provider"
|
|
2055
|
+
},
|
|
2056
|
+
"model": {
|
|
2057
|
+
"type": "string",
|
|
2058
|
+
"title": "model"
|
|
2059
|
+
},
|
|
2060
|
+
"evidence": {
|
|
2061
|
+
"description": "What a decision node asks of its provider's evidence: none, whatever it gives, or some (a provider that gives none is refused before the run).",
|
|
2062
|
+
"enum": [
|
|
2063
|
+
"if_supported",
|
|
2064
|
+
"off",
|
|
2065
|
+
"required"
|
|
2066
|
+
],
|
|
2067
|
+
"type": "string",
|
|
2068
|
+
"title": "evidence"
|
|
2069
|
+
},
|
|
2070
|
+
"timeoutMs": {
|
|
2071
|
+
"type": "number",
|
|
2072
|
+
"title": "timeoutMs"
|
|
2073
|
+
},
|
|
2074
|
+
"images": {
|
|
2075
|
+
"description": "The images a decision node sends with its request: each key is a token (such as `\"<page1>\"`) that appears literally in\nthe node's `state` or in a question's text, and each value is a reference to the image, written as a `state` value is\n(`\"{item.pages.0.image}\"`, or a literal path), that resolves to a string the host loads (a run-relative file path).",
|
|
2076
|
+
"$ref": "#/definitions/DecisionImages",
|
|
2077
|
+
"title": "images"
|
|
1827
2078
|
}
|
|
1828
2079
|
},
|
|
1829
2080
|
"required": [
|
|
@@ -1833,8 +2084,19 @@
|
|
|
1833
2084
|
}
|
|
1834
2085
|
]
|
|
1835
2086
|
},
|
|
2087
|
+
"FieldType": {
|
|
2088
|
+
"title": "FieldType",
|
|
2089
|
+
"enum": [
|
|
2090
|
+
"array",
|
|
2091
|
+
"boolean",
|
|
2092
|
+
"null",
|
|
2093
|
+
"number",
|
|
2094
|
+
"object",
|
|
2095
|
+
"string"
|
|
2096
|
+
],
|
|
2097
|
+
"type": "string"
|
|
2098
|
+
},
|
|
1836
2099
|
"AcceptPredicate": {
|
|
1837
|
-
"description": "A predicate a `call` evaluates against ITS OWN RESULT: paths are result-relative.",
|
|
1838
2100
|
"title": "AcceptPredicate",
|
|
1839
2101
|
"anyOf": [
|
|
1840
2102
|
{
|
|
@@ -2016,9 +2278,92 @@
|
|
|
2016
2278
|
"predicate",
|
|
2017
2279
|
"values"
|
|
2018
2280
|
]
|
|
2281
|
+
},
|
|
2282
|
+
{
|
|
2283
|
+
"type": "object",
|
|
2284
|
+
"properties": {
|
|
2285
|
+
"predicate": {
|
|
2286
|
+
"type": "string",
|
|
2287
|
+
"const": "field_type",
|
|
2288
|
+
"title": "predicate"
|
|
2289
|
+
},
|
|
2290
|
+
"path": {
|
|
2291
|
+
"type": "string",
|
|
2292
|
+
"title": "path"
|
|
2293
|
+
},
|
|
2294
|
+
"type": {
|
|
2295
|
+
"$ref": "#/definitions/FieldType",
|
|
2296
|
+
"title": "type"
|
|
2297
|
+
}
|
|
2298
|
+
},
|
|
2299
|
+
"required": [
|
|
2300
|
+
"path",
|
|
2301
|
+
"predicate",
|
|
2302
|
+
"type"
|
|
2303
|
+
]
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
"description": "Holds when a quote at `path` is in none of the page text at `pages`. `path` names a quote (a string) or a list of them;\nwith `field`, a list (or one record) of records, each holding its quote at `field`. Each of `pages` names a state value\nthis run wrote, a call's result most often: every string under it is page text.",
|
|
2307
|
+
"type": "object",
|
|
2308
|
+
"properties": {
|
|
2309
|
+
"predicate": {
|
|
2310
|
+
"type": "string",
|
|
2311
|
+
"const": "quote_missing",
|
|
2312
|
+
"title": "predicate"
|
|
2313
|
+
},
|
|
2314
|
+
"path": {
|
|
2315
|
+
"type": "string",
|
|
2316
|
+
"title": "path"
|
|
2317
|
+
},
|
|
2318
|
+
"field": {
|
|
2319
|
+
"type": "string",
|
|
2320
|
+
"title": "field"
|
|
2321
|
+
},
|
|
2322
|
+
"pages": {
|
|
2323
|
+
"type": "array",
|
|
2324
|
+
"items": {
|
|
2325
|
+
"type": "string"
|
|
2326
|
+
},
|
|
2327
|
+
"title": "pages"
|
|
2328
|
+
}
|
|
2329
|
+
},
|
|
2330
|
+
"required": [
|
|
2331
|
+
"pages",
|
|
2332
|
+
"path",
|
|
2333
|
+
"predicate"
|
|
2334
|
+
]
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
"$ref": "#/definitions/NotPredicate",
|
|
2338
|
+
"description": "Holds when `of` does not. `of` is mechanical: a judged question never sits inside a negation."
|
|
2339
|
+
}
|
|
2340
|
+
]
|
|
2341
|
+
},
|
|
2342
|
+
"NotPredicate": {
|
|
2343
|
+
"description": "Holds when `of` does not. `of` is mechanical: a judged question never sits inside a negation.",
|
|
2344
|
+
"title": "NotPredicate",
|
|
2345
|
+
"type": "object",
|
|
2346
|
+
"properties": {
|
|
2347
|
+
"predicate": {
|
|
2348
|
+
"type": "string",
|
|
2349
|
+
"const": "not",
|
|
2350
|
+
"title": "predicate"
|
|
2351
|
+
},
|
|
2352
|
+
"of": {
|
|
2353
|
+
"$ref": "#/definitions/AcceptPredicate",
|
|
2354
|
+
"title": "of"
|
|
2019
2355
|
}
|
|
2356
|
+
},
|
|
2357
|
+
"required": [
|
|
2358
|
+
"of",
|
|
2359
|
+
"predicate"
|
|
2020
2360
|
]
|
|
2021
2361
|
},
|
|
2362
|
+
"DecisionImages": {
|
|
2363
|
+
"description": "The images a decision node sends with its request: each key is a token (such as `\"<page1>\"`) that appears literally in\nthe node's `state` or in a question's text, and each value is a reference to the image, written as a `state` value is\n(`\"{item.pages.0.image}\"`, or a literal path), that resolves to a string the host loads (a run-relative file path).",
|
|
2364
|
+
"title": "DecisionImages",
|
|
2365
|
+
"type": "object"
|
|
2366
|
+
},
|
|
2022
2367
|
"Workflow": {
|
|
2023
2368
|
"title": "Workflow",
|
|
2024
2369
|
"type": "object",
|
|
@@ -41,11 +41,16 @@ large contexts at meaningful boundaries while retaining their qualifiers.
|
|
|
41
41
|
The adapter has no default byte ceiling. A host may explicitly configure
|
|
42
42
|
`maxStateBytes`; local size errors then report the measured UTF-8 JSON bytes and
|
|
43
43
|
that host's limit before any HTTP request is sent. Provider context limits are
|
|
44
|
-
separate and token-based
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
separate and token-based. Jev 1.13's and 1.14's documented contract, checked on
|
|
45
|
+
2026-11-16, allows 32k tokens for state plus the longest question and 64k for
|
|
46
|
+
state plus all questions combined, and 262k for both with long context. The Jev
|
|
47
|
+
adapter never sends a request over it: one that may not fit the default goes
|
|
48
|
+
whole with long context, which is slower and less accurate; one that may not fit
|
|
49
|
+
that either has its longest state values cut, each ending ` [cut]`, and the
|
|
50
|
+
decision's receipt shows the state as cut (`state_cut` names each value). Images
|
|
51
|
+
count toward the context too, each use of a reference again. A judge that
|
|
52
|
+
must read every word partitions its evidence in the graph instead (below); do not
|
|
53
|
+
count on long context or cuts as the design.
|
|
49
54
|
|
|
50
55
|
`sift` sends its items together, in as few requests as the host's limits allow:
|
|
51
56
|
when the items exceed `maxQuestionsPerRequest` or the host's
|
|
@@ -102,6 +107,46 @@ Batch independent questions over the same state. They cannot read each other's
|
|
|
102
107
|
answers. Use another step when a decision is needed to retrieve new evidence or
|
|
103
108
|
construct new state. Inspect the assembled state and questions, not just node names.
|
|
104
109
|
|
|
110
|
+
## Name the provider, pin the model, bound the time
|
|
111
|
+
|
|
112
|
+
A decision node (`judge`, `pick`, `sift`, a `route` Jev chooses, or an `ask`
|
|
113
|
+
predicate) may say five things about the provider that answers it. Each is optional:
|
|
114
|
+
|
|
115
|
+
- `provider`: the id of one of the host's decision providers, such as `jev`,
|
|
116
|
+
`parallel` or `openrouter`. Absent, the host's default answers. An `openrouter`
|
|
117
|
+
node names its OpenRouter Decisions model in `model` (such as `liquid/d1`).
|
|
118
|
+
- `model`: a model or version to pin, so a run asks the same model next month. A
|
|
119
|
+
changed pin is a different decision: its answer is never replayed from another
|
|
120
|
+
model's receipt. A provider that declares the models it serves refuses any
|
|
121
|
+
other pin before the run starts; Parallel serves `parallel-fast` only.
|
|
122
|
+
- `evidence`: `"off"` keeps none; `"if_supported"` keeps what the provider gives;
|
|
123
|
+
`"required"` needs some. A provider whose capabilities declare no evidence is
|
|
124
|
+
refused for a `"required"` node before the run starts, and an answer that comes
|
|
125
|
+
back without any fails the request.
|
|
126
|
+
- `timeoutMs`: the node's own bound, at most 120000. It only shortens the
|
|
127
|
+
provider's deadline, never lengthens it. A call cut by it after it was sent may
|
|
128
|
+
have been answered and billed: it is not asked again, and the run goes to review.
|
|
129
|
+
- `images`: `{"<page1>": "{item.pages.0.image}"}` sends images with the request.
|
|
130
|
+
Each token must appear literally in the node's `state` or in a question's text,
|
|
131
|
+
where the image belongs (`"Does <page1> carry a seal?"`). Each reference is
|
|
132
|
+
written as a state value is and resolves to an image path the host reads; the
|
|
133
|
+
bytes never enter state. A provider without image input is refused before the
|
|
134
|
+
run. The receipt names each image by its SHA-256, never its bytes, and keeps the
|
|
135
|
+
state the judge saw. On `openrouter` with a model other than Jev (such as
|
|
136
|
+
`liquid/d1`), the token must stand alone as a top-level `state` value
|
|
137
|
+
(`"page": "<page1>"`), never inside text or a question: those models read an image
|
|
138
|
+
only as a whole state item. Jev on TypeSafe pins `jev-1.14.0`; through OpenRouter,
|
|
139
|
+
`typesafe/jev-1.14`. Jev takes an image of at most 1568 px on each side (a letter
|
|
140
|
+
page renders at 140 dpi to 1190x1540); a larger one is refused before it is sent.
|
|
141
|
+
|
|
142
|
+
The host checks each decision node against its providers before any node runs: a
|
|
143
|
+
provider it lacks, evidence it cannot give, a model it does not serve, a question
|
|
144
|
+
type it does not answer, or images it cannot take stops the run with the node
|
|
145
|
+
named. A host that names no decision providers cannot honour `provider` or
|
|
146
|
+
`timeoutMs`, so it refuses a node that sets either. The evidence a provider gives
|
|
147
|
+
travels with the answer, in `<as>$answers.evidence`, the decision receipt and the
|
|
148
|
+
node's event.
|
|
149
|
+
|
|
105
150
|
## Consume uncertainty honestly
|
|
106
151
|
|
|
107
152
|
`judge` stores decoded values at its `as` key and raw answers at `<as>$answers`.
|
|
@@ -8,12 +8,12 @@ Deliver the complete JSON document the way your host asks; never deliver prose,
|
|
|
8
8
|
## Document
|
|
9
9
|
|
|
10
10
|
A workflow is {"v":2,"name","schemas","input"?,"output","root"}.
|
|
11
|
-
- `schemas` maps ids to inline JSON Schema objects. Every schema id a node, `input` or `output` names must exist there. Inside a schema, reference a catalog schema or an inline definition only as {"$ref":"#/definitions/<id>"}.
|
|
11
|
+
- `schemas` maps ids to inline JSON Schema objects. Every schema id a node, `input` or `output` names must exist there. Inside a schema, reference a catalog schema or an inline definition only as {"$ref":"#/definitions/<id>"}. A `pattern` must not backtrack exponentially: no repeat or optional part inside a repeat that can match the same text (`(a+)+`, `(a?a?)+`, `(\w+\s?)*`), no unbounded repeat of alternatives that start alike (`(a|ab)*`), no backreference; validation refuses one.
|
|
12
12
|
- The input contract: the run starts from the input object and nothing else. `input.schemaId`, when present, is enforced before the first node. A node may read only input keys and keys an earlier node wrote.
|
|
13
13
|
- `output.schemaId` validates the final value; `output.path` selects it from state and must name an input key or a key an earlier node wrote.
|
|
14
14
|
- State is one object. Each step writes its result under one key: its `as`, or, for an agent, decide, extract or code node without `as`, its label. A report writes `report_markdown`. A code node without `as` that returns an object merges that object's top-level fields instead.
|
|
15
15
|
- Keys that hold a `$` are engine-owned: `$host` (host state), `<as>$answers` (raw judge answers and confidences) and `<as>$verify` (verifier results). Read them; never write one. No `as` may hold a `$`, and neither may the label of an agent, decide, extract or code node without `as`.
|
|
16
|
-
- `{dot.path}` placeholders are replaced from state in `state` maps (including `verify.state` and `ask.state`), call `args`, `input`, `env` and `produces`, a child workflow's `input`, and `escalate.summary`; `pick` and `sift` `describe` templates also see `{item...}`. A placeholder that is the whole string keeps its value's type. Every key a state map, call or child input interpolates must be produced upstream. `instructions`, `code` and `command` are literal and never interpolated.
|
|
16
|
+
- `{dot.path}` placeholders are replaced from state in `state` maps (including `verify.state` and `ask.state`), call `args`, `input`, `env` and `produces`, a child workflow's `input`, and `escalate.summary`; `pick` and `sift` `describe` templates also see `{item...}`. A placeholder that is the whole string keeps its value's type. Every key a state map, call or child input interpolates must be produced upstream, except through a whole-string placeholder marked optional, such as `"{draft?}"`: it is null while its path is absent (a loop's first pass, before the step that writes it ran), and the path's value once present. Only a whole string may be marked. `instructions`, `code` and `command` are literal and never interpolated.
|
|
17
17
|
|
|
18
18
|
## Node kinds
|
|
19
19
|
|
|
@@ -31,10 +31,10 @@ This is the complete set. Each kind accepts exactly these fields; any other fiel
|
|
|
31
31
|
- `escalate`: `label`, `when`, `kind`, `stage`, `summary`
|
|
32
32
|
- `call`: `label`, `via`, `tool`, `args`, `code`, `input`, `command`, `env`, `where`, `out`, `as`, `produces`, `deadline_s`, `retry`, `poll`, `requires`
|
|
33
33
|
- `workflow`: `label`, `workflow`, `input`, `out`, `as`
|
|
34
|
-
- `judge`: `label`, `state`, `out`, `as`, `requires`
|
|
35
|
-
- `pick`: `label`, `itemsPath`, `describe`, `instructions`, `state`, `allowNone`, `as`, `requires`
|
|
36
|
-
- `sift`: `label`, `itemsPath`, `describe`, `state`, `out`, `as`, `keep`, `requires`
|
|
37
|
-
- `route`: `label`, `state`, `instructions`, `branches`, `unsure`, `valuePath`, `otherwise`, `as`, `requires`
|
|
34
|
+
- `judge`: `label`, `state`, `out`, `as`, `requires`, `provider`, `model`, `evidence`, `timeoutMs`, `images`
|
|
35
|
+
- `pick`: `label`, `itemsPath`, `describe`, `instructions`, `state`, `allowNone`, `as`, `requires`, `provider`, `model`, `evidence`, `timeoutMs`, `images`
|
|
36
|
+
- `sift`: `label`, `itemsPath`, `describe`, `state`, `out`, `as`, `keep`, `requires`, `provider`, `model`, `evidence`, `timeoutMs`, `images`
|
|
37
|
+
- `route`: `label`, `state`, `instructions`, `branches`, `unsure`, `valuePath`, `otherwise`, `as`, `requires`, `provider`, `model`, `evidence`, `timeoutMs`, `images`
|
|
38
38
|
|
|
39
39
|
Every kind also accepts `metadata`, an object the host owns and the engine never reads; set only the keys the host addendum names.
|
|
40
40
|
|
|
@@ -72,11 +72,13 @@ Typed questions answered by the host's judge in one request each: no tools, no s
|
|
|
72
72
|
- `sift`: `itemsPath`, `out` (a question schema asked of every item; the host splits the items across requests when they exceed its limits) and `as`. `keep` {path: a question id or <id>.confidence, never a choice, gte?} keeps passing items, in order, at `<as>.items`.
|
|
73
73
|
- `route` runs one of 2 or more named `branches`. Jev chooses: a non-empty `state` map, `instructions` (the one question) and up to 240 branches, each {criteria?, body}; `unsure` {branch, gte: a number in (0, 1]} takes that branch when the choice's confidence is below `gte`. Or the workflow already holds the choice: `valuePath` names the state string that is the branch, each branch is {body}, no question is asked, and `otherwise` (a branch) takes a missing or unknown name, which otherwise fails; a non-string fails. `as` records the choice.
|
|
74
74
|
- A decoded boolean is true at yes-probability 0.5. To hold a different threshold, read `<as>$answers.answers.<id>.noul` in a code node.
|
|
75
|
+
- `images` {token: reference} sends images with a decision (judge, pick, sift, a route Jev chooses, ask). Each token, such as "<page1>", must appear literally in the node's `state` or in a question's text; each reference is written as a state value is, such as "{item.pages.0.image}", and must resolve to an image path the host can read. Only a provider that takes image input answers such a node. Pass images by reference, never their bytes in state.
|
|
76
|
+
- Inside a `map` with `onItemFailure` `collect`, a decision whose provider fails (rate limit, HTTP error, invalid answer, timeout) fails that item, and one sent whose outcome was lost, or one the provider refused, ends the item as a row marked `needs_review`; the other items go on.
|
|
75
77
|
|
|
76
78
|
### Control nodes
|
|
77
79
|
|
|
78
80
|
- `chain`: non-empty `steps`, run in order.
|
|
79
|
-
- `map`: `itemsPath` (an upstream list), `body` and `as`. The body sees `item` and `item_index`; `maxConcurrency` is a positive integer (default 4); `resultPath` selects one path from each completed item's state. Without `resultPath`, and with no `as` in the body, each item's result is its whole state, the mapped list included: set `resultPath` (or an `as` in the body) for a large map; the validator warns. `onItemFailure` is `stop` (default: the first failing item stops the map and the run) or `collect`. With `collect`, an item whose node fails (a call that failed after its retries, an agent that delivered no record, output that does not match its schema, a failed check) ends as {item_index, label, code, message} in the list at `failedAs`, the other items finish, and `as` stays aligned with the items: `as[i]` is item i's result, or `null` when item i failed. Filter the nulls explicitly if only successes are wanted. Gate on `failedAs` with `escalate` or a code node; never let failures pass silently. A crash, a cancel, an `escalate` inside the item or an effect whose outcome is unknown is never collected.
|
|
81
|
+
- `map`: `itemsPath` (an upstream list), `body` and `as`. The body sees `item` and `item_index`; `maxConcurrency` is a positive integer (default 4); `resultPath` selects one path from each completed item's state. Without `resultPath`, and with no `as` in the body, each item's result is its whole state, the mapped list included: set `resultPath` (or an `as` in the body) for a large map; the validator warns. A map takes at most 10,000 items, and items × the state's JSON size at most 256 Mi characters (each item runs on its own copy of the state); past either it fails before any item runs. `onItemFailure` is `stop` (default: the first failing item stops the map and the run) or `collect`. With `collect`, an item whose node fails (a call that failed after its retries, an agent that delivered no record, output that does not match its schema, a failed check) ends as {item_index, label, code, message} in the list at `failedAs`, the other items finish, and `as` stays aligned with the items: `as[i]` is item i's result, or `null` when item i failed. Filter the nulls explicitly if only successes are wanted. Gate on `failedAs` with `escalate` or a code node; never let failures pass silently. A crash, a cancel, an `escalate` inside the item or an effect whose outcome is unknown is never collected.
|
|
80
82
|
- `parallel`: at least two `branches`, each starting from the state before the parallel node. Branches write disjoint keys and never read a sibling's writes.
|
|
81
83
|
- `loop`: `body`, `until` (a predicate) and an integer `maxIters` of at least 1 (no maximum), optionally an integer `expect_iters` of at least 1 (priced passes). At the bound the state passes through with `until` unmet; follow the loop with an escalate or gate on that condition.
|
|
82
84
|
- `escalate`: `when` (a predicate), and non-empty `kind`, `stage` and `summary`. When the predicate holds the run stops without output and returns the escalation with its interpolated summary.
|
|
@@ -92,7 +94,7 @@ Typed questions answered by the host's judge in one request each: no tools, no s
|
|
|
92
94
|
|
|
93
95
|
## Predicates
|
|
94
96
|
|
|
95
|
-
`loop.until` and `escalate.when` take one of these; `poll` takes only the first
|
|
97
|
+
`loop.until` and `escalate.when` take one of these; `poll` takes only the first 11. Each path or key reads a state value an input or an earlier node produced.
|
|
96
98
|
A predicate is one JSON object that names itself in its `predicate` field beside its own fields, for example `{"predicate": "field_true", "path": "review.approved"}`.
|
|
97
99
|
- `field_equals` {path, value}: holds when the value at `path` equals `value` (a string, number or boolean)
|
|
98
100
|
- `field_true` {path}: holds when the value at `path` is `true`
|
|
@@ -102,7 +104,10 @@ A predicate is one JSON object that names itself in its `predicate` field beside
|
|
|
102
104
|
- `lt` {path, n}: holds when the finite number at `path` is below `n`
|
|
103
105
|
- `empty` {path}: holds when the value at `path` is an empty array, an empty string, null or absent
|
|
104
106
|
- `no_new_items` {key}: takes `key`, not `path`; holds when that state key is an empty array or falsy
|
|
105
|
-
- `
|
|
107
|
+
- `field_type` {path, type}: holds when the value at `path` is of `type`, one of number, string, boolean, array, object, null; a number only when finite, and an absent value is of no type
|
|
108
|
+
- `quote_missing` {path, field, pages}: the quote check, in code: holds when a quote at `path` (a string, or a list of them; with `field`, a list of records each holding its quote at `field`) is in none of the pages at `pages` (state paths holding what this run's call steps fetched; every string under each is page text). Both sides are compared lowercased, with curly quotes straight, dashes as "-" and whitespace runs as one space, then once more as their letters and digits alone; a quote under 8 characters is not checked. `{"predicate": "quote_missing", "path": "answer.evidence", "field": "quote", "pages": ["page"]}` on an escalate hands back an answer quoting text no fetched page holds. Check quotes with it, never with a judge or an `ask`
|
|
109
|
+
- `not` {of}: holds when `of`, one mechanical predicate (never `ask`), does not; `{"predicate": "not", "of": {"predicate": "field_type", "path": "score", "type": "number"}}` holds when score is absent or not a finite number
|
|
110
|
+
- `ask` {instructions, state, criteria, gte, provider, model, evidence, timeoutMs, images}: a yes/no question for the host's judge: `instructions` is the question, `state` what it sees (default: the whole state), `criteria` optional {true, false} descriptions; holds when the yes-probability is at least `gte` (in (0.5, 1], default 0.6)
|
|
106
111
|
|
|
107
112
|
## Authority
|
|
108
113
|
|