@rcrsr/claude-code-runner 0.3.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 +131 -37
- package/dist/cli/args.d.ts +0 -3
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +74 -25
- package/dist/cli/args.js.map +1 -1
- package/dist/core/runner.d.ts +6 -2
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +31 -23
- package/dist/core/runner.js.map +1 -1
- package/dist/deaddrop/client.d.ts +23 -0
- package/dist/deaddrop/client.d.ts.map +1 -0
- package/dist/deaddrop/client.js +47 -0
- package/dist/deaddrop/client.js.map +1 -0
- package/dist/deaddrop/index.d.ts +2 -0
- package/dist/deaddrop/index.d.ts.map +1 -0
- package/dist/deaddrop/index.js +2 -0
- package/dist/deaddrop/index.js.map +1 -0
- package/dist/index.js +115 -44
- package/dist/index.js.map +1 -1
- package/dist/output/colors.d.ts +25 -5
- package/dist/output/colors.d.ts.map +1 -1
- package/dist/output/colors.js +33 -14
- 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 +5 -0
- package/dist/output/formatter.d.ts.map +1 -1
- package/dist/output/formatter.js +24 -22
- 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 +38 -9
- package/dist/templates/command.d.ts.map +1 -1
- package/dist/templates/command.js +81 -27
- 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 +13 -0
- package/dist/types/runner.d.ts.map +1 -1
- package/dist/types/runner.js +5 -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
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeadDrop client for sending messages to a Deaddrop endpoint
|
|
3
|
+
* https://deaddrop.sh
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_HOST = 'https://deaddrop.bezoan.com';
|
|
6
|
+
/**
|
|
7
|
+
* Create a DeadDrop client from environment variables
|
|
8
|
+
* Returns null if DEADDROP_API_KEY is not set
|
|
9
|
+
*/
|
|
10
|
+
export function createDeadDropClientFromEnv(runId) {
|
|
11
|
+
const apiKey = process.env['DEADDROP_API_KEY'];
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const host = process.env['DEADDROP_HOST'] ?? DEFAULT_HOST;
|
|
16
|
+
return createDeadDropClient({ apiKey, host, runId });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a DeadDrop client with the given configuration
|
|
20
|
+
*/
|
|
21
|
+
export function createDeadDropClient(config) {
|
|
22
|
+
const host = config.host.replace(/\/+$/, ''); // Remove trailing slashes
|
|
23
|
+
const url = `${host}/v1/messages`;
|
|
24
|
+
return {
|
|
25
|
+
async send(content, user) {
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetch(url, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'text/markdown',
|
|
31
|
+
'X-API-Key': config.apiKey,
|
|
32
|
+
'X-DeadDrop-User': user,
|
|
33
|
+
'X-DeadDrop-Subject': config.runId,
|
|
34
|
+
},
|
|
35
|
+
body: content,
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
console.warn(`[DEADDROP] Warning: Failed to send message (${response.status})`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
console.warn(`[DEADDROP] Warning: ${err.message}`);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/deaddrop/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,MAAM,YAAY,GAAG,6BAA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AAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deaddrop/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/deaddrop/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,21 +3,53 @@
|
|
|
3
3
|
* Claude Code Runner - executes claude CLI with proper TTY handling
|
|
4
4
|
* Shows intermediate tool calls and responses in real-time
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { randomBytes } from 'crypto';
|
|
7
|
+
import { parseArgs } from './cli/args.js';
|
|
8
|
+
import { runWithSignals, } from './core/runner.js';
|
|
9
|
+
import { createDeadDropClientFromEnv } from './deaddrop/index.js';
|
|
10
|
+
import { configureDeadDrop, flushDeadDrop, printRunner, printRunnerInfo, } from './output/colors.js';
|
|
9
11
|
import { createFormatterState } from './output/formatter.js';
|
|
10
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';
|
|
11
15
|
import { DEFAULT_CONFIG } from './types/runner.js';
|
|
16
|
+
import { formatSize } from './utils/formatting.js';
|
|
17
|
+
/**
|
|
18
|
+
* Generate a short unique run ID (8 chars, uppercase)
|
|
19
|
+
*/
|
|
20
|
+
function generateRunId() {
|
|
21
|
+
return randomBytes(4).toString('hex').toUpperCase();
|
|
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
|
+
}
|
|
12
33
|
async function main() {
|
|
13
34
|
const totalStart = Date.now();
|
|
14
35
|
const args = process.argv.slice(2);
|
|
15
36
|
const parsed = parseArgs(args);
|
|
37
|
+
// Generate run ID for this session
|
|
38
|
+
const runId = generateRunId();
|
|
16
39
|
// Merge config with defaults
|
|
17
40
|
const config = {
|
|
18
41
|
...DEFAULT_CONFIG,
|
|
19
42
|
...parsed.config,
|
|
20
43
|
};
|
|
44
|
+
// Configure deaddrop if enabled
|
|
45
|
+
if (config.deaddrop) {
|
|
46
|
+
const client = createDeadDropClientFromEnv(runId);
|
|
47
|
+
if (!client) {
|
|
48
|
+
console.error('Error: --deaddrop requires DEADDROP_API_KEY environment variable');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
configureDeadDrop(client.send.bind(client));
|
|
52
|
+
}
|
|
21
53
|
// Create logger
|
|
22
54
|
const commandName = parsed.scriptMode
|
|
23
55
|
? 'script'
|
|
@@ -33,69 +65,108 @@ async function main() {
|
|
|
33
65
|
logger,
|
|
34
66
|
formatterState,
|
|
35
67
|
cwd: process.cwd(),
|
|
68
|
+
runId,
|
|
36
69
|
};
|
|
37
|
-
//
|
|
38
|
-
printRunner(`
|
|
70
|
+
// Emit starting run message first (operational, sent to deaddrop)
|
|
71
|
+
printRunner(`Starting run ${runId}`);
|
|
72
|
+
// Print config with [RUNNER] messages (informational, not sent to deaddrop)
|
|
73
|
+
printRunnerInfo(`Mode: ${parsed.subcommand} | Verbosity: ${config.verbosity}`);
|
|
39
74
|
if (config.model) {
|
|
40
|
-
|
|
75
|
+
printRunnerInfo(`Model: ${config.model}`);
|
|
76
|
+
}
|
|
77
|
+
if (config.deaddrop) {
|
|
78
|
+
printRunnerInfo(`Deaddrop: enabled`);
|
|
41
79
|
}
|
|
42
80
|
if (logger.filePath) {
|
|
43
|
-
|
|
81
|
+
printRunnerInfo(`Log: ${logger.filePath}`);
|
|
44
82
|
}
|
|
45
83
|
logger.log(`Started: ${new Date().toISOString()}`);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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;
|
|
49
91
|
}
|
|
50
92
|
else {
|
|
51
|
-
// Single command
|
|
52
|
-
|
|
93
|
+
// Single prompt or command becomes a 1-step script
|
|
94
|
+
lines = [{ type: 'prompt', text: parsed.prompt }];
|
|
53
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);
|
|
54
101
|
}
|
|
55
102
|
/**
|
|
56
|
-
*
|
|
103
|
+
* Build display string for a script line
|
|
57
104
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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}")`;
|
|
63
111
|
}
|
|
64
112
|
/**
|
|
65
|
-
* Run
|
|
113
|
+
* Run a script (unified execution for single prompts and multi-step scripts)
|
|
66
114
|
*/
|
|
67
|
-
async function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
for (const [i, line] of
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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;
|
|
76
126
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
127
|
+
else {
|
|
128
|
+
const template = loadCommandTemplate(line.name, line.args);
|
|
129
|
+
promptText = template.prompt;
|
|
80
130
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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;
|
|
87
156
|
}
|
|
157
|
+
completedSteps++;
|
|
88
158
|
}
|
|
89
|
-
//
|
|
90
|
-
const totalDuration =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
context.
|
|
94
|
-
|
|
159
|
+
// Print completion with run ID, step count, and duration
|
|
160
|
+
const totalDuration = Date.now() - startTime;
|
|
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;
|
|
95
165
|
}
|
|
96
166
|
// Run main
|
|
97
167
|
main().catch((err) => {
|
|
98
|
-
|
|
168
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
169
|
+
console.error(`Error: ${message}`);
|
|
99
170
|
process.exit(1);
|
|
100
171
|
});
|
|
101
172
|
//# sourceMappingURL=index.js.map
|
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,
|
|
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,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C,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACzD,MAAM,WAAW,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD,WAAW,CACT,iBAAiB,OAAO,CAAC,KAAK,KAAK,cAAc,IAAI,QAAQ,QAAQ,WAAW,GAAG,CACpF,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;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";
|
|
@@ -24,6 +26,7 @@ export declare function colorize(text: string, color: ColorName): string;
|
|
|
24
26
|
export declare function truncate(str: string, len: number): string;
|
|
25
27
|
/**
|
|
26
28
|
* Format duration in human-readable form
|
|
29
|
+
* Examples: 450ms, 2.5s, 1m30s, 1h2m3s
|
|
27
30
|
*/
|
|
28
31
|
export declare function formatDuration(ms: number): string;
|
|
29
32
|
/**
|
|
@@ -34,16 +37,33 @@ export declare function shortenPath(filePath: string): string;
|
|
|
34
37
|
* Format current timestamp as HH:MM:SS.mmm
|
|
35
38
|
*/
|
|
36
39
|
export declare function formatTimestamp(date?: Date): string;
|
|
37
|
-
/**
|
|
38
|
-
* Format elapsed seconds as hh:mm:ss
|
|
39
|
-
*/
|
|
40
|
-
export declare function formatElapsed(seconds: number): string;
|
|
41
40
|
/**
|
|
42
41
|
* Get a timestamped prefix for output lines
|
|
43
42
|
*/
|
|
44
43
|
export declare function timestampPrefix(): string;
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
45
|
+
* Deaddrop user type
|
|
46
|
+
*/
|
|
47
|
+
export type DeadDropUser = 'Runner' | 'Claude Code';
|
|
48
|
+
/**
|
|
49
|
+
* Deaddrop send function type (to avoid circular imports)
|
|
50
|
+
*/
|
|
51
|
+
export type DeadDropSender = (content: string, user: DeadDropUser) => Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Print a [RUNNER] operational message with timestamp
|
|
54
|
+
* Automatically sends to Deaddrop if configured (without prefix)
|
|
47
55
|
*/
|
|
48
56
|
export declare function printRunner(message: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Print a [RUNNER] informational message with timestamp
|
|
59
|
+
* Does NOT send to Deaddrop (used for startup config, debug info)
|
|
60
|
+
*/
|
|
61
|
+
export declare function printRunnerInfo(message: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Print a [CLAUDE] message with timestamp
|
|
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)
|
|
67
|
+
*/
|
|
68
|
+
export declare function printClaude(message: string, rawForDeaddrop?: string): void;
|
|
49
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,SAA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G;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',
|
|
@@ -37,16 +40,22 @@ export function truncate(str, len) {
|
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
42
|
* Format duration in human-readable form
|
|
43
|
+
* Examples: 450ms, 2.5s, 1m30s, 1h2m3s
|
|
40
44
|
*/
|
|
41
45
|
export function formatDuration(ms) {
|
|
42
46
|
if (ms < 1000) {
|
|
43
47
|
return `${ms}ms`;
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
const totalSeconds = ms / 1000;
|
|
50
|
+
if (totalSeconds < 60) {
|
|
51
|
+
return `${totalSeconds.toFixed(1)}s`;
|
|
52
|
+
}
|
|
53
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
54
|
+
const mins = Math.floor((totalSeconds % 3600) / 60);
|
|
55
|
+
const secs = Math.round(totalSeconds % 60);
|
|
56
|
+
if (hours > 0) {
|
|
57
|
+
return `${hours}h${mins}m${secs}s`;
|
|
47
58
|
}
|
|
48
|
-
const mins = Math.floor(ms / 60000);
|
|
49
|
-
const secs = ((ms % 60000) / 1000).toFixed(0);
|
|
50
59
|
return `${mins}m${secs}s`;
|
|
51
60
|
}
|
|
52
61
|
/**
|
|
@@ -70,15 +79,6 @@ export function formatTimestamp(date = new Date()) {
|
|
|
70
79
|
const ms = date.getMilliseconds().toString().padStart(3, '0');
|
|
71
80
|
return `${h}:${m}:${s}.${ms}`;
|
|
72
81
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Format elapsed seconds as hh:mm:ss
|
|
75
|
-
*/
|
|
76
|
-
export function formatElapsed(seconds) {
|
|
77
|
-
const h = Math.floor(seconds / 3600);
|
|
78
|
-
const m = Math.floor((seconds % 3600) / 60);
|
|
79
|
-
const s = seconds % 60;
|
|
80
|
-
return `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
|
|
81
|
-
}
|
|
82
82
|
/**
|
|
83
83
|
* Get a timestamped prefix for output lines
|
|
84
84
|
*/
|
|
@@ -86,9 +86,28 @@ export function timestampPrefix() {
|
|
|
86
86
|
return `${colors.dim}${formatTimestamp()}${colors.reset} `;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* Print a [RUNNER]
|
|
89
|
+
* Print a [RUNNER] operational message with timestamp
|
|
90
|
+
* Automatically sends to Deaddrop if configured (without prefix)
|
|
90
91
|
*/
|
|
91
92
|
export function printRunner(message) {
|
|
92
93
|
console.log(`${timestampPrefix()}${colors.magenta}[RUNNER]${colors.reset} ${message}`);
|
|
94
|
+
sendToDeadDrop(stripAnsi(message), 'Runner');
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Print a [RUNNER] informational message with timestamp
|
|
98
|
+
* Does NOT send to Deaddrop (used for startup config, debug info)
|
|
99
|
+
*/
|
|
100
|
+
export function printRunnerInfo(message) {
|
|
101
|
+
console.log(`${timestampPrefix()}${colors.magenta}[RUNNER]${colors.reset} ${message}`);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Print a [CLAUDE] message with timestamp
|
|
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)
|
|
108
|
+
*/
|
|
109
|
+
export function printClaude(message, rawForDeaddrop) {
|
|
110
|
+
console.log(`${timestampPrefix()}${colors.green}[CLAUDE]${colors.reset} ${message}`);
|
|
111
|
+
sendToDeadDrop(stripAnsi(rawForDeaddrop ?? message), 'Claude Code');
|
|
93
112
|
}
|
|
94
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,UAAU;IAChB,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;CACR,CAAC;AAIX;;GAEG;AACH,4FAA4F;AAC5F,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAE5C,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAgB;IACrD,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAA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xE,CAAC;IACF,cAAc,CAAC,SAAS,CAAC,cAAc,IAAI,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
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,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12,6 +12,11 @@ export interface FormatterState {
|
|
|
12
12
|
lastToolTime: number | null;
|
|
13
13
|
activeTask: ActiveTask | null;
|
|
14
14
|
toolStartTimes: Map<string, number>;
|
|
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;
|
|
15
20
|
}
|
|
16
21
|
export declare function createFormatterState(): FormatterState;
|
|
17
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,4DAA4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