@nextclaw/service 0.1.8 → 0.1.9
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/launcher/npm-runtime-bundle.types.d.ts +1 -1
- package/dist/launcher/npm-runtime-update-command.service.js +2 -1
- package/dist/launcher/npm-runtime-update.manager.d.ts +2 -2
- package/dist/launcher/npm-runtime-update.manager.js +7 -3
- package/dist/launcher/npm-runtime-update.service.d.ts +1 -1
- package/dist/launcher/npm-runtime-update.service.js +1 -1
- package/dist/shared/controllers/gateway.controller.js +6 -8
- package/dist/shared/types/cli.types.d.ts +1 -0
- package/package.json +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UpdateManifest, UpdateProgress, UpdateSnapshot } from "@nextclaw/kernel
|
|
1
|
+
import { UpdateManifest, UpdateProgress, UpdateSnapshot } from "@nextclaw/kernel";
|
|
2
2
|
|
|
3
3
|
//#region src/launcher/npm-runtime-bundle.types.d.ts
|
|
4
4
|
type NpmRuntimeBundleManifest = {
|
|
@@ -14,6 +14,7 @@ var NpmRuntimeUpdateCommandService = class {
|
|
|
14
14
|
return snapshot;
|
|
15
15
|
};
|
|
16
16
|
runManaged = async (opts) => {
|
|
17
|
+
const downloadOnly = Boolean(opts.downloadOnly || opts.download);
|
|
17
18
|
const distribution = NextclawDistributionService.get();
|
|
18
19
|
const source = new NpmRuntimeUpdateSourceService({ packagedPublicKeyPath: distribution.runtimeUpdatePublicKeyPath });
|
|
19
20
|
const launcherVersion = distribution.version;
|
|
@@ -42,7 +43,7 @@ var NpmRuntimeUpdateCommandService = class {
|
|
|
42
43
|
}).run({
|
|
43
44
|
apply: Boolean(opts.apply),
|
|
44
45
|
checkOnly: Boolean(opts.check),
|
|
45
|
-
|
|
46
|
+
applyAfterDownload: !downloadOnly,
|
|
46
47
|
onProgress: opts.json ? void 0 : this.printProgress
|
|
47
48
|
});
|
|
48
49
|
};
|
|
@@ -3,7 +3,7 @@ import { NpmRuntimeReleaseChannel } from "./npm-runtime-update-source.service.js
|
|
|
3
3
|
import { NpmRuntimeUpdateStateStore } from "./npm-runtime-update-state.store.js";
|
|
4
4
|
import { NpmRuntimeBundleService } from "./npm-runtime-bundle.service.js";
|
|
5
5
|
import { NpmRuntimeUpdateService } from "./npm-runtime-update.service.js";
|
|
6
|
-
import { UpdateProgress, UpdateSnapshot } from "@nextclaw/kernel
|
|
6
|
+
import { UpdateProgress, UpdateSnapshot } from "@nextclaw/kernel";
|
|
7
7
|
|
|
8
8
|
//#region src/launcher/npm-runtime-update.manager.d.ts
|
|
9
9
|
type NpmRuntimeUpdateManagerOptions = {
|
|
@@ -17,8 +17,8 @@ type NpmRuntimeUpdateManagerOptions = {
|
|
|
17
17
|
now?: () => Date;
|
|
18
18
|
};
|
|
19
19
|
type NpmRuntimeUpdateActionOptions = {
|
|
20
|
-
download?: boolean;
|
|
21
20
|
apply?: boolean;
|
|
21
|
+
applyAfterDownload?: boolean;
|
|
22
22
|
checkOnly?: boolean;
|
|
23
23
|
onProgress?: (progress: UpdateProgress) => void;
|
|
24
24
|
};
|
|
@@ -16,10 +16,14 @@ var NpmRuntimeUpdateManager = class {
|
|
|
16
16
|
getSnapshot = () => this.toSnapshotFromState(this.options.stateStore.read(), { status: this.options.stateStore.read().downloadedVersion ? "downloaded" : "idle" });
|
|
17
17
|
run = async (options = {}) => {
|
|
18
18
|
if (options.apply) return this.applyDownloadedUpdate();
|
|
19
|
+
const applyAfterDownload = options.applyAfterDownload ?? true;
|
|
19
20
|
const checkedSnapshot = await this.checkForUpdate();
|
|
20
|
-
if (options.checkOnly
|
|
21
|
-
if (
|
|
22
|
-
|
|
21
|
+
if (options.checkOnly) return checkedSnapshot;
|
|
22
|
+
if (applyAfterDownload && checkedSnapshot.status === "downloaded") return this.applyDownloadedUpdate();
|
|
23
|
+
if (checkedSnapshot.status !== "update-available") return checkedSnapshot;
|
|
24
|
+
const downloadedSnapshot = await this.downloadUpdate(options.onProgress);
|
|
25
|
+
if (!applyAfterDownload || downloadedSnapshot.status !== "downloaded") return downloadedSnapshot;
|
|
26
|
+
return this.applyDownloadedUpdate();
|
|
23
27
|
};
|
|
24
28
|
checkForUpdate = async () => {
|
|
25
29
|
const manifestUrl = this.options.resolveManifestUrl(this.options.channel);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NpmRuntimeDownloadedUpdate, NpmRuntimeUpdateProgressReporter } from "./npm-runtime-bundle.types.js";
|
|
2
2
|
import { NpmRuntimeBundleLayoutStore } from "./npm-runtime-bundle-layout.store.js";
|
|
3
3
|
import { NpmRuntimeBundleService } from "./npm-runtime-bundle.service.js";
|
|
4
|
-
import { UpdateManifest, UpdateManifestReader } from "@nextclaw/kernel
|
|
4
|
+
import { UpdateManifest, UpdateManifestReader } from "@nextclaw/kernel";
|
|
5
5
|
|
|
6
6
|
//#region src/launcher/npm-runtime-update.service.d.ts
|
|
7
7
|
type FetchLike = typeof fetch;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { compareNpmRuntimeVersions } from "./npm-runtime-bundle.service.js";
|
|
2
|
+
import { UpdateManifestReader, serializeUnsignedUpdateManifest } from "@nextclaw/kernel";
|
|
2
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
3
4
|
import { dirname, join, resolve, sep } from "node:path";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
import { rm } from "node:fs/promises";
|
|
6
7
|
import { createHash, createPublicKey, verify } from "node:crypto";
|
|
7
8
|
import JSZip from "jszip";
|
|
8
|
-
import { UpdateManifestReader, serializeUnsignedUpdateManifest } from "@nextclaw/kernel/update-contract";
|
|
9
9
|
//#region src/launcher/npm-runtime-update.service.ts
|
|
10
10
|
var NpmRuntimeUpdateService = class {
|
|
11
11
|
platform;
|
|
@@ -267,11 +267,9 @@ var GatewayControllerImpl = class {
|
|
|
267
267
|
});
|
|
268
268
|
};
|
|
269
269
|
updateRun = async (params) => {
|
|
270
|
+
const { note, restartDelayMs, sessionKey, timeoutMs } = params;
|
|
270
271
|
const versionBefore = getPackageVersion$1();
|
|
271
|
-
|
|
272
|
-
const updateCommand = new NpmRuntimeUpdateCommandService();
|
|
273
|
-
const downloadedSnapshot = await updateCommand.runManaged({ download: true });
|
|
274
|
-
const snapshot = downloadedSnapshot.status === "downloaded" ? await updateCommand.runManaged({ apply: true }) : downloadedSnapshot;
|
|
272
|
+
const snapshot = await new NpmRuntimeUpdateCommandService().runManaged({});
|
|
275
273
|
if (snapshot.status === "blocked" || snapshot.status === "failed") return {
|
|
276
274
|
ok: false,
|
|
277
275
|
error: snapshot.errorMessage ?? snapshot.blockReason ?? "update failed",
|
|
@@ -283,12 +281,12 @@ var GatewayControllerImpl = class {
|
|
|
283
281
|
}
|
|
284
282
|
};
|
|
285
283
|
const versionAfter = getPackageVersion$1();
|
|
286
|
-
const delayMs =
|
|
284
|
+
const delayMs = restartDelayMs ?? 0;
|
|
287
285
|
const sentinelPath = await this.writeRestartSentinelPayload({
|
|
288
286
|
kind: "update.run",
|
|
289
287
|
status: "ok",
|
|
290
|
-
sessionKey
|
|
291
|
-
note
|
|
288
|
+
sessionKey,
|
|
289
|
+
note,
|
|
292
290
|
reason: "update.run",
|
|
293
291
|
strategy: "runtime-bundle"
|
|
294
292
|
});
|
|
@@ -298,7 +296,7 @@ var GatewayControllerImpl = class {
|
|
|
298
296
|
});
|
|
299
297
|
return {
|
|
300
298
|
ok: true,
|
|
301
|
-
note:
|
|
299
|
+
note: note ?? null,
|
|
302
300
|
restart: {
|
|
303
301
|
scheduled: true,
|
|
304
302
|
delayMs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/service",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NextClaw long-running service host and runtime lifecycle.",
|
|
6
6
|
"type": "module",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"yaml": "^2.8.1",
|
|
38
38
|
"@nextclaw/channel-extension-feishu": "0.1.1",
|
|
39
39
|
"@nextclaw/core": "0.12.17",
|
|
40
|
-
"@nextclaw/kernel": "0.1.6",
|
|
41
|
-
"@nextclaw/mcp": "0.1.82",
|
|
42
40
|
"@nextclaw/channel-extension-weixin": "0.1.4",
|
|
43
|
-
"@nextclaw/ncp-
|
|
41
|
+
"@nextclaw/ncp-agent-runtime": "0.3.20",
|
|
44
42
|
"@nextclaw/ncp": "0.5.10",
|
|
45
|
-
"@nextclaw/ncp-
|
|
46
|
-
"@nextclaw/
|
|
43
|
+
"@nextclaw/ncp-mcp": "0.1.84",
|
|
44
|
+
"@nextclaw/ncp-http-agent-server": "0.3.22",
|
|
47
45
|
"@nextclaw/nextclaw-hermes-acp-bridge": "0.1.9",
|
|
46
|
+
"@nextclaw/ncp-toolkit": "0.5.15",
|
|
47
|
+
"@nextclaw/mcp": "0.1.82",
|
|
48
|
+
"@nextclaw/kernel": "0.1.6",
|
|
48
49
|
"@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.1.10",
|
|
49
|
-
"@nextclaw/ncp-agent-runtime": "0.3.20",
|
|
50
50
|
"@nextclaw/nextclaw-ncp-runtime-http-client": "0.1.9",
|
|
51
|
-
"@nextclaw/
|
|
52
|
-
"@nextclaw/ncp-mcp": "0.1.84",
|
|
51
|
+
"@nextclaw/openclaw-compat": "1.0.17",
|
|
53
52
|
"@nextclaw/runtime": "0.2.49",
|
|
54
53
|
"@nextclaw/shared": "0.1.4",
|
|
54
|
+
"@nextclaw/remote": "0.1.94",
|
|
55
55
|
"@nextclaw/server": "0.12.17"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|