theokit 0.12.1 → 0.14.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-SQDY3V5X.js → actions-virtual-module-3CDQTWOC.js} +6 -6
- package/dist/{actions-virtual-module-PNPRCEOS.js → actions-virtual-module-RM7JRY5N.js} +9 -9
- package/dist/agents-typed-client-SAWAAH7K.js +142 -0
- package/dist/agents-typed-client-SAWAAH7K.js.map +1 -0
- package/dist/agents-typed-client-UTEQUA63.js +143 -0
- package/dist/agents-typed-client-UTEQUA63.js.map +1 -0
- package/dist/{app-typed-client-5GYEOYP3.js → app-typed-client-5VQE6DNF.js} +9 -9
- package/dist/{app-typed-client-QG7BVZYW.js → app-typed-client-CSOK7NPC.js} +6 -6
- package/dist/body-parser-web-FV5HWCY3.js +71 -0
- package/dist/body-parser-web-FV5HWCY3.js.map +1 -0
- package/dist/boot/index.js +3 -3
- package/dist/{build-QFRLSEZ4.js → build-5K7LK77K.js} +11 -11
- package/dist/{chunk-223EFY5X.js → chunk-2J7XU3PW.js} +68 -27
- package/dist/chunk-2J7XU3PW.js.map +1 -0
- package/dist/chunk-5UUOGAJH.js +445 -0
- package/dist/chunk-5UUOGAJH.js.map +1 -0
- package/dist/{chunk-43D6XNDR.js → chunk-637WJB7Z.js} +91 -18
- package/dist/chunk-637WJB7Z.js.map +1 -0
- package/dist/{chunk-6FYD34NX.js → chunk-BQDGES7C.js} +28 -28
- package/dist/{chunk-6FYD34NX.js.map → chunk-BQDGES7C.js.map} +1 -1
- package/dist/chunk-F4YUPDJ2.js +115 -0
- package/dist/chunk-F4YUPDJ2.js.map +1 -0
- package/dist/{chunk-TGTNRUH3.js → chunk-H243MR3F.js} +2 -2
- package/dist/chunk-JZHT3LW7.js +32 -0
- package/dist/chunk-JZHT3LW7.js.map +1 -0
- package/dist/chunk-KGFNWIMS.js +94 -0
- package/dist/chunk-KGFNWIMS.js.map +1 -0
- package/dist/{chunk-NAZ4E2GT.js → chunk-KXA37ONC.js} +2 -2
- package/dist/{chunk-7CBRKNQA.js → chunk-RBHCJHRR.js} +251 -22
- package/dist/chunk-RBHCJHRR.js.map +1 -0
- package/dist/chunk-RSVN727G.js +1 -0
- package/dist/chunk-S7Y5WLZY.js +235 -0
- package/dist/chunk-S7Y5WLZY.js.map +1 -0
- package/dist/{chunk-GFMQJHXX.js → chunk-WR4F4EEZ.js} +1082 -1074
- package/dist/chunk-WR4F4EEZ.js.map +1 -0
- package/dist/{chunk-WFNLNIJX.js → chunk-Z5IGLBWE.js} +1 -1
- package/dist/cli/index.js +5 -5
- package/dist/client/index.d.ts +41 -134
- package/dist/client/index.js +60 -202
- package/dist/client/index.js.map +1 -1
- package/dist/{dev-GBXOTXUP.js → dev-QOEVYNBG.js} +10 -10
- package/dist/{dev-emit-FEFEDLZF.js → dev-emit-5MDSBP5D.js} +3 -3
- package/dist/{dev-emit-O4EGOSNV.js → dev-emit-QH2YGZXN.js} +2 -2
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/internal-api-5BDI6N5U.js +83 -0
- package/dist/internal-api-EFKZWIYZ.js +66 -0
- package/dist/{openapi-VR6AFBLJ.js → openapi-FHY6HC6I.js} +7 -7
- package/dist/{registry-Q2TZQLUH.js → registry-34LL7NF4.js} +1 -1
- package/dist/{routes-LRYOIIAI.js → routes-EW7TP7NJ.js} +2 -2
- package/dist/server/auth/index.js +1 -1
- package/dist/server/define/index.d.ts +3 -70
- package/dist/server/define/index.js +4 -4
- package/dist/server/http/index.js +2 -2
- package/dist/server/index.d.ts +2 -4
- package/dist/server/index.js +94 -394
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.js +4 -4
- package/dist/server/observability/index.js +1 -1
- package/dist/server/scan/index.d.ts +22 -2
- package/dist/server/scan/index.js +2 -2
- package/dist/{start-3ZHAXSJE.js → start-2KG4JSXM.js} +76 -13
- package/dist/start-2KG4JSXM.js.map +1 -0
- package/dist/vite-plugin/index.js +13 -12
- package/dist/{vite-plugin-WO72VLYR.js → vite-plugin-TDIDZ5U7.js} +7 -7
- package/dist/vite-plugin-TDIDZ5U7.js.map +1 -0
- package/package.json +3 -7
- package/dist/agent-events-DosDXkSV.d.ts +0 -94
- package/dist/chunk-223EFY5X.js.map +0 -1
- package/dist/chunk-3LVRAGAZ.js +0 -73
- package/dist/chunk-3LVRAGAZ.js.map +0 -1
- package/dist/chunk-43D6XNDR.js.map +0 -1
- package/dist/chunk-7CBRKNQA.js.map +0 -1
- package/dist/chunk-AD74EAK3.js +0 -237
- package/dist/chunk-AD74EAK3.js.map +0 -1
- package/dist/chunk-GFMQJHXX.js.map +0 -1
- package/dist/chunk-PBEH6NXR.js +0 -44
- package/dist/chunk-PBEH6NXR.js.map +0 -1
- package/dist/chunk-PIVX3DYW.js +0 -142
- package/dist/chunk-PIVX3DYW.js.map +0 -1
- package/dist/chunk-PPPR5DGR.js +0 -1
- package/dist/chunk-RESN62GB.js +0 -269
- package/dist/chunk-RESN62GB.js.map +0 -1
- package/dist/server/agent/index.d.ts +0 -229
- package/dist/server/agent/index.js +0 -16
- package/dist/start-3ZHAXSJE.js.map +0 -1
- /package/dist/{actions-virtual-module-SQDY3V5X.js.map → actions-virtual-module-3CDQTWOC.js.map} +0 -0
- /package/dist/{actions-virtual-module-PNPRCEOS.js.map → actions-virtual-module-RM7JRY5N.js.map} +0 -0
- /package/dist/{app-typed-client-5GYEOYP3.js.map → app-typed-client-5VQE6DNF.js.map} +0 -0
- /package/dist/{app-typed-client-QG7BVZYW.js.map → app-typed-client-CSOK7NPC.js.map} +0 -0
- /package/dist/{build-QFRLSEZ4.js.map → build-5K7LK77K.js.map} +0 -0
- /package/dist/{chunk-TGTNRUH3.js.map → chunk-H243MR3F.js.map} +0 -0
- /package/dist/{chunk-NAZ4E2GT.js.map → chunk-KXA37ONC.js.map} +0 -0
- /package/dist/{chunk-PPPR5DGR.js.map → chunk-RSVN727G.js.map} +0 -0
- /package/dist/{chunk-WFNLNIJX.js.map → chunk-Z5IGLBWE.js.map} +0 -0
- /package/dist/{dev-GBXOTXUP.js.map → dev-QOEVYNBG.js.map} +0 -0
- /package/dist/{dev-emit-FEFEDLZF.js.map → dev-emit-5MDSBP5D.js.map} +0 -0
- /package/dist/{dev-emit-O4EGOSNV.js.map → dev-emit-QH2YGZXN.js.map} +0 -0
- /package/dist/{server/agent/index.js.map → internal-api-5BDI6N5U.js.map} +0 -0
- /package/dist/{vite-plugin-WO72VLYR.js.map → internal-api-EFKZWIYZ.js.map} +0 -0
- /package/dist/{openapi-VR6AFBLJ.js.map → openapi-FHY6HC6I.js.map} +0 -0
- /package/dist/{registry-Q2TZQLUH.js.map → registry-34LL7NF4.js.map} +0 -0
- /package/dist/{routes-LRYOIIAI.js.map → routes-EW7TP7NJ.js.map} +0 -0
|
@@ -1,30 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
broadcastToDevtools
|
|
3
|
-
} from "./chunk-7BIM27LV.js";
|
|
4
1
|
import {
|
|
5
2
|
buildServicesProxyConfig,
|
|
6
3
|
servicesConfigSchema
|
|
7
4
|
} from "./chunk-D7ZH7DTG.js";
|
|
5
|
+
import {
|
|
6
|
+
broadcastToDevtools
|
|
7
|
+
} from "./chunk-7BIM27LV.js";
|
|
8
8
|
import {
|
|
9
9
|
loadEnv,
|
|
10
10
|
resolveTransformer
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
BATCH_PATH,
|
|
14
|
-
TRACE_HEADER,
|
|
15
|
-
createCorsHandler,
|
|
16
|
-
executeAction,
|
|
17
|
-
executeRoute,
|
|
18
|
-
extractTraceId,
|
|
19
|
-
handleBatchRequest,
|
|
20
|
-
sendError
|
|
21
|
-
} from "./chunk-TGTNRUH3.js";
|
|
11
|
+
} from "./chunk-5UUOGAJH.js";
|
|
22
12
|
import {
|
|
23
13
|
findSuggestion
|
|
24
14
|
} from "./chunk-5QW7IQQU.js";
|
|
25
|
-
import {
|
|
26
|
-
logRequest
|
|
27
|
-
} from "./chunk-WFNLNIJX.js";
|
|
28
15
|
import {
|
|
29
16
|
createPluginRunnerFromConfig
|
|
30
17
|
} from "./chunk-IAJ2JVEH.js";
|
|
@@ -36,10 +23,11 @@ import {
|
|
|
36
23
|
} from "./chunk-JQSKBMXP.js";
|
|
37
24
|
import {
|
|
38
25
|
matchRoute,
|
|
26
|
+
scanAgents,
|
|
39
27
|
scanServerActions,
|
|
40
28
|
scanServerRoutes,
|
|
41
29
|
scanWebSocketRoutes
|
|
42
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-2J7XU3PW.js";
|
|
43
31
|
import {
|
|
44
32
|
CSP_REPORT_PATH,
|
|
45
33
|
CsrfReadinessStore,
|
|
@@ -53,6 +41,25 @@ import {
|
|
|
53
41
|
import {
|
|
54
42
|
importUserModule
|
|
55
43
|
} from "./chunk-7MQOHNHE.js";
|
|
44
|
+
import {
|
|
45
|
+
uiMessageStreamResponse
|
|
46
|
+
} from "./chunk-JZHT3LW7.js";
|
|
47
|
+
import {
|
|
48
|
+
BATCH_PATH,
|
|
49
|
+
TRACE_HEADER,
|
|
50
|
+
createCorsHandler,
|
|
51
|
+
executeAction,
|
|
52
|
+
executeRoute,
|
|
53
|
+
extractTraceId,
|
|
54
|
+
handleBatchRequest,
|
|
55
|
+
sendError
|
|
56
|
+
} from "./chunk-H243MR3F.js";
|
|
57
|
+
import {
|
|
58
|
+
logRequest
|
|
59
|
+
} from "./chunk-Z5IGLBWE.js";
|
|
60
|
+
import {
|
|
61
|
+
validateCsrfRequest
|
|
62
|
+
} from "./chunk-TSLSIRBR.js";
|
|
56
63
|
|
|
57
64
|
// src/vite-plugin/index.ts
|
|
58
65
|
import { existsSync as existsSync9 } from "fs";
|
|
@@ -974,6 +981,217 @@ function createActionMiddleware(vite, serverDir, options) {
|
|
|
974
981
|
};
|
|
975
982
|
}
|
|
976
983
|
|
|
984
|
+
// src/vite-plugin/agent-middleware.ts
|
|
985
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
986
|
+
|
|
987
|
+
// src/server/agent/mount-agent.ts
|
|
988
|
+
import { compileAgentModule, streamAgentUIMessages } from "@theokit/agents";
|
|
989
|
+
function partText(part) {
|
|
990
|
+
if (typeof part !== "object" || part === null) return "";
|
|
991
|
+
const p = part;
|
|
992
|
+
return p.type === "text" && typeof p.text === "string" ? p.text : "";
|
|
993
|
+
}
|
|
994
|
+
function jsonError(status, code, message) {
|
|
995
|
+
return new Response(JSON.stringify({ error: { code, message } }), {
|
|
996
|
+
status,
|
|
997
|
+
headers: { "content-type": "application/json" }
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
function parseAgentRequestBody(body) {
|
|
1001
|
+
if (typeof body !== "object" || body === null) return null;
|
|
1002
|
+
const b = body;
|
|
1003
|
+
if (Array.isArray(b.messages) && b.messages.length > 0) {
|
|
1004
|
+
const last = b.messages[b.messages.length - 1];
|
|
1005
|
+
const parts = Array.isArray(last.parts) ? last.parts : [];
|
|
1006
|
+
const text = parts.map(partText).join("");
|
|
1007
|
+
if (text.length === 0) return null;
|
|
1008
|
+
const sessionId = typeof b.id === "string" && b.id.length > 0 ? b.id : crypto.randomUUID();
|
|
1009
|
+
return { message: text, sessionId };
|
|
1010
|
+
}
|
|
1011
|
+
if (typeof b.message === "string" && b.message.length > 0) {
|
|
1012
|
+
const sessionId = typeof b.sessionId === "string" && b.sessionId.length > 0 ? b.sessionId : crypto.randomUUID();
|
|
1013
|
+
return { message: b.message, sessionId };
|
|
1014
|
+
}
|
|
1015
|
+
return null;
|
|
1016
|
+
}
|
|
1017
|
+
async function mountAgent(mod, request, apiKey, source = "agent module", csrfMode = "strict") {
|
|
1018
|
+
if (csrfMode !== "off") {
|
|
1019
|
+
const csrf = validateCsrfRequest(request);
|
|
1020
|
+
if (!csrf.valid && csrfMode === "strict") {
|
|
1021
|
+
return jsonError(403, "CSRF_FAILED", `CSRF check failed: ${csrf.reason}`);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
const compiled = compileAgentModule(mod, source);
|
|
1025
|
+
let body = null;
|
|
1026
|
+
try {
|
|
1027
|
+
body = await request.json();
|
|
1028
|
+
} catch {
|
|
1029
|
+
}
|
|
1030
|
+
const input = parseAgentRequestBody(body);
|
|
1031
|
+
if (input === null) {
|
|
1032
|
+
return jsonError(400, "BAD_REQUEST", "Request must contain a non-empty message or messages[].");
|
|
1033
|
+
}
|
|
1034
|
+
return uiMessageStreamResponse(streamAgentUIMessages(compiled, apiKey, input));
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// src/server/agent/provider-resolver.ts
|
|
1038
|
+
var DEFAULT_REGISTRY = [
|
|
1039
|
+
{
|
|
1040
|
+
name: "openrouter",
|
|
1041
|
+
envKey: "OPENROUTER_API_KEY",
|
|
1042
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
1043
|
+
priority: 1
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
name: "openai",
|
|
1047
|
+
envKey: "OPENAI_API_KEY",
|
|
1048
|
+
baseUrl: "https://api.openai.com/v1",
|
|
1049
|
+
priority: 2
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
name: "anthropic",
|
|
1053
|
+
envKey: "ANTHROPIC_API_KEY",
|
|
1054
|
+
baseUrl: "https://api.anthropic.com",
|
|
1055
|
+
priority: 3
|
|
1056
|
+
}
|
|
1057
|
+
];
|
|
1058
|
+
var registry = [...DEFAULT_REGISTRY];
|
|
1059
|
+
function resolveProvider() {
|
|
1060
|
+
const sorted = [...registry].sort((a, b) => a.priority - b.priority);
|
|
1061
|
+
for (const desc of sorted) {
|
|
1062
|
+
const apiKey = process.env[desc.envKey];
|
|
1063
|
+
if (apiKey && apiKey.length > 0) {
|
|
1064
|
+
return {
|
|
1065
|
+
name: desc.name,
|
|
1066
|
+
apiKey,
|
|
1067
|
+
baseUrl: desc.baseUrl
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
const envKeys = sorted.map((p) => p.envKey).join(" OR ");
|
|
1072
|
+
throw new Error(
|
|
1073
|
+
`No LLM provider API key found in environment. Set one of: ${envKeys}. Get a free OpenRouter key at https://openrouter.ai/keys (recommended \u2014 one key, many models).`
|
|
1074
|
+
);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// src/server/http/node-web-adapter.ts
|
|
1078
|
+
import { Readable } from "stream";
|
|
1079
|
+
function incomingMessageToWebRequest(req) {
|
|
1080
|
+
const host = pickHeaderString(req.headers.host) ?? "localhost";
|
|
1081
|
+
const url = `http://${host}${req.url ?? "/"}`;
|
|
1082
|
+
const headers = new Headers();
|
|
1083
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
1084
|
+
if (value === void 0) continue;
|
|
1085
|
+
if (Array.isArray(value)) {
|
|
1086
|
+
headers.set(key, value.join(", "));
|
|
1087
|
+
} else {
|
|
1088
|
+
headers.set(key, value);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
const method = (req.method ?? "GET").toUpperCase();
|
|
1092
|
+
const hasBody = method !== "GET" && method !== "HEAD";
|
|
1093
|
+
if (!hasBody) {
|
|
1094
|
+
return new Request(url, { method, headers });
|
|
1095
|
+
}
|
|
1096
|
+
const webStream = Readable.toWeb(req);
|
|
1097
|
+
return new Request(url, {
|
|
1098
|
+
method,
|
|
1099
|
+
headers,
|
|
1100
|
+
body: webStream,
|
|
1101
|
+
// EC-2: Node 18+ requires `duplex: 'half'` when body is a stream.
|
|
1102
|
+
// The `RequestInit` type omits it (Web spec gap); cast accordingly.
|
|
1103
|
+
...{ duplex: "half" }
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
async function writeWebResponseToServerResponse(response, res) {
|
|
1107
|
+
const setCookies = response.headers.getSetCookie();
|
|
1108
|
+
if (setCookies.length > 0) {
|
|
1109
|
+
res.setHeader("Set-Cookie", setCookies);
|
|
1110
|
+
}
|
|
1111
|
+
const otherHeaders = {};
|
|
1112
|
+
for (const [key, value] of response.headers.entries()) {
|
|
1113
|
+
if (key.toLowerCase() === "set-cookie") continue;
|
|
1114
|
+
otherHeaders[key] = value;
|
|
1115
|
+
}
|
|
1116
|
+
res.writeHead(response.status, response.statusText, otherHeaders);
|
|
1117
|
+
if (response.body === null) {
|
|
1118
|
+
res.end();
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
const reader = response.body.getReader();
|
|
1122
|
+
try {
|
|
1123
|
+
for (; ; ) {
|
|
1124
|
+
const { done, value } = await reader.read();
|
|
1125
|
+
if (done) break;
|
|
1126
|
+
res.write(value);
|
|
1127
|
+
}
|
|
1128
|
+
res.end();
|
|
1129
|
+
} finally {
|
|
1130
|
+
reader.releaseLock();
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
function pickHeaderString(value) {
|
|
1134
|
+
if (typeof value === "string") return value;
|
|
1135
|
+
if (Array.isArray(value)) {
|
|
1136
|
+
for (const v of value) if (typeof v === "string" && v.length > 0) return v;
|
|
1137
|
+
}
|
|
1138
|
+
return void 0;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// src/vite-plugin/agent-middleware.ts
|
|
1142
|
+
var PREFIX2 = "/api/agents/";
|
|
1143
|
+
function createAgentMiddleware(vite, projectRoot, csrfMode = "strict") {
|
|
1144
|
+
const loadModule = createViteLoader(vite);
|
|
1145
|
+
return (req, res, next) => {
|
|
1146
|
+
void (async () => {
|
|
1147
|
+
const url = req.url ?? "";
|
|
1148
|
+
if (!url.startsWith(PREFIX2)) {
|
|
1149
|
+
next();
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
const requestId = randomUUID2();
|
|
1153
|
+
const start = Date.now();
|
|
1154
|
+
res.setHeader("x-request-id", requestId);
|
|
1155
|
+
const urlPath = url.split("?")[0];
|
|
1156
|
+
const agent = scanAgents(projectRoot).find((a) => a.agentPath === urlPath);
|
|
1157
|
+
if (!agent) {
|
|
1158
|
+
next();
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
const method = (req.method ?? "POST").toUpperCase();
|
|
1162
|
+
if (method !== "POST") {
|
|
1163
|
+
sendError(
|
|
1164
|
+
res,
|
|
1165
|
+
"METHOD_NOT_ALLOWED",
|
|
1166
|
+
"Agent endpoints accept POST",
|
|
1167
|
+
405,
|
|
1168
|
+
void 0,
|
|
1169
|
+
requestId
|
|
1170
|
+
);
|
|
1171
|
+
logRequest({ method, url, status: 405, duration: Date.now() - start, requestId });
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
try {
|
|
1175
|
+
const mod = await loadModule(agent.filePath);
|
|
1176
|
+
const apiKey = resolveProvider().apiKey;
|
|
1177
|
+
const request = incomingMessageToWebRequest(req);
|
|
1178
|
+
const response = await mountAgent(mod, request, apiKey, agent.filePath, csrfMode);
|
|
1179
|
+
await writeWebResponseToServerResponse(response, res);
|
|
1180
|
+
} catch (err) {
|
|
1181
|
+
sendError(
|
|
1182
|
+
res,
|
|
1183
|
+
"INTERNAL",
|
|
1184
|
+
err instanceof Error ? err.message : "Agent handler failed",
|
|
1185
|
+
500,
|
|
1186
|
+
void 0,
|
|
1187
|
+
requestId
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
logRequest({ method, url, status: res.statusCode, duration: Date.now() - start, requestId });
|
|
1191
|
+
})();
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
|
|
977
1195
|
// src/vite-plugin/api-middleware.ts
|
|
978
1196
|
function shouldBypassApiMiddleware(url, prefixes) {
|
|
979
1197
|
if (!url.startsWith("/api/")) return true;
|
|
@@ -1303,6 +1521,7 @@ async function runConfigureServer(server, ctx) {
|
|
|
1303
1521
|
disallowed: ctx.disallowed
|
|
1304
1522
|
})
|
|
1305
1523
|
);
|
|
1524
|
+
server.middlewares.use(createAgentMiddleware(server, ctx.projectRoot, ctx.csrfMode));
|
|
1306
1525
|
const servicesProxyPrefixes = ctx.services && Object.keys(ctx.services).length > 0 ? Object.values(ctx.services).map((s) => s.proxy) : [];
|
|
1307
1526
|
const csrfReadinessStore = ctx.csrfReadinessStoreOverride ?? new CsrfReadinessStore();
|
|
1308
1527
|
server.middlewares.use(
|
|
@@ -1348,7 +1567,7 @@ async function runConfigureServer(server, ctx) {
|
|
|
1348
1567
|
server.watcher.on("unlink", handleRouteChange);
|
|
1349
1568
|
if (ctx.resolvedOpenApi !== void 0) {
|
|
1350
1569
|
const openApiCfg = ctx.resolvedOpenApi;
|
|
1351
|
-
const { reEmitOpenApi } = await import("./dev-emit-
|
|
1570
|
+
const { reEmitOpenApi } = await import("./dev-emit-QH2YGZXN.js");
|
|
1352
1571
|
const openApiServerDir = resolve6(ctx.projectRoot, "server");
|
|
1353
1572
|
const openApiDistDir = resolve6(ctx.projectRoot, ctx.resolvedDistDir);
|
|
1354
1573
|
const isRouteFileForOpenApi = (file) => file.startsWith(openApiServerDir) && /\.(ts|tsx|js|mjs)$/.test(file);
|
|
@@ -2334,17 +2553,26 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
2334
2553
|
})
|
|
2335
2554
|
);
|
|
2336
2555
|
}
|
|
2337
|
-
const { appTypedClientPlugin } = await import("./app-typed-client-
|
|
2556
|
+
const { appTypedClientPlugin } = await import("./app-typed-client-5VQE6DNF.js");
|
|
2338
2557
|
const appClientPlugin = appTypedClientPlugin({
|
|
2339
2558
|
cwd: projectRoot,
|
|
2340
2559
|
serverDir: resolve9(projectRoot, "server"),
|
|
2341
2560
|
distDir: resolve9(projectRoot, ".theokit")
|
|
2342
2561
|
});
|
|
2343
|
-
const { actionsVirtualModule } = await import("./actions-virtual-module-
|
|
2562
|
+
const { actionsVirtualModule } = await import("./actions-virtual-module-RM7JRY5N.js");
|
|
2344
2563
|
const actionsPlugin = actionsVirtualModule({
|
|
2345
2564
|
serverDir: resolve9(projectRoot, "server"),
|
|
2346
2565
|
distDir: resolve9(projectRoot, ".theokit")
|
|
2347
2566
|
});
|
|
2567
|
+
const { agentsTypedClientPlugin } = await import("./agents-typed-client-SAWAAH7K.js");
|
|
2568
|
+
const { generateManifest } = await import("./internal-api-5BDI6N5U.js");
|
|
2569
|
+
const agentsClientPlugin = agentsTypedClientPlugin({
|
|
2570
|
+
projectRoot,
|
|
2571
|
+
distDir: resolve9(projectRoot, ".theokit"),
|
|
2572
|
+
// Agents live at <projectRoot>/agents; generateManifest scans them via the server dir's
|
|
2573
|
+
// parent, which is projectRoot for the canonical layout.
|
|
2574
|
+
scanManifest: () => generateManifest(resolve9(projectRoot, "server"), projectRoot)
|
|
2575
|
+
});
|
|
2348
2576
|
const { serverRoutesHmrPlugin } = await import("./server-routes-hmr-PBHSKCQJ.js");
|
|
2349
2577
|
const routesHmrPlugin = serverRoutesHmrPlugin({
|
|
2350
2578
|
serverDir: resolve9(projectRoot, "server")
|
|
@@ -2355,6 +2583,7 @@ async function theoPluginAsync(rootOrOptions) {
|
|
|
2355
2583
|
...servicesPlugins,
|
|
2356
2584
|
appClientPlugin,
|
|
2357
2585
|
actionsPlugin,
|
|
2586
|
+
agentsClientPlugin,
|
|
2358
2587
|
routesHmrPlugin
|
|
2359
2588
|
];
|
|
2360
2589
|
}
|
|
@@ -2514,4 +2743,4 @@ export {
|
|
|
2514
2743
|
theoPluginAsync,
|
|
2515
2744
|
theoPlugin
|
|
2516
2745
|
};
|
|
2517
|
-
//# sourceMappingURL=chunk-
|
|
2746
|
+
//# sourceMappingURL=chunk-RBHCJHRR.js.map
|