@nextclaw/service 0.1.4 → 0.1.5
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/cli/commands/diagnostics/services/diagnostics-commands.service.js +1 -1
- package/dist/commands/remote/index.d.ts +1 -1
- package/dist/commands/remote/index.js +1 -1
- package/dist/commands/remote/{services/remote-runtime-support.service.d.ts → utils/remote-runtime-support.utils.d.ts} +2 -2
- package/dist/commands/remote/{services/remote-runtime-support.service.js → utils/remote-runtime-support.utils.js} +4 -3
- package/dist/launcher/npm-runtime-update-command.service.d.ts +1 -1
- package/dist/service-runtime.service.js +1 -1
- package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts +5 -3
- package/dist/shared/services/gateway/managers/gateway-remote.manager.js +3 -2
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts +1 -1
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js +3 -5
- package/dist/shared/services/gateway/{service-bootstrap-status.d.ts → service-bootstrap-status.service.d.ts} +3 -4
- package/dist/shared/services/gateway/{service-bootstrap-status.js → service-bootstrap-status.service.js} +5 -15
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts +1 -1
- package/dist/shared/services/runtime/service-managed-startup.service.js +1 -1
- package/dist/shared/services/runtime/{service-remote-runtime.service.d.ts → utils/service-remote-runtime.utils.d.ts} +5 -3
- package/dist/shared/services/runtime/{service-remote-runtime.service.js → utils/service-remote-runtime.utils.js} +6 -5
- package/package.json +18 -18
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isProcessRunning, resolveUiApiBase, resolveUiConfig } from "../../../../shared/utils/cli.utils.js";
|
|
2
2
|
import { managedServiceStateStore } from "../../../../shared/stores/managed-service-state.store.js";
|
|
3
|
-
import { resolveNextclawRemoteStatusSnapshot } from "../../../../commands/remote/
|
|
3
|
+
import { resolveNextclawRemoteStatusSnapshot } from "../../../../commands/remote/utils/remote-runtime-support.utils.js";
|
|
4
4
|
import "../../../../commands/remote/index.js";
|
|
5
5
|
import { printDoctorReport, printStatusReport } from "../utils/diagnostics-render.utils.js";
|
|
6
6
|
import { APP_NAME, getConfigPath, getWorkspacePath, hasSecretRef, loadConfig, resolveAppLogPath } from "@nextclaw/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemoteStatusStore, hasRunningNextclawManagedService, resolveNextclawRemoteStatusSnapshot } from "./
|
|
1
|
+
import { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemoteStatusStore, hasRunningNextclawManagedService, resolveNextclawRemoteStatusSnapshot } from "./utils/remote-runtime-support.utils.js";
|
|
2
2
|
import { buildPlatformApiBaseErrorMessage, resolvePlatformApiBase } from "./utils/platform-api-base.utils.js";
|
|
3
3
|
import { Config } from "@nextclaw/core";
|
|
4
4
|
import { RemoteConnectCommandOptions, RemoteDoctorCommandOptions, RemoteEnableCommandOptions, RemoteStatusCommandOptions, RemoteStatusSnapshot } from "@nextclaw/remote";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { localUiDiscoveryService } from "../../shared/services/ui/local-ui-discovery.service.js";
|
|
2
2
|
import { buildPlatformApiBaseErrorMessage, resolvePlatformApiBase } from "./utils/platform-api-base.utils.js";
|
|
3
|
-
import { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemoteStatusStore, hasRunningNextclawManagedService, resolveNextclawRemoteStatusSnapshot } from "./
|
|
3
|
+
import { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemoteStatusStore, hasRunningNextclawManagedService, resolveNextclawRemoteStatusSnapshot } from "./utils/remote-runtime-support.utils.js";
|
|
4
4
|
import { getConfigPath, loadConfig, saveConfig } from "@nextclaw/core";
|
|
5
5
|
import { readPlatformSessionTokenState } from "@nextclaw/remote";
|
|
6
6
|
import { hostname } from "node:os";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Config } from "@nextclaw/core";
|
|
2
2
|
import { RemoteConnector, RemoteLogger, RemotePlatformClient, RemoteRuntimeState, RemoteStatusSnapshot, RemoteStatusStore } from "@nextclaw/remote";
|
|
3
3
|
|
|
4
|
-
//#region src/commands/remote/
|
|
4
|
+
//#region src/commands/remote/utils/remote-runtime-support.utils.d.ts
|
|
5
5
|
declare function hasRunningNextclawManagedService(): boolean;
|
|
6
6
|
declare function createNextclawRemotePlatformClient(): RemotePlatformClient;
|
|
7
7
|
declare function createNextclawRemoteConnector(params?: {
|
|
8
8
|
logger?: RemoteLogger;
|
|
9
9
|
}): RemoteConnector;
|
|
10
|
-
declare function createNextclawRemoteStatusStore(mode: RemoteRuntimeState["mode"]): RemoteStatusStore;
|
|
10
|
+
declare function createNextclawRemoteStatusStore(mode: RemoteRuntimeState["mode"], onChange?: (next: RemoteRuntimeState) => void): RemoteStatusStore;
|
|
11
11
|
declare function buildNextclawConfiguredRemoteState(config: Config): RemoteRuntimeState;
|
|
12
12
|
declare function readCurrentNextclawRemoteRuntimeState(): RemoteRuntimeState | null;
|
|
13
13
|
declare function resolveNextclawRemoteStatusSnapshot(config: Config): RemoteStatusSnapshot;
|
|
@@ -2,10 +2,10 @@ import { getPackageVersion as getPackageVersion$1 } from "../../../shared/utils/
|
|
|
2
2
|
import { isProcessRunning } from "../../../shared/utils/cli.utils.js";
|
|
3
3
|
import { localUiRuntimeStore } from "../../../shared/stores/local-ui-runtime.store.js";
|
|
4
4
|
import { managedServiceStateStore } from "../../../shared/stores/managed-service-state.store.js";
|
|
5
|
-
import { resolvePlatformApiBase } from "
|
|
5
|
+
import { resolvePlatformApiBase } from "./platform-api-base.utils.js";
|
|
6
6
|
import { getConfigPath, getDataDir, loadConfig } from "@nextclaw/core";
|
|
7
7
|
import { RemoteConnector, RemotePlatformClient, RemoteStatusStore, buildConfiguredRemoteState, resolveRemoteStatusSnapshot } from "@nextclaw/remote";
|
|
8
|
-
//#region src/commands/remote/
|
|
8
|
+
//#region src/commands/remote/utils/remote-runtime-support.utils.ts
|
|
9
9
|
let currentProcessRemoteRuntimeState = null;
|
|
10
10
|
function hasRunningNextclawManagedService() {
|
|
11
11
|
const state = managedServiceStateStore.read();
|
|
@@ -37,9 +37,10 @@ function createNextclawRemoteConnector(params = {}) {
|
|
|
37
37
|
logger: params.logger
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
function createNextclawRemoteStatusStore(mode) {
|
|
40
|
+
function createNextclawRemoteStatusStore(mode, onChange) {
|
|
41
41
|
return new RemoteStatusStore(mode, { writeRemoteState: (next) => {
|
|
42
42
|
currentProcessRemoteRuntimeState = next;
|
|
43
|
+
onChange?.(next);
|
|
43
44
|
if (localUiRuntimeStore.read()?.pid === process.pid) localUiRuntimeStore.update((state) => ({
|
|
44
45
|
...state,
|
|
45
46
|
remote: next
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UpdateCommandOptions } from "../shared/types/cli.types.js";
|
|
2
|
-
import { UpdateSnapshot } from "@nextclaw/kernel
|
|
2
|
+
import { UpdateSnapshot } from "@nextclaw/kernel";
|
|
3
3
|
|
|
4
4
|
//#region src/launcher/npm-runtime-update-command.service.d.ts
|
|
5
5
|
type NpmRuntimeUpdateCommandServiceOptions = {
|
|
@@ -6,7 +6,7 @@ import { managedServiceStateStore } from "./shared/stores/managed-service-state.
|
|
|
6
6
|
import { logStartupTrace, measureStartupSync } from "./shared/utils/startup-trace.js";
|
|
7
7
|
import { createTopLevelNextclawCommandEnv } from "./shared/utils/top-level-nextclaw-command-env.utils.js";
|
|
8
8
|
import { writeRestartSentinel } from "./shared/services/restart/restart-sentinel.service.js";
|
|
9
|
-
import { hasRunningNextclawManagedService } from "./commands/remote/
|
|
9
|
+
import { hasRunningNextclawManagedService } from "./commands/remote/utils/remote-runtime-support.utils.js";
|
|
10
10
|
import { RemoteCommands } from "./commands/remote/index.js";
|
|
11
11
|
import { PlatformAuthCommands } from "./commands/platform-auth/services/platform-auth-commands.service.js";
|
|
12
12
|
import "./commands/platform-auth/index.js";
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { createManagedRemoteModuleForUi } from "../../runtime/service-remote-runtime.
|
|
1
|
+
import { createManagedRemoteModuleForUi } from "../../runtime/utils/service-remote-runtime.utils.js";
|
|
2
2
|
import { GatewayRuntimeDeps } from "../nextclaw-gateway-runtime.service.js";
|
|
3
3
|
import { Config } from "@nextclaw/core";
|
|
4
4
|
import { UiRemoteAccessHost } from "@nextclaw/server";
|
|
5
|
+
import { RemoteRuntimeState } from "@nextclaw/remote";
|
|
5
6
|
import { ConfigManager } from "@nextclaw/kernel";
|
|
6
7
|
|
|
7
8
|
//#region src/shared/services/gateway/managers/gateway-remote.manager.d.ts
|
|
8
|
-
type RemoteServiceModule = ReturnType<typeof createManagedRemoteModuleForUi>;
|
|
9
|
+
type RemoteServiceModule$1 = ReturnType<typeof createManagedRemoteModuleForUi>;
|
|
9
10
|
declare class GatewayRemoteManager {
|
|
10
|
-
readonly remoteModule: RemoteServiceModule;
|
|
11
|
+
readonly remoteModule: RemoteServiceModule$1;
|
|
11
12
|
readonly remoteAccess: UiRemoteAccessHost;
|
|
12
13
|
constructor(params: {
|
|
13
14
|
deps: GatewayRuntimeDeps;
|
|
14
15
|
configManager: ConfigManager;
|
|
15
16
|
uiConfig: Config["ui"];
|
|
17
|
+
onRemoteStateChange?: (state: RemoteRuntimeState) => void;
|
|
16
18
|
});
|
|
17
19
|
stop: () => Promise<void>;
|
|
18
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRemoteAccessHost } from "../../ui/service-remote-access.service.js";
|
|
2
|
-
import { createManagedRemoteModuleForUi } from "../../runtime/service-remote-runtime.
|
|
2
|
+
import { createManagedRemoteModuleForUi } from "../../runtime/utils/service-remote-runtime.utils.js";
|
|
3
3
|
//#region src/shared/services/gateway/managers/gateway-remote.manager.ts
|
|
4
4
|
var GatewayRemoteManager = class {
|
|
5
5
|
remoteModule;
|
|
@@ -8,7 +8,8 @@ var GatewayRemoteManager = class {
|
|
|
8
8
|
const { configManager, deps, uiConfig } = params;
|
|
9
9
|
this.remoteModule = createManagedRemoteModuleForUi({
|
|
10
10
|
loadConfig: configManager.loadConfig,
|
|
11
|
-
uiConfig
|
|
11
|
+
uiConfig,
|
|
12
|
+
onRemoteStateChange: params.onRemoteStateChange
|
|
12
13
|
});
|
|
13
14
|
this.remoteAccess = createRemoteAccessHost({
|
|
14
15
|
serviceCommands: deps,
|
|
@@ -4,7 +4,7 @@ import { GatewayPluginManager } from "./managers/gateway-plugin.manager.js";
|
|
|
4
4
|
import { GatewayRemoteManager } from "./managers/gateway-remote.manager.js";
|
|
5
5
|
import { GatewayRestartWakeService } from "./gateway-restart-wake.service.js";
|
|
6
6
|
import { UiStartupHandle } from "./nextclaw-app.service.js";
|
|
7
|
-
import { ServiceBootstrapStatusStore } from "./service-bootstrap-status.js";
|
|
7
|
+
import { ServiceBootstrapStatusStore } from "./service-bootstrap-status.service.js";
|
|
8
8
|
import { ServiceFileWatcherRegistry } from "./service-startup-support.service.js";
|
|
9
9
|
import { ServiceExtensionRuntime } from "../extensions/service-extension-runtime.service.js";
|
|
10
10
|
import * as NextclawCore from "@nextclaw/core";
|
|
@@ -17,7 +17,7 @@ import { GatewayRestartWakeService } from "./gateway-restart-wake.service.js";
|
|
|
17
17
|
import { createCronJobHandler } from "./cron-job-handler.service.js";
|
|
18
18
|
import { handleGatewayDeferredStartupError } from "./utils/gateway-runtime-lifecycle.utils.js";
|
|
19
19
|
import { NextclawApp } from "./nextclaw-app.service.js";
|
|
20
|
-
import { ServiceBootstrapStatusStore } from "./service-bootstrap-status.js";
|
|
20
|
+
import { ServiceBootstrapStatusStore } from "./service-bootstrap-status.service.js";
|
|
21
21
|
import { createDeferredUiNcpAgent } from "../session/service-deferred-ncp-agent.service.js";
|
|
22
22
|
import { installPluginRuntimeBridge } from "../plugin/utils/plugin-runtime-bridge.utils.js";
|
|
23
23
|
import { wrapStartChannelsWithDevPluginHotReload } from "../plugin/utils/plugin-dev-hot-reload.utils.js";
|
|
@@ -91,7 +91,8 @@ var NextclawGatewayRuntime = class {
|
|
|
91
91
|
this.remoteManager = new GatewayRemoteManager({
|
|
92
92
|
deps: this.deps,
|
|
93
93
|
configManager: this.configManager,
|
|
94
|
-
uiConfig: this.uiConfig
|
|
94
|
+
uiConfig: this.uiConfig,
|
|
95
|
+
onRemoteStateChange: (state) => this.bootstrapStatus.syncRemoteRuntimeState(state)
|
|
95
96
|
});
|
|
96
97
|
this.marketplace = this.createMarketplace();
|
|
97
98
|
this.runtimeControl = createRuntimeControlHost({
|
|
@@ -143,8 +144,6 @@ var NextclawGatewayRuntime = class {
|
|
|
143
144
|
};
|
|
144
145
|
createBootstrapStatus = () => {
|
|
145
146
|
const bootstrapStatus = new ServiceBootstrapStatusStore();
|
|
146
|
-
bootstrapStatus.markNcpAgentPending();
|
|
147
|
-
bootstrapStatus.markPluginHydrationPending();
|
|
148
147
|
bootstrapStatus.markChannelsPending();
|
|
149
148
|
bootstrapStatus.setRemoteState(this.configManager.config.remote.enabled ? "pending" : "disabled");
|
|
150
149
|
return bootstrapStatus;
|
|
@@ -240,7 +239,6 @@ var NextclawGatewayRuntime = class {
|
|
|
240
239
|
if (enabledChannels.length > 0) console.log(`✓ Channels enabled: ${enabledChannels.join(", ")}`);
|
|
241
240
|
else console.log("Warning: No channels enabled");
|
|
242
241
|
this.bootstrapStatus.markChannelsReady(enabledChannels);
|
|
243
|
-
this.bootstrapStatus.markReady();
|
|
244
242
|
};
|
|
245
243
|
createMarketplace = () => ({
|
|
246
244
|
apiBaseUrl: process.env.NEXTCLAW_MARKETPLACE_API_BASE,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { BootstrapRemoteState, BootstrapStatusView } from "@nextclaw/server";
|
|
2
|
+
import { RemoteRuntimeState } from "@nextclaw/remote";
|
|
2
3
|
|
|
3
|
-
//#region src/shared/services/gateway/service-bootstrap-status.d.ts
|
|
4
|
+
//#region src/shared/services/gateway/service-bootstrap-status.service.d.ts
|
|
4
5
|
declare class ServiceBootstrapStatusStore {
|
|
5
6
|
private state;
|
|
6
7
|
getStatus(): BootstrapStatusView;
|
|
7
8
|
markShellReady(): void;
|
|
8
|
-
markNcpAgentPending(): void;
|
|
9
9
|
markNcpAgentRunning(): void;
|
|
10
10
|
markNcpAgentReady(): void;
|
|
11
11
|
markNcpAgentError(error: string): void;
|
|
12
|
-
markPluginHydrationPending(): void;
|
|
13
12
|
markPluginHydrationRunning(params: {
|
|
14
13
|
totalPluginCount: number;
|
|
15
14
|
}): void;
|
|
@@ -26,7 +25,7 @@ declare class ServiceBootstrapStatusStore {
|
|
|
26
25
|
markChannelsReady(enabled: string[]): void;
|
|
27
26
|
markChannelsError(error: string): void;
|
|
28
27
|
setRemoteState(state: BootstrapRemoteState, message?: string): void;
|
|
29
|
-
|
|
28
|
+
syncRemoteRuntimeState(runtime: RemoteRuntimeState): void;
|
|
30
29
|
markError(error: string): void;
|
|
31
30
|
}
|
|
32
31
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/shared/services/gateway/service-bootstrap-status.ts
|
|
1
|
+
//#region src/shared/services/gateway/service-bootstrap-status.service.ts
|
|
2
2
|
function now() {
|
|
3
3
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
4
4
|
}
|
|
@@ -33,9 +33,6 @@ var ServiceBootstrapStatusStore = class {
|
|
|
33
33
|
this.state.phase = "shell-ready";
|
|
34
34
|
this.state.shellReadyAt = this.state.shellReadyAt ?? now();
|
|
35
35
|
}
|
|
36
|
-
markNcpAgentPending() {
|
|
37
|
-
this.state.ncpAgent = { state: "pending" };
|
|
38
|
-
}
|
|
39
36
|
markNcpAgentRunning() {
|
|
40
37
|
this.state.ncpAgent = {
|
|
41
38
|
state: "running",
|
|
@@ -60,14 +57,6 @@ var ServiceBootstrapStatusStore = class {
|
|
|
60
57
|
error
|
|
61
58
|
};
|
|
62
59
|
}
|
|
63
|
-
markPluginHydrationPending() {
|
|
64
|
-
this.state.pluginHydration = {
|
|
65
|
-
...this.state.pluginHydration,
|
|
66
|
-
state: "pending",
|
|
67
|
-
loadedPluginCount: 0,
|
|
68
|
-
totalPluginCount: 0
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
60
|
markPluginHydrationRunning(params) {
|
|
72
61
|
this.state.phase = "hydrating-capabilities";
|
|
73
62
|
this.state.pluginHydration = {
|
|
@@ -139,9 +128,10 @@ var ServiceBootstrapStatusStore = class {
|
|
|
139
128
|
...message ? { message } : {}
|
|
140
129
|
};
|
|
141
130
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
131
|
+
syncRemoteRuntimeState(runtime) {
|
|
132
|
+
const message = runtime.lastError?.trim() || void 0;
|
|
133
|
+
const state = runtime.state === "connected" ? "ready" : runtime.state === "disabled" ? "disabled" : runtime.state === "error" && message?.includes("already owned") ? "conflict" : runtime.state === "error" ? "error" : "pending";
|
|
134
|
+
this.setRemoteState(state, message);
|
|
145
135
|
}
|
|
146
136
|
markError(error) {
|
|
147
137
|
this.state.phase = "error";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServiceBootstrapStatusStore } from "../service-bootstrap-status.js";
|
|
1
|
+
import { ServiceBootstrapStatusStore } from "../service-bootstrap-status.service.js";
|
|
2
2
|
|
|
3
3
|
//#region src/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts
|
|
4
4
|
declare function handleGatewayDeferredStartupError(params: {
|
|
@@ -4,7 +4,7 @@ import { managedServiceStateStore } from "../../stores/managed-service-state.sto
|
|
|
4
4
|
import { probeHealthEndpoint } from "../../utils/service-port-probe.utils.js";
|
|
5
5
|
import { resolveCliSubcommandLaunch } from "../../utils/marketplace/cli-subcommand-launch.utils.js";
|
|
6
6
|
import { createTopLevelNextclawCommandEnv } from "../../utils/top-level-nextclaw-command-env.utils.js";
|
|
7
|
-
import { writeInitialManagedServiceState, writeReadyManagedServiceState } from "./service-remote-runtime.
|
|
7
|
+
import { writeInitialManagedServiceState, writeReadyManagedServiceState } from "./utils/service-remote-runtime.utils.js";
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
9
|
import { dirname } from "node:path";
|
|
10
10
|
import * as NextclawCore from "@nextclaw/core";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ManagedServiceState } from "
|
|
1
|
+
import { ManagedServiceState } from "../../../stores/managed-service-state.store.js";
|
|
2
2
|
import { Config } from "@nextclaw/core";
|
|
3
|
-
import { RemoteServiceModule } from "@nextclaw/remote";
|
|
3
|
+
import { RemoteRuntimeState, RemoteServiceModule } from "@nextclaw/remote";
|
|
4
4
|
|
|
5
|
-
//#region src/shared/services/runtime/service-remote-runtime.
|
|
5
|
+
//#region src/shared/services/runtime/utils/service-remote-runtime.utils.d.ts
|
|
6
6
|
type ManagedServiceSnapshot = {
|
|
7
7
|
pid: number;
|
|
8
8
|
uiUrl: string;
|
|
@@ -30,11 +30,13 @@ declare function createManagedRemoteModule(params: {
|
|
|
30
30
|
loadConfig: () => Config;
|
|
31
31
|
uiEnabled: boolean;
|
|
32
32
|
localOrigin: string;
|
|
33
|
+
onRemoteStateChange?: (state: RemoteRuntimeState) => void;
|
|
33
34
|
}): RemoteServiceModule | null;
|
|
34
35
|
declare function createManagedRemoteModuleForUi(params: {
|
|
35
36
|
loadConfig: () => Config;
|
|
36
37
|
uiConfig: Pick<Config["ui"], "enabled" | "host" | "port">;
|
|
37
38
|
localOriginOverride?: string;
|
|
39
|
+
onRemoteStateChange?: (state: RemoteRuntimeState) => void;
|
|
38
40
|
}): RemoteServiceModule | null;
|
|
39
41
|
declare function writeInitialManagedServiceState(params: {
|
|
40
42
|
config: Config;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { isProcessRunning, resolveUiApiBase } from "
|
|
2
|
-
import { managedServiceStateStore } from "
|
|
3
|
-
import { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemoteStatusStore } from "
|
|
1
|
+
import { isProcessRunning, resolveUiApiBase } from "../../../utils/cli.utils.js";
|
|
2
|
+
import { managedServiceStateStore } from "../../../stores/managed-service-state.store.js";
|
|
3
|
+
import { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemoteStatusStore } from "../../../../commands/remote/utils/remote-runtime-support.utils.js";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
5
5
|
import { getDataDir } from "@nextclaw/core";
|
|
6
6
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { RemoteServiceModule } from "@nextclaw/remote";
|
|
8
|
-
//#region src/shared/services/runtime/service-remote-runtime.
|
|
8
|
+
//#region src/shared/services/runtime/utils/service-remote-runtime.utils.ts
|
|
9
9
|
function resolveRemoteOwnershipLockPath() {
|
|
10
10
|
return resolve(getDataDir(), "run", "remote-owner.lock.json");
|
|
11
11
|
}
|
|
@@ -117,7 +117,7 @@ function createManagedRemoteModule(params) {
|
|
|
117
117
|
loadConfig: params.loadConfig,
|
|
118
118
|
uiEnabled: params.uiEnabled,
|
|
119
119
|
localOrigin: params.localOrigin,
|
|
120
|
-
statusStore: createNextclawRemoteStatusStore("service"),
|
|
120
|
+
statusStore: createNextclawRemoteStatusStore("service", params.onRemoteStateChange),
|
|
121
121
|
createConnector: (logger) => createNextclawRemoteConnector({ logger }),
|
|
122
122
|
claimOwnership: () => claimManagedRemoteRuntimeOwnership({ localOrigin: params.localOrigin }),
|
|
123
123
|
logger: {
|
|
@@ -132,6 +132,7 @@ function createManagedRemoteModuleForUi(params) {
|
|
|
132
132
|
return createManagedRemoteModule({
|
|
133
133
|
loadConfig: params.loadConfig,
|
|
134
134
|
uiEnabled: params.uiConfig.enabled,
|
|
135
|
+
onRemoteStateChange: params.onRemoteStateChange,
|
|
135
136
|
localOrigin: explicitLocalOrigin && explicitLocalOrigin.length > 0 ? explicitLocalOrigin.replace(/\/+$/, "") : resolveUiApiBase(params.uiConfig.host, params.uiConfig.port)
|
|
136
137
|
});
|
|
137
138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/service",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NextClaw long-running service host and runtime lifecycle.",
|
|
6
6
|
"type": "module",
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"commander": "^12.1.0",
|
|
35
35
|
"jszip": "^3.10.1",
|
|
36
36
|
"yaml": "^2.8.1",
|
|
37
|
-
"@nextclaw/
|
|
38
|
-
"@nextclaw/
|
|
39
|
-
"@nextclaw/
|
|
40
|
-
"@nextclaw/
|
|
41
|
-
"@nextclaw/ncp": "0.
|
|
42
|
-
"@nextclaw/ncp
|
|
43
|
-
"@nextclaw/ncp-
|
|
44
|
-
"@nextclaw/
|
|
45
|
-
"@nextclaw/ncp-
|
|
46
|
-
"@nextclaw/nextclaw-
|
|
47
|
-
"@nextclaw/
|
|
48
|
-
"@nextclaw/
|
|
49
|
-
"@nextclaw/
|
|
50
|
-
"@nextclaw/
|
|
51
|
-
"@nextclaw/runtime": "0.2.
|
|
52
|
-
"@nextclaw/shared": "0.1.
|
|
53
|
-
"@nextclaw/server": "0.12.
|
|
37
|
+
"@nextclaw/mcp": "0.1.80",
|
|
38
|
+
"@nextclaw/kernel": "0.1.4",
|
|
39
|
+
"@nextclaw/channel-extension-weixin": "0.1.2",
|
|
40
|
+
"@nextclaw/core": "0.12.15",
|
|
41
|
+
"@nextclaw/ncp-agent-runtime": "0.3.18",
|
|
42
|
+
"@nextclaw/ncp": "0.5.8",
|
|
43
|
+
"@nextclaw/ncp-mcp": "0.1.82",
|
|
44
|
+
"@nextclaw/nextclaw-hermes-acp-bridge": "0.1.7",
|
|
45
|
+
"@nextclaw/nextclaw-ncp-runtime-http-client": "0.1.7",
|
|
46
|
+
"@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.1.8",
|
|
47
|
+
"@nextclaw/openclaw-compat": "1.0.15",
|
|
48
|
+
"@nextclaw/ncp-toolkit": "0.5.13",
|
|
49
|
+
"@nextclaw/remote": "0.1.92",
|
|
50
|
+
"@nextclaw/ncp-http-agent-server": "0.3.20",
|
|
51
|
+
"@nextclaw/runtime": "0.2.47",
|
|
52
|
+
"@nextclaw/shared": "0.1.2",
|
|
53
|
+
"@nextclaw/server": "0.12.15"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^20.17.6",
|