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) {