{"version":3,"file":"end.type.mjs","names":[],"sources":["../../../../../../../ai/src/contracts/end.type.ts"],"sourcesContent":["/**\n * Framework-global termination sentinel. Emitted by any primitive\n * whose control flow is routed through JSON-serializable strings —\n * supervisor (router agent's `next`, deterministic `route` callback),\n * future planner (plan steps), future orchestrator (session\n * directive), any future primitive that needs to say \"stop\" across a\n * wire that can't carry `null`.\n *\n * **Why one shared literal.** Consumers learn one word. Cross-\n * primitive pipes — a planner feeding a supervisor, a supervisor\n * nested as a tool inside an orchestrator — can pass the sentinel\n * through without translation.\n *\n * **Why this specific string.** Brand-prefixed (`__warlock:`) so it\n * can't collide with a realistic user-chosen intent / step / route\n * key (`\"end\"`, `\"done\"`, `\"stop\"` are all valid user keys).\n * Underscore-surrounded so it stands out in logs and snapshots.\n * JSON-safe so a router agent emits it verbatim.\n *\n * **Not used by every primitive.** Workflow's `nextStep` returns\n * `null` to end — a callback-level mechanism that predates this\n * sentinel. Workflows keep `null`; the sentinel is for primitives\n * whose \"end\" must survive a JSON boundary.\n *\n * @example\n * import { END } from \"@warlock.js/ai\";\n *\n * // Supervisor route callback\n * ai.supervisor({\n *   intents: { writer, critic },\n *   route: (ctx) => (ctx.iteration >= 5 ? END : \"writer\"),\n * });\n *\n * // Router agent output schema\n * const router = ai.agent({\n *   model,\n *   output: z.object({\n *     next: z.union([z.string(), z.array(z.string()), z.literal(END)]),\n *   }),\n * });\n */\nexport const END = \"__warlock:end__\" as const;\n\n/**\n * Value type of `END`. Exposed so consumers building Zod / Standard\n * Schema output schemas can write `z.literal(END)` without\n * hard-coding the string, and so generic helpers that accept \"the\n * end sentinel\" can type-narrow correctly.\n */\nexport type EndSentinel = typeof END;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,MAAM"}