memhouse 0.18.12 → 0.20.1

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 (169) hide show
  1. package/AGENTS.md +22 -151
  2. package/CHANGELOG.md +263 -29
  3. package/LICENSE +202 -22
  4. package/LICENSES/agentlytics-MIT.txt +21 -0
  5. package/LICENSES/memhouse-MIT-until-0.18.11.txt +22 -0
  6. package/LICENSES/models.dev-MIT.txt +22 -0
  7. package/NOTICE +28 -0
  8. package/README.md +42 -20
  9. package/SECURITY.md +21 -8
  10. package/bin/memhouse.js +2223 -311
  11. package/docs/README.md +11 -9
  12. package/docs/guides/admin-password.md +37 -10
  13. package/docs/guides/configuration.md +13 -6
  14. package/docs/guides/daemons.md +64 -3
  15. package/docs/guides/import-claude-ai.md +204 -0
  16. package/docs/guides/install.md +11 -6
  17. package/docs/guides/invite.md +21 -7
  18. package/docs/guides/operate.md +114 -7
  19. package/docs/guides/search-and-resume.md +72 -3
  20. package/docs/guides/share.md +91 -52
  21. package/docs/guides/storage.md +44 -4
  22. package/docs/guides/troubleshooting.md +121 -14
  23. package/docs/guides/uninstall.md +4 -3
  24. package/docs/guides/update.md +16 -0
  25. package/docs/guides/upgrade-to-0.20.md +188 -0
  26. package/docs/releases/README.md +2 -1
  27. package/docs/releases/v0.18.10.md +5 -5
  28. package/docs/releases/v0.18.11.md +3 -3
  29. package/docs/releases/v0.20.0.md +627 -0
  30. package/docs/releases/v0.20.1.md +114 -0
  31. package/docs/tutorials/01-first-house.md +10 -7
  32. package/docs/tutorials/02-join-a-house.md +24 -15
  33. package/docs/tutorials/03-share-your-memory.md +40 -31
  34. package/editors/antigravity.js +1 -80
  35. package/editors/base.js +463 -9
  36. package/editors/bridge.js +119 -0
  37. package/editors/claude.js +273 -105
  38. package/editors/codex.js +278 -52
  39. package/editors/copilot.js +1 -70
  40. package/editors/cursor.js +1 -75
  41. package/editors/derive-fingerprints.json +18 -0
  42. package/editors/harness-paths.js +69 -0
  43. package/editors/index.js +1 -20
  44. package/editors/normalise/agy.js +910 -0
  45. package/editors/normalise/copilot-cli.js +321 -0
  46. package/editors/normalise/cursor-agent.js +852 -0
  47. package/editors/normalise/cursor.js +474 -0
  48. package/editors/normalise/devin.js +575 -0
  49. package/editors/normalise/gemini-cli.js +602 -0
  50. package/editors/normalise/goose.js +673 -0
  51. package/editors/normalise/opencode.js +633 -0
  52. package/editors/normalise/vscode.js +549 -0
  53. package/editors/normalise/zed.js +473 -0
  54. package/editors/opencode-v4.js +119 -0
  55. package/editors/scope.js +14 -3
  56. package/editors/sessions-log.js +349 -0
  57. package/editors/sqlite.js +28 -1
  58. package/editors/vscode.js +1 -72
  59. package/editors/windsurf.js +1 -143
  60. package/examples/01-local-one-machine/README.md +24 -19
  61. package/examples/01-local-one-machine/run.sh +1 -1
  62. package/examples/02-existing-clickhouse/README.md +30 -22
  63. package/examples/02-existing-clickhouse/run.sh +5 -4
  64. package/examples/03-team-house/README.md +44 -37
  65. package/examples/03-team-house/run.sh +35 -18
  66. package/examples/04-self-hosted-team/README.md +29 -14
  67. package/examples/04-self-hosted-team/compose.yml +5 -2
  68. package/examples/04-self-hosted-team/smoke.sh +26 -12
  69. package/examples/README.md +8 -4
  70. package/examples/fixtures/README.md +4 -1
  71. package/examples/fixtures/make-sessions.js +8 -5
  72. package/memhouse/admin-secret.js +89 -24
  73. package/memhouse/argv-secrets.js +64 -0
  74. package/memhouse/channel.js +49 -9
  75. package/memhouse/codex-plugin.js +194 -0
  76. package/memhouse/delivery/AGENT-INSTALL-PROMPT.md +2 -1
  77. package/memhouse/delivery/AGENT-INSTALL.md +22 -11
  78. package/memhouse/delivery/INVITATION.md.tpl +44 -45
  79. package/memhouse/delivery/PROMPT.md +53 -5
  80. package/memhouse/delivery/UPGRADE.md.tpl +1 -1
  81. package/memhouse/delivery/codex/AGENTS-BLOCK.md +11 -0
  82. package/memhouse/delivery/codex/SKILL.md +50 -0
  83. package/memhouse/delivery/kernel-install.md +17 -9
  84. package/memhouse/delivery/plugin/.claude-plugin/plugin.json +2 -2
  85. package/memhouse/delivery/plugin/reference/HOUSE.md +168 -41
  86. package/memhouse/delivery/plugin/skills/access/SKILL.md +13 -5
  87. package/memhouse/delivery/plugin/skills/admin/SKILL.md +14 -6
  88. package/memhouse/delivery/plugin/skills/house/SKILL.md +25 -8
  89. package/memhouse/delivery/plugin/skills/recall/SKILL.md +66 -8
  90. package/memhouse/delivery/plugin/skills/sql/SKILL.md +66 -7
  91. package/memhouse/deploy.js +1 -1
  92. package/memhouse/flags.js +35 -18
  93. package/memhouse/help.js +37 -0
  94. package/memhouse/host.js +82 -2
  95. package/memhouse/house/HOUSE.md +2 -2
  96. package/memhouse/house/convert-profile.js +638 -0
  97. package/memhouse/house/convert-v3.js +742 -0
  98. package/memhouse/house/doctor-v3.js +324 -0
  99. package/memhouse/house/host-alias.js +85 -0
  100. package/memhouse/house/house.js +3 -3
  101. package/memhouse/house/migrate.js +2 -2
  102. package/memhouse/house/profile-dedupe.js +183 -0
  103. package/memhouse/house/profile-edges.js +554 -0
  104. package/memhouse/house/profile-house.js +430 -0
  105. package/memhouse/house/profile-rollup.js +190 -0
  106. package/memhouse/house/q-cli.js +863 -0
  107. package/memhouse/house/queries-v3.js +1013 -0
  108. package/memhouse/house/reconcile-v3.js +192 -0
  109. package/memhouse/house/records-to-profile.js +174 -0
  110. package/memhouse/house/records-to-rows.js +169 -0
  111. package/memhouse/house/relocate.js +2 -1
  112. package/memhouse/house/schema-choice.js +121 -0
  113. package/memhouse/house/schema-profile.js +290 -0
  114. package/memhouse/house/schema-profile.sql.tpl +398 -0
  115. package/memhouse/house/schema-v3.js +267 -0
  116. package/memhouse/house/schema-v3.sql.tpl +213 -0
  117. package/memhouse/import/claude-ai.js +420 -0
  118. package/memhouse/import/import.js +372 -0
  119. package/memhouse/import/pyjson.js +206 -0
  120. package/memhouse/import/records.js +64 -0
  121. package/memhouse/import/writer-profile.js +192 -0
  122. package/memhouse/import/writer-v3.js +240 -0
  123. package/memhouse/import/zip.js +112 -0
  124. package/memhouse/invitation.js +102 -0
  125. package/memhouse/invitefile.js +5 -2
  126. package/memhouse/plugin-copies.js +176 -0
  127. package/memhouse/provision.js +7 -2
  128. package/memhouse/release-hint.js +24 -0
  129. package/memhouse/resume.js +4 -4
  130. package/memhouse/server/api-v3.js +632 -0
  131. package/memhouse/server/dashboard-auth.js +181 -0
  132. package/memhouse/server/dashboard-port.js +91 -0
  133. package/memhouse/server/queries.js +30 -0
  134. package/memhouse/server/server.js +118 -20
  135. package/memhouse/service.js +1 -1
  136. package/memhouse/share.js +687 -1
  137. package/memhouse/shipper/adapter-capture.js +756 -0
  138. package/memhouse/shipper/capture.js +2571 -0
  139. package/memhouse/shipper/dedupe-profile.js +237 -0
  140. package/memhouse/shipper/dedupe-v3.js +1027 -0
  141. package/memhouse/shipper/forks.js +233 -0
  142. package/memhouse/shipper/log-adapter.js +219 -0
  143. package/memhouse/shipper/maintenance.js +49 -0
  144. package/memhouse/shipper/normalise-run.js +148 -0
  145. package/memhouse/shipper/passlog.js +68 -5
  146. package/memhouse/shipper/profile-capture.js +903 -0
  147. package/memhouse/shipper/ship.js +91 -8
  148. package/memhouse/shipper/snapshots.js +193 -0
  149. package/memhouse/shipper/source-roots.js +111 -0
  150. package/memhouse/version-notice.js +66 -0
  151. package/package.json +14 -7
  152. package/public/THIRD_PARTY_NOTICES.txt +2 -2
  153. package/public/assets/index-CcNnhfM3.js +78 -0
  154. package/public/index.html +1 -1
  155. package/ui/package-lock.json +56 -37
  156. package/ui/package.json +1 -0
  157. package/ui/src/App.jsx +29 -14
  158. package/ui/src/components/ChatSidebar.jsx +69 -12
  159. package/ui/src/lib/api.js +76 -0
  160. package/ui/src/lib/dashboard-token.js +41 -0
  161. package/ui/src/main.jsx +22 -5
  162. package/ui/src/pages/Dashboard.jsx +22 -36
  163. package/ui/third-party-notices.js +119 -0
  164. package/ui/vite.config.js +5 -1
  165. package/docs/releases/v0.18.12.md +0 -59
  166. package/memhouse/COMPETITION.md +0 -221
  167. package/memhouse/DESIGN.md +0 -222
  168. package/memhouse/RESUME-AND-UPDATE.md +0 -182
  169. package/public/assets/index-CnWzrjF3.js +0 -78
package/public/index.html CHANGED
@@ -7,7 +7,7 @@
7
7
  <link rel="preconnect" href="https://fonts.googleapis.com" />
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
9
  <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="/assets/index-CnWzrjF3.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-CcNnhfM3.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-DV6ONi_F.css">
12
12
  </head>
13
13
  <body>
@@ -7,6 +7,7 @@
7
7
  "": {
8
8
  "name": "ui",
9
9
  "version": "0.0.0",
10
+ "license": "Apache-2.0",
10
11
  "dependencies": {
11
12
  "@tailwindcss/vite": "^4.2.1",
12
13
  "chart.js": "^4.5.1",
@@ -485,27 +486,43 @@
485
486
  }
486
487
  },
487
488
  "node_modules/@humanfs/core": {
488
- "version": "0.19.1",
489
- "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
490
- "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==",
489
+ "version": "0.19.2",
490
+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
491
+ "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==",
491
492
  "dev": true,
493
+ "license": "Apache-2.0",
494
+ "dependencies": {
495
+ "@humanfs/types": "^0.15.0"
496
+ },
492
497
  "engines": {
493
498
  "node": ">=18.18.0"
494
499
  }
495
500
  },
496
501
  "node_modules/@humanfs/node": {
497
- "version": "0.16.7",
498
- "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz",
499
- "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==",
502
+ "version": "0.16.8",
503
+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz",
504
+ "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==",
500
505
  "dev": true,
506
+ "license": "Apache-2.0",
501
507
  "dependencies": {
502
- "@humanfs/core": "^0.19.1",
508
+ "@humanfs/core": "^0.19.2",
509
+ "@humanfs/types": "^0.15.0",
503
510
  "@humanwhocodes/retry": "^0.4.0"
504
511
  },
505
512
  "engines": {
506
513
  "node": ">=18.18.0"
507
514
  }
508
515
  },
516
+ "node_modules/@humanfs/types": {
517
+ "version": "0.15.0",
518
+ "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz",
519
+ "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==",
520
+ "dev": true,
521
+ "license": "Apache-2.0",
522
+ "engines": {
523
+ "node": ">=18.18.0"
524
+ }
525
+ },
509
526
  "node_modules/@humanwhocodes/module-importer": {
510
527
  "version": "1.0.1",
511
528
  "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
@@ -1268,9 +1285,9 @@
1268
1285
  }
1269
1286
  },
1270
1287
  "node_modules/brace-expansion": {
1271
- "version": "1.1.16",
1272
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz",
1273
- "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==",
1288
+ "version": "1.1.21",
1289
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz",
1290
+ "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==",
1274
1291
  "dev": true,
1275
1292
  "license": "MIT",
1276
1293
  "dependencies": {
@@ -2113,9 +2130,9 @@
2113
2130
  "license": "MIT"
2114
2131
  },
2115
2132
  "node_modules/js-yaml": {
2116
- "version": "4.3.0",
2117
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
2118
- "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
2133
+ "version": "4.3.2",
2134
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
2135
+ "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
2119
2136
  "dev": true,
2120
2137
  "funding": [
2121
2138
  {
@@ -3321,9 +3338,9 @@
3321
3338
  "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
3322
3339
  },
3323
3340
  "node_modules/nanoid": {
3324
- "version": "3.3.16",
3325
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz",
3326
- "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==",
3341
+ "version": "3.3.20",
3342
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
3343
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
3327
3344
  "funding": [
3328
3345
  {
3329
3346
  "type": "github",
@@ -3472,9 +3489,9 @@
3472
3489
  }
3473
3490
  },
3474
3491
  "node_modules/postcss": {
3475
- "version": "8.5.22",
3476
- "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.22.tgz",
3477
- "integrity": "sha512-KBDEIpLrvpv16pp3K0Fw+UCoZfopFjjgeB+0tA/aaThfEE74kKDLrgg603YvOWJyg3+WYtyq3xYsQWsIyZlPqQ==",
3492
+ "version": "8.5.32",
3493
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
3494
+ "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
3478
3495
  "funding": [
3479
3496
  {
3480
3497
  "type": "opencollective",
@@ -3491,9 +3508,9 @@
3491
3508
  ],
3492
3509
  "license": "MIT",
3493
3510
  "dependencies": {
3494
- "nanoid": "^3.3.16",
3511
+ "nanoid": "^3.3.20",
3495
3512
  "picocolors": "^1.1.1",
3496
- "source-map-js": "^1.2.1"
3513
+ "source-map-js": "^1.2.2"
3497
3514
  },
3498
3515
  "engines": {
3499
3516
  "node": "^10 || ^12 || >=14"
@@ -3590,9 +3607,9 @@
3590
3607
  }
3591
3608
  },
3592
3609
  "node_modules/react-router": {
3593
- "version": "7.18.1",
3594
- "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.1.tgz",
3595
- "integrity": "sha512-GDLgg3i3uM0aeJO3Fm+TCS+sDQ7gu12T6x0qdTEzcwqEfleci7JwugVNIF3U//0FWKnJT7ptG+20B2jfDqnZAg==",
3610
+ "version": "7.18.4",
3611
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.4.tgz",
3612
+ "integrity": "sha512-PUPQcMhMGRAslLcvtlPz/kmzBEWPhLdgLFrL7pLNepBL6dX0lWj4WD2cUYVgYCuT3jxvghYFg81cDTj44DhetQ==",
3596
3613
  "license": "MIT",
3597
3614
  "dependencies": {
3598
3615
  "cookie": "^1.0.1",
@@ -3612,12 +3629,12 @@
3612
3629
  }
3613
3630
  },
3614
3631
  "node_modules/react-router-dom": {
3615
- "version": "7.18.1",
3616
- "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.1.tgz",
3617
- "integrity": "sha512-KaZh+X/6UtEp28x51AUYZDMg9NGoz2ja3dNHa+ta/tk40vCzKhQ/RypCWBMLbmDr6//E24Vv5uPsrqXFozdkAg==",
3632
+ "version": "7.18.4",
3633
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.4.tgz",
3634
+ "integrity": "sha512-yrfmJHIpDG7taCpqKjT1G5B6q3O2K+RN8/fgNf0lTjCwiPbQ0ei6vXX9ZjQR+7ld8Tr7Z5xmyMnZ8YJrphWQUw==",
3618
3635
  "license": "MIT",
3619
3636
  "dependencies": {
3620
- "react-router": "7.18.1"
3637
+ "react-router": "7.18.4"
3621
3638
  },
3622
3639
  "engines": {
3623
3640
  "node": ">=20.0.0"
@@ -3764,9 +3781,9 @@
3764
3781
  }
3765
3782
  },
3766
3783
  "node_modules/set-cookie-parser": {
3767
- "version": "2.7.2",
3768
- "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz",
3769
- "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==",
3784
+ "version": "2.7.3",
3785
+ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.3.tgz",
3786
+ "integrity": "sha512-irZHtTqurLna57KQG/s+fzOwv/J6XSH4cs8M/vsrY3uCaQ3S6+QJguAH0WdN47SXlk82voMZ4naWMQf8fdEoIg==",
3770
3787
  "license": "MIT"
3771
3788
  },
3772
3789
  "node_modules/shebang-command": {
@@ -3791,9 +3808,10 @@
3791
3808
  }
3792
3809
  },
3793
3810
  "node_modules/source-map-js": {
3794
- "version": "1.2.1",
3795
- "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
3796
- "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
3811
+ "version": "1.2.2",
3812
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
3813
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
3814
+ "license": "BSD-3-Clause",
3797
3815
  "engines": {
3798
3816
  "node": ">=0.10.0"
3799
3817
  }
@@ -4196,10 +4214,11 @@
4196
4214
  }
4197
4215
  },
4198
4216
  "node_modules/zod": {
4199
- "version": "4.3.6",
4200
- "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",
4201
- "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",
4217
+ "version": "4.6.7",
4218
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
4219
+ "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
4202
4220
  "dev": true,
4221
+ "license": "MIT",
4203
4222
  "funding": {
4204
4223
  "url": "https://github.com/sponsors/colinhacks"
4205
4224
  }
package/ui/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "ui",
3
3
  "private": true,
4
+ "license": "Apache-2.0",
4
5
  "version": "0.0.0",
5
6
  "type": "module",
6
7
  "scripts": {
package/ui/src/App.jsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useState, useEffect, useRef, useCallback } from 'react'
2
2
  import { Routes, Route, NavLink, useLocation } from 'react-router-dom'
3
3
  import { Activity, BarChart3, GitCompare, MessageSquare, FolderOpen, DollarSign, CreditCard, Sun, Moon, RefreshCw, AlertTriangle, Github, Terminal, Database, Users, Plug, Copy, Check, Settings as SettingsIcon, Package, ChevronDown, Target } from 'lucide-react'
4
- import { fetchOverview, refetchAgents, fetchMode, getAuthToken, setOnAuthFailure } from './lib/api'
4
+ import { fetchOverview, refetchAgents, fetchMode, fetchHouseVersion, getAuthToken, setOnAuthFailure } from './lib/api'
5
5
  import { useTheme } from './lib/theme'
6
6
  import { useLive } from './hooks/useLive'
7
7
  import AnimatedLogo from './components/AnimatedLogo'
@@ -80,6 +80,9 @@ export default function App() {
80
80
  const { dark, toggle } = useTheme()
81
81
  const [mcpOpen, setMcpOpen] = useState(false)
82
82
  const [mcpCopied, setMcpCopied] = useState(false)
83
+ // Bumped whenever the house changed: the Dashboard re-reads its landing request.
84
+ const [refreshKey, setRefreshKey] = useState(0)
85
+ const versionRef = useRef(null)
83
86
 
84
87
  useEffect(() => {
85
88
  setOnAuthFailure(() => setAuthed(false))
@@ -100,26 +103,38 @@ export default function App() {
100
103
  if (mode === 'local') refreshOverview()
101
104
  }, [mode])
102
105
 
106
+ const refreshAll = useCallback(() => {
107
+ refreshOverview()
108
+ setRefreshKey(k => k + 1)
109
+ }, [refreshOverview])
110
+
111
+ // Refetch asks the server for a pass — never a full re-ship (an incremental pass on a 0.18
112
+ // house; nothing at all on schema 3, where the capture engine runs on its own timer) — and
113
+ // then re-reads.
103
114
  const rescanAndRefresh = useCallback(async (onProgress) => {
104
115
  await refetchAgents(onProgress)
105
- const data = await fetchOverview()
106
- setOverview(data)
107
- }, [])
116
+ refreshAll()
117
+ }, [refreshAll])
108
118
 
109
- // Live mode: rescan & refresh every 60s. `mode` must be a dependency: it
110
- // starts as null (detection is async), so without it a persisted live=true
111
- // never starts the interval once mode resolves to 'local'.
119
+ // Live: poll the house version token every 60s and re-read only when it moved. It used to
120
+ // run a FULL shipper pass every minute from the dashboard. `mode` must be a dependency: it
121
+ // starts as null (detection is async), so without it a persisted live=true never starts
122
+ // the interval once mode resolves to 'local'.
112
123
  useEffect(() => {
113
124
  if (live && mode === 'local') {
125
+ fetchHouseVersion().then(v => { versionRef.current = v.token }).catch(() => {})
114
126
  liveRef.current = setInterval(() => {
115
- rescanAndRefresh().catch(() => {})
127
+ fetchHouseVersion().then(v => {
128
+ if (versionRef.current !== null && v.token !== versionRef.current) refreshAll()
129
+ versionRef.current = v.token
130
+ }).catch(() => {})
116
131
  }, 60000)
117
132
  } else {
118
133
  if (liveRef.current) clearInterval(liveRef.current)
119
134
  liveRef.current = null
120
135
  }
121
136
  return () => { if (liveRef.current) clearInterval(liveRef.current) }
122
- }, [live, mode, rescanAndRefresh])
137
+ }, [live, mode, refreshAll])
123
138
 
124
139
  const handleRefetch = async () => {
125
140
  setRefetchState({ scanned: 0, total: 0 })
@@ -209,7 +224,7 @@ export default function App() {
209
224
  disabled={!!refetchState}
210
225
  className="flex items-center gap-1 px-2 py-0.5 text-[11px] rounded transition hover:bg-[var(--c-card)]"
211
226
  style={{ color: 'var(--c-text2)', border: '1px solid var(--c-border)' }}
212
- title="Clear cache and rescan all editors"
227
+ title="Run an incremental pass and re-read"
213
228
  >
214
229
  <RefreshCw size={10} className={refetchState ? 'animate-spin' : ''} />
215
230
  {refetchState
@@ -269,7 +284,7 @@ export default function App() {
269
284
  </Routes>
270
285
  ) : (
271
286
  <Routes>
272
- <Route path="/" element={<Dashboard overview={overview} />} />
287
+ <Route path="/" element={<Dashboard overview={overview} refreshKey={refreshKey} />} />
273
288
  <Route path="/projects" element={<Projects overview={overview} />} />
274
289
  <Route path="/projects/detail" element={<ProjectDetail />} />
275
290
  <Route path="/sessions" element={<Sessions overview={overview} />} />
@@ -349,9 +364,9 @@ export default function App() {
349
364
 
350
365
  <div className="text-[12px] font-medium mb-1.5" style={{ color: 'var(--c-white)' }}>Team Sharing</div>
351
366
  <div className="text-[10px] mb-1" style={{ color: 'var(--c-text3)' }}>
352
- Relay join is not supported in memhouse — team sharing is kernel-based. Each
353
- member owns their own rooms and shares by granting SELECT on them.
354
- See memhouse/delivery/kernel-install.md.
367
+ Relay join is not supported in memhouse. Each member owns their own rooms
368
+ and shares by granting SELECT on them (memhouse share). A kernel house
369
+ (memhouse/delivery/kernel-install.md) requires the Ultimagent kernel, not yet public.
355
370
  </div>
356
371
  <pre
357
372
  className="text-[11px] px-3 py-2 overflow-x-auto"
@@ -1,6 +1,6 @@
1
1
  import { useState, useEffect, useRef, useCallback } from 'react'
2
2
  import { X, Download, Send, Search } from 'lucide-react'
3
- import { fetchChat, BASE } from '../lib/api'
3
+ import { fetchChat, fetchChatVersion, fetchChatTurns, downloadChatMarkdown } from '../lib/api'
4
4
  import { editorColor, editorLabel, formatDateTime, formatNumber } from '../lib/constants'
5
5
  import MessageContent, { ROLE_CONFIG } from './MessageRenderer'
6
6
  import TokenTimeline from './TokenTimeline'
@@ -12,6 +12,11 @@ export default function ChatSidebar({ chatId, onClose, fetchFn, extraHeader, use
12
12
  const [msgFilter, setMsgFilter] = useState('')
13
13
  const scrollRef = useRef(null)
14
14
  const msgCountRef = useRef(0)
15
+ const versionRef = useRef(null)
16
+ // Set while earlier messages are prepended: keep the reader where they were instead of
17
+ // jumping to the bottom. Holds the scrollHeight before the prepend.
18
+ const prependRef = useRef(null)
19
+ const [loadingEarlier, setLoadingEarlier] = useState(false)
15
20
 
16
21
  useEffect(() => {
17
22
  if (!chatId) return
@@ -19,10 +24,16 @@ export default function ChatSidebar({ chatId, onClose, fetchFn, extraHeader, use
19
24
  setChat(null)
20
25
  setError(null)
21
26
  msgCountRef.current = 0
27
+ versionRef.current = null
22
28
  const doFetch = fetchFn || fetchChat
23
- doFetch(chatId).then(data => {
29
+ Promise.all([
30
+ doFetch(chatId),
31
+ // The version token the poll compares against. Schema 3 also returns it on the chat.
32
+ fetchFn ? Promise.resolve(null) : fetchChatVersion(chatId).catch(() => null),
33
+ ]).then(([data, v]) => {
24
34
  setChat(data)
25
35
  msgCountRef.current = data?.messages?.length || 0
36
+ versionRef.current = data?.version ?? v?.version ?? null
26
37
  setLoading(false)
27
38
  }).catch(e => {
28
39
  // Without this, a failed initial fetch leaves the spinner forever and
@@ -31,22 +42,58 @@ export default function ChatSidebar({ chatId, onClose, fetchFn, extraHeader, use
31
42
  setLoading(false)
32
43
  })
33
44
 
34
- // Poll for new messages while sidebar is open
45
+ // Poll while the sidebar is open. The default path polls the session's VERSION — one
46
+ // point read — and refetches the conversation only when it moved; it used to refetch the
47
+ // whole session every 10 s (two whole-room scans each time on a 0.18 house). A custom
48
+ // fetchFn keeps the old compare-the-count poll.
35
49
  const iv = setInterval(() => {
36
- doFetch(chatId).then(data => {
37
- if (data?.messages?.length !== msgCountRef.current) {
50
+ if (fetchFn) {
51
+ doFetch(chatId).then(data => {
52
+ if (data?.messages?.length !== msgCountRef.current) {
53
+ msgCountRef.current = data?.messages?.length || 0
54
+ setChat(data)
55
+ }
56
+ }).catch(() => {})
57
+ return
58
+ }
59
+ fetchChatVersion(chatId).then(v => {
60
+ const ver = v?.version ?? null
61
+ if (ver === null || ver === versionRef.current) return
62
+ return doFetch(chatId).then(data => {
63
+ versionRef.current = data?.version ?? ver
38
64
  msgCountRef.current = data?.messages?.length || 0
39
65
  setChat(data)
40
- }
66
+ })
41
67
  }).catch(() => {})
42
68
  }, 10000)
43
69
  return () => clearInterval(iv)
44
70
  }, [chatId, fetchFn])
45
71
 
46
- // Scroll to bottom when chat loads or new messages arrive
72
+ // Schema 3 opens a session at its TAIL; `prevCursor` pages back through the earlier turns.
73
+ const loadEarlier = useCallback(() => {
74
+ if (!chat?.prevCursor || loadingEarlier) return
75
+ setLoadingEarlier(true)
76
+ fetchChatTurns(chat.id, { cursor: chat.prevCursor, dir: 'backward', limit: 1000 }).then(page => {
77
+ prependRef.current = scrollRef.current ? scrollRef.current.scrollHeight : null
78
+ setChat(c => c && ({
79
+ ...c,
80
+ messages: [...(page.messages || []), ...c.messages],
81
+ toolCallDetails: [...(page.toolCallDetails || []), ...(c.toolCallDetails || [])],
82
+ prevCursor: page.prevCursor,
83
+ }))
84
+ }).catch(() => {}).finally(() => setLoadingEarlier(false))
85
+ }, [chat, loadingEarlier])
86
+
87
+ // Scroll to bottom when chat loads or new messages arrive — but after a prepend, keep the
88
+ // same messages in view.
47
89
  useEffect(() => {
48
90
  if (!loading && chat && scrollRef.current) {
49
- scrollRef.current.scrollTop = scrollRef.current.scrollHeight
91
+ if (prependRef.current !== null) {
92
+ scrollRef.current.scrollTop += scrollRef.current.scrollHeight - prependRef.current
93
+ prependRef.current = null
94
+ } else {
95
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight
96
+ }
50
97
  }
51
98
  }, [loading, chat])
52
99
 
@@ -107,14 +154,14 @@ export default function ChatSidebar({ chatId, onClose, fetchFn, extraHeader, use
107
154
  </div>
108
155
  )}
109
156
  {chat && !fetchFn && (
110
- <a
111
- href={`${BASE}/api/chats/${encodeURIComponent(chat.id)}/markdown`}
112
- download
157
+ <button
158
+ type="button"
159
+ onClick={() => downloadChatMarkdown(chat.id).catch(() => {})}
113
160
  className="flex items-center gap-1 px-2 py-1 text-[11px] transition shrink-0"
114
161
  style={{ background: 'var(--c-bg3)', color: 'var(--c-text)', border: '1px solid var(--c-border)' }}
115
162
  >
116
163
  <Download size={11} /> .md
117
- </a>
164
+ </button>
118
165
  )}
119
166
  {extraHeader}
120
167
  </div>
@@ -178,6 +225,16 @@ export default function ChatSidebar({ chatId, onClose, fetchFn, extraHeader, use
178
225
  {error ? `Failed to load conversation: ${error}` : 'Conversation not found.'}
179
226
  </div>
180
227
  )}
228
+ {!loading && chat?.prevCursor && (
229
+ <button
230
+ onClick={loadEarlier}
231
+ disabled={loadingEarlier}
232
+ className="w-full text-[11px] py-1.5 transition hover:bg-[var(--c-bg3)]"
233
+ style={{ color: 'var(--c-text2)', border: '1px solid var(--c-border)' }}
234
+ >
235
+ {loadingEarlier ? 'Loading…' : 'Load earlier messages'}
236
+ </button>
237
+ )}
181
238
  {!loading && chat && chat.messages.length === 0 && (
182
239
  <div className="text-[12px] py-12 text-center" style={{ color: 'var(--c-text3)' }}>
183
240
  {chat.encrypted ? '🔒 This conversation is encrypted.' : 'No messages found.'}
package/ui/src/lib/api.js CHANGED
@@ -65,12 +65,72 @@ export async function fetchChats(params = {}) {
65
65
  if (params.folder) q.set('folder', params.folder);
66
66
  if (params.limit) q.set('limit', params.limit);
67
67
  if (params.offset) q.set('offset', params.offset);
68
+ if (params.cursor) q.set('cursor', params.cursor);
68
69
  if (params.named === false) q.set('named', 'false');
69
70
  appendDateParams(q, params);
70
71
  const res = await fetch(`${BASE}/api/chats?${q}`);
71
72
  return res.json();
72
73
  }
73
74
 
75
+ // The landing page in one request: { overview, daily, stats, costs, largeContext, version }.
76
+ // Replaces the overview / daily-activity / dashboard-stats / costs / chats fan-out.
77
+ export async function fetchLanding(params = {}) {
78
+ const q = new URLSearchParams();
79
+ if (params.editor) q.set('editor', params.editor);
80
+ appendDateParams(q, params);
81
+ const qs = q.toString();
82
+ const res = await fetch(`${BASE}/api/landing${qs ? '?' + qs : ''}`);
83
+ if (!res.ok) throw new Error(`landing failed (${res.status})`);
84
+ return res.json();
85
+ }
86
+
87
+ // The house-wide change token Live polls ({ token, sessions }). Reading it ships nothing.
88
+ export async function fetchHouseVersion() {
89
+ const res = await fetch(`${BASE}/api/version`);
90
+ if (!res.ok) throw new Error(`version failed (${res.status})`);
91
+ return res.json();
92
+ }
93
+
94
+ // One session's version ({ version, ... }): the sidebar refetches only when it moves.
95
+ export async function fetchChatVersion(id) {
96
+ const res = await fetch(`${BASE}/api/chats/${encodeURIComponent(id)}/version`);
97
+ if (!res.ok) throw new Error(`chat version failed (${res.status})`);
98
+ return res.json();
99
+ }
100
+
101
+ // A page of a session's turns: { messages, toolCallDetails, prevCursor, nextCursor, ... }.
102
+ export async function fetchChatTurns(id, opts = {}) {
103
+ const q = new URLSearchParams();
104
+ if (opts.cursor) q.set('cursor', opts.cursor);
105
+ if (opts.dir) q.set('dir', opts.dir);
106
+ if (opts.limit) q.set('limit', opts.limit);
107
+ if (opts.agent != null) q.set('agent', opts.agent);
108
+ const res = await fetch(`${BASE}/api/chats/${encodeURIComponent(id)}/turns?${q}`);
109
+ if (!res.ok) throw new Error(`turns failed (${res.status})`);
110
+ return res.json();
111
+ }
112
+
113
+ export async function fetchSearch(query, opts = {}) {
114
+ const q = new URLSearchParams({ q: query });
115
+ if (opts.harness) q.set('harness', opts.harness);
116
+ if (opts.folder) q.set('folder', opts.folder);
117
+ if (opts.match) q.set('match', opts.match);
118
+ if (opts.limit) q.set('limit', opts.limit);
119
+ appendDateParams(q, opts);
120
+ const res = await fetch(`${BASE}/api/search?${q}`);
121
+ return res.json();
122
+ }
123
+
124
+ export async function fetchModels(params = {}) {
125
+ const q = new URLSearchParams();
126
+ if (params.editor) q.set('editor', params.editor);
127
+ if (params.folder) q.set('folder', params.folder);
128
+ appendDateParams(q, params);
129
+ const qs = q.toString();
130
+ const res = await fetch(`${BASE}/api/models${qs ? '?' + qs : ''}`);
131
+ return res.json();
132
+ }
133
+
74
134
  export async function fetchChat(id) {
75
135
  // Some adapters emit ids containing '/' (e.g. Kiro's dir/file fallback) —
76
136
  // encode so the id stays a single path segment for the /api/chats/:id route.
@@ -297,6 +357,22 @@ export async function fetchGSDFile(folder, type, phaseDir) {
297
357
  return res.json();
298
358
  }
299
359
 
360
+ // The chat as markdown, saved as a file. A plain link cannot carry the dashboard's token, so the
361
+ // download goes through fetch (Bearer added by dashboard-token.js) and a blob URL.
362
+ export async function downloadChatMarkdown(id) {
363
+ const res = await fetch(`${BASE}/api/chats/${encodeURIComponent(id)}/markdown`);
364
+ if (!res.ok) throw new Error(`download failed: ${res.status}`);
365
+ const blob = await res.blob();
366
+ const name = /filename="?([^";]+)"?/.exec(res.headers.get('content-disposition') || '')?.[1] || `${id}.md`;
367
+ const a = document.createElement('a');
368
+ a.href = URL.createObjectURL(blob);
369
+ a.download = name;
370
+ document.body.appendChild(a);
371
+ a.click();
372
+ a.remove();
373
+ setTimeout(() => URL.revokeObjectURL(a.href), 1000);
374
+ }
375
+
300
376
  // ── Relay API ──
301
377
 
302
378
  export async function fetchMode() {
@@ -0,0 +1,41 @@
1
+ // The dashboard's token (memhouse/server/dashboard-auth.js). `memhouse dashboard` opens
2
+ // http://127.0.0.1:<port>/#token=<token>: a fragment, which the browser sends to no server and
3
+ // puts in no Referer. On load it moves to sessionStorage, which is scoped to this exact origin
4
+ // (port included) and this tab, and the address bar loses it. Every /api request then carries it
5
+ // as `Authorization: Bearer`. No cookie is set: the server accepts none.
6
+ //
7
+ // sessionStorage can refuse (a browser setting, a sandboxed frame). The token is then kept in
8
+ // memory for this page load only: the page works until it is reloaded.
9
+
10
+ const KEY = 'memhouse_dashboard_token';
11
+ let inMemory = null;
12
+
13
+ /** Take the token from the URL's fragment, keep it for this tab, and remove it from the URL. */
14
+ export function adoptTokenFromHash() {
15
+ const m = /(?:^#|&)token=([0-9a-f]{64})(?:&|$)/.exec(window.location.hash || '');
16
+ if (!m) return;
17
+ inMemory = m[1];
18
+ try { window.sessionStorage.setItem(KEY, m[1]); } catch { /* refused: kept in memory for this load */ }
19
+ window.history.replaceState(null, '', window.location.pathname + window.location.search);
20
+ }
21
+
22
+ export function dashboardToken() {
23
+ try { return window.sessionStorage.getItem(KEY) || inMemory; } catch { return inMemory; }
24
+ }
25
+
26
+ /** Every same-origin /api request gets the Bearer header. Installed once, before the app renders. */
27
+ export function installApiAuth() {
28
+ const original = window.fetch.bind(window);
29
+ window.fetch = (input, init = {}) => {
30
+ const url = new URL(typeof input === 'string' ? input : input.url, window.location.href);
31
+ if (url.origin === window.location.origin && url.pathname.startsWith('/api/')) {
32
+ const token = dashboardToken();
33
+ if (token) {
34
+ const headers = new Headers(init.headers || (typeof input === 'string' ? undefined : input.headers));
35
+ headers.set('Authorization', `Bearer ${token}`);
36
+ init = { ...init, headers };
37
+ }
38
+ }
39
+ return original(input, init);
40
+ };
41
+ }
package/ui/src/main.jsx CHANGED
@@ -3,14 +3,31 @@ import ReactDOM from 'react-dom/client'
3
3
  import { BrowserRouter } from 'react-router-dom'
4
4
  import { ThemeProvider } from './lib/theme'
5
5
  import App from './App'
6
+ import { adoptTokenFromHash, dashboardToken, installApiAuth } from './lib/dashboard-token'
6
7
  import './index.css'
7
8
 
9
+ // Before anything renders or fetches: take the token from the URL and sign every /api request.
10
+ adoptTokenFromHash()
11
+ installApiAuth()
12
+
13
+ // Without the token this page can read nothing: say how to open it, rather than an app of errors.
14
+ function OpenWithCli() {
15
+ return (
16
+ <div style={{ fontFamily: 'system-ui, sans-serif', maxWidth: '34em', margin: '4em auto', lineHeight: 1.5 }}>
17
+ <h1 style={{ fontSize: '1.3em' }}>memhouse dashboard</h1>
18
+ <p>Open the dashboard with <code>memhouse dashboard</code>.</p>
19
+ </div>
20
+ )
21
+ }
22
+
8
23
  ReactDOM.createRoot(document.getElementById('root')).render(
9
24
  <React.StrictMode>
10
- <ThemeProvider>
11
- <BrowserRouter>
12
- <App />
13
- </BrowserRouter>
14
- </ThemeProvider>
25
+ {dashboardToken() ? (
26
+ <ThemeProvider>
27
+ <BrowserRouter>
28
+ <App />
29
+ </BrowserRouter>
30
+ </ThemeProvider>
31
+ ) : <OpenWithCli />}
15
32
  </React.StrictMode>,
16
33
  )