@llm-dev-ops/agentics-cli 2.7.26 → 2.7.27
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/dist/cli/ui/heartbeat.d.ts +101 -0
- package/dist/cli/ui/heartbeat.d.ts.map +1 -0
- package/dist/cli/ui/heartbeat.js +275 -0
- package/dist/cli/ui/heartbeat.js.map +1 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +13 -20
- package/dist/commands/agents.js.map +1 -1
- package/dist/pipeline/auto-chain.d.ts.map +1 -1
- package/dist/pipeline/auto-chain.js +86 -2
- package/dist/pipeline/auto-chain.js.map +1 -1
- package/dist/pipeline/local-fallback/phase5a-local-fallback.d.ts +18 -21
- package/dist/pipeline/local-fallback/phase5a-local-fallback.d.ts.map +1 -1
- package/dist/pipeline/local-fallback/phase5a-local-fallback.js +287 -94
- package/dist/pipeline/local-fallback/phase5a-local-fallback.js.map +1 -1
- package/dist/pipeline/phases/prompt-generator.js +65 -136
- package/dist/pipeline/phases/prompt-generator.js.map +1 -1
- package/dist/pipeline/ruflo-phase-executor.d.ts.map +1 -1
- package/dist/pipeline/ruflo-phase-executor.js +12 -1
- package/dist/pipeline/ruflo-phase-executor.js.map +1 -1
- package/dist/synthesis/agent-fleet-decomposer.d.ts +100 -0
- package/dist/synthesis/agent-fleet-decomposer.d.ts.map +1 -0
- package/dist/synthesis/agent-fleet-decomposer.js +550 -0
- package/dist/synthesis/agent-fleet-decomposer.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-PIPELINE-099 D3 + D4 — Process-wide pipeline heartbeat.
|
|
3
|
+
*
|
|
4
|
+
* Singleton that emits a continuous "still alive" signal for the entire
|
|
5
|
+
* `agentics ask` lifecycle, not just Phase 1. Replaces the per-call heartbeat
|
|
6
|
+
* inside `executeNaturalLanguageRoute` which died as soon as auto-chain
|
|
7
|
+
* took over Phases 2–7, leaving the user staring at a silent terminal for
|
|
8
|
+
* minutes at a stretch.
|
|
9
|
+
*
|
|
10
|
+
* Two render modes:
|
|
11
|
+
*
|
|
12
|
+
* - **TTY** (`stderr.isTTY` and not opted out): a single status line is
|
|
13
|
+
* repainted in place every 250ms at the cursor position using a four-frame
|
|
14
|
+
* spinner (`◐ ◓ ◑ ◒`). The line shows the current phase, total elapsed
|
|
15
|
+
* time, time-since-phase-entry, and the most recent activity hint set by
|
|
16
|
+
* the pipeline. Other writers (`console.error`, `process.stderr.write`)
|
|
17
|
+
* print above the status line via cursor save/restore.
|
|
18
|
+
*
|
|
19
|
+
* - **Non-TTY** (CI, piped output, `AGENTICS_NO_HEARTBEAT=1`): the spinner
|
|
20
|
+
* is suppressed; instead a plain `[agentics] ⏳ still working — Phase X
|
|
21
|
+
* (MM:SS) — <activity>` line prints every 10 seconds, throttled to skip
|
|
22
|
+
* any tick that happened within 9s of another stderr write.
|
|
23
|
+
*
|
|
24
|
+
* The singleton is crash-safe: `process.on('exit' | 'SIGINT' | 'SIGTERM')`
|
|
25
|
+
* handlers call `stop()` to clear the live status line so it doesn't leave a
|
|
26
|
+
* stale frame on the user's terminal after Ctrl-C.
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { pipelineHeartbeat } from './cli/ui/heartbeat.js';
|
|
31
|
+
* pipelineHeartbeat.start('agentics ask');
|
|
32
|
+
* pipelineHeartbeat.setPhase('Phase 4 — ADRs + DDDs');
|
|
33
|
+
* pipelineHeartbeat.setActivity('ruflo: writing adr-007');
|
|
34
|
+
* // ... long-running work ...
|
|
35
|
+
* pipelineHeartbeat.stop();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare class PipelineHeartbeat {
|
|
39
|
+
private readonly started;
|
|
40
|
+
private label;
|
|
41
|
+
private phase;
|
|
42
|
+
private phaseStartedAt;
|
|
43
|
+
private activity;
|
|
44
|
+
private activitySetAt;
|
|
45
|
+
private frameIndex;
|
|
46
|
+
private timer;
|
|
47
|
+
private mode;
|
|
48
|
+
private lastStderrWriteAt;
|
|
49
|
+
private statusLineRendered;
|
|
50
|
+
private originalStderrWrite;
|
|
51
|
+
private exitHandlersInstalled;
|
|
52
|
+
/**
|
|
53
|
+
* Begin emitting heartbeat ticks. Idempotent — repeated `start()` calls
|
|
54
|
+
* with a different label update the label but do not restart the timer.
|
|
55
|
+
*/
|
|
56
|
+
start(label: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Update the current phase label. Resets the per-phase timer. Called at
|
|
59
|
+
* every `[BEGIN]` boundary in auto-chain so the user can see which phase
|
|
60
|
+
* the pipeline is currently inside.
|
|
61
|
+
*/
|
|
62
|
+
setPhase(phase: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Update the latest activity hint. Examples: "ruflo: dispatching task adr-007",
|
|
65
|
+
* "fleet: 47/109 agents complete", "phase7: rendering decision-memo.md".
|
|
66
|
+
* Recent sets (within ~750ms) suppress the next TTY tick to avoid flicker.
|
|
67
|
+
*/
|
|
68
|
+
setActivity(activity: string): void;
|
|
69
|
+
/** Stop the timer, clear the live status line, restore stderr. */
|
|
70
|
+
stop(): void;
|
|
71
|
+
private tickTty;
|
|
72
|
+
private repaintTtyNow;
|
|
73
|
+
private tickPlain;
|
|
74
|
+
private paintStatusLine;
|
|
75
|
+
private clearStatusLine;
|
|
76
|
+
/**
|
|
77
|
+
* Wrap process.stderr.write so other writers (`console.error` etc.) clear
|
|
78
|
+
* the status line before printing, then we repaint after. This prevents
|
|
79
|
+
* the status line from being interleaved with normal log output in TTY
|
|
80
|
+
* mode. In plain mode the wrapper just records the timestamp so the 10s
|
|
81
|
+
* tick can self-suppress when other writes are happening.
|
|
82
|
+
*/
|
|
83
|
+
private installStderrInterceptor;
|
|
84
|
+
private uninstallStderrInterceptor;
|
|
85
|
+
/** Bypass the interceptor — used for our own status-line paint/clear. */
|
|
86
|
+
private writeRaw;
|
|
87
|
+
private installExitHandlers;
|
|
88
|
+
}
|
|
89
|
+
/** Process-wide singleton. */
|
|
90
|
+
export declare const pipelineHeartbeat: PipelineHeartbeat;
|
|
91
|
+
/**
|
|
92
|
+
* Bracket a phase with `[BEGIN]` / `[END]` log markers and update the
|
|
93
|
+
* heartbeat's phase label. Call at the top of each phase in auto-chain.
|
|
94
|
+
*
|
|
95
|
+
* Returns a `done()` closure that emits the matching `[END]` line when the
|
|
96
|
+
* phase finishes. Always pair `phaseBoundary` with its returned `done` to
|
|
97
|
+
* keep the trace greppable.
|
|
98
|
+
*/
|
|
99
|
+
export declare function phaseBoundary(phaseLabel: string, totalElapsedFromStart: number): () => void;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=heartbeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeat.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/heartbeat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AA8BH,cAAM,iBAAiB;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,IAAI,CAAkC;IAC9C,OAAO,CAAC,iBAAiB,CAAc;IACvC,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,mBAAmB,CAA4C;IACvE,OAAO,CAAC,qBAAqB,CAAS;IAEtC;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAsB1B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ7B;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMnC,kEAAkE;IAClE,IAAI,IAAI,IAAI;IAcZ,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,eAAe;IAOvB;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;IAgChC,OAAO,CAAC,0BAA0B;IAOlC,yEAAyE;IACzE,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,mBAAmB;CAa5B;AAED,8BAA8B;AAC9B,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,GAAG,MAAM,IAAI,CAkB3F"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADR-PIPELINE-099 D3 + D4 — Process-wide pipeline heartbeat.
|
|
3
|
+
*
|
|
4
|
+
* Singleton that emits a continuous "still alive" signal for the entire
|
|
5
|
+
* `agentics ask` lifecycle, not just Phase 1. Replaces the per-call heartbeat
|
|
6
|
+
* inside `executeNaturalLanguageRoute` which died as soon as auto-chain
|
|
7
|
+
* took over Phases 2–7, leaving the user staring at a silent terminal for
|
|
8
|
+
* minutes at a stretch.
|
|
9
|
+
*
|
|
10
|
+
* Two render modes:
|
|
11
|
+
*
|
|
12
|
+
* - **TTY** (`stderr.isTTY` and not opted out): a single status line is
|
|
13
|
+
* repainted in place every 250ms at the cursor position using a four-frame
|
|
14
|
+
* spinner (`◐ ◓ ◑ ◒`). The line shows the current phase, total elapsed
|
|
15
|
+
* time, time-since-phase-entry, and the most recent activity hint set by
|
|
16
|
+
* the pipeline. Other writers (`console.error`, `process.stderr.write`)
|
|
17
|
+
* print above the status line via cursor save/restore.
|
|
18
|
+
*
|
|
19
|
+
* - **Non-TTY** (CI, piped output, `AGENTICS_NO_HEARTBEAT=1`): the spinner
|
|
20
|
+
* is suppressed; instead a plain `[agentics] ⏳ still working — Phase X
|
|
21
|
+
* (MM:SS) — <activity>` line prints every 10 seconds, throttled to skip
|
|
22
|
+
* any tick that happened within 9s of another stderr write.
|
|
23
|
+
*
|
|
24
|
+
* The singleton is crash-safe: `process.on('exit' | 'SIGINT' | 'SIGTERM')`
|
|
25
|
+
* handlers call `stop()` to clear the live status line so it doesn't leave a
|
|
26
|
+
* stale frame on the user's terminal after Ctrl-C.
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { pipelineHeartbeat } from './cli/ui/heartbeat.js';
|
|
31
|
+
* pipelineHeartbeat.start('agentics ask');
|
|
32
|
+
* pipelineHeartbeat.setPhase('Phase 4 — ADRs + DDDs');
|
|
33
|
+
* pipelineHeartbeat.setActivity('ruflo: writing adr-007');
|
|
34
|
+
* // ... long-running work ...
|
|
35
|
+
* pipelineHeartbeat.stop();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const FRAMES = ['◐', '◓', '◑', '◒'];
|
|
39
|
+
const TTY_FRAME_MS = 250;
|
|
40
|
+
const PLAIN_TICK_MS = 10_000;
|
|
41
|
+
const PLAIN_QUIET_THRESHOLD_MS = 9_000;
|
|
42
|
+
const COLOR = {
|
|
43
|
+
reset: '\x1b[0m',
|
|
44
|
+
dim: '\x1b[2m',
|
|
45
|
+
cyan: '\x1b[36m',
|
|
46
|
+
gray: '\x1b[90m',
|
|
47
|
+
};
|
|
48
|
+
/** True when stderr is a TTY and the user has not opted out. */
|
|
49
|
+
function isTtyEnabled() {
|
|
50
|
+
if (process.env['AGENTICS_NO_HEARTBEAT'] === '1')
|
|
51
|
+
return false;
|
|
52
|
+
if (process.env['AGENTICS_NO_LIVE'] === '1')
|
|
53
|
+
return false;
|
|
54
|
+
if (process.env['CI'])
|
|
55
|
+
return false;
|
|
56
|
+
if (process.env['NO_COLOR'])
|
|
57
|
+
return false;
|
|
58
|
+
return Boolean(process.stderr.isTTY);
|
|
59
|
+
}
|
|
60
|
+
function fmtElapsed(ms) {
|
|
61
|
+
const totalSec = Math.floor(ms / 1000);
|
|
62
|
+
const m = Math.floor(totalSec / 60);
|
|
63
|
+
const s = totalSec % 60;
|
|
64
|
+
return `${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`;
|
|
65
|
+
}
|
|
66
|
+
class PipelineHeartbeat {
|
|
67
|
+
started = Date.now();
|
|
68
|
+
label = 'agentics';
|
|
69
|
+
phase = 'starting';
|
|
70
|
+
phaseStartedAt = Date.now();
|
|
71
|
+
activity = '';
|
|
72
|
+
activitySetAt = 0;
|
|
73
|
+
frameIndex = 0;
|
|
74
|
+
timer = null;
|
|
75
|
+
mode = 'off';
|
|
76
|
+
lastStderrWriteAt = Date.now();
|
|
77
|
+
statusLineRendered = false;
|
|
78
|
+
originalStderrWrite = null;
|
|
79
|
+
exitHandlersInstalled = false;
|
|
80
|
+
/**
|
|
81
|
+
* Begin emitting heartbeat ticks. Idempotent — repeated `start()` calls
|
|
82
|
+
* with a different label update the label but do not restart the timer.
|
|
83
|
+
*/
|
|
84
|
+
start(label) {
|
|
85
|
+
this.label = label;
|
|
86
|
+
if (this.timer)
|
|
87
|
+
return;
|
|
88
|
+
// AGENTICS_HEARTBEAT_OFF=1 disables the singleton entirely (e.g. for
|
|
89
|
+
// tests or for users who pipe stderr to a file and don't want the
|
|
90
|
+
// periodic chatter). Default behaviour: tty mode if stderr is a tty,
|
|
91
|
+
// plain mode otherwise.
|
|
92
|
+
if (process.env['AGENTICS_HEARTBEAT_OFF'] === '1')
|
|
93
|
+
return;
|
|
94
|
+
this.mode = isTtyEnabled() ? 'tty' : 'plain';
|
|
95
|
+
this.installStderrInterceptor();
|
|
96
|
+
this.installExitHandlers();
|
|
97
|
+
if (this.mode === 'tty') {
|
|
98
|
+
this.timer = setInterval(() => this.tickTty(), TTY_FRAME_MS);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.timer = setInterval(() => this.tickPlain(), PLAIN_TICK_MS);
|
|
102
|
+
}
|
|
103
|
+
this.timer.unref();
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Update the current phase label. Resets the per-phase timer. Called at
|
|
107
|
+
* every `[BEGIN]` boundary in auto-chain so the user can see which phase
|
|
108
|
+
* the pipeline is currently inside.
|
|
109
|
+
*/
|
|
110
|
+
setPhase(phase) {
|
|
111
|
+
this.phase = phase;
|
|
112
|
+
this.phaseStartedAt = Date.now();
|
|
113
|
+
this.activity = '';
|
|
114
|
+
this.activitySetAt = 0;
|
|
115
|
+
if (this.mode === 'tty')
|
|
116
|
+
this.repaintTtyNow();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Update the latest activity hint. Examples: "ruflo: dispatching task adr-007",
|
|
120
|
+
* "fleet: 47/109 agents complete", "phase7: rendering decision-memo.md".
|
|
121
|
+
* Recent sets (within ~750ms) suppress the next TTY tick to avoid flicker.
|
|
122
|
+
*/
|
|
123
|
+
setActivity(activity) {
|
|
124
|
+
this.activity = activity;
|
|
125
|
+
this.activitySetAt = Date.now();
|
|
126
|
+
if (this.mode === 'tty')
|
|
127
|
+
this.repaintTtyNow();
|
|
128
|
+
}
|
|
129
|
+
/** Stop the timer, clear the live status line, restore stderr. */
|
|
130
|
+
stop() {
|
|
131
|
+
if (this.timer) {
|
|
132
|
+
clearInterval(this.timer);
|
|
133
|
+
this.timer = null;
|
|
134
|
+
}
|
|
135
|
+
if (this.mode === 'tty' && this.statusLineRendered) {
|
|
136
|
+
this.clearStatusLine();
|
|
137
|
+
}
|
|
138
|
+
this.uninstallStderrInterceptor();
|
|
139
|
+
this.mode = 'off';
|
|
140
|
+
}
|
|
141
|
+
// ── Internal ─────────────────────────────────────────────────────────────
|
|
142
|
+
tickTty() {
|
|
143
|
+
// Auto-suppress flicker: if setActivity fired within the last 750ms, skip
|
|
144
|
+
// this tick — the activity-driven repaint already happened.
|
|
145
|
+
if (Date.now() - this.activitySetAt < 750 && this.activitySetAt > 0)
|
|
146
|
+
return;
|
|
147
|
+
this.frameIndex = (this.frameIndex + 1) % FRAMES.length;
|
|
148
|
+
this.paintStatusLine();
|
|
149
|
+
}
|
|
150
|
+
repaintTtyNow() {
|
|
151
|
+
this.frameIndex = (this.frameIndex + 1) % FRAMES.length;
|
|
152
|
+
this.paintStatusLine();
|
|
153
|
+
}
|
|
154
|
+
tickPlain() {
|
|
155
|
+
// Skip if some other writer just printed something — the user already
|
|
156
|
+
// has a fresh signal that we're alive.
|
|
157
|
+
if (Date.now() - this.lastStderrWriteAt < PLAIN_QUIET_THRESHOLD_MS)
|
|
158
|
+
return;
|
|
159
|
+
const elapsed = fmtElapsed(Date.now() - this.started);
|
|
160
|
+
const phaseSegment = this.phase ? `${this.phase} (${fmtElapsed(Date.now() - this.phaseStartedAt)})` : '';
|
|
161
|
+
const activitySegment = this.activity ? ` — ${this.activity}` : '';
|
|
162
|
+
const line = `[agentics] ⏳ still working — ${elapsed} — ${phaseSegment}${activitySegment}\n`;
|
|
163
|
+
this.writeRaw(line);
|
|
164
|
+
}
|
|
165
|
+
paintStatusLine() {
|
|
166
|
+
const frame = FRAMES[this.frameIndex];
|
|
167
|
+
const elapsedTotal = fmtElapsed(Date.now() - this.started);
|
|
168
|
+
const elapsedPhase = fmtElapsed(Date.now() - this.phaseStartedAt);
|
|
169
|
+
const phaseStr = `${COLOR.cyan}${this.phase}${COLOR.reset}`;
|
|
170
|
+
const elapsedStr = `${COLOR.dim}${elapsedTotal} total · ${elapsedPhase} phase${COLOR.reset}`;
|
|
171
|
+
const activityStr = this.activity ? ` ${COLOR.gray}·${COLOR.reset} ${this.activity}` : '';
|
|
172
|
+
const line = ` ${COLOR.cyan}${frame}${COLOR.reset} [${this.label}] ${phaseStr} ${COLOR.gray}·${COLOR.reset} ${elapsedStr}${activityStr}`;
|
|
173
|
+
this.clearStatusLine();
|
|
174
|
+
this.writeRaw(line);
|
|
175
|
+
this.statusLineRendered = true;
|
|
176
|
+
}
|
|
177
|
+
clearStatusLine() {
|
|
178
|
+
if (!this.statusLineRendered)
|
|
179
|
+
return;
|
|
180
|
+
// \r returns to column 0; \x1b[2K clears the entire line.
|
|
181
|
+
this.writeRaw('\r\x1b[2K');
|
|
182
|
+
this.statusLineRendered = false;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Wrap process.stderr.write so other writers (`console.error` etc.) clear
|
|
186
|
+
* the status line before printing, then we repaint after. This prevents
|
|
187
|
+
* the status line from being interleaved with normal log output in TTY
|
|
188
|
+
* mode. In plain mode the wrapper just records the timestamp so the 10s
|
|
189
|
+
* tick can self-suppress when other writes are happening.
|
|
190
|
+
*/
|
|
191
|
+
installStderrInterceptor() {
|
|
192
|
+
if (this.originalStderrWrite)
|
|
193
|
+
return;
|
|
194
|
+
const stderr = process.stderr;
|
|
195
|
+
this.originalStderrWrite = stderr.write.bind(stderr);
|
|
196
|
+
const orig = this.originalStderrWrite;
|
|
197
|
+
const self = this;
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
199
|
+
stderr.write = function (chunk, ...rest) {
|
|
200
|
+
self.lastStderrWriteAt = Date.now();
|
|
201
|
+
// If our own paint is in flight, just pass through.
|
|
202
|
+
if (self.mode !== 'tty') {
|
|
203
|
+
return orig(chunk, ...rest);
|
|
204
|
+
}
|
|
205
|
+
// For TTY: clear the status line, write the foreign output, repaint.
|
|
206
|
+
// We detect "our own writes" by a sentinel prefix — calls to writeRaw
|
|
207
|
+
// bypass this interceptor entirely.
|
|
208
|
+
if (self.statusLineRendered) {
|
|
209
|
+
orig('\r\x1b[2K');
|
|
210
|
+
self.statusLineRendered = false;
|
|
211
|
+
}
|
|
212
|
+
const ok = orig(chunk, ...rest);
|
|
213
|
+
// Defer repaint by one tick so chained writes (multi-line console.error)
|
|
214
|
+
// don't repaint between every line.
|
|
215
|
+
queueMicrotask(() => {
|
|
216
|
+
if (self.mode === 'tty' && !self.statusLineRendered && self.timer) {
|
|
217
|
+
self.paintStatusLine();
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
return ok;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
uninstallStderrInterceptor() {
|
|
224
|
+
if (!this.originalStderrWrite)
|
|
225
|
+
return;
|
|
226
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
227
|
+
process.stderr.write = this.originalStderrWrite;
|
|
228
|
+
this.originalStderrWrite = null;
|
|
229
|
+
}
|
|
230
|
+
/** Bypass the interceptor — used for our own status-line paint/clear. */
|
|
231
|
+
writeRaw(s) {
|
|
232
|
+
const w = this.originalStderrWrite ?? process.stderr.write.bind(process.stderr);
|
|
233
|
+
w(s);
|
|
234
|
+
}
|
|
235
|
+
installExitHandlers() {
|
|
236
|
+
if (this.exitHandlersInstalled)
|
|
237
|
+
return;
|
|
238
|
+
this.exitHandlersInstalled = true;
|
|
239
|
+
const cleanup = () => this.stop();
|
|
240
|
+
process.on('exit', cleanup);
|
|
241
|
+
process.on('SIGINT', () => { cleanup(); process.exit(130); });
|
|
242
|
+
process.on('SIGTERM', () => { cleanup(); process.exit(143); });
|
|
243
|
+
process.on('uncaughtException', (err) => {
|
|
244
|
+
cleanup();
|
|
245
|
+
// Re-throw on next tick so default handler still prints + exits non-zero.
|
|
246
|
+
setImmediate(() => { throw err; });
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/** Process-wide singleton. */
|
|
251
|
+
export const pipelineHeartbeat = new PipelineHeartbeat();
|
|
252
|
+
/**
|
|
253
|
+
* Bracket a phase with `[BEGIN]` / `[END]` log markers and update the
|
|
254
|
+
* heartbeat's phase label. Call at the top of each phase in auto-chain.
|
|
255
|
+
*
|
|
256
|
+
* Returns a `done()` closure that emits the matching `[END]` line when the
|
|
257
|
+
* phase finishes. Always pair `phaseBoundary` with its returned `done` to
|
|
258
|
+
* keep the trace greppable.
|
|
259
|
+
*/
|
|
260
|
+
export function phaseBoundary(phaseLabel, totalElapsedFromStart) {
|
|
261
|
+
const tStart = Date.now();
|
|
262
|
+
const t = fmtElapsed(totalElapsedFromStart);
|
|
263
|
+
pipelineHeartbeat.setPhase(phaseLabel);
|
|
264
|
+
// ANSI bold for the [BEGIN] marker so it stands out in scrollback.
|
|
265
|
+
process.stderr.write(`\n${'='.repeat(72)}\n` +
|
|
266
|
+
` ▶ ${phaseLabel} [BEGIN] T+${t}\n` +
|
|
267
|
+
`${'='.repeat(72)}\n`);
|
|
268
|
+
return () => {
|
|
269
|
+
const dur = fmtElapsed(Date.now() - tStart);
|
|
270
|
+
process.stderr.write(`${'='.repeat(72)}\n` +
|
|
271
|
+
` ▼ ${phaseLabel} ✓ completed (${dur}) [END]\n` +
|
|
272
|
+
`${'='.repeat(72)}\n\n`);
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=heartbeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeat.js","sourceRoot":"","sources":["../../../src/cli/ui/heartbeat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACpC,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAEvC,MAAM,KAAK,GAAG;IACZ,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACR,CAAC;AAEX,gEAAgE;AAChE,SAAS,YAAY;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IAC/D,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,C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iB,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CA2BlF"}
|
package/dist/commands/agents.js
CHANGED
|
@@ -17,6 +17,7 @@ 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';
|
|
20
21
|
// ============================================================================
|
|
21
22
|
// ADR-066: Copilot agents via claude --print (Claude Max — no API key needed)
|
|
22
23
|
// ============================================================================
|
|
@@ -3779,26 +3780,14 @@ export async function executeNaturalLanguageRoute(query, options) {
|
|
|
3779
3780
|
// the user sees the route is executing even if subsequent operations
|
|
3780
3781
|
// (graph load, ruvector simulation, fleet dispatch) take a while.
|
|
3781
3782
|
process.stderr.write(`[agentics] route entered — query="${query.slice(0, 100)}${query.length > 100 ? '…' : ''}" depth=${options.depth ?? 'lite'} trace=${correlationId.slice(0, 8)}\n`);
|
|
3782
|
-
//
|
|
3783
|
-
//
|
|
3784
|
-
//
|
|
3785
|
-
//
|
|
3786
|
-
//
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
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();
|
|
3783
|
+
// ADR-PIPELINE-099 D3 — process-wide heartbeat. Survives across the
|
|
3784
|
+
// executeNaturalLanguageRoute → executeAutoChain handoff (the previous
|
|
3785
|
+
// per-call heartbeat died at the function boundary, leaving Phases 2–7
|
|
3786
|
+
// silent for minutes at a time). Idempotent — auto-chain calls start()
|
|
3787
|
+
// again with no effect. Stop happens at the end of executeAutoChain or
|
|
3788
|
+
// via the singleton's exit handlers.
|
|
3789
|
+
pipelineHeartbeat.start('agentics ask');
|
|
3790
|
+
pipelineHeartbeat.setPhase('Phase 1 — Fleet Dispatch + Simulation');
|
|
3802
3791
|
// ========================================================================
|
|
3803
3792
|
// ADR-030: Capability Graph Routing
|
|
3804
3793
|
//
|
|
@@ -3841,6 +3830,7 @@ export async function executeNaturalLanguageRoute(query, options) {
|
|
|
3841
3830
|
console.error(graphResult.routing.explanation);
|
|
3842
3831
|
// Run ruvector simulation first (same as full-fleet path, ADR-016)
|
|
3843
3832
|
console.error(' [RUVECTOR] Running simulation before graph-routed dispatch (ADR-016)...');
|
|
3833
|
+
pipelineHeartbeat.setActivity(`ruvector: simulating ${graphResult.routing.totalAgents}-agent graph route`);
|
|
3844
3834
|
const simResult = await (async () => {
|
|
3845
3835
|
const MAX_RETRIES = 3;
|
|
3846
3836
|
let lastErr;
|
|
@@ -3879,6 +3869,7 @@ export async function executeNaturalLanguageRoute(query, options) {
|
|
|
3879
3869
|
const REPO_LOCAL_DOMAINS = new Set(['copilot']);
|
|
3880
3870
|
const prevLocalAgents = process.env['AGENTICS_LOCAL_AGENTS'];
|
|
3881
3871
|
console.error(` Dispatching ${graphResult.agents.length} graph-routed agents...`);
|
|
3872
|
+
pipelineHeartbeat.setActivity(`fleet: dispatching ${graphResult.agents.length} graph-routed agents`);
|
|
3882
3873
|
const agentPromises = [];
|
|
3883
3874
|
for (const ref of graphResult.agents) {
|
|
3884
3875
|
agentPromises.push((async () => {
|
|
@@ -4189,6 +4180,7 @@ export async function executeNaturalLanguageRoute(query, options) {
|
|
|
4189
4180
|
{ domain: 'platform', agent: 'risk-score' },
|
|
4190
4181
|
];
|
|
4191
4182
|
console.error(`Dispatching ${fleetAgents.length} agents across ALL 27 domains + ruvector simulation`);
|
|
4183
|
+
pipelineHeartbeat.setActivity(`fleet: dispatching ${fleetAgents.length} agents across 27 domains`);
|
|
4192
4184
|
// ========================================================================
|
|
4193
4185
|
// ADR-016: Run ruvector simulation BEFORE fleet dispatch (sequential).
|
|
4194
4186
|
//
|
|
@@ -4201,6 +4193,7 @@ export async function executeNaturalLanguageRoute(query, options) {
|
|
|
4201
4193
|
// start the fleet. Adds ~5s latency but guarantees simulation success.
|
|
4202
4194
|
// ========================================================================
|
|
4203
4195
|
console.error(' [RUVECTOR] Running simulation before fleet dispatch (ADR-016)...');
|
|
4196
|
+
pipelineHeartbeat.setActivity('ruvector: pre-fleet simulation');
|
|
4204
4197
|
const simResult = await (async () => {
|
|
4205
4198
|
const MAX_RETRIES = 3;
|
|
4206
4199
|
let lastErr;
|