dsh-agentone 0.5.2 → 0.5.3

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.
Files changed (2) hide show
  1. package/lib/index.js +12 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -526,6 +526,15 @@ button{font:inherit;padding:9px 22px;border-radius:10px;border:none;cursor:point
526
526
  });
527
527
  }
528
528
 
529
+ /**
530
+ * 是否运行在 DSH Desktop 内:宿主进程是 Electron(execPath 指向 DSH Desktop
531
+ * 可执行文件)。Desktop 的 webserver 只信 Electron 内部请求,外部浏览器回调
532
+ * 必须走一次性本地服务,与页面侧的自检(page.js/client.js)互为兜底。
533
+ */
534
+ function isDesktopHost() {
535
+ return /DSH Desktop\.app/i.test(process.execPath);
536
+ }
537
+
529
538
  export function apply(ctx, config) {
530
539
  const log = ctx.logger || console;
531
540
  ctx.effect(() => {
@@ -608,9 +617,9 @@ export function apply(ctx, config) {
608
617
  try {
609
618
  const body = await readJsonBody(request);
610
619
  // DSH Desktop:宿主 webserver 只信 Electron 内部请求,外部浏览器访问
611
- // /agentone/callback 会 403。desktop 模式(body.desktop)改由插件在本
612
- // 进程起一次性本地服务收回调(见 openCallbackServer),收完即关。
613
- const callbackUrl = body.desktop
620
+ // /agentone/callback 会 403。desktop 环境(服务端自检 execPath 或页面
621
+ // desktop 标记)改由插件在本进程起一次性本地服务收回调。
622
+ const callbackUrl = body.desktop || isDesktopHost()
614
623
  ? await openCallbackServer(config, log)
615
624
  : String(body.callback_url || '');
616
625
  if (!/^https?:\/\/|^\/portal\//.test(callbackUrl)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agentone",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "AgentOne 平台集成插件:飞书登录、平台模型、SkillHub 技能、套餐申请、插件管理、lark-cli / ccpg-cli 探测(请求超时与错误码透传、令牌轮换 single-flight、凭据损坏容错、状态页 UX 增强)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",