diff --git a/extensions/acpx/src/acpx-runtime-compat.d.ts b/extensions/acpx/src/acpx-runtime-compat.d.ts deleted file mode 100644 index 8a31274ca798..000000000000 --- a/extensions/acpx/src/acpx-runtime-compat.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -declare module "acpx/runtime" { - export const ACPX_BACKEND_ID: string; - - export type AcpRuntimeDoctorReport = import("../runtime-api.js").AcpRuntimeDoctorReport; - export type AcpRuntimeEnsureInput = import("../runtime-api.js").AcpRuntimeEnsureInput; - export type AcpRuntimeEvent = import("../runtime-api.js").AcpRuntimeEvent; - export type AcpRuntimeHandle = import("../runtime-api.js").AcpRuntimeHandle; - export type AcpRuntimeCapabilities = import("../runtime-api.js").AcpRuntimeCapabilities; - export type AcpRuntimeStatus = import("../runtime-api.js").AcpRuntimeStatus; - export type AcpRuntimeTurn = import("../runtime-api.js").AcpRuntimeTurn; - export type AcpRuntimeTurnInput = import("../runtime-api.js").AcpRuntimeTurnInput; - export type AcpRuntimeTurnResult = import("../runtime-api.js").AcpRuntimeTurnResult; - - export type AcpAgentRegistry = { - resolve(agent: string): string | undefined; - list(): string[]; - }; - - export type AcpSessionRecord = Record; - - export type AcpSessionStore = { - load(sessionId: string): Promise; - save(record: AcpSessionRecord): Promise; - }; - - export type AcpRuntimeOptions = { - cwd: string; - sessionStore: AcpSessionStore; - agentRegistry: AcpAgentRegistry; - probeAgent?: string; - mcpServers?: unknown; - permissionMode?: unknown; - nonInteractivePermissions?: unknown; - timeoutMs?: number; - probeAgent?: string; - }; - - export class AcpxRuntime { - constructor(options: AcpRuntimeOptions, testOptions?: unknown); - isHealthy(): boolean; - probeAvailability(): Promise; - doctor(): Promise; - ensureSession(input: AcpRuntimeEnsureInput): Promise; - startTurn(input: AcpRuntimeTurnInput): AcpRuntimeTurn; - runTurn(input: AcpRuntimeTurnInput): AsyncIterable; - getCapabilities(input?: { - handle?: AcpRuntimeHandle; - }): AcpRuntimeCapabilities | Promise; - getStatus(input: { handle: AcpRuntimeHandle; signal?: AbortSignal }): Promise; - setMode(input: { handle: AcpRuntimeHandle; mode: string }): Promise; - setConfigOption(input: { handle: AcpRuntimeHandle; key: string; value: string }): Promise; - cancel(input: { handle: AcpRuntimeHandle; reason?: string }): Promise; - close(input: { - handle: AcpRuntimeHandle; - reason?: string; - discardPersistentState?: boolean; - }): Promise; - } - - export function createAcpRuntime(...args: unknown[]): AcpxRuntime; - export function createAgentRegistry(params: { overrides?: unknown }): AcpAgentRegistry; - export function createFileSessionStore(params: { stateDir: string }): AcpSessionStore; - export function decodeAcpxRuntimeHandleState(...args: unknown[]): unknown; - export function encodeAcpxRuntimeHandleState(...args: unknown[]): unknown; -} diff --git a/extensions/acpx/src/runtime.ts b/extensions/acpx/src/runtime.ts index fdbafbc7ec75..f3e72bd49676 100644 --- a/extensions/acpx/src/runtime.ts +++ b/extensions/acpx/src/runtime.ts @@ -549,16 +549,15 @@ function appendCodexAcpConfigOverrides(command: string, override: CodexAcpModelO function createModelScopedAgentRegistry(params: { agentRegistry: AcpAgentRegistry; scope: AsyncLocalStorage; - leaseCommand: (command: string | undefined) => string | undefined; + leaseCommand: (command: string) => string; }): AcpAgentRegistry { return { - resolve(agentName: string): string | undefined { + resolve(agentName: string): string { const command = params.agentRegistry.resolve(agentName); const override = params.scope.getStore(); if ( !override || normalizeAgentName(agentName) !== CODEX_ACP_AGENT_ID || - typeof command !== "string" || !isCodexAcpCommand(command) ) { return params.leaseCommand(command); @@ -700,9 +699,9 @@ export class AcpxRuntime implements AcpRuntime { }); } - private commandWithLaunchLease(command: string | undefined): string | undefined { + private commandWithLaunchLease(command: string): string { const launch = this.launchLeaseScope.getStore(); - if (!command || !launch) { + if (!launch) { return command; } launch.stableCommand = command; diff --git a/extensions/amazon-bedrock-mantle/bedrock-token-generator.d.ts b/extensions/amazon-bedrock-mantle/bedrock-token-generator.d.ts deleted file mode 100644 index 5f4d4244e676..000000000000 --- a/extensions/amazon-bedrock-mantle/bedrock-token-generator.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module "@aws/bedrock-token-generator" { - export function getTokenProvider(opts?: { - region?: string; - expiresInSeconds?: number; - }): () => Promise; -} diff --git a/extensions/anthropic/cli-backend-api.ts b/extensions/anthropic/cli-backend-api.ts deleted file mode 100644 index ce54b5480f46..000000000000 --- a/extensions/anthropic/cli-backend-api.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { buildAnthropicCliBackend } from "./cli-backend.js"; -export { - CLAUDE_CLI_BACKEND_ID, - isClaudeCliProvider, - normalizeClaudeBackendConfig, -} from "./cli-shared.js"; diff --git a/extensions/browser/browser-runtime-api.ts b/extensions/browser/browser-runtime-api.ts deleted file mode 100644 index 442e4ae4bca9..000000000000 --- a/extensions/browser/browser-runtime-api.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./src/browser-runtime.js"; diff --git a/extensions/feishu/src/monitor.reaction.lifecycle.test-support.ts b/extensions/feishu/src/monitor.reaction.lifecycle.test-support.ts deleted file mode 100644 index e449946715ba..000000000000 --- a/extensions/feishu/src/monitor.reaction.lifecycle.test-support.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { describe, expect, it } from "vitest"; -import type { ClawdbotConfig } from "../runtime-api.js"; -import { - resolveReactionSyntheticEvent, - type FeishuReactionCreatedEvent, -} from "./monitor.account.js"; - -const cfg = {} as ClawdbotConfig; - -function makeReactionEvent( - overrides: Partial = {}, -): FeishuReactionCreatedEvent { - return { - message_id: "om_msg1", - reaction_type: { emoji_type: "THUMBSUP" }, - operator_type: "user", - user_id: { open_id: "ou_user1" }, - ...overrides, - }; -} - -describe("Feishu reaction lifecycle", () => { - it("builds a created synthetic interaction payload", async () => { - const result = await resolveReactionSyntheticEvent({ - cfg, - accountId: "default", - event: makeReactionEvent({ user_id: { open_id: "ou_user1", user_id: "on_user1" } }), - botOpenId: "ou_bot", - fetchMessage: async () => ({ - messageId: "om_msg1", - chatId: "oc_group_1", - chatType: "group", - senderOpenId: "ou_bot", - senderType: "app", - content: "hello", - contentType: "text", - }), - uuid: () => "fixed-uuid", - }); - - expect(result?.sender.sender_id).toEqual({ open_id: "ou_user1", user_id: "on_user1" }); - expect(result?.message.content).toBe('{"text":"[reacted with THUMBSUP to message om_msg1]"}'); - }); - - it("builds a deleted synthetic interaction payload", async () => { - const result = await resolveReactionSyntheticEvent({ - cfg, - accountId: "default", - event: makeReactionEvent(), - botOpenId: "ou_bot", - fetchMessage: async () => ({ - messageId: "om_msg1", - chatId: "oc_group_1", - chatType: "group", - senderOpenId: "ou_bot", - senderType: "app", - content: "hello", - contentType: "text", - }), - uuid: () => "fixed-uuid", - action: "deleted", - }); - - expect(result?.message.content).toBe( - '{"text":"[removed reaction THUMBSUP from message om_msg1]"}', - ); - }); -}); diff --git a/extensions/imessage/src/conversation-bindings.ts b/extensions/imessage/src/conversation-bindings.ts index 3c2f9eb2861f..96b09c9e8eaa 100644 --- a/extensions/imessage/src/conversation-bindings.ts +++ b/extensions/imessage/src/conversation-bindings.ts @@ -44,4 +44,3 @@ export const testing = { }); }, }; -export { testing as __testing }; diff --git a/extensions/xai/model-compat.ts b/extensions/xai/model-compat.ts index 3fbd0dc0da85..51445c1fc8ca 100644 --- a/extensions/xai/model-compat.ts +++ b/extensions/xai/model-compat.ts @@ -8,7 +8,7 @@ export { normalizeXaiModelId as normalizeNativeXaiModelId } from "./model-id.js" export const XAI_TOOL_SCHEMA_PROFILE = "xai"; export const HTML_ENTITY_TOOL_CALL_ARGUMENTS_ENCODING = "html-entities"; -export const XAI_UNSUPPORTED_SCHEMA_KEYWORDS = new Set([ +const XAI_UNSUPPORTED_SCHEMA_KEYWORDS = new Set([ "minLength", "maxLength", "minItems", @@ -17,7 +17,7 @@ export const XAI_UNSUPPORTED_SCHEMA_KEYWORDS = new Set([ "maxContains", ]); -export function resolveXaiModelCompatPatch(): ModelCompatConfig { +function resolveXaiModelCompatPatch(): ModelCompatConfig { return { toolSchemaProfile: XAI_TOOL_SCHEMA_PROFILE, unsupportedToolSchemaKeywords: Array.from(XAI_UNSUPPORTED_SCHEMA_KEYWORDS), diff --git a/src/agents/tool-policy.conformance.ts b/src/agents/tool-policy.conformance.ts deleted file mode 100644 index f26e83f5db8e..000000000000 --- a/src/agents/tool-policy.conformance.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Conformance snapshot for tool policy. - * - * Security note: - * - This is static, build-time information (no runtime I/O, no network exposure). - * - Intended for CI/tools to detect drift between the implementation policy and - * the formal models/extractors. - */ - -import { TOOL_GROUPS } from "./tool-policy.js"; - -// Tool name aliases are intentionally not exported from tool-policy today. -// Keep the conformance snapshot focused on exported policy constants. - -export const TOOL_POLICY_CONFORMANCE = { - toolGroups: TOOL_GROUPS, -} as const; diff --git a/src/agents/tool-policy.test.ts b/src/agents/tool-policy.test.ts index 49b33be0b42f..1d84bfcb22dd 100644 --- a/src/agents/tool-policy.test.ts +++ b/src/agents/tool-policy.test.ts @@ -4,7 +4,6 @@ import { pickSandboxToolPolicy } from "./sandbox-tool-policy.js"; import { isToolAllowed, resolveSandboxToolPolicyForAgent } from "./sandbox/tool-policy.js"; import type { SandboxToolPolicy } from "./sandbox/types.js"; import { isToolAllowedByPolicyName } from "./tool-policy-match.js"; -import { TOOL_POLICY_CONFORMANCE } from "./tool-policy.conformance.js"; import { collectExplicitAllowlist, DEFAULT_PLUGIN_TOOLS_ALLOWLIST_ENTRY, @@ -78,17 +77,6 @@ describe("tool-policy", () => { }); }); -describe("TOOL_POLICY_CONFORMANCE", () => { - it("matches exported TOOL_GROUPS exactly", () => { - expect(TOOL_POLICY_CONFORMANCE.toolGroups).toEqual(TOOL_GROUPS); - }); - - it("is JSON-serializable", () => { - const serialized = JSON.stringify(TOOL_POLICY_CONFORMANCE); - expect(JSON.parse(serialized)).toEqual({ toolGroups: TOOL_GROUPS }); - }); -}); - describe("sandbox tool policy", () => { it("allows all tools with * allow", () => { const policy: SandboxToolPolicy = { allow: ["*"], deny: [] }; diff --git a/src/channels/plugins/contracts/test-helpers/imessage-test-plugin.ts b/src/channels/plugins/contracts/test-helpers/imessage-test-plugin.ts deleted file mode 100644 index 658d7b90671e..000000000000 --- a/src/channels/plugins/contracts/test-helpers/imessage-test-plugin.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/channel-contract"; -import type { ChannelPlugin } from "openclaw/plugin-sdk/channel-plugin-common"; -import { loadBundledPluginTestApiSync } from "../../../../test-utils/bundled-plugin-public-surface.js"; - -type CreateIMessageTestPlugin = (params?: { outbound?: ChannelOutboundAdapter }) => ChannelPlugin; - -let createIMessageTestPluginCache: CreateIMessageTestPlugin | undefined; - -function getCreateIMessageTestPlugin(): CreateIMessageTestPlugin { - if (!createIMessageTestPluginCache) { - ({ createIMessageTestPlugin: createIMessageTestPluginCache } = loadBundledPluginTestApiSync<{ - createIMessageTestPlugin: CreateIMessageTestPlugin; - }>("imessage")); - } - return createIMessageTestPluginCache; -} - -export const createIMessageTestPlugin: CreateIMessageTestPlugin = (...args) => - getCreateIMessageTestPlugin()(...args); diff --git a/src/test-utils/jiti-runtime.ts b/src/test-utils/jiti-runtime.ts deleted file mode 100644 index c11ad43be660..000000000000 --- a/src/test-utils/jiti-runtime.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function shouldExpectNativeJitiForJavaScriptTestRuntime(): boolean { - return typeof (process.versions as { bun?: string }).bun !== "string"; -} diff --git a/src/test-utils/model-fallback.mock.ts b/src/test-utils/model-fallback.mock.ts deleted file mode 100644 index 4431db3db965..000000000000 --- a/src/test-utils/model-fallback.mock.ts +++ /dev/null @@ -1,15 +0,0 @@ -export async function runWithModelFallback(params: { - provider: string; - model: string; - run: ( - provider: string, - model: string, - options?: { allowTransientCooldownProbe?: boolean }, - ) => Promise; -}) { - return { - result: await params.run(params.provider, params.model), - provider: params.provider, - model: params.model, - }; -} diff --git a/test/helpers/fast-short-timeouts.ts b/test/helpers/fast-short-timeouts.ts deleted file mode 100644 index 32fa2bd0d90e..000000000000 --- a/test/helpers/fast-short-timeouts.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { setTimeout as nativeSetTimeout } from "node:timers"; -import { vi } from "vitest"; - -export function useFastShortTimeouts(maxDelayMs = 2000): () => void { - const spy = vi.spyOn(global, "setTimeout").mockImplementation((( - handler: TimerHandler, - timeout?: number, - ...args: unknown[] - ) => { - const delay = typeof timeout === "number" ? timeout : 0; - if (delay > 0 && delay <= maxDelayMs) { - return nativeSetTimeout(handler, 0, ...args); - } - return nativeSetTimeout(handler, delay, ...args); - }) as typeof setTimeout); - return () => spy.mockRestore(); -}