nx-kv 0.34.0 → 0.35.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.
- package/CHANGELOG.md +60 -0
- package/package.json +1 -1
- package/src/modules/localtask/repo/rows.js +2 -0
- package/src/modules/localtask/repo/tasks.js +4 -2
- package/src/modules/localtask/task-lifecycle.js +21 -8
- package/src/modules/localtask/task-view.js +2 -0
- package/src/shared/feedback-text.js +118 -0
- package/src/web/frontend/components/md/ack-rail.jsx +14 -4
- package/src/web/frontend/components/md/md-panes.jsx +10 -3
- package/src/web/frontend/components/repos/get-loop-modal.jsx +181 -0
- package/src/web/frontend/components/tool-acts/layout-panel.jsx +1 -1
- package/src/web/frontend/components/tool-acts/modules.js +25 -0
- package/src/web/frontend/modules/board/ack-nodes.js +49 -1
- package/src/web/frontend/modules/board/reopen-text.js +32 -19
- package/src/web/frontend/modules/md/md-parse.js +41 -3
- package/src/web/frontend/modules/md/style.css +29 -8
- package/src/web/frontend/page/dag/index.jsx +104 -17
- package/src/web/frontend/page/dir/landing.jsx +3 -1
- package/src/web/frontend/page/dir/task.jsx +40 -3
- package/src/web/frontend/page/repos/index.jsx +90 -25
- package/src/web/frontend/page/settings/index.jsx +5 -368
- package/src/web/frontend/page/settings/style.css +4 -147
- package/src/web/frontend/style-v2.css +65 -0
- package/src/web/public/assets/{Introduction-DU27b_b_.js → Introduction-DO6_gTk-.js} +1 -1
- package/src/web/public/assets/{bar-CNuQf706.js → bar-DoiwB4eA.js} +1 -1
- package/src/web/public/assets/button-M9TUn-AR.js +1 -0
- package/src/web/public/assets/{cloud-DgNCxJsL.js → cloud-DSu1a2Dn.js} +1 -1
- package/src/web/public/assets/{composer-launch-BKeKTPp4.js → composer-launch-D-b7HKk5.js} +1 -1
- package/src/web/public/assets/{composer-panel-DP322mVs.js → composer-panel-CJuaj0Jp.js} +1 -1
- package/src/web/public/assets/dag-_5FWJlq5.js +1 -0
- package/src/web/public/assets/{dir-Cipgyv3a.js → dir-GUpDi0kq.js} +1 -1
- package/src/web/public/assets/{group-m61-WL4C.js → group-BzC_R2k-.js} +1 -1
- package/src/web/public/assets/{index-CeIJd4ee.js → index-B_HPAoNR.js} +3 -3
- package/src/web/public/assets/{index-BEkITE6q.css → index-CZBR0CbL.css} +1 -1
- package/src/web/public/assets/{md-panes-PS7K93Lg.js → md-panes-BvQXV_C9.js} +2 -2
- package/src/web/public/assets/{md-parse-DN9INgZn.js → md-parse-C2bDc3IZ.js} +1 -1
- package/src/web/public/assets/{overview-BmoTQJuu.js → overview-sLaedHVZ.js} +1 -1
- package/src/web/public/assets/{progress-CWy9bYKr.js → progress-DOI2YFEi.js} +1 -1
- package/src/web/public/assets/{refs-DAy1kYGf.js → refs-D97SxNRW.js} +1 -1
- package/src/web/public/assets/reopen-text-BylkngqC.js +12 -0
- package/src/web/public/assets/repos-ZPiaK93i.css +1 -0
- package/src/web/public/assets/repos-fp0D_GDq.js +10 -0
- package/src/web/public/assets/{route-crumb-lOriqwxP.js → route-crumb-C5LPu1Qx.js} +1 -1
- package/src/web/public/assets/settings-BBKNCMHm.css +1 -0
- package/src/web/public/assets/settings-D13mfwe0.js +6 -0
- package/src/web/public/assets/{status-tag-DGlwjAg2.js → status-tag-D4wxIj1q.js} +1 -1
- package/src/web/public/assets/task-Cu-rh5jA.js +11 -0
- package/src/web/public/assets/{templates-D900RS5b.js → templates-xbR-qZMs.js} +1 -1
- package/src/web/public/assets/tool-bar-CHoZSF6T.js +1 -0
- package/src/web/public/index.html +3 -3
- package/src/web/public/assets/button-BPYMY-zh.js +0 -1
- package/src/web/public/assets/dag-C4702bOt.js +0 -1
- package/src/web/public/assets/reopen-text-DIFfS71D.js +0 -6
- package/src/web/public/assets/repos-D_NT51Dq.js +0 -9
- package/src/web/public/assets/settings-CBrQ3Iz5.css +0 -1
- package/src/web/public/assets/settings-Vp3ZMC1M.js +0 -7
- package/src/web/public/assets/task-CRpctHxx.js +0 -9
- package/src/web/public/assets/tool-bar-C-rnP0vv.js +0 -1
|
@@ -22,15 +22,17 @@ import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
|
22
22
|
import { useDialog, Modal } from '../../components/popup/index.jsx';
|
|
23
23
|
import MemberPicker from '../../components/board/member-picker.jsx';
|
|
24
24
|
import TransferPanel from '../../components/repos/transfer-panel.jsx';
|
|
25
|
+
import GetLoopModal from '../../components/repos/get-loop-modal.jsx';
|
|
25
26
|
import DocsModal from '../../components/Introduction/docs-modal.jsx';
|
|
27
|
+
import ToolActsBar from '../../components/tool-acts/bar.jsx';
|
|
26
28
|
import { useApp } from '../../app-context.jsx';
|
|
27
29
|
import { useWikiNav } from '../doc/index.jsx';
|
|
28
|
-
import { Button
|
|
30
|
+
import { Button } from '../../components/button/index.jsx';
|
|
29
31
|
// key 归一化与后端共用同一份纯函数(shared/repo-key.js 无 Node 依赖,可直接进前端包),
|
|
30
32
|
// 避免面板里显示/自动填充的 key 和后端登记时算出来的 key 不一致。
|
|
31
33
|
import { keyFromRemote, normalizeKey } from '../../../../shared/repo-key.js';
|
|
32
34
|
|
|
33
|
-
const EMPTY_FORM = { path: '', name: '', desc: '', notes: '', type: 'dev', remote: '', key: '' };
|
|
35
|
+
const EMPTY_FORM = { path: '', name: '', desc: '', notes: '', type: 'dev', remote: '', key: '', icon: '' };
|
|
34
36
|
|
|
35
37
|
// 路径照搬目录看板的「可扫标签」画法:祖先目录变暗、末段略重,点击复制全文。
|
|
36
38
|
// 纯灰一长串(旧画法)里,人眼要逐字符对比才能找到目录名。
|
|
@@ -83,6 +85,14 @@ function RepoRow({ r, filterBoard, refsOfRepo, acts }) {
|
|
|
83
85
|
<strong>
|
|
84
86
|
{r.icon ? <span className="rp-icon" aria-hidden>{r.icon}</span> : null}
|
|
85
87
|
{r.name}
|
|
88
|
+
{/* #145:持续 get 已开启 → 行名绿点(一眼可见;配置在行内「更多 → 持续 get」) */}
|
|
89
|
+
{r.getLoop && r.getLoop.enabled ? (
|
|
90
|
+
<span
|
|
91
|
+
className="rp-gl-dot"
|
|
92
|
+
title={`持续 get 已开启(${Number(r.getLoop.waitMinutes) || 10} 分钟阻塞窗口)`}
|
|
93
|
+
aria-label="持续 get 已开启"
|
|
94
|
+
/>
|
|
95
|
+
) : null}
|
|
86
96
|
</strong>
|
|
87
97
|
<span className="mono rp-name-path"><RepoPath path={r.path} /></span>
|
|
88
98
|
</td>
|
|
@@ -113,16 +123,38 @@ function RepoRow({ r, filterBoard, refsOfRepo, acts }) {
|
|
|
113
123
|
)) : <span className="muted rp-refs-none">—</span>}
|
|
114
124
|
</td>
|
|
115
125
|
<td className="rp-acts">
|
|
116
|
-
{/* #
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
126
|
+
{/* #148:行内动作编排化(kind=repos-row,同一套工具区组件)——默认与旧版
|
|
127
|
+
同构(编辑/打开/删除上栏,更多收纳 持续 get/对齐 remote);每个动作都
|
|
128
|
+
可在「更多 → 自定义工具栏…」里调顺序 / 上栏 / 收纳。 */}
|
|
129
|
+
<ToolActsBar
|
|
130
|
+
kind="repos-row"
|
|
131
|
+
renderers={{
|
|
132
|
+
edit: () => <Button small onClick={() => acts.edit(r)}>编辑</Button>,
|
|
133
|
+
open: () => <Button small title="在文件管理器中打开" onClick={() => acts.open(r)}>打开</Button>,
|
|
134
|
+
del: () => <Button small danger onClick={() => acts.del(r)}>删除</Button>,
|
|
135
|
+
getloop: () => (
|
|
136
|
+
<Button small title="持续 get(waitgoal)配置" onClick={() => acts.getloop(r)}>
|
|
137
|
+
<span className="rp-gl-menu-it">
|
|
138
|
+
{r.getLoop && r.getLoop.enabled ? <span className="rp-gl-dot" aria-hidden /> : null}
|
|
139
|
+
持续 get…
|
|
140
|
+
</span>
|
|
141
|
+
</Button>
|
|
142
|
+
),
|
|
143
|
+
remote: () => <Button small onClick={() => acts.remote(r)}>对齐 remote</Button>,
|
|
144
|
+
}}
|
|
145
|
+
actions={{
|
|
146
|
+
edit: () => acts.edit(r),
|
|
147
|
+
open: () => acts.open(r),
|
|
148
|
+
del: () => acts.del(r),
|
|
149
|
+
getloop: () => acts.getloop(r),
|
|
150
|
+
remote: () => acts.remote(r),
|
|
151
|
+
}}
|
|
152
|
+
titles={{
|
|
153
|
+
getloop: '持续 get(waitgoal)配置',
|
|
154
|
+
remote: 'key 与远程 git 地址对齐',
|
|
155
|
+
del: '删除仓库登记(磁盘文件不受影响)',
|
|
156
|
+
}}
|
|
124
157
|
/>
|
|
125
|
-
<Button small danger onClick={() => acts.del(r)}>删除</Button>
|
|
126
158
|
</td>
|
|
127
159
|
</tr>
|
|
128
160
|
);
|
|
@@ -203,6 +235,8 @@ export default function ReposView() {
|
|
|
203
235
|
const [remoteOpen, setRemoteOpen] = useState(false); // 对齐 remote 的弹窗
|
|
204
236
|
// 查看详情(文档集弹窗):{ kind:'repo', owner } —— 行内「查看详情」入口
|
|
205
237
|
const [docsFor, setDocsFor] = useState(null);
|
|
238
|
+
// 持续 get 配置弹窗(#145):设置页「项目级设置」删除后,配置落到行内「更多」
|
|
239
|
+
const [glFor, setGlFor] = useState(null);
|
|
206
240
|
|
|
207
241
|
const resetForm = () => { setForm(EMPTY_FORM); setEditing(null); setFormOpen(false); setKeyManual(false); };
|
|
208
242
|
|
|
@@ -640,6 +674,9 @@ export default function ReposView() {
|
|
|
640
674
|
notes: form.notes,
|
|
641
675
|
type: form.type === 'ref' ? 'ref' : 'dev',
|
|
642
676
|
remote: remote || undefined,
|
|
677
|
+
// 图标(emoji / 单字符;清空 = 回默认文件夹图标)——原设置页「项目级设置」
|
|
678
|
+
// 的编辑入口(#145 删除该 tab)迁到这里
|
|
679
|
+
icon: form.icon.trim(),
|
|
643
680
|
};
|
|
644
681
|
if (editing) {
|
|
645
682
|
const r = repos.find((x) => x.id === editing);
|
|
@@ -687,6 +724,7 @@ export default function ReposView() {
|
|
|
687
724
|
remote: r.remote || '',
|
|
688
725
|
notes: r.notes || '',
|
|
689
726
|
key: r.key || '',
|
|
727
|
+
icon: r.icon || '',
|
|
690
728
|
});
|
|
691
729
|
// 自定义 key 打开即视为「用户声明过」,编辑远程地址时不自动覆盖它;
|
|
692
730
|
// 非自定义 key 仍跟着远程地址走(和编辑前行为一致)。
|
|
@@ -913,6 +951,8 @@ export default function ReposView() {
|
|
|
913
951
|
edit: (r) => rowAct('edit', r),
|
|
914
952
|
del: (r) => rowAct('del', r),
|
|
915
953
|
remote: (r) => openRemote(r),
|
|
954
|
+
// 持续 get(waitgoal)配置弹窗(#145):保存后刷行数据(绿点/菜单态跟着变)
|
|
955
|
+
getloop: (r) => setGlFor(r),
|
|
916
956
|
// 查看详情:完整文档集弹窗(主篇 / 补充 / reference / 组内,就地编辑)
|
|
917
957
|
// onChanged 回灌仓库与文档两份数据(descDocs 摘要与文档检索都靠它们)
|
|
918
958
|
docs: (r) => setDocsFor({ kind: 'repo', owner: r }),
|
|
@@ -953,15 +993,23 @@ export default function ReposView() {
|
|
|
953
993
|
<h2>仓库管理</h2>
|
|
954
994
|
</div>
|
|
955
995
|
<div className="acts">
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
996
|
+
{/* #145:头部动作编排化(复用 #139/#143 工具区组件)——登记仓库固定主位,
|
|
997
|
+
分组 / 参考仓库 / 导入导出可在「更多 → 自定义工具栏…」里调顺序与显隐。 */}
|
|
998
|
+
<ToolActsBar
|
|
999
|
+
kind="repos"
|
|
1000
|
+
titles={{
|
|
1001
|
+
add: '登记本机开发仓库',
|
|
1002
|
+
boards: '分组管理:建组 / 成员 / 组介绍文档',
|
|
1003
|
+
refs: '参考仓库面板:克隆 / 绑定 / 同步 / 检查 / 存储根',
|
|
1004
|
+
transfer: '布局与仓库的导入导出(逐条选择 / 冲突方案 / 差异检查)',
|
|
1005
|
+
}}
|
|
1006
|
+
actions={{
|
|
1007
|
+
add: openAdd,
|
|
1008
|
+
boards: () => setBoardAdminOpen(true),
|
|
1009
|
+
refs: () => setRefOpen(true),
|
|
1010
|
+
transfer: () => setTransferOpen(true),
|
|
1011
|
+
}}
|
|
1012
|
+
/>
|
|
965
1013
|
</div>
|
|
966
1014
|
</div>
|
|
967
1015
|
|
|
@@ -1224,14 +1272,16 @@ export default function ReposView() {
|
|
|
1224
1272
|
<table className="rp-table">
|
|
1225
1273
|
<thead>
|
|
1226
1274
|
<tr>
|
|
1227
|
-
|
|
1228
|
-
|
|
1275
|
+
{/* #152:列宽重排——行内动作变宽后操作列被挤成两行,宽度让给其他列:
|
|
1276
|
+
仓库/文档/参考仓库/分组收窄,操作列给到一行放得下的 250px。 */}
|
|
1277
|
+
<th scope="col" style={{ width: '17%' }}>仓库</th>
|
|
1278
|
+
<th scope="col" style={{ width: '24%' }}>
|
|
1229
1279
|
文档
|
|
1230
1280
|
<span className="rp-th-hint">主篇摘要 · 查看详情打开完整文档列表</span>
|
|
1231
1281
|
</th>
|
|
1232
|
-
<th scope="col" style={{ width: '
|
|
1233
|
-
<th scope="col" style={{ width: '
|
|
1234
|
-
<th scope="col" style={{ width: '
|
|
1282
|
+
<th scope="col" style={{ width: '15%' }}>参考仓库</th>
|
|
1283
|
+
<th scope="col" style={{ width: '12%' }}>分组</th>
|
|
1284
|
+
<th scope="col" style={{ width: '250px' }}>操作</th>
|
|
1235
1285
|
</tr>
|
|
1236
1286
|
</thead>
|
|
1237
1287
|
<tbody>
|
|
@@ -1421,6 +1471,11 @@ export default function ReposView() {
|
|
|
1421
1471
|
<label htmlFor="repo-name">名称</label>
|
|
1422
1472
|
<input id="repo-name" placeholder="留空则用目录末段" value={form.name} onChange={set('name')} />
|
|
1423
1473
|
</div>
|
|
1474
|
+
<div className="form-field">
|
|
1475
|
+
<label htmlFor="repo-icon">图标</label>
|
|
1476
|
+
<input id="repo-icon" maxLength={8} placeholder="emoji 或单字符(留空 = 默认文件夹图标)"
|
|
1477
|
+
value={form.icon} onChange={set('icon')} />
|
|
1478
|
+
</div>
|
|
1424
1479
|
{/* 描述不是一段字符串,是绑定的文档:这里只显示主篇(点开即编辑),
|
|
1425
1480
|
补充篇在文档页里管理。新建时还没有文档,等落地后从行内点进去写。 */}
|
|
1426
1481
|
{editingDocs ? (
|
|
@@ -1767,6 +1822,16 @@ export default function ReposView() {
|
|
|
1767
1822
|
/>
|
|
1768
1823
|
) : null}
|
|
1769
1824
|
|
|
1825
|
+
{/* 持续 get(waitgoal)配置弹窗(#145):行内「更多 → 持续 get…」;
|
|
1826
|
+
保存后刷本页仓库数据(行名绿点 / 菜单态跟着变) */}
|
|
1827
|
+
{glFor ? (
|
|
1828
|
+
<GetLoopModal
|
|
1829
|
+
repo={repos.find((x) => x.id === glFor.id) || glFor}
|
|
1830
|
+
onClose={() => setGlFor(null)}
|
|
1831
|
+
onSaved={loadRepos}
|
|
1832
|
+
/>
|
|
1833
|
+
) : null}
|
|
1834
|
+
|
|
1770
1835
|
{/* 对齐 remote:key 是本地身份,remote 是协作的标准单位。
|
|
1771
1836
|
候选来自 git remote -v,当前采纳的打勾;点另一条即对齐过去。 */}
|
|
1772
1837
|
{remoteOpen && remoteInfo ? (
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
// - 模板分两块(不混在一起):任务模板(任务正文骨架,纯字符串槽位)与
|
|
15
15
|
// 提示词模板(每区块各自的模板列表 / 启用项;编辑区下方给只读参数速查,语法教程只在 skill / docs)
|
|
16
16
|
// - 任务工具:timegoal / waitgoal 的用法口径(时长在发布/编辑任务时显式给——CLI --duration 或编辑页「时间目标」栏,无全局默认)
|
|
17
|
-
//
|
|
17
|
+
// (#145:「项目级设置」整 tab 删除——介绍/图标/持续 get 都与仓库管理页重复,
|
|
18
|
+
// 现统一在 repos 页:行内「更多 → 持续 get」modal、编辑表单图标、查看详情文档集。)
|
|
19
|
+
// (#150:「任务工具」tab 删除——正文早已不在 bodies 里,点开只剩空白标题页。)
|
|
18
20
|
import { useCallback, useEffect, useState } from 'react';
|
|
19
21
|
import { api } from '../../api/client.js';
|
|
20
22
|
import { useApp } from '../../app-context.jsx';
|
|
@@ -22,22 +24,12 @@ import { useToast } from '../../components/toast/index.jsx';
|
|
|
22
24
|
import { useDialog } from '../../components/popup/index.jsx';
|
|
23
25
|
import { Icon } from '../../components/icons.jsx';
|
|
24
26
|
import { Button } from '../../components/button/index.jsx';
|
|
25
|
-
import { PromptItemsEditor } from '../../modules/prompts/prompt-editor.jsx';
|
|
26
27
|
import PromptTemplatesSection from './prompt-templates-section.jsx';
|
|
27
28
|
import TaskTemplatesSection from './task-templates-section.jsx';
|
|
28
29
|
import SidebarSection from './sidebar-section.jsx';
|
|
29
30
|
import { openTemplateEditor } from '../../panels.jsx';
|
|
30
|
-
import { openPanel } from '../../workspace.js';
|
|
31
31
|
import './style.css';
|
|
32
32
|
|
|
33
|
-
// 多条提示词的条数上限(与服务端 clampAckPromptList 一致)
|
|
34
|
-
const MAX_PROMPT_ITEMS = 10;
|
|
35
|
-
|
|
36
|
-
// 内置「持续 get」默认模板的预设文案(与服务端 waitgoal-config 默认同文案;%s = 任务编号,
|
|
37
|
-
// 存取时与 {{task.id}} 互转——见 GetLoopEditor)。服务端常量带 core 依赖,前端本地声明。
|
|
38
|
-
const GETLOOP_DEFAULT_PRESET =
|
|
39
|
-
'不要直接结束本轮:完成上面的任务(%s)之后,继续调用 nx-kv localtask get(带 --summary 当前现状)领取下一条任务,直到 get 返回 timeout 为止。';
|
|
40
|
-
|
|
41
33
|
// 分区清单 = 左侧导航 = tab
|
|
42
34
|
const SECTIONS = [
|
|
43
35
|
{ id: 'pref', label: '偏好', icon: 'flow' },
|
|
@@ -46,313 +38,8 @@ const SECTIONS = [
|
|
|
46
38
|
{ id: 'taskTemplates', label: '任务模板', icon: 'list' },
|
|
47
39
|
{ id: 'prompts', label: '提示词模板', icon: 'flow' },
|
|
48
40
|
{ id: 'sidebar', label: '侧栏显示', icon: 'sidebar' },
|
|
49
|
-
{ id: 'template', label: '任务工具', icon: 'clock' },
|
|
50
|
-
{ id: 'project', label: '项目级设置', icon: 'repo' },
|
|
51
41
|
];
|
|
52
42
|
|
|
53
|
-
/**
|
|
54
|
-
* 单张项目卡:icon 在标题左侧;点开后编辑条走文档流(头下方整宽),
|
|
55
|
-
* 不被设置面板 overflow 裁切。
|
|
56
|
-
*/
|
|
57
|
-
function ProjectCard({ repo, docStateOf, openDoc, bindExternal, unbind }) {
|
|
58
|
-
const app = useApp() || {};
|
|
59
|
-
const toast = useToast();
|
|
60
|
-
const [iconValue, setIconValue] = useState(repo.icon || '');
|
|
61
|
-
const [iconOpen, setIconOpen] = useState(false);
|
|
62
|
-
const [iconBusy, setIconBusy] = useState(false);
|
|
63
|
-
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
setIconValue(repo.icon || '');
|
|
66
|
-
}, [repo.icon]);
|
|
67
|
-
|
|
68
|
-
const saveIcon = async (next) => {
|
|
69
|
-
const icon = String(next ?? iconValue).trim();
|
|
70
|
-
if (icon === String(repo.icon || '').trim()) {
|
|
71
|
-
setIconOpen(false);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
setIconBusy(true);
|
|
75
|
-
try {
|
|
76
|
-
await api('/api/repos/' + encodeURIComponent(repo.id), { method: 'PATCH', body: { icon } });
|
|
77
|
-
setIconValue(icon);
|
|
78
|
-
toast(icon ? `已保存「${repo.name}」的图标` : `已清除「${repo.name}」的图标`);
|
|
79
|
-
app.refreshRepos && app.refreshRepos();
|
|
80
|
-
setIconOpen(false);
|
|
81
|
-
} catch (e) {
|
|
82
|
-
toast(String(e.message || e));
|
|
83
|
-
} finally {
|
|
84
|
-
setIconBusy(false);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const st = docStateOf(repo);
|
|
89
|
-
const loopOn = !!(repo.getLoop && repo.getLoop.enabled);
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<div className="setp-proj">
|
|
93
|
-
<div className="setp-proj-head">
|
|
94
|
-
<div className={'setp-icon' + (iconOpen ? ' open' : '')}>
|
|
95
|
-
<button
|
|
96
|
-
type="button"
|
|
97
|
-
className="setp-icon-btn"
|
|
98
|
-
title={iconValue ? `项目图标:${iconValue}(点击修改)` : '设置项目图标(emoji / 单字符)'}
|
|
99
|
-
aria-label="项目图标"
|
|
100
|
-
aria-expanded={iconOpen}
|
|
101
|
-
onClick={() => setIconOpen((o) => !o)}
|
|
102
|
-
>
|
|
103
|
-
{iconValue
|
|
104
|
-
? <span className="setp-icon-glyph" aria-hidden>{iconValue}</span>
|
|
105
|
-
: <Icon name="folder" size={14} />}
|
|
106
|
-
</button>
|
|
107
|
-
</div>
|
|
108
|
-
<div className="setp-proj-meta">
|
|
109
|
-
<div className="setp-proj-t">
|
|
110
|
-
<b>{repo.name}</b>
|
|
111
|
-
<span className={'setp-badge ' + st.kind}>
|
|
112
|
-
{st.kind === 'external' ? '外部' : st.kind === 'own' ? '自有' : '约定'}
|
|
113
|
-
</span>
|
|
114
|
-
{loopOn && <span className="setp-badge loop">持续 get</span>}
|
|
115
|
-
</div>
|
|
116
|
-
<div className="setp-proj-p mono" title={st.label}>{st.label}</div>
|
|
117
|
-
</div>
|
|
118
|
-
<div className="setp-proj-actions">
|
|
119
|
-
<Button variant="secondary" onClick={() => openDoc(repo)}>介绍</Button>
|
|
120
|
-
<Button variant="secondary" onClick={() => bindExternal(repo)}>绑定…</Button>
|
|
121
|
-
{repo.doc ? <Button variant="secondary" onClick={() => unbind(repo)}>解绑</Button> : null}
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
{iconOpen && (
|
|
125
|
-
<div className="setp-icon-edit" role="group" aria-label="编辑项目图标">
|
|
126
|
-
<input
|
|
127
|
-
autoFocus
|
|
128
|
-
value={iconValue}
|
|
129
|
-
maxLength={8}
|
|
130
|
-
placeholder="emoji 或单字符"
|
|
131
|
-
onChange={(e) => setIconValue(e.target.value)}
|
|
132
|
-
onKeyDown={(e) => {
|
|
133
|
-
if (e.key === 'Enter') { e.preventDefault(); saveIcon(iconValue); }
|
|
134
|
-
if (e.key === 'Escape') {
|
|
135
|
-
e.preventDefault();
|
|
136
|
-
setIconValue(repo.icon || '');
|
|
137
|
-
setIconOpen(false);
|
|
138
|
-
}
|
|
139
|
-
}}
|
|
140
|
-
disabled={iconBusy}
|
|
141
|
-
/>
|
|
142
|
-
<Button variant="primary" disabled={iconBusy} onClick={() => saveIcon(iconValue)}>保存</Button>
|
|
143
|
-
<Button
|
|
144
|
-
variant="secondary"
|
|
145
|
-
disabled={iconBusy || !iconValue}
|
|
146
|
-
title="清空,侧栏回退默认文件夹图标"
|
|
147
|
-
onClick={() => saveIcon('')}
|
|
148
|
-
>
|
|
149
|
-
清除
|
|
150
|
-
</Button>
|
|
151
|
-
<Button
|
|
152
|
-
variant="secondary"
|
|
153
|
-
disabled={iconBusy}
|
|
154
|
-
onClick={() => { setIconValue(repo.icon || ''); setIconOpen(false); }}
|
|
155
|
-
>
|
|
156
|
-
取消
|
|
157
|
-
</Button>
|
|
158
|
-
</div>
|
|
159
|
-
)}
|
|
160
|
-
<GetLoopEditor repo={repo} />
|
|
161
|
-
</div>
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* 项目级「持续 get」(waitgoal)编辑器:落在 repo 记录的 getLoop 字段。
|
|
167
|
-
* 开启后该项目 `localtask get` 无任务时自动唤起阻塞窗口等人回填,
|
|
168
|
-
* 领到的交付文本追加「继续 get 直到超时」的项目模板(提示词增强,基于项目)。
|
|
169
|
-
*
|
|
170
|
-
* #41 交互收敛:一句话即配置——「选模板」(内置默认 + 全局回调提示词条目)+
|
|
171
|
-
* 带 %s 槽位的一句话(%s = 任务编号,存取时与 {{task.id}} 互转);多条目收起成
|
|
172
|
-
* 标题行,点击展开编辑;说明文字删除。
|
|
173
|
-
*/
|
|
174
|
-
const GETLOOP_LINE_MAX = 2000;
|
|
175
|
-
|
|
176
|
-
function GetLoopEditor({ repo }) {
|
|
177
|
-
const app = useApp() || {};
|
|
178
|
-
const toast = useToast();
|
|
179
|
-
const loop = repo.getLoop && typeof repo.getLoop === 'object' ? repo.getLoop : null;
|
|
180
|
-
const [on, setOn] = useState(!!(loop && loop.enabled));
|
|
181
|
-
const [minutes, setMinutes] = useState(String((loop && loop.waitMinutes) || 10));
|
|
182
|
-
// 旧 string 单条归一成一行(按条编辑);空数组 = 未配置(交付用默认模板)。
|
|
183
|
-
// 展示层 %s ↔ 存储层 {{task.id}} 互转——项目级只写一句话,槽位写 %s。
|
|
184
|
-
const [tpls, setTpls] = useState(() => {
|
|
185
|
-
const raw = loop && loop.template;
|
|
186
|
-
const arr = Array.isArray(raw) ? raw : raw == null ? [] : [raw];
|
|
187
|
-
return arr
|
|
188
|
-
.map((s) => String(s ?? '').trim())
|
|
189
|
-
.filter(Boolean)
|
|
190
|
-
.map((s) => s.replaceAll('{{task.id}}', '%s'));
|
|
191
|
-
});
|
|
192
|
-
const [openIdx, setOpenIdx] = useState(-1);
|
|
193
|
-
const [line, setLine] = useState(''); // 一句话输入(可含 %s)
|
|
194
|
-
const [busy, setBusy] = useState(false);
|
|
195
|
-
// 配置区(阻塞窗口/收尾模板/动作行)默认收起(#103):开启「持续 get」
|
|
196
|
-
// 只是一枚开关的语义,细节按需展开;头上给一行摘要(几分钟·几条模板)。
|
|
197
|
-
const [cfgOpen, setCfgOpen] = useState(false);
|
|
198
|
-
|
|
199
|
-
const save = async (override) => {
|
|
200
|
-
setBusy(true);
|
|
201
|
-
try {
|
|
202
|
-
const enabled = override && override.enabled !== undefined ? override.enabled : on;
|
|
203
|
-
// %s → {{task.id}}(槽位落库为占位符);空行丢弃
|
|
204
|
-
const stored = tpls
|
|
205
|
-
.map((s) => String(s ?? '').trim().replaceAll('%s', '{{task.id}}'))
|
|
206
|
-
.filter(Boolean)
|
|
207
|
-
.slice(0, MAX_PROMPT_ITEMS);
|
|
208
|
-
await api('/api/repos/' + encodeURIComponent(repo.id), {
|
|
209
|
-
method: 'PATCH',
|
|
210
|
-
body: {
|
|
211
|
-
getLoop: {
|
|
212
|
-
enabled,
|
|
213
|
-
...(enabled ? { waitMinutes: Number(minutes) || 10, template: stored } : {}),
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
});
|
|
217
|
-
toast(
|
|
218
|
-
enabled
|
|
219
|
-
? `已保存「${repo.name}」的持续 get 设置(模板 ${stored.length} 条)`
|
|
220
|
-
: `已关闭「${repo.name}」的持续 get`
|
|
221
|
-
);
|
|
222
|
-
app.refreshRepos && app.refreshRepos();
|
|
223
|
-
} catch (e) {
|
|
224
|
-
toast(String(e.message || e));
|
|
225
|
-
} finally {
|
|
226
|
-
setBusy(false);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// 开关即刻落库(#103):配置区收起时用户也要能真正「开启」持续 get,
|
|
231
|
-
// 不能等展开配置按保存才生效。
|
|
232
|
-
const toggleOn = async (next) => {
|
|
233
|
-
setOn(next);
|
|
234
|
-
if (!next) setCfgOpen(false);
|
|
235
|
-
await save({ enabled: next });
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
const addLine = () => {
|
|
239
|
-
const v = line.trim();
|
|
240
|
-
if (!v || tpls.length >= MAX_PROMPT_ITEMS) return;
|
|
241
|
-
setTpls([...tpls, v.slice(0, GETLOOP_LINE_MAX)]);
|
|
242
|
-
setOpenIdx(tpls.length); // 新行直接展开
|
|
243
|
-
setLine('');
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
// 关着时给一枚**真开关**(off 态)做行内入口(#102:与展开后的开关同形态,
|
|
247
|
-
// 不再是一枚意义不明的圆点药丸);开着才展开整块配置。
|
|
248
|
-
// 点击 = 真的开启(#103:此前只翻本地状态,展开后开关显示「开」而库里仍是
|
|
249
|
-
// 关——骗人;现在开关与入口都即时落库)。
|
|
250
|
-
if (!on) {
|
|
251
|
-
return (
|
|
252
|
-
<button className="setp-gl-off" title="开启持续 get(waitgoal)" onClick={() => toggleOn(true)}>
|
|
253
|
-
<span className="dot" />
|
|
254
|
-
持续 get
|
|
255
|
-
</button>
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<div className="setp-loop">
|
|
261
|
-
<div className="setp-loop-head">
|
|
262
|
-
<div className="setp-loop-title">
|
|
263
|
-
<span className="setp-loop-name">持续 get</span>
|
|
264
|
-
<span className="setp-loop-desc">无任务时阻塞等待新任务回填(waitgoal)</span>
|
|
265
|
-
</div>
|
|
266
|
-
<div className="setp-loop-head-acts">
|
|
267
|
-
{on && (
|
|
268
|
-
<button
|
|
269
|
-
className="setp-loop-cfg"
|
|
270
|
-
onClick={() => setCfgOpen((v) => !v)}
|
|
271
|
-
aria-expanded={cfgOpen}
|
|
272
|
-
title={cfgOpen ? '收起配置' : '展开配置'}
|
|
273
|
-
>
|
|
274
|
-
<Icon name="chevron" size={11} className={cfgOpen ? 'rot' : ''} />
|
|
275
|
-
配置
|
|
276
|
-
<span className="setp-loop-cfg-sum">{minutes} 分钟 · {tpls.length} 条模板</span>
|
|
277
|
-
</button>
|
|
278
|
-
)}
|
|
279
|
-
<button
|
|
280
|
-
className={'toggle' + (on ? ' on' : '')}
|
|
281
|
-
onClick={() => toggleOn(!on)}
|
|
282
|
-
disabled={busy}
|
|
283
|
-
>
|
|
284
|
-
<span className="dot" />
|
|
285
|
-
{on ? '开' : '关'}
|
|
286
|
-
</button>
|
|
287
|
-
</div>
|
|
288
|
-
</div>
|
|
289
|
-
{on && cfgOpen && (
|
|
290
|
-
<div className="setp-loop-cfg-body">
|
|
291
|
-
<label className="setp-row setp-loop-row">
|
|
292
|
-
<span>阻塞窗口</span>
|
|
293
|
-
<span className="setp-loop-unit">
|
|
294
|
-
<input className="setp-min" value={minutes} onChange={(e) => setMinutes(e.target.value)} inputMode="numeric" />
|
|
295
|
-
分钟
|
|
296
|
-
</span>
|
|
297
|
-
</label>
|
|
298
|
-
<div className="setp-loop-tpl">
|
|
299
|
-
<div className="setp-h">收尾模板</div>
|
|
300
|
-
<div className="setp-oneline">
|
|
301
|
-
<Button
|
|
302
|
-
variant="secondary"
|
|
303
|
-
title="填入内置默认(继续 get 直到 timeout)"
|
|
304
|
-
onClick={() => setLine(GETLOOP_DEFAULT_PRESET)}
|
|
305
|
-
>
|
|
306
|
-
填入内置默认
|
|
307
|
-
</Button>
|
|
308
|
-
<input
|
|
309
|
-
className="setp-oneline-input"
|
|
310
|
-
value={line}
|
|
311
|
-
placeholder="一句话(%s = 任务编号),选模板后可改"
|
|
312
|
-
onChange={(e) => setLine(e.target.value)}
|
|
313
|
-
onKeyDown={(e) => {
|
|
314
|
-
if (e.key === 'Enter') addLine();
|
|
315
|
-
}}
|
|
316
|
-
/>
|
|
317
|
-
<Button variant="secondary" disabled={busy || !line.trim()} onClick={addLine}>
|
|
318
|
-
添加
|
|
319
|
-
</Button>
|
|
320
|
-
</div>
|
|
321
|
-
{tpls.length ? (
|
|
322
|
-
<PromptItemsEditor
|
|
323
|
-
items={tpls}
|
|
324
|
-
onChange={setTpls}
|
|
325
|
-
disabled={busy}
|
|
326
|
-
placeholder={'一句话(%s = 任务编号)'}
|
|
327
|
-
accordion
|
|
328
|
-
openIndex={openIdx}
|
|
329
|
-
onOpenChange={setOpenIdx}
|
|
330
|
-
/>
|
|
331
|
-
) : (
|
|
332
|
-
<div className="setp-note">{'未配置模板 —— 用默认「完成后续调 localtask get;没活时每轮最多阻塞 {{getloop.waitMinutes}} 分钟,直到 timeout」。'}</div>
|
|
333
|
-
)}
|
|
334
|
-
</div>
|
|
335
|
-
<div className="setp-proj-a">
|
|
336
|
-
<Button
|
|
337
|
-
variant="secondary"
|
|
338
|
-
disabled={busy || tpls.length >= MAX_PROMPT_ITEMS}
|
|
339
|
-
title={tpls.length >= MAX_PROMPT_ITEMS ? `最多 ${MAX_PROMPT_ITEMS} 条` : '新增一条「继续 get」指令'}
|
|
340
|
-
onClick={() => {
|
|
341
|
-
setTpls([...tpls, '']);
|
|
342
|
-
setOpenIdx(tpls.length);
|
|
343
|
-
}}
|
|
344
|
-
>
|
|
345
|
-
添加一条…
|
|
346
|
-
</Button>
|
|
347
|
-
<span className="spacer" />
|
|
348
|
-
<Button variant="primary" disabled={busy} onClick={() => save()}>保存持续 get 设置</Button>
|
|
349
|
-
</div>
|
|
350
|
-
</div>
|
|
351
|
-
)}
|
|
352
|
-
</div>
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
43
|
export default function SettingsPanel() {
|
|
357
44
|
const app = useApp() || {};
|
|
358
45
|
const toast = useToast();
|
|
@@ -360,7 +47,6 @@ export default function SettingsPanel() {
|
|
|
360
47
|
const prefs = app.prefs || {};
|
|
361
48
|
const patchPrefs = app.patchPrefs || (() => {});
|
|
362
49
|
const model = app.model;
|
|
363
|
-
const repos = (app.repoData && app.repoData.repos) || [];
|
|
364
50
|
|
|
365
51
|
const [tab, setTab] = useState('pref');
|
|
366
52
|
const [cfg, setCfg] = useState(null);
|
|
@@ -391,39 +77,8 @@ export default function SettingsPanel() {
|
|
|
391
77
|
}
|
|
392
78
|
});
|
|
393
79
|
|
|
394
|
-
//
|
|
395
|
-
|
|
396
|
-
if (r.doc && r.doc.path) return { kind: 'external', docId: 'path:' + r.doc.path, label: r.doc.path };
|
|
397
|
-
if (r.doc && r.doc.rel) return { kind: 'own', docId: 'rel:' + r.doc.rel, label: r.doc.rel };
|
|
398
|
-
return { kind: 'default', docId: 'rel:' + (r.docRel || ''), label: r.docRel || '(未创建)' };
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
const openDoc = (r) => {
|
|
402
|
-
if (!model) return;
|
|
403
|
-
const st = docStateOf(r);
|
|
404
|
-
if (!st.docId || st.docId === 'rel:') return toast('这个项目还没有介绍文档');
|
|
405
|
-
openPanel(model, { component: 'doc', name: r.name + ' · 介绍', config: { docId: st.docId }, location: 'center' });
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
const bindExternal = (r) =>
|
|
409
|
-
guard(async () => {
|
|
410
|
-
const path = await dialog({
|
|
411
|
-
title: '绑定外部介绍文档',
|
|
412
|
-
input: true,
|
|
413
|
-
placeholder: 'D:\\vault\\nx\\nx-kv.md(只读引用,不进导出包)',
|
|
414
|
-
});
|
|
415
|
-
if (!path) return;
|
|
416
|
-
await api('/api/docs/bind', { method: 'POST', body: { repo: r.key, path: path.trim() } });
|
|
417
|
-
toast(`已绑定:${path.trim()}`);
|
|
418
|
-
app.refreshRepos && app.refreshRepos();
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
const unbind = (r) =>
|
|
422
|
-
guard(async () => {
|
|
423
|
-
await api('/api/docs/bind', { method: 'POST', body: { repo: r.key, reset: true } });
|
|
424
|
-
toast('已解除绑定(回到约定路径)');
|
|
425
|
-
app.refreshRepos && app.refreshRepos();
|
|
426
|
-
});
|
|
80
|
+
// (#145:「项目级设置」tab 删除——介绍/图标/持续 get 统一收进仓库管理页,
|
|
81
|
+
// 这里不再保留 docStateOf / openDoc / bindExternal / unbind。)
|
|
427
82
|
|
|
428
83
|
const openTplEditor = (opts) => {
|
|
429
84
|
if (!model) return;
|
|
@@ -542,24 +197,6 @@ export default function SettingsPanel() {
|
|
|
542
197
|
sidebar: (
|
|
543
198
|
<SidebarSection />
|
|
544
199
|
),
|
|
545
|
-
|
|
546
|
-
project: (
|
|
547
|
-
<>
|
|
548
|
-
<div className="setp-projs">
|
|
549
|
-
{repos.map((r) => (
|
|
550
|
-
<ProjectCard
|
|
551
|
-
key={r.key}
|
|
552
|
-
repo={r}
|
|
553
|
-
docStateOf={docStateOf}
|
|
554
|
-
openDoc={openDoc}
|
|
555
|
-
bindExternal={bindExternal}
|
|
556
|
-
unbind={unbind}
|
|
557
|
-
/>
|
|
558
|
-
))}
|
|
559
|
-
{!repos.length && <div className="setp-note">还没有登记仓库。</div>}
|
|
560
|
-
</div>
|
|
561
|
-
</>
|
|
562
|
-
),
|
|
563
200
|
};
|
|
564
201
|
|
|
565
202
|
return (
|