@introspection-ai/recipes 0.49.0 → 0.51.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 (160) hide show
  1. package/dist/api/mcp.d.ts +1 -0
  2. package/dist/api/mcp.d.ts.map +1 -1
  3. package/dist/api/mcp.js +1 -0
  4. package/dist/api/mcp.js.map +1 -1
  5. package/dist/channels/tools.d.ts.map +1 -1
  6. package/dist/channels/tools.js +2 -17
  7. package/dist/channels/tools.js.map +1 -1
  8. package/dist/command-parameters.d.ts +10 -0
  9. package/dist/command-parameters.d.ts.map +1 -0
  10. package/dist/command-parameters.js +25 -0
  11. package/dist/command-parameters.js.map +1 -0
  12. package/dist/connector-tools.d.ts +1 -1
  13. package/dist/connector-tools.d.ts.map +1 -1
  14. package/dist/connector-tools.js +13 -5
  15. package/dist/connector-tools.js.map +1 -1
  16. package/dist/documents/module.d.ts.map +1 -1
  17. package/dist/documents/module.js +2 -4
  18. package/dist/documents/module.js.map +1 -1
  19. package/dist/documents/profile.d.ts +1 -1
  20. package/dist/documents/profile.js +1 -1
  21. package/dist/egress.d.ts +23 -0
  22. package/dist/egress.d.ts.map +1 -0
  23. package/dist/egress.js +36 -0
  24. package/dist/egress.js.map +1 -0
  25. package/dist/extensions.d.ts +1 -1
  26. package/dist/extensions.d.ts.map +1 -1
  27. package/dist/extensions.js +23 -2
  28. package/dist/extensions.js.map +1 -1
  29. package/dist/introspection-open.d.ts +46 -0
  30. package/dist/introspection-open.d.ts.map +1 -0
  31. package/dist/introspection-open.js +278 -0
  32. package/dist/introspection-open.js.map +1 -0
  33. package/dist/mcp/index.d.ts +37 -0
  34. package/dist/mcp/index.d.ts.map +1 -1
  35. package/dist/mcp/index.js +14 -4
  36. package/dist/mcp/index.js.map +1 -1
  37. package/dist/mcp/pi-client.d.ts +97 -0
  38. package/dist/mcp/pi-client.d.ts.map +1 -0
  39. package/dist/mcp/pi-client.js +342 -0
  40. package/dist/mcp/pi-client.js.map +1 -0
  41. package/dist/mcp/policy.d.ts +2 -0
  42. package/dist/mcp/policy.d.ts.map +1 -1
  43. package/dist/mcp/policy.js +6 -0
  44. package/dist/mcp/policy.js.map +1 -1
  45. package/dist/mcp-chunks/{chunk-3M4OCQR5.js → chunk-PO2SOBEN.js} +1 -0
  46. package/dist/mcp-daemon.js +1 -1
  47. package/dist/mcp-run-worker.js +1 -1
  48. package/dist/open.d.ts +82 -0
  49. package/dist/open.d.ts.map +1 -0
  50. package/dist/open.js +152 -0
  51. package/dist/open.js.map +1 -0
  52. package/dist/pi-extension.d.ts.map +1 -1
  53. package/dist/pi-extension.js +99 -8
  54. package/dist/pi-extension.js.map +1 -1
  55. package/dist/productivity/content.d.ts +25 -0
  56. package/dist/productivity/content.d.ts.map +1 -0
  57. package/dist/productivity/content.js +94 -0
  58. package/dist/productivity/content.js.map +1 -0
  59. package/dist/productivity/handles.d.ts +72 -0
  60. package/dist/productivity/handles.d.ts.map +1 -0
  61. package/dist/productivity/handles.js +111 -0
  62. package/dist/productivity/handles.js.map +1 -0
  63. package/dist/productivity/http.d.ts +35 -0
  64. package/dist/productivity/http.d.ts.map +1 -0
  65. package/dist/productivity/http.js +203 -0
  66. package/dist/productivity/http.js.map +1 -0
  67. package/dist/productivity/index.d.ts +11 -0
  68. package/dist/productivity/index.d.ts.map +1 -0
  69. package/dist/productivity/index.js +7 -0
  70. package/dist/productivity/index.js.map +1 -0
  71. package/dist/productivity/module.d.ts +63 -0
  72. package/dist/productivity/module.d.ts.map +1 -0
  73. package/dist/productivity/module.js +119 -0
  74. package/dist/productivity/module.js.map +1 -0
  75. package/dist/productivity/paging.d.ts +32 -0
  76. package/dist/productivity/paging.d.ts.map +1 -0
  77. package/dist/productivity/paging.js +42 -0
  78. package/dist/productivity/paging.js.map +1 -0
  79. package/dist/productivity/tools.d.ts +40 -0
  80. package/dist/productivity/tools.d.ts.map +1 -0
  81. package/dist/productivity/tools.js +969 -0
  82. package/dist/productivity/tools.js.map +1 -0
  83. package/dist/productivity/types.d.ts +538 -0
  84. package/dist/productivity/types.d.ts.map +1 -0
  85. package/dist/productivity/types.js +119 -0
  86. package/dist/productivity/types.js.map +1 -0
  87. package/dist/recipe/agent.d.ts +6 -1
  88. package/dist/recipe/agent.d.ts.map +1 -1
  89. package/dist/recipe/agent.js +48 -7
  90. package/dist/recipe/agent.js.map +1 -1
  91. package/dist/recipe/companions.d.ts +2 -1
  92. package/dist/recipe/companions.d.ts.map +1 -1
  93. package/dist/recipe/companions.js +14 -11
  94. package/dist/recipe/companions.js.map +1 -1
  95. package/dist/recipe/manifest.generated.d.ts +4 -1
  96. package/dist/recipe/manifest.generated.d.ts.map +1 -1
  97. package/dist/recipe/manifest.generated.js +5 -2
  98. package/dist/recipe/manifest.generated.js.map +1 -1
  99. package/dist/recipe/package.d.ts +12 -0
  100. package/dist/recipe/package.d.ts.map +1 -1
  101. package/dist/recipe/package.js +93 -0
  102. package/dist/recipe/package.js.map +1 -1
  103. package/dist/review.d.ts +1 -0
  104. package/dist/review.d.ts.map +1 -1
  105. package/dist/review.js +1 -0
  106. package/dist/review.js.map +1 -1
  107. package/dist/search/egress.d.ts +12 -0
  108. package/dist/search/egress.d.ts.map +1 -0
  109. package/dist/search/egress.js +24 -0
  110. package/dist/search/egress.js.map +1 -0
  111. package/dist/search/http.d.ts +16 -0
  112. package/dist/search/http.d.ts.map +1 -0
  113. package/dist/search/http.js +75 -0
  114. package/dist/search/http.js.map +1 -0
  115. package/dist/search/index.d.ts +9 -0
  116. package/dist/search/index.d.ts.map +1 -0
  117. package/dist/search/index.js +5 -0
  118. package/dist/search/index.js.map +1 -0
  119. package/dist/search/mcp.d.ts +58 -0
  120. package/dist/search/mcp.d.ts.map +1 -0
  121. package/dist/search/mcp.js +84 -0
  122. package/dist/search/mcp.js.map +1 -0
  123. package/dist/search/module.d.ts +16 -0
  124. package/dist/search/module.d.ts.map +1 -0
  125. package/dist/search/module.js +27 -0
  126. package/dist/search/module.js.map +1 -0
  127. package/dist/search/tool.d.ts +96 -0
  128. package/dist/search/tool.d.ts.map +1 -0
  129. package/dist/search/tool.js +505 -0
  130. package/dist/search/tool.js.map +1 -0
  131. package/dist/search/types.d.ts +247 -0
  132. package/dist/search/types.d.ts.map +1 -0
  133. package/dist/search/types.js +60 -0
  134. package/dist/search/types.js.map +1 -0
  135. package/dist/session.d.ts.map +1 -1
  136. package/dist/session.js +175 -15
  137. package/dist/session.js.map +1 -1
  138. package/dist/skill-progress.d.ts.map +1 -1
  139. package/dist/skill-progress.js +5 -1
  140. package/dist/skill-progress.js.map +1 -1
  141. package/dist/tool-search.d.ts +2 -2
  142. package/dist/tool-search.d.ts.map +1 -1
  143. package/dist/tool-search.js +4 -2
  144. package/dist/tool-search.js.map +1 -1
  145. package/docs/{index.md → README.md} +10 -3
  146. package/docs/{slack.md → channels/slack.md} +1 -1
  147. package/docs/{documents.md → documents/README.md} +4 -4
  148. package/docs/interactions.md +90 -31
  149. package/docs/mcp-configuration.md +77 -2
  150. package/docs/productivity/README.md +360 -0
  151. package/docs/productivity/google.md +226 -0
  152. package/docs/productivity/microsoft.md +143 -0
  153. package/docs/recipe-format.md +24 -3
  154. package/docs/search/README.md +801 -0
  155. package/package.json +19 -8
  156. package/skills/README.md +12 -0
  157. package/skills/productivity/SKILL.md +76 -0
  158. package/skills/search/SKILL.md +72 -0
  159. /package/docs/{channels.md → channels/README.md} +0 -0
  160. /package/{documents → skills/documents}/SKILL.md +0 -0
@@ -0,0 +1,226 @@
1
+ # Google productivity provider
2
+
3
+ **Status: built** (`packages/productivity/google`), not yet published or
4
+ tested against a live Workspace domain. [As built](#as-built) lists where it
5
+ differs from the design below. Facts marked *to confirm* come from Google's
6
+ documentation as summarised in design review, and are checked against a live
7
+ Workspace domain before the package ships.
8
+
9
+ **REST-only for now.** Every command is served by Google's REST APIs. See
10
+ [MCP later](#mcp-later).
11
+
12
+ The `google` provider serves the `mail`, `calendar` and `drive` tools from a
13
+ person's Gmail, Google Calendar and Google Drive. It is the package
14
+ `@introspection-ai/recipe-productivity-google`, a companion of Recipes like
15
+ the Slack channel package.
16
+
17
+ ```json
18
+ {
19
+ "peerDependencies": {
20
+ "@introspection-ai/recipe-productivity-google": ">=X.Y.Z"
21
+ },
22
+ "pi": {
23
+ "productivity": [{ "provider": "google" }]
24
+ }
25
+ }
26
+ ```
27
+
28
+ ## Backends
29
+
30
+ Every command is served by Google's REST APIs, and the descriptor declares
31
+ each `rest`. The mapping is static and versioned: the package's contract
32
+ tests pin each request and result shape.
33
+
34
+ | Command | REST |
35
+ | --- | --- |
36
+ | `mail search` | `GET gmail/v1/users/me/messages?q=` |
37
+ | `mail read` | `users.messages.get`, `users.threads.get` (`format=full`) |
38
+ | `mail fetch_attachment` | `users.messages.attachments.get` |
39
+ | `mail draft` / `update_draft` | `users.drafts.create`, `users.drafts.update` |
40
+ | `mail send` | `users.drafts.send` |
41
+ | `mail label` / `move` | `users.messages.modify` |
42
+ | `calendar list` / `read` | `GET calendar/v3/calendars/{id}/events`, `events.get` |
43
+ | `calendar free_busy` | `POST calendar/v3/freeBusy` |
44
+ | `calendar create` / `update` / `respond` / `cancel` | `events.insert`, `events.patch` (own attendee `responseStatus`), `events.delete`, with `sendUpdates=all` |
45
+ | `drive search` | `GET drive/v3/files?q=` |
46
+ | `drive read` | `files.export` (native formats), `files.get?alt=media` |
47
+ | `drive download` | `files.export`, `files.get?alt=media` |
48
+ | `drive upload` | `POST upload/drive/v3/files` (multipart; resumable above 5 MB) |
49
+
50
+ ### MCP later
51
+
52
+ Google publishes a remote MCP server per Workspace product, but they are a
53
+ developer preview: the Calendar and Drive hosts and every tool name are
54
+ unconfirmed. Once they are generally available and the tool names are
55
+ confirmed, an MCP path can return as a Recipe's own MCP servers kept behind
56
+ the productivity tools with `mcp.servers.<id>.behind: [mail|calendar|drive]`
57
+ ([MCP configuration](../mcp-configuration.md#keep-a-server-behind-a-tool),
58
+ [#459](https://github.com/introspection-org/recipes/pull/459)).
59
+
60
+ ## Results
61
+
62
+ - **Mail.** A message's body is its `text/plain` part, or its `text/html`
63
+ part converted to text when there is none; MIME is decoded and remote
64
+ content dropped. Results carry `from`, `to`, `cc`, `subject`, `sent_at`,
65
+ the thread handle, label names (not IDs) and the attachment list. A folder
66
+ in `mail move` is a label, since Gmail has no folders; the descriptor says
67
+ so.
68
+ - **Calendar.** Times are returned in RFC 3339 with the event's IANA time
69
+ zone. All-day events carry dates, not times. `calendar respond` sets the
70
+ person's own `responseStatus` and nothing else on the event.
71
+ - **Drive.** Google-native files have no bytes of their own, so `drive read`
72
+ and `drive download` export them:
73
+
74
+ | Native type | `drive read` (text) | `drive download` (file) |
75
+ | --- | --- | --- |
76
+ | Docs | `text/plain` | `.docx` |
77
+ | Sheets | `text/csv`, first sheet, with the sheet list | `.xlsx` |
78
+ | Slides | `text/plain` | `.pptx` |
79
+ | Other files | the file's text, when it is text | the file |
80
+
81
+ Google limits an export's size (*to confirm*: 10 MB); a larger file
82
+ reports the limit instead of truncating silently.
83
+
84
+ ## Authentication and setup
85
+
86
+ The package sends a placeholder bearer, and the host attaches the person's
87
+ token ([productivity tools, Authentication](README.md#authentication)).
88
+ On Introspection the connector declares these hosts, and the egress attaches
89
+ the credential only to them:
90
+
91
+ - `gmail.googleapis.com`;
92
+ - `www.googleapis.com`, **path-limited** to `/calendar/v3/`, `/drive/v3/`
93
+ and `/upload/drive/v3/`, because that host serves every other Google API
94
+ too.
95
+
96
+ What a Workspace admin sets up once, in their own Google Cloud project:
97
+
98
+ 1. **Enable the APIs** (Gmail, Calendar, Drive).
99
+ 2. **Create an OAuth client** of type Web application, with the connector
100
+ callback as its redirect URI.
101
+ 3. **Keep the app internal to the domain** where possible. Gmail and Drive
102
+ read scopes are *restricted*: an external app needs Google's verification
103
+ and a yearly security assessment, which an internal app does not.
104
+
105
+ The connector requests offline access (`access_type=offline`,
106
+ `prompt=consent`), which the platform's Google connector OAuth already sends,
107
+ and only the scopes for the commands the Recipe enables:
108
+
109
+ | Tool | Read | Write |
110
+ | --- | --- | --- |
111
+ | `mail` | `gmail.readonly` | `gmail.compose` (drafts, send), `gmail.modify` (labels) |
112
+ | `calendar` | `calendar.readonly` | `calendar.events` |
113
+ | `drive` | `drive.readonly` | `drive.file` (files the agent creates) |
114
+
115
+ ## Errors
116
+
117
+ | Provider answer | Command result |
118
+ | --- | --- |
119
+ | `401` | `not_connected`: the person reconnects |
120
+ | `403` `insufficientPermissions` | `missing_scope`, naming the scope the connector lacks |
121
+ | `403` `rateLimitExceeded`, `userRateLimitExceeded`, or `429` | retried with backoff, then `rate_limited` with the wait |
122
+ | `404` | `not_found`, and the handle is dropped |
123
+ | `5xx` | retried once for reads; writes are not retried |
124
+
125
+ A write is never retried automatically, because Gmail and Calendar writes are
126
+ not idempotent.
127
+
128
+ ## Docs, Sheets and Slides
129
+
130
+ Working **inside** a document is the [documents](../documents/README.md) tool's job,
131
+ not productivity's. Productivity finds a file and moves it; documents reads
132
+ and marks it up. The split holds for both providers, since OneDrive's Word,
133
+ Excel and PowerPoint files are the same problem.
134
+
135
+ - **Now: round trip through files.** `drive download` exports a Doc to
136
+ `.docx`, which the `docx` format already reads and redlines; the result
137
+ goes back with `drive upload`. Sheets and Slides need `xlsx` and `pptx`
138
+ formats in documents, which then serve Excel and PowerPoint too.
139
+ - **Later: live documents.** Comments and suggestions on the live Google Doc
140
+ (Docs `batchUpdate`, Drive comments) are a documents format whose source is
141
+ a `file_…` handle rather than a path under the workspace. That extends the
142
+ documents contract (today a format works on local files by extension), so
143
+ it is designed there, with Microsoft's Word and Excel APIs alongside.
144
+
145
+ ## Test it
146
+
147
+ - **Unit:** a fake HTTP server for the REST calls, covering paging
148
+ (`nextPageToken`), backoff, error mapping, export types and the
149
+ placeholder credential.
150
+ - **Live:** `introspection dev` against a Workspace test domain, with a test
151
+ person connected.
152
+
153
+ ## As built
154
+
155
+ - **Retries.** The host's `http` retries a read
156
+ ([Write a provider](README.md#write-a-provider)); the package adds `403`
157
+ `rateLimitExceeded` / `userRateLimitExceeded` as throttled. A rate limit
158
+ the host stops retrying comes back as `rate_limited` with
159
+ `retry_after_seconds`. A write is sent once, even on a rate limit.
160
+ - **Errors.** As the table above, plus: `400` is `invalid_request`; `403`
161
+ `exportSizeLimitExceeded` is `invalid_request` stating the 10 MB limit (the
162
+ limit is printed on `files.export` in Drive's discovery document).
163
+ - **Mail.** `mail search` builds a Gmail query from the neutral filters
164
+ (`from:`, `after:`/`before:` as epoch seconds, `is:unread`) and maps
165
+ `folder` to a label ID. Summaries come from `format=full` reads with a
166
+ `fields` mask that keeps the headers and part structure but no part data
167
+ (`format=metadata` has no parts, so it cannot tell attachments). Bodies
168
+ are the `text/plain` part, else the HTML part, which the host converts to
169
+ text as it does Microsoft's (`src/productivity/content.ts`). No part inside an attachment or an attached message
170
+ is read as the body. A body part Gmail stores apart (`body.attachmentId`)
171
+ is fetched up to 5 MB; a larger one, or one that cannot be fetched, is
172
+ named in `unavailable`. An attachment's ID is its `partId`, since Gmail's
173
+ `attachmentId` changes between reads. Draft bodies are sent as
174
+ `text/plain` (the Markdown as written); `update_draft` without `body` keeps
175
+ the draft's body (an HTML one as HTML, a stored one fetched) and refuses
176
+ the update when that body cannot be read. `update_draft` keeps the draft's
177
+ `Bcc`, and refuses a draft with attachments or with a `Reply-To` or
178
+ `Resent-*` header, which the rebuilt draft would drop. A header value
179
+ containing a line break is refused. A reply drafted with no `to` goes to the parent's
180
+ `Reply-To`, else its `From`, or to its `To` when the person sent it, as
181
+ Gmail's own Reply does; it never adds the other recipients. `mail move` adds the label and removes `INBOX`;
182
+ `archive` only removes `INBOX`; `SENT` and `DRAFT` cannot be set.
183
+ - **Calendar.** `calendar` names a calendar by its title on the person's
184
+ list (`calendarList.list`). An event listed from another calendar than the
185
+ primary one carries that calendar in its provider id, so `read`, `update`,
186
+ `respond` and `cancel` address the calendar it came from (`create` always
187
+ writes to the primary calendar). An event without its own zone is shown in
188
+ its calendar's zone: `list` takes it from `events.list`, and `read` and
189
+ `update` from `calendars.get`, read once per calendar per session. When
190
+ `calendars.get` is refused (a connection with only `calendar.events`), the
191
+ zone is the fixed one of the event's own offset (`Etc/GMT-1` for
192
+ `+01:00`), or UTC, so neither a read nor a write that already happened
193
+ fails on it.
194
+ `create` and `update` send local times with
195
+ `timeZone`, which Calendar reads in that zone. `respond` patches the
196
+ attendee list with only the person's own `responseStatus` and comment
197
+ changed. `cancel` deletes with `sendUpdates=all`; Google sends attendees
198
+ its own notice, so a cancellation comment is not delivered.
199
+ - **Drive.** `drive read` exports Docs and Slides as `text/plain` and Sheets
200
+ as `text/csv` (the first sheet; the sheet list the design names needs the
201
+ Sheets API and is not returned), and reads only text files of other types,
202
+ with a `Range` request cut at `max_bytes`. `drive upload` uses a multipart upload, or a resumable
203
+ one above 5 MB whose session URI must stay on `/upload/drive/v3/`.
204
+ - **Tests.** The REST commands run against Vercel Labs' Google emulator
205
+ (`@emulators/google`) where it serves them, and against fakes for the rest
206
+ (`events.get`, `events.patch`, `files.export`, resumable uploads) and for
207
+ error injection.
208
+ - **Telemetry.** The host's `http` records each request (each retried
209
+ attempt included) as a client span, a child of the tool call's
210
+ `execute_tool` span, on the tracer scope
211
+ `@introspection-ai/recipe-productivity-google`. The package names each
212
+ request by the discovery document's path from the host's root, such as
213
+ `GET /gmail/v1/users/{userId}/messages/{id}`, and its method id as
214
+ `introspection.api.operation_id` (such as `gmail.users.messages.get`). A
215
+ read's JSON answer up to 256 KiB is recorded under
216
+ `gen_ai.tool.call.result`, so the Introspection processor seals it as it
217
+ seals tool results; a write's answer, bytes, headers, paths and queries
218
+ never are. The resumable upload's session URI comes back in a header, and
219
+ the Drive fields the package asks for carry no signed link.
220
+ - **Not yet:** a live-domain test.
221
+
222
+ Request and response shapes come from Google's discovery documents as
223
+ published in `googleapis/google-api-go-client` at `b6ee70b`:
224
+ `gmail/v1/gmail-api.json` (revision 20261005),
225
+ `calendar/v3/calendar-api.json` (20261030) and `drive/v3/drive-api.json`
226
+ (20261023).
@@ -0,0 +1,143 @@
1
+ # Microsoft productivity provider
2
+
3
+ **Status: built** (`packages/productivity/microsoft`), not yet published or
4
+ tested against a live tenant. [As built](#as-built) lists where it differs from
5
+ the design below.
6
+
7
+ The `microsoft` provider serves the `mail`, `calendar` and `drive` tools from
8
+ a person's Outlook mail, Outlook calendar and OneDrive or SharePoint files,
9
+ over Microsoft Graph v1.0. It is the package
10
+ `@introspection-ai/recipe-productivity-microsoft`.
11
+
12
+ ```json
13
+ {
14
+ "peerDependencies": {
15
+ "@introspection-ai/recipe-productivity-microsoft": ">=X.Y.Z"
16
+ },
17
+ "pi": {
18
+ "productivity": [{ "provider": "microsoft" }]
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## Graph client
24
+
25
+ A small fetch client over Graph v1.0, not the Microsoft Graph TypeScript SDK,
26
+ which is pre-release (`1.0.0-preview.*`) and large. The client handles
27
+ `@odata.nextLink` paging, `429`, `503` and `504` with `Retry-After`, and error
28
+ mapping. The Graph types it uses are written by hand from Graph's OpenAPI
29
+ description (`microsoftgraph/msgraph-metadata`, `openapi/v1.0/openapi.yaml`),
30
+ so nothing extra ships at run time.
31
+
32
+ | Command | Graph | Delegated scope |
33
+ | --- | --- | --- |
34
+ | `mail search` | `GET /me/messages?$search=` or `$filter=` | `Mail.Read` |
35
+ | `mail read` | `GET /me/messages/{id}`, `/me/messages?$filter=conversationId eq`, with `$expand=attachments` | `Mail.Read` |
36
+ | `mail fetch_attachment` | `GET /me/messages/{id}/attachments/{id}`, then `/$value` | `Mail.Read` |
37
+ | `mail draft` / `update_draft` | `POST /me/messages`, `POST /me/messages/{id}/createReply`, `PATCH /me/messages/{id}` | `Mail.ReadWrite` |
38
+ | `mail send` | `POST /me/messages/{id}/send` | `Mail.Send` |
39
+ | `mail move` / `mail label` | `POST /me/messages/{id}/move`, `PATCH` `categories` | `Mail.ReadWrite` |
40
+ | `calendar list` | `GET /me/calendarView?startDateTime=&endDateTime=` | `Calendars.Read` |
41
+ | `calendar free_busy` | `POST /me/calendar/getSchedule`, 20 addresses per call | `Calendars.Read` |
42
+ | `calendar create` / `update` / `cancel` | `POST /me/events`, `PATCH /me/events/{id}`, `POST /me/events/{id}/cancel` | `Calendars.ReadWrite` |
43
+ | `calendar respond` | `POST /me/events/{id}/accept`, `tentativelyAccept`, `decline` | `Calendars.ReadWrite` |
44
+ | `calendar read` | `GET /me/events/{id}` | `Calendars.Read` |
45
+ | `drive search` / `read` / `download` | `GET /me/drive/root/search(q=)`, `GET /me/drive/items/{id}/content` | `Files.Read` |
46
+ | `drive upload` | `PUT /me/drive/items/{parent}:/{name}:/content`, upload sessions above 4 MB | `Files.ReadWrite` |
47
+
48
+ `mail label` maps to Outlook categories, and `mail move` to folders. The
49
+ descriptor states this, since Outlook has no labels in Gmail's sense.
50
+
51
+ ## As built
52
+
53
+ - **Retries.** The host's `http` retries a read (`GET`s and `getSchedule`)
54
+ ([Write a provider](README.md#write-a-provider)). A write is sent once,
55
+ even on a `429`, and a wait the host will not sleep through comes back as
56
+ `rate_limited` with `retry_after_seconds`. `$batch` is not used.
57
+ - **Errors.** `401` is `not_connected`; `403` is `missing_scope`, naming the
58
+ command's scope from the table (Graph does not say which was missing);
59
+ `404` and `410` are `not_found`; `429` is `rate_limited`; other `4xx` are
60
+ `invalid_request`; `5xx` and network failures are `provider_error`.
61
+ - **Mail.** `mail search` uses `$filter` and `$orderby` without text and a
62
+ KQL `$search` with it (Graph combines neither with the other), filtering
63
+ `unread` from the page in that case. `from` as an address is matched with
64
+ `$filter`; `from` as a name goes through KQL (`from:"Alice Smith"`), since
65
+ Graph documents no `$filter` on the sender's name. KQL's `received` takes only a date in
66
+ the mailbox's zone, so with text the dates are widened a day each way and
67
+ the exact `after` and `before` instants filter the page, as `$filter`
68
+ applies them without text. A thread read follows every page, newest first,
69
+ up to 500 messages; a longer thread returns its latest 500 and says so in
70
+ `unavailable`. `folder` and `mail move` take a
71
+ well-known folder (`inbox`, `archive`, `sent`, `drafts`, `trash`, `junk`)
72
+ or a top-level folder's display name. Draft bodies are sent as plain text;
73
+ a reply's text goes in `createReply`'s `comment`, so the quoted thread is
74
+ kept. `mail send` returns no sent-message id, since Graph answers `202`.
75
+ `mail label` reads the message's categories and writes the new set.
76
+ - **Calendar.** `calendar list` and `read` return times in UTC. An event
77
+ listed from a named calendar carries that calendar in its id
78
+ (`<calendarId>/<eventId>`), so `read`, `update`, `respond` and `cancel`
79
+ reach it through `/me/calendars/{id}/events/{id}`, as a calendar shared from
80
+ another mailbox needs. `update` refuses a `body` change on an online
81
+ meeting: Graph replaces the whole body, which holds the Teams join details,
82
+ so the change would disable the meeting (`event-update.md`), and the
83
+ details have no documented delimiter to keep them by.
84
+ `create` and `update` send wall-clock times in the event's IANA zone (a
85
+ time with an offset is converted to it). `free_busy` treats
86
+ `workingElsewhere` as busy and drops `free` slots.
87
+ - **Drive.** A file id carries its drive (`<driveId>/<itemId>`), so items
88
+ in another drive resolve. `drive read` returns text only for text files;
89
+ Word, Excel and PowerPoint files say to use `drive download`. Downloads
90
+ follow Graph's `302` to the pre-authenticated URL without the bearer.
91
+ `drive upload` never overwrites (`conflictBehavior=rename`) and uses an
92
+ upload session in 10 MiB ranges (a 320 KiB multiple) above 4 MiB.
93
+ - **Telemetry.** The host's `http` records each Graph request, each retried
94
+ attempt and each redirect or upload-range request as a client span, a child
95
+ of the tool call's `execute_tool` span, on the tracer scope
96
+ `@introspection-ai/recipe-productivity-microsoft`. The package names each
97
+ request by the path template in Graph's OpenAPI description, such as
98
+ `GET /me/messages/{message-id}` (a request to a pre-authenticated URL is
99
+ named by its method alone). A JSON response body up to 256 KiB is recorded
100
+ under `gen_ai.tool.call.result`; bytes, headers, paths and queries never
101
+ are, since a bearer, an id or a pre-authenticated link can be in them.
102
+ - **Not yet:** a live-tenant test; `Files.Read` reaches the person's own
103
+ OneDrive, and SharePoint results may need `Files.Read.All` or
104
+ `Sites.Read.All`. A download's pre-authenticated host
105
+ (`*.sharepoint.com`) must be reachable through the egress.
106
+
107
+ Endpoint references, from `MicrosoftDocs/microsoft-graph-docs-contrib`
108
+ (`api-reference/v1.0/api/`): `user-list-messages.md`, `message-get.md`,
109
+ `message-list-attachments.md`, `attachment-get.md`, `user-post-messages.md`,
110
+ `message-createreply.md`, `message-update.md`, `message-send.md`,
111
+ `message-move.md`, `user-list-mailfolders.md`, `user-list-calendarview.md`,
112
+ `calendar-list-calendarview.md`, `user-list-calendars.md`, `event-get.md`,
113
+ `calendar-getschedule.md`, `user-post-events.md`, `event-update.md`,
114
+ `event-accept.md`, `event-tentativelyaccept.md`, `event-decline.md`,
115
+ `event-cancel.md`, `driveitem-search.md`, `driveitem-get.md`,
116
+ `driveitem-get-content.md`, `driveitem-put-content.md` and
117
+ `driveitem-createuploadsession.md`.
118
+
119
+ ## Why Graph rather than Work IQ
120
+
121
+ Microsoft's Work IQ MCP server reaches the same data through generic path
122
+ tools, is delegated-only, and may need a Microsoft 365 Copilot licence per
123
+ person (*to confirm*). Graph serves every command here with delegated scopes
124
+ alone. A Recipe that wants Work IQ's Copilot tools (`ask`, `retrieve`) binds
125
+ it as an ordinary MCP server beside these tools.
126
+
127
+ ## Authentication and setup
128
+
129
+ The package sends a placeholder bearer to `graph.microsoft.com`, and the host
130
+ attaches the person's token
131
+ ([productivity tools, Authentication](README.md#authentication)).
132
+
133
+ A tenant admin registers one Entra app with the connector callback as its
134
+ redirect URI, adds the delegated scopes for the commands the Recipe enables
135
+ (`Mail.Read`, `Mail.ReadWrite`, `Mail.Send`, `Calendars.Read`,
136
+ `Calendars.ReadWrite`, `Files.Read`, `Files.ReadWrite`, plus
137
+ `offline_access`), and grants admin consent for the tenant, so people connect
138
+ without a consent screen.
139
+
140
+ ## Docs, Sheets and Slides equivalents
141
+
142
+ Word, Excel and PowerPoint files are [documents](../documents/README.md) work, as for
143
+ Google: `drive download` fetches them and `drive upload` returns the result.
@@ -208,7 +208,7 @@ image, npm) they are there too.
208
208
 
209
209
  A package can also ship skills a Recipe uses; see
210
210
  [Shipping skills in a package](#shipping-skills-in-a-package).
211
- [Channel tools](channels.md) and [Document tools](documents.md) show full
211
+ [Channel tools](channels/README.md) and [Document tools](documents/README.md) show full
212
212
  examples, and how a loaded package is checked against the running Recipes.
213
213
 
214
214
  ### Channel tools
@@ -247,7 +247,7 @@ Omitting it allows supported commands; an empty list exposes no channel tool.
247
247
  `requireReply` is an optional boolean that defaults to `true` when channel tools
248
248
  are enabled. Incoming turns then require a successful final `reply`, so an
249
249
  enabled command allowlist must include `reply`. Set `requireReply: false` for
250
- intentional silence, such as a read-only allowlist. See [Channel tools](channels.md).
250
+ intentional silence, such as a read-only allowlist. See [Channel tools](channels/README.md).
251
251
 
252
252
  ### Document tools
253
253
 
@@ -272,7 +272,26 @@ kind of work, such as `legal-redlining-en-US`, which the docx package ships.
272
272
  }
273
273
  ```
274
274
 
275
- See [Document tools](documents.md).
275
+ See [Document tools](documents/README.md).
276
+
277
+ ### Productivity tools
278
+
279
+ `pi.productivity` names one provider for the `mail`, `calendar` and `drive`
280
+ tools, as `{"provider": "<provider>"}` served by
281
+ `@introspection-ai/recipe-productivity-<provider>`, with an optional `tools`
282
+ object holding a command allowlist per tool. A second provider is refused.
283
+
284
+ ```json
285
+ {
286
+ "pi": {
287
+ "productivity": [
288
+ { "provider": "microsoft", "tools": { "mail": ["search", "read", "draft"] } }
289
+ ]
290
+ }
291
+ }
292
+ ```
293
+
294
+ See [Productivity tools](productivity/README.md).
276
295
 
277
296
  ## Judges
278
297
 
@@ -476,6 +495,8 @@ lists them in `tools`:
476
495
  | `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). |
477
496
  | `show_artifact` | Shows a markdown file the agent wrote (a brief, test cases, a report) in a panel on the right of Pi's terminal, and adds `/recipe view`; Esc closes it. Elsewhere it returns the file's path as text. See [Pi extension](pi-extension.md#artifact-panel). |
478
497
  | `review_artifacts` | Asks the user to review several markdown files the agent wrote, one decision per file (approve, or request changes saying what to change). In Pi's terminal each file shows in the artifact panel; other hosts render their own review. See [Pi extension](pi-extension.md#reviewing-several-files). |
498
+ | `introspection_open` | Asks the person to open an Introspection page (install GitHub or Slack, add a connector, connect their own account, set up sign-in, connect a Runtime's MCP server, look at a Runtime or task) and, with `wait: true`, pauses until they are done. In Pi's terminal it runs the Introspection CLI's loopback; pause/resume hosts render a card. See [Interactions](interactions.md#the-built-in-introspection_open-tool). |
499
+ | `introspection_open` | Asks the person to open an Introspection page (install GitHub or Slack, add a connector, connect their own account, set up sign-in, connect a Runtime's MCP server, look at a Runtime or task) and, with `wait: true`, pauses until they are done. In Pi's terminal it runs the Introspection CLI's loopback; pause/resume hosts render a card. See [Interactions](interactions.md#the-built-in-introspection_open-tool). |
479
500
 
480
501
  ```yaml
481
502
  tools: [read, bash, ask_user_question, show_artifact]