myshell-tools 1.0.0 → 2.0.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/CHANGELOG.md +44 -69
- package/LICENSE +21 -21
- package/README.md +178 -318
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +130 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/cost.d.ts +36 -0
- package/dist/commands/cost.js +103 -0
- package/dist/commands/cost.js.map +1 -0
- package/dist/commands/doctor.d.ts +36 -0
- package/dist/commands/doctor.js +115 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/login.d.ts +20 -0
- package/dist/commands/login.js +60 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/core/assess.d.ts +25 -0
- package/dist/core/assess.js +142 -0
- package/dist/core/assess.js.map +1 -0
- package/dist/core/classify.d.ts +19 -0
- package/dist/core/classify.js +80 -0
- package/dist/core/classify.js.map +1 -0
- package/dist/core/escalate.d.ts +32 -0
- package/dist/core/escalate.js +57 -0
- package/dist/core/escalate.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/orchestrate.d.ts +42 -0
- package/dist/core/orchestrate.js +439 -0
- package/dist/core/orchestrate.js.map +1 -0
- package/dist/core/policy.d.ts +9 -0
- package/dist/core/policy.js +27 -0
- package/dist/core/policy.js.map +1 -0
- package/dist/core/prompt.d.ts +26 -0
- package/dist/core/prompt.js +125 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/review.d.ts +46 -0
- package/dist/core/review.js +148 -0
- package/dist/core/review.js.map +1 -0
- package/dist/core/route.d.ts +28 -0
- package/dist/core/route.js +52 -0
- package/dist/core/route.js.map +1 -0
- package/dist/core/types.d.ts +141 -0
- package/dist/core/types.js +14 -0
- package/dist/core/types.js.map +1 -0
- package/dist/infra/atomic.d.ts +53 -0
- package/dist/infra/atomic.js +171 -0
- package/dist/infra/atomic.js.map +1 -0
- package/dist/infra/clock.d.ts +9 -0
- package/dist/infra/clock.js +15 -0
- package/dist/infra/clock.js.map +1 -0
- package/dist/infra/index.d.ts +9 -0
- package/dist/infra/index.js +7 -0
- package/dist/infra/index.js.map +1 -0
- package/dist/infra/ledger.d.ts +49 -0
- package/dist/infra/ledger.js +90 -0
- package/dist/infra/ledger.js.map +1 -0
- package/dist/infra/paths.d.ts +28 -0
- package/dist/infra/paths.js +38 -0
- package/dist/infra/paths.js.map +1 -0
- package/dist/infra/pricing.d.ts +47 -0
- package/dist/infra/pricing.js +151 -0
- package/dist/infra/pricing.js.map +1 -0
- package/dist/infra/session.d.ts +28 -0
- package/dist/infra/session.js +61 -0
- package/dist/infra/session.js.map +1 -0
- package/dist/interface/render.d.ts +27 -0
- package/dist/interface/render.js +134 -0
- package/dist/interface/render.js.map +1 -0
- package/dist/interface/repl.d.ts +23 -0
- package/dist/interface/repl.js +90 -0
- package/dist/interface/repl.js.map +1 -0
- package/dist/interface/run.d.ts +20 -0
- package/dist/interface/run.js +31 -0
- package/dist/interface/run.js.map +1 -0
- package/dist/providers/claude-parse.d.ts +24 -0
- package/dist/providers/claude-parse.js +113 -0
- package/dist/providers/claude-parse.js.map +1 -0
- package/dist/providers/claude.d.ts +45 -0
- package/dist/providers/claude.js +122 -0
- package/dist/providers/claude.js.map +1 -0
- package/dist/providers/codex-parse.d.ts +32 -0
- package/dist/providers/codex-parse.js +145 -0
- package/dist/providers/codex-parse.js.map +1 -0
- package/dist/providers/codex.d.ts +44 -0
- package/dist/providers/codex.js +124 -0
- package/dist/providers/codex.js.map +1 -0
- package/dist/providers/detect.d.ts +49 -0
- package/dist/providers/detect.js +125 -0
- package/dist/providers/detect.js.map +1 -0
- package/dist/providers/errors.d.ts +49 -0
- package/dist/providers/errors.js +189 -0
- package/dist/providers/errors.js.map +1 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/port.d.ts +74 -0
- package/dist/providers/port.js +16 -0
- package/dist/providers/port.js.map +1 -0
- package/dist/providers/registry.d.ts +21 -0
- package/dist/providers/registry.js +34 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/ui/banner.d.ts +19 -0
- package/dist/ui/banner.js +32 -0
- package/dist/ui/banner.js.map +1 -0
- package/dist/ui/spinner.d.ts +27 -0
- package/dist/ui/spinner.js +67 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/theme.d.ts +32 -0
- package/dist/ui/theme.js +56 -0
- package/dist/ui/theme.js.map +1 -0
- package/package.json +55 -49
- package/data/orchestrator.json +0 -113
- package/src/auth/recovery.mjs +0 -328
- package/src/auth/refresh.mjs +0 -373
- package/src/chef.mjs +0 -348
- package/src/cli/doctor.mjs +0 -568
- package/src/cli/reset.mjs +0 -447
- package/src/cli/status.mjs +0 -379
- package/src/cli.mjs +0 -429
- package/src/commands/doctor.mjs +0 -375
- package/src/commands/help.mjs +0 -324
- package/src/commands/status.mjs +0 -331
- package/src/monitor/health.mjs +0 -486
- package/src/monitor/performance.mjs +0 -442
- package/src/monitor/report.mjs +0 -535
- package/src/orchestrator/classify.mjs +0 -391
- package/src/orchestrator/confidence.mjs +0 -151
- package/src/orchestrator/handoffs.mjs +0 -231
- package/src/orchestrator/review.mjs +0 -222
- package/src/providers/balance.mjs +0 -201
- package/src/providers/claude.mjs +0 -236
- package/src/providers/codex.mjs +0 -255
- package/src/providers/detect.mjs +0 -185
- package/src/providers/errors.mjs +0 -373
- package/src/providers/select.mjs +0 -162
- package/src/repl-enhanced.mjs +0 -417
- package/src/repl.mjs +0 -321
- package/src/state/archive.mjs +0 -366
- package/src/state/atomic.mjs +0 -116
- package/src/state/cleanup.mjs +0 -440
- package/src/state/recovery.mjs +0 -461
- package/src/state/session.mjs +0 -147
- package/src/ui/errors.mjs +0 -456
- package/src/ui/formatter.mjs +0 -327
- package/src/ui/icons.mjs +0 -318
- package/src/ui/progress.mjs +0 -468
- package/templates/prompts/confidence-format.txt +0 -14
- package/templates/prompts/ic-with-feedback.txt +0 -41
- package/templates/prompts/ic.txt +0 -13
- package/templates/prompts/manager-review.txt +0 -40
- package/templates/prompts/manager.txt +0 -14
- package/templates/prompts/worker.txt +0 -12
package/src/ui/progress.mjs
DELETED
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* progress.mjs — Progress indicators and loading animations
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { colors, fmt } from './formatter.mjs';
|
|
6
|
-
import { progress as progressIcons, getSpinnerFrame } from './icons.mjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Spinner class for animated loading indicators
|
|
10
|
-
*/
|
|
11
|
-
export class Spinner {
|
|
12
|
-
constructor(options = {}) {
|
|
13
|
-
this.frames = options.frames || progressIcons.spinner;
|
|
14
|
-
this.interval = options.interval || 100;
|
|
15
|
-
this.text = options.text || '';
|
|
16
|
-
this.color = options.color || colors.blue;
|
|
17
|
-
|
|
18
|
-
this.currentFrame = 0;
|
|
19
|
-
this.timer = null;
|
|
20
|
-
this.isSpinning = false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
start(text) {
|
|
24
|
-
if (text) this.text = text;
|
|
25
|
-
this.isSpinning = true;
|
|
26
|
-
this.currentFrame = 0;
|
|
27
|
-
|
|
28
|
-
this.timer = setInterval(() => {
|
|
29
|
-
this.render();
|
|
30
|
-
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
31
|
-
}, this.interval);
|
|
32
|
-
|
|
33
|
-
// Initial render
|
|
34
|
-
this.render();
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
stop(finalText = null) {
|
|
39
|
-
if (this.timer) {
|
|
40
|
-
clearInterval(this.timer);
|
|
41
|
-
this.timer = null;
|
|
42
|
-
}
|
|
43
|
-
this.isSpinning = false;
|
|
44
|
-
|
|
45
|
-
// Clear the line and show final message
|
|
46
|
-
process.stdout.write('\r\x1b[K');
|
|
47
|
-
if (finalText !== null) {
|
|
48
|
-
process.stdout.write(finalText + '\n');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
updateText(text) {
|
|
55
|
-
this.text = text;
|
|
56
|
-
if (this.isSpinning) {
|
|
57
|
-
this.render();
|
|
58
|
-
}
|
|
59
|
-
return this;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
render() {
|
|
63
|
-
const frame = this.frames[this.currentFrame];
|
|
64
|
-
const coloredFrame = `${this.color}${frame}${colors.reset}`;
|
|
65
|
-
const line = `\r${coloredFrame} ${this.text}`;
|
|
66
|
-
process.stdout.write(line);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
success(text) {
|
|
70
|
-
return this.stop(fmt.green(`✅ ${text || this.text}`));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
error(text) {
|
|
74
|
-
return this.stop(fmt.red(`❌ ${text || this.text}`));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
warning(text) {
|
|
78
|
-
return this.stop(fmt.yellow(`⚠️ ${text || this.text}`));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
info(text) {
|
|
82
|
-
return this.stop(fmt.blue(`💡 ${text || this.text}`));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Progress bar for deterministic progress
|
|
88
|
-
*/
|
|
89
|
-
export class ProgressBar {
|
|
90
|
-
constructor(options = {}) {
|
|
91
|
-
this.total = options.total || 100;
|
|
92
|
-
this.width = options.width || 30;
|
|
93
|
-
this.format = options.format || ':bar :current/:total (:percent)';
|
|
94
|
-
this.complete = options.complete || '█';
|
|
95
|
-
this.incomplete = options.incomplete || '░';
|
|
96
|
-
this.color = options.color || colors.green;
|
|
97
|
-
this.clear = options.clear !== false;
|
|
98
|
-
|
|
99
|
-
this.current = 0;
|
|
100
|
-
this.startTime = Date.now();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
tick(delta = 1, tokens = {}) {
|
|
104
|
-
this.current = Math.min(this.current + delta, this.total);
|
|
105
|
-
this.render(tokens);
|
|
106
|
-
|
|
107
|
-
if (this.current >= this.total && this.clear) {
|
|
108
|
-
this.complete();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
update(current, tokens = {}) {
|
|
113
|
-
this.current = Math.min(current, this.total);
|
|
114
|
-
this.render(tokens);
|
|
115
|
-
|
|
116
|
-
if (this.current >= this.total && this.clear) {
|
|
117
|
-
this.complete();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
render(tokens = {}) {
|
|
122
|
-
const percent = Math.round((this.current / this.total) * 100);
|
|
123
|
-
const completed = Math.round((this.current / this.total) * this.width);
|
|
124
|
-
const remaining = this.width - completed;
|
|
125
|
-
|
|
126
|
-
const completedBar = this.complete.repeat(completed);
|
|
127
|
-
const remainingBar = this.incomplete.repeat(remaining);
|
|
128
|
-
const bar = `${this.color}${completedBar}${colors.dim}${remainingBar}${colors.reset}`;
|
|
129
|
-
|
|
130
|
-
const elapsed = Date.now() - this.startTime;
|
|
131
|
-
const rate = this.current / (elapsed / 1000);
|
|
132
|
-
const eta = this.current > 0 ? (this.total - this.current) / rate : 0;
|
|
133
|
-
|
|
134
|
-
const formatTokens = {
|
|
135
|
-
':bar': bar,
|
|
136
|
-
':current': this.current,
|
|
137
|
-
':total': this.total,
|
|
138
|
-
':percent': `${percent}%`,
|
|
139
|
-
':elapsed': this.formatTime(elapsed / 1000),
|
|
140
|
-
':eta': this.formatTime(eta),
|
|
141
|
-
':rate': rate.toFixed(1),
|
|
142
|
-
...tokens
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
let output = this.format;
|
|
146
|
-
for (const [token, value] of Object.entries(formatTokens)) {
|
|
147
|
-
output = output.replace(new RegExp(token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), value);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
process.stdout.write(`\r${output}`);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
complete() {
|
|
154
|
-
process.stdout.write('\n');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
formatTime(seconds) {
|
|
158
|
-
if (seconds < 60) return `${Math.round(seconds)}s`;
|
|
159
|
-
if (seconds < 3600) return `${Math.round(seconds / 60)}m`;
|
|
160
|
-
return `${Math.round(seconds / 3600)}h`;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Multi-line progress tracker for complex operations
|
|
166
|
-
*/
|
|
167
|
-
export class MultiProgress {
|
|
168
|
-
constructor() {
|
|
169
|
-
this.items = new Map();
|
|
170
|
-
this.isRendering = false;
|
|
171
|
-
this.renderTimer = null;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
add(id, options = {}) {
|
|
175
|
-
const item = {
|
|
176
|
-
id,
|
|
177
|
-
text: options.text || id,
|
|
178
|
-
status: options.status || 'pending', // pending, running, success, error
|
|
179
|
-
progress: options.progress || 0,
|
|
180
|
-
total: options.total || 100,
|
|
181
|
-
color: options.color || colors.blue,
|
|
182
|
-
showProgress: options.showProgress !== false
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
this.items.set(id, item);
|
|
186
|
-
this.render();
|
|
187
|
-
return item;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
update(id, updates) {
|
|
191
|
-
const item = this.items.get(id);
|
|
192
|
-
if (!item) return;
|
|
193
|
-
|
|
194
|
-
Object.assign(item, updates);
|
|
195
|
-
this.render();
|
|
196
|
-
return item;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
success(id, text) {
|
|
200
|
-
return this.update(id, { status: 'success', text: text || this.items.get(id)?.text });
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
error(id, text) {
|
|
204
|
-
return this.update(id, { status: 'error', text: text || this.items.get(id)?.text });
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
start(id, text) {
|
|
208
|
-
return this.update(id, { status: 'running', text: text || this.items.get(id)?.text });
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
complete() {
|
|
212
|
-
if (this.renderTimer) {
|
|
213
|
-
clearInterval(this.renderTimer);
|
|
214
|
-
this.renderTimer = null;
|
|
215
|
-
}
|
|
216
|
-
this.isRendering = false;
|
|
217
|
-
process.stdout.write('\n');
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
render() {
|
|
221
|
-
if (this.items.size === 0) return;
|
|
222
|
-
|
|
223
|
-
// Move cursor to beginning of our section
|
|
224
|
-
const lineCount = this.items.size;
|
|
225
|
-
if (this.isRendering) {
|
|
226
|
-
process.stdout.write(`\x1b[${lineCount}A`);
|
|
227
|
-
}
|
|
228
|
-
this.isRendering = true;
|
|
229
|
-
|
|
230
|
-
for (const item of this.items.values()) {
|
|
231
|
-
const statusIcon = this.getStatusIcon(item.status);
|
|
232
|
-
const progressText = item.showProgress && item.total > 0
|
|
233
|
-
? this.formatProgress(item.progress, item.total)
|
|
234
|
-
: '';
|
|
235
|
-
|
|
236
|
-
const line = `${statusIcon} ${item.text}${progressText}`;
|
|
237
|
-
process.stdout.write(`\r\x1b[K${line}\n`);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// Move cursor back up to the end of our section
|
|
241
|
-
process.stdout.write(`\x1b[${lineCount}A`);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
getStatusIcon(status) {
|
|
245
|
-
switch (status) {
|
|
246
|
-
case 'pending': return fmt.dim('○');
|
|
247
|
-
case 'running': return fmt.blue('●');
|
|
248
|
-
case 'success': return fmt.green('✅');
|
|
249
|
-
case 'error': return fmt.red('❌');
|
|
250
|
-
default: return fmt.dim('○');
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
formatProgress(current, total) {
|
|
255
|
-
if (total <= 0) return '';
|
|
256
|
-
const percent = Math.round((current / total) * 100);
|
|
257
|
-
return fmt.dim(` (${percent}%)`);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Simple loading dots animation
|
|
263
|
-
*/
|
|
264
|
-
export class LoadingDots {
|
|
265
|
-
constructor(text = 'Loading', maxDots = 3) {
|
|
266
|
-
this.baseText = text;
|
|
267
|
-
this.maxDots = maxDots;
|
|
268
|
-
this.currentDots = 0;
|
|
269
|
-
this.timer = null;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
start() {
|
|
273
|
-
this.timer = setInterval(() => {
|
|
274
|
-
this.render();
|
|
275
|
-
this.currentDots = (this.currentDots + 1) % (this.maxDots + 1);
|
|
276
|
-
}, 500);
|
|
277
|
-
|
|
278
|
-
this.render();
|
|
279
|
-
return this;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
stop(finalText = null) {
|
|
283
|
-
if (this.timer) {
|
|
284
|
-
clearInterval(this.timer);
|
|
285
|
-
this.timer = null;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
process.stdout.write('\r\x1b[K');
|
|
289
|
-
if (finalText !== null) {
|
|
290
|
-
process.stdout.write(finalText + '\n');
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return this;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
render() {
|
|
297
|
-
const dots = '.'.repeat(this.currentDots);
|
|
298
|
-
const spaces = ' '.repeat(this.maxDots - this.currentDots);
|
|
299
|
-
process.stdout.write(`\r${this.baseText}${dots}${spaces}`);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Hierarchical progress display for AI orchestration
|
|
305
|
-
*/
|
|
306
|
-
export class HierarchicalProgress {
|
|
307
|
-
constructor() {
|
|
308
|
-
this.agents = new Map(); // id -> { tier, status, text, confidence, model }
|
|
309
|
-
this.isActive = false;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
addAgent(id, options = {}) {
|
|
313
|
-
const agent = {
|
|
314
|
-
id,
|
|
315
|
-
tier: options.tier || 'worker',
|
|
316
|
-
status: 'starting',
|
|
317
|
-
text: options.text || `${options.tier} agent`,
|
|
318
|
-
confidence: options.confidence || null,
|
|
319
|
-
model: options.model || null,
|
|
320
|
-
startTime: Date.now(),
|
|
321
|
-
...options
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
this.agents.set(id, agent);
|
|
325
|
-
this.render();
|
|
326
|
-
return agent;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
updateAgent(id, updates) {
|
|
330
|
-
const agent = this.agents.get(id);
|
|
331
|
-
if (!agent) return;
|
|
332
|
-
|
|
333
|
-
Object.assign(agent, updates);
|
|
334
|
-
this.render();
|
|
335
|
-
return agent;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
escalate(fromId, toId, toTier, reason) {
|
|
339
|
-
this.updateAgent(fromId, { status: 'escalating' });
|
|
340
|
-
|
|
341
|
-
this.addAgent(toId, {
|
|
342
|
-
tier: toTier,
|
|
343
|
-
text: `${toTier.toUpperCase()}: ${reason}`,
|
|
344
|
-
status: 'thinking'
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
this.render();
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
delegate(fromId, toId, toTier, task) {
|
|
351
|
-
this.addAgent(toId, {
|
|
352
|
-
tier: toTier,
|
|
353
|
-
text: `${toTier.toUpperCase()}: ${task}`,
|
|
354
|
-
status: 'working'
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
this.render();
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
complete(id, result = null) {
|
|
361
|
-
const agent = this.agents.get(id);
|
|
362
|
-
if (!agent) return;
|
|
363
|
-
|
|
364
|
-
this.updateAgent(id, {
|
|
365
|
-
status: 'completed',
|
|
366
|
-
text: result || agent.text,
|
|
367
|
-
endTime: Date.now()
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
// Show final summary
|
|
371
|
-
setTimeout(() => this.finish(), 1000);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
fail(id, error) {
|
|
375
|
-
this.updateAgent(id, {
|
|
376
|
-
status: 'failed',
|
|
377
|
-
text: `${error}`,
|
|
378
|
-
endTime: Date.now()
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
render() {
|
|
383
|
-
if (this.agents.size === 0) return;
|
|
384
|
-
|
|
385
|
-
console.log('\n' + fmt.bold('🔄 AI Orchestration Active:'));
|
|
386
|
-
|
|
387
|
-
// Group by tier for hierarchical display
|
|
388
|
-
const tiers = ['manager', 'ic', 'worker'];
|
|
389
|
-
const tierColors = {
|
|
390
|
-
manager: colors.red,
|
|
391
|
-
ic: colors.yellow,
|
|
392
|
-
worker: colors.blue
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
for (const tier of tiers) {
|
|
396
|
-
const tierAgents = Array.from(this.agents.values()).filter(a => a.tier === tier);
|
|
397
|
-
if (tierAgents.length === 0) continue;
|
|
398
|
-
|
|
399
|
-
const tierColor = tierColors[tier];
|
|
400
|
-
const tierIcon = tier === 'manager' ? '👔' : tier === 'ic' ? '👨💻' : '🏗️';
|
|
401
|
-
|
|
402
|
-
console.log(` ${tierColor}${tierIcon} ${tier.toUpperCase()}${colors.reset}`);
|
|
403
|
-
|
|
404
|
-
for (const agent of tierAgents) {
|
|
405
|
-
const statusIcon = this.getAgentStatusIcon(agent.status);
|
|
406
|
-
const confidenceText = agent.confidence
|
|
407
|
-
? ` • confidence: ${fmt.dim((agent.confidence * 100).toFixed(0) + '%')}`
|
|
408
|
-
: '';
|
|
409
|
-
|
|
410
|
-
console.log(` ${statusIcon} ${agent.text}${confidenceText}`);
|
|
411
|
-
|
|
412
|
-
if (agent.model) {
|
|
413
|
-
console.log(` ${fmt.dim(`└─ ${agent.model}`)}`);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
getAgentStatusIcon(status) {
|
|
420
|
-
switch (status) {
|
|
421
|
-
case 'starting': return fmt.blue('🔄');
|
|
422
|
-
case 'thinking': return fmt.blue('🧠');
|
|
423
|
-
case 'working': return fmt.yellow('⚡');
|
|
424
|
-
case 'escalating': return fmt.orange('↗️');
|
|
425
|
-
case 'completed': return fmt.green('✅');
|
|
426
|
-
case 'failed': return fmt.red('❌');
|
|
427
|
-
default: return fmt.dim('○');
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
finish() {
|
|
432
|
-
console.log('');
|
|
433
|
-
this.agents.clear();
|
|
434
|
-
this.isActive = false;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Create a simple spinner with common presets
|
|
440
|
-
*/
|
|
441
|
-
export function createSpinner(text, preset = 'default') {
|
|
442
|
-
const presets = {
|
|
443
|
-
default: { frames: progressIcons.spinner, color: colors.blue },
|
|
444
|
-
dots: { frames: progressIcons.dots, color: colors.green },
|
|
445
|
-
clock: { frames: progressIcons.clock, color: colors.yellow },
|
|
446
|
-
arrow: { frames: progressIcons.arrow, color: colors.cyan }
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
const options = presets[preset] || presets.default;
|
|
450
|
-
return new Spinner({ text, ...options });
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Show a loading animation for a promise
|
|
455
|
-
*/
|
|
456
|
-
export async function withSpinner(promise, text, options = {}) {
|
|
457
|
-
const spinner = createSpinner(text, options.preset);
|
|
458
|
-
spinner.start();
|
|
459
|
-
|
|
460
|
-
try {
|
|
461
|
-
const result = await promise;
|
|
462
|
-
spinner.success(options.successText || `${text} completed`);
|
|
463
|
-
return result;
|
|
464
|
-
} catch (error) {
|
|
465
|
-
spinner.error(options.errorText || `${text} failed`);
|
|
466
|
-
throw error;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
IMPORTANT: All responses MUST end with structured confidence information:
|
|
2
|
-
|
|
3
|
-
{"confidence": 0.0-1.0, "escalate": true|false, "reason": "brief explanation", "needs_review": true|false}
|
|
4
|
-
|
|
5
|
-
Where:
|
|
6
|
-
- confidence: Your certainty level (0.0 = very uncertain, 1.0 = completely certain)
|
|
7
|
-
- escalate: Whether this should go to a higher tier (true/false)
|
|
8
|
-
- reason: Brief explanation of your confidence level or escalation need
|
|
9
|
-
- needs_review: Whether this work should be reviewed by a manager (true/false)
|
|
10
|
-
|
|
11
|
-
Examples:
|
|
12
|
-
{"confidence": 0.9, "escalate": false, "reason": "straightforward implementation", "needs_review": false}
|
|
13
|
-
{"confidence": 0.3, "escalate": true, "reason": "complex security implications", "needs_review": true}
|
|
14
|
-
{"confidence": 0.7, "escalate": false, "reason": "solid approach but edge cases exist", "needs_review": true}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
You are an IC (Individual Contributor) in an AI organization. You handle most of the implementation work:
|
|
2
|
-
|
|
3
|
-
TASK: {{task}}
|
|
4
|
-
|
|
5
|
-
{{#if manager_notes}}
|
|
6
|
-
MANAGER FEEDBACK (from previous attempt):
|
|
7
|
-
═══════════════════════════════════════
|
|
8
|
-
{{manager_notes}}
|
|
9
|
-
═══════════════════════════════════════
|
|
10
|
-
|
|
11
|
-
Your manager has reviewed your previous work and wants you to address the above issues.
|
|
12
|
-
Focus on fixing exactly what they pointed out.
|
|
13
|
-
{{/if}}
|
|
14
|
-
|
|
15
|
-
You are the primary workhorse - most tasks should be completed at your level. Focus on:
|
|
16
|
-
- Code implementation and editing
|
|
17
|
-
- Refactoring and improvements
|
|
18
|
-
- Running tests and debugging
|
|
19
|
-
- Git operations and file management
|
|
20
|
-
|
|
21
|
-
{{#if attempt}}
|
|
22
|
-
This is attempt #{{attempt}}. Apply the manager's feedback carefully.
|
|
23
|
-
{{/if}}
|
|
24
|
-
|
|
25
|
-
If you encounter something that needs architectural decisions, security review, or complex debugging, escalate to your manager.
|
|
26
|
-
|
|
27
|
-
End your response with: {"confidence": 0.0-1.0, "escalate": true|false, "reason": "brief explanation"}
|
|
28
|
-
|
|
29
|
-
{{#if files}}
|
|
30
|
-
Relevant files:
|
|
31
|
-
{{#each files}}
|
|
32
|
-
- {{this}}
|
|
33
|
-
{{/each}}
|
|
34
|
-
{{/if}}
|
|
35
|
-
|
|
36
|
-
{{#if constraints}}
|
|
37
|
-
Constraints:
|
|
38
|
-
{{#each constraints}}
|
|
39
|
-
- {{this}}
|
|
40
|
-
{{/each}}
|
|
41
|
-
{{/if}}
|
package/templates/prompts/ic.txt
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
You are an IC (Individual Contributor) in an AI organization. You handle most of the implementation work:
|
|
2
|
-
|
|
3
|
-
TASK: {{task}}
|
|
4
|
-
|
|
5
|
-
You are the primary workhorse - most tasks should be completed at your level. Focus on:
|
|
6
|
-
- Code implementation and editing
|
|
7
|
-
- Refactoring and improvements
|
|
8
|
-
- Running tests and debugging
|
|
9
|
-
- Git operations and file management
|
|
10
|
-
|
|
11
|
-
If you encounter something that needs architectural decisions, security review, or complex debugging, escalate to your manager.
|
|
12
|
-
|
|
13
|
-
End your response with: {"confidence": 0.0-1.0, "escalate": true|false, "reason": "brief explanation"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
You are a MANAGER reviewing work completed by an IC (Individual Contributor).
|
|
2
|
-
|
|
3
|
-
ORIGINAL TASK: {{task}}
|
|
4
|
-
|
|
5
|
-
IC'S WORK RESULT:
|
|
6
|
-
─────────────────
|
|
7
|
-
{{ic_output}}
|
|
8
|
-
─────────────────
|
|
9
|
-
IC Confidence: {{ic_confidence}}
|
|
10
|
-
Duration: {{duration_ms}}ms
|
|
11
|
-
Model: {{ic_model}}
|
|
12
|
-
{{#if attempt}}
|
|
13
|
-
NOTE: This is attempt #{{attempt}}. Previous manager feedback was addressed.
|
|
14
|
-
{{/if}}
|
|
15
|
-
{{#if manager_notes}}
|
|
16
|
-
|
|
17
|
-
PREVIOUS MANAGER FEEDBACK:
|
|
18
|
-
{{manager_notes}}
|
|
19
|
-
{{/if}}
|
|
20
|
-
|
|
21
|
-
Your job is to review this work and decide:
|
|
22
|
-
|
|
23
|
-
REVIEW CRITERIA:
|
|
24
|
-
1. CORRECTNESS: Did the IC actually complete the task as requested?
|
|
25
|
-
2. QUALITY: Is the implementation solid, or are there obvious issues?
|
|
26
|
-
3. SECURITY: Any security concerns or risky patterns?
|
|
27
|
-
4. COMPLETENESS: Are there missing pieces or edge cases not handled?
|
|
28
|
-
5. EDGE CASES: What could break under unusual conditions?
|
|
29
|
-
|
|
30
|
-
POSSIBLE VERDICTS:
|
|
31
|
-
- APPROVE: Work is good, ship it
|
|
32
|
-
- BOUNCE: IC should fix issues and retry (provide specific feedback)
|
|
33
|
-
- ESCALATE: Manager should take over this task directly
|
|
34
|
-
- REFRAME: Task needs to be broken down or approached differently
|
|
35
|
-
|
|
36
|
-
Your response MUST end with structured output:
|
|
37
|
-
{"verdict": "approve|bounce|escalate|reframe", "notes": "specific feedback", "confidence": 0.0-1.0, "risk_level": "low|medium|high|critical"}
|
|
38
|
-
|
|
39
|
-
If bouncing, be specific about what needs to be fixed.
|
|
40
|
-
If approving, note any minor concerns for future reference.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
You are a MANAGER in an AI organization. Handle high-level decisions and review complex problems:
|
|
2
|
-
|
|
3
|
-
TASK: {{task}}
|
|
4
|
-
|
|
5
|
-
You handle:
|
|
6
|
-
- Architecture decisions
|
|
7
|
-
- Security reviews
|
|
8
|
-
- Complex debugging that requires deep reasoning
|
|
9
|
-
- Code reviews and quality decisions
|
|
10
|
-
- Escalated issues from ICs
|
|
11
|
-
|
|
12
|
-
Either solve the problem completely or provide specific guidance for your team to implement.
|
|
13
|
-
|
|
14
|
-
End your response with: {"confidence": 0.0-1.0, "escalate": false, "reason": "solution approach"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
You are a WORKER in an AI organization hierarchy. Handle this specific, simple task efficiently:
|
|
2
|
-
|
|
3
|
-
TASK: {{task}}
|
|
4
|
-
|
|
5
|
-
You are the cheapest, fastest model in the org chart. Focus on:
|
|
6
|
-
- File lookups, grep operations, simple reads
|
|
7
|
-
- Quick information gathering
|
|
8
|
-
- Basic operations that don't require complex reasoning
|
|
9
|
-
|
|
10
|
-
Work efficiently and honestly. If the task is more complex than you can handle confidently, be honest about it.
|
|
11
|
-
|
|
12
|
-
End your response with: {"confidence": 0.0-1.0, "escalate": true|false, "reason": "brief explanation"}
|