@yeaft/webchat-agent 1.0.388 → 1.0.390
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/connection/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export function connect(WebSocketImpl = WebSocket) {
|
|
|
25
25
|
name: ctx.CONFIG.agentName,
|
|
26
26
|
instanceId,
|
|
27
27
|
workDir: ctx.CONFIG.workDir,
|
|
28
|
+
platform: process.platform,
|
|
28
29
|
capabilities: ctx.agentCapabilities.join(',')
|
|
29
30
|
});
|
|
30
31
|
|
|
@@ -72,7 +73,8 @@ export function connect(WebSocketImpl = WebSocket) {
|
|
|
72
73
|
tempId: msg.tempId,
|
|
73
74
|
secret: ctx.CONFIG.agentSecret,
|
|
74
75
|
capabilities: ctx.agentCapabilities,
|
|
75
|
-
version: ctx.agentVersion
|
|
76
|
+
version: ctx.agentVersion,
|
|
77
|
+
platform: process.platform
|
|
76
78
|
}));
|
|
77
79
|
return;
|
|
78
80
|
}
|
|
@@ -8,8 +8,14 @@ import {
|
|
|
8
8
|
// builds without this capability may still inherit the installed package cwd.
|
|
9
9
|
export const SAFE_REMOTE_UPGRADE_CAPABILITY = 'remote_upgrade_safe';
|
|
10
10
|
|
|
11
|
-
export function requiresManualUpgradeBridge(capabilities) {
|
|
12
|
-
|
|
11
|
+
export function requiresManualUpgradeBridge(capabilities, platform = null) {
|
|
12
|
+
if (Array.isArray(capabilities) && capabilities.includes(SAFE_REMOTE_UPGRADE_CAPABILITY)) return false;
|
|
13
|
+
const normalizedPlatform = typeof platform === 'string' ? platform.trim().toLowerCase() : '';
|
|
14
|
+
if (normalizedPlatform) return normalizedPlatform === 'win32';
|
|
15
|
+
// v1.0.373 predates explicit platform metadata but advertises this Linux-only
|
|
16
|
+
// capability, so it is safe to distinguish from the affected Windows build.
|
|
17
|
+
if (Array.isArray(capabilities) && capabilities.includes('work_item_attachments')) return false;
|
|
18
|
+
return true;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
/**
|
|
@@ -36,7 +42,7 @@ export async function handleClientMisc(clientId, client, msg, checkAgentAccess)
|
|
|
36
42
|
if (!upgradeAgentId) break;
|
|
37
43
|
if (!await checkAgentAccess(upgradeAgentId)) break;
|
|
38
44
|
const upgradeAgent = agents.get(upgradeAgentId);
|
|
39
|
-
if (requiresManualUpgradeBridge(upgradeAgent?.capabilities)) {
|
|
45
|
+
if (requiresManualUpgradeBridge(upgradeAgent?.capabilities, upgradeAgent?.platform)) {
|
|
40
46
|
await sendToWebClient(client, {
|
|
41
47
|
type: 'upgrade_agent_ack',
|
|
42
48
|
agentId: upgradeAgentId,
|
|
@@ -54,6 +54,7 @@ export function handleAgentConnection(ws, url) {
|
|
|
54
54
|
const agentName = url.searchParams.get('name') || `Agent-${clientAgentId.slice(0, 8)}`;
|
|
55
55
|
const instanceId = url.searchParams.get('instanceId') || clientAgentId;
|
|
56
56
|
const workDir = url.searchParams.get('workDir') || '';
|
|
57
|
+
const urlPlatform = url.searchParams.get('platform') || null;
|
|
57
58
|
|
|
58
59
|
// Both authenticated and SKIP_AUTH connections use the existing auth frame
|
|
59
60
|
// for registration metadata. Released Agents already send their version there;
|
|
@@ -118,6 +119,9 @@ export function handleAgentConnection(ws, url) {
|
|
|
118
119
|
|
|
119
120
|
const capabilities = Array.isArray(msg.capabilities) ? msg.capabilities : urlCapabilities;
|
|
120
121
|
const agentVersion = msg.version || null;
|
|
122
|
+
const agentPlatform = typeof msg.platform === 'string' && msg.platform
|
|
123
|
+
? msg.platform
|
|
124
|
+
: urlPlatform;
|
|
121
125
|
// Local no-auth mode still has one durable browser owner. This makes
|
|
122
126
|
// the server-side Session catalog persistent without changing generic
|
|
123
127
|
// development-server behavior, which remains ownerless.
|
|
@@ -149,6 +153,7 @@ export function handleAgentConnection(ws, url) {
|
|
|
149
153
|
ownerUsername,
|
|
150
154
|
agentVersion,
|
|
151
155
|
registeredInstanceId,
|
|
156
|
+
agentPlatform,
|
|
152
157
|
);
|
|
153
158
|
pruneAgentConnectionGenerations();
|
|
154
159
|
}
|
|
@@ -233,7 +238,7 @@ function handleAgentDisconnect(agentId, agentName, ws) {
|
|
|
233
238
|
broadcastAgentList();
|
|
234
239
|
}
|
|
235
240
|
|
|
236
|
-
function completeAgentRegistration(ws, agentId, agentName, workDir, sessionKey, capabilities = [], ownerId = null, ownerUsername = null, agentVersion = null, instanceId = null) {
|
|
241
|
+
function completeAgentRegistration(ws, agentId, agentName, workDir, sessionKey, capabilities = [], ownerId = null, ownerUsername = null, agentVersion = null, instanceId = null, agentPlatform = null) {
|
|
237
242
|
// 如果是重连,保留 conversations;否则(server 重启)创建空 Map
|
|
238
243
|
const existingAgent = agents.get(agentId);
|
|
239
244
|
const conversations = existingAgent?.conversations || new Map();
|
|
@@ -270,6 +275,7 @@ function completeAgentRegistration(ws, agentId, agentName, workDir, sessionKey,
|
|
|
270
275
|
ownerId,
|
|
271
276
|
ownerUsername,
|
|
272
277
|
version: agentVersion,
|
|
278
|
+
platform: agentPlatform,
|
|
273
279
|
encryptOutbound
|
|
274
280
|
});
|
|
275
281
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.390"}
|
package/package.json
CHANGED