@astralyn/pi 1.4.1 → 1.4.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 (49) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/bundle/chunks/{chunk-KSKBY3VV.js → chunk-FGPSYHTQ.js} +12 -6
  3. package/dist/bundle/chunks/{chunk-N77PYEXG.js → chunk-HXKY52DF.js} +1 -1
  4. package/dist/bundle/chunks/{virtual-modules-XNEYDLXF.js → virtual-modules-5NSVVTKO.js} +1 -1
  5. package/dist/bundle/cli.js +1 -1
  6. package/dist/bundle/index.js +1 -1
  7. package/dist/bundle/rpc-entry.js +1 -1
  8. package/dist/core/extensions/index.d.ts +1 -1
  9. package/dist/core/extensions/index.d.ts.map +1 -1
  10. package/dist/core/extensions/index.js.map +1 -1
  11. package/dist/core/extensions/types.d.ts +25 -1
  12. package/dist/core/extensions/types.d.ts.map +1 -1
  13. package/dist/core/extensions/types.js.map +1 -1
  14. package/dist/extensions/index.d.ts.map +1 -1
  15. package/dist/extensions/index.js +2 -0
  16. package/dist/extensions/index.js.map +1 -1
  17. package/dist/extensions/tool-presentation/index.d.ts +7 -0
  18. package/dist/extensions/tool-presentation/index.d.ts.map +1 -0
  19. package/dist/extensions/tool-presentation/index.js +9 -0
  20. package/dist/extensions/tool-presentation/index.js.map +1 -0
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/modes/interactive/components/index.d.ts +1 -1
  25. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  26. package/dist/modes/interactive/components/index.js +1 -1
  27. package/dist/modes/interactive/components/index.js.map +1 -1
  28. package/dist/modes/interactive/components/tool-execution.d.ts +85 -0
  29. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  30. package/dist/modes/interactive/components/tool-execution.js +362 -0
  31. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  32. package/dist/modes/interactive/interactive-mode.js +1 -1
  33. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  34. package/dist/modes/interactive/tool-view/chat.d.ts +1 -1
  35. package/dist/modes/interactive/tool-view/chat.d.ts.map +1 -1
  36. package/dist/modes/interactive/tool-view/chat.js +2 -3
  37. package/dist/modes/interactive/tool-view/chat.js.map +1 -1
  38. package/dist/modes/interactive/tool-view/shell.d.ts +15 -0
  39. package/dist/modes/interactive/tool-view/shell.d.ts.map +1 -0
  40. package/dist/modes/interactive/tool-view/shell.js +51 -0
  41. package/dist/modes/interactive/tool-view/shell.js.map +1 -0
  42. package/dist/modes/interactive/tool-view/tool-execution.d.ts +10 -79
  43. package/dist/modes/interactive/tool-view/tool-execution.d.ts.map +1 -1
  44. package/dist/modes/interactive/tool-view/tool-execution.js +7 -298
  45. package/dist/modes/interactive/tool-view/tool-execution.js.map +1 -1
  46. package/docs/bundled/tool-presentation.md +9 -7
  47. package/docs/extensions.md +3 -1
  48. package/npm-shrinkwrap.json +2 -2
  49. package/package.json +1 -1
@@ -39,23 +39,25 @@ The `Ctrl+B` background hint is not part of a tool row. Once a foreground manage
39
39
 
40
40
  The look is defined in one place, `src/modes/interactive/tool-view/style.ts`: the marker and rail glyphs, their colors, the spacing between blocks, and which tools fold their result. `FramedComponent` in the same file hangs a component's lines off the marker or the rail and derives the gutter width from the glyphs.
41
41
 
42
- `tool-view/tool-execution.ts` owns one call's lifecycle: pending, success and error states, expansion, image placement and Kitty conversion, and renderer disposal. `tool-view/chat.ts` owns the chat container that measures tool blocks for spacing and disposes rows when the chat clears. Extension tools and built-in tools use the same shell, so a third-party tool gets the same dot and rail without any change.
42
+ The upstream `components/tool-execution.ts` owns one call's lifecycle: pending, success and error states, expansion, image placement and Kitty conversion, and renderer disposal. The bundled `tool-presentation` extension attaches a TUI-only shell through the existing tool renderer resolver; `tool-view/shell.ts` maps the visual policy to that shell. The old `tool-view/tool-execution.ts` path is only a compatibility adapter for direct source imports, not a second lifecycle implementation.
43
43
 
44
- Built-in renderers remain responsible for semantic content such as file paths, syntax highlighting, search results, Diff previews, and command output. They return plain components; the shell frames them.
44
+ `tool-view/chat.ts` owns the chat container that measures tool blocks for spacing and disposes rows when the chat clears. It reads each row's gap policy: upstream rows keep one blank line, while the distribution shell uses the compact policy above. Extension tools and built-in tools use the same shell unless they explicitly own a self shell.
45
+
46
+ Built-in renderers remain responsible for semantic content such as file paths, syntax highlighting, search results, Diff previews, and command output. They return plain components; the native component passes them to the shell without wrapping their renderer functions. HTML export uses only those renderers and ignores the TUI shell, so it retains its existing output. Disable `builtin:tool-presentation` (for example with `-builtin:tool-presentation` in extension settings) to use the upstream Box presentation instead.
45
47
 
46
48
  ## Renderer inheritance
47
49
 
48
50
  | Tool definition | Behavior |
49
51
  |---|---|
50
- | No `renderCall`/`renderResult` | Uses the native call and result fallback. |
51
- | Custom renderer with the default shell | Uses the native shell around the custom content. |
52
- | `renderShell: "self"` | Keeps complete ownership of the tool's layout. |
52
+ | No `renderCall`/`renderResult` | Uses the active shell's call and result fallback. |
53
+ | Custom renderer with the default shell | Uses the distribution shell around the custom content, or upstream Box when the extension is disabled. |
54
+ | `renderShell: "self"` | Keeps complete ownership of the tool's layout; no distribution shell is attached. |
53
55
 
54
56
  Built-in tool definitions are also used when an extension overrides only one renderer slot. A custom call renderer can inherit the built-in result renderer, and vice versa. An extension that overrides a built-in tool with its own result renderer controls what that row shows, including when it is collapsed.
55
57
 
56
58
  The inherited Bash result renderer keeps its elapsed time even with a custom call renderer. Call and result renderers share `state`; a renderer that adds a `dispose()` callback must also call the previous callback so both renderers can release their resources.
57
59
 
58
- Renderer failures fall back to native generic output rather than breaking the transcript.
60
+ Renderer failures fall back to the active shell's generic output rather than breaking the transcript; without a distribution shell, the upstream generic fallback is used.
59
61
 
60
62
  ## Generic fallback
61
63
 
@@ -89,7 +91,7 @@ The package does not use:
89
91
 
90
92
  - prototype patching of `ToolExecutionComponent` from an extension;
91
93
  - same-name re-registration to replace built-in tools;
92
- - a global renderer registry exposed through Extension API;
94
+ - a second global renderer registry exposed through Extension API;
93
95
  - a restored `tools-view` extension;
94
96
  - forced decoration of third-party tools that explicitly own their shell;
95
97
  - merging consecutive calls into a collapsed group, or a shell-level progress row.
@@ -2531,7 +2531,7 @@ export default function (pi: ExtensionAPI) {
2531
2531
 
2532
2532
  Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API.
2533
2533
 
2534
- By default, tool output is wrapped in Pi's native call/result shell, which owns the status dot, result rail, spacing between consecutive tool rows, and fallback rendering. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, the shell uses fallback rendering for that slot. Return content without leading padding: the shell trims leading blank result lines and adds no blank line between consecutive tool rows.
2534
+ By default, tool output is wrapped in the active call/result shell, which owns the status dot, result rail, spacing between consecutive tool rows, and fallback rendering. The bundled `tool-presentation` extension supplies the distribution's compact shell; disabling `builtin:tool-presentation` restores the upstream Box shell. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, the shell uses fallback rendering for that slot. Return content without leading padding: the compact shell trims leading blank result lines and adds no blank line between consecutive single-line tool rows.
2535
2535
 
2536
2536
  Set `renderShell: "self"` when the tool should render its own shell instead of using the native shell. This is useful for tools that need complete control over framing or background behavior, for example large previews that must stay visually stable after the tool settles.
2537
2537
 
@@ -3345,6 +3345,8 @@ A tool that reaches other tools declares which ones a call may reach with `reach
3345
3345
 
3346
3346
  `pi.registerToolRenderer((toolName, next) => renderers)` chooses `renderCall`, `renderResult`, and `renderShell` for calls to any tool, including tools that are not registered yet, such as MCP tools in a resumed session. Resolvers run in extension load order. `next()` returns the remaining resolvers' result or the registered tool's renderers, so `next() ?? mine` supplies a fallback. Interactive transcripts and HTML exports both use these resolvers.
3347
3347
 
3348
+ A resolver can also attach an optional `shell` (`ToolExecutionShell`) for TUI-only framing, fallbacks, and row spacing. The native tool component consumes it after the renderers return their components, so `lastComponent` reuse and renderer ownership are preserved. HTML export ignores `shell`; it never changes tool execution or the model-facing tool declaration. An explicit `renderShell: "self"` always remains tool-owned and is not wrapped by a distribution shell.
3349
+
3348
3350
  ### MCP servers
3349
3351
 
3350
3352
  `pi.registerMcpServer(name, config)` adds an MCP server for the current session. `config` has the shape of an `mcpServers` entry in [`mcp.json`](mcp.md): `command`, `args`, `env`, and `cwd` for stdio servers, `url`, `headers`, and `oauth` for HTTP servers, plus `exposure`, `toolExposure`, `description`, `enabled`, and `timeout`.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@astralyn/pi",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@astralyn/pi",
9
- "version": "1.4.1",
9
+ "version": "1.4.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@earendil-works/pi-agent-core": "1.4.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astralyn/pi",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {