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

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 (52) hide show
  1. package/CHANGELOG.en.md +25 -1
  2. package/CHANGELOG.md +25 -1
  3. package/README.en.md +10 -8
  4. package/README.md +10 -8
  5. package/cordis.patch.yml +7 -2
  6. package/lib/auto-review.js +1 -1
  7. package/lib/client.js +197 -74
  8. package/lib/client.js.map +1 -1
  9. package/lib/{command-BGdz7VBH.js → command-B9855H7y.js} +3 -2
  10. package/lib/command.js +1 -1
  11. package/lib/{compat-BiW-m_q0.js → compat-Bg2HFVMX.js} +3 -0
  12. package/lib/compat.js +1 -1
  13. package/lib/{sandbox-CXk5h-ct.js → dialects-Dr4rDR-H.js} +6 -264
  14. package/lib/{fs-BTXySwSG.js → fs-CfzJq2wd.js} +23 -8
  15. package/lib/fs.js +1 -1
  16. package/lib/index.js +7 -6
  17. package/lib/{instructions-MePoRigy.js → instructions-KsUwUFE0.js} +53 -37
  18. package/lib/instructions.js +1 -1
  19. package/lib/lsp.js +19 -16
  20. package/lib/native-win32-2waCRkPI.js +312 -0
  21. package/lib/process-fence.js +62 -12
  22. package/lib/protocol-CJOvAvOS.js +652 -0
  23. package/lib/{registry-KSsmU393.js → registry-Bv431TfO.js} +717 -74
  24. package/lib/registry-operation-C2ZV3Jhw.js +116 -0
  25. package/lib/registry.js +3 -2
  26. package/lib/{review-context-AH-SXHmj.js → review-context-NDpKeMCc.js} +1 -1
  27. package/lib/review-context.js +1 -1
  28. package/lib/sandbox-C-vCJCp3.js +278 -0
  29. package/lib/sandbox.js +1 -1
  30. package/lib/scope.js +101 -11
  31. package/lib/skills.js +48 -29
  32. package/lib/types/authority/native-win32.d.ts +7 -0
  33. package/lib/types/authority/native.d.ts +23 -0
  34. package/lib/types/authority/protocol.d.ts +70 -0
  35. package/lib/types/authority/recovery.d.ts +58 -0
  36. package/lib/types/client/RootSwitcher.d.ts +6 -3
  37. package/lib/types/client/files-tree/adapter.d.ts +63 -1
  38. package/lib/types/compat/authority-storage.d.ts +6 -0
  39. package/lib/types/compat/dsh-version.d.ts +4 -4
  40. package/lib/types/compat/open-in-app-device.d.ts +1 -1
  41. package/lib/types/compat/process-entrypoints.d.ts +2 -0
  42. package/lib/types/compat/process-profile.d.ts +3 -0
  43. package/lib/types/compat/sandbox-confine.d.ts +2 -0
  44. package/lib/types/fs.d.ts +4 -1
  45. package/lib/types/instructions.d.ts +0 -47
  46. package/lib/types/registry-operation.d.ts +31 -0
  47. package/lib/types/registry.d.ts +145 -6
  48. package/lib/types/scope.d.ts +28 -0
  49. package/lib/types/skills/catalog.d.ts +3 -0
  50. package/lib/types/skills/pool.d.ts +1 -1
  51. package/lib/workspace-files.js +63 -7
  52. package/package.json +38 -31
package/lib/client.js CHANGED
@@ -40,8 +40,8 @@ window.__ModuleLoader__.load({
40
40
  _deepseek_ai_dsh_client_ui_primitives = __toESM(_deepseek_ai_dsh_client_ui_primitives, 1);
41
41
  let react_jsx_runtime = require("react/jsx-runtime");
42
42
  let react_dom = require("react-dom");
43
- require("@deepseek-ai/cordis");
44
43
  let _deepseek_ai_dsh_client_store = require("@deepseek-ai/dsh-client-store");
44
+ require("@deepseek-ai/cordis");
45
45
  //#region src/compat/client-session.ts
46
46
  /**
47
47
  * The session the composed client is showing, when it can name one.
@@ -123,7 +123,7 @@ window.__ModuleLoader__.load({
123
123
  return typeof count === "number" && count > 0;
124
124
  }
125
125
  //#endregion
126
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/util.js
126
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.js
127
127
  function getEnumValues(entries) {
128
128
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
129
129
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -430,6 +430,17 @@ window.__ModuleLoader__.load({
430
430
  function unwrapMessage(message) {
431
431
  return typeof message === "string" ? message : message?.message;
432
432
  }
433
+ /** The leading size checks of `defChecks` that set an upper bound, each paired with it. */
434
+ function sizeCaps(defChecks) {
435
+ const caps = [];
436
+ for (const ch of defChecks ?? []) {
437
+ const d = ch._zod.def;
438
+ if (!/_(length|size)$|_equals$/.test(d.check)) break;
439
+ const max = d.maximum ?? d.length ?? d.size;
440
+ if (max >= 0) caps.push([max, ch]);
441
+ }
442
+ return caps;
443
+ }
433
444
  function attachSchema(issues, start, inst) {
434
445
  var _a;
435
446
  for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
@@ -506,7 +517,6 @@ window.__ModuleLoader__.load({
506
517
  });
507
518
  else defineBound(proto, key, desc.value);
508
519
  }
509
- for (const sym of Object.getOwnPropertySymbols(table)) defineBound(proto, sym, table[sym]);
510
520
  }
511
521
  /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
512
522
  function own(inst, key, value, enumerable = true) {
@@ -647,7 +657,7 @@ window.__ModuleLoader__.load({
647
657
  return fn;
648
658
  }
649
659
  //#endregion
650
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/core.js
660
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.js
651
661
  var _a$1;
652
662
  const _zodDesc = {
653
663
  value: void 0,
@@ -692,8 +702,7 @@ window.__ModuleLoader__.load({
692
702
  } finally {
693
703
  _zodDesc.value = void 0;
694
704
  }
695
- }
696
- if (inst._zod.traits.has(name)) return;
705
+ } else if (inst._zod.traits.has(name)) return;
697
706
  inst._zod.traits.add(name);
698
707
  initializer(inst, def);
699
708
  if (initialized) {
@@ -754,7 +763,7 @@ window.__ModuleLoader__.load({
754
763
  return globalConfig;
755
764
  }
756
765
  //#endregion
757
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/errors.js
766
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/errors.js
758
767
  function _getMessage() {
759
768
  const internals = this._zod;
760
769
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -870,7 +879,7 @@ window.__ModuleLoader__.load({
870
879
  return fieldErrors;
871
880
  }
872
881
  //#endregion
873
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/parse.js
882
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/parse.js
874
883
  function finalizeParams(callee, params) {
875
884
  return {
876
885
  callee: params?.callee ?? callee,
@@ -1073,7 +1082,7 @@ window.__ModuleLoader__.load({
1073
1082
  return _safeParseAsync(_Err)(schema, value, _ctx);
1074
1083
  };
1075
1084
  //#endregion
1076
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/regexes.js
1085
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/regexes.js
1077
1086
  /**
1078
1087
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
1079
1088
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -1144,7 +1153,7 @@ window.__ModuleLoader__.load({
1144
1153
  const lowercase = /^[^A-Z]*$/;
1145
1154
  const uppercase = /^[^a-z]*$/;
1146
1155
  //#endregion
1147
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/checks.js
1156
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/checks.js
1148
1157
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
1149
1158
  var _a;
1150
1159
  inst._zod ?? (inst._zod = {});
@@ -1440,7 +1449,7 @@ window.__ModuleLoader__.load({
1440
1449
  };
1441
1450
  });
1442
1451
  //#endregion
1443
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/doc.js
1452
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/doc.js
1444
1453
  var Doc = class {
1445
1454
  constructor(args = [], closed = {}) {
1446
1455
  this.content = [];
@@ -1474,14 +1483,14 @@ window.__ModuleLoader__.load({
1474
1483
  }
1475
1484
  };
1476
1485
  //#endregion
1477
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/versions.js
1486
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/versions.js
1478
1487
  const version = {
1479
1488
  major: 4,
1480
1489
  minor: 6,
1481
- patch: 2
1490
+ patch: 7
1482
1491
  };
1483
1492
  //#endregion
1484
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/schemas.js
1493
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/schemas.js
1485
1494
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1486
1495
  var _a;
1487
1496
  inst ?? (inst = {});
@@ -1641,10 +1650,27 @@ window.__ModuleLoader__.load({
1641
1650
  def.pattern ?? (def.pattern = email);
1642
1651
  $ZodStringFormat.init(inst, def);
1643
1652
  });
1644
- /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
1653
+ function canParseURL(input) {
1654
+ try {
1655
+ if (typeof URL !== "undefined" && typeof URL.canParse === "function") return URL.canParse(input);
1656
+ new URL(input);
1657
+ return true;
1658
+ } catch {
1659
+ return false;
1660
+ }
1661
+ }
1662
+ function validateURL(trimmed, def) {
1663
+ if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) return canParseURL(trimmed) || 2;
1664
+ return parseURLObject(trimmed, def);
1665
+ }
1666
+ /** Parses a URL while preserving the non-normalizing HTTP guard. */
1645
1667
  function parseURLObject(trimmed, def) {
1646
1668
  if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
1647
1669
  try {
1670
+ if (typeof URL !== "undefined") {
1671
+ const URLStatic = URL;
1672
+ if (typeof URLStatic.parse === "function") return URLStatic.parse(trimmed) ?? 2;
1673
+ }
1648
1674
  return new URL(trimmed);
1649
1675
  } catch {
1650
1676
  return 2;
@@ -1668,7 +1694,7 @@ window.__ModuleLoader__.load({
1668
1694
  inst._zod.check = (payload) => {
1669
1695
  try {
1670
1696
  const trimmed = payload.value.trim();
1671
- const url = parseURLObject(trimmed, def);
1697
+ const url = validateURL(trimmed, def);
1672
1698
  if (url === 1) {
1673
1699
  payload.issues.push({
1674
1700
  code: "invalid_format",
@@ -1690,6 +1716,10 @@ window.__ModuleLoader__.load({
1690
1716
  });
1691
1717
  return;
1692
1718
  }
1719
+ if (url === true) {
1720
+ payload.value = stripTabAndNewline(trimmed);
1721
+ return;
1722
+ }
1693
1723
  if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
1694
1724
  code: "invalid_format",
1695
1725
  format: "url",
@@ -1779,12 +1809,7 @@ window.__ModuleLoader__.load({
1779
1809
  const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
1780
1810
  function isValidIPv6(value) {
1781
1811
  if (!ipv6Alphabet.test(value)) return false;
1782
- try {
1783
- new URL(`http://[${value}]`);
1784
- return true;
1785
- } catch {
1786
- return false;
1787
- }
1812
+ return canParseURL(`http://[${value}]`);
1788
1813
  }
1789
1814
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1790
1815
  def.pattern ?? (def.pattern = ipv6);
@@ -1962,6 +1987,26 @@ window.__ModuleLoader__.load({
1962
1987
  return payload;
1963
1988
  };
1964
1989
  });
1990
+ function capSize(inst, size) {
1991
+ const caps = sizeCaps(inst._zod.def.checks);
1992
+ if (!caps.length) return;
1993
+ const cap = Math.min(...caps.map((c) => c[0]));
1994
+ const parse = inst._zod.parse;
1995
+ inst._zod.parse = (payload, ctx) => {
1996
+ const n = size(payload.value);
1997
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
1998
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) if (n > max && ch._zod.def.when(payload)) {
1999
+ const start = payload.issues.length;
2000
+ ch._zod.check(payload);
2001
+ payload.issues[start].continue = false;
2002
+ attachSchema(payload.issues, start, inst);
2003
+ return payload;
2004
+ }
2005
+ }
2006
+ return parse(payload, ctx);
2007
+ };
2008
+ }
2009
+ const arraySize = (input) => Array.isArray(input) ? input.length : -1;
1965
2010
  function handleArrayResult(result, final, index) {
1966
2011
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1967
2012
  final.value[index] = result.value;
@@ -1999,6 +2044,7 @@ window.__ModuleLoader__.load({
1999
2044
  if (proms.length) return Promise.all(proms).then(() => payload);
2000
2045
  return payload;
2001
2046
  };
2047
+ capSize(inst, arraySize);
2002
2048
  });
2003
2049
  function handlePropertyResult(result, final, key, input, optin, optout) {
2004
2050
  const isPresent = key in input;
@@ -2107,7 +2153,7 @@ window.__ModuleLoader__.load({
2107
2153
  }
2108
2154
  return propValues;
2109
2155
  });
2110
- const isObject$2 = isObject;
2156
+ const isObject$1 = isObject;
2111
2157
  const catchall = def.catchall;
2112
2158
  let value;
2113
2159
  const memo = globalConfig.memoizer;
@@ -2115,7 +2161,7 @@ window.__ModuleLoader__.load({
2115
2161
  inst._zod.parse = (payload, ctx) => {
2116
2162
  value ?? (value = _normalized.value);
2117
2163
  const input = payload.value;
2118
- if (!isObject$2(input)) {
2164
+ if (!isObject$1(input)) {
2119
2165
  payload.issues.push({
2120
2166
  expected: "object",
2121
2167
  code: "invalid_type",
@@ -2245,7 +2291,7 @@ window.__ModuleLoader__.load({
2245
2291
  return doc.compile();
2246
2292
  };
2247
2293
  let fastpass;
2248
- const isObject$1 = isObject;
2294
+ const isObject$2 = isObject;
2249
2295
  const jit = !globalConfig.jitless;
2250
2296
  const fastEnabled = jit && allowsEval.value;
2251
2297
  const catchall = def.catchall;
@@ -2253,7 +2299,7 @@ window.__ModuleLoader__.load({
2253
2299
  inst._zod.parse = (payload, ctx) => {
2254
2300
  value ?? (value = _normalized.value);
2255
2301
  const input = payload.value;
2256
- if (!isObject$1(input)) {
2302
+ if (!isObject$2(input)) {
2257
2303
  payload.issues.push({
2258
2304
  expected: "object",
2259
2305
  code: "invalid_type",
@@ -2683,7 +2729,7 @@ window.__ModuleLoader__.load({
2683
2729
  }
2684
2730
  }
2685
2731
  //#endregion
2686
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/memoizer.js
2732
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/memoizer.js
2687
2733
  var $ZodCyclicError = class extends Error {
2688
2734
  constructor() {
2689
2735
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -2694,7 +2740,7 @@ window.__ModuleLoader__.load({
2694
2740
  const STATE = "~memo";
2695
2741
  const NO_ISSUES = [];
2696
2742
  function isRef(value) {
2697
- return value !== null && (typeof value === "object" || typeof value === "function");
2743
+ return value !== null && typeof value === "object";
2698
2744
  }
2699
2745
  function cloneIssues(issues) {
2700
2746
  return issues.map((iss) => iss.path ? {
@@ -2741,9 +2787,6 @@ window.__ModuleLoader__.load({
2741
2787
  check(def.catchall);
2742
2788
  break;
2743
2789
  }
2744
- case "properties":
2745
- merge(shape(def.shape, false));
2746
- break;
2747
2790
  case "array":
2748
2791
  check(def.element);
2749
2792
  break;
@@ -2939,7 +2982,7 @@ window.__ModuleLoader__.load({
2939
2982
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
2940
2983
  }
2941
2984
  //#endregion
2942
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/locales/en.js
2985
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/en.js
2943
2986
  const error = () => {
2944
2987
  const Sizable = {
2945
2988
  string: {
@@ -2994,6 +3037,7 @@ window.__ModuleLoader__.load({
2994
3037
  base64url: "base64url-encoded string",
2995
3038
  json_string: "JSON string",
2996
3039
  e164: "E.164 number",
3040
+ currency_code: "currency code",
2997
3041
  credit_card: "credit card number",
2998
3042
  iban: "IBAN",
2999
3043
  jwt: "JWT",
@@ -3046,7 +3090,7 @@ window.__ModuleLoader__.load({
3046
3090
  return { localeError: error() };
3047
3091
  }
3048
3092
  //#endregion
3049
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/registries.js
3093
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/registries.js
3050
3094
  var _a;
3051
3095
  var $ZodRegistry = class {
3052
3096
  constructor() {
@@ -3093,13 +3137,17 @@ window.__ModuleLoader__.load({
3093
3137
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
3094
3138
  const globalRegistry = globalThis.__zod_globalRegistry;
3095
3139
  //#endregion
3096
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/api.js
3140
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/api.js
3141
+ function snapshotChecks(def) {
3142
+ if (def.checks) def.checks = [...def.checks];
3143
+ return def;
3144
+ }
3097
3145
  // @__NO_SIDE_EFFECTS__
3098
3146
  function _string(Class, params) {
3099
- return new Class({
3147
+ return new Class(snapshotChecks({
3100
3148
  type: "string",
3101
3149
  ...normalizeParams(params)
3102
- });
3150
+ }));
3103
3151
  }
3104
3152
  // @__NO_SIDE_EFFECTS__
3105
3153
  function _email(Class, params) {
@@ -3371,11 +3419,11 @@ window.__ModuleLoader__.load({
3371
3419
  }
3372
3420
  // @__NO_SIDE_EFFECTS__
3373
3421
  function _number(Class, params) {
3374
- return new Class({
3422
+ return new Class(snapshotChecks({
3375
3423
  type: "number",
3376
3424
  checks: [],
3377
3425
  ...normalizeParams(params)
3378
- });
3426
+ }));
3379
3427
  }
3380
3428
  // @__NO_SIDE_EFFECTS__
3381
3429
  function _int(Class, params) {
@@ -3598,7 +3646,7 @@ window.__ModuleLoader__.load({
3598
3646
  return ch;
3599
3647
  }
3600
3648
  //#endregion
3601
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/to-json-schema.js
3649
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.js
3602
3650
  function assignProps(target, ...sources) {
3603
3651
  for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3604
3652
  return target;
@@ -4042,7 +4090,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4042
4090
  return finalize(ctx, schema);
4043
4091
  };
4044
4092
  //#endregion
4045
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/core/json-schema-processors.js
4093
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.js
4046
4094
  const narrowMin = (agg, key, value) => {
4047
4095
  if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
4048
4096
  };
@@ -4229,13 +4277,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4229
4277
  key
4230
4278
  ]
4231
4279
  }));
4232
- const allKeys = new Set(Object.keys(shape));
4233
- const requiredKeys = new Set([...allKeys].filter((key) => {
4280
+ const requiredKeys = [];
4281
+ for (const key of Object.keys(shape)) {
4234
4282
  const field = def.shape[key];
4235
- if (ctx.io === "input") return inputOptin(field) === void 0;
4236
- else return field._zod.optout === void 0;
4237
- }));
4238
- if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
4283
+ if (ctx.io === "input" ? inputOptin(field) === void 0 : field._zod.optout === void 0) requiredKeys.push(key);
4284
+ }
4285
+ if (requiredKeys.length > 0) json.required = requiredKeys;
4239
4286
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
4240
4287
  else if (!def.catchall) {
4241
4288
  if (ctx.io === "output") json.additionalProperties = false;
@@ -4364,7 +4411,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4364
4411
  seen.ref = def.innerType;
4365
4412
  };
4366
4413
  //#endregion
4367
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/classic/errors.js
4414
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/errors.js
4368
4415
  const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4369
4416
  function _lazyMethod(proto, key, make) {
4370
4417
  Object.defineProperty(proto, key, {
@@ -4414,7 +4461,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4414
4461
  };
4415
4462
  const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
4416
4463
  //#endregion
4417
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/classic/parse.js
4464
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/parse.js
4418
4465
  const parse = /* @__PURE__ */ _parse(ZodRealError);
4419
4466
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
4420
4467
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -4428,7 +4475,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4428
4475
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
4429
4476
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
4430
4477
  //#endregion
4431
- //#region node_modules/.pnpm/zod@4.6.2/node_modules/zod/v4/classic/schemas.js
4478
+ //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/schemas.js
4432
4479
  function _ensureDefaultLocale() {
4433
4480
  if (!globalConfig.localeError) config(en_default());
4434
4481
  }
@@ -7855,12 +7902,59 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7855
7902
  const store = createFilesStore();
7856
7903
  const remote = lazyFilesRemote(ctx);
7857
7904
  const face = filesFace(createList(remote), createWatch(remote));
7858
- const inject = (sessionId, actions) => ({
7859
- face: face(sessionId, actions),
7860
- openFile: (address) => {
7861
- ctx.get("sidebarRight")?.openResourceIn?.(sessionId, address);
7862
- }
7863
- });
7905
+ const inject = (sessionId, actions) => {
7906
+ const selection = (0, _deepseek_ai_dsh_client_store.createSnapshotStore)({});
7907
+ const takeovers = /* @__PURE__ */ new Map();
7908
+ const endTakeover = (tabId) => {
7909
+ const held = takeovers.get(tabId);
7910
+ held?.observer?.disconnect();
7911
+ held?.controller.abort();
7912
+ takeovers.delete(tabId);
7913
+ };
7914
+ return {
7915
+ face: face(sessionId, actions),
7916
+ openFile: (address) => {
7917
+ ctx.get("sidebarRight")?.openResourceIn?.(sessionId, address);
7918
+ },
7919
+ hooks: { treeSelection: selection },
7920
+ selectRoot: (tabId, root) => {
7921
+ const next = { ...selection.getSnapshot() };
7922
+ if (root === "primary") delete next[tabId];
7923
+ else next[tabId] = root;
7924
+ selection.set(next);
7925
+ },
7926
+ takeover: {
7927
+ signal: (tabId, root, section) => {
7928
+ let held = takeovers.get(tabId);
7929
+ if (held === void 0 || held.root !== root || held.controller.signal.aborted) {
7930
+ held?.observer?.disconnect();
7931
+ held?.controller.abort();
7932
+ held = {
7933
+ controller: new AbortController(),
7934
+ root,
7935
+ section: void 0,
7936
+ observer: void 0
7937
+ };
7938
+ takeovers.set(tabId, held);
7939
+ }
7940
+ if (section !== void 0 && held.section !== section) {
7941
+ held.section = section;
7942
+ held.observer?.disconnect();
7943
+ held.observer = new MutationObserver(() => {
7944
+ if (!section.isConnected) endTakeover(tabId);
7945
+ });
7946
+ held.observer.observe(document, {
7947
+ childList: true,
7948
+ subtree: true
7949
+ });
7950
+ }
7951
+ if (held.section !== void 0 && !held.section.isConnected) endTakeover(tabId);
7952
+ return held.controller.signal;
7953
+ },
7954
+ end: endTakeover
7955
+ }
7956
+ };
7957
+ };
7864
7958
  return {
7865
7959
  store,
7866
7960
  inject
@@ -7877,14 +7971,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7877
7971
  */
7878
7972
  function createFilesTreeSurface(props, t) {
7879
7973
  if (!filesTreeSurfaceSupported()) return void 0;
7880
- const { sessionId, useStore, actions, face, openFile } = props;
7881
- if (face === void 0 || openFile === void 0 || useStore === void 0 || actions === void 0) return void 0;
7974
+ const { sessionId, useStore, actions, face, openFile, useTreeSelection, selectRoot, takeover } = props;
7975
+ if (face === void 0 || openFile === void 0 || useStore === void 0 || actions === void 0 || useTreeSelection === void 0 || selectRoot === void 0 || takeover === void 0) return void 0;
7882
7976
  return {
7883
7977
  sessionId,
7884
7978
  useStore,
7885
7979
  actions,
7886
7980
  face,
7887
7981
  openFile,
7982
+ useTreeSelection,
7983
+ selectRoot,
7984
+ takeover,
7888
7985
  t
7889
7986
  };
7890
7987
  }
@@ -8349,7 +8446,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8349
8446
  * `@deepseek-ai/dsh-client-ui-primitives`.
8350
8447
  *
8351
8448
  * ```text
8352
- * 0.1.5-rc.2 through 0.2.1-rc.4 no `isMobileDevice` export
8449
+ * 0.1.5-rc.2 through 0.2.1-rc.5 no `isMobileDevice` export
8353
8450
  * 0.2.2-alpha.2 + `isMobileDevice` exported
8354
8451
  * ```
8355
8452
  *
@@ -9527,9 +9624,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9527
9624
  * the same element's `closest('[data-dockkit-content]')` — the dockkit
9528
9625
  * tabHost section — with a generated fallback where the hook is absent.
9529
9626
  *
9530
- * The selected root is component state on purpose: every tab render
9531
- * occurrence gets its own, and reopening the pane resets to the primary
9532
- * root. There is no cross-tab or persisted selection.
9627
+ * The selected root lives in the inject product's session-scoped snapshot,
9628
+ * keyed by that dockkit tab id — component state could not survive the
9629
+ * remount every file open causes (the opened tab takes the pane, the Files
9630
+ * body unmounts with the whole occupant subtree). One selection per tab;
9631
+ * session switches mint a fresh inject product, so no selection crosses
9632
+ * sessions, and a registry eviction reconciles it back to primary.
9533
9633
  *
9534
9634
  * @module @dsh-electron/dsh-plugin-multi-root-workspace/client/RootSwitcher
9535
9635
  */
@@ -9540,17 +9640,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9540
9640
  * path stays readable and hoverable, only the dir/file typography differs.
9541
9641
  */
9542
9642
  const PathLabel = maybeComponent(["PathLabel"]);
9643
+ /** Selector hook for a composition without the fork: nothing was ever selectable. */
9644
+ const noTreeSelection = () => void 0;
9543
9645
  /** The Files-header switcher: root menu, dialog entry, and the portal tree. */
9544
9646
  function RootSwitcher(props) {
9545
9647
  const { panel, t, primaryPath, filesTree } = props;
9546
9648
  const [menuOpen, setMenuOpen] = (0, react.useState)(false);
9547
9649
  const [dialogOpen, setDialogOpen] = (0, react.useState)(false);
9548
9650
  const [view, setView] = (0, react.useState)(void 0);
9549
- const [selected, setSelected] = (0, react.useState)("primary");
9550
9651
  const [takeover, setTakeover] = (0, react.useState)(null);
9551
9652
  const wrapperRef = (0, react.useRef)(null);
9552
9653
  const fallbackTabId = (0, react.useRef)(void 0);
9654
+ const sectionRef = (0, react.useRef)(null);
9553
9655
  const [pane, setPane] = (0, react.useState)(null);
9656
+ const [tabId, setTabId] = (0, react.useState)(void 0);
9554
9657
  const mounted = (0, react.useRef)(true);
9555
9658
  const requestEpoch = (0, react.useRef)(0);
9556
9659
  (0, react.useEffect)(() => {
@@ -9561,8 +9664,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9561
9664
  };
9562
9665
  }, []);
9563
9666
  (0, react.useEffect)(() => {
9564
- setPane(wrapperRef.current?.closest("[data-files-root]") ?? null);
9667
+ const wrapper = wrapperRef.current;
9668
+ sectionRef.current = wrapper?.closest("[data-dockkit-content]") ?? null;
9669
+ const content = sectionRef.current?.dataset.dockkitContent;
9670
+ setTabId(content !== void 0 && content !== "" ? content : fallbackTabId.current ??= `mrfw-${Math.random().toString(36).slice(2)}`);
9671
+ setPane(wrapper?.closest("[data-files-root]") ?? null);
9565
9672
  }, []);
9673
+ const selected = (filesTree?.useTreeSelection ?? noTreeSelection)((selection) => tabId === void 0 ? void 0 : selection[tabId]) ?? "primary";
9674
+ const selectRoot = filesTree?.selectRoot;
9675
+ const setSelected = (0, react.useCallback)((next) => {
9676
+ if (selectRoot === void 0 || tabId === void 0) return;
9677
+ selectRoot(tabId, next);
9678
+ }, [selectRoot, tabId]);
9566
9679
  const refresh = (0, react.useCallback)(async () => {
9567
9680
  if (panel === void 0) {
9568
9681
  setView(void 0);
@@ -9600,39 +9713,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9600
9713
  }, [
9601
9714
  props.subscribeSession,
9602
9715
  props.sessionId,
9603
- refresh
9716
+ refresh,
9717
+ setSelected
9604
9718
  ]);
9605
9719
  (0, react.useEffect)(() => {
9606
- if (selected === "primary") return;
9607
- const current = view?.roots.find((root) => root.id === selected.id);
9720
+ if (selected === "primary" || view === void 0) return;
9721
+ const current = view.roots.find((root) => root.id === selected.id);
9608
9722
  if (current === void 0 || current.state !== "available") {
9609
9723
  setSelected("primary");
9610
9724
  return;
9611
9725
  }
9612
9726
  if (current !== selected) setSelected(current);
9613
- }, [view, selected]);
9727
+ }, [
9728
+ view,
9729
+ selected,
9730
+ setSelected
9731
+ ]);
9614
9732
  const roots = (0, react.useMemo)(() => view?.roots ?? [], [view]);
9615
9733
  const primaryLabel = view?.primaryName ?? basename(view?.primaryRoot ?? primaryPath);
9616
9734
  const triggerLabel = selected === "primary" ? primaryLabel : displayNameOf(selected);
9617
9735
  const triggerPath = selected === "primary" ? view?.primaryRoot ?? primaryPath : selected.path;
9618
9736
  const treeVisible = selected !== "primary" && panel !== void 0 && pane !== null && filesTree !== void 0;
9619
9737
  const selectedPath = selected === "primary" ? void 0 : selected.path;
9738
+ const takeoverCtl = filesTree?.takeover;
9620
9739
  (0, react.useEffect)(() => {
9621
- if (!treeVisible || selectedPath === void 0) {
9740
+ if (!treeVisible || selectedPath === void 0 || tabId === void 0 || takeoverCtl === void 0) {
9622
9741
  setTakeover(null);
9623
9742
  return;
9624
9743
  }
9625
- const controller = new AbortController();
9626
- const tabId = (wrapperRef.current?.closest("[data-dockkit-content]")?.dataset.dockkitContent ?? "") || (fallbackTabId.current ??= `mrfw-${Math.random().toString(36).slice(2)}`);
9627
9744
  setTakeover({
9628
- signal: controller.signal,
9745
+ signal: takeoverCtl.signal(tabId, selectedPath, sectionRef.current ?? void 0),
9629
9746
  tabId,
9630
9747
  root: selectedPath
9631
9748
  });
9632
9749
  return () => {
9633
- controller.abort();
9750
+ if (mounted.current || sectionRef.current === null) takeoverCtl.end(tabId);
9634
9751
  };
9635
- }, [treeVisible, selectedPath]);
9752
+ }, [
9753
+ treeVisible,
9754
+ selectedPath,
9755
+ tabId,
9756
+ takeoverCtl
9757
+ ]);
9636
9758
  const items = (0, react.useMemo)(() => [{
9637
9759
  id: "primary",
9638
9760
  label: `${primaryLabel} · ${t("panel.primary")}`,
@@ -9850,7 +9972,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9850
9972
  inject: filesTreeSeats.inject
9851
9973
  }, function FilesActionsOccupant(props) {
9852
9974
  const absolutePath = props?.absolutePath;
9853
- const paneSessionId = () => props?.sessionId ?? sessionId();
9975
+ const composedSessionId = props?.sessionId;
9976
+ const paneSessionId = (0, react.useCallback)(() => composedSessionId ?? sessionId(), [composedSessionId]);
9854
9977
  const filesTree = createFilesTreeSurface(props, filesTreeT);
9855
9978
  return absolutePath === void 0 ? (0, react.createElement)(WorkspaceFoldersAction, {
9856
9979
  panel,