@denizokcu/haze 1.1.0 → 1.2.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.
Files changed (149) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +17 -10
  3. package/SECURITY.md +1 -1
  4. package/dist/buildInfo.json +3 -3
  5. package/dist/cli/chat/busyIndicator.d.ts +11 -0
  6. package/dist/cli/chat/busyIndicator.js +34 -0
  7. package/dist/cli/chat/chatMetrics.d.ts +0 -1
  8. package/dist/cli/chat/chatMetrics.js +1 -7
  9. package/dist/cli/chat/followUpQueue.d.ts +11 -0
  10. package/dist/cli/chat/followUpQueue.js +38 -0
  11. package/dist/cli/chat/messages.d.ts +0 -22
  12. package/dist/cli/chat/messages.js +40 -85
  13. package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
  14. package/dist/cli/chat/sessionLifecycle.js +8 -1
  15. package/dist/cli/chat/sessionRecorder.d.ts +9 -0
  16. package/dist/cli/chat/sessionRecorder.js +12 -0
  17. package/dist/cli/chat/startupSequence.d.ts +29 -0
  18. package/dist/cli/chat/startupSequence.js +59 -0
  19. package/dist/cli/chat/transcriptPartition.d.ts +23 -0
  20. package/dist/cli/chat/transcriptPartition.js +78 -0
  21. package/dist/cli/chat/wizard/fieldTransitions.d.ts +38 -0
  22. package/dist/cli/chat/wizard/fieldTransitions.js +43 -0
  23. package/dist/cli/chat/wizard/lspHandlers.d.ts +4 -0
  24. package/dist/cli/chat/wizard/lspHandlers.js +85 -0
  25. package/dist/cli/chat/wizard/mcpHandlers.d.ts +8 -0
  26. package/dist/cli/chat/wizard/mcpHandlers.js +82 -0
  27. package/dist/cli/chat/wizard/providerHandlers.d.ts +12 -0
  28. package/dist/cli/chat/wizard/providerHandlers.js +420 -0
  29. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +4 -0
  30. package/dist/cli/chat/wizard/sessionThemeHandlers.js +48 -0
  31. package/dist/cli/chat/wizard/skillsHandlers.d.ts +4 -0
  32. package/dist/cli/chat/wizard/skillsHandlers.js +125 -0
  33. package/dist/cli/chat/wizard/types.d.ts +63 -0
  34. package/dist/cli/chat/wizard/types.js +24 -0
  35. package/dist/cli/chat/wizard/uiState.d.ts +56 -0
  36. package/dist/cli/chat/wizard/uiState.js +15 -0
  37. package/dist/cli/chat/wizardDispatch.d.ts +11 -113
  38. package/dist/cli/chat/wizardDispatch.js +41 -815
  39. package/dist/cli/commands/chat.js +69 -110
  40. package/dist/cli/commands/formatters.d.ts +0 -3
  41. package/dist/cli/commands/formatters.js +0 -29
  42. package/dist/cli/commands/runCommand.d.ts +2 -0
  43. package/dist/cli/commands/runCommand.js +73 -4
  44. package/dist/cli/commands/streaming/agentAttempt.d.ts +11 -1
  45. package/dist/cli/commands/streaming/agentAttempt.js +9 -5
  46. package/dist/cli/commands/streaming/assistantSegments.d.ts +19 -0
  47. package/dist/cli/commands/streaming/assistantSegments.js +48 -0
  48. package/dist/cli/commands/streaming/attemptOutcome.d.ts +25 -5
  49. package/dist/cli/commands/streaming/attemptOutcome.js +69 -16
  50. package/dist/cli/commands/streaming/attemptSetup.d.ts +10 -3
  51. package/dist/cli/commands/streaming/attemptSetup.js +30 -13
  52. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +69 -8
  53. package/dist/cli/commands/streaming/goalCheckpoint.js +36 -1
  54. package/dist/cli/commands/streaming/goalSupervisor.d.ts +18 -3
  55. package/dist/cli/commands/streaming/goalSupervisor.js +71 -12
  56. package/dist/cli/commands/streaming/prepareStep.d.ts +40 -0
  57. package/dist/cli/commands/streaming/prepareStep.js +116 -0
  58. package/dist/cli/commands/streaming/recoverySlices.d.ts +15 -0
  59. package/dist/cli/commands/streaming/recoverySlices.js +29 -0
  60. package/dist/cli/commands/streaming/stallRecovery.d.ts +0 -1
  61. package/dist/cli/commands/streaming/stallRecovery.js +2 -6
  62. package/dist/cli/commands/streaming/streamLoop.d.ts +31 -4
  63. package/dist/cli/commands/streaming/streamLoop.js +283 -268
  64. package/dist/cli/commands/streaming/toolGroupRenderer.js +2 -1
  65. package/dist/cli/commands/streaming/toolPartHandlers.d.ts +19 -0
  66. package/dist/cli/commands/streaming/toolPartHandlers.js +108 -0
  67. package/dist/cli/commands/streaming/turnRuntime.d.ts +1 -1
  68. package/dist/cli/commands/streaming/turnRuntime.js +3 -2
  69. package/dist/cli/commands/streaming.d.ts +12 -1
  70. package/dist/cli/commands/streaming.js +20 -25
  71. package/dist/cli/index.js +6 -3
  72. package/dist/config/modelCatalog.d.ts +32 -0
  73. package/dist/config/modelCatalog.js +84 -0
  74. package/dist/config/providerPresets.d.ts +7 -0
  75. package/dist/config/providerPresets.js +195 -391
  76. package/dist/config/settings.d.ts +10 -2
  77. package/dist/config/settings.js +3 -0
  78. package/dist/core/agent/budgets.d.ts +10 -0
  79. package/dist/core/agent/budgets.js +10 -0
  80. package/dist/core/agent/compaction.d.ts +42 -3
  81. package/dist/core/agent/compaction.js +53 -5
  82. package/dist/core/agent/completionController.d.ts +16 -7
  83. package/dist/core/agent/completionController.js +13 -6
  84. package/dist/core/agent/contextBudget.d.ts +56 -0
  85. package/dist/core/agent/contextBudget.js +53 -0
  86. package/dist/core/agent/errors.js +2 -2
  87. package/dist/core/agent/events.d.ts +36 -1
  88. package/dist/core/agent/goalPolicy.d.ts +4 -3
  89. package/dist/core/agent/goalPolicy.js +9 -4
  90. package/dist/core/agent/overflow.d.ts +45 -0
  91. package/dist/core/agent/overflow.js +91 -0
  92. package/dist/core/agent/requestAssembly.d.ts +7 -0
  93. package/dist/core/agent/requestAssembly.js +15 -7
  94. package/dist/core/agent/workState.d.ts +25 -15
  95. package/dist/core/agent/workState.js +84 -44
  96. package/dist/core/safety/shellClassifier.d.ts +16 -0
  97. package/dist/core/safety/shellClassifier.js +31 -0
  98. package/dist/core/session/sessionSlimming.js +8 -0
  99. package/dist/core/session/sessionStore.d.ts +71 -1
  100. package/dist/core/session/sessionStore.js +121 -6
  101. package/dist/core/validation/outputParser.d.ts +1 -1
  102. package/dist/core/validation/outputParser.js +6 -1
  103. package/dist/llm/client.d.ts +2 -2
  104. package/dist/llm/client.js +14 -6
  105. package/dist/llm/hazeTools.d.ts +64 -208
  106. package/dist/llm/tools/shellTool.js +27 -8
  107. package/dist/llm/tools/taskTool.d.ts +64 -208
  108. package/dist/llm/tools/taskTool.js +22 -10
  109. package/dist/ui/components/TextInput.d.ts +18 -1
  110. package/dist/ui/components/TextInput.js +50 -73
  111. package/dist/ui/components/useInputSuggestions.d.ts +27 -0
  112. package/dist/ui/components/useInputSuggestions.js +98 -0
  113. package/dist/ui/theme.d.ts +8 -8
  114. package/dist/ui/theme.js +11 -12
  115. package/dist/ui/themes/registry.d.ts +5 -0
  116. package/dist/ui/themes/registry.js +436 -0
  117. package/dist/utils/format.d.ts +10 -0
  118. package/dist/utils/format.js +45 -0
  119. package/package.json +16 -15
  120. package/dist/ui/themes/af-magic.d.ts +0 -7
  121. package/dist/ui/themes/af-magic.js +0 -25
  122. package/dist/ui/themes/agnoster.d.ts +0 -10
  123. package/dist/ui/themes/agnoster.js +0 -40
  124. package/dist/ui/themes/bira.d.ts +0 -10
  125. package/dist/ui/themes/bira.js +0 -28
  126. package/dist/ui/themes/bureau.d.ts +0 -10
  127. package/dist/ui/themes/bureau.js +0 -28
  128. package/dist/ui/themes/clean.d.ts +0 -9
  129. package/dist/ui/themes/clean.js +0 -27
  130. package/dist/ui/themes/cloud.d.ts +0 -6
  131. package/dist/ui/themes/cloud.js +0 -24
  132. package/dist/ui/themes/dst.d.ts +0 -10
  133. package/dist/ui/themes/dst.js +0 -28
  134. package/dist/ui/themes/fishy.d.ts +0 -7
  135. package/dist/ui/themes/fishy.js +0 -25
  136. package/dist/ui/themes/index.d.ts +0 -8
  137. package/dist/ui/themes/index.js +0 -36
  138. package/dist/ui/themes/light.d.ts +0 -3
  139. package/dist/ui/themes/light.js +0 -21
  140. package/dist/ui/themes/purple.d.ts +0 -7
  141. package/dist/ui/themes/purple.js +0 -26
  142. package/dist/ui/themes/robbyrussell.d.ts +0 -8
  143. package/dist/ui/themes/robbyrussell.js +0 -26
  144. package/dist/ui/themes/solarized-dark.d.ts +0 -16
  145. package/dist/ui/themes/solarized-dark.js +0 -44
  146. package/dist/ui/themes/solarized-light.d.ts +0 -12
  147. package/dist/ui/themes/solarized-light.js +0 -40
  148. package/dist/ui/themes/steeef.d.ts +0 -11
  149. package/dist/ui/themes/steeef.js +0 -29
@@ -0,0 +1,24 @@
1
+ import { isYesConfirmation } from '../../commands/wizardFlow.js';
2
+ /**
3
+ * Generic typed-"yes" confirm-remove step shared by the LSP and MCP flows.
4
+ * Cancel and no-selection paths are identical; `remove` applies the domain
5
+ * settings mutation and returns the success message.
6
+ */
7
+ export function confirmRemoveStep(ctx, input) {
8
+ return async (value) => {
9
+ const name = input.selectedName();
10
+ if (!name) {
11
+ ctx.setMode('chat');
12
+ return;
13
+ }
14
+ if (!isYesConfirmation(value)) {
15
+ ctx.showMessage(input.cancelMessage);
16
+ input.clearSelection();
17
+ ctx.setMode('chat');
18
+ return;
19
+ }
20
+ ctx.showMessage(await input.remove(name));
21
+ input.clearSelection();
22
+ ctx.setMode('chat');
23
+ };
24
+ }
@@ -0,0 +1,56 @@
1
+ import type { HazeMcpServer, HazeProviderSettings } from '../../../config/settings.js';
2
+ import type { HazeLspServer } from '../../../config/lspSettings.js';
3
+ import type { SkillSource } from '../../../skills/types.js';
4
+ /**
5
+ * Wizard flow UI state: one reducer for selection, drafts, and model
6
+ * discovery. The wizard-related React state that used to live in twelve
7
+ * `useState` hooks in `chat.tsx`. Flat field names match the historical deps
8
+ * names so the dispatch body and its tests read the same way.
9
+ */
10
+ export interface WizardUiState {
11
+ selectedSessionId?: string;
12
+ modelProviderFilter?: string;
13
+ discoveredModels: string[];
14
+ suggestedModels: string[];
15
+ selectedProviderName?: string;
16
+ providerDraft: Partial<HazeProviderSettings>;
17
+ skillDraft: {
18
+ name?: string;
19
+ scope?: SkillSource;
20
+ };
21
+ selectedSkillName?: string;
22
+ selectedLspName?: string;
23
+ lspDraft: Partial<HazeLspServer>;
24
+ selectedMcpName?: string;
25
+ mcpDraft: Partial<HazeMcpServer>;
26
+ }
27
+ export type WizardUiAction = {
28
+ type: 'set';
29
+ key: 'selectedSessionId' | 'modelProviderFilter' | 'selectedProviderName' | 'selectedSkillName' | 'selectedLspName' | 'selectedMcpName';
30
+ value: string | undefined;
31
+ } | {
32
+ type: 'providerDraft';
33
+ value: Partial<HazeProviderSettings>;
34
+ } | {
35
+ type: 'skillDraft';
36
+ value: {
37
+ name?: string;
38
+ scope?: SkillSource;
39
+ };
40
+ } | {
41
+ type: 'lspDraft';
42
+ value: Partial<HazeLspServer>;
43
+ } | {
44
+ type: 'mcpDraft';
45
+ value: Partial<HazeMcpServer>;
46
+ } | {
47
+ type: 'discoveredModels';
48
+ value: string[];
49
+ } | {
50
+ type: 'suggestedModels';
51
+ value: string[];
52
+ } | {
53
+ type: 'reset';
54
+ };
55
+ export declare function initialWizardUiState(): WizardUiState;
56
+ export declare function wizardUiReducer(state: WizardUiState, action: WizardUiAction): WizardUiState;
@@ -0,0 +1,15 @@
1
+ export function initialWizardUiState() {
2
+ return { discoveredModels: [], suggestedModels: [], providerDraft: {}, skillDraft: {}, lspDraft: {}, mcpDraft: {} };
3
+ }
4
+ export function wizardUiReducer(state, action) {
5
+ switch (action.type) {
6
+ case 'set': return { ...state, [action.key]: action.value };
7
+ case 'providerDraft': return { ...state, providerDraft: action.value };
8
+ case 'skillDraft': return { ...state, skillDraft: action.value };
9
+ case 'lspDraft': return { ...state, lspDraft: action.value };
10
+ case 'mcpDraft': return { ...state, mcpDraft: action.value };
11
+ case 'discoveredModels': return { ...state, discoveredModels: action.value };
12
+ case 'suggestedModels': return { ...state, suggestedModels: action.value };
13
+ case 'reset': return initialWizardUiState();
14
+ }
15
+ }
@@ -1,119 +1,18 @@
1
- import type { HazeMcpServer, HazeProviderSettings, HazeSettings } from '../../config/settings.js';
2
- import type { HazeLspServer } from '../../config/lspSettings.js';
3
- import type { LoadedSkill, SkillSource } from '../../skills/types.js';
4
- import type { SessionSummary } from '../../core/session/sessionStore.js';
1
+ import type { HazeMcpServer, HazeProviderSettings } from '../../config/settings.js';
5
2
  import type { Mode } from '../commands/chatModes.js';
3
+ import type { WizardDispatchDeps } from './wizard/types.js';
4
+ export type { WizardDispatchDeps } from './wizard/types.js';
5
+ export { initialWizardUiState, wizardUiReducer, type WizardUiAction, type WizardUiState } from './wizard/uiState.js';
6
+ export { transitionMcpField, transitionProviderField, type McpWizardEffect, type ProviderWizardEffect } from './wizard/fieldTransitions.js';
6
7
  /**
7
8
  * Wizard submit engine (CR-006): one table-driven entry point for every
8
- * picker/wizard mode. Handlers call the pure `*Wizard.ts` result functions and
9
- * apply the shared settingsPatch/mode/message shape; field-capture steps run
10
- * through the pure transition functions below, so `chat.tsx` stays
11
- * orchestration glue instead of a 150-line if-chain.
9
+ * picker/wizard mode. The mode-specific handler families live in
10
+ * `wizard/` (provider/model, skills, LSP, MCP, session/theme); each calls the
11
+ * pure `*Wizard.ts` result functions and applies the shared
12
+ * settingsPatch/mode/message shape, while field-capture steps run through the
13
+ * pure transition functions in `wizard/fieldTransitions.ts`, so `chat.tsx`
14
+ * stays orchestration glue instead of a 150-line if-chain.
12
15
  */
13
- type SharedWizardEffect = {
14
- type: 'message';
15
- text?: string;
16
- } | {
17
- type: 'mode';
18
- mode: Mode;
19
- };
20
- export type ProviderWizardEffect = SharedWizardEffect | {
21
- type: 'provider-draft';
22
- patch: Partial<HazeProviderSettings>;
23
- replace?: boolean;
24
- } | {
25
- type: 'discover-provider-models';
26
- draft: Partial<HazeProviderSettings>;
27
- };
28
- export type McpWizardEffect = SharedWizardEffect | {
29
- type: 'mcp-draft';
30
- patch: Partial<HazeMcpServer>;
31
- } | {
32
- type: 'finish-mcp-stdio';
33
- draft: Partial<HazeMcpServer>;
34
- };
35
- export declare function transitionProviderField(input: {
36
- mode: Mode;
37
- value: string;
38
- settings: HazeSettings;
39
- draft: Partial<HazeProviderSettings>;
40
- }): ProviderWizardEffect[] | undefined;
41
- export declare function transitionMcpField(input: {
42
- mode: Mode;
43
- value: string;
44
- settings: HazeSettings;
45
- draft: Partial<HazeMcpServer>;
46
- }): McpWizardEffect[] | undefined;
47
- /**
48
- * The wizard-related React state that used to live in twelve `useState`
49
- * hooks in `chat.tsx`. Flat field names match the historical deps names so
50
- * the dispatch body and its tests read the same way.
51
- */
52
- export interface WizardUiState {
53
- selectedSessionId?: string;
54
- modelProviderFilter?: string;
55
- discoveredModels: string[];
56
- suggestedModels: string[];
57
- selectedProviderName?: string;
58
- providerDraft: Partial<HazeProviderSettings>;
59
- skillDraft: {
60
- name?: string;
61
- scope?: SkillSource;
62
- };
63
- selectedSkillName?: string;
64
- selectedLspName?: string;
65
- lspDraft: Partial<HazeLspServer>;
66
- selectedMcpName?: string;
67
- mcpDraft: Partial<HazeMcpServer>;
68
- }
69
- export type WizardUiAction = {
70
- type: 'set';
71
- key: 'selectedSessionId' | 'modelProviderFilter' | 'selectedProviderName' | 'selectedSkillName' | 'selectedLspName' | 'selectedMcpName';
72
- value: string | undefined;
73
- } | {
74
- type: 'providerDraft';
75
- value: Partial<HazeProviderSettings>;
76
- } | {
77
- type: 'skillDraft';
78
- value: {
79
- name?: string;
80
- scope?: SkillSource;
81
- };
82
- } | {
83
- type: 'lspDraft';
84
- value: Partial<HazeLspServer>;
85
- } | {
86
- type: 'mcpDraft';
87
- value: Partial<HazeMcpServer>;
88
- } | {
89
- type: 'discoveredModels';
90
- value: string[];
91
- } | {
92
- type: 'suggestedModels';
93
- value: string[];
94
- } | {
95
- type: 'reset';
96
- };
97
- export declare function initialWizardUiState(): WizardUiState;
98
- export declare function wizardUiReducer(state: WizardUiState, action: WizardUiAction): WizardUiState;
99
- export interface WizardDispatchDeps {
100
- settings: HazeSettings;
101
- skills: LoadedSkill[];
102
- sessions?: SessionSummary[];
103
- /** Wizard flow UI state (selection, drafts, model discovery). */
104
- wizard: WizardUiState;
105
- updateWizard: (action: WizardUiAction) => void;
106
- setMode: (mode: Mode) => void;
107
- setSettings: (next: HazeSettings) => void;
108
- showMessage: (message: string | undefined) => void;
109
- resumeSessionById?: (id: string) => Promise<boolean>;
110
- forkSessionById?: (id: string) => Promise<boolean>;
111
- refreshSkills: () => Promise<unknown>;
112
- setBusyLabel: (label: string) => void;
113
- setBusy: (busy: boolean) => void;
114
- /** Busy label to restore when a skill creation finishes. */
115
- idleBusyLabel: string;
116
- }
117
16
  export interface WizardDispatch {
118
17
  /** Handle the value for wizard/picker modes; returns false for non-wizard modes. */
119
18
  dispatch: (mode: Mode, value: string) => Promise<boolean>;
@@ -123,4 +22,3 @@ export interface WizardDispatch {
123
22
  discoverProviderModelsForDraft: (draft: Partial<HazeProviderSettings>) => Promise<void>;
124
23
  }
125
24
  export declare function createWizardDispatch(deps: WizardDispatchDeps): WizardDispatch;
126
- export {};