fyflow-orchestration 0.7.0 → 0.9.0
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/AGENTS.md +1895 -206
- package/README.md +89 -104
- package/dist/browser/chunks/{chunk-YVOP3DIN.js → chunk-3U4UZC34.js} +2683 -449
- package/dist/browser/index.js +19 -9
- package/dist/browser/scheduler/index.js +158 -67
- package/dist/node/chunks/{chunk-YVOP3DIN.js → chunk-3U4UZC34.js} +2683 -449
- package/dist/node/index.js +19 -9
- package/dist/node/scheduler/index.js +158 -67
- package/dist/types/src/definition/assist.d.ts +29 -5
- package/dist/types/src/definition/condition.d.ts +49 -0
- package/dist/types/src/definition/regions.d.ts +12 -1
- package/dist/types/src/definition/registry.d.ts +52 -10
- package/dist/types/src/definition/schema.d.ts +20 -8
- package/dist/types/src/definition/types.d.ts +152 -23
- package/dist/types/src/definition/validate.d.ts +68 -20
- package/dist/types/src/definition/wiring.d.ts +58 -10
- package/dist/types/src/definition/witness.d.ts +12 -4
- package/dist/types/src/driver/driver.d.ts +827 -61
- package/dist/types/src/driver/listener.d.ts +7 -1
- package/dist/types/src/driver/log.d.ts +20 -5
- package/dist/types/src/driver/routing.d.ts +10 -5
- package/dist/types/src/fold/accumulator.d.ts +94 -0
- package/dist/types/src/fold/policies.d.ts +4 -5
- package/dist/types/src/fold/run-state.d.ts +275 -17
- package/dist/types/src/scheduler/bootstrap.d.ts +18 -26
- package/dist/types/src/scheduler/envelope-worker.d.ts +6 -5
- package/dist/types/src/scheduler/index.d.ts +2 -2
- package/dist/types/src/scheduler/runtime.d.ts +144 -39
- package/package.json +3 -3
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The definition validator — `spec/flow-definition.md` section 5.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* deliberately absent — the number `check-spec` prints as *C4 covered
|
|
6
|
-
* from the ids in this file. *(
|
|
4
|
+
* Forty-five refusals — `FD-V14`, `FD-V15` and, since v0.19 (W65, ADR 0054), `FD-V5` and `FD-V34`
|
|
5
|
+
* deliberately absent — the number `check-spec` prints as *C4 covered 45 definition refusals*, derived
|
|
6
|
+
* from the ids in this file. *(44 until W191 added `FD-V49`, `"$item"` outside any map instance, v0.45 — 42 until W179 added `FD-V47` and `FD-V48`, the ASK's two, v0.42 — and this
|
|
7
|
+
* sentence read **thirty-seven** from W92 until W179, stale by five through v0.27's `FD-V42`-`FD-V45` and
|
|
8
|
+
* v0.28's `FD-V46`, the increment again applied to a number nothing was tracking. 34 until W92 added
|
|
9
|
+
* `FD-V39`-`FD-V41`, the GATE's three, v0.23. This read
|
|
7
10
|
* 23 before W45 and 24 after it: the increment was applied to a number nothing was tracking, and
|
|
8
11
|
* it had been wrong by three for several plans. W45's conformity reader. **27 until W58 added
|
|
9
12
|
* `FD-V30` and `FD-V31`, 29 until W59 added `FD-V32`-`FD-V34`, 32 until W61 added
|
|
@@ -14,7 +17,17 @@
|
|
|
14
17
|
*
|
|
15
18
|
* ADR 0002 rule 3: this runs in full, at instantiation, before any task is queued.
|
|
16
19
|
*/
|
|
17
|
-
import type { Finding, FlowDefinition, GateType, GateTypes, JsonSchema, LanguageAdapter, Languages, NodeTypeEntry, NodeTypes, Pools, Registry, WorkerEntry, Workers } from './types.js';
|
|
20
|
+
import type { Finding, FlowDefinition, GateType, GateTypes, JsonSchema, StaticGateType, LanguageAdapter, Languages, NodeTypeEntry, NodeTypes, Pools, Registry, WorkerEntry, Workers } from './types.js';
|
|
21
|
+
export { readKeyPath } from './condition.js';
|
|
22
|
+
/**
|
|
23
|
+
* **The six keys a `task` declares that an `ask` REFUSES, each by `FD-V47` and by nothing else** — v0.42, W179,
|
|
24
|
+
* P35 stop-and-ask (a) and decision 6. Every one is read by a task's WORKER or its scheduler task — a type and its
|
|
25
|
+
* pool, `optional`, `retryPolicy` and `workerGroups` are handed to the scheduler, and a `transform` is evaluated in
|
|
26
|
+
* the type's worker wrapper (`FD-C6`) — and an ask has neither: it is never dispatched. **One rule owns them on an
|
|
27
|
+
* ask**, `FD-V41`'s precedent for `route` on every edge, so `FD-V17`'s message (*undeclared*) does not say the wrong
|
|
28
|
+
* thing beside the right one. Exported so `test/definition/ask.test.ts` compares it to the spec's row both ways.
|
|
29
|
+
*/
|
|
30
|
+
export declare const ASK_REFUSED_KEYS: readonly string[];
|
|
18
31
|
/**
|
|
19
32
|
* **The keys `FD-V17` refuses against, exported so a test can compare them to
|
|
20
33
|
* `spec/flow-definition.md` section 3s own Edge key table** — W42s conformity reader.
|
|
@@ -145,14 +158,10 @@ export declare const KEY_PATH_RE: RegExp;
|
|
|
145
158
|
*/
|
|
146
159
|
export declare function keyPathProblem(v: unknown): string | null;
|
|
147
160
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* (`
|
|
151
|
-
* anything else — a missing key, `null`, an ARRAY mid-path (no index, by (d)), a primitive — is
|
|
152
|
-
* `undefined`, which is what `distinct` routes to `nokey`. The value at the end is returned whatever it is.
|
|
161
|
+
* A gate type's own members — the interface's seven, and no other own key (a typo is the silent kind).
|
|
162
|
+
* `routesFor` and `settingsProblem` since v0.30 (ADR 0092): a type carries `routes` and `defaultRoute`
|
|
163
|
+
* (`keyResolvedRoutes?` beside them) OR `routesFor`, exactly one of the two.
|
|
153
164
|
*/
|
|
154
|
-
export declare function readKeyPath(value: unknown, path: string): unknown;
|
|
155
|
-
/** A gate type's own members — the interface's five, and no other own key (a typo is the silent kind). */
|
|
156
165
|
export declare const GATE_TYPE_KEYS: readonly string[];
|
|
157
166
|
/**
|
|
158
167
|
* **Why a value is not a `GateType`, or `null`** — one predicate for the validator (`FD-V39`'s second
|
|
@@ -160,11 +169,27 @@ export declare const GATE_TYPE_KEYS: readonly string[];
|
|
|
160
169
|
* so the two cannot disagree about what a gate type IS. `distinct` is held to it like any other.
|
|
161
170
|
*/
|
|
162
171
|
export declare function gateTypeProblem(t: unknown): string | null;
|
|
172
|
+
/**
|
|
173
|
+
* **A gate's RESOLVED route set, or why it has none** — ADR 0092 rule 3, the ONE function between a gate's
|
|
174
|
+
* routes and every reader of them: `FD-V41`'s count, `FD-R5`'s undeclared-route stop, the edge an edge with no
|
|
175
|
+
* `route` carries (`gateEdge`), and the wiring check's default and guarantee. A `StaticGateType` resolves to
|
|
176
|
+
* its own three members; a `DerivedGateType` to what its `routesFor` returns for THIS gate's settings.
|
|
177
|
+
*
|
|
178
|
+
* **Pure and TOTAL**: it never throws. Settings that are not a plain object, a `routesFor` that throws, and a
|
|
179
|
+
* set that fails `FD-V39`'s route clauses (`routeSetProblem`, the predicate a static type is held to) or
|
|
180
|
+
* carries a key beside the three are each a `{ problem }`. `routesFor` is handed a COPY of the settings, so a
|
|
181
|
+
* type writing into them moves nothing in the definition, and what it returned is copied and frozen, so a
|
|
182
|
+
* type mutating its own result later moves nothing a reader cached. Call it with the type `gateTypeProblem`
|
|
183
|
+
* accepted — the validator, the driver and the wiring check each do.
|
|
184
|
+
*/
|
|
185
|
+
export declare function routesOf(type: GateType, settings: unknown): Pick<StaticGateType, 'routes' | 'defaultRoute' | 'keyResolvedRoutes'> | {
|
|
186
|
+
readonly problem: string;
|
|
187
|
+
};
|
|
163
188
|
/**
|
|
164
189
|
* **`distinct` — the one BUILT-IN gate type, and it is written against the public interface and nothing
|
|
165
190
|
* else** (P24 decision 2): nothing in the validator, the wiring check or the driver names it; they read
|
|
166
|
-
*
|
|
167
|
-
* keeps the FIRST
|
|
191
|
+
* the gate's route set through `routesOf`, and `settingsSchema`, `settingsProblem` and `fn`, off whatever type
|
|
192
|
+
* a gate names. A `StaticGateType` — its routes are the same for every gate (ADR 0092). It keeps the FIRST
|
|
168
193
|
* branch to reach the gate per key and routes every later one with the same key to `duplicate`.
|
|
169
194
|
*
|
|
170
195
|
* - `first` (the DEFAULT) — the key has not been seen at this gate in this run;
|
|
@@ -178,8 +203,12 @@ export declare function gateTypeProblem(t: unknown): string | null;
|
|
|
178
203
|
* key. Memory holds one entry per key seen; `fn` writes it and nothing else does. Its life is the RUN's —
|
|
179
204
|
* one memory per gate, created empty with the driver and rebuilt by replay on resume (W93, `RN-R26`).
|
|
180
205
|
*/
|
|
181
|
-
export declare const distinct:
|
|
182
|
-
/**
|
|
206
|
+
export declare const distinct: StaticGateType;
|
|
207
|
+
/**
|
|
208
|
+
* **The built-in gate types, by name** — `distinct` (P24), and since W154 `if` and `switch` (P32 decision 1), all
|
|
209
|
+
* three written against the public interface a consumer's type is. A consumer type named as any of them is refused,
|
|
210
|
+
* never merged (`NameCollision`, `FD-V39`).
|
|
211
|
+
*/
|
|
183
212
|
export declare const BUILT_IN_GATE_TYPES: Readonly<Record<string, GateType>>;
|
|
184
213
|
/**
|
|
185
214
|
* **Every gate type a flow may name: the built-ins, then the consumer's** — `Registry.gateTypes`' own
|
|
@@ -264,17 +293,28 @@ export declare function effectiveSettings(node: {
|
|
|
264
293
|
*/
|
|
265
294
|
export declare function settingsProblem(schema: JsonSchema | undefined, defaults: Readonly<Record<string, unknown>> | undefined, settings: unknown): string | null;
|
|
266
295
|
/**
|
|
267
|
-
* **The one place `needs`' reference grammar is parsed** — `FD-V26`'s
|
|
296
|
+
* **The one place `needs`' reference grammar is parsed** — `FD-V26`'s five forms (`"."`, `"$payload"`, `"$item"`, `"n"`, `["n"]` — the two `$` forms since v0.44, `"$item"` composed since v0.45),
|
|
268
297
|
* and `spec/flow-definition.md` section 3's table. `null` is *not a reference at
|
|
269
298
|
* all*, which is what `FD-V26` reports; every other return is well formed and
|
|
270
299
|
* `FD-V27`/`FD-V28` decide whether it is well AIMED.
|
|
271
300
|
*
|
|
272
|
-
*
|
|
273
|
-
* because
|
|
274
|
-
*
|
|
301
|
+
* **The grammar's invented tokens are `"."`, `"?"` and — v0.44 — the whole `"$"` PREFIX**, and
|
|
302
|
+
* each is safe because it is outside `FD-V16`'s charset, so no node may ever be called `.`, end
|
|
303
|
+
* in `?` or begin with `$` (P38 fact 1). *(This read *"`"."` and `"?"` are the only invented
|
|
304
|
+
* tokens"* until W190.)* Two `$` tokens are references: **`"$payload"`** — the value the RUN
|
|
305
|
+
* entered with, from any node and any edge (v0.44,
|
|
306
|
+
* [ADR 0117](../../doc/decisions/0117-a-reference-may-name-what-reached-the-run.md)) — and
|
|
307
|
+
* **`"$item"`** — the item of the innermost map instance CONTAINING the reader, from any node or edge
|
|
308
|
+
* inside one (v0.45, P38 (c), [ADR 0118](../../doc/decisions/0118-a-map-instance-keeps-its-item-while-a-node-of-it-may-still-be-entered.md));
|
|
309
|
+
* parsed here since v0.44 so the union is one type for both (P38 (h)), and aimed by `FD-V49`. Every other `$`
|
|
310
|
+
* spelling — `["$payload"]`, `"$payload?"`, `"$other"` — is `null`, and `FD-V26` names the fix.
|
|
311
|
+
* **They are `form`s and not a flag**, and `node` is `null` on all three node-less forms, so a
|
|
312
|
+
* caller that reads `node === null` as *the `"."` form* reads `"$payload"` as `"."` in silence —
|
|
313
|
+
* **switch on `form`** (P38 fact 7, the reason the union is widened rather than `'self'` reused).
|
|
275
314
|
* **On an EDGE the `"."` form is refused** — `FD-V26`s v0.12 clause — but that is the
|
|
276
315
|
* CALLER`s rule: this function parses ONE grammar, and the two sites differ in what
|
|
277
|
-
* they accept of it rather than in how it is read.
|
|
316
|
+
* they accept of it rather than in how it is read. *`"$payload"` and `"$item"` are NOT refused there*: a
|
|
317
|
+
* predicate has no `ctx.payload` and no `ctx.item`, so naming either is not redundant (P38 decision 3).
|
|
278
318
|
*
|
|
279
319
|
* **The `?` suffix is v0.13's, and it decides what happens when the target produced
|
|
280
320
|
* NOTHING on this path rather than which outputs are named** —
|
|
@@ -289,6 +329,14 @@ export declare function referenceTarget(ref: unknown): {
|
|
|
289
329
|
form: 'self';
|
|
290
330
|
node: null;
|
|
291
331
|
conditional: false;
|
|
332
|
+
} | {
|
|
333
|
+
form: 'payload';
|
|
334
|
+
node: null;
|
|
335
|
+
conditional: false;
|
|
336
|
+
} | {
|
|
337
|
+
form: 'item';
|
|
338
|
+
node: null;
|
|
339
|
+
conditional: false;
|
|
292
340
|
} | {
|
|
293
341
|
form: 'one' | 'all';
|
|
294
342
|
node: string;
|
|
@@ -60,6 +60,15 @@
|
|
|
60
60
|
* `RT-R12` holds and this module loads no engine of its own. A witness is not a proof, and a
|
|
61
61
|
* sample that passes is reported as *the sample passed*, never as *fits*.
|
|
62
62
|
*
|
|
63
|
+
* **And a value the CALLER GIVES is not an arc at all** (v0.38,
|
|
64
|
+
* [P37](../../doc/plans/p37-a-runtime-is-its-registry.md) stop-and-ask (d),
|
|
65
|
+
* [W166](../../doc/work-items/w166-a-sample-the-caller-gives.md)): `givenVerdict` runs a task's transform
|
|
66
|
+
* ONCE on what the node RECEIVES — `$`, as given, no `needs` composed over it — and returns ONE verdict of
|
|
67
|
+
* shape `given`, with no producer and the source `'given'`, whatever arcs reach the node and on the ENTRY
|
|
68
|
+
* too. It reads no arrival, so a given value never reaches the record's or the composition's source
|
|
69
|
+
* aggregation (P37 fact 4) — and those are typed over the two sources a SCHEMA supplies, so it cannot.
|
|
70
|
+
* The evaluation is the arcs' own: `judgeTransform` below is the one both roads call.
|
|
71
|
+
*
|
|
63
72
|
* **A GATE's arc carries what reached it REFINED by what its ROUTE guarantees, and a KEY PATH the
|
|
64
73
|
* producer FORBIDS makes that arc `no`** — [ADR 0068](../../doc/decisions/0068-a-route-guarantees-what-its-type-declares-and-the-library-derives-it-from-the-key-path.md)
|
|
65
74
|
* and its refusing half ([W99](../../doc/work-items/w99-what-a-route-guarantees.md),
|
|
@@ -70,19 +79,30 @@
|
|
|
70
79
|
* states, one question over, **and with the same scope: a step the producer REQUIRES is not read as
|
|
71
80
|
* never carried.** That scope is W100's, and it is what made `fits`'s `'is open there'` arm dead.
|
|
72
81
|
*
|
|
82
|
+
* **An ASK is a PRODUCER and never a consumer** (v0.42, [W179](../../doc/work-items/w179-the-ask-node-in-the-definition.md),
|
|
83
|
+
* ADR 0108). What leaves it is the person's ANSWER, so the arc it sends carries its `answerSchema` exactly as a
|
|
84
|
+
* task's carries its worker's `outputSchema` — an edge, a branch's arrival at a join, a `needs` naming it — and an
|
|
85
|
+
* ask declaring none sends an `unchecked` arc naming the ask. What REACHES it is shown to a person and held to no
|
|
86
|
+
* schema (it runs no worker, so it has no `inputSchema`), so an arc into an ask gets no verdict, as an arc into a
|
|
87
|
+
* gate or a join gets none of its own.
|
|
88
|
+
*
|
|
73
89
|
* Pure over data except the one `import()` of an adapter's worker half, which is async and is why
|
|
74
90
|
* `checkWiring` returns a Promise; no `node:` import, no clock (`RT-R3`, `RT-R4`).
|
|
75
91
|
*/
|
|
76
92
|
import { type JsonSchema } from './schema.js';
|
|
77
93
|
import type { Edge, FlowDefinition, GateNode, Registry } from './types.js';
|
|
78
94
|
import { type SampleSource } from './witness.js';
|
|
79
|
-
/**
|
|
80
|
-
|
|
95
|
+
/**
|
|
96
|
+
* The five shapes of *what a node receives* — `FD-C1`, `JP-R11`, `JP-R12` — **and `given`, which is
|
|
97
|
+
* not an arc** (v0.38, W166): the value a caller hands `tryTransform(…, { input })`. `checkWiring` never
|
|
98
|
+
* produces it. **BREAKING in 0.8.0**: a `switch` exhaustive over the five is not exhaustive over six.
|
|
99
|
+
*/
|
|
100
|
+
export type WiringShape = 'edge' | 'branch' | 'item' | 'record' | 'needs' | 'given';
|
|
81
101
|
/** The five verdicts. */
|
|
82
102
|
export type VerdictKind = 'fits' | 'no' | 'transform-passes' | 'transform-fails' | 'unchecked';
|
|
83
103
|
/** The value a transformed arc was verified on, where it came from, and what came out. */
|
|
84
104
|
export interface WiringSample {
|
|
85
|
-
/** Whether the producer side was a declared example or the generator's witness (Q301). */
|
|
105
|
+
/** Whether the producer side was a declared example or the generator's witness (Q301) — or, on a `given` verdict and only there, the value the caller gave (`'given'`, W166). */
|
|
86
106
|
source: SampleSource;
|
|
87
107
|
/** How many branches or items the sample had, where the producer is a region or a map (Q263). */
|
|
88
108
|
arity?: number;
|
|
@@ -95,8 +115,12 @@ export interface WiringVerdict {
|
|
|
95
115
|
/** The task node on the consuming side. */
|
|
96
116
|
consumer: string;
|
|
97
117
|
shape: WiringShape;
|
|
98
|
-
/**
|
|
99
|
-
|
|
118
|
+
/**
|
|
119
|
+
* The task — or, since v0.42, the ask — whose output arrives, the join whose record arrives, or the opener of the region the consumer sits in.
|
|
120
|
+
* **ABSENT on a `given` verdict, and present on every other** (v0.38, W166): a value the caller gave came from no
|
|
121
|
+
* node. **BREAKING in 0.8.0**: this was `string`.
|
|
122
|
+
*/
|
|
123
|
+
producer?: string;
|
|
100
124
|
/** For a `branch` or `item` arc: the fan-out or map the value passed through. */
|
|
101
125
|
through?: string;
|
|
102
126
|
kind: VerdictKind;
|
|
@@ -111,7 +135,7 @@ export interface WiringReport {
|
|
|
111
135
|
/**
|
|
112
136
|
* The tasks the run's PAYLOAD reaches with no worker in between — the entry task, or every branch
|
|
113
137
|
* task of an entry region, recursively. No arc leads to them; `FD-R4` holds the payload to their
|
|
114
|
-
* input schemas at `start()`, once per run.
|
|
138
|
+
* input schemas at `start()`, once per run, except where a task declares a `transform` (ADR 0101, W170).
|
|
115
139
|
*/
|
|
116
140
|
entry: string[];
|
|
117
141
|
}
|
|
@@ -128,7 +152,7 @@ export interface WiringReport {
|
|
|
128
152
|
export type WiringRegistry = Pick<Registry, 'workers' | 'nodeTypes' | 'languages' | 'gateTypes'>;
|
|
129
153
|
/**
|
|
130
154
|
* **Every value `P` admits is accepted by `C`** — P19 fact 3's relation, verbatim in shape, over
|
|
131
|
-
* the twelve constraining keywords (
|
|
155
|
+
* the twelve constraining keywords (the five annotations are read by nothing — `examples`, ADR 0056 rule 1, and `title`, `description`, `readOnly` and `writeOnly`, ADR 0098). `'fits'` or
|
|
132
156
|
* `'no'` with the reason, never a third answer. `path` is where in the two schemas the answer was
|
|
133
157
|
* decided, as `findings` addresses a value.
|
|
134
158
|
*/
|
|
@@ -140,8 +164,10 @@ export declare function fits(P: JsonSchema, C: JsonSchema, path?: string): {
|
|
|
140
164
|
* **The first task(s) a run's payload reaches with no worker in between** — the entry task, or the
|
|
141
165
|
* branch tasks of an entry region, recursively; for a map, one per element of the array the
|
|
142
166
|
* payload carries under `over`. `FD-R4`'s targets at `start()`; the driver composes each value
|
|
143
|
-
* through the node's `needs` (
|
|
144
|
-
*
|
|
167
|
+
* through the node's `needs` (an entry names no NODE, `FD-V27`: what it can carry is `"."` and, since v0.44,
|
|
168
|
+
* `"$payload"` — the payload this walk was handed, P38 (f) — and, since v0.45, `"$item"`: a target inside a map instance
|
|
169
|
+
* is that map's BRANCH ENTRY, so its value IS the instance's item and a `"$item"` key composes it, P38 (i)) and holds it to the
|
|
170
|
+
* task's worker `inputSchema` — the value the node RECEIVES — unless the task declares a `transform` (ADR 0101, W170). ONE walk, two callers — the driver with the payload, and
|
|
145
171
|
* `checkWiring` with none for `WiringReport.entry` (W73's adequacy reader found a second walk
|
|
146
172
|
* beside this one whose map arm nothing bound; there is one walk now, `entryWalk`).
|
|
147
173
|
*
|
|
@@ -178,9 +204,31 @@ export interface WiringOptions {
|
|
|
178
204
|
workerHalf?: Readonly<Record<string, WorkerCompile>>;
|
|
179
205
|
}
|
|
180
206
|
export declare function checkWiring(registry: WiringRegistry, flow: FlowDefinition, options?: WiringOptions): Promise<WiringReport>;
|
|
207
|
+
/**
|
|
208
|
+
* **A value the CALLER GIVES, on one task node: its transform run ONCE on what the node RECEIVES, and ONE
|
|
209
|
+
* verdict** — v0.38, [P37](../../doc/plans/p37-a-runtime-is-its-registry.md) stop-and-ask (d)'s answer,
|
|
210
|
+
* [W166](../../doc/work-items/w166-a-sample-the-caller-gives.md). **PUBLIC SURFACE, new in 0.8.0**: `index.ts`
|
|
211
|
+
* re-exports every name of this module, so it is a root export, stated as one in `spec/flow-definition.md`
|
|
212
|
+
* v0.38 and `AGENTS.md` section 15. It is `tryTransform` on the node as the flow DECLARES it — `tryTransform`
|
|
213
|
+
* calls it on the copy that carries the candidate — and the two have ONE contract.
|
|
214
|
+
*
|
|
215
|
+
* `input` IS `$` — what the node receives, so no `needs` is composed over it and no arc is read: the verdict
|
|
216
|
+
* is the same whatever arcs reach the node, and the ENTRY node — which no arc reaches — gets one too. Its
|
|
217
|
+
* shape is `given`, it has NO `producer` and no `through`, and its sample's source is `'given'` and nothing
|
|
218
|
+
* else. The evaluation and the judgement are the arcs' own (`judgeTransform`): `transform-passes` where the
|
|
219
|
+
* result satisfies the consumer's `inputSchema`, `transform-fails` naming the finding where it does not or the
|
|
220
|
+
* error where the expression throws, `unchecked` for a language, type, worker or consumer schema the registry
|
|
221
|
+
* lacks — and for a node with NO transform, because there is nothing to run the value through: holding one
|
|
222
|
+
* value to a schema is `findings`'s question.
|
|
223
|
+
*
|
|
224
|
+
* **`undefined` is no input** (the spec's table, W166's conformity reader F1): with it the ARCS answer, exactly
|
|
225
|
+
* as `tryTransform` with no input — the node's verdicts from `checkWiring`, and `[]` on the entry. A node id
|
|
226
|
+
* that names no task returns `[]`.
|
|
227
|
+
*/
|
|
228
|
+
export declare function givenVerdict(registry: WiringRegistry, flow: FlowDefinition, nodeId: string, input: unknown, options?: WiringOptions): Promise<WiringVerdict[]>;
|
|
181
229
|
/** One verdict as one line a person reads — the source of a sample always named (Q301). */
|
|
182
230
|
export declare function describeVerdict(v: WiringVerdict): string;
|
|
183
231
|
/** The verdict kinds, enumerated — what a report's `counts` is keyed by, bound to the spec's table by a test. */
|
|
184
232
|
export declare const VERDICT_KINDS: readonly VerdictKind[];
|
|
185
|
-
/** The arc shapes,
|
|
233
|
+
/** The shapes, enumerated — the five arc shapes and `given` (W166), bound to the spec's arc table by a test. */
|
|
186
234
|
export declare const WIRING_SHAPES: readonly WiringShape[];
|
|
@@ -26,14 +26,22 @@
|
|
|
26
26
|
import type { JsonSchema } from './schema.js';
|
|
27
27
|
/** The least value `schema` admits. */
|
|
28
28
|
export declare function witness(schema: JsonSchema, path?: string): unknown;
|
|
29
|
-
/**
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Where a sample came from — the word every verdict built on one carries (Q301). **`'given'` since
|
|
31
|
+
* v0.38** ([P37](../../doc/plans/p37-a-runtime-is-its-registry.md) stop-and-ask (d),
|
|
32
|
+
* [W166](../../doc/work-items/w166-a-sample-the-caller-gives.md)): a value the CALLER handed
|
|
33
|
+
* `tryTransform(…, { input })` as what the node receives — never a schema's, so `sampleOf` below never
|
|
34
|
+
* returns it and an ARC's sample never carries it. **BREAKING in 0.8.0**: this was two values, and a
|
|
35
|
+
* `switch` exhaustive over two is not exhaustive over three.
|
|
36
|
+
*/
|
|
37
|
+
export type SampleSource = 'example' | 'witness' | 'given';
|
|
31
38
|
/**
|
|
32
39
|
* **The value a tool runs on for one schema, and which it was**: the FIRST declared example (ADR
|
|
33
40
|
* 0056 rule 3), else the witness. A schema of `undefined` — a worker that declares none — has no
|
|
34
|
-
* sample; the caller says UNCHECKED rather than inventing one.
|
|
41
|
+
* sample; the caller says UNCHECKED rather than inventing one. **Its source is one of the TWO a schema
|
|
42
|
+
* can supply, typed so** — `'given'` is the caller's and never a schema's (W166).
|
|
35
43
|
*/
|
|
36
44
|
export declare function sampleOf(schema: JsonSchema | undefined): {
|
|
37
45
|
value: unknown;
|
|
38
|
-
source: SampleSource
|
|
46
|
+
source: Exclude<SampleSource, 'given'>;
|
|
39
47
|
} | undefined;
|