theokit 0.67.0 → 0.69.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 (143) hide show
  1. package/README.md +21 -0
  2. package/dist/{actions-virtual-module-YIWQTI6Q.js → actions-virtual-module-DH3N34I6.js} +6 -6
  3. package/dist/{actions-virtual-module-WCHXKH6R.js → actions-virtual-module-OMIFGXK6.js} +4 -4
  4. package/dist/adapters/agent-mount.d.ts +190 -2
  5. package/dist/adapters/agent-mount.js +18 -3
  6. package/dist/adapters/security-headers.d.ts +17 -1
  7. package/dist/adapters/security-headers.js +7 -0
  8. package/dist/adapters/security-headers.js.map +1 -1
  9. package/dist/{agent-C7F5O5V4.js → agent-7RPGAKTY.js} +3 -3
  10. package/dist/{app-typed-client-2ZEGNFJP.js → app-typed-client-C4LRUSIS.js} +6 -6
  11. package/dist/{app-typed-client-CUM2GZ5Y.js → app-typed-client-R6OUJZEE.js} +4 -4
  12. package/dist/assets-map-BMQASQHW.js +70 -0
  13. package/dist/assets-map-BMQASQHW.js.map +1 -0
  14. package/dist/assets-map-CV2YZ3MY.js +69 -0
  15. package/dist/assets-map-CV2YZ3MY.js.map +1 -0
  16. package/dist/{aws-lambda-R76PWR27.js → aws-lambda-OCJM5YGB.js} +35 -23
  17. package/dist/aws-lambda-OCJM5YGB.js.map +1 -0
  18. package/dist/{build-UNBI6VKC.js → build-CGFKWZ73.js} +13 -8
  19. package/dist/build-CGFKWZ73.js.map +1 -0
  20. package/dist/{bun-NPBIAWSU.js → bun-KRUAWYRW.js} +51 -39
  21. package/dist/bun-KRUAWYRW.js.map +1 -0
  22. package/dist/{chunk-GQNBZDYK.js → chunk-2FHNJ7LI.js} +1 -1
  23. package/dist/{chunk-GQNBZDYK.js.map → chunk-2FHNJ7LI.js.map} +1 -1
  24. package/dist/chunk-3T5XLDOH.js +807 -0
  25. package/dist/chunk-3T5XLDOH.js.map +1 -0
  26. package/dist/{chunk-WAYUHS54.js → chunk-425FJKKO.js} +5 -3
  27. package/dist/chunk-425FJKKO.js.map +1 -0
  28. package/dist/chunk-46FM5AFZ.js +44 -0
  29. package/dist/chunk-46FM5AFZ.js.map +1 -0
  30. package/dist/{chunk-ASBXR57P.js → chunk-4WB62S22.js} +7 -4
  31. package/dist/{chunk-ASBXR57P.js.map → chunk-4WB62S22.js.map} +1 -1
  32. package/dist/chunk-BDPD5HEO.js +554 -0
  33. package/dist/chunk-BDPD5HEO.js.map +1 -0
  34. package/dist/{chunk-UETVDZBE.js → chunk-BINRCILF.js} +4 -1
  35. package/dist/{chunk-UETVDZBE.js.map → chunk-BINRCILF.js.map} +1 -1
  36. package/dist/{chunk-EQCSUC65.js → chunk-BTDTHXUI.js} +2 -2
  37. package/dist/chunk-FFGP2LGQ.js +465 -0
  38. package/dist/chunk-FFGP2LGQ.js.map +1 -0
  39. package/dist/{chunk-PRZCPSUE.js → chunk-I2H6KRCQ.js} +29 -14
  40. package/dist/chunk-I2H6KRCQ.js.map +1 -0
  41. package/dist/{chunk-ENRT6DAU.js → chunk-IDWN2OSG.js} +15 -2
  42. package/dist/chunk-IDWN2OSG.js.map +1 -0
  43. package/dist/{chunk-GAJOZJWD.js → chunk-MOGTMGGA.js} +5 -2
  44. package/dist/chunk-MOGTMGGA.js.map +1 -0
  45. package/dist/{chunk-5VLP3GQ2.js → chunk-MS4A7N77.js} +1 -1
  46. package/dist/chunk-MS4A7N77.js.map +1 -0
  47. package/dist/{chunk-YNK7DW5V.js → chunk-QVXMAHZC.js} +55 -551
  48. package/dist/chunk-QVXMAHZC.js.map +1 -0
  49. package/dist/{chunk-B4Z7KIIU.js → chunk-SJ4AW54X.js} +45 -4
  50. package/dist/chunk-SJ4AW54X.js.map +1 -0
  51. package/dist/{chunk-5AGNZXHJ.js → chunk-SRJBH5E5.js} +16 -679
  52. package/dist/chunk-SRJBH5E5.js.map +1 -0
  53. package/dist/{chunk-GQIATJEG.js → chunk-T2LDLVVV.js} +28 -3
  54. package/dist/chunk-T2LDLVVV.js.map +1 -0
  55. package/dist/{chunk-UKMOQWUC.js → chunk-TJPENLGQ.js} +3 -3
  56. package/dist/chunk-V5SSTT3C.js +52 -0
  57. package/dist/chunk-V5SSTT3C.js.map +1 -0
  58. package/dist/chunk-XG6SQUEP.js +27 -0
  59. package/dist/chunk-XG6SQUEP.js.map +1 -0
  60. package/dist/cli/index.js +6 -6
  61. package/dist/client/index.d.ts +20 -0
  62. package/dist/client/index.js.map +1 -1
  63. package/dist/{cloudflare-2WVDBHCC.js → cloudflare-GK4VD3EU.js} +71 -21
  64. package/dist/cloudflare-GK4VD3EU.js.map +1 -0
  65. package/dist/{route-config-B7FaTSby.d.ts → define-middleware-BOHpPOBs.d.ts} +39 -1
  66. package/dist/{deno-deploy-BXOQ45LD.js → deno-deploy-WMNXRVGL.js} +37 -36
  67. package/dist/deno-deploy-WMNXRVGL.js.map +1 -0
  68. package/dist/{dev-GLUZNBNH.js → dev-72ISY3BP.js} +7 -7
  69. package/dist/{index-BdIaxp0c.d.ts → index-DZ_G5iY2.d.ts} +76 -5
  70. package/dist/index.js +7 -6
  71. package/dist/index.js.map +1 -1
  72. package/dist/{internal-api-3JIWUI3V.js → internal-api-CEZSXGRB.js} +4 -4
  73. package/dist/{internal-api-OK7FS2ZF.js → internal-api-XRIBUACB.js} +8 -7
  74. package/dist/match-DaKsL73w.d.ts +28 -0
  75. package/dist/{mcp-IPDFRK4S.js → mcp-S2AOB3RE.js} +3 -3
  76. package/dist/{match-Dw4CNXJH.d.ts → module-loader-DCip7NoL.d.ts} +1 -28
  77. package/dist/{netlify-LPJAPMQ2.js → netlify-VOL54SC7.js} +23 -20
  78. package/dist/netlify-VOL54SC7.js.map +1 -0
  79. package/dist/{observability-bootstrap-H4NSILXD.js → observability-bootstrap-YQKMEYW7.js} +2 -2
  80. package/dist/{preview-5ONGHDKY.js → preview-WA4HORUQ.js} +3 -3
  81. package/dist/registry-DDBXDHJ2.js +23 -0
  82. package/dist/server/cost/index.d.ts +14 -1
  83. package/dist/server/cost/index.js +1 -1
  84. package/dist/server/define/index.d.ts +2 -28
  85. package/dist/server/define/index.js +2 -3
  86. package/dist/server/http/index.d.ts +4 -3
  87. package/dist/server/http/index.js +13 -8
  88. package/dist/server/index.d.ts +6 -4
  89. package/dist/server/index.js +15 -10
  90. package/dist/server/index.js.map +1 -1
  91. package/dist/server/scan/index.d.ts +3 -2
  92. package/dist/{server-boundary-6PYWFYEL.js → server-boundary-S3G4CSNK.js} +4 -4
  93. package/dist/{server-boundary-CNYNVFT5.js → server-boundary-YN5HAICY.js} +6 -6
  94. package/dist/{start-UYBVPTSV.js → start-ZTMQLNJI.js} +39 -15
  95. package/dist/start-ZTMQLNJI.js.map +1 -0
  96. package/dist/{static-SVDWIOXJ.js → static-7OJNB7D2.js} +4 -4
  97. package/dist/{vercel-YUZADKGV.js → vercel-LZTDSDJF.js} +42 -28
  98. package/dist/vercel-LZTDSDJF.js.map +1 -0
  99. package/dist/vite-plugin/index.js +7 -6
  100. package/dist/{vite-plugin-ILWLTOKK.js → vite-plugin-Z7AJG3M2.js} +7 -7
  101. package/package.json +4 -4
  102. package/dist/aws-lambda-R76PWR27.js.map +0 -1
  103. package/dist/build-UNBI6VKC.js.map +0 -1
  104. package/dist/bun-NPBIAWSU.js.map +0 -1
  105. package/dist/chunk-5AGNZXHJ.js.map +0 -1
  106. package/dist/chunk-5VLP3GQ2.js.map +0 -1
  107. package/dist/chunk-6B3CMPE4.js +0 -192
  108. package/dist/chunk-6B3CMPE4.js.map +0 -1
  109. package/dist/chunk-B4Z7KIIU.js.map +0 -1
  110. package/dist/chunk-D4VP2QPR.js +0 -16
  111. package/dist/chunk-D4VP2QPR.js.map +0 -1
  112. package/dist/chunk-ENRT6DAU.js.map +0 -1
  113. package/dist/chunk-GAJOZJWD.js.map +0 -1
  114. package/dist/chunk-GQIATJEG.js.map +0 -1
  115. package/dist/chunk-O55RLSGG.js +0 -127
  116. package/dist/chunk-O55RLSGG.js.map +0 -1
  117. package/dist/chunk-PRZCPSUE.js.map +0 -1
  118. package/dist/chunk-WAYUHS54.js.map +0 -1
  119. package/dist/chunk-YNK7DW5V.js.map +0 -1
  120. package/dist/cloudflare-2WVDBHCC.js.map +0 -1
  121. package/dist/deno-deploy-BXOQ45LD.js.map +0 -1
  122. package/dist/netlify-LPJAPMQ2.js.map +0 -1
  123. package/dist/registry-E5XEUKG6.js +0 -23
  124. package/dist/start-UYBVPTSV.js.map +0 -1
  125. package/dist/vercel-YUZADKGV.js.map +0 -1
  126. /package/dist/{actions-virtual-module-YIWQTI6Q.js.map → actions-virtual-module-DH3N34I6.js.map} +0 -0
  127. /package/dist/{actions-virtual-module-WCHXKH6R.js.map → actions-virtual-module-OMIFGXK6.js.map} +0 -0
  128. /package/dist/{agent-C7F5O5V4.js.map → agent-7RPGAKTY.js.map} +0 -0
  129. /package/dist/{app-typed-client-2ZEGNFJP.js.map → app-typed-client-C4LRUSIS.js.map} +0 -0
  130. /package/dist/{app-typed-client-CUM2GZ5Y.js.map → app-typed-client-R6OUJZEE.js.map} +0 -0
  131. /package/dist/{chunk-EQCSUC65.js.map → chunk-BTDTHXUI.js.map} +0 -0
  132. /package/dist/{chunk-UKMOQWUC.js.map → chunk-TJPENLGQ.js.map} +0 -0
  133. /package/dist/{dev-GLUZNBNH.js.map → dev-72ISY3BP.js.map} +0 -0
  134. /package/dist/{internal-api-3JIWUI3V.js.map → internal-api-CEZSXGRB.js.map} +0 -0
  135. /package/dist/{internal-api-OK7FS2ZF.js.map → internal-api-XRIBUACB.js.map} +0 -0
  136. /package/dist/{mcp-IPDFRK4S.js.map → mcp-S2AOB3RE.js.map} +0 -0
  137. /package/dist/{observability-bootstrap-H4NSILXD.js.map → observability-bootstrap-YQKMEYW7.js.map} +0 -0
  138. /package/dist/{preview-5ONGHDKY.js.map → preview-WA4HORUQ.js.map} +0 -0
  139. /package/dist/{registry-E5XEUKG6.js.map → registry-DDBXDHJ2.js.map} +0 -0
  140. /package/dist/{server-boundary-6PYWFYEL.js.map → server-boundary-S3G4CSNK.js.map} +0 -0
  141. /package/dist/{server-boundary-CNYNVFT5.js.map → server-boundary-YN5HAICY.js.map} +0 -0
  142. /package/dist/{static-SVDWIOXJ.js.map → static-7OJNB7D2.js.map} +0 -0
  143. /package/dist/{vite-plugin-ILWLTOKK.js.map → vite-plugin-Z7AJG3M2.js.map} +0 -0
@@ -7,32 +7,29 @@ import {
7
7
  } from "./chunk-SSYDEKWF.js";
8
8
  import {
9
9
  dispatchControllerRequest
10
- } from "./chunk-WAYUHS54.js";
10
+ } from "./chunk-425FJKKO.js";
11
+ import {
12
+ createAgentSubjectResolver,
13
+ isAgentCardPath,
14
+ matchAgentAuxRoute,
15
+ serveMatchedAuxRoute
16
+ } from "./chunk-BDPD5HEO.js";
11
17
  import {
12
- RUN_ID_HEADER,
13
- SSE_BASE_HEADERS,
14
- SSE_DONE_FRAME,
15
18
  admitAgentRequest,
16
19
  agentAccessDenied,
17
20
  cacheSchema,
18
21
  closePauseSpan,
19
22
  createObservabilityPluginFromConfig,
20
- encodeSse,
21
- formatSseFrame,
22
23
  getApprovalRegistry,
23
- getRunEventCache,
24
24
  loggingSchema,
25
- makeThreadStartRun,
26
- mintRunId,
27
25
  mountAgent,
28
26
  observabilitySchema,
29
- parseAgentRequestBody,
30
27
  rateLimitSchema,
31
28
  readAgentPolicy,
32
29
  securitySchema,
33
30
  storageSchema,
34
31
  uploadSchema
35
- } from "./chunk-GAJOZJWD.js";
32
+ } from "./chunk-MOGTMGGA.js";
36
33
  import {
37
34
  broadcastToDevtools
38
35
  } from "./chunk-OIGJOYX6.js";
@@ -52,21 +49,19 @@ import {
52
49
  import {
53
50
  BATCH_PATH,
54
51
  createCorsHandler,
55
- createServerContext,
56
- createWebRequestSource,
57
52
  executeAction,
58
53
  executeRoute,
59
- handleBatchRequest,
54
+ handleBatchRequest
55
+ } from "./chunk-SRJBH5E5.js";
56
+ import {
57
+ createWebRequestSource,
60
58
  incomingMessageToHandlerRequest,
61
59
  sendError,
62
60
  writeWebResponseToServerResponse
63
- } from "./chunk-5AGNZXHJ.js";
61
+ } from "./chunk-3T5XLDOH.js";
64
62
  import {
65
63
  validateCsrfRequest
66
64
  } from "./chunk-P6OS7652.js";
67
- import {
68
- subjectFromContext
69
- } from "./chunk-ENRT6DAU.js";
70
65
  import {
71
66
  findSuggestion
72
67
  } from "./chunk-NTDN54XO.js";
@@ -93,11 +88,6 @@ import {
93
88
  import {
94
89
  scanAgents
95
90
  } from "./chunk-KDP2HURW.js";
96
- import {
97
- extractAppResources,
98
- handleMcpJsonRpc,
99
- isMcpPath
100
- } from "./chunk-TQEE36VD.js";
101
91
  import {
102
92
  resolveProvider
103
93
  } from "./chunk-ICXXHV4V.js";
@@ -110,7 +100,7 @@ import {
110
100
 
111
101
  // src/vite-plugin/index.ts
112
102
  import { existsSync as existsSync8 } from "node:fs";
113
- import { resolve as resolve10, dirname as dirname4 } from "node:path";
103
+ import { resolve as resolve9, dirname as dirname4 } from "node:path";
114
104
  import { fileURLToPath } from "node:url";
115
105
 
116
106
  // src/vite-plugin/config-hook.ts
@@ -154,6 +144,18 @@ function runConfigHook(ctx) {
154
144
  }
155
145
  },
156
146
  resolve: {
147
+ // B-228 — one module instance per package, or two React contexts reach the client and the
148
+ // one `RouterProvider` filled is not the one `useLocation()` reads. The alias list below is
149
+ // what creates the condition: its catch-all maps any unlisted `theokit/*` subpath to
150
+ // WORKSPACE SOURCE, whose own bare `react-router` import then resolves against the
151
+ // workspace's node_modules while the app's entry resolves against its own. Measured
152
+ // 2026-09-20: 7.18.2 and 7.18.4 both reached one bundle, and React Router's ErrorBoundary
153
+ // replaced the whole tree with "Unexpected Application Error!".
154
+ //
155
+ // React and react-dom carry the same hazard by the same route — two React instances would
156
+ // produce this class of defect with a different symptom — so all four are named rather than
157
+ // the one that was caught.
158
+ dedupe: ["react-router", "react-router/dom", "react", "react-dom"],
157
159
  alias: [
158
160
  // Order still matters — first match wins — but the entries below are
159
161
  // EXACT (#377). A Vite alias whose `find` is a string matches by prefix,
@@ -773,7 +775,7 @@ async function resolvePluginConfig(projectRoot) {
773
775
  }
774
776
 
775
777
  // src/vite-plugin/configure-server-hook.ts
776
- import { resolve as resolve8, basename } from "node:path";
778
+ import { resolve as resolve7, basename } from "node:path";
777
779
 
778
780
  // src/devtools/server-side/route-manifest.ts
779
781
  function buildPath(parents, segment) {
@@ -1013,52 +1015,6 @@ function createActionMiddleware(vite, serverDir, options) {
1013
1015
  // src/vite-plugin/agent-middleware.ts
1014
1016
  import { randomUUID as randomUUID2 } from "node:crypto";
1015
1017
 
1016
- // src/server/agent/agent-card-handler.ts
1017
- import { buildAgentCard, compileLoadedAgentModule } from "@theokit/agents";
1018
- var WELL_KNOWN = /^\/\.well-known\/([^/]+)\/agent-card\.json$/;
1019
- function isAgentCardPath(urlPath) {
1020
- const match = WELL_KNOWN.exec(urlPath);
1021
- return match ? decodeURIComponent(match[1]) : null;
1022
- }
1023
- function toManifestEntry(name, route, mod) {
1024
- const compiled = compileLoadedAgentModule(mod, `agent card for "${name}"`);
1025
- return {
1026
- name,
1027
- route,
1028
- stream: compiled.stream,
1029
- mainLoop: { method: "", strategy: "" },
1030
- guards: [],
1031
- interceptors: [],
1032
- tools: compiled.tools.map((t) => ({
1033
- name: t.name,
1034
- description: t.description,
1035
- approval: false,
1036
- trace: false,
1037
- audit: false
1038
- })),
1039
- subAgents: []
1040
- };
1041
- }
1042
- function handleAgentCard(mod, name, route, baseUrl) {
1043
- try {
1044
- const card = buildAgentCard(toManifestEntry(name, route, mod), { baseUrl });
1045
- return new Response(JSON.stringify(card), {
1046
- status: 200,
1047
- headers: { "content-type": "application/json; charset=utf-8" }
1048
- });
1049
- } catch (err) {
1050
- return new Response(
1051
- JSON.stringify({
1052
- error: {
1053
- code: "AGENT_CARD_FAILED",
1054
- message: err instanceof Error ? err.message : "card build failed"
1055
- }
1056
- }),
1057
- { status: 500, headers: { "content-type": "application/json; charset=utf-8" } }
1058
- );
1059
- }
1060
- }
1061
-
1062
1018
  // src/server/agent/approve-agent.ts
1063
1019
  var APPROVE_SEGMENT = "/approve/";
1064
1020
  var APPROVE_PATH = /^\/api\/agents\/([^/]+)\/approve\/([^/]+)$/;
@@ -1148,445 +1104,6 @@ async function handleAgentApproval(request, urlPath, registry, csrfMode = "stric
1148
1104
  });
1149
1105
  }
1150
1106
 
1151
- // src/server/agent/handle-agent-run-reconnect.ts
1152
- var RUN_STREAM_PATH = /^\/api\/agents\/([^/]+)\/runs\/([^/]+)\/stream$/;
1153
- function isAgentRunStreamPath(urlPath) {
1154
- const m = RUN_STREAM_PATH.exec(urlPath);
1155
- return m ? { name: decodeURIComponent(m[1]), runId: decodeURIComponent(m[2]) } : null;
1156
- }
1157
- function parseLastEventId(raw) {
1158
- if (raw === null) return -1;
1159
- const n = Number.parseInt(raw, 10);
1160
- return Number.isInteger(n) && n >= 0 ? n : -1;
1161
- }
1162
- function handleAgentRunReconnect(runId, request, cache) {
1163
- if (!cache.has(runId)) {
1164
- return new Response(
1165
- JSON.stringify({ error: { code: "RUN_NOT_FOUND", message: `Unknown run '${runId}'.` } }),
1166
- {
1167
- status: 404,
1168
- headers: { "content-type": "application/json" }
1169
- }
1170
- );
1171
- }
1172
- const afterSeq = parseLastEventId(request.headers.get("last-event-id"));
1173
- const stream = new ReadableStream({
1174
- start(controller) {
1175
- let closed = false;
1176
- const safeEnqueue = (text) => {
1177
- if (closed) return;
1178
- try {
1179
- controller.enqueue(encodeSse(text));
1180
- } catch {
1181
- }
1182
- };
1183
- const close = () => {
1184
- if (closed) return;
1185
- safeEnqueue(SSE_DONE_FRAME);
1186
- closed = true;
1187
- try {
1188
- controller.close();
1189
- } catch {
1190
- }
1191
- };
1192
- const res = cache.attach(
1193
- runId,
1194
- afterSeq,
1195
- (frame) => {
1196
- safeEnqueue(formatSseFrame(frame.seq, frame.data));
1197
- },
1198
- () => {
1199
- close();
1200
- }
1201
- );
1202
- if (!res.known) {
1203
- close();
1204
- return;
1205
- }
1206
- for (const frame of res.replay) {
1207
- safeEnqueue(formatSseFrame(frame.seq, frame.data));
1208
- }
1209
- if (res.ended) {
1210
- close();
1211
- return;
1212
- }
1213
- request.signal.addEventListener("abort", () => {
1214
- res.unsubscribe();
1215
- close();
1216
- });
1217
- }
1218
- });
1219
- return new Response(stream, { headers: { ...SSE_BASE_HEADERS, [RUN_ID_HEADER]: runId } });
1220
- }
1221
-
1222
- // src/server/agent/thread-dispatcher.ts
1223
- function postThreadFollowUp(deps, sessionId, message) {
1224
- if (deps.registry.getActive(sessionId) !== null) {
1225
- deps.registry.queue(sessionId, { message });
1226
- return { queued: true };
1227
- }
1228
- return { runId: startAndPump(deps, sessionId, message) };
1229
- }
1230
- function startAndPump(deps, sessionId, message) {
1231
- const runId = mintRunId();
1232
- deps.cache.begin(runId);
1233
- deps.registry.startRun(sessionId, runId);
1234
- pumpIntoCache(deps, sessionId, runId, deps.startRun(sessionId, message));
1235
- return runId;
1236
- }
1237
- function pumpIntoCache(deps, sessionId, runId, chunks) {
1238
- void (async () => {
1239
- try {
1240
- for await (const chunk of chunks) {
1241
- deps.cache.append(runId, JSON.stringify(chunk));
1242
- }
1243
- } catch {
1244
- } finally {
1245
- deps.cache.end(runId);
1246
- const next = deps.registry.endRun(sessionId, runId);
1247
- if (next !== void 0) startAndPump(deps, sessionId, next.message);
1248
- }
1249
- })();
1250
- }
1251
-
1252
- // src/server/agent/thread-run-registry.ts
1253
- function createInProcessThreadRunRegistry() {
1254
- const threads = /* @__PURE__ */ new Map();
1255
- const ensure = (sessionId) => {
1256
- let s = threads.get(sessionId);
1257
- if (s === void 0) {
1258
- s = { activeRunId: null, queue: [], waiters: /* @__PURE__ */ new Set() };
1259
- threads.set(sessionId, s);
1260
- }
1261
- return s;
1262
- };
1263
- return {
1264
- getActive(sessionId) {
1265
- return threads.get(sessionId)?.activeRunId ?? null;
1266
- },
1267
- startRun(sessionId, runId) {
1268
- const s = ensure(sessionId);
1269
- s.activeRunId = runId;
1270
- const waiters = [...s.waiters];
1271
- s.waiters.clear();
1272
- for (const cb of waiters) cb(runId);
1273
- },
1274
- endRun(sessionId, runId) {
1275
- const s = threads.get(sessionId);
1276
- if (s?.activeRunId !== runId) return void 0;
1277
- s.activeRunId = null;
1278
- return s.queue.shift();
1279
- },
1280
- queue(sessionId, followUp) {
1281
- ensure(sessionId).queue.push(followUp);
1282
- },
1283
- onNextRun(sessionId, cb) {
1284
- const s = ensure(sessionId);
1285
- s.waiters.add(cb);
1286
- return () => {
1287
- s.waiters.delete(cb);
1288
- };
1289
- }
1290
- };
1291
- }
1292
- var serverRegistry;
1293
- function getThreadRunRegistry() {
1294
- serverRegistry ??= createInProcessThreadRunRegistry();
1295
- return serverRegistry;
1296
- }
1297
-
1298
- // src/server/agent/handle-thread-routes.ts
1299
- var THREAD_MESSAGE_PATH = /^\/api\/agents\/([^/]+)\/threads\/([^/]+)\/message$/;
1300
- var THREAD_STREAM_PATH = /^\/api\/agents\/([^/]+)\/threads\/([^/]+)\/stream$/;
1301
- var DEFAULT_IDLE_WAIT_MS = 3e4;
1302
- function matchThread(re, urlPath) {
1303
- const m = re.exec(urlPath);
1304
- return m ? { name: decodeURIComponent(m[1]), sessionId: decodeURIComponent(m[2]) } : null;
1305
- }
1306
- var isThreadMessagePath = (urlPath) => matchThread(THREAD_MESSAGE_PATH, urlPath);
1307
- var isThreadStreamPath = (urlPath) => matchThread(THREAD_STREAM_PATH, urlPath);
1308
- function jsonError2(status, code, message) {
1309
- return new Response(JSON.stringify({ error: { code, message } }), {
1310
- status,
1311
- headers: { "content-type": "application/json; charset=utf-8" }
1312
- });
1313
- }
1314
- async function handleThreadMessage(args) {
1315
- const { mod, apiKey, sessionId, request, source, agentName, csrfMode = "strict" } = args;
1316
- if (csrfMode === "strict") {
1317
- const csrf = validateCsrfRequest(request);
1318
- if (!csrf.valid) return jsonError2(403, "CSRF_FAILED", `CSRF check failed: ${csrf.reason}`);
1319
- }
1320
- let body = null;
1321
- try {
1322
- body = await request.json();
1323
- } catch {
1324
- }
1325
- const input = parseAgentRequestBody(body);
1326
- if (input === null) {
1327
- return jsonError2(400, "BAD_REQUEST", "Request must contain a non-empty message.");
1328
- }
1329
- const result = postThreadFollowUp(
1330
- {
1331
- registry: getThreadRunRegistry(),
1332
- cache: getRunEventCache(),
1333
- // usetheokit/theokit#381 — the request goes with it, so the run's spans join the trace of
1334
- // the caller that queued it instead of opening one of their own.
1335
- startRun: makeThreadStartRun(mod, apiKey, source, agentName, request)
1336
- },
1337
- sessionId,
1338
- input.message
1339
- );
1340
- const headers = { "content-type": "application/json; charset=utf-8" };
1341
- if ("runId" in result) headers[RUN_ID_HEADER] = result.runId;
1342
- return new Response(JSON.stringify(result), { status: 202, headers });
1343
- }
1344
- function handleThreadStream(sessionId, request, registry = getThreadRunRegistry(), cache = getRunEventCache(), idleWaitMs = DEFAULT_IDLE_WAIT_MS) {
1345
- const active = registry.getActive(sessionId);
1346
- if (active !== null && cache.has(active)) {
1347
- return handleAgentRunReconnect(active, request, cache);
1348
- }
1349
- return waitThenAttachStream(sessionId, request, registry, cache, idleWaitMs);
1350
- }
1351
- function waitThenAttachStream(sessionId, request, registry, cache, idleWaitMs) {
1352
- const stream = new ReadableStream({
1353
- start(controller) {
1354
- let closed = false;
1355
- const send = (text) => {
1356
- if (closed) return;
1357
- try {
1358
- controller.enqueue(encodeSse(text));
1359
- } catch {
1360
- }
1361
- };
1362
- let detachAttach;
1363
- const close = () => {
1364
- if (closed) return;
1365
- send(SSE_DONE_FRAME);
1366
- closed = true;
1367
- try {
1368
- controller.close();
1369
- } catch {
1370
- }
1371
- };
1372
- const offNext = registry.onNextRun(sessionId, (runId) => {
1373
- const res = cache.attach(
1374
- runId,
1375
- -1,
1376
- (frame) => {
1377
- send(formatSseFrame(frame.seq, frame.data));
1378
- },
1379
- () => {
1380
- close();
1381
- }
1382
- );
1383
- if (!res.known) {
1384
- close();
1385
- return;
1386
- }
1387
- for (const frame of res.replay) send(formatSseFrame(frame.seq, frame.data));
1388
- if (res.ended) {
1389
- close();
1390
- return;
1391
- }
1392
- detachAttach = res.unsubscribe;
1393
- });
1394
- const teardownWaiter = () => {
1395
- offNext();
1396
- detachAttach?.();
1397
- };
1398
- const timer = setTimeout(() => {
1399
- teardownWaiter();
1400
- close();
1401
- }, idleWaitMs);
1402
- timer.unref();
1403
- request.signal.addEventListener("abort", () => {
1404
- teardownWaiter();
1405
- clearTimeout(timer);
1406
- close();
1407
- });
1408
- }
1409
- });
1410
- return new Response(stream, { headers: { ...SSE_BASE_HEADERS } });
1411
- }
1412
-
1413
- // src/server/agent/list-approvals-handler.ts
1414
- var LIST_PATH = /^\/api\/agents\/([^/]+)\/approvals$/;
1415
- function isListApprovalsPath(urlPath) {
1416
- const match = LIST_PATH.exec(urlPath);
1417
- return match ? decodeURIComponent(match[1]) : null;
1418
- }
1419
- function handleListApprovals(registry, subject) {
1420
- const visible = registry.list().filter((approval) => {
1421
- const owner = registry.ownerOf(approval.approvalId);
1422
- return owner === void 0 || owner === subject;
1423
- });
1424
- return new Response(JSON.stringify({ approvals: visible }), {
1425
- status: 200,
1426
- headers: { "content-type": "application/json; charset=utf-8" }
1427
- });
1428
- }
1429
-
1430
- // src/server/agent/serve-aux-routes.ts
1431
- function jsonError3(status, code, message) {
1432
- return new Response(JSON.stringify({ error: { code, message } }), {
1433
- status,
1434
- headers: { "content-type": "application/json; charset=utf-8" }
1435
- });
1436
- }
1437
- function routeFor(deps, name, build) {
1438
- if (name === null) return null;
1439
- const agent = deps.agents.find((a) => a.name === name);
1440
- return agent === void 0 ? null : build(agent);
1441
- }
1442
- function matchGetAuxRoute(verb, urlPath, deps) {
1443
- if (verb !== "GET") return null;
1444
- const card = routeFor(
1445
- deps,
1446
- isAgentCardPath(urlPath),
1447
- (agent) => ({ kind: "card", agent })
1448
- );
1449
- if (card !== null) return card;
1450
- const approvals = routeFor(
1451
- deps,
1452
- isListApprovalsPath(urlPath),
1453
- (agent) => ({ kind: "approvals", agent })
1454
- );
1455
- if (approvals !== null) return approvals;
1456
- const run = isAgentRunStreamPath(urlPath);
1457
- if (run !== null) {
1458
- return routeFor(
1459
- deps,
1460
- run.name,
1461
- (agent) => ({ kind: "run-stream", agent, runId: run.runId })
1462
- );
1463
- }
1464
- const stream = isThreadStreamPath(urlPath);
1465
- if (stream === null) return null;
1466
- return routeFor(
1467
- deps,
1468
- stream.name,
1469
- (agent) => ({ kind: "thread-stream", agent, sessionId: stream.sessionId })
1470
- );
1471
- }
1472
- async function matchPostAuxRoute(verb, urlPath, deps) {
1473
- if (verb !== "POST") return null;
1474
- const msg = isThreadMessagePath(urlPath);
1475
- if (msg !== null) {
1476
- return routeFor(
1477
- deps,
1478
- msg.name,
1479
- (agent2) => ({ kind: "thread-message", agent: agent2, sessionId: msg.sessionId })
1480
- );
1481
- }
1482
- const agent = routeFor(deps, isMcpPath(urlPath), (found) => found);
1483
- if (agent === null) return null;
1484
- const mod = await deps.loadModule(agent.filePath);
1485
- return isMcpExposed(mod) ? { kind: "mcp", agent, mod } : null;
1486
- }
1487
- async function matchAgentAuxRoute(method, urlPath, deps) {
1488
- const verb = method.toUpperCase();
1489
- return matchGetAuxRoute(verb, urlPath, deps) ?? await matchPostAuxRoute(verb, urlPath, deps);
1490
- }
1491
- async function admitAux(deps, agent, params, body) {
1492
- const mod = await deps.loadModule(agent.filePath);
1493
- const resolve11 = deps.resolveSubject;
1494
- const admitted = { subject: null };
1495
- const recording = resolve11 === void 0 ? void 0 : async () => {
1496
- admitted.subject = await resolve11();
1497
- return admitted.subject;
1498
- };
1499
- const decision = await admitAgentRequest(
1500
- readAgentPolicy(mod, agent.filePath),
1501
- recording,
1502
- params,
1503
- body
1504
- );
1505
- const refusal = decision.allowed ? null : agentAccessDenied(decision, params);
1506
- return { refusal, subject: admitted.subject?.id };
1507
- }
1508
- async function serveMatchedAuxRoute(route, request, deps) {
1509
- if (route.kind === "card") {
1510
- const mod = await deps.loadModule(route.agent.filePath);
1511
- return handleAgentCard(mod, route.agent.name, route.agent.agentPath, deps.baseUrl);
1512
- }
1513
- if (route.kind === "approvals") {
1514
- const admission = await admitAux(deps, route.agent, {
1515
- agent: route.agent.name,
1516
- endpoint: "approvals"
1517
- });
1518
- if (admission.refusal !== null) return admission.refusal;
1519
- return handleListApprovals(getApprovalRegistry(), admission.subject);
1520
- }
1521
- if (route.kind === "run-stream") {
1522
- return handleAgentRunReconnect(route.runId, request, getRunEventCache());
1523
- }
1524
- if (route.kind === "mcp") return serveMcpRoute(route, request, deps);
1525
- return serveThreadRoute(route, request, deps);
1526
- }
1527
- async function serveThreadRoute(route, request, deps) {
1528
- const { agent, sessionId } = route;
1529
- if (route.kind === "thread-stream") {
1530
- const { refusal: refusal2 } = await admitAux(deps, agent, {
1531
- agent: agent.name,
1532
- endpoint: "thread-stream",
1533
- sessionId
1534
- });
1535
- return refusal2 ?? handleThreadStream(sessionId, request);
1536
- }
1537
- const { refusal } = await admitAux(deps, agent, {
1538
- agent: agent.name,
1539
- endpoint: "thread-message",
1540
- sessionId
1541
- });
1542
- if (refusal !== null) return refusal;
1543
- if (deps.resolveApiKey === void 0) {
1544
- return jsonError3(
1545
- 501,
1546
- "NOT_CONFIGURED",
1547
- "Thread follow-up requires a provider API key (resolveApiKey was not provided to serveMatchedAuxRoute)."
1548
- );
1549
- }
1550
- const mod = await deps.loadModule(agent.filePath);
1551
- return handleThreadMessage({
1552
- mod,
1553
- // Passed unresolved: `makeThreadStartRun` calls it once the module is compiled and the
1554
- // model is known (theokit#328).
1555
- apiKey: deps.resolveApiKey,
1556
- sessionId,
1557
- request,
1558
- source: `agent "${agent.name}"`,
1559
- // usetheokit/theokit#406 — the label above reads well in an `AgentDefinitionError` and is not
1560
- // a name; the spans get the name, so the same agent is one series whichever route started it.
1561
- agentName: agent.name,
1562
- csrfMode: deps.csrfMode ?? "strict"
1563
- });
1564
- }
1565
- async function serveMcpRoute(route, request, deps) {
1566
- const { agent, mod } = route;
1567
- const mcpParams = { agent: agent.name, endpoint: "mcp" };
1568
- const mcpDecision = await admitAgentRequest(
1569
- readAgentPolicy(mod, agent.filePath),
1570
- deps.resolveSubject,
1571
- mcpParams
1572
- );
1573
- if (!mcpDecision.allowed) return agentAccessDenied(mcpDecision, mcpParams);
1574
- const csrfMode = deps.csrfMode ?? "strict";
1575
- if (csrfMode === "strict") {
1576
- const csrf = validateCsrfRequest(request);
1577
- if (!csrf.valid) return jsonError3(403, "CSRF_FAILED", `CSRF check failed: ${csrf.reason}`);
1578
- }
1579
- let body = null;
1580
- try {
1581
- body = await request.json();
1582
- } catch {
1583
- }
1584
- return handleMcpJsonRpc(mod, agent.name, body, extractAppResources(mod));
1585
- }
1586
- function isMcpExposed(mod) {
1587
- return mod?.mcp === true;
1588
- }
1589
-
1590
1107
  // src/server/http/plugin-lifecycle.ts
1591
1108
  function messageOf2(err, fallback) {
1592
1109
  return err instanceof Error ? err.message : fallback;
@@ -1615,22 +1132,6 @@ async function serveThroughPluginLifecycle(target, serve) {
1615
1132
  if (pluginRunner) await pluginRunner.runOnResponse(pluginCtx);
1616
1133
  }
1617
1134
 
1618
- // src/server/http/resolve-agent-subject.ts
1619
- function createAgentSubjectResolver(sources) {
1620
- let pending;
1621
- return () => {
1622
- pending ??= resolve5(sources);
1623
- return pending;
1624
- };
1625
- }
1626
- async function resolve5(sources) {
1627
- const { req, res, loadModule, serverDir, pluginRunner } = sources;
1628
- const produced = serverDir === void 0 ? {} : await createServerContext(req, res, loadModule, serverDir);
1629
- const ctx = produced ?? {};
1630
- pluginRunner?.applyDecorations(ctx);
1631
- return subjectFromContext(ctx);
1632
- }
1633
-
1634
1135
  // src/vite-plugin/agent-middleware.ts
1635
1136
  var PREFIX2 = "/api/agents/";
1636
1137
  async function serveApprove(req, res, urlPath, deps, log) {
@@ -1855,7 +1356,7 @@ async function serveAgentTurn(t) {
1855
1356
  }
1856
1357
 
1857
1358
  // src/vite-plugin/api-middleware.ts
1858
- import { resolve as resolve6 } from "node:path";
1359
+ import { resolve as resolve5 } from "node:path";
1859
1360
  function shouldBypassApiMiddleware(url, prefixes) {
1860
1361
  if (!url.startsWith("/api/")) return true;
1861
1362
  if (prefixes.length === 0) return false;
@@ -1903,10 +1404,10 @@ async function handleBatchIfMatch(req, res, ctx) {
1903
1404
  async function handleBatchInline(req, res, batching, requestId) {
1904
1405
  try {
1905
1406
  const chunks = [];
1906
- await new Promise((resolve11, reject) => {
1407
+ await new Promise((resolve10, reject) => {
1907
1408
  req.on("data", (c) => chunks.push(c));
1908
1409
  req.on("end", () => {
1909
- resolve11();
1410
+ resolve10();
1910
1411
  });
1911
1412
  req.on("error", reject);
1912
1413
  });
@@ -1962,7 +1463,7 @@ async function runPluginsBeforeRouteMatch(pluginRunner, reqCtx) {
1962
1463
  }
1963
1464
  async function tryControllerFallthrough(ctx) {
1964
1465
  const handled = await dispatchControllerRequest({
1965
- controllersDir: resolve6(ctx.serverDir, "controllers"),
1466
+ controllersDir: resolve5(ctx.serverDir, "controllers"),
1966
1467
  loadModule: ctx.loadModule,
1967
1468
  req: ctx.req,
1968
1469
  res: ctx.res,
@@ -2108,7 +1609,7 @@ function createApiMiddleware(vite, serverDir, rateLimitConfigOrOptions) {
2108
1609
 
2109
1610
  // src/vite-plugin/ssr-dev-middleware.ts
2110
1611
  import { readFileSync as readFileSync2 } from "node:fs";
2111
- import { resolve as resolve7 } from "node:path";
1612
+ import { resolve as resolve6 } from "node:path";
2112
1613
 
2113
1614
  // src/core/contracts/find-root-div.ts
2114
1615
  function maskHtmlComments(html) {
@@ -2199,7 +1700,7 @@ function setupSsrDevMiddleware(server, opts) {
2199
1700
  return;
2200
1701
  }
2201
1702
  try {
2202
- const indexPath = resolve7(opts.projectRoot, "index.html");
1703
+ const indexPath = resolve6(opts.projectRoot, "index.html");
2203
1704
  let template = readFileSync2(indexPath, "utf-8");
2204
1705
  const nonce = generateNonce();
2205
1706
  template = await server.transformIndexHtml(url, template);
@@ -2342,7 +1843,7 @@ async function runConfigureServer(server, ctx) {
2342
1843
  csrfReadinessStore
2343
1844
  })
2344
1845
  );
2345
- const configPath = resolve8(ctx.projectRoot, "theo.config.ts");
1846
+ const configPath = resolve7(ctx.projectRoot, "theo.config.ts");
2346
1847
  server.watcher.on("change", (file) => {
2347
1848
  if (file === configPath) {
2348
1849
  console.warn(
@@ -2372,7 +1873,7 @@ async function runConfigureServer(server, ctx) {
2372
1873
  const openApiCfg = ctx.resolvedOpenApi;
2373
1874
  const { reEmitOpenApi } = await import("./dev-emit-7RT624PM.js");
2374
1875
  const openApiServerDir = ctx.serverDir;
2375
- const openApiDistDir = resolve8(ctx.projectRoot, ctx.resolvedDistDir);
1876
+ const openApiDistDir = resolve7(ctx.projectRoot, ctx.resolvedDistDir);
2376
1877
  const isRouteFileForOpenApi = (file) => file.startsWith(openApiServerDir) && /\.(ts|tsx|js|mjs)$/.test(file);
2377
1878
  void reEmitOpenApi(openApiServerDir, openApiDistDir, openApiCfg);
2378
1879
  server.watcher.on("change", (file) => {
@@ -2679,7 +2180,7 @@ async function integrateUseTheoUI(cwd, opts) {
2679
2180
 
2680
2181
  // src/vite-plugin/transform-html-hook.ts
2681
2182
  import { existsSync as existsSync7 } from "node:fs";
2682
- import { resolve as resolve9 } from "node:path";
2183
+ import { resolve as resolve8 } from "node:path";
2683
2184
 
2684
2185
  // src/vite-plugin/inject-devtools.ts
2685
2186
  var DEVTOOLS_VIRTUAL_ID = "/@theo/devtools/entry.js";
@@ -2779,7 +2280,7 @@ function runTransformIndexHtml(html, ctx) {
2779
2280
  next = devtools.html;
2780
2281
  const styles = injectStylesheets(next, {
2781
2282
  isDev: ctx.isDevMode.value,
2782
- hasPackage: (name) => existsSync7(resolve9(ctx.projectRoot, "node_modules", ...name.split("/")))
2283
+ hasPackage: (name) => existsSync7(resolve8(ctx.projectRoot, "node_modules", ...name.split("/")))
2783
2284
  });
2784
2285
  next = styles.html;
2785
2286
  return next;
@@ -3490,7 +2991,7 @@ function findConsumerConfig(projectRoot, basename2) {
3490
2991
  let dir = projectRoot;
3491
2992
  for (let level = 0; level < 3; level++) {
3492
2993
  for (const ext of extensions) {
3493
- const candidate = resolve10(dir, `${basename2}${ext}`);
2994
+ const candidate = resolve9(dir, `${basename2}${ext}`);
3494
2995
  if (existsSync8(candidate)) return candidate;
3495
2996
  }
3496
2997
  const parent = dirname4(dir);
@@ -3502,7 +3003,7 @@ function findConsumerConfig(projectRoot, basename2) {
3502
3003
  async function theoPluginAsync(rootOrOptions) {
3503
3004
  const options = typeof rootOrOptions === "string" ? { root: rootOrOptions } : rootOrOptions ?? {};
3504
3005
  const projectRoot = options.root ?? process.cwd();
3505
- const serverDirAbs = resolve10(projectRoot, options.serverDir ?? "server");
3006
+ const serverDirAbs = resolve9(projectRoot, options.serverDir ?? "server");
3506
3007
  const agentsDirName = options.agentsDir ?? "agents";
3507
3008
  const consumerTailwindConfig = findConsumerConfig(projectRoot, "tailwind.config");
3508
3009
  const consumerPostcssConfig = findConsumerConfig(projectRoot, "postcss.config");
@@ -3521,23 +3022,25 @@ async function theoPluginAsync(rootOrOptions) {
3521
3022
  })
3522
3023
  );
3523
3024
  }
3524
- const { appTypedClientPlugin } = await import("./app-typed-client-2ZEGNFJP.js");
3025
+ const { assetsMapPlugin } = await import("./assets-map-CV2YZ3MY.js");
3026
+ const assetsMap = assetsMapPlugin({ appDir: resolve9(projectRoot, options.appDir ?? "app") });
3027
+ const { appTypedClientPlugin } = await import("./app-typed-client-C4LRUSIS.js");
3525
3028
  const appClientPlugin = appTypedClientPlugin({
3526
3029
  cwd: projectRoot,
3527
3030
  serverDir: serverDirAbs,
3528
- distDir: resolve10(projectRoot, ".theokit")
3031
+ distDir: resolve9(projectRoot, ".theokit")
3529
3032
  });
3530
- const { actionsVirtualModule } = await import("./actions-virtual-module-YIWQTI6Q.js");
3033
+ const { actionsVirtualModule } = await import("./actions-virtual-module-DH3N34I6.js");
3531
3034
  const actionsPlugin = actionsVirtualModule({
3532
3035
  serverDir: serverDirAbs,
3533
- distDir: resolve10(projectRoot, ".theokit")
3036
+ distDir: resolve9(projectRoot, ".theokit")
3534
3037
  });
3535
3038
  const { agentsTypedClientPlugin } = await import("./agents-typed-client-PVUZU65B.js");
3536
- const { generateManifest } = await import("./internal-api-OK7FS2ZF.js");
3039
+ const { generateManifest } = await import("./internal-api-XRIBUACB.js");
3537
3040
  const agentsClientPlugin = agentsTypedClientPlugin({
3538
3041
  projectRoot,
3539
3042
  agentsDir: agentsDirName,
3540
- distDir: resolve10(projectRoot, ".theokit"),
3043
+ distDir: resolve9(projectRoot, ".theokit"),
3541
3044
  // Agents live at <projectRoot>/<agentsDir>; generateManifest scans them via the server dir's
3542
3045
  // parent (projectRoot for the canonical layout) + the agents dir name (#95 follow-up).
3543
3046
  scanManifest: () => generateManifest(serverDirAbs, projectRoot, agentsDirName)
@@ -3550,7 +3053,7 @@ async function theoPluginAsync(rootOrOptions) {
3550
3053
  const controllerTransformPlugin = controllerSwcTransformPlugin({
3551
3054
  serverDir: serverDirAbs
3552
3055
  });
3553
- const { serverOnlyImportBoundary } = await import("./server-boundary-CNYNVFT5.js");
3056
+ const { serverOnlyImportBoundary } = await import("./server-boundary-YN5HAICY.js");
3554
3057
  const serverBoundaryPlugin = serverOnlyImportBoundary({
3555
3058
  projectRoot,
3556
3059
  serverDir: serverDirAbs
@@ -3566,15 +3069,16 @@ async function theoPluginAsync(rootOrOptions) {
3566
3069
  appClientPlugin,
3567
3070
  actionsPlugin,
3568
3071
  agentsClientPlugin,
3569
- routesHmrPlugin
3072
+ routesHmrPlugin,
3073
+ assetsMap
3570
3074
  ];
3571
3075
  }
3572
3076
  function buildOptimizeDepsInclude(projectRoot, viteOptimizeDeps) {
3573
3077
  const include = [];
3574
- if (existsSync8(resolve10(projectRoot, "node_modules", "@theokit", "ui"))) {
3078
+ if (existsSync8(resolve9(projectRoot, "node_modules", "@theokit", "ui"))) {
3575
3079
  include.push("@theokit/ui");
3576
3080
  }
3577
- if (existsSync8(resolve10(projectRoot, "node_modules", "lucide-react"))) {
3081
+ if (existsSync8(resolve9(projectRoot, "node_modules", "lucide-react"))) {
3578
3082
  include.push("lucide-react");
3579
3083
  }
3580
3084
  include.push("devalue");
@@ -3600,8 +3104,8 @@ var VIRTUAL_MODULE_IDS = {
3600
3104
  function theoPlugin(rootOrOptions) {
3601
3105
  const options = typeof rootOrOptions === "string" ? { root: rootOrOptions } : rootOrOptions ?? {};
3602
3106
  const projectRoot = options.root ?? process.cwd();
3603
- const appDir = resolve10(projectRoot, options.appDir ?? "app");
3604
- const serverDir = resolve10(projectRoot, options.serverDir ?? "server");
3107
+ const appDir = resolve9(projectRoot, options.appDir ?? "app");
3108
+ const serverDir = resolve9(projectRoot, options.serverDir ?? "server");
3605
3109
  const agentsDir = options.agentsDir ?? "agents";
3606
3110
  const ssrEnabled = options.ssr ?? false;
3607
3111
  const currentDir = dirname4(fileURLToPath(import.meta.url));
@@ -3733,4 +3237,4 @@ export {
3733
3237
  theoPluginAsync,
3734
3238
  theoPlugin
3735
3239
  };
3736
- //# sourceMappingURL=chunk-YNK7DW5V.js.map
3240
+ //# sourceMappingURL=chunk-QVXMAHZC.js.map