@denizokcu/haze 0.10.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 +100 -1
- package/README.md +77 -27
- package/SECURITY.md +22 -0
- package/bin/haze.js +102 -1
- package/dist/buildInfo.json +7 -0
- package/dist/cli/chat/TaskBar.d.ts +2 -1
- package/dist/cli/chat/TaskBar.js +7 -4
- package/dist/cli/chat/chatMetrics.d.ts +2 -2
- package/dist/cli/chat/chatMetrics.js +1 -1
- package/dist/cli/chat/contextReport.js +2 -0
- package/dist/cli/chat/fileMentionSuggestions.js +3 -2
- package/dist/cli/chat/inputSuggestions.d.ts +8 -16
- package/dist/cli/chat/inputSuggestions.js +9 -41
- package/dist/cli/chat/liveRegion.d.ts +25 -0
- package/dist/cli/chat/liveRegion.js +48 -0
- package/dist/cli/chat/messages.d.ts +33 -4
- package/dist/cli/chat/messages.js +218 -35
- package/dist/cli/chat/sessionLifecycle.d.ts +11 -1
- package/dist/cli/chat/sessionLifecycle.js +64 -14
- package/dist/cli/chat/sessionRecorder.js +75 -7
- package/dist/cli/chat/startupInfo.d.ts +0 -1
- package/dist/cli/chat/startupInfo.js +11 -15
- package/dist/cli/chat/turnState.d.ts +1 -1
- package/dist/cli/chat/wizardDispatch.d.ts +90 -28
- package/dist/cli/chat/wizardDispatch.js +349 -133
- package/dist/cli/commands/chat.d.ts +5 -0
- package/dist/cli/commands/chat.js +216 -172
- package/dist/cli/commands/chatModes.d.ts +8 -1
- package/dist/cli/commands/chatModes.js +9 -44
- package/dist/cli/commands/commands.d.ts +2 -0
- package/dist/cli/commands/commands.js +10 -5
- package/dist/cli/commands/doctor.d.ts +19 -0
- package/dist/cli/commands/doctor.js +76 -0
- package/dist/cli/commands/formatters.d.ts +3 -3
- package/dist/cli/commands/formatters.js +8 -25
- package/dist/cli/commands/ndjsonSink.d.ts +23 -0
- package/dist/cli/commands/ndjsonSink.js +38 -0
- package/dist/cli/commands/providerWizard.d.ts +9 -2
- package/dist/cli/commands/providerWizard.js +39 -7
- package/dist/cli/commands/runCommand.d.ts +3 -0
- package/dist/cli/commands/runCommand.js +117 -11
- 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 +25 -0
- package/dist/cli/commands/streaming/abortCause.js +16 -0
- package/dist/cli/commands/streaming/agentAttempt.d.ts +43 -0
- package/dist/cli/commands/streaming/agentAttempt.js +79 -0
- package/dist/cli/commands/streaming/assistantText.js +9 -2
- 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 +65 -0
- package/dist/cli/commands/streaming/goalCheckpoint.js +23 -0
- package/dist/cli/commands/streaming/goalSupervisor.d.ts +64 -0
- package/dist/cli/commands/streaming/goalSupervisor.js +130 -0
- 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 +16 -0
- package/dist/cli/commands/streaming/toolCallRecovery.js +80 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +31 -1
- package/dist/cli/commands/streaming/toolGroupRenderer.js +50 -4
- package/dist/cli/commands/streaming/toolResultState.d.ts +6 -1
- package/dist/cli/commands/streaming/toolResultState.js +29 -7
- 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 +65 -9
- package/dist/cli/commands/streaming.js +133 -430
- 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 +68 -22
- package/dist/cli/terminalTitle.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 +36 -0
- package/dist/config/modelDiscovery.js +164 -1
- package/dist/config/privateStorage.js +28 -2
- package/dist/config/providerAuth.d.ts +14 -0
- package/dist/config/providerAuth.js +49 -0
- package/dist/config/providerPresets.d.ts +39 -7
- package/dist/config/providerPresets.js +371 -100
- package/dist/config/providers.js +2 -0
- package/dist/config/settings.d.ts +43 -0
- package/dist/config/settings.js +12 -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 +73 -1
- package/dist/core/agent/budgets.js +94 -1
- package/dist/core/agent/compaction.d.ts +38 -0
- package/dist/core/agent/compaction.js +92 -17
- package/dist/core/agent/completionController.d.ts +224 -0
- package/dist/core/agent/completionController.js +296 -0
- package/dist/core/agent/contextBudget.d.ts +36 -2
- package/dist/core/agent/contextBudget.js +62 -9
- package/dist/core/agent/errors.d.ts +0 -1
- package/dist/core/agent/errors.js +1 -1
- package/dist/core/agent/events.d.ts +78 -0
- package/dist/core/agent/goalPolicy.d.ts +47 -0
- package/dist/core/agent/goalPolicy.js +106 -0
- package/dist/core/agent/reasoningPolicy.d.ts +31 -0
- package/dist/core/agent/reasoningPolicy.js +27 -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 +27 -0
- package/dist/core/agent/toolCapabilities.js +58 -0
- package/dist/core/agent/toolOutputStore.d.ts +8 -0
- package/dist/core/agent/toolOutputStore.js +11 -11
- package/dist/core/agent/toolResults.d.ts +12 -0
- package/dist/core/agent/toolResults.js +38 -0
- package/dist/core/agent/turnPolicy.d.ts +11 -0
- package/dist/core/agent/turnPolicy.js +19 -0
- package/dist/core/agent/workState.d.ts +81 -3
- package/dist/core/agent/workState.js +176 -10
- package/dist/core/attachments/imageAttachments.js +90 -42
- package/dist/core/deadline.d.ts +27 -0
- package/dist/core/deadline.js +74 -0
- 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 +8 -1
- package/dist/core/persistence/orderedFileWriter.d.ts +10 -0
- package/dist/core/persistence/orderedFileWriter.js +16 -2
- package/dist/core/process/backgroundRegistry.d.ts +2 -3
- package/dist/core/process/backgroundRegistry.js +15 -10
- package/dist/core/process/runBoundedProcess.d.ts +8 -2
- package/dist/core/process/runBoundedProcess.js +15 -6
- package/dist/core/process/userShell.d.ts +16 -0
- package/dist/core/process/userShell.js +59 -0
- package/dist/core/safety/missingExecutable.d.ts +42 -0
- package/dist/core/safety/missingExecutable.js +77 -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 +38 -0
- package/dist/core/session/sessionStore.js +242 -59
- 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 +6 -14
- package/dist/core/subagent/contracts.js +4 -3
- package/dist/core/subagent/executionProfiles.js +2 -2
- package/dist/core/subagent/subagentCoordinator.d.ts +4 -0
- package/dist/core/subagent/subagentCoordinator.js +32 -2
- package/dist/core/subagent/subagentRunner.js +19 -40
- 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.d.ts +17 -1
- package/dist/llm/client.js +86 -14
- package/dist/llm/hazeTools.d.ts +693 -204
- package/dist/llm/hazeTools.js +110 -28
- 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 +5653 -33
- package/dist/llm/lspTools.js +152 -80
- package/dist/llm/openaiCodex.d.ts +1 -0
- package/dist/llm/openaiCodex.js +43 -0
- package/dist/llm/openaiCodexOAuth.d.ts +51 -0
- package/dist/llm/openaiCodexOAuth.js +217 -0
- package/dist/llm/requestContext.d.ts +7 -0
- package/dist/llm/requestContext.js +30 -4
- package/dist/llm/systemPrompt.d.ts +12 -0
- package/dist/llm/systemPrompt.js +24 -11
- package/dist/llm/toolResultTypes.d.ts +7 -14
- package/dist/llm/toolResultTypes.js +1 -4
- package/dist/llm/tools/editMatch.d.ts +14 -9
- package/dist/llm/tools/editMatch.js +73 -1
- package/dist/llm/tools/failures.d.ts +2 -0
- package/dist/llm/tools/failures.js +1 -0
- package/dist/llm/tools/fetchTool.d.ts +16 -0
- package/dist/llm/tools/fetchTool.js +1 -1
- package/dist/llm/tools/fileToolShared.d.ts +8 -5
- package/dist/llm/tools/fileToolShared.js +22 -23
- package/dist/llm/tools/gitIgnore.d.ts +42 -0
- package/dist/llm/tools/gitIgnore.js +247 -0
- 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 +8 -0
- package/dist/llm/tools/readRecovery.js +135 -0
- package/dist/llm/tools/{bashTool.d.ts → shellTool.d.ts} +171 -123
- package/dist/llm/tools/{bashTool.js → shellTool.js} +20 -14
- package/dist/llm/tools/toolContext.d.ts +1 -1
- package/dist/llm/tools/toolContext.js +66 -37
- package/dist/llm/tools/workspaceFile.d.ts +0 -1
- package/dist/llm/tools/workspaceFile.js +1 -6
- package/dist/llm/webFetch.d.ts +18 -1
- package/dist/llm/webFetch.js +64 -97
- 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/ui/codeHighlight.d.ts +4 -0
- package/dist/ui/codeHighlight.js +31 -0
- package/dist/ui/components/Header.d.ts +1 -1
- package/dist/ui/components/MarkdownText.d.ts +16 -2
- package/dist/ui/components/MarkdownText.js +244 -34
- package/dist/ui/components/TextInput.d.ts +8 -1
- package/dist/ui/components/TextInput.js +6 -2
- package/dist/ui/theme.d.ts +4 -3
- package/dist/ui/theme.js +5 -4
- package/dist/utils/buildInfo.d.ts +97 -0
- package/dist/utils/buildInfo.js +244 -0
- package/dist/utils/fs.d.ts +11 -0
- package/dist/utils/fs.js +91 -26
- package/dist/utils/openPath.d.ts +2 -2
- package/dist/utils/openPath.js +19 -6
- package/dist/utils/path.d.ts +2 -1
- package/dist/utils/path.js +6 -2
- package/dist/utils/utf8.d.ts +22 -0
- package/dist/utils/utf8.js +54 -0
- package/dist/utils/version.d.ts +9 -3
- package/dist/utils/version.js +28 -2
- package/package.json +28 -21
- 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 -10
- package/dist/cli/commands/streaming/turnOutcome.js +0 -13
- package/dist/cli/commands/wizardActions.d.ts +0 -46
- package/dist/cli/commands/wizardActions.js +0 -46
- 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 -52
- package/dist/cli/commands/wizardSuggestions.d.ts +0 -31
- package/dist/cli/commands/wizardSuggestions.js +0 -188
- package/dist/cli/commands/wizardTransition.d.ts +0 -37
- package/dist/cli/commands/wizardTransition.js +0 -43
- 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.d.ts +0 -2
- package/dist/core/goal/completionPolicy.js +0 -7
- 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 -18
- package/dist/core/limits/byteBudgets.js +0 -18
- package/dist/core/limits/textBudgets.d.ts +0 -23
- package/dist/core/limits/textBudgets.js +0 -23
- package/dist/core/safety/bashClassifier.d.ts +0 -10
- package/dist/llm/lsp.d.ts +0 -129
- package/dist/llm/lsp.js +0 -307
- 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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@denizokcu/haze",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A minimal LLM harness for your terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -25,56 +25,63 @@
|
|
|
25
25
|
"bin",
|
|
26
26
|
"dist",
|
|
27
27
|
"README.md",
|
|
28
|
+
"SECURITY.md",
|
|
28
29
|
"LICENSE",
|
|
29
|
-
"CHANGELOG.md"
|
|
30
|
-
"examples"
|
|
30
|
+
"CHANGELOG.md"
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"dev": "tsx src/cli/index.ts",
|
|
34
34
|
"clean": "node -e \"require('node:fs').rmSync('dist', {recursive: true, force: true})\"",
|
|
35
|
-
"build": "npm run clean && tsc",
|
|
35
|
+
"build": "npm run clean && tsc && node scripts/write-build-info.mjs",
|
|
36
|
+
"dev:link": "node scripts/dev-link.mjs",
|
|
36
37
|
"start": "node dist/cli/index.js",
|
|
37
38
|
"test": "vitest run",
|
|
38
39
|
"test:watch": "vitest",
|
|
39
40
|
"lint": "eslint src/",
|
|
40
41
|
"lint:fix": "eslint src/ --fix",
|
|
42
|
+
"lint:knip": "knip",
|
|
41
43
|
"typecheck": "tsc --noEmit",
|
|
42
44
|
"context:report": "node --import tsx src/cli/contextReport.ts",
|
|
45
|
+
"release:verify": "node scripts/verify-release-metadata.mjs",
|
|
43
46
|
"haze": "tsx src/cli/index.ts",
|
|
44
|
-
"prepublishOnly": "npm run typecheck && npm run build"
|
|
47
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run lint && npm run build && npm audit --audit-level=high && npm run release:verify"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"@ai-sdk/mcp": "^2.0.
|
|
48
|
-
"@ai-sdk/openai": "4.0.
|
|
50
|
+
"@ai-sdk/mcp": "^2.0.31",
|
|
51
|
+
"@ai-sdk/openai": "4.0.41",
|
|
49
52
|
"@vscode/ripgrep": "1.18.0",
|
|
50
|
-
"ai": "7.0.
|
|
53
|
+
"ai": "7.0.64",
|
|
51
54
|
"cli-highlight": "2.1.11",
|
|
52
55
|
"commander": "15.0.0",
|
|
53
|
-
"defuddle": "^0.19.
|
|
54
|
-
"fs-extra": "11.
|
|
55
|
-
"
|
|
56
|
+
"defuddle": "^0.19.2",
|
|
57
|
+
"fs-extra": "11.4.0",
|
|
58
|
+
"ignore": "^7.0.6",
|
|
59
|
+
"ink": "7.1.1",
|
|
56
60
|
"ink-spinner": "5.0.0",
|
|
57
61
|
"linkedom": "^0.18.13",
|
|
58
|
-
"marked": "18.0.
|
|
59
|
-
"react": "19.2.
|
|
62
|
+
"marked": "18.0.9",
|
|
63
|
+
"react": "19.2.8",
|
|
60
64
|
"strip-ansi": "7.2.0",
|
|
61
65
|
"turndown": "^7.2.4",
|
|
66
|
+
"wrap-ansi": "10.0.0",
|
|
62
67
|
"yaml": "2.9.0",
|
|
63
68
|
"zod": "4.4.3"
|
|
64
69
|
},
|
|
65
70
|
"devDependencies": {
|
|
66
71
|
"@eslint/js": "^10.0.1",
|
|
67
72
|
"@types/fs-extra": "11.0.4",
|
|
68
|
-
"@types/node": "26.
|
|
69
|
-
"@types/react": "19.2.
|
|
70
|
-
"eslint": "^10.
|
|
71
|
-
"
|
|
73
|
+
"@types/node": "26.2.0",
|
|
74
|
+
"@types/react": "19.2.18",
|
|
75
|
+
"eslint": "^10.8.1",
|
|
76
|
+
"ink-testing-library": "^4.0.0",
|
|
77
|
+
"knip": "5.88.1",
|
|
78
|
+
"tsx": "4.23.12",
|
|
72
79
|
"typescript": "6.0.3",
|
|
73
|
-
"typescript-eslint": "^8.
|
|
80
|
+
"typescript-eslint": "^8.67.0",
|
|
74
81
|
"vitest": "^4.1.10"
|
|
75
82
|
},
|
|
76
83
|
"allowScripts": {
|
|
77
|
-
"
|
|
78
|
-
"
|
|
84
|
+
"fsevents@2.3.3": true,
|
|
85
|
+
"esbuild@0.28.2": true
|
|
79
86
|
}
|
|
80
87
|
}
|
|
@@ -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
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TurnStatus } from '../streaming.js';
|
|
2
|
-
export declare function terminalTurnStatus(input: {
|
|
3
|
-
aborted: boolean;
|
|
4
|
-
error?: unknown;
|
|
5
|
-
assistantText: string;
|
|
6
|
-
sawToolCall: boolean;
|
|
7
|
-
lastToolOk?: boolean;
|
|
8
|
-
finishReason?: string;
|
|
9
|
-
budgetReached?: boolean;
|
|
10
|
-
}): TurnStatus;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function terminalTurnStatus(input) {
|
|
2
|
-
if (input.aborted)
|
|
3
|
-
return 'aborted';
|
|
4
|
-
if (input.error)
|
|
5
|
-
return 'failed';
|
|
6
|
-
if (input.lastToolOk === false)
|
|
7
|
-
return 'failed';
|
|
8
|
-
if (input.budgetReached || input.finishReason === 'length' || input.finishReason === 'error')
|
|
9
|
-
return 'failed';
|
|
10
|
-
if (input.sawToolCall && input.assistantText.trim().length === 0)
|
|
11
|
-
return 'failed';
|
|
12
|
-
return input.assistantText.trim().length > 0 ? 'complete' : 'failed';
|
|
13
|
-
}
|
|
@@ -1,46 +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 markImageCapable: "mark image-capable";
|
|
10
|
-
readonly clearImageCapable: "clear image-capable";
|
|
11
|
-
readonly removeModels: "remove models";
|
|
12
|
-
readonly removeProvider: "remove provider";
|
|
13
|
-
};
|
|
14
|
-
export declare const MODEL_CHOICES: {
|
|
15
|
-
readonly addModels: "add models";
|
|
16
|
-
readonly enterModelNames: "enter model names";
|
|
17
|
-
};
|
|
18
|
-
export declare const SERVER_CHOICES: {
|
|
19
|
-
readonly addServer: "add server";
|
|
20
|
-
readonly custom: "custom";
|
|
21
|
-
};
|
|
22
|
-
export declare const COMMON_ACTIONS: {
|
|
23
|
-
readonly enable: "enable";
|
|
24
|
-
readonly disable: "disable";
|
|
25
|
-
};
|
|
26
|
-
export declare const LSP_ACTIONS: {
|
|
27
|
-
readonly removeServer: "remove server";
|
|
28
|
-
};
|
|
29
|
-
export declare const MCP_ACTIONS: {
|
|
30
|
-
readonly setApiKey: "set API key";
|
|
31
|
-
readonly removeServer: "remove server";
|
|
32
|
-
};
|
|
33
|
-
export declare const MCP_TRANSPORTS: {
|
|
34
|
-
readonly http: "http";
|
|
35
|
-
readonly sse: "sse";
|
|
36
|
-
readonly stdio: "stdio";
|
|
37
|
-
};
|
|
38
|
-
export declare const SKILL_CHOICES: {
|
|
39
|
-
readonly addSkill: "add skill";
|
|
40
|
-
};
|
|
41
|
-
export declare const SKILL_ACTIONS: {
|
|
42
|
-
readonly showInfo: "show info";
|
|
43
|
-
readonly validate: "validate";
|
|
44
|
-
readonly removeSkill: "remove skill";
|
|
45
|
-
};
|
|
46
|
-
export declare const YES_CONFIRMATION = "yes";
|
|
@@ -1,46 +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
|
-
markImageCapable: 'mark image-capable',
|
|
10
|
-
clearImageCapable: 'clear image-capable',
|
|
11
|
-
removeModels: 'remove models',
|
|
12
|
-
removeProvider: 'remove provider',
|
|
13
|
-
};
|
|
14
|
-
export const MODEL_CHOICES = {
|
|
15
|
-
addModels: 'add models',
|
|
16
|
-
enterModelNames: 'enter model names',
|
|
17
|
-
};
|
|
18
|
-
export const SERVER_CHOICES = {
|
|
19
|
-
addServer: 'add server',
|
|
20
|
-
custom: 'custom',
|
|
21
|
-
};
|
|
22
|
-
export const COMMON_ACTIONS = {
|
|
23
|
-
enable: 'enable',
|
|
24
|
-
disable: 'disable',
|
|
25
|
-
};
|
|
26
|
-
export const LSP_ACTIONS = {
|
|
27
|
-
removeServer: 'remove server',
|
|
28
|
-
};
|
|
29
|
-
export const MCP_ACTIONS = {
|
|
30
|
-
setApiKey: 'set API key',
|
|
31
|
-
removeServer: 'remove server',
|
|
32
|
-
};
|
|
33
|
-
export const MCP_TRANSPORTS = {
|
|
34
|
-
http: 'http',
|
|
35
|
-
sse: 'sse',
|
|
36
|
-
stdio: 'stdio',
|
|
37
|
-
};
|
|
38
|
-
export const SKILL_CHOICES = {
|
|
39
|
-
addSkill: 'add skill',
|
|
40
|
-
};
|
|
41
|
-
export const SKILL_ACTIONS = {
|
|
42
|
-
showInfo: 'show info',
|
|
43
|
-
validate: 'validate',
|
|
44
|
-
removeSkill: 'remove skill',
|
|
45
|
-
};
|
|
46
|
-
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,52 +0,0 @@
|
|
|
1
|
-
import { configuredLspServers } from '../../config/lspSettings.js';
|
|
2
|
-
import { findMcpServer } from '../../config/mcpSettings.js';
|
|
3
|
-
import { MCP_TRANSPORTS } from './wizardActions.js';
|
|
4
|
-
import { commandParts, isValidUrl } from './wizardInput.js';
|
|
5
|
-
export function captureProviderName(settings, value) {
|
|
6
|
-
const name = value.trim();
|
|
7
|
-
if (!name)
|
|
8
|
-
return { message: 'Provider name is required.' };
|
|
9
|
-
if (settings.providers?.some(provider => provider.name === name))
|
|
10
|
-
return { message: `Provider ${name} already exists. Choose a unique name.` };
|
|
11
|
-
return { nextMode: 'providerAddUrl', draft: { name }, systemMessage: 'OpenAI-compatible base URL? Example: https://openrouter.ai/api/v1 or http://localhost:1234/v1' };
|
|
12
|
-
}
|
|
13
|
-
export function captureLspName(settings, value) {
|
|
14
|
-
const name = value.trim();
|
|
15
|
-
if (!name)
|
|
16
|
-
return { message: 'LSP server name is required.' };
|
|
17
|
-
if (configuredLspServers(settings).some(server => server.name === name))
|
|
18
|
-
return { message: `LSP server ${name} already exists. Choose a unique name.` };
|
|
19
|
-
return { nextMode: 'lspAddCommand', draft: { name }, systemMessage: 'Command to run? Example: typescript-language-server --stdio' };
|
|
20
|
-
}
|
|
21
|
-
export function captureMcpName(settings, value) {
|
|
22
|
-
const name = value.trim();
|
|
23
|
-
if (!name)
|
|
24
|
-
return { message: 'MCP server name is required.' };
|
|
25
|
-
if (findMcpServer(settings, name))
|
|
26
|
-
return { message: `MCP server ${name} already exists. Choose a unique name.` };
|
|
27
|
-
return { nextMode: 'mcpAddTransport', draft: { name }, systemMessage: 'Transport type? http (Streamable HTTP), sse (Server-Sent Events), or stdio (local process).' };
|
|
28
|
-
}
|
|
29
|
-
export function captureProviderUrl(value) {
|
|
30
|
-
if (!isValidUrl(value))
|
|
31
|
-
return { message: 'Enter a valid URL, for example http://localhost:1234/v1.' };
|
|
32
|
-
return { draft: { url: value.trim() }, nextMode: 'providerAddKey', systemMessage: 'API key? Leave blank for local/keyless providers.' };
|
|
33
|
-
}
|
|
34
|
-
export function captureMcpUrl(value) {
|
|
35
|
-
if (!isValidUrl(value))
|
|
36
|
-
return { message: 'Enter a valid URL, for example https://mcp.context7.com/mcp.' };
|
|
37
|
-
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>.' };
|
|
38
|
-
}
|
|
39
|
-
export function captureMcpTransport(value) {
|
|
40
|
-
const transport = value.trim().toLowerCase();
|
|
41
|
-
if (transport !== MCP_TRANSPORTS.http && transport !== MCP_TRANSPORTS.sse && transport !== MCP_TRANSPORTS.stdio)
|
|
42
|
-
return { message: 'Enter http, sse, or stdio.' };
|
|
43
|
-
if (transport === MCP_TRANSPORTS.stdio)
|
|
44
|
-
return { draft: { transport }, nextMode: 'mcpAddCommand', systemMessage: 'Command to run? Example: npx -y @modelcontextprotocol/server-filesystem .' };
|
|
45
|
-
return { draft: { transport }, nextMode: 'mcpAddUrl', systemMessage: `MCP server URL? Example: https://mcp.context7.com/mcp for ${transport}.` };
|
|
46
|
-
}
|
|
47
|
-
export function captureMcpCommand(value) {
|
|
48
|
-
const parts = commandParts(value);
|
|
49
|
-
if (parts.length === 0)
|
|
50
|
-
return { message: 'Command is required.' };
|
|
51
|
-
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.' };
|
|
52
|
-
}
|
|
@@ -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[];
|