@smthrs/plan 1.0.0-rc.8 → 1.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/cjs/Effects.d.ts +29 -11
  2. package/dist/cjs/Effects.d.ts.map +1 -1
  3. package/dist/cjs/Effects.js.map +2 -2
  4. package/dist/cjs/FileSet.d.ts +121 -51
  5. package/dist/cjs/FileSet.d.ts.map +1 -1
  6. package/dist/cjs/FileSet.js.map +2 -2
  7. package/dist/cjs/GraphBuildError.d.ts +2 -4
  8. package/dist/cjs/GraphBuildError.d.ts.map +1 -1
  9. package/dist/cjs/GraphBuildError.js.map +2 -2
  10. package/dist/cjs/KeyMaterial.d.ts +13 -8
  11. package/dist/cjs/KeyMaterial.d.ts.map +1 -1
  12. package/dist/cjs/KeyMaterial.js.map +2 -2
  13. package/dist/cjs/Plan.d.ts +72 -23
  14. package/dist/cjs/Plan.d.ts.map +1 -1
  15. package/dist/cjs/Plan.js +3 -0
  16. package/dist/cjs/Plan.js.map +2 -2
  17. package/dist/cjs/PlanDiff.d.ts +7 -3
  18. package/dist/cjs/PlanDiff.d.ts.map +1 -1
  19. package/dist/cjs/PlanDiff.js.map +2 -2
  20. package/dist/cjs/StepKey.d.ts +38 -17
  21. package/dist/cjs/StepKey.d.ts.map +1 -1
  22. package/dist/cjs/StepKey.js.map +2 -2
  23. package/dist/esm/Effects.d.ts +29 -11
  24. package/dist/esm/Effects.d.ts.map +1 -1
  25. package/dist/esm/Effects.js +18 -7
  26. package/dist/esm/Effects.js.map +1 -1
  27. package/dist/esm/FileSet.d.ts +121 -51
  28. package/dist/esm/FileSet.d.ts.map +1 -1
  29. package/dist/esm/FileSet.js +97 -35
  30. package/dist/esm/FileSet.js.map +1 -1
  31. package/dist/esm/GraphBuildError.d.ts +2 -4
  32. package/dist/esm/GraphBuildError.d.ts.map +1 -1
  33. package/dist/esm/GraphBuildError.js +2 -3
  34. package/dist/esm/GraphBuildError.js.map +1 -1
  35. package/dist/esm/KeyMaterial.d.ts +13 -8
  36. package/dist/esm/KeyMaterial.d.ts.map +1 -1
  37. package/dist/esm/KeyMaterial.js +11 -4
  38. package/dist/esm/KeyMaterial.js.map +1 -1
  39. package/dist/esm/Plan.d.ts +72 -23
  40. package/dist/esm/Plan.d.ts.map +1 -1
  41. package/dist/esm/Plan.js +61 -16
  42. package/dist/esm/Plan.js.map +1 -1
  43. package/dist/esm/PlanDiff.d.ts +7 -3
  44. package/dist/esm/PlanDiff.d.ts.map +1 -1
  45. package/dist/esm/PlanDiff.js +0 -1
  46. package/dist/esm/PlanDiff.js.map +1 -1
  47. package/dist/esm/StepKey.d.ts +38 -17
  48. package/dist/esm/StepKey.d.ts.map +1 -1
  49. package/dist/esm/StepKey.js +33 -11
  50. package/dist/esm/StepKey.js.map +1 -1
  51. package/docs/guides/diff-two-plans.md +78 -1
  52. package/package.json +4 -4
  53. package/src/Effects.ts +29 -11
  54. package/src/FileSet.ts +121 -51
  55. package/src/GraphBuildError.ts +2 -4
  56. package/src/KeyMaterial.ts +13 -8
  57. package/src/Plan.ts +66 -23
  58. package/src/PlanDiff.ts +7 -3
  59. package/src/StepKey.ts +38 -17
@@ -1 +1 @@
1
- {"version":3,"file":"Plan.js","sourceRoot":"","sources":["../../src/Plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,SAAS,MAAM,kCAAkC,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,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA","sourcesContent":["/**\n * The plan: a node graph with every step key computed, inert until run.\n *\n * The way a plan is produced is a law: **planning performs no I/O**.\n * Everything in this module is therefore a pure function of declarations plus\n * the injected `Crypto` service: no filesystem, no clock, no network. A node's\n * key is a function of what it consumes, so an edited declaration re-keys that\n * node and everything downstream of it, and nothing else. That is the entire\n * invalidation mechanism. Invalidation is re-keying, which **rejects**\n * Skyframe's reverse-dependency index and invalidating node visitor outright\n * because content addressing subsumes them. Key invalidation never retains a\n * reverse-dependency index; annotation uses only a temporary reachability cache.\n *\n * Growth is append-only: {@link append} adds a pre-keyed subgraph to the same\n * plan and never rewrites a node already in it.\n *\n * @since 0.1.0\n */\n\nimport { DerivedKey, StoredKey } from \"@smthrs/keys\"\nimport type * as Crypto from \"effect/Crypto\"\nimport * as Effect from \"effect/Effect\"\nimport * as Inspectable from \"effect/Inspectable\"\nimport * as Schema from \"effect/Schema\"\nimport * as Effects from \"./Effects.ts\"\nimport * as FileSet from \"./FileSet.ts\"\nimport { GraphBuildError } from \"./GraphBuildError.ts\"\nimport * as Conflicts from \"./internal/ConflictAnnotation.ts\"\nimport { jsonMirror } from \"./internal/JsonMirror.ts\"\nimport * as KeyMaterial from \"./KeyMaterial.ts\"\nimport * as StepKey from \"./StepKey.ts\"\n\n/**\n * What a node does to the world, declared. Paths only — measuring them is\n * run-time work, so a digest here would break the no-I/O law.\n *\n * @since 0.1.0\n * @category schemas\n * @slop\n */\nexport const NodeEffects = Schema.Struct({\n reads: Schema.Array(FileSet.ReadDeclaration),\n writes: Schema.Array(FileSet.Declaration),\n /**\n * Paths the node declares it will DELETE. A removal mutates the world exactly\n * as a write does, so {@link produces} folds the two together and both the\n * conflict pass and the reader-after-writer pass see them as one set.\n */\n removes: Schema.optional(Schema.Array(FileSet.Pattern)),\n boundaryMode: FileSet.BoundaryMode\n})\n\n/**\n * The value form of {@link NodeEffects}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type NodeEffects = typeof NodeEffects.Type\n\n/**\n * The plan-time write-conflict strategies of the effect taxonomy.\n *\n * @since 0.1.0\n * @category schemas\n * @slop\n */\nexport const PairStrategy = Effects.ConflictStrategy\n\n/**\n * The value form of {@link PairStrategy}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type PairStrategy = typeof PairStrategy.Type\n\n/**\n * The runtime half of a conflict annotation: what the scheduler\n * does when the overlap the plan predicted actually bites, or when a\n * scheduled node's inputs are invalidated under it.\n *\n * @since 0.1.0\n * @category schemas\n * @slop\n */\nexport const RuntimeStrategy = Schema.Literals([\"delay-rebase\", \"stop-merge\"])\n\n/**\n * The value form of {@link RuntimeStrategy}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type RuntimeStrategy = typeof RuntimeStrategy.Type\n\n/** @private */\nconst NodeKind = Schema.Literals([\"step\", \"agent\", \"merge\"])\n\n/**\n * One resolved overlap between two writers that no dependency path already\n * orders. Conflict is a property of the PAIR, not of one declaration.\n *\n * @since 0.1.0\n * @category schemas\n * @slop\n */\nexport const ConflictAnnotation = Schema.Struct({\n with: Schema.NonEmptyString,\n paths: Schema.Array(Schema.String),\n strategy: PairStrategy,\n runtime: RuntimeStrategy\n})\n\n/**\n * The value form of {@link ConflictAnnotation}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type ConflictAnnotation = typeof ConflictAnnotation.Type\n\n/**\n * A keyed node of the plan.\n *\n * `dependsOn` is the *edge* set: material references, any ordering edge a\n * `serialize` verdict added, and the reader-after-writer edges that put a\n * node behind whoever produces the paths it reads. Ordering edges are\n * deliberately NOT part of the key — a node ordered behind another still\n * computes the same result, so re-keying it would throw away a legitimate\n * cache hit.\n *\n * `strategy` and `runtime` are this declaration's own preferences, recorded so\n * a later elaboration can resolve a pair against them without re-reading the\n * flow source.\n *\n * @since 0.1.0\n * @category schemas\n * @slop\n */\nexport const PlanNode = Schema.Struct({\n id: Schema.NonEmptyString,\n kind: NodeKind,\n key: StoredKey,\n material: KeyMaterial.KeyMaterial,\n effects: NodeEffects,\n dependsOn: Schema.Array(Schema.NonEmptyString),\n conflicts: Schema.Array(ConflictAnnotation),\n strategy: PairStrategy,\n runtime: RuntimeStrategy,\n priority: Schema.Int,\n generation: Schema.Int\n})\n\n/**\n * The value form of {@link PlanNode}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type PlanNode = typeof PlanNode.Type\n\n/**\n * A plan: the whole keyed graph plus the digest an approval binds to.\n *\n * `nodes` follows material-dependency order within each generation. Inferred\n * edges can point to later entries; schedule from the complete `dependsOn`\n * graph, never by iterating the array alone.\n *\n * `baseDigest` is the digest at generation 0: what a human approved and what\n * a `RUNNING` run pins. `digest` advances with every appended elaboration.\n *\n * @since 0.1.0\n * @category schemas\n * @slop\n */\nexport const Plan = Schema.Struct({\n planId: Schema.NonEmptyString,\n flow: Schema.NonEmptyString,\n generation: Schema.Int,\n baseDigest: StoredKey,\n digest: StoredKey,\n nodes: Schema.Array(PlanNode)\n})\n\n/**\n * The value form of {@link Plan}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Plan = typeof Plan.Type\n\n/**\n * What a planner hands {@link compile}: a node without its key.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface NodeDraft {\n readonly id: string\n readonly material: KeyMaterial.KeyMaterial\n readonly effects: NodeEffects\n readonly kind?: PlanNode[\"kind\"] | undefined\n readonly priority?: number | undefined\n /** This declaration's preferred plan-time verdict for a detected overlap. */\n readonly conflictStrategy?: PairStrategy | undefined\n /** This declaration's preferred runtime response. */\n readonly runtimeStrategy?: RuntimeStrategy | undefined\n}\n\n/**\n * A graph the compiler refuses.\n *\n * @since 0.1.0\n * @category errors\n * @slop\n */\nexport class PlanError extends Schema.TaggedError<PlanError>()(\"@smthrs/plan/PlanError\", {\n code: Schema.Literals([\n \"cycle\",\n \"unknown_dependency\",\n \"duplicate_node\",\n \"overlap_forbidden\",\n \"invalid_effects\",\n \"invalid_node\",\n \"invalid_plan\",\n \"graph_too_large\"\n ]),\n message: Schema.String\n}) {}\n\n/**\n * Maximum number of nodes retained by one compiled plan.\n *\n * Effect analysis also has a yielding work budget, since a node ceiling alone\n * does not bound dense conflicts to practical work.\n *\n * @since 1.0.0\n * @category limits\n * @slop\n */\nexport const maximumPlanNodes = 10_000\n\n/** @private */\nconst graphSizeError = (size: number): PlanError =>\n new PlanError({\n code: \"graph_too_large\",\n message: `A plan may contain at most ${maximumPlanNodes} nodes, received ${size}`\n })\n\n/** @private */\ntype Ordered =\n | { readonly ok: true; readonly drafts: ReadonlyArray<NodeDraft> }\n | { readonly ok: false; readonly error: PlanError }\n\n/**\n * Topologically orders drafts by their MATERIAL dependencies — the only edges\n * that exist before keys do.\n *\n * @private\n */\nconst topological = (drafts: ReadonlyArray<NodeDraft>, known: ReadonlySet<string>): Ordered => {\n const byId = new Map(drafts.map((draft) => [draft.id, draft]))\n const ordered: Array<NodeDraft> = []\n const state = new Map<string, \"visiting\" | \"done\">()\n interface Frame {\n readonly draft: NodeDraft\n readonly dependencies: ReadonlyArray<string>\n next: number\n }\n for (const draft of drafts) {\n if (state.get(draft.id) === \"done\") continue\n state.set(draft.id, \"visiting\")\n const stack: Array<Frame> = [{ draft, dependencies: KeyMaterial.dependencies(draft.material), next: 0 }]\n while (stack.length > 0) {\n const frame = stack[stack.length - 1]!\n if (frame.next === frame.dependencies.length) {\n state.set(frame.draft.id, \"done\")\n ordered.push(frame.draft)\n stack.pop()\n continue\n }\n const dependency = frame.dependencies[frame.next++]!\n if (known.has(dependency)) continue\n const next = byId.get(dependency)\n if (next === undefined) {\n return {\n ok: false,\n error: new PlanError({\n code: \"unknown_dependency\",\n message: `Node ${frame.draft.id} depends on unknown node ${dependency}`\n })\n }\n }\n const mark = state.get(next.id)\n if (mark === \"done\") continue\n if (mark === \"visiting\") {\n return {\n ok: false,\n error: new PlanError({ code: \"cycle\", message: `Plan cycle through node ${next.id}` })\n }\n }\n state.set(next.id, \"visiting\")\n stack.push({ draft: next, dependencies: KeyMaterial.dependencies(next.material), next: 0 })\n }\n }\n return { ok: true, drafts: ordered }\n}\n\n/**\n * Runs the conflict and reader-after-writer passes and records what they found\n * on every node outside `frozen`, whose rows an append never rewrites. A\n * refused graph fails as a `PlanError` carrying the pass's code and message.\n *\n * @private\n */\nconst annotate = (\n nodes: ReadonlyArray<PlanNode>,\n frozen: ReadonlySet<string>,\n replayGenerations = false\n): Effect.Effect<ReadonlyArray<PlanNode>, PlanError> =>\n Conflicts.annotate(nodes, frozen.size, replayGenerations).pipe(\n Effect.mapError((refusal) => new PlanError(refusal)),\n Effect.map(({ conflicts, ordering }) =>\n nodes.map((node) => {\n if (frozen.has(node.id)) return node\n const added = ordering.get(node.id) ?? []\n return freezeNode({\n ...node,\n conflicts: conflicts.get(node.id) ?? [],\n dependsOn: added.length === 0 ? node.dependsOn : [...node.dependsOn, ...added]\n })\n })\n )\n )\n\n/**\n * The single approval projection. Its node list is the complete reviewable and\n * behavior-bearing contract: id, kind, key, edges, conflict annotations,\n * declared effects, conflict strategy, runtime strategy, and priority.\n *\n * @private\n */\nconst approvalPayload = (\n planId: string,\n flow: string,\n nodes: ReadonlyArray<PlanNode>\n) => ({\n body: { kind: \"plan\", planId, flow },\n inputs: {\n nodes: nodes.map((node) => ({\n id: node.id,\n kind: node.kind,\n key: node.key,\n dependsOn: node.dependsOn,\n conflicts: node.conflicts,\n effects: node.effects,\n strategy: node.strategy,\n runtime: node.runtime,\n priority: node.priority\n }))\n },\n layers: [],\n capabilities: {}\n})\n\n/**\n * The plan's digest: what an approval binds to. Deriving it only from\n * {@link approvalPayload} keeps the approved field list in one place.\n *\n * @private\n */\nconst digestOf = (\n planId: string,\n flow: string,\n nodes: ReadonlyArray<PlanNode>\n): Effect.Effect<StepKey.StepKey, StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> =>\n StepKey.content(approvalPayload(planId, flow, nodes))\n\n/** @private */\nconst maximumDescriptionLength = 256\n\n/** @private */\nconst describeValue = (value: unknown): string => {\n const rendered = typeof value === \"string\" ? JSON.stringify(value) : Inspectable.toStringUnknown(value, 0)\n return rendered.length > maximumDescriptionLength\n ? `${rendered.slice(0, maximumDescriptionLength - 3)}...`\n : rendered\n}\n\n/** @private */\nconst describeNodeId = (id: string): string => id.length > maximumDescriptionLength ? describeValue(id) : id\n\n/** @private */\nconst validateIdentity = (planId: unknown, flow: unknown): PlanError | undefined => {\n if (typeof planId !== \"string\" || planId.length === 0) {\n return new PlanError({\n code: \"invalid_node\",\n message: `Plan option planId must be a non-empty string, received ${describeValue(planId)}`\n })\n }\n if (typeof flow !== \"string\" || flow.length === 0) {\n return new PlanError({\n code: \"invalid_node\",\n message: `Plan option flow must be a non-empty string, received ${describeValue(flow)}`\n })\n }\n return undefined\n}\n\n/** Whether `value` is a container this module may safely copy. */\nconst isSnapshotContainer = (value: unknown): value is object => {\n if (typeof value !== \"object\" || value === null) return false\n if (Array.isArray(value)) return true\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null\n}\n\n/** Creates an empty container with the source container's supported prototype. */\nconst emptySnapshot = (source: object): object =>\n Array.isArray(source) ? [] : Object.create(Object.getPrototypeOf(source)) as object\n\n/**\n * Copies and freezes plain structural containers without interpreting them as\n * JSON. Shared references and cycles point at one cloned container through\n * `memo`; every other value passes through by reference and remains unfrozen.\n * In particular, this does not probe a `Planned` proxy. `validateDrafts`\n * creates the inert material mirror inside the Effect while retaining that\n * proxy, so the canonical serializer still reaches and refuses it.\n */\nconst snapshot = <A extends object>(value: A): A => {\n const root = emptySnapshot(value)\n const memo = new WeakMap<object, object>([[value, root]])\n const pending: Array<{ readonly source: object; readonly target: object }> = [{ source: value, target: root }]\n const created = [root]\n\n while (pending.length > 0) {\n const { source, target } = pending.pop()!\n for (const key of Reflect.ownKeys(source)) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)!\n if (\"value\" in descriptor && isSnapshotContainer(descriptor.value)) {\n let child = memo.get(descriptor.value)\n if (child === undefined) {\n child = emptySnapshot(descriptor.value)\n memo.set(descriptor.value, child)\n pending.push({ source: descriptor.value, target: child })\n created.push(child)\n }\n descriptor.value = child\n }\n Object.defineProperty(target, key, descriptor)\n }\n }\n\n for (const container of created) Object.freeze(container)\n return root as A\n}\n\n/** Freezes one node built by this module while retaining its material snapshot. */\nconst freezeNode = (node: PlanNode): PlanNode =>\n Object.freeze({\n ...node,\n dependsOn: Object.freeze([...node.dependsOn]),\n conflicts: Object.freeze(\n node.conflicts.map((conflict) => Object.freeze({ ...conflict, paths: Object.freeze([...conflict.paths]) }))\n )\n })\n\n/** Plans whose complete immutable snapshot was created by this module. */\nconst frozenPlans = new WeakSet<Plan>()\n\n/** Freezes the plan envelope and its newly built node list. */\nconst freezePlan = (plan: Plan): Plan => {\n const frozen = Object.freeze({ ...plan, nodes: Object.freeze([...plan.nodes]) })\n frozenPlans.add(frozen)\n return frozen\n}\n\n/**\n * Validates the runtime-only parts of `NodeDraft` without replacing effect\n * admission. Effect 4 Struct decoding strips excess properties and copies its\n * schema arrays. The decoded effect declaration replaces any caller-supplied\n * `material.effects`, and every accepted draft receives one deeply frozen JSON\n * mirror for both storage and hashing.\n *\n * @private\n */\nconst validateDrafts = (\n drafts: ReadonlyArray<NodeDraft>\n): Effect.Effect<ReadonlyArray<NodeDraft>, PlanError> =>\n Effect.forEach(drafts, (draft) =>\n Effect.gen(function*() {\n if (typeof draft.id !== \"string\" || draft.id.length === 0) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node id must be a non-empty string, received ${describeValue(draft.id)}`\n })\n )\n }\n const nodeId = describeNodeId(draft.id)\n if (draft.priority !== undefined && !Number.isSafeInteger(draft.priority)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} priority must be a safe integer, received ${describeValue(draft.priority)}`\n })\n )\n }\n if (draft.kind !== undefined && !Schema.is(NodeKind)(draft.kind)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} kind must be step, agent, or merge, received ${describeValue(draft.kind)}`\n })\n )\n }\n if (draft.conflictStrategy !== undefined && !Schema.is(PairStrategy)(draft.conflictStrategy)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} conflictStrategy must be serialize, lane, or fail, received ${\n describeValue(draft.conflictStrategy)\n }`\n })\n )\n }\n if (draft.runtimeStrategy !== undefined && !Schema.is(RuntimeStrategy)(draft.runtimeStrategy)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} runtimeStrategy must be delay-rebase or stop-merge, received ${\n describeValue(draft.runtimeStrategy)\n }`\n })\n )\n }\n const decodedMaterial = yield* Schema.decodeUnknownEffect(KeyMaterial.KeyMaterial)(draft.material).pipe(\n Effect.mapError((cause) =>\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} has invalid material: ${cause.message}`\n })\n )\n )\n const decodedEffects = yield* Schema.decodeUnknownEffect(NodeEffects)(draft.effects).pipe(\n Effect.mapError((cause) =>\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} has invalid effects: ${cause.message}`\n })\n )\n )\n let material: KeyMaterial.KeyMaterial\n try {\n material = snapshot(\n jsonMirror({ ...decodedMaterial, effects: decodedEffects }, (planned) => planned) as KeyMaterial.KeyMaterial\n )\n } catch (cause) {\n const path = cause instanceof GraphBuildError ? cause.path : []\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} has invalid material payload at ${[\"$\", ...path].join(\".\")}`\n })\n )\n }\n return Object.freeze({\n ...draft,\n material,\n effects: material.effects as NodeEffects\n })\n }))\n\n/**\n * The effects schema admits each individual declaration in `validateDrafts`.\n * This pass enforces the cross-field invariant that one path cannot be both a\n * write and a removal.\n *\n * @private\n */\nconst validateEffects = (id: string, effects: NodeEffects): PlanError | undefined => {\n const removes = effects.removes ?? []\n const writes = FileSet.expand(effects.writes)\n for (const removal of removes) {\n if (writes.some((entry) => FileSet.overlaps(entry, removal))) {\n return new PlanError({\n code: \"invalid_effects\",\n message: `Node ${id} declares ${removal} as both a write and a removal`\n })\n }\n }\n return undefined\n}\n\n/** @private */\nconst keyNodes = (\n drafts: ReadonlyArray<NodeDraft>,\n existing: ReadonlyArray<PlanNode>,\n generation: number\n): Effect.Effect<\n ReadonlyArray<PlanNode>,\n PlanError | StepKey.KeyMaterialError | Schema.SchemaError,\n Crypto.Crypto\n> =>\n Effect.gen(function*() {\n const digests: Record<string, string> = Object.create(null) as Record<string, string>\n const known = new Set<string>()\n for (const node of existing) {\n Object.defineProperty(digests, node.id, {\n configurable: true,\n enumerable: true,\n value: node.key,\n writable: true\n })\n known.add(node.id)\n }\n for (const draft of drafts) {\n if (known.has(draft.id)) {\n return yield* Effect.fail(\n new PlanError({ code: \"duplicate_node\", message: `Node ${draft.id} is already in the plan` })\n )\n }\n known.add(draft.id)\n }\n const sorted = topological(drafts, new Set(existing.map((node) => node.id)))\n if (!sorted.ok) return yield* Effect.fail(sorted.error)\n const keyed: Array<PlanNode> = []\n for (const draft of sorted.drafts) {\n const invalid = validateEffects(draft.id, draft.effects)\n if (invalid !== undefined) return yield* Effect.fail(invalid)\n const key = yield* StepKey.planIdentity(draft.material, digests)\n Object.defineProperty(digests, draft.id, {\n configurable: true,\n enumerable: true,\n value: key,\n writable: true\n })\n keyed.push(freezeNode({\n id: draft.id,\n kind: draft.kind ?? \"step\",\n key,\n material: draft.material,\n effects: draft.effects,\n dependsOn: KeyMaterial.dependencies(draft.material),\n conflicts: [],\n strategy: draft.conflictStrategy ?? \"serialize\",\n runtime: draft.runtimeStrategy ?? \"delay-rebase\",\n priority: draft.priority ?? 0,\n generation\n }))\n }\n return keyed\n })\n\n/**\n * Compiles drafts into a plan: material-dependency order, dependency-digest\n * substitution, overlap annotation, and the plan digest. No I/O.\n * Inferred edges extend `dependsOn` without reordering the node array.\n *\n * Traversal uses explicit stacks. Because the conflict and reader/writer\n * passes consider a quadratic number of node pairs, plans are bounded by\n * {@link maximumPlanNodes} and fail with `graph_too_large` above that limit\n * or the effect-analysis work budget. Analysis yields periodically.\n *\n * @since 0.1.0\n * @category constructors\n * @slop\n */\nexport const compile = (options: {\n readonly planId: string\n readonly flow: string\n readonly nodes: ReadonlyArray<NodeDraft>\n}): Effect.Effect<Plan, PlanError | StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> => {\n const captured = snapshot(options)\n return Effect.gen(function*() {\n const invalidIdentity = validateIdentity(captured.planId, captured.flow)\n if (invalidIdentity !== undefined) return yield* Effect.fail(invalidIdentity)\n if (captured.nodes.length > maximumPlanNodes) return yield* Effect.fail(graphSizeError(captured.nodes.length))\n const drafts = yield* validateDrafts(captured.nodes)\n const keyed = yield* keyNodes(drafts, [], 0)\n const nodes = yield* annotate(keyed, new Set())\n const digest = yield* digestOf(captured.planId, captured.flow, nodes)\n return freezePlan({\n planId: captured.planId,\n flow: captured.flow,\n generation: 0,\n baseDigest: digest,\n digest,\n nodes\n })\n })\n}\n\n/**\n * Appends an elaborated subgraph to an existing plan.\n *\n * The plan GROWS; it is never invalidated. Nodes already in it keep their id,\n * key, edges, and generation byte for byte, and the new nodes arrive pre-keyed\n * against them, so a `hit` shows instantly. New nodes retain their material\n * dependency order; scheduling must honor their complete `dependsOn` graph.\n * Re-ordering after a reconciliation happens by re-keying *future* steps,\n * never by rewriting history.\n *\n * @since 0.1.0\n * @category constructors\n * @slop\n */\nexport const append = (\n plan: Plan,\n drafts: ReadonlyArray<NodeDraft>\n): Effect.Effect<Plan, PlanError | StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> => {\n const candidate = frozenPlans.has(plan) ? plan : snapshot(plan)\n const capturedDrafts = snapshot(drafts)\n return Effect.gen(function*() {\n const invalidIdentity = validateIdentity(candidate.planId, candidate.flow)\n if (invalidIdentity !== undefined) return yield* Effect.fail(invalidIdentity)\n const capturedPlan = yield* verify(candidate)\n const nextSize = capturedPlan.nodes.length + capturedDrafts.length\n if (nextSize > maximumPlanNodes) return yield* Effect.fail(graphSizeError(nextSize))\n const validated = yield* validateDrafts(capturedDrafts)\n if (validated.length === 0) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Plan ${capturedPlan.planId} append requires at least one draft`\n })\n )\n }\n const generation = capturedPlan.generation + 1\n const keyed = yield* keyNodes(validated, capturedPlan.nodes, generation)\n const nodes = yield* annotate(\n [...capturedPlan.nodes, ...keyed],\n new Set(capturedPlan.nodes.map((node) => node.id))\n )\n const digest = yield* digestOf(capturedPlan.planId, capturedPlan.flow, nodes)\n return freezePlan({ ...capturedPlan, generation, digest, nodes })\n })\n}\n\n/**\n * Verifies an imported plan against the same key and topology rules as the\n * compiler. Valid compiler-owned immutable values need no second compilation.\n *\n * Generation boundaries are replayed when reconstructing conflict annotations:\n * an append may annotate new nodes, but cannot rewrite an earlier generation.\n * Recorded material-dependency order is verified without sorting inferred edges.\n * Keys and approval digests retain their existing format. The returned snapshot\n * is immutable; later caller mutation cannot change the verified value.\n *\n * @since 1.0.0\n * @category validation\n */\nexport const verify = (\n input: unknown\n): Effect.Effect<Plan, PlanError | StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> =>\n Effect.gen(function*() {\n if (typeof input === \"object\" && input !== null && frozenPlans.has(input as Plan)) return input as Plan\n // Check the array ceiling before schema decoding copies its members.\n if (typeof input === \"object\" && input !== null && \"nodes\" in input && Array.isArray(input.nodes)) {\n if (input.nodes.length > maximumPlanNodes) return yield* Effect.fail(graphSizeError(input.nodes.length))\n }\n const decoded = yield* Schema.decodeUnknownEffect(Plan)(input)\n const invalid = (message: string) => new PlanError({ code: \"invalid_plan\", message })\n if (\n !Number.isSafeInteger(decoded.generation) || decoded.generation < 0 || decoded.generation > decoded.nodes.length\n ) {\n return yield* Effect.fail(\n invalid(\"Plan generation must be a non-negative safe integer with a nonempty appended generation\")\n )\n }\n const generations = new Map<string, number>()\n let previous = 0\n for (const node of decoded.nodes) {\n if (!Number.isSafeInteger(node.generation) || node.generation < previous || node.generation > previous + 1) {\n return yield* Effect.fail(invalid(`Node ${node.id} has an invalid or out-of-order generation`))\n }\n generations.set(node.id, node.generation)\n previous = node.generation\n }\n if (previous !== decoded.generation) {\n return yield* Effect.fail(invalid(\"Plan generation does not match its newest nodes\"))\n }\n for (const node of decoded.nodes) {\n for (const dependency of KeyMaterial.dependencies(node.material)) {\n const generation = generations.get(dependency)\n if (generation !== undefined && generation > node.generation) {\n return yield* Effect.fail(invalid(`Node ${node.id} refers to a future generation`))\n }\n }\n }\n const drafts = yield* validateDrafts(decoded.nodes.map((node) => ({\n id: node.id,\n kind: node.kind,\n material: node.material,\n effects: node.effects,\n conflictStrategy: node.strategy,\n runtimeStrategy: node.runtime,\n priority: node.priority\n })))\n const keyed = (yield* keyNodes(drafts, [], 0)).map((node) =>\n freezeNode({ ...node, generation: generations.get(node.id)! })\n )\n // Replay boundaries within one annotation pass, retaining its expansion\n // map, candidate trie, inferred graph and reachability cache throughout.\n const nodes = yield* annotate(keyed, new Set(), true)\n const baseDigest = yield* digestOf(decoded.planId, decoded.flow, nodes.filter((node) => node.generation === 0))\n const digest = decoded.generation === 0 ? baseDigest : yield* digestOf(decoded.planId, decoded.flow, nodes)\n if (decoded.baseDigest !== baseDigest || decoded.digest !== digest) {\n return yield* Effect.fail(invalid(\"Plan approval digest does not match its compiled content\"))\n }\n // Compare the complete node contract, including material and generation,\n // rather than trusting the claimed keys or the approval projection alone.\n const hash = Schema.decodeUnknownEffect(DerivedKey)\n if ((yield* hash(decoded.nodes)) !== (yield* hash(nodes))) {\n return yield* Effect.fail(\n invalid(\"Plan nodes do not match their compiled keys, effects, ordering, or generations\")\n )\n }\n return freezePlan({ ...decoded, nodes })\n })\n\n/**\n * The nodes added by the newest generation: what {@link module:PlanStore}\n * appends and what the `subgraph-appended` journal record names.\n *\n * @since 0.1.0\n * @category accessors\n * @slop\n */\nexport const generationNodes = (plan: Plan): ReadonlyArray<PlanNode> =>\n plan.nodes.filter((node) => node.generation === plan.generation)\n\n/**\n * Whether `input` is a compiler-owned immutable snapshot that already passed\n * {@link verify}: such values take verify's trusted fast path and need no\n * second schema validation.\n *\n * @since 1.0.0\n * @category guards\n * @slop\n */\nexport const isVerified = (input: unknown): input is Plan =>\n typeof input === \"object\" && input !== null && frozenPlans.has(input as Plan)\n\n/**\n * The approval digest of every generation before the newest: the digest this\n * plan carried before its last append. {@link module:PlanStore}'s append\n * matches it against the stored envelope, so an append proves the recorded\n * plan's integrity from the already-verified prefix instead of decoding and\n * re-verifying every stored row.\n *\n * @since 1.0.0\n * @category accessors\n * @slop\n */\nexport const prefixDigest = (\n plan: Plan\n): Effect.Effect<StepKey.StepKey, StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> =>\n digestOf(plan.planId, plan.flow, plan.nodes.filter((node) => node.generation < plan.generation))\n"]}
1
+ {"version":3,"file":"Plan.js","sourceRoot":"","sources":["../../src/Plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC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CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA","sourcesContent":["/**\n * The plan: a node graph with every step key computed, inert until run.\n *\n * The way a plan is produced is a law: **planning performs no I/O**.\n * Everything in this module is therefore a pure function of declarations plus\n * the injected `Crypto` service: no filesystem, no clock, no network. A node's\n * key is a function of what it consumes, so an edited declaration re-keys that\n * node and everything downstream of it, and nothing else. That is the entire\n * invalidation mechanism. Invalidation is re-keying, which **rejects**\n * Skyframe's reverse-dependency index and invalidating node visitor outright\n * because content addressing subsumes them. Key invalidation never retains a\n * reverse-dependency index; annotation uses only a temporary reachability cache.\n *\n * Growth is append-only: {@link append} adds a pre-keyed subgraph to the same\n * plan and never rewrites a node already in it.\n *\n * @since 0.1.0\n */\n\nimport { DerivedKey, StoredKey } from \"@smthrs/keys\"\nimport type * as Crypto from \"effect/Crypto\"\nimport * as Effect from \"effect/Effect\"\nimport * as Inspectable from \"effect/Inspectable\"\nimport * as Schema from \"effect/Schema\"\nimport * as Effects from \"./Effects.ts\"\nimport * as FileSet from \"./FileSet.ts\"\nimport { GraphBuildError } from \"./GraphBuildError.ts\"\nimport * as Conflicts from \"./internal/ConflictAnnotation.ts\"\nimport { jsonMirror } from \"./internal/JsonMirror.ts\"\nimport * as KeyMaterial from \"./KeyMaterial.ts\"\nimport * as StepKey from \"./StepKey.ts\"\n\n/**\n * What a node does to the world, declared. Paths only — measuring them is\n * run-time work, so a digest here would break the no-I/O law.\n *\n * Decoding fails with a `SchemaError` when a path is not workspace-relative.\n * {@link compile} also refuses a node whose `removes` overlaps its `writes`\n * with an `invalid_effects` {@link PlanError}.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const NodeEffects = Schema.Struct({\n /** Paths the node reads. A read orders the node after every writer of an overlapping path. */\n reads: Schema.Array(FileSet.ReadDeclaration),\n /** Paths the node writes. Two writers of an overlapping path form a conflict. */\n writes: Schema.Array(FileSet.Declaration),\n /**\n * Paths the node declares it will DELETE. A removal mutates the world exactly\n * as a write does, so {@link produces} folds the two together and both the\n * conflict pass and the reader-after-writer pass see them as one set.\n */\n removes: Schema.optional(Schema.Array(FileSet.Pattern)),\n /** How strictly the sandbox enforces these declarations. */\n boundaryMode: FileSet.BoundaryMode\n})\n\n/**\n * The value form of {@link NodeEffects}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type NodeEffects = typeof NodeEffects.Type\n\n/**\n * The plan-time verdict for two writers of an overlapping path:\n * `serialize` gives the later writer an ordering edge, `lane` records a lane\n * annotation on both writers and adds no edge, and `fail` refuses the plan\n * with `overlap_forbidden`. For a pair, `fail` dominates `lane`, which\n * dominates `serialize`. The same schema as `Effects.ConflictStrategy`.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const PairStrategy = Effects.ConflictStrategy\n\n/**\n * The value form of {@link PairStrategy}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type PairStrategy = typeof PairStrategy.Type\n\n/**\n * The runtime half of a conflict annotation: what the scheduler\n * does when the overlap the plan predicted actually bites, or when a\n * scheduled node's inputs are invalidated under it. For a pair,\n * `stop-merge` dominates `delay-rebase`.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const RuntimeStrategy = Schema.Literals([\"delay-rebase\", \"stop-merge\"])\n\n/**\n * The value form of {@link RuntimeStrategy}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type RuntimeStrategy = typeof RuntimeStrategy.Type\n\n/** @private */\nconst NodeKind = Schema.Literals([\"step\", \"agent\", \"merge\"])\n\n/**\n * One resolved overlap between two writers that no dependency path already\n * orders. Conflict is a property of the PAIR, not of one declaration.\n *\n * `with` names the other node, `paths` lists the overlapping declarations,\n * and `strategy` and `runtime` are the verdicts resolved for the pair.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const ConflictAnnotation = Schema.Struct({\n with: Schema.NonEmptyString,\n paths: Schema.Array(Schema.String),\n strategy: PairStrategy,\n runtime: RuntimeStrategy\n})\n\n/**\n * The value form of {@link ConflictAnnotation}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type ConflictAnnotation = typeof ConflictAnnotation.Type\n\n/**\n * A keyed node of the plan.\n *\n * `dependsOn` is the *edge* set: material references, any ordering edge a\n * `serialize` verdict added, and the reader-after-writer edges that put a\n * node behind whoever produces the paths it reads. Ordering edges are\n * deliberately NOT part of the key — a node ordered behind another still\n * computes the same result, so re-keying it would throw away a legitimate\n * cache hit.\n *\n * `strategy` and `runtime` are this declaration's own preferences, recorded so\n * a later elaboration can resolve a pair against them without re-reading the\n * flow source.\n *\n * `generation` is 0 for nodes from {@link compile} and grows by one with each\n * {@link append}.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const PlanNode = Schema.Struct({\n id: Schema.NonEmptyString,\n kind: NodeKind,\n key: StoredKey,\n material: KeyMaterial.KeyMaterial,\n effects: NodeEffects,\n dependsOn: Schema.Array(Schema.NonEmptyString),\n conflicts: Schema.Array(ConflictAnnotation),\n strategy: PairStrategy,\n runtime: RuntimeStrategy,\n priority: Schema.Int,\n generation: Schema.Int\n})\n\n/**\n * The value form of {@link PlanNode}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type PlanNode = typeof PlanNode.Type\n\n/**\n * A plan: the whole keyed graph plus the digest an approval binds to.\n *\n * `nodes` follows material-dependency order within each generation. Inferred\n * edges can point to later entries; schedule from the complete `dependsOn`\n * graph, never by iterating the array alone.\n *\n * `baseDigest` is the digest at generation 0: what a human approved and what\n * a `RUNNING` run pins. `digest` advances with every appended elaboration.\n *\n * Decoding checks only the shape. Use {@link verify} to check that keys,\n * edges, and digests match the declarations.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const Plan = Schema.Struct({\n planId: Schema.NonEmptyString,\n flow: Schema.NonEmptyString,\n generation: Schema.Int,\n baseDigest: StoredKey,\n digest: StoredKey,\n nodes: Schema.Array(PlanNode)\n})\n\n/**\n * The value form of {@link Plan}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type Plan = typeof Plan.Type\n\n/**\n * What a planner hands {@link compile}: a node without its key.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface NodeDraft {\n /** A non-empty id, unique within the plan. */\n readonly id: string\n /** The key inputs. Its `Ref` inputs name the node's material dependencies. */\n readonly material: KeyMaterial.KeyMaterial\n /** The declared reads, writes, and removals. They replace `material.effects`. */\n readonly effects: NodeEffects\n /** `step`, `agent`, or `merge`. Defaults to `step`. */\n readonly kind?: PlanNode[\"kind\"] | undefined\n /** A safe integer scheduling priority. Defaults to 0. */\n readonly priority?: number | undefined\n /** This declaration's preferred plan-time verdict for a detected overlap. */\n readonly conflictStrategy?: PairStrategy | undefined\n /** This declaration's preferred runtime response. */\n readonly runtimeStrategy?: RuntimeStrategy | undefined\n}\n\n/**\n * A graph the compiler refuses. `code` names the rule:\n *\n * - `cycle`: material or inferred edges form a cycle.\n * - `unknown_dependency`: a `Ref` names a node that is not in the plan.\n * - `duplicate_node`: two nodes share an id.\n * - `overlap_forbidden`: two unordered writers overlap and the pair's\n * strategy is `fail`.\n * - `invalid_effects`: a node both writes and removes one path.\n * - `invalid_node`: a draft field, the plan id, or the flow name is malformed.\n * - `invalid_plan`: {@link verify} found a plan that does not match its\n * declarations.\n * - `graph_too_large`: the plan exceeds {@link maximumPlanNodes} or the\n * effect-analysis work budget.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class PlanError extends Schema.TaggedError<PlanError>()(\"@smthrs/plan/PlanError\", {\n code: Schema.Literals([\n \"cycle\",\n \"unknown_dependency\",\n \"duplicate_node\",\n \"overlap_forbidden\",\n \"invalid_effects\",\n \"invalid_node\",\n \"invalid_plan\",\n \"graph_too_large\"\n ]),\n message: Schema.String\n}) {}\n\n/**\n * Maximum number of nodes retained by one compiled plan.\n *\n * Effect analysis also has a yielding work budget, since a node ceiling alone\n * does not bound dense conflicts to practical work.\n *\n * @since 1.0.0\n * @category limits\n */\nexport const maximumPlanNodes = 10_000\n\n/** @private */\nconst graphSizeError = (size: number): PlanError =>\n new PlanError({\n code: \"graph_too_large\",\n message: `A plan may contain at most ${maximumPlanNodes} nodes, received ${size}`\n })\n\n/** @private */\ntype Ordered =\n | { readonly ok: true; readonly drafts: ReadonlyArray<NodeDraft> }\n | { readonly ok: false; readonly error: PlanError }\n\n/**\n * Topologically orders drafts by their MATERIAL dependencies — the only edges\n * that exist before keys do.\n *\n * @private\n */\nconst topological = (drafts: ReadonlyArray<NodeDraft>, known: ReadonlySet<string>): Ordered => {\n const byId = new Map(drafts.map((draft) => [draft.id, draft]))\n const ordered: Array<NodeDraft> = []\n const state = new Map<string, \"visiting\" | \"done\">()\n interface Frame {\n readonly draft: NodeDraft\n readonly dependencies: ReadonlyArray<string>\n next: number\n }\n for (const draft of drafts) {\n if (state.get(draft.id) === \"done\") continue\n state.set(draft.id, \"visiting\")\n const stack: Array<Frame> = [{ draft, dependencies: KeyMaterial.dependencies(draft.material), next: 0 }]\n while (stack.length > 0) {\n const frame = stack[stack.length - 1]!\n if (frame.next === frame.dependencies.length) {\n state.set(frame.draft.id, \"done\")\n ordered.push(frame.draft)\n stack.pop()\n continue\n }\n const dependency = frame.dependencies[frame.next++]!\n if (known.has(dependency)) continue\n const next = byId.get(dependency)\n if (next === undefined) {\n return {\n ok: false,\n error: new PlanError({\n code: \"unknown_dependency\",\n message: `Node ${frame.draft.id} depends on unknown node ${dependency}`\n })\n }\n }\n const mark = state.get(next.id)\n if (mark === \"done\") continue\n if (mark === \"visiting\") {\n return {\n ok: false,\n error: new PlanError({ code: \"cycle\", message: `Plan cycle through node ${next.id}` })\n }\n }\n state.set(next.id, \"visiting\")\n stack.push({ draft: next, dependencies: KeyMaterial.dependencies(next.material), next: 0 })\n }\n }\n return { ok: true, drafts: ordered }\n}\n\n/**\n * Runs the conflict and reader-after-writer passes and records what they found\n * on every node outside `frozen`, whose rows an append never rewrites. A\n * refused graph fails as a `PlanError` carrying the pass's code and message.\n *\n * @private\n */\nconst annotate = (\n nodes: ReadonlyArray<PlanNode>,\n frozen: ReadonlySet<string>,\n replayGenerations = false\n): Effect.Effect<ReadonlyArray<PlanNode>, PlanError> =>\n Conflicts.annotate(nodes, frozen.size, replayGenerations).pipe(\n Effect.mapError((refusal) => new PlanError(refusal)),\n Effect.map(({ conflicts, ordering }) =>\n nodes.map((node) => {\n if (frozen.has(node.id)) return node\n const added = ordering.get(node.id) ?? []\n return freezeNode({\n ...node,\n conflicts: conflicts.get(node.id) ?? [],\n dependsOn: added.length === 0 ? node.dependsOn : [...node.dependsOn, ...added]\n })\n })\n )\n )\n\n/**\n * The single approval projection. Its node list is the complete reviewable and\n * behavior-bearing contract: id, kind, key, edges, conflict annotations,\n * declared effects, conflict strategy, runtime strategy, and priority.\n *\n * @private\n */\nconst approvalPayload = (\n planId: string,\n flow: string,\n nodes: ReadonlyArray<PlanNode>\n) => ({\n body: { kind: \"plan\", planId, flow },\n inputs: {\n nodes: nodes.map((node) => ({\n id: node.id,\n kind: node.kind,\n key: node.key,\n dependsOn: node.dependsOn,\n conflicts: node.conflicts,\n effects: node.effects,\n strategy: node.strategy,\n runtime: node.runtime,\n priority: node.priority\n }))\n },\n layers: [],\n capabilities: {}\n})\n\n/**\n * The plan's digest: what an approval binds to. Deriving it only from\n * {@link approvalPayload} keeps the approved field list in one place.\n *\n * @private\n */\nconst digestOf = (\n planId: string,\n flow: string,\n nodes: ReadonlyArray<PlanNode>\n): Effect.Effect<StepKey.StepKey, StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> =>\n StepKey.content(approvalPayload(planId, flow, nodes))\n\n/** @private */\nconst maximumDescriptionLength = 256\n\n/** @private */\nconst describeValue = (value: unknown): string => {\n const rendered = typeof value === \"string\" ? JSON.stringify(value) : Inspectable.toStringUnknown(value, 0)\n return rendered.length > maximumDescriptionLength\n ? `${rendered.slice(0, maximumDescriptionLength - 3)}...`\n : rendered\n}\n\n/** @private */\nconst describeNodeId = (id: string): string => id.length > maximumDescriptionLength ? describeValue(id) : id\n\n/** @private */\nconst validateIdentity = (planId: unknown, flow: unknown): PlanError | undefined => {\n if (typeof planId !== \"string\" || planId.length === 0) {\n return new PlanError({\n code: \"invalid_node\",\n message: `Plan option planId must be a non-empty string, received ${describeValue(planId)}`\n })\n }\n if (typeof flow !== \"string\" || flow.length === 0) {\n return new PlanError({\n code: \"invalid_node\",\n message: `Plan option flow must be a non-empty string, received ${describeValue(flow)}`\n })\n }\n return undefined\n}\n\n/** Whether `value` is a container this module may safely copy. */\nconst isSnapshotContainer = (value: unknown): value is object => {\n if (typeof value !== \"object\" || value === null) return false\n if (Array.isArray(value)) return true\n const prototype = Object.getPrototypeOf(value)\n return prototype === Object.prototype || prototype === null\n}\n\n/** Creates an empty container with the source container's supported prototype. */\nconst emptySnapshot = (source: object): object =>\n Array.isArray(source) ? [] : Object.create(Object.getPrototypeOf(source)) as object\n\n/**\n * Copies and freezes plain structural containers without interpreting them as\n * JSON. Shared references and cycles point at one cloned container through\n * `memo`; every other value passes through by reference and remains unfrozen.\n * In particular, this does not probe a `Planned` proxy. `validateDrafts`\n * creates the inert material mirror inside the Effect while retaining that\n * proxy, so the canonical serializer still reaches and refuses it.\n */\nconst snapshot = <A extends object>(value: A): A => {\n const root = emptySnapshot(value)\n const memo = new WeakMap<object, object>([[value, root]])\n const pending: Array<{ readonly source: object; readonly target: object }> = [{ source: value, target: root }]\n const created = [root]\n\n while (pending.length > 0) {\n const { source, target } = pending.pop()!\n for (const key of Reflect.ownKeys(source)) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key)!\n if (\"value\" in descriptor && isSnapshotContainer(descriptor.value)) {\n let child = memo.get(descriptor.value)\n if (child === undefined) {\n child = emptySnapshot(descriptor.value)\n memo.set(descriptor.value, child)\n pending.push({ source: descriptor.value, target: child })\n created.push(child)\n }\n descriptor.value = child\n }\n Object.defineProperty(target, key, descriptor)\n }\n }\n\n for (const container of created) Object.freeze(container)\n return root as A\n}\n\n/** Freezes one node built by this module while retaining its material snapshot. */\nconst freezeNode = (node: PlanNode): PlanNode =>\n Object.freeze({\n ...node,\n dependsOn: Object.freeze([...node.dependsOn]),\n conflicts: Object.freeze(\n node.conflicts.map((conflict) => Object.freeze({ ...conflict, paths: Object.freeze([...conflict.paths]) }))\n )\n })\n\n/** Plans whose complete immutable snapshot was created by this module. */\nconst frozenPlans = new WeakSet<Plan>()\n\n/** Freezes the plan envelope and its newly built node list. */\nconst freezePlan = (plan: Plan): Plan => {\n const frozen = Object.freeze({ ...plan, nodes: Object.freeze([...plan.nodes]) })\n frozenPlans.add(frozen)\n return frozen\n}\n\n/**\n * Validates the runtime-only parts of `NodeDraft` without replacing effect\n * admission. Effect 4 Struct decoding strips excess properties and copies its\n * schema arrays. The decoded effect declaration replaces any caller-supplied\n * `material.effects`, and every accepted draft receives one deeply frozen JSON\n * mirror for both storage and hashing.\n *\n * @private\n */\nconst validateDrafts = (\n drafts: ReadonlyArray<NodeDraft>\n): Effect.Effect<ReadonlyArray<NodeDraft>, PlanError> =>\n Effect.forEach(drafts, (draft) =>\n Effect.gen(function*() {\n if (typeof draft.id !== \"string\" || draft.id.length === 0) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node id must be a non-empty string, received ${describeValue(draft.id)}`\n })\n )\n }\n const nodeId = describeNodeId(draft.id)\n if (draft.priority !== undefined && !Number.isSafeInteger(draft.priority)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} priority must be a safe integer, received ${describeValue(draft.priority)}`\n })\n )\n }\n if (draft.kind !== undefined && !Schema.is(NodeKind)(draft.kind)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} kind must be step, agent, or merge, received ${describeValue(draft.kind)}`\n })\n )\n }\n if (draft.conflictStrategy !== undefined && !Schema.is(PairStrategy)(draft.conflictStrategy)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} conflictStrategy must be serialize, lane, or fail, received ${\n describeValue(draft.conflictStrategy)\n }`\n })\n )\n }\n if (draft.runtimeStrategy !== undefined && !Schema.is(RuntimeStrategy)(draft.runtimeStrategy)) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} runtimeStrategy must be delay-rebase or stop-merge, received ${\n describeValue(draft.runtimeStrategy)\n }`\n })\n )\n }\n const decodedMaterial = yield* Schema.decodeUnknownEffect(KeyMaterial.KeyMaterial)(draft.material).pipe(\n Effect.mapError((cause) =>\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} has invalid material: ${cause.message}`\n })\n )\n )\n const decodedEffects = yield* Schema.decodeUnknownEffect(NodeEffects)(draft.effects).pipe(\n Effect.mapError((cause) =>\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} has invalid effects: ${cause.message}`\n })\n )\n )\n let material: KeyMaterial.KeyMaterial\n try {\n material = snapshot(\n jsonMirror({ ...decodedMaterial, effects: decodedEffects }, (planned) => planned) as KeyMaterial.KeyMaterial\n )\n } catch (cause) {\n const path = cause instanceof GraphBuildError ? cause.path : []\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Node ${nodeId} has invalid material payload at ${[\"$\", ...path].join(\".\")}`\n })\n )\n }\n return Object.freeze({\n ...draft,\n material,\n effects: material.effects as NodeEffects\n })\n }))\n\n/**\n * The effects schema admits each individual declaration in `validateDrafts`.\n * This pass enforces the cross-field invariant that one path cannot be both a\n * write and a removal.\n *\n * @private\n */\nconst validateEffects = (id: string, effects: NodeEffects): PlanError | undefined => {\n const removes = effects.removes ?? []\n const writes = FileSet.expand(effects.writes)\n for (const removal of removes) {\n if (writes.some((entry) => FileSet.overlaps(entry, removal))) {\n return new PlanError({\n code: \"invalid_effects\",\n message: `Node ${id} declares ${removal} as both a write and a removal`\n })\n }\n }\n return undefined\n}\n\n/** @private */\nconst keyNodes = (\n drafts: ReadonlyArray<NodeDraft>,\n existing: ReadonlyArray<PlanNode>,\n generation: number\n): Effect.Effect<\n ReadonlyArray<PlanNode>,\n PlanError | StepKey.KeyMaterialError | Schema.SchemaError,\n Crypto.Crypto\n> =>\n Effect.gen(function*() {\n const digests: Record<string, string> = Object.create(null) as Record<string, string>\n const known = new Set<string>()\n for (const node of existing) {\n Object.defineProperty(digests, node.id, {\n configurable: true,\n enumerable: true,\n value: node.key,\n writable: true\n })\n known.add(node.id)\n }\n for (const draft of drafts) {\n if (known.has(draft.id)) {\n return yield* Effect.fail(\n new PlanError({ code: \"duplicate_node\", message: `Node ${draft.id} is already in the plan` })\n )\n }\n known.add(draft.id)\n }\n const sorted = topological(drafts, new Set(existing.map((node) => node.id)))\n if (!sorted.ok) return yield* Effect.fail(sorted.error)\n const keyed: Array<PlanNode> = []\n for (const draft of sorted.drafts) {\n const invalid = validateEffects(draft.id, draft.effects)\n if (invalid !== undefined) return yield* Effect.fail(invalid)\n const key = yield* StepKey.planIdentity(draft.material, digests)\n Object.defineProperty(digests, draft.id, {\n configurable: true,\n enumerable: true,\n value: key,\n writable: true\n })\n keyed.push(freezeNode({\n id: draft.id,\n kind: draft.kind ?? \"step\",\n key,\n material: draft.material,\n effects: draft.effects,\n dependsOn: KeyMaterial.dependencies(draft.material),\n conflicts: [],\n strategy: draft.conflictStrategy ?? \"serialize\",\n runtime: draft.runtimeStrategy ?? \"delay-rebase\",\n priority: draft.priority ?? 0,\n generation\n }))\n }\n return keyed\n })\n\n/**\n * Compiles drafts into a plan: material-dependency order, dependency-digest\n * substitution, overlap annotation, and the plan digest. No I/O.\n * Inferred edges extend `dependsOn` without reordering the node array.\n *\n * Traversal uses explicit stacks. Because the conflict and reader/writer\n * passes consider a quadratic number of node pairs, plans are bounded by\n * {@link maximumPlanNodes} and fail with `graph_too_large` above that limit\n * or the effect-analysis work budget. Analysis yields periodically.\n *\n * The options and drafts are copied when `compile` is called, so later\n * caller mutation does not reach the plan. The result is deeply frozen.\n *\n * @param options - `planId` and `flow` name the plan; `nodes` are the drafts.\n * @returns The generation-0 plan, whose `baseDigest` equals its `digest`.\n * Fails with {@link PlanError} for a refused graph, `KeyMaterialError` or\n * `SchemaError` when a key cannot be derived.\n * @since 0.1.0\n * @category constructors\n */\nexport const compile = (options: {\n readonly planId: string\n readonly flow: string\n readonly nodes: ReadonlyArray<NodeDraft>\n}): Effect.Effect<Plan, PlanError | StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> => {\n const captured = snapshot(options)\n return Effect.gen(function*() {\n const invalidIdentity = validateIdentity(captured.planId, captured.flow)\n if (invalidIdentity !== undefined) return yield* Effect.fail(invalidIdentity)\n if (captured.nodes.length > maximumPlanNodes) return yield* Effect.fail(graphSizeError(captured.nodes.length))\n const drafts = yield* validateDrafts(captured.nodes)\n const keyed = yield* keyNodes(drafts, [], 0)\n const nodes = yield* annotate(keyed, new Set())\n const digest = yield* digestOf(captured.planId, captured.flow, nodes)\n return freezePlan({\n planId: captured.planId,\n flow: captured.flow,\n generation: 0,\n baseDigest: digest,\n digest,\n nodes\n })\n })\n}\n\n/**\n * Appends an elaborated subgraph to an existing plan.\n *\n * The plan GROWS; it is never invalidated. Nodes already in it keep their id,\n * key, edges, and generation byte for byte, and the new nodes arrive pre-keyed\n * against them, so a `hit` shows instantly. New nodes retain their material\n * dependency order; scheduling must honor their complete `dependsOn` graph.\n * Re-ordering after a reconciliation happens by re-keying *future* steps,\n * never by rewriting history.\n *\n * A plan not produced by this module is checked with {@link verify} first.\n *\n * @param plan - The plan to grow.\n * @param drafts - At least one new node. Ids must not repeat existing ones;\n * `Ref` inputs may name existing nodes.\n * @returns The plan with one more generation and a new `digest`. Fails with\n * {@link PlanError} (`invalid_node` for an empty `drafts`, `invalid_plan` for a\n * plan that fails verification), `KeyMaterialError`, or `SchemaError`.\n * @since 0.1.0\n * @category constructors\n */\nexport const append = (\n plan: Plan,\n drafts: ReadonlyArray<NodeDraft>\n): Effect.Effect<Plan, PlanError | StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> => {\n const candidate = frozenPlans.has(plan) ? plan : snapshot(plan)\n const capturedDrafts = snapshot(drafts)\n return Effect.gen(function*() {\n const invalidIdentity = validateIdentity(candidate.planId, candidate.flow)\n if (invalidIdentity !== undefined) return yield* Effect.fail(invalidIdentity)\n const capturedPlan = yield* verify(candidate)\n const nextSize = capturedPlan.nodes.length + capturedDrafts.length\n if (nextSize > maximumPlanNodes) return yield* Effect.fail(graphSizeError(nextSize))\n const validated = yield* validateDrafts(capturedDrafts)\n if (validated.length === 0) {\n return yield* Effect.fail(\n new PlanError({\n code: \"invalid_node\",\n message: `Plan ${capturedPlan.planId} append requires at least one draft`\n })\n )\n }\n const generation = capturedPlan.generation + 1\n const keyed = yield* keyNodes(validated, capturedPlan.nodes, generation)\n const nodes = yield* annotate(\n [...capturedPlan.nodes, ...keyed],\n new Set(capturedPlan.nodes.map((node) => node.id))\n )\n const digest = yield* digestOf(capturedPlan.planId, capturedPlan.flow, nodes)\n return freezePlan({ ...capturedPlan, generation, digest, nodes })\n })\n}\n\n/**\n * Verifies an imported plan against the same key and topology rules as the\n * compiler. Valid compiler-owned immutable values need no second compilation.\n *\n * Generation boundaries are replayed when reconstructing conflict annotations:\n * an append may annotate new nodes, but cannot rewrite an earlier generation.\n * Recorded material-dependency order is verified without sorting inferred edges.\n * Keys and approval digests retain their existing format. The returned snapshot\n * is immutable; later caller mutation cannot change the verified value.\n *\n * @since 1.0.0\n * @category validation\n */\nexport const verify = (\n input: unknown\n): Effect.Effect<Plan, PlanError | StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> =>\n Effect.gen(function*() {\n if (typeof input === \"object\" && input !== null && frozenPlans.has(input as Plan)) return input as Plan\n // Check the array ceiling before schema decoding copies its members.\n if (typeof input === \"object\" && input !== null && \"nodes\" in input && Array.isArray(input.nodes)) {\n if (input.nodes.length > maximumPlanNodes) return yield* Effect.fail(graphSizeError(input.nodes.length))\n }\n const decoded = yield* Schema.decodeUnknownEffect(Plan)(input)\n const invalid = (message: string) => new PlanError({ code: \"invalid_plan\", message })\n if (\n !Number.isSafeInteger(decoded.generation) || decoded.generation < 0 || decoded.generation > decoded.nodes.length\n ) {\n return yield* Effect.fail(\n invalid(\"Plan generation must be a non-negative safe integer with a nonempty appended generation\")\n )\n }\n const generations = new Map<string, number>()\n let previous = 0\n for (const node of decoded.nodes) {\n if (!Number.isSafeInteger(node.generation) || node.generation < previous || node.generation > previous + 1) {\n return yield* Effect.fail(invalid(`Node ${node.id} has an invalid or out-of-order generation`))\n }\n generations.set(node.id, node.generation)\n previous = node.generation\n }\n if (previous !== decoded.generation) {\n return yield* Effect.fail(invalid(\"Plan generation does not match its newest nodes\"))\n }\n for (const node of decoded.nodes) {\n for (const dependency of KeyMaterial.dependencies(node.material)) {\n const generation = generations.get(dependency)\n if (generation !== undefined && generation > node.generation) {\n return yield* Effect.fail(invalid(`Node ${node.id} refers to a future generation`))\n }\n }\n }\n const drafts = yield* validateDrafts(decoded.nodes.map((node) => ({\n id: node.id,\n kind: node.kind,\n material: node.material,\n effects: node.effects,\n conflictStrategy: node.strategy,\n runtimeStrategy: node.runtime,\n priority: node.priority\n })))\n const keyed = (yield* keyNodes(drafts, [], 0)).map((node) =>\n freezeNode({ ...node, generation: generations.get(node.id)! })\n )\n // Replay boundaries within one annotation pass, retaining its expansion\n // map, candidate trie, inferred graph and reachability cache throughout.\n const nodes = yield* annotate(keyed, new Set(), true)\n const baseDigest = yield* digestOf(decoded.planId, decoded.flow, nodes.filter((node) => node.generation === 0))\n const digest = decoded.generation === 0 ? baseDigest : yield* digestOf(decoded.planId, decoded.flow, nodes)\n if (decoded.baseDigest !== baseDigest || decoded.digest !== digest) {\n return yield* Effect.fail(invalid(\"Plan approval digest does not match its compiled content\"))\n }\n // Compare the complete node contract, including material and generation,\n // rather than trusting the claimed keys or the approval projection alone.\n const hash = Schema.decodeUnknownEffect(DerivedKey)\n if ((yield* hash(decoded.nodes)) !== (yield* hash(nodes))) {\n return yield* Effect.fail(\n invalid(\"Plan nodes do not match their compiled keys, effects, ordering, or generations\")\n )\n }\n return freezePlan({ ...decoded, nodes })\n })\n\n/**\n * The nodes added by the newest generation: what {@link module:PlanStore}\n * appends and what the `subgraph-appended` journal record names.\n *\n * @param plan - A plan.\n * @returns The nodes whose generation equals `plan.generation`, in order.\n * @since 0.1.0\n * @category accessors\n */\nexport const generationNodes = (plan: Plan): ReadonlyArray<PlanNode> =>\n plan.nodes.filter((node) => node.generation === plan.generation)\n\n/**\n * Whether `input` is a compiler-owned immutable snapshot that already passed\n * {@link verify}: such values take verify's trusted fast path and need no\n * second schema validation.\n *\n * @param input - Any value.\n * @returns `true` only for a plan returned by {@link compile},\n * {@link append}, or {@link verify}; a structurally equal copy returns `false`.\n * @since 1.0.0\n * @category guards\n */\nexport const isVerified = (input: unknown): input is Plan =>\n typeof input === \"object\" && input !== null && frozenPlans.has(input as Plan)\n\n/**\n * The approval digest of every generation before the newest: the digest this\n * plan carried before its last append. {@link module:PlanStore}'s append\n * matches it against the stored envelope, so an append proves the recorded\n * plan's integrity from the already-verified prefix instead of decoding and\n * re-verifying every stored row.\n *\n * For a generation-0 plan no generation precedes the newest, so this is the\n * digest of an empty node list.\n *\n * @param plan - A plan.\n * @returns The approval digest of the nodes older than `plan.generation`.\n * @since 1.0.0\n * @category accessors\n */\nexport const prefixDigest = (\n plan: Plan\n): Effect.Effect<StepKey.StepKey, StepKey.KeyMaterialError | Schema.SchemaError, Crypto.Crypto> =>\n digestOf(plan.planId, plan.flow, plan.nodes.filter((node) => node.generation < plan.generation))\n"]}
@@ -19,11 +19,13 @@ import type * as Plan from "./Plan.ts";
19
19
  *
20
20
  * @since 0.1.0
21
21
  * @category models
22
- * @slop
23
22
  */
24
23
  export interface Rekeyed {
24
+ /** The node's id in the newer plan. */
25
25
  readonly id: string;
26
+ /** The step key the paired node carried in the older plan. */
26
27
  readonly from: string;
28
+ /** The step key the node carries in the newer plan. */
27
29
  readonly to: string;
28
30
  /**
29
31
  * Field labels such as `"kind"`, `"body"`, `"layers"`, `"capabilities"`,
@@ -39,12 +41,15 @@ export interface Rekeyed {
39
41
  *
40
42
  * @since 0.1.0
41
43
  * @category models
42
- * @slop
43
44
  */
44
45
  export interface PlanDiff {
46
+ /** Ids, in the newer plan, of nodes with no counterpart in the older plan. */
45
47
  readonly added: ReadonlyArray<string>;
48
+ /** Ids, in the older plan, of nodes with no counterpart in the newer plan. */
46
49
  readonly removed: ReadonlyArray<string>;
50
+ /** Nodes paired by id whose step key changed, with the fields that changed it. */
47
51
  readonly rekeyed: ReadonlyArray<Rekeyed>;
52
+ /** Ids, in the newer plan, of nodes whose step key is unchanged, including nodes whose id moved. */
48
53
  readonly unchanged: ReadonlyArray<string>;
49
54
  }
50
55
  /**
@@ -67,7 +72,6 @@ export interface PlanDiff {
67
72
  * plan's node order.
68
73
  * @since 0.1.0
69
74
  * @category constructors
70
- * @slop
71
75
  */
72
76
  export declare const diff: (previous: Plan.Plan, next: Plan.Plan) => PlanDiff;
73
77
  //# sourceMappingURL=PlanDiff.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanDiff.d.ts","sourceRoot":"","sources":["../../src/PlanDiff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAA;AAGtC;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACxC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACvC,Q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@@ const changedFields = (previous, next, rekeyedDependencies, sameField) => {
132
132
  * plan's node order.
133
133
  * @since 0.1.0
134
134
  * @category constructors
135
- * @slop
136
135
  */
137
136
  export const diff = (previous, next) => {
138
137
  // pairs maps a next node to the previous node it is the same step as.
@@ -1 +1 @@
1
- {"version":3,"file":"PlanDiff.js","sourceRoot":"","sources":["../../src/PlanDiff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAuCrD;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,KAAc,EAAU,EAAE;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,GAAG,KAAK,GAAG,CAAA;IACjD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,WAAW,CAAA;IAC5F,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACnE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACjH,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;AACpG,CAAC,CAAA;AAED;;;;;GAKG;AACH,M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AA;IACnC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACnB,SAAQ;QACV,CAAC;QACD,IAAI,QAAQ,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACvB,SAAQ;QACV,CAAC;QACD,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,QAAQ,CAAC,GAAG;YAClB,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;SAC9D,CAAC,CAAA;IACJ,CAAC;IACD,OAAO;QACL,KAAK;QACL,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAClF,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA","sourcesContent":["/**\n * A plan comparison, as a value.\n *\n * A plan diff answers \"which steps changed key (and _which input_\n * changed them), what entered the envelope, what joined the release set —\n * 'what is different about this run' is a set comparison, not archaeology.\"\n * This module is the set comparison.\n *\n * The **verdict** is the key: two nodes with the same key are the same step,\n * under the same id or a moved one, and nothing else needs saying. The\n * **attribution** — `changed: [\"input[1]\"]` — is a report for a human, derived\n * by comparing the declarations field by field. It is deliberately not part of any digest.\n *\n * @since 0.1.0\n */\n\nimport { jsonMirror } from \"./internal/JsonMirror.ts\"\nimport type * as Plan from \"./Plan.ts\"\nimport type * as Planned from \"./Planned.ts\"\n\n/**\n * A node whose key moved, with the fields that moved it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface Rekeyed {\n readonly id: string\n readonly from: string\n readonly to: string\n /**\n * Field labels such as `\"kind\"`, `\"body\"`, `\"layers\"`, `\"capabilities\"`,\n * `\"effects\"`, and `\"input[0]\"` whose declaration differs. `\"kind\"` is the\n * effect tier (`sealed`, `compensable`, or `irreversible`). A\n * `Pending`-referenced upstream re-key is attributed to that input position\n * too. `changed` is empty only when none of the compared fields moved.\n */\n readonly changed: ReadonlyArray<string>\n}\n\n/**\n * What changed between two plans of the same flow.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface PlanDiff {\n readonly added: ReadonlyArray<string>\n readonly removed: ReadonlyArray<string>\n readonly rekeyed: ReadonlyArray<Rekeyed>\n readonly unchanged: ReadonlyArray<string>\n}\n\n/**\n * Order-insensitive structural comparison for the attribution report only.\n * Digests go through RFC 8785 canonical JSON; this does not have to, and\n * saying so keeps the two from being confused.\n *\n * @private\n */\nconst stable = (value: unknown): string => {\n if (typeof value === \"bigint\") return `${value}n`\n if (value === null || typeof value !== \"object\") return JSON.stringify(value) ?? \"undefined\"\n if (Array.isArray(value)) return `[${value.map(stable).join(\",\")}]`\n const entries = Object.entries(value as Record<string, unknown>).sort(([left], [right]) => left < right ? -1 : 1)\n return `{${entries.map(([name, entry]) => `${JSON.stringify(name)}:${stable(entry)}`).join(\",\")}}`\n}\n\n/**\n * A planned value compares as the reference an AST stores for it, so the same\n * reference at the same place is unchanged.\n *\n * @private\n */\nconst plannedReference = (_value: unknown, reference: Planned.Reference) => ({\n _tag: \"PlannedReference\",\n node: reference.node,\n path: reference.path\n})\n\n/** @private */\ntype ComparisonToken = string | symbol\n\n/**\n * Projects compared fields through the key's JSON semantics. A refused value\n * receives an identity token scoped to its node and field, so the same value\n * remains equal to itself without equating two distinct refused values.\n *\n * @private\n */\nconst fieldComparison = () => {\n const refused = new Map<unknown, Map<string, symbol>>()\n const token = (input: unknown, nodeId: string, field: string): ComparisonToken => {\n try {\n return stable(jsonMirror(input, plannedReference))\n } catch {\n const address = JSON.stringify([nodeId, field])\n let fields = refused.get(input)\n if (fields === undefined) {\n fields = new Map()\n refused.set(input, fields)\n }\n let sentinel = fields.get(address)\n if (sentinel === undefined) {\n sentinel = Symbol(address)\n fields.set(address, sentinel)\n }\n return sentinel\n }\n }\n return (previous: unknown, next: unknown, nodeId: string, field: string): boolean =>\n token(previous, nodeId, field) === token(next, nodeId, field)\n}\n\n/** @private */\nconst changedFields = (\n previous: Plan.PlanNode,\n next: Plan.PlanNode,\n rekeyedDependencies: ReadonlySet<string>,\n sameField: ReturnType<typeof fieldComparison>\n): ReadonlyArray<string> => {\n const changed: Array<string> = []\n // StepKey.materialBody is the identity list this attribution must mirror.\n // Inputs, layers, and capabilities complete fromKeyMaterial's hashed value,\n // and material.kind selects the key namespace (content versus tier-bearing\n // plan declaration), so a tier-only move still re-keys and is blamed here.\n if (!sameField(previous.material.version, next.material.version, next.id, \"version\")) changed.push(\"version\")\n if (previous.material.kind !== next.material.kind) changed.push(\"kind\")\n if (!sameField(previous.material.body, next.material.body, next.id, \"body\")) changed.push(\"body\")\n if (!sameField(previous.material.nondeterministic, next.material.nondeterministic, next.id, \"nondeterministic\")) {\n changed.push(\"nondeterministic\")\n }\n if (!sameField(previous.material.effects, next.material.effects, next.id, \"effects\")) changed.push(\"effects\")\n if (!sameField(previous.material.placement, next.material.placement, next.id, \"placement\")) {\n changed.push(\"placement\")\n }\n const width = Math.max(previous.material.inputs.length, next.material.inputs.length)\n for (let index = 0; index < width; index++) {\n const before = previous.material.inputs[index]\n const after = next.material.inputs[index]\n const field = `input[${index}]`\n if (before === undefined || after === undefined || !sameField(before, after, next.id, field)) {\n changed.push(field)\n continue\n }\n if (after._tag !== \"Literal\" && rekeyedDependencies.has(after.from)) changed.push(field)\n }\n if (!sameField(previous.material.layers, next.material.layers, next.id, \"layers\")) changed.push(\"layers\")\n if (!sameField(previous.material.capabilities, next.material.capabilities, next.id, \"capabilities\")) {\n changed.push(\"capabilities\")\n }\n return changed\n}\n\n/**\n * Compares a plan against the last plan for the same flow.\n *\n * Nodes pair in three passes, each over the nodes no earlier pass paired:\n * the same id with the same key, then the same key under any id, then the\n * same id with a different key. The second pass exists because flow node ids\n * can be positional: inserting a step shifts the ids after it while their\n * keys stay equal, and that is one added step, not a re-key of every later\n * one (#3905).\n *\n * `added`, `rekeyed`, and `unchanged` name nodes by their id in `next`;\n * `removed` names nodes by their id in `previous`. A moved id can therefore\n * appear once in `removed` or `added` and once in `unchanged`.\n *\n * @param previous - The last plan recorded for the flow.\n * @param next - The plan to compare against it.\n * @returns The added, removed, re-keyed, and unchanged node ids, each in its\n * plan's node order.\n * @since 0.1.0\n * @category constructors\n * @slop\n */\nexport const diff = (previous: Plan.Plan, next: Plan.Plan): PlanDiff => {\n // pairs maps a next node to the previous node it is the same step as.\n const pairs = new Map<Plan.PlanNode, Plan.PlanNode>()\n const paired = new Set<Plan.PlanNode>()\n const pair = (node: Plan.PlanNode, original: Plan.PlanNode) => {\n pairs.set(node, original)\n paired.add(original)\n }\n const before = new Map(previous.nodes.map((node) => [node.id, node]))\n for (const node of next.nodes) {\n const original = before.get(node.id)\n if (original !== undefined && original.key === node.key) pair(node, original)\n }\n const byKey = new Map<string, Array<Plan.PlanNode>>()\n for (const node of previous.nodes) {\n if (paired.has(node)) continue\n const same = byKey.get(node.key)\n if (same === undefined) byKey.set(node.key, [node])\n else same.push(node)\n }\n for (const node of next.nodes) {\n if (pairs.has(node)) continue\n const original = byKey.get(node.key)?.shift()\n if (original !== undefined) pair(node, original)\n }\n const rekeyedIds = new Set<string>()\n for (const node of next.nodes) {\n if (pairs.has(node)) continue\n const original = before.get(node.id)\n if (original !== undefined && !paired.has(original)) {\n pair(node, original)\n rekeyedIds.add(node.id)\n }\n }\n const added: Array<string> = []\n const rekeyed: Array<Rekeyed> = []\n const unchanged: Array<string> = []\n const sameField = fieldComparison()\n for (const node of next.nodes) {\n const original = pairs.get(node)\n if (original === undefined) {\n added.push(node.id)\n continue\n }\n if (original.key === node.key) {\n unchanged.push(node.id)\n continue\n }\n rekeyed.push({\n id: node.id,\n from: original.key,\n to: node.key,\n changed: changedFields(original, node, rekeyedIds, sameField)\n })\n }\n return {\n added,\n removed: previous.nodes.filter((node) => !paired.has(node)).map((node) => node.id),\n rekeyed,\n unchanged\n }\n}\n"]}
1
+ {"version":3,"file":"PlanDiff.js","sourceRoot":"","sources":["../../src/PlanDiff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AA4CrD;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,KAAc,EAAU,EAAE;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,GAAG,KAAK,GAAG,CAAA;IACjD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,WAAW,CAAA;IAC5F,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IACnE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACjH,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAA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CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAkB,EAAE,CAAA;IAC/B,MAAM,OAAO,GAAmB,EAAE,CAAA;IAClC,MAAM,SAAS,GAAkB,EAAE,CAAA;IACnC,MAAM,SAAS,GAAG,eAAe,EAAE,CAAA;IACnC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACnB,SAAQ;QACV,CAAC;QACD,IAAI,QAAQ,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACvB,SAAQ;QACV,CAAC;QACD,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,QAAQ,CAAC,GAAG;YAClB,EAAE,EAAE,IAAI,CAAC,GAAG;YACZ,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;SAC9D,CAAC,CAAA;IACJ,CAAC;IACD,OAAO;QACL,KAAK;QACL,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAClF,OAAO;QACP,SAAS;KACV,CAAA;AACH,CAAC,CAAA","sourcesContent":["/**\n * A plan comparison, as a value.\n *\n * A plan diff answers \"which steps changed key (and _which input_\n * changed them), what entered the envelope, what joined the release set —\n * 'what is different about this run' is a set comparison, not archaeology.\"\n * This module is the set comparison.\n *\n * The **verdict** is the key: two nodes with the same key are the same step,\n * under the same id or a moved one, and nothing else needs saying. The\n * **attribution** — `changed: [\"input[1]\"]` — is a report for a human, derived\n * by comparing the declarations field by field. It is deliberately not part of any digest.\n *\n * @since 0.1.0\n */\n\nimport { jsonMirror } from \"./internal/JsonMirror.ts\"\nimport type * as Plan from \"./Plan.ts\"\nimport type * as Planned from \"./Planned.ts\"\n\n/**\n * A node whose key moved, with the fields that moved it.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface Rekeyed {\n /** The node's id in the newer plan. */\n readonly id: string\n /** The step key the paired node carried in the older plan. */\n readonly from: string\n /** The step key the node carries in the newer plan. */\n readonly to: string\n /**\n * Field labels such as `\"kind\"`, `\"body\"`, `\"layers\"`, `\"capabilities\"`,\n * `\"effects\"`, and `\"input[0]\"` whose declaration differs. `\"kind\"` is the\n * effect tier (`sealed`, `compensable`, or `irreversible`). A\n * `Pending`-referenced upstream re-key is attributed to that input position\n * too. `changed` is empty only when none of the compared fields moved.\n */\n readonly changed: ReadonlyArray<string>\n}\n\n/**\n * What changed between two plans of the same flow.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface PlanDiff {\n /** Ids, in the newer plan, of nodes with no counterpart in the older plan. */\n readonly added: ReadonlyArray<string>\n /** Ids, in the older plan, of nodes with no counterpart in the newer plan. */\n readonly removed: ReadonlyArray<string>\n /** Nodes paired by id whose step key changed, with the fields that changed it. */\n readonly rekeyed: ReadonlyArray<Rekeyed>\n /** Ids, in the newer plan, of nodes whose step key is unchanged, including nodes whose id moved. */\n readonly unchanged: ReadonlyArray<string>\n}\n\n/**\n * Order-insensitive structural comparison for the attribution report only.\n * Digests go through RFC 8785 canonical JSON; this does not have to, and\n * saying so keeps the two from being confused.\n *\n * @private\n */\nconst stable = (value: unknown): string => {\n if (typeof value === \"bigint\") return `${value}n`\n if (value === null || typeof value !== \"object\") return JSON.stringify(value) ?? \"undefined\"\n if (Array.isArray(value)) return `[${value.map(stable).join(\",\")}]`\n const entries = Object.entries(value as Record<string, unknown>).sort(([left], [right]) => left < right ? -1 : 1)\n return `{${entries.map(([name, entry]) => `${JSON.stringify(name)}:${stable(entry)}`).join(\",\")}}`\n}\n\n/**\n * A planned value compares as the reference an AST stores for it, so the same\n * reference at the same place is unchanged.\n *\n * @private\n */\nconst plannedReference = (_value: unknown, reference: Planned.Reference) => ({\n _tag: \"PlannedReference\",\n node: reference.node,\n path: reference.path\n})\n\n/** @private */\ntype ComparisonToken = string | symbol\n\n/**\n * Projects compared fields through the key's JSON semantics. A refused value\n * receives an identity token scoped to its node and field, so the same value\n * remains equal to itself without equating two distinct refused values.\n *\n * @private\n */\nconst fieldComparison = () => {\n const refused = new Map<unknown, Map<string, symbol>>()\n const token = (input: unknown, nodeId: string, field: string): ComparisonToken => {\n try {\n return stable(jsonMirror(input, plannedReference))\n } catch {\n const address = JSON.stringify([nodeId, field])\n let fields = refused.get(input)\n if (fields === undefined) {\n fields = new Map()\n refused.set(input, fields)\n }\n let sentinel = fields.get(address)\n if (sentinel === undefined) {\n sentinel = Symbol(address)\n fields.set(address, sentinel)\n }\n return sentinel\n }\n }\n return (previous: unknown, next: unknown, nodeId: string, field: string): boolean =>\n token(previous, nodeId, field) === token(next, nodeId, field)\n}\n\n/** @private */\nconst changedFields = (\n previous: Plan.PlanNode,\n next: Plan.PlanNode,\n rekeyedDependencies: ReadonlySet<string>,\n sameField: ReturnType<typeof fieldComparison>\n): ReadonlyArray<string> => {\n const changed: Array<string> = []\n // StepKey.materialBody is the identity list this attribution must mirror.\n // Inputs, layers, and capabilities complete fromKeyMaterial's hashed value,\n // and material.kind selects the key namespace (content versus tier-bearing\n // plan declaration), so a tier-only move still re-keys and is blamed here.\n if (!sameField(previous.material.version, next.material.version, next.id, \"version\")) changed.push(\"version\")\n if (previous.material.kind !== next.material.kind) changed.push(\"kind\")\n if (!sameField(previous.material.body, next.material.body, next.id, \"body\")) changed.push(\"body\")\n if (!sameField(previous.material.nondeterministic, next.material.nondeterministic, next.id, \"nondeterministic\")) {\n changed.push(\"nondeterministic\")\n }\n if (!sameField(previous.material.effects, next.material.effects, next.id, \"effects\")) changed.push(\"effects\")\n if (!sameField(previous.material.placement, next.material.placement, next.id, \"placement\")) {\n changed.push(\"placement\")\n }\n const width = Math.max(previous.material.inputs.length, next.material.inputs.length)\n for (let index = 0; index < width; index++) {\n const before = previous.material.inputs[index]\n const after = next.material.inputs[index]\n const field = `input[${index}]`\n if (before === undefined || after === undefined || !sameField(before, after, next.id, field)) {\n changed.push(field)\n continue\n }\n if (after._tag !== \"Literal\" && rekeyedDependencies.has(after.from)) changed.push(field)\n }\n if (!sameField(previous.material.layers, next.material.layers, next.id, \"layers\")) changed.push(\"layers\")\n if (!sameField(previous.material.capabilities, next.material.capabilities, next.id, \"capabilities\")) {\n changed.push(\"capabilities\")\n }\n return changed\n}\n\n/**\n * Compares a plan against the last plan for the same flow.\n *\n * Nodes pair in three passes, each over the nodes no earlier pass paired:\n * the same id with the same key, then the same key under any id, then the\n * same id with a different key. The second pass exists because flow node ids\n * can be positional: inserting a step shifts the ids after it while their\n * keys stay equal, and that is one added step, not a re-key of every later\n * one (#3905).\n *\n * `added`, `rekeyed`, and `unchanged` name nodes by their id in `next`;\n * `removed` names nodes by their id in `previous`. A moved id can therefore\n * appear once in `removed` or `added` and once in `unchanged`.\n *\n * @param previous - The last plan recorded for the flow.\n * @param next - The plan to compare against it.\n * @returns The added, removed, re-keyed, and unchanged node ids, each in its\n * plan's node order.\n * @since 0.1.0\n * @category constructors\n */\nexport const diff = (previous: Plan.Plan, next: Plan.Plan): PlanDiff => {\n // pairs maps a next node to the previous node it is the same step as.\n const pairs = new Map<Plan.PlanNode, Plan.PlanNode>()\n const paired = new Set<Plan.PlanNode>()\n const pair = (node: Plan.PlanNode, original: Plan.PlanNode) => {\n pairs.set(node, original)\n paired.add(original)\n }\n const before = new Map(previous.nodes.map((node) => [node.id, node]))\n for (const node of next.nodes) {\n const original = before.get(node.id)\n if (original !== undefined && original.key === node.key) pair(node, original)\n }\n const byKey = new Map<string, Array<Plan.PlanNode>>()\n for (const node of previous.nodes) {\n if (paired.has(node)) continue\n const same = byKey.get(node.key)\n if (same === undefined) byKey.set(node.key, [node])\n else same.push(node)\n }\n for (const node of next.nodes) {\n if (pairs.has(node)) continue\n const original = byKey.get(node.key)?.shift()\n if (original !== undefined) pair(node, original)\n }\n const rekeyedIds = new Set<string>()\n for (const node of next.nodes) {\n if (pairs.has(node)) continue\n const original = before.get(node.id)\n if (original !== undefined && !paired.has(original)) {\n pair(node, original)\n rekeyedIds.add(node.id)\n }\n }\n const added: Array<string> = []\n const rekeyed: Array<Rekeyed> = []\n const unchanged: Array<string> = []\n const sameField = fieldComparison()\n for (const node of next.nodes) {\n const original = pairs.get(node)\n if (original === undefined) {\n added.push(node.id)\n continue\n }\n if (original.key === node.key) {\n unchanged.push(node.id)\n continue\n }\n rekeyed.push({\n id: node.id,\n from: original.key,\n to: node.key,\n changed: changedFields(original, node, rekeyedIds, sameField)\n })\n }\n return {\n added,\n removed: previous.nodes.filter((node) => !paired.has(node)).map((node) => node.id),\n rekeyed,\n unchanged\n }\n}\n"]}
@@ -39,7 +39,6 @@ import type * as KeyMaterial from "./KeyMaterial.ts";
39
39
  *
40
40
  * @since 0.1.0
41
41
  * @category models
42
- * @slop
43
42
  */
44
43
  export type StepKey = StoredKey;
45
44
  /**
@@ -65,7 +64,6 @@ type GraphReference = "ref" | "pending" | "ref-projected";
65
64
  *
66
65
  * @since 0.1.0
67
66
  * @category models
68
- * @slop
69
67
  */
70
68
  export interface DigestInput {
71
69
  readonly [DigestInputTypeId]: typeof DigestInputTypeId;
@@ -86,20 +84,25 @@ export interface DigestInput {
86
84
  * Nominally tags a precomputed digest so it is hashed as a digest reference
87
85
  * rather than a literal value.
88
86
  *
87
+ * @param digest - The precomputed digest.
88
+ * @param reference - Which graph reference resolved to the digest, and the
89
+ * projection path for `ref-projected`. Omit for a plain digest.
90
+ * @returns The tagged digest input.
89
91
  * @since 0.1.0
90
92
  * @category constructors
91
- * @slop
92
93
  */
93
94
  export declare const digestInput: (digest: string, reference?: {
94
95
  readonly reference: GraphReference;
95
96
  readonly path?: ReadonlyArray<string>;
96
97
  }) => DigestInput;
97
98
  /**
98
- * Type guard for values produced by {@link digestInput}.
99
+ * Type guard for values produced by {@link digestInput}. A plain object
100
+ * shaped like `{ digest: "..." }` is not one.
99
101
  *
102
+ * @param value - Any value.
103
+ * @returns `true` only for a value carrying the private digest-input brand.
100
104
  * @since 0.1.0
101
105
  * @category guards
102
- * @slop
103
106
  */
104
107
  export declare const isDigestInput: (value: unknown) => value is DigestInput;
105
108
  /**
@@ -126,7 +129,6 @@ export declare const isDigestInput: (value: unknown) => value is DigestInput;
126
129
  *
127
130
  * @since 0.1.0
128
131
  * @category models
129
- * @slop
130
132
  */
131
133
  export type EnvironmentIdentity = typeof EnvironmentIdentity.Type;
132
134
  /**
@@ -155,9 +157,13 @@ export declare const EnvironmentIdentity: Schema.Union<readonly [Schema.Struct<{
155
157
  * digest. Entries are sound only while each settled `from` value is immutable;
156
158
  * callers must create a fresh memo when those values can change.
157
159
  *
160
+ * `digest(from, path, compute)` runs `compute` once per address and shares its
161
+ * result with concurrent callers. A failed or interrupted computation is not
162
+ * kept: the next caller recomputes, and a waiter whose leader was interrupted
163
+ * becomes the new leader instead of inheriting the interrupt.
164
+ *
158
165
  * @since 0.1.0
159
166
  * @category models
160
- * @slop
161
167
  */
162
168
  export interface DigestMemo {
163
169
  readonly digest: (from: string, path: ReadonlyArray<string>, compute: Effect.Effect<StepKey, Schema.SchemaError, Crypto.Crypto>) => Effect.Effect<StepKey, Schema.SchemaError, Crypto.Crypto>;
@@ -166,9 +172,9 @@ export interface DigestMemo {
166
172
  * Creates an empty projected-value digest memo. Projection addresses are
167
173
  * JSON-encoded `[from, path]` tuples so segment boundaries are unambiguous.
168
174
  *
175
+ * @returns A memo with no entries.
169
176
  * @since 0.1.0
170
177
  * @category constructors
171
- * @slop
172
178
  */
173
179
  export declare const makeDigestMemo: () => DigestMemo;
174
180
  /**
@@ -176,7 +182,6 @@ export declare const makeDigestMemo: () => DigestMemo;
176
182
  *
177
183
  * @since 0.1.0
178
184
  * @category models
179
- * @slop
180
185
  */
181
186
  export interface ContentIdentity {
182
187
  readonly body: unknown;
@@ -199,7 +204,6 @@ export interface ContentIdentity {
199
204
  *
200
205
  * @since 0.1.0
201
206
  * @category models
202
- * @slop
203
207
  */
204
208
  export interface OrdinalIdentity {
205
209
  readonly runId: string;
@@ -212,11 +216,18 @@ declare const KeyMaterialError_base: Schema.Class<KeyMaterialError, Schema.Tagge
212
216
  readonly message: Schema.String;
213
217
  }>, Cause.YieldableError>;
214
218
  /**
215
- * Stable failures while resolving graph-local dependency references.
219
+ * Stable failures while deriving a key. `code` names the rule:
220
+ *
221
+ * - `invalid_environment`: an {@link EnvironmentIdentity} that is neither
222
+ * declared nor run-scoped.
223
+ * - `missing_dependency`: a `Ref` or `Pending` input names a node with no
224
+ * recorded digest, or, at dispatch, a `Ref` names one with no settled
225
+ * result.
226
+ * - `non_content_material`: a content-key constructor received material whose
227
+ * tier is not `sealed`.
216
228
  *
217
229
  * @since 0.1.0
218
230
  * @category errors
219
- * @slop
220
231
  */
221
232
  export declare class KeyMaterialError extends KeyMaterialError_base {
222
233
  }
@@ -233,18 +244,21 @@ export declare const environmentIdentity: (environment?: EnvironmentIdentity) =>
233
244
  * declarations are normalized before serialization; write declarations remain
234
245
  * part of the identity even when the step writes nothing.
235
246
  *
247
+ * @param identity - The step's content material.
248
+ * @returns The content key. Fails with `invalid_environment` for a malformed
249
+ * environment, or `SchemaError` when the material cannot be serialized.
236
250
  * @since 0.1.0
237
251
  * @category constructors
238
- * @slop
239
252
  */
240
253
  export declare const content: (identity: ContentIdentity) => Effect.Effect<StepKey, KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
241
254
  /**
242
255
  * Produces a run-local ordinal key for compensable, irreversible, or unsealed
243
256
  * work. These keys intentionally cannot be reused across runs.
244
257
  *
258
+ * @param identity - The run id, optional parent scope, ordinal, and tier.
259
+ * @returns The ordinal key.
245
260
  * @since 0.1.0
246
261
  * @category constructors
247
- * @slop
248
262
  */
249
263
  export declare const ordinal: (identity: OrdinalIdentity) => Effect.Effect<StepKey, Schema.SchemaError, Crypto.Crypto>;
250
264
  /**
@@ -258,9 +272,13 @@ export declare const ordinal: (identity: OrdinalIdentity) => Effect.Effect<StepK
258
272
  * and never enter the hashed value — rename a node and nothing re-keys; change
259
273
  * what a node consumes and everything downstream of it does.
260
274
  *
275
+ * @param material - The node's key material; its tier must be `sealed`.
276
+ * @param dependencyDigests - The key of every node the material references,
277
+ * by node id.
278
+ * @returns The content key. Fails with `non_content_material` for a
279
+ * non-sealed tier and `missing_dependency` for an unresolved reference.
261
280
  * @since 0.1.0
262
281
  * @category constructors
263
- * @slop
264
282
  */
265
283
  export declare const fromKeyMaterial: (material: KeyMaterial.KeyMaterial, dependencyDigests: Readonly<Record<string, string>>) => Effect.Effect<StepKey, KeyMaterialError | Schema.SchemaError, Crypto.Crypto>;
266
284
  /**
@@ -290,7 +308,6 @@ export declare const planIdentity: (material: KeyMaterial.KeyMaterial, dependenc
290
308
  *
291
309
  * @since 0.1.0
292
310
  * @category utilities
293
- * @slop
294
311
  */
295
312
  export declare const project: (value: unknown, path: ReadonlyArray<string>) => unknown;
296
313
  /**
@@ -315,9 +332,13 @@ export declare const project: (value: unknown, path: ReadonlyArray<string>) => u
315
332
  * halt rule guarantees it: a dependent of failed or skipped work never
316
333
  * dispatches, so a `Ref` always resolves against a success.
317
334
  *
335
+ * @param options - The material, the dependencies' settled results, the
336
+ * measured hermetic boundary, and an optional environment and memo.
337
+ * @returns The dispatch key. Fails with `non_content_material` for a
338
+ * non-sealed tier, `missing_dependency` for a `Ref` absent from `results`,
339
+ * or `invalid_environment` for a malformed environment.
318
340
  * @since 0.1.0
319
341
  * @category constructors
320
- * @slop
321
342
  */
322
343
  export declare const dispatchIdentity: (options: {
323
344
  readonly material: KeyM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