@denizokcu/haze 1.5.0 → 1.6.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +74 -5
  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 +7 -2
  7. package/dist/cli/chat/inputSuggestions.js +2 -0
  8. package/dist/cli/chat/resizeGuard.d.ts +20 -0
  9. package/dist/cli/chat/resizeGuard.js +25 -0
  10. package/dist/cli/chat/terminalControl.d.ts +4 -2
  11. package/dist/cli/chat/terminalControl.js +16 -5
  12. package/dist/cli/chat/wizard/pluginHandlers.d.ts +10 -0
  13. package/dist/cli/chat/wizard/pluginHandlers.js +156 -0
  14. package/dist/cli/chat/wizard/skillsHandlers.js +2 -2
  15. package/dist/cli/chat/wizard/types.d.ts +20 -0
  16. package/dist/cli/chat/wizard/uiState.d.ts +25 -1
  17. package/dist/cli/chat/wizard/uiState.js +3 -1
  18. package/dist/cli/chat/wizardDispatch.js +6 -0
  19. package/dist/cli/commands/chat.js +27 -5
  20. package/dist/cli/commands/commandHelp.js +7 -2
  21. package/dist/cli/commands/commands.d.ts +5 -0
  22. package/dist/cli/commands/commands.js +17 -3
  23. package/dist/cli/commands/initCommand.js +3 -2
  24. package/dist/cli/commands/pluginCommand.d.ts +16 -0
  25. package/dist/cli/commands/pluginCommand.js +127 -0
  26. package/dist/cli/commands/reasoningCommand.d.ts +0 -15
  27. package/dist/cli/commands/reasoningCommand.js +1 -3
  28. package/dist/cli/commands/skillsWizard.js +4 -0
  29. package/dist/cli/commands/streaming/agentAttempt.js +2 -1
  30. package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -0
  31. package/dist/cli/commands/streaming/attemptOutcome.js +4 -3
  32. package/dist/cli/commands/streaming/attemptSetup.d.ts +2 -0
  33. package/dist/cli/commands/streaming/attemptSetup.js +3 -2
  34. package/dist/cli/commands/streaming/stallRecovery.d.ts +6 -0
  35. package/dist/cli/commands/streaming/stallRecovery.js +6 -5
  36. package/dist/cli/commands/streaming/turnRuntime.js +2 -4
  37. package/dist/cli/commands/wizardFlow.d.ts +59 -0
  38. package/dist/cli/commands/wizardFlow.js +40 -0
  39. package/dist/cli/contextReportCli.js +4 -3
  40. package/dist/cli/index.js +19 -2
  41. package/dist/config/contextFiles.js +3 -2
  42. package/dist/config/inputHistory.js +3 -3
  43. package/dist/config/paths.d.ts +1 -0
  44. package/dist/config/paths.js +1 -0
  45. package/dist/config/providerAuth.js +3 -3
  46. package/dist/config/settings.d.ts +14 -2
  47. package/dist/config/settings.js +8 -4
  48. package/dist/config/updateCheck.js +3 -3
  49. package/dist/core/agent/budgets.d.ts +17 -0
  50. package/dist/core/agent/budgets.js +19 -0
  51. package/dist/core/agent/reasoningPolicy.js +1 -1
  52. package/dist/core/agent/workState.d.ts +0 -2
  53. package/dist/core/agent/workState.js +1 -1
  54. package/dist/core/log/llmLog.js +1 -1
  55. package/dist/core/providerContracts.d.ts +6 -3
  56. package/dist/core/session/sessionStore.js +4 -3
  57. package/dist/core/subagent/contracts.d.ts +1 -11
  58. package/dist/core/subagent/contracts.js +0 -22
  59. package/dist/llm/client.js +28 -7
  60. package/dist/llm/subagentRunner.d.ts +1 -6
  61. package/dist/llm/subagentRunner.js +11 -23
  62. package/dist/llm/tools/fileTools.js +2 -3
  63. package/dist/llm/tools/gitIgnore.js +1 -1
  64. package/dist/llm/tools/grepRunner.d.ts +10 -0
  65. package/dist/llm/tools/grepRunner.js +24 -0
  66. package/dist/llm/tools/toolContext.d.ts +2 -3
  67. package/dist/llm/tools/toolContext.js +2 -3
  68. package/dist/llm/tools/toolContextState.d.ts +0 -1
  69. package/dist/llm/tools/toolContextState.js +1 -4
  70. package/dist/llm/workerContext.d.ts +0 -7
  71. package/dist/llm/workerContext.js +0 -17
  72. package/dist/skills/SkillLoader.js +3 -2
  73. package/dist/skills/SkillRegistry.js +7 -4
  74. package/dist/skills/builder/SkillBuilder.js +11 -10
  75. package/dist/skills/plugins/installer.d.ts +25 -0
  76. package/dist/skills/plugins/installer.js +272 -0
  77. package/dist/skills/plugins/package.d.ts +41 -0
  78. package/dist/skills/plugins/package.js +275 -0
  79. package/dist/skills/plugins/runtime.d.ts +3 -0
  80. package/dist/skills/plugins/runtime.js +108 -0
  81. package/dist/skills/skillTools.js +10 -5
  82. package/dist/skills/types.d.ts +4 -0
  83. package/dist/ui/codeHighlight.d.ts +1 -1
  84. package/dist/ui/codeHighlight.js +112 -4
  85. package/dist/ui/components/StreamingMarkdownText.d.ts +0 -2
  86. package/dist/ui/components/StreamingMarkdownText.js +1 -1
  87. package/dist/ui/components/TextInput.d.ts +1 -1
  88. package/dist/utils/fs.d.ts +10 -0
  89. package/dist/utils/fs.js +37 -2
  90. package/package.json +17 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0 - 2026-10-24
4
+
5
+ Class-aware idle-stream stall windows so patient local models are not mistaken for dead streams.
6
+
7
+ ### Added
8
+
9
+ - `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.
10
+
11
+ ## 1.5.1 - 2026-10-07
12
+
13
+ Terminal transcript replay on resize and capability-aware reasoning effort.
14
+
15
+ ### Fixed
16
+
17
+ - On terminal width changes, clear the viewport and replay the full settled transcript, including formatted Markdown, at the new width. Only `<Static>` remounts: input drafts and active turns retain their state. Scrollback is not erased, so earlier transcript copies can remain there after replay.
18
+ - Size the dynamic frame against the live Yoga root during Ink's synchronous resize pass, avoiding stale numeric widths before React commits the new terminal dimensions.
19
+ - Gate reasoning effort by endpoint capability. Explicit provider `capabilities.reasoningEffort` overrides win; otherwise local inference endpoints omit the parameter and hosted OpenAI-compatible endpoints retain SDK pass-through. Omission avoids local servers coercing unsupported levels into an enabled reasoning switch; their own default still applies.
20
+ - Match the pinned OpenAI SDK's GPT-6+ restrictions: omit `minimal`, and omit `none` except for exactly `gpt-6-sol` and `gpt-6-luna`. Unsupported choices use the provider default rather than being promoted to another effort; reasoning-policy events explain the omission.
21
+
22
+ ### Documentation
23
+
24
+ - Refresh release metadata, README, public documentation, and scoped AGENTS guidance for 1.5.1; correct session-only reasoning semantics, the `medium` default, and formatted streaming/resize behavior.
25
+
3
26
  ## 1.5.0 - 2026-10-04
4
27
 
5
28
  Ink 8 terminal modernization with formatted streamed Markdown, per-model session-scoped reasoning, model steering for compact models, and pinned session model selections.
package/README.md CHANGED
@@ -2,7 +2,22 @@
2
2
 
3
3
  A minimal LLM harness for your terminal.
4
4
 
5
- ## What's new in 1.5.0
5
+ ## What's new in 1.6.0
6
+
7
+ haze 1.6.0 stops mistaking patient local models for dead streams:
8
+
9
+ - 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.
10
+ - 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.
11
+
12
+ ### Highlights from 1.5.1
13
+
14
+ haze 1.5.1 improves terminal resizing and reasoning-effort compatibility:
15
+
16
+ - On terminal width changes, haze replays the full settled transcript, including formatted Markdown, at the new width. The input draft and active turn stay mounted. Terminal scrollback is preserved, so older transcript copies can remain there after a replay.
17
+ - Local inference endpoints omit reasoning effort by default; providers can explicitly enable or disable it with `capabilities.reasoningEffort`. Hosted OpenAI-compatible endpoints retain pass-through behavior.
18
+ - Unsupported `none`/`minimal` choices for GPT-6+ model names are omitted rather than promoted to a different effort; the provider default applies.
19
+
20
+ ### Highlights from 1.5.0
6
21
 
7
22
  haze 1.5.0 modernizes the terminal experience on Ink 8 — formatted streamed Markdown, native spinners and busy indicators, `$EDITOR`/`$PAGER` handoffs, and IME-aware cursor placement — and adds model steering for compact models, per-model session-scoped `/reasoning` (with the `/thinking` alias), pinned session model selections, and a metadata-only `haze report`.
8
23
 
@@ -106,7 +121,9 @@ Saved settings live in `~/.haze/settings.json`. ChatGPT OAuth credentials live s
106
121
 
107
122
  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.
108
123
 
109
- Control reasoning effort with `/reasoning`. The picker (or `/reasoning <level>`) sets one of `none`, `minimal`, `low`, `medium`, `high`, or `xhigh`; the default is `high` when nothing is saved. `/reasoning unset` returns to the provider default (no reasoning parameter is sent) and `/reasoning status` shows the current level. The level is sent as the AI SDK's portable reasoning parameter (the standard `reasoning_effort` field on OpenAI-compatible endpoints) and applies from the next turn. Endpoints without native support ignore it. The selection persists as `reasoning` in `~/.haze/settings.json`; the current level is shown in the bottom status bar next to the model name.
124
+ 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.
125
+
126
+ 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.
110
127
 
111
128
  haze focuses on chat, local tools, context files, sessions, and Markdown skills. Use `/skills` for workflows outside that core. Its interactive picker can generate a skill from a description, then enable, disable, validate, or remove it. For reviews, release prep, deploy checks, debugging routines, or a team-specific checklist, ask haze to create a skill and edit the resulting Markdown as needed.
112
129
 
@@ -118,7 +135,7 @@ Open a project and ask for work:
118
135
  create a calculator in calc-app in ruby with add subtract multiply divide
119
136
  ```
120
137
 
121
- haze can inspect and edit files, fetch public URLs, and run commands. Tool activity stays compact in the transcript. Completed transcript entries render once as static terminal output, which keeps live model and spinner updates from repainting the full history. During a streamed answer, completed root-level Markdown blocks move into that static history while the unfinished block stays plain and live. Small edits show a colorized diff with one line of context on either side; large diffs get a short summary instead. Shell output is capped while the command runs, then filtered according to the command type. Validation failures keep the useful diagnostics. Raw output handles have per-entry and total memory limits, and tell you how many bytes were dropped. Sessions are saved after their first resumable message, so you can pick up the latest workspace conversation with `haze --continue` or `/resume` without accumulating empty session files.
138
+ haze can inspect and edit files, fetch public URLs, and run commands. Tool activity stays compact in the transcript. Settled transcript entries normally render once as static terminal output, keeping typing, live model output, and spinner updates from repainting the full history. Streaming Markdown remains formatted: parser-stable root blocks move into static history while the final, still-changing block stays in the bounded dynamic tail. On a terminal width change, haze clears the viewport and replays the full static transcript with fresh Markdown layout; the draft and running turn keep their state. This does not erase scrollback, which may retain earlier transcript copies. Small edits show a colorized diff with one line of context on either side; large diffs get a short summary instead. Shell output is capped while the command runs, then filtered according to the command type. Validation failures keep the useful diagnostics. Raw output handles have per-entry and total memory limits, and tell you how many bytes were dropped. Sessions are saved after their first resumable message, so you can pick up the latest workspace conversation with `haze --continue` or `/resume` without accumulating empty session files.
122
139
 
123
140
  The agent can start up to five dev servers or watchers as registered background processes. Their rolling output is capped at 256 KB and remains available through `readToolOutput`; the `process` tool lists, reads, and kills them. The status bar shows the live count. Starting a new session or exiting haze terminates every registered process tree, while aborting an individual turn leaves background work running. Background processes are unavailable inside fleet workers and never survive haze itself.
124
141
 
@@ -208,6 +225,57 @@ They are also available through one `skill` catalog tool. haze loads one workflo
208
225
 
209
226
  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.
210
227
 
228
+ ## Shared plugins and marketplaces
229
+
230
+ Haze accepts local [Agent Plugins 1.0.0](https://agent-plugins.org/specification)
231
+ packages (`plugin.json` plus `skills/`) and existing Claude Code/Codex legacy
232
+ manifests (`.claude-plugin/plugin.json`, `.codex-plugin/plugin.json`). The canonical
233
+ root manifest takes precedence. Claude and OpenAI collections can reference the
234
+ same plugin directories through their respective marketplace catalogs.
235
+
236
+ ```sh
237
+ haze plugin inspect ../haze-kits
238
+ haze plugin inspect ../haze-kits speckit
239
+ haze plugin install ../haze-kits speckit
240
+ haze plugin list
241
+ haze plugin remove speckit
242
+ ```
243
+
244
+ The same operations are available as `/plugin …` in chat; `kit` and `/kit` are aliases.
245
+ Quote local paths containing spaces. Install from a plugin directory directly or
246
+ select a named plugin from a local `.claude-plugin/marketplace.json` or
247
+ `.agents/plugins/marketplace.json` collection. Remote entries require cloning locally
248
+ first; Haze does not download marketplace repositories or honor their installation policies.
249
+
250
+ Packages install globally into `~/.haze/plugins/<name>` with ownership receipts in
251
+ `~/.haze/plugin-receipts`; installation never writes workspace content. Only
252
+ receipt-listed packages activate; copying a collection or Claude cache into a
253
+ directory does not enable it. Plugin skills are globally installed, stay
254
+ untrusted third-party content, and are invoked as `/<plugin>:<skill>`, such as
255
+ `/speckit:speckit-plan`. Use `/skills` to enable/disable them, and `/plugin remove`
256
+ to uninstall the package. Legacy Claude custom skill paths are supported when
257
+ contained in the package.
258
+
259
+ **Compatibility is skills-focused, not a universal plugin runtime.** Hooks, MCP
260
+ servers, agents, legacy command files, LSP and unknown extensions are reported but
261
+ not activated. Host-specific frontmatter, argument expansion, dynamic shell
262
+ preprocessing and tool restrictions are not emulated. Do not rely on those features
263
+ for workflow correctness or safety. Bundled scripts can be run by the agent through
264
+ normal tools when a skill requests it; installation itself executes no package code.
265
+
266
+ The optional `extensions.dev.haze.workspaceFiles` mapping is no longer supported:
267
+ plugins install globally and never write workspace content. Such extensions are
268
+ reported and ignored like other unknown extensions. Bundled workflow assets stay
269
+ inside `~/.haze/plugins/<name>`; the Spec Kit plugin's setup skill copies what a
270
+ project needs from there using normal agent tools. Reinstalling identical content
271
+ is idempotent; remove before changing versions. Protected secrets and package
272
+ symlinks are refused. Interrupted operations can leave partial files and
273
+ `~/.haze/plugin-receipts/.lock`; inspect before manually clearing a stale lock.
274
+ This is not a filesystem sandbox or crash-safe transaction journal.
275
+
276
+ See the collection's README and [plugin interoperability notes](docs/plugin-compatibility.md)
277
+ for official sources, layouts, support limits and cross-agent setup.
278
+
211
279
  ## Commands
212
280
 
213
281
  ```txt
@@ -220,7 +288,7 @@ When you catch yourself repeating the same instructions, put them in a skill. Th
220
288
  /settings open
221
289
  /themes
222
290
  /themes <name>
223
- /reasoning [level|unset|status]
291
+ /reasoning [level|unset|reset|status]
224
292
  /logs [id]
225
293
  /lsp
226
294
  /mcp
@@ -405,7 +473,8 @@ Most haze behaviour needs no configuration; a few optional keys in `~/.haze/sett
405
473
  - `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.
406
474
  - `manualCompaction` (`"llm-summary"` default, or `"heuristic"`): whether manual `/compact` asks the active model for a continuity summary or keeps the model-free bounded excerpt.
407
475
  - `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.
408
- - `reasoning` (`"none"` | `"minimal"` | `"low"` | `"medium"` | `"high"` | `"xhigh"` | `"provider-default"`, default `high`): reasoning-effort level sent as the portable reasoning parameter. An absent key means `high`; the `provider-default` sentinel means no parameter is sent. `/reasoning` lists, sets, and clears it.
476
+ - `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.
477
+ - `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.
409
478
 
410
479
  ## Safety model
411
480
 
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.0",
4
- "commit": "cd0daa845cacfe4aee5adb0cd8f521c9885acf79",
5
- "builtAt": "2026-10-04T20:57:37.360Z",
3
+ "version": "1.6.0",
4
+ "commit": "18eee57e33c3bf36f6d464a52949acade2562cea",
5
+ "builtAt": "2026-10-24T13:09:16.106Z",
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);
@@ -39,5 +39,10 @@ export function DynamicFrame({ rows, columns, sections, input }) {
39
39
  // Previous measurements may be wider on shrink: first-render arithmetic stays authoritative.
40
40
  const inputWidth = metrics.hasMeasured && metrics.clientWidth > 0 ? Math.min(safeWidth, metrics.clientWidth) : safeWidth;
41
41
  const onRowsChange = (next) => setDemand(previous => previous.input === next.input && previous.suggestions === next.suggestions ? previous : next);
42
- return _jsxs(Box, { flexDirection: "column", width: Math.max(1, columns), flexShrink: 0, children: [_jsx(Panel, { rows: budget.live, children: typeof sections.live === 'function' ? sections.live(budget.live) : sections.live }), _jsx(Panel, { rows: budget.debug, children: sections.debug }), _jsx(Panel, { rows: budget.queue, children: sections.queue }), _jsx(Panel, { rows: budget.tasks, children: sections.tasks }), _jsx(Panel, { rows: budget.activity, children: sections.activity }), _jsx(Box, { flexDirection: "column", height: budget.input + budget.suggestions + budget.border, flexShrink: 0, overflow: "hidden", borderStyle: budget.border ? 'round' : undefined, borderColor: theme.border, paddingX: budget.border ? 1 : 0, children: _jsx(Box, { ref: inputRef, width: "100%", flexDirection: "column", minWidth: 0, children: input({ width: inputWidth, inputRows: budget.input, suggestionRows: budget.suggestions, onRowsChange }) }) }), _jsx(Panel, { rows: budget.status, children: sections.status })] });
42
+ // Percentage width resolves against the Yoga root at layout time, so the
43
+ // frame follows the live terminal width even in Ink v8's synchronous
44
+ // resize render of the stale React tree, where an explicit numeric width
45
+ // stays stale-wide and soft-wraps (see tests/cli/chat/resizeBoundary.test.tsx).
46
+ // maxWidth keeps the columns prop authoritative for standalone embeds.
47
+ return _jsxs(Box, { flexDirection: "column", width: "100%", maxWidth: Math.max(1, columns), flexShrink: 0, children: [_jsx(Panel, { rows: budget.live, children: typeof sections.live === 'function' ? sections.live(budget.live) : sections.live }), _jsx(Panel, { rows: budget.debug, children: sections.debug }), _jsx(Panel, { rows: budget.queue, children: sections.queue }), _jsx(Panel, { rows: budget.tasks, children: sections.tasks }), _jsx(Panel, { rows: budget.activity, children: sections.activity }), _jsx(Box, { flexDirection: "column", height: budget.input + budget.suggestions + budget.border, flexShrink: 0, overflow: "hidden", borderStyle: budget.border ? 'round' : undefined, borderColor: theme.border, paddingX: budget.border ? 1 : 0, children: _jsx(Box, { ref: inputRef, width: "100%", flexDirection: "column", minWidth: 0, children: input({ width: inputWidth, inputRows: budget.input, suggestionRows: budget.suggestions, onRowsChange }) }) }), _jsx(Panel, { rows: budget.status, children: sections.status })] });
43
48
  }
@@ -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' },
@@ -0,0 +1,20 @@
1
+ /** Minimal TTY stdout shape for the resize guard (tests pass a fake stream). */
2
+ export interface ResizeGuardStream {
3
+ isTTY?: boolean;
4
+ columns?: number;
5
+ rows?: number;
6
+ on(event: 'resize', listener: () => void): unknown;
7
+ off(event: 'resize', listener: () => void): unknown;
8
+ write(chunk: string): unknown;
9
+ }
10
+ /**
11
+ * Clear the viewport on width changes before Ink's resize repaint. Pair this
12
+ * with a width-keyed <Static> in ChatScreen: clearing alone loses the visible
13
+ * transcript, whereas remounting Static re-renders the history and Markdown
14
+ * at the new width. The dynamic input stays mounted to preserve its draft.
15
+ *
16
+ * Register before render() so this listener precedes Ink's resize handler.
17
+ * This does not erase terminal scrollback; replay can leave earlier copies
18
+ * of the transcript there.
19
+ */
20
+ export declare function installViewportResizeGuard(stream?: ResizeGuardStream): () => void;
@@ -0,0 +1,25 @@
1
+ const HOME_AND_ERASE_DOWN = '\u001B[H\u001B[J';
2
+ /**
3
+ * Clear the viewport on width changes before Ink's resize repaint. Pair this
4
+ * with a width-keyed <Static> in ChatScreen: clearing alone loses the visible
5
+ * transcript, whereas remounting Static re-renders the history and Markdown
6
+ * at the new width. The dynamic input stays mounted to preserve its draft.
7
+ *
8
+ * Register before render() so this listener precedes Ink's resize handler.
9
+ * This does not erase terminal scrollback; replay can leave earlier copies
10
+ * of the transcript there.
11
+ */
12
+ export function installViewportResizeGuard(stream = process.stdout) {
13
+ if (!stream.isTTY)
14
+ return () => undefined;
15
+ let previousColumns = stream.columns;
16
+ const onResize = () => {
17
+ const { columns } = stream;
18
+ if (typeof columns === 'number' && columns !== previousColumns) {
19
+ stream.write(HOME_AND_ERASE_DOWN);
20
+ }
21
+ previousColumns = columns;
22
+ };
23
+ stream.on('resize', onResize);
24
+ return () => { stream.off('resize', onResize); };
25
+ }
@@ -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
  }