theokit 0.52.1 → 0.54.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.
Files changed (124) hide show
  1. package/dist/{actions-virtual-module-VJYKUIXE.js → actions-virtual-module-FGJR3I7V.js} +5 -5
  2. package/dist/{actions-virtual-module-SNG4JC35.js → actions-virtual-module-M4MTKOAX.js} +7 -7
  3. package/dist/adapters/agent-mount.js +1 -1
  4. package/dist/{agent-AHGYRVQX.js → agent-TKCC4WZ6.js} +3 -3
  5. package/dist/{app-typed-client-FQVMEG4Z.js → app-typed-client-22BZ3KDX.js} +24 -33
  6. package/dist/app-typed-client-22BZ3KDX.js.map +1 -0
  7. package/dist/{app-typed-client-ZZIASI4A.js → app-typed-client-6MNNVMJU.js} +22 -31
  8. package/dist/app-typed-client-6MNNVMJU.js.map +1 -0
  9. package/dist/{build-3AYYQZGQ.js → build-JH53TZJI.js} +8 -8
  10. package/dist/{chunk-XLLW46MB.js → chunk-2HWWJTOH.js} +7 -5
  11. package/dist/chunk-2HWWJTOH.js.map +1 -0
  12. package/dist/{chunk-FH3SQR6P.js → chunk-4OTIXAUY.js} +11 -3
  13. package/dist/chunk-4OTIXAUY.js.map +1 -0
  14. package/dist/{chunk-6AM7HIRM.js → chunk-5NNFO7R7.js} +1 -1
  15. package/dist/{chunk-6AM7HIRM.js.map → chunk-5NNFO7R7.js.map} +1 -1
  16. package/dist/{chunk-GSIOWE5B.js → chunk-5VLP3GQ2.js} +2 -2
  17. package/dist/{chunk-2E7JLV7L.js → chunk-6VYF5PMG.js} +2 -2
  18. package/dist/{chunk-YZCD3DWE.js → chunk-AI7GBBRB.js} +2 -2
  19. package/dist/{chunk-SAFGDIPQ.js → chunk-BZF76LFM.js} +18 -7
  20. package/dist/chunk-BZF76LFM.js.map +1 -0
  21. package/dist/{chunk-VGE6AKEJ.js → chunk-DAE7BJ7H.js} +2 -2
  22. package/dist/{chunk-5BOKW3GX.js → chunk-FVFYACYK.js} +2 -2
  23. package/dist/chunk-FVFYACYK.js.map +1 -0
  24. package/dist/{chunk-QTHVHNJJ.js → chunk-HA35FS7U.js} +2 -2
  25. package/dist/{chunk-MBFD6NHB.js → chunk-HLDXHDCB.js} +12 -12
  26. package/dist/{chunk-VHB2FSPM.js → chunk-I2UN46ZX.js} +39 -24
  27. package/dist/chunk-I2UN46ZX.js.map +1 -0
  28. package/dist/{chunk-E53UIFH6.js → chunk-IHAQUUT2.js} +3 -3
  29. package/dist/chunk-IHAQUUT2.js.map +1 -0
  30. package/dist/{chunk-DHAD2O3S.js → chunk-KHBSMLYU.js} +2 -2
  31. package/dist/{chunk-YYOBMOO4.js → chunk-NO6HA4FG.js} +35 -22
  32. package/dist/chunk-NO6HA4FG.js.map +1 -0
  33. package/dist/{chunk-Q5L5EGWZ.js → chunk-NZDGV4YJ.js} +2 -2
  34. package/dist/{chunk-VI7ZANB3.js → chunk-OSBGZYXZ.js} +20 -2
  35. package/dist/chunk-OSBGZYXZ.js.map +1 -0
  36. package/dist/{chunk-I4ELCXNV.js → chunk-S6RWUH3J.js} +19 -11
  37. package/dist/chunk-S6RWUH3J.js.map +1 -0
  38. package/dist/{chunk-PFAVZL4F.js → chunk-SIGUGCBS.js} +5 -5
  39. package/dist/{chunk-JUDNKBDQ.js → chunk-WX6NHGKS.js} +20 -2
  40. package/dist/chunk-WX6NHGKS.js.map +1 -0
  41. package/dist/{chunk-7ZOQN7UH.js → chunk-ZQO37YQJ.js} +2 -2
  42. package/dist/cli/index.js +9 -9
  43. package/dist/client/index.d.ts +31 -1
  44. package/dist/client/index.js.map +1 -1
  45. package/dist/{define-agent-tool-cRuSpidb.d.ts → define-agent-tool-CizaYZwU.d.ts} +9 -4
  46. package/dist/{dev-W7OXHMSP.js → dev-6KDYNF5E.js} +12 -12
  47. package/dist/{dev-emit-SPSV6UU7.js → dev-emit-QGSMUZLU.js} +4 -4
  48. package/dist/{dev-emit-G2E2U3NP.js → dev-emit-W27J3DLU.js} +2 -2
  49. package/dist/{index-C8YN9dpF.d.ts → index-ADEV6pen.d.ts} +1 -1
  50. package/dist/index.d.ts +2 -1
  51. package/dist/index.js +5 -5
  52. package/dist/{info-Y55RWS42.js → info-6WJ3JRNE.js} +4 -4
  53. package/dist/{internal-api-EL25ADPR.js → internal-api-TA37BXH7.js} +7 -7
  54. package/dist/{internal-api-S6BGJCZP.js → internal-api-VUDJUWYE.js} +5 -5
  55. package/dist/{load-config-4ATXQUN3.js → load-config-BKUAMGO5.js} +4 -4
  56. package/dist/{match-DmGgxjIU.d.ts → match-Dw4CNXJH.d.ts} +8 -0
  57. package/dist/{mcp-7BXBN7PD.js → mcp-2RQCKWQR.js} +4 -4
  58. package/dist/{observability-bootstrap-M2WSDIDV.js → observability-bootstrap-H4NSILXD.js} +3 -3
  59. package/dist/{openapi-2IBBOS3Q.js → openapi-PKDDJ7M2.js} +7 -7
  60. package/dist/{preview-4ZTFJG2D.js → preview-J57QZNTO.js} +3 -3
  61. package/dist/{routes-PP5PHHLR.js → routes-A2YLFEYC.js} +5 -5
  62. package/dist/{schema-SOAD43RQ.js → schema-WKTNTGX6.js} +3 -3
  63. package/dist/{schemas-4AXHQMV3.js → schemas-QCMSKQDK.js} +2 -2
  64. package/dist/server/agent/index.d.ts +1 -1
  65. package/dist/server/agent/index.js +2 -2
  66. package/dist/server/define/index.d.ts +2 -2
  67. package/dist/server/define/index.js +2 -2
  68. package/dist/server/http/index.d.ts +2 -2
  69. package/dist/server/http/index.js +2 -2
  70. package/dist/server/index.d.ts +3 -3
  71. package/dist/server/index.js +6 -6
  72. package/dist/server/scan/index.d.ts +8 -2
  73. package/dist/server/scan/index.js +1 -1
  74. package/dist/{server-boundary-XRXVVUMO.js → server-boundary-4UIGB3G5.js} +5 -5
  75. package/dist/{server-boundary-RNM25WWD.js → server-boundary-A2PUD4JV.js} +7 -7
  76. package/dist/{start-WILEDDW2.js → start-3F4LVHWS.js} +95 -13
  77. package/dist/start-3F4LVHWS.js.map +1 -0
  78. package/dist/vite-plugin/index.js +5 -5
  79. package/dist/{vite-plugin-2XM35VNV.js → vite-plugin-VYNUCEI2.js} +11 -11
  80. package/package.json +4 -4
  81. package/dist/app-typed-client-FQVMEG4Z.js.map +0 -1
  82. package/dist/app-typed-client-ZZIASI4A.js.map +0 -1
  83. package/dist/chunk-5BOKW3GX.js.map +0 -1
  84. package/dist/chunk-E53UIFH6.js.map +0 -1
  85. package/dist/chunk-FH3SQR6P.js.map +0 -1
  86. package/dist/chunk-I4ELCXNV.js.map +0 -1
  87. package/dist/chunk-JUDNKBDQ.js.map +0 -1
  88. package/dist/chunk-SAFGDIPQ.js.map +0 -1
  89. package/dist/chunk-VHB2FSPM.js.map +0 -1
  90. package/dist/chunk-VI7ZANB3.js.map +0 -1
  91. package/dist/chunk-XLLW46MB.js.map +0 -1
  92. package/dist/chunk-YYOBMOO4.js.map +0 -1
  93. package/dist/start-WILEDDW2.js.map +0 -1
  94. /package/dist/{actions-virtual-module-VJYKUIXE.js.map → actions-virtual-module-FGJR3I7V.js.map} +0 -0
  95. /package/dist/{actions-virtual-module-SNG4JC35.js.map → actions-virtual-module-M4MTKOAX.js.map} +0 -0
  96. /package/dist/{agent-AHGYRVQX.js.map → agent-TKCC4WZ6.js.map} +0 -0
  97. /package/dist/{build-3AYYQZGQ.js.map → build-JH53TZJI.js.map} +0 -0
  98. /package/dist/{chunk-GSIOWE5B.js.map → chunk-5VLP3GQ2.js.map} +0 -0
  99. /package/dist/{chunk-2E7JLV7L.js.map → chunk-6VYF5PMG.js.map} +0 -0
  100. /package/dist/{chunk-YZCD3DWE.js.map → chunk-AI7GBBRB.js.map} +0 -0
  101. /package/dist/{chunk-VGE6AKEJ.js.map → chunk-DAE7BJ7H.js.map} +0 -0
  102. /package/dist/{chunk-QTHVHNJJ.js.map → chunk-HA35FS7U.js.map} +0 -0
  103. /package/dist/{chunk-MBFD6NHB.js.map → chunk-HLDXHDCB.js.map} +0 -0
  104. /package/dist/{chunk-DHAD2O3S.js.map → chunk-KHBSMLYU.js.map} +0 -0
  105. /package/dist/{chunk-Q5L5EGWZ.js.map → chunk-NZDGV4YJ.js.map} +0 -0
  106. /package/dist/{chunk-PFAVZL4F.js.map → chunk-SIGUGCBS.js.map} +0 -0
  107. /package/dist/{chunk-7ZOQN7UH.js.map → chunk-ZQO37YQJ.js.map} +0 -0
  108. /package/dist/{dev-W7OXHMSP.js.map → dev-6KDYNF5E.js.map} +0 -0
  109. /package/dist/{dev-emit-SPSV6UU7.js.map → dev-emit-QGSMUZLU.js.map} +0 -0
  110. /package/dist/{dev-emit-G2E2U3NP.js.map → dev-emit-W27J3DLU.js.map} +0 -0
  111. /package/dist/{info-Y55RWS42.js.map → info-6WJ3JRNE.js.map} +0 -0
  112. /package/dist/{internal-api-EL25ADPR.js.map → internal-api-TA37BXH7.js.map} +0 -0
  113. /package/dist/{internal-api-S6BGJCZP.js.map → internal-api-VUDJUWYE.js.map} +0 -0
  114. /package/dist/{load-config-4ATXQUN3.js.map → load-config-BKUAMGO5.js.map} +0 -0
  115. /package/dist/{mcp-7BXBN7PD.js.map → mcp-2RQCKWQR.js.map} +0 -0
  116. /package/dist/{observability-bootstrap-M2WSDIDV.js.map → observability-bootstrap-H4NSILXD.js.map} +0 -0
  117. /package/dist/{openapi-2IBBOS3Q.js.map → openapi-PKDDJ7M2.js.map} +0 -0
  118. /package/dist/{preview-4ZTFJG2D.js.map → preview-J57QZNTO.js.map} +0 -0
  119. /package/dist/{routes-PP5PHHLR.js.map → routes-A2YLFEYC.js.map} +0 -0
  120. /package/dist/{schema-SOAD43RQ.js.map → schema-WKTNTGX6.js.map} +0 -0
  121. /package/dist/{schemas-4AXHQMV3.js.map → schemas-QCMSKQDK.js.map} +0 -0
  122. /package/dist/{server-boundary-XRXVVUMO.js.map → server-boundary-4UIGB3G5.js.map} +0 -0
  123. /package/dist/{server-boundary-RNM25WWD.js.map → server-boundary-A2PUD4JV.js.map} +0 -0
  124. /package/dist/{vite-plugin-2XM35VNV.js.map → vite-plugin-VYNUCEI2.js.map} +0 -0
@@ -1,6 +1,6 @@
1
- import "./chunk-VGE6AKEJ.js";
2
- import "./chunk-JUDNKBDQ.js";
3
- import "./chunk-5BOKW3GX.js";
1
+ import "./chunk-DAE7BJ7H.js";
2
+ import "./chunk-WX6NHGKS.js";
3
+ import "./chunk-FVFYACYK.js";
4
4
  import "./chunk-ZDUO4IYN.js";
5
5
  import "./chunk-47FFT43U.js";
6
6
  import "./chunk-NTDN54XO.js";
@@ -12,7 +12,7 @@ import "./chunk-TNI4MARH.js";
12
12
  import "./chunk-OQCRCXCP.js";
13
13
  import {
14
14
  scanServerActionsEnriched
15
- } from "./chunk-VHB2FSPM.js";
15
+ } from "./chunk-I2UN46ZX.js";
16
16
  import "./chunk-DV34VG3N.js";
17
17
  import "./chunk-IRASEXOG.js";
18
18
  import "./chunk-BX6EUYHU.js";
@@ -234,4 +234,4 @@ export const actions = manifest
234
234
  export {
235
235
  actionsVirtualModule
236
236
  };
237
- //# sourceMappingURL=actions-virtual-module-VJYKUIXE.js.map
237
+ //# sourceMappingURL=actions-virtual-module-FGJR3I7V.js.map
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import "tsx/esm";
3
- import "./chunk-E53UIFH6.js";
3
+ import "./chunk-IHAQUUT2.js";
4
4
  import "./chunk-5YPXXSYY.js";
5
5
  import "./chunk-MWWFXYW3.js";
6
6
  import "./chunk-RPET332G.js";
7
- import "./chunk-GSIOWE5B.js";
7
+ import "./chunk-5VLP3GQ2.js";
8
8
  import "./chunk-C27VRUVN.js";
9
9
  import "./chunk-7UZZHCRN.js";
10
- import "./chunk-XLLW46MB.js";
11
- import "./chunk-6AM7HIRM.js";
10
+ import "./chunk-2HWWJTOH.js";
11
+ import "./chunk-5NNFO7R7.js";
12
12
  import {
13
13
  scanServerActionsEnriched
14
- } from "./chunk-YYOBMOO4.js";
14
+ } from "./chunk-NO6HA4FG.js";
15
15
  import "./chunk-Z7CJHDLS.js";
16
16
  import "./chunk-U5PWXS3J.js";
17
- import "./chunk-VI7ZANB3.js";
17
+ import "./chunk-OSBGZYXZ.js";
18
18
  import "./chunk-VQIUTCK2.js";
19
19
 
20
20
  // src/vite-plugin/actions-virtual-module.ts
@@ -218,4 +218,4 @@ export const actions = manifest
218
218
  export {
219
219
  actionsVirtualModule
220
220
  };
221
- //# sourceMappingURL=actions-virtual-module-SNG4JC35.js.map
221
+ //# sourceMappingURL=actions-virtual-module-M4MTKOAX.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mountAgent
3
- } from "../chunk-JUDNKBDQ.js";
3
+ } from "../chunk-WX6NHGKS.js";
4
4
  import "../chunk-2OEN3YTE.js";
5
5
  import "../chunk-BND4YZTQ.js";
6
6
  import "../chunk-CHTAWXC2.js";
@@ -3,13 +3,13 @@ import "tsx/esm";
3
3
  import {
4
4
  agentCommand,
5
5
  createAgentSsrLoader
6
- } from "./chunk-PFAVZL4F.js";
6
+ } from "./chunk-SIGUGCBS.js";
7
7
  import "./chunk-5YPXXSYY.js";
8
- import "./chunk-6AM7HIRM.js";
8
+ import "./chunk-5NNFO7R7.js";
9
9
  import "./chunk-Z7CJHDLS.js";
10
10
  import "./chunk-3QPVEJ7D.js";
11
11
  export {
12
12
  agentCommand,
13
13
  createAgentSsrLoader
14
14
  };
15
- //# sourceMappingURL=agent-AHGYRVQX.js.map
15
+ //# sourceMappingURL=agent-TKCC4WZ6.js.map
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  import "tsx/esm";
3
- import "./chunk-E53UIFH6.js";
3
+ import "./chunk-IHAQUUT2.js";
4
4
  import "./chunk-5YPXXSYY.js";
5
5
  import {
6
6
  scanControllerModules
7
7
  } from "./chunk-MWWFXYW3.js";
8
8
  import "./chunk-RPET332G.js";
9
- import "./chunk-GSIOWE5B.js";
9
+ import "./chunk-5VLP3GQ2.js";
10
10
  import "./chunk-C27VRUVN.js";
11
11
  import "./chunk-7UZZHCRN.js";
12
12
  import {
13
13
  generateManifest
14
- } from "./chunk-XLLW46MB.js";
15
- import "./chunk-6AM7HIRM.js";
14
+ } from "./chunk-2HWWJTOH.js";
15
+ import "./chunk-5NNFO7R7.js";
16
16
  import {
17
17
  HTTP_METHODS
18
- } from "./chunk-YYOBMOO4.js";
18
+ } from "./chunk-NO6HA4FG.js";
19
19
  import "./chunk-Z7CJHDLS.js";
20
20
  import "./chunk-U5PWXS3J.js";
21
- import "./chunk-VI7ZANB3.js";
21
+ import "./chunk-OSBGZYXZ.js";
22
22
  import "./chunk-VQIUTCK2.js";
23
23
 
24
24
  // src/vite-plugin/app-typed-client.ts
@@ -80,9 +80,8 @@ function normalizeSegment(raw) {
80
80
  let s = raw;
81
81
  if (s.startsWith(":...")) s = s.slice(4);
82
82
  else if (s.startsWith(":")) s = s.slice(1);
83
- const camel = s.replace(/-([a-z0-9])/gi, (_, c) => c.toUpperCase());
84
- if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(camel)) {
85
- return { identifier: camel, bracket: false };
83
+ if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s)) {
84
+ return { identifier: s, bracket: false };
86
85
  }
87
86
  return { identifier: s, bracket: true };
88
87
  }
@@ -114,13 +113,10 @@ function paramNamesFromRoute(routePath) {
114
113
  }
115
114
  function buildOneRoute(route, ctx) {
116
115
  if (!route.methods || route.methods.length === 0) return;
117
- const idx = ctx.aliasCounter.value++;
118
116
  const absRouteFile = isAbsolute(route.filePath) ? route.filePath : resolve(ctx.serverDir, route.filePath);
119
117
  const importPath = importPathFor(ctx.dtsOutPath, absRouteFile);
120
- const aliases = route.methods.filter((m) => HTTP_METHODS.includes(m)).map((method) => ({ method, alias: `_r${idx}_${method}` }));
118
+ const aliases = route.methods.filter((m) => HTTP_METHODS.includes(m)).map((method) => ({ method }));
121
119
  if (aliases.length === 0) return;
122
- const importClause = aliases.map((a) => `${a.method} as ${a.alias}`).join(", ");
123
- ctx.importLines.push(` import type { ${importClause} } from '${importPath}'`);
124
120
  const segments = routePathSegments(route.routePath);
125
121
  let node = ctx.root;
126
122
  for (const seg of segments) {
@@ -133,16 +129,16 @@ function buildOneRoute(route, ctx) {
133
129
  node = child;
134
130
  }
135
131
  node.paramNamesAccumulated = paramNamesFromRoute(route.routePath);
136
- for (const { method, alias } of aliases) {
132
+ for (const { method } of aliases) {
137
133
  if (node.methods.has(method)) {
138
134
  ctx.warnings.push(
139
135
  `// WARNING: duplicate ${method} export at /${segments.join("/")} (route file declared twice). Keeping last definition.`
140
136
  );
141
137
  }
142
- node.methods.set(method, alias);
138
+ node.methods.set(method, { importPath, exportName: method });
143
139
  }
144
140
  }
145
- function buildOneController(cr, classAlias, ctx) {
141
+ function buildOneController(cr, classSource, ctx) {
146
142
  const verb = cr.verb.toUpperCase();
147
143
  if (!HTTP_METHODS.includes(verb)) return;
148
144
  const method = verb;
@@ -169,7 +165,7 @@ function buildOneController(cr, classAlias, ctx) {
169
165
  if (!ctx.warnings.includes(note)) ctx.warnings.push(note);
170
166
  }
171
167
  node.controllerMethods.set(method, {
172
- classAlias,
168
+ classSource,
173
169
  methodName: cr.methodName,
174
170
  // theokit#124 — an EXPORTED schema is referenceable from the emitted `.d.ts`; an inline one is
175
171
  // not, and falls through to the documented `unknown`.
@@ -217,13 +213,14 @@ function resolveCollisions(node, pathPrefix, warnings) {
217
213
  }
218
214
  function renderTreeNode(node, indent, _isRoot) {
219
215
  const lines = ["{"];
220
- for (const [method, alias] of node.methods) {
216
+ for (const [method, source] of node.methods) {
221
217
  const lower = method.toLowerCase();
222
218
  const paramsList = node.paramNamesAccumulated.map((p) => `${p}: string`).join("; ");
223
219
  const paramsField = node.paramNamesAccumulated.length > 0 ? `{ params: { ${paramsList} } } & ` : "";
224
220
  const optionalMark = node.paramNamesAccumulated.length === 0 ? "?" : "";
221
+ const routeType = `typeof import('${source.importPath}').${source.exportName}`;
225
222
  lines.push(
226
- `${indent} ${lower}: (opts${optionalMark}: ${paramsField}import('theokit/client').TheoFetchOptions<typeof ${alias}>) => Promise<import('theokit/client').InferResponse<typeof ${alias}>>`
223
+ `${indent} ${lower}: (opts${optionalMark}: ${paramsField}import('theokit/client').TheoFetchOptions<${routeType}>) => Promise<import('theokit/client').InferResponse<${routeType}>>`
227
224
  );
228
225
  }
229
226
  for (const [method, leaf] of node.controllerMethods) {
@@ -234,7 +231,7 @@ function renderTreeNode(node, indent, _isRoot) {
234
231
  const bodyType = leaf.bodySchema === void 0 ? "body?: unknown" : `body: import('zod').infer<typeof import('${leaf.bodySchema.importPath}').${leaf.bodySchema.exportName}>`;
235
232
  const queryType = leaf.querySchema === void 0 ? "query?: Record<string, string>" : `query: import('zod').infer<typeof import('${leaf.querySchema.importPath}').${leaf.querySchema.exportName}>`;
236
233
  lines.push(
237
- `${indent} ${lower}: (opts${optionalMark}: ${paramsField}{ ${bodyType}; ${queryType} }) => Promise<Awaited<ReturnType<InstanceType<typeof ${leaf.classAlias}>['${leaf.methodName}']>>>`
234
+ `${indent} ${lower}: (opts${optionalMark}: ${paramsField}{ ${bodyType}; ${queryType} }) => Promise<Awaited<ReturnType<InstanceType<typeof import('${leaf.classSource.importPath}').${leaf.classSource.className}>['${leaf.methodName}']>>>`
238
235
  );
239
236
  }
240
237
  for (const [name, child] of node.children) {
@@ -252,8 +249,6 @@ function generateClientDts({
252
249
  }) {
253
250
  const ctx = {
254
251
  root: makeNode(),
255
- aliasCounter: { value: 0 },
256
- importLines: [],
257
252
  warnings: [],
258
253
  dtsOutPath,
259
254
  serverDir
@@ -262,20 +257,16 @@ function generateClientDts({
262
257
  buildOneRoute(route, ctx);
263
258
  }
264
259
  if (controllerRoutes?.length) {
265
- const classAliases = /* @__PURE__ */ new Map();
266
260
  for (const cr of controllerRoutes) {
267
- let alias = classAliases.get(cr.filePath);
268
- if (alias === void 0) {
269
- alias = `_c${classAliases.size}`;
270
- classAliases.set(cr.filePath, alias);
271
- const importPath = importPathFor(dtsOutPath, cr.filePath);
272
- ctx.importLines.push(` import type { ${cr.className} as ${alias} } from '${importPath}'`);
273
- }
274
- buildOneController(cr, alias, ctx);
261
+ buildOneController(
262
+ cr,
263
+ { importPath: importPathFor(dtsOutPath, cr.filePath), className: cr.className },
264
+ ctx
265
+ );
275
266
  }
276
267
  }
277
268
  resolveCollisions(ctx.root, "", ctx.warnings);
278
- const importsBlock = ctx.importLines.length > 0 ? ctx.importLines.join("\n") + "\n\n" : "\n";
269
+ const importsBlock = "\n";
279
270
  const warningsBlock = ctx.warnings.length > 0 ? " // " + ctx.warnings.join("\n // ") + "\n\n" : "";
280
271
  const treeBody = ctx.root.children.size === 0 && ctx.root.methods.size === 0 && ctx.root.controllerMethods.size === 0 ? "{\n // No routes detected \u2014 add `server/routes/*.ts` to populate this client.\n }" : renderTreeNode(
281
272
  ctx.root,
@@ -420,4 +411,4 @@ export {
420
411
  generateClientDts,
421
412
  shouldReemitForFile
422
413
  };
423
- //# sourceMappingURL=app-typed-client-FQVMEG4Z.js.map
414
+ //# sourceMappingURL=app-typed-client-22BZ3KDX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-plugin/app-typed-client.ts","../src/vite-plugin/controller-client-emit.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Codegen-time fs ops: all paths derive from `opts.serverDir` / `opts.distDir`\n * (vite plugin opts — trusted, set by the framework's CLI). The plugin only\n * runs at dev/build time, never serves user HTTP input. No path traversal\n * surface here.\n */\n/**\n * Phase 2 + Phase 4 of G1 (g1-client-codegen-plan.md):\n *\n * 1. `generateClientDts(manifest, dtsOutPath)` — pure function emitting the\n * `.theokit/client.d.ts` shape (declared module `@theo/client`).\n * 2. `appTypedClientPlugin(opts)` — Vite plugin wrapper that calls (1),\n * writes the file atomically, and rewrites on route file changes.\n *\n * Implementation notes:\n * - Pure (1) is unit-testable without Vite or a filesystem (see G1-P2 tests).\n * - EC-2: segments are kept literal; anything not a valid identifier is a bracket key (#470).\n * - EC-3: collision between HTTP method name and sub-segment name → method\n * wins; a sub-segment gets a `_` suffix + a warning comment.\n * - EC-6: the write is `writeFileSync(tmp) + renameSync(tmp, final)` (POSIX atomic).\n * - EC-8: imports normalize `\\\\` → `/`.\n */\n\nimport { mkdirSync, readFileSync, renameSync, writeFileSync, existsSync } from 'node:fs'\nimport { dirname, isAbsolute, posix, relative, resolve } from 'node:path'\n\nimport type { Plugin, ViteDevServer } from 'vite'\n\nimport { HTTP_METHODS, type HttpMethod } from '../core/contracts/http-methods.js'\nimport { generateManifest, type ManifestRoute, type TheoManifest } from '../server/internal-api.js'\n\nimport { collectControllerRouteData, type ControllerRouteData } from './controller-client-emit.js'\n\nconst FILE_HEADER = `// AUTO-GENERATED by theokit — do not edit.\n// Source: theokit/packages/theo/src/vite-plugin/app-typed-client.ts (G1 plan).\n// To refresh: \\`pnpm dev\\` or \\`pnpm build\\` regenerates this file on every route change.\n\n/* eslint-disable */\n`\n\ninterface ControllerLeaf {\n /**\n * Where the controller class lives, named inline like the route exports beside it (#469). The\n * alias form it replaced is fragile in a way that is hard to characterise: measured, the same\n * aliased class resolved correctly in one `declare module` block and to `any` in another, with\n * nothing in the file to say which. Inline resolves relative to the file and always survived, so\n * no aliased relative import is left in the generated output at all.\n */\n classSource: { importPath: string; className: string }\n /** Controller method name backing the route (`findById`). */\n methodName: string\n /**\n * theokit#124 — module specifier + exported name of the `@Body` schema, when it has one, so the\n * emitted signature can say `z.infer<typeof import('...').zCreate>` instead of `unknown`.\n */\n bodySchema?: { importPath: string; exportName: string }\n /** theokit#124 — same for `@Query`. */\n querySchema?: { importPath: string; exportName: string }\n}\n\ninterface TreeNode {\n /** sub-namespaces — keyed by segment name (already normalized). */\n children: Map<string, TreeNode>\n /**\n * File-based routes: HTTP method → where the route export lives, so the signature can name it\n * INLINE as `typeof import('...').GET`.\n *\n * It used to hold an import alias, declared once at the top of the `declare module` block. That\n * alias silently resolves to `any` when fed to an external package's conditional type — measured\n * in #469, with no error at all, so every call through the generated client returned `any` while\n * the app compiled. The controller path beside this one already emits schemas inline for the same\n * reason; this brings routes onto the shape that works.\n */\n methods: Map<HttpMethod, { importPath: string; exportName: HttpMethod }>\n /** Decorator controllers: HTTP method → class alias + method (`Awaited<ReturnType<...>>`). */\n controllerMethods: Map<HttpMethod, ControllerLeaf>\n /** Whether any descendant declares dynamic params (for params type construction). */\n paramNamesAccumulated: string[]\n}\n\nfunction makeNode(): TreeNode {\n return {\n children: new Map(),\n methods: new Map(),\n controllerMethods: new Map(),\n paramNamesAccumulated: [],\n }\n}\n\n/**\n * Normalize a path segment to a valid TS identifier when possible.\n * EC-2: the segment is kept literal; pure dynamic (`:name`) → identifier `name`;\n * starts with digit or unsafe char → emit as bracket-access key.\n */\nfunction normalizeSegment(raw: string): { identifier: string; bracket: boolean } {\n // Dynamic segment: leading `:` (e.g. `:id` or `:...slug`).\n let s = raw\n if (s.startsWith(':...')) s = s.slice(4)\n else if (s.startsWith(':')) s = s.slice(1)\n\n // The segment is kept LITERAL (#470). It used to be camelCased — `agents-config` became\n // `agentsConfig` — while the runtime Proxy builds the URL from the key it was handed and knows\n // nothing of the transformation. So the type offered `client.agentsConfig.get()`, the request\n // went to `/api/agentsConfig`, and the route served at `/api/agents-config` answered 404. The\n // call compiled; the failure arrived at runtime.\n //\n // Translating back in the Proxy would have kept the prettier key, at the cost of a second source\n // of truth for every segment name. A generated client is worth more as a faithful mirror of the\n // URLs: bracket access for a hyphenated segment is the honest cost, and the machinery for it was\n // already here for segments that cannot be identifiers at all (`2fa`).\n if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s)) {\n return { identifier: s, bracket: false }\n }\n return { identifier: s, bracket: true }\n}\n\nfunction importPathFor(dtsOutPath: string, routeFileAbs: string): string {\n let rel = relative(dirname(dtsOutPath), routeFileAbs)\n // EC-8: normalize Windows path separators.\n rel = rel.replace(/\\\\/g, '/')\n // Strip extension (`.ts` / `.tsx`); TS module resolution likes extensionless.\n rel = rel.replace(/\\.[jt]sx?$/, '')\n if (!rel.startsWith('.') && !rel.startsWith('/')) {\n rel = './' + rel\n }\n return rel\n}\n\n/**\n * Convert a route path (e.g. `/api/users/:id/posts`) into the tree segments\n * we want under the `client` root. Strips the `/api/` prefix and splits.\n */\nfunction routePathSegments(routePath: string): string[] {\n let p = routePath\n if (p.startsWith('/api/')) p = p.slice(5)\n else if (p.startsWith('/api')) p = p.slice(4)\n if (p.startsWith('/')) p = p.slice(1)\n if (p === '') return []\n return p.split('/').filter(Boolean)\n}\n\nfunction paramNamesFromRoute(routePath: string): string[] {\n const out: string[] = []\n const re = /:(?:\\.\\.\\.)?([^/]+)/g\n let m: RegExpExecArray | null\n while ((m = re.exec(routePath)) !== null) {\n out.push(m[1])\n }\n return out\n}\n\ninterface BuildContext {\n root: TreeNode\n /** Lines emitted at the top of the declared module (one per route file). */\n /** Diagnostic warnings rendered as block comments inside the declared module. */\n warnings: string[]\n dtsOutPath: string\n serverDir: string\n}\n\nfunction buildOneRoute(route: ManifestRoute, ctx: BuildContext): void {\n if (!route.methods || route.methods.length === 0) return\n // Resolve absolute path for the route file (manifest stores it relative to serverDir).\n const absRouteFile = isAbsolute(route.filePath)\n ? route.filePath\n : resolve(ctx.serverDir, route.filePath)\n const importPath = importPathFor(ctx.dtsOutPath, absRouteFile)\n const aliases = route.methods\n .filter((m): m is HttpMethod => (HTTP_METHODS as readonly string[]).includes(m))\n .map((method) => ({ method }))\n if (aliases.length === 0) return\n // No import line: the method signatures name the export inline (see `TreeNode.methods`).\n\n // Walk segments + register methods at the leaf node.\n const segments = routePathSegments(route.routePath)\n let node = ctx.root\n for (const seg of segments) {\n const norm = normalizeSegment(seg)\n let child = node.children.get(norm.identifier)\n if (child === undefined) {\n child = makeNode()\n node.children.set(norm.identifier, child)\n }\n node = child\n }\n // Accumulated param names for typed params (e.g. `{ id: string }`).\n node.paramNamesAccumulated = paramNamesFromRoute(route.routePath)\n\n // Register each HTTP method (collision detection runs in a post-pass).\n for (const { method } of aliases) {\n if (node.methods.has(method)) {\n ctx.warnings.push(\n `// WARNING: duplicate ${method} export at /${segments.join('/')} (route file declared twice). Keeping last definition.`,\n )\n }\n node.methods.set(method, { importPath, exportName: method })\n }\n}\n\n/**\n * #122 (T2.1) — register one decorator-controller route into the tree. The class\n * import alias is shared across the class's methods (resolved by the caller). A\n * file-based route at the same node+verb WINS (file routes are the default); the\n * controller entry is skipped with a warning to keep the emitted `.d.ts` valid.\n */\nfunction buildOneController(\n cr: ControllerRouteData,\n classSource: { importPath: string; className: string },\n ctx: BuildContext,\n): void {\n const verb = cr.verb.toUpperCase()\n if (!(HTTP_METHODS as readonly string[]).includes(verb)) return\n const method = verb as HttpMethod\n\n const segments = routePathSegments(cr.fullPath)\n let node = ctx.root\n for (const seg of segments) {\n const norm = normalizeSegment(seg)\n let child = node.children.get(norm.identifier)\n if (child === undefined) {\n child = makeNode()\n node.children.set(norm.identifier, child)\n }\n node = child\n }\n node.paramNamesAccumulated = paramNamesFromRoute(cr.fullPath)\n\n if (node.methods.has(method)) {\n ctx.warnings.push(\n `WARNING (#122): controller ${cr.className}.${cr.methodName} (${method} /${segments.join('/')}) collides with a file-based route at the same path; file route wins.`,\n )\n return\n }\n if (cr.schemaNotExported === true) {\n // theokit#124 — a note, not a warning: the author did nothing wrong, and the emitted file is\n // valid. It exists so a reader who sees one typed method beside an untyped one knows the reason\n // is reachability, and knows the one-word fix.\n const note = `NOTE (#124): ${cr.className}.${cr.methodName} validates with a schema that is not exported, so its request type falls back to \\`unknown\\`. To get the type, export the schema (\\`export const zX = z.object({...})\\`).`\n if (!ctx.warnings.includes(note)) ctx.warnings.push(note)\n }\n node.controllerMethods.set(method, {\n classSource,\n methodName: cr.methodName,\n // theokit#124 — an EXPORTED schema is referenceable from the emitted `.d.ts`; an inline one is\n // not, and falls through to the documented `unknown`.\n ...(cr.bodySchemaExport !== undefined\n ? {\n bodySchema: {\n importPath: importPathFor(ctx.dtsOutPath, cr.filePath),\n exportName: cr.bodySchemaExport,\n },\n }\n : {}),\n ...(cr.querySchemaExport !== undefined\n ? {\n querySchema: {\n importPath: importPathFor(ctx.dtsOutPath, cr.filePath),\n exportName: cr.querySchemaExport,\n },\n }\n : {}),\n })\n}\n\n/**\n * EC-3: walk the tree post-build and resolve any node where a method's\n * lowercase name clashes with a child segment. HTTP method wins (more common);\n * the offending child gets a `_` suffix + a warning entry.\n */\nfunction resolveCollisions(node: TreeNode, pathPrefix: string, warnings: string[]): void {\n const methodLowerNames = new Set<string>()\n for (const method of node.methods.keys()) {\n methodLowerNames.add(method.toLowerCase())\n }\n for (const method of node.controllerMethods.keys()) {\n methodLowerNames.add(method.toLowerCase())\n }\n const renames: { from: string; to: string }[] = []\n for (const childName of node.children.keys()) {\n if (methodLowerNames.has(childName)) {\n renames.push({ from: childName, to: `${childName}_` })\n }\n }\n for (const { from, to } of renames) {\n const old = node.children.get(from)\n if (old !== undefined) {\n node.children.delete(from)\n node.children.set(to, old)\n warnings.push(\n `WARNING (EC-3): path collision — method '${from}' clashed with sub-namespace at ${pathPrefix}/${from}; sub-namespace renamed to '${to}'.`,\n )\n }\n }\n // Recurse into all children (including the renamed ones).\n for (const [name, child] of node.children) {\n resolveCollisions(child, `${pathPrefix}/${name}`, warnings)\n }\n}\n\nfunction renderTreeNode(node: TreeNode, indent: string, _isRoot: boolean): string {\n // _isRoot is reserved for callers; current rendering is uniform across roots\n // and children (both open with `{`). Kept in the signature for future overrides.\n const lines: string[] = ['{']\n // Methods first\n for (const [method, source] of node.methods) {\n const lower = method.toLowerCase()\n // Routes with path params (`:id`, `:name`) emit a `{ params: {...} }` object\n // intersected with TheoFetchOptions. Without the outer `{...}` wrap the\n // generated signature `(opts: params: {...} & ...)` is invalid TS syntax\n // (parser reads `params:` as a parameter label, then `{...}` as type — invalid).\n const paramsList = node.paramNamesAccumulated.map((p) => `${p}: string`).join('; ')\n const paramsField =\n node.paramNamesAccumulated.length > 0 ? `{ params: { ${paramsList} } } & ` : ''\n const optionalMark = node.paramNamesAccumulated.length === 0 ? '?' : ''\n // Inline, not an alias declared at the top of the block: an aliased relative `import type`\n // inside `declare module` collapses to `any` once an external package's conditional type is\n // applied to it, with no error (#469).\n const routeType = `typeof import('${source.importPath}').${source.exportName}`\n lines.push(\n `${indent} ${lower}: (opts${optionalMark}: ${paramsField}import('theokit/client').TheoFetchOptions<${routeType}>) => Promise<import('theokit/client').InferResponse<${routeType}>>`,\n )\n }\n // #122 (T2.1) — decorator-controller methods. Response inferred via\n // `Awaited<ReturnType<...>>`; params typed from the route pattern.\n //\n // theokit#124 — the request side too, when the `@Body`/`@Query` schema is EXPORTED. The ADR-2\n // checkpoint was right that the type cannot come from the class (parameter decorators erase to\n // runtime metadata, so `Parameters<...>[N]` is positional-only), and right that the runtime schema\n // carries no source identifier. What it missed is that the codegen LOADS the module, so the schema\n // object can be matched back to an export by reference identity — see `exportedNameOf`. An inline\n // schema has no name to reference and keeps the documented `unknown`.\n for (const [method, leaf] of node.controllerMethods) {\n const lower = method.toLowerCase()\n const paramsList = node.paramNamesAccumulated.map((p) => `${p}: string`).join('; ')\n const paramsField =\n node.paramNamesAccumulated.length > 0 ? `{ params: { ${paramsList} } } & ` : ''\n const optionalMark = node.paramNamesAccumulated.length === 0 ? '?' : ''\n const bodyType =\n leaf.bodySchema === undefined\n ? 'body?: unknown'\n : `body: import('zod').infer<typeof import('${leaf.bodySchema.importPath}').${leaf.bodySchema.exportName}>`\n const queryType =\n leaf.querySchema === undefined\n ? 'query?: Record<string, string>'\n : `query: import('zod').infer<typeof import('${leaf.querySchema.importPath}').${leaf.querySchema.exportName}>`\n lines.push(\n `${indent} ${lower}: (opts${optionalMark}: ${paramsField}{ ${bodyType}; ${queryType} }) => Promise<Awaited<ReturnType<InstanceType<typeof import('${leaf.classSource.importPath}').${leaf.classSource.className}>['${leaf.methodName}']>>>`,\n )\n }\n // Children\n for (const [name, child] of node.children) {\n // Backslash first, then the quote: escaping the quote while leaving the escape character\n // untouched means `back\\` emits as `'back\\'`, whose trailing backslash escapes the closing\n // quote and swallows the rest of the line. A backslash is a legal POSIX filename character, so\n // it reaches here from `server/routes/`.\n const propKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n ? name\n : `'${name.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\")}'`\n lines.push(`${indent} ${propKey}: ${renderTreeNode(child, indent + ' ', false)}`)\n }\n lines.push(`${indent}}`)\n return lines.join('\\n')\n}\n\ninterface GenerateClientDtsOptions {\n manifest: TheoManifest\n /** Absolute path to the .d.ts that will be emitted. Used to compute import paths. */\n dtsOutPath: string\n /** Absolute serverDir; manifest's filePath entries are relative to this. */\n serverDir: string\n /**\n * #122 (T2.1) — decorator-controller routes (from `collectControllerRouteData`),\n * merged into the same `client.<ns>.<method>()` tree as file routes. Absent/empty\n * → zero controller output (ADR-5 routes-only byte-identity).\n */\n controllerRoutes?: ControllerRouteData[]\n}\n\nexport function generateClientDts({\n manifest,\n dtsOutPath,\n serverDir,\n controllerRoutes,\n}: GenerateClientDtsOptions): string {\n const ctx: BuildContext = {\n root: makeNode(),\n warnings: [],\n dtsOutPath,\n serverDir,\n }\n for (const route of manifest.routes) {\n buildOneRoute(route, ctx)\n }\n // #122 (T2.1) — merge decorator controllers into the same tree. One import\n // alias per class (shared across its methods), keyed by source file.\n if (controllerRoutes?.length) {\n for (const cr of controllerRoutes) {\n buildOneController(\n cr,\n { importPath: importPathFor(dtsOutPath, cr.filePath), className: cr.className },\n ctx,\n )\n }\n }\n // EC-3: resolve collisions in a post-build pass (collisions materialize\n // when two routes are both processed, not during a single route's build).\n resolveCollisions(ctx.root, '', ctx.warnings)\n\n // No import block at all since #469: every type is named inline as `typeof import('...')`, which\n // is the only form measured to survive inside `declare module`. Nothing pushes here any more, so\n // the seam is gone rather than left empty — an empty seam invites the next author to use it.\n const importsBlock = '\\n'\n const warningsBlock =\n ctx.warnings.length > 0 ? ' // ' + ctx.warnings.join('\\n // ') + '\\n\\n' : ''\n\n // Empty manifest (no routes with methods) → emit a stub interface so consumers\n // still get `client.X` autocomplete-friendly errors instead of \"Module not found\".\n const treeBody =\n ctx.root.children.size === 0 &&\n ctx.root.methods.size === 0 &&\n ctx.root.controllerMethods.size === 0\n ? '{\\n // No routes detected — add `server/routes/*.ts` to populate this client.\\n }'\n : renderTreeNode(ctx.root, ' ', /* isRoot */ true)\n\n return `${FILE_HEADER}\ndeclare module '@theo/client' {\n${importsBlock}${warningsBlock} export interface AppClient ${treeBody}\n export const client: AppClient\n}\n`\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Phase 4 — Vite plugin\n// ─────────────────────────────────────────────────────────────────────────────\n\ninterface AppTypedClientPluginOptions {\n /** Project root (cwd). */\n cwd: string\n /** Absolute path to the user's `server/` dir. */\n serverDir: string\n /** Absolute path to the `.theokit/` output dir (where `client.d.ts` lands). */\n distDir: string\n /**\n * Additional routes to merge into the typed client alongside file-system routes.\n * Each entry follows ManifestRoute shape (filePath, routePath, methods, paramNames).\n *\n * Used by `@theokit/http` `httpDecoratorsPlugin` to inject\n * decorator-defined routes — zero coupling between theokit core and the\n * decorator package (the walk happens in http-decorators; only data arrives here).\n */\n extraRoutes?: ManifestRoute[]\n}\n\nconst VIRTUAL_APP_CLIENT_ID = '@theo/client'\nconst RESOLVED_APP_CLIENT_ID = '\\0@theo/client'\n\n/**\n * Should a watcher file event under `routes/` or `controllers/` trigger a client\n * re-emit? Ignores the `.__decorated__.mjs` temp files that `loadControllerWithSwc`\n * writes+unlinks during controller codegen — reacting to them would create a\n * perpetual emit→temp-write→watcher→emit loop (#122 T2.1).\n */\nexport function shouldReemitForFile(\n file: string,\n routesGlob: string,\n controllersGlob: string,\n): boolean {\n const normalized = file.replace(/\\\\/g, '/')\n if (normalized.includes('.__decorated__.')) return false\n return normalized.startsWith(routesGlob) || normalized.startsWith(controllersGlob)\n}\n\n/** Atomic write via tmp + rename (EC-6). Skips when content is unchanged. */\nfunction writeFileIfChanged(filePath: string, content: string): { changed: boolean } {\n if (existsSync(filePath)) {\n try {\n const current = readFileSync(filePath, 'utf-8')\n if (current === content) return { changed: false }\n } catch {\n // fall through to write\n }\n }\n mkdirSync(dirname(filePath), { recursive: true })\n const tmp = `${filePath}.${process.pid}.tmp`\n writeFileSync(tmp, content)\n renameSync(tmp, filePath)\n return { changed: true }\n}\n\nasync function emitClientDts(\n opts: AppTypedClientPluginOptions,\n): Promise<{ changed: boolean; path: string }> {\n if (!existsSync(opts.serverDir)) {\n // No server dir — emit empty stub to avoid \"module not found\".\n const stubPath = posix.join(opts.distDir.replace(/\\\\/g, '/'), 'client.d.ts')\n return {\n changed: writeFileIfChanged(\n stubPath,\n generateClientDts({\n manifest: {\n version: 1,\n generatedAt: new Date().toISOString(),\n routes: [],\n actions: [],\n websockets: [],\n },\n dtsOutPath: stubPath,\n serverDir: opts.serverDir,\n }),\n ).changed,\n path: stubPath,\n }\n }\n const manifest = generateManifest(opts.serverDir)\n\n // Decorator-client-bridge: merge extra routes (from @theokit/http\n // or any other source) into the manifest so generateClientDts() produces a\n // SINGLE typed client covering both file-system routes AND injected routes.\n if (opts.extraRoutes?.length) {\n manifest.routes.push(...opts.extraRoutes)\n }\n\n // #122 (T2.1) — merge decorator controllers under `<serverDir>/controllers/`\n // into the same typed client. Zero output when the dir is absent/empty (ADR-5).\n const controllersDir = resolve(opts.serverDir, 'controllers')\n const controllerRoutes = existsSync(controllersDir)\n ? await collectControllerRouteData({ controllersDir })\n : []\n\n const dtsOutPath = posix.join(opts.distDir.replace(/\\\\/g, '/'), 'client.d.ts')\n const content = generateClientDts({\n manifest,\n dtsOutPath,\n serverDir: opts.serverDir,\n controllerRoutes,\n })\n const { changed } = writeFileIfChanged(dtsOutPath, content)\n return { changed, path: dtsOutPath }\n}\n\nexport function appTypedClientPlugin(opts: AppTypedClientPluginOptions): Plugin {\n let debounceTimer: NodeJS.Timeout | undefined\n let viteServer: ViteDevServer | undefined\n\n function scheduleEmit(): void {\n if (debounceTimer) clearTimeout(debounceTimer)\n debounceTimer = setTimeout(() => {\n void (async () => {\n try {\n await emitClientDts(opts)\n // Invalidate the virtual module so re-imports pick up potential new shape.\n if (viteServer) {\n const mod = viteServer.moduleGraph.getModuleById(RESOLVED_APP_CLIENT_ID)\n if (mod) viteServer.moduleGraph.invalidateModule(mod)\n }\n } catch (err) {\n // Surface but don't crash dev server.\n console.error('[theokit:app-typed-client] codegen error:', err)\n }\n })()\n }, 100)\n }\n\n return {\n name: 'theokit:app-typed-client',\n enforce: 'post',\n async configResolved() {\n try {\n await emitClientDts(opts)\n } catch (err) {\n console.error('[theokit:app-typed-client] initial codegen error:', err)\n }\n },\n async buildEnd() {\n try {\n await emitClientDts(opts)\n } catch (err) {\n console.error('[theokit:app-typed-client] buildEnd codegen error:', err)\n }\n },\n configureServer(server) {\n viteServer = server\n const routesGlob = posix.join(opts.serverDir.replace(/\\\\/g, '/'), 'routes')\n const controllersGlob = posix.join(opts.serverDir.replace(/\\\\/g, '/'), 'controllers')\n const onFile = (file: string): void => {\n if (shouldReemitForFile(file, routesGlob, controllersGlob)) scheduleEmit()\n }\n server.watcher.on('add', onFile)\n server.watcher.on('change', onFile)\n server.watcher.on('unlink', onFile)\n },\n resolveId(id) {\n if (id === VIRTUAL_APP_CLIENT_ID) return RESOLVED_APP_CLIENT_ID\n return null\n },\n load(id) {\n if (id === RESOLVED_APP_CLIENT_ID) {\n return [\n `import { createAppClient } from 'theokit/client'`,\n `export const client = createAppClient()`,\n `export default client`,\n ``,\n ].join('\\n')\n }\n return null\n },\n }\n}\n\nexport { VIRTUAL_APP_CLIENT_ID, RESOLVED_APP_CLIENT_ID, emitClientDts }\n","/**\n * #122 (T2.1) — typed-client codegen for decorator controllers.\n *\n * Collects the routing metadata of every `@Controller` under `controllersDir`\n * so the app-typed-client codegen can emit `client.<ns>.<method>()` entries.\n * Codegen loads controllers via `loadControllerWithSwc` (swc-compile + import,\n * no Vite dev server needed) — distinct from the dev SERVING path, which loads\n * through Vite's `ssrLoadModule`.\n *\n * ADR-2 checkpoint (LOCKED — see the plan's Unresolved Questions): only the\n * RESPONSE type is inferred, via `Awaited<ReturnType<InstanceType<typeof C>['m']>>`.\n * Request `@Body` types are NOT inferred from the class — parameter decorators are\n * erased runtime metadata, invisible to the type system, so `Parameters<...>[N]` is\n * positional-only and cannot tell body from param from query. Body falls back to\n * `unknown` (runtime `@Body` Zod validation from Phase 1 still applies). Full body\n * inference is tracked in the follow-up issue.\n */\nimport { loadControllerWithSwc, walkControllerMetadata } from '@theokit/http'\n\nimport {\n scanControllerModules,\n type ControllerModuleLoader,\n} from '../server/http/controller-dispatch.js'\n\n/** One controller route, flattened for the client codegen. */\nexport interface ControllerRouteData {\n /** Absolute path to the `*.controller.ts` source (for the `import type` line). */\n filePath: string\n /** The exported class name (e.g. `TasksController`). */\n className: string\n /** Full route path, e.g. `/api/v2/tasks/:id`. */\n fullPath: string\n /** HTTP verb (`GET`, `POST`, …). */\n verb: string\n /** The controller method name backing this route (e.g. `findById`). */\n methodName: string\n /**\n * theokit#124 — the EXPORTED name of the `@Body(schema)` Zod schema, when it has one.\n *\n * Absent when the schema is declared inline or otherwise not exported: there is then no\n * identifier the emitted `.d.ts` could reference, and the body stays `unknown`.\n */\n bodySchemaExport?: string\n /** theokit#124 — same for `@Query(schema)`. */\n querySchemaExport?: string\n /**\n * theokit#124 — a `@Body`/`@Query` schema EXISTS on this route but is not exported, so no name\n * could be referenced and the type degraded to `unknown`.\n *\n * Distinct from \"there is no schema at all\": that route was never going to be typed and needs no\n * explanation, while this one looks arbitrarily untyped next to a typed neighbour. The codegen\n * turns this into a note in the emitted file so the difference is legible.\n */\n schemaNotExported?: boolean\n}\n\n/**\n * Recover the EXPORTED name of a runtime schema object — theokit#124.\n *\n * `WalkResult.bodySchema` is a `z.ZodType` instance with no source identifier, which is why #122's\n * ADR-2 checkpoint concluded the request type was unrecoverable. It is recoverable, just not from\n * the metadata: the codegen already imports the module, so this object IS the one the module\n * exported, and reference identity gives back its name. No parsing, no heuristics — either some\n * export is the same object or none is.\n *\n * Returns `undefined` for an inline schema, which is a real limit rather than a bug: an unexported\n * value has no name a `.d.ts` can import.\n */\nfunction exportedNameOf(\n schema: unknown,\n moduleExports: Readonly<Record<string, unknown>>,\n): string | undefined {\n if (schema === undefined || schema === null) return undefined\n for (const [name, value] of Object.entries(moduleExports)) {\n // Reference identity, never structural comparison: two distinct schemas can be deeply equal,\n // and emitting the wrong name would type the client against the wrong contract silently.\n if (value === schema) return name\n }\n return undefined\n}\n\n/**\n * Scan `controllersDir` and flatten every controller's routes into\n * {@link ControllerRouteData}. Returns `[]` when the directory has no controllers\n * (so the codegen contributes zero bytes — ADR-5 routes-only byte-identity).\n */\nexport async function collectControllerRouteData(opts: {\n controllersDir: string\n loadModule?: ControllerModuleLoader\n}): Promise<ControllerRouteData[]> {\n const loader = opts.loadModule ?? loadControllerWithSwc\n const modules = await scanControllerModules(opts.controllersDir, loader)\n const out: ControllerRouteData[] = []\n for (const { filePath, cls, exports } of modules) {\n const className = (cls as { name: string }).name\n for (const walk of walkControllerMetadata(cls)) {\n const bodySchemaExport = exportedNameOf(walk.bodySchema, exports)\n // `walk.querySchema` is DECLARED on `WalkResult` and never populated — `walkControllerMetadata`\n // resolves a body schema and has no query counterpart, so the field always reads `undefined`\n // (grep: the only occurrence in `@theokit/http` is its own declaration). Reading the entry\n // directly is therefore not a shortcut around an API; it is the only place the schema exists.\n //\n // Deliberately NOT fixed by populating `querySchema` here: that field feeds runtime validation\n // for `@Body`, so filling the query one would start VALIDATING query strings that are not\n // validated today. This issue is about editor types; silently turning on runtime rejection\n // under it would be a behaviour change nobody asked for. Filed separately.\n const queryEntry = walk.paramEntries.find(\n (e) => e.source === 'query' && e.schema !== undefined,\n )\n const querySchemaExport = exportedNameOf(queryEntry?.schema, exports)\n out.push({\n filePath,\n className,\n fullPath: walk.fullPath,\n verb: walk.verb,\n methodName: String(walk.propertyKey),\n ...(bodySchemaExport !== undefined ? { bodySchemaExport } : {}),\n ...(querySchemaExport !== undefined ? { querySchemaExport } : {}),\n ...((walk.bodySchema !== undefined && bodySchemaExport === undefined) ||\n (queryEnt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AI;AAAA,MACb;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  scanControllerModules
3
- } from "./chunk-VGE6AKEJ.js";
4
- import "./chunk-JUDNKBDQ.js";
5
- import "./chunk-5BOKW3GX.js";
3
+ } from "./chunk-DAE7BJ7H.js";
4
+ import "./chunk-WX6NHGKS.js";
5
+ import "./chunk-FVFYACYK.js";
6
6
  import "./chunk-ZDUO4IYN.js";
7
7
  import "./chunk-47FFT43U.js";
8
8
  import "./chunk-NTDN54XO.js";
@@ -14,7 +14,7 @@ import "./chunk-TNI4MARH.js";
14
14
  import "./chunk-OQCRCXCP.js";
15
15
  import {
16
16
  generateManifest
17
- } from "./chunk-VHB2FSPM.js";
17
+ } from "./chunk-I2UN46ZX.js";
18
18
  import {
19
19
  HTTP_METHODS
20
20
  } from "./chunk-DV34VG3N.js";
@@ -96,9 +96,8 @@ function normalizeSegment(raw) {
96
96
  let s = raw;
97
97
  if (s.startsWith(":...")) s = s.slice(4);
98
98
  else if (s.startsWith(":")) s = s.slice(1);
99
- const camel = s.replace(/-([a-z0-9])/gi, (_, c) => c.toUpperCase());
100
- if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(camel)) {
101
- return { identifier: camel, bracket: false };
99
+ if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s)) {
100
+ return { identifier: s, bracket: false };
102
101
  }
103
102
  return { identifier: s, bracket: true };
104
103
  }
@@ -130,13 +129,10 @@ function paramNamesFromRoute(routePath) {
130
129
  }
131
130
  function buildOneRoute(route, ctx) {
132
131
  if (!route.methods || route.methods.length === 0) return;
133
- const idx = ctx.aliasCounter.value++;
134
132
  const absRouteFile = isAbsolute(route.filePath) ? route.filePath : resolve(ctx.serverDir, route.filePath);
135
133
  const importPath = importPathFor(ctx.dtsOutPath, absRouteFile);
136
- const aliases = route.methods.filter((m) => HTTP_METHODS.includes(m)).map((method) => ({ method, alias: `_r${idx}_${method}` }));
134
+ const aliases = route.methods.filter((m) => HTTP_METHODS.includes(m)).map((method) => ({ method }));
137
135
  if (aliases.length === 0) return;
138
- const importClause = aliases.map((a) => `${a.method} as ${a.alias}`).join(", ");
139
- ctx.importLines.push(` import type { ${importClause} } from '${importPath}'`);
140
136
  const segments = routePathSegments(route.routePath);
141
137
  let node = ctx.root;
142
138
  for (const seg of segments) {
@@ -149,16 +145,16 @@ function buildOneRoute(route, ctx) {
149
145
  node = child;
150
146
  }
151
147
  node.paramNamesAccumulated = paramNamesFromRoute(route.routePath);
152
- for (const { method, alias } of aliases) {
148
+ for (const { method } of aliases) {
153
149
  if (node.methods.has(method)) {
154
150
  ctx.warnings.push(
155
151
  `// WARNING: duplicate ${method} export at /${segments.join("/")} (route file declared twice). Keeping last definition.`
156
152
  );
157
153
  }
158
- node.methods.set(method, alias);
154
+ node.methods.set(method, { importPath, exportName: method });
159
155
  }
160
156
  }
161
- function buildOneController(cr, classAlias, ctx) {
157
+ function buildOneController(cr, classSource, ctx) {
162
158
  const verb = cr.verb.toUpperCase();
163
159
  if (!HTTP_METHODS.includes(verb)) return;
164
160
  const method = verb;
@@ -185,7 +181,7 @@ function buildOneController(cr, classAlias, ctx) {
185
181
  if (!ctx.warnings.includes(note)) ctx.warnings.push(note);
186
182
  }
187
183
  node.controllerMethods.set(method, {
188
- classAlias,
184
+ classSource,
189
185
  methodName: cr.methodName,
190
186
  // theokit#124 — an EXPORTED schema is referenceable from the emitted `.d.ts`; an inline one is
191
187
  // not, and falls through to the documented `unknown`.
@@ -233,13 +229,14 @@ function resolveCollisions(node, pathPrefix, warnings) {
233
229
  }
234
230
  function renderTreeNode(node, indent, _isRoot) {
235
231
  const lines = ["{"];
236
- for (const [method, alias] of node.methods) {
232
+ for (const [method, source] of node.methods) {
237
233
  const lower = method.toLowerCase();
238
234
  const paramsList = node.paramNamesAccumulated.map((p) => `${p}: string`).join("; ");
239
235
  const paramsField = node.paramNamesAccumulated.length > 0 ? `{ params: { ${paramsList} } } & ` : "";
240
236
  const optionalMark = node.paramNamesAccumulated.length === 0 ? "?" : "";
237
+ const routeType = `typeof import('${source.importPath}').${source.exportName}`;
241
238
  lines.push(
242
- `${indent} ${lower}: (opts${optionalMark}: ${paramsField}import('theokit/client').TheoFetchOptions<typeof ${alias}>) => Promise<import('theokit/client').InferResponse<typeof ${alias}>>`
239
+ `${indent} ${lower}: (opts${optionalMark}: ${paramsField}import('theokit/client').TheoFetchOptions<${routeType}>) => Promise<import('theokit/client').InferResponse<${routeType}>>`
243
240
  );
244
241
  }
245
242
  for (const [method, leaf] of node.controllerMethods) {
@@ -250,7 +247,7 @@ function renderTreeNode(node, indent, _isRoot) {
250
247
  const bodyType = leaf.bodySchema === void 0 ? "body?: unknown" : `body: import('zod').infer<typeof import('${leaf.bodySchema.importPath}').${leaf.bodySchema.exportName}>`;
251
248
  const queryType = leaf.querySchema === void 0 ? "query?: Record<string, string>" : `query: import('zod').infer<typeof import('${leaf.querySchema.importPath}').${leaf.querySchema.exportName}>`;
252
249
  lines.push(
253
- `${indent} ${lower}: (opts${optionalMark}: ${paramsField}{ ${bodyType}; ${queryType} }) => Promise<Awaited<ReturnType<InstanceType<typeof ${leaf.classAlias}>['${leaf.methodName}']>>>`
250
+ `${indent} ${lower}: (opts${optionalMark}: ${paramsField}{ ${bodyType}; ${queryType} }) => Promise<Awaited<ReturnType<InstanceType<typeof import('${leaf.classSource.importPath}').${leaf.classSource.className}>['${leaf.methodName}']>>>`
254
251
  );
255
252
  }
256
253
  for (const [name, child] of node.children) {
@@ -268,8 +265,6 @@ function generateClientDts({
268
265
  }) {
269
266
  const ctx = {
270
267
  root: makeNode(),
271
- aliasCounter: { value: 0 },
272
- importLines: [],
273
268
  warnings: [],
274
269
  dtsOutPath,
275
270
  serverDir
@@ -278,20 +273,16 @@ function generateClientDts({
278
273
  buildOneRoute(route, ctx);
279
274
  }
280
275
  if (controllerRoutes?.length) {
281
- const classAliases = /* @__PURE__ */ new Map();
282
276
  for (const cr of controllerRoutes) {
283
- let alias = classAliases.get(cr.filePath);
284
- if (alias === void 0) {
285
- alias = `_c${classAliases.size}`;
286
- classAliases.set(cr.filePath, alias);
287
- const importPath = importPathFor(dtsOutPath, cr.filePath);
288
- ctx.importLines.push(` import type { ${cr.className} as ${alias} } from '${importPath}'`);
289
- }
290
- buildOneController(cr, alias, ctx);
277
+ buildOneController(
278
+ cr,
279
+ { importPath: importPathFor(dtsOutPath, cr.filePath), className: cr.className },
280
+ ctx
281
+ );
291
282
  }
292
283
  }
293
284
  resolveCollisions(ctx.root, "", ctx.warnings);
294
- const importsBlock = ctx.importLines.length > 0 ? ctx.importLines.join("\n") + "\n\n" : "\n";
285
+ const importsBlock = "\n";
295
286
  const warningsBlock = ctx.warnings.length > 0 ? " // " + ctx.warnings.join("\n // ") + "\n\n" : "";
296
287
  const treeBody = ctx.root.children.size === 0 && ctx.root.methods.size === 0 && ctx.root.controllerMethods.size === 0 ? "{\n // No routes detected \u2014 add `server/routes/*.ts` to populate this client.\n }" : renderTreeNode(
297
288
  ctx.root,
@@ -436,4 +427,4 @@ export {
436
427
  generateClientDts,
437
428
  shouldReemitForFile
438
429
  };
439
- //# sourceMappingURL=app-typed-client-ZZIASI4A.js.map
430
+ //# sourceMappingURL=app-typed-client-6MNNVMJU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-plugin/app-typed-client.ts","../src/vite-plugin/controller-client-emit.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,WAAW,cAAc,YAAY,eAAe,kBAAkB;AAC/E,SAAS,SAAS,YAAY,OAAO,UAAU,eAAe;;;ACP9D,SAAS,uBAAuB,8BAA8B;AAmD9D,SAAS,eACP,QACA,eACoB;AACpB,MAAI,WAAW,UAAa,WAAW,KAAM,QAAO;AACpD,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,aAAa,GAAG;AAGzD,QAAI,UAAU,OAAQ,QAAO;AAAA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B,SAAS,KAAK;AACZ,gBAAQ,MAAM,qDAAqD,GAAG;AAAA,MACxE;AAAA,IACF;AAAA,IACA,MAAM,WAAW;AACf,UAAI;AACF,cAAM,cAAc,IAAI;AAAA,MAC1B,SAAS,KAAK;AACZ,gBAAQ,MAAM,sDAAsD,GAAG;AAAA,MACzE;AAAA,IACF;AAAA,IACA,gBAAgB,QAAQ;AACtB,mBAAa;AACb,YAAM,aAAa,MAAM,KAAK,KAAK,UAAU,QAAQ,OAAO,GAAG,GAAG,QAAQ;AAC1E,YAAM,kBAAkB,MAAM,KAAK,KAAK,UAAU,QAAQ,OAAO,GAAG,GAAG,aAAa;AACpF,YAAM,SAAS,CAAC,SAAuB;AACrC,YAAI,oBAAoB,MAAM,YAAY,eAAe,EAAG,cAAa;AAAA,MAC3E;AACA,aAAO,QAAQ,GAAG,OAAO,MAAM;AAC/B,aAAO,QAAQ,GAAG,UAAU,MAAM;AAClC,aAAO,QAAQ,GAAG,UAAU,MAAM;AAAA,IACpC;AAAA,IACA,UAAU,IAAI;AACZ,UAAI,OAAO,sBAAuB,QAAO;AACzC,aAAO;AAAA,IACT;AAAA,IACA,KAAK,IAAI;AACP,UAAI,OAAO,wBAAwB;AACjC,eAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,EAAE,KAAK,IAAI;AAAA,MACb;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
@@ -20,33 +20,33 @@ import "./chunk-7UZZHCRN.js";
20
20
  import {
21
21
  generateManifest,
22
22
  writeManifest as writeManifest2
23
- } from "./chunk-XLLW46MB.js";
23
+ } from "./chunk-2HWWJTOH.js";
24
24
  import {
25
25
  scanAgents
26
- } from "./chunk-6AM7HIRM.js";
26
+ } from "./chunk-5NNFO7R7.js";
27
27
  import {
28
28
  scanServerRoutes,
29
29
  scanWebSocketRoutes
30
- } from "./chunk-YYOBMOO4.js";
30
+ } from "./chunk-NO6HA4FG.js";
31
31
  import {
32
32
  compareByCodeUnit,
33
33
  walkSourceFiles
34
34
  } from "./chunk-Z7CJHDLS.js";
35
35
  import {
36
36
  loadConfig
37
- } from "./chunk-QTHVHNJJ.js";
37
+ } from "./chunk-HA35FS7U.js";
38
38
  import {
39
39
  loadEnv
40
40
  } from "./chunk-3QPVEJ7D.js";
41
41
  import {
42
42
  importUserModule
43
43
  } from "./chunk-U5PWXS3J.js";
44
- import "./chunk-FH3SQR6P.js";
44
+ import "./chunk-4OTIXAUY.js";
45
45
  import {
46
46
  buildManifest,
47
47
  writeManifest
48
48
  } from "./chunk-ZNZISJDZ.js";
49
- import "./chunk-VI7ZANB3.js";
49
+ import "./chunk-OSBGZYXZ.js";
50
50
 
51
51
  // src/cli/commands/build.ts
52
52
  import { existsSync as existsSync4 } from "fs";
@@ -554,7 +554,7 @@ async function buildCommand(options) {
554
554
  `);
555
555
  }
556
556
  async function runAdapterBuild(target, config, cwd) {
557
- const { theoPluginAsync } = await import("./vite-plugin-2XM35VNV.js");
557
+ const { theoPluginAsync } = await import("./vite-plugin-VYNUCEI2.js");
558
558
  const { default: react } = await import("@vitejs/plugin-react");
559
559
  const ctx = {
560
560
  // `react()` may return Plugin or Plugin[] depending on version; spread the
@@ -675,4 +675,4 @@ function relativize3(absPath, root) {
675
675
  export {
676
676
  buildCommand
677
677
  };
678
- //# sourceMappingURL=build-3AYYQZGQ.js.map
678
+ //# sourceMappingURL=build-JH53TZJI.js.map
@@ -2,13 +2,13 @@
2
2
  import "tsx/esm";
3
3
  import {
4
4
  scanAgents
5
- } from "./chunk-6AM7HIRM.js";
5
+ } from "./chunk-5NNFO7R7.js";
6
6
  import {
7
7
  compilePattern,
8
8
  scanServerActions,
9
9
  scanServerRoutes,
10
10
  scanWebSocketRoutes
11
- } from "./chunk-YYOBMOO4.js";
11
+ } from "./chunk-NO6HA4FG.js";
12
12
 
13
13
  // src/server/scan/manifest.ts
14
14
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
@@ -25,7 +25,8 @@ function generateManifest(serverDir, projectRoot = dirname(serverDir), agentsDir
25
25
  filePath: relative(serverDir, r.filePath),
26
26
  routePath: r.routePath,
27
27
  paramNames: r.paramNames,
28
- ...r.methods !== void 0 ? { methods: r.methods } : {}
28
+ ...r.methods !== void 0 ? { methods: r.methods } : {},
29
+ ...r.publicMethods !== void 0 ? { publicMethods: r.publicMethods } : {}
29
30
  })),
30
31
  actions: actions.map((a) => ({
31
32
  filePath: relative(serverDir, a.filePath),
@@ -61,7 +62,8 @@ function loadManifest(distDir, serverDir) {
61
62
  routePath: r.routePath,
62
63
  paramNames,
63
64
  pattern,
64
- ...r.methods !== void 0 ? { methods: r.methods } : {}
65
+ ...r.methods !== void 0 ? { methods: r.methods } : {},
66
+ ...r.publicMethods !== void 0 ? { publicMethods: r.publicMethods } : {}
65
67
  };
66
68
  });
67
69
  const actions = raw.actions.map((a) => ({
@@ -86,4 +88,4 @@ export {
86
88
  writeManifest,
87
89
  loadManifest
88
90
  };
89
- //# sourceMappingURL=chunk-XLLW46MB.js.map
91
+ //# sourceMappingURL=chunk-2HWWJTOH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/scan/manifest.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time manifest emitter / loader. All paths derived from `distDir`\n * + `serverDir`, themselves resolved from `process.cwd()`. No HTTP input.\n */\nimport { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'\nimport { join, resolve, relative, dirname } from 'node:path'\n\nimport { scanServerActions } from './action-scan.js'\nimport type { ActionNode } from './action-scan.js'\nimport { scanAgents } from './agent-scan.js'\nimport type { AgentNode } from './agent-scan.js'\nimport { compilePattern } from './match.js'\nimport type { ServerRouteNode } from './match.js'\nimport { scanServerRoutes } from './scan.js'\nimport { scanWebSocketRoutes } from './ws-scan.js'\nimport type { WebSocketRouteNode } from './ws-scan.js'\n\n// --- Manifest Types ---\n\nexport interface ManifestRoute {\n filePath: string\n routePath: string\n paramNames: string[]\n /** HTTP methods (uppercase) the route file exports. Optional — manifests\n * generated before G1 omit this; loaders treat absence as \"unknown\". */\n methods?: string[]\n /**\n * The subset of `methods` declaring `policy('public')`. Optional for the same reason `methods`\n * is: a manifest written before the field existed has none, and `public-exposure-gate.ts` reads\n * that absence as \"not measured\" rather than as \"nothing is public\".\n */\n publicMethods?: string[]\n}\n\nexport interface ManifestAction {\n filePath: string\n actionPath: string\n}\n\nexport interface ManifestWebSocket {\n filePath: string\n wsPath: string\n}\n\n/** M2 — a top-level `agents/*.ts` convention entry. `filePath` is relative to the\n * project root (agents live OUTSIDE `serverDir`), unlike routes/actions/ws. */\nexport interface ManifestAgent {\n filePath: string\n agentPath: string\n name: string\n}\n\nexport interface TheoManifest {\n version: 1\n generatedAt: string\n routes: ManifestRoute[]\n actions: ManifestAction[]\n websockets: ManifestWebSocket[]\n /** M2 — optional for backward compat: manifests generated before M2 omit it. */\n agents?: ManifestAgent[]\n}\n\nexport interface LoadedManifest {\n routes: ServerRouteNode[]\n actions: ActionNode[]\n websockets: WebSocketRouteNode[]\n agents: AgentNode[]\n}\n\n// --- Generate ---\n\nexport function generateManifest(\n serverDir: string,\n // Agents live at `<projectRoot>/<agentsDir>`. Defaults to the server dir's parent; overridable\n // for tests / non-standard layouts.\n projectRoot: string = dirname(serverDir),\n // Agents dir NAME (config `agentsDir`, default \"agents\"), relative to projectRoot (#95 follow-up).\n agentsDir = 'agents',\n): TheoManifest {\n const routes = scanServerRoutes(serverDir)\n const actions = scanServerActions(serverDir)\n const websockets = scanWebSocketRoutes(serverDir)\n const agents = scanAgents(projectRoot, agentsDir)\n\n return {\n version: 1,\n generatedAt: new Date().toISOString(),\n routes: routes.map((r) => ({\n filePath: relative(serverDir, r.filePath),\n routePath: r.routePath,\n paramNames: r.paramNames,\n ...(r.methods !== undefined ? { methods: r.methods } : {}),\n ...(r.publicMethods !== undefined ? { publicMethods: r.publicMethods } : {}),\n })),\n actions: actions.map((a) => ({\n filePath: relative(serverDir, a.filePath),\n actionPath: a.actionPath,\n })),\n websockets: websockets.map((w) => ({\n filePath: relative(serverDir, w.filePath),\n wsPath: w.wsPath,\n })),\n agents: agents.map((a) => ({\n // Relative to projectRoot (agents/ is outside serverDir).\n filePath: relative(projectRoot, a.filePath),\n agentPath: a.agentPath,\n name: a.name,\n })),\n }\n}\n\n// --- Write ---\n\nexport function writeManifest(manifest: TheoManifest, outputDir: string): void {\n mkdirSync(outputDir, { recursive: true })\n const manifestPath = join(outputDir, 'manifest.json')\n writeFileSync(manifestPath, JSON.stringify(manifest, null, 2))\n}\n\n// --- Load ---\n\nexport function loadManifest(distDir: string, serverDir: string): LoadedManifest {\n const manifestPath = join(distDir, 'manifest.json')\n\n if (!existsSync(manifestPath)) {\n throw new Error(`No manifest found at ${manifestPath}. Run \"theo build\" first.`)\n }\n\n const raw = JSON.parse(readFileSync(manifestPath, 'utf-8')) as TheoManifest\n\n const routes: ServerRouteNode[] = raw.routes.map((r) => {\n const { pattern, paramNames } = compilePattern(r.routePath)\n return {\n filePath: resolve(serverDir, r.filePath),\n routePath: r.routePath,\n paramNames,\n pattern,\n ...(r.methods !== undefined ? { methods: r.methods } : {}),\n ...(r.publicMethods !== undefined ? { publicMethods: r.publicMethods } : {}),\n }\n })\n\n const actions: ActionNode[] = raw.actions.map((a) => ({\n filePath: resolve(serverDir, a.filePath),\n actionPath: a.actionPath,\n }))\n\n const websockets: WebSocketRouteNode[] = raw.websockets.map((w) => ({\n filePath: resolve(serverDir, w.filePath),\n wsPath: w.wsPath,\n }))\n\n // M2 — agents resolve relative to the project root (sibling of serverDir).\n // `?? []` keeps pre-M2 manifests (no `agents` field) loadable (fail-safe).\n const projectRoot = dirname(serverDir)\n const agents: AgentNode[] = (raw.agents ?? []).map((a) => ({\n filePath: resolve(projectRoot, a.filePath),\n agentPath: a.agentPath,\n name: a.name,\n }))\n\n return { routes, actions, websockets, agents }\n}\n"],"mappings":";;;;;;;;;;;;;AAIA,SAAS,YAAY,cAAc,eAAe,iBAAi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