@a-company/paradigm 5.3.3 → 5.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.
@@ -318,6 +318,139 @@ async function agentSyncCommand(id, options = {}) {
318
318
  }
319
319
  tracker.success(`Synced ${symbolsUpdated.size} symbols from ${entriesProcessed} entries`);
320
320
  }
321
+ async function agentRosterCommand(options = {}) {
322
+ const cwd = process.cwd();
323
+ const tracker = log.command("agent-roster").start("Agent roster", { cwd });
324
+ const profiles = [];
325
+ if (fs.existsSync(GLOBAL_AGENTS_DIR)) {
326
+ for (const file of fs.readdirSync(GLOBAL_AGENTS_DIR).filter((f) => f.endsWith(AGENT_EXT))) {
327
+ try {
328
+ const p = yaml.load(fs.readFileSync(path.join(GLOBAL_AGENTS_DIR, file), "utf-8"));
329
+ if (p?.id) profiles.push(p);
330
+ } catch {
331
+ }
332
+ }
333
+ }
334
+ const projectDir = path.join(cwd, PROJECT_AGENTS_DIR);
335
+ if (fs.existsSync(projectDir)) {
336
+ for (const file of fs.readdirSync(projectDir).filter((f) => f.endsWith(AGENT_EXT))) {
337
+ try {
338
+ const p = yaml.load(fs.readFileSync(path.join(projectDir, file), "utf-8"));
339
+ if (p?.id) {
340
+ const idx = profiles.findIndex((e) => e.id === p.id);
341
+ if (idx >= 0) profiles[idx] = p;
342
+ else profiles.push(p);
343
+ }
344
+ } catch {
345
+ }
346
+ }
347
+ }
348
+ const active = profiles.filter((p) => !p.benched);
349
+ const benched = profiles.filter((p) => p.benched);
350
+ if (options.json) {
351
+ console.log(JSON.stringify({
352
+ active: active.map(rosterSummarize),
353
+ benched: benched.map(rosterSummarize)
354
+ }, null, 2));
355
+ tracker.success(`${active.length} active, ${benched.length} benched`);
356
+ return;
357
+ }
358
+ console.log(chalk.blue("\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
359
+ console.log(chalk.blue("\u2502") + chalk.white.bold(" Agent Roster ") + chalk.blue("\u2502"));
360
+ console.log(chalk.blue("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"));
361
+ if (active.length > 0) {
362
+ console.log(chalk.green.bold(" Active"));
363
+ for (const p of active) {
364
+ printRosterRow(p);
365
+ }
366
+ }
367
+ if (benched.length > 0) {
368
+ console.log(chalk.gray.bold("\n Benched"));
369
+ for (const p of benched) {
370
+ printRosterRow(p, true);
371
+ }
372
+ }
373
+ if (profiles.length === 0) {
374
+ console.log(chalk.yellow(" No agents found.\n"));
375
+ } else {
376
+ console.log("");
377
+ }
378
+ tracker.success(`${active.length} active, ${benched.length} benched`);
379
+ }
380
+ function printRosterRow(p, dimmed = false) {
381
+ const expertise = (p.expertise || []).sort((a, b) => b.confidence - a.confidence);
382
+ const topSymbol = expertise[0] ? `${expertise[0].symbol} (${(expertise[0].confidence * 100).toFixed(0)}%)` : chalk.gray("\u2014");
383
+ const color = dimmed ? chalk.gray : chalk.white;
384
+ const nickname = p.nickname ? ` (${p.nickname})` : "";
385
+ const threshold = p.attention?.threshold;
386
+ const thresholdStr = threshold != null ? ` | thr: ${threshold.toFixed(2)}` : "";
387
+ console.log(` ${color.bold(p.id)}${chalk.gray(nickname)} \u2014 ${chalk.gray(p.role)}`);
388
+ console.log(` Top: ${topSymbol} | ${expertise.length} symbols${thresholdStr}`);
389
+ }
390
+ function rosterSummarize(p) {
391
+ const expertise = (p.expertise || []).sort((a, b) => b.confidence - a.confidence);
392
+ return {
393
+ id: p.id,
394
+ role: p.role,
395
+ nickname: p.nickname,
396
+ benched: p.benched || false,
397
+ expertiseCount: expertise.length,
398
+ topExpertise: expertise.slice(0, 3).map((e) => ({
399
+ symbol: e.symbol,
400
+ confidence: parseFloat(e.confidence.toFixed(2))
401
+ })),
402
+ threshold: p.attention?.threshold
403
+ };
404
+ }
405
+ async function agentBenchCommand(id) {
406
+ const cwd = process.cwd();
407
+ const tracker = log.command("agent-bench").start(`Benching agent ${id}`, { cwd });
408
+ const profile = loadProfile(cwd, id);
409
+ if (!profile) {
410
+ console.log(chalk.red(`
411
+ Agent "${id}" not found.
412
+ `));
413
+ tracker.error("Not found");
414
+ return;
415
+ }
416
+ profile.benched = true;
417
+ profile.updated = (/* @__PURE__ */ new Date()).toISOString();
418
+ saveProfile(cwd, id, profile);
419
+ console.log(chalk.yellow(`
420
+ \u23F8 Agent "${id}" is now benched.`));
421
+ console.log(chalk.gray(" Maestro will skip this agent during orchestration.\n"));
422
+ tracker.success(`Benched ${id}`);
423
+ }
424
+ async function agentActivateCommand(id) {
425
+ const cwd = process.cwd();
426
+ const tracker = log.command("agent-activate").start(`Activating agent ${id}`, { cwd });
427
+ const profile = loadProfile(cwd, id);
428
+ if (!profile) {
429
+ console.log(chalk.red(`
430
+ Agent "${id}" not found.
431
+ `));
432
+ tracker.error("Not found");
433
+ return;
434
+ }
435
+ profile.benched = false;
436
+ profile.updated = (/* @__PURE__ */ new Date()).toISOString();
437
+ saveProfile(cwd, id, profile);
438
+ console.log(chalk.green(`
439
+ \u25B6 Agent "${id}" is now active.`));
440
+ console.log(chalk.gray(" Maestro will include this agent in orchestration.\n"));
441
+ tracker.success(`Activated ${id}`);
442
+ }
443
+ function saveProfile(rootDir, id, profile) {
444
+ const projectPath = path.join(rootDir, PROJECT_AGENTS_DIR, `${id}${AGENT_EXT}`);
445
+ if (fs.existsSync(projectPath)) {
446
+ fs.writeFileSync(projectPath, yaml.dump(profile, { lineWidth: 120, noRefs: true, sortKeys: false }), "utf-8");
447
+ return;
448
+ }
449
+ const globalPath = path.join(GLOBAL_AGENTS_DIR, `${id}${AGENT_EXT}`);
450
+ const dir = GLOBAL_AGENTS_DIR;
451
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
452
+ fs.writeFileSync(globalPath, yaml.dump(profile, { lineWidth: 120, noRefs: true, sortKeys: false }), "utf-8");
453
+ }
321
454
  function loadProfile(rootDir, id) {
322
455
  const projectPath = path.join(rootDir, PROJECT_AGENTS_DIR, `${id}${AGENT_EXT}`);
323
456
  if (fs.existsSync(projectPath)) {
@@ -380,8 +513,11 @@ function scanLoreDir(lorePath) {
380
513
  return entries;
381
514
  }
382
515
  export {
516
+ agentActivateCommand,
517
+ agentBenchCommand,
383
518
  agentCreateCommand,
384
519
  agentListCommand,
520
+ agentRosterCommand,
385
521
  agentShowCommand,
386
522
  agentSyncCommand
387
523
  };
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- init_lore_loader,
4
- loadLoreEntries,
5
- loadLoreEntry
6
- } from "./chunk-5VKJBNJL.js";
7
2
  import {
8
3
  checkComponentAnchors,
9
4
  checkIntegrity,
10
5
  checkPurposeHealth
11
6
  } from "./chunk-L27I3CPZ.js";
7
+ import {
8
+ init_lore_loader,
9
+ loadLoreEntries,
10
+ loadLoreEntry
11
+ } from "./chunk-5VKJBNJL.js";
12
12
  import {
13
13
  __esm,
14
14
  __export,
@@ -3223,7 +3223,7 @@ async function buildRecoveryPreamble(rootDir) {
3223
3223
  } catch {
3224
3224
  }
3225
3225
  try {
3226
- const { loadNominations } = await import("./nomination-engine-Q4XSXFKT.js");
3226
+ const { loadNominations } = await import("./nomination-engine-HDWMN4IO.js");
3227
3227
  const urgent = loadNominations(rootDir, { pending_only: true }).filter((n) => n.urgency === "critical" || n.urgency === "high");
3228
3228
  if (urgent.length > 0) {
3229
3229
  lines.push("");
@@ -493,6 +493,7 @@ function processEvent(rootDir, event) {
493
493
  const scores = [];
494
494
  for (const profile of profiles) {
495
495
  if (!profile.attention) continue;
496
+ if (profile.benched) continue;
496
497
  if (event.path && !canObservePath(policy, event.path, profile.id)) {
497
498
  continue;
498
499
  }
@@ -896,6 +897,57 @@ function getNominationStats(rootDir, agentId) {
896
897
  acceptRate: engaged > 0 ? accepted / engaged : 0
897
898
  };
898
899
  }
900
+ function getNeverlandMetrics(rootDir) {
901
+ const profiles = loadAllAgentProfiles(rootDir);
902
+ const agentMetrics = profiles.filter((p) => !p.benched).map((p) => {
903
+ const stats = getNominationStats(rootDir, p.id);
904
+ let notebookCount = 0;
905
+ try {
906
+ const nbDir = path4.join(os2.homedir(), ".paradigm", "notebooks", p.id);
907
+ if (fs4.existsSync(nbDir)) {
908
+ notebookCount = fs4.readdirSync(nbDir).filter((f) => f.endsWith(".yaml")).length;
909
+ }
910
+ } catch {
911
+ }
912
+ return {
913
+ id: p.id,
914
+ acceptRate: stats.acceptRate,
915
+ threshold: p.attention?.threshold ?? 0.5,
916
+ expertiseCount: (p.expertise || []).length,
917
+ notebookCount,
918
+ transferableCount: (p.transferable || []).length,
919
+ totalNominations: stats.total
920
+ };
921
+ });
922
+ const count = agentMetrics.length || 1;
923
+ const avgAcceptRate = agentMetrics.reduce((s, a) => s + a.acceptRate, 0) / count;
924
+ const avgThreshold = agentMetrics.reduce((s, a) => s + a.threshold, 0) / count;
925
+ const totalExpertise = agentMetrics.reduce((s, a) => s + a.expertiseCount, 0);
926
+ const totalNotebooks = agentMetrics.reduce((s, a) => s + a.notebookCount, 0);
927
+ const totalTransferable = agentMetrics.reduce((s, a) => s + a.transferableCount, 0);
928
+ const totalNominations = agentMetrics.reduce((s, a) => s + a.totalNominations, 0);
929
+ let healthStatus;
930
+ if (totalNominations < 10) {
931
+ healthStatus = "cold-start";
932
+ } else if (avgAcceptRate < 0.5) {
933
+ healthStatus = "accumulating";
934
+ } else if (avgAcceptRate < 0.7) {
935
+ healthStatus = "calibrating";
936
+ } else {
937
+ healthStatus = "mature";
938
+ }
939
+ return {
940
+ agents: agentMetrics,
941
+ aggregate: {
942
+ avgAcceptRate,
943
+ avgThreshold,
944
+ totalExpertise,
945
+ totalNotebooks,
946
+ totalTransferable
947
+ },
948
+ healthStatus
949
+ };
950
+ }
899
951
  function forwardNominationsToRelay(rootDir, nominations) {
900
952
  if (nominations.length === 0) return;
901
953
  const outboxDir = path4.join(os2.homedir(), ".paradigm", "score", "outbox");
@@ -1067,6 +1119,7 @@ export {
1067
1119
  emitAndProcess,
1068
1120
  adjustAttentionFromFeedback,
1069
1121
  getNominationStats,
1122
+ getNeverlandMetrics,
1070
1123
  forwardNominationsToRelay,
1071
1124
  autoPromoteJournalEntries,
1072
1125
  loadSurfacingConfig,
@@ -17,7 +17,7 @@ async function docsServeCommand(options) {
17
17
  const shouldOpen = options.open !== false;
18
18
  console.log(chalk.cyan("\n Starting Paradigm Docs...\n"));
19
19
  try {
20
- const { startPlatformServer } = await import("./platform-server-PMD57BEG.js");
20
+ const { startPlatformServer } = await import("./platform-server-2D6S6YTK.js");
21
21
  await startPlatformServer({
22
22
  projectDir,
23
23
  port,
package/dist/index.js CHANGED
@@ -719,7 +719,7 @@ loreCmd.option("-p, --port <port>", "Port to run on", "3840").option("--no-open"
719
719
  await loreServeCommand(void 0, options);
720
720
  });
721
721
  program.command("serve").description("Launch Paradigm Platform \u2014 unified development management UI").option("-p, --port <port>", "Port to run on", "3850").option("--no-open", "Don't open browser automatically").option("--sections <list>", "Comma-separated sections to enable (e.g., lore,graph,git)").action(async (options) => {
722
- const { serveCommand } = await import("./serve-FLTFTM3P.js");
722
+ const { serveCommand } = await import("./serve-EFVRS4GA.js");
723
723
  await serveCommand(options);
724
724
  });
725
725
  var graphCmd = program.command("graph").description("Interactive symbol relationship graph").argument("[path]", "Project directory", void 0).option("-p, --port <port>", "Port to run on", "3841").option("--no-open", "Don't open browser automatically").action(async (path2, options) => {
@@ -857,15 +857,15 @@ universityCmd.option("-p, --port <port>", "Port to run on", "3839").option("--no
857
857
  });
858
858
  var docsCmd = program.command("docs").description("Auto-generated documentation from the symbol graph");
859
859
  docsCmd.command("serve").description("Launch interactive docs viewer in browser").option("-p, --port <port>", "Port number (default: 3850)").option("--no-open", "Do not open browser automatically").action(async (options) => {
860
- const { docsServeCommand } = await import("./docs-LVLRPBAW.js");
860
+ const { docsServeCommand } = await import("./docs-J2BTKRVU.js");
861
861
  await docsServeCommand(options);
862
862
  });
863
863
  docsCmd.command("build").description("Build static documentation site").option("-o, --output <dir>", "Output directory (default: from config or .paradigm/docs-site)").action(async (options) => {
864
- const { docsBuildCommand } = await import("./docs-LVLRPBAW.js");
864
+ const { docsBuildCommand } = await import("./docs-J2BTKRVU.js");
865
865
  await docsBuildCommand(options);
866
866
  });
867
867
  docsCmd.action(async () => {
868
- const { docsServeCommand } = await import("./docs-LVLRPBAW.js");
868
+ const { docsServeCommand } = await import("./docs-J2BTKRVU.js");
869
869
  await docsServeCommand({});
870
870
  });
871
871
  var pipelineCmd = program.command("pipeline").description("Spec pipeline \u2014 structured feature workflow with configurable gates");
@@ -1006,23 +1006,35 @@ notebookCmd.action(async () => {
1006
1006
  });
1007
1007
  var agentCmd = program.command("agent").description("Agent identity management \u2014 persistent profiles with expertise tracking");
1008
1008
  agentCmd.command("list").alias("ls").description("List all agent identity profiles").option("--json", "Output as JSON").option("--global", "Show only global profiles").option("--project", "Show only project-level profiles").action(async (options) => {
1009
- const { agentListCommand } = await import("./agent-HYKC2LAK.js");
1009
+ const { agentListCommand } = await import("./agent-WERIO2XV.js");
1010
1010
  await agentListCommand(options);
1011
1011
  });
1012
1012
  agentCmd.command("show <id>").description("Show full agent profile with expertise table").option("--json", "Output as JSON").action(async (id, options) => {
1013
- const { agentShowCommand } = await import("./agent-HYKC2LAK.js");
1013
+ const { agentShowCommand } = await import("./agent-WERIO2XV.js");
1014
1014
  await agentShowCommand(id, options);
1015
1015
  });
1016
1016
  agentCmd.command("create <id>").description("Create a new .agent identity file").option("-r, --role <role>", "Agent role description").option("-d, --description <desc>", "Extended description").option("-g, --global", "Create in global ~/.paradigm/agents/ (default)").option("--deny-paths <patterns>", 'Comma-separated glob patterns to deny (e.g., ".env*,*.key")').action(async (id, options) => {
1017
- const { agentCreateCommand } = await import("./agent-HYKC2LAK.js");
1017
+ const { agentCreateCommand } = await import("./agent-WERIO2XV.js");
1018
1018
  await agentCreateCommand(id, { ...options, global: options.global !== false });
1019
1019
  });
1020
1020
  agentCmd.command("sync <id>").description("Bootstrap expertise from existing project lore").option("-n, --dry-run", "Show what would change without writing").option("--json", "Output as JSON").action(async (id, options) => {
1021
- const { agentSyncCommand } = await import("./agent-HYKC2LAK.js");
1021
+ const { agentSyncCommand } = await import("./agent-WERIO2XV.js");
1022
1022
  await agentSyncCommand(id, options);
1023
1023
  });
1024
+ agentCmd.command("roster").description("Show agent roster with active/benched status").option("--json", "Output as JSON").action(async (options) => {
1025
+ const { agentRosterCommand } = await import("./agent-WERIO2XV.js");
1026
+ await agentRosterCommand(options);
1027
+ });
1028
+ agentCmd.command("bench <id>").description("Bench an agent \u2014 Maestro will skip it during orchestration").action(async (id) => {
1029
+ const { agentBenchCommand } = await import("./agent-WERIO2XV.js");
1030
+ await agentBenchCommand(id);
1031
+ });
1032
+ agentCmd.command("activate <id>").description("Activate a benched agent \u2014 restore to Maestro orchestration").action(async (id) => {
1033
+ const { agentActivateCommand } = await import("./agent-WERIO2XV.js");
1034
+ await agentActivateCommand(id);
1035
+ });
1024
1036
  agentCmd.action(async () => {
1025
- const { agentListCommand } = await import("./agent-HYKC2LAK.js");
1037
+ const { agentListCommand } = await import("./agent-WERIO2XV.js");
1026
1038
  await agentListCommand({});
1027
1039
  });
1028
1040
  program.parse();