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