pi-web-ui 0.112.0 → 0.113.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 +64 -1
- package/README.md +1 -7
- package/README.zh-CN.md +1 -7
- package/README.zh-TW.md +1 -7
- package/bin/pi-web-ui.mjs +423 -50
- package/dist/gh-comment-781.md +5 -0
- package/dist/server/agent-service-daemon.js +29 -4
- package/dist/server/agent-service.js +222 -36
- package/dist/server/canvas/canvas-agent-tool.js +2 -0
- package/dist/server/canvas/canvas-orchestrator.js +40 -1
- package/dist/server/canvas/pstack-skills-data.js +498 -0
- package/dist/server/control-socket.js +6 -2
- package/dist/server/dispatch-domain-handlers.js +36 -11
- package/dist/server/dsh/dsh-agent-service.js +52 -4
- package/dist/server/durable/durable-driver.js +37 -98
- package/dist/server/durable/durable-event-projector.js +253 -0
- package/dist/server/engine-probe.js +35 -11
- package/dist/server/files-service.js +72 -8
- package/dist/server/index.js +74 -50
- package/dist/server/model-admin.js +185 -63
- package/dist/server/plugins.js +10 -6
- package/dist/server/remote-ssh-service.js +110 -12
- package/dist/server/serialize.js +1 -1
- package/dist/server/settings-service.js +36 -48
- package/dist/server/setup-page.js +632 -0
- package/dist/server/skill-discovery.js +361 -59
- package/dist/server/skill-maintenance.js +231 -0
- package/dist/server/skill-tool.js +32 -3
- package/dist/server/soft-cap.js +29 -7
- package/dist/server/subagents.js +246 -31
- package/dist/server/tool-host-factories.js +2 -0
- package/dist/server/tool-manager.js +106 -28
- package/dist/server/universal/drivers/claude-code.js +96 -4
- package/dist/server/universal/universal-session.js +19 -0
- package/dist/server/webui-context.js +6 -6
- package/dist/test-artifact.md +9 -0
- package/dist/test-preview-modal.md +11 -0
- package/dist/test-report.html +20 -0
- package/package.json +1 -1
- package/plugin-sdk/index.d.ts +17 -3
- package/plugins/catalog.json +10 -0
- package/web/dist/assets/{TerminalPanel-Dqr1dK28.js → TerminalPanel-Ci55JtJL.js} +2 -2
- package/web/dist/assets/index-ByiO9f-N.js +2008 -0
- package/web/dist/assets/index-ycGLh4a4.css +1 -0
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/index-Dh8BX-lP.js +0 -720
- package/web/dist/assets/index-DqrC1I_a.css +0 -1
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* 预设存取 + 何时需要 reload」,真正动 runtime 的 session.reload() 走宿主回调
|
|
7
7
|
* (reloadSession 里还会刷新斜杠命令目录)。
|
|
8
8
|
*/
|
|
9
|
-
import { existsSync,
|
|
10
|
-
import { homedir } from "node:os";
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
11
10
|
import { basename, dirname, join } from "node:path";
|
|
12
11
|
import { fileURLToPath } from "node:url";
|
|
13
12
|
import { extensionKey, isInternalExtension, normalizeBgCleanupMinutes, normalizeDisabledPluginTools, normalizeRetryMaxAttempts, normalizeKeepRecentMessages, normalizeSkillList, normalizeSkillsCatalogBudget, normalizeSkillsCatalogMaxDesc, normalizeToolWatchdogTimeoutMs, normalizeUiLayout, defaultSubagentAutoWakeMaxTurns, normalizeSubagentAutoWakeMaxTurns, settingsPresetToUi, } from "./client-state.js";
|
|
@@ -16,6 +15,7 @@ import { findVisionModels, SYSTEM_PROMPT } from "./vision-bridge.js";
|
|
|
16
15
|
import { COMMITMSG_SYSTEM_PROMPT } from "./scm-commitmsg.js";
|
|
17
16
|
import { PLAN_MODE_SYSTEM_PROMPT } from "./plan-mode.js";
|
|
18
17
|
import { DEFAULT_TEMPLATES, localizeTemplate } from "./subagent-templates.js";
|
|
18
|
+
import { discoverDiskSkills, isSkillStillOnDisk } from "./skill-discovery.js";
|
|
19
19
|
import { deriveLegacy, foldLegacyIntoDisabled, normalizeDisabledAgentTools } from "./tool-manager.js";
|
|
20
20
|
import { normalizeToolPromptOverrides } from "./tool-prompt-overrides.js";
|
|
21
21
|
import { resolveServerLang } from "./i18n.js";
|
|
@@ -70,51 +70,13 @@ export class SettingsService {
|
|
|
70
70
|
this.pendingReload = false;
|
|
71
71
|
return v;
|
|
72
72
|
}
|
|
73
|
-
/** 判断某个 skill
|
|
74
|
-
*
|
|
75
|
-
* 出现在设置面板,也不应留在持久化记录里。 */
|
|
73
|
+
/** 判断某个 skill 名是否仍存在于磁盘任何来源(各类 Agent 项目区 / 全局 / 祖先 / npm 包等)。
|
|
74
|
+
* 被禁用且文件已删除的名字不应再出现在设置面板,也不应留在持久化记录里。 */
|
|
76
75
|
skillStillOnDisk(name) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (check(join(agentDir, "skills")))
|
|
82
|
-
return true;
|
|
83
|
-
// SDK 始终扫描用户级 ~/.agents/skills,不依赖 cwd 的祖先链(issue #669)。
|
|
84
|
-
if (check(join(process.env.HOME || homedir(), ".agents", "skills")))
|
|
85
|
-
return true;
|
|
86
|
-
if (check(join(cwd, ".pi", "skills")))
|
|
87
|
-
return true;
|
|
88
|
-
// ③ 祖先链 .agents/skills(SDK collectAncestorAgentsSkillDirs 语义,最多上溯 6 层)
|
|
89
|
-
let dir = cwd;
|
|
90
|
-
for (let i = 0; i < 6 && dir !== dirname(dir); i++, dir = dirname(dir)) {
|
|
91
|
-
if (check(join(dir, ".agents", "skills")))
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
// ④ npm 包内 skills(agent 级 + 项目级,含 @scope 两级子包)
|
|
95
|
-
for (const npmRoot of [join(agentDir, "npm", "node_modules"), join(cwd, ".pi", "npm", "node_modules")]) {
|
|
96
|
-
try {
|
|
97
|
-
for (const entry of readdirSync(npmRoot, { withFileTypes: true })) {
|
|
98
|
-
if (!entry.isDirectory())
|
|
99
|
-
continue;
|
|
100
|
-
if (!entry.name.startsWith("@")) {
|
|
101
|
-
if (check(join(npmRoot, entry.name, "skills")))
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
for (const sub of readdirSync(join(npmRoot, entry.name), { withFileTypes: true })) {
|
|
106
|
-
if (sub.isDirectory() && check(join(npmRoot, entry.name, sub.name, "skills"))) {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
// npm 目录不存在/不可读 → 不是来源
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return false;
|
|
76
|
+
return isSkillStillOnDisk(name, {
|
|
77
|
+
cwd: this.host.cwd(),
|
|
78
|
+
agentDir: this.host.agentDir(),
|
|
79
|
+
});
|
|
118
80
|
}
|
|
119
81
|
/** 判断某个扩展 id 是否仍存在(loader 之外的兜底,供禁用残留清理用):
|
|
120
82
|
* npm: 包 → 任一 npm 根还有目录,或还列在任一 settings.json packages 里
|
|
@@ -178,10 +140,19 @@ export class SettingsService {
|
|
|
178
140
|
const loadedExts = allLoadedExts.filter((e) => !isInternalExtension(e));
|
|
179
141
|
loadedSkillNames = new Set(loadedSkills.map((s) => s.name));
|
|
180
142
|
loadedExtNames = new Set(loadedExts.map((e) => extensionKey(e)));
|
|
143
|
+
// 实时全源磁盘扫描:动态发现外部新安装/更新的各类 Agent 全局与本地技能
|
|
144
|
+
const diskSkills = discoverDiskSkills({
|
|
145
|
+
cwd: this.host.cwd(),
|
|
146
|
+
agentDir: this.host.agentDir(),
|
|
147
|
+
});
|
|
181
148
|
// Prune entries that no longer exist on disk AND aren't disabled
|
|
182
149
|
// (e.g. a skill/extension file was deleted). Disabled entries are
|
|
183
150
|
// kept so they can be re-enabled even when filtered out of the loader.
|
|
184
|
-
const keepSkills = new Set([
|
|
151
|
+
const keepSkills = new Set([
|
|
152
|
+
...loadedSkills.map((s) => s.name),
|
|
153
|
+
...diskSkills.map((s) => s.name),
|
|
154
|
+
...this.settings.disabledSkills,
|
|
155
|
+
]);
|
|
185
156
|
const keepExts = new Set([
|
|
186
157
|
...loadedExts.map((e) => extensionKey(e)),
|
|
187
158
|
...this.settings.disabledExtensions.filter((id) => !isInternalExtension({ path: id })),
|
|
@@ -203,6 +174,18 @@ export class SettingsService {
|
|
|
203
174
|
enabled: true,
|
|
204
175
|
});
|
|
205
176
|
}
|
|
177
|
+
for (const ds of diskSkills) {
|
|
178
|
+
if (!this.knownSkills.has(ds.name)) {
|
|
179
|
+
this.knownSkills.set(ds.name, {
|
|
180
|
+
name: ds.name,
|
|
181
|
+
description: ds.description,
|
|
182
|
+
enabled: !disabledSkills.has(ds.name),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else if (!this.knownSkills.get(ds.name).description && ds.description) {
|
|
186
|
+
this.knownSkills.get(ds.name).description = ds.description;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
206
189
|
for (const e of loadedExts) {
|
|
207
190
|
const id = extensionKey(e);
|
|
208
191
|
const p = e.sourceInfo?.path ?? e.path;
|
|
@@ -213,6 +196,11 @@ export class SettingsService {
|
|
|
213
196
|
enabled: true,
|
|
214
197
|
});
|
|
215
198
|
}
|
|
199
|
+
// 若发现磁盘新增了 loader 尚未加载的技能,触发会话后台异步 reload 以刷新提示词和技能工具
|
|
200
|
+
const hasUnloadedDiskSkills = diskSkills.some((ds) => !loadedSkillNames.has(ds.name));
|
|
201
|
+
if (hasUnloadedDiskSkills && !this.host.isStreaming()) {
|
|
202
|
+
void this.host.reloadSession();
|
|
203
|
+
}
|
|
216
204
|
}
|
|
217
205
|
catch {
|
|
218
206
|
// Session not ready yet — keep whatever we already know.
|
|
@@ -228,7 +216,7 @@ export class SettingsService {
|
|
|
228
216
|
...this.settings.reviewDisabledSkills,
|
|
229
217
|
...normalizeSkillList(this.settings.skillsFullText),
|
|
230
218
|
]),
|
|
231
|
-
].filter((name) => !
|
|
219
|
+
].filter((name) => !this.knownSkills.has(name) && !this.skillStillOnDisk(name));
|
|
232
220
|
if (stale.length > 0) {
|
|
233
221
|
this.settings.disabledSkills = this.settings.disabledSkills.filter((n) => !stale.includes(n));
|
|
234
222
|
this.settings.reviewDisabledSkills = this.settings.reviewDisabledSkills.filter((n) => !stale.includes(n));
|