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.
- package/lib/index.js +12 -3
- 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
|
|
612
|
-
//
|
|
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