From a46510949bf52e452f0a8f3da8b5a3584fa70371 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Thu, 5 Feb 2026 03:00:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20RemoteApp=20?= =?UTF-8?q?=E7=B1=BB=E4=BB=A5=E6=94=AF=E6=8C=81=20ListenProcessParams=20?= =?UTF-8?q?=E5=92=8C=E6=94=B9=E8=BF=9B=E6=B6=88=E6=81=AF=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=20fix:=20=E6=9B=B4=E6=96=B0=20package.json?= =?UTF-8?q?=20=E7=89=88=E6=9C=AC=E5=8F=B7=E8=87=B3=200.1.2=20feat:=20?= =?UTF-8?q?=E5=9C=A8=E9=83=A8=E7=BD=B2=E5=87=BD=E6=95=B0=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20detect=20=E6=A0=87=E5=BF=97=E4=BB=A5=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assistant/src/module/remote-app/remote-app.ts | 17 ++++++++++------- package.json | 2 +- src/command/deploy.ts | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/assistant/src/module/remote-app/remote-app.ts b/assistant/src/module/remote-app/remote-app.ts index 5e3a64f..874d4e6 100644 --- a/assistant/src/module/remote-app/remote-app.ts +++ b/assistant/src/module/remote-app/remote-app.ts @@ -1,4 +1,4 @@ -import type { App } from '@kevisual/router'; +import type { App, ListenProcessParams } from '@kevisual/router'; import { EventEmitter } from 'eventemitter3'; type RemoteAppOptions = { app?: App; @@ -7,6 +7,9 @@ type RemoteAppOptions = { emitter?: EventEmitter; id?: string; }; +/** + * 远程共享地址类似:https://kevisual.cn/ws/proxy + */ export class RemoteApp { mainApp: App; url: string; @@ -108,8 +111,6 @@ export class RemoteApp { this.emitter.off(event, listener); }; } - - sendData(data: any) { } json(data: any) { this.ws.send(JSON.stringify(data)); } @@ -119,8 +120,10 @@ export class RemoteApp { const listenFn = async (event: any) => { try { const data = event.toString(); - const body = JSON.parse(data); - const message = body.data || {}; + const body = JSON.parse(data) + const bodyData = body?.data as ListenProcessParams; + const message = bodyData?.message || {}; + const context = bodyData?.context || {}; if (body?.code === 401) { console.error('远程应用认证失败,请检查 token 是否正确'); this.isError = true; @@ -138,12 +141,12 @@ export class RemoteApp { return; } - const res = await app.call(message); + const res = await app.run(message, context); remoteApp.json({ id: body.id, data: { code: res.code, - data: res.body, + data: res.data, message: res.message, }, }); diff --git a/package.json b/package.json index 9e14240..980f25a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/cli", - "version": "0.1.1", + "version": "0.1.2", "description": "envision 命令行工具", "type": "module", "basename": "/root/cli", diff --git a/src/command/deploy.ts b/src/command/deploy.ts index fbf9ef7..dbe134c 100644 --- a/src/command/deploy.ts +++ b/src/command/deploy.ts @@ -236,6 +236,7 @@ const deployLoadFn = async (id: string, org?: string) => { data: { id: id, username: org, + detect: true, }, }); if (res.code === 200) {