theokit 0.76.2 → 0.77.0
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/README.md +59 -0
- package/dist/{actions-virtual-module-52O6HJZT.js → actions-virtual-module-UIX5YWZR.js} +4 -4
- package/dist/{actions-virtual-module-HS4W7HQU.js → actions-virtual-module-V5Q4XVL5.js} +2 -2
- package/dist/add-DOR7HORT.js +23 -0
- package/dist/{agent-HCK5RHH7.js → agent-MJWQRSJ2.js} +2 -2
- package/dist/{app-typed-client-CJCOALMM.js → app-typed-client-6FQB5FQO.js} +4 -4
- package/dist/{app-typed-client-BWITJLJA.js → app-typed-client-JCBQGPMP.js} +2 -2
- package/dist/{build-Y3CWTWP6.js → build-QDZEOCJ3.js} +4 -4
- package/dist/{chunk-W2I6L4IJ.js → chunk-35OI2TKT.js} +2 -2
- package/dist/{chunk-OIYSUQM7.js → chunk-3TCWOHLY.js} +4 -2
- package/dist/{chunk-OIYSUQM7.js.map → chunk-3TCWOHLY.js.map} +1 -1
- package/dist/{chunk-UQQQ3V43.js → chunk-3XR6CBUA.js} +65 -5
- package/dist/chunk-3XR6CBUA.js.map +1 -0
- package/dist/{chunk-BTDTHXUI.js → chunk-BFDEEJOK.js} +1 -1
- package/dist/{chunk-BTDTHXUI.js.map → chunk-BFDEEJOK.js.map} +1 -1
- package/dist/{chunk-XI4FALFZ.js → chunk-E22GPCCO.js} +24 -1
- package/dist/chunk-E22GPCCO.js.map +1 -0
- package/dist/{chunk-OED37LE5.js → chunk-GNV34JMI.js} +37 -3
- package/dist/chunk-GNV34JMI.js.map +1 -0
- package/dist/{chunk-2SGNODVJ.js → chunk-HNALEGOL.js} +40 -10
- package/dist/chunk-HNALEGOL.js.map +1 -0
- package/dist/{chunk-ZQJORKBM.js → chunk-HZAXFD55.js} +49 -2
- package/dist/chunk-HZAXFD55.js.map +1 -0
- package/dist/{add-3VLFUPF4.js → chunk-JVXDEIT4.js} +15 -12
- package/dist/chunk-JVXDEIT4.js.map +1 -0
- package/dist/{chunk-PVCXREGE.js → chunk-KQBY62AE.js} +2 -2
- package/dist/{chunk-BXQCJJPT.js → chunk-N5YHENWJ.js} +2 -2
- package/dist/{chunk-FEK25JUL.js → chunk-OKFRGAYZ.js} +67 -9
- package/dist/chunk-OKFRGAYZ.js.map +1 -0
- package/dist/{chunk-XDLFOATW.js → chunk-OSSNCUS6.js} +4 -4
- package/dist/{chunk-C2BRSL4W.js → chunk-PQWVT6JC.js} +11 -1
- package/dist/{chunk-C2BRSL4W.js.map → chunk-PQWVT6JC.js.map} +1 -1
- package/dist/{chunk-47FFT43U.js → chunk-YH5CDWLU.js} +25 -1
- package/dist/chunk-YH5CDWLU.js.map +1 -0
- package/dist/cli/index.js +12 -12
- package/dist/{db-ZWDKD57T.js → db-5WOK6HA2.js} +3 -3
- package/dist/{define-middleware-BOHpPOBs.d.ts → define-middleware-D7LFaTv-.d.ts} +27 -2
- package/dist/{dev-R2ZYHZV4.js → dev-N5LQFLBR.js} +9 -7
- package/dist/dev-N5LQFLBR.js.map +1 -0
- package/dist/{generate-ORWEIXCL.js → generate-OA5ARO3P.js} +120 -52
- package/dist/generate-OA5ARO3P.js.map +1 -0
- package/dist/{index-DfsJ3Qhk.d.ts → index-C2lcEI-4.d.ts} +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{info-IPMW56PI.js → info-ELSPSCXK.js} +3 -3
- package/dist/{internal-api-6RAOYIET.js → internal-api-5FTPYSEQ.js} +2 -2
- package/dist/{internal-api-YGFPLQ4E.js → internal-api-H3C2ID6N.js} +4 -4
- package/dist/{job-backend-WvUs5rO1.d.ts → job-backend-BX-PwnZW.d.ts} +25 -0
- package/dist/{load-config-USRR4GXP.js → load-config-SKLFH7YL.js} +3 -3
- package/dist/{mcp-FBXEX45H.js → mcp-3ENI2IPS.js} +3 -3
- package/dist/{openapi-CA3E3LZH.js → openapi-OVXYHZ2S.js} +3 -3
- package/dist/{preview-DLIVPM7A.js → preview-GP6J6IGJ.js} +3 -3
- package/dist/{routes-BJ7GGRCV.js → routes-UNJ77IQU.js} +3 -3
- package/dist/{schema-FBM2UH72.js → schema-2EAIJFWA.js} +2 -2
- package/dist/server/define/index.d.ts +5 -4
- package/dist/server/define/index.js +1 -1
- package/dist/server/http/index.d.ts +4 -3
- package/dist/server/http/index.js +3 -3
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +7 -5
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.d.ts +75 -6
- package/dist/server/jobs/index.js +4 -2
- package/dist/{server-boundary-EKIGYL7B.js → server-boundary-5ZTBC2KF.js} +2 -2
- package/dist/{server-boundary-IDWIB24L.js → server-boundary-DTF6ZEUO.js} +4 -4
- package/dist/{start-LNT5UVSY.js → start-EJFYT7ZU.js} +13 -37
- package/dist/start-EJFYT7ZU.js.map +1 -0
- package/dist/vite-plugin/index.js +5 -4
- package/dist/{vite-plugin-LE42ZIGV.js → vite-plugin-MNZHNOM4.js} +6 -6
- package/dist/vite-plugin-MNZHNOM4.js.map +1 -0
- package/package.json +1 -1
- package/dist/add-3VLFUPF4.js.map +0 -1
- package/dist/chunk-2SGNODVJ.js.map +0 -1
- package/dist/chunk-47FFT43U.js.map +0 -1
- package/dist/chunk-FEK25JUL.js.map +0 -1
- package/dist/chunk-OED37LE5.js.map +0 -1
- package/dist/chunk-UQQQ3V43.js.map +0 -1
- package/dist/chunk-XI4FALFZ.js.map +0 -1
- package/dist/chunk-ZQJORKBM.js.map +0 -1
- package/dist/dev-R2ZYHZV4.js.map +0 -1
- package/dist/generate-ORWEIXCL.js.map +0 -1
- package/dist/start-LNT5UVSY.js.map +0 -1
- /package/dist/{actions-virtual-module-52O6HJZT.js.map → actions-virtual-module-UIX5YWZR.js.map} +0 -0
- /package/dist/{actions-virtual-module-HS4W7HQU.js.map → actions-virtual-module-V5Q4XVL5.js.map} +0 -0
- /package/dist/{agent-HCK5RHH7.js.map → add-DOR7HORT.js.map} +0 -0
- /package/dist/{internal-api-6RAOYIET.js.map → agent-MJWQRSJ2.js.map} +0 -0
- /package/dist/{app-typed-client-CJCOALMM.js.map → app-typed-client-6FQB5FQO.js.map} +0 -0
- /package/dist/{app-typed-client-BWITJLJA.js.map → app-typed-client-JCBQGPMP.js.map} +0 -0
- /package/dist/{build-Y3CWTWP6.js.map → build-QDZEOCJ3.js.map} +0 -0
- /package/dist/{chunk-W2I6L4IJ.js.map → chunk-35OI2TKT.js.map} +0 -0
- /package/dist/{chunk-PVCXREGE.js.map → chunk-KQBY62AE.js.map} +0 -0
- /package/dist/{chunk-BXQCJJPT.js.map → chunk-N5YHENWJ.js.map} +0 -0
- /package/dist/{chunk-XDLFOATW.js.map → chunk-OSSNCUS6.js.map} +0 -0
- /package/dist/{db-ZWDKD57T.js.map → db-5WOK6HA2.js.map} +0 -0
- /package/dist/{info-IPMW56PI.js.map → info-ELSPSCXK.js.map} +0 -0
- /package/dist/{load-config-USRR4GXP.js.map → internal-api-5FTPYSEQ.js.map} +0 -0
- /package/dist/{internal-api-YGFPLQ4E.js.map → internal-api-H3C2ID6N.js.map} +0 -0
- /package/dist/{schema-FBM2UH72.js.map → load-config-SKLFH7YL.js.map} +0 -0
- /package/dist/{mcp-FBXEX45H.js.map → mcp-3ENI2IPS.js.map} +0 -0
- /package/dist/{openapi-CA3E3LZH.js.map → openapi-OVXYHZ2S.js.map} +0 -0
- /package/dist/{preview-DLIVPM7A.js.map → preview-GP6J6IGJ.js.map} +0 -0
- /package/dist/{routes-BJ7GGRCV.js.map → routes-UNJ77IQU.js.map} +0 -0
- /package/dist/{vite-plugin-LE42ZIGV.js.map → schema-2EAIJFWA.js.map} +0 -0
- /package/dist/{server-boundary-EKIGYL7B.js.map → server-boundary-5ZTBC2KF.js.map} +0 -0
- /package/dist/{server-boundary-IDWIB24L.js.map → server-boundary-DTF6ZEUO.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/generate.ts","../src/cli/commands/generate-containment.ts","../src/cli/commands/generate-names.ts","../src/cli/commands/generate-policy-placeholder.ts","../src/cli/commands/generate-resource.ts","../src/cli/commands/generate-sandbox.ts","../src/cli/commands/generate-schedule.ts","../src/server/cron/define-cron.ts","../src/cli/commands/generate-types.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, posix, resolve } from 'node:path'\n\nimport { loadConfig } from '../../config/load-config.js'\n\nimport { detectProjectPackageManager, type PackageManager } from './add.js'\nimport { pathTraversalRefusal } from './generate-containment.js'\nimport { toCamelCase, toPascalCase } from './generate-names.js'\nimport {\n UNDECIDED_POLICY_IDENT,\n undecidedPolicyDeclaration,\n} from './generate-policy-placeholder.js'\nimport { generateResource } from './generate-resource.js'\nimport { generateSandboxTemplate } from './generate-sandbox.js'\nimport { resolveScheduleTarget } from './generate-schedule.js'\nimport {\n VALID_TYPES,\n type GeneratorType,\n type GenerateOptions,\n type GenerateResult,\n type GenerateStatus,\n} from './generate-types.js'\n\nexport {}\n\nfunction toKebabCase(name: string): boolean {\n return /^[a-z][a-z0-9/-]*$/.test(name)\n}\n\n/**\n * Reserved JS identifier names that conflict with object prototype machinery\n * or would shadow built-in module shapes if used as action/route names.\n * Mirrors action-scan's RESERVED_NAMES (T1.4).\n */\nconst RESERVED_BASENAMES = new Set([\n 'index',\n 'constructor',\n '__proto__',\n 'prototype',\n 'hasOwnProperty',\n])\n\n/**\n * Validate that a name segment doesn't hit the reserved-identifier list.\n * Checks the BASENAME (last `/` segment) — nested `admin/constructor` still\n * rejected because the file `constructor.ts` would be the conflict.\n */\nfunction hasReservedSegment(name: string): boolean {\n const basename = name.includes('/') ? (name.split('/').pop() ?? name) : name\n return RESERVED_BASENAMES.has(basename)\n}\n\nfunction generateRouteTemplate(name: string, displayPath: string): string {\n return [\n `import { route, type AccessDecision } from 'theokit/server/define'`,\n `import { z } from 'zod'`,\n ``,\n ...undecidedPolicyDeclaration(displayPath, 'a stub today is a real handler tomorrow'),\n ``,\n `export const GET = route()`,\n ` .policy(${UNDECIDED_POLICY_IDENT})`,\n ` .handler(({ ctx }) => {`,\n ` return { message: 'TODO: implement ${name} GET' }`,\n ` })`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n\nfunction generateControllerTemplate(name: string, displayPath: string): string {\n const className = toPascalCase(name) + 'Controller'\n return [\n `// AUTO-GENERATED by \\`theokit generate controller ${name}\\``,\n `import { Controller, Get, UseGuards, type CanActivate } from '@theokit/http'`,\n ``,\n `// TODO(policy): every controller route declares who may call it (ADR 0001), and \\`theokit build\\``,\n `// refuses one that does not. Generated as a REFUSAL (403) rather than @Public(), because the`,\n `// generator cannot know your access model. Replace @UseGuards(UndecidedAccess) in`,\n `// ${displayPath} with your own guard, or with @Public() if the routes are genuinely open,`,\n `// then delete this class.`,\n `class UndecidedAccess implements CanActivate {`,\n ` canActivate(): boolean {`,\n ` return false`,\n ` }`,\n `}`,\n ``,\n `// Served at /api/${name.replace(/\\//g, '-')}: @Controller() infers the prefix from the class name.`,\n `@Controller()`,\n `@UseGuards(UndecidedAccess)`,\n `export class ${className} {`,\n ` @Get()`,\n ` findAll(): string {`,\n ` return 'This action returns all ${name}'`,\n ` }`,\n `}`,\n ``,\n ].join('\\n')\n}\n\nfunction generateActionTemplate(name: string): string {\n const camel = toCamelCase(name)\n return [\n `import { action } from 'theokit/server/define'`,\n `import { z } from 'zod'`,\n ``,\n `export const ${camel} = action()`,\n ` .input(z.object({}))`,\n ` .handler(({ input, ctx }) => {`,\n ` return { message: 'TODO: implement ${name}' }`,\n ` })`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n\n/**\n * Co-located test template for `theokit generate action <name>` (T5.2 +\n * plan Q4 scenario 1: roundtrip serialize). Skeleton uses vitest BDD shape\n * per testing.md.\n */\nfunction generateAgentTemplate(name: string, displayPath: string): string {\n return [\n `import { AgentBuilder } from '@theokit/agents'`,\n `import type { AccessDecision } from 'theokit/server/define'`,\n `import { z } from 'zod'`,\n ``,\n `// Zero-config: this file is auto-served at POST /api/agents/${name}.`,\n `// Add tools with tool('name')...build() and chain them via .tool(...).`,\n ``,\n ...undecidedPolicyDeclaration(displayPath, 'an agent endpoint runs a model on your key'),\n `export const policy = ${UNDECIDED_POLICY_IDENT}`,\n ``,\n `export default AgentBuilder.create()`,\n ` .input(z.object({ message: z.string() }))`,\n ` .model('openai/gpt-4o-mini')`,\n ` .system('You are a helpful ${name} assistant.')`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n\nfunction generateToolboxTemplate(name: string): string {\n const camel = toCamelCase(name)\n return [\n `import { tool } from 'theokit/server/define'`,\n `import { z } from 'zod'`,\n ``,\n `export const ${camel}Hello = tool('${name}_hello')`,\n ` .describe('Say hello')`,\n ` .input(z.object({ name: z.string() }))`,\n ` .execute(({ name }) => \\`Hello, \\${name}!\\`)`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n\nfunction generateWorkflowTemplate(name: string): string {\n const camel = toCamelCase(name)\n return [\n `import { Workflow, fn } from '@theokit/sdk/workflow'`,\n ``,\n `/**`,\n ` * A minimal workflow — a typed, multi-step pipeline (@theokit/sdk). Each \\`fn(...)\\` step is a pure`,\n ` * function; a step can also run an agent via \\`agentStep(name, agent, mapInput)\\`. Import + run it from`,\n ` * a route, action, cron job, or tool:`,\n ` *`,\n ` * const run = await ${camel}Workflow.run({ name: 'Ada' })`,\n ` * console.log(run.status, run.output) // 'completed' 'Hello, Ada!'`,\n ` */`,\n `export const ${camel}Workflow = Workflow.create({ name: '${name}' })`,\n ` .then(fn('normalize', (input: { name: string }) => ({ name: input.name.trim() })))`,\n ` .then(fn('greet', (step: { name: string }) => \\`Hello, \\${step.name}!\\`))`,\n ` .commit()`,\n ``,\n ].join('\\n')\n}\n\nfunction generateEvalTemplate(name: string): string {\n const camel = toCamelCase(name)\n return [\n `import { Eval, Scorers } from '@theokit/sdk/eval'`,\n ``,\n `/**`,\n ` * An eval for your agent (@theokit/sdk) — runs the model over a dataset and scores each output.`,\n ` * To score the REAL agent, mirror its config: point \\`agent.model\\` (and, ideally, a \\`systemPrompt\\`)`,\n ` * at the same values your \\`agents/chat.ts\\` uses. Run it (needs a provider key in the environment):`,\n ` *`,\n ` * const run = await ${camel}Eval.run()`,\n ` * console.log(run.aggregate.meanScore)`,\n ` */`,\n `export const ${camel}Eval = Eval.create({`,\n ` name: '${name}',`,\n ` dataset: [{ input: 'Say ok', expected: 'ok' }],`,\n ` scorers: [Scorers.containsExpected({ caseSensitive: false })],`,\n ` // Mirror your agent: same model (+ systemPrompt) so this evaluates the agent your users talk to.`,\n ` agent: { apiKey: process.env.OPENROUTER_API_KEY ?? '', model: { id: 'openai/gpt-4o-mini' } },`,\n `})`,\n ``,\n ].join('\\n')\n}\n\nfunction generateMemoryTemplate(_name: string): string {\n return [\n `/**`,\n ` * Conversation memory — nothing to wire.`,\n ` *`,\n ` * Since @theokit/sdk 4.0, every agent session persists AUTOMATICALLY to a native Claude-shaped`,\n ` * transcript. TheoKit roots it at your app under \\`.data/agent-sessions/projects/<cwd>/<agentId>.jsonl\\`,`,\n ` * keyed by the conversation's session id — a same-session follow-up request resumes prior turns with`,\n ` * zero setup. There is no storage adapter to construct or pass to the agent anymore.`,\n ` *`,\n ` * Keep these transcripts out of git — add \\`.data/\\` to your \\`.gitignore\\`.`,\n ` *`,\n ` * Advanced: to change WHERE sessions are written (e.g. \\`~/.claude\\` so the Claude Code CLI can`,\n ` * \\`--continue\\` them), set the SDK's \\`local.baseDir\\` where you create the agent. Most apps never need to.`,\n ` */`,\n `export {}`,\n ``,\n ].join('\\n')\n}\n\n/** The project directories from `theo.config.ts`, each relative to the project root. */\ninterface ProjectLayout {\n appDir: string\n serverDir: string\n agentsDir: string\n}\n\n/** Where a single-file kind is written, relative to the project root, and what it says. */\ninterface SingleFileKind {\n path: (name: string, layout: ProjectLayout) => string\n /** `displayPath` is the project-relative path, for a template that names its own file. */\n template: (name: string, displayPath: string) => string\n}\n\n/**\n * The single-file kinds. `resource` writes several files and `schedule` checks more than its\n * directory, so neither is here. Every path starts from a directory `theo.config.ts` declares: the\n * scaffold puts them under `src/`, and a hardcoded `server/` wrote files no scanner reads (#1031).\n */\nconst SINGLE_FILE_KINDS: Partial<Record<GeneratorType, SingleFileKind>> = {\n // Agent-capability generators. These live UNDER `agentsDir` — they are facets of the agent\n // domain, not standalone top-level concerns — and the folder-semantic scanner treats each as\n // composition (never a phantom route).\n workflow: {\n path: (name, { agentsDir }) => posix.join(agentsDir, 'workflows', `${name}.ts`),\n template: generateWorkflowTemplate,\n },\n eval: {\n path: (name, { agentsDir }) => posix.join(agentsDir, 'evals', `${name}.ts`),\n template: generateEvalTemplate,\n },\n sandbox: {\n path: (name, { agentsDir }) => posix.join(agentsDir, 'sandbox', `${name}.ts`),\n template: generateSandboxTemplate,\n },\n memory: {\n path: (name, { agentsDir }) => posix.join(agentsDir, 'memory', `${name}.ts`),\n template: generateMemoryTemplate,\n },\n route: {\n path: (name, { serverDir }) => posix.join(serverDir, 'routes', `${name}.ts`),\n template: generateRouteTemplate,\n },\n action: {\n path: (name, { serverDir }) => posix.join(serverDir, 'actions', `${name}.ts`),\n template: generateActionTemplate,\n },\n page: {\n path: (name, { appDir }) => posix.join(appDir, name, 'page.tsx'),\n template: generatePageTemplate,\n },\n ws: {\n path: (name, { serverDir }) => posix.join(serverDir, 'ws', `${name}.ts`),\n template: generateWsTemplate,\n },\n controller: {\n path: (name, { serverDir }) => posix.join(serverDir, 'controllers', `${name}.controller.ts`),\n template: generateControllerTemplate,\n },\n // `<agentsDir>/<name>.ts` is what the agent scanner serves at `/api/agents/<name>`, the URL the\n // template promises. The old `server/agents/<name>.agent.ts` was outside `agentsDir` in both the\n // flat and the scaffold layout, so the agent was never served.\n agent: {\n path: (name, { agentsDir }) => posix.join(agentsDir, `${name}.ts`),\n template: generateAgentTemplate,\n },\n toolbox: {\n path: (name, { serverDir }) => posix.join(serverDir, 'toolboxes', `${name}.tools.ts`),\n template: generateToolboxTemplate,\n },\n}\n\n/** The project layout from `theo.config.ts`, or the refusal naming why it could not be read. */\nasync function readLayout(cwd: string): Promise<ProjectLayout | GenerateResult> {\n try {\n const { appDir, serverDir, agentsDir } = await loadConfig(cwd)\n return { appDir, serverDir, agentsDir }\n } catch (err) {\n return {\n status: 'invalid_config',\n message: `Cannot read ${resolve(cwd, 'theo.config.ts')}: ${(err as Error).message}`,\n }\n }\n}\n\nasync function resolveTemplate(\n cwd: string,\n kind: GeneratorType,\n name: string,\n): Promise<Target | GenerateResult | null> {\n const spec = SINGLE_FILE_KINDS[kind]\n if (spec === undefined) return null\n const layout = await readLayout(cwd)\n if ('status' in layout) return layout\n const displayPath = spec.path(name, layout)\n return { filePath: resolve(cwd, displayPath), content: spec.template(name, displayPath) }\n}\n\nfunction generateActionTestTemplate(name: string): string {\n const camel = toCamelCase(name)\n return [\n `import { describe, it, expect } from 'vitest'`,\n ``,\n `import { ${camel} } from './${name.split('/').pop()}.js'`,\n ``,\n `describe('${name} action', () => {`,\n ` it('should accept a valid input shape', () => {`,\n ` expect(${camel}.input).toBeDefined()`,\n ` expect(typeof ${camel}.handler).toBe('function')`,\n ` })`,\n ``,\n ` it('should reject invalid input via zod schema', () => {`,\n ` const parsed = ${camel}.input.safeParse({ __invalid: true })`,\n ` // Empty object schema accepts {}; tighten this assertion when adding fields.`,\n ` expect(parsed.success).toBe(true)`,\n ` })`,\n `})`,\n ``,\n ].join('\\n')\n}\n\nfunction generatePageTemplate(name: string): string {\n const pascal = toPascalCase(name)\n return [`export default function ${pascal}Page() {`, ` return <h1>${pascal}</h1>`, `}`, ``].join(\n '\\n',\n )\n}\n\nfunction generateWsTemplate(_name: string): string {\n // `websocket()` is the public builder. The `defineWebSocket` this template used to import is not\n // exported by any public entry point, so the generated file failed to load.\n return [\n `import { websocket } from 'theokit/server/define'`,\n ``,\n `export default websocket()`,\n ` .onMessage((ws, data) => {`,\n ` ws.send(\\`echo: \\${data}\\`)`,\n ` })`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n\n/** A file to write: where it goes and what it says. */\ninterface Target {\n filePath: string\n content: string\n}\n\n/** Whether `value` names a generator kind. */\nfunction isGeneratorType(value: string): value is GeneratorType {\n return (VALID_TYPES as readonly string[]).includes(value)\n}\n\n/**\n * The refusal for options `generate` cannot act on: not a project, an unknown kind, a name that is\n * not kebab-case, or a reserved basename. `undefined` when the options are acceptable.\n */\nfunction refuseOptions({ cwd, type, name }: GenerateOptions): GenerateResult | undefined {\n if (!existsSync(resolve(cwd, 'theo.config.ts')) && !existsSync(resolve(cwd, 'theo.config.js'))) {\n return {\n status: 'not_a_project',\n message: 'Not a Theo project. cwd has no theo.config.ts or theo.config.js',\n }\n }\n\n if (!isGeneratorType(type)) {\n return {\n status: 'invalid_kind',\n message: `Invalid generator type \"${type}\". Available: ${VALID_TYPES.join(', ')}`,\n }\n }\n\n if (!name || !toKebabCase(name)) {\n return {\n status: 'invalid_name',\n message: `Invalid name \"${name}\". Use kebab-case: lowercase letters, numbers, hyphens. Example: my-route`,\n }\n }\n\n // EC-2-related: reject reserved JS identifier basenames (would shadow\n // built-in prototype machinery in virtual module emit or scan).\n if (hasReservedSegment(name)) {\n return {\n status: 'invalid_name',\n message: `Reserved name \"${name}\" — basename collides with built-in identifier (index/constructor/__proto__/prototype/hasOwnProperty).`,\n }\n }\n return undefined\n}\n\n/** Where a single-file kind goes and what it says, or the refusal that explains why it cannot. */\nasync function resolveTarget(\n cwd: string,\n type: GeneratorType,\n name: string,\n): Promise<Target | GenerateResult> {\n // A schedule's directory comes from the project config, so resolving it is async and may refuse.\n if (type === 'schedule') return resolveScheduleTarget(cwd, name)\n const target = await resolveTemplate(cwd, type, name)\n if (target === null) return { status: 'invalid_kind', message: `Unknown type: ${type}` }\n return target\n}\n\n/** Write `target` unless it escapes the project or already exists. */\nfunction writeTarget(\n cwd: string,\n type: GeneratorType,\n name: string,\n { filePath, content }: Target,\n): GenerateResult {\n // EC-4: confirm the resolved filePath stays inside cwd. `toKebabCase` rejects most traversal\n // vectors in the name, but a directory read from config (`agentsDir`) can still point outside.\n const escaped = pathTraversalRefusal(cwd, filePath)\n if (escaped !== undefined) return escaped\n\n if (existsSync(filePath)) {\n return { status: 'already_exists', filePath, kind: type, name }\n }\n\n mkdirSync(dirname(filePath), { recursive: true })\n writeFileSync(filePath, content)\n\n // T5.2 + plan Q4: emit co-located test file alongside actions (only\n // for action type; routes/pages/ws keep prior single-file behavior).\n // Skip if existing test file present (preserve user-customized tests).\n if (type === 'action') {\n const testPath = filePath.replace(/\\.ts$/, '.test.ts')\n if (!existsSync(testPath)) {\n writeFileSync(testPath, generateActionTestTemplate(name))\n }\n }\n\n if (type === 'controller') {\n const message = controllerDependencyNotice(cwd)\n if (message !== undefined) return { status: 'created', filePath, kind: type, name, message }\n }\n return { status: 'created', filePath, kind: type, name }\n}\n\n/**\n * What a controller build needs from the project. The generated file imports `@theokit/http`,\n * which declares `reflect-metadata` as a required peer. `@theokit/http` sends every controller\n * through SWC (`transformControllerSource`) and asks for `@swc/core`, an optional peer, so the\n * build fails without it even for a controller with no parameter decorators.\n */\nconst CONTROLLER_DEPENDENCIES = ['@theokit/http', 'reflect-metadata'] as const\nconst CONTROLLER_DEV_DEPENDENCIES = ['@swc/core'] as const\n\n/**\n * The install command for the packages a controller build needs that `package.json` does not\n * declare, or `undefined` when it declares them all.\n *\n * It reads what the project declares, not what resolves. `theokit` and `@theokit/agents` depend\n * on `@theokit/http`, so npm hoists it into the app's `node_modules` and a resolution check\n * always passed there, while `@swc/core` was missing and `theokit build` failed (#986).\n */\nfunction controllerDependencyNotice(cwd: string): string | undefined {\n const declared = declaredPackages(cwd)\n const missing = CONTROLLER_DEPENDENCIES.filter((pkg) => !declared.names.has(pkg))\n const missingDev = CONTROLLER_DEV_DEPENDENCIES.filter((pkg) => !declared.names.has(pkg))\n if (missing.length === 0 && missingDev.length === 0) return undefined\n\n const pm = detectProjectPackageManager(cwd)\n const commands = [\n ...(missing.length > 0 ? [installCommand(pm, missing, false)] : []),\n ...(missingDev.length > 0 ? [installCommand(pm, missingDev, true)] : []),\n ]\n return [\n `A controller build needs ${[...missing, ...missingDev].join(', ')}, which ${declared.source} does not declare.`,\n `Install before running the app: ${commands.join(' && ')}`,\n ].join(' ')\n}\n\nfunction installCommand(pm: PackageManager, packages: readonly string[], dev: boolean): string {\n const verb = pm === 'npm' ? 'install' : 'add'\n return [pm, verb, ...(dev ? ['-D'] : []), ...packages].join(' ')\n}\n\n/**\n * The package names `package.json` lists under `dependencies` or `devDependencies`, and how to\n * name the file in the notice. A missing or unreadable file declares nothing, and the notice says\n * why, so the user sees the problem rather than an install list that looks wrong.\n */\nfunction declaredPackages(cwd: string): { names: Set<string>; source: string } {\n const path = resolve(cwd, 'package.json')\n if (!existsSync(path)) return { names: new Set(), source: 'the project (it has no package.json)' }\n let manifest: unknown\n try {\n manifest = JSON.parse(readFileSync(path, 'utf-8'))\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n return { names: new Set(), source: `package.json (it does not parse: ${reason})` }\n }\n const names = new Set<string>()\n if (typeof manifest === 'object' && manifest !== null) {\n for (const field of ['dependencies', 'devDependencies'] as const) {\n const listed = (manifest as Record<string, unknown>)[field]\n if (typeof listed === 'object' && listed !== null) {\n for (const pkg of Object.keys(listed)) names.add(pkg)\n }\n }\n }\n return { names, source: 'package.json' }\n}\n\n/**\n * Programmatic generate. Returns a structured result instead of throwing —\n * Studio (`theokit_generate` tool) consumes this directly. The CLI wrapper\n * below maps the structured result to console output + exit code semantics.\n */\nexport async function generate(opts: GenerateOptions): Promise<GenerateResult> {\n const refused = refuseOptions(opts)\n if (refused !== undefined) return refused\n const { cwd, name } = opts\n // refuseOptions refused every value that is not a generator kind.\n const kind = opts.type as GeneratorType\n\n // Resource generates multiple files — handle separately\n if (kind === 'resource') {\n const layout = await readLayout(cwd)\n if ('status' in layout) return layout\n return generateResource(cwd, name, opts.fields ?? [], layout.serverDir)\n }\n\n const resolved = await resolveTarget(cwd, kind, name)\n if ('status' in resolved) return resolved\n return writeTarget(cwd, kind, name, resolved)\n}\n\n/** The statuses the CLI reports by throwing, and the message each throws. */\nconst CLI_REFUSALS: Record<\n Exclude<GenerateStatus, 'created' | 'already_exists'>,\n (result: GenerateResult, name: string) => string\n> = {\n // The generator's own reason when it gave one: `generate resource` refuses a project that HAS a\n // theo.config.ts when the schema file is missing, and the generic text blamed the config (#1022).\n not_a_project: (result) =>\n result.message ?? 'Not a Theo project. Run this from a project root with theo.config.ts',\n invalid_kind: (result) => result.message ?? 'Invalid kind',\n // `generate` returns invalid_name for a malformed name, a reserved name and a path that\n // resolves outside the project; each message says which, so the CLI must not replace it.\n invalid_name: (result, name) => result.message ?? `Invalid name \"${name}\"`,\n invalid_config: (result) => result.message ?? 'Invalid theo.config.ts',\n agent_not_found: (result) => result.message ?? 'No chat agent found',\n}\n\n/**\n * CLI entry point — preserves the original surface (throws + console.log).\n * Wraps the programmatic `generate` function.\n */\nexport async function generateCommand(\n type: string,\n name: string,\n fields?: string[],\n): Promise<void> {\n const result = await generate({ cwd: process.cwd(), type, name, fields })\n if (result.status === 'already_exists') {\n console.log(`\\n ⚠ ${result.filePath} already exists. Skipping.\\n`)\n } else if (result.status === 'created') {\n console.log(`\\n ✓ Created ${type}: ${result.filePath}\\n`)\n if (result.message !== undefined) console.log(` ${result.message}\\n`)\n } else {\n throw new Error(CLI_REFUSALS[result.status](result, name))\n }\n}\n","/**\n * The one rule every generator applies before writing: the file stays inside the project. Shared\n * by `generate` and the schedule generator, which checks it before looking for the chat agent so an\n * `agentsDir` outside the project is refused as traversal, never reported as a missing agent there.\n */\nimport { isAbsolute, relative, resolve, sep } from 'node:path'\n\nimport type { GenerateResult } from './generate-types.js'\n\n/**\n * Whether `filePath` lies strictly inside `cwd`. Decided by `path.relative`, never by a string\n * prefix: `/tmp/x/app-outside/...` starts with `/tmp/x/app` and is still outside it. A null byte,\n * an absolute path and a `..` escape are all outside.\n */\nfunction isPathInside(cwd: string, filePath: string): boolean {\n if (filePath.includes('\\x00')) return false\n const fromRoot = relative(resolve(cwd), filePath)\n return fromRoot !== '' && !isAbsolute(fromRoot) && fromRoot.split(sep)[0] !== '..'\n}\n\n/** The refusal for a `filePath` outside the project at `cwd`, or `undefined` when it is inside. */\nexport function pathTraversalRefusal(cwd: string, filePath: string): GenerateResult | undefined {\n if (isPathInside(cwd, filePath)) return undefined\n return {\n status: 'invalid_name',\n message: `Path traversal denied: \"${filePath}\" is outside the project root ${resolve(cwd)}.`,\n }\n}\n","/** How `theokit generate` turns a name such as `admin/user-profile` into identifiers. */\n\n/** `admin/user-profile` becomes `AdminUserProfile`. */\nexport function toPascalCase(name: string): string {\n return name\n .split(/[-/]/)\n .map((s) => s.charAt(0).toUpperCase() + s.slice(1))\n .join('')\n}\n\n/** `admin/user-profile` becomes `adminUserProfile`. */\nexport function toCamelCase(name: string): string {\n const pascal = toPascalCase(name)\n return pascal.charAt(0).toLowerCase() + pascal.slice(1)\n}\n","/**\n * The access policy a generated route carries until its author decides one.\n *\n * ADR 0001 made an undeclared `policy` a build error because \"a route that nobody had thought\n * about was indistinguishable from a route deliberately left open\". The generators then wrote\n * `'public'` — including on five methods that read and write a database table — so a generated\n * file was the not-thought-about case wearing the deliberate value, which is the precise state\n * the gate exists to make impossible (usetheokit/theokit#416). `theo build` accepted it, because\n * `assertEveryMethodDeclaresPolicy` asks whether a policy was declared, not which one.\n *\n * A generated route now REFUSES. The author still has to write the answer down — the gate's whole\n * purpose — but the value standing in until they do is the safe one rather than the open one.\n *\n * ## Why an AccessDecision and not `() => false`\n *\n * `evaluateRoutePolicy` maps a bare `false` to \"access denied by route policy\", which tells the\n * reader nothing about where to go. The contract already says a denial \"carries its reason so the\n * caller can say it\", so the refusal names its own file: the first `curl` against a forgotten\n * route prints the path to edit.\n *\n * ## Why a named const rather than a lambda per method\n *\n * Five methods would mean five copies, and deleting four of them is the kind of chore that leaves\n * the fifth behind. One const is one thing to replace, and `grep -rn undecidedPolicy` counts the\n * routes still awaiting a decision — which is the number ADR 0001 wanted to make greppable, and\n * which `grep -c \"policy('public')\"` could not give once generated placeholders were mixed in with\n * real decisions.\n */\n\n/** The identifier the generated methods reference. Exported so callers cannot misspell it. */\nexport const UNDECIDED_POLICY_IDENT = 'undecidedPolicy'\n\n/**\n * Lines declaring the placeholder, to splice into a generated module.\n *\n * @param routePath - the generated file's own path, repo-relative, so the refusal can name it\n * @param what - what the route does, in one clause, for the TODO comment\n */\nexport function undecidedPolicyDeclaration(routePath: string, what: string): string[] {\n return [\n `// TODO(policy): every route declares who may call it (ADR 0001). Generated as a REFUSAL`,\n `// rather than 'public', because the generator cannot know your access model —`,\n `// ${what}.`,\n `// Replace this with 'public' if the route is genuinely open, or with a check such as`,\n `// \\`({ subject, params }) => requireOwner(subject, ownerOf(params.id))\\`, then delete the const.`,\n `const ${UNDECIDED_POLICY_IDENT} = (): AccessDecision => ({`,\n ` allowed: false,`,\n ` reason:`,\n ` '${routePath} still carries the policy the generator wrote, which refuses everyone. ' +`,\n ` 'Declare who may call this route (ADR 0001).',`,\n `})`,\n ]\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, join, resolve } from 'node:path'\n\nimport {\n UNDECIDED_POLICY_IDENT,\n undecidedPolicyDeclaration,\n} from './generate-policy-placeholder.js'\nimport type { GenerateResult } from './generate-types.js'\n\n// --- Field parsing ---\n\nconst ALLOWED_FIELD_TYPES = new Set(['string', 'text', 'number', 'boolean'])\nconst RESERVED_FIELDS = new Set(['id', 'createdAt', 'created_at'])\n\ninterface ResourceField {\n name: string\n type: 'string' | 'text' | 'number' | 'boolean'\n zodType: string\n}\n\nfunction parseResourceFields(args: string[]): ResourceField[] {\n if (args.length === 0) {\n throw new Error(\n 'Resource requires at least one field. Example: theokit generate resource posts title:string',\n )\n }\n return args.map((arg) => {\n const parts = arg.split(':')\n if (parts.length !== 2 || !parts[0] || !parts[1]) {\n throw new Error(`Invalid field \"${arg}\". Use name:type format (e.g. title:string)`)\n }\n const [name, type] = parts\n if (!ALLOWED_FIELD_TYPES.has(type)) {\n throw new Error(\n `Unknown field type \"${type}\" in \"${arg}\". Valid types: ${[...ALLOWED_FIELD_TYPES].join(', ')}`,\n )\n }\n if (RESERVED_FIELDS.has(name)) {\n throw new Error(`Field \"${name}\" is reserved (auto-generated by the framework)`)\n }\n const fieldType = type as ResourceField['type']\n return {\n name,\n type: fieldType,\n zodType: mapZodType(fieldType),\n }\n })\n}\n\n// --- Dialects ---\n\n/**\n * The SQL dialects the generator writes code for. Drizzle's synchronous SQLite drivers expose\n * `.all()`/`.get()`/`.run()` on a query; the Postgres drivers do not, so the two need different\n * table builders AND different handler bodies (usetheokit/theokit#1022).\n */\ntype ResourceDialect = 'sqlite' | 'postgresql'\n\ninterface DialectSpec {\n /** The Drizzle module the table builders come from. */\n readonly module: string\n /** A minimal `<serverDir>/db/index.ts` exporting `db`, shown when the project has none. */\n readonly dbIndexExample: readonly string[]\n /** Matches an existing named import from `module`; group 1 is the list of names. */\n readonly importPattern: RegExp\n /** The table builder function. */\n readonly table: string\n /** Every column builder the generated table may use, imported up front. */\n readonly columns: readonly string[]\n readonly idColumn: string\n readonly createdAtColumn: readonly string[]\n readonly column: (name: string, type: ResourceField['type']) => string\n}\n\nconst DIALECTS: Record<ResourceDialect, DialectSpec> = {\n sqlite: {\n module: 'drizzle-orm/sqlite-core',\n dbIndexExample: [\n `import Database from 'better-sqlite3'`,\n `import { drizzle } from 'drizzle-orm/better-sqlite3'`,\n `import * as schema from './schema.js'`,\n `export const db = drizzle(new Database('data.db'), { schema })`,\n ],\n importPattern: /import\\s*\\{([^}]*)\\}\\s*from\\s*['\"]drizzle-orm\\/sqlite-core['\"]/,\n table: 'sqliteTable',\n columns: ['integer', 'text'],\n idColumn: `integer('id').primaryKey({ autoIncrement: true })`,\n createdAtColumn: [\n `text('created_at')`,\n ` .notNull()`,\n ` .$defaultFn(() => new Date().toISOString().split('T')[0])`,\n ],\n column: (name, type) => {\n switch (type) {\n case 'string':\n case 'text':\n return `text('${name}').notNull()`\n case 'number':\n return `integer('${name}').notNull()`\n case 'boolean':\n return `integer('${name}', { mode: 'boolean' }).notNull().default(false)`\n }\n },\n },\n postgresql: {\n module: 'drizzle-orm/pg-core',\n dbIndexExample: [\n `import pg from 'pg'`,\n `import { drizzle } from 'drizzle-orm/node-postgres'`,\n `import * as schema from './schema.js'`,\n `const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL })`,\n `pool.on('error', (err) => console.warn('[pg] idle client error:', err.message))`,\n `export const db = drizzle(pool, { schema })`,\n ],\n importPattern: /import\\s*\\{([^}]*)\\}\\s*from\\s*['\"]drizzle-orm\\/pg-core['\"]/,\n table: 'pgTable',\n columns: ['boolean', 'integer', 'serial', 'text', 'timestamp'],\n idColumn: `serial('id').primaryKey()`,\n createdAtColumn: [`timestamp('created_at').notNull().defaultNow()`],\n column: (name, type) => {\n switch (type) {\n case 'string':\n case 'text':\n return `text('${name}').notNull()`\n case 'number':\n return `integer('${name}').notNull()`\n case 'boolean':\n return `boolean('${name}').notNull().default(false)`\n }\n },\n },\n}\n\n/** A `dialect:` value in `drizzle.config.ts`, mapped to what the generator does with it. */\nconst DIALECT_ALIASES: Record<string, ResourceDialect | undefined> = {\n sqlite: 'sqlite',\n turso: 'sqlite',\n postgresql: 'postgresql',\n}\n\nconst SCHEMA_IMPORT_DIALECTS: [RegExp, string][] = [\n [/from ['\"]drizzle-orm\\/sqlite-core['\"]/, 'sqlite'],\n [/from ['\"]drizzle-orm\\/pg-core['\"]/, 'postgresql'],\n [/from ['\"]drizzle-orm\\/mysql-core['\"]/, 'mysql'],\n [/from ['\"]drizzle-orm\\/singlestore-core['\"]/, 'singlestore'],\n]\n\n/**\n * The project's dialect: `drizzle.config.ts` says it outright; failing that, the core module the\n * schema already imports from does. A schema that imports from nothing (a fresh file) and no config\n * leaves the historical default, SQLite.\n *\n * @returns the dialect, or the raw name of one the generator cannot write code for.\n */\nfunction detectDialect(cwd: string, schemaSource: string): string {\n const config = readIfPresent(resolve(cwd, 'drizzle.config.ts'))\n if (config !== undefined) {\n const declared = /dialect\\s*:\\s*['\"]([a-z0-9-]+)['\"]/.exec(config)\n if (declared) return declared[1]\n }\n for (const [pattern, dialect] of SCHEMA_IMPORT_DIALECTS) {\n if (pattern.test(schemaSource)) return dialect\n }\n return 'sqlite'\n}\n\nfunction mapZodType(type: ResourceField['type']): string {\n switch (type) {\n case 'string':\n case 'text':\n return 'z.string()'\n case 'number':\n return 'z.number()'\n case 'boolean':\n return 'z.boolean()'\n }\n}\n\n// --- Template generators ---\n\nfunction generateSchemaEntry(\n resourceName: string,\n fields: ResourceField[],\n dialect: DialectSpec,\n): string {\n const [createdAtFirst, ...createdAtRest] = dialect.createdAtColumn\n const cols = [\n ` id: ${dialect.idColumn},`,\n ...fields.map((f) => ` ${f.name}: ${dialect.column(f.name, f.type)},`),\n ` createdAt: ${createdAtFirst}`,\n ...createdAtRest,\n ]\n cols[cols.length - 1] += ','\n return [\n ``,\n `export const ${resourceName} = ${dialect.table}('${resourceName}', {`,\n ...cols,\n `})`,\n ``,\n ].join('\\n')\n}\n\n/**\n * The schema source with the table builders the appended table uses imported. The generator used to\n * append `sqliteTable(...)` with no import at all, so the schema file stopped compiling.\n *\n * An existing named import from the dialect module gains the missing names; without one, an import\n * line goes on top. Names already imported are not repeated.\n */\nfunction withDialectImports(source: string, dialect: DialectSpec): string {\n const needed = [dialect.table, ...dialect.columns]\n const existing = dialect.importPattern.exec(source)\n if (existing) {\n const have = existing[1]\n .split(',')\n .map((n) => n.trim())\n .filter(Boolean)\n const merged = [...new Set([...have, ...needed])].sort((a, b) => a.localeCompare(b))\n return source.replace(existing[0], `import { ${merged.join(', ')} } from '${dialect.module}'`)\n }\n return `import { ${[...needed].sort((a, b) => a.localeCompare(b)).join(', ')} } from '${dialect.module}'\\n${source}`\n}\n\n/**\n * Query expressions per dialect. SQLite's synchronous drivers finish a query with `.all()`, `.get()`\n * or `.run()`; the Postgres drivers return a promise and have none of the three, so the Postgres\n * handlers await the builder and take the first row of `returning()`.\n */\ninterface QueryShapes {\n readonly async: boolean\n list(table: string): string\n insert(table: string): string\n findById(table: string): string\n updateById(table: string): string\n deleteById(table: string): string\n}\n\nconst QUERIES: Record<ResourceDialect, QueryShapes> = {\n sqlite: {\n async: false,\n list: (t) => `db.select().from(${t}).all()`,\n insert: (t) => `db.insert(${t}).values(body).returning().get()`,\n findById: (t) => `db.select().from(${t}).where(eq(${t}.id, params.id)).get()`,\n updateById: (t) => `db.update(${t}).set(body).where(eq(${t}.id, params.id)).returning().get()`,\n deleteById: (t) => `db.delete(${t}).where(eq(${t}.id, params.id)).run()`,\n },\n postgresql: {\n async: true,\n list: (t) => `await db.select().from(${t})`,\n insert: (t) => `(await db.insert(${t}).values(body).returning())[0]`,\n findById: (t) => `(await db.select().from(${t}).where(eq(${t}.id, params.id)))[0]`,\n updateById: (t) =>\n `(await db.update(${t}).set(body).where(eq(${t}.id, params.id)).returning())[0]`,\n deleteById: (t) => `await db.delete(${t}).where(eq(${t}.id, params.id))`,\n },\n}\n\ninterface RouteTemplateInput {\n resourceName: string\n fields: ResourceField[]\n queries: QueryShapes\n /** Project-relative path of the file being written, named by the placeholder policy. */\n displayPath: string\n}\n\nfunction generateRouteIndex({\n resourceName,\n fields,\n queries,\n displayPath,\n}: RouteTemplateInput): string {\n const bodyFields = fields.map((f) => ` ${f.name}: ${f.zodType},`).join('\\n')\n const asyncKw = queries.async ? 'async ' : ''\n return [\n `import { route, type AccessDecision } from 'theokit/server/define'`,\n `import { z } from 'zod'`,\n `import { db } from '../../db/index.js'`,\n `import { ${resourceName} } from '../../db/schema.js'`,\n ``,\n ...undecidedPolicyDeclaration(displayPath, 'these methods read and write a table'),\n ``,\n `export const GET = route()`,\n ` .policy(${UNDECIDED_POLICY_IDENT})`,\n ` .handler(${asyncKw}() => ${queries.list(resourceName)})`,\n ` .build()`,\n ``,\n `export const POST = route()`,\n ` .policy(${UNDECIDED_POLICY_IDENT})`,\n ` .body(`,\n ` z.object({`,\n bodyFields,\n ` }),`,\n ` )`,\n ` .status(201)`,\n ` .handler(${asyncKw}({ body }) => {`,\n ` const result = ${queries.insert(resourceName)}`,\n ` return result`,\n ` })`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n\nfunction generateRouteId({\n resourceName,\n fields,\n queries,\n displayPath,\n}: RouteTemplateInput): string {\n const updateFields = fields.map((f) => ` ${f.name}: ${f.zodType}.optional(),`).join('\\n')\n const asyncKw = queries.async ? 'async ' : ''\n return [\n `import { route, type AccessDecision } from 'theokit/server/define'`,\n `import { z } from 'zod'`,\n `import { db } from '../../db/index.js'`,\n `import { ${resourceName} } from '../../db/schema.js'`,\n `import { eq } from 'drizzle-orm'`,\n ``,\n ...undecidedPolicyDeclaration(\n displayPath,\n 'these methods read, update and delete rows of a table',\n ),\n ``,\n `export const GET = route()`,\n ` .policy(${UNDECIDED_POLICY_IDENT})`,\n ` .params(z.object({ id: z.coerce.number() }))`,\n ` .handler(${asyncKw}({ params }) => {`,\n ` const item = ${queries.findById(resourceName)}`,\n ` if (!item) return new Response(JSON.stringify({ error: 'Not found' }), { status: 404 })`,\n ` return item`,\n ` })`,\n ` .build()`,\n ``,\n `export const PUT = route()`,\n ` .policy(${UNDECIDED_POLICY_IDENT})`,\n ` .params(z.object({ id: z.coerce.number() }))`,\n ` .body(`,\n ` z.object({`,\n updateFields,\n ` }),`,\n ` )`,\n ` .handler(${asyncKw}({ params, body }) => {`,\n ` const result = ${queries.updateById(resourceName)}`,\n ` if (!result) return new Response(JSON.stringify({ error: 'Not found' }), { status: 404 })`,\n ` return result`,\n ` })`,\n ` .build()`,\n ``,\n `export const DELETE = route()`,\n ` .policy(${UNDECIDED_POLICY_IDENT})`,\n ` .params(z.object({ id: z.coerce.number() }))`,\n ` .status(204)`,\n ` .handler(${asyncKw}({ params }) => {`,\n ` ${queries.deleteById(resourceName)}`,\n ` })`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n\nfunction generateTestTemplate(resourceName: string, serverDir: string): string {\n return [\n `import { describe, it, expect } from 'vitest'`,\n ``,\n `describe('${resourceName} API', () => {`,\n ` it('should have a schema defined', async () => {`,\n ` const schema = await import('../${serverDir}/db/schema.js')`,\n ` expect(schema.${resourceName}).toBeDefined()`,\n ` })`,\n ``,\n ` it('should have route handlers', async () => {`,\n ` const index = await import('../${serverDir}/routes/${resourceName}/index.js')`,\n ` expect(index.GET).toBeDefined()`,\n ` expect(index.POST).toBeDefined()`,\n ` })`,\n `})`,\n ``,\n ].join('\\n')\n}\n\n// --- Orchestrator ---\n\n/**\n * Generate a CRUD resource: a table appended to `<serverDir>/db/schema.ts`, two route files under\n * `<serverDir>/routes/<name>/` and a test.\n *\n * @param serverDir - the project-relative `serverDir` from `theo.config.ts`. The generator used to\n * assume `server/`, so in the scaffold (`src/server`) it refused every time.\n */\nfunction readIfPresent(path: string): string | undefined {\n try {\n return readFileSync(path, 'utf-8')\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return undefined\n throw err\n }\n}\n\n/** The files TypeScript resolves `../../db/index.js` to. */\nconst DB_INDEX_FILES = ['index.ts', 'index.tsx', 'index.js']\n\n/** Create `path` only if it does not exist; `false` when it already did. */\nfunction createExclusive(path: string, content: string): boolean {\n try {\n writeFileSync(path, content, { flag: 'wx' })\n return true\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'EEXIST') return false\n throw err\n }\n}\n\nexport function generateResource(\n cwd: string,\n name: string,\n fieldArgs: string[],\n serverDir = 'server',\n): GenerateResult {\n let fields: ResourceField[]\n try {\n fields = parseResourceFields(fieldArgs)\n } catch (err) {\n return { status: 'invalid_name', message: err instanceof Error ? err.message : String(err) }\n }\n\n const schemaRel = join(serverDir, 'db', 'schema.ts')\n const routeDirRel = join(serverDir, 'routes', name)\n const schemaPath = resolve(cwd, schemaRel)\n const routeIndexPath = resolve(cwd, routeDirRel, 'index.ts')\n const routeIdPath = resolve(cwd, routeDirRel, '[id].ts')\n const testPath = resolve(cwd, `tests/${name}.test.ts`)\n\n // Read rather than check-then-read, and create the new files with `wx` rather than\n // check-then-write: the answer can change between a check and the write that trusts it.\n const existingSchema = readIfPresent(schemaPath)\n if (existingSchema === undefined) {\n return {\n status: 'not_a_project',\n message:\n `${schemaRel} not found. \\`theokit generate resource\\` appends the table to the Drizzle ` +\n `schema under the configured serverDir (\"${serverDir}\"); create it first.`,\n }\n }\n if (existingSchema.includes(`export const ${name} =`)) {\n return {\n status: 'already_exists',\n filePath: schemaPath,\n kind: 'resource',\n name,\n message: `Table \"${name}\" already exists in ${schemaRel}`,\n }\n }\n\n const detected = detectDialect(cwd, existingSchema)\n const dialectName = DIALECT_ALIASES[detected]\n if (dialectName === undefined) {\n return {\n status: 'invalid_config',\n message:\n `\\`theokit generate resource\\` writes code for SQLite and PostgreSQL; this project uses ` +\n `\"${detected}\" (from drizzle.config.ts or the imports in ${schemaRel}). Nothing was written.`,\n }\n }\n const dialect = DIALECTS[dialectName]\n const queries = QUERIES[dialectName]\n\n // The routes import `db` from `<serverDir>/db/index.js`. Without the file the command reported\n // success and the next build failed with `Could not resolve` (usetheokit/theokit#1038). Which\n // driver to install is the project's choice, so the generator refuses rather than writing one.\n const dbIndexRel = join(serverDir, 'db', 'index.ts')\n if (!DB_INDEX_FILES.some((file) => existsSync(resolve(cwd, serverDir, 'db', file)))) {\n const example = dialect.dbIndexExample.map((line) => ' ' + line).join('\\n')\n return {\n status: 'not_a_project',\n message:\n `${dbIndexRel} not found. The routes \\`theokit generate resource\\` writes import \\`db\\` ` +\n `from it, so the build would fail to resolve it. Create it with \\`export const db\\`, for ` +\n `example (${dialectName}):\\n\\n${example}\\n\\n` +\n `Nothing was written.`,\n }\n }\n\n // 1. Create the route files first: an existing route refuses before the schema is touched.\n mkdirSync(dirname(routeIndexPath), { recursive: true })\n const template = { resourceName: name, fields, queries }\n if (\n !createExclusive(\n routeIndexPath,\n generateRouteIndex({ ...template, displayPath: join(routeDirRel, 'index.ts') }),\n )\n ) {\n return { status: 'already_exists', filePath: routeIndexPath, kind: 'resource', name }\n }\n writeFileSync(\n routeIdPath,\n generateRouteId({ ...template, displayPath: join(routeDirRel, '[id].ts') }),\n )\n\n // 2. Append the table, with the builders it uses imported.\n writeFileSync(\n schemaPath,\n withDialectImports(existingSchema, dialect) + generateSchemaEntry(name, fields, dialect),\n )\n\n // 3. Create the test file, keeping one the user already has.\n mkdirSync(dirname(testPath), { recursive: true })\n createExclusive(testPath, generateTestTemplate(name, serverDir))\n\n return { status: 'created', filePath: routeIndexPath, kind: 'resource', name }\n}\n","/**\n * The `theokit generate sandbox` template: an agent tool that runs a shell command.\n */\nimport { toCamelCase } from './generate-names.js'\n\n/**\n * usetheokit/theokit#1070 — this template used to describe `LocalSandbox` as \"isolated\" and \"SAFELY\"\n * runnable, to the developer in the doc comment and to the model in the tool description, while the\n * SDK documents `LocalSandbox` as not an isolation boundary: a generated tool wrote into the app\n * directory, read `/etc/passwd` and resolved DNS. The generated tool now asks for bubblewrap\n * confinement through `createSandboxBackend`, checks `resolveSandboxPosture` before every command,\n * and refuses to run unconfined unless the developer opts in by name. The text claims nothing more.\n */\nexport function generateSandboxTemplate(name: string): string {\n const camel = toCamelCase(name)\n const base = name.split('/').pop() ?? name\n const snake = base.replace(/-/g, '_')\n return [\n `import { mkdtempSync } from 'node:fs'`,\n `import { tmpdir } from 'node:os'`,\n `import { join } from 'node:path'`,\n ``,\n `import {`,\n ` createSandboxBackend,`,\n ` resolveSandboxPosture,`,\n ` SandboxNotAvailableError,`,\n `} from '@theokit/sdk/sandbox'`,\n `import { tool } from 'theokit/server/define'`,\n `import { z } from 'zod'`,\n ``,\n `/**`,\n ` * An agent tool that runs a shell command under bubblewrap confinement (Linux): the filesystem is`,\n ` * read-only apart from a scratch directory and /tmp, the network is cut, and the environment is`,\n ` * reduced to an allowlist. The command can still READ anything your user can read. Confinement`,\n ` * limits what a command can change; it is not a boundary for hostile code, which needs a container`,\n ` * or VM backend.`,\n ` *`,\n ` * Where bubblewrap is missing or cannot run (macOS, Windows, many containers) nothing confines the`,\n ` * command, so the tool refuses with \\`SandboxNotAvailableError\\`. To run commands on the host anyway,`,\n ` * with your user's full filesystem and network access, set THEOKIT_SANDBOX_ALLOW_UNCONFINED=1, and`,\n ` * only for commands you trust.`,\n ` *`,\n ` * Connect it to your agent with \\`.tool(...)\\`:`,\n ` *`,\n ` * // agents/chat.ts`,\n ` * import { ${camel}Tool } from './sandbox/${base}.js'`,\n ` * AgentBuilder.create().model(...).tool(${camel}Tool).build()`,\n ` */`,\n `const MODE = 'workspace-write'`,\n `let scratchDir: string | undefined`,\n ``,\n `export const ${camel}Tool = tool('${snake}')`,\n ` .describe('Run a shell command and return its output.')`,\n ` .input(z.object({ command: z.string().describe('The shell command to run, e.g. \"ls -la\"') }))`,\n ` .execute(async ({ command }) => {`,\n ` const posture = resolveSandboxPosture({ mode: MODE })`,\n ` if (!posture.enforced && process.env.THEOKIT_SANDBOX_ALLOW_UNCONFINED !== '1') {`,\n ` throw new SandboxNotAvailableError(`,\n ` \\`Refusing to run the command without confinement: \\${posture.detail}. \\` +`,\n ` 'Install bubblewrap, or set THEOKIT_SANDBOX_ALLOW_UNCONFINED=1 to run it on the host.',`,\n ` )`,\n ` }`,\n ` scratchDir ??= mkdtempSync(join(tmpdir(), '${base}-'))`,\n ` const sandbox = createSandboxBackend({ mode: MODE, workDir: scratchDir, timeoutMs: 5_000 })`,\n ` const { stdout, stderr, exitCode } = await sandbox.execute(command)`,\n ` return exitCode === 0 ? stdout : \\`exit \\${exitCode}: \\${stderr}\\``,\n ` })`,\n ` .build()`,\n ``,\n ].join('\\n')\n}\n","/**\n * The `theokit generate schedule` generator.\n *\n * A schedule must land where `theokit build` scans (`<agentsDir>/schedules`), so its directory is\n * read from the project config through `loadConfig`, the same reader the build uses. When the\n * config cannot be read the generator refuses by name instead of guessing a directory.\n *\n * A schedule runs the app's `chat` agent, so a project without one is refused too: a schedule\n * importing a module that does not exist would make `theokit build` fail on it.\n *\n * The schedule declares `defineCron('<last segment of the name>')`, so that segment is checked with\n * `defineCron`'s own rule and the scanner's own discovery: a name the build would reject, skip, or\n * find already used by another cron file is refused as `invalid_name` before anything is written.\n */\nimport { basename, dirname, extname, relative, resolve, sep } from 'node:path'\n\nimport { loadConfig } from '../../config/load-config.js'\nimport { cronScanDirs, isDiscoverableCronFile, listCronFiles } from '../../server/cron/cron-scan.js'\nimport { CRON_NAME_RULE, isValidCronName } from '../../server/cron/define-cron.js'\nimport { findAgentFile } from '../../server/scan/agent-scan.js'\n\nimport { pathTraversalRefusal } from './generate-containment.js'\nimport type { GenerateResult } from './generate-types.js'\n\n/** Where the schedule goes and what it says, or the refusal that explains why it cannot be written. */\nexport async function resolveScheduleTarget(\n cwd: string,\n name: string,\n): Promise<{ filePath: string; content: string } | GenerateResult> {\n const malformed = cronNameRefusal(name)\n if (malformed !== undefined) return malformed\n let config: Awaited<ReturnType<typeof loadConfig>>\n try {\n config = await loadConfig(cwd)\n } catch (err) {\n return {\n status: 'invalid_config',\n message: `Cannot read ${resolve(cwd, 'theo.config.ts')}: ${(err as Error).message}`,\n }\n }\n const { agentsDir, serverDir } = config\n const agentsRoot = resolve(cwd, agentsDir)\n const cronDirs = cronScanDirs(cwd, serverDir, agentsDir)\n const filePath = resolve(cronDirs.schedules, `${name}.ts`)\n // Before the agent lookup: a chat agent missing from a directory outside the project is not\n // something to create, and the refusal must name the escape, not the missing file.\n const escaped = pathTraversalRefusal(cwd, filePath)\n if (escaped !== undefined) return escaped\n // The agent scanner's own rule, so the file found is the one the build serves as `chat`.\n const chatPath = findAgentFile(agentsRoot, 'chat')\n if (chatPath === undefined) {\n return {\n status: 'agent_not_found',\n message:\n `No \"chat\" agent in ${agentsRoot} (the build serves it from chat.{ts,tsx,js,jsx} or ` +\n 'chat/index.{ts,tsx,js,jsx}). A schedule runs the chat agent; create it first.',\n }\n }\n // The build scans both homes with one duplicate-name guard (build.ts, emitCronArtifacts).\n const taken = cronNameTaken(name, filePath, [cronDirs.crons, cronDirs.schedules])\n if (taken !== undefined) return taken\n return { filePath, content: generateScheduleTemplate(name, importSpecifier(filePath, chatPath)) }\n}\n\n/** The cron name a schedule called `name` declares: its last `/` segment. */\nexport function cronNameOf(name: string): string {\n return name.split('/').pop() ?? name\n}\n\n/** A refusal when the build would skip the file or `defineCron` would reject its name. */\nfunction cronNameRefusal(name: string): GenerateResult | undefined {\n const cronName = cronNameOf(name)\n if (!isDiscoverableCronFile(`${cronName}.ts`)) {\n return {\n status: 'invalid_name',\n message: `Invalid schedule name \"${name}\": the build does not discover a cron file named \"${cronName}.ts\".`,\n }\n }\n if (!isValidCronName(cronName)) {\n return {\n status: 'invalid_name',\n message: `Invalid schedule name \"${name}\": its cron name \"${cronName}\" is one defineCron rejects. ${CRON_NAME_RULE}`,\n }\n }\n return undefined\n}\n\n/**\n * A refusal when another cron file already carries this schedule's cron name. The generator names\n * a cron after its file, so a file of the same name in either cron home is the clash the build's\n * duplicate-name guard would fail on. The target itself is left to the `already_exists` answer.\n *\n * Compared by FILE name, while the build compares the name each file passes to `defineCron`, which\n * it learns only by importing the file. A hand-written `foo.ts` declaring `defineCron('bar')` is\n * not seen here, so schedule `bar` is written and the build then fails with\n * `DuplicateCronNameError`; and a `bar.ts` declaring another name refuses schedule `bar` although\n * the build would accept it. Importing every cron file to read its name would run user code at\n * generate time, which this generator does not do.\n */\nfunction cronNameTaken(\n name: string,\n filePath: string,\n cronDirs: readonly string[],\n): GenerateResult | undefined {\n const cronName = cronNameOf(name)\n const clash = listCronFiles(cronDirs).find(\n (path) => path !== filePath && basename(path, extname(path)) === cronName,\n )\n if (clash === undefined) return undefined\n return {\n status: 'invalid_name',\n message: `Invalid schedule name \"${name}\": the cron name \"${cronName}\" is already used by ${clash}. Cron names must be unique across server/crons/ and agents/schedules/.`,\n }\n}\n\n/**\n * The ESM specifier the schedule at `fromFile` uses to import `toFile` (`../chat.js`). A TypeScript\n * source is imported by its `.js` name, as TypeScript and tsx resolve it; a `.js` or `.jsx` file\n * keeps its own extension.\n */\nexport function importSpecifier(fromFile: string, toFile: string): string {\n const path = relative(dirname(fromFile), toFile)\n .split(sep)\n .join('/')\n .replace(/\\.tsx?$/, '.js')\n return path.startsWith('.') ? path : `./${path}`\n}\n\nfunction generateScheduleTemplate(name: string, chatSpecifier: string): string {\n const base = cronNameOf(name)\n return [\n `import { defineCron } from 'theokit/server/cron'`,\n `import { resolveProvider } from 'theokit/server/agent'`,\n `import { streamAgentTurnInProcess } from '@theokit/agents'`,\n ``,\n `import chat from '${chatSpecifier}'`,\n ``,\n `/**`,\n ` * A scheduled agent run, a first-class TheoKit cron. \\`theokit build\\` discovers it and translates the`,\n ` * schedule to your deploy target's native cron; \\`theokit start\\` runs it in-process.`,\n ` *`,\n ` * Each fire is one model run of your \\`chat\\` agent, so it spends tokens. Nobody is present to approve`,\n ` * a gated tool, so the run uses the \\`auto-reject\\` posture: every approval is answered \"no\" and the`,\n ` * gated tool does not run.`,\n ` *`,\n ` * Schedules are UTC (https://crontab.guru). \\`signal\\` aborts when the scheduler stops.`,\n ` */`,\n `export default defineCron('${base}', {`,\n ` schedule: '0 9 * * *', // every day at 09:00 UTC`,\n ` async handler({ traceId, scheduledAt, signal }) {`,\n ` let outcome = 'ok'`,\n ` try {`,\n ` const agent = chat as { model?: string; plugins?: readonly unknown[] }`,\n ` const { apiKey } = resolveProvider(agent.model, { plugins: agent.plugins })`,\n ` const run = streamAgentTurnInProcess(chat, apiKey, {`,\n ` message: \\`Scheduled run \"${base}\" at \\${scheduledAt.toISOString()}\\`,`,\n ` signal,`,\n ` approvals: {`,\n ` kind: 'auto-reject',`,\n ` reason: 'unattended schedule \"${base}\": nobody is present to approve',`,\n ` },`,\n ` })`,\n ` for await (const chunk of run) {`,\n ` // The SDK can report a failed run as a chunk rather than a rejection.`,\n ` if (chunk.type === 'error') {`,\n ` throw new Error(\\`[${base}] agent run failed: \\${chunk.errorText ?? 'no error text'}\\`)`,\n ` }`,\n ` }`,\n ` } catch (err) {`,\n ` outcome = \\`failed: \\${err instanceof Error ? err.message : String(err)}\\``,\n ` throw err`,\n ` } finally {`,\n ` // One traced line per fire, failed fires included: the scheduler's own error line has no trace id.`,\n ` console.log(\\`[${base}] fire \\${outcome} at \\${scheduledAt.toISOString()} (trace \\${traceId})\\`)`,\n ` }`,\n ` },`,\n `})`,\n ``,\n ].join('\\n')\n}\n","import type { CronDefinition, CronOptions } from './cron-types.js'\nimport { validateCronSchedule } from './cron-validate.js'\n\nconst NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/\n\n/** What {@link isValidCronName} requires, in words, for an error message. */\nexport const CRON_NAME_RULE =\n 'Must be 1-64 chars, lowercase alphanumeric + hyphen, starting with [a-z0-9].'\n\n/** Whether `defineCron` accepts `name`. The generator asks this before writing a cron. */\nexport function isValidCronName(name: string): boolean {\n return typeof name === 'string' && NAME_RE.test(name)\n}\n\nfunction validateName(name: string): void {\n if (!isValidCronName(name)) {\n throw new Error(`defineCron: invalid name \"${name}\". ${CRON_NAME_RULE}`)\n }\n}\n\n/**\n * Declare a time-triggered handler. Pure identity helper — no\n * registration side effect; the build-time scanner (T1.3) discovers\n * definitions by walking `server/crons/` and emits a manifest the\n * adapters translate at deploy.\n *\n * @example\n * ```ts\n * // server/crons/morning-summary.ts\n * export default defineCron('morning-summary', {\n * schedule: '0 9 * * *', // 09:00 UTC\n * async handler({ traceId, scheduledAt, signal }) {\n * // ...\n * },\n * })\n * ```\n */\nexport function defineCron(name: string, options: CronOptions): CronDefinition {\n validateName(name)\n validateCronSchedule(options.schedule)\n return {\n name,\n schedule: options.schedule,\n handler: options.handler,\n concurrency: options.concurrency ?? 'forbid',\n }\n}\n","/**\n * Shared types for the `theokit generate` CLI command family.\n *\n * Extracted to break the circular dependency between generate.ts ↔ generate-resource.ts\n * (architecture-remediation plan T1.1, 2026-06-12).\n */\n\nexport const VALID_TYPES = [\n 'route',\n 'action',\n 'page',\n 'ws',\n 'controller',\n 'agent',\n 'toolbox',\n 'workflow',\n 'eval',\n 'sandbox',\n 'schedule',\n 'memory',\n 'resource',\n] as const\nexport type GeneratorType = (typeof VALID_TYPES)[number]\n\nexport interface GenerateOptions {\n cwd: string\n type: string\n name: string\n fields?: string[]\n}\n\nexport type GenerateStatus =\n | 'created'\n | 'already_exists'\n | 'invalid_kind'\n | 'invalid_name'\n | 'not_a_project'\n | 'invalid_config'\n | 'agent_not_found'\n\nexport interface GenerateResult {\n status: GenerateStatus\n filePath?: string\n kind?: GeneratorType\n name?: string\n message?: string\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAAA,aAAY,aAAAC,YAAW,gBAAAC,eAAc,iBAAAC,sBAAqB;AACnE,SAAS,WAAAC,UAAS,OAAO,WAAAC,gBAAe;;;ACIxC,SAAS,YAAY,UAAU,SAAS,WAAW;AASnD,SAAS,aAAa,KAAa,UAA2B;AAC5D,MAAI,SAAS,SAAS,IAAM,EAAG,QAAO;AACtC,QAAM,WAAW,SAAS,QAAQ,GAAG,GAAG,QAAQ;AAChD,SAAO,aAAa,MAAM,CAAC,WAAW,QAAQ,KAAK,SAAS,MAAM,GAAG,EAAE,CAAC,MAAM;AAChF;AAGO,SAAS,qBAAqB,KAAa,UAA8C;AAC9F,MAAI,aAAa,KAAK,QAAQ,EAAG,QAAO;AACxC,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,SAAS,2BAA2B,QAAQ,iCAAiC,QAAQ,GAAG,CAAC;AAAA,EAC3F;AACF;;;ACxBO,SAAS,aAAa,MAAsB;AACjD,SAAO,KACJ,MAAM,MAAM,EACZ,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC,CAAC,EACjD,KAAK,EAAE;AACZ;AAGO,SAAS,YAAY,MAAsB;AAChD,QAAM,SAAS,aAAa,IAAI;AAChC,SAAO,OAAO,OAAO,CAAC,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC;AACxD;;;ACgBO,IAAM,y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K,KAAK,IAAI;AAEtB,QAAM,OAAO,KAAK;AAGlB,MAAI,SAAS,YAAY;AACvB,UAAM,SAAS,MAAM,WAAW,GAAG;AACnC,QAAI,YAAY,OAAQ,QAAO;AAC/B,WAAO,iBAAiB,KAAK,MAAM,KAAK,UAAU,CAAC,GAAG,OAAO,SAAS;AAAA,EACxE;AAEA,QAAM,WAAW,MAAM,cAAc,KAAK,MAAM,IAAI;AACpD,MAAI,YAAY,SAAU,QAAO;AACjC,SAAO,YAAY,KAAK,MAAM,MAAM,QAAQ;AAC9C;AAGA,IAAM,eAGF;AAAA;AAAA;AAAA,EAGF,eAAe,CAAC,WACd,OAAO,WAAW;AAAA,EACpB,cAAc,CAAC,WAAW,OAAO,WAAW;AAAA;AAAA;AAAA,EAG5C,cAAc,CAAC,QAAQ,SAAS,OAAO,WAAW,iBAAiB,IAAI;AAAA,EACvE,gBAAgB,CAAC,WAAW,OAAO,WAAW;AAAA,EAC9C,iBAAiB,CAAC,WAAW,OAAO,WAAW;AACjD;AAMA,eAAsB,gBACpB,MACA,MACA,QACe;AACf,QAAM,SAAS,MAAM,SAAS,EAAE,KAAK,QAAQ,IAAI,GAAG,MAAM,MAAM,OAAO,CAAC;AACxE,MAAI,OAAO,WAAW,kBAAkB;AACtC,YAAQ,IAAI;AAAA,WAAS,OAAO,QAAQ;AAAA,CAA8B;AAAA,EACpE,WAAW,OAAO,WAAW,WAAW;AACtC,YAAQ,IAAI;AAAA,mBAAiB,IAAI,KAAK,OAAO,QAAQ;AAAA,CAAI;AACzD,QAAI,OAAO,YAAY,OAAW,SAAQ,IAAI,KAAK,OAAO,OAAO;AAAA,CAAI;AAAA,EACvE,OAAO;AACL,UAAM,IAAI,MAAM,aAAa,OAAO,MAAM,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC3D;AACF;","names":["existsSync","mkdirSync","readFileSync","writeFileSync","dirname","resolve","resolve","resolve","dirname","relative","resolve","sep","resolve","relative","dirname","sep","basename","resolve","existsSync","mkdirSync","dirname","writeFileSync","readFileSync"]}
|
|
@@ -2,12 +2,12 @@ import { a as TheoErrorCode, T as TheoErrorEnvelope } from './error-envelope-DG4
|
|
|
2
2
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
3
|
import { P as PluginContext, W as WebOnRequestHook, g as WebPreHandlerHook, h as WebOnResponseHook, i as WebOnErrorHook } from './plugin-types-BUVfUQ0V.js';
|
|
4
4
|
import { P as PluginRunner } from './plugin-runner-BVMOSxvb.js';
|
|
5
|
-
import { J as JobBackend } from './job-backend-
|
|
5
|
+
import { J as JobBackend } from './job-backend-BX-PwnZW.js';
|
|
6
6
|
import { S as ServerRouteNode } from './match-DaKsL73w.js';
|
|
7
7
|
import { L as LoadModule } from './module-loader-DCip7NoL.js';
|
|
8
8
|
import { C as CsrfMode, D as DisallowedConfig } from './csrf-Dgot9qSM.js';
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
-
import {
|
|
10
|
+
import { b as MiddlewareNext, R as RouteConfig } from './define-middleware-D7LFaTv-.js';
|
|
11
11
|
import './action-protocol-tGm3NKRg.js';
|
|
12
12
|
|
|
13
13
|
interface ExecuteActionOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -299,6 +299,7 @@ declare const theoConfigSchema: z.ZodObject<{
|
|
|
299
299
|
outDir: z.ZodDefault<z.ZodString>;
|
|
300
300
|
}, z.core.$strip>>;
|
|
301
301
|
formatError: z.ZodOptional<z.ZodCustom<FormatErrorHook, FormatErrorHook>>;
|
|
302
|
+
ready: z.ZodOptional<z.ZodCustom<() => boolean | Promise<boolean>, () => boolean | Promise<boolean>>>;
|
|
302
303
|
}, z.core.$strip>;
|
|
303
304
|
type TheoConfig = z.infer<typeof theoConfigSchema>;
|
|
304
305
|
|
package/dist/index.js
CHANGED
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
scanRoutes,
|
|
9
9
|
theoConfigSchema,
|
|
10
10
|
theoPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OKFRGAYZ.js";
|
|
12
12
|
import "./chunk-7NRFZBAL.js";
|
|
13
13
|
import "./chunk-SSYDEKWF.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-N5YHENWJ.js";
|
|
15
15
|
import "./chunk-7MCEJVGV.js";
|
|
16
16
|
import "./chunk-4XZOUS5G.js";
|
|
17
17
|
import "./chunk-OIGJOYX6.js";
|
|
@@ -19,12 +19,12 @@ import "./chunk-U3SPBLJF.js";
|
|
|
19
19
|
import "./chunk-WSOAN4KN.js";
|
|
20
20
|
import "./chunk-ENSFCKP6.js";
|
|
21
21
|
import "./chunk-OGLS76RN.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-KQBY62AE.js";
|
|
23
23
|
import "./chunk-36ZACTF3.js";
|
|
24
24
|
import "./chunk-P6OS7652.js";
|
|
25
25
|
import "./chunk-ZDUO4IYN.js";
|
|
26
26
|
import "./chunk-IDWN2OSG.js";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-YH5CDWLU.js";
|
|
28
28
|
import "./chunk-NTDN54XO.js";
|
|
29
29
|
import "./chunk-JO462JZM.js";
|
|
30
30
|
import "./chunk-IXXZBZF7.js";
|
|
@@ -36,6 +36,7 @@ import "./chunk-7HGZ3CKL.js";
|
|
|
36
36
|
import "./chunk-A6UFN6QQ.js";
|
|
37
37
|
import "./chunk-DV34VG3N.js";
|
|
38
38
|
import "./chunk-V6Y2SMRG.js";
|
|
39
|
+
import "./chunk-TRCJHFAX.js";
|
|
39
40
|
import "./chunk-ACKBVBUI.js";
|
|
40
41
|
import "./chunk-IZ3TIL6K.js";
|
|
41
42
|
import "./chunk-TQEE36VD.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":"
|
|
1
|
+
{"version":3,"sources":["../src/config/define-config.ts","../src/config/config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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"]}
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-47MM2JUK.js";
|
|
6
6
|
import {
|
|
7
7
|
loadConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-35OI2TKT.js";
|
|
9
9
|
import "./chunk-3QPVEJ7D.js";
|
|
10
10
|
import "./chunk-O5JZ6ROY.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-PQWVT6JC.js";
|
|
12
12
|
import "./chunk-L4V5V2TI.js";
|
|
13
13
|
import "./chunk-MAJZ2L3A.js";
|
|
14
14
|
|
|
@@ -103,4 +103,4 @@ export {
|
|
|
103
103
|
buildInfo,
|
|
104
104
|
infoCommand
|
|
105
105
|
};
|
|
106
|
-
//# sourceMappingURL=info-
|
|
106
|
+
//# sourceMappingURL=info-ELSPSCXK.js.map
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
handleCspReport,
|
|
17
17
|
handleCsrfReadiness,
|
|
18
18
|
mountAgent
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-E22GPCCO.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveProvider
|
|
22
22
|
} from "./chunk-4JRXZTVQ.js";
|
|
@@ -88,4 +88,4 @@ export {
|
|
|
88
88
|
scanWebSocketRoutes,
|
|
89
89
|
sendError
|
|
90
90
|
};
|
|
91
|
-
//# sourceMappingURL=internal-api-
|
|
91
|
+
//# sourceMappingURL=internal-api-5FTPYSEQ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dispatchControllerRequest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N5YHENWJ.js";
|
|
4
4
|
import {
|
|
5
5
|
mountAgent
|
|
6
6
|
} from "./chunk-4XZOUS5G.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
executeAction,
|
|
19
19
|
executeRoute,
|
|
20
20
|
handleBatchRequest
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KQBY62AE.js";
|
|
22
22
|
import {
|
|
23
23
|
incomingMessageToHandlerRequest,
|
|
24
24
|
sendError
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import "./chunk-P6OS7652.js";
|
|
27
27
|
import "./chunk-ZDUO4IYN.js";
|
|
28
28
|
import "./chunk-IDWN2OSG.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-YH5CDWLU.js";
|
|
30
30
|
import {
|
|
31
31
|
findSuggestion
|
|
32
32
|
} from "./chunk-NTDN54XO.js";
|
|
@@ -111,4 +111,4 @@ export {
|
|
|
111
111
|
scanWebSocketRoutes,
|
|
112
112
|
sendError
|
|
113
113
|
};
|
|
114
|
-
//# sourceMappingURL=internal-api-
|
|
114
|
+
//# sourceMappingURL=internal-api-H3C2ID6N.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { P as PoolLike } from './storage-types-ndO0ZZqH.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Neutral `JobBackend` interface.
|
|
3
5
|
*
|
|
@@ -9,6 +11,7 @@
|
|
|
9
11
|
* implement this same interface to plug in alternate substrates without
|
|
10
12
|
* modifying TheoKit core.
|
|
11
13
|
*/
|
|
14
|
+
|
|
12
15
|
interface JobEnqueueInput {
|
|
13
16
|
/** The job name (matches a `defineJob` declaration). */
|
|
14
17
|
name: string;
|
|
@@ -86,6 +89,28 @@ interface JobBackend {
|
|
|
86
89
|
* `JobLeaseLostError` and leaves the job alone when that lease no longer holds it.
|
|
87
90
|
*/
|
|
88
91
|
nack(jobId: string, opts: JobNackOptions): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Optional: persist a job through `client`, a connection inside a transaction the caller opened,
|
|
94
|
+
* so the job commits or rolls back with the caller's writes (usetheokit/theokit#1077). Only a
|
|
95
|
+
* backend whose jobs live in the caller's database can offer it; `ctx.queue.enqueueInTransaction`
|
|
96
|
+
* refuses a backend without it rather than enqueueing outside the transaction.
|
|
97
|
+
*/
|
|
98
|
+
enqueueInTransaction?(client: PoolLike, input: JobEnqueueInput): Promise<{
|
|
99
|
+
jobId: string;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Optional: resolve when the backend's store answers, reject when it does not. `GET /__theo/ready`
|
|
103
|
+
* calls it under `theokit start` and `theokit dev`, so an unreachable job store answers 503
|
|
104
|
+
* (usetheokit/theokit#1071). A backend with nothing remote to reach leaves it out.
|
|
105
|
+
*/
|
|
106
|
+
ping?(): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Optional: create or upgrade whatever storage the backend needs (a table, an index). Must be
|
|
109
|
+
* idempotent and safe to run from several processes at once. `theokit start` and `theokit dev`
|
|
110
|
+
* call it once at boot, before serving a request or starting the worker, and refuse to boot when
|
|
111
|
+
* it rejects (usetheokit/theokit#1072). A backend that needs no setup leaves it out.
|
|
112
|
+
*/
|
|
113
|
+
migrate?(): Promise<void>;
|
|
89
114
|
/**
|
|
90
115
|
* Optional: return the existing jobId if `key` was enqueued within `ttlSeconds`. Pass `name` to
|
|
91
116
|
* scope the lookup to one job type, as `enqueue` deduplicates on (name, key); without it, a key
|
|
@@ -3,14 +3,14 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
deepMerge,
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-35OI2TKT.js";
|
|
7
7
|
import "./chunk-3QPVEJ7D.js";
|
|
8
8
|
import "./chunk-O5JZ6ROY.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-PQWVT6JC.js";
|
|
10
10
|
import "./chunk-L4V5V2TI.js";
|
|
11
11
|
import "./chunk-MAJZ2L3A.js";
|
|
12
12
|
export {
|
|
13
13
|
deepMerge,
|
|
14
14
|
loadConfig
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=load-config-
|
|
16
|
+
//# sourceMappingURL=load-config-SKLFH7YL.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
createAgentSsrLoader
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OSSNCUS6.js";
|
|
6
6
|
import {
|
|
7
7
|
extractAppResources,
|
|
8
8
|
handleMcpJsonRpc
|
|
@@ -47,7 +47,7 @@ async function serveMcpStdio(mod, name, appResources, streams) {
|
|
|
47
47
|
// src/cli/commands/mcp.ts
|
|
48
48
|
async function mcpCommand(name, deps = {}) {
|
|
49
49
|
const projectRoot = deps.projectRoot ?? process.cwd();
|
|
50
|
-
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-
|
|
50
|
+
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-SKLFH7YL.js")).loadConfig(projectRoot)).agentsDir;
|
|
51
51
|
const agent = scanAgents(projectRoot, agentsDir).find((a) => a.name === name);
|
|
52
52
|
if (!agent) {
|
|
53
53
|
const names = scanAgents(projectRoot, agentsDir).map((a) => a.name).join(", ");
|
|
@@ -76,4 +76,4 @@ async function mcpCommand(name, deps = {}) {
|
|
|
76
76
|
export {
|
|
77
77
|
mcpCommand
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=mcp-
|
|
79
|
+
//# sourceMappingURL=mcp-3ENI2IPS.js.map
|
|
@@ -12,10 +12,10 @@ import "./chunk-4WP7A7RX.js";
|
|
|
12
12
|
import "./chunk-Z7CJHDLS.js";
|
|
13
13
|
import {
|
|
14
14
|
loadConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-35OI2TKT.js";
|
|
16
16
|
import "./chunk-3QPVEJ7D.js";
|
|
17
17
|
import "./chunk-O5JZ6ROY.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-PQWVT6JC.js";
|
|
19
19
|
import "./chunk-L4V5V2TI.js";
|
|
20
20
|
import "./chunk-MAJZ2L3A.js";
|
|
21
21
|
|
|
@@ -84,4 +84,4 @@ function emitOpenApiInMemory(manifest, config) {
|
|
|
84
84
|
export {
|
|
85
85
|
openapiCommand
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=openapi-
|
|
87
|
+
//# sourceMappingURL=openapi-OVXYHZ2S.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-
|
|
8
|
-
import("./start-
|
|
7
|
+
import("./build-QDZEOCJ3.js"),
|
|
8
|
+
import("./start-EJFYT7ZU.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-
|
|
23
|
+
//# sourceMappingURL=preview-GP6J6IGJ.js.map
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
import "./chunk-Z7CJHDLS.js";
|
|
12
12
|
import {
|
|
13
13
|
loadConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-35OI2TKT.js";
|
|
15
15
|
import "./chunk-3QPVEJ7D.js";
|
|
16
16
|
import "./chunk-O5JZ6ROY.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-PQWVT6JC.js";
|
|
18
18
|
import "./chunk-L4V5V2TI.js";
|
|
19
19
|
import "./chunk-MAJZ2L3A.js";
|
|
20
20
|
|
|
@@ -64,4 +64,4 @@ async function routesCommand() {
|
|
|
64
64
|
export {
|
|
65
65
|
routesCommand
|
|
66
66
|
};
|
|
67
|
-
//# sourceMappingURL=routes-
|
|
67
|
+
//# sourceMappingURL=routes-UNJ77IQU.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
theoConfigSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PQWVT6JC.js";
|
|
6
6
|
import "./chunk-L4V5V2TI.js";
|
|
7
7
|
import {
|
|
8
8
|
cacheSchema,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
storageSchema,
|
|
18
18
|
theoConfigSchema
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=schema-
|
|
20
|
+
//# sourceMappingURL=schema-2EAIJFWA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RouteConfig, M as MiddlewareHandler } from '../../define-middleware-
|
|
1
|
+
import { a as RouteContext, R as RouteConfig, M as MiddlewareHandler } from '../../define-middleware-D7LFaTv-.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { W as WebSocketHandler, b as WebSocketLike } from '../../define-websocket-DzPn1sR6.js';
|
|
4
4
|
export { a as WebSocketHandlerWeb } from '../../define-websocket-DzPn1sR6.js';
|
|
@@ -70,7 +70,7 @@ interface MissingHandlerError {
|
|
|
70
70
|
* The fluent route builder. `TQuery/TBody/TParams` track the input schemas (default `z.ZodUndefined`,
|
|
71
71
|
* matching {@link RouteConfig}); `TResponse` tracks the handler return; `THandlerSet` gates `.build()`.
|
|
72
72
|
*/
|
|
73
|
-
interface RouteBuilder<TQuery extends z.ZodType = z.ZodUndefined, TBody extends z.ZodType = z.ZodUndefined, TParams extends z.ZodType = z.ZodUndefined, TCtx =
|
|
73
|
+
interface RouteBuilder<TQuery extends z.ZodType = z.ZodUndefined, TBody extends z.ZodType = z.ZodUndefined, TParams extends z.ZodType = z.ZodUndefined, TCtx = RouteContext, TResponse = unknown, THandlerSet extends boolean = false> {
|
|
74
74
|
/** Set the URL search-params schema. Inferred into `ctx.query`. */
|
|
75
75
|
query<S extends z.ZodType>(schema: S): RouteBuilder<S, TBody, TParams, TCtx, TResponse, THandlerSet>;
|
|
76
76
|
/** Set the request-body schema. Inferred into `ctx.body`. */
|
|
@@ -113,7 +113,8 @@ interface RouteBuilder<TQuery extends z.ZodType = z.ZodUndefined, TBody extends
|
|
|
113
113
|
/**
|
|
114
114
|
* Start a fluent route definition. Chain `.query/.body/.params/.response/.status/.csrf`, declare
|
|
115
115
|
* `.policy()` (which the route scanner requires), then `.handler()` and `.build()` for the
|
|
116
|
-
* `RouteConfig`.
|
|
116
|
+
* `RouteConfig`. The handler's `ctx` is a {@link RouteContext}, which an app augments with the keys
|
|
117
|
+
* its config provides (`ctx.queue` when `jobs.backend` is set).
|
|
117
118
|
*/
|
|
118
119
|
declare function route(): RouteBuilder;
|
|
119
120
|
|
|
@@ -377,4 +378,4 @@ interface WebChannelHandler<TMessage = unknown> {
|
|
|
377
378
|
*/
|
|
378
379
|
declare function defineWebChannel<TMessage = unknown>(handler: WebChannelHandler<TMessage>): WebChannelHandler<TMessage>;
|
|
379
380
|
|
|
380
|
-
export { type ActionAccept, type ActionBuilder, type ActionConfig, type ChannelHandler, CustomTool, type MiddlewareBuilder, MiddlewareHandler, OnErrorHook, OnRequestHook, OnResponseHook, type PluginBuilder, PreHandlerHook, type RouteBuilder, RouteConfig, RoutePolicy, TheoPlugin, type ToolBuilder, ToolTransform, type WebChannelHandler, type WebSocketBuilder, WebSocketHandler, WebSocketLike, action, defineChannel, defineWebChannel, middleware, plugin, route, tool, uiMessageStreamResponse, websocket };
|
|
381
|
+
export { type ActionAccept, type ActionBuilder, type ActionConfig, type ChannelHandler, CustomTool, type MiddlewareBuilder, MiddlewareHandler, OnErrorHook, OnRequestHook, OnResponseHook, type PluginBuilder, PreHandlerHook, type RouteBuilder, RouteConfig, RouteContext, RoutePolicy, TheoPlugin, type ToolBuilder, ToolTransform, type WebChannelHandler, type WebSocketBuilder, WebSocketHandler, WebSocketLike, action, defineChannel, defineWebChannel, middleware, plugin, route, tool, uiMessageStreamResponse, websocket };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export { B as BATCH_PATH, a as BatchExecuteFn, b as BatchPathConflictError, c as BatchPayload, d as BatchRequestItem, e as BatchResponse, f as BatchResultItem, C as CookieOptions, h as CorsConfig, i as CorsHandler, j as CorsOrigin, k as CorsWebHandler, l as CustomErrorPages, E as ExecuteActionOptions, m as ExecuteRouteContext, F as FileTooLargeError, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, n as MiddlewareNextUnavailableError, o as MiddlewareResult, N as NotFoundError, q as ProcedureInputError, r as ProcedureOutputError, S as STRIPPED_HEADERS, v as SendErrorInput, w as SendErrorOptions, T as TRACE_HEADER, x as TRACE_PARENT_HEADER, y as TheoError, W as W3CTraceContext, _ as _resetMiddlewareCacheForTests, A as _resetUninvocableWarningsForTests, D as appendCookieToHeaders, G as appendDeleteCookieToHeaders, I as callProcedure, J as createCorsHandler, K as createCorsWebHandler, L as createOpenApiHandler, Q as createServerContext, V as deleteCookie, X as envelopeCodeToStatus, Y as executeAction, Z as executeRoute, $ as executeWebRequest, a0 as extractTraceId, a1 as extractTraceIdFromRequest, a2 as extractW3CTraceContext, a3 as fromUnknown, a4 as getCookie, a5 as getCookieFromRequest, a6 as handleBatchRequest, a7 as handleRequestError, a8 as handleWebRequestError, a9 as injectModulePreloads, aa as jsonTransformer, ab as loadCustomErrorPages, ac as matchesOrigin, ad as parseCookieHeader, ae as parseRequestBody, af as parseTraceparent, ag as parseTraceparentContext, ah as resolveTransformer, ai as resolveUserModule, aj as runMiddlewareAndContext, ak as sendError, al as sendJson, am as serializeCookie, an as serveStaticFile, ao as serverErrorToEnvelope, ap as setCookie, aq as superjsonTransformer, ar as validateRouteInput } from '../../index-
|
|
1
|
+
export { B as BATCH_PATH, a as BatchExecuteFn, b as BatchPathConflictError, c as BatchPayload, d as BatchRequestItem, e as BatchResponse, f as BatchResultItem, C as CookieOptions, h as CorsConfig, i as CorsHandler, j as CorsOrigin, k as CorsWebHandler, l as CustomErrorPages, E as ExecuteActionOptions, m as ExecuteRouteContext, F as FileTooLargeError, H as HandleBatchOptions, M as MAX_ERROR_HTML_BYTES, n as MiddlewareNextUnavailableError, o as MiddlewareResult, N as NotFoundError, q as ProcedureInputError, r as ProcedureOutputError, S as STRIPPED_HEADERS, v as SendErrorInput, w as SendErrorOptions, T as TRACE_HEADER, x as TRACE_PARENT_HEADER, y as TheoError, W as W3CTraceContext, _ as _resetMiddlewareCacheForTests, A as _resetUninvocableWarningsForTests, D as appendCookieToHeaders, G as appendDeleteCookieToHeaders, I as callProcedure, J as createCorsHandler, K as createCorsWebHandler, L as createOpenApiHandler, Q as createServerContext, V as deleteCookie, X as envelopeCodeToStatus, Y as executeAction, Z as executeRoute, $ as executeWebRequest, a0 as extractTraceId, a1 as extractTraceIdFromRequest, a2 as extractW3CTraceContext, a3 as fromUnknown, a4 as getCookie, a5 as getCookieFromRequest, a6 as handleBatchRequest, a7 as handleRequestError, a8 as handleWebRequestError, a9 as injectModulePreloads, aa as jsonTransformer, ab as loadCustomErrorPages, ac as matchesOrigin, ad as parseCookieHeader, ae as parseRequestBody, af as parseTraceparent, ag as parseTraceparentContext, ah as resolveTransformer, ai as resolveUserModule, aj as runMiddlewareAndContext, ak as sendError, al as sendJson, am as serializeCookie, an as serveStaticFile, ao as serverErrorToEnvelope, ap as setCookie, aq as superjsonTransformer, ar as validateRouteInput } from '../../index-C2lcEI-4.js';
|
|
2
2
|
export { A as ActionError, b as ActionInputError, f as extractUniversalIssues, i as isActionError, d as isInputError } from '../../action-protocol-tGm3NKRg.js';
|
|
3
3
|
import '../../error-envelope-DG47lt8E.js';
|
|
4
4
|
import 'node:http';
|
|
5
5
|
import '../../plugin-types-BUVfUQ0V.js';
|
|
6
6
|
import '../../plugin-runner-BVMOSxvb.js';
|
|
7
|
-
import '../../job-backend-
|
|
7
|
+
import '../../job-backend-BX-PwnZW.js';
|
|
8
|
+
import '../../storage-types-ndO0ZZqH.js';
|
|
8
9
|
import '../../match-DaKsL73w.js';
|
|
9
10
|
import '../../module-loader-DCip7NoL.js';
|
|
10
11
|
import 'vite';
|
|
11
12
|
import '../../csrf-Dgot9qSM.js';
|
|
12
13
|
import '../../audit-log-BQWM5YLG.js';
|
|
13
14
|
import 'zod';
|
|
14
|
-
import '../../define-middleware-
|
|
15
|
+
import '../../define-middleware-D7LFaTv-.js';
|
|
15
16
|
import '../../route-policy-BHXQDzBF.js';
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
injectModulePreloads,
|
|
8
8
|
loadCustomErrorPages,
|
|
9
9
|
serveStaticFile
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-3TCWOHLY.js";
|
|
11
11
|
import "../../chunk-O2KGDLA7.js";
|
|
12
12
|
import {
|
|
13
13
|
jsonTransformer,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
handleRequestError,
|
|
27
27
|
handleWebRequestError,
|
|
28
28
|
matchesOrigin
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-KQBY62AE.js";
|
|
30
30
|
import {
|
|
31
31
|
MiddlewareNextUnavailableError,
|
|
32
32
|
_resetMiddlewareCacheForTests,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
isInputError
|
|
49
49
|
} from "../../chunk-ZDUO4IYN.js";
|
|
50
50
|
import "../../chunk-IDWN2OSG.js";
|
|
51
|
-
import "../../chunk-
|
|
51
|
+
import "../../chunk-YH5CDWLU.js";
|
|
52
52
|
import {
|
|
53
53
|
TRACE_HEADER,
|
|
54
54
|
TRACE_PARENT_HEADER,
|