feat(panel): Antigravity IDE & composer mount, modular preferences, session charts, and per-model context windows (v1.5.0)

This commit is contained in:
fish
2026-11-15 15:25:45 +09:00
parent 18c608ae63
commit ff2470481f
35 changed files with 2602 additions and 128 deletions
+17 -1
View File
@@ -122,9 +122,21 @@ export async function callLsRpc(method, body = {}, timeoutMs = 5000) {
* 向 LS 传递 `{ forceRefresh: true }`,绕过 `language_server.exe` 自身的 3 分钟缓存。
*
* @param {boolean} [forceRefresh=false] 是否强制穿透本地缓存与失败冷却
* @param {string} [accountName=''] 发起查询时宿主报告的账号,用于隔离配额缓存
* @returns {Promise<{data: object|null, fetchedAtMs: number, isStale: boolean, refreshFailed: boolean, error: string|null, fromCache: boolean}>}
*/
export async function getOfficialQuotaSummary(forceRefresh = false) {
export async function getOfficialQuotaSummary(forceRefresh = false, accountName = '') {
if (quotaSummaryCache.accountName !== accountName) {
Object.assign(quotaSummaryCache, {
accountName,
accountGeneration: quotaSummaryCache.accountGeneration + 1,
ts: 0,
lastAttemptTs: 0,
data: null,
error: null,
});
}
const generation = quotaSummaryCache.accountGeneration;
const now = Date.now();
if (!forceRefresh && quotaSummaryCache.data && now - quotaSummaryCache.ts < QUOTA_CACHE_TTL_MS) {
return {
@@ -155,6 +167,9 @@ export async function getOfficialQuotaSummary(forceRefresh = false) {
quotaSummaryCache.lastAttemptTs = now;
try {
const res = await callLsRpc('RetrieveUserQuotaSummary', { forceRefresh: true }, 6000);
const { userStatus } = await callLsRpc('GetUserStatus', {}, 2000);
if ((userStatus?.email || userStatus?.name || '') !== accountName) return {};
if (generation !== quotaSummaryCache.accountGeneration) return {};
const payload = res?.response !== undefined ? res.response : res;
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
const normalized =
@@ -175,6 +190,7 @@ export async function getOfficialQuotaSummary(forceRefresh = false) {
}
quotaSummaryCache.error = 'Quota summary empty';
} catch (err) {
if (generation !== quotaSummaryCache.accountGeneration) return {};
console.error(`RetrieveUserQuotaSummary failed: ${err.message}`);
quotaSummaryCache.error = err.message;
}