@rubytech/create-maxy-code 0.1.461 → 0.1.463

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 (186) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/graph-mcp/dist/index.d.ts +2 -1
  3. package/payload/platform/lib/graph-mcp/dist/index.d.ts.map +1 -1
  4. package/payload/platform/lib/graph-mcp/dist/index.js +14 -22
  5. package/payload/platform/lib/graph-mcp/dist/index.js.map +1 -1
  6. package/payload/platform/lib/graph-mcp/src/index.ts +15 -22
  7. package/payload/platform/lib/mcp-spawn-tee/dist/index.d.ts +8 -7
  8. package/payload/platform/lib/mcp-spawn-tee/dist/index.d.ts.map +1 -1
  9. package/payload/platform/lib/mcp-spawn-tee/dist/index.js +19 -19
  10. package/payload/platform/lib/mcp-spawn-tee/dist/index.js.map +1 -1
  11. package/payload/platform/lib/mcp-spawn-tee/src/__tests__/spawn-tee.test.ts +34 -5
  12. package/payload/platform/lib/mcp-spawn-tee/src/index.ts +22 -19
  13. package/payload/platform/lib/mcp-stderr-tee/dist/index.d.ts +35 -17
  14. package/payload/platform/lib/mcp-stderr-tee/dist/index.d.ts.map +1 -1
  15. package/payload/platform/lib/mcp-stderr-tee/dist/index.js +41 -48
  16. package/payload/platform/lib/mcp-stderr-tee/dist/index.js.map +1 -1
  17. package/payload/platform/lib/mcp-stderr-tee/src/index.ts +42 -51
  18. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.js +27 -0
  19. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.js.map +1 -1
  20. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js +49 -0
  21. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js.map +1 -1
  22. package/payload/platform/lib/storage-broker/dist/audit.d.ts +11 -0
  23. package/payload/platform/lib/storage-broker/dist/audit.d.ts.map +1 -1
  24. package/payload/platform/lib/storage-broker/dist/audit.js +16 -0
  25. package/payload/platform/lib/storage-broker/dist/audit.js.map +1 -1
  26. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts +18 -0
  27. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts.map +1 -1
  28. package/payload/platform/lib/storage-broker/dist/cf-exec.js +77 -0
  29. package/payload/platform/lib/storage-broker/dist/cf-exec.js.map +1 -1
  30. package/payload/platform/lib/storage-broker/dist/house-scoped-token.js +3 -0
  31. package/payload/platform/lib/storage-broker/dist/house-scoped-token.js.map +1 -1
  32. package/payload/platform/lib/storage-broker/dist/registry.d.ts +1 -1
  33. package/payload/platform/lib/storage-broker/dist/registry.d.ts.map +1 -1
  34. package/payload/platform/lib/storage-broker/dist/registry.js.map +1 -1
  35. package/payload/platform/lib/storage-broker/src/__tests__/audit.test.ts +32 -1
  36. package/payload/platform/lib/storage-broker/src/__tests__/cf-exec.test.ts +61 -0
  37. package/payload/platform/lib/storage-broker/src/audit.ts +45 -0
  38. package/payload/platform/lib/storage-broker/src/cf-exec.ts +91 -0
  39. package/payload/platform/lib/storage-broker/src/house-scoped-token.ts +3 -0
  40. package/payload/platform/lib/storage-broker/src/registry.ts +5 -1
  41. package/payload/platform/plugins/admin/lib/mcp-spawn-tee/index.js +19 -19
  42. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +23 -12
  43. package/payload/platform/plugins/aeo/lib/mcp-spawn-tee/index.js +19 -19
  44. package/payload/platform/plugins/browser/lib/mcp-spawn-tee/index.js +19 -19
  45. package/payload/platform/plugins/cloudflare/PLUGIN.md +1 -1
  46. package/payload/platform/plugins/cloudflare/mcp/dist/index.js +5 -5
  47. package/payload/platform/plugins/cloudflare/mcp/dist/index.js.map +1 -1
  48. package/payload/platform/plugins/cloudflare/references/hosting-sites.md +2 -0
  49. package/payload/platform/plugins/cloudflare/skills/calendar-site/SKILL.md +1 -1
  50. package/payload/platform/plugins/cloudflare/skills/site-deploy/SKILL.md +2 -0
  51. package/payload/platform/plugins/connector/lib/mcp-spawn-tee/index.js +19 -19
  52. package/payload/platform/plugins/contacts/lib/mcp-spawn-tee/index.js +19 -19
  53. package/payload/platform/plugins/docs/references/admin-session.md +3 -3
  54. package/payload/platform/plugins/docs/references/cloudflare.md +2 -0
  55. package/payload/platform/plugins/docs/references/internals.md +1 -1
  56. package/payload/platform/plugins/docs/references/outlook-guide.md +11 -4
  57. package/payload/platform/plugins/docs/references/plugins-guide.md +8 -6
  58. package/payload/platform/plugins/email/lib/mcp-spawn-tee/index.js +19 -19
  59. package/payload/platform/plugins/filesystem/lib/mcp-spawn-tee/index.js +19 -19
  60. package/payload/platform/plugins/graph-viewer/lib/mcp-spawn-tee/index.js +19 -19
  61. package/payload/platform/plugins/memory/PLUGIN.md +1 -1
  62. package/payload/platform/plugins/memory/lib/mcp-spawn-tee/index.js +19 -19
  63. package/payload/platform/plugins/memory/mcp/dist/lib/log-ingest.js +2 -2
  64. package/payload/platform/plugins/memory/mcp/dist/lib/log-ingest.js.map +1 -1
  65. package/payload/platform/plugins/outlook/.claude-plugin/plugin.json +1 -1
  66. package/payload/platform/plugins/outlook/PLUGIN.md +2 -2
  67. package/payload/platform/plugins/outlook/lib/mcp-spawn-tee/index.js +19 -19
  68. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-threaded.test.d.ts +2 -0
  69. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-threaded.test.d.ts.map +1 -0
  70. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-threaded.test.js +238 -0
  71. package/payload/platform/plugins/outlook/mcp/dist/__tests__/draft-threaded.test.js.map +1 -0
  72. package/payload/platform/plugins/outlook/mcp/dist/index.js +9 -5
  73. package/payload/platform/plugins/outlook/mcp/dist/index.js.map +1 -1
  74. package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts +1 -6
  75. package/payload/platform/plugins/outlook/mcp/dist/lib/message.d.ts.map +1 -1
  76. package/payload/platform/plugins/outlook/mcp/dist/lib/message.js +9 -17
  77. package/payload/platform/plugins/outlook/mcp/dist/lib/message.js.map +1 -1
  78. package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.d.ts +56 -0
  79. package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.d.ts.map +1 -0
  80. package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.js +40 -0
  81. package/payload/platform/plugins/outlook/mcp/dist/lib/recipients.js.map +1 -0
  82. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.d.ts.map +1 -1
  83. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js +1 -3
  84. package/payload/platform/plugins/outlook/mcp/dist/tools/draft-edit.js.map +1 -1
  85. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts +58 -9
  86. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.d.ts.map +1 -1
  87. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js +97 -18
  88. package/payload/platform/plugins/outlook/mcp/dist/tools/draft.js.map +1 -1
  89. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.d.ts.map +1 -1
  90. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js +1 -3
  91. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-fetch-body.js.map +1 -1
  92. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.d.ts.map +1 -1
  93. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js +3 -18
  94. package/payload/platform/plugins/outlook/mcp/dist/tools/mail-reply.js.map +1 -1
  95. package/payload/platform/plugins/outlook/skills/outlook/SKILL.md +5 -2
  96. package/payload/platform/plugins/quickbooks/lib/mcp-spawn-tee/index.js +19 -19
  97. package/payload/platform/plugins/replicate/lib/mcp-spawn-tee/index.js +19 -19
  98. package/payload/platform/plugins/scheduling/lib/mcp-spawn-tee/index.js +19 -19
  99. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js +6 -32
  100. package/payload/platform/plugins/scheduling/mcp/dist/scripts/__tests__/agent-turn-dispatch.test.js.map +1 -1
  101. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.d.ts.map +1 -1
  102. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js +10 -30
  103. package/payload/platform/plugins/scheduling/mcp/dist/scripts/agent-turn-dispatch.js.map +1 -1
  104. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-cancel.test.js +24 -21
  105. package/payload/platform/plugins/scheduling/mcp/dist/tools/__tests__/schedule-cancel.test.js.map +1 -1
  106. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.d.ts +27 -18
  107. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.d.ts.map +1 -1
  108. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.js +31 -27
  109. package/payload/platform/plugins/scheduling/mcp/dist/tools/schedule-cancel.js.map +1 -1
  110. package/payload/platform/plugins/storage-broker/PLUGIN.md +9 -1
  111. package/payload/platform/plugins/storage-broker/lib/mcp-spawn-tee/index.js +19 -19
  112. package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.d.ts.map +1 -1
  113. package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js +16 -5
  114. package/payload/platform/plugins/storage-broker/mcp/dist/confine-path.js.map +1 -1
  115. package/payload/platform/plugins/storage-broker/mcp/dist/index.js +49 -0
  116. package/payload/platform/plugins/storage-broker/mcp/dist/index.js.map +1 -1
  117. package/payload/platform/plugins/telegram/lib/mcp-spawn-tee/index.js +19 -19
  118. package/payload/platform/plugins/url-get/lib/mcp-spawn-tee/index.js +19 -19
  119. package/payload/platform/plugins/voice-mirror/lib/mcp-spawn-tee/index.js +19 -19
  120. package/payload/platform/plugins/web-designer/PLUGIN.md +1 -1
  121. package/payload/platform/plugins/web-designer/commands/website.md +6 -0
  122. package/payload/platform/plugins/web-designer/skills/web-design/references/deploy.md +12 -0
  123. package/payload/platform/plugins/whatsapp/lib/mcp-spawn-tee/index.js +19 -19
  124. package/payload/platform/plugins/work/lib/mcp-spawn-tee/index.js +19 -19
  125. package/payload/platform/plugins/workflows/lib/mcp-spawn-tee/index.js +19 -19
  126. package/payload/platform/scripts/__tests__/logs-rotate.test.sh +24 -20
  127. package/payload/platform/scripts/logs-read.sh +31 -0
  128. package/payload/platform/scripts/logs-rotate.sh +21 -18
  129. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
  130. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +2 -0
  131. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
  132. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  133. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +37 -0
  134. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  135. package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts +5 -3
  136. package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts.map +1 -1
  137. package/payload/platform/services/claude-session-manager/dist/rc-daemon.js.map +1 -1
  138. package/payload/platform/services/telegram-channel/dist/server.d.ts.map +1 -1
  139. package/payload/platform/services/telegram-channel/dist/server.js +0 -4
  140. package/payload/platform/services/telegram-channel/dist/server.js.map +1 -1
  141. package/payload/platform/services/webchat-channel/dist/server.d.ts.map +1 -1
  142. package/payload/platform/services/webchat-channel/dist/server.js +0 -4
  143. package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
  144. package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
  145. package/payload/platform/services/whatsapp-channel/dist/server.js +0 -4
  146. package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
  147. package/payload/server/{chunk-JXWFVE5X.js → chunk-BBSPFN45.js} +65 -0
  148. package/payload/server/public/assets/{AdminLoginScreens-BFbpkEUS.js → AdminLoginScreens-Bed8SDxY.js} +1 -1
  149. package/payload/server/public/assets/{AdminShell-CdOGObaZ.js → AdminShell-BLh9O6dn.js} +1 -1
  150. package/payload/server/public/assets/{Checkbox-RFD_F0c0.js → Checkbox-BC_KSbpS.js} +1 -1
  151. package/payload/server/public/assets/{admin-CYGdL-1O.js → admin-DfWgJVI3.js} +1 -1
  152. package/payload/server/public/assets/{browser-DVfa_plj.js → browser-C0vkv-hH.js} +1 -1
  153. package/payload/server/public/assets/{calendar-JC_Dxa4n.js → calendar-_pfHw0Hp.js} +1 -1
  154. package/payload/server/public/assets/chat-DYT5H81o.js +1 -0
  155. package/payload/server/public/assets/chevron-left-BnpVBu51.js +1 -0
  156. package/payload/server/public/assets/data-CR-fbPWr.js +1 -0
  157. package/payload/server/public/assets/{graph-hBUrRSkr.js → graph-BZiudUGr.js} +1 -1
  158. package/payload/server/public/assets/{graph-labels-CHh6zs8t.js → graph-labels-BzmmJwCR.js} +1 -1
  159. package/payload/server/public/assets/{maximize-2-DjxE4rm9.js → maximize-2-Bhdsv0U-.js} +1 -1
  160. package/payload/server/public/assets/{operator-BqU9SQuu.js → operator-gm2eP4r6.js} +1 -1
  161. package/payload/server/public/assets/{page-DiQhU6lD.js → page-8AB3jUa_.js} +1 -1
  162. package/payload/server/public/assets/page-BoPorLg-.js +32 -0
  163. package/payload/server/public/assets/{public-Cu_eALgY.js → public-DqJk6qgW.js} +1 -1
  164. package/payload/server/public/assets/{rotate-ccw-F9DsSTSJ.js → rotate-ccw-D_5cETGt.js} +1 -1
  165. package/payload/server/public/assets/{tasks-CE-D0f50.js → tasks-EyKLXINi.js} +1 -1
  166. package/payload/server/public/assets/{time-entry-format-D2rsWhov.js → time-entry-format-DAwmmR3i.js} +1 -1
  167. package/payload/server/public/assets/{useCopyFeedback-QxOmoobV.js → useCopyFeedback-rOWd_lzl.js} +1 -1
  168. package/payload/server/public/assets/{useSelectionMode-RIzNqFjV.js → useSelectionMode-DDmLmPph.js} +1 -1
  169. package/payload/server/public/assets/{useSubAccountSwitcher-BW_fK1Nt.css → useSubAccountSwitcher-pu0jjLCz.css} +1 -1
  170. package/payload/server/public/assets/{useVoiceRecorder-WrWurSYI.js → useVoiceRecorder-azG8zSUI.js} +1 -1
  171. package/payload/server/public/browser.html +5 -5
  172. package/payload/server/public/calendar.html +6 -6
  173. package/payload/server/public/chat.html +12 -12
  174. package/payload/server/public/data.html +10 -10
  175. package/payload/server/public/graph.html +11 -11
  176. package/payload/server/public/index.html +13 -13
  177. package/payload/server/public/operator.html +14 -14
  178. package/payload/server/public/public.html +12 -12
  179. package/payload/server/public/tasks.html +5 -5
  180. package/payload/server/server.js +596 -235
  181. package/payload/server/{src-4F37OHLK.js → src-YLGAZY36.js} +5 -1
  182. package/payload/server/public/assets/chat-Yf8Nkop8.js +0 -1
  183. package/payload/server/public/assets/chevron-left-CAiAUBxO.js +0 -1
  184. package/payload/server/public/assets/data-hqdYXaEn.js +0 -1
  185. package/payload/server/public/assets/page-B4c4_4HP.js +0 -32
  186. /package/payload/server/public/assets/{useSubAccountSwitcher-wo_qGW-I.js → useSubAccountSwitcher-CU-lOxTd.js} +0 -0
@@ -1,12 +1,7 @@
1
- import { postGraph, patchGraph } from "../lib/graph-client.js";
1
+ import { postGraph } from "../lib/graph-client.js";
2
2
  import { attachFilesToDraft, resolveAttachmentsOrRefuse } from "../lib/attach.js";
3
3
  import { log } from "../lib/log.js";
4
- function addrs(list) {
5
- return (list ?? []).map((r) => r.emailAddress?.address).filter((a) => !!a);
6
- }
7
- function recip(list) {
8
- return list.map((address) => ({ emailAddress: { address } }));
9
- }
4
+ import { addrs, applyCcBccToDraft } from "../lib/recipients.js";
10
5
  /**
11
6
  * Reply to a message in-thread via Microsoft Graph. Threading is native: the
12
7
  * createReply/createReplyAll draft carries the original conversationId. The
@@ -26,17 +21,7 @@ export async function runMailReply(config, args) {
26
21
  if (!draft?.id) {
27
22
  throw new Error("outlook-mail-reply: Graph created the reply draft but returned no id.");
28
23
  }
29
- const cc = args.cc ?? [];
30
- const bcc = args.bcc ?? [];
31
- if (cc.length > 0 || bcc.length > 0) {
32
- const mergedCc = [...new Set([...addrs(draft.ccRecipients), ...cc])];
33
- const patch = {};
34
- if (mergedCc.length > 0)
35
- patch.ccRecipients = recip(mergedCc);
36
- if (bcc.length > 0)
37
- patch.bccRecipients = recip(bcc);
38
- await patchGraph(config, `/me/messages/${encodeURIComponent(draft.id)}`, patch, { tool: "mail-reply" });
39
- }
24
+ await applyCcBccToDraft(config, draft.id, draft.ccRecipients, args.cc ?? [], args.bcc ?? [], "mail-reply");
40
25
  await attachFilesToDraft(config, draft.id, files, "mail-reply");
41
26
  await postGraph(config, `/me/messages/${encodeURIComponent(draft.id)}/send`, undefined, { tool: "mail-reply" });
42
27
  log({
@@ -1 +1 @@
1
- {"version":3,"file":"mail-reply.js","sourceRoot":"","sources":["../../src/tools/mail-reply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AA4BpC,SAAS,KAAK,CAAC,IAAgC;IAC7C,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AACD,SAAS,KAAK,CAAC,IAAc;IAC3B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAyB,EACzB,IAAe;IAEf,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,KAAK,CAA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c,IAAI,IAAI;QACpC,QAAQ;QACR,WAAW,EAAE,KAAK,CAAC,MAAM;KAC1B,CAAC,CAAC;IAEH,OAAO;QACL,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,IAAI;QAC5C,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC;QAC7B,QAAQ;QACR,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;KACtC,CAAC;AACJ,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; the calendar is read plus control. Use when the user asks about their Outlook mail, calendar, or contacts, wants to read a full message, reply, delete, send or draft a message, or asks to book, move, cancel, or accept a calendar event. First-time use requires outlook-account-register plus outlook-account-register-poll; subsequent use is transparent. Tools: outlook-mail-list / outlook-mail-search (inbox triage, ~255-char preview, date window + nextCursor paging), outlook-mail-fetch-body (full body of one message), outlook-mail-reply (in-thread reply with attachments), outlook-mail-delete (move to Deleted Items), outlook-mail-otp-extract (poll for a one-time code), outlook-mail-send / outlook-draft / outlook-draft-edit / outlook-draft-send (compose, edit, send, 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 (health), outlook-account-register / outlook-account-register-poll (device-code register)."
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; the calendar is read plus control. Use when the user asks about their Outlook mail, calendar, or contacts, wants to read a full message, reply, delete, send or draft a message, or asks to book, move, cancel, or accept a calendar event. First-time use requires outlook-account-register plus outlook-account-register-poll; subsequent use is transparent. Tools: outlook-mail-list / outlook-mail-search (inbox triage, ~255-char preview, date window + nextCursor paging), outlook-mail-fetch-body (full body of one message), outlook-mail-reply (in-thread reply with attachments), outlook-mail-delete (move to Deleted Items), outlook-mail-otp-extract (poll for a one-time code), outlook-mail-send / outlook-draft / outlook-draft-edit / outlook-draft-send (compose, edit, send, with attachments; outlook-draft takes replyToMessageId to draft a threaded reply without sending it), 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 (health), outlook-account-register / outlook-account-register-poll (device-code register)."
4
4
  ---
5
5
 
6
6
  # Outlook (Microsoft Graph)
@@ -84,7 +84,10 @@ Every address is a **quoted string inside an array**, even when there is only on
84
84
 
85
85
  `"to": rob@example.com` (unquoted) and `"to": "rob@example.com"` (quoted but not an array) are both rejected before the call reaches Outlook. A rejection here means the arguments were malformed; it is not evidence that sending is broken. Check `outlook-mailbox-info` before reporting a send fault.
86
86
 
87
- - `outlook-draft` — create a draft in the Drafts folder (same fields, same array-of-quoted-strings shape as send, including `attachments`). Returns the draft's id, and the files are already on the draft, so it can be sent as-is.
87
+ - `outlook-draft` — create a draft in the Drafts folder (same fields, same array-of-quoted-strings shape as send, including `attachments`). Returns the draft's id, and the files are already on the draft, so it can be sent as-is. Two paths:
88
+ - **New message** — pass `to` and `subject`. The draft threads under nothing.
89
+ - **Threaded reply** — pass `replyToMessageId=<id of the message being answered>` (from `outlook-mail-list` / `outlook-mail-search`). The draft lands under the original conversation, so the sender sees the answer beneath their own email. **Use this whenever drafting a reply** — never hand-type a `RE:` subject on a new message, which leaves the reply detached from its thread. `outlook-mail-reply` also threads but sends immediately, so it is the wrong tool when the account's rule is to draft and not send.
90
+ - On the threaded path Graph sets the recipients and `RE:` subject from the original and quotes it beneath the reply, so `to`, `subject`, and `isHtml=true` are **refused** and the body is plain text. Add `replyAll=true` to answer everyone on the original, `cc`/`bcc` to add recipients.
88
91
  - `outlook-draft-edit draftId=<id>` — update an existing draft in place (Graph drafts are mutable, so no delete-and-reappend). Pass the draftId plus only the fields to change: `to`, `cc`, `bcc`, `subject`, `body`, `isHtml`, `attachments`, `removeAttachments` (recipients and attachments take the same array-of-quoted-strings shape as send). `attachments` adds files to the draft. `removeAttachments` takes files off it, each entry either an attachment name or an attachment id. Pass both to replace a file in one call. To see what a draft carries, call `outlook-mail-attachment` with the draftId as its messageId. 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; a sent message cannot be edited.
89
92
  - `outlook-draft-send draftId=<id>` — send a draft created earlier. Graph consumes the draft on send.
90
93
 
@@ -13,14 +13,15 @@
13
13
  *
14
14
  * Claude Code CLI → shim (this file) = node running <real-entry> in-process
15
15
  * stdin/stdout : untouched (JSON-RPC channel)
16
- * stderr : process.stderr.write teed → per-date + per-session + passthrough
16
+ * stderr : process.stderr.write teed → raw sink + passthrough
17
17
  *
18
- * Destinations (Task 706) — unchanged:
19
- * - `${LOG_DIR}/mcp-<name>-stderr-<date>.log` per-date raw (back-compat;
20
- * the in-process mcp-stderr-tee and the [mcp-init-error] probe read it).
21
- * - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — per-session raw + lifecycle
22
- * lines. Authoritative sink. Absent when SESSION_ID is unset (enumeration
23
- * spawn)then the per-date file is the fallback.
18
+ * Destinations:
19
+ * - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — raw stderr + lifecycle lines.
20
+ * The sole raw sink. Task 1721 retired the per-date twin: its date was
21
+ * pinned at spawn, no reader ever parsed it, and mcp-stderr-tee wrote the
22
+ * same file, so every line landed twice.
23
+ * - `${LOG_DIR}/mcp-<name>-nosession.log` — the same, for a spawn with
24
+ * no SESSION_ID (enumeration). One fixed file per server.
24
25
  * - `server.log` via the loopback log-ingest route — best-effort mirror of
25
26
  * the [mcp-helper] lifecycle lines.
26
27
  *
@@ -49,13 +50,13 @@ const PLATFORM_PORT = process.env.PLATFORM_PORT;
49
50
  const ENTRY = process.argv[2];
50
51
  const SESSION_ID8 = SESSION_ID ? SESSION_ID.slice(0, 8) : "—";
51
52
  const spawnStamp = Date.now();
52
- // Per-session raw + lifecycle log (Task 706). Empty SESSION_ID (enumeration
53
- // spawn) undefined, and the per-date file is the fallback.
54
- const perSessionPath = LOG_DIR && SESSION_ID
55
- ? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-${SESSION_ID}.log`)
56
- : undefined;
57
- const perDatePath = LOG_DIR
58
- ? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-stderr-${new Date(spawnStamp).toISOString().slice(0, 10)}.log`)
53
+ // The one raw sink (Task 1721). A sessionless spawn (rc-daemon stamps
54
+ // SESSION_ID='' rc-daemon.ts:513 while still stamping LOG_DIR) shares one
55
+ // fixed file per server rather than a date-named one: the date was never read
56
+ // by any reader and named a process lifetime, not a day. Interleaved spawns in
57
+ // the nosession file are separated by the [mcp-helper] op=spawn pid= lines.
58
+ const rawSinkPath = LOG_DIR
59
+ ? (0, node_path_1.resolve)(LOG_DIR, SESSION_ID ? `mcp-${SERVER_NAME}-${SESSION_ID}.log` : `mcp-${SERVER_NAME}-nosession.log`)
59
60
  : undefined;
60
61
  // Rolling tail of entry stderr for op=exit. Capped so a chatty server cannot
61
62
  // grow the buffer without bound.
@@ -66,7 +67,7 @@ let exitEmitted = false;
66
67
  let exitSignal;
67
68
  // The real stderr writer, captured before the tee replaces it. Lifecycle lines
68
69
  // and stderr passthrough both go through this so they are never re-teed into
69
- // the per-date sink nor recursed back into the patched writer.
70
+ // the raw sink nor recursed back into the patched writer.
70
71
  const rawStderrWrite = process.stderr.write.bind(process.stderr);
71
72
  // LOG_DIR is created once, lazily, on the first successful append — not per
72
73
  // chunk. teeWrite runs on the server's own stderr hot path now, so a per-call
@@ -115,7 +116,7 @@ function postToServerLog(suffix, level) {
115
116
  // log-ingest route rejects newlines).
116
117
  function emitLifecycle(suffix, level) {
117
118
  const line = `[mcp-helper] ${suffix}\n`;
118
- appendSafe(perSessionPath, line);
119
+ appendSafe(rawSinkPath, line);
119
120
  try {
120
121
  rawStderrWrite(line);
121
122
  }
@@ -127,12 +128,11 @@ if (!ENTRY) {
127
128
  process.exit(2);
128
129
  }
129
130
  // Replace process.stderr.write with a tee: mirror every server stderr byte to
130
- // the per-date and per-session sinks, keep a rolling tail for op=exit, emit
131
+ // the raw sink, keep a rolling tail for op=exit, emit
131
132
  // op=boot on the first bytes, then pass the write through to the real stderr.
132
133
  const teeWrite = ((...args) => {
133
134
  const chunk = args[0];
134
- appendSafe(perDatePath, chunk); // per-date raw (back-compat)
135
- appendSafe(perSessionPath, chunk); // per-session raw (Task 706)
135
+ appendSafe(rawSinkPath, chunk); // raw sink (Task 1721)
136
136
  const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
137
137
  stderrTail = (stderrTail + text).slice(-TAIL_CAP);
138
138
  if (!bootEmitted) {
@@ -13,14 +13,15 @@
13
13
  *
14
14
  * Claude Code CLI → shim (this file) = node running <real-entry> in-process
15
15
  * stdin/stdout : untouched (JSON-RPC channel)
16
- * stderr : process.stderr.write teed → per-date + per-session + passthrough
16
+ * stderr : process.stderr.write teed → raw sink + passthrough
17
17
  *
18
- * Destinations (Task 706) — unchanged:
19
- * - `${LOG_DIR}/mcp-<name>-stderr-<date>.log` per-date raw (back-compat;
20
- * the in-process mcp-stderr-tee and the [mcp-init-error] probe read it).
21
- * - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — per-session raw + lifecycle
22
- * lines. Authoritative sink. Absent when SESSION_ID is unset (enumeration
23
- * spawn)then the per-date file is the fallback.
18
+ * Destinations:
19
+ * - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — raw stderr + lifecycle lines.
20
+ * The sole raw sink. Task 1721 retired the per-date twin: its date was
21
+ * pinned at spawn, no reader ever parsed it, and mcp-stderr-tee wrote the
22
+ * same file, so every line landed twice.
23
+ * - `${LOG_DIR}/mcp-<name>-nosession.log` — the same, for a spawn with
24
+ * no SESSION_ID (enumeration). One fixed file per server.
24
25
  * - `server.log` via the loopback log-ingest route — best-effort mirror of
25
26
  * the [mcp-helper] lifecycle lines.
26
27
  *
@@ -49,13 +50,13 @@ const PLATFORM_PORT = process.env.PLATFORM_PORT;
49
50
  const ENTRY = process.argv[2];
50
51
  const SESSION_ID8 = SESSION_ID ? SESSION_ID.slice(0, 8) : "—";
51
52
  const spawnStamp = Date.now();
52
- // Per-session raw + lifecycle log (Task 706). Empty SESSION_ID (enumeration
53
- // spawn) undefined, and the per-date file is the fallback.
54
- const perSessionPath = LOG_DIR && SESSION_ID
55
- ? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-${SESSION_ID}.log`)
56
- : undefined;
57
- const perDatePath = LOG_DIR
58
- ? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-stderr-${new Date(spawnStamp).toISOString().slice(0, 10)}.log`)
53
+ // The one raw sink (Task 1721). A sessionless spawn (rc-daemon stamps
54
+ // SESSION_ID='' rc-daemon.ts:513 while still stamping LOG_DIR) shares one
55
+ // fixed file per server rather than a date-named one: the date was never read
56
+ // by any reader and named a process lifetime, not a day. Interleaved spawns in
57
+ // the nosession file are separated by the [mcp-helper] op=spawn pid= lines.
58
+ const rawSinkPath = LOG_DIR
59
+ ? (0, node_path_1.resolve)(LOG_DIR, SESSION_ID ? `mcp-${SERVER_NAME}-${SESSION_ID}.log` : `mcp-${SERVER_NAME}-nosession.log`)
59
60
  : undefined;
60
61
  // Rolling tail of entry stderr for op=exit. Capped so a chatty server cannot
61
62
  // grow the buffer without bound.
@@ -66,7 +67,7 @@ let exitEmitted = false;
66
67
  let exitSignal;
67
68
  // The real stderr writer, captured before the tee replaces it. Lifecycle lines
68
69
  // and stderr passthrough both go through this so they are never re-teed into
69
- // the per-date sink nor recursed back into the patched writer.
70
+ // the raw sink nor recursed back into the patched writer.
70
71
  const rawStderrWrite = process.stderr.write.bind(process.stderr);
71
72
  // LOG_DIR is created once, lazily, on the first successful append — not per
72
73
  // chunk. teeWrite runs on the server's own stderr hot path now, so a per-call
@@ -115,7 +116,7 @@ function postToServerLog(suffix, level) {
115
116
  // log-ingest route rejects newlines).
116
117
  function emitLifecycle(suffix, level) {
117
118
  const line = `[mcp-helper] ${suffix}\n`;
118
- appendSafe(perSessionPath, line);
119
+ appendSafe(rawSinkPath, line);
119
120
  try {
120
121
  rawStderrWrite(line);
121
122
  }
@@ -127,12 +128,11 @@ if (!ENTRY) {
127
128
  process.exit(2);
128
129
  }
129
130
  // Replace process.stderr.write with a tee: mirror every server stderr byte to
130
- // the per-date and per-session sinks, keep a rolling tail for op=exit, emit
131
+ // the raw sink, keep a rolling tail for op=exit, emit
131
132
  // op=boot on the first bytes, then pass the write through to the real stderr.
132
133
  const teeWrite = ((...args) => {
133
134
  const chunk = args[0];
134
- appendSafe(perDatePath, chunk); // per-date raw (back-compat)
135
- appendSafe(perSessionPath, chunk); // per-session raw (Task 706)
135
+ appendSafe(rawSinkPath, chunk); // raw sink (Task 1721)
136
136
  const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
137
137
  stderrTail = (stderrTail + text).slice(-TAIL_CAP);
138
138
  if (!bootEmitted) {
@@ -13,14 +13,15 @@
13
13
  *
14
14
  * Claude Code CLI → shim (this file) = node running <real-entry> in-process
15
15
  * stdin/stdout : untouched (JSON-RPC channel)
16
- * stderr : process.stderr.write teed → per-date + per-session + passthrough
16
+ * stderr : process.stderr.write teed → raw sink + passthrough
17
17
  *
18
- * Destinations (Task 706) — unchanged:
19
- * - `${LOG_DIR}/mcp-<name>-stderr-<date>.log` per-date raw (back-compat;
20
- * the in-process mcp-stderr-tee and the [mcp-init-error] probe read it).
21
- * - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — per-session raw + lifecycle
22
- * lines. Authoritative sink. Absent when SESSION_ID is unset (enumeration
23
- * spawn)then the per-date file is the fallback.
18
+ * Destinations:
19
+ * - `${LOG_DIR}/mcp-<name>-<SESSION_ID>.log` — raw stderr + lifecycle lines.
20
+ * The sole raw sink. Task 1721 retired the per-date twin: its date was
21
+ * pinned at spawn, no reader ever parsed it, and mcp-stderr-tee wrote the
22
+ * same file, so every line landed twice.
23
+ * - `${LOG_DIR}/mcp-<name>-nosession.log` — the same, for a spawn with
24
+ * no SESSION_ID (enumeration). One fixed file per server.
24
25
  * - `server.log` via the loopback log-ingest route — best-effort mirror of
25
26
  * the [mcp-helper] lifecycle lines.
26
27
  *
@@ -49,13 +50,13 @@ const PLATFORM_PORT = process.env.PLATFORM_PORT;
49
50
  const ENTRY = process.argv[2];
50
51
  const SESSION_ID8 = SESSION_ID ? SESSION_ID.slice(0, 8) : "—";
51
52
  const spawnStamp = Date.now();
52
- // Per-session raw + lifecycle log (Task 706). Empty SESSION_ID (enumeration
53
- // spawn) undefined, and the per-date file is the fallback.
54
- const perSessionPath = LOG_DIR && SESSION_ID
55
- ? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-${SESSION_ID}.log`)
56
- : undefined;
57
- const perDatePath = LOG_DIR
58
- ? (0, node_path_1.resolve)(LOG_DIR, `mcp-${SERVER_NAME}-stderr-${new Date(spawnStamp).toISOString().slice(0, 10)}.log`)
53
+ // The one raw sink (Task 1721). A sessionless spawn (rc-daemon stamps
54
+ // SESSION_ID='' rc-daemon.ts:513 while still stamping LOG_DIR) shares one
55
+ // fixed file per server rather than a date-named one: the date was never read
56
+ // by any reader and named a process lifetime, not a day. Interleaved spawns in
57
+ // the nosession file are separated by the [mcp-helper] op=spawn pid= lines.
58
+ const rawSinkPath = LOG_DIR
59
+ ? (0, node_path_1.resolve)(LOG_DIR, SESSION_ID ? `mcp-${SERVER_NAME}-${SESSION_ID}.log` : `mcp-${SERVER_NAME}-nosession.log`)
59
60
  : undefined;
60
61
  // Rolling tail of entry stderr for op=exit. Capped so a chatty server cannot
61
62
  // grow the buffer without bound.
@@ -66,7 +67,7 @@ let exitEmitted = false;
66
67
  let exitSignal;
67
68
  // The real stderr writer, captured before the tee replaces it. Lifecycle lines
68
69
  // and stderr passthrough both go through this so they are never re-teed into
69
- // the per-date sink nor recursed back into the patched writer.
70
+ // the raw sink nor recursed back into the patched writer.
70
71
  const rawStderrWrite = process.stderr.write.bind(process.stderr);
71
72
  // LOG_DIR is created once, lazily, on the first successful append — not per
72
73
  // chunk. teeWrite runs on the server's own stderr hot path now, so a per-call
@@ -115,7 +116,7 @@ function postToServerLog(suffix, level) {
115
116
  // log-ingest route rejects newlines).
116
117
  function emitLifecycle(suffix, level) {
117
118
  const line = `[mcp-helper] ${suffix}\n`;
118
- appendSafe(perSessionPath, line);
119
+ appendSafe(rawSinkPath, line);
119
120
  try {
120
121
  rawStderrWrite(line);
121
122
  }
@@ -127,12 +128,11 @@ if (!ENTRY) {
127
128
  process.exit(2);
128
129
  }
129
130
  // Replace process.stderr.write with a tee: mirror every server stderr byte to
130
- // the per-date and per-session sinks, keep a rolling tail for op=exit, emit
131
+ // the raw sink, keep a rolling tail for op=exit, emit
131
132
  // op=boot on the first bytes, then pass the write through to the real stderr.
132
133
  const teeWrite = ((...args) => {
133
134
  const chunk = args[0];
134
- appendSafe(perDatePath, chunk); // per-date raw (back-compat)
135
- appendSafe(perSessionPath, chunk); // per-session raw (Task 706)
135
+ appendSafe(rawSinkPath, chunk); // raw sink (Task 1721)
136
136
  const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
137
137
  stderrTail = (stderrTail + text).slice(-TAIL_CAP);
138
138
  if (!bootEmitted) {
@@ -87,11 +87,9 @@ describe("dispatchAgentTurn", () => {
87
87
  const write = driver.runs.find((r) => r.query.includes("lastDispatchResult"));
88
88
  expect(write?.params.lastDispatchResult).toBe("error:404");
89
89
  });
90
- it("mints a per-firing seat id, stamps lastDispatchSessionId before the POST, and sends it (Task 1526)", async () => {
91
- const order = [];
90
+ it("sends no seat id every firing targets the sender's own session (Task 1746)", async () => {
92
91
  const calls = [];
93
92
  globalThis.fetch = vi.fn(async (_url, init) => {
94
- order.push("fetch");
95
93
  calls.push({ body: JSON.parse(init.body) });
96
94
  return { ok: true, status: 200 };
97
95
  });
@@ -99,8 +97,6 @@ describe("dispatchAgentTurn", () => {
99
97
  const driver = {
100
98
  session: () => ({
101
99
  run: vi.fn(async (query, params) => {
102
- if (query.includes("lastDispatchSessionId"))
103
- order.push("stamp");
104
100
  runs.push({ query, params });
105
101
  return { records: [] };
106
102
  }),
@@ -108,33 +104,11 @@ describe("dispatchAgentTurn", () => {
108
104
  }),
109
105
  };
110
106
  await dispatchAgentTurn("evt-1", "whatsapp", "+447504472444", "reply OK", "acct-house", null, "schedule-event", "/tmp/no-accounts", driver);
111
- const seatFromBody = calls[0].body.sessionId;
112
- expect(seatFromBody).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
113
- const stamp = runs.find((r) => r.query.includes("lastDispatchSessionId"));
114
- expect(stamp?.params.lastDispatchSessionId).toBe(seatFromBody);
115
- // The stamp is written BEFORE the POST (no self-cancel can race it).
116
- expect(order.indexOf("stamp")).toBeLessThan(order.indexOf("fetch"));
117
- });
118
- it("surfaces a stamp-write failure as op=stamp-failed and still dispatches (Task 1526)", async () => {
119
- globalThis.fetch = vi.fn(async () => ({ ok: true, status: 200 }));
120
- // Reject only the lastDispatchSessionId stamp; the result write still succeeds.
121
- const driver = {
122
- session: () => ({
123
- run: vi.fn(async (query) => {
124
- if (query.includes("lastDispatchSessionId"))
125
- throw new Error("neo4j-down");
126
- return { records: [] };
127
- }),
128
- close: vi.fn(async () => { }),
129
- }),
130
- };
131
- const errs = [];
132
- const errSpy = vi.spyOn(console, "error").mockImplementation((m) => {
133
- errs.push(String(m));
134
- });
135
- await expect(dispatchAgentTurn("evt-1", "whatsapp", "+447504472444", "reply OK", "acct-house", null, "schedule-event", "/tmp/no-accounts", driver)).resolves.toBeUndefined();
136
- errSpy.mockRestore();
137
- expect(errs.some((l) => /\[schedule-dispatch\] op=stamp-failed eventId=evt-1 .*detail=neo4j-down/.test(l))).toBe(true);
107
+ // Task 1526's per-firing seat is gone: no sessionId on the POST, and no
108
+ // lastDispatchSessionId stamp (the self-cancel guard reads the turn's own
109
+ // schedule provenance instead).
110
+ expect(calls[0].body.sessionId).toBeUndefined();
111
+ expect(runs.some((r) => r.query.includes("lastDispatchSessionId"))).toBe(false);
138
112
  });
139
113
  it("stamps operator-provenance on the inject POST outside the payload, logs op=dispatch markerOutsidePayload=true", async () => {
140
114
  const accountsDir = mkdtempSync(join(tmpdir(), "dispatch-accounts-"));
@@ -1 +1 @@
1
- {"version":3,"file":"agent-turn-dispatch.test.js","sourceRoot":"","sources":["../../../src/scripts/__tests__/agent-turn-dispatch.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAElF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,GAAG,kBAAkB,CAAC;YAC3B,YAAY,EAAE,UAAU;YACxB,gBAAgB,EAAE,eAAe;YACjC,WAAW,EAAE,UAAU;YACvB,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,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E,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,YAAY,CAaf;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAsFf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EAAE,EACzB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CA8Ef;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EAAE,EACzB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAiCf"}
@@ -1,7 +1,6 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { validateAgentDestination, boundSubAccountFor, resolveAccountAdminUserIds, buildScheduleProvenance, } from "../lib/agent-dispatch.js";
4
- import { scheduledSeatIdFor } from "../lib/scheduled-seat-id.js";
5
4
  import { resolveHouseOrSoleAccountId } from "../../../../../lib/account-enumeration/dist/index.js";
6
5
  /**
7
6
  * Decide how a due event dispatches from its selected node fields. An event
@@ -49,36 +48,17 @@ export async function dispatchAgentTurn(eventId, channel, destination, prompt, e
49
48
  createdByTool,
50
49
  dispatchedAt,
51
50
  });
52
- // Task 1526 — the per-firing seat id. Salted with eventId + dispatchedAt so
53
- // every firing is a session id the manager has never seen and spawns FRESH,
54
- // instead of resuming the deterministic per-sender seat that accreted every
55
- // firing into one compaction-lossy session.
56
- const seatSessionId = scheduledSeatIdFor(eventAccountId, destination, eventId, dispatchedAt);
57
51
  const channelTag = channel === "whatsapp" ? "wa" : channel === "telegram" ? "tg" : channel;
58
52
  console.error(`[sched-dispatch] op=dispatch event=${eventId.slice(0, 8)} account=${eventAccountId.slice(0, 8)} ` +
59
53
  `channel=${channelTag} authoredBy=${(authoredBy[0] ?? "-").slice(0, 8)} markerOutsidePayload=true`);
60
- // Task 1526stamp the firing's seat id on the node BEFORE the POST so the
61
- // 1516 self-cancel guard (which reads lastDispatchSessionId at cancel time)
62
- // sees it even if the spawned turn cancels within its first turn. Best-effort:
63
- // a write failure never blocks the dispatch (the sweep's never-throws contract).
64
- const stampSession = driver.session();
65
- try {
66
- await stampSession.run(`MATCH (e:Event {eventId: $eventId}) SET e.lastDispatchSessionId = $lastDispatchSessionId`, { eventId, lastDispatchSessionId: seatSessionId });
67
- }
68
- catch (err) {
69
- // Never block the dispatch (the sweep's never-throws contract), but a failed
70
- // stamp silently disarms the self-cancel guard (it reads lastDispatchSessionId
71
- // at cancel time), so surface it as its own line rather than swallowing it.
72
- console.error(`[schedule-dispatch] op=stamp-failed eventId=${eventId} sessionId=${seatSessionId} detail=${err instanceof Error ? err.message : String(err)}`);
73
- }
74
- finally {
75
- try {
76
- await stampSession.close();
77
- }
78
- catch {
79
- // ignore
80
- }
81
- }
54
+ // Task 1746 — the lastDispatchSessionId stamp is gone. It existed so the 1516
55
+ // self-cancel guard could compare the cancelling seat's SESSION_ID against the
56
+ // firing that dispatched it, which only discriminated because Task 1526 gave
57
+ // each firing a salted seat. That seat is removed (it spawned a second session
58
+ // for the sender and swallowed their real messages), so the comparison would
59
+ // now be always true. The guard reads the turn's own schedule provenance
60
+ // instead, which the channel server publishes and which names the eventId
61
+ // directly — so nothing needs stamping here, and nothing reads the property.
82
62
  let httpStatus = 0;
83
63
  let lastDispatchResult;
84
64
  try {
@@ -88,7 +68,7 @@ export async function dispatchAgentTurn(eventId, channel, destination, prompt, e
88
68
  const res = await fetch(`http://127.0.0.1:${port}/api/channel/schedule-inject`, {
89
69
  method: "POST",
90
70
  headers: { "Content-Type": "application/json" },
91
- body: JSON.stringify({ channel, accountId: eventAccountId, destination, prompt, eventId, sessionId: seatSessionId, scheduleProvenance: provenance }),
71
+ body: JSON.stringify({ channel, accountId: eventAccountId, destination, prompt, eventId, scheduleProvenance: provenance }),
92
72
  });
93
73
  httpStatus = res.status;
94
74
  lastDispatchResult = res.ok ? "accepted" : `error:${res.status}`;
@@ -123,7 +103,7 @@ export async function dispatchAgentTurn(eventId, channel, destination, prompt, e
123
103
  // ignore
124
104
  }
125
105
  }
126
- console.error(`[schedule-dispatch] op=inject-result eventId=${eventId} sessionId=${seatSessionId} httpStatus=${httpStatus} lastDispatchResult=${lastDispatchResult}`);
106
+ console.error(`[schedule-dispatch] op=inject-result eventId=${eventId} httpStatus=${httpStatus} lastDispatchResult=${lastDispatchResult}`);
127
107
  }
128
108
  /**
129
109
  * The no-event detector. Each heartbeat tick, over every agent-dispatch event
@@ -1 +1 @@
1
- {"version":3,"file":"agent-turn-dispatch.js","sourceRoot":"","sources":["../../src/scripts/agent-turn-dispatch.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC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H,CAAC"}
@@ -1,30 +1,33 @@
1
1
  import { describe, it, expect } from "vitest";
2
2
  import { classifySelfCancel } from "../schedule-cancel.js";
3
- // Task 1526with per-firing seats, byOwnDispatch is the caller session id vs
4
- // the event's stamped lastDispatchSessionId (the most recent firing's seat).
5
- // This is the autonomous self-cancel loop; an operator cancelling via the same
6
- // channel now runs the UNSALTED adminSessionIdFor seat and correctly reads false.
7
- describe("classifySelfCancel byOwnDispatch vs lastDispatchSessionId (Task 1526)", () => {
3
+ // Task 1746byOwnDispatch is DISARMED pending Task 1752. These tests pin the
4
+ // disarm deliberately, so that re-arming it is a conscious act with its own
5
+ // evidence rather than a side effect.
6
+ //
7
+ // Task 1526 keyed the discriminator on the caller's SESSION_ID vs a
8
+ // lastDispatchSessionId stamp, which worked only because a scheduled firing ran
9
+ // its own salted seat. Removing that seat (it split senders' conversations across
10
+ // two sessions) would make the comparison always true — asserting an autonomous
11
+ // loop on every operator cancel. Disarmed under-counts a real loop; it never
12
+ // invents one, which is the safe direction.
13
+ describe("classifySelfCancel — isAgentDispatch reporting, byOwnDispatch disarmed (Task 1746)", () => {
14
+ const DISPATCH = { agentChannel: "whatsapp", agentDestination: "447868387159" };
8
15
  it("not an agent-dispatch event when agentChannel is null", () => {
9
- const r = classifySelfCancel({ callerSessionId: "x", agentChannel: null, agentDestination: null, lastDispatchSessionId: null });
10
- expect(r.isAgentDispatch).toBe(false);
11
- expect(r.byOwnDispatch).toBe(false);
16
+ const r = classifySelfCancel({ eventId: "evt-9", agentChannel: null, agentDestination: null });
17
+ expect(r).toEqual({ isAgentDispatch: false, byOwnDispatch: false });
12
18
  });
13
- it("byOwnDispatch=true when the caller session equals the stamped firing seat", () => {
14
- const r = classifySelfCancel({ callerSessionId: "seat-firing-1", agentChannel: "whatsapp", agentDestination: "447504472444", lastDispatchSessionId: "seat-firing-1" });
15
- expect(r).toEqual({ isAgentDispatch: true, byOwnDispatch: true });
19
+ it("not an agent-dispatch event when agentDestination is null", () => {
20
+ const r = classifySelfCancel({ eventId: "evt-9", agentChannel: "whatsapp", agentDestination: null });
21
+ expect(r).toEqual({ isAgentDispatch: false, byOwnDispatch: false });
16
22
  });
17
- it("byOwnDispatch=false for a different (operator / unsalted) session", () => {
18
- const r = classifySelfCancel({ callerSessionId: "operator-webchat-id", agentChannel: "telegram", agentDestination: "12345678", lastDispatchSessionId: "seat-firing-1" });
19
- expect(r.byOwnDispatch).toBe(false);
23
+ it("reports an agent dispatch, and byOwnDispatch is false the alarm is disarmed", () => {
24
+ const r = classifySelfCancel({ eventId: "evt-9", ...DISPATCH });
25
+ expect(r).toEqual({ isAgentDispatch: true, byOwnDispatch: false });
20
26
  });
21
- it("byOwnDispatch=false when SESSION_ID is absent (fail-safe)", () => {
22
- const r = classifySelfCancel({ callerSessionId: undefined, agentChannel: "whatsapp", agentDestination: "447504472444", lastDispatchSessionId: "seat-firing-1" });
23
- expect(r.byOwnDispatch).toBe(false);
24
- });
25
- it("byOwnDispatch=false when the event has no stamp yet", () => {
26
- const r = classifySelfCancel({ callerSessionId: "seat-firing-1", agentChannel: "whatsapp", agentDestination: "447504472444", lastDispatchSessionId: null });
27
- expect(r.byOwnDispatch).toBe(false);
27
+ it("byOwnDispatch stays false regardless of which event is cancelled (no session inference survives)", () => {
28
+ for (const eventId of ["evt-9", "evt-1", ""]) {
29
+ expect(classifySelfCancel({ eventId, ...DISPATCH }).byOwnDispatch).toBe(false);
30
+ }
28
31
  });
29
32
  });
30
33
  //# sourceMappingURL=schedule-cancel.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schedule-cancel.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/schedule-cancel.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,kFAAk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