mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:00:44 +00:00
chore: trace plugin lifecycle phases
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
installPluginFromMarketplace,
|
||||
resolveMarketplaceInstallShortcut,
|
||||
} from "../plugins/marketplace.js";
|
||||
import { tracePluginLifecyclePhaseAsync } from "../plugins/plugin-lifecycle-trace.js";
|
||||
import { validateJsonSchemaValue } from "../plugins/schema-validator.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { theme } from "../terminal/theme.js";
|
||||
@@ -394,7 +395,11 @@ async function loadConfigFromSnapshotForInstall(
|
||||
export async function loadConfigForInstall(
|
||||
request: PluginInstallRequestContext,
|
||||
): Promise<ConfigSnapshotForInstallPersist> {
|
||||
const snapshot = await readConfigFileSnapshot();
|
||||
const snapshot = await tracePluginLifecyclePhaseAsync(
|
||||
"config read",
|
||||
() => readConfigFileSnapshot(),
|
||||
{ command: "install" },
|
||||
);
|
||||
if (snapshot.valid) {
|
||||
return {
|
||||
config: snapshot.sourceConfig,
|
||||
@@ -414,7 +419,11 @@ export async function runPluginInstallCommand(params: {
|
||||
};
|
||||
}) {
|
||||
const shorthand = !params.opts.marketplace
|
||||
? await resolveMarketplaceInstallShortcut(params.raw)
|
||||
? await tracePluginLifecyclePhaseAsync(
|
||||
"marketplace shortcut resolution",
|
||||
() => resolveMarketplaceInstallShortcut(params.raw),
|
||||
{ command: "install" },
|
||||
)
|
||||
: null;
|
||||
if (shorthand?.ok === false) {
|
||||
defaultRuntime.error(shorthand.error);
|
||||
@@ -641,12 +650,21 @@ export async function runPluginInstallCommand(params: {
|
||||
findBundledSource: (lookup) => findBundledPluginSource({ lookup }),
|
||||
});
|
||||
if (bundledPreNpmPlan) {
|
||||
await installBundledPluginSource({
|
||||
snapshot,
|
||||
rawSpec: raw,
|
||||
bundledSource: bundledPreNpmPlan.bundledSource,
|
||||
warning: bundledPreNpmPlan.warning,
|
||||
});
|
||||
await tracePluginLifecyclePhaseAsync(
|
||||
"install execution",
|
||||
() =>
|
||||
installBundledPluginSource({
|
||||
snapshot,
|
||||
rawSpec: raw,
|
||||
bundledSource: bundledPreNpmPlan.bundledSource,
|
||||
warning: bundledPreNpmPlan.warning,
|
||||
}),
|
||||
{
|
||||
command: "install",
|
||||
source: "bundled",
|
||||
pluginId: bundledPreNpmPlan.bundledSource.pluginId,
|
||||
},
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user