@clawos-dev/clawd 0.2.80-beta.150.2767f59 → 0.2.80-beta.151.166c577
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +37 -3
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -28692,6 +28692,28 @@ var path35 = __toESM(require("path"), 1);
|
|
|
28692
28692
|
var os13 = __toESM(require("os"), 1);
|
|
28693
28693
|
init_protocol();
|
|
28694
28694
|
init_protocol();
|
|
28695
|
+
function buildEnabledPluginNames(personaManager, personaId) {
|
|
28696
|
+
const out = /* @__PURE__ */ new Set();
|
|
28697
|
+
for (const p2 of personaManager.listEnabledPlugins(personaId)) {
|
|
28698
|
+
const name = p2.id.includes("@") ? p2.id.slice(0, p2.id.indexOf("@")) : p2.id;
|
|
28699
|
+
if (name) out.add(name);
|
|
28700
|
+
}
|
|
28701
|
+
return out;
|
|
28702
|
+
}
|
|
28703
|
+
function filterGuestSkills(list, enabledPluginNames) {
|
|
28704
|
+
return list.filter((e) => {
|
|
28705
|
+
if (e.source === "builtin" || e.source === "project") return true;
|
|
28706
|
+
if (e.source === "plugin") return !!e.plugin && enabledPluginNames.has(e.plugin);
|
|
28707
|
+
return false;
|
|
28708
|
+
});
|
|
28709
|
+
}
|
|
28710
|
+
function filterGuestAgents(list, enabledPluginNames) {
|
|
28711
|
+
return list.filter((e) => {
|
|
28712
|
+
if (e.source === "builtin" || e.source === "project") return true;
|
|
28713
|
+
if (e.source === "plugin") return !!e.plugin && enabledPluginNames.has(e.plugin);
|
|
28714
|
+
return false;
|
|
28715
|
+
});
|
|
28716
|
+
}
|
|
28695
28717
|
function assertGuestPath2(ctx, absPath, personaRoot, method) {
|
|
28696
28718
|
if (!ctx || ctx.principal.kind !== "guest" || !personaRoot) return;
|
|
28697
28719
|
if (!isGuestPathAllowed(ctx.grants, absPath, personaRoot, "read")) {
|
|
@@ -28702,7 +28724,7 @@ function assertGuestPath2(ctx, absPath, personaRoot, method) {
|
|
|
28702
28724
|
}
|
|
28703
28725
|
}
|
|
28704
28726
|
function buildWorkspaceHandlers(deps) {
|
|
28705
|
-
const { workspace, skills, agents, personaRoot } = deps;
|
|
28727
|
+
const { workspace, skills, agents, personaRoot, personaManager } = deps;
|
|
28706
28728
|
const list = async (frame, _client, ctx) => {
|
|
28707
28729
|
const args = WorkspaceListArgs.parse(frame);
|
|
28708
28730
|
const isGuest = ctx?.principal.kind === "guest";
|
|
@@ -28722,14 +28744,26 @@ function buildWorkspaceHandlers(deps) {
|
|
|
28722
28744
|
};
|
|
28723
28745
|
const skillsList = async (frame, _client, ctx) => {
|
|
28724
28746
|
const args = SkillsListArgs.parse(frame);
|
|
28725
|
-
|
|
28747
|
+
const cwdAbs = path35.resolve(args.cwd);
|
|
28748
|
+
assertGuestPath2(ctx, cwdAbs, personaRoot, "skills:list");
|
|
28726
28749
|
const list2 = skills.list(args);
|
|
28750
|
+
if (ctx?.principal.kind === "guest" && personaRoot) {
|
|
28751
|
+
const personaId = personaIdFromPath(cwdAbs, personaRoot);
|
|
28752
|
+
const enabled = personaId ? buildEnabledPluginNames(personaManager, personaId) : /* @__PURE__ */ new Set();
|
|
28753
|
+
return { response: { type: "skills:list", skills: filterGuestSkills(list2, enabled) } };
|
|
28754
|
+
}
|
|
28727
28755
|
return { response: { type: "skills:list", skills: list2 } };
|
|
28728
28756
|
};
|
|
28729
28757
|
const agentsList = async (frame, _client, ctx) => {
|
|
28730
28758
|
const args = AgentsListArgs.parse(frame);
|
|
28731
|
-
|
|
28759
|
+
const cwdAbs = path35.resolve(args.cwd);
|
|
28760
|
+
assertGuestPath2(ctx, cwdAbs, personaRoot, "agents:list");
|
|
28732
28761
|
const list2 = agents.list(args);
|
|
28762
|
+
if (ctx?.principal.kind === "guest" && personaRoot) {
|
|
28763
|
+
const personaId = personaIdFromPath(cwdAbs, personaRoot);
|
|
28764
|
+
const enabled = personaId ? buildEnabledPluginNames(personaManager, personaId) : /* @__PURE__ */ new Set();
|
|
28765
|
+
return { response: { type: "agents:list", agents: filterGuestAgents(list2, enabled) } };
|
|
28766
|
+
}
|
|
28733
28767
|
return { response: { type: "agents:list", agents: list2 } };
|
|
28734
28768
|
};
|
|
28735
28769
|
return {
|
package/package.json
CHANGED