@denizokcu/haze 1.7.11 → 1.7.12
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 +18 -0
- package/README.md +113 -97
- package/assets/graph-grammars/NOTICE.md +21 -0
- package/assets/graph-grammars/tree-sitter-javascript.wasm +0 -0
- package/assets/graph-grammars/tree-sitter-tsx.wasm +0 -0
- package/assets/graph-grammars/tree-sitter-typescript.wasm +0 -0
- package/assets/graph-grammars/web-tree-sitter.cjs +4116 -0
- package/assets/graph-grammars/web-tree-sitter.cjs.map +7 -0
- package/assets/graph-grammars/web-tree-sitter.js +4056 -0
- package/assets/graph-grammars/web-tree-sitter.js.map +7 -0
- package/assets/graph-grammars/web-tree-sitter.wasm +0 -0
- package/assets/graph-grammars/web-tree-sitter.wasm.map +55 -0
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/inputSuggestions.js +1 -0
- package/dist/cli/chat/sessionLifecycle.js +2 -1
- package/dist/cli/chat/sessionRecorder.js +4 -1
- package/dist/cli/chat/startupSequence.d.ts +2 -0
- package/dist/cli/chat/startupSequence.js +6 -0
- package/dist/cli/commands/chat.js +5 -2
- package/dist/cli/commands/commandHelp.js +4 -1
- package/dist/cli/commands/commands.js +2 -0
- package/dist/cli/commands/formatters.js +28 -0
- package/dist/cli/commands/graphCommand.d.ts +2 -0
- package/dist/cli/commands/graphCommand.js +60 -0
- package/dist/cli/commands/initCommand.js +14 -0
- package/dist/cli/commands/streaming/agentAttempt.js +11 -1
- package/dist/cli/commands/streaming/attemptOutcome.js +1 -1
- package/dist/cli/commands/streaming/attemptSetup.d.ts +3 -0
- package/dist/cli/commands/streaming/attemptSetup.js +8 -3
- package/dist/cli/commands/streaming/goalSupervisor.js +5 -3
- package/dist/cli/commands/streaming/prepareStep.js +1 -0
- package/dist/cli/commands/streaming/streamLoop.d.ts +2 -0
- package/dist/cli/commands/streaming/streamLoop.js +3 -0
- package/dist/cli/commands/streaming/toolPartHandlers.js +7 -1
- package/dist/cli/commands/streaming.js +5 -0
- package/dist/core/agent/compaction.d.ts +1 -0
- package/dist/core/agent/compaction.js +3 -0
- package/dist/core/graph/analyze.d.ts +61 -0
- package/dist/core/graph/analyze.js +274 -0
- package/dist/core/graph/buildGraph.d.ts +44 -0
- package/dist/core/graph/buildGraph.js +290 -0
- package/dist/core/graph/digest.d.ts +2 -0
- package/dist/core/graph/digest.js +40 -0
- package/dist/core/graph/extract.d.ts +58 -0
- package/dist/core/graph/extract.js +394 -0
- package/dist/core/graph/model.d.ts +63 -0
- package/dist/core/graph/model.js +96 -0
- package/dist/core/graph/query.d.ts +69 -0
- package/dist/core/graph/query.js +391 -0
- package/dist/core/graph/store.d.ts +64 -0
- package/dist/core/graph/store.js +171 -0
- package/dist/core/process/runBoundedProcess.js +12 -6
- package/dist/core/safety/untrustedEnvelopes.d.ts +6 -0
- package/dist/core/safety/untrustedEnvelopes.js +17 -2
- package/dist/core/subagent/executionProfiles.js +4 -4
- package/dist/core/tasks/taskStorage.js +11 -1
- package/dist/core/validation/outputParser.js +16 -8
- package/dist/llm/hazeTools.d.ts +2 -12426
- package/dist/llm/hazeTools.js +2 -0
- package/dist/llm/lspTools.d.ts +3 -12622
- package/dist/llm/requestContext.d.ts +3 -0
- package/dist/llm/requestContext.js +13 -4
- package/dist/llm/subagentRunner.d.ts +2 -308
- package/dist/llm/systemPrompt.js +7 -4
- package/dist/llm/toolResultTypes.d.ts +1 -1
- package/dist/llm/tools/fetchTool.d.ts +2 -1221
- package/dist/llm/tools/fileTools.d.ts +2 -7768
- package/dist/llm/tools/graphAdvisory.d.ts +22 -0
- package/dist/llm/tools/graphAdvisory.js +68 -0
- package/dist/llm/tools/graphTools.d.ts +13 -0
- package/dist/llm/tools/graphTools.js +195 -0
- package/dist/llm/tools/processTool.d.ts +2 -1081
- package/dist/llm/tools/shellTool.d.ts +2 -1513
- package/dist/llm/tools/storedOutputTool.d.ts +2 -355
- package/dist/llm/tools/taskTool.d.ts +2 -489
- package/dist/llm/tools/toolContext.js +24 -9
- package/dist/llm/tools/toolContextState.d.ts +3 -0
- package/dist/llm/tools/toolContextState.js +2 -1
- package/dist/skills/skillTools.js +4 -1
- package/package.json +18 -15
|
@@ -13,7 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* One helper for all envelope producers: no ad-hoc per-site escapes.
|
|
15
15
|
*/
|
|
16
|
-
const
|
|
16
|
+
const ENVELOPE_TAGS = ['web_content', 'mcp_result', 'project_instructions', 'project_context', 'haze_compaction'];
|
|
17
|
+
const ENVELOPE_CLOSER = new RegExp(`<\\/\\s*(?:${ENVELOPE_TAGS.join('|')})\\s*>`, 'gi');
|
|
18
|
+
/** Neutralize one matched closer by breaking the tag open (`<\/`). */
|
|
19
|
+
function escapeCloserMatch(closer) {
|
|
20
|
+
return closer.replace('</', '<\\/');
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
23
|
* Escape every envelope-closing-tag variant in `content` so the payload
|
|
19
24
|
* cannot forge an envelope boundary. The escape breaks the tag open (`<\/`)
|
|
@@ -21,5 +26,15 @@ const ENVELOPE_CLOSER = /<\/\s*(web_content|mcp_result|project_instructions|proj
|
|
|
21
26
|
* the exact form keep working because the producer's own closer is intact.
|
|
22
27
|
*/
|
|
23
28
|
export function escapeEnvelopeClosers(content) {
|
|
24
|
-
return content.replace(ENVELOPE_CLOSER,
|
|
29
|
+
return content.replace(ENVELOPE_CLOSER, escapeCloserMatch);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Escape every closing-tag variant of one additional labeled container (e.g.
|
|
33
|
+
* `project_skill`) with the same variant tolerance as the five built-in
|
|
34
|
+
* kinds, so ad-hoc per-site `replaceAll` escapes cannot reappear.
|
|
35
|
+
*/
|
|
36
|
+
export function escapeTagCloserVariants(content, tag) {
|
|
37
|
+
if (!/^[a-z0-9_]+$/i.test(tag))
|
|
38
|
+
throw new Error(`Invalid envelope tag: ${tag}`);
|
|
39
|
+
return content.replace(new RegExp(`<\\/\\s*${tag}\\s*>`, 'gi'), escapeCloserMatch);
|
|
25
40
|
}
|
|
@@ -27,10 +27,10 @@ export const BUILT_IN_SUBAGENT_PROFILES = {
|
|
|
27
27
|
'cloud-fast': { ...COMPATIBILITY_PROFILE, name: 'cloud-fast', maxConcurrency: 5, deadlineMs: 240_000, maxRetries: 1 },
|
|
28
28
|
};
|
|
29
29
|
export const MODE_TOOL_NAMES = {
|
|
30
|
-
inspect: ['listFiles', 'readFile', 'grep', 'readToolOutput'],
|
|
31
|
-
research: ['listFiles', 'readFile', 'grep', 'readToolOutput', 'fetch'],
|
|
32
|
-
implement: ['listFiles', 'readFile', 'grep', 'readToolOutput', 'editFile', 'replaceLines', 'writeFile', 'shell'],
|
|
33
|
-
validate: ['listFiles', 'readFile', 'grep', 'readToolOutput', 'shell'],
|
|
30
|
+
inspect: ['listFiles', 'readFile', 'grep', 'readToolOutput', 'graphQuery', 'graphExplain', 'graphPath'],
|
|
31
|
+
research: ['listFiles', 'readFile', 'grep', 'readToolOutput', 'fetch', 'graphQuery', 'graphExplain', 'graphPath'],
|
|
32
|
+
implement: ['listFiles', 'readFile', 'grep', 'readToolOutput', 'editFile', 'replaceLines', 'writeFile', 'shell', 'graphQuery', 'graphAffected'],
|
|
33
|
+
validate: ['listFiles', 'readFile', 'grep', 'readToolOutput', 'shell', 'graphAffected'],
|
|
34
34
|
};
|
|
35
35
|
export function isMutationMode(mode) {
|
|
36
36
|
return mode === 'implement' || mode === 'validate';
|
|
@@ -40,7 +40,17 @@ export async function saveTasks(tasks) {
|
|
|
40
40
|
// Mutation guards fail closed: an escaped real path throws instead of writing.
|
|
41
41
|
await assertWritablePathInsideWorkspace(filePath, filePath);
|
|
42
42
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
43
|
-
|
|
43
|
+
// Atomic temp-file-plus-rename (same directory) so a crash mid-write cannot
|
|
44
|
+
// leave truncated JSON that loadTasks would silently reset to an empty list.
|
|
45
|
+
const tempPath = `${filePath}.tmp-${randomUUID()}`;
|
|
46
|
+
await fs.writeFile(tempPath, JSON.stringify(tasks, null, 2), 'utf-8');
|
|
47
|
+
try {
|
|
48
|
+
await fs.rename(tempPath, filePath);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
await fs.rm(tempPath, { force: true }).catch(() => undefined);
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
44
54
|
}
|
|
45
55
|
export async function clearTasks() {
|
|
46
56
|
await saveTasks([]);
|
|
@@ -36,14 +36,17 @@ export function parseValidationOutput(input) {
|
|
|
36
36
|
if (ts) {
|
|
37
37
|
const [, file, lineNo, column, severity, message] = ts;
|
|
38
38
|
diagnostics.push({ file, line: Number(lineNo), column: Number(column), severity: severity === 'warning' ? 'warning' : 'error', message: message ?? '' });
|
|
39
|
-
|
|
39
|
+
if (severity !== 'warning')
|
|
40
|
+
failedFiles.push(file ?? '');
|
|
40
41
|
continue;
|
|
41
42
|
}
|
|
42
43
|
const eslint = line.match(/^(.+?\.(?:ts|tsx|js|jsx|mts|cts))\s*$/);
|
|
43
44
|
if (eslint) {
|
|
44
45
|
const currentFile = eslint[1] ?? '';
|
|
45
46
|
const next = lines[index + 1];
|
|
46
|
-
|
|
47
|
+
// Only error-severity follow-up lines make this a failed file; a
|
|
48
|
+
// warnings-only run must not populate `failedFiles`.
|
|
49
|
+
if (next && /^\s*\d+:\d+\s+error\s/.test(next))
|
|
47
50
|
failedFiles.push(currentFile);
|
|
48
51
|
}
|
|
49
52
|
const eslintDiag = line.match(/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)(?:\s{2,}\S+)?$/);
|
|
@@ -52,7 +55,7 @@ export function parseValidationOutput(input) {
|
|
|
52
55
|
diagnostics.push({ line: Number(lineNo), column: Number(column), severity: severity === 'warning' ? 'warning' : 'error', message: message ?? '' });
|
|
53
56
|
continue;
|
|
54
57
|
}
|
|
55
|
-
const vitestFile = line.match(/^\s*(?:FAIL|FAILED
|
|
58
|
+
const vitestFile = line.match(/^\s*(?:FAIL|FAILED|✗|❯)?\s*([^\s]+\.(?:test|spec)\.(?:ts|tsx|js|jsx))/i);
|
|
56
59
|
if (vitestFile)
|
|
57
60
|
failedFiles.push(vitestFile[1] ?? '');
|
|
58
61
|
const testName = line.match(/^\s*(?:FAIL|✗|×|●)\s+(.+)$/);
|
|
@@ -61,19 +64,24 @@ export function parseValidationOutput(input) {
|
|
|
61
64
|
const genericFile = line.match(/([^\s()]+\.(?:ts|tsx|js|jsx|mts|cts)):(\d+):(\d+)/);
|
|
62
65
|
if (genericFile) {
|
|
63
66
|
const [, file, lineNo, column] = genericFile;
|
|
64
|
-
|
|
65
|
-
diagnostics.push({ file, line: Number(lineNo), column: Number(column), severity
|
|
67
|
+
const severity = /warn/i.test(line) ? 'warning' : 'error';
|
|
68
|
+
diagnostics.push({ file, line: Number(lineNo), column: Number(column), severity, message: line.trim() });
|
|
69
|
+
if (severity === 'error')
|
|
70
|
+
failedFiles.push(file ?? '');
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
const uniqueFiles = uniq(failedFiles).slice(0, 10);
|
|
69
74
|
const uniqueTests = uniq(failedTests).slice(0, 10);
|
|
70
75
|
const diagCount = diagnostics.length;
|
|
76
|
+
const errorDiagCount = diagnostics.filter(diagnostic => diagnostic.severity === 'error').length;
|
|
71
77
|
const rawOutputTruncated = Boolean(input.stdoutTruncated || input.stderrTruncated);
|
|
72
78
|
// Pipes (e.g. `npm test | tail`) and process substitutions can mask a
|
|
73
79
|
// non-zero exit code behind the final command in the pipeline. Treat
|
|
74
|
-
// parsed failure evidence as authoritative over `code` so a green exit
|
|
75
|
-
// status does not override real failures the parser already found.
|
|
76
|
-
|
|
80
|
+
// parsed *failure* evidence as authoritative over `code` so a green exit
|
|
81
|
+
// status does not override real failures the parser already found. Only
|
|
82
|
+
// error-severity diagnostics and failed tests count: warning diagnostics
|
|
83
|
+
// never fail an otherwise-green run (ESLint exits 0 on warnings only).
|
|
84
|
+
const hasFailureEvidence = uniqueTests.length > 0 || errorDiagCount > 0;
|
|
77
85
|
const status = input.timedOut
|
|
78
86
|
? 'timed_out'
|
|
79
87
|
: hasFailureEvidence
|