memhouse 0.12.5 → 0.12.7

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.
package/bin/memhouse.js CHANGED
@@ -667,15 +667,13 @@ CREATE USER IF NOT EXISTS ${member} IDENTIFIED BY '${password.replace(/'/g, "\\'
667
667
 
668
668
  ${rooms.trim()}
669
669
 
670
- -- The whole database. ALL on your own house reaches nothing outside it — the database is
671
- -- the boundary — and it is what lets the shipper create and evolve its own tables.
672
- GRANT ALL ON ${db}.* TO ${member};
673
-
674
- -- SELECT again, WITH GRANT OPTION — sharing, made self-serve and read-only by
675
- -- construction. This is what lets the member run \`GRANT SELECT ON ${db}.* TO <friend>\`
676
- -- themselves (/mem:share) without an operator, while the grant-option stops at SELECT:
677
- -- they can open a read-only window into their own memory and can hand on nothing more.
678
- GRANT SELECT ON ${db}.* TO ${member} WITH GRANT OPTION;
670
+ -- The whole database, WITH GRANT OPTION. ALL on your own house reaches nothing outside it
671
+ -- — the database is the boundary — and it lets the shipper create and evolve its own
672
+ -- tables. The grant option makes the member the real owner: they can hand on any of their
673
+ -- own data (\`/mem:share\` still opens only a read-only SELECT window, but the owner is not
674
+ -- boxed into read-only sharing of their own house). Scoped to this db, and no CREATE USER
675
+ -- rides with it — a member still cannot mint accounts or reach another house.
676
+ GRANT ALL ON ${db}.* TO ${member} WITH GRANT OPTION;
679
677
 
680
678
  -- Self-scoped ALTER USER: the member may change THEIR OWN password and no one else's.
681
679
  -- \`ON ${member}\` names exactly this user, so \`memhouse passwd\` needs no admin, and an
@@ -687,6 +685,11 @@ GRANT SELECT ON ${db}.* TO ${member} WITH GRANT OPTION;
687
685
  -- trust model, flagged by \`memhouse doctor\`, and re-asserted on every \`ship --ensure-schema\`.
688
686
  GRANT ALTER USER ON ${member} TO ${member};
689
687
 
688
+ -- See the OTHER members, read-only. SHOW USERS lets \`/mem:users\` list who is on this
689
+ -- ClickHouse (names only — no passwords, no data) so a member can find who to share with.
690
+ -- It grants no read of anyone's rows; reading a housemate's memory still needs /mem:share.
691
+ GRANT SHOW USERS ON *.* TO ${member};
692
+
690
693
  -- Pin async_insert on the user (ADD SETTING merges; a bare SETTINGS clause would replace
691
694
  -- the user's whole list). The pin keeps the user_id stamp honest: a MATERIALIZED
692
695
  -- currentUser() is computed during the INSERT, and an async flush stores it as the empty
@@ -783,11 +786,12 @@ async function adminBootstrap(cfg, admin) {
783
786
  // reaches nothing outside the database, and it is what lets the member's own shipper
784
787
  // create and evolve the rooms (--ensure-schema below).
785
788
  try {
786
- await q(`GRANT ALL ON ${cfg.db}.* TO ${admin.member}`, { database: '' });
787
- // SELECT again, WITH GRANT OPTION: what /mem:share rides on. The member can open a
788
- // read-only window into their OWN house for a housemate-to-be — and can hand on
789
- // nothing more, because the grant option stops at SELECT.
790
- await q(`GRANT SELECT ON ${cfg.db}.* TO ${admin.member} WITH GRANT OPTION`, { database: '' });
789
+ // ALL, WITH GRANT OPTION: the database is theirs, so they may do anything with their
790
+ // own data AND hand any of it on. /mem:share still opens only a read-only window (it
791
+ // grants SELECT), but the owner is not boxed into read-only sharing of their own house.
792
+ // Scoped to their db: the grant option reaches nothing outside it, and no CREATE USER
793
+ // comes with it, so a member still cannot mint accounts or touch another house.
794
+ await q(`GRANT ALL ON ${cfg.db}.* TO ${admin.member} WITH GRANT OPTION`, { database: '' });
791
795
  // Self-scoped ALTER USER — the member owns their own password (memhouse passwd needs
792
796
  // no admin; an invitee can rotate the password the inviter set). Non-escalating: the
793
797
  // grant names this one user, so it reaches no other account. Best-effort: a house on
@@ -795,8 +799,14 @@ async function adminBootstrap(cfg, admin) {
795
799
  // self-rotation.
796
800
  try { await q(`GRANT ALTER USER ON ${admin.member} TO ${admin.member}`, { database: '' }); }
797
801
  catch { /* admin without access-management: passwd stays admin-assisted for this member */ }
802
+ // See the OTHER members, read-only: SHOW USERS lets `/mem:users` list who is on this
803
+ // ClickHouse (names only — no passwords, no data) so a member can find who to share
804
+ // with. It grants no read of anyone's rows; that still needs an explicit /mem:share.
805
+ // Best-effort like ALTER USER above — an admin without access-management just skips it.
806
+ try { await q(`GRANT SHOW USERS ON *.* TO ${admin.member}`, { database: '' }); }
807
+ catch { /* no access-management: /mem:users section 4 stays admin-only for this member */ }
798
808
  await q(`ALTER USER ${admin.member} ADD SETTING ${MEMBER_PIN}`, { database: '' });
799
- console.log(ok(`granted the house: ALL ON ${cfg.db}.* to '${admin.member}', async_insert pinned`));
809
+ console.log(ok(`granted the house: ALL ON ${cfg.db}.* to '${admin.member}', SHOW USERS, async_insert pinned`));
800
810
  } catch (e) {
801
811
  console.log(bad(`could not grant the house to '${admin.member}': ${e.message}`));
802
812
  if (createdUser) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mem",
3
3
  "description": "Conversation memory for AI agents over the memhouse typed ClickHouse store: ask, search, browse, analyze, check, share, and invite across all 17 supported editors and machines. Skills install as /mem:hello, /mem:ask, /mem:search, /mem:sessions, /mem:share, /mem:invite, /mem:sql, /mem:status, and /mem:users.",
4
- "version": "0.12.5",
4
+ "version": "0.12.7",
5
5
  "author": {
6
6
  "name": "Ramazan Polat"
7
7
  },
@@ -103,5 +103,19 @@ Also worth naming: `memhouse start` serves a dashboard at http://localhost:4640
103
103
  browsing and analytics outside the chat, and everything here is read-only for agents —
104
104
  only the shipper writes.
105
105
 
106
+ **Freshness check** — quietly compare the installed client to the latest release; mention
107
+ it ONLY if there's a real gap (don't clutter the welcome otherwise):
108
+
109
+ ```bash
110
+ INSTALLED=$(memhouse version 2>/dev/null | head -1 | tr -d '[:space:]')
111
+ LATEST=$(curl -sS -m 5 https://registry.npmjs.org/memhouse/latest 2>/dev/null | sed -n 's/.*"version":"\([^"]*\)".*/\1/p')
112
+ echo "installed=${INSTALLED:-unknown} latest=${LATEST:-unknown}"
113
+ ```
114
+
115
+ If the installed version is a MINOR or MAJOR behind (or many patches), add one line:
116
+ "heads-up — you're on 0.A.B, 0.C.D is out; `memhouse update` upgrades it and refreshes
117
+ these `/mem:*` skills." A patch or two behind isn't worth mentioning here. Never run the
118
+ update yourself.
119
+
106
120
  End by offering one concrete action: a search for something they mentioned recently, or
107
121
  `/mem:status` if they seem unsure it's working. One offer, not a menu.
@@ -106,9 +106,34 @@ rows but NO `client_*` record is a **pre-0.10 memhouse still writing** — flag
106
106
  re-ships delete retained parses, and the fixes are upgrade it or (as admin)
107
107
  `REVOKE ALTER DELETE, ALTER UPDATE ON <db>.* FROM <member>`.
108
108
 
109
+ **5. Client freshness** — is the installed memhouse behind the published release? This is a
110
+ shell check, not SQL (it reads the local binary and the npm registry, no house involved):
111
+
112
+ ```bash
113
+ INSTALLED=$(memhouse version 2>/dev/null | head -1 | tr -d '[:space:]')
114
+ LATEST=$(curl -sS -m 5 https://registry.npmjs.org/memhouse/latest 2>/dev/null | sed -n 's/.*"version":"\([^"]*\)".*/\1/p')
115
+ echo "installed=${INSTALLED:-unknown} latest=${LATEST:-unknown}"
116
+ ```
117
+
118
+ Compare the two as `MAJOR.MINOR.PATCH`. Report freshness, and size the nudge to the gap:
119
+
120
+ - **up to date** (installed ≥ latest) — one line: "client 0.X.Y, current."
121
+ - **small gap** (same major+minor, a patch or two behind) — a gentle note: "a newer patch
122
+ 0.X.Z is out; `memhouse update` when convenient."
123
+ - **big gap** (latest MAJOR or MINOR is ahead, or many patches) — surface it prominently and
124
+ **offer to update**: "your memhouse is 0.A.B but 0.C.D is released — run **`memhouse
125
+ update`** to upgrade; it also refreshes the `/mem:*` plugin, then `/reload-plugins`."
126
+ - either side **unknown** (no binary on PATH, or the registry did not answer) — say which,
127
+ don't guess. A plugin-only install with no CLI can't self-update; point at
128
+ `npm i -g memhouse`.
129
+
130
+ Never run `memhouse update` yourself — it restarts daemons and may migrate the house.
131
+ Offer the command; the pilot runs it.
132
+
109
133
  ## Presenting it
110
134
 
111
135
  Lead with one line of verdict ("healthy: N sessions across M editors, last ingest X
112
136
  minutes ago" — or the one thing wrong). Then the per-editor table, then anything from
113
- sections 3–4 that needs action. Skip empty sections; do not pad. If the house is
114
- unreachable, say which URL refused and stop — never guess another endpoint.
137
+ sections 3–5 that needs action. A **big version gap (section 5) is an action** — put the
138
+ `memhouse update` offer near the top, not buried. Skip empty sections; do not pad. If the
139
+ house is unreachable, say which URL refused and stop — never guess another endpoint.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memhouse",
3
- "version": "0.12.5",
3
+ "version": "0.12.7",
4
4
  "description": "memhouse — agent conversation memory across 17 editors: parse-on-client shippers, a typed ClickHouse store with one set of rooms per member, kernel-agency install, and the agentlytics dashboard",
5
5
  "main": "bin/memhouse.js",
6
6
  "bin": {