gestalt-mobile 0.68.1 → 0.68.3

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.
@@ -149,7 +149,15 @@ export class CodexPlaywright {
149
149
  : binding.reason
150
150
  ? 'unavailable'
151
151
  : 'idle',
152
- ...(pending ? { boundary: 'owned-runtime-resume' } : {}),
152
+ ...(pending
153
+ ? {
154
+ boundary: 'owned-runtime-resume',
155
+ nextAction: 'next-root-turn',
156
+ message: desired
157
+ ? 'Activation cannot complete during this turn. Keep the start request pending, finish independent work, then end the turn. Mobile will apply it before the next authorized root turn when the root and children are idle. If no continuation is already authorized, explain that the user can send a follow-up message. Do not poll or stop the request while browser work remains.'
158
+ : 'Release will complete before the next authorized root turn when the root and children are idle. End this turn after independent work; polling during this turn cannot detach the browser.',
159
+ }
160
+ : {}),
153
161
  ...(binding.reason ? { reason: binding.reason } : {}),
154
162
  ...(binding.version ? { packageVersion: binding.version } : {}),
155
163
  packageStatus: binding.packageStatus,
@@ -356,7 +364,7 @@ export class CodexPlaywright {
356
364
  },
357
365
  };
358
366
  if (instructions !== undefined)
359
- config.developer_instructions = withCapabilityInstructions(instructions, 'playwright', '<gestalt_playwright_unavailable>Browser guidance is inactive until this host verifies connected standard tools. Use gestalt_managed_playwright for session-scoped requests. Installation or a plan declaration never grants consent. Pending activation requires a safe owned-runtime resume.</gestalt_playwright_unavailable>');
367
+ config.developer_instructions = withCapabilityInstructions(instructions, 'playwright', '<gestalt_playwright_unavailable>Browser guidance is inactive until this host verifies connected standard tools. Use gestalt_managed_playwright for session-scoped requests. Installation or a plan declaration never grants consent. Pending activation cannot complete within the requesting turn: keep the request pending, finish independent work and end the turn. Mobile applies it before the next already-authorized root turn at a safe idle boundary. If none is authorized, explain that the user can send a follow-up message. Do not poll or stop while browser work remains; no manual session restart is required.</gestalt_playwright_unavailable>');
360
368
  else
361
369
  delete config.developer_instructions;
362
370
  return config;
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: AGPL-3.0-or-later
5
5
  */
6
6
  import { randomUUID } from 'node:crypto';
7
- import { lstat, mkdir, opendir, readdir, realpath, rename, rm, rmdir } from 'node:fs/promises';
7
+ import { lstat, mkdir, readdir, realpath, rename, rm, rmdir } from 'node:fs/promises';
8
8
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
9
9
  import { emptyScratchCounts, } from '../../features/sessions/clean-tmp/use-case.js';
10
10
  import { mobileScratchOwnerId, privateDirectory, scratchMarkerName } from './scratch-filesystem.js';
@@ -15,6 +15,10 @@ import { claimScratchContainment, containmentFenceName } from './containment-fen
15
15
  function reject(reason) {
16
16
  throw new Error(`SCRATCH_CLEANUP_${reason}`);
17
17
  }
18
+ /** POSIX payload names need not be UTF-8. Keep their bytes for filesystem calls. */
19
+ function payloadPath(directory, name) {
20
+ return Buffer.concat([Buffer.from(directory), Buffer.from(sep), name]);
21
+ }
18
22
  /** Only the managed namespace is traversed. There are no prefix/age/PID legacy recognizers. */
19
23
  export class FilesystemScratchCleanup {
20
24
  async cleanSession(session, authorized, protectedSessions) {
@@ -121,10 +125,10 @@ export class FilesystemScratchCleanup {
121
125
  await this.assertProtection(directory, join(container, ownerId), marker, protectedSessions, authorized);
122
126
  // Keep authority metadata until disposable payload has been removed. A failed
123
127
  // payload deletion is retryable; an interrupted metadata retirement is unknown.
124
- for (const child of await readdir(directory)) {
125
- if ([scratchMarkerName, 'leases', '.controller-lock', containmentFenceName].includes(child))
128
+ for (const child of await readdir(directory, { encoding: 'buffer' })) {
129
+ if ([scratchMarkerName, 'leases', '.controller-lock', containmentFenceName].includes(child.toString()))
126
130
  continue;
127
- await rm(join(directory, child), { recursive: true });
131
+ await rm(payloadPath(directory, child), { recursive: true });
128
132
  }
129
133
  if ((await readdir(directory)).includes('leases'))
130
134
  await rm(join(directory, 'leases'), { recursive: true });
@@ -234,17 +238,17 @@ export class FilesystemScratchCleanup {
234
238
  // Even an empty nested namespace is not authority to retire a workspace's
235
239
  // contents recursively as another owner's payload.
236
240
  if (directory !== root &&
237
- basename(directory) === 'sessions' &&
238
- basename(dirname(directory)) === 'tmp')
241
+ basename(directory.toString()) === 'sessions' &&
242
+ basename(dirname(directory.toString())) === 'tmp')
239
243
  reject('unrecognized');
240
- for await (const entry of await opendir(directory)) {
244
+ for (const entry of await readdir(directory, { encoding: 'buffer', withFileTypes: true })) {
241
245
  const child = entry.name;
242
246
  if (++budget.entries > 100_000)
243
247
  reject('unrecognized');
244
248
  if (directory !== root &&
245
- [scratchMarkerName, '.controller-lock', '.association-lock', containmentFenceName].includes(child))
249
+ [scratchMarkerName, '.controller-lock', '.association-lock', containmentFenceName].includes(child.toString()))
246
250
  reject('unrecognized');
247
- const path = join(directory, child);
251
+ const path = payloadPath(directory, child);
248
252
  const info = await lstat(path);
249
253
  if ((process.getuid && info.uid !== process.getuid()) ||
250
254
  (!info.isDirectory() && !info.isFile() && !info.isSymbolicLink()) ||
@@ -14,7 +14,7 @@ export const managedPlaywrightRequestSchema = z
14
14
  export const gestaltManagedPlaywrightDynamicTool = {
15
15
  type: 'function',
16
16
  name: 'gestalt_managed_playwright',
17
- description: 'Request, inspect or release managed browser access for this root session. Profile consent is required. Start/stop may remain pending until a safe owned-runtime resume; tools and browser guidance are usable only after connected verification. Never starts a turn or clears Manual Off or attention. No commands, paths or environment accepted.',
17
+ description: 'Request, inspect or release managed browser access for this root session. Profile consent is required. Pending start/stop cannot complete within this turn: finish independent work and end the turn; Mobile applies the request before the next authorized root turn at a safe idle boundary. Keep a pending start while browser work remains. No manual restart is required. Tools and guidance require connected verification. Never starts a turn or clears Manual Off or attention. No commands, paths or environment accepted.',
18
18
  inputSchema: {
19
19
  type: 'object',
20
20
  additionalProperties: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.68.1",
3
+ "version": "0.68.3",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",