@totalreclaw/mcp-server 2.7.0 → 3.0.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 (58) hide show
  1. package/README.md +47 -7
  2. package/dist/claims-helper.d.ts +79 -31
  3. package/dist/claims-helper.d.ts.map +1 -1
  4. package/dist/claims-helper.js +125 -45
  5. package/dist/claims-helper.js.map +1 -1
  6. package/dist/index.js +177 -40
  7. package/dist/index.js.map +1 -1
  8. package/dist/prompts.d.ts +13 -13
  9. package/dist/prompts.d.ts.map +1 -1
  10. package/dist/prompts.js +111 -178
  11. package/dist/prompts.js.map +1 -1
  12. package/dist/subgraph/store.d.ts +25 -2
  13. package/dist/subgraph/store.d.ts.map +1 -1
  14. package/dist/subgraph/store.js +29 -5
  15. package/dist/subgraph/store.js.map +1 -1
  16. package/dist/tools/consolidate.js +12 -12
  17. package/dist/tools/consolidate.js.map +1 -1
  18. package/dist/tools/debrief.d.ts.map +1 -1
  19. package/dist/tools/debrief.js +11 -3
  20. package/dist/tools/debrief.js.map +1 -1
  21. package/dist/tools/export.d.ts.map +1 -1
  22. package/dist/tools/export.js +61 -12
  23. package/dist/tools/export.js.map +1 -1
  24. package/dist/tools/forget.d.ts +14 -0
  25. package/dist/tools/forget.d.ts.map +1 -1
  26. package/dist/tools/forget.js +8 -2
  27. package/dist/tools/forget.js.map +1 -1
  28. package/dist/tools/import-batch.d.ts.map +1 -1
  29. package/dist/tools/import-batch.js +10 -3
  30. package/dist/tools/import-batch.js.map +1 -1
  31. package/dist/tools/index.d.ts +2 -0
  32. package/dist/tools/index.d.ts.map +1 -1
  33. package/dist/tools/index.js +15 -1
  34. package/dist/tools/index.js.map +1 -1
  35. package/dist/tools/pin.d.ts +8 -0
  36. package/dist/tools/pin.d.ts.map +1 -1
  37. package/dist/tools/pin.js +44 -12
  38. package/dist/tools/pin.js.map +1 -1
  39. package/dist/tools/recall.d.ts.map +1 -1
  40. package/dist/tools/recall.js +63 -10
  41. package/dist/tools/recall.js.map +1 -1
  42. package/dist/tools/remember.d.ts +44 -3
  43. package/dist/tools/remember.d.ts.map +1 -1
  44. package/dist/tools/remember.js +97 -10
  45. package/dist/tools/remember.js.map +1 -1
  46. package/dist/tools/retype.d.ts +119 -0
  47. package/dist/tools/retype.d.ts.map +1 -0
  48. package/dist/tools/retype.js +360 -0
  49. package/dist/tools/retype.js.map +1 -0
  50. package/dist/tools/set-scope.d.ts +57 -0
  51. package/dist/tools/set-scope.d.ts.map +1 -0
  52. package/dist/tools/set-scope.js +118 -0
  53. package/dist/tools/set-scope.js.map +1 -0
  54. package/dist/v1-types.d.ts +79 -0
  55. package/dist/v1-types.d.ts.map +1 -0
  56. package/dist/v1-types.js +104 -0
  57. package/dist/v1-types.js.map +1 -0
  58. package/package.json +7 -2
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ /**
3
+ * `totalreclaw_set_scope` — set or change the v1 scope of an existing memory.
4
+ *
5
+ * Uses the same supersede pattern as `retype` and `pin`: rebuild the inner
6
+ * claim with the scope override, tombstone the old fact id, write the new
7
+ * one with `superseded_by` linking back.
8
+ *
9
+ * Spec: `docs/specs/totalreclaw/memory-taxonomy-v1.md` §3-new-MCP-tools.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.setScopeToolDefinition = void 0;
13
+ exports.validateSetScopeArgs = validateSetScopeArgs;
14
+ exports.executeSetScope = executeSetScope;
15
+ exports.handleSetScope = handleSetScope;
16
+ exports.handleSetScopeWithDeps = handleSetScopeWithDeps;
17
+ const v1_types_js_1 = require("../v1-types.js");
18
+ const retype_js_1 = require("./retype.js");
19
+ const SET_SCOPE_DESCRIPTION = 'Re-tag memory under different life-domain scope (work|personal|health|family|creative|finance|misc|unspecified).\n' +
20
+ '\nINVOKE WHEN USER SAYS:\n' +
21
+ '- "actually that\'s work context, not personal"\n' +
22
+ '- "file that under health" / "move to finance"\n' +
23
+ '- "wrong scope — about my kids, not work"\n' +
24
+ '\nDOES: builds v1 claim with new scope, links via superseded_by, tombstones original. Idempotent.\n' +
25
+ '\nWHEN NOT TO USE:\n' +
26
+ '- memory wrong → totalreclaw_forget + totalreclaw_remember\n' +
27
+ '- type wrong (not scope) → totalreclaw_retype';
28
+ exports.setScopeToolDefinition = {
29
+ name: 'totalreclaw_set_scope',
30
+ description: SET_SCOPE_DESCRIPTION,
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ memory_id: {
35
+ type: 'string',
36
+ description: 'The ID of the memory to retag (from a prior totalreclaw_recall result).',
37
+ },
38
+ scope: {
39
+ type: 'string',
40
+ enum: [...v1_types_js_1.VALID_MEMORY_SCOPES],
41
+ description: 'New scope value. One of: work, personal, health, family, creative, finance, misc, unspecified.',
42
+ },
43
+ },
44
+ required: ['memory_id', 'scope'],
45
+ },
46
+ annotations: {
47
+ readOnlyHint: false,
48
+ destructiveHint: false,
49
+ idempotentHint: true,
50
+ },
51
+ };
52
+ function validateSetScopeArgs(args) {
53
+ if (!args || typeof args !== 'object') {
54
+ return {
55
+ ok: false,
56
+ memoryId: '',
57
+ scope: 'unspecified',
58
+ error: 'Invalid input: memory_id and scope are required',
59
+ };
60
+ }
61
+ const record = args;
62
+ const memoryId = record.memory_id;
63
+ if (typeof memoryId !== 'string' || memoryId.trim().length === 0) {
64
+ return {
65
+ ok: false,
66
+ memoryId: '',
67
+ scope: 'unspecified',
68
+ error: 'Invalid input: memory_id must be a non-empty string',
69
+ };
70
+ }
71
+ const scope = record.scope;
72
+ if (typeof scope !== 'string' || !v1_types_js_1.VALID_MEMORY_SCOPES.includes(scope)) {
73
+ return {
74
+ ok: false,
75
+ memoryId: memoryId.trim(),
76
+ scope: 'unspecified',
77
+ error: `Invalid input: scope must be one of ${v1_types_js_1.VALID_MEMORY_SCOPES.join(', ')}`,
78
+ };
79
+ }
80
+ return {
81
+ ok: true,
82
+ memoryId: memoryId.trim(),
83
+ scope: scope,
84
+ error: '',
85
+ };
86
+ }
87
+ async function executeSetScope(memoryId, newScope, deps) {
88
+ return (0, retype_js_1.executeMetadataOp)(memoryId, deps, (e) => e.scope ?? 'unspecified', (cur, next) => cur === next, (e, next) => ({
89
+ text: e.text,
90
+ type: e.type,
91
+ source: e.source,
92
+ scope: next,
93
+ volatility: e.volatility,
94
+ reasoning: e.reasoning,
95
+ importance: e.importance,
96
+ confidence: e.confidence,
97
+ createdAt: e.createdAt,
98
+ supersededBy: memoryId,
99
+ }), newScope, 'set_scope');
100
+ }
101
+ async function handleSetScope(args) {
102
+ const validation = validateSetScopeArgs(args);
103
+ if (!validation.ok) {
104
+ return errorResponse(validation.error);
105
+ }
106
+ return errorResponse('Set-scope is only supported with the managed service. Self-hosted mode does not yet implement v1 supersession.');
107
+ }
108
+ async function handleSetScopeWithDeps(args, deps) {
109
+ const validation = validateSetScopeArgs(args);
110
+ if (!validation.ok)
111
+ return errorResponse(validation.error);
112
+ const result = await executeSetScope(validation.memoryId, validation.scope, deps);
113
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
114
+ }
115
+ function errorResponse(error) {
116
+ return { content: [{ type: 'text', text: JSON.stringify({ success: false, error }) }] };
117
+ }
118
+ //# sourceMappingURL=set-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-scope.js","sourceRoot":"","sources":["../../src/tools/set-scope.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAwDH,oDAkCC;AAED,0CAyBC;AAED,wCAUC;AAED,wDAQC;AAzID,gDAGwB;AACxB,2CAIqB;AAErB,MAAM,qBAAqB,GACzB,oHAAoH;IACpH,4BAA4B;IAC5B,mDAAmD;IACnD,kDAAkD;IAClD,6CAA6C;IAC7C,qGAAqG;IACrG,sBAAsB;IACtB,8DAA8D;IAC9D,+CAA+C,CAAC;AAErC,QAAA,sBAAsB,GAAG;IACpC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YAC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,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,CAAC,EAAE;QAAE,OAAO,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAClF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Memory Taxonomy v1 — client-side TypeScript mirrors of the canonical
3
+ * enums defined in `rust/totalreclaw-core/src/claims.rs`.
4
+ *
5
+ * Single source of truth for MCP code that accepts / validates v1 fields on
6
+ * the way in from the tool schema. The actual (de)serialization goes through
7
+ * `@totalreclaw/core`'s `validateMemoryClaimV1` / `parseMemoryTypeV1` /
8
+ * `parseMemorySource` — this module only covers the string enumerations
9
+ * so callers can narrow `unknown` tool args without round-tripping WASM.
10
+ *
11
+ * Spec: `docs/specs/totalreclaw/memory-taxonomy-v1.md`.
12
+ */
13
+ /** Closed enum of v1 speech-act-grounded memory types. */
14
+ export declare const VALID_MEMORY_TYPES_V1: readonly ["claim", "preference", "directive", "commitment", "episode", "summary"];
15
+ export type MemoryTypeV1 = (typeof VALID_MEMORY_TYPES_V1)[number];
16
+ /** Provenance source for a memory claim (Tier 1 retrieval signal). */
17
+ export declare const VALID_MEMORY_SOURCES: readonly ["user", "user-inferred", "assistant", "external", "derived"];
18
+ export type MemorySource = (typeof VALID_MEMORY_SOURCES)[number];
19
+ /**
20
+ * Life-domain scope for a memory claim. The enum is open-extensible per the
21
+ * v1 spec, but every v1-compliant client MUST accept these eight values when
22
+ * reading from a vault written by another client.
23
+ */
24
+ export declare const VALID_MEMORY_SCOPES: readonly ["work", "personal", "health", "family", "creative", "finance", "misc", "unspecified"];
25
+ export type MemoryScope = (typeof VALID_MEMORY_SCOPES)[number];
26
+ /** Temporal stability of a memory claim (assigned in comparative rescoring pass). */
27
+ export declare const VALID_MEMORY_VOLATILITIES: readonly ["stable", "updatable", "ephemeral"];
28
+ export type MemoryVolatility = (typeof VALID_MEMORY_VOLATILITIES)[number];
29
+ /** Entity reference inside a v1 claim. */
30
+ export interface MemoryEntityV1 {
31
+ name: string;
32
+ type: 'person' | 'project' | 'tool' | 'company' | 'concept' | 'place';
33
+ role?: string;
34
+ }
35
+ /**
36
+ * The encrypted-blob payload for protobuf v4. Written as UTF-8 JSON inside
37
+ * the XChaCha20-Poly1305 envelope. Matches `MemoryClaimV1` in the Rust core.
38
+ */
39
+ export interface MemoryClaimV1 {
40
+ id: string;
41
+ text: string;
42
+ type: MemoryTypeV1;
43
+ source: MemorySource;
44
+ created_at: string;
45
+ schema_version: '1.0';
46
+ scope?: MemoryScope;
47
+ volatility?: MemoryVolatility;
48
+ entities?: MemoryEntityV1[];
49
+ reasoning?: string;
50
+ expires_at?: string;
51
+ importance?: number;
52
+ confidence?: number;
53
+ superseded_by?: string;
54
+ }
55
+ /** v1 inner-blob schema version — must match the Rust core constant. */
56
+ export declare const MEMORY_CLAIM_V1_SCHEMA_VERSION: "1.0";
57
+ /** Outer protobuf wrapper version that signals "inner blob is v1 JSON". */
58
+ export declare const PROTOBUF_WRAPPER_VERSION_V1: 4;
59
+ export declare function isValidMemoryTypeV1(value: unknown): value is MemoryTypeV1;
60
+ export declare function isValidMemorySource(value: unknown): value is MemorySource;
61
+ export declare function isValidMemoryScope(value: unknown): value is MemoryScope;
62
+ export declare function isValidMemoryVolatility(value: unknown): value is MemoryVolatility;
63
+ /**
64
+ * Map a legacy v0 type (8-type taxonomy) to its v1 replacement. Reference
65
+ * table from `docs/specs/totalreclaw/memory-taxonomy-v1.md` §migration-from-v0.
66
+ *
67
+ * Callers should inspect the source fact and populate `reasoning` separately
68
+ * when they see a legacy `decision` type (v1 merges decision → claim with the
69
+ * rationale captured in the `reasoning` field).
70
+ */
71
+ export declare const LEGACY_TYPE_TO_V1: Record<string, MemoryTypeV1>;
72
+ /**
73
+ * Map a v1 type back to its legacy short-form category key used in v0 blobs
74
+ * (`{c: "pref"}` etc). The ZeroClaw + plugin read paths still emit these
75
+ * short keys for back-compat; we expose the same mapping so MCP reports
76
+ * uniform category strings in recall output regardless of blob version.
77
+ */
78
+ export declare const V1_TYPE_TO_SHORT_CATEGORY: Record<MemoryTypeV1, string>;
79
+ //# sourceMappingURL=v1-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1-types.d.ts","sourceRoot":"","sources":["../src/v1-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,mFAOxB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,wEAMvB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iGAStB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,+CAAgD,CAAC;AAEvF,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,0C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1D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAOlE,CAAC"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /**
3
+ * Memory Taxonomy v1 — client-side TypeScript mirrors of the canonical
4
+ * enums defined in `rust/totalreclaw-core/src/claims.rs`.
5
+ *
6
+ * Single source of truth for MCP code that accepts / validates v1 fields on
7
+ * the way in from the tool schema. The actual (de)serialization goes through
8
+ * `@totalreclaw/core`'s `validateMemoryClaimV1` / `parseMemoryTypeV1` /
9
+ * `parseMemorySource` — this module only covers the string enumerations
10
+ * so callers can narrow `unknown` tool args without round-tripping WASM.
11
+ *
12
+ * Spec: `docs/specs/totalreclaw/memory-taxonomy-v1.md`.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.V1_TYPE_TO_SHORT_CATEGORY = exports.LEGACY_TYPE_TO_V1 = exports.PROTOBUF_WRAPPER_VERSION_V1 = exports.MEMORY_CLAIM_V1_SCHEMA_VERSION = exports.VALID_MEMORY_VOLATILITIES = exports.VALID_MEMORY_SCOPES = exports.VALID_MEMORY_SOURCES = exports.VALID_MEMORY_TYPES_V1 = void 0;
16
+ exports.isValidMemoryTypeV1 = isValidMemoryTypeV1;
17
+ exports.isValidMemorySource = isValidMemorySource;
18
+ exports.isValidMemoryScope = isValidMemoryScope;
19
+ exports.isValidMemoryVolatility = isValidMemoryVolatility;
20
+ /** Closed enum of v1 speech-act-grounded memory types. */
21
+ exports.VALID_MEMORY_TYPES_V1 = [
22
+ 'claim',
23
+ 'preference',
24
+ 'directive',
25
+ 'commitment',
26
+ 'episode',
27
+ 'summary',
28
+ ];
29
+ /** Provenance source for a memory claim (Tier 1 retrieval signal). */
30
+ exports.VALID_MEMORY_SOURCES = [
31
+ 'user',
32
+ 'user-inferred',
33
+ 'assistant',
34
+ 'external',
35
+ 'derived',
36
+ ];
37
+ /**
38
+ * Life-domain scope for a memory claim. The enum is open-extensible per the
39
+ * v1 spec, but every v1-compliant client MUST accept these eight values when
40
+ * reading from a vault written by another client.
41
+ */
42
+ exports.VALID_MEMORY_SCOPES = [
43
+ 'work',
44
+ 'personal',
45
+ 'health',
46
+ 'family',
47
+ 'creative',
48
+ 'finance',
49
+ 'misc',
50
+ 'unspecified',
51
+ ];
52
+ /** Temporal stability of a memory claim (assigned in comparative rescoring pass). */
53
+ exports.VALID_MEMORY_VOLATILITIES = ['stable', 'updatable', 'ephemeral'];
54
+ /** v1 inner-blob schema version — must match the Rust core constant. */
55
+ exports.MEMORY_CLAIM_V1_SCHEMA_VERSION = '1.0';
56
+ /** Outer protobuf wrapper version that signals "inner blob is v1 JSON". */
57
+ exports.PROTOBUF_WRAPPER_VERSION_V1 = 4;
58
+ // ── Runtime type guards ──────────────────────────────────────────────────────
59
+ function isValidMemoryTypeV1(value) {
60
+ return typeof value === 'string' && exports.VALID_MEMORY_TYPES_V1.includes(value);
61
+ }
62
+ function isValidMemorySource(value) {
63
+ return typeof value === 'string' && exports.VALID_MEMORY_SOURCES.includes(value);
64
+ }
65
+ function isValidMemoryScope(value) {
66
+ return typeof value === 'string' && exports.VALID_MEMORY_SCOPES.includes(value);
67
+ }
68
+ function isValidMemoryVolatility(value) {
69
+ return typeof value === 'string' && exports.VALID_MEMORY_VOLATILITIES.includes(value);
70
+ }
71
+ // ── Legacy-type migration helper (for import adapters) ──────────────────────
72
+ /**
73
+ * Map a legacy v0 type (8-type taxonomy) to its v1 replacement. Reference
74
+ * table from `docs/specs/totalreclaw/memory-taxonomy-v1.md` §migration-from-v0.
75
+ *
76
+ * Callers should inspect the source fact and populate `reasoning` separately
77
+ * when they see a legacy `decision` type (v1 merges decision → claim with the
78
+ * rationale captured in the `reasoning` field).
79
+ */
80
+ exports.LEGACY_TYPE_TO_V1 = {
81
+ fact: 'claim',
82
+ context: 'claim',
83
+ decision: 'claim',
84
+ preference: 'preference',
85
+ rule: 'directive',
86
+ goal: 'commitment',
87
+ episodic: 'episode',
88
+ summary: 'summary',
89
+ };
90
+ /**
91
+ * Map a v1 type back to its legacy short-form category key used in v0 blobs
92
+ * (`{c: "pref"}` etc). The ZeroClaw + plugin read paths still emit these
93
+ * short keys for back-compat; we expose the same mapping so MCP reports
94
+ * uniform category strings in recall output regardless of blob version.
95
+ */
96
+ exports.V1_TYPE_TO_SHORT_CATEGORY = {
97
+ claim: 'claim',
98
+ preference: 'pref',
99
+ directive: 'rule', // legacy short-form is `rule`
100
+ commitment: 'goal',
101
+ episode: 'epi',
102
+ summary: 'sum',
103
+ };
104
+ //# sourceMappingURL=v1-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1-types.js","sourceRoot":"","sources":["../src/v1-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA2FH,kDAEC;AAED,kDAEC;AAED,gDAEC;AAED,0DAEC;AAvGD,0DAA0D;AAC7C,QAAA,qBAAqB,GAAG;IACnC,OAAO;IACP,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,SAAS;IACT,SAAS;CACD,CAAC;AAIX,sEAAsE;AACzD,QAAA,oBAAoB,GAAG;IAClC,MAAM;IACN,eAAe;IACf,WAAW;IACX,UAAU;IACV,SAAS;CACD,CAAC;AAIX;;;;GAIG;AACU,QAAA,mBAAmB,GAAG;IACjC,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,MAAM;IACN,aAAa;CACL,CAAC;AAIX,qFAAqF;AACxE,QAAA,yBAAyB,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAU,CAAC;AAuCvF,wEAAwE;AAC3D,QAAA,8BAA8B,GAAG,KAAc,CAAC;AAE7D,2EAA2E;AAC9D,QAAA,2BAA2B,GAAG,CAAU,CAAC;AAEtD,gFAAgF;AAEhF,SAAgB,mBAAmB,CAAC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,6BAA2C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnG,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,4BAA0C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAClG,CAAC;AAED,SAAgB,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,2BAAyC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACjG,CAAC;AAED,SAAgB,uBAAuB,CAAC,KAAc;IACpD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,iCAA+C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvG,CAAC;AAED,+EAA+E;AAE/E;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAiC;IAC7D,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF;;;;;GAKG;AACU,QAAA,yBAAyB,GAAiC;IACrE,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,MAAM,EAAE,8BAA8B;IACjD,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;CACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totalreclaw/mcp-server",
3
- "version": "2.7.0",
3
+ "version": "3.0.1",
4
4
  "description": "End-to-end encrypted memory for AI agents — portable, yours forever. MCP server with XChaCha20-Poly1305 E2EE, semantic search, import/export, and on-chain storage",
5
5
  "homepage": "https://totalreclaw.xyz",
6
6
  "main": "dist/index.js",
@@ -39,12 +39,17 @@
39
39
  "@noble/hashes": "^2.0.1",
40
40
  "@scure/bip39": "^2.0.1",
41
41
  "@totalreclaw/client": "^1.2.0",
42
- "@totalreclaw/core": "^1.4.0",
42
+ "@totalreclaw/core": "^2.0.0",
43
43
  "permissionless": "^0.3.4",
44
44
  "porter-stemmer": "^0.9.1",
45
45
  "tslib": "^2.8.1",
46
46
  "viem": "^2.47.0"
47
47
  },
48
+ "overrides": {
49
+ "permissionless": {
50
+ "ox": "^0.14.17"
51
+ }
52
+ },
48
53
  "devDependencies": {
49
54
  "@types/jest": "^29.5.0",
50
55
  "@types/node": "^20.11.0",