@earendil-works/pi-coding-agent 0.87.0 → 0.87.1

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 (75) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +25 -711
  3. package/dist/bundle/chunks/{anthropic-messages-MYU5ZMRF.js → anthropic-messages-J5WXPPPC.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-GV2E3GBU.js → chunk-65HAU2C5.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-4DKZACXI.js → chunk-OJP47DM6.js} +13 -13
  6. package/dist/bundle/chunks/github-copilot.js +1 -1
  7. package/dist/bundle/chunks/{openai-completions-XHML6MTL.js → openai-completions-OBX42CLD.js} +1 -1
  8. package/dist/bundle/chunks/{virtual-modules-BNWPZYDH.js → virtual-modules-VHMJYYWQ.js} +1 -1
  9. package/dist/bundle/cli-runtime.js +1 -1
  10. package/dist/bundle/index.js +1 -1
  11. package/dist/bundle/rpc-entry.js +1 -1
  12. package/dist/cli/args.d.ts.map +1 -1
  13. package/dist/cli/args.js +14 -4
  14. package/dist/cli/args.js.map +1 -1
  15. package/dist/core/compaction/compaction.d.ts.map +1 -1
  16. package/dist/core/compaction/compaction.js +9 -9
  17. package/dist/core/compaction/compaction.js.map +1 -1
  18. package/dist/core/model-resolver.d.ts.map +1 -1
  19. package/dist/core/model-resolver.js +1 -1
  20. package/dist/core/model-resolver.js.map +1 -1
  21. package/docs/cli-integration.md +106 -0
  22. package/docs/cli.md +268 -0
  23. package/docs/compaction.md +22 -22
  24. package/docs/configuration.md +45 -0
  25. package/docs/containerization.md +109 -82
  26. package/docs/custom-provider.md +132 -784
  27. package/docs/docs.json +139 -99
  28. package/docs/environment-variables.md +3 -5
  29. package/docs/extensions.md +134 -3020
  30. package/docs/how-pi-works.md +49 -0
  31. package/docs/images/interactive-mode.png +0 -0
  32. package/docs/index.md +24 -69
  33. package/docs/json.md +193 -65
  34. package/docs/keybindings.md +57 -102
  35. package/docs/llama-cpp.md +3 -3
  36. package/docs/message-types.md +261 -0
  37. package/docs/models.md +55 -565
  38. package/docs/packages.md +66 -167
  39. package/docs/prompt-templates.md +31 -68
  40. package/docs/providers.md +102 -240
  41. package/docs/quickstart.md +61 -106
  42. package/docs/rpc-commands.md +854 -0
  43. package/docs/rpc-extension-ui.md +200 -0
  44. package/docs/rpc.md +129 -1556
  45. package/docs/sdk.md +76 -1171
  46. package/docs/security.md +70 -32
  47. package/docs/session-format.md +10 -214
  48. package/docs/sessions.md +35 -141
  49. package/docs/settings.md +109 -387
  50. package/docs/shell-aliases.md +85 -5
  51. package/docs/skills.md +51 -190
  52. package/docs/slash-commands.md +60 -0
  53. package/docs/terminal-setup.md +105 -78
  54. package/docs/termux.md +74 -83
  55. package/docs/themes.md +68 -280
  56. package/docs/tmux.md +31 -39
  57. package/docs/tui.md +69 -923
  58. package/docs/usage.md +54 -272
  59. package/docs/windows.md +43 -17
  60. package/examples/README.md +13 -2
  61. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  62. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  63. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  64. package/examples/extensions/gondolin/package-lock.json +2 -2
  65. package/examples/extensions/gondolin/package.json +1 -1
  66. package/examples/extensions/sandbox/package-lock.json +2 -2
  67. package/examples/extensions/sandbox/package.json +1 -1
  68. package/examples/extensions/with-deps/package-lock.json +2 -2
  69. package/examples/extensions/with-deps/package.json +1 -1
  70. package/examples/rpc-client.ts +35 -0
  71. package/examples/rpc-extension-ui.ts +25 -5
  72. package/examples/sdk/README.md +1 -1
  73. package/npm-shrinkwrap.json +20 -20
  74. package/package.json +8 -8
  75. package/docs/development.md +0 -90
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { spawn } from "node:child_process";
18
18
  import { dirname, join } from "node:path";
19
- import * as readline from "node:readline";
19
+ import { StringDecoder } from "node:string_decoder";
20
20
  import { fileURLToPath } from "node:url";
21
21
  import {
22
22
  type Component,
@@ -258,7 +258,7 @@ async function main() {
258
258
 
259
259
  const agent = spawn(
260
260
  "node",
261
- [cliPath, "--mode", "rpc", "--no-session", "--no-extension", "--extension", extensionPath],
261
+ [cliPath, "--mode", "rpc", "--no-session", "--no-extensions", "--extension", extensionPath],
262
262
  { stdio: ["pipe", "pipe", "pipe"] },
263
263
  );
264
264
 
@@ -518,9 +518,7 @@ async function main() {
518
518
 
519
519
  // -- Process agent stdout --
520
520
 
521
- const stdoutRl = readline.createInterface({ input: agent.stdout!, terminal: false });
522
-
523
- stdoutRl.on("line", (line) => {
521
+ function handleAgentLine(line: string): void {
524
522
  let data: Record<string, unknown>;
525
523
  try {
526
524
  data = JSON.parse(line);
@@ -583,6 +581,28 @@ async function main() {
583
581
  tui.requestRender();
584
582
  return;
585
583
  }
584
+ }
585
+
586
+ const stdoutDecoder = new StringDecoder("utf8");
587
+ let stdoutBuffer = "";
588
+
589
+ agent.stdout!.on("data", (chunk: Buffer) => {
590
+ stdoutBuffer += stdoutDecoder.write(chunk);
591
+ while (true) {
592
+ const newlineIndex = stdoutBuffer.indexOf("\n");
593
+ if (newlineIndex === -1) break;
594
+
595
+ const line = stdoutBuffer.slice(0, newlineIndex);
596
+ stdoutBuffer = stdoutBuffer.slice(newlineIndex + 1);
597
+ handleAgentLine(line.endsWith("\r") ? line.slice(0, -1) : line);
598
+ }
599
+ });
600
+
601
+ agent.stdout!.on("end", () => {
602
+ stdoutBuffer += stdoutDecoder.end();
603
+ if (stdoutBuffer.length > 0) {
604
+ handleAgentLine(stdoutBuffer.endsWith("\r") ? stdoutBuffer.slice(0, -1) : stdoutBuffer);
605
+ }
586
606
  });
587
607
 
588
608
  // -- User input --
@@ -15,7 +15,7 @@ The runtime example shows how to build a recreate function that closes over proc
15
15
  | `05-tools.ts` | Built-in tool allowlists |
16
16
  | `06-extensions.ts` | Logging, blocking, result modification |
17
17
  | `07-context-files.ts` | AGENTS.md context files |
18
- | `08-slash-commands.ts` | File-based slash commands |
18
+ | `08-prompt-templates.ts` | File-based prompt templates |
19
19
  | `09-api-keys-and-oauth.ts` | API key resolution, OAuth config |
20
20
  | `10-settings.ts` | Override compaction, retry, terminal settings |
21
21
  | `11-sessions.ts` | In-memory, persistent, continue, list sessions |
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-coding-agent",
3
- "version": "0.87.0",
3
+ "version": "0.87.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@earendil-works/pi-coding-agent",
9
- "version": "0.87.0",
9
+ "version": "0.87.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@earendil-works/chord": "^0.87.0",
13
- "@earendil-works/pi-agent-core": "^0.87.0",
14
- "@earendil-works/pi-ai": "^0.87.0",
15
- "@earendil-works/pi-tui": "^0.87.0",
12
+ "@earendil-works/chord": "^0.87.1",
13
+ "@earendil-works/pi-agent-core": "^0.87.1",
14
+ "@earendil-works/pi-ai": "^0.87.1",
15
+ "@earendil-works/pi-tui": "^0.87.1",
16
16
  "@silvia-odwyer/photon-node": "0.3.4",
17
17
  "chalk": "6.0.0",
18
18
  "cross-spawn": "7.0.6",
@@ -408,8 +408,8 @@
408
408
  }
409
409
  },
410
410
  "node_modules/@earendil-works/chord": {
411
- "version": "0.87.0",
412
- "resolved": "https://registry.npmjs.org/@earendil-works/chord/-/chord-0.87.0.tgz",
411
+ "version": "0.87.1",
412
+ "resolved": "https://registry.npmjs.org/@earendil-works/chord/-/chord-0.87.1.tgz",
413
413
  "license": "MIT",
414
414
  "dependencies": {
415
415
  "esbuild": "0.28.2"
@@ -419,13 +419,13 @@
419
419
  }
420
420
  },
421
421
  "node_modules/@earendil-works/pi-agent-core": {
422
- "version": "0.87.0",
423
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-0.87.0.tgz",
422
+ "version": "0.87.1",
423
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-agent-core/-/pi-agent-core-0.87.1.tgz",
424
424
  "license": "MIT",
425
425
  "dependencies": {
426
- "@earendil-works/chord": "^0.87.0",
427
- "@earendil-works/pi-ai": "^0.87.0",
428
- "@earendil-works/pi-telemetry": "^0.87.0",
426
+ "@earendil-works/chord": "^0.87.1",
427
+ "@earendil-works/pi-ai": "^0.87.1",
428
+ "@earendil-works/pi-telemetry": "^0.87.1",
429
429
  "diff": "8.0.4",
430
430
  "ignore": "7.0.8",
431
431
  "typebox": "1.3.27",
@@ -436,13 +436,13 @@
436
436
  }
437
437
  },
438
438
  "node_modules/@earendil-works/pi-ai": {
439
- "version": "0.87.0",
440
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.87.0.tgz",
439
+ "version": "0.87.1",
440
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.87.1.tgz",
441
441
  "license": "MIT",
442
442
  "dependencies": {
443
443
  "@anthropic-ai/sdk": "0.124.0",
444
444
  "@aws-sdk/client-bedrock-runtime": "3.1127.0",
445
- "@earendil-works/pi-telemetry": "^0.87.0",
445
+ "@earendil-works/pi-telemetry": "^0.87.1",
446
446
  "@google/genai": "2.21.0",
447
447
  "@smithy/node-http-handler": "4.12.1",
448
448
  "http-proxy-agent": "9.1.0",
@@ -482,16 +482,16 @@
482
482
  }
483
483
  },
484
484
  "node_modules/@earendil-works/pi-telemetry": {
485
- "version": "0.87.0",
486
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-telemetry/-/pi-telemetry-0.87.0.tgz",
485
+ "version": "0.87.1",
486
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-telemetry/-/pi-telemetry-0.87.1.tgz",
487
487
  "license": "MIT",
488
488
  "engines": {
489
489
  "node": ">=22.19.0"
490
490
  }
491
491
  },
492
492
  "node_modules/@earendil-works/pi-tui": {
493
- "version": "0.87.0",
494
- "resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-0.87.0.tgz",
493
+ "version": "0.87.1",
494
+ "resolved": "https://registry.npmjs.org/@earendil-works/pi-tui/-/pi-tui-0.87.1.tgz",
495
495
  "license": "MIT",
496
496
  "dependencies": {
497
497
  "get-east-asian-width": "1.6.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-coding-agent",
3
- "version": "0.87.0",
3
+ "version": "0.87.1",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -49,10 +49,10 @@
49
49
  "prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
50
50
  },
51
51
  "dependencies": {
52
- "@earendil-works/chord": "^0.87.0",
53
- "@earendil-works/pi-agent-core": "^0.87.0",
54
- "@earendil-works/pi-ai": "^0.87.0",
55
- "@earendil-works/pi-tui": "^0.87.0",
52
+ "@earendil-works/chord": "^0.87.1",
53
+ "@earendil-works/pi-agent-core": "^0.87.1",
54
+ "@earendil-works/pi-ai": "^0.87.1",
55
+ "@earendil-works/pi-tui": "^0.87.1",
56
56
  "@silvia-odwyer/photon-node": "0.3.4",
57
57
  "chalk": "6.0.0",
58
58
  "cross-spawn": "7.0.6",
@@ -73,9 +73,9 @@
73
73
  "protobufjs": "7.6.6"
74
74
  },
75
75
  "devDependencies": {
76
- "@earendil-works/pi-client": "^0.87.0",
77
- "@earendil-works/pi-protocol": "^0.87.0",
78
- "@earendil-works/pi-server": "^0.87.0",
76
+ "@earendil-works/pi-client": "^0.87.1",
77
+ "@earendil-works/pi-protocol": "^0.87.1",
78
+ "@earendil-works/pi-server": "^0.87.1",
79
79
  "@types/cross-spawn": "6.0.6",
80
80
  "@types/hosted-git-info": "3.0.5",
81
81
  "@types/node": "22.19.19",
@@ -1,90 +0,0 @@
1
- # Development
2
-
3
- See [AGENTS.md](https://github.com/earendil-works/pi/blob/main/AGENTS.md) for additional guidelines.
4
-
5
- ## Setup
6
-
7
- ```bash
8
- git clone https://github.com/earendil-works/pi
9
- cd pi
10
- npm install
11
- npm run build
12
- ```
13
-
14
- Run from source:
15
-
16
- ```bash
17
- /path/to/pi/pi-test.sh
18
- ```
19
-
20
- The script can be run from any directory. Pi keeps the caller's current working directory.
21
-
22
- ### Experimental remote harness
23
-
24
- The remote harness server/client integration is development-only. Run it from the repository with:
25
-
26
- ```bash
27
- PI_EXPERIMENTAL=1 ./pi-test.sh server
28
- PI_EXPERIMENTAL=1 ./pi-test.sh client
29
- ```
30
-
31
- `PI_SERVER_DIR` overrides the server profile and socket directory (default: `~/.pi/server`). `PI_SERVER_ID` selects the logical server ID when `--server-id` is omitted.
32
-
33
- The `client` and `experimental/plugin` package subpaths resolve only under the `source` condition in a checkout. Their implementations and the server/client commands are excluded from npm packages and standalone binaries. `pi-client`, `pi-protocol`, and `pi-server` are development dependencies of coding-agent, not runtime dependencies. The local SDK and stdio RPC API are unchanged.
34
-
35
- ## Forking / Rebranding
36
-
37
- Configure via `package.json`:
38
-
39
- ```json
40
- {
41
- "piConfig": {
42
- "name": "pi",
43
- "configDir": ".pi"
44
- }
45
- }
46
- ```
47
-
48
- Change `name`, `configDir`, and `bin` field for your fork. Affects CLI banner, config paths, and environment variable names.
49
-
50
- ## Path Resolution
51
-
52
- Three execution modes: npm install, standalone binary, tsx from source.
53
-
54
- **Always use `src/config.ts`** for package assets:
55
-
56
- ```typescript
57
- import { getPackageDir, getThemeDir } from "./config.js";
58
- ```
59
-
60
- Never use `__dirname` directly for package assets.
61
-
62
- ## Debug Command
63
-
64
- `/debug` (hidden) writes to `~/.pi/agent/pi-debug.log`:
65
- - Rendered TUI lines with ANSI codes
66
- - Last messages sent to the LLM
67
-
68
- ## Testing
69
-
70
- ```bash
71
- ./test.sh # Run non-LLM tests (no API keys needed)
72
- npm test # Run all tests
73
- npm test -- test/specific.test.ts # Run specific test
74
- ```
75
-
76
- ### Published package smoke test
77
-
78
- After building, run `npm run check:package-install`. It packs the public packages and installs only coding-agent as a direct dependency in a temporary directory outside the repository. Local tarball overrides select declared transitive dependencies without installing development-only packages. The check verifies SDK imports and CLI startup without credentials or model requests.
79
-
80
- `npm run check` also checks runtime dependency declarations and rejects excluded development sources pulled into a package's build through imports.
81
-
82
- ## Project Structure
83
-
84
- ```
85
- packages/
86
- ai/ # LLM provider abstraction
87
- agent/ # Agent loop and message types
88
- tui/ # Terminal UI components
89
- coding-agent/ # CLI and interactive mode
90
- ```