@hasna/mementos 0.14.25 → 0.14.27

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";
@@ -504,6 +543,15 @@ class MementosRemoteClient {
504
543
  injectionContext(input = {}) {
505
544
  return this.request("/injections/context", { method: "POST", body: input });
506
545
  }
546
+ sendInboxMessage(input) {
547
+ return this.request("/inbox", { method: "POST", body: input });
548
+ }
549
+ listInboxMessages(input = {}) {
550
+ return this.request("/inbox", { query: input });
551
+ }
552
+ claimInboxMessage(id, input = {}) {
553
+ return this.request(`/inbox/${encodeURIComponent(id)}/claim`, { method: "POST", body: input });
554
+ }
507
555
  getMemory(id) {
508
556
  return this.request(`/memories/${encodeURIComponent(id)}`);
509
557
  }
@@ -633,6 +681,8 @@ async function run(name, args) {
633
681
  return runHook(args);
634
682
  case "billing":
635
683
  return runBilling(args);
684
+ case "inbox":
685
+ return runInbox(args);
636
686
  case "capabilities":
637
687
  return client.listCapabilities();
638
688
  case "agents":
@@ -654,6 +704,31 @@ async function run(name, args) {
654
704
  ${helpText()}`);
655
705
  }
656
706
  }
707
+ async function runInbox(args) {
708
+ const subcommand = args[0] ?? "list";
709
+ switch (subcommand) {
710
+ case "send": {
711
+ const agentName = args[1];
712
+ const message = args.slice(2).join(" ");
713
+ if (!agentName || !message)
714
+ throw new Error("usage: mementos inbox send <agentName> <message>");
715
+ return client.sendInboxMessage({ targetAgentName: agentName, message });
716
+ }
717
+ case "list": {
718
+ const options = parseInboxOptions(args.slice(1));
719
+ return client.listInboxMessages(options);
720
+ }
721
+ case "claim": {
722
+ const id = args[1];
723
+ if (!id)
724
+ throw new Error("usage: mementos inbox claim <id> [--agent <agentName>]");
725
+ const options = parseInboxOptions(args.slice(2));
726
+ return client.claimInboxMessage(id, options);
727
+ }
728
+ default:
729
+ throw new Error("usage: mementos inbox <send|list|claim>");
730
+ }
731
+ }
657
732
  async function runBilling(args) {
658
733
  const subcommand = args[0] ?? "status";
659
734
  switch (subcommand) {
@@ -713,11 +788,23 @@ async function injectMemory(args) {
713
788
  }
714
789
  async function runHook(args) {
715
790
  const subcommand = args[0] ?? "help";
791
+ if (subcommand === "doctor") {
792
+ const options = parseSetupOptions(args.slice(1));
793
+ return diagnoseAgentSetup({
794
+ apiUrl: baseProductUrl(),
795
+ homeDir: options.homeDir,
796
+ hosts: options.hosts
797
+ });
798
+ }
716
799
  const hookEvents = {
717
- "user-prompt-submit": "UserPromptSubmit",
718
- "session-start": "SessionStart",
800
+ notification: "Notification",
801
+ "post-tool-use": "PostToolUse",
802
+ "pre-tool-use": "PreToolUse",
803
+ setup: "Setup",
719
804
  "subagent-start": "SubagentStart",
720
- setup: "Setup"
805
+ "subagent-stop": "SubagentStop",
806
+ "session-start": "SessionStart",
807
+ "user-prompt-submit": "UserPromptSubmit"
721
808
  };
722
809
  if (subcommand in hookEvents) {
723
810
  const query2 = await readHookQuery();
@@ -732,7 +819,7 @@ async function runHook(args) {
732
819
  };
733
820
  }
734
821
  if (subcommand !== "stop") {
735
- throw new Error("usage: mementos hook <stop|user-prompt-submit|session-start|subagent-start|setup>");
822
+ 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>");
736
823
  }
737
824
  const query = process.env.MEMENTOS_INJECTION_QUERY ?? process.cwd();
738
825
  return injectMemory([query]);
@@ -779,6 +866,28 @@ function parseSetupOptions(args) {
779
866
  }
780
867
  return options;
781
868
  }
869
+ function parseInboxOptions(args) {
870
+ const options = {};
871
+ for (let index = 0;index < args.length; index += 1) {
872
+ const arg = args[index];
873
+ if (arg === "--agent" || arg === "--agent-name") {
874
+ options.agentName = args[++index];
875
+ } else if (arg === "--agent-id") {
876
+ options.agentId = args[++index];
877
+ } else if (arg === "--project") {
878
+ options.projectKey = args[++index];
879
+ } else if (arg === "--session") {
880
+ options.sessionId = args[++index];
881
+ } else if (arg === "--include-delivered") {
882
+ options.includeDelivered = true;
883
+ } else if (arg === "--limit") {
884
+ options.limit = Number(args[++index]);
885
+ } else {
886
+ throw new Error(`Unknown inbox option: ${arg}`);
887
+ }
888
+ }
889
+ return options;
890
+ }
782
891
  function parseHosts(input) {
783
892
  const requested = input.split(",").map((host) => host.trim()).filter(Boolean);
784
893
  const unknown = requested.filter((host) => !SUPPORTED_AGENT_HOSTS.includes(host));
@@ -802,7 +911,8 @@ Usage:
802
911
  mementos auth signup
803
912
  mementos setup agents [--dry-run|--verify|--uninstall]
804
913
  mementos inject <query>
805
- mementos hook <stop|user-prompt-submit|session-start|subagent-start|setup>
914
+ mementos hook <stop|user-prompt-submit|session-start|subagent-start|subagent-stop|pre-tool-use|post-tool-use|notification|setup|doctor>
915
+ mementos inbox <send|list|claim>
806
916
  mementos billing <status|credits|buy>
807
917
  mementos capabilities
808
918
  mementos agents
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
@@ -43,6 +43,15 @@ class MementosRemoteClient {
43
43
  injectionContext(input = {}) {
44
44
  return this.request("/injections/context", { method: "POST", body: input });
45
45
  }
46
+ sendInboxMessage(input) {
47
+ return this.request("/inbox", { method: "POST", body: input });
48
+ }
49
+ listInboxMessages(input = {}) {
50
+ return this.request("/inbox", { query: input });
51
+ }
52
+ claimInboxMessage(id, input = {}) {
53
+ return this.request(`/inbox/${encodeURIComponent(id)}/claim`, { method: "POST", body: input });
54
+ }
46
55
  getMemory(id) {
47
56
  return this.request(`/memories/${encodeURIComponent(id)}`);
48
57
  }
@@ -137,7 +146,7 @@ function readErrorMessage(payload, status) {
137
146
  }
138
147
  // src/mcp-runtime.ts
139
148
  import { createInterface } from "readline";
140
- var MEMENTOS_MCP_VERSION = "0.14.25";
149
+ var MEMENTOS_MCP_VERSION = "0.14.27";
141
150
  var AUTHLESS_SCHEMA = {
142
151
  type: "object",
143
152
  properties: {},
@@ -205,6 +214,27 @@ var REMOTE_MCP_TOOLS = [
205
214
  inputSchema: AUTHLESS_SCHEMA,
206
215
  run: (_input, client) => client.memoryUsage()
207
216
  },
217
+ {
218
+ name: "inbox.send",
219
+ description: "Send a hosted mementos.md inbox message to an agent.",
220
+ inputSchema: OPEN_SCHEMA,
221
+ run: (input, client) => client.sendInboxMessage(input)
222
+ },
223
+ {
224
+ name: "inbox.list",
225
+ description: "List hosted mementos.md inbox messages for an agent.",
226
+ inputSchema: OPEN_SCHEMA,
227
+ run: (input, client) => client.listInboxMessages(input)
228
+ },
229
+ {
230
+ name: "inbox.claim",
231
+ description: "Claim and mark a hosted mementos.md inbox message delivered.",
232
+ inputSchema: OPEN_SCHEMA,
233
+ run: (input, client) => {
234
+ const { id, ...body } = input;
235
+ return client.claimInboxMessage(requiredText(id, "inbox message id is required"), body);
236
+ }
237
+ },
208
238
  {
209
239
  name: "runs.create",
210
240
  description: "Queue a hosted mementos.md run.",
@@ -315,7 +345,7 @@ function requiredText(input, message) {
315
345
  return input.trim();
316
346
  }
317
347
  // src/agent-setup.ts
318
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
348
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "fs";
319
349
  import { homedir } from "os";
320
350
  import { dirname, join } from "path";
321
351
  var SUPPORTED_AGENT_HOSTS = ["claude-code", "codex", "opencode", "antigravity"];
@@ -363,6 +393,30 @@ function buildAgentSetupPlan(options = {}) {
363
393
  mcpCommand
364
394
  };
365
395
  }
396
+ function diagnoseAgentSetup(options = {}) {
397
+ const plan = installAgentSetup({ ...options, action: "verify" });
398
+ const home = options.homeDir ?? homedir();
399
+ const localStoragePath = join(home, ".hasna", "mementos");
400
+ const localDatabaseFiles = [
401
+ ...findLocalDatabaseFiles(localStoragePath),
402
+ ...findLocalDatabaseFiles(join(home, ".config", "mementos"))
403
+ ];
404
+ const env = options.env ?? process.env;
405
+ const tokenSource = ["MEMENTOS_API_TOKEN", "MEMENTOS_PLATFORM_TOKEN", "PLATFORM_API_TOKEN", "APP_API_KEY"].find((key) => Boolean(env[key]));
406
+ return {
407
+ apiUrl: options.apiUrl ?? "https://mementos.md",
408
+ hostResults: plan.hostResults,
409
+ localDatabaseFiles,
410
+ localStorage: {
411
+ path: localStoragePath,
412
+ status: existsSync(localStoragePath) ? "present" : "absent"
413
+ },
414
+ ok: plan.hostResults.every((result) => result.status === "present") && !existsSync(localStoragePath) && localDatabaseFiles.length === 0,
415
+ remoteOnly: true,
416
+ tokenConfigured: Boolean(tokenSource),
417
+ ...tokenSource ? { tokenSource } : {}
418
+ };
419
+ }
366
420
  function installAgentSetup(options = {}) {
367
421
  const plan = buildAgentSetupPlan(options);
368
422
  if (options.action === "verify") {
@@ -772,6 +826,21 @@ function readMemoryRows(payload) {
772
826
  function readText(input) {
773
827
  return typeof input === "string" && input.trim() ? input.trim() : undefined;
774
828
  }
829
+ function findLocalDatabaseFiles(dir) {
830
+ const localDbPattern = new RegExp(`\\.(${["db", "sql" + "ite"].join("|")})(?:$|-)`);
831
+ if (!existsSync(dir))
832
+ return [];
833
+ const stat = statSync(dir);
834
+ if (!stat.isDirectory())
835
+ return localDbPattern.test(dir) ? [dir] : [];
836
+ return readdirSync(dir).flatMap((entry) => {
837
+ const path = join(dir, entry);
838
+ const entryStat = statSync(path);
839
+ if (entryStat.isDirectory())
840
+ return findLocalDatabaseFiles(path);
841
+ return localDbPattern.test(entry) ? [path] : [];
842
+ });
843
+ }
775
844
  export {
776
845
  startMcpStdio,
777
846
  renderSignupInstructions,
@@ -779,6 +848,7 @@ export {
779
848
  installAgentSetup,
780
849
  handleMcpMessage,
781
850
  formatMemoryInjection,
851
+ diagnoseAgentSetup,
782
852
  createRemoteClientFromEnv,
783
853
  callRemoteMcpTool,
784
854
  buildAgentSetupPlan,
@@ -1,5 +1,5 @@
1
1
  import { MementosRemoteClient } from "./remote-client";
2
- export declare const MEMENTOS_MCP_VERSION = "0.14.25";
2
+ export declare const MEMENTOS_MCP_VERSION = "0.14.27";
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;IACrC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACzF;AAaD,eAAO,MAAM,gBAAgB,EAAE,aAAa,EA4G3C,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,MAAM,uBAA8B,oBAKrC;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,uBAA8B;;;;;;;;;;;GA8BxF;AAED,wBAAgB,aAAa,CAAC,MAAM,uBAA8B,QAUjE"}
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;IACrC,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACzF;AAaD,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAiI3C,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACnC,MAAM,uBAA8B,oBAKrC;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,uBAA8B;;;;;;;;;;;GA8BxF;AAED,wBAAgB,aAAa,CAAC,MAAM,uBAA8B,QAUjE"}
package/dist/mcp.js CHANGED
@@ -48,6 +48,15 @@ class MementosRemoteClient {
48
48
  injectionContext(input = {}) {
49
49
  return this.request("/injections/context", { method: "POST", body: input });
50
50
  }
51
+ sendInboxMessage(input) {
52
+ return this.request("/inbox", { method: "POST", body: input });
53
+ }
54
+ listInboxMessages(input = {}) {
55
+ return this.request("/inbox", { query: input });
56
+ }
57
+ claimInboxMessage(id, input = {}) {
58
+ return this.request(`/inbox/${encodeURIComponent(id)}/claim`, { method: "POST", body: input });
59
+ }
51
60
  getMemory(id) {
52
61
  return this.request(`/memories/${encodeURIComponent(id)}`);
53
62
  }
@@ -142,7 +151,7 @@ function readErrorMessage(payload, status) {
142
151
  }
143
152
 
144
153
  // src/mcp-runtime.ts
145
- var MEMENTOS_MCP_VERSION = "0.14.25";
154
+ var MEMENTOS_MCP_VERSION = "0.14.27";
146
155
  var AUTHLESS_SCHEMA = {
147
156
  type: "object",
148
157
  properties: {},
@@ -210,6 +219,27 @@ var REMOTE_MCP_TOOLS = [
210
219
  inputSchema: AUTHLESS_SCHEMA,
211
220
  run: (_input, client) => client.memoryUsage()
212
221
  },
222
+ {
223
+ name: "inbox.send",
224
+ description: "Send a hosted mementos.md inbox message to an agent.",
225
+ inputSchema: OPEN_SCHEMA,
226
+ run: (input, client) => client.sendInboxMessage(input)
227
+ },
228
+ {
229
+ name: "inbox.list",
230
+ description: "List hosted mementos.md inbox messages for an agent.",
231
+ inputSchema: OPEN_SCHEMA,
232
+ run: (input, client) => client.listInboxMessages(input)
233
+ },
234
+ {
235
+ name: "inbox.claim",
236
+ description: "Claim and mark a hosted mementos.md inbox message delivered.",
237
+ inputSchema: OPEN_SCHEMA,
238
+ run: (input, client) => {
239
+ const { id, ...body } = input;
240
+ return client.claimInboxMessage(requiredText(id, "inbox message id is required"), body);
241
+ }
242
+ },
213
243
  {
214
244
  name: "runs.create",
215
245
  description: "Queue a hosted mementos.md run.",
@@ -28,6 +28,9 @@ export declare class MementosRemoteClient {
28
28
  saveMemory(input: Record<string, unknown>): Promise<unknown>;
29
29
  searchMemories(input?: Record<string, unknown>): Promise<unknown>;
30
30
  injectionContext(input?: Record<string, unknown>): Promise<unknown>;
31
+ sendInboxMessage(input: Record<string, unknown>): Promise<unknown>;
32
+ listInboxMessages(input?: Record<string, unknown>): Promise<unknown>;
33
+ claimInboxMessage(id: string, input?: Record<string, unknown>): Promise<unknown>;
31
34
  getMemory(id: string): Promise<unknown>;
32
35
  updateMemory(id: string, input: Record<string, unknown>): Promise<unknown>;
33
36
  deleteMemory(id: string): Promise<unknown>;
@@ -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;IAI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AC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI/C,iBAAiB,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAIrD,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAIjE,SAAS,CAAC,EAAE,EAAE,MAAM;IAIpB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIvD,YAAY,CAAC,EAAE,EAAE,MAAM;IAIvB,WAAW;IAIX,QAAQ,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.25",
3
+ "version": "0.14.27",
4
4
  "description": "Remote-only mementos.md SaaS CLI and MCP client",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",