pi-landstrip 0.19.20 → 0.20.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 (4) hide show
  1. package/README.md +7 -5
  2. package/api.ts +28 -28
  3. package/dist/index.ts +845 -369
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -60,11 +60,13 @@ Configure `~/.pi/agent/landstrip.json`, trusted-project `.pi/landstrip.json`, or
60
60
  `maxSubagents`: 0–16. Agent definitions can override model, prompt, mode, options,
61
61
  and permissions.
62
62
 
63
- Use `/landstrip` for the management pane and `/landstrip help` for commands.
64
- Task IDs accept unique prefixes; bare IDs open logs. `/landstrip tasks kill <id>`
65
- terminates a task. `Ctrl+Shift+A` cycles primary agents while idle.
66
- The `task` tool accepts `background: true` for immediate return and `task_id`
67
- to continue a saved task. Press `Enter` in running/queued logs to steer workers.
63
+ Use `/landstrip-sandbox` for sandbox overview/policy (`Overview`, `Policy`, `Help`)
64
+ and `/landstrip-subagents` for subagent/task management (`Tasks`, `Log`, `Subagent`,
65
+ `Primary`, `Settings`, `Help`). Task IDs accept unique prefixes; bare IDs open logs.
66
+ `/landstrip-subagents tasks kill <id>` terminates a task. `Ctrl+Shift+A` cycles
67
+ primary agents while idle. The `task` tool accepts `background: true`, `include_context: true`,
68
+ and `task_id` to continue a saved task; the `tasks` tool supports `list`, `inspect`, `wait`,
69
+ `steer`, and `cancel`. Press `S` in `Tasks` or `Enter` in running/queued logs to steer workers.
68
70
 
69
71
  ### Worker environment and authentication
70
72
 
package/api.ts CHANGED
@@ -9,15 +9,15 @@ import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-a
9
9
  import { isRecord } from '@landstrip/landstrip-api/shared';
10
10
 
11
11
  export const LANDSTRIP_CONTEXT_ENV = 'LANDSTRIP_CONTEXT';
12
- export const LANDSTRIP_RUNTIME_VERSION = 2;
12
+ export const LANDSTRIP_RUNTIME_VERSION = 3;
13
13
 
14
- const RUNTIME_REGISTER_EVENT = 'landstrip:runtime:register:v2';
15
- const RUNTIME_DISCOVER_EVENT = 'landstrip:runtime:discover:v2';
14
+ const RUNTIME_REGISTER_EVENT = 'landstrip:runtime:register:v3';
15
+ const RUNTIME_DISCOVER_EVENT = 'landstrip:runtime:discover:v3';
16
16
 
17
17
  export type LandstripSandboxState = 'enabled' | 'disabled' | 'unavailable';
18
18
 
19
- export interface LandstripContextV2 {
20
- readonly version: 2;
19
+ export interface LandstripContextV3 {
20
+ readonly version: 3;
21
21
  readonly host: 'pi';
22
22
  readonly role: 'primary' | 'subagent';
23
23
  readonly sandbox: LandstripSandboxState;
@@ -64,7 +64,7 @@ export interface LandstripPermissionAsk {
64
64
  }
65
65
 
66
66
  export interface LandstripPermissionAskRequest {
67
- readonly context: LandstripContextV2;
67
+ readonly context: LandstripContextV3;
68
68
  readonly toolName: string;
69
69
  readonly input: Readonly<Record<string, unknown>>;
70
70
  readonly permissions: readonly LandstripPermissionAsk[];
@@ -134,17 +134,17 @@ export type LandstripSpawn = (
134
134
  ) => ChildProcess;
135
135
 
136
136
  export type LandstripEvent =
137
- | { readonly type: 'sandbox.changed'; readonly context: LandstripContextV2 }
138
- | { readonly type: 'subagent.start'; readonly context: LandstripContextV2 }
137
+ | { readonly type: 'sandbox.changed'; readonly context: LandstripContextV3 }
138
+ | { readonly type: 'subagent.start'; readonly context: LandstripContextV3 }
139
139
  | {
140
140
  readonly type: 'subagent.end';
141
- readonly context: LandstripContextV2;
141
+ readonly context: LandstripContextV3;
142
142
  readonly status: 'completed' | 'cancelled' | 'error';
143
143
  };
144
144
 
145
- export interface PiLandstripRuntimeV2 {
146
- readonly version: 2;
147
- getContext(ctx?: ExtensionContext): LandstripContextV2;
145
+ export interface PiLandstripRuntimeV3 {
146
+ readonly version: 3;
147
+ getContext(ctx?: ExtensionContext): LandstripContextV3;
148
148
  registerShellProvider(provider: LandstripShellProvider): () => void;
149
149
  registerPermissionAskProvider(provider: LandstripPermissionAskProvider): () => void;
150
150
  prepareProcess(options: LandstripProcessOptions): Promise<LandstripPreparedProcess>;
@@ -157,13 +157,13 @@ export interface PiLandstripRuntimeV2 {
157
157
  }
158
158
 
159
159
  interface RuntimeRegistration {
160
- readonly version: 2;
161
- readonly runtime: PiLandstripRuntimeV2;
160
+ readonly version: 3;
161
+ readonly runtime: PiLandstripRuntimeV3;
162
162
  }
163
163
 
164
164
  interface RuntimeDiscovery {
165
- readonly version: 2;
166
- register(runtime: PiLandstripRuntimeV2): void;
165
+ readonly version: 3;
166
+ register(runtime: PiLandstripRuntimeV3): void;
167
167
  }
168
168
 
169
169
  interface EventBusLike {
@@ -175,7 +175,7 @@ function eventBus(pi: ExtensionAPI): EventBusLike | undefined {
175
175
  return (pi as ExtensionAPI & { events?: EventBusLike }).events;
176
176
  }
177
177
 
178
- function isRuntime(value: unknown): value is PiLandstripRuntimeV2 {
178
+ function isRuntime(value: unknown): value is PiLandstripRuntimeV3 {
179
179
  return (
180
180
  isRecord(value) &&
181
181
  value['version'] === LANDSTRIP_RUNTIME_VERSION &&
@@ -213,18 +213,18 @@ function isPreparedProcess(value: unknown): value is LandstripPreparedProcess {
213
213
 
214
214
  function discoverLandstrip(
215
215
  pi: ExtensionAPI,
216
- callback: (runtime: PiLandstripRuntimeV2) => void,
216
+ callback: (runtime: PiLandstripRuntimeV3) => void,
217
217
  onInvalid?: (error: Error) => void,
218
218
  ): () => void {
219
219
  const events = eventBus(pi);
220
220
  if (!events) return () => undefined;
221
221
 
222
- let current: PiLandstripRuntimeV2 | undefined;
222
+ let current: PiLandstripRuntimeV3 | undefined;
223
223
  let disposed = false;
224
224
  const register = (value: unknown): void => {
225
225
  if (disposed) return;
226
226
  if (!isRuntime(value)) {
227
- onInvalid?.(new Error('Invalid Landstrip runtime v2 declaration'));
227
+ onInvalid?.(new Error('Invalid Landstrip runtime v3 declaration'));
228
228
  return;
229
229
  }
230
230
  if (value === current) return;
@@ -234,7 +234,7 @@ function discoverLandstrip(
234
234
  const unsubscribe = events.on(RUNTIME_REGISTER_EVENT, (value) => {
235
235
  if (disposed) return;
236
236
  if (!isRecord(value) || value['version'] !== LANDSTRIP_RUNTIME_VERSION) {
237
- onInvalid?.(new Error('Invalid Landstrip runtime v2 registration'));
237
+ onInvalid?.(new Error('Invalid Landstrip runtime v3 registration'));
238
238
  return;
239
239
  }
240
240
  register(value['runtime']);
@@ -258,13 +258,13 @@ function discoverLandstrip(
258
258
 
259
259
  export function useLandstrip(
260
260
  pi: ExtensionAPI,
261
- callback: (runtime: PiLandstripRuntimeV2) => void,
261
+ callback: (runtime: PiLandstripRuntimeV3) => void,
262
262
  ): () => void {
263
263
  return discoverLandstrip(pi, callback);
264
264
  }
265
265
 
266
266
  export function createLandstrip(pi: ExtensionAPI): Landstrip {
267
- let runtime: PiLandstripRuntimeV2 | undefined;
267
+ let runtime: PiLandstripRuntimeV3 | undefined;
268
268
  let runtimeError: Error | undefined;
269
269
  let disposed = false;
270
270
  const stopDiscovery = discoverLandstrip(
@@ -339,7 +339,7 @@ export function createLandstrip(pi: ExtensionAPI): Landstrip {
339
339
 
340
340
  function provideExtensionProvider(
341
341
  pi: ExtensionAPI,
342
- register: (runtime: PiLandstripRuntimeV2) => () => void,
342
+ register: (runtime: PiLandstripRuntimeV3) => () => void,
343
343
  ): () => void {
344
344
  let unregisterProvider: (() => void) | undefined;
345
345
  const stopDiscovery = useLandstrip(pi, (runtime) => {
@@ -369,7 +369,7 @@ export function provideLandstripPermissionAsk(
369
369
 
370
370
  export function publishLandstripRuntime(
371
371
  pi: ExtensionAPI,
372
- runtime: PiLandstripRuntimeV2,
372
+ runtime: PiLandstripRuntimeV3,
373
373
  ): () => void {
374
374
  const events = eventBus(pi);
375
375
  if (!events) return () => undefined;
@@ -390,13 +390,13 @@ export function publishLandstripRuntime(
390
390
  }
391
391
  }
392
392
 
393
- export function encodeLandstripContext(context: LandstripContextV2): string {
393
+ export function encodeLandstripContext(context: LandstripContextV3): string {
394
394
  return Buffer.from(JSON.stringify(context)).toString('base64url');
395
395
  }
396
396
 
397
397
  export function contextFromEnvironment(
398
398
  env: NodeJS.ProcessEnv = process.env,
399
- ): LandstripContextV2 | undefined {
399
+ ): LandstripContextV3 | undefined {
400
400
  const encoded = env[LANDSTRIP_CONTEXT_ENV];
401
401
  if (!encoded) return undefined;
402
402
 
@@ -418,7 +418,7 @@ export function contextFromEnvironment(
418
418
  ) {
419
419
  return undefined;
420
420
  }
421
- return value as unknown as LandstripContextV2;
421
+ return value as unknown as LandstripContextV3;
422
422
  } catch {
423
423
  return undefined;
424
424
  }