@nextclaw/service 0.1.1
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/LICENSE +21 -0
- package/dist/cli/commands/agent/agent-runtime.utils.d.ts +15 -0
- package/dist/cli/commands/agent/agent-runtime.utils.js +85 -0
- package/dist/cli/commands/agent/cli-agent-runner.utils.d.ts +21 -0
- package/dist/cli/commands/agent/cli-agent-runner.utils.js +89 -0
- package/dist/cli/commands/agent/index.d.ts +3 -0
- package/dist/cli/commands/agent/index.js +3 -0
- package/dist/cli/commands/agent/services/agent-commands.service.d.ts +17 -0
- package/dist/cli/commands/agent/services/agent-commands.service.js +112 -0
- package/dist/cli/commands/companion/index.d.ts +15 -0
- package/dist/cli/commands/companion/index.js +24 -0
- package/dist/cli/commands/companion/services/companion-process.service.d.ts +17 -0
- package/dist/cli/commands/companion/services/companion-process.service.js +49 -0
- package/dist/cli/commands/config/index.d.ts +2 -0
- package/dist/cli/commands/config/index.js +2 -0
- package/dist/cli/commands/config/services/config-commands.service.d.ts +18 -0
- package/dist/cli/commands/config/services/config-commands.service.js +133 -0
- package/dist/cli/commands/cron/index.d.ts +2 -0
- package/dist/cli/commands/cron/index.js +2 -0
- package/dist/cli/commands/cron/services/cron-commands.service.d.ts +22 -0
- package/dist/cli/commands/cron/services/cron-commands.service.js +107 -0
- package/dist/cli/commands/cron/services/cron-local.service.d.ts +25 -0
- package/dist/cli/commands/cron/services/cron-local.service.js +95 -0
- package/dist/cli/commands/cron/utils/cron-job.utils.d.ts +31 -0
- package/dist/cli/commands/cron/utils/cron-job.utils.js +15 -0
- package/dist/cli/commands/diagnostics/index.d.ts +2 -0
- package/dist/cli/commands/diagnostics/index.js +2 -0
- package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.d.ts +22 -0
- package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.js +319 -0
- package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.d.ts +23 -0
- package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.js +66 -0
- package/dist/cli/commands/gateway/index.d.ts +14 -0
- package/dist/cli/commands/gateway/index.js +15 -0
- package/dist/cli/commands/logs/index.d.ts +12 -0
- package/dist/cli/commands/logs/index.js +29 -0
- package/dist/cli/commands/mcp/index.d.ts +14 -0
- package/dist/cli/commands/mcp/index.js +193 -0
- package/dist/cli/commands/restart/index.d.ts +20 -0
- package/dist/cli/commands/restart/index.js +88 -0
- package/dist/cli/commands/secrets/index.d.ts +22 -0
- package/dist/cli/commands/secrets/index.js +280 -0
- package/dist/cli/commands/serve/index.d.ts +14 -0
- package/dist/cli/commands/serve/index.js +19 -0
- package/dist/cli/commands/skills/index.d.ts +26 -0
- package/dist/cli/commands/skills/index.js +147 -0
- package/dist/cli/commands/skills/marketplace-client.d.ts +31 -0
- package/dist/cli/commands/skills/marketplace-client.js +84 -0
- package/dist/cli/commands/skills/marketplace-command-options.utils.d.ts +25 -0
- package/dist/cli/commands/skills/marketplace-command-options.utils.js +31 -0
- package/dist/cli/commands/skills/marketplace-identity.utils.d.ts +14 -0
- package/dist/cli/commands/skills/marketplace-identity.utils.js +77 -0
- package/dist/cli/commands/skills/marketplace-network-retry.d.ts +4 -0
- package/dist/cli/commands/skills/marketplace-network-retry.js +32 -0
- package/dist/cli/commands/skills/marketplace.metadata.d.ts +29 -0
- package/dist/cli/commands/skills/marketplace.metadata.js +158 -0
- package/dist/cli/commands/skills/marketplace.service.d.ts +46 -0
- package/dist/cli/commands/skills/marketplace.service.js +238 -0
- package/dist/cli/commands/skills/skills-query.service.d.ts +141 -0
- package/dist/cli/commands/skills/skills-query.service.js +212 -0
- package/dist/cli/commands/start/index.d.ts +18 -0
- package/dist/cli/commands/start/index.js +25 -0
- package/dist/cli/commands/stop/index.d.ts +12 -0
- package/dist/cli/commands/stop/index.js +11 -0
- package/dist/cli/commands/ui/index.d.ts +14 -0
- package/dist/cli/commands/ui/index.js +17 -0
- package/dist/cli/commands/usage/index.d.ts +2 -0
- package/dist/cli/commands/usage/index.js +2 -0
- package/dist/cli/commands/usage/services/llm-usage-command.service.d.ts +22 -0
- package/dist/cli/commands/usage/services/llm-usage-command.service.js +160 -0
- package/dist/cli/commands/usage/services/llm-usage-query.service.d.ts +43 -0
- package/dist/cli/commands/usage/services/llm-usage-query.service.js +85 -0
- package/dist/commands/channel/channel-config-view.d.ts +7 -0
- package/dist/commands/channel/channel-config-view.js +7 -0
- package/dist/commands/channel/index.d.ts +28 -0
- package/dist/commands/channel/index.js +224 -0
- package/dist/commands/platform-auth/index.d.ts +2 -0
- package/dist/commands/platform-auth/index.js +2 -0
- package/dist/commands/platform-auth/services/account-status.service.d.ts +18 -0
- package/dist/commands/platform-auth/services/account-status.service.js +34 -0
- package/dist/commands/platform-auth/services/platform-auth-commands.service.d.ts +77 -0
- package/dist/commands/platform-auth/services/platform-auth-commands.service.js +295 -0
- package/dist/commands/platform-auth/utils/payload.utils.d.ts +28 -0
- package/dist/commands/platform-auth/utils/payload.utils.js +87 -0
- package/dist/commands/plugin/development-source/dev-plugin-overrides.utils.d.ts +18 -0
- package/dist/commands/plugin/development-source/dev-plugin-overrides.utils.js +111 -0
- package/dist/commands/plugin/development-source/first-party-plugin-load-paths.d.ts +9 -0
- package/dist/commands/plugin/development-source/first-party-plugin-load-paths.js +183 -0
- package/dist/commands/plugin/index.d.ts +30 -0
- package/dist/commands/plugin/index.js +266 -0
- package/dist/commands/plugin/plugin-command-utils.d.ts +13 -0
- package/dist/commands/plugin/plugin-command-utils.js +37 -0
- package/dist/commands/plugin/plugin-extension-registry.d.ts +10 -0
- package/dist/commands/plugin/plugin-extension-registry.js +35 -0
- package/dist/commands/plugin/plugin-mutation-actions.d.ts +15 -0
- package/dist/commands/plugin/plugin-mutation-actions.js +162 -0
- package/dist/commands/plugin/plugin-registry-loader.d.ts +15 -0
- package/dist/commands/plugin/plugin-registry-loader.js +43 -0
- package/dist/commands/plugin/plugin-reload.d.ts +13 -0
- package/dist/commands/plugin/plugin-reload.js +42 -0
- package/dist/commands/remote/index.d.ts +47 -0
- package/dist/commands/remote/index.js +174 -0
- package/dist/commands/remote/services/remote-access-host.service.d.ts +41 -0
- package/dist/commands/remote/services/remote-access-host.service.js +126 -0
- package/dist/commands/remote/services/remote-runtime-support.service.d.ts +15 -0
- package/dist/commands/remote/services/remote-runtime-support.service.js +79 -0
- package/dist/commands/remote/services/remote-service-control.service.d.ts +33 -0
- package/dist/commands/remote/services/remote-service-control.service.js +188 -0
- package/dist/commands/remote/utils/platform-api-base.utils.d.ts +14 -0
- package/dist/commands/remote/utils/platform-api-base.utils.js +39 -0
- package/dist/commands/service/index.d.ts +16 -0
- package/dist/commands/service/index.js +31 -0
- package/dist/commands/service/services/autostart/host-autostart-command.service.d.ts +29 -0
- package/dist/commands/service/services/autostart/host-autostart-command.service.js +158 -0
- package/dist/commands/service/services/autostart/host-autostart-runtime.service.d.ts +23 -0
- package/dist/commands/service/services/autostart/host-autostart-runtime.service.js +53 -0
- package/dist/commands/service/services/autostart/host-autostart.service.d.ts +41 -0
- package/dist/commands/service/services/autostart/host-autostart.service.js +48 -0
- package/dist/commands/service/services/autostart/linux-systemd-autostart.service.d.ts +48 -0
- package/dist/commands/service/services/autostart/linux-systemd-autostart.service.js +433 -0
- package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.d.ts +54 -0
- package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.js +405 -0
- package/dist/commands/service/services/autostart/windows-task-autostart.service.d.ts +54 -0
- package/dist/commands/service/services/autostart/windows-task-autostart.service.js +403 -0
- package/dist/commands/service/types/autostart/host-autostart.types.d.ts +64 -0
- package/dist/commands/service/types/autostart/host-autostart.types.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/launcher/npm-runtime-bundle-layout.store.d.ts +23 -0
- package/dist/launcher/npm-runtime-bundle-layout.store.js +37 -0
- package/dist/launcher/npm-runtime-bundle-manifest.service.d.ts +9 -0
- package/dist/launcher/npm-runtime-bundle-manifest.service.js +39 -0
- package/dist/launcher/npm-runtime-bundle.service.d.ts +47 -0
- package/dist/launcher/npm-runtime-bundle.service.js +150 -0
- package/dist/launcher/npm-runtime-bundle.types.d.ts +49 -0
- package/dist/launcher/npm-runtime-bundle.types.js +1 -0
- package/dist/launcher/npm-runtime-launcher.service.d.ts +19 -0
- package/dist/launcher/npm-runtime-launcher.service.js +57 -0
- package/dist/launcher/npm-runtime-update-command.service.d.ts +12 -0
- package/dist/launcher/npm-runtime-update-command.service.js +87 -0
- package/dist/launcher/npm-runtime-update-source.service.d.ts +19 -0
- package/dist/launcher/npm-runtime-update-source.service.js +57 -0
- package/dist/launcher/npm-runtime-update-state.store.d.ts +17 -0
- package/dist/launcher/npm-runtime-update-state.store.js +92 -0
- package/dist/launcher/npm-runtime-update.manager.d.ts +42 -0
- package/dist/launcher/npm-runtime-update.manager.js +179 -0
- package/dist/launcher/npm-runtime-update.service.d.ts +54 -0
- package/dist/launcher/npm-runtime-update.service.js +183 -0
- package/dist/service-runtime.service.d.ts +91 -0
- package/dist/service-runtime.service.js +392 -0
- package/dist/shared/controllers/gateway.controller.d.ts +61 -0
- package/dist/shared/controllers/gateway.controller.js +318 -0
- package/dist/shared/services/extensions/extension-lifecycle.service.d.ts +56 -0
- package/dist/shared/services/extensions/extension-lifecycle.service.js +143 -0
- package/dist/shared/services/extensions/service-extension-runtime.service.d.ts +51 -0
- package/dist/shared/services/extensions/service-extension-runtime.service.js +338 -0
- package/dist/shared/services/gateway/cron-job-handler.service.d.ts +26 -0
- package/dist/shared/services/gateway/cron-job-handler.service.js +100 -0
- package/dist/shared/services/gateway/gateway-restart-wake.service.d.ts +12 -0
- package/dist/shared/services/gateway/gateway-restart-wake.service.js +91 -0
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.d.ts +37 -0
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.js +218 -0
- package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts +20 -0
- package/dist/shared/services/gateway/managers/gateway-remote.manager.js +25 -0
- package/dist/shared/services/gateway/nextclaw-app.service.d.ts +22 -0
- package/dist/shared/services/gateway/nextclaw-app.service.js +53 -0
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts +89 -0
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js +337 -0
- package/dist/shared/services/gateway/service-bootstrap-status.d.ts +33 -0
- package/dist/shared/services/gateway/service-bootstrap-status.js +152 -0
- package/dist/shared/services/gateway/service-startup-support.service.d.ts +42 -0
- package/dist/shared/services/gateway/service-startup-support.service.js +96 -0
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts +9 -0
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js +10 -0
- package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts +31 -0
- package/dist/shared/services/marketplace/service-marketplace-installer.service.js +99 -0
- package/dist/shared/services/marketplace/service-mcp-marketplace-ops.d.ts +39 -0
- package/dist/shared/services/marketplace/service-mcp-marketplace-ops.js +67 -0
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.d.ts +24 -0
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.js +117 -0
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.d.ts +6 -0
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.js +96 -0
- package/dist/shared/services/restart/restart-coordinator.service.d.ts +30 -0
- package/dist/shared/services/restart/restart-coordinator.service.js +51 -0
- package/dist/shared/services/restart/restart-sentinel.service.d.ts +39 -0
- package/dist/shared/services/restart/restart-sentinel.service.js +88 -0
- package/dist/shared/services/restart/runtime-restart-request.service.d.ts +24 -0
- package/dist/shared/services/restart/runtime-restart-request.service.js +42 -0
- package/dist/shared/services/runtime/runtime-command.service.d.ts +37 -0
- package/dist/shared/services/runtime/runtime-command.service.js +163 -0
- package/dist/shared/services/runtime/runtime-config-init.service.d.ts +4 -0
- package/dist/shared/services/runtime/runtime-config-init.service.js +10 -0
- package/dist/shared/services/runtime/service-managed-startup.service.d.ts +146 -0
- package/dist/shared/services/runtime/service-managed-startup.service.js +426 -0
- package/dist/shared/services/runtime/service-remote-runtime.service.d.ts +53 -0
- package/dist/shared/services/runtime/service-remote-runtime.service.js +173 -0
- package/dist/shared/services/runtime/utils/skills-loader.utils.d.ts +12 -0
- package/dist/shared/services/runtime/utils/skills-loader.utils.js +9 -0
- package/dist/shared/services/session/service-deferred-ncp-agent.service.d.ts +14 -0
- package/dist/shared/services/session/service-deferred-ncp-agent.service.js +85 -0
- package/dist/shared/services/ui/companion-runtime.service.d.ts +33 -0
- package/dist/shared/services/ui/companion-runtime.service.js +145 -0
- package/dist/shared/services/ui/local-ui-discovery.service.d.ts +19 -0
- package/dist/shared/services/ui/local-ui-discovery.service.js +41 -0
- package/dist/shared/services/ui/npm-runtime-update-host.service.d.ts +40 -0
- package/dist/shared/services/ui/npm-runtime-update-host.service.js +181 -0
- package/dist/shared/services/ui/runtime-control-host.service.d.ts +28 -0
- package/dist/shared/services/ui/runtime-control-host.service.js +89 -0
- package/dist/shared/services/ui/service-remote-access.service.d.ts +25 -0
- package/dist/shared/services/ui/service-remote-access.service.js +38 -0
- package/dist/shared/services/ui/ui-bridge-api.service.d.ts +16 -0
- package/dist/shared/services/ui/ui-bridge-api.service.js +43 -0
- package/dist/shared/services/workspace/workspace-manager.service.d.ts +19 -0
- package/dist/shared/services/workspace/workspace-manager.service.js +135 -0
- package/dist/shared/stores/companion-runtime.store.d.ts +15 -0
- package/dist/shared/stores/companion-runtime.store.js +27 -0
- package/dist/shared/stores/local-ui-runtime.store.d.ts +25 -0
- package/dist/shared/stores/local-ui-runtime.store.js +54 -0
- package/dist/shared/stores/managed-service-state.store.d.ts +28 -0
- package/dist/shared/stores/managed-service-state.store.js +38 -0
- package/dist/shared/stores/pending-restart.store.d.ts +21 -0
- package/dist/shared/stores/pending-restart.store.js +35 -0
- package/dist/shared/types/cli.types.d.ts +295 -0
- package/dist/shared/types/cli.types.js +1 -0
- package/dist/shared/utils/cli.utils.d.ts +34 -0
- package/dist/shared/utils/cli.utils.js +262 -0
- package/dist/shared/utils/config-path.d.ts +15 -0
- package/dist/shared/utils/config-path.js +167 -0
- package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.d.ts +16 -0
- package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.js +46 -0
- package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.d.ts +9 -0
- package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.js +33 -0
- package/dist/shared/utils/package/package-manifest.utils.d.ts +8 -0
- package/dist/shared/utils/package/package-manifest.utils.js +48 -0
- package/dist/shared/utils/runtime-helpers.d.ts +14 -0
- package/dist/shared/utils/runtime-helpers.js +26 -0
- package/dist/shared/utils/service-port-probe.utils.d.ts +41 -0
- package/dist/shared/utils/service-port-probe.utils.js +164 -0
- package/dist/shared/utils/startup-trace.d.ts +7 -0
- package/dist/shared/utils/startup-trace.js +37 -0
- package/dist/shared/utils/top-level-nextclaw-command-env.utils.d.ts +4 -0
- package/dist/shared/utils/top-level-nextclaw-command-env.utils.js +10 -0
- package/package.json +68 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { resolveEffectiveNpmRuntimeVersion } from "./npm-runtime-bundle.service.js";
|
|
2
|
+
import { getPackageVersion } from "../shared/utils/package/package-manifest.utils.js";
|
|
3
|
+
import "../shared/utils/cli.utils.js";
|
|
4
|
+
//#region src/launcher/npm-runtime-update.manager.ts
|
|
5
|
+
var NpmRuntimeUpdateManager = class {
|
|
6
|
+
launcherVersion;
|
|
7
|
+
now;
|
|
8
|
+
availableManifest = null;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
this.launcherVersion = options.launcherVersion ?? getPackageVersion();
|
|
12
|
+
this.now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
13
|
+
this.options.layout.ensureLauncherDirs();
|
|
14
|
+
this.syncStateFromCurrentPointer();
|
|
15
|
+
}
|
|
16
|
+
getSnapshot = () => this.toSnapshotFromState(this.options.stateStore.read(), { status: this.options.stateStore.read().downloadedVersion ? "downloaded" : "idle" });
|
|
17
|
+
run = async (options = {}) => {
|
|
18
|
+
if (options.apply) return this.applyDownloadedUpdate();
|
|
19
|
+
const checkedSnapshot = await this.checkForUpdate();
|
|
20
|
+
if (options.checkOnly || checkedSnapshot.status !== "update-available") return checkedSnapshot;
|
|
21
|
+
if (options.download === false) return checkedSnapshot;
|
|
22
|
+
return await this.downloadUpdate(options.onProgress);
|
|
23
|
+
};
|
|
24
|
+
checkForUpdate = async () => {
|
|
25
|
+
const manifestUrl = this.options.resolveManifestUrl(this.options.channel);
|
|
26
|
+
if (!this.options.updateService.hasSignatureVerifier()) return this.toSnapshotFromState(this.options.stateStore.read(), {
|
|
27
|
+
status: "blocked",
|
|
28
|
+
installationKind: "npm-runtime-bundle",
|
|
29
|
+
blockReason: "signature-verification-unavailable",
|
|
30
|
+
recoveryCommand: "Set NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY or NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY_PATH",
|
|
31
|
+
errorMessage: "Runtime bundle updates require a configured update public key."
|
|
32
|
+
});
|
|
33
|
+
if (!manifestUrl) return this.toSnapshotFromState(this.options.stateStore.read(), {
|
|
34
|
+
status: "blocked",
|
|
35
|
+
installationKind: "npm-runtime-bundle",
|
|
36
|
+
blockReason: "unsupported-installation",
|
|
37
|
+
recoveryCommand: "Set NEXTCLAW_UPDATE_MANIFEST_URL or NEXTCLAW_UPDATE_MANIFEST_BASE_URL",
|
|
38
|
+
errorMessage: "Runtime bundle update manifest URL is not configured."
|
|
39
|
+
});
|
|
40
|
+
const checkedAt = this.now().toISOString();
|
|
41
|
+
const state = this.options.stateStore.update((current) => ({
|
|
42
|
+
...current,
|
|
43
|
+
channel: this.options.channel,
|
|
44
|
+
lastUpdateCheckAt: checkedAt
|
|
45
|
+
}));
|
|
46
|
+
const availableUpdate = await this.options.updateService.checkForUpdate(manifestUrl, state.currentVersion, state.badVersions);
|
|
47
|
+
return this.toSnapshotAfterCheck(availableUpdate, this.options.stateStore.read());
|
|
48
|
+
};
|
|
49
|
+
downloadUpdate = async (onProgress) => {
|
|
50
|
+
const manifest = this.availableManifest ?? await this.ensureAvailableManifest();
|
|
51
|
+
const downloaded = await this.options.updateService.downloadAndInstallUpdate(manifest, onProgress);
|
|
52
|
+
const state = this.options.stateStore.update((current) => ({
|
|
53
|
+
...current,
|
|
54
|
+
downloadedVersion: downloaded.downloadedVersion,
|
|
55
|
+
downloadedReleaseNotesUrl: downloaded.manifest.releaseNotesUrl
|
|
56
|
+
}));
|
|
57
|
+
await this.options.bundleService.pruneRetainedArtifacts();
|
|
58
|
+
return this.toSnapshotFromState(state, {
|
|
59
|
+
status: "downloaded",
|
|
60
|
+
availableVersion: downloaded.downloadedVersion,
|
|
61
|
+
downloadedVersion: downloaded.downloadedVersion,
|
|
62
|
+
minimumHostVersion: downloaded.manifest.minimumLauncherVersion,
|
|
63
|
+
releaseNotesUrl: downloaded.manifest.releaseNotesUrl,
|
|
64
|
+
canApplyInApp: true,
|
|
65
|
+
requiresRestart: false
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
applyDownloadedUpdate = () => {
|
|
69
|
+
const downloadedVersion = this.options.stateStore.read().downloadedVersion?.trim();
|
|
70
|
+
if (!downloadedVersion) throw new Error("No downloaded npm runtime update is ready to apply.");
|
|
71
|
+
this.options.bundleService.activateVersion(downloadedVersion);
|
|
72
|
+
this.availableManifest = null;
|
|
73
|
+
return this.toSnapshotFromState(this.options.stateStore.read(), {
|
|
74
|
+
status: "restart-required",
|
|
75
|
+
availableVersion: null,
|
|
76
|
+
downloadedVersion: null,
|
|
77
|
+
releaseNotesUrl: null,
|
|
78
|
+
canApplyInApp: false,
|
|
79
|
+
requiresRestart: true
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
ensureAvailableManifest = async () => {
|
|
83
|
+
const snapshot = await this.checkForUpdate();
|
|
84
|
+
if (!this.availableManifest) {
|
|
85
|
+
if (snapshot.downloadedVersion) throw new Error(`Version ${snapshot.downloadedVersion} has already been downloaded and is ready to apply.`);
|
|
86
|
+
throw new Error("No npm runtime update is currently available.");
|
|
87
|
+
}
|
|
88
|
+
return this.availableManifest;
|
|
89
|
+
};
|
|
90
|
+
toSnapshotAfterCheck = (availableUpdate, state) => {
|
|
91
|
+
if (state.downloadedVersion) {
|
|
92
|
+
this.availableManifest = availableUpdate?.kind === "runtime-bundle-update" ? availableUpdate.manifest : this.availableManifest;
|
|
93
|
+
return this.toSnapshotFromState(state, {
|
|
94
|
+
status: "downloaded",
|
|
95
|
+
availableVersion: availableUpdate?.kind === "runtime-bundle-update" ? availableUpdate.manifest.latestVersion : state.downloadedVersion,
|
|
96
|
+
minimumHostVersion: availableUpdate?.kind === "runtime-bundle-update" ? availableUpdate.manifest.minimumLauncherVersion : null,
|
|
97
|
+
canApplyInApp: true,
|
|
98
|
+
requiresRestart: false
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (!availableUpdate) {
|
|
102
|
+
this.availableManifest = null;
|
|
103
|
+
return this.toSnapshotFromState(state, {
|
|
104
|
+
status: "up-to-date",
|
|
105
|
+
availableVersion: null,
|
|
106
|
+
downloadedVersion: null,
|
|
107
|
+
releaseNotesUrl: null
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (availableUpdate.kind === "host-update-required") {
|
|
111
|
+
this.availableManifest = null;
|
|
112
|
+
return this.toSnapshotFromState(state, {
|
|
113
|
+
status: "blocked",
|
|
114
|
+
availableVersion: availableUpdate.manifest.latestVersion,
|
|
115
|
+
minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,
|
|
116
|
+
releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl,
|
|
117
|
+
blockReason: "host-too-old",
|
|
118
|
+
recoveryCommand: "npm install -g nextclaw@latest",
|
|
119
|
+
errorMessage: `NextClaw npm launcher ${this.launcherVersion} is too old for runtime bundle ${availableUpdate.manifest.latestVersion}.`
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (availableUpdate.kind === "quarantined-bad-version") {
|
|
123
|
+
this.availableManifest = null;
|
|
124
|
+
return this.toSnapshotFromState(state, {
|
|
125
|
+
status: "failed",
|
|
126
|
+
availableVersion: availableUpdate.manifest.latestVersion,
|
|
127
|
+
minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,
|
|
128
|
+
releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl,
|
|
129
|
+
errorMessage: `Version ${availableUpdate.manifest.latestVersion} was quarantined after a failed launch.`
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
this.availableManifest = availableUpdate.manifest;
|
|
133
|
+
return this.toSnapshotFromState(state, {
|
|
134
|
+
status: "update-available",
|
|
135
|
+
availableVersion: availableUpdate.manifest.latestVersion,
|
|
136
|
+
minimumHostVersion: availableUpdate.manifest.minimumLauncherVersion,
|
|
137
|
+
releaseNotesUrl: availableUpdate.manifest.releaseNotesUrl
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
syncStateFromCurrentPointer = () => {
|
|
141
|
+
const currentPointer = this.options.layout.readCurrentPointer();
|
|
142
|
+
const effectiveCurrentVersion = resolveEffectiveNpmRuntimeVersion({
|
|
143
|
+
launcherVersion: this.launcherVersion,
|
|
144
|
+
currentBundleVersion: currentPointer?.version ?? null
|
|
145
|
+
});
|
|
146
|
+
if (!effectiveCurrentVersion) return;
|
|
147
|
+
this.options.stateStore.update((state) => ({
|
|
148
|
+
...state,
|
|
149
|
+
currentVersion: effectiveCurrentVersion
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
toSnapshotFromState = (state, patch) => {
|
|
153
|
+
const hasDownloadedVersion = Boolean(state.downloadedVersion);
|
|
154
|
+
const { status } = patch;
|
|
155
|
+
return {
|
|
156
|
+
installationKind: "npm-runtime-bundle",
|
|
157
|
+
channel: state.channel,
|
|
158
|
+
hostVersion: this.launcherVersion,
|
|
159
|
+
currentVersion: state.currentVersion,
|
|
160
|
+
availableVersion: null,
|
|
161
|
+
downloadedVersion: state.downloadedVersion,
|
|
162
|
+
minimumHostVersion: null,
|
|
163
|
+
releaseNotesUrl: state.downloadedReleaseNotesUrl,
|
|
164
|
+
lastCheckedAt: state.lastUpdateCheckAt,
|
|
165
|
+
progress: null,
|
|
166
|
+
canAutoDownload: state.updatePreferences.autoDownload,
|
|
167
|
+
canApplyInApp: hasDownloadedVersion,
|
|
168
|
+
requiresRestart: false,
|
|
169
|
+
blockReason: null,
|
|
170
|
+
recoveryCommand: null,
|
|
171
|
+
errorMessage: null,
|
|
172
|
+
preferences: { ...state.updatePreferences },
|
|
173
|
+
...patch,
|
|
174
|
+
status
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
//#endregion
|
|
179
|
+
export { NpmRuntimeUpdateManager };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { NpmRuntimeDownloadedUpdate, NpmRuntimeUpdateProgressReporter } from "./npm-runtime-bundle.types.js";
|
|
2
|
+
import { NpmRuntimeBundleLayoutStore } from "./npm-runtime-bundle-layout.store.js";
|
|
3
|
+
import { NpmRuntimeBundleService } from "./npm-runtime-bundle.service.js";
|
|
4
|
+
import { UpdateManifest, UpdateManifestReader } from "@nextclaw/kernel/update-contract";
|
|
5
|
+
|
|
6
|
+
//#region src/launcher/npm-runtime-update.service.d.ts
|
|
7
|
+
type FetchLike = typeof fetch;
|
|
8
|
+
type NpmRuntimeUpdateServiceOptions = {
|
|
9
|
+
layout: NpmRuntimeBundleLayoutStore;
|
|
10
|
+
bundleService: NpmRuntimeBundleService;
|
|
11
|
+
launcherVersion: string;
|
|
12
|
+
bundlePublicKey?: string;
|
|
13
|
+
fetchImpl?: FetchLike;
|
|
14
|
+
platform?: NodeJS.Platform;
|
|
15
|
+
arch?: string;
|
|
16
|
+
manifestReader?: UpdateManifestReader;
|
|
17
|
+
now?: () => number;
|
|
18
|
+
};
|
|
19
|
+
type NpmRuntimeAvailableUpdate = {
|
|
20
|
+
kind: "runtime-bundle-update";
|
|
21
|
+
manifest: UpdateManifest;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "host-update-required";
|
|
24
|
+
manifest: UpdateManifest;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "quarantined-bad-version";
|
|
27
|
+
manifest: UpdateManifest;
|
|
28
|
+
};
|
|
29
|
+
declare class NpmRuntimeUpdateService {
|
|
30
|
+
private readonly options;
|
|
31
|
+
private readonly platform;
|
|
32
|
+
private readonly arch;
|
|
33
|
+
private readonly fetchImpl;
|
|
34
|
+
private readonly manifestReader;
|
|
35
|
+
private readonly bundlePublicKey;
|
|
36
|
+
private readonly now;
|
|
37
|
+
constructor(options: NpmRuntimeUpdateServiceOptions);
|
|
38
|
+
hasSignatureVerifier: () => boolean;
|
|
39
|
+
checkForUpdate: (manifestUrl: string, currentVersion: string | null, badVersions?: string[]) => Promise<NpmRuntimeAvailableUpdate | null>;
|
|
40
|
+
downloadAndInstallUpdate: (manifest: UpdateManifest, reportProgress?: NpmRuntimeUpdateProgressReporter) => Promise<NpmRuntimeDownloadedUpdate>;
|
|
41
|
+
private downloadBundleBytes;
|
|
42
|
+
private fetchManifest;
|
|
43
|
+
private verifyManifest;
|
|
44
|
+
private fetchBundle;
|
|
45
|
+
private readResponseBytes;
|
|
46
|
+
private readContentLength;
|
|
47
|
+
private reportDownloadProgress;
|
|
48
|
+
private findBundleRoot;
|
|
49
|
+
private parseBundlePublicKey;
|
|
50
|
+
private assertManifestSignature;
|
|
51
|
+
private assertBundleSignature;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { NpmRuntimeAvailableUpdate, NpmRuntimeUpdateService };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { compareNpmRuntimeVersions } from "./npm-runtime-bundle.service.js";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname, join, resolve, sep } from "node:path";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { rm } from "node:fs/promises";
|
|
6
|
+
import { createHash, createPublicKey, verify } from "node:crypto";
|
|
7
|
+
import JSZip from "jszip";
|
|
8
|
+
import { UpdateManifestReader, serializeUnsignedUpdateManifest } from "@nextclaw/kernel/update-contract";
|
|
9
|
+
//#region src/launcher/npm-runtime-update.service.ts
|
|
10
|
+
var NpmRuntimeUpdateService = class {
|
|
11
|
+
platform;
|
|
12
|
+
arch;
|
|
13
|
+
fetchImpl;
|
|
14
|
+
manifestReader;
|
|
15
|
+
bundlePublicKey;
|
|
16
|
+
now;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
this.platform = options.platform ?? process.platform;
|
|
20
|
+
this.arch = options.arch ?? process.arch;
|
|
21
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
22
|
+
this.manifestReader = options.manifestReader ?? new UpdateManifestReader();
|
|
23
|
+
this.bundlePublicKey = this.parseBundlePublicKey(options.bundlePublicKey);
|
|
24
|
+
this.now = options.now ?? Date.now;
|
|
25
|
+
}
|
|
26
|
+
hasSignatureVerifier = () => Boolean(this.bundlePublicKey);
|
|
27
|
+
checkForUpdate = async (manifestUrl, currentVersion, badVersions = []) => {
|
|
28
|
+
const manifest = await this.fetchManifest(manifestUrl);
|
|
29
|
+
if (currentVersion && compareNpmRuntimeVersions(manifest.latestVersion, currentVersion) <= 0) return null;
|
|
30
|
+
if (compareNpmRuntimeVersions(this.options.launcherVersion, manifest.minimumLauncherVersion) < 0) return {
|
|
31
|
+
kind: "host-update-required",
|
|
32
|
+
manifest
|
|
33
|
+
};
|
|
34
|
+
if (badVersions.includes(manifest.latestVersion)) return {
|
|
35
|
+
kind: "quarantined-bad-version",
|
|
36
|
+
manifest
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
kind: "runtime-bundle-update",
|
|
40
|
+
manifest
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
downloadAndInstallUpdate = async (manifest, reportProgress) => {
|
|
44
|
+
const bytes = await this.downloadBundleBytes(manifest, reportProgress);
|
|
45
|
+
const stagingRoot = join(this.options.layout.getStagingDir(), `download-${manifest.latestVersion}-${this.now()}`);
|
|
46
|
+
await rm(stagingRoot, {
|
|
47
|
+
recursive: true,
|
|
48
|
+
force: true
|
|
49
|
+
});
|
|
50
|
+
mkdirSync(stagingRoot, { recursive: true });
|
|
51
|
+
try {
|
|
52
|
+
const zip = await JSZip.loadAsync(bytes);
|
|
53
|
+
const entries = Object.values(zip.files);
|
|
54
|
+
await Promise.all(entries.map(async (entry) => {
|
|
55
|
+
const targetPath = resolve(stagingRoot, entry.name);
|
|
56
|
+
const resolvedStagingRoot = resolve(stagingRoot);
|
|
57
|
+
if (targetPath !== resolvedStagingRoot && !targetPath.startsWith(`${resolvedStagingRoot}${sep}`)) throw new Error(`runtime bundle archive contains invalid path: ${entry.name}`);
|
|
58
|
+
if (entry.dir) {
|
|
59
|
+
mkdirSync(targetPath, { recursive: true });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
63
|
+
writeFileSync(targetPath, Buffer.from(await entry.async("uint8array")));
|
|
64
|
+
}));
|
|
65
|
+
const bundleRoot = this.findBundleRoot(stagingRoot);
|
|
66
|
+
const installedBundle = await this.options.bundleService.installFromDirectory(bundleRoot);
|
|
67
|
+
return {
|
|
68
|
+
manifest,
|
|
69
|
+
downloadedVersion: installedBundle.manifest.bundleVersion,
|
|
70
|
+
bundleDirectory: installedBundle.bundleDirectory
|
|
71
|
+
};
|
|
72
|
+
} catch (error) {
|
|
73
|
+
await rm(stagingRoot, {
|
|
74
|
+
recursive: true,
|
|
75
|
+
force: true
|
|
76
|
+
});
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
downloadBundleBytes = async (manifest, reportProgress) => {
|
|
81
|
+
const response = await this.fetchBundle(manifest.bundleUrl);
|
|
82
|
+
const bytes = await this.readResponseBytes(response, reportProgress);
|
|
83
|
+
const sha256 = createHash("sha256").update(bytes).digest("hex");
|
|
84
|
+
if (sha256 !== manifest.bundleSha256) throw new Error(`runtime bundle sha256 mismatch: expected ${manifest.bundleSha256} but got ${sha256}`);
|
|
85
|
+
this.assertBundleSignature(manifest, bytes);
|
|
86
|
+
return bytes;
|
|
87
|
+
};
|
|
88
|
+
fetchManifest = async (manifestUrl) => {
|
|
89
|
+
if (manifestUrl.startsWith("file://")) {
|
|
90
|
+
const manifest = this.manifestReader.parse(JSON.parse(readFileSync(fileURLToPath(manifestUrl), "utf8")), manifestUrl);
|
|
91
|
+
return this.verifyManifest(manifest, manifestUrl);
|
|
92
|
+
}
|
|
93
|
+
const response = await this.fetchImpl(manifestUrl);
|
|
94
|
+
if (!response.ok) throw new Error(`runtime update manifest request failed with status ${response.status}`);
|
|
95
|
+
const manifest = this.manifestReader.parse(await response.json(), manifestUrl);
|
|
96
|
+
return this.verifyManifest(manifest, manifestUrl);
|
|
97
|
+
};
|
|
98
|
+
verifyManifest = (manifest, _manifestUrl) => {
|
|
99
|
+
if (manifest.hostKind && manifest.hostKind !== "npm-runtime-bundle") throw new Error(`runtime update manifest hostKind mismatch: expected npm-runtime-bundle but got ${manifest.hostKind}`);
|
|
100
|
+
if (manifest.channel !== "stable" && manifest.channel !== "beta") throw new Error(`runtime update manifest channel is unsupported: ${manifest.channel}`);
|
|
101
|
+
if (manifest.platform !== this.platform) throw new Error(`runtime update manifest platform mismatch: expected ${this.platform} but got ${manifest.platform}`);
|
|
102
|
+
if (manifest.arch !== this.arch) throw new Error(`runtime update manifest arch mismatch: expected ${this.arch} but got ${manifest.arch}`);
|
|
103
|
+
this.assertManifestSignature(manifest);
|
|
104
|
+
return manifest;
|
|
105
|
+
};
|
|
106
|
+
fetchBundle = async (bundleUrl) => {
|
|
107
|
+
if (bundleUrl.startsWith("file://")) {
|
|
108
|
+
const bytes = readFileSync(fileURLToPath(bundleUrl));
|
|
109
|
+
return new Response(bytes, {
|
|
110
|
+
status: 200,
|
|
111
|
+
headers: { "content-length": String(bytes.byteLength) }
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const response = await this.fetchImpl(bundleUrl);
|
|
115
|
+
if (!response.ok) throw new Error(`runtime bundle download failed with status ${response.status}`);
|
|
116
|
+
return response;
|
|
117
|
+
};
|
|
118
|
+
readResponseBytes = async (response, reportProgress) => {
|
|
119
|
+
const totalBytes = this.readContentLength(response);
|
|
120
|
+
if (!response.body) {
|
|
121
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
122
|
+
this.reportDownloadProgress(reportProgress, bytes.byteLength, totalBytes ?? bytes.byteLength);
|
|
123
|
+
return bytes;
|
|
124
|
+
}
|
|
125
|
+
const reader = response.body.getReader();
|
|
126
|
+
const chunks = [];
|
|
127
|
+
let downloadedBytes = 0;
|
|
128
|
+
this.reportDownloadProgress(reportProgress, downloadedBytes, totalBytes);
|
|
129
|
+
while (true) {
|
|
130
|
+
const next = await reader.read();
|
|
131
|
+
if (next.done) break;
|
|
132
|
+
chunks.push(next.value);
|
|
133
|
+
downloadedBytes += next.value.byteLength;
|
|
134
|
+
this.reportDownloadProgress(reportProgress, downloadedBytes, totalBytes);
|
|
135
|
+
}
|
|
136
|
+
return Buffer.concat(chunks.map((chunk) => Buffer.from(chunk)));
|
|
137
|
+
};
|
|
138
|
+
readContentLength = (response) => {
|
|
139
|
+
const raw = response.headers.get("content-length");
|
|
140
|
+
if (!raw) return null;
|
|
141
|
+
const parsed = Number(raw);
|
|
142
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : null;
|
|
143
|
+
};
|
|
144
|
+
reportDownloadProgress = (reportProgress, downloadedBytes, totalBytes) => {
|
|
145
|
+
reportProgress?.({
|
|
146
|
+
downloadedBytes,
|
|
147
|
+
totalBytes,
|
|
148
|
+
percent: totalBytes && totalBytes > 0 ? Math.min(100, Math.round(downloadedBytes / totalBytes * 100)) : null
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
findBundleRoot = (stagingRoot) => {
|
|
152
|
+
if (existsSync(join(stagingRoot, "manifest.json"))) return stagingRoot;
|
|
153
|
+
const entries = readDirectoryNames(stagingRoot).filter((entry) => existsSync(join(stagingRoot, entry, "manifest.json")));
|
|
154
|
+
if (entries.length === 1) return join(stagingRoot, entries[0]);
|
|
155
|
+
throw new Error(`runtime bundle archive does not contain exactly one manifest root under ${stagingRoot}`);
|
|
156
|
+
};
|
|
157
|
+
parseBundlePublicKey = (publicKey) => {
|
|
158
|
+
const normalizedKey = publicKey?.trim();
|
|
159
|
+
if (!normalizedKey) return null;
|
|
160
|
+
const pemOrEscapedPem = normalizedKey.replaceAll("\\n", "\n");
|
|
161
|
+
if (pemOrEscapedPem.includes("BEGIN PUBLIC KEY")) return createPublicKey(pemOrEscapedPem);
|
|
162
|
+
return createPublicKey({
|
|
163
|
+
key: Buffer.from(normalizedKey, "base64"),
|
|
164
|
+
format: "der",
|
|
165
|
+
type: "spki"
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
assertManifestSignature = (manifest) => {
|
|
169
|
+
if (!this.bundlePublicKey) throw new Error("runtime update manifest signature verification requires bundlePublicKey");
|
|
170
|
+
const signature = Buffer.from(manifest.manifestSignature, "base64");
|
|
171
|
+
if (!verify(null, Buffer.from(serializeUnsignedUpdateManifest(manifest)), this.bundlePublicKey, signature)) throw new Error(`runtime update manifest signature verification failed for ${manifest.latestVersion}`);
|
|
172
|
+
};
|
|
173
|
+
assertBundleSignature = (manifest, bytes) => {
|
|
174
|
+
if (!this.bundlePublicKey) throw new Error("runtime bundle signature verification requires bundlePublicKey");
|
|
175
|
+
const signature = Buffer.from(manifest.bundleSignature, "base64");
|
|
176
|
+
if (!verify(null, bytes, this.bundlePublicKey, signature)) throw new Error(`runtime bundle signature verification failed for ${manifest.latestVersion}`);
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
function readDirectoryNames(directory) {
|
|
180
|
+
return readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
export { NpmRuntimeUpdateService };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { AgentCommandOptions, LoginCommandOptions, UpdateCommandOptions } from "./shared/types/cli.types.js";
|
|
2
|
+
import { PluginCommands } from "./commands/plugin/index.js";
|
|
3
|
+
import { AgentCommands } from "./cli/commands/agent/services/agent-commands.service.js";
|
|
4
|
+
import { CompanionCommands } from "./cli/commands/companion/index.js";
|
|
5
|
+
import { ConfigCommands } from "./cli/commands/config/services/config-commands.service.js";
|
|
6
|
+
import { CronCommands } from "./cli/commands/cron/services/cron-commands.service.js";
|
|
7
|
+
import { DiagnosticsCommands } from "./cli/commands/diagnostics/services/diagnostics-commands.service.js";
|
|
8
|
+
import { GatewayCommands } from "./cli/commands/gateway/index.js";
|
|
9
|
+
import { LogsCommands } from "./cli/commands/logs/index.js";
|
|
10
|
+
import { McpCommands } from "./cli/commands/mcp/index.js";
|
|
11
|
+
import { StartCommands } from "./cli/commands/start/index.js";
|
|
12
|
+
import { RestartCommands } from "./cli/commands/restart/index.js";
|
|
13
|
+
import { SecretsCommands } from "./cli/commands/secrets/index.js";
|
|
14
|
+
import { ServeCommands } from "./cli/commands/serve/index.js";
|
|
15
|
+
import { SkillsCommands } from "./cli/commands/skills/index.js";
|
|
16
|
+
import { StopCommands } from "./cli/commands/stop/index.js";
|
|
17
|
+
import { UiCommands } from "./cli/commands/ui/index.js";
|
|
18
|
+
import { LlmUsageCommandService } from "./cli/commands/usage/services/llm-usage-command.service.js";
|
|
19
|
+
import { ChannelCommands } from "./commands/channel/index.js";
|
|
20
|
+
import { ServiceCommands } from "./commands/service/index.js";
|
|
21
|
+
import { RemoteRuntimeActions } from "@nextclaw/remote";
|
|
22
|
+
|
|
23
|
+
//#region src/service-runtime.service.d.ts
|
|
24
|
+
type NextclawServiceRuntimeOptions = {
|
|
25
|
+
logo?: string;
|
|
26
|
+
};
|
|
27
|
+
type NextclawServiceRuntimeAccount = {
|
|
28
|
+
status: (opts?: {
|
|
29
|
+
apiBase?: string;
|
|
30
|
+
json?: boolean;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
setUsername: (username: string, opts?: {
|
|
33
|
+
apiBase?: string;
|
|
34
|
+
json?: boolean;
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
};
|
|
37
|
+
type NextclawServiceCommands = {
|
|
38
|
+
remote: RemoteRuntimeActions;
|
|
39
|
+
skills: SkillsCommands;
|
|
40
|
+
service: ServiceCommands;
|
|
41
|
+
config: ConfigCommands;
|
|
42
|
+
mcp: McpCommands;
|
|
43
|
+
secrets: SecretsCommands;
|
|
44
|
+
plugins: PluginCommands;
|
|
45
|
+
agents: AgentCommands;
|
|
46
|
+
channels: ChannelCommands;
|
|
47
|
+
cron: CronCommands;
|
|
48
|
+
diagnostics: DiagnosticsCommands;
|
|
49
|
+
logs: LogsCommands;
|
|
50
|
+
gateway: GatewayCommands;
|
|
51
|
+
ui: UiCommands;
|
|
52
|
+
start: StartCommands;
|
|
53
|
+
restart: RestartCommands;
|
|
54
|
+
serve: ServeCommands;
|
|
55
|
+
stop: StopCommands;
|
|
56
|
+
companion: CompanionCommands;
|
|
57
|
+
usage: LlmUsageCommandService;
|
|
58
|
+
};
|
|
59
|
+
declare class NextclawServiceRuntime {
|
|
60
|
+
private logo;
|
|
61
|
+
private restartCoordinator;
|
|
62
|
+
private serviceRestartTask;
|
|
63
|
+
private selfRelaunchArmed;
|
|
64
|
+
private restartRequestService;
|
|
65
|
+
private workspaceManager;
|
|
66
|
+
private runtimeCommandService;
|
|
67
|
+
private platformAuthCommands;
|
|
68
|
+
private remoteCommands;
|
|
69
|
+
account: NextclawServiceRuntimeAccount;
|
|
70
|
+
commands: NextclawServiceCommands;
|
|
71
|
+
constructor(options?: NextclawServiceRuntimeOptions);
|
|
72
|
+
private createCommands;
|
|
73
|
+
get version(): string;
|
|
74
|
+
private scheduleProcessExit;
|
|
75
|
+
private restartBackgroundService;
|
|
76
|
+
private armManagedServiceRelaunch;
|
|
77
|
+
private requestRestart;
|
|
78
|
+
private writeRestartSentinelFromExecContext;
|
|
79
|
+
onboard: () => Promise<void>;
|
|
80
|
+
init: (options?: {
|
|
81
|
+
source?: string;
|
|
82
|
+
auto?: boolean;
|
|
83
|
+
force?: boolean;
|
|
84
|
+
}) => Promise<void>;
|
|
85
|
+
login: (opts?: LoginCommandOptions) => Promise<void>;
|
|
86
|
+
agent: (opts: AgentCommandOptions) => Promise<void>;
|
|
87
|
+
update: (opts: UpdateCommandOptions) => Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
declare const runNextclawNpmRuntimeLauncher: (argv?: string[]) => void;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { NextclawServiceCommands, NextclawServiceRuntime, NextclawServiceRuntimeAccount, NextclawServiceRuntimeOptions, runNextclawNpmRuntimeLauncher };
|