dsh-skill-hub 0.3.0 → 0.3.1

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/client.js CHANGED
@@ -6,7 +6,6 @@ window.__ModuleLoader__.load({
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  let react = require("react");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
- let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
10
9
  //#region src/protocol.ts
11
10
  /**
12
11
  * Shared API contract for dsh-skill-hub: the route paths and payload shapes
@@ -1072,6 +1071,7 @@ window.__ModuleLoader__.load({
1072
1071
  source.candidates = async (session, req) => {
1073
1072
  const items = await original(session, req);
1074
1073
  if (req.signal.aborted) return items;
1074
+ if (req !== null && typeof req === "object" && "drilled" in req) return items;
1075
1075
  const modelByName = await modelInvocableMap(api);
1076
1076
  if (req.signal.aborted) return items;
1077
1077
  const snapshot = scope.getSnapshot();
@@ -1466,6 +1466,706 @@ window.__ModuleLoader__.load({
1466
1466
  });
1467
1467
  }
1468
1468
  //#endregion
1469
+ //#region node_modules/zustand/esm/vanilla.mjs
1470
+ const createStoreImpl = (createState) => {
1471
+ let state;
1472
+ const listeners = /* @__PURE__ */ new Set();
1473
+ const setState = (partial, replace) => {
1474
+ const nextState = typeof partial === "function" ? partial(state) : partial;
1475
+ if (!Object.is(nextState, state)) {
1476
+ const previousState = state;
1477
+ state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
1478
+ listeners.forEach((listener) => listener(state, previousState));
1479
+ }
1480
+ };
1481
+ const getState = () => state;
1482
+ const subscribe = (listener) => {
1483
+ listeners.add(listener);
1484
+ return () => listeners.delete(listener);
1485
+ };
1486
+ const destroy = () => {
1487
+ listeners.clear();
1488
+ };
1489
+ const api = {
1490
+ setState,
1491
+ getState,
1492
+ subscribe,
1493
+ destroy
1494
+ };
1495
+ state = createState(setState, getState, api);
1496
+ return api;
1497
+ };
1498
+ const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1499
+ //#endregion
1500
+ //#region node_modules/zustand/esm/middleware.mjs
1501
+ const subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1502
+ const origSubscribe = api.subscribe;
1503
+ api.subscribe = (selector, optListener, options) => {
1504
+ let listener = selector;
1505
+ if (optListener) {
1506
+ const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
1507
+ let currentSlice = selector(api.getState());
1508
+ listener = (state) => {
1509
+ const nextSlice = selector(state);
1510
+ if (!equalityFn(currentSlice, nextSlice)) {
1511
+ const previousSlice = currentSlice;
1512
+ optListener(currentSlice = nextSlice, previousSlice);
1513
+ }
1514
+ };
1515
+ if (options == null ? void 0 : options.fireImmediately) optListener(currentSlice, currentSlice);
1516
+ }
1517
+ return origSubscribe(listener);
1518
+ };
1519
+ return fn(set, get, api);
1520
+ };
1521
+ const subscribeWithSelector = subscribeWithSelectorImpl;
1522
+ //#endregion
1523
+ //#region node_modules/immer/dist/immer.mjs
1524
+ var NOTHING = Symbol.for("immer-nothing");
1525
+ var DRAFTABLE = Symbol.for("immer-draftable");
1526
+ var DRAFT_STATE = Symbol.for("immer-state");
1527
+ function die(error, ...args) {
1528
+ throw new Error(`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`);
1529
+ }
1530
+ var getPrototypeOf = Object.getPrototypeOf;
1531
+ function isDraft(value) {
1532
+ return !!value && !!value[DRAFT_STATE];
1533
+ }
1534
+ function isDraftable(value) {
1535
+ if (!value) return false;
1536
+ return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
1537
+ }
1538
+ var objectCtorString = Object.prototype.constructor.toString();
1539
+ var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
1540
+ function isPlainObject(value) {
1541
+ if (!value || typeof value !== "object") return false;
1542
+ const proto = Object.getPrototypeOf(value);
1543
+ if (proto === null || proto === Object.prototype) return true;
1544
+ const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
1545
+ if (Ctor === Object) return true;
1546
+ if (typeof Ctor !== "function") return false;
1547
+ let ctorString = cachedCtorStrings.get(Ctor);
1548
+ if (ctorString === void 0) {
1549
+ ctorString = Function.toString.call(Ctor);
1550
+ cachedCtorStrings.set(Ctor, ctorString);
1551
+ }
1552
+ return ctorString === objectCtorString;
1553
+ }
1554
+ function each(obj, iter, strict = true) {
1555
+ if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : Object.keys(obj)).forEach((key) => {
1556
+ iter(key, obj[key], obj);
1557
+ });
1558
+ else obj.forEach((entry, index) => iter(index, entry, obj));
1559
+ }
1560
+ function getArchtype(thing) {
1561
+ const state = thing[DRAFT_STATE];
1562
+ return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
1563
+ }
1564
+ function has(thing, prop) {
1565
+ return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
1566
+ }
1567
+ function set(thing, propOrOldValue, value) {
1568
+ const t = getArchtype(thing);
1569
+ if (t === 2) thing.set(propOrOldValue, value);
1570
+ else if (t === 3) thing.add(value);
1571
+ else thing[propOrOldValue] = value;
1572
+ }
1573
+ function is(x, y) {
1574
+ if (x === y) return x !== 0 || 1 / x === 1 / y;
1575
+ else return x !== x && y !== y;
1576
+ }
1577
+ function isMap(target) {
1578
+ return target instanceof Map;
1579
+ }
1580
+ function isSet(target) {
1581
+ return target instanceof Set;
1582
+ }
1583
+ function latest(state) {
1584
+ return state.copy_ || state.base_;
1585
+ }
1586
+ function shallowCopy(base, strict) {
1587
+ if (isMap(base)) return new Map(base);
1588
+ if (isSet(base)) return new Set(base);
1589
+ if (Array.isArray(base)) return Array.prototype.slice.call(base);
1590
+ const isPlain = isPlainObject(base);
1591
+ if (strict === true || strict === "class_only" && !isPlain) {
1592
+ const descriptors = Object.getOwnPropertyDescriptors(base);
1593
+ delete descriptors[DRAFT_STATE];
1594
+ let keys = Reflect.ownKeys(descriptors);
1595
+ for (let i = 0; i < keys.length; i++) {
1596
+ const key = keys[i];
1597
+ const desc = descriptors[key];
1598
+ if (desc.writable === false) {
1599
+ desc.writable = true;
1600
+ desc.configurable = true;
1601
+ }
1602
+ if (desc.get || desc.set) descriptors[key] = {
1603
+ configurable: true,
1604
+ writable: true,
1605
+ enumerable: desc.enumerable,
1606
+ value: base[key]
1607
+ };
1608
+ }
1609
+ return Object.create(getPrototypeOf(base), descriptors);
1610
+ } else {
1611
+ const proto = getPrototypeOf(base);
1612
+ if (proto !== null && isPlain) return { ...base };
1613
+ const obj = Object.create(proto);
1614
+ return Object.assign(obj, base);
1615
+ }
1616
+ }
1617
+ function freeze(obj, deep = false) {
1618
+ if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
1619
+ if (getArchtype(obj) > 1) Object.defineProperties(obj, {
1620
+ set: dontMutateMethodOverride,
1621
+ add: dontMutateMethodOverride,
1622
+ clear: dontMutateMethodOverride,
1623
+ delete: dontMutateMethodOverride
1624
+ });
1625
+ Object.freeze(obj);
1626
+ if (deep) Object.values(obj).forEach((value) => freeze(value, true));
1627
+ return obj;
1628
+ }
1629
+ function dontMutateFrozenCollections() {
1630
+ die(2);
1631
+ }
1632
+ var dontMutateMethodOverride = { value: dontMutateFrozenCollections };
1633
+ function isFrozen(obj) {
1634
+ if (obj === null || typeof obj !== "object") return true;
1635
+ return Object.isFrozen(obj);
1636
+ }
1637
+ var plugins = {};
1638
+ function getPlugin(pluginKey) {
1639
+ const plugin = plugins[pluginKey];
1640
+ if (!plugin) die(0, pluginKey);
1641
+ return plugin;
1642
+ }
1643
+ var currentScope;
1644
+ function getCurrentScope() {
1645
+ return currentScope;
1646
+ }
1647
+ function createScope(parent_, immer_) {
1648
+ return {
1649
+ drafts_: [],
1650
+ parent_,
1651
+ immer_,
1652
+ canAutoFreeze_: true,
1653
+ unfinalizedDrafts_: 0
1654
+ };
1655
+ }
1656
+ function usePatchesInScope(scope, patchListener) {
1657
+ if (patchListener) {
1658
+ getPlugin("Patches");
1659
+ scope.patches_ = [];
1660
+ scope.inversePatches_ = [];
1661
+ scope.patchListener_ = patchListener;
1662
+ }
1663
+ }
1664
+ function revokeScope(scope) {
1665
+ leaveScope(scope);
1666
+ scope.drafts_.forEach(revokeDraft);
1667
+ scope.drafts_ = null;
1668
+ }
1669
+ function leaveScope(scope) {
1670
+ if (scope === currentScope) currentScope = scope.parent_;
1671
+ }
1672
+ function enterScope(immer2) {
1673
+ return currentScope = createScope(currentScope, immer2);
1674
+ }
1675
+ function revokeDraft(draft) {
1676
+ const state = draft[DRAFT_STATE];
1677
+ if (state.type_ === 0 || state.type_ === 1) state.revoke_();
1678
+ else state.revoked_ = true;
1679
+ }
1680
+ function processResult(result, scope) {
1681
+ scope.unfinalizedDrafts_ = scope.drafts_.length;
1682
+ const baseDraft = scope.drafts_[0];
1683
+ if (result !== void 0 && result !== baseDraft) {
1684
+ if (baseDraft[DRAFT_STATE].modified_) {
1685
+ revokeScope(scope);
1686
+ die(4);
1687
+ }
1688
+ if (isDraftable(result)) {
1689
+ result = finalize(scope, result);
1690
+ if (!scope.parent_) maybeFreeze(scope, result);
1691
+ }
1692
+ if (scope.patches_) getPlugin("Patches").generateReplacementPatches_(baseDraft[DRAFT_STATE].base_, result, scope.patches_, scope.inversePatches_);
1693
+ } else result = finalize(scope, baseDraft, []);
1694
+ revokeScope(scope);
1695
+ if (scope.patches_) scope.patchListener_(scope.patches_, scope.inversePatches_);
1696
+ return result !== NOTHING ? result : void 0;
1697
+ }
1698
+ function finalize(rootScope, value, path) {
1699
+ if (isFrozen(value)) return value;
1700
+ const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
1701
+ const state = value[DRAFT_STATE];
1702
+ if (!state) {
1703
+ each(value, (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path), useStrictIteration);
1704
+ return value;
1705
+ }
1706
+ if (state.scope_ !== rootScope) return value;
1707
+ if (!state.modified_) {
1708
+ maybeFreeze(rootScope, state.base_, true);
1709
+ return state.base_;
1710
+ }
1711
+ if (!state.finalized_) {
1712
+ state.finalized_ = true;
1713
+ state.scope_.unfinalizedDrafts_--;
1714
+ const result = state.copy_;
1715
+ let resultEach = result;
1716
+ let isSet2 = false;
1717
+ if (state.type_ === 3) {
1718
+ resultEach = new Set(result);
1719
+ result.clear();
1720
+ isSet2 = true;
1721
+ }
1722
+ each(resultEach, (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2), useStrictIteration);
1723
+ maybeFreeze(rootScope, result, false);
1724
+ if (path && rootScope.patches_) getPlugin("Patches").generatePatches_(state, path, rootScope.patches_, rootScope.inversePatches_);
1725
+ }
1726
+ return state.copy_;
1727
+ }
1728
+ function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
1729
+ if (childValue == null) return;
1730
+ if (typeof childValue !== "object" && !targetIsSet) return;
1731
+ const childIsFrozen = isFrozen(childValue);
1732
+ if (childIsFrozen && !targetIsSet) return;
1733
+ if (isDraft(childValue)) {
1734
+ const res = finalize(rootScope, childValue, rootPath && parentState && parentState.type_ !== 3 && !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0);
1735
+ set(targetObject, prop, res);
1736
+ if (isDraft(res)) rootScope.canAutoFreeze_ = false;
1737
+ else return;
1738
+ } else if (targetIsSet) targetObject.add(childValue);
1739
+ if (isDraftable(childValue) && !childIsFrozen) {
1740
+ if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) return;
1741
+ if (parentState && parentState.base_ && parentState.base_[prop] === childValue && childIsFrozen) return;
1742
+ finalize(rootScope, childValue);
1743
+ if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop))) maybeFreeze(rootScope, childValue);
1744
+ }
1745
+ }
1746
+ function maybeFreeze(scope, value, deep = false) {
1747
+ if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) freeze(value, deep);
1748
+ }
1749
+ function createProxyProxy(base, parent) {
1750
+ const isArray = Array.isArray(base);
1751
+ const state = {
1752
+ type_: isArray ? 1 : 0,
1753
+ scope_: parent ? parent.scope_ : getCurrentScope(),
1754
+ modified_: false,
1755
+ finalized_: false,
1756
+ assigned_: {},
1757
+ parent_: parent,
1758
+ base_: base,
1759
+ draft_: null,
1760
+ copy_: null,
1761
+ revoke_: null,
1762
+ isManual_: false
1763
+ };
1764
+ let target = state;
1765
+ let traps = objectTraps;
1766
+ if (isArray) {
1767
+ target = [state];
1768
+ traps = arrayTraps;
1769
+ }
1770
+ const { revoke, proxy } = Proxy.revocable(target, traps);
1771
+ state.draft_ = proxy;
1772
+ state.revoke_ = revoke;
1773
+ return proxy;
1774
+ }
1775
+ var objectTraps = {
1776
+ get(state, prop) {
1777
+ if (prop === DRAFT_STATE) return state;
1778
+ const source = latest(state);
1779
+ if (!has(source, prop)) return readPropFromProto(state, source, prop);
1780
+ const value = source[prop];
1781
+ if (state.finalized_ || !isDraftable(value)) return value;
1782
+ if (value === peek(state.base_, prop)) {
1783
+ prepareCopy(state);
1784
+ return state.copy_[prop] = createProxy(value, state);
1785
+ }
1786
+ return value;
1787
+ },
1788
+ has(state, prop) {
1789
+ return prop in latest(state);
1790
+ },
1791
+ ownKeys(state) {
1792
+ return Reflect.ownKeys(latest(state));
1793
+ },
1794
+ set(state, prop, value) {
1795
+ const desc = getDescriptorFromProto(latest(state), prop);
1796
+ if (desc?.set) {
1797
+ desc.set.call(state.draft_, value);
1798
+ return true;
1799
+ }
1800
+ if (!state.modified_) {
1801
+ const current2 = peek(latest(state), prop);
1802
+ const currentState = current2?.[DRAFT_STATE];
1803
+ if (currentState && currentState.base_ === value) {
1804
+ state.copy_[prop] = value;
1805
+ state.assigned_[prop] = false;
1806
+ return true;
1807
+ }
1808
+ if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) return true;
1809
+ prepareCopy(state);
1810
+ markChanged(state);
1811
+ }
1812
+ if (state.copy_[prop] === value && (value !== void 0 || prop in state.copy_) || Number.isNaN(value) && Number.isNaN(state.copy_[prop])) return true;
1813
+ state.copy_[prop] = value;
1814
+ state.assigned_[prop] = true;
1815
+ return true;
1816
+ },
1817
+ deleteProperty(state, prop) {
1818
+ if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
1819
+ state.assigned_[prop] = false;
1820
+ prepareCopy(state);
1821
+ markChanged(state);
1822
+ } else delete state.assigned_[prop];
1823
+ if (state.copy_) delete state.copy_[prop];
1824
+ return true;
1825
+ },
1826
+ getOwnPropertyDescriptor(state, prop) {
1827
+ const owner = latest(state);
1828
+ const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
1829
+ if (!desc) return desc;
1830
+ return {
1831
+ writable: true,
1832
+ configurable: state.type_ !== 1 || prop !== "length",
1833
+ enumerable: desc.enumerable,
1834
+ value: owner[prop]
1835
+ };
1836
+ },
1837
+ defineProperty() {
1838
+ die(11);
1839
+ },
1840
+ getPrototypeOf(state) {
1841
+ return getPrototypeOf(state.base_);
1842
+ },
1843
+ setPrototypeOf() {
1844
+ die(12);
1845
+ }
1846
+ };
1847
+ var arrayTraps = {};
1848
+ each(objectTraps, (key, fn) => {
1849
+ arrayTraps[key] = function() {
1850
+ arguments[0] = arguments[0][0];
1851
+ return fn.apply(this, arguments);
1852
+ };
1853
+ });
1854
+ arrayTraps.deleteProperty = function(state, prop) {
1855
+ return arrayTraps.set.call(this, state, prop, void 0);
1856
+ };
1857
+ arrayTraps.set = function(state, prop, value) {
1858
+ return objectTraps.set.call(this, state[0], prop, value, state[0]);
1859
+ };
1860
+ function peek(draft, prop) {
1861
+ const state = draft[DRAFT_STATE];
1862
+ return (state ? latest(state) : draft)[prop];
1863
+ }
1864
+ function readPropFromProto(state, source, prop) {
1865
+ const desc = getDescriptorFromProto(source, prop);
1866
+ return desc ? `value` in desc ? desc.value : desc.get?.call(state.draft_) : void 0;
1867
+ }
1868
+ function getDescriptorFromProto(source, prop) {
1869
+ if (!(prop in source)) return void 0;
1870
+ let proto = getPrototypeOf(source);
1871
+ while (proto) {
1872
+ const desc = Object.getOwnPropertyDescriptor(proto, prop);
1873
+ if (desc) return desc;
1874
+ proto = getPrototypeOf(proto);
1875
+ }
1876
+ }
1877
+ function markChanged(state) {
1878
+ if (!state.modified_) {
1879
+ state.modified_ = true;
1880
+ if (state.parent_) markChanged(state.parent_);
1881
+ }
1882
+ }
1883
+ function prepareCopy(state) {
1884
+ if (!state.copy_) state.copy_ = shallowCopy(state.base_, state.scope_.immer_.useStrictShallowCopy_);
1885
+ }
1886
+ var Immer2 = class {
1887
+ constructor(config) {
1888
+ this.autoFreeze_ = true;
1889
+ this.useStrictShallowCopy_ = false;
1890
+ this.useStrictIteration_ = true;
1891
+ /**
1892
+ * The `produce` function takes a value and a "recipe function" (whose
1893
+ * return value often depends on the base state). The recipe function is
1894
+ * free to mutate its first argument however it wants. All mutations are
1895
+ * only ever applied to a __copy__ of the base state.
1896
+ *
1897
+ * Pass only a function to create a "curried producer" which relieves you
1898
+ * from passing the recipe function every time.
1899
+ *
1900
+ * Only plain objects and arrays are made mutable. All other objects are
1901
+ * considered uncopyable.
1902
+ *
1903
+ * Note: This function is __bound__ to its `Immer` instance.
1904
+ *
1905
+ * @param {any} base - the initial state
1906
+ * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
1907
+ * @param {Function} patchListener - optional function that will be called with all the patches produced here
1908
+ * @returns {any} a new state, or the initial state if nothing was modified
1909
+ */
1910
+ this.produce = (base, recipe, patchListener) => {
1911
+ if (typeof base === "function" && typeof recipe !== "function") {
1912
+ const defaultBase = recipe;
1913
+ recipe = base;
1914
+ const self = this;
1915
+ return function curriedProduce(base2 = defaultBase, ...args) {
1916
+ return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
1917
+ };
1918
+ }
1919
+ if (typeof recipe !== "function") die(6);
1920
+ if (patchListener !== void 0 && typeof patchListener !== "function") die(7);
1921
+ let result;
1922
+ if (isDraftable(base)) {
1923
+ const scope = enterScope(this);
1924
+ const proxy = createProxy(base, void 0);
1925
+ let hasError = true;
1926
+ try {
1927
+ result = recipe(proxy);
1928
+ hasError = false;
1929
+ } finally {
1930
+ if (hasError) revokeScope(scope);
1931
+ else leaveScope(scope);
1932
+ }
1933
+ usePatchesInScope(scope, patchListener);
1934
+ return processResult(result, scope);
1935
+ } else if (!base || typeof base !== "object") {
1936
+ result = recipe(base);
1937
+ if (result === void 0) result = base;
1938
+ if (result === NOTHING) result = void 0;
1939
+ if (this.autoFreeze_) freeze(result, true);
1940
+ if (patchListener) {
1941
+ const p = [];
1942
+ const ip = [];
1943
+ getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
1944
+ patchListener(p, ip);
1945
+ }
1946
+ return result;
1947
+ } else die(1, base);
1948
+ };
1949
+ this.produceWithPatches = (base, recipe) => {
1950
+ if (typeof base === "function") return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
1951
+ let patches, inversePatches;
1952
+ return [
1953
+ this.produce(base, recipe, (p, ip) => {
1954
+ patches = p;
1955
+ inversePatches = ip;
1956
+ }),
1957
+ patches,
1958
+ inversePatches
1959
+ ];
1960
+ };
1961
+ if (typeof config?.autoFreeze === "boolean") this.setAutoFreeze(config.autoFreeze);
1962
+ if (typeof config?.useStrictShallowCopy === "boolean") this.setUseStrictShallowCopy(config.useStrictShallowCopy);
1963
+ if (typeof config?.useStrictIteration === "boolean") this.setUseStrictIteration(config.useStrictIteration);
1964
+ }
1965
+ createDraft(base) {
1966
+ if (!isDraftable(base)) die(8);
1967
+ if (isDraft(base)) base = current(base);
1968
+ const scope = enterScope(this);
1969
+ const proxy = createProxy(base, void 0);
1970
+ proxy[DRAFT_STATE].isManual_ = true;
1971
+ leaveScope(scope);
1972
+ return proxy;
1973
+ }
1974
+ finishDraft(draft, patchListener) {
1975
+ const state = draft && draft[DRAFT_STATE];
1976
+ if (!state || !state.isManual_) die(9);
1977
+ const { scope_: scope } = state;
1978
+ usePatchesInScope(scope, patchListener);
1979
+ return processResult(void 0, scope);
1980
+ }
1981
+ /**
1982
+ * Pass true to automatically freeze all copies created by Immer.
1983
+ *
1984
+ * By default, auto-freezing is enabled.
1985
+ */
1986
+ setAutoFreeze(value) {
1987
+ this.autoFreeze_ = value;
1988
+ }
1989
+ /**
1990
+ * Pass true to enable strict shallow copy.
1991
+ *
1992
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
1993
+ */
1994
+ setUseStrictShallowCopy(value) {
1995
+ this.useStrictShallowCopy_ = value;
1996
+ }
1997
+ /**
1998
+ * Pass false to use faster iteration that skips non-enumerable properties
1999
+ * but still handles symbols for compatibility.
2000
+ *
2001
+ * By default, strict iteration is enabled (includes all own properties).
2002
+ */
2003
+ setUseStrictIteration(value) {
2004
+ this.useStrictIteration_ = value;
2005
+ }
2006
+ shouldUseStrictIteration() {
2007
+ return this.useStrictIteration_;
2008
+ }
2009
+ applyPatches(base, patches) {
2010
+ let i;
2011
+ for (i = patches.length - 1; i >= 0; i--) {
2012
+ const patch = patches[i];
2013
+ if (patch.path.length === 0 && patch.op === "replace") {
2014
+ base = patch.value;
2015
+ break;
2016
+ }
2017
+ }
2018
+ if (i > -1) patches = patches.slice(i + 1);
2019
+ const applyPatchesImpl = getPlugin("Patches").applyPatches_;
2020
+ if (isDraft(base)) return applyPatchesImpl(base, patches);
2021
+ return this.produce(base, (draft) => applyPatchesImpl(draft, patches));
2022
+ }
2023
+ };
2024
+ function createProxy(value, parent) {
2025
+ const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
2026
+ (parent ? parent.scope_ : getCurrentScope()).drafts_.push(draft);
2027
+ return draft;
2028
+ }
2029
+ function current(value) {
2030
+ if (!isDraft(value)) die(10, value);
2031
+ return currentImpl(value);
2032
+ }
2033
+ function currentImpl(value) {
2034
+ if (!isDraftable(value) || isFrozen(value)) return value;
2035
+ const state = value[DRAFT_STATE];
2036
+ let copy;
2037
+ let strict = true;
2038
+ if (state) {
2039
+ if (!state.modified_) return state.base_;
2040
+ state.finalized_ = true;
2041
+ copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
2042
+ strict = state.scope_.immer_.shouldUseStrictIteration();
2043
+ } else copy = shallowCopy(value, true);
2044
+ each(copy, (key, childValue) => {
2045
+ set(copy, key, currentImpl(childValue));
2046
+ }, strict);
2047
+ if (state) state.finalized_ = false;
2048
+ return copy;
2049
+ }
2050
+ var produce = new Immer2().produce;
2051
+ //#endregion
2052
+ //#region node_modules/@deepseek-ai/dsh-client-store/lib/index.js
2053
+ /**
2054
+ * React-free snapshot store engine (zustand vanilla + immer + subscribeWithSelector +
2055
+ * rafFlush middleware + opt-in persist + dev freeze) plus the declarative
2056
+ * shell over it: {@link defineStore} bakes an init/persist/actions literal
2057
+ * into a {@link StoreHandle}, the registration-side store seat of slot
2058
+ * terminals. Engine products are bare observables — subscribe/getSnapshot/
2059
+ * update/set, NO selector hook. Hook synthesis is ui-renderer's (the one
2060
+ * uSES bridge, cached per source at the binding site).
2061
+ */
2062
+ /**
2063
+ * Notify an observer set without allowing one callback to starve the rest.
2064
+ * @param listeners - current observer callbacks; copied before dispatch.
2065
+ * @param label - diagnostic owner prefix.
2066
+ * @param args - callback arguments.
2067
+ */
2068
+ function notifySubscribers(listeners, label, ...args) {
2069
+ for (const listener of [...listeners]) try {
2070
+ listener(...args);
2071
+ } catch (error) {
2072
+ console.error(`${label} subscriber failed:`, error);
2073
+ }
2074
+ }
2075
+ /** Batches subscriber notification into one flush per animation frame. */
2076
+ function rafBatch(notify) {
2077
+ const schedule = typeof requestAnimationFrame === "function" ? (fn) => {
2078
+ requestAnimationFrame(() => {
2079
+ fn();
2080
+ });
2081
+ } : (fn) => {
2082
+ queueMicrotask(fn);
2083
+ };
2084
+ let scheduled = false;
2085
+ return () => {
2086
+ if (scheduled) return;
2087
+ scheduled = true;
2088
+ schedule(() => {
2089
+ scheduled = false;
2090
+ notify();
2091
+ });
2092
+ };
2093
+ }
2094
+ /**
2095
+ * Create a snapshot store.
2096
+ *
2097
+ * Flush default is 'sync' (controlled inputs need same-tick echo); frame-driven
2098
+ * stores opt into 'raf', where a frame's worth of updates coalesces into one
2099
+ * notification. Known raf-mode tradeoff: a component mounting mid-frame reads
2100
+ * fresh state while existing subscribers hear it next flush — transient
2101
+ * frame-level skew, same nature as the object layer's microtask batching.
2102
+ *
2103
+ * @param init - initial state.
2104
+ * @param opts - flush mode and opt-in persistence (localStorage, keyed by name).
2105
+ * @returns the store.
2106
+ */
2107
+ function createSnapshotStore(init, opts) {
2108
+ const withSelector = subscribeWithSelector(() => init);
2109
+ const api = createStore()(withSelector);
2110
+ if (opts?.persist) attachPersistence(api, opts.persist.name);
2111
+ let subscribe = (fn) => api.subscribe(() => {
2112
+ notifySubscribers([fn], "[client-store]");
2113
+ });
2114
+ if (opts?.flush === "raf") {
2115
+ const listeners = /* @__PURE__ */ new Set();
2116
+ const flush = rafBatch(() => {
2117
+ notifySubscribers(listeners, "[client-store]");
2118
+ });
2119
+ api.subscribe(flush);
2120
+ subscribe = (fn) => {
2121
+ listeners.add(fn);
2122
+ return () => {
2123
+ listeners.delete(fn);
2124
+ };
2125
+ };
2126
+ }
2127
+ return {
2128
+ getSnapshot: () => api.getState(),
2129
+ subscribe: (fn) => subscribe(fn),
2130
+ update: (mutator) => {
2131
+ api.setState(produce(api.getState(), (draft) => {
2132
+ mutator(draft);
2133
+ }), true);
2134
+ },
2135
+ set: (next) => {
2136
+ api.setState(devFreeze(next), true);
2137
+ }
2138
+ };
2139
+ }
2140
+ /**
2141
+ * Whole-value JSON persistence to localStorage. Hand-rolled instead of the
2142
+ * zustand persist middleware: its write path spreads state into an object
2143
+ * (`partialize({ ...get() })`), exploding primitive state (a persisted string
2144
+ * draft becomes {0:'h',1:'e',...}) — not fixable via merge/deserialize options
2145
+ * because the corruption happens before serialization. Storage failures
2146
+ * (quota, private mode) only disable persistence, never break the store.
2147
+ */
2148
+ function attachPersistence(api, name) {
2149
+ if (typeof localStorage === "undefined") return;
2150
+ try {
2151
+ const raw = localStorage.getItem(name);
2152
+ if (raw !== null) api.setState(devFreeze(JSON.parse(raw)), true);
2153
+ } catch (error) {
2154
+ console.error(`snapshot store '${name}' rehydration failed:`, error);
2155
+ }
2156
+ api.subscribe((state) => {
2157
+ try {
2158
+ localStorage.setItem(name, JSON.stringify(state));
2159
+ } catch (error) {
2160
+ console.error(`snapshot store '${name}' persistence failed:`, error);
2161
+ }
2162
+ });
2163
+ }
2164
+ /** Deep-freeze draftable wholesale-set state outside production: set() bypasses immer's freeze. */
2165
+ function devFreeze(value) {
2166
+ return freeze(value, true);
2167
+ }
2168
+ //#endregion
1469
2169
  //#region src/client/settings-form.ts
1470
2170
  /**
1471
2171
  * Settings-card form machinery, vendored from the dsh-web-ui family bucket
@@ -1548,7 +2248,7 @@ window.__ModuleLoader__.load({
1548
2248
  }
1549
2249
  /** Publish a projection of this form, rebuilt whenever the scope or a draft changes. */
1550
2250
  bind(project) {
1551
- const store = (0, _deepseek_ai_dsh_client_runtime_client.createSnapshotStore)(project());
2251
+ const store = createSnapshotStore(project());
1552
2252
  this.listeners.add(() => {
1553
2253
  store.set(project());
1554
2254
  });