From e74be5d41db4afbdd382db6a3bc60a32d805579b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 11 Aug 2026 13:34:24 -0700 Subject: [PATCH] refactor: eliminate final wrapper-shadowing hazards (#122157) * refactor: disambiguate wrapper-shadowed exports * test: align renamed session and facade boundaries * test: cover renamed runtime mock exports * refactor: align remaining wrapper owner call sites * test: align overlap-rebased runtime mocks * refactor: preserve public SDK names after overlap rebase * chore: regenerate wrapper shadowing baselines * test: align cron model selection mocks --- .../agent-harness-runtime.json | 2 +- .../agent-harness.json | 2 +- .../plugin-sdk-api-baseline/channel-core.json | 2 +- .../channel-entry-contract.json | 2 +- .../channel-message.json | 2 +- .../channel-outbound.json | 2 +- .../channel-plugin-common.json | 2 +- .../plugin-sdk-api-baseline/core.json | 2 +- .../plugin-sdk-api-baseline/discord.json | 2 +- .../inbound-envelope.json | 2 +- .../inbound-reply-dispatch.json | 2 +- .../meeting-runtime.json | 2 +- .../plugin-sdk-api-baseline/plugin-entry.json | 2 +- .../plugin-runtime.json | 2 +- .../provider-catalog-runtime.json | 2 +- .../reply-runtime.json | 2 +- .../plugin-sdk-api-baseline/tool-plugin.json | 2 +- .../webhook-ingress.json | 2 +- scripts/check-session-accessor-boundary.mts | 1 + scripts/lib/wrapper-shadowing-baseline.json | 73 +--------------- .../codex-app-server.extensions.test.ts | 2 +- src/agents/command-poll-backoff.runtime.ts | 4 +- src/agents/command-poll-backoff.test.ts | 6 +- src/agents/command-poll-backoff.ts | 2 +- .../session.resolve-session-key.test.ts | 6 +- src/agents/command/session.ts | 4 +- src/agents/embedded-agent-runner.e2e.test.ts | 2 +- .../model.configured-overrides.ts | 7 +- ...orward-compat.errors-and-overrides.test.ts | 2 +- .../model.manifest-alias.ts | 4 +- .../model.registry-resolution.ts | 9 +- .../model.static-catalog.prepared.test.ts | 8 +- ...odel.static-catalog.snapshot-cache.test.ts | 8 +- .../model.static-catalog.test.ts | 30 +++---- .../model.static-catalog.ts | 4 +- .../embedded-agent-runner/model.test.ts | 2 +- .../run/session-bootstrap.ts | 4 +- src/agents/heartbeat-system-prompt.ts | 2 +- .../model-auth-env.provider-aliases.test.ts | 16 ++-- src/agents/model-auth-env.ts | 4 +- src/agents/model-auth.profiles.test.ts | 7 +- src/agents/model-auth.test.ts | 2 +- src/agents/model-selection-resolve.test.ts | 17 ++-- src/agents/model-selection-resolve.ts | 2 +- src/agents/model-selection.test.ts | 2 +- src/agents/model-selection.ts | 2 +- src/agents/model-suppression.runtime.ts | 4 +- src/agents/model-suppression.test.ts | 36 +++++--- src/agents/model-suppression.ts | 2 +- ...ls-config.provider-policy-registry.test.ts | 2 +- .../models-config.providers.moonshot.test.ts | 2 +- .../models-config.providers.nvidia.test.ts | 2 +- ...els-config.runtime-source-snapshot.test.ts | 2 +- src/agents/models.profiles.live.test.ts | 4 +- .../openclaw-tools.session-status.test.ts | 8 +- .../prepare-auth.setup-provider.test.ts | 8 +- src/auto-reply/heartbeat.ts | 2 +- .../reply/commands-session-store.ts | 4 +- src/channels/inbound-event/envelope.ts | 10 +-- .../channel-import-guardrails.test.ts | 4 +- src/cli/plugins-cli-test-helpers.ts | 2 +- src/cli/security-cli.test.ts | 16 ++-- src/cli/security-cli.ts | 4 +- src/commands/agent/session.runtime.ts | 2 +- .../auth-choice.preferred-provider.test.ts | 30 +++---- .../channel-setup/plugin-install.test.ts | 16 ++-- .../workspace-shadow-bypass.test.ts | 14 ++-- ...re.gateway-auth.prompt-auth-config.test.ts | 38 ++++----- src/commands/daemon-install-helpers.test.ts | 20 ++--- src/commands/daemon-install-helpers.ts | 4 +- src/commands/doctor-auth-legacy-oauth.ts | 4 +- ...octor-auth.deprecated-cli-profiles.test.ts | 2 +- .../doctor-legacy-config.migrations.test.ts | 2 +- src/commands/doctor-plugin-manifests.ts | 4 +- ...te-migrations-yes-mode-without.e2e.test.ts | 14 ++-- .../shared/channel-plugin-blockers.test.ts | 24 +++--- .../doctor/shared/pristine-startup-state.ts | 4 +- .../doctor/shared/stale-plugin-config.test.ts | 6 +- src/commands/model-picker.runtime.ts | 12 +-- src/commands/models.list.e2e.test.ts | 10 +-- src/commands/models/auth.test.ts | 46 +++++----- src/commands/models/auth.ts | 8 +- src/commands/models/list.configured.test.ts | 2 +- .../list.list-command.forward-compat.test.ts | 2 +- src/commands/models/list.registry-load.ts | 4 +- src/commands/models/list.registry.ts | 6 +- src/commands/models/list.rows.test.ts | 6 +- src/commands/models/list.rows.ts | 4 +- src/commands/models/provider-aliases.ts | 4 +- src/commands/onboard-channels.e2e.test.ts | 8 +- .../auth-choice.plugin-providers.runtime.ts | 8 +- .../auth-choice.plugin-providers.test.ts | 34 ++++---- src/config/config.web-search-provider.test.ts | 2 +- src/config/doc-baseline.runtime.ts | 2 +- src/config/io.write-config.test.ts | 2 +- src/config/runtime-schema.test.ts | 2 +- src/config/sessions.ts | 2 +- src/config/sessions/session-accessor.entry.ts | 2 +- src/config/sessions/store-entry.ts | 2 +- .../validation.channel-metadata.test.ts | 2 +- .../isolated-agent.model-formatting.test.ts | 2 +- src/cron/isolated-agent/model-selection.ts | 8 +- .../run-model-selection.runtime.ts | 2 +- .../run.model-policy-config-preserved.test.ts | 4 +- src/cron/isolated-agent/run.test-harness.ts | 2 +- src/flows/doctor-core-checks.runtime.test.ts | 40 ++++----- src/flows/doctor-core-checks.runtime.ts | 6 +- src/flows/provider-flow.runtime.ts | 2 +- src/flows/provider-flow.test.ts | 16 ++-- .../gateway-models.profiles.live.test.ts | 4 +- src/infra/heartbeat-runner-config.ts | 2 +- src/infra/heartbeat-summary.ts | 2 +- .../outbound/message-action-execution.ts | 2 +- src/infra/outbound/message-action-params.ts | 9 +- src/infra/outbound/message-action-routing.ts | 2 +- src/infra/outbound/message-action-runner.ts | 2 +- src/infra/outbound/message-action-send.ts | 2 +- src/infra/outbound/reply-payload-normalize.ts | 2 +- .../runner.vision-skip.test.ts | 4 +- src/plugin-sdk/inbound-reply-dispatch.ts | 4 +- src/plugin-sdk/plugin-test-runtime.ts | 2 +- src/plugin-sdk/provider-catalog-runtime.ts | 2 +- src/plugin-sdk/qa-runner-runtime.test.ts | 20 ++--- src/plugin-sdk/qa-runner-runtime.ts | 6 +- src/plugin-sdk/reply-payload.ts | 2 +- src/plugin-sdk/reply-runtime.ts | 2 +- src/plugin-sdk/session-store-runtime.ts | 2 +- .../plugin-registration-contract.ts | 4 +- src/plugins/bundle-commands.test.ts | 2 +- src/plugins/bundled-capability-runtime.ts | 4 +- .../capability-provider-runtime.test.ts | 74 ++++++++-------- src/plugins/channel-plugin-ids.test.ts | 14 ++-- src/plugins/config-contracts.test.ts | 2 +- src/plugins/config-contracts.ts | 7 +- src/plugins/config-normalization-shared.ts | 2 +- src/plugins/config-policy.ts | 2 +- src/plugins/config-state.ts | 4 +- .../contracts/plugin-entry-guardrails.test.ts | 4 +- .../contracts/registry.contract.test.ts | 8 +- src/plugins/contracts/registry.ts | 4 +- .../test-helpers/bundled-plugin-roots.ts | 4 +- src/plugins/discovery-threading.test.ts | 8 +- src/plugins/discovery.test.ts | 14 ++-- src/plugins/gateway-startup-plugin-config.ts | 4 +- src/plugins/install-persistence.ts | 4 +- src/plugins/installed-plugin-index.ts | 7 +- src/plugins/loader-discovery.ts | 4 +- src/plugins/loader.base.test-utils.ts | 8 +- .../loader.hooks-and-runtime.test-utils.ts | 4 +- src/plugins/manifest-registry-installed.ts | 4 +- src/plugins/manifest-registry.test.ts | 84 ++++++++++--------- src/plugins/manifest-registry.ts | 4 +- src/plugins/plugin-registry-contributions.ts | 4 +- src/plugins/provider-auth-choice.runtime.ts | 17 ++-- .../provider-discovery.runtime.test.ts | 58 ++++++------- src/plugins/provider-discovery.runtime.ts | 12 +-- src/plugins/provider-hook-runtime.ts | 4 +- src/plugins/provider-public-artifacts.test.ts | 6 +- src/plugins/provider-public-artifacts.ts | 7 +- src/plugins/provider-runtime.test.ts | 4 +- .../provider-setup-availability.test.ts | 8 +- src/plugins/provider-setup-availability.ts | 4 +- src/plugins/provider-wizard.test.ts | 18 ++-- src/plugins/provider-wizard.ts | 12 +-- ...s.runtime.consult-current-snapshot.test.ts | 8 +- src/plugins/providers.runtime.ts | 8 +- src/plugins/providers.setup-trust.test.ts | 6 +- src/plugins/providers.test.ts | 9 +- src/plugins/runtime/index.test.ts | 10 +-- .../runtime/runtime-plugin-boundary.ts | 4 +- src/plugins/setup-registry.test.ts | 30 ++++--- src/plugins/setup-registry.ts | 2 +- .../stage-bundled-plugin-runtime.test.ts | 4 +- .../test-helpers/registry-jiti-mocks.ts | 2 +- .../web-fetch-providers.runtime.test.ts | 18 ++-- ...ublic-artifacts.explicit-fast-path.test.ts | 2 +- .../web-provider-public-artifacts.test.ts | 4 +- .../web-search-providers.runtime.test.ts | 2 +- src/secrets/configure.test.ts | 2 +- src/secrets/configure.ts | 4 +- src/secrets/provider-integrations.test.ts | 12 +-- src/secrets/resolve.manifest-registry.test.ts | 10 +-- src/secrets/resolve.ts | 4 +- src/secrets/target-registry.fast-path.test.ts | 2 +- ...it-channel-readonly-setup-fallback.test.ts | 4 +- src/security/audit-config-basics.test.ts | 32 +++---- ...t-control-ui-device-auth-migration.test.ts | 4 +- src/security/audit-extra.summary.ts | 4 +- src/security/audit-hooks-routing.test.ts | 14 ++-- .../audit-plugin-readonly-scope.test.ts | 14 ++-- src/security/audit-probe-failure.test.ts | 4 +- src/security/audit-rosterless.test.ts | 10 +-- src/security/audit.runtime.ts | 4 +- src/security/audit.test-support.ts | 6 +- src/security/audit.ts | 4 +- .../session-key-case-preservation.test.ts | 32 +++---- .../loading/workspace-skill-loader.test.ts | 2 +- src/skills/workshop/history-scan.ts | 4 +- src/system-agent/setup-inference-core.ts | 6 +- src/system-agent/setup-inference-detect.ts | 4 +- src/system-agent/setup-inference-plan.ts | 6 +- src/wizard/setup.model-auth.test.ts | 6 +- src/wizard/setup.model-auth.ts | 10 ++- src/wizard/setup.plugin-config.test.ts | 16 ++-- src/wizard/setup.test.ts | 2 +- .../check-session-accessor-boundary.test.ts | 2 + 206 files changed, 820 insertions(+), 834 deletions(-) diff --git a/docs/.generated/plugin-sdk-api-baseline/agent-harness-runtime.json b/docs/.generated/plugin-sdk-api-baseline/agent-harness-runtime.json index d1552a917e2a..4e39869c0d41 100644 --- a/docs/.generated/plugin-sdk-api-baseline/agent-harness-runtime.json +++ b/docs/.generated/plugin-sdk-api-baseline/agent-harness-runtime.json @@ -1 +1 @@ -{"contentHash":"8f8189612c59f0a57b65ebd310af811f64953e4b45271c4c62902f3fcfbd8537","entrypoint":"agent-harness-runtime","importSpecifier":"openclaw/plugin-sdk/agent-harness-runtime"} +{"contentHash":"c0e93e0c2140525841e84065e597ee7819420bda66d149d2f5df8e7810ccedf1","entrypoint":"agent-harness-runtime","importSpecifier":"openclaw/plugin-sdk/agent-harness-runtime"} diff --git a/docs/.generated/plugin-sdk-api-baseline/agent-harness.json b/docs/.generated/plugin-sdk-api-baseline/agent-harness.json index 4440e48f1aa5..284815423700 100644 --- a/docs/.generated/plugin-sdk-api-baseline/agent-harness.json +++ b/docs/.generated/plugin-sdk-api-baseline/agent-harness.json @@ -1 +1 @@ -{"contentHash":"b8a161ee64194146ccfadc417f27d39911eea97ee818538df86653d1a9f414cc","entrypoint":"agent-harness","importSpecifier":"openclaw/plugin-sdk/agent-harness"} +{"contentHash":"c299b664efaf168d481e2c793cab8f017c72d9cbf73dbfb08d01417c9ec66a19","entrypoint":"agent-harness","importSpecifier":"openclaw/plugin-sdk/agent-harness"} diff --git a/docs/.generated/plugin-sdk-api-baseline/channel-core.json b/docs/.generated/plugin-sdk-api-baseline/channel-core.json index e3b4ac7f1771..2e9a31338b05 100644 --- a/docs/.generated/plugin-sdk-api-baseline/channel-core.json +++ b/docs/.generated/plugin-sdk-api-baseline/channel-core.json @@ -1 +1 @@ -{"contentHash":"77f828ec162318163cf147fc99143fcafaf35cfd2e2654559fd14bd778ae43d9","entrypoint":"channel-core","importSpecifier":"openclaw/plugin-sdk/channel-core"} +{"contentHash":"1c9ffa868f6c5b56d2e2a8ceb067f7d2161760b44f3a2cfbc0f0ad6413c6fc08","entrypoint":"channel-core","importSpecifier":"openclaw/plugin-sdk/channel-core"} diff --git a/docs/.generated/plugin-sdk-api-baseline/channel-entry-contract.json b/docs/.generated/plugin-sdk-api-baseline/channel-entry-contract.json index 4fea49217272..65daf61f619c 100644 --- a/docs/.generated/plugin-sdk-api-baseline/channel-entry-contract.json +++ b/docs/.generated/plugin-sdk-api-baseline/channel-entry-contract.json @@ -1 +1 @@ -{"contentHash":"1d756f82df06f6ce77d5b4b1e3abfad6046ff49fed7641b3da206b60feb91404","entrypoint":"channel-entry-contract","importSpecifier":"openclaw/plugin-sdk/channel-entry-contract"} +{"contentHash":"a569ac63b0cc0ae29e23246a265e1a31bf56d6700d6e934ce917730b6cc5f969","entrypoint":"channel-entry-contract","importSpecifier":"openclaw/plugin-sdk/channel-entry-contract"} diff --git a/docs/.generated/plugin-sdk-api-baseline/channel-message.json b/docs/.generated/plugin-sdk-api-baseline/channel-message.json index 5cda4d94dc7b..38076e1a516b 100644 --- a/docs/.generated/plugin-sdk-api-baseline/channel-message.json +++ b/docs/.generated/plugin-sdk-api-baseline/channel-message.json @@ -1 +1 @@ -{"contentHash":"fe0b763f911c6f67d25d63b6fd0defe104bef798008f830ae0f6dbd013a79ff6","entrypoint":"channel-message","importSpecifier":"openclaw/plugin-sdk/channel-message"} +{"contentHash":"70fc7f09d590ed889662c78f320eb7d1d87627880084cbc5af1a5442576c1622","entrypoint":"channel-message","importSpecifier":"openclaw/plugin-sdk/channel-message"} diff --git a/docs/.generated/plugin-sdk-api-baseline/channel-outbound.json b/docs/.generated/plugin-sdk-api-baseline/channel-outbound.json index a5c4df338907..1a78b6d2ae10 100644 --- a/docs/.generated/plugin-sdk-api-baseline/channel-outbound.json +++ b/docs/.generated/plugin-sdk-api-baseline/channel-outbound.json @@ -1 +1 @@ -{"contentHash":"d8f4fbf15031d5731596db8f48d15d28c2522e6d563ab0bd7fa41f4908c53314","entrypoint":"channel-outbound","importSpecifier":"openclaw/plugin-sdk/channel-outbound"} +{"contentHash":"9763e0d262d42c5c3d8a938fa7a0b34853c48355c84a6556af283523c35ce250","entrypoint":"channel-outbound","importSpecifier":"openclaw/plugin-sdk/channel-outbound"} diff --git a/docs/.generated/plugin-sdk-api-baseline/channel-plugin-common.json b/docs/.generated/plugin-sdk-api-baseline/channel-plugin-common.json index 1898fbf1097e..ce4e1901e5e0 100644 --- a/docs/.generated/plugin-sdk-api-baseline/channel-plugin-common.json +++ b/docs/.generated/plugin-sdk-api-baseline/channel-plugin-common.json @@ -1 +1 @@ -{"contentHash":"386c6006608513ffa9c458b1ab085c5b3ca3df953b8cd09cdc17846b8f616aa6","entrypoint":"channel-plugin-common","importSpecifier":"openclaw/plugin-sdk/channel-plugin-common"} +{"contentHash":"1034e6d720b32c0db92a56e02ff10c2d6f790976afb7d5332d548f5eba16321c","entrypoint":"channel-plugin-common","importSpecifier":"openclaw/plugin-sdk/channel-plugin-common"} diff --git a/docs/.generated/plugin-sdk-api-baseline/core.json b/docs/.generated/plugin-sdk-api-baseline/core.json index d43b4526941c..68e3515f928e 100644 --- a/docs/.generated/plugin-sdk-api-baseline/core.json +++ b/docs/.generated/plugin-sdk-api-baseline/core.json @@ -1 +1 @@ -{"contentHash":"a501e9c9f95cda7027f83d52c7b4b95153531cc24540f0e6803435e75def6153","entrypoint":"core","importSpecifier":"openclaw/plugin-sdk/core"} +{"contentHash":"ba196a3b1b0ad6f2a8ca074bce4f4dca36e67f48c8f8a3ee77bd2586a1a24b45","entrypoint":"core","importSpecifier":"openclaw/plugin-sdk/core"} diff --git a/docs/.generated/plugin-sdk-api-baseline/discord.json b/docs/.generated/plugin-sdk-api-baseline/discord.json index f7a44026510f..821b8df01388 100644 --- a/docs/.generated/plugin-sdk-api-baseline/discord.json +++ b/docs/.generated/plugin-sdk-api-baseline/discord.json @@ -1 +1 @@ -{"contentHash":"ceca2545902bcea34a836763afef76c9b55bd0fa639cceb89b7122c0f7c6027a","entrypoint":"discord","importSpecifier":"openclaw/plugin-sdk/discord"} +{"contentHash":"e93dde148be09b57b1a2f879fe5008768c41e15885b6ce6a898e0465f78fec68","entrypoint":"discord","importSpecifier":"openclaw/plugin-sdk/discord"} diff --git a/docs/.generated/plugin-sdk-api-baseline/inbound-envelope.json b/docs/.generated/plugin-sdk-api-baseline/inbound-envelope.json index 26a18b0ea856..7f7dcead67a0 100644 --- a/docs/.generated/plugin-sdk-api-baseline/inbound-envelope.json +++ b/docs/.generated/plugin-sdk-api-baseline/inbound-envelope.json @@ -1 +1 @@ -{"contentHash":"a6537713e63d101897ef9ddfeaae438a50645e2672be5bdced887c4e8a651b96","entrypoint":"inbound-envelope","importSpecifier":"openclaw/plugin-sdk/inbound-envelope"} +{"contentHash":"c6090ec8881419039edee8e497a6e59524ab6bef3014aa9336f8d43a0816ec35","entrypoint":"inbound-envelope","importSpecifier":"openclaw/plugin-sdk/inbound-envelope"} diff --git a/docs/.generated/plugin-sdk-api-baseline/inbound-reply-dispatch.json b/docs/.generated/plugin-sdk-api-baseline/inbound-reply-dispatch.json index 37df5967b740..0f82a976c46d 100644 --- a/docs/.generated/plugin-sdk-api-baseline/inbound-reply-dispatch.json +++ b/docs/.generated/plugin-sdk-api-baseline/inbound-reply-dispatch.json @@ -1 +1 @@ -{"contentHash":"3e853390cc6efef245c9c220512fca49d2f8812abf1968e302c48e48b223d633","entrypoint":"inbound-reply-dispatch","importSpecifier":"openclaw/plugin-sdk/inbound-reply-dispatch"} +{"contentHash":"2ce7ba8b43211c18c309837f71105b66b915c7f7cd6a63d892071919d1a1e161","entrypoint":"inbound-reply-dispatch","importSpecifier":"openclaw/plugin-sdk/inbound-reply-dispatch"} diff --git a/docs/.generated/plugin-sdk-api-baseline/meeting-runtime.json b/docs/.generated/plugin-sdk-api-baseline/meeting-runtime.json index 13a574cda87c..aeb5dff4ffc7 100644 --- a/docs/.generated/plugin-sdk-api-baseline/meeting-runtime.json +++ b/docs/.generated/plugin-sdk-api-baseline/meeting-runtime.json @@ -1 +1 @@ -{"contentHash":"35904f50b6b6826386c774052cf3ab38a07a5ccabbd264237c1ce0bd5f1275c8","entrypoint":"meeting-runtime","importSpecifier":"openclaw/plugin-sdk/meeting-runtime"} +{"contentHash":"bebd31387941500e192e07e3f38b20ad389c7641db7f2a08615915019067aeef","entrypoint":"meeting-runtime","importSpecifier":"openclaw/plugin-sdk/meeting-runtime"} diff --git a/docs/.generated/plugin-sdk-api-baseline/plugin-entry.json b/docs/.generated/plugin-sdk-api-baseline/plugin-entry.json index a52cc293e5e3..57037212fc0f 100644 --- a/docs/.generated/plugin-sdk-api-baseline/plugin-entry.json +++ b/docs/.generated/plugin-sdk-api-baseline/plugin-entry.json @@ -1 +1 @@ -{"contentHash":"3e7a63e4f1d24dd6a2af9b7c5fd47837781471f5d92cdc1ba15f079259617402","entrypoint":"plugin-entry","importSpecifier":"openclaw/plugin-sdk/plugin-entry"} +{"contentHash":"eeb102db0465d7f4e0bc12a6aa6dc877faf429304e2670ff51a60f5d5d011124","entrypoint":"plugin-entry","importSpecifier":"openclaw/plugin-sdk/plugin-entry"} diff --git a/docs/.generated/plugin-sdk-api-baseline/plugin-runtime.json b/docs/.generated/plugin-sdk-api-baseline/plugin-runtime.json index c428f5492a5f..dec8f06e2105 100644 --- a/docs/.generated/plugin-sdk-api-baseline/plugin-runtime.json +++ b/docs/.generated/plugin-sdk-api-baseline/plugin-runtime.json @@ -1 +1 @@ -{"contentHash":"7f5d4e9c2f0593f433cb06c9acbca4c7a683e7d097d8f11304450076a7deb6e7","entrypoint":"plugin-runtime","importSpecifier":"openclaw/plugin-sdk/plugin-runtime"} +{"contentHash":"a57d78253ac4d40bc7933506ff65699c4f34e544cc3b107fe6bc29d58e586ad5","entrypoint":"plugin-runtime","importSpecifier":"openclaw/plugin-sdk/plugin-runtime"} diff --git a/docs/.generated/plugin-sdk-api-baseline/provider-catalog-runtime.json b/docs/.generated/plugin-sdk-api-baseline/provider-catalog-runtime.json index 02f173e9c434..d516fe10450a 100644 --- a/docs/.generated/plugin-sdk-api-baseline/provider-catalog-runtime.json +++ b/docs/.generated/plugin-sdk-api-baseline/provider-catalog-runtime.json @@ -1 +1 @@ -{"contentHash":"43d1e66a594b093ebd63d48de2a17900eef743404ef10068735a2aa8f2900f9f","entrypoint":"provider-catalog-runtime","importSpecifier":"openclaw/plugin-sdk/provider-catalog-runtime"} +{"contentHash":"42aa8fb549aac34c624ee63bc948f28cb8e732b256b72745617cca2e431e84be","entrypoint":"provider-catalog-runtime","importSpecifier":"openclaw/plugin-sdk/provider-catalog-runtime"} diff --git a/docs/.generated/plugin-sdk-api-baseline/reply-runtime.json b/docs/.generated/plugin-sdk-api-baseline/reply-runtime.json index 64095350220a..d64e541ab2dc 100644 --- a/docs/.generated/plugin-sdk-api-baseline/reply-runtime.json +++ b/docs/.generated/plugin-sdk-api-baseline/reply-runtime.json @@ -1 +1 @@ -{"contentHash":"cb54b3d858974c81cc1bd07e0a72b543e7f0a47f3751bd0a287c2f97bbb2b9ac","entrypoint":"reply-runtime","importSpecifier":"openclaw/plugin-sdk/reply-runtime"} +{"contentHash":"07a6384bfd57e2e318fc5195a74a52d81fc1deb05ec7e6ae770bdd819562975d","entrypoint":"reply-runtime","importSpecifier":"openclaw/plugin-sdk/reply-runtime"} diff --git a/docs/.generated/plugin-sdk-api-baseline/tool-plugin.json b/docs/.generated/plugin-sdk-api-baseline/tool-plugin.json index 678fb91d6252..37f6f29c8f43 100644 --- a/docs/.generated/plugin-sdk-api-baseline/tool-plugin.json +++ b/docs/.generated/plugin-sdk-api-baseline/tool-plugin.json @@ -1 +1 @@ -{"contentHash":"cc7dd850ee1af91876e83827b5087c1374328f8eb7b9d559c5df7e34695663e2","entrypoint":"tool-plugin","importSpecifier":"openclaw/plugin-sdk/tool-plugin"} +{"contentHash":"a4c9dd4fa12d108bb4b54b97201b582185e480de592441391f273c2c92521135","entrypoint":"tool-plugin","importSpecifier":"openclaw/plugin-sdk/tool-plugin"} diff --git a/docs/.generated/plugin-sdk-api-baseline/webhook-ingress.json b/docs/.generated/plugin-sdk-api-baseline/webhook-ingress.json index cf52992d7f0a..04fef9f1b23b 100644 --- a/docs/.generated/plugin-sdk-api-baseline/webhook-ingress.json +++ b/docs/.generated/plugin-sdk-api-baseline/webhook-ingress.json @@ -1 +1 @@ -{"contentHash":"6c157ca687f5bf384fcf526ca2465f85b27e3bedba0bde3c8ecf1e4060ddcd5d","entrypoint":"webhook-ingress","importSpecifier":"openclaw/plugin-sdk/webhook-ingress"} +{"contentHash":"f66eb413f310af3189604144311e441609e97bf1b745e617ec434c074c772a65","entrypoint":"webhook-ingress","importSpecifier":"openclaw/plugin-sdk/webhook-ingress"} diff --git a/scripts/check-session-accessor-boundary.mts b/scripts/check-session-accessor-boundary.mts index c504cbe47305..6d1785a591b8 100644 --- a/scripts/check-session-accessor-boundary.mts +++ b/scripts/check-session-accessor-boundary.mts @@ -21,6 +21,7 @@ const legacyReaderNames = new Set([ "readSessionStoreReadOnly", "readSessionStoreSnapshot", "resolveSessionStoreEntry", + "resolveSessionStoreEntryCore", ]); const legacyWholeStoreAccessNames = new Set([ ...legacyReaderNames, diff --git a/scripts/lib/wrapper-shadowing-baseline.json b/scripts/lib/wrapper-shadowing-baseline.json index 1fd1b336f971..fe51488c7066 100644 --- a/scripts/lib/wrapper-shadowing-baseline.json +++ b/scripts/lib/wrapper-shadowing-baseline.json @@ -1,72 +1 @@ -[ - { - "name": "loadPluginManifestRegistry", - "wrapped": "src/plugins/manifest-registry.ts", - "wrapper": "src/config/doc-baseline.runtime.ts" - }, - { - "name": "normalizeOutboundReplyPayload", - "wrapped": "src/infra/outbound/reply-payload-normalize.ts", - "wrapper": "src/plugin-sdk/reply-payload.ts" - }, - { - "name": "normalizePluginsConfigWithResolver", - "wrapped": "src/plugins/config-normalization-shared.ts", - "wrapper": "src/plugins/config-policy.ts" - }, - { - "name": "pruneStaleCommandPolls", - "wrapped": "src/agents/command-poll-backoff.ts", - "wrapper": "src/agents/command-poll-backoff.runtime.ts" - }, - { - "name": "readBooleanParam", - "wrapped": "src/plugin-sdk/boolean-param.ts", - "wrapper": "src/infra/outbound/message-action-params.ts" - }, - { - "name": "resolveAllowedModelRef", - "wrapped": "src/agents/model-selection-resolve.ts", - "wrapper": "src/agents/model-selection.ts" - }, - { - "name": "resolvePluginProviders", - "wrapped": "src/plugins/providers.runtime.ts", - "wrapper": "src/plugins/provider-auth-choice.runtime.ts" - }, - { - "name": "resolvePluginSetupProvider", - "wrapped": "src/plugins/setup-registry.ts", - "wrapper": "src/plugins/provider-auth-choice.runtime.ts" - }, - { - "name": "resolveProviderPluginChoice", - "wrapped": "src/plugins/provider-wizard.ts", - "wrapper": "src/plugins/provider-auth-choice.runtime.ts" - }, - { - "name": "resolveSessionKeyForRequest", - "wrapped": "src/agents/command/session.ts", - "wrapper": "src/commands/agent/session.runtime.ts" - }, - { - "name": "resolveSessionStoreEntry", - "wrapped": "src/config/sessions/store-entry.ts", - "wrapper": "src/plugin-sdk/session-store-runtime.ts" - }, - { - "name": "runProviderModelSelectedHook", - "wrapped": "src/plugins/provider-wizard.ts", - "wrapper": "src/plugins/provider-auth-choice.runtime.ts" - }, - { - "name": "runSecurityAudit", - "wrapped": "src/security/audit.ts", - "wrapper": "src/security/audit.runtime.ts" - }, - { - "name": "shouldSuppressBuiltInModel", - "wrapped": "src/agents/model-suppression.ts", - "wrapper": "src/agents/model-suppression.runtime.ts" - } -] +[] diff --git a/src/agents/codex-app-server.extensions.test.ts b/src/agents/codex-app-server.extensions.test.ts index a66aa156e6fd..eda52ec0259e 100644 --- a/src/agents/codex-app-server.extensions.test.ts +++ b/src/agents/codex-app-server.extensions.test.ts @@ -266,7 +266,7 @@ export default { id: "tool-result-middleware", register(api) { expect(listAgentToolResultMiddlewares("codex")).toHaveLength(0); const manifestRegistry = await import("../plugins/manifest-registry.js"); - const manifestSpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistry"); + const manifestSpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore"); // Startup activation stays false here; the runner must load the owner only // when Codex asks for the middleware runtime. diff --git a/src/agents/command-poll-backoff.runtime.ts b/src/agents/command-poll-backoff.runtime.ts index ba22543a6ca1..be9244157a6e 100644 --- a/src/agents/command-poll-backoff.runtime.ts +++ b/src/agents/command-poll-backoff.runtime.ts @@ -1,9 +1,9 @@ /** * Runtime seam for command poll backoff cleanup. */ -import { pruneStaleCommandPolls as pruneStaleCommandPollsImpl } from "./command-poll-backoff.js"; +import { pruneStaleCommandPollsCore as pruneStaleCommandPollsImpl } from "./command-poll-backoff.js"; -type PruneStaleCommandPolls = typeof import("./command-poll-backoff.js").pruneStaleCommandPolls; +type PruneStaleCommandPolls = typeof import("./command-poll-backoff.js").pruneStaleCommandPollsCore; /** Prune stale command polls using the production backoff implementation. */ export function pruneStaleCommandPolls( diff --git a/src/agents/command-poll-backoff.test.ts b/src/agents/command-poll-backoff.test.ts index c3b8d34f21ba..26920569f832 100644 --- a/src/agents/command-poll-backoff.test.ts +++ b/src/agents/command-poll-backoff.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import type { SessionState } from "../logging/diagnostic-session-state.js"; import { - pruneStaleCommandPolls, + pruneStaleCommandPollsCore, recordCommandPoll, resetCommandPollCount, } from "./command-poll-backoff.js"; @@ -110,7 +110,7 @@ describe("command-poll-backoff", () => { ]), }; - pruneStaleCommandPolls(state, 3600000); + pruneStaleCommandPollsCore(state, 3600000); expect(state.commandPollCounts?.has("cmd-old")).toBe(false); expect(state.commandPollCounts?.has("cmd-new")).toBe(true); @@ -123,7 +123,7 @@ describe("command-poll-backoff", () => { queueDepth: 0, }; - pruneStaleCommandPolls(state); + pruneStaleCommandPollsCore(state); expect(state.commandPollCounts).toBeUndefined(); }); }); diff --git a/src/agents/command-poll-backoff.ts b/src/agents/command-poll-backoff.ts index 7518ae36a73a..4dcd17fb55df 100644 --- a/src/agents/command-poll-backoff.ts +++ b/src/agents/command-poll-backoff.ts @@ -56,7 +56,7 @@ export function resetCommandPollCount(state: SessionState, commandId: string): v * Prune stale command poll records (older than 1 hour). * Call periodically to prevent memory bloat. */ -export function pruneStaleCommandPolls(state: SessionState, maxAgeMs = 3600000): void { +export function pruneStaleCommandPollsCore(state: SessionState, maxAgeMs = 3600000): void { if (!state.commandPollCounts) { return; } diff --git a/src/agents/command/session.resolve-session-key.test.ts b/src/agents/command/session.resolve-session-key.test.ts index 84b56226dba7..8423186e6201 100644 --- a/src/agents/command/session.resolve-session-key.test.ts +++ b/src/agents/command/session.resolve-session-key.test.ts @@ -33,7 +33,7 @@ vi.mock("../agent-scope.js", () => ({ resolveDefaultAgentId: () => "main", })); -const { resolveSessionKeyForRequest, resolveStoredSessionKeyForSessionId } = +const { resolveSessionKeyForRequestCore, resolveStoredSessionKeyForSessionId } = await import("./session.js"); function mockSessionStores(storesByPath: Record>): void { @@ -51,7 +51,7 @@ function expectResolvedRequestSession(params: { sessionStore: Record; storePath: string; }): void { - const result = resolveSessionKeyForRequest({ + const result = resolveSessionKeyForRequestCore({ cfg: { session: { store: "/stores/{agentId}.json", @@ -151,7 +151,7 @@ describe("resolveSessionKeyForRequest", () => { "/stores/other.json": otherStore, }); - const result = resolveSessionKeyForRequest({ + const result = resolveSessionKeyForRequestCore({ cfg: { session: { store: "/stores/{agentId}.json", diff --git a/src/agents/command/session.ts b/src/agents/command/session.ts index 6c50fed30a99..7b867d674ef0 100644 --- a/src/agents/command/session.ts +++ b/src/agents/command/session.ts @@ -222,7 +222,7 @@ export function resolveStoredSessionKeyForSessionId(opts: { } /** Resolves the session key/store targeted by one command request. */ -export function resolveSessionKeyForRequest(opts: { +export function resolveSessionKeyForRequestCore(opts: { cfg: OpenClawConfig; to?: string; sessionId?: string; @@ -330,7 +330,7 @@ export function resolveSession(opts: { clone?: boolean; }): SessionResolution { const sessionCfg = opts.cfg.session; - const { sessionKey, sessionStore, storePath } = resolveSessionKeyForRequest({ + const { sessionKey, sessionStore, storePath } = resolveSessionKeyForRequestCore({ cfg: opts.cfg, to: opts.to, sessionId: opts.sessionId, diff --git a/src/agents/embedded-agent-runner.e2e.test.ts b/src/agents/embedded-agent-runner.e2e.test.ts index 782e56143abd..6542cf2d99a7 100644 --- a/src/agents/embedded-agent-runner.e2e.test.ts +++ b/src/agents/embedded-agent-runner.e2e.test.ts @@ -116,7 +116,7 @@ const installRunEmbeddedMocks = () => { await vi.importActual("./command/session.js"); return { ...actual, - resolveSessionKeyForRequest: (opts: unknown) => resolveSessionKeyForRequestMock(opts), + resolveSessionKeyForRequestCore: (opts: unknown) => resolveSessionKeyForRequestMock(opts), resolveStoredSessionKeyForSessionId: (opts: unknown) => resolveStoredSessionKeyForSessionIdMock(opts), }; diff --git a/src/agents/embedded-agent-runner/model.configured-overrides.ts b/src/agents/embedded-agent-runner/model.configured-overrides.ts index 4666b51bbd3f..979c5cc7bb26 100644 --- a/src/agents/embedded-agent-runner/model.configured-overrides.ts +++ b/src/agents/embedded-agent-runner/model.configured-overrides.ts @@ -8,7 +8,10 @@ import type { ProviderRuntimeModel } from "../../plugins/provider-runtime-model. import { resolveCatalogOwnedModelCompat } from "../model-compat-catalog.js"; import { modelKey, normalizeStaticProviderModelId } from "../model-ref-shared.js"; import { findNormalizedProviderValue, normalizeProviderId } from "../model-selection.js"; -import { shouldSuppressBuiltInModel, shouldUnconditionallySuppress } from "../model-suppression.js"; +import { + shouldSuppressBuiltInModelCore, + shouldUnconditionallySuppress, +} from "../model-suppression.js"; import { attachModelProviderLocalService } from "../provider-local-service.js"; import { attachModelProviderMetadataOwners, @@ -70,7 +73,7 @@ export function shouldSuppressConfiguredModel(params: { ) { return false; } - return shouldSuppressBuiltInModel({ + return shouldSuppressBuiltInModelCore({ provider: params.provider, id: params.modelId, ...(params.cfg ? { config: params.cfg } : {}), diff --git a/src/agents/embedded-agent-runner/model.forward-compat.errors-and-overrides.test.ts b/src/agents/embedded-agent-runner/model.forward-compat.errors-and-overrides.test.ts index 908edb2a951f..fd9597e38f06 100644 --- a/src/agents/embedded-agent-runner/model.forward-compat.errors-and-overrides.test.ts +++ b/src/agents/embedded-agent-runner/model.forward-compat.errors-and-overrides.test.ts @@ -45,7 +45,7 @@ vi.mock("./model.static-catalog.js", () => ({ })); vi.mock("../model-suppression.js", () => ({ - shouldSuppressBuiltInModel: ({ + shouldSuppressBuiltInModelCore: ({ provider, id, baseUrl, diff --git a/src/agents/embedded-agent-runner/model.manifest-alias.ts b/src/agents/embedded-agent-runner/model.manifest-alias.ts index 488a094358b5..50fecc623dd3 100644 --- a/src/agents/embedded-agent-runner/model.manifest-alias.ts +++ b/src/agents/embedded-agent-runner/model.manifest-alias.ts @@ -11,7 +11,7 @@ import { isBundledManifestOwner, } from "../../plugins/manifest-owner-policy.js"; import { - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, type PluginManifestRecord, } from "../../plugins/manifest-registry.js"; import { staticModelIdMatches } from "./model.static-id.js"; @@ -310,7 +310,7 @@ export function resolveManifestModelCatalogProviderAliasMetadata(params: { : undefined; const plugins = currentPlugins ?? - loadPluginManifestRegistry({ + loadPluginManifestRegistryCore({ config: params.cfg, workspaceDir: params.workspaceDir, env, diff --git a/src/agents/embedded-agent-runner/model.registry-resolution.ts b/src/agents/embedded-agent-runner/model.registry-resolution.ts index 0625d8c45e23..f19b7a7c3c2d 100644 --- a/src/agents/embedded-agent-runner/model.registry-resolution.ts +++ b/src/agents/embedded-agent-runner/model.registry-resolution.ts @@ -7,7 +7,10 @@ import type { AuthProfileCredential } from "../auth-profiles/types.js"; import { resolveAgentHarnessPolicy } from "../harness/policy.js"; import { normalizeStaticProviderModelId } from "../model-ref-shared.js"; import { normalizeProviderId } from "../model-selection.js"; -import { shouldSuppressBuiltInModel, shouldUnconditionallySuppress } from "../model-suppression.js"; +import { + shouldSuppressBuiltInModelCore, + shouldUnconditionallySuppress, +} from "../model-suppression.js"; import { listOpenAIAuthProfileProvidersForAgentRuntime } from "../openai-routing.js"; import { buildConfiguredFallbackModel } from "./model.configured-fallback.js"; import { @@ -142,7 +145,7 @@ export function resolveExplicitModelWithRegistry(params: { : undefined; const effectiveBaseUrl = configuredBaseUrl ?? discoveredBaseUrl; if ( - shouldSuppressBuiltInModel({ + shouldSuppressBuiltInModelCore({ provider, id: modelId, ...(cfg ? { config: cfg } : {}), @@ -186,7 +189,7 @@ export function resolveExplicitModelWithRegistry(params: { return undefined; } if ( - shouldSuppressBuiltInModel({ + shouldSuppressBuiltInModelCore({ provider, id: modelId, ...(cfg ? { config: cfg } : {}), diff --git a/src/agents/embedded-agent-runner/model.static-catalog.prepared.test.ts b/src/agents/embedded-agent-runner/model.static-catalog.prepared.test.ts index da5c732a100d..fe9e9217706d 100644 --- a/src/agents/embedded-agent-runner/model.static-catalog.prepared.test.ts +++ b/src/agents/embedded-agent-runner/model.static-catalog.prepared.test.ts @@ -3,7 +3,7 @@ import type { PluginMetadataSnapshot } from "../../plugins/plugin-metadata-snaps import { getModelProviderMetadataOwners } from "../provider-request-config.js"; const mocks = vi.hoisted(() => ({ - loadPluginManifestRegistry: vi.fn(), + loadPluginManifestRegistryCore: vi.fn(), normalizePluginDiscoveryResult: vi.fn(), resolveActivatableProviderOwnerPluginIds: vi.fn(), resolveBundledProviderCompatPluginIds: vi.fn(), @@ -25,7 +25,7 @@ vi.mock("../../plugins/manifest-owner-policy.js", () => ({ })); vi.mock("../../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: mocks.loadPluginManifestRegistry, + loadPluginManifestRegistryCore: mocks.loadPluginManifestRegistryCore, })); vi.mock("../../plugins/manifest.js", () => ({ @@ -95,7 +95,7 @@ describe("prepared bundled provider static catalogs", () => { ); mocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google"]); mocks.resolveOwningPluginIdsForProviderRef.mockReturnValue(["google"]); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "google", @@ -260,7 +260,7 @@ describe("prepared bundled provider static catalogs", () => { it("discovers unconfigured providers when the full catalog is requested", async () => { mocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["anthropic", "google"]); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "anthropic", diff --git a/src/agents/embedded-agent-runner/model.static-catalog.snapshot-cache.test.ts b/src/agents/embedded-agent-runner/model.static-catalog.snapshot-cache.test.ts index 4b3485ed3367..32af752e82a1 100644 --- a/src/agents/embedded-agent-runner/model.static-catalog.snapshot-cache.test.ts +++ b/src/agents/embedded-agent-runner/model.static-catalog.snapshot-cache.test.ts @@ -5,7 +5,7 @@ const manifestMocks = vi.hoisted(() => ({ getCurrentPluginMetadataSnapshot: vi.fn(), listOpenClawPluginManifestMetadata: vi.fn(), loadPluginManifest: vi.fn(), - loadPluginManifestRegistry: vi.fn(), + loadPluginManifestRegistryCore: vi.fn(), })); const providerMocks = vi.hoisted(() => ({ normalizePluginDiscoveryResult: vi.fn(), @@ -31,7 +31,7 @@ vi.mock("../../plugins/manifest.js", async (importOriginal) => ({ vi.mock("../../plugins/manifest-registry.js", async (importOriginal) => ({ ...(await importOriginal()), - loadPluginManifestRegistry: manifestMocks.loadPluginManifestRegistry, + loadPluginManifestRegistryCore: manifestMocks.loadPluginManifestRegistryCore, })); vi.mock("../../plugins/providers.js", async (importOriginal) => ({ @@ -115,7 +115,7 @@ beforeEach(() => { mock.mockReset(); } manifestMocks.listOpenClawPluginManifestMetadata.mockReturnValue([]); - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ plugins: [] }); + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [] }); providerMocks.resolveActivatableProviderOwnerPluginIds.mockImplementation( ({ pluginIds }: { pluginIds: string[] }) => pluginIds, ); @@ -340,6 +340,6 @@ describe("bundled static model catalog snapshot cache", () => { await expect(loadBundledProviderStaticCatalogContextModels({ cfg })).resolves.toEqual([ expect.objectContaining({ provider: "google", contextWindow: 1_048_576 }), ]); - expect(manifestMocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(manifestMocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); }); }); diff --git a/src/agents/embedded-agent-runner/model.static-catalog.test.ts b/src/agents/embedded-agent-runner/model.static-catalog.test.ts index f8e5e85db7df..e83ad45359e3 100644 --- a/src/agents/embedded-agent-runner/model.static-catalog.test.ts +++ b/src/agents/embedded-agent-runner/model.static-catalog.test.ts @@ -5,7 +5,7 @@ const manifestMocks = vi.hoisted(() => ({ getCurrentPluginMetadataSnapshot: vi.fn(), listOpenClawPluginManifestMetadata: vi.fn(), loadPluginManifest: vi.fn(), - loadPluginManifestRegistry: vi.fn(), + loadPluginManifestRegistryCore: vi.fn(), })); const providerMocks = vi.hoisted(() => ({ normalizePluginDiscoveryResult: vi.fn(), @@ -31,7 +31,7 @@ vi.mock("../../plugins/manifest.js", async (importOriginal) => ({ vi.mock("../../plugins/manifest-registry.js", async (importOriginal) => ({ ...(await importOriginal()), - loadPluginManifestRegistry: manifestMocks.loadPluginManifestRegistry, + loadPluginManifestRegistryCore: manifestMocks.loadPluginManifestRegistryCore, })); vi.mock("../../plugins/providers.js", async (importOriginal) => ({ @@ -124,7 +124,7 @@ function createMistralManifestPlugin(overrides?: { } function setConflictingAzureAliasPlugins() { - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "openai", @@ -155,7 +155,7 @@ function setConflictingAzureAliasPlugins() { } function setConditionalSuppressionAliasPlugin(params?: { unconditional?: boolean }) { - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "conditional-provider", @@ -195,7 +195,7 @@ beforeEach(() => { manifestMocks.getCurrentPluginMetadataSnapshot.mockReset(); manifestMocks.listOpenClawPluginManifestMetadata.mockReset(); manifestMocks.loadPluginManifest.mockReset(); - manifestMocks.loadPluginManifestRegistry.mockReset(); + manifestMocks.loadPluginManifestRegistryCore.mockReset(); providerMocks.normalizePluginDiscoveryResult.mockReset(); providerMocks.resolveActivatableProviderOwnerPluginIds.mockReset(); providerMocks.resolveBundledProviderCompatPluginIds.mockReset(); @@ -204,7 +204,7 @@ beforeEach(() => { providerMocks.runProviderStaticCatalog.mockReset(); setManifestPlugins([]); manifestMocks.getCurrentPluginMetadataSnapshot.mockReturnValue(undefined); - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ plugins: [] }); + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [] }); providerMocks.resolveActivatableProviderOwnerPluginIds.mockImplementation( ({ pluginIds }: { pluginIds: string[] }) => pluginIds, ); @@ -217,7 +217,7 @@ beforeEach(() => { describe("canonicalizeManifestModelCatalogProviderAlias", () => { it("canonicalizes unambiguous manifest-owned aliases", () => { - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "moonshot", @@ -261,7 +261,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => { expect(canonicalizeManifestModelCatalogProviderAlias({ provider: "moonshot-ai" })).toBe( "moonshot", ); - expect(manifestMocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(manifestMocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); expect(manifestMocks.getCurrentPluginMetadataSnapshot).toHaveBeenLastCalledWith({ config: undefined, env: process.env, @@ -290,7 +290,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => { it("keeps custom environments on their own manifest registry context", () => { const env = { HOME: "/custom-home" }; manifestMocks.getCurrentPluginMetadataSnapshot.mockReturnValue({ plugins: [] }); - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "moonshot", @@ -310,7 +310,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => { "moonshot", ); expect(manifestMocks.getCurrentPluginMetadataSnapshot).not.toHaveBeenCalled(); - expect(manifestMocks.loadPluginManifestRegistry).toHaveBeenCalledWith({ + expect(manifestMocks.loadPluginManifestRegistryCore).toHaveBeenCalledWith({ config: undefined, env, workspaceDir: undefined, @@ -344,7 +344,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => { discovery: { openai: "runtime" }, }, }; - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ plugins: [plugin] }); + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [plugin] }); expectManifestAliasResolution( { @@ -473,7 +473,7 @@ describe("canonicalizeManifestModelCatalogProviderAlias", () => { }); it("accepts activated config-load-path alias owners", () => { - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "config-provider", @@ -661,7 +661,7 @@ describe("resolveBundledProviderStaticCatalogModel", () => { staticCatalog: { run: vi.fn() }, }; providerMocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google"]); - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ createManifestRecord("google", { providerDiscoverySource: "/fixtures/google/provider-discovery.ts", @@ -704,7 +704,7 @@ describe("resolveBundledProviderStaticCatalogModel", () => { it("skips bundled providers without discovery entries during context warmup", async () => { providerMocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google", "openai"]); - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "google", @@ -726,7 +726,7 @@ describe("resolveBundledProviderStaticCatalogModel", () => { it("keeps successful provider context rows when another static catalog fails", async () => { providerMocks.resolveBundledProviderCompatPluginIds.mockReturnValue(["google", "minimax"]); - manifestMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ createManifestRecord("google", { providerDiscoverySource: "/fixtures/google/provider-discovery.ts", diff --git a/src/agents/embedded-agent-runner/model.static-catalog.ts b/src/agents/embedded-agent-runner/model.static-catalog.ts index 0269a72a5735..a2938aae811c 100644 --- a/src/agents/embedded-agent-runner/model.static-catalog.ts +++ b/src/agents/embedded-agent-runner/model.static-catalog.ts @@ -10,7 +10,7 @@ import { normalizePluginsConfig } from "../../plugins/config-state.js"; import { getCurrentPluginMetadataSnapshot } from "../../plugins/current-plugin-metadata-snapshot.js"; import { listOpenClawPluginManifestMetadata } from "../../plugins/manifest-metadata-scan.js"; import { passesManifestOwnerBasePolicy } from "../../plugins/manifest-owner-policy.js"; -import { loadPluginManifestRegistry } from "../../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../../plugins/manifest-registry.js"; import { loadPluginManifest } from "../../plugins/manifest.js"; import type { PluginMetadataSnapshot } from "../../plugins/plugin-metadata-snapshot.types.js"; import { @@ -520,7 +520,7 @@ export async function loadBundledProviderStaticCatalogContextModels( const discoveryEntryPluginIds = new Set( ( metadataSnapshot?.manifestRegistry?.plugins ?? - loadPluginManifestRegistry({ + loadPluginManifestRegistryCore({ config: params.cfg, workspaceDir: params.workspaceDir, env, diff --git a/src/agents/embedded-agent-runner/model.test.ts b/src/agents/embedded-agent-runner/model.test.ts index 888bfc366abe..26ad6bbbec82 100644 --- a/src/agents/embedded-agent-runner/model.test.ts +++ b/src/agents/embedded-agent-runner/model.test.ts @@ -97,7 +97,7 @@ vi.mock("../model-suppression.js", () => { } return { - shouldSuppressBuiltInModel: ({ + shouldSuppressBuiltInModelCore: ({ provider, id, baseUrl, diff --git a/src/agents/embedded-agent-runner/run/session-bootstrap.ts b/src/agents/embedded-agent-runner/run/session-bootstrap.ts index 28e1b921d066..ea4d8d78f335 100644 --- a/src/agents/embedded-agent-runner/run/session-bootstrap.ts +++ b/src/agents/embedded-agent-runner/run/session-bootstrap.ts @@ -23,7 +23,7 @@ import { import { resolvePreferredSessionKeyForSessionIdMatches } from "../../../sessions/session-id-resolution.js"; import { resolveDefaultAgentId } from "../../agent-scope.js"; import { - resolveSessionKeyForRequest, + resolveSessionKeyForRequestCore, resolveStoredSessionKeyForSessionId, } from "../../command/session.js"; import { @@ -196,7 +196,7 @@ export function backfillSessionKey(params: { sessionId: params.sessionId, agentId: params.agentId, }) - : resolveSessionKeyForRequest({ + : resolveSessionKeyForRequestCore({ cfg: params.config, sessionId: params.sessionId, clone: false, diff --git a/src/agents/heartbeat-system-prompt.ts b/src/agents/heartbeat-system-prompt.ts index 01b7d8b42312..50f66d891962 100644 --- a/src/agents/heartbeat-system-prompt.ts +++ b/src/agents/heartbeat-system-prompt.ts @@ -5,7 +5,7 @@ import { normalizeOptionalString } from "@openclaw/normalization-core/string-coe import { DEFAULT_HEARTBEAT_EVERY, HEARTBEAT_CRON_TASK_GUIDANCE, - resolveHeartbeatPrompt as resolveHeartbeatPromptText, + resolveHeartbeatPromptCore as resolveHeartbeatPromptText, } from "../auto-reply/heartbeat.js"; import { parseDurationMs } from "../cli/parse-duration.js"; import type { AgentDefaultsConfig } from "../config/types.agent-defaults.js"; diff --git a/src/agents/model-auth-env.provider-aliases.test.ts b/src/agents/model-auth-env.provider-aliases.test.ts index 4fb1564fd746..b94c1501908a 100644 --- a/src/agents/model-auth-env.provider-aliases.test.ts +++ b/src/agents/model-auth-env.provider-aliases.test.ts @@ -39,7 +39,7 @@ const pluginMetadataMocks = vi.hoisted(() => { }); const setupRegistryMocks = vi.hoisted(() => ({ - resolvePluginSetupProvider: vi.fn(() => undefined), + resolvePluginSetupProviderCore: vi.fn(() => undefined), })); vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({ @@ -51,7 +51,7 @@ vi.mock("../plugins/plugin-metadata-snapshot.js", () => ({ })); vi.mock("../plugins/setup-registry.js", () => ({ - resolvePluginSetupProvider: setupRegistryMocks.resolvePluginSetupProvider, + resolvePluginSetupProviderCore: setupRegistryMocks.resolvePluginSetupProviderCore, })); describe("resolveEnvApiKey provider auth aliases", () => { @@ -62,8 +62,8 @@ describe("resolveEnvApiKey provider auth aliases", () => { ); pluginMetadataMocks.loadPluginMetadataSnapshot.mockReset(); pluginMetadataMocks.loadPluginMetadataSnapshot.mockReturnValue(pluginMetadataMocks.snapshot); - setupRegistryMocks.resolvePluginSetupProvider.mockReset(); - setupRegistryMocks.resolvePluginSetupProvider.mockReturnValue(undefined); + setupRegistryMocks.resolvePluginSetupProviderCore.mockReset(); + setupRegistryMocks.resolvePluginSetupProviderCore.mockReturnValue(undefined); }); it("reuses the current scoped metadata snapshot while resolving provider auth aliases", () => { @@ -100,7 +100,7 @@ describe("resolveEnvApiKey provider auth aliases", () => { // fallback must receive the same scope as metadata resolution. const config = {}; const env = {} as NodeJS.ProcessEnv; - setupRegistryMocks.resolvePluginSetupProvider.mockReturnValue({ + setupRegistryMocks.resolvePluginSetupProviderCore.mockReturnValue({ resolveConfigApiKey: () => "setup-secret", } as never); @@ -113,7 +113,7 @@ describe("resolveEnvApiKey provider auth aliases", () => { apiKey: "setup-secret", source: "env", }); - expect(setupRegistryMocks.resolvePluginSetupProvider).toHaveBeenCalledWith({ + expect(setupRegistryMocks.resolvePluginSetupProviderCore).toHaveBeenCalledWith({ provider: "setup-cloud", config, workspaceDir: "/workspace", @@ -135,7 +135,7 @@ describe("resolveEnvApiKey provider auth aliases", () => { ).toEqual({ mode: "api-key", source: "env: EXTERNAL_CLOUD_API_KEY" }); expect(pluginMetadataMocks.getCurrentPluginMetadataSnapshot).not.toHaveBeenCalled(); expect(pluginMetadataMocks.loadPluginMetadataSnapshot).not.toHaveBeenCalled(); - expect(setupRegistryMocks.resolvePluginSetupProvider).not.toHaveBeenCalled(); + expect(setupRegistryMocks.resolvePluginSetupProviderCore).not.toHaveBeenCalled(); }); it("retains setup-provider fallback as deferred planning evidence without loading it", () => { @@ -149,6 +149,6 @@ describe("resolveEnvApiKey provider auth aliases", () => { ).toEqual({ kind: "setup-provider", mode: "api-key", source: "setup provider" }); expect(pluginMetadataMocks.getCurrentPluginMetadataSnapshot).not.toHaveBeenCalled(); expect(pluginMetadataMocks.loadPluginMetadataSnapshot).not.toHaveBeenCalled(); - expect(setupRegistryMocks.resolvePluginSetupProvider).not.toHaveBeenCalled(); + expect(setupRegistryMocks.resolvePluginSetupProviderCore).not.toHaveBeenCalled(); }); }); diff --git a/src/agents/model-auth-env.ts b/src/agents/model-auth-env.ts index f36b025e3065..49ad272e609b 100644 --- a/src/agents/model-auth-env.ts +++ b/src/agents/model-auth-env.ts @@ -4,7 +4,7 @@ import { normalizeProviderIdForAuth } from "@openclaw/model-catalog-core/provider-id"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import { getShellEnvAppliedKeys } from "../infra/shell-env.js"; -import { resolvePluginSetupProvider } from "../plugins/setup-registry.js"; +import { resolvePluginSetupProviderCore } from "../plugins/setup-registry.js"; import { resolveLocalProviderAuthEvidence } from "../secrets/provider-auth-evidence.js"; import type { ProviderAuthEvidence } from "../secrets/provider-env-vars.js"; import { normalizeOptionalSecretInput } from "../utils/normalize-secret-input.js"; @@ -193,7 +193,7 @@ export function resolveEnvApiKey( return null; } - const setupProvider = resolvePluginSetupProvider({ + const setupProvider = resolvePluginSetupProviderCore({ provider: normalized, config: options.config, workspaceDir: options.workspaceDir, diff --git a/src/agents/model-auth.profiles.test.ts b/src/agents/model-auth.profiles.test.ts index 7b2f107c22a9..68219fef6d1a 100644 --- a/src/agents/model-auth.profiles.test.ts +++ b/src/agents/model-auth.profiles.test.ts @@ -71,7 +71,12 @@ function testModelDefinition(id: string): Model { vi.mock("../plugins/setup-registry.js", async () => { const { readFileSync } = await import("node:fs"); return { - resolvePluginSetupProvider: ({ provider }: { provider: string; env: NodeJS.ProcessEnv }) => { + resolvePluginSetupProviderCore: ({ + provider, + }: { + provider: string; + env: NodeJS.ProcessEnv; + }) => { if (provider !== "anthropic-vertex") { return undefined; } diff --git a/src/agents/model-auth.test.ts b/src/agents/model-auth.test.ts index b60ac72dcf5c..a08c1d9b337d 100644 --- a/src/agents/model-auth.test.ts +++ b/src/agents/model-auth.test.ts @@ -78,7 +78,7 @@ vi.mock("../plugins/providers.js", () => ({ })); vi.mock("../plugins/setup-registry.js", () => ({ - resolvePluginSetupProvider: () => undefined, + resolvePluginSetupProviderCore: () => undefined, })); vi.mock("../plugins/provider-runtime.js", () => { diff --git a/src/agents/model-selection-resolve.test.ts b/src/agents/model-selection-resolve.test.ts index d15cc1158a56..bb2cf5cb46ae 100644 --- a/src/agents/model-selection-resolve.test.ts +++ b/src/agents/model-selection-resolve.test.ts @@ -1,7 +1,10 @@ // Verifies configured model ref resolution and OpenRouter compatibility aliases. import { describe, expect, it } from "vitest"; import type { OpenClawConfig } from "../config/types.js"; -import { resolveAllowedModelRef, resolveConfiguredModelRef } from "./model-selection-resolve.js"; +import { + resolveAllowedModelRefCore, + resolveConfiguredModelRef, +} from "./model-selection-resolve.js"; describe("model-selection-resolve OpenRouter compat aliases", () => { it("keeps inherited policy aliases bound to default metadata for per-agent selection", () => { @@ -30,7 +33,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => { ]; expect( - resolveAllowedModelRef({ + resolveAllowedModelRefCore({ cfg, catalog, raw: "approved", @@ -39,7 +42,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => { }), ).toEqual({ error: "model not allowed: anthropic/claude-sonnet-4-6" }); expect( - resolveAllowedModelRef({ + resolveAllowedModelRefCore({ cfg, catalog, raw: "openai/gpt-5.5", @@ -75,7 +78,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => { ]; expect( - resolveAllowedModelRef({ + resolveAllowedModelRefCore({ cfg, catalog, raw: "approved", @@ -87,7 +90,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => { ref: { provider: "anthropic", model: "claude-sonnet-4-6" }, }); expect( - resolveAllowedModelRef({ + resolveAllowedModelRefCore({ cfg, catalog, raw: "openai/gpt-5.5", @@ -120,7 +123,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => { } as unknown as OpenClawConfig; expect( - resolveAllowedModelRef({ + resolveAllowedModelRefCore({ cfg, catalog: [], raw: "litellm/cron", @@ -172,7 +175,7 @@ describe("model-selection-resolve OpenRouter compat aliases", () => { ]; expect( - resolveAllowedModelRef({ + resolveAllowedModelRefCore({ cfg, catalog, raw: "openrouter:free", diff --git a/src/agents/model-selection-resolve.ts b/src/agents/model-selection-resolve.ts index 372a14ac95ab..b66c36696f48 100644 --- a/src/agents/model-selection-resolve.ts +++ b/src/agents/model-selection-resolve.ts @@ -64,7 +64,7 @@ export function getModelRefStatus( } /** Resolves a raw model string into an allowed model ref or an explanatory error. */ -export function resolveAllowedModelRef( +export function resolveAllowedModelRefCore( params: { cfg: OpenClawConfig; catalog: ModelCatalogEntry[]; diff --git a/src/agents/model-selection.test.ts b/src/agents/model-selection.test.ts index cb2d39b3dd4e..4ae0b809a751 100644 --- a/src/agents/model-selection.test.ts +++ b/src/agents/model-selection.test.ts @@ -6,7 +6,7 @@ import { createWarnLogCapture } from "../logging/test-helpers/warn-log-capture.j import { resolveAgentHarnessPolicy } from "./harness/policy.js"; import { getModelRefStatus as getNarrowModelRefStatus, - resolveAllowedModelRef as resolveNarrowAllowedModelRef, + resolveAllowedModelRefCore as resolveNarrowAllowedModelRef, } from "./model-selection-resolve.js"; import { isModelKeyAllowedBySet } from "./model-selection-shared.js"; import { diff --git a/src/agents/model-selection.ts b/src/agents/model-selection.ts index ebc3a3075c9d..47b7144bebf9 100644 --- a/src/agents/model-selection.ts +++ b/src/agents/model-selection.ts @@ -31,7 +31,7 @@ import { } from "./model-ref-shared.js"; import { findNormalizedProviderValue, parseModelRef } from "./model-selection-normalize.js"; import { - resolveAllowedModelRef as resolveAllowedModelRefInternal, + resolveAllowedModelRefCore as resolveAllowedModelRefInternal, resolveConfiguredModelFallbacks, } from "./model-selection-resolve.js"; import { diff --git a/src/agents/model-suppression.runtime.ts b/src/agents/model-suppression.runtime.ts index 62d4bf5af273..7e45d5cda8f9 100644 --- a/src/agents/model-suppression.runtime.ts +++ b/src/agents/model-suppression.runtime.ts @@ -5,11 +5,11 @@ */ import { buildShouldSuppressBuiltInModelCore, - shouldSuppressBuiltInModel as shouldSuppressBuiltInModelImpl, + shouldSuppressBuiltInModelCore as shouldSuppressBuiltInModelImpl, } from "./model-suppression.js"; type ShouldSuppressBuiltInModel = - typeof import("./model-suppression.js").shouldSuppressBuiltInModel; + typeof import("./model-suppression.js").shouldSuppressBuiltInModelCore; type BuildShouldSuppressBuiltInModel = typeof import("./model-suppression.js").buildShouldSuppressBuiltInModelCore; diff --git a/src/agents/model-suppression.test.ts b/src/agents/model-suppression.test.ts index cd9a251c476e..22401446c5d3 100644 --- a/src/agents/model-suppression.test.ts +++ b/src/agents/model-suppression.test.ts @@ -16,7 +16,7 @@ import { setCurrentPluginMetadataSnapshotState } from "../plugins/current-plugin import { clearPluginMetadataLifecycleCaches } from "../plugins/plugin-metadata-lifecycle.js"; import { buildShouldSuppressBuiltInModelCore, - shouldSuppressBuiltInModel, + shouldSuppressBuiltInModelCore, } from "./model-suppression.js"; const originalBundledPluginsDir = process.env.OPENCLAW_BUNDLED_PLUGINS_DIR; @@ -44,7 +44,7 @@ describe("model suppression", () => { mocks.buildManifestBuiltInModelSuppressionResolver.mockReturnValueOnce(resolver); expect( - shouldSuppressBuiltInModel({ + shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3-codex-spark", config, @@ -67,7 +67,7 @@ describe("model suppression", () => { mocks.buildManifestBuiltInModelSuppressionResolver.mockReturnValueOnce(resolver); expect( - shouldSuppressBuiltInModel({ + shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3-codex-spark", config: {}, @@ -82,8 +82,10 @@ describe("model suppression", () => { const config = {}; mocks.buildManifestBuiltInModelSuppressionResolver.mockReturnValueOnce(resolver); - expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false); - expect(shouldSuppressBuiltInModel({ provider: "anthropic", id: "claude-4", config })).toBe( + expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe( + false, + ); + expect(shouldSuppressBuiltInModelCore({ provider: "anthropic", id: "claude-4", config })).toBe( false, ); @@ -100,10 +102,14 @@ describe("model suppression", () => { .mockReturnValueOnce(secondResolver); setCurrentPluginMetadataSnapshotState({ id: "first" }, undefined); - expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false); + expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe( + false, + ); setCurrentPluginMetadataSnapshotState({ id: "second" }, undefined); - expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false); + expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe( + false, + ); expect(mocks.buildManifestBuiltInModelSuppressionResolver).toHaveBeenCalledTimes(2); expect(firstResolver).toHaveBeenCalledOnce(); @@ -119,10 +125,14 @@ describe("model suppression", () => { .mockReturnValueOnce(secondResolver); process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = "/tmp/openclaw-bundled-a"; - expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false); + expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe( + false, + ); process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = "/tmp/openclaw-bundled-b"; - expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false); + expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe( + false, + ); expect(mocks.buildManifestBuiltInModelSuppressionResolver).toHaveBeenCalledTimes(2); expect(firstResolver).toHaveBeenCalledOnce(); @@ -137,10 +147,14 @@ describe("model suppression", () => { .mockReturnValueOnce(firstResolver) .mockReturnValueOnce(secondResolver); - expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false); + expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe( + false, + ); config.plugins.load.paths = ["/tmp/openclaw-plugin-b"]; - expect(shouldSuppressBuiltInModel({ provider: "openai", id: "gpt-5.3", config })).toBe(false); + expect(shouldSuppressBuiltInModelCore({ provider: "openai", id: "gpt-5.3", config })).toBe( + false, + ); expect(mocks.buildManifestBuiltInModelSuppressionResolver).toHaveBeenCalledTimes(2); expect(firstResolver).toHaveBeenCalledOnce(); diff --git a/src/agents/model-suppression.ts b/src/agents/model-suppression.ts index e981b1bc5c7d..a07e649865b0 100644 --- a/src/agents/model-suppression.ts +++ b/src/agents/model-suppression.ts @@ -133,7 +133,7 @@ export function shouldSuppressBuiltInModelFromManifest(params: { } /** Return true when any built-in suppression rule applies to a model entry. */ -export function shouldSuppressBuiltInModel(params: { +export function shouldSuppressBuiltInModelCore(params: { provider?: string | null; id?: string | null; baseUrl?: string | null; diff --git a/src/agents/models-config.provider-policy-registry.test.ts b/src/agents/models-config.provider-policy-registry.test.ts index 6bf622bea457..3ab7ab56a466 100644 --- a/src/agents/models-config.provider-policy-registry.test.ts +++ b/src/agents/models-config.provider-policy-registry.test.ts @@ -56,7 +56,7 @@ beforeAll(async () => { const manifestRegistryModule = await import("../plugins/manifest-registry.js"); loadPluginManifestRegistrySpy = vi - .spyOn(manifestRegistryModule, "loadPluginManifestRegistry") + .spyOn(manifestRegistryModule, "loadPluginManifestRegistryCore") .mockReturnValue(manifestRegistry as never); const publicSurfaceLoader = await import("../plugins/public-surface-loader.js"); loadBundledPluginPublicArtifactModuleSyncSpy = vi diff --git a/src/agents/models-config.providers.moonshot.test.ts b/src/agents/models-config.providers.moonshot.test.ts index 9d4aefde0f35..f6c7ac5af61a 100644 --- a/src/agents/models-config.providers.moonshot.test.ts +++ b/src/agents/models-config.providers.moonshot.test.ts @@ -5,7 +5,7 @@ import { applyProviderNativeStreamingUsageCompat } from "../plugin-sdk/provider- import { resolveMissingProviderApiKey } from "./models-config.providers.secret-helpers.js"; vi.mock("../plugins/setup-registry.js", () => ({ - resolvePluginSetupProvider: () => undefined, + resolvePluginSetupProviderCore: () => undefined, })); vi.mock("../infra/shell-env.js", () => ({ diff --git a/src/agents/models-config.providers.nvidia.test.ts b/src/agents/models-config.providers.nvidia.test.ts index e0e0f2fc6742..fcb28b198852 100644 --- a/src/agents/models-config.providers.nvidia.test.ts +++ b/src/agents/models-config.providers.nvidia.test.ts @@ -8,7 +8,7 @@ import { } from "./models-config.providers.secret-helpers.js"; vi.mock("../plugins/setup-registry.js", () => ({ - resolvePluginSetupProvider: () => undefined, + resolvePluginSetupProviderCore: () => undefined, })); vi.mock("../infra/shell-env.js", () => ({ diff --git a/src/agents/models-config.runtime-source-snapshot.test.ts b/src/agents/models-config.runtime-source-snapshot.test.ts index 4d0240d2b1f0..1ff1596081f5 100644 --- a/src/agents/models-config.runtime-source-snapshot.test.ts +++ b/src/agents/models-config.runtime-source-snapshot.test.ts @@ -13,7 +13,7 @@ import { import { enforceSourceManagedProviderSecrets } from "./models-config.providers.source-managed.js"; vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: () => ({ plugins: [] }), + loadPluginManifestRegistryCore: () => ({ plugins: [] }), })); vi.mock("./model-auth-env-vars.js", () => ({ diff --git a/src/agents/models.profiles.live.test.ts b/src/agents/models.profiles.live.test.ts index 24cd4cbe3d84..d0148f337bae 100644 --- a/src/agents/models.profiles.live.test.ts +++ b/src/agents/models.profiles.live.test.ts @@ -53,7 +53,7 @@ import { requireApiKey, resolveUsableCustomProviderApiKey, } from "./model-auth.js"; -import { shouldSuppressBuiltInModel } from "./model-suppression.js"; +import { shouldSuppressBuiltInModelCore } from "./model-suppression.js"; import { ensureOpenClawModelsJson } from "./models-config.js"; import type { StreamFn } from "./runtime/index.js"; import { appendPrioritizedDynamicLiveModels } from "./test-helpers/live-model-dynamic-candidates.js"; @@ -1833,7 +1833,7 @@ describeLive("live models (profile keys)", () => { }> = []; for (const model of models) { - if (shouldSuppressBuiltInModel({ provider: model.provider, id: model.id })) { + if (shouldSuppressBuiltInModelCore({ provider: model.provider, id: model.id })) { continue; } if (!targetMatcher.matchesProvider(model.provider)) { diff --git a/src/agents/openclaw-tools.session-status.test.ts b/src/agents/openclaw-tools.session-status.test.ts index e915b3a18bce..070d283484d7 100644 --- a/src/agents/openclaw-tools.session-status.test.ts +++ b/src/agents/openclaw-tools.session-status.test.ts @@ -3,7 +3,7 @@ import { expectDefined } from "@openclaw/normalization-core"; import { Value } from "typebox/value"; import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import { resolveSessionStoreEntry } from "../config/sessions/store-entry.js"; +import { resolveSessionStoreEntryCore } from "../config/sessions/store-entry.js"; import { mergeSessionEntry, type SessionEntry } from "../config/sessions/types.js"; import { clearInternalHooks, @@ -129,7 +129,7 @@ function createSessionsModuleMock() { const storePath = scope.storePath ?? resolveMockStorePath(undefined, { agentId: scope.agentId }); const store = loadSessionStoreMock(storePath) as Record; - const resolved = resolveSessionStoreEntry({ store, sessionKey: scope.sessionKey }); + const resolved = resolveSessionStoreEntryCore({ store, sessionKey: scope.sessionKey }); const existing = resolved.existing ?? options?.fallbackEntry; if (!existing) { return null; @@ -160,7 +160,7 @@ function createSessionsModuleMock() { if (!candidateKey) { continue; } - const resolved = resolveSessionStoreEntry({ store, sessionKey: candidateKey }); + const resolved = resolveSessionStoreEntryCore({ store, sessionKey: candidateKey }); if (!resolved.existing) { continue; } @@ -346,7 +346,7 @@ vi.mock("../plugins/provider-thinking.js", () => ({ // session_status surface only needs model selection semantics here, not real // bundled provider registration. vi.mock("../plugins/providers.runtime.js", () => ({ - resolvePluginProviders: () => [], + resolvePluginProvidersCore: () => [], })); vi.mock("../agents/auth-profiles.js", createAuthProfilesModuleMock); vi.mock("../agents/model-auth.js", createModelAuthModuleMock); diff --git a/src/agents/runtime-plan/prepare-auth.setup-provider.test.ts b/src/agents/runtime-plan/prepare-auth.setup-provider.test.ts index bb53c3fa4155..0d0ae2b90879 100644 --- a/src/agents/runtime-plan/prepare-auth.setup-provider.test.ts +++ b/src/agents/runtime-plan/prepare-auth.setup-provider.test.ts @@ -19,7 +19,7 @@ const authLookupMocks = vi.hoisted(() => ({ })); const setupRegistryMocks = vi.hoisted(() => ({ - resolvePluginSetupProvider: vi.fn(() => ({ + resolvePluginSetupProviderCore: vi.fn(() => ({ resolveConfigApiKey: () => "gcp-vertex-credentials", })), })); @@ -31,7 +31,7 @@ vi.mock("../model-auth-env-vars.js", async (importOriginal) => ({ vi.mock("../../plugins/setup-registry.js", async (importOriginal) => ({ ...(await importOriginal()), - resolvePluginSetupProvider: setupRegistryMocks.resolvePluginSetupProvider, + resolvePluginSetupProviderCore: setupRegistryMocks.resolvePluginSetupProviderCore, })); describe("prepared setup-provider auth fallback", () => { @@ -61,7 +61,7 @@ describe("prepared setup-provider auth fallback", () => { authProfileStore: store, }); - expect(setupRegistryMocks.resolvePluginSetupProvider).not.toHaveBeenCalled(); + expect(setupRegistryMocks.resolvePluginSetupProviderCore).not.toHaveBeenCalled(); expect(prepared.attempts).toMatchObject([ { kind: "profile", profileId }, { @@ -104,6 +104,6 @@ describe("prepared setup-provider auth fallback", () => { source: "gcloud adc", mode: "api-key", }); - expect(setupRegistryMocks.resolvePluginSetupProvider).toHaveBeenCalledOnce(); + expect(setupRegistryMocks.resolvePluginSetupProviderCore).toHaveBeenCalledOnce(); }); }); diff --git a/src/auto-reply/heartbeat.ts b/src/auto-reply/heartbeat.ts index b4863abdc170..125997ad4d4b 100644 --- a/src/auto-reply/heartbeat.ts +++ b/src/auto-reply/heartbeat.ts @@ -106,7 +106,7 @@ export function isHeartbeatContentEffectivelyEmpty(content: string | undefined | } /** Resolves configured heartbeat prompt text with the built-in default fallback. */ -export function resolveHeartbeatPrompt(raw?: string): string { +export function resolveHeartbeatPromptCore(raw?: string): string { const trimmed = normalizeOptionalString(raw) ?? ""; return trimmed || HEARTBEAT_PROMPT; } diff --git a/src/auto-reply/reply/commands-session-store.ts b/src/auto-reply/reply/commands-session-store.ts index fad6b11a8308..6fdda28249d2 100644 --- a/src/auto-reply/reply/commands-session-store.ts +++ b/src/auto-reply/reply/commands-session-store.ts @@ -1,5 +1,5 @@ // Shared session-store helpers for command handlers that mutate sessions. -import { resolveSessionStoreEntry, type SessionEntry } from "../../config/sessions.js"; +import { resolveSessionStoreEntryCore, type SessionEntry } from "../../config/sessions.js"; import { patchSessionEntryCore } from "../../config/sessions/session-accessor.js"; import { sessionSnapshotChangesApplied } from "../../config/sessions/session-snapshot-merge.js"; import { applyAbortCutoffToSessionEntry, type AbortCutoff } from "./abort-cutoff.js"; @@ -25,7 +25,7 @@ export function resolveCommandSessionEntryForKey( if (!store || !sessionKey) { return {}; } - const resolved = resolveSessionStoreEntry({ store, sessionKey }); + const resolved = resolveSessionStoreEntryCore({ store, sessionKey }); if (!resolved.existing) { return {}; } diff --git a/src/channels/inbound-event/envelope.ts b/src/channels/inbound-event/envelope.ts index b9386473ed15..4de3096643b2 100644 --- a/src/channels/inbound-event/envelope.ts +++ b/src/channels/inbound-event/envelope.ts @@ -76,12 +76,12 @@ export function createInboundEnvelopeBuilder(params: { cfg: TConfig; route: RouteLike; sessionStore?: string; - resolveStorePath: (store: string | undefined, opts: { agentId: string }) => string; + resolveSessionStorePathCore: (store: string | undefined, opts: { agentId: string }) => string; readSessionUpdatedAt: (params: { storePath: string; sessionKey: string }) => number | undefined; resolveEnvelopeFormatOptions: (cfg: TConfig) => TEnvelope; formatAgentEnvelope: (params: InboundEnvelopeFormatParams) => string; }) { - const storePath = params.resolveStorePath(params.sessionStore, { + const storePath = params.resolveSessionStorePathCore(params.sessionStore, { agentId: params.route.agentId, }); const envelopeOptions = params.resolveEnvelopeFormatOptions(params.cfg); @@ -114,7 +114,7 @@ export function resolveInboundRouteEnvelopeBuilder< peer: TPeer; resolveAgentRoute: (params: InboundRouteResolveParams) => TRoute; sessionStore?: string; - resolveStorePath: (store: string | undefined, opts: { agentId: string }) => string; + resolveSessionStorePathCore: (store: string | undefined, opts: { agentId: string }) => string; readSessionUpdatedAt: (params: { storePath: string; sessionKey: string }) => number | undefined; resolveEnvelopeFormatOptions: (cfg: TConfig) => TEnvelope; formatAgentEnvelope: (params: InboundEnvelopeFormatParams) => string; @@ -132,7 +132,7 @@ export function resolveInboundRouteEnvelopeBuilder< cfg: params.cfg, route, sessionStore: params.sessionStore, - resolveStorePath: params.resolveStorePath, + resolveSessionStorePathCore: params.resolveSessionStorePathCore, readSessionUpdatedAt: params.readSessionUpdatedAt, resolveEnvelopeFormatOptions: params.resolveEnvelopeFormatOptions, formatAgentEnvelope: params.formatAgentEnvelope, @@ -183,7 +183,7 @@ export function resolveInboundRouteEnvelopeBuilderWithRuntime< peer: params.peer, resolveAgentRoute: (routeParams) => params.runtime.routing.resolveAgentRoute(routeParams), sessionStore: params.sessionStore, - resolveStorePath: params.runtime.session.resolveStorePath, + resolveSessionStorePathCore: params.runtime.session.resolveStorePath, readSessionUpdatedAt: params.runtime.session.readSessionUpdatedAt, resolveEnvelopeFormatOptions: params.runtime.reply.resolveEnvelopeFormatOptions, formatAgentEnvelope: params.runtime.reply.formatAgentEnvelope, diff --git a/src/channels/plugins/contracts/channel-import-guardrails.test.ts b/src/channels/plugins/contracts/channel-import-guardrails.test.ts index 2b663c939904..08afe30e2f1d 100644 --- a/src/channels/plugins/contracts/channel-import-guardrails.test.ts +++ b/src/channels/plugins/contracts/channel-import-guardrails.test.ts @@ -7,7 +7,7 @@ import { expectDefined } from "@openclaw/normalization-core"; import { describe, expect, it } from "vitest"; import { classifyBundledExtensionSourcePath } from "../../../../scripts/lib/extension-source-classifier.mts"; import { GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES } from "../../../plugin-sdk/test-helpers/public-artifacts.js"; -import { loadPluginManifestRegistry } from "../../../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../../../plugins/manifest-registry.js"; import { expectNoReaddirSyncDuring } from "../../../test-utils/fs-scan-assertions.js"; import { listGitTrackedFiles, @@ -20,7 +20,7 @@ const REPO_ROOT = resolve(ROOT_DIR, ".."); const ALLOWED_EXTENSION_PUBLIC_SURFACES = new Set(GUARDED_EXTENSION_PUBLIC_SURFACE_BASENAMES); ALLOWED_EXTENSION_PUBLIC_SURFACES.add("test-api.js"); const BUNDLED_PLUGIN_ROOT_DIR = "extensions"; -const bundledPluginRecords = loadPluginManifestRegistry({ +const bundledPluginRecords = loadPluginManifestRegistryCore({ config: {}, }).plugins.filter((plugin) => plugin.origin === "bundled"); const bundledPluginRoots = new Map( diff --git a/src/cli/plugins-cli-test-helpers.ts b/src/cli/plugins-cli-test-helpers.ts index 599507e17494..4831fd2f8358 100644 --- a/src/cli/plugins-cli-test-helpers.ts +++ b/src/cli/plugins-cli-test-helpers.ts @@ -418,7 +418,7 @@ vi.mock("../plugins/installed-plugin-index-store.js", async (importOriginal) => }); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: ((...args: unknown[]) => + loadPluginManifestRegistryCore: ((...args: unknown[]) => invokeMock(loadPluginManifestRegistryMock, ...args)) as ( ...args: unknown[] ) => unknown, diff --git a/src/cli/security-cli.test.ts b/src/cli/security-cli.test.ts index 75ef254a4785..b157cd6dc41a 100644 --- a/src/cli/security-cli.test.ts +++ b/src/cli/security-cli.test.ts @@ -8,7 +8,7 @@ const mocks = await vi.hoisted(async () => { const runtime = createCliRuntimeMock(vi); return { loadConfig: vi.fn(), - runSecurityAudit: vi.fn(), + runSecurityAuditCore: vi.fn(), fixSecurityFootguns: vi.fn(), resolveCommandSecretRefsViaGateway: vi.fn(), getSecurityAuditCommandSecretTargetIds: vi.fn( @@ -20,7 +20,7 @@ const mocks = await vi.hoisted(async () => { const { loadConfig, - runSecurityAudit, + runSecurityAuditCore, fixSecurityFootguns, resolveCommandSecretRefsViaGateway, getSecurityAuditCommandSecretTargetIds, @@ -37,7 +37,7 @@ vi.mock("../runtime.js", () => ({ })); vi.mock("../security/audit.js", () => ({ - runSecurityAudit: (opts: unknown) => mocks.runSecurityAudit(opts), + runSecurityAuditCore: (opts: unknown) => mocks.runSecurityAuditCore(opts), })); vi.mock("../security/fix.js", () => ({ @@ -68,7 +68,7 @@ function primeDeepAuditConfig(sourceConfig = { gateway: { mode: "local" } }) { targetStatesByPath: {}, hadUnresolvedTargets: false, }); - runSecurityAudit.mockResolvedValue({ + runSecurityAuditCore.mockResolvedValue({ ts: 0, summary: { critical: 0, warn: 0, info: 0 }, findings: [], @@ -82,7 +82,7 @@ function lastSecretResolverOptions(): Record | undefined { } function lastSecurityAuditOptions(): Record | undefined { - const calls = runSecurityAudit.mock.calls; + const calls = runSecurityAuditCore.mock.calls; return calls[calls.length - 1]?.[0] as Record | undefined; } @@ -90,7 +90,7 @@ describe("security CLI", () => { beforeEach(() => { runtimeLogs.length = 0; loadConfig.mockReset(); - runSecurityAudit.mockReset(); + runSecurityAuditCore.mockReset(); fixSecurityFootguns.mockReset(); resolveCommandSecretRefsViaGateway.mockReset(); getSecurityAuditCommandSecretTargetIds.mockClear(); @@ -134,7 +134,7 @@ describe("security CLI", () => { targetStatesByPath: {}, hadUnresolvedTargets: false, }); - runSecurityAudit.mockResolvedValue({ + runSecurityAuditCore.mockResolvedValue({ ts: 0, summary: { critical: 0, warn: 1, info: 0 }, findings: [ @@ -224,7 +224,7 @@ describe("security CLI", () => { await expect( createProgram().parseAsync(["security", "audit", ...argv, "--json"], { from: "user" }), ).rejects.toThrow(message); - expect(runSecurityAudit).not.toHaveBeenCalled(); + expect(runSecurityAuditCore).not.toHaveBeenCalled(); }, ); }); diff --git a/src/cli/security-cli.ts b/src/cli/security-cli.ts index bffd452ad183..de0ef4f7c951 100644 --- a/src/cli/security-cli.ts +++ b/src/cli/security-cli.ts @@ -9,7 +9,7 @@ import { isRich, theme } from "../../packages/terminal-core/src/theme.js"; import { getRuntimeConfig } from "../config/config.js"; import type { GatewayAuthMode } from "../config/types.gateway.js"; import { defaultRuntime } from "../runtime.js"; -import { runSecurityAudit } from "../security/audit.js"; +import { runSecurityAuditCore } from "../security/audit.js"; import { fixSecurityFootguns } from "../security/fix.js"; import { shortenHomeInString, shortenHomePath } from "../utils.js"; import { formatCliCommand } from "./command-format.js"; @@ -133,7 +133,7 @@ export function registerSecurityCli(program: Command) { targetIds: getSecurityAuditCommandSecretTargetIds(), mode: "read_only_status", }); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: cfg, sourceConfig, deep: Boolean(opts.deep), diff --git a/src/commands/agent/session.runtime.ts b/src/commands/agent/session.runtime.ts index 47cd78857943..4af7c5b903ed 100644 --- a/src/commands/agent/session.runtime.ts +++ b/src/commands/agent/session.runtime.ts @@ -1,5 +1,5 @@ // Full session-store resolution for gateway CLI requests that need local routing facts. -import { resolveSessionKeyForRequest as resolveAgentSessionKeyForRequest } from "../../agents/command/session.js"; +import { resolveSessionKeyForRequestCore as resolveAgentSessionKeyForRequest } from "../../agents/command/session.js"; export function resolveSessionKeyForRequest( ...args: Parameters diff --git a/src/commands/auth-choice.preferred-provider.test.ts b/src/commands/auth-choice.preferred-provider.test.ts index 3e56eacd7cc2..439ab2a4034f 100644 --- a/src/commands/auth-choice.preferred-provider.test.ts +++ b/src/commands/auth-choice.preferred-provider.test.ts @@ -1,14 +1,14 @@ // Preferred provider tests cover auth-choice provider selection and runtime provider discovery. import { beforeEach, describe, expect, it, vi } from "vitest"; -import type { resolvePluginProviders as resolvePluginProvidersFn } from "../plugins/providers.runtime.js"; +import type { resolvePluginProvidersCore as resolvePluginProvidersFn } from "../plugins/providers.runtime.js"; type ResolvePluginProvidersOptions = Parameters[0]; const resolveManifestProviderAuthChoice = vi.hoisted(() => vi.fn()); const resolveManifestDeprecatedProviderAuthChoice = vi.hoisted(() => vi.fn()); const resolveManifestProviderAuthChoices = vi.hoisted(() => vi.fn(() => [])); -const resolveProviderPluginChoice = vi.hoisted(() => vi.fn()); -const resolvePluginProviders = vi.hoisted(() => vi.fn(() => [])); +const resolveProviderPluginChoiceCore = vi.hoisted(() => vi.fn()); +const resolvePluginProvidersCore = vi.hoisted(() => vi.fn(() => [])); vi.mock("../plugins/provider-auth-choices.js", () => ({ resolveManifestProviderAuthChoice, @@ -17,11 +17,11 @@ vi.mock("../plugins/provider-auth-choices.js", () => ({ })); vi.mock("../plugins/provider-wizard.js", () => ({ - resolveProviderPluginChoice, + resolveProviderPluginChoiceCore, })); vi.mock("../plugins/providers.runtime.js", () => ({ - resolvePluginProviders, + resolvePluginProvidersCore, })); import { resolvePreferredProviderForAuthChoice } from "../plugins/provider-auth-choice-preference.js"; @@ -32,8 +32,8 @@ describe("resolvePreferredProviderForAuthChoice", () => { resolveManifestProviderAuthChoice.mockReturnValue(undefined); resolveManifestDeprecatedProviderAuthChoice.mockReturnValue(undefined); resolveManifestProviderAuthChoices.mockReturnValue([]); - resolvePluginProviders.mockReturnValue([]); - resolveProviderPluginChoice.mockReturnValue(null); + resolvePluginProvidersCore.mockReturnValue([]); + resolveProviderPluginChoiceCore.mockReturnValue(null); }); it("prefers manifest metadata when available", async () => { @@ -48,7 +48,7 @@ describe("resolvePreferredProviderForAuthChoice", () => { await expect(resolvePreferredProviderForAuthChoice({ choice: "openai-api-key" })).resolves.toBe( "openai", ); - expect(resolvePluginProviders).not.toHaveBeenCalled(); + expect(resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("normalizes legacy auth choices before plugin lookup", async () => { @@ -67,8 +67,8 @@ describe("resolvePreferredProviderForAuthChoice", () => { await expect(resolvePreferredProviderForAuthChoice({ choice: "claude-cli" })).resolves.toBe( "anthropic", ); - expect(resolveProviderPluginChoice).not.toHaveBeenCalled(); - expect(resolvePluginProviders).not.toHaveBeenCalled(); + expect(resolveProviderPluginChoiceCore).not.toHaveBeenCalled(); + expect(resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("passes explicit env through legacy auth normalization", async () => { @@ -103,18 +103,18 @@ describe("resolvePreferredProviderForAuthChoice", () => { await expect(resolvePreferredProviderForAuthChoice({ choice: "chutes" })).resolves.toBe( "chutes", ); - expect(resolvePluginProviders).not.toHaveBeenCalled(); + expect(resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("passes untrusted-workspace filtering through setup-provider fallback lookup", async () => { - resolvePluginProviders.mockReturnValue([ + resolvePluginProvidersCore.mockReturnValue([ { id: "demo-provider", label: "Demo Provider", auth: [{ id: "api-key", label: "API key", kind: "api_key" }], }, ] as never); - resolveProviderPluginChoice.mockReturnValue({ + resolveProviderPluginChoiceCore.mockReturnValue({ provider: { id: "demo-provider" }, method: { id: "api-key" }, }); @@ -125,8 +125,8 @@ describe("resolvePreferredProviderForAuthChoice", () => { includeUntrustedWorkspacePlugins: false, }), ).resolves.toBe("demo-provider"); - expect(resolvePluginProviders).toHaveBeenCalledOnce(); - const [pluginProviderOptions] = resolvePluginProviders.mock.calls[0] as unknown as [ + expect(resolvePluginProvidersCore).toHaveBeenCalledOnce(); + const [pluginProviderOptions] = resolvePluginProvidersCore.mock.calls[0] as unknown as [ ResolvePluginProvidersOptions, ]; expect(pluginProviderOptions?.mode).toBe("setup"); diff --git a/src/commands/channel-setup/plugin-install.test.ts b/src/commands/channel-setup/plugin-install.test.ts index 0f1ade104197..e334aadf19ab 100644 --- a/src/commands/channel-setup/plugin-install.test.ts +++ b/src/commands/channel-setup/plugin-install.test.ts @@ -57,9 +57,9 @@ vi.mock("../../channels/plugins/catalog.js", () => { }; }); -const loadPluginManifestRegistry = vi.fn(); +const loadPluginManifestRegistryCore = vi.fn(); vi.mock("../../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: (...args: unknown[]) => loadPluginManifestRegistry(...args), + loadPluginManifestRegistryCore: (...args: unknown[]) => loadPluginManifestRegistryCore(...args), })); vi.mock("../../plugins/bundled-sources.js", () => ({ @@ -165,7 +165,7 @@ function mockActivationOnlyPlugin(plugin: { id: string; origin?: "bundled" | "global" | "workspace"; }) { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ createManifestRecord({ id: plugin.id, @@ -231,7 +231,7 @@ beforeEach(() => { discoverOpenClawPlugins.mockReturnValue({ candidates: [], diagnostics: [] }); getChannelPluginCatalogEntry.mockReturnValue(undefined); listChannelPluginCatalogEntries.mockReturnValue([]); - loadPluginManifestRegistry.mockReturnValue({ plugins: [], diagnostics: [] }); + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [], diagnostics: [] }); setActivePluginRegistry(createEmptyPluginRegistry()); }); @@ -850,7 +850,7 @@ describe("ensureChannelSetupPluginInstalled", () => { it("scopes snapshots by a unique discovered manifest match when catalog mapping is missing", () => { const runtime = makeRuntime(); const cfg: OpenClawConfig = {}; - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ createManifestRecord({ id: "custom-external-chat-plugin", @@ -894,7 +894,7 @@ describe("ensureChannelSetupPluginInstalled", () => { ], diagnostics: [], }); - loadPluginManifestRegistry.mockImplementation((args: unknown) => { + loadPluginManifestRegistryCore.mockImplementation((args: unknown) => { if ( isRecord(args) && args.config === cfg && @@ -944,9 +944,9 @@ describe("ensureChannelSetupPluginInstalled", () => { workspaceDir: "/tmp/openclaw-workspace", }); - expect(loadPluginManifestRegistry).toHaveBeenCalled(); + expect(loadPluginManifestRegistryCore).toHaveBeenCalled(); expect( - loadPluginManifestRegistry.mock.calls.every( + loadPluginManifestRegistryCore.mock.calls.every( ([params]) => !Object.hasOwn(params ?? {}, "cache"), ), ).toBe(true); diff --git a/src/commands/channel-setup/workspace-shadow-bypass.test.ts b/src/commands/channel-setup/workspace-shadow-bypass.test.ts index 19f6a3ae83d0..772e8c067be2 100644 --- a/src/commands/channel-setup/workspace-shadow-bypass.test.ts +++ b/src/commands/channel-setup/workspace-shadow-bypass.test.ts @@ -16,7 +16,7 @@ import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; const listChannelPluginCatalogEntries = vi.hoisted(() => vi.fn((_opts?: unknown): unknown[] => [])); const listChatChannels = vi.hoisted(() => vi.fn((): unknown[] => [])); -const loadPluginManifestRegistry = vi.hoisted(() => vi.fn()); +const loadPluginManifestRegistryCore = vi.hoisted(() => vi.fn()); const loadPluginRegistrySnapshot = vi.hoisted(() => vi.fn()); const loadPluginRegistrySnapshotWithMetadata = vi.hoisted(() => vi.fn()); const listPluginContributionIds = vi.hoisted(() => vi.fn((_params?: unknown): string[] => [])); @@ -39,11 +39,11 @@ vi.mock("../../channels/registry.js", () => ({ normalizeAnyChannelId: (channelId?: string) => channelId?.trim().toLowerCase() ?? null, })); vi.mock("../../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: (...a: unknown[]) => loadPluginManifestRegistry(...a), + loadPluginManifestRegistryCore: (...a: unknown[]) => loadPluginManifestRegistryCore(...a), })); vi.mock("../../plugins/plugin-registry.js", () => ({ loadPluginManifestRegistryForPluginRegistry: (...args: unknown[]) => - loadPluginManifestRegistry(...args), + loadPluginManifestRegistryCore(...args), loadPluginRegistrySnapshot: (...args: unknown[]) => loadPluginRegistrySnapshot(...args), loadPluginRegistrySnapshotWithMetadata: (...args: unknown[]) => loadPluginRegistrySnapshotWithMetadata(...args), @@ -65,7 +65,7 @@ import { resolveChannelSetupEntries } from "./discovery.js"; beforeEach(() => { vi.clearAllMocks(); - loadPluginManifestRegistry.mockReturnValue({ plugins: [], diagnostics: [] }); + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [], diagnostics: [] }); loadPluginRegistrySnapshot.mockReturnValue({ version: 1, hostContractVersion: "test", @@ -222,7 +222,7 @@ describe("resolveChannelSetupEntries workspace shadow exclusion (GHSA-2qrv-rc5x- install: { npmSpec: "trusted-telegram-shadow" }, }; listChannelPluginCatalogEntries.mockReturnValue([workspaceEntry]); - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [createManifestChannelPlugin("trusted-telegram-shadow", ["telegram"])], diagnostics: [], }); @@ -273,7 +273,7 @@ describe("resolveChannelSetupEntries workspace shadow exclusion (GHSA-2qrv-rc5x- "trusted-telegram-shadow": ["channel configured"], }, })); - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [createManifestChannelPlugin("trusted-telegram-shadow", ["telegram"])], diagnostics: [], }); @@ -318,7 +318,7 @@ describe("resolveChannelSetupEntries workspace shadow exclusion (GHSA-2qrv-rc5x- changes: [] as string[], autoEnabledReasons: {}, })); - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [createManifestChannelPlugin("my-cool-plugin", ["my-cool-plugin"])], diagnostics: [], }); diff --git a/src/commands/configure.gateway-auth.prompt-auth-config.test.ts b/src/commands/configure.gateway-auth.prompt-auth-config.test.ts index 2a2801a5bed6..89c88ae346d4 100644 --- a/src/commands/configure.gateway-auth.prompt-auth-config.test.ts +++ b/src/commands/configure.gateway-auth.prompt-auth-config.test.ts @@ -144,8 +144,8 @@ const mocks = vi.hoisted(() => ({ }, ), promptCustomApiConfig: vi.fn(), - resolvePluginProviders: vi.fn(() => []), - resolveProviderPluginChoice: vi.fn<() => unknown>(() => null), + resolvePluginProvidersCore: vi.fn(() => []), + resolveProviderPluginChoiceCore: vi.fn<() => unknown>(() => null), loadStaticManifestCatalogRowsForList: vi.fn<() => readonly NormalizedModelCatalogRow[]>(() => []), resolvePreferredProviderForAuthChoice: vi.fn<() => Promise>( async () => undefined, @@ -195,11 +195,11 @@ vi.mock("./onboard-custom.js", () => ({ })); vi.mock("../plugins/providers.runtime.js", () => ({ - resolvePluginProviders: mocks.resolvePluginProviders, + resolvePluginProvidersCore: mocks.resolvePluginProvidersCore, })); vi.mock("../plugins/provider-wizard.js", () => ({ - resolveProviderPluginChoice: mocks.resolveProviderPluginChoice, + resolveProviderPluginChoiceCore: mocks.resolveProviderPluginChoiceCore, })); vi.mock("./models/list.manifest-catalog.js", () => ({ @@ -300,8 +300,8 @@ async function runPromptAuthConfigWithAllowlist(includeMinimaxProvider = false) mocks.promptModelAllowlist.mockResolvedValue({ models: ["kilocode/kilo-auto/balanced"], }); - mocks.resolvePluginProviders.mockReturnValue([]); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolvePluginProvidersCore.mockReturnValue([]); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); return promptAuthConfig({}, makeRuntime(), noopPrompter); } @@ -334,7 +334,7 @@ describe("promptAuthConfig", () => { mocks.promptAuthChoiceGrouped.mockResolvedValue("token"); mocks.applyAuthChoice.mockResolvedValue({ config: {} }); mocks.promptModelAllowlist.mockResolvedValue({ models: undefined }); - mocks.resolveProviderPluginChoice.mockReturnValue({ + mocks.resolveProviderPluginChoiceCore.mockReturnValue({ provider: { id: "anthropic", label: "Anthropic", @@ -380,7 +380,7 @@ describe("promptAuthConfig", () => { models: ["anthropic/claude-sonnet-4-6"], scopeKeys: ["anthropic/claude-opus-4-6", "anthropic/claude-sonnet-4-6"], }); - mocks.resolveProviderPluginChoice.mockReturnValue({ + mocks.resolveProviderPluginChoiceCore.mockReturnValue({ provider: { id: "anthropic", label: "Anthropic", @@ -433,7 +433,7 @@ describe("promptAuthConfig", () => { models: ["openai/gpt-5.5"], scopeKeys: ["openai/gpt-5.5", "openai/gpt-5.4-mini"], }); - mocks.resolveProviderPluginChoice.mockReturnValue({ + mocks.resolveProviderPluginChoiceCore.mockReturnValue({ provider: { id: "openai", label: "OpenAI", @@ -495,7 +495,7 @@ describe("promptAuthConfig", () => { models: ["openai/gpt-5.5", "openai/gpt-5.3-codex"], scopeKeys: ["openai/gpt-5.5", "openai/gpt-5.3-codex"], }); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); const result = await promptAuthConfig({}, makeRuntime(), noopPrompter); @@ -534,7 +534,7 @@ describe("promptAuthConfig", () => { } as OpenClawConfig; mocks.applyAuthChoice.mockResolvedValue({ config: existingConfig }); mocks.promptModelAllowlist.mockResolvedValue({ models: undefined }); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter); @@ -578,7 +578,7 @@ describe("promptAuthConfig", () => { }, ]); mocks.promptModelAllowlist.mockResolvedValue({ models: undefined }); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); await promptAuthConfig(existingConfig, makeRuntime(), noopPrompter); @@ -608,7 +608,7 @@ describe("promptAuthConfig", () => { }, }); mocks.promptModelAllowlist.mockResolvedValue({ models: undefined }); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); await promptAuthConfig({}, makeRuntime(), noopPrompter); @@ -636,7 +636,7 @@ describe("promptAuthConfig", () => { }, }); mocks.promptModelAllowlist.mockResolvedValue({ models: undefined }); - mocks.resolveProviderPluginChoice.mockReturnValue({ + mocks.resolveProviderPluginChoiceCore.mockReturnValue({ provider: { id: "github-copilot", label: "GitHub Copilot", @@ -677,8 +677,8 @@ describe("promptAuthConfig", () => { }, }); mocks.promptModelAllowlist.mockResolvedValue({ models: undefined }); - mocks.resolvePluginProviders.mockReturnValue([]); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolvePluginProvidersCore.mockReturnValue([]); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); mocks.loadStaticManifestCatalogRowsForList.mockReturnValue([ { provider: "github-copilot", @@ -709,7 +709,7 @@ describe("promptAuthConfig", () => { models: ["openai/gpt-5.5"], scopeKeys: ["openai/gpt-5.5", "openai/gpt-5.5-pro"], }); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); const result = await promptAuthConfig( { @@ -743,8 +743,8 @@ describe("promptAuthConfig", () => { mocks.resolvePreferredProviderForAuthChoice .mockResolvedValueOnce("wecom") .mockResolvedValueOnce("kilocode"); - mocks.resolvePluginProviders.mockReturnValue([]); - mocks.resolveProviderPluginChoice.mockReturnValue(null); + mocks.resolvePluginProvidersCore.mockReturnValue([]); + mocks.resolveProviderPluginChoiceCore.mockReturnValue(null); await promptAuthConfig({}, makeRuntime(), noopPrompter); diff --git a/src/commands/daemon-install-helpers.test.ts b/src/commands/daemon-install-helpers.test.ts index be8a22d25fec..ebd079ead2ea 100644 --- a/src/commands/daemon-install-helpers.test.ts +++ b/src/commands/daemon-install-helpers.test.ts @@ -22,7 +22,7 @@ const mocks = vi.hoisted(() => ({ resolveOpenClawWrapperPath: vi.fn(), assertNoSystemLaunchDaemonOwnership: vi.fn(), execLaunchctl: vi.fn(), - loadPluginManifestRegistry: vi.fn< + loadPluginManifestRegistryCore: vi.fn< (...args: unknown[]) => { diagnostics: unknown[]; plugins: unknown[] } >(() => ({ diagnostics: [], @@ -73,7 +73,7 @@ vi.mock("../daemon/launchd-system.js", async (importActual) => ({ vi.mock("../plugins/manifest-registry.js", async (importActual) => { const actual = await importActual(); const hasPluginIntegrationProvider = ( - params?: Parameters[0], + params?: Parameters[0], ) => Object.values(params?.config?.secrets?.providers ?? {}).some( (provider) => @@ -83,12 +83,12 @@ vi.mock("../plugins/manifest-registry.js", async (importActual) => { ); return { ...actual, - loadPluginManifestRegistry: ( - params?: Parameters[0], + loadPluginManifestRegistryCore: ( + params?: Parameters[0], ) => hasPluginIntegrationProvider(params) - ? mocks.loadPluginManifestRegistry(params) - : actual.loadPluginManifestRegistry(params), + ? mocks.loadPluginManifestRegistryCore(params) + : actual.loadPluginManifestRegistryCore(params), }; }); @@ -166,7 +166,7 @@ function mockNodeGatewayPlanFixture( }); mocks.renderSystemNodeWarning.mockReturnValue(warning); mocks.buildServiceEnvironment.mockReturnValue(serviceEnvironment); - mocks.loadPluginManifestRegistry.mockReturnValue({ diagnostics: [], plugins: [] }); + mocks.loadPluginManifestRegistryCore.mockReturnValue({ diagnostics: [], plugins: [] }); mocks.loadPluginManifestRegistryForPluginRegistry.mockReturnValue({ diagnostics: [], plugins: [], @@ -228,7 +228,7 @@ async function buildPluginConfigExecSecretRefPlan(home: string) { const pluginRoot = path.join(home, "acme-secrets"); createSecurePluginRoot(pluginRoot); writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js")); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ diagnostics: [], plugins: [ { @@ -714,7 +714,7 @@ describe("buildGatewayInstallPlan", () => { const pluginRoot = path.join(isolatedHome, "acme-secrets"); createSecurePluginRoot(pluginRoot); writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js")); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ diagnostics: [], plugins: [ { @@ -826,7 +826,7 @@ describe("buildGatewayInstallPlan", () => { const pluginRoot = path.join(isolatedHome, "acme-secrets"); createSecurePluginRoot(pluginRoot); writeSecurePluginEntrypoint(path.join(pluginRoot, "secret-ref-resolver.js")); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ diagnostics: [], plugins: [ { diff --git a/src/commands/daemon-install-helpers.ts b/src/commands/daemon-install-helpers.ts index ccb98072536b..ce52eca6595b 100644 --- a/src/commands/daemon-install-helpers.ts +++ b/src/commands/daemon-install-helpers.ts @@ -35,7 +35,7 @@ import { normalizeEnvVarKey, } from "../infra/host-env-security.js"; import { - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, type PluginManifestRegistry, } from "../plugins/manifest-registry.js"; import { @@ -300,7 +300,7 @@ function collectExecSecretRefPassEnvServiceEnvVars(params: { } const execProvider = isPluginIntegrationSecretProviderConfig(provider) ? (() => { - manifestRegistry ??= loadPluginManifestRegistry({ + manifestRegistry ??= loadPluginManifestRegistryCore({ config: params.config, env: params.env, }); diff --git a/src/commands/doctor-auth-legacy-oauth.ts b/src/commands/doctor-auth-legacy-oauth.ts index e91b28a3a9ec..0bb92b8c04ba 100644 --- a/src/commands/doctor-auth-legacy-oauth.ts +++ b/src/commands/doctor-auth-legacy-oauth.ts @@ -40,8 +40,8 @@ export async function maybeRepairLegacyOAuthProfileIds( return cfg; } let nextCfg = cfg; - const { resolvePluginProviders } = await loadProviderRuntime(); - const providers = resolvePluginProviders({ + const { resolvePluginProvidersCore } = await loadProviderRuntime(); + const providers = resolvePluginProvidersCore({ config: cfg, env: process.env, mode: "setup", diff --git a/src/commands/doctor-auth.deprecated-cli-profiles.test.ts b/src/commands/doctor-auth.deprecated-cli-profiles.test.ts index 739130eb8e93..513452be1aa1 100644 --- a/src/commands/doctor-auth.deprecated-cli-profiles.test.ts +++ b/src/commands/doctor-auth.deprecated-cli-profiles.test.ts @@ -17,7 +17,7 @@ const repairMocks = vi.hoisted(() => ({ })); vi.mock("../plugins/providers.runtime.js", () => ({ - resolvePluginProviders: () => resolvePluginProvidersMock(), + resolvePluginProvidersCore: () => resolvePluginProvidersMock(), })); vi.mock("../agents/auth-profiles/repair.js", () => ({ diff --git a/src/commands/doctor-legacy-config.migrations.test.ts b/src/commands/doctor-legacy-config.migrations.test.ts index 6274dc56a4a0..086f90c4aee6 100644 --- a/src/commands/doctor-legacy-config.migrations.test.ts +++ b/src/commands/doctor-legacy-config.migrations.test.ts @@ -50,7 +50,7 @@ vi.mock("../plugins/manifest-registry.js", () => { }; }; return { - loadPluginManifestRegistry: () => ({ + loadPluginManifestRegistryCore: () => ({ diagnostics: [], plugins: [ plugin("brave", "brave"), diff --git a/src/commands/doctor-plugin-manifests.ts b/src/commands/doctor-plugin-manifests.ts index c38d246b7765..61e7b2d26a28 100644 --- a/src/commands/doctor-plugin-manifests.ts +++ b/src/commands/doctor-plugin-manifests.ts @@ -7,7 +7,7 @@ import { z } from "zod"; import { note } from "../../packages/terminal-core/src/note.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import type { HealthFinding } from "../flows/health-checks.js"; -import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../plugins/manifest-registry.js"; import type { RuntimeEnv } from "../runtime.js"; import { shortenHomePath } from "../utils.js"; import { safeParseJsonWithSchema, safeParseWithSchema } from "../utils/zod-parse.js"; @@ -128,7 +128,7 @@ export function collectLegacyPluginManifestContractMigrations(params?: { } } - for (const plugin of loadPluginManifestRegistry({ + for (const plugin of loadPluginManifestRegistryCore({ ...(params?.config ? { config: params.config } : {}), ...(params?.env ? { env: params.env } : {}), ...(params?.workspaceDir ? { workspaceDir: params.workspaceDir } : {}), diff --git a/src/commands/doctor.runs-legacy-state-migrations-yes-mode-without.e2e.test.ts b/src/commands/doctor.runs-legacy-state-migrations-yes-mode-without.e2e.test.ts index b7c80f44a2b3..d3df9cfdf23e 100644 --- a/src/commands/doctor.runs-legacy-state-migrations-yes-mode-without.e2e.test.ts +++ b/src/commands/doctor.runs-legacy-state-migrations-yes-mode-without.e2e.test.ts @@ -14,7 +14,7 @@ import { const providerRuntimeMocks = vi.hoisted(() => ({ useMockProviders: false, - resolvePluginProviders: vi.fn((_params?: unknown): ProviderPlugin[] => []), + resolvePluginProvidersCore: vi.fn((_params?: unknown): ProviderPlugin[] => []), })); vi.mock("../plugins/providers.runtime.js", async () => { @@ -23,12 +23,12 @@ vi.mock("../plugins/providers.runtime.js", async () => { ); return { ...actual, - resolvePluginProviders: ( - params: Parameters[0], + resolvePluginProvidersCore: ( + params: Parameters[0], ): ProviderPlugin[] => providerRuntimeMocks.useMockProviders - ? providerRuntimeMocks.resolvePluginProviders(params) - : actual.resolvePluginProviders(params), + ? providerRuntimeMocks.resolvePluginProvidersCore(params) + : actual.resolvePluginProvidersCore(params), }; }); @@ -43,7 +43,7 @@ describe("doctor command", () => { ({ healthCommand } = await import("./health.js")); vi.clearAllMocks(); providerRuntimeMocks.useMockProviders = false; - providerRuntimeMocks.resolvePluginProviders.mockReturnValue([]); + providerRuntimeMocks.resolvePluginProvidersCore.mockReturnValue([]); }); it("runs legacy state migrations in yes mode without prompting", async () => { @@ -154,7 +154,7 @@ describe("doctor command", () => { }, }); providerRuntimeMocks.useMockProviders = true; - providerRuntimeMocks.resolvePluginProviders.mockReturnValue([ + providerRuntimeMocks.resolvePluginProvidersCore.mockReturnValue([ { id: "anthropic", label: "Anthropic", diff --git a/src/commands/doctor/shared/channel-plugin-blockers.test.ts b/src/commands/doctor/shared/channel-plugin-blockers.test.ts index 45a81f2660d9..f4fd5c2c2b8e 100644 --- a/src/commands/doctor/shared/channel-plugin-blockers.test.ts +++ b/src/commands/doctor/shared/channel-plugin-blockers.test.ts @@ -47,10 +47,10 @@ function plugin( } function mockManifestPlugins(plugins: unknown[]) { - vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({ + vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore").mockReturnValue({ plugins, diagnostics: [], - } as unknown as ReturnType); + } as unknown as ReturnType); } describe("channel plugin blockers", () => { @@ -60,10 +60,12 @@ describe("channel plugin blockers", () => { }); it("returns no blockers when config and package env have no channel surfaces", () => { - const registrySpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({ - plugins: [], - diagnostics: [], - }); + const registrySpy = vi + .spyOn(manifestRegistry, "loadPluginManifestRegistryCore") + .mockReturnValue({ + plugins: [], + diagnostics: [], + }); const hits = scanConfiguredChannelPluginBlockers({ channels: { @@ -114,10 +116,12 @@ describe("channel plugin blockers", () => { }); it("uses provided manifest records without loading the registry", () => { - const registrySpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({ - plugins: [], - diagnostics: [], - }); + const registrySpy = vi + .spyOn(manifestRegistry, "loadPluginManifestRegistryCore") + .mockReturnValue({ + plugins: [], + diagnostics: [], + }); const hits = scanConfiguredChannelPluginBlockers( { diff --git a/src/commands/doctor/shared/pristine-startup-state.ts b/src/commands/doctor/shared/pristine-startup-state.ts index 7c5102617d71..968e5e12e070 100644 --- a/src/commands/doctor/shared/pristine-startup-state.ts +++ b/src/commands/doctor/shared/pristine-startup-state.ts @@ -15,7 +15,7 @@ import { inspectPluginStartupMetadata, } from "../../../plugins/bundled-plugin-startup-metadata.js"; import { discoverConfiguredPluginLoadPaths } from "../../../plugins/discovery.js"; -import { loadPluginManifestRegistry } from "../../../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../../../plugins/manifest-registry.js"; import { configMayRequireStartupPluginConvergence } from "./startup-plugin-convergence-plan.js"; const STATEFUL_CONFIG_KEYS = new Set([ @@ -138,7 +138,7 @@ function hasOnlyMigrationSafePluginEntries( } // Discovery alone cannot prove host compatibility or rule out a fallback // doctor owner; use the same candidate acceptance as normal plugin startup. - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ config: config as OpenClawConfig, discovery, env, diff --git a/src/commands/doctor/shared/stale-plugin-config.test.ts b/src/commands/doctor/shared/stale-plugin-config.test.ts index 5d0acf64b52e..0fdef413ba8a 100644 --- a/src/commands/doctor/shared/stale-plugin-config.test.ts +++ b/src/commands/doctor/shared/stale-plugin-config.test.ts @@ -41,7 +41,7 @@ describe("doctor stale plugin config helpers", () => { beforeEach(() => { installedPluginIndexMocks.loadInstalledPluginIndexInstallRecordsSync.mockReset(); installedPluginIndexMocks.loadInstalledPluginIndexInstallRecordsSync.mockReturnValue({}); - vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({ + vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore").mockReturnValue({ plugins: [manifest("discord"), manifest("voice-call"), manifest("openai")], diagnostics: [], }); @@ -473,7 +473,7 @@ describe("doctor stale plugin config helpers", () => { expect(scanStalePluginConfig(cfg)).toStrictEqual([]); expect(maybeRepairStalePluginConfig(cfg)).toEqual({ config: cfg, changes: [] }); - expect(manifestRegistry.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(manifestRegistry.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); }); it("uses missing persisted install records as stale channel evidence", () => { @@ -500,7 +500,7 @@ describe("doctor stale plugin config helpers", () => { }); it("does not auto-repair stale refs while plugin discovery has errors", () => { - vi.spyOn(manifestRegistry, "loadPluginManifestRegistry").mockReturnValue({ + vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore").mockReturnValue({ plugins: [], diagnostics: [ { level: "error", message: "plugin path not found: /missing", source: "/missing" }, diff --git a/src/commands/model-picker.runtime.ts b/src/commands/model-picker.runtime.ts index 83be6c199e78..aef5ce1d6b69 100644 --- a/src/commands/model-picker.runtime.ts +++ b/src/commands/model-picker.runtime.ts @@ -5,17 +5,17 @@ import { } from "../flows/provider-flow.runtime.js"; import { runProviderPluginAuthMethod } from "../plugins/provider-auth-choice.js"; import { - resolveProviderPluginChoice, - runProviderModelSelectedHook, + resolveProviderPluginChoiceCore, + runProviderModelSelectedHookCore, } from "../plugins/provider-wizard.js"; -import { resolvePluginProviders } from "../plugins/providers.runtime.js"; +import { resolvePluginProvidersCore } from "../plugins/providers.runtime.js"; /** Lazy runtime methods consumed by model picker command flows. */ export const modelPickerRuntime = { resolveProviderModelPickerContributions: resolveProviderModelPickerFlowContributions, resolveProviderModelPickerEntries: resolveProviderModelPickerFlowEntries, - resolveProviderPluginChoice, - runProviderModelSelectedHook, - resolvePluginProviders, + resolveProviderPluginChoice: resolveProviderPluginChoiceCore, + runProviderModelSelectedHook: runProviderModelSelectedHookCore, + resolvePluginProviders: resolvePluginProvidersCore, runProviderPluginAuthMethod, }; diff --git a/src/commands/models.list.e2e.test.ts b/src/commands/models.list.e2e.test.ts index 88a90b522865..f6e1895bd06b 100644 --- a/src/commands/models.list.e2e.test.ts +++ b/src/commands/models.list.e2e.test.ts @@ -25,7 +25,7 @@ const hasSyntheticLocalProviderAuthConfig = vi.fn().mockReturnValue(false); const loadModelCatalog = vi.fn<(_params?: unknown) => Promise>>>( async () => [], ); -const shouldSuppressBuiltInModel = vi.fn().mockReturnValue(false); +const shouldSuppressBuiltInModelCore = vi.fn().mockReturnValue(false); const shouldSuppressBuiltInModelFromManifest = vi.fn().mockReturnValue(false); const normalizeProviderResolvedModelWithPlugin = vi.hoisted(() => vi.fn(({ context }) => { @@ -205,7 +205,7 @@ vi.mock("../plugins/synthetic-auth.runtime.js", () => ({ vi.mock("../agents/model-suppression.js", async (importOriginal) => ({ ...(await importOriginal()), - shouldSuppressBuiltInModel, + shouldSuppressBuiltInModelCore, shouldSuppressBuiltInModelFromManifest, })); @@ -280,8 +280,8 @@ beforeEach(() => { listProfilesForProvider.mockReturnValue([]); loadModelCatalog.mockReset(); loadModelCatalog.mockResolvedValue([]); - shouldSuppressBuiltInModel.mockReset(); - shouldSuppressBuiltInModel.mockReturnValue(false); + shouldSuppressBuiltInModelCore.mockReset(); + shouldSuppressBuiltInModelCore.mockReturnValue(false); normalizeProviderResolvedModelWithPlugin.mockClear(); readConfigFileSnapshotForWrite.mockClear(); readConfigFileSnapshotForWrite.mockResolvedValue({ @@ -735,7 +735,7 @@ describe("models list/status", () => { const suppressSpark = ({ provider, id }: { provider?: string | null; id?: string | null }) => id === "gpt-5.3-codex-spark" && (provider === "openai" || provider === "azure-openai-responses" || provider === "openai"); - shouldSuppressBuiltInModel.mockImplementation(suppressSpark); + shouldSuppressBuiltInModelCore.mockImplementation(suppressSpark); shouldSuppressBuiltInModelFromManifest.mockImplementation(suppressSpark); setDefaultModel("openai/gpt-5.5"); modelRegistryState.models = [OPENAI_MODEL, OPENAI_SPARK_MODEL, AZURE_OPENAI_SPARK_MODEL]; diff --git a/src/commands/models/auth.test.ts b/src/commands/models/auth.test.ts index ceb09a23638e..3e6a0902c550 100644 --- a/src/commands/models/auth.test.ts +++ b/src/commands/models/auth.test.ts @@ -53,7 +53,7 @@ const mocks = vi.hoisted(() => ({ upsertAuthProfile: vi.fn(), upsertAuthProfileWithLock: vi.fn(), removeProviderAuthProfilesWithLock: vi.fn(), - resolvePluginProviders: vi.fn(), + resolvePluginProvidersCore: vi.fn(), createClackPrompter: vi.fn(), loadValidConfigOrThrow: vi.fn(), updateConfig: vi.fn(), @@ -66,7 +66,7 @@ const mocks = vi.hoisted(() => ({ promoteAuthProfileInOrder: vi.fn(), clearAuthProfileCooldown: vi.fn(), callGateway: vi.fn(), - resolvePluginSetupProvider: vi.fn(), + resolvePluginSetupProviderCore: vi.fn(), resolvePluginSetupRegistry: vi.fn(), })); @@ -138,11 +138,11 @@ vi.mock("../../agents/workspace.js", () => ({ })); vi.mock("../../plugins/providers.runtime.js", () => ({ - resolvePluginProviders: mocks.resolvePluginProviders, + resolvePluginProvidersCore: mocks.resolvePluginProvidersCore, })); vi.mock("../../plugins/setup-registry.js", () => ({ - resolvePluginSetupProvider: mocks.resolvePluginSetupProvider, + resolvePluginSetupProviderCore: mocks.resolvePluginSetupProviderCore, resolvePluginSetupRegistry: mocks.resolvePluginSetupRegistry, })); @@ -381,7 +381,7 @@ describe("modelsAuthLoginCommand", () => { mocks.resolveAgentWorkspaceDir.mockReturnValue("/tmp/openclaw/workspace"); mocks.resolveDefaultAgentWorkspaceDir.mockReturnValue("/tmp/openclaw/workspace"); mocks.isRemoteEnvironment.mockReturnValue(false); - mocks.resolvePluginSetupProvider.mockReturnValue(undefined); + mocks.resolvePluginSetupProviderCore.mockReturnValue(undefined); mocks.resolvePluginSetupRegistry.mockReturnValue({ providers: [], cliBackends: [], @@ -417,7 +417,7 @@ describe("modelsAuthLoginCommand", () => { ], defaultModel: "openai/gpt-5.5", }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ createProvider({ id: "openai", label: "OpenAI Codex", @@ -635,7 +635,7 @@ describe("modelsAuthLoginCommand", () => { ? ["openai:user@example.com"] : [], ); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ createProvider({ id: "openai", label: "OpenAI runtime", @@ -650,7 +650,7 @@ describe("modelsAuthLoginCommand", () => { ], }), ]); - mocks.resolvePluginSetupProvider.mockReturnValue( + mocks.resolvePluginSetupProviderCore.mockReturnValue( createProvider({ id: "openai", label: "OpenAI", @@ -674,7 +674,7 @@ describe("modelsAuthLoginCommand", () => { await modelsAuthLoginCommand({ provider: "openai" }, runtime); - expect(mocks.resolvePluginSetupProvider).toHaveBeenCalledWith({ + expect(mocks.resolvePluginSetupProviderCore).toHaveBeenCalledWith({ provider: "openai", config: initialConfig, workspaceDir: "/tmp/openclaw/workspace", @@ -694,7 +694,7 @@ describe("modelsAuthLoginCommand", () => { const runtime = createRuntime(); const runOauthAuth = vi.fn().mockResolvedValue({ profiles: [] }); const runApiKeyAuth = vi.fn().mockResolvedValue({ profiles: [] }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ createProvider({ id: "openai", label: "OpenAI runtime", @@ -709,7 +709,7 @@ describe("modelsAuthLoginCommand", () => { ], }), ]); - mocks.resolvePluginSetupProvider.mockReturnValue( + mocks.resolvePluginSetupProviderCore.mockReturnValue( createProvider({ id: "openai", label: "OpenAI", @@ -741,7 +741,7 @@ describe("modelsAuthLoginCommand", () => { const runtime = createRuntime(); const runOauthAuth = vi.fn().mockResolvedValue({ profiles: [] }); const runApiKeyAuth = vi.fn().mockResolvedValue({ profiles: [] }); - mocks.resolvePluginSetupProvider.mockReturnValue( + mocks.resolvePluginSetupProviderCore.mockReturnValue( createProvider({ id: "openai", label: "OpenAI", @@ -780,7 +780,7 @@ describe("modelsAuthLoginCommand", () => { note: vi.fn(async () => {}), select, }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ createProvider({ id: "anthropic", label: "Anthropic", @@ -928,7 +928,7 @@ describe("modelsAuthLoginCommand", () => { }, }, }); - mocks.resolvePluginProviders.mockImplementation( + mocks.resolvePluginProvidersCore.mockImplementation( (params: { activate?: boolean; providerRefs?: string[] } | undefined) => params?.activate === true && params?.providerRefs?.[0] === "anthropic" ? [ @@ -954,7 +954,7 @@ describe("modelsAuthLoginCommand", () => { ); const providerResolutionCall = readMockCallArg( - mocks.resolvePluginProviders, + mocks.resolvePluginProvidersCore, ) as ResolvePluginProvidersCall; expect(providerResolutionCall.config).toEqual({}); expect(providerResolutionCall.workspaceDir).toBe("/tmp/openclaw/workspace"); @@ -1055,7 +1055,7 @@ describe("modelsAuthLoginCommand", () => { }; mocks.loadAuthProfileStoreForRuntime.mockReturnValue(fakeStore); mocks.listProfilesForProvider.mockReturnValue(["anthropic:claude-cli", "anthropic:legacy"]); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ { id: "anthropic", label: "Anthropic", @@ -1186,7 +1186,7 @@ describe("modelsAuthLoginCommand", () => { }, defaultModel: "openai/gpt-5.5", }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ createProvider({ id: "openai", label: "OpenAI", @@ -1222,7 +1222,7 @@ describe("modelsAuthLoginCommand", () => { ], defaultModel: "google/gemini-3-pro-preview", }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ createProvider({ id: "google", label: "Google", @@ -1329,7 +1329,7 @@ describe("modelsAuthLoginCommand", () => { const runtime = createRuntime(); const runOauthAuth = vi.fn().mockResolvedValue({ profiles: [] }); const runApiKeyAuth = vi.fn().mockResolvedValue({ profiles: [] }); - mocks.resolvePluginSetupProvider.mockReturnValue( + mocks.resolvePluginSetupProviderCore.mockReturnValue( createProvider({ id: "openai", label: "OpenAI", @@ -1684,7 +1684,7 @@ describe("modelsAuthLoginCommand", () => { }, ], }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ { id: "moonshot", label: "Moonshot", @@ -1728,7 +1728,7 @@ describe("modelsAuthLoginCommand", () => { }, ], }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ { id: "moonshot", label: "Moonshot", @@ -1769,7 +1769,7 @@ describe("modelsAuthLoginCommand", () => { }, ], }); - mocks.resolvePluginProviders.mockReturnValue([ + mocks.resolvePluginProvidersCore.mockReturnValue([ { id: "moonshot", label: "Moonshot", @@ -1799,7 +1799,7 @@ describe("modelsAuthLoginCommand", () => { it("keeps the requested agent store when interactive auth add falls back to paste-token", async () => { const runtime = createRuntime(); useCoderAgentConfig(); - mocks.resolvePluginProviders.mockReturnValue([]); + mocks.resolvePluginProvidersCore.mockReturnValue([]); mocks.clackSelect.mockResolvedValue("custom"); mocks.clackText.mockResolvedValueOnce("openai").mockResolvedValueOnce("openai:manual"); mocks.clackPassword.mockResolvedValue("openai-token"); diff --git a/src/commands/models/auth.ts b/src/commands/models/auth.ts index 137bab2a5d25..0cfc10c85801 100644 --- a/src/commands/models/auth.ts +++ b/src/commands/models/auth.ts @@ -51,9 +51,9 @@ import { } from "../../plugins/provider-auth-choice-helpers.js"; import { applyAuthProfileConfig } from "../../plugins/provider-auth-helpers.js"; import { createVpsAwareOAuthHandlers } from "../../plugins/provider-oauth-flow.js"; -import { resolvePluginProviders } from "../../plugins/providers.runtime.js"; +import { resolvePluginProvidersCore } from "../../plugins/providers.runtime.js"; import { - resolvePluginSetupProvider, + resolvePluginSetupProviderCore, resolvePluginSetupRegistry, } from "../../plugins/setup-registry.js"; import type { @@ -248,7 +248,7 @@ function preferSetupAuthProviders(params: { ? normalizeManualAuthProvider(params.requestedProvider) : undefined; if (requestedProvider) { - const setupProvider = resolvePluginSetupProvider({ + const setupProvider = resolvePluginSetupProviderCore({ provider: requestedProvider, config: params.config, workspaceDir: params.workspaceDir, @@ -279,7 +279,7 @@ async function resolveModelsAuthContext(params?: { const providerRef = requestedProvider ? normalizeManualAuthProvider(requestedProvider) : undefined; - const providers = resolvePluginProviders({ + const providers = resolvePluginProvidersCore({ config, workspaceDir, mode: "setup", diff --git a/src/commands/models/list.configured.test.ts b/src/commands/models/list.configured.test.ts index 0578a9749c39..3083f1b79dfd 100644 --- a/src/commands/models/list.configured.test.ts +++ b/src/commands/models/list.configured.test.ts @@ -31,7 +31,7 @@ vi.mock("../../agents/prepared-model-catalog.js", () => ({ })); vi.mock("../../agents/model-suppression.js", () => ({ - shouldSuppressBuiltInModel: vi.fn(() => false), + shouldSuppressBuiltInModelCore: vi.fn(() => false), shouldSuppressBuiltInModelFromManifest: mocks.shouldSuppressBuiltInModelFromManifest, })); diff --git a/src/commands/models/list.list-command.forward-compat.test.ts b/src/commands/models/list.list-command.forward-compat.test.ts index aab20e541091..13bf1de6b174 100644 --- a/src/commands/models/list.list-command.forward-compat.test.ts +++ b/src/commands/models/list.list-command.forward-compat.test.ts @@ -217,7 +217,7 @@ function installModelsListCommandForwardCompatMocks() { id === "gpt-5.3-codex-spark"; vi.doMock("../../agents/model-suppression.js", () => ({ - shouldSuppressBuiltInModel: suppressOpenAiSpark, + shouldSuppressBuiltInModelCore: suppressOpenAiSpark, shouldSuppressBuiltInModelFromManifest: suppressOpenAiSpark, createManifestBuiltInModelSuppressor: vi.fn( () => (model: { provider?: string | null; id?: string | null }) => suppressOpenAiSpark(model), diff --git a/src/commands/models/list.registry-load.ts b/src/commands/models/list.registry-load.ts index 9227dc91bb6e..a321791f5965 100644 --- a/src/commands/models/list.registry-load.ts +++ b/src/commands/models/list.registry-load.ts @@ -1,5 +1,5 @@ import { modelKey } from "../../agents/model-ref-shared.js"; -import { shouldSuppressBuiltInModel } from "../../agents/model-suppression.js"; +import { shouldSuppressBuiltInModelCore } from "../../agents/model-suppression.js"; /** Registry-loading adapters for model-list row construction. */ import { loadPreparedAgentModelRegistry as loadAgentModelRegistry } from "../../agents/prepared-model-registry.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; @@ -37,7 +37,7 @@ function findConfiguredRegistryModel(params: { return undefined; } if ( - shouldSuppressBuiltInModel({ + shouldSuppressBuiltInModelCore({ provider: model.provider, id: model.id, baseUrl: model.baseUrl, diff --git a/src/commands/models/list.registry.ts b/src/commands/models/list.registry.ts index db915371fb53..e8c3ffd0f65e 100644 --- a/src/commands/models/list.registry.ts +++ b/src/commands/models/list.registry.ts @@ -1,6 +1,6 @@ import { modelKey } from "../../agents/model-ref-shared.js"; import { - shouldSuppressBuiltInModel, + shouldSuppressBuiltInModelCore, shouldSuppressBuiltInModelFromManifest, } from "../../agents/model-suppression.js"; /** Model registry access helpers for `openclaw models list`. */ @@ -72,7 +72,7 @@ function loadAvailableModels( baseUrl: model.baseUrl, config: cfg, }) - : !shouldSuppressBuiltInModel({ + : !shouldSuppressBuiltInModelCore({ provider: model.provider, id: model.id, baseUrl: model.baseUrl, @@ -108,7 +108,7 @@ export async function loadModelRegistry( }); const models = registry.getAll().filter((model) => runtimeSuppression - ? !shouldSuppressBuiltInModel({ + ? !shouldSuppressBuiltInModelCore({ provider: model.provider, id: model.id, baseUrl: model.baseUrl, diff --git a/src/commands/models/list.rows.test.ts b/src/commands/models/list.rows.test.ts index dbaa33223aa9..25778f29e62d 100644 --- a/src/commands/models/list.rows.test.ts +++ b/src/commands/models/list.rows.test.ts @@ -8,14 +8,14 @@ const mocks = vi.hoisted(() => ({ loadScopedModelCatalogSnapshot: vi.fn(), normalizeProviderResolvedModelWithPlugin: vi.fn(() => undefined), resolveBundledProviderPolicySurface: vi.fn(() => null), - shouldSuppressBuiltInModel: vi.fn(() => { + shouldSuppressBuiltInModelCore: vi.fn(() => { throw new Error("runtime model suppression should be skipped"); }), shouldSuppressBuiltInModelFromManifest: vi.fn(() => false), })); vi.mock("../../agents/model-suppression.js", () => ({ - shouldSuppressBuiltInModel: mocks.shouldSuppressBuiltInModel, + shouldSuppressBuiltInModelCore: mocks.shouldSuppressBuiltInModelCore, shouldSuppressBuiltInModelFromManifest: mocks.shouldSuppressBuiltInModelFromManifest, })); @@ -565,7 +565,7 @@ describe("prepared provider catalog projection", () => { }, }); - expect(mocks.shouldSuppressBuiltInModel).not.toHaveBeenCalled(); + expect(mocks.shouldSuppressBuiltInModelCore).not.toHaveBeenCalled(); expect(mocks.shouldSuppressBuiltInModelFromManifest).toHaveBeenCalledWith({ provider: "openai", id: "gpt-5.3-codex-spark", diff --git a/src/commands/models/list.rows.ts b/src/commands/models/list.rows.ts index d38792635ff1..38fa3e9cd82c 100644 --- a/src/commands/models/list.rows.ts +++ b/src/commands/models/list.rows.ts @@ -16,7 +16,7 @@ import { } from "../../agents/model-ref-shared.js"; import { modelCatalogLogicalKey } from "../../agents/model-selection-shared.js"; import { - shouldSuppressBuiltInModel, + shouldSuppressBuiltInModelCore, shouldSuppressBuiltInModelFromManifest, } from "../../agents/model-suppression.js"; import { openAIModelCatalogRoutePolicy } from "../../agents/openai-model-routes.js"; @@ -235,7 +235,7 @@ function shouldSuppressListModel(params: { config: params.context.cfg, }); } - return shouldSuppressBuiltInModel({ + return shouldSuppressBuiltInModelCore({ provider: params.model.provider, id: params.model.id, baseUrl: params.model.baseUrl, diff --git a/src/commands/models/provider-aliases.ts b/src/commands/models/provider-aliases.ts index 0e77b74b3edc..1674c0ef37ad 100644 --- a/src/commands/models/provider-aliases.ts +++ b/src/commands/models/provider-aliases.ts @@ -4,7 +4,7 @@ import path from "node:path"; import { normalizeProviderId } from "@openclaw/model-catalog-core/provider-id"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; import { - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, type PluginManifestRecord, } from "../../plugins/manifest-registry.js"; import { loadPluginManifest, type PluginManifestModelCatalog } from "../../plugins/manifest.js"; @@ -20,7 +20,7 @@ const sourcePeerModelCatalogCache = new Map ({ })); const manifestRegistryMocks = vi.hoisted(() => ({ - loadPluginManifestRegistry: vi.fn(() => ({ plugins: [], diagnostics: [] })), + loadPluginManifestRegistryCore: vi.fn(() => ({ plugins: [], diagnostics: [] })), })); function createPrompter(overrides: Partial): WizardPrompter { @@ -515,7 +515,7 @@ vi.mock("../plugins/manifest-registry.js", async () => { ); return { ...actual, - loadPluginManifestRegistry: manifestRegistryMocks.loadPluginManifestRegistry, + loadPluginManifestRegistryCore: manifestRegistryMocks.loadPluginManifestRegistryCore, }; }); @@ -610,8 +610,8 @@ describe("setupChannels", () => { setMinimalOnboardingRegistryForTests(); catalogMocks.listChannelPluginCatalogEntries.mockReset(); catalogMocks.listChannelPluginCatalogEntries.mockReturnValue([]); - manifestRegistryMocks.loadPluginManifestRegistry.mockReset(); - manifestRegistryMocks.loadPluginManifestRegistry.mockReturnValue({ + manifestRegistryMocks.loadPluginManifestRegistryCore.mockReset(); + manifestRegistryMocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [], diagnostics: [], }); diff --git a/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.runtime.ts b/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.runtime.ts index 994418f29594..321cf880deb5 100644 --- a/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.runtime.ts +++ b/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.runtime.ts @@ -4,13 +4,13 @@ * Kept behind a lazy boundary so ordinary local setup can infer core auth * choices without loading plugin provider discovery. */ -import { resolveProviderPluginChoice } from "../../../plugins/provider-wizard.js"; +import { resolveProviderPluginChoiceCore } from "../../../plugins/provider-wizard.js"; import { resolveOwningPluginIdsForProviderRef } from "../../../plugins/providers.js"; -import { resolvePluginProviders } from "../../../plugins/providers.runtime.js"; +import { resolvePluginProvidersCore } from "../../../plugins/providers.runtime.js"; /** Provider discovery surface used by non-interactive auth-choice handling. */ export const authChoicePluginProvidersRuntime = { resolveOwningPluginIdsForProviderRef, - resolveProviderPluginChoice, - resolvePluginProviders, + resolveProviderPluginChoice: resolveProviderPluginChoiceCore, + resolvePluginProviders: resolvePluginProvidersCore, }; diff --git a/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.test.ts b/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.test.ts index abfa3ced59df..97fcc63419cf 100644 --- a/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.test.ts +++ b/src/commands/onboard-non-interactive/local/auth-choice.plugin-providers.test.ts @@ -60,12 +60,12 @@ vi.mock("../../onboarding-plugin-install.js", () => ({ const resolveOwningPluginIdsForProvider = vi.hoisted(() => vi.fn(() => undefined)); const resolveProviderPluginChoice = vi.hoisted(() => vi.fn()); -const resolvePluginProviders = vi.hoisted(() => vi.fn(() => [])); +const resolvePluginProvidersCore = vi.hoisted(() => vi.fn(() => [])); vi.mock("./auth-choice.plugin-providers.runtime.js", () => ({ authChoicePluginProvidersRuntime: { resolveOwningPluginIdsForProviderRef: resolveOwningPluginIdsForProvider, resolveProviderPluginChoice, - resolvePluginProviders, + resolvePluginProviders: resolvePluginProvidersCore, }, })); @@ -78,7 +78,7 @@ beforeEach(() => { ensureOnboardingPluginInstalled.mockResolvedValue(undefined); resolveOwningPluginIdsForProvider.mockReturnValue(undefined as never); resolveProviderPluginChoice.mockReturnValue(undefined); - resolvePluginProviders.mockReturnValue([] as never); + resolvePluginProvidersCore.mockReturnValue([] as never); ensureCodexRuntimePluginForModelSelection.mockImplementation(async ({ cfg }) => ({ cfg, required: false, @@ -161,7 +161,7 @@ async function applyProviderModelChoice(params: { }, }, })); - resolvePluginProviders.mockReturnValue([provider] as never); + resolvePluginProvidersCore.mockReturnValue([provider] as never); resolveProviderPluginChoice.mockReturnValue({ provider, method: { runNonInteractive }, @@ -253,7 +253,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { const runtime = createRuntime(); const runNonInteractive = vi.fn(async () => ({ plugins: { allow: ["vllm"] } })); resolveOwningPluginIdsForProvider.mockReturnValue(["vllm"] as never); - resolvePluginProviders.mockReturnValue([{ id: "vllm", pluginId: "vllm" }] as never); + resolvePluginProvidersCore.mockReturnValue([{ id: "vllm", pluginId: "vllm" }] as never); resolveProviderPluginChoice.mockReturnValue({ provider: { id: "vllm", pluginId: "vllm", label: "vLLM" }, method: { runNonInteractive }, @@ -273,8 +273,8 @@ describe("applyNonInteractivePluginProviderChoice", () => { expect(resolveOwningPluginIdsForProvider).toHaveBeenCalledOnce(); expect(resolvePreferredProviderForAuthChoice).not.toHaveBeenCalled(); expect(mockArg(resolveOwningPluginIdsForProvider).provider).toBe("vllm"); - expect(resolvePluginProviders).toHaveBeenCalledOnce(); - const providersInput = mockArg(resolvePluginProviders); + expect(resolvePluginProvidersCore).toHaveBeenCalledOnce(); + const providersInput = mockArg(resolvePluginProvidersCore); expect(providersInput.onlyPluginIds).toEqual(["vllm"]); expect(providersInput.includeUntrustedWorkspacePlugins).toBe(false); expect(resolveProviderPluginChoice).toHaveBeenCalledOnce(); @@ -319,7 +319,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { pluginId: "groq", status: "installed", }); - resolvePluginProviders.mockReturnValue([provider] as never); + resolvePluginProvidersCore.mockReturnValue([provider] as never); resolveProviderPluginChoice.mockReturnValueOnce(undefined).mockReturnValue({ provider, method: { runNonInteractive }, @@ -357,7 +357,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { promptInstall: false, }), ); - expect(resolvePluginProviders).toHaveBeenCalledTimes(2); + expect(resolvePluginProvidersCore).toHaveBeenCalledTimes(2); expect(runNonInteractive).toHaveBeenCalledOnce(); expect(result).toMatchObject({ agents: { @@ -448,9 +448,9 @@ describe("applyNonInteractivePluginProviderChoice", () => { 'Auth choice "workspace-provider-api-key" matched a provider plugin that is not trusted or enabled for setup.', ); expect(runtime.exit).toHaveBeenCalledWith(1); - expect(mockArg(resolvePluginProviders).includeUntrustedWorkspacePlugins).toBe(false); + expect(mockArg(resolvePluginProvidersCore).includeUntrustedWorkspacePlugins).toBe(false); expect(resolveProviderPluginChoice).toHaveBeenCalledTimes(1); - expect(resolvePluginProviders).toHaveBeenCalledTimes(1); + expect(resolvePluginProvidersCore).toHaveBeenCalledTimes(1); expect(mockCall(resolveManifestProviderAuthChoice, 0)[0]).toBe("workspace-provider-api-key"); const trustedManifestInput = mockArg(resolveManifestProviderAuthChoice, 0, 1); expect(trustedManifestInput.includeUntrustedWorkspacePlugins).toBe(false); @@ -465,7 +465,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { const runtime = createRuntime(); const runNonInteractive = vi.fn(async () => ({ plugins: { allow: ["demo-plugin"] } })); resolveOwningPluginIdsForProvider.mockReturnValue(["demo-plugin"] as never); - resolvePluginProviders.mockReturnValue([ + resolvePluginProvidersCore.mockReturnValue([ { id: "demo-provider", pluginId: "demo-plugin" }, ] as never); resolveProviderPluginChoice.mockReturnValue({ @@ -484,7 +484,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { toApiKeyCredential: vi.fn(), }); - const providersInput = mockArg(resolvePluginProviders); + const providersInput = mockArg(resolvePluginProvidersCore); expectConfigDefaults(providersInput.config); expect(providersInput.onlyPluginIds).toEqual(["demo-plugin"]); expect(providersInput.includeUntrustedWorkspacePlugins).toBe(false); @@ -510,7 +510,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { const preferenceInput = mockArg(resolvePreferredProviderForAuthChoice); expect(preferenceInput.choice).toBe("openai-api-key"); expect(preferenceInput.includeUntrustedWorkspacePlugins).toBe(false); - expect(mockArg(resolvePluginProviders).includeUntrustedWorkspacePlugins).toBe(false); + expect(mockArg(resolvePluginProvidersCore).includeUntrustedWorkspacePlugins).toBe(false); }); it("ensures Codex after a non-interactive OpenAI provider choice sets the default model", async () => { @@ -528,7 +528,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { required: true, installed: true, }); - resolvePluginProviders.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never); + resolvePluginProvidersCore.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never); resolveProviderPluginChoice.mockReturnValue({ provider: { id: "openai", pluginId: "openai", label: "OpenAI" }, method: { runNonInteractive }, @@ -579,7 +579,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { required: true, installed: true, }); - resolvePluginProviders.mockReturnValue([ + resolvePluginProvidersCore.mockReturnValue([ { id: "github-copilot", pluginId: "github-copilot" }, ] as never); resolveProviderPluginChoice.mockReturnValue({ @@ -617,7 +617,7 @@ describe("applyNonInteractivePluginProviderChoice", () => { required: false, installed: false, }); - resolvePluginProviders.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never); + resolvePluginProvidersCore.mockReturnValue([{ id: "openai", pluginId: "openai" }] as never); resolveProviderPluginChoice.mockReturnValue({ provider: { id: "openai", pluginId: "openai", label: "OpenAI" }, method: { runNonInteractive }, diff --git a/src/config/config.web-search-provider.test.ts b/src/config/config.web-search-provider.test.ts index f92bbd768604..6e4f7f6a4fe9 100644 --- a/src/config/config.web-search-provider.test.ts +++ b/src/config/config.web-search-provider.test.ts @@ -162,7 +162,7 @@ vi.mock("../plugins/manifest-registry.js", () => { }); return { - loadPluginManifestRegistry: () => ({ + loadPluginManifestRegistryCore: () => ({ plugins: [ { id: "brave", diff --git a/src/config/doc-baseline.runtime.ts b/src/config/doc-baseline.runtime.ts index c39914f0fc5c..1f9e87487e08 100644 --- a/src/config/doc-baseline.runtime.ts +++ b/src/config/doc-baseline.runtime.ts @@ -1,6 +1,6 @@ // Collects runtime data needed to generate config documentation baselines. import { collectBundledChannelConfigsCore } from "../plugins/bundled-channel-config-metadata.js"; -import { loadPluginManifestRegistry as loadPluginManifestRegistryImpl } from "../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore as loadPluginManifestRegistryImpl } from "../plugins/manifest-registry.js"; import { collectChannelSchemaMetadataCore, collectPluginSchemaMetadataCore, diff --git a/src/config/io.write-config.test.ts b/src/config/io.write-config.test.ts index 28e19b202362..717aa09fe952 100644 --- a/src/config/io.write-config.test.ts +++ b/src/config/io.write-config.test.ts @@ -52,7 +52,7 @@ const mockMaintainConfigBackups = vi.hoisted(() => ); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: mockLoadPluginManifestRegistry, + loadPluginManifestRegistryCore: mockLoadPluginManifestRegistry, })); vi.mock("../plugins/plugin-registry.js", async (importOriginal) => { diff --git a/src/config/runtime-schema.test.ts b/src/config/runtime-schema.test.ts index 6b882029ee78..ec2ef3dcafa7 100644 --- a/src/config/runtime-schema.test.ts +++ b/src/config/runtime-schema.test.ts @@ -34,7 +34,7 @@ vi.mock("./config.js", () => { }); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: (...args: unknown[]) => mockLoadPluginManifestRegistry(...args), + loadPluginManifestRegistryCore: (...args: unknown[]) => mockLoadPluginManifestRegistry(...args), })); vi.mock("../plugins/plugin-registry.js", () => ({ diff --git a/src/config/sessions.ts b/src/config/sessions.ts index d117cbae9013..8f513a7e9d5b 100644 --- a/src/config/sessions.ts +++ b/src/config/sessions.ts @@ -17,7 +17,7 @@ export { resolveSessionEntryCandidateTarget, } from "./sessions/session-accessor.js"; export * from "./sessions/session-key.js"; -export { resolveSessionStoreEntry } from "./sessions/store-entry.js"; +export { resolveSessionStoreEntryCore } from "./sessions/store-entry.js"; export * from "./sessions/types.js"; export * from "./sessions/transcript.js"; export * from "./sessions/session-registry-maintenance.js"; diff --git a/src/config/sessions/session-accessor.entry.ts b/src/config/sessions/session-accessor.entry.ts index 4559415910ca..04f4bd68258c 100644 --- a/src/config/sessions/session-accessor.entry.ts +++ b/src/config/sessions/session-accessor.entry.ts @@ -56,7 +56,7 @@ import { canonicalSessionKeyMigrationRequiredError } from "./session-canonical-k import { resolveSessionStorePathForScope } from "./session-store-path.js"; import { normalizeStoreSessionKey, - resolveSessionStoreEntry as resolveSessionEntryFromStore, + resolveSessionStoreEntryCore as resolveSessionEntryFromStore, } from "./store-entry.js"; import { resolveAllAgentSessionStoreTargetsSync, type SessionStoreTarget } from "./targets.js"; import type { SessionEntry } from "./types.js"; diff --git a/src/config/sessions/store-entry.ts b/src/config/sessions/store-entry.ts index 6917ac82bdc0..08ece4190526 100644 --- a/src/config/sessions/store-entry.ts +++ b/src/config/sessions/store-entry.ts @@ -275,7 +275,7 @@ function resolveSessionEntryCandidates(params: { }; } -export function resolveSessionStoreEntry(params: { +export function resolveSessionStoreEntryCore(params: { store: Record; sessionKey: string; }): { diff --git a/src/config/validation.channel-metadata.test.ts b/src/config/validation.channel-metadata.test.ts index 12e6e163052a..38ae99d02a70 100644 --- a/src/config/validation.channel-metadata.test.ts +++ b/src/config/validation.channel-metadata.test.ts @@ -242,7 +242,7 @@ function createPluginManifestRecord( } vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: () => mockLoadPluginManifestRegistry(), + loadPluginManifestRegistryCore: () => mockLoadPluginManifestRegistry(), resolveManifestContractPluginIds: () => [], })); diff --git a/src/cron/isolated-agent.model-formatting.test.ts b/src/cron/isolated-agent.model-formatting.test.ts index 75f53d58940f..5a749ccada28 100644 --- a/src/cron/isolated-agent.model-formatting.test.ts +++ b/src/cron/isolated-agent.model-formatting.test.ts @@ -46,7 +46,7 @@ vi.mock("./isolated-agent/run-model-selection.runtime.js", () => ({ cfg: { agents?: { list?: Array } }, agentId: string, ) => cfg.agents?.list?.find((agent) => agent.id === agentId)?.workspace ?? "/tmp/workspace", - resolveAllowedModelRef: resolveAllowedModelRefMock, + resolveAllowedModelRefCore: resolveAllowedModelRefMock, resolveConfiguredModelRef: resolveConfiguredModelRefMock, resolveHooksGmailModel: resolveHooksGmailModelMock, resolveSubagentModelConfigSelectionResult: ({ diff --git a/src/cron/isolated-agent/model-selection.ts b/src/cron/isolated-agent/model-selection.ts index 48a350aa718d..138b37313ff2 100644 --- a/src/cron/isolated-agent/model-selection.ts +++ b/src/cron/isolated-agent/model-selection.ts @@ -20,7 +20,7 @@ import { normalizeModelSelection, publishedModelCatalogOwnerMatchesAgent, resolveAgentConfig, - resolveAllowedModelRef, + resolveAllowedModelRefCore, resolveConfiguredModelRef, resolveHooksGmailModel, resolveSubagentModelConfigSelectionResult, @@ -228,7 +228,7 @@ export async function resolveCronModelSelection( if (subagentModelRaw) { // Subagent/agent model config is advisory here: invalid refs fall back to // defaults so an agent config typo does not prevent unrelated cron runs. - const resolvedSubagent = resolveAllowedModelRef({ + const resolvedSubagent = resolveAllowedModelRefCore({ cfg: owner.config, catalog, raw: subagentModelRaw, @@ -274,7 +274,7 @@ export async function resolveCronModelSelection( if (modelOverride !== undefined && modelOverride.length > 0) { // Payload model overrides are explicit cron config, so reject disallowed // refs instead of silently falling back to defaults. - const resolvedOverride = resolveAllowedModelRef({ + const resolvedOverride = resolveAllowedModelRefCore({ cfg: owner.config, catalog, raw: modelOverride, @@ -305,7 +305,7 @@ export async function resolveCronModelSelection( // and hook-specific models can intentionally move a run away from history. const sessionProviderOverride = params.sessionEntry.providerOverride?.trim() || resolvedDefault.provider; - const resolvedSessionOverride = resolveAllowedModelRef({ + const resolvedSessionOverride = resolveAllowedModelRefCore({ cfg: owner.config, catalog, raw: `${sessionProviderOverride}/${sessionModelOverride}`, diff --git a/src/cron/isolated-agent/run-model-selection.runtime.ts b/src/cron/isolated-agent/run-model-selection.runtime.ts index 281fee5a9a03..08546d1c065f 100644 --- a/src/cron/isolated-agent/run-model-selection.runtime.ts +++ b/src/cron/isolated-agent/run-model-selection.runtime.ts @@ -11,7 +11,7 @@ export type { ResolvedPublishedModelCatalogOwner } from "../../agents/prepared-m export { getModelRefStatus, normalizeModelSelection, - resolveAllowedModelRef, + resolveAllowedModelRefCore, resolveConfiguredModelRef, resolveHooksGmailModel, } from "../../agents/model-selection-resolve.js"; diff --git a/src/cron/isolated-agent/run.model-policy-config-preserved.test.ts b/src/cron/isolated-agent/run.model-policy-config-preserved.test.ts index a940713151a2..95de28a858c1 100644 --- a/src/cron/isolated-agent/run.model-policy-config-preserved.test.ts +++ b/src/cron/isolated-agent/run.model-policy-config-preserved.test.ts @@ -1,7 +1,7 @@ // Cron policy tests cover per-agent defaults flattening before model resolution. import { describe, expect, it } from "vitest"; import { resolveAgentConfig } from "../../agents/agent-scope.js"; -import { resolveAllowedModelRef } from "../../agents/model-selection-resolve.js"; +import { resolveAllowedModelRefCore } from "../../agents/model-selection-resolve.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; import { buildCronAgentDefaultsConfig } from "./run-config.js"; @@ -17,7 +17,7 @@ function buildCronConfig(cfg: OpenClawConfig, agentId: string): OpenClawConfig { } function resolveCronPayloadModel(cfg: OpenClawConfig, raw: string) { - return resolveAllowedModelRef({ + return resolveAllowedModelRefCore({ cfg, catalog: [ { provider: "openai", id: "gpt-5.5", name: "GPT 5.5" }, diff --git a/src/cron/isolated-agent/run.test-harness.ts b/src/cron/isolated-agent/run.test-harness.ts index e12866e99acd..b1c428367a9c 100644 --- a/src/cron/isolated-agent/run.test-harness.ts +++ b/src/cron/isolated-agent/run.test-harness.ts @@ -243,7 +243,7 @@ vi.mock("./run-model-selection.runtime.js", () => ({ resolveAgentWorkspaceDir: resolveAgentWorkspaceDirMock, getModelRefStatus: getModelRefStatusMock, normalizeModelSelection: normalizeModelSelectionForTest, - resolveAllowedModelRef: resolveAllowedModelRefMock, + resolveAllowedModelRefCore: resolveAllowedModelRefMock, resolveConfiguredModelRef: resolveConfiguredModelRefMock, resolveHooksGmailModel: resolveHooksGmailModelMock, resolveSubagentModelConfigSelectionResult: ({ diff --git a/src/flows/doctor-core-checks.runtime.test.ts b/src/flows/doctor-core-checks.runtime.test.ts index 70880f07ab1d..0c2691b3d6c1 100644 --- a/src/flows/doctor-core-checks.runtime.test.ts +++ b/src/flows/doctor-core-checks.runtime.test.ts @@ -14,7 +14,7 @@ const mocks = vi.hoisted(() => ({ probeGatewayStatus: vi.fn(), readGatewayServiceState: vi.fn(), resolveGatewayService: vi.fn(() => ({ label: "openclaw-gateway" })), - resolvePluginProviders: vi.fn((): Array> => []), + resolvePluginProvidersCore: vi.fn((): Array> => []), resolveDefaultModelForAgent: vi.fn(() => ({ provider: "openai", model: "gpt-5.5" })), })); @@ -67,7 +67,7 @@ vi.mock("../plugins/provider-discovery.js", async (importOriginal) => ({ })); vi.mock("../plugins/providers.runtime.js", () => ({ - resolvePluginProviders: mocks.resolvePluginProviders, + resolvePluginProvidersCore: mocks.resolvePluginProvidersCore, })); const { @@ -121,7 +121,7 @@ describe("doctor runtime tool schema checks", () => { runtime: { status: "running" }, }); mocks.resolveGatewayService.mockClear(); - mocks.resolvePluginProviders.mockReset().mockReturnValue([]); + mocks.resolvePluginProvidersCore.mockReset().mockReturnValue([]); mocks.resolveDefaultModelForAgent.mockClear(); }); @@ -669,7 +669,7 @@ describe("doctor gateway runtime checks", () => { describe("doctor provider catalog projection checks", () => { beforeEach(() => { - mocks.resolvePluginProviders.mockReset().mockReturnValue([]); + mocks.resolvePluginProvidersCore.mockReset().mockReturnValue([]); }); it("reports provider catalog rows that fail unified text projection", async () => { @@ -689,7 +689,7 @@ describe("doctor provider catalog projection checks", () => { }, }, ); - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -717,7 +717,7 @@ describe("doctor provider catalog projection checks", () => { it("loads full provider registrations for static catalog validation", async () => { await collectProviderCatalogProjectionFindings({}); - expect(mocks.resolvePluginProviders).toHaveBeenCalledWith( + expect(mocks.resolvePluginProvidersCore).toHaveBeenCalledWith( expect.not.objectContaining({ discoveryEntriesOnly: true, }), @@ -725,7 +725,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports provider catalog model rows with invalid ids", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -760,7 +760,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports whitespace-only provider catalog model ids", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -795,7 +795,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports provider catalog model rows with invalid names", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -828,7 +828,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports provider catalog model lists with invalid shapes", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -867,7 +867,7 @@ describe("doctor provider catalog projection checks", () => { throw new Error("model iterator failed"); }, }); - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -901,7 +901,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports provider catalog results without provider containers", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -927,7 +927,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports invalid multi-provider catalog keys", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -961,7 +961,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports falsy non-empty provider catalog results", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -987,7 +987,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports invalid provider catalog orders without aborting doctor", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -1032,7 +1032,7 @@ describe("doctor provider catalog projection checks", () => { }); it("validates static catalog rows when live catalog order access fails", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -1069,7 +1069,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports static catalog hook access failures without aborting doctor", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -1098,7 +1098,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports static catalog hooks with non-function run values", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -1132,7 +1132,7 @@ describe("doctor provider catalog projection checks", () => { {}, ); revoke(); - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", @@ -1160,7 +1160,7 @@ describe("doctor provider catalog projection checks", () => { }); it("reports present but invalid single-provider catalog branches", async () => { - mocks.resolvePluginProviders.mockReturnValueOnce([ + mocks.resolvePluginProvidersCore.mockReturnValueOnce([ { id: "mockplugin", pluginId: "mockplugin", diff --git a/src/flows/doctor-core-checks.runtime.ts b/src/flows/doctor-core-checks.runtime.ts index 1121dafe65d0..1f800c6ec73c 100644 --- a/src/flows/doctor-core-checks.runtime.ts +++ b/src/flows/doctor-core-checks.runtime.ts @@ -620,12 +620,12 @@ export async function collectProviderCatalogProjectionFindings( cfg: OpenClawConfig, ): Promise { const { runProviderStaticCatalog } = await import("../plugins/provider-discovery.js"); - const { resolvePluginProviders } = await import("../plugins/providers.runtime.js"); + const { resolvePluginProvidersCore } = await import("../plugins/providers.runtime.js"); const env = process.env; const workspaceDir = resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg)); - let providers: Awaited>; + let providers: Awaited>; try { - providers = resolvePluginProviders({ + providers = resolvePluginProvidersCore({ config: cfg, workspaceDir, env, diff --git a/src/flows/provider-flow.runtime.ts b/src/flows/provider-flow.runtime.ts index 649e7c29dcd4..3bf78bb63aa0 100644 --- a/src/flows/provider-flow.runtime.ts +++ b/src/flows/provider-flow.runtime.ts @@ -27,7 +27,7 @@ function resolveProviderDocsById(params?: { }): Map { return new Map( providersRuntime - .resolvePluginProviders({ + .resolvePluginProvidersCore({ config: params?.config, workspaceDir: params?.workspaceDir, env: params?.env, diff --git a/src/flows/provider-flow.test.ts b/src/flows/provider-flow.test.ts index 994720d7874f..816f50e3ed1f 100644 --- a/src/flows/provider-flow.test.ts +++ b/src/flows/provider-flow.test.ts @@ -10,7 +10,7 @@ type ResolveProviderWizardOptions = type ResolveProviderModelPickerEntries = typeof import("../plugins/provider-wizard.js").resolveProviderModelPickerEntries; type ResolvePluginProviders = - typeof import("../plugins/providers.runtime.js").resolvePluginProviders; + typeof import("../plugins/providers.runtime.js").resolvePluginProvidersCore; type ResolveProviderSetupFlowContributions = typeof import("./provider-flow.js").resolveProviderSetupFlowContributions; type ResolveProviderModelPickerFlowContributions = @@ -41,9 +41,9 @@ vi.mock("../plugins/provider-wizard.js", () => ({ resolveProviderModelPickerEntries, })); -const resolvePluginProviders = vi.hoisted(() => vi.fn(() => [])); +const resolvePluginProvidersCore = vi.hoisted(() => vi.fn(() => [])); vi.mock("../plugins/providers.runtime.js", () => ({ - resolvePluginProviders, + resolvePluginProvidersCore, })); let resolveProviderSetupFlowContributions: ResolveProviderSetupFlowContributions; @@ -68,8 +68,8 @@ describe("provider flow install catalog contributions", () => { resolveProviderWizardOptions.mockReturnValue([]); resolveProviderModelPickerEntries.mockReset(); resolveProviderModelPickerEntries.mockReturnValue([]); - resolvePluginProviders.mockReset(); - resolvePluginProviders.mockReturnValue([]); + resolvePluginProvidersCore.mockReset(); + resolvePluginProvidersCore.mockReturnValue([]); ({ resolveProviderSetupFlowContributions } = await import("./provider-flow.js")); ({ resolveProviderModelPickerFlowContributions } = await import("./provider-flow.runtime.js")); }); @@ -125,7 +125,7 @@ describe("provider flow install catalog contributions", () => { .includeUntrustedWorkspacePlugins, ).toBe(false); expect(resolveProviderWizardOptions).not.toHaveBeenCalled(); - expect(resolvePluginProviders).not.toHaveBeenCalled(); + expect(resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("prefers manifest setup contributions over duplicate install-catalog entries", () => { @@ -361,11 +361,11 @@ describe("provider flow install catalog contributions", () => { }, ]); expect(resolveProviderWizardOptions).not.toHaveBeenCalled(); - expect(resolvePluginProviders).not.toHaveBeenCalled(); + expect(resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("keeps docs attached to runtime model-picker contributions", () => { - resolvePluginProviders.mockReturnValue([ + resolvePluginProvidersCore.mockReturnValue([ { id: "openai", label: "OpenAI", diff --git a/src/gateway/gateway-models.profiles.live.test.ts b/src/gateway/gateway-models.profiles.live.test.ts index b9930b2e20d0..a90aeee65edd 100644 --- a/src/gateway/gateway-models.profiles.live.test.ts +++ b/src/gateway/gateway-models.profiles.live.test.ts @@ -56,7 +56,7 @@ import { } from "../agents/live-test-provider-drift.test-support.js"; import { getApiKeyForModelCore, resolveEnvApiKey } from "../agents/model-auth.js"; import { normalizeProviderId } from "../agents/model-selection.js"; -import { shouldSuppressBuiltInModel } from "../agents/model-suppression.js"; +import { shouldSuppressBuiltInModelCore } from "../agents/model-suppression.js"; import { ensureOpenClawModelsJson } from "../agents/models-config.js"; import { STREAM_ERROR_FALLBACK_TEXT } from "../agents/stream-message-shared.js"; import { appendPrioritizedDynamicLiveModels } from "../agents/test-helpers/live-model-dynamic-candidates.js"; @@ -5617,7 +5617,7 @@ describeLive("gateway live (dev agent, profile keys)", () => { const candidates: Array = []; const skipped: Array<{ model: string; error: string }> = []; for (const model of wanted) { - if (shouldSuppressBuiltInModel({ provider: model.provider, id: model.id })) { + if (shouldSuppressBuiltInModelCore({ provider: model.provider, id: model.id })) { continue; } if (!targetMatcher.matchesProvider(model.provider)) { diff --git a/src/infra/heartbeat-runner-config.ts b/src/infra/heartbeat-runner-config.ts index 9b371365040d..3a411a4410a7 100644 --- a/src/infra/heartbeat-runner-config.ts +++ b/src/infra/heartbeat-runner-config.ts @@ -10,7 +10,7 @@ import { resolveModelRefFromString, type ModelRef } from "../agents/model-select import { resolveEffectiveAgentRuntime } from "../agents/thinking-runtime.js"; import { DEFAULT_HEARTBEAT_ACK_MAX_CHARS, - resolveHeartbeatPrompt as resolveHeartbeatPromptText, + resolveHeartbeatPromptCore as resolveHeartbeatPromptText, resolveHeartbeatPromptForResponseTool, } from "../auto-reply/heartbeat.js"; import { resolveDefaultModel } from "../auto-reply/reply/directive-handling.defaults.js"; diff --git a/src/infra/heartbeat-summary.ts b/src/infra/heartbeat-summary.ts index 6785b042d9be..81143573830b 100644 --- a/src/infra/heartbeat-summary.ts +++ b/src/infra/heartbeat-summary.ts @@ -8,7 +8,7 @@ import { import { DEFAULT_HEARTBEAT_ACK_MAX_CHARS, DEFAULT_HEARTBEAT_EVERY, - resolveHeartbeatPrompt as resolveHeartbeatPromptText, + resolveHeartbeatPromptCore as resolveHeartbeatPromptText, } from "../auto-reply/heartbeat.js"; import { parseDurationMs } from "../cli/parse-duration.js"; import type { AgentDefaultsConfig } from "../config/types.agent-defaults.js"; diff --git a/src/infra/outbound/message-action-execution.ts b/src/infra/outbound/message-action-execution.ts index f5cfe10f843a..15ad632fb526 100644 --- a/src/infra/outbound/message-action-execution.ts +++ b/src/infra/outbound/message-action-execution.ts @@ -18,6 +18,7 @@ import type { import type { OpenClawConfig } from "../../config/types.openclaw.js"; import { normalizeMessagePresentation } from "../../interactive/payload.js"; import { createSubsystemLogger } from "../../logging/subsystem.js"; +import { readBooleanParam } from "../../plugin-sdk/boolean-param.js"; import { extractToolPayload } from "../../plugin-sdk/tool-payload.js"; import { resolvePollMaxSelections } from "../../polls.js"; import { createLazyRuntimeModule } from "../../shared/lazy-runtime.js"; @@ -30,7 +31,6 @@ import type { MessageActionResult, ResolvedActionContext, } from "./message-action-contracts.js"; -import { readBooleanParam } from "./message-action-params.js"; import { resolveAndApplyOutboundThreadId } from "./message-action-threading.js"; import { resolveOutboundMessageGatewayOptions } from "./message-gateway-options.js"; import { diff --git a/src/infra/outbound/message-action-params.ts b/src/infra/outbound/message-action-params.ts index 5e8b312b1b33..3c2fc858abe4 100644 --- a/src/infra/outbound/message-action-params.ts +++ b/src/infra/outbound/message-action-params.ts @@ -25,12 +25,9 @@ import { resolveOutboundAttachmentFromBuffer } from "../../media/outbound-attach import { MEDIA_MAX_BYTES } from "../../media/store.js"; import { loadWebMedia } from "../../media/web-media.js"; import { resolveSnakeCaseParamKey } from "../../param-key.js"; -import { readBooleanParam as readBooleanParamShared } from "../../plugin-sdk/boolean-param.js"; +import { readBooleanParam } from "../../plugin-sdk/boolean-param.js"; import { hasPotentialPluginActionParam } from "./message-action-param-keys.js"; -/** Shared boolean param reader used by message-action argument normalization. */ -export const readBooleanParam = readBooleanParamShared; - const BASE_ACTION_MEDIA_SOURCE_PARAM_KEYS = [ "media", "path", @@ -702,8 +699,8 @@ export async function hydrateAttachmentParamsForAction(params: { return; } const forceDocument = - readBooleanParamShared(params.args, "forceDocument") ?? - readBooleanParamShared(params.args, "asDocument") ?? + readBooleanParam(params.args, "forceDocument") ?? + readBooleanParam(params.args, "asDocument") ?? false; await hydrateAttachmentActionPayload({ cfg: params.cfg, diff --git a/src/infra/outbound/message-action-routing.ts b/src/infra/outbound/message-action-routing.ts index 7bcd01eaa219..d80826315a7d 100644 --- a/src/infra/outbound/message-action-routing.ts +++ b/src/infra/outbound/message-action-routing.ts @@ -16,6 +16,7 @@ import type { ChannelThreadingToolContext, } from "../../channels/plugins/types.public.js"; import type { OpenClawConfig } from "../../config/types.openclaw.js"; +import { readBooleanParam } from "../../plugin-sdk/boolean-param.js"; import { resolveFirstBoundAccountId } from "../../routing/bound-account-read.js"; import { readTrimmedStringAlias } from "../../utils/string-readers.js"; import { resolveMessageChannelSelection } from "./channel-selection.js"; @@ -26,7 +27,6 @@ import { resolveImplicitMessageActionTarget, } from "./message-action-normalization.js"; import { hasPotentialPluginActionParam } from "./message-action-param-keys.js"; -import { readBooleanParam } from "./message-action-params.js"; import { actionRequiresTarget } from "./message-action-spec.js"; import { enforceCrossContextPolicy } from "./outbound-policy.js"; import { normalizeTargetForProvider } from "./target-normalization.js"; diff --git a/src/infra/outbound/message-action-runner.ts b/src/infra/outbound/message-action-runner.ts index 06951d0175c2..3c3ebe15532e 100644 --- a/src/infra/outbound/message-action-runner.ts +++ b/src/infra/outbound/message-action-runner.ts @@ -11,6 +11,7 @@ import type { ReplyPayload } from "../../auto-reply/reply-payload.js"; import type { ChannelId } from "../../channels/plugins/types.public.js"; import { getAgentScopedMediaLocalRoots } from "../../media/local-roots.js"; import { resolveAgentScopedOutboundMediaAccess } from "../../media/read-capability.js"; +import { readBooleanParam } from "../../plugin-sdk/boolean-param.js"; import { hasPollCreationParams } from "../../poll-params.js"; import { INTERNAL_MESSAGE_CHANNEL } from "../../utils/message-channel.js"; import { formatErrorMessage } from "../errors.js"; @@ -34,7 +35,6 @@ import { normalizeSandboxMediaParams, parseInteractiveParam, parseJsonMessageParam, - readBooleanParam, resolveAttachmentMediaPolicy, resolveExtraActionMediaSourceParamKeys, } from "./message-action-params.js"; diff --git a/src/infra/outbound/message-action-send.ts b/src/infra/outbound/message-action-send.ts index 24f0101cf572..060dcdd6d64d 100644 --- a/src/infra/outbound/message-action-send.ts +++ b/src/infra/outbound/message-action-send.ts @@ -18,6 +18,7 @@ import { type ReplyPayloadDelivery, } from "../../interactive/payload.js"; import { resolveAgentScopedOutboundMediaAccess } from "../../media/read-capability.js"; +import { readBooleanParam } from "../../plugin-sdk/boolean-param.js"; import { stripUnsupportedCitationControlMarkers } from "../../shared/text/citation-control-markers.js"; import { findCodeRegions } from "../../shared/text/code-regions.js"; import { stripFormattedReasoningMessage } from "../../shared/text/formatted-reasoning-message.js"; @@ -38,7 +39,6 @@ import { collectActionMediaSourceHints, collectAttachmentSources, normalizeSandboxMediaList, - readBooleanParam, } from "./message-action-params.js"; import { prepareOutboundMirrorRoute, diff --git a/src/infra/outbound/reply-payload-normalize.ts b/src/infra/outbound/reply-payload-normalize.ts index 72c45844311b..b3d382884fac 100644 --- a/src/infra/outbound/reply-payload-normalize.ts +++ b/src/infra/outbound/reply-payload-normalize.ts @@ -29,7 +29,7 @@ function readObjectValue(value: unknown): object | undefined { } /** Extract the supported outbound reply fields from loose tool or agent payload objects. */ -export function normalizeOutboundReplyPayload( +export function normalizeOutboundReplyPayloadCore( payload: Record, ): OutboundReplyPayload { const text = readStringValue(payload.text); diff --git a/src/media-understanding/runner.vision-skip.test.ts b/src/media-understanding/runner.vision-skip.test.ts index 5d3c4e428058..4d06b545aced 100644 --- a/src/media-understanding/runner.vision-skip.test.ts +++ b/src/media-understanding/runner.vision-skip.test.ts @@ -5,7 +5,7 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import type { MsgContext } from "../auto-reply/templating.js"; import type { OpenClawConfig } from "../config/types.js"; import { resolvePluginRegistryLoadCacheKey } from "../plugins/loader.js"; -import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../plugins/manifest-registry.js"; import { createEmptyPluginRegistry } from "../plugins/registry.js"; import { setActivePluginRegistry } from "../plugins/runtime.js"; import { createMediaAttachmentCache, normalizeMediaAttachments } from "./runner.attachments.js"; @@ -73,7 +73,7 @@ function setCompatibleActiveMediaUnderstandingRegistry( pluginRegistry: ReturnType, cfg: OpenClawConfig, ) { - const pluginIds = loadPluginManifestRegistry({ + const pluginIds = loadPluginManifestRegistryCore({ config: cfg, env: process.env, }) diff --git a/src/plugin-sdk/inbound-reply-dispatch.ts b/src/plugin-sdk/inbound-reply-dispatch.ts index c30473b2fed8..fb38c03bdf51 100644 --- a/src/plugin-sdk/inbound-reply-dispatch.ts +++ b/src/plugin-sdk/inbound-reply-dispatch.ts @@ -13,7 +13,7 @@ import { } from "../channels/turn/durable-delivery.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import { - normalizeOutboundReplyPayload, + normalizeOutboundReplyPayloadCore, type OutboundReplyPayload, } from "../infra/outbound/reply-payload-normalize.js"; import { dispatchChannelInboundReply } from "./channel-inbound.js"; @@ -87,7 +87,7 @@ async function recordInboundSessionAndDispatchReply( dispatchReplyWithBufferedBlockDispatcher: params.dispatchReplyWithBufferedBlockDispatcher, delivery: { preparePayload: (payload): OutboundReplyPayload => - payload && typeof payload === "object" ? normalizeOutboundReplyPayload(payload) : {}, + payload && typeof payload === "object" ? normalizeOutboundReplyPayloadCore(payload) : {}, deliver: async (payload, info) => { if (params.durable) { const durable = await deliverInboundReplyWithMessageSendContextCore({ diff --git a/src/plugin-sdk/plugin-test-runtime.ts b/src/plugin-sdk/plugin-test-runtime.ts index 4d05ba1aa4de..81cbf9f02f01 100644 --- a/src/plugin-sdk/plugin-test-runtime.ts +++ b/src/plugin-sdk/plugin-test-runtime.ts @@ -13,7 +13,7 @@ export { resolveWebFetchProviderContractEntriesForPluginId, resolveWebSearchProviderContractEntriesForPluginId, } from "../plugins/contracts/registry.js"; -export { loadPluginManifestRegistry } from "../plugins/manifest-registry.js"; +export { loadPluginManifestRegistryCore } from "../plugins/manifest-registry.js"; export { emitDiagnosticEventWithTrustedTraceContext, emitInternalDiagnosticEvent as emitInternalDiagnosticEventForTest, diff --git a/src/plugin-sdk/provider-catalog-runtime.ts b/src/plugin-sdk/provider-catalog-runtime.ts index 2ed10740d6f6..af3802370a67 100644 --- a/src/plugin-sdk/provider-catalog-runtime.ts +++ b/src/plugin-sdk/provider-catalog-runtime.ts @@ -7,5 +7,5 @@ export { } from "../plugins/providers.js"; export { isPluginProvidersLoadInFlight, - resolvePluginProviders, + resolvePluginProvidersCore, } from "../plugins/providers.runtime.js"; diff --git a/src/plugin-sdk/qa-runner-runtime.test.ts b/src/plugin-sdk/qa-runner-runtime.test.ts index 73f73e0aa7ca..e46ceb6fed6f 100644 --- a/src/plugin-sdk/qa-runner-runtime.test.ts +++ b/src/plugin-sdk/qa-runner-runtime.test.ts @@ -12,7 +12,7 @@ import { restorePrivateQaCliEnv, } from "./qa-runtime.test-helpers.js"; -const loadPluginManifestRegistry = vi.hoisted(() => vi.fn()); +const loadPluginManifestRegistryCore = vi.hoisted(() => vi.fn()); const loadBundledPluginManifestRegistry = vi.hoisted(() => vi.fn()); const loadBundledPluginPublicSurfaceModuleSync = vi.hoisted(() => vi.fn()); const tryLoadActivatedBundledPluginPublicSurfaceModuleSync = vi.hoisted(() => vi.fn()); @@ -20,7 +20,7 @@ const resolveOpenClawPackageRootSync = vi.hoisted(() => vi.fn()); vi.mock("../plugins/manifest-registry.js", () => ({ loadBundledPluginManifestRegistry, - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, })); vi.mock("../infra/openclaw-root.js", () => ({ @@ -52,7 +52,7 @@ describe("plugin-sdk qa-runner-runtime", () => { beforeEach(() => { vi.resetModules(); - loadPluginManifestRegistry.mockReset().mockReturnValue({ + loadPluginManifestRegistryCore.mockReset().mockReturnValue({ plugins: [], diagnostics: [], }); @@ -80,7 +80,7 @@ describe("plugin-sdk qa-runner-runtime", () => { it("stays cold until runner discovery is requested", async () => { await import("./qa-runner-runtime.js"); - expect(loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(loadPluginManifestRegistryCore).not.toHaveBeenCalled(); expect(loadBundledPluginPublicSurfaceModuleSync).not.toHaveBeenCalled(); expect(tryLoadActivatedBundledPluginPublicSurfaceModuleSync).not.toHaveBeenCalled(); }); @@ -139,7 +139,7 @@ describe("plugin-sdk qa-runner-runtime", () => { matches: vi.fn(), create: vi.fn(), }; - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "qa-example", @@ -181,7 +181,7 @@ describe("plugin-sdk qa-runner-runtime", () => { }); it("rejects invalid module-flow support metadata", async () => { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "qa-example", @@ -215,7 +215,7 @@ describe("plugin-sdk qa-runner-runtime", () => { }); it("reports declared runners as blocked when the plugin is present but not activated", async () => { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "qa-example", @@ -241,7 +241,7 @@ describe("plugin-sdk qa-runner-runtime", () => { it("keeps shipped runtime-api runner contributions available for installed plugins", async () => { const register = vi.fn((qa: Command) => qa); - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "qa-legacy", @@ -335,7 +335,7 @@ describe("plugin-sdk qa-runner-runtime", () => { }); it("fails fast when two plugins declare the same qa runner command", async () => { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "alpha", @@ -362,7 +362,7 @@ describe("plugin-sdk qa-runner-runtime", () => { }); it("fails when runtime registrations include an undeclared command", async () => { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "qa-example", diff --git a/src/plugin-sdk/qa-runner-runtime.ts b/src/plugin-sdk/qa-runner-runtime.ts index 2750510efd5d..05288d26a6e9 100644 --- a/src/plugin-sdk/qa-runner-runtime.ts +++ b/src/plugin-sdk/qa-runner-runtime.ts @@ -3,7 +3,7 @@ import type { Command } from "commander"; import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; import { loadBundledPluginManifestRegistry, - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, } from "../plugins/manifest-registry.js"; import type { OpenClawConfig } from "./config-contracts.js"; import { @@ -486,7 +486,9 @@ function listDeclaredQaRunnerPlugins( > { // Private QA is a source-checkout harness. Its command tree must be derived // from repo-owned manifests before Commander pre-action hooks can run. - const registry = env ? loadBundledPluginManifestRegistry({ env }) : loadPluginManifestRegistry(); + const registry = env + ? loadBundledPluginManifestRegistry({ env }) + : loadPluginManifestRegistryCore(); return registry.plugins .filter( ( diff --git a/src/plugin-sdk/reply-payload.ts b/src/plugin-sdk/reply-payload.ts index c6e5df1673bf..961d3918688b 100644 --- a/src/plugin-sdk/reply-payload.ts +++ b/src/plugin-sdk/reply-payload.ts @@ -2,7 +2,7 @@ import { normalizeLowercaseStringOrEmpty } from "../../packages/normalization-core/src/string-coerce.js"; import type { ReplyPayload as InternalReplyPayload } from "../auto-reply/reply-payload.js"; import type { ChannelOutboundAdapter } from "../channels/plugins/outbound.types.js"; -import { normalizeOutboundReplyPayload as normalizeCoreOutboundReplyPayload } from "../infra/outbound/reply-payload-normalize.js"; +import { normalizeOutboundReplyPayloadCore as normalizeCoreOutboundReplyPayload } from "../infra/outbound/reply-payload-normalize.js"; import { countOutboundMedia, hasOutboundMedia, diff --git a/src/plugin-sdk/reply-runtime.ts b/src/plugin-sdk/reply-runtime.ts index a859436a21c2..63699f85c89e 100644 --- a/src/plugin-sdk/reply-runtime.ts +++ b/src/plugin-sdk/reply-runtime.ts @@ -23,7 +23,7 @@ export { export { HEARTBEAT_PROMPT, DEFAULT_HEARTBEAT_ACK_MAX_CHARS, - resolveHeartbeatPrompt, + resolveHeartbeatPromptCore, stripHeartbeatToken, } from "../auto-reply/heartbeat.js"; export { resolveHeartbeatReplyPayload } from "../auto-reply/heartbeat-reply-payload.js"; diff --git a/src/plugin-sdk/session-store-runtime.ts b/src/plugin-sdk/session-store-runtime.ts index fdf39cd0d98f..3f01e7818903 100644 --- a/src/plugin-sdk/session-store-runtime.ts +++ b/src/plugin-sdk/session-store-runtime.ts @@ -32,7 +32,7 @@ import { updateSessionEntry, } from "../config/sessions/session-accessor.js"; import { resolveSqliteTargetFromSessionStorePath } from "../config/sessions/session-sqlite-target.js"; -import { resolveSessionStoreEntry as resolveSessionStoreEntryFromStore } from "../config/sessions/store-entry.js"; +import { resolveSessionStoreEntryCore as resolveSessionStoreEntryFromStore } from "../config/sessions/store-entry.js"; import { normalizeResolvedMaintenanceConfigInput } from "../config/sessions/store-maintenance.js"; import type { ResolvedSessionMaintenanceConfigInput } from "../config/sessions/store-maintenance.js"; import type { diff --git a/src/plugin-sdk/test-helpers/plugin-registration-contract.ts b/src/plugin-sdk/test-helpers/plugin-registration-contract.ts index 88b89b58006a..af040173c9d2 100644 --- a/src/plugin-sdk/test-helpers/plugin-registration-contract.ts +++ b/src/plugin-sdk/test-helpers/plugin-registration-contract.ts @@ -3,7 +3,7 @@ */ import { describe, expect, it } from "vitest"; import { pluginRegistrationContractRegistry } from "../../plugins/contracts/registry.js"; -import { loadPluginManifestRegistry } from "../../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../../plugins/manifest-registry.js"; type PluginRegistrationContractParams = { pluginId: string; @@ -144,7 +144,7 @@ export function describePluginRegistrationContract(params: PluginRegistrationCon const manifestAuthChoice = params.manifestAuthChoice; if (manifestAuthChoice) { it("keeps onboarding auth grouping explicit", () => { - const plugin = loadPluginManifestRegistry({}).plugins.find( + const plugin = loadPluginManifestRegistryCore({}).plugins.find( (entry) => entry.origin === "bundled" && entry.id === manifestAuthChoice.pluginId, ); diff --git a/src/plugins/bundle-commands.test.ts b/src/plugins/bundle-commands.test.ts index 93d7feaec5a3..2b7a13b2f9c2 100644 --- a/src/plugins/bundle-commands.test.ts +++ b/src/plugins/bundle-commands.test.ts @@ -16,7 +16,7 @@ vi.mock("../logging/subsystem.js", () => ({ })); vi.mock("./manifest-registry.js", () => ({ - loadPluginManifestRegistry: () => ({ diagnostics: [], plugins: mocks.plugins }), + loadPluginManifestRegistryCore: () => ({ diagnostics: [], plugins: mocks.plugins }), })); vi.mock("./plugin-registry-contributions.js", () => ({ diff --git a/src/plugins/bundled-capability-runtime.ts b/src/plugins/bundled-capability-runtime.ts index 07d3dabbac80..4f36fa681253 100644 --- a/src/plugins/bundled-capability-runtime.ts +++ b/src/plugins/bundled-capability-runtime.ts @@ -4,7 +4,7 @@ import { withBundledPluginEnablementCompat } from "./bundled-compat.js"; import { discoverOpenClawPlugins, type PluginDiscoveryResult } from "./discovery.js"; import { loadOpenClawPluginsWithInternalOverrides } from "./loader-runtime-load.js"; import type { PluginLoadOptions } from "./loader.js"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; import type { PluginRuntime } from "./runtime/types.js"; import type { PluginSdkResolutionPreference } from "./sdk-alias.js"; @@ -44,7 +44,7 @@ export function loadBundledCapabilityRuntimeRegistry(params: { }) ?? {}); const discovery = params.discovery ?? discoverOpenClawPlugins({ env }); const pluginIds = new Set(params.pluginIds); - const manifestRegistry = loadPluginManifestRegistry({ + const manifestRegistry = loadPluginManifestRegistryCore({ config, env, candidates: discovery.candidates, diff --git a/src/plugins/capability-provider-runtime.test.ts b/src/plugins/capability-provider-runtime.test.ts index e89fc70acffd..a8c3e629b725 100644 --- a/src/plugins/capability-provider-runtime.test.ts +++ b/src/plugins/capability-provider-runtime.test.ts @@ -31,7 +31,7 @@ const mocks = vi.hoisted(() => ({ (params?: unknown) => ReturnType | undefined >(() => undefined), resolvePluginRegistryLoadCacheKey: vi.fn((options: unknown) => JSON.stringify(options)), - loadPluginManifestRegistry: vi.fn<(params?: Record) => MockManifestRegistry>( + loadPluginManifestRegistryCore: vi.fn<(params?: Record) => MockManifestRegistry>( () => createEmptyMockManifestRegistry(), ), resolveInstalledManifestRegistryIndexFingerprint: vi.fn(() => "test-installed-index"), @@ -71,7 +71,7 @@ vi.mock("./bundled-capability-runtime.js", () => ({ })); vi.mock("./manifest-registry-installed.js", () => ({ - loadPluginManifestRegistryForInstalledIndex: mocks.loadPluginManifestRegistry, + loadPluginManifestRegistryForInstalledIndex: mocks.loadPluginManifestRegistryCore, resolveInstalledManifestRegistryIndexFingerprint: mocks.resolveInstalledManifestRegistryIndexFingerprint, })); @@ -80,7 +80,7 @@ vi.mock("./manifest-registry.js", async (importOriginal) => { const actual = await importOriginal(); return { ...actual, - loadPluginManifestRegistry: mocks.loadPluginManifestRegistry, + loadPluginManifestRegistryCore: mocks.loadPluginManifestRegistryCore, }; }); @@ -112,12 +112,12 @@ vi.mock("./plugin-registry-snapshot.js", async (importOriginal) => { }; }, loadPluginManifestRegistryForPluginRegistry: ( - ...args: Parameters + ...args: Parameters ) => { const [{ includeDisabled: _includeDisabled, ...params } = {}] = args as [ Record?, ]; - return mocks.loadPluginManifestRegistry(params); + return mocks.loadPluginManifestRegistryCore(params); }, }; }); @@ -209,7 +209,7 @@ function setCapabilityManifestPlugins( contracts: Record; }>, ) { - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: plugins.map((plugin) => ({ origin: "bundled", ...plugin })) as never, diagnostics: [], }); @@ -224,11 +224,11 @@ function expectInitialRuntimeRegistryLookup() { } function requireManifestRegistryLoadParams(index = 0): Record { - const call = mocks.loadPluginManifestRegistry.mock.calls[index] as + const call = mocks.loadPluginManifestRegistryCore.mock.calls[index] as | [Record] | undefined; if (!call) { - throw new Error(`loadPluginManifestRegistry call ${index} missing`); + throw new Error(`loadPluginManifestRegistryCore call ${index} missing`); } return call[0]; } @@ -308,7 +308,7 @@ function setBundledCapabilityFixture( pluginId = "openai", providerId = pluginId, ) { - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: pluginId, @@ -376,8 +376,8 @@ describe("resolvePluginCapabilityProviders", () => { ); mocks.loadPluginRegistrySnapshot.mockReset(); mocks.loadPluginRegistrySnapshot.mockReturnValue({ plugins: [] }); - mocks.loadPluginManifestRegistry.mockReset(); - mocks.loadPluginManifestRegistry.mockReturnValue(createEmptyMockManifestRegistry()); + mocks.loadPluginManifestRegistryCore.mockReset(); + mocks.loadPluginManifestRegistryCore.mockReturnValue(createEmptyMockManifestRegistry()); mocks.loadBundledCapabilityRuntimeRegistry.mockReset(); mocks.loadBundledCapabilityRuntimeRegistry.mockImplementation(() => mocks.createMockRegistry()); mocks.withBundledPluginEnablementCompat.mockReset(); @@ -447,7 +447,7 @@ describe("resolvePluginCapabilityProviders", () => { ["fal"], ); expectActiveRegistryLookup(["fal"]); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); }); it("prepares media capability families from one supplied metadata snapshot", () => { @@ -495,7 +495,7 @@ describe("resolvePluginCapabilityProviders", () => { expect(prepared.musicGenerationProviders?.map((provider) => provider.id)).toEqual([ "musicGenerationProviders", ]); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); }); it.each([ @@ -797,7 +797,7 @@ describe("resolvePluginCapabilityProviders", () => { ["external-image"], ); expectActiveRegistryLookup(["external-image"]); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); }); it("uses the active registry when capability providers are already loaded", () => { @@ -808,7 +808,7 @@ describe("resolvePluginCapabilityProviders", () => { const providers = resolvePluginCapabilityProviders({ key: "speechProviders" }); expectResolvedCapabilityProviderIds(providers, ["openai"]); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); expectInitialRuntimeRegistryLookup(); }); @@ -831,7 +831,7 @@ describe("resolvePluginCapabilityProviders", () => { mocks.loadPluginRegistrySnapshot.mockReturnValue({ plugins: [{ pluginId: "external-image", origin: "global", enabled: true }], }); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "external-image", @@ -882,7 +882,7 @@ describe("resolvePluginCapabilityProviders", () => { generateImage: async () => ({ images: [] }), }, } as never); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "fal", @@ -991,7 +991,7 @@ describe("resolvePluginCapabilityProviders", () => { }, }, } as OpenClawConfig; - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "openai", @@ -1092,7 +1092,7 @@ describe("resolvePluginCapabilityProviders", () => { }, }, } as OpenClawConfig; - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "openai", origin: "bundled", contracts: { [key]: ["openai"] } }, { id: "google", origin: "bundled", contracts: { [key]: ["google"] } }, @@ -1126,7 +1126,7 @@ describe("resolvePluginCapabilityProviders", () => { mocks.loadPluginRegistrySnapshot.mockReturnValue({ plugins: [{ pluginId: "fish-audio-speech", origin: "global", enabled: true }], }); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "fish-audio-speech", @@ -1192,7 +1192,7 @@ describe("resolvePluginCapabilityProviders", () => { }); expectResolvedCapabilityProviderIds(providers, ["deepgram"]); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); expectInitialRuntimeRegistryLookup(); }); @@ -1228,7 +1228,7 @@ describe("resolvePluginCapabilityProviders", () => { }, } as never, ); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "deepgram", @@ -1279,14 +1279,14 @@ describe("resolvePluginCapabilityProviders", () => { }); expectResolvedCapabilityProviderIds(providers, ["microsoft"]); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); expectInitialRuntimeRegistryLookup(); }); it("keeps active capability providers when cfg has no explicit plugin config", () => { const active = createEmptyPluginRegistry(); addSpeechProvider(active, "acme"); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "microsoft", @@ -1418,7 +1418,7 @@ describe("resolvePluginCapabilityProviders", () => { source: "test", provider: { id: "google" }, } as never); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "google", @@ -1461,7 +1461,7 @@ describe("resolvePluginCapabilityProviders", () => { label: "OpenAI", }, } as never); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "deepgram", @@ -1487,7 +1487,7 @@ describe("resolvePluginCapabilityProviders", () => { expect(provider?.id).toBe("openai"); expectActiveRegistryLookup(["deepgram", "openai"]); - expect(mocks.loadPluginManifestRegistry).toHaveBeenCalledOnce(); + expect(mocks.loadPluginManifestRegistryCore).toHaveBeenCalledOnce(); }); it("prefers a canonical provider id over an earlier provider alias", () => { @@ -1565,7 +1565,7 @@ describe("resolvePluginCapabilityProviders", () => { expectResolvedCapabilityProviderIds(providers, ["google", "microsoft"]); expectActiveRegistryLookup(["google", "microsoft"]); - expect(mocks.loadPluginManifestRegistry).toHaveBeenCalledOnce(); + expect(mocks.loadPluginManifestRegistryCore).toHaveBeenCalledOnce(); }); it.each([ @@ -1599,7 +1599,7 @@ describe("resolvePluginCapabilityProviders", () => { resolvePluginCapabilityProviders({ key: "mediaUnderstandingProviders", cfg }), ); - expect(mocks.loadPluginManifestRegistry).toHaveBeenCalledTimes(2); + expect(mocks.loadPluginManifestRegistryCore).toHaveBeenCalledTimes(2); }); it("reloads equivalent unprepared manifest metadata while applying bundled compat", () => { @@ -1621,7 +1621,7 @@ describe("resolvePluginCapabilityProviders", () => { }), ); - expect(mocks.loadPluginManifestRegistry).toHaveBeenCalledTimes(2); + expect(mocks.loadPluginManifestRegistryCore).toHaveBeenCalledTimes(2); }); it("reuses a compatible active registry even when the capability list is empty", () => { @@ -1715,7 +1715,7 @@ describe("resolvePluginCapabilityProviders", () => { }); expectNoResolvedCapabilityProviders(providers); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); expect(mocks.withBundledPluginEnablementCompat).not.toHaveBeenCalled(); expect(mocks.resolveRuntimePluginRegistry).not.toHaveBeenCalled(); }); @@ -1756,7 +1756,7 @@ describe("resolvePluginCapabilityProviders", () => { }); expectInitialRuntimeRegistryLookup(); expectActiveRegistryLookup(["microsoft"]); - expect(mocks.loadPluginManifestRegistry).toHaveBeenCalledOnce(); + expect(mocks.loadPluginManifestRegistryCore).toHaveBeenCalledOnce(); }); it.each([ @@ -1777,7 +1777,7 @@ describe("resolvePluginCapabilityProviders", () => { it("scopes media capability snapshot loads to manifest-derived bundled owners", () => { const cfg = { plugins: { allow: ["openai", "minimax"] } } as OpenClawConfig; - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "openai", @@ -1814,7 +1814,7 @@ describe("resolvePluginCapabilityProviders", () => { it("does not unscoped-load media generation capabilities without bundled owners", () => { const cfg = { plugins: { allow: ["openai"] } } as OpenClawConfig; - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "openai", @@ -1857,7 +1857,7 @@ describe("resolvePluginCapabilityProviders", () => { create: async () => ({ provider: null }), }, } as never); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "google", @@ -1903,7 +1903,7 @@ describe("resolvePluginCapabilityProviders", () => { create: async () => ({ provider: null }), }, } as never); - mocks.loadPluginManifestRegistry.mockReturnValue({ + mocks.loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { id: "google", @@ -1929,7 +1929,7 @@ describe("resolvePluginCapabilityProviders", () => { }); expect(provider).toBeUndefined(); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); expect(mocks.withBundledPluginEnablementCompat).not.toHaveBeenCalled(); expect(mocks.resolveRuntimePluginRegistry).not.toHaveBeenCalled(); }); diff --git a/src/plugins/channel-plugin-ids.test.ts b/src/plugins/channel-plugin-ids.test.ts index 12e2fd3fe5c6..82c4c99de21a 100644 --- a/src/plugins/channel-plugin-ids.test.ts +++ b/src/plugins/channel-plugin-ids.test.ts @@ -31,7 +31,7 @@ const hasMeaningfulChannelConfig = vi.hoisted(() => ); }), ); -const loadPluginManifestRegistry = vi.hoisted(() => vi.fn()); +const loadPluginManifestRegistryCore = vi.hoisted(() => vi.fn()); const loadPluginManifestRegistryForInstalledIndex = vi.hoisted(() => vi.fn()); const loadPluginManifestRegistryForPluginRegistry = vi.hoisted(() => vi.fn()); const loadPluginRegistrySnapshot = vi.hoisted(() => vi.fn()); @@ -349,7 +349,7 @@ function createInstalledPluginRecordFixture( } function createInstalledPluginIndexFixture( - registry: PluginManifestRegistry = loadPluginManifestRegistry(), + registry: PluginManifestRegistry = loadPluginManifestRegistryCore(), ): InstalledPluginIndex { return { version: 1, @@ -368,7 +368,7 @@ function filterManifestRegistryForInstalledIndex(params: { pluginIds?: readonly string[]; includeDisabled?: boolean; }): PluginManifestRegistry { - const registry = loadPluginManifestRegistry() as PluginManifestRegistry; + const registry = loadPluginManifestRegistryCore() as PluginManifestRegistry; const pluginIdSet = params.pluginIds?.length ? new Set(params.pluginIds) : null; return { ...registry, @@ -388,10 +388,10 @@ function useManifestRegistryFixture( registry: PluginManifestRegistry = createManifestRegistryFixture(), ) { const index = createInstalledPluginIndexFixture(registry); - loadPluginManifestRegistry.mockReset().mockReturnValue(registry); + loadPluginManifestRegistryCore.mockReset().mockReturnValue(registry); loadPluginManifestRegistryForPluginRegistry .mockReset() - .mockImplementation(() => loadPluginManifestRegistry()); + .mockImplementation(() => loadPluginManifestRegistryCore()); loadPluginRegistrySnapshot.mockReset().mockReturnValue(index); return { registry, index }; } @@ -403,7 +403,7 @@ function expectStartupPluginIds(params: { workerProviderIds?: readonly string[]; expected: readonly string[]; }) { - const manifestRegistry = loadPluginManifestRegistry() as PluginManifestRegistry; + const manifestRegistry = loadPluginManifestRegistryCore() as PluginManifestRegistry; expect( resolveGatewayStartupPluginIdsFromRegistry({ config: params.config, @@ -520,7 +520,7 @@ describe("resolveGatewayStartupPluginIdsFromRegistry", () => { .mockImplementation(filterManifestRegistryForInstalledIndex); loadPluginManifestRegistryForPluginRegistry .mockReset() - .mockImplementation(() => loadPluginManifestRegistry()); + .mockImplementation(() => loadPluginManifestRegistryCore()); }); it.each([ diff --git a/src/plugins/config-contracts.test.ts b/src/plugins/config-contracts.test.ts index d2ec4d5639e8..c2c3abf66969 100644 --- a/src/plugins/config-contracts.test.ts +++ b/src/plugins/config-contracts.test.ts @@ -23,7 +23,7 @@ vi.mock("./bundled-plugin-metadata.js", () => ({ })); vi.mock("./manifest-registry.js", () => ({ - loadPluginManifestRegistry: mocks.loadBundledManifestRegistry, + loadPluginManifestRegistryCore: mocks.loadBundledManifestRegistry, })); vi.mock("./manifest-registry-installed.js", () => ({ diff --git a/src/plugins/config-contracts.ts b/src/plugins/config-contracts.ts index 0431e21f94c0..002b2fa43bd0 100644 --- a/src/plugins/config-contracts.ts +++ b/src/plugins/config-contracts.ts @@ -3,7 +3,10 @@ import { normalizeSortedUniqueStringEntries } from "@openclaw/normalization-core import type { OpenClawConfig } from "../config/types.openclaw.js"; import { findBundledPluginMetadataById } from "./bundled-plugin-metadata.js"; import { discoverOpenClawPlugins, type PluginDiscoveryResult } from "./discovery.js"; -import { loadPluginManifestRegistry, type PluginManifestRegistry } from "./manifest-registry.js"; +import { + loadPluginManifestRegistryCore, + type PluginManifestRegistry, +} from "./manifest-registry.js"; import type { PluginManifestConfigContracts } from "./manifest.js"; import type { PluginOrigin } from "./plugin-origin.types.js"; import { loadPluginManifestRegistryForPluginRegistry } from "./plugin-registry.js"; @@ -49,7 +52,7 @@ export function resolvePluginConfigContractsById(params: { workspaceDir: params.workspaceDir, env: params.env, }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ config: params.config, workspaceDir: params.workspaceDir, env: params.env, diff --git a/src/plugins/config-normalization-shared.ts b/src/plugins/config-normalization-shared.ts index b452901da442..51a7e2197858 100644 --- a/src/plugins/config-normalization-shared.ts +++ b/src/plugins/config-normalization-shared.ts @@ -237,7 +237,7 @@ function normalizePluginEntries( } /** Normalizes plugin config while allowing callers to resolve aliases first. */ -export function normalizePluginsConfigWithResolver( +export function normalizePluginsConfigWithResolverCore( config?: OpenClawConfig["plugins"], normalizePluginId: NormalizePluginId = identityNormalizePluginId, ): NormalizedPluginsConfig { diff --git a/src/plugins/config-policy.ts b/src/plugins/config-policy.ts index ae0c01f7acd7..785a41db5155 100644 --- a/src/plugins/config-policy.ts +++ b/src/plugins/config-policy.ts @@ -8,7 +8,7 @@ import { import { identityNormalizePluginId, isBundledChannelEnabledByChannelConfig as isBundledChannelEnabledByChannelConfigShared, - normalizePluginsConfigWithResolver as normalizePluginsConfigWithResolverShared, + normalizePluginsConfigWithResolverCore as normalizePluginsConfigWithResolverShared, type NormalizePluginId, type NormalizedPluginsConfig as SharedNormalizedPluginsConfig, } from "./config-normalization-shared.js"; diff --git a/src/plugins/config-state.ts b/src/plugins/config-state.ts index 7debf5fc87a4..4f324dbaee6a 100644 --- a/src/plugins/config-state.ts +++ b/src/plugins/config-state.ts @@ -17,7 +17,7 @@ import { } from "./config-activation-shared.js"; import { isBundledChannelEnabledByChannelConfig as isBundledChannelEnabledByChannelConfigShared, - normalizePluginsConfigWithResolver, + normalizePluginsConfigWithResolverCore, type NormalizePluginId, type NormalizedPluginsConfig as SharedNormalizedPluginsConfig, } from "./config-normalization-shared.js"; @@ -82,7 +82,7 @@ export function normalizePluginId(id: string): string { export const normalizePluginsConfig = ( config?: OpenClawConfig["plugins"], ): NormalizedPluginsConfig => { - return normalizePluginsConfigWithResolver(config, createScopedPluginIdNormalizer()); + return normalizePluginsConfigWithResolverCore(config, createScopedPluginIdNormalizer()); }; /** Resolves the enabled plugin selected to own the context-engine slot. */ diff --git a/src/plugins/contracts/plugin-entry-guardrails.test.ts b/src/plugins/contracts/plugin-entry-guardrails.test.ts index 139b9798212c..c25df98ff3ab 100644 --- a/src/plugins/contracts/plugin-entry-guardrails.test.ts +++ b/src/plugins/contracts/plugin-entry-guardrails.test.ts @@ -4,7 +4,7 @@ import path, { dirname, relative, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; import { listBundledPluginMetadata } from "../bundled-plugin-metadata.js"; -import { loadPluginManifestRegistry } from "../manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../manifest-registry.js"; const REPO_ROOT = resolve(fileURLToPath(new URL("../../..", import.meta.url))); const RUNTIME_ENTRY_HELPER_RE = /(^|\/)plugin-entry\.runtime\.[cm]?[jt]s$/; @@ -33,7 +33,7 @@ const RE_EXPORT_STAR_RE = const RE_EXPORT_NAMED_RE = /^\s*export\s+(?:type\s+)?\{[^}]*\}\s+from\s*["']([^"']+)["']/gmu; function listBundledPluginRoots() { - return loadPluginManifestRegistry({}) + return loadPluginManifestRegistryCore({}) .plugins.filter((plugin) => plugin.origin === "bundled") .map((plugin) => ({ pluginId: plugin.id, diff --git a/src/plugins/contracts/registry.contract.test.ts b/src/plugins/contracts/registry.contract.test.ts index 3c4317c3d129..2e9cec213d4c 100644 --- a/src/plugins/contracts/registry.contract.test.ts +++ b/src/plugins/contracts/registry.contract.test.ts @@ -1,7 +1,7 @@ // Registry contract tests cover plugin contract registry contents and lookup behavior. import { describe, expect, it } from "vitest"; import { uniqueSortedStrings } from "../../plugin-sdk/test-helpers/string-utils.js"; -import { loadPluginManifestRegistry, type PluginManifestRecord } from "../manifest-registry.js"; +import { loadPluginManifestRegistryCore, type PluginManifestRecord } from "../manifest-registry.js"; import { resolveManifestContractPluginIds } from "../plugin-registry.js"; import { BUNDLED_PLUGIN_CONTRACT_SNAPSHOTS } from "./inventory/bundled-capability-metadata.js"; import { pluginRegistrationContractRegistry, providerContractLoadError } from "./registry.js"; @@ -60,7 +60,7 @@ describe("plugin contract registry", () => { const snapshotPluginIds = new Set( BUNDLED_PLUGIN_CONTRACT_SNAPSHOTS.map((entry) => entry.pluginId), ); - return loadPluginManifestRegistry({}) + return loadPluginManifestRegistryCore({}) .plugins.filter((plugin) => snapshotPluginIds.has(plugin.id) && predicate(plugin)) .map((plugin) => plugin.id) .toSorted((left, right) => left.localeCompare(right)); @@ -140,7 +140,7 @@ describe("plugin contract registry", () => { }); it("keeps video-only provider auth choices out of text onboarding", () => { - const registry = loadPluginManifestRegistry({}); + const registry = loadPluginManifestRegistryCore({}); for (const pluginId of ["alibaba", "runway"]) { const plugin = registry.plugins.find( @@ -170,7 +170,7 @@ describe("plugin contract registry", () => { }); it("exposes the GitHub Copilot non-interactive onboarding token flag from manifest metadata", () => { - const registry = loadPluginManifestRegistry({}); + const registry = loadPluginManifestRegistryCore({}); const plugin = registry.plugins.find( (entry) => entry.origin === "bundled" && entry.id === "github-copilot", ); diff --git a/src/plugins/contracts/registry.ts b/src/plugins/contracts/registry.ts index 5f214301223f..8067af20b4be 100644 --- a/src/plugins/contracts/registry.ts +++ b/src/plugins/contracts/registry.ts @@ -2,7 +2,7 @@ import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce"; import { loadBundledCapabilityRuntimeRegistry } from "../bundled-capability-runtime.js"; import { discoverOpenClawPlugins } from "../discovery.js"; -import { loadPluginManifestRegistry } from "../manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../manifest-registry.js"; import { resolveBundledExplicitProviderContractsFromPublicArtifacts } from "../provider-contract-public-artifacts.js"; import type { ProviderPlugin, WebFetchProviderPlugin, WebSearchProviderPlugin } from "../types.js"; import { resolveBundledExplicitWebSearchProvidersFromPublicArtifacts } from "../web-provider-public-artifacts.explicit.js"; @@ -74,7 +74,7 @@ function resolveBundledManifestContracts(): PluginRegistrationContractEntry[] { toolNames: [...entry.toolNames], })); } - return loadPluginManifestRegistry({}) + return loadPluginManifestRegistryCore({}) .plugins.filter( (plugin) => plugin.origin === "bundled" && diff --git a/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts b/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts index f94a8211cc75..7bf2ec22f8c1 100644 --- a/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts +++ b/src/plugins/contracts/test-helpers/bundled-plugin-roots.ts @@ -1,10 +1,10 @@ // Bundled plugin root helpers resolve plugin root paths for contract test fixtures. import { relative, resolve } from "node:path"; -import { loadPluginManifestRegistry } from "../../manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../../manifest-registry.js"; const sourceExtensionsDir = resolve(process.cwd(), "extensions"); const bundledPluginRoots = new Map( - loadPluginManifestRegistry({ + loadPluginManifestRegistryCore({ config: {}, env: { ...process.env, diff --git a/src/plugins/discovery-threading.test.ts b/src/plugins/discovery-threading.test.ts index 6472a56391fa..1a6595c36d47 100644 --- a/src/plugins/discovery-threading.test.ts +++ b/src/plugins/discovery-threading.test.ts @@ -13,7 +13,7 @@ vi.mock("./discovery.js", async (importOriginal) => { }; }); -const { loadPluginManifestRegistry } = await import("./manifest-registry.js"); +const { loadPluginManifestRegistryCore } = await import("./manifest-registry.js"); const { loadInstalledPluginIndexWithDiscovery } = await import("./installed-plugin-index.js"); const emptyDiscovery: PluginDiscoveryResult = { candidates: [], diagnostics: [] }; @@ -25,7 +25,7 @@ describe("discovery threading", () => { }); it("skips internal discoverOpenClawPlugins when discovery is supplied", () => { - loadPluginManifestRegistry({ discovery: emptyDiscovery }); + loadPluginManifestRegistryCore({ discovery: emptyDiscovery }); expect(discoverOpenClawPluginsMock).not.toHaveBeenCalled(); discoverOpenClawPluginsMock.mockClear(); @@ -34,7 +34,7 @@ describe("discovery threading", () => { }); it("calls discoverOpenClawPlugins when neither discovery nor candidates supplied", () => { - loadPluginManifestRegistry({}); + loadPluginManifestRegistryCore({}); expect(discoverOpenClawPluginsMock).toHaveBeenCalledTimes(1); discoverOpenClawPluginsMock.mockClear(); @@ -43,7 +43,7 @@ describe("discovery threading", () => { }); it("prefers explicit candidates over discovery when both are supplied", () => { - loadPluginManifestRegistry({ candidates: [], diagnostics: [], discovery: emptyDiscovery }); + loadPluginManifestRegistryCore({ candidates: [], diagnostics: [], discovery: emptyDiscovery }); expect(discoverOpenClawPluginsMock).not.toHaveBeenCalled(); discoverOpenClawPluginsMock.mockClear(); diff --git a/src/plugins/discovery.test.ts b/src/plugins/discovery.test.ts index c7dca442ce04..cc1811876b29 100644 --- a/src/plugins/discovery.test.ts +++ b/src/plugins/discovery.test.ts @@ -7,7 +7,7 @@ import { afterEach, describe, expect, it, vi } from "vitest"; import type { PluginInstallRecord } from "../config/types.plugins.js"; import { discoverOpenClawPlugins } from "./discovery.js"; import * as pluginHardlinkPolicy from "./hardlink-policy.js"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; import type { PackageManifest } from "./manifest.js"; import { resolvePackageSetupSource } from "./package-entry-resolution.js"; import { listBuiltRuntimeEntryCandidates } from "./package-entrypoints.js"; @@ -940,7 +940,7 @@ describe("discoverOpenClawPlugins", () => { const discovery = await discoverWithStateDir(stateDir, {}); expectCandidateIds(discovery.candidates, { includes: ["pack/one", "pack/two"] }); - const registry = loadPluginManifestRegistry({ discovery, installRecords: {} }); + const registry = loadPluginManifestRegistryCore({ discovery, installRecords: {} }); expect(registry.plugins.map((plugin) => plugin.id).toSorted()).toEqual([ "pack/one", "pack/two", @@ -1645,7 +1645,7 @@ describe("discoverOpenClawPlugins", () => { } const discovery = await discoverWithStateDir(stateDir, {}); - const registry = loadPluginManifestRegistry({ discovery, installRecords: {} }); + const registry = loadPluginManifestRegistryCore({ discovery, installRecords: {} }); expect(registry.diagnostics).toEqual([ expect.objectContaining({ level: "error", pluginId: "first-nameless" }), @@ -1668,7 +1668,7 @@ describe("discoverOpenClawPlugins", () => { } const discovery = await discoverWithStateDir(stateDir, {}); - const registry = loadPluginManifestRegistry({ discovery, installRecords: {} }); + const registry = loadPluginManifestRegistryCore({ discovery, installRecords: {} }); expect(discovery.candidates.map((candidate) => candidate.idHint)).toEqual([ "first-malformed-manifest", @@ -1696,7 +1696,7 @@ describe("discoverOpenClawPlugins", () => { writePluginEntry(path.join(pluginDir, "index.js")); const discovery = await discoverWithStateDir(stateDir, {}); - const registry = loadPluginManifestRegistry({ discovery, installRecords: {} }); + const registry = loadPluginManifestRegistryCore({ discovery, installRecords: {} }); expect(discovery.candidates).toEqual([ expect.objectContaining({ idHint: "metadata-plugin-owner" }), @@ -1729,7 +1729,7 @@ describe("discoverOpenClawPlugins", () => { writePluginEntry(path.join(pluginDir, "index.js")); const discovery = await discoverWithStateDir(stateDir, {}); - const registry = loadPluginManifestRegistry({ discovery, installRecords: {} }); + const registry = loadPluginManifestRegistryCore({ discovery, installRecords: {} }); expect(discovery.candidates).toEqual([ expect.objectContaining({ @@ -1772,7 +1772,7 @@ describe("discoverOpenClawPlugins", () => { } const discovery = await discoverWithStateDir(stateDir, {}); - const registry = loadPluginManifestRegistry({ discovery, installRecords: {} }); + const registry = loadPluginManifestRegistryCore({ discovery, installRecords: {} }); const errors = registry.diagnostics.filter((diagnostic) => diagnostic.message.includes("openclaw.extensions[1]"), ); diff --git a/src/plugins/gateway-startup-plugin-config.ts b/src/plugins/gateway-startup-plugin-config.ts index 16f59543669f..f225319fe9d5 100644 --- a/src/plugins/gateway-startup-plugin-config.ts +++ b/src/plugins/gateway-startup-plugin-config.ts @@ -19,7 +19,7 @@ import { import { readBundledDiscoveryMode } from "./bundled-discovery-state.js"; import { listExplicitConfiguredChannelIdsForConfig } from "./channel-presence-policy.js"; import { collectPluginConfigContractMatches } from "./config-contracts.js"; -import { normalizePluginsConfigWithResolver } from "./config-normalization-shared.js"; +import { normalizePluginsConfigWithResolverCore } from "./config-normalization-shared.js"; import { resolveEffectivePluginActivationState, resolveSelectedContextEnginePluginIdFromConfig, @@ -63,7 +63,7 @@ export function normalizePluginsConfigForInstalledIndex( config: OpenClawConfig["plugins"] | undefined, lookup: InstalledPluginIndexScopeLookup, ) { - return normalizePluginsConfigWithResolver(config, lookup.normalizePluginId); + return normalizePluginsConfigWithResolverCore(config, lookup.normalizePluginId); } function isConfigActivationValueEnabled(value: unknown): boolean { diff --git a/src/plugins/install-persistence.ts b/src/plugins/install-persistence.ts index 58d64a93baa4..b94978fe6c91 100644 --- a/src/plugins/install-persistence.ts +++ b/src/plugins/install-persistence.ts @@ -25,7 +25,7 @@ import { withoutPluginInstallRecords, } from "./installed-plugin-index-records.js"; import { reconcileNpmPluginLoadPath, type PluginInstallUpdate } from "./installs.js"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; import { tracePluginLifecyclePhaseAsync } from "./plugin-lifecycle-trace.js"; import { refreshPluginRegistryAfterConfigMutation } from "./registry-refresh.js"; import { validateJsonSchemaValue } from "./schema-validator.js"; @@ -437,7 +437,7 @@ function resolvePluginConfigEnablement(params: { pluginId: string; installRecords: Record; }): PluginConfigEnablement { - const manifest = loadPluginManifestRegistry({ + const manifest = loadPluginManifestRegistryCore({ config: params.config, installRecords: params.installRecords, }).plugins.find((plugin) => plugin.id === params.pluginId); diff --git a/src/plugins/installed-plugin-index.ts b/src/plugins/installed-plugin-index.ts index 0d61a7abfd31..849efbb270a5 100644 --- a/src/plugins/installed-plugin-index.ts +++ b/src/plugins/installed-plugin-index.ts @@ -21,7 +21,10 @@ import { type LoadInstalledPluginIndexParams, type RefreshInstalledPluginIndexParams, } from "./installed-plugin-index-types.js"; -import { loadPluginManifestRegistry, type PluginManifestRegistry } from "./manifest-registry.js"; +import { + loadPluginManifestRegistryCore, + type PluginManifestRegistry, +} from "./manifest-registry.js"; export { INSTALLED_PLUGIN_INDEX_MIGRATION_VERSION, @@ -66,7 +69,7 @@ function buildInstalledPluginIndex( env, installRecords, })); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ config: params.config, workspaceDir: params.workspaceDir, env, diff --git a/src/plugins/loader-discovery.ts b/src/plugins/loader-discovery.ts index 56c7b0dce475..e716d4802570 100644 --- a/src/plugins/loader-discovery.ts +++ b/src/plugins/loader-discovery.ts @@ -13,7 +13,7 @@ import { import { createPluginCandidatesFromManifestRegistry, pushDiagnostics } from "./loader-shared.js"; import type { PluginLoadOptions } from "./loader-types.js"; import { - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, type PluginManifestRecord, type PluginManifestRegistry, } from "./manifest-registry.js"; @@ -58,7 +58,7 @@ export function resolvePluginLoadDiscovery(params: { })); const manifestRegistry = suppliedManifestRegistry ?? - loadPluginManifestRegistry({ + loadPluginManifestRegistryCore({ config: context.cfg, workspaceDir: options.workspaceDir, env: context.env, diff --git a/src/plugins/loader.base.test-utils.ts b/src/plugins/loader.base.test-utils.ts index 130c6deb4a36..610376db3d00 100644 --- a/src/plugins/loader.base.test-utils.ts +++ b/src/plugins/loader.base.test-utils.ts @@ -53,7 +53,7 @@ import { globalAfterEach0, globalAfterAll1, } from "./loader.test-harness.js"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; import { loadPluginMetadataSnapshot } from "./plugin-metadata-snapshot.js"; import { createEmptyPluginRegistry } from "./registry.js"; import { @@ -432,7 +432,7 @@ describe("loadOpenClawPlugins", () => { allow: [plugin.id], }, }; - const manifestRegistry = loadPluginManifestRegistry({ config }); + const manifestRegistry = loadPluginManifestRegistryCore({ config }); fs.rmSync(path.join(plugin.dir, "openclaw.plugin.json")); const registry = loadOpenClawPlugins({ @@ -1635,7 +1635,7 @@ describe("loadOpenClawPlugins", () => { const discovery = await import("./discovery.js"); const manifestRegistry = await import("./manifest-registry.js"); const discoverySpy = vi.spyOn(discovery, "discoverOpenClawPlugins"); - const manifestSpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistry"); + const manifestSpy = vi.spyOn(manifestRegistry, "loadPluginManifestRegistryCore"); const registry = loadOpenClawPlugins({ cache: false, @@ -1856,7 +1856,7 @@ describe("loadOpenClawPlugins", () => { const manifestRegistry = await import("./manifest-registry.js"); const manifestSpy = vi - .spyOn(manifestRegistry, "loadPluginManifestRegistry") + .spyOn(manifestRegistry, "loadPluginManifestRegistryCore") .mockImplementation(() => { throw new Error("corrupt plugin manifest"); }); diff --git a/src/plugins/loader.hooks-and-runtime.test-utils.ts b/src/plugins/loader.hooks-and-runtime.test-utils.ts index d989e1bd4275..5c2803b51e62 100644 --- a/src/plugins/loader.hooks-and-runtime.test-utils.ts +++ b/src/plugins/loader.hooks-and-runtime.test-utils.ts @@ -21,7 +21,7 @@ import { globalAfterAll1, updatePluginManifest, } from "./loader.test-harness.js"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; afterEach(globalAfterEach0); afterAll(globalAfterAll1); @@ -923,7 +923,7 @@ ${channelPluginSource({ OPENCLAW_DISABLE_BUNDLED_PLUGINS: undefined, }, () => { - const manifestRegistry = loadPluginManifestRegistry({ config }); + const manifestRegistry = loadPluginManifestRegistryCore({ config }); return loadOpenClawPlugins({ cache: false, preferBuiltPluginArtifacts: true, diff --git a/src/plugins/manifest-registry-installed.ts b/src/plugins/manifest-registry-installed.ts index 24e47b1847f0..a9cb83986404 100644 --- a/src/plugins/manifest-registry-installed.ts +++ b/src/plugins/manifest-registry-installed.ts @@ -16,7 +16,7 @@ import { hashJson } from "./installed-plugin-index-hash.js"; import type { InstalledPluginIndex, InstalledPluginIndexRecord } from "./installed-plugin-index.js"; import { extractPluginInstallRecordsFromInstalledPluginIndex } from "./installed-plugin-index.js"; import { - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, type PluginManifestRecord, type PluginManifestRegistry, } from "./manifest-registry.js"; @@ -573,7 +573,7 @@ export function loadPluginManifestRegistryForInstalledIndex(params: { .filter((plugin) => params.includeDisabled || plugin.enabled) .filter((plugin) => !pluginIdSet || pluginIdSet.has(plugin.pluginId)) .map((plugin) => toPluginCandidate(plugin, realpathCache)); - return loadPluginManifestRegistry({ + return loadPluginManifestRegistryCore({ config: params.config, workspaceDir: params.workspaceDir, env, diff --git a/src/plugins/manifest-registry.test.ts b/src/plugins/manifest-registry.test.ts index 04de2691d9a9..b8bd630437de 100644 --- a/src/plugins/manifest-registry.test.ts +++ b/src/plugins/manifest-registry.test.ts @@ -6,7 +6,7 @@ import { collectChannelSchemaMetadataCore } from "../config/channel-config-metad import type { PluginInstallRecord } from "../config/types.plugins.js"; import { collectBundledChannelConfigsCore } from "./bundled-channel-config-metadata.js"; import type { PluginCandidate } from "./discovery.js"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; import type { OpenClawPackageManifest } from "./manifest.js"; import { cleanupTrackedTempDirs, makeTrackedTempDir } from "./test-helpers/fs-fixtures.js"; @@ -117,7 +117,7 @@ function createMsteamsClawHubInstallRecord( function resolveMsteamsClawHubTrust(overrides: Partial = {}) { const dir = makeTempDir(); writeManifest(dir, { id: "msteams", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { msteams: createMsteamsClawHubInstallRecord(dir, overrides), }, @@ -136,7 +136,7 @@ function resolveMsteamsClawHubTrust(overrides: Partial = {} function resolveDiffsNpmTrust(overrides: Partial = {}) { const dir = makeTempDir(); writeManifest(dir, { id: "diffs", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { diffs: { source: "npm", @@ -161,7 +161,7 @@ function resolveDiffsNpmTrust(overrides: Partial = {}) { } function loadRegistry(candidates: PluginCandidate[]) { - return loadPluginManifestRegistry({ + return loadPluginManifestRegistryCore({ candidates, }); } @@ -175,7 +175,9 @@ function hermeticEnv(overrides: NodeJS.ProcessEnv = {}): NodeJS.ProcessEnv { }; } -function countDuplicateWarnings(registry: ReturnType): number { +function countDuplicateWarnings( + registry: ReturnType, +): number { return registry.diagnostics.filter( (diagnostic) => diagnostic.level === "warn" && diagnostic.message?.includes("duplicate plugin id"), @@ -183,7 +185,7 @@ function countDuplicateWarnings(registry: ReturnType, + registry: ReturnType, ): boolean { return registry.diagnostics.some((diagnostic) => diagnostic.message.includes("plugin id mismatch"), @@ -191,14 +193,14 @@ function hasPluginIdMismatchWarning( } function expectRegistryDiagnosticContains( - registry: ReturnType, + registry: ReturnType, fragment: string, ) { expect(registry.diagnostics.map((diag) => diag.message).join("\n")).toContain(fragment); } function expectNoRegistryDiagnosticContains( - registry: ReturnType, + registry: ReturnType, fragment: string, ) { expect(registry.diagnostics.map((diag) => diag.message).join("\n")).not.toContain(fragment); @@ -232,7 +234,7 @@ function expectArrayIncludesAll(value: unknown, expected: readonly unknown[], la } function expectDiagnosticFields( - registry: ReturnType, + registry: ReturnType, expected: { level?: string; pluginId?: string; source?: string; messageIncludes?: string }, ) { const diagnostic = registry.diagnostics.find((entry) => { @@ -307,7 +309,7 @@ function loadRegistryForMinHostVersionCase(params: { minHostVersion: string; env?: NodeJS.ProcessEnv; }) { - return loadPluginManifestRegistry({ + return loadPluginManifestRegistryCore({ ...(params.env ? { env: params.env } : {}), candidates: [ createPluginCandidate({ @@ -333,7 +335,7 @@ function loadRegistryForPluginApiCase(params: { origin?: "bundled" | "global" | "workspace" | "config"; idHint?: string; }) { - return loadPluginManifestRegistry({ + return loadPluginManifestRegistryCore({ ...(params.env ? { env: params.env } : {}), candidates: [ createPluginCandidate({ @@ -355,7 +357,7 @@ function loadRegistryForPluginApiCase(params: { }); } -function hasUnsafeManifestDiagnostic(registry: ReturnType) { +function hasUnsafeManifestDiagnostic(registry: ReturnType) { return registry.diagnostics.some((diag) => diag.message.includes("unsafe plugin manifest path")); } @@ -386,7 +388,7 @@ function createDuplicateCandidateRegistry(params: { writeManifest(bundledDir, manifest); writeManifest(duplicateDir, manifest); - return loadPluginManifestRegistry({ + return loadPluginManifestRegistryCore({ candidates: [ createPluginCandidate({ idHint: params.pluginId, @@ -441,7 +443,7 @@ function loadBundleRegistry(params: { } function expectPluginRoot( - registry: ReturnType, + registry: ReturnType, pluginId: string, ) { const plugin = registry.plugins.find((entry) => entry.id === pluginId); @@ -452,8 +454,8 @@ function expectPluginRoot( } function expectCachedPluginRoot(params: { - first: ReturnType; - second: ReturnType; + first: ReturnType; + second: ReturnType; pluginId: string; firstRoot: string; secondRoot: string; @@ -495,7 +497,7 @@ describe("loadPluginManifestRegistry", () => { OPENCLAW_STATE_DIR: stateDir, }); - const first = loadPluginManifestRegistry({ env }); + const first = loadPluginManifestRegistryCore({ env }); writeManifest(pluginDir, { id: "cached-manifest", @@ -505,7 +507,7 @@ describe("loadPluginManifestRegistry", () => { const updatedAt = new Date(Date.now() + 5000); fs.utimesSync(manifestPath, updatedAt, updatedAt); - const second = loadPluginManifestRegistry({ env }); + const second = loadPluginManifestRegistryCore({ env }); manifestChangeCase = { firstName: first.plugins.find((plugin) => plugin.id === "cached-manifest")?.name, secondName: second.plugins.find((plugin) => plugin.id === "cached-manifest")?.name, @@ -522,7 +524,7 @@ describe("loadPluginManifestRegistry", () => { const source = path.join(dir, "maintenance-access.ts"); writeTextFile(dir, "maintenance-access.ts", "export default { register() {} };"); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ config: { plugins: { load: { paths: [source] } } }, candidates: [ createPluginCandidate({ @@ -550,7 +552,7 @@ describe("loadPluginManifestRegistry", () => { const source = path.join(dir, "node-mcp.ts"); writeTextFile(dir, "node-mcp.ts", "export default { register() {} };"); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ config: { plugins: { load: { paths: [source] } } }, candidates: [ createPluginCandidate({ @@ -570,7 +572,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeTextFile(dir, "index.ts", "export default { register() {} };"); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ config: { plugins: { load: { paths: [dir] } } }, env: hermeticEnv(), }); @@ -789,13 +791,13 @@ describe("loadPluginManifestRegistry", () => { origin: "global", }); - const disabledRegistry = loadPluginManifestRegistry({ + const disabledRegistry = loadPluginManifestRegistryCore({ config: { plugins: { entries: { "external-chat": { enabled: false } } } }, candidates: [candidate], }); expectNoRegistryDiagnosticContains(disabledRegistry, "without channelConfigs metadata"); - const allowlistRegistry = loadPluginManifestRegistry({ + const allowlistRegistry = loadPluginManifestRegistryCore({ config: { plugins: { allow: ["other-plugin"] } }, candidates: [candidate], }); @@ -809,7 +811,7 @@ describe("loadPluginManifestRegistry", () => { writeManifest(bundledDir, manifest); writeManifest(globalDir, manifest); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { zalouser: { source: "npm", @@ -844,7 +846,7 @@ describe("loadPluginManifestRegistry", () => { writeManifest(bundledDir, manifest); writeManifest(globalDir, manifest); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ env: hermeticEnv({ OPENCLAW_DEV_SOURCE_ROOT: devSourceRoot }), installRecords: { codex: { @@ -877,7 +879,7 @@ describe("loadPluginManifestRegistry", () => { writeManifest(bundledDir, manifest); writeManifest(globalDir, manifest); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { zalouser: { source: "npm", @@ -1051,7 +1053,7 @@ describe("loadPluginManifestRegistry", () => { it("does not trust a stale source path after switching to ClawHub", () => { const dir = makeTempDir(); writeManifest(dir, { id: "msteams", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { msteams: createMsteamsClawHubInstallRecord(makeTempDir(), { sourcePath: dir }), }, @@ -1072,7 +1074,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "diagnostics-otel", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { "diagnostics-otel": { source: "clawhub", @@ -1100,7 +1102,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "diagnostics-otel", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { "diagnostics-otel": { source: "clawhub", @@ -1125,7 +1127,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "diagnostics-otel", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { "diagnostics-otel": { source: "npm", @@ -1157,7 +1159,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "diagnostics-prometheus", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { "diagnostics-prometheus": { source: "npm", @@ -1193,7 +1195,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "diagnostics-prometheus", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: {}, candidates: [ createPluginCandidate({ @@ -1212,7 +1214,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "msteams", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: {}, candidates: [ createPluginCandidate({ @@ -1663,7 +1665,7 @@ describe("loadPluginManifestRegistry", () => { }, }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ bundledChannelConfigCollector: collectBundledChannelConfigsCore, candidates: [candidate], }); @@ -2834,7 +2836,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "codex", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ installRecords: { codex: { source: "npm", @@ -2865,7 +2867,7 @@ describe("loadPluginManifestRegistry", () => { const dir = makeTempDir(); writeManifest(dir, { id: "codex", configSchema: { type: "object" } }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ candidates: [ createPluginCandidate({ idHint: "codex", @@ -3247,7 +3249,7 @@ describe("loadPluginManifestRegistry", () => { if (!fixture.linked) { return; } - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ env: hermeticEnv({ OPENCLAW_NIX_MODE: "1" }), candidates: [ createPluginCandidate({ @@ -3303,7 +3305,7 @@ describe("loadPluginManifestRegistry", () => { }, }; - const first = loadPluginManifestRegistry({ + const first = loadPluginManifestRegistryCore({ config, env: hermeticEnv({ HOME: homeA, @@ -3311,7 +3313,7 @@ describe("loadPluginManifestRegistry", () => { OPENCLAW_STATE_DIR: path.join(homeA, ".state"), }), }); - const second = loadPluginManifestRegistry({ + const second = loadPluginManifestRegistryCore({ config, env: hermeticEnv({ HOME: homeB, @@ -3348,13 +3350,13 @@ describe("loadPluginManifestRegistry", () => { }), ]; - const olderHost = loadPluginManifestRegistry({ + const olderHost = loadPluginManifestRegistryCore({ candidates, env: hermeticEnv({ OPENCLAW_VERSION: "2026.3.21", }), }); - const newerHost = loadPluginManifestRegistry({ + const newerHost = loadPluginManifestRegistryCore({ candidates, env: hermeticEnv({ OPENCLAW_VERSION: "2026.3.22", diff --git a/src/plugins/manifest-registry.ts b/src/plugins/manifest-registry.ts index 48d16338ba15..8b205b2448a3 100644 --- a/src/plugins/manifest-registry.ts +++ b/src/plugins/manifest-registry.ts @@ -988,7 +988,7 @@ function isSameGlobalPackageDuplicate(left: PluginCandidate, right: PluginCandid ); } -export function loadPluginManifestRegistry( +export function loadPluginManifestRegistryCore( params: { config?: OpenClawConfig; workspaceDir?: string; @@ -1281,7 +1281,7 @@ export function loadBundledPluginManifestRegistry( ): PluginManifestRegistry { const env = params.env ?? process.env; const installRecords: Record = {}; - return loadPluginManifestRegistry({ + return loadPluginManifestRegistryCore({ env, installRecords, discovery: discoverOpenClawPlugins({ diff --git a/src/plugins/plugin-registry-contributions.ts b/src/plugins/plugin-registry-contributions.ts index a7e5d166740c..157dd3cd5e70 100644 --- a/src/plugins/plugin-registry-contributions.ts +++ b/src/plugins/plugin-registry-contributions.ts @@ -2,7 +2,7 @@ import { normalizeSortedUniqueStringEntries } from "@openclaw/normalization-core/string-normalization"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import { - normalizePluginsConfigWithResolver, + normalizePluginsConfigWithResolverCore, type NormalizedPluginsConfig, } from "./config-normalization-shared.js"; import { isInstalledPluginEnabled } from "./installed-plugin-index.js"; @@ -260,7 +260,7 @@ export function normalizePluginsConfigWithRegistry( index: PluginRegistrySnapshot, options: PluginRegistryIdNormalizerOptions = {}, ): NormalizedPluginsConfig { - return normalizePluginsConfigWithResolver( + return normalizePluginsConfigWithResolverCore( config, createPluginRegistryIdNormalizer(index, options), ); diff --git a/src/plugins/provider-auth-choice.runtime.ts b/src/plugins/provider-auth-choice.runtime.ts index 6e391a61b872..15975e283dfd 100644 --- a/src/plugins/provider-auth-choice.runtime.ts +++ b/src/plugins/provider-auth-choice.runtime.ts @@ -1,17 +1,18 @@ // Runtime boundary for resolving provider auth choices from plugins. import { - resolveProviderPluginChoice as resolveProviderPluginChoiceImpl, - runProviderModelSelectedHook as runProviderModelSelectedHookImpl, + resolveProviderPluginChoiceCore as resolveProviderPluginChoiceImpl, + runProviderModelSelectedHookCore as runProviderModelSelectedHookImpl, } from "./provider-wizard.js"; -import { resolvePluginProviders as resolvePluginProvidersImpl } from "./providers.runtime.js"; -import { resolvePluginSetupProvider as resolvePluginSetupProviderImpl } from "./setup-registry.js"; +import { resolvePluginProvidersCore as resolvePluginProvidersImpl } from "./providers.runtime.js"; +import { resolvePluginSetupProviderCore as resolvePluginSetupProviderImpl } from "./setup-registry.js"; type ResolveProviderPluginChoice = - typeof import("./provider-wizard.js").resolveProviderPluginChoice; + typeof import("./provider-wizard.js").resolveProviderPluginChoiceCore; type RunProviderModelSelectedHook = - typeof import("./provider-wizard.js").runProviderModelSelectedHook; -type ResolvePluginProviders = typeof import("./providers.runtime.js").resolvePluginProviders; -type ResolvePluginSetupProvider = typeof import("./setup-registry.js").resolvePluginSetupProvider; + typeof import("./provider-wizard.js").runProviderModelSelectedHookCore; +type ResolvePluginProviders = typeof import("./providers.runtime.js").resolvePluginProvidersCore; +type ResolvePluginSetupProvider = + typeof import("./setup-registry.js").resolvePluginSetupProviderCore; /** Runtime wrapper for provider plugin wizard choice resolution. */ export function resolveProviderPluginChoice( diff --git a/src/plugins/provider-discovery.runtime.test.ts b/src/plugins/provider-discovery.runtime.test.ts index 73dfaa86734e..2386e60c3227 100644 --- a/src/plugins/provider-discovery.runtime.test.ts +++ b/src/plugins/provider-discovery.runtime.test.ts @@ -12,7 +12,7 @@ const mocks = vi.hoisted(() => { loadPluginMetadataSnapshot: vi.fn(), resolvePluginMetadataSnapshot: vi.fn(), resolveDiscoveredProviderPluginIds: vi.fn(), - resolvePluginProviders: vi.fn(), + resolvePluginProvidersCore: vi.fn(), loadSource, loaderCache, clearNativeRequireJavaScriptModuleCache: vi.fn(), @@ -35,7 +35,7 @@ vi.mock("./providers.js", () => ({ })); vi.mock("./providers.runtime.js", () => ({ - resolvePluginProviders: mocks.resolvePluginProviders, + resolvePluginProvidersCore: mocks.resolvePluginProvidersCore, })); vi.mock("./plugin-module-loader-cache.js", () => ({ @@ -192,13 +192,15 @@ function createProvider(params: { id: string; mode: "static" | "catalog" }): Pro function requireResolvePluginProvidersParams(index = 0): { onlyPluginIds?: string[]; } { - const params = (mocks.resolvePluginProviders.mock.calls[index] as [unknown] | undefined)?.[0] as + const params = ( + mocks.resolvePluginProvidersCore.mock.calls[index] as [unknown] | undefined + )?.[0] as | { onlyPluginIds?: string[]; } | undefined; if (!params) { - throw new Error(`resolvePluginProviders call ${index} missing`); + throw new Error(`resolvePluginProvidersCore call ${index} missing`); } return params; } @@ -245,7 +247,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { expect(resolvePluginDiscoveryProvidersRuntime({})).toEqual([ { ...staticProvider, pluginId: "deepseek" }, ]); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("does not synthesize manifest entry providers for runtime-discovered catalogs", () => { @@ -261,7 +263,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { expect(resolvePluginDiscoveryProvidersRuntime({ discoveryEntriesOnly: true })).toStrictEqual( [], ); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("does not synthesize manifest entry providers for refreshable catalogs", () => { @@ -277,13 +279,13 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { expect(resolvePluginDiscoveryProvidersRuntime({ discoveryEntriesOnly: true })).toStrictEqual( [], ); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("loads the full plugin for refreshable manifest catalog rows", () => { const refreshableProvider = createProvider({ id: "token-plan", mode: "catalog" }); mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["token-plan"]); - mocks.resolvePluginProviders.mockReturnValue([refreshableProvider]); + mocks.resolvePluginProvidersCore.mockReturnValue([refreshableProvider]); mocks.loadPluginMetadataSnapshot.mockReturnValue({ index: { plugins: [] }, manifestRegistry: { @@ -299,7 +301,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { it("loads the full plugin when one manifest catalog provider is runtime-owned", () => { const runtimeProvider = createProvider({ id: "xiaomi-token-plan", mode: "catalog" }); mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["xiaomi"]); - mocks.resolvePluginProviders.mockReturnValue([runtimeProvider]); + mocks.resolvePluginProvidersCore.mockReturnValue([runtimeProvider]); mocks.loadPluginMetadataSnapshot.mockReturnValue({ index: { plugins: [] }, manifestRegistry: { @@ -309,7 +311,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { }); expect(resolvePluginDiscoveryProvidersRuntime({})).toStrictEqual([runtimeProvider]); - expect(mocks.resolvePluginProviders).toHaveBeenCalledOnce(); + expect(mocks.resolvePluginProvidersCore).toHaveBeenCalledOnce(); }); it("keeps static manifest entries available for mixed runtime-catalog plugins", () => { @@ -325,7 +327,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { const providers = resolvePluginDiscoveryProvidersRuntime({ discoveryEntriesOnly: true }); expect(providers.map((provider) => provider.id)).toEqual(["xiaomi"]); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("counts mixed static manifest entries for entries-only complete coverage", () => { @@ -349,13 +351,13 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { }); expect(providers.map((provider) => provider.id)).toEqual(["xiaomi", "deepseek"]); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("loads mixed runtime-catalog plugins even when other static entries exist", () => { const runtimeProvider = createProvider({ id: "xiaomi-token-plan", mode: "catalog" }); mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["deepseek", "xiaomi"]); - mocks.resolvePluginProviders.mockReturnValue([runtimeProvider]); + mocks.resolvePluginProvidersCore.mockReturnValue([runtimeProvider]); mocks.loadPluginMetadataSnapshot.mockReturnValue({ index: { plugins: [] }, manifestRegistry: { @@ -376,7 +378,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { it("loads runtime-only catalog plugins declared without manifest rows", () => { const runtimeProvider = createProvider({ id: "runtime-only", mode: "catalog" }); mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["deepseek", "runtime-only"]); - mocks.resolvePluginProviders.mockReturnValue([runtimeProvider]); + mocks.resolvePluginProvidersCore.mockReturnValue([runtimeProvider]); mocks.loadPluginMetadataSnapshot.mockReturnValue({ index: { plugins: [] }, manifestRegistry: { @@ -397,7 +399,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { it("scopes full loading for a single runtime-only catalog plugin without manifest rows", () => { const runtimeProvider = createProvider({ id: "runtime-only", mode: "catalog" }); mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["runtime-only"]); - mocks.resolvePluginProviders.mockReturnValue([runtimeProvider]); + mocks.resolvePluginProvidersCore.mockReturnValue([runtimeProvider]); mocks.loadPluginMetadataSnapshot.mockReturnValue({ index: { plugins: [] }, manifestRegistry: { @@ -417,7 +419,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { const runtimeProvider = createProvider({ id: "runtime-owned", mode: "catalog" }); mocks.loadSource.mockReturnValue(entryProvider); mocks.resolveDiscoveredProviderPluginIds.mockReturnValue(["mixed-entry"]); - mocks.resolvePluginProviders.mockReturnValue([runtimeProvider]); + mocks.resolvePluginProvidersCore.mockReturnValue([runtimeProvider]); mocks.loadPluginMetadataSnapshot.mockReturnValue({ index: { plugins: [] }, manifestRegistry: { @@ -536,7 +538,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { mocks.loadSource.mockImplementation((modulePath: string) => modulePath.includes("/codex/") ? codexEntryProvider : deepseekEntryProvider, ); - mocks.resolvePluginProviders.mockReturnValue(fullProviders); + mocks.resolvePluginProvidersCore.mockReturnValue(fullProviders); expect( resolvePluginDiscoveryProvidersRuntime({ @@ -547,7 +549,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { { ...deepseekEntryProvider, pluginId: "deepseek" }, ...fullProviders, ]); - expect(mocks.resolvePluginProviders).toHaveBeenCalledTimes(1); + expect(mocks.resolvePluginProvidersCore).toHaveBeenCalledTimes(1); const params = requireResolvePluginProvidersParams(); expect(params.onlyPluginIds).toEqual(["kilocode"]); }); @@ -570,14 +572,14 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { }, }); mocks.loadSource.mockReturnValue(codexEntryProvider); - mocks.resolvePluginProviders.mockReturnValue(fullProviders); + mocks.resolvePluginProvidersCore.mockReturnValue(fullProviders); expect( resolvePluginDiscoveryProvidersRuntime({ env: { KILOCODE_API_KEY: "sk-test" } as NodeJS.ProcessEnv, }), ).toEqual([{ ...codexEntryProvider, pluginId: "codex" }, ...fullProviders]); - expect(mocks.resolvePluginProviders).toHaveBeenCalledTimes(1); + expect(mocks.resolvePluginProvidersCore).toHaveBeenCalledTimes(1); const params = requireResolvePluginProvidersParams(); expect(params.onlyPluginIds).toEqual(["kilocode"]); }); @@ -645,7 +647,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { expect(providers[0]?.id).toBe("deepseek"); expect(providers[0]?.pluginId).toBe("deepseek"); expect(providers[0]?.staticCatalog).toBe(staticProvider.staticCatalog); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("returns synthetic-auth discovery entries only when explicitly requested", () => { @@ -669,7 +671,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { expect(providers).toHaveLength(1); expect(providers[0]).toMatchObject({ id: "claude-cli", pluginId: "deepseek" }); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("returns manifest model catalogs as static discovery entries", async () => { @@ -686,7 +688,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { expect(providers.map((provider) => provider.id)).toEqual(["openai"]); expect(providers[0]?.pluginId).toBe("openai"); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); await expect( providers[0]?.staticCatalog?.run({ config: {}, @@ -725,7 +727,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { const providers = resolvePluginDiscoveryProvidersRuntime({ discoveryEntriesOnly: true }); expect(providers).toStrictEqual([]); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("can omit manifest model catalogs from static discovery entries", () => { @@ -744,7 +746,7 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { }); expect(providers).toStrictEqual([]); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); it("defaults missing manifest model costs for static discovery entries", async () => { @@ -866,14 +868,14 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { diagnostics: [], }, }); - mocks.resolvePluginProviders.mockReturnValue([dynamicProvider]); + mocks.resolvePluginProvidersCore.mockReturnValue([dynamicProvider]); const providers = resolvePluginDiscoveryProvidersRuntime({ onlyPluginIds: ["minimax", "openai"], }); expect(providers.map((provider) => provider.id)).toEqual(["openai", "minimax"]); - expect(mocks.resolvePluginProviders).toHaveBeenCalledTimes(1); + expect(mocks.resolvePluginProvidersCore).toHaveBeenCalledTimes(1); expect(requireResolvePluginProvidersParams().onlyPluginIds).toEqual(["minimax"]); }); @@ -892,6 +894,6 @@ describe("resolvePluginDiscoveryProvidersRuntime", () => { expect(resolvePluginDiscoveryProvidersRuntime({ discoveryEntriesOnly: true })).toStrictEqual( [], ); - expect(mocks.resolvePluginProviders).not.toHaveBeenCalled(); + expect(mocks.resolvePluginProvidersCore).not.toHaveBeenCalled(); }); }); diff --git a/src/plugins/provider-discovery.runtime.ts b/src/plugins/provider-discovery.runtime.ts index c7d63710f85f..4fd35626f088 100644 --- a/src/plugins/provider-discovery.runtime.ts +++ b/src/plugins/provider-discovery.runtime.ts @@ -17,7 +17,7 @@ import { getCachedPluginModuleLoader, } from "./plugin-module-loader-cache.js"; import { resolveDiscoveredProviderPluginIds } from "./providers.js"; -import { resolvePluginProviders } from "./providers.runtime.js"; +import { resolvePluginProvidersCore } from "./providers.runtime.js"; import type { ProviderPlugin } from "./types.js"; type ProviderDiscoveryModule = @@ -472,7 +472,7 @@ export function resolvePluginDiscoveryProvidersRuntime(params: { }); const fullProviders = fullPluginIds.length > 0 - ? resolvePluginProviders({ + ? resolvePluginProvidersCore({ ...params, env, onlyPluginIds: fullPluginIds, @@ -490,7 +490,7 @@ export function resolvePluginDiscoveryProvidersRuntime(params: { ]); const fullProviders = fullPluginIds.length > 0 - ? resolvePluginProviders({ + ? resolvePluginProvidersCore({ ...params, env, onlyPluginIds: fullPluginIds, @@ -503,7 +503,7 @@ export function resolvePluginDiscoveryProvidersRuntime(params: { } const runtimeManifestCatalogPluginIds = listRuntimeManifestCatalogPluginIds(entryResult); if (runtimeManifestCatalogPluginIds.length > 0) { - return resolvePluginProviders({ + return resolvePluginProvidersCore({ ...params, env, onlyPluginIds: runtimeManifestCatalogPluginIds, @@ -516,14 +516,14 @@ export function resolvePluginDiscoveryProvidersRuntime(params: { .filter((pluginId): pluginId is string => typeof pluginId === "string" && pluginId !== ""), ); if (fullPluginIds.length > 0) { - return resolvePluginProviders({ + return resolvePluginProvidersCore({ ...params, env, onlyPluginIds: fullPluginIds, }); } } - return resolvePluginProviders({ + return resolvePluginProvidersCore({ ...params, env, }); diff --git a/src/plugins/provider-hook-runtime.ts b/src/plugins/provider-hook-runtime.ts index b5f374833330..c97dfac27629 100644 --- a/src/plugins/provider-hook-runtime.ts +++ b/src/plugins/provider-hook-runtime.ts @@ -16,7 +16,7 @@ import { resolvePluginControlPlaneFingerprint } from "./plugin-control-plane-con import type { PluginMetadataRegistryView } from "./plugin-metadata-snapshot.types.js"; import { resolveProviderConfigApiOwnerHint } from "./provider-config-owner.js"; import { matchesProviderPluginRef } from "./provider-registry-shared.js"; -import { isPluginProvidersLoadInFlight, resolvePluginProviders } from "./providers.runtime.js"; +import { isPluginProvidersLoadInFlight, resolvePluginProvidersCore } from "./providers.runtime.js"; import type { PluginRegistry } from "./registry-types.js"; import { getActivePluginRegistryWorkspaceDirFromState, @@ -219,7 +219,7 @@ export function resolveProviderPluginsForHooks(params: { }): ProviderPlugin[] { const env = params.env ?? process.env; const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDirFromState(); - return resolvePluginProviders({ + return resolvePluginProvidersCore({ ...params, workspaceDir, env, diff --git a/src/plugins/provider-public-artifacts.test.ts b/src/plugins/provider-public-artifacts.test.ts index 67c9c00cda03..c5a6b5527307 100644 --- a/src/plugins/provider-public-artifacts.test.ts +++ b/src/plugins/provider-public-artifacts.test.ts @@ -418,7 +418,7 @@ describe("provider public artifacts", () => { const actual = await importOriginal(); return { ...actual, - loadPluginManifestRegistry, + loadPluginManifestRegistryCore: loadPluginManifestRegistry, }; }); vi.doMock("./public-surface-loader.js", () => ({ @@ -479,7 +479,7 @@ describe("provider public artifacts", () => { const actual = await importOriginal(); return { ...actual, - loadPluginManifestRegistry, + loadPluginManifestRegistryCore: loadPluginManifestRegistry, }; }); vi.doMock("./public-surface-loader.js", () => ({ @@ -604,7 +604,7 @@ describe("provider public artifacts", () => { const actual = await importOriginal(); return { ...actual, - loadPluginManifestRegistry, + loadPluginManifestRegistryCore: loadPluginManifestRegistry, }; }); vi.doMock("./public-surface-loader.js", () => ({ diff --git a/src/plugins/provider-public-artifacts.ts b/src/plugins/provider-public-artifacts.ts index bf7bf46d3aab..29a06a0276cd 100644 --- a/src/plugins/provider-public-artifacts.ts +++ b/src/plugins/provider-public-artifacts.ts @@ -2,7 +2,10 @@ import path from "node:path"; // Extracts provider public artifacts from plugin metadata. import { normalizeProviderId } from "@openclaw/model-catalog-core/provider-id"; import { resolveBundledPluginsDir } from "./bundled-dir.js"; -import { loadPluginManifestRegistry, type PluginManifestRegistry } from "./manifest-registry.js"; +import { + loadPluginManifestRegistryCore, + type PluginManifestRegistry, +} from "./manifest-registry.js"; import { resolveDirectBundledProviderPolicySurface, resolveTrustedExternalProviderPolicySurface, @@ -23,7 +26,7 @@ function resolveBundledProviderPolicyPlugin( return null; } - const registry = options.manifestRegistry ?? loadPluginManifestRegistry(); + const registry = options.manifestRegistry ?? loadPluginManifestRegistryCore(); for (const plugin of registry.plugins.toSorted((left, right) => left.id.localeCompare(right.id), )) { diff --git a/src/plugins/provider-runtime.test.ts b/src/plugins/provider-runtime.test.ts index e8226a45ca6c..430c30289ec2 100644 --- a/src/plugins/provider-runtime.test.ts +++ b/src/plugins/provider-runtime.test.ts @@ -20,7 +20,7 @@ import type { ProviderValidateReplayTurnsContext, } from "./types.js"; -type ResolvePluginProviders = typeof import("./providers.runtime.js").resolvePluginProviders; +type ResolvePluginProviders = typeof import("./providers.runtime.js").resolvePluginProvidersCore; type IsPluginProvidersLoadInFlight = typeof import("./providers.runtime.js").isPluginProvidersLoadInFlight; type ResolveCatalogHookProviderPluginIds = @@ -292,7 +292,7 @@ describe("provider-runtime", () => { }, })); vi.doMock("./providers.runtime.js", () => ({ - resolvePluginProviders: (params: unknown) => resolvePluginProvidersMock(params as never), + resolvePluginProvidersCore: (params: unknown) => resolvePluginProvidersMock(params as never), isPluginProvidersLoadInFlight: (params: unknown) => isPluginProvidersLoadInFlightMock(params as never), })); diff --git a/src/plugins/provider-setup-availability.test.ts b/src/plugins/provider-setup-availability.test.ts index 68fd8eb39c79..6f48a002f34e 100644 --- a/src/plugins/provider-setup-availability.test.ts +++ b/src/plugins/provider-setup-availability.test.ts @@ -3,7 +3,7 @@ import { detectAvailableSetupProviderIds } from "./provider-setup-availability.j const resolveManifestProviderAuthChoices = vi.hoisted(() => vi.fn()); const enablePluginInConfig = vi.hoisted(() => vi.fn()); -const resolvePluginProviders = vi.hoisted(() => vi.fn()); +const resolvePluginProvidersCore = vi.hoisted(() => vi.fn()); const debug = vi.hoisted(() => vi.fn()); vi.mock("./provider-auth-choices.js", () => ({ @@ -15,7 +15,7 @@ vi.mock("./enable.js", () => ({ })); vi.mock("./providers.runtime.js", () => ({ - resolvePluginProviders, + resolvePluginProvidersCore, })); vi.mock("../logging/subsystem.js", () => ({ @@ -44,7 +44,7 @@ describe("detectAvailableSetupProviderIds", () => { it("returns the provider id when its read-only availability probe succeeds", async () => { const detectAvailability = vi.fn(async () => true); - resolvePluginProviders.mockReturnValue([ + resolvePluginProvidersCore.mockReturnValue([ { pluginId: "ollama", id: "ollama", @@ -63,7 +63,7 @@ describe("detectAvailableSetupProviderIds", () => { }); it("treats failed availability probes as an intentional non-match", async () => { - resolvePluginProviders.mockReturnValue([ + resolvePluginProvidersCore.mockReturnValue([ { pluginId: "ollama", id: "ollama", diff --git a/src/plugins/provider-setup-availability.ts b/src/plugins/provider-setup-availability.ts index 28d2e09655de..b938beb84865 100644 --- a/src/plugins/provider-setup-availability.ts +++ b/src/plugins/provider-setup-availability.ts @@ -8,7 +8,7 @@ import { type ProviderAuthChoiceMetadata, resolveManifestProviderAuthChoices, } from "./provider-auth-choices.js"; -import { resolvePluginProviders } from "./providers.runtime.js"; +import { resolvePluginProvidersCore } from "./providers.runtime.js"; const log = createSubsystemLogger("plugins/provider-setup-availability"); @@ -44,7 +44,7 @@ export async function detectAvailableSetupProviderIds(params: { return new Set(); } - const providers = resolvePluginProviders({ + const providers = resolvePluginProvidersCore({ config: discoveryConfig, workspaceDir: params.workspaceDir, env, diff --git a/src/plugins/provider-wizard.test.ts b/src/plugins/provider-wizard.test.ts index 73c86936513e..15712a4df0e4 100644 --- a/src/plugins/provider-wizard.test.ts +++ b/src/plugins/provider-wizard.test.ts @@ -3,16 +3,16 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { buildProviderPluginMethodChoice, resolveProviderModelPickerEntries, - resolveProviderPluginChoice, + resolveProviderPluginChoiceCore, resolveProviderWizardOptions, - runProviderModelSelectedHook, + runProviderModelSelectedHookCore, } from "./provider-wizard.js"; import type { ProviderPlugin } from "./types.js"; -const resolvePluginProviders = vi.hoisted(() => vi.fn<() => ProviderPlugin[]>(() => [])); +const resolvePluginProvidersCore = vi.hoisted(() => vi.fn<() => ProviderPlugin[]>(() => [])); vi.mock("./providers.runtime.js", () => ({ isPluginProvidersLoadInFlight: () => false, - resolvePluginProviders, + resolvePluginProvidersCore, })); const DEFAULT_WORKSPACE_DIR = "/tmp/workspace"; @@ -87,15 +87,15 @@ function expectProviderResolutionCall(params?: { workspaceDir?: string; count?: number; }) { - expect(resolvePluginProviders).toHaveBeenCalledTimes(params?.count ?? 1); - expect(resolvePluginProviders).toHaveBeenCalledWith({ + expect(resolvePluginProvidersCore).toHaveBeenCalledTimes(params?.count ?? 1); + expect(resolvePluginProvidersCore).toHaveBeenCalledWith({ ...createWizardRuntimeParams(params), mode: "setup", }); } function setResolvedProviders(...providers: ProviderPlugin[]) { - resolvePluginProviders.mockReturnValue(providers); + resolvePluginProvidersCore.mockReturnValue(providers); } function expectSingleWizardChoice(params: { @@ -107,7 +107,7 @@ function expectSingleWizardChoice(params: { setResolvedProviders(params.provider); expect(resolveProviderWizardOptions({})).toEqual([params.expectedOption]); expect( - resolveProviderPluginChoice({ + resolveProviderPluginChoiceCore({ providers: [params.provider], choice: params.choice, }), @@ -324,7 +324,7 @@ describe("provider wizard boundaries", () => { ); const env = createHomeEnv(); - await runProviderModelSelectedHook({ + await runProviderModelSelectedHookCore({ config: {}, model: "vllm/qwen3-coder", prompter: {} as never, diff --git a/src/plugins/provider-wizard.ts b/src/plugins/provider-wizard.ts index b060717416c5..29ff4a1b6fb9 100644 --- a/src/plugins/provider-wizard.ts +++ b/src/plugins/provider-wizard.ts @@ -8,8 +8,8 @@ import { DEFAULT_PROVIDER } from "../agents/defaults.js"; import { normalizeProviderId } from "../agents/model-selection.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import type { WizardPrompter } from "../wizard/prompts.js"; -import { resolvePluginProviders } from "./providers.runtime.js"; -import { resolvePluginSetupProvider } from "./setup-registry.js"; +import { resolvePluginProvidersCore } from "./providers.runtime.js"; +import { resolvePluginSetupProviderCore } from "./setup-registry.js"; import type { ProviderAuthMethod, ProviderPlugin, @@ -138,7 +138,7 @@ function resolveProviderWizardProviders(params: { if (providerWizardProvidersResolverForTest) { return providerWizardProvidersResolverForTest(params); } - return resolvePluginProviders({ + return resolvePluginProvidersCore({ config: params.config, workspaceDir: params.workspaceDir, env: params.env, @@ -240,7 +240,7 @@ export function resolveProviderModelPickerEntries(params: { return entries; } -export function resolveProviderPluginChoice(params: { +export function resolveProviderPluginChoiceCore(params: { providers: ProviderPlugin[]; choice: string; }): { @@ -301,7 +301,7 @@ export function resolveProviderPluginChoice(params: { return null; } -export async function runProviderModelSelectedHook(params: { +export async function runProviderModelSelectedHookCore(params: { config: OpenClawConfig; model: string; prompter: WizardPrompter; @@ -322,7 +322,7 @@ export async function runProviderModelSelectedHook(params: { return; } - const setupProvider = resolvePluginSetupProvider({ + const setupProvider = resolvePluginSetupProviderCore({ provider: selectedProviderId, config: params.config, workspaceDir: params.workspaceDir, diff --git a/src/plugins/providers.runtime.consult-current-snapshot.test.ts b/src/plugins/providers.runtime.consult-current-snapshot.test.ts index 9aa4859655ff..575095e10414 100644 --- a/src/plugins/providers.runtime.consult-current-snapshot.test.ts +++ b/src/plugins/providers.runtime.consult-current-snapshot.test.ts @@ -35,7 +35,7 @@ vi.mock("./manifest-registry-installed.js", async (importOriginal) => { }); import { resolveExternalAuthProfilesWithPlugins } from "./provider-runtime.js"; -import { isPluginProvidersLoadInFlight, resolvePluginProviders } from "./providers.runtime.js"; +import { isPluginProvidersLoadInFlight, resolvePluginProvidersCore } from "./providers.runtime.js"; const WORKSPACE = "/workspace/a"; @@ -176,14 +176,14 @@ describe("provider runtime consults the current plugin metadata snapshot", () => }); }); - describe("resolvePluginProviders", () => { + describe("resolvePluginProvidersCore", () => { it("reuses a compatible current snapshot without a direct disk load", () => { const config: OpenClawConfig = {}; registerCurrentSnapshot(config); // onlyPluginIds:[] short-circuits provider materialization after the // snapshot is resolved, isolating the consult-first routing. - const providers = resolvePluginProviders({ + const providers = resolvePluginProvidersCore({ config, env: {}, workspaceDir: WORKSPACE, @@ -199,7 +199,7 @@ describe("provider runtime consults the current plugin metadata snapshot", () => it("falls back to a direct disk load when no current snapshot is registered", () => { armFallbackLoad(); - resolvePluginProviders({ + resolvePluginProvidersCore({ config: {}, env: {}, workspaceDir: WORKSPACE, diff --git a/src/plugins/providers.runtime.ts b/src/plugins/providers.runtime.ts index 6d57bd3277f7..f062fe16eb70 100644 --- a/src/plugins/providers.runtime.ts +++ b/src/plugins/providers.runtime.ts @@ -172,7 +172,7 @@ function resolveProviderMetadataLookup(params: { } function resolveSetupProviderPluginLoadState( - params: Parameters[0], + params: Parameters[0], base: ReturnType, snapshot: PluginMetadataRegistryView, ) { @@ -224,7 +224,7 @@ function resolveSetupProviderPluginLoadState( } function resolveRuntimeProviderPluginLoadState( - params: Parameters[0], + params: Parameters[0], base: ReturnType, snapshot: PluginMetadataRegistryView, ) { @@ -286,7 +286,7 @@ function resolveRuntimeProviderPluginLoadState( } export function isPluginProvidersLoadInFlight( - params: Parameters[0], + params: Parameters[0], ): boolean { const { env, workspaceDir, snapshot } = resolveProviderMetadataLookup(params); const base = resolvePluginProviderLoadBase({ ...params, workspaceDir, env }, snapshot); @@ -300,7 +300,7 @@ export function isPluginProvidersLoadInFlight( return isPluginRegistryLoadInFlight(loadState.loadOptions); } -export function resolvePluginProviders(params: { +export function resolvePluginProvidersCore(params: { config?: PluginLoadOptions["config"]; workspaceDir?: string; /** Use an explicit env when plugin roots should resolve independently from process.env. */ diff --git a/src/plugins/providers.setup-trust.test.ts b/src/plugins/providers.setup-trust.test.ts index 1250c7feb402..db04e42bbb9b 100644 --- a/src/plugins/providers.setup-trust.test.ts +++ b/src/plugins/providers.setup-trust.test.ts @@ -4,7 +4,7 @@ import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import { withEnv } from "../test-utils/env.js"; import { resetPluginLoaderTestStateForTest } from "./loader.test-fixtures.js"; -import { resolvePluginProviders } from "./providers.runtime.js"; +import { resolvePluginProvidersCore } from "./providers.runtime.js"; import { cleanupTrackedTempDirs, makeTrackedTempDir, @@ -110,7 +110,7 @@ describe("setup provider workspace trust", () => { }; withEnv(env, () => { - const providers = resolvePluginProviders({ + const providers = resolvePluginProvidersCore({ config: { plugins: { enabled: true, @@ -151,7 +151,7 @@ describe("setup provider workspace trust", () => { }; withEnv(env, () => { - const providers = resolvePluginProviders({ + const providers = resolvePluginProvidersCore({ config: { plugins: { allow: ["setup-trusted-provider"], diff --git a/src/plugins/providers.test.ts b/src/plugins/providers.test.ts index df00572359dd..e45f49068d41 100644 --- a/src/plugins/providers.test.ts +++ b/src/plugins/providers.test.ts @@ -18,7 +18,7 @@ type GetRuntimePluginRegistryForLoadOptions = type LoadOpenClawPlugins = typeof import("./loader.js").loadOpenClawPlugins; type IsPluginRegistryLoadInFlight = typeof import("./loader.js").isPluginRegistryLoadInFlight; type LoadPluginManifestRegistry = - typeof import("./manifest-registry.js").loadPluginManifestRegistry; + typeof import("./manifest-registry.js").loadPluginManifestRegistryCore; type LoadPluginMetadataSnapshot = typeof import("./plugin-metadata-snapshot.js").loadPluginMetadataSnapshot; type ApplyPluginAutoEnable = typeof import("../config/plugin-auto-enable.js").applyPluginAutoEnable; @@ -45,7 +45,7 @@ let resolveUsageHookProviderPluginContracts: typeof import("./providers.js").res let resolveExternalAuthProfileProviderPluginIds: typeof import("./providers.js").resolveExternalAuthProfileProviderPluginIds; let resolveDiscoveredProviderPluginIds: typeof import("./providers.js").resolveDiscoveredProviderPluginIds; let resolveDiscoverableProviderOwnerPluginIds: typeof import("./providers.js").resolveDiscoverableProviderOwnerPluginIds; -let resolvePluginProviders: typeof import("./providers.runtime.js").resolvePluginProviders; +let resolvePluginProviders: typeof import("./providers.runtime.js").resolvePluginProvidersCore; let setActivePluginRegistry: SetActivePluginRegistry; type ManifestProviderPluginFixture = { @@ -477,7 +477,7 @@ describe("resolvePluginProviders", () => { applyPluginAutoEnableMock(...args), })); vi.doMock("./manifest-registry.js", () => ({ - loadPluginManifestRegistry: (...args: Parameters) => + loadPluginManifestRegistryCore: (...args: Parameters) => loadPluginManifestRegistryMock(...args), })); vi.doMock("./plugin-metadata-snapshot.js", () => { @@ -527,7 +527,8 @@ describe("resolvePluginProviders", () => { resolveDiscoveredProviderPluginIds, resolveDiscoverableProviderOwnerPluginIds, } = await import("./providers.js")); - ({ resolvePluginProviders } = await import("./providers.runtime.js")); + ({ resolvePluginProvidersCore: resolvePluginProviders } = + await import("./providers.runtime.js")); ({ setActivePluginRegistry } = await import("./runtime.js")); }); diff --git a/src/plugins/runtime/index.test.ts b/src/plugins/runtime/index.test.ts index a691cc1c0864..9404308a928d 100644 --- a/src/plugins/runtime/index.test.ts +++ b/src/plugins/runtime/index.test.ts @@ -15,7 +15,7 @@ import { VERSION } from "../../version.js"; const runtimeModelAuthMocks = vi.hoisted(() => ({ getApiKeyForModel: vi.fn(), getRuntimeAuthForModelCore: vi.fn(), - resolveApiKeyForProvider: vi.fn(), + resolveProviderRuntimeApiKey: vi.fn(), })); const sandboxContextMocks = vi.hoisted(() => ({ resolveSandboxContext: vi.fn(), @@ -24,7 +24,7 @@ const sandboxContextMocks = vi.hoisted(() => ({ vi.mock("./runtime-model-auth.runtime.js", () => ({ getApiKeyForModel: runtimeModelAuthMocks.getApiKeyForModel, getRuntimeAuthForModelCore: runtimeModelAuthMocks.getRuntimeAuthForModelCore, - resolveProviderRuntimeApiKey: runtimeModelAuthMocks.resolveApiKeyForProvider, + resolveProviderRuntimeApiKey: runtimeModelAuthMocks.resolveProviderRuntimeApiKey, })); vi.mock("../../agents/sandbox/context.js", () => sandboxContextMocks); @@ -107,7 +107,7 @@ describe("plugin runtime command execution", () => { vi.restoreAllMocks(); runtimeModelAuthMocks.getApiKeyForModel.mockReset(); runtimeModelAuthMocks.getRuntimeAuthForModelCore.mockReset(); - runtimeModelAuthMocks.resolveApiKeyForProvider.mockReset(); + runtimeModelAuthMocks.resolveProviderRuntimeApiKey.mockReset(); sandboxContextMocks.resolveSandboxContext.mockReset(); resetConfigRuntimeState(); }); @@ -429,7 +429,7 @@ describe("plugin runtime command execution", () => { source: "workspace cloud credentials", mode: "api-key", }); - runtimeModelAuthMocks.resolveApiKeyForProvider.mockResolvedValue({ + runtimeModelAuthMocks.resolveProviderRuntimeApiKey.mockResolvedValue({ apiKey: "provider-key", source: "workspace cloud credentials", mode: "api-key", @@ -458,7 +458,7 @@ describe("plugin runtime command execution", () => { cfg, workspaceDir: "/tmp/workspace", }); - expect(runtimeModelAuthMocks.resolveApiKeyForProvider).toHaveBeenCalledWith({ + expect(runtimeModelAuthMocks.resolveProviderRuntimeApiKey).toHaveBeenCalledWith({ provider: "workspace-cloud", cfg, workspaceDir: "/tmp/workspace", diff --git a/src/plugins/runtime/runtime-plugin-boundary.ts b/src/plugins/runtime/runtime-plugin-boundary.ts index b9fddbf40df7..e1fd00989c2d 100644 --- a/src/plugins/runtime/runtime-plugin-boundary.ts +++ b/src/plugins/runtime/runtime-plugin-boundary.ts @@ -3,7 +3,7 @@ import fs from "node:fs"; import path from "node:path"; import { expectDefined } from "@openclaw/normalization-core"; import { getRuntimeConfig } from "../../config/config.js"; -import { loadPluginManifestRegistry } from "../manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../manifest-registry.js"; import { isJavaScriptModulePath, tryNativeRequireJavaScriptModule, @@ -31,7 +31,7 @@ export function resolvePluginRuntimeRecordByEntryBaseNames( entryBaseNames: string[], onMissing?: () => never, ): PluginRuntimeRecord | null { - const manifestRegistry = loadPluginManifestRegistry({ + const manifestRegistry = loadPluginManifestRegistryCore({ config: readPluginBoundaryConfigSafely(), }); const matches = manifestRegistry.plugins.filter((plugin) => { diff --git a/src/plugins/setup-registry.test.ts b/src/plugins/setup-registry.test.ts index 71e3c24fe638..899cbde56355 100644 --- a/src/plugins/setup-registry.test.ts +++ b/src/plugins/setup-registry.test.ts @@ -25,7 +25,7 @@ const mocks = getRegistryJitiMocks(); let clearPluginSetupRegistryCache: typeof import("./setup-registry.test-fixtures.js").clearPluginSetupRegistryCache; let resolvePluginSetupRegistry: typeof import("./setup-registry.js").resolvePluginSetupRegistry; -let resolvePluginSetupProvider: typeof import("./setup-registry.js").resolvePluginSetupProvider; +let resolvePluginSetupProviderCore: typeof import("./setup-registry.js").resolvePluginSetupProviderCore; let resolvePluginSetupCliBackend: typeof import("./setup-registry.js").resolvePluginSetupCliBackend; let runPluginSetupConfigMigrations: typeof import("./setup-registry.js").runPluginSetupConfigMigrations; let setPluginSetupRegistryModuleLoaderFactoryForTest: @@ -250,7 +250,7 @@ describe("setup-registry module loader", () => { vi.resetModules(); ({ resolvePluginSetupRegistry, - resolvePluginSetupProvider, + resolvePluginSetupProviderCore, resolvePluginSetupCliBackend, runPluginSetupConfigMigrations, } = await import("./setup-registry.js")); @@ -462,11 +462,11 @@ describe("setup-registry module loader", () => { }); const provider = requireRecord( - resolvePluginSetupProvider({ provider: "amazon-bedrock", env: {} }), + resolvePluginSetupProviderCore({ provider: "amazon-bedrock", env: {} }), ); expect(provider.id).toBe("amazon-bedrock"); expect(provider.label).toBe("Amazon Bedrock"); - expect(resolvePluginSetupProvider({ provider: "legacy-bedrock", env: {} })).toBeUndefined(); + expect(resolvePluginSetupProviderCore({ provider: "legacy-bedrock", env: {} })).toBeUndefined(); expect(mocks.createJiti).toHaveBeenCalledTimes(1); expect(mockArg(mocks.createJiti, 0, 0)).toBe(path.join(pluginRoot, "setup-api.js")); }); @@ -510,7 +510,7 @@ describe("setup-registry module loader", () => { }); }); - const provider = requireRecord(resolvePluginSetupProvider({ provider: "openai", env: {} })); + const provider = requireRecord(resolvePluginSetupProviderCore({ provider: "openai", env: {} })); expect(provider.id).toBe("openai"); expect(provider.label).toBe("OpenAI"); }); @@ -537,7 +537,7 @@ describe("setup-registry module loader", () => { diagnostics: [], }); - expect(resolvePluginSetupProvider({ provider: "openai", env: {} })).toBeUndefined(); + expect(resolvePluginSetupProviderCore({ provider: "openai", env: {} })).toBeUndefined(); expect(resolvePluginSetupCliBackend({ backend: "codex-cli", env: {} })).toBeUndefined(); const registry = resolvePluginSetupRegistry({ env: {} }); expect(registry.providers).toEqual([]); @@ -678,7 +678,7 @@ describe("setup-registry module loader", () => { const cwdSpy = vi.spyOn(process, "cwd").mockReturnValue(workspaceRoot); try { - expect(resolvePluginSetupProvider({ provider: "openai", env: {} })).toBeUndefined(); + expect(resolvePluginSetupProviderCore({ provider: "openai", env: {} })).toBeUndefined(); } finally { cwdSpy.mockRestore(); } @@ -794,7 +794,9 @@ describe("setup-registry module loader", () => { }); await expectNoUnhandledRejection(() => { - const provider = requireRecord(resolvePluginSetupProvider({ provider: "openai", env: {} })); + const provider = requireRecord( + resolvePluginSetupProviderCore({ provider: "openai", env: {} }), + ); expect(provider.id).toBe("openai"); expect(provider.label).toBe("OpenAI"); }); @@ -834,7 +836,7 @@ describe("setup-registry module loader", () => { kind: "provider", }); - expect(resolvePluginSetupProvider({ provider: "openai", env: {} })).toBeUndefined(); + expect(resolvePluginSetupProviderCore({ provider: "openai", env: {} })).toBeUndefined(); expect(mocks.createJiti).not.toHaveBeenCalled(); }); @@ -844,7 +846,7 @@ describe("setup-registry module loader", () => { kind: "provider", }); - expect(resolvePluginSetupProvider({ provider: "openai", env: {} })).toBeUndefined(); + expect(resolvePluginSetupProviderCore({ provider: "openai", env: {} })).toBeUndefined(); expect(mocks.createJiti).not.toHaveBeenCalled(); }); @@ -903,9 +905,11 @@ describe("setup-registry module loader", () => { })); mocks.createJiti.mockImplementation(() => loadSetupModule); - expect(resolvePluginSetupProvider({ provider: "openai", env: {} })?.id).toBe("openai"); - expect(resolvePluginSetupProvider({ provider: "anthropic", env: {} })?.id).toBe("anthropic"); - expect(resolvePluginSetupProvider({ provider: "openai", env: {} })?.id).toBe("openai"); + expect(resolvePluginSetupProviderCore({ provider: "openai", env: {} })?.id).toBe("openai"); + expect(resolvePluginSetupProviderCore({ provider: "anthropic", env: {} })?.id).toBe( + "anthropic", + ); + expect(resolvePluginSetupProviderCore({ provider: "openai", env: {} })?.id).toBe("openai"); expect(resolvePluginSetupCliBackend({ backend: "codex-cli", env: {} })?.backend.id).toBe( "codex-cli", diff --git a/src/plugins/setup-registry.ts b/src/plugins/setup-registry.ts index 9e8749105ae1..2bde8a3da746 100644 --- a/src/plugins/setup-registry.ts +++ b/src/plugins/setup-registry.ts @@ -713,7 +713,7 @@ export function resolvePluginSetupRegistry(params?: { return registry; } -export function resolvePluginSetupProvider(params: { +export function resolvePluginSetupProviderCore(params: { provider: string; config?: OpenClawConfig; workspaceDir?: string; diff --git a/src/plugins/stage-bundled-plugin-runtime.test.ts b/src/plugins/stage-bundled-plugin-runtime.test.ts index fe8192a7703a..9e9cf756e021 100644 --- a/src/plugins/stage-bundled-plugin-runtime.test.ts +++ b/src/plugins/stage-bundled-plugin-runtime.test.ts @@ -7,7 +7,7 @@ import { afterEach, describe, expect, it, vi } from "vitest"; import { stageBundledPluginRuntime } from "../../scripts/stage-bundled-plugin-runtime.mts"; import { withMockedWindowsPlatform, withRestoredMocks } from "../test-utils/vitest-spies.js"; import { discoverOpenClawPlugins } from "./discovery.js"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; import { cleanupTrackedTempDirs, makeTrackedTempDir } from "./test-helpers/fs-fixtures.js"; const tempDirs: string[] = []; @@ -545,7 +545,7 @@ describe("stageBundledPluginRuntime", () => { const discovery = discoverOpenClawPlugins({ env, }); - const manifestRegistry = loadPluginManifestRegistry({ + const manifestRegistry = loadPluginManifestRegistryCore({ env, candidates: discovery.candidates, diagnostics: discovery.diagnostics, diff --git a/src/plugins/test-helpers/registry-jiti-mocks.ts b/src/plugins/test-helpers/registry-jiti-mocks.ts index fffdb27134de..0be544c990e5 100644 --- a/src/plugins/test-helpers/registry-jiti-mocks.ts +++ b/src/plugins/test-helpers/registry-jiti-mocks.ts @@ -15,7 +15,7 @@ vi.mock("../discovery.js", () => ({ })); vi.mock("../manifest-registry.js", () => ({ - loadPluginManifestRegistry: ( + loadPluginManifestRegistryCore: ( ...args: Parameters ) => registryJitiMocks.loadPluginManifestRegistry(...args), })); diff --git a/src/plugins/web-fetch-providers.runtime.test.ts b/src/plugins/web-fetch-providers.runtime.test.ts index 9ded1713f780..887de632960f 100644 --- a/src/plugins/web-fetch-providers.runtime.test.ts +++ b/src/plugins/web-fetch-providers.runtime.test.ts @@ -125,8 +125,8 @@ describe("resolvePluginWebFetchProviders", () => { }); beforeEach(() => { - vi.spyOn(manifestRegistryModule, "loadPluginManifestRegistry").mockReturnValue( - createManifestRegistryFixture() as ManifestRegistryModule["loadPluginManifestRegistry"] extends ( + vi.spyOn(manifestRegistryModule, "loadPluginManifestRegistryCore").mockReturnValue( + createManifestRegistryFixture() as ManifestRegistryModule["loadPluginManifestRegistryCore"] extends ( ...args: unknown[] ) => infer R ? R @@ -157,10 +157,10 @@ describe("resolvePluginWebFetchProviders", () => { }); it("falls back to the plugin loader for non-bundled provider owners", () => { - vi.mocked(manifestRegistryModule.loadPluginManifestRegistry).mockReturnValue( + vi.mocked(manifestRegistryModule.loadPluginManifestRegistryCore).mockReturnValue( createManifestRegistryFixture( "global", - ) as ManifestRegistryModule["loadPluginManifestRegistry"] extends ( + ) as ManifestRegistryModule["loadPluginManifestRegistryCore"] extends ( ...args: unknown[] ) => infer R ? R @@ -258,10 +258,10 @@ describe("resolvePluginWebFetchProviders", () => { "default", "/tmp/runtime-workspace", ); - vi.mocked(manifestRegistryModule.loadPluginManifestRegistry).mockReturnValue( + vi.mocked(manifestRegistryModule.loadPluginManifestRegistryCore).mockReturnValue( createManifestRegistryFixture( "global", - ) as ManifestRegistryModule["loadPluginManifestRegistry"] extends ( + ) as ManifestRegistryModule["loadPluginManifestRegistryCore"] extends ( ...args: unknown[] ) => infer R ? R @@ -273,7 +273,7 @@ describe("resolvePluginWebFetchProviders", () => { env, }); - expect(manifestRegistryModule.loadPluginManifestRegistry).toHaveBeenCalledWith({ + expect(manifestRegistryModule.loadPluginManifestRegistryCore).toHaveBeenCalledWith({ config: rawConfig, workspaceDir: "/tmp/runtime-workspace", env, @@ -298,10 +298,10 @@ describe("resolvePluginWebFetchProviders", () => { it("resolves web-fetch providers for each active registry workspace", () => { const env = createWebFetchEnv(); const config = createFirecrawlAllowConfig(); - vi.mocked(manifestRegistryModule.loadPluginManifestRegistry).mockReturnValue( + vi.mocked(manifestRegistryModule.loadPluginManifestRegistryCore).mockReturnValue( createManifestRegistryFixture( "global", - ) as ManifestRegistryModule["loadPluginManifestRegistry"] extends ( + ) as ManifestRegistryModule["loadPluginManifestRegistryCore"] extends ( ...args: unknown[] ) => infer R ? R diff --git a/src/plugins/web-provider-public-artifacts.explicit-fast-path.test.ts b/src/plugins/web-provider-public-artifacts.explicit-fast-path.test.ts index 1c4c2c3f8e1c..723fdd201d93 100644 --- a/src/plugins/web-provider-public-artifacts.explicit-fast-path.test.ts +++ b/src/plugins/web-provider-public-artifacts.explicit-fast-path.test.ts @@ -111,7 +111,7 @@ vi.mock("./manifest-registry.js", async (importOriginal) => { const actual = await importOriginal(); return { ...actual, - loadPluginManifestRegistry: loadPluginManifestRegistryMock, + loadPluginManifestRegistryCore: loadPluginManifestRegistryMock, }; }); diff --git a/src/plugins/web-provider-public-artifacts.test.ts b/src/plugins/web-provider-public-artifacts.test.ts index 6090bfe89c36..ab1e15fc18f9 100644 --- a/src/plugins/web-provider-public-artifacts.test.ts +++ b/src/plugins/web-provider-public-artifacts.test.ts @@ -1,12 +1,12 @@ // Covers web provider public artifact extraction from plugin metadata. import { describe, expect, it } from "vitest"; -import { loadPluginManifestRegistry } from "./manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "./manifest-registry.js"; import { loadBundledWebFetchProviderEntriesFromDir, loadBundledWebSearchProviderEntriesFromDir, } from "./web-provider-public-artifacts.explicit.js"; -const registry = loadPluginManifestRegistry(); +const registry = loadPluginManifestRegistryCore(); const webSearchPluginIds = bundledPluginIdsWithContract("webSearchProviders"); const webFetchPluginIds = bundledPluginIdsWithContract("webFetchProviders"); diff --git a/src/plugins/web-search-providers.runtime.test.ts b/src/plugins/web-search-providers.runtime.test.ts index 1672b06a9f21..e9dda7bd8d92 100644 --- a/src/plugins/web-search-providers.runtime.test.ts +++ b/src/plugins/web-search-providers.runtime.test.ts @@ -276,7 +276,7 @@ describe("resolvePluginWebSearchProviders", () => { await vi.importActual("./manifest-registry.js"); return { ...actual, - loadPluginManifestRegistry: ( + loadPluginManifestRegistryCore: ( ...args: Parameters ) => loadPluginManifestRegistryMock(...args), }; diff --git a/src/secrets/configure.test.ts b/src/secrets/configure.test.ts index af00bc360e9f..e92da816de84 100644 --- a/src/secrets/configure.test.ts +++ b/src/secrets/configure.test.ts @@ -27,7 +27,7 @@ vi.mock("../agents/auth-profiles/persisted.js", () => ({ })); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: (...args: unknown[]) => loadPluginManifestRegistryMock(...args), + loadPluginManifestRegistryCore: (...args: unknown[]) => loadPluginManifestRegistryMock(...args), })); vi.mock("./apply.js", () => ({ diff --git a/src/secrets/configure.ts b/src/secrets/configure.ts index f5f62f9a0aa6..cd1b9e0664ad 100644 --- a/src/secrets/configure.ts +++ b/src/secrets/configure.ts @@ -21,7 +21,7 @@ import { } from "../config/types.secrets.js"; import { isSafeExecutableValue } from "../infra/exec-safety.js"; import { parseStrictPositiveInteger } from "../infra/parse-finite-number.js"; -import { loadPluginManifestRegistry } from "../plugins/manifest-registry.js"; +import { loadPluginManifestRegistryCore } from "../plugins/manifest-registry.js"; import { normalizeAgentId } from "../routing/session-key.js"; import { runSecretsApply, type SecretsApplyResult } from "./apply.js"; import { createSecretsConfigIO } from "./config-io.js"; @@ -176,7 +176,7 @@ function loadSecretProviderIntegrationPresets(params: { config: OpenClawConfig; env: NodeJS.ProcessEnv; }): SecretProviderIntegrationPreset[] { - const manifestRegistry = loadPluginManifestRegistry({ + const manifestRegistry = loadPluginManifestRegistryCore({ config: params.config, env: params.env, }); diff --git a/src/secrets/provider-integrations.test.ts b/src/secrets/provider-integrations.test.ts index b7580628c7df..267c2b494cc1 100644 --- a/src/secrets/provider-integrations.test.ts +++ b/src/secrets/provider-integrations.test.ts @@ -5,7 +5,7 @@ import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import type { PluginCandidate } from "../plugins/discovery.js"; import { - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, type PluginManifestRegistry, } from "../plugins/manifest-registry.js"; import type { PluginOrigin } from "../plugins/plugin-origin.types.js"; @@ -69,7 +69,7 @@ function loadTestRegistry( idHint: string, origin: PluginOrigin = "global", ): PluginManifestRegistry { - return loadPluginManifestRegistry({ + return loadPluginManifestRegistryCore({ candidates: [createCandidate(rootDir, idHint, origin)], }); } @@ -255,7 +255,7 @@ describe("secret provider integration presets", () => { }, }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ candidates: [ createCandidate(rootDir, "long-integration-secrets"), createCandidate(longPluginRootDir, longPluginId), @@ -303,7 +303,7 @@ describe("secret provider integration presets", () => { }, }); - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ candidates: [createCandidate(rootDir, "disabled-secrets", "global")], config: { plugins: { @@ -355,7 +355,7 @@ describe("secret provider integration presets", () => { }, }, }; - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ candidates: [createCandidate(rootDir, "openai", "global")], config, }); @@ -543,7 +543,7 @@ describe("secret provider integration presets", () => { }, }, }; - const registry = loadPluginManifestRegistry({ + const registry = loadPluginManifestRegistryCore({ candidates: [createCandidate(rootDir, "revoked-secrets", "global")], config, }); diff --git a/src/secrets/resolve.manifest-registry.test.ts b/src/secrets/resolve.manifest-registry.test.ts index 3097d9f90fa9..f312d33f613c 100644 --- a/src/secrets/resolve.manifest-registry.test.ts +++ b/src/secrets/resolve.manifest-registry.test.ts @@ -10,7 +10,7 @@ import { withSecureTestNodeExecPath } from "./test-node-command.test-support.js" const mocks = vi.hoisted(() => ({ getCurrentPluginMetadataSnapshot: vi.fn(), - loadPluginManifestRegistry: vi.fn(() => { + loadPluginManifestRegistryCore: vi.fn(() => { throw new Error("unexpected manifest registry rediscovery"); }), })); @@ -20,7 +20,7 @@ vi.mock("../plugins/current-plugin-metadata-snapshot.js", () => ({ })); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: mocks.loadPluginManifestRegistry, + loadPluginManifestRegistryCore: mocks.loadPluginManifestRegistryCore, })); function createPluginManagedSecretProviderFixture(): { @@ -87,7 +87,7 @@ function createPluginManagedSecretProviderFixture(): { describe("resolveSecretRefString manifest registry reuse", () => { afterEach(() => { mocks.getCurrentPluginMetadataSnapshot.mockReset(); - mocks.loadPluginManifestRegistry.mockClear(); + mocks.loadPluginManifestRegistryCore.mockClear(); }); it("uses an explicit manifest registry without rediscovering plugin manifests", async () => { @@ -105,7 +105,7 @@ describe("resolveSecretRefString manifest registry reuse", () => { ).resolves.toBe("value:providers/openrouter/apiKey"); }); expect(mocks.getCurrentPluginMetadataSnapshot).not.toHaveBeenCalled(); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); } finally { fs.rmSync(rootDir, { recursive: true, force: true }); } @@ -132,7 +132,7 @@ describe("resolveSecretRefString manifest registry reuse", () => { env, allowWorkspaceScopedSnapshot: true, }); - expect(mocks.loadPluginManifestRegistry).not.toHaveBeenCalled(); + expect(mocks.loadPluginManifestRegistryCore).not.toHaveBeenCalled(); } finally { fs.rmSync(rootDir, { recursive: true, force: true }); } diff --git a/src/secrets/resolve.ts b/src/secrets/resolve.ts index 9798c5aeef5d..220a43dcc7a1 100644 --- a/src/secrets/resolve.ts +++ b/src/secrets/resolve.ts @@ -16,7 +16,7 @@ import { formatErrorMessage } from "../infra/errors.js"; import { FsSafeError, readSecureFile } from "../infra/fs-safe.js"; import { getCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js"; import { - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, type PluginManifestRegistry, } from "../plugins/manifest-registry.js"; import { runCommandWithTimeout } from "../process/exec.js"; @@ -188,7 +188,7 @@ function resolveConfiguredProvider(params: { env: params.env, allowWorkspaceScopedSnapshot: true, })?.manifestRegistry ?? - loadPluginManifestRegistry({ + loadPluginManifestRegistryCore({ config, env: params.env, }); diff --git a/src/secrets/target-registry.fast-path.test.ts b/src/secrets/target-registry.fast-path.test.ts index f4e31405b26e..3b187099344b 100644 --- a/src/secrets/target-registry.fast-path.test.ts +++ b/src/secrets/target-registry.fast-path.test.ts @@ -53,7 +53,7 @@ const { loadBundledPluginPublicArtifactModuleSyncMock } = vi.hoisted(() => ({ })); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry: loadPluginManifestRegistryMock, + loadPluginManifestRegistryCore: loadPluginManifestRegistryMock, })); vi.mock("../plugins/public-surface-loader.js", () => ({ diff --git a/src/security/audit-channel-readonly-setup-fallback.test.ts b/src/security/audit-channel-readonly-setup-fallback.test.ts index 8a3d88b80522..61d1ac801efa 100644 --- a/src/security/audit-channel-readonly-setup-fallback.test.ts +++ b/src/security/audit-channel-readonly-setup-fallback.test.ts @@ -64,7 +64,7 @@ vi.mock("./audit.nondeep.runtime.js", () => ({ readConfigSnapshotForAudit: vi.fn(async () => null), })); -const { runSecurityAudit } = await import("./audit.js"); +const { runSecurityAuditCore } = await import("./audit.js"); describe("security audit channel read-only setup fallback", () => { it("passes setup fallback plugins to channel security collection", async () => { @@ -104,7 +104,7 @@ describe("security audit channel read-only setup fallback", () => { hasConfiguredChannelsForReadOnlyScopeMock.mockReturnValue(true); listReadOnlyChannelPluginsForConfigMock.mockReturnValue([plugin]); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: cfg, sourceConfig: cfg, includeFilesystem: false, diff --git a/src/security/audit-config-basics.test.ts b/src/security/audit-config-basics.test.ts index 5a0a61f9bb5b..cea8c5d60682 100644 --- a/src/security/audit-config-basics.test.ts +++ b/src/security/audit-config-basics.test.ts @@ -11,7 +11,7 @@ import { type DiagnosticSecurityEvent, } from "../infra/diagnostic-events.js"; import { collectMinimalProfileOverrideFindings } from "./audit-extra.sync.js"; -import { runSecurityAudit } from "./audit.js"; +import { runSecurityAuditCore } from "./audit.js"; import { collectSecurityAuditFindings } from "./audit.test-support.js"; const execFileAsync = promisify(execFile); @@ -96,7 +96,7 @@ describe("security audit config basics", () => { "utf8", ); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -144,7 +144,7 @@ describe("security audit config basics", () => { Buffer.alloc(16 * 1024 * 1024 + 1, 0x20), ); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -182,7 +182,7 @@ describe("security audit config basics", () => { it("does not flag mcporter registry inspection when the registry is missing", async () => { const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-audit-mcporter-missing-")); try { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -220,7 +220,7 @@ describe("security audit config basics", () => { "utf8", ); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -258,7 +258,7 @@ describe("security audit config basics", () => { "utf8", ); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] } }, sourceConfig: {}, env: { OPENCLAW_STATE_DIR: stateDir }, @@ -284,7 +284,7 @@ describe("security audit config basics", () => { recursive: true, }); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -323,7 +323,7 @@ describe("security audit config basics", () => { await fs.mkdir(configDir, { recursive: true }); await execFileAsync("mkfifo", [path.join(configDir, "mcporter.json")]); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -369,7 +369,7 @@ describe("security audit config basics", () => { ); await fs.symlink(targetPath, path.join(configDir, "mcporter.json")); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -411,7 +411,7 @@ describe("security audit config basics", () => { await fs.writeFile(targetPath, Buffer.alloc(16 * 1024 * 1024 + 1, 0x20)); await fs.symlink(targetPath, path.join(configDir, "mcporter.json")); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [ @@ -442,7 +442,7 @@ describe("security audit config basics", () => { it("does not flag per-agent skill allowlists when matching agents deny exec", async () => { const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-audit-mcporter-deny-")); try { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { mcp: { servers: { @@ -473,7 +473,7 @@ describe("security audit config basics", () => { it("audits inherited defaults independently of the default agent override", async () => { const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-audit-mcp-defaults-")); try { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { mcp: { servers: { @@ -513,7 +513,7 @@ describe("security audit config basics", () => { }); it("suppresses configured accepted findings from the active audit report", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] }, security: { @@ -555,7 +555,7 @@ describe("security audit config basics", () => { }); it("keeps unrelated dangerous flags active when one dangerous flag is suppressed", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { entries: { main: { default: true } } }, hooks: { gmail: { allowUnsafeExternalContent: true } }, @@ -605,9 +605,9 @@ describe("security audit config basics", () => { resetDiagnosticEventsForTest(); const captured = captureSecurityEvents(); - let report: Awaited>; + let report: Awaited>; try { - report = await runSecurityAudit({ + report = await runSecurityAuditCore({ config: { agents: { entries: { main: { default: true } } } }, sourceConfig: {}, env: {}, diff --git a/src/security/audit-control-ui-device-auth-migration.test.ts b/src/security/audit-control-ui-device-auth-migration.test.ts index 35fcf99677e6..e2042119baf0 100644 --- a/src/security/audit-control-ui-device-auth-migration.test.ts +++ b/src/security/audit-control-ui-device-auth-migration.test.ts @@ -8,7 +8,7 @@ import { importPendingControlUiDeviceAuthMigration, } from "../state/control-ui-device-auth-migration.js"; import { closeOpenClawStateDatabaseForTest } from "../state/openclaw-state-db.js"; -import { runSecurityAudit } from "./audit.js"; +import { runSecurityAuditCore } from "./audit.js"; const stateDirs: string[] = []; @@ -19,7 +19,7 @@ function createStateEnv(): { stateDir: string; env: NodeJS.ProcessEnv } { } async function collectMigrationFinding(params: { stateDir: string; env: NodeJS.ProcessEnv }) { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: {}, env: params.env, stateDir: params.stateDir, diff --git a/src/security/audit-extra.summary.ts b/src/security/audit-extra.summary.ts index 01d917fb3528..97b13c917db8 100644 --- a/src/security/audit-extra.summary.ts +++ b/src/security/audit-extra.summary.ts @@ -12,7 +12,7 @@ import { isToolAllowedByPolicies } from "../agents/tool-policy-match.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; import type { AgentToolsConfig } from "../config/types.tools.js"; import { hasConfiguredInternalHooks } from "../hooks/configured.js"; -import { normalizePluginsConfigWithResolver } from "../plugins/config-normalization-shared.js"; +import { normalizePluginsConfigWithResolverCore } from "../plugins/config-normalization-shared.js"; import { passesManifestOwnerBasePolicy } from "../plugins/manifest-owner-policy.js"; import { hasConfiguredWebSearchCredential } from "../plugins/web-search-credential-presence.js"; import { inferParamBFromIdOrName } from "../shared/model-param-b.js"; @@ -123,7 +123,7 @@ function isBrowserEnabled(cfg: OpenClawConfig): boolean { } return passesManifestOwnerBasePolicy({ plugin: { id: "browser" }, - normalizedConfig: normalizePluginsConfigWithResolver( + normalizedConfig: normalizePluginsConfigWithResolverCore( cfg.plugins, (pluginId) => normalizeOptionalLowercaseString(pluginId) ?? "", ), diff --git a/src/security/audit-hooks-routing.test.ts b/src/security/audit-hooks-routing.test.ts index 0a05af9dcd8e..bafb1d44276a 100644 --- a/src/security/audit-hooks-routing.test.ts +++ b/src/security/audit-hooks-routing.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import type { OpenClawConfig } from "../config/config.js"; import { collectHooksHardeningFindings } from "./audit-extra.sync.js"; -import { runSecurityAudit } from "./audit.js"; +import { runSecurityAuditCore } from "./audit.js"; function hasFinding( findings: ReturnType, @@ -274,7 +274,7 @@ describe("security audit hooks ingress findings", () => { }); it("flags hooks token reuse of SecretRef-backed gateway password auth in full audit", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] }, secrets: { @@ -304,7 +304,7 @@ describe("security audit hooks ingress findings", () => { }); it("keeps persisted SecretRef reuse findings when audit password override differs", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] }, secrets: { @@ -340,7 +340,7 @@ describe("security audit hooks ingress findings", () => { }); it("flags hooks token reuse of SecretRef-backed trusted-proxy password fallback", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] }, secrets: { @@ -371,7 +371,7 @@ describe("security audit hooks ingress findings", () => { }); it("does not resolve gateway auth SecretRefs when hooks are disabled", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] }, secrets: { @@ -399,7 +399,7 @@ describe("security audit hooks ingress findings", () => { }); it("skips unavailable gateway auth SecretRefs when auditing hooks token reuse", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] }, secrets: { @@ -427,7 +427,7 @@ describe("security audit hooks ingress findings", () => { }); it("does not execute gateway auth SecretRefs during hooks token reuse audit", async () => { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { list: [{ id: "main", default: true }] }, secrets: { diff --git a/src/security/audit-plugin-readonly-scope.test.ts b/src/security/audit-plugin-readonly-scope.test.ts index 070544472d9e..7d526360c7b2 100644 --- a/src/security/audit-plugin-readonly-scope.test.ts +++ b/src/security/audit-plugin-readonly-scope.test.ts @@ -30,12 +30,12 @@ vi.mock("../plugins/runtime/metadata-registry-loader.js", () => ({ loadPluginMetadataRegistrySnapshotMock(...args), })); -const { runSecurityAudit } = await import("./audit.js"); +const { runSecurityAuditCore } = await import("./audit.js"); function createAuditOptions(params: { sourceConfig: OpenClawConfig; - plugins: Parameters[0]["plugins"]; -}): Parameters[0] { + plugins: Parameters[0]["plugins"]; +}): Parameters[0] { return { config: params.sourceConfig, sourceConfig: params.sourceConfig, @@ -97,7 +97,7 @@ describe("security audit read-only plugin scope", () => { }); resolveConfiguredChannelPluginIdsMock.mockReturnValue(["external-channel-plugin"]); - await runSecurityAudit( + await runSecurityAuditCore( createAuditOptions({ sourceConfig, plugins: [], @@ -145,7 +145,7 @@ describe("security audit read-only plugin scope", () => { }); resolveConfiguredChannelPluginIdsMock.mockReturnValue(["external-channel-plugin"]); - await runSecurityAudit( + await runSecurityAuditCore( createAuditOptions({ sourceConfig, plugins: [{ id: "external-channel-plugin" }] as never, @@ -169,7 +169,7 @@ describe("security audit read-only plugin scope", () => { }, }; - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ ...createAuditOptions({ sourceConfig, plugins: [], @@ -191,7 +191,7 @@ describe("security audit read-only plugin scope", () => { }, }; - await runSecurityAudit({ + await runSecurityAuditCore({ config: sourceConfig, sourceConfig, env: {}, diff --git a/src/security/audit-probe-failure.test.ts b/src/security/audit-probe-failure.test.ts index 825fd2222536..1f87aa9711d5 100644 --- a/src/security/audit-probe-failure.test.ts +++ b/src/security/audit-probe-failure.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import { withEnvAsync } from "../test-utils/env.js"; import { collectDeepProbeFindings } from "./audit-deep-probe-findings.js"; -import { runSecurityAudit } from "./audit.js"; +import { runSecurityAuditCore } from "./audit.js"; function requireProbeFailure(findings: ReturnType) { const finding = findings.find((entry) => entry.checkId === "gateway.probe_failed"); @@ -20,7 +20,7 @@ describe("security audit deep probe failure", () => { const url = `wss://${user}:${password}@gateway.example.test/socket?client_secret=${querySecret}`; const report = await withEnvAsync({ OPENCLAW_GATEWAY_URL: undefined }, async () => - runSecurityAudit({ + runSecurityAuditCore({ config: { gateway: { mode: "remote", remote: { url } } }, sourceConfig: { gateway: { mode: "remote", remote: { url } } }, env: {}, diff --git a/src/security/audit-rosterless.test.ts b/src/security/audit-rosterless.test.ts index 0d5543dce7cf..7bf8a1c8117a 100644 --- a/src/security/audit-rosterless.test.ts +++ b/src/security/audit-rosterless.test.ts @@ -5,7 +5,7 @@ import { useAutoCleanupTempDirTracker } from "../../test/helpers/temp-dir.js"; vi.unmock("../agents/agent-scope-config.js"); -const { runSecurityAudit } = await import("./audit.js"); +const { runSecurityAuditCore } = await import("./audit.js"); describe("security audit rosterless configs", () => { const tempDirs = useAutoCleanupTempDirTracker(afterEach); @@ -23,7 +23,7 @@ describe("security audit rosterless configs", () => { const { stateDir, workspaceDir } = makeAuditPaths("rosterless"); await expect( - runSecurityAudit({ + runSecurityAuditCore({ config: {}, stateDir, configPath: path.join(stateDir, "openclaw.json"), @@ -48,7 +48,7 @@ describe("security audit rosterless configs", () => { includeChannelSecurity: false, }; - const authoredEmpty = await runSecurityAudit({ + const authoredEmpty = await runSecurityAuditCore({ ...baseOptions, sourceConfig: { agents: { entries: {} } } as never, }); @@ -59,7 +59,7 @@ describe("security audit rosterless configs", () => { }), ); - const absent = await runSecurityAudit({ ...baseOptions, sourceConfig: {} }); + const absent = await runSecurityAuditCore({ ...baseOptions, sourceConfig: {} }); expect(absent.findings).not.toContainEqual( expect.objectContaining({ checkId: "config.agent_roster.invalid_default_count" }), ); @@ -86,7 +86,7 @@ describe("security audit rosterless configs", () => { async ({ entries, expectedCount }) => { const { stateDir, workspaceDir } = makeAuditPaths("malformed-roster"); - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config: { agents: { entries } } as never, stateDir, configPath: path.join(stateDir, "openclaw.json"), diff --git a/src/security/audit.runtime.ts b/src/security/audit.runtime.ts index 899c1599e768..798a91ef6462 100644 --- a/src/security/audit.runtime.ts +++ b/src/security/audit.runtime.ts @@ -1,7 +1,7 @@ // Runtime boundary for invoking the security audit implementation. -import { runSecurityAudit as runSecurityAuditImpl } from "./audit.js"; +import { runSecurityAuditCore as runSecurityAuditImpl } from "./audit.js"; -type RunSecurityAudit = typeof import("./audit.js").runSecurityAudit; +type RunSecurityAudit = typeof import("./audit.js").runSecurityAuditCore; /** Runtime facade for the full security audit entrypoint. */ export function runSecurityAudit( diff --git a/src/security/audit.test-support.ts b/src/security/audit.test-support.ts index 51e4e52abc83..962ed087d013 100644 --- a/src/security/audit.test-support.ts +++ b/src/security/audit.test-support.ts @@ -1,14 +1,14 @@ import type { OpenClawConfig } from "../config/config.js"; -import { runSecurityAudit } from "./audit.js"; +import { runSecurityAuditCore } from "./audit.js"; import type { SecurityAuditFinding } from "./audit.types.js"; -type AuditOverrides = Omit[0], "config">; +type AuditOverrides = Omit[0], "config">; export async function collectSecurityAuditFindings( config: OpenClawConfig, overrides: AuditOverrides = {}, ): Promise { - const report = await runSecurityAudit({ + const report = await runSecurityAuditCore({ config, sourceConfig: config, includeFilesystem: false, diff --git a/src/security/audit.ts b/src/security/audit.ts index c5058c6f2f07..24f5235f0463 100644 --- a/src/security/audit.ts +++ b/src/security/audit.ts @@ -1336,7 +1336,9 @@ async function createAuditExecutionContext( }; } -export async function runSecurityAudit(opts: SecurityAuditOptions): Promise { +export async function runSecurityAuditCore( + opts: SecurityAuditOptions, +): Promise { const findings: SecurityAuditFinding[] = []; const context = await createAuditExecutionContext(opts); const { cfg, env, platform, stateDir, configPath } = context; diff --git a/src/sessions/session-key-case-preservation.test.ts b/src/sessions/session-key-case-preservation.test.ts index 60ebf7e33dc9..25e3da82602c 100644 --- a/src/sessions/session-key-case-preservation.test.ts +++ b/src/sessions/session-key-case-preservation.test.ts @@ -1,6 +1,6 @@ // Session key case tests cover preserving meaningful case in session keys. import { describe, expect, it } from "vitest"; -import { resolveSessionStoreEntry } from "../config/sessions/store-entry.js"; +import { resolveSessionStoreEntryCore } from "../config/sessions/store-entry.js"; import type { SessionEntry } from "../config/sessions/types.js"; import { buildAgentPeerSessionKey } from "../routing/session-key.js"; import { @@ -258,7 +258,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code [ROOM_MIXED_KEY]: entry("room:!MixedRoomAbCdEf:example.org", 100), [ROOM_LOWER_KEY]: entry("room:!mixedroomabcdef:example.org", 999), // distinct + fresher }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_KEY }); expect(r.normalizedKey).toBe(ROOM_MIXED_KEY); expect(r.legacyKeys).not.toContain(ROOM_LOWER_KEY); expect(r.legacyKeys).toEqual([]); @@ -275,7 +275,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code [structuralAliasKey]: freshStructuralAlias, }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_KEY }); expect(r.legacyKeys).toContain(structuralAliasKey); expect(r.existing).toBe(freshStructuralAlias); @@ -287,7 +287,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code const store: Record = { [ROOM_LOWER_KEY]: entry("room:!mixedroomabcdef:example.org", 999), // distinct room, its own id }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_KEY }); expect(r.legacyKeys).not.toContain(ROOM_LOWER_KEY); expect(r.existing).toBeUndefined(); }); @@ -297,7 +297,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code const store: Record = { [ROOM_LOWER_KEY]: entry("room:!MixedRoomAbCdEf:example.org", 50), }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_KEY }); expect(r.normalizedKey).toBe(ROOM_MIXED_KEY); expect(r.legacyKeys).toContain(ROOM_LOWER_KEY); }); @@ -306,7 +306,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code const store: Record = { [ROOM_LOWER_KEY]: { updatedAt: 50 } as unknown as SessionEntry, // no deliveryContext }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_KEY }); expect(r.legacyKeys).not.toContain(ROOM_LOWER_KEY); expect(r.existing).toBeUndefined(); }); @@ -316,7 +316,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code [ROOM_LOWER_KEY]: entry("room:!MixedRoomAbCdEf:example.org", 50), }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_LOWER_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_LOWER_KEY }); expect(r.legacyKeys).toEqual([]); expect(r.existing).toBeUndefined(); @@ -328,7 +328,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code const store: Record = { [ROOM_LOWER_KEY]: entry("room:!MixedRoomAbCdEf:example.org", 50), }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_KEY }); expect(r.legacyKeys).toContain(ROOM_LOWER_KEY); expect(deliveryContextFromSession(r.existing)?.to).toBe("room:!MixedRoomAbCdEf:example.org"); }); @@ -348,7 +348,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code }, }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_KEY }); expect(r.legacyKeys).toContain(ROOM_LOWER_KEY); expect(r.existing).toBe(store[ROOM_LOWER_KEY]); @@ -367,7 +367,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code }, }; - const r = resolveSessionStoreEntry({ store, sessionKey: mixedAliasKey }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: mixedAliasKey }); expect(r.legacyKeys).toContain(lowerAliasKey); expect(r.existing).toBe(store[lowerAliasKey]); @@ -388,7 +388,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code }, }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_THREAD_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_THREAD_KEY }); expect(r.legacyKeys).not.toContain(ROOM_LOWER_THREAD_KEY); expect(r.existing).toBeUndefined(); @@ -409,7 +409,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code }, }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_THREAD_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_THREAD_KEY }); expect(r.legacyKeys).toContain(ROOM_LOWER_THREAD_KEY); expect(r.existing).toBe(store[ROOM_LOWER_THREAD_KEY]); @@ -430,7 +430,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code }, }; - const r = resolveSessionStoreEntry({ store, sessionKey: ROOM_MIXED_THREAD_KEY }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: ROOM_MIXED_THREAD_KEY }); expect(r.legacyKeys).toContain(ROOM_LOWER_ROOM_PRESERVED_THREAD_KEY); expect(r.existing).toBe(store[ROOM_LOWER_ROOM_PRESERVED_THREAD_KEY]); @@ -445,7 +445,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code [lowerKey]: signalEntry, }; - const r = resolveSessionStoreEntry({ store, sessionKey: mixedKey }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: mixedKey }); expect(r.legacyKeys).toContain(lowerKey); expect(r.existing).toBe(signalEntry); @@ -468,7 +468,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code [lowerKey]: freshLegacy, }; - const r = resolveSessionStoreEntry({ store, sessionKey: mixedKey }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: mixedKey }); expect(r.legacyKeys).toContain(lowerKey); expect(r.existing).toBe(freshLegacy); @@ -490,7 +490,7 @@ describe("resolveSessionStoreEntry — case-distinct Matrix session safety (code [legacyAliasKey]: freshAlias, }; - const r = resolveSessionStoreEntry({ store, sessionKey: legacyAliasKey }); + const r = resolveSessionStoreEntryCore({ store, sessionKey: legacyAliasKey }); expect(r.legacyKeys).toContain(legacyAliasKey); expect(r.existing).toBe(freshAlias); diff --git a/src/skills/loading/workspace-skill-loader.test.ts b/src/skills/loading/workspace-skill-loader.test.ts index 0e9003a1d8e2..87646b1b7554 100644 --- a/src/skills/loading/workspace-skill-loader.test.ts +++ b/src/skills/loading/workspace-skill-loader.test.ts @@ -28,7 +28,7 @@ vi.mock("../../plugins/manifest-registry.js", async () => { const fsLocal = await import("node:fs"); const pathLocal = await import("node:path"); return { - loadPluginManifestRegistry: (params: { workspaceDir?: string }) => { + loadPluginManifestRegistryCore: (params: { workspaceDir?: string }) => { const extensionsRoot = pathLocal.join(params.workspaceDir ?? "", ".openclaw", "extensions"); const plugins = []; for (const id of ["open-prose", "browser"]) { diff --git a/src/skills/workshop/history-scan.ts b/src/skills/workshop/history-scan.ts index 700bcb91ae60..27570c203377 100644 --- a/src/skills/workshop/history-scan.ts +++ b/src/skills/workshop/history-scan.ts @@ -3,7 +3,7 @@ import { resolveAgentConfig, resolveAgentDir } from "../../agents/agent-scope.js import { resolveModelAsync } from "../../agents/embedded-agent-runner/model.js"; import { isEmbeddedAgentRunActive } from "../../agents/embedded-agent-runner/runs.js"; import { resolveDefaultModelForAgent } from "../../agents/model-selection-config.js"; -import { resolveHeartbeatPrompt } from "../../auto-reply/heartbeat.js"; +import { resolveHeartbeatPromptCore } from "../../auto-reply/heartbeat.js"; import { resolveSessionStorePathCore } from "../../config/sessions/paths.js"; import { toErrorObject } from "../../infra/errors.js"; import { @@ -234,7 +234,7 @@ async function runSkillHistoryScanCore( Math.max(1, maxTranscriptChars - HISTORY_SCAN_SESSION_OVERHEAD_CHARS), ); // The configured prompt is only an extra legacy match; the stable marker is authoritative. - const heartbeatPrompt = resolveHeartbeatPrompt( + const heartbeatPrompt = resolveHeartbeatPromptCore( resolveAgentConfig(params.config, params.agentId)?.heartbeat?.prompt ?? params.config.agents?.defaults?.heartbeat?.prompt, ); diff --git a/src/system-agent/setup-inference-core.ts b/src/system-agent/setup-inference-core.ts index 370d73480a6f..79e8b22c850a 100644 --- a/src/system-agent/setup-inference-core.ts +++ b/src/system-agent/setup-inference-core.ts @@ -17,7 +17,7 @@ import { resolveManifestProviderAuthChoice, resolveManifestProviderAuthChoices, } from "../plugins/provider-auth-choices.js"; -import { resolvePluginProviders } from "../plugins/providers.runtime.js"; +import { resolvePluginProvidersCore } from "../plugins/providers.runtime.js"; import type { SetupRecommendedInstall } from "../plugins/recommended-tool-installs.js"; import type { ProviderAuthResult } from "../plugins/types.js"; import type { RuntimeEnv } from "../runtime.js"; @@ -249,7 +249,7 @@ export type ActivateSetupInferenceDeps = { transformConfigWithPendingPluginInstalls?: typeof import("../plugins/install-record-commit.js").transformConfigWithPendingPluginInstalls; refreshPluginRegistryAfterConfigMutation?: typeof import("../plugins/registry-refresh.js").refreshPluginRegistryAfterConfigMutation; ensurePluginRegistryLoaded?: typeof import("../plugins/runtime/runtime-registry-loader.js").ensurePluginRegistryLoaded; - resolvePluginProviders?: typeof resolvePluginProviders; + resolvePluginProviders?: typeof resolvePluginProvidersCore; resolveManifestProviderAuthChoice?: typeof resolveManifestProviderAuthChoice; enablePluginInConfig?: typeof enablePluginInConfig; updateAuthProfileStoreWithLock?: typeof updateAuthProfileStoreWithLock; @@ -281,7 +281,7 @@ export type DetectSetupInferenceDeps = { detectInferenceBackends?: typeof detectInferenceBackends; probeLocalCommand?: typeof probeLocalCommand; resolveManifestProviderAuthChoices?: typeof resolveManifestProviderAuthChoices; - resolvePluginProviders?: typeof resolvePluginProviders; + resolvePluginProviders?: typeof resolvePluginProvidersCore; enablePluginInConfig?: typeof enablePluginInConfig; }; diff --git a/src/system-agent/setup-inference-detect.ts b/src/system-agent/setup-inference-detect.ts index 65a21cbeccc5..6e48c4c177ac 100644 --- a/src/system-agent/setup-inference-detect.ts +++ b/src/system-agent/setup-inference-detect.ts @@ -10,7 +10,7 @@ import { type ProviderAuthChoiceMetadata, resolveManifestProviderAuthChoices, } from "../plugins/provider-auth-choices.js"; -import { resolvePluginProviders } from "../plugins/providers.runtime.js"; +import { resolvePluginProvidersCore } from "../plugins/providers.runtime.js"; import { listRecommendedToolInstalls } from "../plugins/recommended-tool-installs.js"; import { probeLocalCommand } from "./probes.js"; import { @@ -191,7 +191,7 @@ export async function detectSetupInference( discoveryConfig = enabled.config; enabledChoices.push(choice); } - const providers = (deps.resolvePluginProviders ?? resolvePluginProviders)({ + const providers = (deps.resolvePluginProviders ?? resolvePluginProvidersCore)({ config: discoveryConfig, workspaceDir: workspace, mode: "setup", diff --git a/src/system-agent/setup-inference-plan.ts b/src/system-agent/setup-inference-plan.ts index add39aa6883f..9c5c38877222 100644 --- a/src/system-agent/setup-inference-plan.ts +++ b/src/system-agent/setup-inference-plan.ts @@ -19,7 +19,7 @@ import { runProviderPluginAuthMethodUnpersisted, } from "../plugins/provider-auth-choice.js"; import { resolveManifestProviderAuthChoice } from "../plugins/provider-auth-choices.js"; -import { resolvePluginProviders } from "../plugins/providers.runtime.js"; +import { resolvePluginProvidersCore } from "../plugins/providers.runtime.js"; import type { ProviderAuthResult } from "../plugins/types.js"; import type { RuntimeEnv } from "../runtime.js"; import type { WizardPrompter } from "../wizard/prompts.js"; @@ -107,7 +107,7 @@ export async function buildTestPlan(params: { error: `${choice.choiceLabel} is disabled (${sourceEnableResult.reason ?? "blocked"}).`, }; } - const providers = (params.deps.resolvePluginProviders ?? resolvePluginProviders)({ + const providers = (params.deps.resolvePluginProviders ?? resolvePluginProvidersCore)({ config: enableResult.config, workspaceDir: params.pluginWorkspaceDir, mode: "setup", @@ -416,7 +416,7 @@ export async function buildTestPlan(params: { error: `${choice.choiceLabel} is disabled (${sourceEnableResult.reason ?? "blocked"}).`, }; } - const providers = (params.deps.resolvePluginProviders ?? resolvePluginProviders)({ + const providers = (params.deps.resolvePluginProviders ?? resolvePluginProvidersCore)({ config: enableResult.config, workspaceDir: params.pluginWorkspaceDir, mode: "setup", diff --git a/src/wizard/setup.model-auth.test.ts b/src/wizard/setup.model-auth.test.ts index e32ea0dbf824..dc65761ca508 100644 --- a/src/wizard/setup.model-auth.test.ts +++ b/src/wizard/setup.model-auth.test.ts @@ -8,7 +8,7 @@ import { runSetupModelAuthStep } from "./setup.model-auth.js"; type ResolveManifestProviderAuthChoice = typeof import("../plugins/provider-auth-choices.js").resolveManifestProviderAuthChoice; type ResolvePluginSetupProvider = - typeof import("../plugins/setup-registry.js").resolvePluginSetupProvider; + typeof import("../plugins/setup-registry.js").resolvePluginSetupProviderCore; const applyAuthChoice = vi.hoisted(() => vi.fn()); const warnIfModelConfigLooksOff = vi.hoisted(() => vi.fn()); @@ -27,7 +27,7 @@ const resolveManifestProviderAuthChoice = vi.hoisted(() => choiceLabel: "Anthropic CLI", })), ); -const resolvePluginSetupProvider = vi.hoisted(() => +const resolvePluginSetupProviderCore = vi.hoisted(() => vi.fn(() => undefined), ); @@ -61,7 +61,7 @@ vi.mock("../plugins/provider-auth-choices.js", () => ({ })); vi.mock("../plugins/setup-registry.js", () => ({ - resolvePluginSetupProvider, + resolvePluginSetupProviderCore, })); function createPrompter(): WizardPrompter { diff --git a/src/wizard/setup.model-auth.ts b/src/wizard/setup.model-auth.ts index 04dfa23ed711..0cad6297044d 100644 --- a/src/wizard/setup.model-auth.ts +++ b/src/wizard/setup.model-auth.ts @@ -49,9 +49,11 @@ async function resolveAuthChoiceModelSelectionPolicy(params: { env: params.env, }); - const [{ resolveManifestProviderAuthChoice }, { resolvePluginSetupProvider }] = await Promise.all( - [import("../plugins/provider-auth-choices.js"), import("../plugins/setup-registry.js")], - ); + const [{ resolveManifestProviderAuthChoice }, { resolvePluginSetupProviderCore }] = + await Promise.all([ + import("../plugins/provider-auth-choices.js"), + import("../plugins/setup-registry.js"), + ]); const manifestChoice = resolveManifestProviderAuthChoice(params.authChoice, { config: params.config, workspaceDir: params.workspaceDir, @@ -59,7 +61,7 @@ async function resolveAuthChoiceModelSelectionPolicy(params: { includeUntrustedWorkspacePlugins: false, }); if (manifestChoice) { - const setupProvider = resolvePluginSetupProvider({ + const setupProvider = resolvePluginSetupProviderCore({ provider: manifestChoice.providerId, config: params.config, workspaceDir: params.workspaceDir, diff --git a/src/wizard/setup.plugin-config.test.ts b/src/wizard/setup.plugin-config.test.ts index 5bce252f3a1c..df8493027823 100644 --- a/src/wizard/setup.plugin-config.test.ts +++ b/src/wizard/setup.plugin-config.test.ts @@ -9,19 +9,19 @@ import { setupPluginConfig, } from "./setup.plugin-config.js"; -const loadPluginManifestRegistry = vi.fn(); +const loadPluginManifestRegistryCore = vi.fn(); vi.mock("../plugins/manifest-registry.js", () => ({ - loadPluginManifestRegistry, + loadPluginManifestRegistryCore, })); vi.mock("../plugins/plugin-registry.js", () => ({ - loadPluginManifestRegistryForPluginRegistry: loadPluginManifestRegistry, + loadPluginManifestRegistryForPluginRegistry: loadPluginManifestRegistryCore, })); vi.mock("../plugins/plugin-metadata-snapshot.js", () => ({ loadPluginMetadataSnapshot: () => { - const registry = loadPluginManifestRegistry(); + const registry = loadPluginManifestRegistryCore(); return { plugins: registry.plugins, manifestRegistry: registry, @@ -240,7 +240,7 @@ describe("discoverUnconfiguredPlugins", () => { describe("setupPluginConfig", () => { it("allows skipping plugin setup from the multiselect prompt", async () => { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { ...makeManifestPlugin("device-pairing", { @@ -297,7 +297,7 @@ describe("setupPluginConfig", () => { }); it("writes dotted uiHint values into nested plugin config", async () => { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { ...makeManifestPlugin( @@ -359,7 +359,7 @@ describe("setupPluginConfig", () => { it("rejects prototype-polluting dotted uiHint paths without mutating config", async () => { const pollutionProbe = "openclawPluginPollutionProbe"; - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ { ...makeManifestPlugin("unsafe-plugin", { @@ -395,7 +395,7 @@ describe("setupPluginConfig", () => { }); it("coerces only JSON-compatible numeric inputs", async () => { - loadPluginManifestRegistry.mockReturnValue({ + loadPluginManifestRegistryCore.mockReturnValue({ plugins: [ makeManifestPlugin( "numeric-plugin", diff --git a/src/wizard/setup.test.ts b/src/wizard/setup.test.ts index b17760a634c4..5eeac8ac9128 100644 --- a/src/wizard/setup.test.ts +++ b/src/wizard/setup.test.ts @@ -371,7 +371,7 @@ vi.mock("../plugins/provider-auth-choices.js", () => ({ })); vi.mock("../plugins/setup-registry.js", () => ({ - resolvePluginSetupProvider, + resolvePluginSetupProviderCore: resolvePluginSetupProvider, })); vi.mock("../plugins/provider-auth-choice.runtime.js", () => ({ diff --git a/test/scripts/check-session-accessor-boundary.test.ts b/test/scripts/check-session-accessor-boundary.test.ts index 696b8c5c2728..c27e229c511c 100644 --- a/test/scripts/check-session-accessor-boundary.test.ts +++ b/test/scripts/check-session-accessor-boundary.test.ts @@ -358,6 +358,7 @@ describe("session accessor boundary guard", () => { sessions["loadSessionStore"](storePath); readSessionStoreReadOnly(storePath); resolveSessionStoreEntry({ store, sessionKey }); + resolveSessionStoreEntryCore({ store, sessionKey }); `), ).toEqual([ { line: 2, reason: 'calls legacy session store access "loadSessionStore"' }, @@ -365,6 +366,7 @@ describe("session accessor boundary guard", () => { { line: 4, reason: 'references legacy session store access "loadSessionStore"' }, { line: 5, reason: 'calls legacy session store access "readSessionStoreReadOnly"' }, { line: 6, reason: 'calls legacy session store access "resolveSessionStoreEntry"' }, + { line: 7, reason: 'calls legacy session store access "resolveSessionStoreEntryCore"' }, ]); });