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

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 @@
1
+ {"version":3,"file":"Planned.js","sourceRoot":"","sources":["../../src/Planned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;AAoDvE;;;;;;GAMG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAsB;IAC5C,CAAC,MAAM,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAC1C,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,UAAU,EAAE,UAAU,CAAC;IACxB,CAAC,QAAQ,EAAE,QAAQ,CAAC;CACrB,CAAC,CAAA;AAEF,eAAe;AACf,MAAM,QAAQ,GAAG,CAAC,SAAoB,EAAU,EAAE,CAChD,SAAS,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AAEhG;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,SAAoB,EAAE,SAAiB,EAAmB,EAAE,CAC1E,IAAI,eAAe,CAAC;IAClB,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,SAAS,CAAC,IAAI;IACpB,IAAI,EAAE,SAAS,CAAC,IAAI;IACpB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AI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAe,CAAA;AAElG,eAAe;AACf,MAAM,OAAO,GAAG,CAAC,KAAc,EAA8C,EAAE,CAC7E,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,OAAO,KAAK,KAAK,UAAU,CAAA;AAE9E,eAAe;AACf,MAAM,cAAc,GAAG,CAAC,KAAc,EAAsB,EAAE,CAC5D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;IAC3C,OAAQ,KAAmB,CAAC,IAAI,KAAK,QAAQ,IAAK,KAAmB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;IACrF,KAAK,CAAC,OAAO,CAAE,KAAmB,CAAC,IAAI,CAAC;IACxC,KAAK,CAAC,IAAI,CAAE,KAAmB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAA;AAEvF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAyB,EAAE;IACjE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACrC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1D,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAA6B,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,SAAS,CAAA","sourcesContent":["/**\n * The placeholder a body sees where a step result will be.\n *\n * A flow body runs at PLAN time, so its\n * own payload is real data while every step result is a value that does not\n * exist yet. That value has a name and one rule: a planned value may be **passed** — into a payload field,\n * into a branch, into a map — and field access is allowed, because it records a\n * reference path. It may never be **computed on**.\n *\n * {@link Planned} is branded, so arithmetic is a compile error.\n * {@link make} returns a strict proxy\n * whose `Symbol.toPrimitive`, `valueOf`, `toString`, `toJSON`, and call traps\n * throw {@link module:GraphBuildError.GraphBuildError} rather than let a plan be\n * built around `NaN` or `\"[object Object]\"`. The lenient proxy this adapts\n * (`@smthrs/core`'s `Graph.plannedValue`) answered `toPrimitive` with a\n * readable string, which is exactly the silent-wrong-plan path this module\n * exists to close.\n *\n * JavaScript does not expose traps for `Boolean(value)` or strict identity\n * (`value === other`), so those operations cannot be refused at run time.\n * They reveal only proxy truthiness or identity and never the planned result;\n * authors must use {@link module:Node.branch} for decisions on real values.\n * Type-aware ESLint `@typescript-eslint/strict-boolean-expressions` rejects\n * planned conditions, but does not reject explicit Boolean coercion or all\n * reference comparisons. Those still require review.\n *\n * @since 0.1.0\n */\n\nimport type * as Types from \"effect/Types\"\nimport { GraphBuildError } from \"./GraphBuildError.ts\"\n\n/**\n * The brand carried by every planned value, and the key its reference is read\n * from. Interned with `Symbol.for` so a value that crossed a module boundary is\n * still recognised. The interned symbol is a recognition aid, not a\n * capability, so {@link reference} validates the value stored under it.\n *\n * @since 0.1.0\n * @category symbols\n * @slop\n */\nexport const TypeId: unique symbol = Symbol.for(\"@smthrs/plan/Planned\")\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @category symbols\n * @slop\n */\nexport type TypeId = typeof TypeId\n\n/**\n * What a planned value points at: the node that will produce the result, and\n * the property path read from it. `path` is empty for the result itself.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface Reference {\n readonly node: string\n readonly path: ReadonlyArray<string>\n}\n\n/**\n * A {@link Reference} plus the phantom type of the value it stands for, so\n * `Planned<string>` and `Planned<number>` are not interchangeable.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface Identity<out T> extends Reference {\n readonly _T: Types.Covariant<T>\n}\n\n/**\n * A step result that has not been produced yet.\n *\n * The brand rejects arithmetic and ordinary value arguments. The mapped half keeps field\n * access typed — `result.files` is a `Planned` of the field, which is what\n * makes \"pass it on, never compute on it\" expressible rather than merely\n * documented.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Planned<T> =\n & { readonly [TypeId]: Identity<T> }\n & ([T] extends [object] ? { readonly [K in keyof T]: Planned<T[K]> } : unknown)\n\n/**\n * The operations that are computation rather than reference, keyed by the\n * property that performs them. `toJSON` is here because `JSON.stringify` reads\n * it, and a plan that serialized a placeholder would look correct.\n *\n * @private\n */\nconst refusals = new Map<PropertyKey, string>([\n [Symbol.toPrimitive, \"Symbol.toPrimitive\"],\n [\"valueOf\", \"valueOf\"],\n [\"toString\", \"toString\"],\n [\"toJSON\", \"toJSON\"]\n])\n\n/** @private */\nconst describe = (reference: Reference): string =>\n reference.path.length === 0 ? reference.node : `${reference.node}.${reference.path.join(\".\")}`\n\n/**\n * The one refusal this module raises. The guidance is spelled out rather than\n * linked because the author reading it is inside a body and needs the\n * correction on the spot.\n *\n * @private\n */\nconst refuse = (reference: Reference, operation: string): GraphBuildError =>\n new GraphBuildError({\n code: \"planned_value_computed\",\n node: reference.node,\n path: reference.path,\n message: `Planned value ${describe(reference)} was computed at plan time by ${operation}. ` +\n \"Use Node.map to compute, Node.branch to decide, or pass the value into a payload.\"\n })\n\n/**\n * The proxy itself. `_T` of {@link Identity} is a phantom and never exists at\n * run time, so the trap carries the plain {@link Reference}.\n *\n * @private\n */\nconst placeholder = (reference: Reference): unknown => {\n /* v8 ignore next -- a Proxy application always enters the `apply` trap below, so the callable target is unreachable by construction */\n const target = (): undefined => undefined\n return new Proxy(target, {\n get: (_target, key) => {\n if (key === TypeId) return reference\n const refusal = refusals.get(key)\n if (refusal !== undefined) throw refuse(reference, refusal)\n // Not a thenable: a body that returns a planned value inside a promise\n // must resolve to the placeholder, not hang awaiting a proxy.\n if (key === \"then\") return undefined\n return placeholder({ node: reference.node, path: [...reference.path, String(key)] })\n },\n apply: () => {\n throw refuse(reference, \"function application\")\n },\n has: () => {\n throw refuse(reference, \"property existence (`in`)\")\n },\n ownKeys: () => {\n throw refuse(reference, \"property enumeration\")\n }\n })\n}\n\n/**\n * Creates the strict placeholder standing for a node's result.\n *\n * Planning hands one of these to every builder that consumes an upstream\n * value — a branch arm, a continuation — and reads the {@link Reference} back\n * off whatever the builder passed it into.\n *\n * @since 0.1.0\n * @category constructors\n * @slop\n */\nexport const make = <T>(node: string): Planned<T> => placeholder({ node, path: [] }) as Planned<T>\n\n/** @private */\nconst carrier = (value: unknown): value is { readonly [TypeId]?: Reference } =>\n (typeof value === \"object\" && value !== null) || typeof value === \"function\"\n\n/** @private */\nconst validReference = (value: unknown): value is Reference =>\n typeof value === \"object\" && value !== null &&\n typeof (value as Reference).node === \"string\" && (value as Reference).node.length > 0 &&\n Array.isArray((value as Reference).path) &&\n Array.from((value as Reference).path).every((segment) => typeof segment === \"string\")\n\n/**\n * Reads the reference a planned value records, or `undefined` for anything\n * else. An interned symbol is a recognition aid rather than a capability, so a\n * forged carrier is accepted only when its node and path have the complete\n * reference shape. This is how a payload is scanned for the upstream results\n * it consumes.\n *\n * @since 0.1.0\n * @category accessors\n * @slop\n */\nexport const reference = (value: unknown): Reference | undefined => {\n if (!carrier(value)) return undefined\n const candidate = value[TypeId]\n return validReference(candidate) ? candidate : undefined\n}\n\n/**\n * Checks whether a value is a planned placeholder.\n *\n * @since 0.1.0\n * @category guards\n * @slop\n */\nexport const isPlanned = (value: unknown): value is Planned<unknown> => reference(value) !== undefined\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What a bounded repetition does when it reaches its ceiling.
3
+ *
4
+ * This is the ONE ceiling vocabulary. `@smthrs/flow`'s `Poll.make` takes it as
5
+ * `onTimeout`, for the attempt a poll gives up on, and `@smthrs/patterns`'
6
+ * `Loop` takes it as `onMaxReached`, for the iteration a loop gives up on. It
7
+ * was the same two words written out in both packages, with no edge between
8
+ * them, so a third member added on one side would have been invisible to the
9
+ * other. It lives here because `@smthrs/plan` is the package both already
10
+ * depend on.
11
+ *
12
+ * @since 1.0.0-rc.0
13
+ */
14
+ import * as Schema from "effect/Schema";
15
+ /**
16
+ * What a bounded repetition answers with at its ceiling: `fail` raises the
17
+ * repetition's own typed failure, and `return-last` settles with the last
18
+ * value it produced.
19
+ *
20
+ * @category models
21
+ * @since 1.0.0-rc.0
22
+ */
23
+ export declare const AtCeiling: Schema.Literals<readonly ["fail", "return-last"]>;
24
+ /**
25
+ * The value form of {@link AtCeiling}.
26
+ *
27
+ * @category models
28
+ * @since 1.0.0-rc.0
29
+ */
30
+ export type AtCeiling = typeof AtCeiling.Type;
31
+ //# sourceMappingURL=Repetition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Repetition.d.ts","sourceRoot":"","sources":["../../src/Repetition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,mDAA2C,CAAA;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * What a bounded repetition does when it reaches its ceiling.
3
+ *
4
+ * This is the ONE ceiling vocabulary. `@smthrs/flow`'s `Poll.make` takes it as
5
+ * `onTimeout`, for the attempt a poll gives up on, and `@smthrs/patterns`'
6
+ * `Loop` takes it as `onMaxReached`, for the iteration a loop gives up on. It
7
+ * was the same two words written out in both packages, with no edge between
8
+ * them, so a third member added on one side would have been invisible to the
9
+ * other. It lives here because `@smthrs/plan` is the package both already
10
+ * depend on.
11
+ *
12
+ * @since 1.0.0-rc.0
13
+ */
14
+ import * as Schema from "effect/Schema";
15
+ /**
16
+ * What a bounded repetition answers with at its ceiling: `fail` raises the
17
+ * repetition's own typed failure, and `return-last` settles with the last
18
+ * value it produced.
19
+ *
20
+ * @category models
21
+ * @since 1.0.0-rc.0
22
+ */
23
+ export const AtCeiling = Schema.Literals(["fail", "return-last"]);
24
+ //# sourceMappingURL=Repetition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Repetition.js","sourceRoot":"","sources":["../../src/Repetition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA","sourcesContent":["/**\n * What a bounded repetition does when it reaches its ceiling.\n *\n * This is the ONE ceiling vocabulary. `@smthrs/flow`'s `Poll.make` takes it as\n * `onTimeout`, for the attempt a poll gives up on, and `@smthrs/patterns`'\n * `Loop` takes it as `onMaxReached`, for the iteration a loop gives up on. It\n * was the same two words written out in both packages, with no edge between\n * them, so a third member added on one side would have been invisible to the\n * other. It lives here because `@smthrs/plan` is the package both already\n * depend on.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Schema from \"effect/Schema\"\n\n/**\n * What a bounded repetition answers with at its ceiling: `fail` raises the\n * repetition's own typed failure, and `return-last` settles with the last\n * value it produced.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport const AtCeiling = Schema.Literals([\"fail\", \"return-last\"])\n\n/**\n * The value form of {@link AtCeiling}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type AtCeiling = typeof AtCeiling.Type\n"]}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Shared ready-work admission policy. This module decides priority, aging,
3
+ * deterministic ties, and step/agent capacity. It does not decide which nodes
4
+ * are ready, evaluate branches, launch effects, or own execution lifetimes.
5
+ * Those decisions must use the compiled graph and the caller's activation
6
+ * state before presenting candidates here.
7
+ *
8
+ * @since 1.0.0
9
+ */
10
+ import type * as Plan from "./Plan.ts";
11
+ /**
12
+ * Admission limits, independent of graph width and provider capacity.
13
+ * Omitted limits are unbounded within JavaScript's safe-integer range.
14
+ *
15
+ * @since 1.0.0
16
+ * @category models
17
+ */
18
+ export interface Concurrency {
19
+ readonly steps?: number | undefined;
20
+ readonly agents?: number | undefined;
21
+ }
22
+ /**
23
+ * Currently held permits. Every agent also holds a step permit.
24
+ *
25
+ * @since 1.0.0
26
+ * @category models
27
+ */
28
+ export interface Usage {
29
+ readonly steps: number;
30
+ readonly agents: number;
31
+ }
32
+ /**
33
+ * The part of a plan node admission reads. Declared once here so the three
34
+ * places that name it, {@link Candidate}, {@link Admission} and
35
+ * {@link Policy.admit}, cannot drift apart.
36
+ */
37
+ type Schedulable = Pick<Plan.PlanNode, "id" | "kind" | "priority">;
38
+ /**
39
+ * A ready node's scheduling state. `order` is its position in the compiled
40
+ * plan, not arrival order. `waited` counts capacity-constrained admission
41
+ * passes, not wall-clock time.
42
+ *
43
+ * @since 1.0.0
44
+ * @category models
45
+ */
46
+ export interface Candidate<N extends Schedulable = Plan.PlanNode> {
47
+ readonly node: N;
48
+ readonly order: number;
49
+ readonly waited: number;
50
+ }
51
+ /**
52
+ * One admission decision. Deferred candidates carry their incremented age;
53
+ * admitted candidates retain their age for dispatch diagnostics. No input is
54
+ * mutated and neither array owns or freezes the caller's node values.
55
+ *
56
+ * @since 1.0.0
57
+ * @category models
58
+ */
59
+ export interface Admission<N extends Schedulable = Plan.PlanNode> {
60
+ readonly admitted: ReadonlyArray<Candidate<N>>;
61
+ readonly deferred: ReadonlyArray<Candidate<N>>;
62
+ readonly agents: number;
63
+ }
64
+ /**
65
+ * Pure policy shared by execution coordinators.
66
+ *
67
+ * @since 1.0.0
68
+ * @category models
69
+ */
70
+ export interface Policy {
71
+ readonly limits: Usage;
72
+ readonly admit: <N extends Schedulable>(ready: ReadonlyArray<Candidate<N>>, active: Usage) => Admission<N>;
73
+ }
74
+ /**
75
+ * Snapshots validated limits. Admission orders by declared priority plus age,
76
+ * using exact integer arithmetic even when their sum exceeds MAX_SAFE_INTEGER.
77
+ * Ties preserve compiled plan order. An agent blocked by its subset cap does
78
+ * not prevent ordinary ready work from using spare step capacity.
79
+ *
80
+ * Invalid candidate/permit state is refused before any decision is returned.
81
+ * At MAX_SAFE_INTEGER the age saturates; a bounded plan cannot require that
82
+ * many capacity-constrained passes to drain finite work.
83
+ *
84
+ * @since 1.0.0
85
+ * @category constructors
86
+ */
87
+ export declare const make: (concurrency?: Concurrency) => Policy;
88
+ export {};
89
+ //# sourceMappingURL=Scheduling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scheduling.d.ts","sourceRoot":"","sources":["../../src/Scheduling.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC;AAED;;;;;GAKG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;GAIG;AACH,KAAK,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,UAAU,CAAC,CAAA;AAElE;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,CAAC,QAAQ;IAC9D,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;IAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,CAAC,QAAQ;IAC9D,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,WAAW,EACpC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAClC,MAAM,EAAE,KAAK,KACV,SAAS,CAAC,CAAC,CAAC,CAAA;CAClB;AASD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,GAAI,cAAa,WAAgB,KAAG,MAiDpD,CAAA"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Shared ready-work admission policy. This module decides priority, aging,
3
+ * deterministic ties, and step/agent capacity. It does not decide which nodes
4
+ * are ready, evaluate branches, launch effects, or own execution lifetimes.
5
+ * Those decisions must use the compiled graph and the caller's activation
6
+ * state before presenting candidates here.
7
+ *
8
+ * @since 1.0.0
9
+ */
10
+ const integer = (name, value, minimum) => {
11
+ if (!Number.isSafeInteger(value) || value < minimum) {
12
+ throw new RangeError(`${name} must be a ${minimum === 1 ? "positive" : "non-negative"} safe integer`);
13
+ }
14
+ return value;
15
+ };
16
+ /**
17
+ * Snapshots validated limits. Admission orders by declared priority plus age,
18
+ * using exact integer arithmetic even when their sum exceeds MAX_SAFE_INTEGER.
19
+ * Ties preserve compiled plan order. An agent blocked by its subset cap does
20
+ * not prevent ordinary ready work from using spare step capacity.
21
+ *
22
+ * Invalid candidate/permit state is refused before any decision is returned.
23
+ * At MAX_SAFE_INTEGER the age saturates; a bounded plan cannot require that
24
+ * many capacity-constrained passes to drain finite work.
25
+ *
26
+ * @since 1.0.0
27
+ * @category constructors
28
+ */
29
+ export const make = (concurrency = {}) => {
30
+ const limits = Object.freeze({
31
+ steps: integer("concurrency.steps", concurrency.steps ?? Number.MAX_SAFE_INTEGER, 1),
32
+ agents: integer("concurrency.agents", concurrency.agents ?? Number.MAX_SAFE_INTEGER, 1)
33
+ });
34
+ const admit = (ready, active) => {
35
+ integer("active.steps", active.steps, 0);
36
+ integer("active.agents", active.agents, 0);
37
+ if (active.agents > active.steps)
38
+ throw new RangeError("active.agents cannot exceed active.steps");
39
+ const ids = new Set();
40
+ const positions = new Set();
41
+ const ranked = ready.map((candidate) => {
42
+ const { node, order, waited } = candidate;
43
+ integer("candidate.order", order, 0);
44
+ integer("candidate.waited", waited, 0);
45
+ if (!Number.isSafeInteger(node.priority))
46
+ throw new RangeError("candidate.priority must be a safe integer");
47
+ if (node.kind !== "step" && node.kind !== "agent" && node.kind !== "merge") {
48
+ throw new RangeError("invalid candidate kind");
49
+ }
50
+ if (typeof node.id !== "string" || node.id === "" || ids.has(node.id)) {
51
+ throw new RangeError("candidate ids must be non-empty and unique");
52
+ }
53
+ if (positions.has(order))
54
+ throw new RangeError("candidate plan positions must be unique");
55
+ ids.add(node.id);
56
+ positions.add(order);
57
+ return { candidate, priority: BigInt(node.priority) + BigInt(waited) };
58
+ });
59
+ ranked.sort((left, right) => left.priority === right.priority
60
+ ? left.candidate.order - right.candidate.order
61
+ : left.priority > right.priority
62
+ ? -1
63
+ : 1);
64
+ const admitted = [];
65
+ const deferred = [];
66
+ let agents = 0;
67
+ for (const { candidate } of ranked) {
68
+ const isAgent = candidate.node.kind === "agent";
69
+ if (admitted.length >= limits.steps - active.steps || (isAgent && agents >= limits.agents - active.agents)) {
70
+ deferred.push(Object.freeze({ ...candidate, waited: Math.min(Number.MAX_SAFE_INTEGER, candidate.waited + 1) }));
71
+ }
72
+ else {
73
+ admitted.push(Object.freeze({ ...candidate }));
74
+ if (isAgent)
75
+ agents++;
76
+ }
77
+ }
78
+ return Object.freeze({ admitted: Object.freeze(admitted), deferred: Object.freeze(deferred), agents });
79
+ };
80
+ return Object.freeze({ limits, admit });
81
+ };
82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AAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IACxG,CAAC,CAAA;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AACzC,CAAC,CAAA","sourcesContent":["/**\n * Shared ready-work admission policy. This module decides priority, aging,\n * deterministic ties, and step/agent capacity. It does not decide which nodes\n * are ready, evaluate branches, launch effects, or own execution lifetimes.\n * Those decisions must use the compiled graph and the caller's activation\n * state before presenting candidates here.\n *\n * @since 1.0.0\n */\n\nimport type * as Plan from \"./Plan.ts\"\n\n/**\n * Admission limits, independent of graph width and provider capacity.\n * Omitted limits are unbounded within JavaScript's safe-integer range.\n *\n * @since 1.0.0\n * @category models\n */\nexport interface Concurrency {\n readonly steps?: number | undefined\n readonly agents?: number | undefined\n}\n\n/**\n * Currently held permits. Every agent also holds a step permit.\n *\n * @since 1.0.0\n * @category models\n */\nexport interface Usage {\n readonly steps: number\n readonly agents: number\n}\n\n/**\n * The part of a plan node admission reads. Declared once here so the three\n * places that name it, {@link Candidate}, {@link Admission} and\n * {@link Policy.admit}, cannot drift apart.\n */\ntype Schedulable = Pick<Plan.PlanNode, \"id\" | \"kind\" | \"priority\">\n\n/**\n * A ready node's scheduling state. `order` is its position in the compiled\n * plan, not arrival order. `waited` counts capacity-constrained admission\n * passes, not wall-clock time.\n *\n * @since 1.0.0\n * @category models\n */\nexport interface Candidate<N extends Schedulable = Plan.PlanNode> {\n readonly node: N\n readonly order: number\n readonly waited: number\n}\n\n/**\n * One admission decision. Deferred candidates carry their incremented age;\n * admitted candidates retain their age for dispatch diagnostics. No input is\n * mutated and neither array owns or freezes the caller's node values.\n *\n * @since 1.0.0\n * @category models\n */\nexport interface Admission<N extends Schedulable = Plan.PlanNode> {\n readonly admitted: ReadonlyArray<Candidate<N>>\n readonly deferred: ReadonlyArray<Candidate<N>>\n readonly agents: number\n}\n\n/**\n * Pure policy shared by execution coordinators.\n *\n * @since 1.0.0\n * @category models\n */\nexport interface Policy {\n readonly limits: Usage\n readonly admit: <N extends Schedulable>(\n ready: ReadonlyArray<Candidate<N>>,\n active: Usage\n ) => Admission<N>\n}\n\nconst integer = (name: string, value: number, minimum: number): number => {\n if (!Number.isSafeInteger(value) || value < minimum) {\n throw new RangeError(`${name} must be a ${minimum === 1 ? \"positive\" : \"non-negative\"} safe integer`)\n }\n return value\n}\n\n/**\n * Snapshots validated limits. Admission orders by declared priority plus age,\n * using exact integer arithmetic even when their sum exceeds MAX_SAFE_INTEGER.\n * Ties preserve compiled plan order. An agent blocked by its subset cap does\n * not prevent ordinary ready work from using spare step capacity.\n *\n * Invalid candidate/permit state is refused before any decision is returned.\n * At MAX_SAFE_INTEGER the age saturates; a bounded plan cannot require that\n * many capacity-constrained passes to drain finite work.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const make = (concurrency: Concurrency = {}): Policy => {\n const limits = Object.freeze({\n steps: integer(\"concurrency.steps\", concurrency.steps ?? Number.MAX_SAFE_INTEGER, 1),\n agents: integer(\"concurrency.agents\", concurrency.agents ?? Number.MAX_SAFE_INTEGER, 1)\n })\n const admit: Policy[\"admit\"] = (ready, active) => {\n integer(\"active.steps\", active.steps, 0)\n integer(\"active.agents\", active.agents, 0)\n if (active.agents > active.steps) throw new RangeError(\"active.agents cannot exceed active.steps\")\n const ids = new Set<string>()\n const positions = new Set<number>()\n const ranked = ready.map((candidate) => {\n const { node, order, waited } = candidate\n integer(\"candidate.order\", order, 0)\n integer(\"candidate.waited\", waited, 0)\n if (!Number.isSafeInteger(node.priority)) throw new RangeError(\"candidate.priority must be a safe integer\")\n if (node.kind !== \"step\" && node.kind !== \"agent\" && node.kind !== \"merge\") {\n throw new RangeError(\"invalid candidate kind\")\n }\n if (typeof node.id !== \"string\" || node.id === \"\" || ids.has(node.id)) {\n throw new RangeError(\"candidate ids must be non-empty and unique\")\n }\n if (positions.has(order)) throw new RangeError(\"candidate plan positions must be unique\")\n ids.add(node.id)\n positions.add(order)\n return { candidate, priority: BigInt(node.priority) + BigInt(waited) }\n })\n ranked.sort((left, right) =>\n left.priority === right.priority\n ? left.candidate.order - right.candidate.order\n : left.priority > right.priority\n ? -1\n : 1\n )\n const admitted: Array<typeof ready[number]> = []\n const deferred: Array<typeof ready[number]> = []\n let agents = 0\n for (const { candidate } of ranked) {\n const isAgent = candidate.node.kind === \"agent\"\n if (admitted.length >= limits.steps - active.steps || (isAgent && agents >= limits.agents - active.agents)) {\n deferred.push(Object.freeze({ ...candidate, waited: Math.min(Number.MAX_SAFE_INTEGER, candidate.waited + 1) }))\n } else {\n admitted.push(Object.freeze({ ...candidate }))\n if (isAgent) agents++\n }\n }\n return Object.freeze({ admitted: Object.freeze(admitted), deferred: Object.freeze(deferred), agents })\n }\n return Object.freeze({ limits, admit })\n}\n"]}
@@ -0,0 +1,333 @@
1
+ /**
2
+ * The KeyMaterial → step-key compiler.
3
+ *
4
+ * Revived from the deleted `packages/smithers/flows/keys/src/StepKey.ts`. Two
5
+ * deliberate deviations from the original:
6
+ *
7
+ * 1. **It lives here, not in `@smthrs/keys`.** That package owns generic
8
+ * derivation and stored-key validation; a compiler that understands plan
9
+ * material belongs above it.
10
+ * 2. **It produces `@smthrs/keys` `StoredKey` values, not a second `sk1_` digest
11
+ * format.** The original minted its own prefix over a private `Digest`
12
+ * module. The engine dispatches under `StoredKey` (`FlowEngine/ActionKey.ts`),
13
+ * so a plan whose node keys were a *different* string format could never be
14
+ * the thing the cache is consulted against, and that is the whole point of
15
+ * a `Plan`. One key format, one hashing
16
+ * chokepoint (canonical JSON + injected `Crypto`), one namespace field
17
+ * (`kind`) distinguishing content keys from ordinal ones.
18
+ *
19
+ * Everything the original earned is kept: nominally branded digest inputs (a
20
+ * literal that merely *looks* like `{digest}` hashes as a literal), set
21
+ * normalization, the separate environment namespace, per-variant tagging of
22
+ * resolved references, and the hashed `version`.
23
+ *
24
+ * Governing contract: the step-key rules at
25
+ * https://smithers.sh/docs/concepts/content-addressing.
26
+ *
27
+ * @since 0.1.0
28
+ */
29
+ import { type StoredKey } from "@smthrs/keys";
30
+ import * as Cause from "effect/Cause";
31
+ import type * as Crypto from "effect/Crypto";
32
+ import * as Effect from "effect/Effect";
33
+ import * as Schema from "effect/Schema";
34
+ import type * as FileSet from "./FileSet.ts";
35
+ import type * as KeyMaterial from "./KeyMaterial.ts";
36
+ /**
37
+ * A computed step key. Identical in representation to any other flow key —
38
+ * `key1_` plus a SHA-256 digest of the canonical serialization of the material.
39
+ *
40
+ * @since 0.1.0
41
+ * @category models
42
+ * @slop
43
+ */
44
+ export type StepKey = StoredKey;
45
+ /**
46
+ * The nominal brand carried by every {@link DigestInput}. Kept private: the
47
+ * only way to produce a value bearing it is {@link digestInput}, so a plain
48
+ * value that merely happens to look like `{ digest: "..." }` — actions pass
49
+ * content hashes around as ordinary data — can never be mistaken for a genuine
50
+ * upstream-result digest reference. This closes a step-key collision where
51
+ * shape-sniffing (`"digest" in value`) hashed the two identically.
52
+ *
53
+ * @since 0.1.0
54
+ * @category symbols
55
+ */
56
+ declare const DigestInputTypeId: unique symbol;
57
+ /**
58
+ * Which kind of graph reference a {@link DigestInput} stands for. Declared
59
+ * once here so the field on `DigestInput` and the parameter of
60
+ * {@link digestInput} name one set and cannot drift apart.
61
+ */
62
+ type GraphReference = "ref" | "pending" | "ref-projected";
63
+ /**
64
+ * A precomputed digest supplied as a step input rather than a literal value.
65
+ *
66
+ * @since 0.1.0
67
+ * @category models
68
+ * @slop
69
+ */
70
+ export interface DigestInput {
71
+ readonly [DigestInputTypeId]: typeof DigestInputTypeId;
72
+ readonly digest: string;
73
+ /**
74
+ * Which kind of graph reference resolved to this digest.
75
+ *
76
+ * Carrying the discriminator on the digest input keeps `normalizeInputs` the
77
+ * single normalizer: it wraps every variant once, and the variants stay
78
+ * mutually distinct because they differ in this field rather than in a
79
+ * hand-built object a second wrap would hide.
80
+ */
81
+ readonly reference?: GraphReference;
82
+ /** The projection applied to the referenced result, for `ref-projected`. */
83
+ readonly path?: ReadonlyArray<string>;
84
+ }
85
+ /**
86
+ * Nominally tags a precomputed digest so it is hashed as a digest reference
87
+ * rather than a literal value.
88
+ *
89
+ * @since 0.1.0
90
+ * @category constructors
91
+ * @slop
92
+ */
93
+ export declare const digestInput: (digest: string, reference?: {
94
+ readonly reference: GraphReference;
95
+ readonly path?: ReadonlyArray<string>;
96
+ }) => DigestInput;
97
+ /**
98
+ * Type guard for values produced by {@link digestInput}.
99
+ *
100
+ * @since 0.1.0
101
+ * @category guards
102
+ * @slop
103
+ */
104
+ export declare const isDigestInput: (value: unknown) => value is DigestInput;
105
+ /**
106
+ * The engine-resolved execution environment a content key is computed under,
107
+ * hashed in its OWN namespace rather than merged into the caller's `layers`
108
+ * and `capabilities`.
109
+ *
110
+ * Three properties matter and none survives a merge:
111
+ *
112
+ * 1. **Non-aliasing.** Concatenating environment material onto the caller's
113
+ * made `caller{fs:["a"]} + env{fs:["b"]}` hash identically to
114
+ * `caller{fs:["a","b"]} + env{}` — a cross-run collision in the very
115
+ * material whose purpose is preventing one.
116
+ * 2. **Declared vs undeclared.** `declared: false` is not the same value as
117
+ * `declared: true` with empty sets.
118
+ * 3. **Composition order.** Environment layers retain declaration order,
119
+ * because plugin and service composition order can change behavior. The
120
+ * caller-owned `ContentIdentity.layers` stays set-normalized.
121
+ *
122
+ * `runScope` is set only when `declared` is `false`: it pins the key to one
123
+ * run, so a step whose environment identity is unknown can never serve a
124
+ * cross-run hit. The union enforces this for typed callers; both
125
+ * {@link content} and {@link dispatchIdentity} validate it at run time.
126
+ *
127
+ * @since 0.1.0
128
+ * @category models
129
+ * @slop
130
+ */
131
+ export type EnvironmentIdentity = typeof EnvironmentIdentity.Type;
132
+ /**
133
+ * Validated, copyable runtime environment identity. Layer order matters;
134
+ * capability patterns are set-like. Unknown fields are not identity material.
135
+ * @since 1.0.0
136
+ * @category schemas
137
+ */
138
+ export declare const EnvironmentIdentity: Schema.Union<readonly [Schema.Struct<{
139
+ readonly declared: Schema.Literal<true>;
140
+ readonly layers: Schema.$Array<Schema.String>;
141
+ readonly capabilities: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
142
+ readonly runScope: Schema.optionalKey<Schema.Undefined>;
143
+ }>, Schema.Struct<{
144
+ readonly declared: Schema.Literal<false>;
145
+ readonly layers: Schema.$Array<Schema.String>;
146
+ readonly capabilities: Schema.$Record<Schema.String, Schema.$Array<Schema.String>>;
147
+ readonly runScope: Schema.NonEmptyString;
148
+ }>]>;
149
+ /**
150
+ * Caller-owned memoization context for projected dependency-value digests.
151
+ *
152
+ * This is the flows counterpart of Bazel's `ActionKeyContext`: one context is
153
+ * passed through related key computations so shared input material is hashed
154
+ * once. Concurrent requests for the same projection share the in-flight
155
+ * digest. Entries are sound only while each settled `from` value is immutable;
156
+ * callers must create a fresh memo when those values can change.
157
+ *
158
+ * @since 0.1.0
159
+ * @category models
160
+ * @slop
161
+ */
162
+ export interface DigestMemo {
163
+ readonly digest: (from: string, path: ReadonlyArray<string>, compute: Effect.Effect<StepKey, Schema.SchemaError, Crypto.Crypto>) => Effect.Effect<StepKey, Schema.SchemaError, Crypto.Crypto>;
164
+ }
165
+ /**
166
+ * Creates an empty projected-value digest memo. Projection addresses are
167
+ * JSON-encoded `[from, path]` tuples so segment boundaries are unambiguous.
168
+ *
169
+ * @since 0.1.0
170
+ * @category constructors
171
+ * @slop
172
+ */
173
+ export declare const makeDigestMemo: () => DigestMemo;
174
+ /**
175
+ * Material describing a sealed or hermetic content-addressed step.
176
+ *
177
+ * @since 0.1.0
178
+ * @category models
179
+ * @slop
180
+ */
181
+ export interface ContentIdentity {
182
+ readonly body: unknown;
183
+ readonly inputs: Readonly<Record<string, unknown | DigestInput>>;
184
+ readonly layers: ReadonlyArray<string>;
185
+ readonly capabilities: Readonly<Record<string, ReadonlyArray<string>>>;
186
+ readonly environment?: EnvironmentIdentity | undefined;
187
+ readonly hermetic?: {
188
+ readonly readSet: ReadonlyArray<{
189
+ readonly path: string;
190
+ readonly digest: string;
191
+ }>;
192
+ readonly writeSet: ReadonlyArray<FileSet.Entry>;
193
+ readonly removes?: ReadonlyArray<string> | undefined;
194
+ readonly boundaryMode: FileSet.BoundaryMode;
195
+ } | undefined;
196
+ }
197
+ /**
198
+ * Material describing the run-local identity of a non-cacheable step.
199
+ *
200
+ * @since 0.1.0
201
+ * @category models
202
+ * @slop
203
+ */
204
+ export interface OrdinalIdentity {
205
+ readonly runId: string;
206
+ readonly parentScope?: string | undefined;
207
+ readonly ordinal: number;
208
+ readonly tier: "compensable" | "irreversible" | "unsealed";
209
+ }
210
+ declare const KeyMaterialError_base: Schema.Class<KeyMaterialError, Schema.TaggedStruct<"@smthrs/plan/KeyMaterialError", {
211
+ readonly code: Schema.Literals<readonly ["invalid_environment", "missing_dependency", "non_content_material"]>;
212
+ readonly message: Schema.String;
213
+ }>, Cause.YieldableError>;
214
+ /**
215
+ * Stable failures while resolving graph-local dependency references.
216
+ *
217
+ * @since 0.1.0
218
+ * @category errors
219
+ * @slop
220
+ */
221
+ export declare class KeyMaterialError extends KeyMaterialError_base {
222
+ }
223
+ /**
224
+ * Fingerprint for binding one execution to its runtime environment, not an
225
+ * action dispatch key. Uses the same normalization as content/dispatch keys.
226
+ * An omitted environment is distinct from declared-empty and run-scoped ones.
227
+ * @since 1.0.0
228
+ * @category constructors
229
+ */
230
+ export declare const environmentIdentity: (environment?: EnvironmentIdentity) => Effect.Effect<StoredKey, KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
231
+ /**
232
+ * Produces a cross-run reusable key for a sealed or hermetic step. Set-like
233
+ * declarations are normalized before serialization; write declarations remain
234
+ * part of the identity even when the step writes nothing.
235
+ *
236
+ * @since 0.1.0
237
+ * @category constructors
238
+ * @slop
239
+ */
240
+ export declare const content: (identity: ContentIdentity) => Effect.Effect<StepKey, KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
241
+ /**
242
+ * Produces a run-local ordinal key for compensable, irreversible, or unsealed
243
+ * work. These keys intentionally cannot be reused across runs.
244
+ *
245
+ * @since 0.1.0
246
+ * @category constructors
247
+ * @slop
248
+ */
249
+ export declare const ordinal: (identity: OrdinalIdentity) => Effect.Effect<StepKey, Schema.SchemaError, Crypto.Crypto>;
250
+ /**
251
+ * Resolves graph-local references to dependency digests and constructs a
252
+ * sealed content key. Use {@link planIdentity} to compile any effect tier.
253
+ *
254
+ * This is the handoff the Flow Builder Brief describes: the planner hands over
255
+ * a topologically ordered sequence of `{ nodeId, material }`, and for each one
256
+ * the compiler substitutes every `Ref`/`Pending` with the *already computed
257
+ * key of the referenced node*. Structural node ids are lookup addresses only
258
+ * and never enter the hashed value — rename a node and nothing re-keys; change
259
+ * what a node consumes and everything downstream of it does.
260
+ *
261
+ * @since 0.1.0
262
+ * @category constructors
263
+ * @slop
264
+ */
265
+ export declare const fromKeyMaterial: (material: KeyMaterial.KeyMaterial, dependencyDigests: Readonly<Record<string, string>>) => Effect.Effect<StepKey, KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
266
+ /**
267
+ * Identifies a declaration in a plan, independently of whether its execution
268
+ * can be cached. Sealed material retains its existing content-key format;
269
+ * compensable and irreversible material use a distinct, tier-bearing plan
270
+ * namespace. These fingerprints bind approvals, not cross-run result reuse.
271
+ * Dispatch non-cacheable work under a run-local {@link ordinal} instead.
272
+ *
273
+ * @since 1.0.0
274
+ * @category constructors
275
+ */
276
+ export declare const planIdentity: (material: KeyMaterial.KeyMaterial, dependencyDigests: Readonly<Record<string, string>>) => Effect.Effect<StepKey, KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
277
+ /**
278
+ * Projects a settled result along a `Ref` path. Only own data properties
279
+ * resolve, so a missing, inherited, or accessor segment yields `undefined`
280
+ * without invoking a getter. This is a stable, distinct value: a projection that
281
+ * walks off the end of a result is a fact about the graph, not a failure.
282
+ * `undefined` drops out of the canonical form, so it hashes distinctly from
283
+ * every JSON value including `null`.
284
+ *
285
+ * Exported because it is the ONE projection semantics for the value channel:
286
+ * {@link dispatchIdentity} digests what this returns, so every consumer that
287
+ * resolves a `Ref` at execution time must resolve it the same way, or two
288
+ * inputs that key identically could be consumed differently — a stale-hit
289
+ * vector.
290
+ *
291
+ * @since 0.1.0
292
+ * @category utilities
293
+ * @slop
294
+ */
295
+ export declare const project: (value: unknown, path: ReadonlyArray<string>) => unknown;
296
+ /**
297
+ * The key a dispatch is *cached* under, as distinct from the plan key a node
298
+ * is *identified* by.
299
+ *
300
+ * A plan key folds the resolved keys of every upstream node, transitively, so
301
+ * an edit anywhere upstream re-keys everything below it — even when the edited
302
+ * node's output value is byte for byte what it was before. Bazel does not work
303
+ * that way: `ActionCacheChecker` keys an action by the *content* of its
304
+ * inputs, so an unchanged output stops invalidation dead. The file channel in
305
+ * flows already had that property through the measured boundary digests; the
306
+ * JSON value channel did not, and this is what gives it one.
307
+ *
308
+ * The derivation folds the node's OWN material — body, version, effects,
309
+ * placement, layers, capabilities — and never an upstream key. Each material
310
+ * input contributes content instead: a `Literal` its value, a `Ref` the digest
311
+ * of the settled result of `from` projected along `path`, and a `Pending`
312
+ * nothing beyond its tag. The measured hermetic boundary is folded unchanged.
313
+ *
314
+ * `results` must hold every dependency the material names. The scheduler's
315
+ * halt rule guarantees it: a dependent of failed or skipped work never
316
+ * dispatches, so a `Ref` always resolves against a success.
317
+ *
318
+ * @since 0.1.0
319
+ * @category constructors
320
+ * @slop
321
+ */
322
+ export declare const dispatchIdentity: (options: {
323
+ readonly material: KeyMaterial.KeyMaterial;
324
+ /** The settled output value of each dependency, by node id. */
325
+ readonly results: Readonly<Record<string, unknown>>;
326
+ readonly hermetic: NonNullable<ContentIdentity["hermetic"]>;
327
+ /** The engine-resolved execution environment this dispatch runs under. */
328
+ readonly environment?: EnvironmentIdentity | undefined;
329
+ /** Reuses projected-value digests while the corresponding settled values remain immutable. */
330
+ readonly digestMemo?: DigestMemo | undefined;
331
+ }) => Effect.Effect<StepKey, KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
332
+ export {};
333
+ //# sourceMappingURL=StepKey.d.ts.map
@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