create-principles-disciple 1.89.0 → 1.91.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.
Files changed (53) hide show
  1. package/console/dist/ui/api.d.ts +2 -1
  2. package/console/dist/ui/api.js +7 -1
  3. package/console/dist/ui/i18n/en.json +18 -1
  4. package/console/dist/ui/i18n/zh-CN.json +18 -1
  5. package/console/dist/ui/pages/focus/FocusPage.js +48 -4
  6. package/console/dist/ui/pages/principles/PrincipleDetailPage.js +70 -2
  7. package/console/dist/web/assets/app.js +1541 -1223
  8. package/console/package.json +2 -2
  9. package/core/dist/prompt-builder/__tests__/routing-guidance.test.d.ts +1 -2
  10. package/core/dist/prompt-builder/__tests__/routing-guidance.test.d.ts.map +1 -1
  11. package/core/dist/prompt-builder/__tests__/routing-guidance.test.js +1 -2
  12. package/core/dist/prompt-builder/__tests__/routing-guidance.test.js.map +1 -1
  13. package/core/dist/prompt-builder/routing-guidance.d.ts +0 -1
  14. package/core/dist/prompt-builder/routing-guidance.d.ts.map +1 -1
  15. package/core/dist/prompt-builder/routing-guidance.js +0 -1
  16. package/core/dist/prompt-builder/routing-guidance.js.map +1 -1
  17. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +5 -43
  18. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  19. package/core/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js +205 -2
  20. package/core/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js.map +1 -1
  21. package/core/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.js +17 -1
  22. package/core/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.js.map +1 -1
  23. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts +4 -1
  24. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  25. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js +6 -3
  26. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js.map +1 -1
  27. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts +20 -7
  28. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts.map +1 -1
  29. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.js +19 -3
  30. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.js.map +1 -1
  31. package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js +3 -3
  32. package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js.map +1 -1
  33. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts.map +1 -1
  34. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js +0 -18
  35. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js.map +1 -1
  36. package/core/package.json +1 -1
  37. package/package.json +2 -2
  38. package/pd-cli/package.json +1 -1
  39. package/plugin/dist/hooks/prompt.js +4 -5
  40. package/plugin/dist/index.js +0 -83
  41. package/plugin/package.json +2 -2
  42. package/plugin/dist/core/local-worker-routing.d.ts +0 -124
  43. package/plugin/dist/core/local-worker-routing.js +0 -216
  44. package/plugin/dist/core/model-deployment-registry.d.ts +0 -218
  45. package/plugin/dist/core/model-deployment-registry.js +0 -502
  46. package/plugin/dist/core/model-training-registry.d.ts +0 -295
  47. package/plugin/dist/core/model-training-registry.js +0 -474
  48. package/plugin/dist/core/promotion-gate.d.ts +0 -243
  49. package/plugin/dist/core/promotion-gate.js +0 -554
  50. package/plugin/dist/core/shadow-observation-registry.d.ts +0 -217
  51. package/plugin/dist/core/shadow-observation-registry.js +0 -280
  52. package/plugin/dist/utils/shadow-fingerprint.d.ts +0 -16
  53. package/plugin/dist/utils/shadow-fingerprint.js +0 -34
@@ -1,474 +0,0 @@
1
- /**
2
- * Model Training Registry — Training Run, Checkpoint, and Eval Summary Lineage
3
- * =============================================================================
4
- *
5
- * PURPOSE: Establish strict auditable lineage from training run → checkpoint → eval
6
- * so that "deployable" is a controlled state, not a free-text field.
7
- *
8
- * ARCHITECTURE:
9
- * - Registry file: {stateDir}/.state/nocturnal/training-registry.json
10
- * - Three record types in one store: TrainingRun, Checkpoint, EvalSummary
11
- * - File locking on all write operations
12
- * - Family alignment enforced at every transition
13
- *
14
- * LINEAGE CHAIN (enforced):
15
- * TrainingRun → Checkpoint → EvalSummary
16
- * DatasetFingerprint → TrainingRun → Checkpoint → EvalSummary
17
- *
18
- * DEPLOYABILITY RULE:
19
- * A Checkpoint can only be marked deployable if:
20
- * 1. It has an attached EvalSummary
21
- * 2. The EvalSummary has a verdict of 'pass' or 'compare_only' (not 'fail')
22
- * 3. The EvalSummary's targetModelFamily matches the Checkpoint's targetModelFamily
23
- * 4. The Checkpoint's trainRun is in 'completed' status
24
- *
25
- * DESIGN CONSTRAINTS:
26
- * - No real training invocation (Phase 4 only)
27
- * - No checkpoint deploy routing (Phase 5)
28
- * - No automatic promotion
29
- * - Registry is append-only for runs and checkpoints
30
- * - EvalSummary attachment is the only mutable operation on a Checkpoint
31
- */
32
- import * as fs from 'fs';
33
- import * as path from 'path';
34
- import * as crypto from 'crypto';
35
- import { withLock } from '../utils/file-lock.js';
36
- import { atomicWriteFileSync } from '../utils/io.js';
37
- // ---------------------------------------------------------------------------
38
- // Constants
39
- // ---------------------------------------------------------------------------
40
- const REGISTRY_FILE = '.state/nocturnal/training-registry.json';
41
- // ---------------------------------------------------------------------------
42
- // Registry Path
43
- // ---------------------------------------------------------------------------
44
- function getRegistryPath(stateDir) {
45
- return path.join(stateDir, REGISTRY_FILE);
46
- }
47
- /**
48
- * Ensure the registry directory exists.
49
- */
50
- function ensureRegistryDir(stateDir) {
51
- const registryPath = getRegistryPath(stateDir);
52
- const dir = path.dirname(registryPath);
53
- if (!fs.existsSync(dir)) {
54
- fs.mkdirSync(dir, { recursive: true });
55
- }
56
- }
57
- // ---------------------------------------------------------------------------
58
- // File Operations
59
- // ---------------------------------------------------------------------------
60
- /**
61
- * Read the registry from disk. Returns empty registry if missing.
62
- */
63
- function readRegistry(stateDir) {
64
- const registryPath = getRegistryPath(stateDir);
65
- if (!fs.existsSync(registryPath)) {
66
- return { trainingRuns: [], checkpoints: [], evalSummaries: [] };
67
- }
68
- try {
69
- const content = fs.readFileSync(registryPath, 'utf-8');
70
- return JSON.parse(content);
71
- }
72
- catch (err) {
73
- console.warn(`[model-training-registry] Registry corrupted at ${registryPath}, recovering with empty state: ${String(err)}`);
74
- return { trainingRuns: [], checkpoints: [], evalSummaries: [] };
75
- }
76
- }
77
- /**
78
- * Write the registry to disk atomically.
79
- * Caller must hold the registry lock.
80
- */
81
- function writeRegistry(stateDir, registry) {
82
- ensureRegistryDir(stateDir);
83
- const registryPath = getRegistryPath(stateDir);
84
- atomicWriteFileSync(registryPath, JSON.stringify(registry, null, 2));
85
- }
86
- /**
87
- * Execute a read-modify-write under an exclusive file lock.
88
- */
89
- function withRegistryLock(stateDir, fn) {
90
- const registryPath = getRegistryPath(stateDir);
91
- return withLock(registryPath, () => {
92
- const registry = readRegistry(stateDir);
93
- return fn(registry);
94
- });
95
- }
96
- // ---------------------------------------------------------------------------
97
- // Training Run Operations
98
- // ---------------------------------------------------------------------------
99
- /**
100
- * Valid training run status transitions.
101
- * pending → running → completed | failed
102
- * (no backward transitions)
103
- */
104
- const VALID_RUN_TRANSITIONS = {
105
- pending: ['running'],
106
- running: ['completed', 'failed'],
107
- completed: [], // terminal
108
- failed: [], // terminal
109
- };
110
- /**
111
- * Register a new training run.
112
- *
113
- * @param stateDir - Workspace state directory
114
- * @param params - Run parameters
115
- * @returns The registered TrainingRun
116
- */
117
- export function registerTrainingRun(stateDir, params) {
118
- return withRegistryLock(stateDir, (registry) => {
119
- const now = new Date().toISOString();
120
- const trainRunId = crypto.randomUUID();
121
- const run = {
122
- trainRunId,
123
- experimentId: params.experimentId,
124
- targetModelFamily: params.targetModelFamily,
125
- datasetFingerprint: params.datasetFingerprint,
126
- exportId: params.exportId,
127
- sampleCount: params.sampleCount,
128
- configFingerprint: params.configFingerprint,
129
- createdAt: now,
130
- status: 'pending',
131
- checkpointIds: [],
132
- };
133
- registry.trainingRuns.push(run);
134
- writeRegistry(stateDir, registry);
135
- return run;
136
- });
137
- }
138
- /**
139
- * Update a training run's status.
140
- *
141
- * @throws Error if run not found or transition is invalid
142
- */
143
- export function updateTrainingRunStatus(stateDir, trainRunId, newStatus, failureReason) {
144
- return withRegistryLock(stateDir, (registry) => {
145
- const idx = registry.trainingRuns.findIndex((r) => r.trainRunId === trainRunId);
146
- if (idx === -1) {
147
- throw new Error(`Training run not found: ${trainRunId}`);
148
- }
149
- const run = registry.trainingRuns[idx];
150
- const allowed = VALID_RUN_TRANSITIONS[run.status];
151
- if (!allowed.includes(newStatus)) {
152
- throw new Error(`Invalid status transition for training run ${trainRunId}: ${run.status} → ${newStatus}. ` +
153
- `Allowed transitions from ${run.status}: ${allowed.join(', ') || 'none'}`);
154
- }
155
- registry.trainingRuns[idx] = {
156
- ...run,
157
- status: newStatus,
158
- completedAt: newStatus === 'completed' || newStatus === 'failed'
159
- ? new Date().toISOString()
160
- : undefined,
161
- failureReason: newStatus === 'failed' ? failureReason : undefined,
162
- };
163
- writeRegistry(stateDir, registry);
164
- return registry.trainingRuns[idx];
165
- });
166
- }
167
- /**
168
- * Complete a training run (convenience wrapper).
169
- */
170
- export function completeTrainingRun(stateDir, trainRunId) {
171
- return updateTrainingRunStatus(stateDir, trainRunId, 'completed');
172
- }
173
- /**
174
- * Fail a training run (convenience wrapper).
175
- */
176
- export function failTrainingRun(stateDir, trainRunId, reason) {
177
- return updateTrainingRunStatus(stateDir, trainRunId, 'failed', reason);
178
- }
179
- /**
180
- * Start a training run (convenience wrapper).
181
- */
182
- export function startTrainingRun(stateDir, trainRunId) {
183
- return updateTrainingRunStatus(stateDir, trainRunId, 'running');
184
- }
185
- /**
186
- * Get a training run by ID.
187
- */
188
- export function getTrainingRun(stateDir, trainRunId) {
189
- const registry = readRegistry(stateDir);
190
- return registry.trainingRuns.find((r) => r.trainRunId === trainRunId) ?? null;
191
- }
192
- /**
193
- * List all training runs, optionally filtered by status or family.
194
- */
195
- export function listTrainingRuns(stateDir, filter) {
196
- const registry = readRegistry(stateDir);
197
- let runs = registry.trainingRuns;
198
- if (filter?.status) {
199
- runs = runs.filter((r) => r.status === filter.status);
200
- }
201
- if (filter?.targetModelFamily) {
202
- runs = runs.filter((r) => r.targetModelFamily === filter.targetModelFamily);
203
- }
204
- return runs.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
205
- }
206
- // ---------------------------------------------------------------------------
207
- // Checkpoint Operations
208
- // ---------------------------------------------------------------------------
209
- /**
210
- * Register a checkpoint produced by a training run.
211
- *
212
- * @throws Error if the training run is not found
213
- * @throws Error if the targetModelFamily does not match the run's family
214
- */
215
- export function registerCheckpoint(stateDir, params) {
216
- return withRegistryLock(stateDir, (registry) => {
217
- // Verify the training run exists
218
- const run = registry.trainingRuns.find((r) => r.trainRunId === params.trainRunId);
219
- if (!run) {
220
- throw new Error(`Training run not found: ${params.trainRunId}`);
221
- }
222
- // Verify family alignment
223
- if (run.targetModelFamily !== params.targetModelFamily) {
224
- throw new Error(`Target model family mismatch: checkpoint family "${params.targetModelFamily}" ` +
225
- `does not match training run family "${run.targetModelFamily}"`);
226
- }
227
- const now = new Date().toISOString();
228
- const checkpointId = crypto.randomUUID();
229
- const checkpoint = {
230
- checkpointId,
231
- trainRunId: params.trainRunId,
232
- targetModelFamily: params.targetModelFamily,
233
- artifactPath: params.artifactPath,
234
- createdAt: now,
235
- deployable: false, // Always starts as false
236
- };
237
- registry.checkpoints.push(checkpoint);
238
- // Update the training run's checkpoint IDs
239
- const runIdx = registry.trainingRuns.findIndex((r) => r.trainRunId === params.trainRunId);
240
- registry.trainingRuns[runIdx] = {
241
- ...run,
242
- checkpointIds: [...run.checkpointIds, checkpointId],
243
- };
244
- writeRegistry(stateDir, registry);
245
- return checkpoint;
246
- });
247
- }
248
- /**
249
- * Get a checkpoint by ID.
250
- */
251
- export function getCheckpoint(stateDir, checkpointId) {
252
- const registry = readRegistry(stateDir);
253
- return registry.checkpoints.find((c) => c.checkpointId === checkpointId) ?? null;
254
- }
255
- /**
256
- * List all checkpoints, optionally filtered.
257
- */
258
- export function listCheckpoints(stateDir, filter) {
259
- const registry = readRegistry(stateDir);
260
- let { checkpoints } = registry;
261
- if (filter?.trainRunId) {
262
- checkpoints = checkpoints.filter((c) => c.trainRunId === filter.trainRunId);
263
- }
264
- if (filter?.targetModelFamily) {
265
- checkpoints = checkpoints.filter((c) => c.targetModelFamily === filter.targetModelFamily);
266
- }
267
- if (filter?.deployable !== undefined) {
268
- checkpoints = checkpoints.filter((c) => c.deployable === filter.deployable);
269
- }
270
- return checkpoints.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
271
- }
272
- /**
273
- * List all deployable checkpoints for a target model family.
274
- */
275
- export function listDeployableCheckpoints(stateDir, targetModelFamily) {
276
- return listCheckpoints(stateDir, {
277
- targetModelFamily,
278
- deployable: true,
279
- });
280
- }
281
- // ---------------------------------------------------------------------------
282
- // Eval Summary Operations
283
- // ---------------------------------------------------------------------------
284
- /**
285
- * Attach an eval summary to a checkpoint.
286
- *
287
- * @param stateDir - Workspace state directory
288
- * @param checkpointId - The checkpoint to attach to
289
- * @param summary - The eval summary to attach
290
- *
291
- * @throws Error if checkpoint not found
292
- * @throws Error if targetModelFamily mismatch between summary and checkpoint
293
- */
294
- export function attachEvalSummary(stateDir, checkpointId, summary) {
295
- return withRegistryLock(stateDir, (registry) => {
296
- const checkpointIdx = registry.checkpoints.findIndex((c) => c.checkpointId === checkpointId);
297
- if (checkpointIdx === -1) {
298
- throw new Error(`Checkpoint not found: ${checkpointId}`);
299
- }
300
- const checkpoint = registry.checkpoints[checkpointIdx];
301
- // FAMILY ALIGNMENT — enforced fail-closed:
302
- // An eval for a gpt-4 checkpoint cannot be attached to a claude-3 checkpoint
303
- // (and vice versa), even if the eval verdict is 'pass'.
304
- if (summary.targetModelFamily !== checkpoint.targetModelFamily) {
305
- throw new Error(`Family mismatch: eval targets "${summary.targetModelFamily}" ` +
306
- `but checkpoint "${checkpointId}" is "${checkpoint.targetModelFamily}". ` +
307
- `EvalSummary.targetModelFamily must match the checkpoint's targetModelFamily.`);
308
- }
309
- const evalSummary = {
310
- ...summary,
311
- createdAt: new Date().toISOString(),
312
- };
313
- registry.evalSummaries.push(evalSummary);
314
- // Update the checkpoint's lastEvalSummaryRef
315
- registry.checkpoints[checkpointIdx] = {
316
- ...checkpoint,
317
- lastEvalSummaryRef: evalSummary.evalId,
318
- };
319
- writeRegistry(stateDir, registry);
320
- return evalSummary;
321
- });
322
- }
323
- /**
324
- * Get an eval summary by ID.
325
- */
326
- export function getEvalSummary(stateDir, evalId) {
327
- const registry = readRegistry(stateDir);
328
- return registry.evalSummaries.find((e) => e.evalId === evalId) ?? null;
329
- }
330
- /**
331
- * List eval summaries, optionally filtered.
332
- */
333
- export function listEvalSummaries(stateDir, filter) {
334
- const registry = readRegistry(stateDir);
335
- let evals = registry.evalSummaries;
336
- if (filter?.checkpointId) {
337
- evals = evals.filter((e) => e.checkpointId === filter.checkpointId);
338
- }
339
- if (filter?.benchmarkId) {
340
- evals = evals.filter((e) => e.benchmarkId === filter.benchmarkId);
341
- }
342
- if (filter?.verdict) {
343
- evals = evals.filter((e) => e.verdict === filter.verdict);
344
- }
345
- if (filter?.targetModelFamily) {
346
- evals = evals.filter((e) => e.targetModelFamily === filter.targetModelFamily);
347
- }
348
- return evals.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
349
- }
350
- // ---------------------------------------------------------------------------
351
- // Deployability — Core Gating Logic
352
- // ---------------------------------------------------------------------------
353
- /**
354
- * MARK the deployability status of a checkpoint.
355
- *
356
- * DEPLOYABILITY RULE (fail-closed):
357
- * A checkpoint can only be marked deployable if ALL of:
358
- * 1. It has an attached EvalSummary (lastEvalSummaryRef is set)
359
- * 2. The attached EvalSummary has verdict 'pass' or 'compare_only' (not 'fail')
360
- * 3. The EvalSummary's targetModelFamily matches the Checkpoint's targetModelFamily
361
- * NOTE: This is enforced at attachEvalSummary() time (see attachEvalSummary).
362
- * If a mismatched-family eval is attached, attachEvalSummary throws before
363
- * the registry is modified, so no eval with wrong family can ever reach here.
364
- * 4. The parent TrainingRun is in 'completed' status
365
- *
366
- * @param stateDir - Workspace state directory
367
- * @param checkpointId - The checkpoint to mark
368
- * @param deployable - true to mark as deployable; false to revoke
369
- *
370
- * @throws Error if checkpoint not found
371
- * @throws Error if preconditions for deployable=true are not met
372
- */
373
- export function markCheckpointDeployable(stateDir, checkpointId, deployable) {
374
- return withRegistryLock(stateDir, (registry) => {
375
- const idx = registry.checkpoints.findIndex((c) => c.checkpointId === checkpointId);
376
- if (idx === -1) {
377
- throw new Error(`Checkpoint not found: ${checkpointId}`);
378
- }
379
- const checkpoint = registry.checkpoints[idx];
380
- if (deployable) {
381
- // FAIL-CLOSED: Verify all preconditions
382
- // 1. Must have an attached eval summary
383
- if (!checkpoint.lastEvalSummaryRef) {
384
- throw new Error(`Cannot mark checkpoint ${checkpointId} as deployable: ` +
385
- `no eval summary attached. Attach an EvalSummary first.`);
386
- }
387
- // 2. Find the eval summary
388
- const evalSummary = registry.evalSummaries.find((e) => e.evalId === checkpoint.lastEvalSummaryRef);
389
- if (!evalSummary) {
390
- throw new Error(`Cannot mark checkpoint ${checkpointId} as deployable: ` +
391
- `eval summary "${checkpoint.lastEvalSummaryRef}" not found`);
392
- }
393
- // 3. Verdict must be 'pass' or 'compare_only' (not 'fail')
394
- if (evalSummary.verdict === 'fail') {
395
- throw new Error(`Cannot mark checkpoint ${checkpointId} as deployable: ` +
396
- `eval verdict is '${evalSummary.verdict}' (evalId: ${evalSummary.evalId}). ` +
397
- `Only 'pass' or 'compare_only' verdicts allow deployment.`);
398
- }
399
- // 4. Parent training run must be completed
400
- const run = registry.trainingRuns.find((r) => r.trainRunId === checkpoint.trainRunId);
401
- if (!run) {
402
- throw new Error(`Cannot mark checkpoint ${checkpointId} as deployable: ` +
403
- `parent training run "${checkpoint.trainRunId}" not found`);
404
- }
405
- if (run.status !== 'completed') {
406
- throw new Error(`Cannot mark checkpoint ${checkpointId} as deployable: ` +
407
- `parent training run is in '${run.status}' status (must be 'completed')`);
408
- }
409
- }
410
- // Apply the update (both marking deployable and revoking deployability)
411
- registry.checkpoints[idx] = {
412
- ...checkpoint,
413
- deployable,
414
- // If revoking deployability, also clear the eval ref
415
- lastEvalSummaryRef: deployable ? checkpoint.lastEvalSummaryRef : undefined,
416
- };
417
- writeRegistry(stateDir, registry);
418
- return registry.checkpoints[idx];
419
- });
420
- }
421
- /**
422
- * Convenience: check if a checkpoint is deployable.
423
- */
424
- export function isCheckpointDeployable(stateDir, checkpointId) {
425
- const checkpoint = getCheckpoint(stateDir, checkpointId);
426
- return checkpoint?.deployable ?? false;
427
- }
428
- // ---------------------------------------------------------------------------
429
- // Registry-Level Queries
430
- // ---------------------------------------------------------------------------
431
- /**
432
- * Get the full lineage chain for a checkpoint.
433
- * Returns: { run, checkpoint, eval? } or null if not found.
434
- */
435
- export function getCheckpointLineage(stateDir, checkpointId) {
436
- const registry = readRegistry(stateDir);
437
- const checkpoint = registry.checkpoints.find((c) => c.checkpointId === checkpointId);
438
- if (!checkpoint)
439
- return null;
440
- const run = registry.trainingRuns.find((r) => r.trainRunId === checkpoint.trainRunId);
441
- if (!run)
442
- return null;
443
- const eval_ = checkpoint.lastEvalSummaryRef
444
- ? registry.evalSummaries.find((e) => e.evalId === checkpoint.lastEvalSummaryRef) ?? null
445
- : null;
446
- return { run, checkpoint, eval: eval_ ?? null };
447
- }
448
- /**
449
- * Get the complete registry (for debugging/admin purposes).
450
- */
451
- export function getFullRegistry(stateDir) {
452
- return readRegistry(stateDir);
453
- }
454
- /**
455
- * Compute stats for the training registry.
456
- */
457
- export function getTrainingRegistryStats(stateDir) {
458
- const registry = readRegistry(stateDir);
459
- const runs = registry.trainingRuns;
460
- const { checkpoints } = registry;
461
- const evals = registry.evalSummaries;
462
- return {
463
- totalRuns: runs.length,
464
- completedRuns: runs.filter((r) => r.status === 'completed').length,
465
- failedRuns: runs.filter((r) => r.status === 'failed').length,
466
- pendingRuns: runs.filter((r) => r.status === 'pending').length,
467
- runningRuns: runs.filter((r) => r.status === 'running').length,
468
- totalCheckpoints: checkpoints.length,
469
- deployableCheckpoints: checkpoints.filter((c) => c.deployable).length,
470
- totalEvals: evals.length,
471
- passingEvals: evals.filter((e) => e.verdict === 'pass' || e.verdict === 'compare_only').length,
472
- failingEvals: evals.filter((e) => e.verdict === 'fail').length,
473
- };
474
- }