@dsh-electron/dsh-plugin-multi-root-workspace 0.1.13 → 0.1.15

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 (84) hide show
  1. package/CHANGELOG.en.md +36 -1
  2. package/CHANGELOG.md +36 -1
  3. package/README.en.md +27 -10
  4. package/README.md +27 -10
  5. package/cordis.patch.yml +5 -1
  6. package/detail/DETAIL.en.md +1 -0
  7. package/detail/DETAIL.md +1 -0
  8. package/detail/preview.svg +1 -0
  9. package/detail/preview.zh.svg +1 -0
  10. package/lib/{llm-message-fYORacvh.js → agent-instructions-BXuKhOzr.js} +1 -84
  11. package/lib/auto-review.js +2 -2
  12. package/lib/client.js +584 -73
  13. package/lib/client.js.map +1 -1
  14. package/lib/{command-B9855H7y.js → command-y5tfcAeC.js} +45 -12
  15. package/lib/command.js +1 -1
  16. package/lib/compat-CTJbpCxu.js +267 -0
  17. package/lib/compat.js +1 -1
  18. package/lib/{dialects-Dr4rDR-H.js → dialects-CdlG3RF9.js} +1 -1
  19. package/lib/{compat-Bg2HFVMX.js → dsh-version-DCwF7REk.js} +5 -265
  20. package/lib/{fs-CfzJq2wd.js → fs-Uws0ZpmV.js} +38 -0
  21. package/lib/fs.js +1 -1
  22. package/lib/index.js +11 -9
  23. package/lib/{instructions-KsUwUFE0.js → instructions-Ck9wp4J4.js} +695 -26
  24. package/lib/instructions.js +1 -1
  25. package/lib/llm-message-CepyzEBQ.js +84 -0
  26. package/lib/lsp.js +3 -3
  27. package/lib/{metadata-DgqSdVX_.js → metadata-99jgViHQ.js} +1 -1
  28. package/lib/{method-wrapper-CFY3p3j2.js → method-wrapper-D4oUCsEF.js} +22 -2
  29. package/lib/{native-win32-2waCRkPI.js → native-win32-C5oMtt7f.js} +2 -1
  30. package/lib/ops-compatibility.js +58 -0
  31. package/lib/ops-settings-UN2oOKEp.js +40 -0
  32. package/lib/ops-tools-k4JYaOrM.js +152 -0
  33. package/lib/process-fence.js +100 -24
  34. package/lib/{protocol-CJOvAvOS.js → protocol-CwDnFEyK.js} +54 -8
  35. package/lib/{registry-Bv431TfO.js → registry-DyDNDSJZ.js} +235 -79
  36. package/lib/{registry-lease-win32-DVTq9d4D.js → registry-lease-win32-r4puac9m.js} +2 -1
  37. package/lib/registry.js +2 -2
  38. package/lib/{review-context-NDpKeMCc.js → review-context-B-oHkU6a.js} +24 -7
  39. package/lib/review-context.js +1 -1
  40. package/lib/{roots-Ca_W1S9n.js → roots-CmaWxRVy.js} +112 -22
  41. package/lib/{sandbox-C-vCJCp3.js → sandbox-CZElTNPz.js} +1 -1
  42. package/lib/sandbox.js +1 -1
  43. package/lib/scope.js +72 -9
  44. package/lib/skills-utyuvmwr.js +104 -0
  45. package/lib/skills.js +4 -105
  46. package/lib/{tool-context-CpgIFcCB.js → tool-context-CCeY3mrK.js} +1 -1
  47. package/lib/types/authority/protocol.d.ts +5 -1
  48. package/lib/types/client/RootSwitcher.d.ts +2 -0
  49. package/lib/types/client/auto-review-settings.d.ts +18 -0
  50. package/lib/types/client/files-tree/FilesTree.d.ts +4 -1
  51. package/lib/types/client/files-tree/locales.d.ts +1 -1
  52. package/lib/types/client/locales.d.ts +40 -0
  53. package/lib/types/client/open-in-app/locales.d.ts +1 -1
  54. package/lib/types/client/ops-settings.d.ts +6 -0
  55. package/lib/types/client/skills-settings.d.ts +13 -0
  56. package/lib/types/client/styles.d.ts +1 -1
  57. package/lib/types/command.d.ts +3 -3
  58. package/lib/types/compat/auto-review-client.d.ts +58 -0
  59. package/lib/types/compat/connection-rpc.d.ts +12 -0
  60. package/lib/types/compat/dsh-version.d.ts +1 -1
  61. package/lib/types/compat/files-tree.d.ts +36 -0
  62. package/lib/types/compat/fs-patch.d.ts +6 -0
  63. package/lib/types/compat/instruction-activity.d.ts +32 -1
  64. package/lib/types/compat/koffi.d.ts +2 -0
  65. package/lib/types/compat/ops-confirmation.d.ts +17 -0
  66. package/lib/types/compat/ops-settings.d.ts +11 -0
  67. package/lib/types/compat/ops-tools.d.ts +25 -0
  68. package/lib/types/compat/skills-client.d.ts +1 -0
  69. package/lib/types/compat/tool-context.d.ts +4 -0
  70. package/lib/types/compat.d.ts +2 -2
  71. package/lib/types/fs.d.ts +3 -1
  72. package/lib/types/instructions.d.ts +6 -1
  73. package/lib/types/ops-compatibility.d.ts +34 -0
  74. package/lib/types/registry.d.ts +67 -8
  75. package/lib/types/review-context.d.ts +2 -0
  76. package/lib/types/roots.d.ts +114 -20
  77. package/lib/types/scope.d.ts +28 -2
  78. package/lib/workspace-files.js +3 -3
  79. package/lib/{workspace-routing-YPxaQ4V3.js → workspace-routing-D_qwMUh-.js} +4 -4
  80. package/locale/en.json +7 -0
  81. package/locale/zh.json +7 -0
  82. package/package.json +93 -82
  83. package/src/auto-review/README.en.md +1 -1
  84. package/src/auto-review/README.md +1 -1
@@ -1,8 +1,50 @@
1
+ import { createRequire } from "node:module";
1
2
  import { closeSync, lstatSync, mkdirSync, readFileSync, realpathSync, statSync, unlinkSync } from "node:fs";
2
3
  import { createHash, randomUUID } from "node:crypto";
3
- import { join } from "node:path";
4
+ import { dirname, join } from "node:path";
5
+ import { pathToFileURL } from "node:url";
4
6
  import { z } from "zod";
5
7
  import { Socket } from "node:net";
8
+ //#region src/compat/koffi.ts
9
+ /**
10
+ * Koffi must be the host's own copy, not this package's `dependencies` entry:
11
+ * `dsh plugin add` installs a private koffi beside the one the host already
12
+ * loaded, and two `koffi.node` images in one process SIGBUS on darwin-arm64
13
+ * pointer authentication (packed-install smoke, 2026-11-01). `dsh-fs-local`
14
+ * carries koffi on every supported release, so anchoring at it yields the
15
+ * single binary the host itself loaded.
16
+ *
17
+ * Two ways to reach that same binary, in order:
18
+ * 1. `require('koffi')` from the host anchor — the live CJS `module.exports`.
19
+ * The host occasionally exposes a partial `{}` exports object for koffi's
20
+ * CJS entry (mid-evaluation or an intercepted require in the addon loader),
21
+ * so the result is validated instead of trusted.
22
+ * 2. The host koffi's own ESM entry (`index.js` beside the resolved CJS
23
+ * entry) — a separate module instance over the same `koffi.node`, immune
24
+ * to a broken CJS cache entry and never a second native image.
25
+ * Only when no host tree resolves at all does the package-local copy load.
26
+ */
27
+ const pick = (candidate) => {
28
+ let cur = candidate;
29
+ for (let i = 0; i < 3; i++) {
30
+ if (typeof cur?.load === "function") return cur;
31
+ cur = cur?.default;
32
+ }
33
+ };
34
+ async function loadHostKoffi() {
35
+ try {
36
+ const anchor = createRequire(import.meta.url).resolve("@deepseek-ai/dsh-fs-local/package.json");
37
+ const hostRequire = createRequire(anchor);
38
+ const cjs = pick(hostRequire("koffi"));
39
+ if (cjs !== void 0) return cjs;
40
+ const esm = pick(await import(pathToFileURL(join(dirname(hostRequire.resolve("koffi")), "index.js")).href));
41
+ if (esm !== void 0) return esm;
42
+ } catch {}
43
+ const own = pick(await import("koffi"));
44
+ if (own !== void 0) return own;
45
+ return (await import("koffi")).default;
46
+ }
47
+ //#endregion
6
48
  //#region src/authority/native.ts
7
49
  /** Kernel-authenticated local IPC. No credential file and no inherited capability. */
8
50
  function storeIdentity(root) {
@@ -34,7 +76,7 @@ function storeIdentity(root) {
34
76
  }
35
77
  let posixPromise;
36
78
  async function loadPosix() {
37
- const koffi = (await import("koffi")).default;
79
+ const koffi = await loadHostKoffi();
38
80
  const libc = koffi.load(process.platform === "darwin" ? "/usr/lib/libSystem.B.dylib" : "libc.so.6");
39
81
  const bind = (name, ret, args) => libc.func(name, ret, args);
40
82
  const socketpair = bind("socketpair", "int", [
@@ -170,7 +212,7 @@ function posix$1() {
170
212
  return posixPromise ??= loadPosix();
171
213
  }
172
214
  async function connectNative(endpoint) {
173
- if (process.platform === "win32") return (await import("./native-win32-2waCRkPI.js")).connectWindows(endpoint);
215
+ if (process.platform === "win32") return (await import("./native-win32-C5oMtt7f.js")).connectWindows(endpoint);
174
216
  const api = await posix$1(), address = api.address(endpoint), fd = api.open();
175
217
  if (api.connect(fd, address, address.length) !== 0) {
176
218
  closeSync(fd);
@@ -180,7 +222,7 @@ async function connectNative(endpoint) {
180
222
  }
181
223
  /** Called only by the kernel lease holder. Never removes another epoch's socket. */
182
224
  async function listenNative(endpoint, accepted) {
183
- if (process.platform === "win32") return (await import("./native-win32-2waCRkPI.js")).listenWindows(endpoint, accepted);
225
+ if (process.platform === "win32") return (await import("./native-win32-C5oMtt7f.js")).listenWindows(endpoint, accepted);
184
226
  const api = await posix$1(), address = api.address(endpoint), fd = api.open();
185
227
  try {
186
228
  unlinkSync(endpoint);
@@ -222,14 +264,14 @@ async function listenNative(endpoint, accepted) {
222
264
  }
223
265
  /** Capability probe for native tests and diagnostics; not an authorization bypass. */
224
266
  async function nativeHostAvailability() {
225
- if (process.platform === "win32") return (await import("./native-win32-2waCRkPI.js")).windowsHostAvailability();
267
+ if (process.platform === "win32") return (await import("./native-win32-C5oMtt7f.js")).windowsHostAvailability();
226
268
  if (process.platform === "linux") {
227
269
  if (!/^NoNewPrivs:\s+0$/m.test(readFileSync("/proc/self/status", "utf8"))) return {
228
270
  available: false,
229
271
  reason: "the Host itself has NoNewPrivs; shared IPC refuses restricted peers"
230
272
  };
231
273
  } else if (process.platform === "darwin") {
232
- if ((await import("koffi")).default.load("/usr/lib/libsandbox.dylib").func("int sandbox_check(int pid, const char *operation, int filter)")(process.pid, null, 0) !== 0) return {
274
+ if ((await loadHostKoffi()).load("/usr/lib/libsandbox.dylib").func("int sandbox_check(int pid, const char *operation, int filter)")(process.pid, null, 0) !== 0) return {
233
275
  available: false,
234
276
  reason: "the Host itself is sandboxed; shared IPC refuses sandboxed peers"
235
277
  };
@@ -303,7 +345,11 @@ const rootSchema = z.object({
303
345
  "invalid"
304
346
  ]),
305
347
  detail: z.string().optional(),
306
- invalidReason: z.literal("membership-conflict").optional()
348
+ invalidReason: z.enum([
349
+ "membership-conflict",
350
+ "protected-path",
351
+ "primary-overlap"
352
+ ]).optional()
307
353
  }).strict();
308
354
  const snapshotSchema = z.object({
309
355
  protocol: z.literal(1),
@@ -649,4 +695,4 @@ function parseArguments(method, args) {
649
695
  return argumentSchemas[method].parse(args);
650
696
  }
651
697
  //#endregion
652
- export { snapshotSchema as a, parseArguments as i, AuthorityRpcError as n, nativeHostAvailability as o, AuthorityServer as r, storeIdentity as s, AuthorityClient as t };
698
+ export { snapshotSchema as a, loadHostKoffi as c, parseArguments as i, AuthorityRpcError as n, nativeHostAvailability as o, AuthorityServer as r, storeIdentity as s, AuthorityClient as t };