@nextclaw/remote 0.1.10 → 0.1.13

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.d.ts CHANGED
@@ -194,13 +194,15 @@ declare class RemoteServiceModule {
194
194
  private abortController;
195
195
  private runTask;
196
196
  constructor(deps: {
197
- config: Config;
197
+ loadConfig: () => Config;
198
+ uiEnabled: boolean;
198
199
  localOrigin: string;
199
200
  statusStore: RemoteStatusWriter;
200
201
  createConnector: (logger: RemoteLogger) => RemoteConnector;
201
202
  logger?: RemoteLogger;
202
203
  });
203
204
  start(): Promise<void> | null;
205
+ restart(): Promise<void>;
204
206
  stop(): Promise<void>;
205
207
  }
206
208
 
package/dist/index.js CHANGED
@@ -583,7 +583,14 @@ var RemoteServiceModule = class {
583
583
  abortController = null;
584
584
  runTask = null;
585
585
  start() {
586
- if (!this.deps.config.remote.enabled) {
586
+ if (this.runTask) {
587
+ return this.runTask;
588
+ }
589
+ if (!this.deps.uiEnabled) {
590
+ return null;
591
+ }
592
+ const config = this.deps.loadConfig();
593
+ if (!config.remote.enabled) {
587
594
  this.deps.statusStore.write({
588
595
  enabled: false,
589
596
  state: "disabled",
@@ -606,18 +613,19 @@ var RemoteServiceModule = class {
606
613
  this.runTask = connector.run({
607
614
  mode: "service",
608
615
  signal: this.abortController.signal,
609
- autoReconnect: this.deps.config.remote.autoReconnect,
616
+ autoReconnect: config.remote.autoReconnect,
610
617
  localOrigin: this.deps.localOrigin,
611
618
  statusStore: this.deps.statusStore
612
619
  });
613
620
  void this.runTask.catch((error) => {
614
621
  const message = error instanceof Error ? error.message : String(error);
622
+ const latestConfig = this.deps.loadConfig();
615
623
  this.deps.statusStore.write({
616
624
  enabled: true,
617
625
  state: "error",
618
- deviceName: this.deps.config.remote.deviceName || void 0,
626
+ deviceName: latestConfig.remote.deviceName || void 0,
619
627
  deviceId: void 0,
620
- platformBase: this.deps.config.remote.platformApiBase || void 0,
628
+ platformBase: latestConfig.remote.platformApiBase || void 0,
621
629
  localOrigin: this.deps.localOrigin,
622
630
  lastError: message
623
631
  });
@@ -625,6 +633,10 @@ var RemoteServiceModule = class {
625
633
  });
626
634
  return this.runTask;
627
635
  }
636
+ async restart() {
637
+ await this.stop();
638
+ this.start();
639
+ }
628
640
  async stop() {
629
641
  this.abortController?.abort();
630
642
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/remote",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
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/core": "0.9.5",
33
- "@nextclaw/server": "0.10.14"
32
+ "@nextclaw/core": "0.9.7",
33
+ "@nextclaw/server": "0.10.17"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^20.17.6",