dsh-tool-manager 1.1.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/CHANGELOG.md +24 -0
- package/DESIGN.md +228 -0
- package/LICENSE +21 -0
- package/README.md +201 -0
- package/cordis.patch.yml +4 -0
- package/dist/catalog.d.ts +44 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +166 -0
- package/dist/catalog.js.map +1 -0
- package/dist/client.js +581 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +107 -0
- package/dist/config.js.map +1 -0
- package/dist/dsh.d.ts +108 -0
- package/dist/dsh.d.ts.map +1 -0
- package/dist/dsh.js +7 -0
- package/dist/dsh.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +140 -0
- package/dist/index.js.map +1 -0
- package/dist/policy.d.ts +23 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +167 -0
- package/dist/policy.js.map +1 -0
- package/dist/runtime.d.ts +29 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +276 -0
- package/dist/runtime.js.map +1 -0
- package/dist/snapshot.d.ts +4 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +48 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/stats.d.ts +10 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +29 -0
- package/dist/stats.js.map +1 -0
- package/dist/suggest.d.ts +34 -0
- package/dist/suggest.d.ts.map +1 -0
- package/dist/suggest.js +290 -0
- package/dist/suggest.js.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "dsh-tool-manager",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
const react = require("react");
|
|
8
|
+
const reactDom = require("react-dom");
|
|
9
|
+
const h = react.createElement;
|
|
10
|
+
const inject = ["slots"];
|
|
11
|
+
|
|
12
|
+
const css = [
|
|
13
|
+
".tm_root{display:flex;flex-direction:column;gap:14px;max-width:1040px;padding:2px 0 30px;color:var(--dsw-alias-label-primary,#e7e9ed)}",
|
|
14
|
+
".tm_head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}",
|
|
15
|
+
".tm_head h2{font-size:18px;margin:0 0 5px}.tm_muted{color:var(--dsw-alias-label-secondary,#9097a4);font-size:12px;line-height:1.5}",
|
|
16
|
+
".tm_preset_picker{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.tm_preset_picker label{font-size:12px;color:var(--dsw-alias-label-secondary,#9097a4)}.tm_preset_select,.tm_btn{appearance:none;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.28));border-radius:8px;background:var(--dsw-alias-bg-layer-1,rgba(128,128,128,.08));color:inherit;padding:7px 10px;font:inherit;font-size:12px}.tm_preset_select{min-width:min(360px,100%);cursor:pointer}.tm_preset_select option{background:var(--dsw-alias-bg-base,#17191d);color:inherit}.tm_btn{cursor:pointer}.tm_btn.primary{background:#5367e8;border-color:#5367e8;color:#fff}.tm_btn:disabled{opacity:.5;cursor:not-allowed}",
|
|
17
|
+
".tm_panel{border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.24));border-radius:12px;background:var(--dsw-alias-bg-layer-1,rgba(128,128,128,.06));overflow:hidden}",
|
|
18
|
+
".tm_panel_head{padding:13px 14px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap}.tm_panel_head b{font-size:14px}",
|
|
19
|
+
".tm_tools{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:0}.tm_tool{display:flex;gap:10px;align-items:flex-start;padding:11px 14px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.13))}.tm_tool_name{font:600 12px ui-monospace,SFMono-Regular,Consolas,monospace}.tm_tool_desc{font-size:11px;color:var(--dsw-alias-label-secondary,#9097a4);line-height:1.4;margin-top:3px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}",
|
|
20
|
+
".tm_row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.tm_input{box-sizing:border-box;min-width:130px;flex:1;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.3));border-radius:7px;background:var(--dsw-alias-bg-base,#17191d);color:inherit;padding:7px 9px;font:inherit;font-size:12px}.tm_code{font:11px ui-monospace,SFMono-Regular,Consolas,monospace;color:#9da8ff}.tm_notice{padding:12px;border-radius:9px;background:color-mix(in srgb,#f59e0b 12%,transparent);font-size:12px}.tm_error{padding:12px;border-radius:9px;background:color-mix(in srgb,#ef4444 12%,transparent);color:#fca5a5;font-size:12px}",
|
|
21
|
+
".tm_filters{display:flex;gap:6px;flex-wrap:wrap;align-items:center}.tm_chip{appearance:none;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.28));border-radius:999px;background:transparent;color:inherit;padding:4px 9px;cursor:pointer;font:inherit;font-size:11px}.tm_chip.active{border-color:#7c8cff;background:color-mix(in srgb,#7c8cff 16%,transparent)}",
|
|
22
|
+
".tm_stats{display:grid;grid-template-columns:repeat(5,minmax(100px,1fr));gap:8px;padding:10px 14px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.13))}.tm_stat{min-width:0;padding:9px 10px;border-radius:8px;background:var(--dsw-alias-bg-layer-1,rgba(128,128,128,.07));border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.15))}.tm_stat_value{font-size:18px;font-weight:700;line-height:1.2}.tm_stat_label{margin-top:3px;font-size:11px;color:var(--dsw-alias-label-secondary,#9097a4)}@media(max-width:720px){.tm_stats{grid-template-columns:repeat(2,minmax(100px,1fr))}}",
|
|
23
|
+
".tm_badge{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:999px;font-size:10px;vertical-align:middle}.tm_badge.off{background:color-mix(in srgb,#ef4444 18%,transparent);color:#fca5a5}.tm_badge.cold{background:color-mix(in srgb,#6366f1 18%,transparent);color:#c7d2fe}.tm_badge.live{background:color-mix(in srgb,#22c55e 16%,transparent);color:#86efac}",
|
|
24
|
+
".tm_group{border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.13))}.tm_group:last-child{border-bottom:0}",
|
|
25
|
+
".tm_group_bar{display:flex;align-items:center;gap:8px;padding:11px 14px}",
|
|
26
|
+
".tm_chevron{appearance:none;border:0;background:transparent;color:inherit;width:28px;height:28px;border-radius:7px;cursor:pointer;font:16px/1 inherit;flex:0 0 auto}.tm_chevron:hover{background:var(--dsw-alias-bg-layer-1,rgba(128,128,128,.1))}",
|
|
27
|
+
".tm_group_main{appearance:none;border:0;background:transparent;color:inherit;text-align:left;flex:1;min-width:0;cursor:pointer;padding:0}",
|
|
28
|
+
".tm_group_title{font-size:13px;font-weight:600;line-height:1.3}.tm_group_sub{font-size:11px;color:var(--dsw-alias-label-secondary,#9097a4);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
29
|
+
".tm_group_count{flex:0 0 auto;font-size:12px;color:var(--dsw-alias-label-secondary,#9097a4)}",
|
|
30
|
+
".tm_group_body{padding:0 14px 12px 50px}",
|
|
31
|
+
".tm_member{padding:7px 0;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.08))}.tm_member:last-child{border-bottom:0}",
|
|
32
|
+
".tm_modal{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:24px}",
|
|
33
|
+
".tm_modal_mask{position:absolute;inset:0;background:rgba(0,0,0,.55)}",
|
|
34
|
+
".tm_modal_card{position:relative;z-index:1;width:min(720px,100%);max-height:min(84vh,760px);display:flex;flex-direction:column;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.28));border-radius:14px;background:var(--dsw-alias-bg-base,#17191d);box-shadow:0 24px 80px rgba(0,0,0,.45)}",
|
|
35
|
+
".tm_modal_head{padding:16px 16px 12px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.tm_modal_head h3{margin:0;font-size:16px}",
|
|
36
|
+
".tm_modal_body{padding:0 16px 12px;display:flex;flex-direction:column;gap:10px;min-height:0;flex:1;overflow:auto}",
|
|
37
|
+
".tm_modal_foot{padding:12px 16px 16px;display:flex;justify-content:flex-end;gap:8px;border-top:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.18))}",
|
|
38
|
+
".tm_picker{min-height:180px;max-height:min(46vh,420px);overflow:auto;border:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.18));border-radius:8px;background:var(--dsw-alias-bg-layer-1,rgba(128,128,128,.06))}",
|
|
39
|
+
".tm_pick{display:flex;gap:8px;align-items:flex-start;padding:8px 10px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.1))}.tm_pick:last-child{border-bottom:0}",
|
|
40
|
+
].join("");
|
|
41
|
+
|
|
42
|
+
function installCss() {
|
|
43
|
+
if (typeof document === "undefined") return;
|
|
44
|
+
const old = document.querySelector('style[data-plugin-css="dsh-tool-manager"]');
|
|
45
|
+
if (old) { old.textContent = css; return; }
|
|
46
|
+
const tag = document.createElement("style");
|
|
47
|
+
tag.dataset.pluginCss = "dsh-tool-manager";
|
|
48
|
+
tag.textContent = css;
|
|
49
|
+
document.head.appendChild(tag);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function api(path, options) {
|
|
53
|
+
return fetch("/tool-manager/api" + path, {
|
|
54
|
+
headers: { "Content-Type": "application/json" },
|
|
55
|
+
...options,
|
|
56
|
+
}).then(async (response) => {
|
|
57
|
+
const body = await response.json().catch(() => ({}));
|
|
58
|
+
if (!response.ok) throw new Error(body.message || "HTTP " + response.status);
|
|
59
|
+
return body;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function clone(value) { return JSON.parse(JSON.stringify(value)); }
|
|
64
|
+
function newKey() { return "g-" + Math.random().toString(36).slice(2, 10); }
|
|
65
|
+
function withGroupKeys(value) {
|
|
66
|
+
const next = clone(value);
|
|
67
|
+
for (const item of next.presets || []) {
|
|
68
|
+
for (const group of item.policy.groups || []) {
|
|
69
|
+
if (!group._key) group._key = newKey();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return next;
|
|
73
|
+
}
|
|
74
|
+
function policyPayload(policy) {
|
|
75
|
+
return {
|
|
76
|
+
disabled: [...(policy.disabled || [])],
|
|
77
|
+
groups: (policy.groups || []).map((group) => ({
|
|
78
|
+
name: group.name,
|
|
79
|
+
...(group.description ? { description: group.description } : {}),
|
|
80
|
+
patterns: [...(group.patterns || [])],
|
|
81
|
+
})),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function settingsPayload(value) {
|
|
85
|
+
const settings = { presets: {} };
|
|
86
|
+
for (const item of value && value.presets || []) settings.presets[item.id] = policyPayload(item.policy);
|
|
87
|
+
return settings;
|
|
88
|
+
}
|
|
89
|
+
function settingsSignature(value) {
|
|
90
|
+
return JSON.stringify(settingsPayload(value));
|
|
91
|
+
}
|
|
92
|
+
function matchesPattern(value, pattern) {
|
|
93
|
+
if (!pattern.includes("*")) return value === pattern;
|
|
94
|
+
const escaped = pattern.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*");
|
|
95
|
+
return new RegExp("^" + escaped + "$").test(value);
|
|
96
|
+
}
|
|
97
|
+
function matchingTools(tools, patterns) {
|
|
98
|
+
return (tools || []).filter((tool) => (patterns || []).some((pattern) => matchesPattern(tool.name, pattern)));
|
|
99
|
+
}
|
|
100
|
+
function groupedNames(preset) {
|
|
101
|
+
const names = new Set();
|
|
102
|
+
for (const group of preset.policy.groups || []) {
|
|
103
|
+
for (const tool of matchingTools(preset.tools, group.patterns)) names.add(tool.name);
|
|
104
|
+
}
|
|
105
|
+
return names;
|
|
106
|
+
}
|
|
107
|
+
function catalogStats(preset) {
|
|
108
|
+
const disabled = new Set(preset.policy.disabled || []);
|
|
109
|
+
const grouped = groupedNames(preset);
|
|
110
|
+
let ungroupedTools = 0;
|
|
111
|
+
let onDemandTools = 0;
|
|
112
|
+
let disabledTools = 0;
|
|
113
|
+
for (const tool of preset.tools || []) {
|
|
114
|
+
if (disabled.has(tool.name)) disabledTools += 1;
|
|
115
|
+
else if (grouped.has(tool.name)) onDemandTools += 1;
|
|
116
|
+
else ungroupedTools += 1;
|
|
117
|
+
}
|
|
118
|
+
return { totalTools: (preset.tools || []).length, groupCount: (preset.policy.groups || []).length, ungroupedTools, onDemandTools, disabledTools };
|
|
119
|
+
}
|
|
120
|
+
function matchesQuery(tool, needle) {
|
|
121
|
+
if (!needle) return true;
|
|
122
|
+
return tool.name.toLowerCase().includes(needle) || (tool.description || "").toLowerCase().includes(needle);
|
|
123
|
+
}
|
|
124
|
+
function nextGroupName(groups) {
|
|
125
|
+
let i = (groups || []).length + 1;
|
|
126
|
+
let name = "分组 " + i;
|
|
127
|
+
while ((groups || []).some((group) => String(group.name || "").toLowerCase() === name.toLowerCase())) name = "分组 " + (++i);
|
|
128
|
+
return name;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function ToolManagerSection() {
|
|
132
|
+
const [snapshot, setSnapshot] = react.useState(null);
|
|
133
|
+
const [draft, setDraft] = react.useState(null);
|
|
134
|
+
const [active, setActive] = react.useState("");
|
|
135
|
+
const [busy, setBusy] = react.useState(false);
|
|
136
|
+
const [error, setError] = react.useState("");
|
|
137
|
+
const [message, setMessage] = react.useState("");
|
|
138
|
+
const [query, setQuery] = react.useState("");
|
|
139
|
+
const [filter, setFilter] = react.useState("all");
|
|
140
|
+
const [modal, setModal] = react.useState(null);
|
|
141
|
+
const [autoGrouping, setAutoGrouping] = react.useState(false);
|
|
142
|
+
const [autoGroupError, setAutoGroupError] = react.useState("");
|
|
143
|
+
const [autoPreview, setAutoPreview] = react.useState(null);
|
|
144
|
+
const [expanded, setExpanded] = react.useState({});
|
|
145
|
+
|
|
146
|
+
const load = react.useCallback(() => {
|
|
147
|
+
setBusy(true); setError("");
|
|
148
|
+
return api("/snapshot").then((value) => {
|
|
149
|
+
const next = withGroupKeys(value);
|
|
150
|
+
setSnapshot(value); setDraft(next); setModal(null); setAutoPreview(null); setAutoGroupError("");
|
|
151
|
+
setActive((current) => current && value.presets.some((p) => p.id === current) ? current : (value.presets[0] && value.presets[0].id) || "");
|
|
152
|
+
}).catch((e) => setError(String(e.message || e))).finally(() => setBusy(false));
|
|
153
|
+
}, []);
|
|
154
|
+
react.useEffect(() => { load(); }, [load]);
|
|
155
|
+
const dirty = !!(snapshot && draft && settingsSignature(snapshot) !== settingsSignature(draft));
|
|
156
|
+
react.useEffect(() => {
|
|
157
|
+
if (!dirty) return undefined;
|
|
158
|
+
function onBeforeUnload(event) {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
event.returnValue = "";
|
|
161
|
+
}
|
|
162
|
+
window.addEventListener("beforeunload", onBeforeUnload);
|
|
163
|
+
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
164
|
+
}, [dirty]);
|
|
165
|
+
react.useEffect(() => {
|
|
166
|
+
if (!modal) return undefined;
|
|
167
|
+
function onKeyDown(event) {
|
|
168
|
+
if (event.key === "Escape") setModal(null);
|
|
169
|
+
}
|
|
170
|
+
window.addEventListener("keydown", onKeyDown);
|
|
171
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
172
|
+
}, [modal]);
|
|
173
|
+
|
|
174
|
+
if (!draft) return h("div", { className: "tm_root" }, error ? h("div", { className: "tm_error" }, error) : h("div", { className: "tm_muted" }, "正在读取工具目录…"));
|
|
175
|
+
const preset = draft.presets.find((item) => item.id === active) || draft.presets[0];
|
|
176
|
+
if (!preset) return h("div", { className: "tm_notice" }, "没有可用的 Agent Preset。");
|
|
177
|
+
|
|
178
|
+
function mutatePreset(mutator) {
|
|
179
|
+
setDraft((current) => {
|
|
180
|
+
const next = clone(current);
|
|
181
|
+
const target = next.presets.find((item) => item.id === preset.id);
|
|
182
|
+
mutator(target, next);
|
|
183
|
+
return next;
|
|
184
|
+
});
|
|
185
|
+
setMessage("");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function toggleTool(name) {
|
|
189
|
+
mutatePreset((target) => {
|
|
190
|
+
const disabled = new Set(target.policy.disabled || []);
|
|
191
|
+
if (disabled.has(name)) disabled.delete(name); else disabled.add(name);
|
|
192
|
+
target.policy.disabled = [...disabled];
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function openCreate() {
|
|
197
|
+
setModal({
|
|
198
|
+
mode: "create",
|
|
199
|
+
key: newKey(),
|
|
200
|
+
name: nextGroupName(preset.policy.groups),
|
|
201
|
+
description: "",
|
|
202
|
+
patterns: [],
|
|
203
|
+
query: "",
|
|
204
|
+
generating: false,
|
|
205
|
+
generateError: "",
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function openEdit(group) {
|
|
210
|
+
setModal({
|
|
211
|
+
mode: "edit",
|
|
212
|
+
key: group._key,
|
|
213
|
+
name: group.name || "",
|
|
214
|
+
description: group.description || "",
|
|
215
|
+
patterns: [...(group.patterns || [])],
|
|
216
|
+
query: "",
|
|
217
|
+
generating: false,
|
|
218
|
+
generateError: "",
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function deleteGroup(key) {
|
|
223
|
+
mutatePreset((target) => {
|
|
224
|
+
target.policy.groups = (target.policy.groups || []).filter((group) => group._key !== key);
|
|
225
|
+
});
|
|
226
|
+
setExpanded((current) => { const next = { ...current }; delete next[key]; return next; });
|
|
227
|
+
setModal((current) => current && current.key === key ? null : current);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function patchModal(patch) {
|
|
231
|
+
setModal((current) => current ? { ...current, ...patch } : current);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function generateGroupDetails() {
|
|
235
|
+
if (!modal || modal.generating || !(modal.patterns || []).length) return;
|
|
236
|
+
const key = modal.key;
|
|
237
|
+
const otherGroupNames = (preset.policy.groups || [])
|
|
238
|
+
.filter((group) => group._key !== key)
|
|
239
|
+
.map((group) => group.name)
|
|
240
|
+
.filter(Boolean);
|
|
241
|
+
const toolNames = matchingTools(preset.tools, modal.patterns || []).map((tool) => tool.name);
|
|
242
|
+
if (!toolNames.length) {
|
|
243
|
+
patchModal({ generateError: "所选模式当前没有匹配到工具,请重新勾选。" });
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
patchModal({ generating: true, generateError: "" });
|
|
247
|
+
api("/suggest-group", {
|
|
248
|
+
method: "POST",
|
|
249
|
+
body: JSON.stringify({ presetId: preset.id, toolNames, otherGroupNames }),
|
|
250
|
+
}).then((suggestion) => {
|
|
251
|
+
setModal((current) => current && current.key === key
|
|
252
|
+
? { ...current, name: suggestion.name || current.name, description: suggestion.description || current.description, generating: false, generateError: "" }
|
|
253
|
+
: current);
|
|
254
|
+
}).catch((e) => {
|
|
255
|
+
setModal((current) => current && current.key === key
|
|
256
|
+
? { ...current, generating: false, generateError: String(e.message || e) }
|
|
257
|
+
: current);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function confirmModal() {
|
|
262
|
+
if (!modal) return;
|
|
263
|
+
const name = String(modal.name || "").trim().replace(/\s+/g, " ");
|
|
264
|
+
const description = String(modal.description || "").trim();
|
|
265
|
+
const patterns = [...new Set(modal.patterns || [])];
|
|
266
|
+
if (!name) return;
|
|
267
|
+
const created = modal.mode === "create";
|
|
268
|
+
const key = modal.key;
|
|
269
|
+
mutatePreset((target) => {
|
|
270
|
+
if (!Array.isArray(target.policy.groups)) target.policy.groups = [];
|
|
271
|
+
const clash = target.policy.groups.some((item) => item._key !== key && String(item.name || "").toLowerCase() === name.toLowerCase());
|
|
272
|
+
if (clash) return;
|
|
273
|
+
if (created) {
|
|
274
|
+
target.policy.groups.push({ _key: key, name, description, patterns });
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const group = target.policy.groups.find((item) => item._key === key);
|
|
278
|
+
if (!group) return;
|
|
279
|
+
group.name = name;
|
|
280
|
+
group.description = description;
|
|
281
|
+
group.patterns = patterns;
|
|
282
|
+
});
|
|
283
|
+
setModal(null);
|
|
284
|
+
if (created) setExpanded((current) => ({ ...current, [key]: true }));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function autoGroupSignature(toolNames) {
|
|
288
|
+
return preset.id + "\n" + [...toolNames].sort().join("\n");
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function startAutoGroup() {
|
|
292
|
+
if (autoGrouping) return;
|
|
293
|
+
const disabledNames = new Set(preset.policy.disabled || []);
|
|
294
|
+
const alreadyGrouped = groupedNames(preset);
|
|
295
|
+
const candidates = (preset.tools || []).filter((tool) => !disabledNames.has(tool.name) && !alreadyGrouped.has(tool.name));
|
|
296
|
+
if (!candidates.length) {
|
|
297
|
+
setAutoGroupError("当前没有未分组且未关闭的工具。");
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const toolNames = candidates.map((tool) => tool.name);
|
|
301
|
+
const signature = autoGroupSignature(toolNames);
|
|
302
|
+
setAutoGrouping(true); setAutoGroupError(""); setAutoPreview(null);
|
|
303
|
+
api("/auto-group", {
|
|
304
|
+
method: "POST",
|
|
305
|
+
body: JSON.stringify({
|
|
306
|
+
presetId: preset.id,
|
|
307
|
+
toolNames,
|
|
308
|
+
otherGroupNames: (preset.policy.groups || []).map((group) => group.name).filter(Boolean),
|
|
309
|
+
}),
|
|
310
|
+
}).then((result) => {
|
|
311
|
+
setAutoPreview({ presetId: preset.id, signature, groups: result.groups || [], ungrouped: result.ungrouped || [] });
|
|
312
|
+
}).catch((e) => setAutoGroupError(String(e.message || e))).finally(() => setAutoGrouping(false));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function applyAutoGroups() {
|
|
316
|
+
if (!autoPreview || autoPreview.presetId !== preset.id) return;
|
|
317
|
+
const disabledNames = new Set(preset.policy.disabled || []);
|
|
318
|
+
const alreadyGrouped = groupedNames(preset);
|
|
319
|
+
const currentCandidates = (preset.tools || []).filter((tool) => !disabledNames.has(tool.name) && !alreadyGrouped.has(tool.name)).map((tool) => tool.name);
|
|
320
|
+
if (autoPreview.signature !== autoGroupSignature(currentCandidates)) {
|
|
321
|
+
setAutoPreview(null);
|
|
322
|
+
setAutoGroupError("工具或分组草稿已经变化,请重新自动分组。");
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const addedKeys = [];
|
|
326
|
+
mutatePreset((target) => {
|
|
327
|
+
if (!Array.isArray(target.policy.groups)) target.policy.groups = [];
|
|
328
|
+
for (const group of autoPreview.groups) {
|
|
329
|
+
const key = newKey();
|
|
330
|
+
addedKeys.push(key);
|
|
331
|
+
target.policy.groups.push({ _key: key, name: group.name, description: group.description, patterns: [...group.tools] });
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
setExpanded((current) => {
|
|
335
|
+
const next = { ...current };
|
|
336
|
+
for (const key of addedKeys) next[key] = true;
|
|
337
|
+
return next;
|
|
338
|
+
});
|
|
339
|
+
setAutoPreview(null); setAutoGroupError("");
|
|
340
|
+
setMessage("自动分组已加入草稿;检查后请点击保存。");
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function reload() {
|
|
344
|
+
if (dirty && !window.confirm("当前有未保存的修改,刷新会丢弃这些修改。确定继续吗?")) return;
|
|
345
|
+
load();
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function save() {
|
|
349
|
+
const settings = settingsPayload(draft);
|
|
350
|
+
setBusy(true); setError(""); setMessage("");
|
|
351
|
+
api("/save", { method: "POST", body: JSON.stringify({ expectedRevision: snapshot.revision, settings }) })
|
|
352
|
+
.then((value) => {
|
|
353
|
+
const next = withGroupKeys(value);
|
|
354
|
+
setSnapshot(value); setDraft(next); setModal(null);
|
|
355
|
+
setMessage("已保存;运行中 Agent 将从下一个模型步骤应用新策略。");
|
|
356
|
+
})
|
|
357
|
+
.catch((e) => setError(String(e.message || e)))
|
|
358
|
+
.finally(() => setBusy(false));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const disabled = new Set(preset.policy.disabled || []);
|
|
362
|
+
const grouped = groupedNames(preset);
|
|
363
|
+
const autoGroupCandidates = (preset.tools || []).filter((tool) => !disabled.has(tool.name) && !grouped.has(tool.name));
|
|
364
|
+
const stats = catalogStats(preset);
|
|
365
|
+
const needle = query.trim().toLowerCase();
|
|
366
|
+
const groups = preset.policy.groups || [];
|
|
367
|
+
const visibleGroups = groups.filter((group) => {
|
|
368
|
+
const title = String(group.name || "").toLowerCase();
|
|
369
|
+
const description = String(group.description || "").toLowerCase();
|
|
370
|
+
const members = matchingTools(preset.tools, group.patterns);
|
|
371
|
+
if (!needle) return true;
|
|
372
|
+
return title.includes(needle) || description.includes(needle) || members.some((tool) => matchesQuery(tool, needle));
|
|
373
|
+
});
|
|
374
|
+
const showGroups = filter === "all" || filter === "cold";
|
|
375
|
+
const visibleTools = (preset.tools || []).filter((tool) => {
|
|
376
|
+
if (filter === "cold") return false;
|
|
377
|
+
if (!matchesQuery(tool, needle)) return false;
|
|
378
|
+
if (filter === "disabled") return disabled.has(tool.name);
|
|
379
|
+
if (filter === "live") return !disabled.has(tool.name) && !grouped.has(tool.name);
|
|
380
|
+
return !grouped.has(tool.name);
|
|
381
|
+
});
|
|
382
|
+
const orphans = (preset.policy.disabled || []).filter((name) => !(preset.tools || []).some((tool) => tool.name === name));
|
|
383
|
+
const modalNeedle = String(modal && modal.query || "").trim().toLowerCase();
|
|
384
|
+
const modalSelected = new Set(modal ? modal.patterns || [] : []);
|
|
385
|
+
const pickerTools = modal ? (preset.tools || []).filter((tool) => matchesQuery(tool, modalNeedle)) : [];
|
|
386
|
+
const visibleSelected = pickerTools.filter((tool) => modalSelected.has(tool.name)).map((tool) => tool.name);
|
|
387
|
+
const canConfirm = !!(modal && String(modal.name || "").trim());
|
|
388
|
+
const listedGroups = showGroups ? visibleGroups : [];
|
|
389
|
+
|
|
390
|
+
function renderGroup(group) {
|
|
391
|
+
const key = group._key;
|
|
392
|
+
const open = !!expanded[key];
|
|
393
|
+
const members = matchingTools(preset.tools, group.patterns);
|
|
394
|
+
const title = (group.name || "").trim() || "未命名分组";
|
|
395
|
+
return h("div", { className: "tm_group", key: key },
|
|
396
|
+
h("div", { className: "tm_group_bar" },
|
|
397
|
+
h("button", { className: "tm_chevron", title: open ? "收起" : "展开", onClick: () => setExpanded((current) => ({ ...current, [key]: !current[key] })) }, open ? "▾" : "▸"),
|
|
398
|
+
h("button", { className: "tm_group_main", onClick: () => setExpanded((current) => ({ ...current, [key]: !current[key] })) },
|
|
399
|
+
h("div", { className: "tm_group_title" }, title, h("span", { className: "tm_badge cold" }, "按需")),
|
|
400
|
+
h("div", { className: "tm_group_sub" }, group.description || "没有描述"),
|
|
401
|
+
),
|
|
402
|
+
h("span", { className: "tm_group_count" }, members.length + " 个工具"),
|
|
403
|
+
h("button", { className: "tm_btn", onClick: () => openEdit(group) }, "编辑"),
|
|
404
|
+
h("button", { className: "tm_btn", onClick: () => deleteGroup(key) }, "删除"),
|
|
405
|
+
),
|
|
406
|
+
open ? h("div", { className: "tm_group_body" }, members.length
|
|
407
|
+
? members.map((tool) => h("div", { className: "tm_member", key: tool.name },
|
|
408
|
+
h("div", { className: "tm_tool_name" }, tool.name, disabled.has(tool.name) ? h("span", { className: "tm_badge off" }, "关闭") : null),
|
|
409
|
+
h("div", { className: "tm_tool_desc", title: tool.description }, tool.description),
|
|
410
|
+
))
|
|
411
|
+
: h("div", { className: "tm_muted" }, "这个组还没有工具。点编辑勾选。"),
|
|
412
|
+
) : null,
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function renderTool(tool) {
|
|
417
|
+
const enabled = !disabled.has(tool.name);
|
|
418
|
+
return h("label", { className: "tm_tool", key: tool.name },
|
|
419
|
+
h("input", { type: "checkbox", checked: enabled, onChange: () => toggleTool(tool.name) }),
|
|
420
|
+
h("span", null,
|
|
421
|
+
h("div", { className: "tm_tool_name" }, tool.name,
|
|
422
|
+
!enabled ? h("span", { className: "tm_badge off" }, "关闭") : h("span", { className: "tm_badge live" }, "常开"),
|
|
423
|
+
),
|
|
424
|
+
h("div", { className: "tm_tool_desc", title: tool.description }, tool.description),
|
|
425
|
+
),
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const dialog = modal && typeof document !== "undefined" ? reactDom.createPortal(
|
|
430
|
+
h("div", { className: "tm_modal", role: "dialog", "aria-modal": "true", "aria-label": modal.mode === "create" ? "新建按需组" : "编辑按需组" },
|
|
431
|
+
h("div", { className: "tm_modal_mask", onMouseDown: () => setModal(null) }),
|
|
432
|
+
h("div", { className: "tm_modal_card" },
|
|
433
|
+
h("div", { className: "tm_modal_head" },
|
|
434
|
+
h("div", null,
|
|
435
|
+
h("h3", null, modal.mode === "create" ? "新建按需组" : "编辑按需组"),
|
|
436
|
+
h("div", { className: "tm_muted" }, "筛选后勾选要收进该组的工具。确定后会显示在按需里。"),
|
|
437
|
+
),
|
|
438
|
+
h("button", { className: "tm_btn", onClick: () => setModal(null) }, "关闭"),
|
|
439
|
+
),
|
|
440
|
+
h("div", { className: "tm_modal_body" },
|
|
441
|
+
h("div", { className: "tm_row" },
|
|
442
|
+
h("input", { className: "tm_input", value: modal.name, placeholder: "名称(模型用这个打开)", onChange: (e) => patchModal({ name: e.target.value, generateError: "" }) }),
|
|
443
|
+
h("button", { className: "tm_btn", disabled: modal.generating || modalSelected.size === 0 || matchingTools(preset.tools, modal.patterns || []).length === 0, onClick: generateGroupDetails }, modal.generating ? "生成中…" : "自动生成名称和描述"),
|
|
444
|
+
),
|
|
445
|
+
modal.generateError ? h("div", { className: "tm_error" }, modal.generateError) : null,
|
|
446
|
+
h("textarea", { className: "tm_input", style: { width: "100%", minHeight: "72px", resize: "vertical" }, value: modal.description, placeholder: "描述(可选)", onChange: (e) => patchModal({ description: e.target.value, generateError: "" }) }),
|
|
447
|
+
h("div", { className: "tm_row" },
|
|
448
|
+
h("input", { className: "tm_input", value: modal.query, placeholder: "筛选工具名或描述", onChange: (e) => patchModal({ query: e.target.value }) }),
|
|
449
|
+
h("button", { className: "tm_btn", disabled: pickerTools.length === 0, onClick: () => patchModal({ patterns: [...new Set([...(modal.patterns || []), ...pickerTools.map((tool) => tool.name)])], generateError: "" }) }, "全选当前筛选"),
|
|
450
|
+
h("button", { className: "tm_btn", disabled: visibleSelected.length === 0, onClick: () => patchModal({ patterns: (modal.patterns || []).filter((name) => !visibleSelected.includes(name)), generateError: "" }) }, "清除当前筛选"),
|
|
451
|
+
),
|
|
452
|
+
h("div", { className: "tm_muted" }, "已选 " + modalSelected.size + " 个工具。自动生成会调用当前默认模型,结果仍可手动修改。"),
|
|
453
|
+
pickerTools.length
|
|
454
|
+
? h("div", { className: "tm_picker" }, pickerTools.map((tool) => h("label", { className: "tm_pick", key: tool.name },
|
|
455
|
+
h("input", {
|
|
456
|
+
type: "checkbox",
|
|
457
|
+
checked: modalSelected.has(tool.name),
|
|
458
|
+
onChange: (e) => {
|
|
459
|
+
const next = new Set(modal.patterns || []);
|
|
460
|
+
if (e.target.checked) next.add(tool.name); else next.delete(tool.name);
|
|
461
|
+
patchModal({ patterns: [...next], generateError: "" });
|
|
462
|
+
},
|
|
463
|
+
}),
|
|
464
|
+
h("span", null,
|
|
465
|
+
h("div", { className: "tm_tool_name" }, tool.name, disabled.has(tool.name) ? h("span", { className: "tm_badge off" }, "已关闭") : null),
|
|
466
|
+
h("div", { className: "tm_tool_desc", title: tool.description }, tool.description),
|
|
467
|
+
),
|
|
468
|
+
)))
|
|
469
|
+
: h("div", { className: "tm_muted" }, preset.tools.length ? "没有符合筛选的工具。" : "这个 Preset 当前没有可见工具。"),
|
|
470
|
+
),
|
|
471
|
+
h("div", { className: "tm_modal_foot" },
|
|
472
|
+
h("button", { className: "tm_btn", onClick: () => setModal(null) }, "取消"),
|
|
473
|
+
h("button", { className: "tm_btn primary", disabled: !canConfirm || modal.generating, onClick: confirmModal }, "确定"),
|
|
474
|
+
),
|
|
475
|
+
),
|
|
476
|
+
),
|
|
477
|
+
document.body,
|
|
478
|
+
) : null;
|
|
479
|
+
|
|
480
|
+
const previewDialog = autoPreview && typeof document !== "undefined" ? reactDom.createPortal(
|
|
481
|
+
h("div", { className: "tm_modal", role: "dialog", "aria-modal": "true", "aria-label": "自动分组预览" },
|
|
482
|
+
h("div", { className: "tm_modal_mask", onMouseDown: () => setAutoPreview(null) }),
|
|
483
|
+
h("div", { className: "tm_modal_card" },
|
|
484
|
+
h("div", { className: "tm_modal_head" },
|
|
485
|
+
h("div", null, h("h3", null, "自动分组预览"), h("div", { className: "tm_muted" }, "确认后只加入页面草稿,仍需点击保存。")),
|
|
486
|
+
h("button", { className: "tm_btn", onClick: () => setAutoPreview(null) }, "关闭"),
|
|
487
|
+
),
|
|
488
|
+
h("div", { className: "tm_modal_body" },
|
|
489
|
+
autoPreview.groups.map((group, index) => h("div", { className: "tm_panel", key: group.name + index },
|
|
490
|
+
h("div", { className: "tm_panel_head" }, h("div", null, h("b", null, group.name), h("div", { className: "tm_muted" }, group.description)), h("span", { className: "tm_group_count" }, group.tools.length + " 个工具")),
|
|
491
|
+
h("div", { style: { padding: "10px 14px" } }, group.tools.map((name) => h("div", { className: "tm_member tm_tool_name", key: name }, name))),
|
|
492
|
+
)),
|
|
493
|
+
autoPreview.ungrouped.length ? h("div", { className: "tm_notice" }, "保持常开、未归组:", h("span", { className: "tm_code" }, autoPreview.ungrouped.join(", "))) : null,
|
|
494
|
+
),
|
|
495
|
+
h("div", { className: "tm_modal_foot" },
|
|
496
|
+
h("button", { className: "tm_btn", onClick: () => setAutoPreview(null) }, "取消"),
|
|
497
|
+
h("button", { className: "tm_btn primary", onClick: applyAutoGroups }, "确认加入草稿"),
|
|
498
|
+
),
|
|
499
|
+
),
|
|
500
|
+
),
|
|
501
|
+
document.body,
|
|
502
|
+
) : null;
|
|
503
|
+
|
|
504
|
+
const empty = listedGroups.length === 0 && visibleTools.length === 0;
|
|
505
|
+
|
|
506
|
+
return h("div", { className: "tm_root" },
|
|
507
|
+
h("div", { className: "tm_head" },
|
|
508
|
+
h("div", null, h("h2", null, "Agent 工具管理"), h("div", { className: "tm_muted" }, "按每个 Agent 预设开关工具。点「分组」把不常用的收进按需组:平时模型看不到,需要时先查目录再打开。")),
|
|
509
|
+
h("div", { className: "tm_row" },
|
|
510
|
+
h("button", { className: "tm_btn", onClick: reload, disabled: busy || autoGrouping }, "刷新"),
|
|
511
|
+
h("button", { className: "tm_btn primary", onClick: save, disabled: busy || autoGrouping || !draft.writable || !dirty }, busy ? "处理中…" : "保存"),
|
|
512
|
+
),
|
|
513
|
+
),
|
|
514
|
+
dirty ? h("div", { className: "tm_notice", role: "status" }, "有未保存的修改。请点击保存;刷新或离开页面前系统会提醒你。") : null,
|
|
515
|
+
!draft.writable ? h("div", { className: "tm_notice" }, "当前配置文件不可写,不能保存。") : null,
|
|
516
|
+
error ? h("div", { className: "tm_error" }, error) : null,
|
|
517
|
+
message ? h("div", { className: "tm_notice" }, message) : null,
|
|
518
|
+
draft.configPath ? h("div", { className: "tm_muted" }, "配置文件:", h("span", { className: "tm_code" }, draft.configPath)) : null,
|
|
519
|
+
h("div", { className: "tm_preset_picker" },
|
|
520
|
+
h("label", { htmlFor: "tm-preset-select" }, "Agent Preset"),
|
|
521
|
+
h("select", {
|
|
522
|
+
id: "tm-preset-select",
|
|
523
|
+
className: "tm_preset_select",
|
|
524
|
+
value: preset.id,
|
|
525
|
+
disabled: autoGrouping,
|
|
526
|
+
onChange: (event) => { setActive(event.target.value); setQuery(""); setFilter("all"); setModal(null); setAutoPreview(null); setAutoGroupError(""); setExpanded({}); },
|
|
527
|
+
}, draft.presets.map((item) => h("option", { key: item.id, value: item.id }, (item.name || item.id) + " · " + (item.tools || []).length + " 个工具" + (item.isDefault ? " · 默认" : "") + (item.trust === "system" ? "" : " · 用户")))),
|
|
528
|
+
),
|
|
529
|
+
preset.broken ? h("div", { className: "tm_error" }, preset.broken) : null,
|
|
530
|
+
autoGroupError ? h("div", { className: "tm_error" }, autoGroupError) : null,
|
|
531
|
+
h("section", { className: "tm_panel" },
|
|
532
|
+
h("div", { className: "tm_panel_head" },
|
|
533
|
+
h("div", null, h("b", null, "工具目录"), h("div", { className: "tm_muted" }, "关掉后立刻对模型隐藏。按需组默认隐藏,模型要先调用 tool_list 才能使用。")),
|
|
534
|
+
h("div", { className: "tm_row" },
|
|
535
|
+
h("button", { className: "tm_btn", onClick: startAutoGroup, disabled: autoGrouping || autoGroupCandidates.length === 0, title: autoGroupCandidates.length ? "用默认模型对未分组且未关闭的工具进行聚类" : "没有可自动分组的工具" }, autoGrouping ? "自动分组中…" : "自动分组"),
|
|
536
|
+
h("button", { className: "tm_btn", onClick: openCreate, disabled: autoGrouping }, "分组"),
|
|
537
|
+
),
|
|
538
|
+
),
|
|
539
|
+
h("div", { className: "tm_stats" },
|
|
540
|
+
[["工具总量", stats.totalTools], ["分组数量", stats.groupCount], ["未分组工具", stats.ungroupedTools], ["按需工具", stats.onDemandTools], ["已关闭工具", stats.disabledTools]].map(([label, value]) =>
|
|
541
|
+
h("div", { className: "tm_stat", key: label }, h("div", { className: "tm_stat_value" }, value), h("div", { className: "tm_stat_label" }, label)),
|
|
542
|
+
),
|
|
543
|
+
),
|
|
544
|
+
h("div", { className: "tm_row", style: { padding: "10px 14px" } },
|
|
545
|
+
h("input", { className: "tm_input", value: query, placeholder: "搜索工具名、描述或组名", onChange: (e) => setQuery(e.target.value) }),
|
|
546
|
+
h("div", { className: "tm_filters" },
|
|
547
|
+
[["all", "全部"], ["live", "常开"], ["cold", "按需"], ["disabled", "已关闭"]].map(([id, label]) =>
|
|
548
|
+
h("button", { key: id, className: "tm_chip" + (filter === id ? " active" : ""), onClick: () => setFilter(id) }, label),
|
|
549
|
+
),
|
|
550
|
+
),
|
|
551
|
+
),
|
|
552
|
+
orphans.length ? h("div", { className: "tm_notice", style: { margin: "0 14px 10px" } },
|
|
553
|
+
"策略里有已不存在的关闭项:", h("span", { className: "tm_code" }, orphans.join(", ")), " ",
|
|
554
|
+
h("button", { className: "tm_btn", onClick: () => mutatePreset((target) => { target.policy.disabled = (target.policy.disabled || []).filter((name) => !orphans.includes(name)); }) }, "清除"),
|
|
555
|
+
) : null,
|
|
556
|
+
listedGroups.map(renderGroup),
|
|
557
|
+
visibleTools.length ? h("div", { className: "tm_tools" }, visibleTools.map(renderTool)) : null,
|
|
558
|
+
empty ? h("div", { className: "tm_muted", style: { padding: "14px" } },
|
|
559
|
+
filter === "cold" ? (groups.length ? "没有符合筛选的按需组。" : "") : (preset.tools.length ? "没有符合筛选的工具。" : "这个 Preset 当前没有可见工具。"),
|
|
560
|
+
) : null,
|
|
561
|
+
),
|
|
562
|
+
dialog,
|
|
563
|
+
previewDialog,
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function apply(ctx) {
|
|
568
|
+
installCss();
|
|
569
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
570
|
+
name: "settings.section",
|
|
571
|
+
id: "tool-manager",
|
|
572
|
+
order: 25,
|
|
573
|
+
label: "工具管理",
|
|
574
|
+
}, ToolManagerSection));
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
exports.apply = apply;
|
|
578
|
+
exports.inject = inject;
|
|
579
|
+
return module.exports;
|
|
580
|
+
},
|
|
581
|
+
});
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToolManagerSettings } from "./types.js";
|
|
2
|
+
export declare const CONFIG_FILE_NAME = "tool-manager.json";
|
|
3
|
+
export declare function resolveConfigPath(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
4
|
+
export declare class ToolManagerConfigStore {
|
|
5
|
+
readonly path: string;
|
|
6
|
+
private value;
|
|
7
|
+
private currentRevision;
|
|
8
|
+
private writeQueue;
|
|
9
|
+
constructor(path?: string);
|
|
10
|
+
get revision(): number;
|
|
11
|
+
get(): ToolManagerSettings;
|
|
12
|
+
replace(next: ToolManagerSettings, expectedRevision?: number): Promise<void>;
|
|
13
|
+
private load;
|
|
14
|
+
private write;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD,wBAAgB,iBAAiB,CAC/B,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,IAAI,GAAE,MAAkB,GACvB,MAAM,CAMR;AAED,qBAAa,sBAAsB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,UAAU,CAAoC;gBAE1C,IAAI,SAAsB;IAKtC,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,GAAG,IAAI,mBAAmB;IAI1B,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5E,OAAO,CAAC,IAAI;YAeE,KAAK;CA8BpB"}
|