theokit 0.74.5 → 0.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actions-virtual-module-MIQJEHKJ.js → actions-virtual-module-MIQPBAZW.js} +5 -5
- package/dist/{actions-virtual-module-4J7Z37Y4.js → actions-virtual-module-QEI6QPK4.js} +5 -5
- package/dist/adapters/agent-mount.js +1 -1
- package/dist/{agent-XPZUWTHR.js → agent-IIF6JUWX.js} +3 -3
- package/dist/{app-typed-client-AZMUYIYV.js → app-typed-client-CHSITA46.js} +5 -5
- package/dist/{app-typed-client-DSS23KDC.js → app-typed-client-XQJXF646.js} +5 -5
- package/dist/{build-F3O5LJHY.js → build-QIO4VAW2.js} +22 -87
- package/dist/build-QIO4VAW2.js.map +1 -0
- package/dist/{chunk-PZLH4WGU.js → chunk-2BMJQMTH.js} +5 -5
- package/dist/{chunk-44E7XIZC.js → chunk-3MKRDJQ2.js} +2 -2
- package/dist/{chunk-4ERYQBL6.js → chunk-4Z5XO4O4.js} +2 -2
- package/dist/{chunk-FPC6ZEEU.js → chunk-6RVWPEKK.js} +10 -10
- package/dist/{chunk-V7ISZGNS.js → chunk-7HGZ3CKL.js} +2 -2
- package/dist/{chunk-6R5F5YF2.js → chunk-A6UFN6QQ.js} +16 -11
- package/dist/{chunk-6R5F5YF2.js.map → chunk-A6UFN6QQ.js.map} +1 -1
- package/dist/{chunk-5KRMDP46.js → chunk-AHYOVVJ7.js} +13 -3
- package/dist/chunk-AHYOVVJ7.js.map +1 -0
- package/dist/{chunk-WR5B2XNT.js → chunk-FNAEKJHO.js} +2 -2
- package/dist/{chunk-HKF6YNY4.js → chunk-FU3LEX2I.js} +26 -12
- package/dist/chunk-FU3LEX2I.js.map +1 -0
- package/dist/{chunk-VD3BCME6.js → chunk-I5PDEWZZ.js} +2 -2
- package/dist/chunk-IWIRHUNV.js +96 -0
- package/dist/chunk-IWIRHUNV.js.map +1 -0
- package/dist/{chunk-U5PWXS3J.js → chunk-O5JZ6ROY.js} +13 -3
- package/dist/chunk-O5JZ6ROY.js.map +1 -0
- package/dist/{chunk-VOXLI66L.js → chunk-OZB2TKGJ.js} +2 -2
- package/dist/{chunk-ET2TAY3Z.js → chunk-RAUYMVUO.js} +279 -15
- package/dist/chunk-RAUYMVUO.js.map +1 -0
- package/dist/{chunk-XUAWD5HK.js → chunk-RKRFJRJ3.js} +10 -10
- package/dist/{chunk-DA3GGICE.js → chunk-RQKMY3JW.js} +2 -2
- package/dist/{chunk-D5KBBTVD.js → chunk-RY6D4EXL.js} +20 -13
- package/dist/chunk-RY6D4EXL.js.map +1 -0
- package/dist/cli/index.js +10 -10
- package/dist/{dev-TW6QD7F3.js → dev-J2XZIENF.js} +8 -8
- package/dist/{dev-emit-T3X6RR7M.js → dev-emit-AXTJK56H.js} +3 -3
- package/dist/{dev-emit-ZK5GCHXN.js → dev-emit-XAPVJBM4.js} +3 -3
- package/dist/{generate-EN6EDITF.js → generate-RW3NO3NR.js} +239 -141
- package/dist/generate-RW3NO3NR.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/{info-XURFOBRF.js → info-6NAUW5XY.js} +3 -3
- package/dist/{internal-api-XPT4GLYX.js → internal-api-A5HA7TYF.js} +5 -5
- package/dist/{internal-api-ATSPOXI2.js → internal-api-R7TTYMCY.js} +5 -5
- package/dist/{load-config-2DXLI7NW.js → load-config-CLFWJOXN.js} +3 -3
- package/dist/{mcp-LMV3NQEP.js → mcp-MWTG3LRA.js} +4 -4
- package/dist/{openapi-UJSUQPNT.js → openapi-RVFUXXCR.js} +5 -5
- package/dist/{preview-AMNBV2DP.js → preview-ML4CFUD6.js} +3 -3
- package/dist/{routes-ENMU4GAN.js → routes-SMNSI2ZX.js} +3 -3
- package/dist/server/agent/index.d.ts +99 -6
- package/dist/server/agent/index.js +9 -1
- package/dist/server/cron/index.js +2 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +15 -7
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.js +2 -2
- package/dist/server/scan/index.js +4 -4
- package/dist/{server-boundary-K4YQXDQT.js → server-boundary-HYLYGFZY.js} +5 -5
- package/dist/{server-boundary-JM72DQLA.js → server-boundary-ZT6HN7ON.js} +5 -5
- package/dist/{start-GAULIE5E.js → start-L5TGWGLU.js} +7 -7
- package/dist/vite-plugin/index.js +5 -5
- package/dist/{vite-plugin-4ZMBW3KV.js → vite-plugin-OJND2LU5.js} +8 -8
- package/package.json +2 -2
- package/dist/build-F3O5LJHY.js.map +0 -1
- package/dist/chunk-5KRMDP46.js.map +0 -1
- package/dist/chunk-D5KBBTVD.js.map +0 -1
- package/dist/chunk-ET2TAY3Z.js.map +0 -1
- package/dist/chunk-HKF6YNY4.js.map +0 -1
- package/dist/chunk-U5PWXS3J.js.map +0 -1
- package/dist/generate-EN6EDITF.js.map +0 -1
- /package/dist/{actions-virtual-module-MIQJEHKJ.js.map → actions-virtual-module-MIQPBAZW.js.map} +0 -0
- /package/dist/{actions-virtual-module-4J7Z37Y4.js.map → actions-virtual-module-QEI6QPK4.js.map} +0 -0
- /package/dist/{agent-XPZUWTHR.js.map → agent-IIF6JUWX.js.map} +0 -0
- /package/dist/{app-typed-client-AZMUYIYV.js.map → app-typed-client-CHSITA46.js.map} +0 -0
- /package/dist/{app-typed-client-DSS23KDC.js.map → app-typed-client-XQJXF646.js.map} +0 -0
- /package/dist/{chunk-PZLH4WGU.js.map → chunk-2BMJQMTH.js.map} +0 -0
- /package/dist/{chunk-44E7XIZC.js.map → chunk-3MKRDJQ2.js.map} +0 -0
- /package/dist/{chunk-4ERYQBL6.js.map → chunk-4Z5XO4O4.js.map} +0 -0
- /package/dist/{chunk-FPC6ZEEU.js.map → chunk-6RVWPEKK.js.map} +0 -0
- /package/dist/{chunk-V7ISZGNS.js.map → chunk-7HGZ3CKL.js.map} +0 -0
- /package/dist/{chunk-WR5B2XNT.js.map → chunk-FNAEKJHO.js.map} +0 -0
- /package/dist/{chunk-VD3BCME6.js.map → chunk-I5PDEWZZ.js.map} +0 -0
- /package/dist/{chunk-VOXLI66L.js.map → chunk-OZB2TKGJ.js.map} +0 -0
- /package/dist/{chunk-XUAWD5HK.js.map → chunk-RKRFJRJ3.js.map} +0 -0
- /package/dist/{chunk-DA3GGICE.js.map → chunk-RQKMY3JW.js.map} +0 -0
- /package/dist/{dev-TW6QD7F3.js.map → dev-J2XZIENF.js.map} +0 -0
- /package/dist/{dev-emit-T3X6RR7M.js.map → dev-emit-AXTJK56H.js.map} +0 -0
- /package/dist/{dev-emit-ZK5GCHXN.js.map → dev-emit-XAPVJBM4.js.map} +0 -0
- /package/dist/{info-XURFOBRF.js.map → info-6NAUW5XY.js.map} +0 -0
- /package/dist/{internal-api-XPT4GLYX.js.map → internal-api-A5HA7TYF.js.map} +0 -0
- /package/dist/{internal-api-ATSPOXI2.js.map → internal-api-R7TTYMCY.js.map} +0 -0
- /package/dist/{load-config-2DXLI7NW.js.map → load-config-CLFWJOXN.js.map} +0 -0
- /package/dist/{mcp-LMV3NQEP.js.map → mcp-MWTG3LRA.js.map} +0 -0
- /package/dist/{openapi-UJSUQPNT.js.map → openapi-RVFUXXCR.js.map} +0 -0
- /package/dist/{preview-AMNBV2DP.js.map → preview-ML4CFUD6.js.map} +0 -0
- /package/dist/{routes-ENMU4GAN.js.map → routes-SMNSI2ZX.js.map} +0 -0
- /package/dist/{server-boundary-K4YQXDQT.js.map → server-boundary-HYLYGFZY.js.map} +0 -0
- /package/dist/{server-boundary-JM72DQLA.js.map → server-boundary-ZT6HN7ON.js.map} +0 -0
- /package/dist/{start-GAULIE5E.js.map → start-L5TGWGLU.js.map} +0 -0
- /package/dist/{vite-plugin-4ZMBW3KV.js.map → vite-plugin-OJND2LU5.js.map} +0 -0
|
@@ -15,11 +15,11 @@ import "./chunk-CHTAWXC2.js";
|
|
|
15
15
|
import "./chunk-AVQU5CQF.js";
|
|
16
16
|
import "./chunk-VSLTKX5L.js";
|
|
17
17
|
import "./chunk-SFGGRC35.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-4Z5XO4O4.js";
|
|
19
19
|
import {
|
|
20
20
|
scanServerActionsEnriched
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-7HGZ3CKL.js";
|
|
22
|
+
import "./chunk-A6UFN6QQ.js";
|
|
23
23
|
import "./chunk-DV34VG3N.js";
|
|
24
24
|
import "./chunk-V6Y2SMRG.js";
|
|
25
25
|
import "./chunk-ACKBVBUI.js";
|
|
@@ -28,7 +28,7 @@ import "./chunk-ICXXHV4V.js";
|
|
|
28
28
|
import "./chunk-YSJOZEI6.js";
|
|
29
29
|
import "./chunk-Z4PJMZLM.js";
|
|
30
30
|
import "./chunk-UMNXCU3K.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-AHYOVVJ7.js";
|
|
32
32
|
import "./chunk-SOYOYGWY.js";
|
|
33
33
|
import "./chunk-ZWN3AODA.js";
|
|
34
34
|
import "./chunk-XTHN6JBX.js";
|
|
@@ -234,4 +234,4 @@ export const actions = manifest
|
|
|
234
234
|
export {
|
|
235
235
|
actionsVirtualModule
|
|
236
236
|
};
|
|
237
|
-
//# sourceMappingURL=actions-virtual-module-
|
|
237
|
+
//# sourceMappingURL=actions-virtual-module-MIQPBAZW.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "tsx/esm";
|
|
3
|
-
import "./chunk-
|
|
3
|
+
import "./chunk-RQKMY3JW.js";
|
|
4
4
|
import "./chunk-BINRCILF.js";
|
|
5
5
|
import "./chunk-FNJVSFEC.js";
|
|
6
6
|
import "./chunk-WSMLSIS5.js";
|
|
7
7
|
import "./chunk-MX63AWEK.js";
|
|
8
8
|
import "./chunk-C27VRUVN.js";
|
|
9
9
|
import "./chunk-7UZZHCRN.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-FNAEKJHO.js";
|
|
11
|
+
import "./chunk-FU3LEX2I.js";
|
|
12
12
|
import {
|
|
13
13
|
scanServerActionsEnriched
|
|
14
14
|
} from "./chunk-4WP7A7RX.js";
|
|
15
15
|
import "./chunk-Z7CJHDLS.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-O5JZ6ROY.js";
|
|
17
17
|
import "./chunk-D2R5SJEL.js";
|
|
18
18
|
import "./chunk-VQIUTCK2.js";
|
|
19
19
|
|
|
@@ -218,4 +218,4 @@ export const actions = manifest
|
|
|
218
218
|
export {
|
|
219
219
|
actionsVirtualModule
|
|
220
220
|
};
|
|
221
|
-
//# sourceMappingURL=actions-virtual-module-
|
|
221
|
+
//# sourceMappingURL=actions-virtual-module-QEI6QPK4.js.map
|
|
@@ -16,7 +16,7 @@ import "../chunk-CHTAWXC2.js";
|
|
|
16
16
|
import "../chunk-AVQU5CQF.js";
|
|
17
17
|
import {
|
|
18
18
|
scanAgents
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-A6UFN6QQ.js";
|
|
20
20
|
import "../chunk-V6Y2SMRG.js";
|
|
21
21
|
import "../chunk-ACKBVBUI.js";
|
|
22
22
|
import "../chunk-IZ3TIL6K.js";
|
|
@@ -3,13 +3,13 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
agentCommand,
|
|
5
5
|
createAgentSsrLoader
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2BMJQMTH.js";
|
|
7
7
|
import "./chunk-BINRCILF.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-FU3LEX2I.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-
|
|
15
|
+
//# sourceMappingURL=agent-IIF6JUWX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "tsx/esm";
|
|
3
|
-
import "./chunk-
|
|
3
|
+
import "./chunk-RQKMY3JW.js";
|
|
4
4
|
import "./chunk-BINRCILF.js";
|
|
5
5
|
import {
|
|
6
6
|
scanControllerModules
|
|
@@ -11,13 +11,13 @@ import "./chunk-C27VRUVN.js";
|
|
|
11
11
|
import "./chunk-7UZZHCRN.js";
|
|
12
12
|
import {
|
|
13
13
|
generateManifest
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-FNAEKJHO.js";
|
|
15
|
+
import "./chunk-FU3LEX2I.js";
|
|
16
16
|
import {
|
|
17
17
|
HTTP_METHODS
|
|
18
18
|
} from "./chunk-4WP7A7RX.js";
|
|
19
19
|
import "./chunk-Z7CJHDLS.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-O5JZ6ROY.js";
|
|
21
21
|
import "./chunk-D2R5SJEL.js";
|
|
22
22
|
import "./chunk-VQIUTCK2.js";
|
|
23
23
|
|
|
@@ -411,4 +411,4 @@ export {
|
|
|
411
411
|
generateClientDts,
|
|
412
412
|
shouldReemitForFile
|
|
413
413
|
};
|
|
414
|
-
//# sourceMappingURL=app-typed-client-
|
|
414
|
+
//# sourceMappingURL=app-typed-client-CHSITA46.js.map
|
|
@@ -17,11 +17,11 @@ import "./chunk-CHTAWXC2.js";
|
|
|
17
17
|
import "./chunk-AVQU5CQF.js";
|
|
18
18
|
import "./chunk-VSLTKX5L.js";
|
|
19
19
|
import "./chunk-SFGGRC35.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-4Z5XO4O4.js";
|
|
21
21
|
import {
|
|
22
22
|
generateManifest
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-7HGZ3CKL.js";
|
|
24
|
+
import "./chunk-A6UFN6QQ.js";
|
|
25
25
|
import {
|
|
26
26
|
HTTP_METHODS
|
|
27
27
|
} from "./chunk-DV34VG3N.js";
|
|
@@ -32,7 +32,7 @@ import "./chunk-ICXXHV4V.js";
|
|
|
32
32
|
import "./chunk-YSJOZEI6.js";
|
|
33
33
|
import "./chunk-Z4PJMZLM.js";
|
|
34
34
|
import "./chunk-UMNXCU3K.js";
|
|
35
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-AHYOVVJ7.js";
|
|
36
36
|
import "./chunk-SOYOYGWY.js";
|
|
37
37
|
import "./chunk-ZWN3AODA.js";
|
|
38
38
|
import "./chunk-XTHN6JBX.js";
|
|
@@ -427,4 +427,4 @@ export {
|
|
|
427
427
|
generateClientDts,
|
|
428
428
|
shouldReemitForFile
|
|
429
429
|
};
|
|
430
|
-
//# sourceMappingURL=app-typed-client-
|
|
430
|
+
//# sourceMappingURL=app-typed-client-XQJXF646.js.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "tsx/esm";
|
|
3
|
+
import {
|
|
4
|
+
cronScanDirs,
|
|
5
|
+
scanCronDirs
|
|
6
|
+
} from "./chunk-IWIRHUNV.js";
|
|
3
7
|
import {
|
|
4
8
|
VALID_TARGETS,
|
|
5
9
|
targetRendersDocument
|
|
@@ -24,10 +28,10 @@ import {
|
|
|
24
28
|
import {
|
|
25
29
|
generateManifest,
|
|
26
30
|
writeManifest as writeManifest2
|
|
27
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FNAEKJHO.js";
|
|
28
32
|
import {
|
|
29
33
|
scanAgents
|
|
30
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-FU3LEX2I.js";
|
|
31
35
|
import {
|
|
32
36
|
scanServerRoutes,
|
|
33
37
|
scanWebSocketRoutes
|
|
@@ -38,13 +42,13 @@ import {
|
|
|
38
42
|
} from "./chunk-Z7CJHDLS.js";
|
|
39
43
|
import {
|
|
40
44
|
loadConfig
|
|
41
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-OZB2TKGJ.js";
|
|
42
46
|
import {
|
|
43
47
|
loadEnv
|
|
44
48
|
} from "./chunk-3QPVEJ7D.js";
|
|
45
49
|
import {
|
|
46
50
|
importUserModule
|
|
47
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-O5JZ6ROY.js";
|
|
48
52
|
import "./chunk-NX3P5MLH.js";
|
|
49
53
|
import {
|
|
50
54
|
buildManifest,
|
|
@@ -53,7 +57,7 @@ import {
|
|
|
53
57
|
import "./chunk-D2R5SJEL.js";
|
|
54
58
|
|
|
55
59
|
// src/cli/commands/build.ts
|
|
56
|
-
import { existsSync as
|
|
60
|
+
import { existsSync as existsSync4 } from "fs";
|
|
57
61
|
import { resolve as resolve2 } from "path";
|
|
58
62
|
|
|
59
63
|
// src/server/cron/adapter-translators.ts
|
|
@@ -243,74 +247,6 @@ function relativize(absPath, root) {
|
|
|
243
247
|
return absPath;
|
|
244
248
|
}
|
|
245
249
|
|
|
246
|
-
// src/server/cron/cron-scan.ts
|
|
247
|
-
import { existsSync as existsSync2 } from "fs";
|
|
248
|
-
import { basename } from "path";
|
|
249
|
-
var DuplicateCronNameError = class extends Error {
|
|
250
|
-
constructor(cronName, filePaths) {
|
|
251
|
-
super(
|
|
252
|
-
`Duplicate cron name "${cronName}" defined in: ${filePaths.join(", ")}. Cron names must be unique across server/crons/ and agents/schedules/.`
|
|
253
|
-
);
|
|
254
|
-
this.cronName = cronName;
|
|
255
|
-
this.filePaths = filePaths;
|
|
256
|
-
this.name = "DuplicateCronNameError";
|
|
257
|
-
}
|
|
258
|
-
cronName;
|
|
259
|
-
filePaths;
|
|
260
|
-
code = "DUPLICATE_CRON_NAME";
|
|
261
|
-
};
|
|
262
|
-
var CRON_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".mjs"]);
|
|
263
|
-
function isCronDefinition(value) {
|
|
264
|
-
if (typeof value !== "object" || value === null) return false;
|
|
265
|
-
const def = value;
|
|
266
|
-
return typeof def.name === "string" && typeof def.schedule === "string" && typeof def.handler === "function" && (def.concurrency === "forbid" || def.concurrency === "allow");
|
|
267
|
-
}
|
|
268
|
-
async function scanCronDirs(dirs) {
|
|
269
|
-
const filePaths = [];
|
|
270
|
-
for (const dir of dirs) {
|
|
271
|
-
if (!existsSync2(dir)) continue;
|
|
272
|
-
walkSourceFiles(dir, { extensions: CRON_EXTENSIONS }, (p) => {
|
|
273
|
-
const base = basename(p);
|
|
274
|
-
if (base.startsWith("_") || base.startsWith(".")) return;
|
|
275
|
-
filePaths.push(p);
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
const nodes = [];
|
|
279
|
-
for (const filePath of filePaths) {
|
|
280
|
-
let mod;
|
|
281
|
-
try {
|
|
282
|
-
mod = await importUserModule(filePath);
|
|
283
|
-
} catch (err) {
|
|
284
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
285
|
-
throw new Error(`Failed to import cron file "${filePath}": ${reason}`);
|
|
286
|
-
}
|
|
287
|
-
const exported = mod.default;
|
|
288
|
-
if (!isCronDefinition(exported)) {
|
|
289
|
-
throw new Error(
|
|
290
|
-
`Cron file "${filePath}" is missing a valid default export. Expected \`export default defineCron(name, { schedule, handler })\`.`
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
nodes.push({
|
|
294
|
-
name: exported.name,
|
|
295
|
-
filePath,
|
|
296
|
-
schedule: exported.schedule,
|
|
297
|
-
concurrency: exported.concurrency
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
const byName = /* @__PURE__ */ new Map();
|
|
301
|
-
for (const node of nodes) {
|
|
302
|
-
const bucket = byName.get(node.name) ?? [];
|
|
303
|
-
bucket.push(node.filePath);
|
|
304
|
-
byName.set(node.name, bucket);
|
|
305
|
-
}
|
|
306
|
-
for (const [name, paths] of byName) {
|
|
307
|
-
if (paths.length > 1) {
|
|
308
|
-
throw new DuplicateCronNameError(name, paths);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return nodes.sort((a, b) => compareByCodeUnit(a.name, b.name));
|
|
312
|
-
}
|
|
313
|
-
|
|
314
250
|
// src/server/jobs/job-manifest.ts
|
|
315
251
|
var JOB_MANIFEST_SCHEMA_VERSION = 1;
|
|
316
252
|
function buildJobManifest(nodes, projectRoot) {
|
|
@@ -342,8 +278,8 @@ function relativize2(absPath, root) {
|
|
|
342
278
|
}
|
|
343
279
|
|
|
344
280
|
// src/server/jobs/job-scan.ts
|
|
345
|
-
import { existsSync as
|
|
346
|
-
import { basename
|
|
281
|
+
import { existsSync as existsSync2 } from "fs";
|
|
282
|
+
import { basename } from "path";
|
|
347
283
|
var DuplicateJobNameError = class extends Error {
|
|
348
284
|
constructor(jobName, filePaths) {
|
|
349
285
|
super(
|
|
@@ -364,10 +300,10 @@ function isJobDefinition(value) {
|
|
|
364
300
|
return typeof def.name === "string" && typeof def.handler === "function" && typeof def.maxAttempts === "number" && typeof def.hasInputSchema === "boolean";
|
|
365
301
|
}
|
|
366
302
|
async function scanJobs(jobsDir) {
|
|
367
|
-
if (!
|
|
303
|
+
if (!existsSync2(jobsDir)) return [];
|
|
368
304
|
const filePaths = [];
|
|
369
305
|
walkSourceFiles(jobsDir, { extensions: JOB_EXTENSIONS }, (p) => {
|
|
370
|
-
const base =
|
|
306
|
+
const base = basename(p);
|
|
371
307
|
if (base.startsWith("_") || base.startsWith(".")) return;
|
|
372
308
|
filePaths.push(p);
|
|
373
309
|
});
|
|
@@ -409,10 +345,10 @@ async function scanJobs(jobsDir) {
|
|
|
409
345
|
|
|
410
346
|
// src/cli/cleanup/cleanup.ts
|
|
411
347
|
import { promises as fs } from "fs";
|
|
412
|
-
import { basename as
|
|
348
|
+
import { basename as basename2, resolve as resolvePath, sep } from "path";
|
|
413
349
|
var DEFAULT_SKIP = [".git", ".gitkeep", ".gitignore"];
|
|
414
350
|
function normalizeSkipName(name) {
|
|
415
|
-
return
|
|
351
|
+
return basename2(name.replace(/\/$/, ""));
|
|
416
352
|
}
|
|
417
353
|
async function cleanOutDir(opts) {
|
|
418
354
|
const resolvedDir = resolvePath(opts.dir);
|
|
@@ -477,7 +413,7 @@ function describeServicesManifest(manifest, target) {
|
|
|
477
413
|
}
|
|
478
414
|
|
|
479
415
|
// src/cli/commands/build-scan-routes.ts
|
|
480
|
-
import { existsSync as
|
|
416
|
+
import { existsSync as existsSync3 } from "fs";
|
|
481
417
|
import { join, relative, resolve, sep as sep2 } from "path";
|
|
482
418
|
function createBuildScanRoutes(projectRoot, config) {
|
|
483
419
|
return (serverDir) => {
|
|
@@ -513,7 +449,7 @@ function createBuildScanRoutes(projectRoot, config) {
|
|
|
513
449
|
// is handed `serverDir`, and a Worker has no filesystem to look for it on. An app with no
|
|
514
450
|
// `server/context.ts` yields `undefined`, and the generator then emits no import — importing
|
|
515
451
|
// a file that is not there would fail the BUILD rather than one request.
|
|
516
|
-
contextModule:
|
|
452
|
+
contextModule: existsSync3(join(abs, "context.ts")) ? toProjectRelative(join(abs, "context.ts")) : void 0
|
|
517
453
|
};
|
|
518
454
|
};
|
|
519
455
|
}
|
|
@@ -596,7 +532,7 @@ async function buildCommand(options) {
|
|
|
596
532
|
`);
|
|
597
533
|
}
|
|
598
534
|
async function runAdapterBuild(target, config, cwd, adapter) {
|
|
599
|
-
const { theoPluginAsync } = await import("./vite-plugin-
|
|
535
|
+
const { theoPluginAsync } = await import("./vite-plugin-OJND2LU5.js");
|
|
600
536
|
const { default: react } = await import("@vitejs/plugin-react");
|
|
601
537
|
const ctx = {
|
|
602
538
|
// `react()` may return Plugin or Plugin[] depending on version; spread the
|
|
@@ -629,9 +565,8 @@ async function runAdapterBuild(target, config, cwd, adapter) {
|
|
|
629
565
|
await adapter.build(config, cwd, ctx);
|
|
630
566
|
}
|
|
631
567
|
async function emitCronArtifacts(opts) {
|
|
632
|
-
const
|
|
633
|
-
const
|
|
634
|
-
const cronNodes = await scanCronDirs([cronsDir, agentsSchedulesDir]);
|
|
568
|
+
const { crons, schedules } = cronScanDirs(opts.cwd, opts.serverDir, opts.agentsDir);
|
|
569
|
+
const cronNodes = await scanCronDirs([crons, schedules]);
|
|
635
570
|
const manifestPath = resolve2(opts.distDir, "crons.json");
|
|
636
571
|
writeCronManifest(manifestPath, cronNodes, opts.cwd);
|
|
637
572
|
console.log(` \u2713 Crons: ${cronNodes.length} declared`);
|
|
@@ -677,7 +612,7 @@ async function emitCronArtifacts(opts) {
|
|
|
677
612
|
}
|
|
678
613
|
async function emitJobArtifacts(opts) {
|
|
679
614
|
const jobsDir = resolve2(opts.serverDir, "jobs");
|
|
680
|
-
const jobNodes =
|
|
615
|
+
const jobNodes = existsSync4(jobsDir) ? await scanJobs(jobsDir) : [];
|
|
681
616
|
const manifestPath = resolve2(opts.distDir, "jobs.json");
|
|
682
617
|
writeJobManifest(manifestPath, jobNodes, opts.cwd);
|
|
683
618
|
console.log(` \u2713 Jobs: ${jobNodes.length} declared`);
|
|
@@ -692,4 +627,4 @@ function relativize3(absPath, root) {
|
|
|
692
627
|
export {
|
|
693
628
|
buildCommand
|
|
694
629
|
};
|
|
695
|
-
//# sourceMappingURL=build-
|
|
630
|
+
//# sourceMappingURL=build-QIO4VAW2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/build.ts","../src/server/cron/adapter-translators.ts","../src/server/_internal/atomic-write.ts","../src/server/cron/cron-manifest.ts","../src/server/jobs/job-manifest.ts","../src/server/jobs/job-scan.ts","../src/cli/cleanup/cleanup.ts","../src/cli/commands/build/describe-services-manifest.ts","../src/cli/commands/build-scan-routes.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\n// T1.1 (architecture-medium-deferrals) — nodeAdapter no longer static-imported.\n// All adapters dispatch via `adapterRegistry` (lazy-imported within runAdapterBuild).\nimport {\n VALID_TARGETS,\n targetRendersDocument,\n type BuildTarget,\n type AdapterBuildContext,\n type DeployAdapter,\n} from '../../adapters/types.js'\nimport { loadConfig } from '../../config/load-config.js'\nimport { loadEnv } from '../../config/load-env.js'\nimport { validateProjectStructure } from '../../config/validate-structure.js'\nimport {\n ExistingConfigUnparseableError,\n translateCronToAws,\n translateCronToCloudflare,\n translateCronToDeno,\n translateCronToVercel,\n} from '../../server/cron/adapter-translators.js'\nimport { writeCronManifest } from '../../server/cron/cron-manifest.js'\nimport { cronScanDirs, scanCronDirs } from '../../server/cron/cron-scan.js'\nimport { writeJobManifest } from '../../server/jobs/job-manifest.js'\nimport { scanJobs } from '../../server/jobs/job-scan.js'\nimport { generateManifest, writeManifest } from '../../server/scan/manifest.js'\nimport {\n buildManifest as buildServicesManifest,\n writeManifest as writeServicesManifest,\n} from '../../services/index.js'\n// G2 T2.2 — OpenAPI emit. Opt-in via `config.openapi`. Dual output:\n// 1. <distDir>/openapi.json (pre-Vite, dev surface + manifests sibling)\n// 2. dist/openapi.json (post-Vite, build artifact)\n// The dist emit awaits runAdapterBuild — if Vite fails, the second emit\n// never runs (EC-2 absorbed: no stale dist artifact).\nimport { emitOpenApi } from '../../vite-plugin/openapi-emit/emit.js'\nimport { loadRoutesForOpenApi } from '../../vite-plugin/openapi-emit/load-routes.js'\nimport { cleanOutDir } from '../cleanup/cleanup.js'\nimport { preflightNodeAndBindings } from '../preflight-node-version.js'\n\nimport { describeServicesManifest } from './build/describe-services-manifest.js'\nimport { describeControllerArtifacts, emitControllerArtifacts } from './build/emit-controllers.js'\nimport { createBuildScanRoutes } from './build-scan-routes.js'\n\n// Adapters that do NOT support cron triggers natively. Build still\n// succeeds with crons declared, but emits a warning + skip note.\nconst CRON_NA_TARGETS = new Set<BuildTarget>(['bun', 'netlify', 'static'])\n\n// DERIVED, never restated. A hand-written list here went stale and told users\n// that three working targets were unsupported: it named node/vercel/cloudflare\n// while aws-lambda, deno-deploy and theo-cloud also translate crons. Deriving\n// from the two constants means adding a target cannot desynchronise the message.\nconst CRON_SUPPORTED_TARGETS = VALID_TARGETS.filter((t) => !CRON_NA_TARGETS.has(t))\n\nexport async function buildCommand(options?: { target?: string }): Promise<void> {\n const cwd = process.cwd()\n // Preflight (FIRST — BEFORE anything that touches native bindings).\n preflightNodeAndBindings(cwd)\n // Phase 1 (T1.2) — Load .env BEFORE config load.\n loadEnv({ cwd, mode: 'production' })\n\n const config = await loadConfig(cwd)\n // #95 — honor config.appDir so a custom frontend dir (e.g. apps/web) passes the structure gate.\n validateProjectStructure(cwd, config.appDir)\n\n // B-336 — EVERY refusal that is decidable from the target and the config alone runs BEFORE the\n // clean. `cleanOutDir` used to sit here, above even the check that the target EXISTS: measured on a\n // real project, `theokit build --target nao-existe` destroyed 302 files in `.theokit/client/assets`\n // and answered with a message about the typo. The comment above\n // `assertRateLimitEnforceable` already stated this intent in its own words — \"refused by name,\n // BEFORE the build writes anything\" — and the order defeated it.\n const target = (options?.target ?? 'node') as BuildTarget\n\n if (!VALID_TARGETS.includes(target)) {\n throw new Error(\n `Invalid build target \"${target}\". Available targets: ${VALID_TARGETS.join(', ')}`,\n )\n }\n\n const { resolveAdapter, streamingTargets } = await import('../../adapters/registry.js')\n const adapter = await resolveAdapter(target)\n const { assertRateLimitEnforceable, assertStreamingSupported } =\n await import('../../adapters/config-support.js')\n\n // #461 — a dropped `cors` degrades where someone can see it; a dropped RATE LIMIT looks exactly like\n // success until the abuse it was meant to stop. Refused by name, and now genuinely before anything is\n // written or destroyed.\n assertRateLimitEnforceable(config, adapter, target)\n assertStreamingSupported(config, adapter, target, await streamingTargets())\n\n // T2.2 — Clean .theokit/ at build start (Astro pattern). Skip .git*.\n const distDirAbs = resolve(cwd, config.distDir)\n await cleanOutDir({ dir: distDirAbs })\n\n // EC-201 — cross-reference note when config.adapters[] diverges from\n // the --target flag. --target is authoritative per ADR D2.\n const configAdapters = (config as { adapters?: readonly string[] }).adapters\n if (configAdapters && configAdapters.length > 0) {\n const otherAdapters = configAdapters.filter((a) => a !== target)\n if (otherAdapters.length > 0) {\n console.log(\n `\\n Note: theo.config.ts.adapters lists [${otherAdapters.join(', ')}]; ` +\n `this build translates for ${target} only. ` +\n `Run \\`theokit build --target=<adapter>\\` separately for each (cross-reference).`,\n )\n }\n }\n\n console.log(`\\n Building for ${target}...\\n`)\n\n // Manifests emit BEFORE adapter bundling (Vite). Why: manifests are\n // fast + deterministic + don't depend on Vite. If Vite fails (missing\n // dep, malformed entry), the user still gets manifests for diagnostics.\n const serverDir = resolve(cwd, config.serverDir)\n const distDir = distDirAbs\n // #95 follow-up — pass projectRoot (cwd) + config.agentsDir so agents scan honors a custom dir.\n const manifest = generateManifest(serverDir, cwd, config.agentsDir)\n writeManifest(manifest, distDir)\n\n const totalEndpoints =\n manifest.routes.length + manifest.actions.length + manifest.websockets.length\n console.log(\n ` ✓ Manifest: ${manifest.routes.length} routes, ${manifest.actions.length} actions, ${manifest.websockets.length} ws (${totalEndpoints} total)`,\n )\n\n // T1.1 — cron scan + manifest + per-target adapter translation\n await emitCronArtifacts({ cwd, serverDir, agentsDir: config.agentsDir, distDir, target })\n\n // T1.2 — job scan + manifest (no per-target translation needed)\n await emitJobArtifacts({ cwd, serverDir, distDir })\n\n // theokit#123 — compile `server/controllers/**` so `theokit start` can serve them.\n //\n // #122 made controllers first-class in dev, where Vite's swc transform compiles them on the fly.\n // Production has neither, so an uncompiled `.controller.ts` cannot load and its routes 404'd —\n // working in dev and failing in prod, which is the worst place for a gap to live.\n //\n // Deliberately NOT folded into `generateManifest` (ADR-5): the manifest is the deploy-adapter\n // contract, and a parallel route source in it would ripple through every adapter. This writes a\n // separate artifact only the Node start path reads. No controllers ⇒ no artifact at all.\n const controllerManifest = await emitControllerArtifacts({ serverDir, distDir })\n if (controllerManifest !== null) {\n console.log(` ${describeControllerArtifacts(controllerManifest)}`)\n }\n\n // Wave 2 (T1.2) — services manifest at <cwd>/.theokit/services.json. Always\n // emit (empty array when services: {} is empty) so adapters can rely on\n // the file existing. Topological order preserved by buildServicesManifest.\n //\n // Plan v1.2 T2.1 — when theo.config.ts declares `name`, emit services.json\n // v2 with that project identifier. Falling back to v1 (no project field)\n // keeps TheoCloud's deprecation warning path intact (services-bundle).\n const projectName = config.name\n const servicesManifest = buildServicesManifest(config.services, projectName)\n writeServicesManifest(cwd, servicesManifest)\n const servicesLine = describeServicesManifest(servicesManifest, target)\n if (servicesLine !== null) console.log(` ${servicesLine}`)\n\n // G2 T2.2 — OpenAPI dev-surface emit (pre-Vite, sibling of manifests).\n // Opt-in: only when config.openapi is defined. Best-effort: a route load\n // failure produces a warning, not a build abort.\n if (config.openapi !== undefined) {\n const hydrated = await loadRoutesForOpenApi({ serverDir, routes: manifest.routes })\n const devResult = emitOpenApi({\n manifest: hydrated,\n config: { ...config.openapi, outDir: distDir },\n })\n console.log(` ✓ OpenAPI: ${String(hydrated.length)} ops → ${devResult.path}`)\n }\n\n // Now run the adapter-specific bundling (Vite + adapter-specific work).\n await runAdapterBuild(target, config, cwd, adapter)\n\n // G2 T2.2 — OpenAPI build-artifact emit (post-Vite, EC-2 gated on success).\n // If runAdapterBuild threw, execution never reaches this point — no stale\n // dist/openapi.json is written.\n if (config.openapi !== undefined) {\n const distOut = resolve(cwd, 'dist')\n const hydrated = await loadRoutesForOpenApi({ serverDir, routes: manifest.routes })\n const distResult = emitOpenApi({\n manifest: hydrated,\n config: { ...config.openapi, outDir: distOut },\n })\n console.log(` ✓ OpenAPI (dist): ${distResult.path}`)\n }\n\n // Derived, not asserted. This read `config.ssr` alone, so a target whose entry delegates the\n // document to a static host was announced as server-rendering — measured on `--target bun`, which\n // printed `(SSR)` and served an empty `<div id=\"root\">` (B-334).\n const ssrNote = config.ssr && targetRendersDocument(target) ? ' (SSR)' : ''\n console.log(`\\n ✓ Build complete → ${target}${ssrNote}\\n`)\n}\n\nasync function runAdapterBuild(\n target: BuildTarget,\n config: Awaited<ReturnType<typeof loadConfig>>,\n cwd: string,\n // Resolved by the caller, which needs it before `cleanOutDir` to run the refusals (B-336). Passing it\n // in rather than resolving again keeps one answer to \"which adapter is this build\".\n adapter: DeployAdapter,\n): Promise<void> {\n // T1.1 (architecture-cleanup) — CLI composes the Vite Plugin[] and INJECTS it into\n // the adapter via ctx.makeVitePlugins. This inverts the previous `adapters → vite-plugin`\n // edge — adapters no longer import from vite-plugin/ directly.\n //\n // theoPlugin AND `@vitejs/plugin-react` are dynamically imported so the deps are\n // materialized only when needed (adapter is `node`). This keeps the CLI's startup\n // path independent of optional build-time deps (so e.g. `theokit build --target=static`\n // does not need react installed). dep-cruiser's per-module rule allows `cli → vite-plugin`.\n //\n // 0.2.2 regression fix: switched sync `theoPlugin()` → `theoPluginAsync()` so the\n // returned Plugin[] includes the @theo/actions virtual module + typed-client +\n // services + @theokit/ui auto-chain. Without async, build-time Rollup couldn't\n // resolve `@theo/actions` even though dev-time Vite (which already used async)\n // could. See https://github.com/usetheo/theokit/commits — 0.2.2 changelog.\n const { theoPluginAsync } = await import('../../vite-plugin/index.js')\n const { default: react } = await import('@vitejs/plugin-react')\n const ctx: AdapterBuildContext = {\n // `react()` may return Plugin or Plugin[] depending on version; spread the\n // async chain so the contract returns a flat Plugin[] (AdapterBuildContext\n // type updated to `Plugin[] | Promise<Plugin[]>`).\n // #95 — inject the config dirs so the client build's router/entry + typed-client codegen honor\n // custom appDir/serverDir/agentsDir (e.g. \"apps/web\" / \"core\" / \"core/agents\").\n makeVitePlugins: async (opts) =>\n [\n react(),\n ...(await theoPluginAsync({\n ...opts,\n appDir: config.appDir,\n serverDir: config.serverDir,\n agentsDir: config.agentsDir,\n })),\n ].flat(),\n\n // #369 — the same inversion, for the same reason. A Worker has no filesystem, so the Cloudflare\n // entry bakes its routes at build time; importing the scanner from `adapters/` would add the\n // `adapters → server` edge that `adapters-may-only-depend-on-core-router-services` refuses. The\n // CLI already imports both sides, so it composes the scan and hands over the result.\n //\n // A module rather than a closure since B-312: the wrong argument it carried was unreachable from\n // any test while it lived in here, because reaching it meant running the whole build.\n scanRoutes: createBuildScanRoutes(cwd, config),\n }\n\n // T1.1 (architecture-medium-deferrals, ADR D1) — Adapter Registry replaces\n // the previous 9-case switch. New adapters add 1 line in `adapters/registry.ts`;\n // CLI is closed for modification (OCP).\n // #409 / #410 — a config key that validates and is then never read makes the\n // deployed app behave as if the operator had not written it, with nothing\n // anywhere saying so. Name it before the build output scrolls past.\n const { warnUnappliedConfig } = await import('../../adapters/config-support.js')\n\n // #461 / #321 / #322 — the rate-limit refusal moved to `buildCommand`, above `cleanOutDir`, because\n // this position made its own comment false: it claimed the combination was refused \"BEFORE the build\n // writes anything\" and it is reached a hundred lines after the output has been emptied (B-336).\n\n warnUnappliedConfig(config, adapter, target, (message) => {\n console.log(message)\n })\n\n await adapter.build(config, cwd, ctx)\n}\n\nasync function emitCronArtifacts(opts: {\n cwd: string\n serverDir: string\n agentsDir: string\n distDir: string\n target: BuildTarget\n}): Promise<void> {\n // Crons live in two conventional homes: `server/crons/` (a backend trigger) and\n // `agents/schedules/` (a scheduled agent run, kept in the agent domain). Both feed one manifest.\n const { crons, schedules } = cronScanDirs(opts.cwd, opts.serverDir, opts.agentsDir)\n\n const cronNodes = await scanCronDirs([crons, schedules])\n const manifestPath = resolve(opts.distDir, 'crons.json')\n writeCronManifest(manifestPath, cronNodes, opts.cwd)\n\n console.log(` ✓ Crons: ${cronNodes.length} declared`)\n\n if (cronNodes.length === 0) return\n\n // EC-201: target-specific translation. N/A targets emit a warning + skip.\n if (CRON_NA_TARGETS.has(opts.target)) {\n console.log(\n ` ⚠ Cron not supported by target \"${opts.target}\" — declared crons skipped. ` +\n `Supported targets: ${CRON_SUPPORTED_TARGETS.join(', ')}.`,\n )\n return\n }\n\n const manifestEntries = cronNodes.map((n) => ({\n name: n.name,\n filePath: relativize(n.filePath, opts.cwd),\n schedule: n.schedule,\n concurrency: n.concurrency,\n }))\n\n try {\n switch (opts.target) {\n case 'vercel':\n translateCronToVercel(resolve(opts.cwd, 'vercel.json'), manifestEntries)\n console.log(` ✓ Cron → vercel.json crons[] (${cronNodes.length} entries)`)\n break\n case 'cloudflare':\n translateCronToCloudflare(resolve(opts.cwd, 'wrangler.toml'), manifestEntries)\n console.log(` ✓ Cron → wrangler.toml [triggers] (${cronNodes.length})`)\n break\n case 'aws-lambda':\n translateCronToAws(resolve(opts.cwd, 'serverless.yml'), manifestEntries)\n console.log(` ✓ Cron → serverless.yml functions (${cronNodes.length})`)\n break\n case 'deno-deploy':\n translateCronToDeno(resolve(opts.distDir, 'crons-entry.ts'), manifestEntries)\n console.log(` ✓ Cron → ${opts.distDir}/crons-entry.ts (Deno.cron)`)\n break\n case 'node':\n console.log(` ✓ Cron → in-process scheduler (theokit start)`)\n break\n }\n } catch (err) {\n if (err instanceof ExistingConfigUnparseableError) throw err\n throw err\n }\n}\n\nasync function emitJobArtifacts(opts: {\n cwd: string\n serverDir: string\n distDir: string\n}): Promise<void> {\n const jobsDir = resolve(opts.serverDir, 'jobs')\n\n const jobNodes = existsSync(jobsDir) ? await scanJobs(jobsDir) : []\n const manifestPath = resolve(opts.distDir, 'jobs.json')\n writeJobManifest(manifestPath, jobNodes, opts.cwd)\n console.log(` ✓ Jobs: ${jobNodes.length} declared`)\n}\n\nfunction relativize(absPath: string, root: string): string {\n if (absPath.startsWith(root)) {\n const trimmed = absPath.slice(root.length)\n return trimmed.startsWith('/') ? trimmed.slice(1) : trimmed\n }\n return absPath\n}\n","/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time adapter translators: caller-controlled paths only.\n */\nimport { existsSync, readFileSync } from 'node:fs'\n\nimport { writeAtomic } from '../_internal/atomic-write.js'\n\nimport type { CronManifestEntry } from './cron-manifest.js'\n\n/**\n * Thrown when an existing platform-config file (vercel.json, wrangler.toml,\n * serverless.yml) cannot be parsed. Caller must fix the file before\n * re-running `theokit build`. We NEVER silently overwrite a user's config.\n */\nexport class ExistingConfigUnparseableError extends Error {\n readonly code = 'EXISTING_CONFIG_UNPARSEABLE'\n constructor(\n public readonly filePath: string,\n public readonly parseError: string,\n ) {\n super(\n `Existing config \"${filePath}\" could not be parsed: ${parseError}. ` +\n 'Fix or remove the file before re-running build — TheoKit never silently overwrites user configuration.',\n )\n this.name = 'ExistingConfigUnparseableError'\n }\n}\n\n// ──────────────────────────────────────────────────────────\n// Vercel — vercel.json crons[]\n// ──────────────────────────────────────────────────────────\n\ninterface VercelJson {\n crons?: { path: string; schedule: string }[]\n [key: string]: unknown\n}\n\n/**\n * Translate a TheoKit cron manifest into `vercel.json crons[]`.\n *\n * EC-105: existing fields (functions, headers, redirects, rewrites, env,\n * etc.) are preserved verbatim — ONLY the `crons[]` slice is replaced.\n */\nexport function translateCronToVercel(\n vercelJsonPath: string,\n crons: readonly CronManifestEntry[],\n): void {\n let existing: VercelJson = {}\n if (existsSync(vercelJsonPath)) {\n const raw = readFileSync(vercelJsonPath, 'utf8')\n try {\n existing = JSON.parse(raw) as VercelJson\n } catch (err) {\n throw new ExistingConfigUnparseableError(\n vercelJsonPath,\n err instanceof Error ? err.message : String(err),\n )\n }\n }\n const merged: VercelJson = {\n ...existing,\n crons: crons.map((c) => ({\n path: `/api/__crons/${c.name}`,\n schedule: c.schedule,\n })),\n }\n writeAtomic(vercelJsonPath, JSON.stringify(merged, null, 2))\n}\n\n// ──────────────────────────────────────────────────────────\n// Cloudflare — wrangler.toml [triggers] crons\n// ──────────────────────────────────────────────────────────\n\n/**\n * Translate a TheoKit cron manifest into `wrangler.toml [triggers] crons`.\n *\n * EC-105: regex-based mutation that preserves comments + other sections\n * verbatim. Replaces only the `[triggers]` block (or appends if absent).\n */\nexport function translateCronToCloudflare(\n wranglerTomlPath: string,\n crons: readonly CronManifestEntry[],\n): void {\n const schedules = crons.map((c) => `\"${c.schedule}\"`).join(', ')\n const triggersBlock = `[triggers]\\ncrons = [${schedules}]\\n`\n\n if (!existsSync(wranglerTomlPath)) {\n writeAtomic(wranglerTomlPath, triggersBlock)\n return\n }\n\n const existing = readFileSync(wranglerTomlPath, 'utf8')\n\n // Replace existing [triggers] section if present. Strategy: split into\n // line array, find the [triggers] header line, drop subsequent lines\n // until the next section header (line starting with `[`) or EOF.\n const lines = existing.split('\\n')\n const triggersIdx = lines.findIndex((l) => l.trim() === '[triggers]')\n\n let next: string\n if (triggersIdx !== -1) {\n let endIdx = lines.length\n for (let i = triggersIdx + 1; i < lines.length; i++) {\n if (lines[i].trim().startsWith('[')) {\n endIdx = i\n break\n }\n }\n const before = lines.slice(0, triggersIdx).join('\\n')\n const after = lines.slice(endIdx).join('\\n')\n next = `${before}\\n${triggersBlock.trimEnd()}\\n${after}`.replace(/\\n{3,}/g, '\\n\\n')\n } else {\n next = existing.endsWith('\\n')\n ? `${existing}\\n${triggersBlock}`\n : `${existing}\\n\\n${triggersBlock}`\n }\n writeAtomic(wranglerTomlPath, next)\n}\n\n// ──────────────────────────────────────────────────────────\n// AWS Lambda — serverless.yml functions.<fn>.events: schedule\n// ──────────────────────────────────────────────────────────\n\n/**\n * Convert TheoKit's 5-field UTC cron to AWS EventBridge's 6-field format.\n * EventBridge requires `?` in EITHER day-of-month OR day-of-week (not both `*`).\n *\n * Algorithm:\n * - If DOM is \"*\" and DOW is \"*\" → insert ? in DOW (default)\n * - If DOM is \"*\" and DOW is specific → insert ? in DOM\n * - If DOM is specific and DOW is \"*\" → insert ? in DOW\n * - Append \"*\" year field at end.\n */\nexport function convertToAwsCron(schedule: string): string {\n const parts = schedule.trim().split(/\\s+/)\n if (parts.length !== 5) {\n throw new Error(`Invalid 5-field schedule for AWS conversion: \"${schedule}\"`)\n }\n const [minute, hour, dom, month, dow] = parts\n let awsDom = dom\n let awsDow = dow\n if (dom === '*' && dow === '*') {\n awsDow = '?'\n } else if (dom === '*') {\n awsDom = '?'\n } else if (dow === '*') {\n awsDow = '?'\n }\n return `cron(${minute} ${hour} ${awsDom} ${month} ${awsDow} *)`\n}\n\n/**\n * Translate a TheoKit cron manifest into a `serverless.yml` functions\n * map with `events: - schedule: cron(...)` entries.\n *\n * EC-105: appends to `functions:` block, preserving all existing\n * functions/sections. Cron functions are named `cron_<name>` to avoid\n * collision with user-declared functions.\n */\nexport function translateCronToAws(\n serverlessYmlPath: string,\n crons: readonly CronManifestEntry[],\n): void {\n const cronFunctionsYaml = crons\n .map(\n (c) => ` cron_${c.name}:\n handler: .theokit/server/crons/${c.name}.handler\n events:\n - schedule: ${convertToAwsCron(c.schedule)}`,\n )\n .join('\\n')\n\n const block = `\\nfunctions:\\n${cronFunctionsYaml}\\n`\n\n if (!existsSync(serverlessYmlPath)) {\n // Minimal serverless.yml scaffold\n writeAtomic(\n serverlessYmlPath,\n `service: theokit-app\\nprovider:\\n name: aws\\n runtime: nodejs22.x\\n${block}`,\n )\n return\n }\n\n const existing = readFileSync(serverlessYmlPath, 'utf8')\n\n // Look for an existing top-level `functions:` block; if present, append our\n // cron entries under it (don't replace user-declared functions).\n const functionsRe = /^functions:\\s*\\n/m\n let next: string\n if (functionsRe.test(existing)) {\n next = existing.replace(functionsRe, (match) => `${match}${cronFunctionsYaml}\\n`)\n } else {\n next = existing.endsWith('\\n') ? `${existing}${block}` : `${existing}\\n${block}`\n }\n writeAtomic(serverlessYmlPath, next)\n}\n\n// ──────────────────────────────────────────────────────────\n// Deno Deploy — Deno.cron registrations\n// ──────────────────────────────────────────────────────────\n\n/**\n * Emit a Deno entry file that registers each cron via `Deno.cron`.\n *\n * Unlike Vercel/CF/AWS, Deno.cron is an in-process runtime API — the\n * entry file is a managed artifact (overwritten each build), not a user\n * config (so EC-105 doesn't apply here).\n */\nexport function translateCronToDeno(entryPath: string, crons: readonly CronManifestEntry[]): void {\n const lines = crons.map(\n (c) =>\n `Deno.cron(\"${c.name}\", \"${c.schedule}\", async () => {\n const mod = await import(\"../${c.filePath}\");\n const def = mod.default;\n await def.handler({\n traceId: crypto.randomUUID().replace(/-/g, \"\"),\n scheduledAt: new Date(),\n signal: AbortSignal.timeout(60_000),\n });\n});`,\n )\n const content = `// AUTOGENERATED by TheoKit cron build — DO NOT EDIT.\n// Source: server/crons/*.ts → .theokit/crons.json → this file.\n${lines.join('\\n\\n')}\n`\n writeAtomic(entryPath, content)\n}\n","/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time atomic write: caller-controlled paths only. No HTTP input\n * reaches these fs calls.\n */\n// T5a.1b — Web Crypto migration. Build-time only; node:fs + node:path stay\n// because this is a manifest-write leaf (e.g. .theokit/jobs.json) and per\n// ADR-0028 the runtime-portable boundary is the request handler, not the\n// scanner. Only node:crypto is swapped out — Web Crypto's\n// getRandomValues works in every supported runtime.\nimport { mkdirSync, renameSync, writeFileSync } from 'node:fs'\nimport { dirname } from 'node:path'\n\n/**\n * Write `content` to `path` atomically via the tmp + rename pattern.\n *\n * Two concurrent calls to `writeAtomic(path, ...)` are guaranteed to\n * leave `path` containing valid content from ONE of the calls (never\n * truncated, never interleaved). POSIX rename is atomic on the same\n * filesystem.\n *\n * EC-106 (jobs-crons-webhooks-cost-tracking-plan) — shared helper for\n * `.theokit/crons.json` and `.theokit/jobs.json` manifest writes so a\n * concurrent dev-server scan + build manifest emit never produces\n * partial JSON.\n *\n * @param path destination path\n * @param content bytes (UTF-8 string) to write\n */\nexport function writeAtomic(path: string, content: string): void {\n mkdirSync(dirname(path), { recursive: true })\n // Include a random suffix so two concurrent writes don't trample each\n // other's tmp file. Web Crypto getRandomValues is non-blocking +\n // collision-safe for the tiny entropy we need (8 hex chars = 32 bits).\n // Hex-encoded manually to avoid Buffer (runtime-agnostic per ADR-0028).\n const randBuf = new Uint8Array(4)\n globalThis.crypto.getRandomValues(randBuf)\n let suffix = ''\n for (const b of randBuf) suffix += b.toString(16).padStart(2, '0')\n const tmp = `${path}.tmp-${process.pid}-${suffix}`\n writeFileSync(tmp, content, 'utf8')\n renameSync(tmp, path)\n}\n","import { writeAtomic } from '../_internal/atomic-write.js'\n\nimport type { CronNode } from './cron-scan.js'\n\nexport const CRON_MANIFEST_SCHEMA_VERSION = 1 as const\n\nexport interface CronManifestEntry {\n readonly name: string\n readonly filePath: string\n readonly schedule: string\n readonly concurrency: 'forbid' | 'allow'\n}\n\nexport interface CronManifest {\n readonly schemaVersion: typeof CRON_MANIFEST_SCHEMA_VERSION\n readonly generatedAt: string\n readonly crons: readonly CronManifestEntry[]\n}\n\n/**\n * Build a `CronManifest` from scanned `CronNode[]`. Filepaths are kept\n * relative to the caller's project root for portability.\n */\nexport function buildCronManifest(nodes: readonly CronNode[], projectRoot?: string): CronManifest {\n const crons: CronManifestEntry[] = nodes.map((n) => ({\n name: n.name,\n filePath: projectRoot ? relativize(n.filePath, projectRoot) : n.filePath,\n schedule: n.schedule,\n concurrency: n.concurrency,\n }))\n return {\n schemaVersion: CRON_MANIFEST_SCHEMA_VERSION,\n generatedAt: new Date().toISOString(),\n crons,\n }\n}\n\n/**\n * Write the cron manifest to `path` atomically (EC-106).\n *\n * Accepts either a pre-built `CronManifest` OR an array of `CronNode[]`\n * (which gets converted via `buildCronManifest`). The atomic-write\n * helper guarantees `path` always contains valid JSON, even under\n * concurrent writes (e.g., dev-server rescan + build).\n */\nexport function writeCronManifest(\n path: string,\n input: readonly CronNode[] | CronManifest,\n projectRoot?: string,\n): void {\n const manifest: CronManifest = isManifest(input) ? input : buildCronManifest(input, projectRoot)\n writeAtomic(path, JSON.stringify(manifest, null, 2))\n}\n\nfunction isManifest(value: unknown): value is CronManifest {\n return typeof value === 'object' && value !== null && 'schemaVersion' in value && 'crons' in value\n}\n\nfunction relativize(absPath: string, root: string): string {\n if (absPath.startsWith(root)) {\n const trimmed = absPath.slice(root.length)\n return trimmed.startsWith('/') ? trimmed.slice(1) : trimmed\n }\n return absPath\n}\n","import { writeAtomic } from '../_internal/atomic-write.js'\n\nimport type { JobNode } from './job-scan.js'\n\nexport const JOB_MANIFEST_SCHEMA_VERSION = 1 as const\n\nexport interface JobManifestEntry {\n readonly name: string\n readonly filePath: string\n readonly maxAttempts: number\n readonly hasInputSchema: boolean\n}\n\nexport interface JobManifest {\n readonly schemaVersion: typeof JOB_MANIFEST_SCHEMA_VERSION\n readonly generatedAt: string\n readonly jobs: readonly JobManifestEntry[]\n}\n\nexport function buildJobManifest(nodes: readonly JobNode[], projectRoot?: string): JobManifest {\n const jobs: JobManifestEntry[] = nodes.map((n) => ({\n name: n.name,\n filePath: projectRoot ? relativize(n.filePath, projectRoot) : n.filePath,\n maxAttempts: n.maxAttempts,\n hasInputSchema: n.hasInputSchema,\n }))\n return {\n schemaVersion: JOB_MANIFEST_SCHEMA_VERSION,\n generatedAt: new Date().toISOString(),\n jobs,\n }\n}\n\nexport function writeJobManifest(\n path: string,\n input: readonly JobNode[] | JobManifest,\n projectRoot?: string,\n): void {\n const manifest: JobManifest = isManifest(input) ? input : buildJobManifest(input, projectRoot)\n writeAtomic(path, JSON.stringify(manifest, null, 2))\n}\n\nfunction isManifest(value: unknown): value is JobManifest {\n return typeof value === 'object' && value !== null && 'schemaVersion' in value && 'jobs' in value\n}\n\nfunction relativize(absPath: string, root: string): string {\n if (absPath.startsWith(root)) {\n const trimmed = absPath.slice(root.length)\n return trimmed.startsWith('/') ? trimmed.slice(1) : trimmed\n }\n return absPath\n}\n","/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time scanner: caller-controlled directory paths only.\n */\nimport { existsSync } from 'node:fs'\nimport { basename } from 'node:path'\n\nimport { importUserModule } from '../../config/import-user-module.js'\nimport { compareByCodeUnit } from '../_internal/compare-by-code-unit.js'\nimport { walkSourceFiles } from '../_internal/scan-walker.js'\n\nimport type { JobDefinition } from './job-types.js'\n\nexport interface JobNode {\n readonly name: string\n readonly filePath: string\n readonly maxAttempts: number\n readonly hasInputSchema: boolean\n}\n\nexport class DuplicateJobNameError extends Error {\n readonly code = 'DUPLICATE_JOB_NAME'\n constructor(\n public readonly jobName: string,\n public readonly filePaths: readonly string[],\n ) {\n super(\n `Duplicate job name \"${jobName}\" defined in: ${filePaths.join(', ')}. ` +\n 'Job names must be unique across server/jobs/.',\n )\n this.name = 'DuplicateJobNameError'\n }\n}\n\nconst JOB_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.mjs'])\n\ninterface JobModule {\n default?: unknown\n}\n\nfunction isJobDefinition(value: unknown): value is JobDefinition {\n if (typeof value !== 'object' || value === null) return false\n const def = value as Record<string, unknown>\n return (\n typeof def.name === 'string' &&\n typeof def.handler === 'function' &&\n typeof def.maxAttempts === 'number' &&\n typeof def.hasInputSchema === 'boolean'\n )\n}\n\nexport async function scanJobs(jobsDir: string): Promise<JobNode[]> {\n if (!existsSync(jobsDir)) return []\n\n const filePaths: string[] = []\n walkSourceFiles(jobsDir, { extensions: JOB_EXTENSIONS }, (p) => {\n const base = basename(p)\n if (base.startsWith('_') || base.startsWith('.')) return\n filePaths.push(p)\n })\n\n const nodes: JobNode[] = []\n for (const filePath of filePaths) {\n let mod: JobModule\n try {\n mod = await importUserModule(filePath)\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err)\n throw new Error(`Failed to import job file \"${filePath}\": ${reason}`)\n }\n const exported = mod.default\n if (!isJobDefinition(exported)) {\n throw new Error(\n `Job file \"${filePath}\" is missing a valid default export. ` +\n 'Expected `export default defineJob(name, { handler })`.',\n )\n }\n nodes.push({\n name: exported.name,\n filePath,\n maxAttempts: exported.maxAttempts,\n hasInputSchema: exported.hasInputSchema,\n })\n }\n\n const byName = new Map<string, string[]>()\n for (const node of nodes) {\n const bucket = byName.get(node.name) ?? []\n bucket.push(node.filePath)\n byName.set(node.name, bucket)\n }\n for (const [name, paths] of byName) {\n if (paths.length > 1) {\n throw new DuplicateJobNameError(name, paths)\n }\n }\n\n return nodes.sort((a, b) => compareByCodeUnit(a.name, b.name))\n}\n","/**\n * State cleanup utilities (Phase 2 of\n *\n * - `cleanOutDir` — Astro pattern: empty a directory except a skip list,\n * used at `theokit build` start.\n * - `gcAgentRegistry` — Nuxt LRU pattern: delete oldest agent dirs when\n * count exceeds cap, used at `theokit dev` startup.\n *\n * EC-3 (MUST FIX, CRITICAL): cleanOutDir refuses to wipe anything outside\n * the current cwd. Prevents catastrophic `distDir: '/'` data loss.\n * EC-9 (SHOULD TEST): gcAgentRegistry handles dirs with mtime=0 (Docker overlay).\n * EC-11 (SHOULD TEST): cleanOutDir normalizes trailing-slash in skip basenames.\n * EC-12 (SHOULD TEST): cleanOutDir catches EROFS and continues.\n */\n\nimport { promises as fs } from 'node:fs'\nimport { basename, resolve as resolvePath, sep } from 'node:path'\n\nimport type {\n CleanOutDirOptions,\n CleanOutDirResult,\n GcAgentRegistryOptions,\n GcAgentRegistryResult,\n} from './cleanup-types.js'\n\nconst DEFAULT_SKIP = ['.git', '.gitkeep', '.gitignore']\n// DEFAULT_MAX_AGENTS removed in Phase 7 — gcAgentRegistry is a tombstone.\n\nfunction normalizeSkipName(name: string): string {\n // EC-11 — strip trailing slash + leading `./`\n return basename(name.replace(/\\/$/, ''))\n}\n\n/**\n * Empty a directory, preserving entries in the skip list.\n *\n * Throws if `opts.dir` is not inside `process.cwd()` (EC-3 path safety).\n * Returns `{deleted:0, kept:0}` when the directory does not exist.\n */\nexport async function cleanOutDir(opts: CleanOutDirOptions): Promise<CleanOutDirResult> {\n const resolvedDir = resolvePath(opts.dir)\n const resolvedCwd = resolvePath(process.cwd())\n\n // EC-3 — path safety guard. CRITICAL.\n if (resolvedDir === resolvedCwd) {\n throw new Error(\n `cleanOutDir refused to wipe ${resolvedDir} — must be a child of cwd, not cwd itself`,\n )\n }\n if (!resolvedDir.startsWith(resolvedCwd + sep)) {\n throw new Error(\n `cleanOutDir refused to wipe ${resolvedDir} — must be inside cwd (${resolvedCwd})`,\n )\n }\n\n const skip = new Set((opts.skip ?? DEFAULT_SKIP).map(normalizeSkipName))\n\n let entries: { name: string }[]\n try {\n entries = await fs.readdir(resolvedDir, { withFileTypes: true })\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'ENOENT') return { deleted: 0, kept: 0 }\n throw err\n }\n\n let deleted = 0\n let kept = 0\n for (const entry of entries) {\n const name = entry.name\n if (skip.has(name)) {\n kept++\n continue\n }\n const fullPath = resolvePath(resolvedDir, name)\n try {\n await fs.rm(fullPath, { recursive: true, force: true, maxRetries: 3 })\n deleted++\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'ENOENT') {\n deleted++ // already gone\n continue\n }\n // EC-12 — EROFS or other rm failure: warn + continue, don't crash.\n console.warn(\n `[theokit] cleanOutDir could not remove ${fullPath} (${code ?? 'unknown'}); skipping`,\n )\n kept++\n }\n }\n\n return { deleted, kept }\n}\n\n/**\n * Phase 7 — TOMBSTONE for backward-compat. The SDK v1.1.0's `Agent.registry`\n * handles GC natively; this function is a no-op + emits a deprecation warning\n * ONCE per process (EC-10).\n *\n * Will be deleted entirely in TheoKit 0.4.0. Marked deprecated via runtime\n * warning rather than `@deprecated` JSDoc tag to avoid the eslint\n * sonarjs/deprecation flagging our own internal symbols.\n */\nlet warnedOnce = false\nexport async function gcAgentRegistry(\n _opts: GcAgentRegistryOptions,\n): Promise<GcAgentRegistryResult> {\n if (!warnedOnce) {\n warnedOnce = true\n console.warn(\n '[theokit] gcAgentRegistry is deprecated; SDK Agent.registry handles GC natively (configure via theo.config.ts > agents.registry)',\n )\n }\n return Promise.resolve({ deleted: 0, kept: 0 })\n}\n\n/**\n * @internal — testing helper. Resets the module-scoped warnedOnce flag.\n */\nexport function __resetGcDeprecationWarnedForTests(): void {\n warnedOnce = false\n}\n","import type { BuildTarget } from '../../../adapters/types.js'\nimport type { ServicesManifest } from '../../../services/index.js'\n\n/**\n * The build line about `.theokit/services.json`, or `null` when there is nothing worth saying.\n *\n * The v1 warning is addressed to `theo-cloud`, the one target that reads the file. It used to print\n * on every target, for apps that declare no services, and it named a sunset in `theokit 0.6.0` that\n * had passed 68 minors earlier without anything being removed. A deadline nobody enforces teaches\n * the reader to skip the line, so the warning states what the file is and how to upgrade it.\n */\nexport function describeServicesManifest(\n manifest: ServicesManifest,\n target: BuildTarget,\n): string | null {\n if (manifest.services.length > 0) {\n const projectLabel = manifest.version === 2 ? ` project=\"${manifest.project}\"` : ''\n const names = manifest.services.map((s) => s.name).join(', ')\n return (\n `✓ Services manifest (v${String(manifest.version)}${projectLabel}): ` +\n `${String(manifest.services.length)} service(s) (${names})`\n )\n }\n if (manifest.version === 1 && target === 'theo-cloud') {\n return (\n '⚠ services.json emitted as v1 (no `name` in theo.config.ts), which TheoCloud reads as ' +\n 'deprecated. Run `theokit migrate services-json-v1-to-v2` to upgrade.'\n )\n }\n return null\n}\n","import { existsSync } from 'node:fs'\nimport { join, relative, resolve, sep } from 'node:path'\n\nimport type { AdapterBuildContext } from '../../adapters/types.js'\nimport { scanAgents } from '../../server/scan/agent-scan.js'\nimport { scanServerRoutes } from '../../server/scan/scan.js'\nimport { scanWebSocketRoutes } from '../../server/scan/ws-scan.js'\n\n/**\n * What a scanned deploy target is handed instead of a filesystem.\n *\n * #369 — a Worker has no filesystem at request time, so the Cloudflare entry bakes its routes at\n * build time. Importing the scanner from `adapters/` would add the `adapters → server` edge that\n * `adapters-may-only-depend-on-core-router-services` refuses, so the CLI composes the scan and\n * hands over the result.\n *\n * ## Why this is a module rather than a closure inside `buildCommand`\n *\n * It was a closure, and the defect it carried was invisible to every test: `buildCommand` loads a\n * config, runs vite twice and writes a tree, so nothing could ask it one question about one call.\n * Extracted at B-312, whose whole content was a single argument being wrong.\n *\n * Paths are made relative to the project root here, where `projectRoot` is known: that string is\n * both the emitted import specifier and the key the executor looks a module up by, and the scanners\n * return absolute paths.\n */\nexport function createBuildScanRoutes(\n projectRoot: string,\n config: { agentsDir?: string },\n): NonNullable<AdapterBuildContext['scanRoutes']> {\n return (serverDir: string) => {\n const abs = resolve(projectRoot, serverDir)\n const toProjectRelative = (p: string): string => relative(projectRoot, p).split(sep).join('/')\n\n return {\n routes: scanServerRoutes(abs).map((route) => ({\n filePath: toProjectRelative(route.filePath),\n routePath: route.routePath,\n methods: route.methods ?? [],\n })),\n wsRoutes: scanWebSocketRoutes(abs).map((ws) =>\n toProjectRelative(typeof ws === 'string' ? ws : ws.filePath),\n ),\n // #367 — agents are a DIFFERENT scan served by a DIFFERENT function, which is why no adapter\n // had ever heard of them: the entries route `/api/` through `scanServerRoutes` +\n // `executeRoute` alone, so `/api/agents/<name>` matched nothing and 404'd on every target.\n // Scanned here, beside the routes, because the same inversion argument applies verbatim.\n //\n // B-312 — the root is the PROJECT ROOT, and was `dirname(abs)`. `config.agentsDir` is\n // documented and declared relative to the project root, while `dirname(serverDir)` is the\n // root only when `serverDir` is a direct child of it. The scaffold's own nested layout\n // (`serverDir: 'src/server'`, `agentsDir: 'src/server/agents'`) made the two disagree, and\n // `join()` produced `<root>/src/src/server/agents` — so `scanAgents` returned `[]` and every\n // `/api/agents/*` route 404'd on every scanned target. Measured on a live Cloudflare deploy,\n // 2026-09-26. Every other caller in the tree already passes the project root.\n agents: scanAgents(projectRoot, config.agentsDir).map((agent) => ({\n filePath: toProjectRelative(agent.filePath),\n agentPath: agent.agentPath,\n name: agent.name,\n })),\n // B-185 — the identity module, decided here for the same reason the agents are: this provider\n // is handed `serverDir`, and a Worker has no filesystem to look for it on. An app with no\n // `server/context.ts` yields `undefined`, and the generator then emits no import — importing\n // a file that is not there would fail the BUILD rather than one request.\n contextModule: existsSync(join(abs, 'context.ts'))\n ? toProjectRelative(join(abs, 'context.ts'))\n : undefined,\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,WAAAC,gBAAe;;;ACExB,SAAS,YAAY,oBAAoB;;;ACMzC,SAAS,WAAW,YAAY,qBAAqB;AACrD,SAAS,eAAe;AAkBjB,SAAS,YAAY,MAAc,SAAuB;AAC/D,YAAU,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AAK5C,QAAM,UAAU,IAAI,WAAW,CAAC;AAChC,aAAW,OAAO,gBAAgB,OAAO;AACzC,MAAI,SAAS;AACb,aAAW,KAAK,QAAS,WAAU,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AACjE,QAAM,MAAM,GAAG,IAAI,QAAQ,QAAQ,GAAG,IAAI,MAAM;AAChD,gBAAc,KAAK,SAAS,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AAI;AACF,YAAQ,KAAK,QAAQ;AAAA,MACnB,KAAK;AACH,8BAAsBF,SAAQ,KAAK,KAAK,aAAa,GAAG,eAAe;AACvE,gBAAQ,IAAI,6CAAmC,UAAU,MAAM,WAAW;AAC1E;AAAA,MACF,KAAK;AACH,kCAA0BA,SAAQ,KAAK,KAAK,eAAe,GAAG,eAAe;AAC7E,gBAAQ,IAAI,kDAAwC,UAAU,MAAM,GAAG;AACvE;AAAA,MACF,KAAK;AACH,2BAAmBA,SAAQ,KAAK,KAAK,gBAAgB,GAAG,eAAe;AACvE,gBAAQ,IAAI,kDAAwC,UAAU,MAAM,GAAG;AACvE;AAAA,MACF,KAAK;AACH,4BAAoBA,SAAQ,KAAK,SAAS,gBAAgB,GAAG,eAAe;AAC5E,gBAAQ,IAAI,wBAAc,KAAK,OAAO,6BAA6B;AACnE;AAAA,MACF,KAAK;AACH,gBAAQ,IAAI,2DAAiD;AAC7D;AAAA,IACJ;AAAA,EACF,SAAS,KAAK;AACZ,QAAI,eAAe,+BAAgC,OAAM;AACzD,UAAM;AAAA,EACR;AACF;AAEA,eAAe,iBAAiB,MAId;AAChB,QAAM,UAAUA,SAAQ,KAAK,WAAW,MAAM;AAE9C,QAAM,WAAWG,YAAW,OAAO,IAAI,MAAM,SAAS,OAAO,IAAI,CAAC;AAClE,QAAM,eAAeH,SAAQ,KAAK,SAAS,WAAW;AACtD,mBAAiB,cAAc,UAAU,KAAK,GAAG;AACjD,UAAQ,IAAI,kBAAa,SAAS,MAAM,WAAW;AACrD;AAEA,SAASE,YAAW,SAAiB,MAAsB;AACzD,MAAI,QAAQ,WAAW,IAAI,GAAG;AAC5B,UAAM,UAAU,QAAQ,MAAM,KAAK,MAAM;AACzC,WAAO,QAAQ,WAAW,GAAG,IAAI,QAAQ,MAAM,CAAC,IAAI;AAAA,EACtD;AACA,SAAO;AACT;","names":["existsSync","resolve","relativize","isManifest","existsSync","existsSync","basename","existsSync","sep","sep","existsSync","resolve","writeManifest","relativize","existsSync"]}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-BINRCILF.js";
|
|
7
7
|
import {
|
|
8
8
|
scanAgents
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FU3LEX2I.js";
|
|
10
10
|
import {
|
|
11
11
|
loadEnv
|
|
12
12
|
} from "./chunk-3QPVEJ7D.js";
|
|
@@ -145,7 +145,7 @@ async function agentCommand(name, message, deps = {}) {
|
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
const projectRoot = deps.projectRoot ?? process.cwd();
|
|
148
|
-
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-
|
|
148
|
+
const agentsDir = deps.agentsDir ?? (await (await import("./load-config-CLFWJOXN.js")).loadConfig(projectRoot)).agentsDir;
|
|
149
149
|
const agents = scanAgents(projectRoot, agentsDir);
|
|
150
150
|
const agent = agents.find((a) => a.name === name);
|
|
151
151
|
if (!agent) {
|
|
@@ -178,8 +178,8 @@ async function agentCommand(name, message, deps = {}) {
|
|
|
178
178
|
async function createAgentSsrLoader(projectRoot) {
|
|
179
179
|
const { createServer } = await import("vite");
|
|
180
180
|
const react = (await import("@vitejs/plugin-react")).default;
|
|
181
|
-
const { theoPluginAsync } = await import("./vite-plugin-
|
|
182
|
-
const { loadConfig } = await import("./load-config-
|
|
181
|
+
const { theoPluginAsync } = await import("./vite-plugin-OJND2LU5.js");
|
|
182
|
+
const { loadConfig } = await import("./load-config-CLFWJOXN.js");
|
|
183
183
|
const config = await loadConfig(projectRoot);
|
|
184
184
|
const theoPlugins = await theoPluginAsync({
|
|
185
185
|
root: projectRoot,
|
|
@@ -212,4 +212,4 @@ export {
|
|
|
212
212
|
agentCommand,
|
|
213
213
|
createAgentSsrLoader
|
|
214
214
|
};
|
|
215
|
-
//# sourceMappingURL=chunk-
|
|
215
|
+
//# sourceMappingURL=chunk-2BMJQMTH.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-UMNXCU3K.js";
|
|
8
8
|
import {
|
|
9
9
|
importUserModule
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AHYOVVJ7.js";
|
|
11
11
|
import {
|
|
12
12
|
walkSourceFiles
|
|
13
13
|
} from "./chunk-SOYOYGWY.js";
|
|
@@ -526,4 +526,4 @@ export {
|
|
|
526
526
|
DuplicateJobNameError,
|
|
527
527
|
scanJobs
|
|
528
528
|
};
|
|
529
|
-
//# sourceMappingURL=chunk-
|
|
529
|
+
//# sourceMappingURL=chunk-3MKRDJQ2.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
importUserModule
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AHYOVVJ7.js";
|
|
4
4
|
|
|
5
5
|
// src/server/scan/module-loader.ts
|
|
6
6
|
function createViteLoader(vite) {
|
|
@@ -14,4 +14,4 @@ export {
|
|
|
14
14
|
createViteLoader,
|
|
15
15
|
createProductionLoader
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-4Z5XO4O4.js.map
|
|
@@ -78,16 +78,16 @@ import {
|
|
|
78
78
|
} from "./chunk-SFGGRC35.js";
|
|
79
79
|
import {
|
|
80
80
|
createViteLoader
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-4Z5XO4O4.js";
|
|
82
82
|
import {
|
|
83
83
|
matchRoute,
|
|
84
84
|
scanServerActions,
|
|
85
85
|
scanServerRoutes,
|
|
86
86
|
scanWebSocketRoutes
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-7HGZ3CKL.js";
|
|
88
88
|
import {
|
|
89
89
|
scanAgents
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-A6UFN6QQ.js";
|
|
91
91
|
import {
|
|
92
92
|
resolveProvider
|
|
93
93
|
} from "./chunk-ICXXHV4V.js";
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
} from "./chunk-Z4PJMZLM.js";
|
|
97
97
|
import {
|
|
98
98
|
importUserModule
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-AHYOVVJ7.js";
|
|
100
100
|
|
|
101
101
|
// src/vite-plugin/index.ts
|
|
102
102
|
import { existsSync as existsSync8 } from "node:fs";
|
|
@@ -1871,7 +1871,7 @@ async function runConfigureServer(server, ctx) {
|
|
|
1871
1871
|
server.watcher.on("unlink", handleRouteChange);
|
|
1872
1872
|
if (ctx.resolvedOpenApi !== void 0) {
|
|
1873
1873
|
const openApiCfg = ctx.resolvedOpenApi;
|
|
1874
|
-
const { reEmitOpenApi } = await import("./dev-emit-
|
|
1874
|
+
const { reEmitOpenApi } = await import("./dev-emit-AXTJK56H.js");
|
|
1875
1875
|
const openApiServerDir = ctx.serverDir;
|
|
1876
1876
|
const openApiDistDir = resolve7(ctx.projectRoot, ctx.resolvedDistDir);
|
|
1877
1877
|
const isRouteFileForOpenApi = (file) => file.startsWith(openApiServerDir) && /\.(ts|tsx|js|mjs)$/.test(file);
|
|
@@ -3072,7 +3072,7 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
3072
3072
|
}
|
|
3073
3073
|
const { assetsMapPlugin } = await import("./assets-map-CV2YZ3MY.js");
|
|
3074
3074
|
const assetsMap = assetsMapPlugin({ appDir: resolve9(projectRoot, options.appDir ?? "app") });
|
|
3075
|
-
const { appTypedClientPlugin } = await import("./app-typed-client-
|
|
3075
|
+
const { appTypedClientPlugin } = await import("./app-typed-client-XQJXF646.js");
|
|
3076
3076
|
const appClientPlugin = appTypedClientPlugin({
|
|
3077
3077
|
cwd: projectRoot,
|
|
3078
3078
|
serverDir: serverDirAbs,
|
|
@@ -3080,13 +3080,13 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
3080
3080
|
// B-313 — the same name line 226 already passes. This call passed neither it nor the root.
|
|
3081
3081
|
agentsDir: agentsDirName
|
|
3082
3082
|
});
|
|
3083
|
-
const { actionsVirtualModule } = await import("./actions-virtual-module-
|
|
3083
|
+
const { actionsVirtualModule } = await import("./actions-virtual-module-MIQPBAZW.js");
|
|
3084
3084
|
const actionsPlugin = actionsVirtualModule({
|
|
3085
3085
|
serverDir: serverDirAbs,
|
|
3086
3086
|
distDir: resolve9(projectRoot, ".theokit")
|
|
3087
3087
|
});
|
|
3088
3088
|
const { agentsTypedClientPlugin } = await import("./agents-typed-client-PVUZU65B.js");
|
|
3089
|
-
const { generateManifest } = await import("./internal-api-
|
|
3089
|
+
const { generateManifest } = await import("./internal-api-A5HA7TYF.js");
|
|
3090
3090
|
const agentsClientPlugin = agentsTypedClientPlugin({
|
|
3091
3091
|
projectRoot,
|
|
3092
3092
|
agentsDir: agentsDirName,
|
|
@@ -3103,7 +3103,7 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
3103
3103
|
const controllerTransformPlugin = controllerSwcTransformPlugin({
|
|
3104
3104
|
serverDir: serverDirAbs
|
|
3105
3105
|
});
|
|
3106
|
-
const { serverOnlyImportBoundary } = await import("./server-boundary-
|
|
3106
|
+
const { serverOnlyImportBoundary } = await import("./server-boundary-HYLYGFZY.js");
|
|
3107
3107
|
const serverBoundaryPlugin = serverOnlyImportBoundary({
|
|
3108
3108
|
projectRoot,
|
|
3109
3109
|
serverDir: serverDirAbs
|
|
@@ -3288,4 +3288,4 @@ export {
|
|
|
3288
3288
|
buildOptimizeDepsInclude,
|
|
3289
3289
|
theoPlugin
|
|
3290
3290
|
};
|
|
3291
|
-
//# sourceMappingURL=chunk-
|
|
3291
|
+
//# sourceMappingURL=chunk-6RVWPEKK.js.map
|