@ai-sdk/harness 1.0.94 → 1.0.96

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.
@@ -568,6 +568,16 @@ declare function markBridgeStarting({ sandbox, bridgeStateDir, bridgeType, abort
568
568
  }): Promise<void>;
569
569
  declare function waitForBridgeReady({ proc, sandbox, bridgeStateDir, bridgeType, timeoutMs, abortSignal, pollIntervalMs, createTimeoutError, createExitError, }: WaitForBridgeReadyOptions): Promise<WaitForBridgeReadyResult>;
570
570
 
571
+ declare function createBridgeToken(): string;
572
+ declare function withBridgeToken({ endpoint, token, }: {
573
+ endpoint: HarnessV1PortEndpoint;
574
+ token: string;
575
+ }): HarnessV1PortEndpoint;
576
+
577
+ declare function createReadBridgeAsset({ resolveAssetUrl, }: {
578
+ resolveAssetUrl: (name: string) => URL;
579
+ }): (name: string) => Promise<string>;
580
+
571
581
  type BridgeProcessStreamName = 'stdout' | 'stderr';
572
582
  declare function formatBridgeError(error: unknown): string;
573
583
  declare function logBridgeError({ harnessId, sessionId, context, error, write, }: {
@@ -607,4 +617,4 @@ declare function resolveSandboxDefaultWorkingDirectory({ sandboxSession, abortSi
607
617
 
608
618
  declare function getRestrictedSandboxSession(sandboxSession: HarnessV1NetworkSandboxSession | Experimental_SandboxSession): Experimental_SandboxSession;
609
619
 
610
- export { type BridgeReadyErrorContext, type BridgeReadySource, type DiskLogRecoveryMode, type Experimental_BridgeUserMessageRequest, type Experimental_BridgeUserMessageResponse, type Experimental_BridgeUserMessageSubmitter, SandboxChannel, type SandboxChannelDebugEvent, type SandboxChannelOptions, type SandboxChannelReconnectOptions, type SkillFilePathMode, type WaitForBridgeReadyOptions, type WaitForBridgeReadyResult, type WriteSkillsOptions, type WriteSkillsResult, applyCredentialForwarding, classifyDiskLog, createBridgeErrorHandler, createBridgeStartupError, createCredentialRequestTransformation, createSandboxCredentialEnvironment, drainBridgeProcessStream, experimental_createBridgeUserMessageSubmitter, formatBridgeError, forwardBridgeProcessStream, generateSandboxCredentialPlaceholder, getAiGatewayAuthFromEnv, getRestrictedSandboxSession, isHarnessAuthenticationEnvironment, isSandboxCredentialPlaceholder, logBridgeError, markBridgeStarting, maskSandboxCredentials, resolveSandboxDefaultWorkingDirectory, resolveSandboxHomeDir, shellQuote, waitForBridgeReady, warnCredentialBrokeringUnavailable, writeSkills };
620
+ export { type BridgeReadyErrorContext, type BridgeReadySource, type DiskLogRecoveryMode, type Experimental_BridgeUserMessageRequest, type Experimental_BridgeUserMessageResponse, type Experimental_BridgeUserMessageSubmitter, SandboxChannel, type SandboxChannelDebugEvent, type SandboxChannelOptions, type SandboxChannelReconnectOptions, type SkillFilePathMode, type WaitForBridgeReadyOptions, type WaitForBridgeReadyResult, type WriteSkillsOptions, type WriteSkillsResult, applyCredentialForwarding, classifyDiskLog, createBridgeErrorHandler, createBridgeStartupError, createBridgeToken, createCredentialRequestTransformation, createReadBridgeAsset, createSandboxCredentialEnvironment, drainBridgeProcessStream, experimental_createBridgeUserMessageSubmitter, formatBridgeError, forwardBridgeProcessStream, generateSandboxCredentialPlaceholder, getAiGatewayAuthFromEnv, getRestrictedSandboxSession, isHarnessAuthenticationEnvironment, isSandboxCredentialPlaceholder, logBridgeError, markBridgeStarting, maskSandboxCredentials, resolveSandboxDefaultWorkingDirectory, resolveSandboxHomeDir, shellQuote, waitForBridgeReady, warnCredentialBrokeringUnavailable, withBridgeToken, writeSkills };
@@ -1523,6 +1523,28 @@ function lineDecoder() {
1523
1523
  };
1524
1524
  }
1525
1525
 
1526
+ // src/utils/bridge-token.ts
1527
+ import { randomBytes as randomBytes2 } from "crypto";
1528
+ function createBridgeToken() {
1529
+ return randomBytes2(32).toString("hex");
1530
+ }
1531
+ function withBridgeToken({
1532
+ endpoint,
1533
+ token
1534
+ }) {
1535
+ const bridgeUrl = new URL(endpoint.url);
1536
+ bridgeUrl.searchParams.set("agent_bridge_token", token);
1537
+ return { ...endpoint, url: bridgeUrl.toString() };
1538
+ }
1539
+
1540
+ // src/utils/bridge-asset.ts
1541
+ import { readFile } from "fs/promises";
1542
+ function createReadBridgeAsset({
1543
+ resolveAssetUrl
1544
+ }) {
1545
+ return async (name) => readFile(resolveAssetUrl(name), "utf8");
1546
+ }
1547
+
1526
1548
  // src/utils/bridge-diagnostics.ts
1527
1549
  var DEFAULT_TAIL_LIMIT = 20;
1528
1550
  function isSerializedError(error) {
@@ -1723,7 +1745,9 @@ export {
1723
1745
  classifyDiskLog,
1724
1746
  createBridgeErrorHandler,
1725
1747
  createBridgeStartupError,
1748
+ createBridgeToken,
1726
1749
  createCredentialRequestTransformation,
1750
+ createReadBridgeAsset,
1727
1751
  createSandboxCredentialEnvironment,
1728
1752
  drainBridgeProcessStream,
1729
1753
  experimental_createBridgeUserMessageSubmitter,
@@ -1742,6 +1766,7 @@ export {
1742
1766
  shellQuote,
1743
1767
  waitForBridgeReady,
1744
1768
  warnCredentialBrokeringUnavailable,
1769
+ withBridgeToken,
1745
1770
  writeSkills
1746
1771
  };
1747
1772
  //# sourceMappingURL=index.js.map