@denizokcu/haze 0.11.0 → 1.0.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 +23 -0
- package/README.md +23 -14
- package/SECURITY.md +3 -3
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/chatMetrics.d.ts +2 -2
- package/dist/cli/chat/chatMetrics.js +1 -1
- package/dist/cli/chat/fileMentionSuggestions.js +1 -1
- package/dist/cli/chat/inputSuggestions.d.ts +8 -16
- package/dist/cli/chat/inputSuggestions.js +9 -41
- package/dist/cli/chat/messages.d.ts +0 -2
- package/dist/cli/chat/messages.js +2 -2
- package/dist/cli/chat/sessionLifecycle.d.ts +2 -1
- package/dist/cli/chat/turnState.d.ts +1 -1
- package/dist/cli/chat/wizardDispatch.d.ts +90 -28
- package/dist/cli/chat/wizardDispatch.js +250 -133
- package/dist/cli/commands/chat.js +14 -72
- package/dist/cli/commands/chatModes.d.ts +8 -1
- package/dist/cli/commands/chatModes.js +9 -44
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/formatters.d.ts +3 -3
- package/dist/cli/commands/formatters.js +6 -25
- package/dist/cli/commands/providerWizard.js +2 -3
- package/dist/cli/commands/runCommand.js +1 -1
- package/dist/cli/commands/serverWizard.d.ts +34 -0
- package/dist/cli/commands/{mcpWizard.js → serverWizard.js} +44 -2
- package/dist/cli/commands/skillsWizard.d.ts +41 -0
- package/dist/cli/commands/{skillWizard.js → skillsWizard.js} +33 -11
- package/dist/cli/commands/streaming/abortCause.d.ts +2 -1
- package/dist/cli/commands/streaming/agentAttempt.d.ts +43 -0
- package/dist/cli/commands/streaming/agentAttempt.js +79 -0
- package/dist/cli/commands/streaming/attemptLifecycle.d.ts +56 -0
- package/dist/cli/commands/streaming/attemptLifecycle.js +110 -0
- package/dist/cli/commands/streaming/attemptOutcome.d.ts +96 -0
- package/dist/cli/commands/streaming/attemptOutcome.js +206 -0
- package/dist/cli/commands/streaming/attemptSetup.d.ts +78 -0
- package/dist/cli/commands/streaming/attemptSetup.js +167 -0
- package/dist/cli/commands/streaming/goalCheckpoint.d.ts +1 -1
- package/dist/cli/commands/streaming/goalCheckpoint.js +2 -2
- package/dist/cli/commands/streaming/goalSupervisor.js +9 -6
- package/dist/cli/commands/streaming/stallRecovery.d.ts +94 -0
- package/dist/cli/commands/streaming/stallRecovery.js +105 -0
- package/dist/cli/commands/streaming/streamLoop.d.ts +72 -0
- package/dist/cli/commands/streaming/streamLoop.js +448 -0
- package/dist/cli/commands/streaming/toolCallRecovery.d.ts +14 -0
- package/dist/cli/commands/streaming/toolCallRecovery.js +56 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +2 -1
- package/dist/cli/commands/streaming/turnRuntime.d.ts +4 -0
- package/dist/cli/commands/streaming/turnRuntime.js +6 -0
- package/dist/cli/commands/streaming.d.ts +14 -25
- package/dist/cli/commands/streaming.js +43 -754
- package/dist/cli/commands/wizardFlow.d.ts +334 -0
- package/dist/cli/commands/wizardFlow.js +377 -0
- package/dist/cli/contextReport.js +3 -0
- package/dist/cli/index.js +1 -1
- package/dist/config/contextFiles.js +9 -3
- package/dist/config/inputHistory.d.ts +0 -1
- package/dist/config/inputHistory.js +1 -1
- package/dist/config/modelDiscovery.d.ts +0 -15
- package/dist/config/modelDiscovery.js +1 -1
- package/dist/config/settings.d.ts +7 -0
- package/dist/config/settings.js +3 -0
- package/dist/config/skillSettings.js +4 -4
- package/dist/config/updateCheck.d.ts +0 -1
- package/dist/config/updateCheck.js +1 -1
- package/dist/core/agent/budgets.d.ts +63 -1
- package/dist/core/agent/budgets.js +84 -1
- package/dist/core/agent/compaction.js +1 -1
- package/dist/core/agent/completionController.d.ts +7 -13
- package/dist/core/agent/completionController.js +17 -8
- package/dist/core/agent/contextBudget.d.ts +0 -4
- package/dist/core/agent/contextBudget.js +3 -3
- package/dist/core/agent/errors.d.ts +0 -1
- package/dist/core/agent/errors.js +1 -1
- package/dist/core/agent/events.d.ts +5 -1
- package/dist/core/{goal/completionPolicy.d.ts → agent/goalPolicy.d.ts} +18 -0
- package/dist/core/agent/goalPolicy.js +106 -0
- package/dist/core/agent/requestAssembly.d.ts +2 -2
- package/dist/core/agent/requestAssembly.js +16 -4
- package/dist/core/agent/toolCapabilities.d.ts +2 -2
- package/dist/core/agent/toolCapabilities.js +5 -5
- package/dist/core/agent/toolOutputStore.js +1 -1
- package/dist/core/agent/toolResults.js +1 -1
- package/dist/core/agent/workState.d.ts +6 -3
- package/dist/core/agent/workState.js +62 -7
- package/dist/core/attachments/imageAttachments.js +90 -42
- package/dist/core/deadline.d.ts +0 -6
- package/dist/core/deadline.js +1 -1
- package/dist/core/io/boundedRead.js +1 -1
- package/dist/core/limits.d.ts +51 -0
- package/dist/core/limits.js +51 -0
- package/dist/core/log/llmLog.js +1 -1
- package/dist/core/process/backgroundRegistry.d.ts +2 -3
- package/dist/core/process/backgroundRegistry.js +10 -6
- package/dist/core/process/userShell.d.ts +16 -0
- package/dist/core/process/userShell.js +59 -0
- package/dist/core/safety/shellClassifier.d.ts +11 -0
- package/dist/core/safety/{bashClassifier.js → shellClassifier.js} +5 -3
- package/dist/core/safety/urlGuard.d.ts +1 -1
- package/dist/core/session/sessionSlimming.d.ts +0 -3
- package/dist/core/session/sessionSlimming.js +2 -3
- package/dist/core/session/sessionStore.d.ts +1 -0
- package/dist/core/session/sessionStore.js +39 -20
- package/dist/core/{bashOutput → shellOutput}/lineFilter.js +8 -2
- package/dist/core/{bashOutput → shellOutput}/reducers/search.d.ts +0 -1
- package/dist/core/{bashOutput → shellOutput}/reducers/search.js +1 -1
- package/dist/core/shellOutput/registry.d.ts +2 -0
- package/dist/core/{bashOutput → shellOutput}/registry.js +3 -3
- package/dist/core/{bashOutput → shellOutput}/types.d.ts +6 -5
- package/dist/core/subagent/contracts.d.ts +2 -14
- package/dist/core/subagent/contracts.js +3 -3
- package/dist/core/subagent/executionProfiles.js +2 -2
- package/dist/core/subagent/subagentRunner.js +3 -4
- package/dist/core/toolOutput/reduction.d.ts +0 -12
- package/dist/core/toolOutput/reduction.js +1 -1
- package/dist/core/validation/outputParser.d.ts +2 -2
- package/dist/llm/client.js +5 -1
- package/dist/llm/hazeTools.d.ts +139 -124
- package/dist/llm/hazeTools.js +14 -11
- package/dist/llm/initPrompt.js +1 -1
- package/dist/llm/lsp/client.d.ts +45 -0
- package/dist/llm/lsp/client.js +195 -0
- package/dist/llm/lsp/pool.d.ts +23 -0
- package/dist/llm/lsp/pool.js +86 -0
- package/dist/llm/lsp/protocol.d.ts +64 -0
- package/dist/llm/lsp/protocol.js +128 -0
- package/dist/llm/lsp/requests.d.ts +94 -0
- package/dist/llm/lsp/requests.js +119 -0
- package/dist/llm/lspTools.d.ts +3824 -570
- package/dist/llm/lspTools.js +65 -1
- package/dist/llm/openaiCodex.d.ts +0 -2
- package/dist/llm/openaiCodex.js +0 -4
- package/dist/llm/openaiCodexOAuth.d.ts +0 -3
- package/dist/llm/openaiCodexOAuth.js +6 -3
- package/dist/llm/requestContext.d.ts +5 -1
- package/dist/llm/requestContext.js +25 -2
- package/dist/llm/systemPrompt.d.ts +1 -0
- package/dist/llm/systemPrompt.js +13 -6
- package/dist/llm/toolResultTypes.d.ts +0 -14
- package/dist/llm/toolResultTypes.js +1 -4
- package/dist/llm/tools/editMatch.d.ts +0 -9
- package/dist/llm/tools/editMatch.js +1 -1
- package/dist/llm/tools/fetchTool.js +1 -1
- package/dist/llm/tools/fileToolShared.d.ts +4 -2
- package/dist/llm/tools/fileToolShared.js +9 -5
- package/dist/llm/tools/gitIgnore.d.ts +25 -32
- package/dist/llm/tools/gitIgnore.js +216 -98
- package/dist/llm/tools/grepParse.d.ts +2 -1
- package/dist/llm/tools/grepRunner.d.ts +1 -1
- package/dist/llm/tools/grepRunner.js +2 -2
- package/dist/llm/tools/outputCap.d.ts +2 -7
- package/dist/llm/tools/outputCap.js +3 -3
- package/dist/llm/tools/processTool.d.ts +16 -16
- package/dist/llm/tools/processTool.js +1 -1
- package/dist/llm/tools/readRecovery.d.ts +0 -2
- package/dist/llm/tools/readRecovery.js +2 -2
- package/dist/llm/tools/{bashTool.d.ts → shellTool.d.ts} +123 -107
- package/dist/llm/tools/{bashTool.js → shellTool.js} +15 -14
- package/dist/llm/tools/toolContext.js +5 -5
- package/dist/llm/tools/workspaceFile.d.ts +0 -1
- package/dist/llm/tools/workspaceFile.js +1 -6
- package/dist/llm/webFetch.d.ts +1 -1
- package/dist/skills/SkillLoader.d.ts +1 -11
- package/dist/skills/SkillLoader.js +1 -2
- package/dist/skills/types.d.ts +2 -1
- package/dist/utils/buildInfo.d.ts +6 -13
- package/dist/utils/buildInfo.js +6 -15
- package/dist/utils/fs.d.ts +7 -5
- package/dist/utils/fs.js +5 -2
- package/dist/utils/path.d.ts +0 -1
- package/dist/utils/path.js +1 -1
- package/package.json +6 -4
- package/dist/cli/commands/lspWizard.d.ts +0 -14
- package/dist/cli/commands/lspWizard.js +0 -44
- package/dist/cli/commands/mcpWizard.d.ts +0 -15
- package/dist/cli/commands/skillConfirmRemove.d.ts +0 -11
- package/dist/cli/commands/skillConfirmRemove.js +0 -20
- package/dist/cli/commands/skillCreation.d.ts +0 -12
- package/dist/cli/commands/skillCreation.js +0 -14
- package/dist/cli/commands/skillWizard.d.ts +0 -17
- package/dist/cli/commands/streaming/idleTimer.d.ts +0 -26
- package/dist/cli/commands/streaming/idleTimer.js +0 -24
- package/dist/cli/commands/streaming/turnOutcome.d.ts +0 -27
- package/dist/cli/commands/streaming/turnOutcome.js +0 -29
- package/dist/cli/commands/wizardActions.d.ts +0 -47
- package/dist/cli/commands/wizardActions.js +0 -47
- package/dist/cli/commands/wizardInput.d.ts +0 -4
- package/dist/cli/commands/wizardInput.js +0 -19
- package/dist/cli/commands/wizardPrompts.d.ts +0 -22
- package/dist/cli/commands/wizardPrompts.js +0 -58
- package/dist/cli/commands/wizardSuggestions.d.ts +0 -31
- package/dist/cli/commands/wizardSuggestions.js +0 -190
- package/dist/cli/commands/wizardTransition.d.ts +0 -37
- package/dist/cli/commands/wizardTransition.js +0 -43
- package/dist/core/agent/toolExecutionBudget.d.ts +0 -35
- package/dist/core/agent/toolExecutionBudget.js +0 -49
- package/dist/core/agent/turnBudget.d.ts +0 -35
- package/dist/core/agent/turnBudget.js +0 -27
- package/dist/core/bashOutput/ansi.d.ts +0 -1
- package/dist/core/bashOutput/ansi.js +0 -7
- package/dist/core/bashOutput/registry.d.ts +0 -4
- package/dist/core/goal/completionPolicy.js +0 -43
- package/dist/core/goal/requestClassifier.d.ts +0 -3
- package/dist/core/goal/requestClassifier.js +0 -18
- package/dist/core/goal/sessionGoal.d.ts +0 -8
- package/dist/core/goal/sessionGoal.js +0 -30
- package/dist/core/limits/byteBudgets.d.ts +0 -20
- package/dist/core/limits/byteBudgets.js +0 -20
- package/dist/core/limits/textBudgets.d.ts +0 -25
- package/dist/core/limits/textBudgets.js +0 -25
- package/dist/core/safety/bashClassifier.d.ts +0 -10
- package/dist/llm/lsp.d.ts +0 -149
- package/dist/llm/lsp.js +0 -368
- package/dist/ui/components/ErrorView.d.ts +0 -4
- package/dist/ui/components/ErrorView.js +0 -7
- package/dist/utils/yaml.d.ts +0 -2
- package/dist/utils/yaml.js +0 -8
- package/examples/skills/files/SKILL.md +0 -16
- package/examples/skills/files/examples/file-editing.md +0 -3
- /package/dist/core/{bashOutput → shellOutput}/command.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/command.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/lineFilter.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/content.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/content.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/gh.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/gh.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/git.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/git.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/validation.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/validation.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/types.js +0 -0
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { tool } from 'ai';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { classifyShellCommand, isValidationClassification } from '../../core/safety/shellClassifier.js';
|
|
4
4
|
import { detectMissingExecutable, missingExecutableFields } from '../../core/safety/missingExecutable.js';
|
|
5
5
|
import { parseValidationOutput } from '../../core/validation/outputParser.js';
|
|
6
|
-
import {
|
|
6
|
+
import { filterShellOutput } from '../../core/shellOutput/registry.js';
|
|
7
7
|
import { storeToolOutput } from '../../core/agent/toolOutputStore.js';
|
|
8
8
|
import { workspaceRoot } from '../../utils/path.js';
|
|
9
9
|
import { compactStoredOutput, COMPACT_COMMAND_CHARS } from './outputCap.js';
|
|
10
10
|
import { hazeContext, hazeToolContextSchema, runDedupedTool } from './toolContext.js';
|
|
11
11
|
import { runBoundedProcess } from '../../core/process/runBoundedProcess.js';
|
|
12
|
-
import {
|
|
13
|
-
import { SHORT_VALIDATION_CHARS } from '../../core/limits/textBudgets.js';
|
|
12
|
+
import { SHELL_STREAM_BYTES, SHORT_VALIDATION_CHARS } from '../../core/limits.js';
|
|
14
13
|
import { startBackgroundProcess } from '../../core/process/backgroundRegistry.js';
|
|
14
|
+
import { resolveUserShell, shellInvocation, shellSyntaxGuidance } from '../../core/process/userShell.js';
|
|
15
15
|
/** Byte-stat metadata only — the raw stream text must never reach the model context (see code-review CR-001). */
|
|
16
16
|
function streamByteStats(stream) {
|
|
17
17
|
return { totalBytes: stream.totalBytes, retainedBytes: stream.retainedBytes, omittedBytes: stream.omittedBytes };
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const userShell = resolveUserShell();
|
|
20
|
+
export const shellTool = tool({
|
|
21
|
+
description: 'Run workspace inspection or validation. Set purpose=validation for custom checks that should count as completion evidence; risk classification is informational.',
|
|
21
22
|
contextSchema: hazeToolContextSchema,
|
|
22
23
|
inputSchema: z.object({
|
|
23
|
-
command: z.string().min(1).describe(
|
|
24
|
+
command: z.string().min(1).describe(`Command to execute with ${userShell} ${shellInvocation('', userShell).args.join(' ')}. ${shellSyntaxGuidance(userShell)}`.trim()),
|
|
25
|
+
purpose: z.enum(['auto', 'validation']).default('auto').describe('Use validation for an intentional test/check command, including custom assertion scripts; pass/fail still comes from the real process result.'),
|
|
24
26
|
timeoutSeconds: z.number().int().positive().max(600).optional().describe('Timeout in seconds; defaults to 60'),
|
|
25
|
-
allowMutation: z.boolean().default(false).describe('Deprecated compatibility flag. Commands run without confirmation; retained for compatibility.'),
|
|
26
27
|
background: z.boolean().default(false).describe('Start a registered long-running process and return immediately. Use process to list, inspect output, or kill it.'),
|
|
27
28
|
}),
|
|
28
|
-
execute: async ({ command, timeoutSeconds, background }, context) => runDedupedTool('
|
|
29
|
+
execute: async ({ command, purpose, timeoutSeconds, background }, context) => runDedupedTool('shell', { command, purpose, timeoutSeconds, background }, context, async () => {
|
|
29
30
|
const cwd = workspaceRoot();
|
|
30
|
-
const classification =
|
|
31
|
+
const classification = classifyShellCommand(command);
|
|
31
32
|
if (background) {
|
|
32
33
|
if (hazeContext(context)?.isSubagent) {
|
|
33
34
|
return { ok: false, command, reasonCode: 'background_not_allowed', recoverable: false, error: 'Background processes are available only to the main haze turn, not fleet workers.', suggestedNextStep: 'Run the server from the main conversation.' };
|
|
@@ -45,21 +46,21 @@ export const bashTool = tool({
|
|
|
45
46
|
}
|
|
46
47
|
const timeoutMs = (timeoutSeconds ?? 60) * 1000;
|
|
47
48
|
const startedAt = Date.now();
|
|
48
|
-
const processResult = await runBoundedProcess({ command
|
|
49
|
+
const processResult = await runBoundedProcess({ ...shellInvocation(command), cwd, timeoutMs, signal: context.abortSignal, maxStdoutBytes: SHELL_STREAM_BYTES, maxStderrBytes: SHELL_STREAM_BYTES });
|
|
49
50
|
const { code, timedOut } = processResult;
|
|
50
51
|
const stdout = processResult.stdout.text;
|
|
51
52
|
const stderr = processResult.stderr.text;
|
|
52
|
-
const validationSummary = isValidationClassification(classification)
|
|
53
|
+
const validationSummary = purpose === 'validation' || isValidationClassification(classification)
|
|
53
54
|
? parseValidationOutput({ command, code, stdout, stderr, timedOut, stdoutTruncated: processResult.stdout.omittedBytes > 0, stderrTruncated: processResult.stderr.omittedBytes > 0, classification })
|
|
54
55
|
: undefined;
|
|
55
56
|
const validationPassed = validationSummary?.status === 'passed';
|
|
56
|
-
const output =
|
|
57
|
+
const output = filterShellOutput({ command, code, stdout, stderr, timedOut, classification, validationSummary, storeRawOutput: storeToolOutput, fallbackCompact: compactStoredOutput, compactMaxChars: validationPassed ? SHORT_VALIDATION_CHARS : COMPACT_COMMAND_CHARS });
|
|
57
58
|
// Generic, dependency-agnostic diagnostic for a missing executable. Only the
|
|
58
59
|
// executable name and a generic next step are exposed (never raw stderr).
|
|
59
60
|
const missing = code !== 0 && !processResult.aborted ? detectMissingExecutable({ command, code, stderr }) : undefined;
|
|
60
61
|
return {
|
|
61
62
|
ok: code === 0 && !timedOut && !processResult.aborted && !processResult.error,
|
|
62
|
-
code, command, cwd, classification, durationMs: Date.now() - startedAt, timedOut,
|
|
63
|
+
code, command, purpose, cwd, classification, durationMs: Date.now() - startedAt, timedOut,
|
|
63
64
|
aborted: processResult.aborted, signal: processResult.signal, forcedTermination: processResult.forced,
|
|
64
65
|
stdout: output.stdout, stderr: output.stderr, validationSummary,
|
|
65
66
|
stdoutBytes: streamByteStats(processResult.stdout), stderrBytes: streamByteStats(processResult.stderr),
|
|
@@ -55,7 +55,7 @@ export function hazeContext(context) {
|
|
|
55
55
|
return isHazeToolContext(value) ? value : undefined;
|
|
56
56
|
}
|
|
57
57
|
export function toolsContextFor(tools, context) {
|
|
58
|
-
const hazeToolNames = new Set(['listFiles', 'readFile', 'grep', 'replaceLines', 'writeFile', 'editFile', '
|
|
58
|
+
const hazeToolNames = new Set(['listFiles', 'readFile', 'grep', 'replaceLines', 'writeFile', 'editFile', 'shell', 'process', 'fetch']);
|
|
59
59
|
return Object.fromEntries(Object.keys(tools).filter(name => hazeToolNames.has(name)).map(name => [name, context]));
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -114,15 +114,15 @@ export function scopedContextMutationStop(toolName, filePath, files) {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
function isMutatingTool(toolName) {
|
|
117
|
-
//
|
|
117
|
+
// Shell execution is conservatively workspace-mutation-capable. Classification remains
|
|
118
118
|
// informational and is not a sandbox boundary.
|
|
119
|
-
return ['editFile', 'replaceLines', 'writeFile', '
|
|
119
|
+
return ['editFile', 'replaceLines', 'writeFile', 'shell'].includes(toolName);
|
|
120
120
|
}
|
|
121
121
|
function isReadOnlyFileTool(toolName) {
|
|
122
122
|
return ['listFiles', 'readFile', 'grep'].includes(toolName);
|
|
123
123
|
}
|
|
124
124
|
// Read-only tools that participate in completed-call deduplication within a
|
|
125
|
-
// turn (no side effects).
|
|
125
|
+
// turn (no side effects). Shell is deliberately excluded: commands can observe
|
|
126
126
|
// external state changes between identical calls (CR-007).
|
|
127
127
|
function isDeduplicableReadOnlyTool(toolName) {
|
|
128
128
|
return isReadOnlyFileTool(toolName) || toolName === 'fetch';
|
|
@@ -188,7 +188,7 @@ export async function runDedupedTool(toolName, input, context, execute) {
|
|
|
188
188
|
if (isMutatingTool(toolName) && ctx.mutationPolicy) {
|
|
189
189
|
// A worker supplies its whole-run owner so nested tool calls are
|
|
190
190
|
// reentrant. Main-turn calls intentionally receive a fresh owner per
|
|
191
|
-
// mutation, serializing concurrent edit/
|
|
191
|
+
// mutation, serializing concurrent edit/shell calls.
|
|
192
192
|
const owner = ctx.mutationOwner ?? ctx.mutationPolicy.createOwner();
|
|
193
193
|
releaseMutation = await ctx.mutationPolicy.acquire(owner, context.abortSignal);
|
|
194
194
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type ToolExecutionContext } from './toolContext.js';
|
|
2
|
-
export declare function prepareWorkspaceExisting(filePath: string): Promise<string>;
|
|
3
2
|
/**
|
|
4
3
|
* Resolve a read path and confine it to the workspace — unless the user
|
|
5
4
|
* explicitly mentioned it (or a parent directory) in the prompt this turn.
|
|
@@ -4,11 +4,6 @@ import { assertRealPathInsideWorkspace, assertWritablePathInsideWorkspace, resol
|
|
|
4
4
|
import { isPathBlessed } from '../../core/attachments/readBlessings.js';
|
|
5
5
|
import { assertNotIgnored } from './fileToolShared.js';
|
|
6
6
|
import { discoverScopedContext, hazeContext, scopedContextMutationStop } from './toolContext.js';
|
|
7
|
-
export async function prepareWorkspaceExisting(filePath) {
|
|
8
|
-
const absolutePath = resolveWorkspacePath(filePath);
|
|
9
|
-
await assertRealPathInsideWorkspace(absolutePath, filePath);
|
|
10
|
-
return absolutePath;
|
|
11
|
-
}
|
|
12
7
|
/**
|
|
13
8
|
* Resolve a read path and confine it to the workspace — unless the user
|
|
14
9
|
* explicitly mentioned it (or a parent directory) in the prompt this turn.
|
|
@@ -26,7 +21,7 @@ export async function prepareWorkspaceRead(filePath, allowIgnored, context) {
|
|
|
26
21
|
return absolutePath;
|
|
27
22
|
}
|
|
28
23
|
const absolutePath = resolveWorkspacePath(filePath);
|
|
29
|
-
await assertNotIgnored(absolutePath, filePath, allowIgnored);
|
|
24
|
+
await assertNotIgnored(absolutePath, filePath, allowIgnored, { operation: 'read' });
|
|
30
25
|
await assertRealPathInsideWorkspace(absolutePath, filePath);
|
|
31
26
|
return absolutePath;
|
|
32
27
|
}
|
package/dist/llm/webFetch.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface FetchOptions {
|
|
|
30
30
|
* caller). When `pinnedIp` is undefined (literal-IP URL), the transport falls
|
|
31
31
|
* back to the global fetch — no DNS-rebinding surface exists for a literal IP.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
type PinnedFetcher = (url: URL, pinnedIp: string | undefined, init: RequestInit) => Promise<Response>;
|
|
34
34
|
export interface FetchResult {
|
|
35
35
|
url: string;
|
|
36
36
|
status: number;
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import type { LoadedSkill,
|
|
2
|
-
declare function parseSkillMarkdown(content: string): {
|
|
3
|
-
frontmatter: SkillFrontmatter;
|
|
4
|
-
body: string;
|
|
5
|
-
};
|
|
6
|
-
declare function referencedPaths(body: string): string[];
|
|
1
|
+
import type { LoadedSkill, SkillSource } from './types.js';
|
|
7
2
|
export declare function loadSkill(dir: string, source?: SkillSource): Promise<LoadedSkill | null>;
|
|
8
|
-
export declare const internals: {
|
|
9
|
-
parseSkillMarkdown: typeof parseSkillMarkdown;
|
|
10
|
-
referencedPaths: typeof referencedPaths;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
@@ -2,7 +2,7 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import YAML from 'yaml';
|
|
4
4
|
import { assertRealPathInsideRoot } from '../utils/path.js';
|
|
5
|
-
import { SKILL_MARKDOWN_BYTES } from '../core/limits
|
|
5
|
+
import { SKILL_MARKDOWN_BYTES } from '../core/limits.js';
|
|
6
6
|
import { readUtf8Prefix } from '../core/io/boundedRead.js';
|
|
7
7
|
const MAX_REFERENCE_BYTES = 50_000;
|
|
8
8
|
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
|
|
@@ -77,4 +77,3 @@ export async function loadSkill(dir, source = 'global') {
|
|
|
77
77
|
const references = await Promise.all(referencedPaths(body).map(ref => loadReference(dir, ref)));
|
|
78
78
|
return { dir, path: realSkillPath, name: frontmatter.name, description: frontmatter.description, body, references, source };
|
|
79
79
|
}
|
|
80
|
-
export const internals = { parseSkillMarkdown, referencedPaths };
|
package/dist/skills/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface LoadedSkill {
|
|
|
17
17
|
references: LoadedSkillReference[];
|
|
18
18
|
source: SkillSource;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
interface SkillRegistryError {
|
|
21
21
|
directory: string;
|
|
22
22
|
message: string;
|
|
23
23
|
source?: SkillSource;
|
|
@@ -29,3 +29,4 @@ export interface SkillRegistry {
|
|
|
29
29
|
candidates?: LoadedSkill[];
|
|
30
30
|
errors: SkillRegistryError[];
|
|
31
31
|
}
|
|
32
|
+
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** Package identity used to recognize a haze checkout near the working directory. */
|
|
2
|
-
export declare const HAZE_PACKAGE_NAME = "@denizokcu/haze";
|
|
3
1
|
/**
|
|
4
2
|
* Build provenance embedded by `npm run build` (dist/buildInfo.json). Safe
|
|
5
3
|
* metadata only — never environment, credentials, or conversation content.
|
|
@@ -13,14 +11,14 @@ export interface BuildInfo {
|
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
15
13
|
* Runtime capability registry: observable facts about the running build, so
|
|
16
|
-
* behavior can be diagnosed without inferring it from semantic versions.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* behavior can be diagnosed without inferring it from semantic versions. The
|
|
15
|
+
* goal supervisor's compiled artifact gates logical-goal supervision, cross-turn
|
|
16
|
+
* checkpoints, and automatic budget continuation together, so a single flag
|
|
17
|
+
* describes all supervisor-derived behavior; a runtime missing the artifact
|
|
18
|
+
* reports it unavailable.
|
|
19
19
|
*/
|
|
20
20
|
export interface RuntimeCapabilities {
|
|
21
|
-
|
|
22
|
-
crossTurnCheckpoints: boolean;
|
|
23
|
-
automaticBudgetContinuation: boolean;
|
|
21
|
+
goalSupervisorAvailable: boolean;
|
|
24
22
|
}
|
|
25
23
|
/** Compiled module whose presence proves the autonomous goal supervisor is in this build. */
|
|
26
24
|
export declare const GOAL_SUPERVISOR_ARTIFACT: string;
|
|
@@ -38,8 +36,6 @@ export declare function resetBuildInfoCache(): void;
|
|
|
38
36
|
export declare function loadBuildInfoFrom(candidates: readonly string[]): BuildInfo | undefined;
|
|
39
37
|
/** Read a package.json version from an explicit package root. */
|
|
40
38
|
export declare function readPackageVersionAt(root: string): string | undefined;
|
|
41
|
-
/** Read a package.json name from an explicit package root. */
|
|
42
|
-
export declare function readPackageNameAt(root: string): string | undefined;
|
|
43
39
|
/**
|
|
44
40
|
* Nearest ancestor directory (starting at `start`, default: this module's
|
|
45
41
|
* location) containing a package.json — i.e. the package root of the code
|
|
@@ -70,9 +66,6 @@ export interface RuntimeProvenance {
|
|
|
70
66
|
}
|
|
71
67
|
/** Resolved entry executable (process.argv[1]); undefined in non-CLI contexts. */
|
|
72
68
|
export declare function resolveExecutable(): string | undefined;
|
|
73
|
-
export declare function describeRuntime(input?: {
|
|
74
|
-
runtimeRoot?: string;
|
|
75
|
-
}): RuntimeProvenance;
|
|
76
69
|
/** `haze --version --verbose` block: version, commit, runtime/executable paths, supervisor state. */
|
|
77
70
|
export declare function formatVersionVerbose(provenance?: RuntimeProvenance): string;
|
|
78
71
|
/** A nearby haze checkout whose version/commit diverges from the executing runtime. */
|
package/dist/utils/buildInfo.js
CHANGED
|
@@ -3,7 +3,7 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { compareVersions } from './version.js';
|
|
5
5
|
/** Package identity used to recognize a haze checkout near the working directory. */
|
|
6
|
-
|
|
6
|
+
const HAZE_PACKAGE_NAME = '@denizokcu/haze';
|
|
7
7
|
/** Compiled module whose presence proves the autonomous goal supervisor is in this build. */
|
|
8
8
|
export const GOAL_SUPERVISOR_ARTIFACT = join('dist', 'cli', 'commands', 'streaming', 'goalSupervisor.js');
|
|
9
9
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
@@ -77,7 +77,7 @@ export function readPackageVersionAt(root) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
/** Read a package.json name from an explicit package root. */
|
|
80
|
-
|
|
80
|
+
function readPackageNameAt(root) {
|
|
81
81
|
try {
|
|
82
82
|
const parsed = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
|
|
83
83
|
return typeof parsed.name === 'string' ? parsed.name : undefined;
|
|
@@ -143,20 +143,11 @@ export function goalSupervisorArtifactPresent(root) {
|
|
|
143
143
|
}
|
|
144
144
|
/** Capabilities of the running build, verified against its compiled artifacts. */
|
|
145
145
|
export function runtimeCapabilities(root = resolvePackageRoot() ?? process.cwd()) {
|
|
146
|
-
|
|
147
|
-
return {
|
|
148
|
-
logicalGoalSupervisor: supervisor,
|
|
149
|
-
crossTurnCheckpoints: supervisor,
|
|
150
|
-
automaticBudgetContinuation: supervisor,
|
|
151
|
-
};
|
|
146
|
+
return { goalSupervisorAvailable: goalSupervisorArtifactPresent(root) };
|
|
152
147
|
}
|
|
153
148
|
/** One-line capability summary for logs and doctor output. */
|
|
154
149
|
export function formatCapabilities(capabilities) {
|
|
155
|
-
return
|
|
156
|
-
`logical-goal-supervisor=${capabilities.logicalGoalSupervisor ? 'enabled' : 'disabled'}`,
|
|
157
|
-
`cross-turn-checkpoints=${capabilities.crossTurnCheckpoints ? 'enabled' : 'disabled'}`,
|
|
158
|
-
`automatic-budget-continuation=${capabilities.automaticBudgetContinuation ? 'enabled' : 'disabled'}`,
|
|
159
|
-
].join(', ');
|
|
150
|
+
return `goal-supervisor=${capabilities.goalSupervisorAvailable ? 'enabled' : 'disabled'}`;
|
|
160
151
|
}
|
|
161
152
|
/** Resolved entry executable (process.argv[1]); undefined in non-CLI contexts. */
|
|
162
153
|
export function resolveExecutable() {
|
|
@@ -169,7 +160,7 @@ export function resolveExecutable() {
|
|
|
169
160
|
return process.argv[1];
|
|
170
161
|
}
|
|
171
162
|
}
|
|
172
|
-
|
|
163
|
+
function describeRuntime(input = {}) {
|
|
173
164
|
const runtimeRoot = input.runtimeRoot ?? resolvePackageRoot();
|
|
174
165
|
const build = readBuildInfo(input.runtimeRoot ? [join(input.runtimeRoot, 'dist', 'buildInfo.json')] : undefined);
|
|
175
166
|
const version = build?.version ?? readPackageVersionAt(runtimeRoot ?? '') ?? '0.0.0';
|
|
@@ -186,7 +177,7 @@ export function formatVersionVerbose(provenance = describeRuntime()) {
|
|
|
186
177
|
lines.push(`runtime: ${join(provenance.runtimeRoot, 'dist')}`);
|
|
187
178
|
if (provenance.executable)
|
|
188
179
|
lines.push(`executable: ${provenance.executable}`);
|
|
189
|
-
lines.push(`goal supervisor: ${provenance.capabilities.
|
|
180
|
+
lines.push(`goal supervisor: ${provenance.capabilities.goalSupervisorAvailable ? 'enabled' : 'disabled'}`);
|
|
190
181
|
return lines.join('\n');
|
|
191
182
|
}
|
|
192
183
|
function sameRealPath(a, b) {
|
package/dist/utils/fs.d.ts
CHANGED
|
@@ -13,11 +13,13 @@ export interface WalkOptions {
|
|
|
13
13
|
filter?: (entry: WalkEntry) => boolean | Promise<boolean>;
|
|
14
14
|
/**
|
|
15
15
|
* Batched ignore classification over workspace-relative paths. Given a
|
|
16
|
-
* directory's children
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* directory's children (with real directory-ness, so dir-only patterns
|
|
17
|
+
* evaluate exactly like Git), return the subset that is ignored. Ignored
|
|
18
|
+
* entries are dropped and ignored directories are not descended into.
|
|
19
|
+
* Evaluation is in-process, so a listing costs O(visited directories) rule
|
|
20
|
+
* file reads rather than one per entry (RH-001). Fails open: an empty set
|
|
21
|
+
* means "keep all".
|
|
20
22
|
*/
|
|
21
|
-
ignoreBatch?: (
|
|
23
|
+
ignoreBatch?: (entries: WalkEntry[]) => Promise<Set<string>>;
|
|
22
24
|
}
|
|
23
25
|
export declare function walkDir(root: string, options?: WalkOptions): Promise<WalkEntry[]>;
|
package/dist/utils/fs.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
|
|
3
|
+
// Repository metadata and dependency trees are never useful discovery targets.
|
|
4
|
+
// Skip both even when a project has no `.gitignore`: this keeps traversal bounded
|
|
5
|
+
// and prevents dependency contents from crowding out workspace source files.
|
|
6
|
+
const SKIP_ENTRIES = new Set(['.git', 'node_modules']);
|
|
4
7
|
export async function walkDir(root, options = {}) {
|
|
5
8
|
const { recursive = false, maxEntries = Infinity, cursor, filter, ignoreBatch } = options;
|
|
6
9
|
const result = [];
|
|
@@ -30,7 +33,7 @@ export async function walkDir(root, options = {}) {
|
|
|
30
33
|
return entries;
|
|
31
34
|
if (entries.length === 0)
|
|
32
35
|
return entries;
|
|
33
|
-
const ignored = await ignoreBatch(entries
|
|
36
|
+
const ignored = await ignoreBatch(entries);
|
|
34
37
|
if (ignored.size === 0)
|
|
35
38
|
return entries;
|
|
36
39
|
return entries.filter(entry => !ignored.has(entry.path));
|
package/dist/utils/path.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export declare function workspaceRoot(): string;
|
|
|
3
3
|
export declare function workspacePathKey(inputPath: string): string;
|
|
4
4
|
export declare function resolveWorkspacePath(inputPath: string): string;
|
|
5
5
|
export declare function workspaceRelativePath(absolutePath: string): string;
|
|
6
|
-
export declare function assertPathInsideRoot(root: string, candidate: string, inputPath: string, label?: string): void;
|
|
7
6
|
export declare function assertRealPathInsideRoot(root: string, candidate: string, inputPath?: string, label?: string): Promise<string>;
|
|
8
7
|
export declare function assertRealPathInsideWorkspace(absolutePath: string, inputPath?: string): Promise<void>;
|
|
9
8
|
export declare function assertWritablePathInsideWorkspace(absolutePath: string, inputPath?: string): Promise<void>;
|
package/dist/utils/path.js
CHANGED
|
@@ -19,7 +19,7 @@ export function resolveWorkspacePath(inputPath) {
|
|
|
19
19
|
export function workspaceRelativePath(absolutePath) {
|
|
20
20
|
return path.relative(workspaceRoot(), absolutePath) || '.';
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
function assertPathInsideRoot(root, candidate, inputPath, label = 'workspace') {
|
|
23
23
|
const relative = path.relative(root, candidate);
|
|
24
24
|
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
25
25
|
throw new Error(`Path is outside the ${label}: ${inputPath}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@denizokcu/haze",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A minimal LLM harness for your terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
"README.md",
|
|
28
28
|
"SECURITY.md",
|
|
29
29
|
"LICENSE",
|
|
30
|
-
"CHANGELOG.md"
|
|
31
|
-
"examples"
|
|
30
|
+
"CHANGELOG.md"
|
|
32
31
|
],
|
|
33
32
|
"scripts": {
|
|
34
33
|
"dev": "tsx src/cli/index.ts",
|
|
@@ -40,6 +39,7 @@
|
|
|
40
39
|
"test:watch": "vitest",
|
|
41
40
|
"lint": "eslint src/",
|
|
42
41
|
"lint:fix": "eslint src/ --fix",
|
|
42
|
+
"lint:knip": "knip",
|
|
43
43
|
"typecheck": "tsc --noEmit",
|
|
44
44
|
"context:report": "node --import tsx src/cli/contextReport.ts",
|
|
45
45
|
"release:verify": "node scripts/verify-release-metadata.mjs",
|
|
@@ -55,14 +55,15 @@
|
|
|
55
55
|
"commander": "15.0.0",
|
|
56
56
|
"defuddle": "^0.19.2",
|
|
57
57
|
"fs-extra": "11.4.0",
|
|
58
|
+
"ignore": "^7.0.6",
|
|
58
59
|
"ink": "7.1.1",
|
|
59
60
|
"ink-spinner": "5.0.0",
|
|
60
61
|
"linkedom": "^0.18.13",
|
|
61
62
|
"marked": "18.0.9",
|
|
62
|
-
"wrap-ansi": "10.0.0",
|
|
63
63
|
"react": "19.2.8",
|
|
64
64
|
"strip-ansi": "7.2.0",
|
|
65
65
|
"turndown": "^7.2.4",
|
|
66
|
+
"wrap-ansi": "10.0.0",
|
|
66
67
|
"yaml": "2.9.0",
|
|
67
68
|
"zod": "4.4.3"
|
|
68
69
|
},
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
"@types/react": "19.2.18",
|
|
74
75
|
"eslint": "^10.8.1",
|
|
75
76
|
"ink-testing-library": "^4.0.0",
|
|
77
|
+
"knip": "5.88.1",
|
|
76
78
|
"tsx": "4.23.12",
|
|
77
79
|
"typescript": "6.0.3",
|
|
78
80
|
"typescript-eslint": "^8.67.0",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type HazeLspServer } from '../../config/lspSettings.js';
|
|
2
|
-
import type { HazeSettings } from '../../config/settings.js';
|
|
3
|
-
export type LspWizardResult = {
|
|
4
|
-
message?: string;
|
|
5
|
-
mode?: 'chat' | 'lsp' | 'lspAction' | 'lspAddName' | 'lspConfirmRemove';
|
|
6
|
-
selectedName?: string;
|
|
7
|
-
settingsPatch?: Partial<HazeSettings>;
|
|
8
|
-
server?: HazeLspServer;
|
|
9
|
-
clearDraft?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function selectLspServerResult(settings: HazeSettings, serverName: string): LspWizardResult;
|
|
12
|
-
export declare function selectLspPresetResult(settings: HazeSettings, presetId: string): LspWizardResult;
|
|
13
|
-
export declare function selectLspActionResult(settings: HazeSettings, selectedName: string | undefined, action: string): LspWizardResult;
|
|
14
|
-
export declare function finishLspCustomResult(settings: HazeSettings, draftName: string | undefined, commandLine: string): LspWizardResult;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { configuredLspServers, lspPreset, upsertLspServer, setLspServerEnabled } from '../../config/lspSettings.js';
|
|
2
|
-
import { COMMON_ACTIONS, LSP_ACTIONS, SERVER_CHOICES } from './wizardActions.js';
|
|
3
|
-
import { commandParts } from './wizardInput.js';
|
|
4
|
-
export function selectLspServerResult(settings, serverName) {
|
|
5
|
-
if (serverName === SERVER_CHOICES.addServer)
|
|
6
|
-
return { mode: 'lspAddName', clearDraft: true, message: 'Choose an LSP preset, or select "custom" to enter a name and command manually.' };
|
|
7
|
-
const server = configuredLspServers(settings).find(candidate => candidate.name === serverName);
|
|
8
|
-
if (!server)
|
|
9
|
-
return { mode: 'chat', message: `No LSP server named ${serverName}. Use /lsp and choose add server.` };
|
|
10
|
-
return { mode: 'lspAction', selectedName: server.name, message: `${server.name}: choose an action.` };
|
|
11
|
-
}
|
|
12
|
-
export function selectLspPresetResult(settings, presetId) {
|
|
13
|
-
if (presetId === SERVER_CHOICES.custom)
|
|
14
|
-
return { mode: 'lspAddName', clearDraft: true, message: 'LSP server name? Example: typescript, rust, my-lsp.' };
|
|
15
|
-
const preset = lspPreset(presetId);
|
|
16
|
-
if (!preset)
|
|
17
|
-
return { message: `Unknown preset: ${presetId}.` };
|
|
18
|
-
if (configuredLspServers(settings).some(server => server.name === preset.name))
|
|
19
|
-
return { mode: 'chat', message: `LSP server ${preset.name} already exists. Use /lsp to manage existing servers.` };
|
|
20
|
-
return { mode: 'chat', server: preset, settingsPatch: { lspServers: upsertLspServer(settings, preset) }, message: `Added LSP preset ${preset.name}. Ensure ${preset.command} is installed and on PATH; tools appear once it is.` };
|
|
21
|
-
}
|
|
22
|
-
export function selectLspActionResult(settings, selectedName, action) {
|
|
23
|
-
if (!selectedName)
|
|
24
|
-
return { mode: 'lsp' };
|
|
25
|
-
const server = configuredLspServers(settings).find(candidate => candidate.name === selectedName);
|
|
26
|
-
if (!server)
|
|
27
|
-
return { mode: 'chat', selectedName: undefined, message: `LSP server ${selectedName} not found.` };
|
|
28
|
-
if (action === COMMON_ACTIONS.enable || action === COMMON_ACTIONS.disable) {
|
|
29
|
-
const enabled = action === COMMON_ACTIONS.enable;
|
|
30
|
-
return { mode: 'chat', selectedName: undefined, settingsPatch: { lspServers: setLspServerEnabled(settings, selectedName, enabled) }, message: `LSP server ${selectedName} ${enabled ? 'enabled' : 'disabled'}.` };
|
|
31
|
-
}
|
|
32
|
-
if (action === LSP_ACTIONS.removeServer)
|
|
33
|
-
return { mode: 'lspConfirmRemove', message: `Remove LSP server ${selectedName}? Type "yes" to confirm. Esc to cancel.` };
|
|
34
|
-
return { message: `Unknown LSP action: ${action}` };
|
|
35
|
-
}
|
|
36
|
-
export function finishLspCustomResult(settings, draftName, commandLine) {
|
|
37
|
-
const name = draftName?.trim();
|
|
38
|
-
const parts = commandParts(commandLine);
|
|
39
|
-
const command = parts[0];
|
|
40
|
-
if (!name || !command)
|
|
41
|
-
return { mode: 'chat', clearDraft: true, message: 'LSP server name and command are required.' };
|
|
42
|
-
const server = { name, command, args: parts.slice(1), extensions: [], rootPatterns: ['.git'], enabled: true };
|
|
43
|
-
return { mode: 'chat', clearDraft: true, server, settingsPatch: { lspServers: upsertLspServer(settings, server) }, message: `Added LSP server ${name} (${command}${parts.length > 1 ? ` ${parts.slice(1).join(' ')}` : ''}). Add extensions in ~/.haze/settings.json so tools can auto-select it.` };
|
|
44
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { HazeMcpServer, HazeSettings } from '../../config/settings.js';
|
|
2
|
-
export type McpWizardResult = {
|
|
3
|
-
message?: string;
|
|
4
|
-
mode?: 'chat' | 'mcp' | 'mcpAction' | 'mcpAddName' | 'mcpAddKey' | 'mcpSetKey' | 'mcpConfirmRemove';
|
|
5
|
-
selectedName?: string;
|
|
6
|
-
draft?: Partial<HazeMcpServer>;
|
|
7
|
-
settingsPatch?: Partial<HazeSettings>;
|
|
8
|
-
server?: HazeMcpServer;
|
|
9
|
-
clearDraft?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function selectMcpServerResult(settings: HazeSettings, serverName: string): McpWizardResult;
|
|
12
|
-
export declare function selectMcpPresetResult(settings: HazeSettings, presetId: string): McpWizardResult;
|
|
13
|
-
export declare function selectMcpActionResult(settings: HazeSettings, selectedName: string | undefined, action: string): McpWizardResult;
|
|
14
|
-
export declare function finishMcpCustomResult(settings: HazeSettings, draft: Partial<HazeMcpServer>, keyValue?: string): McpWizardResult;
|
|
15
|
-
export declare function setMcpServerKeyResult(settings: HazeSettings, selectedName: string | undefined, keyValue: string): McpWizardResult;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { HazeSettings } from '../../config/settings.js';
|
|
2
|
-
import type { LoadedSkill } from '../../skills/types.js';
|
|
3
|
-
export type SkillConfirmRemoveResult = {
|
|
4
|
-
message?: string;
|
|
5
|
-
mode?: 'chat';
|
|
6
|
-
settingsPatch?: Partial<HazeSettings>;
|
|
7
|
-
removedDir?: string;
|
|
8
|
-
selectedName?: string;
|
|
9
|
-
skill?: LoadedSkill;
|
|
10
|
-
};
|
|
11
|
-
export declare function skillConfirmRemoveResult(settings: HazeSettings, skills: LoadedSkill[], selectedName: string | undefined, value: string): SkillConfirmRemoveResult;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { removeSkillSetting } from '../../config/skillSettings.js';
|
|
2
|
-
import { isYesConfirmation } from './wizardInput.js';
|
|
3
|
-
import { findSelectedSkill } from './skillWizard.js';
|
|
4
|
-
export function skillConfirmRemoveResult(settings, skills, selectedName, value) {
|
|
5
|
-
if (!selectedName)
|
|
6
|
-
return { mode: 'chat' };
|
|
7
|
-
if (!isYesConfirmation(value))
|
|
8
|
-
return { mode: 'chat', selectedName: undefined, message: 'Cancelled. Skill not removed.' };
|
|
9
|
-
const skill = findSelectedSkill(skills, selectedName);
|
|
10
|
-
if (!skill)
|
|
11
|
-
return { mode: 'chat', selectedName: undefined, message: `Skill ${selectedName} not found.` };
|
|
12
|
-
return {
|
|
13
|
-
mode: 'chat',
|
|
14
|
-
selectedName: undefined,
|
|
15
|
-
skill,
|
|
16
|
-
removedDir: skill.dir,
|
|
17
|
-
settingsPatch: { skills: removeSkillSetting(settings, skill.name, skill.source) },
|
|
18
|
-
message: skill.source === 'global' ? `Removed skill ${skill.name}.` : `Removed project skill ${skill.name}.`,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type SkillCreationResult = {
|
|
2
|
-
busy?: boolean;
|
|
3
|
-
busyLabel?: string;
|
|
4
|
-
message?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
draftName?: string;
|
|
7
|
-
mode?: 'chat';
|
|
8
|
-
clearDraft?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare function captureSkillDescription(value: string, draftName: string | undefined): SkillCreationResult;
|
|
11
|
-
export declare function skillCreationMessage(name: string, file: string): string;
|
|
12
|
-
export declare function skillCreationFailure(error: unknown): string;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function captureSkillDescription(value, draftName) {
|
|
2
|
-
const description = value.trim();
|
|
3
|
-
if (!description)
|
|
4
|
-
return { message: 'Description is required. Try again, or press ESC to cancel.' };
|
|
5
|
-
if (!draftName)
|
|
6
|
-
return { mode: 'chat', clearDraft: true, message: 'Skill wizard lost the name. Start over with /skills.' };
|
|
7
|
-
return { description, draftName, busy: true, busyLabel: 'Creating skill' };
|
|
8
|
-
}
|
|
9
|
-
export function skillCreationMessage(name, file) {
|
|
10
|
-
return `Created skill ${name} at ${file}. Invoke it with /${name}. Edit SKILL.md to refine its workflow.`;
|
|
11
|
-
}
|
|
12
|
-
export function skillCreationFailure(error) {
|
|
13
|
-
return `Skill creation failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
14
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { HazeSettings } from '../../config/settings.js';
|
|
2
|
-
import type { LoadedSkill } from '../../skills/types.js';
|
|
3
|
-
export type SkillWizardResult = {
|
|
4
|
-
message?: string;
|
|
5
|
-
mode?: 'chat' | 'skills' | 'skillsAction' | 'skillsAddName' | 'skillsConfirmRemove';
|
|
6
|
-
selectedName?: string;
|
|
7
|
-
settingsPatch?: Partial<HazeSettings>;
|
|
8
|
-
clearDraft?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare function skillPickerValue(skill: LoadedSkill): string;
|
|
11
|
-
export declare function findSelectedSkill(skills: LoadedSkill[], selection: string | undefined): LoadedSkill | undefined;
|
|
12
|
-
export declare function selectSkillResult(skills: LoadedSkill[], name: string): SkillWizardResult;
|
|
13
|
-
export declare function skillInfoMessage(settings: HazeSettings, skill: LoadedSkill): string;
|
|
14
|
-
export declare function selectSkillActionResult(settings: HazeSettings, skills: LoadedSkill[], selectedName: string | undefined, action: string): SkillWizardResult & {
|
|
15
|
-
skill?: LoadedSkill;
|
|
16
|
-
validate?: boolean;
|
|
17
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An idle timer for the main agent turn.
|
|
3
|
-
*
|
|
4
|
-
* The turn is considered "idle" (and aborted) after `timeoutMs` with no stream
|
|
5
|
-
* activity — UNLESS a tool call is currently executing (`isBusy()` returns
|
|
6
|
-
* true). Concurrent subagents can run for many minutes while emitting no stream
|
|
7
|
-
* parts; that is legitimate work, not a dead stream, so the timer defers (rearms)
|
|
8
|
-
* while any tool is in flight. This prevents a long subagent wave from being
|
|
9
|
-
* mistaken for a hung turn.
|
|
10
|
-
*
|
|
11
|
-
* Note: there is intentionally no upper bound on how long a single tool may run
|
|
12
|
-
* while in flight — a genuinely hung tool would defer indefinitely. A per-tool
|
|
13
|
-
* hard timeout is a separate concern; the idle timer only guards against a turn
|
|
14
|
-
* that is producing no model output AND doing no tool work.
|
|
15
|
-
*/
|
|
16
|
-
export interface IdleTimer {
|
|
17
|
-
/** Clear any pending deadline and rearm it for a fresh idle window. */
|
|
18
|
-
reset: () => void;
|
|
19
|
-
/** Cancel the pending deadline without rearming. */
|
|
20
|
-
clear: () => void;
|
|
21
|
-
}
|
|
22
|
-
export declare function createIdleTimer(input: {
|
|
23
|
-
timeoutMs: number;
|
|
24
|
-
isBusy: () => boolean;
|
|
25
|
-
onTimeout: () => void;
|
|
26
|
-
}): IdleTimer;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function createIdleTimer(input) {
|
|
2
|
-
const { timeoutMs, isBusy, onTimeout } = input;
|
|
3
|
-
let timer;
|
|
4
|
-
const fire = () => {
|
|
5
|
-
if (isBusy()) {
|
|
6
|
-
// Tools are executing — that is activity. Defer by rearming.
|
|
7
|
-
timer = setTimeout(fire, timeoutMs);
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
onTimeout();
|
|
11
|
-
};
|
|
12
|
-
return {
|
|
13
|
-
reset: () => {
|
|
14
|
-
if (timer)
|
|
15
|
-
clearTimeout(timer);
|
|
16
|
-
timer = setTimeout(fire, timeoutMs);
|
|
17
|
-
},
|
|
18
|
-
clear: () => {
|
|
19
|
-
if (timer)
|
|
20
|
-
clearTimeout(timer);
|
|
21
|
-
timer = undefined;
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|