@dosu/cli 0.35.2 → 0.35.4
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/bin/dosu.js +23 -12
- package/package.json +1 -1
package/bin/dosu.js
CHANGED
|
@@ -2098,17 +2098,24 @@ var init_commander = __esm(() => {
|
|
|
2098
2098
|
});
|
|
2099
2099
|
|
|
2100
2100
|
// src/config/identity.ts
|
|
2101
|
-
function
|
|
2101
|
+
function getAccessTokenClaim(accessToken, claim) {
|
|
2102
2102
|
try {
|
|
2103
2103
|
const payload = accessToken.split(".")[1];
|
|
2104
2104
|
if (!payload)
|
|
2105
2105
|
return;
|
|
2106
2106
|
const decoded = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
2107
|
-
|
|
2107
|
+
const value = decoded[claim];
|
|
2108
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
2108
2109
|
} catch {
|
|
2109
2110
|
return;
|
|
2110
2111
|
}
|
|
2111
2112
|
}
|
|
2113
|
+
function getAccessTokenUserID(accessToken) {
|
|
2114
|
+
return getAccessTokenClaim(accessToken, "sub");
|
|
2115
|
+
}
|
|
2116
|
+
function getAccessTokenOAuthClientID(accessToken) {
|
|
2117
|
+
return getAccessTokenClaim(accessToken, "client_id");
|
|
2118
|
+
}
|
|
2112
2119
|
|
|
2113
2120
|
// src/config/schema.ts
|
|
2114
2121
|
var MODE_OSS = "oss", CONFIG_SCHEMA_VERSION = 2;
|
|
@@ -2452,14 +2459,18 @@ class Client {
|
|
|
2452
2459
|
if (!session?.refresh_token)
|
|
2453
2460
|
throw new Error("no refresh token available");
|
|
2454
2461
|
const supabaseURL = getSupabaseURL();
|
|
2455
|
-
const
|
|
2462
|
+
const oauthClientID = getAccessTokenOAuthClientID(session.access_token);
|
|
2463
|
+
const endpoint = oauthClientID ? `${supabaseURL}/auth/v1/oauth/token` : `${supabaseURL}/auth/v1/token?grant_type=refresh_token`;
|
|
2464
|
+
const headers = oauthClientID ? { "Content-Type": "application/x-www-form-urlencoded" } : { "Content-Type": "application/json", apikey: getSupabaseAnonKey() };
|
|
2465
|
+
const body = oauthClientID ? new URLSearchParams({
|
|
2466
|
+
grant_type: "refresh_token",
|
|
2467
|
+
refresh_token: session.refresh_token,
|
|
2468
|
+
client_id: oauthClientID
|
|
2469
|
+
}).toString() : JSON.stringify({ refresh_token: session.refresh_token });
|
|
2456
2470
|
const resp = await fetch(endpoint, {
|
|
2457
2471
|
method: "POST",
|
|
2458
|
-
headers
|
|
2459
|
-
|
|
2460
|
-
apikey: getSupabaseAnonKey()
|
|
2461
|
-
},
|
|
2462
|
-
body: JSON.stringify({ refresh_token: session.refresh_token })
|
|
2472
|
+
headers,
|
|
2473
|
+
body
|
|
2463
2474
|
});
|
|
2464
2475
|
if (resp.status !== 200) {
|
|
2465
2476
|
throw new Error(`refresh failed with status ${resp.status}`);
|
|
@@ -4748,7 +4759,7 @@ var init_dist4 = __esm(() => {
|
|
|
4748
4759
|
function getVersionString() {
|
|
4749
4760
|
return `v${VERSION}`;
|
|
4750
4761
|
}
|
|
4751
|
-
var VERSION = "0.35.
|
|
4762
|
+
var VERSION = "0.35.4", INSTALL_CHANNEL = "npm";
|
|
4752
4763
|
|
|
4753
4764
|
// src/debug/logger.ts
|
|
4754
4765
|
import {
|
|
@@ -12391,8 +12402,8 @@ async function stepResolveDeployment(apiClient, id) {
|
|
|
12391
12402
|
const deployments = await apiClient.getDeployments();
|
|
12392
12403
|
const d = deployments.find((d2) => d2.deployment_id === id);
|
|
12393
12404
|
if (!d) {
|
|
12394
|
-
logger.warn("setup", `Deployment ${id} not
|
|
12395
|
-
log.error(
|
|
12405
|
+
logger.warn("setup", `Deployment ${id} is not accessible to the current account`);
|
|
12406
|
+
log.error("This MCP is not accessible to the current Dosu account.\nMake sure you are logged in to the correct account. Run `dosu logout`, then try again.");
|
|
12396
12407
|
return null;
|
|
12397
12408
|
}
|
|
12398
12409
|
logger.info("setup", `Resolved deployment: ${d.name}`);
|
|
@@ -13352,7 +13363,7 @@ async function resolveDeployment2(client, cfg, opts) {
|
|
|
13352
13363
|
emitError({
|
|
13353
13364
|
step: "deployment",
|
|
13354
13365
|
reason: "not_found",
|
|
13355
|
-
agent_next_steps:
|
|
13366
|
+
agent_next_steps: "The requested MCP is not accessible to the current Dosu account. " + "Make sure the user is logged in to the correct account. " + "Run 'dosu logout', then retry setup."
|
|
13356
13367
|
});
|
|
13357
13368
|
return { code: 1, cfg };
|
|
13358
13369
|
}
|