mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-24 07:01:49 +00:00
fix: restore ci status fast path and whatsapp tests
This commit is contained in:
@@ -20,6 +20,7 @@ import type { OpenClawConfig } from "./runtime-api.js";
|
||||
|
||||
const hoisted = vi.hoisted(() => ({
|
||||
sendPollWhatsApp: vi.fn(async () => ({ messageId: "wa-poll-1", toJid: "1555@s.whatsapp.net" })),
|
||||
sendReactionWhatsApp: vi.fn(async () => undefined),
|
||||
handleWhatsAppAction: vi.fn(async () => ({ content: [{ type: "text", text: '{"ok":true}' }] })),
|
||||
loginWeb: vi.fn(async () => {}),
|
||||
pathExists: vi.fn(async () => false),
|
||||
@@ -44,6 +45,19 @@ vi.mock("./runtime.js", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("./send.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("./send.js")>("./send.js");
|
||||
return {
|
||||
...actual,
|
||||
sendPollWhatsApp: hoisted.sendPollWhatsApp,
|
||||
sendReactionWhatsApp: hoisted.sendReactionWhatsApp,
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("./action-runtime.js", () => ({
|
||||
handleWhatsAppAction: hoisted.handleWhatsAppAction,
|
||||
}));
|
||||
|
||||
vi.mock("./login.js", () => ({
|
||||
loginWeb: hoisted.loginWeb,
|
||||
}));
|
||||
@@ -168,6 +182,7 @@ describe("whatsappPlugin outbound sendMedia", () => {
|
||||
describe("whatsappPlugin outbound sendPoll", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
hoisted.sendPollWhatsApp.mockClear();
|
||||
});
|
||||
|
||||
it("threads cfg into runtime sendPollWhatsApp call", async () => {
|
||||
@@ -435,6 +450,7 @@ describe("whatsappPlugin actions.handleAction react messageId resolution", () =>
|
||||
|
||||
beforeEach(() => {
|
||||
hoisted.handleWhatsAppAction.mockClear();
|
||||
hoisted.sendReactionWhatsApp.mockClear();
|
||||
});
|
||||
|
||||
it("uses explicit messageId when provided", async () => {
|
||||
|
||||
@@ -189,6 +189,14 @@
|
||||
"types": "./dist/plugin-sdk/tasks.d.ts",
|
||||
"default": "./dist/plugin-sdk/tasks.js"
|
||||
},
|
||||
"./plugin-sdk/tasks-summary": {
|
||||
"types": "./dist/plugin-sdk/tasks-summary.d.ts",
|
||||
"default": "./dist/plugin-sdk/tasks-summary.js"
|
||||
},
|
||||
"./plugin-sdk/tasks-empty-summary": {
|
||||
"types": "./dist/plugin-sdk/tasks-empty-summary.d.ts",
|
||||
"default": "./dist/plugin-sdk/tasks-empty-summary.js"
|
||||
},
|
||||
"./plugin-sdk/security-runtime": {
|
||||
"types": "./dist/plugin-sdk/security-runtime.d.ts",
|
||||
"default": "./dist/plugin-sdk/security-runtime.js"
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
"speech-core",
|
||||
"plugin-runtime",
|
||||
"tasks",
|
||||
"tasks-empty-summary",
|
||||
"tasks-summary",
|
||||
"security-runtime",
|
||||
"gateway-runtime",
|
||||
"github-copilot-login",
|
||||
|
||||
@@ -10,7 +10,6 @@ import { isMainModule } from "../infra/is-main.js";
|
||||
import { ensureOpenClawCliOnPath } from "../infra/path-env.js";
|
||||
import { assertSupportedRuntime } from "../infra/runtime-guard.js";
|
||||
import { enableConsoleCapture } from "../logging.js";
|
||||
import { normalizePluginId } from "../plugins/config-state.js";
|
||||
import { hasMemoryRuntime } from "../plugins/memory-state.js";
|
||||
import {
|
||||
getCommandPathWithRootOptions,
|
||||
@@ -93,7 +92,7 @@ export function resolveMissingBrowserCommandMessage(config?: OpenClawConfig): st
|
||||
Array.isArray(config?.plugins?.allow) && config.plugins.allow.length > 0
|
||||
? config.plugins.allow
|
||||
.filter((entry): entry is string => typeof entry === "string")
|
||||
.map((entry) => normalizePluginId(entry))
|
||||
.map((entry) => entry.trim().toLowerCase())
|
||||
: [];
|
||||
if (allow.length > 0 && !allow.includes("browser")) {
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { createEmptyTaskAuditSummary } from "openclaw/plugin-sdk/tasks";
|
||||
import { createEmptyTaskRegistrySummary } from "openclaw/plugin-sdk/tasks";
|
||||
import {
|
||||
createEmptyTaskAuditSummary,
|
||||
createEmptyTaskRegistrySummary,
|
||||
} from "openclaw/plugin-sdk/tasks-empty-summary";
|
||||
import type { OpenClawConfig } from "../config/types.js";
|
||||
import type { UpdateCheckResult } from "../infra/update-check.js";
|
||||
import { loggingState } from "../logging/state.js";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import { createEmptyTaskAuditSummary } from "openclaw/plugin-sdk/tasks";
|
||||
import { createEmptyTaskRegistrySummary } from "openclaw/plugin-sdk/tasks";
|
||||
import {
|
||||
createEmptyTaskAuditSummary,
|
||||
createEmptyTaskRegistrySummary,
|
||||
} from "openclaw/plugin-sdk/tasks-empty-summary";
|
||||
import { resolveMemorySearchConfig } from "../agents/memory-search.js";
|
||||
import { hasPotentialConfiguredChannels } from "../channels/config-presence.js";
|
||||
import { resolveCommandSecretRefsViaGateway } from "../cli/command-secret-gateway.js";
|
||||
|
||||
@@ -29,12 +29,16 @@ vi.mock("../config/io.js", () => ({
|
||||
loadConfig: vi.fn(() => ({})),
|
||||
}));
|
||||
|
||||
vi.mock("../config/sessions.js", () => ({
|
||||
loadSessionStore: vi.fn(() => ({})),
|
||||
resolveFreshSessionTotalTokens: vi.fn(() => undefined),
|
||||
resolveMainSessionKey: vi.fn(() => "main"),
|
||||
resolveStorePath: vi.fn(() => "/tmp/sessions.json"),
|
||||
}));
|
||||
vi.mock("../config/sessions.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../config/sessions.js")>();
|
||||
return {
|
||||
...actual,
|
||||
loadSessionStore: vi.fn(() => ({})),
|
||||
resolveFreshSessionTotalTokens: vi.fn(() => undefined),
|
||||
resolveMainSessionKey: vi.fn(() => "main"),
|
||||
resolveStorePath: vi.fn(() => "/tmp/sessions.json"),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("../gateway/agent-list.js", () => ({
|
||||
listGatewayAgentsBasic: vi.fn(() => ({
|
||||
@@ -59,7 +63,7 @@ vi.mock("../infra/system-events.js", () => ({
|
||||
peekSystemEvents: vi.fn(() => []),
|
||||
}));
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/tasks", () => ({
|
||||
vi.mock("openclaw/plugin-sdk/tasks-summary", () => ({
|
||||
getInspectableTaskRegistrySummary: vi.fn(() => ({
|
||||
total: 0,
|
||||
active: 0,
|
||||
|
||||
@@ -17,7 +17,7 @@ let channelSummaryModulePromise: Promise<typeof import("../infra/channel-summary
|
||||
let linkChannelModulePromise: Promise<typeof import("./status.link-channel.js")> | undefined;
|
||||
let configIoModulePromise: Promise<typeof import("../config/io.js")> | undefined;
|
||||
let taskRegistryMaintenanceModulePromise:
|
||||
| Promise<typeof import("openclaw/plugin-sdk/tasks")>
|
||||
| Promise<typeof import("openclaw/plugin-sdk/tasks-summary")>
|
||||
| undefined;
|
||||
|
||||
function loadChannelSummaryModule() {
|
||||
@@ -41,7 +41,7 @@ function loadConfigIoModule() {
|
||||
}
|
||||
|
||||
function loadTaskRegistryMaintenanceModule() {
|
||||
taskRegistryMaintenanceModulePromise ??= import("openclaw/plugin-sdk/tasks");
|
||||
taskRegistryMaintenanceModulePromise ??= import("openclaw/plugin-sdk/tasks-summary");
|
||||
return taskRegistryMaintenanceModulePromise;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TaskAuditSummary } from "openclaw/plugin-sdk/tasks";
|
||||
import type { TaskRegistrySummary } from "openclaw/plugin-sdk/tasks";
|
||||
import type { TaskAuditSummary } from "openclaw/plugin-sdk/tasks-summary";
|
||||
import type { TaskRegistrySummary } from "openclaw/plugin-sdk/tasks-summary";
|
||||
import type { ChannelId } from "../channels/plugins/types.js";
|
||||
|
||||
export type SessionStatus = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getInspectableTaskRegistrySummary } from "openclaw/plugin-sdk/tasks";
|
||||
import { getInspectableTaskRegistrySummary } from "openclaw/plugin-sdk/tasks-summary";
|
||||
import { getActiveEmbeddedRunCount } from "../agents/pi-embedded-runner/runs.js";
|
||||
import { getTotalPendingReplies } from "../auto-reply/reply/dispatcher-registry.js";
|
||||
import type { CliDeps } from "../cli/deps.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import path from "node:path";
|
||||
import { getInspectableTaskRegistrySummary } from "openclaw/plugin-sdk/tasks";
|
||||
import { getInspectableTaskRegistrySummary } from "openclaw/plugin-sdk/tasks-summary";
|
||||
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent-scope.js";
|
||||
import { getActiveEmbeddedRunCount } from "../agents/pi-embedded-runner/runs.js";
|
||||
import { registerSkillsChangeListener } from "../agents/skills/refresh.js";
|
||||
|
||||
10
src/plugin-sdk/tasks-empty-summary.ts
Normal file
10
src/plugin-sdk/tasks-empty-summary.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import {
|
||||
createEmptyTaskAuditSummary,
|
||||
type TaskAuditSummary,
|
||||
} from "../../packages/tasks-host-sdk/src/task-registry.audit.shared.js";
|
||||
import { createEmptyTaskRegistrySummary } from "../../packages/tasks-host-sdk/src/task-registry.summary.js";
|
||||
import type { TaskRegistrySummary } from "../../packages/tasks-host-sdk/src/task-registry.types.js";
|
||||
|
||||
export { createEmptyTaskAuditSummary, createEmptyTaskRegistrySummary };
|
||||
|
||||
export type { TaskAuditSummary, TaskRegistrySummary };
|
||||
19
src/plugin-sdk/tasks-summary.ts
Normal file
19
src/plugin-sdk/tasks-summary.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import {
|
||||
createEmptyTaskAuditSummary,
|
||||
type TaskAuditSummary,
|
||||
} from "../../packages/tasks-host-sdk/src/task-registry.audit.shared.js";
|
||||
import {
|
||||
getInspectableTaskAuditSummary,
|
||||
getInspectableTaskRegistrySummary,
|
||||
} from "../../packages/tasks-host-sdk/src/task-registry.maintenance.js";
|
||||
import { createEmptyTaskRegistrySummary } from "../../packages/tasks-host-sdk/src/task-registry.summary.js";
|
||||
import type { TaskRegistrySummary } from "../../packages/tasks-host-sdk/src/task-registry.types.js";
|
||||
|
||||
export {
|
||||
createEmptyTaskAuditSummary,
|
||||
createEmptyTaskRegistrySummary,
|
||||
getInspectableTaskAuditSummary,
|
||||
getInspectableTaskRegistrySummary,
|
||||
};
|
||||
|
||||
export type { TaskAuditSummary, TaskRegistrySummary };
|
||||
Reference in New Issue
Block a user