@mindexec/cli 0.2.478 → 0.2.480
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/README.md +323 -323
- package/codex-model-catalog.js +202 -202
- package/codex-runtime.js +1608 -1608
- package/desktop-workspace-state.cjs +120 -120
- package/electron/main.cjs +517 -517
- package/electron/preload.cjs +17 -17
- package/electron/recurring-update-owner-smoke.mjs +55 -55
- package/electron/recurring-update-owner.cjs +97 -97
- package/electron/source-smoke.mjs +108 -108
- package/electron/update-feed-resolver.cjs +79 -79
- package/electron/update-feed.json +10 -10
- package/electron/update-manager-smoke.mjs +146 -146
- package/electron/update-manager.cjs +297 -297
- package/electron/windows-package-smoke.mjs +156 -156
- package/launch-bridge.cjs +236 -236
- package/lzo1x.js +110 -110
- package/mode4-atlas-worker.js +440 -440
- package/mode4-atlas.js +130 -130
- package/package.json +1 -1
- package/port-guard.cjs +285 -285
- package/remote-fast/osx-arm64/MacScreenCaptureKitH264.swift +339 -339
- package/remote-fast/osx-arm64/MacSystemAudioCapture.swift +214 -214
- package/remote-fast/osx-arm64/UnixRawCaptureHelper.mjs +80 -80
- package/remote-fast/osx-arm64/livedesk-raw-capture-resampler.mjs +73 -73
- package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/osx-x64/MacScreenCaptureKitH264.swift +339 -339
- package/remote-fast/osx-x64/MacSystemAudioCapture.swift +214 -214
- package/remote-fast/osx-x64/UnixRawCaptureHelper.mjs +80 -80
- package/remote-fast/osx-x64/livedesk-raw-capture-resampler.mjs +73 -73
- package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
- package/remote-hub.js +3698 -3698
- package/scripts/auth-session-smoke.mjs +262 -262
- package/scripts/board-render-ownership-smoke.mjs +85 -85
- package/scripts/codex-model-catalog-smoke.mjs +150 -150
- package/scripts/codex-runtime-home-smoke.mjs +58 -58
- package/scripts/codex-sdk-image-live-smoke.mjs +43 -43
- package/scripts/codex-sdk-image-runtime-smoke.mjs +122 -122
- package/scripts/codex-sdk-runtime-smoke.mjs +89 -89
- package/scripts/desktop-update-publisher-smoke.mjs +89 -89
- package/scripts/desktop-update-worker-smoke.mjs +72 -72
- package/scripts/desktop-workspace-state-smoke.mjs +81 -81
- package/scripts/drive-installed-update-smoke.mjs +67 -67
- package/scripts/npm-fresh-install-smoke.mjs +216 -216
- package/scripts/publish-mindexec-desktop-updates.mjs +224 -224
- package/scripts/remote-agent-managed-smoke.mjs +318 -318
- package/scripts/remote-agent-package-smoke.mjs +64 -64
- package/scripts/remote-agent-ws-smoke.mjs +269 -269
- package/scripts/remote-fast-live-rate-smoke.mjs +343 -343
- package/scripts/remote-fast-mdm-browser-smoke.mjs +453 -453
- package/scripts/remote-fleet-render-smoke.mjs +1350 -1350
- package/scripts/remote-frame-ws-smoke.mjs +234 -234
- package/scripts/remote-http-smoke.mjs +592 -592
- package/scripts/remote-hub-identity-smoke.mjs +146 -146
- package/scripts/remote-hub-scale-smoke.mjs +124 -124
- package/scripts/remote-hub-smoke.mjs +699 -699
- package/scripts/remote-input-ws-smoke.mjs +263 -263
- package/scripts/remote-registry-follower-smoke.mjs +815 -815
- package/scripts/setup-tree-sitter-grammars.mjs +59 -59
- package/server.js +7510 -7510
- package/start-bridge.bat +32 -32
- package/start-bridge.sh +81 -81
- package/tree-sitter-grammars/README.md +18 -0
- package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
- package/wwwroot/_content/MindExecution.Plugins.Admin/css/admin-dashboard.css +546 -546
- package/wwwroot/_content/MindExecution.Plugins.Directory/background.png +0 -0
- package/wwwroot/_content/MindExecution.Plugins.YouTube/css/youtube-search.css +251 -251
- package/wwwroot/_content/MindExecution.Shared/css/mind-map-overrides.css +3789 -3789
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Bold.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Regular.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/js/agent-visualization.js +27 -27
- package/wwwroot/_content/MindExecution.Shared/js/background-themes.js +1449 -1449
- package/wwwroot/_content/MindExecution.Shared/js/code-master.js +8316 -8316
- package/wwwroot/_content/MindExecution.Shared/js/file-system-helper.js +338 -338
- package/wwwroot/_content/MindExecution.Shared/js/marked.min.js +69 -69
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-animated-image-preview.js +270 -270
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-automation-edge-motion.js +170 -170
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-board-render-ownership.js +81 -81
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +10528 -10506
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js.backup +1059 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-hotpath.js +902 -902
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-manager.js +24637 -24637
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dev-guards.js +325 -325
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js +1491 -1491
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js.bak +434 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-glow-shader.js +70 -70
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-image-policy.js +218 -218
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +7081 -7087
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-plan-worker.js +160 -160
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +9960 -9958
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-video-placeholder.js +107 -107
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-logic-workers.js +1004 -1004
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +1351 -1351
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-multi-select.js +865 -865
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-node-search-worker.js +554 -554
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +4771 -4744
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-normal-boundary-optimizer.js +624 -624
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js +241 -241
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js.backup +372 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-pipeline.js +2290 -2290
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-remote-codecs.js +202 -202
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-render-plan.js +1971 -1971
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-lod-system.js +93 -93
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +2391 -2391
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js.backup +1258 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-video-playback-controls.js +95 -95
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-visibility-worker.js +895 -895
- package/wwwroot/_content/MindExecution.Shared/js/mindmap-toolbar.js +636 -636
- package/wwwroot/_content/MindExecution.Shared/js/native-drop-handler.js +45 -45
- package/wwwroot/_content/MindExecution.Shared/js/plan-master.js +117 -117
- package/wwwroot/_content/MindExecution.Shared/js/renderers/CSS3DRenderer.js +114 -114
- package/wwwroot/_content/MindExecution.Shared/js/texture-worker-manager.js +10 -10
- package/wwwroot/_content/MindExecution.Shared/js/three.min.js +6 -6
- package/wwwroot/_content/MindExecution.Shared/js/token-manager.js +7 -7
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js +6 -6
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js.map +2 -2
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/css/all.min.css +8 -8
- package/wwwroot/_content/MindExecution.Shared/models/vocab.txt +30522 -30522
- package/wwwroot/_framework/{Google.Protobuf.33g2gb5is0.dll → Google.Protobuf.9h59ukbel7.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Core.z100xo4mg0.dll → MindExecution.Core.gnj3fo0pr7.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Kernel.i9cldrx8yc.dll → MindExecution.Kernel.1qygzf8o02.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Admin.48lzqddb0a.dll → MindExecution.Plugins.Admin.n3uxh144wo.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Business.7m8u1q142p.dll → MindExecution.Plugins.Business.vl5dximn25.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Concept.cl5wmr53od.dll → MindExecution.Plugins.Concept.rutru9qeoi.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Directory.slipi39041.dll → MindExecution.Plugins.Directory.fqbmq85het.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.PlanMaster.qfge05l671.dll → MindExecution.Plugins.PlanMaster.ko11cc9pll.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.YouTube.tn7v29ut77.dll → MindExecution.Plugins.YouTube.mt39q0to2j.dll} +0 -0
- package/wwwroot/_framework/MindExecution.Shared.umgls362or.dll +0 -0
- package/wwwroot/_framework/{MindExecution.Web.rwawrxxk38.dll → MindExecution.Web.1dwoarj2hg.dll} +0 -0
- package/wwwroot/_framework/{System.Collections.23yxgetbju.dll → System.Collections.zyvbaq6mpd.dll} +0 -0
- package/wwwroot/_framework/blazor.boot.json +25 -25
- package/wwwroot/_headers +40 -40
- package/wwwroot/_redirects +1 -1
- package/wwwroot/index.html +772 -772
- package/wwwroot/js/marketing-tool.js +180 -180
- package/wwwroot/manifest.webmanifest +23 -23
- package/wwwroot/service-worker-assets.js +109 -81
- package/wwwroot/service-worker.js +33 -33
- package/wwwroot/_framework/MindExecution.Shared.rjqlf0umjn.dll +0 -0
|
@@ -1,318 +1,318 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import assert from 'node:assert/strict';
|
|
4
|
-
import { spawn } from 'node:child_process';
|
|
5
|
-
import { mkdtemp, readFile, rm } from 'node:fs/promises';
|
|
6
|
-
import net from 'node:net';
|
|
7
|
-
import os from 'node:os';
|
|
8
|
-
import path from 'node:path';
|
|
9
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
-
|
|
11
|
-
const BRIDGE_TOKEN = 'remote-agent-managed-smoke-token';
|
|
12
|
-
const PAIR_TOKEN = 'remote-agent-managed-pair-token';
|
|
13
|
-
const LEASE_ID = 'remote-agent-managed-smoke-lease';
|
|
14
|
-
const LOCAL_BRIDGE_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
15
|
-
|
|
16
|
-
function wait(ms) {
|
|
17
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async function findFreePort() {
|
|
21
|
-
return await new Promise((resolve, reject) => {
|
|
22
|
-
const server = net.createServer();
|
|
23
|
-
server.unref();
|
|
24
|
-
server.once('error', reject);
|
|
25
|
-
server.listen(0, '127.0.0.1', () => {
|
|
26
|
-
const address = server.address();
|
|
27
|
-
const port = typeof address === 'object' && address ? address.port : 0;
|
|
28
|
-
server.close(() => resolve(port));
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function fetchJson(url, options = {}) {
|
|
34
|
-
const response = await fetch(url, {
|
|
35
|
-
...options,
|
|
36
|
-
headers: {
|
|
37
|
-
...(options.body ? { 'Content-Type': 'application/json' } : {}),
|
|
38
|
-
'X-Bridge-Token': options.token || BRIDGE_TOKEN,
|
|
39
|
-
...(options.headers || {})
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
let payload = null;
|
|
44
|
-
try {
|
|
45
|
-
payload = await response.json();
|
|
46
|
-
} catch {
|
|
47
|
-
// Some failure responses may be empty.
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
status: response.status,
|
|
52
|
-
ok: response.ok,
|
|
53
|
-
payload
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function waitFor(predicate, timeoutMs = 30000, label = 'condition') {
|
|
58
|
-
const startedAt = Date.now();
|
|
59
|
-
let lastError = null;
|
|
60
|
-
while (Date.now() - startedAt < timeoutMs) {
|
|
61
|
-
try {
|
|
62
|
-
const value = await predicate();
|
|
63
|
-
if (value) {
|
|
64
|
-
return value;
|
|
65
|
-
}
|
|
66
|
-
} catch (err) {
|
|
67
|
-
lastError = err;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
await wait(100);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
throw new Error(`Timed out waiting for ${label}${lastError ? `: ${lastError.message}` : ''}.`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function spawnBridge({ bridgePort, remoteHubPort, workspacePath, label }) {
|
|
77
|
-
const child = spawn(process.execPath, ['server.js'], {
|
|
78
|
-
cwd: LOCAL_BRIDGE_DIR,
|
|
79
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
80
|
-
windowsHide: true,
|
|
81
|
-
env: {
|
|
82
|
-
...process.env,
|
|
83
|
-
BRIDGE_PORT: String(bridgePort),
|
|
84
|
-
BRIDGE_TOKEN,
|
|
85
|
-
BRIDGE_REQUIRE_TOKEN: '1',
|
|
86
|
-
MINDEXEC_REMOTE_HUB: '1',
|
|
87
|
-
MINDEXEC_REMOTE_REGISTRY_FOLLOWER: '0',
|
|
88
|
-
MINDEXEC_REMOTE_REGISTRY_REALTIME: '0',
|
|
89
|
-
MINDEXEC_REMOTE_HOST_TARGET_AUTO_RENEW: '0',
|
|
90
|
-
REMOTE_HUB_HOST: '127.0.0.1',
|
|
91
|
-
REMOTE_HUB_PORT: String(remoteHubPort),
|
|
92
|
-
REMOTE_HUB_PAIR_TOKEN: PAIR_TOKEN,
|
|
93
|
-
WORKSPACE_PATH: workspacePath,
|
|
94
|
-
NO_COLOR: '1'
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
let stdout = '';
|
|
99
|
-
let stderr = '';
|
|
100
|
-
child.stdout.on('data', chunk => {
|
|
101
|
-
stdout += chunk.toString();
|
|
102
|
-
});
|
|
103
|
-
child.stderr.on('data', chunk => {
|
|
104
|
-
stderr += chunk.toString();
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const exitPromise = new Promise(resolve => child.once('exit', resolve));
|
|
108
|
-
const details = () => `${label} stdout=${stdout}\n${label} stderr=${stderr}`;
|
|
109
|
-
const stop = async () => {
|
|
110
|
-
if (child.exitCode === null && !child.killed) {
|
|
111
|
-
child.kill('SIGTERM');
|
|
112
|
-
await Promise.race([
|
|
113
|
-
exitPromise,
|
|
114
|
-
wait(5000)
|
|
115
|
-
]);
|
|
116
|
-
if (child.exitCode === null && !child.killed) {
|
|
117
|
-
child.kill('SIGKILL');
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
baseUrl: `http://127.0.0.1:${bridgePort}`,
|
|
124
|
-
child,
|
|
125
|
-
details,
|
|
126
|
-
stop
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
async function startHangingRemoteManager(port) {
|
|
131
|
-
const sockets = new Set();
|
|
132
|
-
const server = net.createServer(socket => {
|
|
133
|
-
sockets.add(socket);
|
|
134
|
-
socket.on('close', () => sockets.delete(socket));
|
|
135
|
-
socket.on('error', () => sockets.delete(socket));
|
|
136
|
-
});
|
|
137
|
-
server.unref();
|
|
138
|
-
await new Promise((resolve, reject) => {
|
|
139
|
-
server.once('error', reject);
|
|
140
|
-
server.listen(port, '127.0.0.1', resolve);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
endpoint: `127.0.0.1:${port}`,
|
|
145
|
-
async stop() {
|
|
146
|
-
for (const socket of sockets) {
|
|
147
|
-
socket.destroy();
|
|
148
|
-
}
|
|
149
|
-
await new Promise(resolve => server.close(resolve));
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
async function waitForBridge(bridge) {
|
|
155
|
-
return await waitFor(async () => {
|
|
156
|
-
const result = await fetchJson(`${bridge.baseUrl}/api/status`);
|
|
157
|
-
return result.ok && result.payload?.status === 'ok' ? result.payload : null;
|
|
158
|
-
}, 30000, `bridge startup\n${bridge.details()}`);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
async function connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint) {
|
|
162
|
-
const result = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/connect`, {
|
|
163
|
-
method: 'POST',
|
|
164
|
-
body: JSON.stringify({
|
|
165
|
-
manager: managerEndpoint,
|
|
166
|
-
managerCandidates: [staleEndpoint, managerEndpoint],
|
|
167
|
-
pairToken: PAIR_TOKEN,
|
|
168
|
-
leaseId: LEASE_ID,
|
|
169
|
-
nodeId: 'remote-agent-managed-smoke-node',
|
|
170
|
-
engine: 'auto',
|
|
171
|
-
source: 'local-bridge-registry'
|
|
172
|
-
})
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
assert.equal(result.ok, true, JSON.stringify(result.payload));
|
|
176
|
-
assert.equal(result.payload?.ok, true, JSON.stringify(result.payload));
|
|
177
|
-
return result.payload.agent;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
async function main() {
|
|
181
|
-
const tempRoot = await mkdtemp(path.join(os.tmpdir(), 'mindexec-remote-managed-smoke-'));
|
|
182
|
-
const hostWorkspace = path.join(tempRoot, 'host');
|
|
183
|
-
const clientWorkspace = path.join(tempRoot, 'client');
|
|
184
|
-
const hostBridgePort = await findFreePort();
|
|
185
|
-
const hostRemotePort = await findFreePort();
|
|
186
|
-
const clientBridgePort = await findFreePort();
|
|
187
|
-
const clientRemotePort = await findFreePort();
|
|
188
|
-
const stalePort = await findFreePort();
|
|
189
|
-
const managerEndpoint = `127.0.0.1:${hostRemotePort}`;
|
|
190
|
-
let hangingManager = null;
|
|
191
|
-
const staleEndpoint = `127.0.0.1:${stalePort}`;
|
|
192
|
-
|
|
193
|
-
let hostBridge = null;
|
|
194
|
-
let clientBridge = null;
|
|
195
|
-
try {
|
|
196
|
-
hangingManager = await startHangingRemoteManager(stalePort);
|
|
197
|
-
hostBridge = spawnBridge({
|
|
198
|
-
bridgePort: hostBridgePort,
|
|
199
|
-
remoteHubPort: hostRemotePort,
|
|
200
|
-
workspacePath: hostWorkspace,
|
|
201
|
-
label: 'host'
|
|
202
|
-
});
|
|
203
|
-
await waitForBridge(hostBridge);
|
|
204
|
-
|
|
205
|
-
clientBridge = spawnBridge({
|
|
206
|
-
bridgePort: clientBridgePort,
|
|
207
|
-
remoteHubPort: clientRemotePort,
|
|
208
|
-
workspacePath: clientWorkspace,
|
|
209
|
-
label: 'client-1'
|
|
210
|
-
});
|
|
211
|
-
await waitForBridge(clientBridge);
|
|
212
|
-
|
|
213
|
-
const firstConnectStartedAt = Date.now();
|
|
214
|
-
const firstAgent = await connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint);
|
|
215
|
-
const firstConnectMs = Date.now() - firstConnectStartedAt;
|
|
216
|
-
assert.equal(firstAgent.running, true, JSON.stringify(firstAgent));
|
|
217
|
-
assert.equal(firstAgent.ready, true, JSON.stringify(firstAgent));
|
|
218
|
-
assert.equal(firstAgent.usingNpx, false, JSON.stringify(firstAgent));
|
|
219
|
-
assert.match(String(firstAgent.launcher || ''), /mindexec-remote-fast/i);
|
|
220
|
-
assert.equal(firstAgent.manager, managerEndpoint, JSON.stringify(firstAgent));
|
|
221
|
-
assert.equal(firstAgent.managerCandidates?.[0], managerEndpoint, JSON.stringify(firstAgent.managerCandidates));
|
|
222
|
-
assert.ok(firstConnectMs < 4500, `managed RemoteAgent selected manager should connect promptly, got ${firstConnectMs}ms`);
|
|
223
|
-
|
|
224
|
-
const connectedDevice = await waitFor(async () => {
|
|
225
|
-
const result = await fetchJson(`${hostBridge.baseUrl}/api/remote/devices`);
|
|
226
|
-
return result.payload?.devices?.find(device => device.connected === true) || null;
|
|
227
|
-
}, 10000, `host device registration\n${hostBridge.details()}\n${clientBridge.details()}`);
|
|
228
|
-
assert.equal(connectedDevice.capabilities?.binaryFrames, true);
|
|
229
|
-
|
|
230
|
-
await clientBridge.stop();
|
|
231
|
-
clientBridge = null;
|
|
232
|
-
|
|
233
|
-
const cachePath = path.join(clientWorkspace, '.mindexec', 'cache', 'remote-agent-recent-managers.json');
|
|
234
|
-
const cache = JSON.parse(await readFile(cachePath, 'utf8'));
|
|
235
|
-
assert.equal(cache.version, 1);
|
|
236
|
-
assert.equal(cache.entries?.[0]?.endpoint, managerEndpoint, JSON.stringify(cache));
|
|
237
|
-
|
|
238
|
-
clientBridge = spawnBridge({
|
|
239
|
-
bridgePort: clientBridgePort,
|
|
240
|
-
remoteHubPort: clientRemotePort,
|
|
241
|
-
workspacePath: clientWorkspace,
|
|
242
|
-
label: 'client-2'
|
|
243
|
-
});
|
|
244
|
-
await waitForBridge(clientBridge);
|
|
245
|
-
|
|
246
|
-
const secondAgent = await connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint);
|
|
247
|
-
assert.equal(secondAgent.running, true, JSON.stringify(secondAgent));
|
|
248
|
-
assert.equal(secondAgent.ready, true, JSON.stringify(secondAgent));
|
|
249
|
-
assert.equal(secondAgent.usingNpx, false, JSON.stringify(secondAgent));
|
|
250
|
-
assert.match(String(secondAgent.launcher || ''), /mindexec-remote-fast/i);
|
|
251
|
-
assert.equal(secondAgent.managerCandidates?.[0], managerEndpoint, JSON.stringify(secondAgent.managerCandidates));
|
|
252
|
-
assert.equal(secondAgent.managerCandidates?.length, 1, JSON.stringify(secondAgent.managerCandidates));
|
|
253
|
-
|
|
254
|
-
const duplicateReport = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/sync-report`, {
|
|
255
|
-
method: 'POST',
|
|
256
|
-
body: JSON.stringify({
|
|
257
|
-
ok: false,
|
|
258
|
-
attempted: true,
|
|
259
|
-
disconnected: true,
|
|
260
|
-
authenticated: true,
|
|
261
|
-
reason: 'connect-failed',
|
|
262
|
-
error: 'duplicate-device-active',
|
|
263
|
-
targetActive: true,
|
|
264
|
-
targetEndpoint: managerEndpoint,
|
|
265
|
-
targetEndpointCandidates: [managerEndpoint, staleEndpoint],
|
|
266
|
-
targetLeaseId: LEASE_ID,
|
|
267
|
-
targetNodeId: 'remote-agent-managed-smoke-node'
|
|
268
|
-
})
|
|
269
|
-
});
|
|
270
|
-
assert.equal(duplicateReport.ok, true, JSON.stringify(duplicateReport.payload));
|
|
271
|
-
assert.equal(duplicateReport.payload?.wake?.reason, 'duplicate-device-active', JSON.stringify(duplicateReport.payload));
|
|
272
|
-
|
|
273
|
-
const duplicateState = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/status`);
|
|
274
|
-
assert.equal(duplicateState.payload?.ready, true, JSON.stringify(duplicateState.payload));
|
|
275
|
-
assert.equal(duplicateState.payload?.needsReconnect, false, JSON.stringify(duplicateState.payload));
|
|
276
|
-
|
|
277
|
-
const staleReport = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/sync-report`, {
|
|
278
|
-
method: 'POST',
|
|
279
|
-
body: JSON.stringify({
|
|
280
|
-
ok: false,
|
|
281
|
-
attempted: true,
|
|
282
|
-
disconnected: true,
|
|
283
|
-
authenticated: true,
|
|
284
|
-
reason: 'agent-disconnected',
|
|
285
|
-
targetActive: true,
|
|
286
|
-
targetEndpoint: managerEndpoint,
|
|
287
|
-
targetEndpointCandidates: [managerEndpoint, staleEndpoint],
|
|
288
|
-
targetLeaseId: LEASE_ID,
|
|
289
|
-
targetNodeId: 'remote-agent-managed-smoke-node'
|
|
290
|
-
})
|
|
291
|
-
});
|
|
292
|
-
assert.equal(staleReport.ok, true, JSON.stringify(staleReport.payload));
|
|
293
|
-
|
|
294
|
-
const staleState = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/status`);
|
|
295
|
-
assert.equal(staleState.payload?.needsReconnect, true, JSON.stringify(staleState.payload));
|
|
296
|
-
|
|
297
|
-
const thirdAgent = await connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint);
|
|
298
|
-
assert.equal(thirdAgent.running, true, JSON.stringify(thirdAgent));
|
|
299
|
-
assert.equal(thirdAgent.ready, true, JSON.stringify(thirdAgent));
|
|
300
|
-
assert.equal(thirdAgent.needsReconnect, false, JSON.stringify(thirdAgent));
|
|
301
|
-
assert.notEqual(thirdAgent.pid, secondAgent.pid, `stale registry-owned RemoteAgent should be restarted, second=${secondAgent.pid}, third=${thirdAgent.pid}`);
|
|
302
|
-
|
|
303
|
-
console.log('RemoteAgent managed supervisor smoke OK');
|
|
304
|
-
} finally {
|
|
305
|
-
if (hangingManager) {
|
|
306
|
-
await hangingManager.stop();
|
|
307
|
-
}
|
|
308
|
-
if (clientBridge) {
|
|
309
|
-
await clientBridge.stop();
|
|
310
|
-
}
|
|
311
|
-
if (hostBridge) {
|
|
312
|
-
await hostBridge.stop();
|
|
313
|
-
}
|
|
314
|
-
await rm(tempRoot, { recursive: true, force: true });
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
await main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { mkdtemp, readFile, rm } from 'node:fs/promises';
|
|
6
|
+
import net from 'node:net';
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
|
|
11
|
+
const BRIDGE_TOKEN = 'remote-agent-managed-smoke-token';
|
|
12
|
+
const PAIR_TOKEN = 'remote-agent-managed-pair-token';
|
|
13
|
+
const LEASE_ID = 'remote-agent-managed-smoke-lease';
|
|
14
|
+
const LOCAL_BRIDGE_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
15
|
+
|
|
16
|
+
function wait(ms) {
|
|
17
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function findFreePort() {
|
|
21
|
+
return await new Promise((resolve, reject) => {
|
|
22
|
+
const server = net.createServer();
|
|
23
|
+
server.unref();
|
|
24
|
+
server.once('error', reject);
|
|
25
|
+
server.listen(0, '127.0.0.1', () => {
|
|
26
|
+
const address = server.address();
|
|
27
|
+
const port = typeof address === 'object' && address ? address.port : 0;
|
|
28
|
+
server.close(() => resolve(port));
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function fetchJson(url, options = {}) {
|
|
34
|
+
const response = await fetch(url, {
|
|
35
|
+
...options,
|
|
36
|
+
headers: {
|
|
37
|
+
...(options.body ? { 'Content-Type': 'application/json' } : {}),
|
|
38
|
+
'X-Bridge-Token': options.token || BRIDGE_TOKEN,
|
|
39
|
+
...(options.headers || {})
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
let payload = null;
|
|
44
|
+
try {
|
|
45
|
+
payload = await response.json();
|
|
46
|
+
} catch {
|
|
47
|
+
// Some failure responses may be empty.
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
status: response.status,
|
|
52
|
+
ok: response.ok,
|
|
53
|
+
payload
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function waitFor(predicate, timeoutMs = 30000, label = 'condition') {
|
|
58
|
+
const startedAt = Date.now();
|
|
59
|
+
let lastError = null;
|
|
60
|
+
while (Date.now() - startedAt < timeoutMs) {
|
|
61
|
+
try {
|
|
62
|
+
const value = await predicate();
|
|
63
|
+
if (value) {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
} catch (err) {
|
|
67
|
+
lastError = err;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
await wait(100);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
throw new Error(`Timed out waiting for ${label}${lastError ? `: ${lastError.message}` : ''}.`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function spawnBridge({ bridgePort, remoteHubPort, workspacePath, label }) {
|
|
77
|
+
const child = spawn(process.execPath, ['server.js'], {
|
|
78
|
+
cwd: LOCAL_BRIDGE_DIR,
|
|
79
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
80
|
+
windowsHide: true,
|
|
81
|
+
env: {
|
|
82
|
+
...process.env,
|
|
83
|
+
BRIDGE_PORT: String(bridgePort),
|
|
84
|
+
BRIDGE_TOKEN,
|
|
85
|
+
BRIDGE_REQUIRE_TOKEN: '1',
|
|
86
|
+
MINDEXEC_REMOTE_HUB: '1',
|
|
87
|
+
MINDEXEC_REMOTE_REGISTRY_FOLLOWER: '0',
|
|
88
|
+
MINDEXEC_REMOTE_REGISTRY_REALTIME: '0',
|
|
89
|
+
MINDEXEC_REMOTE_HOST_TARGET_AUTO_RENEW: '0',
|
|
90
|
+
REMOTE_HUB_HOST: '127.0.0.1',
|
|
91
|
+
REMOTE_HUB_PORT: String(remoteHubPort),
|
|
92
|
+
REMOTE_HUB_PAIR_TOKEN: PAIR_TOKEN,
|
|
93
|
+
WORKSPACE_PATH: workspacePath,
|
|
94
|
+
NO_COLOR: '1'
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
let stdout = '';
|
|
99
|
+
let stderr = '';
|
|
100
|
+
child.stdout.on('data', chunk => {
|
|
101
|
+
stdout += chunk.toString();
|
|
102
|
+
});
|
|
103
|
+
child.stderr.on('data', chunk => {
|
|
104
|
+
stderr += chunk.toString();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const exitPromise = new Promise(resolve => child.once('exit', resolve));
|
|
108
|
+
const details = () => `${label} stdout=${stdout}\n${label} stderr=${stderr}`;
|
|
109
|
+
const stop = async () => {
|
|
110
|
+
if (child.exitCode === null && !child.killed) {
|
|
111
|
+
child.kill('SIGTERM');
|
|
112
|
+
await Promise.race([
|
|
113
|
+
exitPromise,
|
|
114
|
+
wait(5000)
|
|
115
|
+
]);
|
|
116
|
+
if (child.exitCode === null && !child.killed) {
|
|
117
|
+
child.kill('SIGKILL');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
baseUrl: `http://127.0.0.1:${bridgePort}`,
|
|
124
|
+
child,
|
|
125
|
+
details,
|
|
126
|
+
stop
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async function startHangingRemoteManager(port) {
|
|
131
|
+
const sockets = new Set();
|
|
132
|
+
const server = net.createServer(socket => {
|
|
133
|
+
sockets.add(socket);
|
|
134
|
+
socket.on('close', () => sockets.delete(socket));
|
|
135
|
+
socket.on('error', () => sockets.delete(socket));
|
|
136
|
+
});
|
|
137
|
+
server.unref();
|
|
138
|
+
await new Promise((resolve, reject) => {
|
|
139
|
+
server.once('error', reject);
|
|
140
|
+
server.listen(port, '127.0.0.1', resolve);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
endpoint: `127.0.0.1:${port}`,
|
|
145
|
+
async stop() {
|
|
146
|
+
for (const socket of sockets) {
|
|
147
|
+
socket.destroy();
|
|
148
|
+
}
|
|
149
|
+
await new Promise(resolve => server.close(resolve));
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function waitForBridge(bridge) {
|
|
155
|
+
return await waitFor(async () => {
|
|
156
|
+
const result = await fetchJson(`${bridge.baseUrl}/api/status`);
|
|
157
|
+
return result.ok && result.payload?.status === 'ok' ? result.payload : null;
|
|
158
|
+
}, 30000, `bridge startup\n${bridge.details()}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint) {
|
|
162
|
+
const result = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/connect`, {
|
|
163
|
+
method: 'POST',
|
|
164
|
+
body: JSON.stringify({
|
|
165
|
+
manager: managerEndpoint,
|
|
166
|
+
managerCandidates: [staleEndpoint, managerEndpoint],
|
|
167
|
+
pairToken: PAIR_TOKEN,
|
|
168
|
+
leaseId: LEASE_ID,
|
|
169
|
+
nodeId: 'remote-agent-managed-smoke-node',
|
|
170
|
+
engine: 'auto',
|
|
171
|
+
source: 'local-bridge-registry'
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
assert.equal(result.ok, true, JSON.stringify(result.payload));
|
|
176
|
+
assert.equal(result.payload?.ok, true, JSON.stringify(result.payload));
|
|
177
|
+
return result.payload.agent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function main() {
|
|
181
|
+
const tempRoot = await mkdtemp(path.join(os.tmpdir(), 'mindexec-remote-managed-smoke-'));
|
|
182
|
+
const hostWorkspace = path.join(tempRoot, 'host');
|
|
183
|
+
const clientWorkspace = path.join(tempRoot, 'client');
|
|
184
|
+
const hostBridgePort = await findFreePort();
|
|
185
|
+
const hostRemotePort = await findFreePort();
|
|
186
|
+
const clientBridgePort = await findFreePort();
|
|
187
|
+
const clientRemotePort = await findFreePort();
|
|
188
|
+
const stalePort = await findFreePort();
|
|
189
|
+
const managerEndpoint = `127.0.0.1:${hostRemotePort}`;
|
|
190
|
+
let hangingManager = null;
|
|
191
|
+
const staleEndpoint = `127.0.0.1:${stalePort}`;
|
|
192
|
+
|
|
193
|
+
let hostBridge = null;
|
|
194
|
+
let clientBridge = null;
|
|
195
|
+
try {
|
|
196
|
+
hangingManager = await startHangingRemoteManager(stalePort);
|
|
197
|
+
hostBridge = spawnBridge({
|
|
198
|
+
bridgePort: hostBridgePort,
|
|
199
|
+
remoteHubPort: hostRemotePort,
|
|
200
|
+
workspacePath: hostWorkspace,
|
|
201
|
+
label: 'host'
|
|
202
|
+
});
|
|
203
|
+
await waitForBridge(hostBridge);
|
|
204
|
+
|
|
205
|
+
clientBridge = spawnBridge({
|
|
206
|
+
bridgePort: clientBridgePort,
|
|
207
|
+
remoteHubPort: clientRemotePort,
|
|
208
|
+
workspacePath: clientWorkspace,
|
|
209
|
+
label: 'client-1'
|
|
210
|
+
});
|
|
211
|
+
await waitForBridge(clientBridge);
|
|
212
|
+
|
|
213
|
+
const firstConnectStartedAt = Date.now();
|
|
214
|
+
const firstAgent = await connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint);
|
|
215
|
+
const firstConnectMs = Date.now() - firstConnectStartedAt;
|
|
216
|
+
assert.equal(firstAgent.running, true, JSON.stringify(firstAgent));
|
|
217
|
+
assert.equal(firstAgent.ready, true, JSON.stringify(firstAgent));
|
|
218
|
+
assert.equal(firstAgent.usingNpx, false, JSON.stringify(firstAgent));
|
|
219
|
+
assert.match(String(firstAgent.launcher || ''), /mindexec-remote-fast/i);
|
|
220
|
+
assert.equal(firstAgent.manager, managerEndpoint, JSON.stringify(firstAgent));
|
|
221
|
+
assert.equal(firstAgent.managerCandidates?.[0], managerEndpoint, JSON.stringify(firstAgent.managerCandidates));
|
|
222
|
+
assert.ok(firstConnectMs < 4500, `managed RemoteAgent selected manager should connect promptly, got ${firstConnectMs}ms`);
|
|
223
|
+
|
|
224
|
+
const connectedDevice = await waitFor(async () => {
|
|
225
|
+
const result = await fetchJson(`${hostBridge.baseUrl}/api/remote/devices`);
|
|
226
|
+
return result.payload?.devices?.find(device => device.connected === true) || null;
|
|
227
|
+
}, 10000, `host device registration\n${hostBridge.details()}\n${clientBridge.details()}`);
|
|
228
|
+
assert.equal(connectedDevice.capabilities?.binaryFrames, true);
|
|
229
|
+
|
|
230
|
+
await clientBridge.stop();
|
|
231
|
+
clientBridge = null;
|
|
232
|
+
|
|
233
|
+
const cachePath = path.join(clientWorkspace, '.mindexec', 'cache', 'remote-agent-recent-managers.json');
|
|
234
|
+
const cache = JSON.parse(await readFile(cachePath, 'utf8'));
|
|
235
|
+
assert.equal(cache.version, 1);
|
|
236
|
+
assert.equal(cache.entries?.[0]?.endpoint, managerEndpoint, JSON.stringify(cache));
|
|
237
|
+
|
|
238
|
+
clientBridge = spawnBridge({
|
|
239
|
+
bridgePort: clientBridgePort,
|
|
240
|
+
remoteHubPort: clientRemotePort,
|
|
241
|
+
workspacePath: clientWorkspace,
|
|
242
|
+
label: 'client-2'
|
|
243
|
+
});
|
|
244
|
+
await waitForBridge(clientBridge);
|
|
245
|
+
|
|
246
|
+
const secondAgent = await connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint);
|
|
247
|
+
assert.equal(secondAgent.running, true, JSON.stringify(secondAgent));
|
|
248
|
+
assert.equal(secondAgent.ready, true, JSON.stringify(secondAgent));
|
|
249
|
+
assert.equal(secondAgent.usingNpx, false, JSON.stringify(secondAgent));
|
|
250
|
+
assert.match(String(secondAgent.launcher || ''), /mindexec-remote-fast/i);
|
|
251
|
+
assert.equal(secondAgent.managerCandidates?.[0], managerEndpoint, JSON.stringify(secondAgent.managerCandidates));
|
|
252
|
+
assert.equal(secondAgent.managerCandidates?.length, 1, JSON.stringify(secondAgent.managerCandidates));
|
|
253
|
+
|
|
254
|
+
const duplicateReport = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/sync-report`, {
|
|
255
|
+
method: 'POST',
|
|
256
|
+
body: JSON.stringify({
|
|
257
|
+
ok: false,
|
|
258
|
+
attempted: true,
|
|
259
|
+
disconnected: true,
|
|
260
|
+
authenticated: true,
|
|
261
|
+
reason: 'connect-failed',
|
|
262
|
+
error: 'duplicate-device-active',
|
|
263
|
+
targetActive: true,
|
|
264
|
+
targetEndpoint: managerEndpoint,
|
|
265
|
+
targetEndpointCandidates: [managerEndpoint, staleEndpoint],
|
|
266
|
+
targetLeaseId: LEASE_ID,
|
|
267
|
+
targetNodeId: 'remote-agent-managed-smoke-node'
|
|
268
|
+
})
|
|
269
|
+
});
|
|
270
|
+
assert.equal(duplicateReport.ok, true, JSON.stringify(duplicateReport.payload));
|
|
271
|
+
assert.equal(duplicateReport.payload?.wake?.reason, 'duplicate-device-active', JSON.stringify(duplicateReport.payload));
|
|
272
|
+
|
|
273
|
+
const duplicateState = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/status`);
|
|
274
|
+
assert.equal(duplicateState.payload?.ready, true, JSON.stringify(duplicateState.payload));
|
|
275
|
+
assert.equal(duplicateState.payload?.needsReconnect, false, JSON.stringify(duplicateState.payload));
|
|
276
|
+
|
|
277
|
+
const staleReport = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/sync-report`, {
|
|
278
|
+
method: 'POST',
|
|
279
|
+
body: JSON.stringify({
|
|
280
|
+
ok: false,
|
|
281
|
+
attempted: true,
|
|
282
|
+
disconnected: true,
|
|
283
|
+
authenticated: true,
|
|
284
|
+
reason: 'agent-disconnected',
|
|
285
|
+
targetActive: true,
|
|
286
|
+
targetEndpoint: managerEndpoint,
|
|
287
|
+
targetEndpointCandidates: [managerEndpoint, staleEndpoint],
|
|
288
|
+
targetLeaseId: LEASE_ID,
|
|
289
|
+
targetNodeId: 'remote-agent-managed-smoke-node'
|
|
290
|
+
})
|
|
291
|
+
});
|
|
292
|
+
assert.equal(staleReport.ok, true, JSON.stringify(staleReport.payload));
|
|
293
|
+
|
|
294
|
+
const staleState = await fetchJson(`${clientBridge.baseUrl}/api/remote/agent/status`);
|
|
295
|
+
assert.equal(staleState.payload?.needsReconnect, true, JSON.stringify(staleState.payload));
|
|
296
|
+
|
|
297
|
+
const thirdAgent = await connectManagedAgent(clientBridge, managerEndpoint, staleEndpoint);
|
|
298
|
+
assert.equal(thirdAgent.running, true, JSON.stringify(thirdAgent));
|
|
299
|
+
assert.equal(thirdAgent.ready, true, JSON.stringify(thirdAgent));
|
|
300
|
+
assert.equal(thirdAgent.needsReconnect, false, JSON.stringify(thirdAgent));
|
|
301
|
+
assert.notEqual(thirdAgent.pid, secondAgent.pid, `stale registry-owned RemoteAgent should be restarted, second=${secondAgent.pid}, third=${thirdAgent.pid}`);
|
|
302
|
+
|
|
303
|
+
console.log('RemoteAgent managed supervisor smoke OK');
|
|
304
|
+
} finally {
|
|
305
|
+
if (hangingManager) {
|
|
306
|
+
await hangingManager.stop();
|
|
307
|
+
}
|
|
308
|
+
if (clientBridge) {
|
|
309
|
+
await clientBridge.stop();
|
|
310
|
+
}
|
|
311
|
+
if (hostBridge) {
|
|
312
|
+
await hostBridge.stop();
|
|
313
|
+
}
|
|
314
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
await main();
|