theokit 0.18.0 → 0.19.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/agent-Y4W4X46A.js +15 -0
- package/dist/{build-5PSDDMFB.js → build-ESXLJKYY.js} +2 -2
- package/dist/{chunk-DEO2VAJE.js → chunk-7NTXG7SI.js} +6 -113
- package/dist/chunk-7NTXG7SI.js.map +1 -0
- package/dist/chunk-DMC6HYUR.js +141 -0
- package/dist/chunk-DMC6HYUR.js.map +1 -0
- package/dist/{chunk-XVFMSNDE.js → chunk-DXF64KS5.js} +8 -138
- package/dist/chunk-DXF64KS5.js.map +1 -0
- package/dist/{chunk-CC5WOQUV.js → chunk-ULFNEG27.js} +5 -3
- package/dist/{chunk-CC5WOQUV.js.map → chunk-ULFNEG27.js.map} +1 -1
- package/dist/{chunk-XWS4RZCE.js → chunk-W4YO6S4I.js} +110 -1
- package/dist/chunk-W4YO6S4I.js.map +1 -0
- package/dist/{agent-TZ5JZUJ7.js → chunk-ZYMFKYLM.js} +5 -4
- package/dist/{agent-TZ5JZUJ7.js.map → chunk-ZYMFKYLM.js.map} +1 -1
- package/dist/cli/index.js +16 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/{dev-A7NESJ7S.js → dev-D7PKQUL2.js} +4 -3
- package/dist/{dev-A7NESJ7S.js.map → dev-D7PKQUL2.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/mcp-3C4CMHP4.js +77 -0
- package/dist/mcp-3C4CMHP4.js.map +1 -0
- package/dist/server/index.d.ts +31 -1
- package/dist/server/index.js +30 -1
- package/dist/server/index.js.map +1 -1
- package/dist/{start-WGOKQEUW.js → start-5UDUXYKC.js} +3 -2
- package/dist/{start-WGOKQEUW.js.map → start-5UDUXYKC.js.map} +1 -1
- package/dist/vite-plugin/index.js +2 -2
- package/dist/{vite-plugin-DBS2USI4.js → vite-plugin-GXRWNESN.js} +4 -3
- package/dist/vite-plugin-GXRWNESN.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-DEO2VAJE.js.map +0 -1
- package/dist/chunk-XVFMSNDE.js.map +0 -1
- package/dist/chunk-XWS4RZCE.js.map +0 -1
- /package/dist/{vite-plugin-DBS2USI4.js.map → agent-Y4W4X46A.js.map} +0 -0
- /package/dist/{build-5PSDDMFB.js.map → build-ESXLJKYY.js.map} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "tsx/esm";
|
|
3
|
+
import {
|
|
4
|
+
agentCommand,
|
|
5
|
+
createAgentSsrLoader
|
|
6
|
+
} from "./chunk-ZYMFKYLM.js";
|
|
7
|
+
import "./chunk-M6NMS5LR.js";
|
|
8
|
+
import "./chunk-GDN3PXFH.js";
|
|
9
|
+
import "./chunk-34YQOXGM.js";
|
|
10
|
+
import "./chunk-P37RZRFV.js";
|
|
11
|
+
export {
|
|
12
|
+
agentCommand,
|
|
13
|
+
createAgentSsrLoader
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=agent-Y4W4X46A.js.map
|
|
@@ -531,7 +531,7 @@ async function buildCommand(options) {
|
|
|
531
531
|
`);
|
|
532
532
|
}
|
|
533
533
|
async function runAdapterBuild(target, config, cwd) {
|
|
534
|
-
const { theoPluginAsync } = await import("./vite-plugin-
|
|
534
|
+
const { theoPluginAsync } = await import("./vite-plugin-GXRWNESN.js");
|
|
535
535
|
const { default: react } = await import("@vitejs/plugin-react");
|
|
536
536
|
const ctx = {
|
|
537
537
|
// `react()` may return Plugin or Plugin[] depending on version; spread the
|
|
@@ -606,4 +606,4 @@ function relativize3(absPath, root) {
|
|
|
606
606
|
export {
|
|
607
607
|
buildCommand
|
|
608
608
|
};
|
|
609
|
-
//# sourceMappingURL=build-
|
|
609
|
+
//# sourceMappingURL=build-ESXLJKYY.js.map
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
broadcastToDevtools
|
|
7
7
|
} from "./chunk-7BIM27LV.js";
|
|
8
8
|
import {
|
|
9
|
-
buildResourceDescriptors,
|
|
10
9
|
extractAppResources,
|
|
10
|
+
handleMcpJsonRpc,
|
|
11
|
+
isMcpPath,
|
|
11
12
|
loadEnv,
|
|
12
|
-
readAppResource,
|
|
13
13
|
resolveTransformer
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-W4YO6S4I.js";
|
|
15
15
|
import {
|
|
16
16
|
findSuggestion
|
|
17
17
|
} from "./chunk-5QW7IQQU.js";
|
|
@@ -1151,116 +1151,9 @@ function handleListApprovals(registry2) {
|
|
|
1151
1151
|
});
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
1154
|
-
// src/server/agent/mcp-handler.ts
|
|
1155
|
-
import {
|
|
1156
|
-
buildMcpToolDescriptors,
|
|
1157
|
-
compileAgentModule as compileAgentModule2,
|
|
1158
|
-
mcpServerInfo
|
|
1159
|
-
} from "@theokit/agents";
|
|
1160
|
-
var MCP_PATH = /^\/api\/agents\/([^/]+)\/mcp$/;
|
|
1161
|
-
function isMcpPath(urlPath) {
|
|
1162
|
-
const match = MCP_PATH.exec(urlPath);
|
|
1163
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
1164
|
-
}
|
|
1165
|
-
function isJsonRpcRequest(body) {
|
|
1166
|
-
return typeof body === "object" && body !== null && body.jsonrpc === "2.0" && typeof body.method === "string";
|
|
1167
|
-
}
|
|
1168
|
-
function jsonResponse(payload) {
|
|
1169
|
-
return new Response(JSON.stringify(payload), {
|
|
1170
|
-
status: 200,
|
|
1171
|
-
headers: { "content-type": "application/json; charset=utf-8" }
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1174
|
-
function toEntry(name, mod) {
|
|
1175
|
-
const compiled = compileAgentModule2(mod, `mcp server for "${name}"`);
|
|
1176
|
-
return {
|
|
1177
|
-
name,
|
|
1178
|
-
route: `/api/agents/${name}`,
|
|
1179
|
-
stream: compiled.stream,
|
|
1180
|
-
mainLoop: { method: "", strategy: "" },
|
|
1181
|
-
guards: [],
|
|
1182
|
-
interceptors: [],
|
|
1183
|
-
tools: compiled.tools.map((t) => ({
|
|
1184
|
-
name: t.name,
|
|
1185
|
-
description: t.description,
|
|
1186
|
-
approval: false,
|
|
1187
|
-
trace: false,
|
|
1188
|
-
audit: false
|
|
1189
|
-
})),
|
|
1190
|
-
subAgents: []
|
|
1191
|
-
};
|
|
1192
|
-
}
|
|
1193
|
-
function handleMcpJsonRpc(mod, name, body, appResources = []) {
|
|
1194
|
-
if (!isJsonRpcRequest(body)) {
|
|
1195
|
-
return jsonResponse({
|
|
1196
|
-
jsonrpc: "2.0",
|
|
1197
|
-
id: null,
|
|
1198
|
-
error: { code: -32600, message: "Invalid Request" }
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
const { id, method, params } = body;
|
|
1202
|
-
try {
|
|
1203
|
-
const entry = toEntry(name, mod);
|
|
1204
|
-
if (method === "initialize") {
|
|
1205
|
-
const info = mcpServerInfo(entry);
|
|
1206
|
-
const capabilities = { tools: {} };
|
|
1207
|
-
if (appResources.length > 0) capabilities.resources = {};
|
|
1208
|
-
return jsonResponse({
|
|
1209
|
-
jsonrpc: "2.0",
|
|
1210
|
-
id,
|
|
1211
|
-
result: {
|
|
1212
|
-
protocolVersion: info.protocolVersion,
|
|
1213
|
-
capabilities,
|
|
1214
|
-
serverInfo: { name: info.name, version: info.version }
|
|
1215
|
-
}
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
if (method === "tools/list") {
|
|
1219
|
-
return jsonResponse({ jsonrpc: "2.0", id, result: { tools: buildMcpToolDescriptors(entry) } });
|
|
1220
|
-
}
|
|
1221
|
-
if (method === "resources/list") {
|
|
1222
|
-
return jsonResponse({
|
|
1223
|
-
jsonrpc: "2.0",
|
|
1224
|
-
id,
|
|
1225
|
-
result: { resources: buildResourceDescriptors(appResources) }
|
|
1226
|
-
});
|
|
1227
|
-
}
|
|
1228
|
-
if (method === "resources/read") {
|
|
1229
|
-
const uri = params?.uri;
|
|
1230
|
-
if (typeof uri !== "string") {
|
|
1231
|
-
return jsonResponse({
|
|
1232
|
-
jsonrpc: "2.0",
|
|
1233
|
-
id,
|
|
1234
|
-
error: { code: -32602, message: "resources/read requires a string `uri` param." }
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
const contents = readAppResource(appResources, uri);
|
|
1238
|
-
if (contents === null) {
|
|
1239
|
-
return jsonResponse({
|
|
1240
|
-
jsonrpc: "2.0",
|
|
1241
|
-
id,
|
|
1242
|
-
error: { code: -32602, message: `Resource not found: ${uri}` }
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
return jsonResponse({ jsonrpc: "2.0", id, result: contents });
|
|
1246
|
-
}
|
|
1247
|
-
return jsonResponse({
|
|
1248
|
-
jsonrpc: "2.0",
|
|
1249
|
-
id,
|
|
1250
|
-
error: { code: -32601, message: `Method not found: ${method}` }
|
|
1251
|
-
});
|
|
1252
|
-
} catch (err) {
|
|
1253
|
-
return jsonResponse({
|
|
1254
|
-
jsonrpc: "2.0",
|
|
1255
|
-
id,
|
|
1256
|
-
error: { code: -32603, message: err instanceof Error ? err.message : "Internal error" }
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
1154
|
// src/server/agent/mount-agent.ts
|
|
1262
1155
|
import {
|
|
1263
|
-
compileAgentModule as
|
|
1156
|
+
compileAgentModule as compileAgentModule2,
|
|
1264
1157
|
resolveEnabledSkills,
|
|
1265
1158
|
streamAgentUIMessages
|
|
1266
1159
|
} from "@theokit/agents";
|
|
@@ -1299,7 +1192,7 @@ async function mountAgent(mod, request, apiKey, source = "agent module", csrfMod
|
|
|
1299
1192
|
return jsonError2(403, "CSRF_FAILED", `CSRF check failed: ${csrf.reason}`);
|
|
1300
1193
|
}
|
|
1301
1194
|
}
|
|
1302
|
-
const compiled =
|
|
1195
|
+
const compiled = compileAgentModule2(mod, source);
|
|
1303
1196
|
if (compiled.skillsResolver) {
|
|
1304
1197
|
const enabled = await resolveEnabledSkills(compiled.skillsResolver, compiled.runContext ?? {});
|
|
1305
1198
|
if (enabled !== void 0) compiled.skills = { enabled, autoInject: true };
|
|
@@ -3165,4 +3058,4 @@ export {
|
|
|
3165
3058
|
theoPluginAsync,
|
|
3166
3059
|
theoPlugin
|
|
3167
3060
|
};
|
|
3168
|
-
//# sourceMappingURL=chunk-
|
|
3061
|
+
//# sourceMappingURL=chunk-7NTXG7SI.js.map
|