@denizokcu/haze 1.0.0 → 1.1.1
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 +33 -0
- package/README.md +17 -8
- package/SECURITY.md +3 -1
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/TaskBar.js +1 -1
- package/dist/cli/chat/busyIndicator.d.ts +11 -0
- package/dist/cli/chat/busyIndicator.js +34 -0
- package/dist/cli/chat/chatMetrics.d.ts +0 -1
- package/dist/cli/chat/chatMetrics.js +1 -7
- package/dist/cli/chat/followUpQueue.d.ts +11 -0
- package/dist/cli/chat/followUpQueue.js +38 -0
- package/dist/cli/chat/inputSuggestions.js +1 -0
- package/dist/cli/chat/messages.d.ts +0 -22
- package/dist/cli/chat/messages.js +42 -87
- package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
- package/dist/cli/chat/sessionLifecycle.js +6 -1
- package/dist/cli/chat/sessionRecorder.d.ts +2 -0
- package/dist/cli/chat/sessionRecorder.js +6 -0
- package/dist/cli/chat/startupSequence.d.ts +29 -0
- package/dist/cli/chat/startupSequence.js +59 -0
- package/dist/cli/chat/transcriptPartition.d.ts +23 -0
- package/dist/cli/chat/transcriptPartition.js +78 -0
- package/dist/cli/chat/wizard/fieldTransitions.d.ts +38 -0
- package/dist/cli/chat/wizard/fieldTransitions.js +43 -0
- package/dist/cli/chat/wizard/lspHandlers.d.ts +4 -0
- package/dist/cli/chat/wizard/lspHandlers.js +85 -0
- package/dist/cli/chat/wizard/mcpHandlers.d.ts +8 -0
- package/dist/cli/chat/wizard/mcpHandlers.js +82 -0
- package/dist/cli/chat/wizard/providerHandlers.d.ts +12 -0
- package/dist/cli/chat/wizard/providerHandlers.js +420 -0
- package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +4 -0
- package/dist/cli/chat/wizard/sessionThemeHandlers.js +48 -0
- package/dist/cli/chat/wizard/skillsHandlers.d.ts +4 -0
- package/dist/cli/chat/wizard/skillsHandlers.js +125 -0
- package/dist/cli/chat/wizard/types.d.ts +63 -0
- package/dist/cli/chat/wizard/types.js +24 -0
- package/dist/cli/chat/wizard/uiState.d.ts +56 -0
- package/dist/cli/chat/wizard/uiState.js +15 -0
- package/dist/cli/chat/wizardDispatch.d.ts +11 -113
- package/dist/cli/chat/wizardDispatch.js +41 -805
- package/dist/cli/commands/chat.js +89 -110
- package/dist/cli/commands/commandHelp.js +2 -0
- package/dist/cli/commands/commands.js +2 -0
- package/dist/cli/commands/formatters.d.ts +0 -3
- package/dist/cli/commands/formatters.js +6 -29
- package/dist/cli/commands/runCommand.d.ts +2 -0
- package/dist/cli/commands/runCommand.js +67 -4
- package/dist/cli/commands/settingsSummary.js +2 -0
- package/dist/cli/commands/streaming/assistantSegments.d.ts +19 -0
- package/dist/cli/commands/streaming/assistantSegments.js +48 -0
- package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -2
- package/dist/cli/commands/streaming/attemptOutcome.js +17 -7
- package/dist/cli/commands/streaming/goalCheckpoint.d.ts +69 -8
- package/dist/cli/commands/streaming/goalCheckpoint.js +36 -1
- package/dist/cli/commands/streaming/goalSupervisor.d.ts +17 -2
- package/dist/cli/commands/streaming/goalSupervisor.js +62 -12
- package/dist/cli/commands/streaming/prepareStep.d.ts +35 -0
- package/dist/cli/commands/streaming/prepareStep.js +100 -0
- package/dist/cli/commands/streaming/recoverySlices.d.ts +15 -0
- package/dist/cli/commands/streaming/recoverySlices.js +29 -0
- package/dist/cli/commands/streaming/stallRecovery.d.ts +0 -1
- package/dist/cli/commands/streaming/stallRecovery.js +0 -4
- package/dist/cli/commands/streaming/streamLoop.js +9 -230
- package/dist/cli/commands/streaming/toolGroupRenderer.js +2 -1
- package/dist/cli/commands/streaming/toolPartHandlers.d.ts +19 -0
- package/dist/cli/commands/streaming/toolPartHandlers.js +95 -0
- package/dist/cli/commands/streaming.d.ts +4 -1
- package/dist/cli/commands/streaming.js +6 -21
- package/dist/cli/commands/themesCommand.d.ts +17 -0
- package/dist/cli/commands/themesCommand.js +24 -0
- package/dist/cli/commands/wizardFlow.d.ts +7 -0
- package/dist/cli/commands/wizardFlow.js +20 -0
- package/dist/cli/index.js +3 -1
- package/dist/config/providerPresets.d.ts +7 -0
- package/dist/config/providerPresets.js +195 -391
- package/dist/config/settings.d.ts +2 -0
- package/dist/config/settings.js +1 -0
- package/dist/core/agent/completionController.d.ts +14 -7
- package/dist/core/agent/completionController.js +12 -6
- package/dist/core/agent/events.d.ts +12 -0
- package/dist/core/agent/goalPolicy.d.ts +4 -3
- package/dist/core/agent/goalPolicy.js +9 -4
- package/dist/core/agent/workState.d.ts +25 -15
- package/dist/core/agent/workState.js +71 -43
- package/dist/core/safety/secretPaths.d.ts +18 -0
- package/dist/core/safety/secretPaths.js +115 -0
- package/dist/core/session/sessionSlimming.js +8 -0
- package/dist/core/session/sessionStore.d.ts +61 -1
- package/dist/core/session/sessionStore.js +115 -6
- package/dist/llm/hazeTools.d.ts +64 -208
- package/dist/llm/hazeTools.js +6 -0
- package/dist/llm/systemPrompt.js +3 -1
- package/dist/llm/toolResultTypes.d.ts +1 -1
- package/dist/llm/tools/failures.d.ts +6 -0
- package/dist/llm/tools/failures.js +8 -2
- package/dist/llm/tools/readRecovery.js +2 -0
- package/dist/llm/tools/shellTool.js +3 -0
- package/dist/llm/tools/taskTool.d.ts +64 -208
- package/dist/llm/tools/taskTool.js +22 -10
- package/dist/llm/tools/workspaceFile.d.ts +4 -3
- package/dist/llm/tools/workspaceFile.js +30 -13
- package/dist/ui/components/Header.js +1 -1
- package/dist/ui/components/MarkdownText.js +10 -10
- package/dist/ui/components/TextInput.d.ts +1 -1
- package/dist/ui/components/TextInput.js +8 -69
- package/dist/ui/components/useInputSuggestions.d.ts +27 -0
- package/dist/ui/components/useInputSuggestions.js +98 -0
- package/dist/ui/terminalColors.d.ts +29 -0
- package/dist/ui/terminalColors.js +47 -0
- package/dist/ui/theme.d.ts +105 -10
- package/dist/ui/theme.js +125 -15
- package/dist/ui/themes/registry.d.ts +5 -0
- package/dist/ui/themes/registry.js +436 -0
- package/dist/utils/format.d.ts +10 -0
- package/dist/utils/format.js +45 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HazeSettings } from '../../config/settings.js';
|
|
2
|
+
import type { CommandContext, CommandResult } from './commands.js';
|
|
3
|
+
/**
|
|
4
|
+
* `/themes` — theme picker and direct set. The picker is one step in the
|
|
5
|
+
* `wizardFlow.ts` table (mode `themes`); this module holds the pure selection
|
|
6
|
+
* result shared by the slash path and the wizard submit handler, mirroring the
|
|
7
|
+
* other `*Command.ts` / `*Wizard.ts` splits. Applying the resolved theme live
|
|
8
|
+
* is owned by ChatScreen (it re-resolves whenever `settings.theme` changes).
|
|
9
|
+
*/
|
|
10
|
+
export interface ThemeSelectionResult {
|
|
11
|
+
/** Present when the name is valid and should be persisted; absent means the message explains the failure. */
|
|
12
|
+
settingsPatch?: HazeSettings;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
/** Validate a theme name against the built-in registry (`resolveTheme` lists the valid names on failure) and shape the persist result. */
|
|
16
|
+
export declare function selectThemeResult(name: string): ThemeSelectionResult;
|
|
17
|
+
export declare function handleThemesCommand(args: string, ctx: CommandContext): Promise<CommandResult>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolveTheme } from '../../ui/theme.js';
|
|
2
|
+
/** Validate a theme name against the built-in registry (`resolveTheme` lists the valid names on failure) and shape the persist result. */
|
|
3
|
+
export function selectThemeResult(name) {
|
|
4
|
+
const trimmed = name.trim();
|
|
5
|
+
try {
|
|
6
|
+
resolveTheme(trimmed);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
return { message: error instanceof Error ? error.message : String(error) };
|
|
10
|
+
}
|
|
11
|
+
return { settingsPatch: { theme: trimmed }, message: `Theme set to ${trimmed}. Saved to ~/.haze/settings.json. Text already on screen keeps its old colors.` };
|
|
12
|
+
}
|
|
13
|
+
export async function handleThemesCommand(args, ctx) {
|
|
14
|
+
if (!args) {
|
|
15
|
+
ctx.setMode('themes');
|
|
16
|
+
ctx.addSystemMessage('Choose a theme. Selecting one applies it immediately and saves it to ~/.haze/settings.json.');
|
|
17
|
+
return 'handled';
|
|
18
|
+
}
|
|
19
|
+
const result = selectThemeResult(args);
|
|
20
|
+
if (result.settingsPatch)
|
|
21
|
+
await ctx.updateSettings(result.settingsPatch);
|
|
22
|
+
ctx.addSystemMessage(result.message);
|
|
23
|
+
return 'handled';
|
|
24
|
+
}
|
|
@@ -106,6 +106,8 @@ export declare function mcpTransportSuggestions(): TextInputSuggestion[];
|
|
|
106
106
|
export declare function skillsSuggestions(settings: HazeSettings, skills: LoadedSkill[]): TextInputSuggestion[];
|
|
107
107
|
export declare function skillScopeSuggestions(): TextInputSuggestion[];
|
|
108
108
|
export declare function skillsActionSuggestions(settings: HazeSettings, skills: LoadedSkill[], selectedSkillName: string | undefined): TextInputSuggestion[];
|
|
109
|
+
/** Every built-in theme with its palette brightness and the active one marked (`resolveTheme` validates names). */
|
|
110
|
+
export declare function themeSuggestions(settings: HazeSettings): TextInputSuggestion[];
|
|
109
111
|
type WizardStepKind = 'pick' | 'input' | 'masked-input' | 'confirm';
|
|
110
112
|
/** Inputs available to a step's suggestion builder (mirrors the picker state). */
|
|
111
113
|
export interface WizardSuggestionState {
|
|
@@ -327,6 +329,11 @@ export declare const WIZARD_STEPS: readonly [{
|
|
|
327
329
|
readonly kind: "confirm";
|
|
328
330
|
readonly placeholder: "Type \"yes\" to confirm";
|
|
329
331
|
readonly suggestions: () => never[];
|
|
332
|
+
}, {
|
|
333
|
+
readonly id: "themes";
|
|
334
|
+
readonly kind: "pick";
|
|
335
|
+
readonly placeholder: "Choose a theme";
|
|
336
|
+
readonly suggestions: (s: WizardSuggestionState) => TextInputSuggestion[];
|
|
330
337
|
}];
|
|
331
338
|
export type WizardStepId = (typeof WIZARD_STEPS)[number]['id'];
|
|
332
339
|
/** Suggestions for a wizard mode, or undefined when the mode is not a wizard step ('chat'). */
|
|
@@ -4,6 +4,7 @@ import { configuredMcpServers, findMcpServer, findMcpPreset, presetIds } from '.
|
|
|
4
4
|
import { isSkillEnabled } from '../../config/skillSettings.js';
|
|
5
5
|
import { PROVIDER_PRESETS } from '../../config/providerPresets.js';
|
|
6
6
|
import { CHATGPT_CODEX_BASE_URL } from '../../llm/openaiCodexOAuth.js';
|
|
7
|
+
import { BUILT_IN_THEME_SPECS, DEFAULT_THEME_NAME, resolveTheme } from '../../ui/theme.js';
|
|
7
8
|
import { sessionActionSuggestions, sessionSuggestions } from './sessionPicker.js';
|
|
8
9
|
/**
|
|
9
10
|
* Wizard flow table (CR-006 successor): the single source of truth for every
|
|
@@ -324,6 +325,23 @@ export function skillsActionSuggestions(settings, skills, selectedSkillName) {
|
|
|
324
325
|
result.push({ value: SKILL_ACTIONS.removeSkill, description: 'delete this skill directory', kind: 'skill' });
|
|
325
326
|
return result;
|
|
326
327
|
}
|
|
328
|
+
/** Perceptual-luminance check on a `#rrggbb` background so the theme picker can label light vs dark palettes. */
|
|
329
|
+
function isLightBackground(hex) {
|
|
330
|
+
const channels = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex);
|
|
331
|
+
if (!channels)
|
|
332
|
+
return false;
|
|
333
|
+
const [, r = '0', g = '0', b = '0'] = channels;
|
|
334
|
+
return (0.2126 * parseInt(r, 16) + 0.7152 * parseInt(g, 16) + 0.0722 * parseInt(b, 16)) / 255 > 0.5;
|
|
335
|
+
}
|
|
336
|
+
/** Every built-in theme with its palette brightness and the active one marked (`resolveTheme` validates names). */
|
|
337
|
+
export function themeSuggestions(settings) {
|
|
338
|
+
const active = settings.theme ?? DEFAULT_THEME_NAME;
|
|
339
|
+
return Object.keys(BUILT_IN_THEME_SPECS).map(name => ({
|
|
340
|
+
value: name,
|
|
341
|
+
description: `${isLightBackground(resolveTheme(name).background) ? 'light' : 'dark'} palette${name === active ? ' · active' : ''}`,
|
|
342
|
+
kind: 'theme',
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
327
345
|
export const WIZARD_STEPS = [
|
|
328
346
|
// Sessions
|
|
329
347
|
{ id: 'sessions', kind: 'pick', placeholder: 'Choose a saved session', suggestions: (s) => sessionSuggestions(s.sessions ?? []) },
|
|
@@ -368,6 +386,8 @@ export const WIZARD_STEPS = [
|
|
|
368
386
|
{ id: 'mcpAddKey', kind: 'masked-input', placeholder: 'API key, or blank to skip', optional: true, suggestions: () => [] },
|
|
369
387
|
{ id: 'mcpSetKey', kind: 'masked-input', placeholder: 'API key', suggestions: () => [] },
|
|
370
388
|
{ id: 'mcpConfirmRemove', kind: 'confirm', placeholder: 'Type "yes" to confirm', suggestions: () => [] },
|
|
389
|
+
// Themes
|
|
390
|
+
{ id: 'themes', kind: 'pick', placeholder: 'Choose a theme', suggestions: (s) => themeSuggestions(s.settings) },
|
|
371
391
|
];
|
|
372
392
|
const WIZARD_STEP_BY_ID = Object.fromEntries(WIZARD_STEPS.map(step => [step.id, step]));
|
|
373
393
|
/** Suggestions for a wizard mode, or undefined when the mode is not a wizard step ('chat'). */
|
package/dist/cli/index.js
CHANGED
|
@@ -24,7 +24,8 @@ program
|
|
|
24
24
|
.option('-p, --prompt <text>', 'print mode: run a single non-interactive turn and print the result (falls back to piped stdin)')
|
|
25
25
|
.option('-m, --model <selector>', 'override the model for this run only — a registered model name or provider:name')
|
|
26
26
|
.addOption(new Option('--output <format>', 'print-mode output: plain text, a single JSON result envelope, or a stream-json NDJSON event stream').choices(['text', 'json', 'stream-json']).default('text'))
|
|
27
|
-
.option('--timeout <duration>', 'print-mode absolute turn deadline (e.g. 30s, 10m, 2h); bounds total elapsed time so a busy tool cannot run indefinitely')
|
|
27
|
+
.option('--timeout <duration>', 'print-mode absolute turn deadline (e.g. 30s, 10m, 2h); bounds total elapsed time so a busy tool cannot run indefinitely')
|
|
28
|
+
.option('--until-done', 'print mode: relaunch the goal after transient model failures (with backoff) until it structurally completes, the --timeout deadline hits, or repeated relaunches make no progress');
|
|
28
29
|
program.addHelpText('after', `
|
|
29
30
|
Examples:
|
|
30
31
|
$ haze start the interactive chat
|
|
@@ -120,6 +121,7 @@ program.action(async () => {
|
|
|
120
121
|
output: opts.output === 'json' || opts.output === 'stream-json' ? opts.output : 'text',
|
|
121
122
|
debug: Boolean(opts.debug),
|
|
122
123
|
timeout: opts.timeout,
|
|
124
|
+
untilDone: Boolean(opts.untilDone),
|
|
123
125
|
});
|
|
124
126
|
// Set the exit code and return instead of process.exit(code): the latter does not wait
|
|
125
127
|
// for stdout to drain and can truncate piped/redirected output (e.g. `haze -p ... | jq`).
|
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
* Hosted presets carry a pre-configured base URL so users only need to supply an API key
|
|
7
7
|
* and model names. Local/keyless providers have sensible localhost defaults.
|
|
8
8
|
*
|
|
9
|
+
* Presets are authored in a compact definition form (`ProviderPresetDefinition`) and
|
|
10
|
+
* expanded once into the public `ProviderPreset` records: each curated model is a single
|
|
11
|
+
* `[id, contextWindowTokens, maxOutputTokens]` tuple instead of appearing twice (once in
|
|
12
|
+
* `suggestedModels`, once in `modelLimits`), and `needsApiKey` is derived from the
|
|
13
|
+
* category (cloud presets need a key unless they carry an explicit OAuth flow; local
|
|
14
|
+
* ones never do).
|
|
15
|
+
*
|
|
9
16
|
* `modelLimits` values are curated from models.dev (the same catalog pi and nanocoder
|
|
10
17
|
* consume; refreshed 2026-08-15). They are keyed by the exact suggested model id for
|
|
11
18
|
* THIS preset: aggregators may cap context below the origin model's capability (e.g.
|