@smthrs/plan 0.0.0-stage → 1.0.0-rc.3

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.
Files changed (199) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/LICENSE +21 -0
  3. package/README.md +228 -2
  4. package/dist/cjs/CachePolicy.d.ts +131 -0
  5. package/dist/cjs/CachePolicy.d.ts.map +1 -0
  6. package/dist/cjs/CachePolicy.js +50 -0
  7. package/dist/cjs/CachePolicy.js.map +7 -0
  8. package/dist/cjs/Effects.d.ts +240 -0
  9. package/dist/cjs/Effects.d.ts.map +1 -0
  10. package/dist/cjs/Effects.js +76 -0
  11. package/dist/cjs/Effects.js.map +7 -0
  12. package/dist/cjs/FileSet.d.ts +288 -0
  13. package/dist/cjs/FileSet.d.ts.map +1 -0
  14. package/dist/cjs/FileSet.js +191 -0
  15. package/dist/cjs/FileSet.js.map +7 -0
  16. package/dist/cjs/GraphBuildError.d.ts +122 -0
  17. package/dist/cjs/GraphBuildError.d.ts.map +1 -0
  18. package/dist/cjs/GraphBuildError.js +71 -0
  19. package/dist/cjs/GraphBuildError.js.map +7 -0
  20. package/dist/cjs/KeyMaterial.d.ts +102 -0
  21. package/dist/cjs/KeyMaterial.d.ts.map +1 -0
  22. package/dist/cjs/KeyMaterial.js +64 -0
  23. package/dist/cjs/KeyMaterial.js.map +7 -0
  24. package/dist/cjs/Node.d.ts +606 -0
  25. package/dist/cjs/Node.d.ts.map +1 -0
  26. package/dist/cjs/Node.js +207 -0
  27. package/dist/cjs/Node.js.map +7 -0
  28. package/dist/cjs/Placement.d.ts +117 -0
  29. package/dist/cjs/Placement.d.ts.map +1 -0
  30. package/dist/cjs/Placement.js +46 -0
  31. package/dist/cjs/Placement.js.map +7 -0
  32. package/dist/cjs/Plan.d.ts +440 -0
  33. package/dist/cjs/Plan.d.ts.map +1 -0
  34. package/dist/cjs/Plan.js +508 -0
  35. package/dist/cjs/Plan.js.map +7 -0
  36. package/dist/cjs/PlanDiff.d.ts +58 -0
  37. package/dist/cjs/PlanDiff.d.ts.map +1 -0
  38. package/dist/cjs/PlanDiff.js +124 -0
  39. package/dist/cjs/PlanDiff.js.map +7 -0
  40. package/dist/cjs/Planned.d.ts +121 -0
  41. package/dist/cjs/Planned.d.ts.map +1 -0
  42. package/dist/cjs/Planned.js +72 -0
  43. package/dist/cjs/Planned.js.map +7 -0
  44. package/dist/cjs/Repetition.d.ts +31 -0
  45. package/dist/cjs/Repetition.d.ts.map +1 -0
  46. package/dist/cjs/Repetition.js +36 -0
  47. package/dist/cjs/Repetition.js.map +7 -0
  48. package/dist/cjs/Scheduling.d.ts +89 -0
  49. package/dist/cjs/Scheduling.d.ts.map +1 -0
  50. package/dist/cjs/Scheduling.js +76 -0
  51. package/dist/cjs/Scheduling.js.map +7 -0
  52. package/dist/cjs/StepKey.d.ts +333 -0
  53. package/dist/cjs/StepKey.d.ts.map +1 -0
  54. package/dist/cjs/StepKey.js +311 -0
  55. package/dist/cjs/StepKey.js.map +7 -0
  56. package/dist/cjs/index.d.ts +91 -0
  57. package/dist/cjs/index.d.ts.map +1 -0
  58. package/dist/cjs/index.js +59 -0
  59. package/dist/cjs/index.js.map +7 -0
  60. package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
  61. package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
  62. package/dist/cjs/internal/ConflictAnnotation.js +247 -0
  63. package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
  64. package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
  65. package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
  66. package/dist/cjs/internal/EffectCandidates.js +92 -0
  67. package/dist/cjs/internal/EffectCandidates.js.map +7 -0
  68. package/dist/cjs/internal/JsonMirror.d.ts +34 -0
  69. package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
  70. package/dist/cjs/internal/JsonMirror.js +195 -0
  71. package/dist/cjs/internal/JsonMirror.js.map +7 -0
  72. package/dist/cjs/internal/effects.d.ts +245 -0
  73. package/dist/cjs/internal/effects.d.ts.map +1 -0
  74. package/dist/cjs/internal/effects.js +290 -0
  75. package/dist/cjs/internal/effects.js.map +7 -0
  76. package/dist/cjs/internal/node.d.ts +526 -0
  77. package/dist/cjs/internal/node.d.ts.map +1 -0
  78. package/dist/cjs/internal/node.js +312 -0
  79. package/dist/cjs/internal/node.js.map +7 -0
  80. package/dist/cjs/package.json +1 -0
  81. package/dist/cjs/test/PlanFixtures.d.ts +127 -0
  82. package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
  83. package/dist/cjs/test/PlanFixtures.js +59 -0
  84. package/dist/cjs/test/PlanFixtures.js.map +7 -0
  85. package/dist/esm/CachePolicy.d.ts +131 -0
  86. package/dist/esm/CachePolicy.d.ts.map +1 -0
  87. package/dist/esm/CachePolicy.js +117 -0
  88. package/dist/esm/CachePolicy.js.map +1 -0
  89. package/dist/esm/Effects.d.ts +240 -0
  90. package/dist/esm/Effects.d.ts.map +1 -0
  91. package/dist/esm/Effects.js +167 -0
  92. package/dist/esm/Effects.js.map +1 -0
  93. package/dist/esm/FileSet.d.ts +288 -0
  94. package/dist/esm/FileSet.d.ts.map +1 -0
  95. package/dist/esm/FileSet.js +324 -0
  96. package/dist/esm/FileSet.js.map +1 -0
  97. package/dist/esm/GraphBuildError.d.ts +122 -0
  98. package/dist/esm/GraphBuildError.d.ts.map +1 -0
  99. package/dist/esm/GraphBuildError.js +146 -0
  100. package/dist/esm/GraphBuildError.js.map +1 -0
  101. package/dist/esm/KeyMaterial.d.ts +102 -0
  102. package/dist/esm/KeyMaterial.d.ts.map +1 -0
  103. package/dist/esm/KeyMaterial.js +85 -0
  104. package/dist/esm/KeyMaterial.js.map +1 -0
  105. package/dist/esm/Node.d.ts +606 -0
  106. package/dist/esm/Node.d.ts.map +1 -0
  107. package/dist/esm/Node.js +521 -0
  108. package/dist/esm/Node.js.map +1 -0
  109. package/dist/esm/Placement.d.ts +117 -0
  110. package/dist/esm/Placement.d.ts.map +1 -0
  111. package/dist/esm/Placement.js +65 -0
  112. package/dist/esm/Placement.js.map +1 -0
  113. package/dist/esm/Plan.d.ts +440 -0
  114. package/dist/esm/Plan.d.ts.map +1 -0
  115. package/dist/esm/Plan.js +673 -0
  116. package/dist/esm/Plan.js.map +1 -0
  117. package/dist/esm/PlanDiff.d.ts +58 -0
  118. package/dist/esm/PlanDiff.d.ts.map +1 -0
  119. package/dist/esm/PlanDiff.js +159 -0
  120. package/dist/esm/PlanDiff.js.map +1 -0
  121. package/dist/esm/Planned.d.ts +121 -0
  122. package/dist/esm/Planned.d.ts.map +1 -0
  123. package/dist/esm/Planned.js +147 -0
  124. package/dist/esm/Planned.js.map +1 -0
  125. package/dist/esm/Repetition.d.ts +31 -0
  126. package/dist/esm/Repetition.d.ts.map +1 -0
  127. package/dist/esm/Repetition.js +24 -0
  128. package/dist/esm/Repetition.js.map +1 -0
  129. package/dist/esm/Scheduling.d.ts +89 -0
  130. package/dist/esm/Scheduling.d.ts.map +1 -0
  131. package/dist/esm/Scheduling.js +82 -0
  132. package/dist/esm/Scheduling.js.map +1 -0
  133. package/dist/esm/StepKey.d.ts +333 -0
  134. package/dist/esm/StepKey.d.ts.map +1 -0
  135. package/dist/esm/StepKey.js +478 -0
  136. package/dist/esm/StepKey.js.map +1 -0
  137. package/dist/esm/index.d.ts +91 -0
  138. package/dist/esm/index.d.ts.map +1 -0
  139. package/dist/esm/index.js +91 -0
  140. package/dist/esm/index.js.map +1 -0
  141. package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
  142. package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
  143. package/dist/esm/internal/ConflictAnnotation.js +332 -0
  144. package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
  145. package/dist/esm/internal/EffectCandidates.d.ts +19 -0
  146. package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
  147. package/dist/esm/internal/EffectCandidates.js +86 -0
  148. package/dist/esm/internal/EffectCandidates.js.map +1 -0
  149. package/dist/esm/internal/JsonMirror.d.ts +34 -0
  150. package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
  151. package/dist/esm/internal/JsonMirror.js +204 -0
  152. package/dist/esm/internal/JsonMirror.js.map +1 -0
  153. package/dist/esm/internal/effects.d.ts +245 -0
  154. package/dist/esm/internal/effects.d.ts.map +1 -0
  155. package/dist/esm/internal/effects.js +459 -0
  156. package/dist/esm/internal/effects.js.map +1 -0
  157. package/dist/esm/internal/node.d.ts +526 -0
  158. package/dist/esm/internal/node.d.ts.map +1 -0
  159. package/dist/esm/internal/node.js +564 -0
  160. package/dist/esm/internal/node.js.map +1 -0
  161. package/dist/esm/test/PlanFixtures.d.ts +127 -0
  162. package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
  163. package/dist/esm/test/PlanFixtures.js +60 -0
  164. package/dist/esm/test/PlanFixtures.js.map +1 -0
  165. package/docs/README.md +165 -0
  166. package/docs/api.md +1475 -0
  167. package/docs/concepts/authoring-ast.md +203 -0
  168. package/docs/concepts/effects-and-conflicts.md +135 -0
  169. package/docs/concepts/plan-value.md +168 -0
  170. package/docs/concepts/step-keys.md +179 -0
  171. package/docs/guides/author-a-node-graph.md +182 -0
  172. package/docs/guides/compile-a-plan.md +146 -0
  173. package/docs/guides/declare-file-effects.md +143 -0
  174. package/docs/guides/diff-two-plans.md +101 -0
  175. package/docs/installation.md +71 -0
  176. package/docs/quickstart.md +128 -0
  177. package/docs/testing.md +73 -0
  178. package/docs/troubleshooting.md +314 -0
  179. package/package.json +254 -3
  180. package/src/CachePolicy.ts +143 -0
  181. package/src/Effects.ts +284 -0
  182. package/src/FileSet.ts +411 -0
  183. package/src/GraphBuildError.ts +158 -0
  184. package/src/KeyMaterial.ts +106 -0
  185. package/src/Node.ts +871 -0
  186. package/src/Placement.ts +99 -0
  187. package/src/Plan.ts +868 -0
  188. package/src/PlanDiff.ts +199 -0
  189. package/src/Planned.ts +208 -0
  190. package/src/Repetition.ts +33 -0
  191. package/src/Scheduling.ts +154 -0
  192. package/src/StepKey.ts +710 -0
  193. package/src/index.ts +103 -0
  194. package/src/internal/ConflictAnnotation.ts +374 -0
  195. package/src/internal/EffectCandidates.ts +89 -0
  196. package/src/internal/JsonMirror.ts +255 -0
  197. package/src/internal/effects.ts +543 -0
  198. package/src/internal/node.ts +858 -0
  199. package/src/test/PlanFixtures.ts +76 -0
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all2) => {
9
+ for (var name in all2)
10
+ __defProp(target, name, { get: all2[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var Node_exports = {};
30
+ __export(Node_exports, {
31
+ CallMode: () => CallMode,
32
+ TypeId: () => TypeId,
33
+ actionCall: () => actionCall,
34
+ all: () => all,
35
+ andThen: () => andThen,
36
+ any: () => any,
37
+ bindPlanned: () => bindPlanned,
38
+ branch: () => branch,
39
+ branchSubject: () => branchSubject,
40
+ capture: () => capture,
41
+ catch: () => catch_,
42
+ catchFilter: () => catchFilter,
43
+ catchSubject: () => catchSubject,
44
+ continuation: () => continuation,
45
+ declaration: () => declaration,
46
+ declaredPriority: () => declaredPriority,
47
+ fail: () => fail,
48
+ flowCall: () => flowCall,
49
+ functionIdentity: () => functionIdentity,
50
+ isNode: () => isNode,
51
+ map: () => map,
52
+ mapper: () => mapper,
53
+ plannedReference: () => plannedReference,
54
+ predicate: () => predicate,
55
+ priority: () => priority,
56
+ quorum: () => quorum,
57
+ race: () => race,
58
+ succeed: () => succeed
59
+ });
60
+ module.exports = __toCommonJS(Node_exports);
61
+ var import_Function = require("effect/Function");
62
+ var import_GraphBuildError = require("./GraphBuildError.js");
63
+ var internal = __toESM(require("./internal/node.js"), 1);
64
+ var Planned = __toESM(require("./Planned.js"), 1);
65
+ const TypeId = internal.TypeId;
66
+ const CallMode = internal.CallMode;
67
+ const plannedReference = internal.plannedReference;
68
+ const branchSubject = "branch/subject";
69
+ const subjectsKey = /* @__PURE__ */ Symbol.for("@smthrs/plan/Node/subjects/v1");
70
+ const globals = globalThis;
71
+ const subjects = globals[subjectsKey] ??= { branch: 0, catch: 0 };
72
+ const catchSubject = "catch/subject";
73
+ const isNode = (value) => internal.isNode(value);
74
+ const succeed = (value) => internal.makeNode(internal.succeed(value));
75
+ const fail = (error) => internal.makeNode(internal.fail(error));
76
+ const all = (nodes) => internal.makeNode(internal.all(memberAsts(nodes, "all", "invalid_all_member")));
77
+ const memberAsts = (nodes, combinator, code) => {
78
+ const asts = /* @__PURE__ */ Object.create(null);
79
+ for (const [member, node] of Object.entries(nodes)) {
80
+ if (!isNode(node)) {
81
+ throw new import_GraphBuildError.GraphBuildError({
82
+ code,
83
+ node: member,
84
+ path: [],
85
+ message: `Node.${combinator} expected a Node at member "${member}"`
86
+ });
87
+ }
88
+ Object.defineProperty(asts, member, {
89
+ configurable: true,
90
+ enumerable: true,
91
+ value: node.ast,
92
+ writable: true
93
+ });
94
+ }
95
+ return asts;
96
+ };
97
+ const join = (mode, count, nodes) => {
98
+ const asts = memberAsts(nodes, mode, "invalid_join");
99
+ const width = Object.keys(asts).length;
100
+ if (!internal.isRaceCount(mode, count, width)) {
101
+ throw new import_GraphBuildError.GraphBuildError({
102
+ code: "invalid_join",
103
+ node: mode,
104
+ path: [],
105
+ message: mode === "quorum" ? `Node.quorum needs a whole number of successes between 1 and its ${width} members, got ${String(count)}` : `Node.${mode} needs at least one member`
106
+ });
107
+ }
108
+ return internal.race(mode, count, asts);
109
+ };
110
+ const race = (nodes) => internal.makeNode(join("race", 1, nodes));
111
+ const any = (nodes) => internal.makeNode(join("any", 1, nodes));
112
+ const quorum = (count, nodes) => internal.makeNode(join("quorum", count, nodes));
113
+ const map = (0, import_Function.dual)(
114
+ 2,
115
+ (self, f) => internal.makeNode(internal.map(self.ast, (value) => f(value), f))
116
+ );
117
+ const andThen = (0, import_Function.dual)(
118
+ 2,
119
+ (self, next) => {
120
+ if (!isNode(next)) {
121
+ throw new import_GraphBuildError.GraphBuildError({
122
+ code: "invalid_continuation",
123
+ node: "andThen/next",
124
+ path: [],
125
+ message: "Node.andThen expects a Node; use Node.bindPlanned for a symbolic builder or Node.map for value computation"
126
+ });
127
+ }
128
+ return internal.makeNode(internal.andThenNode(self.ast, next.ast));
129
+ }
130
+ );
131
+ const bindPlanned = (0, import_Function.dual)(
132
+ 2,
133
+ (self, build) => internal.makeNode(
134
+ internal.andThen(self.ast, (value) => build(value), build)
135
+ )
136
+ );
137
+ const arm = (build, subject, side) => {
138
+ const node = build(subject);
139
+ if (!isNode(node)) {
140
+ throw new import_GraphBuildError.GraphBuildError({
141
+ code: "invalid_continuation",
142
+ node: `${branchSubject}/${side}`,
143
+ path: [],
144
+ message: `Node.branch expected its "${side}" arm to return a Node`
145
+ });
146
+ }
147
+ return node.ast;
148
+ };
149
+ const branch = (0, import_Function.dual)(
150
+ 2,
151
+ (self, options) => {
152
+ const predicate2 = options.if;
153
+ const subjectToken = `${branchSubject}/${subjects.branch++}`;
154
+ const subject = Planned.make(subjectToken);
155
+ return internal.makeNode(
156
+ internal.branch(
157
+ subjectToken,
158
+ self.ast,
159
+ (value) => predicate2(value),
160
+ predicate2,
161
+ arm(options.then, subject, "then"),
162
+ arm(options.else, subject, "else")
163
+ )
164
+ );
165
+ }
166
+ );
167
+ const catch_ = (0, import_Function.dual)(
168
+ 2,
169
+ (self, options) => {
170
+ const subjectToken = `${catchSubject}/${subjects.catch++}`;
171
+ const failure = options.onFailure(Planned.make(subjectToken));
172
+ if (!isNode(failure)) {
173
+ throw new import_GraphBuildError.GraphBuildError({
174
+ code: "invalid_continuation",
175
+ node: catchSubject,
176
+ path: [],
177
+ message: "Node.catch expected its failure arm to return a Node"
178
+ });
179
+ }
180
+ return internal.makeNode(internal.catch_(subjectToken, self.ast, failure.ast, options.error));
181
+ }
182
+ );
183
+ const priority = (0, import_Function.dual)(
184
+ 2,
185
+ (self, value) => {
186
+ if (!Number.isSafeInteger(value)) {
187
+ throw new import_GraphBuildError.GraphBuildError({
188
+ code: "invalid_priority",
189
+ node: self.ast._tag,
190
+ path: [],
191
+ message: `Node.priority expects a safe integer, received ${value}`
192
+ });
193
+ }
194
+ return internal.makeNode(internal.withPriority(self.ast, value));
195
+ }
196
+ );
197
+ const declaredPriority = (ast) => ast.priority;
198
+ const flowCall = (declaration2, flow, mode, payload) => internal.makeNode(internal.flowCall(declaration2, flow, mode, payload));
199
+ const actionCall = (declaration2, action, payload) => internal.makeNode(internal.actionCall(declaration2, action, payload));
200
+ const declaration = (ast) => internal.declaration(ast);
201
+ const continuation = (ast) => internal.operation(ast);
202
+ const mapper = (ast) => ast._tag === "Map" ? internal.operation(ast) : void 0;
203
+ const predicate = (ast) => ast._tag === "Branch" ? internal.predicate(ast) : void 0;
204
+ const catchFilter = (ast) => ast._tag === "Catch" ? internal.filter(ast) : void 0;
205
+ const functionIdentity = (operation) => internal.functionIdentity(operation);
206
+ const capture = (captures, operation) => internal.capture(captures, operation);
207
+ //# sourceMappingURL=Node.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Node.ts"],
4
+ "sourcesContent": ["/**\n * Pure, pipeable nodes: the shape a flow body describes and nothing more.\n *\n * Building a node records an inspectable AST and executes nothing \u2014 the same\n * split as Bazel's `ctx.actions.run`, which declares an action rather than\n * running one. A plan is\n * always a DAG, so there is no loop node here and never will be: repetition\n * lives one level up, in what a flow settles with.\n *\n * A node also carries Effect's requirement channel, `R`, and carries it as a\n * PHANTOM: building a plan demands nothing, and every combinator here unions\n * `R` without ever reading it. What fills the channel is a call to something\n * whose code lives elsewhere \u2014 an action \u2014 so the type of a plan states which\n * implementations executing it will need, and the place that executes it is\n * where the compiler asks for them.\n *\n * Control flow is structure. {@link branch} takes both arms and evaluates each\n * ONCE, symbolically, so the exit condition and the handoff site are visible\n * topology before anything runs; its predicate is digested and runs later on\n * the real value. {@link map} is transformation only. The rule the authoring\n * note states, and this module encodes: **map transforms; branch decides.**\n *\n * Adapted from `@smthrs/core` (`packages/smithers/flows/core`) `Node.ts`.\n * `Dynamic` is gone \u2014 a model call is an ordinary action, and nothing\n * model-shaped belongs in this package \u2014 and node annotations are gone with\n * it, because the AST has to stay JSON serializable.\n *\n * @since 0.1.0\n */\n\nimport { dual } from \"effect/Function\"\nimport type * as Pipeable from \"effect/Pipeable\"\nimport type * as Schema from \"effect/Schema\"\nimport type * as Types from \"effect/Types\"\nimport { GraphBuildError } from \"./GraphBuildError.ts\"\nimport * as internal from \"./internal/node.ts\"\nimport * as Planned from \"./Planned.ts\"\n\n/**\n * The runtime type identifier carried by every node.\n *\n * @since 0.1.0\n * @category type ids\n * @slop\n */\nexport const TypeId: TypeId = internal.TypeId\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @category type ids\n * @slop\n */\nexport type TypeId = \"~@smthrs/plan/Node\"\n\n/**\n * The inspectable AST a node stores: closure-free, and JSON serializable for\n * every JSON payload an author puts in it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Ast = internal.NodeAst\n\n/**\n * How a flow call joins the caller's plan: `inline` splices the callee's body\n * in, `boundary` makes it one child execution, and `handoff` names the next\n * trampoline round.\n *\n * This is the ONE call-mode vocabulary. {@link flowCall} takes it and\n * `@smthrs/flow`'s graph builder switches on it, so a second spelling in\n * either package would fork the moment one gained a mode.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport const CallMode = internal.CallMode\n\n/**\n * The value form of {@link CallMode}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type CallMode = internal.CallMode\n\n/**\n * The serializable stand-in an AST keeps for a plan-time function: a digest of\n * its normalized source, hashed in place of a closure that could not be\n * shipped, stored, or compared.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type FunctionIdentity = Extract<Ast, { readonly _tag: \"Map\" }>[\"mapper\"]\n\n/**\n * Reads the inert AST reference created for a planned value.\n *\n * Structural lookalikes remain ordinary payload data. This accessor is the\n * only recognition path because the marker itself is deliberately private to\n * the AST cloner.\n *\n * @since 1.0.0\n * @category accessors\n */\nexport const plannedReference = internal.plannedReference\n\n/**\n * A pure graph-building value, covariant in what it will succeed and fail\n * with and in what it will need to run. It is a description: holding one has\n * run nothing.\n *\n * `R` is Effect's requirement channel, and it is PHANTOM here. Nothing at plan\n * time reads it: the AST, the graph built from it, its key material, and every\n * digest are identical whatever `R` says. It exists so a value that names an\n * implementation it does not carry \u2014 an action call \u2014 can say so in its type,\n * and so the place that finally has to run that implementation can demand it.\n * Building a plan therefore stays requirement-free; only executing one is not.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface Node<out A, out E = never, out R = never> extends Pipeable.Pipeable {\n readonly [TypeId]: {\n readonly _A: Types.Covariant<A>\n readonly _E: Types.Covariant<E>\n readonly _R: Types.Covariant<R>\n }\n readonly ast: Ast\n}\n\n/**\n * Any node, whatever it succeeds or fails with and whatever it requires.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Any = Node<unknown, unknown, any>\n\n/**\n * The success type of a node.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Success<N> = N extends Node<infer A, infer _E, infer _R> ? A : never\n\n/**\n * The error type of a node.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Error<N> = N extends Node<infer _A, infer E, infer _R> ? E : never\n\n/**\n * The requirements of a node: what has to be provided wherever it is finally\n * executed, and nothing that has to be provided to build it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Services<N> = N extends Node<infer _A, infer _E, infer R> ? R : never\n\n/**\n * The node reference a branch arm's symbolic subject carries. Arms are built\n * before the graph assigns ids, so every reference an arm records names this\n * placeholder, and graph building rewrites it to the branch's own upstream\n * node \u2014 which is `first`, structurally, and therefore not a guess.\n *\n * @since 0.1.0\n * @category constants\n * @slop\n */\nexport const branchSubject = \"branch/subject\"\n\n/** @private */\nconst subjectsKey = Symbol.for(\"@smthrs/plan/Node/subjects/v1\")\nconst globals = globalThis as typeof globalThis & { [subjectsKey]?: { branch: number; catch: number } }\nconst subjects = globals[subjectsKey] ??= { branch: 0, catch: 0 }\n\n/**\n * The prefix of the node reference a catch failure arm's symbolic error\n * carries. Each {@link catch_} mints its own token under this prefix, so an\n * outer error captured inside a nested failure arm keeps naming the outer\n * catch, and graph building rewrites each token to the node that catch\n * protects.\n *\n * @since 0.1.0\n * @category constants\n * @slop\n */\nexport const catchSubject = \"catch/subject\"\n\n/**\n * The two arms of a decision plus the predicate that chooses between them.\n *\n * `if` runs at RUN time on the real value. `then` and `else` run at PLAN time,\n * once each, against a {@link module:Planned.Planned} placeholder \u2014 they\n * describe topology, so they may pass the value on but never compute on it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface BranchOptions<A, B1, E1, R1, B2, E2, R2> {\n readonly if: (value: A) => boolean\n readonly then: (value: Planned.Planned<A>) => Node<B1, E1, R1>\n readonly else: (value: Planned.Planned<A>) => Node<B2, E2, R2>\n}\n\n/**\n * The statically planned recovery arm and optional schema selecting which\n * typed failures it handles.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface CatchOptions<E, B, E2, R2 = never, Handled = E> {\n readonly error?: Schema.Schema<Handled> | undefined\n readonly onFailure: (error: Planned.Planned<Handled>) => Node<B, E2, R2>\n}\n\n/**\n * Checks whether a value is a node.\n *\n * A node this package built is recognized by registration at construction. A\n * node that crossed a serialization boundary, an object sharing the node\n * prototype whose own `ast` is a well-formed AST, is recognized by that shape,\n * because `@smthrs/flow` hands a rehydrated AST back as a node and its side\n * tables are all a round trip loses. The {@link TypeId} marker is a public\n * string any object can carry, so it counts for nothing on its own: every\n * combinator that admits a node reads its `ast` as trusted topology, and an\n * object carrying the marker on any other prototype, one inheriting it from a\n * node, and one whose `ast` is missing, malformed, cyclic, or an accessor are\n * all refused with the same `GraphBuildError` as any other non-node. A proxy\n * is judged by the shape it forwards: one that forwards a node unchanged\n * passes, and one that diverges from it does not.\n *\n * @since 0.1.0\n * @category guards\n * @slop\n */\nexport const isNode = (value: unknown): value is Any => internal.isNode(value)\n\n/**\n * The inert value delivered by {@link succeed}. Planned references resolve to\n * their result type; other values follow the payload's JSON projection.\n * Invalid dates serialize to null. Members without a JSON representation are\n * omitted from objects and replaced with null in arrays.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Succeed<A> = A extends Planned.Planned<infer Value> ? Value\n : A extends Date ? string | null\n : A extends { toJSON: (...args: any) => infer Value } ? Succeed<Value>\n : A extends (...args: any) => any ? undefined\n : A extends symbol ? undefined\n : A extends ReadonlyArray<unknown> ? { [K in keyof A]: SucceedArrayMember<A[K]> }\n : A extends object ? {\n [K in keyof A as K extends string | number ? [Succeed<A[K]>] extends [undefined] ? never : K : never]: Succeed<\n A[K]\n >\n }\n : A\n\n/** @private */\ntype SucceedArrayMember<A> = A extends Planned.Planned<infer Value> ? Value\n : A extends unknown ? Succeed<A> extends infer Value ? Value extends undefined ? null : Value\n : never\n : never\n\n/**\n * A node that succeeds with the constant's inert JSON projection.\n *\n * Dates produce strings (or null for invalid dates), URLs produce strings,\n * and callable object members are omitted. Use {@link map} to reconstruct a\n * domain value explicitly after this serialization boundary.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const succeed = <A>(value: A): Node<Succeed<A>> => internal.makeNode<Succeed<A>>(internal.succeed(value))\n\n/**\n * The inert error delivered by {@link fail}: the same JSON projection\n * {@link Succeed} describes, because a plan stores an error exactly as it\n * stores a value.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Fail<E> = Succeed<E>\n\n/**\n * A node that fails with the constant's inert JSON projection, in the typed\n * error channel.\n *\n * It is how a plan states a refusal it already knows about \u2014 an unsupported\n * input, an exhausted budget, a compensation that has nothing left to undo \u2014\n * without an action that exists only to fail. {@link catch} recovers it exactly\n * as it recovers an action's failure, and an uncaught one is the flow's typed\n * failure.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const fail = <E>(error: E): Node<never, Fail<E>> => internal.makeNode<never, Fail<E>>(internal.fail(error))\n\n/**\n * Combines independent children into one node, keyed by name.\n *\n * Width is fixed here, at plan time. Fanning out over something a step\n * discovered is not this: end the round and carry the list in the next flow's\n * payload, where it is real data.\n *\n * @since 0.1.0\n * @category constructors\n * @slop\n */\nexport const all = <const Nodes extends Readonly<Record<string, Any>>>(\n nodes: Nodes\n): Node<\n Types.Simplify<{ readonly [K in keyof Nodes]: Success<Nodes[K]> }>,\n Error<Nodes[keyof Nodes]>,\n Services<Nodes[keyof Nodes]>\n> => internal.makeNode(internal.all(memberAsts(nodes, \"all\", \"invalid_all_member\")))\n\n/**\n * The member ASTs of a combination, keyed by name, refusing a non-node member.\n *\n * @private\n */\nconst memberAsts = (\n nodes: Readonly<Record<string, unknown>>,\n combinator: string,\n code: \"invalid_all_member\" | \"invalid_join\"\n): Record<string, Ast> => {\n const asts: Record<string, Ast> = Object.create(null) as Record<string, Ast>\n for (const [member, node] of Object.entries(nodes)) {\n if (!isNode(node)) {\n throw new GraphBuildError({\n code,\n node: member,\n path: [],\n message: `Node.${combinator} expected a Node at member \"${member}\"`\n })\n }\n Object.defineProperty(asts, member, {\n configurable: true,\n enumerable: true,\n value: node.ast,\n writable: true\n })\n }\n return asts\n}\n\n/**\n * Builds a join that settles early, refusing a member set it could never\n * decide on.\n *\n * @private\n */\nconst join = (mode: internal.RaceMode, count: number, nodes: Readonly<Record<string, unknown>>): Ast => {\n const asts = memberAsts(nodes, mode, \"invalid_join\")\n const width = Object.keys(asts).length\n if (!internal.isRaceCount(mode, count, width)) {\n throw new GraphBuildError({\n code: \"invalid_join\",\n node: mode,\n path: [],\n message: mode === \"quorum\"\n ? `Node.quorum needs a whole number of successes between 1 and its ${width} members, got ${String(count)}`\n : `Node.${mode} needs at least one member`\n })\n }\n return internal.race(mode, count, asts)\n}\n\n/**\n * The members of an early-settling join, keyed by name.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Members = Readonly<Record<string, Any>>\n\n/**\n * Settles with the first member to settle, success or typed failure.\n *\n * The other members are interrupted. The winner is journaled, so a resumed run\n * settles the same member and never starts the others again.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const race = <const Nodes extends Members>(\n nodes: Nodes\n): Node<Success<Nodes[keyof Nodes]>, Error<Nodes[keyof Nodes]>, Services<Nodes[keyof Nodes]>> =>\n internal.makeNode(join(\"race\", 1, nodes))\n\n/**\n * Settles with the first member to succeed, ignoring typed failures while a\n * member is still running.\n *\n * It fails with the last failure when every member fails. The other members\n * are interrupted, and the winner is journaled as {@link race} journals it.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const any = <const Nodes extends Members>(\n nodes: Nodes\n): Node<Success<Nodes[keyof Nodes]>, Error<Nodes[keyof Nodes]>, Services<Nodes[keyof Nodes]>> =>\n internal.makeNode(join(\"any\", 1, nodes))\n\n/**\n * Succeeds once `count` members succeed, with exactly those members' values\n * keyed by name.\n *\n * It fails with the failure that leaves fewer than `count` members able to\n * succeed. Either way the members still running are interrupted, and the\n * members that decided are journaled as {@link race} journals its winner.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const quorum = <const Nodes extends Members>(\n count: number,\n nodes: Nodes\n): Node<\n Types.Simplify<{ readonly [K in keyof Nodes]?: Success<Nodes[K]> }>,\n Error<Nodes[keyof Nodes]>,\n Services<Nodes[keyof Nodes]>\n> => internal.makeNode(join(\"quorum\", count, nodes))\n\n/**\n * Transforms an eventual success value with a deferred pure function.\n *\n * The function is digested, not run: it executes later, on the real value.\n * This is where computation on a step result belongs \u2014 and only computation. A\n * `map` that decides what happens next is a `branch` written wrongly.\n *\n * @since 0.1.0\n * @category mapping\n * @slop\n */\nexport const map: {\n <A, B>(f: (a: A) => B): <E, R>(self: Node<A, E, R>) => Node<B, E, R>\n <A, E, R, B>(self: Node<A, E, R>, f: (a: A) => B): Node<B, E, R>\n} = dual(\n 2,\n <A, E, R, B>(self: Node<A, E, R>, f: (a: A) => B): Node<B, E, R> =>\n internal.makeNode<B, E, R>(internal.map(self.ast, (value) => f(value as A), f))\n)\n\n/**\n * Starts the entire next subtree only after this node succeeds, without\n * consuming its result. Failure or interruption prevents that subtree from\n * starting, including actions nested inside combinations or inline flows.\n *\n * Use {@link bindPlanned} to build a dependency from a symbolic result, or\n * {@link map} to compute on the eventual value.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nexport const andThen: {\n <B, E2, R2>(next: Node<B, E2, R2>): <A, E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(self: Node<A, E, R>, next: Node<B, E2, R2>): Node<B, E | E2, R | R2>\n} = dual(\n 2,\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n next: Node<B, E2, R2>\n ): Node<B, E | E2, R | R2> => {\n if (!isNode(next)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: \"andThen/next\",\n path: [],\n message:\n \"Node.andThen expects a Node; use Node.bindPlanned for a symbolic builder or Node.map for value computation\"\n })\n }\n return internal.makeNode<B, E | E2, R | R2>(internal.andThenNode(self.ast, next.ast))\n }\n)\n\n/**\n * Builds a dependency using a symbolic reference to this node's future result.\n *\n * The builder runs during planning. Its argument is a {@link module:Planned.Planned}\n * reference, not the value the node will eventually produce. Pass references\n * into action payloads; use {@link branch} for decisions and {@link map} for\n * computation on real results. JavaScript truthiness and reference equality\n * cannot inspect a planned result. Enable type-aware ESLint's\n * `@typescript-eslint/strict-boolean-expressions` to reject planned conditions.\n * Independent descendants of the built subtree can start while this producer\n * is running; consumers of its reference wait for its value. Use\n * {@link andThen} when the whole next subtree must wait for success.\n *\n * @since 1.0.0\n * @category sequencing\n */\nexport const bindPlanned: {\n <A, B, E2, R2>(\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): <E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): Node<B, E | E2, R | R2>\n} = dual(\n 2,\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): Node<B, E | E2, R | R2> =>\n internal.makeNode<B, E | E2, R | R2>(\n internal.andThen(self.ast, (value) => build(value as Planned.Planned<A>), build)\n )\n)\n\n/**\n * Builds one arm, once, against the symbolic subject.\n *\n * @private\n */\nconst arm = <A, B, E, R>(\n build: (value: Planned.Planned<A>) => Node<B, E, R>,\n subject: Planned.Planned<A>,\n side: string\n): Ast => {\n const node = build(subject)\n if (!isNode(node)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: `${branchSubject}/${side}`,\n path: [],\n message: `Node.branch expected its \"${side}\" arm to return a Node`\n })\n }\n return node.ast\n}\n\n/**\n * Decides between two arms, both of them static topology.\n *\n * Each arm builder is evaluated exactly once, here, against a\n * {@link module:Planned.Planned} placeholder, and the resulting ASTs are what\n * the node stores \u2014 so a plan shows the exit condition and both continuations\n * before it runs. The predicate is digested and evaluated at run time on the\n * real value, which is why none of the plan-time placeholder machinery leaks\n * into control flow.\n *\n * Both arms contribute their requirements, because both arms are topology the\n * plan carries. A run takes one of them, but which one is not known until the\n * predicate sees the real value, so an execution has to be able to take either.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nexport const branch: {\n <A, B1, E1, R1, B2, E2, R2>(\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): <E, R>(self: Node<A, E, R>) => Node<B1 | B2, E | E1 | E2, R | R1 | R2>\n <A, E, R, B1, E1, R1, B2, E2, R2>(\n self: Node<A, E, R>,\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): Node<B1 | B2, E | E1 | E2, R | R1 | R2>\n} = dual(\n 2,\n <A, E, R, B1, E1, R1, B2, E2, R2>(\n self: Node<A, E, R>,\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): Node<B1 | B2, E | E1 | E2, R | R1 | R2> => {\n const predicate = options.if\n const subjectToken = `${branchSubject}/${subjects.branch++}`\n const subject = Planned.make<A>(subjectToken)\n return internal.makeNode<B1 | B2, E | E1 | E2, R | R1 | R2>(\n internal.branch(\n subjectToken,\n self.ast,\n (value) => predicate(value as A),\n predicate,\n arm(options.then, subject, \"then\"),\n arm(options.else, subject, \"else\")\n )\n )\n }\n)\n\n/**\n * Recovers from matching typed failures with static failure topology.\n *\n * The protected graph and failure arm are both stored in the AST. The arm is\n * built once at plan time against a strict planned error placeholder. With no\n * schema the whole typed error channel is handled. A schema handles only the\n * values it accepts, so its overloads retain E: a refinement can reject values\n * without narrowing its TypeScript type. Runtime schema callbacks enter the\n * filter identity along with its JSON Schema. Uncaptured callbacks are local\n * to this process, just like uncaptured mappers.\n *\n * The failure arm contributes its requirements to the node's, for the same\n * reason a branch's arms do: it is topology the plan carries, and a run reaches\n * it whenever the protected graph fails.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nconst catch_: {\n <Handled, B, E2, R2>(\n options: CatchOptions<unknown, B, E2, R2, Handled> & {\n readonly error: Schema.Schema<Handled>\n }\n ): <A, E, R>(self: Node<A, E, R>) => Node<A | B, E | E2, R | R2>\n <E, B, E2, R2>(\n options: CatchOptions<E, B, E2, R2> & {\n readonly error?: undefined\n }\n ): <A, R>(self: Node<A, E, R>) => Node<A | B, E2, R | R2>\n <A, E, R, Handled, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2, Handled> & {\n readonly error: Schema.Schema<Handled>\n }\n ): Node<A | B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2> & {\n readonly error?: undefined\n }\n ): Node<A | B, E2, R | R2>\n} = dual(\n 2,\n <A, E, R, Handled, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2, Handled>\n ): Node<A | B, E | E2, R | R2> => {\n const subjectToken = `${catchSubject}/${subjects.catch++}`\n const failure = options.onFailure(Planned.make<Handled>(subjectToken))\n if (!isNode(failure)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: catchSubject,\n path: [],\n message: \"Node.catch expected its failure arm to return a Node\"\n })\n }\n return internal.makeNode(internal.catch_(subjectToken, self.ast, failure.ast, options.error))\n }\n)\n\nexport { catch_ as catch }\n\n/**\n * Attaches a scheduling priority to a node, leaving the original unchanged.\n *\n * The scheduler runs ready work with a higher number first, so a priority\n * changes LATENCY and nothing else. It never enters key material: a node\n * ordered ahead of another still computes the same result, so re-keying it\n * would throw away a legitimate cache hit. Children inherit the value\n * lexically when the graph is built, and a child that states its own keeps it.\n *\n * @since 0.1.0\n * @category annotations\n * @slop\n */\nexport const priority: {\n (value: number): <A, E, R>(self: Node<A, E, R>) => Node<A, E, R>\n <A, E, R>(self: Node<A, E, R>, value: number): Node<A, E, R>\n} = dual(\n 2,\n <A, E, R>(self: Node<A, E, R>, value: number): Node<A, E, R> => {\n if (!Number.isSafeInteger(value)) {\n throw new GraphBuildError({\n code: \"invalid_priority\",\n node: self.ast._tag,\n path: [],\n message: `Node.priority expects a safe integer, received ${value}`\n })\n }\n return internal.makeNode<A, E, R>(internal.withPriority(self.ast, value))\n }\n)\n\n/**\n * Reads the scheduling priority a node carries, or `undefined` when it states\n * none and inherits from whatever encloses it.\n *\n * @since 0.1.0\n * @category accessors\n * @slop\n */\nexport const declaredPriority = (ast: Ast): number | undefined => ast.priority\n\n/**\n * Constructs the flow-call node used by `@smthrs/flow` without making flow\n * calls part of the public authoring surface of this package.\n *\n * Reserved for `@smthrs/flow`, which owns flow authoring. It is not part\n * of this package's authoring surface, and it validates nothing: an unknown\n * flow tag becomes a call node the graph keeps as a leaf.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const flowCall = <A = unknown, E = never, R = never>(\n declaration: unknown,\n flow: string,\n mode: CallMode,\n payload: unknown\n): Node<A, E, R> => internal.makeNode<A, E, R>(internal.flowCall(declaration, flow, mode, payload))\n\n/**\n * Constructs the action-call node used by `@smthrs/flow` without making\n * action calls part of the public authoring surface of this package.\n *\n * Reserved for `@smthrs/flow`, which owns action authoring. It is not part\n * of this package's authoring surface, and an unknown action tag becomes a\n * call node the graph keeps as a leaf.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const actionCall = <A = unknown, E = never, R = never>(\n declaration: unknown,\n action: string,\n payload: unknown\n): Node<A, E, R> => internal.makeNode<A, E, R>(internal.actionCall(declaration, action, payload))\n\n/**\n * Reads the flow or action declaration a call node names, so `@smthrs/flow`\n * can expand a call it recorded. It is `undefined` for an AST that was\n * rehydrated from JSON, because the declaration lives beside the AST rather\n * than inside it \u2014 a graph built from such an AST keeps the call as a leaf.\n *\n * Reserved for `@smthrs/flow`, which files the declaration when it builds\n * the call. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const declaration = (\n ast: Extract<Ast, { readonly _tag: \"ActionCall\" | \"FlowCall\" }>\n): unknown => internal.declaration(ast)\n\n/**\n * Reads the continuation builder of a sequenced node, which graph building\n * evaluates once against a placeholder. It is `undefined` when the author\n * supplied a node directly \u2014 the topology is already in `next` \u2014 and for a\n * rehydrated AST, whose side table did not survive serialization.\n *\n * Reserved for `@smthrs/flow`'s graph walk. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const continuation = (\n ast: Extract<Ast, { readonly _tag: \"AndThen\" }>\n): ((value: Planned.Planned<unknown>) => unknown) | undefined => internal.operation(ast)\n\n/**\n * Reads the deferred mapper of a {@link map} node, which a driver applies to\n * the real upstream value once it has one. It is `undefined` for every other\n * variant, and for a rehydrated AST whose side table did not survive\n * serialization.\n *\n * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const mapper = (ast: Ast): ((value: unknown) => unknown) | undefined =>\n ast._tag === \"Map\" ? internal.operation(ast) : undefined\n\n/**\n * Reads the run-time predicate of a {@link branch} node, which a driver\n * evaluates on the real subject value to choose an arm. It is `undefined` for\n * every other variant, and for a rehydrated AST whose side table did not\n * survive serialization.\n *\n * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const predicate = (ast: Ast): ((value: unknown) => boolean) | undefined =>\n ast._tag === \"Branch\" ? internal.predicate(ast) : undefined\n\n/**\n * Reads the optional schema selecting failures handled by a {@link catch_}.\n *\n * Reserved for `@smthrs/flow`'s interpreter. It is `undefined` for every\n * variant but `catch_`, and for a rehydrated AST whose side table did not\n * survive serialization.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const catchFilter = (ast: Ast): Schema.Top | undefined => ast._tag === \"Catch\" ? internal.filter(ast) : undefined\n\n/**\n * Identifies a plan-time function the AST does NOT store, a flow's `body`,\n * exactly as the AST identifies the mapper and continuation it does store.\n * A call that keeps its callee as a leaf still has to re-key when that\n * callee's body is edited, and this is the identity it folds in. Unannotated\n * functions fail closed with process-local identity; use {@link capture} to\n * declare inert captures and obtain deterministic identity.\n *\n * Reserved for `@smthrs/flow`, which folds a callee body's identity into a\n * call it keeps as a leaf. Authors never call it; it throws a `TypeError`\n * when handed anything but a function.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const functionIdentity = (operation: unknown): FunctionIdentity => internal.functionIdentity(operation)\n\n/**\n * Binds a frozen plain copy of inert captures as the callback's this receiver.\n *\n * Use a function expression to read the snapshot while keeping the ordinary\n * callback arguments: Node.capture({ factor: 3 }, function(value: number) {\n * return value * this.factor\n * }). Caller objects remain unchanged; lexical aliases still name originals\n * and must not be used as mutable semantic inputs. Nested captures retain the\n * inner callback's snapshot and compose the two identities.\n *\n * Admission walks original descriptors once, rejects built-in brands and\n * non-plain prototypes without evaluating getters, then uses structuredClone\n * to refuse Proxies. Hosts without that API refuse object capture. Only the\n * owned frozen copy enters identity and the wrapper. Sealed, non-extensible,\n * frozen and Immer ordinary data are supported equally. Unsupported values\n * raise a TypeError naming the path. See core docs/api.md#nodecapture for the\n * complete algorithm and the migration from original-object locking.\n *\n * @category constructors\n * @since 0.1.0\n * @slop\n */\nexport const capture = <C extends Readonly<Record<string, unknown>>, Args extends ReadonlyArray<unknown>, A>(\n captures: C,\n operation: (this: Readonly<C>, ...args: Args) => A\n): (...args: Args) => A => internal.capture(captures, operation)\n"],
5
+ "mappings": "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",
6
+ "names": ["predicate", "declaration"]
7
+ }
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Where a node runs, declared.
3
+ *
4
+ * This is the ONE placement model. `@smthrs/core` re-exports it, `@smthrs/flow`
5
+ * annotates with it, and `@smthrs/registry` lowers a descriptor's frontmatter
6
+ * literal into it. It used to be a typed enum in `@smthrs/core` and an opaque
7
+ * `Schema.Unknown` in `@smthrs/flow`, with a cast in the registry standing
8
+ * between them, so a directive lost its type the moment it crossed a package.
9
+ *
10
+ * It lives here because `KeyMaterial.placement` is the field it ends up in, and
11
+ * `@smthrs/plan` is the lowest package core, flow and the registry all depend
12
+ * on. A placement is serializable detail that identifies a host profile; it
13
+ * never contains a host implementation, credentials, or any other runtime
14
+ * handle.
15
+ *
16
+ * The four tags still read `flows/core/Placement/...`. They are hashed into
17
+ * `KeyMaterial.placement` and therefore into the step key of every node that
18
+ * declares a placement, so retagging them would re-key production work and
19
+ * miss its cached results. The tag is a wire value, not a location.
20
+ *
21
+ * @since 1.0.0-rc.0
22
+ */
23
+ import * as Context from "effect/Context";
24
+ import * as Data from "effect/Data";
25
+ /**
26
+ * Serializable host-selection details. These fields identify a host profile;
27
+ * they never contain a host implementation, credentials, or other runtime
28
+ * handle.
29
+ *
30
+ * @category models
31
+ * @since 1.0.0-rc.0
32
+ */
33
+ export interface Options {
34
+ readonly image?: string | undefined;
35
+ readonly profile?: string | undefined;
36
+ readonly target?: string | undefined;
37
+ }
38
+ /**
39
+ * A serializable directive describing where a flow node should run.
40
+ *
41
+ * @category models
42
+ * @since 1.0.0-rc.0
43
+ */
44
+ export type Placement = Data.TaggedEnum<{
45
+ readonly "flows/core/Placement/Local": Readonly<Record<never, never>>;
46
+ readonly "flows/core/Placement/Client": Readonly<Record<never, never>>;
47
+ readonly "flows/core/Placement/Sandbox": Options;
48
+ readonly "flows/core/Placement/Remote": Options;
49
+ }>;
50
+ /**
51
+ * Creates a placement directive for the local process host.
52
+ *
53
+ * @category constructors
54
+ * @since 1.0.0-rc.0
55
+ */
56
+ export declare const local: () => Placement;
57
+ /**
58
+ * Creates a placement directive for the viewer's browser host.
59
+ *
60
+ * @category constructors
61
+ * @since 1.0.0-rc.0
62
+ */
63
+ export declare const client: () => Placement;
64
+ /**
65
+ * Creates a placement directive for an isolated sandbox host.
66
+ *
67
+ * @category constructors
68
+ * @since 1.0.0-rc.0
69
+ */
70
+ export declare const sandbox: (options?: Options) => Placement;
71
+ /**
72
+ * Creates a placement directive for a remote control-plane host.
73
+ *
74
+ * @category constructors
75
+ * @since 1.0.0-rc.0
76
+ */
77
+ export declare const remote: (options?: Options) => Placement;
78
+ /**
79
+ * The annotation key a declared placement is carried under.
80
+ *
81
+ * One key, here, because both graph builders read it: `@smthrs/core` publishes
82
+ * it as `Annotations.Placement` and `@smthrs/flow` as `Flow.Placement`. While
83
+ * they were two keys with two value types, crossing between them was a cast.
84
+ *
85
+ * @category annotations
86
+ * @since 1.0.0-rc.0
87
+ */
88
+ export declare const Annotation: Context.Service<{
89
+ readonly _tag: "flows/core/Placement/Local";
90
+ } | {
91
+ readonly _tag: "flows/core/Placement/Client";
92
+ } | {
93
+ readonly _tag: "flows/core/Placement/Sandbox";
94
+ readonly image?: string | undefined | undefined;
95
+ readonly profile?: string | undefined | undefined;
96
+ readonly target?: string | undefined | undefined;
97
+ } | {
98
+ readonly _tag: "flows/core/Placement/Remote";
99
+ readonly image?: string | undefined | undefined;
100
+ readonly profile?: string | undefined | undefined;
101
+ readonly target?: string | undefined | undefined;
102
+ }, {
103
+ readonly _tag: "flows/core/Placement/Local";
104
+ } | {
105
+ readonly _tag: "flows/core/Placement/Client";
106
+ } | {
107
+ readonly _tag: "flows/core/Placement/Sandbox";
108
+ readonly image?: string | undefined | undefined;
109
+ readonly profile?: string | undefined | undefined;
110
+ readonly target?: string | undefined | undefined;
111
+ } | {
112
+ readonly _tag: "flows/core/Placement/Remote";
113
+ readonly image?: string | undefined | undefined;
114
+ readonly profile?: string | undefined | undefined;
115
+ readonly target?: string | undefined | undefined;
116
+ }>;
117
+ //# sourceMappingURL=Placement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Placement.d.ts","sourceRoot":"","sources":["../../src/Placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAEnC;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;IACtC,QAAQ,CAAC,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;IACrE,QAAQ,CAAC,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;IACtE,QAAQ,CAAC,8BAA8B,EAAE,OAAO,CAAA;IAChD,QAAQ,CAAC,6BAA6B,EAAE,OAAO,CAAA;CAChD,CAAC,CAAA;AAIF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,QAAO,SAAyD,CAAA;AAElF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,QAAO,SAA0D,CAAA;AAEpF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,UAAS,OAAY,KAAG,SACc,CAAA;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,UAAS,OAAY,KAAG,SAAwE,CAAA;AAEvH;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;;;;;;qBA/DJ,MAAM,GAAG,SAAS;uBAChB,MAAM,GAAG,SAAS;sBACnB,MAAM,GAAG,SAAS;;;qBAFnB,MAAM,GAAG,SAAS;uBAChB,MAAM,GAAG,SAAS;sBACnB,MAAM,GAAG,SAAS;;;;;;;qBAFnB,MAAM,GAAG,SAAS;uBAChB,MAAM,GAAG,SAAS;sBACnB,MAAM,GAAG,SAAS;;;qBAFnB,MAAM,GAAG,SAAS;uBAChB,MAAM,GAAG,SAAS;sBACnB,MAAM,GAAG,SAAS;EA6DwC,CAAA"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var Placement_exports = {};
30
+ __export(Placement_exports, {
31
+ Annotation: () => Annotation,
32
+ client: () => client,
33
+ local: () => local,
34
+ remote: () => remote,
35
+ sandbox: () => sandbox
36
+ });
37
+ module.exports = __toCommonJS(Placement_exports);
38
+ var Context = __toESM(require("effect/Context"), 1);
39
+ var Data = __toESM(require("effect/Data"), 1);
40
+ const constructors = Data.taggedEnum();
41
+ const local = () => constructors["flows/core/Placement/Local"]();
42
+ const client = () => constructors["flows/core/Placement/Client"]();
43
+ const sandbox = (options = {}) => constructors["flows/core/Placement/Sandbox"]({ ...options });
44
+ const remote = (options = {}) => constructors["flows/core/Placement/Remote"]({ ...options });
45
+ const Annotation = Context.Service("@smthrs/plan/Placement");
46
+ //# sourceMappingURL=Placement.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Placement.ts"],
4
+ "sourcesContent": ["/**\n * Where a node runs, declared.\n *\n * This is the ONE placement model. `@smthrs/core` re-exports it, `@smthrs/flow`\n * annotates with it, and `@smthrs/registry` lowers a descriptor's frontmatter\n * literal into it. It used to be a typed enum in `@smthrs/core` and an opaque\n * `Schema.Unknown` in `@smthrs/flow`, with a cast in the registry standing\n * between them, so a directive lost its type the moment it crossed a package.\n *\n * It lives here because `KeyMaterial.placement` is the field it ends up in, and\n * `@smthrs/plan` is the lowest package core, flow and the registry all depend\n * on. A placement is serializable detail that identifies a host profile; it\n * never contains a host implementation, credentials, or any other runtime\n * handle.\n *\n * The four tags still read `flows/core/Placement/...`. They are hashed into\n * `KeyMaterial.placement` and therefore into the step key of every node that\n * declares a placement, so retagging them would re-key production work and\n * miss its cached results. The tag is a wire value, not a location.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Context from \"effect/Context\"\nimport * as Data from \"effect/Data\"\n\n/**\n * Serializable host-selection details. These fields identify a host profile;\n * they never contain a host implementation, credentials, or other runtime\n * handle.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport interface Options {\n readonly image?: string | undefined\n readonly profile?: string | undefined\n readonly target?: string | undefined\n}\n\n/**\n * A serializable directive describing where a flow node should run.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type Placement = Data.TaggedEnum<{\n readonly \"flows/core/Placement/Local\": Readonly<Record<never, never>>\n readonly \"flows/core/Placement/Client\": Readonly<Record<never, never>>\n readonly \"flows/core/Placement/Sandbox\": Options\n readonly \"flows/core/Placement/Remote\": Options\n}>\n\nconst constructors = Data.taggedEnum<Placement>()\n\n/**\n * Creates a placement directive for the local process host.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const local = (): Placement => constructors[\"flows/core/Placement/Local\"]()\n\n/**\n * Creates a placement directive for the viewer's browser host.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const client = (): Placement => constructors[\"flows/core/Placement/Client\"]()\n\n/**\n * Creates a placement directive for an isolated sandbox host.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const sandbox = (options: Options = {}): Placement =>\n constructors[\"flows/core/Placement/Sandbox\"]({ ...options })\n\n/**\n * Creates a placement directive for a remote control-plane host.\n *\n * @category constructors\n * @since 1.0.0-rc.0\n */\nexport const remote = (options: Options = {}): Placement => constructors[\"flows/core/Placement/Remote\"]({ ...options })\n\n/**\n * The annotation key a declared placement is carried under.\n *\n * One key, here, because both graph builders read it: `@smthrs/core` publishes\n * it as `Annotations.Placement` and `@smthrs/flow` as `Flow.Placement`. While\n * they were two keys with two value types, crossing between them was a cast.\n *\n * @category annotations\n * @since 1.0.0-rc.0\n */\nexport const Annotation = Context.Service<Placement>(\"@smthrs/plan/Placement\")\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBA,cAAyB;AACzB,WAAsB;AA6BtB,MAAM,eAAe,KAAK,WAAsB;AAQzC,MAAM,QAAQ,MAAiB,aAAa,4BAA4B,EAAE;AAQ1E,MAAM,SAAS,MAAiB,aAAa,6BAA6B,EAAE;AAQ5E,MAAM,UAAU,CAAC,UAAmB,CAAC,MAC1C,aAAa,8BAA8B,EAAE,EAAE,GAAG,QAAQ,CAAC;AAQtD,MAAM,SAAS,CAAC,UAAmB,CAAC,MAAiB,aAAa,6BAA6B,EAAE,EAAE,GAAG,QAAQ,CAAC;AAY/G,MAAM,aAAa,QAAQ,QAAmB,wBAAwB;",
6
+ "names": []
7
+ }