@ai-sdk/harness-codex 1.0.119 → 1.0.121

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.
@@ -9,55 +9,55 @@ importers:
9
9
  .:
10
10
  dependencies:
11
11
  '@openai/codex-sdk':
12
- specifier: 0.149.1
13
- version: 0.149.1
12
+ specifier: 0.155.0
13
+ version: 0.155.0
14
14
  ws:
15
15
  specifier: 8.21.0
16
16
  version: 8.21.0
17
17
 
18
18
  packages:
19
19
 
20
- '@openai/codex-sdk@0.149.1':
21
- resolution: {integrity: sha512-R00Rz5327LefZggAxl28r7vFQq1vxa91OxtjZJOsQfAM/MyH8InW5qwwRu6pzUmRGp1E29XrOzm7u1TeV5Yz2A==}
20
+ '@openai/codex-sdk@0.155.0':
21
+ resolution: {integrity: sha512-oD/7iCZnXqDlrnoWWpGkZExrUStpAau1koyUO/fSW3WwkqewRf+MGj3OS41Buw7gNwj0oM6ilI9RHqP5QQWJaQ==}
22
22
  engines: {node: '>=18'}
23
23
 
24
- '@openai/codex@0.149.1':
25
- resolution: {integrity: sha512-6q5pbcpFbJbqOpkubSDBwXmktQ55aD8eUzGzBF1zASob2DjwhBKDSNGtdZKalfrNJUdTDTPDMmzCXEXs5tMBYA==}
24
+ '@openai/codex@0.155.0':
25
+ resolution: {integrity: sha512-35a85Hbwy9WXkDTJumLjTcmMgpR7BMdrTloWBVGjoA+FBCh7jb3+cYp2W+3U4klqGAjAskoIvQZv7/eedmCjHA==}
26
26
  engines: {node: '>=16'}
27
27
  hasBin: true
28
28
 
29
- '@openai/codex@0.149.1-darwin-arm64':
30
- resolution: {integrity: sha512-6X84kTCbnTgPIJ2EdcPsrvwS0Wxsqpa+bCswGmRf4BjhcQ5nPMnBC6yCAaCMj+vrbXQHj+L6sa9FaR4QkmA1qw==}
29
+ '@openai/codex@0.155.0-darwin-arm64':
30
+ resolution: {integrity: sha512-c0vbt2ZS6XiXq9gQkNictu7PH0deMyq/bw4Ia9bdihU1iJHuGuwC5vD4swU4xhLUKoTs4tMOHwYWKaofFZcVRg==}
31
31
  engines: {node: '>=16'}
32
32
  cpu: [arm64]
33
33
  os: [darwin]
34
34
 
35
- '@openai/codex@0.149.1-darwin-x64':
36
- resolution: {integrity: sha512-MfLBQLfcElJL9tvj6y45qVHHMGSXCPnQOixuD3/Zq0g1BW/eFizkrGLdn48cFpc+l8cK+gt5nYG5pQYwVs6g4A==}
35
+ '@openai/codex@0.155.0-darwin-x64':
36
+ resolution: {integrity: sha512-Epo33vwukf4uPyxg1c7+7+P4J6YgggdwQrCR/BRGuhjpadZAzoAntfm54CPCNHvW6uSq8BHQX/e9G+f5/0XQ7Q==}
37
37
  engines: {node: '>=16'}
38
38
  cpu: [x64]
39
39
  os: [darwin]
40
40
 
41
- '@openai/codex@0.149.1-linux-arm64':
42
- resolution: {integrity: sha512-OqxUfZ1TVvHd18zHPKK/8ZRlpk8Vy11mg5CMHaLxNWldTbwVImDKtSLWT+m8m4NM5Sz4PbjtZMrVT/RfpBW/mQ==}
41
+ '@openai/codex@0.155.0-linux-arm64':
42
+ resolution: {integrity: sha512-iMyMjIYHlBUUDeTEGeEftQozQz0h7nYYCaLDJlZnqDF2Y0+bfdD/ppDS3vsw6mIz/z49haC6TCer11iEWO6fsA==}
43
43
  engines: {node: '>=16'}
44
44
  cpu: [arm64]
45
45
  os: [linux]
46
46
 
47
- '@openai/codex@0.149.1-linux-x64':
48
- resolution: {integrity: sha512-Of5fGYgr7tAMsyj6vhXb4/RM/UoA3Zq8BLegUBDC09UNy1XTLGYP/2XD+UX8z3qh0NDwxYdCjFIWdDNijKZggQ==}
47
+ '@openai/codex@0.155.0-linux-x64':
48
+ resolution: {integrity: sha512-CiXkVTy4ERdFSXXP8n98/iOyVUCOYFPQ8cuwgeOEEbLhe1LnlQbgH/H8ZeuxO9WXKIZLJg0x626UgR9axY2zSA==}
49
49
  engines: {node: '>=16'}
50
50
  cpu: [x64]
51
51
  os: [linux]
52
52
 
53
- '@openai/codex@0.149.1-win32-arm64':
54
- resolution: {integrity: sha512-5K0DmOKGK9Bos627p8sK8ATHjovPK0sDyT6h9Cb+4v+5CW5SGw1HLgjGxoLfJ8g3cg6mtg/pRCXXo2L/j71UVA==}
53
+ '@openai/codex@0.155.0-win32-arm64':
54
+ resolution: {integrity: sha512-aFIONQhKxg+XEVsInLRI2OG8S9OUvfK+nzc4sWcbn8DgxlmuPkbVzloSrD5psh1lKnG4s2qd3QK8tCClSgLzJw==}
55
55
  engines: {node: '>=16'}
56
56
  cpu: [arm64]
57
57
  os: [win32]
58
58
 
59
- '@openai/codex@0.149.1-win32-x64':
60
- resolution: {integrity: sha512-G3QXGAg7nyyhqOeooAMUekBCeHd8a1QByhKcVAFyzNBaI06t6Ft7nsF+1SzFS0spuIdU4YyMi5YD26ukADBQUQ==}
59
+ '@openai/codex@0.155.0-win32-x64':
60
+ resolution: {integrity: sha512-yfB9DHAB0YLTy3oD4one21pzGIJ99b+U/PW4htAq6OLccPSZa8OZz5HeN3XVy1a2/BbCqwWmK+w4p/aG/3DCRw==}
61
61
  engines: {node: '>=16'}
62
62
  cpu: [x64]
63
63
  os: [win32]
@@ -76,35 +76,35 @@ packages:
76
76
 
77
77
  snapshots:
78
78
 
79
- '@openai/codex-sdk@0.149.1':
79
+ '@openai/codex-sdk@0.155.0':
80
80
  dependencies:
81
- '@openai/codex': 0.149.1
81
+ '@openai/codex': 0.155.0
82
82
 
83
- '@openai/codex@0.149.1':
83
+ '@openai/codex@0.155.0':
84
84
  optionalDependencies:
85
- '@openai/codex-darwin-arm64': '@openai/codex@0.149.1-darwin-arm64'
86
- '@openai/codex-darwin-x64': '@openai/codex@0.149.1-darwin-x64'
87
- '@openai/codex-linux-arm64': '@openai/codex@0.149.1-linux-arm64'
88
- '@openai/codex-linux-x64': '@openai/codex@0.149.1-linux-x64'
89
- '@openai/codex-win32-arm64': '@openai/codex@0.149.1-win32-arm64'
90
- '@openai/codex-win32-x64': '@openai/codex@0.149.1-win32-x64'
91
-
92
- '@openai/codex@0.149.1-darwin-arm64':
85
+ '@openai/codex-darwin-arm64': '@openai/codex@0.155.0-darwin-arm64'
86
+ '@openai/codex-darwin-x64': '@openai/codex@0.155.0-darwin-x64'
87
+ '@openai/codex-linux-arm64': '@openai/codex@0.155.0-linux-arm64'
88
+ '@openai/codex-linux-x64': '@openai/codex@0.155.0-linux-x64'
89
+ '@openai/codex-win32-arm64': '@openai/codex@0.155.0-win32-arm64'
90
+ '@openai/codex-win32-x64': '@openai/codex@0.155.0-win32-x64'
91
+
92
+ '@openai/codex@0.155.0-darwin-arm64':
93
93
  optional: true
94
94
 
95
- '@openai/codex@0.149.1-darwin-x64':
95
+ '@openai/codex@0.155.0-darwin-x64':
96
96
  optional: true
97
97
 
98
- '@openai/codex@0.149.1-linux-arm64':
98
+ '@openai/codex@0.155.0-linux-arm64':
99
99
  optional: true
100
100
 
101
- '@openai/codex@0.149.1-linux-x64':
101
+ '@openai/codex@0.155.0-linux-x64':
102
102
  optional: true
103
103
 
104
- '@openai/codex@0.149.1-win32-arm64':
104
+ '@openai/codex@0.155.0-win32-arm64':
105
105
  optional: true
106
106
 
107
- '@openai/codex@0.149.1-win32-x64':
107
+ '@openai/codex@0.155.0-win32-x64':
108
108
  optional: true
109
109
 
110
110
  ws@8.21.0: {}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as _ai_sdk_harness from '@ai-sdk/harness';
2
2
  import { HarnessV1Authentication, HarnessV1CredentialForwarding, HarnessV1PortEndpoint, HarnessV1MintBridgeTokenCallback, HarnessV1, HarnessV1BuiltinTool } from '@ai-sdk/harness';
3
+ import { SandboxChannelReconnectOptions } from '@ai-sdk/harness/utils';
3
4
 
4
5
  type CodexAuthenticationMode = HarnessV1Authentication;
5
6
 
@@ -45,6 +46,13 @@ type CodexHarnessSettings = {
45
46
  readonly portEndpoint?: HarnessV1PortEndpoint;
46
47
  /** Maximum milliseconds to wait for the bridge to advertise its port. Defaults to 120000. */
47
48
  readonly startupTimeoutMs?: number;
49
+ /**
50
+ * Configures reconnection attempts after an established bridge connection
51
+ * drops. The reconnect window includes connection establishment and
52
+ * backoff delays. Defaults to 30 seconds with exponential backoff from 50
53
+ * milliseconds up to 2 seconds.
54
+ */
55
+ readonly reconnect?: SandboxChannelReconnectOptions;
48
56
  /**
49
57
  * Creates the authentication token used by the sandbox bridge. Defaults to
50
58
  * a random 32-byte hexadecimal token.
package/dist/index.js CHANGED
@@ -531,7 +531,7 @@ var inboundMessageSchema = z.discriminatedUnion("type", [
531
531
  var CLI_SHIM_FILENAME = "harness-tool.mjs";
532
532
 
533
533
  // src/version.ts
534
- var VERSION = true ? "1.0.119" : "0.0.0-test";
534
+ var VERSION = true ? "1.0.121" : "0.0.0-test";
535
535
 
536
536
  // src/codex-harness.ts
537
537
  var DEFAULT_CODEX_MODEL = "gpt-5.5";
@@ -682,11 +682,12 @@ function createCodex(settings = {}) {
682
682
  token: coords.token
683
683
  });
684
684
  const attachChannel = new SandboxChannel({
685
- connect: () => openWebSocket(attachEndpoint),
685
+ connect: ({ abortSignal }) => openWebSocket({ ...attachEndpoint, abortSignal }),
686
686
  outboundSchema: outboundMessageSchema,
687
687
  initialLastSeenEventId: coords.lastSeenEventId,
688
688
  onDiagnostic,
689
- onBridgeError
689
+ onBridgeError,
690
+ reconnect: settings.reconnect
690
691
  });
691
692
  await attachChannel.open(isContinue ? { resume: true } : void 0);
692
693
  return createSession({
@@ -808,10 +809,11 @@ function createCodex(settings = {}) {
808
809
  });
809
810
  const bridgeEndpoint = withBridgeToken({ endpoint, token });
810
811
  const channel = new SandboxChannel({
811
- connect: () => openWebSocket(bridgeEndpoint),
812
+ connect: ({ abortSignal }) => openWebSocket({ ...bridgeEndpoint, abortSignal }),
812
813
  outboundSchema: outboundMessageSchema,
813
814
  onDiagnostic,
814
815
  onBridgeError,
816
+ reconnect: settings.reconnect,
815
817
  // In replay mode the respawned bridge reloaded the finished turn from
816
818
  // disk; seed the cursor and resume so it streams the tail (incl.
817
819
  // `finish`).
@@ -896,22 +898,54 @@ async function resolveBridgeEndpoint({
896
898
  }
897
899
  function openWebSocket({
898
900
  url,
899
- headers
901
+ headers,
902
+ abortSignal
900
903
  }) {
901
904
  return new Promise((resolve2, reject) => {
905
+ if (abortSignal.aborted) {
906
+ reject(abortSignal.reason ?? new Error("WebSocket connection aborted"));
907
+ return;
908
+ }
902
909
  const ws = new WebSocket(url, {
903
910
  headers: headers == null ? void 0 : { ...headers }
904
911
  });
905
- const onOpen = () => {
912
+ let settled = false;
913
+ const cleanup = () => {
914
+ abortSignal.removeEventListener("abort", onAbort);
915
+ ws.off("open", onOpen);
906
916
  ws.off("error", onError);
917
+ };
918
+ const rejectWithCleanup = (error) => {
919
+ if (settled) return;
920
+ settled = true;
921
+ cleanup();
922
+ ws.once("error", () => {
923
+ });
924
+ try {
925
+ ws.terminate();
926
+ } catch {
927
+ try {
928
+ ws.close();
929
+ } catch {
930
+ }
931
+ }
932
+ reject(error);
933
+ };
934
+ const onOpen = () => {
935
+ if (settled) return;
936
+ settled = true;
937
+ cleanup();
907
938
  resolve2(ws);
908
939
  };
909
940
  const onError = (err) => {
910
- ws.off("open", onOpen);
911
- reject(err);
941
+ rejectWithCleanup(err);
912
942
  };
943
+ const onAbort = () => rejectWithCleanup(
944
+ abortSignal.reason ?? new Error("WebSocket connection aborted")
945
+ );
913
946
  ws.once("open", onOpen);
914
947
  ws.once("error", onError);
948
+ abortSignal.addEventListener("abort", onAbort, { once: true });
915
949
  });
916
950
  }
917
951
  function createSession({