@hncode/hncode 0.8.1 → 0.8.2
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 +18 -0
- package/README_CN.md +14 -0
- package/package.json +1 -1
- package/src/agent-task.js +354 -337
- package/src/agent.js +19 -3
- package/src/animate.js +35 -0
- package/src/config.js +25 -7
- package/src/file-tree.js +4 -3
- package/src/highlight.js +20 -6
- package/src/i18n.js +825 -0
- package/src/image-row.js +11 -2
- package/src/index.js +730 -610
- package/src/llm.js +146 -21
- package/src/log-file.js +112 -0
- package/src/markdown.js +619 -567
- package/src/migrate-index.js +175 -0
- package/src/migrate.js +392 -0
- package/src/panels.js +9 -7
- package/src/rows-plan-bg.js +3 -2
- package/src/rows-status.js +20 -6
- package/src/rows-tool-result.js +35 -8
- package/src/screen-paint.js +153 -128
- package/src/session-recover.js +317 -0
- package/src/session.js +203 -13
- package/src/swarm-progress.js +5 -1
- package/src/tasks-browser.js +9 -8
- package/src/team-panel.js +12 -11
- package/src/text.js +192 -149
- package/src/tool-line.js +7 -2
- package/src/tool-result.js +400 -327
- package/src/tools/ask-user-question.js +1 -2
- package/src/tools/bash.js +15 -9
- package/src/tools/edit.js +640 -665
- package/src/tools/goal.js +130 -93
- package/src/tools/read.js +141 -133
- package/src/tools/tasks.js +214 -214
- package/src/tools/utils.js +143 -104
- package/src/tui.js +20689 -19943
|
@@ -53,8 +53,7 @@ Do NOT use it for what you can infer from context, or for trivial decisions —
|
|
|
53
53
|
|
|
54
54
|
Usage:
|
|
55
55
|
- Users always get an "Other" option; do not create one.
|
|
56
|
-
|
|
57
|
-
+ ' options — the user gets a focused field instead of a list.',
|
|
56
|
+
For an answer that cannot be enumerated (a name, a path, a description), set free_text: true and omit options — the user gets a focused field instead of a list.
|
|
58
57
|
- 2-4 distinct options per question, labels 1-5 words, descriptions carry the trade-offs. Labels unique within a question, question texts unique across the call.
|
|
59
58
|
- 1-4 questions at a time, related ones grouped. multi_select allows several answers.
|
|
60
59
|
- Put a recommended option first and append "(Recommended)" to its label.
|
package/src/tools/bash.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import fs from 'node:fs';
|
|
7
7
|
import cp from 'node:child_process';
|
|
8
|
-
import { resolvePath, truncateBuf } from './utils.js';
|
|
8
|
+
import { resolvePath, truncateBuf , similarFileHint } from './utils.js';
|
|
9
9
|
import { createTask, appendTaskOutput, settleTask } from '../agent-task.js';
|
|
10
10
|
import { shellSpawnArgs, getShell } from './shell.js';
|
|
11
11
|
|
|
@@ -152,7 +152,7 @@ export const spec = {
|
|
|
152
152
|
const cwdRaw = args.cwd || ctx.workspace;
|
|
153
153
|
let cwd;
|
|
154
154
|
try { cwd = resolvePath(cwdRaw, ctx); } catch (e) { return e.message; }
|
|
155
|
-
if (!fs.existsSync(cwd)) return `Error: cwd does not exist: ${cwdRaw}
|
|
155
|
+
if (!fs.existsSync(cwd)) return `Error: cwd does not exist: ${cwdRaw}${similarFileHint(cwd)}. Omit cwd to use the workspace root.`;
|
|
156
156
|
|
|
157
157
|
if (args.run_in_background) return spawnBackground(args, cwd, ctx);
|
|
158
158
|
|
|
@@ -372,21 +372,27 @@ function spawnBackground(args, cwd, ctx) {
|
|
|
372
372
|
// still read it. (In the TUI the parent rarely exits, but headless -p mode
|
|
373
373
|
// does, and a background job should outlive the prompt.)
|
|
374
374
|
//
|
|
375
|
-
//
|
|
376
|
-
//
|
|
377
|
-
//
|
|
378
|
-
//
|
|
379
|
-
//
|
|
375
|
+
// AND NOT ON WINDOWS AT ALL. The note above says `detached: true` with piped stdout returns exit 0 and no output; the
|
|
376
|
+
// same is true for a NON-interactive background command, which is the ordinary Ctrl+B case. Measured with pwsh:
|
|
377
|
+
//
|
|
378
|
+
// detached=false "exit 3" -> exit 3, output intact
|
|
379
|
+
// detached=true "exit 3" -> exit 0, output EMPTY
|
|
380
|
+
// detached=true "echo hello" -> exit 0, output EMPTY
|
|
381
|
+
//
|
|
382
|
+
// So on Windows the process stays attached: its output and its exit code are the whole point of a background task, and
|
|
383
|
+
// a task that reports success whatever happened is worse than one that dies with its parent. Elsewhere the detach is
|
|
384
|
+
// what makes a job outlive headless `-p`, so it is kept.
|
|
385
|
+
const canDetach = process.platform !== 'win32' && !args.interactive;
|
|
380
386
|
let shell;
|
|
381
387
|
try { shell = shellSpawnArgs(command, { interactive: args.interactive }); } catch (e) { return `Error: ${e.message}`; }
|
|
382
388
|
const child = cp.spawn(shell.bin, shell.args, {
|
|
383
|
-
cwd, detached:
|
|
389
|
+
cwd, detached: canDetach, stdio: [args.interactive ? 'pipe' : 'ignore', 'pipe', 'pipe'], env: { ...process.env },
|
|
384
390
|
});
|
|
385
391
|
const task = createTask(ctx, 'process', {
|
|
386
392
|
description: args.description || args.command,
|
|
387
393
|
command: args.command,
|
|
388
394
|
pid: child.pid,
|
|
389
|
-
detached:
|
|
395
|
+
detached: canDetach,
|
|
390
396
|
});
|
|
391
397
|
// The stdin pipe, when the caller asked for one. Kept on the TASK so `TaskInput` can reach it from a
|
|
392
398
|
// task id alone — a tool receives an id, not a handle. Only `interactive` gets here, so a plain
|