@denizokcu/haze 1.7.12 → 1.8.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 +38 -0
- package/README.md +30 -6
- package/SECURITY.md +1 -1
- package/bin/haze.js +47 -19
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/BusyBar.d.ts +1 -2
- package/dist/cli/chat/ChatHeader.d.ts +6 -0
- package/dist/cli/chat/ChatHeader.js +11 -0
- package/dist/cli/chat/ChatScreen.d.ts +16 -0
- package/dist/cli/chat/ChatScreen.js +399 -0
- package/dist/cli/chat/ChatScreenView.d.ts +68 -0
- package/dist/cli/chat/ChatScreenView.js +47 -0
- package/dist/cli/chat/LiveTail.d.ts +11 -0
- package/dist/cli/chat/LiveTail.js +26 -0
- package/dist/cli/chat/TaskBar.d.ts +3 -2
- package/dist/cli/chat/TaskBar.js +4 -0
- package/dist/cli/chat/agentTurnRunner.d.ts +12 -0
- package/dist/cli/chat/agentTurnRunner.js +177 -0
- package/dist/cli/chat/busyIndicator.js +9 -5
- package/dist/cli/chat/chatMetrics.d.ts +7 -0
- package/dist/cli/chat/chatMetrics.js +15 -1
- package/dist/cli/chat/chatViewModel.d.ts +85 -0
- package/dist/cli/chat/chatViewModel.js +66 -0
- package/dist/cli/chat/fileMentionSuggestions.d.ts +0 -14
- package/dist/cli/chat/fileMentionSuggestions.js +4 -21
- package/dist/cli/chat/liveTheme.d.ts +11 -0
- package/dist/cli/chat/liveTheme.js +26 -0
- package/dist/cli/chat/messageFinalize.d.ts +4 -0
- package/dist/cli/chat/messageFinalize.js +8 -0
- package/dist/cli/chat/messages.js +1 -1
- package/dist/cli/chat/pickerOpeners.d.ts +23 -0
- package/dist/cli/chat/pickerOpeners.js +36 -0
- package/dist/cli/chat/promptSessionState.d.ts +11 -0
- package/dist/cli/chat/promptSessionState.js +39 -0
- package/dist/cli/chat/renderMetrics.d.ts +8 -0
- package/dist/cli/chat/renderMetrics.js +14 -0
- package/dist/cli/chat/resizeGuard.d.ts +11 -0
- package/dist/cli/chat/resizeGuard.js +25 -0
- package/dist/cli/chat/screenDeps.d.ts +116 -0
- package/dist/cli/chat/screenDeps.js +1 -0
- package/dist/cli/chat/sessionLifecycle.d.ts +2 -0
- package/dist/cli/chat/sessionLifecycle.js +4 -1
- package/dist/cli/chat/settingsSelection.d.ts +33 -0
- package/dist/cli/chat/settingsSelection.js +46 -0
- package/dist/cli/chat/skillNotices.d.ts +18 -0
- package/dist/cli/chat/skillNotices.js +26 -0
- package/dist/cli/chat/startupInfo.js +1 -1
- package/dist/cli/chat/submitPipeline.d.ts +8 -0
- package/dist/cli/chat/submitPipeline.js +141 -0
- package/dist/cli/chat/terminalControl.js +1 -1
- package/dist/cli/chat/toolSummaries.d.ts +29 -0
- package/dist/cli/chat/toolSummaries.js +268 -0
- package/dist/cli/chat/turnState.d.ts +8 -0
- package/dist/cli/chat/turnState.js +1 -0
- package/dist/cli/chat/userCommandFlow.d.ts +21 -0
- package/dist/cli/chat/userCommandFlow.js +66 -0
- package/dist/cli/chat/userCommandRunner.d.ts +14 -0
- package/dist/cli/chat/userCommandRunner.js +56 -0
- package/dist/cli/chat/wizard/providerHandlers.js +19 -2
- package/dist/cli/chat/wizardTrail.d.ts +22 -0
- package/dist/cli/chat/wizardTrail.js +55 -0
- package/dist/cli/commands/chat.d.ts +1 -13
- package/dist/cli/commands/chat.js +10 -798
- package/dist/cli/commands/commandHelp.js +7 -5
- package/dist/cli/commands/commandSuggest.d.ts +2 -0
- package/dist/cli/commands/commandSuggest.js +35 -0
- package/dist/cli/commands/commands.js +10 -3
- package/dist/cli/commands/formatters.d.ts +1 -23
- package/dist/cli/commands/formatters.js +3 -252
- package/dist/cli/commands/modelCommand.js +11 -7
- package/dist/cli/commands/reasoningCommand.js +3 -3
- package/dist/cli/commands/runCommand.js +6 -2
- package/dist/cli/commands/streaming/attemptLifecycle.js +1 -0
- package/dist/cli/commands/streaming/attemptOutcome.js +7 -2
- package/dist/cli/commands/streaming/attemptSetup.d.ts +1 -0
- package/dist/cli/commands/streaming/attemptSetup.js +26 -2
- package/dist/cli/commands/streaming/goalCheckpoint.d.ts +1 -1
- package/dist/cli/commands/streaming/stepProjection.d.ts +59 -0
- package/dist/cli/commands/streaming/stepProjection.js +54 -0
- package/dist/cli/commands/streaming/streamLoop.js +31 -23
- package/dist/cli/commands/streaming/toolGroupRenderer.js +1 -1
- package/dist/cli/commands/streaming/toolPartHandlers.js +1 -1
- package/dist/cli/commands/streaming.d.ts +3 -1
- package/dist/cli/commands/wizardFlow.d.ts +2 -0
- package/dist/cli/commands/wizardFlow.js +3 -0
- package/dist/cli/index.js +8 -4
- package/dist/cli/terminalTitle.js +9 -3
- package/dist/config/contextFiles.d.ts +2 -5
- package/dist/config/contextFiles.js +1 -1
- package/dist/config/inputHistory.js +2 -2
- package/dist/config/providerAuth.js +2 -2
- package/dist/config/providerModelFacts.js +5 -0
- package/dist/config/providerPresets.js +1 -1
- package/dist/config/settings.d.ts +7 -0
- package/dist/config/settings.js +9 -2
- package/dist/config/updateCheck.js +2 -2
- package/dist/core/agent/completionController.d.ts +1 -1
- package/dist/core/agent/contextBudget.d.ts +1 -1
- package/dist/core/agent/goalPolicy.js +8 -2
- package/dist/core/agent/overflow.js +5 -0
- package/dist/core/agent/toolCapabilities.js +14 -0
- package/dist/core/agent/userCommands.d.ts +53 -0
- package/dist/core/agent/userCommands.js +116 -0
- package/dist/core/agent/workState.d.ts +3 -1
- package/dist/core/agent/workState.js +57 -26
- package/dist/core/contextFileTypes.d.ts +12 -0
- package/dist/core/contextFileTypes.js +1 -0
- package/dist/core/graph/buildGraph.js +1 -1
- package/dist/core/graph/store.js +1 -1
- package/dist/core/limits.d.ts +2 -0
- package/dist/core/limits.js +2 -0
- package/dist/core/log/llmLog.js +2 -2
- package/dist/{config → core/persistence}/privateStorage.js +1 -1
- package/dist/core/process/runBoundedProcess.d.ts +7 -4
- package/dist/core/process/runBoundedProcess.js +10 -5
- package/dist/core/safety/redaction.d.ts +2 -0
- package/dist/core/safety/redaction.js +26 -5
- package/dist/core/safety/secretPaths.js +12 -3
- package/dist/core/safety/urlGuard.js +2 -0
- package/dist/core/session/sessionStore.d.ts +8 -1
- package/dist/core/session/sessionStore.js +15 -4
- package/dist/core/shellOutput/reducers/validation.d.ts +1 -1
- package/dist/core/shellOutput/types.d.ts +1 -1
- package/dist/{llm → core}/toolResultTypes.d.ts +1 -1
- package/dist/core/validation/outputParser.d.ts +1 -1
- package/dist/llm/hazeTools.js +2 -0
- package/dist/llm/lsp/pool.js +1 -1
- package/dist/llm/lsp/workspaceEdit.d.ts +1 -1
- package/dist/llm/requestContext.d.ts +3 -0
- package/dist/llm/requestContext.js +20 -8
- package/dist/llm/systemPrompt.js +10 -3
- package/dist/llm/toolGroups.d.ts +534 -0
- package/dist/llm/toolGroups.js +57 -0
- package/dist/llm/tools/editMatch.d.ts +1 -1
- package/dist/llm/tools/failures.d.ts +1 -1
- package/dist/llm/tools/fileToolShared.d.ts +1 -1
- package/dist/llm/tools/fileToolShared.js +1 -1
- package/dist/llm/tools/fileTools.js +1 -1
- package/dist/llm/tools/gitTools.d.ts +12 -0
- package/dist/llm/tools/gitTools.js +527 -0
- package/dist/llm/tools/readRecovery.d.ts +1 -1
- package/dist/llm/tools/replaceInFiles.d.ts +1 -1
- package/dist/llm/tools/replaceInFiles.js +1 -1
- package/dist/llm/tools/taskTool.js +4 -1
- package/dist/llm/tools/toolContext.js +5 -2
- package/dist/llm/tools/toolContextState.d.ts +1 -1
- package/dist/llm/tools/workspaceFile.d.ts +2 -2
- package/dist/llm/tools/workspaceFile.js +10 -5
- package/dist/skills/SkillRegistry.js +1 -1
- package/dist/skills/builder/SkillBuilder.js +1 -1
- package/dist/skills/plugins/installer.js +1 -1
- package/dist/skills/plugins/runtime.js +1 -1
- package/dist/ui/components/MarkdownText.d.ts +14 -0
- package/dist/ui/components/MarkdownText.js +77 -12
- package/dist/ui/components/NativeIndicators.js +5 -1
- package/dist/ui/components/StreamingMarkdownText.d.ts +3 -1
- package/dist/ui/components/StreamingMarkdownText.js +39 -11
- package/dist/ui/components/TextInput.d.ts +1 -2
- package/dist/ui/components/TextInput.js +79 -9
- package/dist/ui/components/WizardChoices.d.ts +1 -2
- package/dist/ui/components/useInputSuggestions.d.ts +1 -1
- package/dist/ui/components/useInputSuggestions.js +1 -1
- package/dist/ui/mentionDetection.d.ts +20 -0
- package/dist/ui/mentionDetection.js +24 -0
- package/dist/ui/terminalColors.d.ts +4 -4
- package/dist/ui/terminalColors.js +23 -6
- package/dist/ui/terminalSanitize.js +8 -3
- package/dist/ui/textGeometry.d.ts +2 -0
- package/dist/ui/textGeometry.js +6 -0
- package/dist/ui/themes/registry.js +33 -33
- package/dist/utils/openPath.js +7 -0
- package/package.json +13 -13
- /package/dist/{llm/tools → core/ignore}/gitIgnore.d.ts +0 -0
- /package/dist/{llm/tools → core/ignore}/gitIgnore.js +0 -0
- /package/dist/{config → core}/paths.d.ts +0 -0
- /package/dist/{config → core}/paths.js +0 -0
- /package/dist/{config → core/persistence}/privateStorage.d.ts +0 -0
- /package/dist/{llm → core}/toolResultTypes.js +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type RenderMetrics = {
|
|
2
|
+
at: number;
|
|
3
|
+
renderTime: number;
|
|
4
|
+
};
|
|
5
|
+
export type RenderMetricsReader = () => RenderMetrics | undefined;
|
|
6
|
+
export declare function setRenderMetricsReader(reader: RenderMetricsReader): void;
|
|
7
|
+
export declare function clearRenderMetricsReader(): void;
|
|
8
|
+
export declare function readRenderMetrics(): RenderMetrics | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Module-level on purpose: the Ink render options live outside React, and the
|
|
2
|
+
// debug panel reads the latest value through a getter so it never enters state
|
|
3
|
+
// (no extra re-renders). `commands/chat.tsx` installs the reader and clears it
|
|
4
|
+
// when the terminal session restores; `ChatScreen` consumes it.
|
|
5
|
+
let renderMetricsReader;
|
|
6
|
+
export function setRenderMetricsReader(reader) {
|
|
7
|
+
renderMetricsReader = reader;
|
|
8
|
+
}
|
|
9
|
+
export function clearRenderMetricsReader() {
|
|
10
|
+
renderMetricsReader = undefined;
|
|
11
|
+
}
|
|
12
|
+
export function readRenderMetrics() {
|
|
13
|
+
return renderMetricsReader?.();
|
|
14
|
+
}
|
|
@@ -18,3 +18,14 @@ export interface ResizeGuardStream {
|
|
|
18
18
|
* of the transcript there.
|
|
19
19
|
*/
|
|
20
20
|
export declare function installViewportResizeGuard(stream?: ResizeGuardStream): () => void;
|
|
21
|
+
/** Width replays wait this long for a drag-resize to settle (FE-04). */
|
|
22
|
+
export declare const RESIZE_SETTLE_MS = 120;
|
|
23
|
+
/**
|
|
24
|
+
* Coalesce a burst of width changes into one `<Static>` replay. The viewport
|
|
25
|
+
* still clears on every change (the guard above); only the replay, which
|
|
26
|
+
* re-parses the whole settled transcript, waits for the resize to settle.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createResizeSettler(apply: (columns: number) => void, delayMs?: number): {
|
|
29
|
+
next: (columns: number) => void;
|
|
30
|
+
cancel: () => void;
|
|
31
|
+
};
|
|
@@ -23,3 +23,28 @@ export function installViewportResizeGuard(stream = process.stdout) {
|
|
|
23
23
|
stream.on('resize', onResize);
|
|
24
24
|
return () => { stream.off('resize', onResize); };
|
|
25
25
|
}
|
|
26
|
+
/** Width replays wait this long for a drag-resize to settle (FE-04). */
|
|
27
|
+
export const RESIZE_SETTLE_MS = 120;
|
|
28
|
+
/**
|
|
29
|
+
* Coalesce a burst of width changes into one `<Static>` replay. The viewport
|
|
30
|
+
* still clears on every change (the guard above); only the replay, which
|
|
31
|
+
* re-parses the whole settled transcript, waits for the resize to settle.
|
|
32
|
+
*/
|
|
33
|
+
export function createResizeSettler(apply, delayMs = RESIZE_SETTLE_MS) {
|
|
34
|
+
let timer;
|
|
35
|
+
const cancel = () => {
|
|
36
|
+
if (timer !== undefined)
|
|
37
|
+
clearTimeout(timer);
|
|
38
|
+
timer = undefined;
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
next(columns) {
|
|
42
|
+
cancel();
|
|
43
|
+
timer = setTimeout(() => {
|
|
44
|
+
timer = undefined;
|
|
45
|
+
apply(columns);
|
|
46
|
+
}, delayMs);
|
|
47
|
+
},
|
|
48
|
+
cancel,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ModelMessage } from 'ai';
|
|
3
|
+
import type { ContextFile } from '../../config/contextFiles.js';
|
|
4
|
+
import type { HazeSettings } from '../../config/settings.js';
|
|
5
|
+
import type { HazeSession } from '../../core/session/sessionStore.js';
|
|
6
|
+
import type { WorkState } from '../../core/agent/workState.js';
|
|
7
|
+
import type { LlmLog } from '../../core/log/llmLog.js';
|
|
8
|
+
import type { Task } from '../../core/tasks/taskStorage.js';
|
|
9
|
+
import type { PromptSession } from '../../llm/systemPrompt.js';
|
|
10
|
+
import type { Message, TurnExecutionOptions } from '../commands/streaming.js';
|
|
11
|
+
import type { GoalCheckpoint } from '../commands/streaming/goalCheckpoint.js';
|
|
12
|
+
import type { Mode } from '../commands/chatModes.js';
|
|
13
|
+
import type { SessionRecorder } from './sessionRecorder.js';
|
|
14
|
+
import type { useFollowUpQueue } from './followUpQueue.js';
|
|
15
|
+
import type { useBusyIndicator } from './busyIndicator.js';
|
|
16
|
+
import type { createWizardDispatch } from './wizardDispatch.js';
|
|
17
|
+
import type { createSessionLifecycle } from './sessionLifecycle.js';
|
|
18
|
+
import type { useTerminalControl } from './terminalControl.js';
|
|
19
|
+
/** A genuinely paused goal and what a one-key R resume needs (SU-04). */
|
|
20
|
+
export type PausedResume = {
|
|
21
|
+
kind: 'model-stream-idle' | 'incomplete-goal';
|
|
22
|
+
request: string;
|
|
23
|
+
retryAttempt: number;
|
|
24
|
+
checkpoint?: GoalCheckpoint;
|
|
25
|
+
pauseReason?: 'no-progress' | 'goal-deadline' | 'context-exhausted';
|
|
26
|
+
};
|
|
27
|
+
/** Explicit resume of a paused goal passed into a single agent turn. */
|
|
28
|
+
export type ResumeExisting = {
|
|
29
|
+
kind: 'model-stream-idle';
|
|
30
|
+
retryAttempt: number;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'incomplete-goal';
|
|
33
|
+
checkpoint: GoalCheckpoint;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The explicit dependency bundle the extracted ChatScreen function bodies
|
|
37
|
+
* (`submitPipeline`, `agentTurnRunner`, `messageFinalize`) receive instead of
|
|
38
|
+
* closing over component scope. Assembled once per render in `chat/ChatScreen.tsx`;
|
|
39
|
+
* refs are shared objects, so call-time reads always see fresh values.
|
|
40
|
+
*/
|
|
41
|
+
export interface ChatScreenDeps {
|
|
42
|
+
stoppingRef: React.RefObject<boolean>;
|
|
43
|
+
sealedRef: React.RefObject<boolean>;
|
|
44
|
+
quarantineRef: React.RefObject<(() => void) | undefined>;
|
|
45
|
+
activeGoalRef: React.RefObject<Promise<unknown> | undefined>;
|
|
46
|
+
conversationRef: React.RefObject<ModelMessage[]>;
|
|
47
|
+
settingsRef: React.RefObject<HazeSettings>;
|
|
48
|
+
sessionRef: React.RefObject<HazeSession | undefined>;
|
|
49
|
+
sessionRecorderRef: React.RefObject<SessionRecorder | undefined>;
|
|
50
|
+
sessionStartRef: React.RefObject<Date>;
|
|
51
|
+
workStateRef: React.RefObject<WorkState | undefined>;
|
|
52
|
+
lastAssistantTextRef: React.RefObject<string>;
|
|
53
|
+
abortControllerRef: React.RefObject<AbortController | null>;
|
|
54
|
+
llmLogRef: React.RefObject<LlmLog | undefined>;
|
|
55
|
+
contextFileSignaturesRef: React.RefObject<Map<string, string>>;
|
|
56
|
+
settings: HazeSettings;
|
|
57
|
+
settingsError: string | undefined;
|
|
58
|
+
contextFiles: ContextFile[];
|
|
59
|
+
mode: Mode;
|
|
60
|
+
busy: boolean;
|
|
61
|
+
pausedResume: PausedResume | undefined;
|
|
62
|
+
visibleTasks: Task[];
|
|
63
|
+
setMessages: (updater: React.SetStateAction<Message[]>) => void;
|
|
64
|
+
setSettings: (next: HazeSettings, patch?: HazeSettings) => void;
|
|
65
|
+
setSettingsError: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
66
|
+
setMode: React.Dispatch<React.SetStateAction<Mode>>;
|
|
67
|
+
setContextFiles: React.Dispatch<React.SetStateAction<ContextFile[]>>;
|
|
68
|
+
setBusy: ReturnType<typeof useBusyIndicator>['setBusy'];
|
|
69
|
+
setBusyLabel: React.Dispatch<React.SetStateAction<string>>;
|
|
70
|
+
setTokenUsage: React.Dispatch<React.SetStateAction<import('../commands/streaming/turnRuntime.js').TokenUsage>>;
|
|
71
|
+
/** Optional so lifecycle-only harnesses need not wire it; the screen always provides it. */
|
|
72
|
+
setContextUsage?: React.Dispatch<React.SetStateAction<import('./turnState.js').ContextUsage>>;
|
|
73
|
+
setFleet: React.Dispatch<React.SetStateAction<import('./chatMetrics.js').FleetStatus | undefined>>;
|
|
74
|
+
setVisibleTasks: React.Dispatch<React.SetStateAction<Task[]>>;
|
|
75
|
+
setTaskBarPadding: React.Dispatch<React.SetStateAction<number>>;
|
|
76
|
+
setTasksExpanded: React.Dispatch<React.SetStateAction<boolean>>;
|
|
77
|
+
setPausedResume: React.Dispatch<React.SetStateAction<PausedResume | undefined>>;
|
|
78
|
+
setDebugLogs: React.Dispatch<React.SetStateAction<string[]>>;
|
|
79
|
+
updateWizard: Parameters<typeof createWizardDispatch>[0]['updateWizard'];
|
|
80
|
+
currentModelSelection: () => {
|
|
81
|
+
provider: string;
|
|
82
|
+
model: string;
|
|
83
|
+
endpointFingerprint?: string;
|
|
84
|
+
} | undefined;
|
|
85
|
+
currentPromptSession: () => PromptSession;
|
|
86
|
+
withDisplayOrder: (message: Message) => Message;
|
|
87
|
+
finalizeMessage: (message: Message) => void;
|
|
88
|
+
addStreaming: (message: Message) => void;
|
|
89
|
+
patchLiveMessage: (id: string, update: Partial<Message>) => Message | undefined;
|
|
90
|
+
drainLiveMessages: () => void;
|
|
91
|
+
clearLiveMessages: () => void;
|
|
92
|
+
debugLog: (line: string) => void;
|
|
93
|
+
showPersistenceWarning: (error: unknown) => void;
|
|
94
|
+
skillInvocation: (value: string) => {
|
|
95
|
+
skill: import('../../skills/types.js').LoadedSkill;
|
|
96
|
+
args: string;
|
|
97
|
+
} | undefined;
|
|
98
|
+
prepareUserInput: (value: string) => Promise<{
|
|
99
|
+
value: string;
|
|
100
|
+
displayValue?: string;
|
|
101
|
+
options: TurnExecutionOptions;
|
|
102
|
+
} | undefined>;
|
|
103
|
+
doAgentTurn: (value: string, displayValue?: string, turnOptions?: TurnExecutionOptions) => Promise<void>;
|
|
104
|
+
/** Run one user command (`! <command>`) and hand its output to the model. */
|
|
105
|
+
runUserCommand: (command: string) => Promise<void>;
|
|
106
|
+
openSessionPicker: () => Promise<void>;
|
|
107
|
+
openPluginPicker: () => Promise<void>;
|
|
108
|
+
refreshSkills: () => Promise<import('../../skills/types.js').LoadedSkill[]>;
|
|
109
|
+
setSessionReasoningOverride: (modelSelector: string, setting: import('../../core/agent/reasoningPolicy.js').StoredReasoningSetting | undefined) => void;
|
|
110
|
+
shutdown: () => Promise<void>;
|
|
111
|
+
followUps: ReturnType<typeof useFollowUpQueue>;
|
|
112
|
+
wizard: ReturnType<typeof createWizardDispatch>;
|
|
113
|
+
sessionLifecycle: ReturnType<typeof createSessionLifecycle>;
|
|
114
|
+
terminalControl: ReturnType<typeof useTerminalControl>;
|
|
115
|
+
noSession: boolean;
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,6 +7,7 @@ import { type LlmLog } from '../../core/log/llmLog.js';
|
|
|
7
7
|
import type { Message } from '../commands/streaming.js';
|
|
8
8
|
import type { TokenUsage } from '../commands/streaming/turnRuntime.js';
|
|
9
9
|
import type { SessionRecorder } from './sessionRecorder.js';
|
|
10
|
+
import { type ContextUsage } from './turnState.js';
|
|
10
11
|
/**
|
|
11
12
|
* Session lifecycle controller extracted from `chat.tsx` (CR-006): session
|
|
12
13
|
* init/continue/resume/new/clear/compact live here; the component keeps refs,
|
|
@@ -54,6 +55,7 @@ export interface SessionLifecycleDeps {
|
|
|
54
55
|
/** Drop the live tail (clear/new-session). */
|
|
55
56
|
clearLiveMessages: () => void;
|
|
56
57
|
setTokenUsage: (usage: TokenUsage) => void;
|
|
58
|
+
setContextUsage?: (usage: ContextUsage) => void;
|
|
57
59
|
/** Manual /compact mode: model-written summary (default) or heuristic excerpt. */
|
|
58
60
|
manualCompaction?: () => 'llm-summary' | 'heuristic';
|
|
59
61
|
/** Opt-in session-write secret redaction (HZ-9 `redactSessionSecrets` setting). */
|
|
@@ -10,7 +10,7 @@ import { auxiliaryRequestOptions } from '../../core/providerContracts.js';
|
|
|
10
10
|
import { createSession, findSession, forkSession, formatSession, latestSession, restoreSessionState } from '../../core/session/sessionStore.js';
|
|
11
11
|
import { createLog as createLlmLog, endLog as endLlmLog } from '../../core/log/llmLog.js';
|
|
12
12
|
import { displayMessagesFromConversation, estimateConversationTokens } from './chatMetrics.js';
|
|
13
|
-
import { EMPTY_TOKEN_USAGE } from './turnState.js';
|
|
13
|
+
import { EMPTY_CONTEXT_USAGE, EMPTY_TOKEN_USAGE } from './turnState.js';
|
|
14
14
|
/** Bounded wall-clock budget for one manual LLM compaction summary (SU-03). */
|
|
15
15
|
const COMPACT_SUMMARY_TIMEOUT_MS = 120_000;
|
|
16
16
|
import { teardownBackgroundProcesses } from '../../core/process/backgroundRegistry.js';
|
|
@@ -44,6 +44,7 @@ export function createSessionLifecycle(deps) {
|
|
|
44
44
|
if (selection)
|
|
45
45
|
deps.sessionRecorder()?.recordModelSelection(selection);
|
|
46
46
|
deps.setTokenUsage({ ...EMPTY_TOKEN_USAGE });
|
|
47
|
+
deps.setContextUsage?.({ ...EMPTY_CONTEXT_USAGE });
|
|
47
48
|
await startNewLog();
|
|
48
49
|
const status = `${message}\nSession: ${session.file}`;
|
|
49
50
|
deps.setMessages(messages => {
|
|
@@ -73,6 +74,7 @@ export function createSessionLifecycle(deps) {
|
|
|
73
74
|
deps.clearLiveMessages();
|
|
74
75
|
const restoredMessages = displayMessagesFromConversation(restoredConversation);
|
|
75
76
|
deps.setTokenUsage({ ...EMPTY_TOKEN_USAGE, messages: estimateConversationTokens(restoredMessages).input, outputEstimate: estimateConversationTokens(restoredMessages).output });
|
|
77
|
+
deps.setContextUsage?.({ ...EMPTY_CONTEXT_USAGE, usedTokens: estimateConversationTokens(restoredMessages).input, estimated: true });
|
|
76
78
|
deps.workStateRef.current = workState;
|
|
77
79
|
for (const error of parseErrors) {
|
|
78
80
|
deps.debugLog(`Session parse error: ${error}`);
|
|
@@ -191,6 +193,7 @@ export function createSessionLifecycle(deps) {
|
|
|
191
193
|
deps.conversationRef.current = [];
|
|
192
194
|
deps.lastAssistantTextRef.current = '';
|
|
193
195
|
deps.setTokenUsage({ ...EMPTY_TOKEN_USAGE });
|
|
196
|
+
deps.setContextUsage?.({ ...EMPTY_CONTEXT_USAGE });
|
|
194
197
|
deps.workStateRef.current = undefined;
|
|
195
198
|
deps.clearLiveMessages();
|
|
196
199
|
deps.setMessages(() => [{ role: 'system', text: 'Cleared. The void is productive.' }]);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ModelMessage } from 'ai';
|
|
3
|
+
import type { HazeSettings } from '../../config/settings.js';
|
|
4
|
+
import type { SessionRecorder } from './sessionRecorder.js';
|
|
5
|
+
import type { Message } from '../commands/streaming.js';
|
|
6
|
+
export type SettingsSelection = {
|
|
7
|
+
provider: string;
|
|
8
|
+
model: string;
|
|
9
|
+
endpointFingerprint?: string;
|
|
10
|
+
};
|
|
11
|
+
export type SettingsSelectionDeps = {
|
|
12
|
+
conversationRef: React.MutableRefObject<ModelMessage[]>;
|
|
13
|
+
sessionRecorderRef: React.MutableRefObject<SessionRecorder | undefined>;
|
|
14
|
+
setMessages: (updater: React.SetStateAction<Message[]>) => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Settings state plus the session-pinned model selection, extracted from
|
|
18
|
+
* `ChatScreen` (ARCH-05). `setSettings` records the global default before a
|
|
19
|
+
* patch merge so unrelated settings writes never replace a resumed session's
|
|
20
|
+
* model (merge policy in chat/userInput.ts), converts the conversation when the
|
|
21
|
+
* selected model or provider endpoint changes, and records `model_selection`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSettingsSelection({ conversationRef, sessionRecorderRef, setMessages }: SettingsSelectionDeps): {
|
|
24
|
+
settings: HazeSettings;
|
|
25
|
+
settingsRef: React.RefObject<HazeSettings>;
|
|
26
|
+
defaultSelectionRef: React.RefObject<{
|
|
27
|
+
provider?: string;
|
|
28
|
+
model?: string;
|
|
29
|
+
}>;
|
|
30
|
+
setSettings: (next: HazeSettings, patch?: HazeSettings) => void;
|
|
31
|
+
setSettingsRaw: React.Dispatch<React.SetStateAction<HazeSettings>>;
|
|
32
|
+
currentModelSelection: () => SettingsSelection | undefined;
|
|
33
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import { activeModel, providerEndpointFingerprint } from '../../config/providers.js';
|
|
3
|
+
import { transitionProviderConversation } from '../../core/agent/providerTransition.js';
|
|
4
|
+
import { mergeSettingsSelection } from './userInput.js';
|
|
5
|
+
/**
|
|
6
|
+
* Settings state plus the session-pinned model selection, extracted from
|
|
7
|
+
* `ChatScreen` (ARCH-05). `setSettings` records the global default before a
|
|
8
|
+
* patch merge so unrelated settings writes never replace a resumed session's
|
|
9
|
+
* model (merge policy in chat/userInput.ts), converts the conversation when the
|
|
10
|
+
* selected model or provider endpoint changes, and records `model_selection`.
|
|
11
|
+
*/
|
|
12
|
+
export function useSettingsSelection({ conversationRef, sessionRecorderRef, setMessages }) {
|
|
13
|
+
const [settings, setSettingsRaw] = useState({});
|
|
14
|
+
const settingsRef = useRef({});
|
|
15
|
+
const defaultSelectionRef = useRef({});
|
|
16
|
+
function currentModelSelection() {
|
|
17
|
+
const { provider, model } = settingsRef.current;
|
|
18
|
+
const selected = activeModel(settingsRef.current);
|
|
19
|
+
return provider && model ? { provider, model, ...(selected ? { endpointFingerprint: providerEndpointFingerprint(selected.provider) } : {}) } : undefined;
|
|
20
|
+
}
|
|
21
|
+
function setSettings(next, patch) {
|
|
22
|
+
const previousSelection = currentModelSelection();
|
|
23
|
+
const previousProvider = activeModel(settingsRef.current)?.provider;
|
|
24
|
+
// The ref records the global default from `next` (what updateSettings
|
|
25
|
+
// returned) before the patch merge; unrelated settings writes must not
|
|
26
|
+
// replace a resumed session's model (merge policy in chat/userInput.ts).
|
|
27
|
+
defaultSelectionRef.current = { provider: next.provider, model: next.model };
|
|
28
|
+
settingsRef.current = patch ? mergeSettingsSelection(next, settingsRef.current, patch) : next;
|
|
29
|
+
const selected = currentModelSelection();
|
|
30
|
+
const selectedProvider = activeModel(settingsRef.current)?.provider;
|
|
31
|
+
const changedEndpoint = selectedProvider && (!previousProvider || previousProvider.url !== selectedProvider.url || previousProvider.kind !== selectedProvider.kind);
|
|
32
|
+
if (patch && previousSelection && selected && (previousSelection.provider !== selected.provider || previousSelection.model !== selected.model || changedEndpoint) && conversationRef.current.length) {
|
|
33
|
+
conversationRef.current = transitionProviderConversation(conversationRef.current);
|
|
34
|
+
sessionRecorderRef.current?.recordModelTransition(conversationRef.current, selected);
|
|
35
|
+
setMessages(messages => [...messages, { role: 'system', text: 'Model changed: previous tool history was converted to text and provider reasoning state was cleared.' }]);
|
|
36
|
+
}
|
|
37
|
+
setSettingsRaw(settingsRef.current);
|
|
38
|
+
if (patch && ('provider' in patch || 'model' in patch)) {
|
|
39
|
+
if (selected)
|
|
40
|
+
sessionRecorderRef.current?.recordModelSelection(selected);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Direct state sync for the resume/continue/fork selection restore: no
|
|
44
|
+
// provider transition, the conversation is replaced by the lifecycle anyway.
|
|
45
|
+
return { settings, settingsRef, defaultSelectionRef, setSettings, setSettingsRaw, currentModelSelection };
|
|
46
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LoadedSkill } from '../../skills/types.js';
|
|
2
|
+
/** Signatures of the skill notices already announced in this session. */
|
|
3
|
+
export type SkillNoticeState = {
|
|
4
|
+
project: string;
|
|
5
|
+
errors: string;
|
|
6
|
+
notices: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const initialSkillNoticeState: () => SkillNoticeState;
|
|
9
|
+
/**
|
|
10
|
+
* Pure diffing half of `refreshSkills`: loads the registry and returns the
|
|
11
|
+
* candidate list, the next notice state, and the system messages that changed
|
|
12
|
+
* since the previous state (each notice is announced once per signature).
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadSkillsWithNotices(previous: SkillNoticeState): Promise<{
|
|
15
|
+
skills: LoadedSkill[];
|
|
16
|
+
state: SkillNoticeState;
|
|
17
|
+
messages: string[];
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { loadSkillRegistry } from '../../skills/SkillRegistry.js';
|
|
2
|
+
export const initialSkillNoticeState = () => ({ project: '', errors: '', notices: '' });
|
|
3
|
+
/**
|
|
4
|
+
* Pure diffing half of `refreshSkills`: loads the registry and returns the
|
|
5
|
+
* candidate list, the next notice state, and the system messages that changed
|
|
6
|
+
* since the previous state (each notice is announced once per signature).
|
|
7
|
+
*/
|
|
8
|
+
export async function loadSkillsWithNotices(previous) {
|
|
9
|
+
const registry = await loadSkillRegistry();
|
|
10
|
+
const skills = registry.candidates ?? [...registry.skills.values()];
|
|
11
|
+
const projectSkills = skills.filter(skill => skill.source === 'project');
|
|
12
|
+
const project = projectSkills.map(skill => `${skill.name}:${skill.path}`).join('\n');
|
|
13
|
+
const errors = registry.errors.map(error => `${error.source ? `${error.source}/` : ''}${error.directory}: ${error.message}`).join('\n');
|
|
14
|
+
// Visible load-time shadow notices (HZA-6): a project skill silently
|
|
15
|
+
// overriding a same-named user skill is something the user should see.
|
|
16
|
+
const notices = (registry.notices ?? []).join('\n');
|
|
17
|
+
const messages = [];
|
|
18
|
+
if (project && project !== previous.project) {
|
|
19
|
+
messages.push(`Project skills discovered (repository-provided, untrusted content): ${projectSkills.map(skill => skill.name).join(', ')}`);
|
|
20
|
+
}
|
|
21
|
+
if (errors && errors !== previous.errors)
|
|
22
|
+
messages.push(`Invalid skills were isolated:\n${errors}`);
|
|
23
|
+
if (notices && notices !== previous.notices)
|
|
24
|
+
messages.push(notices);
|
|
25
|
+
return { skills, state: { project, errors, notices }, messages };
|
|
26
|
+
}
|
|
@@ -34,7 +34,7 @@ export function startupProviderInfo(settings) {
|
|
|
34
34
|
lspLine,
|
|
35
35
|
mcpLine,
|
|
36
36
|
'',
|
|
37
|
-
'Run /provider to choose or add a provider, then select a model.',
|
|
37
|
+
'Run /provider to choose or add a provider, then select a model (choose "later" to skip for now). Esc goes back one step; Esc at the first step exits.',
|
|
38
38
|
].join('\n');
|
|
39
39
|
}
|
|
40
40
|
const model = selection.model;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChatScreenDeps } from './screenDeps.js';
|
|
2
|
+
/**
|
|
3
|
+
* The chat input submit pipeline: exit shortcut, settings repair, busy
|
|
4
|
+
* queueing, wizard dispatch, skill invocation, slash commands, then the
|
|
5
|
+
* agent turn. Extracted from `chat.tsx` (CR-006 pattern) — pure code motion
|
|
6
|
+
* over the explicit deps bundle.
|
|
7
|
+
*/
|
|
8
|
+
export declare function submit(deps: ChatScreenDeps, value: string): Promise<void>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { readSettings, updateSettings } from '../../config/settings.js';
|
|
2
|
+
import { readContextFiles } from '../../config/contextFiles.js';
|
|
3
|
+
import { formatSession } from '../../core/session/sessionStore.js';
|
|
4
|
+
import { loadTasks as loadTasksFromStore } from '../../core/tasks/taskStorage.js';
|
|
5
|
+
import { handleSlashCommand } from '../commands/commands.js';
|
|
6
|
+
import { isPausedGoalRecoveryCommand, contextFileSignatureMap } from './userInput.js';
|
|
7
|
+
import { buildContextReport } from './contextReport.js';
|
|
8
|
+
import { parseUserInputLine } from '../../core/agent/userCommands.js';
|
|
9
|
+
import { NO_USER_COMMAND_MESSAGE } from './userCommandFlow.js';
|
|
10
|
+
/**
|
|
11
|
+
* The chat input submit pipeline: exit shortcut, settings repair, busy
|
|
12
|
+
* queueing, wizard dispatch, skill invocation, slash commands, then the
|
|
13
|
+
* agent turn. Extracted from `chat.tsx` (CR-006 pattern) — pure code motion
|
|
14
|
+
* over the explicit deps bundle.
|
|
15
|
+
*/
|
|
16
|
+
export async function submit(deps, value) {
|
|
17
|
+
const { stoppingRef, mode, shutdown, settingsError, setSettings, setSettingsError, setMessages, busy, followUps, pausedResume, setPausedResume, wizard, skillInvocation, doAgentTurn, settings, contextFiles, setMode, updateWizard, sessionLifecycle, noSession, openSessionPicker, sessionRef, terminalControl, refreshSkills, openPluginPicker, setContextFiles, contextFileSignaturesRef, currentPromptSession, setSessionReasoningOverride, sessionStartRef, conversationRef, clearLiveMessages, lastAssistantTextRef, prepareUserInput, setVisibleTasks, setTaskBarPadding, } = deps;
|
|
18
|
+
if (stoppingRef.current)
|
|
19
|
+
return;
|
|
20
|
+
if (mode === 'chat' && /^\/(?:exit|quit)\s*$/i.test(value))
|
|
21
|
+
return shutdown();
|
|
22
|
+
if (settingsError) {
|
|
23
|
+
try {
|
|
24
|
+
const repaired = await readSettings();
|
|
25
|
+
setSettings(repaired, {});
|
|
26
|
+
setSettingsError(undefined);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
30
|
+
setSettingsError(message);
|
|
31
|
+
if (!/^\/(?:settings\s+(?:open|edit)|help|exit|quit)\b/i.test(value.trim())) {
|
|
32
|
+
setMessages(messages => [...messages, { role: 'system', text: `${message}\nRepair settings, then retry. /settings edit (or /settings open), /help, and /exit remain available.` }]);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (busy) {
|
|
38
|
+
if (mode === 'chat')
|
|
39
|
+
followUps.queue(value);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// A new goal or session reset supersedes the paused-goal resume affordance;
|
|
43
|
+
// recovery/configuration commands (compact, model, provider, settings,
|
|
44
|
+
// resume…) intentionally keep it — the pause notice tells the user to run
|
|
45
|
+
// exactly those and then press R (SU-04).
|
|
46
|
+
const isRecoveryCommand = isPausedGoalRecoveryCommand(mode, value);
|
|
47
|
+
if (pausedResume && !isRecoveryCommand)
|
|
48
|
+
setPausedResume(undefined);
|
|
49
|
+
if (await wizard.dispatch(mode, value))
|
|
50
|
+
return;
|
|
51
|
+
// `! <command>` runs directly, with no model turn; `\!` escapes the prefix.
|
|
52
|
+
if (mode === 'chat') {
|
|
53
|
+
const parsed = parseUserInputLine(value);
|
|
54
|
+
if (parsed.kind === 'command') {
|
|
55
|
+
if (parsed.command)
|
|
56
|
+
await deps.runUserCommand(parsed.command);
|
|
57
|
+
else
|
|
58
|
+
setMessages(m => [...m, { role: 'system', text: NO_USER_COMMAND_MESSAGE }]);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (parsed.kind === 'escaped')
|
|
62
|
+
value = parsed.value;
|
|
63
|
+
}
|
|
64
|
+
const invokedSkill = skillInvocation(value);
|
|
65
|
+
if (invokedSkill) {
|
|
66
|
+
const argumentText = invokedSkill.args ? `\nUser-provided skill arguments: ${invokedSkill.args}` : '';
|
|
67
|
+
await doAgentTurn(`The user explicitly invoked the "${invokedSkill.skill.name}" skill. Call skill with name="${invokedSkill.skill.name}" and follow its returned instructions.${argumentText}`, value);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const { clearConversation, compactConversation, compactConversationWithModel } = sessionLifecycle;
|
|
71
|
+
const ctx = {
|
|
72
|
+
settings,
|
|
73
|
+
contextFiles,
|
|
74
|
+
setMode,
|
|
75
|
+
setModelProviderFilter: (filter) => updateWizard({ type: 'set', key: 'modelProviderFilter', value: filter }),
|
|
76
|
+
addSystemMessage: text => setMessages(m => [...m, { role: 'system', text }]),
|
|
77
|
+
clearConversation,
|
|
78
|
+
newSession: async () => {
|
|
79
|
+
conversationRef.current = [];
|
|
80
|
+
lastAssistantTextRef.current = '';
|
|
81
|
+
clearLiveMessages();
|
|
82
|
+
setMessages([{ role: 'system', text: 'Started fresh. The fog parts.' }]);
|
|
83
|
+
await sessionLifecycle.startNewSession('New session started.');
|
|
84
|
+
},
|
|
85
|
+
resumeSession: noSession ? undefined : async (id) => {
|
|
86
|
+
if (id)
|
|
87
|
+
await sessionLifecycle.resumeSessionById(id);
|
|
88
|
+
else
|
|
89
|
+
await openSessionPicker();
|
|
90
|
+
},
|
|
91
|
+
sessionInfo: () => sessionRef.current ? formatSession(sessionRef.current) : 'Session persistence is off.',
|
|
92
|
+
compactConversation,
|
|
93
|
+
compactConversationLlm: compactConversationWithModel,
|
|
94
|
+
runAgentTurn: (prompt, displayValue, options) => doAgentTurn(prompt, displayValue, options),
|
|
95
|
+
composeInEditor: async () => {
|
|
96
|
+
const text = await terminalControl.composeInEditor();
|
|
97
|
+
if (text === undefined)
|
|
98
|
+
setMessages(m => [...m, { role: 'system', text: '/editor needs $EDITOR (or $VISUAL) set to an editor command.' }]);
|
|
99
|
+
return text;
|
|
100
|
+
},
|
|
101
|
+
viewInPager: terminalControl.viewInPager,
|
|
102
|
+
editFileInEditor: terminalControl.editFileInEditor,
|
|
103
|
+
refreshSkills,
|
|
104
|
+
openPluginPicker,
|
|
105
|
+
refreshContextFiles: async () => {
|
|
106
|
+
const files = await readContextFiles().catch(() => contextFiles);
|
|
107
|
+
setContextFiles(files);
|
|
108
|
+
contextFileSignaturesRef.current = contextFileSignatureMap(files);
|
|
109
|
+
return files;
|
|
110
|
+
},
|
|
111
|
+
updateSettings: async (patch) => {
|
|
112
|
+
const next = await updateSettings(patch);
|
|
113
|
+
setSettings(next, patch);
|
|
114
|
+
return deps.settingsRef.current;
|
|
115
|
+
},
|
|
116
|
+
getSessionReasoning: modelSelector => currentPromptSession().reasoningByModel?.[modelSelector],
|
|
117
|
+
setSessionReasoning: setSessionReasoningOverride,
|
|
118
|
+
getContextReport: () => buildContextReport({ sessionStart: sessionStartRef.current, contextFiles, conversation: conversationRef.current }),
|
|
119
|
+
};
|
|
120
|
+
let result;
|
|
121
|
+
try {
|
|
122
|
+
result = await handleSlashCommand(value, ctx);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
126
|
+
setMessages(m => [...m, { role: 'system', text: `Command failed: ${text}` }]);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (result === 'exit')
|
|
130
|
+
return shutdown();
|
|
131
|
+
if (result === 'handled') {
|
|
132
|
+
if (value === '/clear' || value === '/new') {
|
|
133
|
+
loadTasksFromStore().then(t => { setVisibleTasks(t); setTaskBarPadding(0); }).catch(() => undefined);
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const prepared = await prepareUserInput(value);
|
|
138
|
+
if (!prepared)
|
|
139
|
+
return;
|
|
140
|
+
await doAgentTurn(prepared.value, prepared.displayValue, prepared.options);
|
|
141
|
+
}
|
|
@@ -55,7 +55,7 @@ export function runSuspendedChild(launch, stdinText) {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
// Ink-side wiring lives in chat.tsx via useApp(); this module deliberately
|
|
58
|
+
// Ink-side wiring lives in chat/ChatScreen.tsx via useApp(); this module deliberately
|
|
59
59
|
// stays React-free. The interactive hook is defined in terminalControlHook.tsx.
|
|
60
60
|
// --- Ink-side wiring (React, no JSX) -------------------------------------
|
|
61
61
|
import { useCallback } from 'react';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure one-line builders for tool calls, tool results and the busy label
|
|
3
|
+
* (compact, toolCallSummary, toolResultSummary, busyToolLabel): the transcript
|
|
4
|
+
* vocabulary shared by commands/formatters.ts (which re-exports them) and by
|
|
5
|
+
* the turn engine under commands/streaming/, which records them into display
|
|
6
|
+
* state while a step runs (ARCH-03).
|
|
7
|
+
*/
|
|
8
|
+
export declare function compact(value: unknown, maxLength?: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* One-line summary of a tool call for the transcript rows. Wraps the raw
|
|
11
|
+
* builder: paths, patterns, and commands are model/repo-derived, so terminal
|
|
12
|
+
* control sequences are stripped at this sink (HZA-3).
|
|
13
|
+
*/
|
|
14
|
+
export declare function toolCallSummary(toolName: string, input: unknown): string;
|
|
15
|
+
/**
|
|
16
|
+
* One-line summary of a tool result for the transcript rows; same terminal
|
|
17
|
+
* control-sequence sink discipline as `toolCallSummary` (HZA-3).
|
|
18
|
+
*/
|
|
19
|
+
export declare function toolResultSummary(event: {
|
|
20
|
+
success: boolean;
|
|
21
|
+
output?: unknown;
|
|
22
|
+
error?: unknown;
|
|
23
|
+
}): string;
|
|
24
|
+
/**
|
|
25
|
+
* A short, human label for the live busy indicator while a tool is running,
|
|
26
|
+
* e.g. "Running npm test", "Reading src/foo.ts", "Searching".
|
|
27
|
+
* Lets the developer see *what* is happening, not just that something is.
|
|
28
|
+
*/
|
|
29
|
+
export declare function busyToolLabel(toolName: string, input: unknown): string;
|