@introspection-ai/recipes 0.36.2 → 0.38.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/dist/ask-user-question.d.ts +82 -0
- package/dist/ask-user-question.d.ts.map +1 -0
- package/dist/ask-user-question.js +314 -0
- package/dist/ask-user-question.js.map +1 -0
- package/dist/connector-tools.d.ts.map +1 -1
- package/dist/connector-tools.js +10 -2
- package/dist/connector-tools.js.map +1 -1
- package/dist/documents/index.d.ts +7 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +4 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/module.d.ts +61 -0
- package/dist/documents/module.d.ts.map +1 -0
- package/dist/documents/module.js +133 -0
- package/dist/documents/module.js.map +1 -0
- package/dist/documents/profile.d.ts +34 -0
- package/dist/documents/profile.d.ts.map +1 -0
- package/dist/documents/profile.js +94 -0
- package/dist/documents/profile.js.map +1 -0
- package/dist/documents/tools.d.ts +40 -0
- package/dist/documents/tools.d.ts.map +1 -0
- package/dist/documents/tools.js +327 -0
- package/dist/documents/tools.js.map +1 -0
- package/dist/documents/types.d.ts +144 -0
- package/dist/documents/types.d.ts.map +1 -0
- package/dist/documents/types.js +10 -0
- package/dist/documents/types.js.map +1 -0
- package/dist/extensions.d.ts +2 -0
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +3 -0
- package/dist/extensions.js.map +1 -1
- package/dist/interaction-tui.d.ts +1 -1
- package/dist/interaction-tui.d.ts.map +1 -1
- package/dist/interaction-tui.js +2 -2
- package/dist/interaction-tui.js.map +1 -1
- package/dist/mcp-chunks/{auth-command-GMMLBU24.js → auth-command-M7TQE3AL.js} +26 -23
- package/dist/mcp-chunks/call-arguments-GCXZA4HC.js +16 -0
- package/dist/mcp-chunks/{call-command-2VF6IKAZ.js → call-command-7LD7UEFK.js} +33 -33
- package/dist/mcp-chunks/{chunk-TYL2NVXI.js → chunk-2AKSS7WR.js} +2 -2
- package/dist/mcp-chunks/{chunk-LZUKBEQZ.js → chunk-2YV72LUA.js} +12 -12
- package/dist/mcp-chunks/{chunk-2JTXIMGE.js → chunk-3ETUDW7N.js} +1 -1
- package/dist/mcp-chunks/{chunk-5UK2JLTN.js → chunk-3FRLDHVD.js} +5 -5
- package/dist/mcp-chunks/{chunk-ENBJFQ6H.js → chunk-3HSC6NHZ.js} +1 -1
- package/dist/mcp-chunks/{chunk-IHOU2BEL.js → chunk-3LENTPGE.js} +2 -2
- package/dist/mcp-chunks/{chunk-ZJWZY54X.js → chunk-3P3KGT4H.js} +2 -2
- package/dist/mcp-chunks/{chunk-IMXPLUKE.js → chunk-3SXP4S2A.js} +2 -2
- package/dist/mcp-chunks/{chunk-22WCLO4D.js → chunk-5Z6WSV5D.js} +5 -5
- package/dist/mcp-chunks/{chunk-QNZGFUKC.js → chunk-63L6SHK3.js} +2 -2
- package/dist/mcp-chunks/{chunk-OI3RTQXY.js → chunk-66VSGFXA.js} +1 -1
- package/dist/mcp-chunks/{chunk-DUBQHYW4.js → chunk-6O42UGLI.js} +9 -9
- package/dist/mcp-chunks/{chunk-R4OYHQ4V.js → chunk-6P3KAQ5N.js} +1 -1
- package/dist/mcp-chunks/{chunk-5OO6WVPL.js → chunk-7U5NSQ5T.js} +1 -1
- package/dist/mcp-chunks/{chunk-O2C3HXGS.js → chunk-B6S43WID.js} +1 -1
- package/dist/mcp-chunks/{chunk-VWPKJFK4.js → chunk-BHXCAVFP.js} +1 -1
- package/dist/mcp-chunks/{chunk-WXNGATQ7.js → chunk-BUOGKTKK.js} +2 -1
- package/dist/mcp-chunks/{chunk-4U4BUXQD.js → chunk-CXST5CVH.js} +33 -17
- package/dist/mcp-chunks/{chunk-YWFQPA4D.js → chunk-DU4SDPEV.js} +2 -2
- package/dist/mcp-chunks/{chunk-ZI5XYM4C.js → chunk-E76ZUBOJ.js} +4 -4
- package/dist/mcp-chunks/{chunk-D2SZ7KRY.js → chunk-ELHS763C.js} +1 -1
- package/dist/mcp-chunks/chunk-EQCSXVQ7.js +10650 -0
- package/dist/mcp-chunks/{chunk-RHXZKYM7.js → chunk-F2X4Y2TQ.js} +1 -1
- package/dist/mcp-chunks/{chunk-6XC5JJWD.js → chunk-GTETFUPQ.js} +28 -25
- package/dist/mcp-chunks/{chunk-UQUM7ICD.js → chunk-GZ53GNFP.js} +10 -10
- package/dist/mcp-chunks/{chunk-LUVLTUKR.js → chunk-H5PBSJP3.js} +1 -1
- package/dist/mcp-chunks/{chunk-FLUF2FRN.js → chunk-HNQSUT44.js} +3 -3
- package/dist/mcp-chunks/{chunk-CN5KSNWG.js → chunk-I6UFV7RW.js} +1 -1
- package/dist/mcp-chunks/{chunk-OSTHIELS.js → chunk-IRARVOUM.js} +1 -1
- package/dist/mcp-chunks/{webapi-NNCZGUMZ.js → chunk-IRSL7JRH.js} +255 -249
- package/dist/mcp-chunks/{chunk-ZXIF7MKN.js → chunk-IWCVZ46B.js} +2 -2
- package/dist/mcp-chunks/{chunk-RZZO3ZD4.js → chunk-JEHI2YU4.js} +3 -3
- package/dist/mcp-chunks/{chunk-ANNJGB6F.js → chunk-JTPTAO4M.js} +13 -13
- package/dist/mcp-chunks/{chunk-U5QZHPCC.js → chunk-KJ5FPQF6.js} +1 -1
- package/dist/mcp-chunks/{chunk-7IVXKYTI.js → chunk-L2MSWQDL.js} +1 -1
- package/dist/mcp-chunks/{chunk-DBNBEWRX.js → chunk-MEQXX43K.js} +1 -1
- package/dist/mcp-chunks/{chunk-3AAF3FSI.js → chunk-MHUMLEBO.js} +1 -1
- package/dist/mcp-chunks/{chunk-HFHIY5TO.js → chunk-N2U2FODH.js} +4 -4
- package/dist/mcp-chunks/{chunk-YFCNRWLV.js → chunk-N6YUOYDS.js} +2 -2
- package/dist/mcp-chunks/{chunk-C4TJGC4F.js → chunk-O3RTM5HD.js} +1 -1
- package/dist/mcp-chunks/{chunk-35LLRCRA.js → chunk-O7SIXJM6.js} +1308 -912
- package/dist/mcp-chunks/{chunk-QDFL757K.js → chunk-PSE442BC.js} +91 -77
- package/dist/mcp-chunks/{chunk-YPSODIQX.js → chunk-QNXOIF5U.js} +15 -14
- package/dist/mcp-chunks/{chunk-RKQC2EE6.js → chunk-RUF27IUF.js} +2 -2
- package/dist/mcp-chunks/{chunk-SS7V7GVT.js → chunk-S2F7DDP5.js} +4 -4
- package/dist/mcp-chunks/{chunk-D65GOMYV.js → chunk-TC2JPBFB.js} +2 -2
- package/dist/mcp-chunks/{chunk-7BVYBZ4J.js → chunk-THRMUZZD.js} +39 -14
- package/dist/mcp-chunks/{chunk-P5YLK5G2.js → chunk-UFV6SVQG.js} +11 -11
- package/dist/mcp-chunks/{chunk-LISNXOIQ.js → chunk-US63Y6XE.js} +1 -1
- package/dist/mcp-chunks/{chunk-HI6VG5LR.js → chunk-UVRJ3AAD.js} +2 -2
- package/dist/mcp-chunks/{chunk-6TIU2CDB.js → chunk-V42T3QNK.js} +456 -64
- package/dist/mcp-chunks/{chunk-347GOMV4.js → chunk-WDWSA7RL.js} +4 -4
- package/dist/mcp-chunks/{chunk-4PN2J74H.js → chunk-WQL7FJQ3.js} +4 -4
- package/dist/mcp-chunks/{chunk-LRGMFF5S.js → chunk-ZEA3Y5ZD.js} +7 -7
- package/dist/mcp-chunks/{cli-4OQD3H4N.js → cli-IYD7Y7MO.js} +67 -67
- package/dist/mcp-chunks/client-5MNBV3Z7.js +32 -0
- package/dist/mcp-chunks/{config-command-72TCIWPV.js → config-command-6DXILFNO.js} +129 -34
- package/dist/mcp-chunks/daemon-command-V3B3EMXD.js +32 -0
- package/dist/mcp-chunks/{dist-74UCKZK5.js → dist-Q7WSCBBK.js} +74 -55
- package/dist/mcp-chunks/{emit-ts-command-KD4ON2SE.js → emit-ts-command-NDCDFDRM.js} +17 -17
- package/dist/mcp-chunks/{generate-cli-runner-HWGI6HPL.js → generate-cli-runner-PW5WJ7KI.js} +136 -92
- package/dist/mcp-chunks/generated-daemon-runtime-3C4NWGAU.js +32 -0
- package/dist/mcp-chunks/{inspect-cli-command-FT5JSB7V.js → inspect-cli-command-4MGF5CPP.js} +9 -9
- package/dist/mcp-chunks/{launch-AHLKP2VM.js → launch-UG7IH27P.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-BJDITFWN.js → lifecycle-QBYGUHQ3.js} +1 -1
- package/dist/mcp-chunks/{list-command-YKF7RN6Y.js → list-command-SDITI3ZM.js} +36 -35
- package/dist/mcp-chunks/{output-utils-LYB5IJRD.js → output-utils-YTMZTA7J.js} +3 -3
- package/dist/mcp-chunks/{prompt-CH6TK0bC-B3USYOND.js → prompt-DkftHXS7-N7UENQ4C.js} +1 -1
- package/dist/mcp-chunks/{record-command-MJW3Z5E5.js → record-command-JGTMATYI.js} +5 -5
- package/dist/mcp-chunks/{replay-command-5ZHBUOLE.js → replay-command-S2VAC4RW.js} +6 -6
- package/dist/mcp-chunks/{resource-command-L4I24AX5.js → resource-command-SRFQQROJ.js} +9 -9
- package/dist/mcp-chunks/{result-utils-5WRI66KV.js → result-utils-JASGNHXK.js} +3 -3
- package/dist/mcp-chunks/runtime-RMI3XCYJ.js +39 -0
- package/dist/mcp-chunks/{runtime-wrapper-WFMNIHD5.js → runtime-wrapper-7HYO3NM5.js} +3 -3
- package/dist/mcp-chunks/{serve-command-KNCSJUXS.js → serve-command-UF5SVREV.js} +1111 -697
- package/dist/mcp-chunks/{timeouts-2ZHGSB3R.js → timeouts-BJWDJEMH.js} +3 -3
- package/dist/mcp-chunks/{vault-command-7EDL45AA.js → vault-command-EYOIFWEY.js} +5 -4
- package/dist/mcp-chunks/webapi-WMMA3OEC.js +82 -0
- package/dist/mcp-daemon.js +28 -27
- package/dist/mcp-run-worker.js +28 -27
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +6 -0
- package/dist/pi-extension.js.map +1 -1
- package/dist/recipe/package.d.ts +15 -0
- package/dist/recipe/package.d.ts.map +1 -1
- package/dist/recipe/package.js +96 -2
- package/dist/recipe/package.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +6 -0
- package/dist/session.js.map +1 -1
- package/docs/documents.md +344 -0
- package/docs/index.md +1 -0
- package/docs/interactions.md +76 -8
- package/docs/mcp-configuration.md +10 -5
- package/docs/recipe-format.md +69 -1
- package/documents/SKILL.md +63 -0
- package/package.json +16 -11
- package/dist/mcp-chunks/call-arguments-WSURHOLV.js +0 -16
- package/dist/mcp-chunks/chunk-BIVX2WFX.js +0 -3349
- package/dist/mcp-chunks/client-LXKCCVMT.js +0 -31
- package/dist/mcp-chunks/daemon-command-QHS3ACBM.js +0 -31
- package/dist/mcp-chunks/generated-daemon-runtime-7ORS5KBR.js +0 -31
- package/dist/mcp-chunks/runtime-IKWDQLZF.js +0 -38
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
# Document tools
|
|
2
|
+
|
|
3
|
+
A Recipe that reads or marks up documents declares the **document formats** it
|
|
4
|
+
works with. The host then registers one `documents` tool with a `command`
|
|
5
|
+
discriminator, shaped identically for every format. Each format is a package
|
|
6
|
+
that supplies the mechanics and a capability descriptor; the commands, their
|
|
7
|
+
schemas and the rules about where files may be written live in the host.
|
|
8
|
+
|
|
9
|
+
Two properties follow, as for [channels](channels.md):
|
|
10
|
+
|
|
11
|
+
- **A command a format cannot support is absent for that format, not
|
|
12
|
+
failing.** Each format package declares what it supports, and the tool
|
|
13
|
+
routes by file extension. `render` exists when some declared format
|
|
14
|
+
renders; calling it on a `.docx` fails before any work and names the
|
|
15
|
+
formats that support it.
|
|
16
|
+
- **The original is never changed.** Every write takes the document to read
|
|
17
|
+
(`path`) and a new file under `outputs/` to save (`output`). Later calls
|
|
18
|
+
edit that saved file in place by passing it as `path`. The tool refuses to
|
|
19
|
+
write outside `outputs/` or over a file it did not save.
|
|
20
|
+
|
|
21
|
+
Agents select `tools: [documents]`.
|
|
22
|
+
|
|
23
|
+
## Declare document formats
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@introspection-ai/recipe-documents-docx": ">=0.1.0 <1.0.0",
|
|
29
|
+
"@introspection-ai/recipe-documents-pdf": ">=0.1.0 <1.0.0"
|
|
30
|
+
},
|
|
31
|
+
"pi": {
|
|
32
|
+
"documents": [{ "format": "docx" }, { "format": "pdf" }]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
tools: [documents]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Each declaration names a format; the package
|
|
42
|
+
`@introspection-ai/recipe-documents-<format>` must be a dependency, and
|
|
43
|
+
`recipes check` and the runtime both reject a declaration without it. An
|
|
44
|
+
optional `commands` allowlist narrows what that format may do, for every agent:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{ "pi": { "documents": [{ "format": "docx", "commands": ["read", "comment"] }] } }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`read` is always available for a declared format; an empty list disables the
|
|
51
|
+
format. Unknown commands fail `recipes check`; a command the format does not
|
|
52
|
+
support fails when the runtime loads the package.
|
|
53
|
+
|
|
54
|
+
Unlike channels, where each provider owns its own `channels` tool, formats
|
|
55
|
+
share one tool: a Recipe reads a PDF brief and edits a Word contract in the
|
|
56
|
+
same turn, and two `documents` tools would collide.
|
|
57
|
+
|
|
58
|
+
## Skills and profiles
|
|
59
|
+
|
|
60
|
+
Every agent that selects `documents` is offered a core `documents` skill: which
|
|
61
|
+
command fits which change, how to quote, and what each failure means. It is
|
|
62
|
+
generic, with nothing about any one kind of work.
|
|
63
|
+
|
|
64
|
+
A **profile** is a skill for one kind of work, offered beside the core skill.
|
|
65
|
+
A declaration selects at most one, either shipped by the format, by name, or the
|
|
66
|
+
Recipe's own, by a relative path:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{ "pi": { "documents": [{ "format": "docx", "profile": "legal-redlining-en-US" }] } }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{ "pi": { "documents": [{ "format": "docx", "profile": "./profiles/house-style-en-gb" }] } }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The docx package ships `legal-redlining-en-US`
|
|
77
|
+
(`packages/documents/docx/profiles/`): planning a first markup of a contract,
|
|
78
|
+
answering the other side's redline with counters and replies, and writing each
|
|
79
|
+
rationale in your side's voice. A name matches regardless of case.
|
|
80
|
+
|
|
81
|
+
A profile changes what the agent is told, never what the tool does: commands,
|
|
82
|
+
schemas and the path policy are the same with or without one. Nothing in a
|
|
83
|
+
profile runs; it is only read.
|
|
84
|
+
|
|
85
|
+
### Write your own profile
|
|
86
|
+
|
|
87
|
+
A profile is a folder holding a `SKILL.md`, anywhere inside the Recipe:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
profiles/
|
|
91
|
+
house-style-en-gb/
|
|
92
|
+
SKILL.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The `SKILL.md` starts with frontmatter. `name` must be the folder's name, in
|
|
96
|
+
lower case; `description` says when to read it:
|
|
97
|
+
|
|
98
|
+
```markdown
|
|
99
|
+
---
|
|
100
|
+
name: house-style-en-gb
|
|
101
|
+
description: How we edit internal memos in Word. Read it with the documents skill before changing a memo.
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
# Editing memos
|
|
105
|
+
|
|
106
|
+
This profile layers on the core `documents` skill.
|
|
107
|
+
|
|
108
|
+
## When it applies
|
|
109
|
+
Internal memos and policies in Word. Not contracts: those go to legal.
|
|
110
|
+
|
|
111
|
+
## Planning
|
|
112
|
+
Read the whole memo first. Change only what's wrong or unclear; keep the
|
|
113
|
+
author's structure and voice.
|
|
114
|
+
|
|
115
|
+
## Making the changes
|
|
116
|
+
- Rewrite a paragraph with `revise`: its `paragraph` id, its full new `text`,
|
|
117
|
+
and a `rationale`.
|
|
118
|
+
- Fix a word or a figure with `propose_edits`, quoting from a fresh `read`.
|
|
119
|
+
- Raise a question without changing the text with `comment`.
|
|
120
|
+
|
|
121
|
+
## Comments
|
|
122
|
+
Each rationale says why in one sentence, in plain British English. Never
|
|
123
|
+
narrate the edit; the tracked change already shows it.
|
|
124
|
+
|
|
125
|
+
## When an edit fails
|
|
126
|
+
Fix that edit from its reason and the closest text, and resubmit only it. After
|
|
127
|
+
two failures, list it for the author instead.
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Then point the declaration at the folder, or at its `SKILL.md`. The path must
|
|
131
|
+
stay inside the Recipe, by its real path too: a symlink to a folder outside it
|
|
132
|
+
is refused.
|
|
133
|
+
|
|
134
|
+
What a profile should say:
|
|
135
|
+
|
|
136
|
+
- **When it applies,** and when it doesn't, so the agent reads it at the right time.
|
|
137
|
+
- **How to plan the work** before editing: what to change, what to leave alone.
|
|
138
|
+
- **Which `documents` commands to use for which change,** and how: `revise` for
|
|
139
|
+
rewriting paragraphs, `propose_edits` for small fixes, `comment`, `respond`,
|
|
140
|
+
`remove_section`.
|
|
141
|
+
- **How to write rationales and comments:** voice, length, what they explain.
|
|
142
|
+
- **What to do when an edit fails,** and when to stop and hand it to a person.
|
|
143
|
+
|
|
144
|
+
What belongs in the Recipe's own skills instead: a team's or a client's
|
|
145
|
+
positions, playbooks, approvals and facts about a deal. A profile describes a
|
|
146
|
+
kind of work; the Recipe knows the particular case.
|
|
147
|
+
|
|
148
|
+
`recipes check` validates the shape: a name, or a relative path inside the
|
|
149
|
+
Recipe. For a path it also checks that the `SKILL.md` exists, resolves inside
|
|
150
|
+
the Recipe, and has a matching `name` and a `description`. A name the format
|
|
151
|
+
doesn't ship fails when the Recipe loads, with the names it does ship.
|
|
152
|
+
|
|
153
|
+
## Commands
|
|
154
|
+
|
|
155
|
+
| Command (`documents` + `command`) | Arguments | Requires |
|
|
156
|
+
| --- | --- | --- |
|
|
157
|
+
| `read` | `path`, `offset?`, `budget?`, `pages?`, `tables?` | always |
|
|
158
|
+
| `revise` | `path`, `output?`, `author`, `revisions[]` (`paragraph`, `text`, `rationale`) | `revise` |
|
|
159
|
+
| `propose_edits` | `path`, `output?`, `author`, `edits[]` | `proposeEdits` |
|
|
160
|
+
| `comment` | `path`, `output?`, `author`, `text`, and `quote` (`paragraph?`, `near?`, `occurrence?`) or `thread` | `comment` |
|
|
161
|
+
| `respond` | `path`, `output?`, `author`, `responses[]` | `respond` |
|
|
162
|
+
| `remove_section` | `path`, `output?`, `author`, `from`, `through`, `keep?`, `rationale` | `removeSection` |
|
|
163
|
+
| `render` | `path`, `pages?` | `render` |
|
|
164
|
+
|
|
165
|
+
An edit is `{ op: "replace" | "delete" | "insert_after", quote, paragraph?,
|
|
166
|
+
near?, occurrence?, new?, rationale }`. A response is `{ action: "accept" |
|
|
167
|
+
"reject", changes }`, `{ action: "reply", thread, text }` or `{ action:
|
|
168
|
+
"counter", quote, new, rationale, paragraph?, near?, occurrence?, thread? }`.
|
|
169
|
+
|
|
170
|
+
Results are compact text for the model: a write reports each edit as applied,
|
|
171
|
+
with a one-line before/after, or failed, with a reason and the closest
|
|
172
|
+
candidate paragraphs. It never returns the whole document; `read` does that.
|
|
173
|
+
|
|
174
|
+
## What each format registers
|
|
175
|
+
|
|
176
|
+
| Command | docx (`@introspection-ai/recipe-documents-docx`) | PDF (`@introspection-ai/recipe-documents-pdf`) |
|
|
177
|
+
| --- | --- | --- |
|
|
178
|
+
| `read` | Paragraphs with stable ids (`p-031`, `p-012.r2c3` in tables) and their current text, Word's list numbers, a `markup:` line with tracked changes and comments by author, then numbered changes and comment threads. Paged by paragraph. | The path used (text, tables or page images), then pypdfium2's text page by page in reading order, filled form fields and page comments. `tables: true` adds table cells with the `tables` extra. Pages with no text layer are named, to render. Paged by character. |
|
|
179
|
+
| `revise` | Each paragraph's revised text: on a file with no pending changes, untracked edits on a working copy and paper-docx `compare(granularity="word")` build the redline; if compare refuses the batch, or the file already has changes, the same word-level changes go in as targeted tracked edits. The rationale is a comment on the changed text. | not registered |
|
|
180
|
+
| `propose_edits` | Tracked changes signed by `author`, each with its rationale as a comment, saved with `patch_save` | not registered |
|
|
181
|
+
| `comment` | New comment on a quote, or a reply under a thread's first comment | not registered |
|
|
182
|
+
| `respond` | Accept or reject by change number (tracked moves resolve as a pair), reply, or counter | not registered |
|
|
183
|
+
| `remove_section` | Strikes the paragraphs, leaves `Reserved.` after `keep`, keeps numbering | not registered |
|
|
184
|
+
| `render` | not registered | PNG files of pages, at most 10 per call; returns their paths for Pi's `read` tool |
|
|
185
|
+
|
|
186
|
+
### docx: revise or propose_edits
|
|
187
|
+
|
|
188
|
+
`revise` takes no quotes: the agent gives a paragraph id and that paragraph's
|
|
189
|
+
full revised text, and the tool works out the changed words. It is the path for
|
|
190
|
+
a first markup, where most failures in practice came from quoting. One
|
|
191
|
+
`compare` runs per batch; on a contract full of proofing marks and layout hints
|
|
192
|
+
it often refuses, and the batch then takes the tracked path, which handles those
|
|
193
|
+
marks. `propose_edits` remains for small fixes and response turns, where an edit
|
|
194
|
+
sits inside someone else's change. A revision whose text is unchanged becomes a
|
|
195
|
+
comment on that paragraph, and a revision without a rationale fails alone rather
|
|
196
|
+
than failing the batch's schema check.
|
|
197
|
+
|
|
198
|
+
`compare` is used only when its result keeps the body's block structure:
|
|
199
|
+
paper-docx 0.2.0 inserts empty paragraphs for some multi-paragraph batches, which
|
|
200
|
+
would move every later paragraph id, so such a result is discarded for the
|
|
201
|
+
tracked path.
|
|
202
|
+
|
|
203
|
+
### docx: anchors
|
|
204
|
+
|
|
205
|
+
A quote is matched against the paragraph's current text, the text `read`
|
|
206
|
+
shows. Matching forgives runs of whitespace, non-breaking and thin spaces,
|
|
207
|
+
curly quotes and apostrophes, dashes and soft hyphens, then case. When a
|
|
208
|
+
quote only matches without a leading list number such as `5.2` or `(a)`, the
|
|
209
|
+
number is ignored and the result says so. `paragraph` restricts the search to
|
|
210
|
+
one paragraph; `near` ranks repeats by distance to nearby text; `occurrence`
|
|
211
|
+
picks the nth.
|
|
212
|
+
|
|
213
|
+
The edit lands on the original runs. Unchanged words at either end of the
|
|
214
|
+
quote are kept out of the change, compared after the same folding, so retyping
|
|
215
|
+
a curly quote as a straight one does not strike it. A replacement is written
|
|
216
|
+
as a deletion of the old words and an insertion of the new ones, so Word shows
|
|
217
|
+
whole words rather than paper-docx's letter-level alignment. A span that
|
|
218
|
+
crosses a bookmark, proofing mark, layout hint (`lastRenderedPageBreak`), the
|
|
219
|
+
edge of a tracked change, a tab, a line break or a no-break hyphen is edited in
|
|
220
|
+
parts between the marks; a tab, break or hyphen stays as it was. paper-docx does
|
|
221
|
+
not match text across a tracked deletion, so the same split applies to finding
|
|
222
|
+
text. When the parts are refused too, the result is `crosses_marker`, naming the
|
|
223
|
+
marks and the safe parts. The tool never retries by widening an edit.
|
|
224
|
+
|
|
225
|
+
A failed anchor is reported, never guessed: `not_found` (with the closest
|
|
226
|
+
paragraphs and their most similar text), `ambiguous` (with every match),
|
|
227
|
+
`paragraph_not_found`, `occurrence_out_of_range`, `unaddressable` (inside a
|
|
228
|
+
field, content control or text box), or `refused` with the library's reason.
|
|
229
|
+
The failed edit is rolled back and the rest of the batch still applies.
|
|
230
|
+
|
|
231
|
+
The anchoring and the `Reserved.` removal follow RedlineBench's redline
|
|
232
|
+
engine (MIT, Crosby Legal; the licence ships beside the helpers).
|
|
233
|
+
|
|
234
|
+
### docx: not registered
|
|
235
|
+
|
|
236
|
+
`render` is absent for Word: page images need a layout engine such as
|
|
237
|
+
LibreOffice, which the runtime image does not carry. Table structure, fields,
|
|
238
|
+
content controls, headers and footers, footnotes and formatting changes are
|
|
239
|
+
not commands. For those, the package ships the `docx` skill: Paper's public
|
|
240
|
+
`docx` skill and paper-docx 0.2.0 API reference, vendored at a pinned commit
|
|
241
|
+
with its MIT notice and with its install instructions replaced, offered to
|
|
242
|
+
any agent that selects `documents` with the docx format. It is a fallback
|
|
243
|
+
reference, not the primary path.
|
|
244
|
+
|
|
245
|
+
### PDF: text, tables and page images
|
|
246
|
+
|
|
247
|
+
Every PDF `read` starts with `Path:` and the route it took:
|
|
248
|
+
|
|
249
|
+
- **text**: pypdfium2's text for each page, in reading order. This is the
|
|
250
|
+
default and suits prose: on legal deal briefs it got every key fact in about
|
|
251
|
+
5 ms a brief, against about 55 ms for pypdf.
|
|
252
|
+
- **tables**: with `tables: true`, each table also comes back as rows of cells
|
|
253
|
+
from pdfplumber. Ask for tables on contracts with fee schedules, SLA grids or
|
|
254
|
+
price tables: plain text runs a row's cells together, and pdfplumber was the
|
|
255
|
+
only library tried that returned a fee table as real cells. It needs the
|
|
256
|
+
adapter's `tables` extra (below); without it, `read` returns the text and a
|
|
257
|
+
note that the extra is missing.
|
|
258
|
+
- **page images (no text layer)**: a page with no text is a scan. `read` names
|
|
259
|
+
those pages and suggests `render`, which writes each page as a PNG file and
|
|
260
|
+
returns its path; the agent opens it with Pi's `read` tool. Render also to
|
|
261
|
+
check signatures, stamps, charts or layout.
|
|
262
|
+
The images go to a new directory per call under the system temp
|
|
263
|
+
directory, or under `pagesDir` when the host passes one to
|
|
264
|
+
`registerDocumentTools`.
|
|
265
|
+
|
|
266
|
+
PDFs are never changed: every write command is absent for `.pdf`.
|
|
267
|
+
|
|
268
|
+
#### The `tables` extra
|
|
269
|
+
|
|
270
|
+
pdfplumber is optional because of its size: about 41 MB installed, since it
|
|
271
|
+
brings pdfminer.six, cryptography, Pillow and cffi, against 7.7 MB for
|
|
272
|
+
pypdfium2. To enable tables, add it to the Recipe's Python environment and lock
|
|
273
|
+
it:
|
|
274
|
+
|
|
275
|
+
```toml
|
|
276
|
+
# python/pyproject.toml
|
|
277
|
+
dependencies = ["pypdfium2==5.14.0", "pillow==13.0.0", "pdfplumber==0.11.10"]
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
then `uv lock`. The helper imports pdfplumber only when a read asks for tables,
|
|
281
|
+
and nothing is fetched at run time. A profile for contract or pricing work may
|
|
282
|
+
recommend the extra; a Recipe that only reads briefs can leave it out.
|
|
283
|
+
|
|
284
|
+
## Limits
|
|
285
|
+
|
|
286
|
+
- `read` returns about 50,000 characters per part; pass the `offset` it gives.
|
|
287
|
+
- A batch takes at most 60 edits or responses.
|
|
288
|
+
- Paragraph ids are body-block positions. Edits never add or remove blocks, so
|
|
289
|
+
ids hold for a whole redline; a document edited elsewhere gets new ids.
|
|
290
|
+
- Change numbers for `respond` are positions in the file as read: read again
|
|
291
|
+
after any change. Each accept or reject response applies whole or not at
|
|
292
|
+
all, so a bad number leaves its response's other changes unresolved.
|
|
293
|
+
- List numbers in `read` are approximate: restarts and overrides are not
|
|
294
|
+
modelled.
|
|
295
|
+
|
|
296
|
+
## Python
|
|
297
|
+
|
|
298
|
+
The Word and PDF helpers are small Python programs run with the Recipe's own
|
|
299
|
+
`pi.runtime.python` environment (`VIRTUAL_ENV`, or `RECIPE_DOCUMENTS_PYTHON`
|
|
300
|
+
to override). That environment must provide paper-docx for Word and
|
|
301
|
+
pypdfium2 and pillow for PDF, plus pdfplumber for PDF tables. A package-level Python environment, so a Recipe
|
|
302
|
+
need not declare these itself, is a follow-up; until then a Recipe declaring
|
|
303
|
+
`pi.documents` must lock them in its own `python/uv.lock`. The packages'
|
|
304
|
+
`python/uv.lock` files pin the versions their tests run on.
|
|
305
|
+
|
|
306
|
+
## How a Recipe's skills should use it
|
|
307
|
+
|
|
308
|
+
Skills say what good work is; the tool does the mechanics. A skill names the
|
|
309
|
+
command and what goes in it (`documents propose_edits`, one edit per change,
|
|
310
|
+
the rationale as the comment) and spends its words on judgement: what to
|
|
311
|
+
change, how to word the comment, which bucket a counterparty change falls in.
|
|
312
|
+
It does not print scripts, explain library calls or describe file copying.
|
|
313
|
+
Tell the agent to copy quotes from `read`, give the paragraph id, resubmit
|
|
314
|
+
only failed edits, and read the result back before finishing. For PDFs, a skill
|
|
315
|
+
says when tables matter (fee schedules, SLA grids, price tables) so the agent
|
|
316
|
+
passes `tables: true`, and that a page with no text layer is rendered and
|
|
317
|
+
looked at with `read`.
|
|
318
|
+
|
|
319
|
+
## Write a format
|
|
320
|
+
|
|
321
|
+
A format supplies an adapter and a capability descriptor; it writes no tool
|
|
322
|
+
schemas.
|
|
323
|
+
|
|
324
|
+
```ts
|
|
325
|
+
import { createDocumentFormatModule } from "@introspection-ai/recipes/documents";
|
|
326
|
+
|
|
327
|
+
export default createDocumentFormatModule({
|
|
328
|
+
format: "pdf",
|
|
329
|
+
extensions: [".pdf"],
|
|
330
|
+
capabilities: { read: true, render: true },
|
|
331
|
+
createAdapter: ({ env }) => new PdfDocumentAdapter(env),
|
|
332
|
+
});
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Registration checks that the adapter implements every method its
|
|
336
|
+
capabilities claim, and that the adapter returns the declared capabilities.
|
|
337
|
+
A format package ships code only. A skill that teaches a format library, such
|
|
338
|
+
as Paper's `docx` skill, is a dependency of the Recipe that uses it, installed
|
|
339
|
+
when the runtime is baked.
|
|
340
|
+
|
|
341
|
+
## Format pages
|
|
342
|
+
|
|
343
|
+
- Word: this page; `packages/documents/docx/README.md`.
|
|
344
|
+
- PDF: this page; `packages/documents/pdf/README.md`.
|
package/docs/index.md
CHANGED
|
@@ -19,6 +19,7 @@ task lifecycle, protocols, and deployment.
|
|
|
19
19
|
| Declare capability policy and bindings | [MCP configuration](mcp-configuration.md) |
|
|
20
20
|
| Answer a chat message from a Recipe | [Channel tools](channels.md) |
|
|
21
21
|
| Add Slack tools to a Recipe | [Slack channel connector](slack.md) |
|
|
22
|
+
| Read and mark up Word and PDF files from a Recipe | [Document tools](documents.md) |
|
|
22
23
|
| Define portable evaluation judges | [Recipe judges](recipe-judges.md) |
|
|
23
24
|
|
|
24
25
|
## Boundary
|
package/docs/interactions.md
CHANGED
|
@@ -5,13 +5,81 @@ 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
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`
|
|
12
|
-
`
|
|
8
|
+
Most Recipes need only the built-in `ask_user_question` tool: list it in an
|
|
9
|
+
agent's `tools` (see below). The module itself registers no tools. A Recipe
|
|
10
|
+
that needs its own interaction tool — its own name, schema, and prompt — calls
|
|
11
|
+
`askUserQuestion()` or `askUserApproval()` from the tool's `execute()`. Those
|
|
12
|
+
helpers build the `details.interrupt` request, local Pi dialog copy, and host
|
|
13
|
+
metadata. Use raw `askUser()` only when a tool needs a lower-level interaction
|
|
14
|
+
shape.
|
|
15
|
+
|
|
16
|
+
## The built-in `ask_user_question` tool
|
|
17
|
+
|
|
18
|
+
List `ask_user_question` in an agent's `tools` and the host registers it for
|
|
19
|
+
that agent; agents that do not list it never see it.
|
|
20
|
+
|
|
21
|
+
```yaml
|
|
22
|
+
name: agent
|
|
23
|
+
ai:
|
|
24
|
+
model: anthropic/claude-sonnet-4-5
|
|
25
|
+
tools: [read, bash, ask_user_question]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Its inputs mirror Claude Code's `AskUserQuestion`, so models use it without
|
|
29
|
+
extra prompting:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
ask_user_question({
|
|
33
|
+
questions: [ // 1 to 4
|
|
34
|
+
{
|
|
35
|
+
question: string, // the full question, ending in "?"
|
|
36
|
+
header: string, // short label, at most 12 characters
|
|
37
|
+
options: [ // 2 to 4
|
|
38
|
+
{ label: string, description?: string }
|
|
39
|
+
],
|
|
40
|
+
multiSelect?: boolean
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The model never adds an "Other" option: the user can always give their own
|
|
47
|
+
answer. The tool description carries the usage guidance (one decision per
|
|
48
|
+
question, short enough to read aloud, enough context that a bare option makes
|
|
49
|
+
sense, no options inside the question text, no "change it" option on
|
|
50
|
+
approvals, and prefer the tool over asking in plain text).
|
|
51
|
+
|
|
52
|
+
How each host renders it:
|
|
53
|
+
|
|
54
|
+
| Host | Rendering | Result the model sees |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Pi terminal (TUI) and RPC | One dialog per question, in order. Options are numbered (numbers the model put in labels are stripped), with descriptions after the label, and a last option, `Something else — I'll type it`, opens a text input. `multiSelect` uses the toggle list in the TUI and a toggle-then-`Done` selector over RPC. | One line per question, `<header>: <answer>` (several answers joined with `, `), and `details.questions` / `details.answers` with each answer. |
|
|
57
|
+
| Pause/resume host (`PI_INTERRUPT_RESUME`) | The tool returns the `details.interrupt` request from `askUserQuestion()` with bare option labels and their descriptions, `metadata.header` and `metadata.question`; the host renders its own option list and free-text answer. | The host's resume envelope, for example `Answer: Email link`. |
|
|
58
|
+
| Headless (`PI_ASK_USER_AUTO_APPROVE`) and child agents | Nothing is shown; every question declines. | `<header>: (no answer)` per question, then an instruction to proceed with best judgment. |
|
|
59
|
+
| No channel | Nothing is shown. | The unavailable envelope, telling the model to ask in its reply. |
|
|
60
|
+
|
|
61
|
+
The built-in tool reads `PI_INTERRUPT_RESUME` and `PI_ASK_USER_AUTO_APPROVE`
|
|
62
|
+
from the session's environment, the `env` passed to `createAgentSession()` or
|
|
63
|
+
`createRecipesExtension()`, and falls back to `process.env` when none is given.
|
|
64
|
+
A Recipe's own tool can do the same by passing `env` to the helpers.
|
|
65
|
+
|
|
66
|
+
A pause carries one interrupt per tool call, so on a pause/resume host the
|
|
67
|
+
schema asks for one question per call and the description tells the model to
|
|
68
|
+
make one call per question in the same turn; the host collects them into one
|
|
69
|
+
pause. A call that still carries several questions shows nothing and returns
|
|
70
|
+
text asking the model to split it.
|
|
71
|
+
|
|
72
|
+
If a Recipe extension registers its own `ask_user_question`, the host keeps
|
|
73
|
+
it and skips the built-in tool, so a Recipe can migrate at its own pace.
|
|
74
|
+
|
|
75
|
+
### Skills shared with other hosts
|
|
76
|
+
|
|
77
|
+
A skill that also runs in Claude Code or another host should not name one
|
|
78
|
+
host's tool as the only way to ask. Write, for example: "Ask with the host's
|
|
79
|
+
question tool (`ask_user_question` here, `AskUserQuestion` in Claude Code);
|
|
80
|
+
otherwise ask with numbered options in text."
|
|
13
81
|
|
|
14
|
-
##
|
|
82
|
+
## Writing your own interaction tool
|
|
15
83
|
|
|
16
84
|
```ts
|
|
17
85
|
import { Type } from "typebox";
|
|
@@ -20,8 +88,8 @@ import { askUserQuestion } from "@introspection-ai/recipes/interactions";
|
|
|
20
88
|
|
|
21
89
|
export default function (pi: ExtensionAPI) {
|
|
22
90
|
pi.registerTool({
|
|
23
|
-
name: "
|
|
24
|
-
label: "
|
|
91
|
+
name: "clarify",
|
|
92
|
+
label: "Clarify",
|
|
25
93
|
description: "Ask the user a clarifying question and wait for the answer.",
|
|
26
94
|
parameters: Type.Object({
|
|
27
95
|
question: Type.String(),
|
|
@@ -155,11 +155,16 @@ endpoint or credential; Recipe validation rejects local configuration. Commit
|
|
|
155
155
|
`.pi/mcp.local.example.json` when a binding template is helpful.
|
|
156
156
|
|
|
157
157
|
The one committed form validation accepts is an evaluation binding: every
|
|
158
|
-
server is `streamable_http` to a
|
|
159
|
-
`127.0.0.0/8` or `::1`)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
server is an id `package.json` declares, named once, `streamable_http` to a
|
|
159
|
+
loopback URL (`http://localhost:<port>/...`, `127.0.0.0/8` or `::1`) or a
|
|
160
|
+
single-label host such as a compose service (`http://fakes:7353/<id>/mcp`),
|
|
161
|
+
with no `auth` flow and no `command`. Such a file can only stand a fake that
|
|
162
|
+
runs beside the Recipe in for a declared server, so it distributes nothing
|
|
163
|
+
reachable elsewhere: a name without a dot resolves only on the evaluation's own
|
|
164
|
+
network. A host that runs evaluations reads it in place of its own bindings for
|
|
165
|
+
the ids it names. An id the package does not declare would be ignored at run
|
|
166
|
+
time, so validation rejects it rather than let a misspelling fall through to the
|
|
167
|
+
live endpoint. An environment reference in
|
|
163
168
|
the URL is not expanded in a committed binding, so write the literal loopback
|
|
164
169
|
address. A host binds its own endpoint and credential system to the same
|
|
165
170
|
shape. A binding overrides a package-manifest endpoint with the same id,
|
package/docs/recipe-format.md
CHANGED
|
@@ -128,6 +128,11 @@ are enabled. Incoming turns then require a successful final `reply`, so an
|
|
|
128
128
|
enabled command allowlist must include `reply`. Set `requireReply: false` for
|
|
129
129
|
intentional silence, such as a read-only allowlist. See [Channel tools](channels.md).
|
|
130
130
|
|
|
131
|
+
`pi.documents` lists the document formats the `documents` tool opens, each as
|
|
132
|
+
`{"format": "<format>"}` with the package
|
|
133
|
+
`@introspection-ai/recipe-documents-<format>` as a dependency, and an optional
|
|
134
|
+
`commands` allowlist. See [Document tools](documents.md).
|
|
135
|
+
|
|
131
136
|
## Agents
|
|
132
137
|
|
|
133
138
|
`pi.agents` may declare YAML agent definitions explicitly. When omitted,
|
|
@@ -273,7 +278,8 @@ own Pi runtime. Interactive Pi keeps one extension runtime for the selected
|
|
|
273
278
|
Recipe launch and does not retry a partially failed closure without rebuilding
|
|
274
279
|
that runtime. Extension load failures stop the agent before a model call.
|
|
275
280
|
Recipe extensions MUST NOT override host or Pi built-in tool names; use a
|
|
276
|
-
distinct tool name when behavior differs.
|
|
281
|
+
distinct tool name when behavior differs. The one exception is
|
|
282
|
+
`ask_user_question` (see [Tools](#tools-subagents-and-capabilities)). Extension code retains its non-tool
|
|
277
283
|
behavior even when none of its tools appear in the selected agent's `tools`
|
|
278
284
|
allowlist.
|
|
279
285
|
|
|
@@ -289,6 +295,23 @@ hook execution.
|
|
|
289
295
|
`tools` is an allowlist. A host MUST expose no undeclared Pi or extension tool
|
|
290
296
|
through this field.
|
|
291
297
|
|
|
298
|
+
Besides Pi's own tools (`read`, `bash`, `edit`, `write`, `grep`, `find`,
|
|
299
|
+
`ls`), Recipes provides these built-in tools, available only to an agent that
|
|
300
|
+
lists them in `tools`:
|
|
301
|
+
|
|
302
|
+
| Tool | What it does |
|
|
303
|
+
| --- | --- |
|
|
304
|
+
| `ask_user_question` | Asks the user one to four multiple-choice questions and waits for the answers; the user can always type their own answer. Works in Pi's terminal, on pause/resume hosts and headless. See [Interactions](interactions.md#the-built-in-ask_user_question-tool). |
|
|
305
|
+
|
|
306
|
+
```yaml
|
|
307
|
+
tools: [read, bash, ask_user_question]
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
If a Recipe extension registers its own `ask_user_question`, the host keeps
|
|
311
|
+
the Recipe's tool and does not register the built-in one. This exception to
|
|
312
|
+
the rule below lets a Recipe migrate from its own question tool without a
|
|
313
|
+
coordinated release; new Recipes list the built-in tool instead.
|
|
314
|
+
|
|
292
315
|
`subagents` names agents the selected agent may invoke. A host MUST expose only
|
|
293
316
|
those resolved definitions through the shared `agent` tool. How child work is
|
|
294
317
|
scheduled or isolated belongs to the host.
|
|
@@ -373,6 +396,51 @@ TypeScript extensions execute inside the Pi process with its authority. A host
|
|
|
373
396
|
that accepts third-party Recipes MUST review or isolate them before execution;
|
|
374
397
|
the format and Host API are not a sandbox boundary.
|
|
375
398
|
|
|
399
|
+
## Evaluations
|
|
400
|
+
|
|
401
|
+
A Recipe's evaluations live under `evals/` by default:
|
|
402
|
+
|
|
403
|
+
```text
|
|
404
|
+
evals/
|
|
405
|
+
vitest/ vitest-evals suites
|
|
406
|
+
harbor/<task>/ one Harbor task per folder
|
|
407
|
+
lib/ code shared by several tasks or suites
|
|
408
|
+
sources/ pinned generators of derived eval data
|
|
409
|
+
fakes/<server>/ MCP fakes and their scenarios
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
`pi.evals` is optional and overrides those locations. Absent, hosts and tools
|
|
413
|
+
discover `evals/vitest` and `evals/harbor` when they exist.
|
|
414
|
+
|
|
415
|
+
```json
|
|
416
|
+
{
|
|
417
|
+
"pi": {
|
|
418
|
+
"evals": {
|
|
419
|
+
"suites": [
|
|
420
|
+
{ "type": "harbor", "path": "evals/harbor" },
|
|
421
|
+
{ "type": "vitest", "path": "evals/vitest" }
|
|
422
|
+
],
|
|
423
|
+
"lib": "evals/lib",
|
|
424
|
+
"sources": "evals/sources",
|
|
425
|
+
"fakes": "evals/fakes"
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
`suites[].type` is `harbor` or `vitest`; several suites of one type may exist,
|
|
432
|
+
and no two share a path. Every path is Recipe-relative, uses `/`, and stays
|
|
433
|
+
inside the package. Unknown keys are errors.
|
|
434
|
+
|
|
435
|
+
Nothing eval-only reaches a running agent: every suite, `lib`, `sources` and
|
|
436
|
+
`fakes` path MUST be excluded by `.recipeignore` (a single `evals/` line does
|
|
437
|
+
it), and in a Harbor trial only a task's `environment/` reaches the agent.
|
|
438
|
+
Hosts accept `pi.evals` without reading it; it is for evaluation tooling and
|
|
439
|
+
`recipe-check`. `recipe-check` warns about eval paths missing from `.recipeignore`
|
|
440
|
+
for every Recipe, and checks the rest of the layout (Harbor task folders, eval
|
|
441
|
+
files outside the eval paths) only for a Recipe that declares `pi.evals`; an
|
|
442
|
+
empty `{}` adopts those checks with the default paths.
|
|
443
|
+
|
|
376
444
|
## Conformance
|
|
377
445
|
|
|
378
446
|
There are two conformance layers:
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documents
|
|
3
|
+
description: How to read Word and PDF files and mark up Word files with the documents tool. Load it before opening, editing, commenting on or responding to any document.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documents
|
|
7
|
+
|
|
8
|
+
The `documents` tool does every change to a document. It finds the text, keeps the
|
|
9
|
+
formatting, signs every change with `author`, and never touches the original.
|
|
10
|
+
|
|
11
|
+
## Choose the command
|
|
12
|
+
|
|
13
|
+
Always `read` first, every part: pass `offset` from the previous part until it ends. Then:
|
|
14
|
+
|
|
15
|
+
| You want to | Use |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Change a few words: a figure, a term, a short phrase | `propose_edits`: `{op: "replace", quote, new, rationale}`; `delete`; or `insert_after` with `new` |
|
|
18
|
+
| Rewrite most of a paragraph, or make several changes in one | `revise`: `{paragraph: "p-012", text: <its full new text>, rationale}` |
|
|
19
|
+
| Remove a whole numbered section and keep the numbering | `remove_section`: `{from, through, keep, rationale}` |
|
|
20
|
+
| Comment without changing text, or reply on a thread | `comment`: `{quote, text}`, or `{thread, text}` |
|
|
21
|
+
| Answer markup already there | `respond`: accept or reject by change number, reply on a thread, or counter with your own change |
|
|
22
|
+
| See a PDF page as an image (a scan, a signature, a chart) | `render`, then open the image it returns |
|
|
23
|
+
|
|
24
|
+
Every change carries its `rationale`, which becomes a margin comment.
|
|
25
|
+
|
|
26
|
+
## Paths
|
|
27
|
+
|
|
28
|
+
The first change takes `path` (the file you were given) and `output` (a new file under
|
|
29
|
+
`outputs/`). Every later change takes `path` set to that output and no `output`. Never
|
|
30
|
+
rebuild a file from scratch.
|
|
31
|
+
|
|
32
|
+
## Quoting
|
|
33
|
+
|
|
34
|
+
Copy quotes from the text after the paragraph id in `read`, within one paragraph, and
|
|
35
|
+
pass that `paragraph` id. Quote only enough to find the place once; `near` or
|
|
36
|
+
`occurrence` picks one match when it repeats. Spacing, curly quotes and dashes are
|
|
37
|
+
forgiven; words and capitalization are not. With `revise` there is nothing to quote:
|
|
38
|
+
copy the paragraph's current text and change only what must change.
|
|
39
|
+
|
|
40
|
+
## When something fails
|
|
41
|
+
|
|
42
|
+
Each item reports `applied` or `FAILED` with a reason; a failed item changed nothing and
|
|
43
|
+
the rest still went in. Resubmit only the failed ones, with `path` set to the saved file:
|
|
44
|
+
|
|
45
|
+
- `not_found`: use the `closest` text it lists, or `read` again; your earlier changes may
|
|
46
|
+
have moved the text. If the paragraph changed a lot, `revise` it by id.
|
|
47
|
+
- `ambiguous`: add `paragraph`, `near` or `occurrence`.
|
|
48
|
+
- `crosses_marker` or `unaddressable`: the change crosses something Word keeps (a tab, a
|
|
49
|
+
field, a content control). Change the words on each side separately, or `revise` the
|
|
50
|
+
paragraph with its full new text.
|
|
51
|
+
- `change_not_found` or `invalid_changes`: take change numbers from a fresh `read`;
|
|
52
|
+
resolving changes renumbers the rest.
|
|
53
|
+
|
|
54
|
+
Never resubmit an applied item: it would apply twice.
|
|
55
|
+
|
|
56
|
+
## Don't drop to a script
|
|
57
|
+
|
|
58
|
+
Don't write Python or shell to change a document, and don't edit its XML: the tool covers
|
|
59
|
+
the changes above, keeps the file valid and records who changed what. If it truly can't do
|
|
60
|
+
something, say so in your reply rather than working around it. Read the result back with
|
|
61
|
+
`read` before you finish.
|
|
62
|
+
|
|
63
|
+
A profile may add hints for one kind of work, as a skill beside this one; follow both.
|