@twinsearth/dsh-fang 3.0.9 → 3.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,26 @@
1
1
  [![CI](https://github.com/TwinsEarth/dsh-fang/actions/workflows/ci.yml/badge.svg)](https://github.com/TwinsEarth/dsh-fang/actions/workflows/ci.yml)
2
2
  [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0-blue.svg)](LICENSE-CORE)
3
3
  [![SDK: MIT](https://img.shields.io/badge/SDK-MIT-green.svg)](LICENSE-SDK)
4
- [![npm](https://img.shields.io/badge/npm-dsh--fang-red.svg)](https://www.npmjs.com/package/@twinsearth/dsh-fang)
4
+ [![npm latest](https://img.shields.io/npm/v/@twinsearth/dsh-fang.svg?label=npm&color=red)](https://www.npmjs.com/package/@twinsearth/dsh-fang)
5
5
 
6
6
  # 瓮城
7
7
 
8
8
  ## 让DSH不再需要反复重启客户端:
9
9
  加载、运行、更新、回滚、卸载、回收,全生命周期管理。
10
10
 
11
- ### 技术原理:DSH的第一台虚拟机!
11
+ ### 技术原理:DeepSeekHarness的第一台虚拟机!
12
12
 
13
13
  1.用dsh-Web,当瓮城完成风险阻隔&审批(Beta)
14
+
14
15
  2.DeepSeekHarness,当主城保存原样不变(稳定版)
15
16
 
16
- **母体大脑 + 分身器官 + 容器兜底**:一个只读母体,每个任务派生一个用完即弃的子 dsh-Web;
17
- 开发都在分身里,母体只在「提升」时被显式更新。崩溃不扩散、污染不残留、插件不串味。
17
+ **母体大脑 + 分身器官 + 容器兜底**:
18
+
19
+ 一个只读母体,每个任务派生一个用完即弃的子 dsh-Web;
20
+
21
+ 开发都在分身里,母体只在「提升」时被显式更新。
22
+
23
+ 崩溃不扩散、污染不残留、插件不串味。
18
24
 
19
25
  > v2.3.1 把「瓮城」做进 Web UI(左侧导航 + 3:7 分屏控制面板 + 双击派生 + 母体/分身会话继续开发);
20
26
  > v2.0.0 按三层拓扑重新部署,
package/client.js CHANGED
@@ -187,6 +187,20 @@ window.__ModuleLoader__.load({
187
187
  window.localStorage.setItem(key, value ? '1' : '0')
188
188
  } catch { /* 隐私模式:偏好只影响本次会话 */ }
189
189
  }
190
+ function readNumberPref(key, fallback) {
191
+ try {
192
+ if (typeof window === 'undefined' || !window.localStorage) return fallback
193
+ const raw = window.localStorage.getItem(key)
194
+ const n = Number(raw)
195
+ return raw !== null && Number.isFinite(n) ? n : fallback
196
+ } catch { return fallback }
197
+ }
198
+ function writeNumberPref(key, value) {
199
+ try {
200
+ if (typeof window === 'undefined' || !window.localStorage) return
201
+ window.localStorage.setItem(key, String(value))
202
+ } catch { /* 隐私模式 */ }
203
+ }
190
204
 
191
205
  // ── 标题降级:绝不把工作区名当会话标题 ────────────────────────────────
192
206
  function sessionTitleInfo(session) {
@@ -654,8 +668,14 @@ window.__ModuleLoader__.load({
654
668
  .chip--neutral{color:var(--f-text-3);background:var(--f-surface-2);border-color:var(--f-border)}
655
669
 
656
670
  /* layout */
657
- .fang-body{display:grid;grid-template-columns:minmax(320px,1fr) minmax(0,1fr);gap:16px;align-items:start;min-height:0;flex:1 1 auto}
658
- @media (max-width:1100px){.fang-body{grid-template-columns:1fr}}
671
+ .fang-body{position:relative;display:grid;grid-template-columns:minmax(320px,50fr) minmax(0,50fr);gap:16px;align-items:start;min-height:0;flex:1 1 auto}
672
+ .fang-body.is-resizing{cursor:col-resize;user-select:none}
673
+ .fang-body.is-resizing *{user-select:none}
674
+ .fang-split-handle{position:absolute;top:0;bottom:0;left:50%;width:10px;transform:translateX(-50%);cursor:col-resize;z-index:6;border-radius:6px;background:transparent;touch-action:none}
675
+ .fang-split-handle::after{content:"";position:absolute;top:50%;left:50%;width:3px;height:46px;transform:translate(-50%,-50%);border-radius:3px;background:var(--f-border-strong,var(--f-border));opacity:.55;transition:opacity .15s,background .15s}
676
+ .fang-split-handle:hover::after,.fang-split-handle:focus-visible::after,.fang-body.is-resizing .fang-split-handle::after{opacity:1;background:var(--f-blue,#3b82f6)}
677
+ .fang-split-handle:focus-visible{outline:2px solid var(--f-blue,#3b82f6);outline-offset:2px}
678
+ @media (max-width:1100px){.fang-body{grid-template-columns:1fr}.fang-split-handle{display:none}}
659
679
  .panel{background:var(--f-surface);border:1px solid var(--f-border);border-radius:var(--f-radius-panel);
660
680
  box-shadow:var(--f-shadow-card);display:flex;flex-direction:column;min-height:0;overflow:hidden;
661
681
  max-height:calc(100vh - 132px)}
@@ -923,8 +943,8 @@ window.__ModuleLoader__.load({
923
943
  .section-title{min-height:34px}
924
944
  }
925
945
  .btn--sm{min-height:34px}
926
- .expand-btn{width:34px;height:34px}
927
- .section-title{min-height:34px}
946
+ .expand-btn{width:34px;height:34px;min-width:34px}
947
+ .section-title{min-height:34px;min-width:34px}
928
948
  .fork-actions .btn,.fork-actions .text-action{min-height:34px}
929
949
  @media (prefers-reduced-motion:reduce){
930
950
  .fang-console *,.fang-console *::before,.fang-console *::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
@@ -1078,6 +1098,11 @@ window.__ModuleLoader__.load({
1078
1098
  expanded: new Set(),
1079
1099
  collapsed: new Set(['temporary']),
1080
1100
  collapsedTasks: new Set(),
1101
+ // 主工作区比例:元宝工作区 / 分身工作区,默认 50:50,可拖动中间手柄调整。
1102
+ splitRatio: (() => {
1103
+ const n = readNumberPref('fang.panel.split', 0.5)
1104
+ return Math.min(0.75, Math.max(0.25, Number.isFinite(n) ? n : 0.5))
1105
+ })(),
1081
1106
  showTemporary: readPref('fang.panel.showTemporary', true),
1082
1107
  // 母体会话只读投影:默认只看最近 20 条,可切 50 / 全部(偏好存本机)。
1083
1108
  sessionWindow: (() => {
@@ -3716,9 +3741,63 @@ window.__ModuleLoader__.load({
3716
3741
  for (const node of renderNotices(S, app)) frag.append(node)
3717
3742
 
3718
3743
  if (S.role.value === 'mother') {
3719
- frag.append(h('div', { class: 'fang-body', 'aria-busy': S.refreshing ? 'true' : undefined },
3720
- renderMotherPanel(S, app),
3721
- renderForkPanel(S, app)))
3744
+ const body = h('div', { class: 'fang-body', 'aria-busy': S.refreshing ? 'true' : undefined })
3745
+ body.append(renderMotherPanel(S, app), renderForkPanel(S, app))
3746
+ // 中间拖动手柄:默认 50:50,可拖动/键盘方向键调整,双击恢复 50:50(偏好存本机)。
3747
+ const handle = h('div', {
3748
+ class: 'fang-split-handle',
3749
+ role: 'separator',
3750
+ 'aria-orientation': 'vertical',
3751
+ 'aria-label': '调整元宝工作区与分身工作区比例',
3752
+ 'aria-valuemin': '25',
3753
+ 'aria-valuemax': '75',
3754
+ tabindex: '0',
3755
+ title: '拖动调整比例;双击恢复 50:50',
3756
+ })
3757
+ const applyRatio = (ratio, persist = false) => {
3758
+ const clamped = Math.min(0.75, Math.max(0.25, Number.isFinite(ratio) ? ratio : 0.5))
3759
+ S.splitRatio = clamped
3760
+ const left = (clamped * 100).toFixed(2)
3761
+ const right = ((1 - clamped) * 100).toFixed(2)
3762
+ // fr 会先扣除 gap 再按比例分配,避免 50% + gap 溢出。
3763
+ body.style.gridTemplateColumns = `minmax(320px, ${left}fr) minmax(0, ${right}fr)`
3764
+ handle.style.left = left + '%'
3765
+ handle.setAttribute('aria-valuenow', String(Math.round(clamped * 100)))
3766
+ if (persist) writeNumberPref('fang.panel.split', clamped)
3767
+ }
3768
+ applyRatio(S.splitRatio)
3769
+ const onMove = (event) => {
3770
+ const x = event.touches ? event.touches[0]?.clientX : event.clientX
3771
+ if (typeof x !== 'number') return
3772
+ const rect = body.getBoundingClientRect()
3773
+ if (rect.width > 0) applyRatio((x - rect.left) / rect.width)
3774
+ }
3775
+ const stop = () => {
3776
+ body.classList.remove('is-resizing')
3777
+ document.removeEventListener('mousemove', onMove)
3778
+ document.removeEventListener('touchmove', onMove)
3779
+ document.removeEventListener('mouseup', stop)
3780
+ document.removeEventListener('touchend', stop)
3781
+ writeNumberPref('fang.panel.split', S.splitRatio)
3782
+ }
3783
+ const start = (event) => {
3784
+ event.preventDefault()
3785
+ body.classList.add('is-resizing')
3786
+ document.addEventListener('mousemove', onMove)
3787
+ document.addEventListener('touchmove', onMove, { passive: false })
3788
+ document.addEventListener('mouseup', stop, { once: true })
3789
+ document.addEventListener('touchend', stop, { once: true })
3790
+ }
3791
+ handle.addEventListener('mousedown', start)
3792
+ handle.addEventListener('touchstart', start, { passive: false })
3793
+ handle.addEventListener('dblclick', () => applyRatio(0.5, true))
3794
+ handle.addEventListener('keydown', (event) => {
3795
+ if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return
3796
+ event.preventDefault()
3797
+ applyRatio(S.splitRatio + (event.key === 'ArrowLeft' ? -0.02 : 0.02), true)
3798
+ })
3799
+ body.append(handle)
3800
+ frag.append(body)
3722
3801
  frag.append(renderFooter(S, app))
3723
3802
  } else if (S.role.value === 'fork') {
3724
3803
  frag.append(renderHostNotice(S, app))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twinsearth/dsh-fang",
3
- "version": "3.0.9",
3
+ "version": "3.0.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "dsh-Fang (瓮城) — mother/fork plugin development environment for DeepSeek Harness: one readonly mother, a disposable child dsh-Web per task.",
@@ -33,6 +33,11 @@
33
33
  "dsh": {
34
34
  "bundle": {
35
35
  "patch": "./cordis.patch.yml"
36
+ },
37
+ "client": {
38
+ "platform": "web",
39
+ "immediately": true,
40
+ "inject": []
36
41
  }
37
42
  },
38
43
  "scripts": {
@@ -125,7 +125,7 @@ export const AUDIT = {
125
125
  RUNTIME_ERROR: 'runtime-error',
126
126
  }
127
127
 
128
- export const FANG_VERSION = '3.0.9'
128
+ export const FANG_VERSION = '3.0.10'
129
129
 
130
130
  /**
131
131
  * @typedef {object} ForkInfo