{"version":3,"file":"index.mjs","names":["fixture.notification"],"sources":["../src/core/transport/serve.ts","../src/core/transport/main.ts","../../contract/fixtures/event.json","../src/kinds/event.ts"],"sourcesContent":["/**\n * Serving a plugin until its signal aborts: its own way when it has one (a\n * collector's schedule and watch), else the agent's gRPC protocol. Never both.\n * What a project's entry point awaits when the agent runs the worker as a\n * server.\n *\n * The gRPC server (`grpc-server.ts`, and with it grpc-js, proto-loader and\n * protobufjs) is imported when a serve starts it, never before: a worker that\n * answers the document it was exec'd with loads no gRPC.\n *\n * A serve of the agent's protocol lasts until its signal aborts: every answer\n * in flight is aborted, the address is let go, every call that arrives is\n * refused UNAVAILABLE, and the server shuts down once the answers in flight\n * are delivered; the listener each serve added to its signal is removed then.\n * A second serve in the same process (`bun --hot` evaluates the entry point\n * again) finds the serve on `globalThis`, swaps what it serves in place, and\n * returns the same promise: the agent's connection never notices the reload.\n * A serve already stopping is never joined: a serve then waits for it to end,\n * and serves anew. Each serve stops the tracer it built once the serve it\n * started or joined has ended, every answer delivered.\n *\n * A plugin's own serve (a collector's schedule and watch) is hot-reload safe\n * too, by another rule: what it runs is its own, so it is never swapped. A\n * second serve in the same process stops the running one (its signal\n * aborted), waits for it to end, however it ends, then serves; one own serve\n * runs at a time, however many reloads come while one is stopping.\n */\n\nimport { credentialsOf } from \"../api\";\nimport type { AnswerPorts } from \"../run/context\";\nimport type { Plugin, ServeContext } from \"../run/plugin\";\nimport { describeSetting } from \"../settings\";\nimport { AGENT_PROTOCOL, servesAgentProtocol } from \"./agent\";\nimport { onAbort, servedOf, type Served, type ServiceState } from \"./grpc\";\nimport { transportPortsOf, type OwnPortsArgument, type Ports } from \"./ports\";\n\n/**\n * Where a hot reload finds the serve it swaps into: one per process, on\n * `globalThis` (which `bun --hot` keeps across reloads), under a key the global\n * symbol registry gives every evaluation of this module alike.\n */\nexport const SERVER: unique symbol = Symbol.for(\"@nullplatform/plugin:grpc-server\");\n\n/** A serve in progress: what its calls read, what stops it, what stops listening to each signal that stops it, and its promise. */\ninterface Serving {\n  state: ServiceState;\n  stopping: AbortController;\n  /** For each serve that started or joined it, what removes the listener it added to that serve's signal: each run once it ends. */\n  listening: (() => void)[];\n  served: Promise<void>;\n}\n\n/** Where a hot reload finds the plugin's own serve it stops: one per process, as `SERVER` is. */\nexport const OWN_SERVER: unique symbol = Symbol.for(\"@nullplatform/plugin:own-serve\");\n\n/** A plugin's own serve: how it serves itself. */\ntype OwnServe<Own extends object> = NonNullable<Plugin<Own>[\"serve\"]>;\n\n/** A plugin's own serve in progress: what stops it, and its promise. */\ninterface OwnServing {\n  stopping: AbortController;\n  served: Promise<void>;\n}\n\nconst processWide = globalThis as typeof globalThis & { [SERVER]?: Serving; [OWN_SERVER]?: OwnServing };\n\n/** What resolves once `signal` aborts, now if it already has. */\nfunction aborted(signal: AbortSignal): Promise<void> {\n  return new Promise((resolve) => onAbort(signal, resolve));\n}\n\n/**\n * The serve's life: the gRPC server imported and listening, until `stopping`\n * aborts; then stopped. A server that cannot listen is refused. Once it ends,\n * each listener in `listening` is removed from its signal.\n */\nasync function lifeOf(state: ServiceState, listening: (() => void)[]): Promise<void> {\n  try {\n    const { listeningServer } = await import(\"./grpc-server\");\n    const stop = await listeningServer(state);\n    await aborted(state.stopping);\n    await stop();\n  } finally {\n    listening.forEach((stopListening) => stopListening());\n    if (processWide[SERVER]?.state === state) {\n      processWide[SERVER] = undefined;\n    }\n  }\n}\n\n/** `signal` stops `serving` too, until it ends. */\nfunction stoppedBy(serving: Serving, signal: AbortSignal): void {\n  serving.listening.push(onAbort(signal, () => serving.stopping.abort()));\n}\n\n/** A new serve of `served`, published for a hot reload to find before it listens: a serve's signal stops it. */\nfunction started(served: Served, signal: AbortSignal): Serving {\n  const stopping = new AbortController();\n  const state: ServiceState = { served, stopping: stopping.signal, startedAt: Date.now(), inFlight: new Set() };\n  const listening: (() => void)[] = [];\n  const serving: Serving = { state, stopping, listening, served: lifeOf(state, listening) };\n  processWide[SERVER] = serving;\n  stoppedBy(serving, signal);\n  return serving;\n}\n\n/** Serves `served` once `stopped`, a serve already stopping, has ended, however it ends: a serve never joins a server that is stopping. */\nasync function servedAfter(stopped: Serving, served: Served, signal: AbortSignal): Promise<void> {\n  await Promise.allSettled([stopped.served]);\n  return servedOverGrpc(served, signal);\n}\n\n/** Why a worker started without a listen address refuses to serve: the agent's cookie does not name the protocol. */\nfunction refusalOf(served: Served): Error | undefined {\n  if (servesAgentProtocol(served.settings)) {\n    return undefined;\n  }\n  return new Error(\n    `${served.package.slug}: a worker serves the agent's protocol on a unix socket only when the agent starts it: ` +\n      `set ${describeSetting(\"agentPlugin\")} to ${AGENT_PROTOCOL}, or ${describeSetting(\"grpcListen\")} to listen on TCP`,\n  );\n}\n\n/**\n * Serves `served` over the agent's gRPC protocol until `signal` aborts.\n * Refused when the worker is not the agent's child and has no listen address,\n * or when it cannot listen. A second serve in the same process swaps what is\n * served in place and returns the same promise; its own signal stops the\n * server too. A serve while the server is stopping waits for it to end, then\n * serves anew.\n */\nfunction servedOverGrpc(served: Served, signal: AbortSignal): Promise<void> {\n  const refusal = refusalOf(served);\n  if (refusal !== undefined) {\n    return Promise.reject(refusal);\n  }\n  const running = processWide[SERVER];\n  if (running === undefined) {\n    return started(served, signal).served;\n  }\n  if (running.state.stopping.aborted) {\n    return servedAfter(running, served, signal);\n  }\n  running.state.served = served;\n  served.log.info(`${served.package.slug}: hot reload: the plugin swapped in place`);\n  stoppedBy(running, signal);\n  return running.served;\n}\n\n/** The plugin's own serve, run with `context` once `previous` (the one a hot reload stops) has ended, however it ends; never when its signal aborted first, as a later reload's aborts it. `slug` names the plugin in what it logs. */\nasync function ownLifeOf<Own extends object>(previous: OwnServing | undefined, slug: string, own: OwnServe<Own>, context: ServeContext<Own>): Promise<void> {\n  if (previous !== undefined) {\n    await Promise.allSettled([previous.served]);\n    context.log.info(`${slug}: hot reload: the running serve stopped, then this one served`);\n  }\n  if (context.signal.aborted) {\n    return;\n  }\n  return own(context);\n}\n\n/**\n * The plugin's own serve, handed the log, a signal its caller's aborts, the\n * run's platform credentials and its own ports; always a promise (one that\n * gives none resolves, one that throws as it is called rejects). Published for\n * a hot reload to find: a serve in the same process stops the running one\n * first, and serves once it has ended.\n */\nfunction servedOwn<Own extends object>(plugin: Plugin<Own>, own: OwnServe<Own>, answerPorts: AnswerPorts<Own>): Promise<void> {\n  const previous = processWide[OWN_SERVER];\n  previous?.stopping.abort();\n  const stopping = new AbortController();\n  const stopListening = onAbort(answerPorts.signal, () => stopping.abort());\n  const context: ServeContext<Own> = { log: answerPorts.log, signal: stopping.signal, credentials: credentialsOf(answerPorts.settings), ports: answerPorts.ports };\n  const serving: OwnServing = { stopping, served: Promise.resolve() };\n  serving.served = ownLifeOf(previous, plugin.package.slug, own, context).finally(() => {\n    stopListening();\n    if (processWide[OWN_SERVER] === serving) {\n      processWide[OWN_SERVER] = undefined;\n    }\n  });\n  processWide[OWN_SERVER] = serving;\n  return serving.served;\n}\n\n/** How `plugin` serves with `answerPorts`: its own serve, when it has one (`servedOwn`); else the agent's gRPC protocol. */\nfunction servedWith<Own extends object>(plugin: Plugin<Own>, answerPorts: AnswerPorts<Own>): Promise<void> {\n  const own = plugin.serve;\n  if (own !== undefined) {\n    return servedOwn(plugin, own, answerPorts);\n  }\n  return servedOverGrpc(servedOf(plugin, answerPorts), answerPorts.signal);\n}\n\n/**\n * Serves `plugin` until `ports.signal` aborts: its own serve, when it has one;\n * else the agent's gRPC protocol, where the run's settings say. Once the serve\n * has ended, however it ends, the tracer this serve built is stopped. The\n * ports beyond the core's are the plugin's own (`context.ports`, its serve's\n * `context.ports`), required when the plugin needs them. A second serve in the\n * same process swaps the plugin the gRPC server serves and returns the same\n * promise.\n */\nexport function serve<Own extends object = {}>(plugin: Plugin<Own>, ...[ports]: OwnPortsArgument<Own, Ports & Own>): Promise<void> {\n  const { ports: answerPorts, done } = transportPortsOf(ports);\n  const served = servedWith(plugin, answerPorts);\n  served.then(done, done);\n  return served;\n}\n","/**\n * The agent's command line, and a plugin repository's whole entry point:\n * `await main(plugin)`. The one exception to \"the library defines; the\n * project runs\": it reads the command line, sets the exit code and listens to\n * the process while it runs; no other file of the library does, and none\n * exits the process. It is optional: `handle` and `serve` stay for any other\n * client.\n *\n *   --describe   print the manifest (what `np package publish` reads)\n *   exec'd       answer the one document the agent exec'd the worker with\n *                (`execDocument`)\n *   otherwise    serve until SIGTERM or SIGINT: the agent's gRPC protocol, or\n *                the plugin's own (a collector's schedule)\n *\n * The run's ports are the caller's, in code: none, and every port is the real\n * one its settings describe; a local run passes in-memory ones. No\n * environment variable switches a run to local. Its settings are the code's\n * too: main fills only what the code leaves unset, from the variables the\n * agent sets on a worker (`agentSettingsOf`), the one read of the environment\n * in the library; each one's default comes last.\n */\n\nimport { Console } from \"console\";\nimport type { Plugin } from \"../run/plugin\";\nimport { agentSettingsOf, settingsOf } from \"../settings\";\nimport { execDocument, handle } from \"./exec\";\nimport type { OwnPortsArgument, Ports } from \"./ports\";\nimport { serve } from \"./serve\";\n\n/** The ports main runs a plugin with: the core's but the signal, which is main's (SIGTERM and SIGINT), and the plugin's own. */\nexport type MainPorts<Own extends object> = Omit<Ports, \"signal\"> & Own;\n\n/** The flag that prints the manifest. */\nconst DESCRIBE = \"--describe\";\n\n/** What stops the worker. */\nconst STOP_SIGNALS: NodeJS.Signals[] = [\"SIGTERM\", \"SIGINT\"];\n\n/** Where a failure is told: stderr, an error with its stack and its cause. */\nconst failures = new Console(process.stderr);\n\n/** Runs `work` with a signal that SIGTERM or SIGINT aborts, listening for them only while it runs. */\nasync function untilStopped(work: (signal: AbortSignal) => Promise<void>): Promise<void> {\n  const stop = new AbortController();\n  const abort = (): void => stop.abort();\n  STOP_SIGNALS.forEach((signal) => process.once(signal, abort));\n  try {\n    await work(stop.signal);\n  } finally {\n    STOP_SIGNALS.forEach((signal) => process.off(signal, abort));\n  }\n}\n\n/** Answers `document`: its answer on stdout, the exit code 0 when it succeeded, 1 when not. */\nasync function answered<Own extends object>(plugin: Plugin<Own>, document: string, ports: Ports & Own): Promise<void> {\n  const { output, success } = await handle(plugin, document, ports);\n  process.stdout.write(output);\n  process.exitCode = success ? 0 : 1;\n}\n\n/** What the command line and the agent ask of `plugin`: the run's settings those the code gives, each one it leaves unset the agent's variable's. */\nasync function ran<Own extends object>(plugin: Plugin<Own>, ports: MainPorts<Own>): Promise<void> {\n  if (process.argv.includes(DESCRIBE)) {\n    process.stdout.write(`${JSON.stringify(plugin.manifest(), null, 2)}\\n`);\n    return;\n  }\n  const settings = settingsOf(ports.settings, agentSettingsOf(process.env));\n  await untilStopped(async (signal) => {\n    const runPorts = { ...ports, settings, signal };\n    const document = execDocument(settings);\n    return document === undefined ? serve(plugin, runPorts) : answered(plugin, document, runPorts);\n  });\n}\n\n/**\n * Runs `plugin` with `ports` (none: the real ones its settings describe, the\n * settings those the agent sets; the plugin's own required when it needs\n * them) as the command line and the agent ask, then lets the process end: it\n * sets the exit code and never exits itself, so stdout is never cut short. A\n * failure is told on stderr, exit code 1.\n */\nexport async function main<Own extends object = {}>(plugin: Plugin<Own>, ...[ports]: OwnPortsArgument<Own, MainPorts<Own>>): Promise<void> {\n  try {\n    // None given is the core's defaults: the types give none only to a plugin that needs none of its own.\n    await ran(plugin, ports ?? ({} as MainPorts<Own>));\n  } catch (error) {\n    failures.error(error);\n    process.exitCode = 1;\n  }\n}\n","","/**\n * An event route: what a plugin answers when the notifications API delivers an\n * event. It knows the event's fields, each read as text (`textOf`): a payload\n * with a `source` is the event its `event` names, else its `action`. The\n * handler gets `event` as its input (the name, the source and the payload's\n * `context`) and the core's context beside it, and its return prints as an\n * envelope, with no lifecycle. The\n * package's channel lets the event through by the source its name begins with.\n */\n\nimport fixture from \"../../../contract/fixtures/event.json\" with { type: \"json\" };\nimport { isJsonObject, type Payload } from \"../core/payload\";\nimport type { Context } from \"../core/run/context\";\nimport type { Route } from \"../core/run/route\";\nimport { textOf } from \"../core/text\";\n\n/** What an event's handler gets as its input: the event. */\nexport interface EventInput {\n  event: {\n    /** The event's name, as the route declares it. */\n    name: string;\n    /** The notification's source, as the payload sends it, trimmed. */\n    source: string;\n    /** What the event is about, as the notification carries it; empty when it carries none. */\n    context: Record<string, unknown>;\n  };\n}\n\n/** The event a payload is: its `event` when it names one, else its `action`. */\nfunction eventNameOf(payload: Payload): string | undefined {\n  return textOf(payload.event) ?? textOf(payload.action);\n}\n\n/** The source an event's name says: its first segment, `checklist` for `checklist:item:validation_dispatched`. */\nfunction sourceOf(name: string): string {\n  return name.split(\":\")[0];\n}\n\n/** The event `payload` is, as the route named `name` hands it to its handler: a payload its match accepted, so it has a source. */\nfunction eventOf(name: string, payload: Payload): EventInput[\"event\"] {\n  return { name, source: textOf(payload.source) ?? \"\", context: isJsonObject(payload.context) ? payload.context : {} };\n}\n\n/** What tooling offers to run the event with: the event fixture, as the event `name` from its source. */\nfunction sampleOf(name: string): Payload {\n  return { ...structuredClone(fixture.notification), action: name, source: sourceOf(name) };\n}\n\n/** The route that answers the event `name` with `handler`: a payload with a source, whose event is `name`. */\nexport function event(name: string, handler: (input: EventInput, context: Context) => unknown): Route {\n  return {\n    name,\n    match: (payload) => textOf(payload.source) !== undefined && eventNameOf(payload) === name,\n    handler: (payload, context) => handler({ event: eventOf(name, payload) }, context),\n    channel: { source: sourceOf(name), filter: { action: { $eq: name } } },\n    sample: sampleOf(name),\n  };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,SAAwB,OAAO,IAAI,kCAAkC;;AAYlF,MAAa,aAA4B,OAAO,IAAI,gCAAgC;AAWpF,MAAM,cAAc;;AAGpB,SAAS,QAAQ,QAAoC;CACnD,OAAO,IAAI,SAAS,YAAY,QAAQ,QAAQ,OAAO,CAAC;AAC1D;;;;;;AAOA,eAAe,OAAO,OAAqB,WAA0C;CACnF,IAAI;EACF,MAAM,EAAE,oBAAoB,MAAM,OAAO;EACzC,MAAM,OAAO,MAAM,gBAAgB,KAAK;EACxC,MAAM,QAAQ,MAA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