@anvil-works/anvil-cli 0.8.0-canary.12 → 0.8.0-canary.13
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/api.d.ts +5 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/cli.js +174 -27
- package/dist/commands/configure.d.ts.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/modelToken.d.ts +33 -0
- package/dist/commands/modelToken.d.ts.map +1 -0
- package/dist/errors.d.ts +11 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.js +237 -18
- package/dist/services/auth.d.ts +35 -2
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/git-auth.d.ts +35 -0
- package/dist/services/git-auth.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -7,13 +7,17 @@ export type { WatchDiagnosticEventName, WatchDiagnosticEventPayload, WatchSessio
|
|
|
7
7
|
export { branchFromEnvironmentVersion, readEnvironmentPid, requireEnvironmentBranch, writeEnvironmentPid, } from "./environment";
|
|
8
8
|
export type { AnvilEnvironmentBinding, AnvilEnvironmentVersion, EnvBranchChangeMode } from "./environment";
|
|
9
9
|
export { AppIdCandidate, AppIdWithContext, CheckoutAppListItem, detectAppIdsByCommitLookup, detectAppIdsFromAllRemotes, filterCandidates, formatCandidateLabel, getGitFetchUrl, getGitPushUrl, getLatestVersion, getWebSocketUrl, listAppsForCheckout, lookupRemoteInfoForAppId, lookupByCommit, saveUpdates, ValidateAppIdResponse, validateAppId, } from "./services/anvil-api";
|
|
10
|
-
export { ANVIL_SYNC_CLIENT_ID, getAccountsForUrl, getAvailableAnvilUrls, getValidAuthToken, hasTokensForUrl, verifyAndStoreTokens, LoginResult, LogoutResult, logout, TokenData, clearInMemoryTokens, setInMemoryTokens, verifyAuth, } from "./services/auth";
|
|
10
|
+
export { ANVIL_SYNC_CLIENT_ID, getAccountsForUrl, getAvailableAnvilUrls, getValidAuthToken, GetValidAuthTokenOptions, hasTokensForUrl, REFRESH_REQUEST_TIMEOUT_MS, verifyAndStoreTokens, LoginResult, LogoutResult, logout, TokenData, clearInMemoryTokens, setInMemoryTokens, verifyAuth, } from "./services/auth";
|
|
11
11
|
export { DeviceAuthorizationResponse, OAuthTokenResponse, pollDeviceAuthorization, requestDeviceAuthorization, } from "./services/oauth-login";
|
|
12
12
|
export { CheckoutCloneOptions, CheckoutExecutionDeps, CheckoutOptions, CheckoutResult, executeCheckout, getDefaultDestinationDirectory, isDirectoryNonEmpty, isPathInsideGitRepo, parseCheckoutInput, ParsedCheckoutInput, sanitizeDirectoryName, validateCheckoutDestination, } from "./commands/checkout";
|
|
13
13
|
export { createCheckoutPickerSource, type CheckoutPickerDeps, type CheckoutPickerSourceController, type CheckoutPickerSourceOptions, } from "./commands/checkout-picker";
|
|
14
14
|
export { buildGitAuthDoctorReport, formatGitAuthDoctorReport, inspectCredentialHelperCommand, parseCredentialHelperCommand, } from "./commands/gitAuth";
|
|
15
15
|
export type { CredentialFillResult, GitAuthDoctorAppReport, GitAuthDoctorFinding, GitAuthDoctorRemote, GitAuthDoctorReport, GitAuthDoctorStatus, GitCredentialHelperDetails, GitCredentialSimulation, InspectCredentialHelperOptions, } from "./commands/gitAuth";
|
|
16
16
|
export { executeGitCredentialOperation } from "./commands/gitCredential";
|
|
17
|
+
export { executeModelTokenOperation, getModelToken, MODEL_TOKEN_LOCK_TIMEOUT_MS } from "./commands/modelToken";
|
|
18
|
+
export type { ModelTokenDeps, ModelTokenOptions } from "./commands/modelToken";
|
|
19
|
+
export { AUTH_FILE_LOCK_DEFAULTS, getModelTokenHelperScript, installModelTokenHelperScript, MODEL_TOKEN_HELPER_FILENAME, withRepoAuthFileLock, } from "./services/git-auth";
|
|
20
|
+
export type { AuthFileLockOptions } from "./services/git-auth";
|
|
17
21
|
export { deleteConfig, getAllConfig, getConfig, getInstalledPreferredEditors, getPreferredEditorCommand, getSettableConfigKeys, isCommandAvailable, normalizeAnvilUrl, parseConfigSetValue, preferredEditors, PreferredEditor, resetConfig, resolveAnvilUrl, setAuthTokensForAccount, setConfig, SettableConfigKey, } from "./config";
|
|
18
22
|
export { BranchSyncStatus, ValidateBranchSyncStatusOptions, validateAnvilApp, validateBranchSyncStatus, } from "./services/validation";
|
|
19
23
|
export { AnvilYamlValidationResult, FormTemplateValidationResult, ValidatePathResult, ValidationTarget, ValidationIssue, formatValidationPath, validatePath, validateAnvilYaml, validateFormTemplate, } from "./validators";
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAkB,QAAQ,EAAgB,MAAM,UAAU,CAAC;AAI7E,OAAO,EAA4B,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EAQtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAChH,OAAO,EACH,4BAA4B,EAC5B,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACtB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAG3G,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,WAAW,EACX,qBAAqB,EACrB,aAAa,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,o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ACrB;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAMD;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsB3F;AAMD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CA2BjH;AAMD;;;GAGG;AACH,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CA8J9G"}
|
package/dist/cli.js
CHANGED
|
@@ -13384,9 +13384,10 @@ var __webpack_exports__ = {};
|
|
|
13384
13384
|
type: "auth_invalid",
|
|
13385
13385
|
message
|
|
13386
13386
|
}),
|
|
13387
|
-
refreshFailed: (message)=>({
|
|
13387
|
+
refreshFailed: (message, status)=>({
|
|
13388
13388
|
type: "token_refresh_failed",
|
|
13389
|
-
message
|
|
13389
|
+
message,
|
|
13390
|
+
status
|
|
13390
13391
|
})
|
|
13391
13392
|
};
|
|
13392
13393
|
const createAppError = {
|
|
@@ -13600,6 +13601,19 @@ var __webpack_exports__ = {};
|
|
|
13600
13601
|
return "An unknown error occurred";
|
|
13601
13602
|
}
|
|
13602
13603
|
}
|
|
13604
|
+
function getErrorCauseMessage(error) {
|
|
13605
|
+
if ("object" != typeof error || null === error || !("cause" in error)) return null;
|
|
13606
|
+
const cause = error.cause;
|
|
13607
|
+
if (null == cause) return null;
|
|
13608
|
+
const message = errors_getErrorMessage(cause);
|
|
13609
|
+
const code = "object" == typeof cause && null !== cause && "code" in cause && "string" == typeof cause.code ? cause.code : null;
|
|
13610
|
+
if (code && !message.includes(code)) return `${message} (${code})`;
|
|
13611
|
+
return message;
|
|
13612
|
+
}
|
|
13613
|
+
function logErrorCause(error, ui) {
|
|
13614
|
+
const causeMessage = getErrorCauseMessage(error);
|
|
13615
|
+
if (causeMessage) ui.verbose(`Cause: ${causeMessage}`);
|
|
13616
|
+
}
|
|
13603
13617
|
const external_module_namespaceObject = require("module");
|
|
13604
13618
|
const requireFromHere = (0, external_module_namespaceObject.createRequire)(__filename);
|
|
13605
13619
|
const GIT_CREDENTIAL_HELPER_FILENAME = "anvil-credential-helper.cjs";
|
|
@@ -13820,6 +13834,76 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13820
13834
|
function getAuthFilePath(gitDir) {
|
|
13821
13835
|
return external_path_default().join(gitDir, "anvil-auth.json");
|
|
13822
13836
|
}
|
|
13837
|
+
const AUTH_FILE_LOCK_DEFAULTS = {
|
|
13838
|
+
staleMs: 30000,
|
|
13839
|
+
timeoutMs: 60000,
|
|
13840
|
+
retryDelayMs: 100,
|
|
13841
|
+
heartbeatMs: 5000
|
|
13842
|
+
};
|
|
13843
|
+
function git_auth_delay(ms) {
|
|
13844
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
13845
|
+
}
|
|
13846
|
+
async function acquireAuthFileLock(lockPath, options) {
|
|
13847
|
+
const deadline = Date.now() + options.timeoutMs;
|
|
13848
|
+
while(true){
|
|
13849
|
+
try {
|
|
13850
|
+
const handle = await external_fs_.promises.open(lockPath, "wx", 384);
|
|
13851
|
+
try {
|
|
13852
|
+
await handle.writeFile(JSON.stringify({
|
|
13853
|
+
pid: process.pid,
|
|
13854
|
+
acquiredAt: new Date().toISOString()
|
|
13855
|
+
}));
|
|
13856
|
+
} finally{
|
|
13857
|
+
await handle.close();
|
|
13858
|
+
}
|
|
13859
|
+
return;
|
|
13860
|
+
} catch (e) {
|
|
13861
|
+
if ("EEXIST" !== e.code) throw e;
|
|
13862
|
+
}
|
|
13863
|
+
try {
|
|
13864
|
+
const lockStat = await external_fs_.promises.stat(lockPath);
|
|
13865
|
+
if (Date.now() - lockStat.mtimeMs > options.staleMs) {
|
|
13866
|
+
await external_fs_.promises.rm(lockPath, {
|
|
13867
|
+
force: true
|
|
13868
|
+
});
|
|
13869
|
+
continue;
|
|
13870
|
+
}
|
|
13871
|
+
} catch {
|
|
13872
|
+
continue;
|
|
13873
|
+
}
|
|
13874
|
+
if (Date.now() >= deadline) throw new Error(`Timed out waiting for the Anvil auth file lock at ${lockPath}`);
|
|
13875
|
+
await git_auth_delay(options.retryDelayMs);
|
|
13876
|
+
}
|
|
13877
|
+
}
|
|
13878
|
+
async function withRepoAuthFileLock(repoPath, fn, options) {
|
|
13879
|
+
const gitDir = await getRepositoryGitDir(repoPath);
|
|
13880
|
+
const lockPath = `${getAuthFilePath(gitDir)}.lock`;
|
|
13881
|
+
const lockOptions = {
|
|
13882
|
+
...AUTH_FILE_LOCK_DEFAULTS,
|
|
13883
|
+
...options
|
|
13884
|
+
};
|
|
13885
|
+
await external_fs_.promises.mkdir(external_path_default().dirname(lockPath), {
|
|
13886
|
+
recursive: true
|
|
13887
|
+
});
|
|
13888
|
+
await acquireAuthFileLock(lockPath, lockOptions);
|
|
13889
|
+
const heartbeat = startAuthFileLockHeartbeat(lockPath, lockOptions.heartbeatMs);
|
|
13890
|
+
try {
|
|
13891
|
+
return await fn();
|
|
13892
|
+
} finally{
|
|
13893
|
+
clearInterval(heartbeat);
|
|
13894
|
+
await external_fs_.promises.rm(lockPath, {
|
|
13895
|
+
force: true
|
|
13896
|
+
});
|
|
13897
|
+
}
|
|
13898
|
+
}
|
|
13899
|
+
function startAuthFileLockHeartbeat(lockPath, heartbeatMs) {
|
|
13900
|
+
const heartbeat = setInterval(()=>{
|
|
13901
|
+
const now = new Date();
|
|
13902
|
+
external_fs_.promises.utimes(lockPath, now, now).catch(()=>{});
|
|
13903
|
+
}, heartbeatMs);
|
|
13904
|
+
heartbeat.unref();
|
|
13905
|
+
return heartbeat;
|
|
13906
|
+
}
|
|
13823
13907
|
function decodeKey(b64key) {
|
|
13824
13908
|
const key = Buffer.from(b64key, "base64");
|
|
13825
13909
|
if (32 !== key.length) throw new Error("Encryption key must be a base64-encoded 32-byte key");
|
|
@@ -13864,10 +13948,19 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13864
13948
|
recursive: true
|
|
13865
13949
|
});
|
|
13866
13950
|
const authJson = JSON.stringify(auth, null, 2);
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
|
|
13951
|
+
const tempFilePath = `${authFilePath}.tmp-${external_node_crypto_default().randomBytes(6).toString("hex")}`;
|
|
13952
|
+
try {
|
|
13953
|
+
await external_fs_.promises.writeFile(tempFilePath, encrypt(authJson, encryptionKey), {
|
|
13954
|
+
mode: 384
|
|
13955
|
+
});
|
|
13956
|
+
await external_fs_.promises.chmod(tempFilePath, 448);
|
|
13957
|
+
await external_fs_.promises.rename(tempFilePath, authFilePath);
|
|
13958
|
+
} catch (e) {
|
|
13959
|
+
await external_fs_.promises.rm(tempFilePath, {
|
|
13960
|
+
force: true
|
|
13961
|
+
});
|
|
13962
|
+
throw e;
|
|
13963
|
+
}
|
|
13871
13964
|
await git.raw([
|
|
13872
13965
|
"config",
|
|
13873
13966
|
"--local",
|
|
@@ -13876,7 +13969,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13876
13969
|
]);
|
|
13877
13970
|
return authFilePath;
|
|
13878
13971
|
}
|
|
13879
|
-
const
|
|
13972
|
+
const git_auth_readAuthFromRepo = async (repoPath)=>{
|
|
13880
13973
|
const git = esm_default(repoPath);
|
|
13881
13974
|
const gitDir = await getRepositoryGitDir(repoPath, git);
|
|
13882
13975
|
const authFilePath = getAuthFilePath(gitDir);
|
|
@@ -13889,12 +13982,13 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13889
13982
|
return resolveAnvilUrl();
|
|
13890
13983
|
}
|
|
13891
13984
|
const ANVIL_SYNC_CLIENT_ID = "anvil-sync";
|
|
13985
|
+
const REFRESH_REQUEST_TIMEOUT_MS = 12000;
|
|
13892
13986
|
let inMemoryAuth = null;
|
|
13893
13987
|
function authMatches(auth, anvilUrl, username) {
|
|
13894
13988
|
return auth.anvilUrl === normalizeAnvilUrl(anvilUrl) && (!username || auth.username === username);
|
|
13895
13989
|
}
|
|
13896
13990
|
let repoContext = null;
|
|
13897
|
-
function
|
|
13991
|
+
function auth_setRepoContext(repoPath) {
|
|
13898
13992
|
repoContext = repoPath;
|
|
13899
13993
|
}
|
|
13900
13994
|
const inFlightRefreshes = new Map();
|
|
@@ -13917,7 +14011,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13917
14011
|
throw errors_createAuthError.invalid(`Network error: ${e.message}`);
|
|
13918
14012
|
}
|
|
13919
14013
|
}
|
|
13920
|
-
async function refreshAccessToken(refreshToken, anvilUrl = getDefaultAnvilUrl(), clientId = ANVIL_SYNC_CLIENT_ID) {
|
|
14014
|
+
async function refreshAccessToken(refreshToken, anvilUrl = getDefaultAnvilUrl(), clientId = ANVIL_SYNC_CLIENT_ID, options) {
|
|
13921
14015
|
try {
|
|
13922
14016
|
const tokenResponse = await fetch(`${anvilUrl}/oauth/token`, {
|
|
13923
14017
|
method: "POST",
|
|
@@ -13928,11 +14022,12 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13928
14022
|
grant_type: "refresh_token",
|
|
13929
14023
|
refresh_token: refreshToken,
|
|
13930
14024
|
client_id: clientId
|
|
13931
|
-
})
|
|
14025
|
+
}),
|
|
14026
|
+
signal: AbortSignal.timeout(options?.timeoutMs ?? REFRESH_REQUEST_TIMEOUT_MS)
|
|
13932
14027
|
});
|
|
13933
14028
|
if (!tokenResponse.ok) {
|
|
13934
14029
|
const errorText = await tokenResponse.text();
|
|
13935
|
-
throw errors_createAuthError.refreshFailed(`Failed to refresh token: ${tokenResponse.status} ${errorText}
|
|
14030
|
+
throw errors_createAuthError.refreshFailed(`Failed to refresh token: ${tokenResponse.status} ${errorText}`, tokenResponse.status);
|
|
13936
14031
|
}
|
|
13937
14032
|
const tokenData = await tokenResponse.json();
|
|
13938
14033
|
return tokenData;
|
|
@@ -13944,22 +14039,21 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13944
14039
|
async function hasTokensForUrl(anvilUrl, username) {
|
|
13945
14040
|
if (inMemoryAuth) return authMatches(inMemoryAuth, anvilUrl, username);
|
|
13946
14041
|
{
|
|
13947
|
-
const repoAuth = repoContext ? await
|
|
14042
|
+
const repoAuth = repoContext ? await git_auth_readAuthFromRepo(repoContext) : void 0;
|
|
13948
14043
|
if (repoAuth && authMatches(repoAuth, anvilUrl, username)) return true;
|
|
13949
14044
|
return hasTokens(anvilUrl, username);
|
|
13950
14045
|
}
|
|
13951
14046
|
}
|
|
13952
|
-
async function auth_getValidAuthToken(anvilUrl = getDefaultAnvilUrl(), username) {
|
|
14047
|
+
async function auth_getValidAuthToken(anvilUrl = getDefaultAnvilUrl(), username, options) {
|
|
13953
14048
|
const normalized = normalizeAnvilUrl(anvilUrl);
|
|
13954
14049
|
const source = await resolveTokenSource(normalized, username);
|
|
13955
14050
|
const tokens = getSourceTokens(source);
|
|
13956
14051
|
if (!tokens.authToken && !tokens.refreshToken) throw errors_createAuthError.required("Not logged in. Please log in first.");
|
|
13957
|
-
|
|
13958
|
-
if (tokens.refreshToken && isExpired) {
|
|
14052
|
+
if (tokens.refreshToken && isAccessTokenExpired(tokens)) {
|
|
13959
14053
|
const refreshKey = getRefreshKey(normalized, username, source, tokens.refreshToken);
|
|
13960
14054
|
const existingRefresh = inFlightRefreshes.get(refreshKey);
|
|
13961
14055
|
if (existingRefresh) return existingRefresh;
|
|
13962
|
-
const refreshPromise = refreshAndStoreAccessToken(normalized, username, source, tokens.refreshToken).finally(()=>{
|
|
14056
|
+
const refreshPromise = refreshAndStoreAccessToken(normalized, username, source, tokens.refreshToken, options).finally(()=>{
|
|
13963
14057
|
inFlightRefreshes.delete(refreshKey);
|
|
13964
14058
|
});
|
|
13965
14059
|
inFlightRefreshes.set(refreshKey, refreshPromise);
|
|
@@ -13973,7 +14067,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13973
14067
|
type: "memory",
|
|
13974
14068
|
auth: inMemoryAuth
|
|
13975
14069
|
};
|
|
13976
|
-
const repoAuth = repoContext ? await
|
|
14070
|
+
const repoAuth = repoContext ? await git_auth_readAuthFromRepo(repoContext) : void 0;
|
|
13977
14071
|
if (repoAuth && authMatches(repoAuth, normalizedUrl, username)) return {
|
|
13978
14072
|
type: "repo",
|
|
13979
14073
|
auth: repoAuth,
|
|
@@ -13989,6 +14083,9 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13989
14083
|
function getSourceTokens(source) {
|
|
13990
14084
|
return "store" === source.type ? source.tokens : source.auth.tokens;
|
|
13991
14085
|
}
|
|
14086
|
+
function isAccessTokenExpired(tokens) {
|
|
14087
|
+
return null !== tokens.authTokenExpiresAt && tokens.authTokenExpiresAt <= Math.floor(Date.now() / 1000) + 60;
|
|
14088
|
+
}
|
|
13992
14089
|
function getStoreAccountUsername(normalizedUrl, username, refreshToken) {
|
|
13993
14090
|
if (username) return username;
|
|
13994
14091
|
const urlTokens = getUrlTokens(normalizedUrl);
|
|
@@ -14007,11 +14104,43 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14007
14104
|
return `store:${normalizedUrl}:${source.accountUsername ?? username ?? refreshToken}`;
|
|
14008
14105
|
}
|
|
14009
14106
|
}
|
|
14010
|
-
async function refreshAndStoreAccessToken(normalizedUrl, username, source, refreshToken) {
|
|
14107
|
+
async function refreshAndStoreAccessToken(normalizedUrl, username, source, refreshToken, options) {
|
|
14108
|
+
if ("repo" === source.type) return refreshRepoAuthTokens(source.repoPath, {
|
|
14109
|
+
anvilUrl: normalizedUrl,
|
|
14110
|
+
username,
|
|
14111
|
+
auth: source.auth,
|
|
14112
|
+
refreshToken,
|
|
14113
|
+
lock: options?.lock,
|
|
14114
|
+
requestTimeoutMs: options?.requestTimeoutMs
|
|
14115
|
+
});
|
|
14116
|
+
return performTokenRefresh(normalizedUrl, username, source, refreshToken, options?.requestTimeoutMs);
|
|
14117
|
+
}
|
|
14118
|
+
async function refreshRepoAuthTokens(repoPath, options) {
|
|
14119
|
+
const normalizedUrl = normalizeAnvilUrl(options.anvilUrl);
|
|
14120
|
+
return withRepoAuthFileLock(repoPath, async ()=>{
|
|
14121
|
+
let auth = options.auth;
|
|
14122
|
+
let refreshToken = options.refreshToken;
|
|
14123
|
+
const current = await git_auth_readAuthFromRepo(repoPath);
|
|
14124
|
+
if (current && authMatches(current, normalizedUrl, options.username)) {
|
|
14125
|
+
if (current.tokens.authToken && !isAccessTokenExpired(current.tokens)) return current.tokens.authToken;
|
|
14126
|
+
auth = current;
|
|
14127
|
+
refreshToken = current.tokens.refreshToken ?? refreshToken;
|
|
14128
|
+
}
|
|
14129
|
+
if (!auth || !refreshToken) throw errors_createAuthError.required("No repo auth tokens available to refresh.");
|
|
14130
|
+
return performTokenRefresh(normalizedUrl, options.username, {
|
|
14131
|
+
type: "repo",
|
|
14132
|
+
auth,
|
|
14133
|
+
repoPath
|
|
14134
|
+
}, refreshToken, options.requestTimeoutMs);
|
|
14135
|
+
}, options.lock);
|
|
14136
|
+
}
|
|
14137
|
+
async function performTokenRefresh(normalizedUrl, username, source, refreshToken, requestTimeoutMs) {
|
|
14011
14138
|
try {
|
|
14012
14139
|
const tokens = getSourceTokens(source);
|
|
14013
14140
|
const clientId = tokens.clientId ?? ANVIL_SYNC_CLIENT_ID;
|
|
14014
|
-
const tokenData = await refreshAccessToken(refreshToken, normalizedUrl, clientId
|
|
14141
|
+
const tokenData = await refreshAccessToken(refreshToken, normalizedUrl, clientId, {
|
|
14142
|
+
timeoutMs: requestTimeoutMs
|
|
14143
|
+
});
|
|
14015
14144
|
const newTokens = {
|
|
14016
14145
|
authToken: tokenData.access_token,
|
|
14017
14146
|
refreshToken: tokenData.refresh_token,
|
|
@@ -14033,12 +14162,28 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14033
14162
|
}
|
|
14034
14163
|
return tokenData.access_token;
|
|
14035
14164
|
} catch (e) {
|
|
14165
|
+
if ("repo" === source.type && isRefreshTokenRejection(e)) await clearRepoAuthTokens(source.repoPath, source.auth).catch(()=>{});
|
|
14036
14166
|
await clearTokensForAccount(normalizedUrl, username, refreshToken);
|
|
14037
14167
|
throw e;
|
|
14038
14168
|
}
|
|
14039
14169
|
}
|
|
14170
|
+
function isRefreshTokenRejection(e) {
|
|
14171
|
+
const error = e;
|
|
14172
|
+
return error?.type === "token_refresh_failed" && (400 === error.status || 401 === error.status);
|
|
14173
|
+
}
|
|
14174
|
+
async function clearRepoAuthTokens(repoPath, auth) {
|
|
14175
|
+
const encryptionKey = process.env["ANVIL_AUTH_FILE_ENCRYPTION_KEY"];
|
|
14176
|
+
if (!encryptionKey) return;
|
|
14177
|
+
auth.tokens = {
|
|
14178
|
+
authToken: null,
|
|
14179
|
+
refreshToken: null,
|
|
14180
|
+
authTokenExpiresAt: null,
|
|
14181
|
+
clientId: auth.tokens.clientId
|
|
14182
|
+
};
|
|
14183
|
+
await writeAuthToFile(repoPath, auth, encryptionKey);
|
|
14184
|
+
}
|
|
14040
14185
|
async function clearTokensForAccount(url, username, refreshToken) {
|
|
14041
|
-
if (inMemoryAuth || repoContext && await
|
|
14186
|
+
if (inMemoryAuth || repoContext && await git_auth_readAuthFromRepo(repoContext)) return;
|
|
14042
14187
|
{
|
|
14043
14188
|
const normalized = normalizeAnvilUrl(url);
|
|
14044
14189
|
if (username) deleteAccountTokens(normalized, username);
|
|
@@ -14068,7 +14213,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14068
14213
|
loggedOut: false,
|
|
14069
14214
|
message: "Cannot log out when using in-memory auth tokens"
|
|
14070
14215
|
};
|
|
14071
|
-
if (repoContext && await
|
|
14216
|
+
if (repoContext && await git_auth_readAuthFromRepo(repoContext)) return {
|
|
14072
14217
|
loggedOut: false,
|
|
14073
14218
|
message: "Cannot log out when using auth tokens stored in the local git config."
|
|
14074
14219
|
};
|
|
@@ -14099,7 +14244,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14099
14244
|
inMemoryAuth.username
|
|
14100
14245
|
] : [];
|
|
14101
14246
|
{
|
|
14102
|
-
const repoAuth = repoContext ? await
|
|
14247
|
+
const repoAuth = repoContext ? await git_auth_readAuthFromRepo(repoContext) : void 0;
|
|
14103
14248
|
if (repoAuth && authMatches(repoAuth, url)) return [
|
|
14104
14249
|
repoAuth.username
|
|
14105
14250
|
];
|
|
@@ -14111,7 +14256,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14111
14256
|
inMemoryAuth.anvilUrl
|
|
14112
14257
|
];
|
|
14113
14258
|
{
|
|
14114
|
-
const repoAuth = repoContext ? await
|
|
14259
|
+
const repoAuth = repoContext ? await git_auth_readAuthFromRepo(repoContext) : void 0;
|
|
14115
14260
|
if (repoAuth) return [
|
|
14116
14261
|
repoAuth.anvilUrl
|
|
14117
14262
|
];
|
|
@@ -21577,7 +21722,7 @@ print(json.dumps({"issues": issues}))
|
|
|
21577
21722
|
])).trim();
|
|
21578
21723
|
const resolvedGitCommonDir = external_path_default().isAbsolute(rawGitCommonDir) ? rawGitCommonDir : external_path_default().resolve(inputPath, rawGitCommonDir);
|
|
21579
21724
|
const gitCommonDir = external_fs_default().realpathSync(resolvedGitCommonDir);
|
|
21580
|
-
|
|
21725
|
+
auth_setRepoContext(repoPath);
|
|
21581
21726
|
const remotes = (await git.getRemotes(true)).map(detectAnvilRemote);
|
|
21582
21727
|
const anvilRemotes = remotes.filter((remote)=>remote.appId && remote.anvilUrl && "https" === remote.transport);
|
|
21583
21728
|
const findings = [];
|
|
@@ -21703,7 +21848,7 @@ print(json.dumps({"issues": issues}))
|
|
|
21703
21848
|
const repoPath = options.repoPath ?? deps.cwd();
|
|
21704
21849
|
if ("get" !== operation) return null;
|
|
21705
21850
|
if (!request.protocol || !request.host) return null;
|
|
21706
|
-
|
|
21851
|
+
auth_setRepoContext(repoPath);
|
|
21707
21852
|
const appId = parseAppIdFromGitPath(request.path);
|
|
21708
21853
|
if (!appId) return null;
|
|
21709
21854
|
const requestUrl = normalizeAnvilUrl(`${request.protocol}://${request.host}`);
|
|
@@ -21785,7 +21930,7 @@ print(json.dumps({"issues": issues}))
|
|
|
21785
21930
|
async function watch(repoPath, appId, options = {}) {
|
|
21786
21931
|
const { anvilUrl = DEFAULT_ANVIL_URL, gitUrl = anvilUrl, stagedOnly = false, username } = options;
|
|
21787
21932
|
repoPath = external_path_default().resolve(repoPath);
|
|
21788
|
-
|
|
21933
|
+
auth_setRepoContext(repoPath);
|
|
21789
21934
|
const storedEnvPid = options.environment?.envPid ? void 0 : await readEnvironmentPid(repoPath);
|
|
21790
21935
|
const environment = options.environment ?? (storedEnvPid ? {
|
|
21791
21936
|
envPid: storedEnvPid
|
|
@@ -22573,7 +22718,7 @@ print(json.dumps({"issues": issues}))
|
|
|
22573
22718
|
process.exit(1);
|
|
22574
22719
|
}
|
|
22575
22720
|
const { path: repoPath = process.cwd(), appid: explicitAppId, useFirst = false, stagedOnly = false, dependencyWatch = true, autoMode = false, url: explicitUrl, user: explicitUsername, open: openAfterValidation = false } = options;
|
|
22576
|
-
|
|
22721
|
+
auth_setRepoContext(repoPath);
|
|
22577
22722
|
try {
|
|
22578
22723
|
const validationResult = await validateAnvilApp(repoPath);
|
|
22579
22724
|
if (validationResult.appName) logger_logger.info(external_chalk_default().green("Anvil app: ") + external_chalk_default().bold(validationResult.appName));
|
|
@@ -22780,6 +22925,7 @@ print(json.dumps({"issues": issues}))
|
|
|
22780
22925
|
logger_logger.success("Logged in as " + external_chalk_default().bold(result.email));
|
|
22781
22926
|
} catch (e) {
|
|
22782
22927
|
logger_logger.error("Error: " + e.message);
|
|
22928
|
+
logErrorCause(e, logger_logger);
|
|
22783
22929
|
process.exit(1);
|
|
22784
22930
|
}
|
|
22785
22931
|
});
|
|
@@ -23358,6 +23504,7 @@ print(json.dumps({"issues": issues}))
|
|
|
23358
23504
|
await runConfigureFlow(version, configure_defaultDeps);
|
|
23359
23505
|
} catch (e) {
|
|
23360
23506
|
logger_logger.error("Error: " + errors_getErrorMessage(e));
|
|
23507
|
+
logErrorCause(e, logger_logger);
|
|
23361
23508
|
process.exit(1);
|
|
23362
23509
|
}
|
|
23363
23510
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAcD,eAAO,MAAM,+BAA+B,6BAA6B,CAAC;AAC1E,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAShE,wBAAsB,wBAAwB,CAC1C,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,EAAE,EAAE,IAAI,CAAC,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAC3E,OAAO,CAAC,MAAM,CAAC,CAkEjB;AAED,wBAAsB,yBAAyB,CAC3C,cAAc,EAAE,MAAM,EACtB,mBAAmB,GAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAoB,GACrE,OAAO,CAAC,sBAAsB,CAAC,CAuBjC;AAoGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAcD,eAAO,MAAM,+BAA+B,6BAA6B,CAAC;AAC1E,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAShE,wBAAsB,wBAAwB,CAC1C,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,EAAE,EAAE,IAAI,CAAC,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAC3E,OAAO,CAAC,MAAM,CAAC,CAkEjB;AAED,wBAAsB,yBAAyB,CAC3C,cAAc,EAAE,MAAM,EACtB,mBAAmB,GAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAoB,GACrE,OAAO,CAAC,sBAAsB,CAAC,CAuBjC;AAoGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAahF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuC3D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getValidAuthToken } from "../services/auth";
|
|
2
|
+
import { readAuthFromRepo } from "../services/git-auth";
|
|
3
|
+
export interface ModelTokenDeps {
|
|
4
|
+
getValidAuthToken: typeof getValidAuthToken;
|
|
5
|
+
readAuthFromRepo: typeof readAuthFromRepo;
|
|
6
|
+
cwd: () => string;
|
|
7
|
+
}
|
|
8
|
+
export interface ModelTokenOptions {
|
|
9
|
+
deps?: ModelTokenDeps;
|
|
10
|
+
repoPath?: string;
|
|
11
|
+
/** How long to wait for the cross-process auth file lock; defaults to MODEL_TOKEN_LOCK_TIMEOUT_MS. */
|
|
12
|
+
lockTimeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Codex waits a bounded time for a command-based auth provider (the agent-host
|
|
16
|
+
* configures timeout_ms = 30000), so the helper must give up on the auth file
|
|
17
|
+
* lock well before then and fail loudly rather than be killed mid-wait.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MODEL_TOKEN_LOCK_TIMEOUT_MS = 12000;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a valid access token for the repo-local auth session. Refreshes a
|
|
22
|
+
* stale access token (persisting the rotated refresh token) under the
|
|
23
|
+
* cross-process auth file lock.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getModelToken(options?: ModelTokenOptions): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Model-token helper entry point, invoked by the generated
|
|
28
|
+
* anvil-model-token-helper.cjs script: print a valid access token (and nothing
|
|
29
|
+
* else) to stdout. Any failure propagates so the helper script can exit
|
|
30
|
+
* non-zero with a message on stderr.
|
|
31
|
+
*/
|
|
32
|
+
export declare function executeModelTokenOperation(options?: ModelTokenOptions): Promise<void>;
|
|
33
|
+
//# sourceMappingURL=modelToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelToken.d.ts","sourceRoot":"","sources":["../../src/commands/modelToken.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC3B,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,GAAG,EAAE,MAAM,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sGAAsG;IACtG,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AAIH,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAQlD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBpF;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/F"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Typed error definitions for anvil-cli.
|
|
3
3
|
* Uses discriminated unions for type-safe error handling.
|
|
4
4
|
*/
|
|
5
|
+
import type { Logger } from "./logger";
|
|
5
6
|
export type AuthError = {
|
|
6
7
|
type: "auth_required";
|
|
7
8
|
message?: string;
|
|
@@ -14,6 +15,7 @@ export type AuthError = {
|
|
|
14
15
|
} | {
|
|
15
16
|
type: "token_refresh_failed";
|
|
16
17
|
message?: string;
|
|
18
|
+
status?: number;
|
|
17
19
|
};
|
|
18
20
|
export type AppError = {
|
|
19
21
|
type: "app_not_found";
|
|
@@ -102,7 +104,7 @@ export declare const createAuthError: {
|
|
|
102
104
|
required: (message?: string) => AuthError;
|
|
103
105
|
expired: (message?: string) => AuthError;
|
|
104
106
|
invalid: (message?: string) => AuthError;
|
|
105
|
-
refreshFailed: (message?: string) => AuthError;
|
|
107
|
+
refreshFailed: (message?: string, status?: number) => AuthError;
|
|
106
108
|
};
|
|
107
109
|
export declare const createAppError: {
|
|
108
110
|
notFound: (appId: string) => AppError;
|
|
@@ -148,4 +150,12 @@ export declare function isNetworkError(error: AnvilError): error is NetworkError
|
|
|
148
150
|
export declare function isValidationError(error: AnvilError): error is ValidationError;
|
|
149
151
|
export declare function isSaveError(error: AnvilError): error is SaveError;
|
|
150
152
|
export declare function getErrorMessage(error: unknown): string;
|
|
153
|
+
/**
|
|
154
|
+
* Return the immediate underlying cause of an error in a form suitable for
|
|
155
|
+
* verbose CLI output. Native fetch errors use `cause` for the useful network
|
|
156
|
+
* or TLS failure while exposing only "fetch failed" as their main message.
|
|
157
|
+
*/
|
|
158
|
+
export declare function getErrorCauseMessage(error: unknown): string | null;
|
|
159
|
+
/** Log useful nested error details without adding noise to normal CLI output. */
|
|
160
|
+
export declare function logErrorCause(error: unknown, ui: Pick<Logger, "verbose">): void;
|
|
151
161
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,MAAM,MAAM,SAAS,GACf;IAAE,IAAI,EAAE,eAAe,CA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E;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,SAAS,CAEjE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,QAAQ,CAE/D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,SAAS,CAUjE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,QAAQ,CAE/D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,YAAY,CAEvE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,eAAe,CAE7E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,SAAS,CAEjE;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAyFtD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAoBlE;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAK/E"}
|
package/dist/index.js
CHANGED
|
@@ -7376,22 +7376,25 @@ var __webpack_exports__ = {};
|
|
|
7376
7376
|
validateCheckoutDestination: ()=>validateCheckoutDestination,
|
|
7377
7377
|
DeviceAuthorizationResponse: ()=>oauth_login_namespaceObject.DeviceAuthorizationResponse,
|
|
7378
7378
|
OAuthTokenResponse: ()=>oauth_login_namespaceObject.OAuthTokenResponse,
|
|
7379
|
+
REFRESH_REQUEST_TIMEOUT_MS: ()=>REFRESH_REQUEST_TIMEOUT_MS,
|
|
7379
7380
|
WatchSession: ()=>WatchSession_WatchSession,
|
|
7380
7381
|
parseConfigSetValue: ()=>parseConfigSetValue,
|
|
7381
|
-
requestDeviceAuthorization: ()=>requestDeviceAuthorization,
|
|
7382
7382
|
getGitPushUrl: ()=>anvil_api_getGitPushUrl,
|
|
7383
|
+
requestDeviceAuthorization: ()=>requestDeviceAuthorization,
|
|
7383
7384
|
requireEnvironmentBranch: ()=>requireEnvironmentBranch,
|
|
7384
7385
|
setAuthTokensForAccount: ()=>setAccountTokens,
|
|
7385
|
-
validateAnvilApp: ()=>validation_validateAnvilApp,
|
|
7386
7386
|
ValidateAppIdResponse: ()=>anvil_api_namespaceObject.ValidateAppIdResponse,
|
|
7387
|
-
|
|
7387
|
+
getModelToken: ()=>getModelToken,
|
|
7388
7388
|
formatValidationPath: ()=>formatValidationPath,
|
|
7389
7389
|
resolveAnvilUrl: ()=>resolveAnvilUrl,
|
|
7390
7390
|
createCheckoutPickerSource: ()=>createCheckoutPickerSource,
|
|
7391
7391
|
buildGitAuthDoctorReport: ()=>buildGitAuthDoctorReport,
|
|
7392
7392
|
parseCheckoutInput: ()=>parseCheckoutInput,
|
|
7393
7393
|
formatGitAuthDoctorReport: ()=>formatGitAuthDoctorReport,
|
|
7394
|
+
validateAnvilApp: ()=>validation_validateAnvilApp,
|
|
7394
7395
|
resetConfig: ()=>resetConfig,
|
|
7396
|
+
MODEL_TOKEN_HELPER_FILENAME: ()=>MODEL_TOKEN_HELPER_FILENAME,
|
|
7397
|
+
verifyAndStoreTokens: ()=>auth_verifyAndStoreTokens,
|
|
7395
7398
|
FormTemplateValidationResult: ()=>validators_namespaceObject.FormTemplateValidationResult,
|
|
7396
7399
|
createWatchDiagnostic: ()=>createWatchDiagnostic,
|
|
7397
7400
|
ValidationTarget: ()=>validators_namespaceObject.ValidationTarget,
|
|
@@ -7406,8 +7409,10 @@ var __webpack_exports__ = {};
|
|
|
7406
7409
|
CheckoutExecutionDeps: ()=>checkout_namespaceObject.CheckoutExecutionDeps,
|
|
7407
7410
|
validateFormTemplateHtml: ()=>validateFormTemplateHtml,
|
|
7408
7411
|
ValidateBranchSyncStatusOptions: ()=>validation_namespaceObject.ValidateBranchSyncStatusOptions,
|
|
7412
|
+
withRepoAuthFileLock: ()=>withRepoAuthFileLock,
|
|
7409
7413
|
BranchSyncStatus: ()=>validation_namespaceObject.BranchSyncStatus,
|
|
7410
7414
|
getLatestVersion: ()=>getLatestVersion,
|
|
7415
|
+
getModelTokenHelperScript: ()=>getModelTokenHelperScript,
|
|
7411
7416
|
isDirectoryNonEmpty: ()=>isDirectoryNonEmpty,
|
|
7412
7417
|
syncToLatest: ()=>src_api_syncToLatest,
|
|
7413
7418
|
filterCandidates: ()=>anvil_api_filterCandidates,
|
|
@@ -7434,6 +7439,7 @@ var __webpack_exports__ = {};
|
|
|
7434
7439
|
logout: ()=>logout,
|
|
7435
7440
|
TokenData: ()=>auth_namespaceObject.TokenData,
|
|
7436
7441
|
detectAppIdsFromAllRemotes: ()=>anvil_api_detectAppIdsFromAllRemotes,
|
|
7442
|
+
executeModelTokenOperation: ()=>executeModelTokenOperation,
|
|
7437
7443
|
getWebSocketUrl: ()=>getWebSocketUrl,
|
|
7438
7444
|
getAllConfig: ()=>getAllConfig,
|
|
7439
7445
|
isCommandAvailable: ()=>config_isCommandAvailable,
|
|
@@ -7443,6 +7449,7 @@ var __webpack_exports__ = {};
|
|
|
7443
7449
|
getValidAuthToken: ()=>auth_getValidAuthToken,
|
|
7444
7450
|
watch: ()=>src_api_watch,
|
|
7445
7451
|
deleteConfig: ()=>deleteConfig,
|
|
7452
|
+
installModelTokenHelperScript: ()=>installModelTokenHelperScript,
|
|
7446
7453
|
getGitFetchUrl: ()=>anvil_api_getGitFetchUrl,
|
|
7447
7454
|
PreferredEditor: ()=>config_namespaceObject.PreferredEditor,
|
|
7448
7455
|
getAvailableAnvilUrls: ()=>getAvailableAnvilUrls,
|
|
@@ -7455,8 +7462,11 @@ var __webpack_exports__ = {};
|
|
|
7455
7462
|
CheckoutResult: ()=>checkout_namespaceObject.CheckoutResult,
|
|
7456
7463
|
ParsedCheckoutInput: ()=>checkout_namespaceObject.ParsedCheckoutInput,
|
|
7457
7464
|
parseCredentialHelperCommand: ()=>parseCredentialHelperCommand,
|
|
7465
|
+
MODEL_TOKEN_LOCK_TIMEOUT_MS: ()=>MODEL_TOKEN_LOCK_TIMEOUT_MS,
|
|
7466
|
+
GetValidAuthTokenOptions: ()=>auth_namespaceObject.GetValidAuthTokenOptions,
|
|
7458
7467
|
clearInMemoryTokens: ()=>clearInMemoryTokens,
|
|
7459
7468
|
getDefaultDestinationDirectory: ()=>getDefaultDestinationDirectory,
|
|
7469
|
+
AUTH_FILE_LOCK_DEFAULTS: ()=>AUTH_FILE_LOCK_DEFAULTS,
|
|
7460
7470
|
lookupByCommit: ()=>lookupByCommit,
|
|
7461
7471
|
AppIdCandidate: ()=>anvil_api_namespaceObject.AppIdCandidate,
|
|
7462
7472
|
verifyAuth: ()=>auth_verifyAuth
|
|
@@ -7485,6 +7495,7 @@ var __webpack_exports__ = {};
|
|
|
7485
7495
|
__webpack_require__.r(auth_namespaceObject);
|
|
7486
7496
|
__webpack_require__.d(auth_namespaceObject, {
|
|
7487
7497
|
fg: ()=>ANVIL_SYNC_CLIENT_ID,
|
|
7498
|
+
ru: ()=>REFRESH_REQUEST_TIMEOUT_MS,
|
|
7488
7499
|
Ou: ()=>clearInMemoryTokens,
|
|
7489
7500
|
Fr: ()=>auth_getAccountsForUrl,
|
|
7490
7501
|
u5: ()=>getAvailableAnvilUrls,
|
|
@@ -13365,9 +13376,10 @@ var __webpack_exports__ = {};
|
|
|
13365
13376
|
type: "auth_invalid",
|
|
13366
13377
|
message
|
|
13367
13378
|
}),
|
|
13368
|
-
refreshFailed: (message)=>({
|
|
13379
|
+
refreshFailed: (message, status)=>({
|
|
13369
13380
|
type: "token_refresh_failed",
|
|
13370
|
-
message
|
|
13381
|
+
message,
|
|
13382
|
+
status
|
|
13371
13383
|
})
|
|
13372
13384
|
};
|
|
13373
13385
|
const createAppError = {
|
|
@@ -13584,6 +13596,7 @@ var __webpack_exports__ = {};
|
|
|
13584
13596
|
const external_module_namespaceObject = require("module");
|
|
13585
13597
|
const requireFromHere = (0, external_module_namespaceObject.createRequire)(__filename);
|
|
13586
13598
|
const GIT_CREDENTIAL_HELPER_FILENAME = "anvil-credential-helper.cjs";
|
|
13599
|
+
const MODEL_TOKEN_HELPER_FILENAME = "anvil-model-token-helper.cjs";
|
|
13587
13600
|
const GIT_CREDENTIAL_HELPER_LOCATOR = `$(git rev-parse --git-common-dir)/${GIT_CREDENTIAL_HELPER_FILENAME}`;
|
|
13588
13601
|
function getUrlConfigKey(appId) {
|
|
13589
13602
|
return `anvil.auth.${appId}.url`;
|
|
@@ -13674,6 +13687,38 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13674
13687
|
});
|
|
13675
13688
|
`;
|
|
13676
13689
|
}
|
|
13690
|
+
function getModelTokenHelperScript(modulePath) {
|
|
13691
|
+
return `#!/usr/bin/env node
|
|
13692
|
+
"use strict";
|
|
13693
|
+
|
|
13694
|
+
const { execFileSync } = require("child_process");
|
|
13695
|
+
const { executeModelTokenOperation } = require(${JSON.stringify(modulePath)});
|
|
13696
|
+
|
|
13697
|
+
function resolveRepoPath() {
|
|
13698
|
+
return execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
13699
|
+
cwd: process.cwd(),
|
|
13700
|
+
encoding: "utf8",
|
|
13701
|
+
}).trim();
|
|
13702
|
+
}
|
|
13703
|
+
|
|
13704
|
+
Promise.resolve()
|
|
13705
|
+
.then(() => executeModelTokenOperation({ repoPath: resolveRepoPath() }))
|
|
13706
|
+
.catch((e) => {
|
|
13707
|
+
process.stderr.write("anvil model token helper failed: " + ((e && e.message) || e) + "\\n");
|
|
13708
|
+
process.exit(1);
|
|
13709
|
+
});
|
|
13710
|
+
`;
|
|
13711
|
+
}
|
|
13712
|
+
async function installModelTokenHelperScript(helperPath, options) {
|
|
13713
|
+
await external_fs_.promises.mkdir(external_path_default().dirname(helperPath), {
|
|
13714
|
+
recursive: true
|
|
13715
|
+
});
|
|
13716
|
+
await external_fs_.promises.writeFile(helperPath, getModelTokenHelperScript(options?.modulePath ?? getCredentialHelperModulePath()), {
|
|
13717
|
+
mode: 448
|
|
13718
|
+
});
|
|
13719
|
+
await external_fs_.promises.chmod(helperPath, 448);
|
|
13720
|
+
return helperPath;
|
|
13721
|
+
}
|
|
13677
13722
|
function findPackageRoot(startPath) {
|
|
13678
13723
|
let dir = external_fs_default().existsSync(startPath) && external_fs_default().statSync(startPath).isDirectory() ? startPath : external_path_default().dirname(startPath);
|
|
13679
13724
|
while(true){
|
|
@@ -13801,6 +13846,76 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13801
13846
|
function getAuthFilePath(gitDir) {
|
|
13802
13847
|
return external_path_default().join(gitDir, "anvil-auth.json");
|
|
13803
13848
|
}
|
|
13849
|
+
const AUTH_FILE_LOCK_DEFAULTS = {
|
|
13850
|
+
staleMs: 30000,
|
|
13851
|
+
timeoutMs: 60000,
|
|
13852
|
+
retryDelayMs: 100,
|
|
13853
|
+
heartbeatMs: 5000
|
|
13854
|
+
};
|
|
13855
|
+
function git_auth_delay(ms) {
|
|
13856
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
13857
|
+
}
|
|
13858
|
+
async function acquireAuthFileLock(lockPath, options) {
|
|
13859
|
+
const deadline = Date.now() + options.timeoutMs;
|
|
13860
|
+
while(true){
|
|
13861
|
+
try {
|
|
13862
|
+
const handle = await external_fs_.promises.open(lockPath, "wx", 384);
|
|
13863
|
+
try {
|
|
13864
|
+
await handle.writeFile(JSON.stringify({
|
|
13865
|
+
pid: process.pid,
|
|
13866
|
+
acquiredAt: new Date().toISOString()
|
|
13867
|
+
}));
|
|
13868
|
+
} finally{
|
|
13869
|
+
await handle.close();
|
|
13870
|
+
}
|
|
13871
|
+
return;
|
|
13872
|
+
} catch (e) {
|
|
13873
|
+
if ("EEXIST" !== e.code) throw e;
|
|
13874
|
+
}
|
|
13875
|
+
try {
|
|
13876
|
+
const lockStat = await external_fs_.promises.stat(lockPath);
|
|
13877
|
+
if (Date.now() - lockStat.mtimeMs > options.staleMs) {
|
|
13878
|
+
await external_fs_.promises.rm(lockPath, {
|
|
13879
|
+
force: true
|
|
13880
|
+
});
|
|
13881
|
+
continue;
|
|
13882
|
+
}
|
|
13883
|
+
} catch {
|
|
13884
|
+
continue;
|
|
13885
|
+
}
|
|
13886
|
+
if (Date.now() >= deadline) throw new Error(`Timed out waiting for the Anvil auth file lock at ${lockPath}`);
|
|
13887
|
+
await git_auth_delay(options.retryDelayMs);
|
|
13888
|
+
}
|
|
13889
|
+
}
|
|
13890
|
+
async function withRepoAuthFileLock(repoPath, fn, options) {
|
|
13891
|
+
const gitDir = await getRepositoryGitDir(repoPath);
|
|
13892
|
+
const lockPath = `${getAuthFilePath(gitDir)}.lock`;
|
|
13893
|
+
const lockOptions = {
|
|
13894
|
+
...AUTH_FILE_LOCK_DEFAULTS,
|
|
13895
|
+
...options
|
|
13896
|
+
};
|
|
13897
|
+
await external_fs_.promises.mkdir(external_path_default().dirname(lockPath), {
|
|
13898
|
+
recursive: true
|
|
13899
|
+
});
|
|
13900
|
+
await acquireAuthFileLock(lockPath, lockOptions);
|
|
13901
|
+
const heartbeat = startAuthFileLockHeartbeat(lockPath, lockOptions.heartbeatMs);
|
|
13902
|
+
try {
|
|
13903
|
+
return await fn();
|
|
13904
|
+
} finally{
|
|
13905
|
+
clearInterval(heartbeat);
|
|
13906
|
+
await external_fs_.promises.rm(lockPath, {
|
|
13907
|
+
force: true
|
|
13908
|
+
});
|
|
13909
|
+
}
|
|
13910
|
+
}
|
|
13911
|
+
function startAuthFileLockHeartbeat(lockPath, heartbeatMs) {
|
|
13912
|
+
const heartbeat = setInterval(()=>{
|
|
13913
|
+
const now = new Date();
|
|
13914
|
+
external_fs_.promises.utimes(lockPath, now, now).catch(()=>{});
|
|
13915
|
+
}, heartbeatMs);
|
|
13916
|
+
heartbeat.unref();
|
|
13917
|
+
return heartbeat;
|
|
13918
|
+
}
|
|
13804
13919
|
function decodeKey(b64key) {
|
|
13805
13920
|
const key = Buffer.from(b64key, "base64");
|
|
13806
13921
|
if (32 !== key.length) throw new Error("Encryption key must be a base64-encoded 32-byte key");
|
|
@@ -13845,10 +13960,19 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13845
13960
|
recursive: true
|
|
13846
13961
|
});
|
|
13847
13962
|
const authJson = JSON.stringify(auth, null, 2);
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13963
|
+
const tempFilePath = `${authFilePath}.tmp-${external_node_crypto_default().randomBytes(6).toString("hex")}`;
|
|
13964
|
+
try {
|
|
13965
|
+
await external_fs_.promises.writeFile(tempFilePath, encrypt(authJson, encryptionKey), {
|
|
13966
|
+
mode: 384
|
|
13967
|
+
});
|
|
13968
|
+
await external_fs_.promises.chmod(tempFilePath, 448);
|
|
13969
|
+
await external_fs_.promises.rename(tempFilePath, authFilePath);
|
|
13970
|
+
} catch (e) {
|
|
13971
|
+
await external_fs_.promises.rm(tempFilePath, {
|
|
13972
|
+
force: true
|
|
13973
|
+
});
|
|
13974
|
+
throw e;
|
|
13975
|
+
}
|
|
13852
13976
|
await git.raw([
|
|
13853
13977
|
"config",
|
|
13854
13978
|
"--local",
|
|
@@ -13870,6 +13994,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13870
13994
|
return resolveAnvilUrl();
|
|
13871
13995
|
}
|
|
13872
13996
|
const ANVIL_SYNC_CLIENT_ID = "anvil-sync";
|
|
13997
|
+
const REFRESH_REQUEST_TIMEOUT_MS = 12000;
|
|
13873
13998
|
let inMemoryAuth = null;
|
|
13874
13999
|
function setInMemoryTokens(anvilUrl, username, tokens) {
|
|
13875
14000
|
inMemoryAuth = {
|
|
@@ -13908,7 +14033,7 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13908
14033
|
throw createAuthError.invalid(`Network error: ${e.message}`);
|
|
13909
14034
|
}
|
|
13910
14035
|
}
|
|
13911
|
-
async function refreshAccessToken(refreshToken, anvilUrl = getDefaultAnvilUrl(), clientId = ANVIL_SYNC_CLIENT_ID) {
|
|
14036
|
+
async function refreshAccessToken(refreshToken, anvilUrl = getDefaultAnvilUrl(), clientId = ANVIL_SYNC_CLIENT_ID, options) {
|
|
13912
14037
|
try {
|
|
13913
14038
|
const tokenResponse = await fetch(`${anvilUrl}/oauth/token`, {
|
|
13914
14039
|
method: "POST",
|
|
@@ -13919,11 +14044,12 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13919
14044
|
grant_type: "refresh_token",
|
|
13920
14045
|
refresh_token: refreshToken,
|
|
13921
14046
|
client_id: clientId
|
|
13922
|
-
})
|
|
14047
|
+
}),
|
|
14048
|
+
signal: AbortSignal.timeout(options?.timeoutMs ?? REFRESH_REQUEST_TIMEOUT_MS)
|
|
13923
14049
|
});
|
|
13924
14050
|
if (!tokenResponse.ok) {
|
|
13925
14051
|
const errorText = await tokenResponse.text();
|
|
13926
|
-
throw createAuthError.refreshFailed(`Failed to refresh token: ${tokenResponse.status} ${errorText}
|
|
14052
|
+
throw createAuthError.refreshFailed(`Failed to refresh token: ${tokenResponse.status} ${errorText}`, tokenResponse.status);
|
|
13927
14053
|
}
|
|
13928
14054
|
const tokenData = await tokenResponse.json();
|
|
13929
14055
|
return tokenData;
|
|
@@ -13940,17 +14066,16 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13940
14066
|
return hasTokens(anvilUrl, username);
|
|
13941
14067
|
}
|
|
13942
14068
|
}
|
|
13943
|
-
async function auth_getValidAuthToken(anvilUrl = getDefaultAnvilUrl(), username) {
|
|
14069
|
+
async function auth_getValidAuthToken(anvilUrl = getDefaultAnvilUrl(), username, options) {
|
|
13944
14070
|
const normalized = config_normalizeAnvilUrl(anvilUrl);
|
|
13945
14071
|
const source = await resolveTokenSource(normalized, username);
|
|
13946
14072
|
const tokens = getSourceTokens(source);
|
|
13947
14073
|
if (!tokens.authToken && !tokens.refreshToken) throw createAuthError.required("Not logged in. Please log in first.");
|
|
13948
|
-
|
|
13949
|
-
if (tokens.refreshToken && isExpired) {
|
|
14074
|
+
if (tokens.refreshToken && isAccessTokenExpired(tokens)) {
|
|
13950
14075
|
const refreshKey = getRefreshKey(normalized, username, source, tokens.refreshToken);
|
|
13951
14076
|
const existingRefresh = inFlightRefreshes.get(refreshKey);
|
|
13952
14077
|
if (existingRefresh) return existingRefresh;
|
|
13953
|
-
const refreshPromise = refreshAndStoreAccessToken(normalized, username, source, tokens.refreshToken).finally(()=>{
|
|
14078
|
+
const refreshPromise = refreshAndStoreAccessToken(normalized, username, source, tokens.refreshToken, options).finally(()=>{
|
|
13954
14079
|
inFlightRefreshes.delete(refreshKey);
|
|
13955
14080
|
});
|
|
13956
14081
|
inFlightRefreshes.set(refreshKey, refreshPromise);
|
|
@@ -13980,6 +14105,9 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13980
14105
|
function getSourceTokens(source) {
|
|
13981
14106
|
return "store" === source.type ? source.tokens : source.auth.tokens;
|
|
13982
14107
|
}
|
|
14108
|
+
function isAccessTokenExpired(tokens) {
|
|
14109
|
+
return null !== tokens.authTokenExpiresAt && tokens.authTokenExpiresAt <= Math.floor(Date.now() / 1000) + 60;
|
|
14110
|
+
}
|
|
13983
14111
|
function getStoreAccountUsername(normalizedUrl, username, refreshToken) {
|
|
13984
14112
|
if (username) return username;
|
|
13985
14113
|
const urlTokens = getUrlTokens(normalizedUrl);
|
|
@@ -13998,11 +14126,43 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
13998
14126
|
return `store:${normalizedUrl}:${source.accountUsername ?? username ?? refreshToken}`;
|
|
13999
14127
|
}
|
|
14000
14128
|
}
|
|
14001
|
-
async function refreshAndStoreAccessToken(normalizedUrl, username, source, refreshToken) {
|
|
14129
|
+
async function refreshAndStoreAccessToken(normalizedUrl, username, source, refreshToken, options) {
|
|
14130
|
+
if ("repo" === source.type) return refreshRepoAuthTokens(source.repoPath, {
|
|
14131
|
+
anvilUrl: normalizedUrl,
|
|
14132
|
+
username,
|
|
14133
|
+
auth: source.auth,
|
|
14134
|
+
refreshToken,
|
|
14135
|
+
lock: options?.lock,
|
|
14136
|
+
requestTimeoutMs: options?.requestTimeoutMs
|
|
14137
|
+
});
|
|
14138
|
+
return performTokenRefresh(normalizedUrl, username, source, refreshToken, options?.requestTimeoutMs);
|
|
14139
|
+
}
|
|
14140
|
+
async function refreshRepoAuthTokens(repoPath, options) {
|
|
14141
|
+
const normalizedUrl = config_normalizeAnvilUrl(options.anvilUrl);
|
|
14142
|
+
return withRepoAuthFileLock(repoPath, async ()=>{
|
|
14143
|
+
let auth = options.auth;
|
|
14144
|
+
let refreshToken = options.refreshToken;
|
|
14145
|
+
const current = await readAuthFromRepo(repoPath);
|
|
14146
|
+
if (current && authMatches(current, normalizedUrl, options.username)) {
|
|
14147
|
+
if (current.tokens.authToken && !isAccessTokenExpired(current.tokens)) return current.tokens.authToken;
|
|
14148
|
+
auth = current;
|
|
14149
|
+
refreshToken = current.tokens.refreshToken ?? refreshToken;
|
|
14150
|
+
}
|
|
14151
|
+
if (!auth || !refreshToken) throw createAuthError.required("No repo auth tokens available to refresh.");
|
|
14152
|
+
return performTokenRefresh(normalizedUrl, options.username, {
|
|
14153
|
+
type: "repo",
|
|
14154
|
+
auth,
|
|
14155
|
+
repoPath
|
|
14156
|
+
}, refreshToken, options.requestTimeoutMs);
|
|
14157
|
+
}, options.lock);
|
|
14158
|
+
}
|
|
14159
|
+
async function performTokenRefresh(normalizedUrl, username, source, refreshToken, requestTimeoutMs) {
|
|
14002
14160
|
try {
|
|
14003
14161
|
const tokens = getSourceTokens(source);
|
|
14004
14162
|
const clientId = tokens.clientId ?? ANVIL_SYNC_CLIENT_ID;
|
|
14005
|
-
const tokenData = await refreshAccessToken(refreshToken, normalizedUrl, clientId
|
|
14163
|
+
const tokenData = await refreshAccessToken(refreshToken, normalizedUrl, clientId, {
|
|
14164
|
+
timeoutMs: requestTimeoutMs
|
|
14165
|
+
});
|
|
14006
14166
|
const newTokens = {
|
|
14007
14167
|
authToken: tokenData.access_token,
|
|
14008
14168
|
refreshToken: tokenData.refresh_token,
|
|
@@ -14024,10 +14184,26 @@ Promise.resolve(executeGitCredentialOperation(process.argv[2] || "get", {
|
|
|
14024
14184
|
}
|
|
14025
14185
|
return tokenData.access_token;
|
|
14026
14186
|
} catch (e) {
|
|
14187
|
+
if ("repo" === source.type && isRefreshTokenRejection(e)) await clearRepoAuthTokens(source.repoPath, source.auth).catch(()=>{});
|
|
14027
14188
|
await clearTokensForAccount(normalizedUrl, username, refreshToken);
|
|
14028
14189
|
throw e;
|
|
14029
14190
|
}
|
|
14030
14191
|
}
|
|
14192
|
+
function isRefreshTokenRejection(e) {
|
|
14193
|
+
const error = e;
|
|
14194
|
+
return error?.type === "token_refresh_failed" && (400 === error.status || 401 === error.status);
|
|
14195
|
+
}
|
|
14196
|
+
async function clearRepoAuthTokens(repoPath, auth) {
|
|
14197
|
+
const encryptionKey = process.env["ANVIL_AUTH_FILE_ENCRYPTION_KEY"];
|
|
14198
|
+
if (!encryptionKey) return;
|
|
14199
|
+
auth.tokens = {
|
|
14200
|
+
authToken: null,
|
|
14201
|
+
refreshToken: null,
|
|
14202
|
+
authTokenExpiresAt: null,
|
|
14203
|
+
clientId: auth.tokens.clientId
|
|
14204
|
+
};
|
|
14205
|
+
await writeAuthToFile(repoPath, auth, encryptionKey);
|
|
14206
|
+
}
|
|
14031
14207
|
async function clearTokensForAccount(url, username, refreshToken) {
|
|
14032
14208
|
if (inMemoryAuth || repoContext && await readAuthFromRepo(repoContext)) return;
|
|
14033
14209
|
{
|
|
@@ -20537,6 +20713,29 @@ print(json.dumps({"issues": issues}))
|
|
|
20537
20713
|
const response = await buildGitCredentialResponse(operation, request, options);
|
|
20538
20714
|
writeGitCredentialResponse(response);
|
|
20539
20715
|
}
|
|
20716
|
+
const MODEL_TOKEN_LOCK_TIMEOUT_MS = 12000;
|
|
20717
|
+
const modelToken_defaultDeps = {
|
|
20718
|
+
getValidAuthToken: auth_getValidAuthToken,
|
|
20719
|
+
readAuthFromRepo: readAuthFromRepo,
|
|
20720
|
+
cwd: ()=>process.cwd()
|
|
20721
|
+
};
|
|
20722
|
+
async function getModelToken(options = {}) {
|
|
20723
|
+
const deps = options.deps ?? modelToken_defaultDeps;
|
|
20724
|
+
const repoPath = options.repoPath ?? deps.cwd();
|
|
20725
|
+
auth_setRepoContext(repoPath);
|
|
20726
|
+
if (!process.env["ANVIL_AUTH_FILE_ENCRYPTION_KEY"]) throw new Error("ANVIL_AUTH_FILE_ENCRYPTION_KEY is not set; cannot read repo auth tokens.");
|
|
20727
|
+
const auth = await deps.readAuthFromRepo(repoPath);
|
|
20728
|
+
if (!auth) throw new Error(`No Anvil auth tokens found for the repository at ${repoPath}.`);
|
|
20729
|
+
return deps.getValidAuthToken(auth.anvilUrl, auth.username, {
|
|
20730
|
+
lock: {
|
|
20731
|
+
timeoutMs: options.lockTimeoutMs ?? MODEL_TOKEN_LOCK_TIMEOUT_MS
|
|
20732
|
+
}
|
|
20733
|
+
});
|
|
20734
|
+
}
|
|
20735
|
+
async function executeModelTokenOperation(options = {}) {
|
|
20736
|
+
const token = await getModelToken(options);
|
|
20737
|
+
process.stdout.write(`${token}\n`);
|
|
20738
|
+
}
|
|
20540
20739
|
resolveAnvilUrl();
|
|
20541
20740
|
async function watch_decideFallbackUrl(explicitUrl, availableUrls) {
|
|
20542
20741
|
if (explicitUrl) return {
|
|
@@ -20914,6 +21113,7 @@ print(json.dumps({"issues": issues}))
|
|
|
20914
21113
|
}
|
|
20915
21114
|
})();
|
|
20916
21115
|
exports.ANVIL_SYNC_CLIENT_ID = __webpack_exports__.ANVIL_SYNC_CLIENT_ID;
|
|
21116
|
+
exports.AUTH_FILE_LOCK_DEFAULTS = __webpack_exports__.AUTH_FILE_LOCK_DEFAULTS;
|
|
20917
21117
|
exports.AnvilYamlValidationResult = __webpack_exports__.AnvilYamlValidationResult;
|
|
20918
21118
|
exports.AppIdCandidate = __webpack_exports__.AppIdCandidate;
|
|
20919
21119
|
exports.AppIdWithContext = __webpack_exports__.AppIdWithContext;
|
|
@@ -20925,11 +21125,15 @@ exports.CheckoutOptions = __webpack_exports__.CheckoutOptions;
|
|
|
20925
21125
|
exports.CheckoutResult = __webpack_exports__.CheckoutResult;
|
|
20926
21126
|
exports.DeviceAuthorizationResponse = __webpack_exports__.DeviceAuthorizationResponse;
|
|
20927
21127
|
exports.FormTemplateValidationResult = __webpack_exports__.FormTemplateValidationResult;
|
|
21128
|
+
exports.GetValidAuthTokenOptions = __webpack_exports__.GetValidAuthTokenOptions;
|
|
20928
21129
|
exports.LoginResult = __webpack_exports__.LoginResult;
|
|
20929
21130
|
exports.LogoutResult = __webpack_exports__.LogoutResult;
|
|
21131
|
+
exports.MODEL_TOKEN_HELPER_FILENAME = __webpack_exports__.MODEL_TOKEN_HELPER_FILENAME;
|
|
21132
|
+
exports.MODEL_TOKEN_LOCK_TIMEOUT_MS = __webpack_exports__.MODEL_TOKEN_LOCK_TIMEOUT_MS;
|
|
20930
21133
|
exports.OAuthTokenResponse = __webpack_exports__.OAuthTokenResponse;
|
|
20931
21134
|
exports.ParsedCheckoutInput = __webpack_exports__.ParsedCheckoutInput;
|
|
20932
21135
|
exports.PreferredEditor = __webpack_exports__.PreferredEditor;
|
|
21136
|
+
exports.REFRESH_REQUEST_TIMEOUT_MS = __webpack_exports__.REFRESH_REQUEST_TIMEOUT_MS;
|
|
20933
21137
|
exports.SettableConfigKey = __webpack_exports__.SettableConfigKey;
|
|
20934
21138
|
exports.TokenData = __webpack_exports__.TokenData;
|
|
20935
21139
|
exports.ValidateAppIdResponse = __webpack_exports__.ValidateAppIdResponse;
|
|
@@ -20950,6 +21154,7 @@ exports.detectAppIdsByCommitLookup = __webpack_exports__.detectAppIdsByCommitLoo
|
|
|
20950
21154
|
exports.detectAppIdsFromAllRemotes = __webpack_exports__.detectAppIdsFromAllRemotes;
|
|
20951
21155
|
exports.executeCheckout = __webpack_exports__.executeCheckout;
|
|
20952
21156
|
exports.executeGitCredentialOperation = __webpack_exports__.executeGitCredentialOperation;
|
|
21157
|
+
exports.executeModelTokenOperation = __webpack_exports__.executeModelTokenOperation;
|
|
20953
21158
|
exports.filterCandidates = __webpack_exports__.filterCandidates;
|
|
20954
21159
|
exports.formatCandidateLabel = __webpack_exports__.formatCandidateLabel;
|
|
20955
21160
|
exports.formatGitAuthDoctorReport = __webpack_exports__.formatGitAuthDoctorReport;
|
|
@@ -20963,12 +21168,15 @@ exports.getGitFetchUrl = __webpack_exports__.getGitFetchUrl;
|
|
|
20963
21168
|
exports.getGitPushUrl = __webpack_exports__.getGitPushUrl;
|
|
20964
21169
|
exports.getInstalledPreferredEditors = __webpack_exports__.getInstalledPreferredEditors;
|
|
20965
21170
|
exports.getLatestVersion = __webpack_exports__.getLatestVersion;
|
|
21171
|
+
exports.getModelToken = __webpack_exports__.getModelToken;
|
|
21172
|
+
exports.getModelTokenHelperScript = __webpack_exports__.getModelTokenHelperScript;
|
|
20966
21173
|
exports.getPreferredEditorCommand = __webpack_exports__.getPreferredEditorCommand;
|
|
20967
21174
|
exports.getSettableConfigKeys = __webpack_exports__.getSettableConfigKeys;
|
|
20968
21175
|
exports.getValidAuthToken = __webpack_exports__.getValidAuthToken;
|
|
20969
21176
|
exports.getWebSocketUrl = __webpack_exports__.getWebSocketUrl;
|
|
20970
21177
|
exports.hasTokensForUrl = __webpack_exports__.hasTokensForUrl;
|
|
20971
21178
|
exports.inspectCredentialHelperCommand = __webpack_exports__.inspectCredentialHelperCommand;
|
|
21179
|
+
exports.installModelTokenHelperScript = __webpack_exports__.installModelTokenHelperScript;
|
|
20972
21180
|
exports.isCommandAvailable = __webpack_exports__.isCommandAvailable;
|
|
20973
21181
|
exports.isDirectoryNonEmpty = __webpack_exports__.isDirectoryNonEmpty;
|
|
20974
21182
|
exports.isPathInsideGitRepo = __webpack_exports__.isPathInsideGitRepo;
|
|
@@ -21004,9 +21212,11 @@ exports.validatePath = __webpack_exports__.validatePath;
|
|
|
21004
21212
|
exports.verifyAndStoreTokens = __webpack_exports__.verifyAndStoreTokens;
|
|
21005
21213
|
exports.verifyAuth = __webpack_exports__.verifyAuth;
|
|
21006
21214
|
exports.watch = __webpack_exports__.watch;
|
|
21215
|
+
exports.withRepoAuthFileLock = __webpack_exports__.withRepoAuthFileLock;
|
|
21007
21216
|
exports.writeEnvironmentPid = __webpack_exports__.writeEnvironmentPid;
|
|
21008
21217
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
21009
21218
|
"ANVIL_SYNC_CLIENT_ID",
|
|
21219
|
+
"AUTH_FILE_LOCK_DEFAULTS",
|
|
21010
21220
|
"AnvilYamlValidationResult",
|
|
21011
21221
|
"AppIdCandidate",
|
|
21012
21222
|
"AppIdWithContext",
|
|
@@ -21018,11 +21228,15 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
21018
21228
|
"CheckoutResult",
|
|
21019
21229
|
"DeviceAuthorizationResponse",
|
|
21020
21230
|
"FormTemplateValidationResult",
|
|
21231
|
+
"GetValidAuthTokenOptions",
|
|
21021
21232
|
"LoginResult",
|
|
21022
21233
|
"LogoutResult",
|
|
21234
|
+
"MODEL_TOKEN_HELPER_FILENAME",
|
|
21235
|
+
"MODEL_TOKEN_LOCK_TIMEOUT_MS",
|
|
21023
21236
|
"OAuthTokenResponse",
|
|
21024
21237
|
"ParsedCheckoutInput",
|
|
21025
21238
|
"PreferredEditor",
|
|
21239
|
+
"REFRESH_REQUEST_TIMEOUT_MS",
|
|
21026
21240
|
"SettableConfigKey",
|
|
21027
21241
|
"TokenData",
|
|
21028
21242
|
"ValidateAppIdResponse",
|
|
@@ -21043,6 +21257,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
21043
21257
|
"detectAppIdsFromAllRemotes",
|
|
21044
21258
|
"executeCheckout",
|
|
21045
21259
|
"executeGitCredentialOperation",
|
|
21260
|
+
"executeModelTokenOperation",
|
|
21046
21261
|
"filterCandidates",
|
|
21047
21262
|
"formatCandidateLabel",
|
|
21048
21263
|
"formatGitAuthDoctorReport",
|
|
@@ -21056,12 +21271,15 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
21056
21271
|
"getGitPushUrl",
|
|
21057
21272
|
"getInstalledPreferredEditors",
|
|
21058
21273
|
"getLatestVersion",
|
|
21274
|
+
"getModelToken",
|
|
21275
|
+
"getModelTokenHelperScript",
|
|
21059
21276
|
"getPreferredEditorCommand",
|
|
21060
21277
|
"getSettableConfigKeys",
|
|
21061
21278
|
"getValidAuthToken",
|
|
21062
21279
|
"getWebSocketUrl",
|
|
21063
21280
|
"hasTokensForUrl",
|
|
21064
21281
|
"inspectCredentialHelperCommand",
|
|
21282
|
+
"installModelTokenHelperScript",
|
|
21065
21283
|
"isCommandAvailable",
|
|
21066
21284
|
"isDirectoryNonEmpty",
|
|
21067
21285
|
"isPathInsideGitRepo",
|
|
@@ -21097,6 +21315,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
21097
21315
|
"verifyAndStoreTokens",
|
|
21098
21316
|
"verifyAuth",
|
|
21099
21317
|
"watch",
|
|
21318
|
+
"withRepoAuthFileLock",
|
|
21100
21319
|
"writeEnvironmentPid"
|
|
21101
21320
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
21102
21321
|
Object.defineProperty(exports, '__esModule', {
|
package/dist/services/auth.d.ts
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
* Handles token management, refresh, validation, and account management.
|
|
4
4
|
*/
|
|
5
5
|
import { AccountTokens } from "../config";
|
|
6
|
+
import { AuthFileLockOptions } from "./git-auth";
|
|
6
7
|
export declare const ANVIL_SYNC_CLIENT_ID = "anvil-sync";
|
|
8
|
+
/**
|
|
9
|
+
* Upper bound on a single /oauth/token refresh request. Must stay comfortably
|
|
10
|
+
* below the auth file lock's stale threshold (AUTH_FILE_LOCK_DEFAULTS.staleMs)
|
|
11
|
+
* so a refresh can never outlive its own lock; the lock heartbeat is the other
|
|
12
|
+
* half of that guarantee.
|
|
13
|
+
*/
|
|
14
|
+
export declare const REFRESH_REQUEST_TIMEOUT_MS = 12000;
|
|
7
15
|
/** Token data returned from OAuth token endpoint */
|
|
8
16
|
export interface TokenData {
|
|
9
17
|
access_token: string;
|
|
@@ -40,16 +48,41 @@ export declare function verifyAuth(authToken: string, anvilUrl?: string): Promis
|
|
|
40
48
|
* Refresh the access token using a refresh token.
|
|
41
49
|
* @throws {AuthError} if refresh fails
|
|
42
50
|
*/
|
|
43
|
-
export declare function refreshAccessToken(refreshToken: string, anvilUrl?: string, clientId?: string
|
|
51
|
+
export declare function refreshAccessToken(refreshToken: string, anvilUrl?: string, clientId?: string, options?: {
|
|
52
|
+
timeoutMs?: number;
|
|
53
|
+
}): Promise<TokenData>;
|
|
44
54
|
/**
|
|
45
55
|
* Check if we have tokens for a specific URL and username.
|
|
46
56
|
*/
|
|
47
57
|
export declare function hasTokensForUrl(anvilUrl: string, username?: string): Promise<boolean>;
|
|
58
|
+
export interface GetValidAuthTokenOptions {
|
|
59
|
+
/** Cross-process auth file lock settings, used when the tokens live in a repo auth file. */
|
|
60
|
+
lock?: AuthFileLockOptions;
|
|
61
|
+
/** Upper bound on the refresh request; defaults to REFRESH_REQUEST_TIMEOUT_MS. */
|
|
62
|
+
requestTimeoutMs?: number;
|
|
63
|
+
}
|
|
48
64
|
/**
|
|
49
65
|
* Get a valid access token, refreshing it if necessary.
|
|
50
66
|
* @throws {AuthError} if no valid token can be obtained
|
|
51
67
|
*/
|
|
52
|
-
export declare function getValidAuthToken(anvilUrl?: string, username?: string): Promise<string>;
|
|
68
|
+
export declare function getValidAuthToken(anvilUrl?: string, username?: string, options?: GetValidAuthTokenOptions): Promise<string>;
|
|
69
|
+
export interface RefreshRepoAuthTokensOptions {
|
|
70
|
+
anvilUrl: string;
|
|
71
|
+
username?: string;
|
|
72
|
+
/** Auth data already read from the repo; used if the locked re-read finds nothing newer. */
|
|
73
|
+
auth?: AuthData;
|
|
74
|
+
refreshToken?: string;
|
|
75
|
+
lock?: AuthFileLockOptions;
|
|
76
|
+
/** Upper bound on the refresh request; defaults to REFRESH_REQUEST_TIMEOUT_MS. */
|
|
77
|
+
requestTimeoutMs?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Refresh repo-stored auth tokens under the cross-process auth file lock.
|
|
81
|
+
* After acquiring the lock the auth file is re-read: another process may have
|
|
82
|
+
* already refreshed (and rotated the refresh token) while we waited, in which
|
|
83
|
+
* case the fresh token is returned without another refresh call.
|
|
84
|
+
*/
|
|
85
|
+
export declare function refreshRepoAuthTokens(repoPath: string, options: RefreshRepoAuthTokensOptions): Promise<string>;
|
|
53
86
|
/**
|
|
54
87
|
* Log in with token data from OAuth flow.
|
|
55
88
|
* @throws {AuthError} if verification fails
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/services/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAsC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/services/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAsC,MAAM,WAAW,CAAC;AAG9E,OAAO,EAAE,mBAAmB,EAA2D,MAAM,YAAY,CAAC;AAM1G,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD;;;;;GAKG;AAIH,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAMjD,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,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";
|
|
3
|
+
export declare const MODEL_TOKEN_HELPER_FILENAME = "anvil-model-token-helper.cjs";
|
|
3
4
|
export declare const GIT_CREDENTIAL_HELPER_LOCATOR = "$(git rev-parse --git-common-dir)/anvil-credential-helper.cjs";
|
|
4
5
|
export interface AppAuthBinding {
|
|
5
6
|
url?: string;
|
|
@@ -14,6 +15,17 @@ export declare function getAppAuthBinding(repoPath: string, appId: string): Prom
|
|
|
14
15
|
export declare function setAppAuthBinding(repoPath: string, appId: string, binding: AppAuthBinding): Promise<void>;
|
|
15
16
|
export declare function getCleanGitRemoteUrl(appId: string, gitUrl: string): string;
|
|
16
17
|
export declare function getCredentialHelperScript(modulePath: string): string;
|
|
18
|
+
export declare function getModelTokenHelperScript(modulePath: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate the model-token helper script and install it at the given absolute
|
|
21
|
+
* path (e.g. once per host into an agent home directory). The script resolves
|
|
22
|
+
* its repo from the invoking process's cwd via git rev-parse, prints a valid
|
|
23
|
+
* access token to stdout, and exits non-zero with a message on stderr on any
|
|
24
|
+
* failure.
|
|
25
|
+
*/
|
|
26
|
+
export declare function installModelTokenHelperScript(helperPath: string, options?: {
|
|
27
|
+
modulePath?: string;
|
|
28
|
+
}): Promise<string>;
|
|
17
29
|
export declare function getCredentialHelperModulePath(options?: {
|
|
18
30
|
currentModulePath?: string;
|
|
19
31
|
resolvePackageEntry?: () => string;
|
|
@@ -34,6 +46,29 @@ export declare function hardenCheckoutGitAuth(options: {
|
|
|
34
46
|
cleanRemoteUrl: string;
|
|
35
47
|
}>;
|
|
36
48
|
export declare function parseAppIdFromGitPath(pathValue?: string): string | undefined;
|
|
49
|
+
export interface AuthFileLockOptions {
|
|
50
|
+
/**
|
|
51
|
+
* Take over locks whose mtime is older than this. A live holder keeps its
|
|
52
|
+
* lockfile's mtime fresh (see heartbeatMs), so only a dead holder's lock
|
|
53
|
+
* ever reaches this age.
|
|
54
|
+
*/
|
|
55
|
+
staleMs?: number;
|
|
56
|
+
/** Give up waiting for another process after this long. */
|
|
57
|
+
timeoutMs?: number;
|
|
58
|
+
/** Delay between acquisition attempts while another process holds the lock. */
|
|
59
|
+
retryDelayMs?: number;
|
|
60
|
+
/** How often the holder touches the lockfile's mtime to prove it is still alive. */
|
|
61
|
+
heartbeatMs?: number;
|
|
62
|
+
}
|
|
63
|
+
export declare const AUTH_FILE_LOCK_DEFAULTS: Required<AuthFileLockOptions>;
|
|
64
|
+
/**
|
|
65
|
+
* Run `fn` while holding the cross-process lockfile beside the repo's
|
|
66
|
+
* anvil-auth.json. Every read-refresh-write cycle for repo-backed auth must go
|
|
67
|
+
* through this lock: the refresh token rotates on use and server-side reuse
|
|
68
|
+
* revokes the whole token family, so two processes racing a refresh would
|
|
69
|
+
* permanently kill the session's auth.
|
|
70
|
+
*/
|
|
71
|
+
export declare function withRepoAuthFileLock<T>(repoPath: string, fn: () => Promise<T>, options?: AuthFileLockOptions): Promise<T>;
|
|
37
72
|
export declare function writeAuthToFile(repoPath: string, auth: AuthData, encryptionKey: string): Promise<string>;
|
|
38
73
|
export declare const readAuthFromRepo: (repoPath: string) => Promise<AuthData | undefined>;
|
|
39
74
|
//# sourceMappingURL=git-auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-auth.d.ts","sourceRoot":"","sources":["../../src/services/git-auth.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAIrC,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAC5E,eAAO,MAAM,6BAA6B,kEAAwE,CAAC;AAEnH,MAAM,WAAW,cAAc;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAkBD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,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