@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.
Files changed (87) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +67 -3
  3. package/SECURITY.md +1 -1
  4. package/dist/buildInfo.json +3 -3
  5. package/dist/cli/chat/DynamicFrame.d.ts +0 -13
  6. package/dist/cli/chat/DynamicFrame.js +1 -1
  7. package/dist/cli/chat/inputSuggestions.js +2 -0
  8. package/dist/cli/chat/terminalControl.d.ts +4 -2
  9. package/dist/cli/chat/terminalControl.js +16 -5
  10. package/dist/cli/chat/wizard/pluginHandlers.d.ts +10 -0
  11. package/dist/cli/chat/wizard/pluginHandlers.js +156 -0
  12. package/dist/cli/chat/wizard/skillsHandlers.js +2 -2
  13. package/dist/cli/chat/wizard/types.d.ts +20 -0
  14. package/dist/cli/chat/wizard/uiState.d.ts +25 -1
  15. package/dist/cli/chat/wizard/uiState.js +3 -1
  16. package/dist/cli/chat/wizardDispatch.js +6 -0
  17. package/dist/cli/commands/chat.js +18 -3
  18. package/dist/cli/commands/commandHelp.js +7 -2
  19. package/dist/cli/commands/commands.d.ts +5 -0
  20. package/dist/cli/commands/commands.js +17 -3
  21. package/dist/cli/commands/initCommand.js +3 -2
  22. package/dist/cli/commands/pluginCommand.d.ts +16 -0
  23. package/dist/cli/commands/pluginCommand.js +127 -0
  24. package/dist/cli/commands/reasoningCommand.d.ts +0 -15
  25. package/dist/cli/commands/reasoningCommand.js +1 -3
  26. package/dist/cli/commands/skillsWizard.js +4 -0
  27. package/dist/cli/commands/streaming/agentAttempt.js +2 -1
  28. package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -0
  29. package/dist/cli/commands/streaming/attemptOutcome.js +4 -3
  30. package/dist/cli/commands/streaming/attemptSetup.d.ts +2 -0
  31. package/dist/cli/commands/streaming/attemptSetup.js +3 -2
  32. package/dist/cli/commands/streaming/stallRecovery.d.ts +6 -0
  33. package/dist/cli/commands/streaming/stallRecovery.js +6 -5
  34. package/dist/cli/commands/streaming/turnRuntime.js +2 -4
  35. package/dist/cli/commands/wizardFlow.d.ts +59 -0
  36. package/dist/cli/commands/wizardFlow.js +40 -0
  37. package/dist/cli/contextReportCli.js +4 -3
  38. package/dist/cli/index.js +19 -2
  39. package/dist/config/contextFiles.js +3 -2
  40. package/dist/config/inputHistory.js +3 -3
  41. package/dist/config/paths.d.ts +1 -0
  42. package/dist/config/paths.js +1 -0
  43. package/dist/config/providerAuth.js +3 -3
  44. package/dist/config/settings.d.ts +10 -1
  45. package/dist/config/settings.js +7 -4
  46. package/dist/config/updateCheck.js +3 -3
  47. package/dist/core/agent/budgets.d.ts +17 -0
  48. package/dist/core/agent/budgets.js +19 -0
  49. package/dist/core/agent/reasoningPolicy.js +1 -1
  50. package/dist/core/agent/workState.d.ts +0 -2
  51. package/dist/core/agent/workState.js +1 -1
  52. package/dist/core/log/llmLog.js +1 -1
  53. package/dist/core/session/sessionStore.js +4 -3
  54. package/dist/core/subagent/contracts.d.ts +1 -11
  55. package/dist/core/subagent/contracts.js +0 -22
  56. package/dist/llm/client.js +2 -2
  57. package/dist/llm/subagentRunner.d.ts +1 -6
  58. package/dist/llm/subagentRunner.js +11 -23
  59. package/dist/llm/tools/fileTools.js +2 -3
  60. package/dist/llm/tools/gitIgnore.js +1 -1
  61. package/dist/llm/tools/grepRunner.d.ts +10 -0
  62. package/dist/llm/tools/grepRunner.js +24 -0
  63. package/dist/llm/tools/toolContext.d.ts +2 -3
  64. package/dist/llm/tools/toolContext.js +2 -3
  65. package/dist/llm/tools/toolContextState.d.ts +0 -1
  66. package/dist/llm/tools/toolContextState.js +1 -4
  67. package/dist/llm/workerContext.d.ts +0 -7
  68. package/dist/llm/workerContext.js +0 -17
  69. package/dist/skills/SkillLoader.js +3 -2
  70. package/dist/skills/SkillRegistry.js +7 -4
  71. package/dist/skills/builder/SkillBuilder.js +11 -10
  72. package/dist/skills/plugins/installer.d.ts +25 -0
  73. package/dist/skills/plugins/installer.js +272 -0
  74. package/dist/skills/plugins/package.d.ts +41 -0
  75. package/dist/skills/plugins/package.js +275 -0
  76. package/dist/skills/plugins/runtime.d.ts +3 -0
  77. package/dist/skills/plugins/runtime.js +108 -0
  78. package/dist/skills/skillTools.js +10 -5
  79. package/dist/skills/types.d.ts +4 -0
  80. package/dist/ui/codeHighlight.d.ts +1 -1
  81. package/dist/ui/codeHighlight.js +112 -4
  82. package/dist/ui/components/StreamingMarkdownText.d.ts +0 -2
  83. package/dist/ui/components/StreamingMarkdownText.js +1 -1
  84. package/dist/ui/components/TextInput.d.ts +1 -1
  85. package/dist/utils/fs.d.ts +10 -0
  86. package/dist/utils/fs.js +37 -2
  87. package/package.json +17 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.1 - 2026-10-24
4
+
5
+ ### Fixed
6
+
7
+ - OpenRouter attribution now sends `HTTP-Referer: https://github.com/DenizOkcu/haze` instead of the docs site, so OpenRouter's app lookup (`/apps/url/...`) resolves against the repository page. `X-Title: Haze` is unchanged; other OpenAI-compatible providers are unaffected.
8
+
9
+ ## 1.6.0 - 2026-10-24
10
+
11
+ Class-aware idle-stream stall windows so patient local models are not mistaken for dead streams.
12
+
13
+ ### Added
14
+
15
+ - `streamIdleTimeoutMs` setting (integer milliseconds, 1s–24h, loud parse validation): how long the model stream may emit nothing before the attempt aborts and retries from the salvaged step while the shared model-retry pool lasts. Unset resolves per provider class in `prepareAttempt` — 5 minutes for hosted endpoints, 30 minutes for loopback/local inference servers (LM Studio, Ollama), whose prompt ingestion and hidden reasoning emit no stream parts at all: local servers send no SSE keepalives, so a healthy busy model is byte-identical to a dead stream, and re-sending the identical request would discard the prefill work only to stall again. The `timeout` and `retry` events plus the retry/pause system messages report the effective window instead of a hardcoded constant.
16
+
3
17
  ## 1.5.1 - 2026-10-07
4
18
 
5
19
  Terminal transcript replay on resize and capability-aware reasoning effort.
package/README.md CHANGED
@@ -2,7 +2,20 @@
2
2
 
3
3
  A minimal LLM harness for your terminal.
4
4
 
5
- ## What's new in 1.5.1
5
+ [![Known Vulnerabilities](https://snyk.io/test/github/DenizOkcu/haze/badge.svg)](https://snyk.io/test/github/DenizOkcu/haze)
6
+
7
+ ## What's new in 1.6.1
8
+
9
+ haze 1.6.1 fixes OpenRouter app attribution: the `HTTP-Referer` header now points at the GitHub project page (`https://github.com/DenizOkcu/haze`) instead of the docs site, so OpenRouter's `/apps/url/...` lookup resolves. `X-Title: Haze` is unchanged.
10
+
11
+ ### Highlights from 1.6.0
12
+
13
+ haze 1.6.0 stops mistaking patient local models for dead streams:
14
+
15
+ - Idle-stream stall windows are now class-aware: hosted endpoints keep the 5-minute window, while loopback/local inference servers (LM Studio, Ollama) get 30 minutes — their prompt ingestion and hidden reasoning emit no stream output at all, so the old fixed window aborted healthy models mid-work and burned the retry pool re-doing prefill.
16
+ - The new `streamIdleTimeoutMs` setting overrides the window explicitly (integer milliseconds, 1s–24h). The `timeout`/`retry` events and the stall system messages report the effective window.
17
+
18
+ ### Highlights from 1.5.1
6
19
 
7
20
  haze 1.5.1 improves terminal resizing and reasoning-effort compatibility:
8
21
 
@@ -114,7 +127,7 @@ Saved settings live in `~/.haze/settings.json`. ChatGPT OAuth credentials live s
114
127
 
115
128
  Switch the interface palette with `/themes`. The picker lists every built-in theme — light palettes and oh-my-zsh ports like `robbyrussell`, `af-magic`, and `solarized-dark` — and applies the choice immediately; `/themes <name>` sets one directly. The selection persists as `theme` in `~/.haze/settings.json`, and text already on screen keeps its old colors.
116
129
 
117
- Control reasoning effort with `/reasoning` (alias `/thinking`). The picker or `/reasoning <level>` sets `none`, `minimal`, `low`, `medium`, `high`, or `xhigh` for the active model in this session; it never writes settings. `/reasoning unset` omits the parameter, `/reasoning reset` drops the session override, and `/reasoning status` explains the current choice. Resolution follows run-scoped `--reasoning` → per-model session override → saved global `reasoning` setting → built-in default `medium`. The level travels as the AI SDK's portable `reasoning` parameter from the next turn and appears beside the model in the status bar.
130
+ Control reasoning effort with `/reasoning` (alias `/thinking`). The picker or `/reasoning <level>` sets `none`, `minimal`, `low`, `medium`, `high`, or `xhigh` for the active model in this session; it never writes settings. `/reasoning unset` omits the parameter, `/reasoning reset` drops the session override, and `/reasoning status` explains the current choice. Resolution follows run-scoped `--reasoning` → per-model session override → saved global `reasoning` setting → built-in default `low`. The level travels as the AI SDK's portable `reasoning` parameter from the next turn and appears beside the model in the status bar.
118
131
 
119
132
  Reasoning effort is capability-gated: `capabilities.reasoningEffort: true|false` on a provider explicitly enables or disables sending it. Without an override, local inference endpoints recognized by haze (`localhost`, `127.0.0.1`, `::1`, `0.0.0.0`, and `.local` hosts) omit it; hosted endpoints retain pass-through behavior. This avoids local servers interpreting unsupported levels as reasoning being enabled. Omission leaves the server's own default in control; it does not guarantee reasoning is off. For bare GPT-6+ model names, `minimal` is omitted, and `none` is omitted except for exactly `gpt-6-sol` and `gpt-6-luna`; unsupported choices are never silently promoted. The `reasoning_policy` stream event reports the effective policy.
120
133
 
@@ -218,6 +231,57 @@ They are also available through one `skill` catalog tool. haze loads one workflo
218
231
 
219
232
  When you catch yourself repeating the same instructions, put them in a skill. The workflow stays in a Markdown file that you can read and edit.
220
233
 
234
+ ## Shared plugins and marketplaces
235
+
236
+ Haze accepts local [Agent Plugins 1.0.0](https://agent-plugins.org/specification)
237
+ packages (`plugin.json` plus `skills/`) and existing Claude Code/Codex legacy
238
+ manifests (`.claude-plugin/plugin.json`, `.codex-plugin/plugin.json`). The canonical
239
+ root manifest takes precedence. Claude and OpenAI collections can reference the
240
+ same plugin directories through their respective marketplace catalogs.
241
+
242
+ ```sh
243
+ haze plugin inspect ../haze-kits
244
+ haze plugin inspect ../haze-kits speckit
245
+ haze plugin install ../haze-kits speckit
246
+ haze plugin list
247
+ haze plugin remove speckit
248
+ ```
249
+
250
+ The same operations are available as `/plugin …` in chat; `kit` and `/kit` are aliases.
251
+ Quote local paths containing spaces. Install from a plugin directory directly or
252
+ select a named plugin from a local `.claude-plugin/marketplace.json` or
253
+ `.agents/plugins/marketplace.json` collection. Remote entries require cloning locally
254
+ first; Haze does not download marketplace repositories or honor their installation policies.
255
+
256
+ Packages install globally into `~/.haze/plugins/<name>` with ownership receipts in
257
+ `~/.haze/plugin-receipts`; installation never writes workspace content. Only
258
+ receipt-listed packages activate; copying a collection or Claude cache into a
259
+ directory does not enable it. Plugin skills are globally installed, stay
260
+ untrusted third-party content, and are invoked as `/<plugin>:<skill>`, such as
261
+ `/speckit:speckit-plan`. Use `/skills` to enable/disable them, and `/plugin remove`
262
+ to uninstall the package. Legacy Claude custom skill paths are supported when
263
+ contained in the package.
264
+
265
+ **Compatibility is skills-focused, not a universal plugin runtime.** Hooks, MCP
266
+ servers, agents, legacy command files, LSP and unknown extensions are reported but
267
+ not activated. Host-specific frontmatter, argument expansion, dynamic shell
268
+ preprocessing and tool restrictions are not emulated. Do not rely on those features
269
+ for workflow correctness or safety. Bundled scripts can be run by the agent through
270
+ normal tools when a skill requests it; installation itself executes no package code.
271
+
272
+ The optional `extensions.dev.haze.workspaceFiles` mapping is no longer supported:
273
+ plugins install globally and never write workspace content. Such extensions are
274
+ reported and ignored like other unknown extensions. Bundled workflow assets stay
275
+ inside `~/.haze/plugins/<name>`; the Spec Kit plugin's setup skill copies what a
276
+ project needs from there using normal agent tools. Reinstalling identical content
277
+ is idempotent; remove before changing versions. Protected secrets and package
278
+ symlinks are refused. Interrupted operations can leave partial files and
279
+ `~/.haze/plugin-receipts/.lock`; inspect before manually clearing a stale lock.
280
+ This is not a filesystem sandbox or crash-safe transaction journal.
281
+
282
+ See the collection's README and [plugin interoperability notes](docs/plugin-compatibility.md)
283
+ for official sources, layouts, support limits and cross-agent setup.
284
+
221
285
  ## Commands
222
286
 
223
287
  ```txt
@@ -415,7 +479,7 @@ Most haze behaviour needs no configuration; a few optional keys in `~/.haze/sett
415
479
  - `contextWindowFallbackTokens` / `localContextWindowFallbackTokens` (default 128K hosted / 32K local): context-window guess for models without limits metadata or a curated catalog entry. Every turn emits a `context_budget` event naming the window and its source, and the interactive warning fires once per model per session when the built-in default was used.
416
480
  - `manualCompaction` (`"llm-summary"` default, or `"heuristic"`): whether manual `/compact` asks the active model for a continuity summary or keeps the model-free bounded excerpt.
417
481
  - `theme` (string, default `purple`): name of a built-in palette (`/themes` lists and sets them, with `light` and oh-my-zsh ports like `robbyrussell` included). Unknown names fail loudly at startup with the valid names listed.
418
- - `reasoning` (`"none"` | `"minimal"` | `"low"` | `"medium"` | `"high"` | `"xhigh"` | `"provider-default"`, default `medium`): saved global fallback for the portable reasoning parameter. Run-scoped and per-model session choices take precedence. The `provider-default` sentinel omits the parameter; `/reasoning` changes only the in-memory session choice.
482
+ - `reasoning` (`"none"` | `"minimal"` | `"low"` | `"medium"` | `"high"` | `"xhigh"` | `"provider-default"`, default `low`): saved global fallback for the portable reasoning parameter. Run-scoped and per-model session choices take precedence. The `provider-default` sentinel omits the parameter; `/reasoning` changes only the in-memory session choice.
419
483
  - `providers[].capabilities.reasoningEffort` (optional boolean): explicitly allow or omit reasoning effort for that provider. Without it, local inference endpoints omit the parameter and hosted OpenAI-compatible endpoints pass it through, subject to model-specific restrictions.
420
484
 
421
485
  ## Safety model
package/SECURITY.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Version | Supported |
6
6
  |---------|-----------|
7
- | Latest minor (`1.5.x`) | Yes — security fixes |
7
+ | Latest minor (`1.6.x`) | Yes — security fixes |
8
8
  | Older minors and pre-1.0 (`0.x`) | No — upgrade required |
9
9
 
10
10
  Security fixes are provided for the latest published minor release. Upgrade to the newest release before reporting an issue that may already have been fixed.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "1.5.1",
4
- "commit": "d77c53f3eea3bec1757d583bc5a8e80cfd9fc3a2",
5
- "builtAt": "2026-10-07T21:45:47.260Z",
3
+ "version": "1.6.1",
4
+ "commit": "e9a2d0e3b4569cba17d8277b1923281c5faeb0e4",
5
+ "builtAt": "2026-10-24T15:20:57.408Z",
6
6
  "sourceRoot": "/Users/deniz.okcu/development/haze"
7
7
  }
@@ -11,19 +11,6 @@ export interface InputDemand {
11
11
  input: number;
12
12
  suggestions: number;
13
13
  }
14
- /** Allocate the entire normal-screen dynamic frame, never Static history. */
15
- export declare function allocateFrame(rows: number, columns: number, sections: FrameSections, demand?: InputDemand): {
16
- compact: boolean;
17
- input: number;
18
- border: number;
19
- activity: number;
20
- status: number;
21
- suggestions: number;
22
- tasks: number;
23
- queue: number;
24
- debug: number;
25
- live: number;
26
- };
27
14
  export declare function DynamicFrame({ rows, columns, sections, input }: {
28
15
  rows: number;
29
16
  columns: number;
@@ -3,7 +3,7 @@ import { useRef, useState } from 'react';
3
3
  import { Box, useBoxMetrics } from 'ink';
4
4
  import { theme } from '../../ui/theme.js';
5
5
  /** Allocate the entire normal-screen dynamic frame, never Static history. */
6
- export function allocateFrame(rows, columns, sections, demand = { input: 1, suggestions: 0 }) {
6
+ function allocateFrame(rows, columns, sections, demand = { input: 1, suggestions: 0 }) {
7
7
  // Keep normal-screen output below Ink's fullscreen threshold, including long
8
8
  // live previews. One-cell terminals still get an editable input row.
9
9
  let remaining = Math.max(1, Math.floor(rows) - 1);
@@ -12,6 +12,8 @@ const CHAT_COMMAND_SUGGESTIONS = [
12
12
  { value: '/thinking', description: 'Alias for /reasoning. Set reasoning effort for the active model, this session', kind: 'command' },
13
13
  { value: '/context', description: 'Show token breakdown of system, tools, MCP, and messages', kind: 'command' },
14
14
  { value: '/skills', description: 'Manage Markdown skills (add, enable/disable, validate, remove)', kind: 'command' },
15
+ { value: '/plugin ', description: 'Inspect/install local plugins and collections; manage installed project plugins', kind: 'command' },
16
+ { value: '/kit ', description: 'Alias for /plugin', kind: 'command' },
15
17
  { value: '/tips', description: 'Toggle the rotating tips shown while the model is thinking', kind: 'command' },
16
18
  { value: '/fleet ', description: 'Parallelize independent work in disposable contexts (flags: --review/--profile/--workers/--concurrency)', kind: 'command' },
17
19
  { value: '/init', description: 'Create or update AGENTS.md project instructions', kind: 'command' },
@@ -36,10 +36,12 @@ export declare function runSuspendedChild(launch: {
36
36
  * `suspendTerminal` affordances for ChatScreen: run a fullscreen child
37
37
  * ($EDITOR, pager) with the terminal handed over, then restore Ink state and
38
38
  * force a full redraw. `composeInEditor` returns the composed text (or
39
- * undefined when no editor is configured / nothing was typed); `viewInPager`
40
- * returns whether a pager actually ran.
39
+ * undefined when no editor is configured / nothing was typed); `editFileInEditor`
40
+ * opens an existing file and returns false when no editor is configured;
41
+ * `viewInPager` returns whether a pager actually ran.
41
42
  */
42
43
  export declare function useTerminalControl(): {
43
44
  composeInEditor: () => Promise<string | undefined>;
45
+ editFileInEditor: (file: string) => Promise<boolean>;
44
46
  viewInPager: (text: string) => Promise<boolean>;
45
47
  };
@@ -62,14 +62,16 @@ import { useCallback } from 'react';
62
62
  import { useApp, useIsScreenReaderEnabled, useWindowSize } from 'ink';
63
63
  import os from 'node:os';
64
64
  import path from 'node:path';
65
- import fs from 'fs-extra';
65
+ import fs from 'node:fs/promises';
66
+ import { remove } from '../../utils/fs.js';
66
67
  import { randomUUID } from 'node:crypto';
67
68
  /**
68
69
  * `suspendTerminal` affordances for ChatScreen: run a fullscreen child
69
70
  * ($EDITOR, pager) with the terminal handed over, then restore Ink state and
70
71
  * force a full redraw. `composeInEditor` returns the composed text (or
71
- * undefined when no editor is configured / nothing was typed); `viewInPager`
72
- * returns whether a pager actually ran.
72
+ * undefined when no editor is configured / nothing was typed); `editFileInEditor`
73
+ * opens an existing file and returns false when no editor is configured;
74
+ * `viewInPager` returns whether a pager actually ran.
73
75
  */
74
76
  export function useTerminalControl() {
75
77
  const { suspendTerminal } = useApp();
@@ -89,9 +91,18 @@ export function useTerminalControl() {
89
91
  return text || undefined;
90
92
  }
91
93
  finally {
92
- await fs.remove(file).catch(() => undefined);
94
+ await remove(file).catch(() => undefined);
93
95
  }
94
96
  }, [suspendTerminal]);
97
+ const editFileInEditor = useCallback(async (file) => {
98
+ const editor = resolveEditorCommand();
99
+ if (editor === false)
100
+ return false;
101
+ await suspendTerminal(async () => {
102
+ await runSuspendedChild({ command: editor.command, args: [...editor.args, file] });
103
+ });
104
+ return true;
105
+ }, [suspendTerminal]);
95
106
  const viewInPager = useCallback(async (text) => {
96
107
  if (screenReader)
97
108
  return false;
@@ -103,5 +114,5 @@ export function useTerminalControl() {
103
114
  });
104
115
  return true;
105
116
  }, [rows, screenReader, suspendTerminal]);
106
- return { composeInEditor, viewInPager };
117
+ return { composeInEditor, editFileInEditor, viewInPager };
107
118
  }
@@ -0,0 +1,10 @@
1
+ import type { Mode } from '../../commands/chatModes.js';
2
+ import { type WizardDispatchDeps, type WizardHandler, type WizardSetterContext } from './types.js';
3
+ /**
4
+ * `/plugin` picker handlers, mirroring the LSP/MCP wizard shape: the root
5
+ * picker (install/inspect/installed), per-plugin actions, source-directory
6
+ * input steps, collection-entry pickers, and the typed-"yes" confirm-remove.
7
+ * The heavy lifting stays in `pluginCommand.ts` (`runPluginCommand`), so the
8
+ * headless and interactive paths share one implementation.
9
+ */
10
+ export declare function createPluginWizardHandlers(deps: WizardDispatchDeps, ctx: WizardSetterContext): Partial<Record<Mode, WizardHandler>>;
@@ -0,0 +1,156 @@
1
+ import path from 'node:path';
2
+ import os from 'node:os';
3
+ import { listInstalledPlugins, pluginCollectionEntries, runPluginCommand } from '../../commands/pluginCommand.js';
4
+ import { PLUGIN_ACTIONS, PLUGIN_CHOICES } from '../../commands/wizardFlow.js';
5
+ import { confirmRemoveStep } from './types.js';
6
+ /**
7
+ * `/plugin` picker handlers, mirroring the LSP/MCP wizard shape: the root
8
+ * picker (install/inspect/installed), per-plugin actions, source-directory
9
+ * input steps, collection-entry pickers, and the typed-"yes" confirm-remove.
10
+ * The heavy lifting stays in `pluginCommand.ts` (`runPluginCommand`), so the
11
+ * headless and interactive paths share one implementation.
12
+ */
13
+ export function createPluginWizardHandlers(deps, ctx) {
14
+ const { setMode, showMessage } = ctx;
15
+ const setSelectedPluginName = ctx.setSelectedPluginName;
16
+ const setPluginSourceDir = ctx.setPluginSourceDir;
17
+ const runner = deps.pluginRunner ?? {
18
+ install: async (source, name) => runPluginCommand(['install', source, ...(name ? [name] : [])]),
19
+ inspect: async (source, name) => runPluginCommand(['inspect', source, ...(name ? [name] : [])]),
20
+ remove: async (name) => runPluginCommand(['remove', name]),
21
+ collection: pluginCollectionEntries,
22
+ };
23
+ async function reloadPlugins() {
24
+ try {
25
+ ctx.setPlugins(await listInstalledPlugins());
26
+ }
27
+ catch (error) {
28
+ showMessage(`Could not list installed plugins: ${error instanceof Error ? error.message : String(error)}`);
29
+ }
30
+ }
31
+ /** Run one plugin action, surface its message or failure, and return to chat; reload list + skills after installs. */
32
+ async function settle(action, installed) {
33
+ try {
34
+ showMessage(await action);
35
+ }
36
+ catch (error) {
37
+ showMessage(error instanceof Error ? error.message : String(error));
38
+ }
39
+ if (installed) {
40
+ await reloadPlugins();
41
+ await deps.refreshSkills();
42
+ }
43
+ setMode('chat');
44
+ }
45
+ async function selectPlugin(value) {
46
+ if (value === PLUGIN_CHOICES.installPlugin) {
47
+ setPluginSourceDir(undefined);
48
+ ctx.setPluginCollectionEntries([]);
49
+ setMode('pluginInstallSource');
50
+ showMessage('Local plugin directory to install? Relative paths resolve from the workspace; quote paths with spaces. Clone remote repositories locally first.');
51
+ return;
52
+ }
53
+ if (value === PLUGIN_CHOICES.inspectPlugin) {
54
+ setPluginSourceDir(undefined);
55
+ ctx.setPluginCollectionEntries([]);
56
+ setMode('pluginInspectSource');
57
+ showMessage('Local plugin directory to inspect? Only skills are activated on install; review source first.');
58
+ return;
59
+ }
60
+ if (!deps.wizard.plugins.some(plugin => plugin.name === value)) {
61
+ showMessage(`No installed plugin named ${value}. Choose install plugin, inspect plugin, or an installed plugin.`);
62
+ return;
63
+ }
64
+ setSelectedPluginName(value);
65
+ setMode('pluginAction');
66
+ showMessage(`Plugin ${value}: choose an action.`);
67
+ }
68
+ /** Shared source-directory submit: install or inspect, with collection branching. */
69
+ async function submitSource(kind, source) {
70
+ const trimmed = source.trim();
71
+ if (!trimmed) {
72
+ showMessage('Plugin directory is required. Enter a local path, or press ESC to cancel.');
73
+ return;
74
+ }
75
+ try {
76
+ // A collection: offer its entries instead of acting on the root. Root
77
+ // manifests keep precedence, exactly like runPluginCommand('inspect').
78
+ const entries = await runner.collection(trimmed);
79
+ setPluginSourceDir(trimmed);
80
+ ctx.setPluginCollectionEntries(entries);
81
+ setMode(kind === 'install' ? 'pluginInstallName' : 'pluginInspectName');
82
+ showMessage(`Plugin collection: choose an entry to ${kind}.`);
83
+ return;
84
+ }
85
+ catch {
86
+ // Not a collection (or unreadable as one): act on the directory itself.
87
+ }
88
+ await settle(kind === 'install' ? runner.install(trimmed, undefined) : runner.inspect(trimmed, undefined), kind === 'install');
89
+ }
90
+ async function submitCollectionEntry(kind, name) {
91
+ const source = deps.wizard.pluginSourceDir;
92
+ if (!source || !deps.wizard.pluginCollectionEntries.some(entry => entry.name === name)) {
93
+ showMessage('No plugin source selected. Start over with /plugin.');
94
+ setMode('chat');
95
+ return;
96
+ }
97
+ await settle(kind === 'install' ? runner.install(source, name) : runner.inspect(source, name), kind === 'install');
98
+ setPluginSourceDir(undefined);
99
+ ctx.setPluginCollectionEntries([]);
100
+ }
101
+ async function selectPluginAction(action) {
102
+ const name = deps.wizard.selectedPluginName;
103
+ if (!name) {
104
+ showMessage('No plugin selected. Start over with /plugin.');
105
+ setMode('chat');
106
+ return;
107
+ }
108
+ if (action === PLUGIN_ACTIONS.showInfo) {
109
+ // The installed copy under ~/.haze/plugins keeps the package manifest, so
110
+ // inspecting it shows the real summary; the list output stays the
111
+ // fallback for skills-only layouts.
112
+ try {
113
+ showMessage(await runner.inspect(path.join(os.homedir(), '.haze', 'plugins', name), name));
114
+ setMode('chat');
115
+ }
116
+ catch {
117
+ await settle(listSummary(), false);
118
+ }
119
+ return;
120
+ }
121
+ if (action === PLUGIN_ACTIONS.removePlugin) {
122
+ setMode('pluginConfirmRemove');
123
+ showMessage(`Remove plugin ${name}? Modified and unowned files are preserved. Type "yes" to confirm.`);
124
+ return;
125
+ }
126
+ showMessage(`Unknown plugin action: ${action}.`);
127
+ }
128
+ async function listSummary() {
129
+ try {
130
+ return await runPluginCommand(['list']);
131
+ }
132
+ catch (error) {
133
+ return error instanceof Error ? error.message : String(error);
134
+ }
135
+ }
136
+ const pluginConfirmRemoveMode = confirmRemoveStep(ctx, {
137
+ selectedName: () => deps.wizard.selectedPluginName,
138
+ cancelMessage: 'Cancelled. Plugin not removed.',
139
+ clearSelection: () => setSelectedPluginName(undefined),
140
+ remove: async (name) => {
141
+ const message = await runner.remove(name);
142
+ await reloadPlugins();
143
+ await deps.refreshSkills();
144
+ return message;
145
+ },
146
+ });
147
+ return {
148
+ plugins: selectPlugin,
149
+ pluginAction: selectPluginAction,
150
+ pluginInstallSource: (value) => submitSource('install', value),
151
+ pluginInspectSource: (value) => submitSource('inspect', value),
152
+ pluginInstallName: (value) => submitCollectionEntry('install', value),
153
+ pluginInspectName: (value) => submitCollectionEntry('inspect', value),
154
+ pluginConfirmRemove: pluginConfirmRemoveMode,
155
+ };
156
+ }
@@ -1,4 +1,4 @@
1
- import fs from 'fs-extra';
1
+ import { remove } from '../../../utils/fs.js';
2
2
  import { loadSkillRegistry } from '../../../skills/SkillRegistry.js';
3
3
  import { createSkill, toSkillDirName } from '../../../skills/builder/SkillBuilder.js';
4
4
  import { selectSkillActionResult, selectSkillResult, captureSkillDescription as captureSkillDescriptionResult, skillCreationFailure, skillCreationMessage, skillConfirmRemoveResult as skillConfirmRemove } from '../../commands/skillsWizard.js';
@@ -108,7 +108,7 @@ export function createSkillsWizardHandlers(deps, ctx) {
108
108
  if (result.mode === 'chat')
109
109
  setMode('chat');
110
110
  if (result.removedDir)
111
- await fs.remove(result.removedDir);
111
+ await remove(result.removedDir);
112
112
  if (result.settingsPatch)
113
113
  await ctx.applySettings(result.settingsPatch);
114
114
  if (result.removedDir)
@@ -13,6 +13,16 @@ export interface WizardDispatchDeps {
13
13
  settings: HazeSettings;
14
14
  skills: LoadedSkill[];
15
15
  sessions?: SessionSummary[];
16
+ /** Plugin install/inspect/remove/collection actions for the `/plugin` picker; defaults to the pluginCommand implementations. */
17
+ pluginRunner?: {
18
+ install: (source: string, name: string | undefined) => Promise<string>;
19
+ inspect: (source: string, name: string | undefined) => Promise<string>;
20
+ remove: (name: string) => Promise<string>;
21
+ collection: (source: string) => Promise<{
22
+ name: string;
23
+ description?: string;
24
+ }[]>;
25
+ };
16
26
  /** Wizard flow UI state (selection, drafts, model discovery). */
17
27
  wizard: WizardUiState;
18
28
  updateWizard: (action: WizardUiAction) => void;
@@ -52,6 +62,16 @@ export interface WizardSetterContext {
52
62
  setLspDraft: (value: Partial<HazeLspServer>) => void;
53
63
  setSelectedMcpName: (value: string | undefined) => void;
54
64
  setMcpDraft: (value: Partial<HazeMcpServer>) => void;
65
+ setSelectedPluginName: (value: string | undefined) => void;
66
+ setPluginSourceDir: (value: string | undefined) => void;
67
+ setPlugins: (value: {
68
+ name: string;
69
+ version?: string;
70
+ }[]) => void;
71
+ setPluginCollectionEntries: (value: {
72
+ name: string;
73
+ description?: string;
74
+ }[]) => void;
55
75
  setDiscoveredModels: (value: string[]) => void;
56
76
  setSuggestedModels: (value: string[]) => void;
57
77
  }
@@ -23,10 +23,22 @@ export interface WizardUiState {
23
23
  lspDraft: Partial<HazeLspServer>;
24
24
  selectedMcpName?: string;
25
25
  mcpDraft: Partial<HazeMcpServer>;
26
+ /** Installed project plugins (`/plugin` picker); loaded when the picker opens. */
27
+ plugins: {
28
+ name: string;
29
+ version?: string;
30
+ }[];
31
+ selectedPluginName?: string;
32
+ /** Directory last pointed at by install/inspect; collection entries found there. */
33
+ pluginSourceDir?: string;
34
+ pluginCollectionEntries: {
35
+ name: string;
36
+ description?: string;
37
+ }[];
26
38
  }
27
39
  export type WizardUiAction = {
28
40
  type: 'set';
29
- key: 'selectedSessionId' | 'modelProviderFilter' | 'selectedProviderName' | 'selectedSkillName' | 'selectedLspName' | 'selectedMcpName';
41
+ key: 'selectedSessionId' | 'modelProviderFilter' | 'selectedProviderName' | 'selectedSkillName' | 'selectedLspName' | 'selectedMcpName' | 'selectedPluginName' | 'pluginSourceDir';
30
42
  value: string | undefined;
31
43
  } | {
32
44
  type: 'providerDraft';
@@ -49,6 +61,18 @@ export type WizardUiAction = {
49
61
  } | {
50
62
  type: 'suggestedModels';
51
63
  value: string[];
64
+ } | {
65
+ type: 'plugins';
66
+ value: {
67
+ name: string;
68
+ version?: string;
69
+ }[];
70
+ } | {
71
+ type: 'pluginCollectionEntries';
72
+ value: {
73
+ name: string;
74
+ description?: string;
75
+ }[];
52
76
  } | {
53
77
  type: 'reset';
54
78
  };
@@ -1,5 +1,5 @@
1
1
  export function initialWizardUiState() {
2
- return { discoveredModels: [], suggestedModels: [], providerDraft: {}, skillDraft: {}, lspDraft: {}, mcpDraft: {} };
2
+ return { discoveredModels: [], suggestedModels: [], providerDraft: {}, skillDraft: {}, lspDraft: {}, mcpDraft: {}, plugins: [], pluginCollectionEntries: [] };
3
3
  }
4
4
  export function wizardUiReducer(state, action) {
5
5
  switch (action.type) {
@@ -10,6 +10,8 @@ export function wizardUiReducer(state, action) {
10
10
  case 'mcpDraft': return { ...state, mcpDraft: action.value };
11
11
  case 'discoveredModels': return { ...state, discoveredModels: action.value };
12
12
  case 'suggestedModels': return { ...state, suggestedModels: action.value };
13
+ case 'plugins': return { ...state, plugins: action.value };
14
+ case 'pluginCollectionEntries': return { ...state, pluginCollectionEntries: action.value };
13
15
  case 'reset': return initialWizardUiState();
14
16
  }
15
17
  }
@@ -4,6 +4,7 @@ import { createProviderWizardHandlers } from './wizard/providerHandlers.js';
4
4
  import { createSkillsWizardHandlers } from './wizard/skillsHandlers.js';
5
5
  import { createLspWizardHandlers } from './wizard/lspHandlers.js';
6
6
  import { createMcpWizardHandlers } from './wizard/mcpHandlers.js';
7
+ import { createPluginWizardHandlers } from './wizard/pluginHandlers.js';
7
8
  import { createSessionThemeHandlers } from './wizard/sessionThemeHandlers.js';
8
9
  export { initialWizardUiState, wizardUiReducer } from './wizard/uiState.js';
9
10
  export { transitionMcpField, transitionProviderField } from './wizard/fieldTransitions.js';
@@ -30,6 +31,10 @@ export function createWizardDispatch(deps) {
30
31
  setLspDraft: value => deps.updateWizard({ type: 'lspDraft', value }),
31
32
  setSelectedMcpName: value => deps.updateWizard({ type: 'set', key: 'selectedMcpName', value }),
32
33
  setMcpDraft: value => deps.updateWizard({ type: 'mcpDraft', value }),
34
+ setSelectedPluginName: value => deps.updateWizard({ type: 'set', key: 'selectedPluginName', value }),
35
+ setPluginSourceDir: value => deps.updateWizard({ type: 'set', key: 'pluginSourceDir', value }),
36
+ setPlugins: value => deps.updateWizard({ type: 'plugins', value }),
37
+ setPluginCollectionEntries: value => deps.updateWizard({ type: 'pluginCollectionEntries', value }),
33
38
  setDiscoveredModels: value => deps.updateWizard({ type: 'discoveredModels', value }),
34
39
  setSuggestedModels: value => deps.updateWizard({ type: 'suggestedModels', value }),
35
40
  };
@@ -41,6 +46,7 @@ export function createWizardDispatch(deps) {
41
46
  ...provider.handlers,
42
47
  ...createLspWizardHandlers(deps, ctx),
43
48
  ...mcp.handlers,
49
+ ...createPluginWizardHandlers(deps, ctx),
44
50
  };
45
51
  /** Apply one field-transition effect at the submit boundary (was chat.tsx inline branching). */
46
52
  async function applyProviderEffect(effect) {
@@ -48,6 +48,7 @@ import { modelThinkingLabel } from '../../utils/modelName.js';
48
48
  import { commandParts } from './wizardFlow.js';
49
49
  import { backgroundProcessCount, subscribeBackgroundProcesses, teardownBackgroundProcesses } from '../../core/process/backgroundRegistry.js';
50
50
  import { MAX_SESSION_PICKER_RESULTS } from './sessionPicker.js';
51
+ import { listInstalledPlugins } from './pluginCommand.js';
51
52
  /** Latest Ink render metrics under --debug (module-level: render options are outside React). */
52
53
  let renderMetricsReader;
53
54
  function thinkingLabelForSettings(settings) {
@@ -182,7 +183,7 @@ function ChatScreen({ debug = false, version, build, continueSession = false, re
182
183
  // Wizard flow state (selection, drafts, model discovery) in one reducer;
183
184
  // this replaced twelve individual useState hooks.
184
185
  const [wizardState, updateWizard] = useReducer(wizardUiReducer, undefined, initialWizardUiState);
185
- const { modelProviderFilter, discoveredModels, suggestedModels, selectedProviderName, providerDraft, selectedSkillName, selectedLspName, selectedMcpName } = wizardState;
186
+ const { modelProviderFilter, discoveredModels, suggestedModels, selectedProviderName, providerDraft, selectedSkillName, selectedLspName, selectedMcpName, plugins, selectedPluginName, pluginCollectionEntries } = wizardState;
186
187
  useEffect(() => subscribeBackgroundProcesses(() => setBackgroundCount(backgroundProcessCount())), []);
187
188
  // One tip per thinking section, shown under the busy label while the model
188
189
  // is purely thinking (no tool running) and the user has not disabled tips.
@@ -341,6 +342,17 @@ function ChatScreen({ debug = false, version, build, continueSession = false, re
341
342
  const hidden = Math.max(0, next.length - MAX_SESSION_PICKER_RESULTS);
342
343
  setMessages(m => [...m, { role: 'system', text: `Choose a saved session (newest first)${hidden ? `. Showing ${MAX_SESSION_PICKER_RESULTS} of ${next.length}; ${hidden} older sessions are hidden.` : '.'}` }]);
343
344
  }
345
+ async function openPluginPicker() {
346
+ try {
347
+ updateWizard({ type: 'plugins', value: await listInstalledPlugins() });
348
+ }
349
+ catch (error) {
350
+ setMessages(m => [...m, { role: 'system', text: `Could not list installed plugins: ${error instanceof Error ? error.message : String(error)}` }]);
351
+ return;
352
+ }
353
+ setMode('plugins');
354
+ setMessages(m => [...m, { role: 'system', text: 'Choose install plugin, inspect plugin, or an installed plugin to manage. Only skills activate; no scripts, hooks, or MCP servers run.' }]);
355
+ }
344
356
  function cancelThinking() {
345
357
  if (!busy)
346
358
  return;
@@ -405,7 +417,7 @@ function ChatScreen({ debug = false, version, build, continueSession = false, re
405
417
  const message = error instanceof Error ? error.message : String(error);
406
418
  setSettingsError(message);
407
419
  if (!/^\/(?:settings\s+(?:open|edit)|help|exit|quit)\b/i.test(value.trim())) {
408
- setMessages(messages => [...messages, { role: 'system', text: `${message}\nRepair settings, then retry. /settings open, /help, and /exit remain available.` }]);
420
+ setMessages(messages => [...messages, { role: 'system', text: `${message}\nRepair settings, then retry. /settings edit (or /settings open), /help, and /exit remain available.` }]);
409
421
  return;
410
422
  }
411
423
  }
@@ -461,6 +473,9 @@ function ChatScreen({ debug = false, version, build, continueSession = false, re
461
473
  return text;
462
474
  },
463
475
  viewInPager: terminalControl.viewInPager,
476
+ editFileInEditor: terminalControl.editFileInEditor,
477
+ refreshSkills,
478
+ openPluginPicker,
464
479
  refreshContextFiles: async () => {
465
480
  const files = await readContextFiles().catch(() => contextFiles);
466
481
  setContextFiles(files);
@@ -688,7 +703,7 @@ function ChatScreen({ debug = false, version, build, continueSession = false, re
688
703
  const workspaceLabel = `${compactHomePath(process.cwd())}${branchName ? ` (${branchName})` : ''}`;
689
704
  const enabledSkillCount = new Set(skills.filter(skill => isSkillEnabled(settings, skill.name, skill.source)).map(skill => skill.name)).size;
690
705
  const metrics = statusBarMetrics({ messages: [...messages, ...liveMessages], tokenUsage, enabledSkillCount, backgroundProcessCount: backgroundCount });
691
- const inputSuggestions = inputSuggestionsForState({ mode, settings, skills, sessions, selectedProviderName, modelProviderFilter, providerDraftName: providerDraft.name, discoveredModels, suggestedModels, selectedSkillName, selectedLspName, selectedMcpName, sessionReasoning });
706
+ const inputSuggestions = inputSuggestionsForState({ mode, settings, skills, sessions, selectedProviderName, modelProviderFilter, providerDraftName: providerDraft.name, discoveredModels, suggestedModels, selectedSkillName, selectedLspName, selectedMcpName, plugins, selectedPluginName, pluginCollectionEntries, sessionReasoning });
692
707
  const staticItems = [
693
708
  { kind: 'header', key: 'header', subtitle: headerSubtitle },
694
709
  ...staticTranscriptItems,