@parcha/agentrun-dsl 0.1.0-beta.30 → 0.1.0-beta.301
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 +11 -7
- 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 +7 -6
- package/dist/authoring.js +3 -2
- package/dist/cli.js +2 -1
- package/dist/code-exec.d.ts +19 -0
- package/dist/code-exec.js +54 -5
- package/dist/decision-provider.d.ts +11 -2
- package/dist/decision-provider.js +12 -4
- package/dist/decision-receipts.d.ts +19 -3
- package/dist/dry-run.d.ts +31 -1
- package/dist/dry-run.js +103 -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/index.d.ts +12 -9
- package/dist/index.js +14 -9
- 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 +23 -3
- package/dist/predicates.js +48 -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 +20 -14
- package/dist/recovery/driver.js +48 -26
- package/dist/recovery/frozen-snapshot.js +8 -8
- package/dist/recovery/handoff-receipts.d.ts +0 -35
- package/dist/recovery/handoff-receipts.js +2 -44
- package/dist/recovery/index.d.ts +2 -7
- package/dist/recovery/index.js +2 -6
- package/dist/recovery/item-state.d.ts +2 -1
- package/dist/recovery/item-state.js +7 -13
- package/dist/recovery/with-recovery.js +4 -2
- package/dist/submit-envelope.d.ts +1 -1
- package/dist/submit-envelope.js +11 -7
- package/dist/system-one.d.ts +0 -4
- package/dist/system-one.js +7 -8
- package/dist/vocabulary.d.ts +7 -2
- package/dist/vocabulary.js +7 -1
- package/dist/workflow-shape.js +4 -2
- package/dist/workflow.d.ts +64 -13
- package/dist/workflow.js +506 -202
- package/dist/zod-json-contract.js +6 -8
- package/package.json +7 -3
- package/schema/workflow.schema.json +93 -0
- package/skills/author/references/jev-decisions.md +10 -5
- package/skills/author/references/language.md +5 -4
- 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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-dsl",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.301",
|
|
4
4
|
"description": "Composable, typed workflows for agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -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"
|
|
@@ -47,7 +51,7 @@
|
|
|
47
51
|
"skills"
|
|
48
52
|
],
|
|
49
53
|
"engines": {
|
|
50
|
-
"node": ">=22.
|
|
54
|
+
"node": ">=24.22.3"
|
|
51
55
|
},
|
|
52
56
|
"scripts": {
|
|
53
57
|
"build": "tsc -p tsconfig.json",
|
|
@@ -55,7 +59,7 @@
|
|
|
55
59
|
"test": "node --test test/*.test.mjs"
|
|
56
60
|
},
|
|
57
61
|
"dependencies": {
|
|
58
|
-
"typebox": "1.3.
|
|
62
|
+
"typebox": "1.3.27"
|
|
59
63
|
},
|
|
60
64
|
"devDependencies": {
|
|
61
65
|
"esbuild": "0.28.2"
|
|
@@ -1647,6 +1647,37 @@
|
|
|
1647
1647
|
"type"
|
|
1648
1648
|
]
|
|
1649
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
|
+
},
|
|
1650
1681
|
{
|
|
1651
1682
|
"$ref": "#/definitions/NotPredicate",
|
|
1652
1683
|
"description": "Holds when `of` does not. `of` is mechanical: a judged question never sits inside a negation."
|
|
@@ -1949,6 +1980,37 @@
|
|
|
1949
1980
|
"type"
|
|
1950
1981
|
]
|
|
1951
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
|
+
},
|
|
1952
2014
|
{
|
|
1953
2015
|
"$ref": "#/definitions/NotPredicate",
|
|
1954
2016
|
"description": "Holds when `of` does not. `of` is mechanical: a judged question never sits inside a negation."
|
|
@@ -2240,6 +2302,37 @@
|
|
|
2240
2302
|
"type"
|
|
2241
2303
|
]
|
|
2242
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
|
+
},
|
|
2243
2336
|
{
|
|
2244
2337
|
"$ref": "#/definitions/NotPredicate",
|
|
2245
2338
|
"description": "Holds when `of` does not. `of` is mechanical: a judged question never sits inside a negation."
|
|
@@ -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
|
|
@@ -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
|
|
|
@@ -78,7 +78,7 @@ Typed questions answered by the host's judge in one request each: no tools, no s
|
|
|
78
78
|
### Control nodes
|
|
79
79
|
|
|
80
80
|
- `chain`: non-empty `steps`, run in order.
|
|
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. `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.
|
|
82
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.
|
|
83
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.
|
|
84
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.
|
|
@@ -94,7 +94,7 @@ Typed questions answered by the host's judge in one request each: no tools, no s
|
|
|
94
94
|
|
|
95
95
|
## Predicates
|
|
96
96
|
|
|
97
|
-
`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.
|
|
98
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"}`.
|
|
99
99
|
- `field_equals` {path, value}: holds when the value at `path` equals `value` (a string, number or boolean)
|
|
100
100
|
- `field_true` {path}: holds when the value at `path` is `true`
|
|
@@ -105,6 +105,7 @@ A predicate is one JSON object that names itself in its `predicate` field beside
|
|
|
105
105
|
- `empty` {path}: holds when the value at `path` is an empty array, an empty string, null or absent
|
|
106
106
|
- `no_new_items` {key}: takes `key`, not `path`; holds when that state key is an empty array or falsy
|
|
107
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`
|
|
108
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
|
|
109
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)
|
|
110
111
|
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { EffectFailure, type CallRetryClass, type EffectFailureCode } from "../workflow.js";
|
|
2
|
-
/** A failed effect: its closed code, the prose for the reader, and what the host observed
|
|
3
|
-
* (`detail`: the deadline, the elapsed time, the output tail, the filed output) which the
|
|
4
|
-
* interpreter writes onto the attempt's `effect.failed` event. The retry class is the transport's
|
|
5
|
-
* when it gave one, else the code's. */
|
|
6
|
-
export declare class TypedEffectFailure extends EffectFailure {
|
|
7
|
-
readonly code: EffectFailureCode;
|
|
8
|
-
constructor(code: EffectFailureCode, message: string, options?: {
|
|
9
|
-
detail?: Record<string, unknown>;
|
|
10
|
-
cause?: unknown;
|
|
11
|
-
retryClass?: CallRetryClass | null;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
/** A dispatch that succeeded around a failed tool: the transport answered with the tool's own failure
|
|
15
|
-
* envelope as its text. The envelope is the effect's failure, never its result. */
|
|
16
|
-
export declare class EffectEnvelopeFailure extends Error {
|
|
17
|
-
readonly tool: string;
|
|
18
|
-
readonly envelope: string;
|
|
19
|
-
constructor(tool: string, envelope: string);
|
|
20
|
-
}
|
|
21
|
-
/** A thrown error at an effect boundary, as a TypedEffectFailure. A TypedEffectFailure passes through; a
|
|
22
|
-
* tool the host did not grant (`notGranted` names it) is effect_not_granted; an unknown transport
|
|
23
|
-
* (`via` outside the interpreter's list) is effect_unknown_transport; a tool's failure envelope is
|
|
24
|
-
* effect_transport; otherwise the error's typed transport facts decide: a deadline (a TimeoutError, an
|
|
25
|
-
* AbortError, a 408, an idle cut, a timed-out connect) is effect_timeout, any other typed fact (a
|
|
26
|
-
* status, a system code, an error class) is effect_transport with the retry class those facts earn
|
|
27
|
-
* (effectRetryClass), and an error with no typed fact came through no transport that can be named:
|
|
28
|
-
* effect_unknown_transport. The message is carried for the reader and never read. */
|
|
29
|
-
export declare function classifyEffectFailure(error: unknown, at: {
|
|
30
|
-
label: string;
|
|
31
|
-
via: string;
|
|
32
|
-
}, options?: {
|
|
33
|
-
notGranted?: (error: unknown) => string | undefined;
|
|
34
|
-
}): TypedEffectFailure;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// An effect's failure, typed at every boundary. Every failure carries one closed code (EFFECT_FAILURE_CODES, the
|
|
2
|
-
// interpreter's list, which `retry.on` names); the prose stays beside it as `message`, for the reader,
|
|
3
|
-
// and is never the discriminator. This module holds the class a host's effect adapters throw, and the one
|
|
4
|
-
// classifier that maps a thrown transport error to a code from its typed facts (the error's class, its
|
|
5
|
-
// HTTP status, its system code), never from its text.
|
|
6
|
-
import { CALL_TRANSPORTS } from "../vocabulary.js";
|
|
7
|
-
import { EffectFailure } from "../workflow.js";
|
|
8
|
-
import { effectRetryClass, transportFactOf } from "./transport-facts.js";
|
|
9
|
-
/** The retry class a code implies when the failure's transport facts name none: a deadline is a
|
|
10
|
-
* timeout and a non-zero exit is an exit, the two the interpreter's default retry list names; every
|
|
11
|
-
* other code is not transient by nature. */
|
|
12
|
-
const IMPLIED_RETRY_CLASS = { effect_timeout: "timeout", effect_exit: "exit" };
|
|
13
|
-
/** A failed effect: its closed code, the prose for the reader, and what the host observed
|
|
14
|
-
* (`detail`: the deadline, the elapsed time, the output tail, the filed output) which the
|
|
15
|
-
* interpreter writes onto the attempt's `effect.failed` event. The retry class is the transport's
|
|
16
|
-
* when it gave one, else the code's. */
|
|
17
|
-
export class TypedEffectFailure extends EffectFailure {
|
|
18
|
-
constructor(code, message, options = {}) {
|
|
19
|
-
super(message, options.retryClass !== undefined ? options.retryClass : IMPLIED_RETRY_CLASS[code] ?? null, {
|
|
20
|
-
code, ...(options.detail ? { detail: options.detail } : {}), ...(options.cause !== undefined ? { cause: options.cause } : {}),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/** A dispatch that succeeded around a failed tool: the transport answered with the tool's own failure
|
|
25
|
-
* envelope as its text. The envelope is the effect's failure, never its result. */
|
|
26
|
-
export class EffectEnvelopeFailure extends Error {
|
|
27
|
-
tool;
|
|
28
|
-
envelope;
|
|
29
|
-
constructor(tool, envelope) {
|
|
30
|
-
super(`tool "${tool}" returned a failure: ${envelope.slice(0, 500)}`);
|
|
31
|
-
this.tool = tool;
|
|
32
|
-
this.envelope = envelope;
|
|
33
|
-
this.name = "EffectEnvelopeFailure";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/** A thrown error at an effect boundary, as a TypedEffectFailure. A TypedEffectFailure passes through; a
|
|
37
|
-
* tool the host did not grant (`notGranted` names it) is effect_not_granted; an unknown transport
|
|
38
|
-
* (`via` outside the interpreter's list) is effect_unknown_transport; a tool's failure envelope is
|
|
39
|
-
* effect_transport; otherwise the error's typed transport facts decide: a deadline (a TimeoutError, an
|
|
40
|
-
* AbortError, a 408, an idle cut, a timed-out connect) is effect_timeout, any other typed fact (a
|
|
41
|
-
* status, a system code, an error class) is effect_transport with the retry class those facts earn
|
|
42
|
-
* (effectRetryClass), and an error with no typed fact came through no transport that can be named:
|
|
43
|
-
* effect_unknown_transport. The message is carried for the reader and never read. */
|
|
44
|
-
export function classifyEffectFailure(error, at, options = {}) {
|
|
45
|
-
if (error instanceof TypedEffectFailure)
|
|
46
|
-
return error;
|
|
47
|
-
const text = error instanceof Error ? error.message : String(error);
|
|
48
|
-
const message = `call node "${at.label}": ${text.slice(0, 500)}`;
|
|
49
|
-
const refused = options.notGranted?.(error);
|
|
50
|
-
if (refused !== undefined)
|
|
51
|
-
return new TypedEffectFailure("effect_not_granted", message, { cause: error, detail: { tool: refused } });
|
|
52
|
-
if (!CALL_TRANSPORTS.includes(at.via))
|
|
53
|
-
return new TypedEffectFailure("effect_unknown_transport", message, { cause: error, detail: { transport: at.via } });
|
|
54
|
-
if (error instanceof EffectEnvelopeFailure)
|
|
55
|
-
return new TypedEffectFailure("effect_transport", message, { cause: error, retryClass: null });
|
|
56
|
-
const fact = transportFactOf(error);
|
|
57
|
-
const retryClass = effectRetryClass(fact);
|
|
58
|
-
if (retryClass === "timeout" || fact.errorName === "AbortError")
|
|
59
|
-
return new TypedEffectFailure("effect_timeout", message, { cause: error, retryClass });
|
|
60
|
-
const typed = fact.status !== undefined || fact.causeCode !== undefined || fact.errorName !== undefined || fact.providerType !== undefined || fact.providerCode !== undefined;
|
|
61
|
-
return new TypedEffectFailure(typed ? "effect_transport" : "effect_unknown_transport", message, { cause: error, retryClass });
|
|
62
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type InputProvenance } from "./handoff-files.js";
|
|
2
|
-
/** What the block says of the escalation. */
|
|
3
|
-
export type HandoffBlockInput = {
|
|
4
|
-
kind: string;
|
|
5
|
-
stage: string;
|
|
6
|
-
summary: string;
|
|
7
|
-
step_label?: string | null;
|
|
8
|
-
step_exec_id?: string | null;
|
|
9
|
-
state?: Record<string, unknown> | null;
|
|
10
|
-
workflow_sha_used?: string | null;
|
|
11
|
-
cost_usd?: number | null;
|
|
12
|
-
evidence_dir?: string | null;
|
|
13
|
-
/** Where the attempt's report.md was moved, when one existed. */
|
|
14
|
-
report_path?: string | null;
|
|
15
|
-
/** Workspace-relative paths the attempt's files were written to. */
|
|
16
|
-
files?: readonly string[] | null;
|
|
17
|
-
/** Where each input the attempt started from came from, and its form. */
|
|
18
|
-
inputs?: readonly InputProvenance[] | null;
|
|
19
|
-
/** The host's sizes for the continuation, stated as one line. */
|
|
20
|
-
budget?: {
|
|
21
|
-
max_tool_calls?: number;
|
|
22
|
-
max_seconds?: number;
|
|
23
|
-
} | null;
|
|
24
|
-
};
|
|
25
|
-
/** The state at the gate is rendered whole up to this size; beyond it the block points at state.json. */
|
|
26
|
-
export declare const STATE_LIMIT: number;
|
|
27
|
-
/** Strings above the limit become a prefix plus a marker with the omitted length; nested values recurse. */
|
|
28
|
-
export declare function boundedValue(value: unknown, limit?: number): unknown;
|
|
29
|
-
/** One line per completed output in the state: the key the workflow wrote and the shape it holds. */
|
|
30
|
-
export declare function stateShapes(state: Record<string, unknown> | null | undefined): string[];
|
|
31
|
-
/** The one line that states the host's sizes for the continuation, or "" when the host sent none. */
|
|
32
|
-
export declare function escalationBudgetLine(budget: HandoffBlockInput["budget"]): string;
|
|
33
|
-
/** The block the continuation reads first. Deterministic for a given row; policy-agnostic. The reason is the
|
|
34
|
-
* workflow's own text, whole; the state at the gate is whole up to STATE_LIMIT, and beyond it the
|
|
35
|
-
* block points at the file that holds it. */
|
|
36
|
-
export declare function escalationContextBlock(context: HandoffBlockInput): string;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { redactSensitiveValue, redactText } from "./handoff-redact.js";
|
|
3
|
-
import { HANDOFF_FILES_DIR } from "./handoff-files.js";
|
|
4
|
-
const VALUE_LIMIT = 400;
|
|
5
|
-
const ARRAY_LIMIT = 20;
|
|
6
|
-
/** The state at the gate is rendered whole up to this size; beyond it the block points at state.json. */
|
|
7
|
-
export const STATE_LIMIT = 48 * 1024;
|
|
8
|
-
/** The Files section lists this many paths, then counts the rest by directory. */
|
|
9
|
-
const FILES_LIST_LIMIT = 200;
|
|
10
|
-
const SHAPES_LIMIT = 3 * 1024;
|
|
11
|
-
const SHAPE_LINE_LIMIT = 160;
|
|
12
|
-
/** Strings above the limit become a prefix plus a marker with the omitted length; nested values recurse. */
|
|
13
|
-
export function boundedValue(value, limit = VALUE_LIMIT) {
|
|
14
|
-
if (typeof value === "string")
|
|
15
|
-
return value.length > limit ? `${value.slice(0, limit)}<${value.length - limit} more chars>` : value;
|
|
16
|
-
if (Array.isArray(value)) {
|
|
17
|
-
const head = value.slice(0, ARRAY_LIMIT).map(v => boundedValue(v, limit));
|
|
18
|
-
return value.length > ARRAY_LIMIT ? [...head, `<${value.length - ARRAY_LIMIT} more items>`] : head;
|
|
19
|
-
}
|
|
20
|
-
if (value && typeof value === "object")
|
|
21
|
-
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, boundedValue(v, limit)]));
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
/** One line per completed output in the state: the key the workflow wrote and the shape it holds. */
|
|
25
|
-
export function stateShapes(state) {
|
|
26
|
-
if (!state || typeof state !== "object")
|
|
27
|
-
return [];
|
|
28
|
-
return Object.entries(state).map(([key, value]) => {
|
|
29
|
-
let line;
|
|
30
|
-
if (value === null || value === undefined)
|
|
31
|
-
line = `- ${key}: empty`;
|
|
32
|
-
else if (Array.isArray(value))
|
|
33
|
-
line = `- ${key}: array of ${value.length}`;
|
|
34
|
-
else if (typeof value === "object") {
|
|
35
|
-
const keys = Object.keys(value);
|
|
36
|
-
line = `- ${key}: object {${keys.slice(0, 12).join(", ")}${keys.length > 12 ? ", …" : ""}}`;
|
|
37
|
-
}
|
|
38
|
-
else if (typeof value === "string")
|
|
39
|
-
line = `- ${key}: string (${value.length} chars)`;
|
|
40
|
-
else
|
|
41
|
-
line = `- ${key}: ${typeof value}`;
|
|
42
|
-
return line.length > SHAPE_LINE_LIMIT ? `${line.slice(0, SHAPE_LINE_LIMIT)}…` : line;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/** The shapes section under its own budget: whole lines until the budget is spent, then a count. */
|
|
46
|
-
function shapesSection(shapes, budget) {
|
|
47
|
-
if (!shapes.length)
|
|
48
|
-
return ["- none"];
|
|
49
|
-
const kept = [];
|
|
50
|
-
let used = 0;
|
|
51
|
-
for (const line of shapes) {
|
|
52
|
-
if (used + line.length + 1 > budget)
|
|
53
|
-
break;
|
|
54
|
-
kept.push(line);
|
|
55
|
-
used += line.length + 1;
|
|
56
|
-
}
|
|
57
|
-
if (kept.length < shapes.length)
|
|
58
|
-
kept.push(`- …and ${shapes.length - kept.length} more keys (${shapes.length} in total)`);
|
|
59
|
-
return kept;
|
|
60
|
-
}
|
|
61
|
-
/** The block lists this many inputs, then counts the rest; inputs.json lists every one. */
|
|
62
|
-
const INPUT_LINE_LIMIT = 100;
|
|
63
|
-
const INPUT_VALUE_LIMIT = 200;
|
|
64
|
-
/** The inputs section: one line per input, its path, its form and its value (a long value by size). */
|
|
65
|
-
function inputsSection(inputs, filed) {
|
|
66
|
-
if (!inputs?.length)
|
|
67
|
-
return [];
|
|
68
|
-
const label = (form) => form === "email" ? "identifier (email address)" : form === "url" ? "identifier (URL)" : form === "text" ? "typed text" : form;
|
|
69
|
-
return ["", `Inputs the run started from, as the dispatch carried them (path: form: value)${filed ? `; whole in \`${HANDOFF_FILES_DIR}/inputs.json\`` : ""}. An identifier is a value of a fixed form a source can be matched on; typed text is what was written in:`,
|
|
70
|
-
...inputs.slice(0, INPUT_LINE_LIMIT).map((input) => `- ${input.path}: ${label(input.form)}: ${input.value.length > INPUT_VALUE_LIMIT ? `(${input.value.length} chars)` : input.value.replace(/\s+/g, " ")}`),
|
|
71
|
-
...(inputs.length > INPUT_LINE_LIMIT ? [`- …${inputs.length - INPUT_LINE_LIMIT} more inputs (${inputs.length} in total)${filed ? `, each with its path and form in \`${HANDOFF_FILES_DIR}/inputs.json\`` : ""}`] : [])];
|
|
72
|
-
}
|
|
73
|
-
/** The one line that states the host's sizes for the continuation, or "" when the host sent none. */
|
|
74
|
-
export function escalationBudgetLine(budget) {
|
|
75
|
-
if (!budget)
|
|
76
|
-
return "";
|
|
77
|
-
const sizes = [
|
|
78
|
-
...(budget.max_tool_calls !== undefined ? [`${budget.max_tool_calls} external tool calls`] : []),
|
|
79
|
-
...(budget.max_seconds !== undefined ? [`${budget.max_seconds} seconds`] : []),
|
|
80
|
-
];
|
|
81
|
-
return sizes.length ? `Budget for this continuation (set by the host): ${sizes.join(" and ")}.` : "";
|
|
82
|
-
}
|
|
83
|
-
/** The Files section: every path the attempt left for the continuation. */
|
|
84
|
-
function filesSection(context) {
|
|
85
|
-
const frozen = [...(context.files ?? [])];
|
|
86
|
-
const lines = [];
|
|
87
|
-
const described = {
|
|
88
|
-
[`${HANDOFF_FILES_DIR}/state.json`]: "the workflow state at the gate, whole",
|
|
89
|
-
[`${HANDOFF_FILES_DIR}/gate.json`]: "the gate: kind, stage, step, reason, its state and every committed route decision",
|
|
90
|
-
[`${HANDOFF_FILES_DIR}/inputs.json`]: "the inputs the frozen attempt started from, with each one's path and form",
|
|
91
|
-
};
|
|
92
|
-
const shown = frozen.slice(0, FILES_LIST_LIMIT);
|
|
93
|
-
for (const file of shown)
|
|
94
|
-
lines.push(`- ${file}${described[file] ? `: ${described[file]}` : ""}`);
|
|
95
|
-
if (frozen.length > shown.length) {
|
|
96
|
-
const rest = new Map();
|
|
97
|
-
for (const file of frozen.slice(shown.length)) {
|
|
98
|
-
const dir = path.posix.dirname(file);
|
|
99
|
-
rest.set(dir, (rest.get(dir) ?? 0) + 1);
|
|
100
|
-
}
|
|
101
|
-
for (const [dir, count] of rest)
|
|
102
|
-
lines.push(`- …${count} more under ${dir}/`);
|
|
103
|
-
}
|
|
104
|
-
if (!lines.length)
|
|
105
|
-
return [];
|
|
106
|
-
const items = frozen.some((file) => file.startsWith(`${HANDOFF_FILES_DIR}/items/`));
|
|
107
|
-
const effects = frozen.some((file) => file.startsWith(`${HANDOFF_FILES_DIR}/effects/`));
|
|
108
|
-
return ["", "Files the frozen attempt left in the workspace (read them; they are whole where this text is not):",
|
|
109
|
-
...(items ? [`Each file under ${HANDOFF_FILES_DIR}/items/ is one record the workflow judged, with its text and its scores.`] : []),
|
|
110
|
-
...(effects ? [`Each file under ${HANDOFF_FILES_DIR}/effects/ is one paid call: its arguments and its full result.`] : []),
|
|
111
|
-
...lines];
|
|
112
|
-
}
|
|
113
|
-
/** The block the continuation reads first. Deterministic for a given row; policy-agnostic. The reason is the
|
|
114
|
-
* workflow's own text, whole; the state at the gate is whole up to STATE_LIMIT, and beyond it the
|
|
115
|
-
* block points at the file that holds it. */
|
|
116
|
-
export function escalationContextBlock(context) {
|
|
117
|
-
const step = context.step_label ?? context.stage;
|
|
118
|
-
const summary = redactText(String(context.summary || "").trim()) || "(no summary recorded)";
|
|
119
|
-
const budget = escalationBudgetLine(context.budget);
|
|
120
|
-
const header = [
|
|
121
|
-
"## YOU ARE CONTINUING A RUN THAT ESCALATED",
|
|
122
|
-
"",
|
|
123
|
-
`A reviewed workflow${context.workflow_sha_used ? ` (${String(context.workflow_sha_used).slice(0, 12)})` : ""} ran first and stopped at step \`${step}\`${context.step_exec_id ? ` (execution ${context.step_exec_id})` : ""}: ${context.kind}${context.stage && context.stage !== step ? ` at stage ${context.stage}` : ""}.`,
|
|
124
|
-
"",
|
|
125
|
-
"Why it stopped:",
|
|
126
|
-
summary,
|
|
127
|
-
...(budget ? ["", budget] : []),
|
|
128
|
-
"",
|
|
129
|
-
];
|
|
130
|
-
const footer = [
|
|
131
|
-
"",
|
|
132
|
-
...(context.evidence_dir ? [`Evidence gathered so far is under \`${context.evidence_dir}\`.`] : []),
|
|
133
|
-
...(context.report_path ? [`The frozen attempt's report was moved to \`${context.report_path}\`.`] : []),
|
|
134
|
-
...(typeof context.cost_usd === "number"
|
|
135
|
-
? [`The frozen attempt spent $${context.cost_usd.toFixed(4)}.`]
|
|
136
|
-
: []),
|
|
137
|
-
"",
|
|
138
|
-
"Continue the job from this state. Do not redo completed work; build on it. When you explain what happened, cite this escalation (its step and reason) rather than inventing a cause.",
|
|
139
|
-
];
|
|
140
|
-
const shapes = shapesSection(stateShapes(context.state), SHAPES_LIMIT);
|
|
141
|
-
const stateFile = (context.files ?? []).includes(`${HANDOFF_FILES_DIR}/state.json`) ? `${HANDOFF_FILES_DIR}/state.json` : null;
|
|
142
|
-
const stateJson = JSON.stringify(redactSensitiveValue(context.state ?? {}), null, 2);
|
|
143
|
-
const state = stateJson.length <= STATE_LIMIT
|
|
144
|
-
? ["", `State at the gate (whole${stateFile ? `; also in \`${stateFile}\`` : ""}):`, "```json", stateJson, "```"]
|
|
145
|
-
: ["", `State body is ${stateJson.length} chars (${Object.keys(context.state ?? {}).length} keys), beyond what this text carries; ${stateFile ? `read it whole in \`${stateFile}\`` : "the list above names every key with its type and size"}.`];
|
|
146
|
-
const filedInputs = (context.files ?? []).includes(`${HANDOFF_FILES_DIR}/inputs.json`);
|
|
147
|
-
return redactText([...header, "Completed outputs it left in the workflow state (do not redo this work):", ...shapes, ...state, ...inputsSection(context.inputs, filedInputs), ...filesSection(context), ...footer].join("\n"));
|
|
148
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/** One step's transcript message, as a host's reader returns it. */
|
|
2
|
-
export type TranscriptMessage = {
|
|
3
|
-
role: "user" | "assistant" | "toolResult";
|
|
4
|
-
content?: unknown;
|
|
5
|
-
toolCallId?: string;
|
|
6
|
-
toolName?: string;
|
|
7
|
-
isError?: boolean;
|
|
8
|
-
stopReason?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const DIGEST_STEP_LIMIT: number;
|
|
11
|
-
export declare const DIGEST_LIMIT: number;
|
|
12
|
-
/** A step's spend: `usd` is a floor when `state` is `partial` and unknown when null; a spend recorded without a state
|
|
13
|
-
* (a recorded trace's `session.spent` row) is complete. */
|
|
14
|
-
export type InheritedSession = {
|
|
15
|
-
id: string;
|
|
16
|
-
role: string;
|
|
17
|
-
state: string;
|
|
18
|
-
file: string | null;
|
|
19
|
-
spend?: {
|
|
20
|
-
usd: number | null;
|
|
21
|
-
turns: number;
|
|
22
|
-
state?: "complete" | "partial" | "unavailable";
|
|
23
|
-
toolCalls?: number;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export type InheritedEffect = {
|
|
27
|
-
id: string;
|
|
28
|
-
name: string;
|
|
29
|
-
status: string;
|
|
30
|
-
session?: string | null;
|
|
31
|
-
result?: unknown;
|
|
32
|
-
};
|
|
33
|
-
export type InheritedJob = {
|
|
34
|
-
runId: string;
|
|
35
|
-
/** A step's transcript by its session id (the run's durable file holds them), or null when there is none. */
|
|
36
|
-
transcriptOf: (sessionId: string) => readonly TranscriptMessage[] | null;
|
|
37
|
-
cwd: string;
|
|
38
|
-
evidenceDir?: string | null;
|
|
39
|
-
sessions: InheritedSession[];
|
|
40
|
-
effects: InheritedEffect[];
|
|
41
|
-
/** Workspace-relative produced files with the sha256 the driver committed for them. */
|
|
42
|
-
files: Record<string, string>;
|
|
43
|
-
/** The file writeHandoffFiles wrote each effect's whole receipt to, by effect id. */
|
|
44
|
-
effectFiles?: Record<string, string>;
|
|
45
|
-
};
|
|
46
|
-
/** The label a step's identity carries, distinct for every session the frozen driver admits. A step's
|
|
47
|
-
* session is `<run>:<label>:<step|adapt>:<execution path>:a<attempt>` (the label as the
|
|
48
|
-
* interpreter names the node: a child's step `invocation/step`, a plan's `adapt:<gate>/step`, and a
|
|
49
|
-
* label may hold colons), read as the label with each map item index its path runs under as `[k]` and
|
|
50
|
-
* each loop iteration as `#k`. */
|
|
51
|
-
export declare function stepLabelOf(runId: string, sessionId: string): string | null;
|
|
52
|
-
/** One completed LLM step, from its transcript (`transcriptOf`): what it was asked, what it called, what it concluded and
|
|
53
|
-
* what it submitted. Bounded per step; a step whose transcript is absent or unreadable says so. */
|
|
54
|
-
export declare function stepDigest(runId: string, session: InheritedSession, transcriptOf: (sessionId: string) => readonly TranscriptMessage[] | null): string;
|
|
55
|
-
/** The digest the continuation reads after the escalation block: the completed
|
|
56
|
-
* LLM steps' transcripts, the evidence gathered, the files produced with their receipts, and the
|
|
57
|
-
* one rule that this is a continuation. Deterministic for a given ledger and workspace. */
|
|
58
|
-
export declare function inheritedJobDigest(job: InheritedJob): string;
|