@introspection-ai/recipes 0.39.0 → 0.41.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.
- package/README.md +5 -2
- package/dist/artifact-viewer-tui.d.ts +74 -0
- package/dist/artifact-viewer-tui.d.ts.map +1 -0
- package/dist/artifact-viewer-tui.js +179 -0
- package/dist/artifact-viewer-tui.js.map +1 -0
- package/dist/artifact-viewer.d.ts +148 -0
- package/dist/artifact-viewer.d.ts.map +1 -0
- package/dist/artifact-viewer.js +538 -0
- package/dist/artifact-viewer.js.map +1 -0
- package/dist/ask-user-question.d.ts +5 -1
- package/dist/ask-user-question.d.ts.map +1 -1
- package/dist/ask-user-question.js +43 -10
- package/dist/ask-user-question.js.map +1 -1
- package/dist/channels/index.d.ts +2 -2
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +1 -1
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/module.d.ts +18 -0
- package/dist/channels/module.d.ts.map +1 -1
- package/dist/channels/module.js +6 -0
- package/dist/channels/module.js.map +1 -1
- package/dist/connector-tools.d.ts +4 -0
- package/dist/connector-tools.d.ts.map +1 -1
- package/dist/connector-tools.js +27 -11
- package/dist/connector-tools.js.map +1 -1
- package/dist/documents/index.d.ts +2 -2
- package/dist/documents/index.d.ts.map +1 -1
- package/dist/documents/index.js +1 -1
- package/dist/documents/index.js.map +1 -1
- package/dist/documents/module.d.ts +28 -4
- package/dist/documents/module.d.ts.map +1 -1
- package/dist/documents/module.js +34 -24
- package/dist/documents/module.js.map +1 -1
- package/dist/inspect.d.ts +3 -0
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +2 -0
- package/dist/inspect.js.map +1 -1
- package/dist/interaction-tui.d.ts +25 -3
- package/dist/interaction-tui.d.ts.map +1 -1
- package/dist/interaction-tui.js +145 -31
- package/dist/interaction-tui.js.map +1 -1
- package/dist/interactions.d.ts.map +1 -1
- package/dist/interactions.js +5 -0
- package/dist/interactions.js.map +1 -1
- package/dist/mcp-chunks/{chunk-ZK2E4S7E.js → chunk-EZKOZO3F.js} +2005 -0
- package/dist/mcp-daemon.js +1 -1
- package/dist/mcp-run-worker.js +1 -1
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +62 -4
- package/dist/pi-extension.js.map +1 -1
- package/dist/recipe/companions.d.ts +68 -0
- package/dist/recipe/companions.d.ts.map +1 -0
- package/dist/recipe/companions.js +149 -0
- package/dist/recipe/companions.js.map +1 -0
- package/dist/recipe/extensions.d.ts +6 -0
- package/dist/recipe/extensions.d.ts.map +1 -1
- package/dist/recipe/extensions.js +51 -14
- package/dist/recipe/extensions.js.map +1 -1
- package/dist/recipe/package.d.ts +60 -11
- package/dist/recipe/package.d.ts.map +1 -1
- package/dist/recipe/package.js +179 -81
- package/dist/recipe/package.js.map +1 -1
- package/dist/recipe/python.d.ts +16 -5
- package/dist/recipe/python.d.ts.map +1 -1
- package/dist/recipe/python.js +41 -31
- package/dist/recipe/python.js.map +1 -1
- package/dist/recipe/resolve.d.ts.map +1 -1
- package/dist/recipe/resolve.js +30 -16
- package/dist/recipe/resolve.js.map +1 -1
- package/dist/recipe/skills-prompt.d.ts +29 -1
- package/dist/recipe/skills-prompt.d.ts.map +1 -1
- package/dist/recipe/skills-prompt.js +42 -1
- package/dist/recipe/skills-prompt.js.map +1 -1
- package/dist/recipe/skills.d.ts +28 -1
- package/dist/recipe/skills.d.ts.map +1 -1
- package/dist/recipe/skills.js +63 -11
- package/dist/recipe/skills.js.map +1 -1
- package/dist/recipe/suggestions.d.ts +58 -0
- package/dist/recipe/suggestions.d.ts.map +1 -0
- package/dist/recipe/suggestions.js +157 -0
- package/dist/recipe/suggestions.js.map +1 -0
- package/dist/session.d.ts +5 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +19 -4
- package/dist/session.js.map +1 -1
- package/dist/suggestion-picker.d.ts +30 -0
- package/dist/suggestion-picker.d.ts.map +1 -0
- package/dist/suggestion-picker.js +124 -0
- package/dist/suggestion-picker.js.map +1 -0
- package/docs/agent-composition.md +2 -2
- package/docs/channels.md +55 -11
- package/docs/documents.md +77 -17
- package/docs/host-api.md +3 -0
- package/docs/interactions.md +1 -1
- package/docs/pi-extension.md +41 -0
- package/docs/recipe-format.md +225 -63
- package/docs/slack.md +4 -5
- package/package.json +16 -7
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first-run picker: a new Recipe session in the terminal asks once
|
|
3
|
+
* "What would you like to do?" with up to three of the Recipe's prompt
|
|
4
|
+
* templates marked `suggest: true`, through the same terminal helper
|
|
5
|
+
* `ask_user_question` uses. With none marked, it does not ask.
|
|
6
|
+
* Picking one sends it as the first message; typing an answer sends that;
|
|
7
|
+
* Esc leaves the empty prompt. An initial message given on the command line
|
|
8
|
+
* dismisses the picker before it can send anything.
|
|
9
|
+
*/
|
|
10
|
+
import { askInTerminal } from "./ask-user-question.js";
|
|
11
|
+
import { expandWithoutArguments, fillSuggestion, pickSuggestions, readRecipeSuggestions, seededRandom, } from "./recipe/suggestions.js";
|
|
12
|
+
export const SUGGESTIONS_QUESTION = "What would you like to do?";
|
|
13
|
+
/** Pins which three suggestions show, for tests and evals. */
|
|
14
|
+
export const SUGGESTIONS_SEED_ENV = "PI_RECIPES_SUGGESTIONS_SEED";
|
|
15
|
+
function hasMessages(ctx) {
|
|
16
|
+
const entries = ctx.sessionManager?.getEntries?.() ?? [];
|
|
17
|
+
return entries.some((entry) => entry.type === "message");
|
|
18
|
+
}
|
|
19
|
+
function localDate(now = new Date()) {
|
|
20
|
+
const pad = (value) => String(value).padStart(2, "0");
|
|
21
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
22
|
+
}
|
|
23
|
+
/** What Pi can fill locally: today's date and the git author name. */
|
|
24
|
+
async function localValues(pi) {
|
|
25
|
+
const values = { today: localDate() };
|
|
26
|
+
try {
|
|
27
|
+
const result = await pi.exec("git", ["config", "user.name"], { timeout: 2000 });
|
|
28
|
+
const name = result.code === 0 ? result.stdout.trim() : "";
|
|
29
|
+
if (name)
|
|
30
|
+
values["member.name"] = name;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// No git, or no name configured: leave {{member.name}} as written.
|
|
34
|
+
}
|
|
35
|
+
return values;
|
|
36
|
+
}
|
|
37
|
+
function suggestionOptions(suggestions) {
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
return suggestions.map((suggestion) => {
|
|
40
|
+
const command = `/${suggestion.name}`;
|
|
41
|
+
const label = suggestion.description && !seen.has(suggestion.description)
|
|
42
|
+
? suggestion.description
|
|
43
|
+
: command;
|
|
44
|
+
seen.add(label);
|
|
45
|
+
return label === command ? { label } : { label, description: command };
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** Ask once and send the answer; resolves when the picker has settled. */
|
|
49
|
+
export async function offerRecipeSuggestions(pi, ctx, suggestions, signal) {
|
|
50
|
+
const options = suggestionOptions(suggestions);
|
|
51
|
+
let outcome;
|
|
52
|
+
try {
|
|
53
|
+
outcome = await askInTerminal(SUGGESTIONS_QUESTION, options, false, ctx.ui, signal ? { signal } : {}, signal, true);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return; // Dismissed by an initial message.
|
|
57
|
+
}
|
|
58
|
+
const answer = outcome.type === "answered" ? outcome.answer : undefined;
|
|
59
|
+
if (!answer)
|
|
60
|
+
return;
|
|
61
|
+
const picked = suggestions[options.findIndex((option) => option.label === answer)];
|
|
62
|
+
if (!picked) {
|
|
63
|
+
// A typed answer behaves like text typed in the editor.
|
|
64
|
+
pi.sendUserMessage(answer, { expandPromptTemplates: true });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (picked.argumentHint?.includes("<")) {
|
|
68
|
+
// A required argument: put the command in the editor for the user to finish.
|
|
69
|
+
ctx.ui.setEditorText(`/${picked.name} `);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const values = picked.placeholders.length > 0 ? await localValues(pi) : {};
|
|
73
|
+
// An initial message or a session change can abort the picker while git runs.
|
|
74
|
+
if (signal?.aborted)
|
|
75
|
+
return;
|
|
76
|
+
pi.sendUserMessage(fillSuggestion(expandWithoutArguments(picked.text), values));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create the picker and register the `input` handler that lets a
|
|
80
|
+
* command-line or typed message dismiss it.
|
|
81
|
+
*/
|
|
82
|
+
export function createRecipeSuggestionPicker(pi, env) {
|
|
83
|
+
let pending;
|
|
84
|
+
const cancel = () => {
|
|
85
|
+
pending?.abort();
|
|
86
|
+
pending = undefined;
|
|
87
|
+
};
|
|
88
|
+
pi.on("input", (event) => {
|
|
89
|
+
if (event.source !== "extension")
|
|
90
|
+
cancel();
|
|
91
|
+
return { action: "continue" };
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
cancel,
|
|
95
|
+
sessionStarted(event, ctx, promptPaths) {
|
|
96
|
+
cancel();
|
|
97
|
+
if (ctx.mode !== "tui")
|
|
98
|
+
return;
|
|
99
|
+
if (event.reason !== "startup" && event.reason !== "new")
|
|
100
|
+
return;
|
|
101
|
+
if (promptPaths.length === 0 || hasMessages(ctx))
|
|
102
|
+
return;
|
|
103
|
+
const seed = env[SUGGESTIONS_SEED_ENV]?.trim();
|
|
104
|
+
const suggestions = pickSuggestions(readRecipeSuggestions(promptPaths), 3, seed ? seededRandom(seed) : Math.random);
|
|
105
|
+
if (suggestions.length === 0)
|
|
106
|
+
return;
|
|
107
|
+
const controller = new AbortController();
|
|
108
|
+
pending = controller;
|
|
109
|
+
// Pi sends a command-line message only after session_start returns, so
|
|
110
|
+
// ask on the next tick; that message's input event dismisses the picker.
|
|
111
|
+
setTimeout(() => {
|
|
112
|
+
if (controller.signal.aborted)
|
|
113
|
+
return;
|
|
114
|
+
if (hasMessages(ctx) || ctx.isIdle?.() === false)
|
|
115
|
+
return;
|
|
116
|
+
void offerRecipeSuggestions(pi, ctx, suggestions, controller.signal).finally(() => {
|
|
117
|
+
if (pending === controller)
|
|
118
|
+
pending = undefined;
|
|
119
|
+
});
|
|
120
|
+
}, 0);
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=suggestion-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestion-picker.js","sourceRoot":"","sources":["../src/suggestion-picker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,YAAY,GAGb,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AACjE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAA6B,CAAC;AAElE,SAAS,WAAW,CAAC,GAAqB;IACxC,MAAM,OAAO,GAAG,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC;IACzD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,SAAS,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE;IACjC,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9D,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;AACjF,CAAC;AAED,sEAAsE;AACtE,KAAK,UAAU,WAAW,CAAC,EA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rB,uEAAuE;YACvE,yEAAyE;YACzE,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO;oBAAE,OAAO;gBACtC,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,KAAK;oBAAE,OAAO;gBACzD,KAAK,sBAAsB,CAAC,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;oBAChF,IAAI,OAAO,KAAK,UAAU;wBAAE,OAAO,GAAG,SAAS,CAAC;gBAClD,CAAC,CAAC,CAAC;YACL,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -46,7 +46,7 @@ of a base configuration.
|
|
|
46
46
|
name: agent
|
|
47
47
|
description: Main release coordinator
|
|
48
48
|
ai:
|
|
49
|
-
model:
|
|
49
|
+
model: <provider>/<model> # one Pi has credentials for: pi --list-models
|
|
50
50
|
thinking_level: medium
|
|
51
51
|
tools: [read, bash]
|
|
52
52
|
skills: [release-policy]
|
|
@@ -128,7 +128,7 @@ needs.
|
|
|
128
128
|
|
|
129
129
|
```yaml
|
|
130
130
|
ai:
|
|
131
|
-
model:
|
|
131
|
+
model: <provider>/<model> # one Pi has credentials for: pi --list-models
|
|
132
132
|
thinking_level: medium
|
|
133
133
|
options:
|
|
134
134
|
temperature: 0.2
|
package/docs/channels.md
CHANGED
|
@@ -186,9 +186,6 @@ send idempotency or claim exactly-once delivery.
|
|
|
186
186
|
|
|
187
187
|
```json
|
|
188
188
|
{
|
|
189
|
-
"dependencies": {
|
|
190
|
-
"@introspection-ai/recipe-channel-slack": ">=0.4.0 <1.0.0"
|
|
191
|
-
},
|
|
192
189
|
"pi": {
|
|
193
190
|
"channels": [
|
|
194
191
|
{
|
|
@@ -199,7 +196,40 @@ send idempotency or claim exactly-once delivery.
|
|
|
199
196
|
}
|
|
200
197
|
```
|
|
201
198
|
|
|
202
|
-
The channel declaration enables the provider package
|
|
199
|
+
The channel declaration enables the provider package. The Slack package is
|
|
200
|
+
one Recipes installs alongside itself (an `optionalDependencies` entry of
|
|
201
|
+
`@introspection-ai/recipes`), so the copy beside the running Recipes is used
|
|
202
|
+
when the Recipe does not list it. Declare it in `peerDependencies` by
|
|
203
|
+
default, which says so explicitly: the platform provides it.
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"peerDependencies": {
|
|
208
|
+
"@introspection-ai/recipe-channel-slack": ">=X.Y.Z"
|
|
209
|
+
},
|
|
210
|
+
"pi": {
|
|
211
|
+
"channels": [{ "provider": "slack" }]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
To pin an exact version, list it in `dependencies` instead, and the Recipe's
|
|
217
|
+
copy wins:
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"dependencies": {
|
|
222
|
+
"@introspection-ai/recipe-channel-slack": "X.Y.Z"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
`X.Y.Z` stands for a released version (`npm view @introspection-ai/recipe-channel-slack version`): a peer takes an open floor, `>=X.Y.Z`, and a pin an exact version.
|
|
228
|
+
|
|
229
|
+
A provider the host does not
|
|
230
|
+
supply must be declared: in `dependencies`, or in `peerDependencies` when the
|
|
231
|
+
platform running the Recipe provides it. The
|
|
232
|
+
declaration's optional
|
|
203
233
|
`commands` allowlist narrows the supported operations. Each agent selects the
|
|
204
234
|
tool in its YAML file:
|
|
205
235
|
|
|
@@ -221,11 +251,19 @@ the same operation. Set `targeting: true` and implement `send(ctx, {text})` to
|
|
|
221
251
|
opt into the shared targeting schema; set `list: true` and implement `list()` to
|
|
222
252
|
expose `channels list`. Omit these capabilities for origin-bound tools.
|
|
223
253
|
|
|
254
|
+
A package exports a plain descriptor, `RecipeChannelModule`, and the host
|
|
255
|
+
builds the connector from it. Everything the package needs at run time (the
|
|
256
|
+
resolved channel config, `env` and `cwd`) arrives through `createSession`, so
|
|
257
|
+
the package imports only Recipes' types and needs no run-time dependency on
|
|
258
|
+
`@introspection-ai/recipes` (keep it in `devDependencies`). `apiVersion` names
|
|
259
|
+
the contract the package was written against; the host refuses a different
|
|
260
|
+
one, naming the package, both versions and the fix.
|
|
261
|
+
|
|
224
262
|
```ts
|
|
225
|
-
import {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
263
|
+
import type {
|
|
264
|
+
ChannelAdapter,
|
|
265
|
+
ChannelConfig,
|
|
266
|
+
RecipeChannelModule,
|
|
229
267
|
} from "@introspection-ai/recipes/channels";
|
|
230
268
|
|
|
231
269
|
const capabilities = {
|
|
@@ -253,7 +291,9 @@ function targetFrom(config: ChannelConfig | null) {
|
|
|
253
291
|
};
|
|
254
292
|
}
|
|
255
293
|
|
|
256
|
-
|
|
294
|
+
const myChannel: RecipeChannelModule = {
|
|
295
|
+
kind: "channel",
|
|
296
|
+
apiVersion: 1,
|
|
257
297
|
provider: "my-channel",
|
|
258
298
|
capabilities,
|
|
259
299
|
createSession: ({ config, env }) => ({
|
|
@@ -262,7 +302,9 @@ export default createChannelConnectorModule({
|
|
|
262
302
|
// fail when called, the session does not fail to open.
|
|
263
303
|
target: () => targetFrom(config),
|
|
264
304
|
}),
|
|
265
|
-
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
export default myChannel;
|
|
266
308
|
```
|
|
267
309
|
|
|
268
310
|
The host resolves `ChannelConfig` once from the `INTROSPECTION_TASK_CHANNEL_*`
|
|
@@ -272,7 +314,9 @@ their own API fields and do not define provider-specific origin types.
|
|
|
272
314
|
Registration checks that the adapter implements every method its capabilities
|
|
273
315
|
claim, so a descriptor cannot promise a tool the adapter does not have.
|
|
274
316
|
|
|
275
|
-
The
|
|
317
|
+
The host turns the descriptor into an ordinary `RecipeConnectorModule` with
|
|
318
|
+
`createChannelConnectorModule`, which a package may still call itself if it
|
|
319
|
+
depends on Recipes. Manifest validation and agent
|
|
276
320
|
tool selection work without provider-specific code in the Recipe. The unified
|
|
277
321
|
tool is active immediately and does not require `tool_search`.
|
|
278
322
|
|
package/docs/documents.md
CHANGED
|
@@ -24,10 +24,6 @@ Agents select `tools: [documents]`.
|
|
|
24
24
|
|
|
25
25
|
```json
|
|
26
26
|
{
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@introspection-ai/recipe-documents-docx": ">=0.1.0",
|
|
29
|
-
"@introspection-ai/recipe-documents-pdf": ">=0.1.0"
|
|
30
|
-
},
|
|
31
27
|
"pi": {
|
|
32
28
|
"documents": [{ "format": "docx" }, { "format": "pdf" }]
|
|
33
29
|
}
|
|
@@ -38,9 +34,51 @@ Agents select `tools: [documents]`.
|
|
|
38
34
|
tools: [documents]
|
|
39
35
|
```
|
|
40
36
|
|
|
41
|
-
Each declaration names a format
|
|
42
|
-
`@introspection-ai/recipe-documents-<format
|
|
43
|
-
|
|
37
|
+
Each declaration names a format, served by the package
|
|
38
|
+
`@introspection-ai/recipe-documents-<format>`. Recipes installs the docx and
|
|
39
|
+
pdf packages alongside itself (they are `optionalDependencies` of
|
|
40
|
+
`@introspection-ai/recipes`), so a Recipe that does not list them uses the
|
|
41
|
+
copy beside the running Recipes, Python environment and profiles included.
|
|
42
|
+
Declare it in `peerDependencies` by default, which says so explicitly: the
|
|
43
|
+
platform provides it.
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@introspection-ai/recipe-documents-docx": ">=X.Y.Z",
|
|
49
|
+
"@introspection-ai/recipe-documents-pdf": ">=X.Y.Z"
|
|
50
|
+
},
|
|
51
|
+
"pi": {
|
|
52
|
+
"documents": [
|
|
53
|
+
{ "format": "docx", "profile": "legal-redlining-en-US" },
|
|
54
|
+
{ "format": "pdf" }
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
To pin an exact version, list the package in `dependencies` instead, and the
|
|
61
|
+
Recipe's copy wins:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"@introspection-ai/recipe-documents-docx": "X.Y.Z"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`X.Y.Z` stands for a released version (`npm view @introspection-ai/recipe-documents-docx version`): a peer takes an open floor, `>=X.Y.Z`, and a pin an exact version.
|
|
72
|
+
|
|
73
|
+
Any other format must be declared, in `dependencies` (the
|
|
74
|
+
Recipe brings it) or `peerDependencies` (the platform provides it, and the
|
|
75
|
+
runtime image build fails without it); `recipes check` and the runtime both
|
|
76
|
+
reject a declaration with neither. Whichever copy loads must implement the
|
|
77
|
+
format contract the running Recipes implements (`apiVersion`, below), and a
|
|
78
|
+
package that declares a Recipes peer range must admit the running version, or
|
|
79
|
+
the Recipe fails to load naming the package and the fix. When neither the
|
|
80
|
+
Recipe nor the Recipes install has the package, add it to `dependencies` or
|
|
81
|
+
reinstall Recipes with `introspection upgrade`. An
|
|
44
82
|
optional `commands` allowlist narrows what that format may do, for every agent:
|
|
45
83
|
|
|
46
84
|
```json
|
|
@@ -92,6 +130,14 @@ profiles/
|
|
|
92
130
|
SKILL.md
|
|
93
131
|
```
|
|
94
132
|
|
|
133
|
+
Name a profile `<use-case>-<locale>`: a kebab-case use case, which may be a
|
|
134
|
+
domain and a task (`legal-redlining`, `house-style`), then a BCP 47 locale
|
|
135
|
+
with its region (`en-US`, `en-GB`), because spelling and conventions, legal
|
|
136
|
+
ones above all, differ by region. Use the language alone (`-en`) only when
|
|
137
|
+
the guidance doesn't depend on region. The folder and the frontmatter `name`
|
|
138
|
+
are the name in lower case (`house-style-en-gb`); a `profile` declaration
|
|
139
|
+
matches it in any case.
|
|
140
|
+
|
|
95
141
|
The `SKILL.md` starts with frontmatter. `name` must be the folder's name, in
|
|
96
142
|
lower case; `description` says when to read it:
|
|
97
143
|
|
|
@@ -325,38 +371,52 @@ looked at with `read`.
|
|
|
325
371
|
## Write a format
|
|
326
372
|
|
|
327
373
|
A format supplies an adapter and a capability descriptor; it writes no tool
|
|
328
|
-
schemas.
|
|
374
|
+
schemas. It exports a plain object, `RecipeDocumentFormatModule`, and
|
|
375
|
+
everything it needs from Recipes at run time arrives through `createAdapter`,
|
|
376
|
+
so the package imports only Recipes' types and needs no run-time dependency on
|
|
377
|
+
`@introspection-ai/recipes` (keep it in `devDependencies`):
|
|
329
378
|
|
|
330
379
|
```ts
|
|
331
|
-
import {
|
|
380
|
+
import type { RecipeDocumentFormatModule } from "@introspection-ai/recipes/documents";
|
|
332
381
|
|
|
333
|
-
|
|
382
|
+
const pdf: RecipeDocumentFormatModule = {
|
|
383
|
+
kind: "documents",
|
|
384
|
+
apiVersion: 1,
|
|
334
385
|
format: "pdf",
|
|
335
386
|
extensions: [".pdf"],
|
|
336
387
|
capabilities: { read: true, render: true },
|
|
337
|
-
createAdapter: ({ env }) => new PdfDocumentAdapter(env),
|
|
338
|
-
}
|
|
388
|
+
createAdapter: ({ env, python, runHelper }) => new PdfDocumentAdapter({ env, python, runHelper }),
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export default pdf;
|
|
339
392
|
```
|
|
340
393
|
|
|
394
|
+
`apiVersion` names the contract the format was written against; the host
|
|
395
|
+
refuses a different one, naming the package, both versions and the fix.
|
|
396
|
+
`createDocumentFormatModule` from `@introspection-ai/recipes/documents` builds
|
|
397
|
+
the same object, for a format that depends on Recipes anyway.
|
|
398
|
+
|
|
341
399
|
`createAdapter` also receives `python`: the interpreter of the environment the
|
|
342
400
|
format package's own `pi.runtime.python` declares, which the host prepares
|
|
343
401
|
(see [Runtime requirements](recipe-format.md#runtime-requirements)). It is
|
|
344
402
|
absent when the package declares none; an adapter that ignores it keeps
|
|
345
403
|
working.
|
|
346
404
|
|
|
347
|
-
A Python helper runs with `
|
|
348
|
-
|
|
405
|
+
A Python helper runs with `runHelper(script, request, { env, cwd, python,
|
|
406
|
+
signal })`, which the host passes to `createAdapter`: its
|
|
407
|
+
`runDocumentHelper`. It is
|
|
349
408
|
`runPythonJson` from `@introspection-ai/recipes/python` with the document
|
|
350
409
|
contract on top: the interpreter order above, including
|
|
351
410
|
`RECIPE_DOCUMENTS_PYTHON`; a helper that prints `{ "error": "..." }` fails the
|
|
352
411
|
call with that message; and the result is a `DocumentResult` (`text`,
|
|
353
412
|
`details`, `images`) whose `details.timing.call_ms` records the round trip.
|
|
354
|
-
The Word and PDF packages
|
|
355
|
-
`documentPythonExecutable` as `pythonExecutable`.
|
|
413
|
+
The Word and PDF packages run every command through it.
|
|
356
414
|
|
|
357
415
|
Registration checks that the adapter implements every method its
|
|
358
416
|
capabilities claim, and that the adapter returns the declared capabilities.
|
|
359
|
-
A format package ships its code and its profiles (see Skills and profiles)
|
|
417
|
+
A format package ships its code and its profiles (see Skills and profiles), so
|
|
418
|
+
a profile resolves the same from the copy installed alongside Recipes as from
|
|
419
|
+
a pinned one.
|
|
360
420
|
A skill that teaches a format library, such as Paper's `docx` skill, is a
|
|
361
421
|
dependency of the Recipe that uses it, installed when the runtime is baked.
|
|
362
422
|
|
package/docs/host-api.md
CHANGED
|
@@ -98,6 +98,9 @@ It:
|
|
|
98
98
|
to prepare a session that does no work;
|
|
99
99
|
- loads the complete ordered Recipe extension closure, selected skills, and
|
|
100
100
|
package prompts;
|
|
101
|
+
- offers only the Recipe's selected skills, the `documents` tool's skills, and
|
|
102
|
+
any `additionalSkillPaths` the host passes; a skill an extension adds through
|
|
103
|
+
`resources_discover` is not offered;
|
|
101
104
|
- registers the shared subagent tool;
|
|
102
105
|
- creates and binds the Pi `AgentSession`;
|
|
103
106
|
- returns one idempotent `dispose()` boundary.
|
package/docs/interactions.md
CHANGED
package/docs/pi-extension.md
CHANGED
|
@@ -73,6 +73,47 @@ For the selected agent, the extension:
|
|
|
73
73
|
See [Recipe Format](recipe-format.md) for the authored contract and
|
|
74
74
|
[Agent composition](agent-composition.md) for inheritance and selection.
|
|
75
75
|
|
|
76
|
+
## Artifact panel
|
|
77
|
+
|
|
78
|
+
List `show_artifact` in an agent's `tools` and the agent can show the user a
|
|
79
|
+
markdown file it wrote, such as a design brief, `evals/cases/*.md` or a
|
|
80
|
+
report, rendered in a panel on the right of Pi's terminal, instead of only
|
|
81
|
+
printing its path. Agents that do not list it never see the tool or `/recipe view`.
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
tools: [read, write, edit, ask_user_question, show_artifact]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
show_artifact({ path: "evals/cases/refund.md" }) // relative to the working directory
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The tool refuses a path outside the working directory (including a symlink
|
|
92
|
+
that leads out of it), a missing file, and anything that is not `.md` or
|
|
93
|
+
`.markdown`. The panel takes the top-right 45% of the terminal at full height
|
|
94
|
+
and shows the file name and the visible line range. It opens without taking
|
|
95
|
+
the keyboard, so the user keeps typing in the editor. Showing another file
|
|
96
|
+
replaces the content, and the panel re-renders when the file changes on disk.
|
|
97
|
+
|
|
98
|
+
| Key | Where | Does |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `Alt+R` | editor or panel | Moves the keyboard to the panel and back; with no panel open, reopens the last file |
|
|
101
|
+
| `Up` / `Down`, `PgUp` / `PgDn`, `Home` / `End` | panel | Scroll |
|
|
102
|
+
| `o` | panel | Opens the file with the system's default app (`open`, `xdg-open` or `start`) |
|
|
103
|
+
| `Esc` / `q` | panel | Closes the panel |
|
|
104
|
+
|
|
105
|
+
`/recipe view <file>` opens a file the same way; `/recipe view` on its own opens
|
|
106
|
+
the last markdown file the agent showed or wrote with `write` or `edit` in this
|
|
107
|
+
session, and `/recipe close` closes the panel from the editor. They are
|
|
108
|
+
subcommands of `/recipe`, so they never clash with another extension's or your
|
|
109
|
+
own commands.
|
|
110
|
+
|
|
111
|
+
The panel exists only in Pi's interactive terminal. In print, RPC and embedded
|
|
112
|
+
sessions the tool returns `The file is at <path>. The artifact panel is only
|
|
113
|
+
available in Pi's interactive terminal, ...` so the model can tell the user
|
|
114
|
+
where to look. If a Recipe extension registers its own `show_artifact`, the
|
|
115
|
+
host keeps it and registers neither the built-in tool nor `/recipe view`.
|
|
116
|
+
|
|
76
117
|
## Structured child events
|
|
77
118
|
|
|
78
119
|
Pi's JSON mode emits root session events directly. Recipes appends one Pi
|