@ai-sdk/harness-acp 1.0.59 → 1.0.61

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/dist/index.js CHANGED
@@ -5,11 +5,12 @@ import {
5
5
  import { z as z4 } from "zod/v4";
6
6
 
7
7
  // src/v1/acp-v1-harness.ts
8
- import { createHash as createHash5 } from "crypto";
8
+ import { createHash as createHash4 } from "crypto";
9
9
  import { posix } from "path";
10
10
  import {
11
11
  HarnessCapabilityUnsupportedError as HarnessCapabilityUnsupportedError2,
12
- harnessV1DiagnosticFromBridgeFrame
12
+ harnessV1DiagnosticFromBridgeFrame,
13
+ harnessStateDirectoryPath
13
14
  } from "@ai-sdk/harness";
14
15
  import { HarnessBridgeCapabilityUnsupportedError } from "@ai-sdk/harness/bridge";
15
16
  import {
@@ -23,7 +24,6 @@ import {
23
24
  forwardBridgeProcessStream,
24
25
  getRestrictedSandboxSession,
25
26
  markBridgeStarting,
26
- resolveSandboxDefaultWorkingDirectory,
27
27
  resolveSandboxHomeDir,
28
28
  SandboxChannel,
29
29
  shellQuote,
@@ -243,8 +243,8 @@ function validateACPV1Implementation(implementation) {
243
243
  validateForwardEnvironment({ forwardEnv: implementation.forwardEnv });
244
244
  validateForwardEnvironment({ forwardEnv: implementation.credentialEnv });
245
245
  validateEnvironment({ env: implementation.env });
246
- const forwardedKeys = new Set(implementation.forwardEnv ?? []);
247
- const credentialKeys = new Set(implementation.credentialEnv ?? []);
246
+ const forwardedKeys = new Set(implementation.forwardEnv);
247
+ const credentialKeys = new Set(implementation.credentialEnv);
248
248
  for (const key of credentialKeys) {
249
249
  if (forwardedKeys.has(key)) {
250
250
  throw new Error(
@@ -337,11 +337,9 @@ function createImplementationIdentity({
337
337
  type: source.type,
338
338
  command: source.command
339
339
  };
340
- const forwardedEnvironment = [
341
- ...new Set(implementation.forwardEnv ?? [])
342
- ].sort();
340
+ const forwardedEnvironment = [...new Set(implementation.forwardEnv)].sort();
343
341
  const credentialEnvironment = [
344
- ...new Set(implementation.credentialEnv ?? [])
342
+ ...new Set(implementation.credentialEnv)
345
343
  ].sort();
346
344
  const literalEnvironment = Object.fromEntries(
347
345
  Object.entries(implementation.env ?? {}).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [key, { value }])
@@ -1099,23 +1097,17 @@ function validateACPLifecycleCompatibility({
1099
1097
  }
1100
1098
 
1101
1099
  // src/v1/acp-v1-skills.ts
1102
- import { createHash as createHash4 } from "crypto";
1103
1100
  import path from "path";
1101
+ import {
1102
+ harnessSessionDataDirectoryPath
1103
+ } from "@ai-sdk/harness";
1104
1104
  var ACP_SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
1105
1105
  var DEFAULT_ACP_SKILLS_DIRECTORY = ".agents/skills";
1106
1106
  function resolveACPPrivateSessionDirectory({
1107
- sandboxHomeDir,
1108
- harnessId,
1107
+ stateDirectory,
1109
1108
  sessionId
1110
1109
  }) {
1111
- const sessionKey = createHash4("sha256").update(sessionId).digest("hex");
1112
- return path.posix.join(
1113
- sandboxHomeDir,
1114
- ".ai-sdk",
1115
- "harness-acp",
1116
- harnessId,
1117
- sessionKey
1118
- );
1110
+ return harnessSessionDataDirectoryPath({ stateDirectory, sessionId });
1119
1111
  }
1120
1112
  function resolveACPSkillsDirectory({
1121
1113
  implementationHomeDir,
@@ -1293,10 +1285,6 @@ function createACPV1({
1293
1285
  message: `The ${settings.harnessId} ACP harness cannot use \`mintBridgeToken\` with a sandbox session that does not expose an id.`
1294
1286
  });
1295
1287
  }
1296
- const defaultWorkingDirectory = await resolveSandboxDefaultWorkingDirectory({
1297
- sandboxSession,
1298
- abortSignal: startOptions.abortSignal
1299
- });
1300
1288
  const continueFrom = startOptions.continueFrom ?? startOptions.resumeFrom?.continueFrom;
1301
1289
  const lifecycleState = continueFrom ?? startOptions.resumeFrom;
1302
1290
  const isContinue = continueFrom != null;
@@ -1383,19 +1371,19 @@ function createACPV1({
1383
1371
  )
1384
1372
  );
1385
1373
  }
1374
+ const sandboxHomeDir = await resolveSandboxHomeDir({
1375
+ sandbox: toolSafeSandboxSession,
1376
+ abortSignal: startOptions.abortSignal
1377
+ });
1378
+ const stateDirectory = harnessStateDirectoryPath({ sandboxHomeDir });
1386
1379
  const resolvedBridgeDir = posix.resolve(
1387
- defaultWorkingDirectory,
1380
+ stateDirectory,
1388
1381
  bootstrap.bootstrapDir
1389
1382
  );
1390
1383
  const resolvedImplementationDir = `${resolvedBridgeDir}/implementation`;
1391
1384
  const workDir = startOptions.sessionWorkDir;
1392
- const sandboxHomeDir = await resolveSandboxHomeDir({
1393
- sandbox: toolSafeSandboxSession,
1394
- abortSignal: startOptions.abortSignal
1395
- });
1396
1385
  const privateSessionDir = resolveACPPrivateSessionDirectory({
1397
- sandboxHomeDir,
1398
- harnessId: settings.harnessId,
1386
+ stateDirectory,
1399
1387
  sessionId: startOptions.sessionId
1400
1388
  });
1401
1389
  const implementationHomeDir = implementation.source.type === "install-command" ? `${resolvedImplementationDir}/home` : sandboxHomeDir;
@@ -2747,7 +2735,7 @@ function withNativeQuestionRequest({
2747
2735
  providerMetadata: {
2748
2736
  ...toolCall.providerMetadata,
2749
2737
  [harnessId]: {
2750
- ...harnessMetadata ?? {},
2738
+ ...harnessMetadata,
2751
2739
  nativeRequest
2752
2740
  }
2753
2741
  }
@@ -2773,7 +2761,6 @@ function takeBufferedQuestionResult({
2773
2761
  return buffered;
2774
2762
  }
2775
2763
  }
2776
- return void 0;
2777
2764
  }
2778
2765
  function isPermissionModeMappingValue({
2779
2766
  value
@@ -2893,7 +2880,7 @@ function assertRecoveryToolCatalog({
2893
2880
  }
2894
2881
  }
2895
2882
  function fingerprintValue({ value }) {
2896
- return createHash5("sha256").update(JSON.stringify(value)).digest("hex");
2883
+ return createHash4("sha256").update(JSON.stringify(value)).digest("hex");
2897
2884
  }
2898
2885
  function isRecord2(value) {
2899
2886
  return value != null && typeof value === "object" && !Array.isArray(value);
@@ -2920,7 +2907,7 @@ function deserializeBridgeError({
2920
2907
  }
2921
2908
 
2922
2909
  // src/version.ts
2923
- var VERSION = true ? "1.0.59" : "0.0.0-test";
2910
+ var VERSION = true ? "1.0.61" : "0.0.0-test";
2924
2911
 
2925
2912
  // src/acp-harness.ts
2926
2913
  var ACP_CLIENT_APP = {