@rcrsr/claude-code-runner 0.4.0 → 0.5.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/README.md +103 -30
- package/dist/cli/args.d.ts +0 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +51 -20
- package/dist/cli/args.js.map +1 -1
- package/dist/core/runner.d.ts +5 -2
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +27 -24
- package/dist/core/runner.js.map +1 -1
- package/dist/index.js +83 -41
- package/dist/index.js.map +1 -1
- package/dist/output/colors.d.ts +5 -11
- package/dist/output/colors.d.ts.map +1 -1
- package/dist/output/colors.js +7 -59
- package/dist/output/colors.js.map +1 -1
- package/dist/output/deaddrop-queue.d.ts +45 -0
- package/dist/output/deaddrop-queue.d.ts.map +1 -0
- package/dist/output/deaddrop-queue.js +82 -0
- package/dist/output/deaddrop-queue.js.map +1 -0
- package/dist/output/formatter.d.ts +4 -0
- package/dist/output/formatter.d.ts.map +1 -1
- package/dist/output/formatter.js +20 -17
- package/dist/output/formatter.js.map +1 -1
- package/dist/process/pty.d.ts.map +1 -1
- package/dist/process/pty.js +3 -2
- package/dist/process/pty.js.map +1 -1
- package/dist/script/index.d.ts +8 -0
- package/dist/script/index.d.ts.map +1 -0
- package/dist/script/index.js +10 -0
- package/dist/script/index.js.map +1 -0
- package/dist/script/loader.d.ts +13 -0
- package/dist/script/loader.d.ts.map +1 -0
- package/dist/script/loader.js +66 -0
- package/dist/script/loader.js.map +1 -0
- package/dist/script/parser.d.ts +63 -0
- package/dist/script/parser.d.ts.map +1 -0
- package/dist/script/parser.js +349 -0
- package/dist/script/parser.js.map +1 -0
- package/dist/script/types.d.ts +49 -0
- package/dist/script/types.d.ts.map +1 -0
- package/dist/script/types.js +5 -0
- package/dist/script/types.js.map +1 -0
- package/dist/script/variables.d.ts +27 -0
- package/dist/script/variables.d.ts.map +1 -0
- package/dist/script/variables.js +74 -0
- package/dist/script/variables.js.map +1 -0
- package/dist/templates/command.d.ts +18 -20
- package/dist/templates/command.d.ts.map +1 -1
- package/dist/templates/command.js +40 -61
- package/dist/templates/command.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/runner.d.ts +12 -0
- package/dist/types/runner.d.ts.map +1 -1
- package/dist/types/runner.js +4 -3
- package/dist/types/runner.js.map +1 -1
- package/dist/types/tools.d.ts +64 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +12 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/arguments.d.ts +19 -0
- package/dist/utils/arguments.d.ts.map +1 -0
- package/dist/utils/arguments.js +31 -0
- package/dist/utils/arguments.js.map +1 -0
- package/dist/utils/constants.d.ts +49 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +54 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/formatting.d.ts +10 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +19 -0
- package/dist/utils/formatting.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,19 +4,32 @@
|
|
|
4
4
|
* Shows intermediate tool calls and responses in real-time
|
|
5
5
|
*/
|
|
6
6
|
import { randomBytes } from 'crypto';
|
|
7
|
-
import { parseArgs
|
|
8
|
-
import { runWithSignals } from './core/runner.js';
|
|
7
|
+
import { parseArgs } from './cli/args.js';
|
|
8
|
+
import { runWithSignals, } from './core/runner.js';
|
|
9
9
|
import { createDeadDropClientFromEnv } from './deaddrop/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { configureDeadDrop, flushDeadDrop, printRunner, printRunnerInfo, } from './output/colors.js';
|
|
11
11
|
import { createFormatterState } from './output/formatter.js';
|
|
12
12
|
import { createLogger } from './output/logger.js';
|
|
13
|
+
import { captureOutput, createVariableStore, getSubstitutionList, loadScript, substituteVariables, } from './script/index.js';
|
|
14
|
+
import { loadCommandTemplate } from './templates/command.js';
|
|
13
15
|
import { DEFAULT_CONFIG } from './types/runner.js';
|
|
16
|
+
import { formatSize } from './utils/formatting.js';
|
|
14
17
|
/**
|
|
15
18
|
* Generate a short unique run ID (8 chars, uppercase)
|
|
16
19
|
*/
|
|
17
20
|
function generateRunId() {
|
|
18
21
|
return randomBytes(4).toString('hex').toUpperCase();
|
|
19
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Format variables used for "with X" clause
|
|
25
|
+
*/
|
|
26
|
+
function formatVarsUsed(vars) {
|
|
27
|
+
if (vars.length === 0)
|
|
28
|
+
return '';
|
|
29
|
+
// Convert $_ to "last result", keep others as-is
|
|
30
|
+
const labels = vars.map((v) => (v === '$_' ? 'last result' : v));
|
|
31
|
+
return `with ${labels.join(', ')}: `;
|
|
32
|
+
}
|
|
20
33
|
async function main() {
|
|
21
34
|
const totalStart = Date.now();
|
|
22
35
|
const args = process.argv.slice(2);
|
|
@@ -68,58 +81,87 @@ async function main() {
|
|
|
68
81
|
printRunnerInfo(`Log: ${logger.filePath}`);
|
|
69
82
|
}
|
|
70
83
|
logger.log(`Started: ${new Date().toISOString()}`);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
// Build script lines - single prompt/command becomes a 1-step script
|
|
85
|
+
let lines;
|
|
86
|
+
let scriptArgs = [];
|
|
87
|
+
if (parsed.scriptMode && parsed.scriptFile) {
|
|
88
|
+
const script = loadScript(parsed.scriptFile, parsed.scriptArgs);
|
|
89
|
+
lines = script.lines;
|
|
90
|
+
scriptArgs = parsed.scriptArgs;
|
|
74
91
|
}
|
|
75
92
|
else {
|
|
76
|
-
// Single command
|
|
77
|
-
|
|
93
|
+
// Single prompt or command becomes a 1-step script
|
|
94
|
+
lines = [{ type: 'prompt', text: parsed.prompt }];
|
|
78
95
|
}
|
|
96
|
+
// Run the script
|
|
97
|
+
const success = await runScript(lines, scriptArgs, context, totalStart);
|
|
98
|
+
context.logger.close();
|
|
99
|
+
await flushDeadDrop();
|
|
100
|
+
process.exit(success ? 0 : 1);
|
|
79
101
|
}
|
|
80
102
|
/**
|
|
81
|
-
*
|
|
103
|
+
* Build display string for a script line
|
|
82
104
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
105
|
+
function getDisplayLine(line) {
|
|
106
|
+
if (line.type === 'prompt') {
|
|
107
|
+
const preview = line.text.length > 50 ? line.text.slice(0, 50) + '...' : line.text;
|
|
108
|
+
return `"${preview}"`;
|
|
109
|
+
}
|
|
110
|
+
return `command("${line.name}")`;
|
|
89
111
|
}
|
|
90
112
|
/**
|
|
91
|
-
* Run
|
|
113
|
+
* Run a script (unified execution for single prompts and multi-step scripts)
|
|
92
114
|
*/
|
|
93
|
-
async function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
for (const [i, line] of
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
115
|
+
async function runScript(lines, scriptArgs, context, startTime) {
|
|
116
|
+
const store = createVariableStore();
|
|
117
|
+
let completedSteps = 0;
|
|
118
|
+
for (const [i, line] of lines.entries()) {
|
|
119
|
+
const stepNum = i + 1;
|
|
120
|
+
const displayLine = getDisplayLine(line);
|
|
121
|
+
context.logger.log(`\n=== Step ${stepNum}: ${displayLine} ===\n`);
|
|
122
|
+
// Get the prompt text
|
|
123
|
+
let promptText;
|
|
124
|
+
if (line.type === 'prompt') {
|
|
125
|
+
promptText = line.text;
|
|
102
126
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
else {
|
|
128
|
+
const template = loadCommandTemplate(line.name, line.args);
|
|
129
|
+
promptText = template.prompt;
|
|
106
130
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
131
|
+
// Substitute variables
|
|
132
|
+
const varsUsed = getSubstitutionList(promptText, store);
|
|
133
|
+
const finalPrompt = substituteVariables(promptText, store, scriptArgs);
|
|
134
|
+
// Build display: show substituted prompt and what variables were used
|
|
135
|
+
const substitutedDisplay = getDisplayLine({
|
|
136
|
+
type: 'prompt',
|
|
137
|
+
text: finalPrompt,
|
|
138
|
+
});
|
|
139
|
+
const withClause = formatVarsUsed(varsUsed);
|
|
140
|
+
// Set step number for formatter output
|
|
141
|
+
context.formatterState.currentStep = stepNum;
|
|
142
|
+
// Run via runWithSignals (handles iterations, signals, output)
|
|
143
|
+
const stepContext = { stepNum };
|
|
144
|
+
const result = await runWithSignals(finalPrompt, `${withClause}${substitutedDisplay}`, startTime, context, stepContext);
|
|
145
|
+
// Capture output for variable store
|
|
146
|
+
captureOutput(store, result.claudeText, line.capture);
|
|
147
|
+
// Print step completion with result size
|
|
148
|
+
const durationMs = context.formatterState.lastStepDurationMs;
|
|
149
|
+
const duration = durationMs ? `${(durationMs / 1000).toFixed(1)}s` : '?';
|
|
150
|
+
const size = formatSize(result.claudeText.length);
|
|
151
|
+
const captureLabel = line.capture ? `$${line.capture}` : 'result';
|
|
152
|
+
printRunner(`Completed step ${stepNum} in ${duration}, ${captureLabel} = ${size}`);
|
|
153
|
+
// Handle failure (runWithSignals already printed the error)
|
|
154
|
+
if (result.status !== 'ok') {
|
|
155
|
+
return false;
|
|
114
156
|
}
|
|
157
|
+
completedSteps++;
|
|
115
158
|
}
|
|
116
|
-
//
|
|
159
|
+
// Print completion with run ID, step count, and duration
|
|
117
160
|
const totalDuration = Date.now() - startTime;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
context.
|
|
121
|
-
|
|
122
|
-
process.exit(0);
|
|
161
|
+
const stepWord = completedSteps === 1 ? 'step' : 'steps';
|
|
162
|
+
const durationSec = (totalDuration / 1000).toFixed(1);
|
|
163
|
+
printRunner(`Completed run ${context.runId} (${completedSteps} ${stepWord}) in ${durationSec}s`);
|
|
164
|
+
return true;
|
|
123
165
|
}
|
|
124
166
|
// Run main
|
|
125
167
|
main().catch((err) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAEL,cAAc,GAEf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAqB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;GAEG;AACH,SAAS,aAAa;IACpB,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACtD,C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AC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/output/colors.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ANSI color codes for terminal output
|
|
3
3
|
*/
|
|
4
|
+
import { configureDeadDrop, flushDeadDrop } from './deaddrop-queue.js';
|
|
5
|
+
export { configureDeadDrop, flushDeadDrop };
|
|
4
6
|
export declare const colors: {
|
|
5
7
|
readonly reset: "\u001B[0m";
|
|
6
8
|
readonly dim: "\u001B[2m";
|
|
@@ -47,16 +49,6 @@ export type DeadDropUser = 'Runner' | 'Claude Code';
|
|
|
47
49
|
* Deaddrop send function type (to avoid circular imports)
|
|
48
50
|
*/
|
|
49
51
|
export type DeadDropSender = (content: string, user: DeadDropUser) => Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Configure the deaddrop sender for all output functions
|
|
52
|
-
* Call once at startup when --deaddrop is enabled
|
|
53
|
-
*/
|
|
54
|
-
export declare function configureDeadDrop(sender: DeadDropSender | null): void;
|
|
55
|
-
/**
|
|
56
|
-
* Flush all pending deaddrop sends
|
|
57
|
-
* Call before process.exit to ensure all messages are sent
|
|
58
|
-
*/
|
|
59
|
-
export declare function flushDeadDrop(): Promise<void>;
|
|
60
52
|
/**
|
|
61
53
|
* Print a [RUNNER] operational message with timestamp
|
|
62
54
|
* Automatically sends to Deaddrop if configured (without prefix)
|
|
@@ -70,6 +62,8 @@ export declare function printRunnerInfo(message: string): void;
|
|
|
70
62
|
/**
|
|
71
63
|
* Print a [CLAUDE] message with timestamp
|
|
72
64
|
* Automatically sends to Deaddrop if configured (without prefix)
|
|
65
|
+
* @param message - Display message (may be truncated/formatted for console)
|
|
66
|
+
* @param rawForDeaddrop - Original unmodified text to send to deaddrop (preserves newlines)
|
|
73
67
|
*/
|
|
74
|
-
export declare function printClaude(message: string): void;
|
|
68
|
+
export declare function printClaude(message: string, rawForDeaddrop?: string): void;
|
|
75
69
|
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/output/colors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;CAUT,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,MAAM,CAAC;AAQ5C,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAE/D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAejD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAM/D;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/output/colors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,aAAa,EAEd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAC;AAE5C,eAAO,MAAM,MAAM;;;;;;;;;;CAUT,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,MAAM,CAAC;AAQ5C,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAE/D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAejD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAM/D;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKjD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAK1E"}
|
package/dist/output/colors.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ANSI color codes for terminal output
|
|
3
3
|
*/
|
|
4
|
+
import { configureDeadDrop, flushDeadDrop, sendToDeadDrop, } from './deaddrop-queue.js';
|
|
5
|
+
// Re-export deaddrop functions for backward compatibility
|
|
6
|
+
export { configureDeadDrop, flushDeadDrop };
|
|
4
7
|
export const colors = {
|
|
5
8
|
reset: '\x1b[0m',
|
|
6
9
|
dim: '\x1b[2m',
|
|
@@ -82,63 +85,6 @@ export function formatTimestamp(date = new Date()) {
|
|
|
82
85
|
export function timestampPrefix() {
|
|
83
86
|
return `${colors.dim}${formatTimestamp()}${colors.reset} `;
|
|
84
87
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Module-level deaddrop sender, configured once at startup
|
|
87
|
-
*/
|
|
88
|
-
let deadDropSender = null;
|
|
89
|
-
const messageQueue = [];
|
|
90
|
-
let isProcessing = false;
|
|
91
|
-
let flushResolve = null;
|
|
92
|
-
/**
|
|
93
|
-
* Configure the deaddrop sender for all output functions
|
|
94
|
-
* Call once at startup when --deaddrop is enabled
|
|
95
|
-
*/
|
|
96
|
-
export function configureDeadDrop(sender) {
|
|
97
|
-
deadDropSender = sender;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Process queued messages one at a time
|
|
101
|
-
*/
|
|
102
|
-
async function processQueue() {
|
|
103
|
-
if (isProcessing || !deadDropSender)
|
|
104
|
-
return;
|
|
105
|
-
isProcessing = true;
|
|
106
|
-
let msg = messageQueue.shift();
|
|
107
|
-
while (msg) {
|
|
108
|
-
await deadDropSender(msg.content, msg.user);
|
|
109
|
-
msg = messageQueue.shift();
|
|
110
|
-
}
|
|
111
|
-
isProcessing = false;
|
|
112
|
-
// Resolve flush promise if waiting
|
|
113
|
-
if (flushResolve && messageQueue.length === 0) {
|
|
114
|
-
flushResolve();
|
|
115
|
-
flushResolve = null;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Flush all pending deaddrop sends
|
|
120
|
-
* Call before process.exit to ensure all messages are sent
|
|
121
|
-
*/
|
|
122
|
-
export async function flushDeadDrop() {
|
|
123
|
-
if (messageQueue.length === 0 && !isProcessing)
|
|
124
|
-
return;
|
|
125
|
-
return new Promise((resolve) => {
|
|
126
|
-
flushResolve = resolve;
|
|
127
|
-
// If not already processing, start
|
|
128
|
-
if (!isProcessing) {
|
|
129
|
-
void processQueue();
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Send a message to deaddrop if configured
|
|
135
|
-
*/
|
|
136
|
-
function sendToDeadDrop(message, user) {
|
|
137
|
-
if (deadDropSender) {
|
|
138
|
-
messageQueue.push({ content: message, user });
|
|
139
|
-
void processQueue();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
88
|
/**
|
|
143
89
|
* Print a [RUNNER] operational message with timestamp
|
|
144
90
|
* Automatically sends to Deaddrop if configured (without prefix)
|
|
@@ -157,9 +103,11 @@ export function printRunnerInfo(message) {
|
|
|
157
103
|
/**
|
|
158
104
|
* Print a [CLAUDE] message with timestamp
|
|
159
105
|
* Automatically sends to Deaddrop if configured (without prefix)
|
|
106
|
+
* @param message - Display message (may be truncated/formatted for console)
|
|
107
|
+
* @param rawForDeaddrop - Original unmodified text to send to deaddrop (preserves newlines)
|
|
160
108
|
*/
|
|
161
|
-
export function printClaude(message) {
|
|
109
|
+
export function printClaude(message, rawForDeaddrop) {
|
|
162
110
|
console.log(`${timestampPrefix()}${colors.green}[CLAUDE]${colors.reset} ${message}`);
|
|
163
|
-
sendToDeadDrop(stripAnsi(message), 'Claude Code');
|
|
111
|
+
sendToDeadDrop(stripAnsi(rawForDeaddrop ?? message), 'Claude Code');
|
|
164
112
|
}
|
|
165
113
|
//# sourceMappingURL=colors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/output/colors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,IAAI,EAAE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
|
+
/**
|
|
2
|
+
* Serial message queue for deaddrop communication
|
|
3
|
+
* Encapsulates module-level state into a testable class
|
|
4
|
+
*/
|
|
5
|
+
import type { DeadDropSender, DeadDropUser } from './colors.js';
|
|
6
|
+
/**
|
|
7
|
+
* Serial message queue for deaddrop communication
|
|
8
|
+
* Ensures messages are sent one at a time in order
|
|
9
|
+
*/
|
|
10
|
+
export declare class DeadDropQueue {
|
|
11
|
+
private sender;
|
|
12
|
+
private messageQueue;
|
|
13
|
+
private isProcessing;
|
|
14
|
+
private flushResolve;
|
|
15
|
+
/**
|
|
16
|
+
* Configure the sender function
|
|
17
|
+
* Call once at startup when --deaddrop is enabled
|
|
18
|
+
*/
|
|
19
|
+
configure(sender: DeadDropSender | null): void;
|
|
20
|
+
/**
|
|
21
|
+
* Enqueue a message for sending
|
|
22
|
+
*/
|
|
23
|
+
send(message: string, user: DeadDropUser): void;
|
|
24
|
+
/**
|
|
25
|
+
* Wait for all pending messages to be sent
|
|
26
|
+
* Call before process.exit to ensure delivery
|
|
27
|
+
*/
|
|
28
|
+
flush(): Promise<void>;
|
|
29
|
+
private processQueue;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Configure the deaddrop sender for all output functions
|
|
33
|
+
* Call once at startup when --deaddrop is enabled
|
|
34
|
+
*/
|
|
35
|
+
export declare function configureDeadDrop(sender: DeadDropSender | null): void;
|
|
36
|
+
/**
|
|
37
|
+
* Send a message to deaddrop if configured
|
|
38
|
+
*/
|
|
39
|
+
export declare function sendToDeadDrop(message: string, user: DeadDropUser): void;
|
|
40
|
+
/**
|
|
41
|
+
* Flush all pending deaddrop sends
|
|
42
|
+
* Call before process.exit to ensure all messages are sent
|
|
43
|
+
*/
|
|
44
|
+
export declare function flushDeadDrop(): Promise<void>;
|
|
45
|
+
//# sourceMappingURL=deaddrop-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deaddrop-queue.d.ts","sourceRoot":"","sources":["../../src/output/deaddrop-queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhE;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,YAAY,CAA6B;IAEjD;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI;IAI9C;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI;IAO/C;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAWd,YAAY;CAiB3B;AAKD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAErE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAExE;AAED;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAEnD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serial message queue for deaddrop communication
|
|
3
|
+
* Encapsulates module-level state into a testable class
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Serial message queue for deaddrop communication
|
|
7
|
+
* Ensures messages are sent one at a time in order
|
|
8
|
+
*/
|
|
9
|
+
export class DeadDropQueue {
|
|
10
|
+
sender = null;
|
|
11
|
+
messageQueue = [];
|
|
12
|
+
isProcessing = false;
|
|
13
|
+
flushResolve = null;
|
|
14
|
+
/**
|
|
15
|
+
* Configure the sender function
|
|
16
|
+
* Call once at startup when --deaddrop is enabled
|
|
17
|
+
*/
|
|
18
|
+
configure(sender) {
|
|
19
|
+
this.sender = sender;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Enqueue a message for sending
|
|
23
|
+
*/
|
|
24
|
+
send(message, user) {
|
|
25
|
+
if (this.sender) {
|
|
26
|
+
this.messageQueue.push({ content: message, user });
|
|
27
|
+
void this.processQueue();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Wait for all pending messages to be sent
|
|
32
|
+
* Call before process.exit to ensure delivery
|
|
33
|
+
*/
|
|
34
|
+
async flush() {
|
|
35
|
+
if (this.messageQueue.length === 0 && !this.isProcessing)
|
|
36
|
+
return;
|
|
37
|
+
return new Promise((resolve) => {
|
|
38
|
+
this.flushResolve = resolve;
|
|
39
|
+
if (!this.isProcessing) {
|
|
40
|
+
void this.processQueue();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async processQueue() {
|
|
45
|
+
if (this.isProcessing || !this.sender)
|
|
46
|
+
return;
|
|
47
|
+
this.isProcessing = true;
|
|
48
|
+
let msg = this.messageQueue.shift();
|
|
49
|
+
while (msg) {
|
|
50
|
+
await this.sender(msg.content, msg.user);
|
|
51
|
+
msg = this.messageQueue.shift();
|
|
52
|
+
}
|
|
53
|
+
this.isProcessing = false;
|
|
54
|
+
if (this.flushResolve && this.messageQueue.length === 0) {
|
|
55
|
+
this.flushResolve();
|
|
56
|
+
this.flushResolve = null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Singleton instance (maintains backward compatibility)
|
|
61
|
+
const defaultQueue = new DeadDropQueue();
|
|
62
|
+
/**
|
|
63
|
+
* Configure the deaddrop sender for all output functions
|
|
64
|
+
* Call once at startup when --deaddrop is enabled
|
|
65
|
+
*/
|
|
66
|
+
export function configureDeadDrop(sender) {
|
|
67
|
+
defaultQueue.configure(sender);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Send a message to deaddrop if configured
|
|
71
|
+
*/
|
|
72
|
+
export function sendToDeadDrop(message, user) {
|
|
73
|
+
defaultQueue.send(message, user);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Flush all pending deaddrop sends
|
|
77
|
+
* Call before process.exit to ensure all messages are sent
|
|
78
|
+
*/
|
|
79
|
+
export async function flushDeadDrop() {
|
|
80
|
+
return defaultQueue.flush();
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=deaddrop-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deaddrop-queue.js","sourceRoot":"","sources":["../../src/output/deaddrop-queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;GAGG;AACH,MAAM,OAAO,aAAa;IAChB,MAAM,GAA0B,IAAI,CAAC;IACrC,YAAY,GAAoB,EAAE,CAAC;IACnC,YAAY,GAAG,KAAK,CAAC;IACrB,YAAY,GAAwB,IAAI,CAAC;IAEjD;;;OAGG;IACH,SAAS,CAAC,MAA6B;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAe,EAAE,IAAkB;QACtC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YACnD,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY;YAAE,OAAO;QAEjE,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBACvB,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,YAAY;QACxB,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QAC9C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB,IAAI,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QACpC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;YACzC,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAClC,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxD,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AAED,wDAAwD;AACxD,MAAM,YAAY,GAAG,IAAI,aAAa,EAAE,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA6B;IAC7D,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,IAAkB;IAChE,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,YAAY,CAAC,KAAK,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -13,6 +13,10 @@ export interface FormatterState {
|
|
|
13
13
|
activeTask: ActiveTask | null;
|
|
14
14
|
toolStartTimes: Map<string, number>;
|
|
15
15
|
currentStep: number;
|
|
16
|
+
/** When true, step completion is not printed (caller handles it) */
|
|
17
|
+
suppressStepCompletion: boolean;
|
|
18
|
+
/** Duration from last result message (for caller to use) */
|
|
19
|
+
lastStepDurationMs: number | null;
|
|
16
20
|
}
|
|
17
21
|
export declare function createFormatterState(): FormatterState;
|
|
18
22
|
export declare function resetFormatterState(state: FormatterState): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,aAAa,EASnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,aAAa,EASnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAuB5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,sBAAsB,EAAE,OAAO,CAAC;IAChC,4DAA4D;IAC5D,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAUrD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAK/D;AA2ED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,SAAS,GACnB,IAAI,CAuBN;AAoFD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAM,EAAE,sCAAsC;AACvD,mBAAmB,EAAE,MAAM,GAC1B,MAAM,CA4GR"}
|
package/dist/output/formatter.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { isAssistantMessage, isResultMessage, isSystemInitMessage, isTextBlock, isToolResultBlock, isToolUseBlock, isUserMessage, } from '../types/claude.js';
|
|
5
5
|
import { NOISE_PATTERNS, } from '../types/runner.js';
|
|
6
|
+
import { MAX_RESULT_LINES, TRUNCATE_ANSWER, TRUNCATE_BASH_CMD, TRUNCATE_ERROR, TRUNCATE_GREP_PATTERN, TRUNCATE_MESSAGE, TRUNCATE_TASK_DESC, TRUNCATE_TASK_SUMMARY, TRUNCATE_TASK_VERBOSE, TRUNCATE_TOOL_JSON, TRUNCATE_VERBOSE_LINE, } from '../utils/constants.js';
|
|
6
7
|
import { colors, formatDuration, printClaude, printRunner, shortenPath, timestampPrefix, truncate, } from './colors.js';
|
|
7
8
|
export function createFormatterState() {
|
|
8
9
|
return {
|
|
@@ -11,6 +12,8 @@ export function createFormatterState() {
|
|
|
11
12
|
activeTask: null,
|
|
12
13
|
toolStartTimes: new Map(),
|
|
13
14
|
currentStep: 1,
|
|
15
|
+
suppressStepCompletion: true,
|
|
16
|
+
lastStepDurationMs: null,
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
19
|
export function resetFormatterState(state) {
|
|
@@ -53,16 +56,16 @@ function formatToolUse(tool, indented, state) {
|
|
|
53
56
|
summary = input['pattern'] ?? '';
|
|
54
57
|
}
|
|
55
58
|
else if (name === 'Grep') {
|
|
56
|
-
summary = `"${truncate(input['pattern'] ?? '',
|
|
59
|
+
summary = `"${truncate(input['pattern'] ?? '', TRUNCATE_GREP_PATTERN)}"`;
|
|
57
60
|
}
|
|
58
61
|
else if (name === 'Bash') {
|
|
59
|
-
summary = truncate(input['command'] ?? '',
|
|
62
|
+
summary = truncate(input['command'] ?? '', TRUNCATE_BASH_CMD);
|
|
60
63
|
}
|
|
61
64
|
else if (name === 'Task') {
|
|
62
65
|
const taskType = input['subagent_type'] ?? 'agent';
|
|
63
66
|
const taskDesc = truncate(input['description'] ??
|
|
64
67
|
input['prompt'] ??
|
|
65
|
-
'',
|
|
68
|
+
'', TRUNCATE_TASK_DESC);
|
|
66
69
|
summary = `${colors.magenta}${taskType}${colors.reset}: ${taskDesc}`;
|
|
67
70
|
// Mark task as active and print task header
|
|
68
71
|
state.activeTask = { name: taskType, description: taskDesc, id: tool.id };
|
|
@@ -74,7 +77,7 @@ function formatToolUse(tool, indented, state) {
|
|
|
74
77
|
summary = shortenPath(input['file_path'] ?? '');
|
|
75
78
|
}
|
|
76
79
|
else {
|
|
77
|
-
summary = truncate(JSON.stringify(input),
|
|
80
|
+
summary = truncate(JSON.stringify(input), TRUNCATE_TOOL_JSON);
|
|
78
81
|
}
|
|
79
82
|
console.log(`${prefix}${colors.cyan}${name}${colors.reset} ${summary}`);
|
|
80
83
|
}
|
|
@@ -121,13 +124,12 @@ function printToolResult(result, durationStr, verbosity, state) {
|
|
|
121
124
|
: JSON.stringify(result.content);
|
|
122
125
|
const filtered = filterNoiseLines(content);
|
|
123
126
|
const lines = filtered.split('\n').filter((l) => l.trim());
|
|
124
|
-
const
|
|
125
|
-
const showLines = lines.slice(0, maxLines);
|
|
127
|
+
const showLines = lines.slice(0, MAX_RESULT_LINES);
|
|
126
128
|
for (const line of showLines) {
|
|
127
|
-
console.log(`${timestampPrefix()}${indent} ${colors.dim}${truncate(line,
|
|
129
|
+
console.log(`${timestampPrefix()}${indent} ${colors.dim}${truncate(line, TRUNCATE_VERBOSE_LINE)}${colors.reset}`);
|
|
128
130
|
}
|
|
129
|
-
if (lines.length >
|
|
130
|
-
console.log(`${timestampPrefix()}${indent} ${colors.dim}... (${lines.length -
|
|
131
|
+
if (lines.length > MAX_RESULT_LINES) {
|
|
132
|
+
console.log(`${timestampPrefix()}${indent} ${colors.dim}... (${lines.length - MAX_RESULT_LINES} more lines)${colors.reset}${durationStr}`);
|
|
131
133
|
}
|
|
132
134
|
else if (durationStr) {
|
|
133
135
|
console.log(`${timestampPrefix()}${indent} ${durationStr}`);
|
|
@@ -148,7 +150,7 @@ function printTaskResult(result, durationStr, verbosity, state) {
|
|
|
148
150
|
.filter((l) => l.trim() && !l.includes('agentId:'));
|
|
149
151
|
// Show task result summary
|
|
150
152
|
if (lines.length > 0) {
|
|
151
|
-
const maxLen = verbosity === 'verbose' ?
|
|
153
|
+
const maxLen = verbosity === 'verbose' ? TRUNCATE_TASK_VERBOSE : TRUNCATE_TASK_SUMMARY;
|
|
152
154
|
const summary = lines.join(' ').replace(/\s+/g, ' ');
|
|
153
155
|
console.log(`${timestampPrefix()} ${colors.green}→ ${truncate(summary, maxLen)}${colors.reset}`);
|
|
154
156
|
}
|
|
@@ -174,13 +176,13 @@ parallelThresholdMs) {
|
|
|
174
176
|
// Show answers but not thinking/status updates
|
|
175
177
|
if (!block.text.startsWith("I'll ") &&
|
|
176
178
|
!block.text.startsWith('Let me ')) {
|
|
177
|
-
const
|
|
178
|
-
console.log(`${timestampPrefix()}${colors.green}[ANSWER]${colors.reset} ${truncate(
|
|
179
|
+
const displayText = block.text.replace(/[\r\n]+/g, ' ').trim();
|
|
180
|
+
console.log(`${timestampPrefix()}${colors.green}[ANSWER]${colors.reset} ${truncate(displayText, TRUNCATE_ANSWER)}`);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
else {
|
|
182
|
-
const
|
|
183
|
-
printClaude(text);
|
|
184
|
+
const displayText = block.text.replace(/[\r\n]+/g, ' ').trim();
|
|
185
|
+
printClaude(displayText, block.text);
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
else if (isToolUseBlock(block)) {
|
|
@@ -230,7 +232,7 @@ parallelThresholdMs) {
|
|
|
230
232
|
content.startsWith('Error:') ||
|
|
231
233
|
content.startsWith('error:');
|
|
232
234
|
if (isError) {
|
|
233
|
-
console.log(`${timestampPrefix()} ${colors.red}ERROR: ${truncate(content,
|
|
235
|
+
console.log(`${timestampPrefix()} ${colors.red}ERROR: ${truncate(content, TRUNCATE_ERROR)}${colors.reset}${durationStr}`);
|
|
234
236
|
}
|
|
235
237
|
else if (state.activeTask?.id === toolUseId) {
|
|
236
238
|
// Task completing
|
|
@@ -244,14 +246,15 @@ parallelThresholdMs) {
|
|
|
244
246
|
}
|
|
245
247
|
else if (isResultMessage(msg)) {
|
|
246
248
|
flushPendingTools(state, verbosity);
|
|
247
|
-
|
|
249
|
+
state.lastStepDurationMs = msg.duration_ms ?? null;
|
|
250
|
+
if (!state.suppressStepCompletion && verbosity !== 'quiet') {
|
|
248
251
|
const duration = msg.duration_ms ? formatDuration(msg.duration_ms) : '?';
|
|
249
252
|
printRunner(`Completed step ${state.currentStep} in ${duration}`);
|
|
250
253
|
}
|
|
251
254
|
}
|
|
252
255
|
else {
|
|
253
256
|
if (verbosity === 'verbose') {
|
|
254
|
-
console.log(`${timestampPrefix()}${colors.dim}[${msg.type.toUpperCase()}] ${truncate(JSON.stringify(msg),
|
|
257
|
+
console.log(`${timestampPrefix()}${colors.dim}[${msg.type.toUpperCase()}] ${truncate(JSON.stringify(msg), TRUNCATE_MESSAGE)}${colors.reset}`);
|
|
255
258
|
}
|
|
256
259
|
}
|
|
257
260
|
return claudeText;
|