@atlasharness/atlascode 0.1.63 → 0.1.64
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/cli.js +82 -21
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -26901,7 +26901,39 @@ function llmTimeoutRemediationHint(error, currentTimeoutMs) {
|
|
|
26901
26901
|
const head = typeof currentTimeoutMs === "number" && currentTimeoutMs > 0 ? `当前超时 ${Math.round(currentTimeoutMs / 1000)}s` : "慢模型长生成可能超过缺省超时";
|
|
26902
26902
|
return `LLM 请求超时(${head})。可调大:env ATLAS_LLM_TIMEOUT=<毫秒> 或 settings.json llmTimeoutMs 键(上限 ${Math.round(LLM_TIMEOUT_CAP_MS / 60000)}min)。`;
|
|
26903
26903
|
}
|
|
26904
|
-
function
|
|
26904
|
+
function describeEndpointFailure(baseURL) {
|
|
26905
|
+
if (!baseURL)
|
|
26906
|
+
return "LLM 端点";
|
|
26907
|
+
let host;
|
|
26908
|
+
let port;
|
|
26909
|
+
try {
|
|
26910
|
+
const u = new URL(baseURL);
|
|
26911
|
+
host = u.hostname;
|
|
26912
|
+
port = u.port;
|
|
26913
|
+
} catch {
|
|
26914
|
+
return "LLM 端点";
|
|
26915
|
+
}
|
|
26916
|
+
if (host === "localhost" || host === "0.0.0.0" || host === "[::1]" || host.startsWith("127.")) {
|
|
26917
|
+
return port ? `本地端口 ${port}` : "本地网关";
|
|
26918
|
+
}
|
|
26919
|
+
const knownProviders = [
|
|
26920
|
+
[/api\.deepseek\.com$/i, "DeepSeek"],
|
|
26921
|
+
[/api\.openai\.com$/i, "OpenAI"],
|
|
26922
|
+
[/^(dashscope|api)\.aliyuncs\.com$/i, "阿里百炼"],
|
|
26923
|
+
[/api\.moonshot\.cn$/i, "Kimi"],
|
|
26924
|
+
[/api\.minimax\.chat$/i, "MiniMax"],
|
|
26925
|
+
[/api\.baichuan-ai\.com$/i, "百川"],
|
|
26926
|
+
[/api\.01\.ai$/i, "零一万物"],
|
|
26927
|
+
[/api\.siliconflow\.cn$/i, "硅基流动"],
|
|
26928
|
+
[/api\.lkeap\.com$/i, "腾讯混元"]
|
|
26929
|
+
];
|
|
26930
|
+
for (const [re, name] of knownProviders) {
|
|
26931
|
+
if (re.test(host))
|
|
26932
|
+
return `${name} 服务`;
|
|
26933
|
+
}
|
|
26934
|
+
return host;
|
|
26935
|
+
}
|
|
26936
|
+
function gatewayUnreachableRemediationHint(error, endpointLabel) {
|
|
26905
26937
|
if (!error || typeof error !== "object")
|
|
26906
26938
|
return null;
|
|
26907
26939
|
const e = error;
|
|
@@ -26918,7 +26950,7 @@ function gatewayUnreachableRemediationHint(error) {
|
|
|
26918
26950
|
const isNetworkErrno = /ECONNREFUSED|ECONNRESET|ENOTFOUND|ENETUNREACH|EHOSTUNREACH|EAI_AGAIN|fetch failed|socket hang up/i.test(haystack);
|
|
26919
26951
|
if (!isSdkConnection && !isNetworkErrno)
|
|
26920
26952
|
return null;
|
|
26921
|
-
return "
|
|
26953
|
+
return `${endpointLabel ?? "LLM 端点"} 不可达:已切人工确认 —— /doctor 排查`;
|
|
26922
26954
|
}
|
|
26923
26955
|
function modelRetryBackoffMs(attempt, baseMs = MODEL_RETRY_BACKOFF_BASE_MS, capMs = MODEL_RETRY_BACKOFF_CAP_MS) {
|
|
26924
26956
|
const base = Math.max(0, baseMs);
|
|
@@ -27824,6 +27856,18 @@ function setLlmTimeoutSettingsSource(next) {
|
|
|
27824
27856
|
function getCurrentLlmTimeoutMs() {
|
|
27825
27857
|
return resolveLlmTimeoutMs(process.env.ATLAS_LLM_TIMEOUT, llmTimeoutSettingsSource?.());
|
|
27826
27858
|
}
|
|
27859
|
+
function getCurrentEndpointLabel(modelRef) {
|
|
27860
|
+
let baseURL;
|
|
27861
|
+
if (modelRef) {
|
|
27862
|
+
const resolved = resolveModel(modelRef);
|
|
27863
|
+
if (resolved?.baseURL)
|
|
27864
|
+
baseURL = resolved.baseURL;
|
|
27865
|
+
}
|
|
27866
|
+
if (!baseURL) {
|
|
27867
|
+
baseURL = getRoleConfig("small").baseURL;
|
|
27868
|
+
}
|
|
27869
|
+
return describeEndpointFailure(baseURL);
|
|
27870
|
+
}
|
|
27827
27871
|
function resolveLlmTimeoutMs(envRaw = process.env.ATLAS_LLM_TIMEOUT, settingsMs) {
|
|
27828
27872
|
const fromSettings = () => typeof settingsMs === "number" && Number.isInteger(settingsMs) && settingsMs >= 1 ? Math.min(settingsMs, LLM_TIMEOUT_CAP_MS) : LLM_TIMEOUT_DEFAULT_MS;
|
|
27829
27873
|
if (envRaw === undefined || envRaw === "")
|
|
@@ -27847,6 +27891,7 @@ var init_modelprovider2 = __esm(() => {
|
|
|
27847
27891
|
init_modelprovider();
|
|
27848
27892
|
init_constants2();
|
|
27849
27893
|
init_shared();
|
|
27894
|
+
init_roles7();
|
|
27850
27895
|
init_constants2();
|
|
27851
27896
|
init_modelprovider();
|
|
27852
27897
|
init_types2();
|
|
@@ -366288,6 +366333,25 @@ var init_GlimmerMessage = __esm(() => {
|
|
|
366288
366333
|
};
|
|
366289
366334
|
});
|
|
366290
366335
|
|
|
366336
|
+
// src/tui/components/Spinner/spinnerGates.ts
|
|
366337
|
+
function getSpinnerDisplayGates(input) {
|
|
366338
|
+
const { verbose, hasRunningTeammates, effectiveElapsedMs } = input;
|
|
366339
|
+
const forceShow = verbose || hasRunningTeammates;
|
|
366340
|
+
const wantsTimer = forceShow || effectiveElapsedMs > SHOW_TIMER_AFTER_MS;
|
|
366341
|
+
return {
|
|
366342
|
+
wantsTimer,
|
|
366343
|
+
wantsTokens: forceShow || effectiveElapsedMs > SHOW_TOKENS_AFTER_MS,
|
|
366344
|
+
wantsStatusIndicator: wantsTimer
|
|
366345
|
+
};
|
|
366346
|
+
}
|
|
366347
|
+
function computeStallState(input) {
|
|
366348
|
+
const { timeSinceLastToken, currentResponseLength, hasActiveTools } = input;
|
|
366349
|
+
const isStalled = timeSinceLastToken > STALL_AFTER_MS && !hasActiveTools && currentResponseLength > 0;
|
|
366350
|
+
const stalledIntensity = isStalled ? Math.min((timeSinceLastToken - STALL_AFTER_MS) / STALL_FADE_MS, 1) : 0;
|
|
366351
|
+
return { isStalled, stalledIntensity };
|
|
366352
|
+
}
|
|
366353
|
+
var SHOW_TIMER_AFTER_MS = 1000, SHOW_TOKENS_AFTER_MS = 5000, STALL_AFTER_MS = 3000, STALL_FADE_MS = 2000;
|
|
366354
|
+
|
|
366291
366355
|
// src/tui/components/Spinner/useStalledAnimation.ts
|
|
366292
366356
|
function useStalledAnimation(time, currentResponseLength, hasActiveTools = false, reducedMotion = false) {
|
|
366293
366357
|
const lastTokenTime = import_react103.useRef(time);
|
|
@@ -366310,8 +366374,11 @@ function useStalledAnimation(time, currentResponseLength, hasActiveTools = false
|
|
|
366310
366374
|
} else {
|
|
366311
366375
|
timeSinceLastToken = time - mountTime.current;
|
|
366312
366376
|
}
|
|
366313
|
-
const isStalled
|
|
366314
|
-
|
|
366377
|
+
const { isStalled, stalledIntensity: intensity } = computeStallState({
|
|
366378
|
+
timeSinceLastToken,
|
|
366379
|
+
currentResponseLength,
|
|
366380
|
+
hasActiveTools
|
|
366381
|
+
});
|
|
366315
366382
|
if (!reducedMotion && (intensity > 0 || stalledIntensityRef.current > 0)) {
|
|
366316
366383
|
const dt = time - lastSmoothTime.current;
|
|
366317
366384
|
if (dt >= 50) {
|
|
@@ -366340,17 +366407,6 @@ var init_useStalledAnimation = __esm(() => {
|
|
|
366340
366407
|
import_react103 = __toESM(require_react(), 1);
|
|
366341
366408
|
});
|
|
366342
366409
|
|
|
366343
|
-
// src/tui/components/Spinner/spinnerGates.ts
|
|
366344
|
-
function getSpinnerDisplayGates(input) {
|
|
366345
|
-
const { verbose, hasRunningTeammates, effectiveElapsedMs } = input;
|
|
366346
|
-
const forceShow = verbose || hasRunningTeammates;
|
|
366347
|
-
return {
|
|
366348
|
-
wantsTimer: forceShow || effectiveElapsedMs > SHOW_TIMER_AFTER_MS,
|
|
366349
|
-
wantsTokens: forceShow || effectiveElapsedMs > SHOW_TOKENS_AFTER_MS
|
|
366350
|
-
};
|
|
366351
|
-
}
|
|
366352
|
-
var SHOW_TIMER_AFTER_MS = 1000, SHOW_TOKENS_AFTER_MS = 5000;
|
|
366353
|
-
|
|
366354
366410
|
// src/tui/components/Spinner/SpinnerAnimationRow.tsx
|
|
366355
366411
|
function SpinnerAnimationRow({
|
|
366356
366412
|
mode,
|
|
@@ -366389,7 +366445,8 @@ function SpinnerAnimationRow({
|
|
|
366389
366445
|
} = useStalledAnimation(time, currentResponseLength, hasActiveTools || leaderIsIdle, reducedMotion);
|
|
366390
366446
|
const frame = reducedMotion ? 0 : Math.floor(time / 120);
|
|
366391
366447
|
const glimmerSpeed = mode === "requesting" ? 50 : 200;
|
|
366392
|
-
const
|
|
366448
|
+
const displayMessage = mode === "requesting" ? message + "…" : message;
|
|
366449
|
+
const glimmerMessageWidth = import_react104.useMemo(() => stringWidth2(displayMessage), [displayMessage]);
|
|
366393
366450
|
const cycleLength = glimmerMessageWidth + 20;
|
|
366394
366451
|
const cyclePosition = Math.floor(time / glimmerSpeed);
|
|
366395
366452
|
const glimmerIndex = reducedMotion ? -100 : isStalled ? -100 : mode === "requesting" ? cyclePosition % cycleLength - 10 : glimmerMessageWidth + 10 - cyclePosition % cycleLength;
|
|
@@ -366425,7 +366482,7 @@ function SpinnerAnimationRow({
|
|
|
366425
366482
|
const messageWidth = glimmerMessageWidth + 2;
|
|
366426
366483
|
const sep = SEP_WIDTH;
|
|
366427
366484
|
const wantsThinking = thinkingStatus !== null;
|
|
366428
|
-
const { wantsTimer, wantsTokens } = getSpinnerDisplayGates({
|
|
366485
|
+
const { wantsTimer, wantsTokens, wantsStatusIndicator } = getSpinnerDisplayGates({
|
|
366429
366486
|
verbose,
|
|
366430
366487
|
hasRunningTeammates,
|
|
366431
366488
|
effectiveElapsedMs
|
|
@@ -366443,7 +366500,8 @@ function SpinnerAnimationRow({
|
|
|
366443
366500
|
const showTimer = wantsTimer && availableSpace > usedAfterThinking + timerWidth;
|
|
366444
366501
|
const usedAfterTimer = usedAfterThinking + (showTimer ? timerWidth + sep : 0);
|
|
366445
366502
|
const showTokens = wantsTokens && totalTokens > 0 && availableSpace > usedAfterTimer + tokensWidth;
|
|
366446
|
-
const
|
|
366503
|
+
const showStatusIndicator = !showTokens && wantsStatusIndicator && mode === "requesting" && !hasRunningTeammates && availableSpace > usedAfterTimer + 2;
|
|
366504
|
+
const thinkingOnly = showThinking && thinkingStatus === "thinking" && !spinnerSuffix && !showTimer && !showTokens && !showStatusIndicator && true;
|
|
366447
366505
|
const thinkingElapsedSec = (time - THINKING_DELAY_MS) / 1000;
|
|
366448
366506
|
const thinkingOpacity = time < THINKING_DELAY_MS ? 0 : (Math.sin(thinkingElapsedSec * Math.PI * 2 / THINKING_GLOW_PERIOD_S) + 1) / 2;
|
|
366449
366507
|
const thinkingShimmerColor = toRGBColor(interpolateColor(THINKING_INACTIVE, THINKING_INACTIVE_SHIMMER, thinkingOpacity));
|
|
@@ -366467,7 +366525,9 @@ function SpinnerAnimationRow({
|
|
|
366467
366525
|
]
|
|
366468
366526
|
}, undefined, true, undefined, this)
|
|
366469
366527
|
]
|
|
366470
|
-
}, "tokens", true, undefined, this)] : [], ...
|
|
366528
|
+
}, "tokens", true, undefined, this)] : [], ...showStatusIndicator ? [/* @__PURE__ */ jsx_dev_runtime184.jsxDEV(SpinnerModeGlyph, {
|
|
366529
|
+
mode
|
|
366530
|
+
}, "statusGlyph", false, undefined, this)] : [], ...showThinking && thinkingText ? [thinkingStatus === "thinking" && !reducedMotion ? /* @__PURE__ */ jsx_dev_runtime184.jsxDEV(ThemedText, {
|
|
366471
366531
|
color: thinkingShimmerColor,
|
|
366472
366532
|
children: thinkingOnly ? `(${thinkingText})` : thinkingText
|
|
366473
366533
|
}, "thinking", false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime184.jsxDEV(ThemedText, {
|
|
@@ -366521,7 +366581,7 @@ function SpinnerAnimationRow({
|
|
|
366521
366581
|
time
|
|
366522
366582
|
}, undefined, false, undefined, this),
|
|
366523
366583
|
/* @__PURE__ */ jsx_dev_runtime184.jsxDEV(GlimmerMessage, {
|
|
366524
|
-
message,
|
|
366584
|
+
message: displayMessage,
|
|
366525
366585
|
mode,
|
|
366526
366586
|
messageColor,
|
|
366527
366587
|
glimmerIndex,
|
|
@@ -479281,7 +479341,8 @@ Error: sandbox required but unavailable: ${reason}
|
|
|
479281
479341
|
} catch (error) {
|
|
479282
479342
|
logError3(error);
|
|
479283
479343
|
const llmTimeoutHint = llmTimeoutRemediationHint(error, getCurrentLlmTimeoutMs());
|
|
479284
|
-
const
|
|
479344
|
+
const endpointLabel = getCurrentEndpointLabel(mainLoopModelParam);
|
|
479345
|
+
const gwHint = gatewayUnreachableRemediationHint(error, endpointLabel);
|
|
479285
479346
|
setMessages((prev) => [...prev, createSystemMessage(`本轮执行出错:${errorMessage2(error)}。${llmTimeoutHint ? `${llmTimeoutHint} ` : ""}${gwHint ? `${gwHint} ` : ""}请重试。`, "error")]);
|
|
479286
479347
|
} finally {
|
|
479287
479348
|
if (queryGuard.end(thisGeneration)) {
|
package/package.json
CHANGED