From 723dd4af07e62001374230db27029220327c404a Mon Sep 17 00:00:00 2001 From: Gustavo Madeira Santana Date: Sun, 15 Mar 2026 22:29:41 +0000 Subject: [PATCH] Extension host: split activation policy compat layout --- src/commands/doctor-memory-search.test.ts | 2 +- src/commands/doctor-memory-search.ts | 2 +- .../{ => activation}/loader-bootstrap.test.ts | 2 +- .../{ => activation}/loader-bootstrap.ts | 18 +- .../{ => activation}/loader-cache.test.ts | 2 +- .../{ => activation}/loader-cache.ts | 10 +- .../{ => activation}/loader-execution.test.ts | 0 .../{ => activation}/loader-execution.ts | 20 +-- .../{ => activation}/loader-finalize.test.ts | 4 +- .../{ => activation}/loader-finalize.ts | 8 +- .../{ => activation}/loader-flow.test.ts | 8 +- .../{ => activation}/loader-flow.ts | 14 +- .../loader-host-state.test.ts | 0 .../{ => activation}/loader-host-state.ts | 0 .../{ => activation}/loader-import.test.ts | 0 .../{ => activation}/loader-import.ts | 4 +- .../loader-module-loader.test.ts | 0 .../{ => activation}/loader-module-loader.ts | 4 +- .../{ => activation}/loader-orchestrator.ts | 15 +- .../{ => activation}/loader-pipeline.test.ts | 0 .../{ => activation}/loader-pipeline.ts | 8 +- .../{ => activation}/loader-preflight.test.ts | 0 .../{ => activation}/loader-preflight.ts | 8 +- .../{ => activation}/loader-records.test.ts | 8 +- .../{ => activation}/loader-records.ts | 12 +- .../{ => activation}/loader-register.test.ts | 4 +- .../{ => activation}/loader-register.ts | 8 +- .../{ => activation}/loader-run.test.ts | 2 +- .../{ => activation}/loader-run.ts | 6 +- .../loader-runtime-proxy.test.ts | 0 .../{ => activation}/loader-runtime-proxy.ts | 2 +- .../{ => activation}/loader-runtime.test.ts | 2 +- .../{ => activation}/loader-runtime.ts | 8 +- .../{ => activation}/loader-session.test.ts | 6 +- .../{ => activation}/loader-session.ts | 12 +- .../{ => activation}/loader-state.test.ts | 4 +- .../{ => activation}/loader-state.ts | 2 +- .../{ => compat}/hook-compat.test.ts | 0 .../{ => compat}/hook-compat.ts | 6 +- .../{ => compat}/loader-compat.ts | 2 +- .../{ => compat}/plugin-api.test.ts | 2 +- src/extension-host/{ => compat}/plugin-api.ts | 8 +- .../plugin-registry-compat.test.ts | 4 +- .../{ => compat}/plugin-registry-compat.ts | 12 +- .../plugin-registry-registrations.test.ts | 2 +- .../plugin-registry-registrations.ts | 30 ++-- .../{ => compat}/plugin-registry.test.ts | 4 +- .../{ => compat}/plugin-registry.ts | 12 +- src/extension-host/context-engine-runtime.ts | 2 +- src/extension-host/cutover-inventory.md | 162 +++++++++--------- .../embedding-manager-runtime.ts | 2 +- .../embedding-runtime-registry.test.ts | 6 +- .../embedding-runtime-registry.ts | 8 +- src/extension-host/media-runtime-auto.ts | 2 +- .../embedding-runtime-policy.test.ts | 0 .../{ => policy}/embedding-runtime-policy.ts | 6 +- .../loader-activation-policy.test.ts | 8 +- .../{ => policy}/loader-activation-policy.ts | 14 +- .../loader-discovery-policy.test.ts | 0 .../{ => policy}/loader-discovery-policy.ts | 2 +- .../loader-finalization-policy.test.ts | 2 +- .../loader-finalization-policy.ts | 4 +- .../{ => policy}/loader-policy.test.ts | 2 +- .../{ => policy}/loader-policy.ts | 16 +- .../{ => policy}/loader-provenance.test.ts | 0 .../{ => policy}/loader-provenance.ts | 4 +- .../{ => policy}/media-runtime-policy.test.ts | 0 .../{ => policy}/media-runtime-policy.ts | 2 +- .../runtime-backend-arbitration.test.ts | 0 .../runtime-backend-arbitration.ts | 0 .../runtime-backend-policy.test.ts | 0 .../{ => policy}/runtime-backend-policy.ts | 0 .../{ => policy}/slot-arbitration.test.ts | 2 +- .../{ => policy}/slot-arbitration.ts | 6 +- .../{ => policy}/tts-runtime-policy.test.ts | 0 .../{ => policy}/tts-runtime-policy.ts | 2 +- .../runtime-backend-catalog.test.ts | 2 +- src/extension-host/runtime-backend-catalog.ts | 2 +- src/extension-host/tts-runtime-setup.ts | 4 +- src/extension-host/tts-status.ts | 2 +- src/plugins/slots.ts | 2 +- 81 files changed, 278 insertions(+), 273 deletions(-) rename src/extension-host/{ => activation}/loader-bootstrap.test.ts (97%) rename src/extension-host/{ => activation}/loader-bootstrap.ts (85%) rename src/extension-host/{ => activation}/loader-cache.test.ts (97%) rename src/extension-host/{ => activation}/loader-cache.ts (86%) rename src/extension-host/{ => activation}/loader-execution.test.ts (100%) rename src/extension-host/{ => activation}/loader-execution.ts (84%) rename src/extension-host/{ => activation}/loader-finalize.test.ts (95%) rename src/extension-host/{ => activation}/loader-finalize.ts (79%) rename src/extension-host/{ => activation}/loader-flow.test.ts (95%) rename src/extension-host/{ => activation}/loader-flow.ts (93%) rename src/extension-host/{ => activation}/loader-host-state.test.ts (100%) rename src/extension-host/{ => activation}/loader-host-state.ts (100%) rename src/extension-host/{ => activation}/loader-import.test.ts (100%) rename src/extension-host/{ => activation}/loader-import.ts (90%) rename src/extension-host/{ => activation}/loader-module-loader.test.ts (100%) rename src/extension-host/{ => activation}/loader-module-loader.ts (93%) rename src/extension-host/{ => activation}/loader-orchestrator.ts (77%) rename src/extension-host/{ => activation}/loader-pipeline.test.ts (100%) rename src/extension-host/{ => activation}/loader-pipeline.ts (87%) rename src/extension-host/{ => activation}/loader-preflight.test.ts (100%) rename src/extension-host/{ => activation}/loader-preflight.ts (93%) rename src/extension-host/{ => activation}/loader-records.test.ts (93%) rename src/extension-host/{ => activation}/loader-records.ts (87%) rename src/extension-host/{ => activation}/loader-register.test.ts (96%) rename src/extension-host/{ => activation}/loader-register.ts (95%) rename src/extension-host/{ => activation}/loader-run.test.ts (95%) rename src/extension-host/{ => activation}/loader-run.ts (91%) rename src/extension-host/{ => activation}/loader-runtime-proxy.test.ts (100%) rename src/extension-host/{ => activation}/loader-runtime-proxy.ts (94%) rename src/extension-host/{ => activation}/loader-runtime.test.ts (97%) rename src/extension-host/{ => activation}/loader-runtime.ts (94%) rename src/extension-host/{ => activation}/loader-session.test.ts (94%) rename src/extension-host/{ => activation}/loader-session.ts (89%) rename src/extension-host/{ => activation}/loader-state.test.ts (96%) rename src/extension-host/{ => activation}/loader-state.ts (98%) rename src/extension-host/{ => compat}/hook-compat.test.ts (100%) rename src/extension-host/{ => compat}/hook-compat.ts (95%) rename src/extension-host/{ => compat}/loader-compat.ts (97%) rename src/extension-host/{ => compat}/plugin-api.test.ts (98%) rename src/extension-host/{ => compat}/plugin-api.ts (93%) rename src/extension-host/{ => compat}/plugin-registry-compat.test.ts (96%) rename src/extension-host/{ => compat}/plugin-registry-compat.ts (88%) rename src/extension-host/{ => compat}/plugin-registry-registrations.test.ts (98%) rename src/extension-host/{ => compat}/plugin-registry-registrations.ts (93%) rename src/extension-host/{ => compat}/plugin-registry.test.ts (96%) rename src/extension-host/{ => compat}/plugin-registry.ts (97%) rename src/extension-host/{ => policy}/embedding-runtime-policy.test.ts (100%) rename src/extension-host/{ => policy}/embedding-runtime-policy.ts (93%) rename src/extension-host/{ => policy}/loader-activation-policy.test.ts (92%) rename src/extension-host/{ => policy}/loader-activation-policy.ts (82%) rename src/extension-host/{ => policy}/loader-discovery-policy.test.ts (100%) rename src/extension-host/{ => policy}/loader-discovery-policy.ts (94%) rename src/extension-host/{ => policy}/loader-finalization-policy.test.ts (97%) rename src/extension-host/{ => policy}/loader-finalization-policy.ts (92%) rename src/extension-host/{ => policy}/loader-policy.test.ts (97%) rename src/extension-host/{ => policy}/loader-policy.ts (94%) rename src/extension-host/{ => policy}/loader-provenance.test.ts (100%) rename src/extension-host/{ => policy}/loader-provenance.ts (95%) rename src/extension-host/{ => policy}/media-runtime-policy.test.ts (100%) rename src/extension-host/{ => policy}/media-runtime-policy.ts (96%) rename src/extension-host/{ => policy}/runtime-backend-arbitration.test.ts (100%) rename src/extension-host/{ => policy}/runtime-backend-arbitration.ts (100%) rename src/extension-host/{ => policy}/runtime-backend-policy.test.ts (100%) rename src/extension-host/{ => policy}/runtime-backend-policy.ts (100%) rename src/extension-host/{ => policy}/slot-arbitration.test.ts (95%) rename src/extension-host/{ => policy}/slot-arbitration.ts (93%) rename src/extension-host/{ => policy}/tts-runtime-policy.test.ts (100%) rename src/extension-host/{ => policy}/tts-runtime-policy.ts (95%) diff --git a/src/commands/doctor-memory-search.test.ts b/src/commands/doctor-memory-search.test.ts index dac45c5229f..04567b1886e 100644 --- a/src/commands/doctor-memory-search.test.ts +++ b/src/commands/doctor-memory-search.test.ts @@ -33,7 +33,7 @@ vi.mock("../memory/backend-config.js", () => ({ resolveMemoryBackendConfig, })); -vi.mock("../extension-host/embedding-runtime-policy.js", () => ({ +vi.mock("../extension-host/policy/embedding-runtime-policy.js", () => ({ listExtensionHostEmbeddingRemoteRuntimeBackendIds, })); diff --git a/src/commands/doctor-memory-search.ts b/src/commands/doctor-memory-search.ts index c5a87b8888b..cee03232ad9 100644 --- a/src/commands/doctor-memory-search.ts +++ b/src/commands/doctor-memory-search.ts @@ -4,8 +4,8 @@ import { resolveMemorySearchConfig } from "../agents/memory-search.js"; import { resolveApiKeyForProvider } from "../agents/model-auth.js"; import { formatCliCommand } from "../cli/command-format.js"; import type { OpenClawConfig } from "../config/config.js"; -import { listExtensionHostEmbeddingRemoteRuntimeBackendIds } from "../extension-host/embedding-runtime-policy.js"; import { DEFAULT_LOCAL_EMBEDDING_MODEL } from "../extension-host/embedding-runtime.js"; +import { listExtensionHostEmbeddingRemoteRuntimeBackendIds } from "../extension-host/policy/embedding-runtime-policy.js"; import { resolveMemoryBackendConfig } from "../memory/backend-config.js"; import { hasConfiguredMemorySecretInput } from "../memory/secret-input.js"; import { note } from "../terminal/note.js"; diff --git a/src/extension-host/loader-bootstrap.test.ts b/src/extension-host/activation/loader-bootstrap.test.ts similarity index 97% rename from src/extension-host/loader-bootstrap.test.ts rename to src/extension-host/activation/loader-bootstrap.test.ts index a838b932640..57da529ce2f 100644 --- a/src/extension-host/loader-bootstrap.test.ts +++ b/src/extension-host/activation/loader-bootstrap.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { createEmptyPluginRegistry } from "../plugins/registry.js"; +import { createEmptyPluginRegistry } from "../../plugins/registry.js"; import { bootstrapExtensionHostPluginLoad } from "./loader-bootstrap.js"; describe("extension host loader bootstrap", () => { diff --git a/src/extension-host/loader-bootstrap.ts b/src/extension-host/activation/loader-bootstrap.ts similarity index 85% rename from src/extension-host/loader-bootstrap.ts rename to src/extension-host/activation/loader-bootstrap.ts index 6009e427b1b..0745230f6eb 100644 --- a/src/extension-host/loader-bootstrap.ts +++ b/src/extension-host/activation/loader-bootstrap.ts @@ -1,20 +1,20 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { NormalizedPluginsConfig } from "../plugins/config-state.js"; -import { discoverOpenClawPlugins, type PluginCandidate } from "../plugins/discovery.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { NormalizedPluginsConfig } from "../../plugins/config-state.js"; +import { discoverOpenClawPlugins, type PluginCandidate } from "../../plugins/discovery.js"; import { loadPluginManifestRegistry, type PluginManifestRecord, type PluginManifestRegistry, -} from "../plugins/manifest-registry.js"; -import type { PluginRegistry } from "../plugins/registry.js"; -import type { PluginLogger } from "../plugins/types.js"; -import { resolveExtensionHostDiscoveryPolicy } from "./loader-discovery-policy.js"; +} from "../../plugins/manifest-registry.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import type { PluginLogger } from "../../plugins/types.js"; +import { resolveExtensionHostDiscoveryPolicy } from "../policy/loader-discovery-policy.js"; import { buildExtensionHostProvenanceIndex, compareExtensionHostDuplicateCandidateOrder, pushExtensionHostDiagnostics, -} from "./loader-policy.js"; -import type { ExtensionHostProvenanceIndex } from "./loader-provenance.js"; +} from "../policy/loader-policy.js"; +import type { ExtensionHostProvenanceIndex } from "../policy/loader-provenance.js"; export function bootstrapExtensionHostPluginLoad(params: { config: OpenClawConfig; diff --git a/src/extension-host/loader-cache.test.ts b/src/extension-host/activation/loader-cache.test.ts similarity index 97% rename from src/extension-host/loader-cache.test.ts rename to src/extension-host/activation/loader-cache.test.ts index f9e103b6557..da1f8ced98d 100644 --- a/src/extension-host/loader-cache.test.ts +++ b/src/extension-host/activation/loader-cache.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import type { PluginRegistry } from "../plugins/registry.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; import { buildExtensionHostRegistryCacheKey, clearExtensionHostRegistryCache, diff --git a/src/extension-host/loader-cache.ts b/src/extension-host/activation/loader-cache.ts similarity index 86% rename from src/extension-host/loader-cache.ts rename to src/extension-host/activation/loader-cache.ts index 1649fbc8ff5..d046dd4bb1a 100644 --- a/src/extension-host/loader-cache.ts +++ b/src/extension-host/activation/loader-cache.ts @@ -1,8 +1,8 @@ -import type { PluginInstallRecord } from "../config/types.plugins.js"; -import type { NormalizedPluginsConfig } from "../plugins/config-state.js"; -import type { PluginRegistry } from "../plugins/registry.js"; -import { resolvePluginCacheInputs } from "../plugins/roots.js"; -import { resolveUserPath } from "../utils.js"; +import type { PluginInstallRecord } from "../../config/types.plugins.js"; +import type { NormalizedPluginsConfig } from "../../plugins/config-state.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import { resolvePluginCacheInputs } from "../../plugins/roots.js"; +import { resolveUserPath } from "../../utils.js"; export const MAX_EXTENSION_HOST_REGISTRY_CACHE_ENTRIES = 32; diff --git a/src/extension-host/loader-execution.test.ts b/src/extension-host/activation/loader-execution.test.ts similarity index 100% rename from src/extension-host/loader-execution.test.ts rename to src/extension-host/activation/loader-execution.test.ts diff --git a/src/extension-host/loader-execution.ts b/src/extension-host/activation/loader-execution.ts similarity index 84% rename from src/extension-host/loader-execution.ts rename to src/extension-host/activation/loader-execution.ts index ba6b6cc832b..1ec893bbae7 100644 --- a/src/extension-host/loader-execution.ts +++ b/src/extension-host/activation/loader-execution.ts @@ -1,17 +1,17 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { NormalizedPluginsConfig } from "../plugins/config-state.js"; -import { createPluginRegistry, type PluginRegistry } from "../plugins/registry.js"; -import type { CreatePluginRuntimeOptions } from "../plugins/runtime/index.js"; -import type { PluginRuntime } from "../plugins/runtime/types.js"; -import type { PluginLogger } from "../plugins/types.js"; -import { bootstrapExtensionHostPluginLoad } from "./loader-bootstrap.js"; -import { resolveExtensionHostDiscoveryPolicy } from "./loader-discovery-policy.js"; -import { createExtensionHostModuleLoader } from "./loader-module-loader.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { NormalizedPluginsConfig } from "../../plugins/config-state.js"; +import { createPluginRegistry, type PluginRegistry } from "../../plugins/registry.js"; +import type { CreatePluginRuntimeOptions } from "../../plugins/runtime/index.js"; +import type { PluginRuntime } from "../../plugins/runtime/types.js"; +import type { PluginLogger } from "../../plugins/types.js"; +import { resolveExtensionHostDiscoveryPolicy } from "../policy/loader-discovery-policy.js"; import { buildExtensionHostProvenanceIndex, compareExtensionHostDuplicateCandidateOrder, pushExtensionHostDiagnostics, -} from "./loader-policy.js"; +} from "../policy/loader-policy.js"; +import { bootstrapExtensionHostPluginLoad } from "./loader-bootstrap.js"; +import { createExtensionHostModuleLoader } from "./loader-module-loader.js"; import { createExtensionHostLazyRuntime } from "./loader-runtime-proxy.js"; import { createExtensionHostLoaderSession, diff --git a/src/extension-host/loader-finalize.test.ts b/src/extension-host/activation/loader-finalize.test.ts similarity index 95% rename from src/extension-host/loader-finalize.test.ts rename to src/extension-host/activation/loader-finalize.test.ts index 7361db68019..7fb6944992b 100644 --- a/src/extension-host/loader-finalize.test.ts +++ b/src/extension-host/activation/loader-finalize.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "vitest"; -import type { PluginRegistry } from "../plugins/registry.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import { createExtensionHostPluginRecord } from "../policy/loader-policy.js"; import { finalizeExtensionHostRegistryLoad } from "./loader-finalize.js"; -import { createExtensionHostPluginRecord } from "./loader-policy.js"; import { setExtensionHostPluginRecordLifecycleState } from "./loader-state.js"; function createRegistry(): PluginRegistry { diff --git a/src/extension-host/loader-finalize.ts b/src/extension-host/activation/loader-finalize.ts similarity index 79% rename from src/extension-host/loader-finalize.ts rename to src/extension-host/activation/loader-finalize.ts index a5c2c2ca1ce..5bc92a922db 100644 --- a/src/extension-host/loader-finalize.ts +++ b/src/extension-host/activation/loader-finalize.ts @@ -1,7 +1,7 @@ -import type { PluginRegistry } from "../plugins/registry.js"; -import type { PluginLogger } from "../plugins/types.js"; -import { resolveExtensionHostFinalizationPolicy } from "./loader-finalization-policy.js"; -import type { ExtensionHostProvenanceIndex } from "./loader-policy.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import type { PluginLogger } from "../../plugins/types.js"; +import { resolveExtensionHostFinalizationPolicy } from "../policy/loader-finalization-policy.js"; +import type { ExtensionHostProvenanceIndex } from "../policy/loader-policy.js"; import { markExtensionHostRegistryPluginsReady } from "./loader-state.js"; export function finalizeExtensionHostRegistryLoad(params: { diff --git a/src/extension-host/loader-flow.test.ts b/src/extension-host/activation/loader-flow.test.ts similarity index 95% rename from src/extension-host/loader-flow.test.ts rename to src/extension-host/activation/loader-flow.test.ts index 6aff6398d03..31c513be785 100644 --- a/src/extension-host/loader-flow.test.ts +++ b/src/extension-host/activation/loader-flow.test.ts @@ -2,10 +2,10 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; -import { normalizePluginsConfig } from "../plugins/config-state.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; -import type { PluginRegistry } from "../plugins/registry.js"; +import { normalizePluginsConfig } from "../../plugins/config-state.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; import { processExtensionHostPluginCandidate } from "./loader-flow.js"; const tempDirs: string[] = []; diff --git a/src/extension-host/loader-flow.ts b/src/extension-host/activation/loader-flow.ts similarity index 93% rename from src/extension-host/loader-flow.ts rename to src/extension-host/activation/loader-flow.ts index 85bf3e410a9..134454fed88 100644 --- a/src/extension-host/loader-flow.ts +++ b/src/extension-host/activation/loader-flow.ts @@ -1,11 +1,11 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; -import type { PluginRecord, PluginRegistry } from "../plugins/registry.js"; -import type { OpenClawPluginApi, OpenClawPluginModule, PluginLogger } from "../plugins/types.js"; -import { resolveExtensionHostActivationPolicy } from "./loader-activation-policy.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; +import type { PluginRecord, PluginRegistry } from "../../plugins/registry.js"; +import type { OpenClawPluginApi, OpenClawPluginModule, PluginLogger } from "../../plugins/types.js"; +import { resolveExtensionHostActivationPolicy } from "../policy/loader-activation-policy.js"; +import { recordExtensionHostPluginError } from "../policy/loader-policy.js"; import { importExtensionHostPluginModule } from "./loader-import.js"; -import { recordExtensionHostPluginError } from "./loader-policy.js"; import { planExtensionHostLoadedPlugin, runExtensionHostPluginRegister, diff --git a/src/extension-host/loader-host-state.test.ts b/src/extension-host/activation/loader-host-state.test.ts similarity index 100% rename from src/extension-host/loader-host-state.test.ts rename to src/extension-host/activation/loader-host-state.test.ts diff --git a/src/extension-host/loader-host-state.ts b/src/extension-host/activation/loader-host-state.ts similarity index 100% rename from src/extension-host/loader-host-state.ts rename to src/extension-host/activation/loader-host-state.ts diff --git a/src/extension-host/loader-import.test.ts b/src/extension-host/activation/loader-import.test.ts similarity index 100% rename from src/extension-host/loader-import.test.ts rename to src/extension-host/activation/loader-import.test.ts diff --git a/src/extension-host/loader-import.ts b/src/extension-host/activation/loader-import.ts similarity index 90% rename from src/extension-host/loader-import.ts rename to src/extension-host/activation/loader-import.ts index b4e6c44ef3a..629f8387f24 100644 --- a/src/extension-host/loader-import.ts +++ b/src/extension-host/activation/loader-import.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; -import { openBoundaryFileSync } from "../infra/boundary-file-read.js"; -import type { PluginRecord } from "../plugins/registry.js"; +import { openBoundaryFileSync } from "../../infra/boundary-file-read.js"; +import type { PluginRecord } from "../../plugins/registry.js"; export function importExtensionHostPluginModule(params: { rootDir: string; diff --git a/src/extension-host/loader-module-loader.test.ts b/src/extension-host/activation/loader-module-loader.test.ts similarity index 100% rename from src/extension-host/loader-module-loader.test.ts rename to src/extension-host/activation/loader-module-loader.test.ts diff --git a/src/extension-host/loader-module-loader.ts b/src/extension-host/activation/loader-module-loader.ts similarity index 93% rename from src/extension-host/loader-module-loader.ts rename to src/extension-host/activation/loader-module-loader.ts index 1df3523fcc0..9aa834a1378 100644 --- a/src/extension-host/loader-module-loader.ts +++ b/src/extension-host/activation/loader-module-loader.ts @@ -1,6 +1,6 @@ import { createJiti } from "jiti"; -import type { OpenClawPluginModule } from "../plugins/types.js"; -import { resolvePluginSdkAlias, resolvePluginSdkScopedAliasMap } from "./loader-compat.js"; +import type { OpenClawPluginModule } from "../../plugins/types.js"; +import { resolvePluginSdkAlias, resolvePluginSdkScopedAliasMap } from "../compat/loader-compat.js"; type JitiLoaderFactory = typeof createJiti; type JitiLoader = ReturnType; diff --git a/src/extension-host/loader-orchestrator.ts b/src/extension-host/activation/loader-orchestrator.ts similarity index 77% rename from src/extension-host/loader-orchestrator.ts rename to src/extension-host/activation/loader-orchestrator.ts index 0d7a820f5fc..4ebf17e85e1 100644 --- a/src/extension-host/loader-orchestrator.ts +++ b/src/extension-host/activation/loader-orchestrator.ts @@ -1,8 +1,11 @@ -import type { OpenClawConfig } from "../config/config.js"; -import { createSubsystemLogger } from "../logging/subsystem.js"; -import type { PluginRegistry } from "../plugins/registry.js"; -import { createPluginRuntime, type CreatePluginRuntimeOptions } from "../plugins/runtime/index.js"; -import type { PluginLogger } from "../plugins/types.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import { createSubsystemLogger } from "../../logging/subsystem.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import { + createPluginRuntime, + type CreatePluginRuntimeOptions, +} from "../../plugins/runtime/index.js"; +import type { PluginLogger } from "../../plugins/types.js"; import { clearExtensionHostPluginCommands } from "./command-runtime.js"; import { clearExtensionHostLoaderHostState, @@ -18,7 +21,7 @@ export type ExtensionHostPluginLoadOptions = { logger?: PluginLogger; coreGatewayHandlers?: Record< string, - import("../gateway/server-methods/types.js").GatewayRequestHandler + import("../../gateway/server-methods/types.js").GatewayRequestHandler >; runtimeOptions?: CreatePluginRuntimeOptions; cache?: boolean; diff --git a/src/extension-host/loader-pipeline.test.ts b/src/extension-host/activation/loader-pipeline.test.ts similarity index 100% rename from src/extension-host/loader-pipeline.test.ts rename to src/extension-host/activation/loader-pipeline.test.ts diff --git a/src/extension-host/loader-pipeline.ts b/src/extension-host/activation/loader-pipeline.ts similarity index 87% rename from src/extension-host/loader-pipeline.ts rename to src/extension-host/activation/loader-pipeline.ts index 602d2684912..9328ed2f8ce 100644 --- a/src/extension-host/loader-pipeline.ts +++ b/src/extension-host/activation/loader-pipeline.ts @@ -1,7 +1,7 @@ -import type { GatewayRequestHandler } from "../gateway/server-methods/types.js"; -import type { PluginRegistry } from "../plugins/registry.js"; -import type { CreatePluginRuntimeOptions } from "../plugins/runtime/index.js"; -import type { PluginRuntime } from "../plugins/runtime/types.js"; +import type { GatewayRequestHandler } from "../../gateway/server-methods/types.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import type { CreatePluginRuntimeOptions } from "../../plugins/runtime/index.js"; +import type { PluginRuntime } from "../../plugins/runtime/types.js"; import { activateExtensionHostRegistry } from "./activation.js"; import { setCachedExtensionHostRegistry } from "./loader-cache.js"; import { prepareExtensionHostLoaderExecution } from "./loader-execution.js"; diff --git a/src/extension-host/loader-preflight.test.ts b/src/extension-host/activation/loader-preflight.test.ts similarity index 100% rename from src/extension-host/loader-preflight.test.ts rename to src/extension-host/activation/loader-preflight.test.ts diff --git a/src/extension-host/loader-preflight.ts b/src/extension-host/activation/loader-preflight.ts similarity index 93% rename from src/extension-host/loader-preflight.ts rename to src/extension-host/activation/loader-preflight.ts index 3bb7049599f..6940100c571 100644 --- a/src/extension-host/loader-preflight.ts +++ b/src/extension-host/activation/loader-preflight.ts @@ -1,7 +1,7 @@ -import type { OpenClawConfig } from "../config/config.js"; -import { applyTestPluginDefaults, normalizePluginsConfig } from "../plugins/config-state.js"; -import type { PluginLogger } from "../plugins/types.js"; -import { activateExtensionHostRegistry } from "./activation.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import { applyTestPluginDefaults, normalizePluginsConfig } from "../../plugins/config-state.js"; +import type { PluginLogger } from "../../plugins/types.js"; +import { activateExtensionHostRegistry } from "../activation.js"; import { buildExtensionHostRegistryCacheKey, getCachedExtensionHostRegistry, diff --git a/src/extension-host/loader-records.test.ts b/src/extension-host/activation/loader-records.test.ts similarity index 93% rename from src/extension-host/loader-records.test.ts rename to src/extension-host/activation/loader-records.test.ts index ba0f423e241..3b2e4d8649e 100644 --- a/src/extension-host/loader-records.test.ts +++ b/src/extension-host/activation/loader-records.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; -import type { OpenClawConfig } from "../config/config.js"; -import { normalizePluginsConfig } from "../plugins/config-state.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import { normalizePluginsConfig } from "../../plugins/config-state.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; import { prepareExtensionHostPluginCandidate } from "./loader-records.js"; function createCandidate(overrides: Partial = {}): PluginCandidate { diff --git a/src/extension-host/loader-records.ts b/src/extension-host/activation/loader-records.ts similarity index 87% rename from src/extension-host/loader-records.ts rename to src/extension-host/activation/loader-records.ts index 46e7904dd4c..063a8285c3d 100644 --- a/src/extension-host/loader-records.ts +++ b/src/extension-host/activation/loader-records.ts @@ -1,12 +1,12 @@ -import type { OpenClawConfig } from "../config/config.js"; +import type { OpenClawConfig } from "../../config/config.js"; import { resolveEffectiveEnableState, type NormalizedPluginsConfig, -} from "../plugins/config-state.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; -import type { PluginRecord } from "../plugins/registry.js"; -import { createExtensionHostPluginRecord } from "./loader-policy.js"; +} from "../../plugins/config-state.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; +import type { PluginRecord } from "../../plugins/registry.js"; +import { createExtensionHostPluginRecord } from "../policy/loader-policy.js"; import { setExtensionHostPluginRecordDisabled } from "./loader-state.js"; type CandidateEntry = NormalizedPluginsConfig["entries"][string]; diff --git a/src/extension-host/loader-register.test.ts b/src/extension-host/activation/loader-register.test.ts similarity index 96% rename from src/extension-host/loader-register.test.ts rename to src/extension-host/activation/loader-register.test.ts index 7139299bc4b..a02798b2afb 100644 --- a/src/extension-host/loader-register.test.ts +++ b/src/extension-host/activation/loader-register.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import type { PluginDiagnostic } from "../plugins/types.js"; -import { createExtensionHostPluginRecord } from "./loader-policy.js"; +import type { PluginDiagnostic } from "../../plugins/types.js"; +import { createExtensionHostPluginRecord } from "../policy/loader-policy.js"; import { planExtensionHostLoadedPlugin, runExtensionHostPluginRegister, diff --git a/src/extension-host/loader-register.ts b/src/extension-host/activation/loader-register.ts similarity index 95% rename from src/extension-host/loader-register.ts rename to src/extension-host/activation/loader-register.ts index 04596f3ff0f..d08ea6129c3 100644 --- a/src/extension-host/loader-register.ts +++ b/src/extension-host/activation/loader-register.ts @@ -1,12 +1,12 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; -import type { PluginRecord } from "../plugins/registry.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; +import type { PluginRecord } from "../../plugins/registry.js"; import type { OpenClawPluginApi, OpenClawPluginDefinition, OpenClawPluginHookOptions, PluginDiagnostic, -} from "../plugins/types.js"; +} from "../../plugins/types.js"; import { applyExtensionHostDefinitionToRecord, resolveExtensionHostMemoryDecision, diff --git a/src/extension-host/loader-run.test.ts b/src/extension-host/activation/loader-run.test.ts similarity index 95% rename from src/extension-host/loader-run.test.ts rename to src/extension-host/activation/loader-run.test.ts index a2af4a87c42..656ff501584 100644 --- a/src/extension-host/loader-run.test.ts +++ b/src/extension-host/activation/loader-run.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from "vitest"; -import type { PluginRegistry } from "../plugins/registry.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; import { runExtensionHostLoaderSession } from "./loader-run.js"; vi.mock("./loader-session.js", () => ({ diff --git a/src/extension-host/loader-run.ts b/src/extension-host/activation/loader-run.ts similarity index 91% rename from src/extension-host/loader-run.ts rename to src/extension-host/activation/loader-run.ts index 4af971ad143..7ee948bf17a 100644 --- a/src/extension-host/loader-run.ts +++ b/src/extension-host/activation/loader-run.ts @@ -1,6 +1,6 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { PluginRecord } from "../plugins/registry.js"; -import type { OpenClawPluginApi, OpenClawPluginModule } from "../plugins/types.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { PluginRecord } from "../../plugins/registry.js"; +import type { OpenClawPluginApi, OpenClawPluginModule } from "../../plugins/types.js"; import type { ExtensionHostLoaderSession } from "./loader-session.js"; import { finalizeExtensionHostLoaderSession, diff --git a/src/extension-host/loader-runtime-proxy.test.ts b/src/extension-host/activation/loader-runtime-proxy.test.ts similarity index 100% rename from src/extension-host/loader-runtime-proxy.test.ts rename to src/extension-host/activation/loader-runtime-proxy.test.ts diff --git a/src/extension-host/loader-runtime-proxy.ts b/src/extension-host/activation/loader-runtime-proxy.ts similarity index 94% rename from src/extension-host/loader-runtime-proxy.ts rename to src/extension-host/activation/loader-runtime-proxy.ts index 05036e4c22f..7fd6a498dbb 100644 --- a/src/extension-host/loader-runtime-proxy.ts +++ b/src/extension-host/activation/loader-runtime-proxy.ts @@ -1,4 +1,4 @@ -import type { PluginRuntime } from "../plugins/runtime/types.js"; +import type { PluginRuntime } from "../../plugins/runtime/types.js"; export function createExtensionHostLazyRuntime(params: { runtimeOptions?: TOptions; diff --git a/src/extension-host/loader-runtime.test.ts b/src/extension-host/activation/loader-runtime.test.ts similarity index 97% rename from src/extension-host/loader-runtime.test.ts rename to src/extension-host/activation/loader-runtime.test.ts index 74908641de8..9792a975a42 100644 --- a/src/extension-host/loader-runtime.test.ts +++ b/src/extension-host/activation/loader-runtime.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { createExtensionHostPluginRecord } from "./loader-policy.js"; +import { createExtensionHostPluginRecord } from "../policy/loader-policy.js"; import { applyExtensionHostDefinitionToRecord, resolveExtensionHostEarlyMemoryDecision, diff --git a/src/extension-host/loader-runtime.ts b/src/extension-host/activation/loader-runtime.ts similarity index 94% rename from src/extension-host/loader-runtime.ts rename to src/extension-host/activation/loader-runtime.ts index 799b97c59be..efb1b6d46f0 100644 --- a/src/extension-host/loader-runtime.ts +++ b/src/extension-host/activation/loader-runtime.ts @@ -1,7 +1,7 @@ -import { resolveMemorySlotDecision } from "../plugins/config-state.js"; -import type { PluginRecord } from "../plugins/registry.js"; -import { validateJsonSchemaValue } from "../plugins/schema-validator.js"; -import type { OpenClawPluginDefinition, PluginDiagnostic } from "../plugins/types.js"; +import { resolveMemorySlotDecision } from "../../plugins/config-state.js"; +import type { PluginRecord } from "../../plugins/registry.js"; +import { validateJsonSchemaValue } from "../../plugins/schema-validator.js"; +import type { OpenClawPluginDefinition, PluginDiagnostic } from "../../plugins/types.js"; export function validateExtensionHostConfig(params: { schema?: Record; diff --git a/src/extension-host/loader-session.test.ts b/src/extension-host/activation/loader-session.test.ts similarity index 94% rename from src/extension-host/loader-session.test.ts rename to src/extension-host/activation/loader-session.test.ts index e4fe23830ca..f44d174a9ef 100644 --- a/src/extension-host/loader-session.test.ts +++ b/src/extension-host/activation/loader-session.test.ts @@ -2,9 +2,9 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; -import { normalizePluginsConfig } from "../plugins/config-state.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; -import type { PluginRegistry } from "../plugins/registry.js"; +import { normalizePluginsConfig } from "../../plugins/config-state.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; import { createExtensionHostLoaderSession, finalizeExtensionHostLoaderSession, diff --git a/src/extension-host/loader-session.ts b/src/extension-host/activation/loader-session.ts similarity index 89% rename from src/extension-host/loader-session.ts rename to src/extension-host/activation/loader-session.ts index e8eaec3ee4c..062df018fa2 100644 --- a/src/extension-host/loader-session.ts +++ b/src/extension-host/activation/loader-session.ts @@ -1,11 +1,11 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; -import type { PluginRecord, PluginRegistry } from "../plugins/registry.js"; -import type { OpenClawPluginApi, OpenClawPluginModule, PluginLogger } from "../plugins/types.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; +import type { PluginRecord, PluginRegistry } from "../../plugins/registry.js"; +import type { OpenClawPluginApi, OpenClawPluginModule, PluginLogger } from "../../plugins/types.js"; +import type { ExtensionHostProvenanceIndex } from "../policy/loader-policy.js"; import { finalizeExtensionHostRegistryLoad } from "./loader-finalize.js"; import { processExtensionHostPluginCandidate } from "./loader-flow.js"; -import type { ExtensionHostProvenanceIndex } from "./loader-policy.js"; export type ExtensionHostLoaderSession = { registry: PluginRegistry; diff --git a/src/extension-host/loader-state.test.ts b/src/extension-host/activation/loader-state.test.ts similarity index 96% rename from src/extension-host/loader-state.test.ts rename to src/extension-host/activation/loader-state.test.ts index 84c8383722a..eac602d1905 100644 --- a/src/extension-host/loader-state.test.ts +++ b/src/extension-host/activation/loader-state.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import type { PluginRegistry } from "../plugins/registry.js"; -import { createExtensionHostPluginRecord } from "./loader-policy.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import { createExtensionHostPluginRecord } from "../policy/loader-policy.js"; import { appendExtensionHostPluginRecord, markExtensionHostRegistryPluginsReady, diff --git a/src/extension-host/loader-state.ts b/src/extension-host/activation/loader-state.ts similarity index 98% rename from src/extension-host/loader-state.ts rename to src/extension-host/activation/loader-state.ts index 83b9c0856c9..348cae44508 100644 --- a/src/extension-host/loader-state.ts +++ b/src/extension-host/activation/loader-state.ts @@ -2,7 +2,7 @@ import type { PluginRecord, PluginRecordLifecycleState, PluginRegistry, -} from "../plugins/registry.js"; +} from "../../plugins/registry.js"; const EXTENSION_HOST_LIFECYCLE_STATUS_MAP: Record< PluginRecordLifecycleState, diff --git a/src/extension-host/hook-compat.test.ts b/src/extension-host/compat/hook-compat.test.ts similarity index 100% rename from src/extension-host/hook-compat.test.ts rename to src/extension-host/compat/hook-compat.test.ts diff --git a/src/extension-host/hook-compat.ts b/src/extension-host/compat/hook-compat.ts similarity index 95% rename from src/extension-host/hook-compat.ts rename to src/extension-host/compat/hook-compat.ts index 348e16aeaea..1dd66dc14e2 100644 --- a/src/extension-host/hook-compat.ts +++ b/src/extension-host/compat/hook-compat.ts @@ -1,13 +1,13 @@ -import { registerInternalHook, type InternalHookHandler } from "../hooks/internal-hooks.js"; +import { registerInternalHook, type InternalHookHandler } from "../../hooks/internal-hooks.js"; import type { PluginHookHandlerMap, PluginHookName, PluginHookRegistration as TypedPluginHookRegistration, -} from "../plugins/types.js"; +} from "../../plugins/types.js"; import { isPromptInjectionHookName, stripPromptMutationFieldsFromLegacyHookResult, -} from "../plugins/types.js"; +} from "../../plugins/types.js"; export function constrainExtensionHostPromptInjectionHook( handler: PluginHookHandlerMap["before_agent_start"], diff --git a/src/extension-host/loader-compat.ts b/src/extension-host/compat/loader-compat.ts similarity index 97% rename from src/extension-host/loader-compat.ts rename to src/extension-host/compat/loader-compat.ts index 60f750ed2f7..a03980b3e26 100644 --- a/src/extension-host/loader-compat.ts +++ b/src/extension-host/compat/loader-compat.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -import { resolveOpenClawPackageRootSync } from "../infra/openclaw-root.js"; +import { resolveOpenClawPackageRootSync } from "../../infra/openclaw-root.js"; type PluginSdkAliasCandidateKind = "dist" | "src"; diff --git a/src/extension-host/plugin-api.test.ts b/src/extension-host/compat/plugin-api.test.ts similarity index 98% rename from src/extension-host/plugin-api.test.ts rename to src/extension-host/compat/plugin-api.test.ts index d05fbc1190d..c089f50a39a 100644 --- a/src/extension-host/plugin-api.test.ts +++ b/src/extension-host/compat/plugin-api.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from "vitest"; -import type { PluginRecord } from "../plugins/registry.js"; +import type { PluginRecord } from "../../plugins/registry.js"; import { createExtensionHostPluginApi, normalizeExtensionHostPluginLogger } from "./plugin-api.js"; function createRecord(): PluginRecord { diff --git a/src/extension-host/plugin-api.ts b/src/extension-host/compat/plugin-api.ts similarity index 93% rename from src/extension-host/plugin-api.ts rename to src/extension-host/compat/plugin-api.ts index dff59fd3cf6..538d6702bb1 100644 --- a/src/extension-host/plugin-api.ts +++ b/src/extension-host/compat/plugin-api.ts @@ -1,5 +1,5 @@ -import type { PluginRecord } from "../plugins/registry.js"; -import type { PluginRuntime } from "../plugins/runtime/types.js"; +import type { PluginRecord } from "../../plugins/registry.js"; +import type { PluginRuntime } from "../../plugins/runtime/types.js"; import type { OpenClawPluginApi, OpenClawPluginChannelRegistration, @@ -12,8 +12,8 @@ import type { PluginHookName, PluginHookHandlerMap, ProviderPlugin, -} from "../plugins/types.js"; -import { resolveUserPath } from "../utils.js"; +} from "../../plugins/types.js"; +import { resolveUserPath } from "../../utils.js"; export function normalizeExtensionHostPluginLogger(logger: PluginLogger): PluginLogger { return { diff --git a/src/extension-host/plugin-registry-compat.test.ts b/src/extension-host/compat/plugin-registry-compat.test.ts similarity index 96% rename from src/extension-host/plugin-registry-compat.test.ts rename to src/extension-host/compat/plugin-registry-compat.test.ts index c45313fb95f..d6d0a6a53a5 100644 --- a/src/extension-host/plugin-registry-compat.test.ts +++ b/src/extension-host/compat/plugin-registry-compat.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from "vitest"; -import { clearPluginCommands } from "../plugins/commands.js"; -import { createEmptyPluginRegistry, type PluginRecord } from "../plugins/registry.js"; +import { clearPluginCommands } from "../../plugins/commands.js"; +import { createEmptyPluginRegistry, type PluginRecord } from "../../plugins/registry.js"; import { resolveExtensionHostCommandCompatibility, resolveExtensionHostProviderCompatibility, diff --git a/src/extension-host/plugin-registry-compat.ts b/src/extension-host/compat/plugin-registry-compat.ts similarity index 88% rename from src/extension-host/plugin-registry-compat.ts rename to src/extension-host/compat/plugin-registry-compat.ts index 0bb88c1c389..53afb62a9e8 100644 --- a/src/extension-host/plugin-registry-compat.ts +++ b/src/extension-host/compat/plugin-registry-compat.ts @@ -1,18 +1,18 @@ -import { normalizeRegisteredProvider } from "../plugins/provider-validation.js"; -import type { PluginRecord, PluginRegistry } from "../plugins/registry.js"; +import { normalizeRegisteredProvider } from "../../plugins/provider-validation.js"; +import type { PluginRecord, PluginRegistry } from "../../plugins/registry.js"; import type { OpenClawPluginCommandDefinition, PluginDiagnostic, ProviderPlugin, -} from "../plugins/types.js"; -import { registerExtensionHostPluginCommand } from "./command-runtime.js"; +} from "../../plugins/types.js"; +import { registerExtensionHostPluginCommand } from "../command-runtime.js"; import { type ExtensionHostCommandRegistration, type ExtensionHostProviderRegistration, resolveExtensionCommandRegistration, resolveExtensionProviderRegistration, -} from "./runtime-registrations.js"; -import { listExtensionHostProviderRegistrations } from "./runtime-registry.js"; +} from "../runtime-registrations.js"; +import { listExtensionHostProviderRegistrations } from "../runtime-registry.js"; export function pushExtensionHostRegistryDiagnostic(params: { registry: PluginRegistry; diff --git a/src/extension-host/plugin-registry-registrations.test.ts b/src/extension-host/compat/plugin-registry-registrations.test.ts similarity index 98% rename from src/extension-host/plugin-registry-registrations.test.ts rename to src/extension-host/compat/plugin-registry-registrations.test.ts index 6604553d69e..837761fb2c2 100644 --- a/src/extension-host/plugin-registry-registrations.test.ts +++ b/src/extension-host/compat/plugin-registry-registrations.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { createEmptyPluginRegistry, type PluginRecord } from "../plugins/registry.js"; +import { createEmptyPluginRegistry, type PluginRecord } from "../../plugins/registry.js"; import { createExtensionHostPluginRegistrationActions } from "./plugin-registry-registrations.js"; function createRecord(): PluginRecord { diff --git a/src/extension-host/plugin-registry-registrations.ts b/src/extension-host/compat/plugin-registry-registrations.ts similarity index 93% rename from src/extension-host/plugin-registry-registrations.ts rename to src/extension-host/compat/plugin-registry-registrations.ts index 822dec8879a..2e2c25e9d44 100644 --- a/src/extension-host/plugin-registry-registrations.ts +++ b/src/extension-host/compat/plugin-registry-registrations.ts @@ -1,8 +1,8 @@ -import type { AnyAgentTool } from "../agents/tools/common.js"; -import type { ChannelPlugin } from "../channels/plugins/types.js"; -import type { GatewayRequestHandler } from "../gateway/server-methods/types.js"; -import { registerInternalHook } from "../hooks/internal-hooks.js"; -import type { PluginRecord, PluginRegistry } from "../plugins/registry.js"; +import type { AnyAgentTool } from "../../agents/tools/common.js"; +import type { ChannelPlugin } from "../../channels/plugins/types.js"; +import type { GatewayRequestHandler } from "../../gateway/server-methods/types.js"; +import { registerInternalHook } from "../../hooks/internal-hooks.js"; +import type { PluginRecord, PluginRegistry } from "../../plugins/registry.js"; import type { PluginHookHandlerMap, PluginHookName, @@ -14,13 +14,8 @@ import type { OpenClawPluginService, OpenClawPluginToolFactory, PluginHookRegistration as TypedPluginHookRegistration, -} from "../plugins/types.js"; -import { registerExtensionHostContextEngine } from "./context-engine-runtime.js"; -import { - applyExtensionHostTypedHookPolicy, - bridgeExtensionHostLegacyHooks, -} from "./hook-compat.js"; -import { pushExtensionHostRegistryDiagnostic } from "./plugin-registry-compat.js"; +} from "../../plugins/types.js"; +import { registerExtensionHostContextEngine } from "../context-engine-runtime.js"; import { addExtensionChannelRegistration, addExtensionCliRegistration, @@ -31,7 +26,7 @@ import { addExtensionServiceRegistration, addExtensionToolRegistration, addExtensionTypedHookRegistration, -} from "./registry-writes.js"; +} from "../registry-writes.js"; import { resolveExtensionChannelRegistration, resolveExtensionCliRegistration, @@ -42,12 +37,17 @@ import { resolveExtensionServiceRegistration, resolveExtensionToolRegistration, resolveExtensionTypedHookRegistration, -} from "./runtime-registrations.js"; +} from "../runtime-registrations.js"; import { listExtensionHostChannelRegistrations, getExtensionHostGatewayHandlers, listExtensionHostHttpRoutes, -} from "./runtime-registry.js"; +} from "../runtime-registry.js"; +import { + applyExtensionHostTypedHookPolicy, + bridgeExtensionHostLegacyHooks, +} from "./hook-compat.js"; +import { pushExtensionHostRegistryDiagnostic } from "./plugin-registry-compat.js"; export type PluginTypedHookPolicy = { allowPromptInjection?: boolean; diff --git a/src/extension-host/plugin-registry.test.ts b/src/extension-host/compat/plugin-registry.test.ts similarity index 96% rename from src/extension-host/plugin-registry.test.ts rename to src/extension-host/compat/plugin-registry.test.ts index 9130e020fe6..b36abad1fe7 100644 --- a/src/extension-host/plugin-registry.test.ts +++ b/src/extension-host/compat/plugin-registry.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from "vitest"; -import { clearPluginCommands } from "../plugins/commands.js"; -import { createEmptyPluginRegistry, type PluginRecord } from "../plugins/registry.js"; +import { clearPluginCommands } from "../../plugins/commands.js"; +import { createEmptyPluginRegistry, type PluginRecord } from "../../plugins/registry.js"; import { createExtensionHostPluginRegistry } from "./plugin-registry.js"; function createRecord(): PluginRecord { diff --git a/src/extension-host/plugin-registry.ts b/src/extension-host/compat/plugin-registry.ts similarity index 97% rename from src/extension-host/plugin-registry.ts rename to src/extension-host/compat/plugin-registry.ts index b4d1b55e8f3..dfba29f77a7 100644 --- a/src/extension-host/plugin-registry.ts +++ b/src/extension-host/compat/plugin-registry.ts @@ -1,10 +1,14 @@ -import type { PluginRecord, PluginRegistry, PluginRegistryParams } from "../plugins/registry.js"; +import type { PluginRecord, PluginRegistry, PluginRegistryParams } from "../../plugins/registry.js"; import type { PluginDiagnostic, OpenClawPluginApi, OpenClawPluginCommandDefinition, ProviderPlugin, -} from "../plugins/types.js"; +} from "../../plugins/types.js"; +import { + addExtensionCommandRegistration, + addExtensionProviderRegistration, +} from "../registry-writes.js"; import { createExtensionHostPluginApi } from "./plugin-api.js"; import { resolveExtensionHostCommandCompatibility, @@ -14,10 +18,6 @@ import { createExtensionHostPluginRegistrationActions, type PluginTypedHookPolicy, } from "./plugin-registry-registrations.js"; -import { - addExtensionCommandRegistration, - addExtensionProviderRegistration, -} from "./registry-writes.js"; export function createExtensionHostPluginRegistry(params: { registry: PluginRegistry; diff --git a/src/extension-host/context-engine-runtime.ts b/src/extension-host/context-engine-runtime.ts index 3f14edcbe49..17727659c27 100644 --- a/src/extension-host/context-engine-runtime.ts +++ b/src/extension-host/context-engine-runtime.ts @@ -1,6 +1,6 @@ import type { OpenClawConfig } from "../config/config.js"; import type { ContextEngine } from "../context-engine/types.js"; -import { getExtensionHostDefaultSlotId } from "./slot-arbitration.js"; +import { getExtensionHostDefaultSlotId } from "./policy/slot-arbitration.js"; export type ExtensionHostContextEngineFactory = () => ContextEngine | Promise; diff --git a/src/extension-host/cutover-inventory.md b/src/extension-host/cutover-inventory.md index 4883b8a119c..882676d20f7 100644 --- a/src/extension-host/cutover-inventory.md +++ b/src/extension-host/cutover-inventory.md @@ -25,86 +25,88 @@ This is an implementation checklist, not a future-design spec. ## Current Inventory -| Surface | Current implementation | Target owner | Status | How it has been handled so far | -| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Active runtime registry state | `src/plugins/runtime.ts` plus global plugin runtime state | `src/extension-host/active-registry.ts` | `moved` | Host-owned active registry exists; `src/plugins/runtime.ts` is now a compatibility facade. | -| Normalized extension descriptor model | plugin manifests and package metadata interpreted ad hoc across `src/plugins/manifest.ts`, `src/plugins/discovery.ts`, `src/plugins/install.ts` | `src/extension-host/schema.ts` | `partial` | `ResolvedExtension`, `ResolvedContribution`, and `ContributionPolicy` exist; current manifests project into them through compatibility adapters. | -| Resolved static registry | flat rows in `src/plugins/manifest-registry.ts` | `src/extension-host/resolved-registry.ts` | `partial` | Manifest records now carry `resolvedExtension`; a host-owned resolved registry view exists for static consumers. | -| Manifest/package metadata loading | `src/plugins/manifest.ts`, `src/plugins/discovery.ts`, `src/plugins/install.ts` | `src/extension-host/schema.ts` and `src/extension-host/manifest-registry.ts` | `partial` | Package metadata parsing is routed through host schema helpers; legacy loader flow still supplies the source manifests. | -| Loader SDK alias compatibility | `src/plugins/loader.ts` | `src/extension-host/loader-compat.ts` | `partial` | Plugin-SDK alias candidate ordering, alias-file resolution, and scoped alias-map construction now live in host-owned loader compatibility helpers. | -| Loader alias-wired module loader creation | `src/plugins/loader.ts` | `src/extension-host/loader-module-loader.ts` | `partial` | Lazy Jiti creation and SDK-alias-wired module loading now delegate through a host-owned loader-module-loader helper. | -| Loader cache key and registry cache control | `src/plugins/loader.ts` | `src/extension-host/loader-cache.ts` | `partial` | Cache-key construction, LRU registry cache reads and writes, and cache clearing now delegate through host-owned loader-cache helpers while preserving the current cache shape and cap. | -| Loader lazy runtime proxy creation | `src/plugins/loader.ts` | `src/extension-host/loader-runtime-proxy.ts` | `partial` | Lazy plugin runtime creation now delegates through a host-owned loader-runtime-proxy helper instead of remaining inline in the orchestrator. | -| Loader provenance and duplicate-order policy | `src/plugins/loader.ts` | `src/extension-host/loader-policy.ts` | `partial` | Plugin-record creation, duplicate precedence, and provenance indexing now live in host-owned loader-policy helpers. | -| Loader discovery policy results | mixed inside `src/extension-host/loader-policy.ts` and `src/extension-host/loader-orchestrator.ts` | `src/extension-host/loader-discovery-policy.ts` | `partial` | Open-allowlist discovery warnings now resolve through explicit host-owned discovery-policy results before the orchestrator logs them. | -| Loader initial candidate planning and record creation | `src/plugins/loader.ts` | `src/extension-host/loader-records.ts` | `partial` | Duplicate detection, initial record creation, manifest metadata attachment, and first-pass enable-state planning now delegate through host-owned loader-records helpers. | -| Loader entry-path opening and module import | `src/plugins/loader.ts` | `src/extension-host/loader-import.ts` | `partial` | Boundary-checked entry opening and module import now delegate through host-owned loader-import helpers while preserving the current trusted in-process loading model. | -| Loader module-export, config-validation, and memory-slot decisions | `src/plugins/loader.ts` | `src/extension-host/loader-runtime.ts` | `partial` | Module export resolution, export-metadata application, config validation, and early or final memory-slot decisions now delegate through host-owned loader-runtime helpers. | -| Loader post-import planning and register execution | `src/plugins/loader.ts` | `src/extension-host/loader-register.ts` | `partial` | Definition application, post-import validation planning, and `register(...)` execution now delegate through host-owned loader-register helpers while preserving current plugin behavior. | -| Loader per-candidate orchestration | `src/plugins/loader.ts` | `src/extension-host/loader-flow.ts` | `partial` | The per-candidate load flow now runs through a host-owned orchestrator that composes planning, import, runtime validation, register execution, and record-state helpers. | -| Loader top-level load orchestration | `src/plugins/loader.ts` | `src/extension-host/loader-orchestrator.ts` | `partial` | High-level load entry and compatibility facade behavior now route through a host-owned loader orchestrator while `src/plugins/loader.ts` remains the external compatibility surface. | -| Loader host process state | mixed inside `src/plugins/loader.ts` and `src/extension-host/loader-orchestrator.ts` | `src/extension-host/loader-host-state.ts` | `partial` | Shared discovery warning-cache state and loader reset behavior now delegate through a host-owned loader-host-state helper. | -| Loader preflight and cache-hit setup | mixed inside `src/plugins/loader.ts` and `src/extension-host/loader-orchestrator.ts` | `src/extension-host/loader-preflight.ts` | `partial` | Test-default application, config normalization, cache-key construction, cache-hit activation, and command-clear preflight now delegate through a host-owned loader-preflight helper. | -| Loader post-preflight pipeline composition | mixed inside `src/plugins/loader.ts` and `src/extension-host/loader-orchestrator.ts` | `src/extension-host/loader-pipeline.ts` | `partial` | Post-preflight execution setup and session-run composition now delegate through a host-owned loader-pipeline helper. | -| Loader execution setup composition | mixed inside `src/plugins/loader.ts` and `src/extension-host/loader-orchestrator.ts` | `src/extension-host/loader-execution.ts` | `partial` | Runtime creation, registry creation, bootstrap setup, module-loader creation, and session creation now delegate through a host-owned loader-execution helper. | -| Loader discovery and manifest bootstrap | mixed inside `src/plugins/loader.ts` and `src/extension-host/loader-orchestrator.ts` | `src/extension-host/loader-bootstrap.ts` | `partial` | Discovery, manifest loading, manifest diagnostics, discovery-policy logging, provenance building, and candidate ordering now delegate through a host-owned loader-bootstrap helper. | -| Loader mutable activation state session | local variables in `src/extension-host/loader-orchestrator.ts` | `src/extension-host/loader-session.ts` | `partial` | Seen-id tracking, memory-slot selection state, and finalization inputs now live in a host-owned loader session instead of being spread across top-level loader variables. | -| Loader session run and finalization composition | mixed inside `src/extension-host/loader-orchestrator.ts` and `src/extension-host/loader-session.ts` | `src/extension-host/loader-run.ts` | `partial` | Candidate iteration, manifest lookup, per-candidate session processing, and finalization handoff now delegate through a host-owned loader-run helper. | -| Loader activation policy outcomes | open-coded in `src/extension-host/loader-flow.ts` | `src/extension-host/loader-activation-policy.ts` | `partial` | Duplicate precedence, config enablement, and early memory-slot gating now resolve through explicit host-owned activation-policy outcomes instead of remaining as inline loader decisions. | -| Loader record-state transitions | `src/plugins/loader.ts` | `src/extension-host/loader-state.ts` | `partial` | The loader now enforces an explicit lifecycle transition model (`prepared -> imported -> validated -> registered -> ready`, plus terminal `disabled` and `error`) while still mapping back to compatibility `PluginRecord.status` values. | -| Loader finalization policy results | mixed inside `src/extension-host/loader-policy.ts` and `src/extension-host/loader-finalize.ts` | `src/extension-host/loader-finalization-policy.ts` | `partial` | Memory-slot finalization warnings and provenance-based untracked-extension warnings now resolve through explicit host-owned finalization-policy results before the finalizer applies them. | -| Loader final cache, readiness, and activation finalization | `src/plugins/loader.ts` | `src/extension-host/loader-finalize.ts` | `partial` | Cache writes, readiness promotion, and registry activation now delegate through a host-owned loader-finalize helper; broader host lifecycle and policy semantics are still pending. | -| Channel lookup | `src/channels/plugins/index.ts`, `src/channels/plugins/registry-loader.ts`, `src/channels/registry.ts` | extension-host-backed registries plus kernel channel contracts | `partial` | Readers now consume host-owned runtime-registry channel accessors, and channel registrations now also keep host-owned runtime-registry storage with mirrored legacy compatibility arrays. Writes still originate from plugin registration. | -| Dock lookup | `src/channels/dock.ts` | host-owned static descriptors | `partial` | Runtime lookup now uses the host boundary; dock ownership itself has not moved yet. | -| Message-channel normalization | `src/utils/message-channel.ts` | host-owned channel registry view | `partial` | Lookup path now reads through host-owned runtime-registry channel accessors instead of raw legacy channel arrays. | -| Default plugin HTTP route lookup | `src/plugins/http-registry.ts` | host-owned route registry | `partial` | Default route registration and lookup now use host-owned runtime-registry state with a mirrored legacy `registry.httpRoutes` compatibility view. The plugin API still remains the external call surface for static route registration. | -| Channel catalog static metadata | `src/channels/plugins/catalog.ts` | host-owned static descriptors | `partial` | Package metadata parsing now flows through host schema helpers; full canonical catalog migration has not started. | -| Plugin skill discovery | `src/agents/skills/plugin-skills.ts` | host-owned resolved registry | `moved` | Static consumer now reads only resolved-extension data for skill paths and enablement filtering. | -| Plugin auto-enable | `src/config/plugin-auto-enable.ts` | host-owned resolved registry | `partial` | Primary logic runs on resolved-extension data; old manifest-registry injection remains as a compatibility input for older callers and tests. | -| Config validation indexing | `src/config/validation.ts`, `src/config/resolved-extension-validation.ts` | host-owned resolved registry | `moved` | Validation indexing now builds from resolved-extension records instead of flat manifest rows. | -| Config doc baseline generation | `src/config/doc-baseline.ts` | host-owned resolved registry | `moved` | Bundled plugin and channel metadata now load through the resolved-extension registry. | -| Plugin tool resolution and metadata | `src/plugins/tools.ts` | `src/extension-host/tool-runtime.ts` | `partial` | Optional-tool gating, plugin-id and tool-name conflict handling, tool-factory resolution, and plugin-tool metadata tracking now delegate through a host-owned tool-runtime helper while tool registrations now also keep host-owned runtime-registry storage with a mirrored legacy compatibility view. `src/plugins/tools.ts` remains the loader and config-normalization facade. | -| Plugin provider resolution | `src/plugins/providers.ts` | `src/extension-host/provider-runtime.ts` | `partial` | Provider projection from registry entries into runtime provider objects now delegates through a host-owned provider-runtime helper while `src/plugins/providers.ts` remains the loader and config-normalization facade. | -| Plugin provider discovery | `src/plugins/provider-discovery.ts` | `src/extension-host/provider-discovery.ts` | `partial` | Discovery-capable provider filtering, order grouping, and result normalization now delegate through a host-owned provider-discovery helper while `src/plugins/provider-discovery.ts` remains the compatibility facade around the legacy provider loader path. | -| Plugin provider auth helpers | `src/commands/provider-auth-helpers.ts` | `src/extension-host/provider-auth.ts` | `partial` | Provider matching, auth-method selection, config-patch merging, and default-model application now delegate through a host-owned provider-auth helper while command and onboarding entry points remain compatibility surfaces. | -| Plugin provider wizard metadata and choice resolution | `src/plugins/provider-wizard.ts` | `src/extension-host/provider-wizard.ts` | `partial` | Onboarding option building, model-picker entry building, and provider-method choice resolution now delegate through a host-owned provider-wizard helper while `src/plugins/provider-wizard.ts` remains the compatibility facade around loader-backed provider access and post-selection hooks. | -| Plugin provider auth application flow | `src/commands/auth-choice.apply.plugin-provider.ts` | `src/extension-host/provider-auth-flow.ts` | `partial` | Loaded-provider auth application, plugin-enable gating, auth-method execution, and post-auth default-model handling now delegate through a host-owned provider-auth-flow helper while `src/commands/auth-choice.apply.plugin-provider.ts` remains the compatibility entry point. | -| Plugin provider post-selection hook execution | `src/plugins/provider-wizard.ts`, `src/commands/model-picker.ts` | `src/extension-host/provider-model-selection.ts` | `partial` | Provider post-selection hook lookup and invocation now delegate through a host-owned provider-model-selection helper while `src/plugins/provider-wizard.ts` remains a compatibility facade and existing command consumers continue migrating onto the host-owned surface. | -| Plugin loader activation | `src/plugins/loader.ts` | extension host lifecycle + compatibility loader | `partial` | Activation now routes through `src/extension-host/activation.ts`, but discovery, enablement, provenance, module loading, and policy still live in the legacy plugin loader. | -| Plugin API compatibility facade | `src/plugins/registry.ts` | `src/extension-host/plugin-api.ts` | `partial` | Compatibility `OpenClawPluginApi` composition and logger shaping now delegate through a host-owned helper; concrete registration callbacks now come from `src/extension-host/plugin-registry.ts` while `src/plugins/registry.ts` remains the external wrapper. | -| Plugin registry compatibility facade | `src/plugins/registry.ts` | `src/extension-host/plugin-registry.ts` | `partial` | The compatibility plugin-registry facade now delegates through a host-owned helper; `src/plugins/registry.ts` mainly defines shared types and forwards to the host-owned facade. | -| Plugin registry compatibility policy | mixed inside `src/extension-host/plugin-registry.ts` | `src/extension-host/plugin-registry-compat.ts` | `partial` | Provider normalization, command duplicate enforcement, and registry-local diagnostic shaping now delegate through a host-owned compatibility helper; the underlying provider-validation and plugin-command subsystems still remain legacy-owned. | -| Plugin registry registration actions | mixed inside `src/extension-host/plugin-registry.ts` | `src/extension-host/plugin-registry-registrations.ts` | `partial` | Low-risk registration actions for tools, hooks, gateway methods, HTTP routes, channels, CLI, services, typed hooks, and context engines now delegate through a host-owned helper; the compatibility facade still composes those actions with provider and command compatibility policy. | -| Runtime registry read surface | direct reads of `registry.channels`, `registry.providers`, `registry.tools`, `registry.services`, `registry.cliRegistrars`, `registry.commands`, `registry.gatewayHandlers`, and `registry.httpRoutes` across runtime consumers | `src/extension-host/runtime-registry.ts` | `partial` | Host-owned runtime-registry accessors now serve channel, provider, tool, service, CLI, command, gateway-method, and HTTP-route consumers. Channel registrations, provider registrations, tool registrations, command registrations, HTTP routes, gateway methods, CLI registrations, and service registrations now also have host-owned runtime-registry storage with mirrored legacy compatibility views, and the CLI pre-load fast path treats any pre-seeded runtime entry surface as already loaded. | -| Channel registration writes | `src/plugins/registry.ts` | host-owned channel registry | `partial` | Validation and normalization now delegate to `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry channel state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. The legacy plugin API still remains the call surface. | -| Provider registration writes | `src/plugins/registry.ts` | host-owned provider registry | `partial` | Provider normalization and compatibility diagnostics now delegate through `src/extension-host/plugin-registry-compat.ts`, duplicate detection and normalized registration shape still delegate to `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry provider state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. | -| HTTP route registration writes | `src/plugins/registry.ts` | host-owned route registry | `partial` | Route validation and normalization now delegate to `src/extension-host/runtime-registrations.ts`, and append or replace writes now land in host-owned runtime-registry route state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. | -| Gateway method registration writes | `src/plugins/registry.ts` | host-owned runtime contribution registry | `partial` | Duplicate detection and normalized method registration now delegate to `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry gateway-handler state via `src/extension-host/registry-writes.ts` with a mirrored legacy compatibility map. | -| Tool registration writes | `src/plugins/registry.ts` | host-owned tool registry | `partial` | Tool-name normalization and tool-factory shaping delegate through `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry tool state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. Duplicate handling still follows the legacy tool path. | -| CLI registration writes | `src/plugins/registry.ts` | host-owned CLI registry | `partial` | CLI command-name normalization delegates through `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry CLI state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. The legacy plugin API still remains the call surface. | -| Service registration writes | `src/plugins/registry.ts` | host-owned service registry | `partial` | Service-id normalization delegates through `src/extension-host/runtime-registrations.ts`, writes now land in host-owned runtime-registry service state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays, and broader lifecycle ownership now starts in `src/extension-host/service-lifecycle.ts`. | -| Command registration writes | `src/plugins/registry.ts` | host-owned command registry | `partial` | Command-name normalization and duplicate-enforcement diagnostics now delegate through `src/extension-host/plugin-registry-compat.ts`, and writes now land in host-owned runtime-registry command state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. | -| Plugin command runtime | `src/plugins/commands.ts`, `src/auto-reply/reply/commands-plugin.ts`, `src/auto-reply/status.ts`, `src/extension-host/loader-orchestrator.ts` | `src/extension-host/command-runtime.ts` | `partial` | Command registration, matching, execution, listing, native command-spec projection, and loader reload clearing now delegate through a host-owned command-runtime helper while `src/plugins/commands.ts` remains the compatibility facade. | -| Context-engine registration writes | `src/plugins/registry.ts` | host-owned context-engine registry | `partial` | Context-engine id normalization now delegates to `src/extension-host/runtime-registrations.ts`, and the compatibility write plus runtime resolution now route through `src/extension-host/context-engine-runtime.ts` via `src/extension-host/registry-writes.ts` and the `src/context-engine/registry.ts` compatibility facade. | -| Legacy hook registration writes | `src/plugins/registry.ts` | host-owned hook registry | `partial` | Hook-entry construction and event normalization now delegate to `src/extension-host/runtime-registrations.ts`, and the compatibility write now routes through `src/extension-host/registry-writes.ts`; internal-hook bridging still remains in the legacy plugin registry. | -| Typed-hook registration writes | `src/plugins/registry.ts` | host-owned typed-hook registry | `partial` | Typed-hook record construction and hook-name validation now delegate to `src/extension-host/runtime-registrations.ts`, and the compatibility write now routes through `src/extension-host/registry-writes.ts`; prompt-injection policy and execution semantics remain legacy-owned. | -| Hook compatibility policy and bridging | `src/plugins/registry.ts` | `src/extension-host/hook-compat.ts` | `partial` | Legacy internal-hook bridging and typed prompt-injection compatibility policy now delegate through a host-owned helper; actual hook execution ownership remains legacy-owned. | -| Hook execution and global runner | `src/plugins/hook-runner-global.ts`, `src/hooks/internal-hooks.ts`, plugin hook registration in `src/plugins/registry.ts` | canonical kernel event stages + host bridges | `not started` | No canonical event-stage migration has landed yet. | -| Service lifecycle | `src/plugins/services.ts` and plugin service registration | `src/extension-host/service-lifecycle.ts` | `partial` | Service startup, stop ordering, service-context creation, and failure logging now delegate through a host-owned service-lifecycle helper while `src/plugins/services.ts` remains the compatibility entry point. | -| CLI registration | plugin CLI registration in `src/plugins/registry.ts` and CLI loaders | `src/extension-host/cli-lifecycle.ts` plus static descriptors where possible | `partial` | CLI duplicate detection, registrar invocation, and async failure logging now delegate through a host-owned CLI-lifecycle helper while `src/plugins/cli.ts` remains the compatibility entry point. | -| Gateway/server methods | `src/plugins/registry.ts` gateway handler registration plus gateway runtime consumers | `src/extension-host/gateway-methods.ts` plus host-owned runtime contribution registry | `partial` | Gateway method-id aggregation, plugin diagnostic shaping, and extra-handler composition now delegate through a host-owned gateway-methods helper, and gateway handlers now live in host-owned runtime-registry state with a mirrored legacy compatibility map. Request dispatch semantics still live in the gateway server code. | -| Conversation binding ownership, approvals, and restore semantics | `src/plugins/conversation-binding.ts` plus `src/infra/outbound/session-binding-service.ts` | host-owned binding registry and approval policy surface | `not started` | This is a real missing migration surface. The host needs to own plugin-scoped conversation binding, approval persistence, restore-on-restart behavior, detached-binding cleanup, and legacy binding migration without making `src/plugins/conversation-binding.ts` the long-term public surface. | -| Interactive callback routing and namespace ownership | `src/plugins/interactive.ts` plus Telegram and Discord monitor-specific callback wiring | host-owned interaction router and namespace registry | `not started` | This needs to be explicit. The host should own namespace registration, dedupe, fallback rules, and callback dispatch. The first validated rollout may target Telegram and Discord, but the contract itself should stay generic and kernel-agnostic. | -| Ingress claim and bound-route short-circuit semantics | `src/plugins/hooks.ts` typed `inbound_claim` hook plus `src/auto-reply/reply/dispatch-from-config.ts` | canonical event-pipeline ingress claim stage | `not started` | The behavior is conceptually in-scope today, but it should land as a canonical ingress-stage contract with legacy hook bridging only as migration. The key parity rule is first-claim-wins for route ownership while passive observers still run through their own stages. | -| Interactive channel control verbs for bound agents | product-shaped runtime helpers added under `src/plugins/runtime/*` and direct channel-specific helpers in extension code | host-owned adapter runtime contracts and interaction capabilities | `not started` | The host needs a bounded first-cut set of control verbs for interactive agents, such as typing leases plus message or conversation actions. Those verbs should be expressed as generic host-owned adapter capabilities, even if the first validated rollout only exercises them through Telegram and Discord. | -| Slot arbitration | `src/plugins/slots.ts` | `src/extension-host/slot-arbitration.ts` | `partial` | Exclusive-slot selection and default-slot resolution now route through a host-owned slot-arbitration helper while `src/plugins/slots.ts` remains the compatibility facade. Broader slot and catalog arbitration are still pending. | -| ACP backend registry | `src/acp/runtime/registry.ts` | `src/extension-host/acp-runtime-backend-registry.ts` | `partial` | ACP backend registration and resolution now route through a host-owned ACP runtime-backend registry while `src/acp/runtime/registry.ts` remains the compatibility facade. Broader runtime-backend catalog ownership and ACPX pilot migration are still pending. | -| Runtime-backend family catalog | built-in embedding, media-understanding, and TTS runtime descriptors currently implied by runtime-specific host registries | `src/extension-host/runtime-backend-catalog.ts`, `src/extension-host/runtime-backend-arbitration.ts`, and `src/extension-host/runtime-backend-policy.ts` | `partial` | Embedding, media-understanding, and TTS runtime families now publish host-owned `capability.runtime-backend` catalog descriptors through `src/extension-host/runtime-backend-catalog.ts`. The catalog keeps subsystem ids, selector keys, capabilities, explicit auto-selection metadata, default models, and default ranking explicit without widening the legacy provider API. Embedding now shares host-owned backend definitions between `src/extension-host/embedding-runtime-backends.ts`, `src/extension-host/embedding-runtime-registry.ts`, and the runtime-backend catalog instead of the catalog deriving those built-ins from the registry facade. Media-understanding now shares host-owned backend definitions between `src/extension-host/media-runtime-backends.ts`, `src/extension-host/media-runtime-registry.ts`, and the runtime-backend catalog instead of the catalog deriving those built-ins from the registry facade. TTS now shares host-owned backend definitions between `src/extension-host/tts-runtime-backends.ts`, `src/extension-host/tts-runtime-registry.ts`, and the runtime-backend catalog instead of the catalog deriving those built-ins from the registry facade. Initial runtime-family arbitration now routes through `src/extension-host/runtime-backend-arbitration.ts`, shared default and preferred backend ordering plus fallback chaining now route through `src/extension-host/runtime-backend-policy.ts`, the catalog helpers for generic subsystem ordering, media auto-ordering, and TTS preferred-provider ordering now also route through that shared backend-policy layer, embeddings, media, and TTS now also have explicit host-owned policy seams in `src/extension-host/embedding-runtime-policy.ts`, `src/extension-host/media-runtime-policy.ts`, and `src/extension-host/tts-runtime-policy.ts`, and embedding auto-provider selection, embedding local setup guidance, memory doctor guidance, media provider candidate ordering plus default-model lookup, and TTS request setup, status, plus compatibility provider-order exports now read runtime-family data through that catalog-backed arbitration and backend-policy path. Broader selection and arbitration consumers still need to adopt it. | -| Embedding provider registry and fallback routing | `src/memory/embeddings.ts`, `src/memory/manager.ts`, `src/memory/manager-sync-ops.ts`, plus plugin provider capability filtering through `src/plugins/runtime.ts` | `src/extension-host/embedding-runtime-backends.ts`, `src/extension-host/embedding-runtime-policy.ts`, `src/extension-host/embedding-runtime-registry.ts`, `src/extension-host/embedding-runtime.ts`, `src/extension-host/embedding-runtime-types.ts`, `src/extension-host/embedding-manager-runtime.ts`, `src/extension-host/embedding-sync-planning.ts`, `src/extension-host/embedding-sync-execution.ts`, `src/extension-host/embedding-reindex-execution.ts`, and `src/extension-host/embedding-safe-reindex.ts` | `partial` | Built-in embedding backend ids, default-model metadata, default local backend identity, and auto-selection metadata now route through shared host-owned definitions in `src/extension-host/embedding-runtime-backends.ts`, which feed both `src/extension-host/embedding-runtime-registry.ts` and the runtime-backend catalog. Embedding-provider auto-selection, provider creation, local-setup guidance, and primary plus fallback routing now route through a host-owned embedding runtime-registry helper, with auto-provider order and local setup guidance now reading remote backend ordering from `src/extension-host/embedding-runtime-policy.ts` instead of the backend-definition module directly. Explicit embedding fallback-model selection now routes through `src/extension-host/embedding-runtime-policy.ts`, and both the runtime registry and manager fallback activation reuse that one host-owned policy seam instead of keeping duplicate provider-specific fallback logic. The public embedding runtime surface and result typing now route through `src/extension-host/embedding-runtime.ts` and `src/extension-host/embedding-runtime-types.ts`, the main memory-manager consumers now use that host-owned boundary, manager-side batch policy plus fallback activation now route through `src/extension-host/embedding-manager-runtime.ts`, sync and reindex planning now route through `src/extension-host/embedding-sync-planning.ts`, sync and reindex orchestration now route through `src/extension-host/embedding-sync-execution.ts`, reindex sync-body execution plus unsafe reset now route through `src/extension-host/embedding-reindex-execution.ts`, and safe-reindex temp-db creation, file swap, reopen, and cleanup now route through `src/extension-host/embedding-safe-reindex.ts` while `src/memory/embeddings.ts` remains the compatibility facade. Runtime-backend catalog descriptors now also route through `src/extension-host/runtime-backend-catalog.ts`, and memory doctor guidance now reads the embedding auto-provider order from that policy seam. Remaining embedding work is down to broader consumer adoption and arbitration on top of that catalog surface. | -| Media-understanding provider registry and execution routing | `src/media-understanding/providers/index.ts`, `src/media-understanding/runner.ts`, `src/media-understanding/runner.entries.ts`, `src/media-understanding/resolve.ts`, plus plugin provider capability filtering through `src/plugins/runtime.ts` | `src/extension-host/media-runtime-backends.ts`, `src/extension-host/media-runtime-registry.ts`, `src/extension-host/media-runtime-policy.ts`, `src/extension-host/media-runtime-execution.ts`, `src/extension-host/media-runtime-auto.ts`, `src/extension-host/media-runtime-orchestration.ts`, `src/extension-host/media-runtime-config.ts`, `src/extension-host/media-runtime-decision.ts`, `src/extension-host/media-runtime-api.ts`, and `src/extension-host/media-runtime-entrypoints.ts` | `partial` | Built-in media backend ids, provider normalization, auto-selection seed order, selector-key shaping, and default-model metadata now route through shared host-owned definitions in `src/extension-host/media-runtime-backends.ts`, which feed both `src/extension-host/media-runtime-registry.ts` and the runtime-backend catalog. Override merging and runtime lookup now route through a host-owned media runtime-registry helper. Media provider candidate ordering, active-model precedence, and default-model fallback selection now route through `src/extension-host/media-runtime-policy.ts`, so `src/extension-host/media-runtime-auto.ts` no longer open-codes that subsystem-local ordering. Provider and CLI entry execution, output parsing, provider query normalization, provider auth and context shaping, and proxy-aware fetch handling now route through `src/extension-host/media-runtime-execution.ts`. Local-binary probing, auto-entry selection, and top-level capability orchestration now route through `src/extension-host/media-runtime-auto.ts` and `src/extension-host/media-runtime-orchestration.ts`. Prompt, timeout, scope, model-entry, and concurrency planning now route through `src/extension-host/media-runtime-config.ts`, and media decision shaping now routes through `src/extension-host/media-runtime-decision.ts`. The remaining API composition in `src/media-understanding/runner.ts` now routes through `src/extension-host/media-runtime-api.ts`, and the remaining lazy provider and CLI entrypoint wiring in `src/media-understanding/runner.entries.ts` now routes through `src/extension-host/media-runtime-entrypoints.ts`, leaving `src/media-understanding/providers/index.ts`, `src/media-understanding/runner.ts`, `src/media-understanding/runner.entries.ts`, and `src/media-understanding/resolve.ts` as compatibility facades. Runtime-backend catalog descriptors now also route through `src/extension-host/runtime-backend-catalog.ts`, and media auto-selection plus default-model lookup now consume that catalog through the shared media policy seam. Remaining media work is down to broader consumer adoption and arbitration on top of that catalog surface. | -| TTS provider registry and execution routing | `src/tts/tts.ts`, `src/gateway/server-methods/tts.ts`, and `src/auto-reply/reply/commands-tts.ts` | `src/extension-host/tts-runtime-backends.ts`, `src/extension-host/tts-runtime-registry.ts`, `src/extension-host/tts-runtime-policy.ts`, `src/extension-host/tts-runtime-execution.ts`, `src/extension-host/tts-runtime-setup.ts`, `src/extension-host/tts-config.ts`, `src/extension-host/tts-preferences.ts`, `src/extension-host/tts-payload.ts`, `src/extension-host/tts-status.ts`, and `src/extension-host/tts-api.ts` | `partial` | Built-in TTS backend metadata now routes through shared host-owned definitions in `src/extension-host/tts-runtime-backends.ts`, which feed both `src/extension-host/tts-runtime-registry.ts` and the runtime-backend catalog. Provider ordering, API-key resolution, configuration checks, and telephony support now route through that shared host-owned TTS runtime surface. Explicit TTS override and configured-fallback policy now routes through `src/extension-host/tts-runtime-policy.ts`, so default provider selection and fallback chaining no longer depend on hardcoded local ordering. Provider execution loops, output-format selection, telephony synthesis, and provider-error shaping now route through `src/extension-host/tts-runtime-execution.ts`. Provider selection and request setup now route through `src/extension-host/tts-runtime-setup.ts`. TTS config normalization, defaults, and model-override policy now route through `src/extension-host/tts-config.ts`. Prefs-path resolution, auto-mode policy, and persisted TTS preference reads and writes now route through `src/extension-host/tts-preferences.ts`. Auto-TTS gating, directive cleanup, truncation, summarization, and payload planning now route through `src/extension-host/tts-payload.ts`. Last-attempt state, status snapshots, and shared status formatting now route through `src/extension-host/tts-status.ts`. The remaining API composition in `src/tts/tts.ts` now routes through `src/extension-host/tts-api.ts`, so `src/tts/tts.ts` is down to a compatibility facade. Runtime-backend catalog descriptors now also route through `src/extension-host/runtime-backend-catalog.ts`, and TTS request setup, status, plus compatibility provider-order exports now consume that catalog-backed arbitration policy directly. Remaining TTS work is down to broader consumer adoption and arbitration on top of that catalog surface. | -| Onboarding/install/setup surfaces | `src/plugins/install.ts`, package manifests, channel catalog, onboarding commands | host-owned static descriptors | `partial` | Static metadata normalization has started; full setup/install descriptor migration is not done. | -| Pilot migrations | `extensions/thread-ownership`, `extensions/telegram`, `extensions/acpx` | extension-host path with parity tracking | `not started` | No pilot runs through the host path yet. | +The first filesystem-layout pass has also landed: activation helpers now live under `src/extension-host/activation/`, host-owned policy seams now live under `src/extension-host/policy/`, and compatibility facades now live under `src/extension-host/compat/`. This was a structure-only reorganization to match the planned module layout while preserving the same ownership boundaries and compatibility behavior. + +| Surface | Current implementation | Target owner | Status | How it has been handled so far | +| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Active runtime registry state | `src/plugins/runtime.ts` plus global plugin runtime state | `src/extension-host/active-registry.ts` | `moved` | Host-owned active registry exists; `src/plugins/runtime.ts` is now a compatibility facade. | +| Normalized extension descriptor model | plugin manifests and package metadata interpreted ad hoc across `src/plugins/manifest.ts`, `src/plugins/discovery.ts`, `src/plugins/install.ts` | `src/extension-host/schema.ts` | `partial` | `ResolvedExtension`, `ResolvedContribution`, and `ContributionPolicy` exist; current manifests project into them through compatibility adapters. | +| Resolved static registry | flat rows in `src/plugins/manifest-registry.ts` | `src/extension-host/resolved-registry.ts` | `partial` | Manifest records now carry `resolvedExtension`; a host-owned resolved registry view exists for static consumers. | +| Manifest/package metadata loading | `src/plugins/manifest.ts`, `src/plugins/discovery.ts`, `src/plugins/install.ts` | `src/extension-host/schema.ts` and `src/extension-host/manifest-registry.ts` | `partial` | Package metadata parsing is routed through host schema helpers; legacy loader flow still supplies the source manifests. | +| Loader SDK alias compatibility | `src/plugins/loader.ts` | `src/extension-host/compat/loader-compat.ts` | `partial` | Plugin-SDK alias candidate ordering, alias-file resolution, and scoped alias-map construction now live in host-owned loader compatibility helpers. | +| Loader alias-wired module loader creation | `src/plugins/loader.ts` | `src/extension-host/activation/loader-module-loader.ts` | `partial` | Lazy Jiti creation and SDK-alias-wired module loading now delegate through a host-owned loader-module-loader helper. | +| Loader cache key and registry cache control | `src/plugins/loader.ts` | `src/extension-host/activation/loader-cache.ts` | `partial` | Cache-key construction, LRU registry cache reads and writes, and cache clearing now delegate through host-owned loader-cache helpers while preserving the current cache shape and cap. | +| Loader lazy runtime proxy creation | `src/plugins/loader.ts` | `src/extension-host/activation/loader-runtime-proxy.ts` | `partial` | Lazy plugin runtime creation now delegates through a host-owned loader-runtime-proxy helper instead of remaining inline in the orchestrator. | +| Loader provenance and duplicate-order policy | `src/plugins/loader.ts` | `src/extension-host/policy/loader-policy.ts` | `partial` | Plugin-record creation, duplicate precedence, and provenance indexing now live in host-owned loader-policy helpers. | +| Loader discovery policy results | mixed inside `src/extension-host/policy/loader-policy.ts` and `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/policy/loader-discovery-policy.ts` | `partial` | Open-allowlist discovery warnings now resolve through explicit host-owned discovery-policy results before the orchestrator logs them. | +| Loader initial candidate planning and record creation | `src/plugins/loader.ts` | `src/extension-host/activation/loader-records.ts` | `partial` | Duplicate detection, initial record creation, manifest metadata attachment, and first-pass enable-state planning now delegate through host-owned loader-records helpers. | +| Loader entry-path opening and module import | `src/plugins/loader.ts` | `src/extension-host/activation/loader-import.ts` | `partial` | Boundary-checked entry opening and module import now delegate through host-owned loader-import helpers while preserving the current trusted in-process loading model. | +| Loader module-export, config-validation, and memory-slot decisions | `src/plugins/loader.ts` | `src/extension-host/activation/loader-runtime.ts` | `partial` | Module export resolution, export-metadata application, config validation, and early or final memory-slot decisions now delegate through host-owned loader-runtime helpers. | +| Loader post-import planning and register execution | `src/plugins/loader.ts` | `src/extension-host/activation/loader-register.ts` | `partial` | Definition application, post-import validation planning, and `register(...)` execution now delegate through host-owned loader-register helpers while preserving current plugin behavior. | +| Loader per-candidate orchestration | `src/plugins/loader.ts` | `src/extension-host/activation/loader-flow.ts` | `partial` | The per-candidate load flow now runs through a host-owned orchestrator that composes planning, import, runtime validation, register execution, and record-state helpers. | +| Loader top-level load orchestration | `src/plugins/loader.ts` | `src/extension-host/activation/loader-orchestrator.ts` | `partial` | High-level load entry and compatibility facade behavior now route through a host-owned loader orchestrator while `src/plugins/loader.ts` remains the external compatibility surface. | +| Loader host process state | mixed inside `src/plugins/loader.ts` and `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/activation/loader-host-state.ts` | `partial` | Shared discovery warning-cache state and loader reset behavior now delegate through a host-owned loader-host-state helper. | +| Loader preflight and cache-hit setup | mixed inside `src/plugins/loader.ts` and `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/activation/loader-preflight.ts` | `partial` | Test-default application, config normalization, cache-key construction, cache-hit activation, and command-clear preflight now delegate through a host-owned loader-preflight helper. | +| Loader post-preflight pipeline composition | mixed inside `src/plugins/loader.ts` and `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/activation/loader-pipeline.ts` | `partial` | Post-preflight execution setup and session-run composition now delegate through a host-owned loader-pipeline helper. | +| Loader execution setup composition | mixed inside `src/plugins/loader.ts` and `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/activation/loader-execution.ts` | `partial` | Runtime creation, registry creation, bootstrap setup, module-loader creation, and session creation now delegate through a host-owned loader-execution helper. | +| Loader discovery and manifest bootstrap | mixed inside `src/plugins/loader.ts` and `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/activation/loader-bootstrap.ts` | `partial` | Discovery, manifest loading, manifest diagnostics, discovery-policy logging, provenance building, and candidate ordering now delegate through a host-owned loader-bootstrap helper. | +| Loader mutable activation state session | local variables in `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/activation/loader-session.ts` | `partial` | Seen-id tracking, memory-slot selection state, and finalization inputs now live in a host-owned loader session instead of being spread across top-level loader variables. | +| Loader session run and finalization composition | mixed inside `src/extension-host/activation/loader-orchestrator.ts` and `src/extension-host/activation/loader-session.ts` | `src/extension-host/activation/loader-run.ts` | `partial` | Candidate iteration, manifest lookup, per-candidate session processing, and finalization handoff now delegate through a host-owned loader-run helper. | +| Loader activation policy outcomes | open-coded in `src/extension-host/activation/loader-flow.ts` | `src/extension-host/policy/loader-activation-policy.ts` | `partial` | Duplicate precedence, config enablement, and early memory-slot gating now resolve through explicit host-owned activation-policy outcomes instead of remaining as inline loader decisions. | +| Loader record-state transitions | `src/plugins/loader.ts` | `src/extension-host/activation/loader-state.ts` | `partial` | The loader now enforces an explicit lifecycle transition model (`prepared -> imported -> validated -> registered -> ready`, plus terminal `disabled` and `error`) while still mapping back to compatibility `PluginRecord.status` values. | +| Loader finalization policy results | mixed inside `src/extension-host/policy/loader-policy.ts` and `src/extension-host/activation/loader-finalize.ts` | `src/extension-host/policy/loader-finalization-policy.ts` | `partial` | Memory-slot finalization warnings and provenance-based untracked-extension warnings now resolve through explicit host-owned finalization-policy results before the finalizer applies them. | +| Loader final cache, readiness, and activation finalization | `src/plugins/loader.ts` | `src/extension-host/activation/loader-finalize.ts` | `partial` | Cache writes, readiness promotion, and registry activation now delegate through a host-owned loader-finalize helper; broader host lifecycle and policy semantics are still pending. | +| Channel lookup | `src/channels/plugins/index.ts`, `src/channels/plugins/registry-loader.ts`, `src/channels/registry.ts` | extension-host-backed registries plus kernel channel contracts | `partial` | Readers now consume host-owned runtime-registry channel accessors, and channel registrations now also keep host-owned runtime-registry storage with mirrored legacy compatibility arrays. Writes still originate from plugin registration. | +| Dock lookup | `src/channels/dock.ts` | host-owned static descriptors | `partial` | Runtime lookup now uses the host boundary; dock ownership itself has not moved yet. | +| Message-channel normalization | `src/utils/message-channel.ts` | host-owned channel registry view | `partial` | Lookup path now reads through host-owned runtime-registry channel accessors instead of raw legacy channel arrays. | +| Default plugin HTTP route lookup | `src/plugins/http-registry.ts` | host-owned route registry | `partial` | Default route registration and lookup now use host-owned runtime-registry state with a mirrored legacy `registry.httpRoutes` compatibility view. The plugin API still remains the external call surface for static route registration. | +| Channel catalog static metadata | `src/channels/plugins/catalog.ts` | host-owned static descriptors | `partial` | Package metadata parsing now flows through host schema helpers; full canonical catalog migration has not started. | +| Plugin skill discovery | `src/agents/skills/plugin-skills.ts` | host-owned resolved registry | `moved` | Static consumer now reads only resolved-extension data for skill paths and enablement filtering. | +| Plugin auto-enable | `src/config/plugin-auto-enable.ts` | host-owned resolved registry | `partial` | Primary logic runs on resolved-extension data; old manifest-registry injection remains as a compatibility input for older callers and tests. | +| Config validation indexing | `src/config/validation.ts`, `src/config/resolved-extension-validation.ts` | host-owned resolved registry | `moved` | Validation indexing now builds from resolved-extension records instead of flat manifest rows. | +| Config doc baseline generation | `src/config/doc-baseline.ts` | host-owned resolved registry | `moved` | Bundled plugin and channel metadata now load through the resolved-extension registry. | +| Plugin tool resolution and metadata | `src/plugins/tools.ts` | `src/extension-host/tool-runtime.ts` | `partial` | Optional-tool gating, plugin-id and tool-name conflict handling, tool-factory resolution, and plugin-tool metadata tracking now delegate through a host-owned tool-runtime helper while tool registrations now also keep host-owned runtime-registry storage with a mirrored legacy compatibility view. `src/plugins/tools.ts` remains the loader and config-normalization facade. | +| Plugin provider resolution | `src/plugins/providers.ts` | `src/extension-host/provider-runtime.ts` | `partial` | Provider projection from registry entries into runtime provider objects now delegates through a host-owned provider-runtime helper while `src/plugins/providers.ts` remains the loader and config-normalization facade. | +| Plugin provider discovery | `src/plugins/provider-discovery.ts` | `src/extension-host/provider-discovery.ts` | `partial` | Discovery-capable provider filtering, order grouping, and result normalization now delegate through a host-owned provider-discovery helper while `src/plugins/provider-discovery.ts` remains the compatibility facade around the legacy provider loader path. | +| Plugin provider auth helpers | `src/commands/provider-auth-helpers.ts` | `src/extension-host/provider-auth.ts` | `partial` | Provider matching, auth-method selection, config-patch merging, and default-model application now delegate through a host-owned provider-auth helper while command and onboarding entry points remain compatibility surfaces. | +| Plugin provider wizard metadata and choice resolution | `src/plugins/provider-wizard.ts` | `src/extension-host/provider-wizard.ts` | `partial` | Onboarding option building, model-picker entry building, and provider-method choice resolution now delegate through a host-owned provider-wizard helper while `src/plugins/provider-wizard.ts` remains the compatibility facade around loader-backed provider access and post-selection hooks. | +| Plugin provider auth application flow | `src/commands/auth-choice.apply.plugin-provider.ts` | `src/extension-host/provider-auth-flow.ts` | `partial` | Loaded-provider auth application, plugin-enable gating, auth-method execution, and post-auth default-model handling now delegate through a host-owned provider-auth-flow helper while `src/commands/auth-choice.apply.plugin-provider.ts` remains the compatibility entry point. | +| Plugin provider post-selection hook execution | `src/plugins/provider-wizard.ts`, `src/commands/model-picker.ts` | `src/extension-host/provider-model-selection.ts` | `partial` | Provider post-selection hook lookup and invocation now delegate through a host-owned provider-model-selection helper while `src/plugins/provider-wizard.ts` remains a compatibility facade and existing command consumers continue migrating onto the host-owned surface. | +| Plugin loader activation | `src/plugins/loader.ts` | extension host lifecycle + compatibility loader | `partial` | Activation now routes through `src/extension-host/activation.ts`, but discovery, enablement, provenance, module loading, and policy still live in the legacy plugin loader. | +| Plugin API compatibility facade | `src/plugins/registry.ts` | `src/extension-host/compat/plugin-api.ts` | `partial` | Compatibility `OpenClawPluginApi` composition and logger shaping now delegate through a host-owned helper; concrete registration callbacks now come from `src/extension-host/compat/plugin-registry.ts` while `src/plugins/registry.ts` remains the external wrapper. | +| Plugin registry compatibility facade | `src/plugins/registry.ts` | `src/extension-host/compat/plugin-registry.ts` | `partial` | The compatibility plugin-registry facade now delegates through a host-owned helper; `src/plugins/registry.ts` mainly defines shared types and forwards to the host-owned facade. | +| Plugin registry compatibility policy | mixed inside `src/extension-host/compat/plugin-registry.ts` | `src/extension-host/compat/plugin-registry-compat.ts` | `partial` | Provider normalization, command duplicate enforcement, and registry-local diagnostic shaping now delegate through a host-owned compatibility helper; the underlying provider-validation and plugin-command subsystems still remain legacy-owned. | +| Plugin registry registration actions | mixed inside `src/extension-host/compat/plugin-registry.ts` | `src/extension-host/compat/plugin-registry-registrations.ts` | `partial` | Low-risk registration actions for tools, hooks, gateway methods, HTTP routes, channels, CLI, services, typed hooks, and context engines now delegate through a host-owned helper; the compatibility facade still composes those actions with provider and command compatibility policy. | +| Runtime registry read surface | direct reads of `registry.channels`, `registry.providers`, `registry.tools`, `registry.services`, `registry.cliRegistrars`, `registry.commands`, `registry.gatewayHandlers`, and `registry.httpRoutes` across runtime consumers | `src/extension-host/runtime-registry.ts` | `partial` | Host-owned runtime-registry accessors now serve channel, provider, tool, service, CLI, command, gateway-method, and HTTP-route consumers. Channel registrations, provider registrations, tool registrations, command registrations, HTTP routes, gateway methods, CLI registrations, and service registrations now also have host-owned runtime-registry storage with mirrored legacy compatibility views, and the CLI pre-load fast path treats any pre-seeded runtime entry surface as already loaded. | +| Channel registration writes | `src/plugins/registry.ts` | host-owned channel registry | `partial` | Validation and normalization now delegate to `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry channel state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. The legacy plugin API still remains the call surface. | +| Provider registration writes | `src/plugins/registry.ts` | host-owned provider registry | `partial` | Provider normalization and compatibility diagnostics now delegate through `src/extension-host/compat/plugin-registry-compat.ts`, duplicate detection and normalized registration shape still delegate to `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry provider state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. | +| HTTP route registration writes | `src/plugins/registry.ts` | host-owned route registry | `partial` | Route validation and normalization now delegate to `src/extension-host/runtime-registrations.ts`, and append or replace writes now land in host-owned runtime-registry route state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. | +| Gateway method registration writes | `src/plugins/registry.ts` | host-owned runtime contribution registry | `partial` | Duplicate detection and normalized method registration now delegate to `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry gateway-handler state via `src/extension-host/registry-writes.ts` with a mirrored legacy compatibility map. | +| Tool registration writes | `src/plugins/registry.ts` | host-owned tool registry | `partial` | Tool-name normalization and tool-factory shaping delegate through `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry tool state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. Duplicate handling still follows the legacy tool path. | +| CLI registration writes | `src/plugins/registry.ts` | host-owned CLI registry | `partial` | CLI command-name normalization delegates through `src/extension-host/runtime-registrations.ts`, and writes now land in host-owned runtime-registry CLI state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. The legacy plugin API still remains the call surface. | +| Service registration writes | `src/plugins/registry.ts` | host-owned service registry | `partial` | Service-id normalization delegates through `src/extension-host/runtime-registrations.ts`, writes now land in host-owned runtime-registry service state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays, and broader lifecycle ownership now starts in `src/extension-host/service-lifecycle.ts`. | +| Command registration writes | `src/plugins/registry.ts` | host-owned command registry | `partial` | Command-name normalization and duplicate-enforcement diagnostics now delegate through `src/extension-host/compat/plugin-registry-compat.ts`, and writes now land in host-owned runtime-registry command state via `src/extension-host/registry-writes.ts` with mirrored legacy compatibility arrays. | +| Plugin command runtime | `src/plugins/commands.ts`, `src/auto-reply/reply/commands-plugin.ts`, `src/auto-reply/status.ts`, `src/extension-host/activation/loader-orchestrator.ts` | `src/extension-host/command-runtime.ts` | `partial` | Command registration, matching, execution, listing, native command-spec projection, and loader reload clearing now delegate through a host-owned command-runtime helper while `src/plugins/commands.ts` remains the compatibility facade. | +| Context-engine registration writes | `src/plugins/registry.ts` | host-owned context-engine registry | `partial` | Context-engine id normalization now delegates to `src/extension-host/runtime-registrations.ts`, and the compatibility write plus runtime resolution now route through `src/extension-host/context-engine-runtime.ts` via `src/extension-host/registry-writes.ts` and the `src/context-engine/registry.ts` compatibility facade. | +| Legacy hook registration writes | `src/plugins/registry.ts` | host-owned hook registry | `partial` | Hook-entry construction and event normalization now delegate to `src/extension-host/runtime-registrations.ts`, and the compatibility write now routes through `src/extension-host/registry-writes.ts`; internal-hook bridging still remains in the legacy plugin registry. | +| Typed-hook registration writes | `src/plugins/registry.ts` | host-owned typed-hook registry | `partial` | Typed-hook record construction and hook-name validation now delegate to `src/extension-host/runtime-registrations.ts`, and the compatibility write now routes through `src/extension-host/registry-writes.ts`; prompt-injection policy and execution semantics remain legacy-owned. | +| Hook compatibility policy and bridging | `src/plugins/registry.ts` | `src/extension-host/compat/hook-compat.ts` | `partial` | Legacy internal-hook bridging and typed prompt-injection compatibility policy now delegate through a host-owned helper; actual hook execution ownership remains legacy-owned. | +| Hook execution and global runner | `src/plugins/hook-runner-global.ts`, `src/hooks/internal-hooks.ts`, plugin hook registration in `src/plugins/registry.ts` | canonical kernel event stages + host bridges | `not started` | No canonical event-stage migration has landed yet. | +| Service lifecycle | `src/plugins/services.ts` and plugin service registration | `src/extension-host/service-lifecycle.ts` | `partial` | Service startup, stop ordering, service-context creation, and failure logging now delegate through a host-owned service-lifecycle helper while `src/plugins/services.ts` remains the compatibility entry point. | +| CLI registration | plugin CLI registration in `src/plugins/registry.ts` and CLI loaders | `src/extension-host/cli-lifecycle.ts` plus static descriptors where possible | `partial` | CLI duplicate detection, registrar invocation, and async failure logging now delegate through a host-owned CLI-lifecycle helper while `src/plugins/cli.ts` remains the compatibility entry point. | +| Gateway/server methods | `src/plugins/registry.ts` gateway handler registration plus gateway runtime consumers | `src/extension-host/gateway-methods.ts` plus host-owned runtime contribution registry | `partial` | Gateway method-id aggregation, plugin diagnostic shaping, and extra-handler composition now delegate through a host-owned gateway-methods helper, and gateway handlers now live in host-owned runtime-registry state with a mirrored legacy compatibility map. Request dispatch semantics still live in the gateway server code. | +| Conversation binding ownership, approvals, and restore semantics | `src/plugins/conversation-binding.ts` plus `src/infra/outbound/session-binding-service.ts` | host-owned binding registry and approval policy surface | `not started` | This is a real missing migration surface. The host needs to own plugin-scoped conversation binding, approval persistence, restore-on-restart behavior, detached-binding cleanup, and legacy binding migration without making `src/plugins/conversation-binding.ts` the long-term public surface. | +| Interactive callback routing and namespace ownership | `src/plugins/interactive.ts` plus Telegram and Discord monitor-specific callback wiring | host-owned interaction router and namespace registry | `not started` | This needs to be explicit. The host should own namespace registration, dedupe, fallback rules, and callback dispatch. The first validated rollout may target Telegram and Discord, but the contract itself should stay generic and kernel-agnostic. | +| Ingress claim and bound-route short-circuit semantics | `src/plugins/hooks.ts` typed `inbound_claim` hook plus `src/auto-reply/reply/dispatch-from-config.ts` | canonical event-pipeline ingress claim stage | `not started` | The behavior is conceptually in-scope today, but it should land as a canonical ingress-stage contract with legacy hook bridging only as migration. The key parity rule is first-claim-wins for route ownership while passive observers still run through their own stages. | +| Interactive channel control verbs for bound agents | product-shaped runtime helpers added under `src/plugins/runtime/*` and direct channel-specific helpers in extension code | host-owned adapter runtime contracts and interaction capabilities | `not started` | The host needs a bounded first-cut set of control verbs for interactive agents, such as typing leases plus message or conversation actions. Those verbs should be expressed as generic host-owned adapter capabilities, even if the first validated rollout only exercises them through Telegram and Discord. | +| Slot arbitration | `src/plugins/slots.ts` | `src/extension-host/policy/slot-arbitration.ts` | `partial` | Exclusive-slot selection and default-slot resolution now route through a host-owned slot-arbitration helper while `src/plugins/slots.ts` remains the compatibility facade. Broader slot and catalog arbitration are still pending. | +| ACP backend registry | `src/acp/runtime/registry.ts` | `src/extension-host/acp-runtime-backend-registry.ts` | `partial` | ACP backend registration and resolution now route through a host-owned ACP runtime-backend registry while `src/acp/runtime/registry.ts` remains the compatibility facade. Broader runtime-backend catalog ownership and ACPX pilot migration are still pending. | +| Runtime-backend family catalog | built-in embedding, media-understanding, and TTS runtime descriptors currently implied by runtime-specific host registries | `src/extension-host/runtime-backend-catalog.ts`, `src/extension-host/policy/runtime-backend-arbitration.ts`, and `src/extension-host/policy/runtime-backend-policy.ts` | `partial` | Embedding, media-understanding, and TTS runtime families now publish host-owned `capability.runtime-backend` catalog descriptors through `src/extension-host/runtime-backend-catalog.ts`. The catalog keeps subsystem ids, selector keys, capabilities, explicit auto-selection metadata, default models, and default ranking explicit without widening the legacy provider API. Embedding now shares host-owned backend definitions between `src/extension-host/embedding-runtime-backends.ts`, `src/extension-host/embedding-runtime-registry.ts`, and the runtime-backend catalog instead of the catalog deriving those built-ins from the registry facade. Media-understanding now shares host-owned backend definitions between `src/extension-host/media-runtime-backends.ts`, `src/extension-host/media-runtime-registry.ts`, and the runtime-backend catalog instead of the catalog deriving those built-ins from the registry facade. TTS now shares host-owned backend definitions between `src/extension-host/tts-runtime-backends.ts`, `src/extension-host/tts-runtime-registry.ts`, and the runtime-backend catalog instead of the catalog deriving those built-ins from the registry facade. Initial runtime-family arbitration now routes through `src/extension-host/policy/runtime-backend-arbitration.ts`, shared default and preferred backend ordering plus fallback chaining now route through `src/extension-host/policy/runtime-backend-policy.ts`, the catalog helpers for generic subsystem ordering, media auto-ordering, and TTS preferred-provider ordering now also route through that shared backend-policy layer, embeddings, media, and TTS now also have explicit host-owned policy seams in `src/extension-host/policy/embedding-runtime-policy.ts`, `src/extension-host/policy/media-runtime-policy.ts`, and `src/extension-host/policy/tts-runtime-policy.ts`, and embedding auto-provider selection, embedding local setup guidance, memory doctor guidance, media provider candidate ordering plus default-model lookup, and TTS request setup, status, plus compatibility provider-order exports now read runtime-family data through that catalog-backed arbitration and backend-policy path. Broader selection and arbitration consumers still need to adopt it. | +| Embedding provider registry and fallback routing | `src/memory/embeddings.ts`, `src/memory/manager.ts`, `src/memory/manager-sync-ops.ts`, plus plugin provider capability filtering through `src/plugins/runtime.ts` | `src/extension-host/embedding-runtime-backends.ts`, `src/extension-host/policy/embedding-runtime-policy.ts`, `src/extension-host/embedding-runtime-registry.ts`, `src/extension-host/embedding-runtime.ts`, `src/extension-host/embedding-runtime-types.ts`, `src/extension-host/embedding-manager-runtime.ts`, `src/extension-host/embedding-sync-planning.ts`, `src/extension-host/embedding-sync-execution.ts`, `src/extension-host/embedding-reindex-execution.ts`, and `src/extension-host/embedding-safe-reindex.ts` | `partial` | Built-in embedding backend ids, default-model metadata, default local backend identity, and auto-selection metadata now route through shared host-owned definitions in `src/extension-host/embedding-runtime-backends.ts`, which feed both `src/extension-host/embedding-runtime-registry.ts` and the runtime-backend catalog. Embedding-provider auto-selection, provider creation, local-setup guidance, and primary plus fallback routing now route through a host-owned embedding runtime-registry helper, with auto-provider order and local setup guidance now reading remote backend ordering from `src/extension-host/policy/embedding-runtime-policy.ts` instead of the backend-definition module directly. Explicit embedding fallback-model selection now routes through `src/extension-host/policy/embedding-runtime-policy.ts`, and both the runtime registry and manager fallback activation reuse that one host-owned policy seam instead of keeping duplicate provider-specific fallback logic. The public embedding runtime surface and result typing now route through `src/extension-host/embedding-runtime.ts` and `src/extension-host/embedding-runtime-types.ts`, the main memory-manager consumers now use that host-owned boundary, manager-side batch policy plus fallback activation now route through `src/extension-host/embedding-manager-runtime.ts`, sync and reindex planning now route through `src/extension-host/embedding-sync-planning.ts`, sync and reindex orchestration now route through `src/extension-host/embedding-sync-execution.ts`, reindex sync-body execution plus unsafe reset now route through `src/extension-host/embedding-reindex-execution.ts`, and safe-reindex temp-db creation, file swap, reopen, and cleanup now route through `src/extension-host/embedding-safe-reindex.ts` while `src/memory/embeddings.ts` remains the compatibility facade. Runtime-backend catalog descriptors now also route through `src/extension-host/runtime-backend-catalog.ts`, and memory doctor guidance now reads the embedding auto-provider order from that policy seam. Remaining embedding work is down to broader consumer adoption and arbitration on top of that catalog surface. | +| Media-understanding provider registry and execution routing | `src/media-understanding/providers/index.ts`, `src/media-understanding/runner.ts`, `src/media-understanding/runner.entries.ts`, `src/media-understanding/resolve.ts`, plus plugin provider capability filtering through `src/plugins/runtime.ts` | `src/extension-host/media-runtime-backends.ts`, `src/extension-host/media-runtime-registry.ts`, `src/extension-host/policy/media-runtime-policy.ts`, `src/extension-host/media-runtime-execution.ts`, `src/extension-host/media-runtime-auto.ts`, `src/extension-host/media-runtime-orchestration.ts`, `src/extension-host/media-runtime-config.ts`, `src/extension-host/media-runtime-decision.ts`, `src/extension-host/media-runtime-api.ts`, and `src/extension-host/media-runtime-entrypoints.ts` | `partial` | Built-in media backend ids, provider normalization, auto-selection seed order, selector-key shaping, and default-model metadata now route through shared host-owned definitions in `src/extension-host/media-runtime-backends.ts`, which feed both `src/extension-host/media-runtime-registry.ts` and the runtime-backend catalog. Override merging and runtime lookup now route through a host-owned media runtime-registry helper. Media provider candidate ordering, active-model precedence, and default-model fallback selection now route through `src/extension-host/policy/media-runtime-policy.ts`, so `src/extension-host/media-runtime-auto.ts` no longer open-codes that subsystem-local ordering. Provider and CLI entry execution, output parsing, provider query normalization, provider auth and context shaping, and proxy-aware fetch handling now route through `src/extension-host/media-runtime-execution.ts`. Local-binary probing, auto-entry selection, and top-level capability orchestration now route through `src/extension-host/media-runtime-auto.ts` and `src/extension-host/media-runtime-orchestration.ts`. Prompt, timeout, scope, model-entry, and concurrency planning now route through `src/extension-host/media-runtime-config.ts`, and media decision shaping now routes through `src/extension-host/media-runtime-decision.ts`. The remaining API composition in `src/media-understanding/runner.ts` now routes through `src/extension-host/media-runtime-api.ts`, and the remaining lazy provider and CLI entrypoint wiring in `src/media-understanding/runner.entries.ts` now routes through `src/extension-host/media-runtime-entrypoints.ts`, leaving `src/media-understanding/providers/index.ts`, `src/media-understanding/runner.ts`, `src/media-understanding/runner.entries.ts`, and `src/media-understanding/resolve.ts` as compatibility facades. Runtime-backend catalog descriptors now also route through `src/extension-host/runtime-backend-catalog.ts`, and media auto-selection plus default-model lookup now consume that catalog through the shared media policy seam. Remaining media work is down to broader consumer adoption and arbitration on top of that catalog surface. | +| TTS provider registry and execution routing | `src/tts/tts.ts`, `src/gateway/server-methods/tts.ts`, and `src/auto-reply/reply/commands-tts.ts` | `src/extension-host/tts-runtime-backends.ts`, `src/extension-host/tts-runtime-registry.ts`, `src/extension-host/policy/tts-runtime-policy.ts`, `src/extension-host/tts-runtime-execution.ts`, `src/extension-host/tts-runtime-setup.ts`, `src/extension-host/tts-config.ts`, `src/extension-host/tts-preferences.ts`, `src/extension-host/tts-payload.ts`, `src/extension-host/tts-status.ts`, and `src/extension-host/tts-api.ts` | `partial` | Built-in TTS backend metadata now routes through shared host-owned definitions in `src/extension-host/tts-runtime-backends.ts`, which feed both `src/extension-host/tts-runtime-registry.ts` and the runtime-backend catalog. Provider ordering, API-key resolution, configuration checks, and telephony support now route through that shared host-owned TTS runtime surface. Explicit TTS override and configured-fallback policy now routes through `src/extension-host/policy/tts-runtime-policy.ts`, so default provider selection and fallback chaining no longer depend on hardcoded local ordering. Provider execution loops, output-format selection, telephony synthesis, and provider-error shaping now route through `src/extension-host/tts-runtime-execution.ts`. Provider selection and request setup now route through `src/extension-host/tts-runtime-setup.ts`. TTS config normalization, defaults, and model-override policy now route through `src/extension-host/tts-config.ts`. Prefs-path resolution, auto-mode policy, and persisted TTS preference reads and writes now route through `src/extension-host/tts-preferences.ts`. Auto-TTS gating, directive cleanup, truncation, summarization, and payload planning now route through `src/extension-host/tts-payload.ts`. Last-attempt state, status snapshots, and shared status formatting now route through `src/extension-host/tts-status.ts`. The remaining API composition in `src/tts/tts.ts` now routes through `src/extension-host/tts-api.ts`, so `src/tts/tts.ts` is down to a compatibility facade. Runtime-backend catalog descriptors now also route through `src/extension-host/runtime-backend-catalog.ts`, and TTS request setup, status, plus compatibility provider-order exports now consume that catalog-backed arbitration policy directly. Remaining TTS work is down to broader consumer adoption and arbitration on top of that catalog surface. | +| Onboarding/install/setup surfaces | `src/plugins/install.ts`, package manifests, channel catalog, onboarding commands | host-owned static descriptors | `partial` | Static metadata normalization has started; full setup/install descriptor migration is not done. | +| Pilot migrations | `extensions/thread-ownership`, `extensions/telegram`, `extensions/acpx` | extension-host path with parity tracking | `not started` | No pilot runs through the host path yet. | ## Completed Pattern So Far diff --git a/src/extension-host/embedding-manager-runtime.ts b/src/extension-host/embedding-manager-runtime.ts index 2f75caa05e0..6a49e5e3cb1 100644 --- a/src/extension-host/embedding-manager-runtime.ts +++ b/src/extension-host/embedding-manager-runtime.ts @@ -1,7 +1,6 @@ import { resolveAgentDir } from "../agents/agent-scope.js"; import type { ResolvedMemorySearchConfig } from "../agents/memory-search.js"; import type { OpenClawConfig } from "../config/config.js"; -import { resolveExtensionHostEmbeddingFallbackPolicy } from "./embedding-runtime-policy.js"; import { createEmbeddingProvider, type EmbeddingProvider, @@ -12,6 +11,7 @@ import { type OpenAiEmbeddingClient, type VoyageEmbeddingClient, } from "./embedding-runtime.js"; +import { resolveExtensionHostEmbeddingFallbackPolicy } from "./policy/embedding-runtime-policy.js"; export type EmbeddingManagerBatchConfig = { enabled: boolean; diff --git a/src/extension-host/embedding-runtime-registry.test.ts b/src/extension-host/embedding-runtime-registry.test.ts index a9ec5b4ac8b..6b287ad1757 100644 --- a/src/extension-host/embedding-runtime-registry.test.ts +++ b/src/extension-host/embedding-runtime-registry.test.ts @@ -6,9 +6,9 @@ const listExtensionHostEmbeddingRemoteRuntimeBackendIds = vi.hoisted(() => const createGeminiEmbeddingProvider = vi.hoisted(() => vi.fn()); const createOpenAiEmbeddingProvider = vi.hoisted(() => vi.fn()); -vi.mock("./embedding-runtime-policy.js", async () => ({ - ...(await vi.importActual( - "./embedding-runtime-policy.js", +vi.mock("./policy/embedding-runtime-policy.js", async () => ({ + ...(await vi.importActual( + "./policy/embedding-runtime-policy.js", )), listExtensionHostEmbeddingRemoteRuntimeBackendIds, })); diff --git a/src/extension-host/embedding-runtime-registry.ts b/src/extension-host/embedding-runtime-registry.ts index ce857dbd5cd..29ba08bc778 100644 --- a/src/extension-host/embedding-runtime-registry.ts +++ b/src/extension-host/embedding-runtime-registry.ts @@ -26,16 +26,16 @@ import { import { importNodeLlamaCpp } from "../memory/node-llama.js"; import { resolveUserPath } from "../utils.js"; import { DEFAULT_EXTENSION_HOST_LOCAL_EMBEDDING_MODEL } from "./embedding-runtime-backends.js"; -import { - listExtensionHostEmbeddingRemoteRuntimeBackendIds, - resolveExtensionHostEmbeddingFallbackPolicy, -} from "./embedding-runtime-policy.js"; import type { EmbeddingProvider, EmbeddingProviderId, EmbeddingProviderOptions, EmbeddingProviderResult, } from "./embedding-runtime-types.js"; +import { + listExtensionHostEmbeddingRemoteRuntimeBackendIds, + resolveExtensionHostEmbeddingFallbackPolicy, +} from "./policy/embedding-runtime-policy.js"; export type { GeminiEmbeddingClient, diff --git a/src/extension-host/media-runtime-auto.ts b/src/extension-host/media-runtime-auto.ts index 35825eec33b..0b88675e5f5 100644 --- a/src/extension-host/media-runtime-auto.ts +++ b/src/extension-host/media-runtime-auto.ts @@ -21,7 +21,7 @@ import { runExec } from "../process/exec.js"; import { resolveExtensionHostMediaProviderCandidates, type ExtensionHostMediaActiveModel, -} from "./media-runtime-policy.js"; +} from "./policy/media-runtime-policy.js"; export type ActiveMediaModel = { provider: string; diff --git a/src/extension-host/embedding-runtime-policy.test.ts b/src/extension-host/policy/embedding-runtime-policy.test.ts similarity index 100% rename from src/extension-host/embedding-runtime-policy.test.ts rename to src/extension-host/policy/embedding-runtime-policy.test.ts diff --git a/src/extension-host/embedding-runtime-policy.ts b/src/extension-host/policy/embedding-runtime-policy.ts similarity index 93% rename from src/extension-host/embedding-runtime-policy.ts rename to src/extension-host/policy/embedding-runtime-policy.ts index 4f7029b73a6..434c7413027 100644 --- a/src/extension-host/embedding-runtime-policy.ts +++ b/src/extension-host/policy/embedding-runtime-policy.ts @@ -1,10 +1,10 @@ -import { resolveExtensionHostEmbeddingRuntimeDefaultModel } from "./embedding-runtime-backends.js"; +import { resolveExtensionHostEmbeddingRuntimeDefaultModel } from "../embedding-runtime-backends.js"; import type { EmbeddingProviderFallback, EmbeddingProviderId, EmbeddingProviderRequest, -} from "./embedding-runtime-types.js"; -import { listExtensionHostEmbeddingRuntimeBackendCatalogEntries } from "./runtime-backend-catalog.js"; +} from "../embedding-runtime-types.js"; +import { listExtensionHostEmbeddingRuntimeBackendCatalogEntries } from "../runtime-backend-catalog.js"; import { resolveExtensionHostRuntimeBackendIdsByPolicy } from "./runtime-backend-policy.js"; export function listExtensionHostEmbeddingRemoteRuntimeBackendIds(): readonly EmbeddingProviderId[] { diff --git a/src/extension-host/loader-activation-policy.test.ts b/src/extension-host/policy/loader-activation-policy.test.ts similarity index 92% rename from src/extension-host/loader-activation-policy.test.ts rename to src/extension-host/policy/loader-activation-policy.test.ts index 3ca49964f26..bd26c609fde 100644 --- a/src/extension-host/loader-activation-policy.test.ts +++ b/src/extension-host/policy/loader-activation-policy.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; -import type { OpenClawConfig } from "../config/config.js"; -import { normalizePluginsConfig } from "../plugins/config-state.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import { normalizePluginsConfig } from "../../plugins/config-state.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; import { resolveExtensionHostActivationPolicy } from "./loader-activation-policy.js"; function createCandidate(overrides: Partial = {}): PluginCandidate { diff --git a/src/extension-host/loader-activation-policy.ts b/src/extension-host/policy/loader-activation-policy.ts similarity index 82% rename from src/extension-host/loader-activation-policy.ts rename to src/extension-host/policy/loader-activation-policy.ts index 68d102108b1..be82b575cde 100644 --- a/src/extension-host/loader-activation-policy.ts +++ b/src/extension-host/policy/loader-activation-policy.ts @@ -1,10 +1,10 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginManifestRecord } from "../plugins/manifest-registry.js"; -import type { PluginRecord } from "../plugins/registry.js"; -import { prepareExtensionHostPluginCandidate } from "./loader-records.js"; -import { resolveExtensionHostEarlyMemoryDecision } from "./loader-runtime.js"; -import { setExtensionHostPluginRecordDisabled } from "./loader-state.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginManifestRecord } from "../../plugins/manifest-registry.js"; +import type { PluginRecord } from "../../plugins/registry.js"; +import { prepareExtensionHostPluginCandidate } from "../activation/loader-records.js"; +import { resolveExtensionHostEarlyMemoryDecision } from "../activation/loader-runtime.js"; +import { setExtensionHostPluginRecordDisabled } from "../activation/loader-state.js"; export type ExtensionHostActivationPolicyOutcome = | { diff --git a/src/extension-host/loader-discovery-policy.test.ts b/src/extension-host/policy/loader-discovery-policy.test.ts similarity index 100% rename from src/extension-host/loader-discovery-policy.test.ts rename to src/extension-host/policy/loader-discovery-policy.test.ts diff --git a/src/extension-host/loader-discovery-policy.ts b/src/extension-host/policy/loader-discovery-policy.ts similarity index 94% rename from src/extension-host/loader-discovery-policy.ts rename to src/extension-host/policy/loader-discovery-policy.ts index fb245d27f13..c1b40e68c1f 100644 --- a/src/extension-host/loader-discovery-policy.ts +++ b/src/extension-host/policy/loader-discovery-policy.ts @@ -1,4 +1,4 @@ -import type { PluginRecord } from "../plugins/registry.js"; +import type { PluginRecord } from "../../plugins/registry.js"; export function resolveExtensionHostDiscoveryPolicy(params: { pluginsEnabled: boolean; diff --git a/src/extension-host/loader-finalization-policy.test.ts b/src/extension-host/policy/loader-finalization-policy.test.ts similarity index 97% rename from src/extension-host/loader-finalization-policy.test.ts rename to src/extension-host/policy/loader-finalization-policy.test.ts index 68ef023acad..d10c3360020 100644 --- a/src/extension-host/loader-finalization-policy.test.ts +++ b/src/extension-host/policy/loader-finalization-policy.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import type { PluginRegistry } from "../plugins/registry.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; import { resolveExtensionHostFinalizationPolicy } from "./loader-finalization-policy.js"; function createRegistry(): PluginRegistry { diff --git a/src/extension-host/loader-finalization-policy.ts b/src/extension-host/policy/loader-finalization-policy.ts similarity index 92% rename from src/extension-host/loader-finalization-policy.ts rename to src/extension-host/policy/loader-finalization-policy.ts index c16bf153a58..2c516022334 100644 --- a/src/extension-host/loader-finalization-policy.ts +++ b/src/extension-host/policy/loader-finalization-policy.ts @@ -1,5 +1,5 @@ -import type { PluginRegistry } from "../plugins/registry.js"; -import type { PluginDiagnostic } from "../plugins/types.js"; +import type { PluginRegistry } from "../../plugins/registry.js"; +import type { PluginDiagnostic } from "../../plugins/types.js"; import { isExtensionHostTrackedByProvenance, safeRealpathOrResolveExtensionHostPath, diff --git a/src/extension-host/loader-policy.test.ts b/src/extension-host/policy/loader-policy.test.ts similarity index 97% rename from src/extension-host/loader-policy.test.ts rename to src/extension-host/policy/loader-policy.test.ts index e894d8cd559..c71dfd001be 100644 --- a/src/extension-host/loader-policy.test.ts +++ b/src/extension-host/policy/loader-policy.test.ts @@ -2,7 +2,7 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it } from "vitest"; -import type { PluginCandidate } from "../plugins/discovery.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; import { buildExtensionHostProvenanceIndex, compareExtensionHostDuplicateCandidateOrder, diff --git a/src/extension-host/loader-policy.ts b/src/extension-host/policy/loader-policy.ts similarity index 94% rename from src/extension-host/loader-policy.ts rename to src/extension-host/policy/loader-policy.ts index d413fc735ad..6ff98e5c534 100644 --- a/src/extension-host/loader-policy.ts +++ b/src/extension-host/policy/loader-policy.ts @@ -1,7 +1,11 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { PluginCandidate } from "../plugins/discovery.js"; -import type { PluginRecord, PluginRegistry } from "../plugins/registry.js"; -import type { PluginDiagnostic, PluginLogger } from "../plugins/types.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { PluginCandidate } from "../../plugins/discovery.js"; +import type { PluginRecord, PluginRegistry } from "../../plugins/registry.js"; +import type { PluginDiagnostic, PluginLogger } from "../../plugins/types.js"; +import { + appendExtensionHostPluginRecord, + setExtensionHostPluginRecordLifecycleState, +} from "../activation/loader-state.js"; import { addExtensionHostPathToMatcher, createExtensionHostPathMatcher, @@ -9,10 +13,6 @@ import { type ExtensionHostInstallTrackingRule, type ExtensionHostProvenanceIndex, } from "./loader-provenance.js"; -import { - appendExtensionHostPluginRecord, - setExtensionHostPluginRecordLifecycleState, -} from "./loader-state.js"; export function createExtensionHostPluginRecord(params: { id: string; diff --git a/src/extension-host/loader-provenance.test.ts b/src/extension-host/policy/loader-provenance.test.ts similarity index 100% rename from src/extension-host/loader-provenance.test.ts rename to src/extension-host/policy/loader-provenance.test.ts diff --git a/src/extension-host/loader-provenance.ts b/src/extension-host/policy/loader-provenance.ts similarity index 95% rename from src/extension-host/loader-provenance.ts rename to src/extension-host/policy/loader-provenance.ts index ab565303cc3..2ebc07d62bd 100644 --- a/src/extension-host/loader-provenance.ts +++ b/src/extension-host/policy/loader-provenance.ts @@ -1,7 +1,7 @@ import fs from "node:fs"; import path from "node:path"; -import { isPathInside, safeStatSync } from "../plugins/path-safety.js"; -import { resolveUserPath } from "../utils.js"; +import { isPathInside, safeStatSync } from "../../plugins/path-safety.js"; +import { resolveUserPath } from "../../utils.js"; export type ExtensionHostPathMatcher = { exact: Set; diff --git a/src/extension-host/media-runtime-policy.test.ts b/src/extension-host/policy/media-runtime-policy.test.ts similarity index 100% rename from src/extension-host/media-runtime-policy.test.ts rename to src/extension-host/policy/media-runtime-policy.test.ts diff --git a/src/extension-host/media-runtime-policy.ts b/src/extension-host/policy/media-runtime-policy.ts similarity index 96% rename from src/extension-host/media-runtime-policy.ts rename to src/extension-host/policy/media-runtime-policy.ts index 9115fb7ae97..3fe950281ea 100644 --- a/src/extension-host/media-runtime-policy.ts +++ b/src/extension-host/policy/media-runtime-policy.ts @@ -1,4 +1,4 @@ -import type { MediaUnderstandingCapability } from "../media-understanding/types.js"; +import type { MediaUnderstandingCapability } from "../../media-understanding/types.js"; import { normalizeExtensionHostMediaProviderId } from "./media-runtime-registry.js"; import { listExtensionHostMediaRuntimeBackendCatalogEntries, diff --git a/src/extension-host/runtime-backend-arbitration.test.ts b/src/extension-host/policy/runtime-backend-arbitration.test.ts similarity index 100% rename from src/extension-host/runtime-backend-arbitration.test.ts rename to src/extension-host/policy/runtime-backend-arbitration.test.ts diff --git a/src/extension-host/runtime-backend-arbitration.ts b/src/extension-host/policy/runtime-backend-arbitration.ts similarity index 100% rename from src/extension-host/runtime-backend-arbitration.ts rename to src/extension-host/policy/runtime-backend-arbitration.ts diff --git a/src/extension-host/runtime-backend-policy.test.ts b/src/extension-host/policy/runtime-backend-policy.test.ts similarity index 100% rename from src/extension-host/runtime-backend-policy.test.ts rename to src/extension-host/policy/runtime-backend-policy.test.ts diff --git a/src/extension-host/runtime-backend-policy.ts b/src/extension-host/policy/runtime-backend-policy.ts similarity index 100% rename from src/extension-host/runtime-backend-policy.ts rename to src/extension-host/policy/runtime-backend-policy.ts diff --git a/src/extension-host/slot-arbitration.test.ts b/src/extension-host/policy/slot-arbitration.test.ts similarity index 95% rename from src/extension-host/slot-arbitration.test.ts rename to src/extension-host/policy/slot-arbitration.test.ts index 9e9e6c88832..94623dea3e4 100644 --- a/src/extension-host/slot-arbitration.test.ts +++ b/src/extension-host/policy/slot-arbitration.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import type { OpenClawConfig } from "../config/config.js"; +import type { OpenClawConfig } from "../../config/config.js"; import { applyExtensionHostExclusiveSlotSelection } from "./slot-arbitration.js"; describe("extension host slot arbitration", () => { diff --git a/src/extension-host/slot-arbitration.ts b/src/extension-host/policy/slot-arbitration.ts similarity index 93% rename from src/extension-host/slot-arbitration.ts rename to src/extension-host/policy/slot-arbitration.ts index 05ea8e1bc95..98479a58a48 100644 --- a/src/extension-host/slot-arbitration.ts +++ b/src/extension-host/policy/slot-arbitration.ts @@ -1,6 +1,6 @@ -import type { OpenClawConfig } from "../config/config.js"; -import type { PluginSlotsConfig } from "../config/types.plugins.js"; -import type { PluginKind } from "../plugins/types.js"; +import type { OpenClawConfig } from "../../config/config.js"; +import type { PluginSlotsConfig } from "../../config/types.plugins.js"; +import type { PluginKind } from "../../plugins/types.js"; export type ExtensionHostPluginSlotKey = keyof PluginSlotsConfig; diff --git a/src/extension-host/tts-runtime-policy.test.ts b/src/extension-host/policy/tts-runtime-policy.test.ts similarity index 100% rename from src/extension-host/tts-runtime-policy.test.ts rename to src/extension-host/policy/tts-runtime-policy.test.ts diff --git a/src/extension-host/tts-runtime-policy.ts b/src/extension-host/policy/tts-runtime-policy.ts similarity index 95% rename from src/extension-host/tts-runtime-policy.ts rename to src/extension-host/policy/tts-runtime-policy.ts index 68242a0ff6d..a82ec5fe300 100644 --- a/src/extension-host/tts-runtime-policy.ts +++ b/src/extension-host/policy/tts-runtime-policy.ts @@ -1,4 +1,4 @@ -import type { TtsProvider } from "../config/types.tts.js"; +import type { TtsProvider } from "../../config/types.tts.js"; import { listExtensionHostTtsRuntimeBackendCatalogEntries, type ExtensionHostRuntimeBackendCatalogEntry, diff --git a/src/extension-host/runtime-backend-catalog.test.ts b/src/extension-host/runtime-backend-catalog.test.ts index bf93e7e5dae..0c13aad1f7c 100644 --- a/src/extension-host/runtime-backend-catalog.test.ts +++ b/src/extension-host/runtime-backend-catalog.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; -import { listExtensionHostEmbeddingRemoteRuntimeBackendIds } from "./embedding-runtime-policy.js"; +import { listExtensionHostEmbeddingRemoteRuntimeBackendIds } from "./policy/embedding-runtime-policy.js"; vi.mock("./embedding-runtime-backends.js", () => ({ EXTENSION_HOST_EMBEDDING_RUNTIME_BACKEND_IDS: [ diff --git a/src/extension-host/runtime-backend-catalog.ts b/src/extension-host/runtime-backend-catalog.ts index d890ed485a0..6686bde5fbb 100644 --- a/src/extension-host/runtime-backend-catalog.ts +++ b/src/extension-host/runtime-backend-catalog.ts @@ -12,7 +12,7 @@ import { normalizeExtensionHostMediaProviderId, resolveExtensionHostMediaRuntimeDefaultModelMetadata, } from "./media-runtime-backends.js"; -import { resolveExtensionHostRuntimeBackendIdsByPolicy } from "./runtime-backend-policy.js"; +import { resolveExtensionHostRuntimeBackendIdsByPolicy } from "./policy/runtime-backend-policy.js"; import { listExtensionHostTtsRuntimeBackends } from "./tts-runtime-backends.js"; export const EXTENSION_HOST_RUNTIME_BACKEND_FAMILY = "capability.runtime-backend"; diff --git a/src/extension-host/tts-runtime-setup.ts b/src/extension-host/tts-runtime-setup.ts index 21ba32761b9..0b45d97de76 100644 --- a/src/extension-host/tts-runtime-setup.ts +++ b/src/extension-host/tts-runtime-setup.ts @@ -1,10 +1,10 @@ import { existsSync, readFileSync } from "node:fs"; import type { TtsProvider } from "../config/types.tts.js"; -import type { ResolvedTtsConfig } from "./tts-config.js"; import { resolveExtensionHostDefaultTtsProvider, resolveExtensionHostTtsFallbackProviders, -} from "./tts-runtime-policy.js"; +} from "./policy/tts-runtime-policy.js"; +import type { ResolvedTtsConfig } from "./tts-config.js"; type TtsUserPrefs = { tts?: { diff --git a/src/extension-host/tts-status.ts b/src/extension-host/tts-status.ts index abb7fdc08a2..4c7b1a58b43 100644 --- a/src/extension-host/tts-status.ts +++ b/src/extension-host/tts-status.ts @@ -1,4 +1,5 @@ import type { TtsProvider } from "../config/types.tts.js"; +import { resolveExtensionHostTtsFallbackProviders } from "./policy/tts-runtime-policy.js"; import type { ResolvedTtsConfig } from "./tts-config.js"; import { getExtensionHostTtsMaxLength, @@ -6,7 +7,6 @@ import { isExtensionHostTtsSummarizationEnabled, resolveExtensionHostTtsAutoMode, } from "./tts-preferences.js"; -import { resolveExtensionHostTtsFallbackProviders } from "./tts-runtime-policy.js"; import { isExtensionHostTtsProviderConfigured, resolveExtensionHostTtsApiKey, diff --git a/src/plugins/slots.ts b/src/plugins/slots.ts index b383ab09548..53a52c0017a 100644 --- a/src/plugins/slots.ts +++ b/src/plugins/slots.ts @@ -4,4 +4,4 @@ export { extensionHostSlotKeyForPluginKind as slotKeyForPluginKind, type ExtensionHostPluginSlotKey as PluginSlotKey, type ExtensionHostSlotSelectionResult as SlotSelectionResult, -} from "../extension-host/slot-arbitration.js"; +} from "../extension-host/policy/slot-arbitration.js";