@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.
- package/CHANGELOG.md +19 -0
- package/dist/bridge/index.mjs +46 -10
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/bridge/package.json +1 -1
- package/dist/bridge/pnpm-lock.yaml +34 -34
- package/dist/index.d.ts +8 -0
- package/dist/index.js +42 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/bridge/create-emit-stream-event.ts +54 -10
- package/src/bridge/package.json +1 -1
- package/src/bridge/pnpm-lock.yaml +34 -34
- package/src/codex-harness.ts +54 -6
|
@@ -9,55 +9,55 @@ importers:
|
|
|
9
9
|
.:
|
|
10
10
|
dependencies:
|
|
11
11
|
'@openai/codex-sdk':
|
|
12
|
-
specifier: 0.
|
|
13
|
-
version: 0.
|
|
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.
|
|
21
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
25
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
30
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
36
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
42
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
48
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
54
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
60
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
79
|
+
'@openai/codex-sdk@0.155.0':
|
|
80
80
|
dependencies:
|
|
81
|
-
'@openai/codex': 0.
|
|
81
|
+
'@openai/codex': 0.155.0
|
|
82
82
|
|
|
83
|
-
'@openai/codex@0.
|
|
83
|
+
'@openai/codex@0.155.0':
|
|
84
84
|
optionalDependencies:
|
|
85
|
-
'@openai/codex-darwin-arm64': '@openai/codex@0.
|
|
86
|
-
'@openai/codex-darwin-x64': '@openai/codex@0.
|
|
87
|
-
'@openai/codex-linux-arm64': '@openai/codex@0.
|
|
88
|
-
'@openai/codex-linux-x64': '@openai/codex@0.
|
|
89
|
-
'@openai/codex-win32-arm64': '@openai/codex@0.
|
|
90
|
-
'@openai/codex-win32-x64': '@openai/codex@0.
|
|
91
|
-
|
|
92
|
-
'@openai/codex@0.
|
|
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.
|
|
95
|
+
'@openai/codex@0.155.0-darwin-x64':
|
|
96
96
|
optional: true
|
|
97
97
|
|
|
98
|
-
'@openai/codex@0.
|
|
98
|
+
'@openai/codex@0.155.0-linux-arm64':
|
|
99
99
|
optional: true
|
|
100
100
|
|
|
101
|
-
'@openai/codex@0.
|
|
101
|
+
'@openai/codex@0.155.0-linux-x64':
|
|
102
102
|
optional: true
|
|
103
103
|
|
|
104
|
-
'@openai/codex@0.
|
|
104
|
+
'@openai/codex@0.155.0-win32-arm64':
|
|
105
105
|
optional: true
|
|
106
106
|
|
|
107
|
-
'@openai/codex@0.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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({
|