@twinsearth/dsh-fang 3.7.6 → 3.7.7

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,4 +1,4 @@
1
- [![CI](https://github.com/TwinsEarth/dsh-fang/actions/workflows/ci.yml/badge.svg)](https://github.com/TwinsEarth/dsh-fang/actions/workflows/ci.yml)
1
+ [![CI](https://github.com/TwinsEarth/fang-dsh-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/TwinsEarth/fang-dsh-plugin/actions/workflows/ci.yml)
2
2
  [![DSH](https://img.shields.io/badge/DSH-0.2.2--rc.1-4D6BFE?logo=deepseek&logoColor=white)](https://github.com/deepseek-ai/deepseek-harness)
3
3
  [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0-blue.svg)](LICENSE-CORE)
4
4
  [![SDK: MIT](https://img.shields.io/badge/SDK-MIT-green.svg)](LICENSE-SDK)
@@ -71,7 +71,7 @@
71
71
  ## 快速开始
72
72
 
73
73
  ```powershell
74
- git clone https://github.com/TwinsEarth/dsh-fang.git && cd dsh-fang
74
+ git clone https://github.com/TwinsEarth/fang-dsh-plugin.git && cd dsh-fang
75
75
 
76
76
  # 1. 离线自检(不修改任何东西)
77
77
  node tools/fangctl.mjs doctor
package/client.js CHANGED
@@ -2829,13 +2829,82 @@ html[data-fang-overlays="hidden"] .fang-console .toast{display:none!important}
2829
2829
  void loadEssenceDetail()
2830
2830
  }
2831
2831
 
2832
+ /**
2833
+ * Electron webview does not implement the native prompt(); using it makes
2834
+ * 导出/导入 look completely dead. Use an in-app dialog instead.
2835
+ */
2836
+ function vaultDialog({ title, label, defaultValue = '', withWorkspace = false }) {
2837
+ return new Promise((resolve) => {
2838
+ const overlay = document.createElement('div')
2839
+ overlay.style.cssText = 'position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;padding:20px'
2840
+ const box = document.createElement('div')
2841
+ box.style.cssText = 'width:min(560px,100%);background:var(--f-surface,#fff);color:var(--f-text,#111);border:1px solid var(--f-line,#d0d7de);border-radius:12px;padding:18px;box-shadow:0 18px 60px rgba(0,0,0,.25);font:14px/1.5 system-ui,sans-serif'
2842
+ const heading = document.createElement('div')
2843
+ heading.textContent = title
2844
+ heading.style.cssText = 'font-weight:700;font-size:16px;margin-bottom:12px'
2845
+ const hint = document.createElement('div')
2846
+ hint.textContent = label
2847
+ hint.style.cssText = 'font-size:12.5px;opacity:.8;margin-bottom:8px'
2848
+ const input = document.createElement('input')
2849
+ input.type = 'text'
2850
+ input.value = defaultValue
2851
+ input.placeholder = 'D:\\backup\\fang'
2852
+ input.style.cssText = 'width:100%;box-sizing:border-box;padding:9px 10px;border:1px solid var(--f-line,#d0d7de);border-radius:8px;background:transparent;color:inherit;font:inherit'
2853
+ const workspaceLine = document.createElement('label')
2854
+ workspaceLine.style.cssText = 'display:flex;gap:8px;align-items:flex-start;margin-top:12px;font-size:12.5px'
2855
+ const workspace = document.createElement('input')
2856
+ workspace.type = 'checkbox'
2857
+ workspace.checked = false
2858
+ const workspaceText = document.createElement('span')
2859
+ workspaceText.textContent = '同时打包工作区项目文件(默认不勾选;项目很大时会明显变慢)'
2860
+ workspaceLine.append(workspace, workspaceText)
2861
+ const actions = document.createElement('div')
2862
+ actions.style.cssText = 'display:flex;justify-content:flex-end;gap:8px;margin-top:16px'
2863
+ const cancel = document.createElement('button')
2864
+ cancel.type = 'button'
2865
+ cancel.textContent = '取消'
2866
+ cancel.style.cssText = 'padding:7px 14px;border:1px solid var(--f-line,#d0d7de);border-radius:7px;background:transparent;color:inherit;cursor:pointer'
2867
+ const ok = document.createElement('button')
2868
+ ok.type = 'button'
2869
+ ok.textContent = '确定'
2870
+ ok.style.cssText = 'padding:7px 14px;border:0;border-radius:7px;background:#2563eb;color:#fff;cursor:pointer'
2871
+ actions.append(cancel, ok)
2872
+ box.append(heading, hint, input)
2873
+ if (withWorkspace) box.append(workspaceLine)
2874
+ box.append(actions)
2875
+ overlay.append(box)
2876
+ const close = (value) => {
2877
+ overlay.remove()
2878
+ document.removeEventListener('keydown', onKey)
2879
+ resolve(value)
2880
+ }
2881
+ const onKey = (event) => {
2882
+ if (event.key === 'Escape') close(null)
2883
+ if (event.key === 'Enter' && document.activeElement === input) close({ value: input.value.trim(), workspace: workspace.checked })
2884
+ }
2885
+ cancel.addEventListener('click', () => close(null))
2886
+ ok.addEventListener('click', () => close({ value: input.value.trim(), workspace: workspace.checked }))
2887
+ overlay.addEventListener('click', (event) => { if (event.target === overlay) close(null) })
2888
+ document.addEventListener('keydown', onKey)
2889
+ document.body.appendChild(overlay)
2890
+ input.focus()
2891
+ input.select()
2892
+ })
2893
+ }
2894
+
2832
2895
  async function exportTask(task) {
2833
2896
  const taskId = String(task?.taskId ?? '')
2834
2897
  if (!taskId) return
2835
2898
  const fallback = localStorage.getItem('fang.exportDir') || ''
2836
- const destDir = window.prompt('导出到文件夹(绝对路径;不存在会自动创建)', fallback)
2837
- if (!destDir) return
2838
- const workspace = window.confirm('是否同时打包工作区项目文件?\n\n默认「取消」= 只导出会话/附件/配置/日志。\n项目很大时会明显变慢。')
2899
+ const answer = await vaultDialog({
2900
+ title: '导出分身',
2901
+ label: '导出到文件夹(绝对路径;不存在会自动创建)',
2902
+ defaultValue: fallback,
2903
+ withWorkspace: true,
2904
+ })
2905
+ if (!answer?.value) return
2906
+ const destDir = answer.value
2907
+ const workspace = answer.workspace === true
2839
2908
  localStorage.setItem('fang.exportDir', destDir)
2840
2909
  const result = await api('/fang/api/vault/export', { method: 'POST', body: JSON.stringify({ taskId, destDir, options: { workspace, workspaceSnapshot: workspace } }) })
2841
2910
  if (result.status === 200 && result.body?.ok) {
@@ -2846,8 +2915,13 @@ html[data-fang-overlays="hidden"] .fang-console .toast{display:none!important}
2846
2915
  }
2847
2916
 
2848
2917
  async function importTask() {
2849
- const sourceDir = window.prompt('选择分身导出包文件夹(包含 manifest.json 的那一层)', localStorage.getItem('fang.importDir') || '')
2850
- if (!sourceDir) return
2918
+ const answer = await vaultDialog({
2919
+ title: '导入分身',
2920
+ label: '选择导出包文件夹(包含 manifest.json 的那一层)',
2921
+ defaultValue: localStorage.getItem('fang.importDir') || '',
2922
+ })
2923
+ if (!answer?.value) return
2924
+ const sourceDir = answer.value
2851
2925
  localStorage.setItem('fang.importDir', sourceDir)
2852
2926
  const result = await api('/fang/api/vault/import', { method: 'POST', body: JSON.stringify({ sourceDir }) })
2853
2927
  if (result.status === 200 && result.body?.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twinsearth/dsh-fang",
3
- "version": "3.7.6",
3
+ "version": "3.7.7",
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.",
@@ -58,17 +58,17 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@twinsearth/dsh-fang-node-compat": "^0.1.0",
61
- "@twinsearth/fang-dsh-plugin": "3.7.6"
62
- },
63
- "publishConfig": {
64
- "access": "public"
61
+ "@twinsearth/fang-dsh-plugin": "3.7.7"
65
62
  },
66
63
  "repository": {
67
64
  "type": "git",
68
- "url": "git+https://github.com/TwinsEarth/dsh-fang.git"
65
+ "url": "git+https://github.com/TwinsEarth/fang-dsh-plugin.git"
69
66
  },
70
- "homepage": "https://github.com/TwinsEarth/dsh-fang#readme",
67
+ "homepage": "https://github.com/TwinsEarth/fang-dsh-plugin#readme",
71
68
  "bugs": {
72
- "url": "https://github.com/TwinsEarth/dsh-fang/issues"
69
+ "url": "https://github.com/TwinsEarth/fang-dsh-plugin/issues"
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
73
  }
74
74
  }
@@ -131,7 +131,7 @@ export const AUDIT = {
131
131
  RUNTIME_ERROR: 'runtime-error',
132
132
  }
133
133
 
134
- export const FANG_VERSION = '3.7.6'
134
+ export const FANG_VERSION = '3.7.7'
135
135
 
136
136
  /**
137
137
  * @typedef {object} ForkInfo