@mariozechner/pi-coding-agent 0.42.4 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +14 -9
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts +4 -2
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session.d.ts +14 -8
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +37 -15
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +3 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +9 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +25 -14
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +10 -4
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/session-manager.d.ts +11 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +142 -64
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +7 -3
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +15 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +13 -12
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +8 -8
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +1 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +47 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +241 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +17 -3
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +167 -35
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +13 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +2 -2
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +8 -7
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +249 -37
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +2 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +4 -4
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +6 -6
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +11 -8
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +4 -4
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/extensions.md +45 -12
- package/docs/rpc.md +10 -10
- package/docs/sdk.md +10 -5
- package/docs/session.md +1 -1
- package/docs/skills.md +27 -0
- package/docs/tree.md +9 -5
- package/docs/tui.md +2 -0
- package/examples/extensions/README.md +3 -3
- package/examples/extensions/confirm-destructive.ts +5 -5
- package/examples/extensions/dirty-repo-guard.ts +2 -2
- package/examples/extensions/git-checkpoint.ts +3 -3
- package/examples/extensions/handoff.ts +1 -1
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/todo.ts +1 -1
- package/examples/extensions/tools.ts +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/11-sessions.ts +1 -1
- package/package.json +4 -4
- package/dist/utils/fuzzy.d.ts +0 -7
- package/dist/utils/fuzzy.d.ts.map +0 -1
- package/dist/utils/fuzzy.js +0 -86
- package/dist/utils/fuzzy.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.43.0] - 2026-01-11
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- Extension editor (`ctx.ui.editor()`) now uses Enter to submit and Shift+Enter for newlines, matching the main editor. Previously used Ctrl+Enter to submit. Extensions with hardcoded "ctrl+enter" hints need updating. ([#642](https://github.com/badlogic/pi-mono/pull/642) by [@mitsuhiko](https://github.com/mitsuhiko))
|
|
8
|
+
- Renamed `/branch` command to `/fork` ([#641](https://github.com/badlogic/pi-mono/issues/641))
|
|
9
|
+
- RPC: `branch` → `fork`, `get_branch_messages` → `get_fork_messages`
|
|
10
|
+
- SDK: `branch()` → `fork()`, `getBranchMessages()` → `getForkMessages()`
|
|
11
|
+
- AgentSession: `branch()` → `fork()`, `getUserMessagesForBranching()` → `getUserMessagesForForking()`
|
|
12
|
+
- Extension events: `session_before_branch` → `session_before_fork`, `session_branch` → `session_fork`
|
|
13
|
+
- Settings: `doubleEscapeAction: "branch" | "tree"` → `"fork" | "tree"`
|
|
14
|
+
- `SessionManager.list()` and `SessionManager.listAll()` are now async, returning `Promise<SessionInfo[]>`. Callers must await them. ([#620](https://github.com/badlogic/pi-mono/pull/620) by [@tmustier](https://github.com/tmustier))
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `/resume` selector now toggles between current-folder and all sessions with Tab, showing the session cwd in the All view and loading progress. ([#620](https://github.com/badlogic/pi-mono/pull/620) by [@tmustier](https://github.com/tmustier))
|
|
18
|
+
- `SessionManager.list()` and `SessionManager.listAll()` accept optional `onProgress` callback for progress updates
|
|
19
|
+
- `SessionInfo.cwd` field containing the session's working directory (empty string for old sessions)
|
|
20
|
+
- `SessionListProgress` type export for progress callbacks
|
|
21
|
+
- `/scoped-models` command to enable/disable models for Ctrl+P cycling. Changes are session-only by default; press Ctrl+S to persist to settings.json. ([#626](https://github.com/badlogic/pi-mono/pull/626) by [@CarlosGtrz](https://github.com/CarlosGtrz))
|
|
22
|
+
- `model_select` extension hook fires when model changes via `/model`, model cycling, or session restore with `source` field and `previousModel` ([#628](https://github.com/badlogic/pi-mono/pull/628) by [@marckrenn](https://github.com/marckrenn))
|
|
23
|
+
- `ctx.ui.setWorkingMessage()` extension API to customize the "Working..." message during streaming ([#625](https://github.com/badlogic/pi-mono/pull/625) by [@nicobailon](https://github.com/nicobailon))
|
|
24
|
+
- Skill slash commands: loaded skills are registered as `/skill:name` commands for quick access. Toggle via `/settings` or `skills.enableSkillCommands` in settings.json. ([#630](https://github.com/badlogic/pi-mono/pull/630) by [@Dwsy](https://github.com/Dwsy))
|
|
25
|
+
- Slash command autocomplete now uses fuzzy matching (type `/skbra` to match `/skill:brave-search`)
|
|
26
|
+
- `/tree` branch summarization now offers three options: "No summary", "Summarize", and "Summarize with custom prompt". Custom prompts are appended as additional focus to the default summarization instructions. ([#642](https://github.com/badlogic/pi-mono/pull/642) by [@mitsuhiko](https://github.com/mitsuhiko))
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Session picker respects custom keybindings when using `--resume` ([#633](https://github.com/badlogic/pi-mono/pull/633) by [@aos](https://github.com/aos))
|
|
31
|
+
- Custom footer extensions now see model changes: `ctx.model` is now a getter that returns the current model instead of a snapshot from when the context was created ([#634](https://github.com/badlogic/pi-mono/pull/634) by [@ogulcancelik](https://github.com/ogulcancelik))
|
|
32
|
+
- Footer git branch not updating after external branch switches. Git uses atomic writes (temp file + rename), which changes the inode and breaks `fs.watch` on the file. Now watches the directory instead.
|
|
33
|
+
- Extension loading errors are now displayed to the user instead of being silently ignored ([#639](https://github.com/badlogic/pi-mono/pull/639) by [@aliou](https://github.com/aliou))
|
|
34
|
+
|
|
35
|
+
## [0.42.5] - 2026-01-11
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Reduced flicker by only re-rendering changed lines ([#617](https://github.com/badlogic/pi-mono/pull/617) by [@ogulcancelik](https://github.com/ogulcancelik)). No worries tho, there's still a little flicker in the VS Code Terminal. Praise the flicker.
|
|
40
|
+
- Cursor position tracking when content shrinks with unchanged remaining lines
|
|
41
|
+
- TUI renders with wrong dimensions after suspend/resume if terminal was resized while suspended ([#599](https://github.com/badlogic/pi-mono/issues/599))
|
|
42
|
+
- Pasted content containing Kitty key release patterns (e.g., `:3F` in MAC addresses) was incorrectly filtered out ([#623](https://github.com/badlogic/pi-mono/pull/623) by [@ogulcancelik](https://github.com/ogulcancelik))
|
|
43
|
+
|
|
3
44
|
## [0.42.4] - 2026-01-10
|
|
4
45
|
|
|
5
46
|
### Fixed
|
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ pi.exe
|
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
94
|
git clone https://github.com/badlogic/pi-mono.git
|
|
95
|
-
cd pi-mono && npm install
|
|
95
|
+
cd pi-mono && npm install && npm run build
|
|
96
96
|
cd packages/coding-agent && npm run build:binary
|
|
97
97
|
./dist/pi
|
|
98
98
|
```
|
|
@@ -236,13 +236,14 @@ The agent reads, writes, and edits files, and executes commands via bash.
|
|
|
236
236
|
|---------|-------------|
|
|
237
237
|
| `/settings` | Open settings menu (thinking, theme, message delivery modes, toggles) |
|
|
238
238
|
| `/model` | Switch models mid-session. Use `/model <search>` or `provider/model` to prefilter/disambiguate. |
|
|
239
|
+
| `/scoped-models` | Enable/disable models for Ctrl+P cycling |
|
|
239
240
|
| `/export [file]` | Export session to self-contained HTML |
|
|
240
241
|
| `/share` | Upload session as secret GitHub gist, get shareable URL (requires `gh` CLI) |
|
|
241
242
|
| `/session` | Show session info: path, message counts, token usage, cost |
|
|
242
243
|
| `/hotkeys` | Show all keyboard shortcuts |
|
|
243
244
|
| `/changelog` | Display full version history |
|
|
244
245
|
| `/tree` | Navigate session tree in-place (search, filter, label entries) |
|
|
245
|
-
| `/
|
|
246
|
+
| `/fork` | Create new conversation fork from a previous message |
|
|
246
247
|
| `/resume` | Switch to a different session (interactive selector) |
|
|
247
248
|
| `/login` | OAuth login for subscription-based models |
|
|
248
249
|
| `/logout` | Clear OAuth tokens |
|
|
@@ -347,6 +348,10 @@ All keyboard shortcuts can be customized via `~/.pi/agent/keybindings.json`. Eac
|
|
|
347
348
|
| `toggleThinking` | `ctrl+t` | Toggle thinking |
|
|
348
349
|
| `externalEditor` | `ctrl+g` | Open external editor |
|
|
349
350
|
| `followUp` | `alt+enter` | Queue follow-up message |
|
|
351
|
+
| `selectUp` | `up` | Move selection up in lists (session picker, model selector) |
|
|
352
|
+
| `selectDown` | `down` | Move selection down in lists |
|
|
353
|
+
| `selectConfirm` | `enter` | Confirm selection |
|
|
354
|
+
| `selectCancel` | `escape`, `ctrl+c` | Cancel selection |
|
|
350
355
|
|
|
351
356
|
**Example (Emacs-style):**
|
|
352
357
|
|
|
@@ -454,7 +459,7 @@ Sessions auto-save to `~/.pi/agent/sessions/` organized by working directory.
|
|
|
454
459
|
pi --continue # Continue most recent session
|
|
455
460
|
pi -c # Short form
|
|
456
461
|
|
|
457
|
-
pi --resume # Browse and select from past sessions
|
|
462
|
+
pi --resume # Browse and select from past sessions (Tab to toggle Current Folder / All)
|
|
458
463
|
pi -r # Short form
|
|
459
464
|
|
|
460
465
|
pi --no-session # Ephemeral mode (don't save)
|
|
@@ -502,10 +507,10 @@ See [docs/compaction.md](docs/compaction.md) for how compaction works internally
|
|
|
502
507
|
- Press `l` to label entries as bookmarks
|
|
503
508
|
- When switching branches, you're prompted whether to generate a summary of the abandoned branch (messages up to the common ancestor)
|
|
504
509
|
|
|
505
|
-
**Create new session (`/
|
|
510
|
+
**Create new session (`/fork`):** Fork to a new session file:
|
|
506
511
|
|
|
507
512
|
1. Opens selector showing all your user messages
|
|
508
|
-
2. Select a message to
|
|
513
|
+
2. Select a message to fork from
|
|
509
514
|
3. Creates new session with history up to that point
|
|
510
515
|
4. Selected message placed in editor for modification
|
|
511
516
|
|
|
@@ -801,7 +806,7 @@ Usage: `/component Button "onClick handler" "disabled support"`
|
|
|
801
806
|
|
|
802
807
|
Skills are self-contained capability packages that the agent loads on-demand. Pi implements the [Agent Skills standard](https://agentskills.io/specification), warning about violations but remaining lenient.
|
|
803
808
|
|
|
804
|
-
A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks. Skills are loaded when the agent decides a task matches the description, or when you explicitly ask to use one.
|
|
809
|
+
A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks. Skills are loaded when the agent decides a task matches the description, or when you explicitly ask to use one. You can also invoke skills directly via `/skill:name` commands (e.g., `/skill:brave-search`).
|
|
805
810
|
|
|
806
811
|
**Example use cases:**
|
|
807
812
|
- Web search and content extraction (Brave Search API)
|
|
@@ -854,7 +859,7 @@ Extensions are TypeScript modules that extend pi's behavior.
|
|
|
854
859
|
- **Custom tools** - Register tools callable by the LLM with custom UI and rendering
|
|
855
860
|
- **Custom commands** - Add `/commands` for users (e.g., `/deploy`, `/stats`)
|
|
856
861
|
- **Event interception** - Block tool calls, modify results, customize compaction
|
|
857
|
-
- **State persistence** - Store data in session, reconstruct on reload/
|
|
862
|
+
- **State persistence** - Store data in session, reconstruct on reload/fork
|
|
858
863
|
- **External integrations** - File watchers, webhooks, git checkpointing
|
|
859
864
|
- **Custom UI** - Full TUI control from tools, commands, or event handlers
|
|
860
865
|
|
|
@@ -1006,7 +1011,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1006
1011
|
};
|
|
1007
1012
|
|
|
1008
1013
|
pi.on("session_start", async (e, ctx) => reconstruct(ctx));
|
|
1009
|
-
pi.on("
|
|
1014
|
+
pi.on("session_fork", async (e, ctx) => reconstruct(ctx));
|
|
1010
1015
|
pi.on("session_tree", async (e, ctx) => reconstruct(ctx));
|
|
1011
1016
|
|
|
1012
1017
|
pi.registerCommand("increment", {
|
|
@@ -1041,7 +1046,7 @@ Register custom CLI flags (parsed automatically, shown in `--help`):
|
|
|
1041
1046
|
|
|
1042
1047
|
```typescript
|
|
1043
1048
|
export default function (pi: ExtensionAPI) {
|
|
1044
|
-
pi.registerFlag("
|
|
1049
|
+
pi.registerFlag("dry-run", {
|
|
1045
1050
|
description: "Run without making changes",
|
|
1046
1051
|
type: "boolean",
|
|
1047
1052
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-models.d.ts","sourceRoot":"","sources":["../../src/cli/list-models.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"list-models.d.ts","sourceRoot":"","sources":["../../src/cli/list-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAiB/D;;GAEG;AACH,wBAAsB,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6EpG","sourcesContent":["/**\n * List available models with optional fuzzy search\n */\n\nimport type { Api, Model } from \"@mariozechner/pi-ai\";\nimport { fuzzyFilter } from \"@mariozechner/pi-tui\";\nimport type { ModelRegistry } from \"../core/model-registry.js\";\n\n/**\n * Format a number as human-readable (e.g., 200000 -> \"200K\", 1000000 -> \"1M\")\n */\nfunction formatTokenCount(count: number): string {\n\tif (count >= 1_000_000) {\n\t\tconst millions = count / 1_000_000;\n\t\treturn millions % 1 === 0 ? `${millions}M` : `${millions.toFixed(1)}M`;\n\t}\n\tif (count >= 1_000) {\n\t\tconst thousands = count / 1_000;\n\t\treturn thousands % 1 === 0 ? `${thousands}K` : `${thousands.toFixed(1)}K`;\n\t}\n\treturn count.toString();\n}\n\n/**\n * List available models, optionally filtered by search pattern\n */\nexport async function listModels(modelRegistry: ModelRegistry, searchPattern?: string): Promise<void> {\n\tconst models = await modelRegistry.getAvailable();\n\n\tif (models.length === 0) {\n\t\tconsole.log(\"No models available. Set API keys in environment variables.\");\n\t\treturn;\n\t}\n\n\t// Apply fuzzy filter if search pattern provided\n\tlet filteredModels: Model<Api>[] = models;\n\tif (searchPattern) {\n\t\tfilteredModels = fuzzyFilter(models, searchPattern, (m) => `${m.provider} ${m.id}`);\n\t}\n\n\tif (filteredModels.length === 0) {\n\t\tconsole.log(`No models matching \"${searchPattern}\"`);\n\t\treturn;\n\t}\n\n\t// Sort by provider, then by model id\n\tfilteredModels.sort((a, b) => {\n\t\tconst providerCmp = a.provider.localeCompare(b.provider);\n\t\tif (providerCmp !== 0) return providerCmp;\n\t\treturn a.id.localeCompare(b.id);\n\t});\n\n\t// Calculate column widths\n\tconst rows = filteredModels.map((m) => ({\n\t\tprovider: m.provider,\n\t\tmodel: m.id,\n\t\tcontext: formatTokenCount(m.contextWindow),\n\t\tmaxOut: formatTokenCount(m.maxTokens),\n\t\tthinking: m.reasoning ? \"yes\" : \"no\",\n\t\timages: m.input.includes(\"image\") ? \"yes\" : \"no\",\n\t}));\n\n\tconst headers = {\n\t\tprovider: \"provider\",\n\t\tmodel: \"model\",\n\t\tcontext: \"context\",\n\t\tmaxOut: \"max-out\",\n\t\tthinking: \"thinking\",\n\t\timages: \"images\",\n\t};\n\n\tconst widths = {\n\t\tprovider: Math.max(headers.provider.length, ...rows.map((r) => r.provider.length)),\n\t\tmodel: Math.max(headers.model.length, ...rows.map((r) => r.model.length)),\n\t\tcontext: Math.max(headers.context.length, ...rows.map((r) => r.context.length)),\n\t\tmaxOut: Math.max(headers.maxOut.length, ...rows.map((r) => r.maxOut.length)),\n\t\tthinking: Math.max(headers.thinking.length, ...rows.map((r) => r.thinking.length)),\n\t\timages: Math.max(headers.images.length, ...rows.map((r) => r.images.length)),\n\t};\n\n\t// Print header\n\tconst headerLine = [\n\t\theaders.provider.padEnd(widths.provider),\n\t\theaders.model.padEnd(widths.model),\n\t\theaders.context.padEnd(widths.context),\n\t\theaders.maxOut.padEnd(widths.maxOut),\n\t\theaders.thinking.padEnd(widths.thinking),\n\t\theaders.images.padEnd(widths.images),\n\t].join(\" \");\n\tconsole.log(headerLine);\n\n\t// Print rows\n\tfor (const row of rows) {\n\t\tconst line = [\n\t\t\trow.provider.padEnd(widths.provider),\n\t\t\trow.model.padEnd(widths.model),\n\t\t\trow.context.padEnd(widths.context),\n\t\t\trow.maxOut.padEnd(widths.maxOut),\n\t\t\trow.thinking.padEnd(widths.thinking),\n\t\t\trow.images.padEnd(widths.images),\n\t\t].join(\" \");\n\t\tconsole.log(line);\n\t}\n}\n"]}
|
package/dist/cli/list-models.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-models.js","sourceRoot":"","sources":["../../src/cli/list-models.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"list-models.js","sourceRoot":"","sources":["../../src/cli/list-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAa,EAAU;IAChD,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;QACnC,OAAO,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACxE,CAAC;IACD,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;QACpB,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;QAChC,OAAO,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC3E,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAAA,CACxB;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,aAA4B,EAAE,aAAsB,EAAiB;IACrG,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC;IAElD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;QAC3E,OAAO;IACR,CAAC;IAED,gDAAgD;IAChD,IAAI,cAAc,GAAi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i-ai\";\nimport { fuzzyFilter } from \"@mariozechner/pi-tui\";\nimport type { ModelRegistry } from \"../core/model-registry.js\";\n\n/**\n * Format a number as human-readable (e.g., 200000 -> \"200K\", 1000000 -> \"1M\")\n */\nfunction formatTokenCount(count: number): string {\n\tif (count >= 1_000_000) {\n\t\tconst millions = count / 1_000_000;\n\t\treturn millions % 1 === 0 ? `${millions}M` : `${millions.toFixed(1)}M`;\n\t}\n\tif (count >= 1_000) {\n\t\tconst thousands = count / 1_000;\n\t\treturn thousands % 1 === 0 ? `${thousands}K` : `${thousands.toFixed(1)}K`;\n\t}\n\treturn count.toString();\n}\n\n/**\n * List available models, optionally filtered by search pattern\n */\nexport async function listModels(modelRegistry: ModelRegistry, searchPattern?: string): Promise<void> {\n\tconst models = await modelRegistry.getAvailable();\n\n\tif (models.length === 0) {\n\t\tconsole.log(\"No models available. Set API keys in environment variables.\");\n\t\treturn;\n\t}\n\n\t// Apply fuzzy filter if search pattern provided\n\tlet filteredModels: Model<Api>[] = models;\n\tif (searchPattern) {\n\t\tfilteredModels = fuzzyFilter(models, searchPattern, (m) => `${m.provider} ${m.id}`);\n\t}\n\n\tif (filteredModels.length === 0) {\n\t\tconsole.log(`No models matching \"${searchPattern}\"`);\n\t\treturn;\n\t}\n\n\t// Sort by provider, then by model id\n\tfilteredModels.sort((a, b) => {\n\t\tconst providerCmp = a.provider.localeCompare(b.provider);\n\t\tif (providerCmp !== 0) return providerCmp;\n\t\treturn a.id.localeCompare(b.id);\n\t});\n\n\t// Calculate column widths\n\tconst rows = filteredModels.map((m) => ({\n\t\tprovider: m.provider,\n\t\tmodel: m.id,\n\t\tcontext: formatTokenCount(m.contextWindow),\n\t\tmaxOut: formatTokenCount(m.maxTokens),\n\t\tthinking: m.reasoning ? \"yes\" : \"no\",\n\t\timages: m.input.includes(\"image\") ? \"yes\" : \"no\",\n\t}));\n\n\tconst headers = {\n\t\tprovider: \"provider\",\n\t\tmodel: \"model\",\n\t\tcontext: \"context\",\n\t\tmaxOut: \"max-out\",\n\t\tthinking: \"thinking\",\n\t\timages: \"images\",\n\t};\n\n\tconst widths = {\n\t\tprovider: Math.max(headers.provider.length, ...rows.map((r) => r.provider.length)),\n\t\tmodel: Math.max(headers.model.length, ...rows.map((r) => r.model.length)),\n\t\tcontext: Math.max(headers.context.length, ...rows.map((r) => r.context.length)),\n\t\tmaxOut: Math.max(headers.maxOut.length, ...rows.map((r) => r.maxOut.length)),\n\t\tthinking: Math.max(headers.thinking.length, ...rows.map((r) => r.thinking.length)),\n\t\timages: Math.max(headers.images.length, ...rows.map((r) => r.images.length)),\n\t};\n\n\t// Print header\n\tconst headerLine = [\n\t\theaders.provider.padEnd(widths.provider),\n\t\theaders.model.padEnd(widths.model),\n\t\theaders.context.padEnd(widths.context),\n\t\theaders.maxOut.padEnd(widths.maxOut),\n\t\theaders.thinking.padEnd(widths.thinking),\n\t\theaders.images.padEnd(widths.images),\n\t].join(\" \");\n\tconsole.log(headerLine);\n\n\t// Print rows\n\tfor (const row of rows) {\n\t\tconst line = [\n\t\t\trow.provider.padEnd(widths.provider),\n\t\t\trow.model.padEnd(widths.model),\n\t\t\trow.context.padEnd(widths.context),\n\t\t\trow.maxOut.padEnd(widths.maxOut),\n\t\t\trow.thinking.padEnd(widths.thinking),\n\t\t\trow.images.padEnd(widths.images),\n\t\t].join(\" \");\n\t\tconsole.log(line);\n\t}\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TUI session selector for --resume flag
|
|
3
3
|
*/
|
|
4
|
-
import type { SessionInfo } from "../core/session-manager.js";
|
|
4
|
+
import type { SessionInfo, SessionListProgress } from "../core/session-manager.js";
|
|
5
|
+
type SessionsLoader = (onProgress?: SessionListProgress) => Promise<SessionInfo[]>;
|
|
5
6
|
/** Show TUI session selector and return selected session path or null if cancelled */
|
|
6
|
-
export declare function selectSession(
|
|
7
|
+
export declare function selectSession(currentSessionsLoader: SessionsLoader, allSessionsLoader: SessionsLoader): Promise<string | null>;
|
|
8
|
+
export {};
|
|
7
9
|
//# sourceMappingURL=session-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-picker.d.ts","sourceRoot":"","sources":["../../src/cli/session-picker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"session-picker.d.ts","sourceRoot":"","sources":["../../src/cli/session-picker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGnF,KAAK,cAAc,GAAG,CAAC,UAAU,CAAC,EAAE,mBAAmB,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;AAEnF,sFAAsF;AACtF,wBAAsB,aAAa,CAClC,qBAAqB,EAAE,cAAc,EACrC,iBAAiB,EAAE,cAAc,GAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiCxB","sourcesContent":["/**\n * TUI session selector for --resume flag\n */\n\nimport { ProcessTerminal, TUI } from \"@mariozechner/pi-tui\";\nimport type { SessionInfo, SessionListProgress } from \"../core/session-manager.js\";\nimport { SessionSelectorComponent } from \"../modes/interactive/components/session-selector.js\";\n\ntype SessionsLoader = (onProgress?: SessionListProgress) => Promise<SessionInfo[]>;\n\n/** Show TUI session selector and return selected session path or null if cancelled */\nexport async function selectSession(\n\tcurrentSessionsLoader: SessionsLoader,\n\tallSessionsLoader: SessionsLoader,\n): Promise<string | null> {\n\treturn new Promise((resolve) => {\n\t\tconst ui = new TUI(new ProcessTerminal());\n\t\tlet resolved = false;\n\n\t\tconst selector = new SessionSelectorComponent(\n\t\t\tcurrentSessionsLoader,\n\t\t\tallSessionsLoader,\n\t\t\t(path: string) => {\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tresolved = true;\n\t\t\t\t\tui.stop();\n\t\t\t\t\tresolve(path);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tresolved = true;\n\t\t\t\t\tui.stop();\n\t\t\t\t\tresolve(null);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tui.stop();\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t\t() => ui.requestRender(),\n\t\t);\n\n\t\tui.addChild(selector);\n\t\tui.setFocus(selector.getSessionList());\n\t\tui.start();\n\t});\n}\n"]}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
import { ProcessTerminal, TUI } from "@mariozechner/pi-tui";
|
|
5
5
|
import { SessionSelectorComponent } from "../modes/interactive/components/session-selector.js";
|
|
6
6
|
/** Show TUI session selector and return selected session path or null if cancelled */
|
|
7
|
-
export async function selectSession(
|
|
7
|
+
export async function selectSession(currentSessionsLoader, allSessionsLoader) {
|
|
8
8
|
return new Promise((resolve) => {
|
|
9
9
|
const ui = new TUI(new ProcessTerminal());
|
|
10
10
|
let resolved = false;
|
|
11
|
-
const selector = new SessionSelectorComponent(
|
|
11
|
+
const selector = new SessionSelectorComponent(currentSessionsLoader, allSessionsLoader, (path) => {
|
|
12
12
|
if (!resolved) {
|
|
13
13
|
resolved = true;
|
|
14
14
|
ui.stop();
|
|
@@ -23,7 +23,7 @@ export async function selectSession(sessions) {
|
|
|
23
23
|
}, () => {
|
|
24
24
|
ui.stop();
|
|
25
25
|
process.exit(0);
|
|
26
|
-
});
|
|
26
|
+
}, () => ui.requestRender());
|
|
27
27
|
ui.addChild(selector);
|
|
28
28
|
ui.setFocus(selector.getSessionList());
|
|
29
29
|
ui.start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-picker.js","sourceRoot":"","sources":["../../src/cli/session-picker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,wBAAwB,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,CAAC,CAAC;QACvC,EAAE,CAAC,KAAK,EAAE,CAAC;IAAA,CACX,CAAC,CAAC;AAAA,CACH","sourcesContent":["/**\n * TUI session selector for --resume flag\n */\n\nimport { ProcessTerminal, TUI } from \"@mariozechner/pi-tui\";\nimport type { SessionInfo, SessionListProgress } from \"../core/session-manager.js\";\nimport { SessionSelectorComponent } from \"../modes/interactive/components/session-selector.js\";\n\ntype SessionsLoader = (onProgress?: SessionListProgress) => Promise<SessionInfo[]>;\n\n/** Show TUI session selector and return selected session path or null if cancelled */\nexport async function selectSession(\n\tcurrentSessionsLoader: SessionsLoader,\n\tallSessionsLoader: SessionsLoader,\n): Promise<string | null> {\n\treturn new Promise((resolve) => {\n\t\tconst ui = new TUI(new ProcessTerminal());\n\t\tlet resolved = false;\n\n\t\tconst selector = new SessionSelectorComponent(\n\t\t\tcurrentSessionsLoader,\n\t\t\tallSessionsLoader,\n\t\t\t(path: string) => {\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tresolved = true;\n\t\t\t\t\tui.stop();\n\t\t\t\t\tresolve(path);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tresolved = true;\n\t\t\t\t\tui.stop();\n\t\t\t\t\tresolve(null);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tui.stop();\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t\t() => ui.requestRender(),\n\t\t);\n\n\t\tui.addChild(selector);\n\t\tui.setFocus(selector.getSessionList());\n\t\tui.start();\n\t});\n}\n"]}
|
|
@@ -218,6 +218,11 @@ export declare class AgentSession {
|
|
|
218
218
|
model: Model<any>;
|
|
219
219
|
thinkingLevel: ThinkingLevel;
|
|
220
220
|
}>;
|
|
221
|
+
/** Update scoped models for cycling */
|
|
222
|
+
setScopedModels(scopedModels: Array<{
|
|
223
|
+
model: Model<any>;
|
|
224
|
+
thinkingLevel: ThinkingLevel;
|
|
225
|
+
}>): void;
|
|
221
226
|
/** File-based prompt templates */
|
|
222
227
|
get promptTemplates(): ReadonlyArray<PromptTemplate>;
|
|
223
228
|
/**
|
|
@@ -309,6 +314,7 @@ export declare class AgentSession {
|
|
|
309
314
|
* @returns true if completed, false if cancelled by extension
|
|
310
315
|
*/
|
|
311
316
|
newSession(options?: NewSessionOptions): Promise<boolean>;
|
|
317
|
+
private _emitModelSelect;
|
|
312
318
|
/**
|
|
313
319
|
* Set model directly.
|
|
314
320
|
* Validates API key, saves to session and settings.
|
|
@@ -448,21 +454,21 @@ export declare class AgentSession {
|
|
|
448
454
|
*/
|
|
449
455
|
switchSession(sessionPath: string): Promise<boolean>;
|
|
450
456
|
/**
|
|
451
|
-
* Create a
|
|
452
|
-
* Emits
|
|
457
|
+
* Create a fork from a specific entry.
|
|
458
|
+
* Emits before_fork/fork session events to extensions.
|
|
453
459
|
*
|
|
454
|
-
* @param entryId ID of the entry to
|
|
460
|
+
* @param entryId ID of the entry to fork from
|
|
455
461
|
* @returns Object with:
|
|
456
462
|
* - selectedText: The text of the selected user message (for editor pre-fill)
|
|
457
|
-
* - cancelled: True if an extension cancelled the
|
|
463
|
+
* - cancelled: True if an extension cancelled the fork
|
|
458
464
|
*/
|
|
459
|
-
|
|
465
|
+
fork(entryId: string): Promise<{
|
|
460
466
|
selectedText: string;
|
|
461
467
|
cancelled: boolean;
|
|
462
468
|
}>;
|
|
463
469
|
/**
|
|
464
470
|
* Navigate to a different node in the session tree.
|
|
465
|
-
* Unlike
|
|
471
|
+
* Unlike fork() which creates a new session file, this stays in the same file.
|
|
466
472
|
*
|
|
467
473
|
* @param targetId The entry ID to navigate to
|
|
468
474
|
* @param options.summarize Whether user wants to summarize abandoned branch
|
|
@@ -479,9 +485,9 @@ export declare class AgentSession {
|
|
|
479
485
|
summaryEntry?: BranchSummaryEntry;
|
|
480
486
|
}>;
|
|
481
487
|
/**
|
|
482
|
-
* Get all user messages from session for
|
|
488
|
+
* Get all user messages from session for fork selector.
|
|
483
489
|
*/
|
|
484
|
-
|
|
490
|
+
getUserMessagesForForking(): Array<{
|
|
485
491
|
entryId: string;
|
|
486
492
|
text: string;
|
|
487
493
|
}>;
|