theokit 0.50.0 → 0.50.1

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 (92) hide show
  1. package/dist/{actions-virtual-module-ZYLMNW6K.js → actions-virtual-module-DSIVNGK7.js} +6 -5
  2. package/dist/{actions-virtual-module-ZYLMNW6K.js.map → actions-virtual-module-DSIVNGK7.js.map} +1 -1
  3. package/dist/{actions-virtual-module-5WBVSDOM.js → actions-virtual-module-RXL2RJTW.js} +7 -6
  4. package/dist/actions-virtual-module-RXL2RJTW.js.map +1 -0
  5. package/dist/adapters/agent-mount.js +4 -3
  6. package/dist/{agent-GKUEL6OH.js → agent-7IPEVCAY.js} +2 -2
  7. package/dist/{app-typed-client-DQM3Y6YY.js → app-typed-client-UTBMJZOE.js} +6 -5
  8. package/dist/{app-typed-client-DQM3Y6YY.js.map → app-typed-client-UTBMJZOE.js.map} +1 -1
  9. package/dist/{app-typed-client-4LAIEGFX.js → app-typed-client-XGDZKH73.js} +7 -6
  10. package/dist/app-typed-client-XGDZKH73.js.map +1 -0
  11. package/dist/{body-parser-web-4Z2QTPDU.js → body-parser-web-ON5CUTEL.js} +5 -2
  12. package/dist/body-parser-web-ON5CUTEL.js.map +1 -0
  13. package/dist/{body-parser-web-TIOTXPDW.js → body-parser-web-RV2SSAI3.js} +5 -2
  14. package/dist/body-parser-web-RV2SSAI3.js.map +1 -0
  15. package/dist/{build-FLX6VF7Q.js → build-VZODSYIQ.js} +6 -5
  16. package/dist/{build-FLX6VF7Q.js.map → build-VZODSYIQ.js.map} +1 -1
  17. package/dist/{chunk-C62IZEJI.js → chunk-2COPDKIG.js} +9 -5
  18. package/dist/chunk-2COPDKIG.js.map +1 -0
  19. package/dist/{chunk-JIKNR5LX.js → chunk-7AEBH52I.js} +9 -9
  20. package/dist/chunk-7UZZHCRN.js +21 -0
  21. package/dist/chunk-7UZZHCRN.js.map +1 -0
  22. package/dist/chunk-CHTAWXC2.js +18 -0
  23. package/dist/chunk-CHTAWXC2.js.map +1 -0
  24. package/dist/{chunk-72DMJBXI.js → chunk-DOI4G4X3.js} +6 -2
  25. package/dist/chunk-DOI4G4X3.js.map +1 -0
  26. package/dist/{chunk-44J2ANQC.js → chunk-EDWEYQRG.js} +2 -2
  27. package/dist/{chunk-HWBRS4DZ.js → chunk-FMTRNQQ7.js} +2 -2
  28. package/dist/{chunk-7PM6K5EV.js → chunk-H53KNS6Q.js} +2 -2
  29. package/dist/{chunk-RWNYIU6A.js → chunk-JKF25N73.js} +8 -4
  30. package/dist/{chunk-RWNYIU6A.js.map → chunk-JKF25N73.js.map} +1 -1
  31. package/dist/{chunk-WOBSEO75.js → chunk-KOS567NB.js} +3 -3
  32. package/dist/{chunk-OAUI273L.js → chunk-KTS6G26H.js} +10 -10
  33. package/dist/{chunk-ULDCFL2O.js → chunk-N42ZWWOW.js} +2 -2
  34. package/dist/{chunk-MCTC6HSE.js → chunk-PF3YM6NY.js} +2 -2
  35. package/dist/{chunk-JWRCZIA4.js → chunk-PLUHPNGA.js} +3 -3
  36. package/dist/{chunk-2AMLGJJA.js → chunk-RARK7JBR.js} +5 -2
  37. package/dist/chunk-RARK7JBR.js.map +1 -0
  38. package/dist/{chunk-SL7YUHPV.js → chunk-RJJF457I.js} +2 -2
  39. package/dist/{chunk-NZ5JU6D3.js → chunk-URCXSUI3.js} +2 -2
  40. package/dist/cli/index.js +6 -6
  41. package/dist/{dev-ANDSEVLB.js → dev-3UQVD2W6.js} +8 -7
  42. package/dist/{dev-ANDSEVLB.js.map → dev-3UQVD2W6.js.map} +1 -1
  43. package/dist/{index-CzxtQcnp.d.ts → index-DctfHtv-.d.ts} +1 -1
  44. package/dist/index.d.ts +4 -4
  45. package/dist/index.js +7 -6
  46. package/dist/index.js.map +1 -1
  47. package/dist/{internal-api-IP35YU3G.js → internal-api-4X6NDS2F.js} +6 -5
  48. package/dist/{internal-api-OPU456AT.js → internal-api-XQHU5JKY.js} +7 -6
  49. package/dist/{mcp-5LLNAGKA.js → mcp-IQRHFP3Y.js} +2 -2
  50. package/dist/{observability-bootstrap-MZMSOE66.js → observability-bootstrap-LERYDHKY.js} +4 -3
  51. package/dist/{preview-GHPT2EQ5.js → preview-BT47VMIB.js} +3 -3
  52. package/dist/server/http/index.d.ts +1 -1
  53. package/dist/server/http/index.js +4 -3
  54. package/dist/server/index.d.ts +1 -1
  55. package/dist/server/index.js +5 -4
  56. package/dist/server/index.js.map +1 -1
  57. package/dist/server/observability/index.js +3 -2
  58. package/dist/{server-boundary-6B4ZQUY7.js → server-boundary-2WFT546S.js} +7 -6
  59. package/dist/server-boundary-2WFT546S.js.map +1 -0
  60. package/dist/{server-boundary-7VZQRPPX.js → server-boundary-A67OPRKO.js} +6 -5
  61. package/dist/{server-boundary-7VZQRPPX.js.map → server-boundary-A67OPRKO.js.map} +1 -1
  62. package/dist/{start-UZDMOT7I.js → start-3K3C4Z2X.js} +9 -8
  63. package/dist/{start-UZDMOT7I.js.map → start-3K3C4Z2X.js.map} +1 -1
  64. package/dist/vite-plugin/index.js +7 -6
  65. package/dist/{vite-plugin-VKCT2LF2.js → vite-plugin-USXUIV3H.js} +8 -7
  66. package/package.json +1 -1
  67. package/dist/actions-virtual-module-5WBVSDOM.js.map +0 -1
  68. package/dist/app-typed-client-4LAIEGFX.js.map +0 -1
  69. package/dist/body-parser-web-4Z2QTPDU.js.map +0 -1
  70. package/dist/body-parser-web-TIOTXPDW.js.map +0 -1
  71. package/dist/chunk-2AMLGJJA.js.map +0 -1
  72. package/dist/chunk-72DMJBXI.js.map +0 -1
  73. package/dist/chunk-C62IZEJI.js.map +0 -1
  74. package/dist/server-boundary-6B4ZQUY7.js.map +0 -1
  75. /package/dist/{agent-GKUEL6OH.js.map → agent-7IPEVCAY.js.map} +0 -0
  76. /package/dist/{chunk-JIKNR5LX.js.map → chunk-7AEBH52I.js.map} +0 -0
  77. /package/dist/{chunk-44J2ANQC.js.map → chunk-EDWEYQRG.js.map} +0 -0
  78. /package/dist/{chunk-HWBRS4DZ.js.map → chunk-FMTRNQQ7.js.map} +0 -0
  79. /package/dist/{chunk-7PM6K5EV.js.map → chunk-H53KNS6Q.js.map} +0 -0
  80. /package/dist/{chunk-WOBSEO75.js.map → chunk-KOS567NB.js.map} +0 -0
  81. /package/dist/{chunk-OAUI273L.js.map → chunk-KTS6G26H.js.map} +0 -0
  82. /package/dist/{chunk-ULDCFL2O.js.map → chunk-N42ZWWOW.js.map} +0 -0
  83. /package/dist/{chunk-MCTC6HSE.js.map → chunk-PF3YM6NY.js.map} +0 -0
  84. /package/dist/{chunk-JWRCZIA4.js.map → chunk-PLUHPNGA.js.map} +0 -0
  85. /package/dist/{chunk-SL7YUHPV.js.map → chunk-RJJF457I.js.map} +0 -0
  86. /package/dist/{chunk-NZ5JU6D3.js.map → chunk-URCXSUI3.js.map} +0 -0
  87. /package/dist/{internal-api-IP35YU3G.js.map → internal-api-4X6NDS2F.js.map} +0 -0
  88. /package/dist/{internal-api-OPU456AT.js.map → internal-api-XQHU5JKY.js.map} +0 -0
  89. /package/dist/{mcp-5LLNAGKA.js.map → mcp-IQRHFP3Y.js.map} +0 -0
  90. /package/dist/{observability-bootstrap-MZMSOE66.js.map → observability-bootstrap-LERYDHKY.js.map} +0 -0
  91. /package/dist/{preview-GHPT2EQ5.js.map → preview-BT47VMIB.js.map} +0 -0
  92. /package/dist/{vite-plugin-VKCT2LF2.js.map → vite-plugin-USXUIV3H.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/body-parser.ts","../src/server/observability/request-log.ts","../src/server/observability/logger.ts"],"sourcesContent":["import type { IncomingMessage } from 'node:http'\nimport { basename } from 'node:path'\n\nimport Busboy from 'busboy'\n\nimport { appendField } from './multipart-fields.js'\n\n// --- Types ---\n\nexport interface UploadedFile {\n fieldname: string\n filename: string\n encoding: string\n mimeType: string\n buffer: Buffer\n size: number\n}\n\nexport interface ParsedBody {\n fields: Record<string, string | string[]>\n files: UploadedFile[]\n json?: unknown\n}\n\nexport interface BodyParserOptions {\n maxFileSize?: number // bytes, default 10MB\n maxFiles?: number // default 10\n maxFieldSize?: number // bytes, default 1MB\n}\n\nconst METHODS_WITH_BODY = new Set(['POST', 'PUT', 'PATCH'])\n\nconst DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024 // 10MB\nconst DEFAULT_MAX_FILES = 10\nconst DEFAULT_MAX_FIELD_SIZE = 1 * 1024 * 1024 // 1MB\n\n/**\n * theokit#400 — the request body was consumed before the parser could read it.\n *\n * A Node `IncomingMessage` is a single-use stream. Once something drains it, `'end'` has fired and\n * cannot fire again, so a parser that attaches its listeners afterwards waits for an event that\n * will never come: the request hangs with no status, no error, and no timeout — the failure family\n * of `docs/adr/0002`, in its least readable form, since nothing terminates at all.\n *\n * That is a framework bug wherever it happens (a dispatcher converting the request before deciding\n * it owns the path, a middleware reading the stream and not passing the value on), so this reports\n * it by name instead of waiting. A 500 that says which request lost its body is recoverable\n * information; silence is not.\n */\nexport class RequestBodyConsumedError extends Error {\n readonly code = 'REQUEST_BODY_CONSUMED'\n readonly status = 500\n constructor(method: string, url: string | undefined) {\n super(\n `Request body for ${method} ${url ?? '(unknown url)'} was already consumed before the body ` +\n `parser ran, so it can never arrive. Something upstream read the request stream — a route ` +\n `dispatcher, a middleware, or an adapter that converted the request — without passing the ` +\n `parsed body on.`,\n )\n this.name = 'RequestBodyConsumedError'\n }\n}\n\n/**\n * Was the request declared to carry no bytes at all? `content-length: 0` is the one case where an\n * already-ended stream is honestly empty rather than eaten, and it must stay an `undefined` body\n * instead of an error — an empty POST is legal.\n */\nfunction declaresEmptyBody(req: IncomingMessage): boolean {\n return (req.headers['content-length'] ?? '') === '0'\n}\n\n/**\n * True once the stream has emitted `'end'` — which, at the moment the parser is about to attach,\n * means somebody else drained it. A stream nobody has read yet reports `false` here even when Node\n * has already buffered every byte, because `'end'` only fires on consumption.\n *\n * Read as a plain truthiness check on purpose: the type says `boolean`, but the suite's request\n * doubles are plain emitters carrying `headers` and no `readableEnded` at all, and `undefined` must\n * take the untouched-stream path exactly as `false` does.\n */\nfunction bodyAlreadyConsumed(req: IncomingMessage): boolean {\n return req.readableEnded && !declaresEmptyBody(req)\n}\n\nexport class FileTooLargeError extends Error {\n readonly code = 'FILE_TOO_LARGE'\n readonly status = 413\n constructor(\n message: string,\n readonly truncatedFilenames: string[],\n readonly maxFileSize: number,\n ) {\n super(message)\n this.name = 'FileTooLargeError'\n }\n}\n\n// --- JSON parsing ---\n\n/**\n * Stash the parsed body on the IncomingMessage for the devtools forwarder\n * to read at log time. Symbol-keyed so it never leaks into user-visible\n * surfaces. Best-effort — failures (e.g. frozen req) are swallowed.\n */\nfunction stashBodyPreview(req: IncomingMessage, body: unknown): void {\n try {\n ;(req as unknown as Record<symbol, unknown>)[DEVTOOLS_BODY_PREVIEW] = body\n } catch {\n // best-effort; never break the request\n }\n}\n\nfunction parseJsonBody(req: IncomingMessage): Promise<unknown> {\n return new Promise((resolve, reject) => {\n // theokit#400 — an ended stream re-emits nothing, so attaching here would wait forever. A\n // declared-empty body resolves as the absent body it is; anything else was eaten upstream and\n // is reported rather than awaited.\n if (req.readableEnded) {\n if (declaresEmptyBody(req)) {\n resolve(undefined)\n return\n }\n reject(new RequestBodyConsumedError(req.method ?? 'POST', req.url))\n return\n }\n const chunks: Buffer[] = []\n req.on('data', (chunk: Buffer) => chunks.push(chunk))\n req.on('end', () => {\n const raw = Buffer.concat(chunks).toString()\n if (!raw) {\n resolve(undefined)\n return\n }\n try {\n resolve(JSON.parse(raw))\n } catch {\n reject(new Error('Invalid JSON body'))\n }\n })\n req.on('error', reject)\n })\n}\n\n// --- Multipart parsing ---\n\nfunction parseMultipartBody(\n req: IncomingMessage,\n contentType: string,\n options: Required<Pick<BodyParserOptions, 'maxFileSize' | 'maxFiles' | 'maxFieldSize'>>,\n): Promise<{ fields: Record<string, string | string[]>; files: UploadedFile[] }> {\n // EC-3: Validate boundary exists.\n if (!contentType.includes('boundary=')) {\n return Promise.reject(new Error('Missing multipart boundary'))\n }\n\n // theokit#400 — the multipart arm fails differently and no better. Piping an already-drained\n // stream into busboy rejects with `Unexpected end of form` (measured), which\n // `parseQueryAndBody` maps to a 400 VALIDATION_ERROR: the caller is told to fix a request that\n // was correct, and the framework's own mistake reads as theirs. Same cause, so the same name.\n if (bodyAlreadyConsumed(req)) {\n return Promise.reject(new RequestBodyConsumedError(req.method ?? 'POST', req.url))\n }\n\n return new Promise((resolve, reject) => {\n const fields: Record<string, string | string[]> = {}\n const files: UploadedFile[] = []\n // CR-010: track filenames that were truncated mid-stream. The previous\n // implementation skipped truncated files from `files` and relied on\n // `files.some(f => f.size > maxFileSize)` to detect — but since the\n // file was never added, the guard never fired. Silent data loss.\n const truncatedFilenames: string[] = []\n let fileCount = 0\n\n const bb = Busboy({\n headers: req.headers,\n limits: {\n fileSize: options.maxFileSize,\n files: options.maxFiles,\n fieldSize: options.maxFieldSize,\n },\n })\n\n bb.on('field', (name: string, value: string) => {\n appendField(fields, name, value)\n })\n\n bb.on(\n 'file',\n (\n fieldname: string,\n stream: NodeJS.ReadableStream,\n info: { filename: string; encoding: string; mimeType: string },\n ) => {\n fileCount++\n if (fileCount > options.maxFiles) {\n stream.resume() // drain\n return\n }\n\n // EC-6: Sanitize filename — basename only, no path traversal.\n const safeName = basename(info.filename || 'unnamed')\n const chunks: Buffer[] = []\n let size = 0\n let truncated = false\n\n stream.on('data', (chunk: Buffer) => {\n size += chunk.length\n if (size > options.maxFileSize) {\n truncated = true\n stream.resume() // drain the rest\n return\n }\n chunks.push(chunk)\n })\n\n stream.on('end', () => {\n if (truncated) {\n truncatedFilenames.push(safeName)\n return\n }\n\n const buffer = Buffer.concat(chunks)\n files.push({\n fieldname,\n filename: safeName,\n encoding: info.encoding,\n mimeType: info.mimeType,\n buffer,\n size: buffer.length,\n })\n })\n },\n )\n\n bb.on('filesLimit', () => {\n reject(new Error(`Too many files. Maximum: ${options.maxFiles}`))\n })\n\n bb.on('error', (err: Error) => {\n reject(err)\n })\n\n bb.on('close', () => {\n if (truncatedFilenames.length > 0) {\n reject(\n new FileTooLargeError(\n `File too large (max ${options.maxFileSize} bytes): ${truncatedFilenames.join(', ')}`,\n truncatedFilenames,\n options.maxFileSize,\n ),\n )\n return\n }\n resolve({ fields, files })\n })\n\n req.pipe(bb)\n })\n}\n\n// --- Main parser ---\n\n/**\n * Symbol-keyed slot on IncomingMessage that the devtools request log\n * forwarder reads to enrich the broadcast payload with a body preview.\n * Symbol-keyed so it can't collide with user-land props and is invisible\n * to JSON.stringify / iteration. Always optional — readers must guard.\n */\nexport const DEVTOOLS_BODY_PREVIEW = Symbol('theo:devtools:bodyPreview')\n\nexport async function parseRequestBody(\n req: IncomingMessage,\n options?: BodyParserOptions,\n): Promise<ParsedBody> {\n const method = req.method?.toUpperCase() ?? 'GET'\n if (!METHODS_WITH_BODY.has(method)) {\n return { fields: {}, files: [], json: undefined }\n }\n\n const contentType = req.headers['content-type'] ?? ''\n\n // JSON\n if (contentType.includes('application/json')) {\n const json = await parseJsonBody(req)\n stashBodyPreview(req, json)\n return { fields: {}, files: [], json }\n }\n\n // Multipart\n if (contentType.includes('multipart/form-data')) {\n const limits = {\n maxFileSize: options?.maxFileSize ?? DEFAULT_MAX_FILE_SIZE,\n maxFiles: options?.maxFiles ?? DEFAULT_MAX_FILES,\n maxFieldSize: options?.maxFieldSize ?? DEFAULT_MAX_FIELD_SIZE,\n }\n const { fields, files } = await parseMultipartBody(req, contentType, limits)\n stashBodyPreview(req, {\n fields,\n files: files.map((f) => ({\n fieldname: f.fieldname,\n filename: f.filename,\n mimeType: f.mimeType,\n size: f.size,\n })),\n })\n return { fields, files }\n }\n\n // No body or empty\n if (!contentType) {\n return { fields: {}, files: [] }\n }\n\n // Unsupported content type\n throw new Error(`Unsupported Content-Type: ${contentType}`)\n}\n","/**\n * Request log primitive (T6.2 of architecture-review-remediation-plan).\n *\n * Split out from `logger.ts` per PV-12 (SRP) — the file previously mixed\n * 3 concerns (factory, warnOnce, request log). This module owns ONLY the\n * `logRequest` flow + the devtools broadcast best-effort forwarder.\n *\n * Public API surface is unchanged — `logger.ts` re-exports `logRequest`\n * + `RequestLog` + `LoggerFn` for backward compat.\n */\nimport type { IncomingMessage } from 'node:http'\n\nimport { DEVTOOLS_BODY_PREVIEW } from '../body-parser.js'\n\nexport interface RequestLog {\n level: string\n method: string\n url: string\n status: number\n duration: number\n requestId: string\n timestamp: string\n}\n\nexport type LoggerFn = (log: RequestLog) => void\n\nconst defaultLoggerFn: LoggerFn = (log) => {\n // eslint-disable-next-line no-console -- request-log default output IS the contract\n console.log(JSON.stringify(log))\n}\n\nexport function logRequest(\n info: Omit<RequestLog, 'level' | 'timestamp'>,\n customLogger?: LoggerFn,\n req?: IncomingMessage,\n): void {\n const log: RequestLog = {\n level: 'info',\n ...info,\n timestamp: new Date().toISOString(),\n }\n const logger = customLogger ?? defaultLoggerFn\n logger(log)\n // T2.1 — also broadcast to devtools (no-op in prod / when no dev server).\n // Pass `req` so the devtools forwarder can extract headers + body preview\n // stashed by body-parser (Symbol-keyed). Without `req`, only metadata\n // (method/path/status/duration) reaches the devtools UI — the expanded\n // row view then shows nothing useful.\n broadcastRequestToDevtools(info, req)\n}\n\n/**\n * T2.1 — Forward a request record to the devtools UI. Lazy import keeps\n * this module dep-free for prod; broadcast.ts internally guards on\n * `globalThis.__theoViteHotServer`.\n */\nfunction randomRequestId(): string {\n // eslint-disable-next-line sonarjs/pseudo-random -- non-secret correlation id for devtools UI\n return `req-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`\n}\n\n/**\n * T5a.2 Phase C slice 2/2 — pure devtools broadcast that takes a\n * pre-extracted headers object + optional stashed body, so both\n * IncomingMessage and Web Request paths share the same dispatch logic.\n *\n * Errors here must not propagate — devtools forwarding is best-effort\n * and silenced.\n */\nfunction broadcastToDevtoolsCore(\n info: Omit<RequestLog, 'level' | 'timestamp'>,\n headers: Record<string, string> | undefined,\n stashedBody: unknown,\n): void {\n void Promise.all([\n import('../../devtools/server-side/broadcast.js'),\n import('../../devtools/server-side/build-request-body-preview.js'),\n ])\n .then(([{ broadcastRequest }, { buildRequestBodyPreview }]) => {\n const bodyInfo = buildRequestBodyPreview(stashedBody)\n broadcastRequest({\n id: randomRequestId(),\n traceId: info.requestId,\n method: info.method,\n path: info.url,\n status: info.status,\n durationMs: info.duration,\n startedAt: Date.now() - info.duration,\n ...(headers ? { headers } : {}),\n ...(bodyInfo\n ? {\n bodyPreview: bodyInfo.preview,\n bodyLength: bodyInfo.length,\n bodyTruncated: bodyInfo.truncated,\n }\n : {}),\n })\n })\n .catch(() => {\n // No-op: devtools forwarding is best-effort.\n })\n}\n\nfunction broadcastRequestToDevtools(\n info: Omit<RequestLog, 'level' | 'timestamp'>,\n req?: IncomingMessage,\n): void {\n // T2.1 forwarder. Errors here must not propagate.\n const headers = req?.headers\n ? Object.fromEntries(\n Object.entries(req.headers).map(([k, v]) => [\n k,\n Array.isArray(v) ? v.join(', ') : (v ?? ''),\n ]),\n )\n : undefined\n const stashedBody = req\n ? (req as unknown as Record<symbol, unknown>)[DEVTOOLS_BODY_PREVIEW]\n : undefined\n broadcastToDevtoolsCore(info, headers, stashedBody)\n}\n\n/**\n * T5a.2 Phase C slice 2/2 — Web-Standards request log + devtools\n * forward. Mirror of `logRequest(info, logger?, req?: IncomingMessage)`\n * accepting `request?: Request`.\n *\n * Extracts headers via `request.headers.entries()` (Web `Headers`\n * iterator). Body preview stash is NOT yet supported on the Web path —\n * `body-parser-web.ts` doesn't yet stash like `body-parser.ts` does for\n * the IncomingMessage path. That hookup is Phase E scope (body parsing\n * migration). Until then, the devtools UI shows headers but no body\n * preview for Web-handled requests — same surface as the IncomingMessage\n * path before the stash convention shipped.\n */\nexport function logRequestFromRequest(\n info: Omit<RequestLog, 'level' | 'timestamp'>,\n customLogger?: LoggerFn,\n request?: Request,\n): void {\n const log: RequestLog = {\n level: 'info',\n ...info,\n timestamp: new Date().toISOString(),\n }\n const logger = customLogger ?? defaultLoggerFn\n logger(log)\n\n let headers: Record<string, string> | undefined\n if (request) {\n headers = {}\n for (const [k, v] of request.headers.entries()) {\n headers[k] = v\n }\n }\n // Phase E will add body-preview stash on Web Request; for now no stash.\n broadcastToDevtoolsCore(info, headers, undefined)\n}\n","// --- Types ---\n\nexport type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent'\n\nexport interface StructuredLog {\n level: string\n msg: string\n timestamp: string\n [key: string]: unknown\n}\n\nexport interface TheoLogger {\n debug(msg: string, context?: Record<string, unknown>): void\n info(msg: string, context?: Record<string, unknown>): void\n warn(msg: string, context?: Record<string, unknown>): void\n error(msg: string, context?: Record<string, unknown>): void\n child(context: Record<string, unknown>): TheoLogger\n}\n\n// --- Level filtering ---\n\nconst LEVEL_ORDER: Record<string, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n silent: 4,\n}\n\nfunction shouldLog(msgLevel: string, configLevel: string): boolean {\n return LEVEL_ORDER[msgLevel] >= LEVEL_ORDER[configLevel]\n}\n\n// --- Default output ---\n\nfunction defaultOutput(log: StructuredLog): void {\n // eslint-disable-next-line no-console -- structured logger output IS the contract here\n console.log(JSON.stringify(log))\n}\n\n// --- Factory ---\n\nexport function createLogger(options?: {\n level?: LogLevel\n output?: (log: StructuredLog) => void\n context?: Record<string, unknown>\n}): TheoLogger {\n const level = options?.level ?? 'info'\n const output = options?.output ?? defaultOutput\n const baseContext = options?.context ?? {}\n\n function log(msgLevel: string, msg: string, context?: Record<string, unknown>): void {\n if (!shouldLog(msgLevel, level)) return\n\n const entry: StructuredLog = {\n level: msgLevel,\n msg,\n timestamp: new Date().toISOString(),\n ...baseContext,\n ...context,\n }\n\n // Serialize Error objects to stack string\n if (entry.error instanceof Error) {\n entry.error = entry.error.stack ?? entry.error.message\n }\n\n output(entry)\n }\n\n return {\n debug: (msg, ctx) => {\n log('debug', msg, ctx)\n },\n info: (msg, ctx) => {\n log('info', msg, ctx)\n },\n warn: (msg, ctx) => {\n log('warn', msg, ctx)\n },\n error: (msg, ctx) => {\n log('error', msg, ctx)\n },\n child(ctx) {\n return createLogger({\n level,\n output,\n context: { ...baseContext, ...ctx },\n })\n },\n }\n}\n\n// --- warnOnce (T2.1) ---\n\n/**\n * Per-key dedup state. Module-scoped — reset per-process at boot.\n *\n * CR-011 fix: previous implementation used an unbounded `Set` which grew\n * forever in long-running prod processes with high-cardinality keys\n * (e.g. dynamic path segments). The bound below uses LRU-by-insertion:\n * when the Set hits `MAX_SEEN`, the OLDEST key is evicted. Subsequent\n * occurrences of that key will warn ONCE more — acceptable in exchange\n * for bounded memory.\n */\nconst _warnOnceSeen = new Set<string>()\nconst MAX_SEEN = 1024\n\n/**\n * Reset internal state. Test-only export — do not call from production.\n */\nexport function _resetWarnOnceForTests(): void {\n _warnOnceSeen.clear()\n}\n\n/**\n * Emit a structured warning ONCE per key. Subsequent calls with the same\n * key are suppressed. Used for cutover-style warnings (e.g. CSRF warn)\n * that would otherwise flood logs under load.\n *\n * Convention: key is `<event>:<method>:<path>` — see callers in csrf.ts.\n *\n * EC-2: payload may contain circular references. Wrap `JSON.stringify`\n * in try/catch so a malformed payload doesn't crash the request handler.\n */\nexport function warnOnce(key: string, payload: Record<string, unknown>): void {\n if (_warnOnceSeen.has(key)) return\n // CR-011: bounded LRU. Evict oldest insertion when at capacity.\n if (_warnOnceSeen.size >= MAX_SEEN) {\n const oldest = _warnOnceSeen.values().next().value\n if (oldest !== undefined) _warnOnceSeen.delete(oldest)\n }\n _warnOnceSeen.add(key)\n\n let line: string\n try {\n line = JSON.stringify({ ...payload, warnOnce: true })\n } catch {\n // EC-2 fallback — preserve the key for grep-ability even when payload\n // can't serialize (e.g., circular references, BigInt, etc.).\n line = `[warnOnce] ${key} — (payload could not be serialized)`\n }\n console.warn(line)\n\n // T2.1 — also broadcast to devtools (no-op in prod / when no dev server).\n // Imported lazily to keep logger.ts dependency-free for non-dev contexts;\n // broadcastToDevtools internally guards on globalThis.__theoViteHotServer.\n broadcastWarnOnceToDevtools(key, payload)\n}\n\n/**\n * T2.1 — Forward a warnOnce payload to the devtools UI. Recognizes the\n * canonical CSRF warn shape and dispatches as 'csrf.warn'; otherwise\n * falls back to a generic 'error' broadcast.\n *\n * No-op when:\n * - globalThis.__theoViteHotServer is undefined (prod / no dev server)\n * - any error occurs (default-deny via broadcastToDevtools' try/catch)\n */\nfunction payloadField(payload: Record<string, unknown>, key: string, fallback = ''): string {\n const value = payload[key]\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean') return String(value)\n return fallback\n}\n\nfunction randomDevtoolsId(): string {\n // eslint-disable-next-line sonarjs/pseudo-random -- non-secret correlation id for devtools UI\n return `warn-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`\n}\n\nfunction broadcastWarnOnceToDevtools(key: string, payload: Record<string, unknown>): void {\n // CR-021: removed dead `void key` statement.\n // T2.1 forwarder. Errors here must not propagate (default-deny).\n void import('../../devtools/server-side/broadcast.js')\n .then(({ broadcastCsrfWarn, broadcastError }) => {\n if (\n payload.event === 'csrf.warn' &&\n typeof payload.code === 'string' &&\n typeof payload.docsUrl === 'string'\n ) {\n broadcastCsrfWarn({\n event: 'csrf.warn',\n code: payload.code,\n docsUrl: payload.docsUrl,\n method: payloadField(payload, 'method'),\n path: payloadField(payload, 'path'),\n reason: payloadField(payload, 'reason'),\n })\n } else {\n broadcastError({\n id: randomDevtoolsId(),\n type: 'console',\n message: payloadField(payload, 'event', key),\n timestamp: Date.now(),\n })\n }\n })\n .catch(() => {\n // No-op: devtools forwarding is best-effort.\n })\n}\n\n// --- Backward compat re-exports ---\n//\n// T6.2 (PV-12 SRP): `logRequest` + `RequestLog` + `LoggerFn` moved to a\n// dedicated `request-log.ts`. Re-exported here so consumers importing\n// from `theokit/server` see no change.\n\nexport { logRequest } from './request-log.js'\nexport type { RequestLog, LoggerFn } from './request-log.js'\n"],"mappings":";;;;;;;AACA,SAAS,gBAAgB;AAEzB,OAAO,YAAY;AA2BnB,IAAM,oBAAoB,oBAAI,IAA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RWNYIU6A.js";
5
+ } from "./chunk-JKF25N73.js";
6
6
  import {
7
7
  enforceCsrf
8
8
  } from "./chunk-P6OS7652.js";
@@ -108,4 +108,4 @@ export {
108
108
  scanControllerModules,
109
109
  dispatchControllerRequest
110
110
  };
111
- //# sourceMappingURL=chunk-SL7YUHPV.js.map
111
+ //# sourceMappingURL=chunk-RJJF457I.js.map
@@ -178,7 +178,7 @@ async function agentCommand(name, message, deps = {}) {
178
178
  async function createAgentSsrLoader(projectRoot) {
179
179
  const { createServer } = await import("vite");
180
180
  const react = (await import("@vitejs/plugin-react")).default;
181
- const { theoPluginAsync } = await import("./vite-plugin-VKCT2LF2.js");
181
+ const { theoPluginAsync } = await import("./vite-plugin-USXUIV3H.js");
182
182
  const { loadConfig } = await import("./load-config-4ATXQUN3.js");
183
183
  const config = await loadConfig(projectRoot);
184
184
  const theoPlugins = await theoPluginAsync({
@@ -212,4 +212,4 @@ export {
212
212
  agentCommand,
213
213
  createAgentSsrLoader
214
214
  };
215
- //# sourceMappingURL=chunk-NZ5JU6D3.js.map
215
+ //# sourceMappingURL=chunk-URCXSUI3.js.map
package/dist/cli/index.js CHANGED
@@ -15,12 +15,12 @@ function cliVersion() {
15
15
  // src/cli/index.ts
16
16
  var cli = cac("theokit");
17
17
  cli.command("dev", "Start development server").option("--port <port>", "Port number").action(async (options) => {
18
- const { devCommand } = await import("../dev-ANDSEVLB.js");
18
+ const { devCommand } = await import("../dev-3UQVD2W6.js");
19
19
  await devCommand({ port: options.port ? Number(options.port) : void 0 });
20
20
  });
21
21
  cli.command("build", "Build for production").option("--target <target>", "Deploy target (node, vercel, cloudflare)").action(async (options) => {
22
22
  try {
23
- const { buildCommand } = await import("../build-FLX6VF7Q.js");
23
+ const { buildCommand } = await import("../build-VZODSYIQ.js");
24
24
  await buildCommand({ target: options.target });
25
25
  } catch (err) {
26
26
  const msg = err instanceof Error ? err.message : String(err);
@@ -32,7 +32,7 @@ cli.command("build", "Build for production").option("--target <target>", "Deploy
32
32
  });
33
33
  cli.command("start", "Start production server").option("--port <port>", "Port number").action(async (options) => {
34
34
  try {
35
- const { startCommand } = await import("../start-UZDMOT7I.js");
35
+ const { startCommand } = await import("../start-3K3C4Z2X.js");
36
36
  await startCommand({ port: options.port ? Number(options.port) : void 0 });
37
37
  } catch (err) {
38
38
  const msg = err instanceof Error ? err.message : String(err);
@@ -44,7 +44,7 @@ cli.command("start", "Start production server").option("--port <port>", "Port nu
44
44
  });
45
45
  cli.command("preview", "Build for production, then serve it \u2014 one step (B-030)").option("--port <port>", "Port number").option("--target <target>", "Deploy target (node, vercel, cloudflare)").action(async (options) => {
46
46
  try {
47
- const { previewCommand } = await import("../preview-GHPT2EQ5.js");
47
+ const { previewCommand } = await import("../preview-BT47VMIB.js");
48
48
  await previewCommand({
49
49
  port: options.port ? Number(options.port) : void 0,
50
50
  target: options.target
@@ -77,7 +77,7 @@ cli.command(
77
77
  "Run an agent in the terminal (stream + tool calls + approval)"
78
78
  ).action(async (name, message) => {
79
79
  try {
80
- const { agentCommand } = await import("../agent-GKUEL6OH.js");
80
+ const { agentCommand } = await import("../agent-7IPEVCAY.js");
81
81
  const { sawError } = await agentCommand(name, message);
82
82
  if (sawError) process.exit(1);
83
83
  } catch (err) {
@@ -108,7 +108,7 @@ cli.command("agent sessions gc", "Collect old transcripts for this project (dry
108
108
  });
109
109
  cli.command("mcp <agent>", "Serve an agent as an MCP server over stdio (for desktop MCP clients)").action(async (agent) => {
110
110
  try {
111
- const { mcpCommand } = await import("../mcp-5LLNAGKA.js");
111
+ const { mcpCommand } = await import("../mcp-IQRHFP3Y.js");
112
112
  await mcpCommand(agent);
113
113
  } catch (err) {
114
114
  const msg = err instanceof Error ? err.message : String(err);
@@ -11,18 +11,19 @@ import {
11
11
  } from "./chunk-KTMQUYED.js";
12
12
  import {
13
13
  theoPluginAsync
14
- } from "./chunk-OAUI273L.js";
15
- import "./chunk-JWRCZIA4.js";
14
+ } from "./chunk-KTS6G26H.js";
15
+ import "./chunk-PLUHPNGA.js";
16
16
  import "./chunk-2CVV6CNN.js";
17
17
  import "./chunk-3PWQQWT6.js";
18
18
  import "./chunk-FDOOBTXJ.js";
19
19
  import "./chunk-47MM2JUK.js";
20
- import "./chunk-C62IZEJI.js";
20
+ import "./chunk-2COPDKIG.js";
21
21
  import "./chunk-5YPXXSYY.js";
22
- import "./chunk-HWBRS4DZ.js";
22
+ import "./chunk-FMTRNQQ7.js";
23
23
  import "./chunk-RPET332G.js";
24
- import "./chunk-7PM6K5EV.js";
25
- import "./chunk-2AMLGJJA.js";
24
+ import "./chunk-H53KNS6Q.js";
25
+ import "./chunk-RARK7JBR.js";
26
+ import "./chunk-7UZZHCRN.js";
26
27
  import "./chunk-KUZVRJ7M.js";
27
28
  import "./chunk-EVZKNA2W.js";
28
29
  import "./chunk-XS7EX55U.js";
@@ -122,4 +123,4 @@ export {
122
123
  devCommand,
123
124
  startDevServer
124
125
  };
125
- //# sourceMappingURL=dev-ANDSEVLB.js.map
126
+ //# sourceMappingURL=dev-3UQVD2W6.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/commands/dev.ts"],"sourcesContent":["import react from '@vitejs/plugin-react'\nimport { createServer, type Plugin, type ViteDevServer } from 'vite'\n\nimport { loadConfig } from '../../config/load-config.js'\nimport { loadEnv } from '../../config/load-env.js'\nimport { validateProjectStructure } from '../../config/validate-structure.js'\nimport { initCacheEngineFromConfig } from '../../server/cache-bootstrap.js'\nimport { orchestrateDev } from '../../services/index.js'\nimport { theoPluginAsync } from '../../vite-plugin/index.js'\nimport { preflightNodeAndBindings } from '../preflight-node-version.js'\n\ninterface DevOptions {\n port?: number\n}\n\nexport async function startDevServer(cwd: string, options?: DevOptions): Promise<ViteDevServer> {\n // Preflight (FIRST — BEFORE anything that touches native bindings):\n // verifies Node version + native binding ABI match. Emits actionable\n // error referencing `nvm use` + `pnpm rebuild` when the dev server\n // was spawned under the wrong Node (common gotcha with `nohup env ...`\n // stripping the nvm PATH prefix).\n preflightNodeAndBindings(cwd)\n\n // Phase 1 (T1.2) — Load .env files into process.env BEFORE any module\n // reads them. Must run before loadConfig() so theo.config.ts functions\n // referencing process.env.* resolve correctly.\n loadEnv({ cwd, mode: 'development' })\n\n const config = await loadConfig(cwd)\n // #95 — pass config.appDir so the structure gate honors a custom frontend dir (e.g. apps/web).\n validateProjectStructure(cwd, config.appDir)\n\n // #352 — same engine, same config key, so `revalidateTag` behaves identically\n // under `theo dev` and `theo start`. A cache that only exists in production is\n // a cache nobody develops against.\n await initCacheEngineFromConfig(config.cache)\n\n // Wave 2 (T1.1) — spawn polyglot services BEFORE Vite. Healthcheck gates\n // readiness. Empty `services: {}` → early return (Wave 1 BC preserved).\n const orchestration = await orchestrateDev({\n cwd,\n services: config.services,\n })\n if (!orchestration.allHealthy) {\n await orchestration.stop()\n throw new Error(\n `[services] services failed healthcheck: ${orchestration.unhealthy.join(', ')}. ` +\n `Check that each declared service binds its port and responds 200 on its ` +\n `healthcheck path within 30s.`,\n )\n }\n\n // Phase 7 — legacy fs-mtime sweep removed: SDK's Agent.registry handles\n // LRU + idle eviction natively (configurable via theo.config.ts >\n // agents.registry; lazy-configured on first request).\n\n const port = options?.port ?? config.port\n // Narrow the rateLimit union: only the legacy flat shape (windowMs+max)\n // flows into the theoPlugin's RateLimitConfig parameter. The per-route\n // variant is consumed inside the api-middleware via the loaded user\n // config separately.\n const flatRateLimit =\n config.rateLimit && 'windowMs' in config.rateLimit && 'max' in config.rateLimit\n ? config.rateLimit\n : undefined\n // theoPluginAsync auto-chains @theokit/ui + @tailwindcss/vite via\n // top-level Plugin[] return (sync `theoPlugin()` factory's config()\n // hook returning {plugins:[...]} is silently dropped by Vite — see\n // commit history). Spread the result so Vite flattens them.\n let server: ViteDevServer\n try {\n const theoPlugins = await theoPluginAsync({\n root: cwd,\n rateLimit: flatRateLimit,\n ssr: config.ssr,\n // #95 — honor config `serverDir` (default \"server\") so route/action discovery scans it.\n serverDir: config.serverDir,\n // #95 follow-up — honor config `agentsDir` (default \"agents\") for the agent scan/middleware.\n agentsDir: config.agentsDir,\n // #95 follow-up — honor config `appDir` (default \"app\") for the file-based router + SSR/client entry.\n appDir: config.appDir,\n // Wave 2 (T3.1) — wire typed-client plugin when services declared.\n services: config.services,\n // T4.1 (canvas-ecosystem-refactor / ADR D6) — passthrough peer-deps\n // that plugins import dynamically (e.g., mermaid via plugin-canvas).\n viteOptimizeDeps: config.viteOptimizeDeps,\n })\n server = await createServer({\n root: cwd,\n plugins: [react(), ...theoPlugins] as Plugin[],\n server: {\n port,\n host: config.host,\n open: config.open,\n strictPort: config.strictPort,\n warmup: config.warmup ?? {\n clientFiles: ['./app/**/*.tsx', './app/**/*.ts'],\n },\n },\n logLevel: options?.port === 0 ? 'silent' : undefined,\n })\n\n await server.listen()\n } catch (err) {\n // EC-1 / try-finally pattern: if Vite create/listen fails AFTER services\n // started, stop them so we don't leak child processes.\n await orchestration.stop()\n throw err\n }\n\n // EC-1 fix: attach orchestration.stop() to the underlying HTTP server's\n // close event via Node-native API. We do NOT mutate `server.close`\n // (fragile across Vite upgrades). httpServer is `http.Server | null`.\n server.httpServer?.on('close', () => {\n void orchestration.stop()\n })\n\n return server\n}\n\nexport async function devCommand(options: DevOptions): Promise<void> {\n try {\n const cwd = process.cwd()\n const server = await startDevServer(cwd, options)\n server.printUrls()\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n console.error(`\\n ✗ ${msg}\\n`)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,SAAS,oBAAqD;AAc9D,eAAsB,eAAe,KAAa,SAA8C;AAM9F,2BAAyB,GAAG;AAK5B,UAAQ,EAAE,KAAK,MAAM,cAAc,CAAC;AAEpC,QAAM,SAAS,MAAM,WAAW,GAAG;AAEnC,2BAAyB,KAAK,OAAO,MAAM;AAK3C,QAAM,0BAA0B,OAAO,KAAK;AAI5C,QAAM,gBAAgB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M,SAAS,MAAM,eAAe,KAAK,OAAO;AAChD,WAAO,UAAU;AAAA,EACnB,SAAS,KAAK;AACZ,UAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC3D,YAAQ,MAAM;AAAA,WAAS,GAAG;AAAA,CAAI;AAC9B,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/cli/commands/dev.ts"],"sourcesContent":["import react from '@vitejs/plugin-react'\nimport { createServer, type Plugin, type ViteDevServer } from 'vite'\n\nimport { loadConfig } from '../../config/load-config.js'\nimport { loadEnv } from '../../config/load-env.js'\nimport { validateProjectStructure } from '../../config/validate-structure.js'\nimport { initCacheEngineFromConfig } from '../../server/cache-bootstrap.js'\nimport { orchestrateDev } from '../../services/index.js'\nimport { theoPluginAsync } from '../../vite-plugin/index.js'\nimport { preflightNodeAndBindings } from '../preflight-node-version.js'\n\ninterface DevOptions {\n port?: number\n}\n\nexport async function startDevServer(cwd: string, options?: DevOptions): Promise<ViteDevServer> {\n // Preflight (FIRST — BEFORE anything that touches native bindings):\n // verifies Node version + native binding ABI match. Emits actionable\n // error referencing `nvm use` + `pnpm rebuild` when the dev server\n // was spawned under the wrong Node (common gotcha with `nohup env ...`\n // stripping the nvm PATH prefix).\n preflightNodeAndBindings(cwd)\n\n // Phase 1 (T1.2) — Load .env files into process.env BEFORE any module\n // reads them. Must run before loadConfig() so theo.config.ts functions\n // referencing process.env.* resolve correctly.\n loadEnv({ cwd, mode: 'development' })\n\n const config = await loadConfig(cwd)\n // #95 — pass config.appDir so the structure gate honors a custom frontend dir (e.g. apps/web).\n validateProjectStructure(cwd, config.appDir)\n\n // #352 — same engine, same config key, so `revalidateTag` behaves identically\n // under `theo dev` and `theo start`. A cache that only exists in production is\n // a cache nobody develops against.\n await initCacheEngineFromConfig(config.cache)\n\n // Wave 2 (T1.1) — spawn polyglot services BEFORE Vite. Healthcheck gates\n // readiness. Empty `services: {}` → early return (Wave 1 BC preserved).\n const orchestration = await orchestrateDev({\n cwd,\n services: config.services,\n })\n if (!orchestration.allHealthy) {\n await orchestration.stop()\n throw new Error(\n `[services] services failed healthcheck: ${orchestration.unhealthy.join(', ')}. ` +\n `Check that each declared service binds its port and responds 200 on its ` +\n `healthcheck path within 30s.`,\n )\n }\n\n // Phase 7 — legacy fs-mtime sweep removed: SDK's Agent.registry handles\n // LRU + idle eviction natively (configurable via theo.config.ts >\n // agents.registry; lazy-configured on first request).\n\n const port = options?.port ?? config.port\n // Narrow the rateLimit union: only the legacy flat shape (windowMs+max)\n // flows into the theoPlugin's RateLimitConfig parameter. The per-route\n // variant is consumed inside the api-middleware via the loaded user\n // config separately.\n const flatRateLimit =\n config.rateLimit && 'windowMs' in config.rateLimit && 'max' in config.rateLimit\n ? config.rateLimit\n : undefined\n // theoPluginAsync auto-chains @theokit/ui + @tailwindcss/vite via\n // top-level Plugin[] return (sync `theoPlugin()` factory's config()\n // hook returning {plugins:[...]} is silently dropped by Vite — see\n // commit history). Spread the result so Vite flattens them.\n let server: ViteDevServer\n try {\n const theoPlugins = await theoPluginAsync({\n root: cwd,\n rateLimit: flatRateLimit,\n ssr: config.ssr,\n // #95 — honor config `serverDir` (default \"server\") so route/action discovery scans it.\n serverDir: config.serverDir,\n // #95 follow-up — honor config `agentsDir` (default \"agents\") for the agent scan/middleware.\n agentsDir: config.agentsDir,\n // #95 follow-up — honor config `appDir` (default \"app\") for the file-based router + SSR/client entry.\n appDir: config.appDir,\n // Wave 2 (T3.1) — wire typed-client plugin when services declared.\n services: config.services,\n // T4.1 (canvas-ecosystem-refactor / ADR D6) — passthrough peer-deps\n // that plugins import dynamically (e.g., mermaid via plugin-canvas).\n viteOptimizeDeps: config.viteOptimizeDeps,\n })\n server = await createServer({\n root: cwd,\n plugins: [react(), ...theoPlugins] as Plugin[],\n server: {\n port,\n host: config.host,\n open: config.open,\n strictPort: config.strictPort,\n warmup: config.warmup ?? {\n clientFiles: ['./app/**/*.tsx', './app/**/*.ts'],\n },\n },\n logLevel: options?.port === 0 ? 'silent' : undefined,\n })\n\n await server.listen()\n } catch (err) {\n // EC-1 / try-finally pattern: if Vite create/listen fails AFTER services\n // started, stop them so we don't leak child processes.\n await orchestration.stop()\n throw err\n }\n\n // EC-1 fix: attach orchestration.stop() to the underlying HTTP server's\n // close event via Node-native API. We do NOT mutate `server.close`\n // (fragile across Vite upgrades). httpServer is `http.Server | null`.\n server.httpServer?.on('close', () => {\n void orchestration.stop()\n })\n\n return server\n}\n\nexport async function devCommand(options: DevOptions): Promise<void> {\n try {\n const cwd = process.cwd()\n const server = await startDevServer(cwd, options)\n server.printUrls()\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n console.error(`\\n ✗ ${msg}\\n`)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,SAAS,oBAAqD;AAc9D,eAAsB,eAAe,KAAa,SAA8C;AAM9F,2BAAyB,GAAG;AAK5B,UAAQ,EAAE,KAAK,MAAM,cAAc,CAAC;AAEpC,QAAM,SAAS,MAAM,WAAW,GAAG;AAEnC,2BAAyB,KAAK,OAAO,MAAM;AAK3C,QAAM,0BAA0B,OAAO,KAAK;AAI5C,QAAM,gBAAgB,MAAM,eAAe;AAAA,IACzC;AAAA,IACA,UAAU,OAAO;AAAA,EACnB,CAAC;AACD,MAAI,CAAC,cAAc,YAAY;AAC7B,UAAM,cAAc,KAAK;AACzB,UAAM,IAAI;AAAA,MACR,2CAA2C,cAAc,UAAU,KAAK,IAAI,CAAC;AAAA,IAG/E;AAAA,EACF;AAMA,QAAM,OAAO,SAAS,QAAQ,OAAO;AAKrC,QAAM,gBACJ,OAAO,aAAa,cAAc,OAAO,aAAa,SAAS,OAAO,YAClE,OAAO,YACP;AAKN,MAAI;AACJ,MAAI;AACF,UAAM,cAAc,MAAM,gBAAgB;AAAA,MACxC,MAAM;AAAA,MACN,WAAW;AAAA,MACX,KAAK,OAAO;AAAA;AAAA,MAEZ,WAAW,OAAO;AAAA;AAAA,MAElB,WAAW,OAAO;AAAA;AAAA,MAElB,QAAQ,OAAO;AAAA;AAAA,MAEf,UAAU,OAAO;AAAA;AAAA;AAAA,MAGjB,kBAAkB,OAAO;AAAA,IAC3B,CAAC;AACD,aAAS,MAAM,aAAa;AAAA,MAC1B,MAAM;AAAA,MACN,SAAS,CAAC,MAAM,GAAG,GAAG,WAAW;AAAA,MACjC,QAAQ;AAAA,QACN;AAAA,QACA,MAAM,OAAO;AAAA,QACb,MAAM,OAAO;AAAA,QACb,YAAY,OAAO;AAAA,QACnB,QAAQ,OAAO,UAAU;AAAA,UACvB,aAAa,CAAC,kBAAkB,eAAe;AAAA,QACjD;AAAA,MACF;AAAA,MACA,UAAU,SAAS,SAAS,IAAI,WAAW;AAAA,IAC7C,CAAC;AAED,UAAM,OAAO,OAAO;AAAA,EACtB,SAAS,KAAK;AAGZ,UAAM,cAAc,KAAK;AACzB,UAAM;AAAA,EACR;AAKA,SAAO,YAAY,GAAG,SAAS,MAAM;AACnC,SAAK,cAAc,KAAK;AAAA,EAC1B,CAAC;AAED,SAAO;AACT;AAEA,eAAsB,WAAW,SAAoC;AACnE,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,UAAM,SAAS,MAAM,eAAe,KAAK,OAAO;AAChD,WAAO,UAAU;AAAA,EACnB,SAAS,KAAK;AACZ,UAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC3D,YAAQ,MAAM;AAAA,WAAS,GAAG;AAAA,CAAI;AAC9B,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
@@ -856,7 +856,7 @@ interface UploadedFile {
856
856
  size: number;
857
857
  }
858
858
  interface ParsedBody {
859
- fields: Record<string, string>;
859
+ fields: Record<string, string | string[]>;
860
860
  files: UploadedFile[];
861
861
  json?: unknown;
862
862
  }
package/dist/index.d.ts CHANGED
@@ -53,8 +53,8 @@ declare const theoConfigSchema: z.ZodObject<{
53
53
  unhandledErrors: z.ZodOptional<z.ZodBoolean>;
54
54
  logLevels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
55
55
  error: "error";
56
- info: "info";
57
56
  warn: "warn";
57
+ info: "info";
58
58
  debug: "debug";
59
59
  log: "log";
60
60
  }>>>;
@@ -93,24 +93,24 @@ declare const theoConfigSchema: z.ZodObject<{
93
93
  logging: z.ZodOptional<z.ZodObject<{
94
94
  level: z.ZodDefault<z.ZodEnum<{
95
95
  error: "error";
96
- info: "info";
97
96
  warn: "warn";
97
+ info: "info";
98
98
  debug: "debug";
99
99
  silent: "silent";
100
100
  }>>;
101
101
  }, z.core.$strip>>;
102
102
  security: z.ZodOptional<z.ZodObject<{
103
103
  csrf: z.ZodDefault<z.ZodEnum<{
104
- warn: "warn";
105
104
  off: "off";
105
+ warn: "warn";
106
106
  strict: "strict";
107
107
  }>>;
108
108
  headers: z.ZodOptional<z.ZodObject<{
109
109
  csp: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
110
110
  cspMode: z.ZodDefault<z.ZodEnum<{
111
+ off: "off";
111
112
  enforce: "enforce";
112
113
  "report-only": "report-only";
113
- off: "off";
114
114
  }>>;
115
115
  hsts: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
116
116
  frameOptions: z.ZodDefault<z.ZodEnum<{
package/dist/index.js CHANGED
@@ -8,19 +8,20 @@ import {
8
8
  scanRoutes,
9
9
  theoConfigSchema,
10
10
  theoPlugin
11
- } from "./chunk-JIKNR5LX.js";
11
+ } from "./chunk-7AEBH52I.js";
12
12
  import "./chunk-VQPHPQ5L.js";
13
13
  import "./chunk-SSYDEKWF.js";
14
- import "./chunk-SL7YUHPV.js";
14
+ import "./chunk-RJJF457I.js";
15
15
  import "./chunk-OIGJOYX6.js";
16
- import "./chunk-WOBSEO75.js";
16
+ import "./chunk-KOS567NB.js";
17
17
  import "./chunk-4X6H2BXP.js";
18
18
  import "./chunk-OGLS76RN.js";
19
- import "./chunk-RWNYIU6A.js";
19
+ import "./chunk-JKF25N73.js";
20
20
  import "./chunk-47FFT43U.js";
21
21
  import "./chunk-NTDN54XO.js";
22
- import "./chunk-MCTC6HSE.js";
23
- import "./chunk-72DMJBXI.js";
22
+ import "./chunk-PF3YM6NY.js";
23
+ import "./chunk-DOI4G4X3.js";
24
+ import "./chunk-CHTAWXC2.js";
24
25
  import "./chunk-VSLTKX5L.js";
25
26
  import "./chunk-TNI4MARH.js";
26
27
  import "./chunk-OQCRCXCP.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config/define-config.ts","../src/config/config-builder.ts","../src/config/validate-structure.ts","../src/core/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,SAAS,aAAaA,SAAkD;AAC7E,SAAOA;AACT;;;ACiCA,SAAS,kBAAkB,MAA0C;AACnE,QAAM,QAAQ,CAAC,UACb,kBAAkB,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;AACzC,SAAO;AAAA,IACL,MAAM,CAAC,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,IACtC,WAAW,CAAC,UAAU,MAAM,EAAE,WAAW,MAAM,CAAC;AAAA,IAChD,QAAQ,CAAC,UAAU,MAAM,EAAE,QAAQ,MAAM,CAAC;AAAA,IAC1C,WAAW,CAAC,UAAU,MAAM,EAAE,WAAW,MAAM,CAAC;AAAA,IAChD,SAAS,CAAC,UAAU,MAAM,EAAE,SAAS,MAAM,CAAC;AAAA,IAC5C,MAAM,CAAC,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,IACtC,MAAM,CAAC,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,IACtC,KAAK,CAAC,UAAU,MAAM,EAAE,KAAK,MAAM,CAAC;AAAA,IACpC,KAAK,CAAC,YAAY,MAAM,OAAO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ACrB,UAAM,IAAI,iBAAiB,QAAQ,OAAO;AAAA,EAC5C;AACF;","names":["config"]}
1
+ {"version":3,"sources":["../src/config/define-config.ts","../src/config/config-builder.ts","../src/config/validate-structure.ts","../src/core/errors.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,SAAS,aAAaA,SAAkD;AAC7E,SAAOA;AACT;;;ACiCA,SAAS,kBAAkB,MAA0C;AACnE,QAAM,QAAQ,CAAC,UACb,kBAAkB,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;AACzC,SAAO;AAAA,IACL,MAAM,CAAC,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,IACtC,WAAW,CAAC,UAAU,MAAM,EAAE,WAAW,MAAM,CAAC;AAAA,IAChD,QAAQ,CAAC,UAAU,MAAM,EAAE,QAAQ,MAAM,CAAC;AAAA,IAC1C,WAAW,CAAC,UAAU,MAAM,EAAE,WAAW,MAAM,CAAC;AAAA,IAChD,SAAS,CAAC,UAAU,MAAM,EAAE,SAAS,MAAM,CAAC;AAAA,IAC5C,MAAM,CAAC,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,IACtC,MAAM,CAAC,UAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,IACtC,KAAK,CAAC,UAAU,MAAM,EAAE,KAAK,MAAM,CAAC;AAAA,IACpC,KAAK,CAAC,YAAY,MAAM,OAAO;AAAA,IAC/B,OAAO,MAAM,aAAa,IAAI;AAAA,EAChC;AACF;AAKO,SAAS,SAAwB;AACtC,SAAO,kBAAkB,CAAC,CAAC;AAC7B;;;AC5DA,SAAS,kBAAkB;AAC3B,SAAS,YAAY;;;ACLd,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1B;AAAA,EACA;AAAA,EAEhB,YAAY,QAAkB,SAAiB;AAC7C,UAAM,aAAa,OAAO,IAAI,CAAC,MAAM,OAAO,CAAC,EAAE,EAAE,KAAK,IAAI;AAE1D;AAAA,MACE;AAAA;AAAA,UACa,OAAO;AAAA;AAAA,KACjB,aAAa;AAAA,EAAc,UAAU;AAAA,IAAO;AAAA,IACjD;AAEA,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,UAAU;AAAA,EACjB;AACF;;;ADHA,IAAM,iBAAmC;AAAA,EACvC;AAAA,IACE,MAAM;AAAA,IACN,cAAc;AAAA,EAChB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,cAAc;AAAA,EAChB;AACF;AAIO,SAAS,yBAAyB,SAAiB,SAAS,OAAa;AAC9E,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,UAAM,IAAI,iBAAiB,CAAC,qCAAqC,OAAO,EAAE,GAAG,OAAO;AAAA,EACtF;AAEA,QAAM,SAAmB,CAAC;AAE1B,QAAM,eAAiC;AAAA,IACrC,EAAE,MAAM,QAAQ,cAAc,+BAA+B,MAAM,IAAI;AAAA,EACzE;AAEA,aAAW,QAAQ,cAAc;AAC/B,QAAI,CAAC,WAAW,KAAK,SAAS,KAAK,IAAI,CAAC,GAAG;AACzC,aAAO,KAAK,KAAK,YAAY;AAAA,IAC/B;AAAA,EACF;AAEA,aAAW,QAAQ,gBAAgB;AACjC,QAAI,CAAC,WAAW,KAAK,SAAS,KAAK,IAAI,CAAC,GAAG;AACzC,aAAO,KAAK,KAAK,YAAY;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,GAAG;AACrB,UAAM,IAAI,iBAAiB,QAAQ,OAAO;AAAA,EAC5C;AACF;","names":["config"]}
@@ -16,7 +16,7 @@ import {
16
16
  handleCspReport,
17
17
  handleCsrfReadiness,
18
18
  mountAgent
19
- } from "./chunk-C62IZEJI.js";
19
+ } from "./chunk-2COPDKIG.js";
20
20
  import {
21
21
  resolveProvider
22
22
  } from "./chunk-5YPXXSYY.js";
@@ -24,17 +24,18 @@ import {
24
24
  dispatchControllerRequest,
25
25
  incomingMessageToHandlerRequest,
26
26
  sendError
27
- } from "./chunk-HWBRS4DZ.js";
27
+ } from "./chunk-FMTRNQQ7.js";
28
28
  import {
29
29
  generateNonce
30
30
  } from "./chunk-RPET332G.js";
31
31
  import {
32
32
  TRACE_HEADER,
33
33
  extractTraceId
34
- } from "./chunk-7PM6K5EV.js";
34
+ } from "./chunk-H53KNS6Q.js";
35
35
  import {
36
36
  logRequest
37
- } from "./chunk-2AMLGJJA.js";
37
+ } from "./chunk-RARK7JBR.js";
38
+ import "./chunk-7UZZHCRN.js";
38
39
  import {
39
40
  generateManifest
40
41
  } from "./chunk-KUZVRJ7M.js";
@@ -86,4 +87,4 @@ export {
86
87
  scanWebSocketRoutes,
87
88
  sendError
88
89
  };
89
- //# sourceMappingURL=internal-api-IP35YU3G.js.map
90
+ //# sourceMappingURL=internal-api-4X6NDS2F.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  dispatchControllerRequest
3
- } from "./chunk-SL7YUHPV.js";
3
+ } from "./chunk-RJJF457I.js";
4
4
  import {
5
5
  mountAgent
6
- } from "./chunk-WOBSEO75.js";
6
+ } from "./chunk-KOS567NB.js";
7
7
  import {
8
8
  BATCH_PATH,
9
9
  createCorsHandler,
@@ -12,17 +12,18 @@ import {
12
12
  handleBatchRequest,
13
13
  incomingMessageToHandlerRequest,
14
14
  sendError
15
- } from "./chunk-RWNYIU6A.js";
15
+ } from "./chunk-JKF25N73.js";
16
16
  import "./chunk-47FFT43U.js";
17
17
  import {
18
18
  findSuggestion
19
19
  } from "./chunk-NTDN54XO.js";
20
- import "./chunk-MCTC6HSE.js";
20
+ import "./chunk-PF3YM6NY.js";
21
21
  import {
22
22
  TRACE_HEADER,
23
23
  extractTraceId,
24
24
  logRequest
25
- } from "./chunk-72DMJBXI.js";
25
+ } from "./chunk-DOI4G4X3.js";
26
+ import "./chunk-CHTAWXC2.js";
26
27
  import {
27
28
  createPluginRunnerFromConfig
28
29
  } from "./chunk-VSLTKX5L.js";
@@ -105,4 +106,4 @@ export {
105
106
  scanWebSocketRoutes,
106
107
  sendError
107
108
  };
108
- //# sourceMappingURL=internal-api-OPU456AT.js.map
109
+ //# sourceMappingURL=internal-api-XQHU5JKY.js.map
@@ -2,7 +2,7 @@
2
2
  import "tsx/esm";
3
3
  import {
4
4
  createAgentSsrLoader
5
- } from "./chunk-NZ5JU6D3.js";
5
+ } from "./chunk-URCXSUI3.js";
6
6
  import {
7
7
  extractAppResources,
8
8
  handleMcpJsonRpc
@@ -75,4 +75,4 @@ async function mcpCommand(name, deps = {}) {
75
75
  export {
76
76
  mcpCommand
77
77
  };
78
- //# sourceMappingURL=mcp-5LLNAGKA.js.map
78
+ //# sourceMappingURL=mcp-IQRHFP3Y.js.map
@@ -4,12 +4,13 @@ import {
4
4
  _resetObservabilityAdapter,
5
5
  createObservabilityPluginFromConfig,
6
6
  getObservabilityAdapter
7
- } from "./chunk-7PM6K5EV.js";
8
- import "./chunk-2AMLGJJA.js";
7
+ } from "./chunk-H53KNS6Q.js";
8
+ import "./chunk-RARK7JBR.js";
9
+ import "./chunk-7UZZHCRN.js";
9
10
  import "./chunk-VI7ZANB3.js";
10
11
  export {
11
12
  _resetObservabilityAdapter,
12
13
  createObservabilityPluginFromConfig,
13
14
  getObservabilityAdapter
14
15
  };
15
- //# sourceMappingURL=observability-bootstrap-MZMSOE66.js.map
16
+ //# sourceMappingURL=observability-bootstrap-LERYDHKY.js.map
@@ -4,8 +4,8 @@ import "tsx/esm";
4
4
  // src/cli/commands/preview.ts
5
5
  async function defaultSteps() {
6
6
  const [{ buildCommand }, { startCommand }] = await Promise.all([
7
- import("./build-FLX6VF7Q.js"),
8
- import("./start-UZDMOT7I.js")
7
+ import("./build-VZODSYIQ.js"),
8
+ import("./start-3K3C4Z2X.js")
9
9
  ]);
10
10
  return {
11
11
  build: (opts) => buildCommand(opts),
@@ -20,4 +20,4 @@ async function previewCommand(options = {}, steps) {
20
20
  export {
21
21
  previewCommand
22
22
  };
23
- //# sourceMappingURL=preview-GHPT2EQ5.js.map
23
+ //# sourceMappingURL=preview-BT47VMIB.js.map
@@ -1,4 +1,4 @@
1
- export { A as ActionError, b as ActionInputError, B as BATCH_PATH, e as BatchExecuteFn, f as BatchPathConflictError, g as BatchPayload, h as BatchRequestItem, i as BatchResponse, j as BatchResultItem, C as CookieOptions, l as CorsConfig, m as CorsHandler, n as CorsOrigin, o as CorsWebHandler, p as CustomErrorPages, E as ExecuteActionOptions, q as ExecuteRouteContext, F as FileTooLargeError, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, r as MiddlewareResult, N as NotFoundError, t as ProcedureInputError, u as ProcedureOutputError, S as STRIPPED_HEADERS, y as SendErrorInput, z as SendErrorOptions, T as TRACE_HEADER, G as TRACE_PARENT_HEADER, I as TheoError, W as W3CTraceContext, _ as _resetMiddlewareCacheForTests, L as appendCookieToHeaders, Q as appendDeleteCookieToHeaders, V as callProcedure, X as createCorsHandler, Y as createCorsWebHandler, Z as createOpenApiHandler, $ as createServerContext, a0 as deleteCookie, a1 as envelopeCodeToStatus, a2 as executeAction, a3 as executeRoute, a4 as executeWebRequest, a5 as extractTraceId, a6 as extractTraceIdFromRequest, a7 as extractUniversalIssues, a8 as extractW3CTraceContext, a9 as fromUnknown, aa as getCookie, ab as getCookieFromRequest, ac as handleBatchRequest, ad as handleRequestError, ae as handleWebRequestError, af as isActionError, ag as isInputError, ah as jsonTransformer, ai as loadCustomErrorPages, aj as matchesOrigin, ak as parseCookieHeader, al as parseRequestBody, am as parseTraceparent, an as parseTraceparentContext, ao as resolveTransformer, ap as runMiddlewareAndContext, aq as sendError, ar as sendJson, as as serializeCookie, at as serveStaticFile, au as serverErrorToEnvelope, av as setCookie, aw as superjsonTransformer, ax as validateRouteInput } from '../../index-CzxtQcnp.js';
1
+ export { A as ActionError, b as ActionInputError, B as BATCH_PATH, e as BatchExecuteFn, f as BatchPathConflictError, g as BatchPayload, h as BatchRequestItem, i as BatchResponse, j as BatchResultItem, C as CookieOptions, l as CorsConfig, m as CorsHandler, n as CorsOrigin, o as CorsWebHandler, p as CustomErrorPages, E as ExecuteActionOptions, q as ExecuteRouteContext, F as FileTooLargeError, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, r as MiddlewareResult, N as NotFoundError, t as ProcedureInputError, u as ProcedureOutputError, S as STRIPPED_HEADERS, y as SendErrorInput, z as SendErrorOptions, T as TRACE_HEADER, G as TRACE_PARENT_HEADER, I as TheoError, W as W3CTraceContext, _ as _resetMiddlewareCacheForTests, L as appendCookieToHeaders, Q as appendDeleteCookieToHeaders, V as callProcedure, X as createCorsHandler, Y as createCorsWebHandler, Z as createOpenApiHandler, $ as createServerContext, a0 as deleteCookie, a1 as envelopeCodeToStatus, a2 as executeAction, a3 as executeRoute, a4 as executeWebRequest, a5 as extractTraceId, a6 as extractTraceIdFromRequest, a7 as extractUniversalIssues, a8 as extractW3CTraceContext, a9 as fromUnknown, aa as getCookie, ab as getCookieFromRequest, ac as handleBatchRequest, ad as handleRequestError, ae as handleWebRequestError, af as isActionError, ag as isInputError, ah as jsonTransformer, ai as loadCustomErrorPages, aj as matchesOrigin, ak as parseCookieHeader, al as parseRequestBody, am as parseTraceparent, an as parseTraceparentContext, ao as resolveTransformer, ap as runMiddlewareAndContext, aq as sendError, ar as sendJson, as as serializeCookie, at as serveStaticFile, au as serverErrorToEnvelope, av as setCookie, aw as superjsonTransformer, ax as validateRouteInput } from '../../index-DctfHtv-.js';
2
2
  import '../../error-envelope-DG47lt8E.js';
3
3
  import 'node:http';
4
4
  import '../../plugin-types-BUVfUQ0V.js';
@@ -6,7 +6,7 @@ import {
6
6
  createOpenApiHandler,
7
7
  loadCustomErrorPages,
8
8
  serveStaticFile
9
- } from "../../chunk-ULDCFL2O.js";
9
+ } from "../../chunk-N42ZWWOW.js";
10
10
  import {
11
11
  jsonTransformer,
12
12
  resolveTransformer,
@@ -36,7 +36,7 @@ import {
36
36
  sendError,
37
37
  sendJson,
38
38
  validateRouteInput
39
- } from "../../chunk-RWNYIU6A.js";
39
+ } from "../../chunk-JKF25N73.js";
40
40
  import "../../chunk-47FFT43U.js";
41
41
  import {
42
42
  FileTooLargeError,
@@ -48,7 +48,8 @@ import {
48
48
  parseRequestBody,
49
49
  parseTraceparent,
50
50
  parseTraceparentContext
51
- } from "../../chunk-72DMJBXI.js";
51
+ } from "../../chunk-DOI4G4X3.js";
52
+ import "../../chunk-CHTAWXC2.js";
52
53
  import "../../chunk-BX6EUYHU.js";
53
54
  import "../../chunk-P6OS7652.js";
54
55
  import "../../chunk-AVQU5CQF.js";
@@ -4,7 +4,7 @@ export { W as WebSocketHandler, a as WebSocketHandlerWeb, b as WebSocketLike } f
4
4
  export { C as CustomTool, D as DefineAgentToolSpec, T as ToolContextMessage, a as ToolHandlerContext, b as ToolTransform, c as applyTransform } from '../define-agent-tool-cRuSpidb.js';
5
5
  export { A as AccessDecision, R as RoutePolicy, b as RoutePolicyInput, a as RouteSubject, e as evaluateRoutePolicy, r as requireOwner, s as subjectFromContext } from '../route-policy-BxOycCDq.js';
6
6
  export { H as HEALTH_PATH, a as HealthRouteConfig, b as READY_PATH, c as ReadyRouteConfig, d as ReservedResponse, R as ReservedRoutes, e as defineHealthRoute, f as defineReadyRoute, s as serveReservedRoute } from '../health-route-C0hk64_U.js';
7
- export { A as ActionError, a as ActionErrorCode, b as ActionInputError, c as ActionManifestEntry, d as ActionResult, B as BATCH_PATH, e as BatchExecuteFn, f as BatchPathConflictError, g as BatchPayload, h as BatchRequestItem, i as BatchResponse, j as BatchResultItem, k as BodyParserOptions, C as CookieOptions, l as CorsConfig, m as CorsHandler, n as CorsOrigin, o as CorsWebHandler, p as CustomErrorPages, E as ExecuteActionOptions, q as ExecuteRouteContext, F as FileTooLargeError, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, r as MiddlewareResult, N as NotFoundError, O as OpenApiDocsOptions, P as ParsedBody, s as ProcedureInput, t as ProcedureInputError, u as ProcedureOutputError, R as RawRouteInput, v as RouteInputChannel, w as RouteInputSchemas, x as RouteInputValidation, S as STRIPPED_HEADERS, y as SendErrorInput, z as SendErrorOptions, D as SerializedActionResult, T as TRACE_HEADER, G as TRACE_PARENT_HEADER, I as TheoError, J as TheoTransformer, U as UniversalZodIssue, K as UploadedFile, W as W3CTraceContext, _ as _resetMiddlewareCacheForTests, L as appendCookieToHeaders, Q as appendDeleteCookieToHeaders, V as callProcedure, X as createCorsHandler, Y as createCorsWebHandler, Z as createOpenApiHandler, $ as createServerContext, a0 as deleteCookie, a1 as envelopeCodeToStatus, a2 as executeAction, a3 as executeRoute, a4 as executeWebRequest, a5 as extractTraceId, a6 as extractTraceIdFromRequest, a7 as extractUniversalIssues, a8 as extractW3CTraceContext, a9 as fromUnknown, aa as getCookie, ab as getCookieFromRequest, ac as handleBatchRequest, ad as handleRequestError, ae as handleWebRequestError, af as isActionError, ag as isInputError, ah as jsonTransformer, ai as loadCustomErrorPages, aj as matchesOrigin, ak as parseCookieHeader, al as parseRequestBody, am as parseTraceparent, an as parseTraceparentContext, ao as resolveTransformer, ap as runMiddlewareAndContext, aq as sendError, ar as sendJson, as as serializeCookie, at as serveStaticFile, au as serverErrorToEnvelope, av as setCookie, aw as superjsonTransformer, ax as validateRouteInput } from '../index-CzxtQcnp.js';
7
+ export { A as ActionError, a as ActionErrorCode, b as ActionInputError, c as ActionManifestEntry, d as ActionResult, B as BATCH_PATH, e as BatchExecuteFn, f as BatchPathConflictError, g as BatchPayload, h as BatchRequestItem, i as BatchResponse, j as BatchResultItem, k as BodyParserOptions, C as CookieOptions, l as CorsConfig, m as CorsHandler, n as CorsOrigin, o as CorsWebHandler, p as CustomErrorPages, E as ExecuteActionOptions, q as ExecuteRouteContext, F as FileTooLargeError, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, r as MiddlewareResult, N as NotFoundError, O as OpenApiDocsOptions, P as ParsedBody, s as ProcedureInput, t as ProcedureInputError, u as ProcedureOutputError, R as RawRouteInput, v as RouteInputChannel, w as RouteInputSchemas, x as RouteInputValidation, S as STRIPPED_HEADERS, y as SendErrorInput, z as SendErrorOptions, D as SerializedActionResult, T as TRACE_HEADER, G as TRACE_PARENT_HEADER, I as TheoError, J as TheoTransformer, U as UniversalZodIssue, K as UploadedFile, W as W3CTraceContext, _ as _resetMiddlewareCacheForTests, L as appendCookieToHeaders, Q as appendDeleteCookieToHeaders, V as callProcedure, X as createCorsHandler, Y as createCorsWebHandler, Z as createOpenApiHandler, $ as createServerContext, a0 as deleteCookie, a1 as envelopeCodeToStatus, a2 as executeAction, a3 as executeRoute, a4 as executeWebRequest, a5 as extractTraceId, a6 as extractTraceIdFromRequest, a7 as extractUniversalIssues, a8 as extractW3CTraceContext, a9 as fromUnknown, aa as getCookie, ab as getCookieFromRequest, ac as handleBatchRequest, ad as handleRequestError, ae as handleWebRequestError, af as isActionError, ag as isInputError, ah as jsonTransformer, ai as loadCustomErrorPages, aj as matchesOrigin, ak as parseCookieHeader, al as parseRequestBody, am as parseTraceparent, an as parseTraceparentContext, ao as resolveTransformer, ap as runMiddlewareAndContext, aq as sendError, ar as sendJson, as as serializeCookie, at as serveStaticFile, au as serverErrorToEnvelope, av as setCookie, aw as superjsonTransformer, ax as validateRouteInput } from '../index-DctfHtv-.js';
8
8
  export { ACTION_SCHEMAS_DIR, ActionNode, ActionScanError, LoadedManifest, ManifestAction, ManifestAgent, ManifestRoute, ManifestWebSocket, TheoManifest, WebSocketRouteNode, _resetRouteScanCacheForTests, compareRouteSpecificity, generateManifest, loadManifest, scanMiddlewares, scanServerActions, scanServerActionsEnriched, scanServerRoutes, scanWebSocketRoutes, writeManifest } from './scan/index.js';
9
9
  export { L as LoadModule, S as ServerRouteNode, c as compilePattern, a as createProductionLoader, b as createViteLoader, m as matchRoute } from '../match-DmGgxjIU.js';
10
10
  export { AcpToolConfig, AppResource, AppResourceInput, ChannelMessage, ChannelWebhookConfig, CodeModeApi, CodeModeConfig, CodeModePermission, CodeModePermissionDeniedError, McpResourceContents, McpResourceDescriptor, NodeAcpTransport, Sandbox, StdioStreams, VendorAgentClient, VendorAgentToolConfig, WorkflowLike, WorkflowToolConfig, buildResourceDescriptors, createACPTool, createCodeMode, createVendorAgentTool, createWorkflowTool, defineAppResource, extractAppResources, handleChannelWebhook, handleMcpStdioLine, isChannelPath, parseChannelPath, readAppResource, serveMcpStdio } from './agent/index.js';
@@ -25,7 +25,7 @@ import {
25
25
  createOpenApiHandler,
26
26
  loadCustomErrorPages,
27
27
  serveStaticFile
28
- } from "../chunk-ULDCFL2O.js";
28
+ } from "../chunk-N42ZWWOW.js";
29
29
  import {
30
30
  DuplicateJobNameError,
31
31
  InMemoryJobBackend,
@@ -91,7 +91,7 @@ import {
91
91
  sendError,
92
92
  sendJson,
93
93
  validateRouteInput
94
- } from "../chunk-RWNYIU6A.js";
94
+ } from "../chunk-JKF25N73.js";
95
95
  import {
96
96
  DuplicateContextKeyError,
97
97
  createOutbox,
@@ -111,7 +111,7 @@ import {
111
111
  createObservabilityPlugin,
112
112
  resolveAdapter,
113
113
  serializeSpansToOtlp
114
- } from "../chunk-MCTC6HSE.js";
114
+ } from "../chunk-PF3YM6NY.js";
115
115
  import {
116
116
  FileTooLargeError,
117
117
  TRACE_HEADER,
@@ -126,7 +126,8 @@ import {
126
126
  parseTraceparent,
127
127
  parseTraceparentContext,
128
128
  warnOnce
129
- } from "../chunk-72DMJBXI.js";
129
+ } from "../chunk-DOI4G4X3.js";
130
+ import "../chunk-CHTAWXC2.js";
130
131
  import {
131
132
  DuplicateDecorationError,
132
133
  DuplicatePluginError,