@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,27 +0,0 @@
|
|
|
1
|
-
import type { RequestIntent } from '../../../core/goal/requestClassifier.js';
|
|
2
|
-
import type { ValidationOutcome, WorkTaskProgress } from '../../../core/agent/workState.js';
|
|
3
|
-
import type { TurnStatus } from '../streaming.js';
|
|
4
|
-
/**
|
|
5
|
-
* CLI adapter for the authoritative turn-status decision. The pure policy
|
|
6
|
-
* lives in `core/agent/completionController.ts`; this keeps the single call site
|
|
7
|
-
* in the agent turn (see streaming/AGENTS.md) and preserves the documented
|
|
8
|
-
* field-based signature exercised by `tests/cli/turnOutcome.test.ts`.
|
|
9
|
-
*
|
|
10
|
-
* The optional work-evidence fields (intent, mutation/validation counts, task
|
|
11
|
-
* progress) project the turn-wide `TurnExecutionState`; when omitted, the
|
|
12
|
-
* defaults cannot reject a turn (unknown intent, no mutations, no task list).
|
|
13
|
-
*/
|
|
14
|
-
export declare function terminalTurnStatus(input: {
|
|
15
|
-
aborted: boolean;
|
|
16
|
-
error?: unknown;
|
|
17
|
-
assistantText: string;
|
|
18
|
-
sawToolCall: boolean;
|
|
19
|
-
lastToolOk?: boolean;
|
|
20
|
-
finishReason?: string;
|
|
21
|
-
budgetReached?: boolean;
|
|
22
|
-
unresolvedToolInputError?: boolean;
|
|
23
|
-
intent?: RequestIntent;
|
|
24
|
-
mutationCount?: number;
|
|
25
|
-
validationOutcome?: ValidationOutcome;
|
|
26
|
-
taskProgress?: WorkTaskProgress;
|
|
27
|
-
}): TurnStatus;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createTurnExecutionState, decideTerminalStatus, normalizeFinishReason } from '../../../core/agent/completionController.js';
|
|
2
|
-
/**
|
|
3
|
-
* CLI adapter for the authoritative turn-status decision. The pure policy
|
|
4
|
-
* lives in `core/agent/completionController.ts`; this keeps the single call site
|
|
5
|
-
* in the agent turn (see streaming/AGENTS.md) and preserves the documented
|
|
6
|
-
* field-based signature exercised by `tests/cli/turnOutcome.test.ts`.
|
|
7
|
-
*
|
|
8
|
-
* The optional work-evidence fields (intent, mutation/validation counts, task
|
|
9
|
-
* progress) project the turn-wide `TurnExecutionState`; when omitted, the
|
|
10
|
-
* defaults cannot reject a turn (unknown intent, no mutations, no task list).
|
|
11
|
-
*/
|
|
12
|
-
export function terminalTurnStatus(input) {
|
|
13
|
-
void input.error;
|
|
14
|
-
const state = {
|
|
15
|
-
...createTurnExecutionState(),
|
|
16
|
-
aborted: input.aborted,
|
|
17
|
-
finishCause: normalizeFinishReason(input.finishReason),
|
|
18
|
-
intent: input.intent ?? 'unknown',
|
|
19
|
-
mutationCount: input.mutationCount ?? 0,
|
|
20
|
-
...(input.validationOutcome ? { validationOutcome: input.validationOutcome } : {}),
|
|
21
|
-
...(input.taskProgress ? { taskProgress: input.taskProgress } : {}),
|
|
22
|
-
};
|
|
23
|
-
return decideTerminalStatus(state, {
|
|
24
|
-
sawToolCall: input.sawToolCall,
|
|
25
|
-
assistantText: input.assistantText,
|
|
26
|
-
lastToolOk: input.lastToolOk,
|
|
27
|
-
unresolvedToolInputError: Boolean(input.unresolvedToolInputError),
|
|
28
|
-
}, Boolean(input.budgetReached));
|
|
29
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const PROVIDER_CHOICES: {
|
|
2
|
-
readonly addProvider: "add provider";
|
|
3
|
-
readonly custom: "custom";
|
|
4
|
-
};
|
|
5
|
-
export declare const PROVIDER_ACTIONS: {
|
|
6
|
-
readonly useProvider: "use provider";
|
|
7
|
-
readonly addModels: "add models";
|
|
8
|
-
readonly setApiKey: "set API key";
|
|
9
|
-
readonly signInChatGpt: "sign in with ChatGPT";
|
|
10
|
-
readonly markImageCapable: "mark image-capable";
|
|
11
|
-
readonly clearImageCapable: "clear image-capable";
|
|
12
|
-
readonly removeModels: "remove models";
|
|
13
|
-
readonly removeProvider: "remove provider";
|
|
14
|
-
};
|
|
15
|
-
export declare const MODEL_CHOICES: {
|
|
16
|
-
readonly addModels: "add models";
|
|
17
|
-
readonly enterModelNames: "enter model names";
|
|
18
|
-
};
|
|
19
|
-
export declare const SERVER_CHOICES: {
|
|
20
|
-
readonly addServer: "add server";
|
|
21
|
-
readonly custom: "custom";
|
|
22
|
-
};
|
|
23
|
-
export declare const COMMON_ACTIONS: {
|
|
24
|
-
readonly enable: "enable";
|
|
25
|
-
readonly disable: "disable";
|
|
26
|
-
};
|
|
27
|
-
export declare const LSP_ACTIONS: {
|
|
28
|
-
readonly removeServer: "remove server";
|
|
29
|
-
};
|
|
30
|
-
export declare const MCP_ACTIONS: {
|
|
31
|
-
readonly setApiKey: "set API key";
|
|
32
|
-
readonly removeServer: "remove server";
|
|
33
|
-
};
|
|
34
|
-
export declare const MCP_TRANSPORTS: {
|
|
35
|
-
readonly http: "http";
|
|
36
|
-
readonly sse: "sse";
|
|
37
|
-
readonly stdio: "stdio";
|
|
38
|
-
};
|
|
39
|
-
export declare const SKILL_CHOICES: {
|
|
40
|
-
readonly addSkill: "add skill";
|
|
41
|
-
};
|
|
42
|
-
export declare const SKILL_ACTIONS: {
|
|
43
|
-
readonly showInfo: "show info";
|
|
44
|
-
readonly validate: "validate";
|
|
45
|
-
readonly removeSkill: "remove skill";
|
|
46
|
-
};
|
|
47
|
-
export declare const YES_CONFIRMATION = "yes";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export const PROVIDER_CHOICES = {
|
|
2
|
-
addProvider: 'add provider',
|
|
3
|
-
custom: 'custom',
|
|
4
|
-
};
|
|
5
|
-
export const PROVIDER_ACTIONS = {
|
|
6
|
-
useProvider: 'use provider',
|
|
7
|
-
addModels: 'add models',
|
|
8
|
-
setApiKey: 'set API key',
|
|
9
|
-
signInChatGpt: 'sign in with ChatGPT',
|
|
10
|
-
markImageCapable: 'mark image-capable',
|
|
11
|
-
clearImageCapable: 'clear image-capable',
|
|
12
|
-
removeModels: 'remove models',
|
|
13
|
-
removeProvider: 'remove provider',
|
|
14
|
-
};
|
|
15
|
-
export const MODEL_CHOICES = {
|
|
16
|
-
addModels: 'add models',
|
|
17
|
-
enterModelNames: 'enter model names',
|
|
18
|
-
};
|
|
19
|
-
export const SERVER_CHOICES = {
|
|
20
|
-
addServer: 'add server',
|
|
21
|
-
custom: 'custom',
|
|
22
|
-
};
|
|
23
|
-
export const COMMON_ACTIONS = {
|
|
24
|
-
enable: 'enable',
|
|
25
|
-
disable: 'disable',
|
|
26
|
-
};
|
|
27
|
-
export const LSP_ACTIONS = {
|
|
28
|
-
removeServer: 'remove server',
|
|
29
|
-
};
|
|
30
|
-
export const MCP_ACTIONS = {
|
|
31
|
-
setApiKey: 'set API key',
|
|
32
|
-
removeServer: 'remove server',
|
|
33
|
-
};
|
|
34
|
-
export const MCP_TRANSPORTS = {
|
|
35
|
-
http: 'http',
|
|
36
|
-
sse: 'sse',
|
|
37
|
-
stdio: 'stdio',
|
|
38
|
-
};
|
|
39
|
-
export const SKILL_CHOICES = {
|
|
40
|
-
addSkill: 'add skill',
|
|
41
|
-
};
|
|
42
|
-
export const SKILL_ACTIONS = {
|
|
43
|
-
showInfo: 'show info',
|
|
44
|
-
validate: 'validate',
|
|
45
|
-
removeSkill: 'remove skill',
|
|
46
|
-
};
|
|
47
|
-
export const YES_CONFIRMATION = 'yes';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { YES_CONFIRMATION } from './wizardActions.js';
|
|
2
|
-
export function commaList(value) {
|
|
3
|
-
return value.split(',').map(item => item.trim()).filter(Boolean);
|
|
4
|
-
}
|
|
5
|
-
export function commandParts(value) {
|
|
6
|
-
return value.trim().split(/\s+/).filter(Boolean);
|
|
7
|
-
}
|
|
8
|
-
export function isYesConfirmation(value) {
|
|
9
|
-
return value.trim().toLowerCase() === YES_CONFIRMATION;
|
|
10
|
-
}
|
|
11
|
-
export function isValidUrl(value) {
|
|
12
|
-
try {
|
|
13
|
-
new URL(value);
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { HazeMcpServer, HazeSettings } from '../../config/settings.js';
|
|
2
|
-
export type NameCaptureResult = {
|
|
3
|
-
nextMode?: string;
|
|
4
|
-
draft?: {
|
|
5
|
-
name?: string;
|
|
6
|
-
};
|
|
7
|
-
message?: string;
|
|
8
|
-
systemMessage?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function captureProviderName(settings: HazeSettings, value: string): NameCaptureResult;
|
|
11
|
-
export declare function captureLspName(settings: HazeSettings, value: string): NameCaptureResult;
|
|
12
|
-
export declare function captureMcpName(settings: HazeSettings, value: string): NameCaptureResult;
|
|
13
|
-
export type FieldCaptureResult = {
|
|
14
|
-
draft?: Partial<HazeMcpServer>;
|
|
15
|
-
message?: string;
|
|
16
|
-
nextMode?: string;
|
|
17
|
-
systemMessage?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare function captureProviderUrl(value: string): FieldCaptureResult;
|
|
20
|
-
export declare function captureMcpUrl(value: string): FieldCaptureResult;
|
|
21
|
-
export declare function captureMcpTransport(value: string): FieldCaptureResult;
|
|
22
|
-
export declare function captureMcpCommand(value: string): FieldCaptureResult;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { configuredLspServers } from '../../config/lspSettings.js';
|
|
2
|
-
import { findMcpServer } from '../../config/mcpSettings.js';
|
|
3
|
-
import { CHATGPT_CODEX_BASE_URL } from '../../llm/openaiCodexOAuth.js';
|
|
4
|
-
import { MCP_TRANSPORTS } from './wizardActions.js';
|
|
5
|
-
import { commandParts, isValidUrl } from './wizardInput.js';
|
|
6
|
-
export function captureProviderName(settings, value) {
|
|
7
|
-
const name = value.trim();
|
|
8
|
-
if (!name)
|
|
9
|
-
return { message: 'Provider name is required.' };
|
|
10
|
-
if (settings.providers?.some(provider => provider.name === name))
|
|
11
|
-
return { message: `Provider ${name} already exists. Choose a unique name.` };
|
|
12
|
-
return { nextMode: 'providerAddUrl', draft: { name }, systemMessage: 'OpenAI-compatible base URL? Example: https://openrouter.ai/api/v1 or http://localhost:1234/v1' };
|
|
13
|
-
}
|
|
14
|
-
export function captureLspName(settings, value) {
|
|
15
|
-
const name = value.trim();
|
|
16
|
-
if (!name)
|
|
17
|
-
return { message: 'LSP server name is required.' };
|
|
18
|
-
if (configuredLspServers(settings).some(server => server.name === name))
|
|
19
|
-
return { message: `LSP server ${name} already exists. Choose a unique name.` };
|
|
20
|
-
return { nextMode: 'lspAddCommand', draft: { name }, systemMessage: 'Command to run? Example: typescript-language-server --stdio' };
|
|
21
|
-
}
|
|
22
|
-
export function captureMcpName(settings, value) {
|
|
23
|
-
const name = value.trim();
|
|
24
|
-
if (!name)
|
|
25
|
-
return { message: 'MCP server name is required.' };
|
|
26
|
-
if (findMcpServer(settings, name))
|
|
27
|
-
return { message: `MCP server ${name} already exists. Choose a unique name.` };
|
|
28
|
-
return { nextMode: 'mcpAddTransport', draft: { name }, systemMessage: 'Transport type? http (Streamable HTTP), sse (Server-Sent Events), or stdio (local process).' };
|
|
29
|
-
}
|
|
30
|
-
export function captureProviderUrl(value) {
|
|
31
|
-
if (!isValidUrl(value))
|
|
32
|
-
return { message: 'Enter a valid URL, for example http://localhost:1234/v1.' };
|
|
33
|
-
// The Codex endpoint only accepts ChatGPT sign-in, never API keys; point
|
|
34
|
-
// users at the preset instead of a custom provider that cannot work (F-14).
|
|
35
|
-
const codexHint = value.trim() === CHATGPT_CODEX_BASE_URL
|
|
36
|
-
? `\nNote: ${CHATGPT_CODEX_BASE_URL} serves ChatGPT sign-in only. To use it, add the OpenAI Subscription preset via /provider instead of a custom API-key provider.`
|
|
37
|
-
: '';
|
|
38
|
-
return { draft: { url: value.trim() }, nextMode: 'providerAddKey', systemMessage: `API key? Leave blank for local/keyless providers.${codexHint}` };
|
|
39
|
-
}
|
|
40
|
-
export function captureMcpUrl(value) {
|
|
41
|
-
if (!isValidUrl(value))
|
|
42
|
-
return { message: 'Enter a valid URL, for example https://mcp.context7.com/mcp.' };
|
|
43
|
-
return { draft: { url: value.trim() }, nextMode: 'mcpAddKey', systemMessage: 'Optional API key or auth header value? (Leave blank to skip — Enter works.) Sent as Authorization: Bearer <value>.' };
|
|
44
|
-
}
|
|
45
|
-
export function captureMcpTransport(value) {
|
|
46
|
-
const transport = value.trim().toLowerCase();
|
|
47
|
-
if (transport !== MCP_TRANSPORTS.http && transport !== MCP_TRANSPORTS.sse && transport !== MCP_TRANSPORTS.stdio)
|
|
48
|
-
return { message: 'Enter http, sse, or stdio.' };
|
|
49
|
-
if (transport === MCP_TRANSPORTS.stdio)
|
|
50
|
-
return { draft: { transport }, nextMode: 'mcpAddCommand', systemMessage: 'Command to run? Example: npx -y @modelcontextprotocol/server-filesystem .' };
|
|
51
|
-
return { draft: { transport }, nextMode: 'mcpAddUrl', systemMessage: `MCP server URL? Example: https://mcp.context7.com/mcp for ${transport}.` };
|
|
52
|
-
}
|
|
53
|
-
export function captureMcpCommand(value) {
|
|
54
|
-
const parts = commandParts(value);
|
|
55
|
-
if (parts.length === 0)
|
|
56
|
-
return { message: 'Command is required.' };
|
|
57
|
-
return { draft: { command: parts[0], args: parts.slice(1) }, nextMode: 'chat', systemMessage: 'Stdio MCP authentication must be handled by the command or wrapper; HTTP headers do not apply.' };
|
|
58
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { HazeSettings } from '../../config/settings.js';
|
|
2
|
-
import type { LoadedSkill } from '../../skills/types.js';
|
|
3
|
-
import type { TextInputSuggestion } from '../../ui/components/TextInput.js';
|
|
4
|
-
/**
|
|
5
|
-
* Pure suggestion builders for the chat wizard pickers (provider / model / LSP /
|
|
6
|
-
* MCP / skills). Extracted from the React component so they are unit-testable
|
|
7
|
-
* and so `ChatScreen` only owns interactive state, not picker content. Each
|
|
8
|
-
* function takes its explicit inputs and returns the suggestion list shown for
|
|
9
|
-
* the corresponding input mode.
|
|
10
|
-
*/
|
|
11
|
-
export declare function providerSuggestions(settings: HazeSettings): TextInputSuggestion[];
|
|
12
|
-
export declare function providerActionSuggestions(settings: HazeSettings, selectedProviderName: string | undefined): TextInputSuggestion[];
|
|
13
|
-
export declare function presetSuggestions(): TextInputSuggestion[];
|
|
14
|
-
export declare function modelSuggestions(settings: HazeSettings, modelProviderFilter: string | undefined): TextInputSuggestion[];
|
|
15
|
-
export declare function modelAddProviderSuggestions(settings: HazeSettings): TextInputSuggestion[];
|
|
16
|
-
/**
|
|
17
|
-
* Model picker fed by live /models discovery. Curated `suggestedModels`
|
|
18
|
-
* (from provider presets) are pinned atop the discovered list when the
|
|
19
|
-
* endpoint actually serves them — stale curation entries simply don't pin.
|
|
20
|
-
*/
|
|
21
|
-
export declare function modelPickSuggestions(settings: HazeSettings, providerName: string | undefined, discoveredModels: string[], suggestedModels?: string[]): TextInputSuggestion[];
|
|
22
|
-
export declare function lspSuggestions(settings: HazeSettings): TextInputSuggestion[];
|
|
23
|
-
export declare function lspActionSuggestions(settings: HazeSettings, selectedLspName: string | undefined): TextInputSuggestion[];
|
|
24
|
-
export declare function lspPresetSuggestions(): TextInputSuggestion[];
|
|
25
|
-
export declare function mcpSuggestions(settings: HazeSettings): TextInputSuggestion[];
|
|
26
|
-
export declare function mcpActionSuggestions(settings: HazeSettings, selectedMcpName: string | undefined): TextInputSuggestion[];
|
|
27
|
-
export declare function mcpPresetSuggestions(): TextInputSuggestion[];
|
|
28
|
-
export declare function mcpTransportSuggestions(): TextInputSuggestion[];
|
|
29
|
-
export declare function skillsSuggestions(settings: HazeSettings, skills: LoadedSkill[]): TextInputSuggestion[];
|
|
30
|
-
export declare function skillScopeSuggestions(): TextInputSuggestion[];
|
|
31
|
-
export declare function skillsActionSuggestions(settings: HazeSettings, skills: LoadedSkill[], selectedSkillName: string | undefined): TextInputSuggestion[];
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { configuredProviders, findProvider, modelSelector, providerImageCapable } from '../../config/providers.js';
|
|
2
|
-
import { configuredLspServers, LSP_PRESETS } from '../../config/lspSettings.js';
|
|
3
|
-
import { configuredMcpServers, findMcpServer, findMcpPreset, presetIds } from '../../config/mcpSettings.js';
|
|
4
|
-
import { isSkillEnabled } from '../../config/skillSettings.js';
|
|
5
|
-
import { PROVIDER_PRESETS } from '../../config/providerPresets.js';
|
|
6
|
-
import { COMMON_ACTIONS, LSP_ACTIONS, MCP_ACTIONS, MCP_TRANSPORTS, MODEL_CHOICES, PROVIDER_ACTIONS, PROVIDER_CHOICES, SERVER_CHOICES, SKILL_ACTIONS, SKILL_CHOICES } from './wizardActions.js';
|
|
7
|
-
import { findSelectedSkill, skillPickerValue } from './skillWizard.js';
|
|
8
|
-
/**
|
|
9
|
-
* Pure suggestion builders for the chat wizard pickers (provider / model / LSP /
|
|
10
|
-
* MCP / skills). Extracted from the React component so they are unit-testable
|
|
11
|
-
* and so `ChatScreen` only owns interactive state, not picker content. Each
|
|
12
|
-
* function takes its explicit inputs and returns the suggestion list shown for
|
|
13
|
-
* the corresponding input mode.
|
|
14
|
-
*/
|
|
15
|
-
export function providerSuggestions(settings) {
|
|
16
|
-
return [
|
|
17
|
-
...configuredProviders(settings).map(provider => ({
|
|
18
|
-
value: provider.name,
|
|
19
|
-
description: `${provider.url} · ${provider.models.length} model${provider.models.length === 1 ? '' : 's'}`,
|
|
20
|
-
kind: 'provider',
|
|
21
|
-
})),
|
|
22
|
-
{ value: PROVIDER_CHOICES.addProvider, description: 'Add a new provider (presets available)', kind: 'provider' },
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
export function providerActionSuggestions(settings, selectedProviderName) {
|
|
26
|
-
const provider = selectedProviderName ? findProvider(settings, selectedProviderName) : undefined;
|
|
27
|
-
return [
|
|
28
|
-
{ value: PROVIDER_ACTIONS.useProvider, description: 'Set this provider and choose a model', kind: 'provider' },
|
|
29
|
-
{ value: PROVIDER_ACTIONS.addModels, description: provider?.kind === 'chatgpt-codex' ? 'Add a supported Codex model name' : 'Fetch the provider model list and add models', kind: 'provider' },
|
|
30
|
-
...(provider?.kind === 'chatgpt-codex'
|
|
31
|
-
? [{ value: PROVIDER_ACTIONS.signInChatGpt, description: 'Sign in again or switch ChatGPT account', kind: 'provider' }]
|
|
32
|
-
: [{ value: PROVIDER_ACTIONS.setApiKey, description: provider?.key ? 'Update the saved API key' : 'Add an API key', kind: 'provider' }]),
|
|
33
|
-
provider
|
|
34
|
-
? (providerImageCapable(provider)
|
|
35
|
-
? { value: PROVIDER_ACTIONS.clearImageCapable, description: 'Stop sending attached images to this provider', kind: 'provider' }
|
|
36
|
-
: { value: PROVIDER_ACTIONS.markImageCapable, description: 'Allow attached images to be sent to this provider', kind: 'provider' })
|
|
37
|
-
: { value: PROVIDER_ACTIONS.markImageCapable, description: 'Allow attached images to be sent to this provider', kind: 'provider' },
|
|
38
|
-
...(provider?.models?.length ? [{ value: PROVIDER_ACTIONS.removeModels, description: 'Remove models from this provider', kind: 'provider' }] : []),
|
|
39
|
-
{ value: PROVIDER_ACTIONS.removeProvider, description: 'Delete this provider from settings', kind: 'provider' },
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
export function presetSuggestions() {
|
|
43
|
-
const cloudPresets = PROVIDER_PRESETS.filter(p => p.category === 'cloud');
|
|
44
|
-
const localPresets = PROVIDER_PRESETS.filter(p => p.category === 'local');
|
|
45
|
-
return [
|
|
46
|
-
...cloudPresets.map(preset => ({
|
|
47
|
-
value: preset.id,
|
|
48
|
-
description: `${preset.baseUrl}${preset.auth === 'chatgpt-oauth' ? ' · browser sign-in' : ''}${preset.suggestedModels?.length ? ' · e.g. ' + preset.suggestedModels.slice(0, 2).join(', ') : ''}`,
|
|
49
|
-
kind: 'provider',
|
|
50
|
-
})),
|
|
51
|
-
...localPresets.map(preset => ({
|
|
52
|
-
value: preset.id,
|
|
53
|
-
description: `${preset.baseUrl} · local, no API key needed`,
|
|
54
|
-
kind: 'provider',
|
|
55
|
-
})),
|
|
56
|
-
{ value: PROVIDER_CHOICES.custom, description: 'Enter provider name, URL, and API key manually', kind: 'provider' },
|
|
57
|
-
];
|
|
58
|
-
}
|
|
59
|
-
export function modelSuggestions(settings, modelProviderFilter) {
|
|
60
|
-
const providers = configuredProviders(settings).filter(provider => !modelProviderFilter || provider.name === modelProviderFilter);
|
|
61
|
-
return [
|
|
62
|
-
...providers.flatMap(provider => provider.models.map(model => ({
|
|
63
|
-
value: modelProviderFilter ? model : modelSelector(provider, model),
|
|
64
|
-
description: provider.name,
|
|
65
|
-
kind: 'model',
|
|
66
|
-
}))),
|
|
67
|
-
{ value: MODEL_CHOICES.addModels, description: modelProviderFilter ? `Add models to ${modelProviderFilter} (fetched from its models endpoint)` : 'Add models to a provider (fetched from its models endpoint)', kind: 'model' },
|
|
68
|
-
];
|
|
69
|
-
}
|
|
70
|
-
export function modelAddProviderSuggestions(settings) {
|
|
71
|
-
return configuredProviders(settings).map(provider => ({
|
|
72
|
-
value: provider.name,
|
|
73
|
-
description: `${provider.models.length} model${provider.models.length === 1 ? '' : 's'} configured`,
|
|
74
|
-
kind: 'provider',
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Model picker fed by live /models discovery. Curated `suggestedModels`
|
|
79
|
-
* (from provider presets) are pinned atop the discovered list when the
|
|
80
|
-
* endpoint actually serves them — stale curation entries simply don't pin.
|
|
81
|
-
*/
|
|
82
|
-
export function modelPickSuggestions(settings, providerName, discoveredModels, suggestedModels = []) {
|
|
83
|
-
const provider = providerName ? findProvider(settings, providerName) : undefined;
|
|
84
|
-
const configured = new Set(provider?.models ?? []);
|
|
85
|
-
const available = discoveredModels.filter(model => !configured.has(model));
|
|
86
|
-
const availableSet = new Set(available);
|
|
87
|
-
const pinned = suggestedModels.filter(model => availableSet.has(model));
|
|
88
|
-
const pinnedSet = new Set(pinned);
|
|
89
|
-
return [
|
|
90
|
-
...pinned.map(model => ({
|
|
91
|
-
value: model,
|
|
92
|
-
description: 'suggested',
|
|
93
|
-
kind: 'model',
|
|
94
|
-
})),
|
|
95
|
-
...available.filter(model => !pinnedSet.has(model)).map(model => ({
|
|
96
|
-
value: model,
|
|
97
|
-
description: providerName,
|
|
98
|
-
kind: 'model',
|
|
99
|
-
})),
|
|
100
|
-
{ value: MODEL_CHOICES.enterModelNames, description: 'Type comma-separated model names instead', kind: 'model' },
|
|
101
|
-
];
|
|
102
|
-
}
|
|
103
|
-
export function lspSuggestions(settings) {
|
|
104
|
-
const servers = configuredLspServers(settings);
|
|
105
|
-
return [{ value: SERVER_CHOICES.addServer, description: 'add an LSP server (presets available)', kind: 'lsp' },
|
|
106
|
-
...servers.map(server => ({
|
|
107
|
-
value: server.name,
|
|
108
|
-
description: `${server.command}${(server.args ?? []).length ? ` ${(server.args ?? []).join(' ')}` : ''} · ${server.enabled === false ? 'disabled' : 'enabled'}`,
|
|
109
|
-
kind: 'lsp',
|
|
110
|
-
}))];
|
|
111
|
-
}
|
|
112
|
-
export function lspActionSuggestions(settings, selectedLspName) {
|
|
113
|
-
const server = selectedLspName ? configuredLspServers(settings).find(s => s.name === selectedLspName) : undefined;
|
|
114
|
-
const result = [];
|
|
115
|
-
if (server)
|
|
116
|
-
result.push({ value: server.enabled === false ? COMMON_ACTIONS.enable : COMMON_ACTIONS.disable, description: `${server.enabled === false ? COMMON_ACTIONS.enable : COMMON_ACTIONS.disable} this server`, kind: 'lsp' });
|
|
117
|
-
result.push({ value: LSP_ACTIONS.removeServer, description: 'remove this server', kind: 'lsp' });
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
export function lspPresetSuggestions() {
|
|
121
|
-
return [
|
|
122
|
-
...Object.values(LSP_PRESETS).map(preset => ({
|
|
123
|
-
value: preset.name,
|
|
124
|
-
description: `${preset.command} ${(preset.args ?? []).join(' ')} [${(preset.extensions ?? []).join(', ')}]`,
|
|
125
|
-
kind: 'lsp',
|
|
126
|
-
})),
|
|
127
|
-
{ value: SERVER_CHOICES.custom, description: 'enter a name and command manually', kind: 'lsp' },
|
|
128
|
-
];
|
|
129
|
-
}
|
|
130
|
-
export function mcpSuggestions(settings) {
|
|
131
|
-
const servers = configuredMcpServers(settings);
|
|
132
|
-
return [{ value: SERVER_CHOICES.addServer, description: 'add an MCP server (presets available)', kind: 'mcp' },
|
|
133
|
-
...servers.map(server => {
|
|
134
|
-
const location = server.url ?? (server.command ? `${server.command} ${(server.args ?? []).join(' ')}`.trim() : '');
|
|
135
|
-
return { value: server.name, description: `${server.transport}${location ? ` ${location}` : ''} · ${server.enabled === false ? 'disabled' : 'enabled'}`, kind: 'mcp' };
|
|
136
|
-
})];
|
|
137
|
-
}
|
|
138
|
-
export function mcpActionSuggestions(settings, selectedMcpName) {
|
|
139
|
-
const server = selectedMcpName ? findMcpServer(settings, selectedMcpName) : undefined;
|
|
140
|
-
const result = [];
|
|
141
|
-
if (server) {
|
|
142
|
-
result.push({ value: server.enabled === false ? COMMON_ACTIONS.enable : COMMON_ACTIONS.disable, description: `${server.enabled === false ? COMMON_ACTIONS.enable : COMMON_ACTIONS.disable} this server`, kind: 'mcp' });
|
|
143
|
-
if (server.transport !== 'stdio')
|
|
144
|
-
result.push({ value: MCP_ACTIONS.setApiKey, description: server.headers?.length ? 'update the saved API key' : 'add an API key', kind: 'mcp' });
|
|
145
|
-
}
|
|
146
|
-
result.push({ value: MCP_ACTIONS.removeServer, description: 'remove this server', kind: 'mcp' });
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
export function mcpPresetSuggestions() {
|
|
150
|
-
return [
|
|
151
|
-
...presetIds().map(presetId => {
|
|
152
|
-
const preset = findMcpPreset(presetId);
|
|
153
|
-
return { value: presetId, description: preset.description ?? `${preset.transport} server`, kind: 'mcp' };
|
|
154
|
-
}),
|
|
155
|
-
{ value: SERVER_CHOICES.custom, description: 'enter name, transport, and URL or command manually', kind: 'mcp' },
|
|
156
|
-
];
|
|
157
|
-
}
|
|
158
|
-
export function mcpTransportSuggestions() {
|
|
159
|
-
return [
|
|
160
|
-
{ value: MCP_TRANSPORTS.http, description: 'Streamable HTTP (remote)', kind: 'mcp' },
|
|
161
|
-
{ value: MCP_TRANSPORTS.sse, description: 'Server-Sent Events (remote)', kind: 'mcp' },
|
|
162
|
-
{ value: MCP_TRANSPORTS.stdio, description: 'local process', kind: 'mcp' },
|
|
163
|
-
];
|
|
164
|
-
}
|
|
165
|
-
export function skillsSuggestions(settings, skills) {
|
|
166
|
-
return [{ value: SKILL_CHOICES.addSkill, description: 'describe a new skill for haze to generate', kind: 'skill' },
|
|
167
|
-
...skills.map(skill => ({
|
|
168
|
-
value: skills.some(candidate => candidate !== skill && candidate.name === skill.name) ? skillPickerValue(skill) : skill.name,
|
|
169
|
-
description: `${skill.description} · ${skill.source}${isSkillEnabled(settings, skill.name, skill.source) ? '' : ' · disabled'}`,
|
|
170
|
-
kind: 'skill',
|
|
171
|
-
}))];
|
|
172
|
-
}
|
|
173
|
-
export function skillScopeSuggestions() {
|
|
174
|
-
return [
|
|
175
|
-
{ value: 'this project', description: 'create .haze/skills/<name>/SKILL.md for this repository', kind: 'skill' },
|
|
176
|
-
{ value: 'global', description: 'create ~/.haze/skills/<name>/SKILL.md for your user', kind: 'skill' },
|
|
177
|
-
];
|
|
178
|
-
}
|
|
179
|
-
export function skillsActionSuggestions(settings, skills, selectedSkillName) {
|
|
180
|
-
const skill = findSelectedSkill(skills, selectedSkillName);
|
|
181
|
-
const result = [];
|
|
182
|
-
if (skill) {
|
|
183
|
-
const enabled = isSkillEnabled(settings, skill.name, skill.source);
|
|
184
|
-
result.push({ value: enabled ? COMMON_ACTIONS.disable : COMMON_ACTIONS.enable, description: `${enabled ? COMMON_ACTIONS.disable : COMMON_ACTIONS.enable} this skill`, kind: 'skill' });
|
|
185
|
-
result.push({ value: SKILL_ACTIONS.showInfo, description: 'show description, references, and path', kind: 'skill' });
|
|
186
|
-
result.push({ value: SKILL_ACTIONS.validate, description: 're-load and validate SKILL.md', kind: 'skill' });
|
|
187
|
-
}
|
|
188
|
-
result.push({ value: SKILL_ACTIONS.removeSkill, description: 'delete this skill directory', kind: 'skill' });
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { HazeSettings, HazeMcpServer, HazeProviderSettings } from '../../config/settings.js';
|
|
2
|
-
import type { Mode } from './chatModes.js';
|
|
3
|
-
type SharedWizardEffect = {
|
|
4
|
-
type: 'message';
|
|
5
|
-
text?: string;
|
|
6
|
-
} | {
|
|
7
|
-
type: 'mode';
|
|
8
|
-
mode: Mode;
|
|
9
|
-
};
|
|
10
|
-
export type ProviderWizardEffect = SharedWizardEffect | {
|
|
11
|
-
type: 'provider-draft';
|
|
12
|
-
patch: Partial<HazeProviderSettings>;
|
|
13
|
-
replace?: boolean;
|
|
14
|
-
} | {
|
|
15
|
-
type: 'discover-provider-models';
|
|
16
|
-
draft: Partial<HazeProviderSettings>;
|
|
17
|
-
};
|
|
18
|
-
export type McpWizardEffect = SharedWizardEffect | {
|
|
19
|
-
type: 'mcp-draft';
|
|
20
|
-
patch: Partial<HazeMcpServer>;
|
|
21
|
-
} | {
|
|
22
|
-
type: 'finish-mcp-stdio';
|
|
23
|
-
draft: Partial<HazeMcpServer>;
|
|
24
|
-
};
|
|
25
|
-
export declare function transitionProviderField(input: {
|
|
26
|
-
mode: Mode;
|
|
27
|
-
value: string;
|
|
28
|
-
settings: HazeSettings;
|
|
29
|
-
draft: Partial<HazeProviderSettings>;
|
|
30
|
-
}): ProviderWizardEffect[] | undefined;
|
|
31
|
-
export declare function transitionMcpField(input: {
|
|
32
|
-
mode: Mode;
|
|
33
|
-
value: string;
|
|
34
|
-
settings: HazeSettings;
|
|
35
|
-
draft: Partial<HazeMcpServer>;
|
|
36
|
-
}): McpWizardEffect[] | undefined;
|
|
37
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { captureMcpCommand, captureMcpName, captureMcpTransport, captureMcpUrl, captureProviderName, captureProviderUrl } from './wizardPrompts.js';
|
|
2
|
-
export function transitionProviderField(input) {
|
|
3
|
-
if (input.mode === 'providerAddKey') {
|
|
4
|
-
const key = input.value.trim();
|
|
5
|
-
return [
|
|
6
|
-
{ type: 'provider-draft', patch: key ? { key } : {} },
|
|
7
|
-
{ type: 'discover-provider-models', draft: { ...input.draft, ...(key ? { key } : {}) } },
|
|
8
|
-
];
|
|
9
|
-
}
|
|
10
|
-
const result = input.mode === 'providerAddName' ? captureProviderName(input.settings, input.value)
|
|
11
|
-
: input.mode === 'providerAddUrl' ? captureProviderUrl(input.value)
|
|
12
|
-
: undefined;
|
|
13
|
-
if (!result)
|
|
14
|
-
return undefined;
|
|
15
|
-
if (result.message)
|
|
16
|
-
return [{ type: 'message', text: result.message }];
|
|
17
|
-
const patch = result.draft ?? {};
|
|
18
|
-
return [
|
|
19
|
-
...(Object.keys(patch).length ? [{ type: 'provider-draft', patch, replace: input.mode === 'providerAddName' }] : []),
|
|
20
|
-
...(result.nextMode ? [{ type: 'mode', mode: result.nextMode }] : []),
|
|
21
|
-
{ type: 'message', text: result.systemMessage },
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
export function transitionMcpField(input) {
|
|
25
|
-
const result = input.mode === 'mcpAddName' ? captureMcpName(input.settings, input.value)
|
|
26
|
-
: input.mode === 'mcpAddTransport' ? captureMcpTransport(input.value)
|
|
27
|
-
: input.mode === 'mcpAddUrl' ? captureMcpUrl(input.value)
|
|
28
|
-
: input.mode === 'mcpAddCommand' ? captureMcpCommand(input.value)
|
|
29
|
-
: undefined;
|
|
30
|
-
if (!result)
|
|
31
|
-
return undefined;
|
|
32
|
-
if (result.message)
|
|
33
|
-
return [{ type: 'message', text: result.message }];
|
|
34
|
-
const patch = result.draft ?? {};
|
|
35
|
-
const nextDraft = { ...input.draft, ...patch };
|
|
36
|
-
if (result.nextMode === 'chat' && input.mode === 'mcpAddCommand')
|
|
37
|
-
return [{ type: 'finish-mcp-stdio', draft: nextDraft }];
|
|
38
|
-
return [
|
|
39
|
-
...(Object.keys(patch).length ? [{ type: 'mcp-draft', patch }] : []),
|
|
40
|
-
...(result.nextMode ? [{ type: 'mode', mode: result.nextMode }] : []),
|
|
41
|
-
{ type: 'message', text: result.systemMessage },
|
|
42
|
-
];
|
|
43
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { ToolSet } from 'ai';
|
|
2
|
-
/**
|
|
3
|
-
* Marker placed on a structured tool result when the execution-boundary budget
|
|
4
|
-
* blocked the call. The underlying implementation never ran, so callers (goal
|
|
5
|
-
* observers, telemetry) must not treat it as a real tool failure with side
|
|
6
|
-
* effects (RH-003).
|
|
7
|
-
*/
|
|
8
|
-
export declare const TOOL_BUDGET_BLOCKED = "__hazeToolBudgetBlocked";
|
|
9
|
-
export interface ToolExecutionBudgetState {
|
|
10
|
-
/** Number of underlying executions that have actually started. */
|
|
11
|
-
started: number;
|
|
12
|
-
/** Set once a call was blocked so callers can force synthesis. */
|
|
13
|
-
exceeded: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function createToolExecutionBudget(): ToolExecutionBudgetState;
|
|
16
|
-
/** True when a tool result is the structured "budget blocked" placeholder. */
|
|
17
|
-
export declare function isToolBudgetBlocked(output: unknown): boolean;
|
|
18
|
-
export interface BudgetLimit {
|
|
19
|
-
state: ToolExecutionBudgetState;
|
|
20
|
-
limit: number;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Wrap a tool set so each underlying `execute` checks-and-increments one or more
|
|
24
|
-
* shared budgets synchronously at the actual execution boundary. A model-emitted
|
|
25
|
-
* parallel batch enters `execute` sequentially on the JS event loop, so no more
|
|
26
|
-
* than the remaining budget can reach an underlying implementation even within
|
|
27
|
-
* one batch (RH-003). Revisit if the AI SDK ever yields between queueing a batch
|
|
28
|
-
* and invoking execute.
|
|
29
|
-
*
|
|
30
|
-
* When any supplied limit is exhausted the call is blocked: every limit is
|
|
31
|
-
* marked exceeded, no underlying call runs, and a structured bounded failure is
|
|
32
|
-
* returned so the SDK completes the step and the next prepareStep forces
|
|
33
|
-
* text-only synthesis.
|
|
34
|
-
*/
|
|
35
|
-
export declare function withToolExecutionBudget(tools: ToolSet, ...limits: BudgetLimit[]): ToolSet;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Marker placed on a structured tool result when the execution-boundary budget
|
|
3
|
-
* blocked the call. The underlying implementation never ran, so callers (goal
|
|
4
|
-
* observers, telemetry) must not treat it as a real tool failure with side
|
|
5
|
-
* effects (RH-003).
|
|
6
|
-
*/
|
|
7
|
-
export const TOOL_BUDGET_BLOCKED = '__hazeToolBudgetBlocked';
|
|
8
|
-
export function createToolExecutionBudget() {
|
|
9
|
-
return { started: 0, exceeded: false };
|
|
10
|
-
}
|
|
11
|
-
/** True when a tool result is the structured "budget blocked" placeholder. */
|
|
12
|
-
export function isToolBudgetBlocked(output) {
|
|
13
|
-
return typeof output === 'object' && output !== null && TOOL_BUDGET_BLOCKED in output;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Wrap a tool set so each underlying `execute` checks-and-increments one or more
|
|
17
|
-
* shared budgets synchronously at the actual execution boundary. A model-emitted
|
|
18
|
-
* parallel batch enters `execute` sequentially on the JS event loop, so no more
|
|
19
|
-
* than the remaining budget can reach an underlying implementation even within
|
|
20
|
-
* one batch (RH-003). Revisit if the AI SDK ever yields between queueing a batch
|
|
21
|
-
* and invoking execute.
|
|
22
|
-
*
|
|
23
|
-
* When any supplied limit is exhausted the call is blocked: every limit is
|
|
24
|
-
* marked exceeded, no underlying call runs, and a structured bounded failure is
|
|
25
|
-
* returned so the SDK completes the step and the next prepareStep forces
|
|
26
|
-
* text-only synthesis.
|
|
27
|
-
*/
|
|
28
|
-
export function withToolExecutionBudget(tools, ...limits) {
|
|
29
|
-
return Object.fromEntries(Object.entries(tools).map(([name, definition]) => {
|
|
30
|
-
if (typeof definition.execute !== 'function')
|
|
31
|
-
return [name, definition];
|
|
32
|
-
const execute = definition.execute;
|
|
33
|
-
return [name, {
|
|
34
|
-
...definition,
|
|
35
|
-
execute: (...args) => {
|
|
36
|
-
for (const { state, limit } of limits) {
|
|
37
|
-
if (state.started >= limit) {
|
|
38
|
-
for (const entry of limits)
|
|
39
|
-
entry.state.exceeded = true;
|
|
40
|
-
return { ok: false, [TOOL_BUDGET_BLOCKED]: true, error: 'Tool-call budget exhausted; execution was blocked before the underlying tool ran.' };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
for (const { state } of limits)
|
|
44
|
-
state.started++;
|
|
45
|
-
return execute(...args);
|
|
46
|
-
},
|
|
47
|
-
}];
|
|
48
|
-
}));
|
|
49
|
-
}
|