@denizokcu/haze 0.6.0 → 0.8.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 +42 -7
- package/README.md +81 -34
- package/dist/cli/chat/TaskBar.d.ts +9 -0
- package/dist/cli/chat/TaskBar.js +40 -0
- package/dist/cli/chat/chatMetrics.d.ts +11 -0
- package/dist/cli/chat/chatMetrics.js +50 -0
- package/dist/cli/chat/inputSuggestions.d.ts +16 -0
- package/dist/cli/chat/inputSuggestions.js +55 -0
- package/dist/cli/chat/messages.d.ts +9 -0
- package/dist/cli/chat/messages.js +76 -0
- package/dist/cli/chat/sessionRecorder.d.ts +12 -0
- package/dist/cli/chat/sessionRecorder.js +21 -0
- package/dist/cli/chat/startupInfo.d.ts +4 -0
- package/dist/cli/chat/startupInfo.js +53 -0
- package/dist/cli/chat/turnState.d.ts +5 -0
- package/dist/cli/chat/turnState.js +20 -0
- package/dist/cli/commands/chat.d.ts +0 -1
- package/dist/cli/commands/chat.js +331 -906
- package/dist/cli/commands/chatModes.d.ts +8 -0
- package/dist/cli/commands/chatModes.js +44 -0
- package/dist/cli/commands/commandHelp.d.ts +6 -0
- package/dist/cli/commands/commandHelp.js +25 -0
- package/dist/cli/commands/commands.d.ts +1 -1
- package/dist/cli/commands/commands.js +41 -267
- package/dist/cli/commands/formatters.d.ts +6 -0
- package/dist/cli/commands/formatters.js +50 -4
- package/dist/cli/commands/initCommand.d.ts +2 -0
- package/dist/cli/commands/initCommand.js +19 -0
- package/dist/cli/commands/logsCommand.d.ts +2 -0
- package/dist/cli/commands/logsCommand.js +63 -0
- package/dist/cli/commands/lspWizard.d.ts +14 -0
- package/dist/cli/commands/lspWizard.js +44 -0
- package/dist/cli/commands/mcpWizard.d.ts +15 -0
- package/dist/cli/commands/mcpWizard.js +69 -0
- package/dist/cli/commands/modelCommand.d.ts +2 -0
- package/dist/cli/commands/modelCommand.js +36 -0
- package/dist/cli/commands/providerWizard.d.ts +30 -0
- package/dist/cli/commands/providerWizard.js +114 -0
- package/dist/cli/commands/runCommand.d.ts +16 -0
- package/dist/cli/commands/runCommand.js +170 -0
- package/dist/cli/commands/settingsSummary.d.ts +3 -0
- package/dist/cli/commands/settingsSummary.js +40 -0
- package/dist/cli/commands/skillConfirmRemove.d.ts +11 -0
- package/dist/cli/commands/skillConfirmRemove.js +19 -0
- package/dist/cli/commands/skillCreation.d.ts +12 -0
- package/dist/cli/commands/skillCreation.js +14 -0
- package/dist/cli/commands/skillWizard.d.ts +15 -0
- package/dist/cli/commands/skillWizard.js +38 -0
- package/dist/cli/commands/streaming/assistantText.d.ts +17 -0
- package/dist/cli/commands/streaming/assistantText.js +115 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +55 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.js +102 -0
- package/dist/cli/commands/streaming/toolResultState.d.ts +13 -0
- package/dist/cli/commands/streaming/toolResultState.js +25 -0
- package/dist/cli/commands/streaming/turnRuntime.d.ts +78 -0
- package/dist/cli/commands/streaming/turnRuntime.js +86 -0
- package/dist/cli/commands/streaming.d.ts +9 -25
- package/dist/cli/commands/streaming.js +109 -363
- package/dist/cli/commands/wizardActions.d.ts +40 -0
- package/dist/cli/commands/wizardActions.js +40 -0
- package/dist/cli/commands/wizardInput.d.ts +4 -0
- package/dist/cli/commands/wizardInput.js +19 -0
- package/dist/cli/commands/wizardPrompts.d.ts +22 -0
- package/dist/cli/commands/wizardPrompts.js +52 -0
- package/dist/cli/commands/wizardSuggestions.d.ts +23 -0
- package/dist/cli/commands/wizardSuggestions.js +139 -0
- package/dist/cli/index.js +62 -4
- package/dist/config/contextFiles.d.ts +8 -1
- package/dist/config/contextFiles.js +25 -12
- package/dist/config/lspSettings.js +3 -6
- package/dist/config/mcpSettings.js +5 -5
- package/dist/config/providers.js +8 -12
- package/dist/config/settings.d.ts +1 -0
- package/dist/config/settings.js +54 -2
- package/dist/config/skillSettings.js +4 -3
- package/dist/core/agent/budgets.d.ts +6 -0
- package/dist/core/agent/budgets.js +6 -0
- package/dist/core/agent/compaction.js +3 -3
- package/dist/core/agent/errors.js +1 -1
- package/dist/core/agent/requestAssembly.d.ts +1 -7
- package/dist/core/agent/requestAssembly.js +40 -5
- package/dist/core/agent/toolOutputStore.js +5 -4
- package/dist/core/agent/toolResults.d.ts +31 -0
- package/dist/core/agent/toolResults.js +42 -0
- package/dist/core/agent/turnPolicy.d.ts +8 -0
- package/dist/core/agent/turnPolicy.js +23 -0
- package/dist/core/agent/workState.d.ts +18 -5
- package/dist/core/agent/workState.js +39 -20
- package/dist/core/bashOutput/reducers/content.d.ts +1 -0
- package/dist/core/bashOutput/reducers/content.js +1 -1
- package/dist/core/bashOutput/reducers/gh.d.ts +1 -0
- package/dist/core/bashOutput/reducers/gh.js +77 -0
- package/dist/core/bashOutput/registry.js +18 -8
- package/dist/core/goal/completionPolicy.js +1 -1
- package/dist/core/goal/sessionGoal.d.ts +6 -30
- package/dist/core/goal/sessionGoal.js +3 -68
- package/dist/core/safety/bashClassifier.js +30 -0
- package/dist/core/safety/urlGuard.d.ts +1 -0
- package/dist/core/safety/urlGuard.js +6 -1
- package/dist/core/session/sessionSlimming.d.ts +5 -0
- package/dist/core/session/sessionSlimming.js +78 -0
- package/dist/core/session/sessionStore.d.ts +23 -3
- package/dist/core/session/sessionStore.js +30 -10
- package/dist/core/subagent/subagentRunner.d.ts +258 -5
- package/dist/core/subagent/subagentRunner.js +14 -18
- 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/capabilities.d.ts +12 -0
- package/dist/llm/capabilities.js +10 -0
- package/dist/llm/client.d.ts +3 -2
- package/dist/llm/client.js +26 -4
- package/dist/llm/hazeTools.d.ts +7710 -366
- package/dist/llm/hazeTools.js +46 -567
- package/dist/llm/initPrompt.js +1 -1
- package/dist/llm/lsp.d.ts +46 -1
- package/dist/llm/lsp.js +19 -10
- package/dist/llm/lspTools.d.ts +2310 -119
- package/dist/llm/mcp.js +9 -0
- package/dist/llm/requestContext.js +7 -22
- package/dist/llm/systemPrompt.d.ts +1 -0
- package/dist/llm/systemPrompt.js +3 -3
- package/dist/llm/tools/bashTool.d.ts +251 -0
- package/dist/llm/tools/bashTool.js +82 -0
- package/dist/llm/tools/editMatch.d.ts +55 -0
- package/dist/llm/tools/editMatch.js +99 -0
- package/dist/llm/tools/failures.d.ts +36 -0
- package/dist/llm/tools/failures.js +38 -0
- package/dist/llm/tools/fetchTool.d.ts +1201 -0
- package/dist/llm/tools/fetchTool.js +46 -0
- package/dist/llm/tools/fileToolShared.d.ts +10 -0
- package/dist/llm/tools/fileToolShared.js +43 -0
- package/dist/llm/tools/grepParse.d.ts +13 -0
- package/dist/llm/tools/grepParse.js +67 -0
- package/dist/llm/tools/outputCap.d.ts +53 -0
- package/dist/llm/tools/outputCap.js +67 -0
- package/dist/llm/tools/storedOutputTool.d.ts +351 -0
- package/dist/llm/tools/storedOutputTool.js +17 -0
- package/dist/llm/tools/taskTool.d.ts +629 -0
- package/dist/llm/tools/taskTool.js +41 -0
- package/dist/llm/tools/toolContext.d.ts +74 -0
- package/dist/llm/tools/toolContext.js +196 -0
- package/dist/llm/tools/workspaceFile.d.ts +33 -0
- package/dist/llm/tools/workspaceFile.js +27 -0
- package/dist/llm/webFetch.d.ts +13 -1
- package/dist/llm/webFetch.js +122 -28
- package/dist/skills/builder/SkillBuilder.d.ts +3 -0
- package/dist/skills/builder/SkillBuilder.js +8 -8
- package/dist/ui/components/TextInput.d.ts +7 -0
- package/dist/ui/components/TextInput.js +10 -98
- package/dist/ui/inputBuffer.d.ts +28 -0
- package/dist/ui/inputBuffer.js +99 -0
- package/dist/utils/collections.d.ts +6 -0
- package/dist/utils/collections.js +9 -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 +40 -0
- package/examples/skills/files/SKILL.md +1 -1
- package/package.json +14 -15
package/dist/llm/initPrompt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MAX_CONTEXT_FILE_CHARS } from '../config/contextFiles.js';
|
|
2
2
|
export function buildInitPrompt() {
|
|
3
|
-
return `Initialize this repository for
|
|
3
|
+
return `Initialize this repository for haze by creating a best-practice AGENTS.md file.
|
|
4
4
|
|
|
5
5
|
Explore the codebase first, respecting .gitignore, but keep this quick and minimal:
|
|
6
6
|
1. Start with exactly one listFiles call from the workspace root. Do not announce that you are starting before the tool call.
|
package/dist/llm/lsp.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { type ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
1
2
|
import type { HazeLspServer } from '../config/lspSettings.js';
|
|
3
|
+
type Json = null | boolean | number | string | Json[] | {
|
|
4
|
+
[key: string]: Json;
|
|
5
|
+
};
|
|
2
6
|
export declare class LspError extends Error {
|
|
3
7
|
constructor(message: string);
|
|
4
8
|
}
|
|
5
|
-
declare function
|
|
9
|
+
export declare function languageId(filePath: string): string;
|
|
10
|
+
export declare function toUri(absolutePath: string): string;
|
|
11
|
+
export declare function fromUri(uri: string): string;
|
|
12
|
+
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
13
|
+
export declare function asRange(value: unknown): {
|
|
6
14
|
start: {
|
|
7
15
|
line: number;
|
|
8
16
|
character: number;
|
|
@@ -12,7 +20,44 @@ declare function asRange(value: unknown): {
|
|
|
12
20
|
character: number;
|
|
13
21
|
};
|
|
14
22
|
} | undefined;
|
|
23
|
+
export declare function locationToResult(value: unknown): {
|
|
24
|
+
path: string;
|
|
25
|
+
range: {
|
|
26
|
+
start: {
|
|
27
|
+
line: number;
|
|
28
|
+
character: number;
|
|
29
|
+
};
|
|
30
|
+
end: {
|
|
31
|
+
line: number;
|
|
32
|
+
character: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
} | undefined;
|
|
36
|
+
export declare function flattenSymbols(symbols: unknown[], filePath: string, limit: number): {
|
|
37
|
+
name: string;
|
|
38
|
+
kind?: number;
|
|
39
|
+
path: string;
|
|
40
|
+
range?: ReturnType<typeof asRange>;
|
|
41
|
+
selectionRange?: ReturnType<typeof asRange>;
|
|
42
|
+
}[];
|
|
15
43
|
export declare function pickLspServer(servers: HazeLspServer[], filePath: string): HazeLspServer | undefined;
|
|
44
|
+
export declare class StdioLspClient {
|
|
45
|
+
private server;
|
|
46
|
+
private child;
|
|
47
|
+
private id;
|
|
48
|
+
private buffer;
|
|
49
|
+
private pending;
|
|
50
|
+
constructor(server: HazeLspServer, child: ChildProcessWithoutNullStreams);
|
|
51
|
+
static start(server: HazeLspServer): StdioLspClient;
|
|
52
|
+
private rejectAll;
|
|
53
|
+
private onData;
|
|
54
|
+
private send;
|
|
55
|
+
request(method: string, params?: Json, timeoutMs?: number): Promise<unknown>;
|
|
56
|
+
notify(method: string, params?: Json): void;
|
|
57
|
+
initialize(): Promise<void>;
|
|
58
|
+
openDocument(absolutePath: string): Promise<void>;
|
|
59
|
+
close(): Promise<void>;
|
|
60
|
+
}
|
|
16
61
|
export declare function lspDocumentSymbols(server: HazeLspServer, filePath: string, limit: number): Promise<{
|
|
17
62
|
name: string;
|
|
18
63
|
kind?: number;
|
package/dist/llm/lsp.js
CHANGED
|
@@ -9,7 +9,7 @@ export class LspError extends Error {
|
|
|
9
9
|
this.name = 'LspError';
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
function languageId(filePath) {
|
|
12
|
+
export function languageId(filePath) {
|
|
13
13
|
const ext = path.extname(filePath).toLowerCase();
|
|
14
14
|
if (ext === '.ts')
|
|
15
15
|
return 'typescript';
|
|
@@ -27,18 +27,18 @@ function languageId(filePath) {
|
|
|
27
27
|
return 'go';
|
|
28
28
|
return ext.replace(/^\./, '') || 'plaintext';
|
|
29
29
|
}
|
|
30
|
-
function toUri(absolutePath) {
|
|
30
|
+
export function toUri(absolutePath) {
|
|
31
31
|
return pathToFileURL(absolutePath).toString();
|
|
32
32
|
}
|
|
33
|
-
function fromUri(uri) {
|
|
33
|
+
export function fromUri(uri) {
|
|
34
34
|
if (!uri.startsWith('file://'))
|
|
35
35
|
return uri;
|
|
36
36
|
return workspaceRelativePath(new URL(uri).pathname);
|
|
37
37
|
}
|
|
38
|
-
function isObject(value) {
|
|
38
|
+
export function isObject(value) {
|
|
39
39
|
return typeof value === 'object' && value != null && !Array.isArray(value);
|
|
40
40
|
}
|
|
41
|
-
function asRange(value) {
|
|
41
|
+
export function asRange(value) {
|
|
42
42
|
if (!isObject(value) || !isObject(value.start) || !isObject(value.end))
|
|
43
43
|
return undefined;
|
|
44
44
|
const start = value.start;
|
|
@@ -48,16 +48,16 @@ function asRange(value) {
|
|
|
48
48
|
end: { line: typeof end.line === 'number' ? end.line + 1 : 1, character: typeof end.character === 'number' ? end.character + 1 : 1 },
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function locationToResult(value) {
|
|
51
|
+
export function locationToResult(value) {
|
|
52
52
|
if (!isObject(value))
|
|
53
53
|
return undefined;
|
|
54
|
-
const uri = typeof value.uri === 'string' ? value.uri : (
|
|
54
|
+
const uri = typeof value.uri === 'string' ? value.uri : (typeof value.targetUri === 'string' ? value.targetUri : undefined);
|
|
55
55
|
const range = asRange(value.range ?? value.targetSelectionRange ?? value.targetRange);
|
|
56
56
|
if (!uri || !range)
|
|
57
57
|
return undefined;
|
|
58
58
|
return { path: fromUri(uri), range };
|
|
59
59
|
}
|
|
60
|
-
function flattenSymbols(symbols, filePath, limit) {
|
|
60
|
+
export function flattenSymbols(symbols, filePath, limit) {
|
|
61
61
|
const out = [];
|
|
62
62
|
const visit = (items) => {
|
|
63
63
|
for (const item of items) {
|
|
@@ -83,7 +83,7 @@ export function pickLspServer(servers, filePath) {
|
|
|
83
83
|
const ext = path.extname(filePath).toLowerCase();
|
|
84
84
|
return servers.find(server => server.enabled !== false && (server.extensions ?? []).map(e => e.toLowerCase()).includes(ext));
|
|
85
85
|
}
|
|
86
|
-
class StdioLspClient {
|
|
86
|
+
export class StdioLspClient {
|
|
87
87
|
server;
|
|
88
88
|
child;
|
|
89
89
|
id = 0;
|
|
@@ -92,7 +92,16 @@ class StdioLspClient {
|
|
|
92
92
|
constructor(server, child) {
|
|
93
93
|
this.server = server;
|
|
94
94
|
this.child = child;
|
|
95
|
-
child.stdout.on('data', chunk =>
|
|
95
|
+
child.stdout.on('data', chunk => {
|
|
96
|
+
try {
|
|
97
|
+
this.onData(chunk);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
const lspError = error instanceof Error ? error : new LspError(String(error));
|
|
101
|
+
this.rejectAll(lspError);
|
|
102
|
+
this.child.kill('SIGTERM');
|
|
103
|
+
}
|
|
104
|
+
});
|
|
96
105
|
child.stderr.on('data', () => undefined);
|
|
97
106
|
child.on('error', error => this.rejectAll(error instanceof Error ? error : new Error(String(error))));
|
|
98
107
|
child.on('exit', code => this.rejectAll(new LspError(`LSP server exited${code == null ? '' : ` with code ${code}`}`)));
|