@ai-sdk/harness-codex 1.0.178 → 1.0.181
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 +26 -0
- package/dist/bridge/index.mjs +84 -13
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/bridge/package.json +1 -1
- package/dist/bridge/pnpm-lockfile.yaml +30 -30
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/bridge/codex-app-server-driver.ts +41 -6
- package/src/bridge/codex-tool-filtering-hook.ts +2 -2
- package/src/bridge/index.ts +0 -1
- package/src/bridge/package.json +1 -1
- package/src/codex-harness.ts +22 -20
package/dist/bridge/package.json
CHANGED
|
@@ -9,51 +9,51 @@ importers:
|
|
|
9
9
|
.:
|
|
10
10
|
dependencies:
|
|
11
11
|
'@openai/codex':
|
|
12
|
-
specifier: 0.
|
|
13
|
-
version: 0.
|
|
12
|
+
specifier: 0.167.0
|
|
13
|
+
version: 0.167.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@0.
|
|
21
|
-
resolution: {integrity: sha512-
|
|
20
|
+
'@openai/codex@0.167.0':
|
|
21
|
+
resolution: {integrity: sha512-1FSQgbTIKAdTub5Ln6z36NT4eXDmBRkinfigzycbgn9yLZdJ3UdkQZqr0N7jnl8/D1xxT/Pz3Fl2l7S2dmRaFA==}
|
|
22
22
|
engines: {node: '>=16'}
|
|
23
23
|
hasBin: true
|
|
24
24
|
|
|
25
|
-
'@openai/codex@0.
|
|
26
|
-
resolution: {integrity: sha512-
|
|
25
|
+
'@openai/codex@0.167.0-darwin-arm64':
|
|
26
|
+
resolution: {integrity: sha512-7YtMDZX/jbWH9+fCVQg7BVsov8WvBzu4iuedXJEDlUdZxaTrYX2bEQwHIn3p0gxgSMfm30HGK9+bZm1aGSZaHw==}
|
|
27
27
|
engines: {node: '>=16'}
|
|
28
28
|
cpu: [arm64]
|
|
29
29
|
os: [darwin]
|
|
30
30
|
|
|
31
|
-
'@openai/codex@0.
|
|
32
|
-
resolution: {integrity: sha512-
|
|
31
|
+
'@openai/codex@0.167.0-darwin-x64':
|
|
32
|
+
resolution: {integrity: sha512-wKoBiI6SBSg8fqiEYEOJs/NM/ZzKaCgy1cseX9LJbuDq3GCCKkeW9BUGe1ZEkyhhZ5Yfj+HzdUfp698abP2tDA==}
|
|
33
33
|
engines: {node: '>=16'}
|
|
34
34
|
cpu: [x64]
|
|
35
35
|
os: [darwin]
|
|
36
36
|
|
|
37
|
-
'@openai/codex@0.
|
|
38
|
-
resolution: {integrity: sha512-
|
|
37
|
+
'@openai/codex@0.167.0-linux-arm64':
|
|
38
|
+
resolution: {integrity: sha512-5cv+sybRWqpRJL6KCv3YSnIx1GHRmjek997C38n1Zfno4HomKDLkNSjWLDOOc2+ISlVNSRRnySWq4zKmzlY12g==}
|
|
39
39
|
engines: {node: '>=16'}
|
|
40
40
|
cpu: [arm64]
|
|
41
41
|
os: [linux]
|
|
42
42
|
|
|
43
|
-
'@openai/codex@0.
|
|
44
|
-
resolution: {integrity: sha512-
|
|
43
|
+
'@openai/codex@0.167.0-linux-x64':
|
|
44
|
+
resolution: {integrity: sha512-FNc7danfUng9Sp6w+Fh7kofNHHZpA6VMyNKWsWrS3OwHly69gywTWeiuwrUPXpJSho8Df4xqRsHfHRPzj7zYQg==}
|
|
45
45
|
engines: {node: '>=16'}
|
|
46
46
|
cpu: [x64]
|
|
47
47
|
os: [linux]
|
|
48
48
|
|
|
49
|
-
'@openai/codex@0.
|
|
50
|
-
resolution: {integrity: sha512-
|
|
49
|
+
'@openai/codex@0.167.0-win32-arm64':
|
|
50
|
+
resolution: {integrity: sha512-dYeYQZ66LCNnFXyF5vHRsbJQLyfbY3G8vDyn6XG3NxcwMFz4stkgSdC94UPc1NhCxkhpufHlkAm1oe+Z28Pw5Q==}
|
|
51
51
|
engines: {node: '>=16'}
|
|
52
52
|
cpu: [arm64]
|
|
53
53
|
os: [win32]
|
|
54
54
|
|
|
55
|
-
'@openai/codex@0.
|
|
56
|
-
resolution: {integrity: sha512-
|
|
55
|
+
'@openai/codex@0.167.0-win32-x64':
|
|
56
|
+
resolution: {integrity: sha512-duPCBwflc8qhQdLekbL8fDYF646tW4gj0/l9BDnsVhEzoqm6OwxMAJXDFwSOLUUJPCmjBeM+eHYAx4fP/hwfjg==}
|
|
57
57
|
engines: {node: '>=16'}
|
|
58
58
|
cpu: [x64]
|
|
59
59
|
os: [win32]
|
|
@@ -72,31 +72,31 @@ packages:
|
|
|
72
72
|
|
|
73
73
|
snapshots:
|
|
74
74
|
|
|
75
|
-
'@openai/codex@0.
|
|
75
|
+
'@openai/codex@0.167.0':
|
|
76
76
|
optionalDependencies:
|
|
77
|
-
'@openai/codex-darwin-arm64': '@openai/codex@0.
|
|
78
|
-
'@openai/codex-darwin-x64': '@openai/codex@0.
|
|
79
|
-
'@openai/codex-linux-arm64': '@openai/codex@0.
|
|
80
|
-
'@openai/codex-linux-x64': '@openai/codex@0.
|
|
81
|
-
'@openai/codex-win32-arm64': '@openai/codex@0.
|
|
82
|
-
'@openai/codex-win32-x64': '@openai/codex@0.
|
|
83
|
-
|
|
84
|
-
'@openai/codex@0.
|
|
77
|
+
'@openai/codex-darwin-arm64': '@openai/codex@0.167.0-darwin-arm64'
|
|
78
|
+
'@openai/codex-darwin-x64': '@openai/codex@0.167.0-darwin-x64'
|
|
79
|
+
'@openai/codex-linux-arm64': '@openai/codex@0.167.0-linux-arm64'
|
|
80
|
+
'@openai/codex-linux-x64': '@openai/codex@0.167.0-linux-x64'
|
|
81
|
+
'@openai/codex-win32-arm64': '@openai/codex@0.167.0-win32-arm64'
|
|
82
|
+
'@openai/codex-win32-x64': '@openai/codex@0.167.0-win32-x64'
|
|
83
|
+
|
|
84
|
+
'@openai/codex@0.167.0-darwin-arm64':
|
|
85
85
|
optional: true
|
|
86
86
|
|
|
87
|
-
'@openai/codex@0.
|
|
87
|
+
'@openai/codex@0.167.0-darwin-x64':
|
|
88
88
|
optional: true
|
|
89
89
|
|
|
90
|
-
'@openai/codex@0.
|
|
90
|
+
'@openai/codex@0.167.0-linux-arm64':
|
|
91
91
|
optional: true
|
|
92
92
|
|
|
93
|
-
'@openai/codex@0.
|
|
93
|
+
'@openai/codex@0.167.0-linux-x64':
|
|
94
94
|
optional: true
|
|
95
95
|
|
|
96
|
-
'@openai/codex@0.
|
|
96
|
+
'@openai/codex@0.167.0-win32-arm64':
|
|
97
97
|
optional: true
|
|
98
98
|
|
|
99
|
-
'@openai/codex@0.
|
|
99
|
+
'@openai/codex@0.167.0-win32-x64':
|
|
100
100
|
optional: true
|
|
101
101
|
|
|
102
102
|
ws@8.21.0: {}
|
package/dist/index.d.ts
CHANGED
|
@@ -63,8 +63,8 @@ type CodexHarnessSettings = {
|
|
|
63
63
|
*/
|
|
64
64
|
readonly reconnect?: SandboxChannelReconnectOptions;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
66
|
+
* @deprecated Sandbox bridge authentication now uses adapter-generated
|
|
67
|
+
* Ed25519 keys. This setting is ignored and emits a warning.
|
|
68
68
|
*/
|
|
69
69
|
readonly mintBridgeToken?: HarnessV1MintBridgeTokenCallback;
|
|
70
70
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["SandboxSession"],"sources":["../src/codex-auth.ts","../src/codex-harness.ts","../src/version.ts","../src/index.ts"],"mappings":";;;;;KA8CY,0BAA0B;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["SandboxSession"],"sources":["../src/codex-auth.ts","../src/codex-harness.ts","../src/version.ts","../src/index.ts"],"mappings":";;;;;KA8CY,0BAA0B;;;KCoD1B;WACD,OAAO;;;;;;WAMP,uBAAuB;;;;;;;WAOvB,cAAc;;;;;WAKd,aAAa;;;;;WAKb;;;;WAIA;;;;;;;WAOA;;;;;WAKA,eAAe;;WAEf;;;;;;WAMA;;;;;;;WAOA,YAAY;;;;;WAMZ,kBAAkB;;cAYvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA8DU,YACd,WAAU,uBACT,iBAAiB;;;qBCzOP;;;;;;;;qBCKA,iCAAK"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import path, { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { HarnessCapabilityUnsupportedError, commonTool, harnessSessionDataDirectoryPath, harnessStateDirectoryPath, harnessV1BridgeInboundCommandSchemas, harnessV1BridgeOutboundMessageSchema, harnessV1BridgeStartBaseSchema, harnessV1DiagnosticFromBridgeFrame } from "@ai-sdk/harness";
|
|
4
|
-
import { SandboxChannel, applyCredentialForwarding, classifyDiskLog, createBridgeErrorHandler, createBridgeStartupError,
|
|
4
|
+
import { BRIDGE_AUTH_PUBLIC_KEY_ENV, SandboxChannel, applyCredentialForwarding, classifyDiskLog, createBridgeAuthKeyPair, createBridgeErrorHandler, createBridgeStartupError, createBridgeWebSocketConnect, createCredentialRequestTransformation, createReadBridgeAsset, drainBridgeProcessStream, experimental_createBridgeUserMessageSubmitter, extractHarnessPromptContent, forwardBridgeProcessStream, getAiGatewayAuthFromEnv, getJwtExpiresAt, getRestrictedSandboxSession, harnessPromptContentSchema, isAccessTokenExpiringSoon, isHarnessAuthenticationEnvironment, isLinux, isMacOS, isWindows, markBridgeStarting, readLinuxSecretServicePassword, readMacOSKeychainPassword, readWindowsCredentialManagerPassword, refreshOAuthAccessToken, resolveBridgeEndpoint, resolveBridgePort, resolveSandboxCredentialEnvironment, resolveSandboxHomeDir, shellQuote, shouldResolveNativeSubscription, validateBridgeSandboxSettings, waitForBridgeReady, warnCredentialBrokeringUnavailable, warnMintBridgeTokenIgnored, writeSkills } from "@ai-sdk/harness/utils";
|
|
5
5
|
import { isRecord, safeParseJSON, tool } from "@ai-sdk/provider-utils";
|
|
6
6
|
import { WebSocket } from "ws";
|
|
7
7
|
import { z } from "zod/v4";
|
|
@@ -399,7 +399,7 @@ const startMessageSchema = harnessV1BridgeStartBaseSchema.extend({
|
|
|
399
399
|
z.discriminatedUnion("type", [startMessageSchema, ...harnessV1BridgeInboundCommandSchemas]);
|
|
400
400
|
//#endregion
|
|
401
401
|
//#region src/version.ts
|
|
402
|
-
const VERSION = "1.0.
|
|
402
|
+
const VERSION = "1.0.181";
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/codex-harness.ts
|
|
405
405
|
const DEFAULT_CODEX_MODEL = "gpt-5.5";
|
|
@@ -446,7 +446,7 @@ const CODEX_BUILTIN_TOOLS = {
|
|
|
446
446
|
*/
|
|
447
447
|
const codexBridgeCoordsSchema = z.object({
|
|
448
448
|
port: z.number(),
|
|
449
|
-
|
|
449
|
+
privateKey: z.string(),
|
|
450
450
|
lastSeenEventId: z.number(),
|
|
451
451
|
sandboxId: z.string().optional()
|
|
452
452
|
});
|
|
@@ -465,6 +465,10 @@ const codexResumeStateSchema = z.object({
|
|
|
465
465
|
sandboxCredentialEnvironment: z.record(z.string(), z.string()).optional()
|
|
466
466
|
});
|
|
467
467
|
function createCodex(settings = {}) {
|
|
468
|
+
warnMintBridgeTokenIgnored({
|
|
469
|
+
harnessId: "codex",
|
|
470
|
+
mintBridgeToken: settings.mintBridgeToken
|
|
471
|
+
});
|
|
468
472
|
return {
|
|
469
473
|
specificationVersion: "harness-v1",
|
|
470
474
|
harnessId: "codex",
|
|
@@ -484,10 +488,8 @@ function createCodex(settings = {}) {
|
|
|
484
488
|
const sandboxId = "id" in sandboxSession ? sandboxSession.id : void 0;
|
|
485
489
|
validateBridgeSandboxSettings({
|
|
486
490
|
sandboxSession,
|
|
487
|
-
sandboxId,
|
|
488
491
|
portOverride: settings.port,
|
|
489
|
-
portEndpointOverride: settings.portEndpoint
|
|
490
|
-
mintBridgeToken: settings.mintBridgeToken
|
|
492
|
+
portEndpointOverride: settings.portEndpoint
|
|
491
493
|
});
|
|
492
494
|
const lifecycleState = startOpts.continueFrom ?? startOpts.resumeFrom;
|
|
493
495
|
const isResume = lifecycleState != null;
|
|
@@ -552,12 +554,12 @@ function createCodex(settings = {}) {
|
|
|
552
554
|
const attachEndpoint = await resolveBridgeEndpoint({
|
|
553
555
|
sandboxSession,
|
|
554
556
|
port: coords.port,
|
|
555
|
-
portEndpointOverride: settings.portEndpoint
|
|
556
|
-
token: coords.token
|
|
557
|
+
portEndpointOverride: settings.portEndpoint
|
|
557
558
|
});
|
|
558
559
|
const attachChannel = new SandboxChannel({
|
|
559
560
|
connect: createBridgeWebSocketConnect({
|
|
560
561
|
endpoint: attachEndpoint,
|
|
562
|
+
privateKey: coords.privateKey,
|
|
561
563
|
webSocketConstructor: WebSocket
|
|
562
564
|
}),
|
|
563
565
|
outboundSchema: outboundMessageSchema,
|
|
@@ -583,7 +585,7 @@ function createCodex(settings = {}) {
|
|
|
583
585
|
seedResumeThreadOnFirstPrompt: false,
|
|
584
586
|
rerunContinue: false,
|
|
585
587
|
bridgePort: coords.port,
|
|
586
|
-
|
|
588
|
+
bridgePrivateKey: coords.privateKey,
|
|
587
589
|
sandboxId,
|
|
588
590
|
sandboxCredentialEnvironment,
|
|
589
591
|
debug: startOpts.observability?.debug,
|
|
@@ -605,7 +607,7 @@ function createCodex(settings = {}) {
|
|
|
605
607
|
sandboxSession,
|
|
606
608
|
portOverride: settings.port
|
|
607
609
|
});
|
|
608
|
-
const
|
|
610
|
+
const bridgeAuth = createBridgeAuthKeyPair();
|
|
609
611
|
const forwardedAuthEnvironment = credentialsBrokered ? sandboxAuthEnvironment : await applyCredentialForwarding({
|
|
610
612
|
environment: sandboxAuthEnvironment,
|
|
611
613
|
credentialEnvironmentVariables: CODEX_CREDENTIAL_ENVIRONMENT_VARIABLES,
|
|
@@ -619,7 +621,7 @@ function createCodex(settings = {}) {
|
|
|
619
621
|
const env = {
|
|
620
622
|
...forwardedAuthEnvironment,
|
|
621
623
|
AI_SDK_HARNESS_CLIENT_APP: CODEX_CLIENT_APP,
|
|
622
|
-
|
|
624
|
+
[BRIDGE_AUTH_PUBLIC_KEY_ENV]: bridgeAuth.publicKey,
|
|
623
625
|
BRIDGE_WS_PORT: String(port),
|
|
624
626
|
...respawnStrategy === "replay" ? { BRIDGE_REPLAY_FROM_DISK: "1" } : {}
|
|
625
627
|
};
|
|
@@ -671,12 +673,12 @@ function createCodex(settings = {}) {
|
|
|
671
673
|
const bridgeEndpoint = await resolveBridgeEndpoint({
|
|
672
674
|
sandboxSession,
|
|
673
675
|
port: boundPort,
|
|
674
|
-
portEndpointOverride: settings.portEndpoint
|
|
675
|
-
token
|
|
676
|
+
portEndpointOverride: settings.portEndpoint
|
|
676
677
|
});
|
|
677
678
|
const channel = new SandboxChannel({
|
|
678
679
|
connect: createBridgeWebSocketConnect({
|
|
679
680
|
endpoint: bridgeEndpoint,
|
|
681
|
+
privateKey: bridgeAuth.privateKey,
|
|
680
682
|
webSocketConstructor: WebSocket,
|
|
681
683
|
openRetryTimeoutMs: timeoutMs,
|
|
682
684
|
startAbortSignal: startOpts.abortSignal
|
|
@@ -704,7 +706,7 @@ function createCodex(settings = {}) {
|
|
|
704
706
|
seedResumeThreadOnFirstPrompt: respawnStrategy !== void 0,
|
|
705
707
|
rerunContinue: respawnStrategy === "rerun",
|
|
706
708
|
bridgePort: boundPort,
|
|
707
|
-
|
|
709
|
+
bridgePrivateKey: bridgeAuth.privateKey,
|
|
708
710
|
sandboxId,
|
|
709
711
|
sandboxCredentialEnvironment,
|
|
710
712
|
debug: startOpts.observability?.debug,
|
|
@@ -716,7 +718,7 @@ function createCodex(settings = {}) {
|
|
|
716
718
|
}
|
|
717
719
|
};
|
|
718
720
|
}
|
|
719
|
-
function createSession({ sessionId, channel, proc, model, reasoningEffort, webSearch, builtinToolFiltering, codexConfig, mcpServers, headers, resumeThreadId, isResume, seedResumeThreadOnFirstPrompt, rerunContinue, bridgePort,
|
|
721
|
+
function createSession({ sessionId, channel, proc, model, reasoningEffort, webSearch, builtinToolFiltering, codexConfig, mcpServers, headers, resumeThreadId, isResume, seedResumeThreadOnFirstPrompt, rerunContinue, bridgePort, bridgePrivateKey, sandboxId, sandboxCredentialEnvironment, debug, permissionMode, sandbox, sandboxHomeDir, turnConfigurationFingerprint }) {
|
|
720
722
|
let stopped = false;
|
|
721
723
|
let stopPromise;
|
|
722
724
|
let pendingResumeThreadId = seedResumeThreadOnFirstPrompt ? resumeThreadId : void 0;
|
|
@@ -970,7 +972,7 @@ function createSession({ sessionId, channel, proc, model, reasoningEffort, webSe
|
|
|
970
972
|
...sandboxCredentialEnvironment == null ? {} : { sandboxCredentialEnvironment },
|
|
971
973
|
bridge: {
|
|
972
974
|
port: bridgePort,
|
|
973
|
-
|
|
975
|
+
privateKey: bridgePrivateKey,
|
|
974
976
|
lastSeenEventId,
|
|
975
977
|
...sandboxId == null ? {} : { sandboxId }
|
|
976
978
|
}
|
|
@@ -1062,7 +1064,7 @@ function createSession({ sessionId, channel, proc, model, reasoningEffort, webSe
|
|
|
1062
1064
|
...sandboxCredentialEnvironment == null ? {} : { sandboxCredentialEnvironment },
|
|
1063
1065
|
bridge: {
|
|
1064
1066
|
port: bridgePort,
|
|
1065
|
-
|
|
1067
|
+
privateKey: bridgePrivateKey,
|
|
1066
1068
|
lastSeenEventId,
|
|
1067
1069
|
...sandboxId == null ? {} : { sandboxId }
|
|
1068
1070
|
}
|