@ai-sdk/harness-opencode 1.0.96 → 1.0.98

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.
@@ -1,4 +1,3 @@
1
- import { randomBytes } from 'node:crypto';
2
1
  import path from 'node:path';
3
2
  import {
4
3
  commonTool,
@@ -24,6 +23,7 @@ import {
24
23
  applyCredentialForwarding,
25
24
  classifyDiskLog,
26
25
  createSandboxCredentialEnvironment,
26
+ createBridgeToken,
27
27
  experimental_createBridgeUserMessageSubmitter,
28
28
  createBridgeErrorHandler,
29
29
  createBridgeStartupError,
@@ -37,6 +37,7 @@ import {
37
37
  shellQuote,
38
38
  warnCredentialBrokeringUnavailable,
39
39
  waitForBridgeReady,
40
+ withBridgeToken,
40
41
  writeSkills as writeHarnessSkills,
41
42
  type WriteSkillsResult,
42
43
  } from '@ai-sdk/harness/utils';
@@ -446,7 +447,7 @@ export function createOpenCode(
446
447
  });
447
448
  const token =
448
449
  settings.mintBridgeToken == null
449
- ? randomBytes(32).toString('hex')
450
+ ? createBridgeToken()
450
451
  : settings.mintBridgeToken(sandboxId!);
451
452
  const forwardedAuthEnvironment = credentialsBrokered
452
453
  ? sandboxAuthEnvironment
@@ -764,18 +765,6 @@ function webSocketMessageToString(raw: unknown): string {
764
765
  return String(raw);
765
766
  }
766
767
 
767
- function withBridgeToken({
768
- endpoint,
769
- token,
770
- }: {
771
- endpoint: HarnessV1PortEndpoint;
772
- token: string;
773
- }): HarnessV1PortEndpoint {
774
- const bridgeUrl = new URL(endpoint.url);
775
- bridgeUrl.searchParams.set('agent_bridge_token', token);
776
- return { ...endpoint, url: bridgeUrl.toString() };
777
- }
778
-
779
768
  function createSession({
780
769
  sessionId,
781
770
  channel,