@clien-ai/mcp 0.2.1 → 0.4.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.
@@ -13,6 +13,9 @@
13
13
  * AI can pick a `project_id` to pass to `clien_research`.
14
14
  * - create_project → POST /api/projects { name, description? } →
15
15
  * 201 { project }. Returns a confirmation line + the project in `_meta`.
16
+ * - get_project → the one-call orientation hub (FUL-216 / §U8). Fans out
17
+ * CLIENT-SIDE to project-meta + the five child collections in parallel and
18
+ * degrades per child. See the section comment further down.
16
19
  *
17
20
  * Error mapping mirrors `status.ts`: 401 → invalidate the cached session and
18
21
  * surface a re-auth message; 400 → the server's validation message; other
@@ -23,6 +26,8 @@
23
26
  import { z } from 'zod';
24
27
  import { ToolError } from './errors.js';
25
28
  import { apiCall, categorizeFetchError, truncate, } from './research.js';
29
+ import { toCompetitorSummary, toCommunitySignalSummary } from './collections.js';
30
+ import { toInterviewSummary } from './interview.js';
26
31
  const PROJECTS_FETCH_TIMEOUT_MS = 30_000;
27
32
  // Caps re-declared locally: the @clien-ai/mcp package is published separately
28
33
  // and cannot import from the Next.js app. Kept in sync with VALIDATION_LIMITS
@@ -89,20 +94,33 @@ async function throwForResponse(response, deps, action) {
89
94
  deps.invalidateSession?.();
90
95
  throw new ProjectToolError('Session expired. Re-run any Clien.ai tool to re-authenticate, then try again.');
91
96
  }
97
+ const detail = await parseErrorDetail(response);
98
+ if (response.status === 400) {
99
+ throw new ProjectToolError(`Could not ${action} — ${detail}`);
100
+ }
101
+ throw new ProjectToolError(`Failed to ${action} (HTTP ${response.status}): ${detail}`);
102
+ }
103
+ /**
104
+ * Read a non-ok response body into a short human detail: the server's
105
+ * `{ error, code }` when it is JSON, otherwise the truncated raw text.
106
+ *
107
+ * Shared by the throwing path (`throwForResponse`) and the degrading path
108
+ * (`hubFetch`) so the two cannot drift. They differ in what they DO with a
109
+ * failure, not in how they read one, and a fix to the parsing — a new envelope
110
+ * field, a different truncation bound — should not have to be made twice in one
111
+ * file to take effect in both.
112
+ */
113
+ async function parseErrorDetail(response) {
92
114
  const text = await response.text().catch(() => '');
93
- let detail = truncate(text, 200);
94
115
  try {
95
116
  const parsed = JSON.parse(text);
96
117
  if (parsed?.error)
97
- detail = `${parsed.error}${parsed.code ? ` (${parsed.code})` : ''}`;
118
+ return `${parsed.error}${parsed.code ? ` (${parsed.code})` : ''}`;
98
119
  }
99
120
  catch {
100
121
  // non-JSON body — fall back to the truncated raw text
101
122
  }
102
- if (response.status === 400) {
103
- throw new ProjectToolError(`Could not ${action} — ${detail}`);
104
- }
105
- throw new ProjectToolError(`Failed to ${action} (HTTP ${response.status}): ${detail}`);
123
+ return truncate(text, 200);
106
124
  }
107
125
  export async function listProjects(input, deps) {
108
126
  const parsed = ListProjectsInputSchema.safeParse(input);
@@ -192,4 +210,534 @@ export async function createProject(input, deps) {
192
210
  _meta: { project },
193
211
  };
194
212
  }
213
+ // ---------------------------------------------------------------------------
214
+ // get_project (FUL-216 / §U8) — the one-call project orientation hub
215
+ // ---------------------------------------------------------------------------
216
+ //
217
+ // Answers "what is the state of my project?" in ONE call instead of the ~5 an
218
+ // agent needed before (list_personas + list_interviews + list_competitors +
219
+ // list_community_signals + list_reports), by fanning out CLIENT-SIDE to
220
+ // project-meta and the five child endpoints in parallel. Resolved in eng review:
221
+ // no new app-side aggregate endpoint — this is pure composition over reads that
222
+ // already ship, so it adds no server surface to secure or keep in sync.
223
+ //
224
+ // ★ GRACEFUL DEGRADATION IS THE POINT. An orientation tool that dies because one
225
+ // collection hiccuped is worse than useless: the agent loses the other four too,
226
+ // and gets nothing for its round-trip. So every child is isolated — a failure
227
+ // becomes `{ error: 'unavailable', detail }` under its own key in
228
+ // `_meta.collections` while the rest return normally. Two independent layers
229
+ // enforce this:
230
+ // 1. `hubFetch` never throws — it returns a discriminated outcome.
231
+ // 2. `Promise.allSettled` wraps the lot anyway, so even a BUG in (1) turns into
232
+ // an error stub rather than a thrown tool call. Belt and braces on purpose:
233
+ // "never throws" should hold by construction, not by my helper being right.
234
+ //
235
+ // The two deliberate exceptions are the PROJECT itself, where throwing is the
236
+ // honest answer rather than a failure of nerve:
237
+ // - 401 → the session is dead; every child is failing for the same reason, and
238
+ // a hub full of "unavailable" would bury the one thing the agent must do
239
+ // (re-authenticate) under five identical stubs.
240
+ // - 404 → the project does not exist or is not this account's. Returning
241
+ // "here is your project: 0 personas, 0 reports" for someone else's UUID
242
+ // would be a confident answer to a question we cannot answer.
243
+ // Any OTHER project-meta failure (5xx, timeout, unreadable body) degrades like a
244
+ // child: the children may well have loaded, and a partial map beats nothing.
245
+ //
246
+ // ⚠️ ORDERING: the five endpoints do NOT share a sort key, and the differences
247
+ // are user-visible, so each collection carries its OWN ordering phrase (see
248
+ // `HUB_CHILDREN`). Verified against the `.order()` calls in the app's db layer at
249
+ // the time of writing — personas `created_at`, interviews `started_at`, reports
250
+ // `created_at`, competitors `last_seen_at` (newest ACTIVITY), community
251
+ // `created_at` (newest DISCOVERY). Do not collapse these into one "newest first":
252
+ // U7 shipped a copied ordering claim that told agents the wrong thing.
253
+ //
254
+ // ⚠️ COUNTS ARE NOT ALL EXACT. Four endpoints return `pagination.total`; the
255
+ // reports list (`GET /api/validate`) returns `{ jobs }` with NO total and NO
256
+ // offset. So a reports count is a FLOOR, not a count, whenever the page comes
257
+ // back full. Every collection therefore carries `countExact`, and the text says
258
+ // "at least N" when it is false — the one tool whose whole job is telling an
259
+ // agent what exists must not round a floor up into a fact.
260
+ //
261
+ // ⚠️ VOCABULARY: inlined competitors and community signals go through the SAME
262
+ // `toCompetitorSummary` / `toCommunitySignalSummary` mappers `list_competitors` /
263
+ // `list_community_signals` use (FUL-215). Passing the raw rows through here
264
+ // instead would hand an agent `comment_count` from this tool and `commentCount`
265
+ // from that one for a single number.
266
+ // Matches every sibling read tool's 30s (PROJECTS_/PERSONAS_/COLLECTIONS_/
267
+ // REPORTS_FETCH_TIMEOUT_MS). A tighter budget here would make the SAME endpoint
268
+ // read as "unavailable" through this tool while `list_personas` returned it
269
+ // fine — the fan-out is parallel, so a longer per-leg budget costs no extra
270
+ // wall time, and a spurious "unavailable" is the expensive outcome.
271
+ const HUB_FETCH_TIMEOUT_MS = 30_000;
272
+ const HUB_LIMIT_MAX = 50;
273
+ const HUB_LIMIT_DEFAULT = 10;
274
+ /** The child collections `include` can inline. Order drives the text rendering. */
275
+ const HUB_COLLECTIONS = [
276
+ 'personas',
277
+ 'interviews',
278
+ 'competitors',
279
+ 'community',
280
+ 'reports',
281
+ ];
282
+ export const GetProjectInputSchema = z.object({
283
+ project_id: z
284
+ .string()
285
+ .uuid()
286
+ .describe('UUID of the project to orient on. Get it from `list_projects` (or ' +
287
+ '`create_project`). Rejected with a 404 if the project does not exist or ' +
288
+ 'belongs to a different account.'),
289
+ include: z
290
+ .array(z.enum(HUB_COLLECTIONS))
291
+ .optional()
292
+ .describe('Optional list of child collections to INLINE in full — any of ' +
293
+ '"personas", "interviews", "competitors", "community", "reports". Omit ' +
294
+ '(the default) to get counts, IDs, and one-line summaries only, which is ' +
295
+ 'usually enough to decide what to read next. Name a collection here when ' +
296
+ 'you intend to reason over its records and want to skip the follow-up ' +
297
+ 'call. NOTE: inlined interviews carry `messageCount` but NOT their message ' +
298
+ 'transcripts — a page of full transcripts would swamp the response; use ' +
299
+ '`get_interview` for one transcript.'),
300
+ limit: z
301
+ .number()
302
+ .int()
303
+ .min(1)
304
+ .max(HUB_LIMIT_MAX)
305
+ .optional()
306
+ .default(HUB_LIMIT_DEFAULT)
307
+ .describe(`Maximum records to sample PER collection (1-${HUB_LIMIT_MAX}, default ${HUB_LIMIT_DEFAULT}). ` +
308
+ 'Caps the response size — this tool reads five collections at once. The ' +
309
+ 'COUNTS are still the project-wide totals (except reports, see ' +
310
+ '`countExact`); this only bounds how many ids/summaries/inlined records ' +
311
+ 'come back. To page beyond it, use the per-collection list tool.'),
312
+ });
313
+ /**
314
+ * Fan-out specs, keyed by `ChildKey` rather than held in a bare array so BOTH
315
+ * directions are compiler-checked: an `include` value with no spec, or a spec
316
+ * for a key `include` does not offer, is a type error. As a plain
317
+ * `readonly ChildSpec[]` only the spec→key direction was checked — adding a
318
+ * sixth entry to `HUB_COLLECTIONS` compiled fine and silently produced an
319
+ * `include` option that fetched nothing.
320
+ */
321
+ const HUB_CHILD_SPECS = {
322
+ personas: {
323
+ key: 'personas',
324
+ path: '/api/personas',
325
+ collectionKey: 'personas',
326
+ label: 'Personas',
327
+ order: 'newest created first',
328
+ hasTotal: true,
329
+ supportsOffset: true,
330
+ listTool: 'list_personas',
331
+ },
332
+ interviews: {
333
+ key: 'interviews',
334
+ path: '/api/interviews',
335
+ collectionKey: 'interviews',
336
+ label: 'Interviews',
337
+ // `interviews-api.ts` orders by `started_at`, not `created_at`.
338
+ order: 'newest started first',
339
+ hasTotal: true,
340
+ supportsOffset: true,
341
+ listTool: 'list_interviews',
342
+ // FUL-237: ask for `messageCount` instead of the transcripts. This tool
343
+ // already threw the messages away in `toHubItem` — it was paying to read and
344
+ // transfer every word of every interview in the page for a number.
345
+ query: { fields: 'summary' },
346
+ },
347
+ competitors: {
348
+ key: 'competitors',
349
+ path: '/api/competitors',
350
+ collectionKey: 'competitors',
351
+ label: 'Competitors',
352
+ // `last_seen_at DESC` — a competitor re-sighted by a later run moves back up.
353
+ order: 'most recently seen first',
354
+ hasTotal: true,
355
+ supportsOffset: true,
356
+ listTool: 'list_competitors',
357
+ },
358
+ community: {
359
+ key: 'community',
360
+ path: '/api/community',
361
+ collectionKey: 'communitySignals',
362
+ label: 'Community signals',
363
+ // `created_at DESC` — FIRST sighting, deliberately stable under re-merge.
364
+ order: 'newest discovered first',
365
+ hasTotal: true,
366
+ supportsOffset: true,
367
+ listTool: 'list_community_signals',
368
+ },
369
+ reports: {
370
+ key: 'reports',
371
+ path: '/api/validate',
372
+ collectionKey: 'jobs',
373
+ label: 'Reports',
374
+ order: 'newest created first',
375
+ hasTotal: false,
376
+ supportsOffset: false,
377
+ listTool: 'list_reports',
378
+ },
379
+ };
380
+ /**
381
+ * The fan-out list, ordered by `HUB_COLLECTIONS` so the rendering order and the
382
+ * `include` enum can never disagree.
383
+ */
384
+ const HUB_CHILDREN = HUB_COLLECTIONS.map((key) => HUB_CHILD_SPECS[key]);
385
+ /** GET one fan-out target. Never throws — that is the whole contract. */
386
+ async function hubFetch(deps, path) {
387
+ const ctx = makeCtx(deps);
388
+ let response;
389
+ try {
390
+ response = await apiCall(ctx, 'GET', path, { timeoutMs: HUB_FETCH_TIMEOUT_MS });
391
+ }
392
+ catch (err) {
393
+ const e = err;
394
+ if (e.name === 'AbortError' || e.name === 'TimeoutError') {
395
+ return { ok: false, kind: 'timeout', detail: `timed out after ${HUB_FETCH_TIMEOUT_MS / 1000}s` };
396
+ }
397
+ return { ok: false, kind: 'http', detail: truncate(e.message ?? String(err), 200) };
398
+ }
399
+ if (!response.ok) {
400
+ if (categorizeFetchError(response.status) === 'auth') {
401
+ return {
402
+ ok: false,
403
+ kind: 'auth',
404
+ detail: 'session expired (HTTP 401)',
405
+ transientRefresh: response.refreshError?.kind === 'transient',
406
+ };
407
+ }
408
+ const detail = await parseErrorDetail(response);
409
+ if (response.status === 404) {
410
+ return { ok: false, kind: 'notFound', detail: detail || 'not found' };
411
+ }
412
+ if (response.status === 429) {
413
+ // Worth its own kind: one `get_project` spends six requests at once, and
414
+ // `/api/validate` sits behind a per-user read limiter shared with the
415
+ // other validation reads. Folded into the generic HTTP bucket, a rate
416
+ // limit reads as a broken endpoint — so an agent retries immediately
417
+ // (making it worse) instead of waiting, or gives up on data that is
418
+ // simply behind a cooldown.
419
+ const retryAfter = response.headers.get('retry-after');
420
+ return {
421
+ ok: false,
422
+ kind: 'rateLimited',
423
+ detail: `rate limited (HTTP 429)${retryAfter ? ` — retry after ${retryAfter}s` : ''}` +
424
+ `${detail ? `: ${detail}` : ''}`,
425
+ };
426
+ }
427
+ return {
428
+ ok: false,
429
+ kind: 'http',
430
+ detail: `HTTP ${response.status}${detail ? `: ${detail}` : ''}`,
431
+ };
432
+ }
433
+ const json = (await response.json().catch(() => null));
434
+ if (!json || typeof json !== 'object') {
435
+ return { ok: false, kind: 'body', detail: 'the server returned a 200 with an unreadable body' };
436
+ }
437
+ return { ok: true, json };
438
+ }
439
+ function describeFailure(outcome) {
440
+ switch (outcome.kind) {
441
+ case 'auth':
442
+ return 'session expired (HTTP 401)';
443
+ case 'notFound':
444
+ return 'not found, or not owned by this account (HTTP 404)';
445
+ case 'timeout':
446
+ case 'body':
447
+ case 'rateLimited':
448
+ case 'http':
449
+ return outcome.detail;
450
+ }
451
+ }
452
+ /**
453
+ * Normalise a child row for the hub.
454
+ *
455
+ * Competitors and community signals go through U7's mappers so this tool and
456
+ * `list_competitors` / `list_community_signals` speak ONE vocabulary for the same
457
+ * concepts. Interviews carry `messageCount` and never a transcript: inlining a
458
+ * page of them verbatim would return every word of every interview from an
459
+ * orientation call.
460
+ */
461
+ function toHubItem(key, row) {
462
+ const record = (row !== null && typeof row === 'object' ? row : {});
463
+ switch (key) {
464
+ case 'competitors':
465
+ return toCompetitorSummary(record);
466
+ case 'community':
467
+ return toCommunitySignalSummary(record);
468
+ case 'interviews':
469
+ // Same mapper `list_interviews` uses (FUL-237), for the same reason the
470
+ // competitor and community cases above share theirs: this tool and that
471
+ // one must not report different counts — or different "unknown" sentinels
472
+ // — for one interview.
473
+ return toInterviewSummary(record);
474
+ case 'personas':
475
+ case 'reports':
476
+ return record;
477
+ }
478
+ }
479
+ function nonEmptyString(value) {
480
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null;
481
+ }
482
+ /**
483
+ * A server-reported `total` we are willing to publish as an exact count, or
484
+ * `null` when the response cannot support one.
485
+ *
486
+ * Rejects a non-integer, a negative, and — the case worth spelling out — a total
487
+ * SMALLER than the rows the same response just delivered. That combination is
488
+ * self-contradictory, and rendering it produced "Competitors: 0" directly above
489
+ * a competitor's name. A caller cannot act on a collection that reports two
490
+ * different realities, so neither number is published.
491
+ */
492
+ function validTotal(value, deliveredRows) {
493
+ if (typeof value !== 'number' || !Number.isInteger(value) || value < 0)
494
+ return null;
495
+ return value < deliveredRows ? null : value;
496
+ }
497
+ /** One-line human label per child kind, for both the text body and `summaries`. */
498
+ function labelFor(key, item) {
499
+ switch (key) {
500
+ case 'personas': {
501
+ const name = nonEmptyString(item.name) ?? '(unnamed persona)';
502
+ const role = nonEmptyString(item.role);
503
+ return role ? `${name} (${role})` : name;
504
+ }
505
+ case 'interviews': {
506
+ const status = nonEmptyString(item.status) ?? 'unknown';
507
+ // `messageCount` is null when the row carried no `messages` array — we do
508
+ // not KNOW the count. Printing "0 messages" for that would state an empty
509
+ // transcript as fact, which reads as "this interview never happened".
510
+ const count = item.messageCount;
511
+ if (typeof count !== 'number')
512
+ return `${status} — message count unknown`;
513
+ return `${status} — ${count} message${count === 1 ? '' : 's'}`;
514
+ }
515
+ case 'competitors':
516
+ return nonEmptyString(item.name) ?? '(unnamed competitor)';
517
+ case 'community':
518
+ return truncate(nonEmptyString(item.title) ?? '(untitled thread)', 80);
519
+ case 'reports': {
520
+ const prompt = nonEmptyString(item.prompt);
521
+ const status = nonEmptyString(item.status) ?? 'unknown';
522
+ return `${prompt ? `"${truncate(prompt, 60)}"` : '(no prompt)'} — ${status}`;
523
+ }
524
+ }
525
+ }
526
+ function buildCollection(spec, outcome, limit, inline) {
527
+ if (!outcome.ok) {
528
+ return { error: 'unavailable', detail: describeFailure(outcome) };
529
+ }
530
+ const raw = outcome.json[spec.collectionKey];
531
+ if (!Array.isArray(raw)) {
532
+ // A 200 whose body we cannot read is NOT an empty collection, and here the
533
+ // difference is expensive: "0 competitors" nudges an agent straight into a
534
+ // credit-debiting `scan_competitors` for data the project may already hold.
535
+ return {
536
+ error: 'unavailable',
537
+ detail: `the server returned a 200 with no \`${spec.collectionKey}\` array — ` +
538
+ 'this is a failed read, NOT an empty collection',
539
+ };
540
+ }
541
+ // Slice before mapping. The server is asked for `limit` and every endpoint
542
+ // caps at or above it, but `limit` is ADVERTISED as the per-collection cap, so
543
+ // a server that over-returns must not silently blow past the size bound an
544
+ // agent chose — five collections over-returning at once is how an orientation
545
+ // call turns into a context flood.
546
+ const items = raw.slice(0, limit).map((row) => toHubItem(spec.key, row));
547
+ const pagination = outcome.json.pagination;
548
+ const rawTotal = pagination?.total;
549
+ const total = spec.hasTotal ? validTotal(rawTotal, items.length) : null;
550
+ if (spec.hasTotal && total === null) {
551
+ // Same principle as the missing-array case above, and it needs saying twice
552
+ // because the failure looks different: a paginated endpoint that answers
553
+ // without a usable `pagination.total` has NOT told us the collection is
554
+ // empty. Falling back to the page length would publish `count: 0,
555
+ // countExact: true` — a confident "this project has none" derived from a
556
+ // broken response, which is exactly the claim that sends an agent off to run
557
+ // a credit-debiting scan. A total smaller than the rows already in hand is
558
+ // rejected by the same rule: a response that contradicts itself cannot be
559
+ // reported as a fact in either direction.
560
+ return {
561
+ error: 'unavailable',
562
+ detail: `the server returned a 200 with no usable \`pagination.total\` for ` +
563
+ `\`${spec.collectionKey}\`${typeof rawTotal === 'number' ? ` (got ${rawTotal} with ${items.length} rows)` : ''} — this is a failed read, NOT an empty collection`,
564
+ };
565
+ }
566
+ const entry = {
567
+ count: total ?? items.length,
568
+ // With no server-side total, a FULL page means there are probably more.
569
+ countExact: total !== null ? true : items.length < limit,
570
+ shown: items.length,
571
+ ids: items.map((item) => nonEmptyString(item.id)).filter((id) => id !== null),
572
+ summaries: items.map((item) => ({
573
+ id: nonEmptyString(item.id),
574
+ label: labelFor(spec.key, item),
575
+ })),
576
+ };
577
+ if (inline)
578
+ entry.items = items;
579
+ return entry;
580
+ }
581
+ function isUnavailable(entry) {
582
+ return 'error' in entry;
583
+ }
584
+ function countPhrase(entry) {
585
+ return entry.countExact ? String(entry.count) : `at least ${entry.count}`;
586
+ }
587
+ export async function getProject(input, deps) {
588
+ const parsed = GetProjectInputSchema.safeParse(input);
589
+ if (!parsed.success) {
590
+ throw new ProjectToolError(`Invalid input — ${formatZodError(parsed.error)}`);
591
+ }
592
+ const { project_id: projectId, include, limit } = parsed.data;
593
+ const inlined = new Set(include ?? []);
594
+ const childPath = (spec) => {
595
+ const query = new URLSearchParams({ projectId, limit: String(limit) });
596
+ // `/api/validate` takes `limit` only — it has no `offset` param and returns
597
+ // no `pagination`. Sending one would be advertising paging it cannot do.
598
+ if (spec.supportsOffset)
599
+ query.set('offset', '0');
600
+ for (const [key, value] of Object.entries(spec.query ?? {}))
601
+ query.set(key, value);
602
+ return `${spec.path}?${query.toString()}`;
603
+ };
604
+ // One parallel round trip for all six reads. `allSettled` is the outer
605
+ // guarantee: a rejected settle (only reachable via a bug in `hubFetch`, which
606
+ // is written not to throw) degrades to a stub instead of failing the call.
607
+ const settled = await Promise.allSettled([
608
+ hubFetch(deps, `/api/projects/${projectId}`),
609
+ ...HUB_CHILDREN.map((spec) => hubFetch(deps, childPath(spec))),
610
+ ]);
611
+ const toOutcome = (result) => {
612
+ if (!result)
613
+ return { ok: false, kind: 'http', detail: 'no response' };
614
+ if (result.status === 'fulfilled')
615
+ return result.value;
616
+ const reason = result.reason;
617
+ return { ok: false, kind: 'http', detail: truncate(reason?.message ?? String(result.reason), 200) };
618
+ };
619
+ const projectOutcome = toOutcome(settled[0]);
620
+ const childOutcomes = HUB_CHILDREN.map((spec, index) => ({
621
+ spec,
622
+ outcome: toOutcome(settled[index + 1]),
623
+ }));
624
+ // Drop the cached session if ANY leg saw a genuine 401 — the children are
625
+ // separate requests, so a stale token can surface there first.
626
+ const allOutcomes = [projectOutcome, ...childOutcomes.map((child) => child.outcome)];
627
+ const genuineAuthFailure = allOutcomes.some((outcome) => !outcome.ok && outcome.kind === 'auth' && !outcome.transientRefresh);
628
+ if (genuineAuthFailure)
629
+ deps.invalidateSession?.();
630
+ // `!transientRefresh` mirrors the invalidation predicate above, and the two
631
+ // must agree: a 401 whose inline refresh failed for NETWORK reasons is not an
632
+ // expired session. Telling the user to re-authenticate then would send them to
633
+ // fix an account that is fine, and it would fail the whole call for a blip the
634
+ // degradation path handles — so a transient one falls through and degrades
635
+ // like any other project-meta failure.
636
+ if (!projectOutcome.ok && projectOutcome.kind === 'auth' && !projectOutcome.transientRefresh) {
637
+ throw new ProjectToolError('Session expired. Re-run any Clien.ai tool to re-authenticate, then try again.');
638
+ }
639
+ if (!projectOutcome.ok && projectOutcome.kind === 'notFound') {
640
+ throw new ProjectToolError(`Project ${projectId} not found. It may not exist or may belong to a different ` +
641
+ 'account — call list_projects to confirm the id.');
642
+ }
643
+ let projectMeta = null;
644
+ let projectFailure = null;
645
+ if (projectOutcome.ok) {
646
+ const candidate = projectOutcome.json.project;
647
+ if (candidate !== null && typeof candidate === 'object') {
648
+ projectMeta = candidate;
649
+ }
650
+ else {
651
+ projectFailure = 'the server returned a 200 with no `project` object';
652
+ }
653
+ }
654
+ else {
655
+ projectFailure = describeFailure(projectOutcome);
656
+ }
657
+ const collections = {};
658
+ for (const { spec, outcome } of childOutcomes) {
659
+ collections[spec.key] = buildCollection(spec, outcome, limit, inlined.has(spec.key));
660
+ }
661
+ // --- text rendering -------------------------------------------------------
662
+ // ⚠️ Everything below runs AFTER the fan-out, which means it is OUTSIDE the
663
+ // `allSettled` backstop — a throw here fails the whole call and discards six
664
+ // successfully fetched collections, defeating the entire point of the design.
665
+ // So the renderer must be total for ANY value the server can put in these
666
+ // fields. `nonEmptyString` is the guard: a numeric `description` previously
667
+ // reached `truncate`, whose `s.slice` is not a function on a number.
668
+ const projectName = nonEmptyString(projectMeta?.name);
669
+ const projectDescription = nonEmptyString(projectMeta?.description);
670
+ const header = projectMeta
671
+ ? `Project "${projectName ?? '(unnamed)'}" (id: ${projectId})` +
672
+ (projectMeta.isLocked ? ' — ⚠️ LOCKED (read-only until the subscription is upgraded)' : '')
673
+ : `Project ${projectId}`;
674
+ const descriptionLine = projectDescription ? `\n${truncate(projectDescription, 300)}` : '';
675
+ const projectWarning = projectFailure
676
+ ? `\n⚠️ Project metadata unavailable — ${projectFailure}. The collections below were still read.`
677
+ : '';
678
+ const countLines = HUB_CHILDREN.map((spec) => {
679
+ const entry = collections[spec.key];
680
+ if (!entry || isUnavailable(entry)) {
681
+ return (`- ⚠️ ${spec.label}: UNAVAILABLE — ${entry?.detail ?? 'unknown error'}. ` +
682
+ 'This is a failed read, not an empty collection — do not conclude there are none.');
683
+ }
684
+ if (entry.count === 0)
685
+ return `- ${spec.label}: 0`;
686
+ const shownNote = entry.shown < entry.count ? `, showing ${entry.shown}` : '';
687
+ const totalNote = entry.countExact
688
+ ? ''
689
+ : ' — this endpoint reports no total, so the count is a lower bound';
690
+ return `- ${spec.label}: ${countPhrase(entry)} (${spec.order}${shownNote})${totalNote}`;
691
+ });
692
+ const detailBlocks = HUB_CHILDREN.flatMap((spec) => {
693
+ const entry = collections[spec.key];
694
+ if (!entry || isUnavailable(entry) || entry.summaries.length === 0)
695
+ return [];
696
+ const lines = entry.summaries.map((s) => ` - ${s.label} — id: ${s.id ?? 'unknown'}`);
697
+ // Two different "there is more" cases, and the second one used to be
698
+ // unreachable: when `countExact` is false there is no server total, so
699
+ // `count` EQUALS `shown` and the first branch never fires — leaving the one
700
+ // collection whose count is a lower bound as the only one that never told
701
+ // the agent how to see the rest.
702
+ let more = '';
703
+ if (entry.shown < entry.count) {
704
+ more = `\n (${entry.count - entry.shown} more — page with ${spec.listTool})`;
705
+ }
706
+ else if (!entry.countExact) {
707
+ more = `\n (there may be more — page with ${spec.listTool})`;
708
+ }
709
+ return [`${spec.label} (${spec.order}):\n${lines.join('\n')}${more}`];
710
+ });
711
+ const loaded = HUB_CHILDREN.map((spec) => collections[spec.key]).filter((entry) => entry !== undefined && !isUnavailable(entry));
712
+ const everythingLoaded = loaded.length === HUB_CHILDREN.length;
713
+ // `projectFailure === null` is load-bearing, not belt-and-braces: without it a
714
+ // 502 on project meta plus five genuinely empty children rendered "⚠️ Project
715
+ // metadata unavailable" and "This project is empty — nothing failed" in the
716
+ // same response. The one claim this tool exists to make trustworthy is the
717
+ // difference between "failed" and "empty"; contradicting itself about that in
718
+ // consecutive lines is worse than either message alone.
719
+ const isEmptyProject = projectFailure === null && everythingLoaded && loaded.every((entry) => entry.count === 0);
720
+ const footer = isEmptyProject
721
+ ? '\n\nThis project is empty — nothing failed, there is simply no data yet. Run ' +
722
+ 'clien_research for a full validation pass, or create_persona / scan_competitors / ' +
723
+ 'search_forums for a targeted first step.'
724
+ : '\n\nIds and full records are in `_meta.collections`. Read one child with get_persona / ' +
725
+ 'get_interview / get_report, page a whole collection with list_personas / list_interviews / ' +
726
+ 'list_competitors / list_community_signals / list_reports, or re-call get_project with ' +
727
+ '`include` to inline a collection here.';
728
+ const text = `${header}${descriptionLine}${projectWarning}\n\n${countLines.join('\n')}` +
729
+ (detailBlocks.length > 0 ? `\n\n${detailBlocks.join('\n\n')}` : '') +
730
+ footer;
731
+ return {
732
+ content: [{ type: 'text', text }],
733
+ _meta: {
734
+ // Same `{ error: 'unavailable', detail }` shape as a degraded collection,
735
+ // so a caller keys on the presence of `.error` in exactly one way.
736
+ project: projectMeta ?? { error: 'unavailable', detail: projectFailure },
737
+ collections,
738
+ limit,
739
+ included: [...inlined],
740
+ },
741
+ };
742
+ }
195
743
  //# sourceMappingURL=projects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;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,yBAAyB,GAAG,MAAM,CAAA;AAExC,8EAA8E;AAC9E,8EAA8E;AAC9E,0DAA0D;AAC1D,6EAA6E;AAC7E,gFAAgF;AAChF,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAC5B,MAAM,uBAAuB,GAAG,IAAI,CAAA;AACpC,MAAM,cAAc,GAAG,GAAG,CAAA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