{"_id":"@adhd/apigen-runtime","name":"@adhd/apigen-runtime","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@adhd/apigen-runtime","version":"0.1.0","dependencies":{"@adhd/apigen-core":"^0.1.0","pino":"10.3.1"},"main":"./index.js","module":"./index.mjs","typings":"./index.d.ts","publishConfig":{"access":"public"},"gitHead":"70af56163bc48ddfa898e1202c9bd768e7372a33","_id":"@adhd/apigen-runtime@0.1.0","description":"The apigen **dispatch runtime** — the single canonical call path every plugin and every generated server uses to turn an inbound request into a function call. Pure TypeScript, **platform: shared**.","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-Vl1KPPdgsWun7MjF8uujzWFHJs1zC1oFPkvnem26PT8mVNmkXzw5bYIRzm1xS62msrC6qfGj/N3coHf8FxzFAA==","shasum":"d79e182e2ed50be5e0ecd5a3a78639886d4c9c3a","tarball":"https://registry.npmjs.org/@adhd/apigen-runtime/-/apigen-runtime-0.1.0.tgz","fileCount":19,"unpackedSize":25027527,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDay9IYdsumMO5wPkEjrRDX/Mbpn5WP3kzsxaielWhu1wIhAJJ8sZVDcIwuHxVdE78bNKoAG+t/+g6AaXfFqXAZBVTf"}]},"_npmUser":{"name":"pseudosky","email":"skywinston.sk@gmail.com"},"directories":{},"maintainers":[{"name":"pseudosky","email":"skywinston.sk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/apigen-runtime_0.1.0_1782256653029_0.21962295825552136"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-23T23:17:32.811Z","0.1.0":"2026-06-23T23:17:33.301Z","modified":"2026-06-23T23:17:33.543Z"},"maintainers":[{"name":"pseudosky","email":"skywinston.sk@gmail.com"}],"description":"The apigen **dispatch runtime** — the single canonical call path every plugin and every generated server uses to turn an inbound request into a function call. Pure TypeScript, **platform: shared**.","readme":"# @adhd/apigen-runtime\n\nThe apigen **dispatch runtime** — the single canonical call path every plugin and every\ngenerated server uses to turn an inbound request into a function call. Pure TypeScript,\n**platform: shared**.\n\nPart of [apigen](../README.md). For end-to-end usage see [`../cli`](../cli).\n\n## Public API\n\n```ts\nimport {\n  dispatch, buildFnTable, describeParams,\n  needsEnvelopeField, dataParamNames,\n  createLogger, defineMiddleware, createApiPackage,\n  EventBus, wireObservers, buildContext,\n} from '@adhd/apigen-runtime'\nimport type { Logger, LogFormat, CreateLoggerOptions, ParamInfo, AnyFn } from '@adhd/apigen-runtime'\n```\n\n- **`dispatch(fns, ctx, schema, fnName, envelope, data)`** — the one dispatch path. No plugin\n  inlines this; all import it here.\n- **`buildFnTable(mod)`** — normalize an imported module into a callable table, recursively\n  unwrapping `default` / CommonJS `module.exports` layers and keying functions by their\n  `.name` so default- and CJS-wrapped exports resolve (closes ledger finding F28).\n- **`describeParams(schema)` → `ParamInfo[]`** — extract the parameter list for route/tool\n  logging and CLI flag generation.\n- **`needsEnvelopeField` / `dataParamNames`** — envelope + param helpers (single source).\n- **`createLogger({ level, format, destination })`** — pino-based logger; defaults to\n  **stderr** so MCP stdio stdout stays protocol-clean. `format: 'json' | 'pretty'`.\n- **`defineMiddleware` / `createApiPackage` / `EventBus` / `wireObservers` / `buildContext`**\n  — middleware + observer wiring.\n\n## Request envelope\n\nInbound payloads are wrapped: `{ \"data\": { ...params }, ...envelope }`. `dispatch` validates\nthe envelope fields a function requires (e.g. a `session` added by middleware) and passes\n`data` to the function.\n\n## Develop\n\n```bash\nnpx nx build apigen-runtime\nnpx nx test  apigen-runtime\n```\n","readmeFilename":"README.md","_rev":"1-fc163d6cce3e28f24d53f64a43e5d5bc"}