dsh-session-history 0.1.0 → 0.2.1
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 +103 -52
- package/bin/session-history.js +22 -14
- package/client.js +229 -97
- package/icon.svg +5 -7
- package/index.js +58 -16
- package/lib/agents.js +64 -7
- package/lib/config.js +18 -3
- package/lib/links.js +111 -60
- package/lib/raw.js +15 -6
- package/lib/refresh.js +3 -3
- package/lib/scan.js +55 -0
- package/lib/skill.js +6 -6
- package/lib/sources/antigravity.js +3 -3
- package/lib/sources/claude.js +2 -2
- package/lib/sources/codex.js +2 -2
- package/lib/sources/dsh.js +2 -2
- package/lib/sources/lobsterai.js +142 -0
- package/lib/sources/opencode.js +125 -0
- package/lib/sources/pi.js +2 -2
- package/lib/sources/workbuddy.js +98 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
package/client.js
CHANGED
|
@@ -7,29 +7,46 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
const API = './youxia-session-history/api';
|
|
8
8
|
|
|
9
9
|
const css = `
|
|
10
|
-
.yxsh{font-size:13px;line-height:1.
|
|
10
|
+
.yxsh{width:100%;font-size:13px;line-height:1.55;color:var(--dsw-alias-label-primary,inherit);display:flex;flex-direction:column;gap:28px}
|
|
11
11
|
.yxsh *{box-sizing:border-box}.yxsh button,.yxsh input,.yxsh select,.yxsh textarea{font:inherit;color:inherit}
|
|
12
|
-
.yxsh h3{margin:0
|
|
13
|
-
.yxsh-
|
|
14
|
-
.yxsh-
|
|
12
|
+
.yxsh h3{margin:0;font-size:14px;font-weight:600}.yxsh h4{margin:0 0 2px;font-size:12px;font-weight:600;color:var(--dsw-alias-label-secondary,#666)}
|
|
13
|
+
.yxsh-muted{color:var(--dsw-alias-label-tertiary,#888);font-size:12px}.yxsh-error{color:var(--dsw-alias-label-error,#e44848);font-size:12px;white-space:pre-wrap}
|
|
14
|
+
.yxsh-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}.yxsh-grow{flex:1;min-width:0}
|
|
15
|
+
.yxsh-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
|
|
16
|
+
.yxsh-btn{appearance:none;cursor:pointer;border:0.5px solid var(--dsw-alias-border-l4,#8884);background:var(--dsw-alias-bg-layer-3,transparent);border-radius:var(--dsw-radius-md,8px);padding:3px 11px;font-size:12px;line-height:1.7;white-space:nowrap}
|
|
15
17
|
.yxsh-btn:disabled{opacity:.5;cursor:default}.yxsh-btn.primary{background:var(--dsw-alias-interactive-bg-primary,#0A84FF);color:#fff;border-color:transparent}
|
|
16
|
-
|
|
17
|
-
.yxsh-
|
|
18
|
-
.yxsh-
|
|
18
|
+
.yxsh-link{appearance:none;border:0;background:none;padding:0;cursor:pointer;font-size:12px;color:var(--dsw-alias-label-tertiary,#888);text-decoration:underline;text-underline-offset:2px}
|
|
19
|
+
@media (hover:hover){.yxsh-btn:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,#8882)}.yxsh-btn.primary:hover:not(:disabled){filter:brightness(1.08);background:var(--dsw-alias-interactive-bg-primary,#0A84FF)}.yxsh-link:hover{color:var(--dsw-alias-label-primary,inherit)}}
|
|
20
|
+
.yxsh-card{border:0.5px solid var(--dsw-alias-border-l2,#8883);border-radius:10px;background:var(--dsw-alias-bg-layer-2,transparent)}
|
|
21
|
+
.yxsh-home{padding:14px 16px;display:flex;flex-direction:column;gap:12px}
|
|
22
|
+
.yxsh-path{font-family:var(--dsw-font-mono,ui-monospace,monospace);font-size:13px;word-break:break-all}
|
|
23
|
+
.yxsh-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px 18px;padding-top:12px;border-top:0.5px solid var(--dsw-alias-border-l2,#8883)}
|
|
24
|
+
.yxsh-stat span{display:block}.yxsh-stat b{font-weight:600;font-size:13px}
|
|
25
|
+
.yxsh-agent{display:grid;grid-template-columns:minmax(130px,1fr) minmax(220px,2.4fr) auto minmax(120px,auto);gap:4px 16px;align-items:center;padding:10px 14px;border-top:0.5px solid var(--dsw-alias-border-l2,#8883)}
|
|
19
26
|
.yxsh-agent:first-child{border-top:0}.yxsh-agent b{font-weight:500}
|
|
20
|
-
.yxsh-
|
|
21
|
-
.yxsh-
|
|
22
|
-
.yxsh-chip
|
|
23
|
-
.yxsh-
|
|
24
|
-
.yxsh-
|
|
25
|
-
.yxsh-
|
|
26
|
-
.yxsh-
|
|
27
|
-
.yxsh-
|
|
28
|
-
.yxsh
|
|
29
|
-
.yxsh-
|
|
30
|
-
.yxsh-
|
|
31
|
-
.yxsh
|
|
32
|
-
|
|
27
|
+
.yxsh-src{min-width:0}.yxsh-src .yxsh-muted{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
28
|
+
.yxsh-badge{display:inline-block;margin-left:6px;padding:0 5px;border-radius:4px;font-size:11px;line-height:17px;background:var(--dsw-alias-bg-layer-4,#8881);color:var(--dsw-alias-label-secondary,#666);vertical-align:1px}
|
|
29
|
+
.yxsh-chip{display:inline-flex;align-items:center;gap:6px;border-radius:5px;padding:1px 8px;font-size:12px;white-space:nowrap;justify-self:start}
|
|
30
|
+
.yxsh-chip i{width:7px;height:7px;border-radius:50%;flex:none;background:currentColor}
|
|
31
|
+
.yxsh-chip.ready{background:color-mix(in srgb,#34C759 14%,transparent)}.yxsh-chip.ready i{background:#34C759}
|
|
32
|
+
.yxsh-chip.missing{background:color-mix(in srgb,#FF9500 15%,transparent)}.yxsh-chip.missing i{background:#FF9500}
|
|
33
|
+
.yxsh-chip.conflict{background:color-mix(in srgb,#FF3B30 14%,transparent);color:var(--dsw-alias-label-error,#e44848)}
|
|
34
|
+
.yxsh-chip.nodir{background:var(--dsw-alias-bg-layer-4,#8881);color:var(--dsw-alias-label-tertiary,#888)}.yxsh-chip.nodir i{opacity:.5}
|
|
35
|
+
.yxsh-switch{display:inline-flex;align-items:center;gap:6px;cursor:pointer;white-space:nowrap}.yxsh-switch input{margin:0}
|
|
36
|
+
.yxsh-access{margin-top:12px;padding:12px 14px;display:flex;flex-direction:column;gap:10px}
|
|
37
|
+
.yxsh-item{display:flex;align-items:flex-start;gap:12px}.yxsh-item>div{flex:1;min-width:0}
|
|
38
|
+
.yxsh code{font-family:var(--dsw-font-mono,ui-monospace,monospace);font-size:12px}
|
|
39
|
+
.yxsh-notes{margin-top:8px;display:flex;flex-direction:column;gap:2px}
|
|
40
|
+
.yxsh-form{margin-top:12px;padding:14px 16px;display:grid;grid-template-columns:150px minmax(0,1fr);gap:10px 14px;align-items:start}
|
|
41
|
+
.yxsh-form label{padding-top:5px}.yxsh-form .full{grid-column:1/-1}
|
|
42
|
+
.yxsh-input{height:30px;border:0.5px solid var(--dsw-alias-border-l4,#8884);background:var(--dsw-alias-bg-layer-3,transparent);border-radius:var(--dsw-radius-md,8px);padding:0 10px;width:100%;max-width:440px;min-width:0}
|
|
43
|
+
.yxsh textarea.yxsh-input{height:60px;padding:6px 10px;resize:vertical;font-family:var(--dsw-font-mono,ui-monospace,monospace);font-size:12px}
|
|
44
|
+
.yxsh-group{padding:4px 0 6px}.yxsh-group+.yxsh-group{border-top:0.5px solid var(--dsw-alias-border-l2,#8883);padding-top:12px}
|
|
45
|
+
.yxsh-field{display:grid;grid-template-columns:190px minmax(0,1fr);gap:4px 14px;align-items:start;padding:7px 0}
|
|
46
|
+
.yxsh-field label{padding-top:5px}
|
|
47
|
+
.yxsh-pre{margin:10px 0 0;padding:12px 14px;max-height:360px;overflow:auto;border-radius:8px;background:var(--dsw-alias-bg-layer-4,#8881);font-family:var(--dsw-font-mono,ui-monospace,monospace);font-size:11.5px;line-height:1.6;white-space:pre-wrap}
|
|
48
|
+
.yxsh summary{cursor:pointer;font-size:14px;font-weight:600}
|
|
49
|
+
@media (max-width:760px){.yxsh-agent{grid-template-columns:1fr auto}.yxsh-field,.yxsh-form{grid-template-columns:1fr}.yxsh-form label{padding-top:0}}
|
|
33
50
|
`;
|
|
34
51
|
|
|
35
52
|
function source(initial) {
|
|
@@ -39,33 +56,29 @@ window.__ModuleLoader__.load({
|
|
|
39
56
|
set(next) { value = { ...value, ...next }; for (const fn of listeners) fn(); } };
|
|
40
57
|
}
|
|
41
58
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
59
|
+
const pad = n => String(n).padStart(2, '0');
|
|
60
|
+
function when(iso) {
|
|
61
|
+
if (!iso) return '尚未整理';
|
|
62
|
+
const [date, time] = [iso.slice(0, 10), iso.slice(11, 16)];
|
|
63
|
+
const d = new Date(), today = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
64
|
+
const y = new Date(d.getTime() - 86400000), yesterday = `${y.getFullYear()}-${pad(y.getMonth() + 1)}-${pad(y.getDate())}`;
|
|
65
|
+
return (date === today ? '今天 ' : date === yesterday ? '昨天 ' : date.slice(5) + ' ') + time;
|
|
47
66
|
}
|
|
67
|
+
const num = n => Number(n || 0).toLocaleString('zh-CN');
|
|
48
68
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
function sourceText(agent, last) {
|
|
56
|
-
if (!agent.installed) return h('span', { className: 'yxsh-muted' }, '本机未检测到');
|
|
57
|
-
const run = last?.agents?.[agent.folder];
|
|
58
|
-
if (!agent.enabled) return h('span', { className: 'yxsh-muted' }, '已检测到,未整理');
|
|
59
|
-
if (!run) return h('span', { className: 'yxsh-muted' }, '已检测到,待整理');
|
|
60
|
-
return run.ok ? h('span', null, `${run.files} 个会话文件 · ${run.days} 天日志`) : h('span', { className: 'yxsh-error' }, `出错:${run.error}`);
|
|
61
|
-
}
|
|
69
|
+
const STATE = {
|
|
70
|
+
ready: ['已接入', a => `经 ${a.via} 读到本技能`],
|
|
71
|
+
missing: ['待接入', () => '它的技能目录里还没有 session-history,见下方「技能接入」'],
|
|
72
|
+
conflict: ['冲突', a => `${a.conflict?.path} 已有同名的其他内容`],
|
|
73
|
+
nodir: ['不接入', () => '没有设置技能目录,只收录会话'],
|
|
74
|
+
};
|
|
62
75
|
|
|
63
76
|
return {
|
|
64
77
|
inject: ['slots'],
|
|
65
78
|
apply(ctx) {
|
|
66
79
|
let alive = true;
|
|
67
80
|
const state = source({ data: null, loading: true, error: '', pending: '' });
|
|
68
|
-
const
|
|
81
|
+
const useStore = () => React.useSyncExternalStore(state.subscribe, state.getSnapshot, state.getSnapshot);
|
|
69
82
|
|
|
70
83
|
async function api(command) {
|
|
71
84
|
const response = await fetch(API, { credentials: 'same-origin', cache: 'no-store',
|
|
@@ -86,88 +99,207 @@ window.__ModuleLoader__.load({
|
|
|
86
99
|
finally { if (alive) state.set({ pending: '' }); }
|
|
87
100
|
}
|
|
88
101
|
|
|
89
|
-
function
|
|
90
|
-
const
|
|
102
|
+
function Home({ data, pending }) {
|
|
103
|
+
const last = data.last, bad = Object.entries(last?.agents || {}).filter(([, r]) => !r.ok).map(([k]) => k);
|
|
104
|
+
const busy = pending === 'refresh' || data.running;
|
|
91
105
|
return h('section', null,
|
|
106
|
+
h('div', { className: 'yxsh-head' }, h('h3', { className: 'yxsh-grow' }, '数据目录'),
|
|
107
|
+
h('button', { className: 'yxsh-btn', onClick: () => run({ op: 'open' }, 'open'), disabled: !!pending }, '打开'),
|
|
108
|
+
h('button', { className: 'yxsh-btn primary', onClick: () => run({ op: 'refresh' }, 'refresh'), disabled: !!pending || data.running }, busy ? '整理中…' : '立即整理')),
|
|
109
|
+
h('div', { className: 'yxsh-card yxsh-home' },
|
|
110
|
+
h('div', null, h('div', { className: 'yxsh-path' }, data.home),
|
|
111
|
+
h('div', { className: 'yxsh-muted' }, '日志、索引与设置都在这里,与插件分开存放,卸载或更新插件不受影响。')),
|
|
112
|
+
h('div', { className: 'yxsh-stats' },
|
|
113
|
+
h('div', { className: 'yxsh-stat' }, h('span', { className: 'yxsh-muted' }, '最近整理'),
|
|
114
|
+
h('b', null, when(last?.run)), last ? h('span', { className: 'yxsh-muted' }, `用时 ${(Number(last.ms || 0) / 1000).toFixed(1)} 秒`) : null),
|
|
115
|
+
h('div', { className: 'yxsh-stat' }, h('span', { className: 'yxsh-muted' }, '会话'), h('b', null, last?.index ? num(last.index.sessions) : '—'),
|
|
116
|
+
h('span', { className: 'yxsh-muted' }, last?.index ? `${num(last.index.files)} 份日志` : '整理后生成')),
|
|
117
|
+
h('div', { className: 'yxsh-stat' }, h('span', { className: 'yxsh-muted' }, '状态'),
|
|
118
|
+
bad.length ? h('b', { className: 'yxsh-error' }, `${bad.join('、')} 出错`) : h('b', null, last ? '正常' : '等待首次整理'),
|
|
119
|
+
h('span', { className: 'yxsh-muted' }, data.config.refreshMinutes ? `定时:${({ 30: '每 30 分钟', 60: '每小时整点', 120: '每 2 小时', 360: '每 6 小时' })[data.config.refreshMinutes] || `每 ${data.config.refreshMinutes} 分钟`}` : '定时整理已关闭')))));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function AgentRow({ a, pending }) {
|
|
123
|
+
const [label, hint] = STATE[a.state];
|
|
124
|
+
const run_ = a.run;
|
|
125
|
+
return h('div', { className: 'yxsh-agent' },
|
|
126
|
+
h('div', null, h('b', null, a.name), a.custom ? h('span', { className: 'yxsh-badge' }, '自定义') : null,
|
|
127
|
+
a.experimental && !a.custom ? h('span', { className: 'yxsh-badge', title: '会话格式按其公开代码推断,尚未用真实会话验证' }, '实验性') : null),
|
|
128
|
+
h('div', { className: 'yxsh-src' },
|
|
129
|
+
!a.enabled ? h('div', null, '未收录') : !run_ ? h('div', null, '待整理')
|
|
130
|
+
: run_.ok ? h('div', null, `${num(run_.files)} 个会话文件 · ${num(run_.days)} 天日志`) : h('div', { className: 'yxsh-error' }, `整理出错:${run_.error}`),
|
|
131
|
+
h('div', { className: 'yxsh-muted', title: a.sessions }, a.sessions)),
|
|
132
|
+
h('label', { className: 'yxsh-switch yxsh-muted', title: '关闭后不再整理它的新会话,已有日志照常检索' },
|
|
133
|
+
h('input', { type: 'checkbox', checked: a.enabled, disabled: !!pending, onChange: e => run({ op: 'enable', agent: a.id, enabled: e.target.checked }, 'enable') }), '收录'),
|
|
134
|
+
h('div', null, h('span', { className: `yxsh-chip ${a.state}`, title: [hint(a), ...a.dirs.map(d => `读取 ${d.display}`)].join('\n') }, h('i'), label),
|
|
135
|
+
a.custom ? h('div', null, h('button', { className: 'yxsh-link', disabled: !!pending, onClick: () => {
|
|
136
|
+
if (globalThis.confirm?.(`移除「${a.name}」?已整理的日志会保留并照常检索。`) !== false) run({ op: 'removeCustom', id: a.id }, 'remove');
|
|
137
|
+
} }, '移除')) : null));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function Access({ data, pending }) {
|
|
141
|
+
const { targets, links, conflicts } = data;
|
|
142
|
+
const items = [];
|
|
143
|
+
for (const t of targets) {
|
|
144
|
+
const note = data.agents.find(a => t.agents.includes(a.name) && a.note)?.note;
|
|
145
|
+
const shared = t.agents.length > 1;
|
|
146
|
+
const where = t.create ? ['将新建技能目录 ', h('code', { key: 'p' }, t.display), ',']
|
|
147
|
+
: t.realDisplay ? [shared ? '它们读取的 ' : '它读取的 ', (t.paths || [t.display]).map((p, i) => [i ? '、' : '', h('code', { key: p }, p)]), ' 实际都是 ', h('code', { key: 'r' }, t.realDisplay), ',']
|
|
148
|
+
: ['技能目录 ', h('code', { key: 'p' }, t.display), ' '];
|
|
149
|
+
items.push(h('div', { className: 'yxsh-item', key: 't' + t.key },
|
|
150
|
+
h('div', null,
|
|
151
|
+
h('div', null, h('b', null, t.agents.join('、')), ':待接入'),
|
|
152
|
+
h('div', { className: 'yxsh-muted' }, ...where, '其中还没有 session-history。在这里建一条指向数据目录的软链,',
|
|
153
|
+
shared ? `这 ${t.agents.length} 家同时生效。` : '即可生效。', note ? ` 注意:${note}。` : '')),
|
|
154
|
+
h('button', { className: 'yxsh-btn primary', disabled: !!pending, onClick: () => run({ op: 'linkTarget', key: t.key }, 'link') }, '建软链')));
|
|
155
|
+
}
|
|
156
|
+
for (const l of links) items.push(h('div', { className: 'yxsh-item', key: 'l' + l.key },
|
|
157
|
+
h('div', null,
|
|
158
|
+
h('div', null, '已接入:', h('code', null, l.entry), ' → 数据目录'),
|
|
159
|
+
h('div', { className: 'yxsh-muted' }, `${l.agents.join('、')} 经此读取本技能`)),
|
|
160
|
+
h('button', { className: 'yxsh-btn', disabled: !!pending, title: `移除后 ${l.agents.join('、')} 都将看不到本技能`,
|
|
161
|
+
onClick: () => { if (globalThis.confirm?.(`移除这条软链?${l.agents.join('、')} 将看不到本技能。数据不受影响。`) !== false) run({ op: 'unlinkTarget', key: l.key }, 'unlink'); } }, '移除')));
|
|
162
|
+
for (const c of conflicts) items.push(h('div', { className: 'yxsh-item', key: 'c' + c.path },
|
|
163
|
+
h('div', { className: 'yxsh-error' }, `${c.agent}:${c.path} 已有同名的${c.state === 'copy' ? '旧版副本' : c.state === 'broken' ? '失效软链' : '其他文件'},未覆盖。移走后即可接入。`)));
|
|
164
|
+
return h('div', { className: 'yxsh-card yxsh-access' },
|
|
165
|
+
h('div', { className: 'yxsh-row' }, h('h4', { className: 'yxsh-grow' }, '技能接入'),
|
|
166
|
+
targets.length > 1 ? h('button', { className: 'yxsh-btn primary', disabled: !!pending, onClick: () => run({ op: 'linkAll' }, 'link') }, '全部接入') : null),
|
|
167
|
+
items.length ? items : h('div', { className: 'yxsh-muted' }, '检测到的 agent 都已接入本技能。'),
|
|
168
|
+
h('div', { className: 'yxsh-muted' }, '数据目录本身就是技能文件夹,不拷副本:在 agent 读取的技能目录里放一条指向它的软链即可。几家实际读同一个文件夹(比如都软链到你统一管理的技能目录)时,只需一条。'),
|
|
169
|
+
h('div', { className: 'yxsh-muted' }, '是否已接入,是从每个 agent 自己的技能目录出发、顺着软链去读 session-history/SKILL.md 来判断的,与 agent 加载技能走同一条路。'));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function AddAgent({ data, pending }) {
|
|
173
|
+
const [open, setOpen] = React.useState(false);
|
|
174
|
+
const [form, setForm] = React.useState({ name: '', format: 'claude', sessions: '', skills: '' });
|
|
175
|
+
const [check, setCheck] = React.useState(null);
|
|
176
|
+
const fmt = data.formats.find(f => f.id === form.format) || data.formats[0];
|
|
177
|
+
const set = patch => { setForm({ ...form, ...patch }); if ('sessions' in patch || 'format' in patch) setCheck(null); };
|
|
178
|
+
const probe = async () => {
|
|
179
|
+
try { const r = await api({ op: 'probe', format: form.format, sessions: form.sessions }); setCheck(r.probe); }
|
|
180
|
+
catch (error) { setCheck({ error: error.message }); }
|
|
181
|
+
};
|
|
182
|
+
const add = async () => { if (await run({ op: 'addCustom', ...form }, 'add')) { setOpen(false); setForm({ name: '', format: 'claude', sessions: '', skills: '' }); setCheck(null); } };
|
|
183
|
+
const [found, setFound] = React.useState(null);
|
|
184
|
+
const find = async () => {
|
|
185
|
+
setFound({ busy: true });
|
|
186
|
+
try { const r = await api({ op: 'scan' }); if (alive) state.set({ data: r }); setFound({ list: r.found }); }
|
|
187
|
+
catch (error) { setFound({ error: error.message }); }
|
|
188
|
+
};
|
|
189
|
+
const quick = c => run({ op: 'addCustom', name: c.name, format: c.format, sessions: c.sessions, skills: c.skills || '' }, 'add')
|
|
190
|
+
.then(ok => { if (ok) setFound(f => ({ list: (f?.list || []).filter(x => x.sessions !== c.sessions) })); });
|
|
191
|
+
const results = !found ? null : found.busy ? h('div', { className: 'yxsh-muted' }, '查找中…')
|
|
192
|
+
: found.error ? h('div', { className: 'yxsh-error' }, found.error)
|
|
193
|
+
: !found.list.length ? h('div', { className: 'yxsh-muted' }, '没有找到其他可收录的 agent。内置支持的 agent 装好并产生对话后,会自动出现在上面。')
|
|
194
|
+
: h('div', { className: 'yxsh-card', style: { padding: '4px 14px', marginTop: '8px' } }, ...found.list.map(c => h('div', { className: 'yxsh-item', key: c.sessions, style: { padding: '8px 0' } },
|
|
195
|
+
h('div', null, h('div', null, h('b', null, c.name), h('span', { className: 'yxsh-muted' }, ` · ${data.formats.find(f => f.id === c.format)?.label || c.format} · ${num(c.files)} 个会话文件`)),
|
|
196
|
+
h('div', { className: 'yxsh-muted' }, h('code', null, c.sessions), c.skills ? [' 技能目录 ', h('code', { key: 's' }, c.skills)] : ' 未发现技能目录,只收录会话')),
|
|
197
|
+
h('button', { className: 'yxsh-btn', disabled: !!pending, onClick: () => quick(c) }, '添加'))));
|
|
198
|
+
if (!open) return h('div', { style: { marginTop: '10px' } },
|
|
92
199
|
h('div', { className: 'yxsh-row' },
|
|
93
|
-
h('
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
h('
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
200
|
+
h('button', { className: 'yxsh-btn', disabled: found?.busy, onClick: find, title: '重新检测内置 agent,并查找格式相同的其他 agent 或同一 agent 的其他配置目录' }, '自动查找'),
|
|
201
|
+
h('button', { className: 'yxsh-btn', onClick: () => setOpen(true) }, '手动添加')),
|
|
202
|
+
results);
|
|
203
|
+
const verdict = !check ? null : check.error ? h('span', { className: 'yxsh-error' }, check.error)
|
|
204
|
+
: !check.exists ? h('span', { className: 'yxsh-error' }, `目录不存在:${check.path}`)
|
|
205
|
+
: check.files && check.turns ? h('span', null, `找到 ${num(check.files)} 个会话文件,格式对得上。如 `, h('code', null, check.sample))
|
|
206
|
+
: check.files ? h('span', { className: 'yxsh-error' }, `找到 ${num(check.files)} 个文件,但按「${fmt.label}」解析不出对话,格式可能选错了。`)
|
|
207
|
+
: h('span', { className: 'yxsh-error' }, `目录存在,但按「${fmt.label}」没找到会话文件。请确认选的是 ${fmt.dir} 这一层、格式选对了。`);
|
|
208
|
+
return h('div', { className: 'yxsh-card yxsh-form' },
|
|
209
|
+
h('div', { className: 'full' }, h('h4', null, '添加其他 agent'),
|
|
210
|
+
h('div', { className: 'yxsh-muted' }, '用于本插件未内置、但会话记录格式与上面某一家相同的 agent,或同一 agent 的另一套配置目录(多开、多账号)。添加后与内置 agent 一样整理、检索,填了技能目录也可接入技能。')),
|
|
211
|
+
h('label', null, '名称'), h('div', null, h('input', { className: 'yxsh-input', value: form.name, maxLength: 24, placeholder: '如 Qoder CLI', onChange: e => set({ name: e.target.value }) }),
|
|
212
|
+
h('div', { className: 'yxsh-muted' }, '日志里助手发言和检索时 --agent 用这个名字。')),
|
|
213
|
+
h('label', null, '会话格式'), h('div', null, h('select', { className: 'yxsh-input', value: form.format, onChange: e => set({ format: e.target.value }) },
|
|
214
|
+
...data.formats.map(f => h('option', { key: f.id, value: f.id }, f.label))),
|
|
215
|
+
h('div', { className: 'yxsh-muted' }, '它的会话记录与哪一家的格式相同。')),
|
|
216
|
+
h('label', null, '会话目录'), h('div', null, h('input', { className: 'yxsh-input', value: form.sessions, placeholder: `…/${fmt.dir}`, onChange: e => set({ sessions: e.target.value }) }),
|
|
217
|
+
h('div', { className: 'yxsh-muted' }, '填存放会话记录的 ', h('code', null, fmt.dir), ' 这一层,里面是 ', h('code', null, fmt.layout), '。例:', fmt.example, '。'),
|
|
218
|
+
verdict ? h('div', { style: { marginTop: '4px', fontSize: '12px' } }, verdict) : null),
|
|
219
|
+
h('label', null, '技能目录(可选)'), h('div', null, h('input', { className: 'yxsh-input', value: form.skills, placeholder: '如 ~/.qoder-cn/skills', onChange: e => set({ skills: e.target.value }) }),
|
|
220
|
+
h('div', { className: 'yxsh-muted' }, '这个 agent 读取技能的文件夹。填了才会出现在「技能接入」里;留空则只收录它的会话。')),
|
|
221
|
+
h('div', { className: 'full yxsh-row' },
|
|
222
|
+
h('button', { className: 'yxsh-btn', disabled: !form.sessions.trim(), onClick: probe }, '检查目录'),
|
|
223
|
+
h('button', { className: 'yxsh-btn primary', disabled: !!pending || !form.name.trim() || !form.sessions.trim(), onClick: add }, pending === 'add' ? '添加中…' : '添加'),
|
|
224
|
+
h('button', { className: 'yxsh-link', onClick: () => { setOpen(false); setCheck(null); } }, '取消')));
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function Agents({ data, pending }) {
|
|
228
|
+
const live = data.agents, ready = live.filter(a => a.state === 'ready').length, linkable = live.filter(a => a.state !== 'nodir').length;
|
|
229
|
+
return h('section', null,
|
|
230
|
+
h('div', { className: 'yxsh-head' }, h('h3', { className: 'yxsh-grow' }, 'Agents'),
|
|
231
|
+
linkable ? h('span', { className: 'yxsh-muted' }, `已接入 ${ready}/${linkable}`) : null),
|
|
232
|
+
live.length ? h('div', { className: 'yxsh-card' }, ...live.map(a => h(AgentRow, { a, pending, key: a.id })))
|
|
233
|
+
: h('div', { className: 'yxsh-card', style: { padding: '14px' } }, h('span', { className: 'yxsh-muted' }, '还没有检测到支持的 agent。装好后产生过对话就会出现在这里;也可以在下面手动添加。')),
|
|
234
|
+
live.length ? h(Access, { data, pending }) : null,
|
|
235
|
+
h('div', { className: 'yxsh-notes' },
|
|
236
|
+
data.legacy.length ? h('div', { className: 'yxsh-muted' }, `另有旧日志:${data.legacy.join('、')}(对应的 agent 已不在,日志照常检索)`) : null),
|
|
237
|
+
h(AddAgent, { data, pending }));
|
|
115
238
|
}
|
|
116
239
|
|
|
117
240
|
function Settings({ data, pending }) {
|
|
118
241
|
const c = data.config;
|
|
119
|
-
const
|
|
120
|
-
const d = draft || { userLabel: c.userLabel, timezone: c.timezone, dayStartHour: c.dayStartHour, refreshMinutes: c.refreshMinutes,
|
|
242
|
+
const initial = { userLabel: c.userLabel, timezone: c.timezone, dayStartHour: c.dayStartHour, refreshMinutes: c.refreshMinutes,
|
|
121
243
|
staleMinutes: c.staleMinutes, memoryHints: c.memoryHints, gitSnapshots: c.gitSnapshots, excludeCwds: (c.excludeCwds || []).join('\n') };
|
|
244
|
+
const [draft, setDraft] = React.useState(null);
|
|
245
|
+
const d = draft || initial;
|
|
122
246
|
const set = patch => setDraft({ ...d, ...patch });
|
|
123
|
-
const field = (label, control, hint) => h('div', { className: 'yxsh-field' }, h('label', null, label),
|
|
247
|
+
const field = (label, control, hint) => h('div', { className: 'yxsh-field' }, h('label', null, label),
|
|
248
|
+
h('div', null, control, hint ? h('div', { className: 'yxsh-muted' }, hint) : null));
|
|
124
249
|
const select = (value, options, onChange) => h('select', { className: 'yxsh-input', value, onChange: e => onChange(Number(e.target.value)) },
|
|
125
250
|
...options.map(([v, text]) => h('option', { key: v, value: v }, text)));
|
|
251
|
+
const check = (value, text, onChange) => h('label', { className: 'yxsh-switch' }, h('input', { type: 'checkbox', checked: value, onChange: e => onChange(e.target.checked) }), text);
|
|
126
252
|
const save = async () => {
|
|
127
|
-
|
|
128
|
-
if (ok) setDraft(null);
|
|
253
|
+
if (await run({ op: 'config', patch: { ...d, excludeCwds: d.excludeCwds.split('\n').map(x => x.trim()).filter(Boolean) } }, 'config')) setDraft(null);
|
|
129
254
|
};
|
|
130
255
|
return h('section', null,
|
|
131
|
-
h('h3',
|
|
132
|
-
|
|
133
|
-
'
|
|
134
|
-
|
|
135
|
-
'
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
256
|
+
h('div', { className: 'yxsh-head' }, h('h3', { className: 'yxsh-grow' }, '设置'),
|
|
257
|
+
draft ? h('button', { className: 'yxsh-btn', disabled: !!pending, onClick: () => setDraft(null) }, '还原') : null,
|
|
258
|
+
h('button', { className: 'yxsh-btn primary', disabled: !draft || !!pending, onClick: save }, pending === 'config' ? '保存中…' : '保存')),
|
|
259
|
+
h('div', { className: 'yxsh-card', style: { padding: '6px 16px' } },
|
|
260
|
+
h('div', { className: 'yxsh-group' }, h('h4', null, '整理'),
|
|
261
|
+
field('定时整理', select(d.refreshMinutes, [[0, '关闭'], [30, '每 30 分钟'], [60, '每小时整点'], [120, '每 2 小时'], [360, '每 6 小时']], v => set({ refreshMinutes: v })),
|
|
262
|
+
'DSH 开着时在后台整理,只重读有变化的会话文件,通常一两秒。'),
|
|
263
|
+
field('检索前补整理', select(d.staleMinutes, [[0, '关闭'], [10, '距上次超过 10 分钟'], [30, '距上次超过 30 分钟'], [60, '距上次超过 1 小时']], v => set({ staleMinutes: v })),
|
|
264
|
+
'DSH 没开时也能查到较新的对话:任何 agent 检索前,若距上次整理超过所选时长,先补一次。')),
|
|
265
|
+
h('div', { className: 'yxsh-group' }, h('h4', null, '日志'),
|
|
266
|
+
field('你的发言标题', h('input', { className: 'yxsh-input', value: d.userLabel, maxLength: 12, onChange: e => set({ userLabel: e.target.value }) }),
|
|
267
|
+
`日志里你的发言显示为「🧑 ${d.userLabel || '用户'}」。只影响此后整理出的内容,检索新旧写法都认。`),
|
|
268
|
+
field('日界', select(d.dayStartHour, Array.from({ length: 24 }, (_, i) => [i, `${i}:00`]), v => set({ dayStartHour: v })),
|
|
269
|
+
'此时刻之前的对话归入前一天的日志,熬夜的对话不会被拆到两天。'),
|
|
270
|
+
field('时区', h('input', { className: 'yxsh-input', value: d.timezone, placeholder: '跟随系统', onChange: e => set({ timezone: e.target.value }) }),
|
|
271
|
+
'一般留空。可填 +08:00 或 Asia/Shanghai。'),
|
|
272
|
+
field('不收录的工作目录', h('textarea', { className: 'yxsh-input', value: d.excludeCwds, placeholder: '每行一个,如 ~/scratch', onChange: e => set({ excludeCwds: e.target.value }) }),
|
|
273
|
+
'在这些目录里进行的会话不整理。临时目录本就不收。')),
|
|
274
|
+
h('div', { className: 'yxsh-group' }, h('h4', null, '检索'),
|
|
275
|
+
field('Claude Code 记忆', check(d.memoryHints, '检索时附上对题的记忆', v => set({ memoryHints: v })),
|
|
276
|
+
'列出至多 2 条相关记忆的文件名与描述,供 agent 先读这些整理过的结论。')),
|
|
277
|
+
h('div', { className: 'yxsh-group' }, h('h4', null, '备份'),
|
|
278
|
+
field('Git 快照', check(d.gitSnapshots, '每次整理后提交一次日志', v => set({ gitSnapshots: v })),
|
|
279
|
+
data.git ? '数据目录已是 Git 仓库,只提交 logs/。' : '开启时会在数据目录初始化 Git 仓库(只收 logs/);需要装有 Git。'))));
|
|
148
280
|
}
|
|
149
281
|
|
|
150
282
|
function Panel({ view }) {
|
|
151
|
-
const s =
|
|
152
|
-
|
|
283
|
+
const s = useStore();
|
|
284
|
+
const busy = !!(s.data?.running || s.pending === 'refresh');
|
|
285
|
+
// 打开期间定时重读:后台定时整理、别的 agent 检索前补整理都会改状态;整理进行中读得更勤。
|
|
286
|
+
React.useEffect(() => {
|
|
287
|
+
load();
|
|
288
|
+
const timer = setInterval(() => { if (!state.getSnapshot().pending) load(); }, busy ? 3000 : 15000);
|
|
289
|
+
return () => clearInterval(timer);
|
|
290
|
+
}, [busy]);
|
|
153
291
|
if (view && view !== 'page') return null;
|
|
154
292
|
if (s.loading && !s.data) return h('div', { className: 'yxsh yxsh-muted' }, h('style', null, css), '读取中…');
|
|
155
293
|
if (!s.data) return h('div', { className: 'yxsh' }, h('style', null, css), h('p', { className: 'yxsh-error' }, s.error || '读取失败'),
|
|
156
294
|
h('button', { className: 'yxsh-btn', onClick: load }, '重试'));
|
|
157
295
|
const data = s.data;
|
|
158
296
|
return h('div', { className: 'yxsh' }, h('style', null, css),
|
|
159
|
-
h('
|
|
160
|
-
|
|
161
|
-
h('div', { className: 'yxsh-grow' },
|
|
162
|
-
h('div', null, '数据目录 ', h('code', null, data.home), h('span', { className: 'yxsh-muted' }, '(日志、索引、设置都在这里,与插件分开存放:卸载、更新、重装都不动它)')),
|
|
163
|
-
h('div', { className: 'yxsh-muted' }, '最近整理:', fmtRun(data.last))),
|
|
164
|
-
h('button', { className: 'yxsh-btn', onClick: () => run({ op: 'open' }, 'open'), disabled: !!s.pending }, '打开目录'),
|
|
165
|
-
h('button', { className: 'yxsh-btn primary', onClick: () => run({ op: 'refresh' }, 'refresh'), disabled: !!s.pending || data.running },
|
|
166
|
-
s.pending === 'refresh' || data.running ? '整理中…' : '立即整理')),
|
|
167
|
-
s.error ? h('p', { className: 'yxsh-error', role: 'alert' }, s.error) : null),
|
|
297
|
+
s.error ? h('div', { className: 'yxsh-error', role: 'alert' }, s.error) : null,
|
|
298
|
+
h(Home, { data, pending: s.pending }),
|
|
168
299
|
h(Agents, { data, pending: s.pending }),
|
|
169
300
|
h(Settings, { data, pending: s.pending, key: JSON.stringify(data.config) }),
|
|
170
|
-
h('section', null, h('details', null, h('summary', null, 'SKILL.md
|
|
301
|
+
h('section', null, h('details', null, h('summary', null, 'SKILL.md'),
|
|
302
|
+
h('div', { className: 'yxsh-muted', style: { marginTop: '6px' } }, '按检测到的 agent 自动生成,各 agent 读的就是这一份。'),
|
|
171
303
|
h('pre', { className: 'yxsh-pre' }, data.skill))));
|
|
172
304
|
}
|
|
173
305
|
|
package/icon.svg
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
|
|
2
|
-
<circle cx="32" cy="32" r="28" fill="#
|
|
3
|
-
<path d="
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<path d="M12 7v5l4 2"/>
|
|
8
|
-
</g>
|
|
2
|
+
<circle cx="32" cy="32" r="28" fill="#1F2A44"/>
|
|
3
|
+
<path d="M27 14H45A4 4 0 0 1 49 18V27A4 4 0 0 1 45 31H27A4 4 0 0 1 23 27V18A4 4 0 0 1 27 14Z" fill="#4285F4"/>
|
|
4
|
+
<path d="M23 21H41A4 4 0 0 1 45 25V34A4 4 0 0 1 41 38H23A4 4 0 0 1 19 34V25A4 4 0 0 1 23 21Z" fill="#10A37F"/>
|
|
5
|
+
<path d="M19 28H37A4 4 0 0 1 41 32V42A4 4 0 0 1 37 46H25L19.5 50.5V46A4 4 0 0 1 15 42V32A4 4 0 0 1 19 28Z" fill="#FFFFFF"/>
|
|
6
|
+
<path d="M20.5 34.5H35.5M20.5 39.5H30" stroke="#1F2A44" stroke-width="2.6" stroke-linecap="round"/>
|
|
9
7
|
</svg>
|
package/index.js
CHANGED
|
@@ -4,10 +4,11 @@ import { spawn } from 'node:child_process';
|
|
|
4
4
|
import { existsSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { resolveHome, loadConfig, saveConfig, layout, readJson } from './lib/config.js';
|
|
7
|
-
import { SOURCES, enabled, byId } from './lib/agents.js';
|
|
7
|
+
import { SOURCES, FORMATS, enabled, byId, allSources, customSource, folderFor } from './lib/agents.js';
|
|
8
8
|
import { installSkill, skillMarkdown, logFolders, findNode, ENGINE, VERSION } from './lib/skill.js';
|
|
9
|
-
import { skillStatus,
|
|
10
|
-
import { tilde } from './lib/files.js';
|
|
9
|
+
import { skillStatus, linkTarget, linkAll, unlinkTarget } from './lib/links.js';
|
|
10
|
+
import { tilde, expand, isDir } from './lib/files.js';
|
|
11
|
+
import { scan } from './lib/scan.js';
|
|
11
12
|
|
|
12
13
|
export const name = 'session-history';
|
|
13
14
|
export const ROUTE = '/youxia-session-history/api';
|
|
@@ -75,22 +76,45 @@ export function createRunner(home, { node = findNode(), engine = ENGINE } = {})
|
|
|
75
76
|
|
|
76
77
|
export function snapshot(home, runner) {
|
|
77
78
|
const config = loadConfig(home);
|
|
78
|
-
const
|
|
79
|
-
const
|
|
79
|
+
const last = readJson(layout(home).status, null);
|
|
80
|
+
const status = skillStatus(home, config);
|
|
81
|
+
const sources = new Map(allSources(config).map(source => [source.id, source]));
|
|
82
|
+
const shown = status.agents.filter(a => a.installed || a.custom).map(a => {
|
|
83
|
+
const source = sources.get(a.id);
|
|
84
|
+
const run = last?.agents?.[a.folder] || null;
|
|
85
|
+
return { ...a, enabled: enabled(source, config), sessions: (roots => roots.filter(isDir).map(tilde).join('、') || tilde(roots[0]))(source.locate(process.env, config.agents?.[a.id] || {}).roots),
|
|
86
|
+
run: run && { ok: run.ok, files: run.files, days: run.days, error: run.error || null },
|
|
87
|
+
...(a.custom ? { def: config.custom.find(c => c.id === a.id) } : {}) };
|
|
88
|
+
});
|
|
89
|
+
// 只剩旧日志:日志文件夹对应的 agent 不在列表里(已卸载,或来自不再支持的来源)。新用户一般没有。
|
|
90
|
+
const listed = new Set(shown.map(a => a.folder));
|
|
80
91
|
return {
|
|
81
|
-
version: VERSION,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
running: runner?.running ?? false,
|
|
87
|
-
agents,
|
|
88
|
-
legacy: logFolders(home).filter(f => !known.has(f)),
|
|
92
|
+
version: VERSION, home: tilde(home), homeAbs: home, config, last, running: runner?.running ?? false,
|
|
93
|
+
agents: shown,
|
|
94
|
+
targets: status.targets, links: status.links, conflicts: status.conflicts,
|
|
95
|
+
legacy: logFolders(home).filter(f => !listed.has(f)),
|
|
96
|
+
formats: Object.entries(FORMATS).map(([id, f]) => ({ id, label: f.label, dir: f.dir, layout: f.layout, example: f.example })),
|
|
89
97
|
git: existsSync(join(home, '.git')),
|
|
90
98
|
skill: skillMarkdown(home, { config }),
|
|
91
99
|
};
|
|
92
100
|
}
|
|
93
101
|
|
|
102
|
+
/** 检查自定义 agent 的会话目录:存在与否、按所选格式能找到几个会话文件。 */
|
|
103
|
+
export function probe(format, sessions) {
|
|
104
|
+
if (!FORMATS[format]) throw invalid('未知的会话格式');
|
|
105
|
+
const path = expand(String(sessions || '').trim());
|
|
106
|
+
if (!path) throw invalid('请填写会话目录');
|
|
107
|
+
if (!isDir(path)) return { exists: false, files: 0, path: tilde(path) };
|
|
108
|
+
const source = customSource({ id: 'probe', folder: 'probe', name: 'probe', format, sessions: path });
|
|
109
|
+
const files = source.files(source.locate());
|
|
110
|
+
// 只看文件名分不出格式(几家的目录结构相近),抽几个实际解析,能解析出对话才算对。
|
|
111
|
+
let turns = 0;
|
|
112
|
+
for (const file of files.slice(0, 5)) {
|
|
113
|
+
try { const data = source.parse(file); turns += (data.turns || data.records || []).length; } catch { /* 解析失败按 0 计 */ }
|
|
114
|
+
}
|
|
115
|
+
return { exists: true, files: files.length, turns, path: tilde(path), sample: files[0] ? tilde(files[0]) : null };
|
|
116
|
+
}
|
|
117
|
+
|
|
94
118
|
function gitInit(home) {
|
|
95
119
|
if (existsSync(join(home, '.git'))) return;
|
|
96
120
|
return new Promise((resolve, reject) => {
|
|
@@ -121,11 +145,29 @@ export async function command(home, runner, input) {
|
|
|
121
145
|
if (!r.ok) throw invalid(`整理失败:${r.error || '见状态'}`, 500);
|
|
122
146
|
return snapshot(home, runner);
|
|
123
147
|
}
|
|
124
|
-
case '
|
|
148
|
+
case 'linkTarget': linkTarget(home, String(input.key), config); break;
|
|
125
149
|
case 'linkAll': linkAll(home, config); break;
|
|
126
|
-
case '
|
|
150
|
+
case 'unlinkTarget': unlinkTarget(home, String(input.key), config); break;
|
|
151
|
+
case 'probe': return { probe: probe(input.format, input.sessions) };
|
|
152
|
+
case 'scan': return { ...snapshot(home, runner), found: scan(config) };
|
|
153
|
+
case 'addCustom': {
|
|
154
|
+
const name = String(input.name || '').trim();
|
|
155
|
+
if (!name || name.length > 24 || /[\n#]/.test(name)) throw invalid('名称须为 1–24 个字,不含 # 与换行');
|
|
156
|
+
const result = probe(input.format, input.sessions);
|
|
157
|
+
if (!result.exists) throw invalid(`会话目录不存在:${result.path}`);
|
|
158
|
+
const def = { name, format: input.format, sessions: String(input.sessions).trim(), ...(input.skills?.trim() ? { skills: input.skills.trim() } : {}) };
|
|
159
|
+
saveConfig(home, { custom: [...config.custom, def] });
|
|
160
|
+
installSkill(home);
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case 'removeCustom': {
|
|
164
|
+
if (!config.custom.some(c => c.id === input.id)) throw invalid('没有这个自定义 agent');
|
|
165
|
+
saveConfig(home, { custom: config.custom.filter(c => c.id !== input.id) });
|
|
166
|
+
installSkill(home);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
127
169
|
case 'enable': {
|
|
128
|
-
if (!byId(input.agent) || typeof input.enabled !== 'boolean') throw invalid('参数无效');
|
|
170
|
+
if (!byId(input.agent, config) || typeof input.enabled !== 'boolean') throw invalid('参数无效');
|
|
129
171
|
saveConfig(home, { agents: { [input.agent]: { enabled: input.enabled } } });
|
|
130
172
|
installSkill(home);
|
|
131
173
|
break;
|