theokit 0.71.0 → 0.72.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.
- package/dist/{actions-virtual-module-2SM6YMTM.js → actions-virtual-module-EAKYEMGF.js} +4 -4
- package/dist/{actions-virtual-module-5LRBP6YK.js → actions-virtual-module-OHENNMQG.js} +6 -6
- package/dist/adapters/agent-mount.js +3 -3
- package/dist/{agent-4FXJXZFD.js → agent-VJTZ4DQ7.js} +2 -2
- package/dist/{app-typed-client-LIIPHLO6.js → app-typed-client-ILLQYTXP.js} +6 -6
- package/dist/{app-typed-client-JFPV4YLS.js → app-typed-client-LHH77QDB.js} +4 -4
- package/dist/{aws-lambda-MUGK4WNZ.js → aws-lambda-7AZNJGWU.js} +6 -4
- package/dist/{aws-lambda-MUGK4WNZ.js.map → aws-lambda-7AZNJGWU.js.map} +1 -1
- package/dist/{build-KCIH3HI6.js → build-23QF5FNQ.js} +7 -7
- package/dist/build-23QF5FNQ.js.map +1 -0
- package/dist/{bun-JWZ2UOLJ.js → bun-NKVHOFSJ.js} +6 -4
- package/dist/{bun-JWZ2UOLJ.js.map → bun-NKVHOFSJ.js.map} +1 -1
- package/dist/{chunk-KOG5K26V.js → chunk-2Z7TANA4.js} +2 -2
- package/dist/{chunk-V6VARIR3.js → chunk-4EQEJ4PH.js} +9 -9
- package/dist/{chunk-3NAKOWTX.js → chunk-6U67SO5U.js} +3 -3
- package/dist/{chunk-IGCOTLQI.js → chunk-C5CAL3DX.js} +136 -5
- package/dist/{chunk-IGCOTLQI.js.map → chunk-C5CAL3DX.js.map} +1 -1
- package/dist/{chunk-YWWMYEAC.js → chunk-CLSYYO5F.js} +2 -2
- package/dist/{chunk-OSBGZYXZ.js → chunk-D2R5SJEL.js} +16 -2
- package/dist/chunk-D2R5SJEL.js.map +1 -0
- package/dist/{chunk-JMN4COMK.js → chunk-D7STTNQN.js} +3 -3
- package/dist/{chunk-DSPEN7ZJ.js → chunk-DKX7LF5Q.js} +4 -4
- package/dist/{chunk-5XXXJ6DT.js → chunk-E2RC367T.js} +47 -8
- package/dist/chunk-E2RC367T.js.map +1 -0
- package/dist/{chunk-3DGIANAN.js → chunk-FJEKQ4FT.js} +1 -1
- package/dist/{chunk-3DGIANAN.js.map → chunk-FJEKQ4FT.js.map} +1 -1
- package/dist/{chunk-KI4DOTN4.js → chunk-G7U7FQVC.js} +3 -1
- package/dist/chunk-G7U7FQVC.js.map +1 -0
- package/dist/{chunk-6AGXDYVE.js → chunk-IB5VIXLR.js} +2 -2
- package/dist/{chunk-Q4NSUGMS.js → chunk-JJXBRY2U.js} +74 -6
- package/dist/chunk-JJXBRY2U.js.map +1 -0
- package/dist/{chunk-PGDBSK2L.js → chunk-L6UHMWXU.js} +2 -2
- package/dist/{chunk-MS4A7N77.js → chunk-PEL3MJLM.js} +2 -2
- package/dist/{chunk-TNI4MARH.js → chunk-SFGGRC35.js} +23 -6
- package/dist/chunk-SFGGRC35.js.map +1 -0
- package/dist/{chunk-4D4YVXHR.js → chunk-SYIQV4UH.js} +29 -2
- package/dist/{chunk-4D4YVXHR.js.map → chunk-SYIQV4UH.js.map} +1 -1
- package/dist/{chunk-FFS7IRZF.js → chunk-SZWGXHY3.js} +2 -2
- package/dist/{chunk-SX7ZAHNE.js → chunk-WBB3MEEN.js} +16 -2
- package/dist/chunk-WBB3MEEN.js.map +1 -0
- package/dist/{chunk-TMQ52AZR.js → chunk-X2LFNDJQ.js} +2 -2
- package/dist/{chunk-FWEXQ2BR.js → chunk-XLSJWKSP.js} +11 -11
- package/dist/{chunk-NZDGV4YJ.js → chunk-YCF3N4JS.js} +2 -2
- package/dist/cli/index.js +9 -9
- package/dist/{cloudflare-XO43ZIQF.js → cloudflare-4M4XVNUH.js} +5 -3
- package/dist/{cloudflare-XO43ZIQF.js.map → cloudflare-4M4XVNUH.js.map} +1 -1
- package/dist/{config-support-O4REYSK5.js → config-support-SB5NDQZB.js} +11 -5
- package/dist/{config-support-O4REYSK5.js.map → config-support-SB5NDQZB.js.map} +1 -1
- package/dist/{deno-deploy-EUQDK2RC.js → deno-deploy-IVACZ62D.js} +11 -5
- package/dist/deno-deploy-IVACZ62D.js.map +1 -0
- package/dist/{dev-CD4YU5FN.js → dev-JDJWMRLH.js} +9 -9
- package/dist/{index-inRdhi59.d.ts → index-CmkWlIDO.d.ts} +3 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +7 -7
- package/dist/{info-2H7I55YN.js → info-SUX7QVA3.js} +4 -4
- package/dist/{internal-api-TMLSNYMP.js → internal-api-6XNLCNI5.js} +6 -6
- package/dist/{internal-api-WAKX6AZW.js → internal-api-VDYOXOT7.js} +4 -4
- package/dist/{load-config-VMKOV44Y.js → load-config-52H3EKAA.js} +4 -4
- package/dist/{mcp-HS26ZCU4.js → mcp-WJNCTM7M.js} +3 -3
- package/dist/{netlify-LEYEQZK6.js → netlify-3HEWV375.js} +6 -4
- package/dist/{netlify-LEYEQZK6.js.map → netlify-3HEWV375.js.map} +1 -1
- package/dist/{node-OSVPYQ3D.js → node-QUGTW6XV.js} +2 -2
- package/dist/{observability-bootstrap-YQKMEYW7.js → observability-bootstrap-FP6LMMJE.js} +3 -3
- package/dist/{openapi-N4CXRUNT.js → openapi-Q53YOBIU.js} +4 -4
- package/dist/{preview-YDJSRJ2K.js → preview-BARW75PN.js} +3 -3
- package/dist/{rate-limit-BdNDZ3vt.d.ts → rate-limit-fULgvzCz.d.ts} +11 -1
- package/dist/{rate-limit-store-BEJnhWdw.d.ts → rate-limit-store-n1wD4Yk4.d.ts} +48 -1
- package/dist/registry-SDBODRU6.js +23 -0
- package/dist/{routes-ECCDRHXZ.js → routes-FDF4SLOB.js} +4 -4
- package/dist/{schema-ND7GHPQK.js → schema-LHNWUR4V.js} +3 -3
- package/dist/{schemas-QCMSKQDK.js → schemas-2R2J64ZH.js} +2 -2
- package/dist/server/auth/index.d.ts +1 -1
- package/dist/server/http/index.d.ts +1 -1
- package/dist/server/http/index.js +5 -3
- package/dist/server/index.d.ts +4 -4
- package/dist/server/index.js +15 -7
- package/dist/server/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +96 -14
- package/dist/server/rate-limit/index.js +10 -4
- package/dist/server/storage/index.js +1 -1
- package/dist/{server-boundary-RX2AFU5U.js → server-boundary-AO6EELRF.js} +4 -4
- package/dist/{server-boundary-NZPP33G6.js → server-boundary-E5GFVPLB.js} +6 -6
- package/dist/{start-TYXS5I4M.js → start-4JTYXQQJ.js} +14 -11
- package/dist/start-4JTYXQQJ.js.map +1 -0
- package/dist/{static-7OJNB7D2.js → static-NQPLPAB6.js} +6 -2
- package/dist/{static-7OJNB7D2.js.map → static-NQPLPAB6.js.map} +1 -1
- package/dist/{theo-cloud-3ET4G5T6.js → theo-cloud-HMFNZ3FS.js} +3 -1
- package/dist/{theo-cloud-3ET4G5T6.js.map → theo-cloud-HMFNZ3FS.js.map} +1 -1
- package/dist/{vercel-HTAWCNAG.js → vercel-5PMYEEKF.js} +6 -4
- package/dist/{vercel-HTAWCNAG.js.map → vercel-5PMYEEKF.js.map} +1 -1
- package/dist/vite-plugin/index.d.ts +2 -2
- package/dist/vite-plugin/index.js +7 -7
- package/dist/{vite-plugin-DDILUFYY.js → vite-plugin-3ON45MQE.js} +8 -8
- package/package.json +3 -3
- package/dist/build-KCIH3HI6.js.map +0 -1
- package/dist/chunk-5XXXJ6DT.js.map +0 -1
- package/dist/chunk-KI4DOTN4.js.map +0 -1
- package/dist/chunk-OSBGZYXZ.js.map +0 -1
- package/dist/chunk-Q4NSUGMS.js.map +0 -1
- package/dist/chunk-SX7ZAHNE.js.map +0 -1
- package/dist/chunk-TNI4MARH.js.map +0 -1
- package/dist/deno-deploy-EUQDK2RC.js.map +0 -1
- package/dist/registry-4JHCZ6EF.js +0 -23
- package/dist/start-TYXS5I4M.js.map +0 -1
- /package/dist/{actions-virtual-module-2SM6YMTM.js.map → actions-virtual-module-EAKYEMGF.js.map} +0 -0
- /package/dist/{actions-virtual-module-5LRBP6YK.js.map → actions-virtual-module-OHENNMQG.js.map} +0 -0
- /package/dist/{agent-4FXJXZFD.js.map → agent-VJTZ4DQ7.js.map} +0 -0
- /package/dist/{app-typed-client-LIIPHLO6.js.map → app-typed-client-ILLQYTXP.js.map} +0 -0
- /package/dist/{app-typed-client-JFPV4YLS.js.map → app-typed-client-LHH77QDB.js.map} +0 -0
- /package/dist/{chunk-KOG5K26V.js.map → chunk-2Z7TANA4.js.map} +0 -0
- /package/dist/{chunk-V6VARIR3.js.map → chunk-4EQEJ4PH.js.map} +0 -0
- /package/dist/{chunk-3NAKOWTX.js.map → chunk-6U67SO5U.js.map} +0 -0
- /package/dist/{chunk-YWWMYEAC.js.map → chunk-CLSYYO5F.js.map} +0 -0
- /package/dist/{chunk-JMN4COMK.js.map → chunk-D7STTNQN.js.map} +0 -0
- /package/dist/{chunk-DSPEN7ZJ.js.map → chunk-DKX7LF5Q.js.map} +0 -0
- /package/dist/{chunk-6AGXDYVE.js.map → chunk-IB5VIXLR.js.map} +0 -0
- /package/dist/{chunk-PGDBSK2L.js.map → chunk-L6UHMWXU.js.map} +0 -0
- /package/dist/{chunk-MS4A7N77.js.map → chunk-PEL3MJLM.js.map} +0 -0
- /package/dist/{chunk-FFS7IRZF.js.map → chunk-SZWGXHY3.js.map} +0 -0
- /package/dist/{chunk-TMQ52AZR.js.map → chunk-X2LFNDJQ.js.map} +0 -0
- /package/dist/{chunk-FWEXQ2BR.js.map → chunk-XLSJWKSP.js.map} +0 -0
- /package/dist/{chunk-NZDGV4YJ.js.map → chunk-YCF3N4JS.js.map} +0 -0
- /package/dist/{dev-CD4YU5FN.js.map → dev-JDJWMRLH.js.map} +0 -0
- /package/dist/{info-2H7I55YN.js.map → info-SUX7QVA3.js.map} +0 -0
- /package/dist/{internal-api-TMLSNYMP.js.map → internal-api-6XNLCNI5.js.map} +0 -0
- /package/dist/{internal-api-WAKX6AZW.js.map → internal-api-VDYOXOT7.js.map} +0 -0
- /package/dist/{load-config-VMKOV44Y.js.map → load-config-52H3EKAA.js.map} +0 -0
- /package/dist/{mcp-HS26ZCU4.js.map → mcp-WJNCTM7M.js.map} +0 -0
- /package/dist/{node-OSVPYQ3D.js.map → node-QUGTW6XV.js.map} +0 -0
- /package/dist/{observability-bootstrap-YQKMEYW7.js.map → observability-bootstrap-FP6LMMJE.js.map} +0 -0
- /package/dist/{openapi-N4CXRUNT.js.map → openapi-Q53YOBIU.js.map} +0 -0
- /package/dist/{preview-YDJSRJ2K.js.map → preview-BARW75PN.js.map} +0 -0
- /package/dist/{registry-4JHCZ6EF.js.map → registry-SDBODRU6.js.map} +0 -0
- /package/dist/{routes-ECCDRHXZ.js.map → routes-FDF4SLOB.js.map} +0 -0
- /package/dist/{schema-ND7GHPQK.js.map → schema-LHNWUR4V.js.map} +0 -0
- /package/dist/{schemas-QCMSKQDK.js.map → schemas-2R2J64ZH.js.map} +0 -0
- /package/dist/{server-boundary-RX2AFU5U.js.map → server-boundary-AO6EELRF.js.map} +0 -0
- /package/dist/{server-boundary-NZPP33G6.js.map → server-boundary-E5GFVPLB.js.map} +0 -0
- /package/dist/{vite-plugin-DDILUFYY.js.map → vite-plugin-3ON45MQE.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/bun.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Bun deploy adapter. Writes to `cwd/.theokit/bun/`. Build-time.\n */\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nimport type { TheoConfig } from '../config/schema.js'\nimport type { SecurityHeadersConfig } from '../core/contracts/security-headers.js'\nimport { assertServicesUnsupported, readManifest } from '../services/index.js'\n\nimport { deployedAgentsFragment } from './deployed-agents.js'\nimport { type DeployedCorsOptions } from './deployed-cors.js'\nimport { type DeployedCsrfOptions } from './deployed-csrf.js'\nimport { planDeployedPlugins } from './deployed-plugins-module.js'\nimport { deployedEntryPreamble } from './deployed-preamble.js'\nimport {\n deployedRateLimitFragment,\n rateLimitCheckFragment,\n type DeployedRateLimitOptions,\n} from './deployed-rate-limit.js'\nimport {\n deployedRuntimeConfigFragment,\n agentsDirLiteral,\n serverDirLiteral,\n type DeployedRuntimeConfigOptions,\n type DeployedAgentsDirOptions,\n type DeployedServerDirOptions,\n} from './deployed-runtime-config.js'\nimport { deployedTraceFragment } from './deployed-trace.js'\nimport { nodeAdapter } from './node.js'\nimport { describeDeployedSecurityHeaders } from './security-headers.js'\nimport type { AdapterBuildContext, DeployAdapter } from './types.js'\n\nexport interface BunBuildDeps {\n runNodeBuild?: (config: TheoConfig, cwd: string, ctx?: AdapterBuildContext) => Promise<void>\n writeEntry?: (path: string, content: string) => void\n ensureDir?: (path: string) => void\n}\n\n/**\n * The module-scope refusals: this entry is production-only and Bun-only.\n *\n * Extracted from `renderBunEntry` when adding the configured-directory literal pushed it past the\n * per-function line budget. They are a cohesive block — three checks that all refuse to start —\n * and lifting them keeps the budget a signal about the renderer rather than about its preamble.\n */\nconst RUNTIME_GUARDS: readonly string[] = [\n `// EC-1: dev-mode guard`,\n `if (process.env.NODE_ENV !== 'production') {`,\n ` console.error('TheoBunAdapter is production-only. Use \\\\'theokit dev\\\\' (Node) for development.')`,\n ` process.exit(1)`,\n `}`,\n ``,\n `// Version check: Bun >= 1.1`,\n `if (typeof Bun === 'undefined') {`,\n ` console.error('TheoBunAdapter must run inside Bun. Got Node.js or unknown runtime.')`,\n ` process.exit(1)`,\n `}`,\n `{`,\n ` const [maj, min] = (Bun.version ?? '0.0').split('.').map(Number)`,\n ` if (maj < 1 || (maj === 1 && min < 1)) {`,\n ` console.error('TheoBunAdapter requires Bun >= 1.1; got ' + Bun.version)`,\n ` process.exit(1)`,\n ` }`,\n `}`,\n]\n\nexport function renderBunEntry(\n port: number,\n opts: {\n ssrStreaming?: boolean\n securityHeaders?: SecurityHeadersConfig\n } & DeployedAgentsDirOptions &\n DeployedCsrfOptions &\n DeployedRuntimeConfigOptions &\n DeployedServerDirOptions &\n DeployedCorsOptions &\n DeployedRateLimitOptions = {},\n): string {\n const streamingComment = opts.ssrStreaming\n ? `// T2.3 — ssrStreaming on; renderStreamingWeb may be consumed by app code`\n : `// (ssrStreaming off)`\n const runtimeConfig = deployedRuntimeConfigFragment(opts)\n const agentsFragment = deployedAgentsFragment(\n {\n kind: 'scan',\n projectRoot: 'cwd',\n loadModule: 'loadModule',\n serverDir: 'serverDir',\n agentsDirLiteral: agentsDirLiteral(opts),\n },\n {\n pathname: 'pathname',\n // B-185 — bound only when the runtime-config fragment declared the const, which is\n // exactly when a plugins module was emitted. Referencing it otherwise would emit an\n // identifier the entry never declares.\n pluginRunnerExpr:\n opts.runtimeConfigModule === undefined ? undefined : 'await THEO_PLUGIN_RUNNER',\n },\n )\n return [\n `// Generated by Theo — Bun Adapter`,\n `// Run: bun run .theokit/bun/server.mjs`,\n `// Requires Bun >= 1.1`,\n streamingComment,\n ``,\n ...RUNTIME_GUARDS,\n ``,\n `import { resolve, join } from 'node:path'`,\n `import { existsSync } from 'node:fs'`,\n `import { scanServerRoutes, matchRoute, executeRoute, createProductionLoader, extractTraceIdFromRequest, TRACE_HEADER, createCorsWebHandler${opts.rateLimit === undefined ? '' : ', createRateLimiterWeb'} } from 'theokit/server'`,\n `import { createWebShim } from 'theokit/adapters/web-shim'`,\n `import { buildSecurityHeaders, withSecurityHeaders } from 'theokit/adapters/security-headers'`,\n `// T3.2 — WS bridge for Bun runtime`,\n `import { createBunWsBridge } from 'theokit/adapters/ws-shim'`,\n `import { scanWebSocketRoutes } from 'theokit/server'`,\n ``,\n `const cwd = process.cwd()`,\n `const clientDir = resolve(cwd, '.theokit/client')`,\n `const serverDir = resolve(cwd, ${serverDirLiteral(opts)})`,\n `const port = process.env.PORT ? Number(process.env.PORT) : ${port}`,\n ``,\n `// #410 — the security baseline \\`theokit start\\` puts on every response,`,\n `// carried here as a literal because the deployed process has no`,\n `// theo.config.ts to read. Bun is the one Web target whose own handler serves`,\n `// the HTML document (static file + SPA fallback below), so the document gets`,\n `// these headers too -- with a nonce-less CSP, because that HTML was written`,\n `// at build time and carries no nonce on its script tags (EC-4).`,\n ...deployedEntryPreamble(runtimeConfig, agentsFragment, opts, 'bun'),\n ``,\n ...deployedRateLimitFragment(opts.rateLimit, 'bun', 'server.requestIP(request)?.address'),\n ``,\n `const routes = existsSync(serverDir) ? scanServerRoutes(serverDir) : []`,\n `const wsRoutes = existsSync(serverDir) ? scanWebSocketRoutes(serverDir) : []`,\n `const loadModule = createProductionLoader()`,\n ``,\n `// Bun WebSocket config — single handler dispatches to first ws route,`,\n `// or a default no-op when none declared. Per-route routing happens above`,\n `// (the upgrade decision is made in fetch handler before Bun.serve hands off).`,\n `const wsBridge = wsRoutes.length > 0`,\n ` ? createBunWsBridge({`,\n ` onOpen: () => {},`,\n ` onMessage: (ws, data) => { ws.send(data) },`,\n ` onClose: () => {},`,\n ` })`,\n ` : { open: () => {}, message: () => {}, close: () => {} }`,\n ``,\n `function notFoundResponse() {`,\n ` return new Response(JSON.stringify({ error: { code: 'NOT_FOUND', message: 'Route not found' } }), {`,\n ` status: 404,`,\n ` headers: { 'Content-Type': 'application/json' },`,\n ` })`,\n `}`,\n ``,\n `Bun.serve({`,\n ` port,`,\n ` websocket: wsBridge,`,\n ` async fetch(request, server) {`,\n ` // #409 — the preflight is answered BEFORE anything routes: an OPTIONS the router`,\n ` // handles is an OPTIONS the browser never gets a CORS answer to.`,\n ` const preflight = corsPreflight(request)`,\n ` if (preflight !== null) return withSecurityHeaders(preflight, SECURITY_HEADERS)`,\n ...rateLimitCheckFragment(opts.rateLimit, ' '),\n ` return withCors(request, withSecurityHeaders(await handleRequest(request), SECURITY_HEADERS))`,\n ` },`,\n `})`,\n ``,\n ...bunHandleRequestFragment(runtimeConfig.executeRouteSpread, agentsFragment.branch),\n ].join('\\n')\n}\n\n/**\n * The request handler, as generated source.\n *\n * Extracted for the reason `vercel.ts` extracts its own fragments: the emitter is one array\n * literal, so every line the entry gains counts against `max-lines-per-function`, and #410 added\n * the CSRF literal to an emitter that was already sitting exactly at the ceiling.\n */\nfunction bunHandleRequestFragment(runtimeSpread: string, agentBranch: readonly string[]): string[] {\n return [\n `async function handleRequest(request) {`,\n ` const url = new URL(request.url)`,\n ` const pathname = url.pathname`,\n ``,\n ` // 1) Static assets`,\n ` const staticPath = pathname === '/' ? '/index.html' : pathname`,\n ` const fullStatic = join(clientDir, staticPath)`,\n ` if (existsSync(fullStatic)) {`,\n ` const file = Bun.file(fullStatic)`,\n ` if (await file.exists()) return new Response(file)`,\n ` }`,\n ``,\n ` // 2) API routes through the full executeRoute pipeline via the shim`,\n ` if (pathname.startsWith('/api/') || __theoIsAgentCardPath(pathname)) {`,\n ...agentBranch,\n ``,\n ` const match = matchRoute(pathname, routes)`,\n ` if (!match) return notFoundResponse()`,\n ` const { req, res, toResponse } = createWebShim(request)`,\n ...deployedTraceFragment('request', ' '),\n ` const method = request.method.toUpperCase()`,\n ` // #382 — not awaited: toResponse() settles at the headers and carries`,\n ` // a live body, so Bun.serve streams while the handler writes.`,\n ` return toResponse(executeRoute({ route: match.route, method, params: match.params, req, res, loadModule, serverDir, requestId, ...CSRF_CONFIG, ${runtimeSpread} }))`,\n ` }`,\n ``,\n ` // 3) SPA fallback`,\n ` const indexPath = join(clientDir, 'index.html')`,\n ` if (existsSync(indexPath)) return new Response(Bun.file(indexPath))`,\n ``,\n ` return notFoundResponse()`,\n `}`,\n ``,\n `console.log('Theo (Bun) listening on http://localhost:' + port)`,\n ]\n}\n\nexport async function buildBun(\n config: TheoConfig,\n cwd: string,\n deps: BunBuildDeps = {},\n ctx?: AdapterBuildContext,\n): Promise<void> {\n // Wave 2 (T2.2) — reject polyglot services on this adapter.\n assertServicesUnsupported('bun', readManifest(cwd))\n\n const runNodeBuild = deps.runNodeBuild ?? nodeAdapter.build.bind(nodeAdapter)\n await runNodeBuild(config, cwd, ctx)\n\n const outputDir = resolve(cwd, '.theokit/bun')\n const ensureDir = deps.ensureDir ?? ((p: string) => mkdirSync(p, { recursive: true }))\n ensureDir(outputDir)\n\n const pluginsPlan = planDeployedPlugins(config.plugins, 'bun')\n const entry = renderBunEntry(config.port, {\n ssrStreaming: config.ssrStreaming,\n securityHeaders: config.security?.headers,\n csrf: config.security?.csrf,\n disallowed: config.security?.disallowed,\n cors: config.security?.cors,\n // #425 — a selector, not a transformer, so it rides as a literal like the values above.\n serialization: config.serialization,\n // #425 — the ONE concern that is not a literal. A closure cannot be baked, so a plugin\n // declared by module specifier is imported by the emitted module instead; a constructed one\n // is refused by name at build time rather than dropped in silence.\n runtimeConfigModule: pluginsPlan?.moduleSpecifier,\n // #95 — the configured directories, which `build.ts:210` already threads into the Vite\n // plugins. Without these two lines the literals above fall to their defaults and a project\n // with a custom dir deploys an entry that resolves a directory it does not have.\n serverDir: config.serverDir,\n agentsDir: config.agentsDir,\n })\n const write =\n deps.writeEntry ??\n ((p, c) => {\n writeFileSync(p, c)\n })\n if (pluginsPlan !== undefined) {\n // Beside the entry, so the emitted import is a sibling. Written through the same seam as\n // the entry so a test that captures one captures both (#425).\n write(resolve(outputDir, 'theo.plugins.mjs'), pluginsPlan.source)\n }\n write(resolve(outputDir, 'server.mjs'), entry)\n\n // eslint-disable-next-line no-console -- CLI build progress\n console.log('\\n ✓ Bun output → .theokit/bun/server.mjs')\n // eslint-disable-next-line no-console -- CLI build progress\n console.log(\n `${describeDeployedSecurityHeaders({\n target: 'bun',\n securityHeaders: config.security?.headers,\n // No deploy target other than the streamed Cloudflare worker renders HTML\n // at request time, so none of the rest can mint a nonce.\n mintsNonce: false,\n // Bun serves `.theokit/client` itself, so the document DOES pass through\n // the handler these headers are attached to.\n documentHeaders: 'handler',\n })}\\n`,\n )\n}\n\nexport const bunAdapter: DeployAdapter = {\n name: 'bun',\n streamsResponses: true,\n // #409 / #410 — the generated entry calls `executeRoute` with routes, loader\n // and serverDir only. CSRF, route policy, file middleware and Zod validation\n // still run because they live inside `executeRoute`; none of the remaining\n // configurable concerns reach it. Declared explicitly rather than omitted so\n // the gap is a statement in the source and not an absence.\n //\n // `securityHeaders` IS applied: the entry carries `security.headers` as a\n // literal and puts the built baseline on every response, the served document\n // included.\n servesAgents: true,\n appliesConfig: [\n 'securityHeaders',\n 'csrf',\n 'disallowed',\n 'cors',\n 'serialization',\n 'plugins',\n // #508 — bun is the first Web target to ENFORCE a declared limit rather than refuse the\n // build: `Bun.serve` is long-lived, so the in-process counter survives, and its handler\n // already receives `server`, whose `requestIP` gives the peer address without a header.\n 'rateLimit',\n ],\n build(config, cwd, ctx) {\n return buildBun(config, cwd, {}, ctx)\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,WAAW,qBAAqB;AACzC,SAAS,eAAe;AA0CxB,IAAM,iBAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,eACd,MACA,OAQ6B,CAAC,GACtB;AACR,QAAM,mBAAmB,KAAK,eAC1B,mFACA;AACJ,QAAM,gBAAgB,8BAA8B,IAAI;AACxD,QAAM,iBAAiB;AAAA,IACrB;AAAA,MACE,MAAM;AAAA,MACN,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,kBAAkB,iBAAiB,IAAI;AAAA,IACzC;AAAA,IACA;AAAA,MACE,UAAU;AAAA;AAAA;AAAA;AAAA,MAIV,kBACE,KAAK,wBAAwB,SAAY,SAAY;AAAA,IACzD;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA,6IAA6I,KAAK,cAAc,SAAY,KAAK,wBAAwB;AAAA,IACzM;AAAA,IACA;A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A,EACJ;AACF;AAEO,IAAM,aAA4B;AAAA,EACvC,MAAM;AAAA,EACN,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUlB,cAAc;AAAA,EACd,eAAe;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAIA;AAAA,EACF;AAAA,EACA,MAAM,QAAQ,KAAK,KAAK;AACtB,WAAO,SAAS,QAAQ,KAAK,CAAC,GAAG,GAAG;AAAA,EACtC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/adapters/bun.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Bun deploy adapter. Writes to `cwd/.theokit/bun/`. Build-time.\n */\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nimport type { TheoConfig } from '../config/schema.js'\nimport type { SecurityHeadersConfig } from '../core/contracts/security-headers.js'\nimport { assertServicesUnsupported, readManifest } from '../services/index.js'\n\nimport { deployedAgentsFragment } from './deployed-agents.js'\nimport { type DeployedCorsOptions } from './deployed-cors.js'\nimport { type DeployedCsrfOptions } from './deployed-csrf.js'\nimport { planDeployedPlugins } from './deployed-plugins-module.js'\nimport { deployedEntryPreamble } from './deployed-preamble.js'\nimport {\n deployedRateLimitFragment,\n rateLimitCheckFragment,\n type DeployedRateLimitOptions,\n} from './deployed-rate-limit.js'\nimport {\n deployedRuntimeConfigFragment,\n agentsDirLiteral,\n serverDirLiteral,\n type DeployedRuntimeConfigOptions,\n type DeployedAgentsDirOptions,\n type DeployedServerDirOptions,\n} from './deployed-runtime-config.js'\nimport { deployedTraceFragment } from './deployed-trace.js'\nimport { nodeAdapter } from './node.js'\nimport { describeDeployedSecurityHeaders } from './security-headers.js'\nimport type { AdapterBuildContext, DeployAdapter } from './types.js'\n\nexport interface BunBuildDeps {\n runNodeBuild?: (config: TheoConfig, cwd: string, ctx?: AdapterBuildContext) => Promise<void>\n writeEntry?: (path: string, content: string) => void\n ensureDir?: (path: string) => void\n}\n\n/**\n * The module-scope refusals: this entry is production-only and Bun-only.\n *\n * Extracted from `renderBunEntry` when adding the configured-directory literal pushed it past the\n * per-function line budget. They are a cohesive block — three checks that all refuse to start —\n * and lifting them keeps the budget a signal about the renderer rather than about its preamble.\n */\nconst RUNTIME_GUARDS: readonly string[] = [\n `// EC-1: dev-mode guard`,\n `if (process.env.NODE_ENV !== 'production') {`,\n ` console.error('TheoBunAdapter is production-only. Use \\\\'theokit dev\\\\' (Node) for development.')`,\n ` process.exit(1)`,\n `}`,\n ``,\n `// Version check: Bun >= 1.1`,\n `if (typeof Bun === 'undefined') {`,\n ` console.error('TheoBunAdapter must run inside Bun. Got Node.js or unknown runtime.')`,\n ` process.exit(1)`,\n `}`,\n `{`,\n ` const [maj, min] = (Bun.version ?? '0.0').split('.').map(Number)`,\n ` if (maj < 1 || (maj === 1 && min < 1)) {`,\n ` console.error('TheoBunAdapter requires Bun >= 1.1; got ' + Bun.version)`,\n ` process.exit(1)`,\n ` }`,\n `}`,\n]\n\nexport function renderBunEntry(\n port: number,\n opts: {\n ssrStreaming?: boolean\n securityHeaders?: SecurityHeadersConfig\n } & DeployedAgentsDirOptions &\n DeployedCsrfOptions &\n DeployedRuntimeConfigOptions &\n DeployedServerDirOptions &\n DeployedCorsOptions &\n DeployedRateLimitOptions = {},\n): string {\n const streamingComment = opts.ssrStreaming\n ? `// T2.3 — ssrStreaming on; renderStreamingWeb may be consumed by app code`\n : `// (ssrStreaming off)`\n const runtimeConfig = deployedRuntimeConfigFragment(opts)\n const agentsFragment = deployedAgentsFragment(\n {\n kind: 'scan',\n projectRoot: 'cwd',\n loadModule: 'loadModule',\n serverDir: 'serverDir',\n agentsDirLiteral: agentsDirLiteral(opts),\n },\n {\n pathname: 'pathname',\n // B-185 — bound only when the runtime-config fragment declared the const, which is\n // exactly when a plugins module was emitted. Referencing it otherwise would emit an\n // identifier the entry never declares.\n pluginRunnerExpr:\n opts.runtimeConfigModule === undefined ? undefined : 'await THEO_PLUGIN_RUNNER',\n },\n )\n return [\n `// Generated by Theo — Bun Adapter`,\n `// Run: bun run .theokit/bun/server.mjs`,\n `// Requires Bun >= 1.1`,\n streamingComment,\n ``,\n ...RUNTIME_GUARDS,\n ``,\n `import { resolve, join } from 'node:path'`,\n `import { existsSync } from 'node:fs'`,\n `import { scanServerRoutes, matchRoute, executeRoute, createProductionLoader, extractTraceIdFromRequest, TRACE_HEADER, createCorsWebHandler${opts.rateLimit === undefined ? '' : ', createRateLimiterWeb'} } from 'theokit/server'`,\n `import { createWebShim } from 'theokit/adapters/web-shim'`,\n `import { buildSecurityHeaders, withSecurityHeaders } from 'theokit/adapters/security-headers'`,\n `// T3.2 — WS bridge for Bun runtime`,\n `import { createBunWsBridge } from 'theokit/adapters/ws-shim'`,\n `import { scanWebSocketRoutes } from 'theokit/server'`,\n ``,\n `const cwd = process.cwd()`,\n `const clientDir = resolve(cwd, '.theokit/client')`,\n `const serverDir = resolve(cwd, ${serverDirLiteral(opts)})`,\n `const port = process.env.PORT ? Number(process.env.PORT) : ${port}`,\n ``,\n `// #410 — the security baseline \\`theokit start\\` puts on every response,`,\n `// carried here as a literal because the deployed process has no`,\n `// theo.config.ts to read. Bun is the one Web target whose own handler serves`,\n `// the HTML document (static file + SPA fallback below), so the document gets`,\n `// these headers too -- with a nonce-less CSP, because that HTML was written`,\n `// at build time and carries no nonce on its script tags (EC-4).`,\n ...deployedEntryPreamble(runtimeConfig, agentsFragment, opts, 'bun'),\n ``,\n ...deployedRateLimitFragment(opts.rateLimit, 'bun', 'server.requestIP(request)?.address'),\n ``,\n `const routes = existsSync(serverDir) ? scanServerRoutes(serverDir) : []`,\n `const wsRoutes = existsSync(serverDir) ? scanWebSocketRoutes(serverDir) : []`,\n `const loadModule = createProductionLoader()`,\n ``,\n `// Bun WebSocket config — single handler dispatches to first ws route,`,\n `// or a default no-op when none declared. Per-route routing happens above`,\n `// (the upgrade decision is made in fetch handler before Bun.serve hands off).`,\n `const wsBridge = wsRoutes.length > 0`,\n ` ? createBunWsBridge({`,\n ` onOpen: () => {},`,\n ` onMessage: (ws, data) => { ws.send(data) },`,\n ` onClose: () => {},`,\n ` })`,\n ` : { open: () => {}, message: () => {}, close: () => {} }`,\n ``,\n `function notFoundResponse() {`,\n ` return new Response(JSON.stringify({ error: { code: 'NOT_FOUND', message: 'Route not found' } }), {`,\n ` status: 404,`,\n ` headers: { 'Content-Type': 'application/json' },`,\n ` })`,\n `}`,\n ``,\n `Bun.serve({`,\n ` port,`,\n ` websocket: wsBridge,`,\n ` async fetch(request, server) {`,\n ` // #409 — the preflight is answered BEFORE anything routes: an OPTIONS the router`,\n ` // handles is an OPTIONS the browser never gets a CORS answer to.`,\n ` const preflight = corsPreflight(request)`,\n ` if (preflight !== null) return withSecurityHeaders(preflight, SECURITY_HEADERS)`,\n ...rateLimitCheckFragment(opts.rateLimit, ' '),\n ` return withCors(request, withSecurityHeaders(await handleRequest(request), SECURITY_HEADERS))`,\n ` },`,\n `})`,\n ``,\n ...bunHandleRequestFragment(runtimeConfig.executeRouteSpread, agentsFragment.branch),\n ].join('\\n')\n}\n\n/**\n * The request handler, as generated source.\n *\n * Extracted for the reason `vercel.ts` extracts its own fragments: the emitter is one array\n * literal, so every line the entry gains counts against `max-lines-per-function`, and #410 added\n * the CSRF literal to an emitter that was already sitting exactly at the ceiling.\n */\nfunction bunHandleRequestFragment(runtimeSpread: string, agentBranch: readonly string[]): string[] {\n return [\n `async function handleRequest(request) {`,\n ` const url = new URL(request.url)`,\n ` const pathname = url.pathname`,\n ``,\n ` // 1) Static assets`,\n ` const staticPath = pathname === '/' ? '/index.html' : pathname`,\n ` const fullStatic = join(clientDir, staticPath)`,\n ` if (existsSync(fullStatic)) {`,\n ` const file = Bun.file(fullStatic)`,\n ` if (await file.exists()) return new Response(file)`,\n ` }`,\n ``,\n ` // 2) API routes through the full executeRoute pipeline via the shim`,\n ` if (pathname.startsWith('/api/') || __theoIsAgentCardPath(pathname)) {`,\n ...agentBranch,\n ``,\n ` const match = matchRoute(pathname, routes)`,\n ` if (!match) return notFoundResponse()`,\n ` const { req, res, toResponse } = createWebShim(request)`,\n ...deployedTraceFragment('request', ' '),\n ` const method = request.method.toUpperCase()`,\n ` // #382 — not awaited: toResponse() settles at the headers and carries`,\n ` // a live body, so Bun.serve streams while the handler writes.`,\n ` return toResponse(executeRoute({ route: match.route, method, params: match.params, req, res, loadModule, serverDir, requestId, ...CSRF_CONFIG, ${runtimeSpread} }))`,\n ` }`,\n ``,\n ` // 3) SPA fallback`,\n ` const indexPath = join(clientDir, 'index.html')`,\n ` if (existsSync(indexPath)) return new Response(Bun.file(indexPath))`,\n ``,\n ` return notFoundResponse()`,\n `}`,\n ``,\n `console.log('Theo (Bun) listening on http://localhost:' + port)`,\n ]\n}\n\nexport async function buildBun(\n config: TheoConfig,\n cwd: string,\n deps: BunBuildDeps = {},\n ctx?: AdapterBuildContext,\n): Promise<void> {\n // Wave 2 (T2.2) — reject polyglot services on this adapter.\n assertServicesUnsupported('bun', readManifest(cwd))\n\n const runNodeBuild = deps.runNodeBuild ?? nodeAdapter.build.bind(nodeAdapter)\n await runNodeBuild(config, cwd, ctx)\n\n const outputDir = resolve(cwd, '.theokit/bun')\n const ensureDir = deps.ensureDir ?? ((p: string) => mkdirSync(p, { recursive: true }))\n ensureDir(outputDir)\n\n const pluginsPlan = planDeployedPlugins(config.plugins, 'bun')\n const entry = renderBunEntry(config.port, {\n ssrStreaming: config.ssrStreaming,\n securityHeaders: config.security?.headers,\n csrf: config.security?.csrf,\n disallowed: config.security?.disallowed,\n cors: config.security?.cors,\n // #425 — a selector, not a transformer, so it rides as a literal like the values above.\n serialization: config.serialization,\n // #425 — the ONE concern that is not a literal. A closure cannot be baked, so a plugin\n // declared by module specifier is imported by the emitted module instead; a constructed one\n // is refused by name at build time rather than dropped in silence.\n runtimeConfigModule: pluginsPlan?.moduleSpecifier,\n // #95 — the configured directories, which `build.ts:210` already threads into the Vite\n // plugins. Without these two lines the literals above fall to their defaults and a project\n // with a custom dir deploys an entry that resolves a directory it does not have.\n serverDir: config.serverDir,\n agentsDir: config.agentsDir,\n })\n const write =\n deps.writeEntry ??\n ((p, c) => {\n writeFileSync(p, c)\n })\n if (pluginsPlan !== undefined) {\n // Beside the entry, so the emitted import is a sibling. Written through the same seam as\n // the entry so a test that captures one captures both (#425).\n write(resolve(outputDir, 'theo.plugins.mjs'), pluginsPlan.source)\n }\n write(resolve(outputDir, 'server.mjs'), entry)\n\n // eslint-disable-next-line no-console -- CLI build progress\n console.log('\\n ✓ Bun output → .theokit/bun/server.mjs')\n // eslint-disable-next-line no-console -- CLI build progress\n console.log(\n `${describeDeployedSecurityHeaders({\n target: 'bun',\n securityHeaders: config.security?.headers,\n // No deploy target other than the streamed Cloudflare worker renders HTML\n // at request time, so none of the rest can mint a nonce.\n mintsNonce: false,\n // Bun serves `.theokit/client` itself, so the document DOES pass through\n // the handler these headers are attached to.\n documentHeaders: 'handler',\n })}\\n`,\n )\n}\n\nexport const bunAdapter: DeployAdapter = {\n name: 'bun',\n streamsResponses: true,\n // #409 / #410 — the generated entry calls `executeRoute` with routes, loader\n // and serverDir only. CSRF, route policy, file middleware and Zod validation\n // still run because they live inside `executeRoute`; none of the remaining\n // configurable concerns reach it. Declared explicitly rather than omitted so\n // the gap is a statement in the source and not an absence.\n //\n // `securityHeaders` IS applied: the entry carries `security.headers` as a\n // literal and puts the built baseline on every response, the served document\n // included.\n servesAgents: true,\n appliesConfig: [\n 'securityHeaders',\n 'csrf',\n 'disallowed',\n 'cors',\n 'serialization',\n 'plugins',\n // #508 — bun is the first Web target to ENFORCE a declared limit rather than refuse the\n // build: `Bun.serve` is long-lived, so the in-process counter survives, and its handler\n // already receives `server`, whose `requestIP` gives the peer address without a header.\n 'rateLimit',\n ],\n // B-257 — a long-lived process: the in-process counter survives between requests.\n enforcesRateLimit: 'always',\n build(config, cwd, ctx) {\n return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AAK;AACtB,WAAO,SAAS,QAAQ,KAAK,CAAC,GAAG,GAAG;AAAA,EACtC;AACF;","names":[]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
runZodValidation,
|
|
7
7
|
sendError,
|
|
8
8
|
sendJson
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SYIQV4UH.js";
|
|
10
10
|
import {
|
|
11
11
|
enforceCsrf
|
|
12
12
|
} from "./chunk-P6OS7652.js";
|
|
@@ -1039,4 +1039,4 @@ export {
|
|
|
1039
1039
|
createCorsHandler,
|
|
1040
1040
|
createCorsWebHandler
|
|
1041
1041
|
};
|
|
1042
|
-
//# sourceMappingURL=chunk-
|
|
1042
|
+
//# sourceMappingURL=chunk-2Z7TANA4.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
serveMatchedAuxRoute,
|
|
13
13
|
serveThroughPluginLifecycle,
|
|
14
14
|
setupSsrDevMiddleware
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-L6UHMWXU.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveTheoRootDir
|
|
18
18
|
} from "./chunk-FDOOBTXJ.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
mountAgent,
|
|
35
35
|
readAgentPolicy,
|
|
36
36
|
writeWebResponseToServerResponse
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-E2RC367T.js";
|
|
38
38
|
import {
|
|
39
39
|
getApprovalRegistry,
|
|
40
40
|
resolveProvider
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
TRACE_HEADER,
|
|
50
50
|
createObservabilityPluginFromConfig,
|
|
51
51
|
extractTraceId
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-PEL3MJLM.js";
|
|
53
53
|
import {
|
|
54
54
|
logRequest
|
|
55
55
|
} from "./chunk-C27VRUVN.js";
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
} from "./chunk-NO6HA4FG.js";
|
|
69
69
|
import {
|
|
70
70
|
loadConfig
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-SZWGXHY3.js";
|
|
72
72
|
import {
|
|
73
73
|
buildServicesProxyConfig
|
|
74
74
|
} from "./chunk-ZNZISJDZ.js";
|
|
@@ -2195,19 +2195,19 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
2195
2195
|
}
|
|
2196
2196
|
const { assetsMapPlugin } = await import("./assets-map-BMQASQHW.js");
|
|
2197
2197
|
const assetsMap = assetsMapPlugin({ appDir: resolve5(projectRoot, options.appDir ?? "app") });
|
|
2198
|
-
const { appTypedClientPlugin } = await import("./app-typed-client-
|
|
2198
|
+
const { appTypedClientPlugin } = await import("./app-typed-client-LHH77QDB.js");
|
|
2199
2199
|
const appClientPlugin = appTypedClientPlugin({
|
|
2200
2200
|
cwd: projectRoot,
|
|
2201
2201
|
serverDir: serverDirAbs,
|
|
2202
2202
|
distDir: resolve5(projectRoot, ".theokit")
|
|
2203
2203
|
});
|
|
2204
|
-
const { actionsVirtualModule } = await import("./actions-virtual-module-
|
|
2204
|
+
const { actionsVirtualModule } = await import("./actions-virtual-module-EAKYEMGF.js");
|
|
2205
2205
|
const actionsPlugin = actionsVirtualModule({
|
|
2206
2206
|
serverDir: serverDirAbs,
|
|
2207
2207
|
distDir: resolve5(projectRoot, ".theokit")
|
|
2208
2208
|
});
|
|
2209
2209
|
const { agentsTypedClientPlugin } = await import("./agents-typed-client-D4OA2TXB.js");
|
|
2210
|
-
const { generateManifest } = await import("./internal-api-
|
|
2210
|
+
const { generateManifest } = await import("./internal-api-VDYOXOT7.js");
|
|
2211
2211
|
const agentsClientPlugin = agentsTypedClientPlugin({
|
|
2212
2212
|
projectRoot,
|
|
2213
2213
|
agentsDir: agentsDirName,
|
|
@@ -2224,7 +2224,7 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
2224
2224
|
const controllerTransformPlugin = controllerSwcTransformPlugin({
|
|
2225
2225
|
serverDir: serverDirAbs
|
|
2226
2226
|
});
|
|
2227
|
-
const { serverOnlyImportBoundary } = await import("./server-boundary-
|
|
2227
|
+
const { serverOnlyImportBoundary } = await import("./server-boundary-AO6EELRF.js");
|
|
2228
2228
|
const serverBoundaryPlugin = serverOnlyImportBoundary({
|
|
2229
2229
|
projectRoot,
|
|
2230
2230
|
serverDir: serverDirAbs
|
|
@@ -2400,4 +2400,4 @@ export {
|
|
|
2400
2400
|
theoPluginAsync,
|
|
2401
2401
|
theoPlugin
|
|
2402
2402
|
};
|
|
2403
|
-
//# sourceMappingURL=chunk-
|
|
2403
|
+
//# sourceMappingURL=chunk-4EQEJ4PH.js.map
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
mintRunId,
|
|
14
14
|
parseAgentRequestBody,
|
|
15
15
|
readAgentPolicy
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WBB3MEEN.js";
|
|
17
17
|
import {
|
|
18
18
|
createServerContext
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-SYIQV4UH.js";
|
|
20
20
|
import {
|
|
21
21
|
validateCsrfRequest
|
|
22
22
|
} from "./chunk-P6OS7652.js";
|
|
@@ -570,4 +570,4 @@ export {
|
|
|
570
570
|
createAgentSubjectResolver,
|
|
571
571
|
createSubjectResolverFromFactory
|
|
572
572
|
};
|
|
573
|
-
//# sourceMappingURL=chunk-
|
|
573
|
+
//# sourceMappingURL=chunk-6U67SO5U.js.map
|
|
@@ -413,6 +413,107 @@ var UnserialisableRateLimitError = class extends Error {
|
|
|
413
413
|
reason;
|
|
414
414
|
name = "UnserialisableRateLimitError";
|
|
415
415
|
};
|
|
416
|
+
var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
417
|
+
var NOT_BINDABLE = /* @__PURE__ */ new Set([
|
|
418
|
+
"await",
|
|
419
|
+
"break",
|
|
420
|
+
"case",
|
|
421
|
+
"catch",
|
|
422
|
+
"class",
|
|
423
|
+
"const",
|
|
424
|
+
"continue",
|
|
425
|
+
"debugger",
|
|
426
|
+
"default",
|
|
427
|
+
"delete",
|
|
428
|
+
"do",
|
|
429
|
+
"else",
|
|
430
|
+
"enum",
|
|
431
|
+
"export",
|
|
432
|
+
"extends",
|
|
433
|
+
"false",
|
|
434
|
+
"finally",
|
|
435
|
+
"for",
|
|
436
|
+
"function",
|
|
437
|
+
"if",
|
|
438
|
+
"import",
|
|
439
|
+
"in",
|
|
440
|
+
"instanceof",
|
|
441
|
+
"new",
|
|
442
|
+
"null",
|
|
443
|
+
"return",
|
|
444
|
+
"super",
|
|
445
|
+
"switch",
|
|
446
|
+
"this",
|
|
447
|
+
"throw",
|
|
448
|
+
"true",
|
|
449
|
+
"try",
|
|
450
|
+
"typeof",
|
|
451
|
+
"var",
|
|
452
|
+
"void",
|
|
453
|
+
"while",
|
|
454
|
+
"with",
|
|
455
|
+
"yield"
|
|
456
|
+
]);
|
|
457
|
+
function assertBakeableStore(store, target) {
|
|
458
|
+
if (store === void 0) return;
|
|
459
|
+
if (!isStoreShaped(store)) {
|
|
460
|
+
throw new UnserialisableRateLimitError(
|
|
461
|
+
target,
|
|
462
|
+
"`security.rateLimit.store` must be an object naming a module and a factory.",
|
|
463
|
+
[
|
|
464
|
+
"declare `store: { module: '@upstash/redis', factory: 'Redis' }`",
|
|
465
|
+
"omit `store` and let the build refuse this target, which is honest about not limiting"
|
|
466
|
+
]
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
const { module: mod, factory } = store;
|
|
470
|
+
if (typeof mod !== "string" || mod.length === 0) {
|
|
471
|
+
throw new UnserialisableRateLimitError(
|
|
472
|
+
target,
|
|
473
|
+
"`security.rateLimit.store.module` must be the specifier the entry imports from.",
|
|
474
|
+
["declare `module: '@upstash/redis'`", "omit `store`"]
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
if (typeof factory !== "string" || !IDENTIFIER.test(factory) || NOT_BINDABLE.has(factory)) {
|
|
478
|
+
throw new UnserialisableRateLimitError(
|
|
479
|
+
target,
|
|
480
|
+
"`security.rateLimit.store.factory` must be a plain identifier \u2014 it is written into the generated entry as `import { <factory> }`, where a quoted string would not parse, so it is validated rather than escaped. Anything else would put arbitrary source in every deployment this config builds.",
|
|
481
|
+
[
|
|
482
|
+
"name the export directly: `factory: 'Redis'`",
|
|
483
|
+
"omit `store` and let the build refuse this target"
|
|
484
|
+
]
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
const { options } = store;
|
|
488
|
+
if (options !== void 0) {
|
|
489
|
+
if (typeof options !== "object" || options === null || Array.isArray(options)) {
|
|
490
|
+
throw new UnserialisableRateLimitError(
|
|
491
|
+
target,
|
|
492
|
+
"`security.rateLimit.store.options` must be an object of scalar values.",
|
|
493
|
+
[
|
|
494
|
+
"declare `options: { url: 'redis://\u2026', retries: 3 }`",
|
|
495
|
+
"omit `options` and configure the store inside the factory"
|
|
496
|
+
]
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
const offending = Object.entries(options).find(
|
|
500
|
+
([, v]) => typeof v !== "string" && typeof v !== "number" && typeof v !== "boolean"
|
|
501
|
+
);
|
|
502
|
+
if (offending !== void 0) {
|
|
503
|
+
throw new UnserialisableRateLimitError(
|
|
504
|
+
target,
|
|
505
|
+
`\`security.rateLimit.store.options.${offending[0]}\` must be a string, number or boolean.`,
|
|
506
|
+
[
|
|
507
|
+
"declare scalars only \u2014 strings, numbers and booleans",
|
|
508
|
+
"move anything else into the factory itself, which the generated entry calls at runtime"
|
|
509
|
+
]
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function isStoreShaped(store) {
|
|
515
|
+
return typeof store === "object" && store !== null && !Array.isArray(store);
|
|
516
|
+
}
|
|
416
517
|
function bakeableRateLimit(rateLimit, target) {
|
|
417
518
|
if (rateLimit === void 0) return void 0;
|
|
418
519
|
const cfg = rateLimit;
|
|
@@ -436,6 +537,7 @@ function bakeableRateLimit(rateLimit, target) {
|
|
|
436
537
|
]
|
|
437
538
|
);
|
|
438
539
|
}
|
|
540
|
+
assertBakeableStore(cfg.store, target);
|
|
439
541
|
if (cfg.routes !== void 0) {
|
|
440
542
|
throw new UnserialisableRateLimitError(
|
|
441
543
|
target,
|
|
@@ -453,10 +555,13 @@ function bakeableRateLimit(rateLimit, target) {
|
|
|
453
555
|
return {
|
|
454
556
|
windowMs,
|
|
455
557
|
max,
|
|
456
|
-
trustProxy: typeof trustProxy === "boolean" || typeof trustProxy === "number" ? trustProxy : false
|
|
558
|
+
trustProxy: typeof trustProxy === "boolean" || typeof trustProxy === "number" ? trustProxy : false,
|
|
559
|
+
// Validated above — `module` and `options` are escaped at emit time, `factory` was checked
|
|
560
|
+
// against IDENTIFIER because it cannot be.
|
|
561
|
+
store: cfg.store
|
|
457
562
|
};
|
|
458
563
|
}
|
|
459
|
-
function deployedRateLimitFragment(rateLimit, target, addressExpression, params = "request, server") {
|
|
564
|
+
function deployedRateLimitFragment(rateLimit, target, addressExpression, params = "request, server", importPrefix = "") {
|
|
460
565
|
const baked = bakeableRateLimit(rateLimit, target);
|
|
461
566
|
if (baked === void 0) return [];
|
|
462
567
|
return [
|
|
@@ -469,7 +574,27 @@ function deployedRateLimitFragment(rateLimit, target, addressExpression, params
|
|
|
469
574
|
`// the limit is PER INSTANCE, and a caller spread across instances gets that many budgets.`,
|
|
470
575
|
`// The address is resolved correctly either way; the counting is what B-257 is about, and`,
|
|
471
576
|
`// \`theokit build\` refuses a declared limit on those five until it is.`,
|
|
472
|
-
|
|
577
|
+
// B-262 — ONE builder, one signature, always async. The emitter used to branch here:
|
|
578
|
+
// `createRateLimiterWeb` returns a value and `createDurableRateLimiterWeb` returns a Promise, so
|
|
579
|
+
// the CALL SITE had to know which it got and emit `await` or not. A call site whose shape changes
|
|
580
|
+
// with the config is what produced B-257's missing `await`, and `buildRateLimiter` removes the
|
|
581
|
+
// decision rather than documenting it.
|
|
582
|
+
`import { buildRateLimiter } from '${importPrefix}theokit/server/rate-limit'`,
|
|
583
|
+
...baked.store === void 0 ? [
|
|
584
|
+
`const RATE_LIMIT = buildRateLimiter({ windowMs: ${baked.windowMs}, max: ${baked.max} }, undefined)`
|
|
585
|
+
] : [
|
|
586
|
+
// B-257 — a durable counter, named by the app. `module` and the options are JSON literals;
|
|
587
|
+
// `factory` was validated against IDENTIFIER at bake time because it lands here as a bare
|
|
588
|
+
// identifier and no escape can make that safe.
|
|
589
|
+
//
|
|
590
|
+
// The limiter's own import is emitted HERE rather than by each adapter. See `importPrefix`.
|
|
591
|
+
`import { ${baked.store.factory} } from ${JSON.stringify(baked.store.module)}`,
|
|
592
|
+
`const RATE_LIMIT_STORE = new ${baked.store.factory}(${JSON.stringify(baked.store.options ?? {})})`,
|
|
593
|
+
`const RATE_LIMIT = buildRateLimiter(`,
|
|
594
|
+
` { windowMs: ${baked.windowMs}, max: ${baked.max} },`,
|
|
595
|
+
` RATE_LIMIT_STORE,`,
|
|
596
|
+
`)`
|
|
597
|
+
],
|
|
473
598
|
``,
|
|
474
599
|
`// How many proxies the deployment declared in front of it. \`client-ip.ts\` reads a forwarded`,
|
|
475
600
|
`// header only when this says one wrote it: the header is whatever the client typed, so`,
|
|
@@ -515,7 +640,13 @@ function rateLimitCheckFragment(rateLimit, indent, args = "request, server", ref
|
|
|
515
640
|
`${indent}if (caller === undefined) {`,
|
|
516
641
|
`${indent} ${refuseUnnamed}`,
|
|
517
642
|
`${indent}}`,
|
|
518
|
-
|
|
643
|
+
// B-257 — the call side of the pair. `deployedRateLimitFragment` emits the DECLARATION; this
|
|
644
|
+
// emits the CALL, and the two branch on the same fact or the entry names a symbol it never
|
|
645
|
+
// declared. A durable limiter returns a promise; the sync facade does not.
|
|
646
|
+
// B-262 — `await` unconditionally. `buildRateLimiter` is always async, so this line no longer
|
|
647
|
+
// asks what the config declared. The conditional it replaces is where B-257's defect lived:
|
|
648
|
+
// a Promise read for `limited` is always `undefined`, always falsy, and every request passes.
|
|
649
|
+
`${indent}const limit = await RATE_LIMIT(caller)`,
|
|
519
650
|
`${indent}if (limit.limited) {`,
|
|
520
651
|
`${indent} ${refuse}`,
|
|
521
652
|
`${indent}}`
|
|
@@ -596,4 +727,4 @@ export {
|
|
|
596
727
|
deployedRuntimeConfigFragment,
|
|
597
728
|
deployedTraceFragment
|
|
598
729
|
};
|
|
599
|
-
//# sourceMappingURL=chunk-
|
|
730
|
+
//# sourceMappingURL=chunk-C5CAL3DX.js.map
|