@introspection-ai/recipes 0.58.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/agents.d.ts +6 -0
  2. package/dist/agents.d.ts.map +1 -1
  3. package/dist/agents.js.map +1 -1
  4. package/dist/batch/files.d.ts +5 -0
  5. package/dist/batch/files.d.ts.map +1 -1
  6. package/dist/batch/files.js +39 -0
  7. package/dist/batch/files.js.map +1 -1
  8. package/dist/batch/index.d.ts +31 -7
  9. package/dist/batch/index.d.ts.map +1 -1
  10. package/dist/batch/index.js +58 -27
  11. package/dist/batch/index.js.map +1 -1
  12. package/dist/batch/lines.d.ts +51 -9
  13. package/dist/batch/lines.d.ts.map +1 -1
  14. package/dist/batch/lines.js +86 -30
  15. package/dist/batch/lines.js.map +1 -1
  16. package/dist/batch/runner.d.ts +39 -5
  17. package/dist/batch/runner.d.ts.map +1 -1
  18. package/dist/batch/runner.js +427 -52
  19. package/dist/batch/runner.js.map +1 -1
  20. package/dist/compaction.d.ts +11 -0
  21. package/dist/compaction.d.ts.map +1 -0
  22. package/dist/compaction.js +27 -0
  23. package/dist/compaction.js.map +1 -0
  24. package/dist/issues/arguments.d.ts +51 -1
  25. package/dist/issues/arguments.d.ts.map +1 -1
  26. package/dist/issues/arguments.generated.d.ts.map +1 -1
  27. package/dist/issues/arguments.generated.js +97 -0
  28. package/dist/issues/arguments.generated.js.map +1 -1
  29. package/dist/issues/module.d.ts.map +1 -1
  30. package/dist/issues/module.js +8 -1
  31. package/dist/issues/module.js.map +1 -1
  32. package/dist/issues/tool.d.ts.map +1 -1
  33. package/dist/issues/tool.js +127 -4
  34. package/dist/issues/tool.js.map +1 -1
  35. package/dist/issues/types.d.ts +40 -1
  36. package/dist/issues/types.d.ts.map +1 -1
  37. package/dist/issues/types.js +8 -1
  38. package/dist/issues/types.js.map +1 -1
  39. package/dist/judges/classifier.d.ts +8 -0
  40. package/dist/judges/classifier.d.ts.map +1 -1
  41. package/dist/judges/classifier.js +17 -0
  42. package/dist/judges/classifier.js.map +1 -1
  43. package/dist/judges/cli-main.d.ts.map +1 -1
  44. package/dist/judges/cli-main.js +3 -1
  45. package/dist/judges/cli-main.js.map +1 -1
  46. package/dist/judges/definition.d.ts +7 -0
  47. package/dist/judges/definition.d.ts.map +1 -1
  48. package/dist/judges/definition.js +5 -0
  49. package/dist/judges/definition.js.map +1 -1
  50. package/dist/judges/index.d.ts +1 -1
  51. package/dist/judges/index.d.ts.map +1 -1
  52. package/dist/judges/index.js +1 -1
  53. package/dist/judges/index.js.map +1 -1
  54. package/dist/judges/run.d.ts +7 -0
  55. package/dist/judges/run.d.ts.map +1 -1
  56. package/dist/judges/run.js +45 -8
  57. package/dist/judges/run.js.map +1 -1
  58. package/dist/judges/trajectory.d.ts +2 -11
  59. package/dist/judges/trajectory.d.ts.map +1 -1
  60. package/dist/judges/trajectory.js +1 -54
  61. package/dist/judges/trajectory.js.map +1 -1
  62. package/dist/model-binding.d.ts +2 -0
  63. package/dist/model-binding.d.ts.map +1 -1
  64. package/dist/model-binding.js +11 -0
  65. package/dist/model-binding.js.map +1 -1
  66. package/dist/prompts/budget.d.ts +28 -0
  67. package/dist/prompts/budget.d.ts.map +1 -0
  68. package/dist/prompts/budget.js +31 -0
  69. package/dist/prompts/budget.js.map +1 -0
  70. package/dist/prompts/builder.d.ts +32 -0
  71. package/dist/prompts/builder.d.ts.map +1 -0
  72. package/dist/prompts/builder.js +22 -0
  73. package/dist/prompts/builder.js.map +1 -0
  74. package/dist/prompts/builders/conversation-synthesis.d.ts +106 -0
  75. package/dist/prompts/builders/conversation-synthesis.d.ts.map +1 -0
  76. package/dist/prompts/builders/conversation-synthesis.js +495 -0
  77. package/dist/prompts/builders/conversation-synthesis.js.map +1 -0
  78. package/dist/prompts/builders/trajectory.d.ts +14 -0
  79. package/dist/prompts/builders/trajectory.d.ts.map +1 -0
  80. package/dist/prompts/builders/trajectory.js +66 -0
  81. package/dist/prompts/builders/trajectory.js.map +1 -0
  82. package/dist/prompts/fit.d.ts +7 -0
  83. package/dist/prompts/fit.d.ts.map +1 -0
  84. package/dist/prompts/fit.js +15 -0
  85. package/dist/prompts/fit.js.map +1 -0
  86. package/dist/prompts/index.d.ts +8 -0
  87. package/dist/prompts/index.d.ts.map +1 -0
  88. package/dist/prompts/index.js +8 -0
  89. package/dist/prompts/index.js.map +1 -0
  90. package/dist/prompts/registry.d.ts +8 -0
  91. package/dist/prompts/registry.d.ts.map +1 -0
  92. package/dist/prompts/registry.js +15 -0
  93. package/dist/prompts/registry.js.map +1 -0
  94. package/dist/prompts/spec.d.ts +16 -0
  95. package/dist/prompts/spec.d.ts.map +1 -0
  96. package/dist/prompts/spec.js +12 -0
  97. package/dist/prompts/spec.js.map +1 -0
  98. package/dist/prompts/template.d.ts +12 -0
  99. package/dist/prompts/template.d.ts.map +1 -0
  100. package/dist/prompts/template.js +31 -0
  101. package/dist/prompts/template.js.map +1 -0
  102. package/dist/prompts/text.d.ts +5 -0
  103. package/dist/prompts/text.d.ts.map +1 -0
  104. package/dist/prompts/text.js +13 -0
  105. package/dist/prompts/text.js.map +1 -0
  106. package/dist/recipe/agent.d.ts +11 -1
  107. package/dist/recipe/agent.d.ts.map +1 -1
  108. package/dist/recipe/agent.js +76 -1
  109. package/dist/recipe/agent.js.map +1 -1
  110. package/dist/recipe/manifest.generated.d.ts +1 -1
  111. package/dist/recipe/manifest.generated.js +1 -1
  112. package/dist/recipe/session.d.ts +5 -0
  113. package/dist/recipe/session.d.ts.map +1 -1
  114. package/dist/recipe/session.js +82 -4
  115. package/dist/recipe/session.js.map +1 -1
  116. package/dist/run-controller.d.ts.map +1 -1
  117. package/dist/run-controller.js +4 -0
  118. package/dist/run-controller.js.map +1 -1
  119. package/dist/session.d.ts.map +1 -1
  120. package/dist/session.js +2 -0
  121. package/dist/session.js.map +1 -1
  122. package/docs/agent-composition.md +3 -2
  123. package/docs/issues/README.md +34 -12
  124. package/docs/providers.md +12 -3
  125. package/docs/recipe-format.md +71 -3
  126. package/docs/recipe-judges.md +32 -4
  127. package/package.json +9 -5
  128. package/skills/issues/SKILL.md +28 -10
package/docs/providers.md CHANGED
@@ -138,9 +138,9 @@ One `issues` tool with these commands:
138
138
  | Command | Does |
139
139
  | --- | --- |
140
140
  | `search` | find issues by text, status, assignee, project or label |
141
- | `get` | one issue with its comments |
142
- | `create` | a new issue |
143
- | `update` | title, description, assignee, labels, priority |
141
+ | `get` | one issue with its comments and attachments |
142
+ | `create` | a new issue, with attachments |
143
+ | `update` | title, description, assignee, labels, priority; add or remove attachments |
144
144
  | `comment` | add a comment |
145
145
  | `transition` | move to another status |
146
146
 
@@ -166,6 +166,7 @@ later command takes:
166
166
  | `labels` | labels | labels | tags |
167
167
  | `container` | team | project and issue type | the Recipe's project |
168
168
  | `url`, `created_at`, `updated_at` | ✓ | ✓ | ✓ |
169
+ | `attachments` (`link`, `file`, `event`, `span`, each with its `id`) | links: the issue's attachments | links: the issue's remote links | every kind |
169
170
 
170
171
  The providers differ, so each declares the commands and fields it supports in
171
172
  `capabilities`, as productivity providers do:
@@ -184,6 +185,14 @@ The providers differ, so each declares the commands and fields it supports in
184
185
  name the caller's. A name or email is refused with `invalid_request`. A data
185
186
  plane whose issues have no assignee answers an assignee search with
186
187
  `not_supported` rather than list every issue.
188
+ - **Attachments:** a provider declares the kinds it takes and whether it
189
+ removes in `capabilities.attachments`, and the tool answers anything else
190
+ with `not_supported`, naming what the provider can do. Introspection takes
191
+ all four kinds, appends with dedup by identity and removes by id
192
+ (`add_attachments`, `remove_attachments` on `PATCH /v1/issues/{id}`).
193
+ Linear (`save_issue` `links`) and Jira (a remote link per item) take links
194
+ alone, append-only; Jira's file upload needs a local path the tool does not
195
+ have.
187
196
  - **Moving an issue:** `transition` takes a status name or category. Linear
188
197
  sets the state, Jira applies the workflow transition that reaches it, and
189
198
  Introspection sets `status`.
@@ -177,7 +177,26 @@ value; endpoint compatibility must be verified against the provider.
177
177
  `session` owns portable Pi session behavior. Queue modes accept `all` or
178
178
  `one-at-a-time`; `tool_execution` accepts `parallel` or `sequential`. The
179
179
  `retry`, `compaction`, and `images` use the managed runtime's corresponding Pi
180
- settings with snake_case keys. Each session gets a session-local copy of the
180
+ settings with snake_case keys. `compaction` accepts `enabled`,
181
+ `reserve_tokens`, `keep_recent_tokens`, `model_overrides` and `instructions`:
182
+
183
+ ```yaml
184
+ session:
185
+ compaction:
186
+ reserve_tokens: 16384
187
+ model_overrides:
188
+ anthropic/claude-sonnet-4-5:
189
+ reserve_tokens: 65536
190
+ instructions: Keep every open decision and the files it touches.
191
+ ```
192
+
193
+ `model_overrides` is keyed by Pi's exact, case-sensitive
194
+ `<provider>/<model_id>` and sets `reserve_tokens` or `keep_recent_tokens` for
195
+ that model. Each value falls back on its own: the model's override, then the
196
+ block's value, then Pi's default; `enabled` applies to every model.
197
+ `instructions` is a non-empty string passed as the custom instructions of every
198
+ compaction of the session, automatic or manual; a manual compaction's own
199
+ instructions follow it. Each session gets a session-local copy of the
181
200
  host's effective settings, including overrides the host applied to the
182
201
  settings manager it passes (Pi >=0.99; older Pi exposes only the file-backed
183
202
  settings and drops those overrides when it reloads the manager), with the
@@ -190,6 +209,8 @@ branch summaries, UI, shell, resource loading, persistence, networking,
190
209
  analytics, telemetry, and model-default settings are
191
210
  not portable session policy and remain host-owned or belong under `ai`.
192
211
 
212
+ `session.cache` is described in [Prompt cache](#prompt-cache).
213
+
193
214
  `tools` MUST NOT contain `agent`. The host materializes that session-generated
194
215
  tool for a session whose effective `subagents` list is non-empty and whose
195
216
  delegation depth allows it (see below).
@@ -198,6 +219,52 @@ The default agent is named `agent`. If no `agent` exists, a host MAY select the
198
219
  only declared agent. When multiple agents exist without `agent`, the caller
199
220
  MUST select one explicitly.
200
221
 
222
+ ### Prompt cache
223
+
224
+ ```yaml
225
+ session:
226
+ cache:
227
+ retention: long
228
+ warming: off
229
+ compaction:
230
+ reserve_tokens: 750000
231
+ ```
232
+
233
+ `cache.retention` is Pi's `cacheRetention` request option: `none` sends no
234
+ cache markers, `short` asks for the provider's default cache of about five
235
+ minutes, and `long` for about an hour where the model supports it, otherwise
236
+ the default. Omitted, Pi's default applies. A cache serves only a prefix that
237
+ has not changed, so content that changes every turn belongs after the history,
238
+ not in the system prompt; the [Current date](#current-date) rule keeps the
239
+ prompt the same all day for this reason.
240
+
241
+ `ai.options.cache_retention`, and `model.cache_retention` in the older
242
+ `model:` block, are deprecated spellings of `cache.retention`. Each still
243
+ applies and draws a warning. It is read as `session.cache.retention` before
244
+ inheritance, so a parent and a child may use either, and one agent MUST NOT
245
+ declare both.
246
+
247
+ `cache.warming` is Pi's `cacheWarming` setting: `off`, `streaming` or `idle`.
248
+ Pi refreshes the cache before it expires while a run streams (`streaming`) or
249
+ also between runs (`idle`), when a refresh is expected to cost less than the
250
+ rewrite it avoids; idle warming stops 30 minutes after the run's first request,
251
+ so it refreshes a `short` cache and never a `long` one. Each refresh is billed.
252
+
253
+ A large context is bounded by Pi's compaction, which runs at the end of a turn
254
+ or before a request once the context exceeds the model's window less
255
+ `compaction.reserve_tokens`. A Recipe that wants smaller cache rewrites after a
256
+ long pause sets `reserve_tokens` so that compaction starts at the context size
257
+ it is willing to rewrite.
258
+
259
+ | Code | Severity | Rule |
260
+ | --------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
261
+ | `agent.session.cache_invalid` | error | `cache` is not an object; `agent.session.cache_key_unknown` reports a key other than `retention` and `warming`. |
262
+ | `agent.session.cache.retention_invalid` | error | `retention` is not `none`, `short` or `long`. |
263
+ | `agent.session.cache.warming_invalid` | error | `warming` is not `off`, `streaming` or `idle`. |
264
+ | `agent.session.cache.retention_conflict` | error | The agent declares `session.cache.retention` and `ai.options.cache_retention` (or `model.cache_retention`). |
265
+ | `agent.ai.options.cache_retention_deprecated` | warning | The agent declares `ai.options.cache_retention`; move it to `session.cache.retention`. |
266
+ | `agent.model.cache_retention_deprecated` | warning | The agent declares `model.cache_retention`; move it to `session.cache.retention`. |
267
+
201
268
  ## First-party packages
202
269
 
203
270
  Some tools come from packages we publish: **channel tools**
@@ -638,8 +705,9 @@ The host owns:
638
705
 
639
706
  - credentials and secret resolution;
640
707
  - workspaces and filesystem isolation;
641
- - task and process lifecycle;
642
- - persistence and recovery;
708
+ - task and process lifecycle, including when an idle session ends;
709
+ - persistence and recovery, including the cache retention clock, where a
710
+ prepared compaction is stored, and how a session is restored;
643
711
  - scheduling and concurrency enforcement;
644
712
  - network protocols and user authentication;
645
713
  - telemetry export policy;
@@ -158,7 +158,8 @@ questions:
158
158
 
159
159
  `type` says when a judge runs:
160
160
 
161
- - `online`, the default: at the end of every runtime conversation.
161
+ - `online`, the default: at the end of every runtime conversation `on`
162
+ selects, or of a sample of them (see [Sampling](#sampling)).
162
163
  - `mission`: on a request leaving the sandbox, which a route in the Recipe's
163
164
  `policies/routes.yaml` names. Its answers reach the Recipe's Cedar policy
164
165
  before the request is allowed.
@@ -194,8 +195,8 @@ questions:
194
195
  describes both `true` and `false` in non-empty text.
195
196
  - `attributes` lists the request attributes the judge sees, and is empty to show
196
197
  them all.
197
- - `on` and `ai` belong to `online` judges and are rejected on a mission
198
- judge; `attributes` is rejected on online judges.
198
+ - `on`, `ai` and `sample` belong to `online` judges and are rejected on a
199
+ mission judge; `attributes` is rejected on online judges.
199
200
 
200
201
  ## Applicability
201
202
 
@@ -238,6 +239,31 @@ and `[[:alpha:]]` is a POSIX class to Rust and a nested class to JavaScript. A
238
239
  pattern the checker accepts can therefore still be refused by the runner at
239
240
  run time, where it records an error for that judgement.
240
241
 
242
+ ## Sampling
243
+
244
+ `sample` is optional on an online judge: the fraction of the conversations
245
+ `on` selects that the judge runs on, a number above 0 and at most 1. It
246
+ defaults to 1, every selected conversation.
247
+
248
+ ```yaml
249
+ name: helpful
250
+ sample: 0.1
251
+ ```
252
+
253
+ Sampling is deterministic per conversation, so a rerun, and every host that
254
+ judges the same conversation, makes the same choice. A conversation is sampled
255
+ when `h / 2^48 < sample`, where `h` is the first six bytes, read as a
256
+ big-endian unsigned integer, of the SHA-256 of
257
+ `<judge id>:<conversation id>`. The judge id is the platform's id for the
258
+ judge, or its name where the host has none. It is part of the key, so two
259
+ judges that each sample a tenth of conversations do not pick the same tenth;
260
+ renaming a judge draws a new sample. A sampling rate the platform sets for a
261
+ judge replaces `sample`. Only production conversations are sampled.
262
+
263
+ A conversation the sample leaves out records no verdict; it is not
264
+ `not_applicable`, which only `on` produces. An eval run judges every trial it
265
+ asks a judge for, whatever its `sample`.
266
+
241
267
  ## Diagnostics
242
268
 
243
269
  Invalid Recipe content is reported through the normal diagnostics model. Judge
@@ -245,4 +271,6 @@ diagnostics use stable `judge.*` codes, Recipe-relative source paths, useful
245
271
  help text, and deterministic ordering. YAML syntax failures use
246
272
  `judge.yaml_malformed` and include a 1-based source span when the parser
247
273
  provides one. An invalid mission judge reports `judge.mission_invalid`, and a
248
- `type` other than `online` and `mission` reports `judge.type_invalid`.
274
+ `type` other than `online` and `mission` reports `judge.type_invalid`. A
275
+ `sample` that is not a number above 0 and at most 1 reports
276
+ `judge.sample_invalid`; on a mission judge it reports `judge.mission_invalid`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@introspection-ai/recipes",
3
- "version": "0.58.0",
3
+ "version": "0.59.0",
4
4
  "description": "The open format for vertical agents, built on Pi.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -65,6 +65,10 @@
65
65
  "types": "./dist/batch/index.d.ts",
66
66
  "import": "./dist/batch/index.js"
67
67
  },
68
+ "./prompts": {
69
+ "types": "./dist/prompts/index.d.ts",
70
+ "import": "./dist/prompts/index.js"
71
+ },
68
72
  "./judges": {
69
73
  "types": "./dist/judges/index.d.ts",
70
74
  "import": "./dist/judges/index.js"
@@ -146,10 +150,10 @@
146
150
  "@introspection-ai/recipe-productivity-microsoft": ">=0.1.0",
147
151
  "@introspection-ai/recipe-search": ">=0.1.0",
148
152
  "@introspection-ai/recipe-signature": ">=0.1.0",
149
- "@introspection-ai/mcp-client-linux-x64": "0.58.0",
150
- "@introspection-ai/mcp-client-linux-arm64": "0.58.0",
151
- "@introspection-ai/mcp-client-darwin-arm64": "0.58.0",
152
- "@introspection-ai/mcp-client-darwin-x64": "0.58.0"
153
+ "@introspection-ai/mcp-client-linux-x64": "0.59.0",
154
+ "@introspection-ai/mcp-client-linux-arm64": "0.59.0",
155
+ "@introspection-ai/mcp-client-darwin-arm64": "0.59.0",
156
+ "@introspection-ai/mcp-client-darwin-x64": "0.59.0"
153
157
  },
154
158
  "peerDependencies": {
155
159
  "@earendil-works/pi-agent-core": ">=1.1.0 <2.0.0",
@@ -27,14 +27,14 @@ leave it out.
27
27
 
28
28
  ## The commands
29
29
 
30
- | Command | Takes |
31
- | ------------ | ---------------------------------------------------------------------------------------------- |
32
- | `search` | `query`, `status`, `assignee`, `container`, `label`, `limit` (1-50, default 20) |
33
- | `get` | `handle`; returns the issue with its comments |
34
- | `create` | `title` (required), `description`, `priority`, `labels`, `assignee`, `container`, `issue_type` |
35
- | `update` | `handle`, and at least one of `title`, `description`, `priority`, `labels`, `assignee` |
36
- | `comment` | `handle`, `body` (markdown) |
37
- | `transition` | `handle`, `status` |
30
+ | Command | Takes |
31
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------- |
32
+ | `search` | `query`, `status`, `assignee`, `container`, `label`, `limit` (1-50, default 20) |
33
+ | `get` | `handle`; returns the issue with its comments and attachments |
34
+ | `create` | `title` (required), `description`, `priority`, `labels`, `assignee`, `container`, `issue_type`, `attachments` |
35
+ | `update` | `handle`, and at least one of `title`, `description`, `priority`, `labels`, `assignee`, `add_attachments`, `remove_attachments` |
36
+ | `comment` | `handle`, `body` (markdown) |
37
+ | `transition` | `handle`, `status` |
38
38
 
39
39
  - `description` and `body` are markdown.
40
40
  - `labels` on `update` replaces the whole set: `get` the issue first and pass the labels
@@ -45,6 +45,24 @@ leave it out.
45
45
  default. `issue_type` is Jira's alone.
46
46
  - `update` never changes the status. Use `transition` for that.
47
47
 
48
+ ## Attachments
49
+
50
+ An attachment is evidence on an issue, one object per item, by `kind`:
51
+
52
+ - `link`: `url` (http or https), optional `title`
53
+ - `file`: `file_id` (a data plane file), optional `name`
54
+ - `event`: `event_id`
55
+ - `span`: `trace_id` (32 hex) and `span_id` (16 hex)
56
+
57
+ `create` takes them as `attachments`; `update` appends `add_attachments` and removes
58
+ `remove_attachments`, a list of attachment ids. Ids come from `get`, which lists each
59
+ attachment with its id. Adding never replaces what is there, so send only the new item;
60
+ Introspection skips one the issue already holds (the same url, file, event or span).
61
+
62
+ Introspection takes every kind and removes. Linear and Jira take `link` alone and cannot
63
+ remove one. A file, event or span is `not_supported` there: mention it in a comment
64
+ instead.
65
+
48
66
  ## Statuses and priorities
49
67
 
50
68
  `status` (on `search` and `transition`) is the tracker's own status name, or one of the
@@ -98,8 +116,8 @@ The error names a code:
98
116
  - `not_connected`: the tracker is not connected for this person, or the runtime has no
99
117
  credential for it. Ask the person to connect it (with `introspection_open` where it is
100
118
  offered); don't retry.
101
- - `not_supported`: this provider does not serve that command or field. Leave the field
102
- out, or tell the person.
119
+ - `not_supported`: this provider does not serve that command, field or attachment kind.
120
+ Leave it out, or tell the person.
103
121
  - `not_found`: the handle no longer names an issue. Search again.
104
122
  - `invalid_request`: fix the arguments the message names (a missing title, a bad
105
123
  priority, a status the tracker does not have, several providers on offer).