theokit 0.16.0 → 0.18.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-G4BANOLW.js +0 -0
- package/dist/add-W6FNTAFS.js +0 -0
- package/dist/{agent-BBK42EPJ.js → agent-TZ5JZUJ7.js} +3 -3
- package/dist/agents-typed-client-LQ36PCHL.js +0 -0
- package/dist/app-typed-client-Z6BHD4MF.js +0 -0
- package/dist/aws-lambda-7GSCNLPY.js +0 -0
- package/dist/body-parser-web-FV5HWCY3.js +0 -0
- package/dist/broadcast-LUMOJIJT.js +0 -0
- package/dist/{build-LZ4QSZ63.js → build-5PSDDMFB.js} +2 -2
- package/dist/build-request-body-preview-QMWD2IXK.js +0 -0
- package/dist/bun-KP2KES6S.js +0 -0
- package/dist/check-PD2FTKMM.js +0 -0
- package/dist/chunk-34YQOXGM.js +0 -0
- package/dist/chunk-45C3WUQ7.js +0 -0
- package/dist/chunk-567NA7Y6.js +0 -0
- package/dist/chunk-5ODOE6EF.js +0 -0
- package/dist/{chunk-7HBLJ5BU.js → chunk-CC5WOQUV.js} +69 -188
- package/dist/chunk-CC5WOQUV.js.map +1 -0
- package/dist/{chunk-AXVP326H.js → chunk-CWVBDUDC.js} +17 -3
- package/dist/chunk-CWVBDUDC.js.map +1 -0
- package/dist/{chunk-3HLO7KAK.js → chunk-DEO2VAJE.js} +163 -71
- package/dist/chunk-DEO2VAJE.js.map +1 -0
- package/dist/chunk-FOZIR3TG.js +0 -0
- package/dist/chunk-GBXLKYIA.js +0 -0
- package/dist/chunk-GDN3PXFH.js +0 -0
- package/dist/chunk-HGZL5EOI.js +0 -0
- package/dist/chunk-HNBWZKIQ.js +0 -0
- package/dist/chunk-IEES3CHD.js +0 -0
- package/dist/chunk-JAIKGP3Q.js +0 -0
- package/dist/chunk-JQSFBJR5.js +0 -0
- package/dist/chunk-KXA37ONC.js +0 -0
- package/dist/{chunk-FIZXWL73.js → chunk-M6NMS5LR.js} +8 -7
- package/dist/{chunk-FIZXWL73.js.map → chunk-M6NMS5LR.js.map} +1 -1
- package/dist/chunk-NXTF5PPW.js +0 -0
- package/dist/chunk-P37RZRFV.js +0 -0
- package/dist/chunk-WR4F4EEZ.js +0 -0
- package/dist/{chunk-Q6KPASBB.js → chunk-XVFMSNDE.js} +247 -7
- package/dist/chunk-XVFMSNDE.js.map +1 -0
- package/dist/{chunk-5UUOGAJH.js → chunk-XWS4RZCE.js} +47 -1
- package/dist/{chunk-5UUOGAJH.js.map → chunk-XWS4RZCE.js.map} +1 -1
- package/dist/chunk-YJAUJXZS.js +0 -0
- package/dist/cli/index.js +4 -4
- package/dist/client/index.d.ts +51 -1
- package/dist/client/index.js +43 -0
- package/dist/client/index.js.map +1 -1
- package/dist/cloudflare-C6E5SPAE.js +0 -0
- package/dist/configure-agent-registry-ZOBVU3MV.js +0 -0
- package/dist/db-3UNAMSFK.js +0 -0
- package/dist/deno-deploy-RFZN56X4.js +0 -0
- package/dist/{dev-P4GENSZK.js → dev-A7NESJ7S.js} +4 -4
- package/dist/dev-emit-VJ5CFMPY.js +0 -0
- package/dist/dispatcher-EJHL6JMJ.js +0 -0
- package/dist/docker-LZZB4D5E.js +0 -0
- package/dist/generate-OMKHQ7OM.js +0 -0
- package/dist/index.js +2 -2
- package/dist/info-7PE2PZJI.js +0 -0
- package/dist/internal-api-J27TYE2I.js +0 -0
- package/dist/load-config-JKYO5RFK.js +0 -0
- package/dist/netlify-PMLHVPN4.js +0 -0
- package/dist/node-BPJ3Z4DT.js +0 -0
- package/dist/openapi-MXMLZCXC.js +0 -0
- package/dist/registry-XJUYD2OU.js +0 -0
- package/dist/router-TLEAOFID.js +0 -0
- package/dist/routes-NNBEZSGN.js +0 -0
- package/dist/scan-7MJC6PYU.js +0 -0
- package/dist/schema-7CAY6IZR.js +0 -0
- package/dist/server/define/index.d.ts +29 -4
- package/dist/server/define/index.js +3 -1
- package/dist/server/index.d.ts +286 -4
- package/dist/server/index.js +234 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server-error-to-envelope-UUXDSLAZ.js +0 -0
- package/dist/server-routes-hmr-VZXOP5YT.js +0 -0
- package/dist/services-json-Y3XODNB5.js +0 -0
- package/dist/services-typed-client-32KMTTXR.js +0 -0
- package/dist/{start-4VPYN2OS.js → start-WGOKQEUW.js} +31 -7
- package/dist/start-WGOKQEUW.js.map +1 -0
- package/dist/static-7ARBVDJF.js +0 -0
- package/dist/storage-manager-ZSQFLEYT.js +0 -0
- package/dist/theo-cloud-DQRP6S6M.js +0 -0
- package/dist/upgrade-readiness-ACGW44JC.js +0 -0
- package/dist/vercel-J6G7ZHYQ.js +0 -0
- package/dist/vite-plugin/index.js +2 -2
- package/dist/{vite-plugin-23BBKL3F.js → vite-plugin-DBS2USI4.js} +4 -4
- package/package.json +11 -11
- package/LICENSE +0 -201
- package/dist/chunk-3HLO7KAK.js.map +0 -1
- package/dist/chunk-7HBLJ5BU.js.map +0 -1
- package/dist/chunk-AXVP326H.js.map +0 -1
- package/dist/chunk-Q6KPASBB.js.map +0 -1
- package/dist/start-4VPYN2OS.js.map +0 -1
- /package/dist/{agent-BBK42EPJ.js.map → agent-TZ5JZUJ7.js.map} +0 -0
- /package/dist/{build-LZ4QSZ63.js.map → build-5PSDDMFB.js.map} +0 -0
- /package/dist/{dev-P4GENSZK.js.map → dev-A7NESJ7S.js.map} +0 -0
- /package/dist/{vite-plugin-23BBKL3F.js.map → vite-plugin-DBS2USI4.js.map} +0 -0
|
File without changes
|
package/dist/add-W6FNTAFS.js
CHANGED
|
File without changes
|
|
@@ -3,7 +3,7 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
getApprovalRegistry,
|
|
5
5
|
resolveProvider
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-M6NMS5LR.js";
|
|
7
7
|
import {
|
|
8
8
|
loadEnv
|
|
9
9
|
} from "./chunk-GDN3PXFH.js";
|
|
@@ -178,7 +178,7 @@ 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-
|
|
181
|
+
const { theoPluginAsync } = await import("./vite-plugin-DBS2USI4.js");
|
|
182
182
|
const { loadConfig } = await import("./load-config-JKYO5RFK.js");
|
|
183
183
|
const config = await loadConfig(projectRoot);
|
|
184
184
|
const theoPlugins = await theoPluginAsync({
|
|
@@ -206,4 +206,4 @@ async function createAgentSsrLoader(projectRoot) {
|
|
|
206
206
|
export {
|
|
207
207
|
agentCommand
|
|
208
208
|
};
|
|
209
|
-
//# sourceMappingURL=agent-
|
|
209
|
+
//# sourceMappingURL=agent-TZ5JZUJ7.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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-DBS2USI4.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-5PSDDMFB.js.map
|
|
File without changes
|
package/dist/bun-KP2KES6S.js
CHANGED
|
File without changes
|
package/dist/check-PD2FTKMM.js
CHANGED
|
File without changes
|
package/dist/chunk-34YQOXGM.js
CHANGED
|
File without changes
|
package/dist/chunk-45C3WUQ7.js
CHANGED
|
File without changes
|
package/dist/chunk-567NA7Y6.js
CHANGED
|
File without changes
|
package/dist/chunk-5ODOE6EF.js
CHANGED
|
File without changes
|
|
@@ -3,15 +3,19 @@ import "tsx/esm";
|
|
|
3
3
|
import {
|
|
4
4
|
handleAgentApproval,
|
|
5
5
|
incomingMessageToWebRequest,
|
|
6
|
+
isAgentCardPath,
|
|
6
7
|
isApprovalPath,
|
|
8
|
+
isListApprovalsPath,
|
|
9
|
+
isMcpPath,
|
|
7
10
|
mountAgent,
|
|
8
11
|
resolveTransformer,
|
|
12
|
+
serveAgentAuxRoute,
|
|
9
13
|
writeWebResponseToServerResponse
|
|
10
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XVFMSNDE.js";
|
|
11
15
|
import {
|
|
12
16
|
getApprovalRegistry,
|
|
13
17
|
resolveProvider
|
|
14
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-M6NMS5LR.js";
|
|
15
19
|
import {
|
|
16
20
|
isRouteFile,
|
|
17
21
|
scanRoutes
|
|
@@ -392,178 +396,45 @@ function createActionMiddleware(vite, serverDir, options) {
|
|
|
392
396
|
|
|
393
397
|
// src/vite-plugin/agent-middleware.ts
|
|
394
398
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
395
|
-
|
|
396
|
-
// src/server/agent/agent-card-handler.ts
|
|
397
|
-
import {
|
|
398
|
-
buildAgentCard,
|
|
399
|
-
compileAgentModule
|
|
400
|
-
} from "@theokit/agents";
|
|
401
|
-
var WELL_KNOWN = /^\/\.well-known\/([^/]+)\/agent-card\.json$/;
|
|
402
|
-
function isAgentCardPath(urlPath) {
|
|
403
|
-
const match = WELL_KNOWN.exec(urlPath);
|
|
404
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
405
|
-
}
|
|
406
|
-
function toManifestEntry(name, route, mod) {
|
|
407
|
-
const compiled = compileAgentModule(mod, `agent card for "${name}"`);
|
|
408
|
-
return {
|
|
409
|
-
name,
|
|
410
|
-
route,
|
|
411
|
-
stream: compiled.stream,
|
|
412
|
-
mainLoop: { method: "", strategy: "" },
|
|
413
|
-
guards: [],
|
|
414
|
-
interceptors: [],
|
|
415
|
-
tools: compiled.tools.map((t) => ({
|
|
416
|
-
name: t.name,
|
|
417
|
-
description: t.description,
|
|
418
|
-
approval: false,
|
|
419
|
-
trace: false,
|
|
420
|
-
audit: false
|
|
421
|
-
})),
|
|
422
|
-
subAgents: []
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
function handleAgentCard(mod, name, route, baseUrl) {
|
|
426
|
-
try {
|
|
427
|
-
const card = buildAgentCard(toManifestEntry(name, route, mod), { baseUrl });
|
|
428
|
-
return new Response(JSON.stringify(card), {
|
|
429
|
-
status: 200,
|
|
430
|
-
headers: { "content-type": "application/json; charset=utf-8" }
|
|
431
|
-
});
|
|
432
|
-
} catch (err) {
|
|
433
|
-
return new Response(
|
|
434
|
-
JSON.stringify({ error: { code: "AGENT_CARD_FAILED", message: err instanceof Error ? err.message : "card build failed" } }),
|
|
435
|
-
{ status: 500, headers: { "content-type": "application/json; charset=utf-8" } }
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// src/server/agent/list-approvals-handler.ts
|
|
441
|
-
var LIST_PATH = /^\/api\/agents\/([^/]+)\/approvals$/;
|
|
442
|
-
function isListApprovalsPath(urlPath) {
|
|
443
|
-
const match = LIST_PATH.exec(urlPath);
|
|
444
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
445
|
-
}
|
|
446
|
-
function handleListApprovals(registry) {
|
|
447
|
-
return new Response(JSON.stringify({ approvals: registry.list() }), {
|
|
448
|
-
status: 200,
|
|
449
|
-
headers: { "content-type": "application/json; charset=utf-8" }
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// src/server/agent/mcp-handler.ts
|
|
454
|
-
import {
|
|
455
|
-
buildMcpToolDescriptors,
|
|
456
|
-
compileAgentModule as compileAgentModule2,
|
|
457
|
-
mcpServerInfo
|
|
458
|
-
} from "@theokit/agents";
|
|
459
|
-
var MCP_PATH = /^\/api\/agents\/([^/]+)\/mcp$/;
|
|
460
|
-
function isMcpPath(urlPath) {
|
|
461
|
-
const match = MCP_PATH.exec(urlPath);
|
|
462
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
463
|
-
}
|
|
464
|
-
function isJsonRpcRequest(body) {
|
|
465
|
-
return typeof body === "object" && body !== null && body.jsonrpc === "2.0" && typeof body.method === "string";
|
|
466
|
-
}
|
|
467
|
-
function jsonResponse(payload) {
|
|
468
|
-
return new Response(JSON.stringify(payload), {
|
|
469
|
-
status: 200,
|
|
470
|
-
headers: { "content-type": "application/json; charset=utf-8" }
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
function toEntry(name, mod) {
|
|
474
|
-
const compiled = compileAgentModule2(mod, `mcp server for "${name}"`);
|
|
475
|
-
return {
|
|
476
|
-
name,
|
|
477
|
-
route: `/api/agents/${name}`,
|
|
478
|
-
stream: compiled.stream,
|
|
479
|
-
mainLoop: { method: "", strategy: "" },
|
|
480
|
-
guards: [],
|
|
481
|
-
interceptors: [],
|
|
482
|
-
tools: compiled.tools.map((t) => ({
|
|
483
|
-
name: t.name,
|
|
484
|
-
description: t.description,
|
|
485
|
-
approval: false,
|
|
486
|
-
trace: false,
|
|
487
|
-
audit: false
|
|
488
|
-
})),
|
|
489
|
-
subAgents: []
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
function handleMcpJsonRpc(mod, name, body) {
|
|
493
|
-
if (!isJsonRpcRequest(body)) {
|
|
494
|
-
return jsonResponse({ jsonrpc: "2.0", id: null, error: { code: -32600, message: "Invalid Request" } });
|
|
495
|
-
}
|
|
496
|
-
const { id, method } = body;
|
|
497
|
-
try {
|
|
498
|
-
const entry = toEntry(name, mod);
|
|
499
|
-
if (method === "initialize") {
|
|
500
|
-
const info = mcpServerInfo(entry);
|
|
501
|
-
return jsonResponse({
|
|
502
|
-
jsonrpc: "2.0",
|
|
503
|
-
id,
|
|
504
|
-
result: {
|
|
505
|
-
protocolVersion: info.protocolVersion,
|
|
506
|
-
capabilities: { tools: {} },
|
|
507
|
-
serverInfo: { name: info.name, version: info.version }
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
if (method === "tools/list") {
|
|
512
|
-
return jsonResponse({ jsonrpc: "2.0", id, result: { tools: buildMcpToolDescriptors(entry) } });
|
|
513
|
-
}
|
|
514
|
-
return jsonResponse({ jsonrpc: "2.0", id, error: { code: -32601, message: `Method not found: ${method}` } });
|
|
515
|
-
} catch (err) {
|
|
516
|
-
return jsonResponse({
|
|
517
|
-
jsonrpc: "2.0",
|
|
518
|
-
id,
|
|
519
|
-
error: { code: -32603, message: err instanceof Error ? err.message : "Internal error" }
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
// src/vite-plugin/agent-middleware.ts
|
|
525
399
|
var PREFIX2 = "/api/agents/";
|
|
526
400
|
async function serveApprove(req, res, urlPath, csrfMode, log) {
|
|
527
401
|
const method = (req.method ?? "POST").toUpperCase();
|
|
528
402
|
if (method !== "POST") {
|
|
529
|
-
sendError(
|
|
530
|
-
|
|
403
|
+
sendError(
|
|
404
|
+
res,
|
|
405
|
+
"METHOD_NOT_ALLOWED",
|
|
406
|
+
"Approve endpoints accept POST",
|
|
407
|
+
405,
|
|
408
|
+
void 0,
|
|
409
|
+
log.requestId
|
|
410
|
+
);
|
|
411
|
+
logRequest({
|
|
412
|
+
method,
|
|
413
|
+
url: req.url ?? "",
|
|
414
|
+
status: 405,
|
|
415
|
+
duration: Date.now() - log.start,
|
|
416
|
+
requestId: log.requestId
|
|
417
|
+
});
|
|
531
418
|
return;
|
|
532
419
|
}
|
|
533
420
|
try {
|
|
534
|
-
const response = await handleAgentApproval(
|
|
421
|
+
const response = await handleAgentApproval(
|
|
422
|
+
incomingMessageToWebRequest(req),
|
|
423
|
+
urlPath,
|
|
424
|
+
getApprovalRegistry(),
|
|
425
|
+
csrfMode
|
|
426
|
+
);
|
|
535
427
|
await writeWebResponseToServerResponse(response, res);
|
|
536
428
|
} catch (err) {
|
|
537
|
-
sendError(
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
const method = (req.method ?? "POST").toUpperCase();
|
|
546
|
-
const agent = scanAgents(deps.projectRoot).find((a) => a.name === mcpAgentName);
|
|
547
|
-
if (method !== "POST" || !agent) {
|
|
548
|
-
next();
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
try {
|
|
552
|
-
const body = await incomingMessageToWebRequest(req).json();
|
|
553
|
-
const mod = await deps.loadModule(agent.filePath);
|
|
554
|
-
await writeWebResponseToServerResponse(handleMcpJsonRpc(mod, agent.name, body), res);
|
|
555
|
-
} catch (err) {
|
|
556
|
-
sendError(res, "INTERNAL", err instanceof Error ? err.message : "MCP handler failed", 500, void 0, requestId);
|
|
557
|
-
}
|
|
558
|
-
logRequest({ method, url: req.url ?? "", status: res.statusCode, duration: Date.now() - start, requestId });
|
|
559
|
-
}
|
|
560
|
-
async function serveListApprovals(req, res, next, log) {
|
|
561
|
-
const method = (req.method ?? "GET").toUpperCase();
|
|
562
|
-
if (method !== "GET") {
|
|
563
|
-
next();
|
|
564
|
-
return;
|
|
429
|
+
sendError(
|
|
430
|
+
res,
|
|
431
|
+
"INTERNAL",
|
|
432
|
+
err instanceof Error ? err.message : "Approve handler failed",
|
|
433
|
+
500,
|
|
434
|
+
void 0,
|
|
435
|
+
log.requestId
|
|
436
|
+
);
|
|
565
437
|
}
|
|
566
|
-
await writeWebResponseToServerResponse(handleListApprovals(getApprovalRegistry()), res);
|
|
567
438
|
logRequest({
|
|
568
439
|
method,
|
|
569
440
|
url: req.url ?? "",
|
|
@@ -572,33 +443,48 @@ async function serveListApprovals(req, res, next, log) {
|
|
|
572
443
|
requestId: log.requestId
|
|
573
444
|
});
|
|
574
445
|
}
|
|
575
|
-
async function
|
|
446
|
+
async function serveAux(req, res, next, urlPath, deps) {
|
|
576
447
|
const requestId = randomUUID2();
|
|
577
448
|
const start = Date.now();
|
|
578
|
-
res.setHeader("x-request-id", requestId);
|
|
579
|
-
const method = (req.method ?? "GET").toUpperCase();
|
|
580
|
-
const agent = scanAgents(deps.projectRoot).find((a) => a.name === cardAgentName);
|
|
581
|
-
if (method !== "GET" || !agent) {
|
|
582
|
-
next();
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
449
|
try {
|
|
586
|
-
const
|
|
587
|
-
const
|
|
588
|
-
|
|
450
|
+
const request = incomingMessageToWebRequest(req);
|
|
451
|
+
const response = await serveAgentAuxRoute(request, urlPath, {
|
|
452
|
+
agents: scanAgents(deps.projectRoot),
|
|
453
|
+
loadModule: deps.loadModule,
|
|
454
|
+
baseUrl: `http://${req.headers.host ?? "localhost"}`
|
|
455
|
+
});
|
|
456
|
+
if (response === null) {
|
|
457
|
+
next();
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
res.setHeader("x-request-id", requestId);
|
|
461
|
+
await writeWebResponseToServerResponse(response, res);
|
|
589
462
|
} catch (err) {
|
|
590
|
-
|
|
463
|
+
res.setHeader("x-request-id", requestId);
|
|
464
|
+
sendError(
|
|
465
|
+
res,
|
|
466
|
+
"INTERNAL",
|
|
467
|
+
err instanceof Error ? err.message : "Agent aux handler failed",
|
|
468
|
+
500,
|
|
469
|
+
void 0,
|
|
470
|
+
requestId
|
|
471
|
+
);
|
|
591
472
|
}
|
|
592
|
-
logRequest({
|
|
473
|
+
logRequest({
|
|
474
|
+
method: (req.method ?? "GET").toUpperCase(),
|
|
475
|
+
url: req.url ?? "",
|
|
476
|
+
status: res.statusCode,
|
|
477
|
+
duration: Date.now() - start,
|
|
478
|
+
requestId
|
|
479
|
+
});
|
|
593
480
|
}
|
|
594
481
|
function createAgentMiddleware(vite, projectRoot, csrfMode = "strict") {
|
|
595
482
|
const loadModule = createViteLoader(vite);
|
|
596
483
|
return (req, res, next) => {
|
|
597
484
|
void (async () => {
|
|
598
485
|
const url = req.url ?? "";
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
await serveAgentCard(req, res, next, cardAgentName, { projectRoot, loadModule });
|
|
486
|
+
if (isAgentCardPath(url.split("?")[0]) !== null) {
|
|
487
|
+
await serveAux(req, res, next, url.split("?")[0], { projectRoot, loadModule });
|
|
602
488
|
return;
|
|
603
489
|
}
|
|
604
490
|
if (!url.startsWith(PREFIX2)) {
|
|
@@ -613,13 +499,8 @@ function createAgentMiddleware(vite, projectRoot, csrfMode = "strict") {
|
|
|
613
499
|
await serveApprove(req, res, urlPath, csrfMode, { requestId, start });
|
|
614
500
|
return;
|
|
615
501
|
}
|
|
616
|
-
if (isListApprovalsPath(urlPath)) {
|
|
617
|
-
await
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
const mcpAgentName = isMcpPath(urlPath);
|
|
621
|
-
if (mcpAgentName) {
|
|
622
|
-
await serveMcp(req, res, next, mcpAgentName, { projectRoot, loadModule });
|
|
502
|
+
if (isListApprovalsPath(urlPath) !== null || isMcpPath(urlPath) !== null) {
|
|
503
|
+
await serveAux(req, res, next, urlPath, { projectRoot, loadModule });
|
|
623
504
|
return;
|
|
624
505
|
}
|
|
625
506
|
const agent = scanAgents(projectRoot).find((a) => a.agentPath === urlPath);
|
|
@@ -2204,4 +2085,4 @@ export {
|
|
|
2204
2085
|
theoPluginAsync,
|
|
2205
2086
|
theoPlugin
|
|
2206
2087
|
};
|
|
2207
|
-
//# sourceMappingURL=chunk-
|
|
2088
|
+
//# sourceMappingURL=chunk-CC5WOQUV.js.map
|