indusagi 0.13.9 → 0.13.10
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 +6 -0
- package/dist/ai.js +48 -22
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **OpenAI browser redirect**: retries the registered `localhost:1457` callback when port `1455` is unavailable, and uses the selected redirect URI for both authorization and token exchange.
|
|
7
|
+
- **Framework build dependency**: declares the `proxy-agent` package already used by the Bedrock adapter.
|
|
8
|
+
|
|
3
9
|
## [0.13.3]
|
|
4
10
|
|
|
5
11
|
### Changed
|
package/dist/ai.js
CHANGED
|
@@ -19284,6 +19284,7 @@ var CLIENT_ID2 = resolveOpenAICodexClientId();
|
|
|
19284
19284
|
var AUTHORIZE_URL2 = "https://auth.openai.com/oauth/authorize";
|
|
19285
19285
|
var TOKEN_URL2 = "https://auth.openai.com/oauth/token";
|
|
19286
19286
|
var REDIRECT_URI2 = "http://localhost:1455/auth/callback";
|
|
19287
|
+
var FALLBACK_REDIRECT_URI = "http://localhost:1457/auth/callback";
|
|
19287
19288
|
var SCOPE = "openid profile email offline_access api.connectors.read api.connectors.invoke";
|
|
19288
19289
|
var JWT_CLAIM_PATH2 = "https://api.openai.com/auth";
|
|
19289
19290
|
function createState() {
|
|
@@ -19468,27 +19469,47 @@ function startLocalOAuthServer(state) {
|
|
|
19468
19469
|
} catch {
|
|
19469
19470
|
}
|
|
19470
19471
|
};
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
);
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
},
|
|
19488
|
-
waitForCode: async () => null
|
|
19489
|
-
});
|
|
19490
|
-
});
|
|
19472
|
+
const listen = (port) => new Promise((resolve) => {
|
|
19473
|
+
const cleanup = () => {
|
|
19474
|
+
server.off("error", onError);
|
|
19475
|
+
server.off("listening", onListening);
|
|
19476
|
+
};
|
|
19477
|
+
const onError = () => {
|
|
19478
|
+
cleanup();
|
|
19479
|
+
resolve(false);
|
|
19480
|
+
};
|
|
19481
|
+
const onListening = () => {
|
|
19482
|
+
cleanup();
|
|
19483
|
+
resolve(true);
|
|
19484
|
+
};
|
|
19485
|
+
server.once("error", onError);
|
|
19486
|
+
server.once("listening", onListening);
|
|
19487
|
+
server.listen(port, "127.0.0.1");
|
|
19491
19488
|
});
|
|
19489
|
+
return (async () => {
|
|
19490
|
+
for (const [port, redirectUri] of [
|
|
19491
|
+
[1455, REDIRECT_URI2],
|
|
19492
|
+
[1457, FALLBACK_REDIRECT_URI]
|
|
19493
|
+
]) {
|
|
19494
|
+
if (await listen(port)) {
|
|
19495
|
+
return {
|
|
19496
|
+
close: closeQuietly,
|
|
19497
|
+
cancelWait: () => gate.resolve(null),
|
|
19498
|
+
redirectUri,
|
|
19499
|
+
waitForCode: () => gate.promise
|
|
19500
|
+
};
|
|
19501
|
+
}
|
|
19502
|
+
}
|
|
19503
|
+
console.error("[openai-codex] callback ports 1455 and 1457 are unavailable; using manual code entry.");
|
|
19504
|
+
gate.resolve(null);
|
|
19505
|
+
return {
|
|
19506
|
+
close: closeQuietly,
|
|
19507
|
+
cancelWait: () => {
|
|
19508
|
+
},
|
|
19509
|
+
redirectUri: REDIRECT_URI2,
|
|
19510
|
+
waitForCode: async () => null
|
|
19511
|
+
};
|
|
19512
|
+
})();
|
|
19492
19513
|
}
|
|
19493
19514
|
function getAccountId(accessToken) {
|
|
19494
19515
|
const payload = decodeJwt(accessToken);
|
|
@@ -19499,7 +19520,12 @@ function getAccountId(accessToken) {
|
|
|
19499
19520
|
async function loginOpenAICodex(options) {
|
|
19500
19521
|
const { verifier, state, url } = await createAuthorizationFlow(options.originator);
|
|
19501
19522
|
const server = await startLocalOAuthServer(state);
|
|
19502
|
-
|
|
19523
|
+
const authorizationUrl = new URL(url);
|
|
19524
|
+
authorizationUrl.searchParams.set("redirect_uri", server.redirectUri);
|
|
19525
|
+
options.onAuth({
|
|
19526
|
+
url: authorizationUrl.toString(),
|
|
19527
|
+
instructions: "Opening your browser \u2014 finish signing in there to continue."
|
|
19528
|
+
});
|
|
19503
19529
|
const codeFromPastedInput = (pasted) => {
|
|
19504
19530
|
const parsed = parseAuthorizationInput(pasted);
|
|
19505
19531
|
if (parsed.state && parsed.state !== state) {
|
|
@@ -19552,7 +19578,7 @@ async function loginOpenAICodex(options) {
|
|
|
19552
19578
|
if (!code) {
|
|
19553
19579
|
throw new Error("No authorization code was provided to complete sign-in.");
|
|
19554
19580
|
}
|
|
19555
|
-
const tokenResult = await exchangeAuthorizationCode(code, verifier);
|
|
19581
|
+
const tokenResult = await exchangeAuthorizationCode(code, verifier, server.redirectUri);
|
|
19556
19582
|
if (tokenResult.type !== "success") {
|
|
19557
19583
|
throw new Error("Could not trade the authorization code for an access token");
|
|
19558
19584
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "indusagi",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.10",
|
|
4
4
|
"description": "Indusagi — a terminal-first AI coding agent framework. Clean-room implementation.",
|
|
5
5
|
"author": "Varun Israni",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -157,6 +157,7 @@
|
|
|
157
157
|
"marked": "^18.0.4",
|
|
158
158
|
"openai": "^6.41.0",
|
|
159
159
|
"partial-json": "^0.1.7",
|
|
160
|
+
"proxy-agent": "^8.0.2",
|
|
160
161
|
"react": "^18.3.1",
|
|
161
162
|
"strip-ansi": "^7.2.0",
|
|
162
163
|
"ulid": "^3.0.2",
|