@rubytech/create-maxy-code 0.1.443 → 0.1.445

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 (219) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/graph-style/dist/index.d.ts +4 -0
  3. package/payload/platform/lib/graph-style/dist/index.d.ts.map +1 -1
  4. package/payload/platform/lib/graph-style/dist/index.js +37 -1
  5. package/payload/platform/lib/graph-style/dist/index.js.map +1 -1
  6. package/payload/platform/lib/graph-style/src/__tests__/parity.test.ts +39 -0
  7. package/payload/platform/lib/graph-style/src/index.ts +41 -0
  8. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.d.ts +2 -0
  9. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.d.ts.map +1 -0
  10. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.js +46 -0
  11. package/payload/platform/lib/storage-broker/dist/__tests__/audit.test.js.map +1 -0
  12. package/payload/platform/lib/storage-broker/dist/__tests__/authorize.test.d.ts +2 -0
  13. package/payload/platform/lib/storage-broker/dist/__tests__/authorize.test.d.ts.map +1 -0
  14. package/payload/platform/lib/storage-broker/dist/__tests__/authorize.test.js +27 -0
  15. package/payload/platform/lib/storage-broker/dist/__tests__/authorize.test.js.map +1 -0
  16. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.d.ts +2 -0
  17. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.d.ts.map +1 -0
  18. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js +51 -0
  19. package/payload/platform/lib/storage-broker/dist/__tests__/cf-exec.test.js.map +1 -0
  20. package/payload/platform/lib/storage-broker/dist/__tests__/house-credential.test.d.ts +2 -0
  21. package/payload/platform/lib/storage-broker/dist/__tests__/house-credential.test.d.ts.map +1 -0
  22. package/payload/platform/lib/storage-broker/dist/__tests__/house-credential.test.js +39 -0
  23. package/payload/platform/lib/storage-broker/dist/__tests__/house-credential.test.js.map +1 -0
  24. package/payload/platform/lib/storage-broker/dist/__tests__/registry.test.d.ts +2 -0
  25. package/payload/platform/lib/storage-broker/dist/__tests__/registry.test.d.ts.map +1 -0
  26. package/payload/platform/lib/storage-broker/dist/__tests__/registry.test.js +59 -0
  27. package/payload/platform/lib/storage-broker/dist/__tests__/registry.test.js.map +1 -0
  28. package/payload/platform/lib/storage-broker/dist/__tests__/remediate-run.test.d.ts +2 -0
  29. package/payload/platform/lib/storage-broker/dist/__tests__/remediate-run.test.d.ts.map +1 -0
  30. package/payload/platform/lib/storage-broker/dist/__tests__/remediate-run.test.js +77 -0
  31. package/payload/platform/lib/storage-broker/dist/__tests__/remediate-run.test.js.map +1 -0
  32. package/payload/platform/lib/storage-broker/dist/__tests__/remediate.test.d.ts +2 -0
  33. package/payload/platform/lib/storage-broker/dist/__tests__/remediate.test.d.ts.map +1 -0
  34. package/payload/platform/lib/storage-broker/dist/__tests__/remediate.test.js +23 -0
  35. package/payload/platform/lib/storage-broker/dist/__tests__/remediate.test.js.map +1 -0
  36. package/payload/platform/lib/storage-broker/dist/audit.d.ts +19 -0
  37. package/payload/platform/lib/storage-broker/dist/audit.d.ts.map +1 -0
  38. package/payload/platform/lib/storage-broker/dist/audit.js +41 -0
  39. package/payload/platform/lib/storage-broker/dist/audit.js.map +1 -0
  40. package/payload/platform/lib/storage-broker/dist/authorize.d.ts +11 -0
  41. package/payload/platform/lib/storage-broker/dist/authorize.d.ts.map +1 -0
  42. package/payload/platform/lib/storage-broker/dist/authorize.js +17 -0
  43. package/payload/platform/lib/storage-broker/dist/authorize.js.map +1 -0
  44. package/payload/platform/lib/storage-broker/dist/bin/remediate-run.d.ts +25 -0
  45. package/payload/platform/lib/storage-broker/dist/bin/remediate-run.d.ts.map +1 -0
  46. package/payload/platform/lib/storage-broker/dist/bin/remediate-run.js +131 -0
  47. package/payload/platform/lib/storage-broker/dist/bin/remediate-run.js.map +1 -0
  48. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts +20 -0
  49. package/payload/platform/lib/storage-broker/dist/cf-exec.d.ts.map +1 -0
  50. package/payload/platform/lib/storage-broker/dist/cf-exec.js +53 -0
  51. package/payload/platform/lib/storage-broker/dist/cf-exec.js.map +1 -0
  52. package/payload/platform/lib/storage-broker/dist/house-credential.d.ts +6 -0
  53. package/payload/platform/lib/storage-broker/dist/house-credential.d.ts.map +1 -0
  54. package/payload/platform/lib/storage-broker/dist/house-credential.js +33 -0
  55. package/payload/platform/lib/storage-broker/dist/house-credential.js.map +1 -0
  56. package/payload/platform/lib/storage-broker/dist/index.d.ts +7 -0
  57. package/payload/platform/lib/storage-broker/dist/index.d.ts.map +1 -0
  58. package/payload/platform/lib/storage-broker/dist/index.js +30 -0
  59. package/payload/platform/lib/storage-broker/dist/index.js.map +1 -0
  60. package/payload/platform/lib/storage-broker/dist/registry.d.ts +18 -0
  61. package/payload/platform/lib/storage-broker/dist/registry.d.ts.map +1 -0
  62. package/payload/platform/lib/storage-broker/dist/registry.js +45 -0
  63. package/payload/platform/lib/storage-broker/dist/registry.js.map +1 -0
  64. package/payload/platform/lib/storage-broker/dist/remediate.d.ts +7 -0
  65. package/payload/platform/lib/storage-broker/dist/remediate.d.ts.map +1 -0
  66. package/payload/platform/lib/storage-broker/dist/remediate.js +25 -0
  67. package/payload/platform/lib/storage-broker/dist/remediate.js.map +1 -0
  68. package/payload/platform/lib/storage-broker/src/__tests__/audit.test.ts +49 -0
  69. package/payload/platform/lib/storage-broker/src/__tests__/authorize.test.ts +28 -0
  70. package/payload/platform/lib/storage-broker/src/__tests__/cf-exec.test.ts +52 -0
  71. package/payload/platform/lib/storage-broker/src/__tests__/house-credential.test.ts +35 -0
  72. package/payload/platform/lib/storage-broker/src/__tests__/registry.test.ts +64 -0
  73. package/payload/platform/lib/storage-broker/src/__tests__/remediate-run.test.ts +79 -0
  74. package/payload/platform/lib/storage-broker/src/__tests__/remediate.test.ts +21 -0
  75. package/payload/platform/lib/storage-broker/src/audit.ts +55 -0
  76. package/payload/platform/lib/storage-broker/src/authorize.ts +22 -0
  77. package/payload/platform/lib/storage-broker/src/bin/remediate-run.ts +156 -0
  78. package/payload/platform/lib/storage-broker/src/cf-exec.ts +73 -0
  79. package/payload/platform/lib/storage-broker/src/house-credential.ts +32 -0
  80. package/payload/platform/lib/storage-broker/src/index.ts +14 -0
  81. package/payload/platform/lib/storage-broker/src/registry.ts +85 -0
  82. package/payload/platform/lib/storage-broker/src/remediate.ts +31 -0
  83. package/payload/platform/lib/storage-broker/tsconfig.json +8 -0
  84. package/payload/platform/package.json +2 -2
  85. package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
  86. package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
  87. package/payload/platform/plugins/admin/PLUGIN.md +1 -1
  88. package/payload/platform/plugins/admin/hooks/lib/maxy-mcp-plugins.txt +1 -0
  89. package/payload/platform/plugins/admin/mcp/dist/index.js +40 -24
  90. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  91. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.d.ts +7 -7
  92. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.d.ts.map +1 -1
  93. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.js +7 -7
  94. package/payload/platform/plugins/admin/mcp/dist/tools/account-lifecycle.js.map +1 -1
  95. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +8 -4
  96. package/payload/platform/plugins/cloudflare/PLUGIN.md +4 -1
  97. package/payload/platform/plugins/cloudflare/bin/__tests__/cf-schema-check.test.sh +128 -0
  98. package/payload/platform/plugins/cloudflare/bin/__tests__/cf-store-name.test.sh +77 -0
  99. package/payload/platform/plugins/cloudflare/bin/cf-schema-check.sh +60 -0
  100. package/payload/platform/plugins/cloudflare/bin/cf-store-name.sh +37 -0
  101. package/payload/platform/plugins/cloudflare/bin/remediate-storage-isolation.sh +36 -0
  102. package/payload/platform/plugins/cloudflare/references/api.md +4 -0
  103. package/payload/platform/plugins/cloudflare/references/d1-data-capture.md +58 -0
  104. package/payload/platform/plugins/cloudflare/references/r2-object-storage.md +39 -0
  105. package/payload/platform/plugins/cloudflare/skills/cloudflare/SKILL.md +2 -0
  106. package/payload/platform/plugins/cloudflare/skills/site-deploy/SKILL.md +2 -0
  107. package/payload/platform/plugins/docs/references/admin-session.md +2 -0
  108. package/payload/platform/plugins/docs/references/admin-ui.md +4 -0
  109. package/payload/platform/plugins/docs/references/cross-account-authority.md +3 -3
  110. package/payload/platform/plugins/outlook/references/auth.md +8 -0
  111. package/payload/platform/plugins/outlook/skills/outlook/SKILL.md +3 -0
  112. package/payload/platform/plugins/scheduling/mcp/dist/scripts/publish-availability.js +11 -4
  113. package/payload/platform/plugins/scheduling/mcp/dist/scripts/publish-availability.js.map +1 -1
  114. package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.js +15 -10
  115. package/payload/platform/plugins/scheduling/mcp/dist/scripts/reconcile-bookings.js.map +1 -1
  116. package/payload/platform/plugins/storage-broker/.claude-plugin/plugin.json +21 -0
  117. package/payload/platform/plugins/storage-broker/PLUGIN.md +48 -0
  118. package/payload/platform/plugins/storage-broker/lib/mcp-spawn-tee/index.js +193 -0
  119. package/payload/platform/plugins/storage-broker/lib/mcp-spawn-tee/package.json +3 -0
  120. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/caller-scope-headers.test.d.ts +2 -0
  121. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/caller-scope-headers.test.d.ts.map +1 -0
  122. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/caller-scope-headers.test.js +16 -0
  123. package/payload/platform/plugins/storage-broker/mcp/dist/__tests__/caller-scope-headers.test.js.map +1 -0
  124. package/payload/platform/plugins/storage-broker/mcp/dist/call-api.d.ts +8 -0
  125. package/payload/platform/plugins/storage-broker/mcp/dist/call-api.d.ts.map +1 -0
  126. package/payload/platform/plugins/storage-broker/mcp/dist/call-api.js +39 -0
  127. package/payload/platform/plugins/storage-broker/mcp/dist/call-api.js.map +1 -0
  128. package/payload/platform/plugins/storage-broker/mcp/dist/caller-scope-headers.d.ts +7 -0
  129. package/payload/platform/plugins/storage-broker/mcp/dist/caller-scope-headers.d.ts.map +1 -0
  130. package/payload/platform/plugins/storage-broker/mcp/dist/caller-scope-headers.js +16 -0
  131. package/payload/platform/plugins/storage-broker/mcp/dist/caller-scope-headers.js.map +1 -0
  132. package/payload/platform/plugins/storage-broker/mcp/dist/index.d.ts +8 -0
  133. package/payload/platform/plugins/storage-broker/mcp/dist/index.d.ts.map +1 -0
  134. package/payload/platform/plugins/storage-broker/mcp/dist/index.js +98 -0
  135. package/payload/platform/plugins/storage-broker/mcp/dist/index.js.map +1 -0
  136. package/payload/platform/plugins/storage-broker/mcp/package.json +10 -0
  137. package/payload/platform/plugins/storage-broker/mcp/vitest.config.ts +4 -0
  138. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/format-attachment-suffix.test.d.ts +2 -0
  139. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/format-attachment-suffix.test.d.ts.map +1 -0
  140. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/format-attachment-suffix.test.js +44 -0
  141. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/format-attachment-suffix.test.js.map +1 -0
  142. package/payload/platform/plugins/whatsapp/mcp/dist/format.d.ts +7 -0
  143. package/payload/platform/plugins/whatsapp/mcp/dist/format.d.ts.map +1 -1
  144. package/payload/platform/plugins/whatsapp/mcp/dist/format.js +27 -0
  145. package/payload/platform/plugins/whatsapp/mcp/dist/format.js.map +1 -1
  146. package/payload/platform/plugins/whatsapp/mcp/dist/index.js +6 -19
  147. package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
  148. package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +3 -1
  149. package/payload/platform/plugins/work/mcp/dist/tools/work-create.d.ts.map +1 -1
  150. package/payload/platform/plugins/work/mcp/dist/tools/work-create.js +10 -7
  151. package/payload/platform/plugins/work/mcp/dist/tools/work-create.js.map +1 -1
  152. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
  153. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +6 -0
  154. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
  155. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +1 -0
  156. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  157. package/payload/platform/services/claude-session-manager/dist/http-server.js +99 -8
  158. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  159. package/payload/platform/services/claude-session-manager/dist/index.js +0 -13
  160. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  161. package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts +8 -0
  162. package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts.map +1 -1
  163. package/payload/platform/services/claude-session-manager/dist/jsonl-path.js +11 -0
  164. package/payload/platform/services/claude-session-manager/dist/jsonl-path.js.map +1 -1
  165. package/payload/platform/services/claude-session-manager/dist/passive-admin-assignment.d.ts +20 -0
  166. package/payload/platform/services/claude-session-manager/dist/passive-admin-assignment.d.ts.map +1 -0
  167. package/payload/platform/services/claude-session-manager/dist/passive-admin-assignment.js +66 -0
  168. package/payload/platform/services/claude-session-manager/dist/passive-admin-assignment.js.map +1 -0
  169. package/payload/platform/services/claude-session-manager/dist/passive-spawn-tools-tail.d.ts +19 -0
  170. package/payload/platform/services/claude-session-manager/dist/passive-spawn-tools-tail.d.ts.map +1 -0
  171. package/payload/platform/services/claude-session-manager/dist/passive-spawn-tools-tail.js +50 -0
  172. package/payload/platform/services/claude-session-manager/dist/passive-spawn-tools-tail.js.map +1 -0
  173. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  174. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +14 -1
  175. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  176. package/payload/server/chunk-4W6IEUFE.js +175 -0
  177. package/payload/server/public/assets/{AdminLoginScreens-BJVwtpLH.js → AdminLoginScreens-D9L-CuWi.js} +1 -1
  178. package/payload/server/public/assets/{AdminShell-CMu8_Xwn.js → AdminShell-DSQrvZXq.js} +1 -1
  179. package/payload/server/public/assets/{Checkbox-CzD0ORqA.js → Checkbox-CFdt8ljo.js} +1 -1
  180. package/payload/server/public/assets/{admin-D0yk2LMq.js → admin-Ch4n-G0j.js} +1 -1
  181. package/payload/server/public/assets/{browser-CvfbgznO.js → browser-B2AIxiuk.js} +1 -1
  182. package/payload/server/public/assets/{calendar-fw4WethJ.js → calendar-BvItH3B0.js} +1 -1
  183. package/payload/server/public/assets/chat-eQFMaX9y.js +1 -0
  184. package/payload/server/public/assets/chevron-left-D2AnCEyE.js +1 -0
  185. package/payload/server/public/assets/data-BzOmbHoe.js +1 -0
  186. package/payload/server/public/assets/{file-download-Px4s0Bhp.js → file-download-CK9j_Jx2.js} +1 -1
  187. package/payload/server/public/assets/graph-DrE7KupQ.js +51 -0
  188. package/payload/server/public/assets/graph-labels-CwEtvIRV.js +1 -0
  189. package/payload/server/public/assets/{maximize-2-BwphzI9S.js → maximize-2-CuzEom3K.js} +1 -1
  190. package/payload/server/public/assets/{operator-zcIfeB14.js → operator-DlboYPPu.js} +1 -1
  191. package/payload/server/public/assets/page-BuWH5gNK.js +1 -0
  192. package/payload/server/public/assets/page-Co9E8U5x.js +32 -0
  193. package/payload/server/public/assets/{public-C0ehZCdE.js → public-DtFpPMTG.js} +1 -1
  194. package/payload/server/public/assets/{rotate-ccw-C7BqkMec.js → rotate-ccw-Cqp4oqHV.js} +1 -1
  195. package/payload/server/public/assets/{tasks-DlgiCafL.js → tasks-bQKOhMga.js} +1 -1
  196. package/payload/server/public/assets/{time-entry-format-CyNYVDkq.js → time-entry-format-BIL4ZaDK.js} +1 -1
  197. package/payload/server/public/assets/useCopyFeedback-rB8QuqyH.js +1 -0
  198. package/payload/server/public/assets/{useSubAccountSwitcher-1izQvPiD.css → useSubAccountSwitcher-CVHKTSst.css} +1 -1
  199. package/payload/server/public/assets/{useVoiceRecorder-XgpWvXpk.js → useVoiceRecorder-Ctny8qWx.js} +1 -1
  200. package/payload/server/public/browser.html +5 -5
  201. package/payload/server/public/calendar.html +6 -6
  202. package/payload/server/public/chat.html +12 -12
  203. package/payload/server/public/data.html +10 -10
  204. package/payload/server/public/graph.html +11 -11
  205. package/payload/server/public/index.html +13 -13
  206. package/payload/server/public/operator.html +14 -14
  207. package/payload/server/public/public.html +12 -12
  208. package/payload/server/public/tasks.html +5 -5
  209. package/payload/server/server.js +1082 -841
  210. package/payload/server/src-BQ2NYMOT.js +24 -0
  211. package/payload/server/public/assets/chat-DhD-NES_.js +0 -1
  212. package/payload/server/public/assets/chevron-left-B3xSeEDR.js +0 -1
  213. package/payload/server/public/assets/data-CUnDzDox.js +0 -1
  214. package/payload/server/public/assets/graph-DbT8nA6R.js +0 -51
  215. package/payload/server/public/assets/graph-labels-C1YIyLiA.js +0 -1
  216. package/payload/server/public/assets/page-6fCnIb45.js +0 -32
  217. package/payload/server/public/assets/page-CfQFAJia.js +0 -1
  218. package/payload/server/public/assets/useCopyFeedback-ByGUMN94.js +0 -1
  219. /package/payload/server/public/assets/{useSubAccountSwitcher-s6WlRn52.js → useSubAccountSwitcher-CHEt_m6q.js} +0 -0
@@ -67,13 +67,13 @@ export declare function setManagingAdmin(accountsDir: string, accountId: string,
67
67
  * if its account.json happens to carry the field. Filesystem-only; a dir with no
68
68
  * account.json, or an unparseable one, is excluded (corruption discipline).
69
69
  *
70
- * Enumeration matches account-admin-census's `readAccounts` exactly — no UUID_RE
71
- * prefilter, membership decided solely by a parseable account.json. That census
72
- * is the acceptance oracle (`dangling=0` after a removal/reassignment), so the
73
- * guard this drives must see the identical account set; a UUID prefilter here
74
- * could let the guard miss an account the census still flags as dangling. Drives
75
- * the admin-remove reconciliation guard removing an admin this returns
76
- * non-empty for would orphan those accounts, so the removal is refused. */
70
+ * Enumeration decides membership solely by a parseable account.json — no UUID_RE
71
+ * prefilter so the guard sees every account that carries the pointer. Drives
72
+ * the admin-remove reconciliation guard (Task 1501): removing an admin this
73
+ * returns non-empty for would orphan those accounts, so the removal is refused.
74
+ * (Passive intake no longer depends on this pointer being present an absent or
75
+ * dangling managing admin falls back to the primary admin, Task 1630 — but the
76
+ * removal guard still runs so a reassign stays the operator's explicit choice.) */
77
77
  export declare function findClientAccountsManagedBy(accountsDir: string, adminUserId: string): string[];
78
78
  export type ReassignResult = {
79
79
  ok: true;
@@ -1 +1 @@
1
- {"version":3,"file":"account-lifecycle.d.ts","sourceRoot":"","sources":["../../src/tools/account-lifecycle.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AAI9E;;;;;;kEAMkE;AAClE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG5D;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;oCAEoC;AACpC,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,CAoBzE;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED;;+DAE+D;AAC/D,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAE3E;AAED,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;8EAM8E;AAC9E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAOt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O,EAAE,eAAe,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC;IAAE,aAAa,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CA6C5G"}
@@ -142,13 +142,13 @@ export function setManagingAdmin(accountsDir, accountId, adminUserId) {
142
142
  * if its account.json happens to carry the field. Filesystem-only; a dir with no
143
143
  * account.json, or an unparseable one, is excluded (corruption discipline).
144
144
  *
145
- * Enumeration matches account-admin-census's `readAccounts` exactly — no UUID_RE
146
- * prefilter, membership decided solely by a parseable account.json. That census
147
- * is the acceptance oracle (`dangling=0` after a removal/reassignment), so the
148
- * guard this drives must see the identical account set; a UUID prefilter here
149
- * could let the guard miss an account the census still flags as dangling. Drives
150
- * the admin-remove reconciliation guard removing an admin this returns
151
- * non-empty for would orphan those accounts, so the removal is refused. */
145
+ * Enumeration decides membership solely by a parseable account.json — no UUID_RE
146
+ * prefilter so the guard sees every account that carries the pointer. Drives
147
+ * the admin-remove reconciliation guard (Task 1501): removing an admin this
148
+ * returns non-empty for would orphan those accounts, so the removal is refused.
149
+ * (Passive intake no longer depends on this pointer being present an absent or
150
+ * dangling managing admin falls back to the primary admin, Task 1630 — but the
151
+ * removal guard still runs so a reassign stays the operator's explicit choice.) */
152
152
  export function findClientAccountsManagedBy(accountsDir, adminUserId) {
153
153
  let names;
154
154
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"account-lifecycle.js","sourceRoot":"","sources":["../../src/tools/account-lifecycle.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sEAAsE;AACtE,gFAAgF;AAChF,+EAA+E;AAC/E,uEAAuE;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WA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,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;IACpF,MAAM,UAAU,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAC3F,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAC3B;;;;;;;;;;;;;;;;;+DAiB2D,EAC3D,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,CAC1C,CAAC;IACF,gFAAgF;IAChF,2EAA2E;IAC3E,8EAA8E;IAC9E,wEAAwE;IACxE,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,sDAAsD,SAAS,gDAAgD,CAAC,CAAC;IACnI,CAAC;IACD,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAChD,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAChD,SAAS;QACT,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: platform-architecture
3
3
  description: Use when grounding any documented-surface claim about what Maxy ships — plugins, skills, specialists, install/deploy flows, internals. This is the install catalogue, not evidence of what is enabled on the current account. For install state on this account, call `capabilities-here`; for documented surface, cite the `Source:` URL inline.
4
- content-hash: sha256:e83c3708b39a62506dcba40e603fdeb09dd5b11d5cc7d964f3353cd73f01642d
4
+ content-hash: sha256:a6ec9b14c5c480f4b583a6df46bacf861b99e2493ba3a68c7ca0d3ca96173cab
5
5
  brand: maxy-code
6
6
  product-name: Maxy
7
7
  ---
@@ -530,13 +530,13 @@ By default the admin assistant is scoped the same way — it acts on the house a
530
530
 
531
531
  The operator wants this for two surfaces: the account graph and the account filesystem. Each is a separate adoption; a coverage ledger tracks them and a background check confirms neither silently regresses.
532
532
 
533
- ## Creating a sub-account names its managing admin
533
+ ## Creating a sub-account can name a managing admin
534
534
 
535
- Every client sub-account must have a responsible house admin. `account_create` requires the `userId` of a current house admin as the managing admin and refuses to create the account without one — the admin agent asks the operator which house admin manages the client (the choices come from `admin-list`) before creating. The chosen admin is recorded as `managingAdminUserId` on the sub-account. A WhatsApp requirement that comes in for that sub-account is filed as a task assigned to its managing admin, so it lands with a named owner rather than unassigned. A standing check reports any client account whose managing admin is missing or no longer a live house admin.
535
+ A client sub-account may have a responsible house admin, but one is optional. `account_create` takes the `userId` of a current house admin as the managing admin — the admin agent asks the operator which house admin manages the client (the choices come from `admin-list`) and records it as `managingAdminUserId` on the sub-account; a supplied `userId` that is not a live house admin is refused. Omit it for a client run by its owner rather than a house team member. A WhatsApp requirement that comes in for that sub-account is filed as a task assigned to its managing admin; when the sub-account has no managing admin (or its recorded one is no longer a live house admin), the task is assigned to the install's primary admin (the first house admin) instead, so it always lands with a named owner rather than unassigned.
536
536
 
537
537
  ## Reassigning and removing a managing admin
538
538
 
539
- To hand a client to a different team member — or to repair a client whose managing admin was removed — use `account_reassign_admin` with the client's `accountId` and the new admin's `userId`. It refuses a target that is not a client sub-account or a `userId` that is not a current house admin. Removing a house admin is guarded so it cannot silently orphan anyone: `admin-remove` refuses to remove an admin who is still the managing admin of one or more client sub-accounts and names those accounts. Reassign each with `account_reassign_admin`, then remove the admin. After either action the standing check returns to reporting no dangling managing admins.
539
+ To hand a client to a different team member — or to record a managing admin on an unmanaged account, or repair one whose admin was removed — use `account_reassign_admin` with the client's `accountId` and the new admin's `userId`. It refuses a target that is not a client sub-account or a `userId` that is not a current house admin. Removing a house admin is guarded so it cannot silently orphan anyone: `admin-remove` refuses to remove an admin who is still the managing admin of one or more client sub-accounts and names those accounts. Reassign each with `account_reassign_admin`, then remove the admin.
540
540
 
541
541
  ## Memory (graph)
542
542
 
@@ -2761,8 +2761,12 @@ either is a regression.
2761
2761
 
2762
2762
  **`/chat` header always shows the account name.** The admin/operator `HeaderMenu` centre always renders the active account's name alongside the brand logo, on every chat surface, regardless of the active conversation — `headerTitle = businessName || brand.productName`. There is no per-conversation header title: the active conversation's label stays in the sidebar and the Conversations flyout (each resolves its own per-session title independently), never in the header. The account name is `LocalBusiness.name`, resolved by `fetchAccountName(accountId)` in `neo4j-store.ts` with **no theme gate** — unlike `fetchBranding` (which returns null unless a colour/logo property is also set, and stays the source for actual theming). The house account is seeded with `LocalBusiness.name = <brand productName>` (`seed-neo4j.sh`, coalesced ON MATCH so a re-seed backfills a name-less node and never clobbers a name the business-profile recorder set later), so the sub-account picker's house row shows the product name (e.g. "SiteDesk"), not the raw accountId UUID. When a name is absent the resolver emits `[branding] account-name-fallback accountId=<id8>… reason=no-name`, and the picker falls back to the accountId; the seed + backfill is the name source. The lite variant header is unchanged.
2763
2763
 
2764
+ **`/chat` sub-account switch starts a fresh conversation.** Switching sub-accounts from the header picker while on the chat page presents an empty greeting with no active session — no footer id, no highlighted conversation. The next message starts a **new** conversation for the switched-to account rather than reopening that account's previous one, and the previous conversation is left untouched and still resumable from the Conversations list. A normal visit to the chat page that did not switch accounts still reopens the account's most recent conversation as before. The full mechanism (the `clearSignal` first send and the `op=post-switch-pointer`/`op=send-target-resolve` diagnostics) lives in `.docs/admin-webchat-native-channel.md`.
2765
+
2764
2766
  **`/chat` Claude-desktop transcript presentation.** The admin webchat keeps the shared `Transcript` shell (stream, follow-tail) but injects a /chat-only item renderer via the component's optional `renderItems` prop: `renderChatTimeline` in `app/chat/transcript-render.tsx`. Presentation: operator turns render as a right-aligned grey bubble showing the message text and, beneath it, a subtle always-visible time-of-day stamp (no label); delivered agent replies render as plain prose with the same time-of-day stamp beneath (the reply-document filename line stays, as prose); the stamp is HH:MM from the turn's `ts` (locale-formatted, right-aligned inside the operator bubble, left-aligned under agent prose), and a turn whose `ts` is null/unparseable shows no stamp, never an empty line — so only delivered operator and agent-reply turns are stamped, while tool runs, the collapsed "Thinking" block, and the agent-error banner stay time-free; a maximal consecutive run of `tool-call`/`tool-result` turns renders as one collapsed grey one-liner ("Used N tools ›") whose expansion shows every call and result payload — a lone call still gets the one-liner, and prose or a directive row ends a run. The WhatsApp/operator reader (`/whatsapp`, `OperatorConversations`) omits the prop and keeps the default `renderTimeline`, so its bubble/DM chrome is unchanged — except that since the attachment-render extraction the default renderer draws inbound `operator-inbound` uploads and `agent-file` deliveries inline (image thumbnail / pdf.js preview / voice-note player / download chip) via the attachment renderer shared with `/chat`, extracted to `app/chat/attachment-render.tsx` to break the cycle with `transcript-render.tsx`; `renderChatTimeline` is untouched. Both presentations are test-pinned (`app/whatsapp/__tests__/Transcript-*.test.tsx`, `app/chat/__tests__/transcript-render.test.tsx`, `app/chat/__tests__/pdf-preview.test.tsx`). **Day-divider:** both renderers insert a centered `.day-divider` row between two consecutive timeline items on different local calendar days (label `Today`/`Yesterday`, else `Sat 14 Jun 2026`), so a thread spanning midnight is never an ambiguous run of HH:MM; the first dated item gets a leading divider, a null/unparseable `ts` marks no boundary, dividers are computed over the filtered `visibleItems`, and in `/chat` a day crossover flushes any open tool/think run first so a collapsed run never spans it. Per-bubble HH:MM stamps are unchanged. Shared helpers `dayKey`/`dayLabel`/`itemTs`/`DayDivider` live in `app/whatsapp/Transcript.tsx`.
2765
2767
 
2768
+ **One delivered bubble per turn when the agent replied.** On the admin `/chat`, a turn that used the reply tool shows exactly one delivered bubble — the reply. A trailing sign-off or recap the agent writes after the reply is treated as narration and is not shown as a second bubble (it collapses like any mid-turn prose). Only a turn that ends **without** using the reply tool has its final text promoted to a delivered bubble, so a genuine no-reply answer is never lost. The tradeoff, accepted by the operator: a turn that acknowledges on the reply tool and then writes the real answer as trailing text will not show that trailing answer — the agent is steered to put the answer on the reply tool so this stays rare.
2769
+
2766
2770
  **WhatsApp reader is read/write (WhatsApp-Web surface).** A WhatsApp store conversation in the operator Conversations reader (`OperatorConversations`) and the admin root channel viewer (`app/page.tsx`) no longer opens the plain read-only DM chrome — it opens `app/whatsapp/WhatsappWebConversation.tsx`, a WhatsApp-Web-styled surface: a conversation header, the delivered-only store transcript reskinned green/white under a `.wa-web` root class, and a reply composer (`app/whatsapp/ReplyComposer.tsx`). The operator can type text, insert emoji (a codepoint-data picker — no OS input, so the `check-no-emoji-in-jsx` gate stays green), record a voice note (MediaRecorder → the existing audio send path), attach a file **from device storage** (a modal browsing the DATA_ROOT tree via `GET /api/admin/files`, sent by reference — the OS file dialog is no longer the reader's picker), reply to a specific message (a per-bubble affordance that quotes the original in the composer and threads natively on WhatsApp), and search the loaded transcript (a header control that filters to matching turns and highlights the match). The header carries only that Search control — the former Video / Phone / menu icons are gone, because no call or presence data exists behind them. Sent files honour the webchat allowlist (`SUPPORTED_MIME_SET` / 50 MB / 5 files); a device-file reference is authorised server-side (`authorizeReplyFileRef`) against the send's own account (the conversation owner) **or** the session's pinned account (`getAccountIdForSession` — the exact scope the DeviceFilePicker used to offer it), so a house/managing-admin session can attach a managed-client file the picker listed. Because a reply sends bytes OUT to an external WhatsApp recipient, any other account, a `public` partition, and any install-wide / non-account path are refused fail-closed; the cross-account admission's authority is the session's pinned account, never the caller-supplied body `accountId` (the own-account admission matches the body `accountId`, which the route already trusts via `isValidAccountId` and the existing-conversation guard). A scope refusal returns a distinct HTTP 403 reason (`file-ref-cross-account` / `file-ref-public` / `file-ref-foreign`) and copy, never "device file not found" (reserved for a genuine resolve/stat miss). Per-ref `[wa-manual-send] op=reply-file-ref … via=own|session|deny reason=<…> ok=<bool>` logs the decision before any send; `via=deny ok=true` is the exfiltration signature that must never appear. **Send is reply-only and DM-only:** `POST /api/whatsapp-reader/reply` (`requireAdminSession`) refuses any target with no existing stored conversation (`reason=no-existing-conversation`, HTTP 403) — a cold first-contact send bans the account, so the composer is never a cold-contact path, enforced server-side — and refuses `@g.us` groups (`reason=group-send-blocked`), matching the agent's observe-only group invariant; a group thread shows a read-only note in place of the composer. The endpoint is the sole store writer for a manual send: right after each send resolves it appends the record itself, stamped `origin:'operator-manual'` (attributed "You", distinct from an assistant reply), because the Baileys echo that normally persists the store is gated on message text (`manager.ts:906`) and would leave an uncaptioned media send delivered-but-invisible. The record's `messageId` matches the echo's derivation so the async text echo's own persist dedups to a no-op; the send is confirmed by re-read (`op=recorded present=<bool>`). A sent send does not spawn an assistant turn (echo dispatch stays suppressed). Attachments deliver as WhatsApp media/documents and render **inline** in the store reader (image thumbnail / pdf preview / audio player / download chip), because the manual-send path records the message with the servable `attachmentId`. The `.wa-web` skin is scoped to WhatsApp store threads only, so `/chat`, the admin agent session view, and the public visitor webchat are unchanged; the visitor webchat gains no send capability. The in-bubble delivered-tick is cosmetic (no read-receipt data is stored); inbound bubbles keep their sender name so group threads stay attributable, and both directions carry a WhatsApp callout tail (`.wa-web`-scoped only). Non-WhatsApp reader rows (Telegram/webchat session JSONLs) keep the plain read-only `Transcript`. Observability rides `[wa-manual-send]` lines correlated by a per-request `sendId`. **Composer sizing matches the webchat composer:** the reply textarea auto-grows to fit multi-line content (measured from `scrollHeight`, clamped to a one-row minimum and a `viewport/3` maximum, scrollable past the cap with the scrollbar hidden), and a top-border grab handle drags (pointer) or nudges (ArrowUp/ArrowDown, keyboard-focusable) to an explicit height in the same clamp; a manual drag pins the height and overrides auto-grow until the field is cleared, which releases it back to auto-grow. A completed manual resize logs `[operator-ui] op=wa-composer-resize mode=drag|key h=<px>`; a bare click on the handle (no drag) logs nothing.
2767
2771
 
2768
2772
  **`/chat` live activity line.** While a turn is in flight the transcript tail shows one ephemeral `ChatActivity` line (mounted only while `busy`, admin/operator only). It tracks real activity, not a timer: while a `Task` subagent runs it shows that subagent's headline (`agentType · description`, prefixed `N agents ·` when ≥2 are concurrent), sourced from `agent-<hex>.meta.json` via named `activity` SSE events the admin reader pushes from the session's `subagents/` dir; with no subagent active it shows a neutral word that advances only on a real turn arrival. The line carries a turn-elapsed clock and flips to a `stalled` state once nothing has been written for 5 minutes (`now − lastEmitAt`), so the operator can tell a wedge from progress without SSH. It is never added to the persisted timeline. Detail and the `[webchat-activity]` observability live in [`admin-webchat-native-channel.md`](../../../.docs/admin-webchat-native-channel.md).
@@ -40,7 +40,8 @@ The plugin registers no agent-facing MCP tools. Every Cloudflare operation is th
40
40
  |---|---|
41
41
  | [manual-setup.md](references/manual-setup.md) | Tunnel runbook — Steps 0–7 with isolated `cloudflared` command blocks. The agent reads the relevant step before issuing each command. |
42
42
  | [api.md](references/api.md) | Cloudflare API library — canonical docs URL + curated endpoint map (DNS, zones, tunnels, token list/create/verify/revoke), the advanced master-token creation walkthrough, the account-scoped secrets-file storage convention, the agent's reuse-a-stable-per-scope-token discipline, and the standing reconcile pass that revokes strays. |
43
- | [d1-data-capture.md](references/d1-data-capture.md) | Form → Pages Function → D1 store → read/sweep. The Pages-Edit **and** D1-Edit token-scope requirement, `wrangler d1 create`/`execute --remote`, the `swept` column. |
43
+ | [d1-data-capture.md](references/d1-data-capture.md) | Form → Pages Function → D1 store → read/sweep. The Pages-Edit **and** D1-Edit token-scope requirement, `wrangler d1 create`/`execute --remote`, the `swept` column, plus the establishment discipline: `<accountId>-<purpose>` naming, one store per purpose, and the canonical `acceptances` schema. |
44
+ | [r2-object-storage.md](references/r2-object-storage.md) | R2 buckets under the same establishment discipline as D1: `<accountId>-<purpose>` naming via `cf-store-name.sh`, one bucket per purpose, `wrangler r2 bucket create`, and the store-provision breadcrumb. |
44
45
  | [hosting-sites.md](references/hosting-sites.md) | Deploy a static or Next.js site to Cloudflare Pages via `wrangler pages deploy`. |
45
46
  | [web-analytics.md](references/web-analytics.md) | Why a registered site reports 0 visitors — the RUM API is blocked (no permission group), registered ≠ collecting, edge auto-injection is impossible for a Pages-only custom domain, and the beacon must be injected into the site HTML, rebuilt, and redeployed. Outcome: beacon present in live HTML. |
46
47
  | [dashboard-guide.md](references/dashboard-guide.md) | Click-paths for operations the operator prefers to do by hand — sign in, switch accounts, add a site, edit an apex CNAME, verify nameservers, delete a tunnel, manage CNAME records, author an Access policy. |
@@ -53,6 +54,8 @@ The agent loads these references on demand via `plugin-read` as the conversation
53
54
  | Helper | Purpose |
54
55
  |---|---|
55
56
  | [bin/cf-token.sh](bin/cf-token.sh) | Deterministic per-scope token resolver. `bash bin/cf-token.sh <scope> <secrets-file>` (scope: `pages`, `d1`, `dns`, `access`) reads the master's `cfat_`/`cfut_` prefix, routes verify/`permission_groups`/mint to the matching endpoint family, reuses a persisted token or mints once if absent (no expiry), verifies through the transient post-mint window, persists to the secrets file, and prints only the secrets key name on stdout (never a token value). It removes the endpoint-routing decision from the agent, which is what the false-negative `Invalid API Token` / `9109` failures turned on. curl + jq only; exit-code gated. |
57
+ | [bin/cf-store-name.sh](bin/cf-store-name.sh) | Deterministic storage-name resolver. `bash bin/cf-store-name.sh <accountId> <purpose>` prints the canonical `<accountId>-<purpose>` name (nothing else) for a D1 database or R2 bucket, so a store's name identifies its owner and purpose. Lowercases and validates each segment to `[a-z0-9-]`; fails closed on empty or invalid input. No network, no secrets. |
58
+ | [bin/cf-schema-check.sh](bin/cf-schema-check.sh) | Canonical acceptance-schema gate. Feed it the stored DDL (`wrangler d1 execute --json --command "SELECT sql FROM sqlite_master WHERE sql IS NOT NULL" \| jq -r '.[0].results[].sql'`); exit 0 iff the store carries the one canonical `acceptances` shape (`doc_ref`, `doc_type`, `party`, `signer_name`, `accepted_at`, `swept`; no stray `dual_acceptances` table; `signer_name` not a bare `name`), exit 1 with the first drift named on stderr. Exit-code gated. |
56
59
 
57
60
  ### Success contract
58
61
 
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env bash
2
+ # Regression test for cf-schema-check.sh - the canonical acceptance-schema
3
+ # validator. Input on stdin is the DDL text a `SELECT sql FROM sqlite_master`
4
+ # returns; exit 0 iff the store matches the one canonical `acceptances` shape,
5
+ # non-zero on any drift. No network, no D1.
6
+ #
7
+ # Covers:
8
+ # 1. canonical shape -> exit 0
9
+ # 2. canonical shape + an unrelated leads table -> exit 0 (extra tables fine)
10
+ # 3. bare `name` instead of signer_name -> exit 1, stderr names signer drift
11
+ # 4. missing swept column -> exit 1, stderr names swept
12
+ # 5. a stray dual_acceptances table -> exit 1, stderr names it
13
+ # 6. no acceptances table (only leads) -> exit 1, stderr "no acceptances table"
14
+ set -u
15
+
16
+ HELPER="$(cd "$(dirname "$0")/.." && pwd)/cf-schema-check.sh"
17
+ [ -x "$HELPER" ] || { echo "FAIL: $HELPER not executable" >&2; exit 1; }
18
+
19
+ PASS=0; FAIL=0
20
+ ok() { echo "PASS: $1"; PASS=$((PASS+1)); }
21
+ bad() { echo "FAIL: $1" >&2; FAIL=$((FAIL+1)); }
22
+
23
+ # Canonical acceptance DDL (the authority declared in d1-data-capture.md).
24
+ CANON='CREATE TABLE IF NOT EXISTS acceptances (
25
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
26
+ doc_ref TEXT NOT NULL,
27
+ doc_type TEXT NOT NULL,
28
+ party TEXT,
29
+ signer_name TEXT,
30
+ accepted_at TEXT NOT NULL DEFAULT (datetime('"'"'now'"'"')),
31
+ swept INTEGER NOT NULL DEFAULT 0
32
+ );'
33
+
34
+ LEADS='CREATE TABLE leads (
35
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
36
+ email TEXT NOT NULL,
37
+ swept INTEGER NOT NULL DEFAULT 0
38
+ );'
39
+
40
+ # Run helper with stdin=$1. Sets ERR/RC.
41
+ run() {
42
+ local ef; ef=$(mktemp)
43
+ printf '%s\n' "$1" | bash "$HELPER" 2>"$ef" >/dev/null
44
+ RC=$?
45
+ ERR=$(cat "$ef"); rm -f "$ef"
46
+ }
47
+
48
+ # 1. canonical -> 0
49
+ run "$CANON"
50
+ [ "$RC" -eq 0 ] && ok "canonical shape accepted (exit=$RC)" || bad "canonical rejected (exit=$RC err='$ERR')"
51
+
52
+ # 2. canonical + leads -> 0
53
+ run "$CANON
54
+ $LEADS"
55
+ [ "$RC" -eq 0 ] && ok "canonical plus unrelated table accepted" || bad "extra table rejected (exit=$RC err='$ERR')"
56
+
57
+ # 3. bare name drift -> 1, mentions signer
58
+ DRIFT_NAME='CREATE TABLE acceptances (
59
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
60
+ doc_ref TEXT NOT NULL,
61
+ doc_type TEXT NOT NULL,
62
+ party TEXT,
63
+ name TEXT,
64
+ accepted_at TEXT NOT NULL,
65
+ swept INTEGER NOT NULL DEFAULT 0
66
+ );'
67
+ run "$DRIFT_NAME"
68
+ { [ "$RC" -ne 0 ] && printf '%s' "$ERR" | grep -qi "signer"; } \
69
+ && ok "bare name rejected, signer drift named (exit=$RC)" \
70
+ || bad "bare name drift (exit=$RC err='$ERR')"
71
+
72
+ # 4. missing swept -> 1, mentions swept
73
+ DRIFT_SWEPT='CREATE TABLE acceptances (
74
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
75
+ doc_ref TEXT NOT NULL,
76
+ doc_type TEXT NOT NULL,
77
+ party TEXT,
78
+ signer_name TEXT,
79
+ accepted_at TEXT NOT NULL
80
+ );'
81
+ run "$DRIFT_SWEPT"
82
+ { [ "$RC" -ne 0 ] && printf '%s' "$ERR" | grep -qi "swept"; } \
83
+ && ok "missing swept rejected, swept named (exit=$RC)" \
84
+ || bad "missing swept (exit=$RC err='$ERR')"
85
+
86
+ # 4b. acceptances missing swept, but a sibling leads table HAS swept -> still
87
+ # exit 1. Column checks must be scoped to the acceptances table, not bleed
88
+ # across the whole dump.
89
+ DRIFT_SWEPT_BLEED='CREATE TABLE acceptances (
90
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
91
+ doc_ref TEXT NOT NULL,
92
+ doc_type TEXT NOT NULL,
93
+ party TEXT,
94
+ signer_name TEXT,
95
+ accepted_at TEXT NOT NULL
96
+ );
97
+ CREATE TABLE leads (
98
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
99
+ email TEXT NOT NULL,
100
+ swept INTEGER NOT NULL DEFAULT 0
101
+ );'
102
+ run "$DRIFT_SWEPT_BLEED"
103
+ { [ "$RC" -ne 0 ] && printf '%s' "$ERR" | grep -qi "swept"; } \
104
+ && ok "missing swept not masked by sibling table (exit=$RC)" \
105
+ || bad "swept bleed across tables (exit=$RC err='$ERR')"
106
+
107
+ # 5. dual_acceptances stray -> 1, mentions it
108
+ DUAL="$CANON
109
+ CREATE TABLE dual_acceptances (
110
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
111
+ doc_ref TEXT NOT NULL,
112
+ party TEXT,
113
+ signer_name TEXT
114
+ );"
115
+ run "$DUAL"
116
+ { [ "$RC" -ne 0 ] && printf '%s' "$ERR" | grep -qi "dual_acceptances"; } \
117
+ && ok "stray dual_acceptances rejected and named (exit=$RC)" \
118
+ || bad "dual_acceptances stray (exit=$RC err='$ERR')"
119
+
120
+ # 6. no acceptances table -> 1, mentions it
121
+ run "$LEADS"
122
+ { [ "$RC" -ne 0 ] && printf '%s' "$ERR" | grep -qi "no acceptances"; } \
123
+ && ok "missing acceptances table rejected and named (exit=$RC)" \
124
+ || bad "no acceptances table (exit=$RC err='$ERR')"
125
+
126
+ echo "----"
127
+ echo "PASS=$PASS FAIL=$FAIL"
128
+ [ "$FAIL" -eq 0 ]
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env bash
2
+ # Regression test for cf-store-name.sh - the canonical <accountId>-<purpose>
3
+ # store-name helper. Pure string computation: no curl, no secrets, no network.
4
+ #
5
+ # Covers:
6
+ # 1. valid input -> <accountId>-<purpose> on stdout, exit 0
7
+ # 2. deterministic: identical inputs -> byte-identical output
8
+ # 3. mixed-case input is lowercased
9
+ # 4. a hyphenated purpose is preserved
10
+ # 5. empty accountId fails closed (exit 1)
11
+ # 6. empty purpose fails closed (exit 1)
12
+ # 7. an invalid character in a segment fails closed (exit 1)
13
+ # 8. no missing-arg or invalid case leaks a partial name to stdout
14
+ set -u
15
+
16
+ HELPER="$(cd "$(dirname "$0")/.." && pwd)/cf-store-name.sh"
17
+ [ -x "$HELPER" ] || { echo "FAIL: $HELPER not executable" >&2; exit 1; }
18
+
19
+ PASS=0; FAIL=0
20
+ ok() { echo "PASS: $1"; PASS=$((PASS+1)); }
21
+ bad() { echo "FAIL: $1" >&2; FAIL=$((FAIL+1)); }
22
+
23
+ # Run the helper. $1 name, then the helper argv is "$2".."$n" up to a trailing
24
+ # expected-exit sentinel passed via EXP. Sets OUT/ERR/RC.
25
+ run() {
26
+ local name="$1"; shift
27
+ local of ef
28
+ of=$(mktemp); ef=$(mktemp)
29
+ bash "$HELPER" "$@" >"$of" 2>"$ef"
30
+ RC=$?
31
+ OUT=$(cat "$of"); ERR=$(cat "$ef"); rm -f "$of" "$ef"
32
+ }
33
+
34
+ # 1. valid -> name, exit 0
35
+ run "valid" acc123 acceptances
36
+ { [ "$RC" -eq 0 ] && [ "$OUT" = "acc123-acceptances" ]; } \
37
+ && ok "valid input yields acc123-acceptances (exit=$RC)" \
38
+ || bad "valid input (exit=$RC out='$OUT')"
39
+
40
+ # 2. deterministic
41
+ run "det1" acc123 acceptances; d1="$OUT"
42
+ run "det2" acc123 acceptances; d2="$OUT"
43
+ [ "$d1" = "$d2" ] && ok "deterministic identical output" || bad "non-deterministic ('$d1' vs '$d2')"
44
+
45
+ # 3. lowercases
46
+ run "case" Acc123 Acceptances
47
+ { [ "$RC" -eq 0 ] && [ "$OUT" = "acc123-acceptances" ]; } \
48
+ && ok "mixed case lowercased" || bad "case (exit=$RC out='$OUT')"
49
+
50
+ # 4. hyphenated purpose preserved
51
+ run "hyphen" acc123 quote-signing
52
+ { [ "$RC" -eq 0 ] && [ "$OUT" = "acc123-quote-signing" ]; } \
53
+ && ok "hyphenated purpose preserved" || bad "hyphen (exit=$RC out='$OUT')"
54
+
55
+ # 5. empty accountId fails closed
56
+ run "empty-acct" "" acceptances
57
+ { [ "$RC" -ne 0 ] && [ -z "$OUT" ]; } \
58
+ && ok "empty accountId fails closed (exit=$RC)" || bad "empty accountId (exit=$RC out='$OUT')"
59
+
60
+ # 6. empty purpose fails closed
61
+ run "empty-purpose" acc123 ""
62
+ { [ "$RC" -ne 0 ] && [ -z "$OUT" ]; } \
63
+ && ok "empty purpose fails closed (exit=$RC)" || bad "empty purpose (exit=$RC out='$OUT')"
64
+
65
+ # 7. invalid char fails closed
66
+ run "invalid" acc123 "accept!ances"
67
+ { [ "$RC" -ne 0 ] && [ -z "$OUT" ]; } \
68
+ && ok "invalid char fails closed (exit=$RC)" || bad "invalid char (exit=$RC out='$OUT')"
69
+
70
+ # 8. missing second arg fails closed, no partial name
71
+ run "missing-arg" acc123
72
+ { [ "$RC" -ne 0 ] && [ -z "$OUT" ]; } \
73
+ && ok "missing purpose arg fails closed (exit=$RC)" || bad "missing arg (exit=$RC out='$OUT')"
74
+
75
+ echo "----"
76
+ echo "PASS=$PASS FAIL=$FAIL"
77
+ [ "$FAIL" -eq 0 ]
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bash
2
+ # cf-schema-check.sh - canonical acceptance-schema validator.
3
+ #
4
+ # The document-acceptance store (e-sign / works-agreement / quote-signing
5
+ # watchers) has ONE canonical shape, declared in
6
+ # references/d1-data-capture.md § The canonical acceptance store. This helper is
7
+ # the exit-code gate that confirms a live store follows it, so a watcher can
8
+ # rely on reading one known shape instead of three drifted ones.
9
+ #
10
+ # Input: stdin = the DDL text `wrangler d1 execute <db> --remote --command
11
+ # "SELECT sql FROM sqlite_master;"` returns (the SQLite-stored CREATE
12
+ # statements). This is machine-generated DDL, not prose, so token
13
+ # inspection is a deterministic pre-flight.
14
+ # Output: stdout = nothing on success. stderr = a [cf-schema-check] line naming
15
+ # the first failing check.
16
+ # Exit: 0 iff the input matches the canonical acceptance shape; 1 on any drift.
17
+ set -u
18
+
19
+ fail() { echo "[cf-schema-check] drift: $*" >&2; exit 1; }
20
+
21
+ ddl="$(cat)"
22
+ has() { printf '%s' "$ddl" | grep -Eiq "$1"; }
23
+
24
+ # 1. An `acceptances` table must exist. \bacceptances\b does not match inside
25
+ # `dual_acceptances` (the underscore suppresses the word boundary), so this
26
+ # is specific to the canonical table.
27
+ has 'create table[^;(]*\bacceptances\b' || fail "no acceptances table in the store"
28
+
29
+ # 2. No `dual_acceptances` table. Its presence is the two-signer sprawl the
30
+ # canonical `party` column replaces. Checked against the whole dump.
31
+ has '\bdual_acceptances\b' && fail "stray dual_acceptances table (use the party column, not a second table)"
32
+
33
+ # Isolate the `acceptances` CREATE statement so column checks are scoped to it,
34
+ # not bled across sibling tables (a leads table's `swept` must not satisfy the
35
+ # acceptances requirement). Print from the acceptances CREATE line to its `);`.
36
+ acc="$(printf '%s\n' "$ddl" | awk '
37
+ { l = tolower($0) }
38
+ l ~ /create table/ && l ~ /acceptances/ && l !~ /dual_acceptances/ { f = 1 }
39
+ f { print }
40
+ f && /\);/ { exit }
41
+ ')"
42
+ hasin() { printf '%s' "$acc" | grep -Eiq "$1"; }
43
+
44
+ # 3. The signer column is `signer_name`, never a bare `name`. \bname\b does not
45
+ # match inside `signer_name`, so a standalone `name` token with no
46
+ # `signer_name` present is the drift signature.
47
+ if ! hasin '\bsigner_name\b'; then
48
+ if hasin '\bname\b'; then
49
+ fail "signer column is bare 'name', expected 'signer_name'"
50
+ fi
51
+ fail "missing required column: signer_name"
52
+ fi
53
+
54
+ # 4. Every canonical column present in the acceptances table. signer_name is
55
+ # already confirmed above.
56
+ for col in doc_ref doc_type party accepted_at swept; do
57
+ hasin "\\b${col}\\b" || fail "missing required column: ${col}"
58
+ done
59
+
60
+ exit 0
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+ # cf-store-name.sh - deterministic Cloudflare storage-name resolver.
3
+ #
4
+ # Owns the one naming decision the plugin previously left to the agent: a D1
5
+ # database or R2 bucket is named <accountId>-<purpose>, so a store's name
6
+ # identifies its owner and purpose (references/d1-data-capture.md § Establishing
7
+ # a store, references/r2-object-storage.md). Same inputs always yield the same
8
+ # name; that determinism is what lets "does a store for this purpose already
9
+ # exist?" be a lookup rather than a guess.
10
+ #
11
+ # Usage: cf-store-name.sh <accountId> <purpose>
12
+ # Output: stdout = the canonical <accountId>-<purpose> name (nothing else).
13
+ # Exit: 0 when both segments are valid; non-zero (fail closed) otherwise.
14
+ #
15
+ # Pure string computation: no network, no secrets, no side effects. It does NOT
16
+ # create the store or decide create-vs-reuse; that decision and its
17
+ # op=storage-provision breadcrumb live at the create call site, because this
18
+ # helper cannot know whether the store already exists.
19
+ set -u
20
+
21
+ die() { echo "[cf-store-name] error: $*" >&2; exit 1; }
22
+
23
+ account="${1:-}"; purpose="${2:-}"
24
+ [ -n "$account" ] || die "accountId required; usage: cf-store-name.sh <accountId> <purpose>"
25
+ [ -n "$purpose" ] || die "purpose required; usage: cf-store-name.sh <accountId> <purpose>"
26
+
27
+ # Lowercase each segment (D1/R2 names are lowercase), then validate. An invalid
28
+ # character is an error, not a silent fixup - a name that does not round-trip to
29
+ # what the caller asked for would defeat the "name identifies owner+purpose"
30
+ # contract.
31
+ account="$(printf '%s' "$account" | tr '[:upper:]' '[:lower:]')"
32
+ purpose="$(printf '%s' "$purpose" | tr '[:upper:]' '[:lower:]')"
33
+
34
+ case "$account" in *[!a-z0-9-]*) die "accountId '$account' has a character outside [a-z0-9-]";; esac
35
+ case "$purpose" in *[!a-z0-9-]*) die "purpose '$purpose' has a character outside [a-z0-9-]";; esac
36
+
37
+ printf '%s-%s\n' "$account" "$purpose"
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ # remediate-storage-isolation.sh — one-shot, operator-run remediation of an
3
+ # existing multi-tenant install (Task 1631). Registers every existing D1
4
+ # database and R2 bucket to its owning account, relocates the master token into
5
+ # the house-only config file, and strips every account-wide token from every
6
+ # sub-account secrets file.
7
+ #
8
+ # The mapping file is operator-authored JSON: { "<resource-name>": "<accountId>" }.
9
+ # The node core fails closed on any enumerated resource the operator did not map;
10
+ # ownership is never guessed. This wrapper is a faithful relay: it gates on the
11
+ # mapping file existing and on the node exit code, and never echoes a token.
12
+ #
13
+ # Usage: PLATFORM_ROOT=~/<brand>-code/platform \
14
+ # NEO4J_URI=... NEO4J_PASSWORD=... \
15
+ # remediate-storage-isolation.sh <mapping-file.json>
16
+ set -u
17
+
18
+ log() { echo "[remediate] $*" >&2; }
19
+ die() { log "error: $*"; exit 1; }
20
+
21
+ MAPPING="${1:-}"
22
+ [ -n "$MAPPING" ] || die "usage: remediate-storage-isolation.sh <mapping-file.json>"
23
+ [ -r "$MAPPING" ] || die "mapping file not readable: '${MAPPING}'"
24
+ [ -n "${PLATFORM_ROOT:-}" ] || die "PLATFORM_ROOT not set"
25
+
26
+ ENTRY="${PLATFORM_ROOT}/lib/storage-broker/dist/bin/remediate-run.js"
27
+ [ -f "$ENTRY" ] || die "remediation entry not built: '${ENTRY}' (run the platform build first)"
28
+
29
+ log "op=remediate mapping=$(basename "$MAPPING") start"
30
+ node "$ENTRY" "$MAPPING"
31
+ rc=$?
32
+ if [ "$rc" -ne 0 ]; then
33
+ log "op=remediate result=failed code=${rc} (no partial write on a fail-closed abort)"
34
+ exit "$rc"
35
+ fi
36
+ log "op=remediate result=ok"
@@ -51,6 +51,10 @@ SECRETS_DIR="${HOME}/<brand>-code/data/accounts/${ACCOUNT_ID}/secrets"
51
51
  chmod 600 "${SECRETS_DIR}/cloudflare.env"
52
52
  ```
53
53
 
54
+ ### Multi-tenant installs — the master lives house-only
55
+
56
+ The account-scoped storage above is correct for a single-tenant install (one Cloudflare account, one client). On a **multi-client install** (many client sub-accounts sharing one Cloudflare account, for example SiteDesk), an account-wide token in a sub-account's `cloudflare.env` lets that sub-account reach every other client's D1 and R2. There, the master lives house-only at `${PLATFORM_ROOT}/config/cloudflare-house.env` (a location no sub-account spawn sources), per-account `cloudflare.env` files carry no account-wide token, and a sub-account reaches D1/R2 only through the storage broker, which scopes every operation to the caller's account. See [`../../../../.docs/cloudflare-storage-isolation.md`](../../../../.docs/cloudflare-storage-isolation.md). The per-scope DNS/Pages/Access minting below is unchanged and remains admin-run.
57
+
54
58
  Load the master for a mint call:
55
59
 
56
60
  ```bash
@@ -6,6 +6,64 @@ Pair this with `hosting-sites.md` (how the site itself gets deployed) and `api.m
6
6
 
7
7
  ---
8
8
 
9
+ > **Multi-tenant installs.** The raw `wrangler d1` pattern below (admin holds an account-wide token and queries D1 directly) is for a single-tenant install. On a multi-client install where sub-accounts share one Cloudflare account, a sub-account never holds a Cloudflare token and never runs `wrangler` against D1 directly. It reaches D1 only through the storage broker tools (`storage-d1-list`, `storage-d1-create`, `storage-d1-query`), which scope every operation to the caller's account. See [`../../../../.docs/cloudflare-storage-isolation.md`](../../../../.docs/cloudflare-storage-isolation.md).
10
+
11
+ ## Establishing a store — naming, count, and shape
12
+
13
+ The mechanics below (token scope, `wrangler d1 create`, the `swept` cursor) govern **how** you talk to a store. This section governs **how a store is established** — how many, what it is named, what shape it takes. Skipping it is what let one account grow three tables across two databases all recording the same fact.
14
+
15
+ - **Naming — `<accountId>-<purpose>`.** Every D1 database is named `<accountId>-<purpose>`, computed with the helper, never hand-built:
16
+
17
+ ```bash
18
+ DB_NAME="$(bash bin/cf-store-name.sh "<accountId>" "<purpose>")" # e.g. acc9f2-acceptances
19
+ ```
20
+
21
+ The name then identifies the store's owner and purpose at a glance. On a single-tenant install where the account and the brand coincide, the worked `realagent-leads` example below is the same scheme with the brand standing in for `<accountId>`; on a multi-tenant install `<accountId>` is what keeps one client's store from colliding with another's.
22
+
23
+ - **One store per purpose.** A purpose gets exactly **one** database. Before `wrangler d1 create`, list what already exists (`wrangler d1 list`); if a store already serves the purpose, **reuse it** — that is the desired outcome, not a second store. A new capture *kind* within a purpose is a discriminator **column** (`doc_type`, `party`), never a new table and never a new database. A second capture kind spawning a second store is the sprawl signature this rule exists to prevent.
24
+
25
+ - **Canonical schema per purpose.** Each store-purpose has one schema, declared once and reused; a build does not reinvent the shape. The acceptance store's canonical schema is fixed below. Any new capture-purpose store follows the same "canonical schema, declared once" pattern rather than being re-derived per build.
26
+
27
+ **Store-provision breadcrumb.** When a store is created or reused, log the establishment decision so a reuse is visible and a create is attributable to a purpose that genuinely had none:
28
+
29
+ ```
30
+ op=storage-provision resource=d1 purpose=<purpose> account=<accountId> name=<canonical-name> action=create|reuse
31
+ ```
32
+
33
+ ## The canonical acceptance store
34
+
35
+ The document-acceptance store — the one the e-sign, works-agreement, and quote-signing watchers read — is a single `acceptances` table with fixed column names. One shape covers every acceptance kind, so a watcher reads one known store instead of several drifted ones:
36
+
37
+ ```sql
38
+ CREATE TABLE IF NOT EXISTS acceptances (
39
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
40
+ doc_ref TEXT NOT NULL,
41
+ doc_type TEXT NOT NULL,
42
+ party TEXT,
43
+ signer_name TEXT,
44
+ accepted_at TEXT NOT NULL DEFAULT (datetime('now')),
45
+ swept INTEGER NOT NULL DEFAULT 0
46
+ );
47
+ ```
48
+
49
+ - `doc_ref` — identifies the job or document the acceptance is against.
50
+ - `doc_type` — the acceptance kind (`works-agreement`, `single-signer-quote`, `dual-signer-quote`); this is the discriminator, so a new kind is a value here, not a new table.
51
+ - `party` — which signer, for a two-signer document; `NULL` for a single-signer one. This column is what a separate `dual_acceptances` table would otherwise duplicate.
52
+ - `signer_name` — the signer's identity. The column is named `signer_name`, never a bare `name`.
53
+ - `accepted_at` — when the document was accepted.
54
+ - `swept` — the read cursor, exactly as in `leads` below: `0` until the agent has ingested the row, then `1`.
55
+
56
+ Confirm a live store follows canon with the exit-code gate. Read the stored DDL with `--json` (as the sweep `SELECT` below does) and extract the `sql` values with `jq -r`, so the validator receives newline-delimited `CREATE` statements rather than `wrangler`'s bordered table output:
57
+
58
+ ```bash
59
+ CLOUDFLARE_API_TOKEN="${PAGES_D1}" wrangler d1 execute "<db-name>" --remote --json --command \
60
+ "SELECT sql FROM sqlite_master WHERE sql IS NOT NULL;" \
61
+ | jq -r '.[0].results[].sql' | bash bin/cf-schema-check.sh
62
+ # exit 0 = follows canon; exit 1 = the drift is named on stderr.
63
+ ```
64
+
65
+ ---
66
+
9
67
  ## The single most common breakage — token scope
10
68
 
11
69
  A Pages-only token **cannot touch D1**. The deploy succeeds, the form renders, and every submission silently 500s at the D1 insert. The token used for D1-backed Pages work must carry **both**: