@denizokcu/haze 0.11.0 → 1.1.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 +33 -0
- package/README.md +28 -14
- package/SECURITY.md +5 -3
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/TaskBar.js +1 -1
- package/dist/cli/chat/chatMetrics.d.ts +2 -2
- package/dist/cli/chat/chatMetrics.js +1 -1
- package/dist/cli/chat/fileMentionSuggestions.js +1 -1
- package/dist/cli/chat/inputSuggestions.d.ts +8 -16
- package/dist/cli/chat/inputSuggestions.js +10 -41
- package/dist/cli/chat/messages.d.ts +0 -2
- package/dist/cli/chat/messages.js +5 -5
- package/dist/cli/chat/sessionLifecycle.d.ts +2 -1
- package/dist/cli/chat/turnState.d.ts +1 -1
- package/dist/cli/chat/wizardDispatch.d.ts +90 -28
- package/dist/cli/chat/wizardDispatch.js +257 -130
- package/dist/cli/commands/chat.js +61 -77
- package/dist/cli/commands/chatModes.d.ts +8 -1
- package/dist/cli/commands/chatModes.js +9 -44
- package/dist/cli/commands/commandHelp.js +2 -0
- package/dist/cli/commands/commands.js +2 -0
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/formatters.d.ts +3 -3
- package/dist/cli/commands/formatters.js +12 -25
- package/dist/cli/commands/providerWizard.js +2 -3
- package/dist/cli/commands/runCommand.js +1 -1
- package/dist/cli/commands/serverWizard.d.ts +34 -0
- package/dist/cli/commands/{mcpWizard.js → serverWizard.js} +44 -2
- package/dist/cli/commands/settingsSummary.js +2 -0
- package/dist/cli/commands/skillsWizard.d.ts +41 -0
- package/dist/cli/commands/{skillWizard.js → skillsWizard.js} +33 -11
- package/dist/cli/commands/streaming/abortCause.d.ts +2 -1
- package/dist/cli/commands/streaming/agentAttempt.d.ts +43 -0
- package/dist/cli/commands/streaming/agentAttempt.js +79 -0
- package/dist/cli/commands/streaming/attemptLifecycle.d.ts +56 -0
- package/dist/cli/commands/streaming/attemptLifecycle.js +110 -0
- package/dist/cli/commands/streaming/attemptOutcome.d.ts +96 -0
- package/dist/cli/commands/streaming/attemptOutcome.js +206 -0
- package/dist/cli/commands/streaming/attemptSetup.d.ts +78 -0
- package/dist/cli/commands/streaming/attemptSetup.js +167 -0
- package/dist/cli/commands/streaming/goalCheckpoint.d.ts +1 -1
- package/dist/cli/commands/streaming/goalCheckpoint.js +2 -2
- package/dist/cli/commands/streaming/goalSupervisor.js +9 -6
- package/dist/cli/commands/streaming/stallRecovery.d.ts +94 -0
- package/dist/cli/commands/streaming/stallRecovery.js +105 -0
- package/dist/cli/commands/streaming/streamLoop.d.ts +72 -0
- package/dist/cli/commands/streaming/streamLoop.js +448 -0
- package/dist/cli/commands/streaming/toolCallRecovery.d.ts +14 -0
- package/dist/cli/commands/streaming/toolCallRecovery.js +56 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +2 -1
- package/dist/cli/commands/streaming/turnRuntime.d.ts +4 -0
- package/dist/cli/commands/streaming/turnRuntime.js +6 -0
- package/dist/cli/commands/streaming.d.ts +14 -25
- package/dist/cli/commands/streaming.js +43 -754
- package/dist/cli/commands/themesCommand.d.ts +17 -0
- package/dist/cli/commands/themesCommand.js +24 -0
- package/dist/cli/commands/wizardFlow.d.ts +341 -0
- package/dist/cli/commands/wizardFlow.js +397 -0
- package/dist/cli/contextReport.js +3 -0
- package/dist/cli/index.js +1 -1
- package/dist/config/contextFiles.js +9 -3
- package/dist/config/inputHistory.d.ts +0 -1
- package/dist/config/inputHistory.js +1 -1
- package/dist/config/modelDiscovery.d.ts +0 -15
- package/dist/config/modelDiscovery.js +1 -1
- package/dist/config/settings.d.ts +9 -0
- package/dist/config/settings.js +4 -0
- package/dist/config/skillSettings.js +4 -4
- package/dist/config/updateCheck.d.ts +0 -1
- package/dist/config/updateCheck.js +1 -1
- package/dist/core/agent/budgets.d.ts +63 -1
- package/dist/core/agent/budgets.js +84 -1
- package/dist/core/agent/compaction.js +1 -1
- package/dist/core/agent/completionController.d.ts +7 -13
- package/dist/core/agent/completionController.js +17 -8
- package/dist/core/agent/contextBudget.d.ts +0 -4
- package/dist/core/agent/contextBudget.js +3 -3
- package/dist/core/agent/errors.d.ts +0 -1
- package/dist/core/agent/errors.js +1 -1
- package/dist/core/agent/events.d.ts +5 -1
- package/dist/core/{goal/completionPolicy.d.ts → agent/goalPolicy.d.ts} +18 -0
- package/dist/core/agent/goalPolicy.js +106 -0
- package/dist/core/agent/requestAssembly.d.ts +2 -2
- package/dist/core/agent/requestAssembly.js +16 -4
- package/dist/core/agent/toolCapabilities.d.ts +2 -2
- package/dist/core/agent/toolCapabilities.js +5 -5
- package/dist/core/agent/toolOutputStore.js +1 -1
- package/dist/core/agent/toolResults.js +1 -1
- package/dist/core/agent/workState.d.ts +6 -3
- package/dist/core/agent/workState.js +62 -7
- package/dist/core/attachments/imageAttachments.js +90 -42
- package/dist/core/deadline.d.ts +0 -6
- package/dist/core/deadline.js +1 -1
- package/dist/core/io/boundedRead.js +1 -1
- package/dist/core/limits.d.ts +51 -0
- package/dist/core/limits.js +51 -0
- package/dist/core/log/llmLog.js +1 -1
- package/dist/core/process/backgroundRegistry.d.ts +2 -3
- package/dist/core/process/backgroundRegistry.js +10 -6
- package/dist/core/process/userShell.d.ts +16 -0
- package/dist/core/process/userShell.js +59 -0
- package/dist/core/safety/secretPaths.d.ts +18 -0
- package/dist/core/safety/secretPaths.js +115 -0
- package/dist/core/safety/shellClassifier.d.ts +11 -0
- package/dist/core/safety/{bashClassifier.js → shellClassifier.js} +5 -3
- package/dist/core/safety/urlGuard.d.ts +1 -1
- package/dist/core/session/sessionSlimming.d.ts +0 -3
- package/dist/core/session/sessionSlimming.js +2 -3
- package/dist/core/session/sessionStore.d.ts +1 -0
- package/dist/core/session/sessionStore.js +39 -20
- package/dist/core/{bashOutput → shellOutput}/lineFilter.js +8 -2
- package/dist/core/{bashOutput → shellOutput}/reducers/search.d.ts +0 -1
- package/dist/core/{bashOutput → shellOutput}/reducers/search.js +1 -1
- package/dist/core/shellOutput/registry.d.ts +2 -0
- package/dist/core/{bashOutput → shellOutput}/registry.js +3 -3
- package/dist/core/{bashOutput → shellOutput}/types.d.ts +6 -5
- package/dist/core/subagent/contracts.d.ts +2 -14
- package/dist/core/subagent/contracts.js +3 -3
- package/dist/core/subagent/executionProfiles.js +2 -2
- package/dist/core/subagent/subagentRunner.js +3 -4
- package/dist/core/toolOutput/reduction.d.ts +0 -12
- package/dist/core/toolOutput/reduction.js +1 -1
- package/dist/core/validation/outputParser.d.ts +2 -2
- package/dist/llm/client.js +5 -1
- package/dist/llm/hazeTools.d.ts +139 -124
- package/dist/llm/hazeTools.js +20 -11
- package/dist/llm/initPrompt.js +1 -1
- package/dist/llm/lsp/client.d.ts +45 -0
- package/dist/llm/lsp/client.js +195 -0
- package/dist/llm/lsp/pool.d.ts +23 -0
- package/dist/llm/lsp/pool.js +86 -0
- package/dist/llm/lsp/protocol.d.ts +64 -0
- package/dist/llm/lsp/protocol.js +128 -0
- package/dist/llm/lsp/requests.d.ts +94 -0
- package/dist/llm/lsp/requests.js +119 -0
- package/dist/llm/lspTools.d.ts +3824 -570
- package/dist/llm/lspTools.js +65 -1
- package/dist/llm/openaiCodex.d.ts +0 -2
- package/dist/llm/openaiCodex.js +0 -4
- package/dist/llm/openaiCodexOAuth.d.ts +0 -3
- package/dist/llm/openaiCodexOAuth.js +6 -3
- package/dist/llm/requestContext.d.ts +5 -1
- package/dist/llm/requestContext.js +25 -2
- package/dist/llm/systemPrompt.d.ts +1 -0
- package/dist/llm/systemPrompt.js +16 -7
- package/dist/llm/toolResultTypes.d.ts +1 -15
- package/dist/llm/toolResultTypes.js +1 -4
- package/dist/llm/tools/editMatch.d.ts +0 -9
- package/dist/llm/tools/editMatch.js +1 -1
- package/dist/llm/tools/failures.d.ts +6 -0
- package/dist/llm/tools/failures.js +8 -2
- package/dist/llm/tools/fetchTool.js +1 -1
- package/dist/llm/tools/fileToolShared.d.ts +4 -2
- package/dist/llm/tools/fileToolShared.js +9 -5
- package/dist/llm/tools/gitIgnore.d.ts +25 -32
- package/dist/llm/tools/gitIgnore.js +216 -98
- package/dist/llm/tools/grepParse.d.ts +2 -1
- package/dist/llm/tools/grepRunner.d.ts +1 -1
- package/dist/llm/tools/grepRunner.js +2 -2
- package/dist/llm/tools/outputCap.d.ts +2 -7
- package/dist/llm/tools/outputCap.js +3 -3
- package/dist/llm/tools/processTool.d.ts +16 -16
- package/dist/llm/tools/processTool.js +1 -1
- package/dist/llm/tools/readRecovery.d.ts +0 -2
- package/dist/llm/tools/readRecovery.js +4 -2
- package/dist/llm/tools/{bashTool.d.ts → shellTool.d.ts} +123 -107
- package/dist/llm/tools/{bashTool.js → shellTool.js} +18 -14
- package/dist/llm/tools/toolContext.js +5 -5
- package/dist/llm/tools/workspaceFile.d.ts +4 -4
- package/dist/llm/tools/workspaceFile.js +29 -17
- package/dist/llm/webFetch.d.ts +1 -1
- package/dist/skills/SkillLoader.d.ts +1 -11
- package/dist/skills/SkillLoader.js +1 -2
- package/dist/skills/types.d.ts +2 -1
- package/dist/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 +2 -2
- 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 +126 -15
- package/dist/ui/themes/af-magic.d.ts +7 -0
- package/dist/ui/themes/af-magic.js +25 -0
- package/dist/ui/themes/agnoster.d.ts +10 -0
- package/dist/ui/themes/agnoster.js +40 -0
- package/dist/ui/themes/bira.d.ts +10 -0
- package/dist/ui/themes/bira.js +28 -0
- package/dist/ui/themes/bureau.d.ts +10 -0
- package/dist/ui/themes/bureau.js +28 -0
- package/dist/ui/themes/clean.d.ts +9 -0
- package/dist/ui/themes/clean.js +27 -0
- package/dist/ui/themes/cloud.d.ts +6 -0
- package/dist/ui/themes/cloud.js +24 -0
- package/dist/ui/themes/dst.d.ts +10 -0
- package/dist/ui/themes/dst.js +28 -0
- package/dist/ui/themes/fishy.d.ts +7 -0
- package/dist/ui/themes/fishy.js +25 -0
- package/dist/ui/themes/index.d.ts +8 -0
- package/dist/ui/themes/index.js +36 -0
- package/dist/ui/themes/light.d.ts +3 -0
- package/dist/ui/themes/light.js +21 -0
- package/dist/ui/themes/purple.d.ts +7 -0
- package/dist/ui/themes/purple.js +26 -0
- package/dist/ui/themes/robbyrussell.d.ts +8 -0
- package/dist/ui/themes/robbyrussell.js +26 -0
- package/dist/ui/themes/solarized-dark.d.ts +16 -0
- package/dist/ui/themes/solarized-dark.js +44 -0
- package/dist/ui/themes/solarized-light.d.ts +12 -0
- package/dist/ui/themes/solarized-light.js +40 -0
- package/dist/ui/themes/steeef.d.ts +11 -0
- package/dist/ui/themes/steeef.js +29 -0
- package/dist/utils/buildInfo.d.ts +6 -13
- package/dist/utils/buildInfo.js +6 -15
- package/dist/utils/fs.d.ts +7 -5
- package/dist/utils/fs.js +5 -2
- package/dist/utils/path.d.ts +0 -1
- package/dist/utils/path.js +1 -1
- package/package.json +6 -4
- package/dist/cli/commands/lspWizard.d.ts +0 -14
- package/dist/cli/commands/lspWizard.js +0 -44
- package/dist/cli/commands/mcpWizard.d.ts +0 -15
- package/dist/cli/commands/skillConfirmRemove.d.ts +0 -11
- package/dist/cli/commands/skillConfirmRemove.js +0 -20
- package/dist/cli/commands/skillCreation.d.ts +0 -12
- package/dist/cli/commands/skillCreation.js +0 -14
- package/dist/cli/commands/skillWizard.d.ts +0 -17
- package/dist/cli/commands/streaming/idleTimer.d.ts +0 -26
- package/dist/cli/commands/streaming/idleTimer.js +0 -24
- package/dist/cli/commands/streaming/turnOutcome.d.ts +0 -27
- package/dist/cli/commands/streaming/turnOutcome.js +0 -29
- package/dist/cli/commands/wizardActions.d.ts +0 -47
- package/dist/cli/commands/wizardActions.js +0 -47
- package/dist/cli/commands/wizardInput.d.ts +0 -4
- package/dist/cli/commands/wizardInput.js +0 -19
- package/dist/cli/commands/wizardPrompts.d.ts +0 -22
- package/dist/cli/commands/wizardPrompts.js +0 -58
- package/dist/cli/commands/wizardSuggestions.d.ts +0 -31
- package/dist/cli/commands/wizardSuggestions.js +0 -190
- package/dist/cli/commands/wizardTransition.d.ts +0 -37
- package/dist/cli/commands/wizardTransition.js +0 -43
- package/dist/core/agent/toolExecutionBudget.d.ts +0 -35
- package/dist/core/agent/toolExecutionBudget.js +0 -49
- package/dist/core/agent/turnBudget.d.ts +0 -35
- package/dist/core/agent/turnBudget.js +0 -27
- package/dist/core/bashOutput/ansi.d.ts +0 -1
- package/dist/core/bashOutput/ansi.js +0 -7
- package/dist/core/bashOutput/registry.d.ts +0 -4
- package/dist/core/goal/completionPolicy.js +0 -43
- package/dist/core/goal/requestClassifier.d.ts +0 -3
- package/dist/core/goal/requestClassifier.js +0 -18
- package/dist/core/goal/sessionGoal.d.ts +0 -8
- package/dist/core/goal/sessionGoal.js +0 -30
- package/dist/core/limits/byteBudgets.d.ts +0 -20
- package/dist/core/limits/byteBudgets.js +0 -20
- package/dist/core/limits/textBudgets.d.ts +0 -25
- package/dist/core/limits/textBudgets.js +0 -25
- package/dist/core/safety/bashClassifier.d.ts +0 -10
- package/dist/llm/lsp.d.ts +0 -149
- package/dist/llm/lsp.js +0 -368
- package/dist/ui/components/ErrorView.d.ts +0 -4
- package/dist/ui/components/ErrorView.js +0 -7
- package/dist/utils/yaml.d.ts +0 -2
- package/dist/utils/yaml.js +0 -8
- package/examples/skills/files/SKILL.md +0 -16
- package/examples/skills/files/examples/file-editing.md +0 -3
- /package/dist/core/{bashOutput → shellOutput}/command.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/command.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/lineFilter.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/content.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/content.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/gh.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/gh.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/git.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/git.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/validation.d.ts +0 -0
- /package/dist/core/{bashOutput → shellOutput}/reducers/validation.js +0 -0
- /package/dist/core/{bashOutput → shellOutput}/types.js +0 -0
|
@@ -17,6 +17,62 @@ function errorFragments(error, depth = 0) {
|
|
|
17
17
|
...errorFragments(record.error, depth + 1),
|
|
18
18
|
];
|
|
19
19
|
}
|
|
20
|
+
function numericBoundsFor(schema, key) {
|
|
21
|
+
const properties = schema?.properties;
|
|
22
|
+
const property = properties?.[key];
|
|
23
|
+
if (property == null)
|
|
24
|
+
return {};
|
|
25
|
+
const { maximum, minimum } = property;
|
|
26
|
+
return {
|
|
27
|
+
maximum: typeof maximum === 'number' ? maximum : undefined,
|
|
28
|
+
minimum: typeof minimum === 'number' ? minimum : undefined,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Clamps top-level numeric arguments that exceed a tool schema's declared
|
|
33
|
+
* inclusive bounds (for example grep's maxMatches: 9999 against maximum: 200).
|
|
34
|
+
* Small local models frequently invent out-of-range values; clamping keeps the
|
|
35
|
+
* call executable without a model round-trip. Returns the repaired input
|
|
36
|
+
* object, or null when the input is not a JSON object or nothing is out of
|
|
37
|
+
* range. Exclusive bounds, nested objects, and non-numeric fields are left
|
|
38
|
+
* untouched so genuinely malformed input still takes the forced-retry path.
|
|
39
|
+
*/
|
|
40
|
+
export async function clampOutOfBoundsToolNumbers(input, toolName, resolveSchema) {
|
|
41
|
+
let value = input;
|
|
42
|
+
if (typeof value === 'string') {
|
|
43
|
+
try {
|
|
44
|
+
value = JSON.parse(value);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (value == null || typeof value !== 'object' || Array.isArray(value))
|
|
51
|
+
return null;
|
|
52
|
+
let schema;
|
|
53
|
+
try {
|
|
54
|
+
schema = await resolveSchema({ toolName });
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const repaired = { ...value };
|
|
60
|
+
let changed = false;
|
|
61
|
+
for (const [key, entry] of Object.entries(repaired)) {
|
|
62
|
+
if (typeof entry !== 'number' || !Number.isFinite(entry))
|
|
63
|
+
continue;
|
|
64
|
+
const { maximum, minimum } = numericBoundsFor(schema, key);
|
|
65
|
+
if (maximum !== undefined && entry > maximum) {
|
|
66
|
+
repaired[key] = maximum;
|
|
67
|
+
changed = true;
|
|
68
|
+
}
|
|
69
|
+
else if (minimum !== undefined && entry < minimum) {
|
|
70
|
+
repaired[key] = minimum;
|
|
71
|
+
changed = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return changed ? repaired : null;
|
|
75
|
+
}
|
|
20
76
|
/** Identifies tool-input failures that are safe to send back to the model for a smaller retry. */
|
|
21
77
|
export function isMalformedToolInputError(error) {
|
|
22
78
|
const text = errorFragments(error).join(' ');
|
|
@@ -35,7 +35,7 @@ export type ToolDisplayDiff = {
|
|
|
35
35
|
complete?: boolean;
|
|
36
36
|
previousContentOmittedBytes?: number;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
type ToolDisplayItem = {
|
|
39
39
|
id: string;
|
|
40
40
|
summary: string;
|
|
41
41
|
status: 'running' | 'success' | 'error';
|
|
@@ -84,3 +84,4 @@ export interface ToolGroupRenderer {
|
|
|
84
84
|
/** Extract the bounded structured diff returned by dedicated file mutation tools for rich terminal rendering. */
|
|
85
85
|
export declare function toolDiffFromResult(toolCall: NativeToolCall, output: unknown): ToolDisplayDiff | undefined;
|
|
86
86
|
export declare function createToolGroupRenderer(deps: ToolGroupRendererDeps): ToolGroupRenderer;
|
|
87
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ModelMessage } from 'ai';
|
|
2
2
|
import type { ContextFile } from '../../../config/contextFiles.js';
|
|
3
|
+
import type { LlmLog } from '../../../core/log/llmLog.js';
|
|
4
|
+
import { type LlmLogEntry } from '../../../core/log/llmLog.js';
|
|
3
5
|
export interface TokenUsage {
|
|
4
6
|
inputTokens: number | undefined;
|
|
5
7
|
outputTokens: number | undefined;
|
|
@@ -15,6 +17,8 @@ export interface TokenUsage {
|
|
|
15
17
|
effectiveNonCachedInput: number | undefined;
|
|
16
18
|
}
|
|
17
19
|
export declare function retryDelayMs(attempt: number): number;
|
|
20
|
+
/** Append one entry to the per-turn LLM log when file logging is enabled; never blocks the turn. */
|
|
21
|
+
export declare function logEntry(log: LlmLog | undefined, entry: LlmLogEntry): void;
|
|
18
22
|
export declare function abortableDelay(milliseconds: number, signal: AbortSignal): Promise<void>;
|
|
19
23
|
export declare function estimateInputBreakdown(input: {
|
|
20
24
|
system: string;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { appendLogEntry as logAppend } from '../../../core/log/llmLog.js';
|
|
1
2
|
import { cacheHitRatio, contextBreakdown, effectiveNonCachedInput, estimateValueTokens } from '../../../core/agent/contextBudget.js';
|
|
2
3
|
export function retryDelayMs(attempt) {
|
|
3
4
|
return Math.min(4000, 1000 * 2 ** attempt);
|
|
4
5
|
}
|
|
6
|
+
/** Append one entry to the per-turn LLM log when file logging is enabled; never blocks the turn. */
|
|
7
|
+
export function logEntry(log, entry) {
|
|
8
|
+
if (log)
|
|
9
|
+
void logAppend(log, entry).catch(() => undefined);
|
|
10
|
+
}
|
|
5
11
|
export async function abortableDelay(milliseconds, signal) {
|
|
6
12
|
if (signal.aborted)
|
|
7
13
|
return;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { type ModelMessage, type ToolSet } from 'ai';
|
|
2
1
|
import type { LlmLog } from '../../core/log/llmLog.js';
|
|
3
|
-
import
|
|
4
|
-
import { type PromptSession } from '../../llm/systemPrompt.js';
|
|
5
|
-
import type { ContextFile } from '../../config/contextFiles.js';
|
|
2
|
+
import type { ModelMessage } from 'ai';
|
|
6
3
|
import { type AgentEventSink } from '../../core/agent/events.js';
|
|
7
|
-
import {
|
|
4
|
+
import type { ImageAttachment } from '../../core/attachments/imageAttachments.js';
|
|
8
5
|
import { type BlessedPath } from '../../core/attachments/readBlessings.js';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import type {
|
|
14
|
-
import {
|
|
15
|
-
import { type ToolDisplayDiff } from './streaming/toolGroupRenderer.js';
|
|
6
|
+
import type { TurnCompletionEvidence } from '../../core/agent/completionController.js';
|
|
7
|
+
import type { ValidationOutcome, WorkTaskProgress, WorkState } from '../../core/agent/workState.js';
|
|
8
|
+
import type { SubagentOverrides, TurnExecutionScope } from '../../llm/requestContext.js';
|
|
9
|
+
import type { PromptSession } from '../../llm/systemPrompt.js';
|
|
10
|
+
import type { ContextFile } from '../../config/contextFiles.js';
|
|
11
|
+
import type { IncompleteGoalResume } from './streaming/goalCheckpoint.js';
|
|
16
12
|
import { type TokenUsage } from './streaming/turnRuntime.js';
|
|
17
|
-
|
|
13
|
+
import type { ToolDisplayDiff } from './streaming/toolGroupRenderer.js';
|
|
18
14
|
export type Message = {
|
|
19
15
|
id?: string;
|
|
20
16
|
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
@@ -29,9 +25,11 @@ export type Message = {
|
|
|
29
25
|
toolDiffs?: ToolDisplayDiff[];
|
|
30
26
|
};
|
|
31
27
|
export type TurnStatus = 'complete' | 'aborted' | 'failed';
|
|
32
|
-
/** Authoritative outcome of a turn, so callers (esp. headless/CI) need not sniff message
|
|
28
|
+
/** Authoritative outcome of a turn, so callers (esp. headless/CI) need not sniff message texts. */
|
|
33
29
|
export interface TurnResult {
|
|
34
30
|
status: TurnStatus;
|
|
31
|
+
/** Distinguishes a real user cancel from an internal absolute deadline. */
|
|
32
|
+
abortReason?: 'user' | 'turn-deadline';
|
|
35
33
|
/** Bounded, safe completion evidence (no raw commands/output). Additive. */
|
|
36
34
|
evidence?: TurnCompletionEvidence;
|
|
37
35
|
/**
|
|
@@ -57,7 +55,7 @@ export interface TurnResult {
|
|
|
57
55
|
} | IncompleteGoalResume;
|
|
58
56
|
}
|
|
59
57
|
/** Supervisor-provided logical-goal context: tags checkpoints and seeds cumulative evidence. */
|
|
60
|
-
|
|
58
|
+
interface TurnGoalContext {
|
|
61
59
|
goalId: string;
|
|
62
60
|
/** 1-based physical-turn counter for the logical goal. */
|
|
63
61
|
cycle: number;
|
|
@@ -92,16 +90,6 @@ export interface TurnExecutionOptions {
|
|
|
92
90
|
executionScope?: TurnExecutionScope;
|
|
93
91
|
};
|
|
94
92
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Restrict a tool set to the capabilities permitted in a completion-rescue
|
|
97
|
-
* slice: mutation (edit/write/replace) and validation-capable (bash) built-in
|
|
98
|
-
* tools only. Discovery, read, coordinate, and all third-party (MCP) tools are
|
|
99
|
-
* dropped so the rescue cannot reopen exploration. May return an empty set
|
|
100
|
-
* when no built-in mutation/validation tools exist (only possible if builtins
|
|
101
|
-
* were removed); the caller then forces a tool-free synthesis slice instead
|
|
102
|
-
* of silently keeping the unfiltered tool set (F-08).
|
|
103
|
-
*/
|
|
104
|
-
export declare function restrictToRescueTools(tools: ToolSet): ToolSet;
|
|
105
93
|
export interface StreamCallbacks {
|
|
106
94
|
addMessage: (msg: Message) => void;
|
|
107
95
|
updateMessage: (id: string, update: Partial<Message>) => void;
|
|
@@ -123,3 +111,4 @@ export interface StreamCallbacks {
|
|
|
123
111
|
contextFileSignatures?: Map<string, string>;
|
|
124
112
|
}
|
|
125
113
|
export declare function runAgentTurn(value: string, displayValue: string | undefined, contextFiles: ContextFile[], callbacks: StreamCallbacks, retryAttempt?: number, retryingExistingRequest?: boolean, contextOverflowRecovered?: boolean, session?: PromptSession, modelOverride?: string, turnOptions?: TurnExecutionOptions): Promise<TurnResult>;
|
|
114
|
+
export {};
|