@kindgi/flow 0.1.3 → 0.1.4-rc.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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pins.d.ts +57 -0
- package/dist/pins.d.ts.map +1 -0
- package/dist/pins.js +78 -0
- package/dist/pins.js.map +1 -0
- package/dist/types.d.ts +16 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +2 -0
- package/src/pins.ts +117 -0
- package/src/types.ts +17 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export type { BackoffShape, ConvergenceMode, EdgePolicy, Expr, FanoutBranch, Fan
|
|
|
2
2
|
export { CONVERGENCE_MODES, EDGE_POLICY_PRIORITY_DEFAULT, EDGE_POLICY_PRIORITY_MAX, EDGE_POLICY_PRIORITY_MIN, END_NODE, LOOP_END_NODE, LOOP_START_NODE, OPERATORS, SENTINEL_IDS, START_NODE, SUBGRAPH_CONVERGENCE_MODES, isFanoutNode, isLeafNode, isLoopNode, isSubflowNode, } from './types.js';
|
|
3
3
|
export type { CycleError, DuplicateEdgeError, DuplicateNodeError, FlowError, InvalidEdgePolicyError, InvalidFanoutNodeError, InvalidFlowOutputError, InvalidMappingError, InvalidPredicateError, InvalidSubflowNodeError, LoopBodyCycleError, LoopBodyEdgeReferenceError, LoopBodyMissingStartError, LoopConcurrencyError, LoopMaxIterationsError, LoopOutputSchemaError, LoopVariantMismatchError, MissingStartEdgeError, ReservedIdError, SchemaValidationError, UnknownNodeReferenceError, } from './errors.js';
|
|
4
4
|
export { GRAPH_SCHEMA_URI, loadFlow } from './loader.js';
|
|
5
|
+
export { flowPinsDigest, flowRefs, withVersions } from './pins.js';
|
|
6
|
+
export type { FlowPins, FlowRefs, FlowVersionOverrides } from './pins.js';
|
|
5
7
|
export { defineFlow } from './define.js';
|
|
6
8
|
export type { FlowSpec } from './define.js';
|
|
7
9
|
export { evaluateExpr, MISSING_PATH, resolveMapping, resolvePath } from './evaluator.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,YAAY,EACZ,eAAe,EACf,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"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C,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzF,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
3
|
export { CONVERGENCE_MODES, EDGE_POLICY_PRIORITY_DEFAULT, EDGE_POLICY_PRIORITY_MAX, EDGE_POLICY_PRIORITY_MIN, END_NODE, LOOP_END_NODE, LOOP_START_NODE, OPERATORS, SENTINEL_IDS, START_NODE, SUBGRAPH_CONVERGENCE_MODES, isFanoutNode, isLeafNode, isLoopNode, isSubflowNode, } from './types.js';
|
|
4
4
|
export { GRAPH_SCHEMA_URI, loadFlow } from './loader.js';
|
|
5
|
+
export { flowPinsDigest, flowRefs, withVersions } from './pins.js';
|
|
5
6
|
export { defineFlow } from './define.js';
|
|
6
7
|
export { evaluateExpr, MISSING_PATH, resolveMapping, resolvePath } from './evaluator.js';
|
|
7
8
|
export { getEffectivePriority, schedulerTick } from './scheduler.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAgCjC,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC;AA0BpB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAgCjC,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,QAAQ,EACR,aAAa,EACb,eAAe,EACf,SAAS,EACT,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC;AA0BpB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGzF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/pins.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Flow } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The exact version of each block a flow version runs: its lockfile.
|
|
4
|
+
*
|
|
5
|
+
* A flow names its tools by id (a tool node's `ref`, a fanout branch's
|
|
6
|
+
* `handler`) and its agents by id, with an exact `config.version` or
|
|
7
|
+
* none. When a version of the flow is published, the runtime pins each
|
|
8
|
+
* tool, and each agent that names no version, to its latest version
|
|
9
|
+
* then, and every run of that flow version uses those versions. So a
|
|
10
|
+
* new tool or agent version reaches the flow only through a new flow
|
|
11
|
+
* version.
|
|
12
|
+
*
|
|
13
|
+
* Set by the runtime at publish, never authored. A flow version
|
|
14
|
+
* published before pins existed has none and binds the latest versions
|
|
15
|
+
* per run.
|
|
16
|
+
*/
|
|
17
|
+
export interface FlowPins {
|
|
18
|
+
/** Tool id → the exact version this flow version runs. */
|
|
19
|
+
readonly tools: Readonly<Record<string, string>>;
|
|
20
|
+
/** Agent id → the exact version its agent nodes that name none run. */
|
|
21
|
+
readonly agents: Readonly<Record<string, string>>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `sha256:<hex>` of a flow version's pins' canonical JSON (keys sorted,
|
|
25
|
+
* no whitespace), as `pinsDigest` in `@kindgi/agents` is for an agent's.
|
|
26
|
+
*/
|
|
27
|
+
export declare function flowPinsDigest(pins: FlowPins): string;
|
|
28
|
+
/** The blocks a flow runs that its pins name: tool ids, and agent ids with no version. */
|
|
29
|
+
export interface FlowRefs {
|
|
30
|
+
readonly tools: readonly string[];
|
|
31
|
+
readonly agents: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every tool a flow runs (tool nodes and fanout branches, in loop bodies
|
|
35
|
+
* too: what the runtime binds) and every agent it runs at no named
|
|
36
|
+
* version, each id once, sorted.
|
|
37
|
+
*/
|
|
38
|
+
export declare function flowRefs(flow: Flow): FlowRefs;
|
|
39
|
+
/** Exact versions to run a flow version with, over its pins: the shape of a comparison's override. */
|
|
40
|
+
export interface FlowVersionOverrides {
|
|
41
|
+
readonly tools?: Readonly<Record<string, string>>;
|
|
42
|
+
readonly agents?: Readonly<Record<string, string>>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The flow version with some of its blocks run at other exact versions,
|
|
46
|
+
* without publishing a new flow version: what a comparison or a replay
|
|
47
|
+
* runs ("this flow, but `acme.scorer` at 0.4.0").
|
|
48
|
+
*
|
|
49
|
+
* One mechanism with the pins: the overrides go into `pins` (over the
|
|
50
|
+
* version's own), and an agent node that names its own `config.version`
|
|
51
|
+
* gets the override there too, since a node's own version wins over a
|
|
52
|
+
* pin. `pinsDigest` is recomputed, so it names what runs. A flow version
|
|
53
|
+
* published before pins gets pins of the overrides only; its other
|
|
54
|
+
* blocks bind their latest versions, as before.
|
|
55
|
+
*/
|
|
56
|
+
export declare function withVersions(flow: Flow, overrides: FlowVersionOverrides): Flow;
|
|
57
|
+
//# sourceMappingURL=pins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pins.d.ts","sourceRoot":"","sources":["../src/pins.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,IAAI,EAA2C,MAAM,YAAY,CAAC;AAEhF;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,QAAQ;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACnD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAGrD;AAED,0FAA0F;AAC1F,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,QAAQ,CAK7C;AAWD,sGAAsG;AACtG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAY9E"}
|
package/dist/pins.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { canonicalize } from '@kindgi/schema';
|
|
5
|
+
import { isFanoutNode, isLoopNode } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* `sha256:<hex>` of a flow version's pins' canonical JSON (keys sorted,
|
|
8
|
+
* no whitespace), as `pinsDigest` in `@kindgi/agents` is for an agent's.
|
|
9
|
+
*/
|
|
10
|
+
export function flowPinsDigest(pins) {
|
|
11
|
+
const canonical = canonicalize({ tools: pins.tools, agents: pins.agents });
|
|
12
|
+
return `sha256:${createHash('sha256').update(canonical, 'utf8').digest('hex')}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Every tool a flow runs (tool nodes and fanout branches, in loop bodies
|
|
16
|
+
* too: what the runtime binds) and every agent it runs at no named
|
|
17
|
+
* version, each id once, sorted.
|
|
18
|
+
*/
|
|
19
|
+
export function flowRefs(flow) {
|
|
20
|
+
const tools = new Set();
|
|
21
|
+
const agents = new Set();
|
|
22
|
+
collectRefs(flow.nodes, tools, agents);
|
|
23
|
+
return { tools: [...tools].sort(), agents: [...agents].sort() };
|
|
24
|
+
}
|
|
25
|
+
function collectRefs(nodes, tools, agents) {
|
|
26
|
+
for (const node of nodes) {
|
|
27
|
+
if (isLoopNode(node))
|
|
28
|
+
collectRefs(node.body.nodes, tools, agents);
|
|
29
|
+
else if (isFanoutNode(node))
|
|
30
|
+
for (const branch of node.branches)
|
|
31
|
+
tools.add(branch.handler);
|
|
32
|
+
else if (node.kind === 'tool')
|
|
33
|
+
tools.add(node.ref);
|
|
34
|
+
else if (node.kind === 'agent' && node.config?.version === undefined)
|
|
35
|
+
agents.add(node.ref);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The flow version with some of its blocks run at other exact versions,
|
|
40
|
+
* without publishing a new flow version: what a comparison or a replay
|
|
41
|
+
* runs ("this flow, but `acme.scorer` at 0.4.0").
|
|
42
|
+
*
|
|
43
|
+
* One mechanism with the pins: the overrides go into `pins` (over the
|
|
44
|
+
* version's own), and an agent node that names its own `config.version`
|
|
45
|
+
* gets the override there too, since a node's own version wins over a
|
|
46
|
+
* pin. `pinsDigest` is recomputed, so it names what runs. A flow version
|
|
47
|
+
* published before pins gets pins of the overrides only; its other
|
|
48
|
+
* blocks bind their latest versions, as before.
|
|
49
|
+
*/
|
|
50
|
+
export function withVersions(flow, overrides) {
|
|
51
|
+
const pins = {
|
|
52
|
+
tools: { ...(flow.pins?.tools ?? {}), ...(overrides.tools ?? {}) },
|
|
53
|
+
agents: { ...(flow.pins?.agents ?? {}), ...(overrides.agents ?? {}) },
|
|
54
|
+
};
|
|
55
|
+
const agents = overrides.agents ?? {};
|
|
56
|
+
return {
|
|
57
|
+
...flow,
|
|
58
|
+
nodes: overrideNamedAgentVersions(flow.nodes, agents),
|
|
59
|
+
pins,
|
|
60
|
+
pinsDigest: flowPinsDigest(pins),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function overrideNamedAgentVersions(nodes, agents) {
|
|
64
|
+
return nodes.map((node) => {
|
|
65
|
+
if (isLoopNode(node)) {
|
|
66
|
+
return {
|
|
67
|
+
...node,
|
|
68
|
+
body: { ...node.body, nodes: overrideNamedAgentVersions(node.body.nodes, agents) },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const version = node.kind === 'agent' ? agents[node.ref] : undefined;
|
|
72
|
+
if (node.kind !== 'agent' || version === undefined || node.config?.version === undefined) {
|
|
73
|
+
return node;
|
|
74
|
+
}
|
|
75
|
+
return { ...node, config: { ...node.config, version } };
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=pins.js.map
|
package/dist/pins.js.map
ADDED
|
@@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AE,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE;aACnF,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;YACzF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EdgeId, FlowId, NodeId } from '@kindgi/types';
|
|
1
|
+
import type { EdgeId, FlowId, NodeId, VersionDerivation } from '@kindgi/types';
|
|
2
|
+
import type { FlowPins } from './pins.js';
|
|
2
3
|
/**
|
|
3
4
|
* Path roots addressable in edge predicates.
|
|
4
5
|
*
|
|
@@ -751,6 +752,20 @@ export interface Flow {
|
|
|
751
752
|
* `$end` edge (the lowest-id taken one when several fire).
|
|
752
753
|
*/
|
|
753
754
|
readonly output?: FlowOutputSpec;
|
|
755
|
+
/**
|
|
756
|
+
* The exact tool and agent versions this flow version runs, resolved by
|
|
757
|
+
* the runtime when the version was published (see `FlowPins`). Never
|
|
758
|
+
* authored: `loadFlow` refuses it. Absent on a flow version published
|
|
759
|
+
* before pins existed; it binds the latest versions per run.
|
|
760
|
+
*/
|
|
761
|
+
readonly pins?: FlowPins;
|
|
762
|
+
/** `flowPinsDigest(pins)`, recorded when the version was published. */
|
|
763
|
+
readonly pinsDigest?: string;
|
|
764
|
+
/**
|
|
765
|
+
* Set by the runtime on a version a deploy registered under another
|
|
766
|
+
* number than the definition's (see `VersionDerivation`). Never authored.
|
|
767
|
+
*/
|
|
768
|
+
readonly derivedFrom?: VersionDerivation;
|
|
754
769
|
}
|
|
755
770
|
/**
|
|
756
771
|
* A flow's declared output: what the run returns, built from the
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,OAAO,GACP,eAAe,MAAM,EAAE,GACvB,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG,WAAW,CAAC;AAEnD;;;;;;;;;GASG;AACH,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAExD;;;;;;;;GAQ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"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAmGjC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,OAAO;IACP,KAAK;IACL,IAAI;IACJ,KAAK;CACG,CAAC;AA+MX;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AA2FvF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,cAAc,EAAE,YAAY,CAAU,CAAC;AAuQlF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAY,CAAC;AACtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAY,CAAC;AACrD,iEAAiE;AACjE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAU,CAAC;AA2IvD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,QAAiB,CAAC;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAe,CAAC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAsB,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,WAAoB,CAAC;AAElD,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,CAAU,CAAC;AAE5F,4CAA4C;AAC5C,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;AAC9B,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AAChC,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,aAAa,CAAC,IAAc;IAC1C,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;AAClC,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;AACpF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kindgi/flow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4-rc.0",
|
|
4
4
|
"description": "Flow model + predicate DSL for Kindgi™. Defines the task-flow shape (nodes, edges, conditional edges, data-flow mappings) executed by the kernel. Pure — no I/O, no database, no runtime. Ships types, a JSON-schema-validated loader (loadFlow / defineFlow), a predicate evaluator and mapping resolver (evaluateExpr / resolveMapping), and the scheduler tick (schedulerTick) the kernel uses to pick the nodes ready for concurrent execution.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"type-manifest.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@kindgi/schema": "0.1.
|
|
34
|
-
"@kindgi/types": "0.1.
|
|
33
|
+
"@kindgi/schema": "0.1.4-rc.0",
|
|
34
|
+
"@kindgi/types": "0.1.4-rc.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@kindgi/specs": "0.1.
|
|
37
|
+
"@kindgi/specs": "0.1.4-rc.0",
|
|
38
38
|
"@types/node": "^22.10.5",
|
|
39
39
|
"typescript": "^5.7.3",
|
|
40
40
|
"vitest": "^2.1.8"
|
package/src/index.ts
CHANGED
|
@@ -74,6 +74,8 @@ export type {
|
|
|
74
74
|
} from './errors.js';
|
|
75
75
|
|
|
76
76
|
export { GRAPH_SCHEMA_URI, loadFlow } from './loader.js';
|
|
77
|
+
export { flowPinsDigest, flowRefs, withVersions } from './pins.js';
|
|
78
|
+
export type { FlowPins, FlowRefs, FlowVersionOverrides } from './pins.js';
|
|
77
79
|
|
|
78
80
|
export { defineFlow } from './define.js';
|
|
79
81
|
export type { FlowSpec } from './define.js';
|
package/src/pins.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
|
|
4
|
+
import { createHash } from 'node:crypto';
|
|
5
|
+
|
|
6
|
+
import { canonicalize } from '@kindgi/schema';
|
|
7
|
+
|
|
8
|
+
import { type Flow, type FlowNode, isFanoutNode, isLoopNode } from './types.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The exact version of each block a flow version runs: its lockfile.
|
|
12
|
+
*
|
|
13
|
+
* A flow names its tools by id (a tool node's `ref`, a fanout branch's
|
|
14
|
+
* `handler`) and its agents by id, with an exact `config.version` or
|
|
15
|
+
* none. When a version of the flow is published, the runtime pins each
|
|
16
|
+
* tool, and each agent that names no version, to its latest version
|
|
17
|
+
* then, and every run of that flow version uses those versions. So a
|
|
18
|
+
* new tool or agent version reaches the flow only through a new flow
|
|
19
|
+
* version.
|
|
20
|
+
*
|
|
21
|
+
* Set by the runtime at publish, never authored. A flow version
|
|
22
|
+
* published before pins existed has none and binds the latest versions
|
|
23
|
+
* per run.
|
|
24
|
+
*/
|
|
25
|
+
export interface FlowPins {
|
|
26
|
+
/** Tool id → the exact version this flow version runs. */
|
|
27
|
+
readonly tools: Readonly<Record<string, string>>;
|
|
28
|
+
/** Agent id → the exact version its agent nodes that name none run. */
|
|
29
|
+
readonly agents: Readonly<Record<string, string>>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `sha256:<hex>` of a flow version's pins' canonical JSON (keys sorted,
|
|
34
|
+
* no whitespace), as `pinsDigest` in `@kindgi/agents` is for an agent's.
|
|
35
|
+
*/
|
|
36
|
+
export function flowPinsDigest(pins: FlowPins): string {
|
|
37
|
+
const canonical = canonicalize({ tools: pins.tools, agents: pins.agents });
|
|
38
|
+
return `sha256:${createHash('sha256').update(canonical, 'utf8').digest('hex')}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The blocks a flow runs that its pins name: tool ids, and agent ids with no version. */
|
|
42
|
+
export interface FlowRefs {
|
|
43
|
+
readonly tools: readonly string[];
|
|
44
|
+
readonly agents: readonly string[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Every tool a flow runs (tool nodes and fanout branches, in loop bodies
|
|
49
|
+
* too: what the runtime binds) and every agent it runs at no named
|
|
50
|
+
* version, each id once, sorted.
|
|
51
|
+
*/
|
|
52
|
+
export function flowRefs(flow: Flow): FlowRefs {
|
|
53
|
+
const tools = new Set<string>();
|
|
54
|
+
const agents = new Set<string>();
|
|
55
|
+
collectRefs(flow.nodes, tools, agents);
|
|
56
|
+
return { tools: [...tools].sort(), agents: [...agents].sort() };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function collectRefs(nodes: readonly FlowNode[], tools: Set<string>, agents: Set<string>): void {
|
|
60
|
+
for (const node of nodes) {
|
|
61
|
+
if (isLoopNode(node)) collectRefs(node.body.nodes, tools, agents);
|
|
62
|
+
else if (isFanoutNode(node)) for (const branch of node.branches) tools.add(branch.handler);
|
|
63
|
+
else if (node.kind === 'tool') tools.add(node.ref);
|
|
64
|
+
else if (node.kind === 'agent' && node.config?.version === undefined) agents.add(node.ref);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Exact versions to run a flow version with, over its pins: the shape of a comparison's override. */
|
|
69
|
+
export interface FlowVersionOverrides {
|
|
70
|
+
readonly tools?: Readonly<Record<string, string>>;
|
|
71
|
+
readonly agents?: Readonly<Record<string, string>>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The flow version with some of its blocks run at other exact versions,
|
|
76
|
+
* without publishing a new flow version: what a comparison or a replay
|
|
77
|
+
* runs ("this flow, but `acme.scorer` at 0.4.0").
|
|
78
|
+
*
|
|
79
|
+
* One mechanism with the pins: the overrides go into `pins` (over the
|
|
80
|
+
* version's own), and an agent node that names its own `config.version`
|
|
81
|
+
* gets the override there too, since a node's own version wins over a
|
|
82
|
+
* pin. `pinsDigest` is recomputed, so it names what runs. A flow version
|
|
83
|
+
* published before pins gets pins of the overrides only; its other
|
|
84
|
+
* blocks bind their latest versions, as before.
|
|
85
|
+
*/
|
|
86
|
+
export function withVersions(flow: Flow, overrides: FlowVersionOverrides): Flow {
|
|
87
|
+
const pins: FlowPins = {
|
|
88
|
+
tools: { ...(flow.pins?.tools ?? {}), ...(overrides.tools ?? {}) },
|
|
89
|
+
agents: { ...(flow.pins?.agents ?? {}), ...(overrides.agents ?? {}) },
|
|
90
|
+
};
|
|
91
|
+
const agents = overrides.agents ?? {};
|
|
92
|
+
return {
|
|
93
|
+
...flow,
|
|
94
|
+
nodes: overrideNamedAgentVersions(flow.nodes, agents),
|
|
95
|
+
pins,
|
|
96
|
+
pinsDigest: flowPinsDigest(pins),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function overrideNamedAgentVersions(
|
|
101
|
+
nodes: readonly FlowNode[],
|
|
102
|
+
agents: Readonly<Record<string, string>>,
|
|
103
|
+
): readonly FlowNode[] {
|
|
104
|
+
return nodes.map((node) => {
|
|
105
|
+
if (isLoopNode(node)) {
|
|
106
|
+
return {
|
|
107
|
+
...node,
|
|
108
|
+
body: { ...node.body, nodes: overrideNamedAgentVersions(node.body.nodes, agents) },
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const version = node.kind === 'agent' ? agents[node.ref] : undefined;
|
|
112
|
+
if (node.kind !== 'agent' || version === undefined || node.config?.version === undefined) {
|
|
113
|
+
return node;
|
|
114
|
+
}
|
|
115
|
+
return { ...node, config: { ...node.config, version } };
|
|
116
|
+
});
|
|
117
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
3
|
|
|
4
|
-
import type { EdgeId, FlowId, NodeId } from '@kindgi/types';
|
|
4
|
+
import type { EdgeId, FlowId, NodeId, VersionDerivation } from '@kindgi/types';
|
|
5
|
+
|
|
6
|
+
import type { FlowPins } from './pins.js';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Path roots addressable in edge predicates.
|
|
@@ -799,6 +801,20 @@ export interface Flow {
|
|
|
799
801
|
* `$end` edge (the lowest-id taken one when several fire).
|
|
800
802
|
*/
|
|
801
803
|
readonly output?: FlowOutputSpec;
|
|
804
|
+
/**
|
|
805
|
+
* The exact tool and agent versions this flow version runs, resolved by
|
|
806
|
+
* the runtime when the version was published (see `FlowPins`). Never
|
|
807
|
+
* authored: `loadFlow` refuses it. Absent on a flow version published
|
|
808
|
+
* before pins existed; it binds the latest versions per run.
|
|
809
|
+
*/
|
|
810
|
+
readonly pins?: FlowPins;
|
|
811
|
+
/** `flowPinsDigest(pins)`, recorded when the version was published. */
|
|
812
|
+
readonly pinsDigest?: string;
|
|
813
|
+
/**
|
|
814
|
+
* Set by the runtime on a version a deploy registered under another
|
|
815
|
+
* number than the definition's (see `VersionDerivation`). Never authored.
|
|
816
|
+
*/
|
|
817
|
+
readonly derivedFrom?: VersionDerivation;
|
|
802
818
|
}
|
|
803
819
|
|
|
804
820
|
/**
|