dsh-plugin-core-demo 0.35.13 → 0.35.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.
package/dist/client.js CHANGED
@@ -4295,7 +4295,10 @@ function OverlayHead(props) {
4295
4295
 
4296
4296
  // dist/ui/inputs/picker-css.generated.js
4297
4297
  var PICKER_CSS = `
4298
- .dshpc-picker{position:relative;display:inline-block;max-width:100%;font-size:13px;line-height:20px}
4298
+ /* min-width:0 \u662F\u7ED9\u300C\u4F5C\u4E3A flex item\u300D\u51C6\u5907\u7684\uFF1A\u9ED8\u8BA4 min-width:auto \u4F1A\u88AB\u9009\u4E2D\u6587\u672C\u7684 min-content
4299
+ \u6491\u4F4F\uFF0C\u957F\u6A21\u578B\u540D\u5C31\u628A\u540C\u4E00\u884C\u7684\u5176\u5B83\u63A7\u4EF6\u5F80\u5DE6\u9876\uFF082026-11-10 \u7528\u6237\u771F\u673A\u622A\u56FE\uFF1A\u4E09\u4E2A\u8F93\u5165\u6846\u6574\u4F53\u5DE6\u79FB\uFF09\u3002
4300
+ \u7ED9 0 \u540E\u53EF\u6536\u7F29\uFF0C\u6587\u5B57\u7531 __label \u7684\u7701\u7565\u53F7\u63A5\u4F4F\u3002 */
4301
+ .dshpc-picker{position:relative;display:inline-block;max-width:100%;min-width:0;font-size:13px;line-height:20px}
4299
4302
  .dshpc-picker__trigger{
4300
4303
  display:inline-flex;align-items:center;justify-content:space-between;gap:6px;
4301
4304
  min-width:120px;max-width:100%;height:28px;padding:0 8px;
@@ -4339,19 +4342,26 @@ var PICKER_CSS = `
4339
4342
  .dshpc-picker__group-label{
4340
4343
  padding:6px 8px 2px;color:var(--dshpc-fg-3);font-size:11px;
4341
4344
  }
4345
+ /* \u9009\u9879\u662F\u300C\u884C\u300D\u4E0D\u662F\u300C\u5361\u7247\u300D\uFF1A\u5706\u89D2\u6536\u5230 xs \u6863\uFF0C\u4E0E ListRow \u7684\u884C\u53E3\u5F84\u4E00\u81F4 \u2014\u2014 \u5927\u5706\u89D2\u53EA\u5F52\u5916\u5C42\u83DC\u5355
4346
+ \uFF08panel.css \u7684 menu \u6863 + overflow:hidden\uFF09\u30022026-11-10 \u7528\u6237\uFF1A\u6BCF\u9879\u5404\u81EA\u4E00\u5708 8px \u5706\u89D2\uFF0C\u50CF\u4E00\u53E0\u5C0F\u5361\u7247\u3002 */
4342
4347
  .dshpc-picker__option{
4343
- display:flex;align-items:center;gap:6px;padding:6px 8px;border-radius:var(--dshpc-radius-sm);cursor:pointer;
4348
+ display:flex;align-items:center;gap:6px;padding:6px 8px;border-radius:var(--dshpc-radius-xs);cursor:pointer;
4344
4349
  color:var(--dshpc-fg);white-space:nowrap;
4345
4350
  }
4346
- .dshpc-picker__option:hover{background:var(--dshpc-surface-sunken)}
4347
- .dshpc-picker__option--active{background:var(--dshpc-open-bg);color:var(--dshpc-business)}
4351
+ /* hover / \u9009\u4E2D\u76F4\u63A5\u501F ListRow \u7684\u4E24\u6761 token \u2014\u2014 \u540C\u4E00\u4E2A\u300C\u884C\u300D\u8BED\u4E49\uFF0C\u4E0E\u5217\u8868\u6761\u76EE\u5BF9\u9F50\u3002
4352
+ \u9009\u4E2D\u4E0D\u67D3\u6587\u5B57\u8272\uFF1A\u84DD\u5B57\u662F\u300C\u94FE\u63A5\u300D\u8BED\u4E49\uFF0C\u884C\u9009\u4E2D\u53EA\u6362\u5E95\uFF08list-row.css:44-47 \u7684\u53E3\u5F84\uFF09\u3002
4353
+ 2026-11-10 \u7528\u6237\uFF1A\u539F\u6765\u84DD\u5E95\u84DD\u5B57 + \u4EAE\u4E00\u70B9\u7684\u7070\uFF0C\u548C ListRow \u5B8C\u5168\u4E0D\u662F\u4E00\u5957\u3002 */
4354
+ .dshpc-picker__option:hover{background:var(--dshpc-listrow-hover-bg)}
4355
+ .dshpc-picker__option--active{background:var(--dshpc-listrow-selected-bg);color:var(--dshpc-fg)}
4348
4356
  .dshpc-picker__option--disabled{color:var(--dshpc-fg-dim);cursor:not-allowed}
4349
4357
  /* \u9009\u9879\u6587\u5B57\u5403\u6389\u5269\u4F59\u5BBD\u5EA6\uFF1A\u8D85\u957F\u7701\u7565\u53F7\uFF08\u914D\u5408 MarqueeText hover \u8DD1\u9A6C\u706F\uFF09\uFF0C\u4E0D\u6491\u5BBD\u83DC\u5355\u3002 */
4350
4358
  .dshpc-picker__option-label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
4351
4359
  .dshpc-picker__tick{width:12px;color:var(--dshpc-business)}
4352
4360
  .dshpc-picker__empty{padding:8px;color:var(--dshpc-fg-3);text-align:center}
4361
+ /* \u63D0\u793A\u6761\u901A\u680F\uFF1A\u8D1F margin \u62B5\u6389 __head \u7684\u5DE6\u53F3 4px \u5185\u8DDD\uFF08head padding:4px 4px 0\uFF09\uFF0C0 \u5706\u89D2\uFF0C
4362
+ \u9760\u83DC\u5355\u7684 overflow:hidden \u6536\u8FB9 \u2014\u2014 \u4E0E\u9009\u9879\u540C\u4E3A\u300C\u884C\u300D\uFF0C\u4E0D\u518D\u662F\u4E00\u5757\u72EC\u7ACB\u5706\u89D2\u5361\u7247\u3002 */
4353
4363
  .dshpc-picker__degraded{
4354
- padding:6px 8px;margin-bottom:4px;border-radius:var(--dshpc-radius-sm);
4364
+ padding:8px;margin:0 -4px 4px;border-radius:0;
4355
4365
  color:var(--dshpc-warning-label);background:color-mix(in srgb,var(--dshpc-warning) 12%,transparent);
4356
4366
  font-size:11px;
4357
4367
  }
@@ -4388,7 +4398,13 @@ function Picker(props) {
4388
4398
  props.onChange?.(mode === "single" ? next[0] ?? "" : next);
4389
4399
  };
4390
4400
  const limit = props.limit ?? 0;
4391
- const [open, setOpen] = (0, import_react9.useState)(false);
4401
+ const [open, setOpenState] = (0, import_react9.useState)(false);
4402
+ const onOpenChangeRef = (0, import_react9.useRef)(props.onOpenChange);
4403
+ onOpenChangeRef.current = props.onOpenChange;
4404
+ const setOpen = (0, import_react9.useCallback)((next) => {
4405
+ setOpenState(next);
4406
+ onOpenChangeRef.current?.(next);
4407
+ }, []);
4392
4408
  const [query, setQuery] = (0, import_react9.useState)("");
4393
4409
  const [active, setActive2] = (0, import_react9.useState)(-1);
4394
4410
  const [visible, setVisible] = (0, import_react9.useState)(limit);
@@ -4401,7 +4417,8 @@ function Picker(props) {
4401
4417
  middleware: [
4402
4418
  offset3(4),
4403
4419
  flip3(),
4404
- shift3({ padding: 8 }),
4420
+ // 左右各留 12:菜单比触发器宽是常态,贴到视口边上会显得在「硬挤」(2026-11-10 用户)。
4421
+ shift3({ padding: { top: 8, bottom: 8, left: 12, right: 12 } }),
4405
4422
  size3({
4406
4423
  apply({ elements, rects, availableWidth, availableHeight }) {
4407
4424
  const menu = resolveMenuSizing(rects.reference.width, availableWidth, props.searchSizing);
@@ -5646,22 +5663,72 @@ var workspaceList = new WorkspaceListStore();
5646
5663
  var workspaceFiles;
5647
5664
  var boundModelsPath;
5648
5665
  var catalogInFlight;
5649
- function loadModelCatalog(path) {
5666
+ var lastAttemptAt = 0;
5667
+ var retryIndex = 0;
5668
+ var retryTimer;
5669
+ var RETRY_DELAYS_MS = [1e3, 2e3, 4e3];
5670
+ var REVALIDATE_AFTER_MS = 3e4;
5671
+ function isRetryable(error) {
5672
+ const matched = /HTTP (\d{3})/.exec(String(error));
5673
+ if (matched === null)
5674
+ return true;
5675
+ const status = Number(matched[1]);
5676
+ return status >= 500 || status === 429;
5677
+ }
5678
+ function scheduleRetry(path, delay) {
5679
+ if (retryTimer !== void 0)
5680
+ clearTimeout(retryTimer);
5681
+ const timer = setTimeout(() => {
5682
+ retryTimer = void 0;
5683
+ void loadModelCatalog(path);
5684
+ }, delay);
5685
+ timer.unref?.();
5686
+ retryTimer = timer;
5687
+ }
5688
+ function loadModelCatalog(path, retryOnFailure = true) {
5650
5689
  if (catalogInFlight !== void 0)
5651
5690
  return catalogInFlight;
5691
+ lastAttemptAt = Date.now();
5652
5692
  const job = fetch(path, { cache: "no-store" }).then((response) => response.ok ? response.json() : Promise.reject(new Error(`HTTP ${response.status}`))).then((data2) => {
5653
5693
  const routes = data2?.routes;
5654
5694
  if (!Array.isArray(routes))
5655
5695
  throw new Error("\u6A21\u578B\u76EE\u5F55\u54CD\u5E94\u7F3A\u5C11 routes");
5696
+ retryIndex = 0;
5656
5697
  modelCatalog.setRoutes(routes);
5657
5698
  }).catch((error) => {
5658
5699
  modelCatalog.setUnavailable(String(error));
5700
+ if (!retryOnFailure || !isRetryable(error))
5701
+ return;
5702
+ const delay = RETRY_DELAYS_MS[retryIndex];
5703
+ if (delay === void 0)
5704
+ return;
5705
+ retryIndex += 1;
5706
+ scheduleRetry(path, delay);
5659
5707
  }).finally(() => {
5660
5708
  catalogInFlight = void 0;
5661
5709
  });
5662
5710
  catalogInFlight = job;
5663
5711
  return job;
5664
5712
  }
5713
+ function revalidateModelCatalog() {
5714
+ if (boundModelsPath === void 0 || catalogInFlight !== void 0)
5715
+ return;
5716
+ if (Date.now() - lastAttemptAt < REVALIDATE_AFTER_MS)
5717
+ return;
5718
+ void loadModelCatalog(boundModelsPath, false);
5719
+ }
5720
+ var visibilityBound = false;
5721
+ function bindVisibilityRevalidate() {
5722
+ if (visibilityBound)
5723
+ return;
5724
+ if (typeof document === "undefined")
5725
+ return;
5726
+ visibilityBound = true;
5727
+ document.addEventListener("visibilitychange", () => {
5728
+ if (document.visibilityState === "visible")
5729
+ revalidateModelCatalog();
5730
+ });
5731
+ }
5665
5732
  function isWorkspaceSource(value) {
5666
5733
  if (value === null || typeof value !== "object")
5667
5734
  return false;
@@ -5685,6 +5752,7 @@ function connectHost(ctx, options = {}) {
5685
5752
  if (modelsPath === void 0)
5686
5753
  return;
5687
5754
  boundModelsPath = modelsPath;
5755
+ bindVisibilityRevalidate();
5688
5756
  void loadModelCatalog(modelsPath);
5689
5757
  }
5690
5758
 
@@ -5760,6 +5828,11 @@ function ModelPicker(props) {
5760
5828
  size: props.size,
5761
5829
  placement: props.placement,
5762
5830
  className: props.className,
5831
+ // 打开下拉就补拉目录(核心内部 30s 节流,快速开关不会连发):供应商 / 模型增减靠它感知。
5832
+ onOpenChange: (open) => {
5833
+ if (open)
5834
+ revalidateModelCatalog();
5835
+ },
5763
5836
  translate: props.translate,
5764
5837
  onChange: emitModel
5765
5838
  });
@@ -5782,6 +5855,11 @@ function ModelPicker(props) {
5782
5855
  size: props.size,
5783
5856
  placement: props.placement,
5784
5857
  className: props.className,
5858
+ // 打开下拉就补拉目录(核心内部 30s 节流,快速开关不会连发):供应商 / 模型增减靠它感知。
5859
+ onOpenChange: (open) => {
5860
+ if (open)
5861
+ revalidateModelCatalog();
5862
+ },
5785
5863
  translate: props.translate,
5786
5864
  onChange: emitModel
5787
5865
  });
@@ -5801,6 +5879,11 @@ function ModelPicker(props) {
5801
5879
  size: props.size,
5802
5880
  placement: props.placement,
5803
5881
  className: props.providerClassName,
5882
+ // 打开下拉就补拉目录(核心内部 30s 节流,快速开关不会连发):供应商 / 模型增减靠它感知。
5883
+ onOpenChange: (open) => {
5884
+ if (open)
5885
+ revalidateModelCatalog();
5886
+ },
5804
5887
  translate: props.translate,
5805
5888
  onChange: (v) => {
5806
5889
  setPickedProvider(typeof v === "string" ? v : v[0] ?? "");
@@ -5822,6 +5905,11 @@ function ModelPicker(props) {
5822
5905
  size: props.size,
5823
5906
  placement: props.placement,
5824
5907
  className: props.modelClassName,
5908
+ // 打开下拉就补拉目录(核心内部 30s 节流,快速开关不会连发):供应商 / 模型增减靠它感知。
5909
+ onOpenChange: (open) => {
5910
+ if (open)
5911
+ revalidateModelCatalog();
5912
+ },
5825
5913
  translate: props.translate,
5826
5914
  onChange: emitModel
5827
5915
  }));
@@ -8969,7 +9057,7 @@ var onVisibilityChange = () => {
8969
9057
  for (const l of [...tickerListeners])
8970
9058
  l();
8971
9059
  };
8972
- var visibilityBound = false;
9060
+ var visibilityBound2 = false;
8973
9061
  function subscribeTicker(cb) {
8974
9062
  tickerListeners.add(cb);
8975
9063
  if (tickerTimer === null) {
@@ -8977,9 +9065,9 @@ function subscribeTicker(cb) {
8977
9065
  for (const l of [...tickerListeners])
8978
9066
  l();
8979
9067
  }, 1e3);
8980
- if (!visibilityBound && typeof document !== "undefined") {
9068
+ if (!visibilityBound2 && typeof document !== "undefined") {
8981
9069
  document.addEventListener("visibilitychange", onVisibilityChange);
8982
- visibilityBound = true;
9070
+ visibilityBound2 = true;
8983
9071
  }
8984
9072
  }
8985
9073
  return () => {
@@ -63905,8 +63993,8 @@ var docData = {
63905
63993
  "en": "\xA72 Use a control: a generic `Picker` takes its options from the caller (`priorities` in the example, not a model catalog)."
63906
63994
  },
63907
63995
  {
63908
- "zh": "\xA72 \u9644\uFF1A\u9009\u6A21\u578B\u4E0D\u8981\u624B\u6413\u6570\u7EC4 \u2014\u2014 \u5BBF\u4E3B `serveModelCatalog(ctx, { path })` \u6CE8\u518C\u53EA\u8BFB\u76EE\u5F55\u8DEF\u7531\uFF0Cclient `connectHost(ctx, { modelsPath: path })` \u7528\u540C\u4E00\u4E2A path \u5E38\u91CF\u63A5\u4E0A\uFF0C\u518D\u6E32\u67D3 `ModelPicker`\uFF1B\u4F9B\u5E94\u5546 / \u6A21\u578B\u6709\u589E\u51CF\u8C03 `await refreshModelCatalog()` \u91CD\u62C9\u3002\u6F0F\u4E86 `modelsPath` \u5C31\u662F\u7A7A\u76EE\u5F55\uFF0C\u4E14\u4E0D\u4F1A\u6709\u62A5\u9519\u3002",
63909
- "en": "\xA72a Model selection: never hand-roll a models array. Register `serveModelCatalog(ctx, { path })` on the host, call `connectHost(ctx, { modelsPath: path })` on the client with the same path constant, then render `ModelPicker`. `await refreshModelCatalog()` re-pulls the catalog when providers change. Omitting `modelsPath` leaves the catalog empty, silently."
63996
+ "zh": "\xA72 \u9644\uFF1A\u9009\u6A21\u578B\u4E0D\u8981\u624B\u6413\u6570\u7EC4 \u2014\u2014 \u5BBF\u4E3B `serveModelCatalog(ctx, { path })` \u6CE8\u518C\u53EA\u8BFB\u76EE\u5F55\u8DEF\u7531\uFF0Cclient `connectHost(ctx, { modelsPath: path })` \u7528\u540C\u4E00\u4E2A path \u5E38\u91CF\u63A5\u4E0A\uFF0C\u518D\u6E32\u67D3 `ModelPicker`\uFF1B\u9996\u62C9\u5931\u8D25\u6838\u5FC3\u4F1A\u9000\u907F\u91CD\u8BD5 3 \u6B21\uFF0C\u4F9B\u5E94\u5546 / \u6A21\u578B\u6709\u589E\u51CF\u65F6\u6253\u5F00\u9009\u62E9\u5668\u6216\u5207\u56DE\u9875\u9762\u4F1A\u81EA\u52A8\u8865\u62C9\uFF0830s \u8282\u6D41\uFF09\uFF0C\u8981\u7ACB\u523B\u5237\u65B0\u518D\u8C03 `await refreshModelCatalog()`\u3002\u6F0F\u4E86 `modelsPath` \u5C31\u662F\u7A7A\u76EE\u5F55\uFF0C\u4E14\u4E0D\u4F1A\u6709\u62A5\u9519\u3002",
63997
+ "en": "\xA72a Model selection: never hand-roll a models array. Register `serveModelCatalog(ctx, { path })` on the host, call `connectHost(ctx, { modelsPath: path })` on the client with the same path constant, then render `ModelPicker`. The first load retries 3 times with backoff; opening the picker or returning to the page re-pulls when providers change (throttled to once per 30s), and `await refreshModelCatalog()` forces an immediate refresh. Omitting `modelsPath` leaves the catalog empty, silently."
63910
63998
  },
63911
63999
  {
63912
64000
  "zh": "\xA73 \u7528\u901A\u7528\u65B9\u6CD5",
@@ -64355,8 +64443,8 @@ var docData = {
64355
64443
  "en": "WorkspacePicker: a domain picker that brings its own data. Call `connectHost(ctx)` once in the plugin apply and it subscribes to the official `workspaces` snapshot. Unwired = empty state, never fabricated data. Trigger and search-box sizing (`width` / `minWidth` / `maxWidth` / `searchSizing`) matches Picker; `translate` overrides all built-in copy in the component and its dropdown."
64356
64444
  },
64357
64445
  {
64358
- "zh": "ModelPicker\uFF1A\u9009\u62E9\u6A21\u578B\u7684\u5B8C\u6574\u5C01\u88C5\uFF0C\u4E09\u79CD\u5F62\u6001\u5171\u7528\u540C\u4E00\u4EFD\u5BBF\u4E3B\u76EE\u5F55\uFF0C`onChange` \u4E00\u5F8B\u53D1 `provider/id`\uFF1A`grouped`\uFF08\u9ED8\u8BA4\uFF09= \u4E00\u4E2A\u4E0B\u62C9\u3001\u4F9B\u5E94\u5546\u505A\u7EC4\u5934\uFF1B`flat` = \u4E00\u4E2A\u4E0B\u62C9\u3001\u5168\u90E8\u6A21\u578B\u5E73\u94FA\u6210\u300C\u5382\u5546-\u6A21\u578B\u300D\u5E76\u5E26\u641C\u7D22\uFF0C\u641C\u5382\u5546\u540D\u5373\u53EF\u7B5B\uFF1B`cascade` = \u4E24\u4E2A\u4E0B\u62C9\u8054\u52A8\uFF0C\u5382\u5546\u6846\u4E0E\u6A21\u578B\u6846\u90FD\u5E26\u641C\u7D22\uFF0C\u6362\u5382\u5546\u6E05\u7A7A\u6A21\u578B\u3002**\u63A5\u7EBF\u662F\u4E24\u6BB5\u5F0F**\uFF1A\u5BBF\u4E3B `serveModelCatalog(ctx, { path })` + client `connectHost(ctx, { modelsPath: path })` \u7528\u540C\u4E00\u4E2A path \u5E38\u91CF\uFF0C\u6F0F\u4E86 `modelsPath` \u76EE\u5F55\u6C38\u8FDC\u505C\u5728 loading\uFF1B\u4F9B\u5E94\u5546 / \u6A21\u578B\u6709\u589E\u51CF\u65F6 `await refreshModelCatalog()` \u91CD\u62C9\u3002`width` / `minWidth` / `maxWidth` \u7BA1\u89E6\u53D1\u5668\uFF0C`searchSizing` \u7BA1\u6240\u6709\u641C\u7D22\u6846\uFF0C`providerSizing` / `modelSizing` \u8BA9\u8054\u52A8\u6001\u4E24\u4E2A\u6846\u5206\u522B\u8BBE\u5BBD\u3002\u65E7\u503C\u5DF2\u4E0D\u5728\u76EE\u5F55\u91CC\u65F6\u6309\u771F\u5B9E\u503C\u4FDD\u7559\u4E00\u9879\u5E76\u5982\u5B9E\u63D0\u793A\u300C\u5019\u9009\u53EF\u80FD\u4E0D\u5B8C\u6574\u300D\uFF0C\u4E0D\u9759\u9ED8\u4E22\u5F03\u3002",
64359
- "en": 'ModelPicker: the complete model selector. Three variants share one host catalog and always emit `provider/id`: `grouped` (default) groups models under provider headers in one dropdown; `flat` lists every model as `vendor-model` in one searchable dropdown; `cascade` links two searchable dropdowns (provider then model). **Wiring is two-sided**: `serveModelCatalog(ctx, { path })` on the host and `connectHost(ctx, { modelsPath: path })` on the client with the same path constant \u2014 without `modelsPath` the catalog stays `loading` forever; `await refreshModelCatalog()` re-pulls it when providers change. `width`/`minWidth`/`maxWidth` size triggers, `searchSizing` sizes every search box, and `providerSizing`/`modelSizing` size the two cascade boxes separately. A controlled value no longer present in the catalog is retained as-is with an honest "candidates may be incomplete" hint instead of being silently dropped.'
64446
+ "zh": "ModelPicker\uFF1A\u9009\u62E9\u6A21\u578B\u7684\u5B8C\u6574\u5C01\u88C5\uFF0C\u4E09\u79CD\u5F62\u6001\u5171\u7528\u540C\u4E00\u4EFD\u5BBF\u4E3B\u76EE\u5F55\uFF0C`onChange` \u4E00\u5F8B\u53D1 `provider/id`\uFF1A`grouped`\uFF08\u9ED8\u8BA4\uFF09= \u4E00\u4E2A\u4E0B\u62C9\u3001\u4F9B\u5E94\u5546\u505A\u7EC4\u5934\uFF1B`flat` = \u4E00\u4E2A\u4E0B\u62C9\u3001\u5168\u90E8\u6A21\u578B\u5E73\u94FA\u6210\u300C\u5382\u5546-\u6A21\u578B\u300D\u5E76\u5E26\u641C\u7D22\uFF0C\u641C\u5382\u5546\u540D\u5373\u53EF\u7B5B\uFF1B`cascade` = \u4E24\u4E2A\u4E0B\u62C9\u8054\u52A8\uFF0C\u5382\u5546\u6846\u4E0E\u6A21\u578B\u6846\u90FD\u5E26\u641C\u7D22\uFF0C\u6362\u5382\u5546\u6E05\u7A7A\u6A21\u578B\u3002**\u63A5\u7EBF\u662F\u4E24\u6BB5\u5F0F**\uFF1A\u5BBF\u4E3B `serveModelCatalog(ctx, { path })` + client `connectHost(ctx, { modelsPath: path })` \u7528\u540C\u4E00\u4E2A path \u5E38\u91CF\uFF0C\u6F0F\u4E86 `modelsPath` \u76EE\u5F55\u6C38\u8FDC\u505C\u5728 loading\uFF1B\u4F9B\u5E94\u5546 / \u6A21\u578B\u6709\u589E\u51CF\u65F6 `await refreshModelCatalog()` \u91CD\u62C9\u3002`width` / `minWidth` / `maxWidth` \u7BA1\u89E6\u53D1\u5668\uFF0C`searchSizing` \u7BA1\u6240\u6709\u641C\u7D22\u6846\uFF0C`providerSizing` / `modelSizing` \u8BA9\u8054\u52A8\u6001\u4E24\u4E2A\u6846\u5206\u522B\u8BBE\u5BBD\u3002\u65E7\u503C\u5DF2\u4E0D\u5728\u76EE\u5F55\u91CC\u65F6\u6309\u771F\u5B9E\u503C\u4FDD\u7559\u4E00\u9879\u5E76\u5982\u5B9E\u63D0\u793A\u300C\u5019\u9009\u53EF\u80FD\u4E0D\u5B8C\u6574\u300D\uFF0C\u4E0D\u9759\u9ED8\u4E22\u5F03\u3002\u5BBF\u4E3B\u4FA7 `serveModelCatalog` \u7684 `getLlm` \u53EA\u662F\u53EF\u9009\u53D6\u503C\u8986\u76D6\uFF0C\u4E0D\u4F20\u65F6\u6838\u5FC3\u81EA\u884C\u6536\u53E3\uFF08ctx \u5931\u6D3B\u6309\u4E0D\u53EF\u7528\u56DE 503\uFF09\uFF0C\u6D88\u8D39\u65B9\u4E0D\u5FC5\u5404\u81EA\u9632\u3002\u9996\u62C9\u5931\u8D25\u6838\u5FC3\u4F1A\u9000\u907F\u91CD\u8BD5 3 \u6B21\uFF085xx / 429 / \u7F51\u7EDC\u9519\u8BEF\uFF1B403\u3001404 \u4E0D\u91CD\u8BD5\uFF09\uFF0C\u4E09\u6B21\u90FD\u5931\u8D25\u5C31\u505C\u5728\u964D\u7EA7\u6001\uFF1B\u6253\u5F00\u9009\u62E9\u5668 / \u5207\u56DE\u9875\u9762\u65F6\u6309 30s \u8282\u6D41\u81EA\u52A8\u8865\u62C9\uFF0C\u4E0D\u9700\u8981\u81EA\u5DF1\u8F6E\u8BE2\u3002",
64447
+ "en": 'ModelPicker: the complete model selector. Three variants share one host catalog and always emit `provider/id`: `grouped` (default) groups models under provider headers in one dropdown; `flat` lists every model as `vendor-model` in one searchable dropdown; `cascade` links two searchable dropdowns (provider then model). **Wiring is two-sided**: `serveModelCatalog(ctx, { path })` on the host and `connectHost(ctx, { modelsPath: path })` on the client with the same path constant \u2014 without `modelsPath` the catalog stays `loading` forever; `await refreshModelCatalog()` re-pulls it when providers change. `width`/`minWidth`/`maxWidth` size triggers, `searchSizing` sizes every search box, and `providerSizing`/`modelSizing` size the two cascade boxes separately. A controlled value no longer present in the catalog is retained as-is with an honest "candidates may be incomplete" hint instead of being silently dropped. The host-side `getLlm` on `serveModelCatalog` is only an optional override \u2014 the core handles a disposed ctx itself and answers 503, so consumers need not guard it. The first load retries up to 3 times with backoff (5xx / 429 / network only; 403 and 404 stop immediately) and then stays degraded; opening the picker or returning to the page re-pulls at most once per 30s, so no polling is needed.'
64360
64448
  }
64361
64449
  ],
64362
64450
  "api": [
@@ -71344,9 +71432,9 @@ function ReferencePage() {
71344
71432
  "tbody",
71345
71433
  null,
71346
71434
  [
71347
- [t3("buildCore"), `v${"0.35.13"}`],
71348
- [t3("buildDemo"), `v${"0.35.13"}`],
71349
- [t3("buildStamp"), "261110-080713-415"]
71435
+ [t3("buildCore"), `v${"0.35.15"}`],
71436
+ [t3("buildDemo"), `v${"0.35.15"}`],
71437
+ [t3("buildStamp"), "261110-090343-552"]
71350
71438
  ].map(
71351
71439
  ([label, value]) => (0, import_react98.createElement)(
71352
71440
  "tr",
@@ -71662,9 +71750,9 @@ function DemoPage() {
71662
71750
  lineHeight: "14px"
71663
71751
  }
71664
71752
  },
71665
- (0, import_react100.createElement)("span", null, `core v${"0.35.13"}`),
71666
- (0, import_react100.createElement)("span", null, `demo v${"0.35.13"}`),
71667
- (0, import_react100.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261110-080713-415")
71753
+ (0, import_react100.createElement)("span", null, `core v${"0.35.15"}`),
71754
+ (0, import_react100.createElement)("span", null, `demo v${"0.35.15"}`),
71755
+ (0, import_react100.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261110-090343-552")
71668
71756
  )
71669
71757
  )
71670
71758
  ),
package/dist/index.js CHANGED
@@ -1108,6 +1108,16 @@ async function buildModelRoutes(llm) {
1108
1108
  return routes;
1109
1109
  }
1110
1110
  var JSON_HEADERS = { "content-type": "application/json; charset=utf-8" };
1111
+ function resolveLlm(ctx, options) {
1112
+ const fromHook = options.getLlm?.();
1113
+ if (fromHook !== void 0)
1114
+ return fromHook;
1115
+ try {
1116
+ return ctx.get?.("llm");
1117
+ } catch {
1118
+ return void 0;
1119
+ }
1120
+ }
1111
1121
  function serveModelCatalog(ctx, options) {
1112
1122
  ctx.inject(["webServer"], (services) => {
1113
1123
  const webServer = services.webServer;
@@ -1122,7 +1132,7 @@ function serveModelCatalog(ctx, options) {
1122
1132
  res.end(JSON.stringify({ error: "forbidden" }));
1123
1133
  return;
1124
1134
  }
1125
- const llm = options.getLlm?.() ?? ctx.get?.("llm");
1135
+ const llm = resolveLlm(ctx, options);
1126
1136
  if (llm === void 0) {
1127
1137
  res.writeHead(503, JSON_HEADERS);
1128
1138
  res.end(JSON.stringify({ routes: [], error: "llm-unavailable" }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-core-demo",
3
- "version": "0.35.13",
3
+ "version": "0.35.15",
4
4
  "description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
5
5
  "icon": "./assets/icon-components.svg",
6
6
  "keywords": [