@oh-my-pi/pi-coding-agent 13.19.0 → 14.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/CHANGELOG.md +266 -1
  2. package/package.json +86 -20
  3. package/scripts/format-prompts.ts +2 -2
  4. package/src/autoresearch/apply-contract-to-state.ts +24 -0
  5. package/src/autoresearch/contract.ts +0 -44
  6. package/src/autoresearch/dashboard.ts +1 -2
  7. package/src/autoresearch/git.ts +91 -0
  8. package/src/autoresearch/helpers.ts +49 -0
  9. package/src/autoresearch/index.ts +28 -187
  10. package/src/autoresearch/prompt.md +26 -9
  11. package/src/autoresearch/state.ts +0 -6
  12. package/src/autoresearch/tools/init-experiment.ts +202 -117
  13. package/src/autoresearch/tools/log-experiment.ts +83 -125
  14. package/src/autoresearch/tools/run-experiment.ts +48 -10
  15. package/src/autoresearch/types.ts +2 -2
  16. package/src/capability/index.ts +4 -2
  17. package/src/cli/file-processor.ts +3 -3
  18. package/src/cli/grep-cli.ts +8 -8
  19. package/src/cli/grievances-cli.ts +78 -0
  20. package/src/cli/read-cli.ts +67 -0
  21. package/src/cli/setup-cli.ts +4 -4
  22. package/src/cli/update-cli.ts +3 -3
  23. package/src/cli.ts +2 -0
  24. package/src/commands/grep.ts +6 -1
  25. package/src/commands/grievances.ts +20 -0
  26. package/src/commands/read.ts +33 -0
  27. package/src/commit/agentic/agent.ts +5 -5
  28. package/src/commit/agentic/index.ts +3 -4
  29. package/src/commit/agentic/tools/analyze-file.ts +3 -3
  30. package/src/commit/agentic/validation.ts +1 -1
  31. package/src/commit/analysis/conventional.ts +4 -4
  32. package/src/commit/analysis/summary.ts +3 -3
  33. package/src/commit/changelog/generate.ts +4 -4
  34. package/src/commit/map-reduce/map-phase.ts +4 -4
  35. package/src/commit/map-reduce/reduce-phase.ts +4 -4
  36. package/src/commit/pipeline.ts +3 -4
  37. package/src/config/prompt-templates.ts +44 -226
  38. package/src/config/resolve-config-value.ts +4 -2
  39. package/src/config/settings-schema.ts +54 -2
  40. package/src/config/settings.ts +25 -26
  41. package/src/dap/client.ts +674 -0
  42. package/src/dap/config.ts +150 -0
  43. package/src/dap/defaults.json +211 -0
  44. package/src/dap/index.ts +4 -0
  45. package/src/dap/session.ts +1255 -0
  46. package/src/dap/types.ts +600 -0
  47. package/src/debug/log-viewer.ts +3 -2
  48. package/src/discovery/builtin.ts +1 -2
  49. package/src/discovery/codex.ts +2 -2
  50. package/src/discovery/github.ts +2 -1
  51. package/src/discovery/helpers.ts +2 -2
  52. package/src/discovery/opencode.ts +2 -2
  53. package/src/edit/diff.ts +818 -0
  54. package/src/edit/index.ts +309 -0
  55. package/src/edit/line-hash.ts +67 -0
  56. package/src/edit/modes/chunk.ts +454 -0
  57. package/src/{patch → edit/modes}/hashline.ts +741 -361
  58. package/src/{patch/applicator.ts → edit/modes/patch.ts} +420 -117
  59. package/src/{patch/fuzzy.ts → edit/modes/replace.ts} +519 -197
  60. package/src/{patch → edit}/normalize.ts +97 -76
  61. package/src/{patch/shared.ts → edit/renderer.ts} +181 -108
  62. package/src/exec/bash-executor.ts +4 -2
  63. package/src/exec/idle-timeout-watchdog.ts +126 -0
  64. package/src/exec/non-interactive-env.ts +5 -0
  65. package/src/extensibility/custom-commands/bundled/ci-green/index.ts +2 -2
  66. package/src/extensibility/custom-commands/bundled/review/index.ts +2 -2
  67. package/src/extensibility/custom-commands/loader.ts +1 -2
  68. package/src/extensibility/custom-tools/loader.ts +34 -11
  69. package/src/extensibility/extensions/loader.ts +9 -4
  70. package/src/extensibility/extensions/runner.ts +24 -1
  71. package/src/extensibility/extensions/types.ts +1 -1
  72. package/src/extensibility/hooks/loader.ts +5 -6
  73. package/src/extensibility/hooks/types.ts +1 -1
  74. package/src/extensibility/plugins/doctor.ts +2 -1
  75. package/src/extensibility/slash-commands.ts +3 -7
  76. package/src/index.ts +2 -1
  77. package/src/internal-urls/docs-index.generated.ts +11 -11
  78. package/src/ipy/executor.ts +58 -17
  79. package/src/ipy/gateway-coordinator.ts +6 -4
  80. package/src/ipy/kernel.ts +45 -22
  81. package/src/ipy/runtime.ts +2 -2
  82. package/src/lsp/client.ts +7 -4
  83. package/src/lsp/clients/lsp-linter-client.ts +4 -4
  84. package/src/lsp/config.ts +2 -2
  85. package/src/lsp/defaults.json +688 -154
  86. package/src/lsp/index.ts +234 -45
  87. package/src/lsp/lspmux.ts +2 -2
  88. package/src/lsp/startup-events.ts +13 -0
  89. package/src/lsp/types.ts +12 -1
  90. package/src/lsp/utils.ts +8 -1
  91. package/src/main.ts +102 -46
  92. package/src/memories/index.ts +4 -5
  93. package/src/modes/acp/acp-agent.ts +563 -163
  94. package/src/modes/acp/acp-event-mapper.ts +9 -1
  95. package/src/modes/acp/acp-mode.ts +4 -2
  96. package/src/modes/components/agent-dashboard.ts +3 -4
  97. package/src/modes/components/diff.ts +6 -7
  98. package/src/modes/components/read-tool-group.ts +6 -12
  99. package/src/modes/components/settings-defs.ts +5 -0
  100. package/src/modes/components/tool-execution.ts +1 -1
  101. package/src/modes/components/welcome.ts +1 -1
  102. package/src/modes/controllers/btw-controller.ts +2 -2
  103. package/src/modes/controllers/command-controller.ts +3 -2
  104. package/src/modes/controllers/input-controller.ts +12 -8
  105. package/src/modes/index.ts +20 -2
  106. package/src/modes/interactive-mode.ts +94 -37
  107. package/src/modes/rpc/host-tools.ts +186 -0
  108. package/src/modes/rpc/rpc-client.ts +178 -13
  109. package/src/modes/rpc/rpc-mode.ts +73 -3
  110. package/src/modes/rpc/rpc-types.ts +53 -1
  111. package/src/modes/theme/theme.ts +80 -8
  112. package/src/modes/types.ts +2 -2
  113. package/src/prompts/system/system-prompt.md +2 -1
  114. package/src/prompts/tools/chunk-edit.md +219 -0
  115. package/src/prompts/tools/debug.md +43 -0
  116. package/src/prompts/tools/grep.md +3 -0
  117. package/src/prompts/tools/lsp.md +5 -5
  118. package/src/prompts/tools/read-chunk.md +17 -0
  119. package/src/prompts/tools/read.md +19 -5
  120. package/src/sdk.ts +190 -154
  121. package/src/secrets/obfuscator.ts +1 -1
  122. package/src/session/agent-session.ts +306 -256
  123. package/src/session/agent-storage.ts +12 -12
  124. package/src/session/compaction/branch-summarization.ts +3 -3
  125. package/src/session/compaction/compaction.ts +5 -6
  126. package/src/session/compaction/utils.ts +3 -3
  127. package/src/session/history-storage.ts +62 -19
  128. package/src/session/messages.ts +3 -3
  129. package/src/session/session-dump-format.ts +203 -0
  130. package/src/session/session-storage.ts +4 -2
  131. package/src/session/streaming-output.ts +1 -1
  132. package/src/session/tool-choice-queue.ts +213 -0
  133. package/src/slash-commands/builtin-registry.ts +56 -8
  134. package/src/ssh/connection-manager.ts +2 -2
  135. package/src/ssh/sshfs-mount.ts +5 -5
  136. package/src/stt/downloader.ts +4 -4
  137. package/src/stt/recorder.ts +4 -4
  138. package/src/stt/transcriber.ts +2 -2
  139. package/src/system-prompt.ts +21 -13
  140. package/src/task/agents.ts +5 -6
  141. package/src/task/commands.ts +2 -5
  142. package/src/task/executor.ts +4 -4
  143. package/src/task/index.ts +3 -4
  144. package/src/task/template.ts +2 -2
  145. package/src/task/worktree.ts +4 -4
  146. package/src/tools/ask.ts +2 -3
  147. package/src/tools/ast-edit.ts +7 -7
  148. package/src/tools/ast-grep.ts +7 -7
  149. package/src/tools/auto-generated-guard.ts +36 -41
  150. package/src/tools/await-tool.ts +2 -2
  151. package/src/tools/bash.ts +5 -23
  152. package/src/tools/browser.ts +4 -5
  153. package/src/tools/calculator.ts +2 -3
  154. package/src/tools/cancel-job.ts +2 -2
  155. package/src/tools/checkpoint.ts +3 -3
  156. package/src/tools/debug.ts +1007 -0
  157. package/src/tools/exit-plan-mode.ts +2 -3
  158. package/src/tools/fetch.ts +67 -3
  159. package/src/tools/find.ts +4 -5
  160. package/src/tools/fs-cache-invalidation.ts +5 -0
  161. package/src/tools/gemini-image.ts +13 -5
  162. package/src/tools/gh.ts +10 -11
  163. package/src/tools/grep.ts +57 -9
  164. package/src/tools/index.ts +44 -22
  165. package/src/tools/inspect-image.ts +4 -4
  166. package/src/tools/output-meta.ts +1 -1
  167. package/src/tools/python.ts +19 -6
  168. package/src/tools/read.ts +198 -67
  169. package/src/tools/render-mermaid.ts +2 -3
  170. package/src/tools/render-utils.ts +20 -6
  171. package/src/tools/renderers.ts +3 -1
  172. package/src/tools/report-tool-issue.ts +80 -0
  173. package/src/tools/resolve.ts +70 -39
  174. package/src/tools/search-tool-bm25.ts +2 -2
  175. package/src/tools/ssh.ts +2 -2
  176. package/src/tools/todo-write.ts +2 -2
  177. package/src/tools/tool-timeouts.ts +1 -0
  178. package/src/tools/write.ts +5 -6
  179. package/src/tui/tree-list.ts +3 -1
  180. package/src/utils/clipboard.ts +80 -0
  181. package/src/utils/commit-message-generator.ts +2 -3
  182. package/src/utils/edit-mode.ts +49 -0
  183. package/src/utils/file-display-mode.ts +6 -5
  184. package/src/utils/file-mentions.ts +8 -7
  185. package/src/utils/git.ts +4 -4
  186. package/src/utils/image-loading.ts +98 -0
  187. package/src/utils/title-generator.ts +2 -3
  188. package/src/utils/tools-manager.ts +6 -6
  189. package/src/web/scrapers/choosealicense.ts +1 -1
  190. package/src/web/search/index.ts +3 -3
  191. package/src/autoresearch/command-initialize.md +0 -34
  192. package/src/patch/diff.ts +0 -433
  193. package/src/patch/index.ts +0 -888
  194. package/src/patch/parser.ts +0 -532
  195. package/src/patch/types.ts +0 -292
  196. package/src/prompts/agents/oracle.md +0 -77
  197. package/src/tools/pending-action.ts +0 -49
  198. package/src/utils/child-process.ts +0 -88
  199. package/src/utils/frontmatter.ts +0 -117
  200. package/src/utils/image-input.ts +0 -274
  201. package/src/utils/mime.ts +0 -53
  202. package/src/utils/prompt-format.ts +0 -170
package/CHANGELOG.md CHANGED
@@ -2,7 +2,264 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [14.0.2] - 2026-04-09
6
+ ### Added
7
+
8
+ - Added `/force` slash command to force the next agent turn to use a specific tool
9
+ - Added `ToolChoiceQueue` for managing tool-choice directives with lifecycle callbacks and requeue semantics
10
+ - Added `setForcedToolChoice()` method to AgentSession to programmatically force tool invocations
11
+ - Added `toolChoiceQueue` property to AgentSession for direct queue access
12
+ - Added `peekQueueInvoker()` method to AgentSession to retrieve in-flight tool invocation handlers
13
+ - Added `queueResolveHandler()` function as the canonical entry point for preview/apply workflows
14
+ - Added `buildToolChoice()` and `steer()` methods to ToolSession for tool-choice queue integration
15
+ - Added `getToolChoiceQueue()` method to ToolSession for accessing the tool-choice queue
16
+ - Added support for embedded URL selectors (`:raw` and `:L#-L#` line ranges) in read command paths
17
+ - Added `parseReadUrlTarget` function to parse and validate URL read targets with line range support
18
+ - Added `decl` region to chunk selector for targeting declarations without leading trivia
19
+ - Exported `hooks` subpath for extensibility API access
20
+ - Added `build` script for compiling binary artifacts
21
+
22
+ ### Changed
23
+
24
+ - Refactored pending action handling from `PendingActionStore` to `ToolChoiceQueue` with generator-based directives
25
+ - Changed tool-choice override mechanism from simple override to a queue-based system with callbacks
26
+ - Updated `ResolveTool` to dispatch to in-flight queue invokers instead of popping from a pending action store
27
+ - Updated custom tool loader to accept `pushPendingAction` callback instead of `PendingActionStore` instance
28
+ - Updated `AstEditTool` to use `queueResolveHandler()` for preview/apply semantics
29
+ - Changed eager-todo prelude to use the tool-choice queue instead of simple override
30
+ - Updated todo reminder suppression to check for user-forced directives via `consumeLastServedLabel()`
31
+ - Made model-specific edit mode defaults conditional on `PI_STRICT_EDIT_MODE` environment variable for greater flexibility in edit mode selection
32
+ - Updated slash command handlers to support returning remaining text as prompt input instead of consuming input entirely
33
+ - Enhanced slash command parser to recognize both whitespace and colon (`:`) as command argument separators
34
+ - Updated indentation guidance for chunk edit content to use single leading spaces per indent level instead of tabs
35
+ - Updated read CLI to delegate URL inputs through the read tool pipeline instead of treating them as local file paths
36
+ - Updated chunk edit documentation to clarify region semantics and emphasize using the narrowest region for edits
37
+ - Improved chunk selector guidance with visual diagram showing region boundaries
38
+ - Renamed `build:binary` script to `build`
39
+ - Refactored `check` script to include linting via Biome and type checking
40
+ - Added `check:types`, `lint`, `fmt`, and `fix` scripts for improved developer workflow
41
+ - Simplified TypeScript configuration by extending workspace-level config
42
+
43
+ ### Removed
44
+
45
+ - Removed `PendingActionStore` class and related pending-action module
46
+ - Removed `pendingActionStore` parameter from AgentSession config
47
+ - Removed `pendingActionStore` from ToolSession interface
48
+ - Removed `consumeNextToolChoiceOverride()` method from AgentSession (replaced by `nextToolChoice()`)
49
+
50
+ ### Fixed
51
+
52
+ - Fixed tool-choice queue cleanup on agent loop abort to prevent orphaned in-flight directives
53
+ - Fixed requeue semantics to preserve `onInvoked` and `onRejected` callbacks across multiple abort cycles
54
+
55
+ ## [14.0.1] - 2026-04-08
56
+
57
+ ### Changed
58
+
59
+ - Improved auto-generated file detection to gracefully handle ENOENT errors when peeking file content, preventing unnecessary abort failures
60
+ - Optimized context emission by skipping message cloning when no extensions have context handlers
61
+ - Improved message cloning resilience by falling back to shallow array clone when structured cloning fails due to non-cloneable objects
62
+ - Made `assertEditableFileContent` synchronous instead of async for improved performance in streaming edit checks
63
+ - Enhanced streaming edit abort detection to check for auto-generated files as soon as the file path is available, rather than waiting for the full diff
64
+ - Improved file prefix reading in session storage to use `peekFile` utility from @oh-my-pi/pi-utils for better efficiency
65
+ - Moved image metadata detection to @oh-my-pi/pi-utils package for shared use across projects
66
+ - Simplified image loading API by removing redundant metadata parameters and consolidating image utilities
67
+ - Updated imports to use readImageMetadata and parseImageMetadata from @oh-my-pi/pi-utils instead of local implementations
68
+
69
+ ### Removed
70
+
71
+ - Removed image-input.ts utility module; functionality consolidated into image-loading.ts
72
+ - Removed mime.ts utility module; MIME detection moved to @oh-my-pi/pi-utils
73
+ - Removed ImageMetadata interface and ReadImageMetadataOptions from local codebase
74
+
75
+ ### Fixed
76
+
77
+ - Fixed streaming edit abort for auto-generated files by adding LRU caching and early path-based detection to prevent unnecessary edits
78
+
79
+ ## [14.0.0] - 2026-04-08
80
+
81
+ ### Breaking Changes
82
+
83
+ - Simplified chunk edit operations: removed `append_child`, `prepend_child`, `append_sibling`, `prepend_sibling`, and `replace_body` ops in favor of unified `replace`, `before`, `after`, `prepend`, and `append` with region targeting (`@head`, `@body`, `@tail`)
84
+ - Chunk edit `target` format changed: now accepts `selector#CRC@region` for mutations and `selector@region` for insertions; removed separate `crc` and `anchor` fields from edit operations
85
+ - Removed checksum requirement from insert operations (`before`, `after`, `prepend`, `append`); only `replace` requires `#CRC` suffix
86
+
87
+ ### Added
88
+
89
+ - Auto QA tool (`report_tool_issue`) for automated tracking of unexpected tool behavior; enabled via `PI_AUTO_QA=1` environment variable or `dev.autoqa` setting
90
+ - `dev.autoqa` setting to enable automated tool issue reporting for all agents
91
+ - System prompt guidance when `report_tool_issue` tool is available, encouraging agents to report tool behavior discrepancies
92
+ - LSP server discovery at startup via `discoverStartupLspServers()` to detect configured language servers without blocking initialization
93
+ - LSP startup event channel (`lsp:startup`) for asynchronous server warmup notifications with completion or failure status
94
+ - `LspStartupServerInfo` type for tracking LSP server status including connecting, ready, and error states
95
+ - LSP server status display in `/info` command showing connecting, ready, and error states with color-coded indicators
96
+ - Multi-session support in ACP mode: agents can now manage multiple concurrent sessions with independent state, models, and configurations
97
+ - Session forking in ACP mode: `unstable_forkSession` creates a new session from an existing one's history
98
+ - Session resumption in ACP mode: `unstable_resumeSession` reloads a previously saved session
99
+ - Session closure in ACP mode: `unstable_closeSession` cleanly shuts down a session and releases resources
100
+ - Model state reporting in ACP mode: `SessionModelState` with available models and current selection in session responses
101
+ - Direct model setting in ACP mode: `unstable_setSessionModel` RPC command for changing the active model
102
+ - Turn-level usage tracking in ACP mode: prompt responses now include `usage` with input/output/cached token counts
103
+ - Message ID tracking in ACP mode: stable message IDs for assistant chunks enabling client-side message correlation
104
+ - Settings cloning: `Settings.cloneForCwd()` method to create isolated settings instances for different working directories
105
+ - Extension flag value retrieval: `ExtensionRunner.getFlagValues()` to inspect current flag state
106
+ - Exported autoresearch module and submodules via `./autoresearch` and `./autoresearch/*` package paths
107
+ - Exported autoresearch tools via `./autoresearch/tools/*` package path
108
+ - Exported CLI commands via `./cli/commands/*` package path
109
+ - Exported DAP module and submodules via `./dap` and `./dap/*` package paths
110
+ - Exported edit module and submodules via `./edit`, `./edit/*`, and `./edit/modes/*` package paths
111
+ - Exported bundled ci-green custom command via `./extensibility/custom-commands/bundled/ci-green` package path
112
+ - Exported extensibility plugins marketplace via `./extensibility/plugins/marketplace` and `./extensibility/plugins/marketplace/*` package paths
113
+ - Exported ACP mode via `./modes/acp` and `./modes/acp/*` package paths
114
+ - Exported web utilities via `./web/*` package path
115
+ - Exported line-hash utilities from edit module via `./edit/line-hash`
116
+ - Host-owned custom tools support: RPC clients can now register custom tools via `setCustomTools()` and the RPC server will invoke them over the transport with `host_tool_call` requests
117
+ - RPC host tool framework: `RpcHostToolBridge` for managing host tool execution, `RpcHostToolDefinition` for tool metadata, and bidirectional `host_tool_call`, `host_tool_cancel`, `host_tool_update`, and `host_tool_result` frames
118
+ - RPC client tool API: `defineRpcClientTool()` helper, `RpcClientCustomTool` interface, and `RpcClientToolContext` for implementing host-side tool execution with update streaming and abort support
119
+ - `set_host_tools` RPC command to replace the active set of host-owned tools before the next model call
120
+ - `refreshRpcHostTools()` method on `AgentSession` to integrate host tools into the active tool registry with conflict detection and auto-activation of non-hidden tools
121
+ - Instruction breakpoints support: `set_instruction_breakpoint` and `remove_instruction_breakpoint` debug actions for setting breakpoints at specific instruction addresses
122
+ - Data breakpoints support: `data_breakpoint_info`, `set_data_breakpoint`, and `remove_data_breakpoint` debug actions for monitoring variable/memory access
123
+ - Memory introspection: `read_memory` and `write_memory` debug actions for inspecting and modifying debugger memory
124
+ - Disassembly support: `disassemble` debug action for viewing assembly instructions with symbol resolution
125
+ - Module and source introspection: `modules` and `loaded_sources` debug actions for querying loaded modules and source files
126
+ - Custom DAP requests: `custom_request` debug action for sending arbitrary Debug Adapter Protocol commands
127
+ - Reverse request handling in DAP client: `onReverseRequest()` method for responding to adapter-initiated requests like `runInTerminal` and `startDebugging`
128
+ - DAP reverse request support: adapters can now request terminal spawning and child debug sessions via `runInTerminal` and `startDebugging` reverse requests
129
+ - Instruction pointer reference in debug snapshots: `instructionPointerReference` field in session summaries for low-level debugging
130
+ - Hit condition support for instruction and data breakpoints: `hit_condition` parameter for conditional breakpoint triggering
131
+ - RPC `set_todos` command and `todoPhases` in `get_state`, allowing hosts to pre-seed and inspect session todo state over the protocol
132
+ - Deferred diagnostics support in LSP writethrough: `onDeferredDiagnostics` callback and `deferredSignal` in `WritethroughOptions` allow callers to receive diagnostics that arrive after the main 5-second timeout
133
+ - Language detection for `.pm` (Perl modules), `.astro` (Astro framework), and special filenames `containerfile` and `justfile`
134
+ - Workspace-scoped diagnostics and reload actions via `*` file parameter; `diagnostics` action now supports `*` for workspace-wide diagnostics across all configured servers
135
+ - Socket-mode DAP adapter support for debuggers like dlv that communicate via network sockets instead of stdio; Linux uses unix domain sockets, macOS/other platforms use TCP with client-addr dialing
136
+ - Improved extensionless binary debugging: native debuggers (gdb, lldb-dap) and adapters with root markers are now preferred over unrelated adapters like debugpy
137
+ - Debug tool with DAP (Debug Adapter Protocol) support for launching and attaching debuggers, setting breakpoints, stepping through execution, inspecting threads/stack/variables, and evaluating expressions
138
+ - Debug adapter configuration for gdb, lldb-dap, debugpy, and dlv with language/file-type matching and root marker detection
139
+ - Debug session management with support for source and function breakpoints, conditional breakpoints, stack trace inspection, scope/variable exploration, and program output capture
140
+ - `debug.enabled` setting to control debug tool availability
141
+ - Chunk read formatting: `anchorStyle` (full / kind / bare), `read.anchorstyle` setting, and `chunked` flag on file display mode
142
+ - `read.prosechunks` and `read.explorechunks` settings for prose chunk trees and checksum-free explore trees
143
+ - Handlebars helpers `anchor` and `sel` (with template `anchorStyle` context) for chunk examples in prompts
144
+ - Chunk-mode grep lines as `path:selector>LINE|content`; unified grep tool template behind `IS_CHUNK_MODE`
145
+ - `lru-cache` for chunk tree caching
146
+ - Chunk-mode `read` output: recursive rendering with `$XXXX` checksum suffixes, inline large-chunk previews, and normalized `#path$XXXX` selectors between read and edit
147
+ - Autoresearch: `init_experiment` options `new_segment`, `from_autoresearch_md`, `abandon_unlogged_runs`; `log_experiment` options `skip_restore` and broader `force`; `run_experiment` `force` (with warnings); pre-run dirty-path tracking; `abandonUnloggedAutoresearchRuns` and `abandonedAt` on runs
148
+ - LSP: diagnostic versioning (`versionSupport`, stored document version per diagnostic set), and `waitForDiagnostics` / `getDiagnosticsForFile` options (`expectedDocumentVersion`, `allowUnversioned`)
149
+
150
+ ### Changed
151
+
152
+ - Extracted working directory formatting logic into `formatToolWorkingDirectory()` utility for consistent path display across tools
153
+ - Bash command rendering now sanitizes tabs and shortens home directory paths in command previews
154
+ - Chunk edit tool schema: renamed `target` parameter to `sel` for consistency with read tool terminology
155
+ - Chunk edit tool: `op` parameter is now required (previously optional with `replace` default)
156
+ - Chunk edit documentation: updated all region references from `@inner` to `@body` for clearer semantics
157
+ - Chunk edit documentation: expanded with comprehensive real-world examples showing full read output, operation effects, and indentation rules
158
+ - Chunk edit documentation: simplified indentation guidance to write content at indent-level 0 with automatic re-indentation by the tool
159
+ - Chunk edit documentation: clarified that `@region` only works on container chunks, not leaf chunks
160
+ - Chunk edit documentation: emphasized that CRCs change after every edit and must be refreshed from latest responses
161
+ - Read chunk tool documentation: updated selector examples to use `@body` instead of `@inner`
162
+ - Chunk edit region terminology updated: `@inner` renamed to `@body` for clearer semantics in container chunks
163
+ - Chunk edit documentation restructured with comprehensive examples showing full read output, operation effects, and indentation rules
164
+ - Chunk edit indentation guidance simplified: content should be written at indent-level 0 and the tool automatically applies correct base indentation
165
+ - Chunk edit examples expanded with realistic TypeScript code samples demonstrating replace, insert, prepend, append, and delete operations
166
+ - Python tool description now dynamically reflects prelude documentation availability instead of static text
167
+ - Python tool now automatically warms the environment on first execution if prelude helpers are unavailable, ensuring documentation is loaded before use
168
+ - Tool creation now auto-injects `report_tool_issue` when auto QA is enabled, regardless of requested tool list
169
+ - Chunk edit region names standardized to `@head`, `@body`, and `@tail` for clearer semantics
170
+ - Chunk edit documentation clarified: region defaults to full chunk when omitted; leaf chunks no longer support region targeting
171
+ - Chunk read documentation updated: selector examples now use region-specific selectors based on `@head`, `@body`, and `@tail`
172
+ - LSP server connecting status in welcome banner now uses muted pending symbol instead of warning symbol for clearer visual distinction
173
+ - Codex websocket prewarm now runs asynchronously in the background instead of blocking session creation, allowing faster startup
174
+ - Codex websocket status updates now display in interactive mode when prewarm completes or fails
175
+ - LSP server warmup now runs asynchronously in the background instead of blocking session creation, allowing faster startup
176
+ - LSP servers returned from `createAgentSession()` now include `connecting` status during initial warmup phase
177
+ - Interactive mode now subscribes to LSP startup events and displays status updates and error messages to the user
178
+ - LSP server status in `/info` command now distinguishes between connecting (yellow), ready (green), and error (red) states
179
+ - ACP agent now manages multiple sessions instead of a single session; session lifecycle and configuration are now per-session
180
+ - ACP session creation now uses a factory function to support creating new sessions for different working directories
181
+ - ACP event mapping now accepts optional `getMessageId` callback for stable message ID assignment to assistant chunks
182
+
183
+ ### Removed
184
+
185
+ - Deleted `src/utils/prompt-format.ts` module; prompt formatting logic moved to `pi-utils`
186
+ - Deleted `src/utils/frontmatter.ts` module; frontmatter parsing logic moved to `pi-utils`
187
+ - Removed `waitForChildProcess` utility (child process termination now handled by native `killTree` from pi-natives)
188
+ - `grep-chunk.md` (folded into unified grep template)
189
+ - `startMacAppearanceObserver` export (use `MacAppearanceObserver.start()`)
190
+ - `copyToClipboard` export from pi-natives
191
+ - `PI_CHUNK_SPLICES` env and `chunkSplicesEnabled()`
192
+ - Autoresearch `segmentFingerprint` and related config hashing
193
+
194
+ ### Fixed
195
+
196
+ - Chunk edit parameter validation: corrected detection of chunk edit operations to check for `sel` field instead of `target`
197
+ - Chunk edit streaming previews: updated to reference `sel` parameter instead of `target`
198
+ - Python prelude introspection now respects execution timeout and signal options, preventing hangs during environment warmup
199
+ - Welcome banner LSP server status now updates in real-time when background startup warmup completes, eliminating stale connecting status displays
200
+ - Welcome banner LSP startup rows now re-render when background warmup finishes, use the pending status symbol while servers are still connecting, and no longer add a redundant `LSP ready` status line on successful startup
201
+ - ACP session initialization now registers connection cleanup handlers to dispose all sessions on disconnect
202
+ - Reorganized package.json exports: moved `./edit` exports before `./plan-mode` for better logical grouping
203
+ - Notebook conversion logic now checks for raw read mode or non-chunk mode before converting via markit, allowing chunk-mode reads of `.ipynb` files to use chunk parsing instead of conversion
204
+ - Go receiver methods now render as top-level siblings instead of nested under their receiver type in chunk read output
205
+ - Moved prompt formatting and rendering utilities from `coding-agent` to `pi-utils` package; `renderPromptTemplate()` and `formatPromptContent()` now accessed via `prompt.render()` and `prompt.format()` from `@oh-my-pi/pi-utils`
206
+ - Moved `parseFrontmatter()` utility from `coding-agent` to `pi-utils` package; now imported from `@oh-my-pi/pi-utils` instead of local utils
207
+ - Consolidated prompt template handling: `TemplateContext` type now available as `prompt.TemplateContext` from `@oh-my-pi/pi-utils`
208
+ - DAP initialization now advertises support for `runInTerminal` and `startDebugging` reverse requests, and memory references
209
+ - Debug tool schema expanded with new parameters for instruction/data breakpoints, memory operations, and custom requests
210
+ - DAP session state now tracks instruction and data breakpoints separately from source breakpoints
211
+ - Replaced `Bun.which()` with `$which()` from pi-utils for command resolution
212
+ - Chunk edit tool documentation restructured: replaced operation-specific examples with region-based guidance and canonical indentation rules
213
+ - Chunk read documentation updated: selectors now support region syntax (e.g., `class_Foo.fn_bar#ABCD@body`) and canonical target listings show supported regions per chunk
214
+ - Chunk edit schema simplified: `target` description now documents region format; `op` and `content` descriptions clarified for region-aware operations
215
+ - Chunk edit streaming previews updated: labels now reflect region-aware operations (e.g., `append` instead of `append child`, `insert after` without anchor reference)
216
+ - Removed CRC parsing from `parseChunkSelector()` and `parseChunkReadPath()`: selectors no longer extract embedded checksums
217
+ - Chunk edit normalization simplified: no longer requires async checksum resolution or context-dependent operation mapping
218
+ - RPC mode now automatically disables session title generation by default; hosts can opt in with `PI_RPC_EMIT_TITLE=1` environment variable to receive title updates
219
+ - RPC mode now resets workflow-altering `todo.*`, `task.*`, and `async.*` settings to built-in defaults instead of inheriting user overrides
220
+ - RPC mode now disables automatic session title generation by default and suppresses `setTitle` extension UI requests unless hosts opt in with `PI_RPC_EMIT_TITLE=1`
221
+ - Reorganized edit tool implementation from `patch/` to `edit/` directory structure with dedicated mode subdirectories (`edit/modes/chunk.ts`, `edit/modes/hashline.ts`, `edit/modes/patch.ts`, `edit/modes/replace.ts`)
222
+ - Updated package.json exports to use `./edit` path instead of `./patch` for edit tool and related utilities
223
+ - Chunk edit tool documentation simplified: removed line-based edit examples, clarified `target` format with full path and CRC suffix, added guidance for `replace_body` operation to preserve declarations
224
+ - LSP diagnostics timeout reduced from 10 seconds to 5 seconds for faster feedback; slow diagnostics now fetch in background via deferred mechanism
225
+ - Diagnostics action error messaging clarified: requires `file` parameter or `*` for workspace scope; improved guidance in error responses
226
+ - Workspace symbols and reload actions now accept `*` to operate across all configured servers instead of requiring a file path
227
+ - DAP session initialization now subscribes to stop events before launching/attaching to avoid missing stopOnEntry events
228
+ - Stack frame fetching moved outside the event dispatch loop to prevent deadlocks and improve responsiveness
229
+ - Evaluate requests now default to the top stopped frame when frameId is not explicitly provided
230
+ - Eager todo enforcement now skips prompts ending with question marks or exclamation marks, treating them as queries or commands rather than statements requiring task planning
231
+ - Chunk read output now displays fully-qualified anchor paths (e.g., `[class_Worker.fn_run#CRC]`) instead of bare names, making targets unambiguous for edits
232
+ - Chunk edit tool documentation clarified: `target` must be the fully-qualified path with `#CRC` suffix; added guidance to run `read(path="file", sel="?")` for canonical target listings when anchor style is unclear
233
+ - Chunk read tool documentation updated: `sel` parameter now documents the `?` selector for canonical target listings, and clarifies that default output shows full paths
234
+ - Chunk edit schema and tool contract: explicit `op` (`replace`, `append`, `prepend`, `after`, `before`); use `replace` with empty `content` to remove a chunk (no separate `delete` op); sibling inserts use `anchor` instead of separate after/before target fields; insert ops omit CRC where appropriate, mutations require checksum on target
235
+ - Chunk path handling: parse selector and CRC separately, sanitize selectors (strip filename prefixes, uppercase checksums), accept embedded `#CRC` on targets, auto-accept stale CRC for later ops in the same batch on the same chunk
236
+ - Chunk UX: streaming and final edit previews show chunk edits next to hashline edits with op-specific labels; prompt docs shortened with rules table, `…` in examples, and helper-based path/anchor samples
237
+ - `log_experiment` only reverts files modified by the run; prompts and errors document that pre-existing dirty files are preserved; richer pending-run error context; `init_experiment` no-ops when the contract matches unless `new_segment`; secondary metrics informational only (no `force` for drift)
238
+ - Autoresearch: `log_experiment` reloads benchmark/scope/constraints from `autoresearch.md` after resolving a pending run; `/autoresearch` without `autoresearch.md` follows `/plan`-style toggle and message flow; setup moved into autoresearch system prompt (removed `command-initialize.md`)
239
+ - Native/shell alignment: `GrepOutputMode` from pi-natives; shell and `getDiagnosticsForFile` callbacks use error-first `(err, chunk)`; `getDiagnosticsForFile` takes an options object
240
+ - Clipboard: `copyToClipboard` / `readImageFromClipboard` live in `utils/clipboard.ts` (OSC 52 and Termux)
241
+ - macOS: session-wide power assertion while the agent runs; `MacAppearanceObserver.start()` with error-first callback; `detectMacOSAppearance()` returns enum values
242
+ - ACP session cleanup now properly cancels in-flight prompts and disposes resources when sessions are closed or connection aborts
243
+ - Removed unused `_createErrorToolResult` helper function from RPC host-tools module
244
+ - Fixed Go receiver method indentation in append operations to preserve relative indentation from the anchor chunk
245
+ - Fixed Go type chunk line counts to report only the type body lines instead of including grouped receiver methods
246
+ - Fixed enum variant insertion to avoid adding extra blank lines between variants
247
+ - Chunk read output now correctly preserves embedded CRC in selectors (e.g., `class_Foo.fn_bar#ZZPM`) instead of stripping them during path parsing
248
+ - Chunk edit error messages now consistently report checksum mismatches with format `Checksum mismatch` instead of variable phrasing
249
+ - Chunk-mode read output now correctly displays scoped response trees showing only touched chunks and adjacent siblings, preventing unrelated distant chunks from appearing in responses
250
+ - DAP stopped event handling no longer blocks the message reader, preventing potential deadlocks during rapid event sequences
251
+ - Chunk-mode whole-chunk replaces now preserve attached leading comments and docblocks when replacement content starts at the declaration, preventing accidental comment loss during agent edits
252
+ - Chunk edit error messages now consistently report checksum mismatches with the format `did not match checksum "XXXX"` instead of variable phrasing
253
+ - Chunk selector validation for edits now rejects non-canonical selectors (suffix-only like `fn_run` or prefix-stripped like `run`), requiring fully-qualified paths to prevent ambiguity
254
+ - Plan review previews now re-append at the chat tail on refresh, keeping them adjacent to the active selector instead of updating off-screen
255
+ - `log_experiment` validates and reverts run-scoped file changes without clobbering unrelated dirty worktree state
256
+ - Chunk edit targets that embed CRC in the selector (e.g. `fn_foo#ABCD`) parse correctly
257
+ - Shell paths check errors before consuming chunk output (bash executor, config resolution)
258
+ - `/autoresearch` toggles like `/plan` when empty; slash completion no longer suggests `off`/`clear` on an empty prefix after the command
259
+ - Chunk-mode read/edit edge cases (zero-width gap replaces, stale batch diagnostics, grouped Go receivers, line-count headers, parse error locations)
260
+
5
261
  ## [13.19.0] - 2026-04-05
262
+
6
263
  ### Added
7
264
 
8
265
  - Added idle auto-compaction settings and scheduling so sessions can compact after inactive turns without auto-continuing.
@@ -50,6 +307,7 @@
50
307
  - Fixed the plan review selector to support the external editor shortcut for opening and updating the current plan from the approval screen
51
308
 
52
309
  ## [13.18.0] - 2026-04-02
310
+
53
311
  ### Breaking Changes
54
312
 
55
313
  - Removed standalone `fetch` tool; URL fetching is now integrated into the `read` tool
@@ -72,6 +330,7 @@
72
330
  - Fixed `read` tool to properly handle `file://` URL scheme by converting to filesystem paths
73
331
 
74
332
  ## [13.17.5] - 2026-04-01
333
+
75
334
  ### Added
76
335
 
77
336
  - Added support for writing to ZIP archives using fflate library for cross-platform compatibility
@@ -85,6 +344,7 @@
85
344
  - Removed GhPrPushTool test case
86
345
 
87
346
  ## [13.17.4] - 2026-04-01
347
+
88
348
  ### Added
89
349
 
90
350
  - Support for writing to archive entries in `.tar`, `.tar.gz`, `.tgz`, and `.zip` files using `archive.ext:path/inside/archive` syntax
@@ -109,6 +369,7 @@
109
369
  - Updated `read` tool documentation to reflect archive support and usage patterns
110
370
 
111
371
  ## [13.17.2] - 2026-04-01
372
+
112
373
  ### Added
113
374
 
114
375
  - Added `/marketplace help` command to display usage guide for all marketplace operations
@@ -164,6 +425,7 @@
164
425
  - Fixed inline image rendering to cap image height and preserve multiplexer scrollback during terminal resizes ([#587](https://github.com/can1357/oh-my-pi/pull/587) by [@smileynet](https://github.com/smileynet))
165
426
 
166
427
  ## [13.17.1] - 2026-04-01
428
+
167
429
  ### Removed
168
430
 
169
431
  - Removed `code_search` tool for code snippet and documentation search
@@ -173,6 +435,7 @@
173
435
  - Fixed edit tool diff rendering to wrap long diff lines with continuation gutters instead of truncating them at terminal width ([#578](https://github.com/can1357/oh-my-pi/issues/578))
174
436
  - Fixed `--list-models` and `/model` provider filtering to hide models from disabled providers ([#588](https://github.com/can1357/oh-my-pi/issues/588))
175
437
  - Fixed edit tool diffstats to use diff-specific add/remove theme colors instead of success/error status colors ([#589](https://github.com/can1357/oh-my-pi/issues/589))
438
+
176
439
  ## [13.17.0] - 2026-03-30
177
440
 
178
441
  ### Added
@@ -225,6 +488,7 @@
225
488
  - Fixed `--model provider/id` resolving to wrong provider when model ID exists in multiple catalogs ([#560](https://github.com/can1357/oh-my-pi/issues/560))
226
489
 
227
490
  ## [13.16.4] - 2026-03-28
491
+
228
492
  ### Changed
229
493
 
230
494
  - Renamed hashline helper functions from `hlineref`/`hlinefull` to `href`/`hline` for brevity
@@ -404,6 +668,7 @@
404
668
  ### Added
405
669
 
406
670
  - Session observer overlay (`Ctrl+S`): view running subagent sessions with a picker and read-only transcript showing thinking, text, tool calls, and results
671
+
407
672
  ## [13.14.0] - 2026-03-20
408
673
 
409
674
  ### Added
@@ -1680,7 +1945,7 @@
1680
1945
 
1681
1946
  - Changed custom UI hook cleanup to conditionally restore editor state only when not using overlay mode
1682
1947
  - Extracted environment variable configuration for non-interactive bash execution into reusable `NO_PAGER_ENV` constant
1683
- - Replaced custom timing instrumentation with logger.timeAsync() and logger.time() from pi-utils for consistent startup profiling
1948
+ - Replaced custom timing instrumentation with logger.time() and logger.time() from pi-utils for consistent startup profiling
1684
1949
  - Removed PI_DEBUG_STARTUP environment variable in favor of logger.debug() for conditional debug output
1685
1950
  - Consolidated timing calls throughout initialization pipeline to use unified logger-based timing system
1686
1951
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-coding-agent",
4
- "version": "13.19.0",
4
+ "version": "14.0.2",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -31,23 +31,27 @@
31
31
  "omp": "src/cli.ts"
32
32
  },
33
33
  "scripts": {
34
- "check": "tsgo -p tsconfig.json",
34
+ "build": "bun --cwd=../stats scripts/generate-client-bundle.ts --generate && bun --cwd=../natives run embed:native && bun build --compile --define PI_COMPILED=true --external mupdf --root ../.. ./src/cli.ts --outfile dist/omp && bun --cwd=../natives run embed:native --reset && bun --cwd=../stats scripts/generate-client-bundle.ts --reset",
35
+ "check": "biome check . && bun run check:types",
36
+ "check:types": "tsgo -p tsconfig.json --noEmit",
37
+ "lint": "biome lint .",
38
+ "test": "bun test",
39
+ "fix": "biome check --write --unsafe . && bun run format-prompts && bun run generate-docs-index",
40
+ "fmt": "biome format --write . && bun run format-prompts",
35
41
  "format-prompts": "bun scripts/format-prompts.ts",
36
42
  "generate-docs-index": "bun scripts/generate-docs-index.ts",
37
43
  "prepack": "bun scripts/generate-docs-index.ts",
38
- "build:binary": "cd ../.. && bun --cwd=packages/stats scripts/generate-client-bundle.ts && bun --cwd=packages/natives run embed:native && bun build --compile --define PI_COMPILED=true --external mupdf --root . ./packages/coding-agent/src/cli.ts --outfile packages/coding-agent/dist/omp && bun --cwd=packages/natives run embed:native --reset && bun --cwd=packages/stats scripts/generate-client-bundle.ts --reset",
39
- "generate-template": "bun scripts/generate-template.ts",
40
- "test": "bun test"
44
+ "generate-template": "bun scripts/generate-template.ts"
41
45
  },
42
46
  "dependencies": {
43
47
  "@agentclientprotocol/sdk": "0.16.1",
44
48
  "@mozilla/readability": "^0.6",
45
- "@oh-my-pi/omp-stats": "13.19.0",
46
- "@oh-my-pi/pi-agent-core": "13.19.0",
47
- "@oh-my-pi/pi-ai": "13.19.0",
48
- "@oh-my-pi/pi-natives": "13.19.0",
49
- "@oh-my-pi/pi-tui": "13.19.0",
50
- "@oh-my-pi/pi-utils": "13.19.0",
49
+ "@oh-my-pi/omp-stats": "14.0.2",
50
+ "@oh-my-pi/pi-agent-core": "14.0.2",
51
+ "@oh-my-pi/pi-ai": "14.0.2",
52
+ "@oh-my-pi/pi-natives": "14.0.2",
53
+ "@oh-my-pi/pi-tui": "14.0.2",
54
+ "@oh-my-pi/pi-utils": "14.0.2",
51
55
  "@sinclair/typebox": "^0.34",
52
56
  "@xterm/headless": "^6.0",
53
57
  "ajv": "^8.18",
@@ -56,6 +60,7 @@
56
60
  "fflate": "0.8.2",
57
61
  "handlebars": "^4.7",
58
62
  "linkedom": "^0.18",
63
+ "lru-cache": "11.3.1",
59
64
  "markit-ai": "0.5.0",
60
65
  "puppeteer": "^24.37",
61
66
  "zod": "4.3.6"
@@ -90,6 +95,18 @@
90
95
  "types": "./src/async/*.ts",
91
96
  "import": "./src/async/*.ts"
92
97
  },
98
+ "./autoresearch": {
99
+ "types": "./src/autoresearch/index.ts",
100
+ "import": "./src/autoresearch/index.ts"
101
+ },
102
+ "./autoresearch/*": {
103
+ "types": "./src/autoresearch/*.ts",
104
+ "import": "./src/autoresearch/*.ts"
105
+ },
106
+ "./autoresearch/tools/*": {
107
+ "types": "./src/autoresearch/tools/*.ts",
108
+ "import": "./src/autoresearch/tools/*.ts"
109
+ },
93
110
  "./capability": {
94
111
  "types": "./src/capability/index.ts",
95
112
  "import": "./src/capability/index.ts"
@@ -102,6 +119,10 @@
102
119
  "types": "./src/cli/*.ts",
103
120
  "import": "./src/cli/*.ts"
104
121
  },
122
+ "./cli/commands/*": {
123
+ "types": "./src/cli/commands/*.ts",
124
+ "import": "./src/cli/commands/*.ts"
125
+ },
105
126
  "./commands/*": {
106
127
  "types": "./src/commands/*.ts",
107
128
  "import": "./src/commands/*.ts"
@@ -166,6 +187,14 @@
166
187
  "types": "./src/config/*.ts",
167
188
  "import": "./src/config/*.ts"
168
189
  },
190
+ "./dap": {
191
+ "types": "./src/dap/index.ts",
192
+ "import": "./src/dap/index.ts"
193
+ },
194
+ "./dap/*": {
195
+ "types": "./src/dap/*.ts",
196
+ "import": "./src/dap/*.ts"
197
+ },
169
198
  "./debug": {
170
199
  "types": "./src/debug/index.ts",
171
200
  "import": "./src/debug/index.ts"
@@ -182,6 +211,18 @@
182
211
  "types": "./src/discovery/*.ts",
183
212
  "import": "./src/discovery/*.ts"
184
213
  },
214
+ "./edit": {
215
+ "types": "./src/edit/index.ts",
216
+ "import": "./src/edit/index.ts"
217
+ },
218
+ "./edit/*": {
219
+ "types": "./src/edit/*.ts",
220
+ "import": "./src/edit/*.ts"
221
+ },
222
+ "./edit/modes/*": {
223
+ "types": "./src/edit/modes/*.ts",
224
+ "import": "./src/edit/modes/*.ts"
225
+ },
185
226
  "./exa": {
186
227
  "types": "./src/exa/index.ts",
187
228
  "import": "./src/exa/index.ts"
@@ -218,6 +259,10 @@
218
259
  "types": "./src/extensibility/custom-commands/*.ts",
219
260
  "import": "./src/extensibility/custom-commands/*.ts"
220
261
  },
262
+ "./extensibility/custom-commands/bundled/ci-green": {
263
+ "types": "./src/extensibility/custom-commands/bundled/ci-green/index.ts",
264
+ "import": "./src/extensibility/custom-commands/bundled/ci-green/index.ts"
265
+ },
221
266
  "./extensibility/custom-commands/bundled/review": {
222
267
  "types": "./src/extensibility/custom-commands/bundled/review/index.ts",
223
268
  "import": "./src/extensibility/custom-commands/bundled/review/index.ts"
@@ -254,6 +299,14 @@
254
299
  "types": "./src/extensibility/plugins/*.ts",
255
300
  "import": "./src/extensibility/plugins/*.ts"
256
301
  },
302
+ "./extensibility/plugins/marketplace": {
303
+ "types": "./src/extensibility/plugins/marketplace/index.ts",
304
+ "import": "./src/extensibility/plugins/marketplace/index.ts"
305
+ },
306
+ "./extensibility/plugins/marketplace/*": {
307
+ "types": "./src/extensibility/plugins/marketplace/*.ts",
308
+ "import": "./src/extensibility/plugins/marketplace/*.ts"
309
+ },
257
310
  "./internal-urls": {
258
311
  "types": "./src/internal-urls/index.ts",
259
312
  "import": "./src/internal-urls/index.ts"
@@ -314,6 +367,14 @@
314
367
  "types": "./src/modes/*.ts",
315
368
  "import": "./src/modes/*.ts"
316
369
  },
370
+ "./modes/acp": {
371
+ "types": "./src/modes/acp/index.ts",
372
+ "import": "./src/modes/acp/index.ts"
373
+ },
374
+ "./modes/acp/*": {
375
+ "types": "./src/modes/acp/*.ts",
376
+ "import": "./src/modes/acp/*.ts"
377
+ },
317
378
  "./modes/components": {
318
379
  "types": "./src/modes/components/index.ts",
319
380
  "import": "./src/modes/components/index.ts"
@@ -358,14 +419,6 @@
358
419
  "types": "./src/modes/utils/*.ts",
359
420
  "import": "./src/modes/utils/*.ts"
360
421
  },
361
- "./patch": {
362
- "types": "./src/patch/index.ts",
363
- "import": "./src/patch/index.ts"
364
- },
365
- "./patch/*": {
366
- "types": "./src/patch/*.ts",
367
- "import": "./src/patch/*.ts"
368
- },
369
422
  "./plan-mode/*": {
370
423
  "types": "./src/plan-mode/*.ts",
371
424
  "import": "./src/plan-mode/*.ts"
@@ -435,6 +488,10 @@
435
488
  "types": "./src/utils/*.ts",
436
489
  "import": "./src/utils/*.ts"
437
490
  },
491
+ "./web/*": {
492
+ "types": "./src/web/*.ts",
493
+ "import": "./src/web/*.ts"
494
+ },
438
495
  "./web/scrapers": {
439
496
  "types": "./src/web/scrapers/index.ts",
440
497
  "import": "./src/web/scrapers/index.ts"
@@ -454,6 +511,15 @@
454
511
  "./web/search/providers/*": {
455
512
  "types": "./src/web/search/providers/*.ts",
456
513
  "import": "./src/web/search/providers/*.ts"
457
- }
514
+ },
515
+ "./hooks": {
516
+ "types": "./src/extensibility/hooks/index.ts",
517
+ "import": "./src/extensibility/hooks/index.ts"
518
+ },
519
+ "./hooks/*": {
520
+ "types": "./src/extensibility/hooks/*.ts",
521
+ "import": "./src/extensibility/hooks/*.ts"
522
+ },
523
+ "./*.js": "./src/*.ts"
458
524
  }
459
525
  }
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bun
2
+ import { prompt } from "@oh-my-pi/pi-utils";
2
3
  /**
3
4
  * Format prompt files (mixed XML + Markdown + Handlebars).
4
5
  *
@@ -14,7 +15,6 @@
14
15
  * 9. Bold RFC 2119 keywords (MUST, SHOULD, MAY, etc.) in prompt content
15
16
  */
16
17
  import { Glob } from "bun";
17
- import { formatPromptContent } from "../src/utils/prompt-format";
18
18
 
19
19
  const PROMPTS_DIR = new URL("../src/prompts/", import.meta.url).pathname;
20
20
  const COMMIT_PROMPTS_DIR = new URL("../src/commit/prompts/", import.meta.url).pathname;
@@ -42,7 +42,7 @@ async function main() {
42
42
 
43
43
  for (const fullPath of files) {
44
44
  const original = await Bun.file(fullPath).text();
45
- const formatted = formatPromptContent(original, PROMPT_FORMAT_OPTIONS);
45
+ const formatted = prompt.format(original, PROMPT_FORMAT_OPTIONS);
46
46
 
47
47
  if (original !== `${formatted}\n`) {
48
48
  if (check) {
@@ -0,0 +1,24 @@
1
+ import { inferMetricUnitFromName } from "./helpers";
2
+ import type { AutoresearchContract, ExperimentState } from "./types";
3
+
4
+ /**
5
+ * Updates session fields from a validated `autoresearch.md` parse (same fields as `init_experiment`).
6
+ * Does not touch `name`, `currentSegment`, `results`, `bestMetric`, `confidence`, or `maxExperiments`.
7
+ */
8
+ export function applyAutoresearchContractToExperimentState(
9
+ contract: AutoresearchContract,
10
+ state: ExperimentState,
11
+ ): void {
12
+ const benchmarkContract = contract.benchmark;
13
+ state.metricName = benchmarkContract.primaryMetric ?? state.metricName;
14
+ state.metricUnit = benchmarkContract.metricUnit;
15
+ state.bestDirection = benchmarkContract.direction ?? "lower";
16
+ state.secondaryMetrics = benchmarkContract.secondaryMetrics.map(name => ({
17
+ name,
18
+ unit: inferMetricUnitFromName(name),
19
+ }));
20
+ state.benchmarkCommand = benchmarkContract.command?.trim() ?? state.benchmarkCommand;
21
+ state.scopePaths = [...contract.scopePaths];
22
+ state.offLimits = [...contract.offLimits];
23
+ state.constraints = [...contract.constraints];
24
+ }
@@ -1,4 +1,3 @@
1
- import * as crypto from "node:crypto";
2
1
  import * as fs from "node:fs";
3
2
  import * as path from "node:path";
4
3
  import type { AutoresearchBenchmarkContract, AutoresearchContract, MetricDirection } from "./types";
@@ -76,49 +75,6 @@ export function validateAutoresearchContract(contract: AutoresearchContract): st
76
75
  return errors;
77
76
  }
78
77
 
79
- export function buildAutoresearchSegmentFingerprint(
80
- contract: AutoresearchContract,
81
- scripts: {
82
- benchmarkScript: string;
83
- checksScript: string | null;
84
- },
85
- ): string {
86
- const payload = {
87
- benchmark: contract.benchmark,
88
- scopePaths: contract.scopePaths,
89
- offLimits: contract.offLimits,
90
- constraints: contract.constraints,
91
- scripts,
92
- };
93
- return crypto.createHash("sha256").update(JSON.stringify(payload)).digest("hex");
94
- }
95
-
96
- export function getAutoresearchFingerprintMismatchError(
97
- stateFingerprint: string | null,
98
- workDir: string,
99
- ): string | null {
100
- if (!stateFingerprint) {
101
- return "The current segment has no fingerprint metadata. Re-run init_experiment before continuing.";
102
- }
103
-
104
- const contractResult = readAutoresearchContract(workDir);
105
- const scriptSnapshot = loadAutoresearchScriptSnapshot(workDir);
106
- const errors = [...contractResult.errors, ...scriptSnapshot.errors];
107
- if (errors.length > 0) {
108
- return `${errors.join(" ")} Re-run init_experiment after fixing the workspace contract.`;
109
- }
110
-
111
- const currentFingerprint = buildAutoresearchSegmentFingerprint(contractResult.contract, {
112
- benchmarkScript: scriptSnapshot.benchmarkScript,
113
- checksScript: scriptSnapshot.checksScript,
114
- });
115
- if (currentFingerprint === stateFingerprint) {
116
- return null;
117
- }
118
-
119
- return "autoresearch.md, autoresearch.sh, or autoresearch.checks.sh changed since the current segment was initialized. Re-run init_experiment before continuing.";
120
- }
121
-
122
78
  export function loadAutoresearchScriptSnapshot(workDir: string): AutoresearchScriptSnapshot {
123
79
  const benchmarkScriptPath = path.join(workDir, "autoresearch.sh");
124
80
  const checksScriptPath = path.join(workDir, "autoresearch.checks.sh");