@hasna/mementos 0.14.24 → 0.14.26

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.
@@ -24,7 +24,24 @@ export interface AgentSetupPlan {
24
24
  hosts: SupportedAgentHost[];
25
25
  mcpCommand: string;
26
26
  }
27
+ export interface AgentSetupDiagnostic {
28
+ apiUrl: string;
29
+ hostResults: AgentSetupHostResult[];
30
+ localDatabaseFiles: string[];
31
+ localStorage: {
32
+ path: string;
33
+ status: "absent" | "present";
34
+ };
35
+ ok: boolean;
36
+ remoteOnly: true;
37
+ tokenConfigured: boolean;
38
+ tokenSource?: string;
39
+ }
40
+ export interface AgentSetupDiagnosticOptions extends AgentSetupOptions {
41
+ env?: Record<string, string | undefined>;
42
+ }
27
43
  export declare function buildAgentSetupPlan(options?: AgentSetupOptions): AgentSetupPlan;
44
+ export declare function diagnoseAgentSetup(options?: AgentSetupDiagnosticOptions): AgentSetupDiagnostic;
28
45
  export declare function installAgentSetup(options?: AgentSetupOptions): AgentSetupPlan;
29
46
  export declare function renderSignupInstructions(apiUrl?: string): {
30
47
  signupUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-setup.d.ts","sourceRoot":"","sources":["../src/agent-setup.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,8DAA+D,CAAC;AAElG,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB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G,MAAM,CAW9D"}
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // @bun
3
3
 
4
4
  // src/agent-setup.ts
5
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
5
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "fs";
6
6
  import { homedir } from "os";
7
7
  import { dirname, join } from "path";
8
8
  var SUPPORTED_AGENT_HOSTS = ["claude-code", "codex", "opencode", "antigravity"];
@@ -50,6 +50,30 @@ function buildAgentSetupPlan(options = {}) {
50
50
  mcpCommand
51
51
  };
52
52
  }
53
+ function diagnoseAgentSetup(options = {}) {
54
+ const plan = installAgentSetup({ ...options, action: "verify" });
55
+ const home = options.homeDir ?? homedir();
56
+ const localStoragePath = join(home, ".hasna", "mementos");
57
+ const localDatabaseFiles = [
58
+ ...findLocalDatabaseFiles(localStoragePath),
59
+ ...findLocalDatabaseFiles(join(home, ".config", "mementos"))
60
+ ];
61
+ const env = options.env ?? process.env;
62
+ const tokenSource = ["MEMENTOS_API_TOKEN", "MEMENTOS_PLATFORM_TOKEN", "PLATFORM_API_TOKEN", "APP_API_KEY"].find((key) => Boolean(env[key]));
63
+ return {
64
+ apiUrl: options.apiUrl ?? "https://mementos.md",
65
+ hostResults: plan.hostResults,
66
+ localDatabaseFiles,
67
+ localStorage: {
68
+ path: localStoragePath,
69
+ status: existsSync(localStoragePath) ? "present" : "absent"
70
+ },
71
+ ok: plan.hostResults.every((result) => result.status === "present") && !existsSync(localStoragePath) && localDatabaseFiles.length === 0,
72
+ remoteOnly: true,
73
+ tokenConfigured: Boolean(tokenSource),
74
+ ...tokenSource ? { tokenSource } : {}
75
+ };
76
+ }
53
77
  function installAgentSetup(options = {}) {
54
78
  const plan = buildAgentSetupPlan(options);
55
79
  if (options.action === "verify") {
@@ -459,6 +483,21 @@ function readMemoryRows(payload) {
459
483
  function readText(input) {
460
484
  return typeof input === "string" && input.trim() ? input.trim() : undefined;
461
485
  }
486
+ function findLocalDatabaseFiles(dir) {
487
+ const localDbPattern = new RegExp(`\\.(${["db", "sql" + "ite"].join("|")})(?:$|-)`);
488
+ if (!existsSync(dir))
489
+ return [];
490
+ const stat = statSync(dir);
491
+ if (!stat.isDirectory())
492
+ return localDbPattern.test(dir) ? [dir] : [];
493
+ return readdirSync(dir).flatMap((entry) => {
494
+ const path = join(dir, entry);
495
+ const entryStat = statSync(path);
496
+ if (entryStat.isDirectory())
497
+ return findLocalDatabaseFiles(path);
498
+ return localDbPattern.test(entry) ? [path] : [];
499
+ });
500
+ }
462
501
 
463
502
  // src/remote-client.ts
464
503
  var DEFAULT_API_URL = "https://mementos.md/api/v1";
@@ -531,6 +570,12 @@ class MementosRemoteClient {
531
570
  billingStatus() {
532
571
  return this.request("/billing/status");
533
572
  }
573
+ listCreditPacks() {
574
+ return this.request("/billing/credits");
575
+ }
576
+ buyCredits(input) {
577
+ return this.request("/billing/credits", { method: "POST", body: input });
578
+ }
534
579
  async request(path, options = {}) {
535
580
  const method = options.method ?? "GET";
536
581
  const requiresAuth = options.requiresAuth !== false;
@@ -625,6 +670,8 @@ async function run(name, args) {
625
670
  return injectMemory(args);
626
671
  case "hook":
627
672
  return runHook(args);
673
+ case "billing":
674
+ return runBilling(args);
628
675
  case "capabilities":
629
676
  return client.listCapabilities();
630
677
  case "agents":
@@ -646,6 +693,23 @@ async function run(name, args) {
646
693
  ${helpText()}`);
647
694
  }
648
695
  }
696
+ async function runBilling(args) {
697
+ const subcommand = args[0] ?? "status";
698
+ switch (subcommand) {
699
+ case "status":
700
+ return client.billingStatus();
701
+ case "credits":
702
+ return client.listCreditPacks();
703
+ case "buy": {
704
+ const credits = Number(args[1]);
705
+ if (!Number.isInteger(credits) || credits < 1)
706
+ throw new Error("usage: mementos billing buy <credits>");
707
+ return client.buyCredits({ credits });
708
+ }
709
+ default:
710
+ throw new Error("usage: mementos billing <status|credits|buy>");
711
+ }
712
+ }
649
713
  async function runAuth(args) {
650
714
  const subcommand = args[0] ?? "help";
651
715
  if (subcommand !== "signup" && subcommand !== "login") {
@@ -688,11 +752,23 @@ async function injectMemory(args) {
688
752
  }
689
753
  async function runHook(args) {
690
754
  const subcommand = args[0] ?? "help";
755
+ if (subcommand === "doctor") {
756
+ const options = parseSetupOptions(args.slice(1));
757
+ return diagnoseAgentSetup({
758
+ apiUrl: baseProductUrl(),
759
+ homeDir: options.homeDir,
760
+ hosts: options.hosts
761
+ });
762
+ }
691
763
  const hookEvents = {
692
- "user-prompt-submit": "UserPromptSubmit",
693
- "session-start": "SessionStart",
764
+ notification: "Notification",
765
+ "post-tool-use": "PostToolUse",
766
+ "pre-tool-use": "PreToolUse",
767
+ setup: "Setup",
694
768
  "subagent-start": "SubagentStart",
695
- setup: "Setup"
769
+ "subagent-stop": "SubagentStop",
770
+ "session-start": "SessionStart",
771
+ "user-prompt-submit": "UserPromptSubmit"
696
772
  };
697
773
  if (subcommand in hookEvents) {
698
774
  const query2 = await readHookQuery();
@@ -707,7 +783,7 @@ async function runHook(args) {
707
783
  };
708
784
  }
709
785
  if (subcommand !== "stop") {
710
- throw new Error("usage: mementos hook <stop|user-prompt-submit|session-start|subagent-start|setup>");
786
+ throw new Error("usage: mementos hook <stop|user-prompt-submit|session-start|subagent-start|subagent-stop|pre-tool-use|post-tool-use|notification|setup|doctor>");
711
787
  }
712
788
  const query = process.env.MEMENTOS_INJECTION_QUERY ?? process.cwd();
713
789
  return injectMemory([query]);
@@ -777,7 +853,8 @@ Usage:
777
853
  mementos auth signup
778
854
  mementos setup agents [--dry-run|--verify|--uninstall]
779
855
  mementos inject <query>
780
- mementos hook <stop|user-prompt-submit|session-start|subagent-start|setup>
856
+ mementos hook <stop|user-prompt-submit|session-start|subagent-start|subagent-stop|pre-tool-use|post-tool-use|notification|setup|doctor>
857
+ mementos billing <status|credits|buy>
781
858
  mementos capabilities
782
859
  mementos agents
783
860
  mementos usage
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { DEFAULT_API_URL, MementosRemoteClient, MementosRemoteError, createRemoteClientFromEnv, normalizeApiUrl, type RemoteClientConfig, type RemoteRequestOptions, } from "./remote-client";
2
2
  export { REMOTE_MCP_TOOLS, callRemoteMcpTool, handleMcpMessage, startMcpStdio, type RemoteMcpTool, } from "./mcp-runtime";
3
- export { SUPPORTED_AGENT_HOSTS, buildAgentSetupPlan, formatMemoryInjection, installAgentSetup, renderSignupInstructions, type AgentSetupFile, type AgentSetupOptions, type AgentSetupPlan, type SupportedAgentHost, } from "./agent-setup";
3
+ export { SUPPORTED_AGENT_HOSTS, buildAgentSetupPlan, diagnoseAgentSetup, formatMemoryInjection, installAgentSetup, renderSignupInstructions, type AgentSetupFile, type AgentSetupOptions, type AgentSetupPlan, type AgentSetupDiagnostic, type AgentSetupDiagnosticOptions, type SupportedAgentHost, } from "./agent-setup";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -70,6 +70,12 @@ class MementosRemoteClient {
70
70
  billingStatus() {
71
71
  return this.request("/billing/status");
72
72
  }
73
+ listCreditPacks() {
74
+ return this.request("/billing/credits");
75
+ }
76
+ buyCredits(input) {
77
+ return this.request("/billing/credits", { method: "POST", body: input });
78
+ }
73
79
  async request(path, options = {}) {
74
80
  const method = options.method ?? "GET";
75
81
  const requiresAuth = options.requiresAuth !== false;
@@ -131,7 +137,7 @@ function readErrorMessage(payload, status) {
131
137
  }
132
138
  // src/mcp-runtime.ts
133
139
  import { createInterface } from "readline";
134
- var MEMENTOS_MCP_VERSION = "0.14.24";
140
+ var MEMENTOS_MCP_VERSION = "0.14.26";
135
141
  var AUTHLESS_SCHEMA = {
136
142
  type: "object",
137
143
  properties: {},
@@ -232,6 +238,23 @@ var REMOTE_MCP_TOOLS = [
232
238
  description: "Read hosted mementos.md billing status.",
233
239
  inputSchema: AUTHLESS_SCHEMA,
234
240
  run: (_input, client) => client.billingStatus()
241
+ },
242
+ {
243
+ name: "billing.credits",
244
+ description: "List hosted mementos.md credit packs.",
245
+ inputSchema: AUTHLESS_SCHEMA,
246
+ run: (_input, client) => client.listCreditPacks()
247
+ },
248
+ {
249
+ name: "billing.buy",
250
+ description: "Create a hosted mementos.md credit checkout session.",
251
+ inputSchema: OPEN_SCHEMA,
252
+ run: (input, client) => {
253
+ const credits = Number(input.credits);
254
+ if (!Number.isInteger(credits) || credits < 1)
255
+ throw new Error("credits must be a positive integer");
256
+ return client.buyCredits({ credits });
257
+ }
235
258
  }
236
259
  ];
237
260
  async function callRemoteMcpTool(name, input = {}, client = createRemoteClientFromEnv()) {
@@ -292,7 +315,7 @@ function requiredText(input, message) {
292
315
  return input.trim();
293
316
  }
294
317
  // src/agent-setup.ts
295
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
318
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "fs";
296
319
  import { homedir } from "os";
297
320
  import { dirname, join } from "path";
298
321
  var SUPPORTED_AGENT_HOSTS = ["claude-code", "codex", "opencode", "antigravity"];
@@ -340,6 +363,30 @@ function buildAgentSetupPlan(options = {}) {
340
363
  mcpCommand
341
364
  };
342
365
  }
366
+ function diagnoseAgentSetup(options = {}) {
367
+ const plan = installAgentSetup({ ...options, action: "verify" });
368
+ const home = options.homeDir ?? homedir();
369
+ const localStoragePath = join(home, ".hasna", "mementos");
370
+ const localDatabaseFiles = [
371
+ ...findLocalDatabaseFiles(localStoragePath),
372
+ ...findLocalDatabaseFiles(join(home, ".config", "mementos"))
373
+ ];
374
+ const env = options.env ?? process.env;
375
+ const tokenSource = ["MEMENTOS_API_TOKEN", "MEMENTOS_PLATFORM_TOKEN", "PLATFORM_API_TOKEN", "APP_API_KEY"].find((key) => Boolean(env[key]));
376
+ return {
377
+ apiUrl: options.apiUrl ?? "https://mementos.md",
378
+ hostResults: plan.hostResults,
379
+ localDatabaseFiles,
380
+ localStorage: {
381
+ path: localStoragePath,
382
+ status: existsSync(localStoragePath) ? "present" : "absent"
383
+ },
384
+ ok: plan.hostResults.every((result) => result.status === "present") && !existsSync(localStoragePath) && localDatabaseFiles.length === 0,
385
+ remoteOnly: true,
386
+ tokenConfigured: Boolean(tokenSource),
387
+ ...tokenSource ? { tokenSource } : {}
388
+ };
389
+ }
343
390
  function installAgentSetup(options = {}) {
344
391
  const plan = buildAgentSetupPlan(options);
345
392
  if (options.action === "verify") {
@@ -749,6 +796,21 @@ function readMemoryRows(payload) {
749
796
  function readText(input) {
750
797
  return typeof input === "string" && input.trim() ? input.trim() : undefined;
751
798
  }
799
+ function findLocalDatabaseFiles(dir) {
800
+ const localDbPattern = new RegExp(`\\.(${["db", "sql" + "ite"].join("|")})(?:$|-)`);
801
+ if (!existsSync(dir))
802
+ return [];
803
+ const stat = statSync(dir);
804
+ if (!stat.isDirectory())
805
+ return localDbPattern.test(dir) ? [dir] : [];
806
+ return readdirSync(dir).flatMap((entry) => {
807
+ const path = join(dir, entry);
808
+ const entryStat = statSync(path);
809
+ if (entryStat.isDirectory())
810
+ return findLocalDatabaseFiles(path);
811
+ return localDbPattern.test(entry) ? [path] : [];
812
+ });
813
+ }
752
814
  export {
753
815
  startMcpStdio,
754
816
  renderSignupInstructions,
@@ -756,6 +818,7 @@ export {
756
818
  installAgentSetup,
757
819
  handleMcpMessage,
758
820
  formatMemoryInjection,
821
+ diagnoseAgentSetup,
759
822
  createRemoteClientFromEnv,
760
823
  callRemoteMcpTool,
761
824
  buildAgentSetupPlan,
@@ -1,5 +1,5 @@
1
1
  import { MementosRemoteClient } from "./remote-client";
2
- export declare const MEMENTOS_MCP_VERSION = "0.14.24";
2
+ export declare const MEMENTOS_MCP_VERSION = "0.14.26";
3
3
  export interface RemoteMcpTool {
4
4
  name: string;
5
5
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-runtime.d.ts","sourceRoot":"","sources":["../src/mcp-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAElF,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC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
package/dist/mcp.js CHANGED
@@ -75,6 +75,12 @@ class MementosRemoteClient {
75
75
  billingStatus() {
76
76
  return this.request("/billing/status");
77
77
  }
78
+ listCreditPacks() {
79
+ return this.request("/billing/credits");
80
+ }
81
+ buyCredits(input) {
82
+ return this.request("/billing/credits", { method: "POST", body: input });
83
+ }
78
84
  async request(path, options = {}) {
79
85
  const method = options.method ?? "GET";
80
86
  const requiresAuth = options.requiresAuth !== false;
@@ -136,7 +142,7 @@ function readErrorMessage(payload, status) {
136
142
  }
137
143
 
138
144
  // src/mcp-runtime.ts
139
- var MEMENTOS_MCP_VERSION = "0.14.24";
145
+ var MEMENTOS_MCP_VERSION = "0.14.26";
140
146
  var AUTHLESS_SCHEMA = {
141
147
  type: "object",
142
148
  properties: {},
@@ -237,6 +243,23 @@ var REMOTE_MCP_TOOLS = [
237
243
  description: "Read hosted mementos.md billing status.",
238
244
  inputSchema: AUTHLESS_SCHEMA,
239
245
  run: (_input, client) => client.billingStatus()
246
+ },
247
+ {
248
+ name: "billing.credits",
249
+ description: "List hosted mementos.md credit packs.",
250
+ inputSchema: AUTHLESS_SCHEMA,
251
+ run: (_input, client) => client.listCreditPacks()
252
+ },
253
+ {
254
+ name: "billing.buy",
255
+ description: "Create a hosted mementos.md credit checkout session.",
256
+ inputSchema: OPEN_SCHEMA,
257
+ run: (input, client) => {
258
+ const credits = Number(input.credits);
259
+ if (!Number.isInteger(credits) || credits < 1)
260
+ throw new Error("credits must be a positive integer");
261
+ return client.buyCredits({ credits });
262
+ }
240
263
  }
241
264
  ];
242
265
  async function callRemoteMcpTool(name, input = {}, client = createRemoteClientFromEnv()) {
@@ -37,6 +37,8 @@ export declare class MementosRemoteClient {
37
37
  getRun(id: string): Promise<unknown>;
38
38
  listApprovals(): Promise<unknown>;
39
39
  billingStatus(): Promise<unknown>;
40
+ listCreditPacks(): Promise<unknown>;
41
+ buyCredits(input: Record<string, unknown>): Promise<unknown>;
40
42
  request(path: string, options?: RemoteRequestOptions): Promise<unknown>;
41
43
  }
42
44
  export declare function createRemoteClientFromEnv(env?: Record<string, string | undefined>): MementosRemoteClient;
@@ -1 +1 @@
1
- {"version":3,"file":"remote-client.d.ts","sourceRoot":"","sources":["../src/remote-client.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE5F,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO;CAM/D;AAED,qBAAa,oBAAoB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,MAAM,GAAE,kBAAuB;IAM3C,gBAAgB;IAIhB,UAAU;IAIV,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI5C,cAAc,CAAC,KAAK,EAAE,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,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAI5C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAI3D,MAAM,CAAC,EAAE,EAAE,MAAM;IAIjB,aAAa;IAIb,aAAa;IAIb,eAAe;IAIf,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAInC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB;CA4B/D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,oBAAoB,CAKrH;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.14.24",
3
+ "version": "0.14.26",
4
4
  "description": "Remote-only mementos.md SaaS CLI and MCP client",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",