dsh-agentone 0.5.14 → 0.5.15
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/page.js +35 -6
- package/package.json +1 -1
package/lib/page.js
CHANGED
|
@@ -426,8 +426,26 @@ const renderCli = async (s) => {
|
|
|
426
426
|
body.innerHTML = '<div class="skill-sub" style="color:var(--err)">CLI 状态检测失败,请稍后重试。</div>';
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
|
+
renderCliData(s, tools);
|
|
430
|
+
};
|
|
431
|
+
// 纯渲染:tools 形如 { 'lark-cli': {state,version,latest}, ... }。
|
|
432
|
+
// 升级成功后端会带回升级后立即探测的单工具详情,直接合进缓存同步刷新,
|
|
433
|
+
// 不再整页二次探测(否则要再等一轮「检测中…」,用户以为没生效)。
|
|
434
|
+
const renderCliData = (s, tools) => {
|
|
435
|
+
renderCli._tools = { ...(renderCli._tools || {}), ...tools };
|
|
436
|
+
const allTools = renderCli._tools;
|
|
437
|
+
const cliEnabled = s.capabilities?.cli_deployd_enabled !== false;
|
|
438
|
+
const body = $('cli-body');
|
|
439
|
+
if (!s.logged_in) {
|
|
440
|
+
body.innerHTML = '<div class="skill-sub">登录后可用公司托管的 CLI 工具。</div>';
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (!cliEnabled) {
|
|
444
|
+
body.innerHTML = '<div class="skill-sub">平台未开启 CLI 功能。</div>';
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
429
447
|
const rows = Object.entries(CLI_TOOL_META).map(([name, meta]) => {
|
|
430
|
-
const info =
|
|
448
|
+
const info = allTools[name] || { state: 'missing' };
|
|
431
449
|
const state = info.state || 'missing';
|
|
432
450
|
const status = state === 'authorized'
|
|
433
451
|
? '<span class="pill ok" style="font-size:11px">已授权</span>'
|
|
@@ -468,10 +486,17 @@ const cliUpgrade = async (tool, btn) => {
|
|
|
468
486
|
});
|
|
469
487
|
const data = await resp.json().catch(() => ({}));
|
|
470
488
|
if (!resp.ok) throw new Error(data.error || 'CLI 升级失败');
|
|
489
|
+
// 升级响应自带升级后立即探测的单工具详情:先同步刷新界面再弹输出,
|
|
490
|
+
// 用户关掉弹窗时看到的就是新版本(此前弹窗阻塞 + 整页二次探测,
|
|
491
|
+
// 界面长时间停留旧版本,用户以为升级没生效)
|
|
492
|
+
renderCli._probedAt = 0;
|
|
493
|
+
if (data.tool) {
|
|
494
|
+
renderCliData(lastStatus, { [tool]: data.tool });
|
|
495
|
+
} else {
|
|
496
|
+
renderCli(lastStatus);
|
|
497
|
+
}
|
|
471
498
|
// lark-cli 手动安装时 update 只会打印下载地址,原样展示给用户
|
|
472
499
|
if (data.output) alert(data.output);
|
|
473
|
-
renderCli._probedAt = 0;
|
|
474
|
-
renderCli(lastStatus);
|
|
475
500
|
} catch (error) {
|
|
476
501
|
alert(error.message || 'CLI 升级失败,请稍后重试');
|
|
477
502
|
btn.disabled = false;
|
|
@@ -509,12 +534,16 @@ const renderPlugins = async () => {
|
|
|
509
534
|
return;
|
|
510
535
|
}
|
|
511
536
|
const rows = data.plugins.map((plugin) => {
|
|
512
|
-
//
|
|
537
|
+
// 状态区分三种:未安装 → 安装按钮;插件(带 bundle 声明)→ 激活态;
|
|
538
|
+
// 纯依赖(无 bundle 声明,如 @larksuite/cli 这类 CLI 工具包)→ 「依赖」
|
|
539
|
+
// 标签——它永远不进 bundle 层,不能显示「未激活/重启生效」误导用户
|
|
513
540
|
const statePill = !plugin.version
|
|
514
541
|
? '<span class="pill warn" style="font-size:11px">未安装</span>'
|
|
515
542
|
: plugin.active
|
|
516
543
|
? '<span class="pill ok" style="font-size:11px">已激活</span>'
|
|
517
|
-
:
|
|
544
|
+
: plugin.bundled
|
|
545
|
+
? '<span class="pill warn" style="font-size:11px">未激活</span>'
|
|
546
|
+
: '<span class="tag">依赖</span>';
|
|
518
547
|
const builtinTag = plugin.builtin
|
|
519
548
|
? '<span class="tag">内置</span>'
|
|
520
549
|
: '';
|
|
@@ -543,7 +572,7 @@ const renderPlugins = async () => {
|
|
|
543
572
|
return '<div class="skill-item"><div class="skill-info"><div class="skill-name">'
|
|
544
573
|
+ esc(plugin.name) + builtinTag + statePill
|
|
545
574
|
+ '</div><div class="skill-sub">' + desc + esc(plugin.source) + ' · ' + version
|
|
546
|
-
+ (plugin.
|
|
575
|
+
+ (plugin.bundled && !plugin.active ? ' · 未在 bundle 层,重启 dsh 后生效' : '')
|
|
547
576
|
+ '</div></div>' + actionHtml + '</div>';
|
|
548
577
|
});
|
|
549
578
|
list.innerHTML = rows.join('');
|
package/package.json
CHANGED