dsh-project-mcp 0.2.0 → 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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-project-mcp",
3
3
  "description": "Per-project MCP servers for DeepSeek Harness: mounts the MCP servers a project declares into the sessions working in it",
4
- "version": "0.2.0",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "keywords": [
18
18
  "dsh",
19
+ "dsh-plugin",
19
20
  "deepseek-harness",
20
21
  "mcp",
21
22
  "model-context-protocol",
@@ -42,6 +43,22 @@
42
43
  "./cordis.patch.yml": "./cordis.patch.yml",
43
44
  "./package.json": "./package.json"
44
45
  },
46
+ "scripts": {
47
+ "build": "tsc -p tsconfig.json && tsdown && node scripts/wrap-client.mjs",
48
+ "prepack": "pnpm build",
49
+ "typecheck": "tsc -p tsconfig.json",
50
+ "test": "vitest run",
51
+ "coverage": "vitest run --coverage",
52
+ "e2e": "node scripts/e2e-boot.mjs",
53
+ "check": "tsc -p tsconfig.json && tsdown && node scripts/wrap-client.mjs && vitest run --coverage && node scripts/audit.mjs",
54
+ "smoke": "node scripts/live-smoke.mjs",
55
+ "design:parity": "node scripts/design-parity.mjs",
56
+ "test:bun": "bun test tests",
57
+ "smoke:bun": "bun scripts/live-smoke.mjs",
58
+ "audit": "node scripts/audit.mjs",
59
+ "audit:bun": "bun scripts/audit.mjs",
60
+ "check:config": "node scripts/check-config.mjs"
61
+ },
45
62
  "dsh": {
46
63
  "bundle": {
47
64
  "patch": "./cordis.patch.yml"
@@ -59,48 +76,28 @@
59
76
  },
60
77
  "peerDependencies": {
61
78
  "@deepseek-ai/cordis": ">=4.0.2",
62
- "@deepseek-ai/dsh-mcp-client": ">=0.1.5-rc.2",
63
- "@deepseek-ai/dsh-scope": ">=0.1.5-rc.2",
64
- "dsh-better-sidebar": ">=0.19.0",
79
+ "@deepseek-ai/dsh-mcp-client": ">=0.2.0-rc.2",
80
+ "@deepseek-ai/dsh-scope": ">=0.2.0-rc.2",
65
81
  "react": ">=18.2.0"
66
82
  },
67
83
  "peerDependenciesMeta": {
68
- "dsh-better-sidebar": {
69
- "optional": true
70
- },
71
84
  "react": {
72
85
  "optional": true
73
86
  }
74
87
  },
75
88
  "devDependencies": {
76
- "@deepseek-ai/cordis": "4.0.2",
77
- "@deepseek-ai/dsh-mcp-client": "0.1.5-rc.2",
78
- "@deepseek-ai/dsh-scope": "0.1.5-rc.2",
79
- "@types/node": "^22.20.0",
89
+ "@deepseek-ai/cordis": "4.0.4",
90
+ "@deepseek-ai/dsh-mcp-client": "0.2.0-rc.2",
91
+ "@deepseek-ai/dsh-scope": "0.2.0-rc.2",
92
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
93
+ "@types/node": "^22.20.4",
80
94
  "@types/react": "^18.3.31",
81
- "@vitest/coverage-v8": "^5.0.1",
82
- "@vitest/ui": "5.0.1",
83
- "dsh-better-sidebar": "^0.19.1",
95
+ "@vitest/coverage-v8": "^5.0.2",
96
+ "@vitest/ui": "5.0.2",
84
97
  "react": "^18.3.1",
85
- "tsdown": "^0.22.2",
86
- "unrun": "^0.2.39",
98
+ "tsdown": "^0.23.0",
87
99
  "typescript": "^7.0.2",
88
- "vitest": "^5.0.1",
89
- "@deepseek-ai/dsh-tools": "0.1.5-rc.2"
90
- },
91
- "scripts": {
92
- "build": "tsc -p tsconfig.json && tsdown && node scripts/wrap-client.mjs",
93
- "typecheck": "tsc -p tsconfig.json",
94
- "test": "vitest run",
95
- "coverage": "vitest run --coverage",
96
- "e2e": "node scripts/e2e-boot.mjs",
97
- "check": "tsc -p tsconfig.json && tsdown && node scripts/wrap-client.mjs && vitest run --coverage && node scripts/audit.mjs",
98
- "smoke": "node scripts/live-smoke.mjs",
99
- "design:parity": "node scripts/design-parity.mjs",
100
- "test:bun": "bun test tests",
101
- "smoke:bun": "bun scripts/live-smoke.mjs",
102
- "audit": "node scripts/audit.mjs",
103
- "audit:bun": "bun scripts/audit.mjs",
104
- "check:config": "node scripts/check-config.mjs"
100
+ "unrun": "^0.3.1",
101
+ "vitest": "^5.0.2"
105
102
  }
106
- }
103
+ }
package/src/activation.ts CHANGED
@@ -5,17 +5,20 @@
5
5
  * every tool the project owns. This module keeps the *presentation* list small
6
6
  * without touching the registry:
7
7
  *
8
- * - the usage counters seed a **baseline** of tools the project actually calls
9
- * ({@link seedFromUsage}) — they are offered directly from the first step on;
8
+ * - the usage counters seed a **baseline** of tools the project has called — one
9
+ * call is enough ({@link seedFromUsage}) — and they are offered directly from
10
+ * the first step on;
10
11
  * - the newest task text ranks the project's mounted tools with BM25, and the
11
12
  * best matches are offered through a **sticky window** that holds one offered
12
- * set across several steps ({@link advanceAutoOffer});
13
+ * set across the session's steps ({@link advanceAutoOffer});
13
14
  * - the rest are discovered through the `mcp_search_tools` tool this module
14
15
  * registers in the agent scope, which **activates** the matches for the next
15
16
  * step ({@link activate});
16
- * - a tool that is never called falls out again ({@link pruneIdle}), and a
17
- * compaction ends the session's activations while the counter baseline stays
18
- * ({@link onCompaction});
17
+ * - a compaction ends the session's activations that no call backs, while the
18
+ * ones the model really called and the counter baseline stay
19
+ * ({@link onCompaction}); idle pruning ({@link pruneIdle}) stays available
20
+ * through a positive `toolIdleMs`, and the shipped `0` leaves it off, so the
21
+ * compaction boundary is the one place that shrinks the offered set;
19
22
  * - the agent's own `system-prompt/assemble` listener puts the active schemas
20
23
  * back into the assembled request ({@link withActiveTools}).
21
24
  *
@@ -39,14 +42,30 @@ import type { OfferedTool, ServerUsage, SessionTools, ToolPolicy } from './types
39
42
  /** `true` while the session may offer MCP tools through search + activation. */
40
43
  export const DEFAULT_ACTIVATION_ENABLED = true
41
44
 
42
- /** Tools seeded into the baseline from the durable counters. */
43
- export const DEFAULT_ACTIVATION_SEEDED = 8
45
+ /**
46
+ * Tools seeded into the baseline from the durable counters. A project with a
47
+ * few dozen mounted tools calls more than a handful of them, so the cap sits
48
+ * above the narrow window that used to evict a tool the project really uses.
49
+ */
50
+ export const DEFAULT_ACTIVATION_SEEDED = 16
44
51
 
45
- /** Calls one tool needs in the counters before it is seeded. */
46
- export const DEFAULT_ACTIVATION_MIN_CALLS = 5
52
+ /**
53
+ * Calls one tool needs in the counters before it is seeded. One call is enough:
54
+ * a tool the project actually uses enters the durable baseline the first time it
55
+ * is called, so the baseline grows from real usage instead of waiting for the
56
+ * counters to reach an arbitrary threshold.
57
+ */
58
+ export const DEFAULT_ACTIVATION_MIN_CALLS = 1
47
59
 
48
- /** How long a session-activated tool survives without a call (`0` disables). */
49
- export const DEFAULT_TOOL_IDLE_MS = 1_800_000
60
+ /**
61
+ * How long a session-activated tool survives without a call (`0` disables).
62
+ *
63
+ * The shipped `0` keeps a searched tool offered for the rest of the session:
64
+ * dropping it mid-session shrinks the request and rewrites the prompt prefix,
65
+ * which invalidates the provider's prefix cache, so time-based removal stays an
66
+ * explicit opt-in.
67
+ */
68
+ export const DEFAULT_TOOL_IDLE_MS = 0
50
69
 
51
70
  /** Matches one `mcp_search_tools` call activates when it omits `limit`. */
52
71
  export const DEFAULT_SEARCH_LIMIT = 8
@@ -80,11 +99,15 @@ export const MAX_AUTO_ACTIVATION_LIMIT = 50
80
99
  * Extra user messages a context-driven offer survives after the one that ranked
81
100
  * it; `0` keeps only that message. The offering set is recomputed when the task
82
101
  * context moves, so this is what holds one tool list across several steps.
102
+ *
103
+ * The shipped window spans a whole session: dropping an offer mid-session
104
+ * rewrites the prompt prefix and invalidates the provider's prefix cache, so the
105
+ * context tier grows and only resets at a compaction.
83
106
  */
84
- export const DEFAULT_AUTO_ACTIVATION_STICKY_STEPS = 2
107
+ export const DEFAULT_AUTO_ACTIVATION_STICKY_STEPS = 100
85
108
 
86
109
  /** Hard cap on the sticky window, however the config asks for more. */
87
- export const MAX_AUTO_ACTIVATION_STICKY_STEPS = 20
110
+ export const MAX_AUTO_ACTIVATION_STICKY_STEPS = 1000
88
111
 
89
112
  /**
90
113
  * Serialized size of the MCP surface a session may offer directly before this
@@ -241,24 +264,39 @@ export interface SessionEventLike {
241
264
  * One session's activation state.
242
265
  *
243
266
  * `baseline` is the counter-seeded set and outlives a compaction; `active` holds
244
- * the names this session activated through search, each with the epoch
245
- * milliseconds of its last touch, and is what idle pruning and compaction clear.
246
- * Both are read-only because every transition returns a new state.
267
+ * the names this session activated through search or the context tier, each with
268
+ * the epoch milliseconds of its last touch, and is what idle pruning and
269
+ * compaction trim. `used` records the calls the session made for this plugin's
270
+ * own namespace — the evidence a compaction keeps an activation by, because a
271
+ * tool the model called is one the session really uses. It is cumulative for the
272
+ * session and never bounded, so the compaction boundary shrinks the offers no
273
+ * call backs and never shrinks a used tool again.
274
+ *
275
+ * Every field is read-only because every transition returns a new state.
247
276
  */
248
277
  export interface ActivationState {
249
278
  /** Public names the durable counters proved hot; always offered. */
250
279
  readonly baseline: ReadonlySet<string>
251
280
  /** Session-activated public names mapped to their last touch. */
252
281
  readonly active: ReadonlyMap<string, number>
282
+ /**
283
+ * `mcp__` names this session called at least once and the durable baseline
284
+ * does not already keep. Read by nothing but {@link onCompaction}, and
285
+ * cumulative for the session: it is deliberately never bounded, so with the
286
+ * shipped `DEFAULT_TOOL_IDLE_MS` of `0` nothing else removes a name and a tool
287
+ * the session used stays offered for the rest of the session, across every
288
+ * further compaction.
289
+ */
290
+ readonly used: ReadonlySet<string>
253
291
  }
254
292
 
255
293
  /**
256
294
  * Build one session's state.
257
295
  * @param baseline - counter-seeded public names; defaults to none.
258
- * @returns an empty active set over that baseline.
296
+ * @returns an empty active set and an empty used record over that baseline.
259
297
  */
260
298
  export function createActivationState(baseline: Iterable<string> = []): ActivationState {
261
- return { baseline: new Set(baseline), active: new Map() }
299
+ return { baseline: new Set(baseline), active: new Map(), used: new Set() }
262
300
  }
263
301
 
264
302
  /** How {@link seedFromUsage} reads the durable counters. */
@@ -324,13 +362,20 @@ export function activate(
324
362
  active ??= new Map(state.active)
325
363
  active.set(name, at)
326
364
  }
327
- return active === undefined ? state : { baseline: state.baseline, active }
365
+ return active === undefined ? state : { baseline: state.baseline, active, used: state.used }
328
366
  }
329
367
 
330
368
  /**
331
- * Refresh the freshness of a tool the session actually called. A call is what
332
- * keeps a session-activated tool offered; a name that is not active (a baseline
333
- * tool, or a tool the model called by name without activating it) is untouched.
369
+ * Record a call — the freshness of a session-activated tool and the evidence a
370
+ * compaction keeps it by.
371
+ *
372
+ * `active` is refreshed exactly as before: a call is what keeps a
373
+ * session-activated tool offered. `used` records the call itself, but only for
374
+ * this plugin's own namespace: the core tools (`read`, `bash`, …) ride the same
375
+ * `tools/result` hook, and they are no part of a session's MCP activation state.
376
+ * A baseline name is not recorded either — the durable baseline already keeps it
377
+ * offered, so recording the call would only make a compaction look like it
378
+ * changed something.
334
379
  *
335
380
  * @param state - activation state before the call.
336
381
  * @param name - public name of the called tool.
@@ -339,10 +384,22 @@ export function activate(
339
384
  */
340
385
  export function noteUse(state: ActivationState, name: string, at: number): ActivationState {
341
386
  const previous = state.active.get(name)
342
- if (previous === undefined || previous === at) return state
343
- const active = new Map(state.active)
344
- active.set(name, at)
345
- return { baseline: state.baseline, active }
387
+ const refresh = previous !== undefined && previous !== at
388
+ // `used` post-dates the interface: a state an embedder built before the field
389
+ // existed reads as a session that has used nothing, so the read is optional
390
+ // and the write coalesces an empty record instead of throwing.
391
+ const already = state.used?.has(name) === true
392
+ const record = name.startsWith('mcp__') && !state.baseline.has(name) && !already
393
+ if (!refresh && !record) return state
394
+ const active = refresh ? new Map(state.active) : undefined
395
+ active?.set(name, at)
396
+ const used = record ? new Set(state.used ?? []) : undefined
397
+ used?.add(name)
398
+ return {
399
+ baseline: state.baseline,
400
+ active: active ?? state.active,
401
+ used: used ?? state.used ?? new Set(),
402
+ }
346
403
  }
347
404
 
348
405
  /**
@@ -350,6 +407,13 @@ export function noteUse(state: ActivationState, name: string, at: number): Activ
350
407
  * The baseline is never pruned: it comes from the durable counters, not from the
351
408
  * session. `idleMs <= 0` disables pruning.
352
409
  *
410
+ * A positive `idleMs` is an explicit opt-in to *forgetting*: an evicted name
411
+ * leaves the used record with the offer it was about, so the sweep is final —
412
+ * a later compaction cannot read the call back and resurrect what time already
413
+ * dropped. A name the model needs again is activated again through search. The
414
+ * names still inside the window keep their record, and a sweep that evicts
415
+ * nothing returns its input.
416
+ *
353
417
  * @param state - activation state at `now`.
354
418
  * @param now - epoch milliseconds of the sweep.
355
419
  * @param idleMs - age at which a tool falls out.
@@ -358,23 +422,68 @@ export function noteUse(state: ActivationState, name: string, at: number): Activ
358
422
  export function pruneIdle(state: ActivationState, now: number, idleMs: number): ActivationState {
359
423
  if (idleMs <= 0 || state.active.size === 0) return state
360
424
  let active: Map<string, number> | undefined
425
+ let used: Set<string> | undefined
361
426
  for (const [name, at] of state.active) {
362
427
  if (now - at < idleMs) continue
363
428
  active ??= new Map(state.active)
364
429
  active.delete(name)
430
+ // `used` post-dates the interface, so a legacy state simply has no record to
431
+ // forget; a record that is there is copied before it is dropped.
432
+ if (state.used?.has(name) !== true) continue
433
+ used ??= new Set(state.used ?? [])
434
+ used.delete(name)
365
435
  }
366
- return active === undefined ? state : { baseline: state.baseline, active }
436
+ return active === undefined
437
+ ? state
438
+ : { baseline: state.baseline, active, used: used ?? state.used ?? new Set() }
367
439
  }
368
440
 
369
441
  /**
370
- * End the session's activations — a compaction rewrote the conversation they
371
- * belonged to — while keeping the counter baseline.
442
+ * End the session's activations that no call backs, at the compaction boundary.
443
+ *
444
+ * A compaction rewrites the conversation, so the provider's prompt prefix is
445
+ * recomputed anyway: this is the one boundary where dropping a tool costs no
446
+ * cache, which is why idle time is off by default and why this is the only place
447
+ * the offered set shrinks. Only the part the session never used goes — an offer
448
+ * from a context match or a search that the model did not act on. A tool this
449
+ * session did call is one it really uses, so it stays active, stamped with its
450
+ * last touch; evicting it would charge a re-discovery step for a tool the
451
+ * session demonstrably needs. A used name that was never activated falls back to
452
+ * the compaction's own clock. The counter baseline is never pruned.
453
+ *
454
+ * The used record is cumulative for the session and deliberately never bounded:
455
+ * with the shipped `DEFAULT_TOOL_IDLE_MS` of `0` nothing else removes a name, so
456
+ * a tool the session used stays offered for the rest of the session, across every
457
+ * further compaction. This boundary shrinks the offers no call backs — it never
458
+ * shrinks one the session used again.
459
+ *
372
460
  * @param state - activation state before the compaction.
373
- * @returns the updated state, or the input when no session tool was active.
461
+ * @param at - epoch milliseconds of the compaction.
462
+ * @returns the updated state, or the input when nothing was active or used, or
463
+ * when the rebuild is equivalent to what is already there — a caller compares
464
+ * by identity to tell a real change from a boundary that changed nothing.
374
465
  */
375
- export function onCompaction(state: ActivationState): ActivationState {
376
- if (state.active.size === 0) return state
377
- return { baseline: state.baseline, active: new Map() }
466
+ export function onCompaction(state: ActivationState, at: number): ActivationState {
467
+ // `used` post-dates the interface: a state an embedder built before the field
468
+ // existed reads as a session that has used nothing.
469
+ const used = state.used ?? new Set<string>()
470
+ if (state.active.size === 0 && used.size === 0) return state
471
+ const active = new Map<string, number>()
472
+ for (const name of used) active.set(name, state.active.get(name) ?? at)
473
+ // A second compaction with no new call rebuilds exactly the map already there,
474
+ // and an equal-but-different object would read as a change to every caller
475
+ // that compares by identity. Same names and same stamps: the input comes back.
476
+ if (active.size === state.active.size) {
477
+ let equivalent = true
478
+ for (const [name, stamp] of active) {
479
+ if (state.active.get(name) !== stamp) {
480
+ equivalent = false
481
+ break
482
+ }
483
+ }
484
+ if (equivalent) return state
485
+ }
486
+ return { baseline: state.baseline, active, used: state.used ?? new Set() }
378
487
  }
379
488
 
380
489
  /**
@@ -410,10 +519,15 @@ export function surfaceChars(schemas: readonly ToolSchemaLike[]): number {
410
519
  * {@link surfaceChars} sums, so a caller that splits a surface into two halves
411
520
  * counts each half by one rule.
412
521
  *
522
+ * Exported for the same reason {@link surfaceChars} is: the on-demand tool
523
+ * detail route answers the *size of one definition* as a host measurement, and
524
+ * a reason line that recomputed it would risk a different number than the
525
+ * budget decision it explains.
526
+ *
413
527
  * @param schema - one schema a session may offer.
414
528
  * @returns its character count.
415
529
  */
416
- function schemaChars(schema: ToolSchemaLike): number {
530
+ export function schemaChars(schema: ToolSchemaLike): number {
417
531
  return schema.name.length + schema.description.length + serializedLength(schema.parameters)
418
532
  }
419
533
 
@@ -853,7 +967,18 @@ export function autoOffers(state: AutoOfferState): readonly string[] {
853
967
  return entries.map((entry) => entry.name)
854
968
  }
855
969
 
856
- /** Whether two context-driven states describe the same offered set and history. */
970
+ /**
971
+ * Whether two context-driven states offer the same names.
972
+ *
973
+ * Only the presented names are compared, never the advance stamp and never the
974
+ * per-name window stamps, so an advance that changes nothing hands back the
975
+ * previous state without ticking the advance counter: the sticky window ages by
976
+ * changes of the offered set, not by input count. This was reviewed as a
977
+ * possible stickiness off-by-one and cannot produce a wrong offered set — a
978
+ * stall can only hold names the ranking has just chosen again, and it ends at
979
+ * the first advance whose set differs — so do not re-chase an age here before
980
+ * reading `advanceAutoOffer`.
981
+ */
857
982
  function sameAutoOffer(left: AutoOfferState, right: AutoOfferState): boolean {
858
983
  const leftNames = autoPresentedNames(left)
859
984
  const rightNames = autoPresentedNames(right)
@@ -1202,10 +1327,10 @@ export interface ActivationWiringOptions {
1202
1327
  */
1203
1328
  readonly onActivated?: (names: readonly string[], step: number) => void
1204
1329
  /**
1205
- * Told that a compaction ended the session's activations, so the caller can
1206
- * drop the step records that belong to them. Absent leaves the records in
1207
- * place, which only means a later activation of the same name may carry the
1208
- * step of the offer the compaction removed.
1330
+ * Told that a compaction ended some of the session's activations, so the
1331
+ * caller can drop the step records that belonged to the ones it removed.
1332
+ * Absent leaves the records in place, which only means a later activation of
1333
+ * the same name may carry the step of the offer the compaction removed.
1209
1334
  */
1210
1335
  readonly onCompaction?: () => void
1211
1336
  /** Context-driven state to start from; defaults to an empty state. */
@@ -1458,10 +1583,11 @@ export function installActivation(options: ActivationWiringOptions): () => void
1458
1583
  const observe = (_session: unknown, event: SessionEventLike): void => {
1459
1584
  try {
1460
1585
  if (event?.type === 'compaction/end') {
1461
- options.setState(onCompaction(options.state()))
1462
- // The step records belong to activations a compaction has just dropped,
1463
- // so they go with them: a name activated again after this is stamped
1464
- // with the step it returns on, not with the one it left on.
1586
+ options.setState(onCompaction(options.state(), Date.now()))
1587
+ // The step records of the activations the compaction just dropped go
1588
+ // with them: a name activated again after this is stamped with the step
1589
+ // it returns on, not with the one it left on, while a tool the session
1590
+ // really used keeps the step its offer happened on.
1465
1591
  options.onCompaction?.()
1466
1592
  // A compaction rewrote the conversation the offers belonged to, so the
1467
1593
  // context tier starts over; the counter baseline is untouched.
@@ -26,10 +26,11 @@ import type {
26
26
  ServerUsage,
27
27
  SessionSnapshot,
28
28
  SessionTools,
29
+ ToolFacts,
29
30
  ToolPolicy,
30
31
  } from '../types.ts'
31
32
  import type { ToastDraft } from './toasts.ts'
32
- import { STATUS_HINT } from './view.ts'
33
+ import { STATUS_HINT, seedToolFacts } from './view.ts'
33
34
 
34
35
  /** Session the fixtures belong to; `shortSessionId` renders it as `8fce1c`. */
35
36
  export const DESIGN_SESSION = 'session-8fce1c-4a3f-4d0b-9c11-2f6a7b8c9d10'
@@ -93,6 +94,97 @@ export const DESIGN_USAGE: Record<string, ServerUsage> = {
93
94
  },
94
95
  }
95
96
 
97
+ /**
98
+ * The definitions the stand's own host publishes (F-56).
99
+ *
100
+ * The body of an opened row is answered by `GET tool`, a route the stand has no
101
+ * host behind: without these records every open row of the design surfaces would
102
+ * sit on a read that never lands. The records are the picture's own — they agree
103
+ * with {@link DESIGN_USAGE} (`workspace` was called, `catalog` never) and with
104
+ * {@link designTools} — so the stand draws the real body: a description, a field
105
+ * list with one required field and one nested object drawn as its type, and the
106
+ * reason a deferred name is not in the request.
107
+ *
108
+ * They are seeded into the panel's own cache ({@link designProject} calls
109
+ * {@link seedDesignToolFacts}), not branched on inside the row: `view.ts` has no
110
+ * code path that knows whether an answer came from a socket, and the stand must
111
+ * render the product's body rather than a second drawing of it.
112
+ */
113
+ export const DESIGN_TOOL_FACTS: Record<string, ToolFacts> = {
114
+ 'mcp__tglider__workspace': {
115
+ name: 'mcp__tglider__workspace',
116
+ description:
117
+ 'Workspace overview: changed symbols, diagnostics and the files that carry them, as one page.',
118
+ fields: [
119
+ {
120
+ name: 'path',
121
+ type: 'string',
122
+ required: true,
123
+ description: 'Directory to read, relative to the project root.',
124
+ },
125
+ {
126
+ name: 'depth',
127
+ type: 'number',
128
+ required: false,
129
+ description: 'How deep the dependency walk may go.',
130
+ },
131
+ {
132
+ // An object field is drawn as its own type and not expanded: the panel
133
+ // lists what a call takes, it does not mirror the schema.
134
+ name: 'filters',
135
+ type: 'object',
136
+ required: false,
137
+ description: 'Per-file overrides; the server documents their shape.',
138
+ },
139
+ ],
140
+ },
141
+ // No fields at all, so the stand also shows the rule that an empty group draws
142
+ // no heading rather than an empty list under it.
143
+ 'mcp__tglider__catalog': {
144
+ name: 'mcp__tglider__catalog',
145
+ description: 'Every tool the server declares, with the size of each definition.',
146
+ fields: [],
147
+ },
148
+ 'mcp__grafana-local__query': {
149
+ name: 'mcp__grafana-local__query',
150
+ description: 'Run one PromQL query against a dashboard’s data source.',
151
+ fields: [
152
+ { name: 'query', type: 'string', required: true, description: 'The PromQL expression.' },
153
+ { name: 'range', type: 'string', required: false },
154
+ ],
155
+ },
156
+ 'mcp__context7__docs': {
157
+ name: 'mcp__context7__docs',
158
+ description: 'Documentation pages for one library, ranked by the question asked.',
159
+ fields: [],
160
+ },
161
+ 'mcp__playwright__navigate': {
162
+ name: 'mcp__playwright__navigate',
163
+ description: 'Open a URL in the browser and wait for the page to settle.',
164
+ fields: [{ name: 'url', type: 'string', required: true, description: 'Absolute URL to open.' }],
165
+ // Every figure is one the picture's own host measured, which is the whole
166
+ // point of the reason line: the panel prints no size it computed itself.
167
+ reason: { kind: 'budget', chars: 1_240, budget: 8_000, used: 6_900 },
168
+ },
169
+ 'mcp__rider__open': {
170
+ name: 'mcp__rider__open',
171
+ description: 'Open one file in the IDE at a line.',
172
+ fields: [{ name: 'path', type: 'string', required: true }],
173
+ reason: { kind: 'budget', chars: 640, budget: 8_000 },
174
+ },
175
+ }
176
+
177
+ /**
178
+ * Publish the picture's definitions into the panel's cache.
179
+ *
180
+ * Idempotent and cheap: called from {@link designProject}, which every design
181
+ * surface renders through, so a fixture body is always seeded before the first
182
+ * row can be opened. Seeding the same record twice is the same record.
183
+ */
184
+ export function seedDesignToolFacts(): void {
185
+ for (const [name, facts] of Object.entries(DESIGN_TOOL_FACTS)) seedToolFacts(name, facts)
186
+ }
187
+
96
188
  /** One lifecycle event, as the ring stores it. */
97
189
  function event(
98
190
  at: number,
@@ -320,6 +412,9 @@ function sessionOf(variant: DesignVariant): SessionSnapshot[] {
320
412
  */
321
413
  export function designProject(variant: DesignVariant): ProjectSnapshot | undefined {
322
414
  if (variant === 'no-project' || variant === 'no-session') return undefined
415
+ // The stand's own host answers (F-56): an opened row reads the definitions
416
+ // from the cache the product reads, seeded here because there is no route.
417
+ seedDesignToolFacts()
323
418
  const rows = mergedRows(variant)
324
419
  const logs = variant === 'full' ? DESIGN_EVENTS : variant === 'tools-absent' ? DESIGN_PENDING_EVENT : []
325
420
  const sessions = sessionOf(variant)