@nextclaw/remote 0.1.17 → 0.1.18
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/dist/index.js +20 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var RemoteRuntimeActions = class {
|
|
|
21
21
|
const result = this.deps.remoteCommands.enableConfig(opts);
|
|
22
22
|
console.log("\u2713 Remote access enabled");
|
|
23
23
|
if (result.config.remote.deviceName.trim()) {
|
|
24
|
-
console.log(`
|
|
24
|
+
console.log(`Instance: ${result.config.remote.deviceName.trim()}`);
|
|
25
25
|
}
|
|
26
26
|
if (result.config.remote.platformApiBase.trim()) {
|
|
27
27
|
console.log(`Platform: ${result.config.remote.platformApiBase.trim()}`);
|
|
@@ -196,7 +196,7 @@ var RemotePlatformClient = class {
|
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
async registerDevice(params) {
|
|
199
|
-
const response = await fetch(`${params.platformBase}/platform/remote/
|
|
199
|
+
const response = await fetch(`${params.platformBase}/platform/remote/instances/register`, {
|
|
200
200
|
method: "POST",
|
|
201
201
|
headers: {
|
|
202
202
|
"content-type": "application/json",
|
|
@@ -211,8 +211,23 @@ var RemotePlatformClient = class {
|
|
|
211
211
|
})
|
|
212
212
|
});
|
|
213
213
|
const payload = await response.json();
|
|
214
|
+
const instance = payload.data?.instance;
|
|
215
|
+
if (response.ok && payload.ok && instance) {
|
|
216
|
+
return {
|
|
217
|
+
id: instance.id,
|
|
218
|
+
deviceInstallId: instance.instanceInstallId,
|
|
219
|
+
displayName: instance.displayName,
|
|
220
|
+
platform: instance.platform,
|
|
221
|
+
appVersion: instance.appVersion,
|
|
222
|
+
localOrigin: instance.localOrigin,
|
|
223
|
+
status: instance.status,
|
|
224
|
+
lastSeenAt: instance.lastSeenAt,
|
|
225
|
+
createdAt: instance.createdAt,
|
|
226
|
+
updatedAt: instance.updatedAt
|
|
227
|
+
};
|
|
228
|
+
}
|
|
214
229
|
if (!response.ok || !payload.ok || !payload.data?.device) {
|
|
215
|
-
throw new Error(payload.error?.message ?? `Failed to register remote
|
|
230
|
+
throw new Error(payload.error?.message ?? `Failed to register remote instance (${response.status}).`);
|
|
216
231
|
}
|
|
217
232
|
return payload.data.device;
|
|
218
233
|
}
|
|
@@ -499,7 +514,7 @@ var RemoteConnector = class {
|
|
|
499
514
|
displayName: params.context.displayName,
|
|
500
515
|
localOrigin: params.context.localOrigin
|
|
501
516
|
});
|
|
502
|
-
this.logger.info(`\u2713 Remote
|
|
517
|
+
this.logger.info(`\u2713 Remote instance registered: ${device.displayName} (${device.id})`);
|
|
503
518
|
this.logger.info(`\u2713 Local origin: ${params.context.localOrigin}`);
|
|
504
519
|
this.logger.info(`\u2713 Platform: ${params.context.platformBase}`);
|
|
505
520
|
return device;
|
|
@@ -519,7 +534,7 @@ var RemoteConnector = class {
|
|
|
519
534
|
lastError: null
|
|
520
535
|
});
|
|
521
536
|
const device = await this.ensureDevice({ device: params.device, context: params.context });
|
|
522
|
-
const wsUrl = `${params.context.platformBase.replace(/^http/i, "ws")}/platform/remote/connect?
|
|
537
|
+
const wsUrl = `${params.context.platformBase.replace(/^http/i, "ws")}/platform/remote/connect?instanceId=${encodeURIComponent(device.id)}&token=${encodeURIComponent(params.context.token)}`;
|
|
523
538
|
const outcome = await this.connectOnce({
|
|
524
539
|
wsUrl,
|
|
525
540
|
relayBridge: params.relayBridge,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/remote",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Remote access runtime for NextClaw device registration, relay bridging, and service-managed connectivity.",
|
|
6
6
|
"type": "module",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"commander": "^12.1.0",
|
|
32
|
-
"@nextclaw/
|
|
33
|
-
"@nextclaw/
|
|
32
|
+
"@nextclaw/core": "0.9.8",
|
|
33
|
+
"@nextclaw/server": "0.10.22"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^20.17.6",
|