@hasna/mementos 0.14.63 → 0.14.64

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.
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4M5D"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkN5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"system-doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/system-doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgP5D"}
1
+ {"version":3,"file":"system-doctor.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/system-doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2CzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwP5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE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Arg(nameOrId, type) {
5617
5617
  const byName = getEntityByName(nameOrId, type);
5618
5618
  if (byName)
5619
5619
  return byName;
5620
+ if (isApiMode()) {
5621
+ try {
5622
+ return getEntity(nameOrId);
5623
+ } catch {
5624
+ console.error(chalk.red(`Entity not found: ${nameOrId}`));
5625
+ process.exit(1);
5626
+ }
5627
+ }
5620
5628
  const db = getDatabase();
5621
5629
  const id = resolvePartialId(db, "entities", nameOrId);
5622
5630
  if (id)
@@ -62640,24 +62648,28 @@ function registerAgentCommands(program2) {
62640
62648
  console.log(chalk22.green(`\u2665 ${agent.name} (${agent.id}) \u2014 heartbeat sent`));
62641
62649
  });
62642
62650
  program2.command("set-focus [project]").description("Focus this agent on a project (or clear focus if no project given)").option("--agent <id>", "Agent ID").action((project, opts) => {
62643
- const globalOpts = program2.opts();
62644
- const agentId = opts?.agent || globalOpts.agent;
62645
- if (!agentId) {
62646
- process.stderr.write(`Agent ID required. Use --agent.
62651
+ try {
62652
+ const globalOpts = program2.opts();
62653
+ const agentId = opts?.agent || globalOpts.agent;
62654
+ if (!agentId) {
62655
+ process.stderr.write(`Agent ID required. Use --agent.
62647
62656
  `);
62648
- process.exit(1);
62649
- }
62650
- let target = project ?? null;
62651
- if (project) {
62652
- const proj = getProject(project);
62653
- if (proj)
62654
- target = proj.id;
62657
+ process.exit(1);
62658
+ }
62659
+ let target = project ?? null;
62660
+ if (project) {
62661
+ const proj = getProject(project);
62662
+ if (proj)
62663
+ target = proj.id;
62664
+ }
62665
+ setFocus(agentId, target);
62666
+ if (project)
62667
+ console.log(chalk22.green(`Focused: ${agentId} \u2192 project ${project}`));
62668
+ else
62669
+ console.log(chalk22.dim(`Focus cleared for ${agentId}`));
62670
+ } catch (e) {
62671
+ handleError(e);
62655
62672
  }
62656
- setFocus(agentId, target);
62657
- if (project)
62658
- console.log(chalk22.green(`Focused: ${agentId} \u2192 project ${project}`));
62659
- else
62660
- console.log(chalk22.dim(`Focus cleared for ${agentId}`));
62661
62673
  });
62662
62674
  program2.command("get-focus").description("Show the current project focus for an agent").option("--agent <id>", "Agent ID").action((opts) => {
62663
62675
  const globalOpts = program2.opts();
@@ -63551,6 +63563,7 @@ import {
63551
63563
  statSync as statSync3,
63552
63564
  constants as fsConstants
63553
63565
  } from "fs";
63566
+ init_api_mode();
63554
63567
  init_helpers();
63555
63568
  async function runCommandWithTimeout(args, timeoutMs) {
63556
63569
  const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
@@ -63572,6 +63585,10 @@ function registerDoctorCommand(program2) {
63572
63585
  program2.command("doctor").description("Diagnose common issues with the mementos installation").action(async () => {
63573
63586
  const globalOpts = program2.opts();
63574
63587
  const checks = [];
63588
+ if (isApiMode()) {
63589
+ await runCloudDoctor(globalOpts, checks);
63590
+ return;
63591
+ }
63575
63592
  const version = getPackageVersion();
63576
63593
  checks.push({ name: "Version", status: "ok", detail: version });
63577
63594
  const dbPath = getDbPath();
@@ -63758,6 +63775,109 @@ function registerDoctorCommand(program2) {
63758
63775
  outputDoctorResults(globalOpts, checks);
63759
63776
  });
63760
63777
  }
63778
+ async function runCloudDoctor(globalOpts, checks) {
63779
+ checks.push({ name: "Version", status: "ok", detail: getPackageVersion() });
63780
+ const cfg = getApiConfig();
63781
+ checks.push({
63782
+ name: "Storage mode",
63783
+ status: "ok",
63784
+ detail: `self-hosted API (${cfg?.baseUrl ?? "unknown endpoint"})`
63785
+ });
63786
+ let healthy = false;
63787
+ try {
63788
+ const { status, data } = apiJson("GET", "/health");
63789
+ healthy = status >= 200 && status < 300 && !!data;
63790
+ if (healthy && data) {
63791
+ const serverStatus = data.status === "warn" ? "warn" : "ok";
63792
+ checks.push({
63793
+ name: "Cloud connection",
63794
+ status: serverStatus,
63795
+ detail: `reachable \u2014 server v${data.version ?? "?"} (${data.status ?? "ok"})`
63796
+ });
63797
+ const total = data.memories?.total ?? 0;
63798
+ const expired = data.memories?.expired ?? 0;
63799
+ checks.push({ name: "Memories", status: "ok", detail: `${total} total` });
63800
+ checks.push({
63801
+ name: " Expired",
63802
+ status: expired > 10 ? "warn" : "ok",
63803
+ detail: expired > 10 ? `${expired} (run 'mementos clean' to remove)` : String(expired)
63804
+ });
63805
+ checks.push({ name: "Agents", status: "ok", detail: String(data.agents ?? 0) });
63806
+ checks.push({ name: "Projects", status: "ok", detail: String(data.projects ?? 0) });
63807
+ } else {
63808
+ checks.push({ name: "Cloud connection", status: "fail", detail: "health endpoint returned no data" });
63809
+ }
63810
+ } catch (e) {
63811
+ checks.push({
63812
+ name: "Cloud connection",
63813
+ status: "fail",
63814
+ detail: e instanceof Error ? e.message : String(e)
63815
+ });
63816
+ }
63817
+ try {
63818
+ loadConfig();
63819
+ checks.push({ name: "Config", status: "ok", detail: "valid" });
63820
+ } catch (e) {
63821
+ checks.push({ name: "Config", status: "fail", detail: e instanceof Error ? e.message : String(e) });
63822
+ }
63823
+ try {
63824
+ const activeProfile = getActiveProfile();
63825
+ const profiles = listProfiles();
63826
+ checks.push({
63827
+ name: "Active profile",
63828
+ status: "ok",
63829
+ detail: activeProfile ? `${activeProfile} (${profiles.length} total)` : `default \u2014 ${profiles.length} profile(s) available`
63830
+ });
63831
+ } catch (e) {
63832
+ checks.push({ name: "Active profile", status: "warn", detail: e instanceof Error ? e.message : String(e) });
63833
+ }
63834
+ try {
63835
+ const { stdout: mcpOut, exitCode: mcpExit, timedOut } = await runCommandWithTimeout(["claude", "mcp", "list"], 1500);
63836
+ if (timedOut) {
63837
+ checks.push({ name: "MCP server", status: "warn", detail: "health check timed out" });
63838
+ } else if (mcpExit === 0 && mcpOut.includes("mementos")) {
63839
+ checks.push({ name: "MCP server", status: "ok", detail: "registered with Claude Code" });
63840
+ } else if (mcpExit !== 0) {
63841
+ checks.push({ name: "MCP server", status: "warn", detail: "claude not installed or not accessible" });
63842
+ } else {
63843
+ checks.push({ name: "MCP server", status: "warn", detail: "not registered \u2192 run: mementos init" });
63844
+ }
63845
+ } catch {
63846
+ checks.push({ name: "MCP server", status: "warn", detail: "could not check (is claude CLI installed?)" });
63847
+ }
63848
+ try {
63849
+ const settingsFilePath = join7(homedir4(), ".claude", "settings.json");
63850
+ if (existsSync7(settingsFilePath)) {
63851
+ const settings = JSON.parse(readFileSync5(settingsFilePath, "utf-8"));
63852
+ const hooksObj = settings["hooks"] || {};
63853
+ const stopHooks = hooksObj["Stop"] || [];
63854
+ const hasMementos = stopHooks.some((e) => e.hooks?.some((h) => h.command && h.command.includes("mementos")));
63855
+ checks.push({
63856
+ name: "Stop hook",
63857
+ status: hasMementos ? "ok" : "warn",
63858
+ detail: hasMementos ? "installed (sessions \u2192 memories)" : "not installed \u2192 run: mementos init"
63859
+ });
63860
+ } else {
63861
+ checks.push({ name: "Stop hook", status: "warn", detail: "~/.claude/settings.json not found \u2192 run: mementos init" });
63862
+ }
63863
+ } catch {
63864
+ checks.push({ name: "Stop hook", status: "warn", detail: "could not check stop hook" });
63865
+ }
63866
+ if (process.platform === "darwin") {
63867
+ const plistFilePath = join7(homedir4(), "Library", "LaunchAgents", "com.hasna.mementos.plist");
63868
+ checks.push({
63869
+ name: "Auto-start",
63870
+ status: existsSync7(plistFilePath) ? "ok" : "warn",
63871
+ detail: existsSync7(plistFilePath) ? "configured (starts on login)" : "not configured \u2192 run: mementos init"
63872
+ });
63873
+ } else {
63874
+ checks.push({ name: "Auto-start", status: "ok", detail: `n/a on ${process.platform}` });
63875
+ }
63876
+ outputDoctorResults(globalOpts, checks);
63877
+ if (checks.some((c) => c.status === "fail")) {
63878
+ process.exitCode = 1;
63879
+ }
63880
+ }
63761
63881
  function outputDoctorResults(globalOpts, checks) {
63762
63882
  if (globalOpts.json) {
63763
63883
  outputJson({ checks, healthy: checks.every((c) => c.status === "ok") });
@@ -5689,6 +5689,13 @@ function addRoute(method, path, handler) {
5689
5689
  handler
5690
5690
  });
5691
5691
  }
5692
+ function safeDecodeParam(value) {
5693
+ try {
5694
+ return decodeURIComponent(value);
5695
+ } catch {
5696
+ return value;
5697
+ }
5698
+ }
5692
5699
  function matchRoute(method, pathname) {
5693
5700
  let bestMatch = null;
5694
5701
  for (const route of routes) {
@@ -5698,7 +5705,7 @@ function matchRoute(method, pathname) {
5698
5705
  if (match) {
5699
5706
  const params = {};
5700
5707
  route.paramNames.forEach((name, i) => {
5701
- params[name] = match[i + 1];
5708
+ params[name] = safeDecodeParam(match[i + 1]);
5702
5709
  });
5703
5710
  if (!bestMatch || route.specificity > bestMatch.route.specificity || route.specificity === bestMatch.route.specificity && route.order < bestMatch.route.order) {
5704
5711
  bestMatch = { route, params };
@@ -58697,7 +58704,7 @@ function registerSystemToolRoutes() {
58697
58704
  });
58698
58705
  addRoute("GET", "/api/tool-insights/:tool_name", (_req, url, params) => {
58699
58706
  const q = getSearchParams(url);
58700
- const toolName = decodeURIComponent(params["tool_name"]);
58707
+ const toolName = params["tool_name"];
58701
58708
  const projectId = q["project_id"];
58702
58709
  const lessonsLimit = q["limit"] ? parseInt(q["limit"], 10) : 20;
58703
58710
  const stats = getToolStats(toolName, projectId || undefined);
@@ -58712,7 +58719,7 @@ init_memories();
58712
58719
  init_router();
58713
58720
  function registerSystemChainRoutes() {
58714
58721
  addRoute("GET", "/api/chains/:sequence_group", (_req, url, params) => {
58715
- const sequenceGroup = decodeURIComponent(params["sequence_group"]);
58722
+ const sequenceGroup = params["sequence_group"];
58716
58723
  const projectId = getSearchParams(url)["project_id"];
58717
58724
  const chain = getMemoryChain(sequenceGroup, projectId, getDatabase());
58718
58725
  return json({ chain, count: chain.length, sequence_group: sequenceGroup });
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/server/router.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG,CACzB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;AAElC,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MA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M,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,CAiClE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.14.63",
3
+ "version": "0.14.64",
4
4
  "description": "Universal memory system for AI agents - CLI + MCP server + library API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",