openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
37 lines (36 loc) • 1.63 kB
JavaScript
import { O as tryResolveAmbientOwnerAgentId, f as resolveAgentWorkspaceDir } from "./agent-scope-config-DmXgFGKP.mjs";
//#region src/plugins/control-plane-workspace.ts
/** Resolves the optional agent workspace enrichment used by plugin control-plane inventory. */
const PLUGIN_WORKSPACE_SCOPE_OMITTED_DIAGNOSTIC_CODE = "workspace-scope-omitted";
/**
* Resolve workspace discovery without inventing ownership for an explicit roster.
* Shared roots remain safe to inspect when no system owner can be proven.
*/
function resolvePluginControlPlaneWorkspace(e) {
if (e.workspaceDir !== void 0) return {
workspaceDir: e.workspaceDir,
workspaceScope: "selected"
};
const t = tryResolveAmbientOwnerAgentId(e.config);
const n = t ? resolveAgentWorkspaceDir(e.config, t, e.env) : void 0;
if (n) return {
agentId: t,
workspaceDir: n,
workspaceScope: "selected"
};
return {
workspaceScope: "omitted",
diagnostic: {
level: "warn",
code: PLUGIN_WORKSPACE_SCOPE_OMITTED_DIAGNOSTIC_CODE,
message: "Workspace plugin discovery was skipped because multiple explicit agents are configured without agents.defaults.systemAgent.agentId. This partial result includes bundled, managed, and global plugins only; set agents.defaults.systemAgent.agentId to include that owner's workspace plugins."
}
};
}
function appendPluginControlPlaneWorkspaceDiagnostic(e, t) {
const n = t.diagnostic;
if (!n || e.some((e) => e.code === PLUGIN_WORKSPACE_SCOPE_OMITTED_DIAGNOSTIC_CODE)) return [...e];
return [...e, n];
}
//#endregion
export { resolvePluginControlPlaneWorkspace as n, appendPluginControlPlaneWorkspaceDiagnostic as t };