@dsh-electron/dsh-plugin-multi-root-workspace 0.1.8 → 0.1.10

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.
Files changed (75) hide show
  1. package/CHANGELOG.en.md +22 -1
  2. package/CHANGELOG.md +22 -1
  3. package/README.en.md +39 -16
  4. package/README.md +47 -24
  5. package/cordis.patch.yml +10 -0
  6. package/lib/auto-review-packages-nRjnb4pU.js +15 -0
  7. package/lib/auto-review.js +166 -0
  8. package/lib/client.js +573 -131
  9. package/lib/client.js.map +1 -1
  10. package/lib/{command-CESuwlVt.js → command-BGdz7VBH.js} +68 -8
  11. package/lib/command.js +1 -1
  12. package/lib/{compat-DR2LvmYZ.js → compat-D-MljsPV.js} +13 -2
  13. package/lib/compat.js +1 -1
  14. package/lib/{contract-DZ4zczDT.js → contract-CStSEOcK.js} +44 -1
  15. package/lib/fork-CzbeWxHp.js +670 -0
  16. package/lib/fs.js +1 -1
  17. package/lib/index.js +9 -8
  18. package/lib/{instructions-D19jRxN0.js → instructions-MePoRigy.js} +213 -263
  19. package/lib/instructions.js +1 -1
  20. package/lib/llm-message-fYORacvh.js +206 -0
  21. package/lib/lsp.js +1 -1
  22. package/lib/metadata-DgqSdVX_.js +35 -0
  23. package/lib/{registry-DCxC5Lay.js → registry-KSsmU393.js} +66 -13
  24. package/lib/registry.js +1 -1
  25. package/lib/review-context-AH-SXHmj.js +98 -0
  26. package/lib/review-context.js +2 -0
  27. package/lib/{roots-B-0l8mNG.js → roots-Ca_W1S9n.js} +1 -1
  28. package/lib/{sandbox-CVAcT_gy.js → sandbox-CXk5h-ct.js} +3 -3
  29. package/lib/sandbox.js +1 -1
  30. package/lib/scope.js +15 -6
  31. package/lib/skills.js +790 -0
  32. package/lib/types/auto-review/entry.d.ts +5 -0
  33. package/lib/types/client/WorkspaceFoldersAction.d.ts +1 -1
  34. package/lib/types/client/locales.d.ts +26 -16
  35. package/lib/types/client/skills-client.d.ts +23 -0
  36. package/lib/types/client/skills-settings.d.ts +10 -0
  37. package/lib/types/client/skills.d.ts +36 -0
  38. package/lib/types/client/styles.d.ts +1 -1
  39. package/lib/types/command.d.ts +1 -1
  40. package/lib/types/compat/auto-review-contract.d.ts +3 -0
  41. package/lib/types/compat/auto-review-loader.d.ts +33 -0
  42. package/lib/types/compat/auto-review-packages.d.ts +1 -0
  43. package/lib/types/compat/client-session.d.ts +2 -0
  44. package/lib/types/compat/dsh-version.d.ts +5 -5
  45. package/lib/types/compat/instruction-activity.d.ts +17 -0
  46. package/lib/types/compat/review-session.d.ts +2 -0
  47. package/lib/types/compat/skill-content.d.ts +3 -0
  48. package/lib/types/compat/skills-client.d.ts +33 -0
  49. package/lib/types/compat/skills-settings.d.ts +8 -0
  50. package/lib/types/compat/skills.d.ts +13 -0
  51. package/lib/types/compat/storage-zod.d.ts +1 -0
  52. package/lib/types/contract.d.ts +12 -1
  53. package/lib/types/instructions.d.ts +18 -1
  54. package/lib/types/registry.d.ts +7 -0
  55. package/lib/types/review-context.d.ts +49 -0
  56. package/lib/types/roots.d.ts +4 -1
  57. package/lib/types/scope.d.ts +5 -0
  58. package/lib/types/skills/catalog.d.ts +34 -0
  59. package/lib/types/skills/invocation.d.ts +7 -0
  60. package/lib/types/skills/metadata.d.ts +13 -0
  61. package/lib/types/skills/pool.d.ts +19 -0
  62. package/lib/types/skills/reader.d.ts +3 -0
  63. package/lib/types/skills/routing.d.ts +2 -0
  64. package/lib/types/skills-contract.d.ts +39 -0
  65. package/lib/types/skills.d.ts +43 -0
  66. package/lib/windows-runner.js +2 -2
  67. package/lib/workspace-files.js +2 -2
  68. package/package.json +121 -68
  69. package/src/auto-review/FORK.md +26 -0
  70. package/src/auto-review/LICENSE +21 -0
  71. package/src/auto-review/README.en.md +22 -0
  72. package/src/auto-review/README.md +22 -0
  73. package/lib/{fs-Nlp2AiRX.js → fs-BTXySwSG.js} +1 -1
  74. package/lib/{registry-lease-win32-DTO6QpT9.js → registry-lease-win32-DVTq9d4D.js} +1 -1
  75. package/lib/{windows-runner-contract-CEfmZzu0.js → windows-runner-contract-B5R2K3mM.js} +1 -1
@@ -1,10 +1,10 @@
1
1
  import { t as effectiveDirectory } from "./session-directory-BLOstut1.js";
2
- import { r as canonicalPath$1 } from "./windows-runner-contract-CEfmZzu0.js";
3
- import { i as canonicalRoot, o as entryRootRef, p as resolveRootRef, r as availableRoots, t as RootValidationError } from "./roots-B-0l8mNG.js";
4
- import { i as parsePanelCall, r as effectiveRootAccess, t as PANEL_CHANNEL } from "./contract-DZ4zczDT.js";
5
- import "@deepseek-ai/cordis";
2
+ import { r as canonicalPath$1 } from "./windows-runner-contract-B5R2K3mM.js";
3
+ import { i as canonicalRoot, o as entryRootRef, p as resolveRootRef, r as availableRoots, t as RootValidationError } from "./roots-Ca_W1S9n.js";
4
+ import { c as skillsRequestSchema, i as parsePanelCall, r as effectiveRootAccess, s as SKILLS_ENDPOINTS, t as PANEL_CHANNEL } from "./contract-CStSEOcK.js";
6
5
  import { closeSync, lstatSync, openSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
7
6
  import { isAbsolute, join } from "node:path";
7
+ import "@deepseek-ai/cordis";
8
8
  import { canonicalPath } from "@deepseek-ai/dsh-sandbox";
9
9
  //#region src/profile-isolation.ts
10
10
  /**
@@ -682,6 +682,8 @@ function parseFoldersCommand(rawInput) {
682
682
  case "add":
683
683
  case "remove":
684
684
  case "alias":
685
+ case "alias-id":
686
+ case "skills":
685
687
  case "access":
686
688
  case "reveal":
687
689
  case "isolate-profiles":
@@ -723,7 +725,7 @@ function renderRootsReport(primaryRoot, statuses, unavailable, limit, mode) {
723
725
  for (const [index, status] of statuses.entries()) {
724
726
  const alias = status.alias === void 0 ? "" : ` [${status.alias}]`;
725
727
  const state = status.state === "available" ? "" : ` (${status.state}: ${status.detail ?? "unavailable"})`;
726
- lines.push(` ${index + 1} ${status.path}${alias} (${status.access})${state}`);
728
+ lines.push(` ${index + 1} ${status.path}${alias} (${status.access})${state}${typeof status.aliasId === "string" ? ` Skills: ${status.skillsEnabled === true ? "on" : "off"} /${status.aliasId}:` : ""}`);
727
729
  }
728
730
  const withheld = statuses.length - availableRoots(statuses).length;
729
731
  if (withheld > 0) lines.push(`${withheld} root(s) are registered but not writable right now; restore the directory and run /${COMMAND_NAME} list, or remove the entry.`);
@@ -744,7 +746,7 @@ function apply(ctx, config = {}) {
744
746
  ctx.commands.register({
745
747
  name: COMMAND_NAME,
746
748
  description: "List, add, remove, alias, or reveal the additional workspace roots of this session, or isolate DSH profile imports",
747
- input: { hint: "[list|add [path] [--inherit|--read-only|--read-write]|remove <n|path>|alias <n|path> [name]|access <n|path> <level>|reveal <n|path>|isolate-profiles [--apply]|help]" },
749
+ input: { hint: "[list|add [path] [--inherit|--read-only|--read-write]|remove <n|path>|alias <n|path> [name]|alias-id <n|path> <id>|skills <n|path> on|off|access <n|path> <level>|reveal <n|path>|isolate-profiles [--apply]|help]" },
748
750
  handler: async (invocation) => await runCommand(ctx, invocation, config)
749
751
  });
750
752
  ctx.inject(["connection", "webServer"], (connectionCtx) => {
@@ -753,7 +755,7 @@ function apply(ctx, config = {}) {
753
755
  ctx.logger.warn("multi-root: connection resolved without the service; the panel channel is not mounted");
754
756
  return;
755
757
  }
756
- const dispose = connection.rpc.handle(PANEL_CHANNEL, async (endpoint, payload) => await dispatchPanelRequest(ctx, endpoint, payload));
758
+ const dispose = connection.rpc.handle(PANEL_CHANNEL, async (endpoint, payload, signal) => await dispatchPanelRequest(ctx, endpoint, payload, signal));
757
759
  return () => {
758
760
  dispose();
759
761
  };
@@ -817,6 +819,20 @@ async function runCommand(ctx, invocation, config) {
817
819
  text: await report(registry, primaryRoot, policy.mode)
818
820
  };
819
821
  }
822
+ case "alias-id":
823
+ case "skills": {
824
+ const { text: reference, rest: value } = splitReference(parsed.rest);
825
+ const { ref } = await targetOf(registry, primaryRoot, reference);
826
+ if (parsed.verb === "alias-id") await registry.setAliasId(primaryRoot, ref, unquote(value));
827
+ else {
828
+ if (value !== "on" && value !== "off") throw new RootValidationError("invalid-ref", "skills requires on or off");
829
+ await registry.setSkillsEnabled(primaryRoot, ref, value === "on");
830
+ }
831
+ return {
832
+ kind: "success",
833
+ text: await report(registry, primaryRoot, policy.mode)
834
+ };
835
+ }
820
836
  case "access": {
821
837
  const { text: reference, rest: level } = splitReference(parsed.rest);
822
838
  const access = parseAccessLevel(level);
@@ -921,6 +937,8 @@ function helpText() {
921
937
  ` /${COMMAND_NAME} remove <n|path>`,
922
938
  ` /${COMMAND_NAME} alias <n|path> [name] (no name clears the alias)`,
923
939
  ` /${COMMAND_NAME} access <n|path> inherit|read-only|read-write`,
940
+ ` /${COMMAND_NAME} skills <n|path> on|off`,
941
+ ` /${COMMAND_NAME} alias-id <n|path> <kebab-case>`,
924
942
  ` /${COMMAND_NAME} reveal <n|path>`,
925
943
  ` /${COMMAND_NAME} isolate-profiles [--apply] (report or set packageImportMethod: copy for every profile under $DSH_HOME)`,
926
944
  "Roots are canonicalized before they are stored: `~` expands, and a duplicate, a nested directory,",
@@ -1067,6 +1085,8 @@ function toRootView(status, index) {
1067
1085
  ordinal: index + 1,
1068
1086
  id: status.id,
1069
1087
  path: status.path,
1088
+ ...typeof status.aliasId === "string" ? { aliasId: status.aliasId } : {},
1089
+ skillsEnabled: status.skillsEnabled === true,
1070
1090
  ...status.alias === void 0 ? {} : { alias: status.alias },
1071
1091
  addedAt: status.addedAt,
1072
1092
  state: status.state,
@@ -1139,8 +1159,34 @@ async function rootsViewOf(ctx, registry, primaryRoot, request) {
1139
1159
  * A malformed request is reported as `panel/bad-request` rather than throwing
1140
1160
  * through the channel.
1141
1161
  */
1142
- async function dispatchPanelRequest(ctx, endpoint, payload) {
1162
+ async function dispatchPanelRequest(ctx, endpoint, payload, signal) {
1143
1163
  try {
1164
+ if (SKILLS_ENDPOINTS.includes(endpoint)) {
1165
+ const parsedSkills = skillsRequestSchema.safeParse(payload);
1166
+ if (!parsedSkills.success) return {
1167
+ ok: false,
1168
+ error: {
1169
+ code: "panel/bad-request",
1170
+ message: "invalid Skills request",
1171
+ details: {}
1172
+ }
1173
+ };
1174
+ const request = parsedSkills.data;
1175
+ if (endpoint === "skillsPreview" && request.name === void 0 || endpoint === "skillsChanges" && request.generation === void 0) return {
1176
+ ok: false,
1177
+ error: {
1178
+ code: "panel/bad-request",
1179
+ message: "missing Skills request field",
1180
+ details: {}
1181
+ }
1182
+ };
1183
+ const skills = ctx.get("multiRootSkills");
1184
+ if (skills === void 0) throw new Error("multi-root skills: service is unavailable");
1185
+ return {
1186
+ ok: true,
1187
+ value: endpoint === "skillsList" ? await skills.listSession(request.sessionId, signal) : endpoint === "skillsPreview" ? await skills.previewSession(request.sessionId, request.name ?? "", signal) : await skills.changes(request.sessionId, request.generation ?? -1, signal)
1188
+ };
1189
+ }
1144
1190
  const parsed = parsePanelCall(endpoint, payload);
1145
1191
  if (!parsed.ok) return {
1146
1192
  ok: false,
@@ -1169,6 +1215,20 @@ async function dispatchPanelRequest(ctx, endpoint, payload) {
1169
1215
  ok: true,
1170
1216
  value: await rootsViewOf(ctx, registry, primaryRoot, request)
1171
1217
  };
1218
+ case "setSkillsEnabled":
1219
+ if (request.skillsEnabled === void 0) throw new RootValidationError("invalid-ref", "skillsEnabled is required");
1220
+ await registry.setSkillsEnabled(primaryRoot, requireEntry(request), request.skillsEnabled);
1221
+ return {
1222
+ ok: true,
1223
+ value: await rootsViewOf(ctx, registry, primaryRoot, request)
1224
+ };
1225
+ case "setAliasId":
1226
+ if (request.aliasId === void 0) throw new RootValidationError("invalid-alias-id", "aliasId is required");
1227
+ await registry.setAliasId(primaryRoot, requireEntry(request), request.aliasId);
1228
+ return {
1229
+ ok: true,
1230
+ value: await rootsViewOf(ctx, registry, primaryRoot, request)
1231
+ };
1172
1232
  case "setAccess":
1173
1233
  if (request.access === void 0) throw new RootValidationError("invalid-ref", "an access level is required");
1174
1234
  await registry.setAccess(primaryRoot, requireEntry(request), request.access);
package/lib/command.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as renderRootsReport, c as revealArgv, i as parseFoldersCommand, n as apply, o as resolvePanelPrimaryRoot, r as inject, s as revealAccepted, t as COMMAND_NAME } from "./command-CESuwlVt.js";
1
+ import { a as renderRootsReport, c as revealArgv, i as parseFoldersCommand, n as apply, o as resolvePanelPrimaryRoot, r as inject, s as revealAccepted, t as COMMAND_NAME } from "./command-BGdz7VBH.js";
2
2
  export { COMMAND_NAME, apply, inject, parseFoldersCommand, renderRootsReport, resolvePanelPrimaryRoot, revealAccepted, revealArgv };
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
- import { Service } from "@deepseek-ai/cordis";
3
2
  import { existsSync, readFileSync, readdirSync } from "node:fs";
4
3
  import { dirname, join, sep } from "node:path";
4
+ import { Service } from "@deepseek-ai/cordis";
5
5
  import { fileURLToPath } from "node:url";
6
6
  //#region src/compat/dsh-version.ts
7
7
  /**
@@ -50,7 +50,8 @@ const SUPPORTED_DSH_RELEASES = [
50
50
  "0.2.1-alpha.4",
51
51
  "0.2.1-alpha.5",
52
52
  "0.2.1-rc.1",
53
- "0.2.1-rc.2"
53
+ "0.2.1-rc.2",
54
+ "0.2.1-rc.3"
54
55
  ];
55
56
  /**
56
57
  * Packages whose absence means this plugin cannot function at all: every one of
@@ -71,6 +72,11 @@ const REQUIRED_CORE_PACKAGES = [
71
72
  * that is the mixed-installation failure this contract exists to catch.
72
73
  */
73
74
  const OPTIONAL_CORE_PACKAGES = [
75
+ "@deepseek-ai/dsh-skill",
76
+ "@deepseek-ai/dsh-skill-filesystem",
77
+ "@deepseek-ai/dsh-settings",
78
+ "@deepseek-ai/dsh-api-session-controller",
79
+ "@deepseek-ai/dsh-session-query",
74
80
  "@deepseek-ai/dsh-tools",
75
81
  "@deepseek-ai/dsh-working-directory",
76
82
  "@deepseek-ai/dsh-lsp",
@@ -95,6 +101,8 @@ const OPTIONAL_CORE_PACKAGES = [
95
101
  * that disagrees with the host is a real mixed installation, not a phantom.
96
102
  */
97
103
  const RUNTIME_OPTIONAL_PACKAGES = [
104
+ "@deepseek-ai/dsh-skill",
105
+ "@deepseek-ai/dsh-skill-filesystem",
98
106
  "@deepseek-ai/dsh-agent-instructions",
99
107
  "@deepseek-ai/dsh-llm",
100
108
  "@deepseek-ai/dsh-session",
@@ -114,6 +122,9 @@ const RUNTIME_OPTIONAL_PACKAGES = [
114
122
  * uniformly `0.2.0-rc.2` installation).
115
123
  */
116
124
  const HOST_SERVICE_PACKAGES = [
125
+ "@deepseek-ai/dsh-settings",
126
+ "@deepseek-ai/dsh-api-session-controller",
127
+ "@deepseek-ai/dsh-session-query",
117
128
  "@deepseek-ai/dsh-agent",
118
129
  "@deepseek-ai/dsh-api-workspace-files",
119
130
  "@deepseek-ai/dsh-client-connection",
package/lib/compat.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as inject, i as assertSupportedInstallation, n as MultiRootCompatService, r as apply, t as DshCompatUnsupportedError } from "./compat-DR2LvmYZ.js";
1
+ import { a as inject, i as assertSupportedInstallation, n as MultiRootCompatService, r as apply, t as DshCompatUnsupportedError } from "./compat-D-MljsPV.js";
2
2
  export { DshCompatUnsupportedError, MultiRootCompatService, apply, assertSupportedInstallation, inject };
@@ -1,4 +1,37 @@
1
1
  import { z } from "zod";
2
+ //#region src/skills-contract.ts
3
+ /** Browser-safe Skills wire shapes. Session IDs select authority; clients never send paths. */
4
+ const SKILLS_ENDPOINTS = [
5
+ "skillsList",
6
+ "skillsPreview",
7
+ "skillsChanges"
8
+ ];
9
+ const nameSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/);
10
+ const skillsRequestSchema = z.object({
11
+ sessionId: z.string().min(1),
12
+ name: nameSchema.optional(),
13
+ generation: z.number().int().nonnegative().optional()
14
+ }).strict();
15
+ const status = {
16
+ sessionId: z.string(),
17
+ generation: z.number().int().nonnegative(),
18
+ enabled: z.boolean()
19
+ };
20
+ z.object(status);
21
+ z.object({
22
+ ...status,
23
+ skills: z.array(z.object({
24
+ name: nameSchema,
25
+ description: z.string(),
26
+ modelInvocable: z.boolean()
27
+ }))
28
+ });
29
+ z.object({
30
+ ...status,
31
+ name: nameSchema,
32
+ content: z.string()
33
+ });
34
+ //#endregion
2
35
  //#region src/contract.ts
3
36
  /**
4
37
  * The wire contract between the browser panel and this plugin's host half.
@@ -40,6 +73,8 @@ const PANEL_ENDPOINTS = [
40
73
  "alias",
41
74
  "move",
42
75
  "setAccess",
76
+ "setSkillsEnabled",
77
+ "setAliasId",
43
78
  "reveal"
44
79
  ];
45
80
  /** The shared nine-cell rule; tool dispatch may subsequently narrow writes. */
@@ -65,6 +100,8 @@ const panelRequestSchema = z.object({
65
100
  }).strict().optional(),
66
101
  id: z.string().optional(),
67
102
  path: z.string().optional(),
103
+ aliasId: z.string().optional(),
104
+ skillsEnabled: z.boolean().optional(),
68
105
  alias: z.string().optional(),
69
106
  access: z.enum([
70
107
  "inherit",
@@ -88,6 +125,8 @@ const rootViewSchema = z.object({
88
125
  ordinal: z.number().int().positive(),
89
126
  id: z.string(),
90
127
  path: z.string(),
128
+ aliasId: z.string().optional(),
129
+ skillsEnabled: z.boolean().optional(),
91
130
  alias: z.string().optional(),
92
131
  addedAt: z.string(),
93
132
  state: z.enum([
@@ -208,6 +247,8 @@ function narrowCall(endpoint, value) {
208
247
  ...value.entry === void 0 ? {} : { entry: value.entry },
209
248
  ...value.id === void 0 ? {} : { id: value.id },
210
249
  ...value.path === void 0 ? {} : { path: value.path },
250
+ ...value.aliasId === void 0 ? {} : { aliasId: value.aliasId },
251
+ ...value.skillsEnabled === void 0 ? {} : { skillsEnabled: value.skillsEnabled },
211
252
  ...value.alias === void 0 ? {} : { alias: value.alias },
212
253
  ...value.access === void 0 ? {} : { access: value.access },
213
254
  ...value.beforeEntry === void 0 ? {} : { beforeEntry: value.beforeEntry },
@@ -224,6 +265,8 @@ function narrowRootView(value) {
224
265
  state: value.state,
225
266
  access: value.access ?? "inherit",
226
267
  ...value.effectiveAccess === void 0 ? {} : { effectiveAccess: value.effectiveAccess },
268
+ ...value.aliasId === void 0 ? {} : { aliasId: value.aliasId },
269
+ ...value.skillsEnabled === void 0 ? {} : { skillsEnabled: value.skillsEnabled },
227
270
  ...value.alias === void 0 ? {} : { alias: value.alias },
228
271
  ...value.detail === void 0 ? {} : { detail: value.detail }
229
272
  };
@@ -235,4 +278,4 @@ function firstIssue(error) {
235
278
  return `${issue.path.length === 0 ? "" : `${issue.path.join(".")}: `}${issue.message}`;
236
279
  }
237
280
  //#endregion
238
- export { parseRevealedView as a, parsePanelCall as i, PANEL_ENDPOINTS as n, parseRootsView as o, effectiveRootAccess as r, PANEL_CHANNEL as t };
281
+ export { parseRevealedView as a, skillsRequestSchema as c, parsePanelCall as i, PANEL_ENDPOINTS as n, parseRootsView as o, effectiveRootAccess as r, SKILLS_ENDPOINTS as s, PANEL_CHANNEL as t };