@michengai/dsh-skills-manager 1.2.26 → 1.2.28

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/lib/core.js CHANGED
@@ -1957,20 +1957,35 @@ function invalidManagerStateWrite() {
1957
1957
  error: `\u6280\u80FD\u7BA1\u7406\u5668\u72B6\u6001\u6587\u4EF6\u4E0D\u53EF\u8BFB\uFF0C\u5DF2\u62D2\u7EDD\u8986\u76D6: ${managerStatePath()}`
1958
1958
  };
1959
1959
  }
1960
- async function getSidebarEntry() {
1960
+ async function getEntryLocation() {
1961
1961
  const current = await readManagerState();
1962
- return current.state.sidebarEntry === true;
1962
+ if (current.state.entryLocation === "both" || current.state.entryLocation === "sidebar" || current.state.entryLocation === "settings") {
1963
+ return current.state.entryLocation;
1964
+ }
1965
+ return current.state.sidebarEntry === true ? "both" : "settings";
1963
1966
  }
1964
- async function setSidebarEntry(enabled) {
1965
- if (typeof enabled !== "boolean") {
1966
- throw codedError("sidebarEntry must be a boolean", "error.proto.invalidParams");
1967
+ async function setEntryLocation(location) {
1968
+ if (location !== "both" && location !== "sidebar" && location !== "settings") {
1969
+ throw codedError("entryLocation must be one of 'both', 'sidebar', or 'settings'", "error.proto.invalidParams");
1967
1970
  }
1968
1971
  const current = await readManagerState();
1969
1972
  if (current.writable === false) {
1970
1973
  throw codedError("manager state file is read-only", "error.state.invalid");
1971
1974
  }
1972
- current.state.sidebarEntry = enabled;
1975
+ current.state.entryLocation = location;
1976
+ current.state.sidebarEntry = location !== "settings";
1973
1977
  await writeManagerState(current.state);
1978
+ return location;
1979
+ }
1980
+ async function getSidebarEntry() {
1981
+ const location = await getEntryLocation();
1982
+ return location !== "settings";
1983
+ }
1984
+ async function setSidebarEntry(enabled) {
1985
+ if (typeof enabled !== "boolean") {
1986
+ throw codedError("sidebarEntry must be a boolean", "error.proto.invalidParams");
1987
+ }
1988
+ await setEntryLocation(enabled ? "both" : "settings");
1974
1989
  return enabled;
1975
1990
  }
1976
1991
  async function getOnlineUpdate() {
@@ -3701,6 +3716,7 @@ export {
3701
3716
  deleteCategory,
3702
3717
  deleteSkill,
3703
3718
  entryPath,
3719
+ getEntryLocation,
3704
3720
  getOnlineUpdate,
3705
3721
  getProviderSkill,
3706
3722
  getSidebarEntry,
@@ -3735,6 +3751,7 @@ export {
3735
3751
  scanCustomSourceCandidates,
3736
3752
  scanEntries,
3737
3753
  setCategoryEnabled,
3754
+ setEntryLocation,
3738
3755
  setOnlineUpdate,
3739
3756
  setRootPath,
3740
3757
  setSidebarEntry,
package/lib/index.js CHANGED
@@ -28,7 +28,9 @@ import {
28
28
  listWorkspaces,
29
29
  workspaceSkills,
30
30
  logPath,
31
+ getEntryLocation,
31
32
  getSidebarEntry,
33
+ setEntryLocation,
32
34
  setSidebarEntry,
33
35
  getOnlineUpdate,
34
36
  setOnlineUpdate
@@ -371,14 +373,27 @@ function apply(ctx, config) {
371
373
  methods: ["GET", "HEAD", "POST"],
372
374
  fetch: (req) => {
373
375
  if (req.method === "GET" || req.method === "HEAD") {
374
- return runFetch(async () => ({ enabled: await getSidebarEntry() }), void 0, req.method === "HEAD");
376
+ return runFetch(async () => {
377
+ const location = await getEntryLocation();
378
+ return { ok: true, location, enabled: location !== "settings" };
379
+ }, void 0, req.method === "HEAD");
375
380
  }
376
381
  return handlePost(req, async (b) => {
377
- if (!b || typeof b.enabled !== "boolean") {
378
- throw Object.assign(new Error("enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C"), { statusCode: 400, code: "error.proto.invalidParams" });
382
+ if (!b) {
383
+ throw Object.assign(new Error("\u8BF7\u6C42\u4F53\u4E0D\u80FD\u4E3A\u7A7A"), { statusCode: 400, code: "error.proto.invalidParams" });
379
384
  }
380
- const enabled = await setSidebarEntry(b.enabled);
381
- return { enabled };
385
+ if (typeof b.location === "string") {
386
+ if (b.location !== "both" && b.location !== "sidebar" && b.location !== "settings") {
387
+ throw Object.assign(new Error("location \u5FC5\u987B\u662F both\u3001sidebar \u6216 settings"), { statusCode: 400, code: "error.proto.invalidParams" });
388
+ }
389
+ const location = await setEntryLocation(b.location);
390
+ return { ok: true, location, enabled: location !== "settings" };
391
+ }
392
+ if (typeof b.enabled === "boolean") {
393
+ const location = await setEntryLocation(b.enabled ? "both" : "settings");
394
+ return { ok: true, location, enabled: location !== "settings" };
395
+ }
396
+ throw Object.assign(new Error("\u7F3A\u5C11\u5408\u6CD5\u7684 location \u6216 enabled \u53C2\u6570"), { statusCode: 400, code: "error.proto.invalidParams" });
382
397
  });
383
398
  }
384
399
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-skills-manager",
3
- "version": "1.2.26",
3
+ "version": "1.2.28",
4
4
  "description": "DSH Skills Manager — 在 DeepSeek Harness 中统一加载并安全管理本机 Agent Skills · Load and safely manage local Agent Skills in DSH",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {