@rubytech/create-maxy-code 0.1.477 → 0.1.479

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 (204) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1704-data-portal-standing-audit.md +673 -0
  3. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1789-reseat-channel-row-fork.md +1244 -0
  4. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1818-loop-gate-app-routes.md +462 -0
  5. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1819-top-level-label-allowlist.md +321 -0
  6. package/payload/platform/docs/superpowers/plans/2026-07-20-task-1831-data-portal-class-derived-allowlist.md +2177 -0
  7. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1704-data-portal-standing-audit-design.md +177 -0
  8. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1789-reseat-channel-row-fork-design.md +201 -0
  9. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1818-loop-gate-app-routes-design.md +217 -0
  10. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1819-top-level-label-allowlist-design.md +80 -0
  11. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1820-cpu-triage-admin-tools-design.md +97 -0
  12. package/payload/platform/docs/superpowers/specs/2026-07-20-task-1831-data-portal-class-derived-allowlist-design.md +163 -0
  13. package/payload/platform/lib/graph-style/dist/index.d.ts.map +1 -1
  14. package/payload/platform/lib/graph-style/dist/index.js +22 -0
  15. package/payload/platform/lib/graph-style/dist/index.js.map +1 -1
  16. package/payload/platform/lib/graph-style/src/__tests__/parity.test.ts +6 -0
  17. package/payload/platform/lib/graph-style/src/index.ts +20 -0
  18. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.js +44 -0
  19. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.js.map +1 -1
  20. package/payload/platform/lib/storage-broker/dist/audit.d.ts +56 -0
  21. package/payload/platform/lib/storage-broker/dist/audit.d.ts.map +1 -1
  22. package/payload/platform/lib/storage-broker/dist/audit.js +34 -0
  23. package/payload/platform/lib/storage-broker/dist/audit.js.map +1 -1
  24. package/payload/platform/lib/storage-broker/src/__tests__/audit.test.ts +70 -1
  25. package/payload/platform/lib/storage-broker/src/audit.ts +111 -0
  26. package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
  27. package/payload/platform/plugins/admin/PLUGIN.md +7 -1
  28. package/payload/platform/plugins/admin/mcp/dist/index.js +72 -0
  29. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  30. package/payload/platform/plugins/admin/mcp/dist/tools/cpu-triage.d.ts +94 -0
  31. package/payload/platform/plugins/admin/mcp/dist/tools/cpu-triage.d.ts.map +1 -0
  32. package/payload/platform/plugins/admin/mcp/dist/tools/cpu-triage.js +229 -0
  33. package/payload/platform/plugins/admin/mcp/dist/tools/cpu-triage.js.map +1 -0
  34. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +14 -2
  35. package/payload/platform/plugins/cloudflare/PLUGIN.md +26 -1
  36. package/payload/platform/plugins/cloudflare/bin/d1-http.mjs +80 -0
  37. package/payload/platform/plugins/cloudflare/bin/portal-enrol.mjs +17 -2
  38. package/payload/platform/plugins/cloudflare/bin/portal-index-push.mjs +357 -0
  39. package/payload/platform/plugins/cloudflare/bin/schema-exposed-dirs.mjs +103 -0
  40. package/payload/platform/plugins/cloudflare/mcp/__tests__/authorize.test.ts +2 -2
  41. package/payload/platform/plugins/cloudflare/mcp/__tests__/d1-http.test.ts +96 -0
  42. package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-directory-listing.test.ts +120 -0
  43. package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-enrol.test.ts +59 -4
  44. package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-index-push.test.ts +176 -0
  45. package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-index-state-contract.test.ts +75 -0
  46. package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-indexed-download.test.ts +131 -0
  47. package/payload/platform/plugins/cloudflare/mcp/__tests__/portal-sign.test.ts +68 -0
  48. package/payload/platform/plugins/cloudflare/mcp/__tests__/schema-exposed-dirs.test.ts +88 -0
  49. package/payload/platform/plugins/cloudflare/mcp/__tests__/template-config.test.ts +39 -0
  50. package/payload/platform/plugins/cloudflare/skills/data-portal/SKILL.md +68 -1
  51. package/payload/platform/plugins/cloudflare/skills/data-portal/schema.sql +30 -1
  52. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/portal-sign.mjs +87 -0
  53. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/session.ts +8 -4
  54. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/_lib/types.ts +10 -0
  55. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/download.ts +107 -1
  56. package/payload/platform/plugins/cloudflare/skills/data-portal/template/functions/api/files.ts +82 -2
  57. package/payload/platform/plugins/cloudflare/skills/data-portal/template/index.html +9 -0
  58. package/payload/platform/plugins/cloudflare/skills/data-portal/template/portal.css +56 -0
  59. package/payload/platform/plugins/cloudflare/skills/data-portal/template/portal.js +98 -2
  60. package/payload/platform/plugins/cloudflare/skills/data-portal/template/wrangler.toml +12 -0
  61. package/payload/platform/plugins/docs/references/admin-ui.md +1 -1
  62. package/payload/platform/plugins/docs/references/cloudflare.md +12 -0
  63. package/payload/platform/plugins/email/PLUGIN.md +2 -1
  64. package/payload/platform/plugins/email/mcp/dist/__tests__/confirm-sent-copy.test.d.ts +2 -0
  65. package/payload/platform/plugins/email/mcp/dist/__tests__/confirm-sent-copy.test.d.ts.map +1 -0
  66. package/payload/platform/plugins/email/mcp/dist/__tests__/confirm-sent-copy.test.js +92 -0
  67. package/payload/platform/plugins/email/mcp/dist/__tests__/confirm-sent-copy.test.js.map +1 -0
  68. package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-send.test.js +112 -12
  69. package/payload/platform/plugins/email/mcp/dist/__tests__/email-draft-send.test.js.map +1 -1
  70. package/payload/platform/plugins/email/mcp/dist/__tests__/email-send-sent-copy.test.d.ts +2 -0
  71. package/payload/platform/plugins/email/mcp/dist/__tests__/email-send-sent-copy.test.d.ts.map +1 -0
  72. package/payload/platform/plugins/email/mcp/dist/__tests__/email-send-sent-copy.test.js +54 -0
  73. package/payload/platform/plugins/email/mcp/dist/__tests__/email-send-sent-copy.test.js.map +1 -0
  74. package/payload/platform/plugins/email/mcp/dist/__tests__/imap-drafts.test.js +170 -1
  75. package/payload/platform/plugins/email/mcp/dist/__tests__/imap-drafts.test.js.map +1 -1
  76. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-note.test.d.ts +2 -0
  77. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-note.test.d.ts.map +1 -0
  78. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-note.test.js +86 -0
  79. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-note.test.js.map +1 -0
  80. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-sweep.test.d.ts +2 -0
  81. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-sweep.test.d.ts.map +1 -0
  82. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-sweep.test.js +164 -0
  83. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-copy-sweep.test.js.map +1 -0
  84. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-ledger.test.d.ts +2 -0
  85. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-ledger.test.d.ts.map +1 -0
  86. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-ledger.test.js +82 -0
  87. package/payload/platform/plugins/email/mcp/dist/__tests__/sent-ledger.test.js.map +1 -0
  88. package/payload/platform/plugins/email/mcp/dist/lib/imap.d.ts +95 -0
  89. package/payload/platform/plugins/email/mcp/dist/lib/imap.d.ts.map +1 -1
  90. package/payload/platform/plugins/email/mcp/dist/lib/imap.js +223 -0
  91. package/payload/platform/plugins/email/mcp/dist/lib/imap.js.map +1 -1
  92. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-note.d.ts +18 -0
  93. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-note.d.ts.map +1 -0
  94. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-note.js +59 -0
  95. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-note.js.map +1 -0
  96. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-sweep.d.ts +48 -0
  97. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-sweep.d.ts.map +1 -0
  98. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-sweep.js +79 -0
  99. package/payload/platform/plugins/email/mcp/dist/lib/sent-copy-sweep.js.map +1 -0
  100. package/payload/platform/plugins/email/mcp/dist/lib/sent-ledger.d.ts +44 -0
  101. package/payload/platform/plugins/email/mcp/dist/lib/sent-ledger.d.ts.map +1 -0
  102. package/payload/platform/plugins/email/mcp/dist/lib/sent-ledger.js +63 -0
  103. package/payload/platform/plugins/email/mcp/dist/lib/sent-ledger.js.map +1 -0
  104. package/payload/platform/plugins/email/mcp/dist/scripts/sent-copy-sweep.d.ts +2 -0
  105. package/payload/platform/plugins/email/mcp/dist/scripts/sent-copy-sweep.d.ts.map +1 -0
  106. package/payload/platform/plugins/email/mcp/dist/scripts/sent-copy-sweep.js +55 -0
  107. package/payload/platform/plugins/email/mcp/dist/scripts/sent-copy-sweep.js.map +1 -0
  108. package/payload/platform/plugins/email/mcp/dist/tools/email-draft-send.d.ts.map +1 -1
  109. package/payload/platform/plugins/email/mcp/dist/tools/email-draft-send.js +64 -13
  110. package/payload/platform/plugins/email/mcp/dist/tools/email-draft-send.js.map +1 -1
  111. package/payload/platform/plugins/email/mcp/dist/tools/email-reply.d.ts.map +1 -1
  112. package/payload/platform/plugins/email/mcp/dist/tools/email-reply.js +11 -1
  113. package/payload/platform/plugins/email/mcp/dist/tools/email-reply.js.map +1 -1
  114. package/payload/platform/plugins/email/mcp/dist/tools/email-send.d.ts.map +1 -1
  115. package/payload/platform/plugins/email/mcp/dist/tools/email-send.js +16 -3
  116. package/payload/platform/plugins/email/mcp/dist/tools/email-send.js.map +1 -1
  117. package/payload/platform/plugins/email/references/email-reference.md +36 -0
  118. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/portal-index-audit.test.d.ts +2 -0
  119. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/portal-index-audit.test.d.ts.map +1 -0
  120. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/portal-index-audit.test.js +66 -0
  121. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/portal-index-audit.test.js.map +1 -0
  122. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/sent-sweep-throttle.test.d.ts +2 -0
  123. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/sent-sweep-throttle.test.d.ts.map +1 -0
  124. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/sent-sweep-throttle.test.js +18 -0
  125. package/payload/platform/plugins/scheduling/mcp/dist/__tests__/sent-sweep-throttle.test.js.map +1 -0
  126. package/payload/platform/plugins/scheduling/mcp/dist/lib/portal-index-audit.d.ts +41 -0
  127. package/payload/platform/plugins/scheduling/mcp/dist/lib/portal-index-audit.d.ts.map +1 -0
  128. package/payload/platform/plugins/scheduling/mcp/dist/lib/portal-index-audit.js +75 -0
  129. package/payload/platform/plugins/scheduling/mcp/dist/lib/portal-index-audit.js.map +1 -0
  130. package/payload/platform/plugins/scheduling/mcp/dist/lib/sent-sweep-throttle.d.ts +13 -0
  131. package/payload/platform/plugins/scheduling/mcp/dist/lib/sent-sweep-throttle.d.ts.map +1 -0
  132. package/payload/platform/plugins/scheduling/mcp/dist/lib/sent-sweep-throttle.js +10 -0
  133. package/payload/platform/plugins/scheduling/mcp/dist/lib/sent-sweep-throttle.js.map +1 -0
  134. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js +175 -0
  135. package/payload/platform/plugins/scheduling/mcp/dist/scripts/check-due-events.js.map +1 -1
  136. package/payload/platform/scripts/cpu-triage-run.sh +117 -0
  137. package/payload/platform/scripts/cpu-triage.sh +23 -4
  138. package/payload/platform/services/claude-session-manager/dist/activity-range.d.ts +40 -0
  139. package/payload/platform/services/claude-session-manager/dist/activity-range.d.ts.map +1 -0
  140. package/payload/platform/services/claude-session-manager/dist/activity-range.js +68 -0
  141. package/payload/platform/services/claude-session-manager/dist/activity-range.js.map +1 -0
  142. package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts +40 -8
  143. package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts.map +1 -1
  144. package/payload/platform/services/claude-session-manager/dist/activity-rows.js +74 -7
  145. package/payload/platform/services/claude-session-manager/dist/activity-rows.js.map +1 -1
  146. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
  147. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +2 -0
  148. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
  149. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  150. package/payload/platform/services/claude-session-manager/dist/http-server.js +9 -0
  151. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  152. package/payload/server/{chunk-56WJMBQQ.js → chunk-3XLLTG6R.js} +14 -0
  153. package/payload/server/{chunk-JECAP3Z2.js → chunk-XGNRSM57.js} +3 -0
  154. package/payload/server/maxy-edge.js +1 -1
  155. package/payload/server/public/activity.html +8 -6
  156. package/payload/server/public/assets/{AdminLoginScreens-mEKP4pDi.js → AdminLoginScreens-DkxQZnvB.js} +1 -1
  157. package/payload/server/public/assets/AdminShell-Cv_nIFGe.js +2 -0
  158. package/payload/server/public/assets/Checkbox-CsTWK8mm.js +1 -0
  159. package/payload/server/public/assets/activity-BbnTiVBT.js +1 -0
  160. package/payload/server/public/assets/{admin-BVhgfgs1.js → admin-BZY3i_Ff.js} +1 -1
  161. package/payload/server/public/assets/{browser-D-HMmHcM.js → browser-BbIiSFKr.js} +1 -1
  162. package/payload/server/public/assets/{calendar-tGWvFyFn.js → calendar-BvxeTHvQ.js} +1 -1
  163. package/payload/server/public/assets/chat-DUKxufRk.js +1 -0
  164. package/payload/server/public/assets/chevron-left-BtfJD6LL.js +1 -0
  165. package/payload/server/public/assets/data-hl1wa-Ax.js +1 -0
  166. package/payload/server/public/assets/{graph-zEw610xK.js → graph-CDSGRoeb.js} +1 -1
  167. package/payload/server/public/assets/graph-labels-C5qLwnWA.js +1 -0
  168. package/payload/server/public/assets/{maximize-2-BlTjXT_Y.js → maximize-2-CAzH8dED.js} +1 -1
  169. package/payload/server/public/assets/{operator-C7oIw2PG.js → operator-BK7r8DAB.js} +1 -1
  170. package/payload/server/public/assets/{page-CTP7OFZa.js → page-B5YngOrK.js} +1 -1
  171. package/payload/server/public/assets/{page-DL6Zsdvk.js → page-BsCS0Dmc.js} +1 -1
  172. package/payload/server/public/assets/{public-r1A9dqR_.js → public-C1Pz-IBs.js} +1 -1
  173. package/payload/server/public/assets/{rotate-ccw-CzkkKx4-.js → rotate-ccw-UDln4Tou.js} +1 -1
  174. package/payload/server/public/assets/tasks-B-cLsn3p.js +1 -0
  175. package/payload/server/public/assets/{time-entry-format-j669DgXj.js → time-entry-format-DPOBIE18.js} +1 -1
  176. package/payload/server/public/assets/{triangle-alert-BPgCgIef.js → triangle-alert-Dz-CZKo5.js} +1 -1
  177. package/payload/server/public/assets/{useCopyFeedback-BmLa2aes.js → useCopyFeedback-wtUHGohk.js} +1 -1
  178. package/payload/server/public/assets/{useSelectionMode-DnnM7A8-.js → useSelectionMode-sph7AQT5.js} +1 -1
  179. package/payload/server/public/assets/useSubAccountSwitcher-BRIluIKf.css +1 -0
  180. package/payload/server/public/assets/{useVoiceRecorder-u2dwZfen.js → useVoiceRecorder-DN4jYQ0A.js} +1 -1
  181. package/payload/server/public/brand-defaults.css +1 -0
  182. package/payload/server/public/browser.html +5 -5
  183. package/payload/server/public/calendar.html +6 -6
  184. package/payload/server/public/chat.html +12 -12
  185. package/payload/server/public/data.html +11 -11
  186. package/payload/server/public/graph.html +11 -11
  187. package/payload/server/public/index.html +14 -14
  188. package/payload/server/public/operator.html +14 -14
  189. package/payload/server/public/privacy.html +1 -0
  190. package/payload/server/public/public.html +12 -12
  191. package/payload/server/public/tasks.html +6 -5
  192. package/payload/server/public/vnc-popout.html +1 -0
  193. package/payload/server/server.js +894 -384
  194. package/payload/server/{src-JYPKMWJR.js → src-XQ63FPRE.js} +3 -1
  195. package/payload/server/public/assets/AdminShell-BwSaZ88d.js +0 -2
  196. package/payload/server/public/assets/Checkbox-CN4uQ80w.js +0 -1
  197. package/payload/server/public/assets/activity-CIQ8ozNZ.js +0 -1
  198. package/payload/server/public/assets/chat-DkttVxAz.js +0 -1
  199. package/payload/server/public/assets/chevron-left-CZ4ez9G5.js +0 -1
  200. package/payload/server/public/assets/data-P-mcmnNi.js +0 -1
  201. package/payload/server/public/assets/graph-labels-qnBleOE6.js +0 -1
  202. package/payload/server/public/assets/tasks-fIJwYFWG.js +0 -1
  203. package/payload/server/public/assets/useSubAccountSwitcher-C_E8h07P.css +0 -1
  204. /package/payload/server/public/assets/{useSubAccountSwitcher-CFa6ZAT1.js → useSubAccountSwitcher-v8LyBzZN.js} +0 -0
@@ -0,0 +1,82 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
+ import { mkdtempSync, rmSync, mkdirSync, writeFileSync, readFileSync, existsSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ let root;
6
+ beforeEach(() => {
7
+ root = mkdtempSync(join(tmpdir(), "sent-ledger-"));
8
+ mkdirSync(join(root, "config"), { recursive: true });
9
+ process.env.PLATFORM_ROOT = root;
10
+ });
11
+ afterEach(() => {
12
+ rmSync(root, { recursive: true, force: true });
13
+ delete process.env.PLATFORM_ROOT;
14
+ });
15
+ const entry = (over = {}) => ({
16
+ at: new Date().toISOString(),
17
+ accountId: "acct1",
18
+ mailbox: "a@example.com",
19
+ messageId: "m1@example.com",
20
+ copy: "found",
21
+ sentFolder: "[Gmail]/Sent Mail",
22
+ sentUid: 5,
23
+ ...over,
24
+ });
25
+ describe("sent ledger", () => {
26
+ it("appends one JSON line per entry", async () => {
27
+ const { appendSentLedger, ledgerPath } = await import("../lib/sent-ledger.js");
28
+ appendSentLedger(entry());
29
+ appendSentLedger(entry({ messageId: "m2@example.com" }));
30
+ const lines = readFileSync(ledgerPath(), "utf8").trim().split("\n");
31
+ expect(lines).toHaveLength(2);
32
+ expect(JSON.parse(lines[1]).messageId).toBe("m2@example.com");
33
+ });
34
+ it("reads back only entries inside the window", async () => {
35
+ const { appendSentLedger, readSentLedger } = await import("../lib/sent-ledger.js");
36
+ const now = Date.now();
37
+ appendSentLedger(entry({ at: new Date(now - 60 * 60 * 1000).toISOString() }));
38
+ appendSentLedger(entry({ at: new Date(now - 30 * 60 * 60 * 1000).toISOString(), messageId: "old@x" }));
39
+ const recent = readSentLedger(now - 24 * 60 * 60 * 1000);
40
+ expect(recent).toHaveLength(1);
41
+ expect(recent[0].messageId).toBe("m1@example.com");
42
+ });
43
+ it("appends without rewriting, so a concurrent send cannot be lost", async () => {
44
+ const { appendSentLedger, ledgerPath } = await import("../lib/sent-ledger.js");
45
+ const stale = JSON.stringify(entry({ at: new Date(Date.now() - 72 * 60 * 60 * 1000).toISOString(), messageId: "old@x" }));
46
+ writeFileSync(ledgerPath(), stale + "\n");
47
+ appendSentLedger(entry());
48
+ // The stale row survives the append: trimming is the sweep's job, because
49
+ // a rewrite on the send path is what loses concurrent rows.
50
+ const lines = readFileSync(ledgerPath(), "utf8").trim().split("\n");
51
+ expect(lines).toHaveLength(2);
52
+ });
53
+ it("prunes entries older than 48h when the sweep asks", async () => {
54
+ const { appendSentLedger, pruneSentLedger, ledgerPath } = await import("../lib/sent-ledger.js");
55
+ const stale = JSON.stringify(entry({ at: new Date(Date.now() - 72 * 60 * 60 * 1000).toISOString(), messageId: "old@x" }));
56
+ writeFileSync(ledgerPath(), stale + "\n");
57
+ appendSentLedger(entry());
58
+ pruneSentLedger();
59
+ const lines = readFileSync(ledgerPath(), "utf8").trim().split("\n");
60
+ expect(lines).toHaveLength(1);
61
+ expect(JSON.parse(lines[0]).messageId).toBe("m1@example.com");
62
+ });
63
+ it("leaves the file untouched when nothing is past retention", async () => {
64
+ const { appendSentLedger, pruneSentLedger, ledgerPath } = await import("../lib/sent-ledger.js");
65
+ appendSentLedger(entry());
66
+ const before = readFileSync(ledgerPath(), "utf8");
67
+ pruneSentLedger();
68
+ expect(readFileSync(ledgerPath(), "utf8")).toBe(before);
69
+ });
70
+ it("skips a corrupt line rather than throwing", async () => {
71
+ const { readSentLedger, ledgerPath } = await import("../lib/sent-ledger.js");
72
+ writeFileSync(ledgerPath(), "not json\n" + JSON.stringify(entry()) + "\n");
73
+ const rows = readSentLedger(Date.now() - 24 * 60 * 60 * 1000);
74
+ expect(rows).toHaveLength(1);
75
+ });
76
+ it("returns an empty list when the ledger does not exist", async () => {
77
+ const { readSentLedger, ledgerPath } = await import("../lib/sent-ledger.js");
78
+ expect(existsSync(ledgerPath())).toBe(false);
79
+ expect(readSentLedger(0)).toEqual([]);
80
+ });
81
+ });
82
+ //# sourceMappingURL=sent-ledger.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sent-ledger.test.js","sourceRoot":"","sources":["../../src/__tests__/sent-ledger.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,IAAI,IAAY,C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AAC,CAAC;QAC7E,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -472,5 +472,100 @@ export declare function deleteDraft(config: EmailConfig, password: string, uid:
472
472
  folder: string;
473
473
  deleted: boolean;
474
474
  }>;
475
+ export type FileToSentResult = {
476
+ filed: true;
477
+ sentFolder: string;
478
+ sentUid: number;
479
+ draftFolder: string;
480
+ } | {
481
+ filed: false;
482
+ reason: "no-sent-folder" | "draft-absent" | "move-did-nothing" | "moved-but-not-in-sent";
483
+ draftFolder: string;
484
+ };
485
+ /**
486
+ * Relocate a sent draft from \Drafts into the mailbox's \Sent folder.
487
+ *
488
+ * Called only after SMTP has accepted the message, so the mail is already out:
489
+ * every failure path leaves the draft where it is rather than destroying it.
490
+ * This replaces the historical post-send expunge, which on Gmail destroyed the
491
+ * only copy — the provider deduplicates its own Sent-copy against the draft
492
+ * already held under that Message-ID, so expunging left no record of the send
493
+ * anywhere in the account, not even in All Mail (Task 1821).
494
+ *
495
+ * Flags are set while the message is still in \Drafts, where the source UID is
496
+ * addressable: after a MOVE the source UID is gone and the destination UID is
497
+ * known only when the server supports UIDPLUS.
498
+ *
499
+ * `sentUid` is non-null only when the move reported a destination UID AND that
500
+ * UID was read back from \Sent. A null means the copy was moved but could not
501
+ * be located — callers must not report a UID they never confirmed.
502
+ *
503
+ * The retry wrapper makes this non-idempotent operation re-runnable: a drop
504
+ * after a successful MOVE leaves attempt two looking at a \Drafts folder the
505
+ * message has already left. `messageId` is what disambiguates that — when the
506
+ * draft UID is gone, \Sent is searched for it, so an already-filed copy is
507
+ * reported as filed rather than as a loss.
508
+ *
509
+ * `draft-absent` therefore means the UID is not in \Drafts AND the \Sent search
510
+ * came back empty — or that no `messageId` was supplied to search with, which
511
+ * is the one case where the two states cannot be told apart.
512
+ */
513
+ export declare function fileDraftToSent(config: EmailConfig, password: string, uid: number, messageId: string | null): Promise<FileToSentResult>;
514
+ /** UID of a message in `folder` matching `messageId`, or null. Angle brackets are
515
+ * restored because Gmail matches the raw header value, not the bare id. */
516
+ export declare function findUidByMessageId(client: ImapFlow, folder: string, messageId: string): Promise<number | null>;
517
+ export type SentCopyResult = {
518
+ found: true;
519
+ sentFolder: string;
520
+ sentUid: number;
521
+ } | {
522
+ found: false;
523
+ reason: "no-sent-folder";
524
+ } | {
525
+ found: false;
526
+ reason: "not-in-sent";
527
+ sentFolder: string;
528
+ } | {
529
+ found: false;
530
+ reason: "check-failed";
531
+ error: string;
532
+ };
533
+ /**
534
+ * Whether a copy of `messageId` is actually present in the mailbox's \Sent
535
+ * folder.
536
+ *
537
+ * Called after SMTP has accepted the message. The send already happened, so
538
+ * this never throws — an unreachable server yields `check-failed`, which the
539
+ * caller reports as "could not confirm", distinct from "confirmed absent".
540
+ * Collapsing those two into one word is the failure this exists to remove: with
541
+ * nothing in the tool result either affirming or denying the copy, the model
542
+ * supplied the affirmation from expectation for four days (Task 1822).
543
+ *
544
+ * Providers do not file the copy synchronously with SMTP acceptance, so a
545
+ * single immediate search would report a false absence on a healthy mailbox.
546
+ * The search is retried on a fixed short delay before absence is concluded.
547
+ */
548
+ export declare function confirmSentCopy(config: EmailConfig, password: string, messageId: string, opts?: {
549
+ attempts?: number;
550
+ delayMs?: number;
551
+ }): Promise<SentCopyResult>;
552
+ /**
553
+ * Which of `messageIds` are absent from the mailbox's \Sent folder.
554
+ *
555
+ * The right-hand side of the standing reconciliation (Task 1822). Presence is
556
+ * asked per Message-ID rather than by counting the folder: \Sent holds
557
+ * everything the owner sends from any client, so a bulk count is dominated by
558
+ * messages this plugin never sent and a mailbox filing none of ours would
559
+ * still look healthy.
560
+ *
561
+ * One connection serves the whole batch. Throws when the server advertises no
562
+ * \Sent folder or the connection fails — the sweep reports that per mailbox as
563
+ * check-failed rather than as a shortfall, so a mailbox that could not be read
564
+ * is never mistaken for one that lost copies.
565
+ */
566
+ export declare function findMissingInSent(config: EmailConfig, password: string, messageIds: string[]): Promise<{
567
+ folder: string;
568
+ missing: string[];
569
+ }>;
475
570
  export {};
476
571
  //# sourceMappingURL=imap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imap.d.ts","sourceRoot":"","sources":["../../src/lib/imap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,UAAU,CAAC;AAE7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAuFpD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,qGAAqG;IACrG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uFAAuF;IACvF,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,sBAAsB,CAAC;CACrC;AAGD,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,OAAO,GAAG,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CASjB;AAYD,2DAA2D;AAC3D,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C;AAYD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CACvC,MAAM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C;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAC1C;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAAC,cAAc,CAAC,CAiDzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoBhD"}
@@ -1458,4 +1458,227 @@ async function deleteDraftOnce(config, password, uid) {
1458
1458
  await safeLogout(client);
1459
1459
  }
1460
1460
  }
1461
+ /**
1462
+ * Relocate a sent draft from \Drafts into the mailbox's \Sent folder.
1463
+ *
1464
+ * Called only after SMTP has accepted the message, so the mail is already out:
1465
+ * every failure path leaves the draft where it is rather than destroying it.
1466
+ * This replaces the historical post-send expunge, which on Gmail destroyed the
1467
+ * only copy — the provider deduplicates its own Sent-copy against the draft
1468
+ * already held under that Message-ID, so expunging left no record of the send
1469
+ * anywhere in the account, not even in All Mail (Task 1821).
1470
+ *
1471
+ * Flags are set while the message is still in \Drafts, where the source UID is
1472
+ * addressable: after a MOVE the source UID is gone and the destination UID is
1473
+ * known only when the server supports UIDPLUS.
1474
+ *
1475
+ * `sentUid` is non-null only when the move reported a destination UID AND that
1476
+ * UID was read back from \Sent. A null means the copy was moved but could not
1477
+ * be located — callers must not report a UID they never confirmed.
1478
+ *
1479
+ * The retry wrapper makes this non-idempotent operation re-runnable: a drop
1480
+ * after a successful MOVE leaves attempt two looking at a \Drafts folder the
1481
+ * message has already left. `messageId` is what disambiguates that — when the
1482
+ * draft UID is gone, \Sent is searched for it, so an already-filed copy is
1483
+ * reported as filed rather than as a loss.
1484
+ *
1485
+ * `draft-absent` therefore means the UID is not in \Drafts AND the \Sent search
1486
+ * came back empty — or that no `messageId` was supplied to search with, which
1487
+ * is the one case where the two states cannot be told apart.
1488
+ */
1489
+ export async function fileDraftToSent(config, password, uid, messageId) {
1490
+ return withTransientRetry("draftFileToSent", () => fileDraftToSentOnce(config, password, uid, messageId));
1491
+ }
1492
+ /** UID of a message in `folder` matching `messageId`, or null. Angle brackets are
1493
+ * restored because Gmail matches the raw header value, not the bare id. */
1494
+ export async function findUidByMessageId(client, folder, messageId) {
1495
+ const needle = `<${messageId.replace(/^<|>$/g, "")}>`;
1496
+ const lock = await client.getMailboxLock(folder);
1497
+ try {
1498
+ const uids = await client.search({ header: { "message-id": needle } }, { uid: true });
1499
+ return uids && uids.length > 0 ? uids[0] : null;
1500
+ }
1501
+ finally {
1502
+ lock.release();
1503
+ }
1504
+ }
1505
+ async function fileDraftToSentOnce(config, password, uid, messageId) {
1506
+ const client = createClient(config, password);
1507
+ const t0 = Date.now();
1508
+ diag("draftFileToSent", "start", `uid=${uid}`);
1509
+ try {
1510
+ await client.connect();
1511
+ const draftFolder = await resolveDraftsFolder(client, config.email, config.draftsFolder);
1512
+ let sentFolder;
1513
+ try {
1514
+ sentFolder = await resolveFolderName(client, "sent");
1515
+ }
1516
+ catch {
1517
+ // No \Sent to file into. The draft stays put — never expunge without a
1518
+ // confirmed destination.
1519
+ diag("draftFileToSent", "no-sent-folder", `uid=${uid} draftFolder=${draftFolder} in ${Date.now() - t0}ms`);
1520
+ return { filed: false, reason: "no-sent-folder", draftFolder };
1521
+ }
1522
+ let moved;
1523
+ let released = false;
1524
+ const lock = await client.getMailboxLock(draftFolder);
1525
+ try {
1526
+ const existing = await client.fetchOne(String(uid), { uid: true }, { uid: true });
1527
+ if (!existing) {
1528
+ // The UID is gone from \Drafts. That is NOT evidence nothing was filed:
1529
+ // a retried attempt reaches here after its predecessor moved the message.
1530
+ // Ask \Sent before concluding anything.
1531
+ lock.release();
1532
+ released = true;
1533
+ const alreadyFiled = messageId
1534
+ ? await findUidByMessageId(client, sentFolder, messageId)
1535
+ : null;
1536
+ if (alreadyFiled !== null) {
1537
+ diag("draftFileToSent", "already-filed", `uid=${uid} found in ${sentFolder} as uid=${alreadyFiled} in ${Date.now() - t0}ms`);
1538
+ return { filed: true, sentFolder, sentUid: alreadyFiled, draftFolder };
1539
+ }
1540
+ diag("draftFileToSent", "draft-absent", `uid=${uid} folder=${draftFolder} sentSearch=${messageId ? "empty" : "skipped-no-message-id"} in ${Date.now() - t0}ms`);
1541
+ return { filed: false, reason: "draft-absent", draftFolder };
1542
+ }
1543
+ await client.messageFlagsRemove(String(uid), ["\\Draft"], { uid: true });
1544
+ await client.messageFlagsAdd(String(uid), ["\\Seen"], { uid: true });
1545
+ moved = await client.messageMove(String(uid), sentFolder, { uid: true });
1546
+ }
1547
+ finally {
1548
+ if (!released)
1549
+ lock.release();
1550
+ }
1551
+ // imapflow returns false without issuing a MOVE when the range does not
1552
+ // resolve. Nothing was filed — saying otherwise would be the false claim
1553
+ // this whole change exists to remove.
1554
+ if (moved === false) {
1555
+ diag("draftFileToSent", "move-did-nothing", `uid=${uid} folder=${draftFolder} in ${Date.now() - t0}ms`);
1556
+ return { filed: false, reason: "move-did-nothing", draftFolder };
1557
+ }
1558
+ // A uidMap entry is the server's claim about where the message went; it is
1559
+ // not evidence the message is there. Confirm by reading the UID back, and
1560
+ // when the server reported no uidMap at all, fall back to searching \Sent
1561
+ // for the Message-ID. Without that fallback this path returned "filed, UID
1562
+ // not reported by the server" — a filed claim with no read-back behind it,
1563
+ // which is the exact shape of unverified assertion Task 1822 removes.
1564
+ const reportedUid = moved.uidMap instanceof Map ? (moved.uidMap.get(uid) ?? null) : null;
1565
+ let sentUid = null;
1566
+ if (reportedUid !== null) {
1567
+ const sentLock = await client.getMailboxLock(sentFolder);
1568
+ try {
1569
+ const landed = await client.fetchOne(String(reportedUid), { uid: true }, { uid: true });
1570
+ if (landed)
1571
+ sentUid = reportedUid;
1572
+ }
1573
+ finally {
1574
+ sentLock.release();
1575
+ }
1576
+ }
1577
+ if (sentUid === null && messageId) {
1578
+ sentUid = await findUidByMessageId(client, sentFolder, messageId);
1579
+ }
1580
+ if (sentUid === null) {
1581
+ diag("draftFileToSent", "moved-but-not-in-sent", `uid=${uid} ${draftFolder} -> ${sentFolder} in ${Date.now() - t0}ms`);
1582
+ return { filed: false, reason: "moved-but-not-in-sent", draftFolder };
1583
+ }
1584
+ diag("draftFileToSent", "filed", `uid=${uid} ${draftFolder} -> ${sentFolder} sentUid=${sentUid} in ${Date.now() - t0}ms`);
1585
+ return { filed: true, sentFolder, sentUid, draftFolder };
1586
+ }
1587
+ catch (err) {
1588
+ diag("draftFileToSent", "FAILED", imapFailureDetail(config, err, Date.now() - t0));
1589
+ throw err;
1590
+ }
1591
+ finally {
1592
+ await safeLogout(client);
1593
+ }
1594
+ }
1595
+ /**
1596
+ * Whether a copy of `messageId` is actually present in the mailbox's \Sent
1597
+ * folder.
1598
+ *
1599
+ * Called after SMTP has accepted the message. The send already happened, so
1600
+ * this never throws — an unreachable server yields `check-failed`, which the
1601
+ * caller reports as "could not confirm", distinct from "confirmed absent".
1602
+ * Collapsing those two into one word is the failure this exists to remove: with
1603
+ * nothing in the tool result either affirming or denying the copy, the model
1604
+ * supplied the affirmation from expectation for four days (Task 1822).
1605
+ *
1606
+ * Providers do not file the copy synchronously with SMTP acceptance, so a
1607
+ * single immediate search would report a false absence on a healthy mailbox.
1608
+ * The search is retried on a fixed short delay before absence is concluded.
1609
+ */
1610
+ export async function confirmSentCopy(config, password, messageId, opts) {
1611
+ // At least one search always runs: `not-in-sent` asserts the folder was
1612
+ // searched and the message was absent, so it must never be reachable
1613
+ // without a search having happened.
1614
+ const attempts = Math.max(1, opts?.attempts ?? 3);
1615
+ const delayMs = opts?.delayMs ?? 1000;
1616
+ const client = createClient(config, password);
1617
+ const t0 = Date.now();
1618
+ diag("confirmSentCopy", "start", `messageId=${messageId}`);
1619
+ try {
1620
+ await client.connect();
1621
+ let sentFolder;
1622
+ try {
1623
+ sentFolder = await resolveFolderName(client, "sent");
1624
+ }
1625
+ catch {
1626
+ diag("confirmSentCopy", "no-sent-folder", `in ${Date.now() - t0}ms`);
1627
+ return { found: false, reason: "no-sent-folder" };
1628
+ }
1629
+ for (let attempt = 1; attempt <= attempts; attempt++) {
1630
+ const uid = await findUidByMessageId(client, sentFolder, messageId);
1631
+ if (uid !== null) {
1632
+ diag("confirmSentCopy", "found", `${sentFolder} uid=${uid} attempt=${attempt} in ${Date.now() - t0}ms`);
1633
+ return { found: true, sentFolder, sentUid: uid };
1634
+ }
1635
+ if (attempt < attempts && delayMs > 0) {
1636
+ await new Promise((r) => setTimeout(r, delayMs));
1637
+ }
1638
+ }
1639
+ diag("confirmSentCopy", "not-in-sent", `${sentFolder} attempts=${attempts} in ${Date.now() - t0}ms`);
1640
+ return { found: false, reason: "not-in-sent", sentFolder };
1641
+ }
1642
+ catch (err) {
1643
+ const error = err instanceof Error ? err.message : String(err);
1644
+ diag("confirmSentCopy", "check-failed", `${error} in ${Date.now() - t0}ms`);
1645
+ return { found: false, reason: "check-failed", error };
1646
+ }
1647
+ finally {
1648
+ await safeLogout(client);
1649
+ }
1650
+ }
1651
+ /**
1652
+ * Which of `messageIds` are absent from the mailbox's \Sent folder.
1653
+ *
1654
+ * The right-hand side of the standing reconciliation (Task 1822). Presence is
1655
+ * asked per Message-ID rather than by counting the folder: \Sent holds
1656
+ * everything the owner sends from any client, so a bulk count is dominated by
1657
+ * messages this plugin never sent and a mailbox filing none of ours would
1658
+ * still look healthy.
1659
+ *
1660
+ * One connection serves the whole batch. Throws when the server advertises no
1661
+ * \Sent folder or the connection fails — the sweep reports that per mailbox as
1662
+ * check-failed rather than as a shortfall, so a mailbox that could not be read
1663
+ * is never mistaken for one that lost copies.
1664
+ */
1665
+ export async function findMissingInSent(config, password, messageIds) {
1666
+ const client = createClient(config, password);
1667
+ const t0 = Date.now();
1668
+ try {
1669
+ await client.connect();
1670
+ const folder = await resolveFolderName(client, "sent");
1671
+ const missing = [];
1672
+ for (const messageId of messageIds) {
1673
+ const uid = await findUidByMessageId(client, folder, messageId);
1674
+ if (uid === null)
1675
+ missing.push(messageId);
1676
+ }
1677
+ diag("findMissingInSent", "done", `${folder} asked=${messageIds.length} missing=${missing.length} in ${Date.now() - t0}ms`);
1678
+ return { folder, missing };
1679
+ }
1680
+ finally {
1681
+ await safeLogout(client);
1682
+ }
1683
+ }
1461
1684
  //# sourceMappingURL=imap.js.map