theokit 0.43.6 → 0.43.12
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/LICENSE +201 -0
- package/dist/{actions-virtual-module-N7GKUS3D.js → actions-virtual-module-HG66SZ7T.js} +8 -8
- package/dist/actions-virtual-module-HG66SZ7T.js.map +1 -0
- package/dist/{actions-virtual-module-LD3YKWIX.js → actions-virtual-module-RSFRPJQZ.js} +7 -7
- package/dist/actions-virtual-module-RSFRPJQZ.js.map +1 -0
- package/dist/{add-W6FNTAFS.js → add-3VLFUPF4.js} +1 -1
- package/dist/add-3VLFUPF4.js.map +1 -0
- package/dist/{agent-U35G3WNE.js → agent-OXRRKB55.js} +5 -5
- package/dist/{agents-typed-client-NJ73Z6XY.js → agents-typed-client-X56CQ6FX.js} +1 -1
- package/dist/agents-typed-client-X56CQ6FX.js.map +1 -0
- package/dist/{agents-typed-client-CHMVW7MK.js → agents-typed-client-ZP7BKJB3.js} +1 -1
- package/dist/agents-typed-client-ZP7BKJB3.js.map +1 -0
- package/dist/{app-typed-client-6YZRDAPY.js → app-typed-client-GDF2OMJ2.js} +8 -8
- package/dist/app-typed-client-GDF2OMJ2.js.map +1 -0
- package/dist/{app-typed-client-V77SVU2O.js → app-typed-client-USLAMN7X.js} +7 -7
- package/dist/app-typed-client-USLAMN7X.js.map +1 -0
- package/dist/{aws-lambda-7GSCNLPY.js → aws-lambda-473QCOL6.js} +3 -3
- package/dist/{body-parser-web-MUWBKZ3F.js → body-parser-web-NNEJGX6Y.js} +1 -1
- package/dist/body-parser-web-NNEJGX6Y.js.map +1 -0
- package/dist/{body-parser-web-FV5HWCY3.js → body-parser-web-TIOTXPDW.js} +1 -1
- package/dist/body-parser-web-TIOTXPDW.js.map +1 -0
- package/dist/broadcast-LUMOJIJT.js +0 -0
- package/dist/{build-BYLQZJT2.js → build-MQHIJROR.js} +11 -11
- package/dist/{build-BYLQZJT2.js.map → build-MQHIJROR.js.map} +1 -1
- package/dist/{build-request-body-preview-EOP2Y4F3.js → build-request-body-preview-FVBQ7LCE.js} +1 -1
- package/dist/build-request-body-preview-FVBQ7LCE.js.map +1 -0
- package/dist/{build-request-body-preview-QMWD2IXK.js → build-request-body-preview-XPZ2GYMG.js} +1 -1
- package/dist/build-request-body-preview-XPZ2GYMG.js.map +1 -0
- package/dist/{bun-KP2KES6S.js → bun-OQUCL3XW.js} +3 -3
- package/dist/{check-PD2FTKMM.js → check-45NKUVSQ.js} +1 -1
- package/dist/check-45NKUVSQ.js.map +1 -0
- package/dist/{chunk-FRUEDJFX.js → chunk-226KMIGZ.js} +3 -3
- package/dist/{chunk-FRUEDJFX.js.map → chunk-226KMIGZ.js.map} +1 -1
- package/dist/{chunk-U3NTEK46.js → chunk-26ECIX74.js} +2 -2
- package/dist/chunk-2CVV6CNN.js +0 -0
- package/dist/{chunk-FEDSPOY6.js → chunk-2WH6SD3C.js} +6 -6
- package/dist/chunk-2WH6SD3C.js.map +1 -0
- package/dist/{chunk-JAIKGP3Q.js → chunk-47VNWTL4.js} +1 -1
- package/dist/chunk-47VNWTL4.js.map +1 -0
- package/dist/{chunk-D7ZH7DTG.js → chunk-4B2ZMX45.js} +1 -1
- package/dist/chunk-4B2ZMX45.js.map +1 -0
- package/dist/{chunk-IHJZPQEF.js → chunk-4HAU7AJM.js} +3 -3
- package/dist/chunk-4HAU7AJM.js.map +1 -0
- package/dist/{chunk-IPC5UREF.js → chunk-575PAX5L.js} +17 -17
- package/dist/chunk-575PAX5L.js.map +1 -0
- package/dist/chunk-5ODOE6EF.js +0 -0
- package/dist/{chunk-X2VVCJ4V.js → chunk-65EFIUDD.js} +1 -1
- package/dist/chunk-65EFIUDD.js.map +1 -0
- package/dist/{chunk-GY5Q27BJ.js → chunk-6FK7FKY6.js} +1 -1
- package/dist/{chunk-GY5Q27BJ.js.map → chunk-6FK7FKY6.js.map} +1 -1
- package/dist/{chunk-GSO77FSM.js → chunk-6OXCZMW3.js} +45 -47
- package/dist/chunk-6OXCZMW3.js.map +1 -0
- package/dist/{chunk-P37RZRFV.js → chunk-A7JBF5FO.js} +1 -1
- package/dist/chunk-A7JBF5FO.js.map +1 -0
- package/dist/{chunk-AFVTEAES.js → chunk-CJNMJUHE.js} +2 -2
- package/dist/{chunk-AXVFVMLM.js → chunk-DJFMAWH5.js} +8 -4
- package/dist/chunk-DJFMAWH5.js.map +1 -0
- package/dist/{chunk-2ZX4J4SX.js → chunk-DQVBL2G4.js} +58 -56
- package/dist/chunk-DQVBL2G4.js.map +1 -0
- package/dist/{chunk-GW5H4KB4.js → chunk-FX72VHAE.js} +3 -3
- package/dist/chunk-GDN3PXFH.js +0 -0
- package/dist/chunk-GEQJAFSV.js +0 -0
- package/dist/{chunk-5AVPWHUE.js → chunk-HGUZWG2C.js} +7 -4
- package/dist/chunk-HGUZWG2C.js.map +1 -0
- package/dist/chunk-HGZL5EOI.js +0 -0
- package/dist/chunk-HNBWZKIQ.js +0 -0
- package/dist/{chunk-UNLG36Z5.js → chunk-IE6C4KZX.js} +10 -5
- package/dist/chunk-IE6C4KZX.js.map +1 -0
- package/dist/chunk-IEES3CHD.js +0 -0
- package/dist/{chunk-QWBXUZAX.js → chunk-JIL74SFK.js} +4 -4
- package/dist/chunk-JIL74SFK.js.map +1 -0
- package/dist/{chunk-KI7OWQUX.js → chunk-L2S2R3TI.js} +63 -20
- package/dist/chunk-L2S2R3TI.js.map +1 -0
- package/dist/{chunk-L4GCEMNW.js → chunk-LNVMHQ2Z.js} +2 -2
- package/dist/{chunk-SPJNVWOK.js → chunk-N2D5AVRR.js} +2 -3
- package/dist/chunk-N2D5AVRR.js.map +1 -0
- package/dist/{chunk-UO7WS32S.js → chunk-OI6DK6ZJ.js} +3 -3
- package/dist/chunk-OI6DK6ZJ.js.map +1 -0
- package/dist/{chunk-RMU7EBRO.js → chunk-OP7QCTR5.js} +2 -2
- package/dist/{chunk-RMU7EBRO.js.map → chunk-OP7QCTR5.js.map} +1 -1
- package/dist/{chunk-GUUWDMR2.js → chunk-OVHW23YC.js} +2 -2
- package/dist/{chunk-NQRNDPZJ.js → chunk-OXCALO3W.js} +3 -3
- package/dist/{chunk-45C3WUQ7.js → chunk-QPVXGC7O.js} +1 -1
- package/dist/chunk-QPVXGC7O.js.map +1 -0
- package/dist/{chunk-FOZIR3TG.js → chunk-SMP2T335.js} +2 -2
- package/dist/{chunk-M6NMS5LR.js → chunk-TDNNBLGW.js} +1 -1
- package/dist/chunk-TDNNBLGW.js.map +1 -0
- package/dist/{chunk-WFNLNIJX.js → chunk-VPISAMXU.js} +2 -2
- package/dist/{chunk-5PU65T5W.js → chunk-XZ6B2Y2R.js} +1 -1
- package/dist/chunk-XZ6B2Y2R.js.map +1 -0
- package/dist/cli/index.js +15 -15
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +20 -25
- package/dist/client/index.js.map +1 -1
- package/dist/{cloudflare-C6E5SPAE.js → cloudflare-4YT5CK3P.js} +3 -3
- package/dist/configure-agent-registry-ZOBVU3MV.js +0 -0
- package/dist/{controller-swc-transform-URELVCBM.js → controller-swc-transform-JJRMTSDY.js} +1 -1
- package/dist/controller-swc-transform-JJRMTSDY.js.map +1 -0
- package/dist/{controller-swc-transform-XV3ETSE3.js → controller-swc-transform-LUJ4VAZJ.js} +1 -1
- package/dist/controller-swc-transform-LUJ4VAZJ.js.map +1 -0
- package/dist/{db-3UNAMSFK.js → db-IVVCQE5Z.js} +1 -2
- package/dist/db-IVVCQE5Z.js.map +1 -0
- package/dist/{deno-deploy-RFZN56X4.js → deno-deploy-YYN6BNLF.js} +3 -3
- package/dist/{dev-PS2NGT6I.js → dev-WQ4LWCAW.js} +13 -13
- package/dist/{dev-emit-2DL3MCLM.js → dev-emit-HLGJK3PP.js} +3 -3
- package/dist/dev-emit-HLGJK3PP.js.map +1 -0
- package/dist/{dev-emit-XVTJXZGA.js → dev-emit-J7V6GWSK.js} +6 -6
- package/dist/devtools/entry.js +43 -15
- package/dist/devtools/entry.js.map +1 -1
- package/dist/{dispatcher-63LBXYLE.js → dispatcher-DLKIXYNO.js} +2 -2
- package/dist/{dispatcher-EJHL6JMJ.js → dispatcher-KMZBGMM5.js} +1 -1
- package/dist/dispatcher-KMZBGMM5.js.map +1 -0
- package/dist/docker-LZZB4D5E.js +0 -0
- package/dist/{generate-5X4LG77M.js → generate-GXWPUVS7.js} +4 -5
- package/dist/generate-GXWPUVS7.js.map +1 -0
- package/dist/index.js +9 -9
- package/dist/{info-2OOXFTJX.js → info-75U6GCMD.js} +4 -4
- package/dist/info-75U6GCMD.js.map +1 -0
- package/dist/{internal-api-LFW7R65K.js → internal-api-DV3H5NNV.js} +7 -9
- package/dist/{internal-api-FBFV265J.js → internal-api-JFORKYLR.js} +8 -10
- package/dist/{load-config-3EAQTXPH.js → load-config-XP7NSSA7.js} +4 -4
- package/dist/{mcp-ML4QK5ON.js → mcp-FF3NTCHB.js} +6 -6
- package/dist/mcp-FF3NTCHB.js.map +1 -0
- package/dist/{netlify-PMLHVPN4.js → netlify-2WZUQYI3.js} +3 -3
- package/dist/node-CMAYKDCM.js +10 -0
- package/dist/{openapi-2HVGJMSN.js → openapi-ZPXYRAM2.js} +9 -9
- package/dist/openapi-ZPXYRAM2.js.map +1 -0
- package/dist/registry-72YH7ZJM.js +23 -0
- package/dist/registry-72YH7ZJM.js.map +1 -0
- package/dist/{router-TLEAOFID.js → router-6MAACS25.js} +1 -2
- package/dist/router-6MAACS25.js.map +1 -0
- package/dist/{routes-XNS3UM3B.js → routes-ZVDKABXZ.js} +6 -6
- package/dist/scan-7MJC6PYU.js +0 -0
- package/dist/schema-FBOTN46F.js +22 -0
- package/dist/server/agent/index.js +1 -1
- package/dist/server/cost/index.js +1 -1
- package/dist/server/cron/index.js +2 -2
- package/dist/server/http/index.js +3 -3
- package/dist/server/index.js +11 -11
- package/dist/server/jobs/index.js +3 -3
- package/dist/server/observability/index.d.ts +1 -38
- package/dist/server/observability/index.js +2 -2
- package/dist/server/scan/index.js +2 -2
- package/dist/server-error-to-envelope-UUXDSLAZ.js +0 -0
- package/dist/{server-routes-hmr-VZXOP5YT.js → server-routes-hmr-4W5L2MKN.js} +1 -1
- package/dist/server-routes-hmr-4W5L2MKN.js.map +1 -0
- package/dist/{server-routes-hmr-PBHSKCQJ.js → server-routes-hmr-RI7SYNT2.js} +1 -1
- package/dist/server-routes-hmr-RI7SYNT2.js.map +1 -0
- package/dist/{services-json-Y3XODNB5.js → services-json-7ZXJ4CIS.js} +1 -1
- package/dist/services-json-7ZXJ4CIS.js.map +1 -0
- package/dist/{services-typed-client-IETY2SAK.js → services-typed-client-AU6DKXAO.js} +2 -2
- package/dist/services-typed-client-AU6DKXAO.js.map +1 -0
- package/dist/{services-typed-client-32KMTTXR.js → services-typed-client-EO4RFNTZ.js} +2 -2
- package/dist/services-typed-client-EO4RFNTZ.js.map +1 -0
- package/dist/{start-YLR2SFHU.js → start-2U3FUCJX.js} +12 -12
- package/dist/start-2U3FUCJX.js.map +1 -0
- package/dist/{static-MB2CD5Y3.js → static-25H5K42R.js} +3 -3
- package/dist/{static-MB2CD5Y3.js.map → static-25H5K42R.js.map} +1 -1
- package/dist/storage-manager-ZSQFLEYT.js +0 -0
- package/dist/{theo-cloud-DQRP6S6M.js → theo-cloud-JL2KXHIS.js} +2 -2
- package/dist/{upgrade-readiness-ACGW44JC.js → upgrade-readiness-77P6VNB4.js} +1 -1
- package/dist/upgrade-readiness-77P6VNB4.js.map +1 -0
- package/dist/{vercel-J6G7ZHYQ.js → vercel-FP3C6LN6.js} +3 -3
- package/dist/vite-plugin/index.js +9 -9
- package/dist/{vite-plugin-6VVU6PPC.js → vite-plugin-D2NTPZNC.js} +13 -13
- package/package.json +10 -13
- package/dist/actions-virtual-module-LD3YKWIX.js.map +0 -1
- package/dist/actions-virtual-module-N7GKUS3D.js.map +0 -1
- package/dist/add-W6FNTAFS.js.map +0 -1
- package/dist/agents-typed-client-CHMVW7MK.js.map +0 -1
- package/dist/agents-typed-client-NJ73Z6XY.js.map +0 -1
- package/dist/app-typed-client-6YZRDAPY.js.map +0 -1
- package/dist/app-typed-client-V77SVU2O.js.map +0 -1
- package/dist/body-parser-web-FV5HWCY3.js.map +0 -1
- package/dist/body-parser-web-MUWBKZ3F.js.map +0 -1
- package/dist/build-request-body-preview-EOP2Y4F3.js.map +0 -1
- package/dist/build-request-body-preview-QMWD2IXK.js.map +0 -1
- package/dist/check-PD2FTKMM.js.map +0 -1
- package/dist/chunk-2ZX4J4SX.js.map +0 -1
- package/dist/chunk-45C3WUQ7.js.map +0 -1
- package/dist/chunk-5AVPWHUE.js.map +0 -1
- package/dist/chunk-5PU65T5W.js.map +0 -1
- package/dist/chunk-AXVFVMLM.js.map +0 -1
- package/dist/chunk-D7ZH7DTG.js.map +0 -1
- package/dist/chunk-FEDSPOY6.js.map +0 -1
- package/dist/chunk-GSO77FSM.js.map +0 -1
- package/dist/chunk-IHJZPQEF.js.map +0 -1
- package/dist/chunk-IPC5UREF.js.map +0 -1
- package/dist/chunk-JAIKGP3Q.js.map +0 -1
- package/dist/chunk-KI7OWQUX.js.map +0 -1
- package/dist/chunk-M6NMS5LR.js.map +0 -1
- package/dist/chunk-P37RZRFV.js.map +0 -1
- package/dist/chunk-QWBXUZAX.js.map +0 -1
- package/dist/chunk-SPJNVWOK.js.map +0 -1
- package/dist/chunk-UNLG36Z5.js.map +0 -1
- package/dist/chunk-UO7WS32S.js.map +0 -1
- package/dist/chunk-X2VVCJ4V.js.map +0 -1
- package/dist/controller-swc-transform-URELVCBM.js.map +0 -1
- package/dist/controller-swc-transform-XV3ETSE3.js.map +0 -1
- package/dist/db-3UNAMSFK.js.map +0 -1
- package/dist/dev-emit-2DL3MCLM.js.map +0 -1
- package/dist/dispatcher-EJHL6JMJ.js.map +0 -1
- package/dist/generate-5X4LG77M.js.map +0 -1
- package/dist/info-2OOXFTJX.js.map +0 -1
- package/dist/mcp-ML4QK5ON.js.map +0 -1
- package/dist/node-BPJ3Z4DT.js +0 -10
- package/dist/openapi-2HVGJMSN.js.map +0 -1
- package/dist/registry-FKPH7XEL.js +0 -24
- package/dist/registry-FKPH7XEL.js.map +0 -1
- package/dist/router-TLEAOFID.js.map +0 -1
- package/dist/schema-LYOLNHZ7.js +0 -30
- package/dist/server-routes-hmr-PBHSKCQJ.js.map +0 -1
- package/dist/server-routes-hmr-VZXOP5YT.js.map +0 -1
- package/dist/services-json-Y3XODNB5.js.map +0 -1
- package/dist/services-typed-client-32KMTTXR.js.map +0 -1
- package/dist/services-typed-client-IETY2SAK.js.map +0 -1
- package/dist/start-YLR2SFHU.js.map +0 -1
- package/dist/upgrade-readiness-ACGW44JC.js.map +0 -1
- /package/dist/{agent-U35G3WNE.js.map → agent-OXRRKB55.js.map} +0 -0
- /package/dist/{aws-lambda-7GSCNLPY.js.map → aws-lambda-473QCOL6.js.map} +0 -0
- /package/dist/{bun-KP2KES6S.js.map → bun-OQUCL3XW.js.map} +0 -0
- /package/dist/{chunk-U3NTEK46.js.map → chunk-26ECIX74.js.map} +0 -0
- /package/dist/{chunk-AFVTEAES.js.map → chunk-CJNMJUHE.js.map} +0 -0
- /package/dist/{chunk-GW5H4KB4.js.map → chunk-FX72VHAE.js.map} +0 -0
- /package/dist/{chunk-L4GCEMNW.js.map → chunk-LNVMHQ2Z.js.map} +0 -0
- /package/dist/{chunk-GUUWDMR2.js.map → chunk-OVHW23YC.js.map} +0 -0
- /package/dist/{chunk-NQRNDPZJ.js.map → chunk-OXCALO3W.js.map} +0 -0
- /package/dist/{chunk-FOZIR3TG.js.map → chunk-SMP2T335.js.map} +0 -0
- /package/dist/{chunk-WFNLNIJX.js.map → chunk-VPISAMXU.js.map} +0 -0
- /package/dist/{cloudflare-C6E5SPAE.js.map → cloudflare-4YT5CK3P.js.map} +0 -0
- /package/dist/{deno-deploy-RFZN56X4.js.map → deno-deploy-YYN6BNLF.js.map} +0 -0
- /package/dist/{dev-PS2NGT6I.js.map → dev-WQ4LWCAW.js.map} +0 -0
- /package/dist/{dev-emit-XVTJXZGA.js.map → dev-emit-J7V6GWSK.js.map} +0 -0
- /package/dist/{dispatcher-63LBXYLE.js.map → dispatcher-DLKIXYNO.js.map} +0 -0
- /package/dist/{internal-api-FBFV265J.js.map → internal-api-DV3H5NNV.js.map} +0 -0
- /package/dist/{internal-api-LFW7R65K.js.map → internal-api-JFORKYLR.js.map} +0 -0
- /package/dist/{load-config-3EAQTXPH.js.map → load-config-XP7NSSA7.js.map} +0 -0
- /package/dist/{netlify-PMLHVPN4.js.map → netlify-2WZUQYI3.js.map} +0 -0
- /package/dist/{node-BPJ3Z4DT.js.map → node-CMAYKDCM.js.map} +0 -0
- /package/dist/{routes-XNS3UM3B.js.map → routes-ZVDKABXZ.js.map} +0 -0
- /package/dist/{schema-LYOLNHZ7.js.map → schema-FBOTN46F.js.map} +0 -0
- /package/dist/{theo-cloud-DQRP6S6M.js.map → theo-cloud-JL2KXHIS.js.map} +0 -0
- /package/dist/{vercel-J6G7ZHYQ.js.map → vercel-FP3C6LN6.js.map} +0 -0
- /package/dist/{vite-plugin-6VVU6PPC.js.map → vite-plugin-D2NTPZNC.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isZodLike
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JIL74SFK.js";
|
|
4
4
|
import {
|
|
5
5
|
validateCsrfRequest
|
|
6
6
|
} from "./chunk-TSLSIRBR.js";
|
|
@@ -215,7 +215,7 @@ async function parseBodyInline(request) {
|
|
|
215
215
|
}
|
|
216
216
|
async function parseBodyFull(request) {
|
|
217
217
|
if (request.method === "GET" || request.method === "HEAD") return void 0;
|
|
218
|
-
const { parseWebRequestBody } = await import("./body-parser-web-
|
|
218
|
+
const { parseWebRequestBody } = await import("./body-parser-web-NNEJGX6Y.js");
|
|
219
219
|
try {
|
|
220
220
|
const parsed = await parseWebRequestBody(request);
|
|
221
221
|
if (parsed.json === void 0 && Object.keys(parsed.fields).length === 0 && parsed.files.length === 0) {
|
|
@@ -454,4 +454,4 @@ export {
|
|
|
454
454
|
validateRouteInput,
|
|
455
455
|
executeWebRequest
|
|
456
456
|
};
|
|
457
|
-
//# sourceMappingURL=chunk-
|
|
457
|
+
//# sourceMappingURL=chunk-FX72VHAE.js.map
|
package/dist/chunk-GDN3PXFH.js
CHANGED
|
File without changes
|
package/dist/chunk-GEQJAFSV.js
CHANGED
|
File without changes
|
|
@@ -35,7 +35,6 @@ function createWorkflowTool(workflow, config) {
|
|
|
35
35
|
// src/server/agent/acp-tool.ts
|
|
36
36
|
import { spawn } from "child_process";
|
|
37
37
|
import { AcpClient } from "@theokit/agents";
|
|
38
|
-
import { encodeAcpMessage } from "@theokit/agents";
|
|
39
38
|
var NodeAcpTransport = class {
|
|
40
39
|
// stdin=pipe, stdout=pipe, stderr=inherit → the third stream is null.
|
|
41
40
|
proc;
|
|
@@ -59,7 +58,9 @@ function defaultTransport(config) {
|
|
|
59
58
|
}
|
|
60
59
|
function createACPTool(config) {
|
|
61
60
|
if (typeof config.onPermissionRequest !== "function") {
|
|
62
|
-
throw new Error(
|
|
61
|
+
throw new Error(
|
|
62
|
+
"[theokit] createACPTool requires onPermissionRequest (security by default \u2014 no default-allow)"
|
|
63
|
+
);
|
|
63
64
|
}
|
|
64
65
|
const makeTransport = config.transportFactory ?? defaultTransport;
|
|
65
66
|
return {
|
|
@@ -67,7 +68,9 @@ function createACPTool(config) {
|
|
|
67
68
|
description: config.description,
|
|
68
69
|
inputSchema: {
|
|
69
70
|
type: "object",
|
|
70
|
-
properties: {
|
|
71
|
+
properties: {
|
|
72
|
+
message: { type: "string", description: "The task/prompt for the coding agent." }
|
|
73
|
+
},
|
|
71
74
|
required: ["message"]
|
|
72
75
|
},
|
|
73
76
|
handler: async (input) => {
|
|
@@ -325,4 +328,4 @@ export {
|
|
|
325
328
|
handleMcpStdioLine,
|
|
326
329
|
serveMcpStdio
|
|
327
330
|
};
|
|
328
|
-
//# sourceMappingURL=chunk-
|
|
331
|
+
//# sourceMappingURL=chunk-HGUZWG2C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/agent/workflow-tool.ts","../src/server/agent/acp-tool.ts","../src/server/agent/vendor-agent-tool.ts","../src/server/agent/code-mode.ts","../src/server/agent/channel-webhook.ts","../src/server/agent/stream-agent-turn-in-process.ts","../src/server/agent/mcp-stdio.ts"],"sourcesContent":["/**\n * M26 (ADR-0041) — `createWorkflowTool`: wrap an SDK `Workflow` as a `CustomTool`.\n *\n * THIN adapter. `packages/workflows/` stays G13-forbidden — the workflow ENGINE is the SDK's\n * (`Workflow.create(...).run(input)`). This exposes an already-built `Workflow` to an agent as one\n * callable tool: it validates the tool input, delegates to `workflow.run(input)`, and shapes the\n * result for the model. It calls no LLM, dispatches no tool, and runs no orchestration of its own —\n * the SDK owns all of that (sdk-runtime.md / G2).\n */\nimport { z } from 'zod'\n\nimport { defineAgentTool, type CustomTool } from '../define/define-agent-tool.js'\n\n/**\n * Structural stand-in for the SDK `Workflow` (the adapter never imports the SDK type — keeps the\n * SDK an optional peer). Any object with a `run(input)` resolving to `{ status, output }` matches.\n */\nexport interface WorkflowLike {\n run(input: unknown): Promise<{ status: string; output: unknown; runId?: string }>\n}\n\n/** Config for {@link createWorkflowTool}. `inputSchema` defaults to an open object. */\nexport interface WorkflowToolConfig {\n /** Tool name surfaced to the LLM. */\n name: string\n /** Tool description surfaced to the LLM. */\n description: string\n /** Zod schema for the workflow input (defaults to `z.object({}).passthrough()`). */\n inputSchema?: z.ZodType\n}\n\n/** Statuses `Workflow.run` reports as a non-success terminal state. */\nconst FAILURE_STATUSES = new Set(['failed', 'error', 'cancelled', 'canceled'])\n\n/**\n * Wrap an SDK `Workflow` as a {@link CustomTool}. Fails fast if `workflow` does not expose a\n * `run()` method (the SDK Workflow contract), so a mis-wired call is caught at definition time, not\n * at the first invocation (error-handling.md).\n */\nexport function createWorkflowTool(workflow: WorkflowLike, config: WorkflowToolConfig): CustomTool {\n const runFn = (workflow as { run?: unknown } | null | undefined)?.run\n if (typeof runFn !== 'function') {\n throw new Error(\n 'createWorkflowTool: the SDK does not expose a Workflow (expected an object with a run() method). ' +\n 'Pass a `Workflow.create(...).…build()` instance from @theokit/sdk.',\n )\n }\n // Open object by default so arbitrary workflow inputs pass through un-stripped.\n const inputSchema = config.inputSchema ?? z.looseObject({})\n\n return defineAgentTool({\n name: config.name,\n description: config.description,\n inputSchema: inputSchema as z.ZodObject<z.ZodRawShape>,\n handler: async (input: unknown): Promise<string> => {\n const run = await workflow.run(input)\n if (FAILURE_STATUSES.has(run.status)) {\n throw new Error(\n `createWorkflowTool(${JSON.stringify(config.name)}): workflow run ${\n run.runId ? `'${run.runId}' ` : ''\n }failed with status '${run.status}'.`,\n )\n }\n return typeof run.output === 'string' ? run.output : JSON.stringify(run.output)\n },\n })\n}\n","/**\n * M17 (theokit-ai-first) — createACPTool: wrap a coding agent (Claude Code, Amp, Codex) as a tool.\n *\n * Spawns the agent as a subprocess (Node `child_process` — an adapter concern per G8), drives it\n * with the transport-agnostic {@link AcpClient} over newline-delimited JSON-RPC, and returns a\n * `CustomTool`. `onPermissionRequest` is REQUIRED — security by default (no default-allow for file/\n * shell operations). The transport is injectable for tests.\n */\nimport { spawn, type ChildProcessByStdio } from 'node:child_process'\nimport type { Readable, Writable } from 'node:stream'\n\nimport { AcpClient, type AcpTransport } from '@theokit/agents'\nimport type { CustomTool } from '@theokit/sdk'\n\n/** Stdio transport backed by a spawned subprocess (the default for {@link createACPTool}). */\nexport class NodeAcpTransport implements AcpTransport {\n // stdin=pipe, stdout=pipe, stderr=inherit → the third stream is null.\n private readonly proc: ChildProcessByStdio<Writable, Readable, null>\n\n constructor(command: string, args: string[] = [], cwd?: string) {\n this.proc = spawn(command, args, { cwd, stdio: ['pipe', 'pipe', 'inherit'] })\n }\n\n send(line: string): void {\n this.proc.stdin.write(line)\n }\n\n subscribe(onData: (chunk: string) => void): void {\n this.proc.stdout.on('data', (buf: Buffer) => {\n onData(buf.toString('utf8'))\n })\n }\n\n close(): void {\n this.proc.kill()\n }\n}\n\nexport interface AcpToolConfig {\n /** Executable for the coding agent (e.g. `claude`, `amp`, `codex`). */\n command: string\n /** Command-line arguments. */\n args?: string[]\n /** Working directory for the spawned agent. */\n cwd?: string\n /** Tool name the model calls. */\n name: string\n /** Tool description surfaced to the model. */\n description: string\n /**\n * REQUIRED — decide file/shell permission requests from the coding agent. Security by default:\n * there is NO default-allow. Return `{ granted: boolean }` (may be async).\n */\n onPermissionRequest: (params: unknown) => { granted: boolean } | Promise<{ granted: boolean }>\n /** Injected transport factory (defaults to spawning via {@link NodeAcpTransport}) — for tests. */\n transportFactory?: (config: AcpToolConfig) => AcpTransport\n}\n\nfunction defaultTransport(config: AcpToolConfig): AcpTransport {\n return new NodeAcpTransport(config.command, config.args, config.cwd)\n}\n\n/** Wrap a coding agent as a `CustomTool`. Fails fast if `onPermissionRequest` is missing. */\nexport function createACPTool(config: AcpToolConfig): CustomTool {\n if (typeof config.onPermissionRequest !== 'function') {\n throw new Error(\n '[theokit] createACPTool requires onPermissionRequest (security by default — no default-allow)',\n )\n }\n const makeTransport = config.transportFactory ?? defaultTransport\n return {\n name: config.name,\n description: config.description,\n inputSchema: {\n type: 'object',\n properties: {\n message: { type: 'string', description: 'The task/prompt for the coding agent.' },\n },\n required: ['message'],\n },\n handler: async (input: Record<string, unknown>): Promise<string> => {\n const message = typeof input.message === 'string' ? input.message : ''\n const client = new AcpClient(makeTransport(config))\n client.onRequest('session/request_permission', (params) => config.onPermissionRequest(params))\n const result = (await client.request('session/prompt', { message })) as { text?: string }\n return result.text ?? ''\n },\n }\n}\n\n// M56: the `encodeAcpMessage` re-export had no consumer — callers building custom transports\n// import it from `@theokit/agents` directly, which is where it is defined.\n","/**\n * M28 (ADR-0041) — `createVendorAgentTool`: expose a third-party agent SDK (Claude Agent SDK,\n * OpenAI, Cursor) behind a uniform `CustomTool`, mirroring the M17 ACP pattern.\n *\n * The vendor RUNTIME stays theirs — TheoKit only wires. The vendor client is INJECTED (the real\n * vendor SDK client in prod, a fake in tests), so no vendor dependency enters core; vendor-specific\n * client packages belong under `@theokit/agent-*`, never here. This calls no LLM of its own and runs\n * no loop — it delegates each prompt to `client.query(...)` (sdk-runtime.md / G2). Resume is threaded\n * via the vendor's own session id.\n */\nimport type { CustomTool } from '../define/define-agent-tool.js'\n\n/**\n * Structural contract a vendor agent client must satisfy (the adapter never imports a vendor type).\n * `query` runs one turn; `resumeSessionId` continues a prior vendor session; the returned\n * `sessionId` identifies the session to resume next.\n */\nexport interface VendorAgentClient {\n query(\n prompt: string,\n opts?: { resumeSessionId?: string },\n ): Promise<{ text: string; sessionId?: string }>\n}\n\n/** Config for {@link createVendorAgentTool}. */\nexport interface VendorAgentToolConfig {\n /** Vendor label (e.g. `claude`, `openai`, `cursor`). Drives the default tool name. */\n vendor: string\n /** The injected vendor client (real SDK client in prod, a fake in tests). */\n client: VendorAgentClient\n /** Tool name the model calls (defaults to `<vendor>_agent`). */\n name?: string\n /** Tool description surfaced to the model (defaults to a one-line delegate hint). */\n description?: string\n /**\n * Side-channel callback invoked with the vendor session id after each turn — lets the app capture\n * it for a later resume WITHOUT leaking session bookkeeping into the model's view of the result.\n */\n onSession?: (sessionId: string) => void\n}\n\n/**\n * Wrap a vendor agent SDK as a {@link CustomTool}. Fails fast if `vendor` is empty or the client\n * does not expose `query()` (error-handling.md) — a mis-wired call is caught at definition time.\n */\nexport function createVendorAgentTool(config: VendorAgentToolConfig): CustomTool {\n if (!config.vendor || config.vendor.length === 0) {\n throw new Error('createVendorAgentTool: `vendor` is required (e.g. \"claude\", \"openai\").')\n }\n const queryFn = (config.client as { query?: unknown } | null | undefined)?.query\n if (typeof queryFn !== 'function') {\n throw new Error(\n `createVendorAgentTool(${JSON.stringify(config.vendor)}): the vendor client does not expose a query() method. ` +\n 'Pass the vendor SDK client (or a @theokit/agent-* wrapper).',\n )\n }\n\n const name = config.name ?? `${config.vendor}_agent`\n const description =\n config.description ?? `Delegate a task to the ${config.vendor} agent and return its answer.`\n\n return {\n name,\n description,\n inputSchema: {\n type: 'object',\n properties: {\n prompt: { type: 'string', description: 'The task/prompt for the vendor agent.' },\n resumeSessionId: {\n type: 'string',\n description: 'Optional vendor session id to resume a prior conversation.',\n },\n },\n required: ['prompt'],\n },\n handler: async (input: Record<string, unknown>): Promise<string> => {\n const prompt = typeof input.prompt === 'string' ? input.prompt : ''\n const resumeSessionId =\n typeof input.resumeSessionId === 'string' ? input.resumeSessionId : undefined\n const result = await config.client.query(\n prompt,\n resumeSessionId !== undefined ? { resumeSessionId } : undefined,\n )\n if (result.sessionId !== undefined && config.onSession) config.onSession(result.sessionId)\n return result.text\n },\n }\n}\n","/**\n * M29 (ADR-0041) — `createCodeMode`: expose a set of tools to agent-authored code run inside an\n * ISOLATION boundary, so the agent composes tools programmatically instead of one call at a time.\n *\n * Security posture (the whole point of this feature):\n * - The isolation boundary (`sandbox`) is **injected**, never hand-rolled here (Top-risk 1). The app\n * supplies a vetted sandbox — isolated-vm, QuickJS-WASM, or a locked-down worker. TheoKit core\n * ships no VM and adds no sandbox dependency (same posture as the injected deploy adapter / the\n * M17 transport). `node:vm` is NOT a security boundary and MUST NOT be used as the sandbox.\n * - TheoKit owns the **restricted API** (only the declared tools are reachable from the code — no\n * `fs`, `process`, `require`, or network unless a declared, permission-gated tool provides it) and\n * the **mandatory permission gate**: every tool call from the code passes `onPermissionRequest`\n * first, and there is NO default-allow (mirrors M17 `onPermissionRequest`).\n *\n * Threat model (summary): a malicious model could author code that (a) calls a dangerous tool, or\n * (b) tries to reach a host capability. (a) is stopped by the permission gate (deny → the API call\n * throws). (b) is stopped by the injected sandbox (the restricted API is the ONLY surface the code\n * sees). If the app injects a weak sandbox, (b) is on the app — hence the vetted-sandbox requirement.\n */\nimport type { CustomTool } from '../define/define-agent-tool.js'\n\n/** The restricted API handed to sandboxed code: declared tool names → permission-gated callables. */\nexport type CodeModeApi = Record<string, (args: unknown) => Promise<unknown>>\n\n/** The injected isolation boundary. The app supplies a vetted implementation. */\nexport interface Sandbox {\n /** Run `code` with access to ONLY `api` (the restricted tool surface). Resolve the code's result. */\n run(code: string, api: CodeModeApi): Promise<unknown>\n}\n\n/** A permission decision for one tool call from sandboxed code. */\nexport interface CodeModePermission {\n granted: boolean\n /** Optional reason surfaced to the model on denial. */\n reason?: string\n}\n\nexport interface CodeModeConfig {\n /** The tools reachable from the code (the restricted API). */\n tools: CustomTool[]\n /** The injected isolation boundary (vetted sandbox — NEVER node:vm). */\n sandbox: Sandbox\n /**\n * REQUIRED — decide each tool call the code attempts. Security by default: NO default-allow.\n * Return `{ granted }` (may be async). Mirrors M17 `onPermissionRequest`.\n */\n onPermissionRequest: (req: {\n tool: string\n args: unknown\n }) => CodeModePermission | Promise<CodeModePermission>\n /** Tool name the model calls (default `run_code`). */\n name?: string\n /** Tool description surfaced to the model. */\n description?: string\n}\n\n/** Thrown when the permission gate denies a tool call from sandboxed code. */\nexport class CodeModePermissionDeniedError extends Error {\n constructor(tool: string, reason?: string) {\n const suffix = reason ? `: ${reason}` : ''\n super(`code-mode: tool '${tool}' denied by permission gate${suffix}`)\n this.name = 'CodeModePermissionDeniedError'\n }\n}\n\n/** M40 (ADR-0049) — render a tool's JSON-Schema input as a readable arg shape, e.g. `{ limit: number, region?: string }`. */\nfunction describeToolInput(inputSchema: Record<string, unknown>): string {\n const props = (inputSchema.properties as Record<string, { type?: unknown }> | undefined) ?? {}\n const required = new Set((inputSchema.required as string[] | undefined) ?? [])\n const entries = Object.entries(props).map(([key, spec]) => {\n // Complex Zod types (union/intersection/enum) may emit no top-level `type` → 'unknown' (safe).\n const type = typeof spec.type === 'string' ? spec.type : 'unknown'\n return `${key}${required.has(key) ? '' : '?'}: ${type}`\n })\n return entries.length > 0 ? `{ ${entries.join(', ')} }` : '{}'\n}\n\n/**\n * M40 (ADR-0049) — generate the model-facing instructions from the SAME `tools` allow-list\n * `createCodeMode` captures (DRY — cannot drift from the api surface it describes). Teaches the model\n * that its code runs in a sandbox, the available `api.<name>(input)` calls (ONLY this allow-list —\n * least-privilege scoping), and the return contract. Add it to the agent's system prompt.\n */\nfunction generateCodeModeInstructions(tools: CustomTool[], toolName: string): string {\n const calls = tools\n .map((t) => `- \\`await api.${t.name}(${describeToolInput(t.inputSchema)})\\` — ${t.description}`)\n .join('\\n')\n return [\n `The \\`${toolName}\\` tool runs your code in a sandbox. Your code may call ONLY these functions (each bridges to a real, validated tool on the host):`,\n calls,\n 'Write an async function body that composes these calls and return exactly ONE structured result. Prefer `Promise.all` for independent calls; do arithmetic and aggregation in code, not in prose.',\n ].join('\\n\\n')\n}\n\n/**\n * Build a code-mode tool + its generated model instructions (M40 / ADR-0049). Fails fast if\n * `onPermissionRequest` or `sandbox` is missing (security by default). `tool` takes `{ code }`,\n * assembles the permission-gated restricted API from `tools`, runs the code in the injected sandbox,\n * and returns the code's result. `instructions` (add it to the agent's system prompt) teaches the\n * model the sandboxed-code contract + the available `api.<name>(input)` calls.\n */\nexport function createCodeMode(config: CodeModeConfig): { tool: CustomTool; instructions: string } {\n if (typeof config.onPermissionRequest !== 'function') {\n throw new Error(\n 'createCodeMode requires onPermissionRequest (security by default — no default-allow for any tool).',\n )\n }\n const sandboxRun = (config.sandbox as { run?: unknown } | null | undefined)?.run\n if (typeof sandboxRun !== 'function') {\n throw new Error(\n 'createCodeMode requires an injected `sandbox` with a run() method (a vetted isolation boundary — never node:vm).',\n )\n }\n // M40 — an empty allow-list is a config mistake: the restricted API (and the generated\n // instructions) would be empty, and the code could call nothing. Fail fast.\n if (config.tools.length === 0) {\n throw new Error(\n 'createCodeMode requires a non-empty tools[] — the restricted API would be empty.',\n )\n }\n\n // Assemble the restricted API: each declared tool becomes a permission-gated callable.\n const api: CodeModeApi = {}\n for (const tool of config.tools) {\n api[tool.name] = async (args: unknown): Promise<unknown> => {\n const decision = await config.onPermissionRequest({ tool: tool.name, args })\n if (!decision.granted) throw new CodeModePermissionDeniedError(tool.name, decision.reason)\n return tool.handler(args as Record<string, unknown>)\n }\n }\n\n const name = config.name ?? 'run_code'\n const tool: CustomTool = {\n name,\n description:\n config.description ??\n 'Run code that composes the available tools. Only the declared tools are callable.',\n inputSchema: {\n type: 'object',\n properties: { code: { type: 'string', description: 'The code to run in the sandbox.' } },\n required: ['code'],\n },\n handler: async (input: Record<string, unknown>): Promise<string> => {\n const code = typeof input.code === 'string' ? input.code : ''\n const result = await config.sandbox.run(code, api)\n return typeof result === 'string' ? result : JSON.stringify(result)\n },\n }\n return { tool, instructions: generateCodeModeInstructions(config.tools, name) }\n}\n","/**\n * M27 (ADR-0041) — channel webhook routes: `POST /api/agents/<name>/channels/<platform>/webhook`.\n *\n * Auto-generates a per-platform inbound webhook endpoint that VALIDATES the platform signature\n * (reusing the existing webhook `VerifyFn` providers — Slack/Telegram/Discord — never a hand-rolled\n * scheme) and hands the parsed payload to an injected `onMessage` seam. The seam is where an app\n * wires the SDK gateway package (`@theokit/gateway-*`) that translates the payload into an agent\n * turn — TheoKit provides the route + signature gate, NOT the gateway's parsing (G2 / it does not\n * reimplement the gateway).\n */\nimport type { VerifyFn } from '../webhook/webhook-types.js'\n\nconst CHANNEL_PATH = /^\\/api\\/agents\\/([^/]+)\\/channels\\/([^/]+)\\/webhook$/\n\n/** Parsed `{ agent, platform }` from a channel webhook path, or `null` when it doesn't match. */\nexport function parseChannelPath(urlPath: string): { agent: string; platform: string } | null {\n const match = CHANNEL_PATH.exec(urlPath)\n if (!match) return null\n return { agent: decodeURIComponent(match[1]), platform: decodeURIComponent(match[2]) }\n}\n\n/** True when `urlPath` targets a channel webhook (dev/prod routing branches on this). */\nexport function isChannelPath(urlPath: string): boolean {\n return CHANNEL_PATH.test(urlPath)\n}\n\n/** The inbound message handed to the app after signature validation passes. */\nexport interface ChannelMessage {\n agent: string\n platform: string\n /** The parsed JSON payload from the platform (the gateway translates this to an agent turn). */\n payload: unknown\n}\n\nexport interface ChannelWebhookConfig {\n /** Per-platform signature validators (e.g. `{ slack: slack({...}), telegram: telegram({...}) }`). */\n validators: Record<string, VerifyFn>\n /** Handoff seam — wire the SDK gateway / agent here. Invoked only after signature validation. */\n onMessage: (message: ChannelMessage) => void | Promise<void>\n}\n\nfunction jsonError(status: number, code: string, message: string): Response {\n return new Response(JSON.stringify({ error: { code, message } }), {\n status,\n headers: { 'content-type': 'application/json' },\n })\n}\n\n/**\n * Handle one channel webhook request. Returns:\n * 404 UNKNOWN_PLATFORM — no validator configured for `<platform>`\n * 400 BAD_REQUEST — path is not a channel webhook, or the body is not JSON\n * 401 INVALID_SIGNATURE — the platform signature check failed (negative case)\n * 200 { ok: true } — validated + handed to `onMessage`\n */\nexport async function handleChannelWebhook(\n request: Request,\n urlPath: string,\n config: ChannelWebhookConfig,\n): Promise<Response> {\n const parsed = parseChannelPath(urlPath)\n if (parsed === null) {\n return jsonError(\n 400,\n 'BAD_REQUEST',\n 'Path must be /api/agents/<name>/channels/<platform>/webhook.',\n )\n }\n if (!Object.hasOwn(config.validators, parsed.platform)) {\n return jsonError(\n 404,\n 'UNKNOWN_PLATFORM',\n `No validator configured for platform '${parsed.platform}'.`,\n )\n }\n const verify = config.validators[parsed.platform]\n\n // Validate the signature against a CLONE so the body stays readable for the payload parse.\n const verifyResult = await verify(request.clone())\n if (!verifyResult.ok) {\n return jsonError(\n 401,\n 'INVALID_SIGNATURE',\n `Signature validation failed: ${verifyResult.reason}`,\n )\n }\n\n let payload: unknown\n try {\n payload = await request.json()\n } catch {\n return jsonError(400, 'BAD_REQUEST', 'Request body must be JSON.')\n }\n\n await config.onMessage({ agent: parsed.agent, platform: parsed.platform, payload })\n return new Response(JSON.stringify({ ok: true }), {\n status: 200,\n headers: { 'content-type': 'application/json' },\n })\n}\n","/**\n * M35 (multi-surface) — the in-process agent-turn seam (Model A).\n *\n * The FRAMEWORK-owned sibling of the HTTP `mountAgent` and the stdout `runAgentInTerminal`: it runs a\n * compiled agent with the SAME `compileAgentModule` + SAME `streamAgentUIMessages` (G2 — reuses the\n * SDK runtime, reimplements nothing), but returns the raw `UIMessageChunk` generator so ANY consumer\n * drives it directly — the Ink TUI (M35), a Tauri window (M36), or a test — in a SINGLE process with\n * NO HTTP loopback, NO port, and NO CSRF (there is no network boundary to defend).\n *\n * The ONLY difference from the HTTP mount is HITL resolution: the mount pauses the run and resolves\n * the approval via a SECOND HTTP request to `/approve/:id` (the approval registry). In-process there\n * is no second request — the caller resolves the approval INLINE via `awaitApproval` (e.g. the Ink\n * TUI's y/n prompt). The gated-tool map is `compiled.hitl` verbatim, so the pause semantics are\n * byte-identical to the HTTP path; only the resolver differs. Parity with the mount is by\n * construction: both compile the module, resolve function-form skills, and call `streamAgentUIMessages`\n * with the same `{ message, sessionId, hitl }`.\n *\n * Consumers WILL still receive `tool-approval-request` chunks from the returned generator — they are\n * INFORMATIONAL (render them or ignore them). The authoritative human gate is `awaitApproval`, which\n * the SDK awaits BEFORE the gated tool runs; the chunk is not the gate.\n */\nimport {\n compileAgentModule,\n resolveEnabledSkills,\n streamAgentUIMessages,\n type HitlDecision,\n type HumanInTheLoopOptions,\n} from '@theokit/agents'\nimport type { UIMessageChunk } from 'ai'\n\n/** An inline approval request handed to the caller's `awaitApproval` (the Ink/Tauri prompt). */\nexport interface InProcessApprovalRequest {\n approvalId: string\n toolName: string\n opts: HumanInTheLoopOptions\n}\n\n/** Resolve one gated-tool approval inline (approve/deny, or a structured {@link HitlDecision}). */\nexport type InProcessAwaitApproval = (\n req: InProcessApprovalRequest,\n) => Promise<boolean | HitlDecision>\n\nexport interface StreamAgentTurnInProcessInput {\n message: string\n /**\n * M35 (multimodal) — images to send alongside the text. Threaded to the SDK's structured\n * `SDKUserMessage { text, images }` send form. Absent ⇒ the string send path is byte-unchanged.\n */\n images?: Parameters<typeof streamAgentUIMessages>[2]['images']\n /** Resume key; a fresh id per run when omitted. */\n sessionId?: string\n /**\n * Inline HITL resolver — required IFF the agent has `@HumanInTheLoop`-gated tools. Omitting it for a\n * gated agent is a fail-fast error, never a silent bypass (Rule 8, the #99 lesson).\n */\n awaitApproval?: InProcessAwaitApproval\n /** Labels a fail-fast `AgentDefinitionError` (the file path). */\n source?: string\n /** Abort signal forwarded to the SDK stream (client disconnect / window close). */\n signal?: AbortSignal\n}\n\n/** Injectable stream fn (defaults to the real SDK bridge) — lets tests drive a deterministic stream. */\nexport interface StreamAgentTurnDeps {\n stream: typeof streamAgentUIMessages\n}\n\n/**\n * Thrown when a gated agent is run in-process without an `awaitApproval` resolver. Refusing loudly is\n * the correct posture: silently running a `@HumanInTheLoop`-gated tool with no human gate is exactly\n * the #99 class of bug. Typed so callers can catch it distinctly.\n */\nexport class InProcessApprovalRequiredError extends Error {\n constructor(toolNames: readonly string[]) {\n super(\n `Agent has HITL-gated tool(s) [${toolNames.join(', ')}] but no \\`awaitApproval\\` resolver was ` +\n `supplied to streamAgentTurnInProcess. In-process runs must resolve approvals inline — pass ` +\n `awaitApproval, or remove the gate. Refused (fail-closed).`,\n )\n this.name = 'InProcessApprovalRequiredError'\n }\n}\n\n/**\n * Run a compiled agent in-process and return its `UIMessageChunk` stream. `apiKey` is resolved by the\n * caller (same contract as the HTTP mount). Validation + compile happen SYNCHRONOUSLY (so a gated\n * agent without a resolver throws at call time, not lazily on first iteration); the returned value is\n * the SDK's `streamAgentUIMessages` generator.\n */\nexport function streamAgentTurnInProcess(\n mod: unknown,\n apiKey: string,\n input: StreamAgentTurnInProcessInput,\n deps: StreamAgentTurnDeps = { stream: streamAgentUIMessages },\n): AsyncGenerator<UIMessageChunk> {\n const compiled = compileAgentModule(mod, input.source)\n const gated = compiled.hitl\n\n // Fail-fast BEFORE building the stream: a gated agent with no inline resolver would silently bypass\n // the human gate (the #99 class of bug). Refuse loudly (Rule 8, fail-closed).\n if (gated && gated.size > 0 && !input.awaitApproval) {\n throw new InProcessApprovalRequiredError([...gated.keys()])\n }\n const resolve = input.awaitApproval\n\n // Mirror mount-agent's HITL wiring cast-free (structural inference); absent gate ⇒ the non-HITL\n // stream path (M2), unchanged. The SDK calls (approvalId, opts, toolName); route to the caller.\n const hitl =\n gated && gated.size > 0 && resolve\n ? {\n gated,\n awaitApproval: (approvalId: string, opts: HumanInTheLoopOptions, toolName: string) =>\n resolve({ approvalId, toolName, opts }),\n }\n : undefined\n\n const sessionId = input.sessionId ?? crypto.randomUUID()\n\n // Resolve function-form skills (`defineAgent({ skills: (ctx) => [...] })`) BEFORE streaming — exact\n // parity with mount-agent. Done INSIDE the returned generator so the synchronous fail-fast above is\n // preserved (the caller still gets a plain `AsyncGenerator`, no `await` at the call site). A static\n // skill list leaves `skillsResolver` undefined and this is a no-op.\n return (async function* () {\n if (compiled.skillsResolver) {\n const enabled = await resolveEnabledSkills(compiled.skillsResolver, compiled.runContext ?? {})\n if (enabled !== undefined) compiled.skills = { enabled, autoInject: true }\n }\n yield* deps.stream(compiled, apiKey, {\n message: input.message,\n // M35 — pass images through so the SDK send uses the structured `{ text, images }` form.\n ...(input.images !== undefined ? { images: input.images } : {}),\n sessionId,\n hitl,\n signal: input.signal,\n })\n })()\n}\n","/**\n * MCP stdio transport (M16 follow-up) — expose a TheoKit agent as an MCP server over stdin/stdout,\n * the sibling of the M16 HTTP route (`POST /api/agents/<name>/mcp`). A desktop MCP client (e.g.\n * Claude Desktop) spawns `theokit mcp <agent>` and speaks newline-delimited JSON-RPC over the pipe.\n *\n * This is a TRANSPORT over the framework's OWN {@link handleMcpJsonRpc} — it reuses the exact handler\n * the HTTP route uses; it calls no LLM, spawns no MCP client, and reimplements no runtime (G2 /\n * sdk-runtime.md). Distinct from the SDK's MCP CLIENT stdio (which spawns external MCP servers via\n * `mcpServers` command/args) — that stays SDK-side. Here TheoKit is the SERVER. The framework-side\n * placement of this server-exposure transport is recorded in ADR-0042 (refining ADR-0040's M16 note).\n */\nimport type { AppResource } from './mcp-app-resources.js'\nimport { handleMcpJsonRpc } from './mcp-handler.js'\n\n/**\n * Handle one newline-delimited JSON-RPC line. Returns the response line to write to stdout, or\n * `null` for a blank line (nothing to emit). A malformed JSON line yields a `-32700` (Parse error)\n * envelope — never throws, so the stdio loop never dies on bad input.\n */\nexport async function handleMcpStdioLine(\n line: string,\n mod: unknown,\n name: string,\n appResources: readonly AppResource[] = [],\n): Promise<string | null> {\n const trimmed = line.trim()\n if (trimmed.length === 0) return null\n let body: unknown\n try {\n body = JSON.parse(trimmed)\n } catch {\n return JSON.stringify({\n jsonrpc: '2.0',\n id: null,\n error: { code: -32700, message: 'Parse error' },\n })\n }\n const response = await handleMcpJsonRpc(mod, name, body, appResources)\n const payload: unknown = await response.json()\n return JSON.stringify(payload)\n}\n\n/** A minimal readable line source (an async iterable of lines) + a writable sink. */\nexport interface StdioStreams {\n /** Async iterable of newline-delimited input lines (e.g. `readline.createInterface({ input })`). */\n lines: AsyncIterable<string>\n /** Write a response line (the caller appends no newline). */\n write: (line: string) => void\n}\n\n/**\n * Drive the MCP stdio server loop: for each input line, dispatch via {@link handleMcpStdioLine} and\n * write the response line (with a trailing `\\n`). Returns when the input stream ends (EOF).\n */\nexport async function serveMcpStdio(\n mod: unknown,\n name: string,\n appResources: readonly AppResource[],\n streams: StdioStreams,\n): Promise<void> {\n for await (const line of streams.lines) {\n const out = await handleMcpStdioLine(line, mod, name, appResources)\n if (out !== null) streams.write(`${out}\\n`)\n }\n}\n"],"mappings":";;;;;;;;AASA,SAAS,SAAS;AAuBlB,IAAM,mBAAmB,oBAAI,IAAI,CAAC,UAAU,SAAS,aAAa,UAAU,CAAC;AAOtE,SAAS,mBAAmB,UAAwB,QAAwC;AACjG,QAAM,QAAS,UAAmD;AAClE,MAAI,OAAO,UAAU,YAAY;AAC/B,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AAEA,QAAM,cAAc,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC;AAE1D,SAAO,gBAAgB;AAAA,IACrB,MAAM,OAAO;AAAA,IACb,aAAa,OAAO;AAAA,IACpB;AAAA,IACA,SAAS,OAAO,UAAoC;AAClD,YAAM,MAAM,MAAM,SAAS,IAAI,KAAK;AACpC,UAAI,iBAAiB,IAAI,IAA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,cAAc;AAAA,IAChD,CAAC;AAAA,EACH;AACA,QAAM,WAAW,MAAM,iBAAiB,KAAK,MAAM,MAAM,YAAY;AACrE,QAAM,UAAmB,MAAM,SAAS,KAAK;AAC7C,SAAO,KAAK,UAAU,OAAO;AAC/B;AAcA,eAAsB,cACpB,KACA,MACA,cACA,SACe;AACf,mBAAiB,QAAQ,QAAQ,OAAO;AACtC,UAAM,MAAM,MAAM,mBAAmB,MAAM,KAAK,MAAM,YAAY;AAClE,QAAI,QAAQ,KAAM,SAAQ,MAAM,GAAG,GAAG;AAAA,CAAI;AAAA,EAC5C;AACF;","names":["tool"]}
|
package/dist/chunk-HGZL5EOI.js
CHANGED
|
File without changes
|
package/dist/chunk-HNBWZKIQ.js
CHANGED
|
File without changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
getApprovalRegistry
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TDNNBLGW.js";
|
|
6
6
|
import {
|
|
7
7
|
TheoError,
|
|
8
8
|
serverErrorToEnvelope
|
|
@@ -189,7 +189,7 @@ function randomRequestId() {
|
|
|
189
189
|
function broadcastToDevtoolsCore(info, headers, stashedBody) {
|
|
190
190
|
void Promise.all([
|
|
191
191
|
import("./broadcast-LUMOJIJT.js"),
|
|
192
|
-
import("./build-request-body-preview-
|
|
192
|
+
import("./build-request-body-preview-XPZ2GYMG.js")
|
|
193
193
|
]).then(([{ broadcastRequest }, { buildRequestBodyPreview }]) => {
|
|
194
194
|
const bodyInfo = buildRequestBodyPreview(stashedBody);
|
|
195
195
|
broadcastRequest({
|
|
@@ -1515,7 +1515,7 @@ function writeSerialized(res, serialized) {
|
|
|
1515
1515
|
async function emitActionCallTelemetry(name, startedAt, input, outcome) {
|
|
1516
1516
|
if (!__IS_DEV) return;
|
|
1517
1517
|
try {
|
|
1518
|
-
const mod = await import("./dispatcher-
|
|
1518
|
+
const mod = await import("./dispatcher-KMZBGMM5.js");
|
|
1519
1519
|
mod.dispatcher.onActionCall({
|
|
1520
1520
|
// eslint-disable-next-line sonarjs/pseudo-random -- non-secret correlation id
|
|
1521
1521
|
id: `act-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
|
|
@@ -2272,9 +2272,14 @@ function resolveDiscoveryCwd(compiled, projectRoot) {
|
|
|
2272
2272
|
const optedIn = (compiled.settingSources?.length ?? 0) > 0;
|
|
2273
2273
|
return projectRoot !== void 0 && optedIn ? projectRoot : void 0;
|
|
2274
2274
|
}
|
|
2275
|
+
function trimTrailingSlashes(value) {
|
|
2276
|
+
let end = value.length;
|
|
2277
|
+
while (end > 0 && value[end - 1] === "/") end -= 1;
|
|
2278
|
+
return value.slice(0, end);
|
|
2279
|
+
}
|
|
2275
2280
|
function resolveSessionBaseDir(projectRoot) {
|
|
2276
2281
|
if (projectRoot === void 0) return void 0;
|
|
2277
|
-
return `${projectRoot
|
|
2282
|
+
return `${trimTrailingSlashes(projectRoot)}/.data/agent-sessions`;
|
|
2278
2283
|
}
|
|
2279
2284
|
|
|
2280
2285
|
// src/server/scan/module-loader.ts
|
|
@@ -2402,4 +2407,4 @@ export {
|
|
|
2402
2407
|
applySecurityHeaders,
|
|
2403
2408
|
generateNonce
|
|
2404
2409
|
};
|
|
2405
|
-
//# sourceMappingURL=chunk-
|
|
2410
|
+
//# sourceMappingURL=chunk-IE6C4KZX.js.map
|