@nextclaw/service 0.1.2 → 0.1.4
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/commands/plugin/plugin-command-utils.d.ts +1 -1
- package/dist/launcher/npm-runtime-launcher.service.d.ts +2 -0
- package/dist/launcher/npm-runtime-launcher.service.js +5 -3
- package/dist/launcher/npm-runtime-update-command.service.d.ts +6 -0
- package/dist/launcher/npm-runtime-update-command.service.js +5 -2
- package/dist/launcher/npm-runtime-update-source.service.d.ts +2 -0
- package/dist/launcher/npm-runtime-update-source.service.js +3 -1
- package/dist/service-runtime.service.d.ts +5 -0
- package/dist/service-runtime.service.js +11 -3
- package/package.json +7 -7
|
@@ -3,7 +3,7 @@ import { PluginRegistry } from "@nextclaw/openclaw-compat";
|
|
|
3
3
|
//#region src/commands/plugin/plugin-command-utils.d.ts
|
|
4
4
|
declare const RESERVED_PROVIDER_IDS: string[];
|
|
5
5
|
declare function buildReservedPluginLoadOptions(): {
|
|
6
|
-
reservedToolNames: ("read_file" | "write_file" | "edit_file" | "list_dir" | "exec" | "web_search" | "web_fetch" | "message" | "spawn" | "sessions_list" | "sessions_history" | "memory_search" | "memory_get" | "subagents" | "gateway"
|
|
6
|
+
reservedToolNames: ("cron" | "read_file" | "write_file" | "edit_file" | "list_dir" | "exec" | "web_search" | "web_fetch" | "message" | "spawn" | "sessions_list" | "sessions_history" | "memory_search" | "memory_get" | "subagents" | "gateway")[];
|
|
7
7
|
reservedChannelIds: string[];
|
|
8
8
|
reservedProviderIds: string[];
|
|
9
9
|
reservedNcpAgentRuntimeKinds: string[];
|
|
@@ -5,6 +5,7 @@ type NpmRuntimeLauncherOptions = {
|
|
|
5
5
|
argv: string[];
|
|
6
6
|
env?: NodeJS.ProcessEnv;
|
|
7
7
|
layout?: NpmRuntimeBundleLayoutStore;
|
|
8
|
+
launcherVersion?: string;
|
|
8
9
|
packagedAppEntrypoint?: string;
|
|
9
10
|
};
|
|
10
11
|
declare class NpmRuntimeLauncher {
|
|
@@ -14,6 +15,7 @@ declare class NpmRuntimeLauncher {
|
|
|
14
15
|
constructor(options: NpmRuntimeLauncherOptions);
|
|
15
16
|
run: () => never;
|
|
16
17
|
private resolveRuntimeScriptPath;
|
|
18
|
+
private resolveLauncherVersion;
|
|
17
19
|
private resolvePackagedAppEntrypoint;
|
|
18
20
|
}
|
|
19
21
|
//#endregion
|
|
@@ -29,17 +29,18 @@ var NpmRuntimeLauncher = class {
|
|
|
29
29
|
process.exit(typeof result.status === "number" ? result.status : 1);
|
|
30
30
|
};
|
|
31
31
|
resolveRuntimeScriptPath = () => {
|
|
32
|
+
const launcherVersion = this.resolveLauncherVersion();
|
|
32
33
|
if (this.env.NEXTCLAW_DISABLE_RUNTIME_BUNDLE_LAUNCHER === "1" || this.env.NEXTCLAW_RUNTIME_BUNDLE_CHILD === "1") return this.resolvePackagedAppEntrypoint();
|
|
33
|
-
const stateStore = new NpmRuntimeUpdateStateStore(this.layout.getStatePath(), { defaultChannel: inferDefaultNpmRuntimeReleaseChannel(
|
|
34
|
+
const stateStore = new NpmRuntimeUpdateStateStore(this.layout.getStatePath(), { defaultChannel: inferDefaultNpmRuntimeReleaseChannel(launcherVersion) });
|
|
34
35
|
const bundleService = new NpmRuntimeBundleService({
|
|
35
36
|
layout: this.layout,
|
|
36
37
|
stateStore,
|
|
37
|
-
launcherVersion
|
|
38
|
+
launcherVersion
|
|
38
39
|
});
|
|
39
40
|
try {
|
|
40
41
|
const currentBundle = bundleService.resolveCurrentBundle();
|
|
41
42
|
if (currentBundle && shouldPreferPackagedNpmRuntime({
|
|
42
|
-
launcherVersion
|
|
43
|
+
launcherVersion,
|
|
43
44
|
currentBundleVersion: currentBundle.manifest.runtimeVersion ?? currentBundle.manifest.bundleVersion
|
|
44
45
|
})) return this.resolvePackagedAppEntrypoint();
|
|
45
46
|
return currentBundle?.runtimeScriptPath ?? this.resolvePackagedAppEntrypoint();
|
|
@@ -49,6 +50,7 @@ var NpmRuntimeLauncher = class {
|
|
|
49
50
|
return this.resolvePackagedAppEntrypoint();
|
|
50
51
|
}
|
|
51
52
|
};
|
|
53
|
+
resolveLauncherVersion = () => this.options.launcherVersion ?? getPackageVersion$1();
|
|
52
54
|
resolvePackagedAppEntrypoint = () => {
|
|
53
55
|
if (this.options.packagedAppEntrypoint) return this.options.packagedAppEntrypoint;
|
|
54
56
|
return resolve(dirname(fileURLToPath(import.meta.url)), "../app/index.js");
|
|
@@ -2,7 +2,13 @@ import { UpdateCommandOptions } from "../shared/types/cli.types.js";
|
|
|
2
2
|
import { UpdateSnapshot } from "@nextclaw/kernel/update-contract";
|
|
3
3
|
|
|
4
4
|
//#region src/launcher/npm-runtime-update-command.service.d.ts
|
|
5
|
+
type NpmRuntimeUpdateCommandServiceOptions = {
|
|
6
|
+
launcherVersion?: string;
|
|
7
|
+
packagedPublicKeyPath?: string;
|
|
8
|
+
};
|
|
5
9
|
declare class NpmRuntimeUpdateCommandService {
|
|
10
|
+
private readonly options;
|
|
11
|
+
constructor(options?: NpmRuntimeUpdateCommandServiceOptions);
|
|
6
12
|
run: (opts: UpdateCommandOptions) => Promise<UpdateSnapshot>;
|
|
7
13
|
runManaged: (opts: UpdateCommandOptions) => Promise<UpdateSnapshot>;
|
|
8
14
|
private printProgress;
|
|
@@ -8,6 +8,9 @@ import { NpmRuntimeUpdateManager } from "./npm-runtime-update.manager.js";
|
|
|
8
8
|
import { NpmRuntimeUpdateService } from "./npm-runtime-update.service.js";
|
|
9
9
|
//#region src/launcher/npm-runtime-update-command.service.ts
|
|
10
10
|
var NpmRuntimeUpdateCommandService = class {
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
}
|
|
11
14
|
run = async (opts) => {
|
|
12
15
|
const snapshot = await this.runManaged(opts);
|
|
13
16
|
if (opts.json) console.log(JSON.stringify(snapshot, null, 2));
|
|
@@ -15,8 +18,8 @@ var NpmRuntimeUpdateCommandService = class {
|
|
|
15
18
|
return snapshot;
|
|
16
19
|
};
|
|
17
20
|
runManaged = async (opts) => {
|
|
18
|
-
const source = new NpmRuntimeUpdateSourceService();
|
|
19
|
-
const launcherVersion = getPackageVersion();
|
|
21
|
+
const source = new NpmRuntimeUpdateSourceService({ packagedPublicKeyPath: this.options.packagedPublicKeyPath });
|
|
22
|
+
const launcherVersion = this.options.launcherVersion ?? getPackageVersion();
|
|
20
23
|
const channel = source.resolveChannel(opts.channel, launcherVersion);
|
|
21
24
|
const manifestUrl = source.resolveManifestUrl(channel, opts.manifestUrl);
|
|
22
25
|
const layout = new NpmRuntimeBundleLayoutStore();
|
|
@@ -4,12 +4,14 @@ type NpmRuntimeUpdateSourceServiceOptions = {
|
|
|
4
4
|
env?: NodeJS.ProcessEnv;
|
|
5
5
|
platform?: NodeJS.Platform;
|
|
6
6
|
arch?: string;
|
|
7
|
+
packagedPublicKeyPath?: string;
|
|
7
8
|
};
|
|
8
9
|
declare function inferDefaultNpmRuntimeReleaseChannel(launcherVersion?: string | null): NpmRuntimeReleaseChannel;
|
|
9
10
|
declare class NpmRuntimeUpdateSourceService {
|
|
10
11
|
private readonly env;
|
|
11
12
|
private readonly platform;
|
|
12
13
|
private readonly arch;
|
|
14
|
+
private readonly packagedPublicKeyPath?;
|
|
13
15
|
constructor(options?: NpmRuntimeUpdateSourceServiceOptions);
|
|
14
16
|
resolveChannel: (explicitChannel?: unknown, launcherVersion?: string | null) => NpmRuntimeReleaseChannel;
|
|
15
17
|
resolveManifestUrl: (channel: NpmRuntimeReleaseChannel, explicitManifestUrl?: unknown) => string | null;
|
|
@@ -27,10 +27,12 @@ var NpmRuntimeUpdateSourceService = class {
|
|
|
27
27
|
env;
|
|
28
28
|
platform;
|
|
29
29
|
arch;
|
|
30
|
+
packagedPublicKeyPath;
|
|
30
31
|
constructor(options = {}) {
|
|
31
32
|
this.env = options.env ?? process.env;
|
|
32
33
|
this.platform = options.platform ?? process.platform;
|
|
33
34
|
this.arch = options.arch ?? process.arch;
|
|
35
|
+
this.packagedPublicKeyPath = options.packagedPublicKeyPath;
|
|
34
36
|
}
|
|
35
37
|
resolveChannel = (explicitChannel, launcherVersion) => {
|
|
36
38
|
if (explicitChannel !== void 0 || this.env.NEXTCLAW_UPDATE_CHANNEL !== void 0) return normalizeChannel(explicitChannel ?? this.env.NEXTCLAW_UPDATE_CHANNEL);
|
|
@@ -47,7 +49,7 @@ var NpmRuntimeUpdateSourceService = class {
|
|
|
47
49
|
if (explicitPublicKey) return explicitPublicKey;
|
|
48
50
|
const publicKeyPath = normalizeOptionalString(this.env.NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY_PATH);
|
|
49
51
|
if (!publicKeyPath || !existsSync(publicKeyPath)) {
|
|
50
|
-
const packagedPublicKeyPath = resolvePackagedPublicKeyPath();
|
|
52
|
+
const packagedPublicKeyPath = this.packagedPublicKeyPath ?? resolvePackagedPublicKeyPath();
|
|
51
53
|
return existsSync(packagedPublicKeyPath) ? readFileSync(packagedPublicKeyPath, "utf8").trim() : null;
|
|
52
54
|
}
|
|
53
55
|
return readFileSync(publicKeyPath, "utf8").trim();
|
|
@@ -23,6 +23,8 @@ import { RemoteRuntimeActions } from "@nextclaw/remote";
|
|
|
23
23
|
//#region src/service-runtime.service.d.ts
|
|
24
24
|
type NextclawServiceRuntimeOptions = {
|
|
25
25
|
logo?: string;
|
|
26
|
+
version?: string;
|
|
27
|
+
packagedPublicKeyPath?: string;
|
|
26
28
|
};
|
|
27
29
|
type NextclawServiceRuntimeAccount = {
|
|
28
30
|
status: (opts?: {
|
|
@@ -58,6 +60,8 @@ type NextclawServiceCommands = {
|
|
|
58
60
|
};
|
|
59
61
|
declare class NextclawServiceRuntime {
|
|
60
62
|
private logo;
|
|
63
|
+
private productVersion;
|
|
64
|
+
private packagedPublicKeyPath?;
|
|
61
65
|
private restartCoordinator;
|
|
62
66
|
private serviceRestartTask;
|
|
63
67
|
private selfRelaunchArmed;
|
|
@@ -87,6 +91,7 @@ declare class NextclawServiceRuntime {
|
|
|
87
91
|
update: (opts: UpdateCommandOptions) => Promise<void>;
|
|
88
92
|
}
|
|
89
93
|
declare const runNextclawNpmRuntimeLauncher: (argv?: string[], options?: {
|
|
94
|
+
launcherVersion?: string;
|
|
90
95
|
packagedAppEntrypoint?: string;
|
|
91
96
|
}) => void;
|
|
92
97
|
//#endregion
|
|
@@ -53,6 +53,8 @@ import { NextclawKernel } from "@nextclaw/kernel";
|
|
|
53
53
|
const FORCED_PUBLIC_UI_HOST = "0.0.0.0";
|
|
54
54
|
var NextclawServiceRuntime = class {
|
|
55
55
|
logo;
|
|
56
|
+
productVersion;
|
|
57
|
+
packagedPublicKeyPath;
|
|
56
58
|
restartCoordinator;
|
|
57
59
|
serviceRestartTask = null;
|
|
58
60
|
selfRelaunchArmed = false;
|
|
@@ -66,6 +68,8 @@ var NextclawServiceRuntime = class {
|
|
|
66
68
|
constructor(options = {}) {
|
|
67
69
|
logStartupTrace("cli.runtime.constructor.begin");
|
|
68
70
|
this.logo = options.logo ?? "🤖";
|
|
71
|
+
this.productVersion = options.version ?? getPackageVersion$1();
|
|
72
|
+
this.packagedPublicKeyPath = options.packagedPublicKeyPath;
|
|
69
73
|
this.workspaceManager = measureStartupSync("cli.runtime.workspace_manager", () => new WorkspaceManager(this.logo));
|
|
70
74
|
this.runtimeCommandService = measureStartupSync("cli.runtime.runtime_command_service", () => new RuntimeCommandService({
|
|
71
75
|
requestRestart: (params) => this.requestRestart(params),
|
|
@@ -164,7 +168,7 @@ var NextclawServiceRuntime = class {
|
|
|
164
168
|
};
|
|
165
169
|
};
|
|
166
170
|
get version() {
|
|
167
|
-
return
|
|
171
|
+
return this.productVersion;
|
|
168
172
|
}
|
|
169
173
|
scheduleProcessExit = (delayMs, reason) => {
|
|
170
174
|
console.warn(`Gateway restart requested (${reason}).`);
|
|
@@ -377,9 +381,12 @@ var NextclawServiceRuntime = class {
|
|
|
377
381
|
}
|
|
378
382
|
};
|
|
379
383
|
update = async (opts) => {
|
|
380
|
-
const versionBefore =
|
|
384
|
+
const versionBefore = this.version;
|
|
381
385
|
if (!opts.json) console.log(`Current npm launcher version: ${versionBefore}`);
|
|
382
|
-
const snapshot = await new NpmRuntimeUpdateCommandService(
|
|
386
|
+
const snapshot = await new NpmRuntimeUpdateCommandService({
|
|
387
|
+
launcherVersion: versionBefore,
|
|
388
|
+
packagedPublicKeyPath: this.packagedPublicKeyPath
|
|
389
|
+
}).run(opts);
|
|
383
390
|
if (snapshot.status === "blocked" || snapshot.status === "failed") process.exit(1);
|
|
384
391
|
const state = managedServiceStateStore.read();
|
|
385
392
|
if (snapshot.requiresRestart && state && isProcessRunning(state.pid)) console.log(`Tip: restart ${APP_NAME} to apply the update.`);
|
|
@@ -388,6 +395,7 @@ var NextclawServiceRuntime = class {
|
|
|
388
395
|
const runNextclawNpmRuntimeLauncher = (argv = process.argv, options = {}) => {
|
|
389
396
|
new NpmRuntimeLauncher({
|
|
390
397
|
argv,
|
|
398
|
+
launcherVersion: options.launcherVersion,
|
|
391
399
|
packagedAppEntrypoint: options.packagedAppEntrypoint
|
|
392
400
|
}).run();
|
|
393
401
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/service",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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/kernel": "0.1.3",
|
|
38
37
|
"@nextclaw/channel-extension-weixin": "0.1.1",
|
|
39
38
|
"@nextclaw/core": "0.12.14",
|
|
39
|
+
"@nextclaw/kernel": "0.1.3",
|
|
40
40
|
"@nextclaw/mcp": "0.1.79",
|
|
41
|
+
"@nextclaw/ncp": "0.5.7",
|
|
41
42
|
"@nextclaw/ncp-agent-runtime": "0.3.17",
|
|
42
|
-
"@nextclaw/ncp-mcp": "0.1.81",
|
|
43
43
|
"@nextclaw/ncp-http-agent-server": "0.3.19",
|
|
44
|
+
"@nextclaw/ncp-mcp": "0.1.81",
|
|
45
|
+
"@nextclaw/ncp-toolkit": "0.5.12",
|
|
44
46
|
"@nextclaw/nextclaw-hermes-acp-bridge": "0.1.6",
|
|
45
47
|
"@nextclaw/nextclaw-ncp-runtime-http-client": "0.1.6",
|
|
46
|
-
"@nextclaw/ncp-toolkit": "0.5.12",
|
|
47
|
-
"@nextclaw/openclaw-compat": "1.0.14",
|
|
48
48
|
"@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.1.7",
|
|
49
|
+
"@nextclaw/openclaw-compat": "1.0.14",
|
|
49
50
|
"@nextclaw/remote": "0.1.91",
|
|
50
51
|
"@nextclaw/runtime": "0.2.46",
|
|
51
52
|
"@nextclaw/shared": "0.1.1",
|
|
52
|
-
"@nextclaw/server": "0.12.14"
|
|
53
|
-
"@nextclaw/ncp": "0.5.7"
|
|
53
|
+
"@nextclaw/server": "0.12.14"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^20.17.6",
|