@smthrs/plan 1.0.0-rc.8 → 1.0.0-rc.9
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/cjs/Effects.d.ts +29 -11
- package/dist/cjs/Effects.d.ts.map +1 -1
- package/dist/cjs/Effects.js.map +2 -2
- package/dist/cjs/FileSet.d.ts +121 -51
- package/dist/cjs/FileSet.d.ts.map +1 -1
- package/dist/cjs/FileSet.js.map +2 -2
- package/dist/cjs/GraphBuildError.d.ts +2 -4
- package/dist/cjs/GraphBuildError.d.ts.map +1 -1
- package/dist/cjs/GraphBuildError.js.map +2 -2
- package/dist/cjs/KeyMaterial.d.ts +13 -8
- package/dist/cjs/KeyMaterial.d.ts.map +1 -1
- package/dist/cjs/KeyMaterial.js.map +2 -2
- package/dist/cjs/Plan.d.ts +72 -23
- package/dist/cjs/Plan.d.ts.map +1 -1
- package/dist/cjs/Plan.js +3 -0
- package/dist/cjs/Plan.js.map +2 -2
- package/dist/cjs/PlanDiff.d.ts +7 -3
- package/dist/cjs/PlanDiff.d.ts.map +1 -1
- package/dist/cjs/PlanDiff.js.map +2 -2
- package/dist/cjs/StepKey.d.ts +38 -17
- package/dist/cjs/StepKey.d.ts.map +1 -1
- package/dist/cjs/StepKey.js.map +2 -2
- package/dist/esm/Effects.d.ts +29 -11
- package/dist/esm/Effects.d.ts.map +1 -1
- package/dist/esm/Effects.js +18 -7
- package/dist/esm/Effects.js.map +1 -1
- package/dist/esm/FileSet.d.ts +121 -51
- package/dist/esm/FileSet.d.ts.map +1 -1
- package/dist/esm/FileSet.js +97 -35
- package/dist/esm/FileSet.js.map +1 -1
- package/dist/esm/GraphBuildError.d.ts +2 -4
- package/dist/esm/GraphBuildError.d.ts.map +1 -1
- package/dist/esm/GraphBuildError.js +2 -3
- package/dist/esm/GraphBuildError.js.map +1 -1
- package/dist/esm/KeyMaterial.d.ts +13 -8
- package/dist/esm/KeyMaterial.d.ts.map +1 -1
- package/dist/esm/KeyMaterial.js +11 -4
- package/dist/esm/KeyMaterial.js.map +1 -1
- package/dist/esm/Plan.d.ts +72 -23
- package/dist/esm/Plan.d.ts.map +1 -1
- package/dist/esm/Plan.js +61 -16
- package/dist/esm/Plan.js.map +1 -1
- package/dist/esm/PlanDiff.d.ts +7 -3
- package/dist/esm/PlanDiff.d.ts.map +1 -1
- package/dist/esm/PlanDiff.js +0 -1
- package/dist/esm/PlanDiff.js.map +1 -1
- package/dist/esm/StepKey.d.ts +38 -17
- package/dist/esm/StepKey.d.ts.map +1 -1
- package/dist/esm/StepKey.js +33 -11
- package/dist/esm/StepKey.js.map +1 -1
- package/docs/guides/diff-two-plans.md +78 -1
- package/package.json +4 -4
- package/src/Effects.ts +29 -11
- package/src/FileSet.ts +121 -51
- package/src/GraphBuildError.ts +2 -4
- package/src/KeyMaterial.ts +13 -8
- package/src/Plan.ts +66 -23
- package/src/PlanDiff.ts +7 -3
- package/src/StepKey.ts +38 -17
|
@@ -68,7 +68,6 @@ import * as Schema from "effect/Schema";
|
|
|
68
68
|
*
|
|
69
69
|
* @since 0.1.0
|
|
70
70
|
* @category schemas
|
|
71
|
-
* @slop
|
|
72
71
|
*/
|
|
73
72
|
export declare const GraphBuildErrorCode: Schema.Literals<readonly ["planned_value_computed", "invalid_all_member", "invalid_join", "invalid_continuation", "recursion_requires_boundary", "placement_requires_boundary", "cyclic_payload", "payload_too_deep", "graph_too_deep", "duplicate_node", "invalid_priority", "invalid_payload", "unstable_callback", "effect_outside_envelope", "effect_mode_widening", "effect_tier_widening", "capability_outside_grant", "write_conflict", "missing_key_material", "dependency_cycle", "plan_too_large", "payload_too_large", "invalid_node"]>;
|
|
74
73
|
/**
|
|
@@ -76,7 +75,6 @@ export declare const GraphBuildErrorCode: Schema.Literals<readonly ["planned_val
|
|
|
76
75
|
*
|
|
77
76
|
* @since 0.1.0
|
|
78
77
|
* @category models
|
|
79
|
-
* @slop
|
|
80
78
|
*/
|
|
81
79
|
export type GraphBuildErrorCode = typeof GraphBuildErrorCode.Type;
|
|
82
80
|
declare const GraphBuildError_base: Schema.Class<GraphBuildError, Schema.TaggedStruct<"@smthrs/plan/GraphBuildError", {
|
|
@@ -102,7 +100,6 @@ declare const GraphBuildError_base: Schema.Class<GraphBuildError, Schema.TaggedS
|
|
|
102
100
|
*
|
|
103
101
|
* @since 0.1.0
|
|
104
102
|
* @category errors
|
|
105
|
-
* @slop
|
|
106
103
|
*/
|
|
107
104
|
export declare class GraphBuildError extends GraphBuildError_base {
|
|
108
105
|
}
|
|
@@ -113,9 +110,10 @@ export declare class GraphBuildError extends GraphBuildError_base {
|
|
|
113
110
|
* written, so the drafts are withheld. An advisory one reports a narrowing the
|
|
114
111
|
* author should see while the graph still compiles.
|
|
115
112
|
*
|
|
113
|
+
* @param diagnostic - A recorded refusal.
|
|
114
|
+
* @returns `false` only for an advisory code (`capability_outside_grant`).
|
|
116
115
|
* @since 0.1.0
|
|
117
116
|
* @category predicates
|
|
118
|
-
* @slop
|
|
119
117
|
*/
|
|
120
118
|
export declare const isFatalDiagnostic: (diagnostic: GraphBuildError) => boolean;
|
|
121
119
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphBuildError.d.ts","sourceRoot":"","sources":["../../src/GraphBuildError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC
|
|
1
|
+
{"version":3,"file":"GraphBuildError.d.ts","sourceRoot":"","sources":["../../src/GraphBuildError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,mBAAmB,ohBAwB9B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAA;;;;;;;AAEjE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,eAAgB,SAAQ,oBAKnC;CAAG;AAaL;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAAI,YAAY,eAAe,KAAG,OAA8C,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/GraphBuildError.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The refusals a plan-time build raises instead of producing a wrong plan.\n *\n * Every one of these fails LOUDLY at build time: a planned value that was computed on must not\n * bake `NaN` into a plan, an arm that returned something other than a node must\n * not silently vanish from the topology, and a recursive `.call()` must direct\n * the author to `.to()` or `.child()` rather than expanding forever. Each\n * failure therefore names the site (`node` plus the recorded property `path`)\n * and states the fix in `message`, because the author reading it is mid-body\n * and needs the correction, not a classification.\n *\n * The codes are a closed schema literal so a caller can switch on them, and so\n * a new refusal is a deliberate addition rather than a new free-form string.\n *\n * @since 0.1.0\n */\n\nimport * as Schema from \"effect/Schema\"\n\n/**\n * The stable code of a build refusal.\n *\n * `planned_value_computed` is a body computing on a step result;\n * `invalid_all_member` is a non-node handed to {@link module:Node.all};\n * `invalid_join` is a race, any, or quorum with a non-node member, no members,\n * or a quorum count its members cannot reach;\n * `invalid_continuation` is a branch arm or continuation that did not return a\n * node; `recursion_requires_boundary` is a flow calling itself inline, which\n * has to become a trampoline handoff or an explicit child boundary;\n * `placement_requires_boundary` is an inline call whose callee declares a\n * placement the enclosing flow cannot satisfy, which has to become that same\n * explicit child boundary; `cyclic_payload` is a payload that contains itself,\n * which no plan could serialize or hash; `payload_too_deep` is a payload\n * nested past the build bound, which has to be flattened into shallower data;\n * `graph_too_deep` is authored topology nested past the build bound, which\n * has to be split with `.child()` boundaries or trampoline handoffs;\n * `duplicate_node` is two structural graph addresses resolving to one durable\n * node id;\n * `invalid_priority` is a scheduling priority that is not a safe integer,\n * which no ordering could compare; `invalid_payload` is a payload member that\n * cannot be captured as inert JSON without executing author code or losing\n * identity; `unstable_callback` is a function with process-local identity in a\n * graph that requires stable callbacks. Declare its complete inert captures\n * with `Node.capture`, including semantic implementation versions. The two\n * depth refusals exist because graph building walks with an explicit stack\n * and refuses at a bound, rather than recursing until the native stack\n * overflows without a typed error.\n *\n * The four effect-authority refusals are raised when a declaration claims more\n * than the declaration enclosing it granted:\n * `effect_outside_envelope` is a read or write path the envelope does not\n * cover, and it names those paths in `path`; `effect_mode_widening` is an\n * `expected` declaration inside a `hermetic` envelope; `effect_tier_widening`\n * is a tier less reversible than the envelope's; and\n * `capability_outside_grant` is a called flow or action requiring a capability\n * the caller does not hold, which names the dropped capabilities in `path`. The\n * first three are fatal by {@link isFatalDiagnostic}; the fourth is advisory,\n * because dropping a capability narrows authority rather than widening it.\n *\n * The last six are raised by `@smthrs/core`'s graph builder, which uses this\n * one error rather than a second class of its own. `write_conflict` is two work\n * nodes overlapping under `onConflict: \"fail\"`, and `node` names the first of\n * the pair while `Graph.conflicts` carries both; `missing_key_material` is a\n * node that reached key compilation without any; `dependency_cycle` is a\n * dependency set that cannot be ordered, and `node` names a node in the cycle;\n * `plan_too_large` is a node, edge, conflict, or effect-path limit crossed, and\n * `node` names the node whose admission crossed it; `payload_too_large` is a\n * plan value with more members than the bound, and `path` names the offending\n * value path; `invalid_node` is a malformed node AST. All six are fatal.\n *\n * @since 0.1.0\n * @category schemas\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,aAAwB;
|
|
4
|
+
"sourcesContent": ["/**\n * The refusals a plan-time build raises instead of producing a wrong plan.\n *\n * Every one of these fails LOUDLY at build time: a planned value that was computed on must not\n * bake `NaN` into a plan, an arm that returned something other than a node must\n * not silently vanish from the topology, and a recursive `.call()` must direct\n * the author to `.to()` or `.child()` rather than expanding forever. Each\n * failure therefore names the site (`node` plus the recorded property `path`)\n * and states the fix in `message`, because the author reading it is mid-body\n * and needs the correction, not a classification.\n *\n * The codes are a closed schema literal so a caller can switch on them, and so\n * a new refusal is a deliberate addition rather than a new free-form string.\n *\n * @since 0.1.0\n */\n\nimport * as Schema from \"effect/Schema\"\n\n/**\n * The stable code of a build refusal.\n *\n * `planned_value_computed` is a body computing on a step result;\n * `invalid_all_member` is a non-node handed to {@link module:Node.all};\n * `invalid_join` is a race, any, or quorum with a non-node member, no members,\n * or a quorum count its members cannot reach;\n * `invalid_continuation` is a branch arm or continuation that did not return a\n * node; `recursion_requires_boundary` is a flow calling itself inline, which\n * has to become a trampoline handoff or an explicit child boundary;\n * `placement_requires_boundary` is an inline call whose callee declares a\n * placement the enclosing flow cannot satisfy, which has to become that same\n * explicit child boundary; `cyclic_payload` is a payload that contains itself,\n * which no plan could serialize or hash; `payload_too_deep` is a payload\n * nested past the build bound, which has to be flattened into shallower data;\n * `graph_too_deep` is authored topology nested past the build bound, which\n * has to be split with `.child()` boundaries or trampoline handoffs;\n * `duplicate_node` is two structural graph addresses resolving to one durable\n * node id;\n * `invalid_priority` is a scheduling priority that is not a safe integer,\n * which no ordering could compare; `invalid_payload` is a payload member that\n * cannot be captured as inert JSON without executing author code or losing\n * identity; `unstable_callback` is a function with process-local identity in a\n * graph that requires stable callbacks. Declare its complete inert captures\n * with `Node.capture`, including semantic implementation versions. The two\n * depth refusals exist because graph building walks with an explicit stack\n * and refuses at a bound, rather than recursing until the native stack\n * overflows without a typed error.\n *\n * The four effect-authority refusals are raised when a declaration claims more\n * than the declaration enclosing it granted:\n * `effect_outside_envelope` is a read or write path the envelope does not\n * cover, and it names those paths in `path`; `effect_mode_widening` is an\n * `expected` declaration inside a `hermetic` envelope; `effect_tier_widening`\n * is a tier less reversible than the envelope's; and\n * `capability_outside_grant` is a called flow or action requiring a capability\n * the caller does not hold, which names the dropped capabilities in `path`. The\n * first three are fatal by {@link isFatalDiagnostic}; the fourth is advisory,\n * because dropping a capability narrows authority rather than widening it.\n *\n * The last six are raised by `@smthrs/core`'s graph builder, which uses this\n * one error rather than a second class of its own. `write_conflict` is two work\n * nodes overlapping under `onConflict: \"fail\"`, and `node` names the first of\n * the pair while `Graph.conflicts` carries both; `missing_key_material` is a\n * node that reached key compilation without any; `dependency_cycle` is a\n * dependency set that cannot be ordered, and `node` names a node in the cycle;\n * `plan_too_large` is a node, edge, conflict, or effect-path limit crossed, and\n * `node` names the node whose admission crossed it; `payload_too_large` is a\n * plan value with more members than the bound, and `path` names the offending\n * value path; `invalid_node` is a malformed node AST. All six are fatal.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const GraphBuildErrorCode = Schema.Literals([\n \"planned_value_computed\",\n \"invalid_all_member\",\n \"invalid_join\",\n \"invalid_continuation\",\n \"recursion_requires_boundary\",\n \"placement_requires_boundary\",\n \"cyclic_payload\",\n \"payload_too_deep\",\n \"graph_too_deep\",\n \"duplicate_node\",\n \"invalid_priority\",\n \"invalid_payload\",\n \"unstable_callback\",\n \"effect_outside_envelope\",\n \"effect_mode_widening\",\n \"effect_tier_widening\",\n \"capability_outside_grant\",\n \"write_conflict\",\n \"missing_key_material\",\n \"dependency_cycle\",\n \"plan_too_large\",\n \"payload_too_large\",\n \"invalid_node\"\n])\n\n/**\n * The value form of {@link GraphBuildErrorCode}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type GraphBuildErrorCode = typeof GraphBuildErrorCode.Type\n\n/**\n * A build the planner refuses, naming the site and the fix.\n *\n * `node` is the node reference the failure belongs to \u2014 a planned value's\n * origin node, an `all` member name, a branch arm, or the node whose admission\n * crossed a bound. `path` is the property path recorded on a planned value\n * before it was misused, the effect paths an over-claiming declaration named,\n * the capabilities a call lost, or the value path of an oversized payload; it\n * is empty for every other code.\n *\n * This is the ONE build refusal. `@smthrs/core`'s graph builder raised a second\n * `GraphBuildError` of its own, with `paths`, `nodeId` and `nodes` in place of\n * these fields, and the two code sets diverged instead of merging. A conflict's\n * second node is read from `Graph.conflicts`, which carries the pair.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class GraphBuildError extends Schema.TaggedError<GraphBuildError>()(\"@smthrs/plan/GraphBuildError\", {\n code: GraphBuildErrorCode,\n node: Schema.String,\n path: Schema.Array(Schema.String),\n message: Schema.String\n}) {}\n\n/**\n * The one advisory code. Everything else a build records blocks the drafts.\n *\n * A capability the caller does not grant is DROPPED, not granted: the callee\n * runs with less authority than it asked for, which is the safe direction. The\n * author still needs to know, because a flow that silently loses a capability\n * fails later at the action that needed it, so the build records the refusal\n * and lets the graph compile.\n */\nconst advisoryCodes: ReadonlySet<GraphBuildErrorCode> = new Set<GraphBuildErrorCode>([\"capability_outside_grant\"])\n\n/**\n * Whether a recorded refusal blocks the drafts a plan is compiled from.\n *\n * A fatal refusal means the graph describes something no plan could execute as\n * written, so the drafts are withheld. An advisory one reports a narrowing the\n * author should see while the graph still compiles.\n *\n * @param diagnostic - A recorded refusal.\n * @returns `false` only for an advisory code (`capability_outside_grant`).\n * @since 0.1.0\n * @category predicates\n */\nexport const isFatalDiagnostic = (diagnostic: GraphBuildError): boolean => !advisoryCodes.has(diagnostic.code)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,aAAwB;AAwDjB,MAAM,sBAAsB,OAAO,SAAS;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AA4BM,MAAM,wBAAwB,OAAO,YAA6B,EAAE,gCAAgC;AAAA,EACzG,MAAM;AAAA,EACN,MAAM,OAAO;AAAA,EACb,MAAM,OAAO,MAAM,OAAO,MAAM;AAAA,EAChC,SAAS,OAAO;AAClB,CAAC,EAAE;AAAC;AAWJ,MAAM,gBAAkD,oBAAI,IAAyB,CAAC,0BAA0B,CAAC;AAc1G,MAAM,oBAAoB,CAAC,eAAyC,CAAC,cAAc,IAAI,WAAW,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,9 +22,12 @@ import * as Schema from "effect/Schema";
|
|
|
22
22
|
* `Ref{from, path: []}` — which resolve to the same dependency digest — can
|
|
23
23
|
* never collide.
|
|
24
24
|
*
|
|
25
|
+
* - `Literal` hashes `value` inline.
|
|
26
|
+
* - `Ref` consumes the value at `path` inside node `from`'s result.
|
|
27
|
+
* - `Pending` consumes node `from`'s whole result.
|
|
28
|
+
*
|
|
25
29
|
* @since 0.1.0
|
|
26
30
|
* @category schemas
|
|
27
|
-
* @slop
|
|
28
31
|
*/
|
|
29
32
|
export declare const InputRef: Schema.Union<readonly [Schema.TaggedStruct<"Literal", {
|
|
30
33
|
readonly value: Schema.Unknown;
|
|
@@ -35,11 +38,10 @@ export declare const InputRef: Schema.Union<readonly [Schema.TaggedStruct<"Liter
|
|
|
35
38
|
readonly from: Schema.NonEmptyString;
|
|
36
39
|
}>]>;
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
41
|
+
* The value form of {@link InputRef}.
|
|
39
42
|
*
|
|
40
43
|
* @since 0.1.0
|
|
41
44
|
* @category models
|
|
42
|
-
* @slop
|
|
43
45
|
*/
|
|
44
46
|
export type InputRef = typeof InputRef.Type;
|
|
45
47
|
/**
|
|
@@ -48,7 +50,6 @@ export type InputRef = typeof InputRef.Type;
|
|
|
48
50
|
*
|
|
49
51
|
* @since 0.1.0
|
|
50
52
|
* @category constants
|
|
51
|
-
* @slop
|
|
52
53
|
*/
|
|
53
54
|
export declare const version = "flows/key-material/v2";
|
|
54
55
|
/**
|
|
@@ -58,9 +59,12 @@ export declare const version = "flows/key-material/v2";
|
|
|
58
59
|
* interpreted, which is what keeps the compiler independent of whatever the
|
|
59
60
|
* flow builder decides an effect declaration looks like.
|
|
60
61
|
*
|
|
62
|
+
* `version` must equal {@link version}. `kind` is the effect tier. `inputs`
|
|
63
|
+
* are hashed in order; `layers` and `capabilities` name what the node runs
|
|
64
|
+
* with.
|
|
65
|
+
*
|
|
61
66
|
* @since 0.1.0
|
|
62
67
|
* @category schemas
|
|
63
|
-
* @slop
|
|
64
68
|
*/
|
|
65
69
|
export declare const KeyMaterial: Schema.Struct<{
|
|
66
70
|
readonly version: Schema.Literal<"flows/key-material/v2">;
|
|
@@ -81,11 +85,10 @@ export declare const KeyMaterial: Schema.Struct<{
|
|
|
81
85
|
readonly placement: Schema.optional<Schema.Unknown>;
|
|
82
86
|
}>;
|
|
83
87
|
/**
|
|
84
|
-
*
|
|
88
|
+
* The value form of {@link KeyMaterial}.
|
|
85
89
|
*
|
|
86
90
|
* @since 0.1.0
|
|
87
91
|
* @category models
|
|
88
|
-
* @slop
|
|
89
92
|
*/
|
|
90
93
|
export type KeyMaterial = typeof KeyMaterial.Type;
|
|
91
94
|
/**
|
|
@@ -94,9 +97,11 @@ export type KeyMaterial = typeof KeyMaterial.Type;
|
|
|
94
97
|
* {@link module:Plan} uses them as the edge set — one derivation, so an edge
|
|
95
98
|
* and a hashed reference can never disagree.
|
|
96
99
|
*
|
|
100
|
+
* @param material - The node's key material.
|
|
101
|
+
* @returns The `from` of every `Ref` and `Pending` input, first occurrence
|
|
102
|
+
* order, deduplicated.
|
|
97
103
|
* @since 0.1.0
|
|
98
104
|
* @category accessors
|
|
99
|
-
* @slop
|
|
100
105
|
*/
|
|
101
106
|
export declare const dependencies: (material: KeyMaterial) => ReadonlyArray<string>;
|
|
102
107
|
//# sourceMappingURL=KeyMaterial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyMaterial.d.ts","sourceRoot":"","sources":["../../src/KeyMaterial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC
|
|
1
|
+
{"version":3,"file":"KeyMaterial.d.ts","sourceRoot":"","sources":["../../src/KeyMaterial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ;;;;;;;IAInB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,0BAA0B,CAAA;AAE9C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;EAWtB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,WAAW,KAAG,aAAa,CAAC,MAAM,CAMxE,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/KeyMaterial.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The key-material contract: what a planner hands the step-key compiler.\n *\n * Revived from the deleted `packages/smithers/flows/keys/src/KeyMaterial.ts`.\n * It does NOT return to `@smthrs/keys`: that package owns generic derivation\n * and stored-key validation, while material is a *plan-shaped* concept. It\n * lives here, above `@smthrs/keys`, so the key package stays a leaf.\n *\n * Governing contract: the step-key rules at\n * https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md. Material is computed with no I/O,\n * and two hardening rules shape it: the nominal, never shape-sniffed\n * `InputRef` and the hashed `version`.\n *\n * @since 0.1.0\n */\n\nimport * as Schema from \"effect/Schema\"\nimport * as Effects from \"./Effects.ts\"\n\n/**\n * A reference to one declared input of a node: a value hashed inline, or the\n * key of an upstream node whose result this node consumes.\n *\n * The three variants are tagged, and the tag is hashed, so `Pending{from}` and\n * `Ref{from, path: []}` \u2014 which resolve to the same dependency digest \u2014 can\n * never collide.\n *\n * @since 0.1.0\n * @category schemas\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,aAAwB;AACxB,cAAyB;
|
|
4
|
+
"sourcesContent": ["/**\n * The key-material contract: what a planner hands the step-key compiler.\n *\n * Revived from the deleted `packages/smithers/flows/keys/src/KeyMaterial.ts`.\n * It does NOT return to `@smthrs/keys`: that package owns generic derivation\n * and stored-key validation, while material is a *plan-shaped* concept. It\n * lives here, above `@smthrs/keys`, so the key package stays a leaf.\n *\n * Governing contract: the step-key rules at\n * https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md. Material is computed with no I/O,\n * and two hardening rules shape it: the nominal, never shape-sniffed\n * `InputRef` and the hashed `version`.\n *\n * @since 0.1.0\n */\n\nimport * as Schema from \"effect/Schema\"\nimport * as Effects from \"./Effects.ts\"\n\n/**\n * A reference to one declared input of a node: a value hashed inline, or the\n * key of an upstream node whose result this node consumes.\n *\n * The three variants are tagged, and the tag is hashed, so `Pending{from}` and\n * `Ref{from, path: []}` \u2014 which resolve to the same dependency digest \u2014 can\n * never collide.\n *\n * - `Literal` hashes `value` inline.\n * - `Ref` consumes the value at `path` inside node `from`'s result.\n * - `Pending` consumes node `from`'s whole result.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const InputRef = Schema.Union([\n Schema.TaggedStruct(\"Literal\", { value: Schema.Unknown }),\n Schema.TaggedStruct(\"Ref\", { from: Schema.NonEmptyString, path: Schema.Array(Schema.String) }),\n Schema.TaggedStruct(\"Pending\", { from: Schema.NonEmptyString })\n])\n\n/**\n * The value form of {@link InputRef}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type InputRef = typeof InputRef.Type\n\n/**\n * The material version. Folded into every hashed body so a bump re-keys every\n * node derived from it \u2014 the original's second collision fix, kept.\n *\n * @since 0.1.0\n * @category constants\n */\nexport const version = \"flows/key-material/v2\"\n\n/**\n * Everything that can change a node's result, handed to the digest.\n *\n * `effects` and `placement` are opaque: canonically serialized, never\n * interpreted, which is what keeps the compiler independent of whatever the\n * flow builder decides an effect declaration looks like.\n *\n * `version` must equal {@link version}. `kind` is the effect tier. `inputs`\n * are hashed in order; `layers` and `capabilities` name what the node runs\n * with.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const KeyMaterial = Schema.Struct({\n version: Schema.Literal(version),\n kind: Effects.Tier,\n // Absence claims determinism; only the explicit declaration changes identity.\n nondeterministic: Schema.optional(Schema.Literal(true)),\n body: Schema.Unknown,\n inputs: Schema.Array(InputRef),\n layers: Schema.Array(Schema.String),\n capabilities: Schema.Array(Schema.String),\n effects: Schema.optional(Schema.Unknown),\n placement: Schema.optional(Schema.Unknown)\n})\n\n/**\n * The value form of {@link KeyMaterial}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type KeyMaterial = typeof KeyMaterial.Type\n\n/**\n * The graph-local dependencies a material names, in declaration order and\n * without duplicates. The compiler resolves exactly these before hashing, and\n * {@link module:Plan} uses them as the edge set \u2014 one derivation, so an edge\n * and a hashed reference can never disagree.\n *\n * @param material - The node's key material.\n * @returns The `from` of every `Ref` and `Pending` input, first occurrence\n * order, deduplicated.\n * @since 0.1.0\n * @category accessors\n */\nexport const dependencies = (material: KeyMaterial): ReadonlyArray<string> => {\n const seen = new Set<string>()\n for (const input of material.inputs) {\n if (input._tag !== \"Literal\") seen.add(input.from)\n }\n return [...seen]\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,aAAwB;AACxB,cAAyB;AAiBlB,MAAM,WAAW,OAAO,MAAM;AAAA,EACnC,OAAO,aAAa,WAAW,EAAE,OAAO,OAAO,QAAQ,CAAC;AAAA,EACxD,OAAO,aAAa,OAAO,EAAE,MAAM,OAAO,gBAAgB,MAAM,OAAO,MAAM,OAAO,MAAM,EAAE,CAAC;AAAA,EAC7F,OAAO,aAAa,WAAW,EAAE,MAAM,OAAO,eAAe,CAAC;AAChE,CAAC;AAiBM,MAAM,UAAU;AAgBhB,MAAM,cAAc,OAAO,OAAO;AAAA,EACvC,SAAS,OAAO,QAAQ,OAAO;AAAA,EAC/B,MAAM,QAAQ;AAAA;AAAA,EAEd,kBAAkB,OAAO,SAAS,OAAO,QAAQ,IAAI,CAAC;AAAA,EACtD,MAAM,OAAO;AAAA,EACb,QAAQ,OAAO,MAAM,QAAQ;AAAA,EAC7B,QAAQ,OAAO,MAAM,OAAO,MAAM;AAAA,EAClC,cAAc,OAAO,MAAM,OAAO,MAAM;AAAA,EACxC,SAAS,OAAO,SAAS,OAAO,OAAO;AAAA,EACvC,WAAW,OAAO,SAAS,OAAO,OAAO;AAC3C,CAAC;AAsBM,MAAM,eAAe,CAAC,aAAiD;AAC5E,QAAM,OAAO,oBAAI,IAAY;AAC7B,aAAW,SAAS,SAAS,QAAQ;AACnC,QAAI,MAAM,SAAS,UAAW,MAAK,IAAI,MAAM,IAAI;AAAA,EACnD;AACA,SAAO,CAAC,GAAG,IAAI;AACjB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/Plan.d.ts
CHANGED
|
@@ -25,11 +25,15 @@ import * as StepKey from "./StepKey.ts";
|
|
|
25
25
|
* What a node does to the world, declared. Paths only — measuring them is
|
|
26
26
|
* run-time work, so a digest here would break the no-I/O law.
|
|
27
27
|
*
|
|
28
|
+
* Decoding fails with a `SchemaError` when a path is not workspace-relative.
|
|
29
|
+
* {@link compile} also refuses a node whose `removes` overlaps its `writes`
|
|
30
|
+
* with an `invalid_effects` {@link PlanError}.
|
|
31
|
+
*
|
|
28
32
|
* @since 0.1.0
|
|
29
33
|
* @category schemas
|
|
30
|
-
* @slop
|
|
31
34
|
*/
|
|
32
35
|
export declare const NodeEffects: Schema.Struct<{
|
|
36
|
+
/** Paths the node reads. A read orders the node after every writer of an overlapping path. */
|
|
33
37
|
readonly reads: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
34
38
|
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
35
39
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
@@ -40,6 +44,7 @@ export declare const NodeEffects: Schema.Struct<{
|
|
|
40
44
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
41
45
|
}>]>>;
|
|
42
46
|
}>]>>;
|
|
47
|
+
/** Paths the node writes. Two writers of an overlapping path form a conflict. */
|
|
43
48
|
readonly writes: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
44
49
|
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
45
50
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
@@ -60,6 +65,7 @@ export declare const NodeEffects: Schema.Struct<{
|
|
|
60
65
|
* conflict pass and the reader-after-writer pass see them as one set.
|
|
61
66
|
*/
|
|
62
67
|
readonly removes: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
68
|
+
/** How strictly the sandbox enforces these declarations. */
|
|
63
69
|
readonly boundaryMode: Schema.Literals<readonly ["hard", "expected"]>;
|
|
64
70
|
}>;
|
|
65
71
|
/**
|
|
@@ -67,15 +73,17 @@ export declare const NodeEffects: Schema.Struct<{
|
|
|
67
73
|
*
|
|
68
74
|
* @since 0.1.0
|
|
69
75
|
* @category models
|
|
70
|
-
* @slop
|
|
71
76
|
*/
|
|
72
77
|
export type NodeEffects = typeof NodeEffects.Type;
|
|
73
78
|
/**
|
|
74
|
-
* The plan-time
|
|
79
|
+
* The plan-time verdict for two writers of an overlapping path:
|
|
80
|
+
* `serialize` gives the later writer an ordering edge, `lane` records a lane
|
|
81
|
+
* annotation on both writers and adds no edge, and `fail` refuses the plan
|
|
82
|
+
* with `overlap_forbidden`. For a pair, `fail` dominates `lane`, which
|
|
83
|
+
* dominates `serialize`. The same schema as `Effects.ConflictStrategy`.
|
|
75
84
|
*
|
|
76
85
|
* @since 0.1.0
|
|
77
86
|
* @category schemas
|
|
78
|
-
* @slop
|
|
79
87
|
*/
|
|
80
88
|
export declare const PairStrategy: Schema.Literals<readonly ["serialize", "lane", "fail"]>;
|
|
81
89
|
/**
|
|
@@ -83,17 +91,16 @@ export declare const PairStrategy: Schema.Literals<readonly ["serialize", "lane"
|
|
|
83
91
|
*
|
|
84
92
|
* @since 0.1.0
|
|
85
93
|
* @category models
|
|
86
|
-
* @slop
|
|
87
94
|
*/
|
|
88
95
|
export type PairStrategy = typeof PairStrategy.Type;
|
|
89
96
|
/**
|
|
90
97
|
* The runtime half of a conflict annotation: what the scheduler
|
|
91
98
|
* does when the overlap the plan predicted actually bites, or when a
|
|
92
|
-
* scheduled node's inputs are invalidated under it.
|
|
99
|
+
* scheduled node's inputs are invalidated under it. For a pair,
|
|
100
|
+
* `stop-merge` dominates `delay-rebase`.
|
|
93
101
|
*
|
|
94
102
|
* @since 0.1.0
|
|
95
103
|
* @category schemas
|
|
96
|
-
* @slop
|
|
97
104
|
*/
|
|
98
105
|
export declare const RuntimeStrategy: Schema.Literals<readonly ["delay-rebase", "stop-merge"]>;
|
|
99
106
|
/**
|
|
@@ -101,16 +108,17 @@ export declare const RuntimeStrategy: Schema.Literals<readonly ["delay-rebase",
|
|
|
101
108
|
*
|
|
102
109
|
* @since 0.1.0
|
|
103
110
|
* @category models
|
|
104
|
-
* @slop
|
|
105
111
|
*/
|
|
106
112
|
export type RuntimeStrategy = typeof RuntimeStrategy.Type;
|
|
107
113
|
/**
|
|
108
114
|
* One resolved overlap between two writers that no dependency path already
|
|
109
115
|
* orders. Conflict is a property of the PAIR, not of one declaration.
|
|
110
116
|
*
|
|
117
|
+
* `with` names the other node, `paths` lists the overlapping declarations,
|
|
118
|
+
* and `strategy` and `runtime` are the verdicts resolved for the pair.
|
|
119
|
+
*
|
|
111
120
|
* @since 0.1.0
|
|
112
121
|
* @category schemas
|
|
113
|
-
* @slop
|
|
114
122
|
*/
|
|
115
123
|
export declare const ConflictAnnotation: Schema.Struct<{
|
|
116
124
|
readonly with: Schema.NonEmptyString;
|
|
@@ -123,7 +131,6 @@ export declare const ConflictAnnotation: Schema.Struct<{
|
|
|
123
131
|
*
|
|
124
132
|
* @since 0.1.0
|
|
125
133
|
* @category models
|
|
126
|
-
* @slop
|
|
127
134
|
*/
|
|
128
135
|
export type ConflictAnnotation = typeof ConflictAnnotation.Type;
|
|
129
136
|
/**
|
|
@@ -140,9 +147,11 @@ export type ConflictAnnotation = typeof ConflictAnnotation.Type;
|
|
|
140
147
|
* a later elaboration can resolve a pair against them without re-reading the
|
|
141
148
|
* flow source.
|
|
142
149
|
*
|
|
150
|
+
* `generation` is 0 for nodes from {@link compile} and grows by one with each
|
|
151
|
+
* {@link append}.
|
|
152
|
+
*
|
|
143
153
|
* @since 0.1.0
|
|
144
154
|
* @category schemas
|
|
145
|
-
* @slop
|
|
146
155
|
*/
|
|
147
156
|
export declare const PlanNode: Schema.Struct<{
|
|
148
157
|
readonly id: Schema.NonEmptyString;
|
|
@@ -167,6 +176,7 @@ export declare const PlanNode: Schema.Struct<{
|
|
|
167
176
|
readonly placement: Schema.optional<Schema.Unknown>;
|
|
168
177
|
}>;
|
|
169
178
|
readonly effects: Schema.Struct<{
|
|
179
|
+
/** Paths the node reads. A read orders the node after every writer of an overlapping path. */
|
|
170
180
|
readonly reads: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
171
181
|
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
172
182
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
@@ -177,6 +187,7 @@ export declare const PlanNode: Schema.Struct<{
|
|
|
177
187
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
178
188
|
}>]>>;
|
|
179
189
|
}>]>>;
|
|
190
|
+
/** Paths the node writes. Two writers of an overlapping path form a conflict. */
|
|
180
191
|
readonly writes: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
181
192
|
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
182
193
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
@@ -197,6 +208,7 @@ export declare const PlanNode: Schema.Struct<{
|
|
|
197
208
|
* conflict pass and the reader-after-writer pass see them as one set.
|
|
198
209
|
*/
|
|
199
210
|
readonly removes: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
211
|
+
/** How strictly the sandbox enforces these declarations. */
|
|
200
212
|
readonly boundaryMode: Schema.Literals<readonly ["hard", "expected"]>;
|
|
201
213
|
}>;
|
|
202
214
|
readonly dependsOn: Schema.$Array<Schema.NonEmptyString>;
|
|
@@ -216,7 +228,6 @@ export declare const PlanNode: Schema.Struct<{
|
|
|
216
228
|
*
|
|
217
229
|
* @since 0.1.0
|
|
218
230
|
* @category models
|
|
219
|
-
* @slop
|
|
220
231
|
*/
|
|
221
232
|
export type PlanNode = typeof PlanNode.Type;
|
|
222
233
|
/**
|
|
@@ -229,9 +240,11 @@ export type PlanNode = typeof PlanNode.Type;
|
|
|
229
240
|
* `baseDigest` is the digest at generation 0: what a human approved and what
|
|
230
241
|
* a `RUNNING` run pins. `digest` advances with every appended elaboration.
|
|
231
242
|
*
|
|
243
|
+
* Decoding checks only the shape. Use {@link verify} to check that keys,
|
|
244
|
+
* edges, and digests match the declarations.
|
|
245
|
+
*
|
|
232
246
|
* @since 0.1.0
|
|
233
247
|
* @category schemas
|
|
234
|
-
* @slop
|
|
235
248
|
*/
|
|
236
249
|
export declare const Plan: Schema.Struct<{
|
|
237
250
|
readonly planId: Schema.NonEmptyString;
|
|
@@ -262,6 +275,7 @@ export declare const Plan: Schema.Struct<{
|
|
|
262
275
|
readonly placement: Schema.optional<Schema.Unknown>;
|
|
263
276
|
}>;
|
|
264
277
|
readonly effects: Schema.Struct<{
|
|
278
|
+
/** Paths the node reads. A read orders the node after every writer of an overlapping path. */
|
|
265
279
|
readonly reads: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
266
280
|
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
267
281
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
@@ -272,6 +286,7 @@ export declare const Plan: Schema.Struct<{
|
|
|
272
286
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
273
287
|
}>]>>;
|
|
274
288
|
}>]>>;
|
|
289
|
+
/** Paths the node writes. Two writers of an overlapping path form a conflict. */
|
|
275
290
|
readonly writes: Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
|
|
276
291
|
readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
277
292
|
readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
@@ -292,6 +307,7 @@ export declare const Plan: Schema.Struct<{
|
|
|
292
307
|
* conflict pass and the reader-after-writer pass see them as one set.
|
|
293
308
|
*/
|
|
294
309
|
readonly removes: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
|
|
310
|
+
/** How strictly the sandbox enforces these declarations. */
|
|
295
311
|
readonly boundaryMode: Schema.Literals<readonly ["hard", "expected"]>;
|
|
296
312
|
}>;
|
|
297
313
|
readonly dependsOn: Schema.$Array<Schema.NonEmptyString>;
|
|
@@ -312,7 +328,6 @@ export declare const Plan: Schema.Struct<{
|
|
|
312
328
|
*
|
|
313
329
|
* @since 0.1.0
|
|
314
330
|
* @category models
|
|
315
|
-
* @slop
|
|
316
331
|
*/
|
|
317
332
|
export type Plan = typeof Plan.Type;
|
|
318
333
|
/**
|
|
@@ -320,13 +335,17 @@ export type Plan = typeof Plan.Type;
|
|
|
320
335
|
*
|
|
321
336
|
* @since 0.1.0
|
|
322
337
|
* @category models
|
|
323
|
-
* @slop
|
|
324
338
|
*/
|
|
325
339
|
export interface NodeDraft {
|
|
340
|
+
/** A non-empty id, unique within the plan. */
|
|
326
341
|
readonly id: string;
|
|
342
|
+
/** The key inputs. Its `Ref` inputs name the node's material dependencies. */
|
|
327
343
|
readonly material: KeyMaterial.KeyMaterial;
|
|
344
|
+
/** The declared reads, writes, and removals. They replace `material.effects`. */
|
|
328
345
|
readonly effects: NodeEffects;
|
|
346
|
+
/** `step`, `agent`, or `merge`. Defaults to `step`. */
|
|
329
347
|
readonly kind?: PlanNode["kind"] | undefined;
|
|
348
|
+
/** A safe integer scheduling priority. Defaults to 0. */
|
|
330
349
|
readonly priority?: number | undefined;
|
|
331
350
|
/** This declaration's preferred plan-time verdict for a detected overlap. */
|
|
332
351
|
readonly conflictStrategy?: PairStrategy | undefined;
|
|
@@ -338,11 +357,22 @@ declare const PlanError_base: Schema.Class<PlanError, Schema.TaggedStruct<"@smth
|
|
|
338
357
|
readonly message: Schema.String;
|
|
339
358
|
}>, import("effect/Cause").YieldableError>;
|
|
340
359
|
/**
|
|
341
|
-
* A graph the compiler refuses.
|
|
360
|
+
* A graph the compiler refuses. `code` names the rule:
|
|
361
|
+
*
|
|
362
|
+
* - `cycle`: material or inferred edges form a cycle.
|
|
363
|
+
* - `unknown_dependency`: a `Ref` names a node that is not in the plan.
|
|
364
|
+
* - `duplicate_node`: two nodes share an id.
|
|
365
|
+
* - `overlap_forbidden`: two unordered writers overlap and the pair's
|
|
366
|
+
* strategy is `fail`.
|
|
367
|
+
* - `invalid_effects`: a node both writes and removes one path.
|
|
368
|
+
* - `invalid_node`: a draft field, the plan id, or the flow name is malformed.
|
|
369
|
+
* - `invalid_plan`: {@link verify} found a plan that does not match its
|
|
370
|
+
* declarations.
|
|
371
|
+
* - `graph_too_large`: the plan exceeds {@link maximumPlanNodes} or the
|
|
372
|
+
* effect-analysis work budget.
|
|
342
373
|
*
|
|
343
374
|
* @since 0.1.0
|
|
344
375
|
* @category errors
|
|
345
|
-
* @slop
|
|
346
376
|
*/
|
|
347
377
|
export declare class PlanError extends PlanError_base {
|
|
348
378
|
}
|
|
@@ -354,7 +384,6 @@ export declare class PlanError extends PlanError_base {
|
|
|
354
384
|
*
|
|
355
385
|
* @since 1.0.0
|
|
356
386
|
* @category limits
|
|
357
|
-
* @slop
|
|
358
387
|
*/
|
|
359
388
|
export declare const maximumPlanNodes = 10000;
|
|
360
389
|
/**
|
|
@@ -367,9 +396,15 @@ export declare const maximumPlanNodes = 10000;
|
|
|
367
396
|
* {@link maximumPlanNodes} and fail with `graph_too_large` above that limit
|
|
368
397
|
* or the effect-analysis work budget. Analysis yields periodically.
|
|
369
398
|
*
|
|
399
|
+
* The options and drafts are copied when `compile` is called, so later
|
|
400
|
+
* caller mutation does not reach the plan. The result is deeply frozen.
|
|
401
|
+
*
|
|
402
|
+
* @param options - `planId` and `flow` name the plan; `nodes` are the drafts.
|
|
403
|
+
* @returns The generation-0 plan, whose `baseDigest` equals its `digest`.
|
|
404
|
+
* Fails with {@link PlanError} for a refused graph, `KeyMaterialError` or
|
|
405
|
+
* `SchemaError` when a key cannot be derived.
|
|
370
406
|
* @since 0.1.0
|
|
371
407
|
* @category constructors
|
|
372
|
-
* @slop
|
|
373
408
|
*/
|
|
374
409
|
export declare const compile: (options: {
|
|
375
410
|
readonly planId: string;
|
|
@@ -386,9 +421,16 @@ export declare const compile: (options: {
|
|
|
386
421
|
* Re-ordering after a reconciliation happens by re-keying *future* steps,
|
|
387
422
|
* never by rewriting history.
|
|
388
423
|
*
|
|
424
|
+
* A plan not produced by this module is checked with {@link verify} first.
|
|
425
|
+
*
|
|
426
|
+
* @param plan - The plan to grow.
|
|
427
|
+
* @param drafts - At least one new node. Ids must not repeat existing ones;
|
|
428
|
+
* `Ref` inputs may name existing nodes.
|
|
429
|
+
* @returns The plan with one more generation and a new `digest`. Fails with
|
|
430
|
+
* {@link PlanError} (`invalid_node` for an empty `drafts`, `invalid_plan` for a
|
|
431
|
+
* plan that fails verification), `KeyMaterialError`, or `SchemaError`.
|
|
389
432
|
* @since 0.1.0
|
|
390
433
|
* @category constructors
|
|
391
|
-
* @slop
|
|
392
434
|
*/
|
|
393
435
|
export declare const append: (plan: Plan, drafts: ReadonlyArray<NodeDraft>) => Effect.Effect<Plan, PlanError | StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
|
|
394
436
|
/**
|
|
@@ -409,9 +451,10 @@ export declare const verify: (input: unknown) => Effect.Effect<Plan, PlanError |
|
|
|
409
451
|
* The nodes added by the newest generation: what {@link module:PlanStore}
|
|
410
452
|
* appends and what the `subgraph-appended` journal record names.
|
|
411
453
|
*
|
|
454
|
+
* @param plan - A plan.
|
|
455
|
+
* @returns The nodes whose generation equals `plan.generation`, in order.
|
|
412
456
|
* @since 0.1.0
|
|
413
457
|
* @category accessors
|
|
414
|
-
* @slop
|
|
415
458
|
*/
|
|
416
459
|
export declare const generationNodes: (plan: Plan) => ReadonlyArray<PlanNode>;
|
|
417
460
|
/**
|
|
@@ -419,9 +462,11 @@ export declare const generationNodes: (plan: Plan) => ReadonlyArray<PlanNode>;
|
|
|
419
462
|
* {@link verify}: such values take verify's trusted fast path and need no
|
|
420
463
|
* second schema validation.
|
|
421
464
|
*
|
|
465
|
+
* @param input - Any value.
|
|
466
|
+
* @returns `true` only for a plan returned by {@link compile},
|
|
467
|
+
* {@link append}, or {@link verify}; a structurally equal copy returns `false`.
|
|
422
468
|
* @since 1.0.0
|
|
423
469
|
* @category guards
|
|
424
|
-
* @slop
|
|
425
470
|
*/
|
|
426
471
|
export declare const isVerified: (input: unknown) => input is Plan;
|
|
427
472
|
/**
|
|
@@ -431,9 +476,13 @@ export declare const isVerified: (input: unknown) => input is Plan;
|
|
|
431
476
|
* plan's integrity from the already-verified prefix instead of decoding and
|
|
432
477
|
* re-verifying every stored row.
|
|
433
478
|
*
|
|
479
|
+
* For a generation-0 plan no generation precedes the newest, so this is the
|
|
480
|
+
* digest of an empty node list.
|
|
481
|
+
*
|
|
482
|
+
* @param plan - A plan.
|
|
483
|
+
* @returns The approval digest of the nodes older than `plan.generation`.
|
|
434
484
|
* @since 1.0.0
|
|
435
485
|
* @category accessors
|
|
436
|
-
* @slop
|
|
437
486
|
*/
|
|
438
487
|
export declare const prefixDigest: (plan: Plan) => Effect.Effect<StepKey.StepKey, StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
|
|
439
488
|
export {};
|
package/dist/cjs/Plan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plan.d.ts","sourceRoot":"","sources":["../../src/Plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAMvC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC
|
|
1
|
+
{"version":3,"file":"Plan.d.ts","sourceRoot":"","sources":["../../src/Plan.ts"],"names":[],"mappings":"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"}
|
package/dist/cjs/Plan.js
CHANGED
|
@@ -56,7 +56,9 @@ var import_JsonMirror = require("./internal/JsonMirror.js");
|
|
|
56
56
|
var KeyMaterial = __toESM(require("./KeyMaterial.js"), 1);
|
|
57
57
|
var StepKey = __toESM(require("./StepKey.js"), 1);
|
|
58
58
|
const NodeEffects = Schema.Struct({
|
|
59
|
+
/** Paths the node reads. A read orders the node after every writer of an overlapping path. */
|
|
59
60
|
reads: Schema.Array(FileSet.ReadDeclaration),
|
|
61
|
+
/** Paths the node writes. Two writers of an overlapping path form a conflict. */
|
|
60
62
|
writes: Schema.Array(FileSet.Declaration),
|
|
61
63
|
/**
|
|
62
64
|
* Paths the node declares it will DELETE. A removal mutates the world exactly
|
|
@@ -64,6 +66,7 @@ const NodeEffects = Schema.Struct({
|
|
|
64
66
|
* conflict pass and the reader-after-writer pass see them as one set.
|
|
65
67
|
*/
|
|
66
68
|
removes: Schema.optional(Schema.Array(FileSet.Pattern)),
|
|
69
|
+
/** How strictly the sandbox enforces these declarations. */
|
|
67
70
|
boundaryMode: FileSet.BoundaryMode
|
|
68
71
|
});
|
|
69
72
|
const PairStrategy = Effects.ConflictStrategy;
|