@ai-sdk/harness-codex 1.0.123 → 1.0.125

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.
@@ -19,6 +19,8 @@ import {
19
19
  type HarnessV1Session,
20
20
  type HarnessV1Skill,
21
21
  type HarnessV1StreamPart,
22
+ harnessStateDirectoryPath,
23
+ harnessSessionDataDirectoryPath,
22
24
  } from '@ai-sdk/harness';
23
25
  import {
24
26
  applyCredentialForwarding,
@@ -31,7 +33,6 @@ import {
31
33
  forwardBridgeProcessStream,
32
34
  getRestrictedSandboxSession,
33
35
  markBridgeStarting,
34
- resolveSandboxDefaultWorkingDirectory,
35
36
  resolveSandboxHomeDir,
36
37
  SandboxChannel,
37
38
  shellQuote,
@@ -244,11 +245,6 @@ export function createCodex(
244
245
  'The codex harness cannot use `mintBridgeToken` with a sandbox session that does not expose an id.',
245
246
  });
246
247
  }
247
- const defaultWorkingDirectory =
248
- await resolveSandboxDefaultWorkingDirectory({
249
- sandboxSession,
250
- abortSignal: startOpts.abortSignal,
251
- });
252
248
  const lifecycleState = startOpts.continueFrom ?? startOpts.resumeFrom;
253
249
  const isResume = lifecycleState != null;
254
250
  const isContinue = startOpts.continueFrom != null;
@@ -324,17 +320,21 @@ export function createCodex(
324
320
  sandboxAuthEnvironment.OPENAI_BASE_URL = DEFAULT_OPENAI_BASE_URL;
325
321
  }
326
322
  }
327
- const bootstrapDir = path.posix.resolve(
328
- defaultWorkingDirectory,
329
- BOOTSTRAP_DIR,
330
- );
331
-
332
- const workDir = startOpts.sessionWorkDir;
323
+ // Harness SDK state (bootstrap, per-session runs) always lives under
324
+ // the sandbox's own HOME, never the working directory, so it stays
325
+ // out of a user-owned workspace.
333
326
  const sandboxHomeDir = await resolveSandboxHomeDir({
334
327
  sandbox: toolSafeSandboxSession,
335
328
  abortSignal: startOpts.abortSignal,
336
329
  });
337
- const sessionDataDir = `${defaultWorkingDirectory}/.agent-runs/${startOpts.sessionId}`;
330
+ const stateDir = harnessStateDirectoryPath({ sandboxHomeDir });
331
+ const bootstrapDir = path.posix.resolve(stateDir, BOOTSTRAP_DIR);
332
+
333
+ const workDir = startOpts.sessionWorkDir;
334
+ const sessionDataDir = harnessSessionDataDirectoryPath({
335
+ stateDirectory: stateDir,
336
+ sessionId: startOpts.sessionId,
337
+ });
338
338
  const bridgeStateDir = `${sessionDataDir}/bridge`;
339
339
  const cliShimDir = `${sessionDataDir}/codex`;
340
340
  const cliShimPath = `${cliShimDir}/${CLI_SHIM_FILENAME}`;
@@ -265,7 +265,6 @@ async function readCodexAuthCredentialsStoreMode({
265
265
  return toCodexAuthCredentialsStoreMode(match[1]);
266
266
  }
267
267
  }
268
- return undefined;
269
268
  }
270
269
 
271
270
  function toCodexAuthCredentialsStoreMode(
@@ -394,7 +393,6 @@ function createCodexKeyring({
394
393
  if (isWindows(platform)) {
395
394
  return createWindowsCodexKeyring();
396
395
  }
397
- return undefined;
398
396
  }
399
397
 
400
398
  function shellQuoteForSecurity(value: string): string {