@rubytech/create-maxy-code 0.1.472 → 0.1.474

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 (142) hide show
  1. package/dist/__tests__/google-client-id-env.test.js +15 -12
  2. package/dist/index.js +6 -29
  3. package/dist/port-resolution.js +5 -5
  4. package/package.json +1 -1
  5. package/payload/platform/config/brand.json +1 -0
  6. package/payload/platform/docs/superpowers/plans/2026-07-18-ledger-write-path-fix.md +109 -0
  7. package/payload/platform/lib/ledger-core/dist/reconcile.d.ts +7 -0
  8. package/payload/platform/lib/ledger-core/dist/reconcile.d.ts.map +1 -1
  9. package/payload/platform/lib/ledger-core/dist/reconcile.js +5 -2
  10. package/payload/platform/lib/ledger-core/dist/reconcile.js.map +1 -1
  11. package/payload/platform/lib/ledger-core/src/__tests__/reconcile.test.ts +20 -0
  12. package/payload/platform/lib/ledger-core/src/reconcile.ts +12 -2
  13. package/payload/platform/neo4j/schema.cypher +4 -1
  14. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +37 -14
  15. package/payload/platform/plugins/docs/references/admin-ui.md +1 -1
  16. package/payload/platform/plugins/docs/references/google-guide.md +20 -9
  17. package/payload/platform/plugins/docs/references/ledger.md +9 -1
  18. package/payload/platform/plugins/docs/references/troubleshooting.md +4 -0
  19. package/payload/platform/plugins/docs/references/voice-mirror-guide.md +2 -2
  20. package/payload/platform/plugins/google/.claude-plugin/plugin.json +1 -1
  21. package/payload/platform/plugins/google/PLUGIN.md +28 -14
  22. package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.js +79 -28
  23. package/payload/platform/plugins/google/mcp/dist/__tests__/account-register.test.js.map +1 -1
  24. package/payload/platform/plugins/google/mcp/dist/__tests__/boot.test.d.ts +2 -0
  25. package/payload/platform/plugins/google/mcp/dist/__tests__/boot.test.d.ts.map +1 -0
  26. package/payload/platform/plugins/google/mcp/dist/__tests__/boot.test.js +54 -0
  27. package/payload/platform/plugins/google/mcp/dist/__tests__/boot.test.js.map +1 -0
  28. package/payload/platform/plugins/google/mcp/dist/__tests__/google-client.test.js +26 -1
  29. package/payload/platform/plugins/google/mcp/dist/__tests__/google-client.test.js.map +1 -1
  30. package/payload/platform/plugins/google/mcp/dist/__tests__/index-registration.test.js +3 -2
  31. package/payload/platform/plugins/google/mcp/dist/__tests__/index-registration.test.js.map +1 -1
  32. package/payload/platform/plugins/google/mcp/dist/index.d.ts +9 -5
  33. package/payload/platform/plugins/google/mcp/dist/index.d.ts.map +1 -1
  34. package/payload/platform/plugins/google/mcp/dist/index.js +38 -37
  35. package/payload/platform/plugins/google/mcp/dist/index.js.map +1 -1
  36. package/payload/platform/plugins/google/mcp/dist/lib/google-client.d.ts +10 -7
  37. package/payload/platform/plugins/google/mcp/dist/lib/google-client.d.ts.map +1 -1
  38. package/payload/platform/plugins/google/mcp/dist/lib/google-client.js +25 -13
  39. package/payload/platform/plugins/google/mcp/dist/lib/google-client.js.map +1 -1
  40. package/payload/platform/plugins/google/mcp/dist/tools/account-register.d.ts +58 -17
  41. package/payload/platform/plugins/google/mcp/dist/tools/account-register.d.ts.map +1 -1
  42. package/payload/platform/plugins/google/mcp/dist/tools/account-register.js +143 -37
  43. package/payload/platform/plugins/google/mcp/dist/tools/account-register.js.map +1 -1
  44. package/payload/platform/plugins/google/references/auth.md +264 -362
  45. package/payload/platform/plugins/ledger/PLUGIN.md +13 -1
  46. package/payload/platform/plugins/ledger/mcp/dist/index.js +23 -15
  47. package/payload/platform/plugins/ledger/mcp/dist/index.js.map +1 -1
  48. package/payload/platform/plugins/ledger/mcp/dist/lib/read.d.ts +11 -1
  49. package/payload/platform/plugins/ledger/mcp/dist/lib/read.d.ts.map +1 -1
  50. package/payload/platform/plugins/ledger/mcp/dist/lib/read.js +20 -1
  51. package/payload/platform/plugins/ledger/mcp/dist/lib/read.js.map +1 -1
  52. package/payload/platform/plugins/ledger/mcp/dist/lib/types.d.ts +14 -11
  53. package/payload/platform/plugins/ledger/mcp/dist/lib/types.d.ts.map +1 -1
  54. package/payload/platform/plugins/ledger/mcp/dist/lib/types.js.map +1 -1
  55. package/payload/platform/plugins/ledger/mcp/dist/lib/write-rejects.d.ts +12 -0
  56. package/payload/platform/plugins/ledger/mcp/dist/lib/write-rejects.d.ts.map +1 -0
  57. package/payload/platform/plugins/ledger/mcp/dist/lib/write-rejects.js +50 -0
  58. package/payload/platform/plugins/ledger/mcp/dist/lib/write-rejects.js.map +1 -0
  59. package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.d.ts +5 -5
  60. package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.d.ts.map +1 -1
  61. package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.js +11 -11
  62. package/payload/platform/plugins/ledger/mcp/dist/tools/cash-record.js.map +1 -1
  63. package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.d.ts +7 -2
  64. package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.d.ts.map +1 -1
  65. package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.js +9 -3
  66. package/payload/platform/plugins/ledger/mcp/dist/tools/invoice-record.js.map +1 -1
  67. package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.d.ts +7 -0
  68. package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.d.ts.map +1 -1
  69. package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.js +3 -4
  70. package/payload/platform/plugins/ledger/mcp/dist/tools/payment-record.js.map +1 -1
  71. package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.d.ts +1 -1
  72. package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.d.ts.map +1 -1
  73. package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.js +4 -1
  74. package/payload/platform/plugins/ledger/mcp/dist/tools/reconcile.js.map +1 -1
  75. package/payload/platform/plugins/voice-mirror/PLUGIN.md +1 -1
  76. package/payload/platform/plugins/voice-mirror/mcp/dist/index.js +3 -3
  77. package/payload/platform/plugins/voice-mirror/mcp/dist/index.js.map +1 -1
  78. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/voice-corpus.d.ts +14 -1
  79. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/voice-corpus.d.ts.map +1 -1
  80. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/voice-corpus.js +15 -0
  81. package/payload/platform/plugins/voice-mirror/mcp/dist/lib/voice-corpus.js.map +1 -1
  82. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.d.ts.map +1 -1
  83. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.js +3 -1
  84. package/payload/platform/plugins/voice-mirror/mcp/dist/tools/voice-distil-profile.js.map +1 -1
  85. package/payload/platform/plugins/voice-mirror/mcp/scripts/smoke.mjs +51 -4
  86. package/payload/platform/plugins/voice-mirror/skills/voice-mirror/SKILL.md +4 -0
  87. package/payload/platform/scripts/backfill-task-ids.sh +206 -0
  88. package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts +27 -2
  89. package/payload/platform/services/claude-session-manager/dist/activity-rows.d.ts.map +1 -1
  90. package/payload/platform/services/claude-session-manager/dist/activity-rows.js +33 -2
  91. package/payload/platform/services/claude-session-manager/dist/activity-rows.js.map +1 -1
  92. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.d.ts.map +1 -1
  93. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js +1 -0
  94. package/payload/platform/services/claude-session-manager/dist/canonical-tool-names.generated.js.map +1 -1
  95. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  96. package/payload/platform/services/claude-session-manager/dist/http-server.js +3 -0
  97. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  98. package/payload/platform/templates/specialists/agents/personal-assistant.md +1 -1
  99. package/payload/server/{chunk-BSTIQX52.js → chunk-Y6V45R6M.js} +1 -12
  100. package/payload/server/maxy-edge.js +1 -1
  101. package/payload/server/public/activity.html +6 -6
  102. package/payload/server/public/assets/{AdminLoginScreens-BfamGqS7.js → AdminLoginScreens-B44KbEuC.js} +1 -1
  103. package/payload/server/public/assets/{AdminShell-5nHOAzXO.js → AdminShell-BjxV2qkb.js} +2 -2
  104. package/payload/server/public/assets/{Checkbox-CD6aHwac.js → Checkbox-DSeZNGNA.js} +1 -1
  105. package/payload/server/public/assets/activity-CdipMTDp.js +1 -0
  106. package/payload/server/public/assets/{admin-Cpcw_YE-.js → admin-B4LpTCur.js} +1 -1
  107. package/payload/server/public/assets/{browser-0znOwk1W.js → browser-CEFvaWwI.js} +1 -1
  108. package/payload/server/public/assets/{calendar-CykigHdg.js → calendar-B3zo6V34.js} +1 -1
  109. package/payload/server/public/assets/chat-5tJdo9i_.js +1 -0
  110. package/payload/server/public/assets/chevron-left-BJllrPBj.js +1 -0
  111. package/payload/server/public/assets/data-Du79EgR-.js +1 -0
  112. package/payload/server/public/assets/{graph-JV5_xF3V.js → graph-RaOrnSf2.js} +1 -1
  113. package/payload/server/public/assets/{graph-labels-DPYORjBH.js → graph-labels-GlTEIYJj.js} +1 -1
  114. package/payload/server/public/assets/{maximize-2-8vKr3h21.js → maximize-2-CHDa8p5h.js} +1 -1
  115. package/payload/server/public/assets/{operator-Liul1QEq.js → operator-DtqHY4jV.js} +1 -1
  116. package/payload/server/public/assets/{page-CYRA87CB.js → page-CkhFj8GQ.js} +1 -1
  117. package/payload/server/public/assets/{page-Cg7B1RQx.js → page-DxnWgPtd.js} +1 -1
  118. package/payload/server/public/assets/{public-B4HMtpjt.js → public-D5TUfQ3I.js} +1 -1
  119. package/payload/server/public/assets/{rotate-ccw-sz5IQSnr.js → rotate-ccw-BJjVAQQY.js} +1 -1
  120. package/payload/server/public/assets/tasks-CM9pYYG1.js +1 -0
  121. package/payload/server/public/assets/{time-entry-format-CSuCexpM.js → time-entry-format-C5RYEYjM.js} +1 -1
  122. package/payload/server/public/assets/{triangle-alert-ClS81-CU.js → triangle-alert-DLfIsuo_.js} +1 -1
  123. package/payload/server/public/assets/{useCopyFeedback-Cn6YgeNx.js → useCopyFeedback-7yKeiAzV.js} +1 -1
  124. package/payload/server/public/assets/{useSelectionMode-BaD-ZZRk.js → useSelectionMode-CWlh6AEq.js} +1 -1
  125. package/payload/server/public/assets/{useSubAccountSwitcher-CNZL3PKn.css → useSubAccountSwitcher-B2n9QPVI.css} +1 -1
  126. package/payload/server/public/assets/{useVoiceRecorder-BOzHrDAU.js → useVoiceRecorder-j3ZArZ2H.js} +1 -1
  127. package/payload/server/public/browser.html +5 -5
  128. package/payload/server/public/calendar.html +6 -6
  129. package/payload/server/public/chat.html +12 -12
  130. package/payload/server/public/data.html +11 -11
  131. package/payload/server/public/graph.html +11 -11
  132. package/payload/server/public/index.html +14 -14
  133. package/payload/server/public/operator.html +14 -14
  134. package/payload/server/public/public.html +12 -12
  135. package/payload/server/public/tasks.html +5 -5
  136. package/payload/server/server.js +1837 -1695
  137. package/payload/server/public/assets/activity-Dj2nJzPw.js +0 -1
  138. package/payload/server/public/assets/chat-DIOJZ411.js +0 -1
  139. package/payload/server/public/assets/chevron-left-Cq7UvOI0.js +0 -1
  140. package/payload/server/public/assets/data-lHgqlhmu.js +0 -1
  141. package/payload/server/public/assets/tasks-D9oYgEzs.js +0 -1
  142. /package/payload/server/public/assets/{useSubAccountSwitcher-CvjWJSGv.js → useSubAccountSwitcher-CBlKgwms.js} +0 -0
@@ -1,5 +1,6 @@
1
- // acceptance gate for GOOGLE_CLIENT_ID / GOOGLE_PUBLIC_BASE stamping in the
2
- // claude-session-manager systemd unit (Task 1761).
1
+ // acceptance gate for GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET stamping in the
2
+ // claude-session-manager systemd unit (Task 1761; Task 1791 replaced
3
+ // GOOGLE_PUBLIC_BASE with GOOGLE_CLIENT_SECRET and asserts the former is gone).
3
4
  //
4
5
  // This test exists because the first fix stamped only the darwin `.env` mirror
5
6
  // and missed this Linux unit, so on the actual (Ubuntu) install the google
@@ -20,7 +21,7 @@ import assert from "node:assert/strict";
20
21
  import { buildClaudeSessionManagerUnitFile } from "../port-resolution.js";
21
22
  const ACCOUNT_ID = "12345678-9abc-def0-1234-56789abcdef0";
22
23
  const GOOGLE_ID = "1032860640027-p61l59fnog4mad5o7grginpaps9jnu8c.apps.googleusercontent.com";
23
- const PUBLIC_BASE = "https://public.sitedesk.online";
24
+ const SECRET = "GOCSPX-test-value-not-real";
24
25
  const OUTLOOK_ID = "0fa68fe2-8bec-4007-a0c7-776636fbcf97";
25
26
  function build(opts) {
26
27
  return buildClaudeSessionManagerUnitFile({
@@ -36,20 +37,22 @@ function build(opts) {
36
37
  ...opts,
37
38
  });
38
39
  }
39
- test("both values present stamps both Environment lines", () => {
40
- const unit = build({ googleClientId: GOOGLE_ID, googlePublicBase: PUBLIC_BASE });
40
+ test("id and secret present stamps both Environment lines", () => {
41
+ const unit = build({ googleClientId: GOOGLE_ID, googleClientSecret: SECRET });
41
42
  assert.ok(unit.includes(`Environment=GOOGLE_CLIENT_ID=${GOOGLE_ID}`));
42
- assert.ok(unit.includes(`Environment=GOOGLE_PUBLIC_BASE=${PUBLIC_BASE}`));
43
+ assert.ok(unit.includes(`Environment=GOOGLE_CLIENT_SECRET=${SECRET}`));
44
+ // The hosted callback is withdrawn (Task 1791); nothing consumes a public base.
45
+ assert.ok(!unit.includes("GOOGLE_PUBLIC_BASE"));
43
46
  });
44
- test("a client id with no public base stamps NEITHER line", () => {
47
+ test("a client id with no secret stamps NEITHER line", () => {
45
48
  const unit = build({ googleClientId: GOOGLE_ID });
46
49
  assert.ok(!unit.includes("GOOGLE_CLIENT_ID"), "a half-stamp must not ship");
47
- assert.ok(!unit.includes("GOOGLE_PUBLIC_BASE"));
50
+ assert.ok(!unit.includes("GOOGLE_CLIENT_SECRET"));
48
51
  });
49
- test("a public base with no client id stamps NEITHER line", () => {
50
- const unit = build({ googlePublicBase: PUBLIC_BASE });
52
+ test("a secret with no client id stamps NEITHER line", () => {
53
+ const unit = build({ googleClientSecret: SECRET });
51
54
  assert.ok(!unit.includes("GOOGLE_CLIENT_ID"));
52
- assert.ok(!unit.includes("GOOGLE_PUBLIC_BASE"));
55
+ assert.ok(!unit.includes("GOOGLE_CLIENT_SECRET"));
53
56
  });
54
57
  test("a brand shipping no google app stamps neither line", () => {
55
58
  const unit = build({});
@@ -59,7 +62,7 @@ test("a brand shipping no google app stamps neither line", () => {
59
62
  test("google stamping leaves the outlook pair intact", () => {
60
63
  const unit = build({
61
64
  googleClientId: GOOGLE_ID,
62
- googlePublicBase: PUBLIC_BASE,
65
+ googleClientSecret: SECRET,
63
66
  outlookClientId: OUTLOOK_ID,
64
67
  });
65
68
  assert.ok(unit.includes(`Environment=OUTLOOK_CLIENT_ID=${OUTLOOK_ID}`));
package/dist/index.js CHANGED
@@ -51,26 +51,6 @@ catch (err) {
51
51
  }
52
52
  const INSTALL_DIR = resolve(process.env.HOME ?? "/root", BRAND.installDir);
53
53
  const PERSIST_DIR = resolve(process.env.HOME ?? "/root", BRAND.configDir);
54
- // Task 1761 — GOOGLE_PUBLIC_BASE is the https origin Google redirects back to
55
- // after consent. It is a property of THIS INSTALL's tunnel, not of the brand,
56
- // so it is read from the same cloudflared/tunnel.state the uninstaller reads.
57
- // Defined once here because BOTH env paths need it: the darwin .env mirror and
58
- // the Linux systemd unit. Absent tunnel → unset, and google-account-register
59
- // refuses with an actionable message rather than minting a consent URL whose
60
- // redirect_uri Google will reject on its byte-for-byte comparison.
61
- const googlePublicBase = (() => {
62
- try {
63
- const tunnelState = join(PERSIST_DIR, "cloudflared/tunnel.state");
64
- if (!existsSync(tunnelState))
65
- return "";
66
- const parsed = JSON.parse(readFileSync(tunnelState, "utf-8"));
67
- return parsed.domain ? `https://public.${parsed.domain}` : "";
68
- }
69
- catch {
70
- // Unreadable tunnel state is not fatal to the install; the value stays unset.
71
- return "";
72
- }
73
- })();
74
54
  const LOG_DIR = join(PERSIST_DIR, "logs");
75
55
  const LOG_FILE = join(LOG_DIR, `install-${new Date().toISOString().replace(/[:.]/g, "-")}.log`);
76
56
  // every `claude plugin` shellout must read/write the per-brand
@@ -3741,13 +3721,10 @@ function installServiceDarwin() {
3741
3721
  }
3742
3722
  logFile(` [installer] op=outlook-client-id brand=${BRAND.hostname} stamped=${BRAND.outlookClientId ? "true" : "false"}`);
3743
3723
  // Task 1761 — same upsert/strip discipline for the Google vendor app.
3744
- // GOOGLE_PUBLIC_BASE is the https origin the consent redirect returns to;
3745
- // it must match the authorized redirect URI on the vendor app byte-for-byte,
3746
- // so it is derived from the brand's public host, not guessed at call time.
3747
- if (BRAND.googleClientId) {
3724
+ if (BRAND.googleClientId && BRAND.googleClientSecret) {
3748
3725
  for (const [key, value] of [
3749
3726
  ["GOOGLE_CLIENT_ID", BRAND.googleClientId],
3750
- ["GOOGLE_PUBLIC_BASE", googlePublicBase],
3727
+ ["GOOGLE_CLIENT_SECRET", BRAND.googleClientSecret],
3751
3728
  ]) {
3752
3729
  const re = new RegExp(`^${key}=.*$`, "m");
3753
3730
  if (re.test(envContent))
@@ -3757,11 +3734,11 @@ function installServiceDarwin() {
3757
3734
  }
3758
3735
  }
3759
3736
  else {
3760
- for (const key of ["GOOGLE_CLIENT_ID", "GOOGLE_PUBLIC_BASE"]) {
3737
+ for (const key of ["GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET"]) {
3761
3738
  envContent = envContent.replace(new RegExp(`^${key}=.*\\n?`, "m"), "");
3762
3739
  }
3763
3740
  }
3764
- logFile(` [installer] op=google-client-id brand=${BRAND.hostname} stamped=${BRAND.googleClientId ? "true" : "false"} publicBase=${googlePublicBase || "unset"}`);
3741
+ logFile(` [installer] op=google-client-id brand=${BRAND.hostname} stamped=${BRAND.googleClientId && BRAND.googleClientSecret ? "true" : "false"} clientId=${BRAND.googleClientId ? "set" : "unset"} secret=${BRAND.googleClientSecret ? "set" : "unset"}`);
3765
3742
  writeFileSync(envPath, envContent);
3766
3743
  logFile(` .env: DISPLAY_MODE=${DISPLAY_MODE}, EMBED_MODEL=${EMBED_MODEL}, EMBED_DIMENSIONS=${EMBED_DIMS}, NEO4J_URI=bolt://localhost:${NEO4J_PORT}, PORT=${PORT}, MAXY_UI_INTERNAL_PORT=${PORT} (darwin-collapsed), CLAUDE_SESSION_MANAGER_PORT=${BRAND.claudeSessionManagerPort}, HOSTNAME=0.0.0.0, ACCOUNT_ID=${installAccountId.slice(0, 8)}…, CLAUDE_CONFIG_DIR=${persistDir}/.claude, CLAUDE_BIN=${canonicalClaude ?? "unresolved(PATH)"}, NODE_BIN=${nodeBin}, PATH=${darwinServiceEnvPath}`);
3767
3744
  }
@@ -4386,7 +4363,7 @@ function installService() {
4386
4363
  cdpPort: CDP_PORT_BRAND,
4387
4364
  outlookClientId: BRAND.outlookClientId,
4388
4365
  googleClientId: BRAND.googleClientId,
4389
- googlePublicBase: googlePublicBase || undefined,
4366
+ googleClientSecret: BRAND.googleClientSecret,
4390
4367
  });
4391
4368
  writeFileSync(join(serviceDir, claudeSessionManagerUnitName), claudeSessionManagerUnit);
4392
4369
  logFile(` ${claudeSessionManagerUnitName}: CLAUDE_SESSION_MANAGER_PORT=${CLAUDE_SESSION_MANAGER_PORT_BRAND} MAXY_UI_INTERNAL_PORT=${MAXY_UI_INTERNAL_PORT}`);
@@ -4397,7 +4374,7 @@ function installService() {
4397
4374
  // Task 1761 — the same standing signal for the Google vendor app. Both parts
4398
4375
  // are reported because a client id without a public base stamps NEITHER: a
4399
4376
  // consent URL built without the redirect origin is one Google rejects.
4400
- logFile(` [installer] op=google-client-id brand=${BRAND.hostname} stamped=${BRAND.googleClientId && googlePublicBase ? "true" : "false"} clientId=${BRAND.googleClientId ? "set" : "unset"} publicBase=${googlePublicBase || "unset"}`);
4377
+ logFile(` [installer] op=google-client-id brand=${BRAND.hostname} stamped=${BRAND.googleClientId && BRAND.googleClientSecret ? "true" : "false"} clientId=${BRAND.googleClientId ? "set" : "unset"} secret=${BRAND.googleClientSecret ? "set" : "unset"}`);
4401
4378
  // Task 250 — write the brand-agnostic `claude-ptys.slice` unit. Every
4402
4379
  // brand's session manager drops its per-spawn scope units under this
4403
4380
  // slice. Writing it once per install is idempotent (the content is
@@ -135,11 +135,11 @@ export function buildClaudeSessionManagerUnitFile(o) {
135
135
  const outlookEnv = o.outlookClientId
136
136
  ? `\nEnvironment=OUTLOOK_CLIENT_ID=${o.outlookClientId}\nEnvironment=OUTLOOK_TENANT_ID=common`
137
137
  : "";
138
- // Task 1761same contract for the Google vendor app. The client id and the
139
- // install's public base land together: a client id without a redirect origin
140
- // produces a consent URL Google rejects, so a half-stamp is worse than none.
141
- const googleEnv = o.googleClientId && o.googlePublicBase
142
- ? `\nEnvironment=GOOGLE_CLIENT_ID=${o.googleClientId}\nEnvironment=GOOGLE_PUBLIC_BASE=${o.googlePublicBase}`
138
+ // Task 1791id and secret land together. A client id without its secret
139
+ // produces a consent URL the user can complete but an exchange that cannot,
140
+ // which fails later and less legibly than not offering the flow at all.
141
+ const googleEnv = o.googleClientId && o.googleClientSecret
142
+ ? `\nEnvironment=GOOGLE_CLIENT_ID=${o.googleClientId}\nEnvironment=GOOGLE_CLIENT_SECRET=${o.googleClientSecret}`
143
143
  : "";
144
144
  return `[Unit]
145
145
  Description=${o.productName} Claude Session Manager
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy-code",
3
- "version": "0.1.472",
3
+ "version": "0.1.474",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy-code": "./dist/index.js"
@@ -16,6 +16,7 @@
16
16
  "claudeSessionManagerPort": 19400,
17
17
  "outlookClientId": "",
18
18
  "googleClientId": "",
19
+ "googleClientSecret": "",
19
20
  "commercialMode": false,
20
21
  "vertical": "schema-knowledge-work",
21
22
  "shipsPremiumBundles": ["venture-studio", "writer-craft", "teaching", "management-consulting"],
@@ -0,0 +1,109 @@
1
+ # Ledger write path fix — implementation plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax.
4
+
5
+ **Goal:** Every ledger write tool successfully creates its node, because relationships carry the element id `writeNodeWithEdges` actually requires.
6
+
7
+ **Architecture:** Delete the ledger's invented `GraphRelationship` and the cast that forced it past the type checker; import the real type so the shape becomes a compile-time constraint. Resolve each relationship target to an element id before writing. Add a census counter so a dead write path can no longer read as a healthy empty ledger.
8
+
9
+ **Spec:** [`.tasks/1788-...md`](../../../../.tasks/1788-ledger-write-tools-pass-an-invented-relationship-shape-so-every-write-is-rejected.md). No separate design doc; the task carries the decisions.
10
+
11
+ ## Global constraints
12
+
13
+ - Node 22. Never `npm install` in this worktree; deps are symlinked from the parent.
14
+ - Build and test from `maxy-code/platform`.
15
+ - The four write tools must not be tested with a stubbed `write`. That stub is why the bug shipped.
16
+ - Do not touch `lib/ledger-core`'s arithmetic (money, balance, ageing) — only `reconcile.ts` gains a counter.
17
+ - Baseline before changes: 56 ledger tests, 508 memory-plugin tests.
18
+
19
+ ---
20
+
21
+ ### Task 1: Make the wrong shape a compile error
22
+
23
+ **Files:** `plugins/ledger/mcp/src/lib/types.ts`, `plugins/ledger/mcp/src/index.ts`
24
+
25
+ **Produces:** the real `GraphRelationship { type, direction, targetNodeId }` in scope for every tool.
26
+
27
+ - [ ] **Step 1: Prove the current code is wrong at the type level.** In `types.ts`, delete the local `GraphRelationship` and re-export the real one:
28
+
29
+ ```ts
30
+ export type { GraphRelationship } from "../../../../../lib/graph-write/dist/index.js";
31
+ ```
32
+
33
+ - [ ] **Step 2: Delete the cast in `index.ts`.** Replace the `writeNodeWithEdges as unknown as (...)` wrapper with a direct reference. Run `tsc -p plugins/ledger/mcp/tsconfig.json` and record every error. Expect failures in `invoice-record.ts`, `payment-record.ts`, `cash-record.ts` on `targetLabel`/`targetProps`. **Those errors are the bug** — they are what the cast was hiding.
34
+
35
+ - [ ] **Step 3: Fix the attribution while here.** `createdBy` becomes `{ agent: agentSlug, session: sessionId, tool, source: "ledger" }` with no `?? ""`, so `graph-write:254`'s `agent ?? source ?? "unknown"` chain can work.
36
+
37
+ - [ ] **Step 4: Commit** once the remaining errors are only the three tool files.
38
+
39
+ ---
40
+
41
+ ### Task 2: Resolve targets to element ids
42
+
43
+ **Files:** `plugins/ledger/mcp/src/lib/read.ts`, `tools/{invoice-record,payment-record,cash-record}.ts`, `index.ts`, `PLUGIN.md`
44
+
45
+ **Consumes:** the real type from Task 1.
46
+
47
+ - [ ] **Step 1: `readInvoice` returns the node's id.** Add `nodeId: string` to `InvoiceRead`; add `elementId(i) AS nodeId` to the Cypher and map it.
48
+
49
+ - [ ] **Step 2: Write the failing tests first.** For each of the three tools, assert the relationship carries a `targetNodeId` equal to the id supplied or resolved, and that no relationship carries `targetLabel`:
50
+
51
+ ```ts
52
+ it('targets the counterparty by element id', async () => {
53
+ const write = okWrite()
54
+ await invoiceRecord({ ...base, counterpartyNodeId: '4:abc:12', session: {} as never, write })
55
+ const rel = write.mock.calls[0]![0].relationships[0]
56
+ expect(rel.targetNodeId).toBe('4:abc:12')
57
+ expect(rel).not.toHaveProperty('targetLabel')
58
+ })
59
+ ```
60
+
61
+ - [ ] **Step 3: Implement.** `invoice-record` and `cash-record` take a required `counterpartyNodeId`. `payment-record` and `credit-record` use `invoice.nodeId` from the read. Each `zod` schema gains the field with a description telling the agent to look the organisation up first.
62
+
63
+ - [ ] **Step 4: Reject a blank id** before writing, with `op=reject reason=missing-counterparty`, so the failure names the cause rather than surfacing as `unresolved-target`.
64
+
65
+ - [ ] **Step 5: `tsc` clean, ledger tests green, commit.**
66
+
67
+ ---
68
+
69
+ ### Task 3: The test that would have caught it
70
+
71
+ **Files:** `plugins/ledger/mcp/src/tools/__tests__/write-contract.test.ts` (new)
72
+
73
+ One integration test per write tool that calls the **real** `writeNodeWithEdges` against a fake `Session` (`run` + `close`), asserting the issued Cypher carries the resolved target id and that no `unresolved-target` rejection occurs.
74
+
75
+ - [ ] **Step 1: Write it against the current code and watch it fail** if Tasks 1 and 2 were somehow incomplete.
76
+ - [ ] **Step 2: Confirm it passes.**
77
+ - [ ] **Step 3: Prove it is load-bearing.** Temporarily reintroduce `targetLabel` in one tool; the build must fail. Revert.
78
+ - [ ] **Step 4: Commit.**
79
+
80
+ ---
81
+
82
+ ### Task 4: Make a dead write path visible
83
+
84
+ **Files:** `lib/ledger-core/src/reconcile.ts`, `plugins/ledger/mcp/src/lib/read.ts`, `tools/reconcile.ts`, `ui/app/lib/ledger-census.ts`, tests
85
+
86
+ `[ledger-census]` currently prints `invoices=0 payments=0` identically whether the ledger is healthy-and-empty or wholly broken. That is why this bug ran all day unseen.
87
+
88
+ - [ ] **Step 1: Failing test.** `reconcileLedger` alarms when `writeRejects24h > 0`.
89
+ - [ ] **Step 2: Implement.** Add `writeRejects24h` to `LedgerCensusRows`, `LedgerCensusFinding`, the alarm condition, and `formatCensusLine`.
90
+ - [ ] **Step 3: Source the count.** Both the census and the reconcile tool count `[graph-write] reject` lines in `<LOG_DIR>/mcp-ledger-*.log` with a timestamp inside the trailing 24 hours.
91
+ - [ ] **Step 4: Tests green, commit.**
92
+
93
+ ---
94
+
95
+ ### Task 5: Docs
96
+
97
+ **Files:** `plugins/ledger/PLUGIN.md`, `plugins/docs/references/ledger.md`
98
+
99
+ State that the counterparty must be looked up first and passed by id, that the ledger never creates organisations, and what `writeRejects24h` means. Keep the shipped reference free of em-dashes.
100
+
101
+ - [ ] Commit.
102
+
103
+ ---
104
+
105
+ ## Self-review
106
+
107
+ **Spec coverage.** Type import and cast removal: Task 1. Attribution: Task 1 step 3. Element-id resolution for all four write tools: Task 2. The banned-stub integration test: Task 3. Census counter: Task 4. Docs: Task 5. Out-of-scope items (duplicate-org matching, `:InvoiceLine`, read tools, ledger-core arithmetic) are untouched.
108
+
109
+ **Risk.** Task 2 changes the tool signatures, so any agent prompt or skill that calls `ledger-invoice-record` with a bare counterparty name breaks. Nothing calls these tools yet except live agent turns, and they have never succeeded, so there is no working caller to regress.
@@ -31,6 +31,12 @@ export interface LedgerCensusRows {
31
31
  storedBalanceProps: number;
32
32
  paymentKeys: readonly PaymentKey[];
33
33
  declaredNotLive: readonly string[];
34
+ /** Count of `[graph-write] reject` lines from the ledger's MCP logs in the
35
+ * trailing 24 hours. Without it the census cannot tell a healthy empty
36
+ * ledger from one whose write path is wholly dead: both print
37
+ * `invoices=0 payments=0`. Task 1788, after exactly that went unseen for a
38
+ * day. */
39
+ writeRejects24h: number;
34
40
  }
35
41
  export interface LedgerCensusFinding {
36
42
  invoices: number;
@@ -39,6 +45,7 @@ export interface LedgerCensusFinding {
39
45
  storedBalanceProps: number;
40
46
  suspectDuplicates: number;
41
47
  declaredNotLive: readonly string[];
48
+ writeRejects24h: number;
42
49
  alarm: boolean;
43
50
  }
44
51
  export declare function reconcileLedger(rows: LedgerCensusRows, _now: number): LedgerCensusFinding;
@@ -1 +1 @@
1
- {"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../src/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;mEAImE;AACnE,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAO/C,CAAA;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;IAClC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,kBAAkB,EAAE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AI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAmBzF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAQ/D"}
@@ -52,7 +52,8 @@ export function reconcileLedger(rows, _now) {
52
52
  const alarm = rows.orphanPayments > 0 ||
53
53
  rows.storedBalanceProps > 0 ||
54
54
  suspectDuplicates > 0 ||
55
- rows.declaredNotLive.length > 0;
55
+ rows.declaredNotLive.length > 0 ||
56
+ rows.writeRejects24h > 0;
56
57
  return {
57
58
  invoices: rows.invoices,
58
59
  payments: rows.payments,
@@ -60,6 +61,7 @@ export function reconcileLedger(rows, _now) {
60
61
  storedBalanceProps: rows.storedBalanceProps,
61
62
  suspectDuplicates,
62
63
  declaredNotLive: rows.declaredNotLive,
64
+ writeRejects24h: rows.writeRejects24h,
63
65
  alarm,
64
66
  };
65
67
  }
@@ -72,6 +74,7 @@ export function formatCensusLine(f) {
72
74
  return (`[ledger-census] invoices=${f.invoices} payments=${f.payments} ` +
73
75
  `orphanPayments=${f.orphanPayments} storedBalanceProps=${f.storedBalanceProps} ` +
74
76
  `suspectDuplicates=${f.suspectDuplicates} ` +
75
- `declaredNotLive=${f.declaredNotLive.length === 0 ? "none" : f.declaredNotLive.join(",")}`);
77
+ `declaredNotLive=${f.declaredNotLive.length === 0 ? "none" : f.declaredNotLive.join(",")} ` +
78
+ `writeRejects24h=${f.writeRejects24h}`);
76
79
  }
77
80
  //# sourceMappingURL=reconcile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reconcile.js","sourceRoot":"","sources":["../src/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;mEAImE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,qCAAqC;IACrC,mCAAmC;IACnC,oBAAoB;IACpB,sBAAsB;IACtB,yBAAyB;IACzB,gBAAgB;CACjB,CAAA;AA4BD;;;;;;;;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const clean = {
8
8
  storedBalanceProps: 0,
9
9
  paymentKeys: [],
10
10
  declaredNotLive: [],
11
+ writeRejects24h: 0,
11
12
  }
12
13
  const NOW = Date.parse('2026-07-18T00:00:00Z')
13
14
 
@@ -84,4 +85,23 @@ describe('reconcileLedger', () => {
84
85
  expect(LEDGER_INDEX_NAMES).toHaveLength(6)
85
86
  expect(LEDGER_INDEX_NAMES).toContain('cash_entry_account_entryid_unique')
86
87
  })
88
+
89
+ it('alarms when the write path is rejecting', () => {
90
+ // The case this counter exists for: on 2026-07-18 every ledger write was
91
+ // rejected all day while the census printed invoices=0 payments=0, which
92
+ // is byte-identical to a healthy ledger nobody has used yet.
93
+ const f = reconcileLedger({ ...clean, writeRejects24h: 4 }, NOW)
94
+ expect(f.alarm).toBe(true)
95
+ expect(formatCensusLine(f)).toContain('writeRejects24h=4')
96
+ })
97
+
98
+ it('a healthy empty ledger is distinguishable from a broken one', () => {
99
+ const empty = { ...clean, invoices: 0, payments: 0 }
100
+ const broken = { ...empty, writeRejects24h: 4 }
101
+ expect(formatCensusLine(reconcileLedger(empty, NOW))).not.toEqual(
102
+ formatCensusLine(reconcileLedger(broken, NOW)),
103
+ )
104
+ expect(reconcileLedger(empty, NOW).alarm).toBe(false)
105
+ expect(reconcileLedger(broken, NOW).alarm).toBe(true)
106
+ })
87
107
  })
@@ -41,6 +41,12 @@ export interface LedgerCensusRows {
41
41
  storedBalanceProps: number
42
42
  paymentKeys: readonly PaymentKey[]
43
43
  declaredNotLive: readonly string[]
44
+ /** Count of `[graph-write] reject` lines from the ledger's MCP logs in the
45
+ * trailing 24 hours. Without it the census cannot tell a healthy empty
46
+ * ledger from one whose write path is wholly dead: both print
47
+ * `invoices=0 payments=0`. Task 1788, after exactly that went unseen for a
48
+ * day. */
49
+ writeRejects24h: number
44
50
  }
45
51
 
46
52
  export interface LedgerCensusFinding {
@@ -50,6 +56,7 @@ export interface LedgerCensusFinding {
50
56
  storedBalanceProps: number
51
57
  suspectDuplicates: number
52
58
  declaredNotLive: readonly string[]
59
+ writeRejects24h: number
53
60
  alarm: boolean
54
61
  }
55
62
 
@@ -81,7 +88,8 @@ export function reconcileLedger(rows: LedgerCensusRows, _now: number): LedgerCen
81
88
  rows.orphanPayments > 0 ||
82
89
  rows.storedBalanceProps > 0 ||
83
90
  suspectDuplicates > 0 ||
84
- rows.declaredNotLive.length > 0
91
+ rows.declaredNotLive.length > 0 ||
92
+ rows.writeRejects24h > 0
85
93
 
86
94
  return {
87
95
  invoices: rows.invoices,
@@ -90,6 +98,7 @@ export function reconcileLedger(rows: LedgerCensusRows, _now: number): LedgerCen
90
98
  storedBalanceProps: rows.storedBalanceProps,
91
99
  suspectDuplicates,
92
100
  declaredNotLive: rows.declaredNotLive,
101
+ writeRejects24h: rows.writeRejects24h,
93
102
  alarm,
94
103
  }
95
104
  }
@@ -104,6 +113,7 @@ export function formatCensusLine(f: LedgerCensusFinding): string {
104
113
  `[ledger-census] invoices=${f.invoices} payments=${f.payments} ` +
105
114
  `orphanPayments=${f.orphanPayments} storedBalanceProps=${f.storedBalanceProps} ` +
106
115
  `suspectDuplicates=${f.suspectDuplicates} ` +
107
- `declaredNotLive=${f.declaredNotLive.length === 0 ? "none" : f.declaredNotLive.join(",")}`
116
+ `declaredNotLive=${f.declaredNotLive.length === 0 ? "none" : f.declaredNotLive.join(",")} ` +
117
+ `writeRejects24h=${f.writeRejects24h}`
108
118
  )
109
119
  }
@@ -1655,7 +1655,10 @@ FOR (cr:Credit) ON (cr.accountId);
1655
1655
  // ----------------------------------------------------------
1656
1656
  // :VoiceProfile holds the distilled style card for one (AdminUser, format).
1657
1657
  // Task 462: one profile per (accountId, userId, format); format ∈
1658
- // {text, email, social-post, article, marketing-copy, note}.
1658
+ // {formal, informal, text, email, social-post, article, marketing-copy, note}.
1659
+ // Task 1795 added the broad `formal`/`informal` buckets. No constraint or
1660
+ // index change was needed — they resolve through the same `n.format =
1661
+ // $format` equality, and the uniqueness constraint already admits them.
1659
1662
  // The old (accountId, adminUserId) unique constraint is dropped and replaced.
1660
1663
  //
1661
1664
  // :VoiceEdit captures operator edits on agent drafts as feedback,
@@ -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:46e07a18921b711849e53f63b8c29b72f3324f91bc682eb5be585ccd64c98971
4
+ content-hash: sha256:87a32054a533d5a60538763ef209f3b3e9d64d70f677d91507dbada9d1006609
5
5
  brand: maxy-code
6
6
  product-name: Maxy
7
7
  ---
@@ -636,6 +636,12 @@ If you need statutory accounts, this is not that. It is the answer to "who owes
636
636
 
637
637
  **Ask for a statement.** Everything owed to you and everything you owe, sorted into 0-30, 31-60, 61-90 and 90+ days overdue, plus net cash.
638
638
 
639
+ ## You look the customer up first
640
+
641
+ When you record an invoice or a cash movement, the agent finds the company or person in your records first, then attaches the money to that exact record. It will not create a new company for you, and the name that appears on the invoice is taken from the record it attached to, so the two can never disagree.
642
+
643
+ That is on purpose. Deciding whether "Beagle Direct Ltd" is the same firm as an existing "Beagle Direct" is a judgement about your records, not a bookkeeping step, and getting it wrong quietly splits one customer's payment history across two entries.
644
+
639
645
  ## Three behaviours worth knowing about
640
646
 
641
647
  **What is outstanding is never stored.** It is worked out from the payments each time you ask. This means the figure cannot fall out of step with the payments behind it. If it were stored, a payment recorded by any route that forgot to update it would leave the invoice quietly reporting a wrong number, and nothing would fail.
@@ -648,7 +654,9 @@ If you need statutory accounts, this is not that. It is the answer to "who owes
648
654
 
649
655
  Some ways this can go wrong announce themselves. Others do not: a payment that ends up attached to no invoice, a stale balance field reappearing, or the same payment recorded twice under two different ids. None of those produce an error at the time, because nothing goes wrong at the moment they happen.
650
656
 
651
- So there is a check that runs by itself every fifteen minutes and writes one line to the log beginning `[ledger-census]`. When it is healthy the counters are all zero. When something is wrong the line ends with `alarm=true` and says which of the four it found.
657
+ So there is a check that runs by itself every fifteen minutes and writes one line to the log beginning `[ledger-census]`. When it is healthy the counters are all zero. When something is wrong the line ends with `alarm=true` and says which of them it found.
658
+
659
+ One of those counters is the number of writes that were refused in the last day. It is there because of a real failure: for a whole day every attempt to record money was refused, and the check still read as healthy, because a ledger nobody has used and a ledger that cannot be written to both show nothing.
652
660
 
653
661
  You can also ask for that check on demand at any time, and it reports the same thing in plain words.
654
662
 
@@ -2207,7 +2215,7 @@ Source: https://docs.getmaxy.com/google-guide.md
2207
2215
  # Google Calendar
2208
2216
 
2209
2217
  Live Google Calendar for one account: read the user's real events, and create,
2210
- update, cancel, respond to and check availability against them. Eleven tools,
2218
+ update, cancel, respond to and check availability against them. Twelve tools,
2211
2219
  admin agent only.
2212
2220
 
2213
2221
  There is deliberately no Gmail surface here. Mail runs on the `email` plugin's
@@ -2218,9 +2226,16 @@ force Google's annual third-party security assessment. Calendar is only a
2218
2226
  ## Connecting an account
2219
2227
 
2220
2228
  `google-account-register` returns a consent URL. Relay it to the user: they open
2221
- it on any device, sign in, and approve. Google redirects to this install's
2222
- public host at `/api/google/oauth/callback`, which exchanges the code and stores
2223
- encrypted tokens. `google-account-register-poll` then reports the outcome.
2229
+ it on any device, sign in, and approve.
2230
+
2231
+ Their browser then lands on a page that **fails to load**. That is expected, not
2232
+ a fault — the vendor app is a Desktop client, so Google redirects to a loopback
2233
+ address on the user's own device where nothing is listening. The address bar
2234
+ carries the code. Ask them to copy it and pass it to
2235
+ `google-account-register-submit`, which completes the connection.
2236
+
2237
+ If they paste the whole `code=...` fragment, or a value containing `%2F`, the
2238
+ tool handles it. `google-account-register-poll` reports the outcome at any point.
2224
2239
 
2225
2240
  The register tool does not block and does not wait. A second register while one
2226
2241
  is already live is refused rather than overwriting it; that refusal names how
@@ -2256,9 +2271,12 @@ granted.
2256
2271
 
2257
2272
  ## When something is wrong
2258
2273
 
2259
- **"GOOGLE_CLIENT_ID is not configured"** this brand has no Google vendor app
2260
- yet. Nothing the operator does on the device fixes it; the brand needs its own
2261
- Google Cloud OAuth client. See `platform/plugins/google/references/auth.md`.
2274
+ **"GOOGLE_CLIENT_ID is not configured"**, or the same for
2275
+ `GOOGLE_CLIENT_SECRET` this brand has no Google vendor app yet. Nothing the
2276
+ operator does on the device fixes it, and no file placed on the device fixes it
2277
+ either: the id and secret ship in the brand's `brand.json` and reach the device
2278
+ through an installer publish. The brand needs its own Google Cloud Desktop OAuth
2279
+ client. See `platform/plugins/google/references/auth.md`.
2262
2280
 
2263
2281
  **A 403 naming insufficient scope** — the connected account approved something
2264
2282
  narrower than the full calendar scope. Re-run `google-account-register` so they
@@ -2270,8 +2288,9 @@ Testing, where Google caps refresh tokens at seven days and limits the app to
2270
2288
  property of the vendor app, not a fault in the connection.
2271
2289
 
2272
2290
  **A registration never completes** — the consent URL was opened but not
2273
- approved, or the callback could not be reached. `google-account-register-poll`
2274
- reports `expired` once the pending entry outlives Google's code lifetime.
2291
+ approved, or the code was never copied back to
2292
+ `google-account-register-submit`. `google-account-register-poll` reports
2293
+ `expired` once the pending entry outlives Google's code lifetime.
2275
2294
 
2276
2295
  ---
2277
2296
  # QuickBooks Online
@@ -2802,7 +2821,7 @@ In the admin chat, ask: **"Start the voice-mirror backfill."**
2802
2821
  Maxy asks which stream to backfill first — discrete documents (emails, posts, PDFs) or chat archives (WhatsApp, Telegram, etc.). **Pick chat archives first if you have any imported.** Chat is where your unguarded voice lives; email is the same voice in dress clothes.
2803
2822
 
2804
2823
  - **Chat archives** — tag a whole conversation in one click. Maxy doesn't ask about individual messages because chunks within a conversation almost always share the same voice. Options per conversation: yours, mixed (multiple authors on your side — rare), or not yours (e.g. a Slack channel where you only forwarded other people's messages).
2805
- - **Documents and posts** — paginated 10 at a time. Maxy shows each item with its detected format (email, article, note, social-post). Tag the whole batch, a subset by number, or per-item if you want a precise label like `human-led-agent-assisted` (you wrote the content, Maxy polished). Override the detected format if one is wrong.
2824
+ - **Documents and posts** — paginated 10 at a time. Maxy shows each item with its source, date, recipient or topic, and a one-line preview. You name the format on every command — Maxy never guesses it. Reach for the broad buckets, `formal` or `informal`, unless a narrower one (`email`, `article`, `note`, `social-post`, `marketing-copy`, `text`) genuinely fits. Tag the whole batch, a subset by number, or per-item if you want a precise label like `human-led-agent-assisted` (you wrote the content, Maxy polished).
2806
2825
 
2807
2826
  Skip a batch if none qualify, or stop at any time — the next session resumes where you left off.
2808
2827
 
@@ -2842,7 +2861,7 @@ Voice mirror is on by default for every drafting skill. To opt out for one, set
2842
2861
 
2843
2862
  ## Status
2844
2863
 
2845
- Voice mirror is live end-to-end. Six corpus formats (text, email, social-post, article, note, marketing-copy), five tools (`voice-tag-content`, `voice-distil-profile`, `voice-retrieve-conditioning`, `voice-record-feedback`, `voice-ingest-session-text`), on-demand session-turn capture, and wiring into the three live drafting surfaces (email composition, property brochures, investor data room) are all live. When no voice profile exists on the account for a given format, every drafting skill degrades gracefully — the output matches what it was before voice mirror was installed.
2864
+ Voice mirror is live end-to-end. Eight corpus formats (the broad buckets `formal` and `informal`, plus the narrower `text`, `email`, `social-post`, `article`, `note`, `marketing-copy`), five tools (`voice-tag-content`, `voice-distil-profile`, `voice-retrieve-conditioning`, `voice-record-feedback`, `voice-ingest-session-text`), on-demand session-turn capture, and wiring into the three live drafting surfaces (email composition, property brochures, investor data room) are all live. When no voice profile exists on the account for a given format, every drafting skill degrades gracefully — the output matches what it was before voice mirror was installed.
2846
2865
 
2847
2866
  ---
2848
2867
  # Admin UI Reference
@@ -2906,7 +2925,7 @@ either is a regression.
2906
2925
  |---|---|---|
2907
2926
  | `/session` | Admin cookie session: PIN-gated mint, validate, rotate. | `GET /`, `POST /` |
2908
2927
  | `/sessions` | Legacy admin-server conversation routes. No UI consumer remains after the ConversationsModal was retired; the surviving handlers are deletion candidates and not described here. | (legacy, no live caller) |
2909
- | `/sidebar-sessions` | Sole data path for the sidebar Sessions list. One JSONL on disk equals one row. The row's delete button is the only way a row disappears. Each row carries `sessionId`, `title`, `startedAt`, `live`, `isSubagent`, `pid: number \| null` (basename of the matched `sessions/<pid>.json`), and `projectDir` (the directory holding the JSONL — consumed by the delete route). The payload also carries top-level `accountId` so the pane renders the full UUID label whose first ~8 chars prefix-match the truncated Remote Control daemon entry in claude.ai/code. The legacy `rcUrl` field is gone — the row's external-link affordance now POSTs `/session-rc-spawn` to start a fresh local `claude --remote-control <name> --session-id <sid>` PTY on every click. **WhatsApp and Telegram sessions (admin + public) appear in this list**, colour-coded by channel (WhatsApp green `#25D366`, Telegram blue `#229ED9`, via a `conv-channel-*` left accent bar) and carrying the standard row kebab (Usage & cost, Reset/re-seat, Rename, Archive, Delete) so the operator can inspect and re-seat a channel session's params. Each row's `channel` is the authoritative `.meta.json` sidecar value (`whatsapp`/`telegram`/`webchat`/`browser`/null), not the JSONL-envelope channel. Each row also carries its sidecar `senderId`. For a WhatsApp/Telegram row with a `senderId` and no operator rename or ai-title (`titleSource:'prefix'`), the route resolves a contact `personName` and the sidebar renders the reader panel's `"<name> <number>"` label via the shared `operatorConvName`, degrading to the number alone then the stripped title on a miss, so a Sessions row and that conversation's reader-panel row read identically. The name comes from the shared `resolveOperatorNamesBySender` helper the WhatsApp reader also calls, so the two surfaces cannot drift; a renamed or ai-titled channel row keeps its own title. The only role/channel excluded from the list is `public`+`webchat` (its dedicated reader is the sole surface); the exclusion predicate is `isSessionListExcluded`, decoupled from the reader's inclusion predicate `isReaderChannelSession` (unchanged), so the WhatsApp/Telegram reader panels are unaffected — a store-only WhatsApp conversation with no session JSONL stays reader-only. Observability rides `[admin-sessions-list] … channelInList=whatsapp:<n>,telegram:<n>,webchat:<n> channelNameCandidates=<n> channelNamesResolved=<n> unknownChannel=<n> excludedPublicWebchat=<n>`, and each unresolved channel name logs one `[admin-sessions-list] op=channel-name-unresolved sessionId=<id8> channel=<whatsapp\|telegram> senderId=<id> reason=<no-senderId\|classify-miss\|neo4j-down>` line so a persistent `channelNamesResolved` shortfall is never silent. | `GET /` |
2928
+ | `/sidebar-sessions` | Sole data path for the sidebar Sessions list. One JSONL on disk equals one row. The row's delete button is the only way a row disappears. Each row carries `sessionId`, `title`, `startedAt`, `live`, `isSubagent`, `pid: number \| null` (basename of the matched `sessions/<pid>.json`), and `projectDir` (the directory holding the JSONL — consumed by the delete route). The payload also carries top-level `accountId` so the pane renders the full UUID label whose first ~8 chars prefix-match the truncated Remote Control daemon entry in claude.ai/code. The legacy `rcUrl` field is gone — the row's external-link affordance now POSTs `/session-rc-spawn` to start a fresh local `claude --remote-control <name> --session-id <sid>` PTY on every click. **WhatsApp and Telegram sessions (admin + public) appear in this list**, colour-coded by channel (WhatsApp green `#25D366`, Telegram blue `#229ED9`, via a `conv-channel-*` left accent bar) and carrying the standard row kebab (Usage & cost, Reset/re-seat, Rename, Archive, Delete) so the operator can inspect and re-seat a channel session's params. Each row's `channel` is the authoritative `.meta.json` sidecar value (`whatsapp`/`telegram`/`webchat`/`browser`/null), not the JSONL-envelope channel. Each row also carries its sidecar `senderId`. For a WhatsApp/Telegram row with a `senderId` and no operator rename or ai-title (`titleSource:'prefix'`), the route resolves a contact `personName` and the sidebar renders the reader panel's `"<name> <number>"` label via the shared `operatorConvName`, degrading to the number alone then the stripped title on a miss, so a Sessions row and that conversation's reader-panel row read identically. A channel row name has two sources, in precedence order. First the shared `resolveOperatorNamesBySender` helper the WhatsApp reader also calls, which matches the sender phone against the account's admins — that names an admin WhatsApp session and every Telegram session. Second, for a `whatsapp` row only, the WhatsApp pushName from the account's on-disk message store (`storePushNamesBySender` over `readConversationSummaries`, keyed by `normalizeE164` of the counterparty phone so a `+44 7…` sender matches a `447…` store key). The store is consulted only when the resolver reports **no binding** for that sender. That is typically a public WhatsApp customer, the case this exists for — such a sender has no admin record and so can only be named by the store, and without it those rows degraded to the bare number while the reader panel named them — though an admin missing from `users.json` qualifies too. A resolver miss caused by Neo4j being unreachable deliberately does NOT qualify: that is an outage rather than an absent binding, so the row degrades to the number and still logs `reason=neo4j-down`, keeping the outage signal intact. Telegram has no message store and is never looked up. The store read is guarded: a corrupt or absent store degrades to no pushName and logs `op=store-unreadable`, never 500s the list. Both sources are the ones the reader itself uses, so the two surfaces cannot drift; a renamed or ai-titled channel row keeps its own title. The Sessions list reads the viewed account's own store only. An account-manager's thread persists under the house account rather than the sub-account it manages, so on a multi-account install viewing a sub-account that row is not named here even though the reader panel names it — the reader additionally consults the house store, filtered to manager phones bound to that sub. The only role/channel excluded from the list is `public`+`webchat` (its dedicated reader is the sole surface); the exclusion predicate is `isSessionListExcluded`, decoupled from the reader's inclusion predicate `isReaderChannelSession` (unchanged), so the WhatsApp/Telegram reader panels are unaffected — a store-only WhatsApp conversation with no session JSONL stays reader-only. Observability rides `[admin-sessions-list] … channelInList=whatsapp:<n>,telegram:<n>,webchat:<n> channelNameCandidates=<n> channelNamesResolved=<n> (operator=<n> store=<n>) unknownChannel=<n> excludedPublicWebchat=<n>`, and each unresolved channel name logs one `[admin-sessions-list] op=channel-name-unresolved sessionId=<id8> channel=<whatsapp\|telegram> senderId=<id> reason=<no-senderId\|classify-miss\|neo4j-down>` line — emitted only when **both** sources miss, so a residual shortfall means a genuinely nameless sender rather than the expected public-customer floor, and the `operator=`/`store=` split says which source is carrying the names. | `GET /` |
2910
2929
  | `/session-delete` | POST `{ sessionId }`. Thin proxy over the manager: POST `/:id/stop` (idempotent) then DELETE `/:id`. Sends **no** accountId. The manager resolves the session by scanning every slug under `projects/` for its JSONL (`slugForExistingJsonl`, covering `archive/`), exactly as the sidebar list enumerates rows, and gates on file existence alone — so any session the operator can see is deletable. This replaces the earlier accountId-derived slug and the `!row` term, which narrowed resolution below the list and left a session under a non-house slug with no watcher row (e.g. a legacy `-home-admin` session on a single-account install) listed yet un-deletable. Account scope is a view filter, not a delete gate — admin access is install-wide, so there is nothing to scope against. The sibling `/session-stop` (the standalone End control) resolves identically and also forwards no accountId. | `POST /` |
2911
2930
  | `/session-rc-spawn` | POST `{ sessionId?, name? }`. Fire-and-forget `claude --remote-control [name] [--session-id <sid>]`. Present `sessionId` resumes; absent starts a fresh session (also used by the sidebar's "New session" button — it no longer opens claude.ai/code directly). Proxies to the manager's `/rc-spawn`, which waits up to **60 s** (raised from 12 s) for the spawned PTY to bind and returns `{ spawnedPid, sessionId, bridgeSessionId, slug, outcome, reason }`. For a webchat-bound spawn (every admin-gated host's "New session", returning a same-origin `/chat?session=<id>` target — `resolveRcSpawnOutcome` → `sameOrigin:true`) the Sidebar navigates the **current** tab via `window.location.assign`, replacing the dashboard in place (back returns to it); only a claude.ai/code slug (`sameOrigin:false`, the bare-admin resume bridge, never a new-session outcome) navigates a separately-opened tab. On `timeout` or `spawn-failed` it shows an error modal (reason + sessionId) and **never** opens a bare claude.ai/code tab. The new process registers itself as its own Remote Control entry in claude.ai/code. | `POST /` |
2912
2931
  | `/claude-sessions` | **Spawn surface only**. `POST /` is the Sidebar new-session-with-prompt path, cookie-auth only (the recorder loopback caller was removed; LinkedIn ingest moved to `/rc-spawn`). The former UI-facing handlers (SSE row feed, list, resume, stop, rename, archive, delete, `/:id/meta`, `/:id/input`, `/:id/log`) were removed — the maxy dashboard no longer manages or displays sessions. | `POST /` |
@@ -4891,6 +4910,10 @@ To deliberately disconnect the wrong account, use the header menu's **Disconnect
4891
4910
  3. `grep '\[auth-health\]' ~/.${brand}/logs/server.log | tail -n 5` — the heartbeat fires every five minutes. `status=dead expiresIn=...` means the refresh token is gone; only a re-login fixes it. `status=ok` heartbeats with no spawns in between mean the credentials file is healthy and the failure lives elsewhere.
4892
4911
  4. The spawn-failure surface now carries `reason=auth-refresh-failed` (with `authStatus` in the JSON body) instead of generic `pid-file-timeout` whenever the credentials file is in `dead` or `expired` state at the moment of failure — visible in `grep '\[spawn-failed\]'` on server.log.
4893
4912
 
4913
+ **A WhatsApp message you can see on your phone never appears in the app.** First check whether it was ever stored, rather than assuming it routed elsewhere: ask Maxy for the most recent ingest reconcile, or `grep '\[wa-ingest-audit\]' ~/.${brand}/logs/server.log | tail -1`. A healthy line reads `op=reconcile … unpersisted=0 inFlight=0 guard=installed`. If `unpersisted` is above zero, the `ids=` field names the exact message ids that arrived at the wire and were never written to the store — those messages are genuinely lost to the platform, not hidden in another workspace or sub-account, and they cannot be re-fetched because WhatsApp only delivers an acked message once. Forward the message from your phone to get it back in; it re-enters as a new message through the normal path.
4914
+
4915
+ The audit runs every 15 minutes and holds a stanza for 10 minutes before judging it, so a message can take up to 25 minutes to be reported. The wait is deliberate: a large batch of photos arriving at once can take several minutes to finish storing, and a false "a message was lost" alarm would make the real one easy to ignore. Three classes are resolved rather than reported, each counted separately: `skippedStatus` (status broadcasts, never stored), `skippedReaction` (reactions, stored under the message they react to rather than under their own id — a consequence being that a lost *reaction* is not detectable), and `declined` (messages carrying neither text nor a file, such as a shared contact card, a poll, or a delete-for-everyone, which are dropped by design). `oldestUnpersistedMin` tells you whether a reported loss is new or one you have already seen, since the same id is re-reported every 15 minutes for a day. `guard=absent` or `inFlight` stuck above zero on an idle install are both faults worth surfacing to support: the first means the media-download crash guard failed to install at boot, the second means its counter leaked. `contained` counts crashes the guard prevented — a number that climbs while media traffic stays flat is also worth reporting.
4916
+
4894
4917
  ---
4895
4918
 
4896
4919
  ## Memory Not Working