mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 17:00:34 +00:00
chore: Fix types in tests 8/N.
This commit is contained in:
@@ -1,9 +1,3 @@
|
|||||||
import type { OpenClawConfig } from "../../config/config.js";
|
|
||||||
import type { SessionEntry, SessionScope } from "../../config/sessions.js";
|
|
||||||
import type { MediaUnderstandingDecision } from "../../media-understanding/types.js";
|
|
||||||
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "../thinking.js";
|
|
||||||
import type { ReplyPayload } from "../types.js";
|
|
||||||
import type { CommandContext } from "./commands-types.js";
|
|
||||||
import {
|
import {
|
||||||
resolveAgentDir,
|
resolveAgentDir,
|
||||||
resolveDefaultAgentId,
|
resolveDefaultAgentId,
|
||||||
@@ -15,14 +9,20 @@ import {
|
|||||||
resolveInternalSessionKey,
|
resolveInternalSessionKey,
|
||||||
resolveMainSessionAlias,
|
resolveMainSessionAlias,
|
||||||
} from "../../agents/tools/sessions-helpers.js";
|
} from "../../agents/tools/sessions-helpers.js";
|
||||||
|
import type { OpenClawConfig } from "../../config/config.js";
|
||||||
|
import type { SessionEntry, SessionScope } from "../../config/sessions.js";
|
||||||
import { logVerbose } from "../../globals.js";
|
import { logVerbose } from "../../globals.js";
|
||||||
import {
|
import {
|
||||||
formatUsageWindowSummary,
|
formatUsageWindowSummary,
|
||||||
loadProviderUsageSummary,
|
loadProviderUsageSummary,
|
||||||
resolveUsageProviderId,
|
resolveUsageProviderId,
|
||||||
} from "../../infra/provider-usage.js";
|
} from "../../infra/provider-usage.js";
|
||||||
|
import type { MediaUnderstandingDecision } from "../../media-understanding/types.js";
|
||||||
import { normalizeGroupActivation } from "../group-activation.js";
|
import { normalizeGroupActivation } from "../group-activation.js";
|
||||||
import { buildStatusMessage } from "../status.js";
|
import { buildStatusMessage } from "../status.js";
|
||||||
|
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "../thinking.js";
|
||||||
|
import type { ReplyPayload } from "../types.js";
|
||||||
|
import type { CommandContext } from "./commands-types.js";
|
||||||
import { getFollowupQueueDepth, resolveQueueSettings } from "./queue.js";
|
import { getFollowupQueueDepth, resolveQueueSettings } from "./queue.js";
|
||||||
import { resolveSubagentLabel } from "./subagents-utils.js";
|
import { resolveSubagentLabel } from "./subagents-utils.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import type { SpawnSubagentResult } from "../../agents/subagent-spawn.js";
|
|
||||||
import { resetSubagentRegistryForTests } from "../../agents/subagent-registry.js";
|
import { resetSubagentRegistryForTests } from "../../agents/subagent-registry.js";
|
||||||
|
import type { SpawnSubagentResult } from "../../agents/subagent-spawn.js";
|
||||||
|
|
||||||
const hoisted = vi.hoisted(() => {
|
const hoisted = vi.hoisted(() => {
|
||||||
const spawnSubagentDirectMock = vi.fn();
|
const spawnSubagentDirectMock = vi.fn();
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import crypto from "node:crypto";
|
import crypto from "node:crypto";
|
||||||
import type { SubagentRunRecord } from "../../agents/subagent-registry.js";
|
|
||||||
import type { CommandHandler } from "./commands-types.js";
|
|
||||||
import { AGENT_LANE_SUBAGENT } from "../../agents/lanes.js";
|
import { AGENT_LANE_SUBAGENT } from "../../agents/lanes.js";
|
||||||
import { abortEmbeddedPiRun } from "../../agents/pi-embedded.js";
|
import { abortEmbeddedPiRun } from "../../agents/pi-embedded.js";
|
||||||
|
import type { SubagentRunRecord } from "../../agents/subagent-registry.js";
|
||||||
import {
|
import {
|
||||||
clearSubagentRunSteerRestart,
|
clearSubagentRunSteerRestart,
|
||||||
listSubagentRunsForRequester,
|
listSubagentRunsForRequester,
|
||||||
@@ -36,6 +35,7 @@ import {
|
|||||||
} from "../../shared/subagents-format.js";
|
} from "../../shared/subagents-format.js";
|
||||||
import { INTERNAL_MESSAGE_CHANNEL } from "../../utils/message-channel.js";
|
import { INTERNAL_MESSAGE_CHANNEL } from "../../utils/message-channel.js";
|
||||||
import { stopSubagentsForRequester } from "./abort.js";
|
import { stopSubagentsForRequester } from "./abort.js";
|
||||||
|
import type { CommandHandler } from "./commands-types.js";
|
||||||
import { clearSessionQueues } from "./queue.js";
|
import { clearSessionQueues } from "./queue.js";
|
||||||
import { formatRunLabel, formatRunStatus, sortSubagentRuns } from "./subagents-utils.js";
|
import { formatRunLabel, formatRunStatus, sortSubagentRuns } from "./subagents-utils.js";
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import {
|
|||||||
} from "./status.js";
|
} from "./status.js";
|
||||||
|
|
||||||
const { listPluginCommands } = vi.hoisted(() => ({
|
const { listPluginCommands } = vi.hoisted(() => ({
|
||||||
listPluginCommands: vi.fn(() => []),
|
listPluginCommands: vi.fn(
|
||||||
|
(): Array<{ name: string; description: string; pluginId: string }> => [],
|
||||||
|
),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("../plugins/commands.js", () => ({
|
vi.mock("../plugins/commands.js", () => ({
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import type { SkillCommandSpec } from "../agents/skills.js";
|
|
||||||
import type { OpenClawConfig } from "../config/config.js";
|
|
||||||
import type { MediaUnderstandingDecision } from "../media-understanding/types.js";
|
|
||||||
import type { CommandCategory } from "./commands-registry.types.js";
|
|
||||||
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "./thinking.js";
|
|
||||||
import { lookupContextTokens } from "../agents/context.js";
|
import { lookupContextTokens } from "../agents/context.js";
|
||||||
import { DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
|
import { DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
|
||||||
import { resolveModelAuthMode } from "../agents/model-auth.js";
|
import { resolveModelAuthMode } from "../agents/model-auth.js";
|
||||||
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
|
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
|
||||||
import { resolveSandboxRuntimeStatus } from "../agents/sandbox.js";
|
import { resolveSandboxRuntimeStatus } from "../agents/sandbox.js";
|
||||||
|
import type { SkillCommandSpec } from "../agents/skills.js";
|
||||||
import { derivePromptTokens, normalizeUsage, type UsageLike } from "../agents/usage.js";
|
import { derivePromptTokens, normalizeUsage, type UsageLike } from "../agents/usage.js";
|
||||||
|
import type { OpenClawConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
resolveMainSessionKey,
|
resolveMainSessionKey,
|
||||||
resolveSessionFilePath,
|
resolveSessionFilePath,
|
||||||
@@ -19,6 +16,7 @@ import {
|
|||||||
} from "../config/sessions.js";
|
} from "../config/sessions.js";
|
||||||
import { formatTimeAgo } from "../infra/format-time/format-relative.ts";
|
import { formatTimeAgo } from "../infra/format-time/format-relative.ts";
|
||||||
import { resolveCommitHash } from "../infra/git-commit.js";
|
import { resolveCommitHash } from "../infra/git-commit.js";
|
||||||
|
import type { MediaUnderstandingDecision } from "../media-understanding/types.js";
|
||||||
import { listPluginCommands } from "../plugins/commands.js";
|
import { listPluginCommands } from "../plugins/commands.js";
|
||||||
import { resolveAgentIdFromSessionKey } from "../routing/session-key.js";
|
import { resolveAgentIdFromSessionKey } from "../routing/session-key.js";
|
||||||
import {
|
import {
|
||||||
@@ -41,8 +39,13 @@ import {
|
|||||||
listChatCommandsForConfig,
|
listChatCommandsForConfig,
|
||||||
type ChatCommandDefinition,
|
type ChatCommandDefinition,
|
||||||
} from "./commands-registry.js";
|
} from "./commands-registry.js";
|
||||||
|
import type { CommandCategory } from "./commands-registry.types.js";
|
||||||
|
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "./thinking.js";
|
||||||
|
|
||||||
type AgentConfig = Partial<NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]>>;
|
type AgentDefaults = NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]>;
|
||||||
|
type AgentConfig = Partial<AgentDefaults> & {
|
||||||
|
model?: AgentDefaults["model"] | string;
|
||||||
|
};
|
||||||
|
|
||||||
export const formatTokenCount = formatTokenCountShared;
|
export const formatTokenCount = formatTokenCountShared;
|
||||||
|
|
||||||
@@ -72,7 +75,7 @@ type StatusArgs = {
|
|||||||
usageLine?: string;
|
usageLine?: string;
|
||||||
timeLine?: string;
|
timeLine?: string;
|
||||||
queue?: QueueStatus;
|
queue?: QueueStatus;
|
||||||
mediaDecisions?: MediaUnderstandingDecision[];
|
mediaDecisions?: ReadonlyArray<MediaUnderstandingDecision>;
|
||||||
subagentsLine?: string;
|
subagentsLine?: string;
|
||||||
includeTranscriptUsage?: boolean;
|
includeTranscriptUsage?: boolean;
|
||||||
now?: number;
|
now?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user