@inventec/dsh-copilot-auth 1.2.12 → 1.2.14

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/README.md CHANGED
@@ -33,7 +33,9 @@
33
33
 
34
34
  | 本插件 | DSH 实测版本 | authorization 服务 | 说明 |
35
35
  |---|---|---|---|
36
- | v1.2.12+ | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **交互打磨**:「补充模型」的全选按钮在全选中切换为「取消全选」(任一取消勾选即恢复「全选」);「重建」风险提示精简为一行;成功路径的「技术详情」计数移除(与弹窗增删列表重复),技术详情仅在真实失败时展示。其余同 v1.2.11 |
36
+ | v1.2.14+ | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **消除弹窗上下弹跳**:「拉取预览中…」物化指示改为**常驻占位行**(visibility 显隐,不插入/移除节点)——v1.2.13 固定高度解决了整卡伸缩,本版消除指示条插入/移除引起的垂直位移。其余同 v1.2.13 |
37
+ | v1.2.13 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **修复模型弹窗勾选闪烁**:勾选/全选触发的物化期间弹窗保持挂载(历史实现切回 `previewing` 导致弹窗整体卸载重挂——卡片闪现「拉取预览中」、滚动位置丢失,实测探针元素直接从 DOM 消失);弹窗改固定高度三段式(头部/内部滚动/常驻操作栏),尺寸不再随增删列表变化;勾选走本地乐观更新(服务端回显到达后对齐)。其余同 v1.2.12 |
38
+ | v1.2.12 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **交互打磨**:「补充模型」的全选按钮在全选中切换为「取消全选」(任一取消勾选即恢复「全选」);「重建」风险提示精简为一行;成功路径的「技术详情」计数移除(与弹窗增删列表重复),技术详情仅在真实失败时展示。其余同 v1.2.11 |
37
39
  | v1.2.11 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **界面收敛:移除「重新授权」按钮与 `capabilities.reauthorize` 能力位**(逻辑冗余——已登录只需退出登录,未登录入口本就是「授权登录」;换号/重授权=先退出再登录两步)。其余同 v1.2.10 |
38
40
  | v1.2.10 | `0.1.7-rc.2`+ | runtime 内置,插件不挂载 | **退出登录正式可用**:无进行中授权尝试且无未核实风险(风险锁存)时,经确认弹窗清除凭据并**删除后立即复核**(凭据未消失则如实报「退出未完成」);授权尝试进行中(begin 晚写窗口)与撤回/超时未核实期一律拒绝退出。`/status` 的 `authorization.capabilities.logout` 按可用性动态返回。经主人 2026-10-05 裁决替代 v1.2.8 D-01「退出全禁」策略 |
39
41
  | v1.2.9 | `0.1.7-rc.2`+(`0.2.0-rc.1` web 与 `0.2.0-rc.2` desktop 已实测) | runtime 内置,插件不挂载 | **修复 v1.2.8 授权页显示回归**:授权状态机漏接 `fetch`,页面恒显「未登录」、点「授权登录」恒「失败」且请求根本不发出(2026-10-04 实机实证,nginx 全量零 `POST /copilot-auth/start`)。另加:/status 加载失败退避自愈重试(60 秒转手动+「查询状态」)、失败原因分层展示(网络/网关/响应,不再裸「失败」)、已登录时服务端拒绝替换性授权(409 `already-configured`)且客户端自动恢复已登录视图 |
package/lib/client.js CHANGED
@@ -193,11 +193,11 @@ function reduce(state, event) {
193
193
  const p = state.preview;
194
194
  if (event.type === "select") {
195
195
  return [{
196
- name: "previewing",
196
+ name: "confirming",
197
197
  flags: state.flags ?? initial.flags,
198
- operation: p.operation,
199
- catalogSource: p.catalogSource,
200
- stale: false
198
+ preview: p,
199
+ materializing: true,
200
+ staleNotice: state.staleNotice
201
201
  }, {
202
202
  type: "preview",
203
203
  operation: p.operation,
@@ -207,12 +207,19 @@ function reduce(state, event) {
207
207
  confirmEmpty: event.confirmEmpty === true
208
208
  }];
209
209
  }
210
+ if (event.type === "preview-ok") {
211
+ return [{ name: "confirming", flags: state.flags ?? initial.flags, preview: event.preview, staleNotice: state.stale === true, materializing: false }, null];
212
+ }
213
+ if (event.type === "preview-fail") {
214
+ return [{ name: "failed", flags: state.flags ?? initial.flags, error: event.error }, null];
215
+ }
210
216
  if (event.type === "start") {
211
217
  return [{
212
- name: "previewing",
213
- operation: event.operation === "rebuild" ? "rebuild" : p.operation,
214
- catalogSource: event.catalogSource,
215
- stale: false
218
+ name: "confirming",
219
+ flags: state.flags ?? initial.flags,
220
+ preview: p,
221
+ materializing: true,
222
+ staleNotice: state.staleNotice
216
223
  }, {
217
224
  type: "preview",
218
225
  operation: event.operation === "rebuild" ? "rebuild" : p.operation,
@@ -220,6 +227,7 @@ function reduce(state, event) {
220
227
  }];
221
228
  }
222
229
  if (event.type === "confirm") {
230
+ if (state.materializing) return [state, null];
223
231
  const isRebuild = p.operation === "rebuild";
224
232
  const emptyTarget = isRebuild && (p.diff?.targetView?.models ?? []).length === 0;
225
233
  if (isRebuild && event.second !== true) return [state, null];
@@ -853,13 +861,21 @@ function sampleThemeSurface() {
853
861
  const bg = m ? `rgb(${m[1].split(",").slice(0, 3).join(",")})` : "#fff";
854
862
  return { bg, fg: cs.color || "inherit" };
855
863
  }
856
- function RefreshModal({ t, flow, onSelect, onConfirm, onCancel, onOverlay }) {
864
+ function RefreshModal({ t, flow, materializing, onSelect, onConfirm, onCancel, onOverlay }) {
857
865
  const p = flow.preview;
858
866
  const diff = p.diff ?? {};
859
867
  const isRebuild = p.operation === "rebuild";
860
868
  const emptyTarget = isRebuild && (diff.targetView?.models ?? []).length === 0;
861
869
  const candidates = diff.candidates ?? [];
862
- const selectedIds = new Set(diff.added ?? []);
870
+ const [localSel, setLocalSel] = (0, import_react.useState)(null);
871
+ (0, import_react.useEffect)(() => {
872
+ setLocalSel(null);
873
+ }, [p.diff]);
874
+ const selectedIds = new Set(localSel ?? (diff.added ?? []));
875
+ const emitSel = (ids) => {
876
+ setLocalSel(new Set(ids));
877
+ onSelect(ids);
878
+ };
863
879
  const [stage, setStage] = (0, import_react.useState)(0);
864
880
  const cancelRef = (0, import_react.useRef)(null);
865
881
  const surface = (0, import_react.useRef)(null);
@@ -894,114 +910,122 @@ function RefreshModal({ t, flow, onSelect, onConfirm, onCancel, onOverlay }) {
894
910
  p.catalogSource === "latest" ? t("srcLatest") : p.catalogSource === "overlay" ? t("srcOverlay") : t("srcLocal")
895
911
  ].filter(Boolean).join(" \xB7 ");
896
912
  const list = (items, style, render) => items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { opacity: 0.6 }, children: t("none") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: styles.diffList, children: items.map((x, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { style: { ...style, ...styles.mono }, children: render ? render(x) : x }, x?.id ?? x ?? i)) });
897
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: styles.modalMask, role: "dialog", "aria-modal": "true", onKeyDown: escCancel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { ...styles.modal, background: surface.current.bg, color: surface.current.fg }, children: [
898
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { style: styles.modalTitle, children: t(isRebuild ? "rebuildTitle" : "supplementTitle") }),
899
- flow.staleNotice && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.banner, children: [
900
- "\u26A0 ",
901
- t("previewStale")
902
- ] }),
903
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: styles.modalText, children: sourceLine }),
904
- p.evidence?.stale === true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.banner, children: [
905
- "\u26A0 ",
906
- t("srcStale")
907
- ] }),
908
- !isRebuild && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
909
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
910
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("candidates") }),
911
- "\uFF08",
912
- candidates.length,
913
- "\uFF09",
914
- candidates.length > 0 && (() => {
915
- const allSelected = candidates.every((id) => selectedIds.has(id));
916
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", style: { ...styles.button, ...styles.secondary, height: 24, marginLeft: 10, fontSize: 12 }, onClick: () => onSelect(allSelected ? [] : candidates), children: allSelected ? t("selectNone") : t("selectAll") });
917
- })()
913
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: styles.modalMask, role: "dialog", "aria-modal": "true", onKeyDown: escCancel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { ...styles.modal, background: surface.current.bg, color: surface.current.fg, height: "min(80vh, 680px)", padding: 0, overflow: "hidden" }, children: [
914
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { padding: "18px 20px 6px" }, children: [
915
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h4", { style: styles.modalTitle, children: t(isRebuild ? "rebuildTitle" : "supplementTitle") }),
916
+ flow.staleNotice && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.banner, children: [
917
+ "\u26A0 ",
918
+ t("previewStale")
918
919
  ] }),
919
- list(candidates, styles.added, (id) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
920
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: selectedIds.has(id), onChange: () => {
921
- const next = new Set(selectedIds);
922
- if (next.has(id)) next.delete(id);
923
- else next.add(id);
924
- onSelect([...next]);
925
- } }),
926
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: id })
927
- ] })),
928
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
920
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: styles.modalText, children: sourceLine }),
921
+ p.evidence?.stale === true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.banner, children: [
929
922
  "\u26A0 ",
930
- t("supplementRisk")
923
+ t("srcStale")
924
+ ] }),
925
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: { ...styles.banner, minHeight: 20, visibility: materializing ? "visible" : "hidden" }, children: [
926
+ "\u24D8 ",
927
+ t("refreshing")
931
928
  ] })
932
929
  ] }),
933
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
934
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("addedModels") }),
935
- "\uFF08",
936
- (diff.added ?? []).length,
937
- "\uFF09"
938
- ] }),
939
- list(diff.added ?? [], styles.added),
940
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
941
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("removedModels") }),
942
- "\uFF08",
943
- (diff.removed ?? []).length,
944
- "\uFF09"
945
- ] }),
946
- list(diff.removed ?? [], styles.removed, (x) => `${x.id} \u2014 ${t(x.reason === "unresolvable" ? "removedUnresolvable" : "removedAccount")}`),
947
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
948
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("keptModels") }),
949
- "\uFF08",
950
- (diff.kept ?? []).length,
951
- "\uFF09"
952
- ] }),
953
- (diff.warnings ?? []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
930
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { flex: 1, overflowY: "auto", minHeight: 0, scrollbarGutter: "stable", padding: "0 20px", opacity: materializing ? 0.55 : 1, pointerEvents: materializing ? "none" : "auto" }, children: [
931
+ !isRebuild && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
932
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
933
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("candidates") }),
934
+ "\uFF08",
935
+ candidates.length,
936
+ "\uFF09",
937
+ candidates.length > 0 && (() => {
938
+ const allSelected = candidates.every((id) => selectedIds.has(id));
939
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", style: { ...styles.button, ...styles.secondary, height: 24, marginLeft: 10, fontSize: 12 }, onClick: () => emitSel(allSelected ? [] : candidates), children: allSelected ? t("selectNone") : t("selectAll") });
940
+ })()
941
+ ] }),
942
+ list(candidates, styles.added, (id) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
943
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", checked: selectedIds.has(id), onChange: () => {
944
+ const next = new Set(selectedIds);
945
+ if (next.has(id)) next.delete(id);
946
+ else next.add(id);
947
+ emitSel([...next]);
948
+ } }),
949
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: id })
950
+ ] })),
951
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
952
+ "\u26A0 ",
953
+ t("supplementRisk")
954
+ ] })
955
+ ] }),
954
956
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
955
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("warnings") }),
957
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("addedModels") }),
956
958
  "\uFF08",
957
- diff.warnings.length,
959
+ (diff.added ?? []).length,
958
960
  "\uFF09"
959
961
  ] }),
960
- list(diff.warnings, styles.skipped, (w) => `${w.id ?? ""} \u2014 ${w.reason ?? ""}`)
961
- ] }),
962
- isRebuild && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
963
- "\u26A0 ",
964
- t("rebuildRisk")
965
- ] }),
966
- emptyTarget && stage >= 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
967
- "\u26A0 ",
968
- t("clearRisk")
969
- ] }),
970
- stage === 1 && !emptyTarget && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
971
- "\u26A0 ",
972
- t("secondConfirm")
973
- ] }),
974
- (p.skipped ?? []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { style: styles.modalText, children: [
975
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
976
- t("skippedModels"),
962
+ list(diff.added ?? [], styles.added),
963
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
964
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("removedModels") }),
977
965
  "\uFF08",
978
- p.skipped.length,
966
+ (diff.removed ?? []).length,
979
967
  "\uFF09"
980
968
  ] }),
981
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: styles.diffList, children: p.skipped.map((s) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { style: styles.skipped, children: [
982
- s.id,
983
- " \u2014 ",
984
- s.reason
985
- ] }, s.id)) })
986
- ] }),
987
- p.catalogError && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { style: styles.modalText, children: [
988
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: t("techDetails") }),
989
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { ...styles.mono, fontSize: 12 }, children: p.catalogError })
969
+ list(diff.removed ?? [], styles.removed, (x) => `${x.id} \u2014 ${t(x.reason === "unresolvable" ? "removedUnresolvable" : "removedAccount")}`),
970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
971
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("keptModels") }),
972
+ "\uFF08",
973
+ (diff.kept ?? []).length,
974
+ "\uFF09"
975
+ ] }),
976
+ (diff.warnings ?? []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
977
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.modalText, children: [
978
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("warnings") }),
979
+ "\uFF08",
980
+ diff.warnings.length,
981
+ "\uFF09"
982
+ ] }),
983
+ list(diff.warnings, styles.skipped, (w) => `${w.id ?? ""} \u2014 ${w.reason ?? ""}`)
984
+ ] }),
985
+ isRebuild && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
986
+ "\u26A0 ",
987
+ t("rebuildRisk")
988
+ ] }),
989
+ emptyTarget && stage >= 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
990
+ "\u26A0 ",
991
+ t("clearRisk")
992
+ ] }),
993
+ stage === 1 && !emptyTarget && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: styles.risk, children: [
994
+ "\u26A0 ",
995
+ t("secondConfirm")
996
+ ] }),
997
+ (p.skipped ?? []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { style: styles.modalText, children: [
998
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("summary", { children: [
999
+ t("skippedModels"),
1000
+ "\uFF08",
1001
+ p.skipped.length,
1002
+ "\uFF09"
1003
+ ] }),
1004
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: styles.diffList, children: p.skipped.map((s) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { style: styles.skipped, children: [
1005
+ s.id,
1006
+ " \u2014 ",
1007
+ s.reason
1008
+ ] }, s.id)) })
1009
+ ] }),
1010
+ p.catalogError && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { style: styles.modalText, children: [
1011
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: t("techDetails") }),
1012
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { ...styles.mono, fontSize: 12 }, children: p.catalogError })
1013
+ ] })
990
1014
  ] }),
991
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: styles.modalActions, children: [
1015
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "8px 20px 16px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: styles.modalActions, children: [
992
1016
  p.catalogSource === "local" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", style: { ...styles.button, ...styles.secondary, marginRight: "auto" }, onClick: onOverlay, children: t("overlayBtn") }),
993
1017
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { ref: cancelRef, type: "button", style: { ...styles.button, ...styles.secondary }, onClick: onCancel, children: t("cancel") }),
994
1018
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
995
1019
  "button",
996
1020
  {
997
1021
  type: "button",
998
- style: { ...styles.button, ...styles.primary, ...p.evidence?.stale === true ? { opacity: 0.5, cursor: "not-allowed" } : null },
999
- disabled: p.evidence?.stale === true,
1022
+ style: { ...styles.button, ...styles.primary, ...p.evidence?.stale === true || materializing ? { opacity: 0.5, cursor: "not-allowed" } : null },
1023
+ disabled: p.evidence?.stale === true || materializing,
1000
1024
  onClick: confirmClick,
1001
1025
  children: t("applyChanges")
1002
1026
  }
1003
1027
  )
1004
- ] })
1028
+ ] }) })
1005
1029
  ] }) });
1006
1030
  }
1007
1031
  function RetireDialog({ t, onConfirm, onCancel }) {
@@ -1246,6 +1270,7 @@ function CopilotSection({ t = (key) => DICTS.en[key] ?? key }) {
1246
1270
  {
1247
1271
  t,
1248
1272
  flow,
1273
+ materializing: flow.materializing === true,
1249
1274
  onSelect: (selectedIds) => drive({ type: "select", selectedIds }),
1250
1275
  onConfirm: (opts) => drive({ type: "confirm", ...opts }),
1251
1276
  onCancel: () => drive({ type: "cancel" }),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inventec/dsh-copilot-auth",
3
- "version": "1.2.12",
4
- "description": "为内置 Copilot 提供方补设备码登录设置页,预置开箱路由;凭据入内置凭据库,模型目录兜底不覆盖定制。v1.2.12:补充模型全选/取消全选互斥切换、重建风险提示精简一行、成功路径技术详情移除(失败诊断保留)。v1.2.10:退出登录正式可用(协议 v2)。适配 DSH 0.1.7+(≤0.1.5 请用 1.1.x)。",
3
+ "version": "1.2.14",
4
+ "description": "为内置 Copilot 提供方补设备码登录设置页,预置开箱路由;凭据入内置凭据库,模型目录兜底不覆盖定制。v1.2.14:物化指示改常驻占位行(显隐不挤占布局),消除弹窗上下弹跳。v1.2.13:修复勾选闪烁(弹窗保持挂载+固定高度)。适配 DSH 0.1.7+(≤0.1.5 请用 1.1.x)。",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "iasi",
@@ -95,13 +95,15 @@ export function reduce(state, event) {
95
95
  case "confirming": {
96
96
  const p = state.preview;
97
97
  if (event.type === "select") {
98
- // 选择变化:从原快照 materialize(服务端重算,沿用原有效期,不重新取数)
98
+ // 选择变化:从原快照 materialize(服务端重算,沿用原有效期,不重新取数)。
99
+ // 留在 confirming+materializing 标记——弹窗保持挂载、不卸载重挂;
100
+ // 历史实现切回 previewing 导致弹窗整体关闭再打开(勾选闪烁的根因,2026-10-05)。
99
101
  return [{
100
- name: "previewing",
102
+ name: "confirming",
101
103
  flags: state.flags ?? initial.flags,
102
- operation: p.operation,
103
- catalogSource: p.catalogSource,
104
- stale: false,
104
+ preview: p,
105
+ materializing: true,
106
+ staleNotice: state.staleNotice,
105
107
  }, {
106
108
  type: "preview",
107
109
  operation: p.operation,
@@ -111,13 +113,22 @@ export function reduce(state, event) {
111
113
  confirmEmpty: event.confirmEmpty === true,
112
114
  }];
113
115
  }
116
+ if (event.type === "preview-ok") {
117
+ // materialize/切源完成:预览原位替换(新 previewId 绑定新选择)
118
+ return [{ name: "confirming", flags: state.flags ?? initial.flags, preview: event.preview, staleNotice: state.stale === true, materializing: false }, null];
119
+ }
120
+ if (event.type === "preview-fail") {
121
+ return [{ name: "failed", flags: state.flags ?? initial.flags, error: event.error }, null];
122
+ }
114
123
  if (event.type === "start") {
115
- // 显式切源(overlay/local)或切换操作:生成全新预览(不隐式降级,Q7)
124
+ // 显式切源(overlay/local)或切换操作:生成全新预览(不隐式降级,Q7)。
125
+ // 同 select:留在 confirming 保持弹窗挂载。
116
126
  return [{
117
- name: "previewing",
118
- operation: event.operation === "rebuild" ? "rebuild" : p.operation,
119
- catalogSource: event.catalogSource,
120
- stale: false,
127
+ name: "confirming",
128
+ flags: state.flags ?? initial.flags,
129
+ preview: p,
130
+ materializing: true,
131
+ staleNotice: state.staleNotice,
121
132
  }, {
122
133
  type: "preview",
123
134
  operation: event.operation === "rebuild" ? "rebuild" : p.operation,
@@ -125,6 +136,7 @@ export function reduce(state, event) {
125
136
  }];
126
137
  }
127
138
  if (event.type === "confirm") {
139
+ if (state.materializing) return [state, null]; // 物化中不得用旧 previewId 应用
128
140
  const isRebuild = p.operation === "rebuild";
129
141
  const emptyTarget = isRebuild && (p.diff?.targetView?.models ?? []).length === 0;
130
142
  if (isRebuild && event.second !== true) return [state, null]; // 重建需二次确认