@plur-ai/mcp 0.9.10 → 0.9.11

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.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync, statSy
5
5
  import { join } from "path";
6
6
  import { fileURLToPath } from "url";
7
7
  import { homedir, platform } from "os";
8
- var VERSION = "0.9.10";
8
+ var VERSION = "0.9.11";
9
9
  var HELP = `plur-mcp v${VERSION} \u2014 persistent memory for AI agents
10
10
 
11
11
  Usage:
@@ -279,7 +279,7 @@ if (arg === "init") {
279
279
  process.exit(0);
280
280
  }
281
281
  if (arg === "serve" || arg === void 0) {
282
- const { runStdio } = await import("./server-GRHXPO6E.js");
282
+ const { runStdio } = await import("./server-FHZHOMM5.js");
283
283
  runStdio().catch((err) => {
284
284
  console.error("Failed to start PLUR MCP server:", err);
285
285
  process.exit(1);
@@ -17,7 +17,7 @@ import { Plur as Plur2, checkForUpdate } from "@plur-ai/core";
17
17
  import { extractMetaEngrams, validateMetaEngram, confidenceBand, generateProfile, getProfileForInjection, selectModelForOperation, getCachedUpdateCheck, minorVersionsBehind, scanForTensions, CapabilityCanary } from "@plur-ai/core";
18
18
 
19
19
  // src/version.ts
20
- var VERSION = "0.9.10";
20
+ var VERSION = "0.9.11";
21
21
 
22
22
  // src/tools.ts
23
23
  function makeHttpLlm(baseUrl, apiKey, model = "gpt-4o-mini") {
@@ -1082,14 +1082,21 @@ Include at least one engram_suggestion if ANYTHING was learned. An empty suggest
1082
1082
  engram_suggestions: {
1083
1083
  type: "array",
1084
1084
  items: {
1085
- type: "object",
1086
- properties: {
1087
- statement: { type: "string", description: "A concise, reusable assertion. Write it as advice to your future self." },
1088
- type: { type: "string", enum: ["behavioral", "terminological", "procedural", "architectural"] }
1089
- },
1090
- required: ["statement"]
1085
+ // Prefer {statement, type} objects. Bare strings are tolerated
1086
+ // and treated as {statement: <string>} (issue #231).
1087
+ anyOf: [
1088
+ { type: "string" },
1089
+ {
1090
+ type: "object",
1091
+ properties: {
1092
+ statement: { type: "string", description: "A concise, reusable assertion. Write it as advice to your future self." },
1093
+ type: { type: "string", enum: ["behavioral", "terminological", "procedural", "architectural"] }
1094
+ },
1095
+ required: ["statement"]
1096
+ }
1097
+ ]
1091
1098
  },
1092
- description: "Learnings from this session. Review the conversation for corrections, preferences, patterns, and technical facts before calling."
1099
+ description: 'Learnings from this session. Preferred shape is {statement: "...", type?: "..."}; bare strings are also accepted and treated as the statement. Review the conversation for corrections, preferences, patterns, and technical facts before calling.'
1093
1100
  }
1094
1101
  },
1095
1102
  required: ["summary", "engram_suggestions"]
@@ -1099,9 +1106,23 @@ Include at least one engram_suggestion if ANYTHING was learned. An empty suggest
1099
1106
  const session_id = args.session_id;
1100
1107
  const suggestions = args.engram_suggestions;
1101
1108
  let engrams_created = 0;
1102
- if (suggestions?.length) {
1103
- for (const s of suggestions) {
1104
- plur.learn(s.statement, { type: s.type });
1109
+ if (Array.isArray(suggestions) && suggestions.length) {
1110
+ for (let i = 0; i < suggestions.length; i++) {
1111
+ const s = suggestions[i];
1112
+ let statement;
1113
+ let type;
1114
+ if (typeof s === "string") {
1115
+ statement = s;
1116
+ } else if (s && typeof s === "object") {
1117
+ statement = s.statement;
1118
+ type = s.type;
1119
+ }
1120
+ if (typeof statement !== "string" || statement.length === 0) {
1121
+ throw new Error(
1122
+ `engram_suggestions[${i}] must be a string or {statement: string, type?: string}, got ${typeof s}`
1123
+ );
1124
+ }
1125
+ plur.learn(statement, { type });
1105
1126
  engrams_created++;
1106
1127
  }
1107
1128
  }
@@ -1160,7 +1181,7 @@ Include at least one engram_suggestion if ANYTHING was learned. An empty suggest
1160
1181
  annotations: { title: "List stores", readOnlyHint: true, idempotentHint: true },
1161
1182
  inputSchema: { type: "object", properties: {} },
1162
1183
  handler: async (_args, plur) => {
1163
- const stores = plur.listStores();
1184
+ const stores = await plur.listStoresAsync();
1164
1185
  const outboxCount = plur.outboxCount();
1165
1186
  return {
1166
1187
  stores,
@@ -1641,6 +1662,31 @@ Use \`scope\` to namespace engrams per project:
1641
1662
 
1642
1663
  Override with \`PLUR_PATH\` environment variable.
1643
1664
  `;
1665
+ function jsonSchemaPropToZod(prop) {
1666
+ if (!prop || typeof prop !== "object") return z.unknown();
1667
+ const variants = prop.anyOf ?? prop.oneOf;
1668
+ if (Array.isArray(variants) && variants.length > 0) {
1669
+ const zodVariants = variants.map(jsonSchemaPropToZod);
1670
+ if (zodVariants.length === 1) return zodVariants[0];
1671
+ return z.union(zodVariants);
1672
+ }
1673
+ if (prop.type === "string") return prop.enum ? z.enum(prop.enum) : z.string();
1674
+ if (prop.type === "number" || prop.type === "integer") return z.number();
1675
+ if (prop.type === "boolean") return z.boolean();
1676
+ if (prop.type === "array") {
1677
+ const itemSchema = prop.items ? jsonSchemaPropToZod(prop.items) : z.unknown();
1678
+ return z.array(itemSchema);
1679
+ }
1680
+ if (prop.type === "object" && prop.properties) {
1681
+ const shape = {};
1682
+ for (const [k, p] of Object.entries(prop.properties)) {
1683
+ const field = jsonSchemaPropToZod(p);
1684
+ shape[k] = prop.required?.includes(k) ? field : field.optional();
1685
+ }
1686
+ return z.object(shape).passthrough();
1687
+ }
1688
+ return z.unknown();
1689
+ }
1644
1690
  async function createServer(plur) {
1645
1691
  const instance = plur ?? new Plur2();
1646
1692
  const tools = getToolDefinitions();
@@ -1683,12 +1729,7 @@ async function createServer(plur) {
1683
1729
  if (schema?.properties) {
1684
1730
  const shape = {};
1685
1731
  for (const [key, prop] of Object.entries(schema.properties)) {
1686
- let field;
1687
- if (prop.type === "string") field = prop.enum ? z.enum(prop.enum) : z.string();
1688
- else if (prop.type === "number") field = z.number();
1689
- else if (prop.type === "boolean") field = z.boolean();
1690
- else if (prop.type === "array") field = z.array(z.unknown());
1691
- else field = z.unknown();
1732
+ const field = jsonSchemaPropToZod(prop);
1692
1733
  shape[key] = schema.required?.includes(key) ? field : field.optional();
1693
1734
  }
1694
1735
  const parsed = z.object(shape).passthrough().safeParse(args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plur-ai/mcp",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "plur-mcp": "dist/index.js"
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@modelcontextprotocol/sdk": "^1.12.0",
15
15
  "zod": "^3.23.0",
16
- "@plur-ai/core": "0.9.10"
16
+ "@plur-ai/core": "0.9.11"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^25.5.0"