pi-landstrip 0.19.14 → 0.19.16

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 (3) hide show
  1. package/api.ts +32 -30
  2. package/dist/index.ts +3 -3
  3. package/package.json +2 -2
package/api.ts CHANGED
@@ -178,33 +178,35 @@ function eventBus(pi: ExtensionAPI): EventBusLike | undefined {
178
178
  function isRuntime(value: unknown): value is PiLandstripRuntimeV2 {
179
179
  return (
180
180
  isRecord(value) &&
181
- value.version === LANDSTRIP_RUNTIME_VERSION &&
182
- typeof value.getContext === 'function' &&
183
- typeof value.registerShellProvider === 'function' &&
184
- typeof value.registerPermissionAskProvider === 'function' &&
185
- typeof value.prepareProcess === 'function' &&
186
- typeof value.registerWorkerExtension === 'function' &&
187
- typeof value.getWorkerExtensions === 'function' &&
188
- typeof value.on === 'function'
181
+ value['version'] === LANDSTRIP_RUNTIME_VERSION &&
182
+ typeof value['getContext'] === 'function' &&
183
+ typeof value['registerShellProvider'] === 'function' &&
184
+ typeof value['registerPermissionAskProvider'] === 'function' &&
185
+ typeof value['prepareProcess'] === 'function' &&
186
+ typeof value['registerWorkerExtension'] === 'function' &&
187
+ typeof value['getWorkerExtensions'] === 'function' &&
188
+ typeof value['on'] === 'function'
189
189
  );
190
190
  }
191
191
 
192
192
  function isDisposableProcess(value: unknown): value is Pick<LandstripPreparedProcess, 'dispose'> {
193
- return isRecord(value) && typeof value.dispose === 'function';
193
+ return isRecord(value) && typeof value['dispose'] === 'function';
194
194
  }
195
195
 
196
196
  function isPreparedProcess(value: unknown): value is LandstripPreparedProcess {
197
197
  return (
198
198
  isRecord(value) &&
199
- typeof value.command === 'string' &&
200
- value.command.trim().length > 0 &&
201
- Array.isArray(value.args) &&
202
- [...value.args].every((arg: unknown) => typeof arg === 'string') &&
203
- typeof value.cwd === 'string' &&
204
- value.cwd.length > 0 &&
205
- isRecord(value.env) &&
206
- Object.values(value.env).every((entry) => entry === undefined || typeof entry === 'string') &&
207
- typeof value.spawn === 'function' &&
199
+ typeof value['command'] === 'string' &&
200
+ value['command'].trim().length > 0 &&
201
+ Array.isArray(value['args']) &&
202
+ [...value['args']].every((arg: unknown) => typeof arg === 'string') &&
203
+ typeof value['cwd'] === 'string' &&
204
+ value['cwd'].length > 0 &&
205
+ isRecord(value['env']) &&
206
+ Object.values(value['env']).every(
207
+ (entry) => entry === undefined || typeof entry === 'string',
208
+ ) &&
209
+ typeof value['spawn'] === 'function' &&
208
210
  isDisposableProcess(value)
209
211
  );
210
212
  }
@@ -231,11 +233,11 @@ function discoverLandstrip(
231
233
  };
232
234
  const unsubscribe = events.on(RUNTIME_REGISTER_EVENT, (value) => {
233
235
  if (disposed) return;
234
- if (!isRecord(value) || value.version !== LANDSTRIP_RUNTIME_VERSION) {
236
+ if (!isRecord(value) || value['version'] !== LANDSTRIP_RUNTIME_VERSION) {
235
237
  onInvalid?.(new Error('Invalid Landstrip runtime v2 registration'));
236
238
  return;
237
239
  }
238
- register(value.runtime);
240
+ register(value['runtime']);
239
241
  });
240
242
  const dispose = (): void => {
241
243
  if (disposed) return;
@@ -373,8 +375,8 @@ export function publishLandstripRuntime(
373
375
  if (!events) return () => undefined;
374
376
 
375
377
  const unsubscribe = events.on(RUNTIME_DISCOVER_EVENT, (value) => {
376
- if (!isRecord(value) || value.version !== LANDSTRIP_RUNTIME_VERSION) return;
377
- if (typeof value.register === 'function') value.register(runtime);
378
+ if (!isRecord(value) || value['version'] !== LANDSTRIP_RUNTIME_VERSION) return;
379
+ if (typeof value['register'] === 'function') value['register'](runtime);
378
380
  });
379
381
  try {
380
382
  events.emit(RUNTIME_REGISTER_EVENT, {
@@ -402,14 +404,14 @@ export function contextFromEnvironment(
402
404
  const value: unknown = JSON.parse(Buffer.from(encoded, 'base64url').toString('utf8'));
403
405
  if (
404
406
  !isRecord(value) ||
405
- value.version !== LANDSTRIP_RUNTIME_VERSION ||
406
- value.host !== 'pi' ||
407
- value.role !== 'subagent' ||
408
- typeof value.sandbox !== 'string' ||
409
- !['enabled', 'disabled', 'unavailable'].includes(value.sandbox) ||
410
- typeof value.cwd !== 'string' ||
411
- !Number.isInteger(value.depth) ||
412
- (value.depth as number) < 0 ||
407
+ value['version'] !== LANDSTRIP_RUNTIME_VERSION ||
408
+ value['host'] !== 'pi' ||
409
+ value['role'] !== 'subagent' ||
410
+ typeof value['sandbox'] !== 'string' ||
411
+ !['enabled', 'disabled', 'unavailable'].includes(value['sandbox']) ||
412
+ typeof value['cwd'] !== 'string' ||
413
+ !Number.isInteger(value['depth']) ||
414
+ (value['depth'] as number) < 0 ||
413
415
  ['sessionId', 'taskId', 'parentTaskId', 'agent'].some(
414
416
  (key) => value[key] !== undefined && typeof value[key] !== 'string',
415
417
  )
package/dist/index.ts CHANGED
@@ -80,10 +80,10 @@ function publishLandstripRuntime(pi, runtime) {
80
80
  return;
81
81
  };
82
82
  const unsubscribe = events.on(RUNTIME_DISCOVER_EVENT, (value) => {
83
- if (!isRecord(value) || value.version !== LANDSTRIP_RUNTIME_VERSION)
83
+ if (!isRecord(value) || value["version"] !== LANDSTRIP_RUNTIME_VERSION)
84
84
  return;
85
- if (typeof value.register === "function")
86
- value.register(runtime);
85
+ if (typeof value["register"] === "function")
86
+ value["register"](runtime);
87
87
  });
88
88
  try {
89
89
  events.emit(RUNTIME_REGISTER_EVENT, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-landstrip",
3
- "version": "0.19.14",
3
+ "version": "0.19.16",
4
4
  "description": "Sandboxed Bash and process-backed agents for Pi",
5
5
  "keywords": [
6
6
  "landstrip",
@@ -39,7 +39,7 @@
39
39
  "ci:test": "npm run test"
40
40
  },
41
41
  "dependencies": {
42
- "@landstrip/landstrip-api": "^0.19.14",
42
+ "@landstrip/landstrip-api": "^0.19.16",
43
43
  "jsonc-parser": "^3.3.1",
44
44
  "minimatch": "^10.2.5",
45
45
  "undici": "^8.9.0",