{"version":3,"file":"orchestration.mjs","names":[],"sources":["../../src/batteries/orchestration/index.ts"],"sourcesContent":["/**\n * The orchestration battery — plan lifecycle, execution, and the model-facing tool forge.\n *\n * @module @nhtio/adk/batteries/orchestration\n *\n * @remarks\n * This is the battery's BARREL and its single entry point: the assembly gate where the\n * work-package pieces (validation, approval, the executor, templates, rendering, the raw\n * views, the outline reader and the tool forge) are wired together. It is the one place a\n * precondition can be enforced for every operation, which is why the encoder requirement and\n * evaluator loading live here rather than scattered across the modules that happen to need them.\n *\n * ### Why `createOrchestration` is async\n *\n * Construction is the last moment a deployment can fail LOUDLY and EARLY. Four things are\n * resolved here, before any plan is created, frozen or approved:\n *\n * 1. **The encoder is required.** `@nhtio/encoder` is declared an OPTIONAL PEER of the whole\n *    package — peer metadata is package-wide, not subpath-scoped, so making it required would\n *    force it on every consumer including the many who never import orchestration. The\n *    requirement is enforced where it CAN be: at construction, by eagerly\n *    `await import('@nhtio/encoder')` and throwing {@link E_ORCH_ENCODER_REQUIRED} (naming the\n *    package and its install command) if it is absent. Failing here means no plan is ever created,\n *    frozen or approved in a deployment missing the encoder — the property that actually matters.\n *    It is genuinely required because the digest comes from a lossless canonical encoding, and\n *    digests are load-bearing in every lifecycle transition, approval binding and `claimRun` —\n *    even an in-memory store needs them.\n * 2. **Encodables are registered once.** `registerOrchestrationEncodables()` is called here,\n *    once, because `registerClass` is a global registry and decoding an unregistered class throws.\n * 3. **Every configured evaluator cell is loaded.** `await load()` runs on each cell supplied at\n *    construction, so a missing optional peer surfaces HERE rather than part-way through a freeze.\n *    A cell supplied per-run is loaded at that point, with the same named error.\n * 4. **Every registered template is validated.** `validateTemplate` runs on each template and a\n *    blocking issue throws, so a misconfigured deployment fails at boot with a named error rather\n *    than at first instantiation months later.\n *\n * ### Dependency precedence\n *\n * Resolved HERE and stated once so it cannot drift: **per-run wins field by field over\n * construction**; anything absent from both is a named error if the plan needs it. `evaluators`\n * MERGE BY CELL `id` — a per-run cell replaces the configured one with the same id, others\n * survive — because a run legitimately swaps one cell while keeping the rest. Everything else\n * replaces wholesale.\n *\n * ### Environment neutrality\n *\n * The barrel stays environment-neutral: there is no `node:*` anywhere in its module graph. The\n * Lua cell (`./cells/lua`) imports `node:worker_threads` and is therefore NOT re-exported here —\n * it is reachable only via its own deep subpath.\n *\n * The conformance suite (`./conformance`) is excluded for the same reason in a different\n * dimension: it imports `vitest`, which is an OPTIONAL peer dependency. A barrel re-export makes\n * that import part of every consumer's module graph, so `import '@nhtio/adk/batteries/orchestration'`\n * fails with `ERR_MODULE_NOT_FOUND` for anyone who has not installed a test runner — which is\n * every production consumer. It is reachable only via its own deep subpath, from a test\n * environment where `vitest` is present. This matches `batteries/vector`, whose conformance suite\n * is likewise vitest-based and likewise subpath-only. (`batteries/sandbox` DOES re-export its\n * suite from its barrel, and that is fine: it asserts through a local `assert` helper and imports\n * no test framework at all. The rule is about the `vitest` import, not about conformance suites.)\n *\n * The structured and jexl cells, the types, the exceptions, the store contract and the in-memory\n * store, and the raw/render/outline functions are all re-exported.\n *\n * ### How the deep subpaths are named\n *\n * Every module carrying an `@module` tag becomes one published entry, and the entry key is its\n * FULL path from `src/` — `batteries/orchestration/forge`, not `forge`. The build derives the map\n * by scanning for those tags (`getEntries` in `bin/utils`), and the emitted declaration sits at\n * the matching path, so `dist/batteries/orchestration/types.d.ts` and `dist/types.d.ts` are\n * different files reached by different specifiers.\n *\n * Stated because the leaf basenames repeat and that looks alarming: this battery ships `forge`\n * and `types`, and so do the root package and several other batteries — 25 modules end in\n * `/types` today, four in `/forge`. None of them collide, because nothing is keyed on the\n * basename. A module tagged here can never overwrite `@nhtio/adk/forge`.\n */\n\nimport { renderPlan } from './render'\nimport { planOutline } from './outline'\nimport { approvePlan } from './approval'\nimport { executePlan } from './executor'\nimport { freezePlan } from './validation'\nimport { rawPlan, rawOps, rawDiff } from './raw'\nimport { forgeOrchestrationTools } from './forge'\nimport { registerOrchestrationEncodables } from './encoding'\nimport { validateTemplate, instantiateTemplate } from './templates'\nimport { isObject, isError, isInstanceOf } from '../../lib/utils/guards'\nimport { E_ORCH_ENCODER_REQUIRED, E_ORCH_CELL_UNAVAILABLE } from './exceptions'\nimport type {\n  CreateOrchestration,\n  FreezeInputs,\n  InvocableTools,\n  Orchestration,\n  PlanTemplate,\n  PredicateEvaluator,\n  RunDeps,\n  RunOptions,\n} from './types'\n\n// ── re-exports: the public deep-import surface ─────────────────────────────\n\nexport { InMemoryPlanStore } from './in_memory'\nexport { createStructuredCell } from './cells/structured'\nexport type { JexlCellOptions, JexlTransform } from './cells/jexl'\nexport { createJexlCell } from './cells/jexl'\n\nexport { renderPlan } from './render'\nexport type { RenderPlanOptions } from './render'\nexport { rawPlan, rawOps, rawDiff } from './raw'\nexport { planOutline, planRead } from './outline'\n\nexport { NodeRef, ParamRef, registerOrchestrationEncodables, planDigest } from './encoding'\nexport { computeAuthoritySet } from './approval'\nexport { validateTemplate, instantiateTemplate } from './templates'\nexport { forgeOrchestrationTools } from './forge'\nexport type { ForgeOrchestrationRuntime, ForgeOrchestrationOptions } from './forge'\nexport { effectiveToolMethods } from './artifact_methods'\nexport {\n  isPlanNode,\n  isPlanEdge,\n  nodeById,\n  outgoing,\n  incoming,\n  entryNodes,\n  reachableFrom,\n  findCycle,\n  routesBetween,\n  immediateDominator,\n  handleAppliesTo,\n  readPath,\n  isValidNodeId,\n  isValidEdgeId,\n} from './plan'\nexport { foldRun } from './runs'\nexport { foldOps, branchKey } from './ops'\nexport {\n  joinPromptParts,\n  stripInstructionTags,\n  wrapInstruction,\n  decodeOutputSchema,\n  validateReasonerOutput,\n} from './reason'\nexport {\n  isPredicateLeaf,\n  isAllPredicate,\n  isAnyPredicate,\n  isNotPredicate,\n  isStructuredPredicate,\n  parseStructuredPredicate,\n  loadOnce,\n} from './predicates'\nexport type {\n  PredicateOp,\n  PredicateLeaf,\n  AllPredicate,\n  AnyPredicate,\n  NotPredicate,\n  StructuredPredicate,\n  ParsePredicateResult,\n} from './predicates'\nexport { createDispatchReasoner } from './dispatch_reasoner'\nexport { E_ORCH_ENCODER_REQUIRED, E_ORCH_CELL_UNAVAILABLE } from './exceptions'\n\nexport type {\n  PlanStore,\n  CreateResult,\n  AppendResult,\n  TransitionRequest,\n  TransitionResult,\n  ClaimRunResult,\n} from './store'\nexport type { PlanLock, PlanLockFactory } from './locks'\n\n// The full type surface of the battery, re-exported once so a consumer needs only this barrel.\n// `NodeRef`/`ParamRef`/`branchKey`/`foldRun`/`effectiveToolMethods` are re-exported above as the\n// real values (from the modules that implement them) and appear here as types only where the\n// `types.ts` declarations carry them; the value re-exports win for runtime use.\nexport type {\n  // lifecycle & identity\n  PlanState,\n  PlanId,\n  NodeId,\n  // value domain\n  EncodableValue,\n  ArgValue,\n  BranchId,\n  RouteSegment,\n  NodeOutput,\n  OutputItem,\n  OutputTable,\n  ArtifactTable,\n  SpooledArtifactLike,\n  MediaLike,\n  // node definitions\n  PlanNodeKind,\n  EdgeHandle,\n  PlanEdge,\n  DeclaredField,\n  EntryNodeDefinition,\n  CallNodeDefinition,\n  ReasonNodeDefinition,\n  PromptPart,\n  TransformNodeDefinition,\n  BranchNodeDefinition,\n  SelectNodeDefinition,\n  JoinNodeDefinition,\n  PlanNode,\n  // reading surface\n  PlanOutline,\n  PhaseEntry,\n  PlanSlice,\n  // run events\n  NodeOutcome,\n  FrameRef,\n  RunEvent,\n  PendingFrame,\n  JoinState,\n  RunProjection,\n  // injected seams\n  CallInvokerFn,\n  ToolResult,\n  ArtifactMethodDescriptor,\n  ArtifactClassLike,\n  ReasonerFn,\n  PredicateEvaluator,\n  PredicateContext,\n  PredicateVerdict,\n  AuthorityClaim,\n  AuthorityVerb,\n  // ops & bounds\n  PlanOp,\n  PlanBounds,\n  // templates\n  PlanTemplate,\n  TemplateArgValue,\n  TemplateNode,\n  TemplateDefinitionOf,\n  InstantiateResult,\n  // views\n  RawPlanView,\n  PlanSummary,\n  PlanIssue,\n  PlanDiff,\n  ApprovalRecord,\n  InterruptionCause,\n  // provenance\n  PlanProvenance,\n  ClonedFrom,\n  InstantiatedFrom,\n  // assembly\n  RunDeps,\n  RunOptions,\n  ExecutePlanFn,\n  FreezeInputs,\n  InvocableTools,\n  Orchestration,\n  CreateOrchestration,\n} from './types'\n\n// ── helpers ────────────────────────────────────────────────────────────────\n\n/**\n * The install command for the optional `@nhtio/encoder` peer, surfaced in the\n * {@link E_ORCH_ENCODER_REQUIRED} message so the failure names the fix.\n */\nconst ENCODER_INSTALL = 'npm install @nhtio/encoder'\n\n/**\n * Eagerly resolve the `@nhtio/encoder` optional peer and throw a named, fatal error if it is\n * absent. The encoder is required by orchestration — digests are load-bearing in every lifecycle\n * transition — but it stays an optional peer of the package as a whole, so the requirement is\n * enforced at construction rather than in `package.json`.\n *\n * @internal\n */\nconst requireEncoder = async (): Promise<void> => {\n  try {\n    await import('@nhtio/encoder')\n  } catch (err) {\n    const detail = isError(err) ? err.message : String(err)\n    throw new E_ORCH_ENCODER_REQUIRED([\n      `orchestration requires the @nhtio/encoder optional peer, which could not be loaded. ` +\n        `Install it with: ${ENCODER_INSTALL}. Underlying error: ${detail}`,\n    ])\n  }\n}\n\n/**\n * Load a single evaluator cell, surfacing a missing optional peer as\n * {@link E_ORCH_CELL_UNAVAILABLE}. A cell's own `load()` already maps an import failure to that\n * error; this wrapper additionally guards a cell whose `load` is missing or throws a non-named\n * error, so construction fails with a named error regardless of which path the failure took.\n *\n * @internal\n */\nconst loadCell = async (cell: PredicateEvaluator): Promise<void> => {\n  const detail =\n    `orchestration cell '${cell.id}' is unavailable: its optional peer could not be loaded. ` +\n    `Install it with: npm install ${cell.id}.`\n  try {\n    await cell.load()\n  } catch (err) {\n    // A cell's own load() already throws E_ORCH_CELL_UNAVAILABLE; rethrow that verbatim.\n    if (isInstanceOf(err, 'E_ORCH_CELL_UNAVAILABLE', E_ORCH_CELL_UNAVAILABLE)) throw err\n    // Anything else becomes the named error so construction still fails loudly and by name.\n    const reason = isError(err) ? err.message : String(err)\n    throw new E_ORCH_CELL_UNAVAILABLE([`${detail} Underlying error: ${reason}`])\n  }\n}\n\n/**\n * Merge evaluator cells by `id`: a per-run cell replaces the configured one with the same id,\n * others survive. A run legitimately swaps one cell while keeping the rest, so the merge is\n * cell-by-cell rather than wholesale.\n *\n * @internal\n */\nconst mergeEvaluators = (\n  configured: readonly PredicateEvaluator[],\n  perRun: readonly PredicateEvaluator[] | undefined\n): PredicateEvaluator[] => {\n  if (!perRun || perRun.length === 0) return [...configured]\n  if (configured.length === 0) return [...perRun]\n  const byId = new Map<string, PredicateEvaluator>()\n  for (const cell of configured) byId.set(cell.id, cell)\n  for (const cell of perRun) byId.set(cell.id, cell) // per-run wins by id\n  return [...byId.values()]\n}\n\n/**\n * Resolve freeze inputs field-by-field against the construction defaults, merging `evaluators`\n * by cell id and replacing `invocable` wholesale. Returns the fully-resolved\n * {@link FreezeInputs} that `validation.ts`'s internal `freezePlan` expects.\n *\n * @internal\n */\nconst resolveFreezeInputs = (\n  defaults: { invocable: InvocableTools; evaluators: PredicateEvaluator[] },\n  override: Partial<FreezeInputs> | undefined\n): FreezeInputs => ({\n  invocable: override?.invocable ?? defaults.invocable,\n  evaluators: mergeEvaluators(defaults.evaluators, override?.evaluators),\n})\n\n/**\n * Resolve per-run options against the construction `deps`, applying the same field-by-field\n * precedence: per-run wins, `evaluators` merge by cell id, everything else replaces wholesale.\n * The result is the `RunOptions` passed to the executor's internal `executePlan`.\n *\n * @internal\n */\nconst resolveRunOptions = (deps: Partial<RunDeps>, options: RunOptions): RunOptions => ({\n  ...options,\n  invokeCall: options.invokeCall ?? deps.invokeCall,\n  reason: options.reason ?? deps.reason,\n  evaluators: mergeEvaluators(deps.evaluators ?? [], options.evaluators),\n  locks: options.locks ?? deps.locks,\n})\n\n// ── the assembly gate ──────────────────────────────────────────────────────\n\n/**\n * THE battery's single entry point. Everything public is reached through the\n * {@link Orchestration} object it returns, so it is the one place a precondition can be enforced\n * for every operation.\n *\n * Construction is async because it eagerly resolves the `@nhtio/encoder` optional peer (throwing\n * {@link E_ORCH_ENCODER_REQUIRED} if absent), registers the orchestration encodables once, loads\n * every configured evaluator cell (so a missing optional peer surfaces here rather than at\n * freeze), and validates every registered template (so a misconfigured deployment fails at boot\n * with a named error rather than at first instantiation).\n *\n * **You do not need to call `registerOrchestrationEncodables()` yourself if you construct through\n * this function** — it runs here, before any plan can exist, so `decode()` can rebuild `NodeRef`\n * and `ParamRef` from that moment on. Call it directly only when you reach the deep subpaths\n * WITHOUT constructing an `Orchestration`: decoding a persisted plan in a worker that never builds\n * one, for instance. It is idempotent, so calling it anyway is harmless.\n *\n * See the module doc for the full rationale and the dependency-precedence rules.\n *\n * @param config - The store, tier-C allowlist, optional run-dependency defaults, and optional\n *   consumer-defined plan templates.\n * @returns The assembled {@link Orchestration} surface.\n * @throws {E_ORCH_ENCODER_REQUIRED} if `@nhtio/encoder` is not installed.\n * @throws {E_ORCH_CELL_UNAVAILABLE} if a configured evaluator cell's optional peer is missing.\n * @throws {Error} if a registered template has a blocking validation issue.\n */\nexport const createOrchestration: CreateOrchestration = async (config) => {\n  if (!isObject(config)) {\n    throw new TypeError('createOrchestration: config must be an object')\n  }\n  const { store, invocable, deps, templates } = config\n\n  // 1. The encoder is required by orchestration. Resolve it eagerly and throw a named, fatal\n  //    error naming the package and its install command if the optional peer is absent.\n  await requireEncoder()\n  // 2. Register the IR's encoder classes once. `registerClass` is a global registry, and\n  //    decoding an unregistered class throws, so this must run before any decode.\n  registerOrchestrationEncodables()\n\n  // 3. Load every configured evaluator cell, so a missing optional peer surfaces at construction\n  //    rather than part-way through a freeze. A per-run cell is loaded at the same point with the\n  //    same named error.\n  const configuredEvaluators = deps?.evaluators ?? []\n  for (const cell of configuredEvaluators) {\n    await loadCell(cell)\n  }\n\n  // 4. Validate every registered template. A blocking issue throws, so a misconfigured\n  //    deployment fails at boot with a named error rather than at first instantiation.\n  const registeredTemplates: PlanTemplate[] = []\n  if (templates) {\n    for (const tpl of templates) {\n      const issues = validateTemplate(tpl, invocable)\n      const blocking = issues.find((i) => i.severity === 'blocking')\n      if (blocking) {\n        const where = blocking.nodeId ?? blocking.edgeId ?? tpl.id\n        throw new Error(\n          `createOrchestration: template ${JSON.stringify(tpl.id)} is invalid (${where}): ` +\n            `${blocking.code} — ${blocking.message}`\n        )\n      }\n      registeredTemplates.push(tpl)\n    }\n  }\n\n  // Snapshot the construction defaults for run/override resolution. `evaluators` is captured by\n  // reference; mergeEvaluators composes against it on every call.\n  const constructionDeps: Partial<RunDeps> = deps ?? {}\n  const freezeDefaults = {\n    invocable,\n    evaluators: configuredEvaluators,\n  }\n\n  /** A stable actor identity for ops minted by the forge on behalf of this orchestration. */\n  const actorId = `orchestration`\n\n  const orchestration: Orchestration = {\n    store,\n\n    async freezePlan(planId, inputs) {\n      const resolved = resolveFreezeInputs(freezeDefaults, inputs)\n      return freezePlan(store, planId, resolved)\n    },\n\n    async approvePlan(planId, record) {\n      return approvePlan(store, planId, record)\n    },\n\n    async executePlan(planId, options) {\n      const resolved = resolveRunOptions(constructionDeps, options)\n      return executePlan(store, planId, resolved)\n    },\n\n    async instantiate(templateId, args) {\n      const tpl = registeredTemplates.find((t) => t.id === templateId)\n      if (!tpl) {\n        return {\n          ok: false,\n          reason: 'unknown_template',\n          detail: `No template registered with id ${JSON.stringify(templateId)}.`,\n        }\n      }\n      return instantiateTemplate(store, tpl, args, actorId)\n    },\n\n    templates() {\n      return registeredTemplates.map((tpl) => ({\n        id: tpl.id,\n        summary: tpl.summary,\n        params: tpl.params,\n      }))\n    },\n\n    render: renderPlan,\n\n    raw: {\n      plan: rawPlan,\n      ops: rawOps,\n      diff: rawDiff,\n      outline: planOutline,\n    },\n\n    tools(tier) {\n      return forgeOrchestrationTools(\n        {\n          store,\n          invocable,\n          evaluators: configuredEvaluators,\n          templates: registeredTemplates,\n          actorId,\n        },\n        { tier }\n      )\n    },\n  }\n\n  return orchestration\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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