memorix 1.8.4 → 1.8.5

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 (73) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/CLAUDE.md +3 -0
  3. package/README.md +4 -4
  4. package/README.zh-CN.md +5 -3
  5. package/dist/cli/index.js +1542 -626
  6. package/dist/dashboard/static/app.js +29 -885
  7. package/dist/dashboard/static/index.html +1 -5
  8. package/dist/dashboard/static/style.css +36 -503
  9. package/dist/index.d.ts +4 -4
  10. package/dist/index.js +213 -70
  11. package/dist/memcode/index.js +28035 -169
  12. package/dist/memcode-runtime/CHANGELOG.md +34 -0
  13. package/dist/sdk.js +30 -12
  14. package/docs/1.8.0-RELEASE-CANDIDATE-SPEC.md +22 -16
  15. package/docs/AGENT_OPERATOR_PLAYBOOK.md +2 -2
  16. package/docs/API_REFERENCE.md +10 -8
  17. package/docs/DASHBOARD.md +23 -0
  18. package/docs/DEVELOPMENT.md +2 -2
  19. package/docs/DOCKER.md +6 -3
  20. package/docs/INTEGRATIONS.md +1 -1
  21. package/docs/MODULES.md +46 -20
  22. package/docs/PERFORMANCE.md +1 -1
  23. package/docs/README.md +8 -7
  24. package/docs/SETUP.md +3 -3
  25. package/package.json +11 -11
  26. package/plugins/antigravity/memorix/plugin.json +1 -1
  27. package/plugins/antigravity/memorix/rules/memorix.md +5 -0
  28. package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
  29. package/plugins/claude/memorix/skills/memorix-memory/SKILL.md +3 -0
  30. package/plugins/claude/memorix/skills/memorix-mini-skills/SKILL.md +2 -0
  31. package/plugins/claude/memorix/skills/memorix-orchestrate/SKILL.md +2 -0
  32. package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
  33. package/plugins/codebuddy/memorix/skills/memorix-memory/SKILL.md +3 -0
  34. package/plugins/codebuddy/memorix/skills/memorix-mini-skills/SKILL.md +2 -0
  35. package/plugins/codebuddy/memorix/skills/memorix-orchestrate/SKILL.md +2 -0
  36. package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
  37. package/plugins/codex/memorix/skills/memorix-memory/SKILL.md +3 -0
  38. package/plugins/codex/memorix/skills/memorix-mini-skills/SKILL.md +2 -0
  39. package/plugins/codex/memorix/skills/memorix-orchestrate/SKILL.md +2 -0
  40. package/plugins/copilot/memorix/plugin.json +1 -1
  41. package/plugins/copilot/memorix/skills/memorix-memory/SKILL.md +3 -0
  42. package/plugins/copilot/memorix/skills/memorix-mini-skills/SKILL.md +2 -0
  43. package/plugins/copilot/memorix/skills/memorix-orchestrate/SKILL.md +2 -0
  44. package/plugins/cursor/memorix/skills/memorix-memory/SKILL.md +3 -0
  45. package/plugins/cursor/memorix/skills/memorix-mini-skills/SKILL.md +2 -0
  46. package/plugins/cursor/memorix/skills/memorix-orchestrate/SKILL.md +2 -0
  47. package/plugins/gemini/memorix/GEMINI.md +5 -0
  48. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  49. package/plugins/hermes/memorix/plugin.yaml +7 -1
  50. package/plugins/omp/memorix/package.json +1 -1
  51. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
  52. package/plugins/pi/memorix/package.json +1 -1
  53. package/plugins/pi/memorix/skills/memorix-memory/SKILL.md +3 -0
  54. package/plugins/pi/memorix/skills/memorix-mini-skills/SKILL.md +2 -0
  55. package/plugins/pi/memorix/skills/memorix-orchestrate/SKILL.md +2 -0
  56. package/server.json +2 -2
  57. package/src/cli/command-guide.ts +52 -1
  58. package/src/cli/commands/background.ts +166 -6
  59. package/src/cli/commands/serve-http.ts +73 -80
  60. package/src/cli/commands/serve.ts +95 -93
  61. package/src/cli/index.ts +1 -1
  62. package/src/dashboard/static/index.html +1 -5
  63. package/src/dashboard/static/style.css +36 -503
  64. package/src/hooks/installers/index.ts +3 -0
  65. package/src/hooks/official-skills.ts +13 -6
  66. package/src/memory/graph.ts +2 -2
  67. package/src/server/mcp-diagnostics.ts +9 -7
  68. package/src/server/modern-mcp-bridge.ts +108 -0
  69. package/src/server/stdio-startup-gate.ts +41 -2
  70. package/src/server/tool-profile.ts +7 -6
  71. package/src/server.ts +1 -1
  72. package/src/store/orama-store.ts +2 -2
  73. package/src/wiki/types.ts +2 -2
package/dist/cli/index.js CHANGED
@@ -3232,7 +3232,7 @@ ${import_picocolors.default.gray(m3)} ${s4}
3232
3232
 
3233
3233
  // src/cli/version.ts
3234
3234
  function getCliVersion() {
3235
- return true ? "1.8.4" : pkg.version;
3235
+ return true ? "1.8.5" : pkg.version;
3236
3236
  }
3237
3237
  var init_version = __esm({
3238
3238
  "src/cli/version.ts"() {
@@ -38645,8 +38645,8 @@ var init_uploads = __esm({
38645
38645
  init_shims();
38646
38646
  checkFileSupport = () => {
38647
38647
  if (typeof File === "undefined") {
38648
- const { process: process3 } = globalThis;
38649
- const isOldNode = typeof process3?.versions?.node === "string" && parseInt(process3.versions.node.split(".")) < 20;
38648
+ const { process: process2 } = globalThis;
38649
+ const isOldNode = typeof process2?.versions?.node === "string" && parseInt(process2.versions.node.split(".")) < 20;
38650
38650
  throw new Error("`File` is not defined as a global, which is required for file uploads." + (isOldNode ? " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`." : ""));
38651
38651
  }
38652
38652
  };
@@ -65035,8 +65035,8 @@ var init_uploads4 = __esm({
65035
65035
  init_shims2();
65036
65036
  checkFileSupport2 = () => {
65037
65037
  if (typeof File === "undefined") {
65038
- const { process: process3 } = globalThis;
65039
- const isOldNode = typeof process3?.versions?.node === "string" && parseInt(process3.versions.node.split(".")) < 20;
65038
+ const { process: process2 } = globalThis;
65039
+ const isOldNode = typeof process2?.versions?.node === "string" && parseInt(process2.versions.node.split(".")) < 20;
65040
65040
  throw new Error("`File` is not defined as a global, which is required for file uploads." + (isOldNode ? " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`." : ""));
65041
65041
  }
65042
65042
  };
@@ -79311,15 +79311,15 @@ var require_streams = __commonJS({
79311
79311
  var POOL_SIZE2 = 65536;
79312
79312
  if (!globalThis.ReadableStream) {
79313
79313
  try {
79314
- const process3 = __require("process");
79315
- const { emitWarning } = process3;
79314
+ const process2 = __require("process");
79315
+ const { emitWarning } = process2;
79316
79316
  try {
79317
- process3.emitWarning = () => {
79317
+ process2.emitWarning = () => {
79318
79318
  };
79319
79319
  Object.assign(globalThis, __require("stream/web"));
79320
- process3.emitWarning = emitWarning;
79320
+ process2.emitWarning = emitWarning;
79321
79321
  } catch (error40) {
79322
- process3.emitWarning = emitWarning;
79322
+ process2.emitWarning = emitWarning;
79323
79323
  throw error40;
79324
79324
  }
79325
79325
  } catch (error40) {
@@ -83960,7 +83960,7 @@ var require_logging_utils = __commonJS({
83960
83960
  exports.setBackend = setBackend;
83961
83961
  exports.log = log;
83962
83962
  var events_1 = __require("events");
83963
- var process3 = __importStar(__require("process"));
83963
+ var process2 = __importStar(__require("process"));
83964
83964
  var util2 = __importStar(__require("util"));
83965
83965
  var colours_1 = require_colours();
83966
83966
  var LogSeverity;
@@ -84017,7 +84017,7 @@ var require_logging_utils = __commonJS({
84017
84017
  this.cached = /* @__PURE__ */ new Map();
84018
84018
  this.filters = [];
84019
84019
  this.filtersSet = false;
84020
- let nodeFlag = (_a6 = process3.env[exports.env.nodeEnables]) !== null && _a6 !== void 0 ? _a6 : "*";
84020
+ let nodeFlag = (_a6 = process2.env[exports.env.nodeEnables]) !== null && _a6 !== void 0 ? _a6 : "*";
84021
84021
  if (nodeFlag === "all") {
84022
84022
  nodeFlag = "*";
84023
84023
  }
@@ -84057,7 +84057,7 @@ var require_logging_utils = __commonJS({
84057
84057
  return (fields, ...args) => {
84058
84058
  var _a6;
84059
84059
  const nscolour = `${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`;
84060
- const pid = `${colours_1.Colours.yellow}${process3.pid}${colours_1.Colours.reset}`;
84060
+ const pid = `${colours_1.Colours.yellow}${process2.pid}${colours_1.Colours.reset}`;
84061
84061
  let level;
84062
84062
  switch (fields.severity) {
84063
84063
  case LogSeverity.ERROR:
@@ -84105,8 +84105,8 @@ var require_logging_utils = __commonJS({
84105
84105
  }
84106
84106
  setFilters() {
84107
84107
  var _a6;
84108
- const existingFilters = (_a6 = process3.env["NODE_DEBUG"]) !== null && _a6 !== void 0 ? _a6 : "";
84109
- process3.env["NODE_DEBUG"] = `${existingFilters}${existingFilters ? "," : ""}${this.filters.join(",")}`;
84108
+ const existingFilters = (_a6 = process2.env["NODE_DEBUG"]) !== null && _a6 !== void 0 ? _a6 : "";
84109
+ process2.env["NODE_DEBUG"] = `${existingFilters}${existingFilters ? "," : ""}${this.filters.join(",")}`;
84110
84110
  }
84111
84111
  };
84112
84112
  function getDebugBackend(debugPkg) {
@@ -84159,7 +84159,7 @@ var require_logging_utils = __commonJS({
84159
84159
  }
84160
84160
  function log(namespace, parent) {
84161
84161
  if (!cachedBackend) {
84162
- const enablesFlag = process3.env[exports.env.nodeEnables];
84162
+ const enablesFlag = process2.env[exports.env.nodeEnables];
84163
84163
  if (!enablesFlag) {
84164
84164
  return exports.placeholder;
84165
84165
  }
@@ -111728,8 +111728,8 @@ var init_node = __esm({
111728
111728
  checkFileSupport3 = () => {
111729
111729
  var _a6;
111730
111730
  if (typeof File === "undefined") {
111731
- const { process: process3 } = globalThis;
111732
- const isOldNode = typeof ((_a6 = process3 === null || process3 === void 0 ? void 0 : process3.versions) === null || _a6 === void 0 ? void 0 : _a6.node) === "string" && parseInt(process3.versions.node.split(".")) < 20;
111731
+ const { process: process2 } = globalThis;
111732
+ const isOldNode = typeof ((_a6 = process2 === null || process2 === void 0 ? void 0 : process2.versions) === null || _a6 === void 0 ? void 0 : _a6.node) === "string" && parseInt(process2.versions.node.split(".")) < 20;
111733
111733
  throw new Error("`File` is not defined as a global, which is required for file uploads." + (isOldNode ? " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`." : ""));
111734
111734
  }
111735
111735
  };
@@ -192804,6 +192804,9 @@ var init_official_skills = __esm({
192804
192804
  '| Specific past decision, bug, file, or change | `memorix_search` | `memorix memory search --query "<topic>"` |',
192805
192805
  "| Need the full source for a search hit | `memorix_detail` | `memorix memory detail --id <id>` |",
192806
192806
  "| Need the sequence around one memory | `memorix_timeline` | `memorix memory timeline --id <id>` |",
192807
+ "| Check source and freshness for a memory | `memorix_evidence` | `memorix evidence list|get|events` |",
192808
+ "| Record whether a memory helped, conflicted, or was corrected | `memorix_feedback` | `memorix feedback record|show|audit` |",
192809
+ "| Inspect or import controlled media | `memorix_media` | `memorix media import|attach|list|show|status` |",
192807
192810
  '| Learned reusable project knowledge | `memorix_store` | `memorix memory store --type <type> --entity <name> --title "<title>" "<text>"` |',
192808
192811
  "| Task or bug is complete/outdated | `memorix_resolve` | `memorix memory resolve --ids <ids>` |",
192809
192812
  "",
@@ -192934,6 +192937,8 @@ var init_official_skills = __esm({
192934
192937
  "",
192935
192938
  "Promote memories into mini-skills only when they are reusable instructions, not just historical notes.",
192936
192939
  "",
192940
+ "The standard setup uses the `lite` MCP profile. `memorix_skills` and `memorix_promote` are full-profile tools, so use the CLI fallback unless the current server was explicitly started with `MEMORIX_MODE=full` or `--mode full`. Do not probe hidden MCP tools repeatedly.",
192941
+ "",
192937
192942
  "## Tool Router",
192938
192943
  "",
192939
192944
  "| Situation | Prefer | CLI fallback |",
@@ -192969,15 +192974,17 @@ var init_official_skills = __esm({
192969
192974
  "| Situation | Prefer | CLI fallback |",
192970
192975
  "|---|---|---|",
192971
192976
  '| Run managed subagent execution | CLI | `memorix orchestrate --goal "<goal>" --agents claude:1,codex:1` |',
192972
- "| Register coordination identity | `team_manage` action `join` | `memorix team join --agentType <agent>` |",
192973
- "| Create or inspect tasks | `team_task` | `memorix task create|list|claim|complete` |",
192974
- "| Send or read coordination messages | `team_message` | `memorix message send|broadcast|inbox` |",
192975
- "| Share structured handoff | `memorix_handoff` | `memorix handoff send` |",
192976
- "| Avoid file conflicts | `team_file_lock` | `memorix lock lock|unlock|status` |",
192977
- "| Poll joined coordination state | `memorix_poll` | `memorix poll` |",
192977
+ "| Register coordination identity when team MCP tools are available | `team_manage` action `join` | `memorix team join --agentType <agent>` |",
192978
+ "| Create or inspect tasks when team MCP tools are available | `team_task` | `memorix task create|list|claim|complete` |",
192979
+ "| Send or read coordination messages when team MCP tools are available | `team_message` | `memorix message send|broadcast|inbox` |",
192980
+ "| Share structured handoff when team MCP tools are available | `memorix_handoff` | `memorix handoff send` |",
192981
+ "| Avoid file conflicts when team MCP tools are available | `team_file_lock` | `memorix lock lock|unlock|status` |",
192982
+ "| Poll joined coordination state when team MCP tools are available | `memorix_poll` | `memorix poll` |",
192978
192983
  "",
192979
192984
  "## Boundaries",
192980
192985
  "",
192986
+ "The standard setup uses the `lite` MCP profile. Coordination MCP tools are exposed only by `team` or `full`; use the CLI fallback for ordinary installations, or explicitly start the server with `--mode team`. Do not probe unavailable team tools in a loop.",
192987
+ "",
192981
192988
  "- For ordinary memory, do not join coordination state.",
192982
192989
  "- For production multi-agent execution, prefer `memorix orchestrate` so the main process owns planning, dispatch, retries, and verification gates.",
192983
192990
  "- `memorix orchestrate` uses the current checkout for single-worker runs and task worktrees for parallel runs. Use `--isolated` to force worktree isolation, `--no-worktree` to disable it, `--allow-dirty` to run with uncommitted changes, and `--no-auto-merge` to preserve task worktrees for manual review.",
@@ -194141,7 +194148,10 @@ alwaysApply: true
194141
194148
  "| `memorix_store` | Save something worth persisting |",
194142
194149
  '| `memorix_store_reasoning` | Save the "why" behind a decision |',
194143
194150
  "| `memorix_resolve` | Mark completed/outdated memories |",
194144
- "| `memorix_session_start` | Load session context (handoff, orchestration coordination) |"
194151
+ "| `memorix_session_start` | Load session context (handoff, orchestration coordination) |",
194152
+ "| `memorix_evidence` | Check a memory source, freshness, and verification state |",
194153
+ "| `memorix_feedback` | Record whether a memory helped, conflicted, or was corrected |",
194154
+ "| `memorix_media` | Inspect or import controlled local media |"
194145
194155
  ].join("\n");
194146
194156
  }
194147
194157
  async function uninstallHooks(agent, projectRoot, global2 = false) {
@@ -205684,16 +205694,24 @@ function resolveToolProfile(opts) {
205684
205694
  return normalize(opts.explicit) ?? normalize(opts.envValue) ?? opts.fallback;
205685
205695
  }
205686
205696
  function describeProfile(profile) {
205697
+ const count3 = countToolsInProfile(profile);
205687
205698
  switch (profile) {
205688
205699
  case "micro":
205689
- return "micro (agent-ready context + bounded recovery/media, ~9 tools)";
205700
+ return `micro (agent-ready context + bounded recovery/media, ${count3} tools)`;
205690
205701
  case "lite":
205691
- return "lite (core memory + sessions, ~18 tools)";
205702
+ return `lite (core memory + sessions, ${count3} tools)`;
205692
205703
  case "team":
205693
- return "team (lite + coordination tools + dashboard + knowledge workspace, ~26 tools)";
205704
+ return `team (lite + coordination tools + dashboard + knowledge workspace, ${count3} tools)`;
205694
205705
  case "full":
205695
- return "full (all tools including advanced / KG-compat)";
205706
+ return `full (all tools including advanced / KG-compat, ${count3} tools)`;
205707
+ }
205708
+ }
205709
+ function countToolsInProfile(profile) {
205710
+ let n3 = 0;
205711
+ for (const name of Object.keys(TOOL_PROFILES)) {
205712
+ if (isToolInProfile(name, profile)) n3++;
205696
205713
  }
205714
+ return n3;
205697
205715
  }
205698
205716
  var TOOL_PROFILES;
205699
205717
  var init_tool_profile = __esm({
@@ -205768,7 +205786,7 @@ var init_tool_profile = __esm({
205768
205786
  function getMcpServerInfo() {
205769
205787
  return {
205770
205788
  name: "memorix",
205771
- version: true ? "1.8.4" : "1.0.1"
205789
+ version: true ? "1.8.5" : "1.0.1"
205772
205790
  };
205773
205791
  }
205774
205792
  function createMcpDiscoverResult(capabilities, serverInfo) {
@@ -205835,7 +205853,17 @@ var init_stdio_startup_gate = __esm({
205835
205853
  this.fail(new Error(`stdio input chunk exceeded ${this.maxBufferSize} bytes`));
205836
205854
  return;
205837
205855
  }
205838
- this.input.write(chunk);
205856
+ this.pendingInput += typeof chunk === "string" ? chunk : chunk.toString("utf8");
205857
+ let newline2 = this.pendingInput.indexOf("\n");
205858
+ while (newline2 >= 0 && !this.stopped) {
205859
+ const line = this.pendingInput.slice(0, newline2 + 1);
205860
+ this.pendingInput = this.pendingInput.slice(newline2 + 1);
205861
+ this.handleReadyLine(line);
205862
+ newline2 = this.pendingInput.indexOf("\n");
205863
+ }
205864
+ if (!this.stopped && Buffer.byteLength(this.pendingInput, "utf8") > this.maxBufferSize) {
205865
+ this.fail(new Error(`stdio input exceeded ${this.maxBufferSize} bytes`));
205866
+ }
205839
205867
  return;
205840
205868
  }
205841
205869
  const text2 = typeof chunk === "string" ? chunk : chunk.toString("utf8");
@@ -205934,6 +205962,24 @@ var init_stdio_startup_gate = __esm({
205934
205962
  this.queuedMessages.push(line);
205935
205963
  this.queuedBytes += bytes;
205936
205964
  }
205965
+ handleReadyLine(line) {
205966
+ const parsed = this.parseLine(line);
205967
+ if (parsed && !("error" in parsed) && this.isDiscoveryRequest(parsed.message)) {
205968
+ const response = {
205969
+ jsonrpc: "2.0",
205970
+ id: parsed.message.id,
205971
+ result: createMcpStartupDiscoverResult(this.serverInfo)
205972
+ };
205973
+ try {
205974
+ this.stdout.write(`${JSON.stringify(response)}
205975
+ `);
205976
+ } catch (error40) {
205977
+ this.fail(error40 instanceof Error ? error40 : new Error(String(error40)));
205978
+ }
205979
+ return;
205980
+ }
205981
+ this.input.write(line);
205982
+ }
205937
205983
  parseLine(line) {
205938
205984
  const trimmed = line.endsWith("\n") ? line.slice(0, -1).replace(/\r$/, "") : line;
205939
205985
  if (!trimmed.trim()) return null;
@@ -205972,7 +206018,8 @@ var init_stdio_startup_gate = __esm({
205972
206018
  if (message.method !== MCP_SERVER_DISCOVER_METHOD) return false;
205973
206019
  if (!Object.prototype.hasOwnProperty.call(message, "id")) return false;
205974
206020
  const params = message.params;
205975
- return params === void 0 || typeof params === "object" && params !== null && !Array.isArray(params);
206021
+ if (params === void 0) return true;
206022
+ return typeof params === "object" && params !== null && !Array.isArray(params) && !Object.prototype.hasOwnProperty.call(params, "_meta");
205976
206023
  }
205977
206024
  isValidRequestId(id) {
205978
206025
  return id === null || typeof id === "string" || typeof id === "number" && Number.isFinite(id);
@@ -206051,6 +206098,297 @@ var init_mcp_root_path = __esm({
206051
206098
  }
206052
206099
  });
206053
206100
 
206101
+ // node_modules/zod/v4/mini/parse.js
206102
+ var init_parse8 = __esm({
206103
+ "node_modules/zod/v4/mini/parse.js"() {
206104
+ "use strict";
206105
+ init_esm_shims();
206106
+ init_core3();
206107
+ }
206108
+ });
206109
+
206110
+ // node_modules/zod/v4/mini/schemas.js
206111
+ function object2(shape, params) {
206112
+ const def = {
206113
+ type: "object",
206114
+ get shape() {
206115
+ util_exports.assignProp(this, "shape", { ...shape });
206116
+ return this.shape;
206117
+ },
206118
+ ...util_exports.normalizeParams(params)
206119
+ };
206120
+ return new ZodMiniObject(def);
206121
+ }
206122
+ var ZodMiniType, ZodMiniObject;
206123
+ var init_schemas4 = __esm({
206124
+ "node_modules/zod/v4/mini/schemas.js"() {
206125
+ "use strict";
206126
+ init_esm_shims();
206127
+ init_core3();
206128
+ init_core3();
206129
+ init_parse8();
206130
+ ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
206131
+ if (!inst._zod)
206132
+ throw new Error("Uninitialized schema in ZodMiniType.");
206133
+ $ZodType.init(inst, def);
206134
+ inst.def = def;
206135
+ inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
206136
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
206137
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
206138
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
206139
+ inst.check = (...checks) => {
206140
+ return inst.clone(
206141
+ {
206142
+ ...def,
206143
+ checks: [
206144
+ ...def.checks ?? [],
206145
+ ...checks.map((ch2) => typeof ch2 === "function" ? { _zod: { check: ch2, def: { check: "custom" }, onattach: [] } } : ch2)
206146
+ ]
206147
+ }
206148
+ // { parent: true }
206149
+ );
206150
+ };
206151
+ inst.clone = (_def, params) => clone2(inst, _def, params);
206152
+ inst.brand = () => inst;
206153
+ inst.register = ((reg, meta) => {
206154
+ reg.add(inst, meta);
206155
+ return inst;
206156
+ });
206157
+ });
206158
+ ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
206159
+ $ZodObject.init(inst, def);
206160
+ ZodMiniType.init(inst, def);
206161
+ util_exports.defineLazy(inst, "shape", () => def.shape);
206162
+ });
206163
+ }
206164
+ });
206165
+
206166
+ // node_modules/zod/v4/mini/checks.js
206167
+ var init_checks3 = __esm({
206168
+ "node_modules/zod/v4/mini/checks.js"() {
206169
+ "use strict";
206170
+ init_esm_shims();
206171
+ }
206172
+ });
206173
+
206174
+ // node_modules/zod/v4/mini/iso.js
206175
+ var init_iso2 = __esm({
206176
+ "node_modules/zod/v4/mini/iso.js"() {
206177
+ "use strict";
206178
+ init_esm_shims();
206179
+ }
206180
+ });
206181
+
206182
+ // node_modules/zod/v4/mini/coerce.js
206183
+ var init_coerce2 = __esm({
206184
+ "node_modules/zod/v4/mini/coerce.js"() {
206185
+ "use strict";
206186
+ init_esm_shims();
206187
+ }
206188
+ });
206189
+
206190
+ // node_modules/zod/v4/mini/external.js
206191
+ var init_external3 = __esm({
206192
+ "node_modules/zod/v4/mini/external.js"() {
206193
+ "use strict";
206194
+ init_esm_shims();
206195
+ init_core3();
206196
+ init_parse8();
206197
+ init_schemas4();
206198
+ init_checks3();
206199
+ init_core3();
206200
+ init_locales();
206201
+ init_iso2();
206202
+ init_coerce2();
206203
+ }
206204
+ });
206205
+
206206
+ // node_modules/zod/v4/mini/index.js
206207
+ var init_mini = __esm({
206208
+ "node_modules/zod/v4/mini/index.js"() {
206209
+ "use strict";
206210
+ init_esm_shims();
206211
+ init_external3();
206212
+ }
206213
+ });
206214
+
206215
+ // node_modules/zod/v4-mini/index.js
206216
+ var init_v4_mini = __esm({
206217
+ "node_modules/zod/v4-mini/index.js"() {
206218
+ "use strict";
206219
+ init_esm_shims();
206220
+ init_mini();
206221
+ }
206222
+ });
206223
+
206224
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
206225
+ function isZ4Schema(s4) {
206226
+ const schema = s4;
206227
+ return !!schema._zod;
206228
+ }
206229
+ function objectFromShape(shape) {
206230
+ const values = Object.values(shape);
206231
+ if (values.length === 0)
206232
+ return object2({});
206233
+ const allV4 = values.every(isZ4Schema);
206234
+ const allV3 = values.every((s4) => !isZ4Schema(s4));
206235
+ if (allV4)
206236
+ return object2(shape);
206237
+ if (allV3)
206238
+ return objectType(shape);
206239
+ throw new Error("Mixed Zod versions detected in object shape.");
206240
+ }
206241
+ function safeParse4(schema, data) {
206242
+ if (isZ4Schema(schema)) {
206243
+ const result2 = safeParse(schema, data);
206244
+ return result2;
206245
+ }
206246
+ const v3Schema = schema;
206247
+ const result = v3Schema.safeParse(data);
206248
+ return result;
206249
+ }
206250
+ async function safeParseAsync3(schema, data) {
206251
+ if (isZ4Schema(schema)) {
206252
+ const result2 = await safeParseAsync(schema, data);
206253
+ return result2;
206254
+ }
206255
+ const v3Schema = schema;
206256
+ const result = await v3Schema.safeParseAsync(data);
206257
+ return result;
206258
+ }
206259
+ function getObjectShape(schema) {
206260
+ if (!schema)
206261
+ return void 0;
206262
+ let rawShape;
206263
+ if (isZ4Schema(schema)) {
206264
+ const v4Schema = schema;
206265
+ rawShape = v4Schema._zod?.def?.shape;
206266
+ } else {
206267
+ const v3Schema = schema;
206268
+ rawShape = v3Schema.shape;
206269
+ }
206270
+ if (!rawShape)
206271
+ return void 0;
206272
+ if (typeof rawShape === "function") {
206273
+ try {
206274
+ return rawShape();
206275
+ } catch {
206276
+ return void 0;
206277
+ }
206278
+ }
206279
+ return rawShape;
206280
+ }
206281
+ function normalizeObjectSchema(schema) {
206282
+ if (!schema)
206283
+ return void 0;
206284
+ if (typeof schema === "object") {
206285
+ const asV3 = schema;
206286
+ const asV4 = schema;
206287
+ if (!asV3._def && !asV4._zod) {
206288
+ const values = Object.values(schema);
206289
+ if (values.length > 0 && values.every((v6) => typeof v6 === "object" && v6 !== null && (v6._def !== void 0 || v6._zod !== void 0 || typeof v6.parse === "function"))) {
206290
+ return objectFromShape(schema);
206291
+ }
206292
+ }
206293
+ }
206294
+ if (isZ4Schema(schema)) {
206295
+ const v4Schema = schema;
206296
+ const def = v4Schema._zod?.def;
206297
+ if (def && (def.type === "object" || def.shape !== void 0)) {
206298
+ return schema;
206299
+ }
206300
+ } else {
206301
+ const v3Schema = schema;
206302
+ if (v3Schema.shape !== void 0) {
206303
+ return schema;
206304
+ }
206305
+ }
206306
+ return void 0;
206307
+ }
206308
+ function getDotPath(path48) {
206309
+ if (path48.length === 0) {
206310
+ return "object root";
206311
+ }
206312
+ return path48.reduce((acc, seg, index) => {
206313
+ if (index === 0) {
206314
+ return String(seg);
206315
+ }
206316
+ if (typeof seg === "number") {
206317
+ return `${acc}[${seg}]`;
206318
+ }
206319
+ return `${acc}.${seg}`;
206320
+ }, "");
206321
+ }
206322
+ function getParseErrorMessage(error40) {
206323
+ if (error40 && typeof error40 === "object") {
206324
+ if ("issues" in error40 && Array.isArray(error40.issues) && error40.issues.length > 0) {
206325
+ return error40.issues.map((i4) => {
206326
+ if (!i4.path?.length) {
206327
+ return i4.message;
206328
+ }
206329
+ return `${i4.message} at ${getDotPath(i4.path)}`;
206330
+ }).join("\n");
206331
+ }
206332
+ if ("message" in error40 && typeof error40.message === "string") {
206333
+ return error40.message;
206334
+ }
206335
+ try {
206336
+ return JSON.stringify(error40);
206337
+ } catch {
206338
+ return String(error40);
206339
+ }
206340
+ }
206341
+ return String(error40);
206342
+ }
206343
+ function getSchemaDescription(schema) {
206344
+ return schema.description;
206345
+ }
206346
+ function isSchemaOptional(schema) {
206347
+ if (isZ4Schema(schema)) {
206348
+ const v4Schema = schema;
206349
+ return v4Schema._zod?.def?.type === "optional";
206350
+ }
206351
+ const v3Schema = schema;
206352
+ if (typeof schema.isOptional === "function") {
206353
+ return schema.isOptional();
206354
+ }
206355
+ return v3Schema._def?.typeName === "ZodOptional";
206356
+ }
206357
+ function getLiteralValue(schema) {
206358
+ if (isZ4Schema(schema)) {
206359
+ const v4Schema = schema;
206360
+ const def2 = v4Schema._zod?.def;
206361
+ if (def2) {
206362
+ if (def2.value !== void 0)
206363
+ return def2.value;
206364
+ if (Array.isArray(def2.values) && def2.values.length > 0) {
206365
+ return def2.values[0];
206366
+ }
206367
+ }
206368
+ }
206369
+ const v3Schema = schema;
206370
+ const def = v3Schema._def;
206371
+ if (def) {
206372
+ if (def.value !== void 0)
206373
+ return def.value;
206374
+ if (Array.isArray(def.values) && def.values.length > 0) {
206375
+ return def.values[0];
206376
+ }
206377
+ }
206378
+ const directValue = schema.value;
206379
+ if (directValue !== void 0)
206380
+ return directValue;
206381
+ return void 0;
206382
+ }
206383
+ var init_zod_compat = __esm({
206384
+ "node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js"() {
206385
+ "use strict";
206386
+ init_esm_shims();
206387
+ init_v3();
206388
+ init_v4_mini();
206389
+ }
206390
+ });
206391
+
206054
206392
  // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
206055
206393
  var types_exports3 = {};
206056
206394
  __export(types_exports3, {
@@ -207770,422 +208108,6 @@ var init_types8 = __esm({
207770
208108
  }
207771
208109
  });
207772
208110
 
207773
- // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
207774
- function deserializeMessage(line) {
207775
- return JSONRPCMessageSchema.parse(JSON.parse(line));
207776
- }
207777
- function serializeMessage(message) {
207778
- return JSON.stringify(message) + "\n";
207779
- }
207780
- var STDIO_DEFAULT_MAX_BUFFER_SIZE, ReadBuffer;
207781
- var init_stdio = __esm({
207782
- "node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js"() {
207783
- "use strict";
207784
- init_esm_shims();
207785
- init_types8();
207786
- STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
207787
- ReadBuffer = class {
207788
- constructor(options) {
207789
- this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
207790
- }
207791
- append(chunk) {
207792
- const newSize = (this._buffer?.length ?? 0) + chunk.length;
207793
- if (newSize > this._maxBufferSize) {
207794
- this.clear();
207795
- throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
207796
- }
207797
- this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
207798
- }
207799
- readMessage() {
207800
- if (!this._buffer) {
207801
- return null;
207802
- }
207803
- const index = this._buffer.indexOf("\n");
207804
- if (index === -1) {
207805
- return null;
207806
- }
207807
- const line = this._buffer.toString("utf8", 0, index).replace(/\r$/, "");
207808
- this._buffer = this._buffer.subarray(index + 1);
207809
- return deserializeMessage(line);
207810
- }
207811
- clear() {
207812
- this._buffer = void 0;
207813
- }
207814
- };
207815
- }
207816
- });
207817
-
207818
- // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
207819
- var stdio_exports = {};
207820
- __export(stdio_exports, {
207821
- StdioServerTransport: () => StdioServerTransport
207822
- });
207823
- import process2 from "process";
207824
- var StdioServerTransport;
207825
- var init_stdio2 = __esm({
207826
- "node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js"() {
207827
- "use strict";
207828
- init_esm_shims();
207829
- init_stdio();
207830
- StdioServerTransport = class {
207831
- constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
207832
- this._stdin = _stdin;
207833
- this._stdout = _stdout;
207834
- this._started = false;
207835
- this._ondata = (chunk) => {
207836
- try {
207837
- this._readBuffer.append(chunk);
207838
- this.processReadBuffer();
207839
- } catch (error40) {
207840
- this.onerror?.(error40);
207841
- this.close().catch(() => {
207842
- });
207843
- }
207844
- };
207845
- this._onerror = (error40) => {
207846
- this.onerror?.(error40);
207847
- };
207848
- this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
207849
- }
207850
- /**
207851
- * Starts listening for messages on stdin.
207852
- */
207853
- async start() {
207854
- if (this._started) {
207855
- throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");
207856
- }
207857
- this._started = true;
207858
- this._stdin.on("data", this._ondata);
207859
- this._stdin.on("error", this._onerror);
207860
- }
207861
- processReadBuffer() {
207862
- while (true) {
207863
- try {
207864
- const message = this._readBuffer.readMessage();
207865
- if (message === null) {
207866
- break;
207867
- }
207868
- this.onmessage?.(message);
207869
- } catch (error40) {
207870
- this.onerror?.(error40);
207871
- }
207872
- }
207873
- }
207874
- async close() {
207875
- this._stdin.off("data", this._ondata);
207876
- this._stdin.off("error", this._onerror);
207877
- const remainingDataListeners = this._stdin.listenerCount("data");
207878
- if (remainingDataListeners === 0) {
207879
- this._stdin.pause();
207880
- }
207881
- this._readBuffer.clear();
207882
- this.onclose?.();
207883
- }
207884
- send(message) {
207885
- return new Promise((resolve6) => {
207886
- const json4 = serializeMessage(message);
207887
- if (this._stdout.write(json4)) {
207888
- resolve6();
207889
- } else {
207890
- this._stdout.once("drain", resolve6);
207891
- }
207892
- });
207893
- }
207894
- };
207895
- }
207896
- });
207897
-
207898
- // node_modules/zod/v4/mini/parse.js
207899
- var init_parse8 = __esm({
207900
- "node_modules/zod/v4/mini/parse.js"() {
207901
- "use strict";
207902
- init_esm_shims();
207903
- init_core3();
207904
- }
207905
- });
207906
-
207907
- // node_modules/zod/v4/mini/schemas.js
207908
- function object2(shape, params) {
207909
- const def = {
207910
- type: "object",
207911
- get shape() {
207912
- util_exports.assignProp(this, "shape", { ...shape });
207913
- return this.shape;
207914
- },
207915
- ...util_exports.normalizeParams(params)
207916
- };
207917
- return new ZodMiniObject(def);
207918
- }
207919
- var ZodMiniType, ZodMiniObject;
207920
- var init_schemas4 = __esm({
207921
- "node_modules/zod/v4/mini/schemas.js"() {
207922
- "use strict";
207923
- init_esm_shims();
207924
- init_core3();
207925
- init_core3();
207926
- init_parse8();
207927
- ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
207928
- if (!inst._zod)
207929
- throw new Error("Uninitialized schema in ZodMiniType.");
207930
- $ZodType.init(inst, def);
207931
- inst.def = def;
207932
- inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
207933
- inst.safeParse = (data, params) => safeParse(inst, data, params);
207934
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
207935
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
207936
- inst.check = (...checks) => {
207937
- return inst.clone(
207938
- {
207939
- ...def,
207940
- checks: [
207941
- ...def.checks ?? [],
207942
- ...checks.map((ch2) => typeof ch2 === "function" ? { _zod: { check: ch2, def: { check: "custom" }, onattach: [] } } : ch2)
207943
- ]
207944
- }
207945
- // { parent: true }
207946
- );
207947
- };
207948
- inst.clone = (_def, params) => clone2(inst, _def, params);
207949
- inst.brand = () => inst;
207950
- inst.register = ((reg, meta) => {
207951
- reg.add(inst, meta);
207952
- return inst;
207953
- });
207954
- });
207955
- ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
207956
- $ZodObject.init(inst, def);
207957
- ZodMiniType.init(inst, def);
207958
- util_exports.defineLazy(inst, "shape", () => def.shape);
207959
- });
207960
- }
207961
- });
207962
-
207963
- // node_modules/zod/v4/mini/checks.js
207964
- var init_checks3 = __esm({
207965
- "node_modules/zod/v4/mini/checks.js"() {
207966
- "use strict";
207967
- init_esm_shims();
207968
- }
207969
- });
207970
-
207971
- // node_modules/zod/v4/mini/iso.js
207972
- var init_iso2 = __esm({
207973
- "node_modules/zod/v4/mini/iso.js"() {
207974
- "use strict";
207975
- init_esm_shims();
207976
- }
207977
- });
207978
-
207979
- // node_modules/zod/v4/mini/coerce.js
207980
- var init_coerce2 = __esm({
207981
- "node_modules/zod/v4/mini/coerce.js"() {
207982
- "use strict";
207983
- init_esm_shims();
207984
- }
207985
- });
207986
-
207987
- // node_modules/zod/v4/mini/external.js
207988
- var init_external3 = __esm({
207989
- "node_modules/zod/v4/mini/external.js"() {
207990
- "use strict";
207991
- init_esm_shims();
207992
- init_core3();
207993
- init_parse8();
207994
- init_schemas4();
207995
- init_checks3();
207996
- init_core3();
207997
- init_locales();
207998
- init_iso2();
207999
- init_coerce2();
208000
- }
208001
- });
208002
-
208003
- // node_modules/zod/v4/mini/index.js
208004
- var init_mini = __esm({
208005
- "node_modules/zod/v4/mini/index.js"() {
208006
- "use strict";
208007
- init_esm_shims();
208008
- init_external3();
208009
- }
208010
- });
208011
-
208012
- // node_modules/zod/v4-mini/index.js
208013
- var init_v4_mini = __esm({
208014
- "node_modules/zod/v4-mini/index.js"() {
208015
- "use strict";
208016
- init_esm_shims();
208017
- init_mini();
208018
- }
208019
- });
208020
-
208021
- // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
208022
- function isZ4Schema(s4) {
208023
- const schema = s4;
208024
- return !!schema._zod;
208025
- }
208026
- function objectFromShape(shape) {
208027
- const values = Object.values(shape);
208028
- if (values.length === 0)
208029
- return object2({});
208030
- const allV4 = values.every(isZ4Schema);
208031
- const allV3 = values.every((s4) => !isZ4Schema(s4));
208032
- if (allV4)
208033
- return object2(shape);
208034
- if (allV3)
208035
- return objectType(shape);
208036
- throw new Error("Mixed Zod versions detected in object shape.");
208037
- }
208038
- function safeParse4(schema, data) {
208039
- if (isZ4Schema(schema)) {
208040
- const result2 = safeParse(schema, data);
208041
- return result2;
208042
- }
208043
- const v3Schema = schema;
208044
- const result = v3Schema.safeParse(data);
208045
- return result;
208046
- }
208047
- async function safeParseAsync3(schema, data) {
208048
- if (isZ4Schema(schema)) {
208049
- const result2 = await safeParseAsync(schema, data);
208050
- return result2;
208051
- }
208052
- const v3Schema = schema;
208053
- const result = await v3Schema.safeParseAsync(data);
208054
- return result;
208055
- }
208056
- function getObjectShape(schema) {
208057
- if (!schema)
208058
- return void 0;
208059
- let rawShape;
208060
- if (isZ4Schema(schema)) {
208061
- const v4Schema = schema;
208062
- rawShape = v4Schema._zod?.def?.shape;
208063
- } else {
208064
- const v3Schema = schema;
208065
- rawShape = v3Schema.shape;
208066
- }
208067
- if (!rawShape)
208068
- return void 0;
208069
- if (typeof rawShape === "function") {
208070
- try {
208071
- return rawShape();
208072
- } catch {
208073
- return void 0;
208074
- }
208075
- }
208076
- return rawShape;
208077
- }
208078
- function normalizeObjectSchema(schema) {
208079
- if (!schema)
208080
- return void 0;
208081
- if (typeof schema === "object") {
208082
- const asV3 = schema;
208083
- const asV4 = schema;
208084
- if (!asV3._def && !asV4._zod) {
208085
- const values = Object.values(schema);
208086
- if (values.length > 0 && values.every((v6) => typeof v6 === "object" && v6 !== null && (v6._def !== void 0 || v6._zod !== void 0 || typeof v6.parse === "function"))) {
208087
- return objectFromShape(schema);
208088
- }
208089
- }
208090
- }
208091
- if (isZ4Schema(schema)) {
208092
- const v4Schema = schema;
208093
- const def = v4Schema._zod?.def;
208094
- if (def && (def.type === "object" || def.shape !== void 0)) {
208095
- return schema;
208096
- }
208097
- } else {
208098
- const v3Schema = schema;
208099
- if (v3Schema.shape !== void 0) {
208100
- return schema;
208101
- }
208102
- }
208103
- return void 0;
208104
- }
208105
- function getDotPath(path48) {
208106
- if (path48.length === 0) {
208107
- return "object root";
208108
- }
208109
- return path48.reduce((acc, seg, index) => {
208110
- if (index === 0) {
208111
- return String(seg);
208112
- }
208113
- if (typeof seg === "number") {
208114
- return `${acc}[${seg}]`;
208115
- }
208116
- return `${acc}.${seg}`;
208117
- }, "");
208118
- }
208119
- function getParseErrorMessage(error40) {
208120
- if (error40 && typeof error40 === "object") {
208121
- if ("issues" in error40 && Array.isArray(error40.issues) && error40.issues.length > 0) {
208122
- return error40.issues.map((i4) => {
208123
- if (!i4.path?.length) {
208124
- return i4.message;
208125
- }
208126
- return `${i4.message} at ${getDotPath(i4.path)}`;
208127
- }).join("\n");
208128
- }
208129
- if ("message" in error40 && typeof error40.message === "string") {
208130
- return error40.message;
208131
- }
208132
- try {
208133
- return JSON.stringify(error40);
208134
- } catch {
208135
- return String(error40);
208136
- }
208137
- }
208138
- return String(error40);
208139
- }
208140
- function getSchemaDescription(schema) {
208141
- return schema.description;
208142
- }
208143
- function isSchemaOptional(schema) {
208144
- if (isZ4Schema(schema)) {
208145
- const v4Schema = schema;
208146
- return v4Schema._zod?.def?.type === "optional";
208147
- }
208148
- const v3Schema = schema;
208149
- if (typeof schema.isOptional === "function") {
208150
- return schema.isOptional();
208151
- }
208152
- return v3Schema._def?.typeName === "ZodOptional";
208153
- }
208154
- function getLiteralValue(schema) {
208155
- if (isZ4Schema(schema)) {
208156
- const v4Schema = schema;
208157
- const def2 = v4Schema._zod?.def;
208158
- if (def2) {
208159
- if (def2.value !== void 0)
208160
- return def2.value;
208161
- if (Array.isArray(def2.values) && def2.values.length > 0) {
208162
- return def2.values[0];
208163
- }
208164
- }
208165
- }
208166
- const v3Schema = schema;
208167
- const def = v3Schema._def;
208168
- if (def) {
208169
- if (def.value !== void 0)
208170
- return def.value;
208171
- if (Array.isArray(def.values) && def.values.length > 0) {
208172
- return def.values[0];
208173
- }
208174
- }
208175
- const directValue = schema.value;
208176
- if (directValue !== void 0)
208177
- return directValue;
208178
- return void 0;
208179
- }
208180
- var init_zod_compat = __esm({
208181
- "node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js"() {
208182
- "use strict";
208183
- init_esm_shims();
208184
- init_v3();
208185
- init_v4_mini();
208186
- }
208187
- });
208188
-
208189
208111
  // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
208190
208112
  function isTerminal(status) {
208191
208113
  return status === "completed" || status === "failed" || status === "cancelled";
@@ -216239,6 +216161,783 @@ var init_ajv_provider = __esm({
216239
216161
  }
216240
216162
  });
216241
216163
 
216164
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js
216165
+ var ExperimentalClientTasks;
216166
+ var init_client3 = __esm({
216167
+ "node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js"() {
216168
+ "use strict";
216169
+ init_esm_shims();
216170
+ init_types8();
216171
+ ExperimentalClientTasks = class {
216172
+ constructor(_client) {
216173
+ this._client = _client;
216174
+ }
216175
+ /**
216176
+ * Calls a tool and returns an AsyncGenerator that yields response messages.
216177
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
216178
+ *
216179
+ * This method provides streaming access to tool execution, allowing you to
216180
+ * observe intermediate task status updates for long-running tool calls.
216181
+ * Automatically validates structured output if the tool has an outputSchema.
216182
+ *
216183
+ * @example
216184
+ * ```typescript
216185
+ * const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} });
216186
+ * for await (const message of stream) {
216187
+ * switch (message.type) {
216188
+ * case 'taskCreated':
216189
+ * console.log('Tool execution started:', message.task.taskId);
216190
+ * break;
216191
+ * case 'taskStatus':
216192
+ * console.log('Tool status:', message.task.status);
216193
+ * break;
216194
+ * case 'result':
216195
+ * console.log('Tool result:', message.result);
216196
+ * break;
216197
+ * case 'error':
216198
+ * console.error('Tool error:', message.error);
216199
+ * break;
216200
+ * }
216201
+ * }
216202
+ * ```
216203
+ *
216204
+ * @param params - Tool call parameters (name and arguments)
216205
+ * @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema)
216206
+ * @param options - Optional request options (timeout, signal, task creation params, etc.)
216207
+ * @returns AsyncGenerator that yields ResponseMessage objects
216208
+ *
216209
+ * @experimental
216210
+ */
216211
+ async *callToolStream(params, resultSchema = CallToolResultSchema, options) {
216212
+ const clientInternal = this._client;
216213
+ const optionsWithTask = {
216214
+ ...options,
216215
+ // We check if the tool is known to be a task during auto-configuration, but assume
216216
+ // the caller knows what they're doing if they pass this explicitly
216217
+ task: options?.task ?? (clientInternal.isToolTask(params.name) ? {} : void 0)
216218
+ };
216219
+ const stream2 = clientInternal.requestStream({ method: "tools/call", params }, resultSchema, optionsWithTask);
216220
+ const validator = clientInternal.getToolOutputValidator(params.name);
216221
+ for await (const message of stream2) {
216222
+ if (message.type === "result" && validator) {
216223
+ const result = message.result;
216224
+ if (!result.structuredContent && !result.isError) {
216225
+ yield {
216226
+ type: "error",
216227
+ error: new McpError(ErrorCode.InvalidRequest, `Tool ${params.name} has an output schema but did not return structured content`)
216228
+ };
216229
+ return;
216230
+ }
216231
+ if (result.structuredContent) {
216232
+ try {
216233
+ const validationResult = validator(result.structuredContent);
216234
+ if (!validationResult.valid) {
216235
+ yield {
216236
+ type: "error",
216237
+ error: new McpError(ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`)
216238
+ };
216239
+ return;
216240
+ }
216241
+ } catch (error40) {
216242
+ if (error40 instanceof McpError) {
216243
+ yield { type: "error", error: error40 };
216244
+ return;
216245
+ }
216246
+ yield {
216247
+ type: "error",
216248
+ error: new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error40 instanceof Error ? error40.message : String(error40)}`)
216249
+ };
216250
+ return;
216251
+ }
216252
+ }
216253
+ }
216254
+ yield message;
216255
+ }
216256
+ }
216257
+ /**
216258
+ * Gets the current status of a task.
216259
+ *
216260
+ * @param taskId - The task identifier
216261
+ * @param options - Optional request options
216262
+ * @returns The task status
216263
+ *
216264
+ * @experimental
216265
+ */
216266
+ async getTask(taskId, options) {
216267
+ return this._client.getTask({ taskId }, options);
216268
+ }
216269
+ /**
216270
+ * Retrieves the result of a completed task.
216271
+ *
216272
+ * @param taskId - The task identifier
216273
+ * @param resultSchema - Zod schema for validating the result
216274
+ * @param options - Optional request options
216275
+ * @returns The task result
216276
+ *
216277
+ * @experimental
216278
+ */
216279
+ async getTaskResult(taskId, resultSchema, options) {
216280
+ return this._client.getTaskResult({ taskId }, resultSchema, options);
216281
+ }
216282
+ /**
216283
+ * Lists tasks with optional pagination.
216284
+ *
216285
+ * @param cursor - Optional pagination cursor
216286
+ * @param options - Optional request options
216287
+ * @returns List of tasks with optional next cursor
216288
+ *
216289
+ * @experimental
216290
+ */
216291
+ async listTasks(cursor, options) {
216292
+ return this._client.listTasks(cursor ? { cursor } : void 0, options);
216293
+ }
216294
+ /**
216295
+ * Cancels a running task.
216296
+ *
216297
+ * @param taskId - The task identifier
216298
+ * @param options - Optional request options
216299
+ *
216300
+ * @experimental
216301
+ */
216302
+ async cancelTask(taskId, options) {
216303
+ return this._client.cancelTask({ taskId }, options);
216304
+ }
216305
+ /**
216306
+ * Sends a request and returns an AsyncGenerator that yields response messages.
216307
+ * The generator is guaranteed to end with either a 'result' or 'error' message.
216308
+ *
216309
+ * This method provides streaming access to request processing, allowing you to
216310
+ * observe intermediate task status updates for task-augmented requests.
216311
+ *
216312
+ * @param request - The request to send
216313
+ * @param resultSchema - Zod schema for validating the result
216314
+ * @param options - Optional request options (timeout, signal, task creation params, etc.)
216315
+ * @returns AsyncGenerator that yields ResponseMessage objects
216316
+ *
216317
+ * @experimental
216318
+ */
216319
+ requestStream(request, resultSchema, options) {
216320
+ return this._client.requestStream(request, resultSchema, options);
216321
+ }
216322
+ };
216323
+ }
216324
+ });
216325
+
216326
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
216327
+ function assertToolsCallTaskCapability(requests, method, entityName) {
216328
+ if (!requests) {
216329
+ throw new Error(`${entityName} does not support task creation (required for ${method})`);
216330
+ }
216331
+ switch (method) {
216332
+ case "tools/call":
216333
+ if (!requests.tools?.call) {
216334
+ throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
216335
+ }
216336
+ break;
216337
+ default:
216338
+ break;
216339
+ }
216340
+ }
216341
+ function assertClientRequestTaskCapability(requests, method, entityName) {
216342
+ if (!requests) {
216343
+ throw new Error(`${entityName} does not support task creation (required for ${method})`);
216344
+ }
216345
+ switch (method) {
216346
+ case "sampling/createMessage":
216347
+ if (!requests.sampling?.createMessage) {
216348
+ throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);
216349
+ }
216350
+ break;
216351
+ case "elicitation/create":
216352
+ if (!requests.elicitation?.create) {
216353
+ throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
216354
+ }
216355
+ break;
216356
+ default:
216357
+ break;
216358
+ }
216359
+ }
216360
+ var init_helpers2 = __esm({
216361
+ "node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js"() {
216362
+ "use strict";
216363
+ init_esm_shims();
216364
+ }
216365
+ });
216366
+
216367
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js
216368
+ function applyElicitationDefaults(schema, data) {
216369
+ if (!schema || data === null || typeof data !== "object")
216370
+ return;
216371
+ if (schema.type === "object" && schema.properties && typeof schema.properties === "object") {
216372
+ const obj = data;
216373
+ const props = schema.properties;
216374
+ for (const key of Object.keys(props)) {
216375
+ const propSchema = props[key];
216376
+ if (obj[key] === void 0 && Object.prototype.hasOwnProperty.call(propSchema, "default")) {
216377
+ obj[key] = propSchema.default;
216378
+ }
216379
+ if (obj[key] !== void 0) {
216380
+ applyElicitationDefaults(propSchema, obj[key]);
216381
+ }
216382
+ }
216383
+ }
216384
+ if (Array.isArray(schema.anyOf)) {
216385
+ for (const sub of schema.anyOf) {
216386
+ if (typeof sub !== "boolean") {
216387
+ applyElicitationDefaults(sub, data);
216388
+ }
216389
+ }
216390
+ }
216391
+ if (Array.isArray(schema.oneOf)) {
216392
+ for (const sub of schema.oneOf) {
216393
+ if (typeof sub !== "boolean") {
216394
+ applyElicitationDefaults(sub, data);
216395
+ }
216396
+ }
216397
+ }
216398
+ }
216399
+ function getSupportedElicitationModes(capabilities) {
216400
+ if (!capabilities) {
216401
+ return { supportsFormMode: false, supportsUrlMode: false };
216402
+ }
216403
+ const hasFormCapability = capabilities.form !== void 0;
216404
+ const hasUrlCapability = capabilities.url !== void 0;
216405
+ const supportsFormMode = hasFormCapability || !hasFormCapability && !hasUrlCapability;
216406
+ const supportsUrlMode = hasUrlCapability;
216407
+ return { supportsFormMode, supportsUrlMode };
216408
+ }
216409
+ var Client;
216410
+ var init_client4 = __esm({
216411
+ "node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js"() {
216412
+ "use strict";
216413
+ init_esm_shims();
216414
+ init_protocol();
216415
+ init_types8();
216416
+ init_ajv_provider();
216417
+ init_zod_compat();
216418
+ init_client3();
216419
+ init_helpers2();
216420
+ Client = class extends Protocol {
216421
+ /**
216422
+ * Initializes this client with the given name and version information.
216423
+ */
216424
+ constructor(_clientInfo, options) {
216425
+ super(options);
216426
+ this._clientInfo = _clientInfo;
216427
+ this._cachedToolOutputValidators = /* @__PURE__ */ new Map();
216428
+ this._cachedKnownTaskTools = /* @__PURE__ */ new Set();
216429
+ this._cachedRequiredTaskTools = /* @__PURE__ */ new Set();
216430
+ this._listChangedDebounceTimers = /* @__PURE__ */ new Map();
216431
+ this._capabilities = options?.capabilities ?? {};
216432
+ this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator();
216433
+ if (options?.listChanged) {
216434
+ this._pendingListChangedConfig = options.listChanged;
216435
+ }
216436
+ }
216437
+ /**
216438
+ * Set up handlers for list changed notifications based on config and server capabilities.
216439
+ * This should only be called after initialization when server capabilities are known.
216440
+ * Handlers are silently skipped if the server doesn't advertise the corresponding listChanged capability.
216441
+ * @internal
216442
+ */
216443
+ _setupListChangedHandlers(config2) {
216444
+ if (config2.tools && this._serverCapabilities?.tools?.listChanged) {
216445
+ this._setupListChangedHandler("tools", ToolListChangedNotificationSchema, config2.tools, async () => {
216446
+ const result = await this.listTools();
216447
+ return result.tools;
216448
+ });
216449
+ }
216450
+ if (config2.prompts && this._serverCapabilities?.prompts?.listChanged) {
216451
+ this._setupListChangedHandler("prompts", PromptListChangedNotificationSchema, config2.prompts, async () => {
216452
+ const result = await this.listPrompts();
216453
+ return result.prompts;
216454
+ });
216455
+ }
216456
+ if (config2.resources && this._serverCapabilities?.resources?.listChanged) {
216457
+ this._setupListChangedHandler("resources", ResourceListChangedNotificationSchema, config2.resources, async () => {
216458
+ const result = await this.listResources();
216459
+ return result.resources;
216460
+ });
216461
+ }
216462
+ }
216463
+ /**
216464
+ * Access experimental features.
216465
+ *
216466
+ * WARNING: These APIs are experimental and may change without notice.
216467
+ *
216468
+ * @experimental
216469
+ */
216470
+ get experimental() {
216471
+ if (!this._experimental) {
216472
+ this._experimental = {
216473
+ tasks: new ExperimentalClientTasks(this)
216474
+ };
216475
+ }
216476
+ return this._experimental;
216477
+ }
216478
+ /**
216479
+ * Registers new capabilities. This can only be called before connecting to a transport.
216480
+ *
216481
+ * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).
216482
+ */
216483
+ registerCapabilities(capabilities) {
216484
+ if (this.transport) {
216485
+ throw new Error("Cannot register capabilities after connecting to transport");
216486
+ }
216487
+ this._capabilities = mergeCapabilities(this._capabilities, capabilities);
216488
+ }
216489
+ /**
216490
+ * Override request handler registration to enforce client-side validation for elicitation.
216491
+ */
216492
+ setRequestHandler(requestSchema, handler) {
216493
+ const shape = getObjectShape(requestSchema);
216494
+ const methodSchema = shape?.method;
216495
+ if (!methodSchema) {
216496
+ throw new Error("Schema is missing a method literal");
216497
+ }
216498
+ const methodValue = getLiteralValue(methodSchema);
216499
+ if (typeof methodValue !== "string") {
216500
+ throw new Error("Schema method literal must be a string");
216501
+ }
216502
+ const method = methodValue;
216503
+ if (method === "elicitation/create") {
216504
+ const wrappedHandler = async (request, extra) => {
216505
+ const validatedRequest = safeParse4(ElicitRequestSchema, request);
216506
+ if (!validatedRequest.success) {
216507
+ const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
216508
+ throw new McpError(ErrorCode.InvalidParams, `Invalid elicitation request: ${errorMessage}`);
216509
+ }
216510
+ const { params } = validatedRequest.data;
216511
+ params.mode = params.mode ?? "form";
216512
+ const { supportsFormMode, supportsUrlMode } = getSupportedElicitationModes(this._capabilities.elicitation);
216513
+ if (params.mode === "form" && !supportsFormMode) {
216514
+ throw new McpError(ErrorCode.InvalidParams, "Client does not support form-mode elicitation requests");
216515
+ }
216516
+ if (params.mode === "url" && !supportsUrlMode) {
216517
+ throw new McpError(ErrorCode.InvalidParams, "Client does not support URL-mode elicitation requests");
216518
+ }
216519
+ const result = await Promise.resolve(handler(request, extra));
216520
+ if (params.task) {
216521
+ const taskValidationResult = safeParse4(CreateTaskResultSchema, result);
216522
+ if (!taskValidationResult.success) {
216523
+ const errorMessage = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
216524
+ throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
216525
+ }
216526
+ return taskValidationResult.data;
216527
+ }
216528
+ const validationResult = safeParse4(ElicitResultSchema, result);
216529
+ if (!validationResult.success) {
216530
+ const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
216531
+ throw new McpError(ErrorCode.InvalidParams, `Invalid elicitation result: ${errorMessage}`);
216532
+ }
216533
+ const validatedResult = validationResult.data;
216534
+ const requestedSchema = params.mode === "form" ? params.requestedSchema : void 0;
216535
+ if (params.mode === "form" && validatedResult.action === "accept" && validatedResult.content && requestedSchema) {
216536
+ if (this._capabilities.elicitation?.form?.applyDefaults) {
216537
+ try {
216538
+ applyElicitationDefaults(requestedSchema, validatedResult.content);
216539
+ } catch {
216540
+ }
216541
+ }
216542
+ }
216543
+ return validatedResult;
216544
+ };
216545
+ return super.setRequestHandler(requestSchema, wrappedHandler);
216546
+ }
216547
+ if (method === "sampling/createMessage") {
216548
+ const wrappedHandler = async (request, extra) => {
216549
+ const validatedRequest = safeParse4(CreateMessageRequestSchema, request);
216550
+ if (!validatedRequest.success) {
216551
+ const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);
216552
+ throw new McpError(ErrorCode.InvalidParams, `Invalid sampling request: ${errorMessage}`);
216553
+ }
216554
+ const { params } = validatedRequest.data;
216555
+ const result = await Promise.resolve(handler(request, extra));
216556
+ if (params.task) {
216557
+ const taskValidationResult = safeParse4(CreateTaskResultSchema, result);
216558
+ if (!taskValidationResult.success) {
216559
+ const errorMessage = taskValidationResult.error instanceof Error ? taskValidationResult.error.message : String(taskValidationResult.error);
216560
+ throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);
216561
+ }
216562
+ return taskValidationResult.data;
216563
+ }
216564
+ const hasTools = params.tools || params.toolChoice;
216565
+ const resultSchema = hasTools ? CreateMessageResultWithToolsSchema : CreateMessageResultSchema;
216566
+ const validationResult = safeParse4(resultSchema, result);
216567
+ if (!validationResult.success) {
216568
+ const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
216569
+ throw new McpError(ErrorCode.InvalidParams, `Invalid sampling result: ${errorMessage}`);
216570
+ }
216571
+ return validationResult.data;
216572
+ };
216573
+ return super.setRequestHandler(requestSchema, wrappedHandler);
216574
+ }
216575
+ return super.setRequestHandler(requestSchema, handler);
216576
+ }
216577
+ assertCapability(capability, method) {
216578
+ if (!this._serverCapabilities?.[capability]) {
216579
+ throw new Error(`Server does not support ${capability} (required for ${method})`);
216580
+ }
216581
+ }
216582
+ async connect(transport, options) {
216583
+ await super.connect(transport);
216584
+ if (transport.sessionId !== void 0) {
216585
+ return;
216586
+ }
216587
+ try {
216588
+ const result = await this.request({
216589
+ method: "initialize",
216590
+ params: {
216591
+ protocolVersion: LATEST_PROTOCOL_VERSION,
216592
+ capabilities: this._capabilities,
216593
+ clientInfo: this._clientInfo
216594
+ }
216595
+ }, InitializeResultSchema, options);
216596
+ if (result === void 0) {
216597
+ throw new Error(`Server sent invalid initialize result: ${result}`);
216598
+ }
216599
+ if (!SUPPORTED_PROTOCOL_VERSIONS.includes(result.protocolVersion)) {
216600
+ throw new Error(`Server's protocol version is not supported: ${result.protocolVersion}`);
216601
+ }
216602
+ this._serverCapabilities = result.capabilities;
216603
+ this._serverVersion = result.serverInfo;
216604
+ if (transport.setProtocolVersion) {
216605
+ transport.setProtocolVersion(result.protocolVersion);
216606
+ }
216607
+ this._instructions = result.instructions;
216608
+ await this.notification({
216609
+ method: "notifications/initialized"
216610
+ });
216611
+ if (this._pendingListChangedConfig) {
216612
+ this._setupListChangedHandlers(this._pendingListChangedConfig);
216613
+ this._pendingListChangedConfig = void 0;
216614
+ }
216615
+ } catch (error40) {
216616
+ void this.close();
216617
+ throw error40;
216618
+ }
216619
+ }
216620
+ /**
216621
+ * After initialization has completed, this will be populated with the server's reported capabilities.
216622
+ */
216623
+ getServerCapabilities() {
216624
+ return this._serverCapabilities;
216625
+ }
216626
+ /**
216627
+ * After initialization has completed, this will be populated with information about the server's name and version.
216628
+ */
216629
+ getServerVersion() {
216630
+ return this._serverVersion;
216631
+ }
216632
+ /**
216633
+ * After initialization has completed, this may be populated with information about the server's instructions.
216634
+ */
216635
+ getInstructions() {
216636
+ return this._instructions;
216637
+ }
216638
+ assertCapabilityForMethod(method) {
216639
+ switch (method) {
216640
+ case "logging/setLevel":
216641
+ if (!this._serverCapabilities?.logging) {
216642
+ throw new Error(`Server does not support logging (required for ${method})`);
216643
+ }
216644
+ break;
216645
+ case "prompts/get":
216646
+ case "prompts/list":
216647
+ if (!this._serverCapabilities?.prompts) {
216648
+ throw new Error(`Server does not support prompts (required for ${method})`);
216649
+ }
216650
+ break;
216651
+ case "resources/list":
216652
+ case "resources/templates/list":
216653
+ case "resources/read":
216654
+ case "resources/subscribe":
216655
+ case "resources/unsubscribe":
216656
+ if (!this._serverCapabilities?.resources) {
216657
+ throw new Error(`Server does not support resources (required for ${method})`);
216658
+ }
216659
+ if (method === "resources/subscribe" && !this._serverCapabilities.resources.subscribe) {
216660
+ throw new Error(`Server does not support resource subscriptions (required for ${method})`);
216661
+ }
216662
+ break;
216663
+ case "tools/call":
216664
+ case "tools/list":
216665
+ if (!this._serverCapabilities?.tools) {
216666
+ throw new Error(`Server does not support tools (required for ${method})`);
216667
+ }
216668
+ break;
216669
+ case "completion/complete":
216670
+ if (!this._serverCapabilities?.completions) {
216671
+ throw new Error(`Server does not support completions (required for ${method})`);
216672
+ }
216673
+ break;
216674
+ case "initialize":
216675
+ break;
216676
+ case "ping":
216677
+ break;
216678
+ }
216679
+ }
216680
+ assertNotificationCapability(method) {
216681
+ switch (method) {
216682
+ case "notifications/roots/list_changed":
216683
+ if (!this._capabilities.roots?.listChanged) {
216684
+ throw new Error(`Client does not support roots list changed notifications (required for ${method})`);
216685
+ }
216686
+ break;
216687
+ case "notifications/initialized":
216688
+ break;
216689
+ case "notifications/cancelled":
216690
+ break;
216691
+ case "notifications/progress":
216692
+ break;
216693
+ }
216694
+ }
216695
+ assertRequestHandlerCapability(method) {
216696
+ if (!this._capabilities) {
216697
+ return;
216698
+ }
216699
+ switch (method) {
216700
+ case "sampling/createMessage":
216701
+ if (!this._capabilities.sampling) {
216702
+ throw new Error(`Client does not support sampling capability (required for ${method})`);
216703
+ }
216704
+ break;
216705
+ case "elicitation/create":
216706
+ if (!this._capabilities.elicitation) {
216707
+ throw new Error(`Client does not support elicitation capability (required for ${method})`);
216708
+ }
216709
+ break;
216710
+ case "roots/list":
216711
+ if (!this._capabilities.roots) {
216712
+ throw new Error(`Client does not support roots capability (required for ${method})`);
216713
+ }
216714
+ break;
216715
+ case "tasks/get":
216716
+ case "tasks/list":
216717
+ case "tasks/result":
216718
+ case "tasks/cancel":
216719
+ if (!this._capabilities.tasks) {
216720
+ throw new Error(`Client does not support tasks capability (required for ${method})`);
216721
+ }
216722
+ break;
216723
+ case "ping":
216724
+ break;
216725
+ }
216726
+ }
216727
+ assertTaskCapability(method) {
216728
+ assertToolsCallTaskCapability(this._serverCapabilities?.tasks?.requests, method, "Server");
216729
+ }
216730
+ assertTaskHandlerCapability(method) {
216731
+ if (!this._capabilities) {
216732
+ return;
216733
+ }
216734
+ assertClientRequestTaskCapability(this._capabilities.tasks?.requests, method, "Client");
216735
+ }
216736
+ async ping(options) {
216737
+ return this.request({ method: "ping" }, EmptyResultSchema, options);
216738
+ }
216739
+ async complete(params, options) {
216740
+ return this.request({ method: "completion/complete", params }, CompleteResultSchema, options);
216741
+ }
216742
+ async setLoggingLevel(level, options) {
216743
+ return this.request({ method: "logging/setLevel", params: { level } }, EmptyResultSchema, options);
216744
+ }
216745
+ async getPrompt(params, options) {
216746
+ return this.request({ method: "prompts/get", params }, GetPromptResultSchema, options);
216747
+ }
216748
+ async listPrompts(params, options) {
216749
+ return this.request({ method: "prompts/list", params }, ListPromptsResultSchema, options);
216750
+ }
216751
+ async listResources(params, options) {
216752
+ return this.request({ method: "resources/list", params }, ListResourcesResultSchema, options);
216753
+ }
216754
+ async listResourceTemplates(params, options) {
216755
+ return this.request({ method: "resources/templates/list", params }, ListResourceTemplatesResultSchema, options);
216756
+ }
216757
+ async readResource(params, options) {
216758
+ return this.request({ method: "resources/read", params }, ReadResourceResultSchema, options);
216759
+ }
216760
+ async subscribeResource(params, options) {
216761
+ return this.request({ method: "resources/subscribe", params }, EmptyResultSchema, options);
216762
+ }
216763
+ async unsubscribeResource(params, options) {
216764
+ return this.request({ method: "resources/unsubscribe", params }, EmptyResultSchema, options);
216765
+ }
216766
+ /**
216767
+ * Calls a tool and waits for the result. Automatically validates structured output if the tool has an outputSchema.
216768
+ *
216769
+ * For task-based execution with streaming behavior, use client.experimental.tasks.callToolStream() instead.
216770
+ */
216771
+ async callTool(params, resultSchema = CallToolResultSchema, options) {
216772
+ if (this.isToolTaskRequired(params.name)) {
216773
+ throw new McpError(ErrorCode.InvalidRequest, `Tool "${params.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);
216774
+ }
216775
+ const result = await this.request({ method: "tools/call", params }, resultSchema, options);
216776
+ const validator = this.getToolOutputValidator(params.name);
216777
+ if (validator) {
216778
+ if (!result.structuredContent && !result.isError) {
216779
+ throw new McpError(ErrorCode.InvalidRequest, `Tool ${params.name} has an output schema but did not return structured content`);
216780
+ }
216781
+ if (result.structuredContent) {
216782
+ try {
216783
+ const validationResult = validator(result.structuredContent);
216784
+ if (!validationResult.valid) {
216785
+ throw new McpError(ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`);
216786
+ }
216787
+ } catch (error40) {
216788
+ if (error40 instanceof McpError) {
216789
+ throw error40;
216790
+ }
216791
+ throw new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error40 instanceof Error ? error40.message : String(error40)}`);
216792
+ }
216793
+ }
216794
+ }
216795
+ return result;
216796
+ }
216797
+ isToolTask(toolName) {
216798
+ if (!this._serverCapabilities?.tasks?.requests?.tools?.call) {
216799
+ return false;
216800
+ }
216801
+ return this._cachedKnownTaskTools.has(toolName);
216802
+ }
216803
+ /**
216804
+ * Check if a tool requires task-based execution.
216805
+ * Unlike isToolTask which includes 'optional' tools, this only checks for 'required'.
216806
+ */
216807
+ isToolTaskRequired(toolName) {
216808
+ return this._cachedRequiredTaskTools.has(toolName);
216809
+ }
216810
+ /**
216811
+ * Cache validators for tool output schemas.
216812
+ * Called after listTools() to pre-compile validators for better performance.
216813
+ */
216814
+ cacheToolMetadata(tools) {
216815
+ this._cachedToolOutputValidators.clear();
216816
+ this._cachedKnownTaskTools.clear();
216817
+ this._cachedRequiredTaskTools.clear();
216818
+ for (const tool of tools) {
216819
+ if (tool.outputSchema) {
216820
+ const toolValidator = this._jsonSchemaValidator.getValidator(tool.outputSchema);
216821
+ this._cachedToolOutputValidators.set(tool.name, toolValidator);
216822
+ }
216823
+ const taskSupport = tool.execution?.taskSupport;
216824
+ if (taskSupport === "required" || taskSupport === "optional") {
216825
+ this._cachedKnownTaskTools.add(tool.name);
216826
+ }
216827
+ if (taskSupport === "required") {
216828
+ this._cachedRequiredTaskTools.add(tool.name);
216829
+ }
216830
+ }
216831
+ }
216832
+ /**
216833
+ * Get cached validator for a tool
216834
+ */
216835
+ getToolOutputValidator(toolName) {
216836
+ return this._cachedToolOutputValidators.get(toolName);
216837
+ }
216838
+ async listTools(params, options) {
216839
+ const result = await this.request({ method: "tools/list", params }, ListToolsResultSchema, options);
216840
+ this.cacheToolMetadata(result.tools);
216841
+ return result;
216842
+ }
216843
+ /**
216844
+ * Set up a single list changed handler.
216845
+ * @internal
216846
+ */
216847
+ _setupListChangedHandler(listType, notificationSchema, options, fetcher) {
216848
+ const parseResult = ListChangedOptionsBaseSchema.safeParse(options);
216849
+ if (!parseResult.success) {
216850
+ throw new Error(`Invalid ${listType} listChanged options: ${parseResult.error.message}`);
216851
+ }
216852
+ if (typeof options.onChanged !== "function") {
216853
+ throw new Error(`Invalid ${listType} listChanged options: onChanged must be a function`);
216854
+ }
216855
+ const { autoRefresh, debounceMs } = parseResult.data;
216856
+ const { onChanged } = options;
216857
+ const refresh = async () => {
216858
+ if (!autoRefresh) {
216859
+ onChanged(null, null);
216860
+ return;
216861
+ }
216862
+ try {
216863
+ const items = await fetcher();
216864
+ onChanged(null, items);
216865
+ } catch (e5) {
216866
+ const error40 = e5 instanceof Error ? e5 : new Error(String(e5));
216867
+ onChanged(error40, null);
216868
+ }
216869
+ };
216870
+ const handler = () => {
216871
+ if (debounceMs) {
216872
+ const existingTimer = this._listChangedDebounceTimers.get(listType);
216873
+ if (existingTimer) {
216874
+ clearTimeout(existingTimer);
216875
+ }
216876
+ const timer = setTimeout(refresh, debounceMs);
216877
+ this._listChangedDebounceTimers.set(listType, timer);
216878
+ } else {
216879
+ refresh();
216880
+ }
216881
+ };
216882
+ this.setNotificationHandler(notificationSchema, handler);
216883
+ }
216884
+ async sendRootsListChanged() {
216885
+ return this.notification({ method: "notifications/roots/list_changed" });
216886
+ }
216887
+ };
216888
+ }
216889
+ });
216890
+
216891
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js
216892
+ var InMemoryTransport;
216893
+ var init_inMemory = __esm({
216894
+ "node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js"() {
216895
+ "use strict";
216896
+ init_esm_shims();
216897
+ InMemoryTransport = class _InMemoryTransport {
216898
+ constructor() {
216899
+ this._messageQueue = [];
216900
+ }
216901
+ /**
216902
+ * Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a Client and one to a Server.
216903
+ */
216904
+ static createLinkedPair() {
216905
+ const clientTransport = new _InMemoryTransport();
216906
+ const serverTransport = new _InMemoryTransport();
216907
+ clientTransport._otherTransport = serverTransport;
216908
+ serverTransport._otherTransport = clientTransport;
216909
+ return [clientTransport, serverTransport];
216910
+ }
216911
+ async start() {
216912
+ while (this._messageQueue.length > 0) {
216913
+ const queuedMessage = this._messageQueue.shift();
216914
+ this.onmessage?.(queuedMessage.message, queuedMessage.extra);
216915
+ }
216916
+ }
216917
+ async close() {
216918
+ const other = this._otherTransport;
216919
+ this._otherTransport = void 0;
216920
+ await other?.close();
216921
+ this.onclose?.();
216922
+ }
216923
+ /**
216924
+ * Sends a message with optional auth info.
216925
+ * This is useful for testing authentication scenarios.
216926
+ */
216927
+ async send(message, options) {
216928
+ if (!this._otherTransport) {
216929
+ throw new Error("Not connected");
216930
+ }
216931
+ if (this._otherTransport.onmessage) {
216932
+ this._otherTransport.onmessage(message, { authInfo: options?.authInfo });
216933
+ } else {
216934
+ this._otherTransport._messageQueue.push({ message, extra: { authInfo: options?.authInfo } });
216935
+ }
216936
+ }
216937
+ };
216938
+ }
216939
+ });
216940
+
216242
216941
  // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
216243
216942
  var ExperimentalServerTasks;
216244
216943
  var init_server = __esm({
@@ -216460,47 +217159,6 @@ var init_server = __esm({
216460
217159
  }
216461
217160
  });
216462
217161
 
216463
- // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
216464
- function assertToolsCallTaskCapability(requests, method, entityName) {
216465
- if (!requests) {
216466
- throw new Error(`${entityName} does not support task creation (required for ${method})`);
216467
- }
216468
- switch (method) {
216469
- case "tools/call":
216470
- if (!requests.tools?.call) {
216471
- throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);
216472
- }
216473
- break;
216474
- default:
216475
- break;
216476
- }
216477
- }
216478
- function assertClientRequestTaskCapability(requests, method, entityName) {
216479
- if (!requests) {
216480
- throw new Error(`${entityName} does not support task creation (required for ${method})`);
216481
- }
216482
- switch (method) {
216483
- case "sampling/createMessage":
216484
- if (!requests.sampling?.createMessage) {
216485
- throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);
216486
- }
216487
- break;
216488
- case "elicitation/create":
216489
- if (!requests.elicitation?.create) {
216490
- throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
216491
- }
216492
- break;
216493
- default:
216494
- break;
216495
- }
216496
- }
216497
- var init_helpers2 = __esm({
216498
- "node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js"() {
216499
- "use strict";
216500
- init_esm_shims();
216501
- }
216502
- });
216503
-
216504
217162
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
216505
217163
  var Server;
216506
217164
  var init_server2 = __esm({
@@ -266275,6 +266933,81 @@ var init_server4 = __esm({
266275
266933
  }
266276
266934
  });
266277
266935
 
266936
+ // src/server/modern-mcp-bridge.ts
266937
+ var modern_mcp_bridge_exports = {};
266938
+ __export(modern_mcp_bridge_exports, {
266939
+ createModernMcpBridge: () => createModernMcpBridge
266940
+ });
266941
+ import {
266942
+ fromJsonSchema,
266943
+ McpServer as ModernMcpServer
266944
+ } from "@modelcontextprotocol/server";
266945
+ async function createModernMcpBridge(options) {
266946
+ const { createMemorixServer: createMemorixServer2 } = await Promise.resolve().then(() => (init_server4(), server_exports2));
266947
+ const legacy = await createMemorixServer2(
266948
+ options.projectRoot,
266949
+ void 0,
266950
+ void 0,
266951
+ {
266952
+ ...options,
266953
+ allowUntrackedFallback: options.allowUntrackedFallback ?? false,
266954
+ deferProjectInitUntilBound: options.deferProjectInitUntilBound ?? true,
266955
+ deferProjectRuntimeInit: options.deferProjectRuntimeInit ?? true
266956
+ }
266957
+ );
266958
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
266959
+ const legacyClient = new Client({
266960
+ name: "memorix-modern-bridge",
266961
+ version: getMcpServerInfo().version
266962
+ });
266963
+ await legacy.server.connect(serverTransport);
266964
+ await legacyClient.connect(clientTransport);
266965
+ const listed = await legacyClient.listTools();
266966
+ const modern = new ModernMcpServer(getMcpServerInfo());
266967
+ for (const tool of listed.tools) {
266968
+ modern.registerTool(
266969
+ tool.name,
266970
+ {
266971
+ ...tool.title ? { title: tool.title } : {},
266972
+ ...tool.description ? { description: tool.description } : {},
266973
+ inputSchema: fromJsonSchema(tool.inputSchema)
266974
+ },
266975
+ async (args) => await legacyClient.callTool({
266976
+ name: tool.name,
266977
+ arguments: args
266978
+ })
266979
+ );
266980
+ }
266981
+ const bridge = modern;
266982
+ bridge.memorix = {
266983
+ projectId: legacy.projectId,
266984
+ deferredInit: legacy.deferredInit,
266985
+ switchProject: legacy.switchProject,
266986
+ isExplicitlyBound: legacy.isExplicitlyBound,
266987
+ handleTransportClose: legacy.handleTransportClose
266988
+ };
266989
+ let closed = false;
266990
+ const modernClose = modern.close.bind(modern);
266991
+ modern.close = async () => {
266992
+ if (closed) return;
266993
+ closed = true;
266994
+ await modernClose();
266995
+ await legacyClient.close().catch(() => void 0);
266996
+ await legacy.server.close().catch(() => void 0);
266997
+ legacy.handleTransportClose();
266998
+ };
266999
+ return bridge;
267000
+ }
267001
+ var init_modern_mcp_bridge = __esm({
267002
+ "src/server/modern-mcp-bridge.ts"() {
267003
+ "use strict";
267004
+ init_esm_shims();
267005
+ init_client4();
267006
+ init_inMemory();
267007
+ init_mcp_discovery();
267008
+ }
267009
+ });
267010
+
266278
267011
  // src/cli/commands/serve-shared.ts
266279
267012
  var serve_shared_exports = {};
266280
267013
  __export(serve_shared_exports, {
@@ -266628,6 +267361,14 @@ var init_serve = __esm({
266628
267361
  }
266629
267362
  },
266630
267363
  run: async ({ args }) => {
267364
+ const { serveStdio, StdioServerTransport } = await import("@modelcontextprotocol/server/stdio");
267365
+ const { createModernMcpBridge: createModernMcpBridge2 } = await Promise.resolve().then(() => (init_modern_mcp_bridge(), modern_mcp_bridge_exports));
267366
+ const { detectProject: detectProject2, findGitInSubdirs: findGitInSubdirs2, isSystemDirectory: isSystemDirectory2 } = await Promise.resolve().then(() => (init_detector(), detector_exports));
267367
+ const { homedir: homedir36 } = await import("os");
267368
+ const { writeLastProjectRoot: writeLastProjectRoot2 } = await Promise.resolve().then(() => (init_launch_root(), launch_root_exports));
267369
+ const { resolveServeProject: resolveServeProject2 } = await Promise.resolve().then(() => (init_serve_shared(), serve_shared_exports));
267370
+ let stdioHandle;
267371
+ let stdinEndedBeforeHandle = false;
266631
267372
  const startupGate = new StdioStartupGate({
266632
267373
  stdin: process.stdin,
266633
267374
  stdout: process.stdout,
@@ -266637,16 +267378,17 @@ var init_serve = __esm({
266637
267378
  process.exit(1);
266638
267379
  },
266639
267380
  onEnd: () => {
266640
- console.error("[memorix] stdin closed \u2014 exiting");
266641
- process.exitCode = 0;
267381
+ console.error("[memorix] stdin closed - exiting");
267382
+ if (stdioHandle) {
267383
+ void stdioHandle.close().catch((error40) => {
267384
+ console.error(`[memorix] stdio close error: ${error40 instanceof Error ? error40.message : String(error40)}`);
267385
+ });
267386
+ } else {
267387
+ stdinEndedBeforeHandle = true;
267388
+ }
266642
267389
  }
266643
267390
  });
266644
267391
  startupGate.start();
266645
- const { StdioServerTransport: StdioServerTransport2 } = await Promise.resolve().then(() => (init_stdio2(), stdio_exports));
266646
- const { createMemorixServer: createMemorixServer2 } = await Promise.resolve().then(() => (init_server4(), server_exports2));
266647
- const { detectProject: detectProject2, findGitInSubdirs: findGitInSubdirs2, isSystemDirectory: isSystemDirectory2 } = await Promise.resolve().then(() => (init_detector(), detector_exports));
266648
- const { homedir: homedir36 } = await import("os");
266649
- const { resolveServeProject: resolveServeProject2 } = await Promise.resolve().then(() => (init_serve_shared(), serve_shared_exports));
266650
267392
  let safeCwd;
266651
267393
  try {
266652
267394
  safeCwd = process.cwd();
@@ -266663,70 +267405,82 @@ var init_serve = __esm({
266663
267405
  },
266664
267406
  { detectProject: detectProject2, findGitInSubdirs: findGitInSubdirs2, isSystemDirectory: isSystemDirectory2 }
266665
267407
  );
266666
- for (const message of resolution.messages) {
266667
- console.error(message);
266668
- }
267408
+ for (const message of resolution.messages) console.error(message);
266669
267409
  if (!resolution.detectedProject) {
266670
267410
  console.error(`[memorix] [WARN] ${resolution.error}`);
266671
- console.error(`[memorix] Starting in deferred-binding mode \u2014 project will bind via MCP roots or memorix_session_start.`);
266672
- console.error(`[memorix] For non-git directories, use --allow-untracked to enable untracked/ fallback.`);
267411
+ console.error("[memorix] Starting in deferred-binding mode - bind with memorix_session_start(projectRoot=...) when needed.");
267412
+ console.error("[memorix] For non-git directories, use --allow-untracked to enable untracked/ fallback.");
266673
267413
  }
266674
267414
  const detected = resolution.detectedProject;
266675
267415
  const projectRoot = resolution.projectRoot;
266676
- if (detected) {
266677
- const { writeLastProjectRoot: writeLastProjectRoot2 } = await Promise.resolve().then(() => (init_launch_root(), launch_root_exports));
266678
- writeLastProjectRoot2(detected.rootPath);
266679
- }
267416
+ if (detected) writeLastProjectRoot2(detected.rootPath);
266680
267417
  const allowUntracked = args["allow-untracked"] ?? false;
266681
- const toolProfile = resolveToolProfile({ explicit: args.mode, envValue: process.env.MEMORIX_MODE, fallback: "micro" });
266682
- const serverOptions = detected ? { toolProfile, deferProjectRuntimeInit: true } : { allowUntrackedFallback: allowUntracked, deferProjectInitUntilBound: !allowUntracked, deferProjectRuntimeInit: true, toolProfile };
266683
- const { server, projectId, deferredInit, switchProject } = await createMemorixServer2(projectRoot, void 0, void 0, serverOptions);
266684
- const transport = new StdioServerTransport2(startupGate.input, process.stdout);
266685
- await server.connect(transport);
266686
- startupGate.markReady();
266687
- console.error(`[memorix] MCP Server running on stdio (project: ${projectId})`);
266688
- console.error(`[memorix] Project root: ${detected?.rootPath ?? projectRoot}`);
266689
- const tryRootsSwitch = async () => {
266690
- try {
266691
- const { roots } = await server.server.listRoots();
266692
- if (!roots || roots.length === 0) return;
266693
- for (const root of roots) {
266694
- if (!root.uri.startsWith("file://")) continue;
266695
- const rootPath = mcpFileUriToPath(root.uri);
266696
- if (!rootPath) continue;
266697
- const rootDetected = detectProject2(rootPath);
266698
- if (rootDetected) {
266699
- const switched = await switchProject(rootPath);
267418
+ const toolProfile = resolveToolProfile({
267419
+ explicit: args.mode,
267420
+ envValue: process.env.MEMORIX_MODE,
267421
+ fallback: "micro"
267422
+ });
267423
+ const transport = new StdioServerTransport(startupGate.input, process.stdout);
267424
+ const createBridge = async () => {
267425
+ const bridge = await createModernMcpBridge2({
267426
+ projectRoot,
267427
+ allowUntrackedFallback: allowUntracked,
267428
+ deferProjectInitUntilBound: !allowUntracked,
267429
+ deferProjectRuntimeInit: true,
267430
+ toolProfile
267431
+ });
267432
+ const tryRootsSwitch = async () => {
267433
+ try {
267434
+ if (bridge.memorix.isExplicitlyBound()) return;
267435
+ const { roots } = await bridge.server.listRoots();
267436
+ for (const root of roots ?? []) {
267437
+ if (!root.uri.startsWith("file://")) continue;
267438
+ const rootPath = mcpFileUriToPath(root.uri);
267439
+ if (!rootPath) continue;
267440
+ const switched = await bridge.memorix.switchProject(rootPath, "mcp-roots");
266700
267441
  if (switched) {
266701
- console.error(`[memorix] [UPDATED] Project updated via MCP roots: ${rootDetected.id}`);
267442
+ console.error(`[memorix] [UPDATED] Project updated via MCP roots: ${rootPath}`);
267443
+ return;
266702
267444
  }
266703
- return;
266704
- }
266705
- const subGit = findGitInSubdirs2(rootPath);
266706
- if (subGit) {
266707
- const switched = await switchProject(subGit);
266708
- if (switched) {
267445
+ const subGit = findGitInSubdirs2(rootPath);
267446
+ if (subGit && await bridge.memorix.switchProject(subGit, "mcp-roots")) {
266709
267447
  console.error(`[memorix] [UPDATED] Project updated via MCP roots (subdir): ${subGit}`);
267448
+ return;
266710
267449
  }
266711
- return;
266712
267450
  }
267451
+ } catch (error40) {
267452
+ console.error(`[memorix] MCP roots not available (${error40 instanceof Error ? error40.message : "unsupported"})`);
266713
267453
  }
266714
- } catch (err) {
266715
- console.error(`[memorix] MCP roots not available (${err.message ?? "unsupported"})`);
266716
- }
266717
- };
266718
- try {
266719
- const { RootsListChangedNotificationSchema: RootsListChangedNotificationSchema2 } = await Promise.resolve().then(() => (init_types8(), types_exports3));
266720
- server.server.setNotificationHandler(RootsListChangedNotificationSchema2, async () => {
266721
- console.error(`[memorix] Roots changed \u2014 re-detecting project...`);
267454
+ };
267455
+ bridge.server.setNotificationHandler("notifications/roots/list_changed", async () => {
266722
267456
  await tryRootsSwitch();
266723
267457
  });
266724
- } catch {
267458
+ const deferredInitTimer = setTimeout(() => {
267459
+ bridge.memorix.deferredInit().catch((error40) => {
267460
+ console.error(`[memorix] Deferred init error: ${error40 instanceof Error ? error40.message : String(error40)}`);
267461
+ });
267462
+ }, 5e3);
267463
+ deferredInitTimer.unref?.();
267464
+ const originalClose = bridge.close.bind(bridge);
267465
+ bridge.close = async () => {
267466
+ clearTimeout(deferredInitTimer);
267467
+ await originalClose();
267468
+ };
267469
+ return bridge;
267470
+ };
267471
+ stdioHandle = serveStdio(createBridge, {
267472
+ transport,
267473
+ legacy: "serve",
267474
+ onerror: (error40) => console.error(`[memorix] stdio MCP error: ${error40.message}`)
267475
+ });
267476
+ startupGate.markReady();
267477
+ if (stdinEndedBeforeHandle) {
267478
+ void stdioHandle.close().catch((error40) => {
267479
+ console.error(`[memorix] stdio close error: ${error40 instanceof Error ? error40.message : String(error40)}`);
267480
+ });
266725
267481
  }
266726
- const deferredInitTimer = setTimeout(() => {
266727
- deferredInit().catch((e5) => console.error(`[memorix] Deferred init error:`, e5));
266728
- }, 5e3);
266729
- deferredInitTimer.unref?.();
267482
+ console.error(`[memorix] MCP Server running on stdio (profile: ${toolProfile}, project: ${detected?.id ?? "deferred"})`);
267483
+ console.error(`[memorix] Project root: ${detected?.rootPath ?? projectRoot}`);
266730
267484
  Promise.resolve().then(() => (init_update_checker(), update_checker_exports)).then((m6) => m6.checkForUpdates()).catch(() => {
266731
267485
  });
266732
267486
  }
@@ -266743,15 +267497,17 @@ function getMcpDiagnostics() {
266743
267497
  legacy: LEGACY_MCP_PROTOCOL_VERSION,
266744
267498
  discovery: "supported",
266745
267499
  versionlessRequests: "legacy-compatible",
266746
- modernResultMetadata: "discovery-only",
266747
- statelessRequests: "compatibility-only",
267500
+ modernResultMetadata: "supported",
267501
+ statelessRequests: "supported",
266748
267502
  statefulStreamableHttp: "supported"
266749
267503
  },
266750
267504
  capabilities: {
266751
267505
  tasks: "unsupported",
266752
267506
  polling: "unsupported",
266753
- subscriptions: "unsupported",
266754
- listCache: "unsupported",
267507
+ subscriptions: "supported",
267508
+ // The protocol envelope is emitted, but TTL is intentionally zero until
267509
+ // Memorix can invalidate a durable per-project list cache correctly.
267510
+ listCache: "protocol-hints-only",
266755
267511
  explicitProjectHandle: "supported"
266756
267512
  }
266757
267513
  };
@@ -269040,6 +269796,7 @@ var init_serve_http = __esm({
269040
269796
  init_retention();
269041
269797
  init_visibility();
269042
269798
  init_mcp_diagnostics();
269799
+ init_mcp_discovery();
269043
269800
  init_port();
269044
269801
  init_mcp_root_path();
269045
269802
  DEFAULT_SESSION_TIMEOUT_MS = 12 * 60 * 60 * 1e3;
@@ -269084,6 +269841,9 @@ var init_serve_http = __esm({
269084
269841
  const { homedir: homedir36 } = await import("os");
269085
269842
  const { McpBindingStore: McpBindingStore2 } = await Promise.resolve().then(() => (init_mcp_binding_store(), mcp_binding_store_exports));
269086
269843
  const { MemoryFeedbackStore: MemoryFeedbackStore2 } = await Promise.resolve().then(() => (init_feedback(), feedback_exports));
269844
+ const { createModernMcpBridge: createModernMcpBridge2 } = await Promise.resolve().then(() => (init_modern_mcp_bridge(), modern_mcp_bridge_exports));
269845
+ const { createMcpHandler } = await import("@modelcontextprotocol/server");
269846
+ const { toNodeHandler } = await import("@modelcontextprotocol/node");
269087
269847
  let configuredDefaults = {};
269088
269848
  try {
269089
269849
  const { getServerConfig: getServerConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
@@ -269138,6 +269898,27 @@ var init_serve_http = __esm({
269138
269898
  }
269139
269899
  const statelessBindingStore = new McpBindingStore2();
269140
269900
  await statelessBindingStore.init(persistMod.getBaseDataDir());
269901
+ const modernMcpHandler = createMcpHandler(async ({ requestInfo }) => {
269902
+ const handleId = requestInfo?.headers.get("mcp-project-handle") ?? void 0;
269903
+ const persisted = handleId ? statelessBindingStore.touch(handleId) : void 0;
269904
+ const requestedRoot = requestInfo?.headers.get("mcp-project-root") ?? void 0;
269905
+ const root = persisted?.projectRoot ?? requestedRoot ?? projectRoot;
269906
+ return createModernMcpBridge2({
269907
+ projectRoot: root,
269908
+ allowUntrackedFallback: false,
269909
+ deferProjectInitUntilBound: true,
269910
+ deferProjectRuntimeInit: true,
269911
+ dashboardMode: "control-plane",
269912
+ dashboardPort: port,
269913
+ toolProfile
269914
+ });
269915
+ }, {
269916
+ // Legacy requests are routed to the existing sessionful implementation
269917
+ // below; this handler is strict modern-only by construction.
269918
+ legacy: "reject",
269919
+ responseMode: "auto"
269920
+ });
269921
+ const modernNodeHandler = toNodeHandler(modernMcpHandler);
269141
269922
  const sessions = /* @__PURE__ */ new Map();
269142
269923
  const sessionLastActivity = /* @__PURE__ */ new Map();
269143
269924
  const expiredSessions = /* @__PURE__ */ new Map();
@@ -269283,78 +270064,34 @@ var init_serve_http = __esm({
269283
270064
  res.setHeader("Mcp-Method", req.method || "UNKNOWN");
269284
270065
  res.setHeader("Mcp-Name", MCP_SERVER_NAME);
269285
270066
  }
269286
- async function handleStatelessPost(req, res, body) {
269287
- const handleId = typeof req.headers["mcp-project-handle"] === "string" ? req.headers["mcp-project-handle"] : void 0;
269288
- const persisted = handleId ? statelessBindingStore.touch(handleId) : void 0;
269289
- if (handleId && !persisted) {
269290
- res.writeHead(404, { "Content-Type": "application/json" });
269291
- res.end(JSON.stringify({ jsonrpc: "2.0", error: { code: -32001, message: "MCP project handle not found or expired; initialize again." }, id: null }));
269292
- return;
269293
- }
269294
- const requestedRoot = typeof req.headers["mcp-project-root"] === "string" ? req.headers["mcp-project-root"] : void 0;
269295
- const root = persisted?.projectRoot ?? requestedRoot ?? projectRoot;
269296
- const { createMemorixServer: createMemorixServer3 } = await Promise.resolve().then(() => (init_server4(), server_exports2));
269297
- const { createProjectBindingController: createProjectBindingController3 } = await Promise.resolve().then(() => (init_request_context(), request_context_exports));
269298
- const binding = createProjectBindingController3(root);
269299
- const { server, projectId, handleTransportClose } = await createMemorixServer3(
269300
- root,
269301
- void 0,
269302
- void 0,
269303
- {
269304
- allowUntrackedFallback: false,
269305
- deferProjectInitUntilBound: true,
269306
- deferProjectRuntimeInit: true,
269307
- dashboardMode: "control-plane",
269308
- dashboardPort: port,
269309
- toolProfile,
269310
- projectBinding: binding
269311
- }
269312
- );
269313
- const transport = new StreamableHTTPServerTransport2({
269314
- // No Mcp-Session-Id: the protocol state is carried by our explicit
269315
- // durable project handle and reconstructed on every request.
269316
- sessionIdGenerator: void 0,
269317
- enableJsonResponse: true
269318
- });
269319
- try {
269320
- await server.connect(transport);
269321
- let effectiveHandle = persisted;
269322
- if (!effectiveHandle && projectId !== "__unresolved__" && isInitializeRequest2(body)) {
269323
- effectiveHandle = statelessBindingStore.create({
269324
- projectId,
269325
- projectRoot: root,
269326
- dataDir: await persistMod.getProjectDataDir(projectId)
269327
- });
269328
- }
269329
- if (effectiveHandle) res.setHeader("Mcp-Project-Handle", effectiveHandle.handleId);
269330
- const sdkBody = body && typeof body === "object" ? JSON.parse(JSON.stringify(body)) : body;
269331
- const sdkRequest = sdkBody;
269332
- if (sdkRequest && typeof sdkRequest === "object" && sdkRequest.method === "initialize" && sdkRequest.params) {
269333
- sdkRequest.params.protocolVersion = MCP_SDK_COMPAT_PROTOCOL_VERSION;
269334
- }
269335
- if (req.headers["mcp-protocol-version"]) {
269336
- req.headers["mcp-protocol-version"] = MCP_SDK_COMPAT_PROTOCOL_VERSION;
269337
- for (let i4 = 0; i4 < req.rawHeaders.length; i4 += 2) {
269338
- if (req.rawHeaders[i4].toLowerCase() === "mcp-protocol-version") {
269339
- req.rawHeaders[i4 + 1] = MCP_SDK_COMPAT_PROTOCOL_VERSION;
269340
- break;
269341
- }
269342
- }
269343
- }
269344
- patchMcpResponse(res);
269345
- await transport.handleRequest(req, res, sdkBody);
269346
- } finally {
269347
- handleTransportClose();
269348
- await transport.close().catch(() => void 0);
269349
- }
269350
- }
269351
270067
  async function handlePost(req, res) {
269352
270068
  const sessionId = req.headers["mcp-session-id"];
269353
270069
  const body = await parseBody(req);
270070
+ const params = body && typeof body === "object" && !Array.isArray(body) ? body.params : void 0;
270071
+ const claimlessDiscovery = !sessionId && isServerDiscoverRequest(body) && !req.headers["mcp-protocol-version"] && !req.headers["mcp-method"] && req.headers["mcp-stateless"] !== "true" && (params === void 0 || typeof params === "object" && params !== null && !Array.isArray(params) && !Object.prototype.hasOwnProperty.call(params, "_meta"));
270072
+ if (claimlessDiscovery) {
270073
+ res.writeHead(200, { "Content-Type": "application/json" });
270074
+ res.end(JSON.stringify({
270075
+ jsonrpc: "2.0",
270076
+ id: body.id ?? null,
270077
+ result: createMcpStartupDiscoverResult(getMcpServerInfo())
270078
+ }));
270079
+ return;
270080
+ }
269354
270081
  const requestedProtocol = req.headers["mcp-protocol-version"];
269355
270082
  const statelessRequested = req.headers["mcp-stateless"] === "true" || requestedProtocol === CURRENT_MCP_PROTOCOL_VERSION || typeof req.headers["mcp-project-handle"] === "string" || isServerDiscoverRequest(body);
269356
270083
  if (!sessionId && statelessRequested) {
269357
- await handleStatelessPost(req, res, body);
270084
+ const handleId = typeof req.headers["mcp-project-handle"] === "string" ? req.headers["mcp-project-handle"] : void 0;
270085
+ if (handleId && !statelessBindingStore.touch(handleId)) {
270086
+ res.writeHead(404, { "Content-Type": "application/json" });
270087
+ res.end(JSON.stringify({
270088
+ jsonrpc: "2.0",
270089
+ error: { code: -32001, message: "MCP project handle not found or expired; initialize again." },
270090
+ id: null
270091
+ }));
270092
+ return;
270093
+ }
270094
+ await modernNodeHandler(req, res, body);
269358
270095
  return;
269359
270096
  }
269360
270097
  if (sessionId && sessions.has(sessionId)) {
@@ -270316,6 +271053,7 @@ var init_serve_http = __esm({
270316
271053
  sendJson2({ error: err instanceof Error ? err.message : "Unknown error" }, 500);
270317
271054
  }
270318
271055
  }
271056
+ let httpReadyAt = null;
270319
271057
  const httpServer = createServer3(async (req, res) => {
270320
271058
  setCorsHeaders(req, res);
270321
271059
  if (req.method === "OPTIONS") {
@@ -270330,9 +271068,13 @@ var init_serve_http = __esm({
270330
271068
  res.end(JSON.stringify({
270331
271069
  status: "ok",
270332
271070
  mode: "control-plane",
271071
+ profile: toolProfile,
270333
271072
  port,
270334
271073
  uptime: Math.round(process.uptime()),
270335
271074
  pid: process.pid,
271075
+ projectId: defaultProject?.id ?? "__unresolved__",
271076
+ projectName: defaultProject?.name ?? null,
271077
+ readyAt: httpReadyAt,
270336
271078
  embedding: getEmbeddingRuntimeHealth2()
270337
271079
  }));
270338
271080
  return;
@@ -270399,6 +271141,7 @@ var init_serve_http = __esm({
270399
271141
  httpServer.keepAliveTimeout = 6e4;
270400
271142
  httpServer.headersTimeout = 65e3;
270401
271143
  httpServer.listen(port, host, () => {
271144
+ httpReadyAt = (/* @__PURE__ */ new Date()).toISOString();
270402
271145
  try {
270403
271146
  const memorixDir = (process.env.HOME || process.env.USERPROFILE || "").replace(/\\/g, "/") + "/.memorix";
270404
271147
  mkdirSync12(memorixDir, { recursive: true });
@@ -275000,6 +275743,9 @@ function getStateFilePath() {
275000
275743
  function getLogFilePath() {
275001
275744
  return getMemorixDir() + "/background.log";
275002
275745
  }
275746
+ function getBackgroundLockPath() {
275747
+ return getMemorixDir() + "/background.lock";
275748
+ }
275003
275749
  function parseBoundedPositiveInteger(value, fallback, label, maximum) {
275004
275750
  const raw = value ?? String(fallback);
275005
275751
  if (!/^[0-9]+$/u.test(raw)) {
@@ -275163,25 +275909,82 @@ async function startWindowsBackgroundService(options) {
275163
275909
  });
275164
275910
  }
275165
275911
  async function healthCheck(port, timeoutMs = 3e3) {
275912
+ const controller = new AbortController();
275913
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
275166
275914
  try {
275167
- const controller = new AbortController();
275168
- const timer = setTimeout(() => controller.abort(), timeoutMs);
275169
275915
  const res = await fetch(`http://127.0.0.1:${port}/health`, {
275170
275916
  signal: controller.signal
275171
275917
  });
275172
- clearTimeout(timer);
275173
275918
  if (!res.ok) return { ok: false, error: `HTTP ${res.status}` };
275174
275919
  const data = await res.json();
275175
275920
  return { ok: true, data };
275176
275921
  } catch (err) {
275177
275922
  return { ok: false, error: err instanceof Error ? err.message : "Unknown error" };
275923
+ } finally {
275924
+ clearTimeout(timer);
275178
275925
  }
275179
275926
  }
275180
275927
  async function isPortInUse(port) {
275181
275928
  const health = await healthCheck(port, 1500);
275182
275929
  return health.ok;
275183
275930
  }
275184
- async function doStart(port) {
275931
+ async function acquireBackgroundLock(lockPath, staleMs = BACKGROUND_LOCK_STALE_MS, timeoutMs = BACKGROUND_LOCK_ACQUIRE_TIMEOUT_MS) {
275932
+ const lockDir = path44.dirname(lockPath);
275933
+ if (!fs26.existsSync(lockDir)) fs26.mkdirSync(lockDir, { recursive: true });
275934
+ const deadline = Date.now() + timeoutMs;
275935
+ while (Date.now() < deadline) {
275936
+ try {
275937
+ const fd = fs26.openSync(lockPath, "wx");
275938
+ const token = `${process.pid}:${randomBytes2(12).toString("hex")}`;
275939
+ fs26.writeSync(fd, JSON.stringify({ pid: process.pid, acquiredAt: Date.now(), token }));
275940
+ const heartbeat = setInterval(() => {
275941
+ try {
275942
+ const now3 = /* @__PURE__ */ new Date();
275943
+ fs26.futimesSync(fd, now3, now3);
275944
+ } catch {
275945
+ }
275946
+ }, BACKGROUND_LOCK_HEARTBEAT_MS);
275947
+ heartbeat.unref();
275948
+ return { fd, acquired: true, path: lockPath, token, heartbeat };
275949
+ } catch (err) {
275950
+ if (!(err && err.code === "EEXIST")) throw err;
275951
+ try {
275952
+ if (Date.now() - fs26.statSync(lockPath).mtimeMs > staleMs) {
275953
+ let ownerAlive = false;
275954
+ try {
275955
+ const raw = fs26.readFileSync(lockPath, "utf8");
275956
+ const owner = JSON.parse(raw);
275957
+ ownerAlive = typeof owner.pid === "number" && owner.pid > 0 && isProcessRunning(owner.pid);
275958
+ } catch {
275959
+ }
275960
+ if (!ownerAlive) {
275961
+ fs26.unlinkSync(lockPath);
275962
+ continue;
275963
+ }
275964
+ }
275965
+ } catch {
275966
+ }
275967
+ await new Promise((resolve6) => setTimeout(resolve6, 200));
275968
+ }
275969
+ }
275970
+ throw new Error(
275971
+ `Another Memorix background start is still in progress (${lockPath}). Wait a few seconds and retry; no second control plane was started.`
275972
+ );
275973
+ }
275974
+ function releaseBackgroundLock(lock) {
275975
+ if (!lock.acquired) return;
275976
+ if (lock.heartbeat) clearInterval(lock.heartbeat);
275977
+ try {
275978
+ if (lock.fd !== null) fs26.closeSync(lock.fd);
275979
+ } catch {
275980
+ }
275981
+ try {
275982
+ const current = JSON.parse(fs26.readFileSync(lock.path, "utf8"));
275983
+ if (current.token === lock.token) fs26.unlinkSync(lock.path);
275984
+ } catch {
275985
+ }
275986
+ }
275987
+ async function doStartUnlocked(port) {
275185
275988
  const state = loadState();
275186
275989
  if (state) {
275187
275990
  if (isProcessRunning(state.pid)) {
@@ -275334,6 +276137,14 @@ async function doStart(port) {
275334
276137
  ].join("\n");
275335
276138
  process.stderr.write(footer + "\n");
275336
276139
  }
276140
+ async function doStart(port) {
276141
+ const lock = await acquireBackgroundLock(getBackgroundLockPath());
276142
+ try {
276143
+ await doStartUnlocked(port);
276144
+ } finally {
276145
+ releaseBackgroundLock(lock);
276146
+ }
276147
+ }
275337
276148
  async function doStop() {
275338
276149
  const state = loadState();
275339
276150
  if (!state) {
@@ -275393,11 +276204,22 @@ async function doStop() {
275393
276204
  }
275394
276205
  console.log("[OK] Control plane stopped.");
275395
276206
  }
275396
- async function doStatus() {
276207
+ async function doStatus(asJson = false) {
275397
276208
  const state = loadState();
275398
276209
  if (!state) {
275399
276210
  const portHealth = await healthCheck(3211, 2e3);
275400
276211
  if (portHealth.ok) {
276212
+ if (asJson) {
276213
+ console.log(JSON.stringify({
276214
+ status: "unmanaged",
276215
+ managed: false,
276216
+ port: 3211,
276217
+ dashboard: "http://127.0.0.1:3211/",
276218
+ mcp: "http://127.0.0.1:3211/mcp",
276219
+ health: portHealth.data ?? null
276220
+ }, null, 2));
276221
+ return;
276222
+ }
275401
276223
  console.log("");
275402
276224
  console.log("No background control plane is registered,");
275403
276225
  console.log('but a Memorix instance IS running on port 3211 (likely a foreground "memorix serve-http").');
@@ -275417,6 +276239,10 @@ async function doStatus() {
275417
276239
  console.log(' 2. Run "memorix background start"');
275418
276240
  console.log("");
275419
276241
  } else {
276242
+ if (asJson) {
276243
+ console.log(JSON.stringify({ status: "stopped", managed: false, port: 3211 }, null, 2));
276244
+ return;
276245
+ }
275420
276246
  console.log("No background control plane is registered.");
275421
276247
  console.log("");
275422
276248
  console.log("Start one with: memorix background start");
@@ -275427,6 +276253,30 @@ async function doStatus() {
275427
276253
  const health = running ? await healthCheck(state.port) : { ok: false, error: "Process not running" };
275428
276254
  const pidMismatch = health.ok && health.data?.pid && health.data.pid !== state.pid;
275429
276255
  const probablyReused = running && !health.ok;
276256
+ const status = health.ok && !pidMismatch ? "running" : pidMismatch ? "pid-mismatch" : probablyReused ? "pid-reused" : running ? "starting" : "stopped";
276257
+ if (asJson) {
276258
+ if (pidMismatch || probablyReused || !running) {
276259
+ clearState();
276260
+ try {
276261
+ fs26.unlinkSync(getMemorixDir() + "/background.ready");
276262
+ } catch {
276263
+ }
276264
+ }
276265
+ console.log(JSON.stringify({
276266
+ status,
276267
+ managed: true,
276268
+ pid: state.pid,
276269
+ port: state.port,
276270
+ startedAt: state.startedAt,
276271
+ instance: state.instanceToken ? `${state.instanceToken.slice(0, 8)}\u2026` : null,
276272
+ dashboard: `http://127.0.0.1:${state.port}/`,
276273
+ mcp: `http://127.0.0.1:${state.port}/mcp`,
276274
+ logFile: normalizePath3(state.logFile),
276275
+ health: health.ok ? health.data ?? null : null,
276276
+ error: health.ok ? null : health.error ?? (running ? "Health check failed" : "Process not running")
276277
+ }, null, 2));
276278
+ return;
276279
+ }
275430
276280
  console.log("");
275431
276281
  console.log("Memorix Background Control Plane");
275432
276282
  console.log("================================");
@@ -275446,6 +276296,9 @@ async function doStatus() {
275446
276296
  console.log(` PID: ${d4.pid ?? "unknown"}`);
275447
276297
  console.log(` Uptime: ${d4.uptime ?? 0}s`);
275448
276298
  console.log(` Mode: ${d4.mode ?? "unknown"}`);
276299
+ console.log(` Profile: ${d4.profile ?? "unknown"}`);
276300
+ console.log(` Project: ${d4.projectId ?? "unresolved"}${d4.projectName ? ` (${d4.projectName})` : ""}`);
276301
+ console.log(` Ready at: ${d4.readyAt ?? "unknown"}`);
275449
276302
  }
275450
276303
  if (pidMismatch) {
275451
276304
  console.log("");
@@ -275539,7 +276392,7 @@ function doLogs(follow, lines) {
275539
276392
  console.log(tail.join("\n"));
275540
276393
  }
275541
276394
  }
275542
- var background_default, _testing3;
276395
+ var BACKGROUND_LOCK_STALE_MS, BACKGROUND_LOCK_ACQUIRE_TIMEOUT_MS, BACKGROUND_LOCK_HEARTBEAT_MS, background_default, _testing3;
275543
276396
  var init_background = __esm({
275544
276397
  "src/cli/commands/background.ts"() {
275545
276398
  "use strict";
@@ -275547,6 +276400,9 @@ var init_background = __esm({
275547
276400
  init_dist2();
275548
276401
  init_port();
275549
276402
  init_launch_root();
276403
+ BACKGROUND_LOCK_STALE_MS = 15e3;
276404
+ BACKGROUND_LOCK_ACQUIRE_TIMEOUT_MS = 1e4;
276405
+ BACKGROUND_LOCK_HEARTBEAT_MS = 2e3;
275550
276406
  background_default = defineCommand({
275551
276407
  meta: {
275552
276408
  name: "background",
@@ -275569,6 +276425,11 @@ var init_background = __esm({
275569
276425
  alias: "n",
275570
276426
  description: "Number of log lines to show (default: 50)",
275571
276427
  required: false
276428
+ },
276429
+ json: {
276430
+ type: "boolean",
276431
+ description: "Emit a machine-readable status receipt",
276432
+ required: false
275572
276433
  }
275573
276434
  },
275574
276435
  run: async ({ args }) => {
@@ -275583,7 +276444,7 @@ var init_background = __esm({
275583
276444
  await doStop();
275584
276445
  break;
275585
276446
  case "status":
275586
- await doStatus();
276447
+ await doStatus(!!args.json);
275587
276448
  break;
275588
276449
  case "restart":
275589
276450
  await doRestart(port);
@@ -275609,6 +276470,7 @@ var init_background = __esm({
275609
276470
  console.log(" --port <port> HTTP port (default: 3211)");
275610
276471
  console.log(' --follow, -f Follow log output in real-time (for "logs")');
275611
276472
  console.log(" --lines, -n Number of log lines to show (default: 50)");
276473
+ console.log(' --json Emit a machine-readable status receipt (for "status")');
275612
276474
  console.log("");
275613
276475
  console.log("Mode distinction:");
275614
276476
  console.log(" Quick Mode = stdio / single project / zero friction");
@@ -275630,7 +276492,10 @@ var init_background = __esm({
275630
276492
  formatBackgroundCommandError,
275631
276493
  resolveBackgroundCliEntry,
275632
276494
  resolveBackgroundCliEntryFrom,
275633
- resolveBackgroundCwd
276495
+ resolveBackgroundCwd,
276496
+ acquireBackgroundLock,
276497
+ releaseBackgroundLock,
276498
+ getBackgroundLockPath
275634
276499
  };
275635
276500
  }
275636
276501
  });
@@ -285996,6 +286861,10 @@ var GUIDES = {
285996
286861
  usage: [
285997
286862
  "memorix codegraph status",
285998
286863
  "memorix codegraph refresh",
286864
+ "memorix codegraph init",
286865
+ "memorix codegraph sync",
286866
+ "memorix codegraph diff [--from <snapshot>] [--to <snapshot>]",
286867
+ "memorix codegraph impact --path <relative-source-path>",
285999
286868
  'memorix codegraph context-pack --task "trace the auth flow" [--limit 20]'
286000
286869
  ]
286001
286870
  },
@@ -286014,10 +286883,57 @@ var GUIDES = {
286014
286883
  usage: [
286015
286884
  "memorix knowledge init [--mode local|versioned]",
286016
286885
  "memorix knowledge status",
286886
+ "memorix knowledge claims",
286887
+ 'memorix knowledge review --id <claim-id> --review approved|rejected --detail "..."',
286017
286888
  "memorix knowledge compile",
286018
286889
  "memorix knowledge lint",
286019
- "memorix knowledge workflow list"
286020
- ]
286890
+ "memorix knowledge apply --proposal <id> [--force]",
286891
+ "memorix knowledge workflow import|list",
286892
+ 'memorix knowledge workflow select --task "prepare a release"',
286893
+ "memorix knowledge workflow preview|apply --id <workflow-id> --agent codex",
286894
+ 'memorix knowledge workflow run --id <workflow-id> --task "..." --outcome passed'
286895
+ ],
286896
+ notes: ["Claims need source review before they can become maintained Knowledge Workspace pages."]
286897
+ },
286898
+ evidence: {
286899
+ summary: "Inspect the source, freshness, and verification state behind project memories.",
286900
+ usage: [
286901
+ 'memorix evidence list [--query "auth"] [--limit 20]',
286902
+ "memorix evidence get --id 42",
286903
+ "memorix evidence sync",
286904
+ 'memorix evidence stale --paths src/server.ts,tests/server.test.ts --reason "source changed"',
286905
+ "memorix evidence events --id 42"
286906
+ ],
286907
+ notes: ["Evidence cards point back to observations and source files; they are not a second memory store."]
286908
+ },
286909
+ feedback: {
286910
+ summary: "Record and inspect whether a memory helped, conflicted, or was corrected.",
286911
+ usage: [
286912
+ "memorix feedback record --id 42 --signal verification-success --source test:run-1",
286913
+ "memorix feedback show --id 42",
286914
+ "memorix feedback audit --id 42 [--limit 100]"
286915
+ ],
286916
+ notes: ["Feedback changes the candidate score through an auditable event; it does not rewrite the original memory."]
286917
+ },
286918
+ formation: {
286919
+ summary: "Inspect Memory Formation quality metrics collected by the runtime.",
286920
+ usage: ["memorix formation metrics"],
286921
+ notes: ["Metrics are empty until the formation pipeline has processed observations."]
286922
+ },
286923
+ media: {
286924
+ summary: "Import, inspect, derive, embed, and clean controlled local media assets.",
286925
+ usage: [
286926
+ "memorix media import --path ./diagram.png",
286927
+ 'memorix media attach --asset <asset-id> --title "Architecture diagram"',
286928
+ "memorix media list --kind image",
286929
+ "memorix media show --asset <asset-id>",
286930
+ "memorix media derive-pdf|derive-audio --asset <asset-id> [--attach]",
286931
+ "memorix media embed|similar --asset <asset-id>",
286932
+ 'memorix media generate image|video --prompt "..."',
286933
+ "memorix media status|cancel --job <media-job-id>",
286934
+ "memorix media cleanup [--max-bytes <limit>]"
286935
+ ],
286936
+ notes: ["Media generation is explicit and provider-gated; importing a file does not automatically send it to a model."]
286021
286937
  },
286022
286938
  reasoning: {
286023
286939
  summary: "Capture and retrieve engineering decision rationale.",
@@ -286510,7 +287426,7 @@ var main2 = defineCommand({
286510
287426
  console.error(" integrate Install one IDE integration into the current repo");
286511
287427
  console.error(" status Show project info + stats");
286512
287428
  console.error(" dashboard Open standalone dashboard (read-mostly)");
286513
- console.error(" hooks Open legacy hook installer menu");
287429
+ console.error(" hooks Install, inspect, or remove agent hooks");
286514
287430
  console.error(" cleanup Remove old memories");
286515
287431
  console.error(" purge Retire all memories (project by default, --all for everything)");
286516
287432
  console.error(" sync Rules/workspace sync plus interactive wizard");