@astralyn/pi 0.81.1-1 → 0.82.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 (185) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +690 -677
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +1 -0
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/cli/config-selector.d.ts.map +1 -1
  7. package/dist/cli/config-selector.js +1 -1
  8. package/dist/cli/config-selector.js.map +1 -1
  9. package/dist/cli/startup-ui.d.ts.map +1 -1
  10. package/dist/cli/startup-ui.js +1 -1
  11. package/dist/cli/startup-ui.js.map +1 -1
  12. package/dist/cli.js +0 -0
  13. package/dist/core/agent-session.d.ts +11 -0
  14. package/dist/core/agent-session.d.ts.map +1 -1
  15. package/dist/core/agent-session.js +7 -8
  16. package/dist/core/agent-session.js.map +1 -1
  17. package/dist/core/compaction/compaction.d.ts.map +1 -1
  18. package/dist/core/compaction/compaction.js +11 -3
  19. package/dist/core/compaction/compaction.js.map +1 -1
  20. package/dist/core/extensions/runner.d.ts.map +1 -1
  21. package/dist/core/extensions/runner.js +4 -0
  22. package/dist/core/extensions/runner.js.map +1 -1
  23. package/dist/core/extensions/types.d.ts +9 -1
  24. package/dist/core/extensions/types.d.ts.map +1 -1
  25. package/dist/core/extensions/types.js.map +1 -1
  26. package/dist/core/model-config.d.ts +30 -0
  27. package/dist/core/model-config.d.ts.map +1 -1
  28. package/dist/core/model-config.js +6 -0
  29. package/dist/core/model-config.js.map +1 -1
  30. package/dist/core/model-registry.d.ts.map +1 -1
  31. package/dist/core/model-registry.js +2 -2
  32. package/dist/core/model-registry.js.map +1 -1
  33. package/dist/core/model-resolver.d.ts.map +1 -1
  34. package/dist/core/model-resolver.js +7 -0
  35. package/dist/core/model-resolver.js.map +1 -1
  36. package/dist/core/model-runtime.d.ts +0 -1
  37. package/dist/core/model-runtime.d.ts.map +1 -1
  38. package/dist/core/model-runtime.js +3 -5
  39. package/dist/core/model-runtime.js.map +1 -1
  40. package/dist/core/remote-catalog-provider.d.ts +1 -1
  41. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  42. package/dist/core/remote-catalog-provider.js +5 -10
  43. package/dist/core/remote-catalog-provider.js.map +1 -1
  44. package/dist/core/settings-manager.d.ts +1 -1
  45. package/dist/core/settings-manager.d.ts.map +1 -1
  46. package/dist/core/settings-manager.js.map +1 -1
  47. package/dist/core/system-prompt.d.ts.map +1 -1
  48. package/dist/core/system-prompt.js +1 -1
  49. package/dist/core/system-prompt.js.map +1 -1
  50. package/dist/core/tools/bash.d.ts +2 -1
  51. package/dist/core/tools/bash.d.ts.map +1 -1
  52. package/dist/core/tools/bash.js +114 -24
  53. package/dist/core/tools/bash.js.map +1 -1
  54. package/dist/core/tools/find.d.ts.map +1 -1
  55. package/dist/core/tools/find.js +1 -0
  56. package/dist/core/tools/find.js.map +1 -1
  57. package/dist/core/tools/read.d.ts.map +1 -1
  58. package/dist/core/tools/read.js +4 -3
  59. package/dist/core/tools/read.js.map +1 -1
  60. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  61. package/dist/core/tools/tool-definition-wrapper.js +5 -1
  62. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  63. package/dist/extensions/index.d.ts.map +1 -1
  64. package/dist/extensions/index.js +2 -0
  65. package/dist/extensions/index.js.map +1 -1
  66. package/dist/extensions/llama/provider.d.ts.map +1 -1
  67. package/dist/extensions/llama/provider.js +1 -2
  68. package/dist/extensions/llama/provider.js.map +1 -1
  69. package/dist/extensions/subagent/activity.d.ts +16 -0
  70. package/dist/extensions/subagent/activity.d.ts.map +1 -0
  71. package/dist/extensions/subagent/activity.js +150 -0
  72. package/dist/extensions/subagent/activity.js.map +1 -0
  73. package/dist/extensions/subagent/agents.d.ts +7 -0
  74. package/dist/extensions/subagent/agents.d.ts.map +1 -0
  75. package/dist/extensions/subagent/agents.js +218 -0
  76. package/dist/extensions/subagent/agents.js.map +1 -0
  77. package/dist/extensions/subagent/constants.d.ts +22 -0
  78. package/dist/extensions/subagent/constants.d.ts.map +1 -0
  79. package/dist/extensions/subagent/constants.js +32 -0
  80. package/dist/extensions/subagent/constants.js.map +1 -0
  81. package/dist/extensions/subagent/index.d.ts +3 -0
  82. package/dist/extensions/subagent/index.d.ts.map +1 -0
  83. package/dist/extensions/subagent/index.js +249 -0
  84. package/dist/extensions/subagent/index.js.map +1 -0
  85. package/dist/extensions/subagent/picker.d.ts +31 -0
  86. package/dist/extensions/subagent/picker.d.ts.map +1 -0
  87. package/dist/extensions/subagent/picker.js +116 -0
  88. package/dist/extensions/subagent/picker.js.map +1 -0
  89. package/dist/extensions/subagent/render.d.ts +8 -0
  90. package/dist/extensions/subagent/render.d.ts.map +1 -0
  91. package/dist/extensions/subagent/render.js +322 -0
  92. package/dist/extensions/subagent/render.js.map +1 -0
  93. package/dist/extensions/subagent/resolve.d.ts +16 -0
  94. package/dist/extensions/subagent/resolve.d.ts.map +1 -0
  95. package/dist/extensions/subagent/resolve.js +103 -0
  96. package/dist/extensions/subagent/resolve.js.map +1 -0
  97. package/dist/extensions/subagent/runner.d.ts +30 -0
  98. package/dist/extensions/subagent/runner.d.ts.map +1 -0
  99. package/dist/extensions/subagent/runner.js +355 -0
  100. package/dist/extensions/subagent/runner.js.map +1 -0
  101. package/dist/extensions/subagent/schema.d.ts +28 -0
  102. package/dist/extensions/subagent/schema.d.ts.map +1 -0
  103. package/dist/extensions/subagent/schema.js +33 -0
  104. package/dist/extensions/subagent/schema.js.map +1 -0
  105. package/dist/extensions/subagent/sdk-runner.d.ts +14 -0
  106. package/dist/extensions/subagent/sdk-runner.d.ts.map +1 -0
  107. package/dist/extensions/subagent/sdk-runner.js +210 -0
  108. package/dist/extensions/subagent/sdk-runner.js.map +1 -0
  109. package/dist/extensions/subagent/settings.d.ts +9 -0
  110. package/dist/extensions/subagent/settings.d.ts.map +1 -0
  111. package/dist/extensions/subagent/settings.js +131 -0
  112. package/dist/extensions/subagent/settings.js.map +1 -0
  113. package/dist/extensions/subagent/types.d.ts +99 -0
  114. package/dist/extensions/subagent/types.d.ts.map +1 -0
  115. package/dist/extensions/subagent/types.js +2 -0
  116. package/dist/extensions/subagent/types.js.map +1 -0
  117. package/dist/modes/interactive/components/extension-editor.d.ts +1 -2
  118. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  119. package/dist/modes/interactive/components/extension-editor.js +16 -46
  120. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  121. package/dist/modes/interactive/components/index.d.ts +1 -0
  122. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  123. package/dist/modes/interactive/components/index.js +1 -0
  124. package/dist/modes/interactive/components/index.js.map +1 -1
  125. package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
  126. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  127. package/dist/modes/interactive/components/tool-execution.js +25 -4
  128. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  129. package/dist/modes/interactive/components/tool-group.d.ts +16 -0
  130. package/dist/modes/interactive/components/tool-group.d.ts.map +1 -0
  131. package/dist/modes/interactive/components/tool-group.js +64 -0
  132. package/dist/modes/interactive/components/tool-group.js.map +1 -0
  133. package/dist/modes/interactive/external-editor.d.ts +12 -0
  134. package/dist/modes/interactive/external-editor.d.ts.map +1 -0
  135. package/dist/modes/interactive/external-editor.js +37 -0
  136. package/dist/modes/interactive/external-editor.js.map +1 -0
  137. package/dist/modes/interactive/interactive-mode.d.ts +3 -1
  138. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  139. package/dist/modes/interactive/interactive-mode.js +61 -62
  140. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  141. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  142. package/dist/modes/rpc/rpc-mode.js +1 -0
  143. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  144. package/dist/rpc-entry.js +0 -0
  145. package/dist/utils/clipboard.d.ts.map +1 -1
  146. package/dist/utils/clipboard.js +19 -8
  147. package/dist/utils/clipboard.js.map +1 -1
  148. package/dist/utils/version-check.d.ts.map +1 -1
  149. package/dist/utils/version-check.js +3 -1
  150. package/dist/utils/version-check.js.map +1 -1
  151. package/docs/compaction.md +401 -401
  152. package/docs/containerization.md +111 -111
  153. package/docs/custom-provider.md +766 -763
  154. package/docs/environment-variables.md +88 -0
  155. package/docs/extensions.md +2961 -2953
  156. package/docs/index.md +80 -77
  157. package/docs/models.md +6 -2
  158. package/docs/packages.md +228 -228
  159. package/docs/providers.md +8 -1
  160. package/docs/quickstart.md +165 -165
  161. package/docs/rpc.md +1576 -1559
  162. package/docs/sdk.md +1186 -1186
  163. package/docs/session-format.md +436 -436
  164. package/docs/settings.md +1 -1
  165. package/docs/termux.md +127 -127
  166. package/docs/tui.md +942 -942
  167. package/docs/usage.md +0 -13
  168. package/examples/extensions/README.md +213 -213
  169. package/examples/extensions/custom-compaction.ts +3 -0
  170. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  171. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  172. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  173. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  174. package/examples/extensions/doom-overlay/doom/build.sh +0 -0
  175. package/examples/extensions/gondolin/package-lock.json +2 -2
  176. package/examples/extensions/gondolin/package.json +1 -1
  177. package/examples/extensions/handoff.ts +9 -1
  178. package/examples/extensions/sandbox/package-lock.json +2 -2
  179. package/examples/extensions/sandbox/package.json +1 -1
  180. package/examples/extensions/summarize.ts +3 -0
  181. package/examples/extensions/with-deps/package-lock.json +2 -2
  182. package/examples/extensions/with-deps/package.json +1 -1
  183. package/examples/sdk/README.md +140 -140
  184. package/npm-shrinkwrap.json +16 -15
  185. package/package.json +10 -4
@@ -1,111 +1,111 @@
1
- # Containerization
2
-
3
- Pi runs with all permissions by default, but in some cases, you will want to have more control over what directories Pi can write to and which accesses it has.
4
-
5
- There are two general options. You can either
6
- 1. run the whole `pi` process inside an isolated environment, or
7
- 2. run `pi` on the host and route tool execution into an isolated environment.
8
-
9
- ## Choose a pattern
10
-
11
- | Pattern | What is isolated | Best for | Notes |
12
- | --- | --- | --- | --- |
13
- | Gondolin extension | Built-in tools and `!` commands | Local micro-VM isolation while keeping auth on host | See [`examples/extensions/gondolin/`](../examples/extensions/gondolin/). |
14
- | Plain Docker | Whole `pi` process in a local container | Simple local isolation | Provider API keys enter the container. |
15
- | OpenShell | Whole `pi` process in a policy-controlled sandbox | Local or remote managed sandbox | Requires an OpenShell gateway |
16
-
17
- Extensions run wherever the `pi` process runs. If you run host `pi` with a tool-routing extension, other custom extension tools still run on the host unless they also delegate their operations.
18
-
19
- ## Gondolin
20
-
21
- [Gondolin](https://github.com/earendil-works/gondolin) is a local Linux micro-VM.
22
- Use the [example extension](../examples/extensions/gondolin) when you want `pi` on the host but all built-in tools routed into the VM.
23
-
24
- Setup:
25
-
26
- ```bash
27
- cp -R packages/coding-agent/examples/extensions/gondolin ~/.pi/agent/extensions/gondolin
28
- cd ~/.pi/agent/extensions/gondolin
29
- npm install --ignore-scripts
30
- ```
31
-
32
- Run from the project you want mounted:
33
-
34
- ```bash
35
- cd /path/to/project
36
- pi -e ~/.pi/agent/extensions/gondolin
37
- ```
38
-
39
- The extension mounts the host cwd at `/workspace` in the VM and overrides `read`, `write`, `edit`, `bash`, `grep`, `find`, and `ls`.
40
- User `!` commands are routed into the VM, as well.
41
- File changes under `/workspace` write through to the host.
42
-
43
- Requirements: Node.js >= 23.6.0 for `@earendil-works/gondolin`, plus QEMU (requires installation through your package manager).
44
-
45
- ## Plain Docker
46
-
47
- Run the whole `pi` process in Docker when you want the simplest local container boundary.
48
-
49
- `Dockerfile.pi`:
50
-
51
- ```dockerfile
52
- FROM node:24-bookworm-slim
53
-
54
- RUN apt-get update \
55
- && apt-get install -y --no-install-recommends bash ca-certificates git ripgrep \
56
- && rm -rf /var/lib/apt/lists/*
57
- RUN npm install -g --ignore-scripts @astralyn/pi
58
-
59
- WORKDIR /workspace
60
- ENTRYPOINT ["pi"]
61
- ```
62
-
63
- Build and run:
64
-
65
- ```bash
66
- docker build -t pi-sandbox -f Dockerfile.pi .
67
-
68
- docker run --rm -it \
69
- -e ANTHROPIC_API_KEY \
70
- -v "$PWD:/workspace" \
71
- -v pi-agent-home:/root/.pi/agent \
72
- pi-sandbox
73
- ```
74
-
75
- The `-v "$PWD:/workspace"` mounts your current directory into the container at /workspace such that reads and writes in `/workspace` inside Docker directly affect your host files, like in the Gondolin example.
76
-
77
- Use a named volume for `/root/.pi/agent` if you want container-local settings and sessions. Mounting your host `~/.pi/agent` exposes host auth and session files to the container.
78
-
79
- ## OpenShell
80
-
81
- Use [NVIDIA OpenShell](https://docs.nvidia.com/openshell/about/overview) when you want a policy-controlled sandbox with filesystem, process, network, credential, and inference controls.
82
- OpenShell can run sandboxes through a local gateway backed by Docker, Podman, or a VM runtime, or through a remote Kubernetes gateway.
83
-
84
- Every sandbox requires an active gateway.
85
- Register and select one before creating a sandbox:
86
-
87
- ```bash
88
- openshell gateway add <gateway-url> --name <name>
89
- openshell gateway select <name>
90
- ```
91
-
92
- Launch `pi` inside an OpenShell sandbox:
93
-
94
- ```bash
95
- openshell sandbox create --name pi-sandbox --from pi -- pi
96
- ```
97
-
98
- In this pattern, the whole `pi` process runs inside the sandbox.
99
- Built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
100
-
101
- If the gateway is remote, project files are not bind-mounted from the host, meaning writes in the sandbox are not reflected on your machine.
102
- Clone the repository inside the sandbox or use OpenShell file transfer commands:
103
-
104
- ```bash
105
- openshell sandbox upload pi-sandbox ./repo /workspace
106
- openshell sandbox download pi-sandbox /workspace/repo ./repo-out
107
- ```
108
-
109
- OpenShell providers can keep raw model API keys outside the sandbox.
110
- When inference routing is configured, code inside the sandbox can call `https://inference.local`, and the gateway injects the configured provider credentials upstream.
111
- Configure Pi to use the corresponding OpenAI-compatible or Anthropic-compatible endpoint if you want model traffic to use this route.
1
+ # Containerization
2
+
3
+ Pi runs with all permissions by default, but in some cases, you will want to have more control over what directories Pi can write to and which accesses it has.
4
+
5
+ There are two general options. You can either
6
+ 1. run the whole `pi` process inside an isolated environment, or
7
+ 2. run `pi` on the host and route tool execution into an isolated environment.
8
+
9
+ ## Choose a pattern
10
+
11
+ | Pattern | What is isolated | Best for | Notes |
12
+ | --- | --- | --- | --- |
13
+ | Gondolin extension | Built-in tools and `!` commands | Local micro-VM isolation while keeping auth on host | See [`examples/extensions/gondolin/`](../examples/extensions/gondolin/). |
14
+ | Plain Docker | Whole `pi` process in a local container | Simple local isolation | Provider API keys enter the container. |
15
+ | OpenShell | Whole `pi` process in a policy-controlled sandbox | Local or remote managed sandbox | Requires an OpenShell gateway |
16
+
17
+ Extensions run wherever the `pi` process runs. If you run host `pi` with a tool-routing extension, other custom extension tools still run on the host unless they also delegate their operations.
18
+
19
+ ## Gondolin
20
+
21
+ [Gondolin](https://github.com/earendil-works/gondolin) is a local Linux micro-VM.
22
+ Use the [example extension](../examples/extensions/gondolin) when you want `pi` on the host but all built-in tools routed into the VM.
23
+
24
+ Setup:
25
+
26
+ ```bash
27
+ cp -R packages/coding-agent/examples/extensions/gondolin ~/.pi/agent/extensions/gondolin
28
+ cd ~/.pi/agent/extensions/gondolin
29
+ npm install --ignore-scripts
30
+ ```
31
+
32
+ Run from the project you want mounted:
33
+
34
+ ```bash
35
+ cd /path/to/project
36
+ pi -e ~/.pi/agent/extensions/gondolin
37
+ ```
38
+
39
+ The extension mounts the host cwd at `/workspace` in the VM and overrides `read`, `write`, `edit`, `bash`, `grep`, `find`, and `ls`.
40
+ User `!` commands are routed into the VM, as well.
41
+ File changes under `/workspace` write through to the host.
42
+
43
+ Requirements: Node.js >= 23.6.0 for `@earendil-works/gondolin`, plus QEMU (requires installation through your package manager).
44
+
45
+ ## Plain Docker
46
+
47
+ Run the whole `pi` process in Docker when you want the simplest local container boundary.
48
+
49
+ `Dockerfile.pi`:
50
+
51
+ ```dockerfile
52
+ FROM node:24-bookworm-slim
53
+
54
+ RUN apt-get update \
55
+ && apt-get install -y --no-install-recommends bash ca-certificates git ripgrep \
56
+ && rm -rf /var/lib/apt/lists/*
57
+ RUN npm install -g --ignore-scripts @astralyn/pi
58
+
59
+ WORKDIR /workspace
60
+ ENTRYPOINT ["pi"]
61
+ ```
62
+
63
+ Build and run:
64
+
65
+ ```bash
66
+ docker build -t pi-sandbox -f Dockerfile.pi .
67
+
68
+ docker run --rm -it \
69
+ -e ANTHROPIC_API_KEY \
70
+ -v "$PWD:/workspace" \
71
+ -v pi-agent-home:/root/.pi/agent \
72
+ pi-sandbox
73
+ ```
74
+
75
+ The `-v "$PWD:/workspace"` mounts your current directory into the container at /workspace such that reads and writes in `/workspace` inside Docker directly affect your host files, like in the Gondolin example.
76
+
77
+ Use a named volume for `/root/.pi/agent` if you want container-local settings and sessions. Mounting your host `~/.pi/agent` exposes host auth and session files to the container.
78
+
79
+ ## OpenShell
80
+
81
+ Use [NVIDIA OpenShell](https://docs.nvidia.com/openshell/about/overview) when you want a policy-controlled sandbox with filesystem, process, network, credential, and inference controls.
82
+ OpenShell can run sandboxes through a local gateway backed by Docker, Podman, or a VM runtime, or through a remote Kubernetes gateway.
83
+
84
+ Every sandbox requires an active gateway.
85
+ Register and select one before creating a sandbox:
86
+
87
+ ```bash
88
+ openshell gateway add <gateway-url> --name <name>
89
+ openshell gateway select <name>
90
+ ```
91
+
92
+ Launch `pi` inside an OpenShell sandbox:
93
+
94
+ ```bash
95
+ openshell sandbox create --name pi-sandbox --from pi -- pi
96
+ ```
97
+
98
+ In this pattern, the whole `pi` process runs inside the sandbox.
99
+ Built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
100
+
101
+ If the gateway is remote, project files are not bind-mounted from the host, meaning writes in the sandbox are not reflected on your machine.
102
+ Clone the repository inside the sandbox or use OpenShell file transfer commands:
103
+
104
+ ```bash
105
+ openshell sandbox upload pi-sandbox ./repo /workspace
106
+ openshell sandbox download pi-sandbox /workspace/repo ./repo-out
107
+ ```
108
+
109
+ OpenShell providers can keep raw model API keys outside the sandbox.
110
+ When inference routing is configured, code inside the sandbox can call `https://inference.local`, and the gateway injects the configured provider credentials upstream.
111
+ Configure Pi to use the corresponding OpenAI-compatible or Anthropic-compatible endpoint if you want model traffic to use this route.