@dirgha/code 1.20.39 → 1.21.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 +0 -57
- package/README.md +4 -8
- package/dist/auth/keypool.js +26 -40
- package/dist/auth/keypool.js.map +1 -1
- package/dist/auth/keystore.js +11 -16
- package/dist/auth/keystore.js.map +1 -1
- package/dist/cli/config.d.ts +5 -8
- package/dist/cli/config.js +3 -24
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/first-run.js +24 -40
- package/dist/cli/first-run.js.map +1 -1
- package/dist/cli/flows/wizard.js +18 -12
- package/dist/cli/flows/wizard.js.map +1 -1
- package/dist/cli/interactive.d.ts +0 -4
- package/dist/cli/interactive.js +1 -29
- package/dist/cli/interactive.js.map +1 -1
- package/dist/cli/main.js +18 -69
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/slash/fleet.js +1 -19
- package/dist/cli/slash/fleet.js.map +1 -1
- package/dist/cli/slash/models.js +2 -4
- package/dist/cli/slash/models.js.map +1 -1
- package/dist/cli/slash/paste.js +7 -4
- package/dist/cli/slash/paste.js.map +1 -1
- package/dist/cli/slash.js +10 -26
- package/dist/cli/slash.js.map +1 -1
- package/dist/cli/subcommands/audit.js +8 -28
- package/dist/cli/subcommands/audit.js.map +1 -1
- package/dist/cli/subcommands/doctor.d.ts +0 -4
- package/dist/cli/subcommands/doctor.js +21 -82
- package/dist/cli/subcommands/doctor.js.map +1 -1
- package/dist/cli/subcommands/feature-setup.js +6 -6
- package/dist/cli/subcommands/feature-setup.js.map +1 -1
- package/dist/cli/subcommands/memory.js +0 -23
- package/dist/cli/subcommands/memory.js.map +1 -1
- package/dist/cli/subcommands/telemetry.d.ts +1 -2
- package/dist/cli/subcommands/telemetry.js +34 -47
- package/dist/cli/subcommands/telemetry.js.map +1 -1
- package/dist/context/branch.d.ts +2 -2
- package/dist/context/branch.js +23 -40
- package/dist/context/branch.js.map +1 -1
- package/dist/context/compaction.js +22 -45
- package/dist/context/compaction.js.map +1 -1
- package/dist/context/git-state.js +18 -31
- package/dist/context/git-state.js.map +1 -1
- package/dist/context/knowledge.js +20 -31
- package/dist/context/knowledge.js.map +1 -1
- package/dist/context/memory.js +1 -8
- package/dist/context/memory.js.map +1 -1
- package/dist/context/mode-enforcement.js +1 -11
- package/dist/context/mode-enforcement.js.map +1 -1
- package/dist/context/mode.js +30 -67
- package/dist/context/mode.js.map +1 -1
- package/dist/context/primer.js +3 -15
- package/dist/context/primer.js.map +1 -1
- package/dist/fleet/apply-back.js +1 -5
- package/dist/fleet/apply-back.js.map +1 -1
- package/dist/fleet/cli-command.d.ts +0 -2
- package/dist/fleet/cli-command.js +1 -15
- package/dist/fleet/cli-command.js.map +1 -1
- package/dist/fleet/runner.js +2 -35
- package/dist/fleet/runner.js.map +1 -1
- package/dist/fleet/scratchpad.js +2 -1
- package/dist/fleet/scratchpad.js.map +1 -1
- package/dist/fleet/state.d.ts +0 -4
- package/dist/fleet/state.js +2 -11
- package/dist/fleet/state.js.map +1 -1
- package/dist/fleet/templates.d.ts +0 -4
- package/dist/fleet/templates.js.map +1 -1
- package/dist/fleet/types.d.ts +0 -4
- package/dist/fleet/types.js.map +1 -1
- package/dist/intelligence/failover-chain.js +1 -10
- package/dist/intelligence/failover-chain.js.map +1 -1
- package/dist/intelligence/health-monitor.d.ts +8 -8
- package/dist/intelligence/health-monitor.js +74 -105
- package/dist/intelligence/health-monitor.js.map +1 -1
- package/dist/intelligence/prices.d.ts +4 -6
- package/dist/intelligence/prices.js +10 -36
- package/dist/intelligence/prices.js.map +1 -1
- package/dist/kernel/agent-loop.js +17 -60
- package/dist/kernel/agent-loop.js.map +1 -1
- package/dist/lsp/client.js +16 -29
- package/dist/lsp/client.js.map +1 -1
- package/dist/lsp/detector.js +6 -7
- package/dist/lsp/detector.js.map +1 -1
- package/dist/mcp/client.d.ts +1 -1
- package/dist/mcp/client.js +16 -19
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/transport.js +38 -46
- package/dist/mcp/transport.js.map +1 -1
- package/dist/providers/deepseek.js +1 -1
- package/dist/providers/deepseek.js.map +1 -1
- package/dist/providers/dispatch.js +1 -15
- package/dist/providers/dispatch.js.map +1 -1
- package/dist/providers/index.d.ts +0 -11
- package/dist/providers/index.js +2 -29
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/nvidia.js +1 -1
- package/dist/providers/nvidia.js.map +1 -1
- package/dist/providers/openai-compat.js +2 -4
- package/dist/providers/openai-compat.js.map +1 -1
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/safety/audit-log.d.ts +0 -15
- package/dist/safety/audit-log.js +0 -21
- package/dist/safety/audit-log.js.map +1 -1
- package/dist/state/db.js +5 -60
- package/dist/state/db.js.map +1 -1
- package/dist/tools/browser.js +16 -24
- package/dist/tools/browser.js.map +1 -1
- package/dist/tools/checkpoint.d.ts +1 -6
- package/dist/tools/checkpoint.js +62 -79
- package/dist/tools/checkpoint.js.map +1 -1
- package/dist/tools/cron.js +3 -1
- package/dist/tools/cron.js.map +1 -1
- package/dist/tools/diff.js +21 -25
- package/dist/tools/diff.js.map +1 -1
- package/dist/tools/exec.d.ts +0 -2
- package/dist/tools/exec.js +0 -13
- package/dist/tools/exec.js.map +1 -1
- package/dist/tools/fs-edit.d.ts +5 -3
- package/dist/tools/fs-edit.js +23 -8
- package/dist/tools/fs-edit.js.map +1 -1
- package/dist/tools/fs-ls.js +8 -6
- package/dist/tools/fs-ls.js.map +1 -1
- package/dist/tools/fs-read.d.ts +1 -1
- package/dist/tools/fs-read.js +28 -37
- package/dist/tools/fs-read.js.map +1 -1
- package/dist/tools/fs-write.d.ts +1 -1
- package/dist/tools/fs-write.js +33 -33
- package/dist/tools/fs-write.js.map +1 -1
- package/dist/tools/git.js +6 -12
- package/dist/tools/git.js.map +1 -1
- package/dist/tools/index.d.ts +2 -5
- package/dist/tools/index.js +4 -7
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/multimodal.js +12 -11
- package/dist/tools/multimodal.js.map +1 -1
- package/dist/tools/rtk.js +9 -22
- package/dist/tools/rtk.js.map +1 -1
- package/dist/tools/search-glob.d.ts +1 -1
- package/dist/tools/search-glob.js +24 -42
- package/dist/tools/search-glob.js.map +1 -1
- package/dist/tools/search-grep.d.ts +1 -1
- package/dist/tools/search-grep.js +32 -56
- package/dist/tools/search-grep.js.map +1 -1
- package/dist/tools/shell.d.ts +1 -7
- package/dist/tools/shell.js +61 -114
- package/dist/tools/shell.js.map +1 -1
- package/dist/tui/ink/App.d.ts +1 -2
- package/dist/tui/ink/App.js +82 -194
- package/dist/tui/ink/App.js.map +1 -1
- package/dist/tui/ink/components/DenseToolMessage.js +8 -23
- package/dist/tui/ink/components/DenseToolMessage.js.map +1 -1
- package/dist/tui/ink/components/InputBox.js +25 -16
- package/dist/tui/ink/components/InputBox.js.map +1 -1
- package/dist/tui/ink/components/KeySetOverlay.d.ts +1 -1
- package/dist/tui/ink/components/KeySetOverlay.js +16 -18
- package/dist/tui/ink/components/KeySetOverlay.js.map +1 -1
- package/dist/tui/ink/components/Logo.d.ts +0 -20
- package/dist/tui/ink/components/Logo.js +1 -67
- package/dist/tui/ink/components/Logo.js.map +1 -1
- package/dist/tui/ink/components/ModelPicker.d.ts +2 -2
- package/dist/tui/ink/components/ModelPicker.js +26 -34
- package/dist/tui/ink/components/ModelPicker.js.map +1 -1
- package/dist/tui/ink/components/PasteCollapse.d.ts +1 -3
- package/dist/tui/ink/components/PasteCollapse.js +9 -11
- package/dist/tui/ink/components/PasteCollapse.js.map +1 -1
- package/dist/tui/ink/components/SpinnerGlyph.d.ts +4 -4
- package/dist/tui/ink/components/SpinnerGlyph.js +14 -34
- package/dist/tui/ink/components/SpinnerGlyph.js.map +1 -1
- package/dist/tui/ink/components/StatusBar.d.ts +0 -7
- package/dist/tui/ink/components/StatusBar.js +5 -11
- package/dist/tui/ink/components/StatusBar.js.map +1 -1
- package/dist/tui/ink/components/ThinkingBlock.d.ts +4 -15
- package/dist/tui/ink/components/ThinkingBlock.js +17 -34
- package/dist/tui/ink/components/ThinkingBlock.js.map +1 -1
- package/dist/tui/ink/components/ToolBox.js +13 -23
- package/dist/tui/ink/components/ToolBox.js.map +1 -1
- package/dist/tui/ink/index.js +1 -17
- package/dist/tui/ink/index.js.map +1 -1
- package/dist/tui/ink/theme-context.js +3 -6
- package/dist/tui/ink/theme-context.js.map +1 -1
- package/dist/tui/ink/use-declined-versions.js +2 -6
- package/dist/tui/ink/use-declined-versions.js.map +1 -1
- package/dist/tui/ink/use-event-projection.d.ts +0 -2
- package/dist/tui/ink/use-event-projection.js +2 -21
- package/dist/tui/ink/use-event-projection.js.map +1 -1
- package/dist/tui/ink/use-overlays.js +17 -16
- package/dist/tui/ink/use-overlays.js.map +1 -1
- package/package.json +6 -5
- package/dist/state/db-telemetry.d.ts +0 -21
- package/dist/state/db-telemetry.js +0 -116
- package/dist/state/db-telemetry.js.map +0 -1
- package/dist/telemetry/gateway-push.d.ts +0 -17
- package/dist/telemetry/gateway-push.js +0 -48
- package/dist/telemetry/gateway-push.js.map +0 -1
- package/dist/telemetry/index.d.ts +0 -9
- package/dist/telemetry/index.js +0 -9
- package/dist/telemetry/index.js.map +0 -1
- package/dist/tools/github.d.ts +0 -13
- package/dist/tools/github.js +0 -257
- package/dist/tools/github.js.map +0 -1
- package/dist/tui/ink/components/VirtualTranscript.d.ts +0 -19
- package/dist/tui/ink/components/VirtualTranscript.js +0 -31
- package/dist/tui/ink/components/VirtualTranscript.js.map +0 -1
- package/dist/tui/ink/markdown/syntax-highlight.d.ts +0 -13
- package/dist/tui/ink/markdown/syntax-highlight.js +0 -91
- package/dist/tui/ink/markdown/syntax-highlight.js.map +0 -1
- package/dist/tui/ink/use-elapsed.d.ts +0 -14
- package/dist/tui/ink/use-elapsed.js +0 -61
- package/dist/tui/ink/use-elapsed.js.map +0 -1
- package/dist/tui/ink/use-flicker-detector.d.ts +0 -12
- package/dist/tui/ink/use-flicker-detector.js +0 -37
- package/dist/tui/ink/use-flicker-detector.js.map +0 -1
- package/dist/tui/ink/use-render-metrics.d.ts +0 -14
- package/dist/tui/ink/use-render-metrics.js +0 -106
- package/dist/tui/ink/use-render-metrics.js.map +0 -1
- package/dist/tui/ink/use-transcript-scroll.d.ts +0 -19
- package/dist/tui/ink/use-transcript-scroll.js +0 -83
- package/dist/tui/ink/use-transcript-scroll.js.map +0 -1
- package/dist/utils/env.d.ts +0 -1
- package/dist/utils/env.js +0 -60
- package/dist/utils/env.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -10
- package/dist/utils/fs.js +0 -37
- package/dist/utils/fs.js.map +0 -1
|
@@ -3,34 +3,27 @@
|
|
|
3
3
|
* to a Node-native line scan. Always returns file:line:match triples,
|
|
4
4
|
* capped by resultLimit to keep the LLM reply compact.
|
|
5
5
|
*/
|
|
6
|
-
import { spawn } from
|
|
7
|
-
import { readFile, readdir, stat } from
|
|
8
|
-
import { join } from
|
|
9
|
-
import { isValidCwdPath } from "../utils/fs.js";
|
|
6
|
+
import { spawn } from 'node:child_process';
|
|
7
|
+
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
8
|
+
import { resolve, join } from 'node:path';
|
|
10
9
|
const DEFAULT_LIMIT = 200;
|
|
11
10
|
export const searchGrepTool = {
|
|
12
|
-
name:
|
|
13
|
-
description:
|
|
11
|
+
name: 'search_grep',
|
|
12
|
+
description: 'Search for a regex pattern across files under a directory. Prefers ripgrep when installed.',
|
|
14
13
|
inputSchema: {
|
|
15
|
-
type:
|
|
14
|
+
type: 'object',
|
|
16
15
|
properties: {
|
|
17
|
-
pattern: { type:
|
|
18
|
-
path: { type:
|
|
19
|
-
resultLimit: { type:
|
|
20
|
-
ignoreCase: { type:
|
|
21
|
-
filePattern: {
|
|
22
|
-
type: "string",
|
|
23
|
-
description: "Glob to limit files (ripgrep --glob).",
|
|
24
|
-
},
|
|
16
|
+
pattern: { type: 'string' },
|
|
17
|
+
path: { type: 'string' },
|
|
18
|
+
resultLimit: { type: 'integer', minimum: 1 },
|
|
19
|
+
ignoreCase: { type: 'boolean' },
|
|
20
|
+
filePattern: { type: 'string', description: 'Glob to limit files (ripgrep --glob).' },
|
|
25
21
|
},
|
|
26
|
-
required: [
|
|
22
|
+
required: ['pattern'],
|
|
27
23
|
},
|
|
28
24
|
async execute(rawInput, ctx) {
|
|
29
25
|
const input = rawInput;
|
|
30
|
-
const
|
|
31
|
-
if (!check.valid)
|
|
32
|
-
return { content: check.error, isError: true };
|
|
33
|
-
const root = check.resolved;
|
|
26
|
+
const root = resolve(ctx.cwd, input.path ?? '.');
|
|
34
27
|
const limit = input.resultLimit ?? DEFAULT_LIMIT;
|
|
35
28
|
const rg = await runRipgrep(input, root, limit);
|
|
36
29
|
if (rg)
|
|
@@ -39,51 +32,34 @@ export const searchGrepTool = {
|
|
|
39
32
|
},
|
|
40
33
|
};
|
|
41
34
|
async function runRipgrep(input, root, limit) {
|
|
42
|
-
const args = [
|
|
43
|
-
"--line-number",
|
|
44
|
-
"--no-heading",
|
|
45
|
-
"--color",
|
|
46
|
-
"never",
|
|
47
|
-
`--max-count=${limit}`,
|
|
48
|
-
];
|
|
35
|
+
const args = ['--line-number', '--no-heading', '--color', 'never', `--max-count=${limit}`];
|
|
49
36
|
if (input.ignoreCase)
|
|
50
|
-
args.push(
|
|
37
|
+
args.push('--ignore-case');
|
|
51
38
|
if (input.filePattern)
|
|
52
|
-
args.push(
|
|
53
|
-
args.push(
|
|
54
|
-
const child = spawn(
|
|
55
|
-
cwd: root,
|
|
56
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
57
|
-
});
|
|
39
|
+
args.push('--glob', input.filePattern);
|
|
40
|
+
args.push('--', input.pattern, root);
|
|
41
|
+
const child = spawn('rg', args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
58
42
|
const out = [];
|
|
59
43
|
const errChunks = [];
|
|
60
|
-
child.stdout.on(
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
child.stderr.on("data", (buf) => {
|
|
64
|
-
errChunks.push(buf);
|
|
65
|
-
});
|
|
44
|
+
child.stdout.on('data', (buf) => { out.push(buf.toString('utf8')); });
|
|
45
|
+
child.stderr.on('data', (buf) => { errChunks.push(buf); });
|
|
66
46
|
const exitCode = await new Promise((resolveExit, rejectExit) => {
|
|
67
|
-
child.on(
|
|
68
|
-
child.on(
|
|
47
|
+
child.on('error', err => rejectExit(err));
|
|
48
|
+
child.on('exit', code => resolveExit(code ?? -1));
|
|
69
49
|
}).catch(() => -1);
|
|
70
|
-
const stderrText = Buffer.concat(errChunks)
|
|
71
|
-
.toString("utf8")
|
|
72
|
-
.trim();
|
|
73
50
|
if (exitCode === -1 || exitCode === 2)
|
|
74
51
|
return undefined;
|
|
75
|
-
const joined = out.join(
|
|
76
|
-
const lines = joined.length > 0 ? joined.split(
|
|
52
|
+
const joined = out.join('');
|
|
53
|
+
const lines = joined.length > 0 ? joined.split('\n').filter(l => l.length > 0) : [];
|
|
77
54
|
const truncated = lines.length >= limit;
|
|
78
|
-
const content = lines.length > 0 ? lines.join("\n") : "(no matches)";
|
|
79
55
|
return {
|
|
80
|
-
content:
|
|
81
|
-
data: { matches: lines.length, truncated, engine:
|
|
56
|
+
content: lines.length > 0 ? lines.join('\n') : '(no matches)',
|
|
57
|
+
data: { matches: lines.length, truncated, engine: 'ripgrep' },
|
|
82
58
|
isError: false,
|
|
83
59
|
};
|
|
84
60
|
}
|
|
85
61
|
async function nodeScan(input, root, limit) {
|
|
86
|
-
const flags = input.ignoreCase ?
|
|
62
|
+
const flags = input.ignoreCase ? 'gi' : 'g';
|
|
87
63
|
let regex;
|
|
88
64
|
try {
|
|
89
65
|
regex = new RegExp(input.pattern, flags);
|
|
@@ -100,7 +76,7 @@ async function nodeScan(input, root, limit) {
|
|
|
100
76
|
}
|
|
101
77
|
const names = await readdir(dir).catch(() => []);
|
|
102
78
|
for (const name of names) {
|
|
103
|
-
if (name ===
|
|
79
|
+
if (name === 'node_modules' || name === '.git' || name === 'dist')
|
|
104
80
|
continue;
|
|
105
81
|
const abs = join(dir, name);
|
|
106
82
|
const info = await stat(abs).catch(() => undefined);
|
|
@@ -109,8 +85,8 @@ async function nodeScan(input, root, limit) {
|
|
|
109
85
|
if (info.isDirectory())
|
|
110
86
|
await walk(abs);
|
|
111
87
|
else if (info.isFile() && info.size < 512 * 1024) {
|
|
112
|
-
const text = await readFile(abs,
|
|
113
|
-
const lines = text.split(
|
|
88
|
+
const text = await readFile(abs, 'utf8').catch(() => '');
|
|
89
|
+
const lines = text.split('\n');
|
|
114
90
|
for (let i = 0; i < lines.length; i++) {
|
|
115
91
|
regex.lastIndex = 0; // reset state between tests — global-flag RegExp retains lastIndex
|
|
116
92
|
if (regex.test(lines[i])) {
|
|
@@ -126,8 +102,8 @@ async function nodeScan(input, root, limit) {
|
|
|
126
102
|
}
|
|
127
103
|
await walk(root);
|
|
128
104
|
return {
|
|
129
|
-
content: matches.length > 0 ? matches.join(
|
|
130
|
-
data: { matches: matches.length, truncated, engine:
|
|
105
|
+
content: matches.length > 0 ? matches.join('\n') : '(no matches)',
|
|
106
|
+
data: { matches: matches.length, truncated, engine: 'node' },
|
|
131
107
|
isError: false,
|
|
132
108
|
};
|
|
133
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-grep.js","sourceRoot":"","sources":["../../src/tools/search-grep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"search-grep.js","sourceRoot":"","sources":["../../src/tools/search-grep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI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AAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;wBAC5C,IAAI,OAAO,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;4BAAC,SAAS,GAAG,IAAI,CAAC;4BAAC,OAAO;wBAAC,CAAC;oBAC5D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc;QACjE,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE;QAC5D,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC"}
|
package/dist/tools/shell.d.ts
CHANGED
|
@@ -7,17 +7,11 @@
|
|
|
7
7
|
* the model does not misread a capped stream as a complete one.
|
|
8
8
|
*
|
|
9
9
|
* Platform routing (1.13.0):
|
|
10
|
-
* posix → spawn(
|
|
10
|
+
* posix → spawn(cmd, { shell: true }) // /bin/sh -c <cmd>
|
|
11
11
|
* win32 → prefer pwsh > powershell > cmd.exe via env detection;
|
|
12
12
|
* fall back to cmd if PowerShell isn't on PATH. PowerShell
|
|
13
13
|
* handles quoting + UTF-8 + multi-line scripts more cleanly
|
|
14
14
|
* than cmd.exe's relic Windows-95 parser.
|
|
15
|
-
*
|
|
16
|
-
* Streaming mode (1.14.0):
|
|
17
|
-
* When `streamOutput: true` is passed, each stdout/stderr chunk is
|
|
18
|
-
* forwarded to `ctx.onProgress` as it arrives so the TUI can display
|
|
19
|
-
* live output. Accumulated output is still returned in the final
|
|
20
|
-
* ToolResult for the model. Backwards-compatible: default is false.
|
|
21
15
|
*/
|
|
22
16
|
import type { Tool } from "./registry.js";
|
|
23
17
|
export declare const shellTool: Tool;
|
package/dist/tools/shell.js
CHANGED
|
@@ -7,60 +7,45 @@
|
|
|
7
7
|
* the model does not misread a capped stream as a complete one.
|
|
8
8
|
*
|
|
9
9
|
* Platform routing (1.13.0):
|
|
10
|
-
* posix → spawn(
|
|
10
|
+
* posix → spawn(cmd, { shell: true }) // /bin/sh -c <cmd>
|
|
11
11
|
* win32 → prefer pwsh > powershell > cmd.exe via env detection;
|
|
12
12
|
* fall back to cmd if PowerShell isn't on PATH. PowerShell
|
|
13
13
|
* handles quoting + UTF-8 + multi-line scripts more cleanly
|
|
14
14
|
* than cmd.exe's relic Windows-95 parser.
|
|
15
|
-
*
|
|
16
|
-
* Streaming mode (1.14.0):
|
|
17
|
-
* When `streamOutput: true` is passed, each stdout/stderr chunk is
|
|
18
|
-
* forwarded to `ctx.onProgress` as it arrives so the TUI can display
|
|
19
|
-
* live output. Accumulated output is still returned in the final
|
|
20
|
-
* ToolResult for the model. Backwards-compatible: default is false.
|
|
21
15
|
*/
|
|
22
|
-
import { spawn,
|
|
23
|
-
|
|
24
|
-
import { resolve, sep } from "node:path";
|
|
25
|
-
import { promisify } from "node:util";
|
|
26
|
-
const execFileAsync = promisify(execFile);
|
|
27
|
-
/** Cached PowerShell executable detection (probed async at first use). */
|
|
16
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
17
|
+
/** Cached PowerShell executable detection (per-process, never re-probed). */
|
|
28
18
|
let cachedWindowsShell = null;
|
|
29
|
-
|
|
30
|
-
async function resolveWindowsShell() {
|
|
19
|
+
function resolveWindowsShell() {
|
|
31
20
|
if (cachedWindowsShell)
|
|
32
21
|
return cachedWindowsShell;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
cachedWindowsShell = {
|
|
41
|
-
cmd: exe,
|
|
42
|
-
args: (script) => [
|
|
43
|
-
"-NoLogo",
|
|
44
|
-
"-NoProfile",
|
|
45
|
-
"-NonInteractive",
|
|
46
|
-
"-OutputFormat",
|
|
47
|
-
"Text",
|
|
48
|
-
"-Command",
|
|
49
|
-
script,
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
return cachedWindowsShell;
|
|
53
|
-
}
|
|
54
|
-
catch { }
|
|
55
|
-
}
|
|
22
|
+
// Prefer PowerShell 7+ (`pwsh`), then Windows PowerShell 5.1, then cmd.
|
|
23
|
+
for (const exe of ["pwsh", "powershell"]) {
|
|
24
|
+
const probe = spawnSync(exe, ["-NoLogo", "-Command", "exit 0"], {
|
|
25
|
+
timeout: 3000,
|
|
26
|
+
});
|
|
27
|
+
if (probe.status === 0) {
|
|
56
28
|
cachedWindowsShell = {
|
|
57
|
-
cmd:
|
|
58
|
-
args: (script) => [
|
|
29
|
+
cmd: exe,
|
|
30
|
+
args: (script) => [
|
|
31
|
+
"-NoLogo",
|
|
32
|
+
"-NoProfile",
|
|
33
|
+
"-NonInteractive",
|
|
34
|
+
"-OutputFormat",
|
|
35
|
+
"Text",
|
|
36
|
+
"-Command",
|
|
37
|
+
script,
|
|
38
|
+
],
|
|
59
39
|
};
|
|
60
40
|
return cachedWindowsShell;
|
|
61
|
-
}
|
|
41
|
+
}
|
|
62
42
|
}
|
|
63
|
-
|
|
43
|
+
// Fallback: cmd.exe via shell:true (no /c needed since spawn handles it).
|
|
44
|
+
cachedWindowsShell = {
|
|
45
|
+
cmd: process.env.ComSpec ?? "cmd.exe",
|
|
46
|
+
args: (script) => ["/d", "/s", "/c", script],
|
|
47
|
+
};
|
|
48
|
+
return cachedWindowsShell;
|
|
64
49
|
}
|
|
65
50
|
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
66
51
|
const MAX_OUTPUT_BYTES = 256 * 1024;
|
|
@@ -74,19 +59,7 @@ export const shellTool = {
|
|
|
74
59
|
properties: {
|
|
75
60
|
command: { type: "string" },
|
|
76
61
|
cwd: { type: "string" },
|
|
77
|
-
timeoutMs: {
|
|
78
|
-
type: "integer",
|
|
79
|
-
minimum: 1000,
|
|
80
|
-
description: "Hard timeout in milliseconds (default 120 000). On expiry the child " +
|
|
81
|
-
"receives SIGTERM then SIGKILL after 2 s.",
|
|
82
|
-
},
|
|
83
|
-
streamOutput: {
|
|
84
|
-
type: "boolean",
|
|
85
|
-
description: "When true, forward each output chunk to the progress bus so the " +
|
|
86
|
-
"TUI can display live output while the command runs. " +
|
|
87
|
-
"Accumulated output is still returned in the final result. " +
|
|
88
|
-
"Default: false.",
|
|
89
|
-
},
|
|
62
|
+
timeoutMs: { type: "integer", minimum: 1000 },
|
|
90
63
|
},
|
|
91
64
|
required: ["command"],
|
|
92
65
|
},
|
|
@@ -96,42 +69,39 @@ export const shellTool = {
|
|
|
96
69
|
const input = rawInput;
|
|
97
70
|
const cwd = input.cwd ?? ctx.cwd;
|
|
98
71
|
const timeoutMs = input.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
72
|
+
// TODO: use context.sandbox when SandboxAdapter.exec() is wired.
|
|
73
|
+
// ctx.sandbox is now populated by createToolExecutor() — replace the
|
|
74
|
+
// spawn() block below with ctx.sandbox.exec({ command, cwd, env, ... })
|
|
75
|
+
// once the mapping from Input → SandboxExecOptions is validated.
|
|
76
|
+
//
|
|
77
|
+
// Platform-aware spawn. On Windows, prefer pwsh > powershell > cmd.
|
|
78
|
+
// PowerShell handles UTF-8, quoting, and multi-line scripts more
|
|
79
|
+
// cleanly than cmd.exe's legacy parser. On POSIX, plain shell:true
|
|
80
|
+
// (= /bin/sh -c).
|
|
108
81
|
const child = process.platform === "win32"
|
|
109
|
-
? (
|
|
110
|
-
const shell =
|
|
82
|
+
? (() => {
|
|
83
|
+
const shell = resolveWindowsShell();
|
|
111
84
|
return spawn(shell.cmd, shell.args(input.command), {
|
|
112
85
|
cwd,
|
|
113
86
|
env: ctx.env,
|
|
114
|
-
stdio: ["
|
|
87
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
115
88
|
windowsHide: true,
|
|
116
89
|
});
|
|
117
90
|
})()
|
|
118
|
-
: spawn(
|
|
91
|
+
: spawn(input.command, {
|
|
119
92
|
cwd,
|
|
120
93
|
env: ctx.env,
|
|
121
|
-
stdio: ["
|
|
94
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
95
|
+
shell: true,
|
|
122
96
|
});
|
|
123
|
-
const childProcess = await (child instanceof Promise
|
|
124
|
-
? child
|
|
125
|
-
: Promise.resolve(child));
|
|
126
97
|
const stdoutChunks = [];
|
|
127
98
|
const stderrChunks = [];
|
|
128
99
|
let stdoutBytes = 0;
|
|
129
100
|
let stderrBytes = 0;
|
|
130
101
|
let truncated = false;
|
|
102
|
+
// Shared total so combined stdout+stderr never exceeds MAX_OUTPUT_BYTES.
|
|
131
103
|
let totalBytes = 0;
|
|
132
|
-
const
|
|
133
|
-
const stderrDecoder = new StringDecoder("utf8");
|
|
134
|
-
const onData = (chunks, decoder, trackBytes, label) => (buf) => {
|
|
104
|
+
const onData = (chunks, trackBytes) => (buf) => {
|
|
135
105
|
const remaining = MAX_OUTPUT_BYTES - totalBytes;
|
|
136
106
|
if (remaining <= 0) {
|
|
137
107
|
truncated = true;
|
|
@@ -143,53 +113,30 @@ export const shellTool = {
|
|
|
143
113
|
trackBytes(slice.length);
|
|
144
114
|
if (buf.length > remaining)
|
|
145
115
|
truncated = true;
|
|
146
|
-
const text =
|
|
147
|
-
if (text.trim().length > 0)
|
|
148
|
-
|
|
149
|
-
// in non-streaming mode the existing behaviour is preserved
|
|
150
|
-
// (progress is still emitted so the TUI spinner stays alive,
|
|
151
|
-
// but callers that don't pass onProgress see no difference).
|
|
152
|
-
if (streamOutput) {
|
|
153
|
-
ctx.onProgress?.(label === "STDERR" ? `[stderr] ${text.trimEnd()}` : text.trimEnd());
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
ctx.onProgress?.(text.trimEnd());
|
|
157
|
-
}
|
|
158
|
-
}
|
|
116
|
+
const text = slice.toString("utf8");
|
|
117
|
+
if (text.trim().length > 0)
|
|
118
|
+
ctx.onProgress?.(text.trimEnd());
|
|
159
119
|
};
|
|
160
|
-
|
|
120
|
+
child.stdout.on("data", onData(stdoutChunks, (n) => {
|
|
161
121
|
stdoutBytes += n;
|
|
162
|
-
}
|
|
163
|
-
|
|
122
|
+
}));
|
|
123
|
+
child.stderr.on("data", onData(stderrChunks, (n) => {
|
|
164
124
|
stderrBytes += n;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
childProcess.kill("SIGKILL");
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
/* already gone */
|
|
175
|
-
}
|
|
176
|
-
}, 2_000);
|
|
177
|
-
};
|
|
178
|
-
const timer = setTimeout(killChild, timeoutMs);
|
|
125
|
+
}));
|
|
126
|
+
const timer = setTimeout(() => {
|
|
127
|
+
child.kill("SIGKILL");
|
|
128
|
+
}, timeoutMs);
|
|
129
|
+
// Wire abort signal so Esc/cancel kills the child immediately.
|
|
179
130
|
const onAbort = () => {
|
|
180
|
-
|
|
131
|
+
child.kill("SIGKILL");
|
|
181
132
|
};
|
|
182
|
-
|
|
183
|
-
ctx.signal.addEventListener("abort", onAbort, { once: true });
|
|
184
|
-
}
|
|
133
|
+
ctx.signal?.addEventListener("abort", onAbort, { once: true });
|
|
185
134
|
const exitCode = await new Promise((resolveExit) => {
|
|
186
|
-
|
|
187
|
-
|
|
135
|
+
child.on("error", () => resolveExit(-1));
|
|
136
|
+
child.on("close", (code) => resolveExit(code ?? -1));
|
|
188
137
|
});
|
|
189
138
|
clearTimeout(timer);
|
|
190
|
-
|
|
191
|
-
ctx.signal.removeEventListener("abort", onAbort);
|
|
192
|
-
}
|
|
139
|
+
ctx.signal?.removeEventListener("abort", onAbort);
|
|
193
140
|
const stdout = Buffer.concat(stdoutChunks).toString("utf8");
|
|
194
141
|
const stderr = Buffer.concat(stderrChunks).toString("utf8");
|
|
195
142
|
const banner = `exit=${exitCode}${truncated ? " [output truncated]" : ""}`;
|
package/dist/tools/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/tools/shell.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/tools/shell.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAUtD,6EAA6E;AAC7E,IAAI,kBAAkB,GAGX,IAAI,CAAC;AAEhB,SAAS,mBAAmB;IAI1B,IAAI,kBAAkB;QAAE,OAAO,kBAAkB,CAAC;IAClD,wEAAwE;IACxE,KAAK,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE;YAC9D,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QACH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,kBAAkB,GAAG;gBACnB,GAAG,EAAE,GAAG;gBACR,IAAI,EAAE,CAAC,MAAc,EAAY,EAAE,CAAC;oBAClC,SAAS;oBACT,YAAY;oBACZ,iBAAiB;oBACjB,eAAe;oBACf,MAAM;oBACN,UAAU;oBACV,MAAM;iBACP;aACF,CAAC;YACF,OAAO,kBAAkB,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,0EAA0E;IAC1E,kBAAkB,GAAG;QACnB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,SAAS;QACrC,IAAI,EAAE,CAAC,MAAc,EAAY,EAAE,CAAC,CAAC,I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,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QACH,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,YAAgD,CACjD,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,YAAgD,CACjD,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnB,MAAM,MAAM,GAAG,QAAQ,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QAC3E,MAAM,IAAI,GAAG;YACX,MAAM;YACN,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;YAC7C,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;SAC9C;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;YACxC,IAAI,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE;YACvD,OAAO,EAAE,QAAQ,KAAK,CAAC;SACxB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/dist/tui/ink/App.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Ink root component for the dirgha TUI.
|
|
3
3
|
*
|
|
4
4
|
* Layout is a single vertical stack:
|
|
5
|
-
* 1. Logo (
|
|
5
|
+
* 1. Logo (rendered once inside <Static>, never re-renders)
|
|
6
6
|
* 2. Transcript (finalised user messages + completed turn blocks)
|
|
7
7
|
* 3. LiveTurn (the currently streaming turn, if any)
|
|
8
8
|
* 4. InputBox
|
|
@@ -23,7 +23,6 @@ import type { DirghaConfig } from "../../cli/config.js";
|
|
|
23
23
|
import type { SlashRegistry } from "../../cli/slash.js";
|
|
24
24
|
import { type ModelEntry } from "./components/ModelPicker.js";
|
|
25
25
|
import { type HelpSlashCommand } from "./components/HelpOverlay.js";
|
|
26
|
-
export declare const VERSION: string;
|
|
27
26
|
export interface AppProps {
|
|
28
27
|
events: EventStream;
|
|
29
28
|
registry: ToolRegistry;
|