@jingyi0605/codingns4dsh 0.2.1-rc.4 → 0.2.1-rc.6

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 (239) hide show
  1. package/README.en.md +4 -4
  2. package/README.md +5 -5
  3. package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.d.ts +1 -1
  4. package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.js +1 -1
  5. package/data/build/dist/client/bundle.js +1808 -221
  6. package/data/build/dist/client/bundle.js.map +1 -1
  7. package/data/build/dist/client/cli-session-config-cache.d.ts.map +1 -1
  8. package/data/build/dist/client/cli-session-config-cache.js +9 -3
  9. package/data/build/dist/client/cli-session-config-cache.js.map +1 -1
  10. package/data/build/dist/client/cli-slots.js +2 -2
  11. package/data/build/dist/client/cli-slots.js.map +1 -1
  12. package/data/build/dist/client/client.delegate-command.js +3 -2
  13. package/data/build/dist/client/client.delegate-command.js.map +1 -1
  14. package/data/build/dist/client/client.magpie-model-tag.js +24 -8
  15. package/data/build/dist/client/client.magpie-model-tag.js.map +1 -1
  16. package/data/build/dist/client/client.native-workspace-store.js +32 -15
  17. package/data/build/dist/client/client.native-workspace-store.js.map +1 -1
  18. package/data/build/dist/client/client.session-translation.js +25 -0
  19. package/data/build/dist/client/client.session-translation.js.map +1 -1
  20. package/data/build/dist/client/client.transport.js +266 -50
  21. package/data/build/dist/client/client.transport.js.map +1 -1
  22. package/data/build/dist/client/delegate-command.js +2 -1
  23. package/data/build/dist/client/delegate-command.js.map +1 -1
  24. package/data/build/dist/client/desktop-assistant.js +264 -48
  25. package/data/build/dist/client/features/cli-adapters.d.ts.map +1 -1
  26. package/data/build/dist/client/features/cli-adapters.js +13 -1
  27. package/data/build/dist/client/features/cli-adapters.js.map +1 -1
  28. package/data/build/dist/client/features/index.d.ts.map +1 -1
  29. package/data/build/dist/client/features/index.js +2 -0
  30. package/data/build/dist/client/features/index.js.map +1 -1
  31. package/data/build/dist/client/features/magpie-management-page.d.ts.map +1 -1
  32. package/data/build/dist/client/features/magpie-management-page.js +80 -31
  33. package/data/build/dist/client/features/magpie-management-page.js.map +1 -1
  34. package/data/build/dist/client/features/magpie-management.d.ts.map +1 -1
  35. package/data/build/dist/client/features/magpie-management.js +3 -2
  36. package/data/build/dist/client/features/magpie-management.js.map +1 -1
  37. package/data/build/dist/client/features/plugin-update.d.ts +3 -0
  38. package/data/build/dist/client/features/plugin-update.d.ts.map +1 -0
  39. package/data/build/dist/client/features/plugin-update.js +8 -0
  40. package/data/build/dist/client/features/plugin-update.js.map +1 -0
  41. package/data/build/dist/client/features/types.d.ts +3 -0
  42. package/data/build/dist/client/features/types.d.ts.map +1 -1
  43. package/data/build/dist/client/locale.d.ts.map +1 -1
  44. package/data/build/dist/client/locale.js +7 -0
  45. package/data/build/dist/client/locale.js.map +1 -1
  46. package/data/build/dist/client/locales/magpie.d.ts.map +1 -1
  47. package/data/build/dist/client/locales/magpie.js +60 -2
  48. package/data/build/dist/client/locales/magpie.js.map +1 -1
  49. package/data/build/dist/client/locales/panels.d.ts.map +1 -1
  50. package/data/build/dist/client/locales/panels.js +18 -0
  51. package/data/build/dist/client/locales/panels.js.map +1 -1
  52. package/data/build/dist/client/locales/pluginUpdate.d.ts +3 -0
  53. package/data/build/dist/client/locales/pluginUpdate.d.ts.map +1 -0
  54. package/data/build/dist/client/locales/pluginUpdate.js +131 -0
  55. package/data/build/dist/client/locales/pluginUpdate.js.map +1 -0
  56. package/data/build/dist/client/locales/usage.d.ts.map +1 -1
  57. package/data/build/dist/client/locales/usage.js +2 -0
  58. package/data/build/dist/client/locales/usage.js.map +1 -1
  59. package/data/build/dist/client/magpie-context-meter.d.ts +18 -0
  60. package/data/build/dist/client/magpie-context-meter.d.ts.map +1 -0
  61. package/data/build/dist/client/magpie-context-meter.js +274 -0
  62. package/data/build/dist/client/magpie-context-meter.js.map +1 -0
  63. package/data/build/dist/client/magpie-context-store.d.ts +32 -0
  64. package/data/build/dist/client/magpie-context-store.d.ts.map +1 -0
  65. package/data/build/dist/client/magpie-context-store.js +165 -0
  66. package/data/build/dist/client/magpie-context-store.js.map +1 -0
  67. package/data/build/dist/client/magpie-model-tag.d.ts +4 -2
  68. package/data/build/dist/client/magpie-model-tag.d.ts.map +1 -1
  69. package/data/build/dist/client/magpie-model-tag.js +25 -8
  70. package/data/build/dist/client/magpie-model-tag.js.map +1 -1
  71. package/data/build/dist/client/native-model-translation-menu.d.ts +1 -0
  72. package/data/build/dist/client/native-model-translation-menu.d.ts.map +1 -1
  73. package/data/build/dist/client/native-model-translation-menu.js +2 -2
  74. package/data/build/dist/client/native-model-translation-menu.js.map +1 -1
  75. package/data/build/dist/client/session-translation-chat.d.ts.map +1 -1
  76. package/data/build/dist/client/session-translation-chat.js +6 -2
  77. package/data/build/dist/client/session-translation-chat.js.map +1 -1
  78. package/data/build/dist/client/settings-promo-styles.d.ts +5 -0
  79. package/data/build/dist/client/settings-promo-styles.d.ts.map +1 -1
  80. package/data/build/dist/client/settings-promo-styles.js +15 -2
  81. package/data/build/dist/client/settings-promo-styles.js.map +1 -1
  82. package/data/build/dist/client/settings-promo.d.ts +4 -2
  83. package/data/build/dist/client/settings-promo.d.ts.map +1 -1
  84. package/data/build/dist/client/settings-promo.js +4 -4
  85. package/data/build/dist/client/settings-promo.js.map +1 -1
  86. package/data/build/dist/client/settings-section.d.ts +2 -3
  87. package/data/build/dist/client/settings-section.d.ts.map +1 -1
  88. package/data/build/dist/client/settings-section.js +12 -9
  89. package/data/build/dist/client/settings-section.js.map +1 -1
  90. package/data/build/dist/client/settings-update.d.ts +8 -0
  91. package/data/build/dist/client/settings-update.d.ts.map +1 -0
  92. package/data/build/dist/client/settings-update.js +57 -0
  93. package/data/build/dist/client/settings-update.js.map +1 -0
  94. package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
  95. package/data/build/dist/client/subscription-slot.js +47 -21
  96. package/data/build/dist/client/subscription-slot.js.map +1 -1
  97. package/data/build/dist/client/update-panel-styles.d.ts +29 -0
  98. package/data/build/dist/client/update-panel-styles.d.ts.map +1 -0
  99. package/data/build/dist/client/update-panel-styles.js +69 -0
  100. package/data/build/dist/client/update-panel-styles.js.map +1 -0
  101. package/data/build/dist/client/update-panel.d.ts +7 -0
  102. package/data/build/dist/client/update-panel.d.ts.map +1 -0
  103. package/data/build/dist/client/update-panel.js +52 -0
  104. package/data/build/dist/client/update-panel.js.map +1 -0
  105. package/data/build/dist/client/update-store.d.ts +43 -0
  106. package/data/build/dist/client/update-store.d.ts.map +1 -0
  107. package/data/build/dist/client/update-store.js +207 -0
  108. package/data/build/dist/client/update-store.js.map +1 -0
  109. package/data/build/dist/dsh-capabilities/client/plugin-reload-adapter.d.ts +4 -0
  110. package/data/build/dist/dsh-capabilities/client/plugin-reload-adapter.d.ts.map +1 -0
  111. package/data/build/dist/dsh-capabilities/client/plugin-reload-adapter.js +6 -0
  112. package/data/build/dist/dsh-capabilities/client/plugin-reload-adapter.js.map +1 -0
  113. package/data/build/dist/dsh-capabilities/client/session-performance-adapter.d.ts +15 -1
  114. package/data/build/dist/dsh-capabilities/client/session-performance-adapter.d.ts.map +1 -1
  115. package/data/build/dist/dsh-capabilities/client/session-performance-adapter.js +53 -21
  116. package/data/build/dist/dsh-capabilities/client/session-performance-adapter.js.map +1 -1
  117. package/data/build/dist/dsh-capabilities/host/plugin-update-adapter.d.ts +22 -0
  118. package/data/build/dist/dsh-capabilities/host/plugin-update-adapter.d.ts.map +1 -0
  119. package/data/build/dist/dsh-capabilities/host/plugin-update-adapter.js +71 -0
  120. package/data/build/dist/dsh-capabilities/host/plugin-update-adapter.js.map +1 -0
  121. package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.d.ts +4 -0
  122. package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.d.ts.map +1 -1
  123. package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.js +16 -1
  124. package/data/build/dist/dsh-capabilities/host/session-model-selection-adapter.js.map +1 -1
  125. package/data/build/dist/dsh-capabilities/matrix.d.ts.map +1 -1
  126. package/data/build/dist/dsh-capabilities/matrix.js +16 -12
  127. package/data/build/dist/dsh-capabilities/matrix.js.map +1 -1
  128. package/data/build/dist/dsh-capabilities/routes.d.ts.map +1 -1
  129. package/data/build/dist/dsh-capabilities/routes.js +19 -9
  130. package/data/build/dist/dsh-capabilities/routes.js.map +1 -1
  131. package/data/build/dist/dsh-capabilities/types.d.ts +1 -1
  132. package/data/build/dist/dsh-capabilities/types.d.ts.map +1 -1
  133. package/data/build/dist/dsh-capabilities/types.js.map +1 -1
  134. package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts.map +1 -1
  135. package/data/build/dist/host/cli-adapters/dsh-message-projector.js +5 -2
  136. package/data/build/dist/host/cli-adapters/dsh-message-projector.js.map +1 -1
  137. package/data/build/dist/host/cli-adapters/feature.d.ts.map +1 -1
  138. package/data/build/dist/host/cli-adapters/feature.js +181 -29
  139. package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
  140. package/data/build/dist/host/cli-adapters/magpie-context.d.ts +9 -0
  141. package/data/build/dist/host/cli-adapters/magpie-context.d.ts.map +1 -0
  142. package/data/build/dist/host/cli-adapters/magpie-context.js +128 -0
  143. package/data/build/dist/host/cli-adapters/magpie-context.js.map +1 -0
  144. package/data/build/dist/host/cli-adapters/magpie-update.d.ts.map +1 -1
  145. package/data/build/dist/host/cli-adapters/magpie-update.js +14 -4
  146. package/data/build/dist/host/cli-adapters/magpie-update.js.map +1 -1
  147. package/data/build/dist/host/cli-adapters/magpie-usage.d.ts +12 -2
  148. package/data/build/dist/host/cli-adapters/magpie-usage.d.ts.map +1 -1
  149. package/data/build/dist/host/cli-adapters/magpie-usage.js +120 -51
  150. package/data/build/dist/host/cli-adapters/magpie-usage.js.map +1 -1
  151. package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
  152. package/data/build/dist/host/cli-adapters/registry.js +6 -5
  153. package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
  154. package/data/build/dist/host/dsh-runtime-version.d.ts.map +1 -1
  155. package/data/build/dist/host/dsh-runtime-version.js +4 -1
  156. package/data/build/dist/host/dsh-runtime-version.js.map +1 -1
  157. package/data/build/dist/host/features/index.d.ts.map +1 -1
  158. package/data/build/dist/host/features/index.js +2 -0
  159. package/data/build/dist/host/features/index.js.map +1 -1
  160. package/data/build/dist/host/features/plugin-update.d.ts +6 -0
  161. package/data/build/dist/host/features/plugin-update.d.ts.map +1 -0
  162. package/data/build/dist/host/features/plugin-update.js +45 -0
  163. package/data/build/dist/host/features/plugin-update.js.map +1 -0
  164. package/data/build/dist/host/index.d.ts.map +1 -1
  165. package/data/build/dist/host/index.js +31 -1
  166. package/data/build/dist/host/index.js.map +1 -1
  167. package/data/build/dist/host/native-session-bridge.d.ts +8 -0
  168. package/data/build/dist/host/native-session-bridge.d.ts.map +1 -1
  169. package/data/build/dist/host/native-session-bridge.js +43 -0
  170. package/data/build/dist/host/native-session-bridge.js.map +1 -1
  171. package/data/build/dist/host/rpc.d.ts +4 -1
  172. package/data/build/dist/host/rpc.d.ts.map +1 -1
  173. package/data/build/dist/host/rpc.js +33 -7
  174. package/data/build/dist/host/rpc.js.map +1 -1
  175. package/data/build/dist/host/session-handle-eviction.d.ts +29 -0
  176. package/data/build/dist/host/session-handle-eviction.d.ts.map +1 -0
  177. package/data/build/dist/host/session-handle-eviction.js +413 -0
  178. package/data/build/dist/host/session-handle-eviction.js.map +1 -0
  179. package/data/build/dist/host/settings.d.ts.map +1 -1
  180. package/data/build/dist/host/settings.js +12 -1
  181. package/data/build/dist/host/settings.js.map +1 -1
  182. package/data/build/dist/host/update/application-result.d.ts +3 -0
  183. package/data/build/dist/host/update/application-result.d.ts.map +1 -0
  184. package/data/build/dist/host/update/application-result.js +13 -0
  185. package/data/build/dist/host/update/application-result.js.map +1 -0
  186. package/data/build/dist/host/update/http.d.ts +7 -0
  187. package/data/build/dist/host/update/http.d.ts.map +1 -0
  188. package/data/build/dist/host/update/http.js +55 -0
  189. package/data/build/dist/host/update/http.js.map +1 -0
  190. package/data/build/dist/host/update/metadata.d.ts +14 -0
  191. package/data/build/dist/host/update/metadata.d.ts.map +1 -0
  192. package/data/build/dist/host/update/metadata.js +75 -0
  193. package/data/build/dist/host/update/metadata.js.map +1 -0
  194. package/data/build/dist/host/update/release-notes.d.ts +6 -0
  195. package/data/build/dist/host/update/release-notes.d.ts.map +1 -0
  196. package/data/build/dist/host/update/release-notes.js +52 -0
  197. package/data/build/dist/host/update/release-notes.js.map +1 -0
  198. package/data/build/dist/host/update/service.d.ts +25 -0
  199. package/data/build/dist/host/update/service.d.ts.map +1 -0
  200. package/data/build/dist/host/update/service.js +209 -0
  201. package/data/build/dist/host/update/service.js.map +1 -0
  202. package/data/build/dist/shared/contracts/cli-adapter.d.ts +2 -0
  203. package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
  204. package/data/build/dist/shared/contracts/config.d.ts +17 -0
  205. package/data/build/dist/shared/contracts/config.d.ts.map +1 -1
  206. package/data/build/dist/shared/contracts/config.js +8 -0
  207. package/data/build/dist/shared/contracts/config.js.map +1 -1
  208. package/data/build/dist/shared/contracts/errors.d.ts +2 -2
  209. package/data/build/dist/shared/contracts/errors.d.ts.map +1 -1
  210. package/data/build/dist/shared/contracts/errors.js +1 -1
  211. package/data/build/dist/shared/contracts/errors.js.map +1 -1
  212. package/data/build/dist/shared/contracts/magpie-management.d.ts +40 -0
  213. package/data/build/dist/shared/contracts/magpie-management.d.ts.map +1 -1
  214. package/data/build/dist/shared/contracts/plugin-update.d.ts +93 -0
  215. package/data/build/dist/shared/contracts/plugin-update.d.ts.map +1 -0
  216. package/data/build/dist/shared/contracts/plugin-update.js +128 -0
  217. package/data/build/dist/shared/contracts/plugin-update.js.map +1 -0
  218. package/data/build/dist/shared/contracts/session-translation.d.ts +4 -0
  219. package/data/build/dist/shared/contracts/session-translation.d.ts.map +1 -1
  220. package/data/build/dist/shared/contracts/session-translation.js +21 -0
  221. package/data/build/dist/shared/contracts/session-translation.js.map +1 -1
  222. package/data/build/dist/shared/contracts/subscription.d.ts +3 -0
  223. package/data/build/dist/shared/contracts/subscription.d.ts.map +1 -1
  224. package/data/build/dist/shared/contracts/subscription.js.map +1 -1
  225. package/data/build/dist/shared/contracts/version.d.ts +7 -7
  226. package/data/build/dist/shared/contracts/version.d.ts.map +1 -1
  227. package/data/build/dist/shared/contracts/version.js +11 -17
  228. package/data/build/dist/shared/contracts/version.js.map +1 -1
  229. package/data/build/dist/shared/index.d.ts +1 -1
  230. package/data/build/dist/shared/index.d.ts.map +1 -1
  231. package/data/build/dist/shared/index.js +1 -1
  232. package/data/build/dist/shared/index.js.map +1 -1
  233. package/package.json +4 -3
  234. package/profile/README.md +6 -6
  235. package/profile/package.json +3 -3
  236. package/profile/scripts/check-dsh-install.mjs +14 -1
  237. package/profile/version.json +2 -2
  238. package/scripts/check-dsh-install.mjs +14 -1
  239. package/version.json +2 -2
@@ -4093,7 +4093,9 @@ window.__ModuleLoader__.load({
4093
4093
  flex: "none",
4094
4094
  alignItems: "center",
4095
4095
  justifyContent: "center",
4096
- width: "18px",
4096
+ minWidth: "18px",
4097
+ maxWidth: "45%",
4098
+ gap: "4px",
4097
4099
  height: "18px",
4098
4100
  marginInlineStart: "auto",
4099
4101
  whiteSpace: "nowrap",
@@ -4107,29 +4109,43 @@ window.__ModuleLoader__.load({
4107
4109
  objectFit: "contain",
4108
4110
  borderRadius: "4px"
4109
4111
  };
4112
+ const providerStyle = {
4113
+ minWidth: 0,
4114
+ overflow: "hidden",
4115
+ textOverflow: "ellipsis",
4116
+ fontSize: "12px",
4117
+ color: "var(--dsw-alias-label-secondary)"
4118
+ };
4110
4119
  /** Compact visual source marker shared by every model-list surface. */
4111
- function MagpieModelTag() {
4120
+ function MagpieModelTag(props) {
4112
4121
  return (0, react.createElement)("span", {
4113
4122
  [MAGPIE_MODEL_TAG_ATTRIBUTE]: "",
4114
4123
  role: "note",
4115
- "aria-label": "Provided by Magpie",
4116
- title: "Provided by Magpie",
4124
+ "aria-label": props.providerId ?? "Provided by Magpie",
4125
+ title: props.providerId ?? "Provided by Magpie",
4117
4126
  style: tagStyle
4118
- }, (0, react.createElement)("img", {
4127
+ }, props.providerId === void 0 ? null : (0, react.createElement)("span", { style: providerStyle }, props.providerId), (0, react.createElement)("img", {
4119
4128
  src: magpieModelLogoUrl(),
4120
4129
  alt: "Provided by Magpie",
4121
4130
  style: tagLogoStyle
4122
4131
  }));
4123
4132
  }
4124
4133
  /** Native DSH owns its menu DOM, so its option rows receive the same badge imperatively. */
4125
- function createMagpieModelTagNode(document, modelId) {
4134
+ function createMagpieModelTagNode(document, modelId, providerId) {
4126
4135
  const tag = document.createElement("span");
4127
4136
  tag.setAttribute(MAGPIE_MODEL_TAG_ATTRIBUTE, "");
4128
4137
  if (modelId !== void 0) tag.dataset.modelId = modelId;
4138
+ if (providerId !== void 0) tag.dataset.providerId = providerId;
4129
4139
  tag.setAttribute("role", "note");
4130
- tag.setAttribute("aria-label", "Provided by Magpie");
4131
- tag.title = "Provided by Magpie";
4140
+ tag.setAttribute("aria-label", providerId ?? "Provided by Magpie");
4141
+ tag.title = providerId ?? "Provided by Magpie";
4132
4142
  Object.assign(tag.style, tagStyle);
4143
+ if (providerId !== void 0) {
4144
+ const provider = document.createElement("span");
4145
+ provider.textContent = providerId;
4146
+ Object.assign(provider.style, providerStyle);
4147
+ tag.append(provider);
4148
+ }
4133
4149
  const logo = document.createElement("img");
4134
4150
  logo.setAttribute("src", magpieModelLogoUrl());
4135
4151
  logo.setAttribute("alt", "Provided by Magpie");
@@ -8352,13 +8368,13 @@ window.__ModuleLoader__.load({
8352
8368
  //#region src/shared/contracts/version.ts
8353
8369
  /** DSH verification target, synchronized with the root version.json. */
8354
8370
  const DSH_VERSION = "0.2.1-rc.3";
8371
+ /** DSH 测试版本别名,供新代码表达语义,保留 DSH_VERSION 兼容旧调用方。 */
8372
+ const DSH_TESTED_VERSION = DSH_VERSION;
8355
8373
  /**
8356
- * Supported hosts retain the 0.2.0-rc.2 floor and include 0.2.1-rc.2.
8357
- * Capability adapters preserve earlier subagent, peer and message contracts.
8358
- * Keep an explicit upper bound: a later prerelease requires verification before
8359
- * either installation checks or runtime capability selection may accept it.
8374
+ * Only the minimum version blocks installation and activation.
8375
+ * Hosts newer than DSH_TESTED_VERSION receive an advisory warning.
8360
8376
  */
8361
- const DSH_COMPATIBILITY = ">=0.2.0-rc.2 <=0.2.1-rc.3";
8377
+ const DSH_COMPATIBILITY = ">=0.2.0-rc.2";
8362
8378
  /**
8363
8379
  * 兼容范围下界,即插件仍然接受的最低 DSH 版本。
8364
8380
  *
@@ -8367,7 +8383,7 @@ window.__ModuleLoader__.load({
8367
8383
  * “不支持的 DSH 版本”,把仅仅缺少启动页注入的页面误判为宿主不兼容。
8368
8384
  */
8369
8385
  function minimumSupportedDshVersion() {
8370
- return /^>=([^ ]+)/u.exec(">=0.2.0-rc.2 <=0.2.1-rc.3")?.[1] ?? "0.2.1-rc.3";
8386
+ return /^>=([^ ]+)/u.exec(">=0.2.0-rc.2")?.[1] ?? "0.2.1-rc.3";
8371
8387
  }
8372
8388
  /** Host 注入到浏览器页面的真实 DSH 版本全局字段。 */
8373
8389
  const CODINGNS_DSH_VERSION_GLOBAL = "__CODINGNS_DSH_VERSION__";
@@ -8376,17 +8392,16 @@ window.__ModuleLoader__.load({
8376
8392
  return /^0\.1\.5(?:-|$)/u.test(version);
8377
8393
  }
8378
8394
  /** Codingns4DSH 插件自身的 npm 版本。 */
8379
- const CODINGNS_VERSION = "0.2.1-rc.4";
8380
- /** 判断宿主版本是否落在当前插件声明的 DSH 兼容范围内;范围省略上界时不校验上限。 */
8395
+ const CODINGNS_VERSION = "0.2.1-rc.6";
8396
+ /** Accept any valid host version at or above the supported minimum. */
8381
8397
  function isDshVersionCompatible(version) {
8382
- const match = /^>=([^ ]+)(?: <=([^ ]+))?$/u.exec(DSH_COMPATIBILITY);
8398
+ return isDshVersionAtLeast(version, minimumSupportedDshVersion());
8399
+ }
8400
+ /** Newer hosts stay enabled; this predicate controls advisory notices only. */
8401
+ function isDshVersionNewerThanTested(version) {
8383
8402
  const actual = parseVersion(version);
8384
- const minimum = parseVersion(match?.[1] ?? "");
8385
- if (match === null || !actual || !minimum) return version === DSH_VERSION;
8386
- if (match[2] === void 0) return compareVersions(actual, minimum) >= 0;
8387
- const maximum = parseVersion(match[2]);
8388
- if (maximum === void 0) return version === DSH_VERSION;
8389
- return compareVersions(actual, minimum) >= 0 && compareVersions(actual, maximum) <= 0;
8403
+ const tested = parseVersion(DSH_TESTED_VERSION);
8404
+ return actual !== void 0 && tested !== void 0 && compareVersions(actual, tested) > 0;
8390
8405
  }
8391
8406
  /** 判断 DSH 版本是否达到某个功能模块要求的最低版本。 */
8392
8407
  function isDshVersionAtLeast(version, minimum) {
@@ -8493,6 +8508,11 @@ window.__ModuleLoader__.load({
8493
8508
  enabled: false,
8494
8509
  maxConcurrentSubagents: 8
8495
8510
  };
8511
+ const DEFAULT_SESSION_HANDLE_EVICTION_SETTINGS = {
8512
+ enabled: true,
8513
+ idleTtlMs: 6e5,
8514
+ maxOpenHandles: 32
8515
+ };
8496
8516
  /** 归一化子代理托管设置:只有显式 true 才算开启;并发数按上下限收敛。 */
8497
8517
  function normalizeSubagentBridgeSettings(value) {
8498
8518
  const record = typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
@@ -8704,6 +8724,7 @@ window.__ModuleLoader__.load({
8704
8724
  agentAdapterPreferences: {},
8705
8725
  subagentBridge: DEFAULT_SUBAGENT_BRIDGE_SETTINGS,
8706
8726
  sessionTranslation: require_session_translation.DEFAULT_SESSION_TRANSLATION_SETTINGS,
8727
+ sessionHandleEviction: DEFAULT_SESSION_HANDLE_EVICTION_SETTINGS,
8707
8728
  gitManagement: DEFAULT_GIT_MANAGEMENT_SETTINGS,
8708
8729
  terminalEnhancement: DEFAULT_TERMINAL_ENHANCEMENT_SETTINGS,
8709
8730
  workspaceSessionEnhancement: DEFAULT_WORKSPACE_SESSION_ENHANCEMENT_SETTINGS,
@@ -9018,6 +9039,12 @@ window.__ModuleLoader__.load({
9018
9039
  return DSH_COMPATIBILITY;
9019
9040
  }
9020
9041
  });
9042
+ Object.defineProperty(exports, "DSH_TESTED_VERSION", {
9043
+ enumerable: true,
9044
+ get: function() {
9045
+ return DSH_TESTED_VERSION;
9046
+ }
9047
+ });
9021
9048
  Object.defineProperty(exports, "DSH_VERSION", {
9022
9049
  enumerable: true,
9023
9050
  get: function() {
@@ -9084,6 +9111,12 @@ window.__ModuleLoader__.load({
9084
9111
  return isDshVersionCompatible;
9085
9112
  }
9086
9113
  });
9114
+ Object.defineProperty(exports, "isDshVersionNewerThanTested", {
9115
+ enumerable: true,
9116
+ get: function() {
9117
+ return isDshVersionNewerThanTested;
9118
+ }
9119
+ });
9087
9120
  Object.defineProperty(exports, "isFeatureDshVersionCompatible", {
9088
9121
  enumerable: true,
9089
9122
  get: function() {
@@ -16941,6 +16974,25 @@ window.__ModuleLoader__.load({
16941
16974
  model
16942
16975
  };
16943
16976
  }
16977
+ /** Retain known diagnostics without copying raw provider errors into history or UI. */
16978
+ function readSessionTranslationDiagnostics(value) {
16979
+ const failure = asRecord(asRecord(value)?.failure);
16980
+ if (typeof failure?.retryable !== "boolean") return {};
16981
+ switch (failure.code) {
16982
+ case "timeout":
16983
+ case "cancelled":
16984
+ case "rate-limit":
16985
+ case "network":
16986
+ case "unavailable":
16987
+ case "invalid-response":
16988
+ case "configuration":
16989
+ case "provider": return { failure: {
16990
+ code: failure.code,
16991
+ retryable: failure.retryable
16992
+ } };
16993
+ default: return {};
16994
+ }
16995
+ }
16944
16996
  /** Preserve available metrics while accepting records saved before metrics existed. */
16945
16997
  function readSessionTranslationMetrics(value) {
16946
16998
  const record = asRecord(value);
@@ -16973,6 +17025,12 @@ window.__ModuleLoader__.load({
16973
17025
  return normalizeSessionTranslationSettings;
16974
17026
  }
16975
17027
  });
17028
+ Object.defineProperty(exports, "readSessionTranslationDiagnostics", {
17029
+ enumerable: true,
17030
+ get: function() {
17031
+ return readSessionTranslationDiagnostics;
17032
+ }
17033
+ });
16976
17034
  Object.defineProperty(exports, "readSessionTranslationMetrics", {
16977
17035
  enumerable: true,
16978
17036
  get: function() {
@@ -17440,7 +17498,7 @@ window.__ModuleLoader__.load({
17440
17498
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
17441
17499
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
17442
17500
  */
17443
- const en$17 = {
17501
+ const en$18 = {
17444
17502
  "debug.title": "Debug",
17445
17503
  "debug.guideDescription": "Start workspace commands, check ports, and open services",
17446
17504
  "debug.readingWorkspace": "Reading workspace…",
@@ -17518,7 +17576,7 @@ window.__ModuleLoader__.load({
17518
17576
  "feature.debug.label": "Workspace debugging",
17519
17577
  "feature.debug.description": "Launch terminals and check services"
17520
17578
  };
17521
- const zh$17 = {
17579
+ const zh$18 = {
17522
17580
  "debug.title": "调试",
17523
17581
  "debug.guideDescription": "启动工作区命令、检查端口并访问服务",
17524
17582
  "debug.readingWorkspace": "正在读取工作区…",
@@ -17599,7 +17657,7 @@ window.__ModuleLoader__.load({
17599
17657
  //#endregion
17600
17658
  //#region src/client/locales/assistantDebug.ts
17601
17659
  /** 全局助理调试页词典;状态名与 JSON 只在明确的调试区域展示。 */
17602
- const zh$16 = {
17660
+ const zh$17 = {
17603
17661
  "assistant.debug.open": "全局项目状态调试",
17604
17662
  "assistant.debug.title": "全局助理管理状态调试",
17605
17663
  "assistant.debug.description": "独立检查工作区范围、会话状态和文字指令,无需启动语音。",
@@ -17779,7 +17837,7 @@ window.__ModuleLoader__.load({
17779
17837
  "assistant.debug.analysisState.cancelled": "总结已停止,原始索引材料已保留",
17780
17838
  "assistant.debug.rawEvidence": "以下是原始会话摘录,作为总结证据保留,不是 LLM 生成的进展判断。"
17781
17839
  };
17782
- const en$16 = {
17840
+ const en$17 = {
17783
17841
  "assistant.debug.open": "Global project state debug",
17784
17842
  "assistant.debug.title": "Global assistant management debug",
17785
17843
  "assistant.debug.description": "Inspect workspace scope, session state and text commands without starting voice.",
@@ -17961,7 +18019,7 @@ window.__ModuleLoader__.load({
17961
18019
  };
17962
18020
  //#endregion
17963
18021
  //#region src/client/locales/assistantAvatar.ts
17964
- const en$15 = {
18022
+ const en$16 = {
17965
18023
  "avatar.portraitTitle": "Avatar",
17966
18024
  "avatar.portraitEdit": "Adjust avatar",
17967
18025
  "avatar.portraitLocalHint": "Saved in this browser for this character; conversation and sidebar avatars update together.",
@@ -18097,7 +18155,7 @@ window.__ModuleLoader__.load({
18097
18155
  "avatar.desktopFallback": "Desktop companion unavailable; showing inside this window.",
18098
18156
  "avatar.dragHint": "Drag to move; click to open the assistant."
18099
18157
  };
18100
- const zh$15 = {
18158
+ const zh$16 = {
18101
18159
  "avatar.portraitTitle": "头像",
18102
18160
  "avatar.portraitEdit": "微调头像",
18103
18161
  "avatar.portraitLocalHint": "按形象保存在当前浏览器,对话与侧栏头像同步更新。",
@@ -18241,7 +18299,7 @@ window.__ModuleLoader__.load({
18241
18299
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
18242
18300
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
18243
18301
  */
18244
- const en$14 = {
18302
+ const en$15 = {
18245
18303
  "htmlFiles.confirmConnect": "Allow this HTML page to read, save, and delete files in these locations?\n\nPage: {path}\n\n{scopes}\n\nAccess lasts until this preview is closed or reloaded.",
18246
18304
  "htmlFiles.cancelled": "Workspace file connection cancelled.",
18247
18305
  "fileMenu.expandFolder": "Expand folder",
@@ -18314,7 +18372,7 @@ window.__ModuleLoader__.load({
18314
18372
  "pwaPrompt.dismiss": "Not now",
18315
18373
  "pwaPrompt.iosHint": "Tap \"Share\" then \"Add to Home Screen\" to install."
18316
18374
  };
18317
- const zh$14 = {
18375
+ const zh$15 = {
18318
18376
  "htmlFiles.confirmConnect": "允许此 HTML 页面读取、保存和删除以下位置中的文件吗?\n\n页面:{path}\n\n{scopes}\n\n授权在关闭或重新加载预览后失效。",
18319
18377
  "htmlFiles.cancelled": "已取消工作区文件连接。",
18320
18378
  "fileMenu.expandFolder": "展开文件夹",
@@ -18395,7 +18453,7 @@ window.__ModuleLoader__.load({
18395
18453
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
18396
18454
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
18397
18455
  */
18398
- const en$13 = {
18456
+ const en$14 = {
18399
18457
  "feature.gitManagement.label": "Git repository management",
18400
18458
  "feature.gitManagement.description": "View changes and manage commits",
18401
18459
  "git.tabTitle": "Git",
@@ -18517,7 +18575,7 @@ window.__ModuleLoader__.load({
18517
18575
  "git.unknownTime": "Unknown time",
18518
18576
  "git.dateLabel": "{month}/{day}"
18519
18577
  };
18520
- const zh$13 = {
18578
+ const zh$14 = {
18521
18579
  "feature.gitManagement.label": "Git 仓库管理",
18522
18580
  "feature.gitManagement.description": "查看改动并管理提交",
18523
18581
  "git.tabTitle": "Git",
@@ -18647,7 +18705,7 @@ window.__ModuleLoader__.load({
18647
18705
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
18648
18706
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
18649
18707
  */
18650
- const en$12 = {
18708
+ const en$13 = {
18651
18709
  "common.listSeparator": ", ",
18652
18710
  "settings.unknownVersion": "Unknown version",
18653
18711
  "settings.maintenanceDisabled": "This module is disabled by maintenance policy; the setting will not start it.",
@@ -18716,6 +18774,15 @@ window.__ModuleLoader__.load({
18716
18774
  "translation.statusTranslating": "Translating…",
18717
18775
  "translation.progressHelp": "Preparing and translating your message. The translation result will be available when this finishes.",
18718
18776
  "translation.statusFailed": "Translation failed; original kept",
18777
+ "translation.failure.timeout": "The translation request timed out.",
18778
+ "translation.failure.cancelled": "The translation request was cancelled.",
18779
+ "translation.failure.rate-limit": "The translation provider rate limit was reached.",
18780
+ "translation.failure.network": "A network error interrupted the translation request.",
18781
+ "translation.failure.unavailable": "The translation provider was temporarily unavailable.",
18782
+ "translation.failure.invalid-response": "The translation response failed format, language, completion, or protected-text validation.",
18783
+ "translation.failure.configuration": "The translation model or provider configuration was rejected or unavailable.",
18784
+ "translation.failure.provider": "The translation provider or runtime reported an unclassified error.",
18785
+ "translation.failure.unknown": "No failure details were saved for this translation.",
18719
18786
  "translation.retry": "Retry translation",
18720
18787
  "translation.sendDirectly": "Send directly",
18721
18788
  "translation.cancelSending": "Cancel sending",
@@ -18748,7 +18815,7 @@ window.__ModuleLoader__.load({
18748
18815
  "translation.adapter.cursor": "Cursor",
18749
18816
  "translation.adapter.kiro": "Kiro"
18750
18817
  };
18751
- const zh$12 = {
18818
+ const zh$13 = {
18752
18819
  "common.listSeparator": "、",
18753
18820
  "settings.unknownVersion": "未知版本",
18754
18821
  "settings.maintenanceDisabled": "该模块当前由维护策略停用,设置不会启动它。",
@@ -18817,6 +18884,15 @@ window.__ModuleLoader__.load({
18817
18884
  "translation.statusTranslating": "正在翻译…",
18818
18885
  "translation.progressHelp": "正在准备并翻译消息,完成后可查看翻译结果。",
18819
18886
  "translation.statusFailed": "翻译失败,已保留原文",
18887
+ "translation.failure.timeout": "翻译请求超时。",
18888
+ "translation.failure.cancelled": "翻译请求已取消。",
18889
+ "translation.failure.rate-limit": "翻译服务商的请求频率已达上限。",
18890
+ "translation.failure.network": "网络错误中断了翻译请求。",
18891
+ "translation.failure.unavailable": "翻译服务商暂时不可用。",
18892
+ "translation.failure.invalid-response": "翻译结果未通过格式、语言、完整性或受保护文本校验。",
18893
+ "translation.failure.configuration": "翻译模型或服务商配置被拒绝或不可用。",
18894
+ "translation.failure.provider": "翻译服务商或运行时返回了未分类错误。",
18895
+ "translation.failure.unknown": "此翻译未保存失败详情。",
18820
18896
  "translation.retry": "重试翻译",
18821
18897
  "translation.sendDirectly": "直接发送",
18822
18898
  "translation.cancelSending": "取消发送",
@@ -18857,7 +18933,7 @@ window.__ModuleLoader__.load({
18857
18933
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
18858
18934
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
18859
18935
  */
18860
- const en$11 = {
18936
+ const en$12 = {
18861
18937
  "feature.peerHost.label": "Manage other DSH Hosts",
18862
18938
  "feature.peerHost.description": "Aggregate sessions from multiple Hosts",
18863
18939
  "peerHost.panelTitle": "Manage other DSH Hosts",
@@ -18938,7 +19014,7 @@ window.__ModuleLoader__.load({
18938
19014
  "peerHost.stateActive": "The preboot shim has taken over the page Transport; the native Connection of this page keeps reusing the same instance.",
18939
19015
  "peerHost.statePending": "The preboot shim is installed with CodingNS; it takes effect as soon as PeerHost is enabled, and native workspaces read the aggregate Transport directly."
18940
19016
  };
18941
- const zh$11 = {
19017
+ const zh$12 = {
18942
19018
  "feature.peerHost.label": "管理其他 DSH Host",
18943
19019
  "feature.peerHost.description": "聚合多个 Host 会话",
18944
19020
  "peerHost.panelTitle": "管理其他 DSH Host",
@@ -19027,7 +19103,7 @@ window.__ModuleLoader__.load({
19027
19103
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
19028
19104
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
19029
19105
  */
19030
- const en$10 = {
19106
+ const en$11 = {
19031
19107
  "peerHostWorkspace.tabLocal": "Local folders",
19032
19108
  "peerHostWorkspace.tabRemote": "Remote HOST",
19033
19109
  "peerHostWorkspace.sourceLabel": "Workspace source",
@@ -19073,7 +19149,7 @@ window.__ModuleLoader__.load({
19073
19149
  "peerHostWorkspace.hintNotReady": "“{host}” is currently “{status}”; finish connecting it in the management panel first.",
19074
19150
  "peerHostWorkspace.manageHosts": "Manage other DSH Hosts"
19075
19151
  };
19076
- const zh$10 = {
19152
+ const zh$11 = {
19077
19153
  "peerHostWorkspace.tabLocal": "本机文件夹",
19078
19154
  "peerHostWorkspace.tabRemote": "远程 HOST",
19079
19155
  "peerHostWorkspace.sourceLabel": "工作区来源",
@@ -19127,7 +19203,7 @@ window.__ModuleLoader__.load({
19127
19203
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
19128
19204
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
19129
19205
  */
19130
- const en$9 = {
19206
+ const en$10 = {
19131
19207
  "terminalShare.title": "Share terminal output to a conversation",
19132
19208
  "terminalShare.menuTitle": "Share to a conversation",
19133
19209
  "terminalShare.more": "More conversations",
@@ -19200,7 +19276,7 @@ window.__ModuleLoader__.load({
19200
19276
  "loginProtection.errorTimeoutRange": "The session timeout must be between 60 and 604800 seconds",
19201
19277
  "loginProtection.errorScopesRequired": "Select at least one scope"
19202
19278
  };
19203
- const zh$9 = {
19279
+ const zh$10 = {
19204
19280
  "terminalShare.title": "分享终端输出至会话",
19205
19281
  "terminalShare.menuTitle": "分享至会话",
19206
19282
  "terminalShare.more": "更多会话",
@@ -19281,7 +19357,7 @@ window.__ModuleLoader__.load({
19281
19357
  * 只放该域新增的键;合并与命名空间注册由 ../locale.ts 统一完成。
19282
19358
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
19283
19359
  */
19284
- const en$8 = {
19360
+ const en$9 = {
19285
19361
  "usage.r4StatsPeriod": "Account usage · UTC",
19286
19362
  "usage.r4TodayIoTokens": "Input + output tokens today",
19287
19363
  "usage.r4WeekRequests": "Requests · last 7 days",
@@ -19402,6 +19478,7 @@ window.__ModuleLoader__.load({
19402
19478
  "usage.magpieTabRoute": "Route + quota",
19403
19479
  "usage.magpieAggregateTitle": "Gateway usage",
19404
19480
  "usage.magpieSessionTitle": "This Agent session",
19481
+ "usage.magpieSessionTodayTitle": "This Agent session · today",
19405
19482
  "usage.magpieRouteTitle": "Latest route",
19406
19483
  "usage.magpieUsageUnavailable": "Magpie usage is unavailable.",
19407
19484
  "usage.magpieRequests": "Requests",
@@ -19486,7 +19563,7 @@ window.__ModuleLoader__.load({
19486
19563
  "usage.magpieRequestsTitle": "Magpie requests",
19487
19564
  "usage.magpieRequestsClose": "Close"
19488
19565
  };
19489
- const zh$8 = {
19566
+ const zh$9 = {
19490
19567
  "usage.r4StatsPeriod": "账户用量 · UTC",
19491
19568
  "usage.r4TodayIoTokens": "今日输入与输出 Token",
19492
19569
  "usage.r4WeekRequests": "近 7 天请求数",
@@ -19607,6 +19684,7 @@ window.__ModuleLoader__.load({
19607
19684
  "usage.magpieTabRoute": "路由 + 配额",
19608
19685
  "usage.magpieAggregateTitle": "网关用量",
19609
19686
  "usage.magpieSessionTitle": "当前 Agent 会话",
19687
+ "usage.magpieSessionTodayTitle": "当前 Agent 会话 · 今日",
19610
19688
  "usage.magpieRouteTitle": "最近路由",
19611
19689
  "usage.magpieUsageUnavailable": "暂时无法读取 Magpie 用量。",
19612
19690
  "usage.magpieRequests": "请求数",
@@ -19693,7 +19771,7 @@ window.__ModuleLoader__.load({
19693
19771
  };
19694
19772
  //#endregion
19695
19773
  //#region src/client/locales/voiceModels.ts
19696
- const en$7 = {
19774
+ const en$8 = {
19697
19775
  "voice.models.prepared": "Model resources are ready. Save the configuration to use this recognition model.",
19698
19776
  "voice.settings.input": "Speech input",
19699
19777
  "voice.settings.output": "Speech output",
@@ -19736,7 +19814,7 @@ window.__ModuleLoader__.load({
19736
19814
  "voice.models.localHint": "Models are stored on this Host. Verification tests model loading and recognition without using your microphone.",
19737
19815
  "voice.models.close": "Close"
19738
19816
  };
19739
- const zh$7 = {
19817
+ const zh$8 = {
19740
19818
  "voice.models.prepared": "模型资源已准备好,保存配置后使用此识别模型。",
19741
19819
  "voice.settings.input": "语音输入",
19742
19820
  "voice.settings.output": "语音输出",
@@ -19782,7 +19860,7 @@ window.__ModuleLoader__.load({
19782
19860
  //#endregion
19783
19861
  //#region src/client/locales/assistantTts.ts
19784
19862
  /** 独立音色面板词典;官方名称保留原文,元数据标签随界面语言翻译。 */
19785
- const en$6 = {
19863
+ const en$7 = {
19786
19864
  "tts.wizardPrepareResources": "Prepare voice resources",
19787
19865
  "tts.wizardDraftReady": "Voice resources are ready. Configuration changes apply after saving.",
19788
19866
  "tts.prepare": "Prepare MOSS resources",
@@ -19859,7 +19937,7 @@ window.__ModuleLoader__.load({
19859
19937
  "tts.saveParameters": "Save speech controls",
19860
19938
  "tts.resetParameters": "Restore and save defaults"
19861
19939
  };
19862
- const zh$6 = {
19940
+ const zh$7 = {
19863
19941
  "tts.wizardPrepareResources": "准备语音资源",
19864
19942
  "tts.wizardDraftReady": "语音资源已就绪,配置保存后生效。",
19865
19943
  "tts.prepare": "准备 MOSS 资源",
@@ -19939,7 +20017,7 @@ window.__ModuleLoader__.load({
19939
20017
  //#endregion
19940
20018
  //#region src/client/locales/assistantWorkbench.ts
19941
20019
  /** 生命周期工作台文案;高级资源管理复用原有词典。 */
19942
- const zh$5 = {
20020
+ const zh$6 = {
19943
20021
  "awb.notifications.title": "会话提醒",
19944
20022
  "awb.notifications.hint": "在悬浮助理旁显示提醒,查看会话后标记已读。",
19945
20023
  "awb.notifications.enabled": "启用会话提醒",
@@ -20107,7 +20185,7 @@ window.__ModuleLoader__.load({
20107
20185
  "awb.prompts": "提示词",
20108
20186
  "awb.unavailableSelection": "原选择暂不可用:{id}"
20109
20187
  };
20110
- const en$5 = {
20188
+ const en$6 = {
20111
20189
  "awb.notifications.title": "Session notices",
20112
20190
  "awb.notifications.hint": "Show notices beside the floating assistant. Viewing a session marks its notice as read.",
20113
20191
  "awb.notifications.enabled": "Enable session notices",
@@ -20285,7 +20363,7 @@ window.__ModuleLoader__.load({
20285
20363
  * 注册仍使用同一份 zh/en。
20286
20364
  * 规范见 docs/开发规范/20260930-前端文案国际化规范.md。
20287
20365
  */
20288
- const zh$4 = {
20366
+ const zh$5 = {
20289
20367
  "subagentCollapsed.inactive.one": "已停止 {count} 个子智能体",
20290
20368
  "subagentCollapsed.inactive.other": "已停止 {count} 个子智能体",
20291
20369
  "subagentCollapsed.inactive.expand": "展开已停止的子智能体",
@@ -20328,7 +20406,7 @@ window.__ModuleLoader__.load({
20328
20406
  "subagentCollapsed.open.sidebar": "在侧边栏打开",
20329
20407
  "subagentCollapsed.open.sidebar.aria": "在侧边栏打开 {label}"
20330
20408
  };
20331
- const en$4 = {
20409
+ const en$5 = {
20332
20410
  "subagentCollapsed.inactive.one": "{count} stopped subagent",
20333
20411
  "subagentCollapsed.inactive.other": "{count} stopped subagents",
20334
20412
  "subagentCollapsed.inactive.expand": "Show stopped subagents",
@@ -20384,7 +20462,7 @@ window.__ModuleLoader__.load({
20384
20462
  };
20385
20463
  //#endregion
20386
20464
  //#region src/client/locales/quickApps.ts
20387
- const en$3 = {
20465
+ const en$4 = {
20388
20466
  "quickApps.storagePreview": "App data is saved in this browser. IndexedDB and URLs starting with / are not supported in this view.",
20389
20467
  "quickApps.storageFailed": "App data could not be saved in this browser: {message}",
20390
20468
  "quickApps.sandboxPreview": "Workspace preview. Browser storage and URLs starting with / may not work in this view.",
@@ -20517,7 +20595,7 @@ window.__ModuleLoader__.load({
20517
20595
  "quickApps.status.missing-workspace": "The original workspace is unavailable.",
20518
20596
  "quickApps.status.missing-file": "The entry file or application folder is missing or cannot be accessed."
20519
20597
  };
20520
- const zh$3 = {
20598
+ const zh$4 = {
20521
20599
  "quickApps.storagePreview": "应用数据保存在当前浏览器中。此视图不支持 IndexedDB 和以 / 开头的网址。",
20522
20600
  "quickApps.storageFailed": "无法在当前浏览器中保存应用数据:{message}",
20523
20601
  "quickApps.sandboxPreview": "工作区预览:浏览器存储和以 / 开头的网址可能无法在此视图中使用。",
@@ -20652,7 +20730,7 @@ window.__ModuleLoader__.load({
20652
20730
  };
20653
20731
  //#endregion
20654
20732
  //#region src/client/locales/cliManagement.ts
20655
- const en$2 = {
20733
+ const en$3 = {
20656
20734
  "cli.team.label": "Team eligibility",
20657
20735
  "cli.team.leadAndMember": "Collaborator and Lead",
20658
20736
  "cli.team.member": "Collaborator",
@@ -20729,7 +20807,7 @@ window.__ModuleLoader__.load({
20729
20807
  "cli.manage.retryStatus": "Retry status",
20730
20808
  "cli.manage.reviewAgain": "Review another operation"
20731
20809
  };
20732
- const zh$2 = {
20810
+ const zh$3 = {
20733
20811
  "cli.team.label": "团队适配能力",
20734
20812
  "cli.team.leadAndMember": "协作者和管理者",
20735
20813
  "cli.team.member": "协作者",
@@ -20809,10 +20887,37 @@ window.__ModuleLoader__.load({
20809
20887
  //#endregion
20810
20888
  //#region src/client/locales/magpie.ts
20811
20889
  /** Copy for the optional Magpie usage dashboard. */
20812
- const en$1 = {
20890
+ const en$2 = {
20813
20891
  "feature.magpieManagement.label": "Magpie management and usage",
20814
20892
  "feature.magpieManagement.description": "Enable to add a separate Magpie Management page below Plugins in the global sidebar.",
20815
20893
  "magpie.sidebarLabel": "Magpie",
20894
+ "magpie.context.system": "System prompt",
20895
+ "magpie.context.tools": "Tools",
20896
+ "magpie.context.memory": "Memory",
20897
+ "magpie.context.files": "Files",
20898
+ "magpie.context.results": "Tool results",
20899
+ "magpie.context.chat": "Conversation content",
20900
+ "magpie.context.usedPercent": "Context used {percent}%",
20901
+ "magpie.context.window": "Context window",
20902
+ "magpie.context.used": "Used context",
20903
+ "magpie.context.native": "DSH context",
20904
+ "magpie.context.nativeTools": "Tool definitions",
20905
+ "magpie.context.nativeMessages": "Conversation messages",
20906
+ "magpie.context.nativeComposition": "Estimated composition (share of total)",
20907
+ "magpie.context.modelWindow": "Model window {value}",
20908
+ "magpie.context.cache": "Prompt cache",
20909
+ "magpie.context.hit": "hit",
20910
+ "magpie.context.close": "Close context",
20911
+ "magpie.context.composition": "Context composition",
20912
+ "magpie.context.content": "Content",
20913
+ "magpie.context.all": "All",
20914
+ "magpie.context.allCount": "All · {count}",
20915
+ "magpie.context.empty": "No content available",
20916
+ "magpie.context.rounds": "{count} rounds",
20917
+ "magpie.context.requests": "{count} requests",
20918
+ "magpie.context.request": "Request {count}",
20919
+ "magpie.context.earlierRounds": "Earlier {count} rounds",
20920
+ "magpie.context.round": "Round {count}",
20816
20921
  "magpie.usage": "Usage",
20817
20922
  "magpie.routing": "Routing",
20818
20923
  "magpie.statTokens": "Tokens",
@@ -20859,8 +20964,10 @@ window.__ModuleLoader__.load({
20859
20964
  "magpie.refreshing": "Refreshing…",
20860
20965
  "magpie.update.title": "Magpie update",
20861
20966
  "magpie.update.open": "Magpie {version}; open update details",
20967
+ "magpie.update.openAvailable": "Magpie {version}; update {latest} available; open update details",
20968
+ "magpie.update.badge": "New",
20862
20969
  "magpie.update.close": "Close Magpie update details",
20863
- "magpie.update.description": "Automatic checks observe Magpie in the background. Download and restart only run after you confirm a manual update.",
20970
+ "magpie.update.description": "Opening this page checks for updates automatically. Download and restart only run after you confirm a manual update.",
20864
20971
  "magpie.update.unavailable": "Magpie update status is unavailable.",
20865
20972
  "magpie.update.unsupported": "This Magpie version does not expose a supported update API.",
20866
20973
  "magpie.update.invalid": "Magpie returned an update response CodingNS cannot safely read.",
@@ -21130,10 +21237,37 @@ window.__ModuleLoader__.load({
21130
21237
  "magpie.install.customApply": "Detect this path",
21131
21238
  "magpie.install.disabledNote": "Magpie management stays off until a working Magpie CLI is detected."
21132
21239
  };
21133
- const zh$1 = {
21240
+ const zh$2 = {
21134
21241
  "feature.magpieManagement.label": "Magpie 管理与用量",
21135
21242
  "feature.magpieManagement.description": "启用后,会在全局侧栏的「插件」下方添加独立的 Magpie 管理页面。",
21136
21243
  "magpie.sidebarLabel": "Magpie",
21244
+ "magpie.context.system": "系统提示词",
21245
+ "magpie.context.tools": "工具",
21246
+ "magpie.context.memory": "记忆",
21247
+ "magpie.context.files": "文件",
21248
+ "magpie.context.results": "工具结果",
21249
+ "magpie.context.chat": "会话内容",
21250
+ "magpie.context.usedPercent": "上下文已用 {percent}%",
21251
+ "magpie.context.window": "上下文窗口",
21252
+ "magpie.context.used": "已用上下文",
21253
+ "magpie.context.native": "DSH 上下文",
21254
+ "magpie.context.nativeTools": "工具定义",
21255
+ "magpie.context.nativeMessages": "对话消息",
21256
+ "magpie.context.nativeComposition": "估算组成(占估算总量的比例)",
21257
+ "magpie.context.modelWindow": "模型窗口 {value}",
21258
+ "magpie.context.cache": "提示词缓存",
21259
+ "magpie.context.hit": "命中",
21260
+ "magpie.context.close": "关闭上下文",
21261
+ "magpie.context.composition": "上下文组成",
21262
+ "magpie.context.content": "内容",
21263
+ "magpie.context.all": "全部",
21264
+ "magpie.context.allCount": "全部 · {count}",
21265
+ "magpie.context.empty": "没有可显示的内容",
21266
+ "magpie.context.rounds": "{count} 轮",
21267
+ "magpie.context.requests": "{count} 个请求",
21268
+ "magpie.context.request": "请求 {count}",
21269
+ "magpie.context.earlierRounds": "更早的 {count} 轮",
21270
+ "magpie.context.round": "第 {count} 轮",
21137
21271
  "magpie.usage": "用量",
21138
21272
  "magpie.routing": "路由",
21139
21273
  "magpie.statTokens": "Token",
@@ -21180,8 +21314,10 @@ window.__ModuleLoader__.load({
21180
21314
  "magpie.refreshing": "正在刷新…",
21181
21315
  "magpie.update.title": "Magpie 更新",
21182
21316
  "magpie.update.open": "Magpie {version};打开更新详情",
21317
+ "magpie.update.openAvailable": "Magpie {version};发现新版本 {latest};打开更新详情",
21318
+ "magpie.update.badge": "新",
21183
21319
  "magpie.update.close": "关闭 Magpie 更新详情",
21184
- "magpie.update.description": "后台会自动观察 Magpie 的更新状态;只有你确认手动更新后,才会下载或重启。",
21320
+ "magpie.update.description": "打开管理页时会自动检查更新;只有你确认手动更新后,才会下载或重启。",
21185
21321
  "magpie.update.unavailable": "暂时无法读取 Magpie 更新状态。",
21186
21322
  "magpie.update.unsupported": "当前 Magpie 版本没有可支持的更新 API。",
21187
21323
  "magpie.update.invalid": "Magpie 返回了 CodingNS 无法安全读取的更新数据。",
@@ -21452,6 +21588,138 @@ window.__ModuleLoader__.load({
21452
21588
  "magpie.install.disabledNote": "检测到可用的 Magpie CLI 前,Magpie 管理保持关闭。"
21453
21589
  };
21454
21590
  //#endregion
21591
+ //#region src/client/locales/pluginUpdate.ts
21592
+ const en$1 = {
21593
+ "update.localeTag": "en-US",
21594
+ "update.newVersionBadge": "New",
21595
+ "update.toggleDetails": "Show or hide update details",
21596
+ "update.newVersion": "New version {version}",
21597
+ "update.title": "Plugin updates",
21598
+ "update.description": "Check npm releases and review the exact GitHub tag.",
21599
+ "update.hostVersion": "Running Host:",
21600
+ "update.clientVersion": "Running Client:",
21601
+ "update.installedVersion": "Installed package:",
21602
+ "update.unknown": "Unknown",
21603
+ "update.activationHelp": "Package installation and live code activation are reported separately. This DSH version cannot confirm a Desktop Client reload.",
21604
+ "update.channel": "Release channel",
21605
+ "update.latest": "npm latest",
21606
+ "update.next": "npm next (prerelease)",
21607
+ "update.exact": "Exact version",
21608
+ "update.exactVersion": "Exact npm version",
21609
+ "update.check": "Check for updates",
21610
+ "update.checking": "Checking npm and GitHub...",
21611
+ "update.requestError": "The request could not be completed. Retry the check or review native DSH Plugins.",
21612
+ "update.previousResult": "Previous check shown. Check again before updating.",
21613
+ "update.targetVersion": "Target version:",
21614
+ "update.publishedAt": "Published:",
21615
+ "update.releasePublishedAt": "GitHub release published:",
21616
+ "update.commit": "Source commit:",
21617
+ "update.compatibility": "DSH compatibility:",
21618
+ "update.openRelease": "Open exact GitHub release",
21619
+ "update.noNotes": "Release notes are unavailable for this exact tag.",
21620
+ "update.nativeFallback": "Use native DSH Plugins to review package status and complete any required update or restart.",
21621
+ "update.review": "Review update",
21622
+ "update.confirmTitle": "Confirm the exact package update",
21623
+ "update.confirmHelp": "Install Codingns4DSH {version} through the DSH package manager? The new Host and Client code may require a DSH restart.",
21624
+ "update.confirm": "Confirm and update",
21625
+ "update.back": "Back",
21626
+ "update.cancel": "Request cancellation",
21627
+ "update.refreshStatus": "Refresh operation status",
21628
+ "update.operationHelp": "DSH owns this operation. Closing settings does not cancel it. Cancellation is confirmed only after DSH finishes restoring the package files.",
21629
+ "update.packageState": "Package:",
21630
+ "update.hostActivation": "Host activation:",
21631
+ "update.clientActivation": "Client activation:",
21632
+ "update.checkState.up-to-date": "This channel is up to date.",
21633
+ "update.checkState.update-available": "A newer version is available.",
21634
+ "update.checkState.no-newer-version": "This channel is older than the running or installed version.",
21635
+ "update.checkState.incompatible": "This target is incompatible with the running DSH.",
21636
+ "update.checkState.compatibility-unknown": "Target compatibility could not be confirmed. Updating is blocked.",
21637
+ "update.checkState.unavailable": "Update information is unavailable.",
21638
+ "update.checkState.unsupported": "This runtime does not support checking the active version.",
21639
+ "update.compatibilityState.compatible": "Compatible",
21640
+ "update.compatibilityState.incompatible": "Incompatible",
21641
+ "update.compatibilityState.unknown": "Unknown",
21642
+ "update.phase.installing": "Installing through DSH...",
21643
+ "update.phase.cancelling": "Waiting for DSH cancellation...",
21644
+ "update.phase.applying": "DSH is applying the package...",
21645
+ "update.phase.completed": "Operation completed",
21646
+ "update.application.applied-without-desktop-restart": "Host and Client are active at the target version.",
21647
+ "update.application.restart-required": "Package installed; restart required to activate the code.",
21648
+ "update.application.activation-unknown": "Live activation could not be confirmed.",
21649
+ "update.application.failed": "The update failed. Review package status before retrying.",
21650
+ "update.application.cancelled": "DSH cancelled the update.",
21651
+ "update.application.unsupported": "Use native DSH Plugins to update this package.",
21652
+ "update.package.installed": "Installed",
21653
+ "update.package.unchanged": "Unchanged",
21654
+ "update.package.rolled-back": "Profile files restored by DSH",
21655
+ "update.package.unknown": "Unknown; review native DSH Plugins"
21656
+ };
21657
+ const zh$1 = {
21658
+ "update.localeTag": "zh-CN",
21659
+ "update.newVersionBadge": "新版本",
21660
+ "update.toggleDetails": "展开或收起更新详情",
21661
+ "update.newVersion": "新版本 {version}",
21662
+ "update.title": "插件更新",
21663
+ "update.description": "检查 npm 发布版本,并查看对应的 GitHub 标签。",
21664
+ "update.hostVersion": "运行中的 Host:",
21665
+ "update.clientVersion": "运行中的 Client:",
21666
+ "update.installedVersion": "已安装的软件包:",
21667
+ "update.unknown": "未知",
21668
+ "update.activationHelp": "软件包安装状态与运行时代码激活状态分开显示。当前 DSH 版本无法确认 Desktop Client 是否已重新加载。",
21669
+ "update.channel": "发布渠道",
21670
+ "update.latest": "npm latest(稳定版)",
21671
+ "update.next": "npm next(预发布版)",
21672
+ "update.exact": "指定版本",
21673
+ "update.exactVersion": "npm 指定版本号",
21674
+ "update.check": "检查更新",
21675
+ "update.checking": "正在检查 npm 和 GitHub……",
21676
+ "update.requestError": "请求未完成。请重试,或到 DSH 原生插件页面查看状态。",
21677
+ "update.previousResult": "显示的是上一次检查结果。更新前请重新检查。",
21678
+ "update.targetVersion": "目标版本:",
21679
+ "update.publishedAt": "npm 发布时间:",
21680
+ "update.releasePublishedAt": "GitHub 发布时间:",
21681
+ "update.commit": "源代码提交:",
21682
+ "update.compatibility": "DSH 兼容性:",
21683
+ "update.openRelease": "打开对应的 GitHub Release",
21684
+ "update.noNotes": "该精确标签没有可用的 Release notes。",
21685
+ "update.nativeFallback": "请到 DSH 原生插件页面查看软件包状态,并完成必要的更新或重启。",
21686
+ "update.review": "查看更新",
21687
+ "update.confirmTitle": "确认更新指定软件包",
21688
+ "update.confirmHelp": "通过 DSH 软件包管理器安装 Codingns4DSH {version}?新的 Host 和 Client 代码可能需要重启 DSH 才能生效。",
21689
+ "update.confirm": "确认并更新",
21690
+ "update.back": "返回",
21691
+ "update.cancel": "请求取消",
21692
+ "update.refreshStatus": "刷新操作状态",
21693
+ "update.operationHelp": "此操作由 DSH 管理。关闭设置不会取消操作;只有 DSH 完成软件包恢复后,取消才会被确认。",
21694
+ "update.packageState": "软件包状态:",
21695
+ "update.hostActivation": "Host 激活状态:",
21696
+ "update.clientActivation": "Client 激活状态:",
21697
+ "update.checkState.up-to-date": "此渠道已经是最新版本。",
21698
+ "update.checkState.update-available": "发现新版本。",
21699
+ "update.checkState.no-newer-version": "此渠道版本低于当前运行或已安装版本。",
21700
+ "update.checkState.incompatible": "此目标版本与当前 DSH 不兼容。",
21701
+ "update.checkState.compatibility-unknown": "无法确认目标版本兼容性,更新已阻止。",
21702
+ "update.checkState.unavailable": "更新信息暂不可用。",
21703
+ "update.checkState.unsupported": "当前运行环境不支持检查活动版本。",
21704
+ "update.compatibilityState.compatible": "兼容",
21705
+ "update.compatibilityState.incompatible": "不兼容",
21706
+ "update.compatibilityState.unknown": "未知",
21707
+ "update.phase.installing": "正在通过 DSH 安装……",
21708
+ "update.phase.cancelling": "正在等待 DSH 完成取消……",
21709
+ "update.phase.applying": "DSH 正在应用软件包……",
21710
+ "update.phase.completed": "操作已完成",
21711
+ "update.application.applied-without-desktop-restart": "Host 和 Client 已运行目标版本。",
21712
+ "update.application.restart-required": "软件包已安装;需要重启才能激活新代码。",
21713
+ "update.application.activation-unknown": "无法确认运行时代码是否已激活。",
21714
+ "update.application.failed": "更新失败。请先检查软件包状态再重试。",
21715
+ "update.application.cancelled": "DSH 已取消更新。",
21716
+ "update.application.unsupported": "请使用 DSH 原生插件页面更新此软件包。",
21717
+ "update.package.installed": "已安装",
21718
+ "update.package.unchanged": "未改变",
21719
+ "update.package.rolled-back": "DSH 已恢复配置文件",
21720
+ "update.package.unknown": "未知;请检查 DSH 原生插件页面"
21721
+ };
21722
+ //#endregion
21455
21723
  //#region src/client/locale.ts
21456
21724
  /** Codingns4DSH 自有词典命名空间。词典缺少的语言由 DSH 自动回退到英文。 */
21457
21725
  const CODINGNS_LOCALE_NS = "codingns";
@@ -21461,6 +21729,8 @@ window.__ModuleLoader__.load({
21461
21729
  "settings.subtitle": "Configure modules without changing DSH global settings.",
21462
21730
  "settings.version": "Codingns4DSH v{version}",
21463
21731
  "settings.compatibility": "Compatible with DSH {range}",
21732
+ "settings.testedDshVersion": "Tested with DSH {version}",
21733
+ "settings.untestedDshWarning": "DSH {version} is newer than the latest tested version ({tested}). Compatibility has not been verified; plugin installation and operation remain enabled.",
21464
21734
  "settings.toggle": "{label} toggle",
21465
21735
  "settings.legacyFallback": "This DSH version uses compatibility mode; multi-tab and shell-selection extensions are unavailable.",
21466
21736
  "settings.versionBlocked": "This module is unavailable on DSH {version}; it requires DSH {minimum} or newer.",
@@ -21919,6 +22189,8 @@ window.__ModuleLoader__.load({
21919
22189
  "settings.subtitle": "按模块配置 Codingns4DSH 功能,不影响 DSH 的全局设置。",
21920
22190
  "settings.version": "Codingns4DSH v{version}",
21921
22191
  "settings.compatibility": "兼容 DSH {range}",
22192
+ "settings.testedDshVersion": "已验证 DSH {version}",
22193
+ "settings.untestedDshWarning": "当前 DSH {version} 高于插件最新已验证版本({tested}),兼容性尚未验证;不影响插件安装和运行。",
21922
22194
  "settings.toggle": "{label}开关",
21923
22195
  "settings.legacyFallback": "当前 DSH 版本使用兼容模式;多 Tab 和 Shell 选择扩展不可用。",
21924
22196
  "settings.versionBlocked": "当前 DSH {version} 不支持此模块;需要 DSH {minimum} 或更高版本。",
@@ -22379,19 +22651,20 @@ window.__ModuleLoader__.load({
22379
22651
  */
22380
22652
  const en = {
22381
22653
  ...CORE_EN,
22382
- ...en$15,
22383
22654
  ...en$16,
22384
- ...en$13,
22385
22655
  ...en$17,
22656
+ ...en$14,
22657
+ ...en$18,
22658
+ ...en$12,
22386
22659
  ...en$11,
22387
- ...en$10,
22660
+ ...en$9,
22388
22661
  ...en$8,
22389
22662
  ...en$7,
22390
22663
  ...en$6,
22664
+ ...en$15,
22665
+ ...en$10,
22666
+ ...en$13,
22391
22667
  ...en$5,
22392
- ...en$14,
22393
- ...en$9,
22394
- ...en$12,
22395
22668
  ...en$4,
22396
22669
  ...en$3,
22397
22670
  ...en$2,
@@ -22399,19 +22672,20 @@ window.__ModuleLoader__.load({
22399
22672
  };
22400
22673
  const zh = {
22401
22674
  ...CORE_ZH,
22402
- ...zh$15,
22403
22675
  ...zh$16,
22404
- ...zh$13,
22405
22676
  ...zh$17,
22677
+ ...zh$14,
22678
+ ...zh$18,
22679
+ ...zh$12,
22406
22680
  ...zh$11,
22407
- ...zh$10,
22681
+ ...zh$9,
22408
22682
  ...zh$8,
22409
22683
  ...zh$7,
22410
22684
  ...zh$6,
22685
+ ...zh$15,
22686
+ ...zh$10,
22687
+ ...zh$13,
22411
22688
  ...zh$5,
22412
- ...zh$14,
22413
- ...zh$9,
22414
- ...zh$12,
22415
22689
  ...zh$4,
22416
22690
  ...zh$3,
22417
22691
  ...zh$2,
@@ -22477,7 +22751,7 @@ window.__ModuleLoader__.load({
22477
22751
  Object.defineProperty(exports, "en", {
22478
22752
  enumerable: true,
22479
22753
  get: function() {
22480
- return en$4;
22754
+ return en$5;
22481
22755
  }
22482
22756
  });
22483
22757
  Object.defineProperty(exports, "registerCodingNsLocale", {
@@ -22501,7 +22775,7 @@ window.__ModuleLoader__.load({
22501
22775
  Object.defineProperty(exports, "zh", {
22502
22776
  enumerable: true,
22503
22777
  get: function() {
22504
- return zh$4;
22778
+ return zh$5;
22505
22779
  }
22506
22780
  });
22507
22781
  return module.exports;
@@ -23221,7 +23495,7 @@ window.__ModuleLoader__.load({
23221
23495
  const MOBILE_RIGHTBAR_MANUAL_OPEN_EVENT = "codingns4dsh-mobile-rightbar-manual-open";
23222
23496
  const MOBILE_RIGHTBAR_MANUAL_CLOSE_EVENT = "codingns4dsh-mobile-rightbar-manual-close";
23223
23497
  const MOBILE_RIGHTBAR_VISIBILITY_ATTRIBUTE = "data-codingns-mobile-rightbar";
23224
- const STYLE_ID$3 = "codingns4dsh-mobile-rightbar-visibility";
23498
+ const STYLE_ID$5 = "codingns4dsh-mobile-rightbar-visibility";
23225
23499
  /** 手势确认右栏呼出后、修改宿主状态前通知显示控制器。 */
23226
23500
  function notifyMobileRightbarManualOpen(documentLike) {
23227
23501
  documentLike?.dispatchEvent?.(new Event(MOBILE_RIGHTBAR_MANUAL_OPEN_EVENT));
@@ -23243,7 +23517,7 @@ window.__ModuleLoader__.load({
23243
23517
  let session = readSession();
23244
23518
  const style = dom?.createElement?.("style");
23245
23519
  if (style !== void 0) {
23246
- style.id = STYLE_ID$3;
23520
+ style.id = STYLE_ID$5;
23247
23521
  style.textContent = `html[${MOBILE_RIGHTBAR_VISIBILITY_ATTRIBUTE}="blocked"] [data-sidebar-right-panel] { display: none !important; }`;
23248
23522
  dom?.head?.appendChild(style);
23249
23523
  }
@@ -24928,7 +25202,7 @@ window.__ModuleLoader__.load({
24928
25202
  this.code = code;
24929
25203
  }
24930
25204
  };
24931
- /** 启动期严格检查 DSH 兼容范围,不对未知版本静默降级。 */
25205
+ /** Enforce the DSH minimum version without rejecting newer hosts. */
24932
25206
  function assertSupportedDshVersion(version) {
24933
25207
  if (!require_native_workspace_store.isDshVersionCompatible(version)) throw new CodingNsDshError(CODINGNS_DSH_ERROR_CODES.DSH_VERSION_UNSUPPORTED, `不支持的 DSH 版本: ${version};当前插件兼容范围为 ${SUPPORTED_DSH_COMPATIBILITY}`);
24934
25208
  }
@@ -30306,6 +30580,7 @@ window.__ModuleLoader__.load({
30306
30580
  }
30307
30581
  //#endregion
30308
30582
  //#region src/dsh-capabilities/host/session-model-selection-adapter.ts
30583
+ const NATIVE_ACCESSOR = Symbol.for("codingns4dsh.native-model-selection");
30309
30584
  function selectionOwner(controller) {
30310
30585
  const owner = controller?.agents;
30311
30586
  return typeof owner?.selectionFor === "function" ? owner : void 0;
@@ -30332,9 +30607,13 @@ window.__ModuleLoader__.load({
30332
30607
  return key === "current" ? external : Reflect.get(target, key, receiver);
30333
30608
  } });
30334
30609
  };
30610
+ Object.defineProperty(selectionFor, NATIVE_ACCESSOR, { value: {
30611
+ native: original[NATIVE_ACCESSOR]?.native ?? original,
30612
+ installed: selectionFor
30613
+ } });
30335
30614
  owner.selectionFor = selectionFor;
30336
30615
  return () => {
30337
- if (owner.selectionFor !== selectionFor) return;
30616
+ if (owner.selectionFor[NATIVE_ACCESSOR]?.installed !== selectionFor) return;
30338
30617
  if (ownDescriptor !== void 0) Object.defineProperty(owner, "selectionFor", ownDescriptor);
30339
30618
  else Reflect.deleteProperty(owner, "selectionFor");
30340
30619
  };
@@ -30565,7 +30844,7 @@ window.__ModuleLoader__.load({
30565
30844
  /** Reuse the native activity pill, dialog, localization, settings, and session binding. */
30566
30845
  function createSessionPerformancePresentation(context) {
30567
30846
  const slots = context.slots;
30568
- return { install(useAdapter, element, hooks) {
30847
+ return { install(useAdapter, element, hooks, options) {
30569
30848
  const wrappers = /* @__PURE__ */ new Set();
30570
30849
  const removeActivity = followPresentationEntry(slots, "conversation.composer.dock", (entry) => entry.options.id === "activity" && !wrappers.has(entry.component), (native) => {
30571
30850
  const Activity = native.component;
@@ -30606,7 +30885,7 @@ window.__ModuleLoader__.load({
30606
30885
  };
30607
30886
  });
30608
30887
  try {
30609
- const removeContext = installGrokContextPresentation(context, slots, useAdapter, element, hooks);
30888
+ const removeContext = installGrokContextPresentation(context, slots, useAdapter, element, hooks, options);
30610
30889
  return () => {
30611
30890
  removeContext();
30612
30891
  removeActivity();
@@ -30618,22 +30897,57 @@ window.__ModuleLoader__.load({
30618
30897
  } };
30619
30898
  }
30620
30899
  /** ContextMeter lives inside the native composer bar, rather than in its own slot. */
30621
- function installGrokContextPresentation(owner, slots, useAdapter, element, hooks) {
30622
- return installComposerPresentation(owner, slots, (Native) => function ComposerWithGrokContext(props) {
30623
- const adapter = useAdapter(props.sessionId ?? "");
30624
- return element(Native, {
30625
- ...props,
30626
- useProjection: (key, ...args) => {
30627
- const original = props.useProjection(key, ...args);
30628
- if (key === "contextBreakdown" && adapter === "grok") return void 0;
30629
- if (key !== "contextPressure") return original;
30630
- const value = props.useProjection(GROK_CONTEXT_PROJECTION);
30631
- if (adapter !== "grok") return original;
30632
- const pressure = value ?? {};
30633
- return typeof args[0] === "function" ? args[0](pressure) : pressure;
30634
- }
30635
- });
30636
- }, element, hooks);
30900
+ function installGrokContextPresentation(owner, slots, useAdapter, element, hooks, options) {
30901
+ const magpieContext = options?.magpieContext;
30902
+ const removeMagpieMeter = magpieContext === void 0 ? () => void 0 : installMagpieContextDock(slots, magpieContext, element);
30903
+ try {
30904
+ const removeComposer = installComposerPresentation(owner, slots, (Native) => function ComposerWithGrokContext(props) {
30905
+ const adapter = useAdapter(props.sessionId ?? "");
30906
+ const magpieSnapshot = magpieContext?.useSnapshot?.(magpieContext.rpc, props.sessionId) ?? null;
30907
+ const legacyMagpieReady = magpieContext?.useReady?.(magpieContext.rpc, props.sessionId) === true;
30908
+ const magpieReady = magpieSnapshot !== null || legacyMagpieReady;
30909
+ return element(Native, {
30910
+ ...props,
30911
+ useProjection: (key, ...args) => {
30912
+ const original = props.useProjection(key, ...args);
30913
+ if (key === "contextBreakdown" && (adapter === "grok" || magpieReady)) return void 0;
30914
+ if (key !== "contextPressure") return original;
30915
+ const value = props.useProjection(GROK_CONTEXT_PROJECTION);
30916
+ if (magpieSnapshot !== null) {
30917
+ const pressure = {
30918
+ pressureTokens: magpieSnapshot.usedTokens,
30919
+ contextWindow: magpieSnapshot.contextWindow
30920
+ };
30921
+ return typeof args[0] === "function" ? args[0](pressure) : pressure;
30922
+ }
30923
+ if (magpieReady) return void 0;
30924
+ if (adapter !== "grok") return original;
30925
+ const pressure = value ?? {};
30926
+ return typeof args[0] === "function" ? args[0](pressure) : pressure;
30927
+ }
30928
+ });
30929
+ }, element, hooks);
30930
+ return () => {
30931
+ removeComposer();
30932
+ removeMagpieMeter();
30933
+ };
30934
+ } catch (error) {
30935
+ removeMagpieMeter();
30936
+ throw error;
30937
+ }
30938
+ }
30939
+ /** Mount a zero-layout Client enhancer beside the native ContextMeter. */
30940
+ function installMagpieContextDock(slots, magpieContext, element) {
30941
+ return slots.inject("conversation.composer.dock", () => slots.register({
30942
+ name: "conversation.composer.dock",
30943
+ id: "codingns-magpie-context",
30944
+ order: -10,
30945
+ inject: (sessionId) => ({
30946
+ rpc: magpieContext.rpc,
30947
+ sessionId,
30948
+ ...magpieContext.locale === void 0 ? {} : { locale: magpieContext.locale }
30949
+ })
30950
+ }, (props) => element(magpieContext.component, props)));
30637
30951
  }
30638
30952
  //#endregion
30639
30953
  //#region src/dsh-capabilities/host/agent-team-adapter.ts
@@ -30868,6 +31182,123 @@ window.__ModuleLoader__.load({
30868
31182
  }
30869
31183
  }
30870
31184
  //#endregion
31185
+ //#region src/shared/contracts/plugin-update.ts
31186
+ const CODINGNS_PACKAGE_NAME = "@jingyi0605/codingns4dsh";
31187
+ const CODINGNS_NPM_REGISTRY = "https://registry.npmjs.org";
31188
+ function isSemver(value) {
31189
+ return value.length <= 128 && parseSemver(value) !== null;
31190
+ }
31191
+ function updateError(code) {
31192
+ return Object.assign(new Error(code), { code });
31193
+ }
31194
+ /** Compare two semver values without treating prerelease strings lexically. */
31195
+ function compareSemver(left, right) {
31196
+ const a = parseSemver(left);
31197
+ const b = parseSemver(right);
31198
+ if (a === null || b === null) throw new Error("Invalid semver");
31199
+ for (const key of [
31200
+ "major",
31201
+ "minor",
31202
+ "patch"
31203
+ ]) if (a[key] !== b[key]) return a[key] - b[key];
31204
+ if (a.prerelease.length === 0 && b.prerelease.length > 0) return 1;
31205
+ if (a.prerelease.length > 0 && b.prerelease.length === 0) return -1;
31206
+ for (let index = 0; index < Math.max(a.prerelease.length, b.prerelease.length); index += 1) {
31207
+ const leftPart = a.prerelease[index];
31208
+ const rightPart = b.prerelease[index];
31209
+ if (leftPart === void 0) return -1;
31210
+ if (rightPart === void 0) return 1;
31211
+ if (leftPart === rightPart) continue;
31212
+ const leftNumeric = /^\d+$/u.test(leftPart);
31213
+ if (leftNumeric !== /^\d+$/u.test(rightPart)) return leftNumeric ? -1 : 1;
31214
+ if (leftNumeric && leftPart.length !== rightPart.length) return leftPart.length - rightPart.length;
31215
+ return leftPart < rightPart ? -1 : 1;
31216
+ }
31217
+ return 0;
31218
+ }
31219
+ function parseSemver(value) {
31220
+ const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u.exec(value);
31221
+ if (match === null || match[4]?.split(".").some((part) => /^0\d+$/u.test(part))) return null;
31222
+ if (!match.slice(1, 4).map(Number).every(Number.isSafeInteger)) return null;
31223
+ return {
31224
+ major: Number(match[1]),
31225
+ minor: Number(match[2]),
31226
+ patch: Number(match[3]),
31227
+ prerelease: match[4]?.split(".") ?? []
31228
+ };
31229
+ }
31230
+ //#endregion
31231
+ //#region src/dsh-capabilities/host/plugin-update-adapter.ts
31232
+ function readUpdateService(context, name) {
31233
+ if (typeof context !== "object" || context === null) return void 0;
31234
+ try {
31235
+ const getter = Reflect.get(context, "get");
31236
+ return typeof getter === "function" ? getter.call(context, name) : Reflect.get(context, name);
31237
+ } catch {
31238
+ return;
31239
+ }
31240
+ }
31241
+ function supportsPluginUpdateManager(context) {
31242
+ const manager = readUpdateService(context, "pluginManager");
31243
+ return typeof manager?.listBundles === "function" && typeof manager.installBundle === "function";
31244
+ }
31245
+ /** Published 0.2.1-rc.2 contract. There is no updateBundle or self-uninstall fallback. */
31246
+ function createPluginUpdateManager(context) {
31247
+ const manager = readUpdateService(context, "pluginManager");
31248
+ const policy = () => {
31249
+ const profile = readUpdateService(context, "profileContext");
31250
+ if (!profile || typeof profile.name !== "string") return "UPDATE_PROFILE_UNKNOWN";
31251
+ if (profile.name === "desktop" || profile.packageManager !== void 0 || process.versions.electron !== void 0) return "UPDATE_DESKTOP_UNSUPPORTED";
31252
+ if (readUpdateService(context, "hmr") !== void 0) return "UPDATE_NATIVE_MANAGER_REQUIRED";
31253
+ };
31254
+ return {
31255
+ async installed() {
31256
+ const bundle = (await manager.listBundles()).find((item) => item.name === CODINGNS_PACKAGE_NAME);
31257
+ const version = typeof bundle?.version === "string" && isSemver(bundle.version) ? bundle.version : null;
31258
+ const blockCode = policy() ?? (bundle?.installed !== true || bundle.availability !== "profile" ? "UPDATE_PROFILE_UNKNOWN" : version === null ? "UPDATE_INSTALLED_VERSION_UNKNOWN" : void 0);
31259
+ return {
31260
+ version,
31261
+ ...blockCode === void 0 ? {} : { blockCode }
31262
+ };
31263
+ },
31264
+ async install(version, requestId) {
31265
+ if (!isSemver(version)) throw updateError("UPDATE_INVALID_VERSION");
31266
+ const { blockCode } = await this.installed();
31267
+ if (blockCode !== void 0) throw updateError(blockCode);
31268
+ return normalizePluginManagerOutcome(await manager.installBundle(`${CODINGNS_PACKAGE_NAME}@${version}`, {
31269
+ enabled: true,
31270
+ saveExact: true,
31271
+ registry: CODINGNS_NPM_REGISTRY,
31272
+ requestId
31273
+ }), version);
31274
+ },
31275
+ cancellationAvailable: typeof manager.cancelInstall === "function",
31276
+ async cancel(requestId) {
31277
+ return manager.cancelInstall ? (await manager.cancelInstall(requestId)).status : "not-running";
31278
+ }
31279
+ };
31280
+ }
31281
+ function normalizePluginManagerOutcome(value, version) {
31282
+ const result = value;
31283
+ const application = [
31284
+ "applied",
31285
+ "restart-required",
31286
+ "overridden",
31287
+ "failed",
31288
+ "cancelled"
31289
+ ].includes(String(result?.application)) ? result.application : "unknown";
31290
+ const accepted = result?.bundle === "@jingyi0605/codingns4dsh" && result.version === version;
31291
+ const error = result?.error;
31292
+ const code = typeof error?.code === "string" && /^[a-z-]{1,64}$/u.test(error.code) ? `UPDATE_MANAGER_${error.code.toUpperCase().replaceAll("-", "_")}` : void 0;
31293
+ return {
31294
+ application,
31295
+ installedVersion: accepted ? version : null,
31296
+ packageAccepted: accepted,
31297
+ restored: result?.stage === "install" && result.changed === false && result.packageResult !== void 0 && (application === "cancelled" || application === "failed" && error?.code === "incompatible-version"),
31298
+ ...code === void 0 ? {} : { errorCode: code }
31299
+ };
31300
+ }
31301
+ //#endregion
30871
31302
  //#region src/dsh-capabilities/routes.ts
30872
31303
  /**
30873
31304
  * 注册 Codingns4DSH 当前实际消费的 DSH 服务能力。
@@ -30882,10 +31313,32 @@ window.__ModuleLoader__.load({
30882
31313
  const range020 = require_native_workspace_store.DSH_COMPATIBILITY;
30883
31314
  const add = (route) => registry.register(route);
30884
31315
  if (runtime === "host") {
31316
+ for (const [capability, id] of [["plugin.update.inspect", "plugin-manager-inspect-021"], ["plugin.update.apply", "plugin-manager-install-021"]]) add({
31317
+ id,
31318
+ capability,
31319
+ supportedDsh: ">=0.2.1-rc.2",
31320
+ runtime,
31321
+ priority: 10,
31322
+ status: "supported",
31323
+ introducedIn: "0.2.1-rc.2",
31324
+ detect: supportsPluginUpdateManager,
31325
+ create: createPluginUpdateManager
31326
+ });
31327
+ add({
31328
+ id: "plugin-host-version-020",
31329
+ capability: "plugin.host.activation-status",
31330
+ supportedDsh: range020,
31331
+ runtime,
31332
+ priority: 10,
31333
+ status: "supported",
31334
+ introducedIn: "0.2.0-rc.2",
31335
+ detect: () => true,
31336
+ create: () => ({ version: require_native_workspace_store.CODINGNS_VERSION })
31337
+ });
30885
31338
  for (const role of ["member", "lead"]) add({
30886
31339
  id: `agent-team-external-${role}-021`,
30887
31340
  capability: `agent-team.external-${role}`,
30888
- supportedDsh: ">=0.2.1-alpha.2 <=0.2.1-rc.3",
31341
+ supportedDsh: ">=0.2.1-alpha.2",
30889
31342
  runtime,
30890
31343
  priority: 10,
30891
31344
  status: "supported",
@@ -30896,7 +31349,7 @@ window.__ModuleLoader__.load({
30896
31349
  add({
30897
31350
  id: "session-performance-projection-021",
30898
31351
  capability: "session.external-performance",
30899
- supportedDsh: ">=0.2.1-alpha.3 <=0.2.1-rc.3",
31352
+ supportedDsh: ">=0.2.1-alpha.3",
30900
31353
  runtime,
30901
31354
  priority: 10,
30902
31355
  status: "supported",
@@ -30940,7 +31393,7 @@ window.__ModuleLoader__.load({
30940
31393
  add({
30941
31394
  id: "session-prompt-assembly-021",
30942
31395
  capability: "session.prompt-assembly",
30943
- supportedDsh: ">=0.2.1-alpha.3 <=0.2.1-rc.3",
31396
+ supportedDsh: ">=0.2.1-alpha.3",
30944
31397
  runtime,
30945
31398
  priority: 10,
30946
31399
  status: "supported",
@@ -30951,7 +31404,7 @@ window.__ModuleLoader__.load({
30951
31404
  add({
30952
31405
  id: "session-external-model-selection-021",
30953
31406
  capability: "session.external-model-selection",
30954
- supportedDsh: ">=0.2.1-alpha.3 <=0.2.1-rc.3",
31407
+ supportedDsh: ">=0.2.1-alpha.3",
30955
31408
  runtime,
30956
31409
  priority: 10,
30957
31410
  status: "supported",
@@ -30973,7 +31426,7 @@ window.__ModuleLoader__.load({
30973
31426
  add({
30974
31427
  id: "session-activation-021",
30975
31428
  capability: "session.activation",
30976
- supportedDsh: ">=0.2.1-alpha.3 <=0.2.1-rc.3",
31429
+ supportedDsh: ">=0.2.1-alpha.3",
30977
31430
  runtime,
30978
31431
  priority: 10,
30979
31432
  status: "supported",
@@ -30984,7 +31437,7 @@ window.__ModuleLoader__.load({
30984
31437
  for (const capability of ["connection.peer", "connection.uplink"]) add({
30985
31438
  id: `${capability}-021`,
30986
31439
  capability,
30987
- supportedDsh: ">=0.2.1-alpha.3 <=0.2.1-rc.3",
31440
+ supportedDsh: ">=0.2.1-alpha.3",
30988
31441
  runtime,
30989
31442
  priority: 40,
30990
31443
  status: "supported",
@@ -31077,6 +31530,17 @@ window.__ModuleLoader__.load({
31077
31530
  addDsh020HostRoutes(add, range020);
31078
31531
  addPeerHostHostRoutes(add);
31079
31532
  } else {
31533
+ add({
31534
+ id: "plugin-client-reload-unavailable-020",
31535
+ capability: "plugin.client.reload-status",
31536
+ supportedDsh: range020,
31537
+ runtime,
31538
+ priority: 10,
31539
+ status: "supported",
31540
+ introducedIn: "0.2.0-rc.2",
31541
+ detect: () => false,
31542
+ create: () => void 0
31543
+ });
31080
31544
  add({
31081
31545
  id: "sidebar-panellist-main-020",
31082
31546
  capability: "sidebar.global-panel",
@@ -31091,7 +31555,7 @@ window.__ModuleLoader__.load({
31091
31555
  add({
31092
31556
  id: "session-performance-presentation-021",
31093
31557
  capability: "session.external-performance",
31094
- supportedDsh: ">=0.2.1-alpha.3 <=0.2.1-rc.3",
31558
+ supportedDsh: ">=0.2.1-alpha.3",
31095
31559
  runtime,
31096
31560
  priority: 10,
31097
31561
  status: "supported",
@@ -31124,7 +31588,7 @@ window.__ModuleLoader__.load({
31124
31588
  add({
31125
31589
  id: "message-presentation-021",
31126
31590
  capability: "conversation.message-presentation",
31127
- supportedDsh: ">=0.2.1-alpha.3 <=0.2.1-rc.3",
31591
+ supportedDsh: ">=0.2.1-alpha.3",
31128
31592
  runtime,
31129
31593
  priority: 10,
31130
31594
  status: "supported",
@@ -31445,7 +31909,7 @@ window.__ModuleLoader__.load({
31445
31909
  add({
31446
31910
  id: "conversation-draft-share-021",
31447
31911
  capability: "conversation.draft-share",
31448
- supportedDsh: ">=0.2.1-alpha.1 <=0.2.1-rc.3",
31912
+ supportedDsh: ">=0.2.1-alpha.1",
31449
31913
  runtime: "client",
31450
31914
  priority: 30,
31451
31915
  status: "supported",
@@ -31742,6 +32206,482 @@ window.__ModuleLoader__.load({
31742
32206
  return readKey(context, field);
31743
32207
  }
31744
32208
  //#endregion
32209
+ //#region src/client/rpc-call.ts
32210
+ const apiRoutes = /* @__PURE__ */ new WeakMap();
32211
+ /** 只在路由确实不存在或方法不兼容时回退,普通超时不能重复提交写操作。 */
32212
+ async function callCodingNsRpcResult(rpc, endpoint, payload, signal) {
32213
+ if (apiRoutes.get(rpc)?.has(endpoint)) return rpc.call("/api", `codingns/${endpoint}`, payload, signal);
32214
+ try {
32215
+ return await rpc.call(require_transport.CODINGNS_RPC_CHANNEL, endpoint, payload, signal);
32216
+ } catch (error) {
32217
+ if (signal?.aborted || !/HTTP (?:404|405)\b/u.test(error instanceof Error ? error.message : String(error))) throw error;
32218
+ const result = await rpc.call("/api", `codingns/${endpoint}`, payload, signal);
32219
+ let routes = apiRoutes.get(rpc);
32220
+ if (routes === void 0) {
32221
+ routes = /* @__PURE__ */ new Set();
32222
+ apiRoutes.set(rpc, routes);
32223
+ }
32224
+ routes.add(endpoint);
32225
+ return result;
32226
+ }
32227
+ }
32228
+ //#endregion
32229
+ //#region src/client/magpie-context-store.ts
32230
+ const POLL_INTERVAL_MS = 3e3;
32231
+ const IDLE_STATE = { status: "idle" };
32232
+ const NATIVE_STATE = { status: "native" };
32233
+ const stores$1 = /* @__PURE__ */ new WeakMap();
32234
+ const EMPTY_STORE = {
32235
+ subscribe: () => () => void 0,
32236
+ getSnapshot: () => NATIVE_STATE,
32237
+ getServerSnapshot: () => NATIVE_STATE
32238
+ };
32239
+ var MagpieContextStore = class {
32240
+ rpc;
32241
+ sessionId;
32242
+ listeners = /* @__PURE__ */ new Set();
32243
+ state = IDLE_STATE;
32244
+ request;
32245
+ timer;
32246
+ polling = false;
32247
+ constructor(rpc, sessionId) {
32248
+ this.rpc = rpc;
32249
+ this.sessionId = sessionId;
32250
+ }
32251
+ getSnapshot = () => this.state;
32252
+ getServerSnapshot = () => IDLE_STATE;
32253
+ subscribe = (listener) => {
32254
+ this.listeners.add(listener);
32255
+ if (this.listeners.size === 1) this.load(false);
32256
+ return () => {
32257
+ this.listeners.delete(listener);
32258
+ if (this.listeners.size === 0) this.stopPolling();
32259
+ };
32260
+ };
32261
+ setPolling(enabled) {
32262
+ this.polling = enabled;
32263
+ if (!enabled) {
32264
+ this.stopPolling();
32265
+ return;
32266
+ }
32267
+ this.schedulePoll();
32268
+ }
32269
+ refresh() {
32270
+ return this.load(true);
32271
+ }
32272
+ async load(force) {
32273
+ if (this.request !== void 0) return this.request;
32274
+ if (!force && this.state.status === "ready") return;
32275
+ if (this.state.status !== "ready") this.setState({ status: "loading" });
32276
+ const request = callCodingNsRpcResult(this.rpc, "magpie/context", { sessionId: this.sessionId }).then((result) => {
32277
+ if (!result.ok) {
32278
+ if (this.state.status !== "ready") this.setState({ status: "error" });
32279
+ return;
32280
+ }
32281
+ const value = readMagpieContextSession(result.value);
32282
+ this.setState(value === null ? NATIVE_STATE : {
32283
+ status: "ready",
32284
+ value
32285
+ });
32286
+ }).catch(() => {
32287
+ if (this.state.status !== "ready") this.setState({ status: "error" });
32288
+ }).finally(() => {
32289
+ if (this.request === request) this.request = void 0;
32290
+ this.schedulePoll();
32291
+ });
32292
+ this.request = request;
32293
+ return request;
32294
+ }
32295
+ schedulePoll() {
32296
+ if (!this.polling || this.listeners.size === 0 || this.timer !== void 0) return;
32297
+ this.timer = setTimeout(() => {
32298
+ this.timer = void 0;
32299
+ this.load(true);
32300
+ }, POLL_INTERVAL_MS);
32301
+ }
32302
+ stopPolling() {
32303
+ if (this.timer !== void 0) clearTimeout(this.timer);
32304
+ this.timer = void 0;
32305
+ }
32306
+ setState(next) {
32307
+ if (sameState(this.state, next)) return;
32308
+ this.state = next;
32309
+ for (const listener of [...this.listeners]) listener();
32310
+ }
32311
+ };
32312
+ function getMagpieContextStore(rpc, sessionId) {
32313
+ const normalized = sessionId.trim();
32314
+ let bySession = stores$1.get(rpc);
32315
+ if (bySession === void 0) {
32316
+ bySession = /* @__PURE__ */ new Map();
32317
+ stores$1.set(rpc, bySession);
32318
+ }
32319
+ let store = bySession.get(normalized);
32320
+ if (store === void 0) {
32321
+ store = new MagpieContextStore(rpc, normalized);
32322
+ bySession.set(normalized, store);
32323
+ }
32324
+ return store;
32325
+ }
32326
+ function useMagpieContext(rpc, sessionId) {
32327
+ const store = rpc === void 0 || sessionId === void 0 || sessionId.trim() === "" ? EMPTY_STORE : getMagpieContextStore(rpc, sessionId);
32328
+ return (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getServerSnapshot);
32329
+ }
32330
+ function readMagpieContextSession(value) {
32331
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
32332
+ const record = value;
32333
+ return typeof record.agent === "string" && typeof record.key === "string" && typeof record.model === "string" && Number.isSafeInteger(record.usedTokens) && Number.isSafeInteger(record.contextWindow) && Array.isArray(record.parts) ? value : null;
32334
+ }
32335
+ function sameState(left, right) {
32336
+ if (left.status !== right.status) return false;
32337
+ return left.status === "ready" && right.status === "ready" ? sameContextSession(left.value, right.value) : true;
32338
+ }
32339
+ function sameContextSession(left, right) {
32340
+ if (left.agent !== right.agent || left.key !== right.key || left.title !== right.title || left.model !== right.model || left.requests !== right.requests || left.turns !== right.turns || left.usedTokens !== right.usedTokens || left.contextWindow !== right.contextWindow || left.cacheTokens !== right.cacheTokens || left.cacheRate !== right.cacheRate || left.compacts !== right.compacts || left.latestId !== right.latestId || left.parts.length !== right.parts.length || left.points.length !== right.points.length) return false;
32341
+ for (let index = 0; index < left.parts.length; index += 1) {
32342
+ const a = left.parts[index];
32343
+ const b = right.parts[index];
32344
+ if (a.kind !== b.kind || a.tokens !== b.tokens || a.items.length !== b.items.length) return false;
32345
+ for (let itemIndex = 0; itemIndex < a.items.length; itemIndex += 1) {
32346
+ const item = a.items[itemIndex];
32347
+ const other = b.items[itemIndex];
32348
+ if (item.name !== other.name || item.tag !== other.tag || item.count !== other.count || item.tokens !== other.tokens) return false;
32349
+ }
32350
+ }
32351
+ for (let index = 0; index < left.points.length; index += 1) {
32352
+ const point = left.points[index];
32353
+ const other = right.points[index];
32354
+ if (point.id !== other.id || point.time !== other.time || point.tokens !== other.tokens || point.window !== other.window || point.cacheTokens !== other.cacheTokens) return false;
32355
+ }
32356
+ return true;
32357
+ }
32358
+ //#endregion
32359
+ //#region src/client/magpie-context-meter.ts
32360
+ const STYLE_ID$4 = "codingns4dsh-magpie-context-meter";
32361
+ const COLORS = {
32362
+ system: "#8b5cf6",
32363
+ tools: "#1ea7d9",
32364
+ memory: "#f1a31a",
32365
+ files: "#20b98b",
32366
+ results: "#e13d8d",
32367
+ chat: "#4f46d8"
32368
+ };
32369
+ const PART_LABEL_KEYS = {
32370
+ system: "magpie.context.system",
32371
+ tools: "magpie.context.tools",
32372
+ memory: "magpie.context.memory",
32373
+ files: "magpie.context.files",
32374
+ results: "magpie.context.results",
32375
+ chat: "magpie.context.chat"
32376
+ };
32377
+ const PART_ORDER = [
32378
+ "system",
32379
+ "tools",
32380
+ "memory",
32381
+ "files",
32382
+ "results",
32383
+ "chat"
32384
+ ];
32385
+ const NATIVE_PARTS = [
32386
+ {
32387
+ key: "systemTokens",
32388
+ label: "magpie.context.system",
32389
+ color: "var(--dsw-static-neutral-bluish-400, #aeb3bc)"
32390
+ },
32391
+ {
32392
+ key: "toolsTokens",
32393
+ label: "magpie.context.nativeTools",
32394
+ color: "#a78bfa"
32395
+ },
32396
+ {
32397
+ key: "messageTokens",
32398
+ label: "magpie.context.nativeMessages",
32399
+ color: "var(--dsw-static-blue-450, #4b8df8)"
32400
+ }
32401
+ ];
32402
+ const FALLBACK_LOCALE$2 = {
32403
+ bind: () => require_transport.resolveCodingNsTranslator(),
32404
+ getSnapshot: () => ({
32405
+ active: "en",
32406
+ locales: [],
32407
+ revision: 0
32408
+ }),
32409
+ subscribe: () => () => void 0,
32410
+ register: () => () => void 0
32411
+ };
32412
+ /**
32413
+ * Enhance DSH's native ContextMeter without adding another visible trigger.
32414
+ * The native button receives Magpie's pressure through the composer projection;
32415
+ * this zero-layout entry only redirects its dialog to the Magpie inspector.
32416
+ */
32417
+ function MagpieContextMeter({ rpc, sessionId, locale, useSession, useProjection }) {
32418
+ const state = useMagpieContext(rpc, sessionId);
32419
+ const store = rpc === void 0 || sessionId === void 0 ? void 0 : getMagpieContextStore(rpc, sessionId);
32420
+ const running = useSession?.((value) => value.running) === true;
32421
+ const revision = useSession?.((value) => JSON.stringify([value.modelSelection, value.running]));
32422
+ const nativePressure = useProjection?.("contextPressure");
32423
+ const nativeBreakdown = useProjection?.("contextBreakdown");
32424
+ const [open, setOpen] = (0, react.useState)(false);
32425
+ const [activeKind, setActiveKind] = (0, react.useState)("all");
32426
+ const [placement, setPlacement] = (0, react.useState)({
32427
+ left: 12,
32428
+ bottom: 52
32429
+ });
32430
+ const rootRef = (0, react.useRef)(null);
32431
+ const anchorRef = (0, react.useRef)(null);
32432
+ const panelRef = (0, react.useRef)(null);
32433
+ const openRef = (0, react.useRef)(open);
32434
+ const t = require_transport.useCodingNsTranslator(locale ?? FALLBACK_LOCALE$2);
32435
+ (0, react.useEffect)(() => {
32436
+ installStyles$1();
32437
+ }, []);
32438
+ (0, react.useEffect)(() => {
32439
+ if (revision !== void 0) store?.refresh();
32440
+ }, [revision, store]);
32441
+ (0, react.useEffect)(() => {
32442
+ openRef.current = open;
32443
+ store?.setPolling(open || running || state.status === "ready");
32444
+ return () => store?.setPolling(false);
32445
+ }, [
32446
+ open,
32447
+ running,
32448
+ state.status,
32449
+ store
32450
+ ]);
32451
+ (0, react.useEffect)(() => {
32452
+ if (state.status !== "ready" && open) setOpen(false);
32453
+ }, [open, state.status]);
32454
+ const updatePlacement = (0, react.useCallback)(() => {
32455
+ if (typeof window === "undefined") return;
32456
+ const rect = anchorRef.current?.getBoundingClientRect();
32457
+ if (rect === void 0) return;
32458
+ const panelWidth = Math.min(980, Math.max(280, window.innerWidth - 24));
32459
+ const left = Math.max(12, Math.min(rect.left - Math.max(0, (panelWidth - rect.width) / 2), window.innerWidth - panelWidth - 12));
32460
+ setPlacement({
32461
+ left,
32462
+ bottom: Math.max(12, window.innerHeight - rect.top + 8)
32463
+ });
32464
+ }, []);
32465
+ (0, react.useEffect)(() => {
32466
+ if (state.status !== "ready" || typeof document === "undefined") return;
32467
+ const dock = rootRef.current?.closest("[data-composer-dock]");
32468
+ if (dock === null || dock === void 0) return;
32469
+ let attached = null;
32470
+ let nativeExpanded = null;
32471
+ const onClick = (event) => {
32472
+ event.preventDefault();
32473
+ event.stopImmediatePropagation();
32474
+ updatePlacement();
32475
+ setOpen((value) => !value);
32476
+ };
32477
+ const detach = () => {
32478
+ if (attached === null) return;
32479
+ attached.removeEventListener("click", onClick, true);
32480
+ if (nativeExpanded === null) attached.removeAttribute("aria-expanded");
32481
+ else attached.setAttribute("aria-expanded", nativeExpanded);
32482
+ if (anchorRef.current === attached) anchorRef.current = null;
32483
+ };
32484
+ const bind = () => {
32485
+ const next = findNativeContextTrigger(dock);
32486
+ if (next === attached) return;
32487
+ detach();
32488
+ attached = next;
32489
+ anchorRef.current = next;
32490
+ if (next !== null) {
32491
+ nativeExpanded = next.getAttribute("aria-expanded");
32492
+ next.setAttribute("aria-expanded", String(openRef.current));
32493
+ next.addEventListener("click", onClick, true);
32494
+ }
32495
+ if (openRef.current) updatePlacement();
32496
+ };
32497
+ bind();
32498
+ const observer = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver(bind);
32499
+ observer?.observe(dock, {
32500
+ childList: true,
32501
+ subtree: true
32502
+ });
32503
+ return () => {
32504
+ observer?.disconnect();
32505
+ detach();
32506
+ };
32507
+ }, [state.status, updatePlacement]);
32508
+ (0, react.useEffect)(() => {
32509
+ if (!open) return;
32510
+ updatePlacement();
32511
+ window.addEventListener("resize", updatePlacement);
32512
+ window.addEventListener("scroll", updatePlacement, true);
32513
+ return () => {
32514
+ window.removeEventListener("resize", updatePlacement);
32515
+ window.removeEventListener("scroll", updatePlacement, true);
32516
+ };
32517
+ }, [open]);
32518
+ useDismissOnOutsidePointer(anchorRef, open, () => setOpen(false), { portal: panelRef });
32519
+ (0, react.useEffect)(() => {
32520
+ const trigger = anchorRef.current;
32521
+ if (trigger === null) return;
32522
+ trigger.setAttribute("aria-expanded", String(open));
32523
+ }, [open]);
32524
+ if (state.status !== "ready") return (0, react.createElement)("span", {
32525
+ ref: rootRef,
32526
+ "data-codingns-magpie-context-enhancer": true,
32527
+ style: hiddenEnhancerStyle
32528
+ });
32529
+ const value = state.value;
32530
+ const panel = open && typeof document !== "undefined" ? (0, import_react_dom.createPortal)(createContextPanel(value, t, activeKind, setActiveKind, () => setOpen(false), placement, panelRef, createNativeContextSummary(nativePressure, nativeBreakdown, t)), document.body) : null;
32531
+ return (0, react.createElement)("span", {
32532
+ ref: rootRef,
32533
+ "data-codingns-magpie-context-enhancer": true,
32534
+ style: hiddenEnhancerStyle
32535
+ }, panel);
32536
+ }
32537
+ const hiddenEnhancerStyle = { display: "none" };
32538
+ function findNativeContextTrigger(dock) {
32539
+ for (const button of dock.querySelectorAll("button.JObwrW_trigger")) if (button.closest("[data-composer-dock]") === dock && button.closest("[data-codingns-magpie-context-enhancer]") === null && button.closest(".JObwrW_root") !== null) return button;
32540
+ return null;
32541
+ }
32542
+ function createNativeContextSummary(pressure, breakdown, t) {
32543
+ const used = pressure?.projectedTokens ?? pressure?.pressureTokens;
32544
+ const capacity = pressure?.contextWindow;
32545
+ if (!isTokenCount(used) || !isTokenCount(capacity) || capacity === 0) return null;
32546
+ const percent = Math.min(100, Math.round(used / capacity * 100));
32547
+ const parts = breakdown !== void 0 && NATIVE_PARTS.every((part) => isTokenCount(breakdown?.[part.key])) ? NATIVE_PARTS.map((part) => ({
32548
+ ...part,
32549
+ tokens: breakdown[part.key]
32550
+ })) : [];
32551
+ const total = parts.reduce((sum, part) => sum + part.tokens, 0);
32552
+ return (0, react.createElement)("section", {
32553
+ className: "codingns4dsh-magpie-context-native",
32554
+ "aria-label": t("magpie.context.native")
32555
+ }, (0, react.createElement)("strong", { className: "codingns4dsh-magpie-context-heading-label" }, t("magpie.context.native")), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-native-usage" }, (0, react.createElement)("span", void 0, t("magpie.context.usedPercent", { percent })), (0, react.createElement)("strong", void 0, `~${formatTokens$1(used)} / ${formatTokens$1(capacity)}`)), (0, react.createElement)("div", {
32556
+ className: "codingns4dsh-magpie-context-native-bar",
32557
+ role: "meter",
32558
+ "aria-label": t("magpie.context.used"),
32559
+ "aria-valuemin": 0,
32560
+ "aria-valuemax": 100,
32561
+ "aria-valuenow": percent
32562
+ }, total > 0 ? parts.map((part) => (0, react.createElement)("span", {
32563
+ key: part.key,
32564
+ style: {
32565
+ width: `${percent * part.tokens / total}%`,
32566
+ background: part.color
32567
+ }
32568
+ })) : (0, react.createElement)("span", { style: {
32569
+ width: `${percent}%`,
32570
+ background: require_theme.dshThemeColor.labelTertiary
32571
+ } })), parts.length > 0 && (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-caption" }, t("magpie.context.nativeComposition")), parts.length > 0 && (0, react.createElement)("dl", { className: "codingns4dsh-magpie-context-native-parts" }, parts.map((part) => (0, react.createElement)("div", { key: part.key }, (0, react.createElement)("dt", void 0, (0, react.createElement)("i", {
32572
+ "aria-hidden": true,
32573
+ style: { background: part.color }
32574
+ }), t(part.label)), (0, react.createElement)("dd", void 0, (0, react.createElement)("span", void 0, `~${formatTokens$1(part.tokens)}`), (0, react.createElement)("span", { className: "codingns4dsh-magpie-context-caption" }, `${total > 0 ? trimDecimal(part.tokens / total * 100) : "0"}%`))))));
32575
+ }
32576
+ function isTokenCount(value) {
32577
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
32578
+ }
32579
+ function createContextPanel(value, t, activeKind, setActiveKind, close, placement, panelRef, nativeSummary) {
32580
+ const used = formatTokens$1(value.usedTokens);
32581
+ const windowSize = formatTokens$1(value.contextWindow);
32582
+ const cache = `${Math.round(value.cacheRate * 100)}%`;
32583
+ const parts = PART_ORDER.map((kind) => value.parts.find((part) => part.kind === kind) ?? emptyPart(kind));
32584
+ const total = Math.max(1, parts.reduce((sum, part) => sum + part.tokens, 0));
32585
+ const contentItems = (activeKind === "all" ? parts : parts.filter((part) => part.kind === activeKind)).flatMap((part) => part.items.map((item) => ({
32586
+ ...item,
32587
+ kind: part.kind
32588
+ }))).sort((left, right) => right.tokens - left.tokens);
32589
+ const rounds = value.points.slice(-12).reverse();
32590
+ return (0, react.createElement)("div", {
32591
+ ref: panelRef,
32592
+ className: "codingns4dsh-magpie-context-panel",
32593
+ role: "dialog",
32594
+ "aria-label": t("magpie.context.window"),
32595
+ style: {
32596
+ left: placement.left,
32597
+ bottom: placement.bottom
32598
+ }
32599
+ }, nativeSummary, (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-heading" }, (0, react.createElement)("div", void 0, (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-heading-label" }, t("magpie.context.used")), (0, react.createElement)("strong", { className: "codingns4dsh-magpie-context-heading-value" }, used), (0, react.createElement)("span", { className: "codingns4dsh-magpie-context-heading-unit" }, " token"), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-caption" }, t("magpie.context.modelWindow", { value: windowSize }))), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-cache" }, (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-heading-label" }, t("magpie.context.cache")), (0, react.createElement)("strong", { className: "codingns4dsh-magpie-context-cache-value" }, cache), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-caption" }, t("magpie.context.hit")), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-cache-track" }, (0, react.createElement)("span", { style: { width: `${Math.round(value.cacheRate * 100)}%` } }))), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-model" }, (0, react.createElement)("span", void 0, value.model), (0, react.createElement)("button", {
32600
+ type: "button",
32601
+ onClick: close,
32602
+ "aria-label": t("magpie.context.close")
32603
+ }, "×"))), (0, react.createElement)("div", {
32604
+ className: "codingns4dsh-magpie-context-treemap",
32605
+ "aria-label": t("magpie.context.composition")
32606
+ }, parts.map((part) => (0, react.createElement)("div", {
32607
+ key: part.kind,
32608
+ className: `codingns4dsh-magpie-context-block codingns4dsh-magpie-context-block-${part.kind}`,
32609
+ style: {
32610
+ "--codingns-magpie-part-color": COLORS[part.kind],
32611
+ "--codingns-magpie-part-size": `${Math.max(4, part.tokens / total * 100)}%`,
32612
+ flex: `${Math.max(.04, part.tokens / total)} 1 0`
32613
+ }
32614
+ }, (0, react.createElement)("strong", void 0, labelFor(part.kind, t)), (0, react.createElement)("span", void 0, formatTokens$1(part.tokens))))), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-legend" }, parts.map((part) => (0, react.createElement)("button", {
32615
+ key: part.kind,
32616
+ type: "button",
32617
+ className: activeKind === part.kind ? "is-active" : "",
32618
+ onClick: () => setActiveKind(activeKind === part.kind ? "all" : part.kind)
32619
+ }, (0, react.createElement)("i", { style: { background: COLORS[part.kind] } }), labelFor(part.kind, t), formatTokens$1(part.tokens)))), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-content-heading" }, (0, react.createElement)("strong", void 0, t("magpie.context.content")), (0, react.createElement)("span", void 0, t("magpie.context.allCount", { count: contentItems.length }))), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-tabs" }, (0, react.createElement)("button", {
32620
+ type: "button",
32621
+ className: activeKind === "all" ? "is-active" : "",
32622
+ onClick: () => setActiveKind("all")
32623
+ }, t("magpie.context.all")), parts.map((part) => (0, react.createElement)("button", {
32624
+ key: part.kind,
32625
+ type: "button",
32626
+ className: activeKind === part.kind ? "is-active" : "",
32627
+ onClick: () => setActiveKind(part.kind)
32628
+ }, labelFor(part.kind, t)))), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-list" }, contentItems.length === 0 ? (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-empty" }, t("magpie.context.empty")) : contentItems.slice(0, 61).map((item, index) => (0, react.createElement)("div", {
32629
+ key: `${item.kind}-${item.name}-${index}`,
32630
+ className: "codingns4dsh-magpie-context-row"
32631
+ }, (0, react.createElement)("span", { className: "codingns4dsh-magpie-context-row-name" }, displayItemName(item.name, item.kind, item.count, t)), (0, react.createElement)("span", { className: "codingns4dsh-magpie-context-row-tag" }, item.tag ?? labelFor(item.kind, t)), (0, react.createElement)("span", { className: "codingns4dsh-magpie-context-row-bar" }, (0, react.createElement)("i", { style: {
32632
+ width: `${Math.min(100, Math.max(2, item.tokens / Math.max(1, contentItems[0].tokens) * 100))}%`,
32633
+ background: COLORS[item.kind]
32634
+ } })), (0, react.createElement)("span", { className: "codingns4dsh-magpie-context-row-value" }, formatTokens$1(item.tokens))))), (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-session" }, (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-breadcrumb" }, `${value.agent} › ${truncate(value.key)} › #${value.latestId ?? "—"}`), (0, react.createElement)("span", void 0, `${t("magpie.context.rounds", { count: value.turns })} · ${t("magpie.context.requests", { count: value.requests })}`)), rounds.length > 0 && (0, react.createElement)("div", { className: "codingns4dsh-magpie-context-rounds" }, rounds.map((point, index) => (0, react.createElement)("div", {
32635
+ key: point.id,
32636
+ className: "codingns4dsh-magpie-context-round"
32637
+ }, (0, react.createElement)("span", void 0, t("magpie.context.request", { count: value.points.length - index })), (0, react.createElement)("i", void 0, (0, react.createElement)("b", { style: { width: `${Math.min(100, point.tokens / Math.max(1, value.contextWindow) * 100)}%` } })), (0, react.createElement)("span", void 0, formatTokens$1(point.tokens))))));
32638
+ }
32639
+ function installStyles$1() {
32640
+ if (typeof document === "undefined" || document.getElementById(STYLE_ID$4) !== null) return null;
32641
+ const style = document.createElement("style");
32642
+ style.id = STYLE_ID$4;
32643
+ style.textContent = `
32644
+ .codingns4dsh-magpie-context-panel{position:fixed;z-index:10000;width:min(980px,calc(100vw - 24px));max-height:min(82vh,780px);overflow:auto;box-sizing:border-box;padding:18px 20px 12px;color:${require_theme.dshThemeColor.labelPrimary};background:${require_theme.dshThemeColor.menuBackground};border:1px solid ${require_theme.dshThemeColor.menuBorder};border-radius:14px;box-shadow:${require_theme.dshThemeColor.prominentShadow};font-size:${require_theme.uiFontSize(12)};line-height:1.35}
32645
+ .codingns4dsh-magpie-context-native{border-bottom:1px solid ${require_theme.dshThemeColor.fieldBorder};padding-bottom:14px;margin-bottom:16px}.codingns4dsh-magpie-context-native-usage{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin-top:7px;color:${require_theme.dshThemeColor.labelSecondary};font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-native-usage strong{margin-left:auto;color:${require_theme.dshThemeColor.labelPrimary};font-weight:500}.codingns4dsh-magpie-context-native-bar{display:flex;height:4px;overflow:hidden;margin:10px 0 12px;border-radius:99px;background:${require_theme.dshThemeColor.surfaceSubtle}}.codingns4dsh-magpie-context-native-bar span{flex:none;height:100%;border-radius:1px}.codingns4dsh-magpie-context-native-parts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px 24px;margin:8px 0 0}.codingns4dsh-magpie-context-native-parts>div{display:flex;justify-content:space-between;align-items:center;gap:8px;min-width:0}.codingns4dsh-magpie-context-native-parts dt{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:${require_theme.dshThemeColor.labelSecondary}}.codingns4dsh-magpie-context-native-parts dt i{display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:6px}.codingns4dsh-magpie-context-native-parts dd{display:flex;gap:8px;margin:0;white-space:nowrap;font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-native-parts dd .codingns4dsh-magpie-context-caption{margin:0}
32646
+ @media (max-width:640px){.codingns4dsh-magpie-context-native-parts{grid-template-columns:minmax(0,1fr)}}
32647
+ .codingns4dsh-magpie-context-heading{display:grid;grid-template-columns:minmax(180px,1fr) minmax(160px,1fr) minmax(160px,1fr);gap:18px;align-items:start;margin-bottom:14px}.codingns4dsh-magpie-context-heading-label{color:${require_theme.dshThemeColor.labelTertiary};font-size:${require_theme.uiFontSize(12)};font-weight:600}.codingns4dsh-magpie-context-heading-value{font-size:${require_theme.uiFontSize(28)};line-height:1;font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-heading-unit{color:${require_theme.dshThemeColor.labelSecondary};margin-left:4px}.codingns4dsh-magpie-context-caption{color:${require_theme.dshThemeColor.labelTertiary};margin-top:4px}.codingns4dsh-magpie-context-cache-value{display:block;color:#6bbd99;font-size:${require_theme.uiFontSize(28)};line-height:1;font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-cache-track{height:6px;margin-top:8px;border-radius:99px;background:var(--dsw-alias-fill-tertiary,rgba(127,127,127,.12));overflow:hidden}.codingns4dsh-magpie-context-cache-track span{display:block;height:100%;background:#8bcfae;border-radius:inherit}.codingns4dsh-magpie-context-model{display:flex;justify-content:space-between;gap:8px;color:${require_theme.dshThemeColor.labelSecondary};font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-model button{border:0;background:transparent;color:${require_theme.dshThemeColor.labelTertiary};font-size:20px;line-height:18px;cursor:pointer}
32648
+ .codingns4dsh-magpie-context-treemap{display:flex;min-height:168px;gap:4px;margin:8px 0 10px}.codingns4dsh-magpie-context-block{min-width:0;display:flex;flex-direction:column;justify-content:flex-start;padding:9px 10px;border:1px solid color-mix(in srgb,var(--codingns-magpie-part-color) 25%,transparent);border-radius:8px;background:color-mix(in srgb,var(--codingns-magpie-part-color) 9%,transparent);color:var(--codingns-magpie-part-color);overflow:hidden}.codingns4dsh-magpie-context-block strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:${require_theme.uiFontSize(12)}}.codingns4dsh-magpie-context-block span{font-size:${require_theme.uiFontSize(11)};color:${require_theme.dshThemeColor.labelTertiary};font-variant-numeric:tabular-nums}
32649
+ .codingns4dsh-magpie-context-legend{display:flex;flex-wrap:wrap;gap:5px 13px;border-bottom:1px solid ${require_theme.dshThemeColor.fieldBorder};padding-bottom:10px}.codingns4dsh-magpie-context-legend button,.codingns4dsh-magpie-context-tabs button{border:0;background:transparent;color:${require_theme.dshThemeColor.labelSecondary};cursor:pointer;padding:3px 0;font-size:${require_theme.uiFontSize(11)};font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-legend button.is-active,.codingns4dsh-magpie-context-tabs button.is-active{color:${require_theme.dshThemeColor.labelPrimary};font-weight:700}.codingns4dsh-magpie-context-legend i{display:inline-block;width:8px;height:8px;margin-right:5px;border-radius:2px}
32650
+ .codingns4dsh-magpie-context-content-heading{display:flex;justify-content:space-between;align-items:center;margin-top:13px;font-size:${require_theme.uiFontSize(13)}}.codingns4dsh-magpie-context-content-heading span{color:${require_theme.dshThemeColor.labelTertiary};font-size:${require_theme.uiFontSize(11)}}.codingns4dsh-magpie-context-tabs{display:flex;gap:13px;overflow:auto;margin:8px 0 2px;border-bottom:1px solid ${require_theme.dshThemeColor.fieldBorder}}.codingns4dsh-magpie-context-list{display:flex;flex-direction:column;min-height:60px}.codingns4dsh-magpie-context-row{display:grid;grid-template-columns:minmax(90px,1.1fr) minmax(70px,.7fr) minmax(100px,1fr) 52px;gap:9px;align-items:center;min-height:27px;border-bottom:1px solid color-mix(in srgb,currentColor 7%,transparent)}.codingns4dsh-magpie-context-row-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.codingns4dsh-magpie-context-row-tag{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:${require_theme.dshThemeColor.labelTertiary};font-size:${require_theme.uiFontSize(10)}}.codingns4dsh-magpie-context-row-bar{height:5px;border-radius:99px;background:var(--dsw-alias-fill-tertiary,rgba(127,127,127,.12));overflow:hidden}.codingns4dsh-magpie-context-row-bar i{display:block;height:100%;border-radius:inherit}.codingns4dsh-magpie-context-row-value{text-align:right;color:${require_theme.dshThemeColor.labelSecondary};font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-empty{padding:22px;text-align:center;color:${require_theme.dshThemeColor.labelTertiary}}
32651
+ .codingns4dsh-magpie-context-session{display:flex;justify-content:space-between;gap:10px;margin-top:13px;color:${require_theme.dshThemeColor.labelTertiary};font-size:${require_theme.uiFontSize(11)};font-variant-numeric:tabular-nums}.codingns4dsh-magpie-context-breadcrumb{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.codingns4dsh-magpie-context-rounds{display:flex;flex-direction:column;gap:3px;margin-top:7px}.codingns4dsh-magpie-context-round{display:grid;grid-template-columns:75px minmax(80px,1fr) 50px;gap:8px;align-items:center;color:${require_theme.dshThemeColor.labelTertiary};font-size:${require_theme.uiFontSize(10)}}.codingns4dsh-magpie-context-round i{height:4px;border-radius:99px;background:var(--dsw-alias-fill-tertiary,rgba(127,127,127,.12));overflow:hidden}.codingns4dsh-magpie-context-round b{display:block;height:100%;border-radius:inherit;background:#4f46d8}.codingns4dsh-magpie-context-round>span:last-child{text-align:right;font-variant-numeric:tabular-nums}
32652
+ @media (max-width:640px){.codingns4dsh-magpie-context-panel{padding:13px 12px 10px}.codingns4dsh-magpie-context-heading{grid-template-columns:1fr 1fr;gap:10px}.codingns4dsh-magpie-context-model{grid-column:1 / -1}.codingns4dsh-magpie-context-treemap{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,54px)}.codingns4dsh-magpie-context-block{flex:initial!important}.codingns4dsh-magpie-context-row{grid-template-columns:minmax(90px,1fr) minmax(90px,1fr) 52px}.codingns4dsh-magpie-context-row-tag{display:none}.codingns4dsh-magpie-context-session{display:block}.codingns4dsh-magpie-context-session>span{display:block;margin-top:3px}}
32653
+ @media (prefers-reduced-motion:reduce){.codingns4dsh-magpie-context-panel{transition:none}}
32654
+ `;
32655
+ document.head.appendChild(style);
32656
+ return null;
32657
+ }
32658
+ function formatTokens$1(value) {
32659
+ if (value < 1e3) return String(Math.round(value));
32660
+ if (value < 1e6) return `${trimDecimal(value / 1e3)}K`;
32661
+ return `${trimDecimal(value / 1e6)}M`;
32662
+ }
32663
+ function trimDecimal(value) {
32664
+ return (value >= 100 ? Math.round(value) : Math.round(value * 10) / 10).toString();
32665
+ }
32666
+ function labelFor(kind, t) {
32667
+ return t(PART_LABEL_KEYS[kind]);
32668
+ }
32669
+ function emptyPart(kind) {
32670
+ return {
32671
+ kind,
32672
+ tokens: 0,
32673
+ items: []
32674
+ };
32675
+ }
32676
+ function displayItemName(name, kind, count, t) {
32677
+ if (kind === "chat" && name === "earlier") return t("magpie.context.earlierRounds", { count: count ?? 0 });
32678
+ if (kind === "chat" && /^\d+$/u.test(name)) return t("magpie.context.round", { count: name });
32679
+ return name;
32680
+ }
32681
+ function truncate(value) {
32682
+ return value.length > 24 ? `${value.slice(0, 24)}…` : value;
32683
+ }
32684
+ //#endregion
31745
32685
  //#region src/client/peer-host-scoped-client.ts
31746
32686
  /** 根据当前 Host 自有端点生成作用域 WebSocket 工厂;不接受目标 Host URL。 */
31747
32687
  function createPeerHostWebSocketFactory(endpoint, options = {}) {
@@ -32790,7 +33730,15 @@ window.__ModuleLoader__.load({
32790
33730
  if (performance !== void 0) context.resources.add(performance.install((sessionId) => (0, react.useSyncExternalStore)(subscribeSessionAdapters, () => sessionAdapterId(sessionId), () => sessionAdapterId(sessionId)), react.createElement, {
32791
33731
  useMemo: react.useMemo,
32792
33732
  useSyncExternalStore: react.useSyncExternalStore
32793
- }));
33733
+ }, { magpieContext: {
33734
+ component: MagpieContextMeter,
33735
+ rpc: context.services.rpc,
33736
+ locale: context.services.locale,
33737
+ useSnapshot: (rpc, sessionId) => {
33738
+ const state = useMagpieContext(rpc, sessionId);
33739
+ return state.status === "ready" ? state.value : null;
33740
+ }
33741
+ } }));
32794
33742
  const { registerDelegateCommand } = await require.async("./client.delegate-command.js");
32795
33743
  context.resources.add(registerDelegateCommand(uiContext, {
32796
33744
  rpc: context.services.rpc,
@@ -33564,26 +34512,6 @@ window.__ModuleLoader__.load({
33564
34512
  } }, t("cli.thinkingLevel", { value: model.efforts.length > 0 ? model.efforts.map((effort) => model.effortLabels?.[effort] ?? effort).join(t("common.listSeparator")) : t("cli.defaultEffort") })));
33565
34513
  }
33566
34514
  //#endregion
33567
- //#region src/client/rpc-call.ts
33568
- const apiRoutes = /* @__PURE__ */ new WeakMap();
33569
- /** 只在路由确实不存在或方法不兼容时回退,普通超时不能重复提交写操作。 */
33570
- async function callCodingNsRpcResult(rpc, endpoint, payload, signal) {
33571
- if (apiRoutes.get(rpc)?.has(endpoint)) return rpc.call("/api", `codingns/${endpoint}`, payload, signal);
33572
- try {
33573
- return await rpc.call(require_transport.CODINGNS_RPC_CHANNEL, endpoint, payload, signal);
33574
- } catch (error) {
33575
- if (signal?.aborted || !/HTTP (?:404|405)\b/u.test(error instanceof Error ? error.message : String(error))) throw error;
33576
- const result = await rpc.call("/api", `codingns/${endpoint}`, payload, signal);
33577
- let routes = apiRoutes.get(rpc);
33578
- if (routes === void 0) {
33579
- routes = /* @__PURE__ */ new Set();
33580
- apiRoutes.set(rpc, routes);
33581
- }
33582
- routes.add(endpoint);
33583
- return result;
33584
- }
33585
- }
33586
- //#endregion
33587
34515
  //#region src/client/feature-requirement.ts
33588
34516
  /** Magpie 安装探测的 RPC 端点;设置卡片与模块面板共用一个探测结果。 */
33589
34517
  const MAGPIE_DETECTION_ENDPOINT = "magpie/management/detection";
@@ -35567,40 +36495,73 @@ window.__ModuleLoader__.load({
35567
36495
  loadManagement(controller.signal);
35568
36496
  return () => controller.abort();
35569
36497
  }, [loadManagement, refreshKey]);
35570
- const loadUpdates = (0, react.useCallback)(async (signal) => {
36498
+ const loadUpdates = (0, react.useCallback)(async (signal, check = false) => {
35571
36499
  setUpdateLoading(true);
35572
36500
  setUpdateError(null);
35573
36501
  try {
35574
- const [status, notes] = await Promise.all([callMagpieRpc(rpc, "update/status", {}, signal), callMagpieRpc(rpc, "update/notes", {}, signal)]);
36502
+ const status = await callMagpieRpc(rpc, "update/status", {}, signal);
35575
36503
  if (signal.aborted) return;
35576
36504
  setUpdateStatus(status);
35577
- setUpdateNotes(notes);
36505
+ if (check && ![
36506
+ "checking",
36507
+ "downloading",
36508
+ "ready"
36509
+ ].includes(status.state)) {
36510
+ const checked = await callMagpieRpc(rpc, "update/check", {}, signal);
36511
+ if (signal.aborted) return;
36512
+ setUpdateStatus(checked);
36513
+ }
35578
36514
  } catch (error) {
35579
36515
  if (signal.aborted) return;
35580
36516
  setUpdateError(magpieUpdateIssueForRpcError(error));
35581
36517
  } finally {
35582
36518
  if (!signal.aborted) setUpdateLoading(false);
35583
36519
  }
36520
+ if (signal.aborted) return;
36521
+ const notes = await callMagpieRpc(rpc, "update/notes", {}, signal).catch(() => null);
36522
+ if (!signal.aborted && notes !== null) setUpdateNotes(notes);
35584
36523
  }, [rpc]);
35585
36524
  (0, react.useEffect)(() => {
35586
36525
  const controller = new AbortController();
35587
- loadUpdates(controller.signal);
36526
+ loadUpdates(controller.signal, true);
35588
36527
  return () => controller.abort();
35589
36528
  }, [loadUpdates, refreshKey]);
36529
+ const updateState = updateStatus?.state;
36530
+ (0, react.useEffect)(() => {
36531
+ if (updateLoading || updateState !== "checking" && updateState !== "downloading") return;
36532
+ const controller = new AbortController();
36533
+ let timer;
36534
+ const poll = async () => {
36535
+ try {
36536
+ const status = await callMagpieRpc(rpc, "update/status", {}, controller.signal);
36537
+ if (controller.signal.aborted) return;
36538
+ setUpdateStatus(status);
36539
+ setUpdateError(null);
36540
+ if (status.state !== "checking" && status.state !== "downloading") return;
36541
+ } catch (error) {
36542
+ if (controller.signal.aborted) return;
36543
+ setUpdateError(magpieUpdateIssueForRpcError(error));
36544
+ }
36545
+ timer = setTimeout(() => {
36546
+ poll();
36547
+ }, 1e3);
36548
+ };
36549
+ timer = setTimeout(() => {
36550
+ poll();
36551
+ }, 1e3);
36552
+ return () => {
36553
+ controller.abort();
36554
+ clearTimeout(timer);
36555
+ };
36556
+ }, [
36557
+ rpc,
36558
+ updateLoading,
36559
+ updateState
36560
+ ]);
35590
36561
  const checkForUpdate = (0, react.useCallback)(async () => {
35591
- setUpdateLoading(true);
35592
- setUpdateError(null);
35593
36562
  setUpdateNotice("");
35594
- try {
35595
- const [status, notes] = await Promise.all([callMagpieRpc(rpc, "update/check", {}, void 0), callMagpieRpc(rpc, "update/notes", {}, void 0)]);
35596
- setUpdateStatus(status);
35597
- setUpdateNotes(notes);
35598
- } catch (error) {
35599
- setUpdateError(magpieUpdateIssueForRpcError(error));
35600
- } finally {
35601
- setUpdateLoading(false);
35602
- }
35603
- }, [rpc]);
36563
+ await loadUpdates(new AbortController().signal, true);
36564
+ }, [loadUpdates]);
35604
36565
  const installUpdate = (0, react.useCallback)(async () => {
35605
36566
  setUpdateLoading(true);
35606
36567
  setUpdateError(null);
@@ -35708,6 +36669,11 @@ window.__ModuleLoader__.load({
35708
36669
  const usageReports = pageTab === "usage";
35709
36670
  /** Provider and routing-group settings are not period-scoped, so the period filter is hidden there. */
35710
36671
  const periodScoped = pageTab === "overview" || pageTab === "usage";
36672
+ const updateAvailable = updateStatus?.latest != null && updateStatus.latest !== updateStatus.current;
36673
+ const versionLabel = updateAvailable ? t("magpie.update.openAvailable", {
36674
+ version: updateStatus.current,
36675
+ latest: updateStatus.latest
36676
+ }) : t("magpie.update.open", { version: updateStatus?.current ?? "—" });
35711
36677
  return (0, react.createElement)("div", {
35712
36678
  className: "codingns-magpie-page",
35713
36679
  role: "region",
@@ -35741,13 +36707,16 @@ window.__ModuleLoader__.load({
35741
36707
  "aria-hidden": true
35742
36708
  }, entry.icon), (0, react.createElement)("span", { className: "codingns-magpie-tab-label" }, t(entry.label))))), (0, react.createElement)("div", { className: "codingns-magpie-topbar-right" }, (0, react.createElement)("button", {
35743
36709
  type: "button",
35744
- className: "codingns-magpie-version-button",
36710
+ className: `codingns-magpie-version-button${updateAvailable ? " has-update" : ""}`,
35745
36711
  "aria-haspopup": "dialog",
35746
36712
  "aria-expanded": updateOpen,
35747
36713
  onClick: () => setUpdateOpen((value) => !value),
35748
- "aria-label": t("magpie.update.open", { version: updateStatus?.current ?? "—" }),
35749
- title: t("magpie.update.open", { version: updateStatus?.current ?? "—" })
35750
- }, updateStatus?.current ?? "—"), (0, react.createElement)("button", {
36714
+ "aria-label": versionLabel,
36715
+ title: versionLabel
36716
+ }, updateStatus?.current ?? "—", updateAvailable && (0, react.createElement)("span", {
36717
+ className: "codingns-magpie-update-badge",
36718
+ "aria-hidden": true
36719
+ }, t("magpie.update.badge"))), (0, react.createElement)("button", {
35751
36720
  type: "button",
35752
36721
  className: "codingns-magpie-icon-button",
35753
36722
  disabled: dashboardLoading || managementLoading || managementWriting,
@@ -36111,7 +37080,7 @@ window.__ModuleLoader__.load({
36111
37080
  }
36112
37081
  function RequestsPage({ page, loading, error, selectedSession, offset, onOffsetChange, onClearSession, t, append = false }) {
36113
37082
  const items = page?.items ?? [];
36114
- const aggregate = sumRequests(items);
37083
+ const aggregate = page?.aggregate === void 0 ? sumRequests(items) : requestMetricsToCardAggregate(page.aggregate);
36115
37084
  const stats = [
36116
37085
  {
36117
37086
  label: t("magpie.statTokens"),
@@ -36120,7 +37089,7 @@ window.__ModuleLoader__.load({
36120
37089
  },
36121
37090
  {
36122
37091
  label: t("magpie.statCalls"),
36123
- value: formatInteger$1(page?.total ?? aggregate.calls),
37092
+ value: formatInteger$1(page?.aggregate?.calls ?? page?.total ?? aggregate.calls),
36124
37093
  detail: `${formatInteger$1(aggregate.errors)} ${t("magpie.metricErrors")} · ${formatInteger$1(aggregate.retried)} ${t("magpie.metricRetries")}`
36125
37094
  },
36126
37095
  ...selectedSession === null ? [] : [{
@@ -36151,7 +37120,7 @@ window.__ModuleLoader__.load({
36151
37120
  size: 20,
36152
37121
  className: "codingns-magpie-provider-logo codingns-magpie-provider-logo-compact",
36153
37122
  fallback: "none"
36154
- }), selectedSession.dshSessionName ?? t("magpie.requestFor", {
37123
+ }), selectedSession.dshSessionName ?? page?.sessionName ?? t("magpie.requestFor", {
36155
37124
  agent: selectedSession.agent,
36156
37125
  id: selectedSession.id
36157
37126
  })), onClearSession !== null && (0, react.createElement)("button", {
@@ -36227,6 +37196,32 @@ window.__ModuleLoader__.load({
36227
37196
  decodeCount: speedCount === 0 ? null : speedCount
36228
37197
  };
36229
37198
  }
37199
+ function requestMetricsToCardAggregate(metrics) {
37200
+ if (metrics === null) return {
37201
+ calls: null,
37202
+ errors: null,
37203
+ retried: null,
37204
+ inputTokens: null,
37205
+ outputTokens: null,
37206
+ cost: null,
37207
+ unpriced: null,
37208
+ ttftMs: null,
37209
+ decodeTokens: null,
37210
+ decodeCount: null
37211
+ };
37212
+ return {
37213
+ calls: metrics.calls,
37214
+ errors: metrics.errors,
37215
+ retried: metrics.retried,
37216
+ inputTokens: metrics.inputTokens,
37217
+ outputTokens: metrics.outputTokens,
37218
+ cost: metrics.cost,
37219
+ unpriced: metrics.unpriced,
37220
+ ttftMs: metrics.ttftMs,
37221
+ decodeTokens: metrics.decodeTokens === null || metrics.decodeMs === null || metrics.decodeMs <= 0 ? null : metrics.decodeTokens / (metrics.decodeMs / 1e3),
37222
+ decodeCount: metrics.decodeCount
37223
+ };
37224
+ }
36230
37225
  function NativeRequestRow({ request, t }) {
36231
37226
  const speed = request.durationMs !== null && request.outputTokens !== null && request.durationMs > 0 ? `${formatValue(request.outputTokens / (request.durationMs / 1e3))} token/s` : "—";
36232
37227
  return (0, react.createElement)("tr", void 0, (0, react.createElement)("td", { className: "codingns-magpie-time-cell" }, formatTimestamp(request.time)), (0, react.createElement)("td", void 0, (0, react.createElement)("span", { className: "codingns-magpie-provider-inline" }, (0, react.createElement)(MagpieProviderLogo, {
@@ -36719,6 +37714,7 @@ window.__ModuleLoader__.load({
36719
37714
  .codingns-magpie-topbar-left{display:flex;align-items:center;justify-self:start;min-width:0;max-width:100%}
36720
37715
  .codingns-magpie-topbar-right{display:flex;align-items:center;justify-self:end;gap:8px;min-width:0}
36721
37716
  .codingns-magpie-version-button{display:inline-flex;align-items:center;min-height:30px;padding:0 9px;border:.5px solid var(--mp-line-strong);border-radius:999px;background:var(--mp-card);color:var(--mp-muted);font:inherit;font-size:${require_theme.uiFontSize(12)};font-variant-numeric:tabular-nums;cursor:pointer;transition:background .15s,color .15s,border-color .15s}.codingns-magpie-version-button:hover,.codingns-magpie-version-button[aria-expanded=true]{border-color:color-mix(in srgb,var(--mp-accent) 55%,var(--mp-line-strong));background:color-mix(in srgb,var(--mp-accent) 8%,var(--mp-card));color:var(--mp-ink)}.codingns-magpie-version-button:focus-visible{outline:2px solid color-mix(in srgb,var(--mp-accent) 55%,transparent);outline-offset:1px}
37717
+ .codingns-magpie-version-button.has-update{gap:6px;border-color:color-mix(in srgb,var(--mp-accent) 55%,var(--mp-line-strong));color:var(--mp-ink)}.codingns-magpie-update-badge{display:inline-flex;align-items:center;padding:1px 5px;border-radius:999px;background:var(--mp-accent);color:var(--dsw-alias-label-on-primary,#fff);font-size:${require_theme.uiFontSize(10)};font-weight:600;line-height:1.4}
36722
37718
  .codingns-magpie-icon-button{display:grid;place-items:center;flex:0 0 auto;width:30px;height:30px;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--mp-muted);cursor:pointer;transition:background .15s,color .15s}
36723
37719
  .codingns-magpie-icon-button:hover{background:var(--mp-hover);color:var(--mp-ink)}
36724
37720
  .codingns-magpie-icon-button:active{background:var(--mp-layer)}
@@ -37037,9 +38033,10 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
37037
38033
  * 使用的是哪个入口/版本、没检测到时该做什么。检测在 Host 执行,面板不直接
37038
38034
  * 访问文件系统,也不显示 Host 异常原文。
37039
38035
  */
37040
- function MagpieInstallPanel({ services, enabled }) {
38036
+ function MagpieInstallPanel({ services, enabled, requirement: cardRequirement }) {
37041
38037
  const t = require_transport.useCodingNsTranslator(services.locale);
37042
- const requirement = useMagpieInstallRequirement(services);
38038
+ const ownRequirement = useMagpieInstallRequirement(cardRequirement == null ? services : null);
38039
+ const requirement = cardRequirement ?? ownRequirement;
37043
38040
  const [showCustom, setShowCustom] = (0, react.useState)(false);
37044
38041
  const [customPath, setCustomPath] = (0, react.useState)("");
37045
38042
  const detection = requirement.detection;
@@ -39374,8 +40371,9 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39374
40371
  if (normalized === "") return Promise.resolve({ adapterId: "dsh" });
39375
40372
  const cache = cacheFor(rpc);
39376
40373
  const existing = cache.get(normalized);
39377
- if (existing instanceof Promise) return existing;
39378
- if (!options.force && existing !== void 0 && Date.now() - existing.loadedAt < SESSION_CONFIG_CACHE_TTL_MS) return Promise.resolve(existing.value);
40374
+ if (existing instanceof Promise) {
40375
+ if (!options.force) return existing;
40376
+ } else if (!options.force && existing !== void 0 && Date.now() - existing.loadedAt < SESSION_CONFIG_CACHE_TTL_MS) return Promise.resolve(existing.value);
39379
40377
  const request = require_magpie_model_tag.callCliRpc(rpc, "session/get", { sessionId: normalized }).then((value) => {
39380
40378
  if (cache.get(normalized) === request) cache.set(normalized, {
39381
40379
  value,
@@ -39512,6 +40510,8 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39512
40510
  const [resetPending, setResetPending] = (0, react.useState)(false);
39513
40511
  const [resetResult, setResetResult] = (0, react.useState)(null);
39514
40512
  const [resetError, setResetError] = (0, react.useState)(null);
40513
+ const sessionRef = (0, react.useRef)(void 0);
40514
+ const routeKeyRef = (0, react.useRef)(null);
39515
40515
  const modelSelectionRevision = props.useSession?.((value) => JSON.stringify([value.modelSelection, value.running]));
39516
40516
  const [adapterRevision, bumpAdapterRevision] = (0, react.useState)(0);
39517
40517
  const openRef = (0, react.useRef)(open);
@@ -39571,6 +40571,8 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39571
40571
  (0, react.useEffect)(() => {
39572
40572
  const sessionId = props.sessionId?.trim();
39573
40573
  if (!sessionId) {
40574
+ sessionRef.current = void 0;
40575
+ routeKeyRef.current = null;
39574
40576
  setEligible(false);
39575
40577
  setSnapshot(null);
39576
40578
  setAdapterId(null);
@@ -39585,18 +40587,23 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39585
40587
  }
39586
40588
  let active = true;
39587
40589
  let upstreamUnresolved = false;
39588
- setEligible(false);
39589
- setSnapshot(null);
39590
- setAdapterId(null);
39591
- setProviderId(null);
39592
- setOpen(false);
39593
- setResetOpen(false);
39594
- setResetPending(false);
39595
- setResetResult(null);
39596
- setResetError(null);
39597
- setMagpieTab("usage");
40590
+ if (sessionRef.current !== sessionId) {
40591
+ sessionRef.current = sessionId;
40592
+ routeKeyRef.current = null;
40593
+ setEligible(false);
40594
+ setSnapshot(null);
40595
+ setAdapterId(null);
40596
+ setProviderId(null);
40597
+ setOpen(false);
40598
+ setResetOpen(false);
40599
+ setResetPending(false);
40600
+ setResetResult(null);
40601
+ setResetError(null);
40602
+ setMagpieTab("usage");
40603
+ }
39598
40604
  const refresh = async (signal) => {
39599
40605
  let routeSignal;
40606
+ let routeChanged = false;
39600
40607
  setLoading(true);
39601
40608
  try {
39602
40609
  const selection = await loadCliSessionConfig(props.rpc, sessionId, { force: true });
@@ -39611,12 +40618,6 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39611
40618
  return;
39612
40619
  }
39613
40620
  if (signal.aborted) return false;
39614
- if (active) {
39615
- setEligible(true);
39616
- setAdapterId(adapterId);
39617
- setProviderId(selection.providerId ?? null);
39618
- }
39619
- const intervalMins = props.getRefreshIntervalMins?.() ?? require_native_workspace_store.DEFAULT_SUBSCRIPTION_USAGE_SETTINGS.refreshIntervalMins;
39620
40621
  const cacheKey = JSON.stringify([
39621
40622
  adapterId,
39622
40623
  selection.providerId ?? "",
@@ -39624,7 +40625,22 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39624
40625
  sessionId,
39625
40626
  selection.providerSessionId ?? ""
39626
40627
  ]);
39627
- const magpieSnapshot = snapshotRef.current?.magpie;
40628
+ routeChanged = routeKeyRef.current !== cacheKey;
40629
+ if (routeChanged) {
40630
+ routeKeyRef.current = cacheKey;
40631
+ if (active) {
40632
+ setSnapshot(null);
40633
+ setOpen(false);
40634
+ setMagpieTab("usage");
40635
+ }
40636
+ }
40637
+ if (active) {
40638
+ setEligible(true);
40639
+ setAdapterId(adapterId);
40640
+ setProviderId(selection.providerId ?? null);
40641
+ }
40642
+ const intervalMins = props.getRefreshIntervalMins?.() ?? require_native_workspace_store.DEFAULT_SUBSCRIPTION_USAGE_SETTINGS.refreshIntervalMins;
40643
+ const magpieSnapshot = routeChanged ? void 0 : snapshotRef.current?.magpie;
39628
40644
  const includeRoute = magpieSnapshot !== null && magpieSnapshot !== void 0 && (openRef.current || shouldResolveMagpieQuota(magpieSnapshot));
39629
40645
  const cached = subscriptionUsageCache.get(cacheKey);
39630
40646
  const canReuseCachedUsage = cached !== void 0 && cached.usage.providerUsage?.provider?.capability !== "new-api";
@@ -39651,8 +40667,10 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39651
40667
  } catch {
39652
40668
  if (signal.aborted || routeSignal?.aborted === true) return false;
39653
40669
  if (active) {
39654
- setEligible(false);
39655
- setSnapshot(null);
40670
+ if (routeChanged || snapshotRef.current === null) {
40671
+ setEligible(false);
40672
+ setSnapshot(null);
40673
+ }
39656
40674
  }
39657
40675
  return false;
39658
40676
  } finally {
@@ -39979,10 +40997,10 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
39979
40997
  })));
39980
40998
  }
39981
40999
  function MagpieUsagePanel({ usage, aggregateRows, sessionRows, t }) {
39982
- return (0, react.createElement)("div", void 0, (0, react.createElement)("section", { style: magpieUsageSectionStyle }, (0, react.createElement)("strong", { style: magpieSectionTitleStyle }, t("usage.magpieAggregateTitle")), usage.usageStatus === "available" ? createMagpieRows(aggregateRows) : (0, react.createElement)("div", { style: magpieMutedTextStyle }, t("usage.magpieUsageUnavailable"))), (0, react.createElement)("section", { style: magpieUsageSectionStyle }, (0, react.createElement)("strong", { style: magpieSectionTitleStyle }, t("usage.magpieSessionTitle")), usage.sessionId !== null && (0, react.createElement)("div", { style: magpieSessionIdentityStyle }, (0, react.createElement)("span", void 0, t("usage.magpieAgent", { agent: usage.agent })), usage.sessionName !== void 0 && (0, react.createElement)("strong", {
41000
+ return (0, react.createElement)("div", void 0, (0, react.createElement)("section", { style: magpieUsageSectionStyle }, (0, react.createElement)("strong", { style: magpieSectionTitleStyle }, t("usage.magpieAggregateTitle")), usage.usageStatus === "available" ? createMagpieRows(aggregateRows) : (0, react.createElement)("div", { style: magpieMutedTextStyle }, t("usage.magpieUsageUnavailable"))), (0, react.createElement)("section", { style: magpieUsageSectionStyle }, (0, react.createElement)("strong", { style: magpieSectionTitleStyle }, t(usage.sessionPeriod === "today" ? "usage.magpieSessionTodayTitle" : "usage.magpieSessionTitle")), usage.sessionId !== null && (0, react.createElement)("div", { style: magpieSessionIdentityStyle }, (0, react.createElement)("div", { style: magpieSessionNameRowStyle }, (0, react.createElement)("span", { style: { flex: "none" } }, t("usage.magpieAgent", { agent: usage.agent })), usage.sessionName !== void 0 && (0, react.createElement)("strong", {
39983
41001
  style: magpieSessionNameStyle,
39984
41002
  title: usage.sessionName
39985
- }, usage.sessionName), (0, react.createElement)("code", { style: magpieSessionIdStyle }, usage.sessionId)), usage.session === null ? (0, react.createElement)("div", { style: magpieMutedTextStyle }, usage.sessionId === null ? t("usage.magpieSessionIdUnavailable") : t("usage.magpieSessionNoUsage")) : createMagpieRows(sessionRows)));
41003
+ }, usage.sessionName)), (0, react.createElement)("code", { style: magpieSessionIdStyle }, usage.sessionId)), usage.session === null ? (0, react.createElement)("div", { style: magpieMutedTextStyle }, usage.sessionId === null ? t("usage.magpieSessionIdUnavailable") : t("usage.magpieSessionNoUsage")) : createMagpieRows(sessionRows)));
39986
41004
  }
39987
41005
  function magpieQuotaUnavailableMessage(usage, quotas, t) {
39988
41006
  return usage.quotaStatus === "unavailable" ? t("usage.magpieQuotaUnavailable") : usage.quotaStatus === "provider-unavailable" ? t("usage.magpieQuotaProviderUnavailable") : quotas.length === 0 ? t("usage.magpieQuotaNoData") : null;
@@ -40206,10 +41224,10 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
40206
41224
  function canReadMagpieSessionRequests(sessionId, agent) {
40207
41225
  return sessionId !== null && sessionId.trim() !== "" && sessionId.length <= 512 && /^[a-z0-9][a-z0-9-]*$/u.test(agent);
40208
41226
  }
40209
- /** 只读取今天的会话请求,与路由卡片和“当前 Agent 会话”用量保持同一时间口径。 */
41227
+ /** Include every date in the selected session's paginated request history. */
40210
41228
  async function readMagpieSessionRequestPage(rpc, sessionId, agent, offset, signal) {
40211
41229
  const result = await callCodingNsRpcResult(rpc, "magpie/usage/requests", {
40212
- period: "today",
41230
+ period: "all",
40213
41231
  offset,
40214
41232
  limit: 50,
40215
41233
  sessionId,
@@ -40226,6 +41244,7 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
40226
41244
  * 不再维护一套重复的请求卡片渲染。
40227
41245
  */
40228
41246
  function MagpieSessionRequestsDialog({ sessionId, sessionName, agent, page, offset, loading, error, t, onClose, dialogRef, onOffsetChange, onRetry }) {
41247
+ const displaySessionName = sessionName ?? page?.sessionName ?? null;
40229
41248
  const dialog = (0, react.createElement)("div", {
40230
41249
  className: "codingns4dsh-magpie-requests-overlay",
40231
41250
  ref: dialogRef,
@@ -40261,7 +41280,7 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
40261
41280
  selectedSession: {
40262
41281
  id: sessionId,
40263
41282
  agent,
40264
- ...sessionName === null ? {} : { dshSessionName: sessionName }
41283
+ ...displaySessionName === null ? {} : { dshSessionName: displaySessionName }
40265
41284
  },
40266
41285
  offset,
40267
41286
  onOffsetChange,
@@ -40831,6 +41850,7 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
40831
41850
  */
40832
41851
  function shouldResolveMagpieQuota(usage) {
40833
41852
  if (usage === null || usage === void 0) return false;
41853
+ if (usage.session === null) return true;
40834
41854
  if (usage.quotaStatus !== "available") return usage.upstreamProvider === null;
40835
41855
  return usage.sessionId !== null && usage.session !== null && (usage.quotas?.length ?? 0) === 0;
40836
41856
  }
@@ -41175,16 +42195,21 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
41175
42195
  overflowWrap: "anywhere"
41176
42196
  };
41177
42197
  const magpieSessionIdentityStyle = {
41178
- display: "flex",
41179
- flexWrap: "wrap",
41180
- alignItems: "baseline",
41181
- gap: "2px 10px",
42198
+ display: "grid",
42199
+ gap: 2,
41182
42200
  minWidth: 0,
41183
42201
  color: require_theme.dshThemeColor.labelSecondary,
41184
42202
  fontSize: require_theme.uiFontSize(12),
41185
42203
  lineHeight: "16px"
41186
42204
  };
42205
+ const magpieSessionNameRowStyle = {
42206
+ display: "flex",
42207
+ alignItems: "baseline",
42208
+ gap: 10,
42209
+ minWidth: 0
42210
+ };
41187
42211
  const magpieSessionNameStyle = {
42212
+ minWidth: 0,
41188
42213
  maxWidth: "100%",
41189
42214
  overflow: "hidden",
41190
42215
  color: require_theme.dshThemeColor.labelPrimary,
@@ -41194,7 +42219,6 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
41194
42219
  whiteSpace: "nowrap"
41195
42220
  };
41196
42221
  const magpieSessionIdStyle = {
41197
- flex: "1 1 120px",
41198
42222
  minWidth: 0,
41199
42223
  color: require_theme.dshThemeColor.labelTertiary,
41200
42224
  fontSize: require_theme.uiFontSize(10),
@@ -43053,7 +44077,7 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
43053
44077
  existing?.remove();
43054
44078
  continue;
43055
44079
  }
43056
- if (existing?.dataset.modelId === model.id) {
44080
+ if (existing?.dataset.modelId === model.id && existing.dataset.providerId === model.magpieProviderId) {
43057
44081
  if (row.children[row.children.length - 1] !== existing) {
43058
44082
  existing.remove();
43059
44083
  row.append(existing);
@@ -43061,7 +44085,7 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
43061
44085
  continue;
43062
44086
  }
43063
44087
  existing?.remove();
43064
- const tag = require_magpie_model_tag.createMagpieModelTagNode(document, model.id);
44088
+ const tag = require_magpie_model_tag.createMagpieModelTagNode(document, model.id, model.magpieProviderId);
43065
44089
  row.append(tag);
43066
44090
  }
43067
44091
  }
@@ -43711,10 +44735,11 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
43711
44735
  const nativeAvailable = nativeDefault !== void 0;
43712
44736
  const [nativeMenu, setNativeMenu] = (0, react.useState)(null);
43713
44737
  const catalog = catalogState?.adapterId === selection.adapterId && catalogState.sessionId === sessionId ? catalogState.value : null;
43714
- const nativeModels = selection.adapterId === "dsh" ? (catalog?.groups ?? []).flatMap((group) => group.models.map(({ id, name, source }) => ({
44738
+ const nativeModels = selection.adapterId === "dsh" ? (catalog?.groups ?? []).flatMap((group) => group.models.map(({ id, name, source, magpieProviderId }) => ({
43715
44739
  id,
43716
44740
  name,
43717
- ...source === "magpie" ? { source } : {}
44741
+ ...source === "magpie" ? { source } : {},
44742
+ ...magpieProviderId === void 0 ? {} : { magpieProviderId }
43718
44743
  }))) : [];
43719
44744
  nativeMagpieModelsRef.current = nativeModels;
43720
44745
  const nativeMagpieModelRevision = JSON.stringify(nativeModels);
@@ -44088,7 +45113,7 @@ html[data-codingns-mobile-sidebar="on"] .codingns-magpie-page{padding-left:0;--m
44088
45113
  overflow: "hidden",
44089
45114
  textOverflow: "ellipsis",
44090
45115
  whiteSpace: "nowrap"
44091
- } }, item.name), item.id === model?.id && (0, react.createElement)("span", { "aria-hidden": true }, "✓"), item.source === "magpie" && (0, react.createElement)(require_magpie_model_tag.MagpieModelTag, {}));
45116
+ } }, item.name), item.id === model?.id && (0, react.createElement)("span", { "aria-hidden": true }, "✓"), item.source === "magpie" && (0, react.createElement)(require_magpie_model_tag.MagpieModelTag, { providerId: item.magpieProviderId }));
44092
45117
  }))), visibleModelGroups.length === 0 && (0, react.createElement)("div", {
44093
45118
  key: "model-empty",
44094
45119
  role: "status",
@@ -48561,7 +49586,7 @@ ${SCOPE} article>div:last-child>button { float:none!important; order:1; min-heig
48561
49586
  }
48562
49587
  //#endregion
48563
49588
  //#region src/client/git-panel-styles.ts
48564
- const STYLE_ID$2 = "codingns4dsh-git-panel";
49589
+ const STYLE_ID$3 = "codingns4dsh-git-panel";
48565
49590
  /**
48566
49591
  * Git 面板的交互态类名。
48567
49592
  *
@@ -48594,15 +49619,15 @@ ${SCOPE} article>div:last-child>button { float:none!important; order:1; min-heig
48594
49619
  /** 安装 Git 面板的交互态样式,重复调用只保留一份。非浏览器环境(单元测试)直接跳过。 */
48595
49620
  function installGitPanelStyles() {
48596
49621
  if (typeof document === "undefined") return () => void 0;
48597
- if (document.querySelector(`style[data-plugin-css="${STYLE_ID$2}"]`) !== null) return () => void 0;
49622
+ if (document.querySelector(`style[data-plugin-css="${STYLE_ID$3}"]`) !== null) return () => void 0;
48598
49623
  const style = document.createElement("style");
48599
49624
  style.dataset.plugin = "codingns4dsh";
48600
- style.dataset.pluginCss = STYLE_ID$2;
49625
+ style.dataset.pluginCss = STYLE_ID$3;
48601
49626
  style.textContent = gitPanelCss;
48602
49627
  document.head.appendChild(style);
48603
49628
  return () => style.remove();
48604
49629
  }
48605
- const focusRing = "outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));outline-offset:2px";
49630
+ const focusRing$1 = "outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));outline-offset:2px";
48606
49631
  const focusRingInset = "outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));outline-offset:-2px";
48607
49632
  const hover = "background:var(--dsw-alias-interactive-bg-hover)";
48608
49633
  const active = "background:var(--dsw-alias-interactive-bg-active)";
@@ -48622,14 +49647,14 @@ ${SCOPE} article>div:last-child>button { float:none!important; order:1; min-heig
48622
49647
  .${gitPanelClass.action}{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;padding:0;border:0;border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-secondary);background:transparent;cursor:pointer;font-size:16px;line-height:1}
48623
49648
  .${gitPanelClass.action}:hover:not(:disabled){${hover};color:var(--dsw-alias-label-primary)}
48624
49649
  .${gitPanelClass.action}:active:not(:disabled){${active}}
48625
- .${gitPanelClass.action}:focus-visible{${focusRing}}
49650
+ .${gitPanelClass.action}:focus-visible{${focusRing$1}}
48626
49651
  .${gitPanelClass.action}:disabled{${disabled}}
48627
49652
  .${gitPanelClass.actionDanger}{color:var(--dsw-alias-state-error-primary)}
48628
49653
  .${gitPanelClass.actionDanger}:hover:not(:disabled){${hover};color:var(--dsw-alias-state-error-primary)}
48629
49654
  .${gitPanelClass.button}{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-primary);background:var(--dsw-specific-input-major);cursor:pointer}
48630
49655
  .${gitPanelClass.button}:hover:not(:disabled){${hover}}
48631
49656
  .${gitPanelClass.button}:active:not(:disabled){${active}}
48632
- .${gitPanelClass.button}:focus-visible{${focusRing}}
49657
+ .${gitPanelClass.button}:focus-visible{${focusRing$1}}
48633
49658
  .${gitPanelClass.button}:disabled{${disabled}}
48634
49659
  .${gitPanelClass.buttonPrimary}{border-color:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground);background:var(--dsw-alias-button-primary-fill);font-weight:600}
48635
49660
  .${gitPanelClass.buttonPrimary}:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}
@@ -48639,7 +49664,7 @@ ${SCOPE} article>div:last-child>button { float:none!important; order:1; min-heig
48639
49664
  .${gitPanelClass.menuTrigger}{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;padding:0;border:0;border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-secondary);background:transparent;cursor:pointer;font-size:16px;line-height:1}
48640
49665
  .${gitPanelClass.menuTrigger}:hover:not(:disabled){${hover};color:var(--dsw-alias-label-primary)}
48641
49666
  .${gitPanelClass.menuTrigger}:active:not(:disabled){${active}}
48642
- .${gitPanelClass.menuTrigger}:focus-visible{${focusRing}}
49667
+ .${gitPanelClass.menuTrigger}:focus-visible{${focusRing$1}}
48643
49668
  .${gitPanelClass.menuTrigger}:disabled{${disabled}}
48644
49669
  .${gitPanelClass.menu}{border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-3);box-shadow:var(--dsw-elevation-prominent)}
48645
49670
  .${gitPanelClass.menuItem}{display:block;width:100%;box-sizing:border-box;border:0;border-radius:var(--dsw-radius-xs);color:var(--dsw-alias-label-primary);background:transparent;text-align:left;cursor:pointer;font-size:13px;line-height:20px;white-space:nowrap}
@@ -48651,11 +49676,11 @@ ${SCOPE} article>div:last-child>button { float:none!important; order:1; min-heig
48651
49676
  .${gitPanelClass.progress}{display:inline-block;animation:codingns4dsh-git-spin 900ms linear infinite}
48652
49677
  .${gitPanelClass.field}{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-primary)}
48653
49678
  .${gitPanelClass.field}:hover:not(:disabled){border-color:var(--dsw-alias-border-l3)}
48654
- .${gitPanelClass.field}:focus-visible{${focusRing}}
49679
+ .${gitPanelClass.field}:focus-visible{${focusRing$1}}
48655
49680
  .${gitPanelClass.field}:disabled{${disabled}}
48656
49681
  .${gitPanelClass.select}{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-specific-input-major);color:var(--dsw-alias-label-secondary);cursor:pointer}
48657
49682
  .${gitPanelClass.select}:hover:not(:disabled){border-color:var(--dsw-alias-border-l3)}
48658
- .${gitPanelClass.select}:focus-visible{${focusRing}}
49683
+ .${gitPanelClass.select}:focus-visible{${focusRing$1}}
48659
49684
  .${gitPanelClass.select}:disabled{${disabled}}
48660
49685
  .${gitPanelClass.ref}{display:inline-flex;align-items:center;gap:4px;border-radius:999px;white-space:nowrap}
48661
49686
  .${gitPanelClass.segmented}{position:relative;display:inline-grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:2px;padding:4px;border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover)}
@@ -73022,7 +74047,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
73022
74047
  button: "var(--dsw-alias-button-elevated-fill, #44474e)",
73023
74048
  shadow: "var(--dsw-elevation-prominent, 0 12px 36px rgba(0, 0, 0, 0.42))"
73024
74049
  };
73025
- const button = {
74050
+ const button$1 = {
73026
74051
  ...require_theme.dshSettingsButtonStyle,
73027
74052
  minHeight: 36,
73028
74053
  touchAction: "manipulation",
@@ -73226,7 +74251,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
73226
74251
  overflowY: "auto"
73227
74252
  };
73228
74253
  const topRowButton = {
73229
- ...button,
74254
+ ...button$1,
73230
74255
  height: 28,
73231
74256
  minHeight: 28,
73232
74257
  padding: "2px 10px",
@@ -73355,7 +74380,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
73355
74380
  flex: "0 0 auto"
73356
74381
  };
73357
74382
  const notificationActionButton = {
73358
- ...button,
74383
+ ...button$1,
73359
74384
  width: 28,
73360
74385
  height: 28,
73361
74386
  minHeight: 28,
@@ -76520,6 +77545,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
76520
77545
  const detailsTitle = props.translationT(inputFailure ? "translation.inputFailedTitle" : "translation.detailsTitle");
76521
77546
  const pending = record === void 0 || output.pending;
76522
77547
  const failed = record?.failed === true;
77548
+ const failure = require_session_translation.readSessionTranslationDiagnostics(record).failure;
76523
77549
  const alreadyTargetLanguage = record?.alreadyTargetLanguage === true;
76524
77550
  const statusText = pending ? props.translationT("translation.statusTranslating") : failed ? props.translationT("translation.statusFailed") : alreadyTargetLanguage ? props.translationT("translation.statusNotNeeded") : props.translationT("translation.statusTranslated");
76525
77551
  const statusColor = pending ? require_theme.dshThemeColor.accent : failed ? require_theme.dshThemeColor.error : alreadyTargetLanguage ? require_theme.dshThemeColor.accent : require_theme.dshThemeColor.success;
@@ -76613,7 +77639,10 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
76613
77639
  `${props.translationT("translation.modelUsed")}: ${alreadyTargetLanguage ? props.translationT("translation.modelNotUsed") : formatModel(record.model, props.translationT)}`,
76614
77640
  ...record.durationMs === void 0 ? [] : [`${(record.durationMs / 1e3).toFixed(2)} s`],
76615
77641
  ...record.totalTokens === void 0 ? [] : [`${record.totalTokens} tok`]
76616
- ].join(" · ")), props.inputFailure === void 0 ? null : (0, react.createElement)("p", { role: "alert" }, props.translationT("translation.inputFailedHelp")), decisionError ? (0, react.createElement)("p", {
77642
+ ].join(" · ")), props.inputFailure === void 0 ? null : (0, react.createElement)("p", { role: "alert" }, props.translationT("translation.inputFailedHelp")), pending || !failed ? null : (0, react.createElement)("p", {
77643
+ role: "alert",
77644
+ style: { color: require_theme.dshThemeColor.error }
77645
+ }, props.translationT(`translation.failure.${failure?.code ?? "unknown"}`)), decisionError ? (0, react.createElement)("p", {
76617
77646
  role: "alert",
76618
77647
  style: { color: require_theme.dshThemeColor.error }
76619
77648
  }, props.translationT("translation.decisionFailed")) : null, props.inputFailure !== void 0 ? (0, react.createElement)("div", { style: {
@@ -77458,6 +78487,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
77458
78487
  ...candidate.alreadyTargetLanguage === true ? { alreadyTargetLanguage: true } : {},
77459
78488
  ...model === void 0 ? {} : { model },
77460
78489
  ...candidate.failed === true ? { failed: true } : {},
78490
+ ...require_session_translation.readSessionTranslationDiagnostics(candidate),
77461
78491
  ...require_session_translation.readSessionTranslationMetrics(candidate)
77462
78492
  };
77463
78493
  }
@@ -77484,6 +78514,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
77484
78514
  ...candidate.alreadyTargetLanguage === true ? { alreadyTargetLanguage: true } : {},
77485
78515
  ...model === void 0 ? {} : { model },
77486
78516
  ...candidate.failed === true ? { failed: true } : {},
78517
+ ...require_session_translation.readSessionTranslationDiagnostics(candidate),
77487
78518
  ...require_session_translation.readSessionTranslationMetrics(candidate)
77488
78519
  };
77489
78520
  }
@@ -77497,6 +78528,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
77497
78528
  ...record.alreadyTargetLanguage === true ? { alreadyTargetLanguage: true } : {},
77498
78529
  ...record.model === void 0 ? {} : { model: record.model },
77499
78530
  ...record.failed === true ? { failed: true } : {},
78531
+ ...require_session_translation.readSessionTranslationDiagnostics(record),
77500
78532
  ...require_session_translation.readSessionTranslationMetrics(record)
77501
78533
  };
77502
78534
  }
@@ -78073,6 +79105,23 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78073
79105
  return value === "en" || value === "fr" || value === "de" || value === "ja" ? value : "zh";
78074
79106
  }
78075
79107
  //#endregion
79108
+ //#region src/client/features/plugin-update.ts
79109
+ const pluginUpdateFeature = {
79110
+ descriptor: {
79111
+ name: "pluginUpdate",
79112
+ version: "1.0.0",
79113
+ enabledByDefault: true,
79114
+ dependencies: [],
79115
+ runtime: "client",
79116
+ requires: [{
79117
+ capability: "plugin.client.reload-status",
79118
+ required: false,
79119
+ fallback: "degrade"
79120
+ }]
79121
+ },
79122
+ start: () => void 0
79123
+ };
79124
+ //#endregion
78076
79125
  //#region src/features/host-router.ts
78077
79126
  /** 统一管理当前 Host/PeerHost 的完整作用域和 generation。 */
78078
79127
  var HostRouter = class {
@@ -78290,6 +79339,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78290
79339
  //#region src/client/features/index.ts
78291
79340
  /** Client 侧功能模块清单:新增模块在这里登记一行,不需要改动设置页和入口。 */
78292
79341
  const CLIENT_FEATURES = [
79342
+ pluginUpdateFeature,
78293
79343
  lanAccessFeature,
78294
79344
  loginProtectionFeature,
78295
79345
  reverseProxyFeature,
@@ -78336,15 +79386,20 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78336
79386
  * DSH 真实存在的令牌(对照 `@deepseek-ai/dsh-client-ui-theme` 的 403 个
78337
79387
  * `--dsw-*`),保证明暗主题下都能跟随宿主。
78338
79388
  */
78339
- const STYLE_ID$1 = "codingns4dsh-settings-promo";
79389
+ const STYLE_ID$2 = "codingns4dsh-settings-promo";
78340
79390
  /** 推广条的元素类名;结构由组件决定,视觉由本模块的样式表决定。 */
78341
79391
  const settingsPromoClass = {
78342
79392
  root: "codingns4dsh-settings-promo",
79393
+ row: "codingns4dsh-settings-promo-row",
78343
79394
  brand: "codingns4dsh-settings-promo-brand",
78344
79395
  headline: "codingns4dsh-settings-promo-headline",
78345
79396
  logo: "codingns4dsh-settings-promo-logo",
78346
79397
  title: "codingns4dsh-settings-promo-title",
78347
79398
  version: "codingns4dsh-settings-promo-version",
79399
+ versionControl: "codingns4dsh-settings-promo-version-control",
79400
+ badgeSlot: "codingns4dsh-settings-promo-badge-slot",
79401
+ badge: "codingns4dsh-settings-promo-update-badge",
79402
+ details: "codingns4dsh-settings-promo-update-details",
78348
79403
  text: "codingns4dsh-settings-promo-text",
78349
79404
  hand: "codingns4dsh-settings-promo-hand",
78350
79405
  action: "codingns4dsh-settings-promo-action"
@@ -78357,28 +79412,37 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78357
79412
  */
78358
79413
  function installSettingsPromoStyles() {
78359
79414
  if (typeof document === "undefined") return () => void 0;
78360
- if (document.querySelector(`style[data-plugin-css="${STYLE_ID$1}"]`) !== null) return () => void 0;
79415
+ if (document.querySelector(`style[data-plugin-css="${STYLE_ID$2}"]`) !== null) return () => void 0;
78361
79416
  const style = document.createElement("style");
78362
79417
  style.dataset.plugin = "codingns4dsh";
78363
- style.dataset.pluginCss = STYLE_ID$1;
79418
+ style.dataset.pluginCss = STYLE_ID$2;
78364
79419
  style.textContent = settingsPromoCss;
78365
79420
  document.head.appendChild(style);
78366
79421
  return () => style.remove();
78367
79422
  }
79423
+ const focusRing = "outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px";
78368
79424
  const settingsPromoCss = `
78369
- .${settingsPromoClass.root}{box-sizing:border-box;display:flex;align-items:center;gap:12px;width:100%;padding:10px 14px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);box-shadow:var(--dsw-elevation-soft)}
79425
+ .${settingsPromoClass.root}{box-sizing:border-box;display:flex;flex-direction:column;align-items:stretch;gap:12px;width:100%;padding:10px 14px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);box-shadow:var(--dsw-elevation-soft)}
79426
+ .${settingsPromoClass.row}{display:flex;flex-wrap:nowrap;align-items:center;gap:12px;min-width:0;width:100%}
78370
79427
  .${settingsPromoClass.brand}{display:flex;flex-direction:column;gap:6px;flex:0 0 auto;min-width:0}
78371
79428
  .${settingsPromoClass.headline}{display:flex;align-items:center;gap:8px;min-width:0}
78372
79429
  .${settingsPromoClass.logo}{flex:0 0 auto;color:var(--dsw-alias-button-info-fill)}
78373
79430
  .${settingsPromoClass.title}{margin:0;color:var(--dsw-alias-label-primary);font-size:16px;line-height:1.25;font-weight:650;white-space:nowrap}
78374
79431
  .${settingsPromoClass.version}{align-self:flex-start;box-sizing:border-box;padding:1px 8px;border:.5px solid var(--dsw-alias-border-l2);border-radius:999px;color:var(--dsw-alias-label-secondary);background:var(--dsw-specific-input-major);font-size:11px;line-height:16px;white-space:nowrap}
79432
+ .${settingsPromoClass.versionControl}{position:relative;display:inline-flex;align-items:center;align-self:flex-start;min-width:0}
79433
+ button.${settingsPromoClass.version}{appearance:none;flex:0 1 auto;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;font-family:inherit;cursor:pointer}
79434
+ button.${settingsPromoClass.version}:hover{color:var(--dsw-alias-button-info-fill);border-color:var(--dsw-alias-button-info-fill)}
79435
+ button.${settingsPromoClass.version}:focus-visible{${focusRing}}
79436
+ .${settingsPromoClass.badgeSlot}{position:absolute;left:calc(100% + 4px);top:50%;display:inline-flex;align-items:center;width:42px;height:16px;transform:translateY(-50%);pointer-events:none}
79437
+ .${settingsPromoClass.badge}{box-sizing:border-box;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 4px;border-radius:999px;color:var(--dsw-alias-button-info-fill);background:color-mix(in srgb,var(--dsw-alias-button-info-fill) 12%,transparent);font-size:10px;line-height:14px;font-weight:600}
79438
+ .${settingsPromoClass.details}{align-self:stretch;box-sizing:border-box;width:100%;min-width:0;padding-top:12px;border-top:.5px solid var(--dsw-alias-border-l2)}
78375
79439
  .${settingsPromoClass.text}{flex:1 1 auto;min-width:0;margin:0;color:var(--dsw-alias-button-info-fill);font-size:12px;line-height:1.5;text-align:right}
78376
79440
  .${settingsPromoClass.hand}{margin-left:4px}
78377
79441
  .${settingsPromoClass.action}{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:0 0 auto;min-height:28px;padding:4px 12px;border:.5px solid var(--dsw-alias-button-info-fill);border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-button-info-fill);background:color-mix(in srgb,var(--dsw-alias-button-info-fill) 10%,transparent);font-size:12px;line-height:1.3;font-weight:600;text-decoration:none;cursor:pointer;transition:background 160ms ease,color 160ms ease,border-color 160ms ease}
78378
79442
  .${settingsPromoClass.action}:hover{background:var(--dsw-alias-button-info-hover);border-color:var(--dsw-alias-button-info-hover);color:var(--dsw-alias-label-primary-foreground)}
78379
79443
  .${settingsPromoClass.action}:active{background:var(--dsw-alias-button-info-fill);border-color:var(--dsw-alias-button-info-fill);color:var(--dsw-alias-label-primary-foreground)}
78380
- .${settingsPromoClass.action}:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
78381
- @media (max-width:640px){.${settingsPromoClass.root}{flex-direction:column;align-items:center;gap:10px;padding:12px}.${settingsPromoClass.brand}{align-items:center}.${settingsPromoClass.version}{align-self:center}}
79444
+ .${settingsPromoClass.action}:focus-visible{${focusRing}}
79445
+ @media (max-width:640px){.${settingsPromoClass.root}{gap:10px;padding:12px}.${settingsPromoClass.row}{flex-direction:column;align-items:center;gap:10px}.${settingsPromoClass.brand}{align-items:center}.${settingsPromoClass.version}{align-self:center}.${settingsPromoClass.versionControl}{align-self:center}.${settingsPromoClass.versionControl} button{flex-shrink:0}}
78382
79446
  @media (prefers-reduced-motion:reduce){.${settingsPromoClass.action}{transition:none}}
78383
79447
  `;
78384
79448
  //#endregion
@@ -78400,13 +79464,13 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78400
79464
  *
78401
79465
  * @param props.locale - DSH 语言服务;文案由 `codingns` 命名空间提供。
78402
79466
  */
78403
- function CodingNsSettingsPromo({ locale }) {
79467
+ function CodingNsSettingsPromo({ locale, versionControl, children }) {
78404
79468
  const t = require_transport.useCodingNsTranslator(locale);
78405
79469
  (0, react.useEffect)(() => installSettingsPromoStyles(), []);
78406
79470
  return (0, react.createElement)("aside", {
78407
79471
  className: settingsPromoClass.root,
78408
79472
  "aria-label": t("settings.promo.sectionLabel")
78409
- }, (0, react.createElement)("div", { className: settingsPromoClass.brand }, (0, react.createElement)("div", { className: settingsPromoClass.headline }, (0, react.createElement)(StarBurstIcon, { className: settingsPromoClass.logo }), (0, react.createElement)("h3", { className: settingsPromoClass.title }, t("common.brand"))), (0, react.createElement)("span", { className: settingsPromoClass.version }, t("settings.promo.version", { version: require_native_workspace_store.CODINGNS_VERSION }))), (0, react.createElement)("p", { className: settingsPromoClass.text }, t("settings.promo.starHint"), (0, react.createElement)("span", {
79473
+ }, (0, react.createElement)("div", { className: settingsPromoClass.row }, (0, react.createElement)("div", { className: settingsPromoClass.brand }, (0, react.createElement)("div", { className: settingsPromoClass.headline }, (0, react.createElement)(StarBurstIcon, { className: settingsPromoClass.logo }), (0, react.createElement)("h3", { className: settingsPromoClass.title }, t("common.brand"))), versionControl ?? (0, react.createElement)("span", { className: settingsPromoClass.version }, t("settings.promo.version", { version: "0.2.1-rc.6" }))), (0, react.createElement)("p", { className: settingsPromoClass.text }, t("settings.promo.starHint"), (0, react.createElement)("span", {
78410
79474
  className: settingsPromoClass.hand,
78411
79475
  "aria-hidden": true
78412
79476
  }, "👉")), (0, react.createElement)("a", {
@@ -78415,7 +79479,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78415
79479
  target: "_blank",
78416
79480
  rel: "noreferrer",
78417
79481
  "aria-label": t("settings.promo.actionLabel")
78418
- }, (0, react.createElement)(GitHubMarkIcon), (0, react.createElement)("span", void 0, t("settings.promo.github")), (0, react.createElement)("span", { "aria-hidden": true }, "⭐")));
79482
+ }, (0, react.createElement)(GitHubMarkIcon), (0, react.createElement)("span", void 0, t("settings.promo.github")), (0, react.createElement)("span", { "aria-hidden": true }, "⭐"))), children);
78419
79483
  }
78420
79484
  /**
78421
79485
  * 品牌标识:八芒星。
@@ -78454,13 +79518,524 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78454
79518
  }, (0, react.createElement)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.4 7.4 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z" }));
78455
79519
  }
78456
79520
  //#endregion
79521
+ //#region src/dsh-capabilities/client/plugin-reload-adapter.ts
79522
+ /** Supported DSH Desktop releases expose no authoritative Client replacement contract. */
79523
+ function pluginClientReloadStatus() {
79524
+ return {
79525
+ state: "unsupported",
79526
+ version: require_native_workspace_store.CODINGNS_VERSION,
79527
+ code: "UPDATE_CLIENT_RELOAD_UNSUPPORTED"
79528
+ };
79529
+ }
79530
+ //#endregion
79531
+ //#region src/client/update-store.ts
79532
+ const DEFAULT_PLUGIN_UPDATE_CHANNEL = "0.2.1-rc.6".includes("-") ? "next" : "latest";
79533
+ var PluginUpdateStore = class {
79534
+ rpc;
79535
+ snapshot = {
79536
+ checking: false,
79537
+ starting: false,
79538
+ current: false,
79539
+ check: null,
79540
+ operation: null,
79541
+ runtime: null,
79542
+ error: null
79543
+ };
79544
+ listeners = /* @__PURE__ */ new Set();
79545
+ lifetime = new AbortController();
79546
+ checkRequest;
79547
+ timer;
79548
+ generation = 0;
79549
+ operationGeneration = 0;
79550
+ recoveryGeneration = 0;
79551
+ runtimeGeneration = 0;
79552
+ pollPending;
79553
+ visible = true;
79554
+ constructor(rpc) {
79555
+ this.rpc = rpc;
79556
+ }
79557
+ getSnapshot = () => this.snapshot;
79558
+ subscribe = (listener) => {
79559
+ this.listeners.add(listener);
79560
+ return () => this.listeners.delete(listener);
79561
+ };
79562
+ async loadRuntime() {
79563
+ const generation = ++this.runtimeGeneration;
79564
+ try {
79565
+ const runtime = await this.call("runtime", {});
79566
+ if (generation === this.runtimeGeneration) this.publish({ runtime });
79567
+ } catch (error) {
79568
+ if (generation === this.runtimeGeneration) this.publish({ error: errorCode(error) });
79569
+ }
79570
+ }
79571
+ invalidate() {
79572
+ this.generation++;
79573
+ this.checkRequest?.controller.abort();
79574
+ this.checkRequest = void 0;
79575
+ this.publish({
79576
+ current: false,
79577
+ checking: false
79578
+ });
79579
+ }
79580
+ check(channel) {
79581
+ const key = JSON.stringify(channel);
79582
+ if (this.checkRequest?.key === key) return this.checkRequest.promise;
79583
+ this.invalidate();
79584
+ const generation = this.generation;
79585
+ const controller = new AbortController();
79586
+ this.publish({
79587
+ checking: true,
79588
+ error: null
79589
+ });
79590
+ const promise = this.call("check", {
79591
+ channel,
79592
+ clientVersion: require_native_workspace_store.CODINGNS_VERSION
79593
+ }, controller.signal).then((check) => {
79594
+ if (generation !== this.generation) return;
79595
+ this.runtimeGeneration++;
79596
+ this.publish({
79597
+ check,
79598
+ runtime: check,
79599
+ current: true
79600
+ });
79601
+ }).catch((error) => {
79602
+ if (generation === this.generation && !controller.signal.aborted) this.publish({ error: errorCode(error) });
79603
+ }).finally(() => {
79604
+ if (generation !== this.generation) return;
79605
+ this.checkRequest = void 0;
79606
+ this.publish({ checking: false });
79607
+ });
79608
+ this.checkRequest = {
79609
+ key,
79610
+ controller,
79611
+ promise
79612
+ };
79613
+ return promise;
79614
+ }
79615
+ async apply(reviewed) {
79616
+ if (this.snapshot.starting || this.snapshot.operation?.state === "applying") return;
79617
+ if (!this.snapshot.current || reviewed !== this.snapshot.check || !reviewed.canApply || reviewed.target === null) {
79618
+ this.publish({ error: "UPDATE_CHECK_REQUIRED" });
79619
+ return;
79620
+ }
79621
+ this.operationGeneration++;
79622
+ this.publish({
79623
+ starting: true,
79624
+ error: null
79625
+ });
79626
+ let recover = false;
79627
+ try {
79628
+ const operation = await this.call("apply", {
79629
+ version: reviewed.target.version,
79630
+ confirmation: true,
79631
+ checkedAt: reviewed.checkedAt
79632
+ });
79633
+ this.publish({
79634
+ operation,
79635
+ current: false
79636
+ });
79637
+ this.schedule();
79638
+ } catch (error) {
79639
+ this.publish({
79640
+ error: errorCode(error),
79641
+ current: false
79642
+ });
79643
+ recover = true;
79644
+ } finally {
79645
+ this.publish({ starting: false });
79646
+ }
79647
+ if (recover) await this.recover();
79648
+ }
79649
+ async recover() {
79650
+ if (this.snapshot.starting) return;
79651
+ const generation = this.operationGeneration;
79652
+ const recovery = ++this.recoveryGeneration;
79653
+ try {
79654
+ const operation = await this.call("status", {});
79655
+ if (generation !== this.operationGeneration || recovery !== this.recoveryGeneration) return;
79656
+ if (this.snapshot.operation?.state === "applying" && operation === null) this.publish({ error: "UPDATE_OPERATION_NOT_FOUND" });
79657
+ else if (operation !== null) this.acceptOperation(operation);
79658
+ this.schedule();
79659
+ } catch (error) {
79660
+ if (generation === this.operationGeneration && recovery === this.recoveryGeneration) this.publish({ error: errorCode(error) });
79661
+ }
79662
+ }
79663
+ async cancel() {
79664
+ const operation = this.snapshot.operation;
79665
+ if (!operation?.cancellationAvailable || operation.state !== "applying") return;
79666
+ this.publish({
79667
+ operation: {
79668
+ ...operation,
79669
+ phase: "cancelling",
79670
+ cancellationAvailable: false
79671
+ },
79672
+ error: null
79673
+ });
79674
+ try {
79675
+ const next = await this.call("cancel", { operationId: operation.operationId });
79676
+ if (this.snapshot.operation?.operationId === operation.operationId) this.acceptOperation(next);
79677
+ } catch (error) {
79678
+ if (this.snapshot.operation?.operationId === operation.operationId && this.snapshot.operation.state !== "completed") this.publish({ error: errorCode(error) });
79679
+ }
79680
+ this.schedule();
79681
+ }
79682
+ setVisible(visible) {
79683
+ this.visible = visible;
79684
+ if (this.timer !== void 0) clearTimeout(this.timer);
79685
+ this.timer = void 0;
79686
+ if (visible) this.schedule();
79687
+ }
79688
+ dispose() {
79689
+ this.lifetime.abort();
79690
+ this.invalidate();
79691
+ if (this.timer !== void 0) clearTimeout(this.timer);
79692
+ this.listeners.clear();
79693
+ }
79694
+ schedule() {
79695
+ if (this.lifetime.signal.aborted || !this.visible || this.snapshot.error !== null || this.timer !== void 0 || this.snapshot.operation?.state !== "applying") return;
79696
+ this.timer = setTimeout(() => {
79697
+ this.timer = void 0;
79698
+ this.poll();
79699
+ }, 1e3);
79700
+ }
79701
+ poll() {
79702
+ if (this.pollPending) return this.pollPending;
79703
+ const operation = this.snapshot.operation;
79704
+ if (operation?.state !== "applying") return Promise.resolve();
79705
+ this.pollPending = this.call("status", { operationId: operation.operationId }).then((next) => {
79706
+ if (this.snapshot.operation?.operationId === next.operationId) this.acceptOperation(next);
79707
+ }).catch((error) => {
79708
+ if (this.snapshot.operation?.operationId === operation.operationId && this.snapshot.operation.state !== "completed") this.publish({ error: errorCode(error) });
79709
+ }).finally(() => {
79710
+ this.pollPending = void 0;
79711
+ this.schedule();
79712
+ });
79713
+ return this.pollPending;
79714
+ }
79715
+ async call(action, payload, signal) {
79716
+ const combined = AbortSignal.any([
79717
+ this.lifetime.signal,
79718
+ AbortSignal.timeout(3e4),
79719
+ ...signal ? [signal] : []
79720
+ ]);
79721
+ combined.throwIfAborted();
79722
+ const response = await this.rpc.call(require_transport.CODINGNS_RPC_CHANNEL, `update/${action}`, payload, combined);
79723
+ combined.throwIfAborted();
79724
+ if (!response.ok) throw updateError(response.error.code);
79725
+ return response.value;
79726
+ }
79727
+ acceptOperation(operation) {
79728
+ const current = this.snapshot.operation;
79729
+ if (current?.operationId === operation.operationId) {
79730
+ if (operation.revision < current.revision || current.state === "completed" && operation.state !== "completed") return;
79731
+ if (operation.revision === current.revision) {
79732
+ if (this.snapshot.error !== null) this.publish({ error: null });
79733
+ return;
79734
+ }
79735
+ }
79736
+ this.publish({
79737
+ operation,
79738
+ error: null
79739
+ });
79740
+ if (operation.state === "completed" && (current?.operationId !== operation.operationId || current.state !== "completed")) this.loadRuntime();
79741
+ }
79742
+ publish(patch) {
79743
+ if (this.lifetime.signal.aborted) return;
79744
+ this.snapshot = {
79745
+ ...this.snapshot,
79746
+ ...patch
79747
+ };
79748
+ for (const listener of this.listeners) listener();
79749
+ }
79750
+ };
79751
+ function errorCode(error) {
79752
+ const code = error?.code;
79753
+ return typeof code === "string" && /^UPDATE_[A-Z_]{1,80}$/u.test(code) ? code : "UPDATE_REQUEST_FAILED";
79754
+ }
79755
+ //#endregion
79756
+ //#region src/client/update-panel-styles.ts
79757
+ const STYLE_ID$1 = "codingns4dsh-update-panel";
79758
+ const updatePanelClass = {
79759
+ root: "codingns4dsh-update-panel",
79760
+ section: "codingns4dsh-update-section",
79761
+ versions: "codingns4dsh-update-versions",
79762
+ version: "codingns4dsh-update-version",
79763
+ versionLabel: "codingns4dsh-update-version-label",
79764
+ versionValue: "codingns4dsh-update-version-value",
79765
+ note: "codingns4dsh-update-note",
79766
+ warning: "codingns4dsh-update-warning",
79767
+ controls: "codingns4dsh-update-controls",
79768
+ fieldLabel: "codingns4dsh-update-field-label",
79769
+ state: "codingns4dsh-update-state",
79770
+ stateGood: "codingns4dsh-update-state-good",
79771
+ stateBad: "codingns4dsh-update-state-bad",
79772
+ target: "codingns4dsh-update-target",
79773
+ targetHeader: "codingns4dsh-update-target-header",
79774
+ targetVersion: "codingns4dsh-update-target-version",
79775
+ metadata: "codingns4dsh-update-metadata",
79776
+ metadataItem: "codingns4dsh-update-metadata-item",
79777
+ metadataLabel: "codingns4dsh-update-metadata-label",
79778
+ metadataValue: "codingns4dsh-update-metadata-value",
79779
+ notes: "codingns4dsh-update-notes",
79780
+ notesBody: "codingns4dsh-update-notes-body",
79781
+ actions: "codingns4dsh-update-actions",
79782
+ confirm: "codingns4dsh-update-confirm",
79783
+ operation: "codingns4dsh-update-operation"
79784
+ };
79785
+ function installUpdatePanelStyles() {
79786
+ if (typeof document === "undefined") return () => void 0;
79787
+ if (document.querySelector(`style[data-plugin-css="${STYLE_ID$1}"]`) !== null) return () => void 0;
79788
+ const style = document.createElement("style");
79789
+ style.dataset.plugin = "codingns4dsh";
79790
+ style.dataset.pluginCss = STYLE_ID$1;
79791
+ style.textContent = `
79792
+ .${updatePanelClass.root}{display:flex;flex-direction:column;gap:14px;color:${require_theme.dshThemeColor.labelPrimary};font-size:13px;line-height:1.45;min-width:0}
79793
+ .${updatePanelClass.section}{display:flex;flex-direction:column;gap:9px;min-width:0}
79794
+ .${updatePanelClass.versions}{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
79795
+ .${updatePanelClass.version}{display:flex;flex-direction:column;gap:3px;min-width:0;padding:8px 10px;border:1px solid ${require_theme.dshThemeColor.border};border-radius:8px;background:${require_theme.dshThemeColor.surfaceSubtle}}
79796
+ .${updatePanelClass.versionLabel},.${updatePanelClass.metadataLabel}{color:${require_theme.dshThemeColor.labelSecondary};font-size:11px;line-height:1.3}
79797
+ .${updatePanelClass.versionValue}{font-size:13px;font-weight:650;overflow-wrap:anywhere;font-family:${require_theme.dshThemeColor.codeFont}}
79798
+ .${updatePanelClass.note}{margin:0;padding:9px 11px;border-left:3px solid ${require_theme.dshThemeColor.accent};border-radius:6px;background:${require_theme.dshThemeColor.surfaceSubtle};color:${require_theme.dshThemeColor.labelSecondary};font-size:12px}
79799
+ .${updatePanelClass.warning}{margin:0;padding:9px 11px;border-left:3px solid ${require_theme.dshThemeColor.warning};border-radius:6px;background:color-mix(in srgb,${require_theme.dshThemeColor.warning} 10%,transparent);font-size:12px}
79800
+ .${updatePanelClass.controls}{display:flex;flex-direction:column;gap:6px}
79801
+ .${updatePanelClass.fieldLabel}{color:${require_theme.dshThemeColor.labelSecondary};font-size:11px;font-weight:650}
79802
+ .${updatePanelClass.state}{margin:0;padding:8px 10px;border-radius:7px;background:${require_theme.dshThemeColor.surfaceSubtle};font-weight:650}
79803
+ .${updatePanelClass.stateGood}{color:${require_theme.dshThemeColor.success};border:1px solid color-mix(in srgb,${require_theme.dshThemeColor.success} 40%,transparent)}
79804
+ .${updatePanelClass.stateBad}{color:${require_theme.dshThemeColor.error};border:1px solid color-mix(in srgb,${require_theme.dshThemeColor.error} 40%,transparent)}
79805
+ .${updatePanelClass.target}{display:flex;flex-direction:column;gap:10px;padding:11px;border:1px solid ${require_theme.dshThemeColor.border};border-radius:9px;background:${require_theme.dshThemeColor.cardBackground};box-shadow:${require_theme.dshThemeColor.subtleShadow}}
79806
+ .${updatePanelClass.targetHeader}{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}
79807
+ .${updatePanelClass.targetVersion}{color:${require_theme.dshThemeColor.accent};font-size:16px;line-height:1.25;font-weight:750;font-family:${require_theme.dshThemeColor.codeFont};overflow-wrap:anywhere}
79808
+ .${updatePanelClass.metadata}{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}
79809
+ .${updatePanelClass.metadataItem}{display:flex;flex-direction:column;gap:2px;min-width:0}
79810
+ .${updatePanelClass.metadataValue}{font-size:12px;overflow-wrap:anywhere}
79811
+ .${updatePanelClass.notes}{display:flex;flex-direction:column;gap:6px;min-width:0}
79812
+ .${updatePanelClass.notesBody}{box-sizing:border-box;max-height:280px;margin:0;padding:10px 11px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;border:1px solid ${require_theme.dshThemeColor.border};border-radius:7px;background:${require_theme.dshThemeColor.inputBackground};font-family:${require_theme.dshThemeColor.codeFont};font-size:12px;line-height:1.55}
79813
+ .${updatePanelClass.actions}{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
79814
+ .${updatePanelClass.confirm}{padding:11px;border:1px solid color-mix(in srgb,${require_theme.dshThemeColor.warning} 50%,${require_theme.dshThemeColor.border});border-radius:9px;background:color-mix(in srgb,${require_theme.dshThemeColor.warning} 7%,transparent)}
79815
+ .${updatePanelClass.operation}{padding:11px;border:1px solid ${require_theme.dshThemeColor.border};border-radius:9px;background:${require_theme.dshThemeColor.surfaceSubtle}}
79816
+ @media(max-width:640px){.${updatePanelClass.versions}{grid-template-columns:1fr}.${updatePanelClass.metadata}{grid-template-columns:1fr}}
79817
+ @media(prefers-reduced-motion:reduce){.codingns4dsh-update-panel *{scroll-behavior:auto}}
79818
+ `;
79819
+ document.head.appendChild(style);
79820
+ return () => style.remove();
79821
+ }
79822
+ //#endregion
79823
+ //#region src/client/update-panel.ts
79824
+ const column = {
79825
+ display: "flex",
79826
+ flexDirection: "column",
79827
+ gap: 10,
79828
+ minWidth: 0,
79829
+ overflowWrap: "anywhere"
79830
+ };
79831
+ const button = {
79832
+ ...require_theme.dshButtonStyle,
79833
+ padding: "6px 12px",
79834
+ borderRadius: 6,
79835
+ cursor: "pointer",
79836
+ alignSelf: "flex-start"
79837
+ };
79838
+ const field = {
79839
+ ...require_theme.dshFieldStyle,
79840
+ padding: "6px 10px",
79841
+ borderRadius: 6,
79842
+ width: "100%",
79843
+ boxSizing: "border-box"
79844
+ };
79845
+ function PluginUpdatePanel({ services, enabled, store }) {
79846
+ const t = require_transport.useCodingNsTranslator(services.locale);
79847
+ const snapshot = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
79848
+ const localeTag = t("update.localeTag");
79849
+ (0, react.useEffect)(() => installUpdatePanelStyles(), []);
79850
+ const [channel, setChannel] = (0, react.useState)(DEFAULT_PLUGIN_UPDATE_CHANNEL);
79851
+ const [exactVersion, setExactVersion] = (0, react.useState)("");
79852
+ const [reviewed, setReviewed] = (0, react.useState)(null);
79853
+ const busy = snapshot.checking || snapshot.starting || snapshot.operation?.state === "applying";
79854
+ const check = snapshot.check;
79855
+ const blockCode = snapshot.runtime === null ? check?.applyBlockCode : snapshot.runtime.applyBlockCode;
79856
+ const target = check?.target;
79857
+ const operation = snapshot.operation;
79858
+ const result = operation?.result;
79859
+ const reset = () => {
79860
+ store.invalidate();
79861
+ setReviewed(null);
79862
+ };
79863
+ const formattedDate = (value) => {
79864
+ if (value === null) return t("update.unknown");
79865
+ const date = new Date(value);
79866
+ return Number.isNaN(date.valueOf()) ? t("update.unknown") : new Intl.DateTimeFormat(localeTag, {
79867
+ dateStyle: "medium",
79868
+ timeStyle: "short",
79869
+ timeZone: "UTC"
79870
+ }).format(date);
79871
+ };
79872
+ const versionCard = (key, value) => (0, react.createElement)("div", {
79873
+ key,
79874
+ className: updatePanelClass.version
79875
+ }, (0, react.createElement)("span", { className: updatePanelClass.versionLabel }, t(key)), (0, react.createElement)("strong", { className: updatePanelClass.versionValue }, value ?? t("update.unknown")));
79876
+ const metadata = (key, value, code = false) => (0, react.createElement)("div", {
79877
+ key,
79878
+ className: updatePanelClass.metadataItem
79879
+ }, (0, react.createElement)("span", { className: updatePanelClass.metadataLabel }, t(key)), (0, react.createElement)("span", {
79880
+ className: updatePanelClass.metadataValue,
79881
+ ...code ? { style: { fontFamily: require_theme.dshThemeColor.codeFont } } : {}
79882
+ }, value ?? t("update.unknown")));
79883
+ return (0, react.createElement)("div", { className: updatePanelClass.root }, (0, react.createElement)("div", { className: updatePanelClass.versions }, versionCard("update.hostVersion", snapshot.runtime?.runningHostVersion ?? check?.runningHostVersion), versionCard("update.clientVersion", require_native_workspace_store.CODINGNS_VERSION), versionCard("update.installedVersion", snapshot.runtime?.installedVersion)), (0, react.createElement)("p", { className: updatePanelClass.note }, t("update.activationHelp")), blockCode ? (0, react.createElement)("p", { className: updatePanelClass.warning }, t("update.nativeFallback"), " ", (0, react.createElement)("code", void 0, blockCode)) : null, (0, react.createElement)("div", { className: updatePanelClass.controls }, (0, react.createElement)("label", { className: updatePanelClass.fieldLabel }, t("update.channel")), (0, react.createElement)("select", {
79884
+ style: field,
79885
+ value: channel,
79886
+ disabled: !enabled || busy,
79887
+ onChange: (event) => {
79888
+ reset();
79889
+ setChannel(event.currentTarget.value);
79890
+ }
79891
+ }, (0, react.createElement)("option", { value: "latest" }, t("update.latest")), (0, react.createElement)("option", { value: "next" }, t("update.next")), (0, react.createElement)("option", { value: "exact" }, t("update.exact")))), channel === "exact" ? (0, react.createElement)("div", { className: updatePanelClass.controls }, (0, react.createElement)("label", { className: updatePanelClass.fieldLabel }, t("update.exactVersion")), (0, react.createElement)("input", {
79892
+ style: field,
79893
+ value: exactVersion,
79894
+ maxLength: 128,
79895
+ disabled: !enabled || busy,
79896
+ onChange: (event) => {
79897
+ reset();
79898
+ setExactVersion(event.currentTarget.value);
79899
+ }
79900
+ })) : null, (0, react.createElement)("div", { className: updatePanelClass.actions }, (0, react.createElement)("button", {
79901
+ type: "button",
79902
+ style: button,
79903
+ disabled: !enabled || busy || channel === "exact" && !isSemver(exactVersion),
79904
+ onClick: () => {
79905
+ setReviewed(null);
79906
+ store.check(channel === "exact" ? {
79907
+ kind: "exact",
79908
+ version: exactVersion
79909
+ } : { kind: channel });
79910
+ }
79911
+ }, t(snapshot.checking ? "update.checking" : "update.check"))), snapshot.error ? (0, react.createElement)("div", {
79912
+ role: "alert",
79913
+ className: updatePanelClass.warning
79914
+ }, t("update.requestError"), " ", snapshot.error) : null, check ? (0, react.createElement)("div", { style: column }, (0, react.createElement)("div", {
79915
+ role: "status",
79916
+ className: `${updatePanelClass.state} ${check.state === "update-available" ? updatePanelClass.stateGood : check.state === "incompatible" || check.state === "compatibility-unknown" ? updatePanelClass.stateBad : ""}`
79917
+ }, t(`update.checkState.${check.state}`)), !snapshot.current ? (0, react.createElement)("p", { className: updatePanelClass.note }, t("update.previousResult")) : null, target ? (0, react.createElement)("div", { className: updatePanelClass.target }, (0, react.createElement)("div", { className: updatePanelClass.targetHeader }, (0, react.createElement)("strong", { className: updatePanelClass.targetVersion }, `v${target.version}`), (0, react.createElement)("a", {
79918
+ href: target.release.url,
79919
+ target: "_blank",
79920
+ rel: "noreferrer",
79921
+ style: {
79922
+ ...button,
79923
+ color: require_theme.dshThemeColor.accent,
79924
+ textDecoration: "none"
79925
+ }
79926
+ }, t("update.openRelease"))), (0, react.createElement)("div", { className: updatePanelClass.metadata }, metadata("update.publishedAt", formattedDate(target.publishedAt)), metadata("update.releasePublishedAt", formattedDate(target.release.publishedAt)), metadata("update.commit", target.release.commit ?? target.gitHead, true), metadata("update.compatibility", `${t(`update.compatibilityState.${target.compatibility.state}`)}${target.compatibility.required ? ` · ${target.compatibility.required}` : ""}`)), (0, react.createElement)("div", { className: updatePanelClass.notes }, (0, react.createElement)("strong", void 0, target.release.title || target.release.tag), target.release.state === "available" ? (0, react.createElement)("pre", { className: updatePanelClass.notesBody }, target.release.body || t("update.noNotes")) : (0, react.createElement)("p", { className: updatePanelClass.note }, t("update.noNotes"), " ", target.release.reason ?? ""))) : null, (0, react.createElement)("div", { className: updatePanelClass.actions }, (0, react.createElement)("button", {
79927
+ type: "button",
79928
+ style: button,
79929
+ disabled: !enabled || busy || !snapshot.current || !check.canApply,
79930
+ onClick: () => setReviewed(check)
79931
+ }, t("update.review")))) : null, reviewed && reviewed === check && snapshot.current ? (0, react.createElement)("div", {
79932
+ role: "group",
79933
+ "aria-label": t("update.confirmTitle"),
79934
+ className: `${updatePanelClass.section} ${updatePanelClass.confirm}`
79935
+ }, (0, react.createElement)("strong", void 0, t("update.confirmTitle")), (0, react.createElement)("p", { style: { margin: 0 } }, t("update.confirmHelp", { version: reviewed.target.version })), (0, react.createElement)("div", { className: updatePanelClass.actions }, (0, react.createElement)("button", {
79936
+ type: "button",
79937
+ style: button,
79938
+ disabled: busy,
79939
+ onClick: () => {
79940
+ setReviewed(null);
79941
+ store.apply(reviewed);
79942
+ }
79943
+ }, t("update.confirm")), (0, react.createElement)("button", {
79944
+ type: "button",
79945
+ style: button,
79946
+ disabled: busy,
79947
+ onClick: () => setReviewed(null)
79948
+ }, t("update.back")))) : null, operation ? (0, react.createElement)("div", {
79949
+ role: "status",
79950
+ "aria-live": "polite",
79951
+ className: `${updatePanelClass.section} ${updatePanelClass.operation}`
79952
+ }, metadata("update.targetVersion", operation.targetVersion, true), (0, react.createElement)("div", void 0, t(`update.phase.${operation.phase}`)), operation.cancellationAvailable ? (0, react.createElement)("div", { className: updatePanelClass.actions }, (0, react.createElement)("button", {
79953
+ type: "button",
79954
+ style: button,
79955
+ onClick: () => {
79956
+ store.cancel();
79957
+ }
79958
+ }, t("update.cancel"))) : null, result ? (0, react.createElement)("div", { style: column }, (0, react.createElement)("strong", void 0, t(`update.application.${result.application}`)), metadata("update.packageState", t(`update.package.${result.packageState}`)), metadata("update.hostActivation", `${result.hostActivation.state} · ${result.hostActivation.version ?? t("update.unknown")}`), metadata("update.clientActivation", `${result.clientReload.state} · ${pluginClientReloadStatus().version}`), (0, react.createElement)("p", { style: { margin: 0 } }, t("update.nativeFallback")), result.errorCode ? (0, react.createElement)("div", void 0, result.errorCode) : null) : (0, react.createElement)("p", { style: { margin: 0 } }, t("update.operationHelp")), (0, react.createElement)("div", { className: updatePanelClass.actions }, (0, react.createElement)("button", {
79959
+ type: "button",
79960
+ style: button,
79961
+ onClick: () => {
79962
+ store.recover();
79963
+ }
79964
+ }, t("update.refreshStatus")))) : null);
79965
+ }
79966
+ //#endregion
79967
+ //#region src/client/settings-update.ts
79968
+ function hasNewerPluginVersion(snapshot) {
79969
+ const target = snapshot.check?.target;
79970
+ if (!target) return false;
79971
+ return [
79972
+ require_native_workspace_store.CODINGNS_VERSION,
79973
+ snapshot.runtime?.runningHostVersion,
79974
+ snapshot.runtime?.installedVersion
79975
+ ].filter((version) => typeof version === "string" && isSemver(version)).every((version) => compareSemver(target.version, version) > 0);
79976
+ }
79977
+ function CodingNsSettingsUpdate({ services }) {
79978
+ const t = require_transport.useCodingNsTranslator(services.locale);
79979
+ const store = (0, react.useMemo)(() => new PluginUpdateStore(services.rpc), [services.rpc]);
79980
+ const snapshot = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
79981
+ const [open, setOpen] = (0, react.useState)(false);
79982
+ const [hasOpened, setHasOpened] = (0, react.useState)(false);
79983
+ const detailsId = (0, react.useId)();
79984
+ (0, react.useEffect)(() => {
79985
+ store.loadRuntime();
79986
+ store.recover();
79987
+ let checked = false;
79988
+ const visibility = () => {
79989
+ const visible = typeof document === "undefined" || document.visibilityState !== "hidden";
79990
+ store.setVisible(visible);
79991
+ if (visible && !checked) {
79992
+ checked = true;
79993
+ store.check({ kind: DEFAULT_PLUGIN_UPDATE_CHANNEL });
79994
+ }
79995
+ };
79996
+ visibility();
79997
+ if (typeof document !== "undefined") document.addEventListener("visibilitychange", visibility);
79998
+ return () => {
79999
+ if (typeof document !== "undefined") document.removeEventListener("visibilitychange", visibility);
80000
+ store.dispose();
80001
+ };
80002
+ }, [store]);
80003
+ const versionControl = (0, react.createElement)("div", { className: settingsPromoClass.versionControl }, (0, react.createElement)("button", {
80004
+ type: "button",
80005
+ className: settingsPromoClass.version,
80006
+ "aria-expanded": open,
80007
+ "aria-controls": detailsId,
80008
+ title: t("update.toggleDetails"),
80009
+ onClick: () => {
80010
+ setOpen(!open);
80011
+ setHasOpened(true);
80012
+ }
80013
+ }, t("settings.promo.version", { version: require_native_workspace_store.CODINGNS_VERSION })), (0, react.createElement)("span", { className: settingsPromoClass.badgeSlot }, hasNewerPluginVersion(snapshot) ? (0, react.createElement)("span", {
80014
+ className: settingsPromoClass.badge,
80015
+ role: "status",
80016
+ title: t("update.newVersion", { version: snapshot.check.target.version }),
80017
+ "aria-label": t("update.newVersion", { version: snapshot.check.target.version })
80018
+ }, t("update.newVersionBadge")) : null));
80019
+ return (0, react.createElement)(CodingNsSettingsPromo, {
80020
+ locale: services.locale,
80021
+ versionControl
80022
+ }, (0, react.createElement)("div", {
80023
+ id: detailsId,
80024
+ hidden: !open,
80025
+ className: settingsPromoClass.details
80026
+ }, hasOpened ? (0, react.createElement)(PluginUpdatePanel, {
80027
+ services,
80028
+ enabled: true,
80029
+ store
80030
+ }) : null));
80031
+ }
80032
+ //#endregion
78457
80033
  //#region src/client/settings-section.ts
78458
80034
  /**
78459
80035
  * DSH 设置页中的 Codingns4DSH 区块。
78460
80036
  *
78461
- * 它只做一件事:遍历注册表中带界面描述的模块并渲染卡片。卡片内容来自模块
78462
- * 自己的 settingsPanel,所以新增模块不会在这里产生分支。页面最上方是
78463
- * GitHub Star 推广条({@link CodingNsSettingsPromo}),属于纯展示内容。
80037
+ * Module cards come from the registry. The header combines the existing brand
80038
+ * banner with a version disclosure for update details.
78464
80039
  */
78465
80040
  function CodingNsSettingsSection({ settings, registry, services, restartStates = {} }) {
78466
80041
  const store = (0, react.useMemo)(() => settingsSnapshotHandle(settings), [settings]);
@@ -78480,7 +80055,18 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78480
80055
  ...require_theme.dshSettingsToastStyle,
78481
80056
  borderColor: toast.kind === "error" ? require_theme.dshThemeColor.error : toast.kind === "success" ? require_theme.dshThemeColor.success : require_theme.dshThemeColor.border
78482
80057
  }
78483
- }, toast.message), (0, react.createElement)(CodingNsSettingsPromo, { locale: services.locale }), (0, react.createElement)("header", { style: require_theme.dshSettingsHeaderStyle }, (0, react.createElement)("p", { style: require_theme.dshSettingsSubtitleStyle }, t("settings.subtitle"))), (0, react.createElement)("div", { style: {
80058
+ }, toast.message), (0, react.createElement)(CodingNsSettingsUpdate, { services }), require_native_workspace_store.isDshVersionNewerThanTested(services.dshVersion) ? (0, react.createElement)("div", {
80059
+ role: "status",
80060
+ style: {
80061
+ padding: "10px 12px",
80062
+ border: `1px solid ${require_theme.dshThemeColor.warning}`,
80063
+ borderRadius: 6,
80064
+ background: require_theme.dshThemeColor.surfaceSubtle
80065
+ }
80066
+ }, t("settings.untestedDshWarning", {
80067
+ version: services.dshVersion,
80068
+ tested: require_native_workspace_store.DSH_TESTED_VERSION
80069
+ })) : null, (0, react.createElement)("header", { style: require_theme.dshSettingsHeaderStyle }, (0, react.createElement)("p", { style: require_theme.dshSettingsSubtitleStyle }, t("settings.subtitle"))), (0, react.createElement)("div", { style: {
78484
80070
  display: "flex",
78485
80071
  flexDirection: "column",
78486
80072
  gap: 12
@@ -78516,7 +80102,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78516
80102
  border: `1px solid ${require_theme.dshThemeColor.border}`,
78517
80103
  borderRadius: 6,
78518
80104
  background: require_theme.dshThemeColor.surfaceSubtle
78519
- } }, (0, react.createElement)("div", void 0, t("settings.compatibility", { range: require_native_workspace_store.DSH_COMPATIBILITY })), (0, react.createElement)("a", {
80105
+ } }, (0, react.createElement)("div", void 0, t("settings.compatibility", { range: require_native_workspace_store.DSH_COMPATIBILITY })), (0, react.createElement)("div", void 0, t("settings.testedDshVersion", { version: require_native_workspace_store.DSH_TESTED_VERSION })), (0, react.createElement)("a", {
78520
80106
  href: CODINGNS_GITHUB_URL,
78521
80107
  target: "_blank",
78522
80108
  rel: "noreferrer",
@@ -78547,7 +80133,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78547
80133
  const needsRequirement = ui.requirementKey !== void 0;
78548
80134
  const installedRequirement = useMagpieInstallRequirement(needsRequirement ? services : null);
78549
80135
  const requirement = needsRequirement ? installedRequirement : null;
78550
- const requirementBlocked = requirement !== null && requirement.state === "missing";
80136
+ const requirementBlocked = !enabled && requirement !== null && requirement.state !== "ready";
78551
80137
  const switchDisabled = temporarilyDisabled || ui.alwaysEnabled === true || !versionCompatible || snapshot.status === "loading" || !snapshot.writable || requirementBlocked;
78552
80138
  const toggle = (next) => {
78553
80139
  if (requirementBlocked) {
@@ -78651,7 +80237,8 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
78651
80237
  services,
78652
80238
  enabled,
78653
80239
  snapshot,
78654
- notify
80240
+ notify,
80241
+ requirement
78655
80242
  })));
78656
80243
  }
78657
80244
  /** 标题栏开关:真实 checkbox 语义,点击不会连带折叠卡片。 */
@@ -84361,7 +85948,7 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
84361
85948
  function isInjectedStage0Runtime(scope = globalThis) {
84362
85949
  return scope[CODINGNS_STAGE0_GLOBAL] === true;
84363
85950
  }
84364
- route("session.external-performance", "session-performance-projection-021", "host", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", ["dsh-capabilities/host/session-performance-adapter.ts", "host/cli-adapters/feature.ts"]), route("session.external-performance", "session-performance-presentation-021", "client", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", ["dsh-capabilities/client/session-performance-adapter.ts", "client/features/cli-adapters.ts"]), route("quick-app.proxy", "quick-app-host-proxy-021", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", [
85951
+ route("plugin.update.inspect", "plugin-manager-inspect-021", "host", ">=0.2.1-rc.2", "supported", ["dsh-capabilities/host/plugin-update-adapter.ts", "host/features/plugin-update.ts"]), route("plugin.update.apply", "plugin-manager-install-021", "host", ">=0.2.1-rc.2", "supported", ["dsh-capabilities/host/plugin-update-adapter.ts", "host/update/service.ts"]), route("plugin.host.activation-status", "plugin-host-version-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/update/service.ts"]), route("plugin.client.reload-status", "plugin-client-reload-unavailable-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/client/plugin-reload-adapter.ts", "client/update-panel.ts"]), route("session.external-performance", "session-performance-projection-021", "host", ">=0.2.1-alpha.3", "supported", ["dsh-capabilities/host/session-performance-adapter.ts", "host/cli-adapters/feature.ts"]), route("session.external-performance", "session-performance-presentation-021", "client", ">=0.2.1-alpha.3", "supported", ["dsh-capabilities/client/session-performance-adapter.ts", "client/features/cli-adapters.ts"]), route("quick-app.proxy", "quick-app-host-proxy-021", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", [
84365
85952
  "dsh-capabilities/host/quick-app-proxy-adapter.ts",
84366
85953
  "dsh-capabilities/host/quick-app-proxy-provider.ts",
84367
85954
  "host/features/quick-apps.ts",
@@ -84377,22 +85964,22 @@ button[${ACCOUNT_ATTRIBUTE}]:focus-visible{outline:2px solid ${require_theme.dsh
84377
85964
  "dsh-capabilities/host/quick-app-transport.ts",
84378
85965
  "host/features/quick-apps.ts",
84379
85966
  "host/features/lan-access-dsh.ts"
84380
- ]), route("sidebar.footer-action", "sidebar-footer-action-021", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/client/quick-app-footer-adapter.ts", "client/features/quick-apps.ts"]), route("session.prompt-assembly", "session-prompt-assembly-021", "host", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", [
85967
+ ]), route("sidebar.footer-action", "sidebar-footer-action-021", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/client/quick-app-footer-adapter.ts", "client/features/quick-apps.ts"]), route("session.prompt-assembly", "session-prompt-assembly-021", "host", ">=0.2.1-alpha.3", "supported", [
84381
85968
  "dsh-capabilities/host/session-prompt-adapter.ts",
84382
85969
  "host/features/session-prompt-translation.ts",
84383
85970
  "host/cli-adapters/feature.ts"
84384
- ]), route("session.external-model-selection", "session-external-model-selection-021", "host", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", ["dsh-capabilities/host/session-model-selection-adapter.ts", "host/cli-adapters/feature.ts"]), route("session.activation", "session-activation-020", "host", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["dsh-capabilities/host/session-activation-adapter.ts", "host/native-session-bridge.ts"]), route("session.activation", "session-activation-021", "host", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", ["dsh-capabilities/host/session-activation-adapter.ts", "host/native-session-bridge.ts"]), route("conversation.message-presentation", "message-presentation-020", "client", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["dsh-capabilities/client/message-presentation-adapter.ts", "client/session-translation-chat.ts"]), route("conversation.message-presentation", "message-presentation-021", "client", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", ["dsh-capabilities/client/message-presentation-adapter.ts", "client/session-translation-chat.ts"]), route("connection.peer", "connection.peer-021", "host", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", [
85971
+ ]), route("session.external-model-selection", "session-external-model-selection-021", "host", ">=0.2.1-alpha.3", "supported", ["dsh-capabilities/host/session-model-selection-adapter.ts", "host/cli-adapters/feature.ts"]), route("session.activation", "session-activation-020", "host", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["dsh-capabilities/host/session-activation-adapter.ts", "host/native-session-bridge.ts"]), route("session.activation", "session-activation-021", "host", ">=0.2.1-alpha.3", "supported", ["dsh-capabilities/host/session-activation-adapter.ts", "host/native-session-bridge.ts"]), route("conversation.message-presentation", "message-presentation-020", "client", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["dsh-capabilities/client/message-presentation-adapter.ts", "client/session-translation-chat.ts"]), route("conversation.message-presentation", "message-presentation-021", "client", ">=0.2.1-alpha.3", "supported", ["dsh-capabilities/client/message-presentation-adapter.ts", "client/session-translation-chat.ts"]), route("connection.peer", "connection.peer-021", "host", ">=0.2.1-alpha.3", "supported", [
84385
85972
  "dsh-capabilities/host/connection-peer-adapter.ts",
84386
85973
  "host/rpc.ts",
84387
85974
  "host/features/global-voice-rpc.ts",
84388
85975
  "host/modules/peer-host/peer-host-native-dispatch.ts"
84389
- ]), route("connection.uplink", "connection.uplink-021", "host", ">=0.2.1-alpha.3 <=0.2.1-rc.3", "supported", ["dsh-capabilities/host/native-dispatch-adapter.ts", "host/modules/peer-host/peer-host-native-dispatch.ts"]), route("session.title", "session-title-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/host/session-title-adapter.ts", "host/features/session-title-optimization.ts"]), route("session.working-directory", "session-working-directory-021", "host", ">=0.2.1-alpha.2", "supported", ["host/terminal/terminal-controller.ts", "host/index.ts"]), route("llm.text", "llm-text-021", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", [
85976
+ ]), route("connection.uplink", "connection.uplink-021", "host", ">=0.2.1-alpha.3", "supported", ["dsh-capabilities/host/native-dispatch-adapter.ts", "host/modules/peer-host/peer-host-native-dispatch.ts"]), route("session.title", "session-title-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/host/session-title-adapter.ts", "host/features/session-title-optimization.ts"]), route("session.working-directory", "session-working-directory-021", "host", ">=0.2.1-alpha.2", "supported", ["host/terminal/terminal-controller.ts", "host/index.ts"]), route("llm.text", "llm-text-021", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", [
84390
85977
  "dsh-capabilities/host/assistant-llm-adapter.ts",
84391
85978
  "host/features/assistant-text-chat.ts",
84392
85979
  "dsh-capabilities/host/session-title-adapter.ts",
84393
85980
  "host/features/session-title-optimization.ts",
84394
85981
  "host/features/git-management.ts"
84395
- ]), route("assistant.agent", "assistant-agent-021", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/host/assistant-agent-adapter.ts", "host/features/global-voice-rpc.ts"]), route("settings.store", "legacy-settings-scope", "host", ">=0.1.5-rc.3 <=0.1.6", "supported", ["host/settings.ts", "host/features/*"]), route("settings.store", "config-forms", "host", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["host/settings.ts", "client/settings-bridge.ts"]), route("connection.rpc", "legacy-rpc-handler", "host", ">=0.1.5-rc.3 <=0.1.6", "supported", ["host/rpc.ts"]), route("connection.rpc", "peer-aware-rpc-handler", "host", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["host/rpc.ts"]), route("connection.peer", "peer-scope", "host", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["host/rpc.ts"]), route("ui.icon.plus", "fixed-plus-icon", "client", ">=0.1.5-rc.3 <=0.1.6", "supported", ["client/terminal/xterm-view.ts"]), route("ui.icon.plus", "regular-plus-icon", "client", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["client/terminal/xterm-view.ts"]), route("ui.icon.chevron", "fixed-chevron-icon", "client", ">=0.1.5-rc.3 <=0.1.6", "supported", ["client/terminal/ui.ts"]), route("ui.icon.chevron", "regular-chevron-icon", "client", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["client/terminal/ui.ts"]), route("locale.runtime", "locale-runtime", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/locale.ts"]), route("theme.runtime", "theme-runtime", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/theme.ts"]), route("conversation.tool-call", "conversation-events", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/external-tool-stream.ts"]), route("sidebar.right", "sidebar-right-tabs", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/terminal/ui.ts"]), route("sidebar.global-panel", "sidebar-panellist-main-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/client/global-panel-adapter.ts", "client/features/magpie-management.ts"]), route("typert.remote", "remote-result", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/terminal/terminal-controller.ts", "client/terminal/model.ts"]), route("peer-host.store", "peer-host-store", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.handshake", "peer-host-handshake", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.http-proxy", "peer-host-http-proxy", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.ws-proxy", "peer-host-ws-proxy", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.aggregate", "peer-host-aggregate", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.relay-route", "peer-host-relay-route", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.native-navigation", "peer-host-native-navigation-legacy", "client", ">=0.1.5-rc.3 <=0.1.6", "deprecated", ["client/features/peer-host.ts"]), route("peer-host.native-navigation", "peer-host-native-navigation-modern", "client", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["client/features/peer-host.ts"]), route("peer-host.remote-web-context-fallback", "peer-host-remote-web-context-fallback", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/features/peer-host.ts"]), route("settings.store", "settings-forms-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/settings.ts", "host/rpc.ts"]), route("connection.rpc", "connection-rpc-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/rpc.ts", "transport/dsh-transport.ts"]), route("connection.peer", "connection-peer-admission-020", "host", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["host/rpc.ts"]), route("connection.attachment", "connection-rpc-attachment-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/rpc.ts", "transport/dsh-transport.ts"]), route("connection.uplink", "connection-rpc-uplink-020", "host", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["host/rpc.ts", "transport/dsh-transport.ts"]), route("typert.remote", "remote-context-stream-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/terminal/terminal-controller.ts", "client/terminal/model.ts"]), route("typert.context", "typert-context-registry-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.host.ts", "host/terminal/terminal-controller.ts"]), route("typert.stream", "typert-remote-stream-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.host.ts", "typert.remote-client.ts"]), route("session.format-v4", "session-format-v4", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/native-session-bridge.ts", "host/session-migration-repair.ts"]), route("subagent.continuable", "subagent-continuable-020", "host", ">=0.2.0-rc.1 <=0.2.1-alpha.1", "supported", ["host/cli-adapters/session-store.ts", "host/cli-adapters/feature.ts"]), route("subagent.continuable", "subagent-activation-021", "host", ">=0.2.1-alpha.2", "supported", ["host/cli-adapters/native-team-subagent.ts", "host/cli-adapters/native-subagent-dispatch.ts"]), route("agent-team.native", "agent-team-native-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/cli-adapters/feature.ts", "host/cli-adapters/native-team-proxy.ts"]), route("agent-team.external-member", "agent-team-external-member-021", "host", ">=0.2.1-alpha.2 <=0.2.1-rc.3", "supported", ["host/cli-adapters/feature.ts", "host/cli-bridge/team-dispatch.ts"]), route("agent-team.external-lead", "agent-team-external-lead-021", "host", ">=0.2.1-alpha.2 <=0.2.1-rc.3", "supported", ["host/cli-adapters/feature.ts", "host/cli-bridge/team-dispatch.ts"]), route("ui.icon.plus", "regular-plus-icon-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/xterm-view.ts"]), route("ui.icon.chevron", "regular-chevron-icon-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/ui.ts"]), route("locale.runtime", "locale-runtime-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/locale.ts"]), route("theme.runtime", "theme-runtime-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/theme.ts"]), route("theme.font-scale", "theme-font-scale-021", "client", ">=0.2.1-alpha.2", "supported", ["client/font-scale.ts", "client/index.ts"]), route("conversation.tool-call", "conversation-events-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/external-tool-stream.ts"]), route("conversation.draft-share", "conversation-draft-share-021", "client", ">=0.2.1-alpha.1 <=0.2.1-rc.3", "supported", ["client/terminal/ui.ts", "client/terminal/sharing.ts"]), route("conversation.interaction-translation", "interaction-presentation-021", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/session-translation-interactions.ts"]), route("sidebar.right", "sidebar-right-dock-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/ui.ts"]), route("typert.remote", "remote-context-stream-020-client", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/model.ts"]), route("typert.context", "typert-context-registry-020-client", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.remote-client.ts", "client/terminal/model.ts"]), route("typert.stream", "typert-remote-stream-020-client", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.remote-client.ts", "client/terminal/model.ts"]), route("client.boot-graph", "client-web-boot-graph-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/index.ts", "package.json"]), route("peer-host.native-navigation", "peer-host-native-navigation-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/features/peer-host.ts"]), route("peer-host.remote-web-context-fallback", "peer-host-remote-web-context-fallback-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/features/peer-host.ts"]), route("peer-host.store", "peer-host-store-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.handshake", "peer-host-handshake-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.http-proxy", "peer-host-http-proxy-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts", "host/modules/peer-host/quick-app-gateway.ts"]), route("peer-host.ws-proxy", "peer-host-ws-proxy-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.aggregate", "peer-host-aggregate-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.aggregated-transport", "peer-host-aggregated-transport-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/modules/peer-host/aggregated-host-transport.ts"]), route("peer-host.client-preboot-transport", "peer-host-client-preboot-transport-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", [
85982
+ ]), route("assistant.agent", "assistant-agent-021", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/host/assistant-agent-adapter.ts", "host/features/global-voice-rpc.ts"]), route("settings.store", "legacy-settings-scope", "host", ">=0.1.5-rc.3 <=0.1.6", "supported", ["host/settings.ts", "host/features/*"]), route("settings.store", "config-forms", "host", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["host/settings.ts", "client/settings-bridge.ts"]), route("connection.rpc", "legacy-rpc-handler", "host", ">=0.1.5-rc.3 <=0.1.6", "supported", ["host/rpc.ts"]), route("connection.rpc", "peer-aware-rpc-handler", "host", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["host/rpc.ts"]), route("connection.peer", "peer-scope", "host", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["host/rpc.ts"]), route("ui.icon.plus", "fixed-plus-icon", "client", ">=0.1.5-rc.3 <=0.1.6", "supported", ["client/terminal/xterm-view.ts"]), route("ui.icon.plus", "regular-plus-icon", "client", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["client/terminal/xterm-view.ts"]), route("ui.icon.chevron", "fixed-chevron-icon", "client", ">=0.1.5-rc.3 <=0.1.6", "supported", ["client/terminal/ui.ts"]), route("ui.icon.chevron", "regular-chevron-icon", "client", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["client/terminal/ui.ts"]), route("locale.runtime", "locale-runtime", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/locale.ts"]), route("theme.runtime", "theme-runtime", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/theme.ts"]), route("conversation.tool-call", "conversation-events", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/external-tool-stream.ts"]), route("sidebar.right", "sidebar-right-tabs", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/terminal/ui.ts"]), route("sidebar.global-panel", "sidebar-panellist-main-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["dsh-capabilities/client/global-panel-adapter.ts", "client/features/magpie-management.ts"]), route("typert.remote", "remote-result", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/terminal/terminal-controller.ts", "client/terminal/model.ts"]), route("peer-host.store", "peer-host-store", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.handshake", "peer-host-handshake", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.http-proxy", "peer-host-http-proxy", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.ws-proxy", "peer-host-ws-proxy", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.aggregate", "peer-host-aggregate", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.relay-route", "peer-host-relay-route", "host", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["host/features/peer-host.ts"]), route("peer-host.native-navigation", "peer-host-native-navigation-legacy", "client", ">=0.1.5-rc.3 <=0.1.6", "deprecated", ["client/features/peer-host.ts"]), route("peer-host.native-navigation", "peer-host-native-navigation-modern", "client", ">=0.1.7-rc.2 <=0.1.7-rc.2", "supported", ["client/features/peer-host.ts"]), route("peer-host.remote-web-context-fallback", "peer-host-remote-web-context-fallback", "client", ">=0.1.5-rc.3 <=0.1.7-rc.2", "supported", ["client/features/peer-host.ts"]), route("settings.store", "settings-forms-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/settings.ts", "host/rpc.ts"]), route("connection.rpc", "connection-rpc-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/rpc.ts", "transport/dsh-transport.ts"]), route("connection.peer", "connection-peer-admission-020", "host", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["host/rpc.ts"]), route("connection.attachment", "connection-rpc-attachment-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/rpc.ts", "transport/dsh-transport.ts"]), route("connection.uplink", "connection-rpc-uplink-020", "host", ">=0.2.0-rc.2 <=0.2.1-alpha.2", "supported", ["host/rpc.ts", "transport/dsh-transport.ts"]), route("typert.remote", "remote-context-stream-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/terminal/terminal-controller.ts", "client/terminal/model.ts"]), route("typert.context", "typert-context-registry-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.host.ts", "host/terminal/terminal-controller.ts"]), route("typert.stream", "typert-remote-stream-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.host.ts", "typert.remote-client.ts"]), route("session.format-v4", "session-format-v4", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/native-session-bridge.ts", "host/session-migration-repair.ts"]), route("subagent.continuable", "subagent-continuable-020", "host", ">=0.2.0-rc.1 <=0.2.1-alpha.1", "supported", ["host/cli-adapters/session-store.ts", "host/cli-adapters/feature.ts"]), route("subagent.continuable", "subagent-activation-021", "host", ">=0.2.1-alpha.2", "supported", ["host/cli-adapters/native-team-subagent.ts", "host/cli-adapters/native-subagent-dispatch.ts"]), route("agent-team.native", "agent-team-native-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/cli-adapters/feature.ts", "host/cli-adapters/native-team-proxy.ts"]), route("agent-team.external-member", "agent-team-external-member-021", "host", ">=0.2.1-alpha.2", "supported", ["host/cli-adapters/feature.ts", "host/cli-bridge/team-dispatch.ts"]), route("agent-team.external-lead", "agent-team-external-lead-021", "host", ">=0.2.1-alpha.2", "supported", ["host/cli-adapters/feature.ts", "host/cli-bridge/team-dispatch.ts"]), route("ui.icon.plus", "regular-plus-icon-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/xterm-view.ts"]), route("ui.icon.chevron", "regular-chevron-icon-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/ui.ts"]), route("locale.runtime", "locale-runtime-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/locale.ts"]), route("theme.runtime", "theme-runtime-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/theme.ts"]), route("theme.font-scale", "theme-font-scale-021", "client", ">=0.2.1-alpha.2", "supported", ["client/font-scale.ts", "client/index.ts"]), route("conversation.tool-call", "conversation-events-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/external-tool-stream.ts"]), route("conversation.draft-share", "conversation-draft-share-021", "client", ">=0.2.1-alpha.1", "supported", ["client/terminal/ui.ts", "client/terminal/sharing.ts"]), route("conversation.interaction-translation", "interaction-presentation-021", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/session-translation-interactions.ts"]), route("sidebar.right", "sidebar-right-dock-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/ui.ts"]), route("typert.remote", "remote-context-stream-020-client", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/terminal/model.ts"]), route("typert.context", "typert-context-registry-020-client", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.remote-client.ts", "client/terminal/model.ts"]), route("typert.stream", "typert-remote-stream-020-client", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["typert.remote-client.ts", "client/terminal/model.ts"]), route("client.boot-graph", "client-web-boot-graph-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/index.ts", "package.json"]), route("peer-host.native-navigation", "peer-host-native-navigation-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/features/peer-host.ts"]), route("peer-host.remote-web-context-fallback", "peer-host-remote-web-context-fallback-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["client/features/peer-host.ts"]), route("peer-host.store", "peer-host-store-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.handshake", "peer-host-handshake-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.http-proxy", "peer-host-http-proxy-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts", "host/modules/peer-host/quick-app-gateway.ts"]), route("peer-host.ws-proxy", "peer-host-ws-proxy-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.aggregate", "peer-host-aggregate-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/features/peer-host.ts"]), route("peer-host.aggregated-transport", "peer-host-aggregated-transport-020", "host", require_native_workspace_store.DSH_COMPATIBILITY, "supported", ["host/modules/peer-host/aggregated-host-transport.ts"]), route("peer-host.client-preboot-transport", "peer-host-client-preboot-transport-020", "client", require_native_workspace_store.DSH_COMPATIBILITY, "supported", [
84396
85983
  "bootstrap/index.ts",
84397
85984
  "host/index-injection.ts",
84398
85985
  "client/features/peer-host.ts"
@@ -90413,5 +92000,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
90413
92000
  });
90414
92001
 
90415
92002
  })();
90416
- // codingns-client-revision: 35886f7c011dbf3b1b8887fda4f4d0801ce70892fbbcbc56eb0a5b58cea97891
92003
+ // codingns-client-revision: cd7d0051b78ba2ffbee4f037966c1f1af54ec8f25faa8891c2d414d9cbe7e77a
90417
92004
  //# sourceMappingURL=bundle.js.map