@oh-my-pi/pi-coding-agent 6.9.69 → 7.0.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 +132 -51
- package/examples/sdk/04-skills.ts +1 -1
- package/package.json +6 -6
- package/src/core/agent-session.ts +112 -4
- package/src/core/auth-storage.ts +524 -202
- package/src/core/bash-executor.ts +1 -1
- package/src/core/model-registry.ts +7 -0
- package/src/core/python-executor.ts +29 -8
- package/src/core/python-gateway-coordinator.ts +55 -1
- package/src/core/python-prelude.py +201 -8
- package/src/core/tools/find.ts +18 -5
- package/src/core/tools/lsp/index.ts +13 -2
- package/src/core/tools/python.ts +1 -0
- package/src/core/tools/read.ts +4 -4
- package/src/modes/interactive/controllers/command-controller.ts +349 -0
- package/src/modes/interactive/controllers/input-controller.ts +55 -7
- package/src/modes/interactive/interactive-mode.ts +6 -1
- package/src/modes/interactive/types.ts +2 -1
- package/src/prompts/system/system-prompt.md +81 -79
- package/src/prompts/tools/python.md +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [7.0.0] - 2026-01-21
|
|
6
|
+
### Added
|
|
7
|
+
|
|
8
|
+
- Added usage report deduplication to prevent duplicate account entries
|
|
9
|
+
- Added debug logging for usage fetch operations to aid diagnostics
|
|
10
|
+
- Added provider sorting in usage display by total usage amount
|
|
11
|
+
- Added `isolated` parameter to task tool for running each task in separate git worktrees
|
|
12
|
+
- Added git worktree management for isolated task execution with patch generation
|
|
13
|
+
- Added patch application system that applies changes only when all patches are valid
|
|
14
|
+
- Added working directory information to environment info display
|
|
15
|
+
- Added `/usage` command to display provider usage and limits
|
|
16
|
+
- Added support for multiple usage providers beyond Codex
|
|
17
|
+
- Added usage report caching with configurable TTL
|
|
18
|
+
- Added visual usage bars and account aggregation in usage display
|
|
19
|
+
- Added `fetchUsageReports()` method to agent session
|
|
20
|
+
- Added `output()` function to read task/agent outputs by ID with support for multiple formats and queries
|
|
21
|
+
- Added session file support to Python executor for accessing task outputs
|
|
22
|
+
- Added support for jq-like queries when reading JSON outputs
|
|
23
|
+
- Added offset and limit parameters for reading specific line ranges from outputs
|
|
24
|
+
- Added "." and "c" shortcuts to continue agent without sending visible message
|
|
25
|
+
- Added debug logging for usage fetch results to aid /usage diagnostics
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Updated discoverSkills function to return object with skills property
|
|
30
|
+
- Enhanced usage report merging to combine limits and metadata from duplicate accounts
|
|
31
|
+
- Improved OAuth credential handling to preserve existing fields when updating
|
|
32
|
+
- Removed cd function from Python prelude to encourage using cwd parameter
|
|
33
|
+
- Updated task tool to generate and apply patches when running in isolated mode
|
|
34
|
+
- Enhanced task tool rendering to display isolated execution status and patch paths
|
|
35
|
+
- Updated system prompt structure and formatting for better readability
|
|
36
|
+
- Reorganized tool hierarchy and discipline sections
|
|
37
|
+
- Added parallel work guidance for task-based workflows
|
|
38
|
+
- Enhanced verification and integration methodology sections
|
|
39
|
+
- Updated skills and rules formatting for cleaner presentation
|
|
40
|
+
- Added stronger emphasis on completeness and quality standards
|
|
41
|
+
- Refactored usage tracking from Codex-specific to generic provider system
|
|
42
|
+
- Updated usage limit detection to work with multiple provider APIs
|
|
43
|
+
- Changed usage cache to use persistent storage instead of in-memory only
|
|
44
|
+
- Limited diagnostic messages to 50 items to prevent overwhelming output when processing files with many issues
|
|
45
|
+
- Changed `/dump` command to include complete agent context: system prompt, model config, available tools with schemas, and all message types (bash/python executions, custom messages, branch summaries, compaction summaries, file mentions)
|
|
46
|
+
- Changed `/dump` format to use YAML instead of JSON for tool schemas and arguments (more readable)
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- Fixed TypeScript error in bash executor by properly typing caught exception
|
|
51
|
+
- Fixed usage display ordering to show providers with lowest usage first
|
|
52
|
+
- Fixed task tool result rendering to show fallback text when no results are available
|
|
53
|
+
- Fixed external editor to work properly on Unix systems by correctly handling terminal I/O
|
|
54
|
+
- Fixed external editor to show warning message when it fails to open instead of silently failing
|
|
55
|
+
- Fixed find tool to properly handle no matches case without treating as error
|
|
56
|
+
- Fixed find tool to wait for fd exit so error messages no longer report exit null
|
|
57
|
+
- Fixed read tool to properly handle no matches case without treating as error
|
|
58
|
+
- Fixed orphaned Python kernel gateway processes not being killed on process exit
|
|
59
|
+
- Fixed /usage provider ordering to sort by aggregate usage (most used last)
|
|
60
|
+
- Fixed /usage account dedupe to collapse identical accounts using usage metadata
|
|
61
|
+
|
|
5
62
|
## [6.9.69] - 2026-01-21
|
|
6
63
|
|
|
7
64
|
### Added
|
|
@@ -44,6 +101,7 @@
|
|
|
44
101
|
- Fixed patch indentation normalization for fuzzy matches, tab/space diffs, and ambiguous context alignment
|
|
45
102
|
|
|
46
103
|
## [6.9.0] - 2026-01-21
|
|
104
|
+
|
|
47
105
|
### Removed
|
|
48
106
|
|
|
49
107
|
- Removed Git tool and all related functionality
|
|
@@ -54,6 +112,7 @@
|
|
|
54
112
|
- Removed @oh-my-pi/pi-git-tool dependency
|
|
55
113
|
|
|
56
114
|
## [6.8.5] - 2026-01-21
|
|
115
|
+
|
|
57
116
|
### Breaking Changes
|
|
58
117
|
|
|
59
118
|
- Changed timeout parameter from seconds to milliseconds in Python tool
|
|
@@ -65,6 +124,7 @@
|
|
|
65
124
|
- Improved streaming output handling and buffer management
|
|
66
125
|
|
|
67
126
|
## [6.8.4] - 2026-01-21
|
|
127
|
+
|
|
68
128
|
### Changed
|
|
69
129
|
|
|
70
130
|
- Updated output sink to properly handle large outputs
|
|
@@ -146,6 +206,7 @@
|
|
|
146
206
|
- Updated temporary file cleanup to use secure async removal methods
|
|
147
207
|
|
|
148
208
|
## [6.7.67] - 2026-01-19
|
|
209
|
+
|
|
149
210
|
### Added
|
|
150
211
|
|
|
151
212
|
- Added normative rewrite setting to control tool call argument normalization in session history
|
|
@@ -194,7 +255,7 @@
|
|
|
194
255
|
|
|
195
256
|
- Patch application handles repeated context blocks, preserves original indentation on fuzzy match
|
|
196
257
|
- Ambiguous context matching resolves duplicates using adjacent @@ anchor positioning
|
|
197
|
-
- Patch parser handles bare
|
|
258
|
+
- Patch parser handles bare \*\*\* terminators, model hallucination markers, line hint ranges
|
|
198
259
|
- Function context matching handles signatures with and without empty parentheses
|
|
199
260
|
- Fixed session title generation to respect OMP_NO_TITLE environment variable
|
|
200
261
|
- Fixed Python module discovery to use import.meta.dir for ES module compatibility
|
|
@@ -206,6 +267,7 @@
|
|
|
206
267
|
- Fixed MCP tool path formatting to correctly display provider information
|
|
207
268
|
|
|
208
269
|
## [6.2.0] - 2026-01-19
|
|
270
|
+
|
|
209
271
|
### Changed
|
|
210
272
|
|
|
211
273
|
- Improved LSP batching to coalesce formatting and diagnostics for parallel edits
|
|
@@ -243,12 +305,14 @@
|
|
|
243
305
|
- Fixed TTSR abbreviation expansion from TTSR to Time Traveling Stream Rules
|
|
244
306
|
|
|
245
307
|
## [5.8.0] - 2026-01-19
|
|
308
|
+
|
|
246
309
|
### Changed
|
|
247
310
|
|
|
248
311
|
- Updated WASM loading to use streaming for development environments with base64 fallback
|
|
249
312
|
- Added scripts directory to published package files
|
|
250
313
|
|
|
251
314
|
## [5.7.68] - 2026-01-18
|
|
315
|
+
|
|
252
316
|
### Changed
|
|
253
317
|
|
|
254
318
|
- Updated WASM loading to use base64-encoded WASM for better compatibility with compiled binaries
|
|
@@ -258,12 +322,14 @@
|
|
|
258
322
|
- Fixed WASM loading issues in compiled binary builds
|
|
259
323
|
|
|
260
324
|
## [5.7.67] - 2026-01-18
|
|
325
|
+
|
|
261
326
|
### Changed
|
|
262
327
|
|
|
263
328
|
- Replaced external photon-node dependency with vendored WebAssembly implementation
|
|
264
329
|
- Updated image processing to use local photon library for better performance
|
|
265
330
|
|
|
266
331
|
## [5.6.70] - 2026-01-18
|
|
332
|
+
|
|
267
333
|
### Added
|
|
268
334
|
|
|
269
335
|
- Added support for loading Python prelude extension modules from user and project directories
|
|
@@ -336,7 +402,7 @@
|
|
|
336
402
|
- Enhanced Python kernel availability checking with faster validation
|
|
337
403
|
- Optimized Python environment warming to avoid blocking during tool initialization
|
|
338
404
|
- Reorganized settings interface into behavior, tools, display, voice, status, lsp, and exa tabs
|
|
339
|
-
- Migrated environment variables from
|
|
405
|
+
- Migrated environment variables from PI* to OMP* prefix with automatic migration
|
|
340
406
|
- Updated model selector to use TabBar component for provider navigation
|
|
341
407
|
- Changed role badges to inverted style with colored backgrounds
|
|
342
408
|
- Added support for /models command alias in addition to /model
|
|
@@ -369,11 +435,13 @@
|
|
|
369
435
|
- Enhanced Python gateway environment filtering to exclude sensitive API keys and Windows system paths
|
|
370
436
|
|
|
371
437
|
## [5.5.0] - 2026-01-18
|
|
438
|
+
|
|
372
439
|
### Changed
|
|
373
440
|
|
|
374
441
|
- Updated task execution guidelines to improve prompt framing and parallelization instructions
|
|
375
442
|
|
|
376
443
|
## [5.4.2] - 2026-01-16
|
|
444
|
+
|
|
377
445
|
### Changed
|
|
378
446
|
|
|
379
447
|
- Updated model resolution to accept pre-serialized settings for better performance
|
|
@@ -381,11 +449,13 @@
|
|
|
381
449
|
- Enhanced edit tool documentation with clear use cases for bash alternatives
|
|
382
450
|
|
|
383
451
|
## [5.3.0] - 2026-01-15
|
|
452
|
+
|
|
384
453
|
### Changed
|
|
385
454
|
|
|
386
455
|
- Expanded bash tool guidance to explicitly list appropriate use cases including file operations, build commands, and process management
|
|
387
456
|
|
|
388
457
|
## [5.2.1] - 2026-01-14
|
|
458
|
+
|
|
389
459
|
### Fixed
|
|
390
460
|
|
|
391
461
|
- Fixed stale diagnostic results by tracking diagnostic versions before file sync operations
|
|
@@ -429,6 +499,7 @@
|
|
|
429
499
|
- Fixed session selector page up/down navigation
|
|
430
500
|
|
|
431
501
|
## [5.0.1] - 2026-01-12
|
|
502
|
+
|
|
432
503
|
### Changed
|
|
433
504
|
|
|
434
505
|
- Replaced wasm-vips with Photon for more stable WASM image processing
|
|
@@ -455,6 +526,7 @@
|
|
|
455
526
|
- Move `sharp` to optional dependencies with all platform binaries to fix arm64 runtime errors
|
|
456
527
|
|
|
457
528
|
## [4.7.0] - 2026-01-12
|
|
529
|
+
|
|
458
530
|
### Added
|
|
459
531
|
|
|
460
532
|
- Add `omp config` subcommand for managing settings (`list`, `get`, `set`, `reset`, `path`)
|
|
@@ -474,6 +546,7 @@
|
|
|
474
546
|
## [4.6.0] - 2026-01-12
|
|
475
547
|
|
|
476
548
|
### Added
|
|
549
|
+
|
|
477
550
|
- Add `/skill:name` slash commands for quick skill access (toggle via `skills.enableSkillCommands` setting)
|
|
478
551
|
- Add `cwd` to SessionInfo for session list display
|
|
479
552
|
- Add custom summarization instructions option in tree selector
|
|
@@ -481,10 +554,12 @@
|
|
|
481
554
|
- Add `shutdownRequested` and `checkShutdownRequested()` for extension-initiated shutdown
|
|
482
555
|
|
|
483
556
|
### Fixed
|
|
557
|
+
|
|
484
558
|
- Component `invalidate()` now properly rebuilds content on theme changes
|
|
485
559
|
- Force full re-render after returning from external editor
|
|
486
560
|
|
|
487
561
|
## [4.4.8] - 2026-01-12
|
|
562
|
+
|
|
488
563
|
### Changed
|
|
489
564
|
|
|
490
565
|
- Changed review finding priority format from numeric (0-3) to string labels (P0-P3) for clearer severity indication
|
|
@@ -504,6 +579,7 @@
|
|
|
504
579
|
- Fixed frontmatter parsing to properly report source location when YAML parsing fails
|
|
505
580
|
|
|
506
581
|
## [4.4.4] - 2026-01-11
|
|
582
|
+
|
|
507
583
|
### Added
|
|
508
584
|
|
|
509
585
|
- Added `todo_write` tool for creating and managing structured task lists during coding sessions
|
|
@@ -534,6 +610,7 @@
|
|
|
534
610
|
- Fixed prompt template loading to strip leading HTML comment metadata blocks
|
|
535
611
|
|
|
536
612
|
## [4.3.2] - 2026-01-11
|
|
613
|
+
|
|
537
614
|
### Changed
|
|
538
615
|
|
|
539
616
|
- Increased default bash output preview from 5 to 10 lines when collapsed
|
|
@@ -573,6 +650,7 @@
|
|
|
573
650
|
- Fixed serialized auth storage initialization so OAuth refreshes in subagents don't crash
|
|
574
651
|
|
|
575
652
|
## [4.2.2] - 2026-01-11
|
|
653
|
+
|
|
576
654
|
### Added
|
|
577
655
|
|
|
578
656
|
- Added persistent cache storage for Codex usage data that survives application restarts
|
|
@@ -593,6 +671,7 @@
|
|
|
593
671
|
- Removed `planner` agent command template, consolidating planning functionality into the `plan` agent
|
|
594
672
|
|
|
595
673
|
## [4.2.1] - 2026-01-11
|
|
674
|
+
|
|
596
675
|
### Added
|
|
597
676
|
|
|
598
677
|
- Added automatic discovery and listing of AGENTS.md files in the system prompt, providing agents with an authoritative list of project-specific instruction files without runtime searching
|
|
@@ -659,6 +738,7 @@
|
|
|
659
738
|
- Hardened file permissions on agent database directory (700) and database file (600) to restrict access
|
|
660
739
|
|
|
661
740
|
## [4.1.0] - 2026-01-10
|
|
741
|
+
|
|
662
742
|
### Added
|
|
663
743
|
|
|
664
744
|
- Added persistent prompt history with SQLite-backed storage and Ctrl+R search
|
|
@@ -668,6 +748,7 @@
|
|
|
668
748
|
- Fixed credential blocking logic to correctly check for remaining available credentials instead of always returning true
|
|
669
749
|
|
|
670
750
|
## [4.0.1] - 2026-01-10
|
|
751
|
+
|
|
671
752
|
### Added
|
|
672
753
|
|
|
673
754
|
- Added usage limit error detection to enable automatic credential switching when Codex accounts hit rate limits
|
|
@@ -771,11 +852,13 @@
|
|
|
771
852
|
- Extension directories in `settings.json` respect `package.json` manifests
|
|
772
853
|
|
|
773
854
|
## [3.37.0] - 2026-01-10
|
|
855
|
+
|
|
774
856
|
### Changed
|
|
775
857
|
|
|
776
858
|
- Improved bash command display to show relative paths for working directories within the current directory, and hide redundant `cd` prefix when working directory matches current directory
|
|
777
859
|
|
|
778
860
|
## [3.36.0] - 2026-01-10
|
|
861
|
+
|
|
779
862
|
### Added
|
|
780
863
|
|
|
781
864
|
- Added `calc` tool for basic mathematical calculations with support for arithmetic operators, parentheses, and hex/binary/octal literals
|
|
@@ -794,6 +877,7 @@
|
|
|
794
877
|
- Improved completion notification message to include session title when available
|
|
795
878
|
|
|
796
879
|
## [3.35.0] - 2026-01-09
|
|
880
|
+
|
|
797
881
|
### Added
|
|
798
882
|
|
|
799
883
|
- Added retry logic with exponential backoff for auto-compaction failures
|
|
@@ -1871,15 +1955,14 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
|
|
|
1871
1955
|
- **Credential storage refactored**: API keys and OAuth tokens are now stored in `~/.omp/agent/auth.json` instead of `oauth.json` and `settings.json`. Existing credentials are automatically migrated on first run. ([#296](https://github.com/badlogic/pi-mono/issues/296))
|
|
1872
1956
|
|
|
1873
1957
|
- **SDK API changes** ([#296](https://github.com/badlogic/pi-mono/issues/296)):
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
- See updated [SDK documentation](docs/sdk.md) and [README](README.md)
|
|
1958
|
+
- Added `AuthStorage` class for credential management (API keys and OAuth tokens)
|
|
1959
|
+
- Added `ModelRegistry` class for model discovery and API key resolution
|
|
1960
|
+
- Added `discoverAuthStorage()` and `discoverModels()` discovery functions
|
|
1961
|
+
- `createAgentSession()` now accepts `authStorage` and `modelRegistry` options
|
|
1962
|
+
- Removed `configureOAuthStorage()`, `defaultGetApiKey()`, `findModel()`, `discoverAvailableModels()`
|
|
1963
|
+
- Removed `getApiKey` callback option (use `AuthStorage.setRuntimeApiKey()` for runtime overrides)
|
|
1964
|
+
- Use `getModel()` from `@oh-my-pi/pi-ai` for built-in models, `modelRegistry.find()` for custom models + built-in models
|
|
1965
|
+
- See updated [SDK documentation](docs/sdk.md) and [README](README.md)
|
|
1883
1966
|
|
|
1884
1967
|
- **Settings changes**: Removed `apiKeys` from `settings.json`. Use `auth.json` instead. ([#296](https://github.com/badlogic/pi-mono/issues/296))
|
|
1885
1968
|
|
|
@@ -1910,16 +1993,15 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
|
|
|
1910
1993
|
### Added
|
|
1911
1994
|
|
|
1912
1995
|
- **Compaction hook improvements**: The `before_compact` session event now includes:
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
- Removed `apiKey` string in favor of `resolveApiKey` for more flexibility
|
|
1996
|
+
- `previousSummary`: Summary from the last compaction (if any), so hooks can preserve accumulated context
|
|
1997
|
+
- `messagesToKeep`: Messages that will be kept after the summary (recent turns), in addition to `messagesToSummarize`
|
|
1998
|
+
- `resolveApiKey`: Function to resolve API keys for any model (checks settings, OAuth, env vars)
|
|
1999
|
+
- Removed `apiKey` string in favor of `resolveApiKey` for more flexibility
|
|
1918
2000
|
|
|
1919
2001
|
- **SessionManager API cleanup**:
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
2002
|
+
- Renamed `loadSessionFromEntries()` to `buildSessionContext()` (builds LLM context from entries, handling compaction)
|
|
2003
|
+
- Renamed `loadEntries()` to `getEntries()` (returns defensive copy of all session entries)
|
|
2004
|
+
- Added `buildSessionContext()` method to SessionManager
|
|
1923
2005
|
|
|
1924
2006
|
## [0.27.5] - 2025-12-24
|
|
1925
2007
|
|
|
@@ -2138,13 +2220,13 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
|
|
|
2138
2220
|
- **Custom tools now require `index.ts` entry point**: Auto-discovered custom tools must be in a subdirectory with an `index.ts` file. The old pattern `~/.omp/agent/tools/mytool.ts` must become `~/.omp/agent/tools/mytool/index.ts`. This allows multi-file tools to import helper modules. Explicit paths via `--tool` or `settings.json` still work with any `.ts` file.
|
|
2139
2221
|
|
|
2140
2222
|
- **Hook `tool_result` event restructured**: The `ToolResultEvent` now exposes full tool result data instead of just text. ([#233](https://github.com/badlogic/pi-mono/pull/233))
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2223
|
+
- Removed: `result: string` field
|
|
2224
|
+
- Added: `content: (TextContent | ImageContent)[]` - full content array
|
|
2225
|
+
- Added: `details: unknown` - tool-specific details (typed per tool via discriminated union on `toolName`)
|
|
2226
|
+
- `ToolResultEventResult.result` renamed to `ToolResultEventResult.text` (removed), use `content` instead
|
|
2227
|
+
- Hook handlers returning `{ result: "..." }` must change to `{ content: [{ type: "text", text: "..." }] }`
|
|
2228
|
+
- Built-in tool details types exported: `BashToolDetails`, `ReadToolDetails`, `GrepToolDetails`, `FindToolDetails`, `LsToolDetails`, `TruncationResult`
|
|
2229
|
+
- Type guards exported for narrowing: `isBashToolResult`, `isReadToolResult`, `isEditToolResult`, `isWriteToolResult`, `isGrepToolResult`, `isFindToolResult`, `isLsToolResult`
|
|
2148
2230
|
|
|
2149
2231
|
## [0.23.4] - 2025-12-18
|
|
2150
2232
|
|
|
@@ -2173,13 +2255,12 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
|
|
|
2173
2255
|
- Improved system prompt documentation section with clearer pointers to specific doc files for custom models, themes, skills, hooks, custom tools, and RPC.
|
|
2174
2256
|
|
|
2175
2257
|
- Cleaned up documentation:
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
- `README.md`: Complete settings table, condensed philosophy section, standardized OAuth docs
|
|
2258
|
+
- `theme.md`: Added missing color tokens (`thinkingXhigh`, `bashMode`)
|
|
2259
|
+
- `skills.md`: Rewrote with better framing and examples
|
|
2260
|
+
- `hooks.md`: Fixed timeout/error handling docs, added import aliases section
|
|
2261
|
+
- `custom-tools.md`: Added intro with use cases and comparison table
|
|
2262
|
+
- `rpc.md`: Added missing `hook_error` event documentation
|
|
2263
|
+
- `README.md`: Complete settings table, condensed philosophy section, standardized OAuth docs
|
|
2183
2264
|
|
|
2184
2265
|
- Hooks loader now supports same import aliases as custom tools (`@sinclair/typebox`, `@oh-my-pi/pi-ai`, `@oh-my-pi/pi-tui`, `@oh-my-pi/pi-coding-agent`).
|
|
2185
2266
|
|
|
@@ -2436,12 +2517,12 @@ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
|
|
|
2436
2517
|
### Changed
|
|
2437
2518
|
|
|
2438
2519
|
- **Tool output truncation**: All tools now enforce consistent truncation limits with actionable notices for the LLM. ([#134](https://github.com/badlogic/pi-mono/issues/134))
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2520
|
+
- **Limits**: 2000 lines OR 50KB (whichever hits first), never partial lines
|
|
2521
|
+
- **read**: Shows `[Showing lines X-Y of Z. Use offset=N to continue]`. If first line exceeds 50KB, suggests bash command
|
|
2522
|
+
- **bash**: Tail truncation with temp file. Shows `[Showing lines X-Y of Z. Full output: /tmp/...]`
|
|
2523
|
+
- **grep**: Pre-truncates match lines to 500 chars. Shows match limit and line truncation notices
|
|
2524
|
+
- **find/ls**: Shows result/entry limit notices
|
|
2525
|
+
- TUI displays truncation warnings in yellow at bottom of tool output (visible even when collapsed)
|
|
2445
2526
|
|
|
2446
2527
|
## [0.13.1] - 2025-12-06
|
|
2447
2528
|
|
|
@@ -2528,13 +2609,13 @@ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
|
|
|
2528
2609
|
### Added
|
|
2529
2610
|
|
|
2530
2611
|
- **Context Compaction**: Long sessions can now be compacted to reduce context usage while preserving recent conversation history. ([#92](https://github.com/badlogic/pi-mono/issues/92), [docs](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md#context-compaction))
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2612
|
+
- `/compact [instructions]`: Manually compact context with optional custom instructions for the summary
|
|
2613
|
+
- `/autocompact`: Toggle automatic compaction when context exceeds threshold
|
|
2614
|
+
- Compaction summarizes older messages while keeping recent messages (default 20k tokens) verbatim
|
|
2615
|
+
- Auto-compaction triggers when context reaches `contextWindow - reserveTokens` (default 16k reserve)
|
|
2616
|
+
- Compacted sessions show a collapsible summary in the TUI (toggle with `o` key)
|
|
2617
|
+
- HTML exports include compaction summaries as collapsible sections
|
|
2618
|
+
- RPC mode supports `{"type":"compact"}` command and auto-compaction (emits compaction events)
|
|
2538
2619
|
- **Branch Source Tracking**: Branched sessions now store `branchedFrom` in the session header, containing the path to the original session file. Useful for tracing session lineage.
|
|
2539
2620
|
|
|
2540
2621
|
## [0.12.5] - 2025-12-03
|
|
@@ -2571,11 +2652,11 @@ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
|
|
|
2571
2652
|
### Added
|
|
2572
2653
|
|
|
2573
2654
|
- **Models**: Added support for OpenAI's new models:
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2655
|
+
- `gpt-4.1` (128K context)
|
|
2656
|
+
- `gpt-4.1-mini` (128K context)
|
|
2657
|
+
- `gpt-4.1-nano` (128K context)
|
|
2658
|
+
- `o3` (200K context, reasoning model)
|
|
2659
|
+
- `o4-mini` (200K context, reasoning model)
|
|
2579
2660
|
|
|
2580
2661
|
## [0.12.0] - 2025-12-02
|
|
2581
2662
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { createAgentSession, discoverSkills, SessionManager, type Skill } from "@oh-my-pi/pi-coding-agent";
|
|
9
9
|
|
|
10
10
|
// Discover all skills from cwd/.omp/skills, ~/.omp/agent/skills, etc.
|
|
11
|
-
const allSkills = discoverSkills();
|
|
11
|
+
const { skills: allSkills } = await discoverSkills();
|
|
12
12
|
console.log(
|
|
13
13
|
"Discovered skills:",
|
|
14
14
|
allSkills.map((s) => s.name),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"ompConfig": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"prepublishOnly": "bun run generate-template && bun run clean && bun run build"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@oh-my-pi/omp-stats": "
|
|
44
|
-
"@oh-my-pi/pi-agent-core": "
|
|
45
|
-
"@oh-my-pi/pi-ai": "
|
|
46
|
-
"@oh-my-pi/pi-tui": "
|
|
47
|
-
"@oh-my-pi/pi-utils": "
|
|
43
|
+
"@oh-my-pi/omp-stats": "7.0.0",
|
|
44
|
+
"@oh-my-pi/pi-agent-core": "7.0.0",
|
|
45
|
+
"@oh-my-pi/pi-ai": "7.0.0",
|
|
46
|
+
"@oh-my-pi/pi-tui": "7.0.0",
|
|
47
|
+
"@oh-my-pi/pi-utils": "7.0.0",
|
|
48
48
|
"@openai/agents": "^0.3.7",
|
|
49
49
|
"@sinclair/typebox": "^0.34.46",
|
|
50
50
|
"ajv": "^8.17.1",
|
|
@@ -15,9 +15,19 @@
|
|
|
15
15
|
|
|
16
16
|
import { existsSync, readFileSync } from "node:fs";
|
|
17
17
|
import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
18
|
-
import type {
|
|
18
|
+
import type {
|
|
19
|
+
AssistantMessage,
|
|
20
|
+
ImageContent,
|
|
21
|
+
Message,
|
|
22
|
+
Model,
|
|
23
|
+
TextContent,
|
|
24
|
+
ToolCall,
|
|
25
|
+
Usage,
|
|
26
|
+
UsageReport,
|
|
27
|
+
} from "@oh-my-pi/pi-ai";
|
|
19
28
|
import { isContextOverflow, modelsAreEqual, supportsXhigh } from "@oh-my-pi/pi-ai";
|
|
20
29
|
import { abortableSleep, logger } from "@oh-my-pi/pi-utils";
|
|
30
|
+
import { YAML } from "bun";
|
|
21
31
|
import type { Rule } from "../capability/rule";
|
|
22
32
|
import { getAgentDbPath } from "../config";
|
|
23
33
|
import { theme } from "../modes/interactive/theme/theme";
|
|
@@ -50,7 +60,17 @@ import type {
|
|
|
50
60
|
import type { CompactOptions, ContextUsage } from "./extensions/types";
|
|
51
61
|
import { extractFileMentions, generateFileMentionMessages } from "./file-mentions";
|
|
52
62
|
import type { HookCommandContext } from "./hooks/types";
|
|
53
|
-
import
|
|
63
|
+
import {
|
|
64
|
+
type BashExecutionMessage,
|
|
65
|
+
type BranchSummaryMessage,
|
|
66
|
+
bashExecutionToText,
|
|
67
|
+
type CompactionSummaryMessage,
|
|
68
|
+
type CustomMessage,
|
|
69
|
+
type FileMentionMessage,
|
|
70
|
+
type HookMessage,
|
|
71
|
+
type PythonExecutionMessage,
|
|
72
|
+
pythonExecutionToText,
|
|
73
|
+
} from "./messages";
|
|
54
74
|
import type { ModelRegistry } from "./model-registry";
|
|
55
75
|
import { parseModelString } from "./model-resolver";
|
|
56
76
|
import { expandPromptTemplate, type PromptTemplate, parseCommandArgs, renderPromptTemplate } from "./prompt-templates";
|
|
@@ -3161,6 +3181,14 @@ export class AgentSession {
|
|
|
3161
3181
|
};
|
|
3162
3182
|
}
|
|
3163
3183
|
|
|
3184
|
+
async fetchUsageReports(): Promise<UsageReport[] | null> {
|
|
3185
|
+
const authStorage = this._modelRegistry.authStorage;
|
|
3186
|
+
if (!authStorage.fetchUsageReports) return null;
|
|
3187
|
+
return authStorage.fetchUsageReports({
|
|
3188
|
+
baseUrlResolver: (provider) => this._modelRegistry.getProviderBaseUrl?.(provider),
|
|
3189
|
+
});
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3164
3192
|
/**
|
|
3165
3193
|
* Estimate context tokens from messages, using the last assistant usage when available.
|
|
3166
3194
|
*/
|
|
@@ -3265,6 +3293,36 @@ export class AgentSession {
|
|
|
3265
3293
|
formatSessionAsText(): string {
|
|
3266
3294
|
const lines: string[] = [];
|
|
3267
3295
|
|
|
3296
|
+
// Include system prompt at the beginning
|
|
3297
|
+
const systemPrompt = this.agent.state.systemPrompt;
|
|
3298
|
+
if (systemPrompt) {
|
|
3299
|
+
lines.push("## System Prompt\n");
|
|
3300
|
+
lines.push(systemPrompt);
|
|
3301
|
+
lines.push("\n");
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
// Include model and thinking level
|
|
3305
|
+
const model = this.agent.state.model;
|
|
3306
|
+
const thinkingLevel = this.agent.state.thinkingLevel;
|
|
3307
|
+
lines.push("## Configuration\n");
|
|
3308
|
+
lines.push(`Model: ${model.provider}/${model.id}`);
|
|
3309
|
+
lines.push(`Thinking Level: ${thinkingLevel}`);
|
|
3310
|
+
lines.push("\n");
|
|
3311
|
+
|
|
3312
|
+
// Include available tools
|
|
3313
|
+
const tools = this.agent.state.tools;
|
|
3314
|
+
if (tools.length > 0) {
|
|
3315
|
+
lines.push("## Available Tools\n");
|
|
3316
|
+
for (const tool of tools) {
|
|
3317
|
+
lines.push(`### ${tool.name}\n`);
|
|
3318
|
+
lines.push(tool.description);
|
|
3319
|
+
lines.push("\n```yaml");
|
|
3320
|
+
lines.push(YAML.stringify(tool.parameters, null, 2));
|
|
3321
|
+
lines.push("```\n");
|
|
3322
|
+
}
|
|
3323
|
+
lines.push("\n");
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3268
3326
|
for (const msg of this.messages) {
|
|
3269
3327
|
if (msg.role === "user") {
|
|
3270
3328
|
lines.push("## User\n");
|
|
@@ -3293,8 +3351,8 @@ export class AgentSession {
|
|
|
3293
3351
|
lines.push("</thinking>\n");
|
|
3294
3352
|
} else if (c.type === "toolCall") {
|
|
3295
3353
|
lines.push(`### Tool: ${c.name}`);
|
|
3296
|
-
lines.push("```
|
|
3297
|
-
lines.push(
|
|
3354
|
+
lines.push("```yaml");
|
|
3355
|
+
lines.push(YAML.stringify(c.arguments, null, 2));
|
|
3298
3356
|
lines.push("```\n");
|
|
3299
3357
|
}
|
|
3300
3358
|
}
|
|
@@ -3314,6 +3372,56 @@ export class AgentSession {
|
|
|
3314
3372
|
}
|
|
3315
3373
|
}
|
|
3316
3374
|
lines.push("");
|
|
3375
|
+
} else if (msg.role === "bashExecution") {
|
|
3376
|
+
const bashMsg = msg as BashExecutionMessage;
|
|
3377
|
+
if (!bashMsg.excludeFromContext) {
|
|
3378
|
+
lines.push("## Bash Execution\n");
|
|
3379
|
+
lines.push(bashExecutionToText(bashMsg));
|
|
3380
|
+
lines.push("\n");
|
|
3381
|
+
}
|
|
3382
|
+
} else if (msg.role === "pythonExecution") {
|
|
3383
|
+
const pythonMsg = msg as PythonExecutionMessage;
|
|
3384
|
+
if (!pythonMsg.excludeFromContext) {
|
|
3385
|
+
lines.push("## Python Execution\n");
|
|
3386
|
+
lines.push(pythonExecutionToText(pythonMsg));
|
|
3387
|
+
lines.push("\n");
|
|
3388
|
+
}
|
|
3389
|
+
} else if (msg.role === "custom" || msg.role === "hookMessage") {
|
|
3390
|
+
const customMsg = msg as CustomMessage | HookMessage;
|
|
3391
|
+
lines.push(`## ${customMsg.customType}\n`);
|
|
3392
|
+
if (typeof customMsg.content === "string") {
|
|
3393
|
+
lines.push(customMsg.content);
|
|
3394
|
+
} else {
|
|
3395
|
+
for (const c of customMsg.content) {
|
|
3396
|
+
if (c.type === "text") {
|
|
3397
|
+
lines.push(c.text);
|
|
3398
|
+
} else if (c.type === "image") {
|
|
3399
|
+
lines.push("[Image]");
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
lines.push("\n");
|
|
3404
|
+
} else if (msg.role === "branchSummary") {
|
|
3405
|
+
const branchMsg = msg as BranchSummaryMessage;
|
|
3406
|
+
lines.push("## Branch Summary\n");
|
|
3407
|
+
lines.push(`(from branch: ${branchMsg.fromId})\n`);
|
|
3408
|
+
lines.push(branchMsg.summary);
|
|
3409
|
+
lines.push("\n");
|
|
3410
|
+
} else if (msg.role === "compactionSummary") {
|
|
3411
|
+
const compactMsg = msg as CompactionSummaryMessage;
|
|
3412
|
+
lines.push("## Compaction Summary\n");
|
|
3413
|
+
lines.push(`(${compactMsg.tokensBefore} tokens before compaction)\n`);
|
|
3414
|
+
lines.push(compactMsg.summary);
|
|
3415
|
+
lines.push("\n");
|
|
3416
|
+
} else if (msg.role === "fileMention") {
|
|
3417
|
+
const fileMsg = msg as FileMentionMessage;
|
|
3418
|
+
lines.push("## File Mention\n");
|
|
3419
|
+
for (const file of fileMsg.files) {
|
|
3420
|
+
lines.push(`<file path="${file.path}">`);
|
|
3421
|
+
lines.push(file.content);
|
|
3422
|
+
lines.push("</file>\n");
|
|
3423
|
+
}
|
|
3424
|
+
lines.push("\n");
|
|
3317
3425
|
}
|
|
3318
3426
|
}
|
|
3319
3427
|
|