theokit 0.36.0 → 0.37.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.
Files changed (62) hide show
  1. package/dist/{actions-virtual-module-AX6UMYF5.js → actions-virtual-module-6HQK5GHV.js} +3 -3
  2. package/dist/{actions-virtual-module-BCN7IEQC.js → actions-virtual-module-HYCFRMC3.js} +3 -3
  3. package/dist/{agent-4FJK6PRR.js → agent-PSJ77NJA.js} +2 -2
  4. package/dist/{app-typed-client-U3OCOWYT.js → app-typed-client-K3PXIZDZ.js} +3 -3
  5. package/dist/{app-typed-client-LM2PNOCL.js → app-typed-client-X2A6NMI2.js} +3 -3
  6. package/dist/{build-YQ3AWJV2.js → build-4HOXGMZV.js} +2 -2
  7. package/dist/{chunk-TGTNRUH3.js → chunk-2WTL2GZO.js} +58 -4
  8. package/dist/chunk-2WTL2GZO.js.map +1 -0
  9. package/dist/{chunk-4MTCKE5I.js → chunk-4FE56YQP.js} +2 -2
  10. package/dist/{chunk-OOS5LB5Y.js → chunk-AXF3KYY5.js} +11 -9
  11. package/dist/chunk-AXF3KYY5.js.map +1 -0
  12. package/dist/{chunk-V3X5FWJA.js → chunk-EV33DOG6.js} +1 -1
  13. package/dist/{chunk-V3X5FWJA.js.map → chunk-EV33DOG6.js.map} +1 -1
  14. package/dist/{chunk-F46GSPV7.js → chunk-EZWFDHTI.js} +2 -2
  15. package/dist/{chunk-KXA37ONC.js → chunk-GNUXRXHI.js} +2 -2
  16. package/dist/{chunk-S7L6H3KP.js → chunk-J5PK5FRN.js} +2 -38
  17. package/dist/{chunk-S7L6H3KP.js.map → chunk-J5PK5FRN.js.map} +1 -1
  18. package/dist/{chunk-WR4F4EEZ.js → chunk-PMBYKLLN.js} +58 -4
  19. package/dist/chunk-PMBYKLLN.js.map +1 -0
  20. package/dist/chunk-VB2WWBIT.js +1 -0
  21. package/dist/{chunk-5VRQVXHH.js → chunk-XQPBWMC2.js} +10 -42
  22. package/dist/{chunk-5VRQVXHH.js.map → chunk-XQPBWMC2.js.map} +1 -1
  23. package/dist/cli/index.js +5 -5
  24. package/dist/{dev-PESPUGQU.js → dev-GA572OS7.js} +5 -5
  25. package/dist/{index-C3ged4mn.d.ts → index-BeAsvfPr.d.ts} +2 -2
  26. package/dist/index.js +4 -4
  27. package/dist/{internal-api-CS3AG7MT.js → internal-api-N6JGTRMN.js} +5 -3
  28. package/dist/{internal-api-CCRY3HN4.js → internal-api-TV4CFQY2.js} +5 -3
  29. package/dist/{mcp-FMZSFEEQ.js → mcp-Z3SZULLS.js} +2 -2
  30. package/dist/{plugin-runner-CMprWWHZ.d.ts → plugin-runner-BFEcgtmJ.d.ts} +1 -1
  31. package/dist/{plugin-types-L49QYMb5.d.ts → plugin-types-D69-lJZ9.d.ts} +9 -2
  32. package/dist/server/define/index.d.ts +1 -1
  33. package/dist/server/define/index.js +1 -1
  34. package/dist/server/http/index.d.ts +3 -3
  35. package/dist/server/http/index.js +1 -1
  36. package/dist/server/index.d.ts +4 -4
  37. package/dist/server/index.js +3 -3
  38. package/dist/server/plugins/index.d.ts +3 -3
  39. package/dist/{start-CHMKI2KH.js → start-SWWCB36Q.js} +4 -4
  40. package/dist/vite-plugin/index.js +4 -4
  41. package/dist/{vite-plugin-T3EXDNQQ.js → vite-plugin-OY5ESFTR.js} +5 -5
  42. package/package.json +2 -2
  43. package/dist/chunk-OOS5LB5Y.js.map +0 -1
  44. package/dist/chunk-RSVN727G.js +0 -1
  45. package/dist/chunk-TGTNRUH3.js.map +0 -1
  46. package/dist/chunk-WR4F4EEZ.js.map +0 -1
  47. /package/dist/{actions-virtual-module-AX6UMYF5.js.map → actions-virtual-module-6HQK5GHV.js.map} +0 -0
  48. /package/dist/{actions-virtual-module-BCN7IEQC.js.map → actions-virtual-module-HYCFRMC3.js.map} +0 -0
  49. /package/dist/{agent-4FJK6PRR.js.map → agent-PSJ77NJA.js.map} +0 -0
  50. /package/dist/{app-typed-client-U3OCOWYT.js.map → app-typed-client-K3PXIZDZ.js.map} +0 -0
  51. /package/dist/{app-typed-client-LM2PNOCL.js.map → app-typed-client-X2A6NMI2.js.map} +0 -0
  52. /package/dist/{build-YQ3AWJV2.js.map → build-4HOXGMZV.js.map} +0 -0
  53. /package/dist/{chunk-4MTCKE5I.js.map → chunk-4FE56YQP.js.map} +0 -0
  54. /package/dist/{chunk-F46GSPV7.js.map → chunk-EZWFDHTI.js.map} +0 -0
  55. /package/dist/{chunk-KXA37ONC.js.map → chunk-GNUXRXHI.js.map} +0 -0
  56. /package/dist/{chunk-RSVN727G.js.map → chunk-VB2WWBIT.js.map} +0 -0
  57. /package/dist/{dev-PESPUGQU.js.map → dev-GA572OS7.js.map} +0 -0
  58. /package/dist/{internal-api-CCRY3HN4.js.map → internal-api-N6JGTRMN.js.map} +0 -0
  59. /package/dist/{internal-api-CS3AG7MT.js.map → internal-api-TV4CFQY2.js.map} +0 -0
  60. /package/dist/{mcp-FMZSFEEQ.js.map → mcp-Z3SZULLS.js.map} +0 -0
  61. /package/dist/{start-CHMKI2KH.js.map → start-SWWCB36Q.js.map} +0 -0
  62. /package/dist/{vite-plugin-T3EXDNQQ.js.map → vite-plugin-OY5ESFTR.js.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  loadEnv,
10
10
  resolveTransformer
11
- } from "./chunk-4MTCKE5I.js";
11
+ } from "./chunk-4FE56YQP.js";
12
12
  import {
13
13
  BATCH_PATH,
14
14
  TRACE_HEADER,
@@ -17,8 +17,10 @@ import {
17
17
  executeRoute,
18
18
  extractTraceId,
19
19
  handleBatchRequest,
20
+ incomingMessageToHandlerRequest,
21
+ incomingMessageToWebRequest,
20
22
  sendError
21
- } from "./chunk-TGTNRUH3.js";
23
+ } from "./chunk-2WTL2GZO.js";
22
24
  import {
23
25
  findSuggestion
24
26
  } from "./chunk-5QW7IQQU.js";
@@ -1761,34 +1763,6 @@ function isMcpExposed(mod) {
1761
1763
  }
1762
1764
 
1763
1765
  // src/server/http/node-web-adapter.ts
1764
- import { Readable } from "stream";
1765
- function incomingMessageToWebRequest(req) {
1766
- const host = pickHeaderString(req.headers.host) ?? "localhost";
1767
- const url = `http://${host}${req.url ?? "/"}`;
1768
- const headers = new Headers();
1769
- for (const [key, value] of Object.entries(req.headers)) {
1770
- if (value === void 0) continue;
1771
- if (Array.isArray(value)) {
1772
- headers.set(key, value.join(", "));
1773
- } else {
1774
- headers.set(key, value);
1775
- }
1776
- }
1777
- const method = (req.method ?? "GET").toUpperCase();
1778
- const hasBody = method !== "GET" && method !== "HEAD";
1779
- if (!hasBody) {
1780
- return new Request(url, { method, headers });
1781
- }
1782
- const webStream = Readable.toWeb(req);
1783
- return new Request(url, {
1784
- method,
1785
- headers,
1786
- body: webStream,
1787
- // EC-2: Node 18+ requires `duplex: 'half'` when body is a stream.
1788
- // The `RequestInit` type omits it (Web spec gap); cast accordingly.
1789
- ...{ duplex: "half" }
1790
- });
1791
- }
1792
1766
  async function writeWebResponseToServerResponse(response, res) {
1793
1767
  const setCookies = response.headers.getSetCookie();
1794
1768
  if (setCookies.length > 0) {
@@ -1816,13 +1790,6 @@ async function writeWebResponseToServerResponse(response, res) {
1816
1790
  reader.releaseLock();
1817
1791
  }
1818
1792
  }
1819
- function pickHeaderString(value) {
1820
- if (typeof value === "string") return value;
1821
- if (Array.isArray(value)) {
1822
- for (const v of value) if (typeof v === "string" && v.length > 0) return v;
1823
- }
1824
- return void 0;
1825
- }
1826
1793
 
1827
1794
  // src/vite-plugin/agent-middleware.ts
1828
1795
  var PREFIX2 = "/api/agents/";
@@ -2058,7 +2025,8 @@ async function runPluginsBeforeRouteMatch(pluginRunner, reqCtx) {
2058
2025
  const { req, res, requestId, start, url } = reqCtx;
2059
2026
  try {
2060
2027
  const hookResult = await pluginRunner.runOnRequest({
2061
- request: req,
2028
+ // #119 — plugin hooks see a Web `Request` in every runtime (ADR-0028 R3a).
2029
+ request: incomingMessageToHandlerRequest(req),
2062
2030
  response: res,
2063
2031
  ctx: {},
2064
2032
  requestId
@@ -3344,19 +3312,19 @@ async function theoPluginAsync(rootOrOptions) {
3344
3312
  })
3345
3313
  );
3346
3314
  }
3347
- const { appTypedClientPlugin } = await import("./app-typed-client-U3OCOWYT.js");
3315
+ const { appTypedClientPlugin } = await import("./app-typed-client-K3PXIZDZ.js");
3348
3316
  const appClientPlugin = appTypedClientPlugin({
3349
3317
  cwd: projectRoot,
3350
3318
  serverDir: serverDirAbs,
3351
3319
  distDir: resolve9(projectRoot, ".theokit")
3352
3320
  });
3353
- const { actionsVirtualModule } = await import("./actions-virtual-module-AX6UMYF5.js");
3321
+ const { actionsVirtualModule } = await import("./actions-virtual-module-6HQK5GHV.js");
3354
3322
  const actionsPlugin = actionsVirtualModule({
3355
3323
  serverDir: serverDirAbs,
3356
3324
  distDir: resolve9(projectRoot, ".theokit")
3357
3325
  });
3358
3326
  const { agentsTypedClientPlugin } = await import("./agents-typed-client-MAAILRI6.js");
3359
- const { generateManifest } = await import("./internal-api-CS3AG7MT.js");
3327
+ const { generateManifest } = await import("./internal-api-N6JGTRMN.js");
3360
3328
  const agentsClientPlugin = agentsTypedClientPlugin({
3361
3329
  projectRoot,
3362
3330
  agentsDir: agentsDirName,
@@ -3539,4 +3507,4 @@ export {
3539
3507
  theoPluginAsync,
3540
3508
  theoPlugin
3541
3509
  };
3542
- //# sourceMappingURL=chunk-5VRQVXHH.js.map
3510
+ //# sourceMappingURL=chunk-XQPBWMC2.js.map