dsh-agy-link 0.6.46 → 0.6.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/CHANGELOG.md +44 -0
- package/dist/cli-image.mjs +72 -30
- package/dist/client.js +359 -65
- package/dist/index.js +680 -58
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -162,7 +162,7 @@ function defaultConfig() {
|
|
|
162
162
|
warmupModels: [PREFERRED_GEMINI_FLASH, PREFERRED_CLAUDE],
|
|
163
163
|
autoTranslate: false,
|
|
164
164
|
translateModel: PREFERRED_GEMINI_FLASH,
|
|
165
|
-
translateEffort: "
|
|
165
|
+
translateEffort: "low",
|
|
166
166
|
translateTargetLanguage: "中文(简体)",
|
|
167
167
|
translateMaxChars: 8e3,
|
|
168
168
|
translateMaxTokens: 4096,
|
|
@@ -569,28 +569,27 @@ function modelFamilyOf(modelId) {
|
|
|
569
569
|
/**
|
|
570
570
|
* True when the unattended quota probe must skip this account's summary call.
|
|
571
571
|
*
|
|
572
|
-
* Only
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
* be retried normally.
|
|
572
|
+
* Only terminal account-level refusals suppress: retrying them every hour is
|
|
573
|
+
* pure risk-control exposure. `auth` stays on the existing authRequired
|
|
574
|
+
* lifecycle, and network faults must be retried normally.
|
|
576
575
|
*/
|
|
577
576
|
function quotaSummarySuppressed(account, now = Date.now()) {
|
|
578
577
|
const state = account.quotaUnavailable;
|
|
579
578
|
if (state === void 0) return false;
|
|
580
|
-
if (state.reason !== "no_license" && state.reason !== "no_summary_access") return false;
|
|
579
|
+
if (state.reason !== "no_license" && state.reason !== "no_summary_access" && state.reason !== "validation_required" && state.reason !== "tos_violation") return false;
|
|
581
580
|
return state.retryAfter > now;
|
|
582
581
|
}
|
|
583
582
|
/**
|
|
584
583
|
* Whether the account should leave the background poll ENTIRELY.
|
|
585
584
|
*
|
|
586
|
-
*
|
|
587
|
-
* A free-tier account whose SUMMARY is
|
|
588
|
-
*
|
|
585
|
+
* Unlicensed, verification-blocked, and suspended accounts cannot produce
|
|
586
|
+
* usable quota until the user intervenes. A free-tier account whose SUMMARY is
|
|
587
|
+
* refused still refreshes its model list and user quota (issue #137).
|
|
589
588
|
*/
|
|
590
589
|
function accountPollSuppressed(account, now = Date.now()) {
|
|
591
590
|
const state = account.quotaUnavailable;
|
|
592
591
|
if (state === void 0) return false;
|
|
593
|
-
if (state.reason !== "no_license") return false;
|
|
592
|
+
if (state.reason !== "no_license" && state.reason !== "validation_required" && state.reason !== "tos_violation") return false;
|
|
594
593
|
return state.retryAfter > now;
|
|
595
594
|
}
|
|
596
595
|
/**
|
|
@@ -611,7 +610,7 @@ function accountHasArgon(acc, pool, catalog) {
|
|
|
611
610
|
if (catalog && catalog.source === "discovered") return catalog.models?.some((m) => isArgonModel(m.id)) ?? false;
|
|
612
611
|
return false;
|
|
613
612
|
}
|
|
614
|
-
const EFFORT_SUFFIX_RE = /-(?:low|medium|high|tiered|thinking)$/i;
|
|
613
|
+
const EFFORT_SUFFIX_RE = /-(?:tiered-)?(?:low|medium|high|xhigh|tiered|thinking)$/i;
|
|
615
614
|
/**
|
|
616
615
|
* Return the un-tiered base model slug (e.g. claude-opus-4-6-thinking -> claude-opus-4-6,
|
|
617
616
|
* claude-opus-5-5-high -> claude-opus-5-5).
|
|
@@ -633,6 +632,14 @@ function modelMatches(requestedModel, candidateModelId) {
|
|
|
633
632
|
if (r === c) return true;
|
|
634
633
|
return baseModelSlug(r) === baseModelSlug(c);
|
|
635
634
|
}
|
|
635
|
+
function quotaSupportsModel(acc, clean, pool, catalog) {
|
|
636
|
+
const familyQuotaModels = acc.quotas?.[modelFamilyOf(clean)]?.models;
|
|
637
|
+
if (Array.isArray(familyQuotaModels) && familyQuotaModels.some((m) => modelMatches(clean, m.modelId))) return true;
|
|
638
|
+
const lower = clean.toLowerCase();
|
|
639
|
+
if (lower === "gemini-pro-orchestrator-neon") return Array.isArray(familyQuotaModels) && familyQuotaModels.some((m) => modelMatches("gemini-4-neon", m.modelId));
|
|
640
|
+
if (lower === "gemini-pro-orchestrator-g1-pro") return accountHasArgon(acc, pool, catalog);
|
|
641
|
+
return false;
|
|
642
|
+
}
|
|
636
643
|
/**
|
|
637
644
|
* Determine whether a managed account supports a specific model.
|
|
638
645
|
* If the account's quota or discovered catalog enumerates models for that family,
|
|
@@ -645,14 +652,13 @@ function accountSupportsModel(acc, model, pool, catalog) {
|
|
|
645
652
|
if (isArgonModel(clean)) return accountHasArgon(acc, pool, catalog);
|
|
646
653
|
if (catalog && catalog.source === "discovered" && Array.isArray(catalog.models) && catalog.models.length > 0) {
|
|
647
654
|
if (catalog.models.some((m) => modelMatches(clean, m.id))) return true;
|
|
648
|
-
|
|
649
|
-
if (Array.isArray(familyQuotaModels) && familyQuotaModels.some((m) => modelMatches(clean, m.modelId))) return true;
|
|
655
|
+
if (quotaSupportsModel(acc, clean, pool, catalog)) return true;
|
|
650
656
|
return false;
|
|
651
657
|
}
|
|
652
658
|
const family = modelFamilyOf(clean);
|
|
653
659
|
const familyQuota = acc.quotas?.[family];
|
|
654
660
|
if (familyQuota) {
|
|
655
|
-
if (Array.isArray(familyQuota.models) && familyQuota.models.length > 0) return
|
|
661
|
+
if (Array.isArray(familyQuota.models) && familyQuota.models.length > 0) return quotaSupportsModel(acc, clean, pool, catalog);
|
|
656
662
|
return true;
|
|
657
663
|
}
|
|
658
664
|
if (acc.quotas && Object.keys(acc.quotas).length > 0 && acc.quotas.google !== void 0) return false;
|
|
@@ -1294,7 +1300,7 @@ var ModelCatalog = class ModelCatalog {
|
|
|
1294
1300
|
const ac = new AbortController();
|
|
1295
1301
|
const timer = setTimeout(() => ac.abort(), 3e4);
|
|
1296
1302
|
try {
|
|
1297
|
-
const { stdout, stderr } = await this.discover(ac.signal, accountId);
|
|
1303
|
+
const { stdout, stderr, accountId: probedAccountId } = await this.discover(ac.signal, accountId);
|
|
1298
1304
|
if (isUnauthenticatedModelsFallback(stdout, stderr)) {
|
|
1299
1305
|
const msg = "agy models returned unauthenticated fallback output";
|
|
1300
1306
|
if (accountId) {
|
|
@@ -1323,7 +1329,10 @@ var ModelCatalog = class ModelCatalog {
|
|
|
1323
1329
|
if (accountId) {
|
|
1324
1330
|
this.accountCatalogs.set(accountId, newCatalog);
|
|
1325
1331
|
if (this.current.source !== "discovered") this.current = newCatalog;
|
|
1326
|
-
} else
|
|
1332
|
+
} else {
|
|
1333
|
+
this.current = newCatalog;
|
|
1334
|
+
if (probedAccountId) this.accountCatalogs.set(probedAccountId, newCatalog);
|
|
1335
|
+
}
|
|
1327
1336
|
this.persistToDisk();
|
|
1328
1337
|
if (changed && announce) this.onUpdate?.();
|
|
1329
1338
|
return;
|
|
@@ -30936,6 +30945,20 @@ var RunRecording = class {
|
|
|
30936
30945
|
}
|
|
30937
30946
|
return null;
|
|
30938
30947
|
}
|
|
30948
|
+
/**
|
|
30949
|
+
* True when at least one consumable `result` event (`ok` or non-empty
|
|
30950
|
+
* `response`) exists at index >= `from`. A settled recording with
|
|
30951
|
+
* `failureInfo === null` and no consumable result at `>= from` would always
|
|
30952
|
+
* fail with `agy stream ended without a result event` if re-driven.
|
|
30953
|
+
*/
|
|
30954
|
+
hasConsumableResultFrom(from) {
|
|
30955
|
+
const start = Math.max(0, from);
|
|
30956
|
+
for (let i = start; i < this.events.length; i++) {
|
|
30957
|
+
const ev = this.events[i];
|
|
30958
|
+
if (ev !== void 0 && ev.kind === "result" && (ev.ok || ev.response !== "")) return true;
|
|
30959
|
+
}
|
|
30960
|
+
return false;
|
|
30961
|
+
}
|
|
30939
30962
|
/** Event at an absolute index (bounds-checked). */
|
|
30940
30963
|
eventAt(index) {
|
|
30941
30964
|
return this.events[index];
|
|
@@ -32299,7 +32322,7 @@ async function resolveEventToolArgs(rec, ev, i, resolved) {
|
|
|
32299
32322
|
}
|
|
32300
32323
|
}
|
|
32301
32324
|
}
|
|
32302
|
-
async function* driveSpan(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice) {
|
|
32325
|
+
async function* driveSpan(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice, skipDbEnrichment = false) {
|
|
32303
32326
|
if (signal?.aborted) {
|
|
32304
32327
|
rec.requestAbort?.();
|
|
32305
32328
|
yield {
|
|
@@ -32317,14 +32340,14 @@ async function* driveSpan(deps, rec, from, cutOnTool, useCodeWrapper, goalContex
|
|
|
32317
32340
|
deps.runs.remember(rec);
|
|
32318
32341
|
deps.runs.pin(rec.runId);
|
|
32319
32342
|
try {
|
|
32320
|
-
yield* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice);
|
|
32343
|
+
yield* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice, skipDbEnrichment);
|
|
32321
32344
|
} finally {
|
|
32322
32345
|
deps.runs.unpin(rec.runId);
|
|
32323
32346
|
deps.runs.remember(rec);
|
|
32324
32347
|
}
|
|
32325
32348
|
}
|
|
32326
32349
|
/** Body of {@link driveSpan}: map recorded events until the span finishes. */
|
|
32327
|
-
async function* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice) {
|
|
32350
|
+
async function* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalContext, supportsGoalUpdate, supportsPlanExit, signal, compactionNotice, skipDbEnrichment = false) {
|
|
32328
32351
|
const queue = new ChunkQueue();
|
|
32329
32352
|
let abortedLocally = false;
|
|
32330
32353
|
const onAbort = () => {
|
|
@@ -32365,9 +32388,11 @@ async function* driveSpanBody(deps, rec, from, cutOnTool, useCodeWrapper, goalCo
|
|
|
32365
32388
|
try {
|
|
32366
32389
|
for await (const ev of rec.eventsFrom(from)) {
|
|
32367
32390
|
if (abortedLocally || signal?.aborted) break;
|
|
32368
|
-
|
|
32369
|
-
|
|
32370
|
-
|
|
32391
|
+
if (!skipDbEnrichment) {
|
|
32392
|
+
await resolveEventThought(rec, ev, i, resolvedThoughts, pendingThoughtSteps);
|
|
32393
|
+
if (pendingThoughtSteps.size > 0) await resolvePendingThoughts(rec, ev, resolvedThoughts, pendingThoughtSteps);
|
|
32394
|
+
await resolveEventToolArgs(rec, ev, i, resolved);
|
|
32395
|
+
}
|
|
32371
32396
|
for (const ch of mapper.map(ev, i)) queue.push(ch);
|
|
32372
32397
|
i++;
|
|
32373
32398
|
if (mapper.isFinished) {
|
|
@@ -34894,7 +34919,7 @@ function buildSpawnArgs(input, printTimeoutMinutes, log) {
|
|
|
34894
34919
|
};
|
|
34895
34920
|
}
|
|
34896
34921
|
/** Create the recording, parser, HOME snapshot and tool watchdog for one run. */
|
|
34897
|
-
function createAttemptRecorder(deps, cfg, account, initialConversationId) {
|
|
34922
|
+
function createAttemptRecorder(deps, cfg, account, initialConversationId, trackSubagents = true) {
|
|
34898
34923
|
const rec = deps.runs.create();
|
|
34899
34924
|
rec.accountHome = account && account.dir ? account.dir : void 0;
|
|
34900
34925
|
const conversationsDir = conversationsDirFor(rec.accountHome);
|
|
@@ -34902,7 +34927,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
|
|
|
34902
34927
|
const parser = new StreamJsonParser();
|
|
34903
34928
|
deps.onParser?.(parser);
|
|
34904
34929
|
const watchdog = createToolWatchdog(deps.log, cfg);
|
|
34905
|
-
const tracker = new SubagentTracker({
|
|
34930
|
+
const tracker = trackSubagents ? new SubagentTracker({
|
|
34906
34931
|
conversationId: initialConversationId,
|
|
34907
34932
|
resumed: Boolean(initialConversationId),
|
|
34908
34933
|
accountHome: rec.accountHome,
|
|
@@ -34913,7 +34938,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
|
|
|
34913
34938
|
noteActivity: () => {
|
|
34914
34939
|
watchdog.markEvent();
|
|
34915
34940
|
}
|
|
34916
|
-
});
|
|
34941
|
+
}) : void 0;
|
|
34917
34942
|
const state = {
|
|
34918
34943
|
rec,
|
|
34919
34944
|
parser,
|
|
@@ -34923,8 +34948,8 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
|
|
|
34923
34948
|
printTimeoutMinutes: watchdog.printTimeoutMinutes,
|
|
34924
34949
|
attachProcess: (proc) => {
|
|
34925
34950
|
watchdog.attach(proc);
|
|
34926
|
-
tracker
|
|
34927
|
-
proc.outcome.finally(() => tracker
|
|
34951
|
+
tracker?.start();
|
|
34952
|
+
proc.outcome.finally(() => tracker?.stop());
|
|
34928
34953
|
},
|
|
34929
34954
|
feedLine: (line, onEvent, onFirstEvent) => {
|
|
34930
34955
|
watchdog.markEvent();
|
|
@@ -34932,11 +34957,11 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
|
|
|
34932
34957
|
for (const ev of parser.feed(line + "\n")) {
|
|
34933
34958
|
if (ev.kind === "init" && ev.conversationId) {
|
|
34934
34959
|
state.streamCid = ev.conversationId;
|
|
34935
|
-
tracker
|
|
34960
|
+
tracker?.setConversationId(ev.conversationId);
|
|
34936
34961
|
}
|
|
34937
34962
|
if (ev.kind === "result" && ev.conversationId !== "") {
|
|
34938
34963
|
state.streamCid = ev.conversationId;
|
|
34939
|
-
tracker
|
|
34964
|
+
tracker?.setConversationId(ev.conversationId);
|
|
34940
34965
|
}
|
|
34941
34966
|
watchdog.trackStep(ev);
|
|
34942
34967
|
rec.append(ev);
|
|
@@ -34949,7 +34974,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
|
|
|
34949
34974
|
for (const ev of parser.flush()) {
|
|
34950
34975
|
if (ev.kind === "result" && ev.conversationId !== "") {
|
|
34951
34976
|
state.streamCid = ev.conversationId;
|
|
34952
|
-
tracker
|
|
34977
|
+
tracker?.setConversationId(ev.conversationId);
|
|
34953
34978
|
}
|
|
34954
34979
|
rec.append(ev);
|
|
34955
34980
|
if (typeof onEvent === "function") try {
|
|
@@ -34959,7 +34984,7 @@ function createAttemptRecorder(deps, cfg, account, initialConversationId) {
|
|
|
34959
34984
|
},
|
|
34960
34985
|
stop: () => {
|
|
34961
34986
|
watchdog.stop();
|
|
34962
|
-
tracker
|
|
34987
|
+
tracker?.stop();
|
|
34963
34988
|
},
|
|
34964
34989
|
conversationId: () => state.streamCid ?? diffConversations(before, conversationsDir).conversationId
|
|
34965
34990
|
};
|
|
@@ -35023,6 +35048,19 @@ async function waitForRunSettle(run, timeoutMs) {
|
|
|
35023
35048
|
}
|
|
35024
35049
|
return run.isSettled;
|
|
35025
35050
|
}
|
|
35051
|
+
function persistBindingOnResult(deps, input, recorder, ev) {
|
|
35052
|
+
if (ev.kind !== "result" || !ev.ok || looksLikeTosViolation(ev.response) || !input.persistBinding || input.sessionAccountKey === "" || deps.isSuperseded(input.sessionKey, recorder.rec)) return;
|
|
35053
|
+
const finalId = input.binding !== void 0 ? input.binding.conversationId : ev.conversationId || recorder.streamCid;
|
|
35054
|
+
if (!finalId) return;
|
|
35055
|
+
const mergedImages = input.binding?.sentImageIds || input.newlySentImageIds.length > 0 ? [.../* @__PURE__ */ new Set([...input.binding?.sentImageIds ?? [], ...input.newlySentImageIds])] : void 0;
|
|
35056
|
+
deps.store.set(input.sessionAccountKey, {
|
|
35057
|
+
conversationId: finalId,
|
|
35058
|
+
lastMessageCount: input.messages.length,
|
|
35059
|
+
updatedAt: Date.now(),
|
|
35060
|
+
model: input.activeModel,
|
|
35061
|
+
...mergedImages && mergedImages.length > 0 ? { sentImageIds: mergedImages } : {}
|
|
35062
|
+
});
|
|
35063
|
+
}
|
|
35026
35064
|
/**
|
|
35027
35065
|
* Spawn the child under the held slot. Installs the line callback (parser feed
|
|
35028
35066
|
* + tool watchdog + first-event hand-off), registers the run for steer
|
|
@@ -35066,9 +35104,10 @@ async function startAttemptProcess(deps, input, spawn, recorder, slot) {
|
|
|
35066
35104
|
stdinPayload: spawn.stdinPayload,
|
|
35067
35105
|
preemptAutoUpdate: cfg.suppressAgyAutoUpdate,
|
|
35068
35106
|
stderrKeepalive: true,
|
|
35069
|
-
onLine: (line) => {
|
|
35070
|
-
|
|
35071
|
-
|
|
35107
|
+
onLine: (line) => recorder.feedLine(line, (ev) => {
|
|
35108
|
+
persistBindingOnResult(deps, input, recorder, ev);
|
|
35109
|
+
input.agyOnEvent?.(ev);
|
|
35110
|
+
}, () => slotHandoff?.onFirstEvent())
|
|
35072
35111
|
});
|
|
35073
35112
|
spawned = true;
|
|
35074
35113
|
recorder.attachProcess(proc);
|
|
@@ -35578,7 +35617,8 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
35578
35617
|
deps.clearInFlightPrompt(sessionKey, spawn.prompt);
|
|
35579
35618
|
recorder.drain(input.agyOnEvent);
|
|
35580
35619
|
const conversationId = recorder.conversationId();
|
|
35581
|
-
|
|
35620
|
+
const existingRes = rec.getResultEvent();
|
|
35621
|
+
if (!(existingRes !== null && (existingRes.ok || existingRes.response !== "")) && outcome.idleGraceTerminated) {
|
|
35582
35622
|
const recovered = conversationId === null ? "" : recoverFinalReply(conversationId, rec.accountHome);
|
|
35583
35623
|
const synthResult = {
|
|
35584
35624
|
kind: "result",
|
|
@@ -35639,7 +35679,7 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
35639
35679
|
* queue notices; the outcome closure runs detached exactly as before.
|
|
35640
35680
|
*/
|
|
35641
35681
|
async function* runAgyAttempt(deps, input) {
|
|
35642
|
-
const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId);
|
|
35682
|
+
const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId, !input.isAux);
|
|
35643
35683
|
const spawn = buildSpawnArgs(input, recorder.printTimeoutMinutes, deps.log);
|
|
35644
35684
|
const slot = yield* dispatchCredentialSlot(deps, {
|
|
35645
35685
|
...input,
|
|
@@ -35884,13 +35924,14 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
35884
35924
|
if (continuation !== null) {
|
|
35885
35925
|
const rec = this.deps.runs.get(continuation.runId);
|
|
35886
35926
|
const deadFailure = rec !== void 0 && rec.isSettled ? rec.failureInfo : null;
|
|
35887
|
-
|
|
35927
|
+
const deadMissingResult = rec !== void 0 && rec.isSettled && deadFailure === null && !rec.hasConsumableResultFrom(continuation.eventIndex + 1);
|
|
35928
|
+
if (rec !== void 0 && !deadMissingResult && !(deadFailure !== null && this.claimFailover(sessionKey, deadFailure.code))) {
|
|
35888
35929
|
yield* driveSpan(this.deps, rec, continuation.eventIndex + 1, hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal);
|
|
35889
35930
|
return;
|
|
35890
35931
|
}
|
|
35891
35932
|
if (rec !== void 0) {
|
|
35892
35933
|
this.deps.runs.forget(continuation.runId);
|
|
35893
|
-
this.warnOnce("dead-continuation:" + continuation.runId, "agy run " + continuation.runId + " settled in " + (deadFailure?.code ?? "") + " — retrying this step instead of replaying it" + (deadFailure?.code === Err.NETWORK && this.sharesSingleEgress() ? " on the same account (shared egress)" : " on another account"));
|
|
35934
|
+
this.warnOnce("dead-continuation:" + continuation.runId, deadMissingResult ? "agy run " + continuation.runId + " settled without a consumable result — retrying this step instead of replaying an empty stream" : "agy run " + continuation.runId + " settled in " + (deadFailure?.code ?? "") + " — retrying this step instead of replaying it" + (deadFailure?.code === Err.NETWORK && this.sharesSingleEgress() ? " on the same account (shared egress)" : " on another account"));
|
|
35894
35935
|
} else this.warnOnce("stale-continuation:" + continuation.runId, "agy run " + continuation.runId + " is no longer available in memory (server restarted?) — falling back to fresh turn prompt assembly");
|
|
35895
35936
|
}
|
|
35896
35937
|
const catalog = this.deps.catalog.get();
|
|
@@ -36075,7 +36116,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
36075
36116
|
signal: options.signal,
|
|
36076
36117
|
agyOnEvent: options.agyOnEvent
|
|
36077
36118
|
});
|
|
36078
|
-
yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice);
|
|
36119
|
+
yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice, isAux && !isImage);
|
|
36079
36120
|
}
|
|
36080
36121
|
};
|
|
36081
36122
|
//#endregion
|
|
@@ -38773,6 +38814,495 @@ var TranslationService = class {
|
|
|
38773
38814
|
}
|
|
38774
38815
|
}
|
|
38775
38816
|
};
|
|
38817
|
+
const STDERR_TAIL_CAP = 2048;
|
|
38818
|
+
const PRINT_TIMEOUT_ARG = "30m";
|
|
38819
|
+
function appendTail(prev, chunk) {
|
|
38820
|
+
const next = prev + chunk;
|
|
38821
|
+
return next.length > STDERR_TAIL_CAP ? next.slice(-2048) : next;
|
|
38822
|
+
}
|
|
38823
|
+
function killWorkerProcess(worker, platform) {
|
|
38824
|
+
if (worker.idleTimer !== null) {
|
|
38825
|
+
clearTimeout(worker.idleTimer);
|
|
38826
|
+
worker.idleTimer = null;
|
|
38827
|
+
}
|
|
38828
|
+
worker.closed = true;
|
|
38829
|
+
const child = worker.child;
|
|
38830
|
+
try {
|
|
38831
|
+
child.stdin?.end();
|
|
38832
|
+
} catch {}
|
|
38833
|
+
if (platform !== "win32" && typeof child.pid === "number" && child.pid > 0) try {
|
|
38834
|
+
process.kill(-child.pid, "SIGKILL");
|
|
38835
|
+
return;
|
|
38836
|
+
} catch {}
|
|
38837
|
+
try {
|
|
38838
|
+
child.kill("SIGKILL");
|
|
38839
|
+
} catch {}
|
|
38840
|
+
}
|
|
38841
|
+
function resetParserTurnStats(worker) {
|
|
38842
|
+
worker.stderrTail = "";
|
|
38843
|
+
worker.parser.stats.lastResultError = void 0;
|
|
38844
|
+
worker.parser.stats.sawAuthFailure = false;
|
|
38845
|
+
worker.parser.stats.authFailureText = void 0;
|
|
38846
|
+
}
|
|
38847
|
+
function attachWorkerStreams(worker, onClose) {
|
|
38848
|
+
const dispatchEvents = (events) => {
|
|
38849
|
+
const waiter = worker.activeTurn;
|
|
38850
|
+
if (!waiter) return;
|
|
38851
|
+
for (const ev of events) if (ev.kind === "step" && ev.stepKind === "text") {
|
|
38852
|
+
if (ev.fragment) waiter.deltaText += ev.text;
|
|
38853
|
+
else if (ev.text !== "") waiter.fullStepText = ev.text;
|
|
38854
|
+
} else if (ev.kind === "result") {
|
|
38855
|
+
worker.activeTurn = null;
|
|
38856
|
+
const text = (ev.response || waiter.deltaText || waiter.fullStepText).trim();
|
|
38857
|
+
waiter.resolve({
|
|
38858
|
+
kind: "result",
|
|
38859
|
+
ok: ev.ok,
|
|
38860
|
+
response: text,
|
|
38861
|
+
...ev.error === void 0 ? {} : { error: ev.error }
|
|
38862
|
+
});
|
|
38863
|
+
return;
|
|
38864
|
+
}
|
|
38865
|
+
};
|
|
38866
|
+
worker.child.stdin?.on("error", () => void 0);
|
|
38867
|
+
worker.child.stdout?.on("data", (buf) => {
|
|
38868
|
+
const chunk = typeof buf === "string" ? buf : buf.toString("utf8");
|
|
38869
|
+
dispatchEvents(worker.parser.feed(chunk));
|
|
38870
|
+
});
|
|
38871
|
+
worker.child.stderr?.on("data", (buf) => {
|
|
38872
|
+
const chunk = typeof buf === "string" ? buf : buf.toString("utf8");
|
|
38873
|
+
worker.stderrTail = appendTail(worker.stderrTail, chunk);
|
|
38874
|
+
});
|
|
38875
|
+
worker.child.on("error", (err) => {
|
|
38876
|
+
worker.closed = true;
|
|
38877
|
+
onClose(worker);
|
|
38878
|
+
const waiter = worker.activeTurn;
|
|
38879
|
+
if (waiter) {
|
|
38880
|
+
worker.activeTurn = null;
|
|
38881
|
+
waiter.resolve({
|
|
38882
|
+
kind: "exit",
|
|
38883
|
+
code: null,
|
|
38884
|
+
error: err.message
|
|
38885
|
+
});
|
|
38886
|
+
}
|
|
38887
|
+
});
|
|
38888
|
+
worker.child.on("close", (code) => {
|
|
38889
|
+
worker.closed = true;
|
|
38890
|
+
dispatchEvents(worker.parser.flush());
|
|
38891
|
+
onClose(worker);
|
|
38892
|
+
const waiter = worker.activeTurn;
|
|
38893
|
+
if (waiter) {
|
|
38894
|
+
worker.activeTurn = null;
|
|
38895
|
+
waiter.resolve({
|
|
38896
|
+
kind: "exit",
|
|
38897
|
+
code
|
|
38898
|
+
});
|
|
38899
|
+
}
|
|
38900
|
+
});
|
|
38901
|
+
}
|
|
38902
|
+
function awaitWorkerTurn(worker, prompt, timeoutMs, signal, onKill) {
|
|
38903
|
+
resetParserTurnStats(worker);
|
|
38904
|
+
return new Promise((resolve) => {
|
|
38905
|
+
let settled = false;
|
|
38906
|
+
let timer = null;
|
|
38907
|
+
const finish = (outcome) => {
|
|
38908
|
+
if (settled) return;
|
|
38909
|
+
settled = true;
|
|
38910
|
+
if (timer !== null) clearTimeout(timer);
|
|
38911
|
+
signal?.removeEventListener("abort", onAbort);
|
|
38912
|
+
worker.activeTurn = null;
|
|
38913
|
+
resolve(outcome);
|
|
38914
|
+
};
|
|
38915
|
+
const onAbort = () => {
|
|
38916
|
+
onKill();
|
|
38917
|
+
finish({
|
|
38918
|
+
kind: "aborted",
|
|
38919
|
+
error: "aborted by caller"
|
|
38920
|
+
});
|
|
38921
|
+
};
|
|
38922
|
+
worker.activeTurn = {
|
|
38923
|
+
deltaText: "",
|
|
38924
|
+
fullStepText: "",
|
|
38925
|
+
resolve: finish
|
|
38926
|
+
};
|
|
38927
|
+
if (signal?.aborted) {
|
|
38928
|
+
onAbort();
|
|
38929
|
+
return;
|
|
38930
|
+
}
|
|
38931
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
38932
|
+
timer = setTimeout(() => {
|
|
38933
|
+
onKill();
|
|
38934
|
+
finish({
|
|
38935
|
+
kind: "timeout",
|
|
38936
|
+
error: "translation timed out after " + timeoutMs + "ms"
|
|
38937
|
+
});
|
|
38938
|
+
}, Math.max(1e3, timeoutMs));
|
|
38939
|
+
timer.unref?.();
|
|
38940
|
+
try {
|
|
38941
|
+
const line = buildStreamInputLine(prompt);
|
|
38942
|
+
if (!worker.child.stdin) throw new Error("translation worker stdin unavailable");
|
|
38943
|
+
worker.child.stdin.write(line, "utf8");
|
|
38944
|
+
} catch (err) {
|
|
38945
|
+
onKill();
|
|
38946
|
+
finish({
|
|
38947
|
+
kind: "exit",
|
|
38948
|
+
code: null,
|
|
38949
|
+
error: err instanceof Error ? err.message : String(err)
|
|
38950
|
+
});
|
|
38951
|
+
}
|
|
38952
|
+
});
|
|
38953
|
+
}
|
|
38954
|
+
function waitForQueueOrAbort(queue, signal) {
|
|
38955
|
+
if (!signal) return queue.then(() => false);
|
|
38956
|
+
if (signal.aborted) return Promise.resolve(true);
|
|
38957
|
+
return new Promise((resolve) => {
|
|
38958
|
+
const onAbort = () => resolve(true);
|
|
38959
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
38960
|
+
queue.then(() => {
|
|
38961
|
+
signal.removeEventListener("abort", onAbort);
|
|
38962
|
+
resolve(signal.aborted);
|
|
38963
|
+
});
|
|
38964
|
+
});
|
|
38965
|
+
}
|
|
38966
|
+
var TranslationWorkerPool = class {
|
|
38967
|
+
deps;
|
|
38968
|
+
worker = null;
|
|
38969
|
+
queue = Promise.resolve();
|
|
38970
|
+
disposed = false;
|
|
38971
|
+
constructor(deps) {
|
|
38972
|
+
this.deps = deps;
|
|
38973
|
+
}
|
|
38974
|
+
platform() {
|
|
38975
|
+
return this.deps.platform ?? process.platform;
|
|
38976
|
+
}
|
|
38977
|
+
now() {
|
|
38978
|
+
return this.deps.now?.() ?? Date.now();
|
|
38979
|
+
}
|
|
38980
|
+
/**
|
|
38981
|
+
* Attempt a fast translation via a persistent warm `agy` stream-json worker.
|
|
38982
|
+
* Returns `null` when unavailable (Windows, missing binary, or inside
|
|
38983
|
+
* default test harness without an injected `spawn`) so callers fall back cleanly.
|
|
38984
|
+
*/
|
|
38985
|
+
async tryTranslate(req) {
|
|
38986
|
+
if (this.disposed || this.platform() === "win32") return null;
|
|
38987
|
+
if (this.deps.spawn === void 0 && process.env.NODE_TEST_CONTEXT !== void 0) return null;
|
|
38988
|
+
if (!this.deps.bin()) return null;
|
|
38989
|
+
const startedAt = this.now();
|
|
38990
|
+
let releaseQueue;
|
|
38991
|
+
const prevQueue = this.queue;
|
|
38992
|
+
const gate = new Promise((r) => {
|
|
38993
|
+
releaseQueue = r;
|
|
38994
|
+
});
|
|
38995
|
+
this.queue = prevQueue.then(() => gate, () => gate);
|
|
38996
|
+
if (await waitForQueueOrAbort(prevQueue, req.signal) || this.disposed) {
|
|
38997
|
+
releaseQueue();
|
|
38998
|
+
return this.disposed ? null : {
|
|
38999
|
+
ok: false,
|
|
39000
|
+
text: "",
|
|
39001
|
+
code: "ABORTED",
|
|
39002
|
+
error: "aborted by caller",
|
|
39003
|
+
durationMs: this.now() - startedAt
|
|
39004
|
+
};
|
|
39005
|
+
}
|
|
39006
|
+
try {
|
|
39007
|
+
return await this.execute(req, startedAt);
|
|
39008
|
+
} finally {
|
|
39009
|
+
releaseQueue();
|
|
39010
|
+
}
|
|
39011
|
+
}
|
|
39012
|
+
dispose() {
|
|
39013
|
+
this.disposed = true;
|
|
39014
|
+
this.dropWorker(this.worker);
|
|
39015
|
+
}
|
|
39016
|
+
dropWorker(target) {
|
|
39017
|
+
if (!target) return;
|
|
39018
|
+
if (this.worker === target) this.worker = null;
|
|
39019
|
+
killWorkerProcess(target, this.platform());
|
|
39020
|
+
}
|
|
39021
|
+
armIdleTimer(target) {
|
|
39022
|
+
if (target.idleTimer !== null) clearTimeout(target.idleTimer);
|
|
39023
|
+
const ttl = this.deps.idleTtlMs ?? 3e5;
|
|
39024
|
+
target.idleTimer = setTimeout(() => {
|
|
39025
|
+
if (this.worker === target && !target.activeTurn) this.dropWorker(target);
|
|
39026
|
+
}, ttl);
|
|
39027
|
+
target.idleTimer.unref?.();
|
|
39028
|
+
}
|
|
39029
|
+
ensureWorker(bin, cfg, account, model, effort, promptLen) {
|
|
39030
|
+
const key = `${account?.id ?? "default"}|${model}|${effort}`;
|
|
39031
|
+
const maxTurns = this.deps.maxTurns ?? 8;
|
|
39032
|
+
const maxChars = this.deps.maxPromptChars ?? 32e3;
|
|
39033
|
+
const idleTtlMs = this.deps.idleTtlMs ?? 3e5;
|
|
39034
|
+
const cur = this.worker;
|
|
39035
|
+
if (cur && !cur.closed) {
|
|
39036
|
+
const expired = this.now() - cur.lastUsedAt > idleTtlMs;
|
|
39037
|
+
const exhausted = cur.turns >= maxTurns || cur.promptChars + promptLen > maxChars;
|
|
39038
|
+
if (cur.key === key && !expired && !exhausted) {
|
|
39039
|
+
if (cur.idleTimer !== null) {
|
|
39040
|
+
clearTimeout(cur.idleTimer);
|
|
39041
|
+
cur.idleTimer = null;
|
|
39042
|
+
}
|
|
39043
|
+
return cur;
|
|
39044
|
+
}
|
|
39045
|
+
this.dropWorker(cur);
|
|
39046
|
+
}
|
|
39047
|
+
if (account?.dir && !account.systemHome) try {
|
|
39048
|
+
ensureIsolatedKeychain(account.dir);
|
|
39049
|
+
} catch {}
|
|
39050
|
+
const env = withAgyQuietEnv(buildAgyEnv({
|
|
39051
|
+
account,
|
|
39052
|
+
cfg,
|
|
39053
|
+
telemetryFlags: false
|
|
39054
|
+
}));
|
|
39055
|
+
if (cfg.suppressAgyAutoUpdate !== false) preemptAgyAutoUpdate(env, this.now());
|
|
39056
|
+
const args = [
|
|
39057
|
+
"-p",
|
|
39058
|
+
"--output-format",
|
|
39059
|
+
"stream-json",
|
|
39060
|
+
"--input-format",
|
|
39061
|
+
"stream-json",
|
|
39062
|
+
"--mode",
|
|
39063
|
+
"plan",
|
|
39064
|
+
"--model",
|
|
39065
|
+
model,
|
|
39066
|
+
"--print-timeout",
|
|
39067
|
+
PRINT_TIMEOUT_ARG
|
|
39068
|
+
];
|
|
39069
|
+
if (effort !== "") args.push("--effort", effort);
|
|
39070
|
+
const created = {
|
|
39071
|
+
key,
|
|
39072
|
+
account,
|
|
39073
|
+
model,
|
|
39074
|
+
effort,
|
|
39075
|
+
child: (this.deps.spawn ?? ((cmd, a, opts) => spawn(cmd, a, opts)))(bin, args, {
|
|
39076
|
+
cwd: tmpdir(),
|
|
39077
|
+
env,
|
|
39078
|
+
stdio: [
|
|
39079
|
+
"pipe",
|
|
39080
|
+
"pipe",
|
|
39081
|
+
"pipe"
|
|
39082
|
+
],
|
|
39083
|
+
detached: this.platform() !== "win32",
|
|
39084
|
+
windowsHide: true
|
|
39085
|
+
}),
|
|
39086
|
+
parser: new StreamJsonParser(),
|
|
39087
|
+
stderrTail: "",
|
|
39088
|
+
turns: 0,
|
|
39089
|
+
promptChars: 0,
|
|
39090
|
+
lastUsedAt: this.now(),
|
|
39091
|
+
idleTimer: null,
|
|
39092
|
+
closed: false,
|
|
39093
|
+
activeTurn: null
|
|
39094
|
+
};
|
|
39095
|
+
attachWorkerStreams(created, (w) => {
|
|
39096
|
+
if (this.worker === w) this.worker = null;
|
|
39097
|
+
});
|
|
39098
|
+
this.worker = created;
|
|
39099
|
+
return created;
|
|
39100
|
+
}
|
|
39101
|
+
async execute(req, startedAt) {
|
|
39102
|
+
if (req.signal?.aborted) return {
|
|
39103
|
+
ok: false,
|
|
39104
|
+
text: "",
|
|
39105
|
+
code: "ABORTED",
|
|
39106
|
+
error: "aborted by caller",
|
|
39107
|
+
durationMs: this.now() - startedAt
|
|
39108
|
+
};
|
|
39109
|
+
const bin = this.deps.bin();
|
|
39110
|
+
if (!bin) return null;
|
|
39111
|
+
const cfg = this.deps.cfg();
|
|
39112
|
+
const resolvedModel = resolveModelSlug(req.model);
|
|
39113
|
+
const family = modelFamilyOf(resolvedModel);
|
|
39114
|
+
const pool = this.deps.pool;
|
|
39115
|
+
let account;
|
|
39116
|
+
if (pool) {
|
|
39117
|
+
const selected = pool.selectAccount(family, resolvedModel);
|
|
39118
|
+
if (!selected) {
|
|
39119
|
+
if (pool.getAccounts().length > 0) return {
|
|
39120
|
+
ok: false,
|
|
39121
|
+
text: "",
|
|
39122
|
+
code: Err.QUOTA,
|
|
39123
|
+
error: "no eligible Antigravity account available",
|
|
39124
|
+
durationMs: this.now() - startedAt
|
|
39125
|
+
};
|
|
39126
|
+
} else account = selected;
|
|
39127
|
+
}
|
|
39128
|
+
const prompt = stripNulBytes(req.prompt);
|
|
39129
|
+
for (let effortAttempt = 0; effortAttempt < 2; effortAttempt++) {
|
|
39130
|
+
const wantedEffort = effortAttempt === 0 ? (req.effort ?? "").trim() : "";
|
|
39131
|
+
const effort = wantedEffort !== "" && !this.deps.isEffortUnsupported?.(resolvedModel) ? wantedEffort : "";
|
|
39132
|
+
const active = this.ensureWorker(bin, cfg, account, resolvedModel, effort, prompt.length);
|
|
39133
|
+
const outcome = await awaitWorkerTurn(active, prompt, req.timeoutMs, req.signal, () => this.dropWorker(active));
|
|
39134
|
+
const res = this.handleOutcome(active, outcome, prompt.length, family, resolvedModel, account, effort, effortAttempt === 0, startedAt);
|
|
39135
|
+
if (res === "retry-without-effort") continue;
|
|
39136
|
+
return res;
|
|
39137
|
+
}
|
|
39138
|
+
return {
|
|
39139
|
+
ok: false,
|
|
39140
|
+
text: "",
|
|
39141
|
+
code: Err.AGY_ERROR,
|
|
39142
|
+
error: "translation failed after effort retry",
|
|
39143
|
+
durationMs: this.now() - startedAt
|
|
39144
|
+
};
|
|
39145
|
+
}
|
|
39146
|
+
handleOutcome(active, outcome, promptLen, family, resolvedModel, account, effort, canRetryEffort, startedAt) {
|
|
39147
|
+
const durationMs = this.now() - startedAt;
|
|
39148
|
+
const pool = this.deps.pool;
|
|
39149
|
+
const sawAuthFailure = active.parser.stats.sawAuthFailure;
|
|
39150
|
+
if (outcome.kind === "result" && outcome.ok) {
|
|
39151
|
+
if (looksLikeTosViolation(outcome.response)) {
|
|
39152
|
+
this.dropWorker(active);
|
|
39153
|
+
return this.mapFailure(outcome.response, pool, account, family, resolvedModel, true, durationMs, sawAuthFailure);
|
|
39154
|
+
}
|
|
39155
|
+
if (outcome.response === "") {
|
|
39156
|
+
this.finishHealthyTurn(active, promptLen);
|
|
39157
|
+
this.deps.log(`translation worker produced empty response: model=${resolvedModel} durationMs=${durationMs}`);
|
|
39158
|
+
return {
|
|
39159
|
+
ok: false,
|
|
39160
|
+
text: "",
|
|
39161
|
+
code: Err.EMPTY_RESPONSE,
|
|
39162
|
+
error: "the translate model returned no text",
|
|
39163
|
+
...account ? { accountId: account.id } : {},
|
|
39164
|
+
durationMs
|
|
39165
|
+
};
|
|
39166
|
+
}
|
|
39167
|
+
if (account) pool?.recordSuccess(account.id, family);
|
|
39168
|
+
this.finishHealthyTurn(active, promptLen);
|
|
39169
|
+
return {
|
|
39170
|
+
ok: true,
|
|
39171
|
+
text: outcome.response,
|
|
39172
|
+
...account ? { accountId: account.id } : {},
|
|
39173
|
+
durationMs
|
|
39174
|
+
};
|
|
39175
|
+
}
|
|
39176
|
+
const errText = [
|
|
39177
|
+
...outcome.kind === "result" ? [outcome.error, outcome.response] : [outcome.error],
|
|
39178
|
+
active.parser.stats.lastResultError,
|
|
39179
|
+
active.parser.stats.authFailureText,
|
|
39180
|
+
active.stderrTail
|
|
39181
|
+
].filter((s) => typeof s === "string" && s.trim() !== "").join("\n");
|
|
39182
|
+
const refusedModel = parseEffortUnsupported(errText);
|
|
39183
|
+
if (canRetryEffort && effort !== "" && (refusedModel !== null || /--effort/i.test(errText) && /not supported|unsupported/i.test(errText))) {
|
|
39184
|
+
this.deps.rememberEffortUnsupported?.(refusedModel ?? resolvedModel, errText);
|
|
39185
|
+
this.dropWorker(active);
|
|
39186
|
+
return "retry-without-effort";
|
|
39187
|
+
}
|
|
39188
|
+
this.dropWorker(active);
|
|
39189
|
+
if (outcome.kind === "aborted") return {
|
|
39190
|
+
ok: false,
|
|
39191
|
+
text: "",
|
|
39192
|
+
code: "ABORTED",
|
|
39193
|
+
error: outcome.error,
|
|
39194
|
+
durationMs
|
|
39195
|
+
};
|
|
39196
|
+
if (outcome.kind === "timeout") return {
|
|
39197
|
+
ok: false,
|
|
39198
|
+
text: "",
|
|
39199
|
+
code: Err.TIMEOUT,
|
|
39200
|
+
error: outcome.error,
|
|
39201
|
+
durationMs
|
|
39202
|
+
};
|
|
39203
|
+
return this.mapFailure(errText, pool, account, family, resolvedModel, outcome.kind === "result", durationMs, sawAuthFailure);
|
|
39204
|
+
}
|
|
39205
|
+
finishHealthyTurn(active, promptLen) {
|
|
39206
|
+
active.turns += 1;
|
|
39207
|
+
active.promptChars += promptLen;
|
|
39208
|
+
active.lastUsedAt = this.now();
|
|
39209
|
+
const maxTurns = this.deps.maxTurns ?? 8;
|
|
39210
|
+
const maxChars = this.deps.maxPromptChars ?? 32e3;
|
|
39211
|
+
if (active.turns >= maxTurns || active.promptChars >= maxChars) this.dropWorker(active);
|
|
39212
|
+
else if (!active.closed) this.armIdleTimer(active);
|
|
39213
|
+
}
|
|
39214
|
+
mapFailure(errText, pool, account, family, resolvedModel, wasResultEnvelope, durationMs, sawAuthFailure) {
|
|
39215
|
+
const accountPatch = account ? { accountId: account.id } : {};
|
|
39216
|
+
if (looksLikeTosViolation(errText)) {
|
|
39217
|
+
if (account) pool?.markAuthRequired(account.id, errText);
|
|
39218
|
+
return {
|
|
39219
|
+
ok: false,
|
|
39220
|
+
text: "",
|
|
39221
|
+
code: Err.AGY_ERROR,
|
|
39222
|
+
error: errText,
|
|
39223
|
+
...accountPatch,
|
|
39224
|
+
durationMs
|
|
39225
|
+
};
|
|
39226
|
+
}
|
|
39227
|
+
if (looksLikeValidationRequired(errText)) return {
|
|
39228
|
+
ok: false,
|
|
39229
|
+
text: "",
|
|
39230
|
+
code: Err.AGY_ERROR,
|
|
39231
|
+
error: errText,
|
|
39232
|
+
...accountPatch,
|
|
39233
|
+
durationMs
|
|
39234
|
+
};
|
|
39235
|
+
if (looksLikeHardRateLimit(errText)) {
|
|
39236
|
+
if (account && pool) {
|
|
39237
|
+
const resetMs = parseResetDurationMs(errText);
|
|
39238
|
+
const resetIso = resetMs ? new Date(this.now() + resetMs).toISOString() : void 0;
|
|
39239
|
+
pool.recordFailure(account.id, family, errText, resetIso);
|
|
39240
|
+
if (pool.getActiveAccountId(family) === account.id) pool.advanceAccount(account.id, family, resolvedModel);
|
|
39241
|
+
}
|
|
39242
|
+
return {
|
|
39243
|
+
ok: false,
|
|
39244
|
+
text: "",
|
|
39245
|
+
code: Err.RATE_LIMIT,
|
|
39246
|
+
error: errText,
|
|
39247
|
+
...accountPatch,
|
|
39248
|
+
durationMs
|
|
39249
|
+
};
|
|
39250
|
+
}
|
|
39251
|
+
if (looksLikeRateLimit(errText)) return {
|
|
39252
|
+
ok: false,
|
|
39253
|
+
text: "",
|
|
39254
|
+
code: Err.OVERLOADED,
|
|
39255
|
+
error: errText,
|
|
39256
|
+
...accountPatch,
|
|
39257
|
+
durationMs
|
|
39258
|
+
};
|
|
39259
|
+
if (looksLikeNetworkError(errText) || looksLikeAuthVerificationJitter(errText)) return {
|
|
39260
|
+
ok: false,
|
|
39261
|
+
text: "",
|
|
39262
|
+
code: Err.NETWORK,
|
|
39263
|
+
error: errText,
|
|
39264
|
+
...accountPatch,
|
|
39265
|
+
durationMs
|
|
39266
|
+
};
|
|
39267
|
+
const unrecog = parseModelNotRecognized(errText);
|
|
39268
|
+
if (unrecog || looksLikeEligibilityFailure(errText)) {
|
|
39269
|
+
if (account && pool) {
|
|
39270
|
+
if (unrecog && typeof pool.markModelUnsupported === "function") pool.markModelUnsupported(account.id, unrecog);
|
|
39271
|
+
pool.advanceAccount(account.id, family, resolvedModel);
|
|
39272
|
+
}
|
|
39273
|
+
return {
|
|
39274
|
+
ok: false,
|
|
39275
|
+
text: "",
|
|
39276
|
+
code: Err.ELIGIBILITY,
|
|
39277
|
+
error: errText,
|
|
39278
|
+
...accountPatch,
|
|
39279
|
+
durationMs
|
|
39280
|
+
};
|
|
39281
|
+
}
|
|
39282
|
+
if (sawAuthFailure || looksLikeAuthFailure(errText)) {
|
|
39283
|
+
if (account && pool && shouldMarkAuthRequired(Err.AUTH, errText)) {
|
|
39284
|
+
pool.noteAuthFailure(account.id, errText);
|
|
39285
|
+
if (pool.getActiveAccountId(family) === account.id) pool.advanceAccount(account.id, family, resolvedModel);
|
|
39286
|
+
}
|
|
39287
|
+
return {
|
|
39288
|
+
ok: false,
|
|
39289
|
+
text: "",
|
|
39290
|
+
code: Err.AUTH,
|
|
39291
|
+
error: errText,
|
|
39292
|
+
...accountPatch,
|
|
39293
|
+
durationMs
|
|
39294
|
+
};
|
|
39295
|
+
}
|
|
39296
|
+
return {
|
|
39297
|
+
ok: false,
|
|
39298
|
+
text: "",
|
|
39299
|
+
code: wasResultEnvelope ? Err.AGY_ERROR : Err.PROCESS_EXIT,
|
|
39300
|
+
error: errText || "translation worker failed",
|
|
39301
|
+
...accountPatch,
|
|
39302
|
+
durationMs
|
|
39303
|
+
};
|
|
39304
|
+
}
|
|
39305
|
+
};
|
|
38776
39306
|
//#endregion
|
|
38777
39307
|
//#region src/host/pool-auth.ts
|
|
38778
39308
|
const DONE_STATUS_TTL_MS = 3e4;
|
|
@@ -39620,6 +40150,8 @@ function buildFamilyQuotas(params) {
|
|
|
39620
40150
|
/** Map the HTTP verdict onto the account-level marker. */
|
|
39621
40151
|
function unavailableReason(failure, hasModelData) {
|
|
39622
40152
|
if (failure === null) return hasModelData ? "partial" : "unreachable";
|
|
40153
|
+
if (failure.kind === "tos_violation") return "tos_violation";
|
|
40154
|
+
if (failure.kind === "validation_required") return "validation_required";
|
|
39623
40155
|
if (failure.kind === "no_license") return "no_license";
|
|
39624
40156
|
if (failure.kind === "no_summary_access") return "no_summary_access";
|
|
39625
40157
|
if (failure.kind === "auth") return "auth";
|
|
@@ -39710,23 +40242,28 @@ async function refreshAccountQuotaPipeline(deps, account, force = false) {
|
|
|
39710
40242
|
if (info?.email) email = info.email;
|
|
39711
40243
|
}
|
|
39712
40244
|
const modelsCatalog = buildModelsCatalog(discovered, userQuota);
|
|
40245
|
+
let currentUnavailReason = account.quotaUnavailable?.reason;
|
|
39713
40246
|
if (!suppressSummary) {
|
|
39714
|
-
if ((summary?.groups?.length ?? 0) > 0 || (summary?.buckets?.length ?? 0) > 0)
|
|
39715
|
-
|
|
40247
|
+
if ((summary?.groups?.length ?? 0) > 0 || (summary?.buckets?.length ?? 0) > 0) {
|
|
40248
|
+
deps.pool.clearQuotaUnavailable(account.id);
|
|
40249
|
+
currentUnavailReason = void 0;
|
|
40250
|
+
} else {
|
|
39716
40251
|
const failure = deps.summaryFailure?.() ?? null;
|
|
39717
40252
|
const reason = unavailableReason(failure, Object.keys(modelsCatalog).length > 0);
|
|
40253
|
+
currentUnavailReason = reason;
|
|
39718
40254
|
const previous = account.quotaUnavailable;
|
|
39719
40255
|
const retryMs = reason === "no_summary_access" ? QUOTA_FREE_TIER_RETRY_MS : QUOTA_LICENSE_RETRY_MS;
|
|
39720
40256
|
deps.pool.noteQuotaUnavailable(account.id, {
|
|
39721
40257
|
reason,
|
|
39722
40258
|
since: previous?.reason === reason ? previous.since : now,
|
|
39723
40259
|
retryAfter: now + retryMs,
|
|
39724
|
-
...failure?.detail === void 0 ? {} : { detail: failure.detail }
|
|
40260
|
+
...failure?.detail === void 0 ? {} : { detail: failure.detail },
|
|
40261
|
+
...failure?.actionUrl === void 0 ? {} : { actionUrl: failure.actionUrl }
|
|
39725
40262
|
});
|
|
39726
40263
|
}
|
|
39727
40264
|
}
|
|
39728
40265
|
if (!summary && Object.keys(modelsCatalog).length === 0) return null;
|
|
39729
|
-
if (account.authRequired) deps.pool.clearAuthRequired(account.id);
|
|
40266
|
+
if (account.authRequired && currentUnavailReason !== "validation_required" && currentUnavailReason !== "tos_violation") deps.pool.clearAuthRequired(account.id);
|
|
39730
40267
|
const { familyQuotas, summaryGroups } = buildFamilyQuotas({
|
|
39731
40268
|
summary,
|
|
39732
40269
|
modelsCatalog,
|
|
@@ -39862,9 +40399,28 @@ function networkFailureCode(error) {
|
|
|
39862
40399
|
const cause = error?.cause;
|
|
39863
40400
|
return typeof cause?.code === "string" ? cause.code : void 0;
|
|
39864
40401
|
}
|
|
40402
|
+
function extractHttpsActionUrl(bodyText) {
|
|
40403
|
+
try {
|
|
40404
|
+
const details = JSON.parse(bodyText)?.error?.details;
|
|
40405
|
+
if (Array.isArray(details)) for (const d of details) {
|
|
40406
|
+
const meta = d?.metadata;
|
|
40407
|
+
const direct = meta?.validation_url ?? meta?.appeal_url ?? d?.url;
|
|
40408
|
+
if (typeof direct === "string" && direct.startsWith("https://")) return direct;
|
|
40409
|
+
const links = d?.links;
|
|
40410
|
+
if (Array.isArray(links)) for (const l of links) {
|
|
40411
|
+
const u = l?.url;
|
|
40412
|
+
if (typeof u === "string" && u.startsWith("https://")) return u;
|
|
40413
|
+
}
|
|
40414
|
+
}
|
|
40415
|
+
} catch {}
|
|
40416
|
+
const m = bodyText.match(/https:\/\/accounts\.google\.com\/[^\s"'<>]+|https:\/\/support\.google\.com\/[^\s"'<>]+/);
|
|
40417
|
+
return m ? m[0] : void 0;
|
|
40418
|
+
}
|
|
39865
40419
|
/**
|
|
39866
|
-
* Classify a refusal.
|
|
39867
|
-
*
|
|
40420
|
+
* Classify a refusal. Structured `VALIDATION_REQUIRED` and `TOS_VIOLATION`
|
|
40421
|
+
* share `403 PERMISSION_DENIED` with free-tier refusals, so they MUST be
|
|
40422
|
+
* checked first — otherwise a Pro/Ultra account needing Google verification is
|
|
40423
|
+
* mislabeled as a free-tier account.
|
|
39868
40424
|
*/
|
|
39869
40425
|
function classifySummaryRefusal(status, bodyText = "") {
|
|
39870
40426
|
const detail = apiErrorStatus(bodyText);
|
|
@@ -39873,6 +40429,24 @@ function classifySummaryRefusal(status, bodyText = "") {
|
|
|
39873
40429
|
status,
|
|
39874
40430
|
...detail === void 0 ? {} : { detail }
|
|
39875
40431
|
};
|
|
40432
|
+
if (status === 403 && looksLikeTosViolation(bodyText)) {
|
|
40433
|
+
const actionUrl = extractHttpsActionUrl(bodyText);
|
|
40434
|
+
return {
|
|
40435
|
+
kind: "tos_violation",
|
|
40436
|
+
status,
|
|
40437
|
+
...detail === void 0 ? {} : { detail },
|
|
40438
|
+
...actionUrl === void 0 ? {} : { actionUrl }
|
|
40439
|
+
};
|
|
40440
|
+
}
|
|
40441
|
+
if (status === 403 && looksLikeValidationRequired(bodyText)) {
|
|
40442
|
+
const actionUrl = extractHttpsActionUrl(bodyText);
|
|
40443
|
+
return {
|
|
40444
|
+
kind: "validation_required",
|
|
40445
|
+
status,
|
|
40446
|
+
...detail === void 0 ? {} : { detail },
|
|
40447
|
+
...actionUrl === void 0 ? {} : { actionUrl }
|
|
40448
|
+
};
|
|
40449
|
+
}
|
|
39876
40450
|
if (status === 403 && detail === "PERMISSION_DENIED") return {
|
|
39877
40451
|
kind: "no_summary_access",
|
|
39878
40452
|
status,
|
|
@@ -40246,7 +40820,8 @@ async function getStoredToken(deps, account, allowKeychainFallback = true) {
|
|
|
40246
40820
|
function persistRefreshedToken(deps, account, tokens, expectedRefreshToken) {
|
|
40247
40821
|
const file = quotaTokenFilePath(account);
|
|
40248
40822
|
try {
|
|
40249
|
-
if (expectedRefreshToken &&
|
|
40823
|
+
if (expectedRefreshToken && existsSync(file) && deps.parseCredentialDoc(readFileSync(file, "utf8"))?.refreshToken !== expectedRefreshToken) return;
|
|
40824
|
+
if (process.platform !== "win32" && (account.systemHome || !account.dir) && !existsSync(file) && expectedRefreshToken) return;
|
|
40250
40825
|
mkdirSync(dirname(file), { recursive: true });
|
|
40251
40826
|
let existing = {};
|
|
40252
40827
|
if (existsSync(file)) try {
|
|
@@ -40332,6 +40907,10 @@ async function getValidAccessTokenUncached(deps, account) {
|
|
|
40332
40907
|
if (tok.refreshToken) try {
|
|
40333
40908
|
const refreshed = await refreshTokens(tok.refreshToken, deps.proxyFor(account), account.id);
|
|
40334
40909
|
if (!isCurrentAccountGrant(deps, account, tok.refreshToken)) return null;
|
|
40910
|
+
if (process.platform !== "win32" && (account.systemHome || !account.dir)) {
|
|
40911
|
+
const liveKeychain = await deps.readSystemKeychainToken().catch(() => null);
|
|
40912
|
+
if (liveKeychain?.refreshToken && liveKeychain.refreshToken !== tok.refreshToken) return null;
|
|
40913
|
+
}
|
|
40335
40914
|
if (refreshed?.access_token) {
|
|
40336
40915
|
deps.persistRefreshedToken(account, {
|
|
40337
40916
|
access_token: refreshed.access_token,
|
|
@@ -41292,7 +41871,11 @@ async function readSessionImage(ctx, dshHomeDir, ref) {
|
|
|
41292
41871
|
}
|
|
41293
41872
|
return null;
|
|
41294
41873
|
}
|
|
41295
|
-
async function runTranslationStream(ctx, getConfig, log, req) {
|
|
41874
|
+
async function runTranslationStream(ctx, getConfig, log, req, workerPool) {
|
|
41875
|
+
if (workerPool !== void 0) {
|
|
41876
|
+
const fast = await workerPool.tryTranslate(req);
|
|
41877
|
+
if (fast !== null) return fast;
|
|
41878
|
+
}
|
|
41296
41879
|
const startedAt = Date.now();
|
|
41297
41880
|
const controller = new AbortController();
|
|
41298
41881
|
const timer = setTimeout(() => controller.abort(/* @__PURE__ */ new Error("translation timed out after " + req.timeoutMs + "ms")), Math.max(1e3, req.timeoutMs));
|
|
@@ -41317,7 +41900,7 @@ async function runTranslationStream(ctx, getConfig, log, req) {
|
|
|
41317
41900
|
signal,
|
|
41318
41901
|
...getConfig().translateBindConversation && req.setup !== void 0 ? { agyTranslateSession: {
|
|
41319
41902
|
setup: req.setup,
|
|
41320
|
-
text: req.prompt
|
|
41903
|
+
text: req.text ?? req.prompt
|
|
41321
41904
|
} } : {}
|
|
41322
41905
|
};
|
|
41323
41906
|
let text = "";
|
|
@@ -41462,8 +42045,13 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
41462
42045
|
if (!targetAcc || !targetAcc.enabled || targetAcc.authRequired) throw new Error(`account ${accountId} is unavailable for model discovery`);
|
|
41463
42046
|
candidateAccount = targetAcc;
|
|
41464
42047
|
} else {
|
|
41465
|
-
const
|
|
41466
|
-
|
|
42048
|
+
const pickEnabled = (id) => {
|
|
42049
|
+
if (!id) return void 0;
|
|
42050
|
+
const acc = pool.getAccount(id);
|
|
42051
|
+
return acc && acc.enabled && !acc.authRequired ? acc : void 0;
|
|
42052
|
+
};
|
|
42053
|
+
candidateAccount = pickEnabled(pool.getActiveAccountId("google")) ?? pickEnabled(poolData.lastActiveAccountId) ?? pickEnabled(poolData.primaryAccountId) ?? pool.getAccounts().find((a) => a.enabled && !a.authRequired);
|
|
42054
|
+
if (!candidateAccount && pool.getAccounts().length > 0) throw new Error("no enabled account available for model discovery");
|
|
41467
42055
|
}
|
|
41468
42056
|
const probeModelsFor = async (acc) => {
|
|
41469
42057
|
const lease = process.platform === "win32" && process.env.NODE_TEST_CONTEXT === void 0 && Boolean(acc && acc.dir && !acc.systemHome) ? await acquireCredentialSlot(acc, pool, {
|
|
@@ -41480,18 +42068,23 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
41480
42068
|
lease?.release();
|
|
41481
42069
|
}
|
|
41482
42070
|
};
|
|
42071
|
+
let probedAccount = candidateAccount;
|
|
41483
42072
|
let out = await probeModelsFor(candidateAccount);
|
|
41484
42073
|
if (!accountId && (out.code !== 0 || out.stdout.includes("Please sign in") || /sign in|auth|not logged in/i.test(out.stderrTail)) && (!candidateAccount || !candidateAccount.dir)) {
|
|
41485
42074
|
const secondary = pool.getAccounts().find((a) => a.enabled && !a.authRequired && a.dir);
|
|
41486
42075
|
if (secondary) {
|
|
41487
42076
|
const secondaryOut = await probeModelsFor(secondary);
|
|
41488
|
-
if (secondaryOut.code === 0 && secondaryOut.stdout.trim() !== "")
|
|
42077
|
+
if (secondaryOut.code === 0 && secondaryOut.stdout.trim() !== "") {
|
|
42078
|
+
out = secondaryOut;
|
|
42079
|
+
probedAccount = secondary;
|
|
42080
|
+
}
|
|
41489
42081
|
}
|
|
41490
42082
|
}
|
|
41491
42083
|
if (out.code !== 0 && out.stdout.trim() === "") throw new Error("agy models failed: " + (out.stderrTail.trim() !== "" ? out.stderrTail.trim().slice(-200) : "exit " + String(out.code)));
|
|
41492
42084
|
return {
|
|
41493
42085
|
stdout: out.stdout,
|
|
41494
|
-
stderr: out.stderrTail
|
|
42086
|
+
stderr: out.stderrTail,
|
|
42087
|
+
...probedAccount ? { accountId: probedAccount.id } : {}
|
|
41495
42088
|
};
|
|
41496
42089
|
}, getConfig().fallbackModels, getConfig().modelsCacheTtlMs, notifyPicker, {
|
|
41497
42090
|
cacheFile: join(stateDir(), "model-catalog.json"),
|
|
@@ -41535,6 +42128,7 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
41535
42128
|
refreshQuota: async () => {
|
|
41536
42129
|
await quota.refreshAllQuotas(false).catch(() => void 0);
|
|
41537
42130
|
await catalog.forceRefreshAndNotify().catch(() => void 0);
|
|
42131
|
+
await catalog.warmAccounts(pool.getAccounts()).catch(() => void 0);
|
|
41538
42132
|
},
|
|
41539
42133
|
effortUnsupported: () => effortStore.read(),
|
|
41540
42134
|
onEffortUnsupported: (model) => effortStore.remember(model),
|
|
@@ -41549,6 +42143,19 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
41549
42143
|
},
|
|
41550
42144
|
readImage: (ref) => readSessionImage(ctx, dshHome(), ref)
|
|
41551
42145
|
});
|
|
42146
|
+
const translationWorkers = new TranslationWorkerPool({
|
|
42147
|
+
cfg: getConfig,
|
|
42148
|
+
bin,
|
|
42149
|
+
pool,
|
|
42150
|
+
log,
|
|
42151
|
+
isEffortUnsupported: (model) => effortStore.read().includes(model),
|
|
42152
|
+
rememberEffortUnsupported: (model) => {
|
|
42153
|
+
if (catalog.advertisedEfforts(model).length === 0) {
|
|
42154
|
+
effortStore.remember(model);
|
|
42155
|
+
notifyPicker();
|
|
42156
|
+
}
|
|
42157
|
+
}
|
|
42158
|
+
});
|
|
41552
42159
|
const translation = new TranslationService({
|
|
41553
42160
|
cfg: getConfig,
|
|
41554
42161
|
catalog: () => catalog.get(),
|
|
@@ -41557,7 +42164,7 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
41557
42164
|
sessionCwd: (id) => sessionWorkspace(id),
|
|
41558
42165
|
sessionLogPath: (id) => findSessionLogFile(dshHome(), id),
|
|
41559
42166
|
log,
|
|
41560
|
-
run: (req) => runTranslationStream(ctx, getConfig, log, req),
|
|
42167
|
+
run: (req) => runTranslationStream(ctx, getConfig, log, req, translationWorkers),
|
|
41561
42168
|
appendRecord: async (sessionId, record) => {
|
|
41562
42169
|
const session = sessionsSvc()?.get(sessionId);
|
|
41563
42170
|
if (session === void 0) return null;
|
|
@@ -41626,6 +42233,7 @@ function createHostServices(ctx, entryConfig = {}) {
|
|
|
41626
42233
|
runs,
|
|
41627
42234
|
adapter,
|
|
41628
42235
|
translation,
|
|
42236
|
+
translationWorkers,
|
|
41629
42237
|
setOverride,
|
|
41630
42238
|
readEffortUnsupported: effortStore.read,
|
|
41631
42239
|
rememberEffortUnsupported: effortStore.remember,
|
|
@@ -41753,6 +42361,14 @@ function handleStatus(services, req, res) {
|
|
|
41753
42361
|
let supportedModels;
|
|
41754
42362
|
if (cfg.poolWideCatalog || !activeAcc || !pool || typeof catalog.getModelsForAccount !== "function") supportedModels = typeof catalog.getUnion === "function" ? catalog.getUnion(pool?.getAccounts ? pool.getAccounts() : [], pool) : typeof catalog.getAllKnownModels === "function" ? catalog.getAllKnownModels(pool?.getAccounts ? pool.getAccounts() : []) : catalog.get().models ?? [];
|
|
41755
42363
|
else supportedModels = catalog.getModelsForAccount(activeAcc, pool);
|
|
42364
|
+
const sanitizedCatalogModels = sanitizeCatalogEntries(supportedModels).entries;
|
|
42365
|
+
const activeCat = !cfg.poolWideCatalog && activeAcc && typeof catalog.getAccountCatalog === "function" ? catalog.getAccountCatalog(activeAcc.id) ?? cat : cat;
|
|
42366
|
+
const catalogCount = typeof catalog.getModelsForAccount === "function" ? sanitizedCatalogModels.length : activeCat.models.length;
|
|
42367
|
+
const accountModels = {};
|
|
42368
|
+
if (typeof catalog.getAccountCatalog === "function") for (const acc of poolData?.accounts ?? []) {
|
|
42369
|
+
const accCat = catalog.getAccountCatalog(acc.id);
|
|
42370
|
+
if (accCat && accCat.source === "discovered" && accCat.models.length > 0) accountModels[acc.id] = sanitizeCatalogEntries(accCat.models).entries;
|
|
42371
|
+
}
|
|
41756
42372
|
sendJsonWithEtag(req, res, 200, {
|
|
41757
42373
|
plugin: "dsh-agy-link",
|
|
41758
42374
|
bin: bin(),
|
|
@@ -41769,11 +42385,12 @@ function handleStatus(services, req, res) {
|
|
|
41769
42385
|
pool: poolData,
|
|
41770
42386
|
quotaRefreshing: typeof quota?.refreshingAccounts === "function" ? quota.refreshingAccounts() : [],
|
|
41771
42387
|
catalog: {
|
|
41772
|
-
source:
|
|
41773
|
-
count:
|
|
41774
|
-
lastError: cat.lastError ?? null
|
|
42388
|
+
source: activeCat.source,
|
|
42389
|
+
count: catalogCount,
|
|
42390
|
+
lastError: activeCat.lastError ?? cat.lastError ?? null
|
|
41775
42391
|
},
|
|
41776
|
-
catalogModels:
|
|
42392
|
+
catalogModels: sanitizedCatalogModels,
|
|
42393
|
+
accountModels,
|
|
41777
42394
|
hiddenModels: cfg.hiddenModels,
|
|
41778
42395
|
autoWarmup: cfg.autoWarmup,
|
|
41779
42396
|
warmupModels: cfg.warmupModels,
|
|
@@ -42044,7 +42661,11 @@ function handlePoolRefreshQuota(services, req, res) {
|
|
|
42044
42661
|
const acc = pool.getAccount(id);
|
|
42045
42662
|
if (acc) await quota.refreshAccountQuota(acc, true);
|
|
42046
42663
|
} else await quota.refreshAllQuotas(true);
|
|
42047
|
-
await catalog.forceRefresh().catch(() => void 0);
|
|
42664
|
+
if (id) await catalog.forceRefresh(id).catch(() => void 0);
|
|
42665
|
+
else {
|
|
42666
|
+
await catalog.forceRefresh().catch(() => void 0);
|
|
42667
|
+
if (typeof catalog.warmAccounts === "function") await catalog.warmAccounts(pool.getAccounts()).catch(() => void 0);
|
|
42668
|
+
}
|
|
42048
42669
|
})().catch(() => void 0);
|
|
42049
42670
|
let releaseTimer;
|
|
42050
42671
|
const entry = work.finally(() => {
|
|
@@ -43534,6 +44155,7 @@ function apply(ctx, entryConfig = {}) {
|
|
|
43534
44155
|
ctx.effect(() => {
|
|
43535
44156
|
return () => {
|
|
43536
44157
|
bridgeDisposed = true;
|
|
44158
|
+
services.translationWorkers?.dispose();
|
|
43537
44159
|
auth.dispose();
|
|
43538
44160
|
poolAuth.cancel();
|
|
43539
44161
|
if (askToolDispose.current !== null) askToolDispose.current();
|