@mariozechner/pi-coding-agent 0.58.4 → 0.60.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +14 -11
  3. package/dist/bun/cli.d.ts +3 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +6 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/register-bedrock.d.ts +2 -0
  8. package/dist/bun/register-bedrock.d.ts.map +1 -0
  9. package/dist/bun/register-bedrock.js +85 -0
  10. package/dist/bun/register-bedrock.js.map +1 -0
  11. package/dist/cli/args.d.ts +1 -0
  12. package/dist/cli/args.d.ts.map +1 -1
  13. package/dist/cli/args.js +4 -0
  14. package/dist/cli/args.js.map +1 -1
  15. package/dist/cli/initial-message.d.ts +18 -0
  16. package/dist/cli/initial-message.d.ts.map +1 -0
  17. package/dist/cli/initial-message.js +22 -0
  18. package/dist/cli/initial-message.js.map +1 -0
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +0 -3
  21. package/dist/cli.js.map +1 -1
  22. package/dist/core/agent-session.d.ts +1 -0
  23. package/dist/core/agent-session.d.ts.map +1 -1
  24. package/dist/core/agent-session.js +23 -3
  25. package/dist/core/agent-session.js.map +1 -1
  26. package/dist/core/bash-executor.d.ts +6 -7
  27. package/dist/core/bash-executor.d.ts.map +1 -1
  28. package/dist/core/bash-executor.js +8 -107
  29. package/dist/core/bash-executor.js.map +1 -1
  30. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  31. package/dist/core/compaction/branch-summarization.js +1 -0
  32. package/dist/core/compaction/branch-summarization.js.map +1 -1
  33. package/dist/core/compaction/compaction.d.ts.map +1 -1
  34. package/dist/core/compaction/compaction.js +2 -0
  35. package/dist/core/compaction/compaction.js.map +1 -1
  36. package/dist/core/extensions/runner.d.ts +5 -2
  37. package/dist/core/extensions/runner.d.ts.map +1 -1
  38. package/dist/core/extensions/runner.js +21 -4
  39. package/dist/core/extensions/runner.js.map +1 -1
  40. package/dist/core/extensions/types.d.ts +1 -1
  41. package/dist/core/extensions/types.d.ts.map +1 -1
  42. package/dist/core/extensions/types.js.map +1 -1
  43. package/dist/core/footer-data-provider.d.ts +6 -1
  44. package/dist/core/footer-data-provider.d.ts.map +1 -1
  45. package/dist/core/footer-data-provider.js +83 -37
  46. package/dist/core/footer-data-provider.js.map +1 -1
  47. package/dist/core/keybindings.d.ts +3 -0
  48. package/dist/core/keybindings.d.ts.map +1 -1
  49. package/dist/core/keybindings.js +21 -11
  50. package/dist/core/keybindings.js.map +1 -1
  51. package/dist/core/package-manager.d.ts +15 -1
  52. package/dist/core/package-manager.d.ts.map +1 -1
  53. package/dist/core/package-manager.js +194 -15
  54. package/dist/core/package-manager.js.map +1 -1
  55. package/dist/core/session-manager.d.ts.map +1 -1
  56. package/dist/core/session-manager.js +6 -7
  57. package/dist/core/session-manager.js.map +1 -1
  58. package/dist/core/slash-commands.d.ts.map +1 -1
  59. package/dist/core/slash-commands.js +1 -1
  60. package/dist/core/slash-commands.js.map +1 -1
  61. package/dist/core/system-prompt.d.ts.map +1 -1
  62. package/dist/core/system-prompt.js +3 -2
  63. package/dist/core/system-prompt.js.map +1 -1
  64. package/dist/core/tools/bash.d.ts +8 -0
  65. package/dist/core/tools/bash.d.ts.map +1 -1
  66. package/dist/core/tools/bash.js +75 -69
  67. package/dist/core/tools/bash.js.map +1 -1
  68. package/dist/core/tools/index.d.ts +1 -1
  69. package/dist/core/tools/index.d.ts.map +1 -1
  70. package/dist/core/tools/index.js +1 -1
  71. package/dist/core/tools/index.js.map +1 -1
  72. package/dist/index.d.ts +1 -1
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/index.js.map +1 -1
  76. package/dist/main.d.ts.map +1 -1
  77. package/dist/main.js +50 -19
  78. package/dist/main.js.map +1 -1
  79. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  80. package/dist/modes/interactive/components/tree-selector.js +12 -1
  81. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  82. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  83. package/dist/modes/interactive/components/user-message.js +2 -1
  84. package/dist/modes/interactive/components/user-message.js.map +1 -1
  85. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  86. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  87. package/dist/modes/interactive/interactive-mode.js +50 -6
  88. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  89. package/docs/extensions.md +17 -3
  90. package/docs/keybindings.md +2 -0
  91. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  92. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  93. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  94. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  95. package/examples/extensions/with-deps/package-lock.json +2 -2
  96. package/examples/extensions/with-deps/package.json +1 -1
  97. package/package.json +5 -5
@@ -641,6 +641,8 @@ pi.on("tool_result", async (event, ctx) => {
641
641
  Fired when user executes `!` or `!!` commands. **Can intercept.**
642
642
 
643
643
  ```typescript
644
+ import { createLocalBashOperations } from "@mariozechner/pi-coding-agent";
645
+
644
646
  pi.on("user_bash", (event, ctx) => {
645
647
  // event.command - the bash command
646
648
  // event.excludeFromContext - true if !! prefix
@@ -649,7 +651,17 @@ pi.on("user_bash", (event, ctx) => {
649
651
  // Option 1: Provide custom operations (e.g., SSH)
650
652
  return { operations: remoteBashOps };
651
653
 
652
- // Option 2: Full replacement - return result directly
654
+ // Option 2: Wrap pi's built-in local bash backend
655
+ const local = createLocalBashOperations();
656
+ return {
657
+ operations: {
658
+ exec(command, cwd, options) {
659
+ return local.exec(`source ~/.profile\n${command}`, cwd, options);
660
+ }
661
+ }
662
+ };
663
+
664
+ // Option 3: Full replacement - return result directly
653
665
  return { result: { output: "...", exitCode: 0, cancelled: false, truncated: false } };
654
666
  });
655
667
  ```
@@ -934,7 +946,7 @@ Register a custom tool callable by the LLM. See [Custom Tools](#custom-tools) fo
934
946
 
935
947
  Use `pi.setActiveTools()` to enable or disable tools (including dynamically added tools) at runtime.
936
948
 
937
- Use `promptSnippet` to customize that tool's one-line entry in `Available tools`, and `promptGuidelines` to append tool-specific bullets to the default `Guidelines` section when the tool is active.
949
+ Use `promptSnippet` to opt a custom tool into a one-line entry in `Available tools`, and `promptGuidelines` to append tool-specific bullets to the default `Guidelines` section when the tool is active.
938
950
 
939
951
  See [dynamic-tools.ts](../examples/extensions/dynamic-tools.ts) for a full example.
940
952
 
@@ -1336,7 +1348,7 @@ export default function (pi: ExtensionAPI) {
1336
1348
 
1337
1349
  Register tools the LLM can call via `pi.registerTool()`. Tools appear in the system prompt and can have custom rendering.
1338
1350
 
1339
- Use `promptSnippet` for a short one-line entry in the `Available tools` section in the default system prompt. If omitted, pi falls back to `description`.
1351
+ Use `promptSnippet` for a short one-line entry in the `Available tools` section in the default system prompt. If omitted, custom tools are left out of that section.
1340
1352
 
1341
1353
  Use `promptGuidelines` to add tool-specific bullets to the default system prompt `Guidelines` section. These bullets are included only while the tool is active (for example, after `pi.setActiveTools([...])`).
1342
1354
 
@@ -1465,6 +1477,8 @@ pi.registerTool({
1465
1477
 
1466
1478
  **Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
1467
1479
 
1480
+ For `user_bash`, extensions can reuse pi's local shell backend via `createLocalBashOperations()` instead of reimplementing local process spawning, shell resolution, and process-tree termination.
1481
+
1468
1482
  The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
1469
1483
 
1470
1484
  ```typescript
@@ -2,6 +2,8 @@
2
2
 
3
3
  All keyboard shortcuts can be customized via `~/.pi/agent/keybindings.json`. Each action can be bound to one or more keys.
4
4
 
5
+ After editing `keybindings.json`, run `/reload` in pi to apply the changes without restarting the session.
6
+
5
7
  ## Key Format
6
8
 
7
9
  `modifier+key` where modifiers are `ctrl`, `shift`, `alt` (combinable) and keys are:
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.9.4",
3
+ "version": "1.11.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.9.4",
9
+ "version": "1.11.0",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.9.4",
4
+ "version": "1.11.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.9.4",
4
+ "version": "1.11.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-qwen-cli",
3
3
  "private": true,
4
- "version": "1.8.4",
4
+ "version": "1.10.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "1.22.4",
3
+ "version": "1.24.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "1.22.4",
9
+ "version": "1.24.0",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "1.22.4",
4
+ "version": "1.24.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mariozechner/pi-coding-agent",
3
- "version": "0.58.4",
3
+ "version": "0.60.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -32,7 +32,7 @@
32
32
  "clean": "shx rm -rf dist",
33
33
  "dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
34
34
  "build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js && npm run copy-assets",
35
- "build:binary": "npm --prefix ../tui run build && npm --prefix ../ai run build && npm --prefix ../agent run build && npm run build && bun build --compile ./dist/cli.js --outfile dist/pi && npm run copy-binary-assets",
35
+ "build:binary": "npm --prefix ../tui run build && npm --prefix ../ai run build && npm --prefix ../agent run build && npm run build && bun build --compile ./dist/bun/cli.js --outfile dist/pi && npm run copy-binary-assets",
36
36
  "copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/",
37
37
  "copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
38
38
  "test": "vitest --run",
@@ -40,9 +40,9 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@mariozechner/jiti": "^2.6.2",
43
- "@mariozechner/pi-agent-core": "^0.58.4",
44
- "@mariozechner/pi-ai": "^0.58.4",
45
- "@mariozechner/pi-tui": "^0.58.4",
43
+ "@mariozechner/pi-agent-core": "^0.60.0",
44
+ "@mariozechner/pi-ai": "^0.60.0",
45
+ "@mariozechner/pi-tui": "^0.60.0",
46
46
  "@silvia-odwyer/photon-node": "^0.3.4",
47
47
  "chalk": "^5.5.0",
48
48
  "cli-highlight": "^2.1.11",