@ai-sdk/harness-claude-code 1.0.98 → 1.0.100

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
@@ -1,5 +1,4 @@
1
1
  // src/claude-code-harness.ts
2
- import { randomBytes } from "crypto";
3
2
  import { posix } from "path";
4
3
  import {
5
4
  commonTool,
@@ -10,6 +9,7 @@ import {
10
9
  applyCredentialForwarding,
11
10
  classifyDiskLog,
12
11
  createSandboxCredentialEnvironment,
12
+ createBridgeToken,
13
13
  experimental_createBridgeUserMessageSubmitter,
14
14
  createBridgeErrorHandler,
15
15
  createBridgeStartupError,
@@ -23,6 +23,7 @@ import {
23
23
  shellQuote,
24
24
  warnCredentialBrokeringUnavailable,
25
25
  waitForBridgeReady,
26
+ withBridgeToken,
26
27
  writeSkills as writeHarnessSkills
27
28
  } from "@ai-sdk/harness/utils";
28
29
  import {
@@ -33,8 +34,10 @@ import { WebSocket } from "ws";
33
34
  import { z as z2 } from "zod/v4";
34
35
 
35
36
  // src/claude-code-bootstrap.ts
36
- import { readFile } from "fs/promises";
37
- import { fileURLToPath } from "url";
37
+ import { createReadBridgeAsset } from "@ai-sdk/harness/utils";
38
+ var readBridgeAsset = createReadBridgeAsset({
39
+ resolveAssetUrl: (name) => new URL(`./bridge/${name}`, import.meta.url)
40
+ });
38
41
  var CLAUDE_CODE_BOOTSTRAP_DIR = ".harness-bootstrap/claude-code";
39
42
  var cachedBootstrap;
40
43
  async function getClaudeCodeBootstrap() {
@@ -68,23 +71,6 @@ async function getClaudeCodeBootstrap() {
68
71
  };
69
72
  return cachedBootstrap;
70
73
  }
71
- async function readBridgeAsset(name) {
72
- const candidates = [
73
- new URL(`./bridge/${name}`, import.meta.url),
74
- new URL(`../bridge/${name}`, import.meta.url)
75
- ];
76
- let lastErr;
77
- for (const url of candidates) {
78
- try {
79
- return await readFile(fileURLToPath(url), "utf8");
80
- } catch (err) {
81
- const code = err.code;
82
- if (code !== "ENOENT") throw err;
83
- lastErr = err;
84
- }
85
- }
86
- throw lastErr ?? new Error(`bridge asset not found: ${name}`);
87
- }
88
74
 
89
75
  // src/claude-code-auth.ts
90
76
  import { execFileSync } from "child_process";
@@ -274,7 +260,7 @@ var inboundMessageSchema = z.discriminatedUnion("type", [
274
260
  ]);
275
261
 
276
262
  // src/version.ts
277
- var VERSION = true ? "1.0.98" : "0.0.0-test";
263
+ var VERSION = true ? "1.0.100" : "0.0.0-test";
278
264
 
279
265
  // src/claude-code-harness.ts
280
266
  var CLAUDE_CODE_CLIENT_APP = `ai-sdk/harness-claude-code/${VERSION}`;
@@ -1079,7 +1065,7 @@ function createClaudeCode(settings = {}) {
1079
1065
  sandboxSession,
1080
1066
  override: settings.port
1081
1067
  });
1082
- const token = settings.mintBridgeToken == null ? randomBytes(32).toString("hex") : settings.mintBridgeToken(sandboxId);
1068
+ const token = settings.mintBridgeToken == null ? createBridgeToken() : settings.mintBridgeToken(sandboxId);
1083
1069
  const env = {
1084
1070
  BRIDGE_CHANNEL_TOKEN: token,
1085
1071
  BRIDGE_WS_PORT: String(port),
@@ -1384,14 +1370,6 @@ function webSocketMessageToString(raw) {
1384
1370
  }
1385
1371
  return String(raw);
1386
1372
  }
1387
- function withBridgeToken({
1388
- endpoint,
1389
- token
1390
- }) {
1391
- const bridgeUrl = new URL(endpoint.url);
1392
- bridgeUrl.searchParams.set("agent_bridge_token", token);
1393
- return { ...endpoint, url: bridgeUrl.toString() };
1394
- }
1395
1373
  function sleep(ms) {
1396
1374
  return new Promise((resolve) => {
1397
1375
  const timer = setTimeout(resolve, ms);