@tangle-network/agent-runtime 0.161.0 → 0.162.0

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 (65) hide show
  1. package/dist/{activation-DaUNBcZw.js → activation-DxGP0h_p.js} +2 -2
  2. package/dist/{activation-DaUNBcZw.js.map → activation-DxGP0h_p.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-DDRliHit.js → authoring-kO7vE_c9.js} +2 -2
  6. package/dist/{authoring-DDRliHit.js.map → authoring-kO7vE_c9.js.map} +1 -1
  7. package/dist/{conversation-DLYKdh6W.js → conversation-7XGKoDM6.js} +3 -3
  8. package/dist/{conversation-DLYKdh6W.js.map → conversation-7XGKoDM6.js.map} +1 -1
  9. package/dist/conversation.d.ts +1 -1
  10. package/dist/conversation.js +1 -1
  11. package/dist/durable.d.ts +2 -2
  12. package/dist/durable.js +1 -1
  13. package/dist/{environment-provider-BobKk46F.d.ts → environment-provider-Bk8rg4gs.d.ts} +2 -2
  14. package/dist/environment-provider.d.ts +1 -1
  15. package/dist/{executable-spec-7ovS7PBo.js → executable-spec-CkGvdPds.js} +17 -5
  16. package/dist/executable-spec-CkGvdPds.js.map +1 -0
  17. package/dist/{graph-DWUz1caU.js → graph-COikUkrj.js} +2 -2
  18. package/dist/{graph-DWUz1caU.js.map → graph-COikUkrj.js.map} +1 -1
  19. package/dist/graph.d.ts +241 -0
  20. package/dist/graph.js +380 -0
  21. package/dist/graph.js.map +1 -0
  22. package/dist/{improvement-cycle-oUBE1Pzg.js → improvement-cycle-dGtgX1vr.js} +4 -4
  23. package/dist/{improvement-cycle-oUBE1Pzg.js.map → improvement-cycle-dGtgX1vr.js.map} +1 -1
  24. package/dist/{index-CT7Cmz66.d.ts → index-4mRXbu_V.d.ts} +4 -4
  25. package/dist/{index-5B7TlTSi.d.ts → index-8b0o4dMF.d.ts} +5 -5
  26. package/dist/{index-CLt9zpuD.d.ts → index-CTQ97IMO.d.ts} +2 -2
  27. package/dist/index.d.ts +7 -7
  28. package/dist/index.js +9 -9
  29. package/dist/intelligence.d.ts +4 -4
  30. package/dist/intelligence.js +3 -3
  31. package/dist/kernel.d.ts +5 -5
  32. package/dist/kernel.js +7 -7
  33. package/dist/{knowledge-BBfx7pSo.js → knowledge-CZT8ahp6.js} +3 -3
  34. package/dist/{knowledge-BBfx7pSo.js.map → knowledge-CZT8ahp6.js.map} +1 -1
  35. package/dist/knowledge.d.ts +1 -1
  36. package/dist/knowledge.js +1 -1
  37. package/dist/{loop-runner-bin-CjRjwtal.js → loop-runner-bin-CIjmKf7v.js} +3 -3
  38. package/dist/{loop-runner-bin-CjRjwtal.js.map → loop-runner-bin-CIjmKf7v.js.map} +1 -1
  39. package/dist/{loop-runner-bin-DRX6EDIy.d.ts → loop-runner-bin-DHU5kmJW.d.ts} +3 -3
  40. package/dist/loop-runner-bin.d.ts +1 -1
  41. package/dist/loop-runner-bin.js +1 -1
  42. package/dist/mcp/bin.js +3 -3
  43. package/dist/mcp/index.d.ts +3 -3
  44. package/dist/mcp/index.js +4 -4
  45. package/dist/{openai-tools-CLb9RqXL.js → openai-tools-DG779Z6S.js} +2 -2
  46. package/dist/{openai-tools-CLb9RqXL.js.map → openai-tools-DG779Z6S.js.map} +1 -1
  47. package/dist/primeintellect/index.d.ts +1 -1
  48. package/dist/{redact-0AK8JmHW.d.ts → redact-BUIB5IWj.d.ts} +3 -3
  49. package/dist/{runtime-BzY66cd6.d.ts → runtime-B0FIFwpH.d.ts} +3 -3
  50. package/dist/{runtime-CyVJSWzN.js → runtime-BT00zfIS.js} +8 -8
  51. package/dist/{runtime-CyVJSWzN.js.map → runtime-BT00zfIS.js.map} +1 -1
  52. package/dist/{stream-agent-turn-jaaFaSXM.d.ts → stream-agent-turn-BEhmmYmL.d.ts} +2 -2
  53. package/dist/{stream-agent-turn-FRZAuXAL.js → stream-agent-turn-CKIpCbSq.js} +2 -2
  54. package/dist/{stream-agent-turn-FRZAuXAL.js.map → stream-agent-turn-CKIpCbSq.js.map} +1 -1
  55. package/dist/{structural-rollout-JEhoJUjC.js → structural-rollout-DAenyNls.js} +4 -4
  56. package/dist/{structural-rollout-JEhoJUjC.js.map → structural-rollout-DAenyNls.js.map} +1 -1
  57. package/dist/{supervise-DE-GFNKg.js → supervise-Di6xvnOL.js} +2 -2
  58. package/dist/{supervise-DE-GFNKg.js.map → supervise-Di6xvnOL.js.map} +1 -1
  59. package/dist/{supervisor-ZlQy5Fwl.js → supervisor-DmWq4vkU.js} +15 -2
  60. package/dist/{supervisor-ZlQy5Fwl.js.map → supervisor-DmWq4vkU.js.map} +1 -1
  61. package/dist/testing.d.ts +2 -2
  62. package/dist/testing.js +11 -11
  63. package/dist/{types-BBXdSns1.d.ts → types-DXKDG6DQ.d.ts} +8 -5
  64. package/package.json +6 -1
  65. package/dist/executable-spec-7ovS7PBo.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","names":[],"sources":["../src/runtime/graph/kind.ts","../src/runtime/graph/registry.ts","../src/runtime/graph/engine.ts","../src/runtime/graph/kinds.ts"],"sourcesContent":["/**\n * `NodeKind` — what a consumer registers to add a node kind to the graph engine without forking\n * it (agent-runtime#969, #970).\n *\n * The engine owns the graph: scheduling over typed data edges, guards, joins, cycles, the\n * conserved pool, the journal. It does NOT own execution — `run` returns an `Agent`, the\n * kernel's spawn contract (`Scope.spawn` takes an `Agent { name, act }`; a leaf `Agent` carries its\n * `Executor` as `executorSpec: AgentSpec`, and a supervisor `Agent` is `supervisorAgent(...)`). So\n * every node rides `supervise()`'s machinery unchanged: the pool's reserve/reconcile, the\n * content-addressed journal, the completion gate, `Settled`, trace evidence. An engine that\n * re-implemented any of those would be a second kernel.\n *\n * Every kernel-owned extension contract is a TS interface plus a hand-written validator that\n * throws `ValidationError` by name (the kernel has no zod), and this one follows suit. JSON Schema\n * is the PORTABLE form of a config/port shape — a `Record<string, unknown>`, as `McpToolDescriptor`\n * and `DeliveryBinding` already spell it — so a kind's declaration can be published in a manifest\n * and lifted by a host on another stack.\n *\n * The bar this file is measured against: the scheduler's source names no kind that is not\n * universal. A kind the engine ships (`agent`, `supervisor`, `subgraph`, `script`) is universal by\n * the rule \"the model cannot decide it with the verbs it has\"; everything else — integrations,\n * notifications, sandbox provisioning, human decisions — is registered by a host.\n */\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { ValidationError } from '../../errors'\nimport type { WorkerSpawnContext } from '../../mcp/tools/coordination'\nimport type { Agent } from '../supervise/types'\nimport type { Registered, RegistryHandle } from './registry'\n\n/** A JSON Schema document as the kernel already spells it: an opaque record, validated by the\n * consumer's own validator, published verbatim. */\nexport type JsonSchema = Readonly<Record<string, unknown>>\n\n/**\n * One declared port on a node. Ports are how a `data` edge binds one node's output to another's\n * input with a type the compiler can check structurally before any spend. A node has two implicit\n * output ports beside its declared ones: `out` (its result) and `trace` (its `WorkerTraceEvidence`\n * by `traceRef`); only an `analyzes` edge may bind `trace`.\n */\nexport interface PortSpec {\n readonly name: string\n readonly schema: JsonSchema\n readonly description?: string\n}\n\n/**\n * What a kind declares it needs from the host. The engine never imports a host capability; it\n * knows only that a kind SAID it needs something under this name and the host PROVIDED something\n * under it. The context a kind receives is narrowed to exactly its declaration — an undeclared\n * effect is `undefined`, never a service locator.\n */\nexport type EffectName = string\n\nexport type EffectContext<Effects extends ReadonlyArray<EffectName>> = Readonly<{\n [K in Effects[number]]: unknown\n}>\n\n/**\n * What happens to a node that was IN FLIGHT when the process died. A settled node is never a\n * per-kind choice — it restores from its content-addressed `outRef` on replay. `'restart'` re-runs\n * from the journaled `inputRef`; `'resume'` is legal only for a kind whose executor can re-attach\n * to the live process (the bridge backend's session re-attachment is the existing instance).\n */\nexport type OnCrash = 'restart' | 'resume'\n\n/**\n * Whether a kind's spend enters the conserved pool. `'metered'`: the executor reports `Spend` and\n * settling without one is an ENGINE ERROR — never \"free\". `'exempt'`: the whole reservation is\n * refunded on settle, keeping the node out of Σk by construction (the kernel's `budgetExempt`).\n */\nexport type BudgetMode = 'metered' | 'exempt'\n\n/** The validated declaration every kind provides. `Config` is the per-node config shape;\n * `Effects` is the tuple of host capabilities it declares, so the context `run` receives is typed\n * to exactly that tuple. */\nexport interface NodeKind<\n Config = unknown,\n Effects extends ReadonlyArray<EffectName> = ReadonlyArray<EffectName>,\n> extends Registered {\n /** Kind id, e.g. `agent`, `integration.invoke`. With `version`, forms the handle `<id>/v<n>`. */\n readonly id: string\n readonly version: number\n readonly description: string\n /** Validate and narrow one node's config. Throw `ValidationError` to refuse; the compiler\n * surfaces the message with the node id prefixed. */\n readonly validateConfig: (raw: unknown, context: string) => Config\n /** The portable form of `validateConfig`'s accepted shape, for manifests and hosts. */\n readonly configSchema: JsonSchema\n /** Declared input ports; a `data` edge may bind only these. Empty for a source node. */\n readonly inputs: ReadonlyArray<PortSpec>\n /** Declared output ports beside the implicit `out` and `trace`. */\n readonly outputs: ReadonlyArray<PortSpec>\n /** Host capabilities this kind reaches for, by name. The context is narrowed to exactly these. */\n readonly effects: Effects\n readonly onCrash: OnCrash\n readonly budget: BudgetMode\n /**\n * Build the agent for one node instance. The kernel spawns it under `Scope.spawn`, so it is\n * authorized, classified, journaled, pooled and gated like any child — the kind owns only what\n * the agent DOES. `profile` is the node's pinned profile (an `agent`/`supervisor` kind runs it;\n * a `script` kind may ignore it); `inputs` are the resolved, content-addressed port values;\n * `effects` is the narrowed host context; `spawn` is the kernel's per-spawn context when the\n * kind needs it (a supervisor kind threads it into `nodeContext`).\n */\n readonly run: (args: {\n readonly config: Config\n readonly profile: AgentProfile\n readonly inputs: Readonly<Record<string, unknown>>\n readonly effects: EffectContext<Effects>\n readonly spawn?: WorkerSpawnContext\n }) => Agent<unknown, unknown>\n}\n\n/** Per-node flags a graph author sets; they are node properties, not kinds (agent-runtime#970). */\nexport interface NodeFlags {\n /** An oracle — a judge, grader, auditor, trace analyst — may be bound only by an `analyzes`\n * edge. The compiler refuses a `delegates` or `data` edge INTO an oracle: an edge to a grader\n * leaks the rubric. */\n readonly oracle?: boolean\n /** `script` only: pure over `(config, inputs)` ⇒ budget exempt, output restorable on replay,\n * runs in-process. A pure script that settles with a different `outRef` for the same inputs\n * has lied, and the first replay mismatch is an engine error. */\n readonly pure?: boolean\n}\n\n/** Validate a kind declaration at registration — so a malformed kind is refused by name once,\n * not at the first node that uses it. */\nexport function validateNodeKind(kind: NodeKind, context = 'registerNodeKind'): NodeKind {\n const who = `${context}: kind ${JSON.stringify(`${kind.id}/v${kind.version}`)}`\n if (typeof kind.id !== 'string' || kind.id.length === 0) {\n throw new ValidationError(`${context}: a kind must carry a non-empty id`)\n }\n if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(kind.id)) {\n throw new ValidationError(`${who}: id may contain only letters, digits, \".\", \"_\" and \"-\"`)\n }\n if (!Number.isSafeInteger(kind.version) || kind.version < 1) {\n throw new ValidationError(`${who}: version must be a positive integer`)\n }\n if (typeof kind.description !== 'string' || kind.description.trim().length === 0) {\n throw new ValidationError(`${who}: description is required`)\n }\n if (typeof kind.validateConfig !== 'function') {\n throw new ValidationError(`${who}: validateConfig must be a function`)\n }\n if (!isRecord(kind.configSchema)) {\n throw new ValidationError(`${who}: configSchema must be a JSON Schema object`)\n }\n for (const [field, ports] of [\n ['inputs', kind.inputs],\n ['outputs', kind.outputs],\n ] as const) {\n if (!Array.isArray(ports)) throw new ValidationError(`${who}: ${field} must be an array`)\n const seen = new Set<string>()\n for (const port of ports) {\n if (!port || typeof port.name !== 'string' || port.name.length === 0) {\n throw new ValidationError(`${who}: every ${field} port needs a non-empty name`)\n }\n if (field === 'outputs' && (port.name === 'out' || port.name === 'trace')) {\n throw new ValidationError(\n `${who}: output port ${JSON.stringify(port.name)} is implicit on every node and cannot be declared`,\n )\n }\n if (seen.has(port.name)) {\n throw new ValidationError(`${who}: duplicate ${field} port ${JSON.stringify(port.name)}`)\n }\n seen.add(port.name)\n if (!isRecord(port.schema)) {\n throw new ValidationError(\n `${who}: ${field} port ${JSON.stringify(port.name)} needs a JSON Schema`,\n )\n }\n }\n }\n if (\n !Array.isArray(kind.effects) ||\n kind.effects.some((e) => typeof e !== 'string' || e.length === 0)\n ) {\n throw new ValidationError(`${who}: effects must be an array of non-empty names`)\n }\n if (new Set(kind.effects).size !== kind.effects.length) {\n throw new ValidationError(`${who}: effects must not repeat a name`)\n }\n if (kind.onCrash !== 'restart' && kind.onCrash !== 'resume') {\n throw new ValidationError(`${who}: onCrash must be \"restart\" or \"resume\"`)\n }\n if (kind.budget !== 'metered' && kind.budget !== 'exempt') {\n throw new ValidationError(`${who}: budget must be \"metered\" or \"exempt\"`)\n }\n if (typeof kind.run !== 'function') {\n throw new ValidationError(`${who}: run must be a function`)\n }\n return kind\n}\n\n/** The handle a graph writes to name this kind. */\nexport function kindHandle(kind: Pick<NodeKind, 'id' | 'version'>): RegistryHandle {\n return { id: kind.id, version: kind.version }\n}\n\n/**\n * Narrow a host's effect table to exactly what one kind declared. Anything the kind did not\n * declare is absent — `undefined` on read — so a kind cannot reach past its declaration, and the\n * engine can list a graph's required effects before spending a token.\n */\nexport function narrowEffects<Effects extends ReadonlyArray<EffectName>>(\n declared: Effects,\n provided: Readonly<Record<string, unknown>>,\n context: string,\n): EffectContext<Effects> {\n const out: Record<string, unknown> = {}\n const missing: string[] = []\n for (const name of declared) {\n if (!(name in provided)) {\n missing.push(name)\n continue\n }\n out[name] = provided[name]\n }\n if (missing.length > 0) {\n throw new ValidationError(\n `${context}: host provides no effect for ${missing.map((m) => JSON.stringify(m)).join(', ')}; provided: ${\n Object.keys(provided).sort().join(', ') || 'none'\n }`,\n )\n }\n return Object.freeze(out) as EffectContext<Effects>\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n","/**\n * `Registry<T>` — the ONE name→thing shape for the graph engine.\n *\n * The kernel grew fourteen of these (agent-runtime#978) that differ in three properties:\n * whether names can be listed, what a miss does, and whether the table is global. This one\n * fixes all three — enumerable, a miss is refused BY NAME listing what is registered, and every\n * registry is per-instance — and it is lifted from `AgentEnvironmentProviderRegistry`, the\n * richest and best-tested of the fourteen, not invented.\n *\n * Entries are addressed by a versioned handle, `<id>/v<n>`, the same way the prompt registry\n * addresses directives. A graph names a kind by handle; a host registers exact versions; a\n * missing version is refused, never served by a newer one.\n */\n\nimport { ValidationError } from '../../errors'\n\n/** A versioned name: what a graph writes and what a host registers. */\nexport interface RegistryHandle {\n readonly id: string\n readonly version: number\n}\n\n/** `<id>/v<n>` — the only spelling a handle has on the wire, in a journal, or in an error. */\nexport function formatRegistryHandle(handle: RegistryHandle): string {\n return `${handle.id}/v${handle.version}`\n}\n\n/** Parse the wire spelling back. Refuses anything that is not exactly `<id>/v<n>`. */\nexport function parseRegistryHandle(text: string, context: string): RegistryHandle {\n const match = /^([A-Za-z0-9][A-Za-z0-9._-]*)\\/v(\\d+)$/u.exec(text)\n if (!match) {\n throw new ValidationError(\n `${context}: ${JSON.stringify(text)} is not a registry handle; expected \"<id>/v<n>\"`,\n )\n }\n const version = Number(match[2])\n if (!Number.isSafeInteger(version) || version < 1) {\n throw new ValidationError(`${context}: handle version must be a positive integer`)\n }\n return { id: match[1] as string, version }\n}\n\n/** Anything a registry holds carries its own handle, so the table cannot drift from the entry. */\nexport interface Registered extends RegistryHandle {}\n\nexport interface Registry<T extends Registered> {\n /** Add one entry. A second entry under the same handle is refused unless `replace` is set —\n * silently shadowing a registered kind is how a key no caller could produce once survived. */\n register(entry: T, options?: { readonly replace?: boolean }): void\n has(handle: RegistryHandle): boolean\n get(handle: RegistryHandle): T | undefined\n /** The entry, or a refusal that names the handle AND lists every registered handle — a miss\n * must be diagnosable from its message alone. */\n require(handle: RegistryHandle, context?: string): T\n /** Every registered handle, sorted, as wire spellings. The thing the fourteen predecessors\n * mostly could not do and four callers needed. */\n names(): string[]\n /** Every entry, in `names()` order. */\n entries(): T[]\n}\n\n/**\n * Create a registry. Per-instance by construction: two engines in one process may hold\n * different kind sets, a test is hermetic, and a run can print its own table. There is\n * deliberately no module-level singleton — `builtinShapes` was the one mutable global in the\n * kernel and it had zero tests.\n */\nexport function createRegistry<T extends Registered>(\n label: string,\n seed: Iterable<T> = [],\n): Registry<T> {\n const table = new Map<string, T>()\n const registry: Registry<T> = {\n register(entry, options = {}): void {\n if (typeof entry.id !== 'string' || entry.id.length === 0) {\n throw new ValidationError(`${label}: an entry must carry a non-empty id`)\n }\n if (!Number.isSafeInteger(entry.version) || entry.version < 1) {\n throw new ValidationError(\n `${label}: ${JSON.stringify(entry.id)} must carry a positive integer version`,\n )\n }\n const key = formatRegistryHandle(entry)\n if (!options.replace && table.has(key)) {\n throw new ValidationError(`${label}: ${JSON.stringify(key)} is already registered`)\n }\n table.set(key, entry)\n },\n has(handle): boolean {\n return table.has(formatRegistryHandle(handle))\n },\n get(handle): T | undefined {\n return table.get(formatRegistryHandle(handle))\n },\n require(handle, context = label): T {\n const key = formatRegistryHandle(handle)\n const entry = table.get(key)\n if (entry === undefined) {\n const known = registry.names()\n const suffix =\n known.length > 0 ? `; registered: ${known.join(', ')}` : '; nothing is registered'\n throw new ValidationError(`${context}: ${JSON.stringify(key)} is not registered${suffix}`)\n }\n return entry\n },\n names(): string[] {\n return Array.from(table.keys()).sort()\n },\n entries(): T[] {\n return registry.names().map((key) => table.get(key) as T)\n },\n }\n for (const entry of seed) registry.register(entry)\n return registry\n}\n","/**\n * `createGraphEngine` — one engine instance: its kind registry (core kinds pre-registered, host\n * kinds added by the caller), its effect table, and nothing global.\n *\n * The scheduler (#980), journal fold (#981) and the `runGraph` preset (#982) attach here; this\n * file is the part that must exist first so a host can register kinds and a compiler can ask\n * \"which effects does this graph need\" before a token is spent.\n */\n\nimport { ValidationError } from '../../errors'\nimport type { EffectName, NodeKind } from './kind'\nimport { validateNodeKind } from './kind'\nimport { createRegistry, type Registry } from './registry'\n\nexport interface GraphEngineOptions {\n /** Kinds to register beside the core set. A host adds its own here; nothing is global. */\n readonly kinds?: ReadonlyArray<NodeKind>\n /** The host's effect table, by name. A kind receives only the effects it declared. */\n readonly effects?: Readonly<Record<EffectName, unknown>>\n /** The core set. Injected so a test can substitute, and so the engine never imports a\n * backend-specific factory at module load. */\n readonly coreKinds: ReadonlyArray<NodeKind>\n}\n\nexport interface GraphEngine {\n readonly kinds: Registry<NodeKind>\n readonly effects: Readonly<Record<EffectName, unknown>>\n /** Every effect name any registered kind declares — what a host must provide for this engine's\n * whole kind set to be runnable. Listed, never discovered mid-run. */\n requiredEffects(): string[]\n /** The declared effects no host value covers. Empty means every registered kind is runnable. */\n missingEffects(): string[]\n}\n\n/**\n * Build one engine: a kind registry seeded with the core kinds plus the host's, and the host's\n * effect values. Every kind is validated by name at construction, so a malformed host kind fails\n * here, never at its first node.\n */\nexport function createGraphEngine(options: GraphEngineOptions): GraphEngine {\n const kinds = createRegistry<NodeKind>('graph kinds')\n for (const kind of options.coreKinds) kinds.register(validateNodeKind(kind, 'createGraphEngine'))\n for (const kind of options.kinds ?? [])\n kinds.register(validateNodeKind(kind, 'createGraphEngine'))\n const effects = Object.freeze({ ...(options.effects ?? {}) })\n if (Object.keys(effects).some((name) => name.length === 0)) {\n throw new ValidationError('createGraphEngine: an effect name must be non-empty')\n }\n const engine: GraphEngine = {\n kinds,\n effects,\n requiredEffects(): string[] {\n const names = new Set<string>()\n for (const kind of kinds.entries()) for (const name of kind.effects) names.add(name)\n return Array.from(names).sort()\n },\n missingEffects(): string[] {\n return engine.requiredEffects().filter((name) => !(name in effects))\n },\n }\n return engine\n}\n","/**\n * The four core node kinds (agent-runtime#970) — the ones universal by the rule \"the model cannot\n * decide it with the verbs it has\". Everything else (integrations, notifications, sandbox\n * provisioning, human decisions) is registered by a host against the same `NodeKind` contract.\n *\n * Each `run` returns an `Agent` the kernel spawns under `Scope.spawn`; none of these re-implements\n * pooling, journaling, gating or identity. `agent` and `supervisor` are thin wraps over the\n * kernel's own factories; `script` is the one kind with no kernel primitive behind it; `subgraph`\n * is the scheduler's and is refused here until the scheduler lands (#980).\n */\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { contentAddress } from '../../durable/content-address'\nimport { ValidationError } from '../../errors'\nimport type { MakeWorkerAgent } from '../../mcp/tools/coordination'\nimport type { DeliverableSpec } from '../supervise/completion-gate'\nimport type { ExecutorConfig } from '../supervise/runtime'\nimport { workerFromBackend } from '../supervise/supervise'\nimport { type SupervisorAgentDeps, supervisorAgent } from '../supervise/supervisor-agent'\nimport type { Agent, AgentSpec, Executor, ExecutorResult, Spend } from '../supervise/types'\nimport type { NodeKind } from './kind'\nimport { formatRegistryHandle, type RegistryHandle } from './registry'\n\n// ── agent ───────────────────────────────────────────────────────────────────────\n\nexport interface AgentKindConfig {\n /** Where this node's profile runs. Omit to inherit the engine's default backend. */\n readonly backend?: ExecutorConfig\n /** This node's completion check. Omit to inherit the graph's terminal check. */\n readonly deliverable?: DeliverableSpec<unknown>\n}\n\n/**\n * One profile, one run: the kernel's leaf, exactly as `supervise()` derives it from `backend`.\n * The model cannot decide this — it is what gets run.\n */\nexport function agentKind(defaults: {\n readonly backend?: ExecutorConfig\n readonly deliverable?: DeliverableSpec<unknown>\n}): NodeKind<AgentKindConfig> {\n return {\n id: 'agent',\n version: 1,\n description: 'One AgentProfile run as a leaf on a backend; the kernel derives the executor.',\n validateConfig: (raw, context) => {\n const config = asRecord(raw, `${context}: agent config`)\n return {\n ...(config.backend !== undefined ? { backend: config.backend as ExecutorConfig } : {}),\n ...(config.deliverable !== undefined\n ? { deliverable: config.deliverable as DeliverableSpec<unknown> }\n : {}),\n }\n },\n configSchema: {\n type: 'object',\n properties: { backend: { type: 'object' }, deliverable: { type: 'object' } },\n additionalProperties: false,\n },\n inputs: [],\n outputs: [],\n effects: [],\n onCrash: 'restart',\n budget: 'metered',\n run: ({ config, profile, spawn }) => {\n const backend = config.backend ?? defaults.backend\n if (!backend) {\n throw new ValidationError(\n `agent kind: node ${JSON.stringify(profile.name)} has no backend — set config.backend or the engine default`,\n )\n }\n const make: MakeWorkerAgent = workerFromBackend(\n backend,\n config.deliverable ?? defaults.deliverable,\n )\n return make(profile, spawn)\n },\n }\n}\n\n// ── supervisor ──────────────────────────────────────────────────────────────────\n\nexport interface SupervisorKindConfig {\n /** Per-child budget reserved from the pool on each spawn this supervisor makes. */\n readonly perWorker: SupervisorAgentDeps['perWorker']\n readonly maxLiveWorkers?: number\n}\n\n/**\n * The thing that DECIDES: a nested `supervisorAgent` with the coordination verbs. Its children\n * are its own tree — the graph sees one node in, one `Settled` out. A `subgraph` constrains what\n * it may spawn; without one it is free-form under `profileSecurity` and `allowedModels`.\n */\nexport function supervisorKind(deps: {\n readonly blobs: SupervisorAgentDeps['blobs']\n readonly makeWorkerAgent: MakeWorkerAgent\n readonly router?: SupervisorAgentDeps['router']\n readonly driveHarness?: SupervisorAgentDeps['driveHarness']\n}): NodeKind<SupervisorKindConfig> {\n return {\n id: 'supervisor',\n version: 1,\n description:\n 'A nested supervisor: spawns, observes, steers and awaits its own children with the coordination verbs.',\n validateConfig: (raw, context) => {\n const config = asRecord(raw, `${context}: supervisor config`)\n const perWorker = asRecord(config.perWorker, `${context}: supervisor config.perWorker`)\n return {\n perWorker: perWorker as unknown as SupervisorKindConfig['perWorker'],\n ...(config.maxLiveWorkers !== undefined\n ? { maxLiveWorkers: Number(config.maxLiveWorkers) }\n : {}),\n }\n },\n configSchema: {\n type: 'object',\n properties: { perWorker: { type: 'object' }, maxLiveWorkers: { type: 'integer' } },\n required: ['perWorker'],\n additionalProperties: false,\n },\n inputs: [],\n outputs: [],\n effects: [],\n onCrash: 'restart',\n budget: 'metered',\n run: ({ config, profile }) =>\n supervisorAgent(profile, {\n blobs: deps.blobs,\n makeWorkerAgent: deps.makeWorkerAgent,\n perWorker: config.perWorker,\n ...(config.maxLiveWorkers !== undefined ? { maxLiveWorkers: config.maxLiveWorkers } : {}),\n ...(deps.router ? { router: deps.router } : {}),\n ...(deps.driveHarness ? { driveHarness: deps.driveHarness } : {}),\n }),\n }\n}\n\n// ── script ──────────────────────────────────────────────────────────────────────\n\n/** The caller code a `script` node runs. Receives the resolved inputs; returns the output. */\nexport type ScriptBody = (\n inputs: Readonly<Record<string, unknown>>,\n signal: AbortSignal,\n) => Promise<unknown> | unknown\n\nexport interface ScriptKindConfig {\n readonly body: ScriptBody\n /**\n * `pure: true` is the promise that the output is a function of `(config, inputs)` alone: the\n * node is then budget-exempt, its output restorable on replay by content address, and it runs\n * in-process. A pure script that settles with a different `outRef` for the same inputs has\n * lied, and the first replay mismatch is an engine error.\n */\n readonly pure?: boolean\n /** For a metered script: what it spent. Omit on a pure script. A metered script that reports\n * nothing is metered as NOTHING-KNOWN, never as free. */\n readonly spent?: Spend\n}\n\n/** The script kind's handle; it also names the kind in every script node's identity. */\nconst SCRIPT: RegistryHandle = { id: 'script', version: 1 }\n\n/**\n * Caller code as a node. The one kind with no kernel primitive behind it: the kernel has no\n * \"data→data with no execution\" concept (agent-runtime#970 fact-finding), so this is new. It is\n * still a leaf `Agent` carrying an `Executor`, so the journal, the gate and the pool treat it like\n * any other node.\n */\nexport function scriptKind(): NodeKind<ScriptKindConfig> {\n return {\n ...SCRIPT,\n description:\n 'Run caller code over the resolved inputs; pure scripts are exempt and restorable.',\n validateConfig: (raw, context) => {\n const config = asRecord(raw, `${context}: script config`)\n if (typeof config.body !== 'function') {\n throw new ValidationError(`${context}: script config.body must be a function`)\n }\n if (config.pure !== undefined && typeof config.pure !== 'boolean') {\n throw new ValidationError(`${context}: script config.pure must be a boolean`)\n }\n if (config.pure === true && config.spent !== undefined) {\n throw new ValidationError(\n `${context}: a pure script is budget-exempt and cannot report spent`,\n )\n }\n return {\n body: config.body as ScriptBody,\n ...(config.pure !== undefined ? { pure: config.pure } : {}),\n ...(config.spent !== undefined ? { spent: config.spent as Spend } : {}),\n }\n },\n configSchema: {\n type: 'object',\n properties: { pure: { type: 'boolean' }, spent: { type: 'object' } },\n // `body` is a function and has no JSON form; a host that lifts `script` supplies its own\n // executable reference (ADC: a module in a sandbox) under this same kind id.\n additionalProperties: true,\n },\n inputs: [],\n outputs: [],\n effects: [],\n onCrash: 'restart',\n budget: 'metered',\n run: ({ config, profile, inputs }) => scriptAgent(profile, config, inputs, SCRIPT),\n }\n}\n\nfunction scriptAgent(\n profile: AgentProfile,\n config: ScriptKindConfig,\n inputs: Readonly<Record<string, unknown>>,\n kind: RegistryHandle,\n): Agent<unknown, unknown> & { executorSpec: AgentSpec } {\n let artifact: ExecutorResult<unknown> | undefined\n const executor: Executor<unknown> = {\n runtime: 'inline',\n // A pure script spends nothing from the pool by construction; the kernel refunds its whole\n // reservation. A metered script with no `spent` is NOT free: it is recorded as unknown.\n ...(config.pure ? { budgetExempt: true } : {}),\n async execute(_task, signal): Promise<ExecutorResult<unknown>> {\n const startedAt = Date.now()\n const out = await config.body(inputs, signal)\n const ms = Date.now() - startedAt\n // Exempt means zero spend on every pool channel, iterations included; only the wall clock is\n // reported, and it is not a pool channel.\n const spent: Spend = config.pure\n ? { iterations: 0, tokens: { input: 0, output: 0 }, usd: 0, ms }\n : (config.spent ?? {\n iterations: 1,\n tokens: { input: 0, output: 0, tokensKnown: false },\n tokensKnown: false,\n usd: 0,\n usdKnown: false,\n ms,\n })\n artifact = { outRef: contentAddress(out), out, spent }\n return artifact\n },\n teardown: () => Promise.resolve({ destroyed: true }),\n resultArtifact(): ExecutorResult<unknown> {\n if (!artifact) throw new ValidationError('script: resultArtifact() read before execute()')\n return artifact\n },\n }\n // The profile names the node; the kind is the behavioral authority, so it joins the node's\n // identity here. A script claims no harness or model: nothing runs one.\n const spec: AgentSpec = {\n profile,\n harness: null,\n executor,\n execution: { correlation: { nodeKind: formatRegistryHandle(kind) } },\n }\n return {\n name: profile.name ?? 'script',\n // `act` is never the path: Scope reads `executorSpec` and runs the executor itself.\n act: () => Promise.reject(new ValidationError('script: act() is not the execution path')),\n executorSpec: spec,\n }\n}\n\n// ── subgraph ────────────────────────────────────────────────────────────────────\n\n/**\n * A node carrying its own graph: the constraint on what a supervisor may spawn at depth>1. Its\n * executor is a nested engine run; that needs the scheduler (#980), so until then this kind is\n * registered and REFUSES at run time by name rather than being absent — a graph that names it\n * compiles, and the refusal says exactly what is missing.\n */\nexport function subgraphKind(): NodeKind<{ readonly graph: unknown }> {\n return {\n id: 'subgraph',\n version: 1,\n description: 'A node that runs its own graph; constrains a supervisor at depth>1.',\n validateConfig: (raw, context) => {\n const config = asRecord(raw, `${context}: subgraph config`)\n if (config.graph === undefined) {\n throw new ValidationError(`${context}: subgraph config.graph is required`)\n }\n return { graph: config.graph }\n },\n configSchema: {\n type: 'object',\n properties: { graph: { type: 'object' } },\n required: ['graph'],\n },\n inputs: [],\n outputs: [],\n effects: [],\n onCrash: 'restart',\n budget: 'metered',\n run: ({ profile }) => {\n throw new ValidationError(\n `subgraph kind: node ${JSON.stringify(profile.name)} cannot run yet — the scheduler that executes a nested graph lands in agent-runtime#980`,\n )\n },\n }\n}\n\nfunction asRecord(value: unknown, context: string): Record<string, unknown> {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new ValidationError(`${context} must be an object`)\n }\n return value as Record<string, unknown>\n}\n"],"mappings":";;;;;;AAgIA,SAAgB,iBAAiB,MAAgB,UAAU,oBAA8B;CACvF,MAAM,MAAM,GAAG,QAAQ,SAAS,KAAK,UAAU,GAAG,KAAK,GAAG,IAAI,KAAK,SAAS;CAC5E,IAAI,OAAO,KAAK,OAAO,YAAY,KAAK,GAAG,WAAW,GACpD,MAAM,IAAI,gBAAgB,GAAG,QAAQ,mCAAmC;CAE1E,IAAI,CAAC,gCAAgC,KAAK,KAAK,EAAE,GAC/C,MAAM,IAAI,gBAAgB,GAAG,IAAI,wDAAwD;CAE3F,IAAI,CAAC,OAAO,cAAc,KAAK,OAAO,KAAK,KAAK,UAAU,GACxD,MAAM,IAAI,gBAAgB,GAAG,IAAI,qCAAqC;CAExE,IAAI,OAAO,KAAK,gBAAgB,YAAY,KAAK,YAAY,KAAK,CAAC,CAAC,WAAW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,EAAE,OAAO,EAAE,MAAM,SAAS,EAAE;GACxC,UAAU,CAAC,OAAO;EACpB;EACA,QAAQ,CAAC;EACT,SAAS,CAAC;EACV,SAAS,CAAC;EACV,SAAS;EACT,QAAQ;EACR,MAAM,EAAE,cAAc;GACpB,MAAM,IAAI,gBACR,uBAAuB,KAAK,UAAU,QAAQ,IAAI,EAAE,wFACtD;EACF;CACF;AACF;AAEA,SAAS,SAAS,OAAgB,SAA0C;CAC1E,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GACpE,MAAM,IAAI,gBAAgB,GAAG,QAAQ,mBAAmB;CAE1D,OAAO;AACT"}
@@ -1,10 +1,10 @@
1
1
  import { i as ConfigError } from "./errors-CDZ8XsVj.js";
2
- import { n as streamAgentTurn, t as collectAgentTurn } from "./stream-agent-turn-FRZAuXAL.js";
2
+ import { n as streamAgentTurn, t as collectAgentTurn } from "./stream-agent-turn-CKIpCbSq.js";
3
3
  import { n as detachedSnapshot } from "./snapshot-CTAf4uuA.js";
4
4
  import { $ as parseAgentCandidateProfileActivation, J as assertCandidateProfileBinding, K as agentCandidateProfileAsAgentProfile, Q as omitUndefinedObjectFields, Y as createAgentCandidateProfileActivation, Z as materializeAgentCandidateProfilePlan, at as canonicalCandidateDocument, ct as immutableCandidateValue, d as verifiedResourceTextByDigest, dt as verifyCanonicalCandidateDocument, et as parseExactAgentProfile, f as verifyAgentCandidateBundle, it as canonicalCandidateDigest$1, lt as omitTopLevelDigest, n as executePreparedAgentCandidate, q as applyExactAgentProfileDiff, rt as canonicalCandidateBytes, t as prepareAgentCandidateExecution } from "./prepare-VLGnSyav.js";
5
5
  import { a as concreteProfileModel, t as assertExecutableAgentProfile } from "./model-policy-Sw4ywhtL.js";
6
- import { qt as runSettledCommand, z as createExecutor } from "./supervisor-ZlQy5Fwl.js";
7
- import { D as optimizerMethod, a as defaultStructuralRolloutPolicy } from "./structural-rollout-JEhoJUjC.js";
6
+ import { qt as runSettledCommand, z as createExecutor } from "./supervisor-DmWq4vkU.js";
7
+ import { D as optimizerMethod, a as defaultStructuralRolloutPolicy } from "./structural-rollout-DAenyNls.js";
8
8
  import { t as runAnalystLoop } from "./analyst-loop-Bouu53-l.js";
9
9
  import { AGENT_IMPROVEMENT_SOURCE_METADATA_KEY, agentCandidateMaterializationReceiptSchema, agentCandidateRunReceiptSchema, agentImprovementActivationSchema, agentImprovementProposalSchema, agentImprovementReviewSchema, agentImprovementSourceMetadata, agentImprovementSourceSchema, agentProfileDiffSchema, agentProfileImprovementArmSchema, agentProfileImprovementExecutionRefSchema, agentProfileModelHintsSchema, agentProfileSchema, applyAgentProfileDiff, candidateExecutionEvidenceSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, changedProfileImprovementSurfaces, defineAgentProfileDiff, diffAgentProfiles, numbersApproximatelyEqual, sha256DigestSchema } from "@tangle-network/agent-interface";
10
10
  import { CostLedger, canonicalJson, makeProposalFinding } from "@tangle-network/agent-eval";
@@ -3037,4 +3037,4 @@ function sameOrderedValues(left, right) {
3037
3037
  //#endregion
3038
3038
  export { agentImprovementTargetInput as A, ROLLOUT_POLICY_EXTENSION as B, optimizationActivationReceiptFromMetadata as C, agentImprovementProfileSurfaceDigest as D, agentImprovementProfileDiffs as E, isAgentImprovementProfileSurface as F, structuralRolloutPolicyFromProfile as G, normalizeRolloutPolicy as H, isAgentProfileMeasuredSurface as I, defaultBuildPrompt as J, agenticGenerator as K, improve as L, agentProfileImprovementStateDigest as M, assertProfileImprovementTargetsShareIdentity as N, agentImprovementProfileSurfaceInput as O, buildAgentImprovementActivationTargets as P, withMethodRuntimeControls as R, createOptimizationActivationReceipt as S, AGENT_PROFILE_MEASURED_SURFACES as T, parseRolloutPolicy as U, applyRolloutPolicyToProfile as V, serializeRolloutPolicy as W, profilePolicyWithBudget as _, executeAgentCandidateExperimentCell as a, profileTaskScenarioIdentity as b, requireSealedCandidateExperiment as c, verifyAgentImprovementActivation as d, verifyAgentImprovementProposal as f, profileImprovementMetadata as g, createProfileImprovementCostLedger as h, createAgentImprovementProposal as i, agentImprovementTargetProfileDiffs as j, agentImprovementTargetDigest as k, reviewAgentImprovementProposal as l, verifyCandidateExecutionEvidence as m, createAgentImprovementActivation as n, proposeAgentImprovement as o, verifyAgentImprovementReview as p, commandVerifier as q, createAgentImprovementMeasuredComparison as r, proposeAgentProfileImprovement as s, AgentCandidateExperimentCellExecutionError as t, runAgentCandidateExperiment as u, profilePreparationAccounting as v, AGENT_IMPROVEMENT_PROFILE_SURFACES as w, sealProfileImprovementBenchmark as x, profileStateDigest as y, rawTraceDistiller as z };
3039
3039
 
3040
- //# sourceMappingURL=improvement-cycle-oUBE1Pzg.js.map
3040
+ //# sourceMappingURL=improvement-cycle-dGtgX1vr.js.map