psyclaw 0.27.19 → 0.27.20
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/package.json +1 -1
- package/scripts/rebrand-pi.mjs +32 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
PsyClaw 是面向社会科学研究的智能体工作台。它把研究项目、证据来源、Claim-Evidence 账本、完整性门禁、可恢复工作流和本地面板接到内置运行时上;只有无法由证据和通行方法消解、且会实质改变研究设计或解释的分歧才交由研究者取舍。它不替代统计软件,也不会把未经核验的引用、结果或审稿意见写成事实。
|
|
4
4
|
|
|
5
|
-
当前版本:`0.27.
|
|
5
|
+
当前版本:`0.27.20`。正式命令、用户配置目录和后续发布统一使用 `psyclaw`。
|
|
6
6
|
|
|
7
7
|
## 发布流程
|
|
8
8
|
|
|
@@ -19,19 +19,19 @@ RELEASE_MESSAGE="release: describe the change" pnpm release:push
|
|
|
19
19
|
需要 Node.js `>=22.19.0`。官方 npm 源:
|
|
20
20
|
|
|
21
21
|
```powershell
|
|
22
|
-
npm install -g psyclaw@0.27.
|
|
22
|
+
npm install -g psyclaw@0.27.20
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
如果本机 npm 配置把 registry 误写成带有 `~/` 的地址,请显式指定官方源:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install -g psyclaw@0.27.
|
|
28
|
+
npm install -g psyclaw@0.27.20 --registry=https://registry.npmjs.org/
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
中国大陆网络较慢或无法访问官方源时:
|
|
32
32
|
|
|
33
33
|
```powershell
|
|
34
|
-
npm install -g psyclaw@0.27.
|
|
34
|
+
npm install -g psyclaw@0.27.20 --registry=https://registry.npmmirror.com
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
确认命令入口:
|
package/package.json
CHANGED
package/scripts/rebrand-pi.mjs
CHANGED
|
@@ -435,6 +435,35 @@ async function applySettingsPatches(settingsManagerPath) {
|
|
|
435
435
|
return applied;
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
+
const MANAGED_TOOL_DOWNLOAD_GUARD = ` // PsyClaw supplies Node-based find/grep fallbacks. Keep PATH tools when
|
|
439
|
+
// present, but never fetch optional binaries from GitHub during startup.
|
|
440
|
+
return undefined;`;
|
|
441
|
+
|
|
442
|
+
/** Disable Pi's optional binary downloads without enabling global offline mode. */
|
|
443
|
+
export function disableManagedToolDownloads(content) {
|
|
444
|
+
if (content.includes(MANAGED_TOOL_DOWNLOAD_GUARD)) {
|
|
445
|
+
return { content, applied: false };
|
|
446
|
+
}
|
|
447
|
+
const existingToolCheck = ` if (existingPath) {
|
|
448
|
+
return existingPath;
|
|
449
|
+
}`;
|
|
450
|
+
const occurrences = content.split(existingToolCheck).length - 1;
|
|
451
|
+
if (occurrences !== 1 || !content.includes("export async function ensureTool(tool, onStatus)")) {
|
|
452
|
+
throw new Error(`Expected exactly one Pi managed-tool availability check, found ${occurrences}`);
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
content: content.replace(existingToolCheck, `${existingToolCheck}\n${MANAGED_TOOL_DOWNLOAD_GUARD}`),
|
|
456
|
+
applied: true,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
async function applyManagedToolPatches(toolsManagerPath) {
|
|
461
|
+
const current = await readFile(toolsManagerPath, "utf8");
|
|
462
|
+
const result = disableManagedToolDownloads(current);
|
|
463
|
+
if (result.applied) await atomicReplace(toolsManagerPath, result.content, true);
|
|
464
|
+
return result.applied;
|
|
465
|
+
}
|
|
466
|
+
|
|
438
467
|
export async function rebrandPiRuntime(options = {}) {
|
|
439
468
|
const entry = import.meta.resolve("@earendil-works/pi-coding-agent");
|
|
440
469
|
const pkgDir = dirname(dirname(fileURLToPath(entry)));
|
|
@@ -442,15 +471,17 @@ export async function rebrandPiRuntime(options = {}) {
|
|
|
442
471
|
const modePath = join(pkgDir, "dist", "modes", "interactive", "interactive-mode.js");
|
|
443
472
|
const settingsManagerPath = join(pkgDir, "dist", "core", "settings-manager.js");
|
|
444
473
|
const slashCommandsPath = join(pkgDir, "dist", "core", "slash-commands.js");
|
|
474
|
+
const toolsManagerPath = join(pkgDir, "dist", "utils", "tools-manager.js");
|
|
445
475
|
|
|
446
476
|
const pkgResult = await patchPackageJson(pkgPath);
|
|
447
477
|
const applied = await applyModePatches(modePath);
|
|
448
478
|
const settingsApplied = await applySettingsPatches(settingsManagerPath);
|
|
449
479
|
const commandApplied = await applySlashCommandPatches(slashCommandsPath);
|
|
480
|
+
const managedToolsApplied = await applyManagedToolPatches(toolsManagerPath);
|
|
450
481
|
|
|
451
482
|
if (!options.quiet) {
|
|
452
483
|
process.stdout.write(
|
|
453
|
-
`psyclaw rebrand: piConfig ${pkgResult.applied ? "applied" : "already set"} · ${applied.length > 0 ? `patched ${applied.length} display string(s)` : "display strings already patched"} · ${settingsApplied.length > 0 ? `patched ${settingsApplied.length} setting default(s)` : "settings already patched"} · ${commandApplied.length > 0 ? `hidden ${commandApplied.length} Pi command(s)` : "Pi commands already filtered"} (${pkgDir})\n`,
|
|
484
|
+
`psyclaw rebrand: piConfig ${pkgResult.applied ? "applied" : "already set"} · ${applied.length > 0 ? `patched ${applied.length} display string(s)` : "display strings already patched"} · ${settingsApplied.length > 0 ? `patched ${settingsApplied.length} setting default(s)` : "settings already patched"} · ${commandApplied.length > 0 ? `hidden ${commandApplied.length} Pi command(s)` : "Pi commands already filtered"} · ${managedToolsApplied ? "disabled managed-tool downloads" : "managed-tool downloads already disabled"} (${pkgDir})\n`,
|
|
454
485
|
);
|
|
455
486
|
if (applied.length > 0) {
|
|
456
487
|
for (const label of applied) {
|