replicas-cli 0.3.46 → 0.3.47
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.cjs +11 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28449,7 +28449,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
28449
28449
|
});
|
|
28450
28450
|
|
|
28451
28451
|
// ../shared/src/cli-version.ts
|
|
28452
|
-
var CLI_VERSION = "0.3.
|
|
28452
|
+
var CLI_VERSION = "0.3.47";
|
|
28453
28453
|
|
|
28454
28454
|
// ../shared/src/version.ts
|
|
28455
28455
|
function compareVersions(v1, v2) {
|
|
@@ -30757,10 +30757,11 @@ var import_readline = __toESM(require("readline"));
|
|
|
30757
30757
|
var import_chalk15 = __toESM(require("chalk"));
|
|
30758
30758
|
var DEFAULT_CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
|
|
30759
30759
|
var CLAUDE_CLIENT_ID = process.env.CLAUDE_OAUTH_CLIENT_ID || DEFAULT_CLIENT_ID;
|
|
30760
|
-
var AUTHORIZATION_ENDPOINT2 = "https://claude.
|
|
30761
|
-
var TOKEN_ENDPOINT2 = "https://
|
|
30762
|
-
var REDIRECT_URI = "https://
|
|
30763
|
-
var SCOPES = "
|
|
30760
|
+
var AUTHORIZATION_ENDPOINT2 = "https://claude.com/cai/oauth/authorize";
|
|
30761
|
+
var TOKEN_ENDPOINT2 = "https://platform.claude.com/v1/oauth/token";
|
|
30762
|
+
var REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
|
|
30763
|
+
var SCOPES = "user:inference";
|
|
30764
|
+
var TOKEN_LIFETIME_SECONDS = 365 * 24 * 60 * 60;
|
|
30764
30765
|
function buildAuthorizationUrl2(codeChallenge, state) {
|
|
30765
30766
|
const params = new URLSearchParams({
|
|
30766
30767
|
code: "true",
|
|
@@ -30819,7 +30820,8 @@ async function exchangeCodeForTokens2(code, state, expectedState, codeVerifier)
|
|
|
30819
30820
|
grant_type: "authorization_code",
|
|
30820
30821
|
client_id: CLAUDE_CLIENT_ID,
|
|
30821
30822
|
redirect_uri: REDIRECT_URI,
|
|
30822
|
-
code_verifier: codeVerifier
|
|
30823
|
+
code_verifier: codeVerifier,
|
|
30824
|
+
expires_in: TOKEN_LIFETIME_SECONDS
|
|
30823
30825
|
};
|
|
30824
30826
|
const response = await fetch(TOKEN_ENDPOINT2, {
|
|
30825
30827
|
method: "POST",
|
|
@@ -30833,16 +30835,12 @@ async function exchangeCodeForTokens2(code, state, expectedState, codeVerifier)
|
|
|
30833
30835
|
throw new Error(`Failed to exchange authorization code: ${response.status} ${text2}`);
|
|
30834
30836
|
}
|
|
30835
30837
|
const data = await response.json();
|
|
30836
|
-
const now = Date.now();
|
|
30837
|
-
const expiresAt = new Date(now + data.expires_in * 1e3).toISOString();
|
|
30838
|
-
const refreshTokenExpiresAt = data.refresh_token_expires_in ? new Date(now + data.refresh_token_expires_in * 1e3).toISOString() : void 0;
|
|
30839
30838
|
return {
|
|
30840
30839
|
accessToken: data.access_token,
|
|
30841
|
-
refreshToken: data.refresh_token,
|
|
30842
30840
|
tokenType: data.token_type,
|
|
30843
30841
|
scope: data.scope,
|
|
30844
|
-
expiresAt,
|
|
30845
|
-
|
|
30842
|
+
expiresAt: new Date(Date.now() + (data.expires_in ?? TOKEN_LIFETIME_SECONDS) * 1e3).toISOString(),
|
|
30843
|
+
accountEmail: data.account?.email_address
|
|
30846
30844
|
};
|
|
30847
30845
|
}
|
|
30848
30846
|
async function runClaudeOAuthFlow(totalSteps) {
|
|
@@ -30878,11 +30876,10 @@ async function claudeAuthCommand(options = {}) {
|
|
|
30878
30876
|
},
|
|
30879
30877
|
toRequestBody: (tokens) => ({
|
|
30880
30878
|
access_token: tokens.accessToken,
|
|
30881
|
-
refresh_token: tokens.refreshToken,
|
|
30882
30879
|
token_type: tokens.tokenType,
|
|
30883
30880
|
scope: tokens.scope,
|
|
30884
30881
|
expires_at: tokens.expiresAt,
|
|
30885
|
-
|
|
30882
|
+
account_email: tokens.accountEmail
|
|
30886
30883
|
})
|
|
30887
30884
|
});
|
|
30888
30885
|
}
|