@llm-dev-ops/agentics-cli 2.7.35 → 2.7.37

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 (61) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/commands/agents.d.ts.map +1 -1
  4. package/dist/commands/agents.js +24 -70
  5. package/dist/commands/agents.js.map +1 -1
  6. package/dist/mcp/agent-event-parser.d.ts +1 -11
  7. package/dist/mcp/agent-event-parser.d.ts.map +1 -1
  8. package/dist/mcp/agent-event-parser.js +7 -140
  9. package/dist/mcp/agent-event-parser.js.map +1 -1
  10. package/dist/mcp/mcp-server.js +0 -58
  11. package/dist/mcp/mcp-server.js.map +1 -1
  12. package/dist/pipeline/auto-chain.d.ts.map +1 -1
  13. package/dist/pipeline/auto-chain.js +27 -93
  14. package/dist/pipeline/auto-chain.js.map +1 -1
  15. package/dist/pipeline/local-fallback/phase5a-local-fallback.d.ts +21 -18
  16. package/dist/pipeline/local-fallback/phase5a-local-fallback.d.ts.map +1 -1
  17. package/dist/pipeline/local-fallback/phase5a-local-fallback.js +92 -397
  18. package/dist/pipeline/local-fallback/phase5a-local-fallback.js.map +1 -1
  19. package/dist/pipeline/phase2/phases/adr-generator.d.ts +29 -1
  20. package/dist/pipeline/phase2/phases/adr-generator.d.ts.map +1 -1
  21. package/dist/pipeline/phase2/phases/adr-generator.js +709 -1399
  22. package/dist/pipeline/phase2/phases/adr-generator.js.map +1 -1
  23. package/dist/pipeline/phase2/phases/research-dossier.d.ts.map +1 -1
  24. package/dist/pipeline/phase2/phases/research-dossier.js +2 -33
  25. package/dist/pipeline/phase2/phases/research-dossier.js.map +1 -1
  26. package/dist/pipeline/phase2/types.d.ts +19 -57
  27. package/dist/pipeline/phase2/types.d.ts.map +1 -1
  28. package/dist/pipeline/phase4-adrs/adr-index-extractor.d.ts +75 -0
  29. package/dist/pipeline/phase4-adrs/adr-index-extractor.d.ts.map +1 -0
  30. package/dist/pipeline/phase4-adrs/adr-index-extractor.js +200 -0
  31. package/dist/pipeline/phase4-adrs/adr-index-extractor.js.map +1 -0
  32. package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.d.ts.map +1 -1
  33. package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.js +70 -68
  34. package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.js.map +1 -1
  35. package/dist/pipeline/phases/adr-ddd-generator.d.ts.map +1 -1
  36. package/dist/pipeline/phases/adr-ddd-generator.js +48 -2
  37. package/dist/pipeline/phases/adr-ddd-generator.js.map +1 -1
  38. package/dist/pipeline/phases/prompt-generator.js +191 -80
  39. package/dist/pipeline/phases/prompt-generator.js.map +1 -1
  40. package/dist/pipeline/ruflo-phase-executor.d.ts.map +1 -1
  41. package/dist/pipeline/ruflo-phase-executor.js +69 -17
  42. package/dist/pipeline/ruflo-phase-executor.js.map +1 -1
  43. package/dist/pipeline/types.d.ts +14 -1
  44. package/dist/pipeline/types.d.ts.map +1 -1
  45. package/dist/synthesis/ask-artifact-writer.d.ts +1 -1
  46. package/dist/synthesis/ask-artifact-writer.d.ts.map +1 -1
  47. package/dist/synthesis/ask-artifact-writer.js +9 -9
  48. package/dist/synthesis/ask-artifact-writer.js.map +1 -1
  49. package/dist/synthesis/simulation-artifact-generator.d.ts +1 -27
  50. package/dist/synthesis/simulation-artifact-generator.d.ts.map +1 -1
  51. package/dist/synthesis/simulation-artifact-generator.js +38 -128
  52. package/dist/synthesis/simulation-artifact-generator.js.map +1 -1
  53. package/package.json +1 -1
  54. package/dist/cli/ui/heartbeat.d.ts +0 -88
  55. package/dist/cli/ui/heartbeat.d.ts.map +0 -1
  56. package/dist/cli/ui/heartbeat.js +0 -158
  57. package/dist/cli/ui/heartbeat.js.map +0 -1
  58. package/dist/synthesis/agent-fleet-decomposer.d.ts +0 -124
  59. package/dist/synthesis/agent-fleet-decomposer.d.ts.map +0 -1
  60. package/dist/synthesis/agent-fleet-decomposer.js +0 -696
  61. package/dist/synthesis/agent-fleet-decomposer.js.map +0 -1
@@ -17,7 +17,6 @@ import { execFileSync } from 'node:child_process';
17
17
  import { isTransientFailure, isTerminalFailure } from '../errors/transient.js';
18
18
  import { recordDegradation, drainDegradations } from '../observability/degradations.js';
19
19
  import { computePhase1Verdict } from '../pipeline/phase1-verdict.js';
20
- import { pipelineHeartbeat } from '../cli/ui/heartbeat.js';
21
20
  // ============================================================================
22
21
  // ADR-066: Copilot agents via claude --print (Claude Max — no API key needed)
23
22
  // ============================================================================
@@ -3779,20 +3778,27 @@ export async function executeNaturalLanguageRoute(query, options) {
3779
3778
  // Top-of-function entry banner — fires within microseconds of dispatch so
3780
3779
  // the user sees the route is executing even if subsequent operations
3781
3780
  // (graph load, ruvector simulation, fleet dispatch) take a while.
3782
- // ADR-PIPELINE-100 §D5 — emit AGENTICS_TRACE_ID=<id> as the very first
3783
- // line so the MCP server's fast-return path can grab it within the first
3784
- // 100ms and return a "pipeline started, tail this log" response to the
3785
- // caller without blocking on the rest of the run.
3786
- process.stderr.write(`AGENTICS_TRACE_ID=${correlationId}\n`);
3787
3781
  process.stderr.write(`[agentics] route entered — query="${query.slice(0, 100)}${query.length > 100 ? '…' : ''}" depth=${options.depth ?? 'lite'} trace=${correlationId.slice(0, 8)}\n`);
3788
- // ADR-PIPELINE-099 D3 process-wide heartbeat. Survives across the
3789
- // executeNaturalLanguageRoute executeAutoChain handoff (the previous
3790
- // per-call heartbeat died at the function boundary, leaving Phases 2–7
3791
- // silent for minutes at a time). Idempotent auto-chain calls start()
3792
- // again with no effect. Stop happens at the end of executeAutoChain or
3793
- // via the singleton's exit handlers.
3794
- pipelineHeartbeat.start('agentics ask');
3795
- pipelineHeartbeat.setPhase('Phase 1 — Fleet Dispatch + Simulation');
3782
+ // Global 10-second heartbeat. Ticks until process exit (`unref()` keeps it
3783
+ // from blocking termination). When any other code emits its own output the
3784
+ // tick still fires but that's acceptable better noisy than silent. The
3785
+ // heartbeat suppresses itself via `lastOutputAt` if other writes have
3786
+ // happened recently.
3787
+ let lastOutputAt = Date.now();
3788
+ const realStderrWrite = process.stderr.write.bind(process.stderr);
3789
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3790
+ process.stderr.write = (chunk, ...rest) => {
3791
+ lastOutputAt = Date.now();
3792
+ return realStderrWrite(chunk, ...rest);
3793
+ };
3794
+ const heartbeat = setInterval(() => {
3795
+ if (Date.now() - lastOutputAt < 9_000)
3796
+ return; // something else just wrote
3797
+ const elapsedSec = Math.floor((Date.now() - start) / 1000);
3798
+ realStderrWrite(`[agentics] ⏳ still working — ${elapsedSec}s elapsed\n`);
3799
+ lastOutputAt = Date.now();
3800
+ }, 10_000);
3801
+ heartbeat.unref();
3796
3802
  // ========================================================================
3797
3803
  // ADR-030: Capability Graph Routing
3798
3804
  //
@@ -3835,7 +3841,6 @@ export async function executeNaturalLanguageRoute(query, options) {
3835
3841
  console.error(graphResult.routing.explanation);
3836
3842
  // Run ruvector simulation first (same as full-fleet path, ADR-016)
3837
3843
  console.error(' [RUVECTOR] Running simulation before graph-routed dispatch (ADR-016)...');
3838
- pipelineHeartbeat.setActivity(`ruvector: simulating ${graphResult.routing.totalAgents}-agent graph route`);
3839
3844
  const simResult = await (async () => {
3840
3845
  const MAX_RETRIES = 3;
3841
3846
  let lastErr;
@@ -3874,21 +3879,8 @@ export async function executeNaturalLanguageRoute(query, options) {
3874
3879
  const REPO_LOCAL_DOMAINS = new Set(['copilot']);
3875
3880
  const prevLocalAgents = process.env['AGENTICS_LOCAL_AGENTS'];
3876
3881
  console.error(` Dispatching ${graphResult.agents.length} graph-routed agents...`);
3877
- pipelineHeartbeat.setActivity(`fleet: dispatching ${graphResult.agents.length} graph-routed agents`);
3878
3882
  const agentPromises = [];
3879
- // ADR-PIPELINE-100 D2 emit a `[FLEET-CALL]` line as each agent
3880
- // STARTS and a result line when each FINISHES. The fleet runs in
3881
- // parallel via Promise.allSettled, so without these lines the user
3882
- // sees nothing for 1-3 minutes between the dispatch banner and the
3883
- // aggregate result. Pre-2.7.27 builds had this same silence — it
3884
- // never went away by itself when the heartbeat singleton was added.
3885
- const fleetTotal = graphResult.agents.length;
3886
- let fleetStartedCount = 0;
3887
- let fleetFinishedCount = 0;
3888
- graphResult.agents.forEach((ref, idx) => {
3889
- const agentStart = Date.now();
3890
- fleetStartedCount++;
3891
- process.stderr.write(` [FLEET-CALL] [${String(idx + 1).padStart(3, ' ')}/${fleetTotal}] → ${ref.domain}/${ref.agent}\n`);
3883
+ for (const ref of graphResult.agents) {
3892
3884
  agentPromises.push((async () => {
3893
3885
  try {
3894
3886
  if (!REPO_LOCAL_DOMAINS.has(ref.domain)) {
@@ -3902,25 +3894,12 @@ export async function executeNaturalLanguageRoute(query, options) {
3902
3894
  }
3903
3895
  const payload = buildDomainPayload(ref.domain, ref.agent, query, correlationId);
3904
3896
  const result = await executeAgentsInvokeCommand(ref.domain, ref.agent, payload, options);
3905
- const elapsed = ((Date.now() - agentStart) / 1000).toFixed(1);
3906
- fleetFinishedCount++;
3907
- const status = result.status ?? 200;
3908
- const ok = status >= 200 && status < 300;
3909
- process.stderr.write(` [FLEET-CALL] [${String(idx + 1).padStart(3, ' ')}/${fleetTotal}] ${ok ? '✓' : '✗'} ${ref.domain}/${ref.agent} (${elapsed}s, ${fleetFinishedCount}/${fleetTotal} done)\n`);
3910
- pipelineHeartbeat.setActivity(`fleet: ${fleetFinishedCount}/${fleetTotal} agents complete`);
3911
- return { kind: 'agent', domain: ref.domain, agent: ref.agent, status, response: result.response };
3897
+ return { kind: 'agent', domain: ref.domain, agent: ref.agent, status: result.status ?? 200, response: result.response };
3912
3898
  }
3913
3899
  catch (err) {
3914
- fleetFinishedCount++;
3915
- const elapsed = ((Date.now() - agentStart) / 1000).toFixed(1);
3916
- const errMsg = err instanceof Error ? err.message.slice(0, 80) : String(err).slice(0, 80);
3917
- process.stderr.write(` [FLEET-CALL] [${String(idx + 1).padStart(3, ' ')}/${fleetTotal}] ✗ ${ref.domain}/${ref.agent} (${elapsed}s) — ${errMsg}\n`);
3918
3900
  return { kind: 'agent', domain: ref.domain, agent: ref.agent, status: 502, response: { error: err instanceof Error ? err.message : String(err) } };
3919
3901
  }
3920
3902
  })());
3921
- });
3922
- if (fleetStartedCount > 0) {
3923
- process.stderr.write(` [FLEET-CALL] all ${fleetStartedCount} agents in flight — awaiting responses...\n`);
3924
3903
  }
3925
3904
  const allResults = await Promise.allSettled([Promise.resolve(simResult), ...agentPromises]);
3926
3905
  const elapsed = Date.now() - start;
@@ -4210,7 +4189,6 @@ export async function executeNaturalLanguageRoute(query, options) {
4210
4189
  { domain: 'platform', agent: 'risk-score' },
4211
4190
  ];
4212
4191
  console.error(`Dispatching ${fleetAgents.length} agents across ALL 27 domains + ruvector simulation`);
4213
- pipelineHeartbeat.setActivity(`fleet: dispatching ${fleetAgents.length} agents across 27 domains`);
4214
4192
  // ========================================================================
4215
4193
  // ADR-016: Run ruvector simulation BEFORE fleet dispatch (sequential).
4216
4194
  //
@@ -4223,7 +4201,6 @@ export async function executeNaturalLanguageRoute(query, options) {
4223
4201
  // start the fleet. Adds ~5s latency but guarantees simulation success.
4224
4202
  // ========================================================================
4225
4203
  console.error(' [RUVECTOR] Running simulation before fleet dispatch (ADR-016)...');
4226
- pipelineHeartbeat.setActivity('ruvector: pre-fleet simulation');
4227
4204
  const simResult = await (async () => {
4228
4205
  const MAX_RETRIES = 3;
4229
4206
  let lastErr;
@@ -4270,24 +4247,12 @@ export async function executeNaturalLanguageRoute(query, options) {
4270
4247
  const WAVE_SIZE = 15;
4271
4248
  const WAVE_DELAY_MS = 2000;
4272
4249
  const agentPromises = [];
4273
- // ADR-PIPELINE-100 D2 — per-agent visibility for the full-fleet path.
4274
- // Without these per-call lines the user sees a "Wave N/M" banner then
4275
- // 1-3 minutes of silence per wave, then nothing until ALL waves
4276
- // finish. The user explicitly demanded "I should see them being
4277
- // called" — these are the lines that satisfy that.
4278
- const fleetTotal = fleetAgents.length;
4279
- let fleetFinishedCount = 0;
4280
- let agentDispatchIdx = 0;
4281
4250
  for (let i = 0; i < fleetAgents.length; i += WAVE_SIZE) {
4282
4251
  const wave = fleetAgents.slice(i, i + WAVE_SIZE);
4283
4252
  const waveNum = Math.floor(i / WAVE_SIZE) + 1;
4284
4253
  const totalWaves = Math.ceil(fleetAgents.length / WAVE_SIZE);
4285
- console.error(` Wave ${waveNum}/${totalWaves}: dispatching ${wave.length} agents (${wave.map(a => `${a.domain}/${a.agent}`).slice(0, 3).join(', ')}${wave.length > 3 ? '...' : ''})`);
4254
+ console.error(` Wave ${waveNum}/${totalWaves}: ${wave.length} agents (${wave.map(a => `${a.domain}/${a.agent}`).slice(0, 3).join(', ')}${wave.length > 3 ? '...' : ''})`);
4286
4255
  for (const { domain, agent } of wave) {
4287
- agentDispatchIdx++;
4288
- const myIdx = agentDispatchIdx;
4289
- const agentStart = Date.now();
4290
- process.stderr.write(` [FLEET-CALL] [${String(myIdx).padStart(3, ' ')}/${fleetTotal}] → ${domain}/${agent}\n`);
4291
4256
  agentPromises.push((async () => {
4292
4257
  try {
4293
4258
  // Toggle repo-local per-agent: only copilot uses repo-local
@@ -4302,19 +4267,9 @@ export async function executeNaturalLanguageRoute(query, options) {
4302
4267
  }
4303
4268
  const payload = buildDomainPayload(domain, agent, query, correlationId);
4304
4269
  const result = await executeAgentsInvokeCommand(domain, agent, payload, options);
4305
- fleetFinishedCount++;
4306
- const elapsed = ((Date.now() - agentStart) / 1000).toFixed(1);
4307
- const status = result.status ?? 200;
4308
- const ok = status >= 200 && status < 300;
4309
- process.stderr.write(` [FLEET-CALL] [${String(myIdx).padStart(3, ' ')}/${fleetTotal}] ${ok ? '✓' : '✗'} ${domain}/${agent} (${elapsed}s, ${fleetFinishedCount}/${fleetTotal} done)\n`);
4310
- pipelineHeartbeat.setActivity(`fleet: ${fleetFinishedCount}/${fleetTotal} agents complete`);
4311
- return { kind: 'agent', domain, agent, status, response: result.response };
4270
+ return { kind: 'agent', domain, agent, status: result.status ?? 200, response: result.response };
4312
4271
  }
4313
4272
  catch (err) {
4314
- fleetFinishedCount++;
4315
- const elapsed = ((Date.now() - agentStart) / 1000).toFixed(1);
4316
- const errMsg = err instanceof Error ? err.message.slice(0, 80) : String(err).slice(0, 80);
4317
- process.stderr.write(` [FLEET-CALL] [${String(myIdx).padStart(3, ' ')}/${fleetTotal}] ✗ ${domain}/${agent} (${elapsed}s) — ${errMsg}\n`);
4318
4273
  return { kind: 'agent', domain, agent, status: 502, response: { error: err instanceof Error ? err.message : String(err) } };
4319
4274
  }
4320
4275
  })());
@@ -4324,7 +4279,6 @@ export async function executeNaturalLanguageRoute(query, options) {
4324
4279
  await new Promise(resolve => setTimeout(resolve, WAVE_DELAY_MS));
4325
4280
  }
4326
4281
  }
4327
- process.stderr.write(` [FLEET-CALL] all ${fleetTotal} agents in flight — awaiting final responses...\n`);
4328
4282
  const allResults = await Promise.allSettled([Promise.resolve(simResult), ...agentPromises]);
4329
4283
  const elapsed = Date.now() - start;
4330
4284
  // Restore repo-local mode setting