@rubytech/create-maxy-code 0.1.459 → 0.1.461

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 (189) hide show
  1. package/dist/__tests__/cron-heartbeat-registration.test.js +57 -28
  2. package/dist/__tests__/launchd-plist.test.js +26 -0
  3. package/dist/cron-registration.js +30 -8
  4. package/dist/index.js +50 -9
  5. package/dist/launchd-plist.js +1 -1
  6. package/dist/uninstall.js +9 -3
  7. package/package.json +1 -1
  8. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js +116 -6
  9. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js.map +1 -1
  10. package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js +20 -0
  11. package/payload/platform/lib/storage-broker/dist/__tests__/object-limits.test.js.map +1 -1
  12. package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.d.ts +2 -0
  13. package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.d.ts.map +1 -0
  14. package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.js +41 -0
  15. package/payload/platform/lib/storage-broker/dist/__tests__/resource-limits.test.js.map +1 -0
  16. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts +1 -0
  17. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts.map +1 -1
  18. package/payload/platform/lib/storage-broker/dist/cf-exec.js +116 -48
  19. package/payload/platform/lib/storage-broker/dist/cf-exec.js.map +1 -1
  20. package/payload/platform/lib/storage-broker/dist/index.d.ts +1 -0
  21. package/payload/platform/lib/storage-broker/dist/index.d.ts.map +1 -1
  22. package/payload/platform/lib/storage-broker/dist/index.js +1 -0
  23. package/payload/platform/lib/storage-broker/dist/index.js.map +1 -1
  24. package/payload/platform/lib/storage-broker/dist/object-limits.d.ts +27 -0
  25. package/payload/platform/lib/storage-broker/dist/object-limits.d.ts.map +1 -1
  26. package/payload/platform/lib/storage-broker/dist/object-limits.js +27 -7
  27. package/payload/platform/lib/storage-broker/dist/object-limits.js.map +1 -1
  28. package/payload/platform/lib/storage-broker/dist/resource-limits.d.ts +102 -0
  29. package/payload/platform/lib/storage-broker/dist/resource-limits.d.ts.map +1 -0
  30. package/payload/platform/lib/storage-broker/dist/resource-limits.js +105 -0
  31. package/payload/platform/lib/storage-broker/dist/resource-limits.js.map +1 -0
  32. package/payload/platform/lib/storage-broker/src/__tests__/cf-exec.test.ts +130 -7
  33. package/payload/platform/lib/storage-broker/src/__tests__/object-limits.test.ts +30 -0
  34. package/payload/platform/lib/storage-broker/src/__tests__/resource-limits.test.ts +49 -0
  35. package/payload/platform/lib/storage-broker/src/cf-exec.ts +129 -56
  36. package/payload/platform/lib/storage-broker/src/index.ts +1 -0
  37. package/payload/platform/lib/storage-broker/src/object-limits.ts +26 -6
  38. package/payload/platform/lib/storage-broker/src/resource-limits.ts +105 -0
  39. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +5 -4
  40. package/payload/platform/plugins/cloudflare/PLUGIN.md +3 -1
  41. package/payload/platform/plugins/cloudflare/bin/portal-enrol.mjs +96 -0
  42. package/payload/platform/plugins/cloudflare/mcp/__tests__/auth-route.test.ts +220 -0
  43. package/payload/platform/plugins/cloudflare/mcp/__tests__/authorize.test.ts +201 -0
  44. package/payload/platform/plugins/cloudflare/mcp/__tests__/file-routes.test.ts +178 -0
  45. package/payload/platform/plugins/cloudflare/mcp/__tests__/harness.test.ts +32 -0
  46. package/payload/platform/plugins/cloudflare/mcp/__tests__/passcode.test.ts +204 -0
  47. package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-enrol.test.ts +207 -0
  48. package/payload/platform/plugins/cloudflare/mcp/__tests__/ratelimit.test.ts +77 -0
  49. package/payload/platform/plugins/cloudflare/mcp/__tests__/skill-contract.test.ts +46 -0
  50. package/payload/platform/plugins/cloudflare/mcp/__tests__/template-config.test.ts +55 -0
  51. package/payload/platform/plugins/cloudflare/mcp/__tests__/upload-route.test.ts +255 -0
  52. package/payload/platform/plugins/cloudflare/mcp/package.json +5 -2
  53. package/payload/platform/plugins/cloudflare/references/r2-object-storage.md +46 -0
  54. package/payload/platform/plugins/cloudflare/skills/data-portal/SKILL.md +125 -0
  55. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/authorize.ts +32 -0
  56. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/log.ts +12 -0
  57. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/passcode.mjs +193 -0
  58. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/ratelimit.ts +55 -0
  59. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/session.ts +85 -0
  60. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/types.ts +44 -0
  61. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/auth.ts +119 -0
  62. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/delete.ts +89 -0
  63. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/download.ts +70 -0
  64. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/files.ts +41 -0
  65. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/upload.ts +151 -0
  66. package/payload/platform/plugins/cloudflare/skills/data-portal/template/public/index.html +42 -0
  67. package/payload/platform/plugins/cloudflare/skills/data-portal/template/public/portal.css +113 -0
  68. package/payload/platform/plugins/cloudflare/skills/data-portal/template/public/portal.js +155 -0
  69. package/payload/platform/plugins/cloudflare/skills/data-portal/template/schema.sql +73 -0
  70. package/payload/platform/plugins/cloudflare/skills/data-portal/template/wrangler.toml +21 -0
  71. package/payload/platform/plugins/cloudflare/skills/site-deploy/SKILL.md +8 -0
  72. package/payload/platform/plugins/docs/references/outlook-guide.md +3 -3
  73. package/payload/platform/plugins/docs/references/voice-mirror-guide.md +1 -0
  74. package/payload/platform/plugins/filesystem/PLUGIN.md +0 -1
  75. package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.d.ts +14 -10
  76. package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.d.ts.map +1 -1
  77. package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.js +14 -10
  78. package/payload/platform/plugins/filesystem/mcp/dist/lib/scope.js.map +1 -1
  79. package/payload/platform/plugins/outlook/.claude-plugin/plugin.json +1 -1
  80. package/payload/platform/plugins/outlook/PLUGIN.md +3 -5
  81. package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.d.ts +2 -0
  82. package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.d.ts.map +1 -0
  83. package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.js +75 -0
  84. package/payload/platform/plugins/outlook/mcp/dist/__tests__/detach.test.js.map +1 -0
  85. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.d.ts +2 -0
  86. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.d.ts.map +1 -0
  87. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.js +187 -0
  88. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit-removal.test.js.map +1 -0
  89. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js +1 -1
  90. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-edit.test.js.map +1 -1
  91. package/payload/platform/plugins/outlook/mcp/dist/index.js +3 -2
  92. package/payload/platform/plugins/outlook/mcp/dist/index.js.map +1 -1
  93. package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.d.ts +43 -0
  94. package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.d.ts.map +1 -0
  95. package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.js +65 -0
  96. package/payload/platform/plugins/outlook/mcp/dist/lib/attachment-list.js.map +1 -0
  97. package/payload/platform/plugins/outlook/mcp/dist/lib/detach.d.ts +65 -0
  98. package/payload/platform/plugins/outlook/mcp/dist/lib/detach.d.ts.map +1 -0
  99. package/payload/platform/plugins/outlook/mcp/dist/lib/detach.js +99 -0
  100. package/payload/platform/plugins/outlook/mcp/dist/lib/detach.js.map +1 -0
  101. package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts +6 -1
  102. package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.d.ts.map +1 -1
  103. package/payload/platform/plugins/outlook/mcp/dist/lib/outbound-attachments.js.map +1 -1
  104. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts +42 -22
  105. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts.map +1 -1
  106. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js +59 -23
  107. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js.map +1 -1
  108. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.d.ts +15 -16
  109. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.d.ts.map +1 -1
  110. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js +8 -41
  111. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-attachment.js.map +1 -1
  112. package/payload/platform/plugins/outlook/references/auth.md +1 -1
  113. package/payload/platform/plugins/outlook/references/graph-surfaces.md +7 -3
  114. package/payload/platform/plugins/outlook/skills/outlook/SKILL.md +1 -1
  115. package/payload/platform/plugins/storage-broker/PLUGIN.md +1 -1
  116. package/payload/platform/plugins/voice-mirror/PLUGIN.md +19 -7
  117. package/payload/platform/plugins/voice-mirror/mcp/dist/index.d.ts.map +1 -1
  118. package/payload/platform/plugins/voice-mirror/mcp/dist/index.js +35 -16
  119. package/payload/platform/plugins/voice-mirror/mcp/dist/index.js.map +1 -1
  120. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.d.ts +31 -0
  121. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.d.ts.map +1 -0
  122. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.js +87 -0
  123. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/admin-user.js.map +1 -0
  124. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.d.ts.map +1 -1
  125. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.js +111 -12
  126. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.js.map +1 -1
  127. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-ingest-session-text.d.ts.map +1 -1
  128. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-ingest-session-text.js +2 -1
  129. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-ingest-session-text.js.map +1 -1
  130. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-record-feedback.d.ts.map +1 -1
  131. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-record-feedback.js +2 -1
  132. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-record-feedback.js.map +1 -1
  133. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-retrieve-conditioning.d.ts.map +1 -1
  134. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-retrieve-conditioning.js +54 -21
  135. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-retrieve-conditioning.js.map +1 -1
  136. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.d.ts +2 -2
  137. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.d.ts.map +1 -1
  138. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.js +12 -3
  139. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-tag-content.js.map +1 -1
  140. package/payload/platform/plugins/voice-mirror/mcp/scripts/smoke.mjs +444 -0
  141. package/payload/platform/plugins/voice-mirror/skills/voice-mirror/SKILL.md +18 -2
  142. package/payload/platform/scripts/__tests__/logs-rotate.test.sh +256 -0
  143. package/payload/platform/scripts/__tests__/resume-tunnel.test.sh +79 -0
  144. package/payload/platform/scripts/logs-rotate.sh +204 -0
  145. package/payload/platform/scripts/resume-tunnel.sh +27 -0
  146. package/payload/platform/scripts/voice-author-key-audit.sh +155 -0
  147. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  148. package/payload/platform/services/claude-session-manager/dist/http-server.js +41 -5
  149. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  150. package/payload/platform/services/claude-session-manager/dist/index.d.ts +1 -0
  151. package/payload/platform/services/claude-session-manager/dist/index.d.ts.map +1 -1
  152. package/payload/platform/services/claude-session-manager/dist/index.js +22 -0
  153. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  154. package/payload/platform/services/claude-session-manager/dist/install-start-counter.d.ts +2 -0
  155. package/payload/platform/services/claude-session-manager/dist/install-start-counter.d.ts.map +1 -0
  156. package/payload/platform/services/claude-session-manager/dist/install-start-counter.js +12 -0
  157. package/payload/platform/services/claude-session-manager/dist/install-start-counter.js.map +1 -0
  158. package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.d.ts +17 -0
  159. package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.d.ts.map +1 -0
  160. package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.js +88 -0
  161. package/payload/platform/services/claude-session-manager/dist/mcp-descriptor-resolve.js.map +1 -0
  162. package/payload/platform/services/claude-session-manager/dist/pty-census.d.ts +122 -9
  163. package/payload/platform/services/claude-session-manager/dist/pty-census.d.ts.map +1 -1
  164. package/payload/platform/services/claude-session-manager/dist/pty-census.js +214 -29
  165. package/payload/platform/services/claude-session-manager/dist/pty-census.js.map +1 -1
  166. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +0 -1
  167. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  168. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +36 -24
  169. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  170. package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts.map +1 -1
  171. package/payload/platform/services/claude-session-manager/dist/rc-daemon.js +13 -1
  172. package/payload/platform/services/claude-session-manager/dist/rc-daemon.js.map +1 -1
  173. package/payload/platform/services/claude-session-manager/dist/session-memory-cap.d.ts.map +1 -1
  174. package/payload/platform/services/claude-session-manager/dist/session-memory-cap.js +4 -2
  175. package/payload/platform/services/claude-session-manager/dist/session-memory-cap.js.map +1 -1
  176. package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.d.ts +150 -0
  177. package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.d.ts.map +1 -0
  178. package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.js +333 -0
  179. package/payload/platform/services/claude-session-manager/dist/slice-memory-policy.js.map +1 -0
  180. package/payload/platform/services/claude-session-manager/dist/start-counter.d.ts +10 -0
  181. package/payload/platform/services/claude-session-manager/dist/start-counter.d.ts.map +1 -0
  182. package/payload/platform/services/claude-session-manager/dist/start-counter.js +55 -0
  183. package/payload/platform/services/claude-session-manager/dist/start-counter.js.map +1 -0
  184. package/payload/server/{chunk-Q6W4U6HL.js → chunk-JXWFVE5X.js} +83 -39
  185. package/payload/server/server.js +268 -73
  186. package/payload/server/{src-3I2RYZFB.js → src-4F37OHLK.js} +11 -1
  187. package/payload/platform/plugins/outlook/mcp/dist/__tests__/pkce-flow.test.d.ts +0 -2
  188. package/payload/platform/plugins/outlook/mcp/dist/__tests__/pkce-flow.test.js +0 -215
  189. package/payload/platform/plugins/outlook/mcp/dist/__tests__/pkce-flow.test.js.map +0 -1
@@ -1,16 +1,20 @@
1
1
  /**
2
2
  * Read HOUSE_ADMIN_SCOPE for the plugin, fail-closed. HOUSE_ADMIN_SCOPE is the
3
3
  * whole boundary: it is present in the spawn env ONLY for a house role:admin
4
- * session (Task 1440). This plugin's PLUGIN.md also declares the key with a
5
- * `${HOUSE_ADMIN_SCOPE}` placeholder so the value flows on loaders that pass
6
- * only declared env keys but an UNSET placeholder is substituted
7
- * differently across spawn loaders: some yield empty, some leave the literal
8
- * `${HOUSE_ADMIN_SCOPE}` string (which is truthy). Treating a literal
9
- * placeholder or an empty value as "no scope" makes a non-house session
10
- * deterministically fail-closed regardless of loader behaviour — the read
11
- * never trusts a value it did not receive as a real scope. (This is why the
12
- * plugin does not call the shared `readHouseAdminScope`, whose truthy test
13
- * would accept the literal placeholder.)
4
+ * session (Task 1440), and it reaches this server by INHERITANCE from that
5
+ * env never from a declared env block. Task 1700 deleted this plugin's
6
+ * `HOUSE_ADMIN_SCOPE: ${HOUSE_ADMIN_SCOPE}` declaration: the key is not in the
7
+ * platform placeholder map, so declaring it could only ever yield the literal
8
+ * `${HOUSE_ADMIN_SCOPE}` string (which is truthy), and the `mcp-manifest: auto`
9
+ * generator discards the block anyway. Do not restore the declaration.
10
+ *
11
+ * The literal-placeholder guard below stays as defence in depth. Since Task
12
+ * 1700 the platform drops an unresolvable key rather than emitting its literal,
13
+ * so no loader should now deliver one — but treating a literal placeholder or
14
+ * an empty value as "no scope" keeps a non-house session deterministically
15
+ * fail-closed regardless of loader behaviour: the read never trusts a value it
16
+ * did not receive as a real scope. (This is why the plugin does not call the
17
+ * shared `readHouseAdminScope`, whose truthy test would accept the literal.)
14
18
  */
15
19
  export declare function readPluginHouseScope(env: NodeJS.ProcessEnv): string | null;
16
20
  export interface Ctx {
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/lib/scope.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,IAAI,CAK1E;AAED,MAAM,WAAW,GAAG;IAClB,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,6EAA6E;IAC7E,WAAW,EAAE,M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E"}
@@ -20,16 +20,20 @@ const short = (id) => id.slice(0, 8);
20
20
  /**
21
21
  * Read HOUSE_ADMIN_SCOPE for the plugin, fail-closed. HOUSE_ADMIN_SCOPE is the
22
22
  * whole boundary: it is present in the spawn env ONLY for a house role:admin
23
- * session (Task 1440). This plugin's PLUGIN.md also declares the key with a
24
- * `${HOUSE_ADMIN_SCOPE}` placeholder so the value flows on loaders that pass
25
- * only declared env keys but an UNSET placeholder is substituted
26
- * differently across spawn loaders: some yield empty, some leave the literal
27
- * `${HOUSE_ADMIN_SCOPE}` string (which is truthy). Treating a literal
28
- * placeholder or an empty value as "no scope" makes a non-house session
29
- * deterministically fail-closed regardless of loader behaviour — the read
30
- * never trusts a value it did not receive as a real scope. (This is why the
31
- * plugin does not call the shared `readHouseAdminScope`, whose truthy test
32
- * would accept the literal placeholder.)
23
+ * session (Task 1440), and it reaches this server by INHERITANCE from that
24
+ * env never from a declared env block. Task 1700 deleted this plugin's
25
+ * `HOUSE_ADMIN_SCOPE: ${HOUSE_ADMIN_SCOPE}` declaration: the key is not in the
26
+ * platform placeholder map, so declaring it could only ever yield the literal
27
+ * `${HOUSE_ADMIN_SCOPE}` string (which is truthy), and the `mcp-manifest: auto`
28
+ * generator discards the block anyway. Do not restore the declaration.
29
+ *
30
+ * The literal-placeholder guard below stays as defence in depth. Since Task
31
+ * 1700 the platform drops an unresolvable key rather than emitting its literal,
32
+ * so no loader should now deliver one — but treating a literal placeholder or
33
+ * an empty value as "no scope" keeps a non-house session deterministically
34
+ * fail-closed regardless of loader behaviour: the read never trusts a value it
35
+ * did not receive as a real scope. (This is why the plugin does not call the
36
+ * shared `readHouseAdminScope`, whose truthy test would accept the literal.)
33
37
  */
34
38
  export function readPluginHouseScope(env) {
35
39
  const raw = env.HOUSE_ADMIN_SCOPE;
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/lib/scope.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,yE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,CAAC;IACpF,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "outlook",
3
- "description": "Microsoft 365 / Outlook.com via Microsoft Graph. Mail is read (list, search, full-body), reply, delete, and compose (draft, draft-edit, send); contacts are read-only; calendar is read + control. Per-account OAuth device-code flow; no client secret. One account can hold several mailboxes at once; every operational tool takes an optional mailbox selector (email or graphUserId) and refuses ambiguously when two or more are attached and none is named. Tools — outlook-account-register / outlook-account-register-poll: device-code register (start + poll); outlook-mail-list / outlook-mail-search: inbox triage (~255-char preview) with a date window (list) or KQL from:/subject: filters (search) and a nextCursor for paging beyond the newest page; outlook-mail-fetch-body: full body of one message by id; outlook-mail-attachment: list a message's inbound attachments, or download one file attachment's bytes to the account uploads folder; outlook-mail-reply: in-thread reply (replyAll, cc/bcc, attachments); outlook-mail-delete: move to Deleted Items (recoverable); outlook-mail-otp-extract: poll for a one-time code; outlook-mail-send / outlook-draft / outlook-draft-edit / outlook-draft-send: compose, edit, and send, all with attachments; outlook-calendar-list / outlook-calendar-event: read calendar; outlook-calendar-create / outlook-calendar-update / outlook-calendar-cancel / outlook-calendar-respond / outlook-calendar-freebusy: control calendar; outlook-contacts-list: contacts; outlook-mailbox-info: auth state + folder count for one mailbox; outlook-mailbox-list: every connected mailbox.",
3
+ "description": "Microsoft 365 / Outlook.com via Microsoft Graph. Mail is read (list, search, full-body), reply, delete, and compose (draft, draft-edit, send); contacts are read-only; calendar is read + control. Per-account OAuth device-code flow; no client secret. One account can hold several mailboxes at once; every operational tool takes an optional mailbox selector (email or graphUserId) and refuses ambiguously when two or more are attached and none is named. Tools — outlook-account-register / outlook-account-register-poll: device-code register (start + poll); outlook-mail-list / outlook-mail-search: inbox triage (~255-char preview) with a date window (list) or KQL from:/subject: filters (search) and a nextCursor for paging beyond the newest page; outlook-mail-fetch-body: full body of one message by id; outlook-mail-attachment: list any message's attachments (received or draft), or download one file attachment's bytes to the account uploads folder; outlook-mail-reply: in-thread reply (replyAll, cc/bcc, attachments); outlook-mail-delete: move to Deleted Items (recoverable); outlook-mail-otp-extract: poll for a one-time code; outlook-mail-send / outlook-draft / outlook-draft-edit / outlook-draft-send: compose, edit, and send, all with attachments; outlook-calendar-list / outlook-calendar-event: read calendar; outlook-calendar-create / outlook-calendar-update / outlook-calendar-cancel / outlook-calendar-respond / outlook-calendar-freebusy: control calendar; outlook-contacts-list: contacts; outlook-mailbox-info: auth state + folder count for one mailbox; outlook-mailbox-list: every connected mailbox.",
4
4
  "version": "0.1.0",
5
5
  "author": {
6
6
  "name": "Rubytech LLC"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: outlook
3
- description: Microsoft 365 / Outlook.com via Microsoft Graph. Mail is read (list, search, full-body), reply, delete, and compose (draft, draft-edit, send); contacts are read-only; calendar is read + control. Per-account OAuth device-code flow; no client secret. One account can hold several mailboxes at once; every operational tool takes an optional mailbox selector (email or graphUserId) and refuses ambiguously when two or more are attached and none is named. Tools — outlook-account-register / outlook-account-register-poll: device-code register (start + poll); outlook-mail-list / outlook-mail-search: inbox triage (~255-char preview) with a date window (list) or KQL from:/subject: filters (search) and a nextCursor for paging beyond the newest page; outlook-mail-fetch-body: full body of one message by id; outlook-mail-attachment: list a message's inbound attachments, or download one file attachment's bytes to the account uploads folder; outlook-mail-reply: in-thread reply (replyAll, cc/bcc, attachments); outlook-mail-delete: move to Deleted Items (recoverable); outlook-mail-otp-extract: poll for a one-time code; outlook-mail-send / outlook-draft / outlook-draft-edit / outlook-draft-send: compose, edit, and send, all with attachments; outlook-calendar-list / outlook-calendar-event: read calendar; outlook-calendar-create / outlook-calendar-update / outlook-calendar-cancel / outlook-calendar-respond / outlook-calendar-freebusy: control calendar; outlook-contacts-list: contacts; outlook-mailbox-info: auth state + folder count for one mailbox; outlook-mailbox-list: every connected mailbox.
3
+ description: Microsoft 365 / Outlook.com via Microsoft Graph. Mail is read (list, search, full-body), reply, delete, and compose (draft, draft-edit, send); contacts are read-only; calendar is read + control. Per-account OAuth device-code flow; no client secret. One account can hold several mailboxes at once; every operational tool takes an optional mailbox selector (email or graphUserId) and refuses ambiguously when two or more are attached and none is named. Tools — outlook-account-register / outlook-account-register-poll: device-code register (start + poll); outlook-mail-list / outlook-mail-search: inbox triage (~255-char preview) with a date window (list) or KQL from:/subject: filters (search) and a nextCursor for paging beyond the newest page; outlook-mail-fetch-body: full body of one message by id; outlook-mail-attachment: list any message's attachments (received or draft), or download one file attachment's bytes to the account uploads folder; outlook-mail-reply: in-thread reply (replyAll, cc/bcc, attachments); outlook-mail-delete: move to Deleted Items (recoverable); outlook-mail-otp-extract: poll for a one-time code; outlook-mail-send / outlook-draft / outlook-draft-edit / outlook-draft-send: compose, edit, and send, all with attachments; outlook-calendar-list / outlook-calendar-event: read calendar; outlook-calendar-create / outlook-calendar-update / outlook-calendar-cancel / outlook-calendar-respond / outlook-calendar-freebusy: control calendar; outlook-contacts-list: contacts; outlook-mailbox-info: auth state + folder count for one mailbox; outlook-mailbox-list: every connected mailbox.
4
4
  tools:
5
5
  - name: outlook-account-register
6
6
  publicAllowlist: false
@@ -85,8 +85,6 @@ mcp:
85
85
  PLATFORM_ROOT: ${PLATFORM_ROOT}
86
86
  ACCOUNT_ID: ${ACCOUNT_ID}
87
87
  SESSION_ID: ${SESSION_ID}
88
- OUTLOOK_CLIENT_ID: ${OUTLOOK_CLIENT_ID}
89
- OUTLOOK_TENANT_ID: ${OUTLOOK_TENANT_ID}
90
88
  mcp-manifest: auto
91
89
  ---
92
90
 
@@ -99,10 +97,10 @@ Microsoft Graph access for Outlook.com / Microsoft 365 mailboxes. Mail is read (
99
97
  - **Register:** `outlook-account-register` — starts the OAuth device-code flow against the brand's Entra app and returns a user code + verification URL immediately. The operator opens `microsoft.com/devicelogin` on any device, enters the code, and consents. The always-running server then completes registration on its own: a self-contained dispatcher (`dist/scripts/complete-registration.js`), armed on a 30 s interval, polls every live pending code to a terminal outcome, so a mailbox connects once the operator consents with no agent action. `outlook-account-register-poll` remains the manual path and the fallback, one check per call. Registering a second mailbox on the same account adds it alongside the first rather than replacing it; each mailbox holds its own encrypted tokens (AES-256-CBC) under a shared account key. One device-code flow runs at a time per account; starting another while one is live returns an `in-progress` signal. Observability: `devicecode-autopoll` per poll cycle and an independent `devicecode-stranded` audit for any pending code left un-harvested past its lifetime.
100
98
  - **Multiple mailboxes:** one account can hold several mailboxes. Every operational tool takes an optional `mailbox` argument (email or graphUserId). With one mailbox, omit it. With two or more, name it — omitting it returns a refusal listing the connected mailboxes. `outlook-mailbox-list` shows them all.
101
99
  - **Mail (read):** `outlook-mail-list` returns messages newest-first with an optional `since`/`before` date window, and `outlook-mail-search` runs a Graph `$search` (KQL) query where `from:`/`to:`/`subject:`/`received>=` filters live — both return Microsoft's short `bodyPreview` (~255 chars) for cheap triage and a `nextCursor` for paging beyond the 250-per-page window (the cursor is an opaque `@odata.nextLink`; pass it back as `cursor`). Graph forbids `$search`+`$filter`, so the strict date window is on the list tool and sender/subject filtering is on the search tool. `outlook-mail-fetch-body` reads the COMPLETE body of one message by id (HTML decoded to text, no preview cap) — the full-read path. All three read tools report `hasAttachments` per message, so the agent knows to reach for the attachment tool.
102
- - **Mail (attachments):** `outlook-mail-attachment` lists or downloads a message's inbound attachments. Called with `messageId` alone it LISTS them (`id`, `name`, `contentType`, `size`, `isInline`, and a `kind` of `file`/`item`/`reference`) via `GET /me/messages/{id}/attachments` with `$select` (no bytes). Called with `messageId`+`attachmentId` it DOWNLOADS one file attachment: the bytes are written to `{accountDir}/uploads/outlook/<messageHash>/<bytesHash>-<name>` at `0o600` and the saved absolute path is returned, ready for the Read tool, `SendUserFile`, or an `outlook-mail-reply` attachment. Only file attachments download — `item` (embedded message/event) and `reference` (cloud-drive link) kinds are refused, as are empty payloads and anything over the 25 MB cap; in each case nothing is written. Requires `Mail.Read`.
100
+ - **Mail (attachments):** `outlook-mail-attachment` lists or downloads any message's attachments — received or draft. Called with `messageId` alone it LISTS them (`id`, `name`, `contentType`, `size`, `isInline`, and a `kind` of `file`/`item`/`reference`) via `GET /me/messages/{id}/attachments` with `$select` (no bytes); a draft is a message in the same collection, so passing a draftId lists what that draft carries, and the returned `name`/`id` is the handle `outlook-draft-edit`'s `removeAttachments` takes. Called with `messageId`+`attachmentId` it DOWNLOADS one file attachment: the bytes are written to `{accountDir}/uploads/outlook/<messageHash>/<bytesHash>-<name>` at `0o600` and the saved absolute path is returned, ready for the Read tool, `SendUserFile`, or an `outlook-mail-reply` attachment. Only file attachments download — `item` (embedded message/event) and `reference` (cloud-drive link) kinds are refused, as are empty payloads and anything over the 25 MB cap; in each case nothing is written. Requires `Mail.Read`.
103
101
  - **Mail (reply / delete):** `outlook-mail-reply` replies in-thread (native `conversationId` threading) with `replyAll`, added cc/bcc, and account-scoped file attachments (up to 25 MB per file — files over Graph's ~3 MB inline limit stream through a chunked upload session); the body is prepended above the quoted original. `outlook-mail-delete` moves messages to Deleted Items (recoverable — never hard-deletes). Both require `Mail.ReadWrite` (reply also needs `Mail.Send`).
104
102
  - **Mail (OTP):** `outlook-mail-otp-extract` polls the inbox for a one-time verification code from a named sender, reading full bodies to extract it — used during service authentication.
105
- - **Mail (send / draft):** `outlook-mail-send` sends a new message — via `POST /me/sendMail` with no attachments, or composed as a draft, attached, and sent when `attachments` is present (`/me/sendMail` carries attachments inline and cannot fit a large file); `outlook-draft` creates a draft, attaches any files, and returns its id; `outlook-draft-edit` updates an existing draft in place (Graph drafts are mutable) and can add attachments (additive it cannot remove one); `outlook-draft-send` sends an existing draft by id. Recipients are to/cc/bcc arrays; body is HTML or plain text via `isHtml`; `attachments` are file paths inside the account directory, capped at 25 MB per file and validated before any Graph write. Success asserted on Graph 202. Requires `Mail.Send` + `Mail.ReadWrite`; a mailbox on the old read-only consent returns an actionable "re-register to grant send" signal.
103
+ - **Mail (send / draft):** `outlook-mail-send` sends a new message — via `POST /me/sendMail` with no attachments, or composed as a draft, attached, and sent when `attachments` is present (`/me/sendMail` carries attachments inline and cannot fit a large file); `outlook-draft` creates a draft, attaches any files, and returns its id; `outlook-draft-edit` updates an existing draft in place (Graph drafts are mutable) and edits its attachments — `attachments` adds files, `removeAttachments` takes them off by name or attachment id, and both together replace a file in one call; `outlook-draft-send` sends an existing draft by id. Recipients are to/cc/bcc arrays; body is HTML or plain text via `isHtml`; `attachments` are file paths inside the account directory, capped at 25 MB per file and validated before any Graph write. Success asserted on Graph 202. Requires `Mail.Send` + `Mail.ReadWrite`; a mailbox on the old read-only consent returns an actionable "re-register to grant send" signal.
106
104
  - **Calendar (read + control):** `outlook-calendar-list` and `outlook-calendar-event` read events; `outlook-calendar-create` books an event; `outlook-calendar-update` reschedules or edits one; `outlook-calendar-cancel` cancels a meeting (notifying attendees when the account organises it) or deletes a personal appointment; `outlook-calendar-respond` accepts, declines, or tentatively accepts an invite; `outlook-calendar-freebusy` reports availability for one or more addresses over a window. Writes require the `Calendars.ReadWrite` consent; a mailbox on stale read-only consent returns a distinct signal naming the scope and `outlook-account-register`.
107
105
  - **Contacts (read-only):** `outlook-contacts-list` returns contacts.
108
106
  - **Health:** `outlook-mailbox-info` reports auth state, refresh-window status, and top-level folder count for one mailbox (name it with `mailbox` when several are attached). `outlook-mailbox-list` lists every attached mailbox with its email, scopes, and token health, reading local stores only, never the network. It reports an `addressable` count and a per-mailbox `status` (`ok` / `blank-email` / `refresh-expired` / `unreadable`) so an authenticated, addressable mailbox is distinguishable from one that is merely present: a bare `count` of 1 is not "connected" unless that mailbox is `status:ok`. Use these to answer "did mailbox X auth?" without grepping logs.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=detach.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detach.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/detach.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { AttachmentRefusedError } from "../lib/outbound-attachments.js";
4
+ import { resolveRemovalsOrRefuse } from "../lib/detach.js";
5
+ function item(id, name) {
6
+ return { id, name, contentType: "application/pdf", size: 10, isInline: false, kind: "file" };
7
+ }
8
+ test("resolveRemovalsOrRefuse: resolves a target by exact name", () => {
9
+ const items = [item("A1", "report.pdf"), item("A2", "notes.txt")];
10
+ const out = resolveRemovalsOrRefuse(items, ["report.pdf"], "draft-edit");
11
+ assert.deepEqual(out, [{ attachmentId: "A1", name: "report.pdf" }]);
12
+ });
13
+ test("resolveRemovalsOrRefuse: resolves a target by attachment id", () => {
14
+ const items = [item("A1", "report.pdf"), item("A2", "notes.txt")];
15
+ const out = resolveRemovalsOrRefuse(items, ["A2"], "draft-edit");
16
+ assert.deepEqual(out, [{ attachmentId: "A2", name: "notes.txt" }]);
17
+ });
18
+ test("resolveRemovalsOrRefuse: an id match wins over a name match", () => {
19
+ // A file literally named "A2" alongside an attachment whose id is "A2".
20
+ const items = [item("A1", "A2"), item("A2", "notes.txt")];
21
+ const out = resolveRemovalsOrRefuse(items, ["A2"], "draft-edit");
22
+ assert.deepEqual(out, [{ attachmentId: "A2", name: "notes.txt" }], "the precise handle wins");
23
+ });
24
+ test("resolveRemovalsOrRefuse: a name not on the draft refuses not-on-draft and names what IS on it", () => {
25
+ const items = [item("A1", "report.pdf"), item("A2", "notes.txt")];
26
+ assert.throws(() => resolveRemovalsOrRefuse(items, ["absent.pdf"], "draft-edit"), (err) => {
27
+ assert.ok(err instanceof AttachmentRefusedError);
28
+ assert.equal(err.reason, "not-on-draft");
29
+ assert.equal(err.file, "absent.pdf");
30
+ assert.match(err.message, /report\.pdf/);
31
+ assert.match(err.message, /notes\.txt/);
32
+ return true;
33
+ });
34
+ });
35
+ test("resolveRemovalsOrRefuse: an empty draft refuses not-on-draft without inventing contents", () => {
36
+ assert.throws(() => resolveRemovalsOrRefuse([], ["absent.pdf"], "draft-edit"), (err) => {
37
+ assert.ok(err instanceof AttachmentRefusedError);
38
+ assert.equal(err.reason, "not-on-draft");
39
+ assert.match(err.message, /no attachments/);
40
+ return true;
41
+ });
42
+ });
43
+ test("resolveRemovalsOrRefuse: a name matching two attachments refuses ambiguous-name with the ids", () => {
44
+ const items = [item("A1", "report.pdf"), item("A2", "report.pdf")];
45
+ assert.throws(() => resolveRemovalsOrRefuse(items, ["report.pdf"], "draft-edit"), (err) => {
46
+ assert.ok(err instanceof AttachmentRefusedError);
47
+ assert.equal(err.reason, "ambiguous-name");
48
+ assert.equal(err.file, "report.pdf");
49
+ assert.match(err.message, /A1/);
50
+ assert.match(err.message, /A2/);
51
+ return true;
52
+ });
53
+ });
54
+ test("resolveRemovalsOrRefuse: resolves every target in one call", () => {
55
+ const items = [item("A1", "report.pdf"), item("A2", "notes.txt")];
56
+ const out = resolveRemovalsOrRefuse(items, ["report.pdf", "A2"], "draft-edit");
57
+ assert.deepEqual(out, [
58
+ { attachmentId: "A1", name: "report.pdf" },
59
+ { attachmentId: "A2", name: "notes.txt" },
60
+ ]);
61
+ });
62
+ test("resolveRemovalsOrRefuse: two targets naming the same attachment collapse to one removal", () => {
63
+ // An agent holding both handles for one file from a listing. Without the
64
+ // dedup the second DELETE 404s and the call reports failure for work that
65
+ // wholly succeeded.
66
+ const items = [item("A1", "report.pdf"), item("A2", "notes.txt")];
67
+ const out = resolveRemovalsOrRefuse(items, ["A1", "report.pdf"], "draft-edit");
68
+ assert.deepEqual(out, [{ attachmentId: "A1", name: "report.pdf" }]);
69
+ });
70
+ test("resolveRemovalsOrRefuse: the same target twice collapses to one removal", () => {
71
+ const items = [item("A1", "report.pdf")];
72
+ const out = resolveRemovalsOrRefuse(items, ["report.pdf", "report.pdf"], "draft-edit");
73
+ assert.deepEqual(out, [{ attachmentId: "A1", name: "report.pdf" }]);
74
+ });
75
+ //# sourceMappingURL=detach.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detach.test.js","sourceRoot":"","sources":["../../src/__tests__/detach.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,oBAAoB,CAAC;A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-removal.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,187 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { mkdtempSync, writeFileSync } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { join } from "node:path";
6
+ import { TokenStore } from "../auth/token-store.js";
7
+ import { runDraftEdit } from "../tools/draft-edit.js";
8
+ import { AttachmentRefusedError } from "../lib/outbound-attachments.js";
9
+ function configWithToken(accountId) {
10
+ const dir = mkdtempSync(join(tmpdir(), "outlook-dr-"));
11
+ const tokenStore = new TokenStore(accountId, dir);
12
+ tokenStore.store("access-token", "refresh-token", 3600, { scopes: ["Mail.ReadWrite", "Mail.Send"] });
13
+ return { clientId: "test-client", tenantId: "common", accountId, tokenStore };
14
+ }
15
+ /** Mock Graph: a GET on the attachments collection returns `listing`; every
16
+ * other call answers `{id:"DE1"}` like the existing draft-edit suite. */
17
+ function mockRouted(listing) {
18
+ const calls = [];
19
+ const original = globalThis.fetch;
20
+ globalThis.fetch = (async (input, init) => {
21
+ const req = input instanceof Request ? input : null;
22
+ const url = req ? req.url : typeof input === "string" ? input : input.toString();
23
+ const method = req?.method ?? init?.method ?? "GET";
24
+ if (!url.includes("graph.microsoft.com"))
25
+ return original(input, init);
26
+ let body = null;
27
+ if (req)
28
+ body = await req.clone().text().catch(() => null);
29
+ else if (typeof init?.body === "string")
30
+ body = init.body;
31
+ calls.push({ url, method, body });
32
+ if (method === "GET" && /\/attachments(\?|$)/.test(url)) {
33
+ const value = listing.map((l) => ({
34
+ "@odata.type": "#microsoft.graph.fileAttachment",
35
+ id: l.id,
36
+ name: l.name,
37
+ contentType: "application/pdf",
38
+ size: 10,
39
+ isInline: false,
40
+ }));
41
+ return new Response(JSON.stringify({ value }), { status: 200, headers: { "content-type": "application/json" } });
42
+ }
43
+ return new Response(JSON.stringify({ id: "DE1" }), { status: 200, headers: { "content-type": "application/json" } });
44
+ });
45
+ return { restore: () => { globalThis.fetch = original; }, calls };
46
+ }
47
+ test("outlook-draft-edit: a removal DELETEs the resolved attachment id", async () => {
48
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }]);
49
+ try {
50
+ const r = await runDraftEdit(configWithToken("acct-dr1"), {
51
+ draftId: "DE1",
52
+ removeAttachments: ["report.pdf"],
53
+ });
54
+ assert.deepEqual(r.removed, ["report.pdf"]);
55
+ const dels = mock.calls.filter((c) => c.method === "DELETE");
56
+ assert.equal(dels.length, 1, "exactly one DELETE");
57
+ assert.match(dels[0].url, /\/messages\/DE1\/attachments\/A1$/);
58
+ }
59
+ finally {
60
+ mock.restore();
61
+ }
62
+ });
63
+ test("outlook-draft-edit: removal alone is a valid edit — no PATCH", async () => {
64
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }]);
65
+ try {
66
+ const r = await runDraftEdit(configWithToken("acct-dr2"), {
67
+ draftId: "DE1",
68
+ removeAttachments: ["report.pdf"],
69
+ });
70
+ assert.equal(r.updated, true);
71
+ assert.ok(!mock.calls.some((c) => c.method === "PATCH"), "no PATCH when only attachments are removed");
72
+ }
73
+ finally {
74
+ mock.restore();
75
+ }
76
+ });
77
+ test("outlook-draft-edit: removal by attachment id works", async () => {
78
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }, { id: "A2", name: "notes.txt" }]);
79
+ try {
80
+ const r = await runDraftEdit(configWithToken("acct-dr3"), {
81
+ draftId: "DE1",
82
+ removeAttachments: ["A2"],
83
+ });
84
+ assert.deepEqual(r.removed, ["notes.txt"]);
85
+ const dels = mock.calls.filter((c) => c.method === "DELETE");
86
+ assert.equal(dels.length, 1);
87
+ assert.match(dels[0].url, /\/attachments\/A2$/);
88
+ }
89
+ finally {
90
+ mock.restore();
91
+ }
92
+ });
93
+ test("outlook-draft-edit: a same-name swap resolves the removal against pre-call state", async () => {
94
+ const dir = mkdtempSync(join(tmpdir(), "outlook-acct-dr4-"));
95
+ process.env.ACCOUNT_DIR = dir;
96
+ const file = join(dir, "report.pdf");
97
+ writeFileSync(file, "the newer report");
98
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }]);
99
+ try {
100
+ const r = await runDraftEdit(configWithToken("acct-dr4"), {
101
+ draftId: "DE1",
102
+ removeAttachments: ["report.pdf"],
103
+ attachments: [file],
104
+ });
105
+ assert.deepEqual(r.removed, ["report.pdf"]);
106
+ assert.deepEqual(r.attachments, ["report.pdf"]);
107
+ // The OLD file's id was pinned before the new one landed.
108
+ const dels = mock.calls.filter((c) => c.method === "DELETE");
109
+ assert.equal(dels.length, 1);
110
+ assert.match(dels[0].url, /\/attachments\/A1$/);
111
+ // And the removal happened before the add, not after.
112
+ const delIdx = mock.calls.findIndex((c) => c.method === "DELETE");
113
+ const postIdx = mock.calls.findIndex((c) => c.method === "POST" && /\/DE1\/attachments$/.test(c.url));
114
+ assert.ok(delIdx >= 0 && postIdx >= 0, "both a DELETE and an attach POST were issued");
115
+ assert.ok(delIdx < postIdx, "the removal precedes the add");
116
+ }
117
+ finally {
118
+ mock.restore();
119
+ delete process.env.ACCOUNT_DIR;
120
+ }
121
+ });
122
+ test("outlook-draft-edit: removing a file the draft does not carry throws before any write", async () => {
123
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }]);
124
+ try {
125
+ await assert.rejects(() => runDraftEdit(configWithToken("acct-dr5"), {
126
+ draftId: "DE1",
127
+ subject: "a field edit that must not land",
128
+ removeAttachments: ["absent.pdf"],
129
+ }), (err) => {
130
+ assert.ok(err instanceof AttachmentRefusedError);
131
+ assert.equal(err.reason, "not-on-draft");
132
+ assert.match(err.message, /report\.pdf/, "the refusal names what IS on the draft");
133
+ return true;
134
+ });
135
+ // The listing GET is allowed; nothing that mutates the draft is.
136
+ assert.ok(!mock.calls.some((c) => c.method !== "GET"), "no PATCH, DELETE or POST was issued");
137
+ }
138
+ finally {
139
+ mock.restore();
140
+ }
141
+ });
142
+ test("outlook-draft-edit: an ambiguous name is refused rather than resolved arbitrarily", async () => {
143
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }, { id: "A2", name: "report.pdf" }]);
144
+ try {
145
+ await assert.rejects(() => runDraftEdit(configWithToken("acct-dr6"), {
146
+ draftId: "DE1",
147
+ removeAttachments: ["report.pdf"],
148
+ }), (err) => {
149
+ assert.ok(err instanceof AttachmentRefusedError);
150
+ assert.equal(err.reason, "ambiguous-name");
151
+ return true;
152
+ });
153
+ assert.ok(!mock.calls.some((c) => c.method === "DELETE"), "nothing was deleted");
154
+ }
155
+ finally {
156
+ mock.restore();
157
+ }
158
+ });
159
+ test("outlook-draft-edit: naming one file by both id and name removes it once", async () => {
160
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }, { id: "A2", name: "notes.txt" }]);
161
+ try {
162
+ const r = await runDraftEdit(configWithToken("acct-dr9"), {
163
+ draftId: "DE1",
164
+ removeAttachments: ["A1", "report.pdf"],
165
+ });
166
+ assert.deepEqual(r.removed, ["report.pdf"], "reported once, not twice");
167
+ const dels = mock.calls.filter((c) => c.method === "DELETE");
168
+ assert.equal(dels.length, 1, "one DELETE — a second would 404 and fail a call that succeeded");
169
+ }
170
+ finally {
171
+ mock.restore();
172
+ }
173
+ });
174
+ test("outlook-draft-edit: no listing GET is issued when no removal is requested", async () => {
175
+ const mock = mockRouted([{ id: "A1", name: "report.pdf" }]);
176
+ try {
177
+ await runDraftEdit(configWithToken("acct-dr7"), { draftId: "DE1", subject: "just a subject" });
178
+ assert.ok(!mock.calls.some((c) => c.method === "GET"), "the listing is only fetched to resolve a removal");
179
+ }
180
+ finally {
181
+ mock.restore();
182
+ }
183
+ });
184
+ test("outlook-draft-edit: an empty edit still names removeAttachments in its error", async () => {
185
+ await assert.rejects(() => runDraftEdit(configWithToken("acct-dr8"), { draftId: "DE1" }), /removeAttachments/);
186
+ });
187
+ //# sourceMappingURL=draft-edit-removal.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-edit-removal.test.js","sourceRoot":"","sources":["../../src/__tests__/draft-edit-removal.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW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C;QAC/F,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,EAAE,kDAAkD,CAAC,CAAC;IAC7G,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;IAC9F,MAAM,MAAM,CAAC,OAAO,CAClB,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EACnE,mBAAmB,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -38,7 +38,7 @@ test("outlook-draft-edit: PATCHes only supplied fields, and reports the id Graph
38
38
  const mock = mockGraph(200, { id: "DRAFT9-RESAVED" });
39
39
  try {
40
40
  const r = await runDraftEdit(configWithToken("acct-de-1"), { draftId: "DRAFT9", subject: "Revised", body: "new text" });
41
- assert.deepEqual(r, { draftId: "DRAFT9-RESAVED", updated: true, attachments: [] });
41
+ assert.deepEqual(r, { draftId: "DRAFT9-RESAVED", updated: true, attachments: [], removed: [] });
42
42
  assert.equal(mock.calls.length, 1);
43
43
  assert.equal(mock.calls[0].method, "PATCH");
44
44
  assert.match(mock.calls[0].url, /\/me\/messages\/DRAFT9$/);
@@ -1 +1 @@
1
- {"version":3,"file":"draft-edit.test.js","sourceRoot":"","sources":["../../src/__tests__/draft-edit.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE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AC;IACJ,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;IACnE,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACzG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,sBAAsB,CAAC,CAAC;IACjE,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,2EAA2E,EAAE,KAAK,IAAI,EAAE;IAC3F,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAC9G,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -233,7 +233,7 @@ lifelineTool(server, "outlook-mail-fetch-body", "Read the COMPLETE body of one m
233
233
  return fail(`outlook-mail-fetch-body failed: ${err.message}`);
234
234
  }
235
235
  });
236
- lifelineTool(server, "outlook-mail-attachment", "List or download a message's inbound attachments. Call with messageId alone to LIST attachments (id, name, contentType, size, isInline, kind) — kind is file, item, or reference. Call with messageId and attachmentId to DOWNLOAD one file attachment: its bytes are written to the account's uploads/outlook folder and the saved absolute path is returned, ready for the Read tool, SendUserFile, or an outlook-mail-reply attachment. Only file attachments download (item and reference kinds are refused); the cap is 25 MB. Find messages that have attachments via outlook-mail-list / outlook-mail-search (both report hasAttachments). Requires the Mail.Read scope.", {
236
+ lifelineTool(server, "outlook-mail-attachment", "List or download a message's attachments — works on any message, received or draft. Call with messageId alone to LIST attachments (id, name, contentType, size, isInline, kind) — kind is file, item, or reference. Pass a draftId as messageId to see what a draft carries before editing it, and use the returned name or id with outlook-draft-edit's removeAttachments. Call with messageId and attachmentId to DOWNLOAD one file attachment: its bytes are written to the account's uploads/outlook folder and the saved absolute path is returned, ready for the Read tool, SendUserFile, or an outlook-mail-reply attachment. Only file attachments download (item and reference kinds are refused); the cap is 25 MB. Find messages that have attachments via outlook-mail-list / outlook-mail-search (both report hasAttachments). Requires the Mail.Read scope.", {
237
237
  messageId: z.string().min(1),
238
238
  attachmentId: z.string().min(1).optional(),
239
239
  mailbox: mailboxArg,
@@ -522,7 +522,7 @@ lifelineTool(server, "outlook-draft-send", "Send an existing draft by id via Mic
522
522
  return fail(`outlook-draft-send failed: ${err.message}`);
523
523
  }
524
524
  });
525
- lifelineTool(server, "outlook-draft-edit", "Update an existing draft in place via Microsoft Graph PATCH /me/messages/{draftId}, and/or add attachments to it. Graph drafts are mutable, so this edits the stored draft directly (no delete-and-reappend). Pass draftId (from outlook-draft) plus only the fields to change: to, cc, bcc, subject, body, isHtml, attachments. attachments is an array of file paths inside the account directory (up to 25 MB per file) and is ADDITIVE — files are added to whatever the draft already carries; this tool cannot remove an attachment. At least one field or attachment is required. Only drafts are editable — a PATCH on a sent message returns an error. Requires the Mail.ReadWrite scope.", {
525
+ lifelineTool(server, "outlook-draft-edit", "Update an existing draft in place via Microsoft Graph PATCH /me/messages/{draftId}, and/or add and remove its attachments. Graph drafts are mutable, so this edits the stored draft directly (no delete-and-reappend). Pass draftId (from outlook-draft) plus only the fields to change: to, cc, bcc, subject, body, isHtml, attachments, removeAttachments. attachments is an array of file paths inside the account directory (up to 25 MB per file) and is added to what the draft already carries. removeAttachments takes files off the draft, each entry either an attachment name or an attachment id (list them with outlook-mail-attachment, passing the draftId as messageId). Passing both replaces a file in one call: removals resolve against the draft's state before the call, so swapping a file for a newer file of the same name is unambiguous. Removing a file the draft does not carry, or a name it carries twice, is refused and changes nothing. At least one field, attachment or removal is required. Only drafts are editable — a PATCH on a sent message returns an error, and Graph does not allow removing an attachment from a sent message. Requires the Mail.ReadWrite scope.", {
526
526
  draftId: z.string().min(1),
527
527
  to: z.array(z.string().min(3)).optional(),
528
528
  cc: z.array(z.string()).optional(),
@@ -531,6 +531,7 @@ lifelineTool(server, "outlook-draft-edit", "Update an existing draft in place vi
531
531
  body: z.string().optional(),
532
532
  isHtml: z.boolean().optional(),
533
533
  attachments: z.array(z.string()).optional(),
534
+ removeAttachments: z.array(z.string().min(1)).optional(),
534
535
  mailbox: mailboxArg,
535
536
  }, async ({ mailbox, ...args }) => {
536
537
  if (!ACCOUNT_ID)