gestalt-mobile 0.59.0 → 0.60.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
@@ -623,11 +623,12 @@ when configuring GitHub, rotating credentials, or recovering a partial release.
623
623
 
624
624
  ## Host-owned test suites
625
625
 
626
- The optional `--test-runner-config` enables a supervisor API for tests that must
627
- run outside an agent's shell sandbox. See [host test runner](docs/host-tests.md)
628
- for explicit candidate authorization, start/status/cancel calls, evidence, and
629
- the execution boundary. It is disabled by default and does not change Serena
630
- or shell sandbox permissions.
626
+ The host test runner is enabled by default. Root supervisors configure suites at
627
+ runtime in the session workspace's `.gestalt/host-tests.json` and run them as the
628
+ host user, outside the agent shell sandbox, without fingerprint approval or a
629
+ restart. See [host test runner](docs/host-tests.md) for configuration, calls,
630
+ evidence and the execution boundary. Use `--disable-test-runner` to turn it off.
631
+ Serena's own sandbox checks remain in place.
631
632
 
632
633
  ## Copyright and license
633
634
 
@@ -29,7 +29,7 @@ Options:
29
29
  --disable-passkey-auth Disable passkey access control (unsafe on shared or network hosts)
30
30
  --data-dir <path> Directory for persistent application data
31
31
  --icon <path> SVG or PNG used as the installed PWA application icon
32
- --test-runner-config <path> Private operator configuration for host-owned test suites
32
+ --disable-test-runner Disable host tests (default: runtime .gestalt/host-tests.json suites)
33
33
  --xerj <mode> Source discovery: auto (default, index and watch), manual, off
34
34
  --skills <profile> Use a global skill profile for every session
35
35
  --skills list List saved global skill profiles without starting the server
@@ -289,7 +289,7 @@ export async function runCli(dependencies = {}) {
289
289
  root: config.root,
290
290
  xerj: config.xerj,
291
291
  dataDir: config.dataDir,
292
- testRunnerConfig: config.testRunnerConfig,
292
+ testRunnerEnabled: config.testRunnerEnabled,
293
293
  relyingParty: config.relyingParty,
294
294
  passkeyAuthEnabled: config.passkeyAuthEnabled,
295
295
  staticDir: packagedClientDir(moduleUrl),
@@ -388,6 +388,73 @@ async function createUnauthorizedProductionApp(root, dataDir) {
388
388
  }
389
389
  describe('production composition', () => {
390
390
  describeCompositionConcern('autopilot', () => {
391
+ it('does not park after a host test completes before process-wait registration', async () => {
392
+ let coordinator;
393
+ const f = await createProductionAutopilotFixture({
394
+ autopilotSchedule: () => () => { },
395
+ onAutopilotCoordinator: (value) => {
396
+ coordinator = value;
397
+ },
398
+ });
399
+ onTestFinished(() => f.app.close());
400
+ const exec = promisify(execFile);
401
+ await exec('git', ['init', '-q', f.workspacePath]);
402
+ await exec('git', [
403
+ '-c',
404
+ 'user.name=Fixture',
405
+ '-c',
406
+ 'user.email=fixture@example.invalid',
407
+ 'commit',
408
+ '--allow-empty',
409
+ '-qm',
410
+ 'fixture',
411
+ ], { cwd: f.workspacePath });
412
+ await mkdir(join(f.workspacePath, '.gestalt'), { recursive: true });
413
+ await writeFile(join(f.workspacePath, '.gestalt/host-tests.json'), JSON.stringify({
414
+ version: 1,
415
+ suites: [
416
+ {
417
+ id: 'fast',
418
+ repository: f.workspacePath,
419
+ command: process.execPath,
420
+ args: ['-e', 'process.exit(0)'],
421
+ timeoutMs: 5000,
422
+ maxOutputBytes: 4096,
423
+ },
424
+ ],
425
+ }));
426
+ const session = (await f.app.inject(`/api/sessions/${f.sessionId}`)).json();
427
+ const call = async (id, args) => {
428
+ const response = (await f.handles.find((handle) => handle.request).request({
429
+ id,
430
+ method: 'item/tool/call',
431
+ params: { threadId: session.threadId, tool: 'gestalt_test_runner', arguments: args },
432
+ }));
433
+ return JSON.parse(response.contentItems[0].text);
434
+ };
435
+ const run = await call(900, {
436
+ operation: 'start',
437
+ suite: 'fast',
438
+ requestId: '00000000-0000-4000-8000-000000000001',
439
+ });
440
+ expect(run.state).toBe('running');
441
+ const database = new DatabaseSync(join(f.dataDir, 'relay.sqlite'));
442
+ onTestFinished(() => database.close());
443
+ await vi.waitFor(() => expect(database
444
+ .prepare("SELECT COUNT(*) AS count FROM session_events WHERE session_id=? AND type='host-test.completed'")
445
+ .get(f.sessionId)?.count).toBe(1), { timeout: 5000 });
446
+ const report = {
447
+ id: 'focused-running',
448
+ leaseId: 'focused-wait',
449
+ wakeConditions: ['processResultAvailable'],
450
+ maxWaitMs: 600_000,
451
+ };
452
+ expect(coordinator.registerProactiveWait(f.sessionId, report)).toBe('wakeAlreadySatisfied');
453
+ expect(await call(901, { operation: 'status', runId: run.runId })).toMatchObject({
454
+ state: 'passed',
455
+ });
456
+ expect(coordinator.registerProactiveWait(f.sessionId, report)).toBe(true);
457
+ });
391
458
  const versionedText = (state = 'TODO', strict = false) => '#+MODEL_POLICY_VERSION: 1\n' +
392
459
  (strict ? '#+MODEL_POLICY_ASSURANCE: runtime-attested\n' : '') +
393
460
  autopilotPlanText(state).replace(':REVIEW_STATUS: UNREVIEWED', `:REVIEW_STATUS: UNREVIEWED
@@ -15,7 +15,7 @@ import { SqliteTransportDiagnostics } from './platform/persistence/sqlite-transp
15
15
  import { buildApp } from './app.js';
16
16
  import { ManagedUpgrade } from './platform/maintenance/managed-upgrade.js';
17
17
  import { LocalHostTestRunner } from './platform/host-tests/runner.js';
18
- import { loadHostTestConfig, within } from './platform/host-tests/config.js';
18
+ import { loadWorkspaceHostTestConfig, within } from './platform/host-tests/config.js';
19
19
  import { handleHostTestTool } from './features/host-tests/application/handle-tool.js';
20
20
  import { gestaltTestRunnerDynamicTool } from '../shared/contracts/host-tests.js';
21
21
  import { SelfDebugWorkspace } from './platform/self-debug/workspace.js';
@@ -113,9 +113,6 @@ export async function composeRelayApp(options) {
113
113
  if (ownerHandle && ownerHandle.length !== 32)
114
114
  throw new Error('Authorization randomness must return exactly 32 bytes');
115
115
  const root = resolve(options.root);
116
- const hostTestSuites = options.testRunnerConfig
117
- ? await loadHostTestConfig(options.testRunnerConfig, root)
118
- : undefined;
119
116
  let hostTests;
120
117
  const databasePath = options.dataDir
121
118
  ? join(resolve(options.dataDir), 'relay.sqlite')
@@ -266,6 +263,7 @@ export async function composeRelayApp(options) {
266
263
  },
267
264
  });
268
265
  const autopilot = new AutopilotCoordinator({
266
+ pendingProcessResult: (sessionId) => hostTests?.hasUnreadResult(sessionId) ?? false,
269
267
  modelPolicyStatus: (sessionId) => supervisedPlans.modelPolicyStatus(sessionId),
270
268
  store: autopilotStore,
271
269
  now: () => new Date().toISOString(),
@@ -1435,15 +1433,16 @@ export async function composeRelayApp(options) {
1435
1433
  }
1436
1434
  let app;
1437
1435
  try {
1438
- if (hostTestSuites) {
1439
- if (within(await realpath(root), await realpath(dirname(databasePath)))) {
1440
- throw new Error('Host test evidence must be outside the agent workspace; choose a private --data-dir');
1441
- }
1442
- hostTests = new LocalHostTestRunner(hostTestSuites, join(dirname(databasePath), 'host-test-runs'), (sessionId, runId, observedAt) => {
1436
+ if (options.testRunnerEnabled !== false) {
1437
+ hostTests = new LocalHostTestRunner(join(dirname(databasePath), 'host-test-runs'), (sessionId, runId, observedAt) => {
1443
1438
  if (!sessions.find(sessionId))
1444
1439
  return;
1445
1440
  events.publish(journal.append(sessionId, 'host-test.completed', { runId, observedAt }, observedAt));
1446
1441
  autopilot.rootProcessCompleted(sessionId, runId);
1442
+ }, async (workspace) => {
1443
+ if (!within(await realpath(root), await realpath(workspace)))
1444
+ throw new Error('Host test workspace is outside the configured root');
1445
+ return loadWorkspaceHostTestConfig(workspace);
1447
1446
  });
1448
1447
  await hostTests.initialize();
1449
1448
  }
@@ -17,9 +17,8 @@ const optionNames = new Set([
17
17
  '--skills',
18
18
  '--icon',
19
19
  '--xerj',
20
- '--test-runner-config',
21
20
  ]);
22
- const flagNames = new Set(['--disable-passkey-auth']);
21
+ const flagNames = new Set(['--disable-passkey-auth', '--disable-test-runner']);
23
22
  export function parseConfig(args, cwd = process.cwd()) {
24
23
  const values = new Map();
25
24
  const flags = new Set();
@@ -65,9 +64,7 @@ export function parseConfig(args, cwd = process.cwd()) {
65
64
  dataDir: values.get('--data-dir'),
66
65
  skillsProfile: values.get('--skills'),
67
66
  iconPath: values.has('--icon') ? resolveIconPath(cwd, values.get('--icon')) : undefined,
68
- testRunnerConfig: values.has('--test-runner-config')
69
- ? resolve(cwd, values.get('--test-runner-config'))
70
- : undefined,
67
+ testRunnerEnabled: !flags.has('--disable-test-runner'),
71
68
  };
72
69
  }
73
70
  function resolveIconPath(cwd, value) {
@@ -330,8 +330,10 @@ export class AutopilotCoordinator {
330
330
  const nextProtocol = reportProbe(protocol, report);
331
331
  if (nextProtocol === protocol)
332
332
  return false;
333
- if (nextProtocol.outcome === 'parked' && nextProtocol.waitLease)
333
+ if (nextProtocol.outcome === 'parked' && nextProtocol.waitLease) {
334
334
  this.parkedSubscriptions.set(sessionId, nextProtocol.waitLease.id);
335
+ this.activityEventKeys.set(sessionId, this.progressKey(sessionId, false));
336
+ }
335
337
  else
336
338
  this.parkedSubscriptions.delete(sessionId);
337
339
  const now = this.deps.now();
@@ -360,8 +362,10 @@ export class AutopilotCoordinator {
360
362
  report.maxWaitMs > AUTOPILOT_WAIT_MAX_MS)
361
363
  return false;
362
364
  const now = this.deps.now();
363
- if (this.executorWakeAlreadySatisfied(sessionId, state, report.wakeConditions)) {
364
- // The executor edge is already visible. Fence every pending automatic
365
+ const processWakeSatisfied = report.wakeConditions.some((condition) => ['processExited', 'processResultAvailable'].includes(condition)) && this.deps.pendingProcessResult?.(sessionId);
366
+ if (processWakeSatisfied ||
367
+ this.executorWakeAlreadySatisfied(sessionId, state, report.wakeConditions)) {
368
+ // The requested edge is already visible. Fence every pending automatic
365
369
  // callback before returning control to the still-active root; otherwise
366
370
  // a scheduled executor resume could race same-turn supervision.
367
371
  const cancelled = this.cancelScheduledControl(state, now);
@@ -389,6 +393,7 @@ export class AutopilotCoordinator {
389
393
  this.completionTimers.get(sessionId)?.();
390
394
  this.completionTimers.delete(sessionId);
391
395
  this.parkedSubscriptions.set(sessionId, report.leaseId);
396
+ this.activityEventKeys.set(sessionId, this.progressKey(sessionId, false));
392
397
  this.persist({
393
398
  ...state,
394
399
  state: 'monitoring',
@@ -1437,7 +1442,9 @@ export class AutopilotCoordinator {
1437
1442
  // Reuse the canonical semantic projection: child order, timestamps, and
1438
1443
  // activity prose cannot manufacture an extra wake, while a child-only
1439
1444
  // lifecycle transition remains visible with an unchanged root.
1440
- const eventKey = this.progressKey(sessionId);
1445
+ // The root finishing the turn that registered a lease is not a new work event.
1446
+ // Keep child transitions observable without letting the waiter wake itself.
1447
+ const eventKey = this.progressKey(sessionId, prior.supervision?.outcome !== 'parked');
1441
1448
  if (this.activityEventKeys.get(sessionId) === eventKey)
1442
1449
  return;
1443
1450
  this.activityEventKeys.set(sessionId, eventKey);
@@ -3169,12 +3176,12 @@ export class AutopilotCoordinator {
3169
3176
  policy: this.deps.policy,
3170
3177
  });
3171
3178
  }
3172
- progressKey(sessionId) {
3179
+ progressKey(sessionId, includeRootActivity = true) {
3173
3180
  const retained = this.deps.plan(sessionId);
3174
3181
  const state = this.deps.store.find(sessionId);
3175
- return this.progressKeyFor(sessionId, state, retained);
3182
+ return this.progressKeyFor(sessionId, state, retained, includeRootActivity);
3176
3183
  }
3177
- progressKeyFor(sessionId, state, retained) {
3184
+ progressKeyFor(sessionId, state, retained, includeRootActivity = true) {
3178
3185
  const activity = this.deps.activity(sessionId);
3179
3186
  const interactions = this.deps.pendingInteraction(sessionId)
3180
3187
  ? [{ id: 'pending', kind: 'session', state: 'pending' }]
@@ -3215,7 +3222,7 @@ export class AutopilotCoordinator {
3215
3222
  })),
3216
3223
  })),
3217
3224
  agentActivity: [
3218
- ...(activity
3225
+ ...(activity && includeRootActivity
3219
3226
  ? [
3220
3227
  {
3221
3228
  agentId: 'root',
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: AGPL-3.0-or-later
5
5
  */
6
6
  import { lstat, readFile, realpath } from 'node:fs/promises';
7
- import { isAbsolute, relative, sep } from 'node:path';
7
+ import { isAbsolute, join, relative, sep } from 'node:path';
8
8
  import { z } from 'zod';
9
9
  const suiteSchema = z
10
10
  .object({
@@ -12,10 +12,6 @@ const suiteSchema = z
12
12
  repository: z.string().min(1),
13
13
  command: z.string().min(1),
14
14
  args: z.array(z.string().max(4096)).max(64),
15
- candidate: z
16
- .string()
17
- .regex(/^[a-f0-9]{64}$/)
18
- .nullable(),
19
15
  timeoutMs: z.number().int().min(100).max(3_600_000),
20
16
  maxOutputBytes: z.number().int().min(1024).max(16_777_216),
21
17
  })
@@ -27,22 +23,29 @@ export function within(root, target) {
27
23
  const path = relative(root, target);
28
24
  return path === '' || (!isAbsolute(path) && path !== '..' && !path.startsWith('..' + sep));
29
25
  }
30
- /** Operator file, outside the workspace, loaded once. Repository files cannot grant host authority. */
31
- export async function loadHostTestConfig(path, workspaceRoot) {
26
+ /** Reload agent-editable workspace suites on demand. Absence permits later creation. */
27
+ export async function loadWorkspaceHostTestConfig(workspaceRoot) {
32
28
  const root = await realpath(workspaceRoot);
29
+ const path = join(root, '.gestalt', 'host-tests.json');
30
+ let info;
31
+ try {
32
+ info = await lstat(path);
33
+ }
34
+ catch (error) {
35
+ if (error.code === 'ENOENT')
36
+ return [];
37
+ throw error;
38
+ }
33
39
  const canonical = await realpath(path);
34
- const info = await lstat(path);
35
- if (within(root, canonical) ||
36
- info.isSymbolicLink() ||
37
- !info.isFile() ||
38
- info.size > 65536 ||
39
- (info.mode & 0o077) !== 0 ||
40
- info.uid !== process.getuid?.()) {
41
- throw new Error('Host test configuration must be a private user-owned file outside the workspace');
40
+ if (!within(root, canonical) || info.isSymbolicLink() || !info.isFile() || info.size > 65536) {
41
+ throw new Error('Host test configuration must be a bounded regular file within the workspace');
42
42
  }
43
43
  const config = configSchema.parse(JSON.parse(await readFile(canonical, 'utf8')));
44
+ return validateSuites(config.suites, root);
45
+ }
46
+ async function validateSuites(suites, root) {
44
47
  const names = new Set();
45
- for (const suite of config.suites) {
48
+ for (const suite of suites) {
46
49
  if (names.has(suite.id) || !isAbsolute(suite.repository) || !isAbsolute(suite.command)) {
47
50
  throw new Error('Host test suites require unique names and absolute repository/command paths');
48
51
  }
@@ -54,5 +57,5 @@ export async function loadHostTestConfig(path, workspaceRoot) {
54
57
  if (!executable.isFile() && !executable.isSymbolicLink())
55
58
  throw new Error('Invalid host test executable');
56
59
  }
57
- return config.suites;
60
+ return suites;
58
61
  }
@@ -9,7 +9,7 @@ import { closeSync, openSync, writeSync } from 'node:fs';
9
9
  import { lstat, mkdir, readFile, readdir, realpath, rename, writeFile } from 'node:fs/promises';
10
10
  import { join } from 'node:path';
11
11
  import { candidate } from './candidate.js';
12
- import { within } from './config.js';
12
+ import { loadWorkspaceHostTestConfig, within } from './config.js';
13
13
  // The host owns a lifetime pipe; even a host crash closes it. Tests cannot inherit
14
14
  // that pipe or the IPC channel. The guardian reaps its own group, never a stored PID.
15
15
  const guardian = `
@@ -24,21 +24,22 @@ const child=spawn(command,JSON.parse(args),{cwd,env:process.env,stdio:['ignore',
24
24
  child.once('error',()=>{if(process.connected)process.send({exitCode:127,signal:null});stop()});
25
25
  child.once('exit',(exitCode,signal)=>{if(process.connected)process.send({exitCode,signal});stop()});
26
26
  `;
27
- /** One host-owned runner per relay. All suites are immutable operator configuration. */
27
+ /** One host-owned runner per relay. Each run retains its resolved configuration. */
28
28
  export class LocalHostTestRunner {
29
- suites;
30
29
  evidenceRoot;
31
30
  completed;
31
+ workspaceSuites;
32
32
  results = new Map();
33
33
  active = new Map();
34
34
  reservations = new Set();
35
35
  requests = new Map();
36
+ resultReads = new Map();
36
37
  sessionGenerations = new Map();
37
38
  closing = false;
38
- constructor(suites, evidenceRoot, completed = () => { }) {
39
- this.suites = suites;
39
+ constructor(evidenceRoot, completed = () => { }, workspaceSuites = loadWorkspaceHostTestConfig) {
40
40
  this.evidenceRoot = evidenceRoot;
41
41
  this.completed = completed;
42
+ this.workspaceSuites = workspaceSuites;
42
43
  }
43
44
  async initialize() {
44
45
  if (process.platform !== 'linux' && process.platform !== 'darwin')
@@ -108,15 +109,26 @@ export class LocalHostTestRunner {
108
109
  return { error: 'runNotFound' };
109
110
  if (input.operation === 'cancel')
110
111
  this.active.get(result.runId)?.stop('cancelled');
111
- return structuredClone(result);
112
+ return this.readResult(result);
113
+ }
114
+ if (input.operation === 'start') {
115
+ const previous = [...this.results.values()].find((result) => result.sessionId === owner.sessionId && result.requestId === input.requestId);
116
+ if (previous) {
117
+ return previous.suite === input.suite
118
+ ? this.readResult(previous)
119
+ : { error: 'requestIdConflict' };
120
+ }
112
121
  }
113
122
  const workspace = await realpath(owner.workspace);
114
- const available = this.suites.filter((suite) => within(workspace, suite.repository));
123
+ if (within(workspace, await realpath(this.evidenceRoot)))
124
+ return { error: 'evidenceInsideWorkspace' };
125
+ const suites = await this.workspaceSuites(workspace);
126
+ const available = suites.filter((suite) => within(workspace, suite.repository));
115
127
  if (input.operation === 'list')
116
128
  return {
117
129
  suites: available.map((suite) => ({
118
130
  id: suite.id,
119
- authorizedCandidate: suite.candidate,
131
+ repository: suite.repository,
120
132
  timeoutMs: suite.timeoutMs,
121
133
  })),
122
134
  };
@@ -129,23 +141,16 @@ export class LocalHostTestRunner {
129
141
  const current = await candidate(suite.repository);
130
142
  return {
131
143
  suite: suite.id,
144
+ repository: suite.repository,
132
145
  candidate: current,
133
- authorized: suite.candidate === current,
134
146
  fingerprintScope: 'Git-visible files, modes, index, HEAD and branch; excludes ignored dependencies and host toolchains',
135
147
  };
136
148
  }
137
- const previous = [...this.results.values()].find((result) => result.sessionId === owner.sessionId && result.requestId === input.requestId);
138
- if (previous)
139
- return previous.suite === suite.id && previous.candidate === input.candidate
140
- ? structuredClone(previous)
141
- : { error: 'requestIdConflict' };
142
- return this.start(owner, suite, input.candidate, input.requestId, generation);
149
+ return this.start(owner, suite, input.requestId, generation);
143
150
  }
144
- async start(owner, suite, expected, requestId, generation) {
151
+ async start(owner, suite, requestId, generation) {
145
152
  if (this.closing)
146
153
  return { error: 'hostShuttingDown' };
147
- if (suite.candidate !== expected)
148
- return { error: 'candidateNotAuthorized' };
149
154
  if (this.results.size >= 1000)
150
155
  return { error: 'evidenceCapacityReached' };
151
156
  if (this.reservations.has(suite.repository))
@@ -154,8 +159,7 @@ export class LocalHostTestRunner {
154
159
  return { error: 'hostRunnerBusy' };
155
160
  this.reservations.add(suite.repository);
156
161
  try {
157
- if ((await candidate(suite.repository)) !== expected)
158
- return { error: 'candidateChanged' };
162
+ const current = await candidate(suite.repository);
159
163
  if (this.closing)
160
164
  return { error: 'hostShuttingDown' };
161
165
  const runId = randomUUID();
@@ -168,7 +172,7 @@ export class LocalHostTestRunner {
168
172
  requestId,
169
173
  sessionId: owner.sessionId,
170
174
  suite: suite.id,
171
- candidate: expected,
175
+ candidate: current,
172
176
  finalCandidate: null,
173
177
  state: 'running',
174
178
  startedAt: now,
@@ -190,7 +194,7 @@ export class LocalHostTestRunner {
190
194
  timeoutMs: suite.timeoutMs,
191
195
  maxOutputBytes: suite.maxOutputBytes,
192
196
  fingerprintVersion: 1,
193
- candidate: expected,
197
+ candidate: current,
194
198
  nodeVersion: process.version,
195
199
  platform: process.platform,
196
200
  arch: process.arch,
@@ -212,7 +216,7 @@ export class LocalHostTestRunner {
212
216
  return structuredClone(result);
213
217
  }
214
218
  finally {
215
- if (![...this.active.values()].some((run) => run.result.suite === suite.id))
219
+ if (![...this.active.values()].some((run) => run.repository === suite.repository))
216
220
  this.reservations.delete(suite.repository);
217
221
  }
218
222
  }
@@ -250,7 +254,7 @@ export class LocalHostTestRunner {
250
254
  reason ??= state;
251
255
  child.stdin?.end();
252
256
  };
253
- this.active.set(result.runId, { result, stop, done });
257
+ this.active.set(result.runId, { result, repository: suite.repository, stop, done });
254
258
  const timeout = setTimeout(() => stop('timedOut'), suite.timeoutMs);
255
259
  let summary = '';
256
260
  child.stdin?.on('error', () => { });
@@ -326,6 +330,31 @@ export class LocalHostTestRunner {
326
330
  })();
327
331
  });
328
332
  }
333
+ /** Completed evidence is a level-triggered wake until its owning supervisor reads it. */
334
+ hasUnreadResult(sessionId) {
335
+ return [...this.results.values()].some((result) => result.sessionId === sessionId && result.state !== 'running' && !result.resultReadAt);
336
+ }
337
+ async readResult(result) {
338
+ const pending = this.resultReads.get(result.runId);
339
+ if (pending)
340
+ return structuredClone(await pending);
341
+ const snapshot = structuredClone(result);
342
+ if (snapshot.state !== 'running' && !snapshot.resultReadAt) {
343
+ snapshot.resultReadAt = new Date().toISOString();
344
+ const read = this.persist(snapshot).then(() => {
345
+ this.results.set(snapshot.runId, snapshot);
346
+ return snapshot;
347
+ });
348
+ this.resultReads.set(snapshot.runId, read);
349
+ try {
350
+ return structuredClone(await read);
351
+ }
352
+ finally {
353
+ this.resultReads.delete(snapshot.runId);
354
+ }
355
+ }
356
+ return snapshot;
357
+ }
329
358
  async persist(result) {
330
359
  const temporary = result.resultPath + '.tmp';
331
360
  await writeFile(temporary, JSON.stringify(result) + '\n', { mode: 0o600 });
@@ -13,7 +13,6 @@ export const hostTestRequest = z.discriminatedUnion('operation', [
13
13
  .object({
14
14
  operation: z.literal('start'),
15
15
  suite,
16
- candidate: z.string().regex(/^[a-f0-9]{64}$/),
17
16
  requestId: runId,
18
17
  })
19
18
  .strict(),
@@ -23,14 +22,13 @@ export const hostTestRequest = z.discriminatedUnion('operation', [
23
22
  export const gestaltTestRunnerDynamicTool = {
24
23
  type: 'function',
25
24
  name: 'gestalt_test_runner',
26
- description: 'Run host-configured test suites outside the agent shell sandbox. Root supervisor only. Disabled unless the operator configures a suite and approves its exact Git-visible candidate digest. list/inspect do not execute code. start uses an idempotent requestId; status/cancel require the returned runId. Never accepts commands, environment, or paths. Results include UTC observations and private evidence paths; counts can be unknown. Does not approve milestones or resume Autopilot.',
25
+ description: 'Run workspace test suites outside the agent shell sandbox as the host user. Enabled by default; root supervisor only. Create or edit .gestalt/host-tests.json in the session workspace using normal file tools; suites reload at runtime without restart or fingerprint approval. list/inspect do not execute code. start requires suite and an idempotent requestId; status/cancel require runId. Tool arguments never accept commands, environment, or paths. Results retain automatic source fingerprints, UTC observations and private evidence; counts can be unknown. Keep the writer idle during tests. Does not approve milestones or resume Autopilot.',
27
26
  inputSchema: {
28
27
  type: 'object',
29
28
  additionalProperties: false,
30
29
  properties: {
31
30
  operation: { type: 'string', enum: ['list', 'inspect', 'start', 'status', 'cancel'] },
32
31
  suite: { type: 'string' },
33
- candidate: { type: 'string' },
34
32
  requestId: { type: 'string' },
35
33
  runId: { type: 'string' },
36
34
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.59.0",
3
+ "version": "0.60.1",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",