@introspection-ai/recipes 0.13.0 → 0.14.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 (222) hide show
  1. package/README.md +46 -57
  2. package/dist/{agent-tool.d.ts → agents.d.ts} +4 -1
  3. package/dist/agents.d.ts.map +1 -0
  4. package/dist/{agent-tool.js → agents.js} +1 -1
  5. package/dist/agents.js.map +1 -0
  6. package/dist/api/extensions.d.ts +3 -0
  7. package/dist/api/extensions.d.ts.map +1 -0
  8. package/dist/api/extensions.js +2 -0
  9. package/dist/api/extensions.js.map +1 -0
  10. package/dist/api/mcp.d.ts +4 -0
  11. package/dist/api/mcp.d.ts.map +1 -0
  12. package/dist/api/mcp.js +2 -0
  13. package/dist/api/mcp.js.map +1 -0
  14. package/dist/api/session.d.ts +3 -0
  15. package/dist/api/session.d.ts.map +1 -0
  16. package/dist/api/session.js +2 -0
  17. package/dist/api/session.js.map +1 -0
  18. package/dist/child-agent.d.ts +5 -4
  19. package/dist/child-agent.d.ts.map +1 -1
  20. package/dist/child-agent.js +26 -117
  21. package/dist/child-agent.js.map +1 -1
  22. package/dist/child-session.d.ts +23 -0
  23. package/dist/child-session.d.ts.map +1 -0
  24. package/dist/child-session.js +48 -0
  25. package/dist/child-session.js.map +1 -0
  26. package/dist/extensions.d.ts +29 -0
  27. package/dist/extensions.d.ts.map +1 -0
  28. package/dist/extensions.js +119 -0
  29. package/dist/extensions.js.map +1 -0
  30. package/dist/index.d.ts +4 -13
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -13
  33. package/dist/index.js.map +1 -1
  34. package/dist/inspect.d.ts +38 -5
  35. package/dist/inspect.d.ts.map +1 -1
  36. package/dist/inspect.js +92 -41
  37. package/dist/inspect.js.map +1 -1
  38. package/dist/interactions.d.ts +18 -2
  39. package/dist/interactions.d.ts.map +1 -1
  40. package/dist/interactions.js +41 -10
  41. package/dist/interactions.js.map +1 -1
  42. package/dist/mcp-catalog.d.ts +1 -0
  43. package/dist/mcp-catalog.d.ts.map +1 -1
  44. package/dist/mcp-catalog.js +14 -6
  45. package/dist/mcp-catalog.js.map +1 -1
  46. package/dist/mcp-chunks/auth-command-ZLGYIEUY.js +273 -0
  47. package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +13 -0
  48. package/dist/mcp-chunks/call-command-LKTKSYTH.js +612 -0
  49. package/dist/mcp-chunks/chunk-2U4BSDC4.js +3951 -0
  50. package/dist/mcp-chunks/chunk-2XL7MG7R.js +272 -0
  51. package/dist/mcp-chunks/chunk-3BJA27PY.js +2321 -0
  52. package/dist/mcp-chunks/chunk-4SQKWYFF.js +15 -0
  53. package/dist/mcp-chunks/chunk-5QOSCSQB.js +290 -0
  54. package/dist/mcp-chunks/chunk-6W5QFASN.js +77 -0
  55. package/dist/mcp-chunks/chunk-6XCZGU3G.js +1004 -0
  56. package/dist/mcp-chunks/chunk-7FHEBT5G.js +149 -0
  57. package/dist/mcp-chunks/chunk-7KA2VJVZ.js +114 -0
  58. package/dist/mcp-chunks/chunk-7UDVSOOF.js +138 -0
  59. package/dist/mcp-chunks/chunk-BNV3TPE4.js +66 -0
  60. package/dist/mcp-chunks/chunk-BTLAWHTA.js +129 -0
  61. package/dist/mcp-chunks/chunk-BV56DXPW.js +13 -0
  62. package/dist/mcp-chunks/chunk-BWHIA4PC.js +90 -0
  63. package/dist/mcp-chunks/chunk-BZIQOWE6.js +267 -0
  64. package/dist/mcp-chunks/chunk-D3MRAZ6H.js +16140 -0
  65. package/dist/mcp-chunks/chunk-DHBE7UBH.js +750 -0
  66. package/dist/mcp-chunks/chunk-E22DYOW5.js +251 -0
  67. package/dist/mcp-chunks/chunk-ECIVB7P4.js +139 -0
  68. package/dist/mcp-chunks/chunk-HKRJ6O36.js +1076 -0
  69. package/dist/mcp-chunks/chunk-IABRYROW.js +44 -0
  70. package/dist/mcp-chunks/chunk-J6LYIZXN.js +45 -0
  71. package/dist/mcp-chunks/chunk-L7NTQVYN.js +161 -0
  72. package/dist/mcp-chunks/chunk-LEZSACDE.js +141 -0
  73. package/dist/mcp-chunks/chunk-LKIBAYKU.js +208 -0
  74. package/dist/mcp-chunks/chunk-LNH5LAJD.js +152 -0
  75. package/dist/mcp-chunks/chunk-LQQEYD76.js +124 -0
  76. package/dist/mcp-chunks/chunk-LRKZP7DJ.js +47 -0
  77. package/dist/mcp-chunks/chunk-LS7PMWSR.js +109 -0
  78. package/dist/mcp-chunks/chunk-M3TPODXI.js +95 -0
  79. package/dist/mcp-chunks/chunk-MZ2NARG7.js +400 -0
  80. package/dist/mcp-chunks/chunk-N46NEFAF.js +45 -0
  81. package/dist/mcp-chunks/chunk-NNOEGEUZ.js +17273 -0
  82. package/dist/mcp-chunks/chunk-NRAJX5E4.js +69 -0
  83. package/dist/mcp-chunks/chunk-P3PSC54P.js +869 -0
  84. package/dist/mcp-chunks/chunk-PIIYJR44.js +6341 -0
  85. package/dist/mcp-chunks/chunk-PWYFKGKG.js +385 -0
  86. package/dist/mcp-chunks/chunk-SJCCBNZ4.js +45 -0
  87. package/dist/mcp-chunks/chunk-TATVT5IT.js +194 -0
  88. package/dist/mcp-chunks/chunk-TEUKFFQL.js +29 -0
  89. package/dist/mcp-chunks/chunk-UKYNQGNE.js +150 -0
  90. package/dist/mcp-chunks/chunk-UNKB4SBV.js +37 -0
  91. package/dist/mcp-chunks/chunk-WD6BOD24.js +138 -0
  92. package/dist/mcp-chunks/chunk-WQJZMCJN.js +73 -0
  93. package/dist/mcp-chunks/chunk-XANPGTLI.js +364 -0
  94. package/dist/mcp-chunks/chunk-XQK2JSW4.js +35 -0
  95. package/dist/mcp-chunks/chunk-YHQUTU6L.js +571 -0
  96. package/dist/mcp-chunks/chunk-YVZKMV5H.js +57 -0
  97. package/dist/mcp-chunks/cli-UV4QJZZM.js +929 -0
  98. package/dist/mcp-chunks/client-S7RQUG5U.js +13 -0
  99. package/dist/mcp-chunks/config-command-NLAGKID5.js +1101 -0
  100. package/dist/mcp-chunks/daemon-command-U242Z6VY.js +26 -0
  101. package/dist/mcp-chunks/dist-LK3SHAMX.js +6478 -0
  102. package/dist/mcp-chunks/emit-ts-command-VBXVXO6V.js +386 -0
  103. package/dist/mcp-chunks/generate-cli-runner-6CAZZA3P.js +1426 -0
  104. package/dist/mcp-chunks/inspect-cli-command-3ZORTOR7.js +111 -0
  105. package/dist/mcp-chunks/launch-YKRXHXJI.js +10 -0
  106. package/dist/mcp-chunks/lifecycle-XVKRHPH3.js +16 -0
  107. package/dist/mcp-chunks/list-command-2MEGGNFQ.js +4190 -0
  108. package/dist/mcp-chunks/output-utils-NKESLAJ6.js +12 -0
  109. package/dist/mcp-chunks/prompt-B1Yc1NPt-VGOTWJMN.js +918 -0
  110. package/dist/mcp-chunks/record-command-YXHTTTT5.js +17 -0
  111. package/dist/mcp-chunks/replay-command-25HJ6AQU.js +85 -0
  112. package/dist/mcp-chunks/resource-command-OO4NYF5C.js +97 -0
  113. package/dist/mcp-chunks/result-utils-MOHHLNM7.js +15 -0
  114. package/dist/mcp-chunks/runtime-5WJ3G25Y.js +33 -0
  115. package/dist/mcp-chunks/runtime-wrapper-RPWDIDBF.js +10 -0
  116. package/dist/mcp-chunks/serve-command-DHXJZMMN.js +3302 -0
  117. package/dist/mcp-chunks/timeouts-W2XWCCXR.js +18 -0
  118. package/dist/mcp-chunks/vault-command-PIYIUEZL.js +154 -0
  119. package/dist/mcp-daemon-client.d.ts +6 -1
  120. package/dist/mcp-daemon-client.d.ts.map +1 -1
  121. package/dist/mcp-daemon-client.js +119 -2
  122. package/dist/mcp-daemon-client.js.map +1 -1
  123. package/dist/mcp-daemon-protocol.d.ts +18 -1
  124. package/dist/mcp-daemon-protocol.d.ts.map +1 -1
  125. package/dist/mcp-daemon-protocol.js +31 -0
  126. package/dist/mcp-daemon-protocol.js.map +1 -1
  127. package/dist/mcp-daemon.js +169 -76602
  128. package/dist/mcp-daemon.js.map +1 -1
  129. package/dist/mcp-policy.d.ts +11 -0
  130. package/dist/mcp-policy.d.ts.map +1 -0
  131. package/dist/mcp-policy.js +27 -0
  132. package/dist/mcp-policy.js.map +1 -0
  133. package/dist/mcp-run-worker.js +38 -76540
  134. package/dist/mcp-tools.d.ts +39 -0
  135. package/dist/mcp-tools.d.ts.map +1 -0
  136. package/dist/mcp-tools.js +493 -0
  137. package/dist/mcp-tools.js.map +1 -0
  138. package/dist/mcp.d.ts +21 -9
  139. package/dist/mcp.d.ts.map +1 -1
  140. package/dist/mcp.js +101 -31
  141. package/dist/mcp.js.map +1 -1
  142. package/dist/model-binding.d.ts +39 -0
  143. package/dist/model-binding.d.ts.map +1 -0
  144. package/dist/model-binding.js +103 -0
  145. package/dist/model-binding.js.map +1 -0
  146. package/dist/pi-extension.d.ts +2 -22
  147. package/dist/pi-extension.d.ts.map +1 -1
  148. package/dist/pi-extension.js +296 -71
  149. package/dist/pi-extension.js.map +1 -1
  150. package/dist/recipe/resolve.d.ts +43 -20
  151. package/dist/recipe/resolve.d.ts.map +1 -1
  152. package/dist/recipe/resolve.js +215 -70
  153. package/dist/recipe/resolve.js.map +1 -1
  154. package/dist/recipe-agent.d.ts +24 -27
  155. package/dist/recipe-agent.d.ts.map +1 -1
  156. package/dist/recipe-agent.js +278 -230
  157. package/dist/recipe-agent.js.map +1 -1
  158. package/dist/recipe-check.d.ts +18 -0
  159. package/dist/recipe-check.d.ts.map +1 -0
  160. package/dist/recipe-check.js +261 -0
  161. package/dist/recipe-check.js.map +1 -0
  162. package/dist/recipe-extensions.d.ts.map +1 -1
  163. package/dist/recipe-extensions.js +0 -3
  164. package/dist/recipe-extensions.js.map +1 -1
  165. package/dist/recipe-model.d.ts +3 -1
  166. package/dist/recipe-model.d.ts.map +1 -1
  167. package/dist/recipe-model.js +15 -12
  168. package/dist/recipe-model.js.map +1 -1
  169. package/dist/recipe-package.d.ts +6 -28
  170. package/dist/recipe-package.d.ts.map +1 -1
  171. package/dist/recipe-package.js +248 -191
  172. package/dist/recipe-package.js.map +1 -1
  173. package/dist/recipe-skills.d.ts.map +1 -1
  174. package/dist/recipe-skills.js +42 -29
  175. package/dist/recipe-skills.js.map +1 -1
  176. package/dist/run-controller.d.ts +10 -9
  177. package/dist/run-controller.d.ts.map +1 -1
  178. package/dist/run-controller.js +28 -21
  179. package/dist/run-controller.js.map +1 -1
  180. package/dist/session.d.ts +40 -53
  181. package/dist/session.d.ts.map +1 -1
  182. package/dist/session.js +312 -173
  183. package/dist/session.js.map +1 -1
  184. package/dist/test-utils.d.ts +7 -7
  185. package/dist/test-utils.d.ts.map +1 -1
  186. package/dist/test-utils.js +32 -15
  187. package/dist/test-utils.js.map +1 -1
  188. package/docs/agent-composition.md +41 -35
  189. package/docs/host-api.md +201 -0
  190. package/docs/index.md +9 -14
  191. package/docs/interactions.md +12 -11
  192. package/docs/mcp-auth.md +6 -6
  193. package/docs/mcp-configuration.md +73 -25
  194. package/docs/pi-extension.md +39 -11
  195. package/docs/recipe-flow.md +9 -9
  196. package/docs/recipe-format.md +106 -41
  197. package/docs/recipe-judges.md +24 -36
  198. package/package.json +23 -17
  199. package/vendor/mcp-client/darwin-arm64/mcp-client +0 -0
  200. package/vendor/mcp-client/darwin-x64/mcp-client +0 -0
  201. package/vendor/mcp-client/linux-arm64/mcp-client +0 -0
  202. package/vendor/recipe-check/darwin-arm64/recipe-check +0 -0
  203. package/vendor/recipe-check/darwin-x64/recipe-check +0 -0
  204. package/vendor/recipe-check/linux-arm64/recipe-check +0 -0
  205. package/vendor/recipe-check/linux-x64/recipe-check +0 -0
  206. package/vendor/recipe-check/linux-x64-musl/recipe-check +0 -0
  207. package/vendor/recipe-check/win32-x64/recipe-check.exe +0 -0
  208. package/dist/agent-tool.d.ts.map +0 -1
  209. package/dist/agent-tool.js.map +0 -1
  210. package/dist/run.d.ts +0 -28
  211. package/dist/run.d.ts.map +0 -1
  212. package/dist/run.js +0 -84
  213. package/dist/run.js.map +0 -1
  214. package/dist/testing.d.ts +0 -25
  215. package/dist/testing.d.ts.map +0 -1
  216. package/dist/testing.js +0 -96
  217. package/dist/testing.js.map +0 -1
  218. package/docs/deployment-configuration.md +0 -65
  219. package/docs/migration.md +0 -70
  220. package/docs/python-bindings-release.md +0 -47
  221. package/docs/recipe-evals.md +0 -70
  222. package/docs/runtime-library.md +0 -171
package/docs/index.md CHANGED
@@ -10,16 +10,14 @@ task lifecycle, protocols, and deployment.
10
10
 
11
11
  | Goal | Document |
12
12
  | --- | --- |
13
+ | Create, validate, and run a Recipe | [Recipe workflow](recipe-flow.md) |
13
14
  | Understand the portable artifact contract | [Recipe Format](recipe-format.md) |
14
- | Embed a Recipe in a host | [Runtime library](runtime-library.md) |
15
+ | Run a Recipe in your host | [Host API](host-api.md) |
15
16
  | Run a Recipe in Pi | [Pi extension](pi-extension.md) |
16
17
  | Compose agents and subagents | [Agent composition](agent-composition.md) |
17
18
  | Ask for user input across hosts | [Interactions](interactions.md) |
18
19
  | Declare capability policy and bindings | [MCP configuration](mcp-configuration.md) |
19
- | Declare portable resource intent | [Deployment configuration](deployment-configuration.md) |
20
- | Package quality definitions | [Recipe judges](recipe-judges.md) |
21
- | Declare offline evaluation suites | [Recipe evals](recipe-evals.md) |
22
- | Move from the previous package | [Migration](migration.md) |
20
+ | Define portable evaluation judges | [Recipe judges](recipe-judges.md) |
23
21
 
24
22
  ## Boundary
25
23
 
@@ -30,20 +28,17 @@ Recipe source
30
28
  resolveRecipe() format interpretation
31
29
  │
32
30
  ▼
33
- createRecipeSession() complete live Pi agent
31
+ createAgentSession() complete live Pi agent
34
32
  │
35
- ├── runRecipe() one-turn convenience
36
- │
37
- └── host tasks, persistence, auth, protocols, deployment
33
+ └── host tasks, persistence, auth, protocols, deployment
38
34
  ```
39
35
 
40
36
  Recipes stops at the live session boundary. It does not ship a generic server,
41
- task store, scheduler, sandbox, or provider-specific deployment adapter.
37
+ task store, scheduler, sandbox, or provider-specific hosting integration.
42
38
 
43
- The first-party hosts are:
39
+ The same contracts power:
44
40
 
45
41
  - the Pi terminal harness through the Recipes extension;
46
- - Introspection's managed `runtime-agent`.
42
+ - Node.js hosts through `createAgentSession()`.
47
43
 
48
- Other hosts implement the same session contract and can run the host
49
- conformance suite.
44
+ Every host can run the exported conformance suite against its integration.
@@ -1,7 +1,7 @@
1
1
  # Recipe Interactions
2
2
 
3
- `@introspection-ai/recipes/interactions` gives recipe tools one contract for
4
- asking the user a question or requesting approval that works on every pi host:
3
+ `@introspection-ai/recipes/interactions` gives Recipe tools one contract for
4
+ asking the user a question or requesting approval that works on every Pi host:
5
5
  the local TUI, RPC-driven UIs, headless runs, and hosts that stream tool
6
6
  results to a remote frontend and can pause/resume a run.
7
7
 
@@ -77,7 +77,7 @@ Pi's native tool-result shape is `content` plus arbitrary structured
77
77
  `details`. Recipes stores its interaction state at `details.interrupt`.
78
78
  A host that supports pause/resume treats
79
79
  `details.interrupt.outcome.type === "awaiting_user"` as a pause request.
80
- Runtime adapters generate their own pause state from this record.
80
+ Hosts generate their own pause state from this record.
81
81
 
82
82
  | Field | Meaning |
83
83
  | --- | --- |
@@ -90,26 +90,26 @@ Runtime adapters generate their own pause state from this record.
90
90
  | `outcome` | Local result, or `{ type: "awaiting_user" }` when the host must pause |
91
91
 
92
92
  Question options are suggestions, not a closed enum. Local Pi shows them in a
93
- selector plus an `Other` input path, and runtime adapters should preserve that
93
+ selector plus an `Other` input path, and hosts should preserve that
94
94
  same custom-answer path unless a specific tool explicitly does something else.
95
95
 
96
96
  Resume payloads are single-question: `{ answer }` for questions,
97
97
  `{ approved, feedback? }` for confirmations. A decline is a resume with
98
98
  status `cancelled` and **no payload**. Any host-specific pause/resume state
99
- should be generated by the host adapter from this request, not authored inside
100
- recipes.
99
+ should be generated by the host from this request, not authored inside a
100
+ Recipe.
101
101
 
102
102
  ## AG-UI compatibility
103
103
 
104
104
  `details.interrupt` is intentionally close to the shape needed by AG-UI-style
105
- frontends, while remaining Pi-native recipe metadata. A host that deploys
106
- recipes behind the Agent User Interaction Protocol can map an awaiting
105
+ frontends, while remaining Pi-native Recipe metadata. A host that deploys a
106
+ Recipe behind the Agent User Interaction Protocol can map an awaiting
107
107
  `details.interrupt` request into `RUN_FINISHED` with
108
108
  `outcome: { type: "interrupt", interrupts: [...] }`, then resume with the
109
109
  same `{ answer }`, `{ approved, feedback? }`, or cancelled payloads described
110
110
  above.
111
111
 
112
- Recipes should still emit only `details.interrupt`. The host adapter owns ids,
112
+ Recipes should still emit only `details.interrupt`. The host owns ids,
113
113
  tool-call binding, response schemas, transport events, persistence, and any
114
114
  frontend-specific rendering.
115
115
 
@@ -157,7 +157,7 @@ options.
157
157
  The envelope is the tool-result text the model sees after the user responds.
158
158
  It is a byte-exact wire contract: the local dialog walk and every pause/resume
159
159
  host must synthesize identical text for the same outcome,
160
- so recipes cannot tell where the answer came from. Do not reword these
160
+ so Recipe tools cannot tell where the answer came from. Do not reword these
161
161
  without a coordinated protocol change across all hosts.
162
162
 
163
163
  | Outcome | Envelope |
@@ -178,7 +178,8 @@ best judgment.
178
178
  - **`executionMode: "sequential"` is mandatory.** A host pause must never
179
179
  race concurrently executing tools.
180
180
  - **Prefer the wrappers.** Use `askUserQuestion()` and `askUserApproval()` so
181
- recipes do not hand-author interrupt details, reasons, or display metadata.
181
+ Recipe tools do not hand-author interrupt details, reasons, or display
182
+ metadata.
182
183
  - **Never format envelopes yourself.** Return the helper result as-is; envelope
183
184
  authorship must not split across layers.
184
185
  - **Thread the tool's `signal`** into the helper and check for aborts after any
package/docs/mcp-auth.md CHANGED
@@ -7,7 +7,7 @@ endpoint model.
7
7
  Recipe MCP authentication follows the endpoint source that made an
8
8
  already-approved server reachable: a configured package manifest or a local/host
9
9
  binding. Authentication never selects a server or grants tools; the package and
10
- active/visible-agent selections still determine the final server/tool inventory.
10
+ selected-agent policies still determine the final server/tool inventory.
11
11
 
12
12
  ## Local OAuth
13
13
 
@@ -49,13 +49,13 @@ cannot initiate authentication.
49
49
 
50
50
  ## Hosted bindings
51
51
 
52
- Hosted runtimes adapt their endpoint and credential systems into the same
52
+ Hosts adapt their endpoint and credential systems into the same
53
53
  `.pi/mcp.local.json` shape before starting Recipes. Header values remain
54
54
  environment references, so credentials are resolved at runtime rather than
55
55
  written into the recipe workspace. Deployment-specific bootstrap, token, and
56
- egress behavior belongs to the hosting adapter, not this package.
56
+ egress behavior belongs to the host, not this package.
57
57
 
58
- Regardless of where a recipe runs, the agent sees one rule: MCP operations are
58
+ Regardless of where a Recipe runs, the agent sees one rule: MCP operations are
59
59
  headless. When authentication is missing, it receives a deployment-neutral
60
60
  recovery telling it to ask the user to authenticate the connection outside the
61
61
  agent session and then retry; `mcp run --json-errors` reports this as
@@ -75,6 +75,6 @@ reads an absolute local path supplied by an MCP result; server output must not
75
75
  choose files for an agent session to read.
76
76
 
77
77
  This command policy prevents accidental escape from the materialized MCP
78
- surface. It is not an OS or network sandbox: the enclosing local shell or
79
- managed runtime remains responsible for filesystem, process, and egress
78
+ surface. It is not an OS or network sandbox: the enclosing local shell or host
79
+ remains responsible for filesystem, process, and egress
80
80
  isolation.
@@ -1,31 +1,30 @@
1
1
  # MCP configuration
2
2
 
3
3
  MCP authorization is the intersection of two fail-closed policy gates: the
4
- package boundary and the subsets selected by the active agent and its visible
5
- subagents. The authorized server must
4
+ package boundary and the subset selected by an agent. The authorized server must
6
5
  also have a reachable endpoint, supplied either by a package-declared MCP
7
6
  manifest or by a local/host binding. A binding supplies connectivity; it never
8
7
  expands authorization.
9
8
 
10
9
  ```text
11
- package policy ∩ active/visible-agent selections = authorized tools
10
+ package policy ∩ selected-agent policy = authorized tools
12
11
  package.json#pi.mcp agents/*.yaml#mcp
13
12
  +
14
13
  endpoint from package manifest or local/host binding
15
14
  ↓
16
- session-local mcp CLI
15
+ CLI or Pi-registered tools
17
16
  ```
18
17
 
19
18
  ## 1. Declare the package boundary
20
19
 
21
- `package.json#pi.mcp` declares the servers a recipe may use and the maximum
20
+ `package.json#pi.mcp` declares the servers a Recipe may use and the maximum
22
21
  tool set available from each one. It can also reference portable MCP manifests.
23
22
 
24
23
  ```json
25
24
  {
26
25
  "pi": {
27
26
  "mcp": {
28
- "manifest": "mcp.json",
27
+ "manifests": ["mcp.json"],
29
28
  "servers": [
30
29
  {
31
30
  "id": "contacts",
@@ -44,13 +43,12 @@ tool set available from each one. It can also reference portable MCP manifests.
44
43
  Prefer exact tool names. `"*"` explicitly permits the package-visible tool set,
45
44
  including tools a server may add later; patterns such as `search_*` are invalid.
46
45
 
47
- `manifest` accepts a single path; `manifests` accepts an array, and either the
48
- `mcp` value or a manifest reference may be given as a string shorthand for a
49
- single path. A server marked `"required": true` must resolve to a bound endpoint
50
- at session materialization or the session fails closed rather than starting
51
- without the capability.
46
+ `manifests` is always an array of Recipe-relative paths or globs. Singular
47
+ `manifest` and string shorthand are invalid. A server marked
48
+ `"required": true` must resolve to a bound endpoint at session materialization
49
+ or the session fails closed rather than starting without the capability.
52
50
 
53
- ## 2. Narrow access for each agent
51
+ ## 2. Choose an agent mode and narrow access
54
52
 
55
53
  An agent selects a subset of the package-permitted servers and tools. It cannot
56
54
  add capability that the package did not declare.
@@ -59,15 +57,51 @@ add capability that the package did not declare.
59
57
  tools:
60
58
  - bash
61
59
  mcp:
62
- contacts:
63
- include:
64
- - search_contacts
60
+ mode: cli
61
+ servers:
62
+ contacts:
63
+ include:
64
+ - search_contacts
65
65
  ```
66
66
 
67
67
  Omitting a server—or the entire agent `mcp` block—means no access. `exclude`
68
68
  removes exact names after inclusion and always wins. MCP tools are selected here,
69
69
  not in the agent's ordinary `tools` list.
70
70
 
71
+ `mode: cli` creates the session-local `mcp` command.
72
+
73
+ `mode: tools` registers every authorized MCP tool with Pi. Server-local
74
+ `defer` selectors control which authorized tools start hidden from the model;
75
+ `eager` subtracts exceptions from that deferred set:
76
+
77
+ ```yaml
78
+ mcp:
79
+ mode: tools
80
+ servers:
81
+ contacts:
82
+ include: ["*"]
83
+ defer: ["*"]
84
+ eager:
85
+ - search_contacts
86
+ ```
87
+
88
+ Omit `defer` to expose every authorized tool immediately. Use `defer: ["*"]`
89
+ to hide all authorized tools for a server, then optionally list exact tools in
90
+ `eager` to expose those tools at startup. Both fields accept exact tool names
91
+ or a sole `"*"` selector. `eager` wins when a tool matches both fields, but
92
+ neither field can authorize a tool excluded by `include`/`exclude`.
93
+
94
+ Deferred tools remain authorized and discoverable. When at least one exists,
95
+ Recipes registers `mcp_search`; calling it searches only the authorized
96
+ deferred catalog and adds matches to Pi's current active tool set for the next
97
+ model request. It never grants access beyond `servers`.
98
+
99
+ `defer` and `eager` are invalid in CLI mode. An omitted agent `mcp` block
100
+ inherits its base policy. Once a child declares `mcp`, the complete block
101
+ replaces the inherited policy; restate its mode, servers, authorization, and
102
+ activation selectors. This makes external capability changes reviewable at the
103
+ derived agent. Every resolved agent owns its mode independently.
104
+
71
105
  ## 3. Supply endpoint configuration
72
106
 
73
107
  A referenced MCP manifest can carry a portable configured endpoint and catalog.
@@ -97,12 +131,12 @@ export CONTACTS_MCP_TOKEN='...'
97
131
  pi --recipe . --agent agent
98
132
  ```
99
133
 
100
- Do not commit or distribute `.pi/mcp.local.json`; publish validation rejects
134
+ Do not commit or distribute `.pi/mcp.local.json`; Recipe validation rejects
101
135
  local configuration. Commit `.pi/mcp.local.example.json` when a binding template
102
- is helpful. A hosted runtime binds its own endpoint and credential system to the
103
- same shape. A binding overrides a package-manifest endpoint with the same id,
104
- but a server that the package does not permit, or that none of the active/visible
105
- agents permit, remains unavailable.
136
+ is helpful. A host binds its own endpoint and credential system to the same
137
+ shape. A binding overrides a package-manifest endpoint with the same id,
138
+ but a server that the package or selected agent does not permit remains
139
+ unavailable.
106
140
 
107
141
  When the local file is absent, manifest-supplied endpoints remain usable.
108
142
  Required servers that need environment-specific bindings fail closed until the
@@ -110,9 +144,10 @@ local Pi environment or embedding host supplies them.
110
144
 
111
145
  ## Use capabilities from an agent
112
146
 
113
- When the active agent or one of its visible subagents has MCP access, the
114
- extension creates a session-local `mcp` command from their combined selections.
115
- Discover narrowly, inspect one schema, then call or compose:
147
+ In CLI mode, Recipes creates a session-local `mcp` command containing only the
148
+ selected agent's authorized tools. Delegating to another agent does not grant
149
+ the parent direct access to that child's MCP capabilities. Discover narrowly,
150
+ inspect one schema, then call or compose:
116
151
 
117
152
  ```bash
118
153
  mcp search "contact lookup"
@@ -122,5 +157,18 @@ mcp call contacts.search_contacts query="Ada Lovelace"
122
157
 
123
158
  The command is headless and cannot add servers, mutate configuration, or start
124
159
  browser authentication. See [MCP authentication](mcp-auth.md) for OAuth and
125
- hosted binding details, and [Recipes extension](pi-extension.md#mcp) for the
126
- full runtime contract.
160
+ hosted binding details, and [Recipes extension](pi-extension.md) for the
161
+ full session contract.
162
+
163
+ In tools mode, each Pi session—including each delegated child session—gets its
164
+ own registered tool catalog and active set. The MCP daemon and mcporter config
165
+ remain private to those wrappers; shell tools do not receive an `mcp` command,
166
+ `MCPORTER_CONFIG`, or MCP session path.
167
+
168
+ Pi receives each tool's MCP input schema. If the server declares
169
+ `outputSchema`, Recipes retains and validates it locally against successful
170
+ `structuredContent`; providers do not currently receive it as a tool
171
+ declaration field. Text, image, resource, resource-link, audio, and structured
172
+ results are normalized to Pi tool results. Duplicate structured JSON text is
173
+ removed, errors become ordinary failed tool calls, and model-visible text is
174
+ bounded to 50 KiB or 2,000 lines by default.
@@ -9,7 +9,8 @@ pi --recipe ./path/to/recipe --agent agent
9
9
 
10
10
  Pi is the harness. The extension resolves the selected Recipe, configures its
11
11
  model and tools, loads its skills and extensions, materializes its declared
12
- capabilities, and registers its subagents.
12
+ capabilities, and registers its subagents. Every launch with `--recipe`
13
+ validates the authored package first.
13
14
 
14
15
  ## Installation
15
16
 
@@ -52,7 +53,7 @@ For the selected agent, the extension:
52
53
  1. reads the root `package.json#pi` resource declarations;
53
54
  2. resolves the agent YAML, including `from:` inheritance;
54
55
  3. selects the model, thinking level, and tool allowlist;
55
- 4. loads selected skills, prompts, and Recipe-owned extensions;
56
+ 4. loads selected skills, package prompts, and the complete Recipe extension closure;
56
57
  5. materializes declared MCP bindings from host or local configuration;
57
58
  6. exposes only the declared subagents through the shared `agent` tool.
58
59
 
@@ -71,24 +72,51 @@ remain unavailable. See [MCP configuration](mcp-configuration.md).
71
72
  ## Recipe-owned extensions
72
73
 
73
74
  TypeScript extension sources declared by `package.json#pi.extensions` are
74
- loaded relative to the Recipe. Agent-level `extensions.include` and
75
- `extensions.exclude` select which declared extensions participate.
75
+ resolved deterministically and loaded for every Recipe session. This complete
76
+ set is one executable closure; agent YAML only controls which registered tools
77
+ the model may call.
78
+
79
+ Recipe extensions can import `forAgent`, `forRecipeSession`, and
80
+ `getRecipeSessionContext` from `@introspection-ai/recipes/extensions` for
81
+ session-local conditional behavior:
82
+
83
+ ```ts
84
+ import { forAgent } from "@introspection-ai/recipes/extensions";
85
+
86
+ export default function reviewerHooks(pi) {
87
+ forAgent(pi, "reviewer", () => {
88
+ pi.on("tool_call", reviewPolicy);
89
+ });
90
+ }
91
+ ```
92
+
93
+ The context distinguishes `root` and `subagent` roles. Conditional behavior is
94
+ not code isolation: the extension module still executes with the Pi process's
95
+ authority. `forAgent` matches the final resolved `agent.name` exactly; `from`
96
+ is configuration inheritance and does not make a derived agent match its
97
+ ancestor's hooks.
76
98
 
77
- Recipe extensions can import runtime helpers from `@introspection-ai/recipes`.
78
- The loader also aliases the previous `@introspection-ai/pi-recipes` name during
79
- the migration period so existing Recipe source shares the same runtime state.
99
+ The closure contains every extension declared by the Recipe. It does not claim
100
+ exclusive ownership of the surrounding Pi process: trusted global or project
101
+ extensions already loaded by interactive Pi may still run hooks, providers,
102
+ commands, and other non-tool behavior. Recipe `tools` remains the exact
103
+ model-callable allowlist. Embedded Recipe sessions disable ambient extensions,
104
+ skills, prompt templates, and context files by default.
80
105
 
81
106
  ## Validation
82
107
 
83
- Run:
108
+ Every `pi --recipe` launch automatically runs the shared Recipe Format
109
+ validator. Invalid Recipes are rendered in Pi and stop the session before any
110
+ model call.
111
+
112
+ For an explicit manual or CI check, run:
84
113
 
85
114
  ```bash
86
115
  introspection check
87
116
  ```
88
117
 
89
- The runtime also performs the minimum validation required to fail safely before
90
- constructing a session. Static authoring diagnostics remain the CLI validator's
91
- job.
118
+ Both paths use the same Rust validation core. The binary embedded in the npm
119
+ package is an internal bridge for Pi startup, not a second user-facing CLI.
92
120
 
93
121
  ## Host parity
94
122
 
@@ -1,7 +1,7 @@
1
1
  # Recipe workflow
2
2
 
3
3
  The `introspection` CLI owns the developer workflow. The Recipes npm package is
4
- the format implementation and Pi runtime extension; it does not install a
4
+ the format implementation, Host API, and Pi extension; it does not install a
5
5
  second CLI.
6
6
 
7
7
  ## Create and run locally
@@ -15,10 +15,11 @@ introspection local
15
15
 
16
16
  `introspection init` scaffolds a Recipe and ensures compatible versions of Pi
17
17
  and the Recipes extension are present. `introspection check` runs the Recipe
18
- Format validator. `introspection local` resolves the repository's local runtime
19
- manifest and launches Pi with the Recipe path.
18
+ Format validator. `introspection local` resolves the repository's project
19
+ manifest and launches Pi with the Recipe path. Pi automatically runs the same
20
+ validator whenever `--recipe` is present.
20
21
 
21
- The local path requires no login and no Introspection cloud runtime.
22
+ The local path requires no login or Introspection cloud service.
22
23
 
23
24
  ## Run Pi directly
24
25
 
@@ -33,9 +34,8 @@ publish command.
33
34
 
34
35
  ## Deploy
35
36
 
36
- The Recipe remains unchanged across hosts. A host calls
37
- `createRecipeSession()` and supplies its own credentials, task lifecycle,
38
- persistence, isolation, and protocol surface.
37
+ The Recipe remains unchanged across hosts. A long-lived host resolves the Recipe
38
+ once, calls `createAgentSession()`, and supplies its own credentials, task
39
+ lifecycle, persistence, isolation, and protocol surface.
39
40
 
40
- Use Introspection when you want the managed host. Use a host adapter when you
41
- want to operate the same Recipe on another platform.
41
+ Integrate the Host API with the platform that will operate the Recipe.