@yeaft/webchat-agent 1.0.375 → 1.0.376
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/index.js +2 -1
- package/local-runtime/server/handlers/agent-sync.js +1 -1
- package/local-runtime/server/handlers/client-misc.js +9 -19
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +71 -71
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +1 -1
- package/package.json +1 -1
- package/upgrade-command.js +4 -0
- package/windows-upgrade-bootstrap.js +4 -2
- package/windows-upgrade-runner.js +0 -2
package/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import { loadNodePty } from './terminal.js';
|
|
|
22
22
|
import { connect } from './connection.js';
|
|
23
23
|
import { loadMcpServers } from './mcp.js';
|
|
24
24
|
import { getManagedSandboxIdentity } from './managed-sandbox/identity-store.js';
|
|
25
|
+
import { SAFE_REMOTE_UPGRADE_CAPABILITY } from './upgrade-command.js';
|
|
25
26
|
import { loadConfig as loadYeaftConfig } from './yeaft/config.js';
|
|
26
27
|
import {
|
|
27
28
|
ensureManagedCliTools,
|
|
@@ -157,7 +158,7 @@ async function detectCapabilities() {
|
|
|
157
158
|
// agent build can speak plaintext WS frames. New servers see this and
|
|
158
159
|
// flip `agent.encryptOutbound = false`, stopping outbound encryption
|
|
159
160
|
// to this peer. Old servers ignore the unknown capability token.
|
|
160
|
-
const capabilities = ['background_tasks', 'file_editor', 'ping_session', 'plaintext-ok', 'work_center', 'work_center_message_v2', 'session_history_search', 'session_history_outline', 'session_history_window_prefetch'];
|
|
161
|
+
const capabilities = ['background_tasks', 'file_editor', 'ping_session', 'plaintext-ok', SAFE_REMOTE_UPGRADE_CAPABILITY, 'work_center', 'work_center_message_v2', 'session_history_search', 'session_history_outline', 'session_history_window_prefetch'];
|
|
161
162
|
if (MANAGED_SANDBOX_IDENTITY) capabilities.push('managed-sandbox');
|
|
162
163
|
if (process.platform === 'linux') capabilities.push('work_item_attachments');
|
|
163
164
|
const pty = await loadNodePty();
|
|
@@ -176,7 +176,7 @@ export async function handleAgentSync(agentId, agent, msg) {
|
|
|
176
176
|
(agent.ownerId && client.userId === agent.ownerId) ||
|
|
177
177
|
(!agent.ownerId && client.role === 'admin')
|
|
178
178
|
)) {
|
|
179
|
-
await sendToWebClient(client, { type: 'upgrade_agent_ack', agentId, success: msg.success, error: msg.error, alreadyLatest: msg.alreadyLatest, version: msg.version, reason: msg.reason, currentNode: msg.currentNode, requiredNode: msg.requiredNode });
|
|
179
|
+
await sendToWebClient(client, { type: 'upgrade_agent_ack', agentId, success: msg.success, error: msg.error, alreadyLatest: msg.alreadyLatest, version: msg.version, reason: msg.reason, currentNode: msg.currentNode, requiredNode: msg.requiredNode, requiredCapability: msg.requiredCapability });
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
break;
|
|
@@ -3,23 +3,13 @@ import {
|
|
|
3
3
|
sendToWebClient, forwardToAgent, broadcastAgentList
|
|
4
4
|
} from '../ws-utils.js';
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
6
|
+
// Only Agents that explicitly advertise the package-replacement-safe updater
|
|
7
|
+
// may receive remote upgrade commands. Version thresholds are insufficient:
|
|
8
|
+
// builds without this capability may still inherit the installed package cwd.
|
|
9
|
+
export const SAFE_REMOTE_UPGRADE_CAPABILITY = 'remote_upgrade_safe';
|
|
9
10
|
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
return match ? match.slice(1).map(Number) : null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function requiresManualUpgradeBridge(version) {
|
|
16
|
-
const current = parseVersion(version);
|
|
17
|
-
const minimum = parseVersion(MIN_SAFE_REMOTE_UPGRADE_VERSION);
|
|
18
|
-
if (!current || !minimum) return true;
|
|
19
|
-
for (let index = 0; index < minimum.length; index++) {
|
|
20
|
-
if (current[index] !== minimum[index]) return current[index] < minimum[index];
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
11
|
+
export function requiresManualUpgradeBridge(capabilities) {
|
|
12
|
+
return !Array.isArray(capabilities) || !capabilities.includes(SAFE_REMOTE_UPGRADE_CAPABILITY);
|
|
23
13
|
}
|
|
24
14
|
|
|
25
15
|
/**
|
|
@@ -46,15 +36,15 @@ export async function handleClientMisc(clientId, client, msg, checkAgentAccess)
|
|
|
46
36
|
if (!upgradeAgentId) break;
|
|
47
37
|
if (!await checkAgentAccess(upgradeAgentId)) break;
|
|
48
38
|
const upgradeAgent = agents.get(upgradeAgentId);
|
|
49
|
-
if (requiresManualUpgradeBridge(upgradeAgent?.
|
|
39
|
+
if (requiresManualUpgradeBridge(upgradeAgent?.capabilities)) {
|
|
50
40
|
await sendToWebClient(client, {
|
|
51
41
|
type: 'upgrade_agent_ack',
|
|
52
42
|
agentId: upgradeAgentId,
|
|
53
43
|
success: false,
|
|
54
44
|
reason: 'manual_upgrade_required',
|
|
55
45
|
version: upgradeAgent?.version || null,
|
|
56
|
-
|
|
57
|
-
error: `Agent ${upgradeAgent?.version || 'unknown'}
|
|
46
|
+
requiredCapability: SAFE_REMOTE_UPGRADE_CAPABILITY,
|
|
47
|
+
error: `Agent ${upgradeAgent?.version || 'unknown'} does not advertise the safe remote-upgrade contract. First stop the selected Agent/service on that machine: if it runs under PM2 or another service manager, stop that exact instance there; if it runs in a foreground terminal, terminate that process. Confirm that process has exited, then run "npm install -g @yeaft/webchat-agent@latest --registry=https://pkg.yeaft.com/". Finally, restart the same Agent instance with its original configuration.`,
|
|
58
48
|
});
|
|
59
49
|
break;
|
|
60
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.376"}
|