refactor(core): inline one-use helper modules · openclaw/openclaw@7b74d73
vincentkoc
·
2026-06-18
·
via Recent Commits to openclaw:main
File tree
agents/embedded-agent-runner/run
| Original file line number | Diff line number | Diff line change |
|---|
@@ -7,15 +7,14 @@ import {
|
7 | 7 | } from "openclaw/plugin-sdk/llm"; |
8 | 8 | import { afterEach, describe, expect, it, vi } from "vitest"; |
9 | 9 | import type { OpenClawConfig } from "../../../config/config.js"; |
10 | | -import { DEFAULT_LLM_IDLE_TIMEOUT_SECONDS } from "../../../config/agent-timeout-defaults.js"; |
11 | 10 | import { notifyLlmRequestActivity } from "../../../shared/llm-request-activity.js"; |
12 | 11 | import type { StreamFn } from "../../runtime/index.js"; |
13 | 12 | import { |
14 | 13 | resolveLlmIdleTimeoutMs, |
15 | 14 | streamWithIdleTimeout, |
16 | 15 | } from "./llm-idle-timeout.js"; |
17 | 16 | |
18 | | -const DEFAULT_LLM_IDLE_TIMEOUT_MS = DEFAULT_LLM_IDLE_TIMEOUT_SECONDS * 1000; |
| 17 | +const DEFAULT_LLM_IDLE_TIMEOUT_MS = 120_000; |
19 | 18 | |
20 | 19 | describe("resolveLlmIdleTimeoutMs", () => { |
21 | 20 | it("returns default when config is undefined", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,6 @@ import {
|
6 | 6 | clampTimerTimeoutMs, |
7 | 7 | MAX_TIMER_TIMEOUT_MS, |
8 | 8 | } from "@openclaw/normalization-core/number-coercion"; |
9 | | -import { DEFAULT_LLM_IDLE_TIMEOUT_SECONDS } from "../../../config/agent-timeout-defaults.js"; |
10 | 9 | import type { OpenClawConfig } from "../../../config/types.openclaw.js"; |
11 | 10 | import { onLlmRequestActivity } from "../../../shared/llm-request-activity.js"; |
12 | 11 | import type { StreamFn } from "../../runtime/index.js"; |
@@ -17,7 +16,7 @@ import type { EmbeddedRunTrigger } from "./params.js";
|
17 | 16 | /** |
18 | 17 | * Default idle timeout for LLM streaming responses in milliseconds. |
19 | 18 | */ |
20 | | -const DEFAULT_LLM_IDLE_TIMEOUT_MS = DEFAULT_LLM_IDLE_TIMEOUT_SECONDS * 1000; |
| 19 | +const DEFAULT_LLM_IDLE_TIMEOUT_MS = 120_000; |
21 | 20 | |
22 | 21 | /** |
23 | 22 | * Detects loopback / private-network / `.local` base URLs. Local providers |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,6 @@
|
2 | 2 | import { afterEach, describe, expect, it } from "vitest"; |
3 | 3 | import { testing as cliBackendsTesting } from "../agents/cli-backends.js"; |
4 | 4 | import type { ModelDefinitionConfig } from "../config/types.models.js"; |
5 | | -import { formatFastModeLabel } from "./status-labels.js"; |
6 | 5 | import { buildStatusMessage } from "./status-message.js"; |
7 | 6 | |
8 | 7 | function statusTestModel(id: string, name: string, contextWindow: number): ModelDefinitionConfig { |
@@ -21,16 +20,6 @@ afterEach(() => {
|
21 | 20 | cliBackendsTesting.resetDepsForTest(); |
22 | 21 | }); |
23 | 22 | |
24 | | -describe("formatFastModeLabel", () => { |
25 | | -it("shows fast mode when enabled", () => { |
26 | | -expect(formatFastModeLabel(true)).toBe("Fast: on"); |
27 | | -}); |
28 | | - |
29 | | -it("shows fast mode when disabled", () => { |
30 | | -expect(formatFastModeLabel(false)).toBe("Fast: off"); |
31 | | -}); |
32 | | -}); |
33 | | - |
34 | 23 | describe("buildStatusMessage context window", () => { |
35 | 24 | it("ignores stale runtime context after a manual session model switch", () => { |
36 | 25 | const text = buildStatusMessage({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -62,7 +62,6 @@ import {
|
62 | 62 | import { VERSION } from "../version.js"; |
63 | 63 | import { resolveAgentRuntimeLabel } from "./agent-runtime-label.js"; |
64 | 64 | import { resolveActiveFallbackState } from "./fallback-notice-state.js"; |
65 | | -import { formatFastModeLabel } from "./status-labels.js"; |
66 | 65 | |
67 | 66 | type AgentDefaults = NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]>; |
68 | 67 | type AgentConfig = Partial<AgentDefaults> & { |
@@ -957,7 +956,7 @@ export function buildStatusMessage(args: StatusArgs): string {
|
957 | 956 | `Execution: ${execution.label}`, |
958 | 957 | `Runtime: ${agentRuntimeLabel}`, |
959 | 958 | `Think: ${thinkLevel}`, |
960 | | -formatFastModeLabel(fastMode), |
| 959 | +`Fast: ${fastMode ? "on" : "off"}`, |
961 | 960 | textVerbosity ? `Text: ${textVerbosity}` : null, |
962 | 961 | verboseLabel, |
963 | 962 | traceLabel, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。