dsh-agentone 0.5.27 → 0.5.28
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/lib/proc.js +42 -15
- package/package.json +4 -1
package/lib/proc.js
CHANGED
|
@@ -536,10 +536,16 @@ async function cliLatestVersion(tool, timeoutMs) {
|
|
|
536
536
|
return typeof data?.latest_version === 'string' ? data.latest_version : null;
|
|
537
537
|
}
|
|
538
538
|
if (tool === 'lark-cli') {
|
|
539
|
-
//
|
|
540
|
-
//
|
|
541
|
-
|
|
542
|
-
|
|
539
|
+
// npm 机器查 npm view;无 npm 的机器(仅独立 pnpm / DSH Desktop 自带
|
|
540
|
+
// shim)退化 pnpm view——否则升级检测在整类机器上都悄悄失效,升级
|
|
541
|
+
// 按钮永远不出现(与安装走 pnpm 分支是同一环境类)
|
|
542
|
+
try {
|
|
543
|
+
const { stdout } = await runCliTool('npm', ['view', '@larksuite/cli', 'version'], { timeoutMs });
|
|
544
|
+
return parseCliVersion(stdout);
|
|
545
|
+
} catch {
|
|
546
|
+
const version = await pnpmViewLatest('@larksuite/cli').catch(() => null);
|
|
547
|
+
return version || null;
|
|
548
|
+
}
|
|
543
549
|
}
|
|
544
550
|
return null;
|
|
545
551
|
}
|
|
@@ -586,12 +592,21 @@ async function installLarkSkills({ timeoutMs = 180_000 } = {}) {
|
|
|
586
592
|
} catch {
|
|
587
593
|
// 目录不存在 → 未安装,继续
|
|
588
594
|
}
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
+
const args = ['skills', 'add', 'larksuite/cli', '-g', '--all', '--dangerously-accept-openclaw-risks'];
|
|
596
|
+
const tail = (out) => String(out).split('\n').map((l) => l.trim()).filter(Boolean).slice(-3).join('\n');
|
|
597
|
+
// 包执行器降级链:优先 npx(npm 机器);无 npm 的机器(仅独立 pnpm 或
|
|
598
|
+
// DSH Desktop 自带 shim)走 pnpm dlx——真实用户机 pnpm 装完 lark-cli 后
|
|
599
|
+
// 卡在 npx 缺失的引导文案上,被当成安装失败报上来;两者都缺则温和
|
|
600
|
+
// 跳过(技能是增强项,不该阻断安装成功的呈现)
|
|
601
|
+
if (resolveCommandOrNull('npx')) {
|
|
602
|
+
const { stdout } = await runCliTool('npx', ['-y', ...args], { timeoutMs });
|
|
603
|
+
return tail(stdout);
|
|
604
|
+
}
|
|
605
|
+
if (resolveCommandOrNull('pnpm')) {
|
|
606
|
+
const { stdout } = await runCliTool('pnpm', ['dlx', ...args], { timeoutMs });
|
|
607
|
+
return tail(stdout);
|
|
608
|
+
}
|
|
609
|
+
return 'lark-cli 已安装。默认技能包暂跳过(本机暂无 npm/npx,不影响 CLI 功能;如需技能可安装 Node.js 后重新点「安装」)';
|
|
595
610
|
}
|
|
596
611
|
|
|
597
612
|
/**
|
|
@@ -625,11 +640,20 @@ export async function installCliTool(tool, { timeoutMs = 600_000 } = {}) {
|
|
|
625
640
|
const dir = /global bin directory "(.+?)" is not in PATH/i.exec(String(error?.message || ''))?.[1];
|
|
626
641
|
if (!dir) throw error;
|
|
627
642
|
extraBinDirsCache = [...extraBinDirs(), dir];
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
643
|
+
({ stdout } = await pnpmInstall());
|
|
644
|
+
}
|
|
645
|
+
// pnpm 全局 bin 的真实落点随版本/配置漂移(v10 是 %LOCALAPPDATA%\
|
|
646
|
+
// pnpm\bin,PNPM_HOME 自定义更随意,v11 又不同)——装完问 pnpm 本尊
|
|
647
|
+
// 要实际目录并常驻兑底缓存:否则状态页探测不到刚装的 lark-cli,
|
|
648
|
+
// 明明装成功却显示「未安装」(真实用户机 0.5.27 实测)
|
|
649
|
+
try {
|
|
650
|
+
const { stdout: binOut } = await runCliTool('pnpm', ['bin', '-g'], { timeoutMs: 20_000 });
|
|
651
|
+
const dir = String(binOut || '').split('\n').map((l) => l.trim()).filter(Boolean).pop();
|
|
652
|
+
if (dir && !extraBinDirs().includes(dir)) {
|
|
653
|
+
extraBinDirsCache = [...extraBinDirs(), dir];
|
|
632
654
|
}
|
|
655
|
+
} catch {
|
|
656
|
+
// 问不到不阻断:静态兑底目录仍兜底
|
|
633
657
|
}
|
|
634
658
|
} else if (process.platform === 'win32') {
|
|
635
659
|
const nodeNote = await installNodeWindows(timeoutMs);
|
|
@@ -879,7 +903,10 @@ export async function upgradeCliTool(tool, { timeoutMs = 300_000 } = {}) {
|
|
|
879
903
|
const lines = String(stdout).split('\n').map((l) => l.trim()).filter(Boolean);
|
|
880
904
|
return lines.slice(-6).join('\n');
|
|
881
905
|
} catch (error) {
|
|
882
|
-
if (tool === 'lark-cli'
|
|
906
|
+
if (tool === 'lark-cli') {
|
|
907
|
+
// 老版本 update 子命令不存在(unknown command)→ 重装即升级;其余
|
|
908
|
+
// 失败(如 pnpm 装的 lark-cli 内部走 npm 自升级而本机无 npm)也统
|
|
909
|
+
// 一落到 installCliTool——它按机器环境选对安装器并兜底探测落点
|
|
883
910
|
return installCliTool('lark-cli', { timeoutMs });
|
|
884
911
|
}
|
|
885
912
|
throw error;
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agentone",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.28",
|
|
4
4
|
"description": "AgentOne 平台集成插件:飞书登录、平台模型(同步失败自愈重试)、SkillHub 技能(升级检测一键升级、装后即时刷新、套餐技能自动同步)、套餐申请、插件管理与自助升级、lark-cli / ccpg-cli 探测与一键安装(请求超时与错误码透传、令牌轮换 single-flight、凭据损坏容错与并发安全写入、状态页 UX 增强)",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"smoke": "node scripts/env-matrix-smoke.mjs"
|
|
8
|
+
},
|
|
6
9
|
"main": "lib/index.js",
|
|
7
10
|
"exports": {
|
|
8
11
|
".": "./lib/index.js",
|