@@ -4,13 +4,8 @@ import { assertConfigWriteAllowedInCurrentMode } from "../config/config.js";
44import { reportClawHubPluginInstallTelemetry } from "../infra/clawhub-packages.js" ;
55import { parseClawHubPluginSpec } from "../infra/clawhub-spec.js" ;
66import { formatErrorMessage } from "../infra/errors.js" ;
7- import { createManagedPluginArtifactConsentHandler } from "../plugins/capability-consent.js" ;
87import { CLAWHUB_INSTALL_ERROR_CODE } from "../plugins/clawhub.js" ;
9- import { resolveDefaultPluginExtensionsDir } from "../plugins/install-paths.js" ;
10- import { persistPluginInstall } from "../plugins/install-persistence.js" ;
11- import { loadInstalledPluginIndexInstallRecords } from "../plugins/installed-plugin-index-records.js" ;
128import { installManagedPluginSource } from "../plugins/management-service.js" ;
13- import { installPluginFromMarketplace } from "../plugins/marketplace.js" ;
149import { withPluginLifecycleLease } from "../plugins/plugin-lifecycle-lease.js" ;
1510import { tracePluginLifecyclePhaseAsync } from "../plugins/plugin-lifecycle-trace.js" ;
1611import { defaultRuntime } from "../runtime.js" ;
@@ -121,46 +116,26 @@ async function runPluginInstallCommandUnlocked(
121116 ) {
122117 return runtime . exit ( 1 ) ;
123118 }
124- const artifactConsent = createManagedPluginArtifactConsentHandler ( {
125- config : snapshot . config ,
126- source : "marketplace" ,
127- spec : `${ raw } @${ preflight . marketplace } ` ,
128- ...( installMode === "update"
129- ? { previousRecords : await loadInstalledPluginIndexInstallRecords ( ) }
130- : { } ) ,
119+ const result = await installManagedPluginSource ( {
120+ request : {
121+ source : "marketplace" ,
122+ marketplace : preflight . marketplace ,
123+ plugin : raw ,
124+ mode : installMode ,
125+ } ,
126+ snapshot,
131127 ...capabilityConsent ,
132- } ) ;
133- const result = await installPluginFromMarketplace ( {
134- ...safetyOverrides ,
135- marketplace : preflight . marketplace ,
136- mode : installMode ,
137- plugin : raw ,
138- extensionsDir : resolveDefaultPluginExtensionsDir ( ) ,
128+ safetyOverrides,
139129 logger : createPluginInstallLogger ( runtime ) ,
140- onBeforePluginArtifactCommit : artifactConsent . onBeforePluginArtifactCommit ,
130+ invalidateRuntimeCache,
131+ runtime,
141132 } ) ;
142133 if ( ! result . ok ) {
143134 if ( ! isClawHubBlockedCliFailure ( result ) ) {
144135 runtime . error ( result . error ) ;
145136 }
146137 return runtime . exit ( 1 ) ;
147138 }
148-
149- const install = artifactConsent . applyAcceptedSurface ( result . pluginId , {
150- source : "marketplace" ,
151- installPath : result . targetDir ,
152- version : result . version ,
153- marketplaceName : result . marketplaceName ,
154- marketplaceSource : result . marketplaceSource ,
155- marketplacePlugin : result . marketplacePlugin ,
156- } ) ;
157- await persistPluginInstall ( {
158- snapshot,
159- pluginId : result . pluginId ,
160- install,
161- invalidateRuntimeCache,
162- runtime,
163- } ) ;
164139 return ;
165140 }
166141
@@ -251,6 +226,7 @@ async function runPluginInstallCommandUnlocked(
251226 return runtime . exit ( 1 ) ;
252227 }
253228
229+ case "marketplace" :
254230 case "npm-pack" :
255231 case "git" : {
256232 const result = await installManagedPluginSource ( {
0 commit comments