@denizokcu/haze 0.7.0 → 0.9.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 +35 -9
- package/README.md +37 -35
- package/dist/cli/chat/inputSuggestions.js +2 -2
- package/dist/cli/chat/sessionRecorder.d.ts +3 -0
- package/dist/cli/chat/sessionRecorder.js +23 -8
- package/dist/cli/commands/chat.js +136 -124
- package/dist/cli/commands/chatModes.js +1 -1
- package/dist/cli/commands/commandHelp.js +2 -2
- package/dist/cli/commands/commands.d.ts +1 -1
- package/dist/cli/commands/commands.js +1 -1
- package/dist/cli/commands/formatters.d.ts +6 -0
- package/dist/cli/commands/formatters.js +41 -3
- package/dist/cli/commands/logsCommand.js +7 -21
- package/dist/cli/commands/mcpWizard.js +24 -2
- package/dist/cli/commands/providerWizard.js +18 -5
- package/dist/cli/commands/runCommand.js +7 -15
- package/dist/cli/commands/settingsSummary.js +3 -1
- package/dist/cli/commands/streaming/turnOutcome.d.ts +10 -0
- package/dist/cli/commands/streaming/turnOutcome.js +13 -0
- package/dist/cli/commands/streaming.js +99 -51
- package/dist/cli/commands/wizardPrompts.js +1 -1
- package/dist/cli/commands/wizardSuggestions.js +3 -2
- package/dist/cli/commands/wizardTransition.d.ts +33 -0
- package/dist/cli/commands/wizardTransition.js +44 -0
- package/dist/config/contextFiles.js +6 -3
- package/dist/config/endpointSecurity.d.ts +2 -0
- package/dist/config/endpointSecurity.js +28 -0
- package/dist/config/inputHistory.js +4 -2
- package/dist/config/privateStorage.d.ts +6 -0
- package/dist/config/privateStorage.js +61 -0
- package/dist/config/providers.js +5 -9
- package/dist/config/settings.d.ts +1 -0
- package/dist/config/settings.js +55 -3
- package/dist/config/updateCheck.js +4 -2
- package/dist/core/agent/compaction.js +2 -2
- package/dist/core/agent/errors.js +1 -1
- package/dist/core/agent/requestAssembly.d.ts +1 -0
- package/dist/core/agent/requestAssembly.js +13 -0
- package/dist/core/agent/toolOutputStore.d.ts +3 -0
- package/dist/core/agent/toolOutputStore.js +32 -11
- package/dist/core/bashOutput/registry.js +11 -9
- package/dist/core/goal/completionPolicy.d.ts +0 -28
- package/dist/core/goal/completionPolicy.js +1 -89
- package/dist/core/io/boundedRead.d.ts +15 -0
- package/dist/core/io/boundedRead.js +97 -0
- package/dist/core/limits/byteBudgets.d.ts +13 -0
- package/dist/core/limits/byteBudgets.js +13 -0
- package/dist/core/log/llmLog.d.ts +10 -0
- package/dist/core/log/llmLog.js +59 -13
- package/dist/core/persistence/orderedFileWriter.d.ts +11 -0
- package/dist/core/persistence/orderedFileWriter.js +29 -0
- package/dist/core/process/runBoundedProcess.d.ts +27 -0
- package/dist/core/process/runBoundedProcess.js +80 -0
- package/dist/core/session/sessionStore.js +48 -25
- package/dist/core/subagent/subagentRunner.d.ts +252 -9
- package/dist/core/subagent/subagentRunner.js +14 -19
- package/dist/core/toolOutput/reduction.d.ts +2 -0
- package/dist/core/toolOutput/reduction.js +12 -0
- package/dist/core/validation/outputParser.js +5 -3
- package/dist/llm/client.d.ts +2 -2
- package/dist/llm/client.js +19 -3
- package/dist/llm/hazeTools.d.ts +8103 -364
- package/dist/llm/hazeTools.js +43 -33
- package/dist/llm/initPrompt.js +1 -1
- package/dist/llm/lsp.d.ts +21 -3
- package/dist/llm/lsp.js +65 -14
- package/dist/llm/lspTools.d.ts +2358 -101
- package/dist/llm/mcp.d.ts +1 -1
- package/dist/llm/mcp.js +65 -16
- package/dist/llm/requestContext.d.ts +1 -0
- package/dist/llm/requestContext.js +6 -3
- package/dist/llm/systemPrompt.js +2 -2
- package/dist/llm/toolResultTypes.d.ts +1 -1
- package/dist/llm/tools/bashTool.d.ts +603 -5
- package/dist/llm/tools/bashTool.js +23 -60
- package/dist/llm/tools/fetchTool.d.ts +1201 -65
- package/dist/llm/tools/fetchTool.js +2 -1
- package/dist/llm/tools/grepRunner.d.ts +15 -0
- package/dist/llm/tools/grepRunner.js +85 -0
- package/dist/llm/tools/storedOutputTool.d.ts +351 -10
- package/dist/llm/tools/taskTool.d.ts +629 -28
- package/dist/llm/tools/toolContext.d.ts +7 -2
- package/dist/llm/tools/toolContext.js +11 -2
- package/dist/llm/webFetch.js +31 -21
- package/dist/skills/SkillLoader.js +17 -5
- package/dist/skills/SkillRegistry.js +19 -6
- package/dist/skills/builder/SkillBuilder.js +7 -7
- package/dist/skills/types.d.ts +5 -0
- package/dist/ui/components/TextInput.d.ts +7 -0
- package/dist/ui/components/TextInput.js +10 -0
- package/dist/utils/modelName.d.ts +2 -0
- package/dist/utils/modelName.js +15 -0
- package/dist/utils/path.d.ts +2 -0
- package/dist/utils/path.js +9 -4
- package/examples/skills/files/SKILL.md +1 -1
- package/package.json +14 -14
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import { tool } from 'ai';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
import { classifyBashCommand, isValidationClassification } from '../../core/safety/bashClassifier.js';
|
|
@@ -7,75 +6,39 @@ import { filterBashOutput } from '../../core/bashOutput/registry.js';
|
|
|
7
6
|
import { storeToolOutput } from '../../core/agent/toolOutputStore.js';
|
|
8
7
|
import { workspaceRoot } from '../../utils/path.js';
|
|
9
8
|
import { compactStoredOutput, COMPACT_COMMAND_CHARS } from './outputCap.js';
|
|
10
|
-
import { runDedupedTool } from './toolContext.js';
|
|
9
|
+
import { hazeToolContextSchema, runDedupedTool } from './toolContext.js';
|
|
10
|
+
import { runBoundedProcess } from '../../core/process/runBoundedProcess.js';
|
|
11
|
+
import { BASH_STREAM_BYTES } from '../../core/limits/byteBudgets.js';
|
|
11
12
|
const SHORT_VALIDATION_CHARS = 2_000;
|
|
12
13
|
export const bashTool = tool({
|
|
13
|
-
description: 'Run workspace tests, builds, validation, or inspection.
|
|
14
|
+
description: 'Run workspace tests, builds, validation, or inspection. Risk classification is informational; use file tools for edits.',
|
|
15
|
+
contextSchema: hazeToolContextSchema,
|
|
14
16
|
inputSchema: z.object({
|
|
15
17
|
command: z.string().min(1).describe('Command to execute with bash -lc'),
|
|
16
18
|
timeoutSeconds: z.number().int().positive().max(600).optional().describe('Timeout in seconds; defaults to 60'),
|
|
17
19
|
allowMutation: z.boolean().default(false).describe('Deprecated compatibility flag. Commands run without confirmation; retained for compatibility.'),
|
|
18
20
|
}),
|
|
19
|
-
execute: async ({ command, timeoutSeconds
|
|
21
|
+
execute: async ({ command, timeoutSeconds }, context) => runDedupedTool('bash', { command, timeoutSeconds }, context, async () => {
|
|
20
22
|
const cwd = workspaceRoot();
|
|
21
23
|
const classification = classifyBashCommand(command);
|
|
22
24
|
const timeoutMs = (timeoutSeconds ?? 60) * 1000;
|
|
23
25
|
const startedAt = Date.now();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
settled = true;
|
|
42
|
-
clearTimeout(timer);
|
|
43
|
-
context.abortSignal?.removeEventListener('abort', abort);
|
|
44
|
-
const validationSummary = isValidationClassification(classification)
|
|
45
|
-
? parseValidationOutput({ command, code, stdout, stderr, timedOut, stdoutTruncated: stdout.length > COMPACT_COMMAND_CHARS, stderrTruncated: stderr.length > COMPACT_COMMAND_CHARS, classification })
|
|
46
|
-
: undefined;
|
|
47
|
-
const validationPassed = validationSummary?.status === 'passed';
|
|
48
|
-
const output = filterBashOutput({
|
|
49
|
-
command,
|
|
50
|
-
code,
|
|
51
|
-
stdout,
|
|
52
|
-
stderr,
|
|
53
|
-
timedOut,
|
|
54
|
-
classification,
|
|
55
|
-
validationSummary,
|
|
56
|
-
storeRawOutput: storeToolOutput,
|
|
57
|
-
fallbackCompact: compactStoredOutput,
|
|
58
|
-
compactMaxChars: validationPassed ? SHORT_VALIDATION_CHARS : COMPACT_COMMAND_CHARS,
|
|
59
|
-
});
|
|
60
|
-
resolve({
|
|
61
|
-
ok: code === 0 && !timedOut,
|
|
62
|
-
code,
|
|
63
|
-
command,
|
|
64
|
-
cwd,
|
|
65
|
-
classification,
|
|
66
|
-
durationMs: Date.now() - startedAt,
|
|
67
|
-
timedOut,
|
|
68
|
-
stdout: output.stdout,
|
|
69
|
-
stderr: output.stderr,
|
|
70
|
-
validationSummary,
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
child.on('error', error => {
|
|
74
|
-
settled = true;
|
|
75
|
-
clearTimeout(timer);
|
|
76
|
-
context.abortSignal?.removeEventListener('abort', abort);
|
|
77
|
-
resolve({ ok: false, command, cwd, classification, durationMs: Date.now() - startedAt, error: error.message });
|
|
78
|
-
});
|
|
79
|
-
});
|
|
26
|
+
const processResult = await runBoundedProcess({ command: 'bash', args: ['-lc', command], cwd, timeoutMs, signal: context.abortSignal, maxStdoutBytes: BASH_STREAM_BYTES, maxStderrBytes: BASH_STREAM_BYTES });
|
|
27
|
+
const { code, timedOut } = processResult;
|
|
28
|
+
const stdout = processResult.stdout.text;
|
|
29
|
+
const stderr = processResult.stderr.text;
|
|
30
|
+
const validationSummary = isValidationClassification(classification)
|
|
31
|
+
? parseValidationOutput({ command, code, stdout, stderr, timedOut, stdoutTruncated: processResult.stdout.omittedBytes > 0, stderrTruncated: processResult.stderr.omittedBytes > 0, classification })
|
|
32
|
+
: undefined;
|
|
33
|
+
const validationPassed = validationSummary?.status === 'passed';
|
|
34
|
+
const output = filterBashOutput({ command, code, stdout, stderr, timedOut, classification, validationSummary, storeRawOutput: storeToolOutput, fallbackCompact: compactStoredOutput, compactMaxChars: validationPassed ? SHORT_VALIDATION_CHARS : COMPACT_COMMAND_CHARS });
|
|
35
|
+
return {
|
|
36
|
+
ok: code === 0 && !timedOut && !processResult.aborted && !processResult.error,
|
|
37
|
+
code, command, cwd, classification, durationMs: Date.now() - startedAt, timedOut,
|
|
38
|
+
aborted: processResult.aborted, signal: processResult.signal, forcedTermination: processResult.forced,
|
|
39
|
+
stdout: output.stdout, stderr: output.stderr, validationSummary,
|
|
40
|
+
stdoutBytes: processResult.stdout, stderrBytes: processResult.stderr,
|
|
41
|
+
...(processResult.error ? { error: processResult.error } : {}),
|
|
42
|
+
};
|
|
80
43
|
}),
|
|
81
44
|
});
|