@introspection-ai/recipes 0.51.0 → 0.52.1

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 (235) 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/introspection-open.d.ts +2 -1
  49. package/dist/introspection-open.d.ts.map +1 -1
  50. package/dist/introspection-open.js +14 -6
  51. package/dist/introspection-open.js.map +1 -1
  52. package/dist/issues/index.d.ts +7 -0
  53. package/dist/issues/index.d.ts.map +1 -0
  54. package/dist/issues/index.js +4 -0
  55. package/dist/issues/index.js.map +1 -0
  56. package/dist/issues/module.d.ts +38 -0
  57. package/dist/issues/module.d.ts.map +1 -0
  58. package/dist/issues/module.js +114 -0
  59. package/dist/issues/module.js.map +1 -0
  60. package/dist/issues/tool.d.ts +95 -0
  61. package/dist/issues/tool.d.ts.map +1 -0
  62. package/dist/issues/tool.js +479 -0
  63. package/dist/issues/tool.js.map +1 -0
  64. package/dist/issues/types.d.ts +280 -0
  65. package/dist/issues/types.d.ts.map +1 -0
  66. package/dist/issues/types.js +79 -0
  67. package/dist/issues/types.js.map +1 -0
  68. package/dist/mcp/cli/command-context.d.ts +20 -1
  69. package/dist/mcp/cli/command-context.d.ts.map +1 -1
  70. package/dist/mcp/cli/command-context.js.map +1 -1
  71. package/dist/mcp/cli/core.d.ts +0 -2
  72. package/dist/mcp/cli/core.d.ts.map +1 -1
  73. package/dist/mcp/cli/core.js +9 -33
  74. package/dist/mcp/cli/core.js.map +1 -1
  75. package/dist/mcp/cli/handshake-retry.d.ts +5 -0
  76. package/dist/mcp/cli/handshake-retry.d.ts.map +1 -0
  77. package/dist/mcp/cli/handshake-retry.js +32 -0
  78. package/dist/mcp/cli/handshake-retry.js.map +1 -0
  79. package/dist/mcp/daemon/index.js +3 -4
  80. package/dist/mcp/daemon/index.js.map +1 -1
  81. package/dist/mcp/pi-client.d.ts +2 -0
  82. package/dist/mcp/pi-client.d.ts.map +1 -1
  83. package/dist/mcp/pi-client.js +5 -1
  84. package/dist/mcp/pi-client.js.map +1 -1
  85. package/dist/mcp/pi-mcp-runtime.d.ts +25 -0
  86. package/dist/mcp/pi-mcp-runtime.d.ts.map +1 -0
  87. package/dist/mcp/pi-mcp-runtime.js +215 -0
  88. package/dist/mcp/pi-mcp-runtime.js.map +1 -0
  89. package/dist/mcp/pi-runtime.d.ts +7 -0
  90. package/dist/mcp/pi-runtime.d.ts.map +1 -0
  91. package/dist/mcp/pi-runtime.js +26 -0
  92. package/dist/mcp/pi-runtime.js.map +1 -0
  93. package/dist/mcp-chunks/chunk-3UVHZECT.js +31 -0
  94. package/dist/mcp-chunks/{chunk-PO2SOBEN.js → chunk-CGJ2XOSF.js} +43 -35
  95. package/dist/mcp-chunks/{chunk-GTETFUPQ.js → chunk-IMG2JMBS.js} +8 -8
  96. package/dist/mcp-chunks/{chunk-UFV6SVQG.js → chunk-LQKMNWDE.js} +2 -2
  97. package/dist/mcp-chunks/{chunk-S2F7DDP5.js → chunk-QUDOU7MQ.js} +1 -1
  98. package/dist/mcp-chunks/{cli-IYD7Y7MO.js → cli-BM23ZXPJ.js} +54 -54
  99. package/dist/mcp-chunks/{client-5MNBV3Z7.js → client-RKTAKDAY.js} +7 -7
  100. package/dist/mcp-chunks/{daemon-command-V3B3EMXD.js → daemon-command-VU6WTFCJ.js} +8 -8
  101. package/dist/mcp-chunks/{generate-cli-runner-PW5WJ7KI.js → generate-cli-runner-JAAPSWGX.js} +12 -12
  102. package/dist/mcp-chunks/{generated-daemon-runtime-3C4NWGAU.js → generated-daemon-runtime-LX4L2X7Z.js} +8 -8
  103. package/dist/mcp-chunks/pi-mcp-runtime-GHDEPXUL.js +1231 -0
  104. package/dist/mcp-chunks/{runtime-RMI3XCYJ.js → runtime-T63YI7TC.js} +6 -6
  105. package/dist/mcp-chunks/{serve-command-UF5SVREV.js → serve-command-75P4VBJ6.js} +7 -7
  106. package/dist/mcp-daemon.js +21 -19
  107. package/dist/mcp-run-worker.js +11 -10
  108. package/dist/open.d.ts +6 -0
  109. package/dist/open.d.ts.map +1 -1
  110. package/dist/open.js +9 -1
  111. package/dist/open.js.map +1 -1
  112. package/dist/pi-extension.d.ts +3 -0
  113. package/dist/pi-extension.d.ts.map +1 -1
  114. package/dist/pi-extension.js +82 -18
  115. package/dist/pi-extension.js.map +1 -1
  116. package/dist/productivity/arguments.d.ts +298 -0
  117. package/dist/productivity/arguments.d.ts.map +1 -0
  118. package/dist/productivity/arguments.generated.d.ts +28 -0
  119. package/dist/productivity/arguments.generated.d.ts.map +1 -0
  120. package/dist/productivity/arguments.generated.js +489 -0
  121. package/dist/productivity/arguments.generated.js.map +1 -0
  122. package/dist/productivity/arguments.js +10 -0
  123. package/dist/productivity/arguments.js.map +1 -0
  124. package/dist/productivity/http.d.ts.map +1 -1
  125. package/dist/productivity/http.js +4 -1
  126. package/dist/productivity/http.js.map +1 -1
  127. package/dist/productivity/index.d.ts +1 -1
  128. package/dist/productivity/index.d.ts.map +1 -1
  129. package/dist/productivity/index.js +1 -1
  130. package/dist/productivity/index.js.map +1 -1
  131. package/dist/productivity/module.d.ts +15 -2
  132. package/dist/productivity/module.d.ts.map +1 -1
  133. package/dist/productivity/module.js +24 -19
  134. package/dist/productivity/module.js.map +1 -1
  135. package/dist/productivity/tools.d.ts +6 -0
  136. package/dist/productivity/tools.d.ts.map +1 -1
  137. package/dist/productivity/tools.js +64 -224
  138. package/dist/productivity/tools.js.map +1 -1
  139. package/dist/productivity/types.d.ts +2 -0
  140. package/dist/productivity/types.d.ts.map +1 -1
  141. package/dist/productivity/types.js.map +1 -1
  142. package/dist/recipe/agent.d.ts +40 -10
  143. package/dist/recipe/agent.d.ts.map +1 -1
  144. package/dist/recipe/agent.js +209 -30
  145. package/dist/recipe/agent.js.map +1 -1
  146. package/dist/recipe/companions.js +1 -1
  147. package/dist/recipe/manifest.generated.d.ts +3 -1
  148. package/dist/recipe/manifest.generated.d.ts.map +1 -1
  149. package/dist/recipe/manifest.generated.js +3 -1
  150. package/dist/recipe/manifest.generated.js.map +1 -1
  151. package/dist/recipe/package.d.ts +28 -3
  152. package/dist/recipe/package.d.ts.map +1 -1
  153. package/dist/recipe/package.js +155 -1
  154. package/dist/recipe/package.js.map +1 -1
  155. package/dist/recipe/providers.d.ts +62 -0
  156. package/dist/recipe/providers.d.ts.map +1 -0
  157. package/dist/recipe/providers.js +95 -0
  158. package/dist/recipe/providers.js.map +1 -0
  159. package/dist/recipe/resolve.d.ts +7 -3
  160. package/dist/recipe/resolve.d.ts.map +1 -1
  161. package/dist/recipe/resolve.js +7 -2
  162. package/dist/recipe/resolve.js.map +1 -1
  163. package/dist/run-controller.d.ts +6 -0
  164. package/dist/run-controller.d.ts.map +1 -1
  165. package/dist/run-controller.js +2 -0
  166. package/dist/run-controller.js.map +1 -1
  167. package/dist/search/index.d.ts +2 -1
  168. package/dist/search/index.d.ts.map +1 -1
  169. package/dist/search/index.js +1 -1
  170. package/dist/search/index.js.map +1 -1
  171. package/dist/search/module.d.ts +19 -7
  172. package/dist/search/module.d.ts.map +1 -1
  173. package/dist/search/module.js +38 -16
  174. package/dist/search/module.js.map +1 -1
  175. package/dist/search/tool.d.ts +6 -1
  176. package/dist/search/tool.d.ts.map +1 -1
  177. package/dist/search/tool.js +22 -9
  178. package/dist/search/tool.js.map +1 -1
  179. package/dist/search/types.d.ts +13 -3
  180. package/dist/search/types.d.ts.map +1 -1
  181. package/dist/search/types.js +4 -1
  182. package/dist/search/types.js.map +1 -1
  183. package/dist/session.d.ts +21 -1
  184. package/dist/session.d.ts.map +1 -1
  185. package/dist/session.js +132 -43
  186. package/dist/session.js.map +1 -1
  187. package/dist/test-utils.d.ts +2 -0
  188. package/dist/test-utils.d.ts.map +1 -1
  189. package/dist/test-utils.js +3 -1
  190. package/dist/test-utils.js.map +1 -1
  191. package/dist/tool-search.d.ts +9 -0
  192. package/dist/tool-search.d.ts.map +1 -1
  193. package/dist/tool-search.js +23 -0
  194. package/dist/tool-search.js.map +1 -1
  195. package/dist/tools/bridge.d.ts +44 -0
  196. package/dist/tools/bridge.d.ts.map +1 -0
  197. package/dist/tools/bridge.js +106 -0
  198. package/dist/tools/bridge.js.map +1 -0
  199. package/dist/tools/cli.d.ts +20 -0
  200. package/dist/tools/cli.d.ts.map +1 -0
  201. package/dist/tools/cli.js +246 -0
  202. package/dist/tools/cli.js.map +1 -0
  203. package/dist/tools/entry.d.ts +2 -0
  204. package/dist/tools/entry.d.ts.map +1 -0
  205. package/dist/tools/entry.js +3 -0
  206. package/dist/tools/entry.js.map +1 -0
  207. package/dist/tools/shell.d.ts +12 -0
  208. package/dist/tools/shell.d.ts.map +1 -0
  209. package/dist/tools/shell.js +50 -0
  210. package/dist/tools/shell.js.map +1 -0
  211. package/dist/tuning/tpe.d.ts +112 -0
  212. package/dist/tuning/tpe.d.ts.map +1 -0
  213. package/dist/tuning/tpe.js +286 -0
  214. package/dist/tuning/tpe.js.map +1 -0
  215. package/docs/README.md +3 -1
  216. package/docs/channels/README.md +10 -0
  217. package/docs/documents/README.md +20 -19
  218. package/docs/host-api.md +10 -0
  219. package/docs/interactions.md +6 -6
  220. package/docs/issues/README.md +183 -0
  221. package/docs/mcp-configuration.md +65 -1
  222. package/docs/pi-extension.md +5 -0
  223. package/docs/productivity/README.md +8 -3
  224. package/docs/providers.md +321 -0
  225. package/docs/recipe-format.md +103 -32
  226. package/docs/search/README.md +37 -20
  227. package/package.json +28 -10
  228. package/skills/documents/SKILL.md +2 -1
  229. package/dist/mcp-chunks/{auth-command-M7TQE3AL.js → auth-command-UYFOGGQR.js} +6 -6
  230. package/dist/mcp-chunks/{call-command-7LD7UEFK.js → call-command-6U5BNDR7.js} +17 -17
  231. package/dist/mcp-chunks/{chunk-PSE442BC.js → chunk-36D4FILJ.js} +26 -26
  232. package/dist/mcp-chunks/{config-command-6DXILFNO.js → config-command-ZSPJI34E.js} +10 -10
  233. package/dist/mcp-chunks/{emit-ts-command-NDCDFDRM.js → emit-ts-command-SY4LQE4S.js} +3 -3
  234. package/dist/mcp-chunks/{inspect-cli-command-4MGF5CPP.js → inspect-cli-command-JPX4ON6N.js} +4 -4
  235. package/dist/mcp-chunks/{resource-command-SRFQQROJ.js → resource-command-DUY4SVE5.js} +4 -4
package/README.md CHANGED
@@ -58,7 +58,7 @@ The normative contract is documented in [Recipe Format](docs/recipe-format.md).
58
58
 
59
59
  ## Use a Recipe
60
60
 
61
- The [`introspection`](https://github.com/introspection-org/introspection-cli)
61
+ The [`introspection`](https://www.npmjs.com/package/@introspection-ai/cli)
62
62
  CLI owns the end-to-end local workflow:
63
63
 
64
64
  ```bash
@@ -136,8 +136,8 @@ tests.
136
136
  tool, capability descriptors, and opaque message references. Replies answer
137
137
  the task's origin; capable adapters also support explicit read and send targets.
138
138
  - `@introspection-ai/recipe-channel-slack` is the Slack adapter, and
139
- `@introspection-ai/recipe-documents-docx` and `-pdf` the Word and PDF
140
- formats. Recipes installs them alongside itself (`optionalDependencies`), so
139
+ `@introspection-ai/recipe-documents-docx`, `-pdf` and `-html` the Word, PDF
140
+ and HTML formats. Recipes installs them alongside itself (`optionalDependencies`), so
141
141
  a Recipe that declares Slack in `pi.channels` or a format in `pi.documents`
142
142
  needs no dependency; one in `dependencies` pins it.
143
143
  - `@introspection-ai/recipes/agents` — portable agent-run controller and tool
@@ -0,0 +1,3 @@
1
+ export { API_LOCAL_CONFIG_ENV, normalizeApiHost, readApiBindings, resolveApiLocalConfigPath, } from "../api-bindings.js";
2
+ export type { ApiLocalConfig, LocalApiBinding, RecipeSessionApiBindings, } from "../api-bindings.js";
3
+ //# sourceMappingURL=api-bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-bindings.d.ts","sourceRoot":"","sources":["../../src/api/api-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,cAAc,EACd,eAAe,EACf,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { API_LOCAL_CONFIG_ENV, normalizeApiHost, readApiBindings, resolveApiLocalConfigPath, } from "../api-bindings.js";
2
+ //# sourceMappingURL=api-bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-bindings.js","sourceRoot":"","sources":["../../src/api/api-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { createAgentSession, RecipeCredentialError, RecipeMcpEnvironmentInUseError, RecipeModelError, RecipeModelTransportError, } from "../session.js";
2
2
  export type { CreateAgentSessionOptions, RecipeSessionHandle, RecipeSessionOtelOptions, } from "../session.js";
3
3
  export type { MemoryContextOverride, MemoryContextSource } from "../memory.js";
4
+ export type { ApiLocalConfig, LocalApiBinding, RecipeSessionApiBindings, } from "../api-bindings.js";
4
5
  export type { RecipeStep, RecipeStepItem } from "../skill-progress.js";
5
6
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/api/session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,8BAA8B,EAC9B,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC/E,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/api/session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,8BAA8B,EAC9B,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC/E,YAAY,EACV,cAAc,EACd,eAAe,EACf,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * One entry of `.pi/api.local.json`: every request the Recipe's providers and
3
+ * channel adapters send to `host` goes to `url` instead (docs/mcp-configuration.md,
4
+ * "API bindings").
5
+ */
6
+ export interface LocalApiBinding {
7
+ /** A bare hostname a loaded provider or adapter declares, such as `graph.microsoft.com`. */
8
+ host: string;
9
+ /** Where the host's requests go: an absolute http(s) URL, optionally with a path prefix. `${VAR}` is interpolated. */
10
+ url: string;
11
+ /** Set on every request to the host, after its credentials are removed. `${VAR}` is interpolated. */
12
+ headers?: Record<string, string>;
13
+ }
14
+ /**
15
+ * The `.pi/api.local.json` shape, usable inline by hosts that synthesize
16
+ * bindings instead of reading them from disk.
17
+ */
18
+ export interface ApiLocalConfig {
19
+ apis: LocalApiBinding[];
20
+ }
21
+ /** Names the binding file, ahead of `<cwd>/.pi/api.local.json` and `<recipeDir>/.pi/api.local.json`. */
22
+ export declare const API_LOCAL_CONFIG_ENV = "PI_RECIPES_API_LOCAL_CONFIG";
23
+ /** Also remove these headers from every request to a bound host, and from any redirect it leads to another host. */
24
+ export declare function stripApiBoundHeaders(names: Iterable<string>): void;
25
+ /**
26
+ * The binding file a session reads: the one `PI_RECIPES_API_LOCAL_CONFIG`
27
+ * names, else `<cwd>/.pi/api.local.json`, else `<recipeDir>/.pi/api.local.json`,
28
+ * else none.
29
+ */
30
+ export declare function resolveApiLocalConfigPath(opts: {
31
+ cwd: string;
32
+ recipeDir: string;
33
+ env?: NodeJS.ProcessEnv;
34
+ }): string | undefined;
35
+ /**
36
+ * A binding's host as it is matched: trimmed, lower case, without a trailing
37
+ * dot. Throws for anything but a bare hostname (a scheme, port, path,
38
+ * credentials or an IP literal with a port).
39
+ */
40
+ export declare function normalizeApiHost(host: string): string;
41
+ /**
42
+ * The session's API bindings, hosts normalized and `${VAR}` in `url` and
43
+ * `headers` interpolated from `env`: the inline `apiBindings` when given, else
44
+ * the file `resolveApiLocalConfigPath` finds, else none. An empty file binds
45
+ * nothing. A file that is missing (when the env names it) or malformed, a host
46
+ * bound twice, a host that is not a bare hostname and a `url` that is not
47
+ * absolute http(s) all throw, so the session fails rather than reaching the
48
+ * live host.
49
+ */
50
+ export declare function readApiBindings(opts: {
51
+ cwd: string;
52
+ recipeDir: string;
53
+ env?: NodeJS.ProcessEnv;
54
+ inline?: ApiLocalConfig;
55
+ }): LocalApiBinding[];
56
+ /**
57
+ * Whether a request to `url` goes where a live API binding sends it rather
58
+ * than to the vendor: such a request needs no egress credential lane.
59
+ */
60
+ export declare function isApiBound(url: string | URL): boolean;
61
+ /** Whether `globalThis.fetch` is the API binding wrapper. */
62
+ export declare function isApiBindingFetchInstalled(): boolean;
63
+ /**
64
+ * Put the binding wrapper in front of the current `globalThis.fetch` while any
65
+ * binding is live. A no-op when the wrapper already is the global fetch, so
66
+ * calling it again never grows the chain.
67
+ */
68
+ export declare function ensureApiBindingFetch(): void;
69
+ /**
70
+ * Bind hosts for one owner (a session) in front of `globalThis.fetch`, until
71
+ * the returned release. Owners share the process's fetch: two live owners may
72
+ * bind a host only to the same URL and headers, and a host stays bound until
73
+ * its last owner releases. After the last release the global fetch is handed
74
+ * back, unless something replaced the wrapper since.
75
+ */
76
+ export declare function installApiBindings(owner: string, bindings: readonly LocalApiBinding[]): () => void;
77
+ /** What a session bound: the hosts its providers declare, and where the file sends each bound one. */
78
+ export interface RecipeSessionApiBindings {
79
+ /** Every host the loaded productivity, issues, channel and (with `pi.search`) search providers declare, sorted. */
80
+ declaredHosts: readonly string[];
81
+ /** The bindings in force for this session; headers are left out, as they may carry a token. */
82
+ bound: readonly Pick<LocalApiBinding, "host" | "url">[];
83
+ }
84
+ /**
85
+ * Resolve, check and install a session's API bindings: what both session
86
+ * paths do once their providers are loaded and before any of their
87
+ * extensions runs.
88
+ */
89
+ export declare function bindRecipeApis(opts: {
90
+ owner: string;
91
+ cwd: string;
92
+ recipeDir: string;
93
+ declaredHosts: readonly string[];
94
+ env?: NodeJS.ProcessEnv;
95
+ inline?: ApiLocalConfig;
96
+ }): {
97
+ apiBindings: RecipeSessionApiBindings;
98
+ bindings: LocalApiBinding[];
99
+ release: () => void;
100
+ };
101
+ //# sourceMappingURL=api-bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-bindings.d.ts","sourceRoot":"","sources":["../src/api-bindings.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAC;IACb,sHAAsH;IACtH,GAAG,EAAE,MAAM,CAAC;IACZ,qGAAqG;IACrG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB;AAED,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AA0BlE,oHAAoH;AACpH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAElE;AAWD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB,GAAG,MAAM,GAAG,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IAAI,CAAC;CACrB,CAcA"}
@@ -0,0 +1,406 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { interpolateEnv } from "./mcp/index.js";
4
+ /** Names the binding file, ahead of `<cwd>/.pi/api.local.json` and `<recipeDir>/.pi/api.local.json`. */
5
+ export const API_LOCAL_CONFIG_ENV = "PI_RECIPES_API_LOCAL_CONFIG";
6
+ /**
7
+ * Removed from every request to a bound host before the entry's headers are
8
+ * set: credentials, the session carriers the platform's egress strips, and the
9
+ * runtime proxy's routing headers. Kept by hand in step with the egress's
10
+ * locator header list.
11
+ */
12
+ const STRIPPED_HEADERS = [
13
+ "authorization",
14
+ "proxy-authorization",
15
+ "x-api-key",
16
+ "api-key",
17
+ "x-goog-api-key",
18
+ "x-typesense-api-key",
19
+ "baggage",
20
+ "x-introspection-egress-host",
21
+ "x-introspection-relay-target",
22
+ ];
23
+ /**
24
+ * The credential headers the loaded providers declare (a search provider's
25
+ * `capabilities.credential.header`), removed beside `STRIPPED_HEADERS`.
26
+ */
27
+ const providerCredentialHeaders = new Set();
28
+ /** Also remove these headers from every request to a bound host, and from any redirect it leads to another host. */
29
+ export function stripApiBoundHeaders(names) {
30
+ for (const name of names)
31
+ providerCredentialHeaders.add(name.toLowerCase());
32
+ }
33
+ function deleteStrippedHeaders(headers) {
34
+ for (const name of STRIPPED_HEADERS)
35
+ headers.delete(name);
36
+ for (const name of providerCredentialHeaders)
37
+ headers.delete(name);
38
+ }
39
+ function defaultApiLocalConfigPath(dir) {
40
+ return join(dir, ".pi", "api.local.json");
41
+ }
42
+ /**
43
+ * The binding file a session reads: the one `PI_RECIPES_API_LOCAL_CONFIG`
44
+ * names, else `<cwd>/.pi/api.local.json`, else `<recipeDir>/.pi/api.local.json`,
45
+ * else none.
46
+ */
47
+ export function resolveApiLocalConfigPath(opts) {
48
+ const env = opts.env ?? process.env;
49
+ const configured = env[API_LOCAL_CONFIG_ENV]?.trim();
50
+ if (configured)
51
+ return configured;
52
+ const workspaceConfig = defaultApiLocalConfigPath(opts.cwd);
53
+ if (existsSync(workspaceConfig))
54
+ return workspaceConfig;
55
+ const recipeConfig = defaultApiLocalConfigPath(opts.recipeDir);
56
+ return existsSync(recipeConfig) ? recipeConfig : undefined;
57
+ }
58
+ /**
59
+ * A binding's host as it is matched: trimmed, lower case, without a trailing
60
+ * dot. Throws for anything but a bare hostname (a scheme, port, path,
61
+ * credentials or an IP literal with a port).
62
+ */
63
+ export function normalizeApiHost(host) {
64
+ const value = host.trim().toLowerCase().replace(/\.$/, "");
65
+ let parsed;
66
+ try {
67
+ parsed = /^[a-z0-9.-]+$/.test(value)
68
+ ? new URL(`https://${value}`)
69
+ : undefined;
70
+ }
71
+ catch {
72
+ parsed = undefined;
73
+ }
74
+ if (!parsed || parsed.hostname !== value || value.split(".").includes(""))
75
+ throw new Error(`API binding host '${host}' is not a bare hostname (no scheme, port or path)`);
76
+ return value;
77
+ }
78
+ function bindingUrl(value, host) {
79
+ let url;
80
+ try {
81
+ url = new URL(value);
82
+ }
83
+ catch {
84
+ throw new Error(`API binding for '${host}' has url '${value}', which is not an absolute URL`);
85
+ }
86
+ if (url.protocol !== "http:" && url.protocol !== "https:")
87
+ throw new Error(`API binding for '${host}' has url '${value}', which is not http(s)`);
88
+ if (url.search || url.hash || url.username || url.password)
89
+ throw new Error(`API binding for '${host}' has url '${value}'; it takes no query, fragment or credentials`);
90
+ return url.toString();
91
+ }
92
+ function parseBinding(value, index, env) {
93
+ if (!value || typeof value !== "object" || Array.isArray(value))
94
+ throw new Error(`API binding ${index} is not an object`);
95
+ const entry = value;
96
+ if (typeof entry.host !== "string")
97
+ throw new Error(`API binding ${index} has no host`);
98
+ const host = normalizeApiHost(entry.host);
99
+ if (typeof entry.url !== "string")
100
+ throw new Error(`API binding for '${host}' has no url`);
101
+ const url = bindingUrl(interpolateEnv(entry.url, env), host);
102
+ if (entry.headers === undefined)
103
+ return { host, url };
104
+ if (!entry.headers ||
105
+ typeof entry.headers !== "object" ||
106
+ Array.isArray(entry.headers))
107
+ throw new Error(`API binding for '${host}' has headers that are not a map`);
108
+ const headers = {};
109
+ for (const [name, header] of Object.entries(entry.headers)) {
110
+ if (typeof header !== "string")
111
+ throw new Error(`API binding for '${host}' has header '${name}' that is not a string`);
112
+ headers[name] = interpolateEnv(header, env);
113
+ }
114
+ return { host, url, headers };
115
+ }
116
+ function parseApiLocalConfig(value, source, env) {
117
+ if (!value || typeof value !== "object" || Array.isArray(value))
118
+ throw new Error(`${source} is not a JSON object`);
119
+ const apis = "apis" in value ? value.apis : undefined;
120
+ if (apis === undefined)
121
+ return [];
122
+ if (!Array.isArray(apis))
123
+ throw new Error(`${source}: apis is not an array`);
124
+ const bindings = apis.map((entry, index) => parseBinding(entry, index, env));
125
+ const seen = new Set();
126
+ for (const binding of bindings) {
127
+ if (seen.has(binding.host))
128
+ throw new Error(`${source} binds '${binding.host}' more than once`);
129
+ seen.add(binding.host);
130
+ }
131
+ return bindings;
132
+ }
133
+ /**
134
+ * The session's API bindings, hosts normalized and `${VAR}` in `url` and
135
+ * `headers` interpolated from `env`: the inline `apiBindings` when given, else
136
+ * the file `resolveApiLocalConfigPath` finds, else none. An empty file binds
137
+ * nothing. A file that is missing (when the env names it) or malformed, a host
138
+ * bound twice, a host that is not a bare hostname and a `url` that is not
139
+ * absolute http(s) all throw, so the session fails rather than reaching the
140
+ * live host.
141
+ */
142
+ export function readApiBindings(opts) {
143
+ const env = opts.env ?? process.env;
144
+ if (opts.inline)
145
+ return parseApiLocalConfig(opts.inline, "apiBindings", env);
146
+ const path = resolveApiLocalConfigPath({ ...opts, env });
147
+ if (!path)
148
+ return [];
149
+ let text;
150
+ try {
151
+ text = readFileSync(path, "utf8");
152
+ }
153
+ catch (error) {
154
+ throw new Error(`API binding file ${path} cannot be read: ${error instanceof Error ? error.message : String(error)}`);
155
+ }
156
+ if (!text.trim())
157
+ return [];
158
+ let parsed;
159
+ try {
160
+ parsed = JSON.parse(text);
161
+ }
162
+ catch (error) {
163
+ throw new Error(`API binding file ${path} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
164
+ }
165
+ return parseApiLocalConfig(parsed, `API binding file ${path}`, env);
166
+ }
167
+ /**
168
+ * Fails when a binding names a host no loaded provider or adapter declares:
169
+ * the file can rebind a declared host, never add one.
170
+ */
171
+ function assertApiBindingsDeclared(bindings, declaredHosts) {
172
+ const declared = new Set(declaredHosts.map((host) => host.toLowerCase()));
173
+ const undeclared = bindings
174
+ .map((binding) => binding.host)
175
+ .filter((host) => !declared.has(host));
176
+ if (undeclared.length > 0)
177
+ throw new Error(`API bindings name host(s) no loaded provider or channel declares: ${undeclared.join(", ")}${declared.size ? ` (declared: ${[...declared].sort().join(", ")})` : ""}`);
178
+ }
179
+ const live = new Map();
180
+ let installedFetch;
181
+ let wrappedFetch;
182
+ function sameBinding(left, right) {
183
+ const leftHeaders = Object.entries(left.headers ?? {});
184
+ const rightHeaders = right.headers ?? {};
185
+ return (left.url === right.url &&
186
+ leftHeaders.length === Object.keys(rightHeaders).length &&
187
+ leftHeaders.every(([name, value]) => rightHeaders[name] === value));
188
+ }
189
+ function hostOf(url) {
190
+ try {
191
+ return (typeof url === "string" ? new URL(url) : url).hostname
192
+ .toLowerCase()
193
+ .replace(/\.$/, "");
194
+ }
195
+ catch {
196
+ return undefined;
197
+ }
198
+ }
199
+ /**
200
+ * Whether a request to `url` goes where a live API binding sends it rather
201
+ * than to the vendor: such a request needs no egress credential lane.
202
+ */
203
+ export function isApiBound(url) {
204
+ const host = hostOf(url);
205
+ return host !== undefined && live.has(host);
206
+ }
207
+ /** Where a request to a bound URL goes, with its forwarding headers. */
208
+ function rewrite(url, binding) {
209
+ const base = new URL(binding.url);
210
+ const prefix = base.pathname.replace(/\/+$/, "");
211
+ return {
212
+ target: `${base.origin}${prefix}${url.pathname}${url.search}`,
213
+ prefix,
214
+ };
215
+ }
216
+ function boundHeaders(headers, binding, prefix) {
217
+ deleteStrippedHeaders(headers);
218
+ headers.set("x-forwarded-host", binding.host);
219
+ headers.set("x-forwarded-proto", "https");
220
+ if (prefix)
221
+ headers.set("x-forwarded-prefix", prefix);
222
+ else
223
+ headers.delete("x-forwarded-prefix");
224
+ for (const [name, value] of Object.entries(binding.headers ?? {}))
225
+ headers.set(name, value);
226
+ return headers;
227
+ }
228
+ function isRequest(input) {
229
+ return (typeof input === "object" &&
230
+ input !== null &&
231
+ !(input instanceof URL) &&
232
+ typeof input.url === "string" &&
233
+ typeof input.method === "string");
234
+ }
235
+ const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
236
+ /** The redirects one bound request follows, as fetch itself allows. */
237
+ const MAX_REDIRECTS = 20;
238
+ function bindingFetch(inner) {
239
+ /**
240
+ * Send one hop of a chain that started at a bound host: a bound host to its
241
+ * target, any other host to the wrapped fetch. Every redirect the caller
242
+ * wants followed is followed here, bound hop or not, rather than inside the
243
+ * wrapped fetch, so a `Location` naming a bound host anywhere in the chain
244
+ * goes through the binding instead of reaching the vendor.
245
+ */
246
+ async function hop(url, init, hops) {
247
+ const host = hostOf(url);
248
+ const binding = host === undefined ? undefined : live.get(host)?.binding;
249
+ const follow = (init.redirect ?? "follow") === "follow";
250
+ const manual = follow ? { redirect: "manual" } : {};
251
+ let response;
252
+ if (binding) {
253
+ const { target, prefix } = rewrite(url, binding);
254
+ response = await inner(target, {
255
+ ...init,
256
+ headers: boundHeaders(new Headers(init.headers), binding, prefix),
257
+ ...manual,
258
+ });
259
+ }
260
+ else {
261
+ response = await inner(url.href, { ...init, ...manual });
262
+ }
263
+ const location = response.headers.get("location");
264
+ if (!follow || !REDIRECT_STATUSES.has(response.status) || !location)
265
+ return response;
266
+ if (hops >= MAX_REDIRECTS)
267
+ throw new TypeError("fetch failed: too many redirects");
268
+ // A bound target answers as the vendor (x-forwarded-*), so its Location
269
+ // is read against the URL the provider sent to.
270
+ const next = new URL(location, url);
271
+ const method = (init.method ?? "GET").toUpperCase();
272
+ const toGet = response.status === 303
273
+ ? method !== "HEAD"
274
+ : (response.status === 301 || response.status === 302) &&
275
+ method === "POST";
276
+ if (!toGet && init.body instanceof ReadableStream)
277
+ throw new TypeError("fetch failed: cannot follow a redirect with a streamed body");
278
+ const headers = new Headers(init.headers);
279
+ // Another host gets none of what the binding strips, bound or not.
280
+ if (next.host !== url.host) {
281
+ deleteStrippedHeaders(headers);
282
+ for (const name of Object.keys(binding?.headers ?? {}))
283
+ headers.delete(name);
284
+ }
285
+ if (toGet) {
286
+ headers.delete("content-type");
287
+ headers.delete("content-length");
288
+ }
289
+ await response.body?.cancel();
290
+ return hop(next, { ...init, headers, ...(toGet ? { method: "GET", body: null } : {}) }, hops + 1);
291
+ }
292
+ const wrapped = (async (input, init) => {
293
+ if (live.size === 0)
294
+ return inner(input, init);
295
+ const raw = isRequest(input)
296
+ ? input.url
297
+ : input instanceof URL
298
+ ? input.href
299
+ : String(input);
300
+ const host = hostOf(raw);
301
+ const entry = host === undefined ? undefined : live.get(host);
302
+ if (!entry)
303
+ return inner(input, init);
304
+ if (!isRequest(input))
305
+ return hop(new URL(raw), init ?? {}, 0);
306
+ const request = init ? new Request(input, init) : input;
307
+ // Buffered, so a 307 or 308 can send the body again.
308
+ const body = request.body ? await request.arrayBuffer() : null;
309
+ return hop(new URL(request.url), {
310
+ method: request.method,
311
+ headers: request.headers,
312
+ body,
313
+ redirect: request.redirect,
314
+ signal: request.signal,
315
+ credentials: request.credentials,
316
+ cache: request.cache,
317
+ integrity: request.integrity,
318
+ keepalive: request.keepalive,
319
+ referrer: request.referrer,
320
+ referrerPolicy: request.referrerPolicy,
321
+ }, 0);
322
+ });
323
+ return wrapped;
324
+ }
325
+ /** Whether `globalThis.fetch` is the API binding wrapper. */
326
+ export function isApiBindingFetchInstalled() {
327
+ return installedFetch !== undefined && globalThis.fetch === installedFetch;
328
+ }
329
+ /**
330
+ * Put the binding wrapper in front of the current `globalThis.fetch` while any
331
+ * binding is live. A no-op when the wrapper already is the global fetch, so
332
+ * calling it again never grows the chain.
333
+ */
334
+ export function ensureApiBindingFetch() {
335
+ if (live.size === 0 || isApiBindingFetchInstalled())
336
+ return;
337
+ wrappedFetch = globalThis.fetch;
338
+ installedFetch = bindingFetch(wrappedFetch);
339
+ globalThis.fetch = installedFetch;
340
+ }
341
+ /**
342
+ * Bind hosts for one owner (a session) in front of `globalThis.fetch`, until
343
+ * the returned release. Owners share the process's fetch: two live owners may
344
+ * bind a host only to the same URL and headers, and a host stays bound until
345
+ * its last owner releases. After the last release the global fetch is handed
346
+ * back, unless something replaced the wrapper since.
347
+ */
348
+ export function installApiBindings(owner, bindings) {
349
+ if (bindings.length === 0)
350
+ return () => { };
351
+ for (const binding of bindings) {
352
+ const current = live.get(binding.host);
353
+ if (current && !sameBinding(current.binding, binding))
354
+ throw new Error(`${owner} binds API host '${binding.host}' to ${binding.url}, but a live session binds it to ${current.binding.url}`);
355
+ }
356
+ const token = Symbol(owner);
357
+ for (const binding of bindings) {
358
+ const current = live.get(binding.host);
359
+ if (current)
360
+ current.owners.add(token);
361
+ else
362
+ live.set(binding.host, { binding, owners: new Set([token]) });
363
+ }
364
+ ensureApiBindingFetch();
365
+ let released = false;
366
+ return () => {
367
+ if (released)
368
+ return;
369
+ released = true;
370
+ for (const binding of bindings) {
371
+ const current = live.get(binding.host);
372
+ if (!current)
373
+ continue;
374
+ current.owners.delete(token);
375
+ if (current.owners.size === 0)
376
+ live.delete(binding.host);
377
+ }
378
+ if (live.size > 0)
379
+ return;
380
+ if (isApiBindingFetchInstalled() && wrappedFetch)
381
+ globalThis.fetch = wrappedFetch;
382
+ installedFetch = undefined;
383
+ wrappedFetch = undefined;
384
+ };
385
+ }
386
+ /**
387
+ * Resolve, check and install a session's API bindings: what both session
388
+ * paths do once their providers are loaded and before any of their
389
+ * extensions runs.
390
+ */
391
+ export function bindRecipeApis(opts) {
392
+ const bindings = readApiBindings(opts);
393
+ assertApiBindingsDeclared(bindings, opts.declaredHosts);
394
+ const release = installApiBindings(opts.owner, bindings);
395
+ return {
396
+ apiBindings: {
397
+ declaredHosts: [
398
+ ...new Set(opts.declaredHosts.map((host) => host.toLowerCase())),
399
+ ].sort(),
400
+ bound: bindings.map(({ host, url }) => ({ host, url })),
401
+ },
402
+ bindings,
403
+ release,
404
+ };
405
+ }
406
+ //# sourceMappingURL=api-bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-bindings.js","sourceRoot":"","sources":["../src/api-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAwBhD,wGAAwG;AACxG,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAA6B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG;IACvB,eAAe;IACf,qBAAqB;IACrB,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,qBAAqB;IACrB,SAAS;IACT,6BAA6B;IAC7B,8BAA8B;CACtB,CAAC;AAEX;;;GAGG;AACH,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAAU,CAAC;AAEpD,oHAAoH;AACpH,MAAM,UAAU,oBAAoB,CAAC,KAAuB;IAC1D,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAgB;IAC7C,KAAK,MAAM,IAAI,IAAI,gBAAgB;QAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAK,MAAM,IAAI,IAAI,yBAAyB;QAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAW;IAC5C,OAAO,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;A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