cbrowser 18.75.0 → 18.75.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgvIpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAE1D;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvE;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAWpD"}
1
+ {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmxIpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAE1D;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvE;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAWpD"}
@@ -12,6 +12,7 @@
12
12
  * Or: npx cbrowser mcp-server
13
13
  */
14
14
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
15
+ import { PERSONA_CATEGORIES } from "./persona-questionnaire.js";
15
16
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
16
17
  import { z } from "zod";
17
18
  import { CBrowser } from "./browser.js";
@@ -230,6 +231,33 @@ const VALUES_QUESTIONS = [
230
231
  },
231
232
  ];
232
233
  const questionnaireSessionsMap = new Map();
234
+ /**
235
+ * Group a flat Schwartz/SDT value record into the nested schema every other
236
+ * values-returning path uses (schwartz / higherOrder / sdt / maslowLevel).
237
+ *
238
+ * persona_questionnaire_build emitted `values` FLAT, with Schwartz and SDT
239
+ * merged and no higherOrder grouping — so the C4b nested-schema fix never
240
+ * reached the creation path, and a persona built through the questionnaire had
241
+ * a different value shape from the same persona loaded back. Three sites
242
+ * already hand-write this grouping; this is the shared one. (2026-07-29)
243
+ */
244
+ function nestPersonaValues(values) {
245
+ if (!values)
246
+ return undefined;
247
+ const pick = (...keys) => {
248
+ const out = {};
249
+ for (const k of keys)
250
+ if (values[k] !== undefined)
251
+ out[k] = values[k];
252
+ return out;
253
+ };
254
+ return {
255
+ schwartz: pick("selfDirection", "stimulation", "hedonism", "achievement", "power", "security", "conformity", "tradition", "benevolence", "universalism"),
256
+ higherOrder: pick("openness", "selfEnhancement", "conservation", "selfTranscendence"),
257
+ sdt: pick("autonomyNeed", "competenceNeed", "relatednessNeed"),
258
+ maslowLevel: values.maslowLevel,
259
+ };
260
+ }
233
261
  function getQuestionnaireSession(sessionId) {
234
262
  return questionnaireSessionsMap.get(sessionId);
235
263
  }
@@ -1953,7 +1981,7 @@ This ensures personas are grounded in research, not stereotypes.
1953
1981
  };
1954
1982
  });
1955
1983
  server.tool("persona_category_guidance", "Get research-based guidance for a specific persona category. Explains what values are appropriate and why, with citations. Use before building a persona to understand category constraints.", {
1956
- category: z.enum(["cognitive", "physical", "sensory", "emotional", "general"]).describe("Persona category to get guidance for"),
1984
+ category: z.enum(PERSONA_CATEGORIES).describe("Persona category to get guidance for"),
1957
1985
  }, async ({ category }) => {
1958
1986
  const { getCategoryValuePreset, COGNITIVE_SUBTYPES, } = await import("./persona-questionnaire.js");
1959
1987
  const preset = getCategoryValuePreset(category);
@@ -1983,6 +2011,11 @@ This ensures personas are grounded in research, not stereotypes.
1983
2011
  sensory: "Use neutral (0.5) values. Sensory perception ≠ motivational psychology. Color-blindness doesn't make someone more/less achievement-oriented.",
1984
2012
  emotional: "Apply trait-based values from personality psychology (e.g., anxiety = high security-seeking).",
1985
2013
  general: "Use population baselines. Specific characteristics come from cognitive traits, not disability-based value shifts.",
2014
+ // Added 2026-07-29: this table covered five of the six
2015
+ // categories, and TypeScript flagged it the moment the enum
2016
+ // stopped silently excluding "agent". An unlisted key would have
2017
+ // yielded `undefined` guidance beside a populated preset.
2018
+ agent: "Agent personas are not human — motivational values do not apply. Use trait-based capability values (parsing, retrieval, tool use) and do NOT project human needs like security or belonging onto them.",
1986
2019
  }[category],
1987
2020
  }, null, 2),
1988
2021
  },
@@ -1993,7 +2026,7 @@ This ensures personas are grounded in research, not stereotypes.
1993
2026
  name: z.string().describe("Name for the new persona"),
1994
2027
  description: z.string().describe("Description of the persona"),
1995
2028
  answers: z.record(z.string(), z.number()).describe("Map of trait names to values (0-1), e.g. {patience: 0.25, riskTolerance: 0.75}"),
1996
- category: z.enum(["cognitive", "physical", "sensory", "emotional", "general"]).optional().describe("Persona category for value safeguards. Auto-detected from name/description if not provided."),
2029
+ category: z.enum(PERSONA_CATEGORIES).optional().describe("Persona category for value safeguards. Auto-detected from name/description if not provided."),
1997
2030
  valueOverrides: z.record(z.string(), z.number()).optional().describe("Override specific Schwartz values (0-1), e.g. {security: 0.8, stimulation: 0.3}"),
1998
2031
  save: z.boolean().optional().default(true).describe("Save the persona to disk for future use"),
1999
2032
  }, async ({ name, description, answers, category, valueOverrides, save }) => {
@@ -2047,7 +2080,10 @@ This ensures personas are grounded in research, not stereotypes.
2047
2080
  strategy: categoryResult.valueStrategy,
2048
2081
  guidance: categoryResult.guidance,
2049
2082
  },
2083
+ // Flat shape retained for callers that already read it; the nested
2084
+ // grouping is what every other values-returning path emits.
2050
2085
  values: categoryResult.values,
2086
+ valuesNested: nestPersonaValues(categoryResult.values),
2051
2087
  researchBasis: subtypeValues
2052
2088
  ? [...categoryResult.researchBasis, subtypeValues.researchBasis]
2053
2089
  : categoryResult.researchBasis,