@broberg/lens-daemon 0.1.58 → 0.1.59

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 (2) hide show
  1. package/package.json +3 -3
  2. package/src/flow.ts +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@broberg/lens-daemon",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "The Lens module of the cardmem daemon (flows, critic, coverage, capture sessions, the /lens/* routes and the cardmem-lens MCP) as a package. The daemon mounts createLensRouter(deps) + createLensMcpRouter(deps). Bun runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -15,8 +15,8 @@
15
15
  "sharp": "^0.35.5",
16
16
  "turndown": "^7.2.4",
17
17
  "zod": "^3.23.8",
18
- "@broberg/lens-svg": "0.1.1",
19
- "@broberg/lens-engine": "0.14.1"
18
+ "@broberg/lens-engine": "0.14.1",
19
+ "@broberg/lens-svg": "0.1.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@happy-dom/global-registrator": "^20.10.6",
package/src/flow.ts CHANGED
@@ -610,7 +610,17 @@ export function parseFlow(input: unknown): Flow {
610
610
  }
611
611
  let browsers: Record<string, { auth: AuthConfig }> | undefined;
612
612
  if (f.browsers !== undefined) {
613
- const b = f.browsers as unknown;
613
+ // F009.142 — an MCP client whose tool list predates the field sends it as a JSON
614
+ // string; read it like coerceAuth reads auth, never drop it (a dropped login would
615
+ // run both browsers as one user and still report green).
616
+ let b = f.browsers as unknown;
617
+ if (typeof b === 'string') {
618
+ try {
619
+ b = JSON.parse(b);
620
+ } catch {
621
+ throw new Error('flow.browsers was a string but not valid JSON — pass {<name>: {auth: {...}}}');
622
+ }
623
+ }
614
624
  if (!b || typeof b !== 'object' || Array.isArray(b)) throw new Error('flow.browsers must be {<name>: {auth: {...}}}');
615
625
  browsers = {};
616
626
  for (const [name, v] of Object.entries(b as Record<string, unknown>)) {