hippo-memory 1.12.4 → 1.12.6

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 (39) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +106 -3
  3. package/dist/cli.js.map +1 -1
  4. package/dist/connectors/slack/ingest.d.ts.map +1 -1
  5. package/dist/connectors/slack/ingest.js +8 -1
  6. package/dist/connectors/slack/ingest.js.map +1 -1
  7. package/dist/connectors/slack/workspaces.d.ts +48 -0
  8. package/dist/connectors/slack/workspaces.d.ts.map +1 -0
  9. package/dist/connectors/slack/workspaces.js +60 -0
  10. package/dist/connectors/slack/workspaces.js.map +1 -0
  11. package/dist/owner-validation.d.ts +43 -0
  12. package/dist/owner-validation.d.ts.map +1 -0
  13. package/dist/owner-validation.js +56 -0
  14. package/dist/owner-validation.js.map +1 -0
  15. package/dist/server.d.ts.map +1 -1
  16. package/dist/server.js +11 -1
  17. package/dist/server.js.map +1 -1
  18. package/dist/src/cli.js +106 -3
  19. package/dist/src/cli.js.map +1 -1
  20. package/dist/src/connectors/slack/ingest.js +8 -1
  21. package/dist/src/connectors/slack/ingest.js.map +1 -1
  22. package/dist/src/connectors/slack/workspaces.js +60 -0
  23. package/dist/src/connectors/slack/workspaces.js.map +1 -0
  24. package/dist/src/owner-validation.js +56 -0
  25. package/dist/src/owner-validation.js.map +1 -0
  26. package/dist/src/server.js +11 -1
  27. package/dist/src/server.js.map +1 -1
  28. package/dist/src/store.js +24 -4
  29. package/dist/src/store.js.map +1 -1
  30. package/dist/src/version.js +1 -1
  31. package/dist/store.d.ts.map +1 -1
  32. package/dist/store.js +24 -4
  33. package/dist/store.js.map +1 -1
  34. package/dist/version.d.ts +1 -1
  35. package/dist/version.js +1 -1
  36. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  37. package/extensions/openclaw-plugin/package.json +1 -1
  38. package/openclaw.plugin.json +1 -1
  39. package/package.json +1 -1
package/dist/src/cli.js CHANGED
@@ -67,9 +67,11 @@ import { multihopSearch } from './multihop.js';
67
67
  import { getReranker } from './rerankers/index.js';
68
68
  import { computeSalience } from './salience.js';
69
69
  import { computeAmbientState, renderAmbientSummary } from './ambient.js';
70
+ import { validateOwner, isStrictOwnerEnv } from './owner-validation.js';
70
71
  import { listDlq, replayDlqEntry } from './connectors/slack/dlq.js';
71
72
  import { backfillChannel } from './connectors/slack/backfill.js';
72
73
  import { slackHistoryFetcher } from './connectors/slack/web-client.js';
74
+ import { addWorkspace as addSlackWorkspace, listWorkspaces as listSlackWorkspaces, removeWorkspace as removeSlackWorkspace, } from './connectors/slack/workspaces.js';
73
75
  import { cmdGithub } from './connectors/github/cli-impl.js';
74
76
  // ---------------------------------------------------------------------------
75
77
  // Helpers
@@ -529,7 +531,15 @@ async function cmdRemember(hippoRoot, text, flags) {
529
531
  console.error(`(kind='raw' is reserved for ingestion connectors; kind='archived' is internal.)`);
530
532
  process.exit(1);
531
533
  }
532
- const ownerFlag = typeof flags['owner'] === 'string' ? flags['owner'] : null;
534
+ const ownerRaw = typeof flags['owner'] === 'string' ? flags['owner'] : null;
535
+ const ownerCheck = validateOwner(ownerRaw, { strict: isStrictOwnerEnv() });
536
+ if (!ownerCheck.ok) {
537
+ console.error(ownerCheck.message);
538
+ process.exit(1);
539
+ }
540
+ if (ownerCheck.message)
541
+ console.error(ownerCheck.message);
542
+ const ownerFlag = ownerCheck.value ?? null;
533
543
  const artifactRefFlag = typeof flags['artifact-ref'] === 'string' ? flags['artifact-ref'] : null;
534
544
  const scopeForEnvelope = typeof flags['scope'] === 'string' ? flags['scope'].trim() || null : null;
535
545
  // A5 stub auth: stamp tenant_id from env (HIPPO_TENANT) so recall isolation
@@ -4567,6 +4577,71 @@ function cmdSlackDlqReplay(hippoRoot, args, flags) {
4567
4577
  }
4568
4578
  console.log(`replay ok: status=${result.status} memory_id=${result.memoryId ?? '(none)'} retry_count=${result.retryCount}`);
4569
4579
  }
4580
+ function printSlackWorkspacesUsage() {
4581
+ console.log('hippo slack workspaces <add|list|remove> [options]');
4582
+ console.log(' add --team <T> --tenant <t> Register a workspace (upserts on existing team-id)');
4583
+ console.log(' list List all registered workspaces');
4584
+ console.log(' remove --team <T> Remove a workspace registration');
4585
+ }
4586
+ function cmdSlackWorkspacesAdd(hippoRoot, flags) {
4587
+ if (flags['help']) {
4588
+ printSlackWorkspacesUsage();
4589
+ return;
4590
+ }
4591
+ const teamId = typeof flags['team'] === 'string' ? flags['team'].trim() : '';
4592
+ const tenantId = typeof flags['tenant'] === 'string' ? flags['tenant'].trim() : '';
4593
+ if (!teamId || !tenantId) {
4594
+ console.error('Usage: hippo slack workspaces add --team <T> --tenant <t>');
4595
+ process.exit(1);
4596
+ }
4597
+ const db = openHippoDb(hippoRoot);
4598
+ try {
4599
+ const ws = addSlackWorkspace(db, { teamId, tenantId });
4600
+ console.log(`added: ${ws.teamId} -> ${ws.tenantId} (${ws.addedAt})`);
4601
+ }
4602
+ finally {
4603
+ closeHippoDb(db);
4604
+ }
4605
+ }
4606
+ function cmdSlackWorkspacesList(hippoRoot) {
4607
+ const db = openHippoDb(hippoRoot);
4608
+ try {
4609
+ const items = listSlackWorkspaces(db);
4610
+ if (items.length === 0) {
4611
+ console.log('(no registered workspaces; routing via HIPPO_TENANT fallback)');
4612
+ return;
4613
+ }
4614
+ for (const ws of items) {
4615
+ console.log(`${ws.teamId}\t${ws.tenantId}\t${ws.addedAt}`);
4616
+ }
4617
+ }
4618
+ finally {
4619
+ closeHippoDb(db);
4620
+ }
4621
+ }
4622
+ function cmdSlackWorkspacesRemove(hippoRoot, flags) {
4623
+ if (flags['help']) {
4624
+ printSlackWorkspacesUsage();
4625
+ return;
4626
+ }
4627
+ const teamId = typeof flags['team'] === 'string' ? flags['team'].trim() : '';
4628
+ if (!teamId) {
4629
+ console.error('Usage: hippo slack workspaces remove --team <T>');
4630
+ process.exit(1);
4631
+ }
4632
+ const db = openHippoDb(hippoRoot);
4633
+ try {
4634
+ const removed = removeSlackWorkspace(db, teamId);
4635
+ if (!removed) {
4636
+ console.error(`no workspace registered for team ${teamId}`);
4637
+ process.exit(1);
4638
+ }
4639
+ console.log(`removed: ${teamId}`);
4640
+ }
4641
+ finally {
4642
+ closeHippoDb(db);
4643
+ }
4644
+ }
4570
4645
  function cmdSlack(hippoRoot, args, flags) {
4571
4646
  const sub = args[0];
4572
4647
  if (sub === 'backfill') {
@@ -4581,7 +4656,24 @@ function cmdSlack(hippoRoot, args, flags) {
4581
4656
  cmdSlackDlqReplay(hippoRoot, args, flags);
4582
4657
  return;
4583
4658
  }
4584
- console.error('Usage: hippo slack <backfill|dlq list|dlq replay <id> [--force]> [...]');
4659
+ if (sub === 'workspaces') {
4660
+ const action = args[1];
4661
+ if (action === 'add') {
4662
+ cmdSlackWorkspacesAdd(hippoRoot, flags);
4663
+ return;
4664
+ }
4665
+ if (action === 'list') {
4666
+ cmdSlackWorkspacesList(hippoRoot);
4667
+ return;
4668
+ }
4669
+ if (action === 'remove') {
4670
+ cmdSlackWorkspacesRemove(hippoRoot, flags);
4671
+ return;
4672
+ }
4673
+ printSlackWorkspacesUsage();
4674
+ process.exit(1);
4675
+ }
4676
+ console.error('Usage: hippo slack <backfill|dlq list|dlq replay <id> [--force]|workspaces add|workspaces list|workspaces remove> [...]');
4585
4677
  process.exit(1);
4586
4678
  }
4587
4679
  function printUsage() {
@@ -4983,12 +5075,23 @@ async function main() {
4983
5075
  const tags = Array.isArray(tagsRaw)
4984
5076
  ? tagsRaw.map(String)
4985
5077
  : typeof tagsRaw === 'string' ? [tagsRaw] : undefined;
5078
+ // B2 v1.12.6 — validate --owner on the thin-client path too.
5079
+ // Failure on this path exits early so the user gets the same
5080
+ // validation experience whether or not a server is up.
5081
+ const thinOwnerRaw = typeof flags['owner'] === 'string' ? flags['owner'] : undefined;
5082
+ const thinOwnerCheck = validateOwner(thinOwnerRaw, { strict: isStrictOwnerEnv() });
5083
+ if (!thinOwnerCheck.ok) {
5084
+ console.error(thinOwnerCheck.message);
5085
+ process.exit(1);
5086
+ }
5087
+ if (thinOwnerCheck.message)
5088
+ console.error(thinOwnerCheck.message);
4986
5089
  const remembered = await runViaServerIfAvailable(hippoRoot, async (info, apiKey) => {
4987
5090
  const result = await client.remember(info.url, apiKey, {
4988
5091
  content: text,
4989
5092
  kind: rememberKindRaw,
4990
5093
  scope: typeof flags['scope'] === 'string' ? flags['scope'] : undefined,
4991
- owner: typeof flags['owner'] === 'string' ? flags['owner'] : undefined,
5094
+ owner: thinOwnerCheck.value,
4992
5095
  artifactRef: typeof flags['artifact-ref'] === 'string' ? flags['artifact-ref'] : undefined,
4993
5096
  tags,
4994
5097
  });