@denizokcu/haze 0.5.0 → 0.7.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 +36 -1
- package/README.md +101 -24
- package/dist/cli/chat/TaskBar.d.ts +9 -0
- package/dist/cli/chat/TaskBar.js +40 -0
- package/dist/cli/chat/chatMetrics.d.ts +11 -0
- package/dist/cli/chat/chatMetrics.js +50 -0
- package/dist/cli/chat/inputSuggestions.d.ts +16 -0
- package/dist/cli/chat/inputSuggestions.js +55 -0
- package/dist/cli/chat/messages.d.ts +9 -0
- package/dist/cli/chat/messages.js +76 -0
- package/dist/cli/chat/sessionRecorder.d.ts +12 -0
- package/dist/cli/chat/sessionRecorder.js +21 -0
- package/dist/cli/chat/startupInfo.d.ts +4 -0
- package/dist/cli/chat/startupInfo.js +53 -0
- package/dist/cli/chat/turnState.d.ts +5 -0
- package/dist/cli/chat/turnState.js +20 -0
- package/dist/cli/commands/chat.d.ts +0 -1
- package/dist/cli/commands/chat.js +519 -495
- package/dist/cli/commands/chatModes.d.ts +8 -0
- package/dist/cli/commands/chatModes.js +44 -0
- package/dist/cli/commands/commandHelp.d.ts +6 -0
- package/dist/cli/commands/commandHelp.js +25 -0
- package/dist/cli/commands/commands.d.ts +3 -2
- package/dist/cli/commands/commands.js +55 -320
- package/dist/cli/commands/formatters.d.ts +27 -0
- package/dist/cli/commands/formatters.js +149 -4
- package/dist/cli/commands/initCommand.d.ts +2 -0
- package/dist/cli/commands/initCommand.js +19 -0
- package/dist/cli/commands/logsCommand.d.ts +2 -0
- package/dist/cli/commands/logsCommand.js +63 -0
- package/dist/cli/commands/lspWizard.d.ts +14 -0
- package/dist/cli/commands/lspWizard.js +44 -0
- package/dist/cli/commands/mcpWizard.d.ts +15 -0
- package/dist/cli/commands/mcpWizard.js +69 -0
- package/dist/cli/commands/modelCommand.d.ts +2 -0
- package/dist/cli/commands/modelCommand.js +36 -0
- package/dist/cli/commands/providerWizard.d.ts +30 -0
- package/dist/cli/commands/providerWizard.js +114 -0
- package/dist/cli/commands/runCommand.d.ts +16 -0
- package/dist/cli/commands/runCommand.js +170 -0
- package/dist/cli/commands/settingsSummary.d.ts +3 -0
- package/dist/cli/commands/settingsSummary.js +40 -0
- package/dist/cli/commands/skillConfirmRemove.d.ts +11 -0
- package/dist/cli/commands/skillConfirmRemove.js +19 -0
- package/dist/cli/commands/skillCreation.d.ts +12 -0
- package/dist/cli/commands/skillCreation.js +14 -0
- package/dist/cli/commands/skillWizard.d.ts +15 -0
- package/dist/cli/commands/skillWizard.js +38 -0
- package/dist/cli/commands/streaming/assistantText.d.ts +17 -0
- package/dist/cli/commands/streaming/assistantText.js +115 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +55 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.js +102 -0
- package/dist/cli/commands/streaming/toolResultState.d.ts +13 -0
- package/dist/cli/commands/streaming/toolResultState.js +25 -0
- package/dist/cli/commands/streaming/turnRuntime.d.ts +78 -0
- package/dist/cli/commands/streaming/turnRuntime.js +86 -0
- package/dist/cli/commands/streaming.d.ts +10 -29
- package/dist/cli/commands/streaming.js +249 -911
- package/dist/cli/commands/wizardActions.d.ts +40 -0
- package/dist/cli/commands/wizardActions.js +40 -0
- package/dist/cli/commands/wizardInput.d.ts +4 -0
- package/dist/cli/commands/wizardInput.js +19 -0
- package/dist/cli/commands/wizardPrompts.d.ts +22 -0
- package/dist/cli/commands/wizardPrompts.js +52 -0
- package/dist/cli/commands/wizardSuggestions.d.ts +23 -0
- package/dist/cli/commands/wizardSuggestions.js +139 -0
- package/dist/cli/index.js +62 -4
- package/dist/config/contextFiles.d.ts +8 -1
- package/dist/config/contextFiles.js +25 -12
- package/dist/config/lspSettings.d.ts +16 -0
- package/dist/config/lspSettings.js +95 -0
- package/dist/config/mcpSettings.d.ts +24 -0
- package/dist/config/mcpSettings.js +100 -0
- package/dist/config/providers.js +4 -4
- package/dist/config/settings.d.ts +34 -0
- package/dist/config/skillSettings.d.ts +15 -0
- package/dist/config/skillSettings.js +32 -0
- package/dist/config/updateCheck.d.ts +44 -0
- package/dist/config/updateCheck.js +83 -0
- package/dist/core/agent/budgets.d.ts +6 -0
- package/dist/core/agent/budgets.js +6 -0
- package/dist/core/agent/compaction.js +1 -1
- package/dist/core/agent/requestAssembly.d.ts +0 -7
- package/dist/core/agent/requestAssembly.js +27 -5
- package/dist/core/agent/toolOutputStore.js +5 -4
- package/dist/core/agent/toolResults.d.ts +31 -0
- package/dist/core/agent/toolResults.js +42 -0
- package/dist/core/agent/turnPolicy.d.ts +8 -0
- package/dist/core/agent/turnPolicy.js +23 -0
- package/dist/core/agent/workState.d.ts +18 -5
- package/dist/core/agent/workState.js +39 -20
- package/dist/core/bashOutput/reducers/content.d.ts +1 -0
- package/dist/core/bashOutput/reducers/content.js +1 -1
- package/dist/core/bashOutput/reducers/gh.d.ts +1 -0
- package/dist/core/bashOutput/reducers/gh.js +77 -0
- package/dist/core/bashOutput/registry.js +8 -0
- package/dist/core/goal/sessionGoal.d.ts +6 -30
- package/dist/core/goal/sessionGoal.js +3 -68
- package/dist/core/safety/bashClassifier.js +30 -0
- package/dist/core/safety/urlGuard.d.ts +1 -0
- package/dist/core/safety/urlGuard.js +6 -1
- package/dist/core/session/sessionSlimming.d.ts +5 -0
- package/dist/core/session/sessionSlimming.js +78 -0
- package/dist/core/session/sessionStore.d.ts +23 -3
- package/dist/core/session/sessionStore.js +30 -10
- package/dist/core/subagent/subagentRunner.d.ts +11 -1
- package/dist/core/subagent/subagentRunner.js +1 -0
- package/dist/llm/capabilities.d.ts +12 -0
- package/dist/llm/capabilities.js +10 -0
- package/dist/llm/client.d.ts +1 -0
- package/dist/llm/client.js +11 -2
- package/dist/llm/hazeTools.d.ts +31 -32
- package/dist/llm/hazeTools.js +40 -567
- package/dist/llm/lsp.d.ts +109 -0
- package/dist/llm/lsp.js +241 -0
- package/dist/llm/lspTools.d.ts +104 -0
- package/dist/llm/lspTools.js +115 -0
- package/dist/llm/mcp.d.ts +19 -0
- package/dist/llm/mcp.js +73 -0
- package/dist/llm/requestContext.d.ts +28 -0
- package/dist/llm/requestContext.js +41 -0
- package/dist/llm/systemPrompt.d.ts +5 -1
- package/dist/llm/systemPrompt.js +9 -3
- package/dist/llm/tools/bashTool.d.ts +5 -0
- package/dist/llm/tools/bashTool.js +81 -0
- package/dist/llm/tools/editMatch.d.ts +55 -0
- package/dist/llm/tools/editMatch.js +99 -0
- package/dist/llm/tools/failures.d.ts +36 -0
- package/dist/llm/tools/failures.js +38 -0
- package/dist/llm/tools/fetchTool.d.ts +65 -0
- package/dist/llm/tools/fetchTool.js +45 -0
- package/dist/llm/tools/fileToolShared.d.ts +10 -0
- package/dist/llm/tools/fileToolShared.js +43 -0
- package/dist/llm/tools/grepParse.d.ts +13 -0
- package/dist/llm/tools/grepParse.js +67 -0
- package/dist/llm/tools/outputCap.d.ts +53 -0
- package/dist/llm/tools/outputCap.js +67 -0
- package/dist/llm/tools/storedOutputTool.d.ts +10 -0
- package/dist/llm/tools/storedOutputTool.js +17 -0
- package/dist/llm/tools/taskTool.d.ts +28 -0
- package/dist/llm/tools/taskTool.js +41 -0
- package/dist/llm/tools/toolContext.d.ts +69 -0
- package/dist/llm/tools/toolContext.js +187 -0
- package/dist/llm/tools/workspaceFile.d.ts +33 -0
- package/dist/llm/tools/workspaceFile.js +27 -0
- package/dist/llm/webFetch.d.ts +13 -1
- package/dist/llm/webFetch.js +91 -7
- package/dist/skills/builder/SkillBuilder.d.ts +3 -0
- package/dist/skills/builder/SkillBuilder.js +24 -45
- package/dist/ui/components/TextInput.d.ts +1 -1
- package/dist/ui/components/TextInput.js +1 -99
- package/dist/ui/inputBuffer.d.ts +28 -0
- package/dist/ui/inputBuffer.js +99 -0
- package/dist/utils/collections.d.ts +6 -0
- package/dist/utils/collections.js +9 -0
- package/dist/utils/path.d.ts +2 -0
- package/dist/utils/path.js +40 -0
- package/dist/utils/version.d.ts +20 -0
- package/dist/utils/version.js +72 -0
- package/package.json +2 -2
- package/dist/cli/commands/skills.d.ts +0 -4
- package/dist/cli/commands/skills.js +0 -38
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HazeMcpServer, HazeSettings } from './settings.js';
|
|
2
|
+
export type McpTransport = 'http' | 'sse' | 'stdio';
|
|
3
|
+
/**
|
|
4
|
+
* Presets for well-known MCP servers. Keys are stable preset identifiers users
|
|
5
|
+
* can select from the `/mcp add` flow. Omit `name`; it is supplied by the caller.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MCP_PRESETS: Record<string, Omit<HazeMcpServer, 'name'> & {
|
|
8
|
+
description?: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function presetIds(): string[];
|
|
11
|
+
export declare function findMcpPreset(id: string): (Omit<HazeMcpServer, 'name'> & {
|
|
12
|
+
description?: string;
|
|
13
|
+
}) | undefined;
|
|
14
|
+
export declare function isTransport(value: unknown): value is McpTransport;
|
|
15
|
+
/**
|
|
16
|
+
* Normalize and validate an MCP server definition. Returns undefined when the
|
|
17
|
+
* definition is missing required fields for its transport.
|
|
18
|
+
*/
|
|
19
|
+
export declare function normalizeServer(server: HazeMcpServer): HazeMcpServer | undefined;
|
|
20
|
+
export declare function configuredMcpServers(settings: HazeSettings): HazeMcpServer[];
|
|
21
|
+
export declare function findMcpServer(settings: HazeSettings, name: string): HazeMcpServer | undefined;
|
|
22
|
+
export declare function upsertMcpServer(settings: HazeSettings, server: HazeMcpServer): HazeMcpServer[];
|
|
23
|
+
export declare function removeMcpServer(settings: HazeSettings, name: string): HazeMcpServer[];
|
|
24
|
+
export declare function toggleMcpServer(settings: HazeSettings, name: string, enabled: boolean): HazeMcpServer[] | undefined;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { findByName, removeByName, upsertByName } from '../utils/collections.js';
|
|
2
|
+
const TRANSPORTS = ['http', 'sse', 'stdio'];
|
|
3
|
+
/**
|
|
4
|
+
* Presets for well-known MCP servers. Keys are stable preset identifiers users
|
|
5
|
+
* can select from the `/mcp add` flow. Omit `name`; it is supplied by the caller.
|
|
6
|
+
*/
|
|
7
|
+
export const MCP_PRESETS = {
|
|
8
|
+
context7: { transport: 'http', url: 'https://mcp.context7.com/mcp', description: 'Context7 — up-to-date library docs' },
|
|
9
|
+
};
|
|
10
|
+
export function presetIds() {
|
|
11
|
+
return Object.keys(MCP_PRESETS);
|
|
12
|
+
}
|
|
13
|
+
export function findMcpPreset(id) {
|
|
14
|
+
return MCP_PRESETS[id];
|
|
15
|
+
}
|
|
16
|
+
export function isTransport(value) {
|
|
17
|
+
return typeof value === 'string' && TRANSPORTS.includes(value);
|
|
18
|
+
}
|
|
19
|
+
function normalizeStringArray(values) {
|
|
20
|
+
if (!Array.isArray(values))
|
|
21
|
+
return undefined;
|
|
22
|
+
const result = values
|
|
23
|
+
.filter((value) => typeof value === 'string')
|
|
24
|
+
.map(value => value.trim())
|
|
25
|
+
.filter(Boolean);
|
|
26
|
+
return [...new Set(result)];
|
|
27
|
+
}
|
|
28
|
+
function normalizeHeaders(headers) {
|
|
29
|
+
if (!Array.isArray(headers))
|
|
30
|
+
return undefined;
|
|
31
|
+
const result = [];
|
|
32
|
+
for (const header of headers) {
|
|
33
|
+
if (typeof header !== 'object' || header == null)
|
|
34
|
+
continue;
|
|
35
|
+
const candidate = header;
|
|
36
|
+
if (typeof candidate.name !== 'string' || typeof candidate.value !== 'string')
|
|
37
|
+
continue;
|
|
38
|
+
const name = candidate.name.trim();
|
|
39
|
+
if (!name)
|
|
40
|
+
continue;
|
|
41
|
+
result.push({ name, value: candidate.value });
|
|
42
|
+
}
|
|
43
|
+
return result.length > 0 ? result : undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Normalize and validate an MCP server definition. Returns undefined when the
|
|
47
|
+
* definition is missing required fields for its transport.
|
|
48
|
+
*/
|
|
49
|
+
export function normalizeServer(server) {
|
|
50
|
+
const name = server.name?.trim();
|
|
51
|
+
const transport = isTransport(server.transport) ? server.transport : undefined;
|
|
52
|
+
if (!name || !transport)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (transport === 'http' || transport === 'sse') {
|
|
55
|
+
const url = server.url?.trim();
|
|
56
|
+
if (!url)
|
|
57
|
+
return undefined;
|
|
58
|
+
const headers = normalizeHeaders(server.headers);
|
|
59
|
+
return {
|
|
60
|
+
name,
|
|
61
|
+
transport,
|
|
62
|
+
url,
|
|
63
|
+
...(headers ? { headers } : {}),
|
|
64
|
+
...(server.enabled === false ? { enabled: false } : {}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// stdio
|
|
68
|
+
const command = server.command?.trim();
|
|
69
|
+
if (!command)
|
|
70
|
+
return undefined;
|
|
71
|
+
const args = normalizeStringArray(server.args);
|
|
72
|
+
return {
|
|
73
|
+
name,
|
|
74
|
+
transport,
|
|
75
|
+
command,
|
|
76
|
+
...(args && args.length > 0 ? { args } : {}),
|
|
77
|
+
...(server.enabled === false ? { enabled: false } : {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function configuredMcpServers(settings) {
|
|
81
|
+
return (settings.mcpServers ?? [])
|
|
82
|
+
.map(server => normalizeServer(server))
|
|
83
|
+
.filter((server) => Boolean(server));
|
|
84
|
+
}
|
|
85
|
+
export function findMcpServer(settings, name) {
|
|
86
|
+
return findByName(configuredMcpServers(settings), name);
|
|
87
|
+
}
|
|
88
|
+
export function upsertMcpServer(settings, server) {
|
|
89
|
+
return upsertByName(configuredMcpServers(settings), server);
|
|
90
|
+
}
|
|
91
|
+
export function removeMcpServer(settings, name) {
|
|
92
|
+
return removeByName(configuredMcpServers(settings), name);
|
|
93
|
+
}
|
|
94
|
+
export function toggleMcpServer(settings, name, enabled) {
|
|
95
|
+
const servers = configuredMcpServers(settings);
|
|
96
|
+
const target = findByName(servers, name);
|
|
97
|
+
if (!target)
|
|
98
|
+
return undefined;
|
|
99
|
+
return upsertMcpServer(settings, { ...target, enabled });
|
|
100
|
+
}
|
package/dist/config/providers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findByName, upsertByName } from '../utils/collections.js';
|
|
1
2
|
// Used only to migrate legacy single-provider OpenRouter settings (apiKey/baseURL)
|
|
2
3
|
// into the providers array. There is no default provider or model anymore: users
|
|
3
4
|
// must configure a provider themselves via /provider.
|
|
@@ -43,7 +44,7 @@ export function configuredProviders(settings) {
|
|
|
43
44
|
return providers;
|
|
44
45
|
}
|
|
45
46
|
export function findProvider(settings, name) {
|
|
46
|
-
return configuredProviders(settings)
|
|
47
|
+
return findByName(configuredProviders(settings), name);
|
|
47
48
|
}
|
|
48
49
|
export function activeProvider(settings) {
|
|
49
50
|
const providers = configuredProviders(settings);
|
|
@@ -55,7 +56,7 @@ export function activeModel(settings) {
|
|
|
55
56
|
return undefined;
|
|
56
57
|
const model = settings.model && provider.models.includes(settings.model)
|
|
57
58
|
? settings.model
|
|
58
|
-
:
|
|
59
|
+
: provider.models[0];
|
|
59
60
|
if (!model)
|
|
60
61
|
return undefined;
|
|
61
62
|
return { provider, model };
|
|
@@ -84,8 +85,7 @@ export function modelSelector(provider, model) {
|
|
|
84
85
|
return `${provider.name}:${model}`;
|
|
85
86
|
}
|
|
86
87
|
export function upsertProvider(settings, provider) {
|
|
87
|
-
|
|
88
|
-
return [...providers, provider];
|
|
88
|
+
return upsertByName(configuredProviders(settings), provider);
|
|
89
89
|
}
|
|
90
90
|
export function providerHasKey(settings, provider) {
|
|
91
91
|
return Boolean(provider.key ?? (provider.name === 'openrouter' ? settings.apiKey : undefined));
|
|
@@ -4,10 +4,44 @@ export interface HazeProviderSettings {
|
|
|
4
4
|
key?: string;
|
|
5
5
|
models: string[];
|
|
6
6
|
}
|
|
7
|
+
export interface HazeLspServerSettings {
|
|
8
|
+
name: string;
|
|
9
|
+
command: string;
|
|
10
|
+
args?: string[];
|
|
11
|
+
extensions?: string[];
|
|
12
|
+
rootPatterns?: string[];
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface HazeMcpHeader {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
export interface HazeMcpServer {
|
|
20
|
+
name: string;
|
|
21
|
+
transport: 'http' | 'sse' | 'stdio';
|
|
22
|
+
url?: string;
|
|
23
|
+
command?: string;
|
|
24
|
+
args?: string[];
|
|
25
|
+
headers?: HazeMcpHeader[];
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Metadata override for an on-disk skill. The skill directory (~/.haze/skills/<name>)
|
|
30
|
+
* remains the source of truth for existence and content; this index only records
|
|
31
|
+
* overrides. A skill is enabled unless an entry here sets `enabled: false`, mirroring
|
|
32
|
+
* the enable/disable toggle the provider/LSP/MCP pickers expose.
|
|
33
|
+
*/
|
|
34
|
+
export interface HazeSkillSetting {
|
|
35
|
+
name: string;
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
}
|
|
7
38
|
export interface HazeSettings {
|
|
8
39
|
provider?: string;
|
|
9
40
|
model?: string;
|
|
10
41
|
providers?: HazeProviderSettings[];
|
|
42
|
+
lspServers?: HazeLspServerSettings[];
|
|
43
|
+
mcpServers?: HazeMcpServer[];
|
|
44
|
+
skills?: HazeSkillSetting[];
|
|
11
45
|
apiKey?: string;
|
|
12
46
|
baseURL?: string;
|
|
13
47
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HazeSettings, HazeSkillSetting } from './settings.js';
|
|
2
|
+
/**
|
|
3
|
+
* Normalized skill metadata overrides. The list is override-only: only skills that
|
|
4
|
+
* deviate from the default (enabled) appear here, so it never desyncs from disk.
|
|
5
|
+
*/
|
|
6
|
+
export declare function configuredSkillSettings(settings: HazeSettings): HazeSkillSetting[];
|
|
7
|
+
/** A skill is enabled unless an explicit override disables it. */
|
|
8
|
+
export declare function isSkillEnabled(settings: HazeSettings, name: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Toggle a skill. Enabling clears its override (back to default); disabling records
|
|
11
|
+
* `enabled: false`. Returns the next `skills` array for updateSettings.
|
|
12
|
+
*/
|
|
13
|
+
export declare function setSkillEnabled(settings: HazeSettings, name: string, enabled: boolean): HazeSkillSetting[];
|
|
14
|
+
/** Drop a skill's override entry. Called when a skill directory is removed. */
|
|
15
|
+
export declare function removeSkillSetting(settings: HazeSettings, name: string): HazeSkillSetting[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { findByName, removeByName } from '../utils/collections.js';
|
|
2
|
+
/**
|
|
3
|
+
* Normalized skill metadata overrides. The list is override-only: only skills that
|
|
4
|
+
* deviate from the default (enabled) appear here, so it never desyncs from disk.
|
|
5
|
+
*/
|
|
6
|
+
export function configuredSkillSettings(settings) {
|
|
7
|
+
const result = [];
|
|
8
|
+
for (const entry of settings.skills ?? []) {
|
|
9
|
+
const name = entry.name?.trim();
|
|
10
|
+
if (!name)
|
|
11
|
+
continue;
|
|
12
|
+
result.push({ name, ...(entry.enabled === false ? { enabled: false } : {}) });
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
/** A skill is enabled unless an explicit override disables it. */
|
|
17
|
+
export function isSkillEnabled(settings, name) {
|
|
18
|
+
const entry = findByName(configuredSkillSettings(settings), name);
|
|
19
|
+
return entry ? entry.enabled !== false : true;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Toggle a skill. Enabling clears its override (back to default); disabling records
|
|
23
|
+
* `enabled: false`. Returns the next `skills` array for updateSettings.
|
|
24
|
+
*/
|
|
25
|
+
export function setSkillEnabled(settings, name, enabled) {
|
|
26
|
+
const others = removeByName(configuredSkillSettings(settings), name);
|
|
27
|
+
return enabled ? others : [...others, { name, enabled: false }];
|
|
28
|
+
}
|
|
29
|
+
/** Drop a skill's override entry. Called when a skill directory is removed. */
|
|
30
|
+
export function removeSkillSetting(settings, name) {
|
|
31
|
+
return removeByName(configuredSkillSettings(settings), name);
|
|
32
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const UPDATE_CHECK_FILE: string;
|
|
2
|
+
export interface UpdateCheckResult {
|
|
3
|
+
latestVersion: string;
|
|
4
|
+
isOutdated: boolean;
|
|
5
|
+
checkedAt: number;
|
|
6
|
+
}
|
|
7
|
+
interface UpdateCheckStore {
|
|
8
|
+
checkedAt?: number;
|
|
9
|
+
latestVersion?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the latest published version of a package. Defaults to shelling out
|
|
13
|
+
* to `npm view <pkg> version` so proxies/scopes/private registries from the
|
|
14
|
+
* user's `.npmrc` are respected. Injectable for deterministic tests.
|
|
15
|
+
*/
|
|
16
|
+
export type ExecVersionFn = (packageName: string, options: {
|
|
17
|
+
timeout: number;
|
|
18
|
+
}) => Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Non-blockingly check whether a newer version of `packageName` is published.
|
|
21
|
+
*
|
|
22
|
+
* Throttled by a small JSON store (`~/.haze/updateCheck.json`) so we hit the
|
|
23
|
+
* registry at most once per `intervalMs`. Within the window, the cached
|
|
24
|
+
* `latestVersion` is reused (and recompared against `currentVersion` so a user
|
|
25
|
+
* who updates without clearing the cache still gets correct status).
|
|
26
|
+
*
|
|
27
|
+
* Every failure mode (no npm, offline, timeout, 404, malformed output, store
|
|
28
|
+
* read/write error) resolves to `undefined` — the caller never sees an error.
|
|
29
|
+
*
|
|
30
|
+
* Everything except `currentVersion` and `packageName` is injectable so the
|
|
31
|
+
* spawn/timeout/throttle logic is testable without network or the filesystem.
|
|
32
|
+
*/
|
|
33
|
+
export declare function checkForUpdate(input: {
|
|
34
|
+
currentVersion: string;
|
|
35
|
+
packageName: string;
|
|
36
|
+
now?: number;
|
|
37
|
+
intervalMs?: number;
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
storePath?: string;
|
|
40
|
+
exec?: ExecVersionFn;
|
|
41
|
+
readStoreFn?: (file: string) => Promise<UpdateCheckStore>;
|
|
42
|
+
writeStoreFn?: (file: string, store: UpdateCheckStore) => Promise<void>;
|
|
43
|
+
}): Promise<UpdateCheckResult | undefined>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { execFile as execFileCallback } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { HAZE_DIR } from './paths.js';
|
|
6
|
+
import { isNewer } from '../utils/version.js';
|
|
7
|
+
const execFile = promisify(execFileCallback);
|
|
8
|
+
export const UPDATE_CHECK_FILE = path.join(HAZE_DIR, 'updateCheck.json');
|
|
9
|
+
const DEFAULT_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24h
|
|
10
|
+
const DEFAULT_TIMEOUT_MS = 5000;
|
|
11
|
+
async function defaultExecVersion(packageName, options) {
|
|
12
|
+
const { stdout } = await execFile('npm', ['view', packageName, 'version'], { timeout: options.timeout });
|
|
13
|
+
return stdout;
|
|
14
|
+
}
|
|
15
|
+
async function defaultReadStore(file) {
|
|
16
|
+
return fs.readJson(file).catch(() => ({}));
|
|
17
|
+
}
|
|
18
|
+
async function defaultWriteStore(file, store) {
|
|
19
|
+
await fs.ensureDir(path.dirname(file));
|
|
20
|
+
await fs.writeJson(file, store, { spaces: 2 });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Non-blockingly check whether a newer version of `packageName` is published.
|
|
24
|
+
*
|
|
25
|
+
* Throttled by a small JSON store (`~/.haze/updateCheck.json`) so we hit the
|
|
26
|
+
* registry at most once per `intervalMs`. Within the window, the cached
|
|
27
|
+
* `latestVersion` is reused (and recompared against `currentVersion` so a user
|
|
28
|
+
* who updates without clearing the cache still gets correct status).
|
|
29
|
+
*
|
|
30
|
+
* Every failure mode (no npm, offline, timeout, 404, malformed output, store
|
|
31
|
+
* read/write error) resolves to `undefined` — the caller never sees an error.
|
|
32
|
+
*
|
|
33
|
+
* Everything except `currentVersion` and `packageName` is injectable so the
|
|
34
|
+
* spawn/timeout/throttle logic is testable without network or the filesystem.
|
|
35
|
+
*/
|
|
36
|
+
export async function checkForUpdate(input) {
|
|
37
|
+
const now = input.now ?? Date.now();
|
|
38
|
+
const intervalMs = input.intervalMs ?? DEFAULT_INTERVAL_MS;
|
|
39
|
+
const timeoutMs = input.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
40
|
+
const storePath = input.storePath ?? UPDATE_CHECK_FILE;
|
|
41
|
+
const exec = input.exec ?? defaultExecVersion;
|
|
42
|
+
const readStoreFn = input.readStoreFn ?? defaultReadStore;
|
|
43
|
+
const writeStoreFn = input.writeStoreFn ?? defaultWriteStore;
|
|
44
|
+
let store;
|
|
45
|
+
try {
|
|
46
|
+
store = await readStoreFn(storePath);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
store = {};
|
|
50
|
+
}
|
|
51
|
+
// Within the throttle window: reuse the cached latestVersion without spawning npm.
|
|
52
|
+
if (typeof store.checkedAt === 'number' &&
|
|
53
|
+
typeof store.latestVersion === 'string' &&
|
|
54
|
+
now - store.checkedAt < intervalMs) {
|
|
55
|
+
return {
|
|
56
|
+
latestVersion: store.latestVersion,
|
|
57
|
+
isOutdated: isNewer(store.latestVersion, input.currentVersion),
|
|
58
|
+
checkedAt: store.checkedAt,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
let latestVersion;
|
|
62
|
+
try {
|
|
63
|
+
const raw = await exec(input.packageName, { timeout: timeoutMs });
|
|
64
|
+
latestVersion = (raw.split(/\r?\n/)[0] ?? '').trim();
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
if (!latestVersion)
|
|
70
|
+
return undefined;
|
|
71
|
+
const checkedAt = now;
|
|
72
|
+
try {
|
|
73
|
+
await writeStoreFn(storePath, { checkedAt, latestVersion });
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Store write failure is non-fatal; we still report the fresh result.
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
latestVersion,
|
|
80
|
+
isOutdated: isNewer(latestVersion, input.currentVersion),
|
|
81
|
+
checkedAt,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const DEFAULT_MAX_OUTPUT_TOKENS = 16384;
|
|
2
|
+
export declare const IDLE_TIMEOUT_MS: number;
|
|
3
|
+
export declare const MAIN_STEP_LIMIT = 64;
|
|
4
|
+
export declare const MAIN_TOOL_CALL_LIMIT = 120;
|
|
5
|
+
export declare const MAIN_TOOL_ONLY_STEP_LIMIT = 24;
|
|
6
|
+
export declare const ACTIVE_CONTEXT_TOKEN_BUDGET = 40000;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const DEFAULT_MAX_OUTPUT_TOKENS = 16384;
|
|
2
|
+
export const IDLE_TIMEOUT_MS = 5 * 60_000;
|
|
3
|
+
export const MAIN_STEP_LIMIT = 64;
|
|
4
|
+
export const MAIN_TOOL_CALL_LIMIT = 120;
|
|
5
|
+
export const MAIN_TOOL_ONLY_STEP_LIMIT = 24;
|
|
6
|
+
export const ACTIVE_CONTEXT_TOKEN_BUDGET = 40_000;
|
|
@@ -34,7 +34,7 @@ export function compactModelMessages(messages, options = {}) {
|
|
|
34
34
|
const recent = messages.slice(recentStart);
|
|
35
35
|
const oldText = older.map(message => {
|
|
36
36
|
const text = modelMessageText(message).replace(/\s+/g, ' ').trim();
|
|
37
|
-
return text ? `- ${message.role}: ${text
|
|
37
|
+
return text ? `- ${message.role}: ${text}` : '';
|
|
38
38
|
}).filter(Boolean).join('\n');
|
|
39
39
|
const summary = [
|
|
40
40
|
'Compacted prior Haze conversation. Treat this as continuity context, not a new user request.',
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import type { ModelMessage } from 'ai';
|
|
2
2
|
export declare const SYNTHETIC_CONTROL_OPEN = "<haze_control>";
|
|
3
|
-
export declare function toolRequestSettings<T extends Record<string, unknown>>(tools: T, allowTools: boolean): {
|
|
4
|
-
tools: T;
|
|
5
|
-
toolChoice: "auto";
|
|
6
|
-
} | {
|
|
7
|
-
tools?: undefined;
|
|
8
|
-
toolChoice?: undefined;
|
|
9
|
-
};
|
|
10
3
|
export declare function isSyntheticControlMessage(message: ModelMessage): boolean;
|
|
11
4
|
export declare function stripSyntheticControls(messages: ModelMessage[]): ModelMessage[];
|
|
12
5
|
export declare function withSyntheticControl(messages: ModelMessage[], control: string): ModelMessage[];
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { estimateValueTokens } from './contextBudget.js';
|
|
2
|
+
import { isFailedToolOutput } from './toolResults.js';
|
|
2
3
|
export const SYNTHETIC_CONTROL_OPEN = '<haze_control>';
|
|
3
|
-
export function toolRequestSettings(tools, allowTools) {
|
|
4
|
-
return allowTools ? { tools, toolChoice: 'auto' } : {};
|
|
5
|
-
}
|
|
6
4
|
export function isSyntheticControlMessage(message) {
|
|
7
5
|
return message.role === 'user'
|
|
8
6
|
&& typeof message.content === 'string'
|
|
@@ -29,7 +27,7 @@ function isFailedResult(output) {
|
|
|
29
27
|
if (type === 'error-text' || type === 'error-json' || type === 'execution-denied')
|
|
30
28
|
return true;
|
|
31
29
|
const value = resultValue(output);
|
|
32
|
-
return
|
|
30
|
+
return isFailedToolOutput(value);
|
|
33
31
|
}
|
|
34
32
|
function compactJsonValue(value, toolName) {
|
|
35
33
|
if (typeof value !== 'object' || value == null || Array.isArray(value)) {
|
|
@@ -80,7 +78,7 @@ function compactResultOutput(output, toolName) {
|
|
|
80
78
|
return { ...typed, value: `[Older successful ${toolName} result omitted from active context.]` };
|
|
81
79
|
return output;
|
|
82
80
|
}
|
|
83
|
-
const COMPACTABLE_INPUT_TOOLS = new Set(['writeFile', 'bash']);
|
|
81
|
+
const COMPACTABLE_INPUT_TOOLS = new Set(['writeFile', 'editFile', 'replaceLines', 'bash']);
|
|
84
82
|
const BASH_COMMAND_TRUNCATE_THRESHOLD = 200;
|
|
85
83
|
const BASH_COMMAND_KEEP_CHARS = 150;
|
|
86
84
|
function compactToolCallInput(input, toolName) {
|
|
@@ -95,6 +93,30 @@ function compactToolCallInput(input, toolName) {
|
|
|
95
93
|
content: `[Compacted: original ${bytes} bytes. Use readFile on "${path}" to inspect.]`,
|
|
96
94
|
};
|
|
97
95
|
}
|
|
96
|
+
if (toolName === 'editFile' && Array.isArray(source.edits)) {
|
|
97
|
+
const path = typeof source.path === 'string' ? source.path : '<unknown>';
|
|
98
|
+
const edits = source.edits.map(edit => {
|
|
99
|
+
if (typeof edit !== 'object' || edit == null)
|
|
100
|
+
return edit;
|
|
101
|
+
const entry = edit;
|
|
102
|
+
const oldBytes = typeof entry.oldText === 'string' ? entry.oldText.length : 0;
|
|
103
|
+
const newBytes = typeof entry.newText === 'string' ? entry.newText.length : 0;
|
|
104
|
+
return {
|
|
105
|
+
...entry,
|
|
106
|
+
oldText: `[Compacted: original ${oldBytes} bytes.]`,
|
|
107
|
+
newText: `[Compacted: original ${newBytes} bytes. Use readFile on "${path}" to inspect.]`,
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
return { ...source, edits };
|
|
111
|
+
}
|
|
112
|
+
if (toolName === 'replaceLines' && typeof source.content === 'string') {
|
|
113
|
+
const bytes = source.content.length;
|
|
114
|
+
const path = typeof source.path === 'string' ? source.path : '<unknown>';
|
|
115
|
+
return {
|
|
116
|
+
...source,
|
|
117
|
+
content: `[Compacted: original ${bytes} bytes. Use readFile on "${path}" to inspect.]`,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
98
120
|
if (toolName === 'bash' && typeof source.command === 'string' && source.command.length > BASH_COMMAND_TRUNCATE_THRESHOLD) {
|
|
99
121
|
const total = source.command.length;
|
|
100
122
|
const truncated = source.command.slice(0, BASH_COMMAND_KEEP_CHARS).replace(/\s+/g, ' ').trim();
|
|
@@ -4,11 +4,12 @@ const MAX_STORED_OUTPUTS = 100;
|
|
|
4
4
|
export function storeToolOutput(content) {
|
|
5
5
|
const handle = `output-${crypto.randomBytes(8).toString('hex')}`;
|
|
6
6
|
outputs.set(handle, content);
|
|
7
|
-
|
|
7
|
+
// Synchronous, so the check+delete is atomic across async callers — no race.
|
|
8
|
+
// Each call inserts exactly one entry, so a single eviction restores the cap.
|
|
9
|
+
if (outputs.size > MAX_STORED_OUTPUTS) {
|
|
8
10
|
const oldest = outputs.keys().next().value;
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
outputs.delete(oldest);
|
|
11
|
+
if (oldest)
|
|
12
|
+
outputs.delete(oldest);
|
|
12
13
|
}
|
|
13
14
|
return handle;
|
|
14
15
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, protocol-level predicates and accessors for tool outputs and inputs.
|
|
3
|
+
*
|
|
4
|
+
* Tool results across the codebase carry a loose `{ok?: boolean}` convention
|
|
5
|
+
* (built-in hazeTools, subagent summaries, MCP passthrough). Centralizing these
|
|
6
|
+
* checks keeps the semantics identical everywhere they are used: the dedup gate
|
|
7
|
+
* (`hazeTools`), the work-state observer, the agent turn, and request
|
|
8
|
+
* compaction. Keeping them in `core/agent/` (no `ai`/UI imports) preserves
|
|
9
|
+
* auditability.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A structured tool result explicitly reports failure via `{ok: false}`.
|
|
13
|
+
* Returns false for results with no `ok` field (success is implied by the
|
|
14
|
+
* caller's `success` flag) and for non-object outputs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isFailedToolOutput(output: unknown): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Combine the provider success flag with the structured `ok` field. A result
|
|
19
|
+
* counts as OK only when the call succeeded AND did not report `{ok: false}`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function toolOutputOk(output: unknown, success: boolean): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Read a string field from an `unknown` tool input object. Returns undefined
|
|
24
|
+
* for non-objects, missing keys, or non-string values.
|
|
25
|
+
*/
|
|
26
|
+
export declare function toolInputField(input: unknown, key: string): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Deduplicated read-only tool calls return a `{duplicateSkipped: true}` marker
|
|
29
|
+
* instead of re-running. Lets observers treat them as no-ops.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isDuplicateSkippedOutput(output: unknown): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, protocol-level predicates and accessors for tool outputs and inputs.
|
|
3
|
+
*
|
|
4
|
+
* Tool results across the codebase carry a loose `{ok?: boolean}` convention
|
|
5
|
+
* (built-in hazeTools, subagent summaries, MCP passthrough). Centralizing these
|
|
6
|
+
* checks keeps the semantics identical everywhere they are used: the dedup gate
|
|
7
|
+
* (`hazeTools`), the work-state observer, the agent turn, and request
|
|
8
|
+
* compaction. Keeping them in `core/agent/` (no `ai`/UI imports) preserves
|
|
9
|
+
* auditability.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A structured tool result explicitly reports failure via `{ok: false}`.
|
|
13
|
+
* Returns false for results with no `ok` field (success is implied by the
|
|
14
|
+
* caller's `success` flag) and for non-object outputs.
|
|
15
|
+
*/
|
|
16
|
+
export function isFailedToolOutput(output) {
|
|
17
|
+
return typeof output === 'object' && output != null && 'ok' in output && output.ok === false;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Combine the provider success flag with the structured `ok` field. A result
|
|
21
|
+
* counts as OK only when the call succeeded AND did not report `{ok: false}`.
|
|
22
|
+
*/
|
|
23
|
+
export function toolOutputOk(output, success) {
|
|
24
|
+
return success && !isFailedToolOutput(output);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Read a string field from an `unknown` tool input object. Returns undefined
|
|
28
|
+
* for non-objects, missing keys, or non-string values.
|
|
29
|
+
*/
|
|
30
|
+
export function toolInputField(input, key) {
|
|
31
|
+
if (typeof input !== 'object' || input == null || !(key in input))
|
|
32
|
+
return undefined;
|
|
33
|
+
const value = input[key];
|
|
34
|
+
return typeof value === 'string' ? value : undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Deduplicated read-only tool calls return a `{duplicateSkipped: true}` marker
|
|
38
|
+
* instead of re-running. Lets observers treat them as no-ops.
|
|
39
|
+
*/
|
|
40
|
+
export function isDuplicateSkippedOutput(output) {
|
|
41
|
+
return typeof output === 'object' && output != null && 'duplicateSkipped' in output && output.duplicateSkipped === true;
|
|
42
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function stableToolKey(toolCall) {
|
|
2
|
+
return `${toolCall.toolName}:${JSON.stringify(toolCall.input)}`;
|
|
3
|
+
}
|
|
4
|
+
export function uniqueRepeatedToolNames(toolCalls) {
|
|
5
|
+
const seen = new Set();
|
|
6
|
+
const repeated = new Set();
|
|
7
|
+
for (const toolCall of toolCalls) {
|
|
8
|
+
const key = stableToolKey(toolCall);
|
|
9
|
+
if (seen.has(key))
|
|
10
|
+
repeated.add(toolCall.toolName);
|
|
11
|
+
seen.add(key);
|
|
12
|
+
}
|
|
13
|
+
return [...repeated];
|
|
14
|
+
}
|
|
15
|
+
export function toolOnlyStepCount(steps) {
|
|
16
|
+
let count = 0;
|
|
17
|
+
for (const step of [...steps].reverse()) {
|
|
18
|
+
if (step.toolCalls.length === 0 || step.text.trim().length > 0)
|
|
19
|
+
break;
|
|
20
|
+
count += 1;
|
|
21
|
+
}
|
|
22
|
+
return count;
|
|
23
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { RequestIntent } from '../goal/requestClassifier.js';
|
|
2
2
|
export type WorkFileAction = 'read' | 'created' | 'modified';
|
|
3
|
-
export type WorkValidationStatus = 'passed' | 'failed';
|
|
3
|
+
export type WorkValidationStatus = 'pending' | 'passed' | 'failed';
|
|
4
|
+
export type WorkStatus = 'active' | 'needs-user' | 'blocked' | 'complete' | 'aborted';
|
|
5
|
+
export type WorkPhase = 'starting' | 'inspecting' | 'editing' | 'validating' | 'summarizing' | 'done';
|
|
4
6
|
export interface WorkState {
|
|
7
|
+
id: string;
|
|
5
8
|
goal: string;
|
|
9
|
+
originalUserRequest: string;
|
|
6
10
|
intent: RequestIntent;
|
|
11
|
+
normalizedIntent: RequestIntent;
|
|
7
12
|
successCriteria: string[];
|
|
8
13
|
constraints: string[];
|
|
9
14
|
decisions: Array<{
|
|
@@ -15,15 +20,23 @@ export interface WorkState {
|
|
|
15
20
|
action: WorkFileAction;
|
|
16
21
|
note?: string;
|
|
17
22
|
}>;
|
|
23
|
+
touchedFiles: string[];
|
|
18
24
|
validations: Array<{
|
|
19
25
|
command: string;
|
|
20
|
-
status: WorkValidationStatus
|
|
26
|
+
status: Exclude<WorkValidationStatus, 'pending'>;
|
|
21
27
|
summary: string;
|
|
22
28
|
}>;
|
|
29
|
+
validationCommands: Array<{
|
|
30
|
+
command: string;
|
|
31
|
+
status: WorkValidationStatus;
|
|
32
|
+
}>;
|
|
23
33
|
blockers: string[];
|
|
24
34
|
pending: string[];
|
|
25
35
|
nextAction?: string;
|
|
26
|
-
|
|
36
|
+
status: WorkStatus;
|
|
37
|
+
phase: WorkPhase;
|
|
38
|
+
blocker?: string;
|
|
39
|
+
lastProgressAt: number;
|
|
27
40
|
revision: number;
|
|
28
41
|
}
|
|
29
42
|
export interface WorkToolEvent {
|
|
@@ -33,6 +46,6 @@ export interface WorkToolEvent {
|
|
|
33
46
|
output?: unknown;
|
|
34
47
|
duplicateSkipped?: boolean;
|
|
35
48
|
}
|
|
36
|
-
export declare function createWorkState(goal: string, intent: RequestIntent, successCriteria: string[]): WorkState;
|
|
37
|
-
export declare function observeWorkToolEvent(state: WorkState, event: WorkToolEvent): WorkState;
|
|
49
|
+
export declare function createWorkState(goal: string, intent: RequestIntent, successCriteria: string[], now?: number): WorkState;
|
|
50
|
+
export declare function observeWorkToolEvent(state: WorkState, event: WorkToolEvent, now?: number): WorkState;
|
|
38
51
|
export declare function workStatePrompt(state: WorkState): string;
|