pi-landstrip 0.17.43 → 0.18.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.
package/README.md CHANGED
@@ -7,14 +7,13 @@ Subagents 3 active
7
7
  └─ ● running @general Design bounded summaries
8
8
  ```
9
9
 
10
- `pi-landstrip` is a [Pi](https://pi.dev/) extension that provides sandboxed Bash
11
- execution, OpenCode-compatible primary agents, and sandbox-aware subagents. It
12
- uses an Anthropic-compatible policy and delegates OS-level enforcement to
10
+ `pi-landstrip` adds sandboxed Bash, primary agents, and sandboxed subagents to
11
+ [Pi](https://pi.dev/). OS isolation is provided by
13
12
  [`landstrip`](https://github.com/landstrip/landstrip).
14
13
 
15
- The extension includes a shared [sandbox policy](./sandbox.json) and separate
16
- [agent configuration](./subagents.json). Global and trusted-project files can
17
- override both.
14
+ The package includes a default [sandbox policy](./sandbox.json). Configure agents,
15
+ subagent limits, permissions, and OpenCode imports under `landstrip` in Pi
16
+ `settings.json`. Trusted project settings override global settings.
18
17
 
19
18
  Process-backed subagents require Pi >= 0.82.0, and Node.js >= 22.19.0.
20
19
 
@@ -46,15 +45,12 @@ Alternatively, place the extension under `~/.pi/agent/extensions/` (global) or
46
45
 
47
46
  On unsupported platforms the extension loads but leaves sandboxing disabled.
48
47
 
49
- On Windows, Pi's Git Bash/MSYS shell cannot run under LPAC. The packaged policy
50
- therefore selects standard AppContainer explicitly. This is weaker than LPAC because
51
- resources granted to `ALL APPLICATION PACKAGES` remain visible; `/sandbox` and the
52
- status line report the active backend and mode. There is no silent
53
- LPAC-to-standard fallback.
48
+ Pi's Git Bash/MSYS shell cannot start in LPAC, so the default Windows policy uses
49
+ standard AppContainer. `/sandbox` and the status line show the active Windows
50
+ isolation. LPAC launch failures return an error.
54
51
 
55
- An optional restricted-user backend supports Git Bash without AppContainer. It
56
- requires one-time elevated host setup and persistent local accounts and WFP rules;
57
- see [Windows restricted-user setup](#windows-restricted-user-setup).
52
+ Restricted-user isolation supports Git Bash with restricted local accounts. See
53
+ [Windows restricted-user installation](#windows-restricted-user-installation).
58
54
 
59
55
  ## Disabling
60
56
 
@@ -71,20 +67,16 @@ processes, but without the outer Landstrip OS sandbox. The extension warns once
71
67
  per session. Agent tool permissions still apply, but they are not an OS isolation
72
68
  boundary.
73
69
 
74
- Trusted project config overrides global config except for the Windows backend,
75
- which can be selected only in the trusted global file. `/sandbox` updates a trusted
76
- project sandbox file when present, otherwise the global file. Pi versions without a
77
- project-trust API use only global configuration.
70
+ Trusted project config overrides global config. `/sandbox` updates a trusted
71
+ project sandbox file when present, otherwise the global file. Pi versions
72
+ without a project-trust API use only global configuration.
78
73
 
79
74
  ## Behavior
80
75
 
81
- When Pi requests a sandboxed permission, the extension sends a host notification
82
- and opens a dialog. The user can allow once, allow for the session, persist for
83
- the project or globally, or reject. The dialog shows the exact path or domain
84
- being approved.
85
-
86
- Project approvals are written to `.pi/sandbox.json`; global approvals are
87
- written to `~/.pi/agent/sandbox.json`.
76
+ When a command requests additional access, the extension opens an approval dialog.
77
+ The user can allow once, allow for the session, save the approval globally or for the
78
+ project, or reject it. Project approvals go to `.pi/sandbox.json`; global approvals
79
+ go to `~/.pi/agent/sandbox.json`.
88
80
 
89
81
  The main agent remains a normal Pi process. `pi-landstrip` replaces Bash execution,
90
82
  including AI `bash` calls and manually typed shell commands (`!` and `!!`), with a
@@ -103,27 +95,39 @@ task's dedicated session directory. These paths are required to construct a
103
95
  normal Pi worker and are not persisted into `sandbox.json`. The worker receives
104
96
  write access only to its own session and temporary directories.
105
97
 
106
- Use `/sandbox` to inspect the active policy and toggle sandboxing. Use `/agents`
107
- to select the primary role, inspect worker configuration and status, and set the
108
- global or trusted-project concurrency limit.
98
+ Use `/sandbox` to inspect or disable the sandbox. Use `/agents` to select a primary
99
+ agent, inspect primary agents, subagents, and tasks, and set subagent limits.
100
+
101
+ ## Permission model
102
+
103
+ Agent and sandbox permissions apply at different stages:
104
+
105
+ | Layer | Checked before or during | Controls |
106
+ | ------------------ | ------------------------ | ------------------------------------------ |
107
+ | Agent permission | Before tool dispatch | Which tools an agent may call |
108
+ | Sandbox permission | During process execution | Filesystem and network access for commands |
109
+
110
+ ```text
111
+ agent → agent permission → tool → sandbox → OS resource
112
+ ```
113
+
114
+ Each layer prompts independently. An agent approval allows tool dispatch; sandbox
115
+ restrictions still apply to the resulting process.
109
116
 
110
117
  ## Primary agents
111
118
 
112
- The `/agents` selector provides OpenCode-compatible `build` and `plan` roles by
113
- default. Build has normal development access; plan asks before shell commands
114
- and file changes. Built-in colors match OpenCode's default theme roles
115
- (`success`/green for build, `warning`/orange for plan) and appear in the status
116
- line and agent selectors.
117
- The selection controls the root system prompt and permissions and is restored
118
- with the session.
119
+ `/agents` lists all configured agents and their modes. Press Enter to activate a
120
+ visible primary agent. The built-in primary agents are `build` and `plan`. Build has
121
+ normal development access; plan asks before shell commands and file edits.
122
+
123
+ The selected prompt and permissions are stored in the session. Press `Ctrl+Shift+A`
124
+ while Pi is idle to cycle through visible primary agents.
119
125
 
120
126
  ## Subagents
121
127
 
122
- Landstrip provides an OpenCode-compatible `task` tool. Each active task runs as a
123
- full `pi --mode rpc` process inside an outer Landstrip sandbox. The sandbox
124
- covers Pi, its plugins and tools, model requests, and descendant processes. The
125
- root Pi process supervises RPC, permissions, nesting, persistence, and result
126
- delivery.
128
+ The `task` tool runs each subagent in a separate `pi --mode rpc` process inside a
129
+ Landstrip sandbox. The root Pi process manages RPC, permissions, nesting, sessions,
130
+ and results.
127
131
 
128
132
  Workers use normal Pi resource discovery and plugin loading, plus the
129
133
  `pi-landstrip` worker extension. Requested tools are composed inside the worker,
@@ -131,7 +135,7 @@ so plugins can add or replace implementations. Each task starts a fresh Pi
131
135
  process and plugin instances; continuing a `task_id` restores its persisted Pi
132
136
  session in a new process.
133
137
 
134
- The tool accepts the OpenCode task fields:
138
+ The tool accepts these fields:
135
139
 
136
140
  ```json
137
141
  {
@@ -144,32 +148,18 @@ The tool accepts the OpenCode task fields:
144
148
  }
145
149
  ```
146
150
 
147
- Foreground tasks return the child result directly. Background tasks return a
148
- queued result and deliver completion automatically. Task rows show lifecycle
149
- state, current activity, tool-call count, elapsed time, and expandable output.
150
- Use `/subagents` to open an inspector with **Agents** and **Sessions** tabs. The
151
- Agents tab lists every available subagent type and its `built-in`, `global`, or
152
- `local` source. The Sessions tab inspects child transcripts; task rows can open a
153
- specific one with `/subagents <id>`. Completed and failed task metadata remains
154
- available after reload, and persisted sessions can be continued with `task_id`.
151
+ Foreground tasks return their result directly. Background tasks return immediately
152
+ and report completion later. The **Tasks** tab in `/agents` shows task status and
153
+ output. Open a task with `/agents <id>`. Continue a saved session with `task_id`.
155
154
 
156
155
  Session switching or shutdown stops live workers. After an unclean restart,
157
156
  unfinished work is marked interrupted; completed but undelivered background
158
157
  results are delivered when the root session resumes.
159
158
 
160
- OpenCode-style permissions wrap each worker's composed tools: `deny` blocks,
161
- `ask` prompts in the root UI, and `allow` runs the tool. Other workers may
162
- continue while a prompt is open. Forwarded worker dialogs identify the agent,
163
- task summary, and task ID. An "Allow for this session" decision applies to the
164
- root session and its descendants.
165
-
166
- Tool permissions cannot widen the outer Landstrip policy. Sandbox approvals
167
- continue to use `.pi/sandbox.json` and `~/.pi/agent/sandbox.json`.
168
-
169
- Subagents fail closed when sandboxing is expected but unavailable, unsupported,
170
- or missing. An explicit `--no-sandbox` flag or `enabled: false` configuration is
171
- treated as an intentional opt-out and uses the warned unsandboxed process path.
172
- Unsupported Pi versions still fail task startup.
159
+ Workers check agent permissions before tool dispatch: `deny` blocks, `ask` prompts in
160
+ the root UI, and `allow` runs the tool. Required sandbox startup failures stop the
161
+ task. With `--no-sandbox` or `enabled: false`, workers run without OS isolation and
162
+ Pi shows a warning.
173
163
 
174
164
  ### Platform behavior
175
165
 
@@ -205,158 +195,134 @@ first.
205
195
 
206
196
  ## Configuration
207
197
 
208
- Subagent configuration is read from `~/.pi/agent/subagents.json` and, for trusted
209
- projects, `.pi/subagents.json`. Project values override global values; both are
210
- merged over the packaged [defaults](./subagents.json). The packaged subagent types
211
- are `explore`, `general`, and the OpenCode-compatible `scout` reconnaissance agent.
198
+ Agent permissions are configured under `landstrip` in Pi `settings.json`. Sandbox
199
+ permissions are configured in `sandbox.json`. The files use different schemas and
200
+ control different stages.
201
+
202
+ ### Agent policy (`settings.json`)
203
+
204
+ Agent settings are read from `~/.pi/agent/settings.json` and, for trusted projects,
205
+ `.pi/settings.json`. Built-in subagents are `explore`, `general`, and `scout`.
212
206
 
213
- Sandbox policy remains in `~/.pi/agent/sandbox.json` and `.pi/sandbox.json`. Pi's
214
- `settings.json` only needs the normal package entry for the extension:
207
+ Pi Markdown agents are loaded from `~/.pi/agent/agents/*.md` and, for trusted
208
+ projects, `.pi/agents/*.md`. Nested directories are supported. Project Markdown
209
+ agents override global Markdown agents. Settings under `landstrip.agent` override
210
+ Markdown and OpenCode agents with the same name.
211
+
212
+ Add agent configuration under `landstrip` in Pi `settings.json`:
215
213
 
216
214
  ```json
217
215
  {
218
- "packages": ["npm:pi-landstrip"]
216
+ "landstrip": {
217
+ "maxSubagents": 2,
218
+ "agent": {
219
+ "review": {
220
+ "description": "Review code without modifying it",
221
+ "mode": "subagent",
222
+ "prompt": "Review the requested code and report concrete findings.",
223
+ "permission": {
224
+ "edit": "deny",
225
+ "bash": "ask"
226
+ }
227
+ }
228
+ },
229
+ "permission": {
230
+ "task": {
231
+ "*": "deny",
232
+ "review": "allow"
233
+ }
234
+ }
235
+ }
219
236
  }
220
237
  ```
221
238
 
222
- OpenCode Markdown agent import flags live in `subagents.json` as top-level
223
- `opencode` (both default to `true`):
239
+ `landstrip.maxSubagents` sets the maximum number of concurrent subagents from 0 to 16. The default is 1; zero disables `task`. The `/agents` **Settings** tab provides
240
+ **Maximum subagents (global)** and **Maximum subagents (local)**.
241
+
242
+ `landstrip.permission` applies to every agent. Each
243
+ `landstrip.agent.<name>.permission` map adds agent-specific rules; later matching
244
+ rules win. Agent definitions support `mode`, `prompt`, `model`, `variant`, `steps`,
245
+ `color`, `disable`, and `allow`/`ask`/`deny` permissions. `{file:path}` prompt
246
+ references are resolved from the defining `settings.json`. Provider-specific fields
247
+ belong under `options`.
248
+
249
+ `hidden` removes an agent from `/agents`. A hidden, subagent-capable agent remains
250
+ available to `task`. Agent `mode` controls activation: only `primary` and `all` agents
251
+ can be selected as primary, while only `subagent` and `all` agents can be passed to
252
+ `task`. Missing, ambiguous, or unauthenticated primary-agent models produce an error
253
+ and leave the current agent active.
254
+
255
+ OpenCode integration flags also live in Pi `settings.json` under
256
+ `landstrip.opencode`; both default to `true`:
224
257
 
225
258
  ```json
226
259
  {
227
- "maxSubagents": 0,
228
- "opencode": {
229
- "showGlobalAgents": true,
230
- "showLocalAgents": true
231
- },
232
- "subagents": {
233
- "agent": {}
260
+ "packages": ["npm:pi-landstrip"],
261
+ "landstrip": {
262
+ "opencode": {
263
+ "showGlobalAgents": true,
264
+ "showLocalAgents": true
265
+ }
234
266
  }
235
267
  }
236
268
  ```
237
269
 
238
- - `showGlobalAgents` imports Markdown agents from the OpenCode global config
239
- directory (`$OPENCODE_CONFIG_DIR`, or `$XDG_CONFIG_HOME/opencode`, or
240
- `~/.config/opencode`) under `agent/` and `agents/`.
241
- - `showLocalAgents` imports Markdown agents from the trusted project's
242
- `.opencode/agent/` and `.opencode/agents/` directories.
270
+ - `showGlobalAgents` imports `agent` definitions from `opencode.json` and
271
+ `opencode.jsonc`, plus Markdown agents under `agent/` and `agents/`, in the
272
+ OpenCode global config directory (`$OPENCODE_CONFIG_DIR`,
273
+ `$XDG_CONFIG_HOME/opencode`, or `~/.config/opencode`).
274
+ - `showLocalAgents` imports `agent` definitions from project `opencode.json` and
275
+ `opencode.jsonc`, `.opencode/opencode.json` and `.opencode/opencode.jsonc`, and
276
+ Markdown agents under `.opencode/agent/` and `.opencode/agents/`.
277
+
278
+ Set either flag to `false` to disable that OpenCode source. Project OpenCode agents
279
+ override global OpenCode agents. Pi Markdown agents and `landstrip.agent` settings
280
+ take precedence over OpenCode imports. Project sources require a trusted project.
281
+ OpenCode config files support JSONC comments, trailing commas, and `{file:path}`
282
+ prompt references.
243
283
 
244
- Set a flag to `false` to disable that source. OpenCode local agents override
245
- OpenCode global agents. Pi agent definitions from `subagents.json` (built-in,
246
- global, and local) take precedence over OpenCode imports with the same name;
247
- conflicts are silent. Local OpenCode agents are skipped when the project is
248
- untrusted, regardless of the flag.
284
+ ### Sandbox policy (`sandbox.json`)
249
285
 
250
- `subagents.json` accepts top-level `maxSubagents`, `opencode`, and `subagents`;
251
- sandbox fields belong in `sandbox.json`.
286
+ Sandbox settings are read from `~/.pi/agent/sandbox.json` and, for trusted projects,
287
+ `.pi/sandbox.json`. They control runtime filesystem and network access.
252
288
 
253
- The Windows sandbox fields are:
289
+ Configure Windows sandbox fields in `sandbox.json`:
254
290
 
255
291
  ```json
256
292
  {
257
293
  "windows": {
258
- "backend": "appContainer",
259
294
  "appContainerMode": "standard",
260
295
  "allowLoopback": false
261
296
  }
262
297
  }
263
298
  ```
264
299
 
265
- `backend` is `"appContainer"` or `"restrictedUser"`. It is a trusted host setting:
266
- only `~/.pi/agent/sandbox.json` can change it, and project configuration cannot
267
- override it. `appContainerMode` is `"lpac"` or `"standard"`; core Landstrip defaults
268
- to LPAC, while the Pi package defaults to standard mode for Git Bash compatibility.
269
- `allowLoopback` is independently opt-in and applies only to AppContainer.
300
+ `appContainerMode` accepts `"lpac"` or `"standard"`. The Pi package defaults to
301
+ standard mode for Git Bash. `allowLoopback` applies only to AppContainer. Landstrip
302
+ selects Windows isolation automatically.
270
303
 
271
- ### Windows restricted-user setup
304
+ #### Windows restricted-user installation
272
305
 
273
- Provision the backend once before selecting it in global configuration:
306
+ Provision restricted-user execution once to activate it:
274
307
 
275
308
  ```powershell
276
- npx @landstrip/landstrip windows setup
309
+ npx @landstrip/landstrip windows install
277
310
  npx @landstrip/landstrip windows status
278
311
  ```
279
312
 
280
- Setup requests UAC elevation and defaults to eight restricted-network accounts, two
281
- unrestricted-network accounts, and proxy ports 60080-60111. Run
282
- `npx @landstrip/landstrip windows setup --help` for pool and port options. Then set
283
- `"backend": "restrictedUser"` in `~/.pi/agent/sandbox.json` and restart Pi.
313
+ Installation requests elevation and creates eight restricted-network accounts, two
314
+ unrestricted-network accounts, and proxy ports 60080–60111 by default. Use
315
+ `windows install --help` to change these values. Restart Pi after installation.
284
316
 
285
- The extension checks installation health and reads the configured proxy range before
286
- launching a restricted worker. Restricted-user mode does not support
287
- `windows.allowLoopback` or `network.allowLocalBinding`. Remove the persistent
288
- accounts, WFP rules, runner, and recovered per-run ACL grants with:
317
+ Before each launch, the extension checks the installation. A failed health check
318
+ stops the task. Restricted-user isolation does not support `windows.allowLoopback`
319
+ or `network.allowLocalBinding`. Remove the accounts, WFP rules, runner, and ACL
320
+ grants with:
289
321
 
290
322
  ```powershell
291
323
  npx @landstrip/landstrip windows uninstall
292
324
  ```
293
325
 
294
- A subagent configuration example follows:
295
-
296
- ```json
297
- {
298
- "maxSubagents": 2,
299
- "subagents": {
300
- "agent": {
301
- "review": {
302
- "description": "Review code without modifying it",
303
- "mode": "subagent",
304
- "prompt": "Review the requested code and report concrete findings.",
305
- "permission": {
306
- "edit": "deny",
307
- "bash": "ask"
308
- }
309
- }
310
- },
311
- "permission": {
312
- "task": {
313
- "*": "deny",
314
- "review": "allow"
315
- }
316
- }
317
- }
318
- }
319
- ```
320
-
321
- `maxSubagents` is an integer from 0 through 16 controlling concurrent workers.
322
- The packaged default is 0, which removes the `task` tool while retaining primary
323
- roles. There is no separate subagent enable switch. The Settings tab in
324
- `/agents` edits this limit for global and trusted-project configuration.
325
-
326
- Agent modes, hidden/disabled agents, prompts, colors, and ordered
327
- `allow`/`ask`/`deny` permissions apply to primary agents and subagents. Prompt
328
- strings may include OpenCode-style `{file:path}` tokens; relative paths resolve
329
- against the `subagents.json` file that defines them. `color` accepts `#RRGGBB`
330
- or OpenCode theme names (`primary`, `secondary`, `accent`, `success`, `warning`,
331
- `error`, `info`). `hidden` only hides an agent from user-facing primary pickers;
332
- the model can still invoke a hidden subagent via `task`. Subagent workers also
333
- honor model selection, supported Pi thinking-level variants, and step limits.
334
- Primary agent activation currently changes the prompt and permissions only.
335
- Later matching permission rules win. Put provider-specific values under
336
- `options`; unknown agent fields are rejected. Agent permissions cannot weaken an
337
- enabled OS sandbox, grant filesystem access, or grant network access.
338
-
339
- ## Configuration migration
340
-
341
- There is no compatibility loader for previous subagent configuration sources.
342
- Legacy keys in `settings.json` produce a migration warning. Move configuration as
343
- follows, then remove the old fields:
344
-
345
- - Move `agent` and `permission` from Pi `settings.json` or OpenCode JSON under
346
- `subagents.agent` and `subagents.permission`.
347
- - Convert legacy `tools` booleans to explicit `permission` rules.
348
- - Move Markdown agent prompts into each `subagents.agent.<name>.prompt` string.
349
- - Put the worker limit in top-level `maxSubagents`; zero disables delegation.
350
- - Move `landstrip.opencode` flags from Pi `settings.json` to top-level
351
- `opencode` in `subagents.json`.
352
- - Use `~/.pi/agent/subagents.json` for global configuration and
353
- `.pi/subagents.json` for trusted project configuration.
354
- - Leave sandbox policy in `~/.pi/agent/sandbox.json` and `.pi/sandbox.json`;
355
- those files are unchanged.
356
-
357
- Do not put these fields in Pi's `settings.json`; `pi-landstrip` does not read
358
- them there.
359
-
360
326
  ## Plugin API
361
327
 
362
328
  Pi extensions can discover the active Landstrip runtime through the versioned