psyclaw 0.29.3 → 0.29.4
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 +4 -4
- package/dist/apps/panel/index.html +124 -2
- package/dist/src/adapters/pi/extension.js +131 -29
- package/dist/src/adapters/pi/extension.js.map +1 -1
- package/dist/src/analysis/plan.d.ts +23 -0
- package/dist/src/analysis/plan.js +39 -2
- package/dist/src/analysis/plan.js.map +1 -1
- package/dist/src/analysis/stats-router.js +3 -2
- package/dist/src/analysis/stats-router.js.map +1 -1
- package/dist/src/ars/keybindings.d.ts +10 -5
- package/dist/src/ars/keybindings.js +20 -10
- package/dist/src/ars/keybindings.js.map +1 -1
- package/dist/src/branding.js +3 -1
- package/dist/src/branding.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/panel/server.js +31 -1
- package/dist/src/panel/server.js.map +1 -1
- package/dist/src/session/help.d.ts +5 -0
- package/dist/src/session/help.js +46 -0
- package/dist/src/session/help.js.map +1 -0
- package/dist/src/session/modes.js +3 -2
- package/dist/src/session/modes.js.map +1 -1
- package/dist/src/style/cli-ui.js +7 -6
- package/dist/src/style/cli-ui.js.map +1 -1
- package/dist/src/verify/checklist.d.ts +9 -2
- package/dist/src/verify/checklist.js +70 -15
- package/dist/src/verify/checklist.js.map +1 -1
- package/package.json +4 -1
- package/skills/core/analysis-plan/SKILL.md +21 -11
- package/skills/recommended/catalog.json +84 -2
- package/skills/scholars/README.md +20 -0
- package/skills/scholars/freud-perspective/SKILL.md +70 -0
- package/skills/scholars/gelman-perspective/SKILL.md +66 -0
- package/skills/scholars/kahneman-perspective/SKILL.md +71 -0
- package/vendor/nuwa-skill/LICENSE +21 -0
- package/vendor/nuwa-skill/NOTICE.md +9 -0
- package/vendor/nuwa-skill/PROVENANCE.json +1 -0
- package/vendor/nuwa-skill/README.md +378 -0
- package/vendor/nuwa-skill/README_EN.md +290 -0
- package/vendor/nuwa-skill/SKILL.md +682 -0
- package/vendor/nuwa-skill/references/extraction-framework.md +151 -0
- package/vendor/nuwa-skill/references/fidelity-scorecard.md +63 -0
- package/vendor/nuwa-skill/references/skill-template.md +117 -0
- package/vendor/nuwa-skill/scripts/merge_research.py +150 -0
- package/vendor/nuwa-skill/scripts/quality_check.py +152 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ PsyClaw 是面向社会科学研究的智能体工作台。它把研究项目、
|
|
|
4
4
|
|
|
5
5
|
PsyClaw 自有代码使用 MIT 许可证;随 npm 包内置的 Academic Research Skills 位于 `vendor/ars`,保持上游署名并单独遵循 CC BY-NC 4.0,仅限非商业用途。
|
|
6
6
|
|
|
7
|
-
当前版本:`0.29.
|
|
7
|
+
当前版本:`0.29.4`。正式命令、用户配置目录和后续发布统一使用 `psyclaw`。
|
|
8
8
|
|
|
9
9
|
## 发布流程
|
|
10
10
|
|
|
@@ -21,19 +21,19 @@ RELEASE_MESSAGE="release: describe the change" pnpm release:push
|
|
|
21
21
|
需要 Node.js `>=22.19.0`。官方 npm 源:
|
|
22
22
|
|
|
23
23
|
```powershell
|
|
24
|
-
npm install -g psyclaw@0.29.
|
|
24
|
+
npm install -g psyclaw@0.29.4
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
如果本机 npm 配置把 registry 误写成带有 `~/` 的地址,请显式指定官方源:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npm install -g psyclaw@0.29.
|
|
30
|
+
npm install -g psyclaw@0.29.4 --registry=https://registry.npmjs.org/
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
中国大陆网络较慢或无法访问官方源时:
|
|
34
34
|
|
|
35
35
|
```powershell
|
|
36
|
-
npm install -g psyclaw@0.29.
|
|
36
|
+
npm install -g psyclaw@0.29.4 --registry=https://registry.npmmirror.com
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
PsyClaw 的 npm 发布包直接携带 Windows x64/arm64 版 `ripgrep` 和 `fd`,Windows 启动时直接使用包内可执行文件,不再联网下载。其他平台缺少这两个工具时仍由锁定的 Pi 原生工具管理器处理:代理环境走 GitHub 官方 API 与 Release,国内 npm registry 环境统一走国内镜像。
|
|
@@ -1174,10 +1174,18 @@
|
|
|
1174
1174
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
|
|
1175
1175
|
模型与成本
|
|
1176
1176
|
</button>
|
|
1177
|
+
<button data-view="checklist">
|
|
1178
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 11l3 3L22 4"/><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"/></svg>
|
|
1179
|
+
核对清单
|
|
1180
|
+
</button>
|
|
1181
|
+
<button data-view="chat">
|
|
1182
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
|
|
1183
|
+
对话
|
|
1184
|
+
</button>
|
|
1177
1185
|
</div>
|
|
1178
1186
|
<div class="nav-footer">
|
|
1179
1187
|
<div style="font-weight:600;margin-bottom:2px;color:var(--text-secondary)">PsyClaw 运行提示</div>
|
|
1180
|
-
|
|
1188
|
+
终端 <code>Shift+Tab</code> 切换模式;Thinking 用 <code>Ctrl+Shift+T</code>。
|
|
1181
1189
|
</div>
|
|
1182
1190
|
</nav>
|
|
1183
1191
|
|
|
@@ -1373,6 +1381,39 @@
|
|
|
1373
1381
|
</div>
|
|
1374
1382
|
</div>
|
|
1375
1383
|
</section>
|
|
1384
|
+
|
|
1385
|
+
<section id="view-checklist" class="view">
|
|
1386
|
+
<div class="page-head">
|
|
1387
|
+
<div>
|
|
1388
|
+
<h1>交叉核验清单</h1>
|
|
1389
|
+
<p>分析前/后由模型提出项,人在此勾选。可跳过,但会标注「未经核对」。本地写入 <code>.psyclaw/verify-checklist.json</code>。</p>
|
|
1390
|
+
</div>
|
|
1391
|
+
<div style="display:flex;gap:8px">
|
|
1392
|
+
<button id="refresh-checklist" class="button">刷新</button>
|
|
1393
|
+
<button id="skip-checklist" class="button" title="其余未核项标为跳过/未经核对">跳过未核项</button>
|
|
1394
|
+
</div>
|
|
1395
|
+
</div>
|
|
1396
|
+
<div class="panel section">
|
|
1397
|
+
<table>
|
|
1398
|
+
<thead>
|
|
1399
|
+
<tr><th>状态</th><th>ID</th><th>类别</th><th>阶段</th><th>说明</th><th>操作</th></tr>
|
|
1400
|
+
</thead>
|
|
1401
|
+
<tbody id="checklist-body">
|
|
1402
|
+
<tr><td colspan="6" class="empty">正在读取核对清单...</td></tr>
|
|
1403
|
+
</tbody>
|
|
1404
|
+
</table>
|
|
1405
|
+
</div>
|
|
1406
|
+
</section>
|
|
1407
|
+
|
|
1408
|
+
<section id="view-chat" class="view">
|
|
1409
|
+
<div class="page-head">
|
|
1410
|
+
<div>
|
|
1411
|
+
<h1>交互对话</h1>
|
|
1412
|
+
<p>整页对话视图(不再只依赖右下角抽屉)。打开本页时会把控制台嵌到此处。</p>
|
|
1413
|
+
</div>
|
|
1414
|
+
</div>
|
|
1415
|
+
<div id="chat-console-host" class="panel section" style="min-height:62vh;padding:0;overflow:hidden;display:flex;flex-direction:column"></div>
|
|
1416
|
+
</section>
|
|
1376
1417
|
</main>
|
|
1377
1418
|
</div>
|
|
1378
1419
|
</div>
|
|
@@ -1500,8 +1541,87 @@ function setView(view) {
|
|
|
1500
1541
|
});
|
|
1501
1542
|
if (view === "ecosystem") loadEcosystem();
|
|
1502
1543
|
if (view === "provider") loadProvider();
|
|
1544
|
+
if (view === "checklist") loadChecklist();
|
|
1545
|
+
if (view === "chat") mountConsoleInChat();
|
|
1546
|
+
else restoreConsoleDrawer();
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
function mountConsoleInChat() {
|
|
1550
|
+
const host = $("chat-console-host");
|
|
1551
|
+
const drawer = $("console-drawer");
|
|
1552
|
+
if (!host || !drawer) return;
|
|
1553
|
+
host.appendChild(drawer);
|
|
1554
|
+
drawer.classList.add("open");
|
|
1555
|
+
drawer.style.position = "relative";
|
|
1556
|
+
drawer.style.inset = "auto";
|
|
1557
|
+
drawer.style.width = "100%";
|
|
1558
|
+
drawer.style.height = "100%";
|
|
1559
|
+
drawer.style.minHeight = "58vh";
|
|
1560
|
+
drawer.style.boxShadow = "none";
|
|
1561
|
+
drawer.style.borderRadius = "0";
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
function restoreConsoleDrawer() {
|
|
1565
|
+
const drawer = $("console-drawer");
|
|
1566
|
+
if (!drawer || drawer.parentElement === document.body) return;
|
|
1567
|
+
document.body.appendChild(drawer);
|
|
1568
|
+
drawer.style.position = "";
|
|
1569
|
+
drawer.style.inset = "";
|
|
1570
|
+
drawer.style.width = "";
|
|
1571
|
+
drawer.style.height = "";
|
|
1572
|
+
drawer.style.minHeight = "";
|
|
1573
|
+
drawer.style.boxShadow = "";
|
|
1574
|
+
drawer.style.borderRadius = "";
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
async function loadChecklist() {
|
|
1578
|
+
const body = $("checklist-body");
|
|
1579
|
+
if (!body) return;
|
|
1580
|
+
body.innerHTML = `<tr><td colspan="6" class="empty">正在读取核对清单...</td></tr>`;
|
|
1581
|
+
try {
|
|
1582
|
+
const data = await json("/api/crosscheck");
|
|
1583
|
+
const items = data.checklist?.items || [];
|
|
1584
|
+
body.innerHTML = items.map(item => {
|
|
1585
|
+
const status = item.status || "unverified";
|
|
1586
|
+
return `<tr>
|
|
1587
|
+
<td>${esc(status)}</td>
|
|
1588
|
+
<td><code>${esc(item.id)}</code></td>
|
|
1589
|
+
<td>${esc(item.kind || "general")}</td>
|
|
1590
|
+
<td>${esc(item.phase || "general")}</td>
|
|
1591
|
+
<td>${esc(item.label)}${item.notes ? `<div style="color:var(--text-muted);font-size:11px">${esc(item.notes)}</div>` : ""}</td>
|
|
1592
|
+
<td style="white-space:nowrap">
|
|
1593
|
+
<button class="button" data-check-id="${esc(item.id)}" data-check-status="verified">核实</button>
|
|
1594
|
+
<button class="button" data-check-id="${esc(item.id)}" data-check-status="flagged">存疑</button>
|
|
1595
|
+
<button class="button" data-check-id="${esc(item.id)}" data-check-status="skipped">跳过</button>
|
|
1596
|
+
</td>
|
|
1597
|
+
</tr>`;
|
|
1598
|
+
}).join("") || `<tr><td colspan="6" class="empty">清单为空</td></tr>`;
|
|
1599
|
+
body.querySelectorAll("[data-check-id]").forEach(btn => {
|
|
1600
|
+
btn.addEventListener("click", async () => {
|
|
1601
|
+
await json("/api/crosscheck", {
|
|
1602
|
+
method: "POST",
|
|
1603
|
+
headers: { "content-type": "application/json" },
|
|
1604
|
+
body: JSON.stringify({ id: btn.dataset.checkId, status: btn.dataset.checkStatus }),
|
|
1605
|
+
});
|
|
1606
|
+
await loadChecklist();
|
|
1607
|
+
});
|
|
1608
|
+
});
|
|
1609
|
+
} catch (error) {
|
|
1610
|
+
body.innerHTML = `<tr><td colspan="6" class="empty">加载失败: ${esc(error.message)}</td></tr>`;
|
|
1611
|
+
}
|
|
1503
1612
|
}
|
|
1504
1613
|
|
|
1614
|
+
$("refresh-checklist")?.addEventListener("click", loadChecklist);
|
|
1615
|
+
$("skip-checklist")?.addEventListener("click", async () => {
|
|
1616
|
+
if (!confirm("将把所有未核项标为跳过,并写入「未经核对」。继续?")) return;
|
|
1617
|
+
await json("/api/crosscheck", {
|
|
1618
|
+
method: "POST",
|
|
1619
|
+
headers: { "content-type": "application/json" },
|
|
1620
|
+
body: JSON.stringify({ action: "skip" }),
|
|
1621
|
+
});
|
|
1622
|
+
await loadChecklist();
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1505
1625
|
document.querySelectorAll(".nav button").forEach(button => {
|
|
1506
1626
|
button.addEventListener("click", () => setView(button.dataset.view));
|
|
1507
1627
|
});
|
|
@@ -2105,8 +2225,10 @@ $("cmd-plan-btn").addEventListener("click", async () => {
|
|
|
2105
2225
|
});
|
|
2106
2226
|
|
|
2107
2227
|
$("cmd-verify-btn").addEventListener("click", async () => {
|
|
2228
|
+
setView("checklist");
|
|
2229
|
+
await loadChecklist();
|
|
2108
2230
|
openConsole();
|
|
2109
|
-
await sendConsoleMessage("/
|
|
2231
|
+
await sendConsoleMessage("/crosscheck list");
|
|
2110
2232
|
});
|
|
2111
2233
|
|
|
2112
2234
|
/* --- 加载项目状态并更新 Stepper 状态 --- */
|
|
@@ -28,7 +28,8 @@ import { formatAnalysisPlanTakeover, resolveStatsIntent, } from "../../analysis/
|
|
|
28
28
|
import { arsRoot } from "../../ars/pi-panel-executor.js";
|
|
29
29
|
import { ArsModeEditor, isArsModeEditorText } from "../../ars/mode-editor.js";
|
|
30
30
|
import { MODE_STATUS, nextSessionMode, parseSessionMode, sessionModePrompt, } from "../../session/modes.js";
|
|
31
|
-
import { formatVerifyChecklist, loadVerifyChecklist, markVerifyItem } from "../../verify/checklist.js";
|
|
31
|
+
import { formatVerifyChecklist, isNaturalPlanConfirm, loadVerifyChecklist, markVerifyItem, skipUnverifiedItems } from "../../verify/checklist.js";
|
|
32
|
+
import { formatSessionHelp } from "../../session/help.js";
|
|
32
33
|
const PARADIGMS = new Set([
|
|
33
34
|
"survey-observational",
|
|
34
35
|
"qualitative-thematic",
|
|
@@ -1128,14 +1129,67 @@ export default function psyclawExtension(pi) {
|
|
|
1128
1129
|
});
|
|
1129
1130
|
});
|
|
1130
1131
|
if (!legacyTestApi && typeof pi.on === "function")
|
|
1131
|
-
pi.on("input", (event, ctx) => {
|
|
1132
|
+
pi.on("input", async (event, ctx) => {
|
|
1132
1133
|
if (event.source === "extension")
|
|
1133
1134
|
return;
|
|
1134
1135
|
if (/^\/(?:login|logout)(?:\s|$)/i.test(event.text.trim())) {
|
|
1135
1136
|
ctx.ui.notify("PsyClaw 已统一隐藏底层登录命令。请使用 /provider 配置、切换或更新模型凭据。", "info");
|
|
1136
1137
|
return { action: "handled" };
|
|
1137
1138
|
}
|
|
1139
|
+
if (/^\/help(?:\s|$)/i.test(event.text.trim())) {
|
|
1140
|
+
ctx.ui.notify(formatSessionHelp(), "info");
|
|
1141
|
+
return { action: "handled" };
|
|
1142
|
+
}
|
|
1138
1143
|
const mode = arsModeEditor?.getMode() ?? sessionMode;
|
|
1144
|
+
const trimmed = event.text.trim();
|
|
1145
|
+
// Natural-language plan confirm: reply「可以」instead of forcing /plan confirm.
|
|
1146
|
+
if (mode === "analysis" && isNaturalPlanConfirm(trimmed)) {
|
|
1147
|
+
const plan = await readActiveAnalysisPlan(ctx.cwd);
|
|
1148
|
+
if (plan && (plan.status === "awaiting-confirm" || plan.status === "ready" || plan.status === "reviewing")) {
|
|
1149
|
+
const method = plan.confirmedMethod || plan.primaryAnalysis || plan.proposedMethods[0] || "按当前方案执行";
|
|
1150
|
+
let next = plan.status === "awaiting-confirm"
|
|
1151
|
+
? advanceAnalysisPlan(plan, { type: "confirm", method, backend: "local-script" })
|
|
1152
|
+
: plan;
|
|
1153
|
+
if (next.status === "reviewing" || next.status === "awaiting-confirm") {
|
|
1154
|
+
next = advanceAnalysisPlan(next, { type: "review" });
|
|
1155
|
+
}
|
|
1156
|
+
next = advanceAnalysisPlan(next, { type: "run-now" });
|
|
1157
|
+
next = await writeAnalysisPlan(ctx.cwd, next);
|
|
1158
|
+
ctx.ui.notify(`${formatAnalysisPlanStatus(next)}\n已按自然语言确认并开始执行。`, "info");
|
|
1159
|
+
return {
|
|
1160
|
+
action: "transform",
|
|
1161
|
+
text: [
|
|
1162
|
+
"/skill:analysis-plan",
|
|
1163
|
+
"",
|
|
1164
|
+
`User confirmed with natural language ("${trimmed}"). Execute plan ${next.id} now.`,
|
|
1165
|
+
`Confirmed method: ${next.confirmedMethod ?? method}`,
|
|
1166
|
+
next.approvalMode === "auto" ? "approvalMode=auto: label outputs as 未经人审批." : "Human confirmed this step.",
|
|
1167
|
+
"Before and after analysis, open Panel checklist or /crosscheck; skipping must mark 未经核对.",
|
|
1168
|
+
].join("\n"),
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
const wantsStats = mode === "analysis" && Boolean(resolveStatsIntent(trimmed));
|
|
1173
|
+
const wantsAcademic = mode === "academic" && Boolean(resolveAcademicSoftRoute(trimmed));
|
|
1174
|
+
if ((wantsStats || wantsAcademic) && !(await readActiveProject(ctx.cwd))) {
|
|
1175
|
+
if (!ctx.hasUI) {
|
|
1176
|
+
return {
|
|
1177
|
+
action: "transform",
|
|
1178
|
+
text: [
|
|
1179
|
+
"尚未 /init。请先提醒用户初始化工作区;若用户确认可无仓继续,再处理其请求。",
|
|
1180
|
+
"User request:",
|
|
1181
|
+
trimmed,
|
|
1182
|
+
].join("\n"),
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
const choice = await ctx.ui.select("尚未 /init。统计/写作建议先建仓,否则交接与核对清单不完整。", ["先执行 /init", "本次继续(稍后 init)", "取消"], { timeout: 120_000 });
|
|
1186
|
+
if (choice === "取消" || choice === undefined)
|
|
1187
|
+
return { action: "handled" };
|
|
1188
|
+
if (choice === "先执行 /init") {
|
|
1189
|
+
return { action: "transform", text: `/init\n\n(用户选择先初始化,完成后再继续:${trimmed})` };
|
|
1190
|
+
}
|
|
1191
|
+
ctx.ui.notify("继续本次请求;建议随后 /init。关键结果请做交叉核验。", "warning");
|
|
1192
|
+
}
|
|
1139
1193
|
if (mode === "academic") {
|
|
1140
1194
|
const match = resolveAcademicSoftRoute(event.text);
|
|
1141
1195
|
if (!match)
|
|
@@ -1199,7 +1253,8 @@ export default function psyclawExtension(pi) {
|
|
|
1199
1253
|
`工作仓库已初始化:${project.id}`,
|
|
1200
1254
|
"已创建 data/raw|clean、analysis/、literature/、paper/、psyclaw.md、.psyclaw/",
|
|
1201
1255
|
"Shift+Tab:chat → analysis → academic",
|
|
1202
|
-
"
|
|
1256
|
+
"Thinking:Ctrl+Shift+T",
|
|
1257
|
+
"澄清与分析请切到 analysis;写作审稿请切到 academic。输入 /help 查看速览。",
|
|
1203
1258
|
].join("\n"), "info");
|
|
1204
1259
|
}
|
|
1205
1260
|
catch (error) {
|
|
@@ -1207,29 +1262,54 @@ export default function psyclawExtension(pi) {
|
|
|
1207
1262
|
}
|
|
1208
1263
|
},
|
|
1209
1264
|
});
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
const checklist = await loadVerifyChecklist(ctx.cwd);
|
|
1217
|
-
ctx.ui.notify(formatVerifyChecklist(checklist), "info");
|
|
1218
|
-
return;
|
|
1219
|
-
}
|
|
1220
|
-
const id = parts[0];
|
|
1221
|
-
const status = (parts[1] ?? "verified");
|
|
1222
|
-
if (status !== "verified" && status !== "unverified" && status !== "flagged") {
|
|
1223
|
-
ctx.ui.notify("Usage: /verify list | /verify <id> verified|unverified|flagged [备注]", "info");
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
const notes = parts.slice(2).join(" ") || undefined;
|
|
1227
|
-
const checklist = await markVerifyItem(ctx.cwd, id, status, notes);
|
|
1228
|
-
ctx.ui.notify(formatVerifyChecklist(checklist), "info");
|
|
1265
|
+
const handleCrosscheck = async (args, ctx) => {
|
|
1266
|
+
try {
|
|
1267
|
+
const parts = args.trim().split(/\s+/).filter(Boolean);
|
|
1268
|
+
if (parts.length === 0 || parts[0] === "list") {
|
|
1269
|
+
ctx.ui.notify(formatVerifyChecklist(await loadVerifyChecklist(ctx.cwd)), "info");
|
|
1270
|
+
return;
|
|
1229
1271
|
}
|
|
1230
|
-
|
|
1231
|
-
await
|
|
1272
|
+
if (parts[0] === "skip") {
|
|
1273
|
+
ctx.ui.notify(formatVerifyChecklist(await skipUnverifiedItems(ctx.cwd)), "warning");
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
if (parts[0] === "kind") {
|
|
1277
|
+
const kind = (parts[1] ?? "general");
|
|
1278
|
+
pi.sendUserMessage([
|
|
1279
|
+
"交叉核验任务:请作为助手主动提出核对项,不要等用户自己去「申请确认」。",
|
|
1280
|
+
`核验类别:${kind}(citations=引文,format=格式,requirements=研究要求,stats=统计结果,general=综合)。`,
|
|
1281
|
+
"输出可勾选清单,并建议用户打开 /panel 核对页逐项确认;若用户跳过,必须在产物中标注「未经核对」。",
|
|
1282
|
+
"分析前与分析后都要有清单,不能默认跳过。",
|
|
1283
|
+
].join("\n"), ctx.isIdle() ? {} : { deliverAs: "followUp" });
|
|
1284
|
+
ctx.ui.notify(`已启动 ${kind} 交叉核验;也可 /panel 打开核对清单。`, "info");
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
const id = parts[0];
|
|
1288
|
+
const status = (parts[1] ?? "verified");
|
|
1289
|
+
if (status !== "verified" && status !== "unverified" && status !== "flagged" && status !== "skipped") {
|
|
1290
|
+
ctx.ui.notify("Usage: /crosscheck list | skip | kind <citations|format|requirements|stats> | <id> verified|unverified|flagged|skipped [备注]", "info");
|
|
1291
|
+
return;
|
|
1232
1292
|
}
|
|
1293
|
+
const notes = parts.slice(2).join(" ") || undefined;
|
|
1294
|
+
const checklist = await markVerifyItem(ctx.cwd, id, status, notes);
|
|
1295
|
+
ctx.ui.notify(formatVerifyChecklist(checklist), "info");
|
|
1296
|
+
}
|
|
1297
|
+
catch (error) {
|
|
1298
|
+
await notifyError(ctx, error);
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
pi.registerCommand("crosscheck", {
|
|
1302
|
+
description: "交叉核验:/crosscheck list|skip|kind <类型>|<id> verified|…",
|
|
1303
|
+
handler: async (args, ctx) => handleCrosscheck(args, ctx),
|
|
1304
|
+
});
|
|
1305
|
+
pi.registerCommand("verify", {
|
|
1306
|
+
description: "交叉核验(同 /crosscheck):模型提出项,人勾选或 skip 标注未经核对",
|
|
1307
|
+
handler: async (args, ctx) => handleCrosscheck(args, ctx),
|
|
1308
|
+
});
|
|
1309
|
+
pi.registerCommand("help", {
|
|
1310
|
+
description: "三种模式速览与常用命令",
|
|
1311
|
+
handler: async (_args, ctx) => {
|
|
1312
|
+
ctx.ui.notify(formatSessionHelp(), "info");
|
|
1233
1313
|
},
|
|
1234
1314
|
});
|
|
1235
1315
|
pi.registerCommand("plan", {
|
|
@@ -1239,11 +1319,33 @@ export default function psyclawExtension(pi) {
|
|
|
1239
1319
|
const trimmed = args.trim();
|
|
1240
1320
|
const [cmdRaw, ...rest] = trimmed.split(/\s+/).filter(Boolean);
|
|
1241
1321
|
const cmd = (cmdRaw ?? "status").toLowerCase();
|
|
1242
|
-
const usage = "Usage: /plan new
|
|
1322
|
+
const usage = "Usage: /plan new|status|list|confirm|auto|human|review|run|defer|handoff|reject";
|
|
1243
1323
|
if (cmd === "new") {
|
|
1244
1324
|
const goal = rest.join(" ").trim() || "从当前对话澄清的分析目标";
|
|
1245
1325
|
const plan = await writeAnalysisPlan(ctx.cwd, createAnalysisPlan({ goal }));
|
|
1246
|
-
ctx.ui.notify(`${formatAnalysisPlanStatus(plan)}\n
|
|
1326
|
+
ctx.ui.notify(`${formatAnalysisPlanStatus(plan)}\n已创建。模型会按分析项逐一请你选择;回复「可以」即可确认执行。`, "info");
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
if (cmd === "auto") {
|
|
1330
|
+
let plan = await readActiveAnalysisPlan(ctx.cwd);
|
|
1331
|
+
if (!plan) {
|
|
1332
|
+
ctx.ui.notify("没有活跃 Plan。先 /plan new 或在 analysis 模式触发 soft takeover。", "warning");
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
plan = advanceAnalysisPlan(plan, { type: "set-approval-mode", mode: "auto" });
|
|
1336
|
+
plan = await writeAnalysisPlan(ctx.cwd, plan);
|
|
1337
|
+
ctx.ui.notify(`${formatAnalysisPlanStatus(plan)}\n已启用 auto:后续结果必须标注「未经人审批」。`, "warning");
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
if (cmd === "human") {
|
|
1341
|
+
let plan = await readActiveAnalysisPlan(ctx.cwd);
|
|
1342
|
+
if (!plan) {
|
|
1343
|
+
ctx.ui.notify("没有活跃 Plan。", "warning");
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
plan = advanceAnalysisPlan(plan, { type: "set-approval-mode", mode: "human" });
|
|
1347
|
+
plan = await writeAnalysisPlan(ctx.cwd, plan);
|
|
1348
|
+
ctx.ui.notify(`${formatAnalysisPlanStatus(plan)}\n已恢复人工确认。`, "info");
|
|
1247
1349
|
return;
|
|
1248
1350
|
}
|
|
1249
1351
|
if (cmd === "list") {
|
|
@@ -1273,7 +1375,7 @@ export default function psyclawExtension(pi) {
|
|
|
1273
1375
|
plan = advanceAnalysisPlan(plan, { type: "confirm", method, backend: "local-script" });
|
|
1274
1376
|
plan = advanceAnalysisPlan(plan, { type: "review" });
|
|
1275
1377
|
plan = await writeAnalysisPlan(ctx.cwd, plan);
|
|
1276
|
-
ctx.ui.notify(`${formatAnalysisPlanStatus(plan)}\n
|
|
1378
|
+
ctx.ui.notify(`${formatAnalysisPlanStatus(plan)}\n软确认完成并已审查。回复「可以」或 /plan run 开始执行。`, "info");
|
|
1277
1379
|
return;
|
|
1278
1380
|
}
|
|
1279
1381
|
if (cmd === "review") {
|
|
@@ -1516,9 +1618,9 @@ export default function psyclawExtension(pi) {
|
|
|
1516
1618
|
ctx.ui.notify([
|
|
1517
1619
|
`PsyClaw ARS profile v${PSYCLAW_ARS_PROFILE_VERSION}`,
|
|
1518
1620
|
`当前模式:${arsModeEditor?.getMode() ?? sessionMode}(Shift+Tab:chat → analysis → academic)`,
|
|
1519
|
-
"Thinking:Ctrl+Shift+
|
|
1621
|
+
"Thinking:Ctrl+Shift+T",
|
|
1520
1622
|
`来源:${ARS_REPOSITORY_URL} @ ${ARS_UPSTREAM_REF} (${ARS_UPSTREAM_COMMIT.slice(0, 12)})`,
|
|
1521
|
-
"入口:Shift+Tab,/ars doctor,/ars start,/ars full <task>,/ars stop,/
|
|
1623
|
+
"入口:Shift+Tab,/ars doctor,/ars start,/ars full <task>,/ars stop,/crosscheck,/help",
|
|
1522
1624
|
formatNatureArsFillerStatus(natureFillersFromCommandContext(ctx)),
|
|
1523
1625
|
].join("\n"), "info");
|
|
1524
1626
|
return;
|