diff --git a/src/secrets/runtime.coverage.test.ts b/src/secrets/runtime.coverage.test.ts index a7423567b7a..45b275be97e 100644 --- a/src/secrets/runtime.coverage.test.ts +++ b/src/secrets/runtime.coverage.test.ts @@ -1,6 +1,6 @@ import fs from "node:fs"; import path from "node:path"; -import { beforeAll, describe, expect, it, vi } from "vitest"; +import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; import type { AuthProfileStore } from "../agents/auth-profiles.js"; import type { OpenClawConfig } from "../config/config.js"; import type { PluginOrigin } from "../plugins/types.js"; @@ -70,6 +70,24 @@ let collectConfigAssignments: typeof import("./runtime-config-collectors.js").co let createResolverContext: typeof import("./runtime-shared.js").createResolverContext; let resolveSecretRefValues: typeof import("./resolve.js").resolveSecretRefValues; let resolveRuntimeWebTools: typeof import("./runtime-web-tools.js").resolveRuntimeWebTools; +const previousBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; +const previousTrustBundledPluginsDir = process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR; + +process.env.OPENCLAW_BUNDLED_PLUGINS_DIR ??= "extensions"; +process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR ??= "1"; + +afterAll(() => { + if (previousBundledPluginsDir === undefined) { + delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; + } else { + process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = previousBundledPluginsDir; + } + if (previousTrustBundledPluginsDir === undefined) { + delete process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR; + } else { + process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR = previousTrustBundledPluginsDir; + } +}); async function ensureConfigCoverageRuntimeLoaded(): Promise { if (!collectConfigAssignments) { @@ -317,6 +335,16 @@ function applyConfigForOpenClawTarget( "https://example.com/hook", ); } + if (entry.id === "channels.qqbot.clientSecret") { + setPathCreateStrict(config, ["channels", "qqbot", "appId"], "sample-app-id"); + } + if (entry.id === "channels.qqbot.accounts.*.clientSecret") { + setPathCreateStrict( + config, + ["channels", "qqbot", "accounts", wildcardToken, "appId"], + "sample-app-id", + ); + } if (entry.id === "channels.feishu.verificationToken") { setPathCreateStrict(config, ["channels", "feishu", "connectionMode"], "webhook"); } diff --git a/src/secrets/target-registry.docs.test.ts b/src/secrets/target-registry.docs.test.ts index 4bdb802ed04..6edc1558139 100644 --- a/src/secrets/target-registry.docs.test.ts +++ b/src/secrets/target-registry.docs.test.ts @@ -1,6 +1,6 @@ import fs from "node:fs"; import path from "node:path"; -import { describe, expect, it } from "vitest"; +import { afterAll, describe, expect, it } from "vitest"; import { buildSecretRefCredentialMatrix, type SecretRefCredentialMatrixDocument, @@ -10,6 +10,25 @@ function buildSecretRefCredentialMatrixJson(): string { return `${JSON.stringify(buildSecretRefCredentialMatrix(), null, 2)}\n`; } +const previousBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; +const previousTrustBundledPluginsDir = process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR; + +process.env.OPENCLAW_BUNDLED_PLUGINS_DIR ??= "extensions"; +process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR ??= "1"; + +afterAll(() => { + if (previousBundledPluginsDir === undefined) { + delete process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; + } else { + process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = previousBundledPluginsDir; + } + if (previousTrustBundledPluginsDir === undefined) { + delete process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR; + } else { + process.env.OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR = previousTrustBundledPluginsDir; + } +}); + describe("secret target registry docs", () => { it("stays in sync with docs/reference/secretref-user-supplied-credentials-matrix.json", () => { const pathname = path.join(