@anthonyhaussman/opencode-agy-auth 1.0.11-beta.1 → 1.0.12-alpha.0
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.js +48 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -170,7 +170,7 @@ function createAgyActivityRequestId() {
|
|
|
170
170
|
import os from "os";
|
|
171
171
|
|
|
172
172
|
// src/sdk/agy-cli-version.ts
|
|
173
|
-
var AGY_CLI_VERSION = "1.0.
|
|
173
|
+
var AGY_CLI_VERSION = "1.0.12";
|
|
174
174
|
|
|
175
175
|
// src/sdk/user-agent.ts
|
|
176
176
|
var cachedUserAgent = null;
|
|
@@ -270,6 +270,47 @@ function accessTokenExpired(auth) {
|
|
|
270
270
|
return auth.expires <= Date.now() + ACCESS_TOKEN_EXPIRY_BUFFER_MS;
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
// src/sdk/terminal-hyperlink.ts
|
|
274
|
+
var OSC8_OPEN = "\x1B]8;;";
|
|
275
|
+
var OSC8_CLOSE = "\x07";
|
|
276
|
+
function supportsOsc8Hyperlinks() {
|
|
277
|
+
if (process.stdout && !process.stdout.isTTY) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
if (process.env.OPENCODE_HEADLESS) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
const termProgram = process.env.TERM_PROGRAM?.toLowerCase() ?? "";
|
|
284
|
+
if (termProgram === "iterm.app" || termProgram === "wezterm" || termProgram === "ghostty") {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
if (process.env.KITTY_WINDOW_ID) {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
const vteVersion = parseInt(process.env.VTE_VERSION ?? "0", 10);
|
|
291
|
+
if (vteVersion >= 5e3) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
const colorTerm = process.env.COLORTERM?.toLowerCase() ?? "";
|
|
295
|
+
if (colorTerm === "truecolor" || colorTerm === "24bit") {
|
|
296
|
+
const term = process.env.TERM?.toLowerCase() ?? "";
|
|
297
|
+
if (term.startsWith("xterm") || term.startsWith("alacritty") || term === "termion") {
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
function formatHyperlink(url2, text) {
|
|
304
|
+
if (!supportsOsc8Hyperlinks()) {
|
|
305
|
+
if (text) {
|
|
306
|
+
return text === url2 ? text : `${text} (${url2})`;
|
|
307
|
+
}
|
|
308
|
+
return url2;
|
|
309
|
+
}
|
|
310
|
+
const displayText = text ?? url2;
|
|
311
|
+
return `${OSC8_OPEN}${url2}${OSC8_CLOSE}${displayText}${OSC8_OPEN}${OSC8_CLOSE}`;
|
|
312
|
+
}
|
|
313
|
+
|
|
273
314
|
// src/plugin/project/types.ts
|
|
274
315
|
var FREE_TIER_ID = "free-tier";
|
|
275
316
|
var LEGACY_TIER_ID = "legacy-tier";
|
|
@@ -412,7 +453,7 @@ async function loadManagedProject(accessToken, projectId, userAgentModel) {
|
|
|
412
453
|
}
|
|
413
454
|
const url2 = `${AGY_CODE_ASSIST_ENDPOINT}/v1internal:loadCodeAssist`;
|
|
414
455
|
if (process.env.OPENCODE_AGY_VERBOSE_LOGS === "1") {
|
|
415
|
-
console.warn(`[Agy Auth] loadManagedProject calling URL: ${url2} with project: ${projectId || "none"}`);
|
|
456
|
+
console.warn(`[Agy Auth] loadManagedProject calling URL: ${formatHyperlink(url2)} with project: ${projectId || "none"}`);
|
|
416
457
|
}
|
|
417
458
|
const headers = buildCodeAssistHeaders2(accessToken, userAgentModel);
|
|
418
459
|
const response = await agyFetch(url2, {
|
|
@@ -422,7 +463,7 @@ async function loadManagedProject(accessToken, projectId, userAgentModel) {
|
|
|
422
463
|
});
|
|
423
464
|
if (!response.ok) {
|
|
424
465
|
if (response.status === 403 || response.status === 404) {
|
|
425
|
-
console.warn(`[Agy Auth] loadManagedProject failed with ${response.status} (possible Cloud API mismatch/unauthorized). URL: ${url2}, Project: ${projectId}`);
|
|
466
|
+
console.warn(`[Agy Auth] loadManagedProject failed with ${response.status} (possible Cloud API mismatch/unauthorized). URL: ${formatHyperlink(url2)}, Project: ${projectId}`);
|
|
426
467
|
const responseText = await readResponseTextIfNeeded(response, true);
|
|
427
468
|
if (responseText && isVpcScError(responseText)) {
|
|
428
469
|
console.warn(`[Agy Auth] loadManagedProject: Detected VPC Service Controls block`);
|
|
@@ -455,7 +496,7 @@ async function onboardManagedProject(accessToken, tierId, projectId, userAgentMo
|
|
|
455
496
|
const baseUrl = `${AGY_CODE_ASSIST_ENDPOINT}/v1internal`;
|
|
456
497
|
const onboardUrl = `${baseUrl}:onboardUser`;
|
|
457
498
|
if (process.env.OPENCODE_AGY_VERBOSE_LOGS === "1") {
|
|
458
|
-
console.warn(`[Agy Auth] onboardManagedProject calling URL: ${onboardUrl} with project: ${projectId || "none"}`);
|
|
499
|
+
console.warn(`[Agy Auth] onboardManagedProject calling URL: ${formatHyperlink(onboardUrl)} with project: ${projectId || "none"}`);
|
|
459
500
|
}
|
|
460
501
|
try {
|
|
461
502
|
const response = await fetchWithDebug(
|
|
@@ -16724,7 +16765,7 @@ function rewriteGeminiPreviewAccessError(body, status, requestedModel) {
|
|
|
16724
16765
|
const error45 = body.error ?? {};
|
|
16725
16766
|
const trimmedMessage = typeof error45.message === "string" ? error45.message.trim() : "";
|
|
16726
16767
|
const messagePrefix = trimmedMessage.length > 0 ? trimmedMessage : "Gemini 3 preview features are not enabled for this account.";
|
|
16727
|
-
const enhancedMessage = `${messagePrefix} Request preview access at ${GEMINI_PREVIEW_LINK} before using Gemini 3 models.`;
|
|
16768
|
+
const enhancedMessage = `${messagePrefix} Request preview access at ${formatHyperlink(GEMINI_PREVIEW_LINK, "preview access page")} before using Gemini 3 models.`;
|
|
16728
16769
|
return {
|
|
16729
16770
|
...body,
|
|
16730
16771
|
error: {
|
|
@@ -16745,8 +16786,8 @@ function enhanceGeminiErrorResponse(body, status) {
|
|
|
16745
16786
|
if (validationInfo) {
|
|
16746
16787
|
const message = [
|
|
16747
16788
|
error45.message ?? "Account validation required for Gemini/Agy Code Assist.",
|
|
16748
|
-
validationInfo.link ? `Complete validation: ${validationInfo.link}` : void 0,
|
|
16749
|
-
validationInfo.learnMore ? `Learn more: ${validationInfo.learnMore}` : void 0
|
|
16789
|
+
validationInfo.link ? `Complete validation: ${formatHyperlink(validationInfo.link, "validation page")}` : void 0,
|
|
16790
|
+
validationInfo.learnMore ? `Learn more: ${formatHyperlink(validationInfo.learnMore, "help article")}` : void 0
|
|
16750
16791
|
].filter(Boolean).join(" ");
|
|
16751
16792
|
return {
|
|
16752
16793
|
body: {
|