hummin-cli 1.0.4 → 1.0.5
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
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.5] - 2026-09-18
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- The footer's two status rows now have a blank spacer row between them instead of sitting flush against each other.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- The npm package README is now the hummin project README instead of upstream pi's; `npm install -g hummin-cli` is the documented install path.
|
|
12
|
+
|
|
3
13
|
## [1.0.4] - 2026-09-18
|
|
4
14
|
|
|
5
15
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,718 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="https://pi.dev">
|
|
3
|
-
<img alt="pi logo" src="https://pi.dev/logo-auto.svg" width="128">
|
|
4
|
-
</a>
|
|
5
|
-
</p>
|
|
6
|
-
<p align="center">
|
|
7
|
-
<a href="https://discord.com/invite/3cU7Bz4UPx"><img alt="Discord" src="https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white" /></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/@earendil-works/pi-coding-agent"><img alt="npm" src="https://img.shields.io/npm/v/@earendil-works/pi-coding-agent?style=flat-square" /></a>
|
|
9
|
-
</p>
|
|
1
|
+
# hummin
|
|
10
2
|
|
|
11
|
-
|
|
3
|
+
A GLM-native terminal coding agent: the [pi agent harness](https://github.com/earendil-works/pi) (MIT, by Mario Zechner / earendil-works) retuned for Z.ai's GLM models and [colibri](https://github.com/JustVugg/colibri) local inference.
|
|
12
4
|
|
|
13
|
-
|
|
5
|
+
Why a fork: GLM is a first-class citizen here, not a compatibility mode. The provider picker surfaces Z.ai and your local colibri instances first, the default model is GLM, and the whole tool assumes you may be talking to a slow, disk-streaming local model instead of a datacenter.
|
|
14
6
|
|
|
15
|
-
|
|
7
|
+
> Based on [pi](https://github.com/earendil-works/pi). All credit for the agent core goes upstream; this fork only curates, extends, and rebrands. License: MIT (see [LICENSE](LICENSE)).
|
|
16
8
|
|
|
17
|
-
|
|
9
|
+
## Status
|
|
18
10
|
|
|
19
|
-
|
|
11
|
+
Early and moving fast. The working spec lives in Renn's local clone (not part of the public repo):
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
- M0 rebrand + build: done
|
|
14
|
+
- M1 Z.ai catalog: done upstream (GLM-5.3 / GLM-5.3-Flash ship in the zai provider); live acceptance pending
|
|
15
|
+
- M2 colibri extension: scaffolded and mock-tested; queue-aware UX and zero-config autoload next
|
|
16
|
+
- M3 docs/branding/release: in progress
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Public OSS session data helps improve models, prompts, tools, and evaluations using real development workflows.
|
|
26
|
-
|
|
27
|
-
For the full explanation, see [this post on X](https://x.com/badlogicgames/status/2037811643774652911).
|
|
28
|
-
|
|
29
|
-
To publish sessions, use [`badlogic/pi-share-hf`](https://github.com/badlogic/pi-share-hf). Read its README.md for setup instructions. All you need is a Hugging Face account, the Hugging Face CLI, and `pi-share-hf`.
|
|
30
|
-
|
|
31
|
-
You can also watch [this video](https://x.com/badlogicgames/status/2041151967695634619), where I show how I publish my `pi-mono` sessions.
|
|
32
|
-
|
|
33
|
-
I regularly publish my own `pi-mono` work sessions here:
|
|
34
|
-
|
|
35
|
-
- [badlogicgames/pi-mono on Hugging Face](https://huggingface.co/datasets/badlogicgames/pi-mono)
|
|
36
|
-
|
|
37
|
-
## Table of Contents
|
|
38
|
-
|
|
39
|
-
- [Quick Start](#quick-start)
|
|
40
|
-
- [Providers & Models](#providers--models)
|
|
41
|
-
- [Interactive Mode](#interactive-mode)
|
|
42
|
-
- [Editor](#editor)
|
|
43
|
-
- [Commands](#commands)
|
|
44
|
-
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
45
|
-
- [Message Queue](#message-queue)
|
|
46
|
-
- [Sessions](#sessions)
|
|
47
|
-
- [Branching](#branching)
|
|
48
|
-
- [Compaction](#compaction)
|
|
49
|
-
- [Settings](#settings)
|
|
50
|
-
- [Context Files](#context-files)
|
|
51
|
-
- [Customization](#customization)
|
|
52
|
-
- [Prompt Templates](#prompt-templates)
|
|
53
|
-
- [Skills](#skills)
|
|
54
|
-
- [Extensions](#extensions)
|
|
55
|
-
- [Themes](#themes)
|
|
56
|
-
- [Pi Packages](#pi-packages)
|
|
57
|
-
- [Programmatic Usage](#programmatic-usage)
|
|
58
|
-
- [Philosophy](#philosophy)
|
|
59
|
-
- [CLI Reference](#cli-reference)
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Quick Start
|
|
18
|
+
## Install
|
|
64
19
|
|
|
65
20
|
```bash
|
|
66
|
-
npm install -g
|
|
21
|
+
npm install -g hummin-cli
|
|
67
22
|
```
|
|
68
23
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Installer alternative:
|
|
24
|
+
Or from a clone:
|
|
72
25
|
|
|
73
26
|
```bash
|
|
74
|
-
|
|
27
|
+
npm install
|
|
28
|
+
npm run build
|
|
29
|
+
cd packages/coding-agent && npm link # puts `hummin` on your PATH
|
|
75
30
|
```
|
|
76
31
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
export ANTHROPIC_API_KEY=sk-ant-...
|
|
81
|
-
pi
|
|
82
|
-
```
|
|
32
|
+
Requires Node >= 22.19.
|
|
83
33
|
|
|
84
|
-
|
|
34
|
+
## Quickstart (Z.ai cloud)
|
|
85
35
|
|
|
86
36
|
```bash
|
|
87
|
-
|
|
88
|
-
|
|
37
|
+
export ZAI_API_KEY=your-key # or run `hummin auth login zai`
|
|
38
|
+
hummin # interactive TUI; GLM-5.3 is the default suggestion
|
|
39
|
+
hummin -p "summarize this repo" # oneshot mode
|
|
89
40
|
```
|
|
90
41
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
**Platform notes:** [Windows](docs/windows.md) | [Termux (Android)](docs/termux.md) | [tmux](docs/tmux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Providers & Models
|
|
98
|
-
|
|
99
|
-
For each built-in provider, pi maintains a list of tool-capable models. Configured provider catalogs refresh automatically; run `pi update --models` to force an immediate refresh. Authenticate via subscription (`/login`) or API key, then select any model from that provider via `/model` (or Ctrl+L). Press Ctrl+S in the model picker to save the highlighted model as the startup default.
|
|
100
|
-
|
|
101
|
-
**Subscriptions:**
|
|
102
|
-
- Anthropic Claude Pro/Max
|
|
103
|
-
- OpenAI ChatGPT Plus/Pro (Codex)
|
|
104
|
-
- GitHub Copilot
|
|
105
|
-
|
|
106
|
-
**API keys:**
|
|
107
|
-
- Anthropic
|
|
108
|
-
- Ant Ling
|
|
109
|
-
- OpenAI
|
|
110
|
-
- Azure OpenAI
|
|
111
|
-
- DeepSeek
|
|
112
|
-
- NVIDIA NIM
|
|
113
|
-
- Google Gemini
|
|
114
|
-
- Google Vertex
|
|
115
|
-
- Amazon Bedrock
|
|
116
|
-
- Mistral
|
|
117
|
-
- Groq
|
|
118
|
-
- Cerebras
|
|
119
|
-
- Cloudflare AI Gateway
|
|
120
|
-
- Cloudflare Workers AI
|
|
121
|
-
- xAI
|
|
122
|
-
- OpenRouter
|
|
123
|
-
- Vercel AI Gateway
|
|
124
|
-
- ZAI Coding Plan (Global)
|
|
125
|
-
- ZAI Coding Plan (China)
|
|
126
|
-
- OpenCode Zen
|
|
127
|
-
- OpenCode Go
|
|
128
|
-
- Hugging Face
|
|
129
|
-
- Fireworks
|
|
130
|
-
- Together AI
|
|
131
|
-
- Baseten
|
|
132
|
-
- Kimi For Coding
|
|
133
|
-
- MiniMax
|
|
134
|
-
- Xiaomi MiMo
|
|
135
|
-
- Xiaomi MiMo Token Plan (China)
|
|
136
|
-
- Xiaomi MiMo Token Plan (Amsterdam)
|
|
137
|
-
- Xiaomi MiMo Token Plan (Singapore)
|
|
138
|
-
|
|
139
|
-
Pi also supports the llama.cpp router server. Configure it with `/login llama.cpp`, manage downloads and loaded models with `/llama`, then select a loaded model with `/model`. See [docs/llama-cpp.md](docs/llama-cpp.md) for setup and usage.
|
|
140
|
-
|
|
141
|
-
See [docs/providers.md](docs/providers.md) for other provider setup instructions.
|
|
142
|
-
|
|
143
|
-
**Custom providers & models:** Add providers via `~/.pi/agent/models.json` if they speak a supported API (OpenAI, Anthropic, Google). For custom APIs or OAuth, use extensions. See [docs/models.md](docs/models.md) and [docs/custom-provider.md](docs/custom-provider.md).
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Interactive Mode
|
|
148
|
-
|
|
149
|
-
<p align="center"><img src="docs/images/interactive-mode.png" alt="Interactive Mode" width="600"></p>
|
|
150
|
-
|
|
151
|
-
The interface from top to bottom:
|
|
152
|
-
|
|
153
|
-
- **Startup header** - Shows shortcuts (`/hotkeys` for all), loaded AGENTS.md files, prompt templates, skills, and extensions
|
|
154
|
-
- **Messages** - Your messages, assistant responses, tool calls and results, notifications, errors, and extension UI
|
|
155
|
-
- **Editor** - Where you type; border color indicates thinking level and the border shows the streaming working indicator
|
|
156
|
-
- **Footer** - Working directory, session name, total token/cache usage (`↑` input, `↓` output, `R` cache read, `W` cache write, `CH` latest cache hit rate), cost, context usage, current model. Totals include assistant responses, usage reported by tools, and summary generation.
|
|
157
|
-
|
|
158
|
-
The editor can be temporarily replaced by other UI, like built-in `/settings` or custom UI from extensions (e.g., a Q&A tool that lets the user answer model questions in a structured format). [Extensions](#extensions) can also replace the editor, add widgets above/below it, a status line, custom footer, or overlays.
|
|
159
|
-
|
|
160
|
-
### Editor
|
|
161
|
-
|
|
162
|
-
| Feature | How |
|
|
163
|
-
|---------|-----|
|
|
164
|
-
| File reference | Type `@` to fuzzy-search project files |
|
|
165
|
-
| Path completion | Tab to complete paths |
|
|
166
|
-
| Multi-line | Shift+Enter (or Ctrl+Enter on Windows Terminal) |
|
|
167
|
-
| External editor | Ctrl+G opens `externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere |
|
|
168
|
-
| Clipboard | Ctrl+V to paste an image or text (Alt+V on Windows), or drag images onto terminal |
|
|
169
|
-
| Bash commands | `!command` runs and sends output to LLM, `!!command` runs without sending |
|
|
170
|
-
|
|
171
|
-
Standard editing keybindings for delete word, undo, etc. See [docs/keybindings.md](docs/keybindings.md).
|
|
172
|
-
|
|
173
|
-
### Commands
|
|
174
|
-
|
|
175
|
-
Type `/` in the editor to trigger commands. [Extensions](#extensions) can register custom commands, [skills](#skills) are available as `/skill:name`, and [prompt templates](#prompt-templates) expand via `/templatename`.
|
|
176
|
-
|
|
177
|
-
| Command | Description |
|
|
178
|
-
|---------|-------------|
|
|
179
|
-
| `/login`, `/logout` | Manage provider credentials |
|
|
180
|
-
| [`/llama`](docs/llama-cpp.md) | Download, load, and unload llama.cpp router models |
|
|
181
|
-
| `/model` | Switch models; Ctrl+S in the picker saves the startup default |
|
|
182
|
-
| `/thinking` | Switch thinking level; Ctrl+S in the picker saves the startup default |
|
|
183
|
-
| `/scoped-models` | Enable/disable models for Ctrl+P cycling |
|
|
184
|
-
| `/settings` | Theme, message delivery, transport, and other preferences |
|
|
185
|
-
| `/resume` | Pick from previous sessions |
|
|
186
|
-
| `/new` | Start a new session |
|
|
187
|
-
| `/name <name>` | Set session display name |
|
|
188
|
-
| `/session` | Show session info (file, ID, messages, tokens, cost) |
|
|
189
|
-
| `/tree` | Jump to any point in the session and continue from there |
|
|
190
|
-
| `/trust` | Save project trust decision for future sessions (restart required) |
|
|
191
|
-
| `/fork` | Create a new session from a previous user message |
|
|
192
|
-
| `/clone` | Duplicate the current active branch into a new session |
|
|
193
|
-
| `/compact [prompt]` | Manually compact context, optional custom instructions |
|
|
194
|
-
| `/copy` | Copy last assistant message to clipboard |
|
|
195
|
-
| `/export [file]` | Export session to HTML or JSONL file |
|
|
196
|
-
| `/import <file>` | Import and resume a session from a JSONL file |
|
|
197
|
-
| `/share` | Upload as private GitHub gist with shareable HTML link |
|
|
198
|
-
| `/reload` | Reload keybindings, extensions, skills, prompts, themes, and context files |
|
|
199
|
-
| `/hotkeys` | Show all keyboard shortcuts |
|
|
200
|
-
| `/changelog` | Display version history |
|
|
201
|
-
| `/quit` | Quit pi |
|
|
202
|
-
|
|
203
|
-
### Keyboard Shortcuts
|
|
204
|
-
|
|
205
|
-
See `/hotkeys` for the full list. Customize via `~/.pi/agent/keybindings.json`. See [docs/keybindings.md](docs/keybindings.md).
|
|
206
|
-
|
|
207
|
-
**Commonly used:**
|
|
208
|
-
|
|
209
|
-
| Key | Action |
|
|
210
|
-
|-----|--------|
|
|
211
|
-
| Ctrl+C | Clear editor |
|
|
212
|
-
| Ctrl+C twice | Quit |
|
|
213
|
-
| Escape | Cancel/abort |
|
|
214
|
-
| Escape twice | Open `/tree` |
|
|
215
|
-
| Ctrl+L | Open model selector |
|
|
216
|
-
| Ctrl+P / Shift+Ctrl+P | Cycle scoped models forward/backward |
|
|
217
|
-
| Shift+Tab | Cycle thinking level |
|
|
218
|
-
| Ctrl+O | Collapse/expand tool output |
|
|
219
|
-
| Ctrl+T | Collapse/expand thinking blocks |
|
|
220
|
-
| Ctrl+X | Copy the last assistant message; with fullscreen copy-on-select disabled, copy the active text selection |
|
|
221
|
-
|
|
222
|
-
### Message Queue
|
|
223
|
-
|
|
224
|
-
Submit messages while the agent is working:
|
|
225
|
-
|
|
226
|
-
- **Enter** queues a *steering* message, delivered after the current assistant turn finishes executing its tool calls
|
|
227
|
-
- **Alt+Enter** queues a *follow-up* message, delivered only after the agent finishes all work
|
|
228
|
-
- **Escape** aborts and restores queued messages to editor
|
|
229
|
-
- **Alt+Up** retrieves queued messages back to editor
|
|
230
|
-
|
|
231
|
-
On Windows Terminal, `Alt+Enter` is fullscreen by default. Remap it in [docs/terminal-setup.md](docs/terminal-setup.md) so pi can receive the follow-up shortcut.
|
|
42
|
+
GLM-5.3, GLM-5.3-Flash and GLM-5.3-highspeed ship in the `zai` provider catalog (1M-token context, reasoning variants mapped to `reasoning_effort`). Pick models with `/model`; set a persistent default with the picker's "set as default" action.
|
|
232
43
|
|
|
233
|
-
|
|
44
|
+
## Local inference (colibri, llama.cpp, ...)
|
|
234
45
|
|
|
235
|
-
|
|
46
|
+
The bundled `hummin-colibri` extension registers ONE provider (`colibri`) that exposes every model found on your local OpenAI-compatible servers. The engine behind each server does not matter - colibri (MoE streaming), llama.cpp, Ollama all work; the server's own `/v1/models` is the source of truth for model ids, and the first server in the list that serves a model wins (duplicates dedupe into one entry with fallback ordering).
|
|
236
47
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
Sessions are stored as JSONL files with a tree structure. Each entry has an `id` and `parentId`, enabling in-place branching without creating new files. See [docs/session-format.md](docs/session-format.md) for file format.
|
|
240
|
-
|
|
241
|
-
### Management
|
|
242
|
-
|
|
243
|
-
Sessions auto-save to `~/.pi/agent/sessions/` organized by working directory.
|
|
48
|
+
**Full walkthrough - engines, model choices, server setup on Linux/Mac, and a worked example: [COLIBRI-SETUP.md](COLIBRI-SETUP.md).**
|
|
244
49
|
|
|
245
50
|
```bash
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
pi --name "my task" # Set session display name at startup
|
|
250
|
-
pi --session <path|id> # Use specific session file or ID
|
|
251
|
-
pi --fork <path|id> # Fork specific session file or ID into a new session
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Use `/session` in interactive mode to see the current session ID before reusing it with `--session <id>` or `--fork <id>`.
|
|
255
|
-
|
|
256
|
-
### Branching
|
|
257
|
-
|
|
258
|
-
**`/tree`** - Navigate the session tree in-place. Select any previous point, continue from there, and switch between branches. All history preserved in a single file. Selecting a point while the model is responding cancels that response. Navigation cannot proceed while compaction or another tree navigation is still running; wait for it to finish and retry.
|
|
259
|
-
|
|
260
|
-
<p align="center"><img src="docs/images/tree-view.png" alt="Tree View" width="600"></p>
|
|
261
|
-
|
|
262
|
-
- Search by typing, fold/unfold and jump between branches with Ctrl+←/Ctrl+→ or Alt+←/Alt+→, page with ←/→
|
|
263
|
-
- Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
|
|
264
|
-
- Press Ctrl+X to copy the selected message
|
|
265
|
-
- Press Shift+L to label entries as bookmarks and Shift+T to toggle label timestamps
|
|
266
|
-
|
|
267
|
-
**`/fork`** - Create a new session file from a previous user message on the active branch. Opens a selector, copies the active path up to that point, and places the selected prompt in the editor for modification.
|
|
268
|
-
|
|
269
|
-
**`/clone`** - Duplicate the current active branch into a new session file at the current position. The new session keeps the full active-path history and opens with an empty editor.
|
|
270
|
-
|
|
271
|
-
**`--fork <path|id>`** - Fork an existing session file or partial session UUID directly from the CLI. This copies the full source session into a new session file in the current project.
|
|
272
|
-
|
|
273
|
-
### Compaction
|
|
274
|
-
|
|
275
|
-
Long sessions can exhaust context windows. Compaction summarizes older messages while keeping recent ones.
|
|
276
|
-
|
|
277
|
-
**Manual:** `/compact` or `/compact <custom instructions>`
|
|
278
|
-
|
|
279
|
-
**Automatic:** Enabled by default. Triggers on context overflow (recovers and retries) or when approaching the limit (proactive). Configure via `/settings` or `settings.json`.
|
|
280
|
-
|
|
281
|
-
Compaction is lossy. The full history remains in the JSONL file; use `/tree` to revisit. Customize compaction behavior via [extensions](#extensions). See [docs/compaction.md](docs/compaction.md) for internals.
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
## Settings
|
|
286
|
-
|
|
287
|
-
Use `/settings` to modify common options, or edit JSON files directly:
|
|
288
|
-
|
|
289
|
-
| Location | Scope |
|
|
290
|
-
|----------|-------|
|
|
291
|
-
| `~/.pi/agent/settings.json` | Global (all projects) |
|
|
292
|
-
| `.pi/settings.json` | Project (overrides global) |
|
|
293
|
-
|
|
294
|
-
See [docs/settings.md](docs/settings.md) for all options.
|
|
295
|
-
|
|
296
|
-
### Project Trust
|
|
297
|
-
|
|
298
|
-
On interactive startup, pi asks before trusting a project folder that contains project-local settings, resources, or project `.agents/skills` and has no saved decision for the folder or a parent folder in `~/.pi/agent/trust.json`. Trusting a project allows pi to load `.pi/settings.json` and `.pi` resources, install missing project packages, and execute project extensions.
|
|
299
|
-
|
|
300
|
-
Before the trust decision, pi loads only context files, user/global extensions, and CLI `-e` extensions so they can handle the `project_trust` event. Project-local extensions, project package-managed extensions, and project settings are loaded only after the project is trusted. This split also applies when switching to a session from a different cwd whose trust has not been resolved in the current process.
|
|
301
|
-
|
|
302
|
-
Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, they use `defaultProjectTrust` from global settings: `ask` (default) and `never` ignore those project resources, while `always` trusts them. Pass `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
|
|
303
|
-
|
|
304
|
-
If no extension or saved decision applies, `defaultProjectTrust` controls the fallback behavior. Set it to `"ask"`, `"always"`, or `"never"` in `~/.pi/agent/settings.json`, or change it with `/settings`.
|
|
305
|
-
|
|
306
|
-
`pi config` and package commands use the same project trust flow, except `pi update` never prompts. Pass `--approve` to trust project-local settings for one command or `--no-approve` to ignore them.
|
|
307
|
-
|
|
308
|
-
Use `/trust` in interactive mode to save a project trust decision for future sessions, including trust for the immediate parent folder. It writes `~/.pi/agent/trust.json` only; the current session is not reloaded, so restart pi for changes to take effect.
|
|
309
|
-
|
|
310
|
-
### Telemetry and update checks
|
|
311
|
-
|
|
312
|
-
Pi has two separate startup features:
|
|
313
|
-
|
|
314
|
-
- **Update check:** fetches `https://pi.dev/api/latest-version` to check whether a newer Pi version exists. Disable it with `PI_SKIP_VERSION_CHECK=1`. Disabling update checks only turns off this check.
|
|
315
|
-
- **Install/update telemetry:** after first install or a changelog-detected update, sends an anonymous version ping to `https://pi.dev/api/report-install`. This setting also controls optional provider attribution headers for OpenRouter, Cloudflare, and direct NVIDIA NIM requests. Opt out by setting `enableInstallTelemetry` to `false` in `settings.json`, or by setting `PI_TELEMETRY=0`. This does not disable update checks; Pi may still contact `pi.dev` for the latest version unless update checks are disabled or offline mode is enabled.
|
|
316
|
-
|
|
317
|
-
Use `--offline` or `PI_OFFLINE=1` to disable all startup network operations described here, including update checks, package update checks, and install/update telemetry.
|
|
318
|
-
|
|
319
|
-
---
|
|
320
|
-
|
|
321
|
-
## Context Files
|
|
322
|
-
|
|
323
|
-
Pi loads `AGENTS.md` (or `CLAUDE.md`) at startup from:
|
|
324
|
-
- `~/.pi/agent/AGENTS.md` (global)
|
|
325
|
-
- Parent directories (walking up from cwd)
|
|
326
|
-
- Current directory
|
|
327
|
-
|
|
328
|
-
If a directory contains `AGENTS.override.md`, Pi loads it instead of `AGENTS.md` or `CLAUDE.md` from that directory. Context files from other directories are still concatenated.
|
|
329
|
-
|
|
330
|
-
Use for project instructions (`AGENTS.md`/`CLAUDE.md`), conventions, common commands. All matching files are concatenated.
|
|
331
|
-
|
|
332
|
-
Disable context file loading with `--no-context-files` (or `-nc`).
|
|
333
|
-
|
|
334
|
-
### System Prompt
|
|
335
|
-
|
|
336
|
-
Replace the default system prompt with `.pi/SYSTEM.md` (project) or `~/.pi/agent/SYSTEM.md` (global). Append without replacing via `APPEND_SYSTEM.md`.
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
## Customization
|
|
341
|
-
|
|
342
|
-
### Prompt Templates
|
|
343
|
-
|
|
344
|
-
Reusable prompts as Markdown files. Type `/name` to expand.
|
|
345
|
-
|
|
346
|
-
```markdown
|
|
347
|
-
<!-- ~/.pi/agent/prompts/review.md -->
|
|
348
|
-
Review this code for bugs, security issues, and performance problems.
|
|
349
|
-
Focus on: {{focus}}
|
|
51
|
+
export HUMMIN_COLIBRI_INSTANCES="http://nas:9996,http://nas:9998,http://mac:9998" # order = preference
|
|
52
|
+
export COLI_API_KEY=... # only if the servers enforce a key
|
|
53
|
+
hummin # extensions autoload from ~/.hummin/agent/extensions/
|
|
350
54
|
```
|
|
351
55
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
### Skills
|
|
56
|
+
Behavior:
|
|
355
57
|
|
|
356
|
-
|
|
58
|
+
- One model namespace across all servers; unreachable servers contribute no models until a session restart (no guessed placeholder ids).
|
|
59
|
+
- One generation at a time per server is handled, not thrown at you: requests are serialized per server and the documented busy response (429 + `x-colibri-queue-wait-ms`) is retried with capped backoff.
|
|
60
|
+
- Context windows are read from each server's `/props` when available (llama.cpp), falling back to `HUMMIN_COLIBRI_CTX` (default 16384).
|
|
61
|
+
- Reasoning: qwen-family models map hummin's thinking level to `chat_template_kwargs.enable_thinking` - on by default, `/thinking off` disables. Other model families register without thinking controls.
|
|
357
62
|
|
|
358
|
-
|
|
359
|
-
<!-- ~/.pi/agent/skills/my-skill/SKILL.md -->
|
|
360
|
-
# My Skill
|
|
361
|
-
Use this skill when the user asks about X.
|
|
362
|
-
|
|
363
|
-
## Steps
|
|
364
|
-
1. Do this
|
|
365
|
-
2. Then that
|
|
366
|
-
```
|
|
63
|
+
### Developing without a server
|
|
367
64
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
### Extensions
|
|
371
|
-
|
|
372
|
-
<p align="center"><img src="docs/images/doom-extension.png" alt="Doom Extension" width="600"></p>
|
|
373
|
-
|
|
374
|
-
TypeScript modules that extend pi with custom tools, commands, keyboard shortcuts, event handlers, and UI components.
|
|
375
|
-
|
|
376
|
-
```typescript
|
|
377
|
-
export default function (pi: ExtensionAPI) {
|
|
378
|
-
pi.registerTool({ name: "deploy", ... });
|
|
379
|
-
pi.registerCommand("stats", { ... });
|
|
380
|
-
pi.on("tool_call", async (event, ctx) => { ... });
|
|
381
|
-
}
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
The default export can also be `async`. pi waits for async extension factories before startup continues, which is useful for one-time initialization such as fetching remote model lists before calling `pi.registerProvider()`.
|
|
385
|
-
|
|
386
|
-
**What's possible:**
|
|
387
|
-
- Custom tools (or replace built-in tools entirely)
|
|
388
|
-
- Sub-agents and plan mode
|
|
389
|
-
- Custom compaction and summarization
|
|
390
|
-
- Permission gates and path protection
|
|
391
|
-
- Custom editors and UI components
|
|
392
|
-
- Status lines, headers, footers
|
|
393
|
-
- Git checkpointing and auto-commit
|
|
394
|
-
- SSH and sandbox execution
|
|
395
|
-
- MCP server integration
|
|
396
|
-
- Make pi look like Claude Code
|
|
397
|
-
- Games while waiting (yes, Doom runs)
|
|
398
|
-
- ...anything you can dream up
|
|
399
|
-
|
|
400
|
-
Place in `~/.pi/agent/extensions/`, `.pi/extensions/`, or a [pi package](#pi-packages) to share with others. See [docs/extensions.md](docs/extensions.md) and [examples/extensions/](examples/extensions/).
|
|
401
|
-
|
|
402
|
-
### Themes
|
|
403
|
-
|
|
404
|
-
Built-in: `dark`, `light`. Themes hot-reload: modify the active theme file and pi immediately applies changes.
|
|
405
|
-
|
|
406
|
-
Place in `~/.pi/agent/themes/`, `.pi/themes/`, or a [pi package](#pi-packages) to share with others. See [docs/themes.md](docs/themes.md).
|
|
407
|
-
|
|
408
|
-
### Pi Packages
|
|
409
|
-
|
|
410
|
-
Bundle and share extensions, skills, prompts, and themes via npm or git. Find packages on [npmjs.com](https://www.npmjs.com/search?q=keywords%3Api-package) or [Discord](https://discord.com/channels/1456806362351669492/1457744485428629628).
|
|
411
|
-
|
|
412
|
-
> **Security:** Pi packages run with full system access. Extensions execute arbitrary code, and skills can instruct the model to perform any action including running executables. Review source code before installing third-party packages.
|
|
65
|
+
A mock server speaks the same surface (streaming, `/health`, `/v1/models`, 429 queueing):
|
|
413
66
|
|
|
414
67
|
```bash
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
pi install git:github.com/user/repo
|
|
418
|
-
pi install git:github.com/user/repo@v1 # tag or commit
|
|
419
|
-
pi install git:git@github.com:user/repo
|
|
420
|
-
pi install git:git@github.com:user/repo@v1 # tag or commit
|
|
421
|
-
pi install https://github.com/user/repo
|
|
422
|
-
pi install https://github.com/user/repo@v1 # tag or commit
|
|
423
|
-
pi install ssh://git@github.com/user/repo
|
|
424
|
-
pi install ssh://git@github.com/user/repo@v1 # tag or commit
|
|
425
|
-
pi remove npm:@foo/pi-tools
|
|
426
|
-
pi uninstall npm:@foo/pi-tools # alias for remove
|
|
427
|
-
pi list
|
|
428
|
-
pi update # update pi only
|
|
429
|
-
pi update --all # update pi and packages
|
|
430
|
-
pi update --extensions # update packages only
|
|
431
|
-
pi update --models # refresh model catalogs only
|
|
432
|
-
pi update --self # update pi only
|
|
433
|
-
pi update --self --force # reinstall pi even if current
|
|
434
|
-
pi update npm:@foo/pi-tools # update one package
|
|
435
|
-
pi config # enable/disable extensions, skills, prompts, themes
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
Packages install to `~/.pi/agent/git/` (git) or `~/.pi/agent/npm/` (npm). Use `-l` for project-local installs (`.pi/git/`, `.pi/npm/`). Git `@ref` values are pinned tags or commits; pinned packages are skipped by `pi update --extensions` and `pi update --all`, so use `pi install git:host/user/repo@new-ref` to move an existing package to a new ref. Git packages install dependencies with `npm install --omit=dev` by default, so runtime deps must be listed under `dependencies`; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers. If you use a Node version manager and want package installs to reuse a stable npm context, set `npmCommand` in `settings.json`, for example `["mise", "exec", "node@20", "--", "npm"]`.
|
|
439
|
-
|
|
440
|
-
Create a package by adding a `pi` key to `package.json`:
|
|
441
|
-
|
|
442
|
-
```json
|
|
443
|
-
{
|
|
444
|
-
"name": "my-pi-package",
|
|
445
|
-
"keywords": ["pi-package"],
|
|
446
|
-
"pi": {
|
|
447
|
-
"extensions": ["./extensions"],
|
|
448
|
-
"skills": ["./skills"],
|
|
449
|
-
"prompts": ["./prompts"],
|
|
450
|
-
"themes": ["./themes"]
|
|
451
|
-
}
|
|
452
|
-
}
|
|
68
|
+
node scripts/mock-colibri.mjs --port 9998 --model glm-5.3-flash
|
|
69
|
+
HUMMIN_COLIBRI_INSTANCES="http://127.0.0.1:9998" hummin -p "hello"
|
|
453
70
|
```
|
|
454
71
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
See [docs/packages.md](docs/packages.md).
|
|
72
|
+
## GLM-first curation
|
|
458
73
|
|
|
459
|
-
|
|
74
|
+
- `/model` picker: current model, saved default, then zai/colibri providers, then the rest alphabetically.
|
|
75
|
+
- `/login`: curated providers first. Other built-ins are hidden unless already configured; set `"providers": { "showAll": true }` in settings to always see everything.
|
|
76
|
+
- Default theme: `hummin-dark` (override with `"theme"` in settings or the first-run dialog).
|
|
460
77
|
|
|
461
|
-
## Programmatic Usage
|
|
462
78
|
|
|
463
|
-
|
|
79
|
+
## Persistent memory (experimental)
|
|
464
80
|
|
|
465
|
-
|
|
466
|
-
import { createAgentSession, ModelRuntime, SessionManager } from "@earendil-works/pi-coding-agent";
|
|
467
|
-
|
|
468
|
-
const modelRuntime = await ModelRuntime.create();
|
|
469
|
-
const { session } = await createAgentSession({
|
|
470
|
-
sessionManager: SessionManager.inMemory(),
|
|
471
|
-
modelRuntime,
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
await session.prompt("What files are in the current directory?");
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
For advanced multi-session runtime replacement, use `createAgentSessionRuntime()` and `AgentSessionRuntime`.
|
|
478
|
-
|
|
479
|
-
See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/).
|
|
480
|
-
|
|
481
|
-
### RPC Mode
|
|
482
|
-
|
|
483
|
-
For non-Node.js integrations, use RPC mode over stdin/stdout:
|
|
81
|
+
Session distillation and a self-curating knowledge vault, off by default:
|
|
484
82
|
|
|
485
83
|
```bash
|
|
486
|
-
|
|
84
|
+
export HUMMIN_MEMORY=1 # enable
|
|
85
|
+
export HUMMIN_MEMORY_MODE=vault # lesson (default) or vault
|
|
86
|
+
export HUMMIN_MEMORY_VAULT_DIR=~/hummin-vault
|
|
487
87
|
```
|
|
488
88
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
---
|
|
494
|
-
|
|
495
|
-
## Philosophy
|
|
496
|
-
|
|
497
|
-
Pi is aggressively extensible so it doesn't have to dictate your workflow. Features that other tools bake in can be built with [extensions](#extensions), [skills](#skills), or installed from third-party [pi packages](#pi-packages). This keeps the core minimal while letting you shape pi to fit how you work.
|
|
498
|
-
|
|
499
|
-
**No MCP.** Build CLI tools with READMEs (see [Skills](#skills)), or build an extension that adds MCP support. [Why?](https://mariozechner.at/posts/2025-11-02-what-if-you-dont-need-mcp/)
|
|
500
|
-
|
|
501
|
-
**No sub-agents.** There's many ways to do this. Spawn pi instances via tmux, or build your own with [extensions](#extensions), or install a package that does it your way.
|
|
502
|
-
|
|
503
|
-
**No permission popups.** Run in a container, or build your own confirmation flow with [extensions](#extensions) inline with your environment and security requirements.
|
|
504
|
-
|
|
505
|
-
**No plan mode.** Write plans to files, or build it with [extensions](#extensions), or install a package.
|
|
506
|
-
|
|
507
|
-
**No built-in to-dos.** They confuse models. Use a TODO.md file, or build your own with [extensions](#extensions).
|
|
89
|
+
- **lesson mode**: after each session, one distillation call summarizes it into a Problem/Approach/Gotcha note (or nothing, if there is no lesson) under `~/.hummin/agent/memory/`.
|
|
90
|
+
- **vault mode**: lessons queue in a git-backed, Obsidian-compatible vault; `/vault-fold` runs an agent pass that folds them into an entity graph (`entities/<type>/<slug>.md`, wikilinks, dated facts) following the vault's own AGENTS.md conventions contract; `/vault-recall <query>` searches it.
|
|
91
|
+
- Distillation provider defaults to cloud (`zai`); override with `HUMMIN_MEMORY_PROVIDER` / `HUMMIN_MEMORY_MODEL_ID`.
|
|
508
92
|
|
|
509
|
-
|
|
93
|
+
## Bench
|
|
510
94
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
---
|
|
514
|
-
|
|
515
|
-
## CLI Reference
|
|
516
|
-
|
|
517
|
-
```bash
|
|
518
|
-
pi [options] [--] [@files...] [messages...]
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
### Package Commands
|
|
522
|
-
|
|
523
|
-
```bash
|
|
524
|
-
pi install <source> [-l] # Install package, -l for project-local
|
|
525
|
-
pi remove <source> [-l] # Remove package
|
|
526
|
-
pi uninstall <source> [-l] # Alias for remove
|
|
527
|
-
pi update [source|self|pi] # Update pi only, or one package source
|
|
528
|
-
pi update --all # Update pi and packages
|
|
529
|
-
pi update --extensions # Update packages only
|
|
530
|
-
pi update --models # Refresh model catalogs only
|
|
531
|
-
pi update --self # Update pi only
|
|
532
|
-
pi update --self --force # Reinstall pi even if current
|
|
533
|
-
pi update --extension <src> # Update one package
|
|
534
|
-
pi list # List installed packages
|
|
535
|
-
pi config # Enable/disable package resources
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
`pi config` and project package commands accept `--approve`/`--no-approve` to trust or ignore project-local settings for one command. `pi update` never prompts for project trust.
|
|
539
|
-
|
|
540
|
-
### Modes
|
|
541
|
-
|
|
542
|
-
| Flag | Description |
|
|
543
|
-
|------|-------------|
|
|
544
|
-
| (default) | Interactive mode |
|
|
545
|
-
| `-p`, `--print` | Print response and exit |
|
|
546
|
-
| `--mode json` | Output all events as JSON lines (see [docs/json.md](docs/json.md)) |
|
|
547
|
-
| `--mode rpc` | RPC mode for process integration (see [docs/rpc.md](docs/rpc.md)) |
|
|
548
|
-
| `--export <in> [out]` | Export session to HTML |
|
|
549
|
-
|
|
550
|
-
In print mode, pi also reads piped stdin and merges it into the initial prompt:
|
|
95
|
+
Golden-task harness for measuring agent/provider changes:
|
|
551
96
|
|
|
552
97
|
```bash
|
|
553
|
-
|
|
98
|
+
node bench/run.mjs --provider zai --model glm-5.3-flash # cloud baseline (fast)
|
|
99
|
+
node bench/run.mjs --provider colibri --model qwen3.8-27b --thinking off # local llama.cpp
|
|
554
100
|
```
|
|
555
101
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
| Option | Description |
|
|
559
|
-
|--------|-------------|
|
|
560
|
-
| `--provider <name>` | Provider (anthropic, openai, google, etc.) |
|
|
561
|
-
| `--model <pattern>` | Model pattern or ID (supports `provider/id` and optional `:<thinking>`) |
|
|
562
|
-
| `--api-key <key>` | API key (overrides env vars) |
|
|
563
|
-
| `--thinking <level>` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max` |
|
|
564
|
-
| `--models <patterns>` | Comma-separated patterns for Ctrl+P cycling |
|
|
565
|
-
| `--list-models [search]` | List available models |
|
|
566
|
-
|
|
567
|
-
### Session Options
|
|
568
|
-
|
|
569
|
-
| Option | Description |
|
|
570
|
-
|--------|-------------|
|
|
571
|
-
| `-c`, `--continue` | Continue most recent session |
|
|
572
|
-
| `-r`, `--resume` | Browse and select session |
|
|
573
|
-
| `--session <path\|id>` | Use specific session file or partial UUID |
|
|
574
|
-
| `--fork <path\|id>` | Fork specific session file or partial UUID into a new session |
|
|
575
|
-
| `--session-dir <dir>` | Custom session storage directory |
|
|
576
|
-
| `--no-session` | Ephemeral mode (don't save) |
|
|
577
|
-
| `--name <name>`, `-n <name>` | Set session display name at startup |
|
|
578
|
-
|
|
579
|
-
### Tool Options
|
|
580
|
-
|
|
581
|
-
| Option | Description |
|
|
582
|
-
|--------|-------------|
|
|
583
|
-
| `--tools <list>`, `-t <list>` | Allowlist specific tool names across built-in, extension, and custom tools |
|
|
584
|
-
| `--exclude-tools <list>`, `-xt <list>` | Disable specific tool names across built-in, extension, and custom tools |
|
|
585
|
-
| `--no-builtin-tools`, `-nbt` | Disable built-in tools by default but keep extension/custom tools enabled |
|
|
586
|
-
| `--no-tools`, `-nt` | Disable all tools by default |
|
|
587
|
-
|
|
588
|
-
Available built-in tools: `read`, `bash`, `powershell` (Windows), `edit`, `write`, `grep`, `find`, `ls`
|
|
589
|
-
|
|
590
|
-
### Resource Options
|
|
591
|
-
|
|
592
|
-
| Option | Description |
|
|
593
|
-
|--------|-------------|
|
|
594
|
-
| `-e`, `--extension <source>` | Load extension from path, npm, or git (repeatable) |
|
|
595
|
-
| `--no-extensions` | Disable extension discovery |
|
|
596
|
-
| `--skill <path>` | Load skill (repeatable) |
|
|
597
|
-
| `--no-skills` | Disable skill discovery |
|
|
598
|
-
| `--prompt-template <path>` | Load prompt template (repeatable) |
|
|
599
|
-
| `--no-prompt-templates` | Disable prompt template discovery |
|
|
600
|
-
| `--theme <path>` | Load theme (repeatable) |
|
|
601
|
-
| `--no-themes` | Disable theme discovery |
|
|
602
|
-
| `--no-context-files`, `-nc` | Disable AGENTS.md and CLAUDE.md context file discovery |
|
|
603
|
-
|
|
604
|
-
Combine `--no-*` with explicit flags to load exactly what you need, ignoring settings.json (e.g., `--no-extensions -e ./my-ext.ts`).
|
|
605
|
-
|
|
606
|
-
### Other Options
|
|
607
|
-
|
|
608
|
-
| Option | Description |
|
|
609
|
-
|--------|-------------|
|
|
610
|
-
| `--system-prompt <text>` | Replace default prompt (context files and skills still appended) |
|
|
611
|
-
| `--append-system-prompt <text>` | Append to system prompt |
|
|
612
|
-
| `--tui-mode <mode>` | TUI mode: `regular` (default) or experimental `fullscreen` |
|
|
613
|
-
| `--use-theme <name[/name]>` | Set the initial interactive theme for this run without changing settings |
|
|
614
|
-
| `--verbose` | Force verbose startup |
|
|
615
|
-
| `-a`, `--approve` | Trust project-local files for this run |
|
|
616
|
-
| `-na`, `--no-approve` | Ignore project-local files for this run |
|
|
617
|
-
| `--` | Stop option parsing; remaining arguments are prompts or `@file` inputs |
|
|
618
|
-
| `-h`, `--help` | Show help |
|
|
619
|
-
| `-v`, `--version` | Show version |
|
|
620
|
-
|
|
621
|
-
### File Arguments
|
|
622
|
-
|
|
623
|
-
Prefix files with `@` to include in the message:
|
|
102
|
+
Three fixtures (implement, fix, QA-catch) with deterministic checks; results land in `bench/results/` stamped with a config hash for A/B attribution.
|
|
624
103
|
|
|
625
|
-
|
|
626
|
-
pi @prompt.md "Answer this"
|
|
627
|
-
pi -p @screenshot.png "What's in this image?"
|
|
628
|
-
pi @code.ts @test.ts "Review these files"
|
|
629
|
-
```
|
|
104
|
+
## Recommended personal setup
|
|
630
105
|
|
|
631
|
-
|
|
106
|
+
Run the interactive setup once - it writes real settings (globally, or per-project with `--project`), so no shell exports are needed:
|
|
632
107
|
|
|
633
108
|
```bash
|
|
634
|
-
#
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
# Non-interactive
|
|
638
|
-
pi -p "Summarize this codebase"
|
|
639
|
-
|
|
640
|
-
# Prompt beginning with a dash
|
|
641
|
-
pi -p -- "- Summarize these points"
|
|
642
|
-
|
|
643
|
-
# Non-interactive with piped stdin
|
|
644
|
-
cat README.md | pi -p "Summarize this text"
|
|
645
|
-
|
|
646
|
-
# Named one-shot session
|
|
647
|
-
pi --name "release audit" -p "Audit this repository"
|
|
648
|
-
|
|
649
|
-
# Different model
|
|
650
|
-
pi --provider openai --model gpt-4o "Help me refactor"
|
|
651
|
-
|
|
652
|
-
# Model with provider prefix (no --provider needed)
|
|
653
|
-
pi --model openai/gpt-4o "Help me refactor"
|
|
654
|
-
|
|
655
|
-
# Model with thinking level shorthand
|
|
656
|
-
pi --model sonnet:high "Solve this complex problem"
|
|
657
|
-
|
|
658
|
-
# Limit model cycling
|
|
659
|
-
pi --models "claude-*,gpt-4o"
|
|
660
|
-
|
|
661
|
-
# Read-only mode
|
|
662
|
-
pi --tools read,grep,find,ls -p "Review the code"
|
|
663
|
-
|
|
664
|
-
# Disable one extension or built-in tool while keeping the rest available
|
|
665
|
-
pi --exclude-tools ask_question
|
|
666
|
-
|
|
667
|
-
# High thinking level
|
|
668
|
-
pi --thinking high "Solve this complex problem"
|
|
109
|
+
hummin init # local servers, project memory, vault directory
|
|
110
|
+
hummin init --yes --memory vault --vault-dir ~/hummin-vault \
|
|
111
|
+
--instances "http://nas:9996,http://nas:9998,http://mac:9998" # scriptable
|
|
669
112
|
```
|
|
670
113
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
| Variable | Description |
|
|
674
|
-
|----------|-------------|
|
|
675
|
-
| `AI_AGENT` | Set to `pi` by the CLI and RPC entry points so generic tooling can attribute child processes to Pi |
|
|
676
|
-
| `PI_CODING_AGENT` | Set to `true` by the CLI and RPC entry points so child processes can detect that they run inside Pi |
|
|
677
|
-
| `PI_CODING_AGENT_DIR` | Override config directory (default: `~/.pi/agent`) |
|
|
678
|
-
| `PI_CODING_AGENT_SESSION_DIR` | Override session storage directory (overridden by `--session-dir`) |
|
|
679
|
-
| `PI_PACKAGE_DIR` | Override package directory (useful for Nix/Guix where store paths tokenize poorly) |
|
|
680
|
-
| `PI_OFFLINE` | Disable startup network operations, including update checks, package update checks, and install/update telemetry |
|
|
681
|
-
| `PI_SKIP_VERSION_CHECK` | Skip the Pi version update check at startup. This prevents the `pi.dev` latest-version request |
|
|
682
|
-
| `PI_TELEMETRY` | Override install/update telemetry and provider attribution headers. Use `1`/`true`/`yes` to enable or `0`/`false`/`no` to disable. This does not disable update checks |
|
|
683
|
-
| `PI_CACHE_RETENTION` | Set to `long` for extended prompt cache (Anthropic: 1h, OpenAI: 24h) |
|
|
684
|
-
| `VISUAL`, `EDITOR` | Fallback external editor for Ctrl+G when `externalEditor` is unset; defaults to Notepad on Windows and `nano` elsewhere |
|
|
685
|
-
|
|
686
|
-
Commands run by the LLM-callable `bash` and `powershell` tools also receive current session metadata:
|
|
687
|
-
|
|
688
|
-
| Variable | Description |
|
|
689
|
-
|----------|-------------|
|
|
690
|
-
| `PI_SESSION_ID` | Current session ID |
|
|
691
|
-
| `PI_SESSION_FILE` | Absolute session JSONL path; unset for ephemeral sessions |
|
|
692
|
-
| `PI_PROVIDER` | Currently selected model provider |
|
|
693
|
-
| `PI_MODEL` | Currently selected model ID |
|
|
694
|
-
| `PI_REASONING_LEVEL` | Current effective reasoning level |
|
|
695
|
-
|
|
696
|
-
These values are resolved when each command starts. See [Environment Variables](docs/environment-variables.md#shell-tool-session-environment) for semantics, examples, and custom-tool opt-out.
|
|
697
|
-
|
|
698
|
-
---
|
|
699
|
-
|
|
700
|
-
## Contributing & Development
|
|
114
|
+
Env vars (`HUMMIN_COLIBRI_INSTANCES`, `HUMMIN_MEMORY`, `HUMMIN_MEMORY_MODE`, `HUMMIN_MEMORY_VAULT_DIR`) still override stored settings when set.
|
|
701
115
|
|
|
702
|
-
|
|
116
|
+
Then copy [SYSTEM.example.md](SYSTEM.example.md) to `~/.hummin/agent/SYSTEM.md` for the tuned operating rules, and `/model` to pick a default.
|
|
703
117
|
|
|
704
|
-
##
|
|
118
|
+
## Differences from upstream pi
|
|
705
119
|
|
|
706
|
-
|
|
120
|
+
- Rebranded binary/config (`hummin`, `~/.hummin/agent`) via pi's official `piConfig` fork support.
|
|
121
|
+
- GLM-first provider curation and defaults (this README).
|
|
122
|
+
- `hummin-colibri` extension + mock server.
|
|
123
|
+
- One upstream build fix (`FinishReason.TOO_MANY_TOOL_CALLS` handling) pending upstream discussion.
|
|
707
124
|
|
|
708
|
-
|
|
125
|
+
Everything else is upstream pi: sessions, extensions API, themes, tools, RPC/JSON modes. Read upstream's docs under [packages/coding-agent/docs](packages/coding-agent/docs).
|
|
709
126
|
|
|
710
|
-
|
|
711
|
-
- [@earendil-works/pi-agent-core](https://www.npmjs.com/package/@earendil-works/pi-agent-core): Agent framework
|
|
712
|
-
- [@earendil-works/pi-tui](https://www.npmjs.com/package/@earendil-works/pi-tui): Terminal UI components
|
|
127
|
+
## Contributing
|
|
713
128
|
|
|
714
|
-
|
|
715
|
-
<a href="https://pi.dev">pi.dev</a> domain graciously donated by
|
|
716
|
-
<br /><br />
|
|
717
|
-
<a href="https://exe.dev"><img src="docs/images/exy.png" alt="Exy mascot" width="48" /><br />exe.dev</a>
|
|
718
|
-
</p>
|
|
129
|
+
This fork follows upstream's bar: understand your code, keep the core minimal, prefer extensions. See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md) for the rules that apply to agent-written changes.
|
|
@@ -1331,7 +1331,7 @@ ${statusParts.join(`
|
|
|
1331
1331
|
`;this.addChild(new Markdown(header+this.message.summary,0,0,this.markdownTheme,{color:text=>theme.fg("customMessageText",text)}))}else this.addChild(new Text(theme.fg("customMessageText",`Compacted from ${tokenStr} tokens (`)+theme.fg("dim",keyText("app.tools.expand"))+theme.fg("customMessageText"," to expand)"),0,0))}};var CustomEditor=class extends Editor{keybindings;workingStatusIndicator;embedWorkingStatus;actionHandlers=new Map;onEscape;onCtrlD;onPasteImage;onExtensionShortcut;constructor(tui,theme2,keybindings,options){super(tui,theme2,options),this.keybindings=keybindings,this.embedWorkingStatus=options?.embedWorkingStatus??!1}setWorkingStatusIndicator(indicator){this.workingStatusIndicator=indicator}renderTopBorder(width,hiddenLineCount){if(!this.embedWorkingStatus||!this.workingStatusIndicator||width<=0)return super.renderTopBorder(width,hiddenLineCount);let status=this.workingStatusIndicator.renderInBorder(Math.max(1,width-5)),statusWidth=visibleWidth(status);if(statusWidth===0)return super.renderTopBorder(width,hiddenLineCount);let overflowLabel=hiddenLineCount>0?` \u2191 ${hiddenLineCount} more `:void 0,overflowLabelWidth=overflowLabel?visibleWidth(overflowLabel):0,overflowStart=Math.floor((width-overflowLabelWidth)/2),canFitOverflow=()=>overflowLabel!==void 0&&overflowLabelWidth+2<=width&&overflowStart-(3+statusWidth+1)>=1;if(overflowLabel&&!canFitOverflow()&&(status=this.workingStatusIndicator.renderSpinnerInBorder(width),statusWidth=visibleWidth(status)),canFitOverflow()){let leftBlockWidth=3+statusWidth+1;return this.borderColor("\u2500\u2500 ")+status+this.borderColor(` ${"\u2500".repeat(overflowStart-leftBlockWidth)}${overflowLabel}${"\u2500".repeat(width-overflowStart-overflowLabelWidth)}`)}if(width>=statusWidth+5)return this.borderColor("\u2500\u2500 ")+status+this.borderColor(` ${"\u2500".repeat(width-statusWidth-4)}`);status=this.workingStatusIndicator.renderSpinnerInBorder(width),statusWidth=visibleWidth(status);let prefixWidth=Math.min(3,Math.max(0,width-statusWidth));return this.borderColor("\u2500".repeat(prefixWidth))+status+this.borderColor("\u2500".repeat(Math.max(0,width-prefixWidth-statusWidth)))}onAction(action,handler){this.actionHandlers.set(action,handler)}handleInput(data){if(!this.onExtensionShortcut?.(data)){if(this.keybindings.matches(data,"app.clipboard.pasteImage")){this.onPasteImage?.();return}if(this.keybindings.matches(data,"app.interrupt")){if(!this.isShowingAutocomplete()){let handler=this.onEscape??this.actionHandlers.get("app.interrupt");if(handler){handler();return}}super.handleInput(data);return}if(this.keybindings.matches(data,"app.exit")&&this.getText().length===0){let handler=this.onCtrlD??this.actionHandlers.get("app.exit");handler&&handler();return}if(this.keybindings.matches(data,"tui.editor.historyPrevious")||this.keybindings.matches(data,"tui.editor.historyNext")){super.handleInput(data);return}for(let[action,handler]of this.actionHandlers)if(action!=="app.interrupt"&&action!=="app.exit"&&this.keybindings.matches(data,action)){handler();return}super.handleInput(data)}}};var CustomEntryComponent=class extends Container{entry;renderer;customComponent;_expanded=!1;constructor(entry,renderer){super(),this.entry=entry,this.renderer=renderer,this.rebuild()}hasContent(){return this.customComponent!==void 0}setExpanded(expanded){this._expanded!==expanded&&(this._expanded=expanded,this.rebuild())}invalidate(){super.invalidate(),this.rebuild()}rebuild(){this.clear(),this.customComponent=void 0;let component;try{component=this.renderer(this.entry,{expanded:this._expanded},theme)}catch(error){let message=error instanceof Error?error.message:String(error),box2=new Box(1,1,text=>theme.bg("customMessageBg",text));box2.addChild(new Text(theme.fg("error",`[${this.entry.customType}] renderer failed: ${message}`),0,0)),component=box2}component&&(this.customComponent=component,this.addChild(new Spacer(1)),this.addChild(component))}};var OSC133_ZONE_START2="\x1B]133;A\x07",OSC133_ZONE_END2="\x1B]133;B\x07",OSC133_ZONE_FINAL2="\x1B]133;C\x07";function formatMessageTimestamp(timestamp,now=new Date){let date=new Date(timestamp),time2=`${String(date.getHours()).padStart(2,"0")}:${String(date.getMinutes()).padStart(2,"0")}`;return date.getFullYear()===now.getFullYear()&&date.getMonth()===now.getMonth()&&date.getDate()===now.getDate()?time2:`${`${date.getFullYear()}-${String(date.getMonth()+1).padStart(2,"0")}-${String(date.getDate()).padStart(2,"0")}`} ${time2}`}var UserMessageComponent=class extends Container{scrollbarMarkerKind="user";text;markdownTheme;outputPad;markdownTransformers;timestamp;showTimestamp=!0;constructor(text,markdownTheme=getMarkdownTheme(),outputPad=1,markdownTransformers=[],timestamp){super(),this.text=text,this.markdownTheme=markdownTheme,this.outputPad=outputPad,this.markdownTransformers=markdownTransformers,this.timestamp=timestamp,this.rebuild()}setOutputPad(padding){this.outputPad=padding,this.rebuild()}setShowTimestamp(enabled){this.showTimestamp=enabled}rebuild(){this.clear();let contentBox=new Box(this.outputPad,1,content=>theme.bg("userMessageBg",content));contentBox.addChild(new Markdown(this.text,0,0,this.markdownTheme,{color:content=>theme.fg("userMessageText",content)},{preserveOrderedListMarkers:!0,preserveBackslashEscapes:!0,transform:createMarkdownTransform("user",!1,this.markdownTransformers)})),this.addChild(contentBox)}render(width){let lines=super.render(width);if(lines.length===0)return lines;if(this.showTimestamp&&this.timestamp!==void 0){let tag=theme.fg("dim",formatMessageTimestamp(this.timestamp)),padWidth=Math.max(0,width-1-visibleWidth(tag)),tagLine=" ".repeat(padWidth)+tag;lines.push(truncateToWidth(tagLine,width))}return lines[0]=OSC133_ZONE_START2+lines[0],lines[lines.length-1]=OSC133_ZONE_END2+OSC133_ZONE_FINAL2+lines[lines.length-1],lines}};var CustomMessageComponent=class extends Container{message;customRenderer;box;customComponent;markdownTheme;_expanded=!1;outputPad;showTimestamp;scrollbarMarkerKind="system";constructor(message,customRenderer,markdownTheme=getMarkdownTheme(),outputPad=1,showTimestamp=!1){super(),this.message=message,this.customRenderer=customRenderer,this.markdownTheme=markdownTheme,this.outputPad=outputPad,this.showTimestamp=showTimestamp,this.addChild(new Spacer(1)),this.box=new Box(1,1,t=>theme.bg("customMessageBg",t)),this.rebuild()}setExpanded(expanded){this._expanded!==expanded&&(this._expanded=expanded,this.rebuild())}setOutputPad(outputPad){this.outputPad!==outputPad&&(this.outputPad=outputPad,this.rebuild())}setShowTimestamp(enabled){this.showTimestamp=enabled}invalidate(){super.invalidate(),this.rebuild()}rebuild(){if(this.customComponent&&(this.removeChild(this.customComponent),this.customComponent=void 0),this.removeChild(this.box),this.customRenderer)try{let component=this.customRenderer(this.message,{expanded:this._expanded,outputPad:this.outputPad},theme);if(component){this.customComponent=component,this.addChild(component);return}}catch{}this.addChild(this.box),this.box.clear();let label=theme.fg("customMessageLabel",`\x1B[1m[${this.message.customType}]\x1B[22m`);this.box.addChild(new Text(label,0,0)),this.box.addChild(new Spacer(1));let text;typeof this.message.content=="string"?text=this.message.content:text=this.message.content.filter(c2=>c2.type==="text").map(c2=>c2.text).join(`
|
|
1332
1332
|
`),this.box.addChild(new Markdown(text,0,0,this.markdownTheme,{color:text2=>theme.fg("customMessageText",text2)}))}render(width){let lines=super.render(width);if(!this.showTimestamp||lines.length===0)return lines;let tag=theme.fg("dim",formatMessageTimestamp(this.message.timestamp)),padWidth=Math.max(0,width-1-visibleWidth(tag));return lines.push(truncateToWidth(" ".repeat(padWidth)+tag,width)),lines}};var DAX_HEX="bbbab8b9b9b6b9b8b5bcbbb8b8b7b4b7b5b2b6b5b2b8b7b4b7b6b3b6b4b1bdbcb8bab8b6bbb8b5b8b5b1bbb8b4c2bebbc1bebac0bdbabfbcb9c1bebabfbebbc0bfbcc0bdbabbb8b5c1bfbcbfbcb8bbb9b6bfbcb8c2bfbcc1bfbcbfbbb8bdb9b6b8b7b5b9b8b5b8b8b5b5b5b2b6b5b2b8b7b4b9b8b5b9b8b5b6b5b3bab8b5bcbab7bbb9b6bbb8b5bfb9b5bdb2abbcb0a8beb2aabeb5afbfbab6bebab7c0bfbcbebdbabebbb8c0bdbabfbebbc2bebbbdbab7c3c0bdc3c0bdc1bebbc2bebabfbcb8bab9b6b7b6b3b2b1aeb6b5b2b5b4b1b5b4b2b6b5b2b7b6b4b9b8b6b7b6b3bbbab7b2afaba5988fb49e90b09481b79a88b39683b09583b7a395bfb6b0c0bdbabdbbb8bebcb9c1bfbcc0bebbbdbab7bebbb8c2bfbcc0bdbac0bcb9bdb9b6c0bcb8b5b4b2b4b3b0bab9b6b9b9b6b5b4b1b5b4b1b6b5b3b9b8b5b9b8b6b9b8b6b2aeaa968174a6836eaa856eab846eaf8973ac8973b08f79b18f7ab39786b7a89dbbb3aebfbab6c2c0bdbebcb9bfbdbac3c1bdc2bebbc0bcb9bdb9b6c1bdbabfbbb8b4b3b0b9b8b5b8b7b5b4b3b1b5b4b1b8b7b4b8b7b5bab9b6bbbab7b1afad8c7a719d735ca47860a87d65a98069ae8972ae8c75af8d77aa826ba98067aa8974b39e90b6a79dbbb2adc0bdbac1bfbdbfbbb8c1bdb9bebab6c0bdb9bfbbb8c1bdbab4b2b0b7b6b4b7b6b3b4b2b0bab9b7b6b5b2b6b5b2bab9b6bab9b6958c87977663aa836bac8772b08f7aad8c77b2917db0917db0907cac8971a77d64a87f67ac8972b29887b8a89dbfbab5bfbdbac1bebac0bcb9c0bcb9c0bcb9c1bebabebab7b8b7b4b7b6b4b5b4b1b5b4b2b7b6b3b5b4b2bab9b7bab9b6b4b1ada88f7fad8973ae8d78b19684b19685b29786b69a89b29582b1917daa856ea87e66a97e66ad866ea9826baf9280b8ada6bdbbb8bebab7bfbbb8c1bdbabfbbb8bcb8b4bcb8b5b6b4b2b7b5b3b6b5b2b8b7b4b3b2afb8b7b4b6b5b2b3b2b0b3a59aab856fad8d78b0917eb19886b49b8bb49a89b39785b0917eaf8f7cab866fa77d65a77a61a87d64a9816ab08f79b5a296c1bcb8c3bfbcc2bebbbebab7bfbbb7bdbab6c2bebab8b7b4b7b6b4b6b5b3b7b6b3b6b5b2b9b8b6b4b3b1b6b1acac8f7ca9826bae8f7aaf9583b49c8cb49c8bb79d8cb59987b19380ad8e79ae8c77af8e78ac8771a3775faa826bae8972b39888bbb6b2bebbb8bfbbb8bfbbb8c0bdb9bebbb7c0bdb9b6b5b2b9b8b5b4b3b1b8b7b5b4b3b0b7b6b4b6b5b3b1a7a0aa8772a77d65a88570b49887b19b8d9c887c907a6d987f71aa907faf917daf8e7aad8c78ac8b77a8836ca9836cac8770b49b8abdb6b2c0bcb9c0bdb9bfbbb8bebab7bfbcb9bebab7b9b8b6b5b4b2b9b8b5b8b7b5b8b7b4b7b6b4b5b4b2b3a9a2ad8973a1755da9856fb398858c776a65544b776358725d526e594d9c7f6eb1907ba68672ad8e7aab8771ac856db18f79b3a092beb9b5c1bdbabdb9b5bebab7bfbbb7bebab7bcb9b6b7b6b4b6b6b3b8b7b4b5b4b2b8b6b4b7b6b3b4b3b0b4aba4a6826ba3775fb08e79b19584a88e7daa8e7db29481ad8f7c997e6da38674ac8d79ac8e7aae917f9a7c6a896a599a7c6ab3a398c1bdbabdb9b6bcb8b5bebab6bebab7bdb9b5bdb9b6b5b4b1b7b5b3b5b4b2b7b6b3b7b6b4b3b3b0b3b2b0b4aca5a7846fa97f68ae8f7bae9383b59c8bb2937fae8e79ac8b76af927eaf927eb29683b39885b2988891786a72594c6e594d978d86bdbab7bab7b3c0bcb9c0bcb9bebab7bebbb7bdb9b6b3b2b0b4b3b0b5b4b2b4b4b1b4b3b1b4b3b1b4b3b0b6ada5aa8670a57a62ad8e7ab29b8cb69d8dab856fa9826aa88069ab8771af907db49987b19684b29886b59987b39480b09787b5a9a1bcb8b5bebab7bdb9b5bebab7bfbbb8bfbbb7bbb7b4b3b2afb8b7b5b8b7b5b3b2b0b5b4b2b6b5b3b6b4b1afa299a98975a9826baf907cb39988b49a89af8e7aac8973aa856eaf8c74b1917dae907dac907db39988b29785b49785b7a090b9aca3bfbab7bcb8b5bdb9b6bcb8b4bcb8b5bdb9b5bcb8b4b5b4b2b6b5b3b4b3b0b4b3b0b9b8b5b8b6b4908b88887467aa8f7ea78976ad8973b08b74b59885b69e8eb29888b1917cb1917db1937fae907cb19686b39a8ab29886b59b8ab8a192b6aaa3b7b2afbcb8b4bcb8b5bbb7b4c0bcb9bebab7c0bcb9b6b5b2b6b5b3b4b3b0bab9b7b7b6b4b1b0ae7b716ba083709b806f716158967764b08870b29481b69b8ab69f8fb39a89b69f90b49d8db39a89b29988b49c8cb6a090b8a496baa49593867f8f8986bfbbb7bdb9b5bcb7b4bab6b3b9b5b2bab6b2b4b3b1b3b3b0b6b5b3b8b7b5b4b2b0a7a5a38f837dae917ea084725a504c63544da28370b39784b59e8db2a093a698909b918b998e8790857e95877dad998bb39c8cb5a091b9a2938d827c95908dbebab6bbb7b3bdbab7bbb7b4bdb9b6bbb7b4b4b3b0b5b4b1b8b7b5b6b5b3b8b8b5b4b2af968f8ab29a8bab9485544b483a323073655d96887f70655f61595547403e453e3c453f3d57504f655e5b90847db39c8db7a090b6a09189807aaba6a3bdb9b6c0bcb9bebab7bcb7b4bebab7bbb7b4b3b2b0b6b5b3b2b1afb7b6b4b8b7b4b5b4b1aeaba8b5a89fac998d4d44412d25244d46444e4744322b293a3230423937433a37352d2a59504c534b48524a48988a81b59f8fb19c8d827974b2afacbdb9b5bcb8b4bdb9b5bcb8b5bdb9b6bab6b2b8b7b5b5b4b2b6b6b3b9b8b5b7b6b3b6b5b2b8b6b3b9b4b1b2a9a26c64612d25242d2625312a28352d2c453d3a78675c8d7a6ea09792aea6a0615854332b29524a479f8e82b09d90a49b96c1bdb9bebab7bfbbb8bbb8b4b9b5b1b8b4b0b9b4b0b7b6b4b8b7b5b8b7b4b6b5b3b8b6b3bab9b6b9b8b5b4b3b0b7b5b2a5a29f453d3b261e1d261f1e2e2625413936857268977865b19482b5a69caca5a07c7572453d3b746963a0948cc5bfbbc0bbb8beb9b6bbb7b3bbb6b3b7b3afb8b4b0b9b5b1b7b6b3b6b5b3b5b4b2b5b4b2b7b6b3b7b6b3b8b6b3b4b2afb7b6b3b3b1ae6d6765251f1e1e18172a22212d2523443b3971625ab19888b09482a89182877e792c25243e3634766d6abeb9b5bfbbb7bebab6bcb7b3bbb6b3b9b5b1b7b3afb8b4b0b4b3b0b5b4b1b5b4b1b4b3b1b5b4b2b8b6b4b5b3b0b9b6b4b5b4b1b6b4b27f79762a2322221c1b2d2524221b1a443e3c47413f6f676281766f867971675e5a3e37352a222166605dbab7b3bdb9b5beb9b5bcb7b3bcb7b3b9b4b0bab6b2bab6b2b5b3b0b6b4b2b3b2afb7b6b3b4b4b1b4b3b0b6b4b1b5b4b1b4b3b0b9b6b29a8c8252474230292828201f181212322c2c231e1d1c16162c26252923222d26252d2523332b2a8e8885bcb8b5bcb7b3bbb6b2bcb7b3b9b4b1b9b5b1b7b2afb7b2ae7a838e9b9b9caeadacb3b2b0b3b2afb7b7b4b6b5b3b6b6b3b7b6b3b9ada4a991808e7b6f50453f2b24231a14142923221f19181d17161f18182620201d17162a22215d5654b7b3b0bbb7b3bbb6b2b8b4b0bab5b1bbb6b2bab5b1b8b4b0bab6b22c496b4c5d735f68766e727a828285929090adaba8b7b2aeb6a59ab39682a28470a387748e76674e403a1a14141d1716181211221c1c1f1918221c1b2f2827342d2c8d8884bab6b3b9b5b2bab5b1bab5b1b9b4b0bab6b2b8b4b0b9b4b0b7b2ae325e8b365f8a3a5d833f5b7a545f70646469706b6aa08f84b08e78b18e769f7e689e7f6b9e816d907766584940362d2a1c1615201b1a1a1413201a1a251e1d393331a39e9bbab5b1bcb7b3bab6b2b8b3afb8b4b0b9b4b0b9b4b1bab5b2b5b0ac3d6c9843729d44719c426e98415f805a64716f6a699d8677b1927eb3947faa89749d7a649f7f6ba487749e837186716454463f2c25231e181837302e3a33317a7471beb9b6bcb8b4bbb6b2b6b2aebab5b1b9b5b1b8b3afbab6b2b6b1adb5aeaa4877a14c7aa44e7ba345719a3a5d80586b7f767475927b6eb1927faf8e79b08e78a78169a07861a17f6aa58570a688749b83738270666f66618a8480a49e99b7b2aebab6b2bcb8b4b9b5b1b7b2aebab5b1b9b4b0b6b1aeb6b1adb2aca8b2aca84876a04a78a2517fa74771973a5d80405c7a6161677c695fac8a75b08d77b4917aaf8971ad876fa5816aa6846ea78670a98a76ac9484ab9f96b2aca8bdb8b4bcb7b3bcb8b4bcb8b4b8b3afb7b2aeb9b4b0b8b3afb8b2aeb6afabb3aeaab2aeaa4878a14b7aa34c7ba44a759b3d63873b5f825b67766f5f569c7e6caf8c77b18f79b28f78b5927caf8e78a98872aa8a76a98a76ac917fada199b7b0acb9b3afbfb9b5c1bab6bdb6b2b8b3afbab5b1b9b4b0b6afabb7b1adb3ada9b3aeaab0aba8",WIDTH2=32,HEIGHT2=32;function parseImage(){let pixels=[];for(let y2=0;y2<HEIGHT2;y2++){let row=[];for(let x2=0;x2<WIDTH2;x2++){let idx=(y2*WIDTH2+x2)*6,r=parseInt(DAX_HEX.slice(idx,idx+2),16),g=parseInt(DAX_HEX.slice(idx+2,idx+4),16),b2=parseInt(DAX_HEX.slice(idx+4,idx+6),16);row.push([r,g,b2])}pixels.push(row)}return pixels}function rgb(r,g,b2,bg=!1){return`\x1B[${bg?48:38};2;${r};${g};${b2}m`}var RESET="\x1B[0m";function buildImage(){let pixels=parseImage(),lines=[];for(let row=0;row<HEIGHT2;row+=2){let line="";for(let x2=0;x2<WIDTH2;x2++){let top=pixels[row][x2],bottom=pixels[row+1]?.[x2]??top;line+=`${rgb(bottom[0],bottom[1],bottom[2])}${rgb(top[0],top[1],top[2],!0)}\u2584`}line+=RESET,lines.push(line)}return lines}var DaxnutsComponent=class{ui;image;interval=null;tick=0;maxTicks=25;cachedLines=[];cachedWidth=0;cachedTick=-1;constructor(ui){this.ui=ui,this.image=buildImage(),this.startAnimation()}invalidate(){this.cachedWidth=0}startAnimation(){this.interval=setInterval(()=>{this.tick++,this.tick>=this.maxTicks&&this.stopAnimation(),this.cachedWidth=0,this.ui.requestRender()},80)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}render(width){if(width===this.cachedWidth&&this.cachedTick===this.tick)return this.cachedLines;let t=theme,lines=[],center=s=>{let visible=s.replace(/\x1b\[[0-9;]*m/g,"").length,left=Math.max(0,Math.floor((width-visible)/2));return" ".repeat(left)+s};lines.push("");let revealedRows=Math.min(this.image.length,Math.floor(this.tick/this.maxTicks*(this.image.length+3)));for(let i=0;i<this.image.length;i++)if(i<revealedRows)lines.push(center(this.image[i]));else if(i===revealedRows){let scanline="\u2593".repeat(WIDTH2);lines.push(center(rgb(100,200,255)+scanline+RESET))}else lines.push(center(" ".repeat(WIDTH2)));lines.push("");let textPhase=Math.max(0,this.tick-this.maxTicks*.6);return textPhase>0||this.tick>=this.maxTicks?(lines.push(center(t.fg("accent","Free Kimi K2.5 via OpenCode Zen"))),lines.push(center(t.fg("success",'"Powered by daxnuts"'))),lines.push(center(t.fg("muted","\u2014 @thdxr")))):(lines.push(""),lines.push(""),lines.push("")),lines.push(""),textPhase>2||this.tick>=this.maxTicks?(lines.push(center(t.fg("dim","Try OpenCode"))),lines.push(center(t.fg("mdLink","https://mistral.ai/news/mistral-vibe-2-0")))):(lines.push(""),lines.push("")),lines.push(""),this.cachedLines=lines,this.cachedWidth=width,this.cachedTick=this.tick,lines}dispose(){this.stopAnimation()}};import*as fs6 from"node:fs";var BLOG_URL="https://mariozechner.at/posts/2026-04-08-ive-sold-out/",IMAGE_FILENAME="clankolas.png",cachedImageBase64,attemptedImageLoad=!1;function loadImageBase64(){if(attemptedImageLoad)return cachedImageBase64;attemptedImageLoad=!0;try{cachedImageBase64=fs6.readFileSync(getBundledInteractiveAssetPath(IMAGE_FILENAME)).toString("base64")}catch{cachedImageBase64=void 0}return cachedImageBase64}var EarendilAnnouncementComponent=class extends Container{constructor(){super(),this.addChild(new DynamicBorder(text=>theme.fg("accent",text))),this.addChild(new Text(theme.bold(theme.fg("accent","pi has joined Earendil")),1,0)),this.addChild(new Spacer(1)),this.addChild(new Text(theme.fg("muted","Read the blog post:"),1,0)),this.addChild(new Text(theme.fg("mdLink",BLOG_URL),1,0)),this.addChild(new Spacer(1));let imageBase64=loadImageBase64();imageBase64&&(this.addChild(new Image(imageBase64,"image/png",{fallbackColor:text=>theme.fg("muted",text)},{maxWidthCells:56,filename:IMAGE_FILENAME})),this.addChild(new Spacer(1))),this.addChild(new DynamicBorder(text=>theme.fg("accent",text)))}};import{spawn as spawn8}from"node:child_process";import{mkdtempSync,readFileSync as readFileSync21,rmSync as rmSync4,writeFileSync as writeFileSync13}from"node:fs";import{tmpdir as tmpdir5}from"node:os";import{join as join38}from"node:path";async function editInExternalEditor(options){let directory=mkdtempSync(join38(tmpdir5(),"pi-editor-")),filePath=join38(directory,"prompt.md");try{writeFileSync13(filePath,options.content,"utf-8");let[editor,...editorArgs]=options.command.split(" ");return process.stdout.write(`Launching external editor: ${options.command}
|
|
1333
1333
|
hummin will resume when the editor exits.
|
|
1334
|
-
`),await new Promise(resolve17=>{let child=spawn8(editor,[...editorArgs,filePath],{stdio:"inherit",shell:process.platform==="win32"});child.on("error",()=>resolve17(null)),child.on("close",code=>resolve17(code))})!==0?{status:"failed"}:{status:"complete",content:stripBom(readFileSync21(filePath,"utf-8")).replace(/\n$/,"")}}finally{try{rmSync4(directory,{recursive:!0,force:!0})}catch{}}}var ExtensionEditorComponent=class extends Container{editor;onSubmitCallback;onCancelCallback;tui;keybindings;externalEditorCommand;_focused=!1;get focused(){return this._focused}set focused(value2){this._focused=value2,this.editor.focused=value2}constructor(tui,keybindings,title,prefill,onSubmit,onCancel,options,externalEditorCommand){super(),this.tui=tui,this.keybindings=keybindings,this.externalEditorCommand=externalEditorCommand||process.env.VISUAL||process.env.EDITOR||(process.platform==="win32"?"notepad":"nano"),this.onSubmitCallback=onSubmit,this.onCancelCallback=onCancel,this.addChild(new DynamicBorder),this.addChild(new Spacer(1)),this.addChild(new Text(theme.fg("accent",title),1,0)),this.addChild(new Spacer(1)),this.editor=new Editor(tui,getEditorTheme(),options),prefill&&this.editor.setText(prefill),this.editor.onSubmit=text=>{this.onSubmitCallback(text)},this.addChild(this.editor),this.addChild(new Spacer(1));let hint=keyHint("tui.select.confirm","submit")+" "+keyHint("tui.input.newLine","newline")+" "+keyHint("tui.select.cancel","cancel")+` ${keyHint("app.editor.external","external editor")}`;this.addChild(new Text(hint,1,0)),this.addChild(new Spacer(1)),this.addChild(new DynamicBorder)}handleInput(keyData){if(getKeybindings().matches(keyData,"tui.select.cancel")){this.onCancelCallback();return}if(this.keybindings.matches(keyData,"app.editor.external")){this.handleOpenExternalEditor();return}this.editor.handleInput(keyData)}async handleOpenExternalEditor(){let content=this.editor.getText();this.tui.stop();try{let result=await editInExternalEditor({command:this.externalEditorCommand,content});result.status==="complete"&&this.editor.setText(result.content)}finally{this.tui.start(),this.tui.requestRender(!0)}}};import{isAbsolute as isAbsolute4,relative as relative5,resolve as resolve13,sep as sep9}from"node:path";function sanitizeStatusText(text){return text.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()}function formatTokens(count){return count<1e3?count.toString():count<1e4?`${(count/1e3).toFixed(1)}k`:count<1e6?`${Math.round(count/1e3)}k`:count<1e7?`${(count/1e6).toFixed(1)}M`:`${Math.round(count/1e6)}M`}function formatCwdForFooter(cwd,home){if(!home)return cwd;let resolvedCwd=resolve13(cwd),resolvedHome=resolve13(home),relativeToHome=relative5(resolvedHome,resolvedCwd);return relativeToHome===""||relativeToHome!==".."&&!relativeToHome.startsWith(`..${sep9}`)&&!isAbsolute4(relativeToHome)?relativeToHome===""?"~":`~${sep9}${relativeToHome}`:cwd}var FooterComponent=class{autoCompactEnabled=!0;session;footerData;compactionQueueCount=0;diffStatCache=new Map;cachedPrefix;constructor(session,footerData){this.session=session,this.footerData=footerData}setSession(session){this.session=session}setAutoCompactEnabled(enabled){this.autoCompactEnabled=enabled}setCompactionQueueCount(count){this.compactionQueueCount=count}invalidate(){}dispose(){}getToolDiffStat(message){let details=message.details;if(typeof details?.added=="number"&&typeof details.removed=="number")return{added:details.added,removed:details.removed};if(typeof details?.diff!="string"||details.diff==="")return;let cached=this.diffStatCache.get(message.toolCallId);if(cached)return cached;let stat3=countDiffStat(details.diff);return this.diffStatCache.set(message.toolCallId,stat3),stat3}aggregateEntry(entry,usage,diff){let message=entry.message;if(entry.type==="message"&&message?.role==="assistant"){let msgUsage=message.usage;addUsageToTotals(usage,msgUsage);let latestPromptTokens=msgUsage.input+msgUsage.cacheRead+msgUsage.cacheWrite;return latestPromptTokens>0?msgUsage.cacheRead/latestPromptTokens*100:void 0}if(entry.type==="message"&&message?.role==="toolResult"){message.usage&&addUsageToTotals(usage,message.usage);let stat3=this.getToolDiffStat({toolCallId:message.toolCallId??"",details:message.details});stat3&&(diff.added+=stat3.added,diff.removed+=stat3.removed)}(entry.type==="branch_summary"||entry.type==="compaction")&&entry.usage&&addUsageToTotals(usage,entry.usage)}computeSessionStats(){let entries=this.session.sessionManager.getEntries(),prefixCount=Math.max(0,entries.length-1);if(!this.cachedPrefix||this.cachedPrefix.entryCount!==prefixCount||entries[0]!==this.cachedPrefix.firstEntry){let usage=createUsageTotals(),diff={added:0,removed:0},cacheHitRate;for(let i=0;i<prefixCount;i++){let hitRate=this.aggregateEntry(entries[i],usage,diff);hitRate!==void 0&&(cacheHitRate=hitRate)}this.cachedPrefix={entryCount:prefixCount,firstEntry:entries[0],usage,diff,cacheHitRate}}let usageTotals={...this.cachedPrefix.usage},sessionDiff={...this.cachedPrefix.diff},latestCacheHitRate=this.cachedPrefix.cacheHitRate;if(entries.length>0){let hitRate=this.aggregateEntry(entries[entries.length-1],usageTotals,sessionDiff);hitRate!==void 0&&(latestCacheHitRate=hitRate)}return{usageTotals,sessionDiff,latestCacheHitRate}}joinGroups(groups){return groups.filter(group=>group.length>0).join(theme.fg("dim"," | "))}alignLeftRight(left,right,width){let rightWidth=visibleWidth(right);if(visibleWidth(left)+rightWidth<=width)return left+" ".repeat(width-visibleWidth(left)-rightWidth)+right;if(rightWidth>=width)return truncateToWidth(right,width,"...");let truncatedLeft=truncateToWidth(left,width-rightWidth,"..."),padding=" ".repeat(Math.max(0,width-visibleWidth(truncatedLeft)-rightWidth));return truncatedLeft+padding+right}render(width){let state2=this.session.state,{usageTotals,sessionDiff,latestCacheHitRate}=this.computeSessionStats(),contextUsage=this.session.getContextUsage(),contextWindow=contextUsage?.contextWindow??state2.model?.contextWindow??0,contextPercentValue=contextUsage?.percent??0,contextPercent=contextUsage?.percent!==null?contextPercentValue.toFixed(1):"?",cwd=formatCwdForFooter(this.session.sessionManager.getCwd(),process.env.HOME||process.env.USERPROFILE),gitStatus=this.footerData.getGitStatus(),branch=this.footerData.getGitBranch(),repoName=this.footerData.getGitRepoName(),idParts=[theme.fg("dim",cwd)];if(repoName&&idParts.push(repoName),branch){let dirty=gitStatus&&(gitStatus.staged>0||gitStatus.modified>0||gitStatus.untracked>0)?"*":"";idParts.push(theme.fg("accent",`${branch}${dirty}`))}let sessionName2=this.session.sessionManager.getSessionName();sessionName2&&idParts.push(sessionName2);let idLine=this.joinGroups(idParts),modelName=state2.model?.id||"no-model",providerName=state2.model?this.session.modelRuntime.getProvider(state2.model.provider)?.name??state2.model.provider:void 0,modelParts=[];if(providerName&&modelParts.push(theme.fg("dim",`(${providerName})`)),modelParts.push(theme.fg("accent",modelName)),state2.model?.reasoning){let thinkingLevel=state2.thinkingLevel||"off";modelParts.push(theme.fg("dim",thinkingLevel==="off"?"no thinking":thinkingLevel))}let modelLine=`${theme.fg("dim","|")} ${modelParts.join(theme.fg("dim"," + "))}`,statGroups=[],queueCount=this.session.pendingMessageCount+this.compactionQueueCount;if(queueCount>0&&statGroups.push(`${theme.fg("dim","queue")} ${theme.fg("accent",String(queueCount))}`),sessionDiff.added>0||sessionDiff.removed>0){let diffParts=[];sessionDiff.added>0&&diffParts.push(theme.fg("toolDiffAdded",`+${formatTokens(sessionDiff.added)}`)),sessionDiff.removed>0&&diffParts.push(theme.fg("toolDiffRemoved",`-${formatTokens(sessionDiff.removed)}`)),statGroups.push(`${theme.fg("dim","diff")} ${diffParts.join(" ")}`)}if(gitStatus){let gitParts=[];gitStatus.staged>0&&gitParts.push(theme.fg("toolDiffAdded",`+${gitStatus.staged}`)),gitStatus.modified>0&&gitParts.push(theme.fg("warning",`~${gitStatus.modified}`)),gitStatus.untracked>0&&gitParts.push(theme.fg("dim",`?${gitStatus.untracked}`)),gitStatus.ahead&&gitParts.push(theme.fg("accent",`\u2191${gitStatus.ahead}`)),gitStatus.behind&&gitParts.push(theme.fg("accent",`\u2193${gitStatus.behind}`)),gitParts.length>0&&statGroups.push(`${theme.fg("dim","git")} ${gitParts.join(" ")}`)}let tokenParts=[];usageTotals.input&&tokenParts.push(`${theme.fg("dim","in")} ${formatTokens(usageTotals.input)}`),usageTotals.output&&tokenParts.push(`${theme.fg("dim","out")} ${formatTokens(usageTotals.output)}`),usageTotals.cacheRead&&tokenParts.push(`${theme.fg("dim","rd")} ${formatTokens(usageTotals.cacheRead)}`),usageTotals.cacheWrite&&tokenParts.push(`${theme.fg("dim","wr")} ${formatTokens(usageTotals.cacheWrite)}`),(usageTotals.cacheRead>0||usageTotals.cacheWrite>0)&&latestCacheHitRate!==void 0&&tokenParts.push(`${theme.fg("dim","hit")} ${latestCacheHitRate.toFixed(1)}%`);let usingSubscription=state2.model?state2.model.provider==="kimi-coding"||this.session.modelRuntime.isUsingSubscription(state2.model.provider):!1,pricedModel=state2.model&&Object.values(state2.model.cost??{}).some(rate=>rate>0);(usageTotals.cost||usingSubscription||pricedModel)&&tokenParts.push(`$${usageTotals.cost.toFixed(3)}${usingSubscription?" (sub)":""}`),tokenParts.length>0&&statGroups.push(tokenParts.join(theme.fg("dim"," \xB7 ")));let statsLine=this.joinGroups(statGroups),autoTag=this.autoCompactEnabled?" auto":"",barCells=10,filled=Math.max(0,Math.min(barCells,Math.round(contextPercentValue/100*barCells))),bar="\u2588".repeat(filled)+"\u2591".repeat(barCells-filled),meterColor=contextPercentValue>90?"error":contextPercentValue>70?"warning":"accent",contextValue=contextPercent==="?"?`${theme.fg("dim","?")}/${formatTokens(contextWindow)}`:`${theme.fg(meterColor,bar)} ${theme.fg("dim",`${contextPercent}%${autoTag}`)}`,contextLine=`${theme.fg("dim","|")} ${theme.fg("dim","ctx")} ${contextValue}`,lines=[this.alignLeftRight(idLine,modelLine,width),this.alignLeftRight(statsLine,contextLine,width)],extensionStatuses=this.footerData.getExtensionStatuses();if(extensionStatuses.size>0){let statusLine=Array.from(extensionStatuses.entries()).sort(([a],[b2])=>a.localeCompare(b2)).map(([,text])=>sanitizeStatusText(text)).join(" ");lines.push(truncateToWidth(statusLine,width,theme.fg("dim","...")))}return lines}};import{spawn as spawn9}from"node:child_process";function openBrowser(target){let[cmd,args]=process.platform==="darwin"?["open",[target]]:process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",target]]:["xdg-open",[target]];spawn9(cmd,args,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}var LoginDialogComponent=class extends Container{contentContainer;input;tui;abortController=new AbortController;inputResolver;inputRejecter;onComplete;_focused=!1;get focused(){return this._focused}set focused(value2){this._focused=value2,this.input.focused=value2}constructor(tui,providerId,onComplete,providerNameOverride,titleOverride){super(),this.tui=tui,this.onComplete=onComplete;let title=titleOverride??`Login to ${providerNameOverride||providerId}`;this.addChild(new DynamicBorder),this.addChild(new Text(theme.fg("accent",theme.bold(title)),1,0)),this.contentContainer=new Container,this.addChild(this.contentContainer),this.input=new Input,this.input.onSubmit=()=>{if(this.inputResolver){let value2=this.input.getValue();this.replaceInputWithSubmittedText(value2),this.inputResolver(value2),this.inputResolver=void 0,this.inputRejecter=void 0}},this.input.onEscape=()=>{this.cancel()},this.addChild(new DynamicBorder)}get signal(){return this.abortController.signal}replaceInputWithSubmittedText(value2){this.contentContainer.children=this.contentContainer.children.map(child=>child===this.input?new Text(`> ${value2}`,0,0):child)}cancel(){this.abortController.abort(),this.inputRejecter&&(this.inputRejecter(new Error("Login cancelled")),this.inputResolver=void 0,this.inputRejecter=void 0),this.onComplete(!1,"Login cancelled")}showAuth(url,instructions){this.contentContainer.clear(),this.contentContainer.addChild(new Spacer(1));let linkedUrl=`\x1B]8;;${url}\x07${url}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("accent",linkedUrl),1,0));let clickHint=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",hyperlink2=`\x1B]8;;${url}\x07${clickHint}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("dim",hyperlink2),1,0)),instructions&&(this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("warning",instructions),1,0))),openBrowser(url),this.tui.requestRender()}showDeviceCode(info){this.contentContainer.clear(),this.contentContainer.addChild(new Spacer(1));let linkedUrl=`\x1B]8;;${info.verificationUri}\x07${info.verificationUri}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("accent",linkedUrl),1,0));let clickHint=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",hyperlink2=`\x1B]8;;${info.verificationUri}\x07${clickHint}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("dim",hyperlink2),1,0)),this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("warning",`Enter code: ${info.userCode}`),1,0)),this.tui.requestRender()}showManualInput(prompt){return this.input.setValue(""),this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("dim",prompt),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender(),new Promise((resolve17,reject)=>{this.inputResolver=resolve17,this.inputRejecter=reject})}showPrompt(message,placeholder){return this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("text",message),1,0)),placeholder&&this.contentContainer.addChild(new Text(theme.fg("dim",`e.g., ${placeholder}`),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to cancel,")} ${keyHint("tui.select.confirm","to submit")})`,1,0)),this.input.setValue(""),this.tui.requestRender(),new Promise((resolve17,reject)=>{this.inputResolver=resolve17,this.inputRejecter=reject})}showDetails(lines){this.contentContainer.clear(),this.contentContainer.addChild(new Spacer(1));for(let line of lines)this.contentContainer.addChild(new Text(line,1,0));this.tui.requestRender()}showInfo(message,links=[],showCloseHint=!1){this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("text",message),1,0));for(let link of links){let text=link.label?`${link.label}: ${link.url}`:link.url,hyperlink2=`\x1B]8;;${link.url}\x07${text}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("accent",hyperlink2),1,0))}showCloseHint&&(this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to close")})`,1,0))),this.tui.requestRender()}showWaiting(message){this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("dim",message),1,0)),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender()}showProgress(message){this.contentContainer.addChild(new Text(theme.fg("dim",message),1,0)),this.tui.requestRender()}handleInput(data){if(getKeybindings().matches(data,"tui.select.cancel")){this.cancel();return}this.input.handleInput(data)}};var WIDTHS=[[0,172,1],[173,173,0],[174,767,1],[768,879,0],[880,1154,1],[1155,1161,0],[1162,1424,1],[1425,1469,0],[1470,1470,1],[1471,1471,0],[1472,1472,1],[1473,1474,0],[1475,1475,1],[1476,1477,0],[1478,1478,1],[1479,1479,0],[1480,1540,1],[1541,1541,0],[1542,1551,1],[1552,1562,0],[1563,1563,1],[1564,1564,0],[1565,1610,1],[1611,1631,0],[1632,1647,1],[1648,1648,0],[1649,1749,1],[1750,1756,0],[1757,1758,1],[1759,1764,0],[1765,1766,1],[1767,1768,0],[1769,1769,1],[1770,1773,0],[1774,1806,1],[1807,1807,0],[1808,1808,1],[1809,1809,0],[1810,1839,1],[1840,1866,0],[1867,1957,1],[1958,1968,0],[1969,2026,1],[2027,2035,0],[2036,2044,1],[2045,2045,0],[2046,2069,1],[2070,2073,0],[2074,2074,1],[2075,2083,0],[2084,2084,1],[2085,2087,0],[2088,2088,1],[2089,2093,0],[2094,2136,1],[2137,2139,0],[2140,2191,1],[2192,2193,0],[2194,2199,1],[2200,2207,0],[2208,2249,1],[2250,2306,0],[2307,2361,1],[2362,2362,0],[2363,2363,1],[2364,2364,0],[2365,2368,1],[2369,2376,0],[2377,2380,1],[2381,2381,0],[2382,2384,1],[2385,2391,0],[2392,2401,1],[2402,2403,0],[2404,2432,1],[2433,2433,0],[2434,2491,1],[2492,2492,0],[2493,2493,1],[2494,2494,0],[2495,2496,1],[2497,2500,0],[2501,2508,1],[2509,2509,0],[2510,2518,1],[2519,2519,0],[2520,2529,1],[2530,2531,0],[2532,2557,1],[2558,2558,0],[2559,2560,1],[2561,2562,0],[2563,2619,1],[2620,2620,0],[2621,2624,1],[2625,2626,0],[2627,2630,1],[2631,2632,0],[2633,2634,1],[2635,2637,0],[2638,2640,1],[2641,2641,0],[2642,2671,1],[2672,2673,0],[2674,2676,1],[2677,2677,0],[2678,2688,1],[2689,2690,0],[2691,2747,1],[2748,2748,0],[2749,2752,1],[2753,2757,0],[2758,2758,1],[2759,2760,0],[2761,2764,1],[2765,2765,0],[2766,2785,1],[2786,2787,0],[2788,2809,1],[2810,2815,0],[2816,2816,1],[2817,2817,0],[2818,2875,1],[2876,2876,0],[2877,2877,1],[2878,2879,0],[2880,2880,1],[2881,2884,0],[2885,2892,1],[2893,2893,0],[2894,2900,1],[2901,2903,0],[2904,2913,1],[2914,2915,0],[2916,2945,1],[2946,2946,0],[2947,3005,1],[3006,3006,0],[3007,3007,1],[3008,3008,0],[3009,3020,1],[3021,3021,0],[3022,3030,1],[3031,3031,0],[3032,3071,1],[3072,3072,0],[3073,3075,1],[3076,3076,0],[3077,3131,1],[3132,3132,0],[3133,3133,1],[3134,3136,0],[3137,3141,1],[3142,3144,0],[3145,3145,1],[3146,3149,0],[3150,3156,1],[3157,3158,0],[3159,3169,1],[3170,3171,0],[3172,3200,1],[3201,3201,0],[3202,3259,1],[3260,3260,0],[3261,3262,1],[3263,3264,0],[3265,3265,1],[3266,3266,0],[3267,3269,1],[3270,3272,0],[3273,3273,1],[3274,3277,0],[3278,3284,1],[3285,3286,0],[3287,3297,1],[3298,3299,0],[3300,3327,1],[3328,3329,0],[3330,3386,1],[3387,3388,0],[3389,3389,1],[3390,3390,0],[3391,3392,1],[3393,3396,0],[3397,3404,1],[3405,3406,0],[3407,3414,1],[3415,3415,0],[3416,3425,1],[3426,3427,0],[3428,3456,1],[3457,3457,0],[3458,3529,1],[3530,3530,0],[3531,3534,1],[3535,3535,0],[3536,3537,1],[3538,3540,0],[3541,3541,1],[3542,3542,0],[3543,3550,1],[3551,3551,0],[3552,3632,1],[3633,3633,0],[3634,3635,1],[3636,3642,0],[3643,3654,1],[3655,3662,0],[3663,3760,1],[3761,3761,0],[3762,3763,1],[3764,3772,0],[3773,3783,1],[3784,3790,0],[3791,3863,1],[3864,3865,0],[3866,3892,1],[3893,3893,0],[3894,3894,1],[3895,3895,0],[3896,3896,1],[3897,3897,0],[3898,3952,1],[3953,3966,0],[3967,3967,1],[3968,3972,0],[3973,3973,1],[3974,3975,0],[3976,3980,1],[3981,3991,0],[3992,3992,1],[3993,4028,0],[4029,4037,1],[4038,4038,0],[4039,4140,1],[4141,4144,0],[4145,4145,1],[4146,4151,0],[4152,4152,1],[4153,4154,0],[4155,4156,1],[4157,4158,0],[4159,4183,1],[4184,4185,0],[4186,4189,1],[4190,4192,0],[4193,4208,1],[4209,4212,0],[4213,4225,1],[4226,4226,0],[4227,4228,1],[4229,4230,0],[4231,4236,1],[4237,4237,0],[4238,4252,1],[4253,4253,0],[4254,4351,1],[4352,4447,2],[4448,4607,0],[4608,4956,1],[4957,4959,0],[4960,5905,1],[5906,5908,0],[5909,5937,1],[5938,5939,0],[5940,5969,1],[5970,5971,0],[5972,6001,1],[6002,6003,0],[6004,6051,1],[6052,6052,2],[6053,6067,1],[6068,6069,0],[6070,6070,1],[6071,6077,0],[6078,6085,1],[6086,6086,0],[6087,6088,1],[6089,6099,0],[6100,6103,1],[6104,6104,3],[6105,6108,1],[6109,6109,0],[6110,6154,1],[6155,6159,0],[6160,6276,1],[6277,6278,0],[6279,6312,1],[6313,6313,0],[6314,6431,1],[6432,6434,0],[6435,6438,1],[6439,6440,0],[6441,6449,1],[6450,6450,0],[6451,6456,1],[6457,6459,0],[6460,6678,1],[6679,6680,0],[6681,6682,1],[6683,6683,0],[6684,6741,1],[6742,6742,0],[6743,6743,1],[6744,6750,0],[6751,6751,1],[6752,6752,0],[6753,6753,1],[6754,6754,0],[6755,6756,1],[6757,6764,0],[6765,6770,1],[6771,6780,0],[6781,6782,1],[6783,6783,0],[6784,6831,1],[6832,6862,0],[6863,6911,1],[6912,6915,0],[6916,6963,1],[6964,6973,0],[6974,6977,1],[6978,6979,0],[6980,7018,1],[7019,7027,0],[7028,7039,1],[7040,7041,0],[7042,7073,1],[7074,7077,0],[7078,7079,1],[7080,7081,0],[7082,7082,1],[7083,7085,0],[7086,7141,1],[7142,7142,0],[7143,7143,1],[7144,7145,0],[7146,7148,1],[7149,7149,0],[7150,7150,1],[7151,7153,0],[7154,7211,1],[7212,7219,0],[7220,7221,1],[7222,7223,0],[7224,7375,1],[7376,7378,0],[7379,7379,1],[7380,7392,0],[7393,7393,1],[7394,7400,0],[7401,7404,1],[7405,7405,0],[7406,7411,1],[7412,7412,0],[7413,7415,1],[7416,7417,0],[7418,7615,1],[7616,7679,0],[7680,8202,1],[8203,8207,0],[8208,8233,1],[8234,8238,0],[8239,8287,1],[8288,8303,0],[8304,8399,1],[8400,8432,0],[8433,8985,1],[8986,8987,2],[8988,9e3,1],[9001,9002,2],[9003,9192,1],[9193,9196,2],[9197,9199,1],[9200,9200,2],[9201,9202,1],[9203,9203,2],[9204,9724,1],[9725,9726,2],[9727,9747,1],[9748,9749,2],[9750,9799,1],[9800,9811,2],[9812,9854,1],[9855,9855,2],[9856,9874,1],[9875,9875,2],[9876,9888,1],[9889,9889,2],[9890,9897,1],[9898,9899,2],[9900,9916,1],[9917,9918,2],[9919,9923,1],[9924,9925,2],[9926,9933,1],[9934,9934,2],[9935,9939,1],[9940,9940,2],[9941,9961,1],[9962,9962,2],[9963,9969,1],[9970,9971,2],[9972,9972,1],[9973,9973,2],[9974,9977,1],[9978,9978,2],[9979,9980,1],[9981,9981,2],[9982,9988,1],[9989,9989,2],[9990,9993,1],[9994,9995,2],[9996,10023,1],[10024,10024,2],[10025,10059,1],[10060,10060,2],[10061,10061,1],[10062,10062,2],[10063,10066,1],[10067,10069,2],[10070,10070,1],[10071,10071,2],[10072,10132,1],[10133,10135,2],[10136,10159,1],[10160,10160,2],[10161,10174,1],[10175,10175,2],[10176,11034,1],[11035,11036,2],[11037,11087,1],[11088,11088,2],[11089,11092,1],[11093,11093,2],[11094,11502,1],[11503,11505,0],[11506,11743,1],[11744,11775,0],[11776,11903,1],[11904,11929,2],[11930,11930,1],[11931,12019,2],[12020,12031,1],[12032,12245,2],[12246,12271,1],[12272,12329,2],[12330,12335,0],[12336,12350,2],[12351,12352,1],[12353,12438,2],[12439,12440,1],[12441,12442,0],[12443,12543,2],[12544,12548,1],[12549,12591,2],[12592,12592,1],[12593,12643,2],[12644,12644,0],[12645,12686,2],[12687,12687,1],[12688,12771,2],[12772,12782,1],[12783,12830,2],[12831,12831,1],[12832,12871,2],[12872,12879,1],[12880,19903,2],[19904,19967,1],[19968,42124,2],[42125,42127,1],[42128,42182,2],[42183,42606,1],[42607,42610,0],[42611,42611,1],[42612,42621,0],[42622,42653,1],[42654,42655,0],[42656,42735,1],[42736,42737,0],[42738,43009,1],[43010,43010,0],[43011,43013,1],[43014,43014,0],[43015,43018,1],[43019,43019,0],[43020,43044,1],[43045,43046,0],[43047,43051,1],[43052,43052,0],[43053,43203,1],[43204,43205,0],[43206,43231,1],[43232,43249,0],[43250,43257,1],[43258,43258,0],[43259,43262,1],[43263,43263,0],[43264,43301,1],[43302,43309,0],[43310,43334,1],[43335,43345,0],[43346,43359,1],[43360,43388,2],[43389,43391,1],[43392,43394,0],[43395,43442,1],[43443,43443,0],[43444,43445,1],[43446,43449,0],[43450,43451,1],[43452,43453,0],[43454,43492,1],[43493,43493,0],[43494,43560,1],[43561,43566,0],[43567,43568,1],[43569,43570,0],[43571,43572,1],[43573,43574,0],[43575,43586,1],[43587,43587,0],[43588,43595,1],[43596,43596,0],[43597,43643,1],[43644,43644,0],[43645,43695,1],[43696,43696,0],[43697,43697,1],[43698,43700,0],[43701,43702,1],[43703,43704,0],[43705,43709,1],[43710,43711,0],[43712,43712,1],[43713,43713,0],[43714,43755,1],[43756,43757,0],[43758,43765,1],[43766,43766,0],[43767,44004,1],[44005,44005,0],[44006,44007,1],[44008,44008,0],[44009,44012,1],[44013,44013,0],[44014,44031,1],[44032,55203,2],[55204,55215,1],[55216,55238,0],[55239,55242,1],[55243,55291,0],[55292,63743,1],[63744,64255,2],[64256,64285,1],[64286,64286,0],[64287,65023,1],[65024,65039,0],[65040,65049,2],[65050,65055,1],[65056,65071,0],[65072,65106,2],[65107,65107,1],[65108,65126,2],[65127,65127,1],[65128,65131,2],[65132,65278,1],[65279,65279,0],[65280,65280,1],[65281,65376,2],[65377,65437,1],[65438,65440,0],[65441,65503,1],[65504,65510,2],[65511,65519,1],[65520,65528,0],[65529,66044,1],[66045,66045,0],[66046,66271,1],[66272,66272,0],[66273,66421,1],[66422,66426,0],[66427,68096,1],[68097,68099,0],[68100,68100,1],[68101,68102,0],[68103,68107,1],[68108,68111,0],[68112,68151,1],[68152,68154,0],[68155,68158,1],[68159,68159,0],[68160,68324,1],[68325,68326,0],[68327,68899,1],[68900,68903,0],[68904,69290,1],[69291,69292,0],[69293,69372,1],[69373,69375,0],[69376,69445,1],[69446,69456,0],[69457,69505,1],[69506,69509,0],[69510,69632,1],[69633,69633,0],[69634,69687,1],[69688,69702,0],[69703,69743,1],[69744,69744,0],[69745,69746,1],[69747,69748,0],[69749,69758,1],[69759,69761,0],[69762,69810,1],[69811,69814,0],[69815,69816,1],[69817,69818,0],[69819,69825,1],[69826,69826,0],[69827,69887,1],[69888,69890,0],[69891,69926,1],[69927,69931,0],[69932,69932,1],[69933,69940,0],[69941,70002,1],[70003,70003,0],[70004,70015,1],[70016,70017,0],[70018,70069,1],[70070,70078,0],[70079,70081,1],[70082,70083,0],[70084,70088,1],[70089,70092,0],[70093,70094,1],[70095,70095,0],[70096,70190,1],[70191,70193,0],[70194,70195,1],[70196,70196,0],[70197,70197,1],[70198,70199,0],[70200,70205,1],[70206,70206,0],[70207,70208,1],[70209,70209,0],[70210,70366,1],[70367,70367,0],[70368,70370,1],[70371,70378,0],[70379,70399,1],[70400,70401,0],[70402,70458,1],[70459,70460,0],[70461,70461,1],[70462,70462,0],[70463,70463,1],[70464,70464,0],[70465,70486,1],[70487,70487,0],[70488,70501,1],[70502,70508,0],[70509,70511,1],[70512,70516,0],[70517,70711,1],[70712,70719,0],[70720,70721,1],[70722,70724,0],[70725,70725,1],[70726,70726,0],[70727,70749,1],[70750,70750,0],[70751,70831,1],[70832,70832,0],[70833,70834,1],[70835,70840,0],[70841,70841,1],[70842,70842,0],[70843,70844,1],[70845,70845,0],[70846,70846,1],[70847,70848,0],[70849,70849,1],[70850,70851,0],[70852,71086,1],[71087,71087,0],[71088,71089,1],[71090,71093,0],[71094,71099,1],[71100,71101,0],[71102,71102,1],[71103,71104,0],[71105,71131,1],[71132,71133,0],[71134,71218,1],[71219,71226,0],[71227,71228,1],[71229,71229,0],[71230,71230,1],[71231,71232,0],[71233,71338,1],[71339,71339,0],[71340,71340,1],[71341,71341,0],[71342,71343,1],[71344,71349,0],[71350,71350,1],[71351,71351,0],[71352,71452,1],[71453,71455,0],[71456,71457,1],[71458,71461,0],[71462,71462,1],[71463,71467,0],[71468,71726,1],[71727,71735,0],[71736,71736,1],[71737,71738,0],[71739,71983,1],[71984,71984,0],[71985,71994,1],[71995,71996,0],[71997,71997,1],[71998,71999,0],[72e3,72e3,1],[72001,72001,0],[72002,72002,1],[72003,72003,0],[72004,72147,1],[72148,72151,0],[72152,72153,1],[72154,72155,0],[72156,72159,1],[72160,72160,0],[72161,72192,1],[72193,72202,0],[72203,72242,1],[72243,72248,0],[72249,72249,1],[72250,72254,0],[72255,72262,1],[72263,72263,0],[72264,72272,1],[72273,72278,0],[72279,72280,1],[72281,72283,0],[72284,72323,1],[72324,72342,0],[72343,72343,1],[72344,72345,0],[72346,72751,1],[72752,72758,0],[72759,72759,1],[72760,72765,0],[72766,72766,1],[72767,72767,0],[72768,72849,1],[72850,72871,0],[72872,72873,1],[72874,72880,0],[72881,72881,1],[72882,72883,0],[72884,72884,1],[72885,72886,0],[72887,73008,1],[73009,73014,0],[73015,73017,1],[73018,73018,0],[73019,73019,1],[73020,73021,0],[73022,73022,1],[73023,73031,0],[73032,73103,1],[73104,73105,0],[73106,73108,1],[73109,73109,0],[73110,73110,1],[73111,73111,0],[73112,73458,1],[73459,73460,0],[73461,73471,1],[73472,73474,0],[73475,73525,1],[73526,73530,0],[73531,73535,1],[73536,73536,0],[73537,73537,1],[73538,73538,0],[73539,78911,1],[78912,78912,0],[78913,78918,1],[78919,78933,0],[78934,92911,1],[92912,92916,0],[92917,92975,1],[92976,92982,0],[92983,94030,1],[94031,94031,0],[94032,94094,1],[94095,94098,0],[94099,94175,1],[94176,94179,2],[94180,94180,0],[94181,94191,1],[94192,94193,2],[94194,94207,1],[94208,100343,2],[100344,100351,1],[100352,101589,2],[101590,101631,1],[101632,101640,2],[101641,110575,1],[110576,110579,2],[110580,110580,1],[110581,110587,2],[110588,110588,1],[110589,110590,2],[110591,110591,1],[110592,110882,2],[110883,110897,1],[110898,110898,2],[110899,110927,1],[110928,110930,2],[110931,110932,1],[110933,110933,2],[110934,110947,1],[110948,110951,2],[110952,110959,1],[110960,111355,2],[111356,113820,1],[113821,113822,0],[113823,113823,1],[113824,113827,0],[113828,118527,1],[118528,118573,0],[118574,118575,1],[118576,118598,0],[118599,119140,1],[119141,119141,0],[119142,119142,1],[119143,119145,0],[119146,119149,1],[119150,119170,0],[119171,119172,1],[119173,119179,0],[119180,119209,1],[119210,119213,0],[119214,119361,1],[119362,119364,0],[119365,121343,1],[121344,121398,0],[121399,121402,1],[121403,121452,0],[121453,121460,1],[121461,121461,0],[121462,121475,1],[121476,121476,0],[121477,121498,1],[121499,121503,0],[121504,121504,1],[121505,121519,0],[121520,122879,1],[122880,122886,0],[122887,122887,1],[122888,122904,0],[122905,122906,1],[122907,122913,0],[122914,122914,1],[122915,122916,0],[122917,122917,1],[122918,122922,0],[122923,123022,1],[123023,123023,0],[123024,123183,1],[123184,123190,0],[123191,123565,1],[123566,123566,0],[123567,123627,1],[123628,123631,0],[123632,124139,1],[124140,124143,0],[124144,125135,1],[125136,125142,0],[125143,125251,1],[125252,125258,0],[125259,126979,1],[126980,126980,2],[126981,127182,1],[127183,127183,2],[127184,127373,1],[127374,127374,2],[127375,127376,1],[127377,127386,2],[127387,127487,1],[127488,127490,2],[127491,127503,1],[127504,127547,2],[127548,127551,1],[127552,127560,2],[127561,127567,1],[127568,127569,2],[127570,127583,1],[127584,127589,2],[127590,127743,1],[127744,127776,2],[127777,127788,1],[127789,127797,2],[127798,127798,1],[127799,127868,2],[127869,127869,1],[127870,127891,2],[127892,127903,1],[127904,127946,2],[127947,127950,1],[127951,127955,2],[127956,127967,1],[127968,127984,2],[127985,127987,1],[127988,127988,2],[127989,127991,1],[127992,128062,2],[128063,128063,1],[128064,128064,2],[128065,128065,1],[128066,128252,2],[128253,128254,1],[128255,128317,2],[128318,128330,1],[128331,128334,2],[128335,128335,1],[128336,128359,2],[128360,128377,1],[128378,128378,2],[128379,128404,1],[128405,128406,2],[128407,128419,1],[128420,128420,2],[128421,128506,1],[128507,128591,2],[128592,128639,1],[128640,128709,2],[128710,128715,1],[128716,128716,2],[128717,128719,1],[128720,128722,2],[128723,128724,1],[128725,128727,2],[128728,128731,1],[128732,128735,2],[128736,128746,1],[128747,128748,2],[128749,128755,1],[128756,128764,2],[128765,128991,1],[128992,129003,2],[129004,129007,1],[129008,129008,2],[129009,129291,1],[129292,129338,2],[129339,129339,1],[129340,129349,2],[129350,129350,1],[129351,129535,2],[129536,129647,1],[129648,129660,2],[129661,129663,1],[129664,129672,2],[129673,129679,1],[129680,129725,2],[129726,129726,1],[129727,129733,2],[129734,129741,1],[129742,129755,2],[129756,129759,1],[129760,129768,2],[129769,129775,1],[129776,129784,2],[129785,131071,1],[131072,196605,2],[196606,196607,1],[196608,262141,2],[262142,917503,1],[917504,921599,0],[921600,1114111,1]];var segmenter3=new Intl.Segmenter("en",{granularity:"grapheme"}),VS16=65039,isRegionalIndicator=cp=>cp>=127462&&cp<=127487;function codePointWidth(cp){let lo=0,hi=WIDTHS.length-1;for(;lo<=hi;){let mid=lo+hi>>1,run=WIDTHS[mid];if(cp<run[0])hi=mid-1;else if(cp>run[1])lo=mid+1;else return run[2]}return 1}function clusterWidth(cluster){let w=0,vs16=!1,regional=0;for(let ch of cluster){let cp=ch.codePointAt(0);cp===VS16&&(vs16=!0),isRegionalIndicator(cp)&®ional++;let cw=codePointWidth(cp);cw>w&&(w=cw)}return vs16||regional>=2?2:w}function*measured(s){for(let{segment:segment2}of segmenter3.segment(s))yield[segment2,clusterWidth(segment2)]}function stringWidth(s){let w=0;for(let{segment:segment2}of segmenter3.segment(s))w+=clusterWidth(segment2);return w}var WRAP_WIDTH=24,MAX_LINES=4,MAX_LABEL=28,LABEL_BREAK_CHARS=["_","-",".","/"],asciiLower=s=>s.replace(/[A-Z]/g,c2=>c2.toLowerCase()),asciiUpper=s=>s.replace(/[a-z]/g,c2=>c2.toUpperCase()),CONTROLS=/[\0-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g,stripControls=src=>src.replace(CONTROLS,"");function srcLines(src){let out=src.split(`
|
|
1334
|
+
`),await new Promise(resolve17=>{let child=spawn8(editor,[...editorArgs,filePath],{stdio:"inherit",shell:process.platform==="win32"});child.on("error",()=>resolve17(null)),child.on("close",code=>resolve17(code))})!==0?{status:"failed"}:{status:"complete",content:stripBom(readFileSync21(filePath,"utf-8")).replace(/\n$/,"")}}finally{try{rmSync4(directory,{recursive:!0,force:!0})}catch{}}}var ExtensionEditorComponent=class extends Container{editor;onSubmitCallback;onCancelCallback;tui;keybindings;externalEditorCommand;_focused=!1;get focused(){return this._focused}set focused(value2){this._focused=value2,this.editor.focused=value2}constructor(tui,keybindings,title,prefill,onSubmit,onCancel,options,externalEditorCommand){super(),this.tui=tui,this.keybindings=keybindings,this.externalEditorCommand=externalEditorCommand||process.env.VISUAL||process.env.EDITOR||(process.platform==="win32"?"notepad":"nano"),this.onSubmitCallback=onSubmit,this.onCancelCallback=onCancel,this.addChild(new DynamicBorder),this.addChild(new Spacer(1)),this.addChild(new Text(theme.fg("accent",title),1,0)),this.addChild(new Spacer(1)),this.editor=new Editor(tui,getEditorTheme(),options),prefill&&this.editor.setText(prefill),this.editor.onSubmit=text=>{this.onSubmitCallback(text)},this.addChild(this.editor),this.addChild(new Spacer(1));let hint=keyHint("tui.select.confirm","submit")+" "+keyHint("tui.input.newLine","newline")+" "+keyHint("tui.select.cancel","cancel")+` ${keyHint("app.editor.external","external editor")}`;this.addChild(new Text(hint,1,0)),this.addChild(new Spacer(1)),this.addChild(new DynamicBorder)}handleInput(keyData){if(getKeybindings().matches(keyData,"tui.select.cancel")){this.onCancelCallback();return}if(this.keybindings.matches(keyData,"app.editor.external")){this.handleOpenExternalEditor();return}this.editor.handleInput(keyData)}async handleOpenExternalEditor(){let content=this.editor.getText();this.tui.stop();try{let result=await editInExternalEditor({command:this.externalEditorCommand,content});result.status==="complete"&&this.editor.setText(result.content)}finally{this.tui.start(),this.tui.requestRender(!0)}}};import{isAbsolute as isAbsolute4,relative as relative5,resolve as resolve13,sep as sep9}from"node:path";function sanitizeStatusText(text){return text.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()}function formatTokens(count){return count<1e3?count.toString():count<1e4?`${(count/1e3).toFixed(1)}k`:count<1e6?`${Math.round(count/1e3)}k`:count<1e7?`${(count/1e6).toFixed(1)}M`:`${Math.round(count/1e6)}M`}function formatCwdForFooter(cwd,home){if(!home)return cwd;let resolvedCwd=resolve13(cwd),resolvedHome=resolve13(home),relativeToHome=relative5(resolvedHome,resolvedCwd);return relativeToHome===""||relativeToHome!==".."&&!relativeToHome.startsWith(`..${sep9}`)&&!isAbsolute4(relativeToHome)?relativeToHome===""?"~":`~${sep9}${relativeToHome}`:cwd}var FooterComponent=class{autoCompactEnabled=!0;session;footerData;compactionQueueCount=0;diffStatCache=new Map;cachedPrefix;constructor(session,footerData){this.session=session,this.footerData=footerData}setSession(session){this.session=session}setAutoCompactEnabled(enabled){this.autoCompactEnabled=enabled}setCompactionQueueCount(count){this.compactionQueueCount=count}invalidate(){}dispose(){}getToolDiffStat(message){let details=message.details;if(typeof details?.added=="number"&&typeof details.removed=="number")return{added:details.added,removed:details.removed};if(typeof details?.diff!="string"||details.diff==="")return;let cached=this.diffStatCache.get(message.toolCallId);if(cached)return cached;let stat3=countDiffStat(details.diff);return this.diffStatCache.set(message.toolCallId,stat3),stat3}aggregateEntry(entry,usage,diff){let message=entry.message;if(entry.type==="message"&&message?.role==="assistant"){let msgUsage=message.usage;addUsageToTotals(usage,msgUsage);let latestPromptTokens=msgUsage.input+msgUsage.cacheRead+msgUsage.cacheWrite;return latestPromptTokens>0?msgUsage.cacheRead/latestPromptTokens*100:void 0}if(entry.type==="message"&&message?.role==="toolResult"){message.usage&&addUsageToTotals(usage,message.usage);let stat3=this.getToolDiffStat({toolCallId:message.toolCallId??"",details:message.details});stat3&&(diff.added+=stat3.added,diff.removed+=stat3.removed)}(entry.type==="branch_summary"||entry.type==="compaction")&&entry.usage&&addUsageToTotals(usage,entry.usage)}computeSessionStats(){let entries=this.session.sessionManager.getEntries(),prefixCount=Math.max(0,entries.length-1);if(!this.cachedPrefix||this.cachedPrefix.entryCount!==prefixCount||entries[0]!==this.cachedPrefix.firstEntry){let usage=createUsageTotals(),diff={added:0,removed:0},cacheHitRate;for(let i=0;i<prefixCount;i++){let hitRate=this.aggregateEntry(entries[i],usage,diff);hitRate!==void 0&&(cacheHitRate=hitRate)}this.cachedPrefix={entryCount:prefixCount,firstEntry:entries[0],usage,diff,cacheHitRate}}let usageTotals={...this.cachedPrefix.usage},sessionDiff={...this.cachedPrefix.diff},latestCacheHitRate=this.cachedPrefix.cacheHitRate;if(entries.length>0){let hitRate=this.aggregateEntry(entries[entries.length-1],usageTotals,sessionDiff);hitRate!==void 0&&(latestCacheHitRate=hitRate)}return{usageTotals,sessionDiff,latestCacheHitRate}}joinGroups(groups){return groups.filter(group=>group.length>0).join(theme.fg("dim"," | "))}alignLeftRight(left,right,width){let rightWidth=visibleWidth(right);if(visibleWidth(left)+rightWidth<=width)return left+" ".repeat(width-visibleWidth(left)-rightWidth)+right;if(rightWidth>=width)return truncateToWidth(right,width,"...");let truncatedLeft=truncateToWidth(left,width-rightWidth,"..."),padding=" ".repeat(Math.max(0,width-visibleWidth(truncatedLeft)-rightWidth));return truncatedLeft+padding+right}render(width){let state2=this.session.state,{usageTotals,sessionDiff,latestCacheHitRate}=this.computeSessionStats(),contextUsage=this.session.getContextUsage(),contextWindow=contextUsage?.contextWindow??state2.model?.contextWindow??0,contextPercentValue=contextUsage?.percent??0,contextPercent=contextUsage?.percent!==null?contextPercentValue.toFixed(1):"?",cwd=formatCwdForFooter(this.session.sessionManager.getCwd(),process.env.HOME||process.env.USERPROFILE),gitStatus=this.footerData.getGitStatus(),branch=this.footerData.getGitBranch(),repoName=this.footerData.getGitRepoName(),idParts=[theme.fg("dim",cwd)];if(repoName&&idParts.push(repoName),branch){let dirty=gitStatus&&(gitStatus.staged>0||gitStatus.modified>0||gitStatus.untracked>0)?"*":"";idParts.push(theme.fg("accent",`${branch}${dirty}`))}let sessionName2=this.session.sessionManager.getSessionName();sessionName2&&idParts.push(sessionName2);let idLine=this.joinGroups(idParts),modelName=state2.model?.id||"no-model",providerName=state2.model?this.session.modelRuntime.getProvider(state2.model.provider)?.name??state2.model.provider:void 0,modelParts=[];if(providerName&&modelParts.push(theme.fg("dim",`(${providerName})`)),modelParts.push(theme.fg("accent",modelName)),state2.model?.reasoning){let thinkingLevel=state2.thinkingLevel||"off";modelParts.push(theme.fg("dim",thinkingLevel==="off"?"no thinking":thinkingLevel))}let modelLine=`${theme.fg("dim","|")} ${modelParts.join(theme.fg("dim"," + "))}`,statGroups=[],queueCount=this.session.pendingMessageCount+this.compactionQueueCount;if(queueCount>0&&statGroups.push(`${theme.fg("dim","queue")} ${theme.fg("accent",String(queueCount))}`),sessionDiff.added>0||sessionDiff.removed>0){let diffParts=[];sessionDiff.added>0&&diffParts.push(theme.fg("toolDiffAdded",`+${formatTokens(sessionDiff.added)}`)),sessionDiff.removed>0&&diffParts.push(theme.fg("toolDiffRemoved",`-${formatTokens(sessionDiff.removed)}`)),statGroups.push(`${theme.fg("dim","diff")} ${diffParts.join(" ")}`)}if(gitStatus){let gitParts=[];gitStatus.staged>0&&gitParts.push(theme.fg("toolDiffAdded",`+${gitStatus.staged}`)),gitStatus.modified>0&&gitParts.push(theme.fg("warning",`~${gitStatus.modified}`)),gitStatus.untracked>0&&gitParts.push(theme.fg("dim",`?${gitStatus.untracked}`)),gitStatus.ahead&&gitParts.push(theme.fg("accent",`\u2191${gitStatus.ahead}`)),gitStatus.behind&&gitParts.push(theme.fg("accent",`\u2193${gitStatus.behind}`)),gitParts.length>0&&statGroups.push(`${theme.fg("dim","git")} ${gitParts.join(" ")}`)}let tokenParts=[];usageTotals.input&&tokenParts.push(`${theme.fg("dim","in")} ${formatTokens(usageTotals.input)}`),usageTotals.output&&tokenParts.push(`${theme.fg("dim","out")} ${formatTokens(usageTotals.output)}`),usageTotals.cacheRead&&tokenParts.push(`${theme.fg("dim","rd")} ${formatTokens(usageTotals.cacheRead)}`),usageTotals.cacheWrite&&tokenParts.push(`${theme.fg("dim","wr")} ${formatTokens(usageTotals.cacheWrite)}`),(usageTotals.cacheRead>0||usageTotals.cacheWrite>0)&&latestCacheHitRate!==void 0&&tokenParts.push(`${theme.fg("dim","hit")} ${latestCacheHitRate.toFixed(1)}%`);let usingSubscription=state2.model?state2.model.provider==="kimi-coding"||this.session.modelRuntime.isUsingSubscription(state2.model.provider):!1,pricedModel=state2.model&&Object.values(state2.model.cost??{}).some(rate=>rate>0);(usageTotals.cost||usingSubscription||pricedModel)&&tokenParts.push(`$${usageTotals.cost.toFixed(3)}${usingSubscription?" (sub)":""}`),tokenParts.length>0&&statGroups.push(tokenParts.join(theme.fg("dim"," \xB7 ")));let statsLine=this.joinGroups(statGroups),autoTag=this.autoCompactEnabled?" auto":"",barCells=10,filled=Math.max(0,Math.min(barCells,Math.round(contextPercentValue/100*barCells))),bar="\u2588".repeat(filled)+"\u2591".repeat(barCells-filled),meterColor=contextPercentValue>90?"error":contextPercentValue>70?"warning":"accent",contextValue=contextPercent==="?"?`${theme.fg("dim","?")}/${formatTokens(contextWindow)}`:`${theme.fg(meterColor,bar)} ${theme.fg("dim",`${contextPercent}%${autoTag}`)}`,contextLine=`${theme.fg("dim","|")} ${theme.fg("dim","ctx")} ${contextValue}`,lines=[this.alignLeftRight(idLine,modelLine,width),"",this.alignLeftRight(statsLine,contextLine,width)],extensionStatuses=this.footerData.getExtensionStatuses();if(extensionStatuses.size>0){let statusLine=Array.from(extensionStatuses.entries()).sort(([a],[b2])=>a.localeCompare(b2)).map(([,text])=>sanitizeStatusText(text)).join(" ");lines.push(truncateToWidth(statusLine,width,theme.fg("dim","...")))}return lines}};import{spawn as spawn9}from"node:child_process";function openBrowser(target){let[cmd,args]=process.platform==="darwin"?["open",[target]]:process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",target]]:["xdg-open",[target]];spawn9(cmd,args,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}var LoginDialogComponent=class extends Container{contentContainer;input;tui;abortController=new AbortController;inputResolver;inputRejecter;onComplete;_focused=!1;get focused(){return this._focused}set focused(value2){this._focused=value2,this.input.focused=value2}constructor(tui,providerId,onComplete,providerNameOverride,titleOverride){super(),this.tui=tui,this.onComplete=onComplete;let title=titleOverride??`Login to ${providerNameOverride||providerId}`;this.addChild(new DynamicBorder),this.addChild(new Text(theme.fg("accent",theme.bold(title)),1,0)),this.contentContainer=new Container,this.addChild(this.contentContainer),this.input=new Input,this.input.onSubmit=()=>{if(this.inputResolver){let value2=this.input.getValue();this.replaceInputWithSubmittedText(value2),this.inputResolver(value2),this.inputResolver=void 0,this.inputRejecter=void 0}},this.input.onEscape=()=>{this.cancel()},this.addChild(new DynamicBorder)}get signal(){return this.abortController.signal}replaceInputWithSubmittedText(value2){this.contentContainer.children=this.contentContainer.children.map(child=>child===this.input?new Text(`> ${value2}`,0,0):child)}cancel(){this.abortController.abort(),this.inputRejecter&&(this.inputRejecter(new Error("Login cancelled")),this.inputResolver=void 0,this.inputRejecter=void 0),this.onComplete(!1,"Login cancelled")}showAuth(url,instructions){this.contentContainer.clear(),this.contentContainer.addChild(new Spacer(1));let linkedUrl=`\x1B]8;;${url}\x07${url}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("accent",linkedUrl),1,0));let clickHint=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",hyperlink2=`\x1B]8;;${url}\x07${clickHint}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("dim",hyperlink2),1,0)),instructions&&(this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("warning",instructions),1,0))),openBrowser(url),this.tui.requestRender()}showDeviceCode(info){this.contentContainer.clear(),this.contentContainer.addChild(new Spacer(1));let linkedUrl=`\x1B]8;;${info.verificationUri}\x07${info.verificationUri}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("accent",linkedUrl),1,0));let clickHint=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",hyperlink2=`\x1B]8;;${info.verificationUri}\x07${clickHint}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("dim",hyperlink2),1,0)),this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("warning",`Enter code: ${info.userCode}`),1,0)),this.tui.requestRender()}showManualInput(prompt){return this.input.setValue(""),this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("dim",prompt),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender(),new Promise((resolve17,reject)=>{this.inputResolver=resolve17,this.inputRejecter=reject})}showPrompt(message,placeholder){return this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("text",message),1,0)),placeholder&&this.contentContainer.addChild(new Text(theme.fg("dim",`e.g., ${placeholder}`),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to cancel,")} ${keyHint("tui.select.confirm","to submit")})`,1,0)),this.input.setValue(""),this.tui.requestRender(),new Promise((resolve17,reject)=>{this.inputResolver=resolve17,this.inputRejecter=reject})}showDetails(lines){this.contentContainer.clear(),this.contentContainer.addChild(new Spacer(1));for(let line of lines)this.contentContainer.addChild(new Text(line,1,0));this.tui.requestRender()}showInfo(message,links=[],showCloseHint=!1){this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("text",message),1,0));for(let link of links){let text=link.label?`${link.label}: ${link.url}`:link.url,hyperlink2=`\x1B]8;;${link.url}\x07${text}\x1B]8;;\x07`;this.contentContainer.addChild(new Text(theme.fg("accent",hyperlink2),1,0))}showCloseHint&&(this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to close")})`,1,0))),this.tui.requestRender()}showWaiting(message){this.contentContainer.addChild(new Spacer(1)),this.contentContainer.addChild(new Text(theme.fg("dim",message),1,0)),this.contentContainer.addChild(new Text(`(${keyHint("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender()}showProgress(message){this.contentContainer.addChild(new Text(theme.fg("dim",message),1,0)),this.tui.requestRender()}handleInput(data){if(getKeybindings().matches(data,"tui.select.cancel")){this.cancel();return}this.input.handleInput(data)}};var WIDTHS=[[0,172,1],[173,173,0],[174,767,1],[768,879,0],[880,1154,1],[1155,1161,0],[1162,1424,1],[1425,1469,0],[1470,1470,1],[1471,1471,0],[1472,1472,1],[1473,1474,0],[1475,1475,1],[1476,1477,0],[1478,1478,1],[1479,1479,0],[1480,1540,1],[1541,1541,0],[1542,1551,1],[1552,1562,0],[1563,1563,1],[1564,1564,0],[1565,1610,1],[1611,1631,0],[1632,1647,1],[1648,1648,0],[1649,1749,1],[1750,1756,0],[1757,1758,1],[1759,1764,0],[1765,1766,1],[1767,1768,0],[1769,1769,1],[1770,1773,0],[1774,1806,1],[1807,1807,0],[1808,1808,1],[1809,1809,0],[1810,1839,1],[1840,1866,0],[1867,1957,1],[1958,1968,0],[1969,2026,1],[2027,2035,0],[2036,2044,1],[2045,2045,0],[2046,2069,1],[2070,2073,0],[2074,2074,1],[2075,2083,0],[2084,2084,1],[2085,2087,0],[2088,2088,1],[2089,2093,0],[2094,2136,1],[2137,2139,0],[2140,2191,1],[2192,2193,0],[2194,2199,1],[2200,2207,0],[2208,2249,1],[2250,2306,0],[2307,2361,1],[2362,2362,0],[2363,2363,1],[2364,2364,0],[2365,2368,1],[2369,2376,0],[2377,2380,1],[2381,2381,0],[2382,2384,1],[2385,2391,0],[2392,2401,1],[2402,2403,0],[2404,2432,1],[2433,2433,0],[2434,2491,1],[2492,2492,0],[2493,2493,1],[2494,2494,0],[2495,2496,1],[2497,2500,0],[2501,2508,1],[2509,2509,0],[2510,2518,1],[2519,2519,0],[2520,2529,1],[2530,2531,0],[2532,2557,1],[2558,2558,0],[2559,2560,1],[2561,2562,0],[2563,2619,1],[2620,2620,0],[2621,2624,1],[2625,2626,0],[2627,2630,1],[2631,2632,0],[2633,2634,1],[2635,2637,0],[2638,2640,1],[2641,2641,0],[2642,2671,1],[2672,2673,0],[2674,2676,1],[2677,2677,0],[2678,2688,1],[2689,2690,0],[2691,2747,1],[2748,2748,0],[2749,2752,1],[2753,2757,0],[2758,2758,1],[2759,2760,0],[2761,2764,1],[2765,2765,0],[2766,2785,1],[2786,2787,0],[2788,2809,1],[2810,2815,0],[2816,2816,1],[2817,2817,0],[2818,2875,1],[2876,2876,0],[2877,2877,1],[2878,2879,0],[2880,2880,1],[2881,2884,0],[2885,2892,1],[2893,2893,0],[2894,2900,1],[2901,2903,0],[2904,2913,1],[2914,2915,0],[2916,2945,1],[2946,2946,0],[2947,3005,1],[3006,3006,0],[3007,3007,1],[3008,3008,0],[3009,3020,1],[3021,3021,0],[3022,3030,1],[3031,3031,0],[3032,3071,1],[3072,3072,0],[3073,3075,1],[3076,3076,0],[3077,3131,1],[3132,3132,0],[3133,3133,1],[3134,3136,0],[3137,3141,1],[3142,3144,0],[3145,3145,1],[3146,3149,0],[3150,3156,1],[3157,3158,0],[3159,3169,1],[3170,3171,0],[3172,3200,1],[3201,3201,0],[3202,3259,1],[3260,3260,0],[3261,3262,1],[3263,3264,0],[3265,3265,1],[3266,3266,0],[3267,3269,1],[3270,3272,0],[3273,3273,1],[3274,3277,0],[3278,3284,1],[3285,3286,0],[3287,3297,1],[3298,3299,0],[3300,3327,1],[3328,3329,0],[3330,3386,1],[3387,3388,0],[3389,3389,1],[3390,3390,0],[3391,3392,1],[3393,3396,0],[3397,3404,1],[3405,3406,0],[3407,3414,1],[3415,3415,0],[3416,3425,1],[3426,3427,0],[3428,3456,1],[3457,3457,0],[3458,3529,1],[3530,3530,0],[3531,3534,1],[3535,3535,0],[3536,3537,1],[3538,3540,0],[3541,3541,1],[3542,3542,0],[3543,3550,1],[3551,3551,0],[3552,3632,1],[3633,3633,0],[3634,3635,1],[3636,3642,0],[3643,3654,1],[3655,3662,0],[3663,3760,1],[3761,3761,0],[3762,3763,1],[3764,3772,0],[3773,3783,1],[3784,3790,0],[3791,3863,1],[3864,3865,0],[3866,3892,1],[3893,3893,0],[3894,3894,1],[3895,3895,0],[3896,3896,1],[3897,3897,0],[3898,3952,1],[3953,3966,0],[3967,3967,1],[3968,3972,0],[3973,3973,1],[3974,3975,0],[3976,3980,1],[3981,3991,0],[3992,3992,1],[3993,4028,0],[4029,4037,1],[4038,4038,0],[4039,4140,1],[4141,4144,0],[4145,4145,1],[4146,4151,0],[4152,4152,1],[4153,4154,0],[4155,4156,1],[4157,4158,0],[4159,4183,1],[4184,4185,0],[4186,4189,1],[4190,4192,0],[4193,4208,1],[4209,4212,0],[4213,4225,1],[4226,4226,0],[4227,4228,1],[4229,4230,0],[4231,4236,1],[4237,4237,0],[4238,4252,1],[4253,4253,0],[4254,4351,1],[4352,4447,2],[4448,4607,0],[4608,4956,1],[4957,4959,0],[4960,5905,1],[5906,5908,0],[5909,5937,1],[5938,5939,0],[5940,5969,1],[5970,5971,0],[5972,6001,1],[6002,6003,0],[6004,6051,1],[6052,6052,2],[6053,6067,1],[6068,6069,0],[6070,6070,1],[6071,6077,0],[6078,6085,1],[6086,6086,0],[6087,6088,1],[6089,6099,0],[6100,6103,1],[6104,6104,3],[6105,6108,1],[6109,6109,0],[6110,6154,1],[6155,6159,0],[6160,6276,1],[6277,6278,0],[6279,6312,1],[6313,6313,0],[6314,6431,1],[6432,6434,0],[6435,6438,1],[6439,6440,0],[6441,6449,1],[6450,6450,0],[6451,6456,1],[6457,6459,0],[6460,6678,1],[6679,6680,0],[6681,6682,1],[6683,6683,0],[6684,6741,1],[6742,6742,0],[6743,6743,1],[6744,6750,0],[6751,6751,1],[6752,6752,0],[6753,6753,1],[6754,6754,0],[6755,6756,1],[6757,6764,0],[6765,6770,1],[6771,6780,0],[6781,6782,1],[6783,6783,0],[6784,6831,1],[6832,6862,0],[6863,6911,1],[6912,6915,0],[6916,6963,1],[6964,6973,0],[6974,6977,1],[6978,6979,0],[6980,7018,1],[7019,7027,0],[7028,7039,1],[7040,7041,0],[7042,7073,1],[7074,7077,0],[7078,7079,1],[7080,7081,0],[7082,7082,1],[7083,7085,0],[7086,7141,1],[7142,7142,0],[7143,7143,1],[7144,7145,0],[7146,7148,1],[7149,7149,0],[7150,7150,1],[7151,7153,0],[7154,7211,1],[7212,7219,0],[7220,7221,1],[7222,7223,0],[7224,7375,1],[7376,7378,0],[7379,7379,1],[7380,7392,0],[7393,7393,1],[7394,7400,0],[7401,7404,1],[7405,7405,0],[7406,7411,1],[7412,7412,0],[7413,7415,1],[7416,7417,0],[7418,7615,1],[7616,7679,0],[7680,8202,1],[8203,8207,0],[8208,8233,1],[8234,8238,0],[8239,8287,1],[8288,8303,0],[8304,8399,1],[8400,8432,0],[8433,8985,1],[8986,8987,2],[8988,9e3,1],[9001,9002,2],[9003,9192,1],[9193,9196,2],[9197,9199,1],[9200,9200,2],[9201,9202,1],[9203,9203,2],[9204,9724,1],[9725,9726,2],[9727,9747,1],[9748,9749,2],[9750,9799,1],[9800,9811,2],[9812,9854,1],[9855,9855,2],[9856,9874,1],[9875,9875,2],[9876,9888,1],[9889,9889,2],[9890,9897,1],[9898,9899,2],[9900,9916,1],[9917,9918,2],[9919,9923,1],[9924,9925,2],[9926,9933,1],[9934,9934,2],[9935,9939,1],[9940,9940,2],[9941,9961,1],[9962,9962,2],[9963,9969,1],[9970,9971,2],[9972,9972,1],[9973,9973,2],[9974,9977,1],[9978,9978,2],[9979,9980,1],[9981,9981,2],[9982,9988,1],[9989,9989,2],[9990,9993,1],[9994,9995,2],[9996,10023,1],[10024,10024,2],[10025,10059,1],[10060,10060,2],[10061,10061,1],[10062,10062,2],[10063,10066,1],[10067,10069,2],[10070,10070,1],[10071,10071,2],[10072,10132,1],[10133,10135,2],[10136,10159,1],[10160,10160,2],[10161,10174,1],[10175,10175,2],[10176,11034,1],[11035,11036,2],[11037,11087,1],[11088,11088,2],[11089,11092,1],[11093,11093,2],[11094,11502,1],[11503,11505,0],[11506,11743,1],[11744,11775,0],[11776,11903,1],[11904,11929,2],[11930,11930,1],[11931,12019,2],[12020,12031,1],[12032,12245,2],[12246,12271,1],[12272,12329,2],[12330,12335,0],[12336,12350,2],[12351,12352,1],[12353,12438,2],[12439,12440,1],[12441,12442,0],[12443,12543,2],[12544,12548,1],[12549,12591,2],[12592,12592,1],[12593,12643,2],[12644,12644,0],[12645,12686,2],[12687,12687,1],[12688,12771,2],[12772,12782,1],[12783,12830,2],[12831,12831,1],[12832,12871,2],[12872,12879,1],[12880,19903,2],[19904,19967,1],[19968,42124,2],[42125,42127,1],[42128,42182,2],[42183,42606,1],[42607,42610,0],[42611,42611,1],[42612,42621,0],[42622,42653,1],[42654,42655,0],[42656,42735,1],[42736,42737,0],[42738,43009,1],[43010,43010,0],[43011,43013,1],[43014,43014,0],[43015,43018,1],[43019,43019,0],[43020,43044,1],[43045,43046,0],[43047,43051,1],[43052,43052,0],[43053,43203,1],[43204,43205,0],[43206,43231,1],[43232,43249,0],[43250,43257,1],[43258,43258,0],[43259,43262,1],[43263,43263,0],[43264,43301,1],[43302,43309,0],[43310,43334,1],[43335,43345,0],[43346,43359,1],[43360,43388,2],[43389,43391,1],[43392,43394,0],[43395,43442,1],[43443,43443,0],[43444,43445,1],[43446,43449,0],[43450,43451,1],[43452,43453,0],[43454,43492,1],[43493,43493,0],[43494,43560,1],[43561,43566,0],[43567,43568,1],[43569,43570,0],[43571,43572,1],[43573,43574,0],[43575,43586,1],[43587,43587,0],[43588,43595,1],[43596,43596,0],[43597,43643,1],[43644,43644,0],[43645,43695,1],[43696,43696,0],[43697,43697,1],[43698,43700,0],[43701,43702,1],[43703,43704,0],[43705,43709,1],[43710,43711,0],[43712,43712,1],[43713,43713,0],[43714,43755,1],[43756,43757,0],[43758,43765,1],[43766,43766,0],[43767,44004,1],[44005,44005,0],[44006,44007,1],[44008,44008,0],[44009,44012,1],[44013,44013,0],[44014,44031,1],[44032,55203,2],[55204,55215,1],[55216,55238,0],[55239,55242,1],[55243,55291,0],[55292,63743,1],[63744,64255,2],[64256,64285,1],[64286,64286,0],[64287,65023,1],[65024,65039,0],[65040,65049,2],[65050,65055,1],[65056,65071,0],[65072,65106,2],[65107,65107,1],[65108,65126,2],[65127,65127,1],[65128,65131,2],[65132,65278,1],[65279,65279,0],[65280,65280,1],[65281,65376,2],[65377,65437,1],[65438,65440,0],[65441,65503,1],[65504,65510,2],[65511,65519,1],[65520,65528,0],[65529,66044,1],[66045,66045,0],[66046,66271,1],[66272,66272,0],[66273,66421,1],[66422,66426,0],[66427,68096,1],[68097,68099,0],[68100,68100,1],[68101,68102,0],[68103,68107,1],[68108,68111,0],[68112,68151,1],[68152,68154,0],[68155,68158,1],[68159,68159,0],[68160,68324,1],[68325,68326,0],[68327,68899,1],[68900,68903,0],[68904,69290,1],[69291,69292,0],[69293,69372,1],[69373,69375,0],[69376,69445,1],[69446,69456,0],[69457,69505,1],[69506,69509,0],[69510,69632,1],[69633,69633,0],[69634,69687,1],[69688,69702,0],[69703,69743,1],[69744,69744,0],[69745,69746,1],[69747,69748,0],[69749,69758,1],[69759,69761,0],[69762,69810,1],[69811,69814,0],[69815,69816,1],[69817,69818,0],[69819,69825,1],[69826,69826,0],[69827,69887,1],[69888,69890,0],[69891,69926,1],[69927,69931,0],[69932,69932,1],[69933,69940,0],[69941,70002,1],[70003,70003,0],[70004,70015,1],[70016,70017,0],[70018,70069,1],[70070,70078,0],[70079,70081,1],[70082,70083,0],[70084,70088,1],[70089,70092,0],[70093,70094,1],[70095,70095,0],[70096,70190,1],[70191,70193,0],[70194,70195,1],[70196,70196,0],[70197,70197,1],[70198,70199,0],[70200,70205,1],[70206,70206,0],[70207,70208,1],[70209,70209,0],[70210,70366,1],[70367,70367,0],[70368,70370,1],[70371,70378,0],[70379,70399,1],[70400,70401,0],[70402,70458,1],[70459,70460,0],[70461,70461,1],[70462,70462,0],[70463,70463,1],[70464,70464,0],[70465,70486,1],[70487,70487,0],[70488,70501,1],[70502,70508,0],[70509,70511,1],[70512,70516,0],[70517,70711,1],[70712,70719,0],[70720,70721,1],[70722,70724,0],[70725,70725,1],[70726,70726,0],[70727,70749,1],[70750,70750,0],[70751,70831,1],[70832,70832,0],[70833,70834,1],[70835,70840,0],[70841,70841,1],[70842,70842,0],[70843,70844,1],[70845,70845,0],[70846,70846,1],[70847,70848,0],[70849,70849,1],[70850,70851,0],[70852,71086,1],[71087,71087,0],[71088,71089,1],[71090,71093,0],[71094,71099,1],[71100,71101,0],[71102,71102,1],[71103,71104,0],[71105,71131,1],[71132,71133,0],[71134,71218,1],[71219,71226,0],[71227,71228,1],[71229,71229,0],[71230,71230,1],[71231,71232,0],[71233,71338,1],[71339,71339,0],[71340,71340,1],[71341,71341,0],[71342,71343,1],[71344,71349,0],[71350,71350,1],[71351,71351,0],[71352,71452,1],[71453,71455,0],[71456,71457,1],[71458,71461,0],[71462,71462,1],[71463,71467,0],[71468,71726,1],[71727,71735,0],[71736,71736,1],[71737,71738,0],[71739,71983,1],[71984,71984,0],[71985,71994,1],[71995,71996,0],[71997,71997,1],[71998,71999,0],[72e3,72e3,1],[72001,72001,0],[72002,72002,1],[72003,72003,0],[72004,72147,1],[72148,72151,0],[72152,72153,1],[72154,72155,0],[72156,72159,1],[72160,72160,0],[72161,72192,1],[72193,72202,0],[72203,72242,1],[72243,72248,0],[72249,72249,1],[72250,72254,0],[72255,72262,1],[72263,72263,0],[72264,72272,1],[72273,72278,0],[72279,72280,1],[72281,72283,0],[72284,72323,1],[72324,72342,0],[72343,72343,1],[72344,72345,0],[72346,72751,1],[72752,72758,0],[72759,72759,1],[72760,72765,0],[72766,72766,1],[72767,72767,0],[72768,72849,1],[72850,72871,0],[72872,72873,1],[72874,72880,0],[72881,72881,1],[72882,72883,0],[72884,72884,1],[72885,72886,0],[72887,73008,1],[73009,73014,0],[73015,73017,1],[73018,73018,0],[73019,73019,1],[73020,73021,0],[73022,73022,1],[73023,73031,0],[73032,73103,1],[73104,73105,0],[73106,73108,1],[73109,73109,0],[73110,73110,1],[73111,73111,0],[73112,73458,1],[73459,73460,0],[73461,73471,1],[73472,73474,0],[73475,73525,1],[73526,73530,0],[73531,73535,1],[73536,73536,0],[73537,73537,1],[73538,73538,0],[73539,78911,1],[78912,78912,0],[78913,78918,1],[78919,78933,0],[78934,92911,1],[92912,92916,0],[92917,92975,1],[92976,92982,0],[92983,94030,1],[94031,94031,0],[94032,94094,1],[94095,94098,0],[94099,94175,1],[94176,94179,2],[94180,94180,0],[94181,94191,1],[94192,94193,2],[94194,94207,1],[94208,100343,2],[100344,100351,1],[100352,101589,2],[101590,101631,1],[101632,101640,2],[101641,110575,1],[110576,110579,2],[110580,110580,1],[110581,110587,2],[110588,110588,1],[110589,110590,2],[110591,110591,1],[110592,110882,2],[110883,110897,1],[110898,110898,2],[110899,110927,1],[110928,110930,2],[110931,110932,1],[110933,110933,2],[110934,110947,1],[110948,110951,2],[110952,110959,1],[110960,111355,2],[111356,113820,1],[113821,113822,0],[113823,113823,1],[113824,113827,0],[113828,118527,1],[118528,118573,0],[118574,118575,1],[118576,118598,0],[118599,119140,1],[119141,119141,0],[119142,119142,1],[119143,119145,0],[119146,119149,1],[119150,119170,0],[119171,119172,1],[119173,119179,0],[119180,119209,1],[119210,119213,0],[119214,119361,1],[119362,119364,0],[119365,121343,1],[121344,121398,0],[121399,121402,1],[121403,121452,0],[121453,121460,1],[121461,121461,0],[121462,121475,1],[121476,121476,0],[121477,121498,1],[121499,121503,0],[121504,121504,1],[121505,121519,0],[121520,122879,1],[122880,122886,0],[122887,122887,1],[122888,122904,0],[122905,122906,1],[122907,122913,0],[122914,122914,1],[122915,122916,0],[122917,122917,1],[122918,122922,0],[122923,123022,1],[123023,123023,0],[123024,123183,1],[123184,123190,0],[123191,123565,1],[123566,123566,0],[123567,123627,1],[123628,123631,0],[123632,124139,1],[124140,124143,0],[124144,125135,1],[125136,125142,0],[125143,125251,1],[125252,125258,0],[125259,126979,1],[126980,126980,2],[126981,127182,1],[127183,127183,2],[127184,127373,1],[127374,127374,2],[127375,127376,1],[127377,127386,2],[127387,127487,1],[127488,127490,2],[127491,127503,1],[127504,127547,2],[127548,127551,1],[127552,127560,2],[127561,127567,1],[127568,127569,2],[127570,127583,1],[127584,127589,2],[127590,127743,1],[127744,127776,2],[127777,127788,1],[127789,127797,2],[127798,127798,1],[127799,127868,2],[127869,127869,1],[127870,127891,2],[127892,127903,1],[127904,127946,2],[127947,127950,1],[127951,127955,2],[127956,127967,1],[127968,127984,2],[127985,127987,1],[127988,127988,2],[127989,127991,1],[127992,128062,2],[128063,128063,1],[128064,128064,2],[128065,128065,1],[128066,128252,2],[128253,128254,1],[128255,128317,2],[128318,128330,1],[128331,128334,2],[128335,128335,1],[128336,128359,2],[128360,128377,1],[128378,128378,2],[128379,128404,1],[128405,128406,2],[128407,128419,1],[128420,128420,2],[128421,128506,1],[128507,128591,2],[128592,128639,1],[128640,128709,2],[128710,128715,1],[128716,128716,2],[128717,128719,1],[128720,128722,2],[128723,128724,1],[128725,128727,2],[128728,128731,1],[128732,128735,2],[128736,128746,1],[128747,128748,2],[128749,128755,1],[128756,128764,2],[128765,128991,1],[128992,129003,2],[129004,129007,1],[129008,129008,2],[129009,129291,1],[129292,129338,2],[129339,129339,1],[129340,129349,2],[129350,129350,1],[129351,129535,2],[129536,129647,1],[129648,129660,2],[129661,129663,1],[129664,129672,2],[129673,129679,1],[129680,129725,2],[129726,129726,1],[129727,129733,2],[129734,129741,1],[129742,129755,2],[129756,129759,1],[129760,129768,2],[129769,129775,1],[129776,129784,2],[129785,131071,1],[131072,196605,2],[196606,196607,1],[196608,262141,2],[262142,917503,1],[917504,921599,0],[921600,1114111,1]];var segmenter3=new Intl.Segmenter("en",{granularity:"grapheme"}),VS16=65039,isRegionalIndicator=cp=>cp>=127462&&cp<=127487;function codePointWidth(cp){let lo=0,hi=WIDTHS.length-1;for(;lo<=hi;){let mid=lo+hi>>1,run=WIDTHS[mid];if(cp<run[0])hi=mid-1;else if(cp>run[1])lo=mid+1;else return run[2]}return 1}function clusterWidth(cluster){let w=0,vs16=!1,regional=0;for(let ch of cluster){let cp=ch.codePointAt(0);cp===VS16&&(vs16=!0),isRegionalIndicator(cp)&®ional++;let cw=codePointWidth(cp);cw>w&&(w=cw)}return vs16||regional>=2?2:w}function*measured(s){for(let{segment:segment2}of segmenter3.segment(s))yield[segment2,clusterWidth(segment2)]}function stringWidth(s){let w=0;for(let{segment:segment2}of segmenter3.segment(s))w+=clusterWidth(segment2);return w}var WRAP_WIDTH=24,MAX_LINES=4,MAX_LABEL=28,LABEL_BREAK_CHARS=["_","-",".","/"],asciiLower=s=>s.replace(/[A-Z]/g,c2=>c2.toLowerCase()),asciiUpper=s=>s.replace(/[a-z]/g,c2=>c2.toUpperCase()),CONTROLS=/[\0-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g,stripControls=src=>src.replace(CONTROLS,"");function srcLines(src){let out=src.split(`
|
|
1335
1335
|
`).map(l3=>l3.endsWith("\r")?l3.slice(0,-1):l3);return out.length>0&&out[out.length-1]===""&&out.pop(),out}var ALNUM=/[\p{Alphabetic}\p{N}]/u,isAlphanumeric=c2=>ALNUM.test(c2),isIdChar=c2=>isAlphanumeric(c2)||c2==="_",ENTITY_LOOKAHEAD=10,NAMED_ENTITIES={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function decodeEntityBody(body){let named=NAMED_ENTITIES[body];if(named!==void 0)return named;if(!body.startsWith("#"))return null;let num=body.slice(1),hex=/^[xX]/.test(num),digits=hex?num.slice(1):num;if(!(hex?/^[0-9a-fA-F]+$/:/^[0-9]+$/).test(digits))return null;let code=Number.parseInt(digits,hex?16:10);return code>1114111||code>=55296&&code<=57343||code<32||code>=127&&code<=159?null:String.fromCodePoint(code)}function decodeHtmlEntities(s){if(!s.includes("&"))return s;let chars=[...s],out="",i=0;for(;i<chars.length;){if(chars[i]!=="&"){out+=chars[i],i++;continue}let hi=Math.min(i+1+ENTITY_LOOKAHEAD,chars.length),semi=-1;for(let j2=i+1;j2<hi;j2++)if(chars[j2]===";"){semi=j2;break}let decoded=semi===-1?null:decodeEntityBody(chars.slice(i+1,semi).join(""));decoded===null?(out+="&",i++):(out+=decoded,i=semi+1)}return out}function stripMarkdown(s){let chars=[...[...s].filter(c2=>c2!=="`").join("").replaceAll("**","").replaceAll("__","")],out="";for(let i=0;i<chars.length;i++){let c2=chars[i],inWord=i>0&&isAlphanumeric(chars[i-1])&&chars[i+1]!==void 0&&isAlphanumeric(chars[i+1]);(c2==="*"||c2==="_")&&!inWord||(out+=c2)}return out.trim()}var HTML_FORMAT_TAGS=new Set(["b","strong","i","em","u","s","strike","del","ins","mark","small","big","sub","sup","code","kbd","samp","var","tt","span","font","q","abbr","cite","pre"]);function htmlTagAt(chars,start){let i=start+1;chars[i]==="/"&&i++;let nameStart=i;for(;i<chars.length&&/^[0-9A-Za-z]$/.test(chars[i]);)i++;if(i===nameStart)return null;let name=chars.slice(nameStart,i).join("");for(;i<chars.length&&chars[i]!==">";){if(chars[i]==="<")return null;i++}return chars[i]===">"?{name,end:i+1}:null}function stripHtmlTags(s){let chars=[...s],out="",i=0;for(;i<chars.length;){if(chars[i]==="<"){let tag=htmlTagAt(chars,i);if(tag){let lower=tag.name.toLowerCase();if(lower==="br"){out+=" ",i=tag.end;continue}if(HTML_FORMAT_TAGS.has(lower)){i=tag.end;continue}}}out+=chars[i],i++}return out}function unwrap(s,open2,close){return s.length>=open2.length+close.length&&s.startsWith(open2)&&s.endsWith(close)?s.slice(open2.length,s.length-close.length):null}function cleanLabel(raw){let trimmed=stripHtmlTags(raw.trim()).trim(),unquoted=(unwrap(trimmed,'"','"')??unwrap(trimmed,"'","'")??trimmed).trim(),md=unwrap(unquoted,"`","`");return decodeHtmlEntities(md===null?unquoted:stripMarkdown(md.trim()))}function lastBreak(s){let best=-1;for(let c2 of LABEL_BREAK_CHARS)best=Math.max(best,s.lastIndexOf(c2));return best}function wrapLabel(label,width,maxLines){width=Math.max(1,width);let lines=[],cur="",curW=0;for(let word of label.split(/\s+/).filter(w=>w!=="")){let ww=stringWidth(word);if(ww>width){cur!==""&&(lines.push(cur),cur="");let chunk="",chunkW=0;for(let[ch,cw]of measured(word)){if(chunkW+cw>width&&chunk!==""){let p=lastBreak(chunk),carry=p===-1?"":chunk.slice(p+1);lines.push(p===-1?chunk:chunk.slice(0,p+1)),chunk=carry,chunkW=stringWidth(carry)}chunk+=ch,chunkW+=cw}cur=chunk,curW=chunkW}else cur===""?(cur=word,curW=ww):curW+1+ww<=width?(cur+=` ${word}`,curW+=1+ww):(lines.push(cur),cur=word,curW=ww)}if(cur!==""&&lines.push(cur),lines.length===0&&lines.push(""),lines.length>maxLines){lines.length=maxLines;let target=Math.max(1,width-1),s="",sw=0;for(let[ch,cw]of measured(lines[lines.length-1])){if(sw+cw>target)break;s+=ch,sw+=cw}lines[lines.length-1]=`${s}\u2026`}return lines}function fitLabel(label,inner){if(stringWidth(label)<=inner)return label;let out="",used=0;for(let[c2,cw]of measured(label)){if(used+cw+1>inner)break;out+=c2,used+=cw}return`${out}\u2026`}var CONT="\0",U2=1,D=2,L2=4,R2=8,STY_DOT=1,STY_THICK=2,STY_SOLID=4,Canvas=class{w;h;ch;cls;mask;style;occupied;curStyle=STY_SOLID;constructor(w,h){let n=w*h;this.w=w,this.h=h,this.ch=new Array(n).fill(" "),this.cls=new Array(n).fill("none"),this.mask=new Uint8Array(n),this.style=new Uint8Array(n),this.occupied=new Uint8Array(n)}idx(x2,y2){return y2*this.w+x2}set(x2,y2,c2,cls){if(x2>=this.w||y2>=this.h)return;let i=this.idx(x2,y2);this.ch[i]=c2,this.cls[i]=cls}addBits(x2,y2,bits,cls="edge"){if(x2>=this.w||y2>=this.h)return;let i=this.idx(x2,y2);this.occupied[i]||(this.mask[i]|=bits,this.style[i]|=this.curStyle,this.cls[i]!=="border"&&(this.cls[i]=cls))}blit(sub,ox,oy){for(let sy=0;sy<sub.h;sy++)for(let sx=0;sx<sub.w;sx++){let x2=ox+sx,y2=oy+sy;if(x2>=this.w||y2>=this.h)continue;let si=sub.idx(sx,sy),di=this.idx(x2,y2);this.ch[di]=sub.ch[si],this.cls[di]=sub.cls[si],this.style[di]=sub.style[si],this.occupied[di]=1}}junction(x2,y2,bits){if(x2>=this.w||y2>=this.h)return;let i=this.idx(x2,y2);this.mask[i]|=bits,this.cls[i]!=="border"&&(this.cls[i]="edge")}segV(x2,y0,y1){let a=Math.min(y0,y1),b2=Math.max(y0,y1);for(let y2=a;y2<=b2;y2++){let bits=0;y2>a&&(bits|=U2),y2<b2&&(bits|=D),this.addBits(x2,y2,bits)}}segH(y2,x0,x1){let a=Math.min(x0,x1),b2=Math.max(x0,x1);for(let x2=a;x2<=b2;x2++){let bits=0;x2>a&&(bits|=L2),x2<b2&&(bits|=R2),this.addBits(x2,y2,bits)}}finalizeMask(){for(let i=0;i<this.ch.length;i++)if(this.mask[i]!==0&&this.ch[i]===" "){let c2=maskChar(this.mask[i]);this.ch[i]=this.style[i]===STY_DOT?dottedChar(c2):this.style[i]===STY_THICK?thickChar(c2):c2}}flipVertical(){for(let y2=0;y2<Math.floor(this.h/2);y2++){let y22=this.h-1-y2;for(let x2=0;x2<this.w;x2++){let i=this.idx(x2,y2),j2=this.idx(x2,y22);[this.ch[i],this.ch[j2]]=[this.ch[j2],this.ch[i]],[this.cls[i],this.cls[j2]]=[this.cls[j2],this.cls[i]]}}for(let i=0;i<this.ch.length;i++)this.ch[i]=flipGlyphV(this.ch[i])}flipHorizontal(){for(let y2=0;y2<this.h;y2++)for(let x2=0;x2<Math.floor(this.w/2);x2++){let x22=this.w-1-x2,i=this.idx(x2,y2),j2=this.idx(x22,y2);[this.ch[i],this.ch[j2]]=[this.ch[j2],this.ch[i]],[this.cls[i],this.cls[j2]]=[this.cls[j2],this.cls[i]]}for(let i=0;i<this.ch.length;i++)this.ch[i]=flipGlyphH(this.ch[i]);for(let y2=0;y2<this.h;y2++){let x2=0;for(;x2<this.w;){let cls=this.cls[this.idx(x2,y2)];if(cls==="text"||cls==="edgeLabel"){let start=this.idx(x2,y2);for(;x2<this.w&&this.cls[this.idx(x2,y2)]===cls;)x2++;let end=this.idx(x2,y2);reverseSlice(this.ch,start,end)}else x2++}}}toLines(){let plain=[],styled=[],width=0;for(let y2=0;y2<this.h;y2++){let last=0;for(let x2=this.w-1;x2>=0;x2--)if(this.ch[this.idx(x2,y2)]!==" "){last=x2+1;break}width=Math.max(width,last);let spans=[],plainRow="",run="",runCls="none";for(let x2=0;x2<last;x2++){let i=this.idx(x2,y2),c2=this.ch[i];if(c2===CONT)continue;let cls=this.cls[i];plainRow+=c2,cls!==runCls&&run!==""&&(spans.push({text:run,cls:runCls}),run=""),runCls=cls,run+=c2}run!==""&&spans.push({text:run,cls:runCls}),styled.push(spans),plain.push(plainRow.replace(/ +$/,""))}let first=0;for(;first<plain.length&&plain[first]==="";)first++;let end=plain.length;for(;end>first&&plain[end-1]==="";)end--;return{plain:plain.slice(first,end),styled:styled.slice(first,end),width}}};function reverseSlice(arr,start,end){for(let i=start,j2=end-1;i<j2;i++,j2--)[arr[i],arr[j2]]=[arr[j2],arr[i]]}function drawText(canvas,text,x2,y2,cls){let cur=x2;for(let[cluster,cw]of measured(text))if(cw!==0){canvas.set(cur,y2,cluster,cls);for(let k2=1;k2<cw;k2++)canvas.set(cur+k2,y2,CONT,cls);cur+=cw}}function drawTextOverEdges(canvas,text,x2,y2,cls){let cur=x2;for(let[cluster,cw]of measured(text))if(cw!==0){for(let k2=0;k2<cw;k2++)cur+k2<canvas.w&&y2<canvas.h&&(canvas.mask[canvas.idx(cur+k2,y2)]=0),canvas.set(cur+k2,y2,k2===0?cluster:CONT,cls);cur+=cw}}function maskChar(mask){switch(mask){case 0:return" ";case U2:case D:case U2|D:return"\u2502";case L2:case R2:case L2|R2:return"\u2500";case D|R2:return"\u250C";case D|L2:return"\u2510";case U2|R2:return"\u2514";case U2|L2:return"\u2518";case U2|D|R2:return"\u251C";case U2|D|L2:return"\u2524";case D|L2|R2:return"\u252C";case U2|L2|R2:return"\u2534";default:return"\u253C"}}var DOTTED={"\u2500":"\u254C","\u2502":"\u254E"},THICK={"\u2500":"\u2501","\u2502":"\u2503","\u250C":"\u250F","\u2510":"\u2513","\u2514":"\u2517","\u2518":"\u251B","\u251C":"\u2523","\u2524":"\u252B","\u252C":"\u2533","\u2534":"\u253B","\u253C":"\u254B"},FLIP_V={"\u250C":"\u2514","\u2514":"\u250C","\u2510":"\u2518","\u2518":"\u2510","\u250F":"\u2517","\u2517":"\u250F","\u2513":"\u251B","\u251B":"\u2513","\u256D":"\u2570","\u2570":"\u256D","\u256E":"\u256F","\u256F":"\u256E","\u252C":"\u2534","\u2534":"\u252C","\u2533":"\u253B","\u253B":"\u2533","\u25BC":"\u25B2","\u25B2":"\u25BC","\u25BD":"\u25B3","\u25B3":"\u25BD"},FLIP_H={"\u250C":"\u2510","\u2510":"\u250C","\u2514":"\u2518","\u2518":"\u2514","\u250F":"\u2513","\u2513":"\u250F","\u2517":"\u251B","\u251B":"\u2517","\u256D":"\u256E","\u256E":"\u256D","\u2570":"\u256F","\u256F":"\u2570","\u251C":"\u2524","\u2524":"\u251C","\u2523":"\u252B","\u252B":"\u2523","\u25B6":"\u25C4","\u25C4":"\u25B6","\u25B7":"\u25C1","\u25C1":"\u25B7"},dottedChar=c2=>DOTTED[c2]??c2,thickChar=c2=>THICK[c2]??c2,flipGlyphV=c2=>FLIP_V[c2]??c2,flipGlyphH=c2=>FLIP_H[c2]??c2;var MAX_NODES=128,MAX_EDGES=512,MAX_GROUPS=24,MAX_GROUP_DEPTH=6,MAX_MEMBERS=8,emptyClassInfo=()=>({annotation:null,attrs:[],methods:[]});function parseDir(token){switch(asciiUpper(token)){case"LR":return"right";case"RL":return"left";case"BT":return"up";default:return"down"}}var Graph=class{nodes=[];edges=[];index=new Map;groups=[];nodeGroup=[];curGroup=null;overCap=!1;warnings=[];dir="down";constructor(dir="down"){this.dir=dir}nodeIndex(id,label,shape){let existing=this.index.get(id);return existing!==void 0?(label!==null&&(this.nodes[existing].label=label,this.nodes[existing].shape=shape),existing):this.nodes.length>=MAX_NODES?(this.overCap=!0,null):(this.index.set(id,this.nodes.length),this.nodes.push({label:label??id,shape}),this.nodeGroup.push(this.curGroup),this.nodes.length-1)}nodeLabel(id,label){let existing=this.index.get(id);return existing!==void 0?(this.nodes[existing].label=label,existing):this.nodeIndex(id,label,"round")}pushEdge(edge){return this.edges.length>=MAX_EDGES?(this.overCap=!0,!1):(this.edges.push(edge),!0)}};var PAD=1,GAP_X=3,GAP_Y=2,MAX_CANVAS_CELLS=1<<21,sat=(a,b2)=>Math.max(0,a-b2),half=n=>Math.floor(n/2);function computeRanks(graph){let n=graph.nodes.length,children=Array.from({length:n},()=>[]),indeg=new Array(n).fill(0);for(let e of graph.edges)e.from!==e.to&&(children[e.from].push(e.to),indeg[e.to]++);let color=new Uint8Array(n),dag=Array.from({length:n},()=>[]),order=[],roots=[...Array(n).keys()].filter(i=>indeg[i]===0);for(let start of[...roots,...Array(n).keys()])color[start]===0&&dfsDag(start,children,color,dag,order);let rank=new Array(n).fill(0);for(let i=order.length-1;i>=0;i--){let u=order[i];for(let v2 of dag[u])rank[v2]=Math.max(rank[v2],rank[u]+1)}return rank}function dfsDag(start,children,color,dag,order){let stack=[{u:start,i:0}];for(color[start]=1;stack.length>0;){let frame2=stack[stack.length-1],u=frame2.u;if(frame2.i<children[u].length){let v2=children[u][frame2.i];if(frame2.i++,color[v2]===1)continue;dag[u].push(v2),color[v2]===0&&(color[v2]=1,stack.push({u:v2,i:0}))}else color[u]=2,order.push(u),stack.pop()}}function orderRanks(byRank,edges,ranks){let n=ranks.length;if(byRank.length<2||n<3)return;let parents=Array.from({length:n},()=>[]),children=Array.from({length:n},()=>[]);for(let e of edges)e.from!==e.to&&ranks[e.to]>ranks[e.from]&&(parents[e.to].push(e.from),children[e.from].push(e.to));let pos=new Array(n).fill(0),reindex=row=>{for(let i=0;i<row.length;i++)pos[row[i]]=i};for(let row of byRank)reindex(row);let best=byRank.map(row=>[...row]),bestCrossings=countCrossings(edges,ranks,pos);if(bestCrossings!==0){for(let it2=0;it2<8;it2++){let rows=it2%2===0?byRank.slice(1):byRank.slice(0,-1).reverse(),neigh=it2%2===0?parents:children;for(let row of rows)sortByBarycenter(row,neigh,pos),reindex(row);let crossings=countCrossings(edges,ranks,pos);if(crossings<bestCrossings&&(bestCrossings=crossings,best=byRank.map(row=>[...row])),bestCrossings===0)break}for(let i=0;i<byRank.length;i++)byRank[i].splice(0,byRank[i].length,...best[i])}}function sortByBarycenter(row,neigh,pos){let keyed=row.map(v2=>({key:neigh[v2].length===0?pos[v2]:neigh[v2].reduce((s,u)=>s+pos[u],0)/neigh[v2].length,v:v2}));keyed.sort((a,b2)=>a.key-b2.key);for(let i=0;i<keyed.length;i++)row[i]=keyed[i].v}function countCrossings(edges,ranks,pos){let adjacent=edges.filter(e=>e.from!==e.to&&ranks[e.to]===ranks[e.from]+1).map(e=>[ranks[e.from],pos[e.from],pos[e.to]]),crossings=0;for(let i=0;i<adjacent.length;i++){let a=adjacent[i];for(let j2=i+1;j2<adjacent.length;j2++){let b2=adjacent[j2];a[0]===b2[0]&&(a[1]<b2[1]&&a[2]>b2[2]||a[1]>b2[1]&&a[2]<b2[2])&&crossings++}}return crossings}function assignPositions(byRank,size,sep11,edges,ranks){let n=size.length,parents=Array.from({length:n},()=>[]),children=Array.from({length:n},()=>[]);for(let e of edges)e.from!==e.to&&ranks[e.to]>ranks[e.from]&&(parents[e.to].push(e.from),children[e.from].push(e.to));let pos=new Array(n).fill(0);for(let row of byRank){let x2=0;for(let v2 of row){let h=size[v2]/2;x2+=h,pos[v2]=x2,x2+=h+sep11}}for(let it2=0;it2<10;it2++){let rows=it2%2===0?byRank:[...byRank].reverse(),neigh=it2%2===0?parents:children;for(let row of rows)relaxRank(row,neigh,pos,size,sep11)}let minLeft=Number.POSITIVE_INFINITY;for(let v2=0;v2<n;v2++)minLeft=Math.min(minLeft,pos[v2]-size[v2]/2);return Number.isFinite(minLeft)||(minLeft=0),Array.from({length:n},(_2,v2)=>Math.max(0,Math.round(pos[v2]-minLeft)))}function relaxRank(nodes,neigh,pos,size,sep11){let n=nodes.length;if(n===0)return;let desired=nodes.map(v2=>neigh[v2].length===0?pos[v2]:neigh[v2].reduce((s,u)=>s+pos[u],0)/neigh[v2].length),halfOf=i=>size[nodes[i]]/2,left=new Array(n);for(let i=0;i<n;i++)left[i]=i===0?desired[i]:Math.max(desired[i],left[i-1]+halfOf(i-1)+sep11+halfOf(i));let right=new Array(n);for(let i=n-1;i>=0;i--)right[i]=i===n-1?desired[i]:Math.min(desired[i],right[i+1]-halfOf(i+1)-sep11-halfOf(i));for(let i=0;i<n;i++)pos[nodes[i]]=(left[i]+right[i])/2;for(let i=1;i<n;i++){let minP=pos[nodes[i-1]]+halfOf(i-1)+sep11+halfOf(i);pos[nodes[i]]<minP&&(pos[nodes[i]]=minP)}}function assignTracks(spans){let sorted=[...spans].sort((a,b2)=>{for(let i=0;i<5;i++)if(a[i]!==b2[i])return a[i]-b2[i];return 0}),tracks=[],assigned=[];for(let[s,e,f2,t,idx]of sorted){let slot=tracks.findIndex(members=>members.every(([s2,e2,f22,t2])=>e2+2<=s||e+2<=s2||f22===f2||t2===t));slot===-1&&(tracks.push([]),slot=tracks.length-1),tracks[slot].push([s,e,f2,t]),assigned.push([idx,slot])}return{assigned,count:tracks.length}}function busSpans(graph,ranks,centers,r,exact){let out=[];return graph.edges.forEach((e,i)=>{let jogs=exact?centers[e.from]!==centers[e.to]:Math.abs(centers[e.from]-centers[e.to])>1;e.from!==e.to&&ranks[e.from]===r&&ranks[e.to]===r+1&&jogs&&out.push([Math.min(centers[e.from],centers[e.to]),Math.max(centers[e.from],centers[e.to]),e.from,e.to,i])}),out}function laneSpans(graph,ranks,placed,vertical){let out=[];return graph.edges.forEach((e,i)=>{if(e.from===e.to||ranks[e.to]===ranks[e.from]+1)return;let pf=placed[e.from],pt2=placed[e.to],a=vertical?Math.min(pf.cy,pt2.cy):Math.min(pf.cx,pt2.cx),b2=vertical?Math.max(pf.cy,pt2.cy):Math.max(pf.cx,pt2.cx);out.push([a,b2,e.from,e.to,i])}),out}function placeTd(ranks,maxRank,byRank,sizes,graph,placed){let centers=assignPositions(byRank,sizes.layW,GAP_X,graph.edges,ranks),edgeBus=new Array(graph.edges.length).fill(0),busTracks=new Array(maxRank+1).fill(0);for(let r=0;r<maxRank;r++){let spans=busSpans(graph,ranks,centers,r,!1);if(spans.length===0)continue;let{assigned,count}=assignTracks(spans);for(let[idx,slot]of assigned)edgeBus[idx]=slot;busTracks[r]=count}let rankH=byRank.map(row=>row.length===0?3:Math.max(...row.map(i=>sizes.boxH[i]+sizes.extraH[i]))),rankY=new Array(maxRank+1).fill(0);for(let r=1;r<=maxRank;r++)rankY[r]=rankY[r-1]+rankH[r-1]+Math.max(GAP_Y,busTracks[r-1]+1);let canvasH=rankY[maxRank]+rankH[maxRank],bandEnd=Array.from({length:maxRank+1},(_2,r)=>rankY[r]+rankH[r]),diagramW=1;byRank.forEach((row,r)=>{for(let idx of row){let w=sizes.boxW[idx],h=sizes.boxH[idx],cx=centers[idx],x2=sat(cx,half(w)),y2=rankY[r]+half(rankH[r]-h-sizes.extraH[idx]);placed[idx]={x:x2,y:y2,w,h,cx,cy:y2+half(h),rank:r},diagramW=Math.max(diagramW,x2+w),sizes.extraH[idx]>0&&sizes.selfLabelW[idx]>0&&(diagramW=Math.max(diagramW,x2+w+2+sizes.selfLabelW[idx]))}});let contentW=diagramW;for(let e of graph.edges){if(e.from===e.to||e.label===null)continue;let lw=Math.min(stringWidth(e.label),MAX_LABEL);contentW=ranks[e.to]===ranks[e.from]+1?Math.max(contentW,placed[e.to].cx+2+lw):Math.max(contentW,diagramW+lw+1)}let edgeLane=new Array(graph.edges.length).fill(0),lanes=laneSpans(graph,ranks,placed,!0),canvasW=contentW,laneBase=0;if(lanes.length>0){let{assigned,count}=assignTracks(lanes);for(let[idx,slot]of assigned)edgeLane[idx]=slot;canvasW=contentW+1+count,laneBase=contentW+1}return{canvasW,canvasH,bandEnd,edgeBus,laneBase,edgeLane}}function placeLr(ranks,maxRank,byRank,sizes,graph,placed){let colW=byRank.map(row=>row.length===0?0:Math.max(...row.map(i=>sizes.boxW[i]))),labelWidths=graph.edges.filter(e=>e.from===e.to||ranks[e.to]===ranks[e.from]+1).filter(e=>e.label!==null).map(e=>Math.min(stringWidth(e.label),MAX_LABEL)),maxLabel=labelWidths.length===0?0:Math.max(...labelWidths),baseGap=Math.max(GAP_X+1,maxLabel+3),centers=assignPositions(byRank,sizes.layH,1,graph.edges,ranks),edgeBus=new Array(graph.edges.length).fill(0),busTracks=new Array(maxRank+1).fill(0);for(let r=0;r<maxRank;r++){let spans=busSpans(graph,ranks,centers,r,!0);if(spans.length===0)continue;let{assigned,count}=assignTracks(spans);for(let[idx,slot]of assigned)edgeBus[idx]=slot;busTracks[r]=count}let rankX=new Array(maxRank+1).fill(0);for(let r=1;r<=maxRank;r++)rankX[r]=rankX[r-1]+colW[r-1]+Math.max(baseGap,busTracks[r-1]+1);let selfTails=byRank[maxRank].filter(i=>sizes.extraH[i]>0&&sizes.selfLabelW[i]>0).map(i=>2+sizes.selfLabelW[i]),canvasW=rankX[maxRank]+colW[maxRank]+(selfTails.length===0?0:Math.max(...selfTails)),bandEnd=Array.from({length:maxRank+1},(_2,r)=>rankX[r]+colW[r]),diagramH=1;byRank.forEach((row,r)=>{let x2=rankX[r];for(let idx of row){let w=sizes.boxW[idx],h=sizes.boxH[idx],cy=centers[idx],y2=sat(cy,half(h+sizes.extraH[idx]));placed[idx]={x:x2,y:y2,w,h,cx:x2+half(w),cy:y2+half(h),rank:r},diagramH=Math.max(diagramH,y2+h+sizes.extraH[idx])}});let edgeLane=new Array(graph.edges.length).fill(0),lanes=laneSpans(graph,ranks,placed,!1),canvasH=diagramH,laneBase=0;if(lanes.length>0){let{assigned,count}=assignTracks(lanes);for(let[idx,slot]of assigned)edgeLane[idx]=slot;canvasH=diagramH+1+count,laneBase=diagramH+1}return{canvasW,canvasH,bandEnd,edgeBus,laneBase,edgeLane}}function layoutCanvas(graph,extras){let n=graph.nodes.length;if(n===0)return null;let ranks=computeRanks(graph),maxRank=Math.max(...ranks,0),byRank=Array.from({length:maxRank+1},()=>[]);for(let idx=0;idx<ranks.length;idx++)byRank[ranks[idx]].push(idx);orderRanks(byRank,graph.edges,ranks);let wrapped=graph.nodes.map(node=>wrapLabel(node.label,WRAP_WIDTH,MAX_LINES)),widest=lines=>Math.max(1,lines.length===0?1:Math.max(...lines.map(stringWidth))),boxW=extras.map((extra,i)=>extra.kind==="frame"?Math.max(extra.sub.w+2,stringWidth(fitLabel(graph.nodes[i].label,WRAP_WIDTH))+4):extra.kind==="compartments"?widest(extra.sections.flat())+2*PAD+2:widest(wrapped[i])+2*PAD+2),boxH=extras.map((extra,i)=>{if(extra.kind==="frame")return extra.sub.h+2;if(extra.kind==="compartments"){let filled=extra.sections.filter(s=>s.length>0).length;return extra.sections.reduce((s,sec)=>s+sec.length,0)+sat(filled,1)+2}return wrapped[i].length+2}),extraH=new Array(n).fill(0),selfLabelW=new Array(n).fill(0);for(let e of graph.edges)e.from===e.to&&(extraH[e.from]=2,e.label!==null&&(selfLabelW[e.from]=Math.max(selfLabelW[e.from],Math.min(stringWidth(e.label),MAX_LABEL))));for(let i=0;i<n;i++)extraH[i]>0&&(boxW[i]=Math.max(boxW[i],7));let sizes={boxW,boxH,layW:boxW.map((w,i)=>w+(selfLabelW[i]>0?2*(selfLabelW[i]+3):0)),layH:boxH.map((h,i)=>h+extraH[i]),extraH,selfLabelW},placed=Array.from({length:n},()=>({x:0,y:0,w:0,h:0,cx:0,cy:0,rank:0})),vertical=graph.dir==="down"||graph.dir==="up",plan=vertical?placeTd(ranks,maxRank,byRank,sizes,graph,placed):placeLr(ranks,maxRank,byRank,sizes,graph,placed);if(plan.canvasW*plan.canvasH>MAX_CANVAS_CELLS)return null;let canvas=new Canvas(plan.canvasW,plan.canvasH);for(let idx=0;idx<n;idx++){let extra=extras[idx];extra.kind==="frame"?drawFrame(canvas,placed[idx],graph.nodes[idx].label,extra.sub):extra.kind==="compartments"?drawClassBox(canvas,placed[idx],extra.sections):drawBox(canvas,placed[idx],wrapped[idx],graph.nodes[idx].shape)}return graph.edges.forEach((edge,i)=>{if(canvas.curStyle=edge.line==="dotted"?STY_DOT:edge.line==="thick"?STY_THICK:STY_SOLID,edge.from===edge.to){routeSelf(canvas,placed[edge.from],edge);return}let from=placed[edge.from],to=placed[edge.to],adjacent=to.rank===from.rank+1,bus=plan.bandEnd[from.rank]+plan.edgeBus[i],lane=plan.laneBase+plan.edgeLane[i];vertical?adjacent?routeForward(canvas,from,to,edge,bus):routeBack(canvas,from,to,edge,lane):adjacent?routeForwardLr(canvas,from,to,edge,bus):routeBackLr(canvas,from,to,edge,lane)}),canvas.finalizeMask(),canvas}function orient(canvas,graph){return graph.dir==="up"?canvas.flipVertical():graph.dir==="left"&&canvas.flipHorizontal(),canvas}function layoutFlowchart(graph){let extras=graph.nodes.map(()=>({kind:"plain"})),canvas=layoutCanvas(graph,extras);return canvas&&orient(canvas,graph)}function layoutClass(graph,infos){let extras=graph.nodes.map((node,i)=>{let title=[];return infos[i].annotation!==null&&title.push(`\xAB${infos[i].annotation}\xBB`),title.push(displayGenerics(node.label)),{kind:"compartments",sections:[title,infos[i].attrs,infos[i].methods]}}),canvas=layoutCanvas(graph,extras);return canvas&&orient(canvas,graph)}function displayGenerics(s){let out="",open2=!1;for(let c2 of s)c2==="~"?(out+=open2?">":"<",open2=!open2):out+=c2;return out}var nodeKey=i=>`n${i}`,groupKey=i=>`g${i}`;function layoutGrouped(graph){let proxy=new Map;graph.groups.forEach((g,gi)=>{let ni=graph.index.get(g.id);ni!==void 0&&proxy.set(ni,gi)});let groupChain=g=>{let chain=[],cur=g;for(;cur!==null;)chain.push(cur),cur=graph.groups[cur].parent;return chain.reverse()},endpoint=n=>{let gi=proxy.get(n);return gi===void 0?{key:nodeKey(n),chain:groupChain(graph.nodeGroup[n])}:{key:groupKey(gi),chain:groupChain(graph.groups[gi].parent)}},scopeEdges=new Map,referenced=new Array(graph.groups.length).fill(!1);graph.edges.forEach((e,ei)=>{let f2=endpoint(e.from),t=endpoint(e.to),k2=0;for(;k2<f2.chain.length&&k2<t.chain.length&&f2.chain[k2]===t.chain[k2];)k2++;let scope=k2===0?null:f2.chain[k2-1],fKey=f2.chain.length>k2?groupKey(f2.chain[k2]):f2.key,tKey=t.chain.length>k2?groupKey(t.chain[k2]):t.key;for(let key of[fKey,tKey])key.startsWith("g")&&(referenced[Number(key.slice(1))]=!0);let list2=scopeEdges.get(scope);list2?list2.push([fKey,tKey,ei]):scopeEdges.set(scope,[[fKey,tKey,ei]])});let directNodes=new Map;graph.nodeGroup.forEach((g,ni)=>{if(proxy.has(ni))return;let list2=directNodes.get(g);list2?list2.push(ni):directNodes.set(g,[ni])});let keep=new Array(graph.groups.length).fill(!1);for(let gi=graph.groups.length-1;gi>=0;gi--){let hasNodes=(directNodes.get(gi)??[]).length>0,hasChildren=graph.groups.some((g,c2)=>g.parent===gi&&keep[c2]);keep[gi]=hasNodes||hasChildren||referenced[gi]}let canvas=buildScope(graph,null,scopeEdges,directNodes,keep);return canvas&&orient(canvas,graph)}function buildScope(graph,scope,scopeEdges,directNodes,keep){let items=(directNodes.get(scope)??[]).map(nodeKey),childGroups=graph.groups.map((_2,gi)=>gi).filter(gi=>graph.groups[gi].parent===scope&&keep[gi]);if(items.push(...childGroups.map(groupKey)),items.length===0)return new Canvas(1,1);let indexOf=new Map,nodes=[],extras=[];for(let item of items){indexOf.set(item,nodes.length);let i=Number(item.slice(1));if(item.startsWith("n"))nodes.push({label:graph.nodes[i].label,shape:graph.nodes[i].shape}),extras.push({kind:"plain"});else{let sub=buildScope(graph,i,scopeEdges,directNodes,keep);if(sub===null)return null;nodes.push({label:graph.groups[i].label,shape:"rect"}),extras.push({kind:"frame",sub})}}let edges=[];for(let[f2,t,ei]of scopeEdges.get(scope)??[]){let fi=indexOf.get(f2),ti=indexOf.get(t);if(fi===void 0||ti===void 0)continue;let e=graph.edges[ei];edges.push({from:fi,to:ti,label:e.label,headTo:e.headTo,headFrom:e.headFrom,line:e.line})}let synth=new Graph(graph.dir);return synth.nodes=nodes,synth.edges=edges,layoutCanvas(synth,extras)}function drawBox(canvas,p,lines,shape){let{x:x2,y:y2,w,h}=p,right=x2+w-1,bottom=y2+h-1,rounded=shape==="round"||shape==="diamond";canvas.set(x2,y2,rounded?"\u256D":"\u250C","border"),canvas.set(right,y2,rounded?"\u256E":"\u2510","border"),canvas.set(x2,bottom,rounded?"\u2570":"\u2514","border"),canvas.set(right,bottom,rounded?"\u256F":"\u2518","border");for(let cx=x2+1;cx<right;cx++)canvas.addBits(cx,y2,L2|R2,"border"),canvas.addBits(cx,bottom,L2|R2,"border");for(let cy=y2+1;cy<bottom;cy++)canvas.addBits(x2,cy,U2|D,"border"),canvas.addBits(right,cy,U2|D,"border");for(let cy=y2;cy<=bottom;cy++)for(let cx=x2;cx<=right;cx++)canvas.occupied[canvas.idx(cx,cy)]=1;let inner=Math.max(1,sat(w,2*PAD+2));lines.forEach((line,li)=>{let text=fitLabel(line,inner),textX=x2+1+PAD+half(sat(inner,stringWidth(text)));drawText(canvas,text,textX,y2+1+li,"text")})}function drawClassBox(canvas,p,sections){drawBox(canvas,p,[],"rect");let inner=Math.max(1,sat(p.w,2*PAD+2)),row=p.y+1,first=!0;sections.forEach((section,si)=>{if(section.length!==0){if(!first){canvas.set(p.x,row,"\u251C","border");for(let x2=p.x+1;x2<p.x+p.w-1;x2++)canvas.set(x2,row,"\u2500","border");canvas.set(p.x+p.w-1,row,"\u2524","border"),row++}first=!1;for(let line of section){let text=fitLabel(line,inner),tx=si===0?p.x+1+PAD+half(sat(inner,stringWidth(text))):p.x+1+PAD;drawTextOverEdges(canvas,text,tx,row,"text"),row++}}})}function drawFrame(canvas,p,title,sub){drawBox(canvas,p,[],"rect");let t=fitLabel(title,sat(p.w,4));drawTextOverEdges(canvas,` ${t} `,p.x+1,p.y,"text"),canvas.blit(sub,p.x+1+half(p.w-2-sub.w),p.y+1+half(p.h-2-sub.h))}function headGlyph(head,arrow){switch(head){case"circle":return"o";case"cross":return"\xD7";case"diamondFill":return"\u25C6";case"diamondOpen":return"\u25C7";case"triangle":return{"\u25BC":"\u25BD","\u25B2":"\u25B3","\u25C4":"\u25C1","\u25B6":"\u25B7"}[arrow]??arrow;default:return arrow}}function routeForward(canvas,from,to,edge,bus){let tx=to.cx,bx=Math.abs(from.cx-tx)<=1?tx:from.cx,by=from.y+from.h-1,headRow=to.y-1;canvas.junction(bx,by,D),canvas.segV(bx,by,bus),bx===tx?canvas.segV(bx,bus,headRow):(canvas.segH(bus,bx,tx),canvas.segV(tx,bus,headRow)),edge.headTo==="none"?canvas.addBits(tx,headRow,U2):canvas.set(tx,headRow,headGlyph(edge.headTo,"\u25BC"),"edge"),edge.headFrom!=="none"&&canvas.set(bx,by,headGlyph(edge.headFrom,"\u25B2"),"edge"),edge.label!==null&&placeLabel(canvas,edge.label,headRow,tx+1)}function routeSelf(canvas,p,edge){let bottom=p.y+p.h-1,exitX=p.cx+1,retX=p.x+p.w-2;if(retX<=exitX||bottom+2>=canvas.h)return;let[v2,h,bl,br]=edge.line==="dotted"?["\u254E","\u254C","\u2570","\u256F"]:edge.line==="thick"?["\u2503","\u2501","\u2517","\u251B"]:["\u2502","\u2500","\u2570","\u256F"];canvas.junction(exitX,bottom,D),canvas.set(exitX,bottom+1,v2,"edge"),canvas.set(exitX,bottom+2,bl,"edge");for(let x2=exitX+1;x2<retX;x2++)canvas.set(x2,bottom+2,h,"edge");canvas.set(retX,bottom+2,br,"edge"),canvas.set(retX,bottom+1,headGlyph(edge.headTo,"\u25B2"),"edge"),edge.label!==null&&placeLabel(canvas,edge.label,bottom+1,p.x+p.w+1)}function routeBack(canvas,from,to,edge,laneX){let sx=from.x+from.w-1,sy=from.cy,tx=to.x+to.w-1,tyc=to.cy;canvas.junction(sx,sy,R2),canvas.segH(sy,sx,laneX),canvas.segV(laneX,sy,tyc),canvas.segH(tyc,tx+1,laneX),edge.headTo==="none"?canvas.addBits(tx+1,tyc,R2):canvas.set(tx+1,tyc,headGlyph(edge.headTo,"\u25C4"),"edge"),edge.headFrom!=="none"&&canvas.set(sx,sy,headGlyph(edge.headFrom,"\u25C4"),"edge"),edge.label!==null&&placeLabel(canvas,edge.label,sat(tyc,1),sat(laneX,stringWidth(edge.label)+1))}function routeForwardLr(canvas,from,to,edge,bus){let rx=from.x+from.w-1,ry=from.cy,ly=to.cy,headCol=to.x-1;canvas.junction(rx,ry,R2),canvas.segH(ry,rx,bus),ry===ly?canvas.segH(ry,bus,headCol):(canvas.segV(bus,ry,ly),canvas.segH(ly,bus,headCol)),edge.headTo==="none"?canvas.addBits(headCol,ly,R2):canvas.set(headCol,ly,headGlyph(edge.headTo,"\u25B6"),"edge"),edge.headFrom!=="none"&&canvas.set(rx,ry,headGlyph(edge.headFrom,"\u25C4"),"edge"),edge.label!==null&&placeLabel(canvas,edge.label,sat(ly,1),bus+1)}function routeBackLr(canvas,from,to,edge,laneY){let sx=from.cx,sy=from.y+from.h-1,tx=to.cx,ty=to.y+to.h-1;canvas.junction(sx,sy,D),canvas.segV(sx,sy,laneY),canvas.segH(laneY,sx,tx),canvas.segV(tx,laneY,ty+1),edge.headTo==="none"?canvas.addBits(tx,ty+1,D):canvas.set(tx,ty+1,headGlyph(edge.headTo,"\u25B2"),"edge"),edge.headFrom!=="none"&&canvas.set(sx,sy,headGlyph(edge.headFrom,"\u25B2"),"edge"),edge.label!==null&&placeLabel(canvas,edge.label,sat(laneY,1),half(sx+tx))}function placeLabel(canvas,label,row,startX){if(row>=canvas.h)return;let text=fitLabel(label,MAX_LABEL),x2=startX;for(let[c2,cw]of measured(text)){if(cw===0)continue;if(x2+cw>canvas.w)break;let blocked=!1;for(let k2=0;k2<cw;k2++){let i=canvas.idx(x2+k2,row);(canvas.ch[i]!==" "||canvas.mask[i]!==0||canvas.occupied[i])&&(blocked=!0)}if(blocked)break;canvas.set(x2,row,c2,"edgeLabel");for(let k2=1;k2<cw;k2++)canvas.set(x2+k2,row,CONT,"edgeLabel");x2+=cw}}var PAD2=1,SEQ_GAP=5,MAX_CANVAS_CELLS2=1<<21,sat2=(a,b2)=>Math.max(0,a-b2),half2=n=>Math.floor(n/2);function noteGeometry(xs,anchor,textW){if(anchor.kind==="over"){let center=half2(xs[anchor.from]+xs[anchor.to]),w2=Math.max(xs[anchor.to]-xs[anchor.from]+5,textW+2*PAD2+2);return{x:sat2(center,half2(w2)),w:w2}}let w=textW+2*PAD2+2;return anchor.kind==="left"?{x:sat2(xs[anchor.at],2+w-1),w}:{x:xs[anchor.at]+2,w}}var itemTextW=text=>text===null?0:stringWidth(text);function layoutSequence(seq){let n=seq.labels.length,labels=seq.labels.map(l3=>fitLabel(l3,WRAP_WIDTH)),boxW=labels.map(l3=>Math.max(1,stringWidth(l3))+2*PAD2+2),boxH=3,gaps=Array.from({length:sat2(n,1)},(_2,i)=>Math.max(SEQ_GAP,Math.ceil(boxW[i]/2)+Math.ceil(boxW[i+1]/2)+1)),reqs=[];for(let item of seq.items)if(item.kind==="message"){let tw=itemTextW(item.text);item.from!==item.to?reqs.push([Math.min(item.from,item.to),Math.max(item.from,item.to),Math.max(tw+2,4)]):item.from+1<n&&reqs.push([item.from,item.from+1,5+tw+2])}else if(item.kind==="note"){let tw=stringWidth(item.text),a=item.anchor;if(a.kind==="over"&&a.from<a.to)reqs.push([a.from,a.to,sat2(tw,1)]);else if(a.kind==="over"){let need=Math.ceil((tw+4)/2)+2;a.from>0&&reqs.push([a.from-1,a.from,need]),a.from+1<n&&reqs.push([a.from,a.from+1,need])}else a.kind==="left"&&a.at>0?reqs.push([a.at-1,a.at,tw+7]):a.kind==="right"&&a.at+1<n&&reqs.push([a.at,a.at+1,tw+7])}reqs.sort((a,b2)=>a[1]-a[0]-(b2[1]-b2[0]));for(let[l3,r,need]of reqs){let cur=0;for(let i=l3;i<r;i++)cur+=gaps[i];cur<need&&(gaps[r-1]+=need-cur)}let xs=new Array(n);xs[0]=half2(boxW[0]);for(let i=1;i<n;i++)xs[i]=xs[i-1]+gaps[i-1];let canvasW=xs[n-1]+Math.ceil(boxW[n-1]/2)+1;for(let item of seq.items)if(item.kind==="message"&&item.from===item.to)canvasW=Math.max(canvasW,xs[item.from]+5+itemTextW(item.text)+1);else if(item.kind==="note"){let g=noteGeometry(xs,item.anchor,stringWidth(item.text));canvasW=Math.max(canvasW,g.x+g.w+1)}else item.kind==="divider"&&(canvasW=Math.max(canvasW,stringWidth(item.text)+4));let rows=[],y2=boxH+1;for(let item of seq.items)rows.push(y2),y2+=rowHeight(item);let bottomTop=y2,canvasH=bottomTop+boxH;if(canvasW*canvasH>MAX_CANVAS_CELLS2)return null;let canvas=new Canvas(canvasW,canvasH);for(let i=0;i<n;i++)for(let by of[0,bottomTop])drawBox(canvas,box(sat2(xs[i],half2(boxW[i])),by,boxW[i],boxH),[labels[i]],"rect");seq.items.forEach((item,k2)=>{if(item.kind!=="note")return;let g=noteGeometry(xs,item.anchor,stringWidth(item.text));drawBox(canvas,box(g.x,rows[k2],g.w,3),[item.text],"rect")});for(let x2 of xs)canvas.junction(x2,boxH-1,D),canvas.segV(x2,boxH,bottomTop-1),canvas.junction(x2,bottomTop,U2);return seq.items.forEach((item,k2)=>{let r=rows[k2];item.kind==="message"?drawMessage(canvas,item,xs,r):item.kind==="divider"&&drawDivider(canvas,item.text,r,canvasW)}),canvas.finalizeMask(),canvas}function rowHeight(item){return item.kind==="note"?4:item.kind==="divider"?2:item.from===item.to?4:item.text!==null?3:2}var box=(x2,y2,w,h)=>({x:x2,y:y2,w,h,cx:x2+half2(w),cy:y2+1,rank:0});function drawMessage(canvas,item,xs,r){let lineCh=item.dashed?"\u254C":"\u2500";if(item.from===item.to){let x2=xs[item.from];canvas.junction(x2,r,R2),canvas.set(x2+1,r,lineCh,"edge"),canvas.set(x2+2,r,lineCh,"edge"),canvas.set(x2+3,r,"\u256E","edge"),canvas.set(x2+3,r+1,"\u2502","edge"),canvas.set(x2+1,r+2,item.head==="cross"?"\xD7":"\u25C4","edge"),canvas.set(x2+2,r+2,lineCh,"edge"),canvas.set(x2+3,r+2,"\u256F","edge"),item.text!==null&&drawTextOverEdges(canvas,item.text,x2+5,r+1,"text");return}let x0=xs[item.from],x1=xs[item.to],rightward=x1>x0,arrowRow=item.text!==null?r+1:r,lo=Math.min(x0,x1),hi=Math.max(x0,x1);canvas.junction(x0,arrowRow,rightward?R2:L2);for(let x2=lo+1;x2<hi;x2++)canvas.set(x2,arrowRow,lineCh,"edge");let headCh=item.head==="cross"?"\xD7":rightward?"\u25B6":"\u25C4";if(canvas.set(rightward?x1-1:x1+1,arrowRow,headCh,"edge"),item.text!==null){let span=hi-lo-1,t=fitLabel(item.text,Math.max(1,span));drawTextOverEdges(canvas,t,lo+1+half2(sat2(span,stringWidth(t))),r,"text")}}function drawDivider(canvas,text,r,canvasW){for(let x2=0;x2<canvasW;x2++)canvas.set(x2,r,"\u2500","edge");drawTextOverEdges(canvas,` ${fitLabel(text,sat2(canvasW,4))} `,2,r,"edgeLabel")}function flushStatement(cur,out){let trimmed=cur.trim();return trimmed!==""&&out.push(trimmed),""}function splitStatements(line,out){let chars=[...line],cur="",inQuotes=!1;for(let i=0;i<chars.length;i++){let c2=chars[i];if(inQuotes)c2==='"'&&(inQuotes=!1),cur+=c2;else if(c2==='"')inQuotes=!0,cur+=c2;else{if(c2==="%"&&chars[i+1]==="%")break;c2===";"?cur=flushStatement(cur,out):cur+=c2}}flushStatement(cur,out)}function statementsOf(src){let out=[];for(let line of srcLines(src))splitStatements(line,out);return out}var firstWord=s=>s.split(/\s+/).filter(w=>w!=="")[0]??"",words=s=>s.split(/\s+/).filter(w=>w!=="");function splitOnce(s,sep11){let i=s.indexOf(sep11);return i===-1?null:[s.slice(0,i),s.slice(i+sep11.length)]}var nonEmpty=s=>s===""?null:s;function headerKind(statements){let header=statements[0];if(header===void 0)return null;let kind=firstWord(header);return kind===""?null:asciiLower(kind)}function diagramKind(src){let kind=headerKind(statementsOf(src));return kind===null?null:kind==="graph"||kind==="flowchart"?"flowchart":kind.startsWith("statediagram")?"state":kind.startsWith("classdiagram")?"class":kind==="erdiagram"?"er":kind==="sequencediagram"?"sequence":null}function parseGraph(src){let statements=statementsOf(src),kind=headerKind(statements);if(kind!=="graph"&&kind!=="flowchart")return null;let graph=new Graph(parseDir(words(statements[0])[1]??"TB")),stack=[];for(let st2 of statements.slice(1)){switch(asciiLower(firstWord(st2))){case"subgraph":{if(graph.groups.length>=MAX_GROUPS||stack.length>=MAX_GROUP_DEPTH)return null;let[id,label]=parseSubgraphDecl(st2.slice(8).trim());graph.groups.push({id,label,parent:stack.at(-1)??null}),stack.push(graph.groups.length-1),graph.curGroup=stack.at(-1)??null;continue}case"end":stack.pop(),graph.curGroup=stack.at(-1)??null;continue;case"classdef":case"class":case"style":case"linkstyle":case"click":case"direction":continue;default:break}if(parseStatement(st2,graph),graph.overCap)return null}return graph.nodes.length===0?null:graph}function parseSubgraphDecl(rest){if(rest.startsWith('"')){let close=rest.indexOf('"',1);if(close!==-1){let label=rest.slice(1,close);return[label,decodeHtmlEntities(label)]}}let open2=rest.indexOf("[");if(open2!==-1){let id=rest.slice(0,open2).trim(),label=cleanLabel(rest.slice(open2+1).replace(/\]+$/,"").trim());if(id!==""&&label!=="")return[id,label]}return[rest,rest]}function parseStatement(st2,graph){let chars=[...st2],i=0,head=parseNodeGroup(chars,i,graph);if(!head){graph.warnings.push(`dropped, does not start with a node: "${st2}"`);return}let prev=head.group;for(i=head.next;i=skipSpaces(chars,i),!(i>=chars.length);){let link=parseLink(chars,i);if(!link){graph.warnings.push(`dropped, expected a link: "${chars.slice(i).join("")}"`);break}i=skipSpaces(chars,link.next);let target=parseNodeGroup(chars,i,graph);if(!target){graph.warnings.push(`dropped, link has no target: "${st2}"`);break}i=target.next;for(let f2 of prev)for(let t of target.group){let reversed=link.left==="arrow"&&link.right!=="arrow";if(!graph.pushEdge({from:reversed?t:f2,to:reversed?f2:t,label:link.label,headTo:reversed?"arrow":link.right,headFrom:reversed?link.right:link.left,line:link.line}))return}prev=target.group}}function parseNodeGroup(chars,start,graph){let first=parseNode(chars,start,graph);if(!first)return null;let group=[first.index],i=first.next;for(;;){let j2=skipSpaces(chars,i);if(chars[j2]!=="&")break;let next=parseNode(chars,j2+1,graph);if(!next)return null;group.push(next.index),i=next.next}return{group,next:i}}function skipSpaces(chars,i){for(;i<chars.length&&(chars[i]===" "||chars[i]===" ");)i++;return i}function parseNode(chars,start,graph){let i=skipSpaces(chars,start),idStart=i;for(;i<chars.length&&isIdChar(chars[i]);)i++;if(i===idStart)return null;let id=chars.slice(idStart,i).join(""),shaped=readShapeAt(chars,i);shaped.unclosed!==void 0&&graph.warnings.push(`node "${id}": label is missing its closing \`${shaped.unclosed}\``);let index3=graph.nodeIndex(id,shaped.label,shaped.shape);if(index3===null)return null;let next=shaped.after;if(chars[next]===":"&&chars[next+1]===":"&&chars[next+2]===":"){let k2=next+3;for(;k2<chars.length&&(isIdChar(chars[k2])||chars[k2]==="-");)k2++;for(;k2>next+3&&chars[k2-1]==="-";)k2--;k2>next+3&&(next=k2)}return{index:index3,next}}function readShapeAt(chars,i){let c2=chars[i],n=chars[i+1];return c2==="["?n==="["?readShape(chars,i+2,"]]","rect"):n==="("?readShape(chars,i+2,")]","round"):readShape(chars,i+1,"]","rect"):c2==="("?n==="("?readShape(chars,i+2,"))","round"):n==="["?readShape(chars,i+2,"])","round"):readShape(chars,i+1,")","round"):c2==="{"?n==="{"?readShape(chars,i+2,"}}","diamond"):readShape(chars,i+1,"}","diamond"):c2===">"?readShape(chars,i+1,"]","rect"):{shape:"rect",label:null,after:i}}function readShape(chars,start,closer,shape){let j2=start;for(;chars[j2]===" "||chars[j2]===" ";)j2++;let quoted=chars[j2]==='"',i=start,text="",inQuotes=!1;for(;i<chars.length;){let c2=chars[i];if(quoted&&c2==='"'){inQuotes=!inQuotes,text+=c2,i++;continue}if(!inQuotes&&chars.slice(i,i+closer.length).join("")===closer)return{shape,label:cleanLabel(text),after:i+closer.length};text+=c2,i++}return{shape,label:cleanLabel(text),after:chars.length,unclosed:closer}}var isLinkChar=c2=>c2==="-"||c2==="."||c2==="="||c2==="<"||c2===">";function parseLink(chars,start){let i=skipSpaces(chars,start),left="none";(chars[i]==="o"||chars[i]==="x")&&(chars[i+1]==="-"||chars[i+1]==="."||chars[i+1]==="=")&&(left=chars[i]==="o"?"circle":"cross",i++);let opStart=i;for(;i<chars.length&&isLinkChar(chars[i]);)i++;if(i===opStart)return null;let op1=chars.slice(opStart,i).join("");left==="none"&&op1.startsWith("<")&&(left="arrow");let line=lineKind(op1),right=op1.includes(">")?"arrow":"none";if(right==="none"){let trailing=trailingHead(chars,i);trailing&&(right=trailing.head,i=trailing.next)}if(chars[i]==="|"){i++;let lStart=i;for(;i<chars.length&&chars[i]!=="|";)i++;let label=cleanLabel(chars.slice(lStart,i).join(""));return chars[i]==="|"&&i++,{left,right,line,label:nonEmpty(label),next:i}}if(right==="none"){let textStart=skipSpaces(chars,i),j2=textStart;for(;j2<chars.length&&!isLinkChar(chars[j2]);)j2++;if(j2<chars.length&&j2>textStart&&chars[j2]!=="<"){let text=chars.slice(textStart,j2).join(""),op2Start=j2;for(;j2<chars.length&&isLinkChar(chars[j2]);)j2++;let op2=chars.slice(op2Start,j2).join("");if(op2.includes(">"))right="arrow";else{let trailing=trailingHead(chars,j2);trailing&&(right=trailing.head,j2=trailing.next)}return line==="solid"&&(line=lineKind(op2)),{left,right,line,label:nonEmpty(cleanLabel(text)),next:j2}}}return{left,right,line,label:null,next:i}}function lineKind(op){return op.includes("=")?"thick":op.includes(".")?"dotted":"solid"}function trailingHead(chars,i){let head=chars[i]==="o"?"circle":chars[i]==="x"?"cross":null;if(head===null)return null;let after=chars[i+1];return after===void 0||after===" "||after===" "||after==="|"||after==="&"||after===";"?{head,next:i+1}:null}function parseState(src){let statements=statementsOf(src),kind=headerKind(statements);if(kind===null||!kind.startsWith("statediagram"))return null;let graph=new Graph,inNote=!1;for(let st2 of statements.slice(1)){if(inNote){asciiLower(st2)==="end note"&&(inNote=!1);continue}st2=dropStyleTags(st2);let first=asciiLower(firstWord(st2));if(first==="direction")graph.dir=parseDir(words(st2)[1]??"");else if(first==="note")st2.includes(":")||(inNote=!0);else if(first==="state"){if(parseStateDecl(st2,graph)===null)return null}else if(!["classdef","class","hide","scale","}","--"].includes(first)){if(st2.includes("-->")){if(parseTransition(st2,graph)===null)return null}else if(parseStateDesc(st2,graph)===null)return null}if(graph.overCap)return null}return graph.nodes.length===0?null:graph}function parseStateDecl(st2,graph){let rest=st2.slice(5).trim().replace(/\{$/,"").trim();if(rest==="")return!0;if(rest.startsWith('"')){let close=rest.indexOf('"',1);if(close===-1)return null;let label=rest.slice(1,close),after=rest.slice(close+1).trim(),id2=after.startsWith("as")?after.slice(2).trim():label;return graph.nodeLabel(id2,decodeHtmlEntities(label))===null?null:!0}let shape="round",id=rest,stereotyped=!1,pos=rest.indexOf("<<");return pos!==-1&&(rest.slice(pos+2).replace(/>>$/,"").trim()==="choice"&&(shape="diamond"),id=rest.slice(0,pos).trim(),stereotyped=!0),id===""||/\s/.test(id)||graph.nodeIndex(id,stereotyped?id:null,shape)===null?null:!0}function parseTransition(st2,graph){let rest=st2,prev=null;for(;;){let split=splitOnce(rest,"-->");if(!split)break;let[lhs,rhs]=split,fromId=lhs.trimEnd().replace(/-+$/,"").trim(),from;if(prev!==null){if(fromId!=="")return null;from=prev}else{if(fromId==="")return null;let f2=stateEndpoint(graph,fromId,!0);if(f2===null)return null;from=f2}let nextArrow=rhs.indexOf("-->"),toPartRaw=nextArrow===-1?rhs:rhs.slice(0,nextArrow),tail=nextArrow===-1?"":rhs.slice(nextArrow),colon=splitOnce(toPartRaw,":"),toPart=colon?colon[0]:toPartRaw,label=colon?nonEmpty(decodeHtmlEntities(colon[1].trim())):null,toId=toPart.trimStart().replace(/^>+/,"").trimEnd().replace(/-+$/,"").trim();if(toId==="")return null;let to=stateEndpoint(graph,toId,!1);if(to===null)return null;if(!graph.pushEdge({from,to,label,headTo:"arrow",headFrom:"none",line:"solid"}))return!0;prev=to,rest=tail}return!0}function dropStyleTags(st2){let chars=[...st2],out=[];for(let i=0;i<chars.length;){if(chars[i]===":"&&chars[i+1]===":"&&chars[i+2]===":"){let k2=i+3;for(;k2<chars.length&&(isIdChar(chars[k2])||chars[k2]==="-");)k2++;for(;k2>i+3&&chars[k2-1]==="-";)k2--;if(k2>i+3){i=k2;continue}}out.push(chars[i]),i++}return out.join("")}function stateEndpoint(graph,id,isSource){return id==="[*]"?graph.nodeIndex(isSource?"[*]start":"[*]end","\u25CF","round"):graph.nodeIndex(id,null,"round")}function parseStateDesc(st2,graph){let split=splitOnce(st2,":");if(split){let id=split[0].trim(),desc=split[1].trim();return id===""||/\s/.test(id)||desc===""||graph.nodeLabel(id,decodeHtmlEntities(desc))===null?null:!0}return/\s/.test(st2)||graph.nodeIndex(st2,null,"round")===null?null:!0}var CLASS_OPS=[["<|--","triangle","none","solid"],["--|>","none","triangle","solid"],["<|..","triangle","none","dotted"],["..|>","none","triangle","dotted"],["*--","diamondFill","none","solid"],["--*","none","diamondFill","solid"],["o--","diamondOpen","none","solid"],["--o","none","diamondOpen","solid"],["<--","arrow","none","solid"],["-->","none","arrow","solid"],["<..","arrow","none","dotted"],["..>","none","arrow","dotted"],["--","none","none","solid"],["..","none","none","dotted"]],MAX_CLASS_OP=4;function parseClass2(src){let statements=statementsOf(src),kind=headerKind(statements);if(kind===null||!kind.startsWith("classdiagram"))return null;let graph=new Graph,infos=[],sync=()=>{for(;infos.length<graph.nodes.length;)infos.push(emptyClassInfo())},declare=name=>{let idx=graph.nodeIndex(name,null,"rect");return sync(),idx},curClass=null;for(let st2 of statements.slice(1)){if(curClass!==null){st2==="}"?curClass=null:pushMember(infos[curClass],st2);continue}st2=dropStyleTags(st2);let first=asciiLower(firstWord(st2));if(first==="direction"){graph.dir=parseDir(words(st2)[1]??"");continue}if(["note","callback","click","link","style","cssclass","classdef","namespace","}"].includes(first))continue;if(first==="class"){let rest=st2.slice(5).trim(),open2=rest.endsWith("{"),name=open2?rest.slice(0,-1).trim():rest;if(name===""||/\s/.test(name))return null;let idx=declare(name);if(idx===null)return null;open2&&(curClass=idx);continue}if(st2.startsWith("<<")){let split=splitOnce(st2.slice(2),">>");if(!split)return null;let name=split[1].trim();if(name===""||/\s/.test(name))return null;let idx=declare(name);if(idx===null)return null;infos[idx].annotation=split[0].trim();continue}let rel=parseClassRelation(st2);if(rel){let f2=declare(rel.from);if(f2===null)return null;let t=declare(rel.to);if(t===null||graph.edges.length>=MAX_EDGES)return null;graph.edges.push({from:f2,to:t,label:rel.label,headTo:rel.headTo,headFrom:rel.headFrom,line:rel.line});continue}let member=splitOnce(st2,":");if(member){let id=member[0].trim(),text=member[1].trim();if(id===""||/\s/.test(id)||text==="")return null;let idx=declare(id);if(idx===null)return null;pushMember(infos[idx],text);continue}return null}return graph.nodes.length===0?null:(sync(),{graph,infos})}function pushMember(info,raw){if(raw.startsWith("<<")){let split=splitOnce(raw.slice(2),">>");split&&(info.annotation=split[0].trim());return}let member=decodeHtmlEntities(displayGenerics2(raw.trim())),list2=member.includes("(")?info.methods:info.attrs;list2.length<MAX_MEMBERS?list2.push(member):list2.length===MAX_MEMBERS&&list2.push("\u2026")}function parseClassRelation(st2){let chars=[...st2],found=null;outer:for(let pos=0;pos<chars.length;pos++){let tail=chars.slice(pos,pos+MAX_CLASS_OP).join("");for(let[op,headFrom,headTo,line]of CLASS_OPS){if(!tail.startsWith(op)||op.startsWith("o")&&pos>0&&isIdChar(chars[pos-1]))continue;let after=chars[pos+[...op].length];if(!(op.endsWith("o")&&after!==void 0&&isIdChar(after))){found={pos,op,headFrom,headTo,line};break outer}}}if(!found)return null;let lhsRaw=chars.slice(0,found.pos).join("").trim(),rhsRaw=chars.slice(found.pos+[...found.op].length).join("").trim(),[lhs,cardFrom]=stripCardinalitySuffix(lhsRaw),[rhs,cardTo]=stripCardinalityPrefix(rhsRaw),split=splitOnce(rhs,":"),toId=(split?split[0]:rhs).trim(),relLabel=split?nonEmpty(decodeHtmlEntities(split[1].trim())):null;if(lhs===""||toId===""||/\s/.test(lhs)||/\s/.test(toId))return null;let label=nonEmpty([cardFrom,relLabel??"",cardTo].filter(s=>s!=="").join(" "));return{from:lhs,to:toId,headFrom:found.headFrom,headTo:found.headTo,line:found.line,label}}function stripCardinalitySuffix(s){let t=s.trimEnd();if(t.endsWith('"')){let rest=t.slice(0,-1),q2=rest.lastIndexOf('"');if(q2!==-1)return[rest.slice(0,q2).trimEnd(),rest.slice(q2+1)]}return[t,""]}function stripCardinalityPrefix(s){let t=s.trimStart();if(t.startsWith('"')){let rest=t.slice(1),q2=rest.indexOf('"');if(q2!==-1)return[rest.slice(q2+1).trimStart(),rest.slice(0,q2)]}return[t,""]}function displayGenerics2(s){let out="",open2=!1;for(let c2 of s)c2==="~"?(out+=open2?">":"<",open2=!open2):out+=c2;return out}function parseEr(src){let statements=statementsOf(src);if(headerKind(statements)!=="erdiagram")return null;let graph=new Graph,infos=[],curEntity=null;for(let st2 of statements.slice(1)){if(curEntity!==null){st2==="}"?curEntity=null:pushErAttribute(infos[curEntity],st2);continue}let rel=splitErRelationship(st2);if(rel){let tokens=words(rel.rel);if(tokens.length!==3)return null;let op=parseErOp(tokens[1]);if(!op)return null;let f2=erEntity(graph,infos,tokens[0]);if(f2===null)return null;let t=erEntity(graph,infos,tokens[2]);if(t===null||graph.edges.length>=MAX_EDGES)return null;let relLabel=rel.label===null?"":cleanLabel(rel.label);graph.edges.push({from:f2,to:t,label:nonEmpty([op.cardL,relLabel,op.cardR].filter(s=>s!=="").join(" ")),headTo:"none",headFrom:"none",line:op.line});continue}let open2=st2.endsWith("{"),decl=open2?st2.slice(0,-1).trim():st2;if(decl===""||words(decl).length!==1)return null;let idx=erEntity(graph,infos,decl);if(idx===null)return null;open2&&(curEntity=idx)}if(graph.nodes.length===0)return null;for(;infos.length<graph.nodes.length;)infos.push(emptyClassInfo());return{graph,infos}}function erEntity(graph,infos,token){let open2=token.indexOf("["),idx;if(open2!==-1){let id=token.slice(0,open2),label=cleanLabel(token.slice(open2+1).replace(/\]+$/,""));if(id===""||label==="")return null;idx=graph.nodeLabel(id,label)}else idx=graph.nodeIndex(token,null,"rect");if(idx===null)return null;for(;infos.length<graph.nodes.length;)infos.push(emptyClassInfo());return idx}function splitErRelationship(st2){let split=splitOnce(st2,":"),rel=split?split[0]:st2,label=split?split[1].trim():null;return words(rel).some(t=>parseErOp(t)!==null)?{rel,label}:null}var isAscii=s=>{for(let i=0;i<s.length;i++)if(s.charCodeAt(i)>127)return!1;return!0};function parseErOp(tok){if(tok.length!==6||!isAscii(tok))return null;let mid=tok.slice(2,4),line=mid==="--"?"solid":mid===".."?"dotted":null;if(line===null)return null;let cardL=erCard(tok.slice(0,2)),cardR=erCard(tok.slice(4,6));return cardL===null||cardR===null?null:{cardL,cardR,line}}function erCard(tok){switch(tok){case"|o":case"o|":return"0..1";case"||":return"1";case"}o":case"o{":return"0..*";case"}|":case"|{":return"1..*";default:return null}}function pushErAttribute(info,raw){let parts=[];for(let tok of words(raw)){if(tok.startsWith('"'))break;parts.push(tok)}if(parts.length===0)return;let line=decodeHtmlEntities(parts.join(" "));info.attrs.length<MAX_MEMBERS?info.attrs.push(line):info.attrs.length===MAX_MEMBERS&&info.attrs.push("\u2026")}var SEQ_OPS=[["-->>",!0,"arrow"],["->>",!1,"arrow"],["--x",!0,"cross"],["-x",!1,"cross"],["--)",!0,"arrow"],["-)",!1,"arrow"],["-->",!0,"arrow"],["->",!1,"arrow"]],MAX_SEQ_OP=4,Sequence=class{labels=[];index=new Map;items=[];participant(id,label){let existing=this.index.get(id);return existing!==void 0?(label!==null&&(this.labels[existing]=label),existing):this.labels.length>=MAX_NODES?null:(this.index.set(id,this.labels.length),this.labels.push(label??id),this.labels.length-1)}};function parseSequence(src){let statements=statementsOf(src);if(headerKind(statements)!=="sequencediagram")return null;let seq=new Sequence,autonumber=!1,msgCount=0,blocks=[];for(let st2 of statements.slice(1)){let first=firstWord(st2),lower=asciiLower(first);if(lower==="participant"||lower==="actor"){let rest=st2.slice(first.length).trim();if(rest==="")return null;let as=splitOnce(rest," as ");if(seq.participant(as?as[0].trim():rest,as?cleanLabel(as[1]):null)===null)return null;continue}if(lower==="autonumber"){autonumber=!0;continue}if(["activate","deactivate","create","destroy","title","acctitle","accdescr","links","link","properties"].includes(lower))continue;if(lower==="note"){let note=parseNoteAnchor(st2.slice(first.length).trim(),seq);if(!note||seq.items.length>=MAX_EDGES)return null;seq.items.push({kind:"note",anchor:note.anchor,text:note.text});continue}if(["loop","alt","opt","par","critical","break","else","and","option"].includes(lower)){if(["else","and","option"].includes(lower)){if(blocks.at(-1)!==!0)continue}else blocks.push(!0);if(seq.items.length>=MAX_EDGES)return null;seq.items.push({kind:"divider",text:decodeHtmlEntities(st2)});continue}if(lower==="rect"||lower==="box"){blocks.push(!1);continue}if(lower==="end"){if(blocks.pop()===!0){if(seq.items.length>=MAX_EDGES)return null;seq.items.push({kind:"divider",text:"end"})}continue}let msg=parseSeqMessage(st2,seq);if(!msg)return null;let text=msg.text;if(autonumber&&(msgCount++,text=text===null?`${msgCount}.`:`${msgCount}. ${text}`),seq.items.length>=MAX_EDGES)return null;seq.items.push({kind:"message",from:msg.from,to:msg.to,text,dashed:msg.dashed,head:msg.head})}return seq.labels.length===0?null:seq}function parseNoteAnchor(rest,seq){let lower=asciiLower(rest),kind,idsAndText;if(lower.startsWith("over "))kind="over",idsAndText=rest.slice(5);else if(lower.startsWith("left of "))kind="left",idsAndText=rest.slice(8);else if(lower.startsWith("right of "))kind="right",idsAndText=rest.slice(9);else return null;let split=splitOnce(idsAndText,":");if(!split)return null;let text=decodeHtmlEntities(split[1].trim()),parts=split[0].split(",").map(s=>s.trim()).filter(s=>s!=="");if(parts.length===0)return null;let a=seq.participant(parts[0],null);if(a===null)return null;if(kind!=="over")return{text,anchor:{kind,at:a}};let b2=a;if(parts[1]!==void 0){let second=seq.participant(parts[1],null);if(second===null)return null;b2=second}return{text,anchor:{kind:"over",from:Math.min(a,b2),to:Math.max(a,b2)}}}function parseSeqMessage(st2,seq){let chars=[...st2],found=null;outer:for(let pos=0;pos<chars.length;pos++){let tail=chars.slice(pos,pos+MAX_SEQ_OP).join("");for(let[op,dashed,head]of SEQ_OPS)if(tail.startsWith(op)){found={pos,op,dashed,head};break outer}}if(!found)return null;let fromId=chars.slice(0,found.pos).join("").trim();if(fromId==="")return null;let rest=chars.slice(found.pos+[...found.op].length).join("").trimStart().replace(/^[+-]+/,""),split=splitOnce(rest,":"),toId=(split?split[0]:rest).trim(),text=split?nonEmpty(decodeHtmlEntities(split[1].trim())):null;if(toId==="")return null;let from=seq.participant(fromId,null);if(from===null)return null;let to=seq.participant(toId,null);return to===null?null:{from,to,text,dashed:found.dashed,head:found.head}}function render(src){if(src=stripControls(src),src.trim()==="")return null;let drawn=attempt(src);return drawn===null?null:{...drawn.canvas.toLines(),warnings:drawn.warnings}}function attempt(src){let drawn=draw(src);if(drawn!==null)return drawn;let body=src.replace(/\s+$/,""),cut=body.lastIndexOf(`
|
|
1336
1336
|
`);if(cut===-1)return null;let salvaged=draw(body.slice(0,cut));if(salvaged===null)return null;let dropped=body.slice(cut+1).trim();return{canvas:salvaged.canvas,warnings:[...salvaged.warnings,`dropped, unreadable final line: "${dropped}"`]}}function draw(src){let plain=canvas=>canvas===null?null:{canvas,warnings:[]};switch(diagramKind(src)){case"flowchart":{let graph=parseGraph(src);if(graph===null)return null;let canvas=graph.groups.length===0?layoutFlowchart(graph):layoutGrouped(graph);return canvas===null?null:{canvas,warnings:graph.warnings}}case"state":{let state2=parseState(src);return state2===null?null:plain(layoutFlowchart(state2))}case"class":{let cls=parseClass2(src);return cls===null?null:plain(layoutClass(cls.graph,cls.infos))}case"er":{let er=parseEr(src);return er===null?null:plain(layoutClass(er.graph,er.infos))}case"sequence":{let seq=parseSequence(src);return seq===null?null:plain(layoutSequence(seq))}default:return null}}var markdownParser2=new Z;function isMermaid(token){return token.type==="code"&&token.lang?.trim().split(/\s+/,1)[0]?.toLowerCase()==="mermaid"}function codeSpan(line){let content=line||"\xA0",longestBacktickRun=Math.max(0,...Array.from(content.matchAll(/`+/g),match2=>match2[0].length)),fence="`".repeat(longestBacktickRun+1),padding=content.startsWith("`")||content.endsWith("`")?" ":"";return`${fence}${padding}${content}${padding}${fence}`}function styleSpan(span,theme2){switch(span.cls){case"border":return theme2.fg("borderMuted",span.text);case"text":return theme2.fg("text",span.text);case"edge":return theme2.fg("accent",span.text);case"edgeLabel":return theme2.fg("muted",span.text);case"title":return theme2.fg("accent",theme2.bold(span.text));case"none":return span.text}}function themedLines(art,theme2){return art.styled.map(row=>row.map(span=>styleSpan(span,theme2)).join(""))}function createMermaidMarkdownTransformer(options){return(markdown,context)=>{let mode=options.getMode();return mode==="off"||context.messageType==="assistant-thinking"||context.isStreaming&&mode!=="streaming"?markdown:markdownParser2.lexer(markdown).map(token=>{if(!isMermaid(token))return token.raw;let art=render(token.text);if(!art||art.width>context.availableWidth)return token.raw;if(!context.isStreaming&&art.warnings.length>0){let suffix=art.warnings.length>1?` (+${art.warnings.length-1} more)`:"",warning=`Mermaid diagram not rendered: ${art.warnings[0]}${suffix}`,styledWarning=options.theme?options.theme.fg("warning",warning):warning;return`${token.raw}
|
|
1337
1337
|
${codeSpan(styledWarning)}
|
package/dist/bundle/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
3
|
-
import{DISPLAY_NAME,aliasZcodeEnv,configureHttpDispatcher,main}from"./chunks/chunk-
|
|
3
|
+
import{DISPLAY_NAME,aliasZcodeEnv,configureHttpDispatcher,main}from"./chunks/chunk-RGARQVSZ.js";import"./chunks/chunk-XDUWOHPL.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-RCZIEVGO.js";import"./chunks/chunk-A3JYRWB6.js";import"./chunks/chunk-4L3WN2XY.js";function setupCli(){process.title=DISPLAY_NAME,process.env.PI_CODING_AGENT="true",process.env.HUMMIN_CODING_AGENT="true",process.env.AI_AGENT="hummin",aliasZcodeEnv(),process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();main(process.argv.slice(2));
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildSessionContext,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,resolveToCwd,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,withLocalInferenceLock,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-
|
|
2
|
+
import{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildSessionContext,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,resolveToCwd,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,withLocalInferenceLock,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-RGARQVSZ.js";import"./chunks/chunk-XDUWOHPL.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-RCZIEVGO.js";import"./chunks/chunk-A3JYRWB6.js";import"./chunks/chunk-4L3WN2XY.js";export{AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildSessionContext,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,resolveToCwd,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,withLocalInferenceLock,wrapRegisteredTool,wrapRegisteredTools};
|
package/dist/bundle/rpc-entry.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
3
|
-
import{DISPLAY_NAME,aliasZcodeEnv,configureHttpDispatcher,main}from"./chunks/chunk-
|
|
3
|
+
import{DISPLAY_NAME,aliasZcodeEnv,configureHttpDispatcher,main}from"./chunks/chunk-RGARQVSZ.js";import"./chunks/chunk-XDUWOHPL.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-RCZIEVGO.js";import"./chunks/chunk-A3JYRWB6.js";import"./chunks/chunk-4L3WN2XY.js";process.title=`${DISPLAY_NAME}-rpc`;process.env.PI_CODING_AGENT="true";process.env.HUMMIN_CODING_AGENT="true";process.env.AI_AGENT="hummin";aliasZcodeEnv();process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hummin-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"bin": {
|
|
6
6
|
"hummin": "dist/bundle/cli.js"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"piConfig": {
|
|
56
56
|
"name": "hummin",
|
|
57
57
|
"configDir": ".hummin",
|
|
58
|
-
"version": "1.0.
|
|
58
|
+
"version": "1.0.5",
|
|
59
59
|
"displayName": "hummin",
|
|
60
60
|
"checkNewVersion": false,
|
|
61
61
|
"remoteCatalog": false
|