@introspection-ai/recipes 0.51.0 → 0.52.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 (226) hide show
  1. package/README.md +3 -3
  2. package/dist/api/api-bindings.d.ts +3 -0
  3. package/dist/api/api-bindings.d.ts.map +1 -0
  4. package/dist/api/api-bindings.js +2 -0
  5. package/dist/api/api-bindings.js.map +1 -0
  6. package/dist/api/session.d.ts +1 -0
  7. package/dist/api/session.d.ts.map +1 -1
  8. package/dist/api-bindings.d.ts +101 -0
  9. package/dist/api-bindings.d.ts.map +1 -0
  10. package/dist/api-bindings.js +406 -0
  11. package/dist/api-bindings.js.map +1 -0
  12. package/dist/channels/arguments.d.ts +116 -0
  13. package/dist/channels/arguments.d.ts.map +1 -0
  14. package/dist/channels/arguments.generated.d.ts +15 -0
  15. package/dist/channels/arguments.generated.d.ts.map +1 -0
  16. package/dist/channels/arguments.generated.js +181 -0
  17. package/dist/channels/arguments.generated.js.map +1 -0
  18. package/dist/channels/arguments.js +8 -0
  19. package/dist/channels/arguments.js.map +1 -0
  20. package/dist/channels/module.d.ts +5 -0
  21. package/dist/channels/module.d.ts.map +1 -1
  22. package/dist/channels/module.js +10 -5
  23. package/dist/channels/module.js.map +1 -1
  24. package/dist/channels/tools.d.ts.map +1 -1
  25. package/dist/channels/tools.js +22 -59
  26. package/dist/channels/tools.js.map +1 -1
  27. package/dist/channels/types.d.ts +5 -0
  28. package/dist/channels/types.d.ts.map +1 -1
  29. package/dist/child/session.d.ts +5 -0
  30. package/dist/child/session.d.ts.map +1 -1
  31. package/dist/child/session.js +2 -0
  32. package/dist/child/session.js.map +1 -1
  33. package/dist/clock.d.ts +80 -0
  34. package/dist/clock.d.ts.map +1 -0
  35. package/dist/clock.js +169 -0
  36. package/dist/clock.js.map +1 -0
  37. package/dist/command-parameters.d.ts +37 -5
  38. package/dist/command-parameters.d.ts.map +1 -1
  39. package/dist/command-parameters.js +73 -11
  40. package/dist/command-parameters.js.map +1 -1
  41. package/dist/connector-tools.d.ts +18 -0
  42. package/dist/connector-tools.d.ts.map +1 -1
  43. package/dist/connector-tools.js +48 -2
  44. package/dist/connector-tools.js.map +1 -1
  45. package/dist/documents/tools.d.ts.map +1 -1
  46. package/dist/documents/tools.js +3 -3
  47. package/dist/documents/tools.js.map +1 -1
  48. package/dist/issues/index.d.ts +7 -0
  49. package/dist/issues/index.d.ts.map +1 -0
  50. package/dist/issues/index.js +4 -0
  51. package/dist/issues/index.js.map +1 -0
  52. package/dist/issues/module.d.ts +38 -0
  53. package/dist/issues/module.d.ts.map +1 -0
  54. package/dist/issues/module.js +114 -0
  55. package/dist/issues/module.js.map +1 -0
  56. package/dist/issues/tool.d.ts +95 -0
  57. package/dist/issues/tool.d.ts.map +1 -0
  58. package/dist/issues/tool.js +479 -0
  59. package/dist/issues/tool.js.map +1 -0
  60. package/dist/issues/types.d.ts +280 -0
  61. package/dist/issues/types.d.ts.map +1 -0
  62. package/dist/issues/types.js +79 -0
  63. package/dist/issues/types.js.map +1 -0
  64. package/dist/mcp/cli/command-context.d.ts +20 -1
  65. package/dist/mcp/cli/command-context.d.ts.map +1 -1
  66. package/dist/mcp/cli/command-context.js.map +1 -1
  67. package/dist/mcp/cli/core.d.ts +0 -2
  68. package/dist/mcp/cli/core.d.ts.map +1 -1
  69. package/dist/mcp/cli/core.js +9 -33
  70. package/dist/mcp/cli/core.js.map +1 -1
  71. package/dist/mcp/cli/handshake-retry.d.ts +5 -0
  72. package/dist/mcp/cli/handshake-retry.d.ts.map +1 -0
  73. package/dist/mcp/cli/handshake-retry.js +32 -0
  74. package/dist/mcp/cli/handshake-retry.js.map +1 -0
  75. package/dist/mcp/daemon/index.js +3 -4
  76. package/dist/mcp/daemon/index.js.map +1 -1
  77. package/dist/mcp/pi-client.d.ts +2 -0
  78. package/dist/mcp/pi-client.d.ts.map +1 -1
  79. package/dist/mcp/pi-client.js +5 -1
  80. package/dist/mcp/pi-client.js.map +1 -1
  81. package/dist/mcp/pi-mcp-runtime.d.ts +25 -0
  82. package/dist/mcp/pi-mcp-runtime.d.ts.map +1 -0
  83. package/dist/mcp/pi-mcp-runtime.js +215 -0
  84. package/dist/mcp/pi-mcp-runtime.js.map +1 -0
  85. package/dist/mcp/pi-runtime.d.ts +7 -0
  86. package/dist/mcp/pi-runtime.d.ts.map +1 -0
  87. package/dist/mcp/pi-runtime.js +26 -0
  88. package/dist/mcp/pi-runtime.js.map +1 -0
  89. package/dist/mcp-chunks/chunk-3UVHZECT.js +31 -0
  90. package/dist/mcp-chunks/{chunk-PO2SOBEN.js → chunk-CGJ2XOSF.js} +43 -35
  91. package/dist/mcp-chunks/{chunk-GTETFUPQ.js → chunk-IMG2JMBS.js} +8 -8
  92. package/dist/mcp-chunks/{chunk-UFV6SVQG.js → chunk-LQKMNWDE.js} +2 -2
  93. package/dist/mcp-chunks/{chunk-S2F7DDP5.js → chunk-QUDOU7MQ.js} +1 -1
  94. package/dist/mcp-chunks/{cli-IYD7Y7MO.js → cli-BM23ZXPJ.js} +54 -54
  95. package/dist/mcp-chunks/{client-5MNBV3Z7.js → client-RKTAKDAY.js} +7 -7
  96. package/dist/mcp-chunks/{daemon-command-V3B3EMXD.js → daemon-command-VU6WTFCJ.js} +8 -8
  97. package/dist/mcp-chunks/{generate-cli-runner-PW5WJ7KI.js → generate-cli-runner-JAAPSWGX.js} +12 -12
  98. package/dist/mcp-chunks/{generated-daemon-runtime-3C4NWGAU.js → generated-daemon-runtime-LX4L2X7Z.js} +8 -8
  99. package/dist/mcp-chunks/pi-mcp-runtime-GHDEPXUL.js +1231 -0
  100. package/dist/mcp-chunks/{runtime-RMI3XCYJ.js → runtime-T63YI7TC.js} +6 -6
  101. package/dist/mcp-chunks/{serve-command-UF5SVREV.js → serve-command-75P4VBJ6.js} +7 -7
  102. package/dist/mcp-daemon.js +21 -19
  103. package/dist/mcp-run-worker.js +11 -10
  104. package/dist/pi-extension.d.ts +3 -0
  105. package/dist/pi-extension.d.ts.map +1 -1
  106. package/dist/pi-extension.js +82 -18
  107. package/dist/pi-extension.js.map +1 -1
  108. package/dist/productivity/arguments.d.ts +298 -0
  109. package/dist/productivity/arguments.d.ts.map +1 -0
  110. package/dist/productivity/arguments.generated.d.ts +28 -0
  111. package/dist/productivity/arguments.generated.d.ts.map +1 -0
  112. package/dist/productivity/arguments.generated.js +489 -0
  113. package/dist/productivity/arguments.generated.js.map +1 -0
  114. package/dist/productivity/arguments.js +10 -0
  115. package/dist/productivity/arguments.js.map +1 -0
  116. package/dist/productivity/http.d.ts.map +1 -1
  117. package/dist/productivity/http.js +4 -1
  118. package/dist/productivity/http.js.map +1 -1
  119. package/dist/productivity/index.d.ts +1 -1
  120. package/dist/productivity/index.d.ts.map +1 -1
  121. package/dist/productivity/index.js +1 -1
  122. package/dist/productivity/index.js.map +1 -1
  123. package/dist/productivity/module.d.ts +15 -2
  124. package/dist/productivity/module.d.ts.map +1 -1
  125. package/dist/productivity/module.js +24 -19
  126. package/dist/productivity/module.js.map +1 -1
  127. package/dist/productivity/tools.d.ts +6 -0
  128. package/dist/productivity/tools.d.ts.map +1 -1
  129. package/dist/productivity/tools.js +64 -224
  130. package/dist/productivity/tools.js.map +1 -1
  131. package/dist/productivity/types.d.ts +2 -0
  132. package/dist/productivity/types.d.ts.map +1 -1
  133. package/dist/productivity/types.js.map +1 -1
  134. package/dist/recipe/agent.d.ts +40 -10
  135. package/dist/recipe/agent.d.ts.map +1 -1
  136. package/dist/recipe/agent.js +209 -30
  137. package/dist/recipe/agent.js.map +1 -1
  138. package/dist/recipe/companions.js +1 -1
  139. package/dist/recipe/manifest.generated.d.ts +3 -1
  140. package/dist/recipe/manifest.generated.d.ts.map +1 -1
  141. package/dist/recipe/manifest.generated.js +3 -1
  142. package/dist/recipe/manifest.generated.js.map +1 -1
  143. package/dist/recipe/package.d.ts +28 -3
  144. package/dist/recipe/package.d.ts.map +1 -1
  145. package/dist/recipe/package.js +155 -1
  146. package/dist/recipe/package.js.map +1 -1
  147. package/dist/recipe/providers.d.ts +62 -0
  148. package/dist/recipe/providers.d.ts.map +1 -0
  149. package/dist/recipe/providers.js +95 -0
  150. package/dist/recipe/providers.js.map +1 -0
  151. package/dist/recipe/resolve.d.ts +7 -3
  152. package/dist/recipe/resolve.d.ts.map +1 -1
  153. package/dist/recipe/resolve.js +7 -2
  154. package/dist/recipe/resolve.js.map +1 -1
  155. package/dist/run-controller.d.ts +6 -0
  156. package/dist/run-controller.d.ts.map +1 -1
  157. package/dist/run-controller.js +2 -0
  158. package/dist/run-controller.js.map +1 -1
  159. package/dist/search/index.d.ts +2 -1
  160. package/dist/search/index.d.ts.map +1 -1
  161. package/dist/search/index.js +1 -1
  162. package/dist/search/index.js.map +1 -1
  163. package/dist/search/module.d.ts +19 -7
  164. package/dist/search/module.d.ts.map +1 -1
  165. package/dist/search/module.js +38 -16
  166. package/dist/search/module.js.map +1 -1
  167. package/dist/search/tool.d.ts +6 -1
  168. package/dist/search/tool.d.ts.map +1 -1
  169. package/dist/search/tool.js +22 -9
  170. package/dist/search/tool.js.map +1 -1
  171. package/dist/search/types.d.ts +13 -3
  172. package/dist/search/types.d.ts.map +1 -1
  173. package/dist/search/types.js +4 -1
  174. package/dist/search/types.js.map +1 -1
  175. package/dist/session.d.ts +21 -1
  176. package/dist/session.d.ts.map +1 -1
  177. package/dist/session.js +132 -43
  178. package/dist/session.js.map +1 -1
  179. package/dist/test-utils.d.ts +2 -0
  180. package/dist/test-utils.d.ts.map +1 -1
  181. package/dist/test-utils.js +3 -1
  182. package/dist/test-utils.js.map +1 -1
  183. package/dist/tool-search.d.ts +9 -0
  184. package/dist/tool-search.d.ts.map +1 -1
  185. package/dist/tool-search.js +23 -0
  186. package/dist/tool-search.js.map +1 -1
  187. package/dist/tools/bridge.d.ts +44 -0
  188. package/dist/tools/bridge.d.ts.map +1 -0
  189. package/dist/tools/bridge.js +106 -0
  190. package/dist/tools/bridge.js.map +1 -0
  191. package/dist/tools/cli.d.ts +20 -0
  192. package/dist/tools/cli.d.ts.map +1 -0
  193. package/dist/tools/cli.js +246 -0
  194. package/dist/tools/cli.js.map +1 -0
  195. package/dist/tools/entry.d.ts +2 -0
  196. package/dist/tools/entry.d.ts.map +1 -0
  197. package/dist/tools/entry.js +3 -0
  198. package/dist/tools/entry.js.map +1 -0
  199. package/dist/tools/shell.d.ts +12 -0
  200. package/dist/tools/shell.d.ts.map +1 -0
  201. package/dist/tools/shell.js +50 -0
  202. package/dist/tools/shell.js.map +1 -0
  203. package/dist/tuning/tpe.d.ts +112 -0
  204. package/dist/tuning/tpe.d.ts.map +1 -0
  205. package/dist/tuning/tpe.js +286 -0
  206. package/dist/tuning/tpe.js.map +1 -0
  207. package/docs/README.md +3 -1
  208. package/docs/channels/README.md +10 -0
  209. package/docs/documents/README.md +20 -19
  210. package/docs/host-api.md +10 -0
  211. package/docs/issues/README.md +183 -0
  212. package/docs/mcp-configuration.md +65 -1
  213. package/docs/pi-extension.md +5 -0
  214. package/docs/productivity/README.md +8 -3
  215. package/docs/providers.md +321 -0
  216. package/docs/recipe-format.md +103 -32
  217. package/docs/search/README.md +37 -20
  218. package/package.json +28 -10
  219. package/skills/documents/SKILL.md +2 -1
  220. package/dist/mcp-chunks/{auth-command-M7TQE3AL.js → auth-command-UYFOGGQR.js} +6 -6
  221. package/dist/mcp-chunks/{call-command-7LD7UEFK.js → call-command-6U5BNDR7.js} +17 -17
  222. package/dist/mcp-chunks/{chunk-PSE442BC.js → chunk-36D4FILJ.js} +26 -26
  223. package/dist/mcp-chunks/{config-command-6DXILFNO.js → config-command-ZSPJI34E.js} +10 -10
  224. package/dist/mcp-chunks/{emit-ts-command-NDCDFDRM.js → emit-ts-command-SY4LQE4S.js} +3 -3
  225. package/dist/mcp-chunks/{inspect-cli-command-4MGF5CPP.js → inspect-cli-command-JPX4ON6N.js} +4 -4
  226. package/dist/mcp-chunks/{resource-command-SRFQQROJ.js → resource-command-DUY4SVE5.js} +4 -4
@@ -2,19 +2,18 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  callOnce,
4
4
  createRuntime
5
- } from "./chunk-PSE442BC.js";
5
+ } from "./chunk-36D4FILJ.js";
6
+ import "./chunk-2AKSS7WR.js";
6
7
  import "./chunk-6P3KAQ5N.js";
7
8
  import "./chunk-F2X4Y2TQ.js";
8
- import "./chunk-2AKSS7WR.js";
9
- import "./chunk-2YV72LUA.js";
10
- import "./chunk-THRMUZZD.js";
11
- import "./chunk-V42T3QNK.js";
12
- import "./chunk-O3RTM5HD.js";
13
9
  import "./chunk-3ETUDW7N.js";
14
10
  import {
15
11
  MCPORTER_VERSION
16
12
  } from "./chunk-QNXOIF5U.js";
17
13
  import "./chunk-6O42UGLI.js";
14
+ import "./chunk-2YV72LUA.js";
15
+ import "./chunk-THRMUZZD.js";
16
+ import "./chunk-V42T3QNK.js";
18
17
  import "./chunk-CXST5CVH.js";
19
18
  import "./chunk-7U5NSQ5T.js";
20
19
  import {
@@ -25,6 +24,7 @@ import "./chunk-JEHI2YU4.js";
25
24
  import "./chunk-IWCVZ46B.js";
26
25
  import "./chunk-T4MQCFIK.js";
27
26
  import "./chunk-BHXCAVFP.js";
27
+ import "./chunk-O3RTM5HD.js";
28
28
  import "./chunk-MHUMLEBO.js";
29
29
  import "./chunk-IRSL7JRH.js";
30
30
  import "./chunk-UVRJ3AAD.js";
@@ -4,24 +4,23 @@ import {
4
4
  } from "./chunk-HNQSUT44.js";
5
5
  import {
6
6
  DaemonClient
7
- } from "./chunk-GTETFUPQ.js";
7
+ } from "./chunk-IMG2JMBS.js";
8
8
  import {
9
9
  createRuntime
10
- } from "./chunk-PSE442BC.js";
10
+ } from "./chunk-36D4FILJ.js";
11
+ import "./chunk-2AKSS7WR.js";
11
12
  import "./chunk-6P3KAQ5N.js";
12
13
  import {
13
14
  createNonInteractiveElicitationResponder
14
15
  } from "./chunk-F2X4Y2TQ.js";
15
- import "./chunk-2AKSS7WR.js";
16
- import "./chunk-2YV72LUA.js";
17
- import "./chunk-THRMUZZD.js";
18
- import "./chunk-V42T3QNK.js";
19
- import "./chunk-O3RTM5HD.js";
20
16
  import "./chunk-3ETUDW7N.js";
21
17
  import {
22
18
  MCPORTER_VERSION
23
19
  } from "./chunk-QNXOIF5U.js";
24
20
  import "./chunk-6O42UGLI.js";
21
+ import "./chunk-2YV72LUA.js";
22
+ import "./chunk-THRMUZZD.js";
23
+ import "./chunk-V42T3QNK.js";
25
24
  import "./chunk-CXST5CVH.js";
26
25
  import "./chunk-7U5NSQ5T.js";
27
26
  import "./chunk-3LENTPGE.js";
@@ -29,6 +28,7 @@ import "./chunk-JEHI2YU4.js";
29
28
  import "./chunk-IWCVZ46B.js";
30
29
  import "./chunk-T4MQCFIK.js";
31
30
  import "./chunk-BHXCAVFP.js";
31
+ import "./chunk-O3RTM5HD.js";
32
32
  import {
33
33
  isKeepAliveServer
34
34
  } from "./chunk-MHUMLEBO.js";
@@ -12,26 +12,26 @@ import {
12
12
  installMcpCommandIoRouting,
13
13
  mcpDaemonRequestContext,
14
14
  serializeMcpDaemonEnvelope
15
- } from "./mcp-chunks/chunk-PO2SOBEN.js";
16
- import "./mcp-chunks/chunk-S2F7DDP5.js";
15
+ } from "./mcp-chunks/chunk-CGJ2XOSF.js";
16
+ import {
17
+ createMcpRuntime
18
+ } from "./mcp-chunks/chunk-3UVHZECT.js";
19
+ import "./mcp-chunks/chunk-QUDOU7MQ.js";
17
20
  import "./mcp-chunks/chunk-HNQSUT44.js";
18
- import "./mcp-chunks/chunk-UFV6SVQG.js";
21
+ import "./mcp-chunks/chunk-LQKMNWDE.js";
19
22
  import "./mcp-chunks/chunk-3SXP4S2A.js";
20
23
  import "./mcp-chunks/chunk-B6S43WID.js";
21
- import "./mcp-chunks/chunk-GTETFUPQ.js";
22
- import {
23
- createRuntime
24
- } from "./mcp-chunks/chunk-PSE442BC.js";
24
+ import "./mcp-chunks/chunk-IMG2JMBS.js";
25
+ import "./mcp-chunks/chunk-36D4FILJ.js";
26
+ import "./mcp-chunks/chunk-2AKSS7WR.js";
25
27
  import "./mcp-chunks/chunk-6P3KAQ5N.js";
26
28
  import "./mcp-chunks/chunk-F2X4Y2TQ.js";
27
- import "./mcp-chunks/chunk-2AKSS7WR.js";
28
- import "./mcp-chunks/chunk-2YV72LUA.js";
29
- import "./mcp-chunks/chunk-THRMUZZD.js";
30
- import "./mcp-chunks/chunk-V42T3QNK.js";
31
- import "./mcp-chunks/chunk-O3RTM5HD.js";
32
29
  import "./mcp-chunks/chunk-3ETUDW7N.js";
33
30
  import "./mcp-chunks/chunk-QNXOIF5U.js";
34
31
  import "./mcp-chunks/chunk-6O42UGLI.js";
32
+ import "./mcp-chunks/chunk-2YV72LUA.js";
33
+ import "./mcp-chunks/chunk-THRMUZZD.js";
34
+ import "./mcp-chunks/chunk-V42T3QNK.js";
35
35
  import "./mcp-chunks/chunk-CXST5CVH.js";
36
36
  import "./mcp-chunks/chunk-7U5NSQ5T.js";
37
37
  import "./mcp-chunks/chunk-3LENTPGE.js";
@@ -39,6 +39,7 @@ import "./mcp-chunks/chunk-JEHI2YU4.js";
39
39
  import "./mcp-chunks/chunk-IWCVZ46B.js";
40
40
  import "./mcp-chunks/chunk-T4MQCFIK.js";
41
41
  import "./mcp-chunks/chunk-BHXCAVFP.js";
42
+ import "./mcp-chunks/chunk-O3RTM5HD.js";
42
43
  import "./mcp-chunks/chunk-MHUMLEBO.js";
43
44
  import "./mcp-chunks/chunk-IRSL7JRH.js";
44
45
  import "./mcp-chunks/chunk-UVRJ3AAD.js";
@@ -73,12 +74,12 @@ var active = /* @__PURE__ */ new Map();
73
74
  var SHUTDOWN_GRACE_MS = 1e3;
74
75
  var CATALOG_PRELOAD_BACKOFF_MS = [100, 250, 500, 1e3, 2e3];
75
76
  function runtime() {
76
- runtimePromise ??= createRuntime({
77
- configPath: process.env.MCPORTER_CONFIG
78
- }).catch((error) => {
79
- runtimePromise = void 0;
80
- throw error;
81
- });
77
+ runtimePromise ??= createMcpRuntime(process.env.MCPORTER_CONFIG).catch(
78
+ (error) => {
79
+ runtimePromise = void 0;
80
+ throw error;
81
+ }
82
+ );
82
83
  return runtimePromise;
83
84
  }
84
85
  function catalogHealthy(catalogs) {
@@ -322,7 +323,8 @@ async function callToolRequest(request, socket) {
322
323
  return value.callTool(request.server, request.tool, {
323
324
  args: request.arguments,
324
325
  timeoutMs: request.timeoutMs,
325
- disableOAuth: true
326
+ disableOAuth: true,
327
+ signal: controller.signal
326
328
  });
327
329
  });
328
330
  if (controller.signal.aborted) {
@@ -2,24 +2,24 @@ import { createRequire as __createRequire } from "node:module"; const require =
2
2
  import {
3
3
  executeMcpCommand,
4
4
  installMcpCommandIoRouting
5
- } from "./mcp-chunks/chunk-PO2SOBEN.js";
6
- import "./mcp-chunks/chunk-S2F7DDP5.js";
5
+ } from "./mcp-chunks/chunk-CGJ2XOSF.js";
6
+ import "./mcp-chunks/chunk-3UVHZECT.js";
7
+ import "./mcp-chunks/chunk-QUDOU7MQ.js";
7
8
  import "./mcp-chunks/chunk-HNQSUT44.js";
8
- import "./mcp-chunks/chunk-UFV6SVQG.js";
9
+ import "./mcp-chunks/chunk-LQKMNWDE.js";
9
10
  import "./mcp-chunks/chunk-3SXP4S2A.js";
10
11
  import "./mcp-chunks/chunk-B6S43WID.js";
11
- import "./mcp-chunks/chunk-GTETFUPQ.js";
12
- import "./mcp-chunks/chunk-PSE442BC.js";
12
+ import "./mcp-chunks/chunk-IMG2JMBS.js";
13
+ import "./mcp-chunks/chunk-36D4FILJ.js";
14
+ import "./mcp-chunks/chunk-2AKSS7WR.js";
13
15
  import "./mcp-chunks/chunk-6P3KAQ5N.js";
14
16
  import "./mcp-chunks/chunk-F2X4Y2TQ.js";
15
- import "./mcp-chunks/chunk-2AKSS7WR.js";
16
- import "./mcp-chunks/chunk-2YV72LUA.js";
17
- import "./mcp-chunks/chunk-THRMUZZD.js";
18
- import "./mcp-chunks/chunk-V42T3QNK.js";
19
- import "./mcp-chunks/chunk-O3RTM5HD.js";
20
17
  import "./mcp-chunks/chunk-3ETUDW7N.js";
21
18
  import "./mcp-chunks/chunk-QNXOIF5U.js";
22
19
  import "./mcp-chunks/chunk-6O42UGLI.js";
20
+ import "./mcp-chunks/chunk-2YV72LUA.js";
21
+ import "./mcp-chunks/chunk-THRMUZZD.js";
22
+ import "./mcp-chunks/chunk-V42T3QNK.js";
23
23
  import "./mcp-chunks/chunk-CXST5CVH.js";
24
24
  import "./mcp-chunks/chunk-7U5NSQ5T.js";
25
25
  import "./mcp-chunks/chunk-3LENTPGE.js";
@@ -27,6 +27,7 @@ import "./mcp-chunks/chunk-JEHI2YU4.js";
27
27
  import "./mcp-chunks/chunk-IWCVZ46B.js";
28
28
  import "./mcp-chunks/chunk-T4MQCFIK.js";
29
29
  import "./mcp-chunks/chunk-BHXCAVFP.js";
30
+ import "./mcp-chunks/chunk-O3RTM5HD.js";
30
31
  import "./mcp-chunks/chunk-MHUMLEBO.js";
31
32
  import "./mcp-chunks/chunk-IRSL7JRH.js";
32
33
  import "./mcp-chunks/chunk-UVRJ3AAD.js";
@@ -1,11 +1,14 @@
1
1
  import { type ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
2
  import { type CreateRecipeChildAgentRunner } from "./child/agent.js";
3
3
  import { type AgentRunEventObserver } from "./agents.js";
4
+ import { type RecipeClockOptions } from "./clock.js";
4
5
  export interface RecipesExtensionOptions {
5
6
  env?: NodeJS.ProcessEnv;
6
7
  createChildAgentRunner?: CreateRecipeChildAgentRunner;
7
8
  /** Observe canonical Pi events from every child run. */
8
9
  onAgentRunEvent?: AgentRunEventObserver;
10
+ /** The clock behind the date in the prompt and the `today` tool. Default: the host's. */
11
+ clock?: RecipeClockOptions;
9
12
  }
10
13
  export declare function createRecipesExtension(opts?: RecipesExtensionOptions): ExtensionFactory;
11
14
  declare const _default: ExtensionFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"pi-extension.d.ts","sourceRoot":"","sources":["../src/pi-extension.ts"],"names":[],"mappings":"AAaA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,4BAA4B,EAGlC,MAAM,kBAAkB,CAAC;AAoB1B,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,aAAa,CAAC;AA+ErB,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,sBAAsB,CAAC,EAAE,4BAA4B,CAAC;IACtD,wDAAwD;IACxD,eAAe,CAAC,EAAE,qBAAqB,CAAC;CACzC;AA+cD,wBAAgB,sBAAsB,CACpC,IAAI,GAAE,uBAA4B,GACjC,gBAAgB,CAk1ClB"}
1
+ {"version":3,"file":"pi-extension.d.ts","sourceRoot":"","sources":["../src/pi-extension.ts"],"names":[],"mappings":"AAaA,OAAO,EAIL,KAAK,gBAAgB,EAEtB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAGL,KAAK,4BAA4B,EAGlC,MAAM,kBAAkB,CAAC;AAoB1B,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,aAAa,CAAC;AA4ErB,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,YAAY,CAAC;AAiBpB,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,sBAAsB,CAAC,EAAE,4BAA4B,CAAC;IACtD,wDAAwD;IACxD,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,yFAAyF;IACzF,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAudD,wBAAgB,sBAAsB,CACpC,IAAI,GAAE,uBAA4B,GACjC,gBAAgB,CA45ClB"}
@@ -15,8 +15,9 @@ import { AGENT_RUN_EVENT_ENTRY_TYPE, notifyAgentRunEvent, } from "./agents.js";
15
15
  import { clearMcpSession, clearSessionMcpCli, configureMcpLocalConfigPath, createIsolatedMcpEnvironment, endpointBindings, formatMcpConfigurationDiagnostics, materializeMcpSession, materializeSessionMcpCli, resolveAgentMcpSelections, resolveMcpSessionServers, stopMcpDaemon, } from "./mcp/index.js";
16
16
  import { mcpServersBehindTools } from "./mcp/policy.js";
17
17
  import { clearMcpCatalogPreload, preloadMcpCatalogs } from "./mcp/catalog.js";
18
+ import { PLATFORM_TOOL_NAMES, platformToolExposure, } from "./recipe/agent.js";
18
19
  import { createMcpToolSet } from "./mcp/tools.js";
19
- import { createMcpBehindGuard, hideServersBehindTools, isPiMcpServerTool, piMcpServerRegistrations, serverBehindTools, waitForPiMcpServers, } from "./mcp/pi-client.js";
20
+ import { createMcpBehindGuard, hideServersBehindTools, isPiMcpServerTool, piMcpServerRegistrations, serverBehindTools, waitForPiMcpServers, assertPiSupportsCodemode, } from "./mcp/pi-client.js";
20
21
  import { applyRecipeAgentPayloadPolicy, applyRecipeAgentModelConfigToModel, cloneModelForRecipe, } from "./recipe/model.js";
21
22
  import { resolveRecipe, } from "./recipe/resolve.js";
22
23
  import { activateRecipePython, prepareRecipePython, RECIPE_PYTHON_ROOT_ENV, } from "./recipe/python.js";
@@ -25,25 +26,34 @@ import { createAgentTool, } from "./agents.js";
25
26
  import { askUserQuestionExtension, wantsAskUserQuestion, } from "./ask-user-question.js";
26
27
  import { introspectionOpenExtension, wantsIntrospectionOpen, } from "./introspection-open.js";
27
28
  import { artifactViewerExtension, recipeSubcommand, recipeSubcommandCompletions, recipeSubcommandNames, splitRecipeSubcommand, wantsArtifactViewer, } from "./artifact-viewer.js";
29
+ import { createRecipeClock, todayExtension, wantsToday, withCurrentDate, } from "./clock.js";
30
+ import { bindRecipeApis, ensureApiBindingFetch, installApiBindings, isApiBindingFetchInstalled, } from "./api-bindings.js";
28
31
  import { loadRecipeConnectors } from "./connector-tools.js";
29
32
  import { createRecipeSuggestionPicker } from "./suggestion-picker.js";
30
- import { createRecipeToolSearchTools, LEGACY_MCP_TOOL_SEARCH_NAME, RECIPE_TOOL_SEARCH_NAME, } from "./tool-search.js";
33
+ import { createRecipeToolSearchTools, LEGACY_MCP_TOOL_SEARCH_NAME, RECIPE_TOOL_SEARCH_NAME, withToolExposure, } from "./tool-search.js";
31
34
  /** Mid-turn completion delivery retries on this cadence until the session idles. */
32
35
  const COMPLETION_DELIVERY_RETRY_MS = 100;
33
- /** Published by the Runtime's proxy-preload.js (introspection-cloud managed-fetch.ts). */
36
+ /** Published by the hosted runtime's proxy preload. */
34
37
  const MANAGED_FETCH_INSTALLER_SYMBOL = Symbol.for("introspection.installManagedFetch");
35
38
  const MANAGED_EGRESS_URL_ENV = "INTROSPECTION_EGRESS_URL";
36
39
  const EGRESS_PROXY_NATIVE_ENV = "INTROSPECTION_EGRESS_PROXY_NATIVE";
37
40
  /**
38
- * Recompose the Runtime's managed fetch over the fetch Pi installs during its
39
- * own bootstrap. Returns whether an installer was present.
41
+ * Compose the process fetch: the Runtime's managed fetch over the fetch Pi
42
+ * installs during its own bootstrap, then the API binding wrapper over both
43
+ * while a binding is live, so the proxy sees the rewritten URL. A no-op while
44
+ * the wrapper is the global fetch: the managed installer re-wraps any fetch it
45
+ * did not install, which would grow the chain on every model request. Returns
46
+ * whether an installer was present.
40
47
  */
41
- function ensureManagedFetch() {
48
+ function ensureRecipeFetch() {
42
49
  const install = Reflect.get(globalThis, MANAGED_FETCH_INSTALLER_SYMBOL);
43
- if (typeof install !== "function")
44
- return false;
45
- install();
46
- return true;
50
+ const managed = typeof install === "function";
51
+ if (isApiBindingFetchInstalled())
52
+ return managed;
53
+ if (managed)
54
+ install();
55
+ ensureApiBindingFetch();
56
+ return managed;
47
57
  }
48
58
  /**
49
59
  * Managed egress with no installer means provider requests bypass credential
@@ -356,11 +366,13 @@ function applyChildToolEvent(run, event) {
356
366
  }
357
367
  export function createRecipesExtension(opts = {}) {
358
368
  const env = opts.env ?? process.env;
369
+ const clock = createRecipeClock(opts.clock);
359
370
  const createChildAgentRunner = opts.createChildAgentRunner ?? createRecipeChildAgentRunner;
360
371
  let state = null;
361
372
  let lastLaunchErrorKey = null;
362
373
  let childRunIndex = 0;
363
374
  const childRuns = new Map();
375
+ let releaseApiBindings;
364
376
  // Runs restored from a previous Pi process via rehydrateChildRuns(). They
365
377
  // have no live runner: readable (status/wait) but not controllable.
366
378
  const archivedRuns = new Map();
@@ -705,6 +717,8 @@ export function createRecipesExtension(opts = {}) {
705
717
  launchState.extensionRegistrations.claim("tool", tool.name, "<host>");
706
718
  }
707
719
  let loadedCount = 0;
720
+ if (launchState.resolved.toolPolicy?.mode === "cli")
721
+ throw new Error("tools.mode cli serves first-party tools to the tools command, which this Pi extension host does not provide yet; use tools or codemode here");
708
722
  try {
709
723
  const connectors = await loadRecipeConnectors(launchState.resolved.manifest, launchState.resolved.tools, {
710
724
  recipeDir: launchState.resolved.recipeDir,
@@ -713,9 +727,36 @@ export function createRecipesExtension(opts = {}) {
713
727
  ...(launchState.python
714
728
  ? { python: launchState.python.packages }
715
729
  : {}),
730
+ exposure: (name) => platformToolExposure(launchState.resolved.toolPolicy, name),
731
+ clock,
732
+ ...(launchState.resolved.wildcardTools
733
+ ? { wildcardTools: launchState.resolved.wildcardTools }
734
+ : {}),
735
+ });
736
+ // Bound hosts must be in front of the fetch before any factory runs: a
737
+ // channel adapter may capture it while its extension loads.
738
+ const bound = bindRecipeApis({
739
+ owner: `Recipe ${launchState.resolved.manifest.name}`,
740
+ cwd: launchState.cwd,
741
+ recipeDir: launchState.resolved.recipeDir,
742
+ declaredHosts: connectors.hosts,
743
+ env,
716
744
  });
745
+ launchState.apiBindings = bound.bindings;
746
+ releaseApiBindings = bound.release;
717
747
  launchState.initialConnectorToolNames =
718
748
  connectors.loadout.initialActiveToolNames;
749
+ if (launchState.resolved.toolPolicy?.mode === "codemode") {
750
+ // First-party tools in codemode need the codemode tool even with no MCP server.
751
+ assertPiSupportsCodemode("tools.mode codemode");
752
+ if (!pi.getAllTools().some((tool) => tool.name === CODEMODE_TOOL_NAME))
753
+ await createCodemodeExtension({ models: false })(pi);
754
+ launchState.initialConnectorToolNames = [
755
+ ...launchState.initialConnectorToolNames,
756
+ CODEMODE_TOOL_NAME,
757
+ ];
758
+ launchState.extensionAllowedToolNames.add(CODEMODE_TOOL_NAME);
759
+ }
719
760
  launchState.connectorToolNames = connectors.loadout.toolNames;
720
761
  launchState.connectorDeferredToolNames =
721
762
  connectors.loadout.deferredToolNames;
@@ -746,7 +787,7 @@ export function createRecipesExtension(opts = {}) {
746
787
  ? { python: launchState.python.packages }
747
788
  : {}),
748
789
  }), launchState.extensionRegistrations, extensionPath, launchState.extensionAllowedToolNames, usesPiMcp(launchState));
749
- await factory(pi);
790
+ await withToolExposure(factory, (name) => platformToolExposure(launchState.resolved.toolPolicy, name))(pi);
750
791
  loadedCount += 1;
751
792
  }
752
793
  // The first-party ask_user_question tool loads after the Recipe's own
@@ -757,6 +798,9 @@ export function createRecipesExtension(opts = {}) {
757
798
  if (wantsIntrospectionOpen(launchState.resolved.tools)) {
758
799
  await introspectionOpenExtension(launchState.extensionRegistrations, env)(pi);
759
800
  }
801
+ if (wantsToday(launchState.resolved.tools)) {
802
+ await todayExtension(clock, launchState.extensionRegistrations)(pi);
803
+ }
760
804
  // Likewise the first-party artifact viewer (show_artifact and /recipe view).
761
805
  if (wantsArtifactViewer(launchState.resolved.tools)) {
762
806
  await artifactViewerExtension(launchState.extensionRegistrations, {}, launchState.resolved.tools, env)(pi);
@@ -817,9 +861,20 @@ export function createRecipesExtension(opts = {}) {
817
861
  if (launchState.resolved.thinkingLevel) {
818
862
  pi.setThinkingLevel(launchState.resolved.thinkingLevel);
819
863
  }
864
+ // First-party tools a host or Recipe extension registered (`web_search`)
865
+ // whose exposure keeps them undeclared.
866
+ const undeclaredExtensionTools = pi
867
+ .getAllTools()
868
+ .filter((tool) => tool.exposure !== "direct" &&
869
+ PLATFORM_TOOL_NAMES.includes(tool.name) &&
870
+ launchState.resolved.tools.includes(tool.name) &&
871
+ !launchState.connectorToolNames.includes(tool.name));
820
872
  const deferredToolNames = [
821
873
  ...launchState.connectorDeferredToolNames,
822
874
  ...launchState.mcpDeferredToolNames,
875
+ ...undeclaredExtensionTools
876
+ .filter((tool) => tool.exposure === "deferred")
877
+ .map((tool) => tool.name),
823
878
  ];
824
879
  if (deferredToolNames.length > 0 && !launchState.toolSearchRegistered) {
825
880
  const toolSearchTools = createRecipeToolSearchTools(pi, launchState.mcpDeferredToolNames.length > 0, (tool) => serverBehindTools(launchState.piBehindServers, tool) !== undefined);
@@ -829,8 +884,13 @@ export function createRecipesExtension(opts = {}) {
829
884
  }
830
885
  launchState.toolSearchRegistered = true;
831
886
  }
887
+ const registeredTools = new Set(pi.getAllTools().map((tool) => tool.name));
888
+ // A tool `include: ["*"]` added that the host does not offer is left out.
889
+ const unavailable = new Set(launchState.resolved.wildcardTools?.filter((name) => !registeredTools.has(name)));
832
890
  const activeTools = new Set([
833
- ...launchState.resolved.tools.filter((tool) => !launchState.connectorToolNames.includes(tool)),
891
+ ...launchState.resolved.tools.filter((tool) => !launchState.connectorToolNames.includes(tool) &&
892
+ !undeclaredExtensionTools.some((entry) => entry.name === tool) &&
893
+ !unavailable.has(tool)),
834
894
  ...launchState.initialConnectorToolNames,
835
895
  ...(launchState.resolved.subagents.size > 0 ? ["agent"] : []),
836
896
  ...launchState.initialMcpToolNames,
@@ -846,7 +906,6 @@ export function createRecipesExtension(opts = {}) {
846
906
  ? [LEGACY_MCP_TOOL_SEARCH_NAME]
847
907
  : []),
848
908
  ]);
849
- const registeredTools = new Set(pi.getAllTools().map((tool) => tool.name));
850
909
  const missingTools = [...activeTools].filter((name) => !registeredTools.has(name));
851
910
  if (missingTools.length > 0) {
852
911
  throw new Error(`Recipe agent "${launchState.resolved.name}" declares unavailable tool(s): ${missingTools.join(", ")}`);
@@ -1225,7 +1284,7 @@ export function createRecipesExtension(opts = {}) {
1225
1284
  registerGenAiSpansFile(pi, env);
1226
1285
  void createMcpBehindGuard(() => state?.piBehindServers ?? [])(pi);
1227
1286
  pi.on("before_provider_request", (event, ctx) => {
1228
- ensureManagedFetch();
1287
+ ensureRecipeFetch();
1229
1288
  if (!state || !ctx.model)
1230
1289
  return undefined;
1231
1290
  return applyRecipeAgentPayloadPolicy(event.payload, ctx.model, state.resolved.modelConfig);
@@ -1283,6 +1342,8 @@ export function createRecipesExtension(opts = {}) {
1283
1342
  await closeAllChildRuns();
1284
1343
  await closeRootMcpRuntime();
1285
1344
  state = null;
1345
+ releaseApiBindings?.();
1346
+ releaseApiBindings = undefined;
1286
1347
  archivedRuns.clear();
1287
1348
  completions.clear();
1288
1349
  await ctx.waitForIdle();
@@ -1335,7 +1396,7 @@ export function createRecipesExtension(opts = {}) {
1335
1396
  return skills;
1336
1397
  });
1337
1398
  pi.on("session_start", async (event, ctx) => {
1338
- if (!ensureManagedFetch()) {
1399
+ if (!ensureRecipeFetch()) {
1339
1400
  const warning = managedFetchMissingWarning(env);
1340
1401
  if (warning !== undefined)
1341
1402
  ctx.ui.notify(warning, "warning");
@@ -1361,6 +1422,9 @@ export function createRecipesExtension(opts = {}) {
1361
1422
  }
1362
1423
  try {
1363
1424
  await loadRecipeExtensions(pi, ctx, launchState);
1425
+ // A restarted session reuses the loaded extensions and their bindings.
1426
+ if (launchState.apiBindings && !releaseApiBindings)
1427
+ releaseApiBindings = installApiBindings(`Recipe ${launchState.resolved.manifest.name}`, launchState.apiBindings);
1364
1428
  }
1365
1429
  catch (err) {
1366
1430
  const message = err instanceof Error ? err.message : String(err);
@@ -1409,6 +1473,8 @@ export function createRecipesExtension(opts = {}) {
1409
1473
  clearMcpCatalogPreload(env);
1410
1474
  await stopMcpDaemon(env);
1411
1475
  restorePythonActivation();
1476
+ releaseApiBindings?.();
1477
+ releaseApiBindings = undefined;
1412
1478
  if (originalRecipeDirEnv === undefined) {
1413
1479
  delete env.PI_RECIPE_DIR;
1414
1480
  }
@@ -1473,9 +1539,7 @@ export function createRecipesExtension(opts = {}) {
1473
1539
  return {};
1474
1540
  hideServersBehindTools(event.systemPromptOptions.sections, launchState.piBehindServers);
1475
1541
  offerOnlyRecipeSkills(event, recipeSkills(launchState));
1476
- return {
1477
- systemPrompt: createSystemPrompt(event, launchState),
1478
- };
1542
+ return withCurrentDate(event, clock, createSystemPrompt(event, launchState));
1479
1543
  });
1480
1544
  };
1481
1545
  }