hippo-memory 1.12.4 → 1.12.5

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.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Slack workspace registration helpers (T2B follow-up, 2026-05-24).
3
+ *
4
+ * The `slack_workspaces` table maps Slack `team_id` → hippo `tenant_id`.
5
+ * Empty table = single-tenant install (HIPPO_TENANT fallback).
6
+ * Non-empty = multi-workspace install (fail-closed routing via
7
+ * `resolveTenantForTeam`).
8
+ *
9
+ * Before T2B, populating this table required direct SQL — fine for a
10
+ * single-machine deployment, awkward for operators with multiple
11
+ * workspaces. These helpers give the CLI (`hippo slack workspaces
12
+ * add|list|remove`) a clean surface.
13
+ *
14
+ * Design choices:
15
+ * - `add` is an upsert (ON CONFLICT UPDATE). Re-registering an
16
+ * existing team_id with a different tenant_id intentionally
17
+ * overwrites — operators move workspaces between tenants and the
18
+ * CLI shouldn't require a delete+add dance.
19
+ * - `list` sorts by team_id for stable output.
20
+ * - `remove` returns a boolean for the CLI to distinguish "removed"
21
+ * from "not found" without an extra SELECT.
22
+ */
23
+ /**
24
+ * Register or re-register a Slack team → tenant mapping. Upserts on
25
+ * team_id conflict (operators move workspaces between tenants).
26
+ */
27
+ export function addWorkspace(db, opts) {
28
+ const addedAt = new Date().toISOString();
29
+ db.prepare(`INSERT INTO slack_workspaces (team_id, tenant_id, added_at)
30
+ VALUES (?, ?, ?)
31
+ ON CONFLICT(team_id) DO UPDATE SET
32
+ tenant_id = excluded.tenant_id,
33
+ added_at = excluded.added_at`).run(opts.teamId, opts.tenantId, addedAt);
34
+ return { teamId: opts.teamId, tenantId: opts.tenantId, addedAt };
35
+ }
36
+ /**
37
+ * List all registered workspaces, sorted by team_id for stable output.
38
+ */
39
+ export function listWorkspaces(db) {
40
+ const rows = db
41
+ .prepare(`SELECT team_id, tenant_id, added_at FROM slack_workspaces ORDER BY team_id`)
42
+ .all();
43
+ return rows.map((r) => ({
44
+ teamId: r.team_id,
45
+ tenantId: r.tenant_id,
46
+ addedAt: r.added_at,
47
+ }));
48
+ }
49
+ /**
50
+ * Remove a workspace registration by team_id. Returns true if a row was
51
+ * deleted, false if no row matched (so the CLI can report not-found
52
+ * without a separate lookup).
53
+ */
54
+ export function removeWorkspace(db, teamId) {
55
+ const result = db
56
+ .prepare(`DELETE FROM slack_workspaces WHERE team_id = ?`)
57
+ .run(teamId);
58
+ return Number(result.changes) > 0;
59
+ }
60
+ //# sourceMappingURL=workspaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../../src/connectors/slack/workspaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAeH;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAoB,EACpB,IAAsB;IAEtB,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,EAAE,CAAC,OAAO,CACR;;;;oCAIgC,CACjC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAoB;IACjD,MAAM,IAAI,GAAG,EAAE;SACZ,OAAO,CACN,4EAA4E,CAC7E;SACA,GAAG,EAAqE,CAAC;IAC5E,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACtB,MAAM,EAAE,CAAC,CAAC,OAAO;QACjB,QAAQ,EAAE,CAAC,CAAC,SAAS;QACrB,OAAO,EAAE,CAAC,CAAC,QAAQ;KACpB,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,EAAoB,EACpB,MAAc;IAEd,MAAM,MAAM,GAAG,EAAE;SACd,OAAO,CAAC,gDAAgD,CAAC;SACzD,GAAG,CAAC,MAAM,CAAC,CAAC;IACf,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC"}
@@ -18,7 +18,7 @@
18
18
  * an ESM `import` can resolve cleanly, and a hardcoded constant survives
19
19
  * any packager that drops .json files.
20
20
  */
21
- export const PACKAGE_VERSION = '1.12.4';
21
+ export const PACKAGE_VERSION = '1.12.5';
22
22
  // Bump on every release alongside the 4 other manifests + lockfile.
23
23
  /**
24
24
  * Compare two semver strings. Returns positive if a > b, 0 if equal, negative
package/dist/version.d.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  * an ESM `import` can resolve cleanly, and a hardcoded constant survives
19
19
  * any packager that drops .json files.
20
20
  */
21
- export declare const PACKAGE_VERSION = "1.12.4";
21
+ export declare const PACKAGE_VERSION = "1.12.5";
22
22
  /**
23
23
  * Compare two semver strings. Returns positive if a > b, 0 if equal, negative
24
24
  * if a < b.
package/dist/version.js CHANGED
@@ -18,7 +18,7 @@
18
18
  * an ESM `import` can resolve cleanly, and a hardcoded constant survives
19
19
  * any packager that drops .json files.
20
20
  */
21
- export const PACKAGE_VERSION = '1.12.4';
21
+ export const PACKAGE_VERSION = '1.12.5';
22
22
  // Bump on every release alongside the 4 other manifests + lockfile.
23
23
  /**
24
24
  * Compare two semver strings. Returns positive if a > b, 0 if equal, negative
@@ -2,7 +2,7 @@
2
2
  "id": "hippo-memory",
3
3
  "name": "Hippo Memory",
4
4
  "description": "Biologically-inspired memory for AI agents. Decay by default, retrieval strengthening, sleep consolidation.",
5
- "version": "1.12.4",
5
+ "version": "1.12.5",
6
6
 
7
7
  "configSchema": {
8
8
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "1.12.4",
3
+ "version": "1.12.5",
4
4
  "description": "Hippo Memory plugin for OpenClaw - biologically-inspired agent memory",
5
5
  "main": "index.ts",
6
6
  "openclaw": {
@@ -2,7 +2,7 @@
2
2
  "id": "hippo-memory",
3
3
  "name": "Hippo Memory",
4
4
  "description": "Biologically-inspired memory for AI agents. Decay by default, retrieval strengthening, sleep consolidation.",
5
- "version": "1.12.4",
5
+ "version": "1.12.5",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "1.12.4",
3
+ "version": "1.12.5",
4
4
  "description": "Biologically-inspired memory system for AI agents. Decay by default, strength through use.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",