@ai-sdk/harness-opencode 1.0.179 → 1.0.182

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/harness-opencode",
3
- "version": "1.0.179",
3
+ "version": "1.0.182",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -26,17 +26,17 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@ai-sdk/harness": "1.0.176",
29
+ "@ai-sdk/harness": "1.0.179",
30
30
  "@ai-sdk/provider": "4.0.37",
31
- "@ai-sdk/provider-utils": "5.0.76",
31
+ "@ai-sdk/provider-utils": "5.0.78",
32
32
  "ws": "8.21.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "zod": "^3.25.76 || ^4.1.8"
36
36
  },
37
37
  "devDependencies": {
38
- "@modelcontextprotocol/sdk": "1.32.1",
39
- "@opencode-ai/sdk": "1.18.34",
38
+ "@modelcontextprotocol/sdk": "1.32.2",
39
+ "@opencode-ai/sdk": "1.19.5",
40
40
  "@types/node": "22.19.19",
41
41
  "@types/ws": "^8.5.13",
42
42
  "@vercel/ai-tsconfig": "0.0.0",
@@ -4,10 +4,10 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@modelcontextprotocol/sdk": "1.32.1",
8
- "@opencode-ai/sdk": "1.18.34",
7
+ "@modelcontextprotocol/sdk": "1.32.2",
8
+ "@opencode-ai/sdk": "1.19.5",
9
9
  "@vscode/ripgrep": "1.18.0",
10
- "opencode-ai": "1.18.34",
10
+ "opencode-ai": "1.19.5",
11
11
  "ws": "8.21.0",
12
12
  "zod": "3.25.76"
13
13
  }
@@ -28,7 +28,8 @@ import {
28
28
  applyCredentialForwarding,
29
29
  classifyDiskLog,
30
30
  resolveSandboxCredentialEnvironment,
31
- createBridgeToken,
31
+ BRIDGE_AUTH_PUBLIC_KEY_ENV,
32
+ createBridgeAuthKeyPair,
32
33
  createBridgeWebSocketConnect,
33
34
  experimental_createBridgeUserMessageSubmitter,
34
35
  createBridgeErrorHandler,
@@ -45,6 +46,7 @@ import {
45
46
  shellQuote,
46
47
  validateBridgeSandboxSettings,
47
48
  warnCredentialBrokeringUnavailable,
49
+ warnMintBridgeTokenIgnored,
48
50
  waitForBridgeReady,
49
51
  writeSkills,
50
52
  type SandboxChannelReconnectOptions,
@@ -138,9 +140,10 @@ export type OpenCodeHarnessSettings = {
138
140
  * milliseconds up to 2 seconds.
139
141
  */
140
142
  readonly reconnect?: SandboxChannelReconnectOptions;
143
+ // TODO: Remove in the next major version.
141
144
  /**
142
- * Creates the authentication token used by the sandbox bridge. Defaults to
143
- * a random 32-byte hexadecimal token.
145
+ * @deprecated Sandbox bridge authentication now uses adapter-generated
146
+ * Ed25519 keys. This setting is ignored and emits a warning.
144
147
  */
145
148
  readonly mintBridgeToken?: HarnessV1MintBridgeTokenCallback;
146
149
  };
@@ -262,7 +265,7 @@ const OPENCODE_BUILTIN_TOOL_NAMES = Object.keys(
262
265
 
263
266
  const openCodeBridgeCoordsSchema = z.object({
264
267
  port: z.number(),
265
- token: z.string(),
268
+ privateKey: z.string(),
266
269
  lastSeenEventId: z.number(),
267
270
  sandboxId: z.string().optional(),
268
271
  });
@@ -278,6 +281,10 @@ type OpenCodeBridgeCoords = z.infer<typeof openCodeBridgeCoordsSchema>;
278
281
  export function createOpenCode(
279
282
  settings: OpenCodeHarnessSettings = {},
280
283
  ): HarnessV1<typeof OPENCODE_BUILTIN_TOOLS> {
284
+ warnMintBridgeTokenIgnored({
285
+ harnessId: 'opencode',
286
+ mintBridgeToken: settings.mintBridgeToken,
287
+ });
281
288
  if (
282
289
  settings.mcpServers != null &&
283
290
  Object.prototype.hasOwnProperty.call(settings.mcpServers, 'harness-tools')
@@ -302,10 +309,8 @@ export function createOpenCode(
302
309
  const sandboxId = 'id' in sandboxSession ? sandboxSession.id : undefined;
303
310
  validateBridgeSandboxSettings({
304
311
  sandboxSession,
305
- sandboxId,
306
312
  portOverride: settings.port,
307
313
  portEndpointOverride: settings.portEndpoint,
308
- mintBridgeToken: settings.mintBridgeToken,
309
314
  });
310
315
  const lifecycleState = startOpts.continueFrom ?? startOpts.resumeFrom;
311
316
  const isResume = lifecycleState != null;
@@ -453,12 +458,12 @@ export function createOpenCode(
453
458
  sandboxSession,
454
459
  port: coords.port,
455
460
  portEndpointOverride: settings.portEndpoint,
456
- token: coords.token,
457
461
  });
458
462
  let supportsUserMessageResponses = false;
459
463
  const attachChannel: OpenCodeChannel = new SandboxChannel({
460
464
  connect: createBridgeWebSocketConnect({
461
465
  endpoint: attachEndpoint,
466
+ privateKey: coords.privateKey,
462
467
  webSocketConstructor: WebSocket,
463
468
  onHello: hello => {
464
469
  supportsUserMessageResponses =
@@ -487,7 +492,7 @@ export function createOpenCode(
487
492
  seedResumeSessionOnFirstPrompt: false,
488
493
  rerunContinue: false,
489
494
  bridgePort: coords.port,
490
- bridgeToken: coords.token,
495
+ bridgePrivateKey: coords.privateKey,
491
496
  sandboxId,
492
497
  sandboxCredentialEnvironment,
493
498
  debug: startOpts.observability?.debug,
@@ -520,10 +525,7 @@ export function createOpenCode(
520
525
  sandboxSession,
521
526
  portOverride: settings.port,
522
527
  });
523
- const token =
524
- settings.mintBridgeToken == null
525
- ? createBridgeToken()
526
- : settings.mintBridgeToken(sandboxId!);
528
+ const bridgeAuth = createBridgeAuthKeyPair();
527
529
  const forwardedAuthEnvironment = credentialsBrokered
528
530
  ? sandboxAuthEnvironment
529
531
  : await applyCredentialForwarding({
@@ -563,7 +565,7 @@ export function createOpenCode(
563
565
  }),
564
566
  }),
565
567
  AI_SDK_HARNESS_CLIENT_APP: OPENCODE_CLIENT_APP,
566
- BRIDGE_CHANNEL_TOKEN: token,
568
+ [BRIDGE_AUTH_PUBLIC_KEY_ENV]: bridgeAuth.publicKey,
567
569
  BRIDGE_WS_PORT: String(port),
568
570
  ...(respawnStrategy === 'replay'
569
571
  ? { BRIDGE_REPLAY_FROM_DISK: '1' }
@@ -627,13 +629,13 @@ export function createOpenCode(
627
629
  sandboxSession,
628
630
  port: boundPort,
629
631
  portEndpointOverride: settings.portEndpoint,
630
- token,
631
632
  });
632
633
  let supportsUserMessageResponses = false;
633
634
 
634
635
  const channel: OpenCodeChannel = new SandboxChannel({
635
636
  connect: createBridgeWebSocketConnect({
636
637
  endpoint: bridgeEndpoint,
638
+ privateKey: bridgeAuth.privateKey,
637
639
  webSocketConstructor: WebSocket,
638
640
  openRetryTimeoutMs: timeoutMs,
639
641
  startAbortSignal: startOpts.abortSignal,
@@ -668,7 +670,7 @@ export function createOpenCode(
668
670
  seedResumeSessionOnFirstPrompt: respawnStrategy !== undefined,
669
671
  rerunContinue: respawnStrategy === 'rerun',
670
672
  bridgePort: boundPort,
671
- bridgeToken: token,
673
+ bridgePrivateKey: bridgeAuth.privateKey,
672
674
  sandboxId,
673
675
  sandboxCredentialEnvironment,
674
676
  debug: startOpts.observability?.debug,
@@ -721,7 +723,7 @@ function createSession({
721
723
  seedResumeSessionOnFirstPrompt,
722
724
  rerunContinue,
723
725
  bridgePort,
724
- bridgeToken,
726
+ bridgePrivateKey,
725
727
  sandboxId,
726
728
  sandboxCredentialEnvironment,
727
729
  debug,
@@ -745,7 +747,7 @@ function createSession({
745
747
  seedResumeSessionOnFirstPrompt: boolean;
746
748
  rerunContinue: boolean;
747
749
  bridgePort: number;
748
- bridgeToken: string;
750
+ bridgePrivateKey: string;
749
751
  sandboxId: string | undefined;
750
752
  sandboxCredentialEnvironment: Record<string, string> | undefined;
751
753
  debug: HarnessV1DebugConfig | undefined;
@@ -1126,7 +1128,7 @@ function createSession({
1126
1128
  : { sandboxCredentialEnvironment }),
1127
1129
  bridge: {
1128
1130
  port: bridgePort,
1129
- token: bridgeToken,
1131
+ privateKey: bridgePrivateKey,
1130
1132
  lastSeenEventId,
1131
1133
  ...(sandboxId == null ? {} : { sandboxId }),
1132
1134
  },
@@ -1255,7 +1257,7 @@ function createSession({
1255
1257
  : { sandboxCredentialEnvironment }),
1256
1258
  bridge: {
1257
1259
  port: bridgePort,
1258
- token: bridgeToken,
1260
+ privateKey: bridgePrivateKey,
1259
1261
  lastSeenEventId,
1260
1262
  ...(sandboxId == null ? {} : { sandboxId }),
1261
1263
  },