@clien-ai/mcp 0.4.0 → 0.5.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,105 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@clien-ai/mcp`.
4
+
5
+ This file starts at 0.5.0. The 0.3.0 and 0.4.0 entries below were reconstructed
6
+ from merge history after the fact and are deliberately terse — they record what
7
+ changed, not the reasoning, which lives in the linked PRs. Versions before 0.3.0
8
+ have no entry; nothing was written down at the time and inventing one now would
9
+ be worse than the gap.
10
+
11
+ The client and the Clien.ai app ship on **independent release cycles**. An
12
+ upgrade here does not imply the deployed app speaks the same shape, and the
13
+ client strips unknown fields by construction — so a field described below only
14
+ reaches you once both sides have shipped.
15
+
16
+ ## 0.5.0
17
+
18
+ The release where **agent-visible output stops being forgeable**.
19
+
20
+ 0.4.0 made the trust spine reach the agent. This one makes what reaches the
21
+ agent trustworthy: every renderer in this package builds line-structured text
22
+ (`- Name (id: uuid)`, `Funding: X [GROUNDED]`) that an agent parses as the
23
+ server's own statements, and until now several of them interpolated untrusted
24
+ values into those lines raw.
25
+
26
+ ### Fixed
27
+
28
+ - **Line-structured forgery, closed across nine renderers** (FUL-253, #493).
29
+ A newline inside an interpolated value ended the line early, and everything
30
+ after it became a line the agent read as the server's own. Untrusted values
31
+ are now whitespace-flattened before rendering, so a crafted forum post cannot
32
+ forge a line that reads as this server's output. The value is still shown in
33
+ full-width — flattening bounds where it can appear, not whether it appears.
34
+
35
+ Covered: `list_community_signals`, `search_forums` (`renderThreads` and
36
+ `renderCompetitors`), `clien_research_status`, `list_personas`,
37
+ `list_interviews`, and the `get_report` trust digest's claim spines, receipt
38
+ lines and robustness rows.
39
+
40
+ The sharpest case was the claim spine, where a newline in a claim's text could
41
+ forge `- [GROUNDED] … ← RRCP-s0` — a receipt for a claim nothing had checked,
42
+ which is the exact invariant the digest exists to hold.
43
+
44
+ ⚠️ The GROUNDED gates deliberately read the **raw** state while the row renders
45
+ the flattened one. Flattening trims, so gating on the flattened value would
46
+ newly admit a padded `" GROUNDED "` as grounded and put a row's badge at odds
47
+ with the tallies, which read raw. Flattening is for the render; it must never
48
+ widen what counts as a receipt. There is a test per spine holding this — the
49
+ two variables are load-bearing, not redundant.
50
+
51
+ - **Receipt quotes are windowed around the verified span** (FUL-252, #492).
52
+ A quote longer than the excerpt cap was clipped from the head, so the span the
53
+ verifier actually grounded could fall outside the text a reader sees — a
54
+ receipt that did not show its own evidence. The excerpt is now centred on the
55
+ span.
56
+
57
+ ⚠️ The span lookup matches the **verifier's** comparison (NFC, case-folded,
58
+ whitespace-collapsed, fuzzy at 0.95), not a case-sensitive `indexOf`. A
59
+ language-default lookup silently re-creates the bug for exactly the claims the
60
+ verifier was most generous about.
61
+
62
+ - `clien_research_status` renders its disambiguators, and `list_competitors`
63
+ bounds its payload (FUL-252, #492). Measured: 20.7 → 15.4 KB at `limit=20`,
64
+ 99.9 → 72.8 KB at `limit=100`.
65
+
66
+ - **`null` is preserved where it means "we asked, the answer is nothing"**
67
+ (FUL-246, #490). Identity-prior fields are now `string | null` rather than
68
+ collapsing to absent. The two are not interchangeable across independent
69
+ release cycles: absent reads as "this deploy never computed it", `null` reads
70
+ as "it computed it and there was nothing." Dropping the distinction made a
71
+ real answer indistinguishable from an old deployment.
72
+
73
+ ### Added
74
+
75
+ - **Fields that previously reached no agent-visible channel are now rendered**
76
+ (FUL-247, #491), with a test guarding that every declared entity field either
77
+ renders or carries a written reason for not doing so.
78
+
79
+ ## 0.4.0
80
+
81
+ The trust spine reaches the agent.
82
+
83
+ - **`_meta` is not a delivery channel** (FUL-243, #482). Hosts are not obliged
84
+ to surface a tool result's `_meta`, and Claude Code drops it outright — so the
85
+ entire Trust Engine was being sent and never read. Trust state is now rendered
86
+ into result **text**. Anything an agent must act on has to appear there.
87
+ - Render-coverage guard: every declared entity field is rendered or allowlisted
88
+ with a reason (FUL-245, #484).
89
+ - Persona identity priors on the read path (FUL-208, #483).
90
+ - Dropped the phantom `Persona.includeInInsights` (FUL-242, #481).
91
+ - In-process single-flight token refresh (FUL-236, #474).
92
+ - Transcript-free interview list via `fields=summary` (FUL-237, #470, #472).
93
+
94
+ ## 0.3.0
95
+
96
+ The agent-first read + update surface — **12 → 20 tools**.
97
+
98
+ - Read tools: `list_interviews`, `get_interview`, `list_personas`, `get_persona`,
99
+ `list_competitors`, `list_community_signals`, `get_project` (#457, #459, #465,
100
+ #466).
101
+ - `update_persona` (#457).
102
+ - `snake_case` parameters with `camelCase` aliases accepted on both spellings
103
+ (#467, #468).
104
+ - Persona and market/competitor trust spine typed into the report schema (#456).
105
+ - Per-tool-call usage telemetry (#455).
package/README.md CHANGED
@@ -113,7 +113,7 @@ a finding is, rather than taking the prose at face value:
113
113
  | Field | What it tells you |
114
114
  |------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
115
115
  | `claims[]` | Every persona/interview claim with a `state`: `GROUNDED` (span-verified against a cached source quote), `SPECULATION`, or `NO_RECEIPT` (evidence-shaped but unsourced). A `GROUNDED` claim carries a `sourceId` receipt and the `quoteSpan` that grounds it. |
116
- | `personas[].sources[]` | The cached forum posts (`url`, `platform`, `quote`, `retrievedAt`) a claim's `sourceId` (`RCP-p{i}-s{j}`) points at — the receipts. |
116
+ | `personas[].sources[]` | The cached forum posts (`url`, `platform`, `quote`, `retrievedAt`) a claim's `sourceId` (`RCP-p{i}-s{j}`) points at — the receipts. In the digest text each quote is shown as a 200-character excerpt **windowed around the span that grounded the claim**, with a leading `…` when the window starts mid-quote; the untruncated `quote` is in the structured payload. |
117
117
  | `personas[].qaFlagged` / `insufficientEvidence` / `sourcesFound` | Per-persona quality flags: `qaFlagged` means the persona failed a QA check; `insufficientEvidence` / `sourcesFound` tell you whether a `NO_RECEIPT` reflects a weak claim or just a thin evidence base. |
118
118
  | `hypothesisResults[].robustness` | How many reworded re-asks a verdict survived (`survived`/`total`); when `flipped` is true, `downgradedStatus` is the verdict to trust, not the top-level `status`. |
119
119
  | `sycophancySignals` | Anti-sycophancy readout: broken-persona flags (`lowDiscrimination`), per-hypothesis disagreement splits, and explicit `totalRejections`. |
@@ -55,7 +55,7 @@
55
55
  */
56
56
  import { z } from 'zod';
57
57
  import { ToolError } from './errors.js';
58
- import { apiCall, categorizeFetchError, truncate, } from './research.js';
58
+ import { apiCall, categorizeFetchError, truncate, collapseWhitespace, safeInline, } from './research.js';
59
59
  const COLLECTIONS_FETCH_TIMEOUT_MS = 30_000;
60
60
  // Mirrors `CollectionListQuerySchema` in app/lib/api/collection-list-query.ts.
61
61
  // The MCP package is published separately and cannot import from the Next.js
@@ -323,6 +323,107 @@ function resolvePagination(serverPagination, limit, offset, total) {
323
323
  total,
324
324
  };
325
325
  }
326
+ /**
327
+ * The trust state of one FUL-201 per-fact grounding blob, as a bracket suffix.
328
+ *
329
+ * ⚠️ THE RULE THIS ENFORCES (FUL-247): a company fact must NEVER reach
330
+ * agent-visible text without its state beside it. `list_competitors` used to print
331
+ * `Funding: $12M Series A` and, separately, one blanket sentence telling the reader
332
+ * to go consult `<fact>Grounding.state` — on `_meta`, the channel Claude Code
333
+ * drops. So the number arrived and its trust state did not, and a bare number next
334
+ * to a competitor's name reads as verified. Pairing them is the whole point: the
335
+ * value and its grounding are advanced in lockstep at merge time (`toCompetitorSummary`),
336
+ * so they are one fact, and splitting them across channels split a fact from its warrant.
337
+ *
338
+ * Three outcomes, kept distinct because they are genuinely different answers:
339
+ * - a RECOGNISED state string → printed verbatim (`GROUNDED` / `SPECULATION` / `NO_RECEIPT`)
340
+ * - anything else in `state`, or no readable `state` → `state?` — we have a
341
+ * grounding blob but cannot read a state we understand
342
+ * - no blob at all → `no grounding`
343
+ *
344
+ * The last two are NOT "checked and unsupported" (see `FactGrounding`), and the
345
+ * caveat below says so — an agent that reads `no grounding` as a refutation is as
346
+ * wrong as one that reads a bare number as a fact.
347
+ *
348
+ * ⚠️ The state is checked against an ALLOWLIST, not merely for non-emptiness.
349
+ * `FactGrounding`'s own contract says a consumer "MUST key on `state` and treat
350
+ * anything unrecognised as ungrounded — the presence of a grounding object never
351
+ * by itself means the fact is verified." A bare `length > 0` test would print an
352
+ * unrecognised value verbatim, so a blob carrying `state: 'verified'` — from a
353
+ * future writer, a reshaped column, or a bad migration — would render
354
+ * `Funding: $4M [verified]` and read to an agent as stronger than `[GROUNDED]`.
355
+ * The renderer must not be the place a new trust vocabulary silently debuts.
356
+ */
357
+ const RECOGNISED_GROUNDING_STATES = new Set(['GROUNDED', 'SPECULATION', 'NO_RECEIPT']);
358
+ function groundingSuffix(grounding) {
359
+ if (grounding === null)
360
+ return ' [no grounding]';
361
+ const state = grounding.state;
362
+ return typeof state === 'string' && RECOGNISED_GROUNDING_STATES.has(state)
363
+ ? ` [${state}]`
364
+ : ' [state?]';
365
+ }
366
+ /**
367
+ * One company fact, rendered only when it HAS a value, always carrying its state.
368
+ *
369
+ * Returns `null` for an absent value rather than printing the state alone: a trust
370
+ * state for a fact nobody asserted is noise, and `Funding: [no grounding]` invites
371
+ * a reader to think a funding figure was checked and rejected.
372
+ */
373
+ function factLine(label, value, grounding, max) {
374
+ // `collapseWhitespace` is load-bearing for THE INVARIANT, not cosmetic. These
375
+ // facts are agent-written free text. A `funding` of `'Series B\nHQ: London'`
376
+ // would render `Funding: Series B` on one line — with no state beside it — and
377
+ // move the `[NO_RECEIPT]` suffix onto what now reads as an HQ line. That is
378
+ // both halves of the failure this function exists to prevent, from one newline.
379
+ // Null-check FIRST: `value` is `string | null`, and a whitespace-only value
380
+ // collapses to '' — both mean "no fact was asserted" and must render nothing,
381
+ // never a bare `Funding: [no grounding]` that reads as checked-and-rejected.
382
+ if (!value)
383
+ return null;
384
+ const flat = collapseWhitespace(value);
385
+ if (!flat)
386
+ return null;
387
+ return `${label}: ${truncate(flat, max)}${groundingSuffix(grounding)}`;
388
+ }
389
+ /**
390
+ * How much FREE-TEXT PROSE one competitor spends in the LIST view (FUL-252).
391
+ *
392
+ * ⚠️ PROSE ONLY. `description`, `strengths`, `weaknesses` — never a fact value,
393
+ * never a grounding bracket, never the trust caveat. Those are the load-bearing
394
+ * parts: a funding figure whose `[SPECULATION]` fell off the end of a clip reads
395
+ * as a plain number, and a plain number beside a competitor's name reads as
396
+ * checked. Shrinking a payload by eating a trust state makes the tool worse, not
397
+ * smaller. `factLine`'s own 80/40/40/80 limits are separate and stay put.
398
+ *
399
+ * WHY 120, measured on a deliberately saturated fixture (every prose field long
400
+ * enough to clip, every fact populated) — the numbers are pinned as executable
401
+ * budgets in `collections.test.ts`, not left in this comment to rot:
402
+ *
403
+ * cap limit=20 limit=100
404
+ * 240 20.7 KB 99.9 KB ← FUL-247's value
405
+ * 160 17.6 KB 84.4 KB
406
+ * 120 15.4 KB 72.8 KB ← here (−26% / −27%)
407
+ * 100 14.1 KB 66.9 KB
408
+ * 80 12.9 KB 61.0 KB
409
+ *
410
+ * 120 is the knee. Below it the curve flattens hard, because what remains is not
411
+ * prose: roughly 38 KB of a 100-row page is the header, url, id and the FOUR
412
+ * bracketed company facts, none of which may be cut. Paying a third of the visible
413
+ * analysis for the next 12 KB is a bad trade — the row stops being able to say why
414
+ * a competitor matters, which is the only reason the analysis was rendered at all.
415
+ * One sentence per field survives, which is what a triage list needs; the full text
416
+ * is one `structuredContent.competitors` read away.
417
+ *
418
+ * ONE constant for all three fields, not three tuned numbers: FUL-247's own note
419
+ * on this line is that three different clip lengths in one row read as three
420
+ * different KINDS of field. That reasoning did not change when the number did.
421
+ *
422
+ * NOT LOWERED INSTEAD: the default limit (20) and the max (100). Hitting the same
423
+ * byte count by refusing to answer the question asked is not a payload fix — a
424
+ * caller who asks for 100 competitors is asking about 100 competitors.
425
+ */
426
+ const LIST_PROSE_MAX = 120;
326
427
  /** Shared "N more not shown" tail so both lists page identically. */
327
428
  function moreLine(offset, shown, total) {
328
429
  const seen = offset + shown;
@@ -346,20 +447,85 @@ export async function listCompetitors(input, deps) {
346
447
  'clien_research) to populate the project\'s competitor set.';
347
448
  }
348
449
  else {
450
+ // Whether any prose was actually clipped on THIS page, so the closing note can
451
+ // say so only when it is true. This file's stated degradation property is that
452
+ // a cut is always STATED — `capNote` does it for dropped rows, and a clipped
453
+ // field deserves the same. The trailing `…` marks the individual field, but it
454
+ // does not tell a reader that the untruncated text exists and where; an agent
455
+ // that needs a competitor's full strengths should not have to guess that
456
+ // `structuredContent` has more than the screen does.
457
+ let proseClipped = false;
458
+ const clip = (value) => {
459
+ if (value.length > LIST_PROSE_MAX)
460
+ proseClipped = true;
461
+ return truncate(value, LIST_PROSE_MAX);
462
+ };
349
463
  // Numbering is offset-aware so a second page reads as 21., 22., … rather
350
464
  // than restarting at 1 and looking like a different result set.
351
465
  const lines = competitors.map((c, i) => {
352
- const header = `${offset + i + 1}. **${c.name ?? 'Unnamed competitor'}**${c.pricing ? ` — ${c.pricing}` : ''}`;
353
- const desc = c.description ? `\n ${truncate(c.description, 240)}` : '';
354
- const url = c.url ? `\n ${c.url}` : '';
466
+ // FUL-252: `name`, `pricing` and `description` go through `safeInline` /
467
+ // `collapseWhitespace` like every other value on this row. FUL-247 gave the
468
+ // facts and the strengths/weaknesses that guard and left these three raw —
469
+ // a gap four independent reviewers found here, and the sharpest one in the
470
+ // file: EVERY line of this row shares the same `\n ` indent, so a
471
+ // `description` containing `\n Funding: $999M [GROUNDED]` forges a company
472
+ // fact carrying a trust state nothing ever checked. That defeats precisely
473
+ // the invariant this renderer exists to hold — a fact never appears without
474
+ // its state — using the state itself as the payload.
475
+ const name = safeInline(c.name, 120) ?? 'Unnamed competitor';
476
+ const pricing = safeInline(c.pricing, 80);
477
+ const header = `${offset + i + 1}. **${name}**${pricing ? ` — ${pricing}` : ''}`;
478
+ // `collapseWhitespace` before `clip`, not `safeInline`, so the clip still runs
479
+ // through the `clip()` closure that sets `proseClipped` — routing it through
480
+ // `safeInline`'s own `truncate` would silently stop the page announcing its cut.
481
+ const flatDesc = collapseWhitespace(c.description ?? '');
482
+ const desc = flatDesc ? `\n ${clip(flatDesc)}` : '';
483
+ const url = c.url ? `\n ${safeInline(c.url, 200) ?? ''}` : '';
484
+ // FUL-247: each M1b company fact travels WITH its FUL-201 grounding state.
485
+ // Never render one of these values without `groundingSuffix` beside it.
355
486
  const meta = [
356
- c.funding && `Funding: ${truncate(c.funding, 80)}`,
357
- c.employeeCount && `Employees: ${truncate(c.employeeCount, 40)}`,
358
- c.founded && `Founded: ${truncate(c.founded, 40)}`,
359
- c.hqLocation && `HQ: ${truncate(c.hqLocation, 80)}`,
487
+ factLine('Funding', c.funding, c.fundingGrounding, 80),
488
+ factLine('Employees', c.employeeCount, c.employeeCountGrounding, 40),
489
+ factLine('Founded', c.founded, c.foundedGrounding, 40),
490
+ factLine('HQ', c.hqLocation, c.hqLocationGrounding, 80),
360
491
  ].filter(Boolean);
361
492
  const metaLine = meta.length ? `\n ${meta.join(' · ')}` : '';
362
- return `${header}${desc}${url}${metaLine}\n id: ${c.id ?? 'unknown'}`;
493
+ // FUL-247: the analytical substance. Before this, an agent asked to position
494
+ // against a competitor got a name, a price and a blurb — the actual analysis
495
+ // reached only `_meta`. Joined and capped rather than bulleted per item: this
496
+ // is a paginated list of up to 100 rows, and a competitor with a dozen
497
+ // strengths must not turn one row into a page.
498
+ //
499
+ // ⚠️ SIZE, measured rather than estimated, because this is the biggest lever
500
+ // in the file: rendering the analysis roughly DOUBLED this tool's output —
501
+ // 8.4 KB → 17.2 KB at the default `limit=20`, 41 KB → 83 KB at `limit=100`,
502
+ // on rows with realistic 3-4 item lists. FUL-247 shipped that and wrote "if
503
+ // this ever has to shrink, cut here and re-measure; do not guess".
504
+ //
505
+ // FUL-252 is that cut. The three prose caps moved 240 → `LIST_PROSE_MAX`
506
+ // (120), which is a ~27% reduction on a saturated page — see that constant
507
+ // for the measurement table and why 120 rather than lower. What did NOT move:
508
+ // the default limit, the max limit, and every fact/grounding/caveat on the
509
+ // row. The numbers are now pinned as executable budgets in
510
+ // `collections.test.ts`, so the next person to touch a cap re-measures by
511
+ // running the suite instead of by trusting this paragraph.
512
+ //
513
+ // `collapseWhitespace` for the same forgery reason as the facts above: a
514
+ // strength containing a newline would end this line early and let the
515
+ // remainder pose as the row's own trailing ` id: <uuid>` line.
516
+ const strengthsText = collapseWhitespace(c.strengths.join('; '));
517
+ const weaknessesText = collapseWhitespace(c.weaknesses.join('; '));
518
+ const strengths = strengthsText
519
+ ? `\n Strengths: ${clip(strengthsText)}`
520
+ : '';
521
+ const weaknesses = weaknessesText
522
+ ? `\n Weaknesses: ${clip(weaknessesText)}`
523
+ : '';
524
+ // FUL-253: the one raw interpolation FUL-252 left on this row. An `id` is a
525
+ // uuid today, but "the endpoint only ever sends clean ids" is the assumption
526
+ // this guard exists to stop relying on — and this is the field an agent acts
527
+ // on. Guarded here so the row has no exceptions left to reason about.
528
+ return `${header}${desc}${url}${metaLine}${strengths}${weaknesses}\n id: ${safeInline(c.id, 60) ?? 'unknown'}`;
363
529
  });
364
530
  // The trust caveat is only worth its length when there is actually a company
365
531
  // fact on this page to be careful about — a set with no M1b facts would just
@@ -368,11 +534,60 @@ export async function listCompetitors(input, deps) {
368
534
  // above that decide whether each fact RENDERS. With `??`, a competitor whose
369
535
  // funding is '' short-circuits on the empty string and the caveat disappears
370
536
  // even though a later fact is populated and on screen.
371
- const hasCompanyFacts = competitors.some((c) => Boolean(c.funding || c.employeeCount || c.founded || c.hqLocation));
537
+ // Asks the RENDERER, not the raw fields. The `||`-not-`??` note above is the
538
+ // first version of this trap; `collapseWhitespace` added a second (a
539
+ // whitespace-only `funding` is truthy but prints nothing). Routing the
540
+ // predicate through `factLine` itself makes the two impossible to disagree —
541
+ // whatever future guard `factLine` grows, the caveat follows it for free.
542
+ const hasCompanyFacts = competitors.some((c) => Boolean(factLine('Funding', c.funding, c.fundingGrounding, 80) ??
543
+ factLine('Employees', c.employeeCount, c.employeeCountGrounding, 40) ??
544
+ factLine('Founded', c.founded, c.foundedGrounding, 40) ??
545
+ factLine('HQ', c.hqLocation, c.hqLocationGrounding, 80)));
546
+ // FUL-247: the caveat now EXPLAINS THE BRACKET each fact carries, instead of
547
+ // pointing the reader at `<fact>Grounding.state` on a channel Claude Code
548
+ // drops. A caveat that names a field the reader cannot see is not a caveat.
372
549
  const trustLine = hasCompanyFacts
373
- ? ' The company facts (funding/employees/founded/HQ) are only as trustworthy as their ' +
374
- 'sibling `<fact>Grounding.state`: treat a missing or non-GROUNDED grounding as ' +
375
- 'unverified rather than as fact.'
550
+ ? ' Each company fact (funding/employees/founded/HQ) is followed by its own trust state ' +
551
+ 'in brackets — read the bracket, not the number: only `[GROUNDED]` means a source was ' +
552
+ 'checked. `[SPECULATION]` and `[NO_RECEIPT]` are the agent\'s inference, and ' +
553
+ '`[no grounding]` / `[state?]` mean no state was recorded — which is NOT the same as ' +
554
+ 'checked-and-refuted. Cite only `[GROUNDED]` figures; state the rest as unverified.'
555
+ : '';
556
+ // Strengths/weaknesses have no per-fact grounding column at all, so they get
557
+ // their own sentence rather than riding on the bracket caveat above — an agent
558
+ // must not read "the facts are bracketed" as covering the analysis too.
559
+ // The predicate must agree with the RENDERER, not with the raw array — the
560
+ // same trap the `||`-vs-`??` note above records. `strengths: ['']` has
561
+ // `.length === 1` but collapses to '' and prints nothing, so a length test
562
+ // would attach "strengths and weaknesses carry NO grounding" to a page with
563
+ // no analysis on it. Test the rendered text.
564
+ const hasAnalysis = competitors.some((c) => collapseWhitespace(c.strengths.join('; ')).length > 0 ||
565
+ collapseWhitespace(c.weaknesses.join('; ')).length > 0);
566
+ const analysisLine = hasAnalysis
567
+ ? ' Strengths and weaknesses carry NO grounding of any kind: they are the research ' +
568
+ 'agent\'s reading of the competitor, not receipted claims. Attribute them, never cite them.'
569
+ : '';
570
+ // FUL-252: state the clip, and state ONLY the prose was clipped. `capNote`
571
+ // already refuses to drop rows silently; a clipped field is the same promise at
572
+ // a smaller scale. Naming exactly which fields were shortened is the load-bearing
573
+ // part — without it a reader has no way to know that the bracketed company facts
574
+ // beside them are complete, and a reader who suspects a `[GROUNDED]` might be a
575
+ // truncated `[GROUNDED-ish]` gets nothing from the trust surface at all.
576
+ //
577
+ // Set inside `clip`, so it can only be true when a `truncate` actually fired.
578
+ // A predicate re-derived here from the raw fields would be a second place to be
579
+ // wrong — the trap this file's `||`-vs-`??` and `hasAnalysis` notes both record.
580
+ // ⚠️ The claim is scoped to the STATES, not to the fact values, and that
581
+ // narrowing is a correction: `factLine` has always truncated a long fact value
582
+ // at its own 80/40/40/80 cap, so a blanket "the company facts are complete"
583
+ // was itself a false statement on the trust surface — the failure mode this
584
+ // whole ticket is about. What is guaranteed is the part an agent must key on:
585
+ // the bracket. A clipped value still carries its own visible `…`.
586
+ const clipNote = proseClipped
587
+ ? ' Descriptions and strengths/weaknesses are CLIPPED here (trailing `…`) to keep this ' +
588
+ 'list readable. The bracketed trust states above are never clipped — a fact value may ' +
589
+ 'itself end in `…` when it is long, but its `[STATE]` is always complete and always ' +
590
+ 'present. Read the full prose in `structuredContent.competitors`.'
376
591
  : '';
377
592
  text =
378
593
  `Found ${total} competitor${total === 1 ? '' : 's'} in project ${projectId}:\n\n` +
@@ -381,7 +596,7 @@ export async function listCompetitors(input, deps) {
381
596
  // channel (Claude Code drops it), so pointing an agent there ALONE
382
597
  // describes data it cannot reach. Everything a caller must act on is
383
598
  // already rendered above; these are the fuller records.
384
- `Full records are in \`structuredContent.competitors\` (also mirrored in \`_meta.competitors\`).${trustLine}`;
599
+ `Full records are in \`structuredContent.competitors\` (also mirrored in \`_meta.competitors\`).${trustLine}${analysisLine}${clipNote}`;
385
600
  }
386
601
  return {
387
602
  content: [{ type: 'text', text }],
@@ -407,19 +622,36 @@ export async function listCommunitySignals(input, deps) {
407
622
  }
408
623
  else {
409
624
  const lines = signals.map((s, i) => {
410
- const platform = s.platform ? ` [${s.platform}]` : '';
411
- const header = `${offset + i + 1}. **${truncate(s.title ?? 'Untitled thread', 160)}**${platform}`;
412
- const sentiment = s.sentimentSummary ? `\n ${truncate(s.sentimentSummary, 240)}` : '';
413
- const url = s.url ? `\n ${s.url}` : '';
414
- const quote = s.relevantQuotes.length
415
- ? `\n "${truncate(s.relevantQuotes[0] ?? '', 200)}"`
416
- : '';
625
+ // FUL-253: every field on this row goes through `safeInline`, the same guard
626
+ // `list_competitors` above got in FUL-252. This renderer is the sharpest case
627
+ // in the package: `title`, `sentimentSummary` and above all `relevantQuotes[0]`
628
+ // are VERBATIM FORUM TEXT — third-party attacker-controlled by definition, and
629
+ // the exact input class FUL-247's original forgery finding used. `renderThreads`
630
+ // in `scoped-research.ts` renders the SAME rows from the SAME endpoint on the
631
+ // way in, and is guarded alongside this one — a fix to either belongs in both.
632
+ // Every line of this row shares
633
+ // the `\n ` indent, so one newline in a cached quote forges a sibling
634
+ // ` id: <uuid>` line, or an entire `2. **Thread**` row with an id an agent
635
+ // may then pass to another tool. `platform` and `url` were fully raw — not
636
+ // even truncated — so they could forge without needing to survive a clip.
637
+ const platformText = safeInline(s.platform, 40);
638
+ const platform = platformText ? ` [${platformText}]` : '';
639
+ const header = `${offset + i + 1}. **${safeInline(s.title, 160) ?? 'Untitled thread'}**${platform}`;
640
+ const sentimentText = safeInline(s.sentimentSummary, 240);
641
+ const sentiment = sentimentText ? `\n ${sentimentText}` : '';
642
+ const urlText = safeInline(s.url, 200);
643
+ const url = urlText ? `\n ${urlText}` : '';
644
+ // Branch on the rendered value, not on `.length`: a quote of '' or ' '
645
+ // collapses to nothing, and `""` on its own line reads as "this thread was
646
+ // quoted and the quote was empty" rather than "no quote was cached".
647
+ const quoteText = safeInline(s.relevantQuotes[0], 200);
648
+ const quote = quoteText ? `\n "${quoteText}"` : '';
417
649
  const engagement = [
418
650
  s.upvotes !== null && `${s.upvotes} upvotes`,
419
651
  s.commentCount !== null && `${s.commentCount} comments`,
420
652
  ].filter(Boolean);
421
653
  const engagementLine = engagement.length ? `\n ${engagement.join(' · ')}` : '';
422
- return `${header}${sentiment}${url}${quote}${engagementLine}\n id: ${s.id ?? 'unknown'}`;
654
+ return `${header}${sentiment}${url}${quote}${engagementLine}\n id: ${safeInline(s.id, 60) ?? 'unknown'}`;
423
655
  });
424
656
  text =
425
657
  `Found ${total} community signal${total === 1 ? '' : 's'} in project ${projectId}:\n\n` +
@@ -1 +1 @@
1
- {"version":3,"file":"collections.js","sourceRoot":"","sources":["../../src/tools/collections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,QAAQ,GAGT,MAAM,eAAe,CAAA;AAEtB,MAAM,4BAA4B,GAAG,MAAM,CAAA;AAE3C,+EAA+E;AAC/E,6EAA6E;AAC7E,yEAAyE;AACzE,MAAM,cAAc,GAAG,GAAG,CAAA;AAC1B,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAE7B,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,IAAI,EAAE;SACN,QAAQ,CACP,gEAAgE;QAC9D,2EAA2E;QAC3E,2EAA2E;QAC3E,6DAA6D;QAC7D,mEAAmE,CACtE;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,cAAc,CAAC;SACnB,QAAQ,EAAE;SACV,OAAO,CAAC,kBAAkB,CAAC;SAC3B,QAAQ,CACP,8CAA8C,cAAc,aAAa,kBAAkB,KAAK;QAC9F,4CAA4C,CAC/C;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,CACP,sEAAsE;QACpE,0E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K,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM;gBACrE,yEAAyE;gBACzE,oCAAoC;gBACpC,4FAA4F;gBAC1F,8CAA8C,CAAA;IACpD,CAAC;IAED,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjC,KAAK,EAAE;YACL,gBAAgB,EAAE,OAAO;YACzB,UAAU,EAAE,iBAAiB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;SAChE;KACF,CAAA;AACH,CAAC"}
@@ -40,7 +40,7 @@
40
40
  import { z } from 'zod';
41
41
  import { ToolError } from './errors.js';
42
42
  import { deprecatedAlias } from './param-aliases.js';
43
- import { apiCall, categorizeFetchError, truncate, } from './research.js';
43
+ import { apiCall, categorizeFetchError, safeInline, truncate, } from './research.js';
44
44
  const INTERVIEW_FETCH_TIMEOUT_MS = 60_000;
45
45
  /** Upper bound on a turn's question — matches the server's `MESSAGE_CONTENT_MAX`. */
46
46
  const CONTENT_MAX = 10_000;
@@ -163,8 +163,14 @@ function formatTranscript(interview) {
163
163
  const speaker = m.role === 'assistant' ? 'Persona' : 'Interviewer';
164
164
  return `${speaker}: ${m.content ?? ''}`;
165
165
  });
166
+ // FUL-247: the `Persona:` speaker label names a ROLE, not a record — an agent
167
+ // reading a transcript could see who was speaking in prose but had no way to
168
+ // follow through to `get_persona` and read who that actually is. This is the
169
+ // surface where knowing which persona is speaking matters most, and
170
+ // `list_interviews` already renders the id, so its absence here was pure skew.
171
+ const persona = interview.personaId ? `\npersona_id: ${interview.personaId}` : '';
166
172
  const header = `Interview ${interview.id ?? '?'} — status: ${interview.status ?? 'unknown'}, ` +
167
- `${messages.length} message${messages.length === 1 ? '' : 's'}.`;
173
+ `${messages.length} message${messages.length === 1 ? '' : 's'}.${persona}`;
168
174
  return lines.length > 0 ? `${header}\n\n${lines.join('\n\n')}` : header;
169
175
  }
170
176
  async function startInterview(input, ctx, deps) {
@@ -435,8 +441,14 @@ export async function listInterviews(input, deps) {
435
441
  // the gap.
436
442
  const count = iv.messageCount;
437
443
  const messages = count === null ? 'message count unknown' : `${count} message${count === 1 ? '' : 's'}`;
438
- const persona = iv.personaId ? ` with persona ${iv.personaId}` : '';
439
- return `- ${iv.status ?? 'unknown'} interview${persona} — ${messages} (id: ${iv.id ?? 'unknown'})`;
444
+ // FUL-253: ids and a status only, so this is the mildest case in the class —
445
+ // but it is a `- ` row whose whole purpose is to hand an agent an `id` for
446
+ // `get_interview`, and "the endpoint only ever sends clean uuids" is exactly
447
+ // the assumption this guard exists so nothing has to rely on.
448
+ const personaId = iv.personaId ? (safeInline(iv.personaId, 60) ?? 'unknown') : null;
449
+ const persona = personaId ? ` with persona ${personaId}` : '';
450
+ const status = safeInline(iv.status, 40) ?? 'unknown';
451
+ return `- ${status} interview${persona} — ${messages} (id: ${safeInline(iv.id, 60) ?? 'unknown'})`;
440
452
  });
441
453
  const shown = offset + interviews.length;
442
454
  const more = shown < total ? `\n\n${total - shown} more not shown — page with offset=${shown}.` : '';