@suifei/dsh-ai-team 0.4.168 → 0.4.169

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.169 - 2026-12-05
4
+
5
+ - 浏览式工作目录选择器支持通过 DSH 宿主新建一个子目录并回填项目表单。同名或权限错误会保留目录名称,等待用户修改。感谢 @yuwanbushiwanzi 提出从项目表单直接新建目录的场景(#145)。
6
+
3
7
  ## 0.4.168 - 2026-12-04
4
8
 
5
9
  - 项目主对话支持 Enter 发送讨论、Shift+Enter 换行。中文输入法选字和 @成员选择优先处理,任务模式仍使用 Ctrl/⌘+Enter。发送按钮移到输入框左侧,避开宿主右下角悬浮层。感谢 @yuwanbushiwanzi 提供开工引导和桌宠遮挡的复现场景(#145)。
package/README.md CHANGED
@@ -54,6 +54,7 @@
54
54
 
55
55
  ## 最近更新
56
56
 
57
+ - **新建工作目录**(0.4.169)。在浏览式目录选择器中创建子目录后,路径直接回填当前项目表单。
57
58
  - **项目讨论发送**(0.4.168)。`Enter` 发送,`Shift+Enter` 换行。发送按钮移到输入框左侧的工具栏,避开右下角悬浮层。
58
59
  - **点击成员行打开会话**(0.4.167)。项目侧栏和团队管理页都可直接点击成员行,右侧「⋯」打开成员资料。
59
60
  - **待验收按本轮提交计时**(0.4.166)。更换负责人后,编制巡检仍按本轮提交时间计算等待时长,并据此判断是否需要补位。
@@ -276,7 +277,7 @@ dsh --profile web --no-open --port 33271
276
277
 
277
278
  第一次进入 Project 先设置 **工作目录**:工作目录编辑器会自动弹出,并预填宿主给出的建议值——配置项 `defaultWorkspace` → 当前进程目录 → **`~/works`**(Windows 为 `%USERPROFILE%\works`,Linux/macOS 为 `~/works`;不存在时自动创建)。点「选择目录」或用输入框改成任意已存在的目录即可;**新建项目必须填工作目录**(服务端强制,空目录会被 400 拒绝)。每个 Project 独立一个目录,成员只在这个目录里执行 Task。
278
279
 
279
- 「选择目录」会使用宿主的原生对话框或在文渊阁内浏览宿主目录。选定后先回填路径,保存或创建项目时生效。
280
+ 「选择目录」会使用宿主的原生对话框或在文渊阁内浏览宿主目录。浏览式选择器支持在当前目录下「新建目录」。选中或创建目录后,路径先回填表单,保存或创建项目时生效。
280
281
 
281
282
  ### 打开文渊阁后提示 503
282
283
 
package/client.js CHANGED
@@ -307,6 +307,11 @@ window.__ModuleLoader__.load({
307
307
  workspaceBrowseEmpty: '此目录没有子目录。',
308
308
  workspaceBrowseTruncated: '仅显示宿主返回的部分目录。',
309
309
  workspaceBrowseError: '未能读取目录。{message}',
310
+ workspaceNewFolder: '新建目录',
311
+ workspaceFolderName: '目录名称',
312
+ workspaceCreateFolder: '创建并使用',
313
+ workspaceCancelFolder: '取消新建',
314
+ workspaceCreateFolderError: '未能创建目录。{message}',
310
315
  workspaceSave: '保存目录',
311
316
  projectCreate: '创建项目',
312
317
  projectCreated: '已创建项目 {name}。',
@@ -825,6 +830,11 @@ window.__ModuleLoader__.load({
825
830
  workspaceBrowseEmpty: 'This directory has no subdirectories.',
826
831
  workspaceBrowseTruncated: 'Only some directories were returned by the host.',
827
832
  workspaceBrowseError: 'Could not read the directory. {message}',
833
+ workspaceNewFolder: 'New folder',
834
+ workspaceFolderName: 'Folder name',
835
+ workspaceCreateFolder: 'Create and use',
836
+ workspaceCancelFolder: 'Cancel creation',
837
+ workspaceCreateFolderError: 'Could not create the folder. {message}',
828
838
  workspaceSave: 'Save directory',
829
839
  projectCreate: 'Create project',
830
840
  projectCreated: 'Created project {name}.',
@@ -2127,11 +2137,18 @@ window.__ModuleLoader__.load({
2127
2137
  const [listing, setListing] = React.useState(null);
2128
2138
  const [error, setError] = React.useState('');
2129
2139
  const [loading, setLoading] = React.useState(true);
2140
+ const [folderName, setFolderName] = React.useState(null);
2141
+ const [folderError, setFolderError] = React.useState('');
2142
+ const [creating, setCreating] = React.useState(false);
2130
2143
  const closeButton = React.useRef(null);
2144
+ const pendingFolder = React.useRef(null);
2131
2145
  React.useEffect(() => {
2132
2146
  const previous = document.activeElement;
2133
2147
  closeButton.current?.focus({ preventScroll: true });
2134
- return () => previous?.focus?.({ preventScroll: true });
2148
+ return () => {
2149
+ pendingFolder.current = null;
2150
+ previous?.focus?.({ preventScroll: true });
2151
+ };
2135
2152
  }, []);
2136
2153
  React.useEffect(() => {
2137
2154
  const controller = new AbortController();
@@ -2152,24 +2169,61 @@ window.__ModuleLoader__.load({
2152
2169
  const browse = (path) => {
2153
2170
  setLoading(true);
2154
2171
  setError('');
2172
+ setFolderName(null);
2173
+ setFolderError('');
2155
2174
  setRequest({ path });
2156
2175
  };
2176
+ const canCreate = typeof service.createDirectory === 'function' && Boolean(listing?.path) && !loading && !error;
2177
+ const busy = loading || creating;
2178
+ const close = () => { if (!pendingFolder.current) onClose(); };
2179
+ const cancelFolder = () => {
2180
+ setFolderName(null);
2181
+ setFolderError('');
2182
+ };
2183
+ async function createFolder(event) {
2184
+ event.preventDefault();
2185
+ const name = folderName?.trim();
2186
+ if (!canCreate || !name || pendingFolder.current) return;
2187
+ const pending = {};
2188
+ pendingFolder.current = pending;
2189
+ setCreating(true);
2190
+ setFolderError('');
2191
+ try {
2192
+ const path = await service.createDirectory(listing.path, name);
2193
+ if (pendingFolder.current === pending) onPick(path);
2194
+ } catch (cause) {
2195
+ if (pendingFolder.current === pending) setFolderError(cause?.message ?? String(cause));
2196
+ } finally {
2197
+ if (pendingFolder.current === pending) {
2198
+ pendingFolder.current = null;
2199
+ setCreating(false);
2200
+ }
2201
+ }
2202
+ }
2157
2203
  const parentPath = listing?.crumbs?.at(-2)?.path;
2158
- return h(ModalBack, { onClose },
2204
+ return h(ModalBack, { onClose: close },
2159
2205
  h('div', { className: 'at-modal at-directory-picker', role: 'dialog', 'aria-modal': 'true', 'aria-label': t('workspaceBrowseTitle') },
2160
2206
  h('h2', { className: 'at-modaltitle' }, t('workspaceBrowseTitle')),
2161
2207
  h('div', { className: 'at-modalactions' },
2162
- h('button', { ref: closeButton, className: 'at-btn', type: 'button', onClick: onClose }, t('cancel')),
2163
- h('button', { className: 'at-btn at-btn-primary', type: 'button', disabled: loading || !listing?.path || Boolean(error), onClick: () => onPick(listing.path) }, t('workspaceBrowseChoose'))),
2208
+ h('button', { ref: closeButton, className: 'at-btn', type: 'button', disabled: creating, onClick: close }, t('cancel')),
2209
+ h('button', { className: 'at-btn at-btn-primary', type: 'button', disabled: busy || !listing?.path || Boolean(error), onClick: () => onPick(listing.path) }, t('workspaceBrowseChoose'))),
2164
2210
  h('div', { className: 'at-directory-nav' },
2165
- h('button', { className: 'at-btn', type: 'button', disabled: loading, onClick: () => browse(undefined) }, t('workspaceBrowseHome')),
2166
- h('button', { className: 'at-btn', type: 'button', disabled: loading || !parentPath, onClick: () => browse(parentPath) }, t('workspaceBrowseParent'))),
2211
+ h('button', { className: 'at-btn', type: 'button', disabled: busy, onClick: () => browse(undefined) }, t('workspaceBrowseHome')),
2212
+ h('button', { className: 'at-btn', type: 'button', disabled: busy || !parentPath, onClick: () => browse(parentPath) }, t('workspaceBrowseParent')),
2213
+ canCreate && folderName === null ? h('button', { className: 'at-btn', type: 'button', onClick: () => setFolderName('') }, t('workspaceNewFolder')) : null),
2167
2214
  listing?.path ? h('div', { className: 'at-modalmeta at-directory-path' }, listing.path) : null,
2168
2215
  loading ? h('div', { className: 'at-modalmeta', role: 'status' }, t('loading')) : null,
2169
2216
  error ? h('div', { className: 'at-modalerror at-directory-path', role: 'alert' }, tf(t, 'workspaceBrowseError', { message: error })) : null,
2217
+ canCreate && folderName !== null ? h('form', { className: 'at-field', onSubmit: createFolder, 'aria-busy': creating },
2218
+ h('label', { className: 'at-field' }, t('workspaceFolderName'),
2219
+ h('input', { autoFocus: true, value: folderName, disabled: creating, onChange: (event) => setFolderName(event.target.value) })),
2220
+ folderError ? h('div', { className: 'at-modalerror at-directory-path', role: 'alert' }, tf(t, 'workspaceCreateFolderError', { message: folderError })) : null,
2221
+ h('div', { className: 'at-modalactions' },
2222
+ h('button', { className: 'at-btn', type: 'button', disabled: creating, onClick: cancelFolder }, t('workspaceCancelFolder')),
2223
+ h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: creating || !folderName.trim() }, t('workspaceCreateFolder')))) : null,
2170
2224
  h('div', { className: 'at-directory-list', 'aria-busy': loading },
2171
2225
  (listing?.entries ?? []).map(({ name, path }) =>
2172
- h('button', { className: 'at-btn', key: path, title: name, type: 'button', disabled: loading, onClick: () => browse(path) }, name))),
2226
+ h('button', { className: 'at-btn', key: path, title: name, type: 'button', disabled: busy, onClick: () => browse(path) }, name))),
2173
2227
  !loading && !error && listing?.entries?.length === 0 ? h('p', { className: 'at-modalmeta' }, t('workspaceBrowseEmpty')) : null,
2174
2228
  listing?.truncated ? h('p', { className: 'at-modalmeta' }, t('workspaceBrowseTruncated')) : null));
2175
2229
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.168",
3
+ "version": "0.4.169",
4
4
  "type": "module",
5
5
  "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
6
  "license": "MIT",