@hmharness/cli 0.18.3 → 0.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +6 -0
- package/dist/tui.d.ts +13 -0
- package/dist/tui.js +49 -5
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -155,6 +155,12 @@ async function repl(yes, initialHistory, initialSessionId) {
|
|
|
155
155
|
if (line === '/yolo' || line === '/yolo on' || line === '/yolo off') {
|
|
156
156
|
const turnOn = line === '/yolo' ? !autoApprove : line === '/yolo on';
|
|
157
157
|
autoApprove = turnOn;
|
|
158
|
+
// 2026-09-25: live effect + persistent default (same as the TUI)
|
|
159
|
+
(await import('@hmharness/agent')).liveYolo.on = turnOn;
|
|
160
|
+
try {
|
|
161
|
+
cfg = await (await import('@hmharness/kernel')).patchConfig({ approval: turnOn ? 'auto' : 'ask' });
|
|
162
|
+
}
|
|
163
|
+
catch { /* runtime only */ }
|
|
158
164
|
stdout.write((turnOn ? YELLOW(t.yoloOn) : DIM(t.yoloOff)) + '\n');
|
|
159
165
|
continue;
|
|
160
166
|
}
|
package/dist/tui.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type SessionSummary } from '@hmharness/kernel';
|
|
2
2
|
import { type Locale } from '@hmharness/agent';
|
|
3
|
+
interface Entry {
|
|
4
|
+
lines: string[];
|
|
5
|
+
}
|
|
3
6
|
/** desc keys index into Strings (agent i18n); matched by name at runtime. */
|
|
4
7
|
export declare const COMMANDS: Array<{
|
|
5
8
|
name: string;
|
|
@@ -292,6 +295,15 @@ export declare class TuiRuntime {
|
|
|
292
295
|
* LAST cell to its full output. */
|
|
293
296
|
addToolCell(folded: string, full: string): void;
|
|
294
297
|
toggleLastCell(): boolean;
|
|
298
|
+
/** In-progress tool call: ONE line that the result later REPLACES in
|
|
299
|
+
* place (2026-09-25 user request: consecutive tool calls used to cost
|
|
300
|
+
* two transcript lines each - the `● name args` line plus the folded
|
|
301
|
+
* `⎿ result` line - and a run of ten calls buried the conversation).
|
|
302
|
+
* Returns the mutable entry so settleToolCall() can swap it. */
|
|
303
|
+
startToolCall(display: string): Entry;
|
|
304
|
+
/** Fold a settled tool call onto its start line and register it as a
|
|
305
|
+
* z-expandable cell (same cell semantics as addToolCell). */
|
|
306
|
+
settleToolCall(entry: Entry, folded: string, full: string): void;
|
|
295
307
|
/** Light zero-dep markdown line color for STREAMED text: headings cyan,
|
|
296
308
|
* list markers dim, fences dim, blockquotes dim; everything else plain.
|
|
297
309
|
* Applied per completed line so already-stable rows never reflow. */
|
|
@@ -313,3 +325,4 @@ export declare class TuiRuntime {
|
|
|
313
325
|
export declare function tui(yes: boolean, noWeb?: boolean, opts?: {
|
|
314
326
|
resumeAtStart?: boolean;
|
|
315
327
|
}): Promise<void>;
|
|
328
|
+
export {};
|
package/dist/tui.js
CHANGED
|
@@ -991,6 +991,27 @@ export class TuiRuntime {
|
|
|
991
991
|
this.dirty = true;
|
|
992
992
|
return true;
|
|
993
993
|
}
|
|
994
|
+
/** In-progress tool call: ONE line that the result later REPLACES in
|
|
995
|
+
* place (2026-09-25 user request: consecutive tool calls used to cost
|
|
996
|
+
* two transcript lines each - the `● name args` line plus the folded
|
|
997
|
+
* `⎿ result` line - and a run of ten calls buried the conversation).
|
|
998
|
+
* Returns the mutable entry so settleToolCall() can swap it. */
|
|
999
|
+
startToolCall(display) {
|
|
1000
|
+
const width = Math.max(20, (stdout.columns || 100) - 2);
|
|
1001
|
+
const entry = { lines: wrapTo(display, width) };
|
|
1002
|
+
this.entries.push(entry);
|
|
1003
|
+
this.scrollFromBottom = 0;
|
|
1004
|
+
this.dirty = true;
|
|
1005
|
+
return entry;
|
|
1006
|
+
}
|
|
1007
|
+
/** Fold a settled tool call onto its start line and register it as a
|
|
1008
|
+
* z-expandable cell (same cell semantics as addToolCell). */
|
|
1009
|
+
settleToolCall(entry, folded, full) {
|
|
1010
|
+
const width = Math.max(20, (stdout.columns || 100) - 2);
|
|
1011
|
+
entry.lines = wrapTo(folded, width).map((l) => DIM(l));
|
|
1012
|
+
this.toolCells.push({ entry, full, folded, expanded: false });
|
|
1013
|
+
this.dirty = true;
|
|
1014
|
+
}
|
|
994
1015
|
/* ---------------- M4: streaming markdown colorizer (B10) ---------------- */
|
|
995
1016
|
/** Light zero-dep markdown line color for STREAMED text: headings cyan,
|
|
996
1017
|
* list markers dim, fences dim, blockquotes dim; everything else plain.
|
|
@@ -2032,6 +2053,10 @@ export async function tui(yes, noWeb = false, opts = {}) {
|
|
|
2032
2053
|
fullToolLog.push({ name: 'thinking', output: reasoningBuf.slice(0, 8000) });
|
|
2033
2054
|
} reasoningBuf = ''; rt.foldThinking(); };
|
|
2034
2055
|
let kind = null;
|
|
2056
|
+
// the in-flight tool call's transcript entry: the result REPLACES it
|
|
2057
|
+
// in place (one line per call, 2026-09-25)
|
|
2058
|
+
let pendingToolEntry = null;
|
|
2059
|
+
let pendingToolName = null;
|
|
2035
2060
|
try {
|
|
2036
2061
|
const result = await runAgentTask({
|
|
2037
2062
|
task: line,
|
|
@@ -2076,14 +2101,24 @@ export async function tui(yes, noWeb = false, opts = {}) {
|
|
|
2076
2101
|
const brief = name === 'run_command' && typeof args.command === 'string'
|
|
2077
2102
|
? args.command
|
|
2078
2103
|
: JSON.stringify(args);
|
|
2079
|
-
|
|
2104
|
+
// ONE line per call (2026-09-25): the running `● name args` line
|
|
2105
|
+
// is REPLACED in place by the folded result line on settle, so a
|
|
2106
|
+
// run of N calls costs N transcript lines, not 2N
|
|
2107
|
+
pendingToolEntry = rt.startToolCall(`${YELLOW('●')} ${CYAN(name)} ${DIM(brief.replace(/\s+/g, ' ').slice(0, 90))}`);
|
|
2108
|
+
pendingToolName = name;
|
|
2080
2109
|
},
|
|
2081
2110
|
onToolResult: (name, output, isError) => {
|
|
2082
2111
|
const dot = isError ? RED('✗') : GREEN('•');
|
|
2083
2112
|
const first = output.split('\n').find((l) => l.trim()) ?? '';
|
|
2084
|
-
// M4 B8:
|
|
2085
|
-
//
|
|
2086
|
-
|
|
2113
|
+
// M4 B8 + 2026-09-25: the call line settles INTO the folded cell
|
|
2114
|
+
// (one line per call; `z` with an empty input expands the last)
|
|
2115
|
+
const folded = ` ${dot} ${CYAN(name)} ${DIM('⎿ ' + first.trim().slice(0, 100))}`;
|
|
2116
|
+
if (pendingToolEntry && pendingToolName === name)
|
|
2117
|
+
rt.settleToolCall(pendingToolEntry, folded, output);
|
|
2118
|
+
else
|
|
2119
|
+
rt.addToolCell(folded, output);
|
|
2120
|
+
pendingToolEntry = null;
|
|
2121
|
+
pendingToolName = null;
|
|
2087
2122
|
// M4 B9 (T18 复案 2026-09-21): outputs beyond a screen NO LONGER
|
|
2088
2123
|
// auto-open the full-screen pager - on every system it read as a
|
|
2089
2124
|
// break-in (a wall of raw output hijacking the screen while the
|
|
@@ -2517,8 +2552,17 @@ export async function tui(yes, noWeb = false, opts = {}) {
|
|
|
2517
2552
|
if (line === '/yolo' || line === '/yolo on' || line === '/yolo off') {
|
|
2518
2553
|
const turnOn = line === '/yolo' ? !autoApprove : line === '/yolo on';
|
|
2519
2554
|
autoApprove = turnOn;
|
|
2555
|
+
// 2026-09-25 user request: LIVE effect (the running task's next
|
|
2556
|
+
// approval ask consults this) + PERSISTENT (one toggle = the standing
|
|
2557
|
+
// default; survives restarts via config)
|
|
2558
|
+
(await import('@hmharness/agent')).liveYolo.on = turnOn;
|
|
2559
|
+
try {
|
|
2560
|
+
const { patchConfig } = await import('@hmharness/kernel');
|
|
2561
|
+
cfg = await patchConfig({ approval: turnOn ? 'auto' : 'ask' });
|
|
2562
|
+
}
|
|
2563
|
+
catch { /* runtime toggles still applied */ }
|
|
2520
2564
|
rt.setModeTag(turnOn ? '🔥' : '');
|
|
2521
|
-
rt.addText(turnOn ? t.yoloOn : t.yoloOff
|
|
2565
|
+
rt.addText((turnOn ? t.yoloOn : t.yoloOff) + (turnOn ? '' : ''), 'plain');
|
|
2522
2566
|
return;
|
|
2523
2567
|
}
|
|
2524
2568
|
if (line === '/lang' || line.startsWith('/lang ')) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"description": "hmharness command line: one-shot tasks, an interactive REPL, a fullscreen TUI, the web frontend, and direct tool invocation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@hmharness/evolution": "0.14.25",
|
|
49
49
|
"@hmharness/domain-harmony": "0.13.8",
|
|
50
50
|
"@hmharness/domain-ops": "0.8.3",
|
|
51
|
-
"@hmharness/agent": "0.14.
|
|
51
|
+
"@hmharness/agent": "0.14.20",
|
|
52
52
|
"@hmharness/evaluation": "0.8.6",
|
|
53
|
-
"@hmharness/web": "0.9.
|
|
53
|
+
"@hmharness/web": "0.9.7",
|
|
54
54
|
"@hmharness/sandbox": "0.8.5"
|
|
55
55
|
}
|
|
56
56
|
}
|