dsh-edge 0.1.0

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +183 -0
  4. package/README.zh.md +183 -0
  5. package/THIRD_PARTY_NOTICES.md +199 -0
  6. package/dist/_headers +3 -0
  7. package/dist/assets/fonts/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  8. package/dist/assets/fonts/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  9. package/dist/assets/fonts/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  10. package/dist/assets/fonts/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  11. package/dist/assets/fonts/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  12. package/dist/assets/fonts/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  13. package/dist/assets/fonts/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  14. package/dist/assets/fonts/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  15. package/dist/assets/fonts/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  16. package/dist/assets/fonts/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  17. package/dist/assets/fonts/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  18. package/dist/assets/fonts/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  19. package/dist/assets/fonts/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  20. package/dist/assets/fonts/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  21. package/dist/assets/fonts/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  22. package/dist/assets/fonts/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  23. package/dist/assets/fonts/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  24. package/dist/assets/fonts/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  25. package/dist/assets/fonts/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  26. package/dist/assets/fonts/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  27. package/dist/assets/fonts/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  28. package/dist/assets/fonts/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  29. package/dist/assets/fonts/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  30. package/dist/assets/fonts/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  31. package/dist/assets/fonts/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  32. package/dist/assets/fonts/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  33. package/dist/assets/fonts/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  34. package/dist/assets/fonts/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  35. package/dist/assets/fonts/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  36. package/dist/assets/fonts/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  37. package/dist/assets/fonts/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  38. package/dist/assets/fonts/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  39. package/dist/assets/fonts/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  40. package/dist/assets/fonts/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  41. package/dist/assets/fonts/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  42. package/dist/assets/fonts/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  43. package/dist/assets/fonts/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  44. package/dist/assets/fonts/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  45. package/dist/assets/fonts/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  46. package/dist/assets/fonts/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  47. package/dist/assets/fonts/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  48. package/dist/assets/fonts/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  49. package/dist/assets/fonts/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  50. package/dist/assets/fonts/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  51. package/dist/assets/fonts/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  52. package/dist/assets/fonts/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  53. package/dist/assets/fonts/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  54. package/dist/assets/fonts/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  55. package/dist/assets/fonts/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  56. package/dist/assets/fonts/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  57. package/dist/assets/fonts/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  58. package/dist/assets/fonts/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  59. package/dist/assets/fonts/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  60. package/dist/assets/fonts/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  61. package/dist/assets/fonts/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  62. package/dist/assets/fonts/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  63. package/dist/assets/fonts/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  64. package/dist/assets/fonts/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  65. package/dist/assets/fonts/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  66. package/dist/assets/index-C-1AiF3k.js +112 -0
  67. package/dist/assets/index-CSGf6Qzd.css +1 -0
  68. package/dist/assets/langs/c-BIGW1oBm.js +2 -0
  69. package/dist/assets/langs/cpp-DIPi6g--.js +2 -0
  70. package/dist/assets/langs/csharp-DSvCPggb.js +2 -0
  71. package/dist/assets/langs/css-CLj8gQPS.js +2 -0
  72. package/dist/assets/langs/go-C27-OAKa.js +2 -0
  73. package/dist/assets/langs/html-CfGypltT.js +2 -0
  74. package/dist/assets/langs/ini-BEwlwnbL.js +2 -0
  75. package/dist/assets/langs/java-CylS5w8V.js +2 -0
  76. package/dist/assets/langs/kotlin-BdnUsdx6.js +2 -0
  77. package/dist/assets/langs/less-B1dDrJ26.js +2 -0
  78. package/dist/assets/langs/lua-BaeVxFsk.js +2 -0
  79. package/dist/assets/langs/markdown-Cvjx9yec.js +2 -0
  80. package/dist/assets/langs/mdx-Cmh6b_Ma.js +2 -0
  81. package/dist/assets/langs/php-D-uCvoST.js +2 -0
  82. package/dist/assets/langs/python-B6aJPvgy.js +2 -0
  83. package/dist/assets/langs/ruby-DEItuUFs.js +2 -0
  84. package/dist/assets/langs/rust-B1yitclQ.js +2 -0
  85. package/dist/assets/langs/scss-D5BDwBP9.js +2 -0
  86. package/dist/assets/langs/sql-CRqJ_cUM.js +2 -0
  87. package/dist/assets/langs/swift-D82vCrfD.js +2 -0
  88. package/dist/assets/langs/toml-vGWfd6FD.js +2 -0
  89. package/dist/assets/langs/xml-sdJ4AIDG.js +2 -0
  90. package/dist/assets/langs/yaml-Buea-lGh.js +2 -0
  91. package/dist/assets/vendor-Cjbwl5VI.js +411 -0
  92. package/dist/assets/vendor-CjyC-hUb.css +1 -0
  93. package/dist/favicon.svg +8 -0
  94. package/dist/index.html +35 -0
  95. package/dist/manifest.webmanifest +16 -0
  96. package/dist/plugins/@deepseek-ai/dsh-api-gateway/client.js +420 -0
  97. package/dist/plugins/@deepseek-ai/dsh-api-remotes/client.js +5937 -0
  98. package/dist/plugins/@deepseek-ai/dsh-client-connection/client.js +10207 -0
  99. package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +1231 -0
  100. package/dist/plugins/@deepseek-ai/dsh-client-modules/client.js +259 -0
  101. package/dist/plugins/@deepseek-ai/dsh-client-runtime/client.js +10539 -0
  102. package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +1725 -0
  103. package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +1116 -0
  104. package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +9832 -0
  105. package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +373 -0
  106. package/dist/plugins/@deepseek-ai/dsh-client-ui-edge/client.js +549 -0
  107. package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +859 -0
  108. package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +280 -0
  109. package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +456 -0
  110. package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +804 -0
  111. package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +461 -0
  112. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings/client.js +254 -0
  113. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +609 -0
  114. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +292 -0
  115. package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +327 -0
  116. package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +710 -0
  117. package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +1312 -0
  118. package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +1630 -0
  119. package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +7370 -0
  120. package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +700 -0
  121. package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +474 -0
  122. package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +2426 -0
  123. package/dist/plugins/@deepseek-ai/dsh-typert-registry/client.js +1372 -0
  124. package/package.json +97 -0
  125. package/scripts/assemble-web.mjs +230 -0
  126. package/scripts/bundle-size.d.mts +2 -0
  127. package/scripts/bundle-size.mjs +26 -0
  128. package/scripts/bundle.mjs +53 -0
  129. package/scripts/cli.d.mts +39 -0
  130. package/scripts/cli.mjs +496 -0
  131. package/scripts/install.d.mts +149 -0
  132. package/scripts/install.mjs +989 -0
  133. package/scripts/legal-files.mjs +24 -0
  134. package/scripts/verify-packed.mjs +32 -0
  135. package/scripts/wrangler-config.d.mts +18 -0
  136. package/scripts/wrangler-config.mjs +84 -0
  137. package/src/agent.ts +119 -0
  138. package/src/auth.ts +352 -0
  139. package/src/deepseek.ts +231 -0
  140. package/src/deployment.ts +147 -0
  141. package/src/direct-shell-core-empty.ts +10 -0
  142. package/src/direct-shell-protocol.ts +5 -0
  143. package/src/direct-shell.ts +341 -0
  144. package/src/do-session-persistence.ts +1064 -0
  145. package/src/edge-api.ts +796 -0
  146. package/src/edge-credentials.ts +56 -0
  147. package/src/edge-remotes.ts +41 -0
  148. package/src/edge-workspace-store.ts +339 -0
  149. package/src/http.ts +212 -0
  150. package/src/index.ts +196 -0
  151. package/src/instance.ts +1007 -0
  152. package/src/isolated-direct-shell-unavailable.ts +11 -0
  153. package/src/protocol.ts +39 -0
  154. package/src/release.ts +9 -0
  155. package/src/session-store.ts +1110 -0
  156. package/src/sse.ts +86 -0
  157. package/src/web-search.ts +38 -0
  158. package/src/workspace.ts +270 -0
  159. package/wrangler.jsonc +56 -0
@@ -0,0 +1,456 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@deepseek-ai/dsh-client-ui-layout",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+ let react = require("react");
9
+ let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
10
+ /** Viewport width below which the sidebar auto-collapses to the rail (deepsuite
11
+ * LG breakpoint); a manual toggle below it re-expands over the squeezed center
12
+ * (stores.ts narrowExpanded). */
13
+ const SIDEBAR_AUTO_COLLAPSE = 1024;
14
+ /**
15
+ * Clamp a panel width into its contract range.
16
+ * @param px - requested width.
17
+ * @param min - range lower bound.
18
+ * @param max - range upper bound.
19
+ * @returns the clamped width.
20
+ */
21
+ function clampWidth(px, min, max) {
22
+ return Math.min(max, Math.max(min, Math.round(px)));
23
+ }
24
+ /**
25
+ * Solve the three column widths for one viewport frame. Pure: no hysteresis —
26
+ * the output is a function of (viewport, preferences) only, so recovery on
27
+ * re-widening is automatic. Preferences re-clamp here because they cross the
28
+ * store boundary and callers may still supply stale ranges.
29
+ * @param viewport - available frame width in px.
30
+ * @param sidebar - sidebar width preference in px (0 = closed).
31
+ * @param details - details width preference in px (0 = closed).
32
+ * @returns resolved widths; details 0 means visually closed (never unmounted), while a closed sidebar keeps its compact rail.
33
+ */
34
+ function computeColumns(viewport, sidebar, details) {
35
+ const s = sidebar === 0 ? 56 : clampWidth(sidebar, 264, 420);
36
+ const d0 = details === 0 ? 0 : clampWidth(details, 300, 520);
37
+ if (s + d0 + 640 <= viewport) return {
38
+ sidebar: s,
39
+ center: viewport - s - d0,
40
+ details: d0
41
+ };
42
+ const d1 = d0 === 0 ? 0 : Math.max(300, viewport - s - 640);
43
+ if (s + d1 + 640 <= viewport) return {
44
+ sidebar: s,
45
+ center: 640,
46
+ details: d1
47
+ };
48
+ return {
49
+ sidebar: s,
50
+ center: Math.max(0, viewport - s),
51
+ details: 0
52
+ };
53
+ }
54
+ //#endregion
55
+ //#region \0dsh-css:/private/var/folders/nm/n5smty9962gf5rhjc5855kt80000gn/T/dsh-edge-release-worktree.XXXXXX.RcJjogaGt4/repo/packages/client/ui-layout/src/client/AppFrame.module.css.mjs
56
+ const css = ".Sp1W1W_frame{background:var(--dsw-alias-bg-base);height:100%;transition:grid-template-columns var(--ds-transition-duration-slow) var(--ds-ease-in-out);grid-template-rows:100%;display:grid;position:relative;overflow:hidden}.Sp1W1W_frame[data-dragging]{transition:none}@media (prefers-reduced-motion:reduce){.Sp1W1W_frame{transition:none}}.Sp1W1W_sidebarCol{background:var(--dsw-specific-sidebar-fill);border-right:1px solid var(--dsw-alias-border-l1);min-width:0;overflow:hidden}.Sp1W1W_centerCol{flex-direction:column;min-width:0;display:flex;overflow:hidden}.Sp1W1W_detailsCol{border-left:1px solid var(--dsw-alias-border-l2);min-width:0;overflow:hidden}.Sp1W1W_frame[data-details-collapsed] .Sp1W1W_detailsCol{border-left:none}.Sp1W1W_handle{cursor:col-resize;z-index:2;touch-action:none;width:8px;transition:left var(--ds-transition-duration-slow) var(--ds-ease-in-out);margin-left:-4px;position:absolute;top:0;bottom:0}.Sp1W1W_frame[data-dragging] .Sp1W1W_handle{transition:none}@media (prefers-reduced-motion:reduce){.Sp1W1W_handle{transition:none}}.Sp1W1W_handle[data-side=details]:after{content:\"\";box-sizing:border-box;background:var(--dsw-alias-button-floating-fill);border:1px solid var(--dsw-alias-border-l2-darkmode-thin);opacity:0;width:12px;height:32px;transition:opacity var(--ds-transition-duration-slow) var(--ds-ease-in-out), background var(--ds-transition-duration-slow) var(--ds-ease-in-out);border-radius:10px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.Sp1W1W_detailsCol:hover~.Sp1W1W_handle[data-side=details]:after,.Sp1W1W_handle[data-side=details]:hover:after,.Sp1W1W_handle[data-side=details][data-dragging=true]:after{opacity:1}.Sp1W1W_handle[data-side=details]:hover:after,.Sp1W1W_handle[data-side=details][data-dragging=true]:after{background:var(--dsw-alias-button-floating-hover);border-color:var(--dsw-alias-border-l3)}.Sp1W1W_overlayLayer{z-index:20;pointer-events:none;position:absolute;inset:0}.Sp1W1W_overlayLayer>*{pointer-events:auto}";
57
+ const tagId = "@deepseek-ai/dsh-client-ui-layout/AppFrame.module.css";
58
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
59
+ const tag = document.createElement("style");
60
+ tag.dataset.plugin = "@deepseek-ai/dsh-client-ui-layout";
61
+ tag.dataset.pluginCss = tagId;
62
+ tag.textContent = css;
63
+ document.head.appendChild(tag);
64
+ }
65
+ var AppFrame_module_css_default = {
66
+ "centerCol": "Sp1W1W_centerCol",
67
+ "frame": "Sp1W1W_frame",
68
+ "detailsCol": "Sp1W1W_detailsCol",
69
+ "handle": "Sp1W1W_handle",
70
+ "overlayLayer": "Sp1W1W_overlayLayer",
71
+ "sidebarCol": "Sp1W1W_sidebarCol"
72
+ };
73
+ //#endregion
74
+ //#region lib/types/client/AppFrame.js
75
+ /**
76
+ * Three-column shell frame, registered into the built-in 'root' slot (the web
77
+ * shell renders only 'root'). Owns the grid tracks (sidebar | center |
78
+ * details), the drag handles (pointer capture + rAF throttle), the concession
79
+ * chain (columns.ts), and the child-slot render decisions: the sidebar slot
80
+ * renders HERE with live parameters from the concession solve, and the
81
+ * session-aware occupants render in fixed column positions; strict entries
82
+ * gate themselves on current-session availability while session-maybe
83
+ * entries retain identity. Pure component: everything arrives
84
+ * through the three framework shares — zero cordis or framework imports,
85
+ * zero self-made hooks.
86
+ */
87
+ /** Center column grid item (session-body building block). */
88
+ function CenterColumn(props) {
89
+ return (0, react_jsx_runtime.jsx)("div", {
90
+ className: AppFrame_module_css_default.centerCol,
91
+ children: props.children
92
+ });
93
+ }
94
+ /** Details column grid item; width 0 keeps the subtree mounted (never unmount on close). */
95
+ function DetailsColumn(props) {
96
+ return (0, react_jsx_runtime.jsx)("div", {
97
+ className: AppFrame_module_css_default.detailsCol,
98
+ children: props.children
99
+ });
100
+ }
101
+ /**
102
+ * One drag handle: pointer capture, rAF-throttled dx reports against the drag-start origin.
103
+ * `side` keys the hover-reveal CSS to the owning column.
104
+ */
105
+ function DragHandle(props) {
106
+ const [dragging, setDragging] = (0, react.useState)(false);
107
+ const origin = (0, react.useRef)(0);
108
+ const latest = (0, react.useRef)(0);
109
+ const frame = (0, react.useRef)(null);
110
+ const callbacks = (0, react.useRef)({
111
+ onStart: props.onStart,
112
+ onDrag: props.onDrag,
113
+ onEnd: props.onEnd
114
+ });
115
+ callbacks.current = {
116
+ onStart: props.onStart,
117
+ onDrag: props.onDrag,
118
+ onEnd: props.onEnd
119
+ };
120
+ const onPointerDown = (0, react.useCallback)((e) => {
121
+ e.preventDefault();
122
+ e.currentTarget.setPointerCapture(e.pointerId);
123
+ origin.current = e.clientX;
124
+ latest.current = e.clientX;
125
+ callbacks.current.onStart();
126
+ setDragging(true);
127
+ }, []);
128
+ const onPointerMove = (0, react.useCallback)((e) => {
129
+ if (!e.currentTarget.hasPointerCapture(e.pointerId)) return;
130
+ latest.current = e.clientX;
131
+ frame.current ??= requestAnimationFrame(() => {
132
+ frame.current = null;
133
+ callbacks.current.onDrag(latest.current - origin.current);
134
+ });
135
+ }, []);
136
+ const onPointerUp = (0, react.useCallback)((e) => {
137
+ if (!e.currentTarget.hasPointerCapture(e.pointerId)) return;
138
+ e.currentTarget.releasePointerCapture(e.pointerId);
139
+ if (frame.current !== null) {
140
+ cancelAnimationFrame(frame.current);
141
+ frame.current = null;
142
+ }
143
+ callbacks.current.onDrag(latest.current - origin.current);
144
+ setDragging(false);
145
+ callbacks.current.onEnd();
146
+ }, []);
147
+ return (0, react_jsx_runtime.jsx)("div", {
148
+ className: AppFrame_module_css_default.handle,
149
+ style: { left: props.left },
150
+ "data-side": props.side,
151
+ "data-dragging": dragging || void 0,
152
+ onPointerDown,
153
+ onPointerMove,
154
+ onPointerUp
155
+ });
156
+ }
157
+ /** The three-column frame (see module doc). */
158
+ function AppFrame({ useStore, useSessions, actions, renderSlot }) {
159
+ const panels = useStore((s) => s);
160
+ const detailsSession = useSessions((s) => {
161
+ const current = s.current;
162
+ return current !== void 0 && s.byId[current]?.blank === false ? current : void 0;
163
+ });
164
+ const frameRef = (0, react.useRef)(null);
165
+ const [viewport, setViewport] = (0, react.useState)(() => window.innerWidth);
166
+ const lastSession = (0, react.useRef)(detailsSession);
167
+ (0, react.useLayoutEffect)(() => {
168
+ if (detailsSession === void 0) return;
169
+ if (lastSession.current !== void 0 && lastSession.current !== detailsSession) actions.closeDetails();
170
+ lastSession.current = detailsSession;
171
+ }, [actions, detailsSession]);
172
+ (0, react.useEffect)(() => {
173
+ const el = frameRef.current;
174
+ /* v8 ignore next -- the ref is always attached by effect time: the frame div renders unconditionally. */
175
+ if (el === null) return;
176
+ let raf = null;
177
+ const observer = new ResizeObserver(() => {
178
+ raf ??= requestAnimationFrame(() => {
179
+ raf = null;
180
+ const width = el.getBoundingClientRect().width;
181
+ if (width > 0) setViewport(width);
182
+ });
183
+ });
184
+ observer.observe(el);
185
+ return () => {
186
+ observer.disconnect();
187
+ if (raf !== null) cancelAnimationFrame(raf);
188
+ };
189
+ }, []);
190
+ const narrow = viewport < SIDEBAR_AUTO_COLLAPSE;
191
+ (0, react.useEffect)(() => {
192
+ actions.setNarrow(narrow);
193
+ }, [actions, narrow]);
194
+ const sidebarCollapsed = narrow ? !panels.narrowExpanded : panels.sidebar === 0;
195
+ const cols = computeColumns(viewport, sidebarCollapsed ? 0 : panels.sidebar === 0 ? 280 : panels.sidebar, detailsSession === void 0 ? 0 : panels.details);
196
+ const colsRef = (0, react.useRef)(cols);
197
+ colsRef.current = cols;
198
+ const sidebarBase = (0, react.useRef)(0);
199
+ const detailsBase = (0, react.useRef)(0);
200
+ const [dragging, setDragging] = (0, react.useState)(false);
201
+ const onDragEnd = (0, react.useCallback)(() => {
202
+ setDragging(false);
203
+ }, []);
204
+ const onSidebarStart = (0, react.useCallback)(() => {
205
+ sidebarBase.current = colsRef.current.sidebar;
206
+ setDragging(true);
207
+ }, []);
208
+ const onDetailsStart = (0, react.useCallback)(() => {
209
+ detailsBase.current = colsRef.current.details;
210
+ setDragging(true);
211
+ }, []);
212
+ const onSidebarDrag = (0, react.useCallback)((dx) => {
213
+ actions.setSidebar(sidebarBase.current + dx);
214
+ }, [actions]);
215
+ const onDetailsDrag = (0, react.useCallback)((dx) => {
216
+ actions.setDetails(detailsBase.current - dx);
217
+ }, [actions]);
218
+ return (0, react_jsx_runtime.jsxs)("div", {
219
+ ref: frameRef,
220
+ className: AppFrame_module_css_default.frame,
221
+ style: { gridTemplateColumns: `${cols.sidebar}px minmax(0, 1fr) ${cols.details}px` },
222
+ "data-sidebar-collapsed": sidebarCollapsed || void 0,
223
+ "data-details-collapsed": cols.details === 0 || void 0,
224
+ "data-dragging": dragging || void 0,
225
+ children: [
226
+ (0, react_jsx_runtime.jsx)("div", {
227
+ className: AppFrame_module_css_default.sidebarCol,
228
+ children: renderSlot("sidebar", {
229
+ collapsed: sidebarCollapsed,
230
+ width: cols.sidebar
231
+ })
232
+ }),
233
+ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)(CenterColumn, { children: renderSlot("conversation", {}) }), (0, react_jsx_runtime.jsx)(DetailsColumn, { children: renderSlot("details", {}) })] }),
234
+ (0, react_jsx_runtime.jsx)("div", {
235
+ className: AppFrame_module_css_default.overlayLayer,
236
+ "data-shell-overlay": true,
237
+ children: renderSlot("shell.overlay", {})
238
+ }),
239
+ !sidebarCollapsed && (0, react_jsx_runtime.jsx)(DragHandle, {
240
+ side: "sidebar",
241
+ left: cols.sidebar,
242
+ onStart: onSidebarStart,
243
+ onDrag: onSidebarDrag,
244
+ onEnd: onDragEnd
245
+ }),
246
+ cols.details > 0 && (0, react_jsx_runtime.jsx)(DragHandle, {
247
+ side: "details",
248
+ left: viewport - cols.details,
249
+ onStart: onDetailsStart,
250
+ onDrag: onDetailsDrag,
251
+ onEnd: onDragEnd
252
+ })
253
+ ]
254
+ });
255
+ }
256
+ //#endregion
257
+ //#region lib/types/client/stores.js
258
+ /**
259
+ * The root entry's transient layout store: panel geometry as plain widths in
260
+ * px (0 = closed). Module level exports the factory only — a module-level
261
+ * handle would pin the store's identity in the module
262
+ * cache (a de-facto singleton surviving plugin reloads). register() receives
263
+ * the factory (exclusive use: the framework instantiates per entry), AppFrame
264
+ * derives its PropsStore share from the return type, and the service face
265
+ * receives the bound actions through the registration's inject hook.
266
+ */
267
+ /**
268
+ * Create the layout panel store handle. The preference IS the width, so
269
+ * closing a panel forgets its drag width — reopening restores the contract
270
+ * default. Actions are the complete write set: drag writes clamp
271
+ * into the panel's contract range and never cross the open/closed line;
272
+ * open/close transitions write 0 / the default explicitly. Below the
273
+ * auto-collapse breakpoint (AppFrame feeds setNarrow) the sidebar toggle
274
+ * flips the narrowExpanded override instead of the preference.
275
+ * @returns the store handle (spec + type + identity + factory in one).
276
+ */
277
+ function createLayoutStore() {
278
+ return (0, _deepseek_ai_dsh_client_runtime_client.defineStore)({
279
+ init: () => ({
280
+ sidebar: 280,
281
+ details: 0,
282
+ narrow: false,
283
+ narrowExpanded: false
284
+ }),
285
+ actions: {
286
+ setSidebar: (d, px) => {
287
+ d.sidebar = clampWidth(px, 264, 420);
288
+ },
289
+ setDetails: (d, px) => {
290
+ d.details = clampWidth(px, 300, 520);
291
+ },
292
+ toggleSidebar: (d) => {
293
+ if (d.narrow) d.narrowExpanded = !d.narrowExpanded;
294
+ else d.sidebar = d.sidebar === 0 ? 280 : 0;
295
+ },
296
+ setNarrow: (d, narrow) => {
297
+ if (d.narrow === narrow) return;
298
+ d.narrow = narrow;
299
+ d.narrowExpanded = false;
300
+ },
301
+ openDetails: (d) => {
302
+ if (d.details === 0) d.details = 360;
303
+ },
304
+ closeDetails: (d) => {
305
+ d.details = 0;
306
+ }
307
+ }
308
+ });
309
+ }
310
+ //#endregion
311
+ //#region lib/types/client/service.js
312
+ /** Cross-plugin panel-action face (ctx.layout). */
313
+ var LayoutController = class {
314
+ #panels;
315
+ /**
316
+ * Adopt the root entry's bound store actions. Called from the root
317
+ * registration's inject hook (a sanctioned assembly side effect), so the
318
+ * face is live from the entry's first render; on entry re-register the
319
+ * fresh actions overwrite the stale set.
320
+ * @param actions - bound actions of the entry's layout store instance.
321
+ */
322
+ attachPanels(actions) {
323
+ this.#panels = actions;
324
+ }
325
+ /** Toggle the sidebar panel (closed ⟷ contract default width). */
326
+ toggleSidebar() {
327
+ this.#require().toggleSidebar();
328
+ }
329
+ /** Open the details panel (no-op when already open). */
330
+ openDetails() {
331
+ this.#require().openDetails();
332
+ }
333
+ /** Close the details panel. */
334
+ closeDetails() {
335
+ this.#require().closeDetails();
336
+ }
337
+ #require() {
338
+ if (this.#panels === void 0) throw new Error("layout: panel actions not wired (root entry not mounted)");
339
+ return this.#panels;
340
+ }
341
+ };
342
+ //#endregion
343
+ //#region lib/types/client/theme-presenter.js
344
+ /** Body attribute selecting the dark base palette in the token stylesheets. */
345
+ const DARK_ATTRIBUTE = "data-ds-dark-theme";
346
+ /** Applies theme snapshots to the document; one instance per plugin fiber. */
347
+ var ThemePresenter = class {
348
+ /** Token names this presenter wrote in the last apply (its retraction set). */
349
+ appliedTokens = [];
350
+ /** The single metadata node this presenter inserts and removes. */
351
+ themeColorMeta;
352
+ /** Create the presenter-owned metadata node before the first snapshot arrives. */
353
+ constructor() {
354
+ this.themeColorMeta = document.createElement("meta");
355
+ this.themeColorMeta.name = "theme-color";
356
+ }
357
+ /**
358
+ * Project a snapshot onto the document: set root `color-scheme` and the body
359
+ * palette attribute from `active.colorScheme` (never the id — `system` is
360
+ * resolved upstream), then replace the previously applied token variables
361
+ * with `active.tokens`. Browser theme-color metadata follows the computed
362
+ * body background after those writes, so the rendered palette remains the
363
+ * color authority.
364
+ * @param snapshot - resolved theme snapshot from ctx.theme.
365
+ */
366
+ apply(snapshot) {
367
+ const scheme = snapshot.active.colorScheme;
368
+ document.documentElement.style.colorScheme = scheme;
369
+ const body = document.body;
370
+ if (scheme === "dark") body.setAttribute(DARK_ATTRIBUTE, "");
371
+ else body.removeAttribute(DARK_ATTRIBUTE);
372
+ for (const name of this.appliedTokens) body.style.removeProperty(name);
373
+ this.appliedTokens = [];
374
+ for (const [name, value] of Object.entries(snapshot.active.tokens)) {
375
+ body.style.setProperty(name, value);
376
+ this.appliedTokens.push(name);
377
+ }
378
+ this.themeColorMeta.content = getComputedStyle(body).backgroundColor;
379
+ if (!this.themeColorMeta.isConnected) document.head.append(this.themeColorMeta);
380
+ }
381
+ /** Retract root color-scheme, the palette attribute, token variables, and the owned metadata node. */
382
+ dispose() {
383
+ document.documentElement.style.removeProperty("color-scheme");
384
+ const body = document.body;
385
+ body.removeAttribute(DARK_ATTRIBUTE);
386
+ for (const name of this.appliedTokens) body.style.removeProperty(name);
387
+ this.appliedTokens = [];
388
+ this.themeColorMeta.remove();
389
+ }
390
+ };
391
+ //#endregion
392
+ //#region lib/types/client/index.js
393
+ /** Required services (cordis fiber inject — the loader passes all module exports as an object plugin). */
394
+ const inject = ["slots", "theme"];
395
+ /**
396
+ * Client plugin body: provide ctx.layout, then one register() call — AppFrame
397
+ * into 'root' with the four child-slot declarations, the layout store seat,
398
+ * and the inject hook that hands the store's bound actions to the service.
399
+ * @param ctx - client root context.
400
+ */
401
+ function apply(ctx) {
402
+ const layout = new LayoutController();
403
+ ctx.effect(() => {
404
+ const disposeService = ctx.reflect.provide("layout", layout);
405
+ const disposeRegistration = ctx.slots.register({
406
+ name: "root",
407
+ children: {
408
+ "sidebar": {
409
+ kind: "single",
410
+ scope: "root"
411
+ },
412
+ "conversation": {
413
+ kind: "single",
414
+ scope: "session-maybe"
415
+ },
416
+ "details": {
417
+ kind: "single",
418
+ scope: "session"
419
+ },
420
+ "shell.overlay": {
421
+ kind: "list",
422
+ scope: "root"
423
+ }
424
+ },
425
+ store: createLayoutStore,
426
+ inject: (actions) => {
427
+ layout.attachPanels(actions);
428
+ return {};
429
+ }
430
+ }, AppFrame);
431
+ return () => {
432
+ disposeRegistration();
433
+ disposeService();
434
+ };
435
+ }, "ui-layout: service + root registration");
436
+ ctx.effect(() => {
437
+ const presenter = new ThemePresenter();
438
+ presenter.apply(ctx.theme.getTheme());
439
+ const off = ctx.on("theme/change", (snapshot) => {
440
+ presenter.apply(snapshot);
441
+ });
442
+ return () => {
443
+ off();
444
+ presenter.dispose();
445
+ };
446
+ }, "ui-layout: theme presenter");
447
+ }
448
+ //#endregion
449
+ exports.LayoutController = LayoutController;
450
+ exports.apply = apply;
451
+ exports.inject = inject;
452
+ return module.exports;
453
+ }
454
+ });
455
+
456
+ //# sourceMappingURL=client.js.map