@denizokcu/haze 1.5.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +67 -3
- package/SECURITY.md +1 -1
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/DynamicFrame.d.ts +0 -13
- package/dist/cli/chat/DynamicFrame.js +1 -1
- package/dist/cli/chat/inputSuggestions.js +2 -0
- package/dist/cli/chat/terminalControl.d.ts +4 -2
- package/dist/cli/chat/terminalControl.js +16 -5
- package/dist/cli/chat/wizard/pluginHandlers.d.ts +10 -0
- package/dist/cli/chat/wizard/pluginHandlers.js +156 -0
- package/dist/cli/chat/wizard/skillsHandlers.js +2 -2
- package/dist/cli/chat/wizard/types.d.ts +20 -0
- package/dist/cli/chat/wizard/uiState.d.ts +25 -1
- package/dist/cli/chat/wizard/uiState.js +3 -1
- package/dist/cli/chat/wizardDispatch.js +6 -0
- package/dist/cli/commands/chat.js +18 -3
- package/dist/cli/commands/commandHelp.js +7 -2
- package/dist/cli/commands/commands.d.ts +5 -0
- package/dist/cli/commands/commands.js +17 -3
- package/dist/cli/commands/initCommand.js +3 -2
- package/dist/cli/commands/pluginCommand.d.ts +16 -0
- package/dist/cli/commands/pluginCommand.js +127 -0
- package/dist/cli/commands/reasoningCommand.d.ts +0 -15
- package/dist/cli/commands/reasoningCommand.js +1 -3
- package/dist/cli/commands/skillsWizard.js +4 -0
- package/dist/cli/commands/streaming/agentAttempt.js +2 -1
- package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -0
- package/dist/cli/commands/streaming/attemptOutcome.js +4 -3
- package/dist/cli/commands/streaming/attemptSetup.d.ts +2 -0
- package/dist/cli/commands/streaming/attemptSetup.js +3 -2
- package/dist/cli/commands/streaming/stallRecovery.d.ts +6 -0
- package/dist/cli/commands/streaming/stallRecovery.js +6 -5
- package/dist/cli/commands/streaming/turnRuntime.js +2 -4
- package/dist/cli/commands/wizardFlow.d.ts +59 -0
- package/dist/cli/commands/wizardFlow.js +40 -0
- package/dist/cli/contextReportCli.js +4 -3
- package/dist/cli/index.js +19 -2
- package/dist/config/contextFiles.js +3 -2
- package/dist/config/inputHistory.js +3 -3
- package/dist/config/paths.d.ts +1 -0
- package/dist/config/paths.js +1 -0
- package/dist/config/providerAuth.js +3 -3
- package/dist/config/settings.d.ts +10 -1
- package/dist/config/settings.js +7 -4
- package/dist/config/updateCheck.js +3 -3
- package/dist/core/agent/budgets.d.ts +17 -0
- package/dist/core/agent/budgets.js +19 -0
- package/dist/core/agent/reasoningPolicy.js +1 -1
- package/dist/core/agent/workState.d.ts +0 -2
- package/dist/core/agent/workState.js +1 -1
- package/dist/core/log/llmLog.js +1 -1
- package/dist/core/session/sessionStore.js +4 -3
- package/dist/core/subagent/contracts.d.ts +1 -11
- package/dist/core/subagent/contracts.js +0 -22
- package/dist/llm/client.js +2 -2
- package/dist/llm/subagentRunner.d.ts +1 -6
- package/dist/llm/subagentRunner.js +11 -23
- package/dist/llm/tools/fileTools.js +2 -3
- package/dist/llm/tools/gitIgnore.js +1 -1
- package/dist/llm/tools/grepRunner.d.ts +10 -0
- package/dist/llm/tools/grepRunner.js +24 -0
- package/dist/llm/tools/toolContext.d.ts +2 -3
- package/dist/llm/tools/toolContext.js +2 -3
- package/dist/llm/tools/toolContextState.d.ts +0 -1
- package/dist/llm/tools/toolContextState.js +1 -4
- package/dist/llm/workerContext.d.ts +0 -7
- package/dist/llm/workerContext.js +0 -17
- package/dist/skills/SkillLoader.js +3 -2
- package/dist/skills/SkillRegistry.js +7 -4
- package/dist/skills/builder/SkillBuilder.js +11 -10
- package/dist/skills/plugins/installer.d.ts +25 -0
- package/dist/skills/plugins/installer.js +272 -0
- package/dist/skills/plugins/package.d.ts +41 -0
- package/dist/skills/plugins/package.js +275 -0
- package/dist/skills/plugins/runtime.d.ts +3 -0
- package/dist/skills/plugins/runtime.js +108 -0
- package/dist/skills/skillTools.js +10 -5
- package/dist/skills/types.d.ts +4 -0
- package/dist/ui/codeHighlight.d.ts +1 -1
- package/dist/ui/codeHighlight.js +112 -4
- package/dist/ui/components/StreamingMarkdownText.d.ts +0 -2
- package/dist/ui/components/StreamingMarkdownText.js +1 -1
- package/dist/ui/components/TextInput.d.ts +1 -1
- package/dist/utils/fs.d.ts +10 -0
- package/dist/utils/fs.js +37 -2
- package/package.json +17 -20
|
@@ -3,15 +3,20 @@ export const COMMAND_HELP_ENTRIES = [
|
|
|
3
3
|
{ usage: '/provider', description: 'Choose a provider, then use it, add/remove models, set API key, toggle image input, or remove it.' },
|
|
4
4
|
{ usage: '/model', description: 'Choose a model, or add models from a provider\'s models endpoint.' },
|
|
5
5
|
{ usage: '/model <name-or-provider:name>', description: 'Set a model directly. Selecting a model also sets its provider.' },
|
|
6
|
+
{ usage: '/model list', description: 'List all configured models across providers.' },
|
|
6
7
|
{ usage: '/settings', description: 'Show the configured provider, model, API key status, LSP/MCP servers, skills, and loaded context files.' },
|
|
7
8
|
{ usage: '/settings open', description: 'Open ~/.haze/settings.json with the OS default app.' },
|
|
9
|
+
{ usage: '/settings edit', description: 'Open ~/.haze/settings.json in $VISUAL/$EDITOR in a fullscreen terminal handoff; falls back to the OS default app when no editor is configured. Restart haze to apply external changes.' },
|
|
8
10
|
{ usage: '/themes', description: 'Choose a terminal theme from the built-in registry (light palettes and oh-my-zsh ports included); applies immediately.' },
|
|
9
11
|
{ usage: '/themes <name>', description: 'Set the theme directly, e.g. /themes robbyrussell. Saved to ~/.haze/settings.json; text already on screen keeps its old colors.' },
|
|
10
12
|
{ usage: '/reasoning', description: 'Choose a reasoning effort level (none, minimal, low, medium, high, xhigh) for the active model, for this session; unset sends no parameter, reset falls back to the saved/default level.' },
|
|
11
|
-
{ usage: '/reasoning <level|unset|reset|status>', description: 'Set the reasoning effort for the active model for this session, send no parameter with unset, remove the override with reset, or show the current level with status.
|
|
13
|
+
{ usage: '/reasoning <level|unset|reset|status>', description: 'Set the reasoning effort for the active model for this session, send no parameter with unset, remove the override with reset, or show the current level with status. Low is the default. Endpoints without native support ignore the parameter.' },
|
|
12
14
|
{ usage: '/thinking', description: 'Alias for /reasoning. Choose a reasoning effort level (none, minimal, low, medium, high, xhigh) for the active model, for this session; unset sends no parameter, reset falls back to the saved/default level.' },
|
|
13
|
-
{ usage: '/thinking <level|unset|reset|status>', description: 'Alias for /reasoning. Set the reasoning effort for the active model for this session, send no parameter with unset, remove the override with reset, or show the current level with status.
|
|
15
|
+
{ usage: '/thinking <level|unset|reset|status>', description: 'Alias for /reasoning. Set the reasoning effort for the active model for this session, send no parameter with unset, remove the override with reset, or show the current level with status. Low is the default. Endpoints without native support ignore the parameter.' },
|
|
14
16
|
{ usage: '/skills', description: 'Manage Markdown skills: generate a custom skill, show info, enable/disable, validate, or remove.' },
|
|
17
|
+
{ usage: '/plugin', description: 'Open the plugin picker: install or inspect a local plugin/collection, or manage installed project plugins. /kit is an alias.' },
|
|
18
|
+
{ usage: '/plugin inspect|install <local-directory> [plugin-name]', description: 'Inspect or install a Claude/Agent Plugins package or a selected local marketplace plugin. Only skills are activated; review source first.' },
|
|
19
|
+
{ usage: '/plugin list|remove <name>', description: 'List project-installed plugins or remove one, preserving modified and seed files. /kit is an alias.' },
|
|
15
20
|
{ usage: '/tips', description: 'Toggle the rotating tips shown under the busy label while the model is thinking.' },
|
|
16
21
|
{ usage: '/fleet [--review] [--profile <name>] [--workers <provider:model>] [--concurrency <n>] [--] <prompt>', description: 'Run genuinely independent tasks through disposable contexts. Runtime enforces profile concurrency, deadlines, and mutation serialization; control guidance is not persisted. Declines non-parallel work.' },
|
|
17
22
|
{ usage: '/init', description: 'Inspect the current workspace and create or update AGENTS.md project instructions.' },
|
|
@@ -19,8 +19,13 @@ export type CommandContext = {
|
|
|
19
19
|
runAgentTurn: (prompt: string, displayValue?: string, options?: TurnExecutionOptions) => Promise<void>;
|
|
20
20
|
/** Ink 8 `suspendTerminal` affordances; provided by the interactive screen only. */
|
|
21
21
|
composeInEditor?: () => Promise<string | undefined>;
|
|
22
|
+
/** Open an existing file in $VISUAL/$EDITOR; false when no editor is configured. */
|
|
23
|
+
editFileInEditor?: (file: string) => Promise<boolean>;
|
|
22
24
|
viewInPager?: (text: string) => Promise<boolean>;
|
|
23
25
|
refreshContextFiles: () => Promise<ContextFile[]>;
|
|
26
|
+
refreshSkills?: () => Promise<unknown>;
|
|
27
|
+
/** Open the `/plugin` picker (interactive screen only; loads installed plugins first). */
|
|
28
|
+
openPluginPicker?: () => Promise<void>;
|
|
24
29
|
updateSettings: (patch: Partial<HazeSettings>) => Promise<HazeSettings>;
|
|
25
30
|
/** Read the session-scoped per-model reasoning override (`provider:model` key). */
|
|
26
31
|
getSessionReasoning: (modelSelector: string) => StoredReasoningSetting | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { pathExists } from '../../utils/fs.js';
|
|
2
2
|
import { SETTINGS_FILE, writeSettings } from '../../config/settings.js';
|
|
3
3
|
import { openPath } from '../../utils/openPath.js';
|
|
4
4
|
import { clearTasks } from '../../core/tasks/taskStorage.js';
|
|
@@ -9,9 +9,10 @@ import { handleLogsCommand } from './logsCommand.js';
|
|
|
9
9
|
import { handleModelCommand } from './modelCommand.js';
|
|
10
10
|
import { handleReasoningCommand } from './reasoningCommand.js';
|
|
11
11
|
import { handleThemesCommand } from './themesCommand.js';
|
|
12
|
+
import { handlePluginCommand } from './pluginCommand.js';
|
|
12
13
|
import { formatSettingsSummary } from './settingsSummary.js';
|
|
13
14
|
async function ensureSettingsFile(settings) {
|
|
14
|
-
if (!await
|
|
15
|
+
if (!await pathExists(SETTINGS_FILE))
|
|
15
16
|
await writeSettings(settings);
|
|
16
17
|
return SETTINGS_FILE;
|
|
17
18
|
}
|
|
@@ -58,10 +59,23 @@ const SLASH_COMMANDS = [
|
|
|
58
59
|
} },
|
|
59
60
|
{ match: exactOrArgs('/lsp'), run: (_args, ctx) => { ctx.setMode('lsp'); ctx.addSystemMessage('Choose an LSP server to enable, disable, or remove it. Choose "add server" to add one from presets (e.g. typescript) or enter a custom command.'); return HANDLED; } },
|
|
60
61
|
{ match: exactOrArgs('/mcp'), run: (_args, ctx) => { ctx.setMode('mcp'); ctx.addSystemMessage('Choose an MCP server to enable, disable, remove, or set a key for it. Choose "add server" to add one from presets (e.g. context7) or enter custom details.'); return HANDLED; } },
|
|
61
|
-
{ match:
|
|
62
|
+
{ match: exact('/settings open'), run: async (_args, ctx) => { const file = await ensureSettingsFile(ctx.settings); await openPath(file); ctx.addSystemMessage(`Opened settings file: ${file}`); return HANDLED; } },
|
|
63
|
+
{ match: exact('/settings edit'), run: async (_args, ctx) => {
|
|
64
|
+
const file = await ensureSettingsFile(ctx.settings);
|
|
65
|
+
if (ctx.editFileInEditor && await ctx.editFileInEditor(file)) {
|
|
66
|
+
// External edits are not hot-reloaded; in-memory settings stay authoritative for this session.
|
|
67
|
+
ctx.addSystemMessage(`Edited settings file: ${file}. Restart haze to apply changes.`);
|
|
68
|
+
return HANDLED;
|
|
69
|
+
}
|
|
70
|
+
await openPath(file);
|
|
71
|
+
ctx.addSystemMessage(`${ctx.editFileInEditor ? 'No $VISUAL/$EDITOR configured' : 'Editor handoff unavailable'}; opened settings file with the OS default app: ${file}`);
|
|
72
|
+
return HANDLED;
|
|
73
|
+
} },
|
|
62
74
|
{ match: exact('/settings'), run: async (_args, ctx) => { ctx.addSystemMessage(await formatSettingsSummary(ctx.settings, ctx.contextFiles)); return HANDLED; } },
|
|
63
75
|
{ match: exact('/provider'), run: (_args, ctx) => { ctx.setModelProviderFilter?.(undefined); ctx.setMode('provider'); ctx.addSystemMessage('Choose a provider. Selecting one opens provider actions. Choose "add provider" to pick from presets or enter custom details.'); return HANDLED; } },
|
|
64
76
|
{ match: exact('/init'), run: async (_args, ctx) => await handleInitCommand(ctx) },
|
|
77
|
+
{ match: exactOrArgs('/plugin'), run: handlePluginCommand },
|
|
78
|
+
{ match: exactOrArgs('/kit'), run: handlePluginCommand },
|
|
65
79
|
{ match: exact('/skills'), run: (_args, ctx) => { ctx.setMode('skills'); ctx.addSystemMessage('Choose a skill to show info, enable/disable, or remove it. Choose "add skill" to generate a new one from a description.'); return HANDLED; } },
|
|
66
80
|
{ match: exact('/tips'), run: async (_args, ctx) => {
|
|
67
81
|
const currentlyEnabled = ctx.settings.tips?.enabled !== false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import fs from 'fs
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import { pathExists } from '../../utils/fs.js';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { MAX_CONTEXT_FILE_CHARS } from '../../config/contextFiles.js';
|
|
4
5
|
import { buildInitPrompt } from '../../llm/initPrompt.js';
|
|
@@ -6,7 +7,7 @@ export async function handleInitCommand(ctx) {
|
|
|
6
7
|
await ctx.runAgentTurn(buildInitPrompt(), '/init');
|
|
7
8
|
await ctx.refreshContextFiles();
|
|
8
9
|
const agentsMdPath = path.join(process.cwd(), 'AGENTS.md');
|
|
9
|
-
if (await
|
|
10
|
+
if (await pathExists(agentsMdPath)) {
|
|
10
11
|
const content = await fs.readFile(agentsMdPath, 'utf8');
|
|
11
12
|
const chars = content.length;
|
|
12
13
|
const lines = content.split('\n').length;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CommandContext, CommandResult } from './commands.js';
|
|
2
|
+
/** Installed plugins for the `/plugin` picker (receipt-listed, global ~/.haze). */
|
|
3
|
+
export declare function listInstalledPlugins(): Promise<{
|
|
4
|
+
name: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
}[]>;
|
|
7
|
+
/** Collection entries from a local marketplace root; throws when the directory is not a collection (root plugin manifests keep precedence). */
|
|
8
|
+
export declare function pluginCollectionEntries(source: string): Promise<{
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
}[]>;
|
|
12
|
+
/** cwd is kept for source-path resolution symmetry with other commands; installs are global. */
|
|
13
|
+
export declare function runPluginCommand(args: string[], _cwd?: string): Promise<string>;
|
|
14
|
+
/** Quoted local paths work in chat too; this is argument parsing, not shell execution. */
|
|
15
|
+
export declare function pluginCommandParts(value: string): string[];
|
|
16
|
+
export declare function handlePluginCommand(args: string, ctx: CommandContext): Promise<CommandResult>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { inspectPlugin, PLUGIN_LIMITS, readJson, safePath } from '../../skills/plugins/package.js';
|
|
4
|
+
import { installPlugin, listPlugins, removePlugin } from '../../skills/plugins/installer.js';
|
|
5
|
+
const PLUGIN_HELP = 'plugin inspect <local-directory> [plugin-name]\nplugin install <local-directory> [plugin-name]\nplugin list\nplugin remove <name>\nPlugins install globally under ~/.haze/plugins and never write workspace content. Installation trusts local instruction content; no scripts, hooks or MCP servers are activated. Clone remote collections locally first. kit is an alias for plugin.';
|
|
6
|
+
async function exists(file) {
|
|
7
|
+
try {
|
|
8
|
+
await fs.lstat(file);
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
if (error.code === 'ENOENT')
|
|
13
|
+
return false;
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Installed plugins for the `/plugin` picker (receipt-listed, global ~/.haze). */
|
|
18
|
+
export async function listInstalledPlugins() {
|
|
19
|
+
return listPlugins();
|
|
20
|
+
}
|
|
21
|
+
/** Collection entries from a local marketplace root; throws when the directory is not a collection (root plugin manifests keep precedence). */
|
|
22
|
+
export async function pluginCollectionEntries(source) {
|
|
23
|
+
const root = await safePath(await fs.realpath(path.resolve(source)));
|
|
24
|
+
// Root plugin manifests keep precedence over colocated marketplace catalogs.
|
|
25
|
+
for (const manifest of ['plugin.json', '.claude-plugin/plugin.json', '.codex-plugin/plugin.json', 'skills']) {
|
|
26
|
+
if (await exists(await safePath(root, manifest)))
|
|
27
|
+
throw new Error('Not a plugin collection.');
|
|
28
|
+
}
|
|
29
|
+
const { plugins } = await readCollection(root);
|
|
30
|
+
return plugins.map(entry => {
|
|
31
|
+
const record = typeof entry === 'object' && entry !== null ? entry : {};
|
|
32
|
+
if (typeof record.name !== 'string' || !record.name)
|
|
33
|
+
throw new Error('Invalid marketplace plugin entry.');
|
|
34
|
+
return { name: record.name, ...(typeof record.description === 'string' ? { description: record.description } : {}) };
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** Read and validate a marketplace catalog (`.claude-plugin` first, then `.agents/plugins`). */
|
|
38
|
+
async function readCollection(source) {
|
|
39
|
+
const root = await safePath(await fs.realpath(path.resolve(source)));
|
|
40
|
+
for (const location of ['.claude-plugin/marketplace.json', '.agents/plugins/marketplace.json']) {
|
|
41
|
+
const file = await safePath(root, location);
|
|
42
|
+
try {
|
|
43
|
+
await fs.lstat(file);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (error.code === 'ENOENT')
|
|
47
|
+
continue;
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
const catalog = await readJson(file);
|
|
51
|
+
if (!Array.isArray(catalog.plugins) || catalog.plugins.length > PLUGIN_LIMITS.entries)
|
|
52
|
+
throw new Error('Invalid marketplace plugins list.');
|
|
53
|
+
return { name: typeof catalog.name === 'string' ? catalog.name : undefined, plugins: catalog.plugins };
|
|
54
|
+
}
|
|
55
|
+
throw new Error('No plugin collection marketplace found.');
|
|
56
|
+
}
|
|
57
|
+
/** cwd is kept for source-path resolution symmetry with other commands; installs are global. */
|
|
58
|
+
export async function runPluginCommand(args, _cwd = process.cwd()) {
|
|
59
|
+
const [action, source, name, ...extra] = args;
|
|
60
|
+
if (!action || action === 'help')
|
|
61
|
+
return PLUGIN_HELP;
|
|
62
|
+
if (extra.length || (action === 'list' && source) || (action === 'remove' && name))
|
|
63
|
+
throw new Error(PLUGIN_HELP);
|
|
64
|
+
if (action === 'list') {
|
|
65
|
+
const installed = await listPlugins();
|
|
66
|
+
return installed.length ? installed.map(plugin => `${plugin.name}${plugin.version ? `@${plugin.version}` : ''}`).join('\n') : 'No plugins installed.';
|
|
67
|
+
}
|
|
68
|
+
if (!source)
|
|
69
|
+
throw new Error(PLUGIN_HELP);
|
|
70
|
+
if (action === 'remove') {
|
|
71
|
+
const result = await removePlugin(source);
|
|
72
|
+
return `Removed plugin ${result.name}.${result.retained.length ? `\nRetained modified/unowned files:\n${result.retained.join('\n')}` : ''}`;
|
|
73
|
+
}
|
|
74
|
+
if (action === 'install') {
|
|
75
|
+
const result = await installPlugin(source, name);
|
|
76
|
+
return `${result.alreadyInstalled ? 'Plugin already installed:' : 'Installed'} ${result.name}${result.version ? `@${result.version}` : ''}.\nUse /skills or /${result.name}:<skill-name>.${result.warnings.length ? `\n${result.warnings.join('\n')}` : ''}`;
|
|
77
|
+
}
|
|
78
|
+
if (action === 'inspect') {
|
|
79
|
+
let result;
|
|
80
|
+
try {
|
|
81
|
+
result = await inspectPlugin(source, name);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
if (!(error instanceof Error) || error.message !== 'This is a plugin collection; select a plugin name.')
|
|
85
|
+
throw error;
|
|
86
|
+
// Collection inspection lists metadata only; selection is required to install.
|
|
87
|
+
const catalog = await readCollection(source).catch(() => undefined);
|
|
88
|
+
if (!catalog)
|
|
89
|
+
throw error;
|
|
90
|
+
const entries = await pluginCollectionEntries(source);
|
|
91
|
+
const collectionName = catalog.name ?? path.basename(await fs.realpath(path.resolve(source)));
|
|
92
|
+
return `Plugin collection: ${collectionName}\n${entries.map(entry => entry.name).join('\n')}\nSelect one: plugin inspect <local-directory> <plugin-name>`;
|
|
93
|
+
}
|
|
94
|
+
const skills = result.files.filter(file => /^skills\/[^/]+\/SKILL\.md$/.test(file));
|
|
95
|
+
return `${result.manifest.name}${result.manifest.version ? `@${result.manifest.version}` : ''}\n${result.manifest.description ?? ''}\n${skills.length} standard skills; ${result.files.length} package files.${result.warnings.length ? `\n${result.warnings.join('\n')}` : ''}`;
|
|
96
|
+
}
|
|
97
|
+
throw new Error(PLUGIN_HELP);
|
|
98
|
+
}
|
|
99
|
+
/** Quoted local paths work in chat too; this is argument parsing, not shell execution. */
|
|
100
|
+
export function pluginCommandParts(value) {
|
|
101
|
+
const parts = [];
|
|
102
|
+
let remaining = value.trim();
|
|
103
|
+
while (remaining) {
|
|
104
|
+
const match = /^(?:"([^"]*)"|'([^']*)'|([^\s"']+))(?:\s+|$)/.exec(remaining);
|
|
105
|
+
if (!match)
|
|
106
|
+
throw new Error('Invalid plugin arguments. Quote paths containing spaces.');
|
|
107
|
+
parts.push(match[1] ?? match[2] ?? match[3]);
|
|
108
|
+
remaining = remaining.slice(match[0].length);
|
|
109
|
+
}
|
|
110
|
+
return parts;
|
|
111
|
+
}
|
|
112
|
+
export async function handlePluginCommand(args, ctx) {
|
|
113
|
+
const parts = pluginCommandParts(args);
|
|
114
|
+
if (parts.length === 0) {
|
|
115
|
+
// Bare `/plugin` opens the picker, consistent with /skills, /lsp, and /mcp;
|
|
116
|
+
// headless contexts without a picker keep the usage text.
|
|
117
|
+
if (ctx.openPluginPicker)
|
|
118
|
+
await ctx.openPluginPicker();
|
|
119
|
+
else
|
|
120
|
+
ctx.addSystemMessage(PLUGIN_HELP);
|
|
121
|
+
return 'handled';
|
|
122
|
+
}
|
|
123
|
+
ctx.addSystemMessage(await runPluginCommand(parts));
|
|
124
|
+
if (parts[0] === 'install' || parts[0] === 'remove')
|
|
125
|
+
await ctx.refreshSkills?.();
|
|
126
|
+
return 'handled';
|
|
127
|
+
}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
import { type ResolvedReasoningChoice, type StoredReasoningSetting } from '../../core/agent/reasoningPolicy.js';
|
|
2
2
|
import type { CommandContext, CommandResult } from './commands.js';
|
|
3
|
-
/**
|
|
4
|
-
* `/reasoning` — per-model, per-session reasoning-effort picker and direct
|
|
5
|
-
* set, modeled on `/themes`. The picker is one step in the `wizardFlow.ts`
|
|
6
|
-
* table (mode `reasoning`); this module holds the pure result function shared
|
|
7
|
-
* by the slash path and the wizard submit handler. The chosen level applies to
|
|
8
|
-
* the active `provider:model` for the current session only — kept in memory on
|
|
9
|
-
* the `PromptSession` object, never written to `~/.haze/settings.json` — and
|
|
10
|
-
* applies from the next turn (reasoning is resolved once per attempt in
|
|
11
|
-
* `attemptSetup`). A model without a session override falls back to the saved
|
|
12
|
-
* global `reasoning` setting, then the built-in default.
|
|
13
|
-
*/
|
|
14
|
-
/** Picker value that stops sending a reasoning parameter (also accepted as `off` on the slash path). */
|
|
15
|
-
export declare const REASONING_UNSET = "unset";
|
|
16
|
-
/** Picker/slash value that removes the session override and inherits the saved/default level. */
|
|
17
|
-
export declare const REASONING_RESET = "reset";
|
|
18
3
|
export type ReasoningCommandResult = {
|
|
19
4
|
action: 'status';
|
|
20
5
|
message: string;
|
|
@@ -10,10 +10,8 @@ import { REASONING_LEVELS, REASONING_PROVIDER_DEFAULT, isReasoningLevel, isReaso
|
|
|
10
10
|
* `attemptSetup`). A model without a session override falls back to the saved
|
|
11
11
|
* global `reasoning` setting, then the built-in default.
|
|
12
12
|
*/
|
|
13
|
-
/** Picker value that stops sending a reasoning parameter (also accepted as `off` on the slash path). */
|
|
14
|
-
export const REASONING_UNSET = 'unset';
|
|
15
13
|
/** Picker/slash value that removes the session override and inherits the saved/default level. */
|
|
16
|
-
|
|
14
|
+
const REASONING_RESET = 'reset';
|
|
17
15
|
const LEVELS_LIST = REASONING_LEVELS.join(', ');
|
|
18
16
|
function describeChoice(choice) {
|
|
19
17
|
if (choice.level === undefined)
|
|
@@ -33,6 +33,8 @@ export function selectSkillActionResult(settings, skills, selectedName, action)
|
|
|
33
33
|
return { message: skillInfoMessage(settings, skill), skill };
|
|
34
34
|
if (action === SKILL_ACTIONS.validate)
|
|
35
35
|
return { validate: true, skill };
|
|
36
|
+
if (action === SKILL_ACTIONS.removeSkill && skill.pluginName)
|
|
37
|
+
return { mode: 'chat', selectedName: undefined, message: `Use /plugin remove ${skill.pluginName} or disable this skill`, skill };
|
|
36
38
|
if (action === SKILL_ACTIONS.removeSkill)
|
|
37
39
|
return { mode: 'skillsConfirmRemove', message: `Remove ${skill.source} skill ${skill.name}? This deletes ${skill.dir}. Type "yes" to confirm. Esc to cancel.`, skill };
|
|
38
40
|
return { message: `Unknown skill action: ${action}`, skill };
|
|
@@ -59,6 +61,8 @@ export function skillConfirmRemoveResult(settings, skills, selectedName, value)
|
|
|
59
61
|
const skill = findSelectedSkill(skills, selectedName);
|
|
60
62
|
if (!skill)
|
|
61
63
|
return { mode: 'chat', selectedName: undefined, message: `Skill ${selectedName} not found.` };
|
|
64
|
+
if (skill.pluginName)
|
|
65
|
+
return { mode: 'chat', selectedName: undefined, message: `Use /plugin remove ${skill.pluginName} or disable this skill`, skill };
|
|
62
66
|
return {
|
|
63
67
|
mode: 'chat',
|
|
64
68
|
selectedName: undefined,
|
|
@@ -60,6 +60,7 @@ export async function runAgentAttempt(input) {
|
|
|
60
60
|
abortCause,
|
|
61
61
|
retryAttempt,
|
|
62
62
|
maxRetries: attemptSetupResult.modelRetries,
|
|
63
|
+
timeoutMs: attemptSetupResult.streamIdleTimeoutMs,
|
|
63
64
|
classifyEmission: () => loopState.currentAssistantText.trim().length > 0 || loopState.assistantStarted ? 'text' : loopState.inFlightTools.size > 0 ? 'tool' : 'none',
|
|
64
65
|
isToolInFlight: () => loopState.inFlightTools.size > 0,
|
|
65
66
|
provider: () => attemptSetupResult.runtime.config.providerName,
|
|
@@ -74,7 +75,7 @@ export async function runAgentAttempt(input) {
|
|
|
74
75
|
return finalizeAttemptOutcome({ value, callbacks, abortController, turnOptions, turnState, turnBudget, goal, remainingTurnDeadlineMs, stream, retryAttempt, overflowRetries: input.overflowRetries });
|
|
75
76
|
}
|
|
76
77
|
catch (error) {
|
|
77
|
-
return handleAttemptFailure({ value, callbacks, abortController, turnState, retryAttempt, progressSinceLastRetry: input.progressSinceLastRetry, overflowRetries: input.overflowRetries, abortCause, stallGuard, salvage, error, maxRetries: setup?.modelRetries, retryBaseDelayMs: setup?.retryBaseDelayMs, goal, turnOptions });
|
|
78
|
+
return handleAttemptFailure({ value, callbacks, abortController, turnState, retryAttempt, progressSinceLastRetry: input.progressSinceLastRetry, overflowRetries: input.overflowRetries, abortCause, stallGuard, salvage, error, maxRetries: setup?.modelRetries, retryBaseDelayMs: setup?.retryBaseDelayMs, idleTimeoutMs: setup?.streamIdleTimeoutMs, goal, turnOptions });
|
|
78
79
|
}
|
|
79
80
|
finally {
|
|
80
81
|
await cleanup.closeOnce(ATTEMPT_TEARDOWN_BOUND_MS);
|
|
@@ -97,6 +97,8 @@ export interface AttemptFailureDeps {
|
|
|
97
97
|
maxRetries?: number;
|
|
98
98
|
/** Backoff base for the shared model-retry pool (`retryBaseDelayMs` setting); defaults to DEFAULT_RETRY_BASE_DELAY_MS. */
|
|
99
99
|
retryBaseDelayMs?: number;
|
|
100
|
+
/** Effective idle-stall window (`streamIdleTimeoutMs` setting; 5 min hosted / 30 min local built-in); defaults to IDLE_TIMEOUT_MS. */
|
|
101
|
+
idleTimeoutMs?: number;
|
|
100
102
|
goal: SessionGoal;
|
|
101
103
|
turnOptions: TurnExecutionOptions;
|
|
102
104
|
}
|
|
@@ -182,6 +182,7 @@ export function handleAttemptFailure(deps) {
|
|
|
182
182
|
const { value, callbacks, abortController, turnState, abortCause, stallGuard, salvage, error, goal, turnOptions } = deps;
|
|
183
183
|
const maxRetries = deps.maxRetries ?? DEFAULT_MODEL_RETRIES;
|
|
184
184
|
const retryBaseDelayMs = deps.retryBaseDelayMs ?? DEFAULT_RETRY_BASE_DELAY_MS;
|
|
185
|
+
const idleTimeoutMs = deps.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
185
186
|
const overflowRetries = deps.overflowRetries ?? 0;
|
|
186
187
|
// Progress refills the shared pool: consecutive failures chain backoff, but
|
|
187
188
|
// a failed attempt that completed steps since the last retry starts fresh.
|
|
@@ -195,8 +196,8 @@ export function handleAttemptFailure(deps) {
|
|
|
195
196
|
salvageConversationToLastStep(callbacks, salvage);
|
|
196
197
|
if (stallGuard?.retryEligible) {
|
|
197
198
|
const delay = retryDelayMs(retryAttempt, retryBaseDelayMs);
|
|
198
|
-
callbacks.onEvent?.(agentEvent({ type: 'retry', attempt: retryAttempt + 1, maxAttempts: maxRetries, delayMs: delay, error: `model stream idle for ${formatSeconds(
|
|
199
|
-
callbacks.addMessage({ role: 'system', text: `Model stream stalled for ${formatIdleMinutes(
|
|
199
|
+
callbacks.onEvent?.(agentEvent({ type: 'retry', attempt: retryAttempt + 1, maxAttempts: maxRetries, delayMs: delay, error: `model stream idle for ${formatSeconds(idleTimeoutMs)}` }));
|
|
200
|
+
callbacks.addMessage({ role: 'system', text: `Model stream stalled for ${formatIdleMinutes(idleTimeoutMs)}; retrying attempt ${retryAttempt + 1}/${maxRetries} in ${formatSeconds(delay)}. Completed steps are preserved.` });
|
|
200
201
|
// freshController: this stall aborted the controller to kill the hung
|
|
201
202
|
// stream; the retry needs a live signal.
|
|
202
203
|
return { status: 'failed', retry: { attempt: retryAttempt + 1, delayMs: delay, freshController: true } };
|
|
@@ -206,7 +207,7 @@ export function handleAttemptFailure(deps) {
|
|
|
206
207
|
// path) instead of discarding progress; the interactive UI offers a
|
|
207
208
|
// one-key resume from TurnResult.resume.
|
|
208
209
|
const afterStep = turnState.stepsUsed > 0 ? ` after step ${turnState.stepsUsed}` : '';
|
|
209
|
-
callbacks.addMessage({ role: 'system', text: `Model stream stalled for ${formatIdleMinutes(
|
|
210
|
+
callbacks.addMessage({ role: 'system', text: `Model stream stalled for ${formatIdleMinutes(idleTimeoutMs)}; unfinished task paused${afterStep}. Press R to retry, or send a follow-up message to continue.` });
|
|
210
211
|
return { status: 'failed', resume: { kind: 'model-stream-idle', request: value, retryAttempt } };
|
|
211
212
|
}
|
|
212
213
|
if (abortCause.kind === 'turn-deadline') {
|
|
@@ -50,6 +50,8 @@ export interface AttemptSetup {
|
|
|
50
50
|
modelRetries: number;
|
|
51
51
|
/** Backoff base for the shared model-retry pool, from the `retryBaseDelayMs` setting (default 1000ms). */
|
|
52
52
|
retryBaseDelayMs: number;
|
|
53
|
+
/** Effective idle-stall window (ms): the `streamIdleTimeoutMs` setting, else 5 min hosted / 30 min local. */
|
|
54
|
+
streamIdleTimeoutMs: number;
|
|
53
55
|
steeringProfile: 'standard' | 'compact';
|
|
54
56
|
}
|
|
55
57
|
export interface AttemptSetupDeps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readSettings } from '../../../config/settings.js';
|
|
2
|
-
import { DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_RETRY_BASE_DELAY_MS, MAIN_STEP_LIMIT, MAIN_TOOL_CALL_LIMIT, SUBAGENT_TOOL_DEADLINE_MS, DEFAULT_TOOL_DEADLINE_MS, DEFAULT_MODEL_RETRIES, withToolExecutionBudget } from '../../../core/agent/budgets.js';
|
|
2
|
+
import { DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_RETRY_BASE_DELAY_MS, MAIN_STEP_LIMIT, MAIN_TOOL_CALL_LIMIT, SUBAGENT_TOOL_DEADLINE_MS, DEFAULT_TOOL_DEADLINE_MS, DEFAULT_MODEL_RETRIES, resolveStreamIdleTimeoutMs, withToolExecutionBudget } from '../../../core/agent/budgets.js';
|
|
3
3
|
import { agentEvent } from '../../../core/agent/events.js';
|
|
4
4
|
import { goalDirectionPrompt, isPlanOnlyRequest } from '../../../core/agent/goalPolicy.js';
|
|
5
5
|
import { projectPreflight } from '../../../core/agent/projectPreflight.js';
|
|
@@ -11,7 +11,7 @@ import { withToolDeadline } from '../../../core/deadline.js';
|
|
|
11
11
|
import { isMutatingCapability, isValidationCapable } from '../../../core/agent/toolCapabilities.js';
|
|
12
12
|
import { userTurnMessage } from '../../../core/attachments/imageAttachments.js';
|
|
13
13
|
import { WorkspaceMutationPolicy } from '../../../core/subagent/workspaceMutationPolicy.js';
|
|
14
|
-
import { modelWithConfig, providerRequestSettings } from '../../../llm/client.js';
|
|
14
|
+
import { modelWithConfig, providerRequestSettings, isLocalProviderUrl } from '../../../llm/client.js';
|
|
15
15
|
import { assembleRequestContext } from '../../../llm/requestContext.js';
|
|
16
16
|
import { modelThinkingLabel } from '../../../utils/modelName.js';
|
|
17
17
|
import { estimateInputBreakdown, logEntry } from './turnRuntime.js';
|
|
@@ -193,6 +193,7 @@ export async function prepareAttempt(deps) {
|
|
|
193
193
|
toolCategories,
|
|
194
194
|
modelRetries: typeof turnSettings.modelRetries === 'number' ? turnSettings.modelRetries : DEFAULT_MODEL_RETRIES,
|
|
195
195
|
retryBaseDelayMs: typeof turnSettings.retryBaseDelayMs === 'number' ? turnSettings.retryBaseDelayMs : DEFAULT_RETRY_BASE_DELAY_MS,
|
|
196
|
+
streamIdleTimeoutMs: resolveStreamIdleTimeoutMs(turnSettings.streamIdleTimeoutMs, isLocalProviderUrl(runtime.config.baseURL)),
|
|
196
197
|
steeringProfile,
|
|
197
198
|
};
|
|
198
199
|
}
|
|
@@ -61,6 +61,12 @@ export interface StreamStallGuardDeps {
|
|
|
61
61
|
retryAttempt: number;
|
|
62
62
|
/** Retry-pool size for this turn (`modelRetries` setting); defaults to DEFAULT_MODEL_RETRIES. */
|
|
63
63
|
maxRetries?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Effective idle-stall window in ms, resolved in `prepareAttempt` from the
|
|
66
|
+
* `streamIdleTimeoutMs` setting with the class-aware built-in default
|
|
67
|
+
* (5 min hosted / 30 min local); defaults to IDLE_TIMEOUT_MS.
|
|
68
|
+
*/
|
|
69
|
+
timeoutMs?: number;
|
|
64
70
|
/** Classify what the stalled step emitted so far: partial text, in-flight tool, or nothing. */
|
|
65
71
|
classifyEmission: () => StallEmission;
|
|
66
72
|
isToolInFlight: () => boolean;
|
|
@@ -39,12 +39,13 @@ export function createIdleTimer(input) {
|
|
|
39
39
|
}
|
|
40
40
|
export function createStreamStallGuard(deps) {
|
|
41
41
|
const maxRetries = deps.maxRetries ?? DEFAULT_MODEL_RETRIES;
|
|
42
|
+
const timeoutMs = deps.timeoutMs ?? IDLE_TIMEOUT_MS;
|
|
42
43
|
let stallEmission = 'none';
|
|
43
44
|
let retryEligible = false;
|
|
44
45
|
let lastStreamEventAt;
|
|
45
46
|
let lastStreamEventType;
|
|
46
47
|
const timer = createIdleTimer({
|
|
47
|
-
timeoutMs
|
|
48
|
+
timeoutMs,
|
|
48
49
|
isBusy: () => deps.isToolInFlight(),
|
|
49
50
|
onTimeout: () => {
|
|
50
51
|
if (deps.controller.signal.aborted)
|
|
@@ -58,7 +59,7 @@ export function createStreamStallGuard(deps) {
|
|
|
58
59
|
deps.onEvent?.(agentEvent({
|
|
59
60
|
type: 'timeout',
|
|
60
61
|
phase: 'model-stream',
|
|
61
|
-
timeoutMs
|
|
62
|
+
timeoutMs,
|
|
62
63
|
provider: deps.provider(),
|
|
63
64
|
model: deps.model(),
|
|
64
65
|
lastStreamEventAt: lastEventAtIso,
|
|
@@ -68,9 +69,9 @@ export function createStreamStallGuard(deps) {
|
|
|
68
69
|
retryEligible: retryEligible,
|
|
69
70
|
maxRetries: maxRetries,
|
|
70
71
|
}));
|
|
71
|
-
logEntry(deps.log, { at: new Date().toISOString(), type: 'warning', stream: 'main', error: `model-stream idle ${
|
|
72
|
-
deps.debugLog(`model stream idle for ${
|
|
73
|
-
abortForTurn(deps.abortCause, { kind: 'model-stream-idle', timeoutMs
|
|
72
|
+
logEntry(deps.log, { at: new Date().toISOString(), type: 'warning', stream: 'main', error: `model-stream idle ${timeoutMs}ms: provider=${deps.provider() ?? 'unknown'} model=${deps.model() ?? 'unknown'} lastEvent=${lastStreamEventType ?? 'none'}@${lastEventAtIso ?? 'never'} stallEmission=${stallEmission} workPhase=${deps.workPhase()} retryEligible=${retryEligible} maxRetries=${maxRetries} stepsUsed=${deps.stepsUsed()}` });
|
|
73
|
+
deps.debugLog(`model stream idle for ${timeoutMs}ms (last event: ${lastStreamEventType ?? 'none'}); ${retryEligible ? `retryable stall (${deps.retryAttempt}/${maxRetries} used)` : 'stall not retryable'}`);
|
|
74
|
+
abortForTurn(deps.abortCause, { kind: 'model-stream-idle', timeoutMs }, deps.controller, 'haze model stream was idle for the configured timeout.');
|
|
74
75
|
},
|
|
75
76
|
});
|
|
76
77
|
return {
|
|
@@ -68,10 +68,8 @@ export function subagentTokenEstimate(output) {
|
|
|
68
68
|
if (typeof output !== 'object' || output == null)
|
|
69
69
|
return undefined;
|
|
70
70
|
const value = output;
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const input = typeof inputValue === 'number' ? inputValue : 0;
|
|
74
|
-
const outputTokens = typeof outputValue === 'number' ? outputValue : 0;
|
|
71
|
+
const input = typeof value.telemetry?.usage?.inputTokens === 'number' ? value.telemetry.usage.inputTokens : 0;
|
|
72
|
+
const outputTokens = typeof value.telemetry?.usage?.outputTokens === 'number' ? value.telemetry.usage.outputTokens : 0;
|
|
75
73
|
return input > 0 || outputTokens > 0 ? { input, output: outputTokens } : undefined;
|
|
76
74
|
}
|
|
77
75
|
export function rememberContextFilesFromToolOutput(activeContextFiles, output) {
|
|
@@ -56,6 +56,14 @@ export declare const MCP_TRANSPORTS: {
|
|
|
56
56
|
export declare const SKILL_CHOICES: {
|
|
57
57
|
readonly addSkill: "add skill";
|
|
58
58
|
};
|
|
59
|
+
export declare const PLUGIN_CHOICES: {
|
|
60
|
+
readonly installPlugin: "install plugin";
|
|
61
|
+
readonly inspectPlugin: "inspect plugin";
|
|
62
|
+
};
|
|
63
|
+
export declare const PLUGIN_ACTIONS: {
|
|
64
|
+
readonly showInfo: "show info";
|
|
65
|
+
readonly removePlugin: "remove plugin";
|
|
66
|
+
};
|
|
59
67
|
export declare const SKILL_ACTIONS: {
|
|
60
68
|
readonly showInfo: "show info";
|
|
61
69
|
readonly validate: "validate";
|
|
@@ -107,6 +115,17 @@ export declare function mcpTransportSuggestions(): TextInputSuggestion[];
|
|
|
107
115
|
export declare function skillsSuggestions(settings: HazeSettings, skills: LoadedSkill[]): TextInputSuggestion[];
|
|
108
116
|
export declare function skillScopeSuggestions(): TextInputSuggestion[];
|
|
109
117
|
export declare function skillsActionSuggestions(settings: HazeSettings, skills: LoadedSkill[], selectedSkillName: string | undefined): TextInputSuggestion[];
|
|
118
|
+
export interface PluginPickerPlugin {
|
|
119
|
+
name: string;
|
|
120
|
+
version?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface PluginPickerEntry {
|
|
123
|
+
name: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
}
|
|
126
|
+
export declare function pluginSuggestions(plugins: PluginPickerPlugin[]): TextInputSuggestion[];
|
|
127
|
+
export declare function pluginActionSuggestions(): TextInputSuggestion[];
|
|
128
|
+
export declare function pluginCollectionSuggestions(entries: PluginPickerEntry[]): TextInputSuggestion[];
|
|
110
129
|
/** Every built-in theme with its palette brightness and the active one marked (`resolveTheme` validates names). */
|
|
111
130
|
export declare function themeSuggestions(settings: HazeSettings): TextInputSuggestion[];
|
|
112
131
|
/** Reasoning-effort picker values: every level plus the unset/reset actions. The active marker resolves the session override → saved setting → default. */
|
|
@@ -125,6 +144,11 @@ export interface WizardSuggestionState {
|
|
|
125
144
|
selectedSkillName?: string;
|
|
126
145
|
selectedLspName?: string;
|
|
127
146
|
selectedMcpName?: string;
|
|
147
|
+
/** Installed project plugins (`/plugin` picker), loaded when the picker opens. */
|
|
148
|
+
plugins?: PluginPickerPlugin[];
|
|
149
|
+
selectedPluginName?: string;
|
|
150
|
+
/** Collection entries offered after pointing install/inspect at a collection. */
|
|
151
|
+
pluginCollectionEntries?: PluginPickerEntry[];
|
|
128
152
|
/** Session per-model reasoning overrides (`/reasoning`); shown as the active level in the picker. */
|
|
129
153
|
sessionReasoning?: Record<string, StoredReasoningSetting>;
|
|
130
154
|
}
|
|
@@ -334,6 +358,41 @@ export declare const WIZARD_STEPS: readonly [{
|
|
|
334
358
|
readonly kind: "confirm";
|
|
335
359
|
readonly placeholder: "Type \"yes\" to confirm";
|
|
336
360
|
readonly suggestions: () => never[];
|
|
361
|
+
}, {
|
|
362
|
+
readonly id: "plugins";
|
|
363
|
+
readonly kind: "pick";
|
|
364
|
+
readonly placeholder: "Choose install, inspect, or an installed plugin";
|
|
365
|
+
readonly suggestions: (s: WizardSuggestionState) => TextInputSuggestion[];
|
|
366
|
+
}, {
|
|
367
|
+
readonly id: "pluginAction";
|
|
368
|
+
readonly kind: "pick";
|
|
369
|
+
readonly placeholder: "show info or remove plugin";
|
|
370
|
+
readonly suggestions: () => TextInputSuggestion[];
|
|
371
|
+
}, {
|
|
372
|
+
readonly id: "pluginInstallSource";
|
|
373
|
+
readonly kind: "input";
|
|
374
|
+
readonly placeholder: "Local plugin directory (e.g. ../haze-kits)";
|
|
375
|
+
readonly suggestions: () => never[];
|
|
376
|
+
}, {
|
|
377
|
+
readonly id: "pluginInstallName";
|
|
378
|
+
readonly kind: "pick";
|
|
379
|
+
readonly placeholder: "Choose a plugin from the collection";
|
|
380
|
+
readonly suggestions: (s: WizardSuggestionState) => TextInputSuggestion[];
|
|
381
|
+
}, {
|
|
382
|
+
readonly id: "pluginInspectSource";
|
|
383
|
+
readonly kind: "input";
|
|
384
|
+
readonly placeholder: "Local plugin directory (e.g. ../haze-kits)";
|
|
385
|
+
readonly suggestions: () => never[];
|
|
386
|
+
}, {
|
|
387
|
+
readonly id: "pluginInspectName";
|
|
388
|
+
readonly kind: "pick";
|
|
389
|
+
readonly placeholder: "Choose a plugin from the collection";
|
|
390
|
+
readonly suggestions: (s: WizardSuggestionState) => TextInputSuggestion[];
|
|
391
|
+
}, {
|
|
392
|
+
readonly id: "pluginConfirmRemove";
|
|
393
|
+
readonly kind: "confirm";
|
|
394
|
+
readonly placeholder: "Type \"yes\" to confirm";
|
|
395
|
+
readonly suggestions: () => never[];
|
|
337
396
|
}, {
|
|
338
397
|
readonly id: "themes";
|
|
339
398
|
readonly kind: "pick";
|
|
@@ -61,6 +61,14 @@ export const MCP_TRANSPORTS = {
|
|
|
61
61
|
export const SKILL_CHOICES = {
|
|
62
62
|
addSkill: 'add skill',
|
|
63
63
|
};
|
|
64
|
+
export const PLUGIN_CHOICES = {
|
|
65
|
+
installPlugin: 'install plugin',
|
|
66
|
+
inspectPlugin: 'inspect plugin',
|
|
67
|
+
};
|
|
68
|
+
export const PLUGIN_ACTIONS = {
|
|
69
|
+
showInfo: 'show info',
|
|
70
|
+
removePlugin: 'remove plugin',
|
|
71
|
+
};
|
|
64
72
|
export const SKILL_ACTIONS = {
|
|
65
73
|
showInfo: 'show info',
|
|
66
74
|
validate: 'validate',
|
|
@@ -330,6 +338,30 @@ export function skillsActionSuggestions(settings, skills, selectedSkillName) {
|
|
|
330
338
|
result.push({ value: SKILL_ACTIONS.removeSkill, description: 'delete this skill directory', kind: 'skill' });
|
|
331
339
|
return result;
|
|
332
340
|
}
|
|
341
|
+
export function pluginSuggestions(plugins) {
|
|
342
|
+
return [
|
|
343
|
+
{ value: PLUGIN_CHOICES.installPlugin, description: 'install a local plugin package or collection', kind: 'plugin' },
|
|
344
|
+
{ value: PLUGIN_CHOICES.inspectPlugin, description: 'inspect a local plugin package or collection first', kind: 'plugin' },
|
|
345
|
+
...plugins.map(plugin => ({
|
|
346
|
+
value: plugin.name,
|
|
347
|
+
description: plugin.version ? `installed · ${plugin.version}` : 'installed',
|
|
348
|
+
kind: 'plugin',
|
|
349
|
+
})),
|
|
350
|
+
];
|
|
351
|
+
}
|
|
352
|
+
export function pluginActionSuggestions() {
|
|
353
|
+
return [
|
|
354
|
+
{ value: PLUGIN_ACTIONS.showInfo, description: 'show description, skills, and file count', kind: 'plugin' },
|
|
355
|
+
{ value: PLUGIN_ACTIONS.removePlugin, description: 'remove this plugin, preserving modified and seed files', kind: 'plugin' },
|
|
356
|
+
];
|
|
357
|
+
}
|
|
358
|
+
export function pluginCollectionSuggestions(entries) {
|
|
359
|
+
return entries.map(entry => ({
|
|
360
|
+
value: entry.name,
|
|
361
|
+
description: entry.description ?? 'collection plugin',
|
|
362
|
+
kind: 'plugin',
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
333
365
|
/** Perceptual-luminance check on a `#rrggbb` background so the theme picker can label light vs dark palettes. */
|
|
334
366
|
function isLightBackground(hex) {
|
|
335
367
|
const channels = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex);
|
|
@@ -413,6 +445,14 @@ export const WIZARD_STEPS = [
|
|
|
413
445
|
{ id: 'mcpAddKey', kind: 'masked-input', placeholder: 'API key, or blank to skip', optional: true, suggestions: () => [] },
|
|
414
446
|
{ id: 'mcpSetKey', kind: 'masked-input', placeholder: 'API key', suggestions: () => [] },
|
|
415
447
|
{ id: 'mcpConfirmRemove', kind: 'confirm', placeholder: 'Type "yes" to confirm', suggestions: () => [] },
|
|
448
|
+
// Plugins
|
|
449
|
+
{ id: 'plugins', kind: 'pick', placeholder: 'Choose install, inspect, or an installed plugin', suggestions: (s) => pluginSuggestions(s.plugins ?? []) },
|
|
450
|
+
{ id: 'pluginAction', kind: 'pick', placeholder: 'show info or remove plugin', suggestions: () => pluginActionSuggestions() },
|
|
451
|
+
{ id: 'pluginInstallSource', kind: 'input', placeholder: 'Local plugin directory (e.g. ../haze-kits)', suggestions: () => [] },
|
|
452
|
+
{ id: 'pluginInstallName', kind: 'pick', placeholder: 'Choose a plugin from the collection', suggestions: (s) => pluginCollectionSuggestions(s.pluginCollectionEntries ?? []) },
|
|
453
|
+
{ id: 'pluginInspectSource', kind: 'input', placeholder: 'Local plugin directory (e.g. ../haze-kits)', suggestions: () => [] },
|
|
454
|
+
{ id: 'pluginInspectName', kind: 'pick', placeholder: 'Choose a plugin from the collection', suggestions: (s) => pluginCollectionSuggestions(s.pluginCollectionEntries ?? []) },
|
|
455
|
+
{ id: 'pluginConfirmRemove', kind: 'confirm', placeholder: 'Type "yes" to confirm', suggestions: () => [] },
|
|
416
456
|
// Themes
|
|
417
457
|
{ id: 'themes', kind: 'pick', placeholder: 'Choose a theme', suggestions: (s) => themeSuggestions(s.settings) },
|
|
418
458
|
// Reasoning effort
|