nextclaw 0.18.12-beta.2 → 0.18.12-beta.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/cli/app/index.js +566 -142
- package/dist/cli/launcher/index.js +2 -2
- package/dist/{npm-runtime-update-state.store-DaF0iDY9.js → npm-runtime-update-state.store-BwM_B6eP.js} +94 -29
- package/package.json +17 -16
- package/ui-dist/assets/api-C412zuay.js +15 -0
- package/ui-dist/assets/app-manager-provider-Cm-KiZZG.js +1 -0
- package/ui-dist/assets/app-navigation.config-BORqHkbN.js +1 -0
- package/ui-dist/assets/{book-open-C5p9re7m.js → book-open-DgLqYpNY.js} +1 -1
- package/ui-dist/assets/{channels-list-page-CZAdoJ3s.js → channels-list-page-sISO_4Yj.js} +2 -2
- package/ui-dist/assets/{chat-a-_X0PmT.js → chat-ChCu7LQD.js} +8 -8
- package/ui-dist/assets/chat-page-BCaNZJGT.js +1 -0
- package/ui-dist/assets/{chunk-JZWAC4HX-CD1w8mri.js → chunk-JZWAC4HX-DvbcIVPf.js} +1 -1
- package/ui-dist/assets/{config-split-page-YB7xRSn7.js → config-split-page-BMRGuCJQ.js} +1 -1
- package/ui-dist/assets/{createLucideIcon-D48LQ7_3.js → createLucideIcon-BZkY6emz.js} +1 -1
- package/ui-dist/assets/desktop-update-config-BfJ5iSeY.js +1 -0
- package/ui-dist/assets/{dialog-BNdeIVqc.js → dialog-B-CXiFPZ.js} +1 -1
- package/ui-dist/assets/{dist-BjUfmI6n.js → dist-DYVfg3q5.js} +1 -1
- package/ui-dist/assets/{doc-browser-CX_BvO6R.js → doc-browser-BUlCkZo2.js} +1 -1
- package/ui-dist/assets/{doc-browser-CLdhFEsz.js → doc-browser-CzCV73NJ.js} +1 -1
- package/ui-dist/assets/doc-browser-Doh2541x.js +1 -0
- package/ui-dist/assets/{doc-browser-context-5mbkyvid.js → doc-browser-context-DfLHAWbG.js} +1 -1
- package/ui-dist/assets/{es2015-Db-PtAnL.js → es2015-BXroVnPi.js} +1 -1
- package/ui-dist/assets/{external-link-BwNyDSMe.js → external-link-Sw3ah_JD.js} +1 -1
- package/ui-dist/assets/{folder-BSLCUICp.js → folder-D7-VTnkz.js} +1 -1
- package/ui-dist/assets/{hash-DpL5u6Fu.js → hash-zajSTDXZ.js} +1 -1
- package/ui-dist/assets/i18n-C5Mibli1.js +1 -0
- package/ui-dist/assets/index-CqPDhosM.js +2 -0
- package/ui-dist/assets/{key-round-BNTFD7Jk.js → key-round-CnI1mc9F.js} +1 -1
- package/ui-dist/assets/loader-circle-B5i8oMMY.js +1 -0
- package/ui-dist/assets/{logo-badge-a-OsoTKw.js → logo-badge-BQgKnVtz.js} +1 -1
- package/ui-dist/assets/{logos--4c27B_Z.js → logos-CqVm0q0W.js} +1 -1
- package/ui-dist/assets/marketplace-page-C8uaWkfd.js +1 -0
- package/ui-dist/assets/{marketplace-page-PA3qcNzv.js → marketplace-page-C9oZ01rM.js} +2 -2
- package/ui-dist/assets/mcp-marketplace-page-DuEixgSs.js +40 -0
- package/ui-dist/assets/mcp-marketplace-page-rNqr6ZpD.js +1 -0
- package/ui-dist/assets/message-square-D6Z4NwpG.js +1 -0
- package/ui-dist/assets/{model-config-C3-m1Sua.js → model-config-mfhqEZBG.js} +1 -1
- package/ui-dist/assets/{notice-card-DE4jOEXF.js → notice-card-CozHB03G.js} +1 -1
- package/ui-dist/assets/play-D8WJLnJe.js +1 -0
- package/ui-dist/assets/plus-Di0KAkiO.js +1 -0
- package/ui-dist/assets/{popover-B6dtrFF5.js → popover-CPUPma-w.js} +1 -1
- package/ui-dist/assets/{provider-scoped-model-input-BkpcdlQB.js → provider-scoped-model-input-CL9sti2I.js} +1 -1
- package/ui-dist/assets/{providers-list-EzKC5s0y.js → providers-list-HPmL2akJ.js} +1 -1
- package/ui-dist/assets/refresh-ccw-Bii4w8aB.js +1 -0
- package/ui-dist/assets/refresh-cw-BxojR62w.js +1 -0
- package/ui-dist/assets/remote-oDlAdgVA.js +1 -0
- package/ui-dist/assets/{rotate-cw-CeTNbfMs.js → rotate-cw-1Xqa7LZ8.js} +1 -1
- package/ui-dist/assets/runtime-config-page-BCshTAAE.js +1 -0
- package/ui-dist/assets/{save-B8Rym7bl.js → save--BVI5wZX.js} +1 -1
- package/ui-dist/assets/{search-config-CNh9FS_N.js → search-config-Bcnk9VlL.js} +1 -1
- package/ui-dist/assets/{search-BUGoDsjN.js → search-vChioOoe.js} +1 -1
- package/ui-dist/assets/{secrets-config-Bau56GeM.js → secrets-config-Dde-5Y1w.js} +2 -2
- package/ui-dist/assets/{select-BuXrS7g3.js → select-BELPuXLW.js} +1 -1
- package/ui-dist/assets/{sessions-config-page-BDF04GaS.js → sessions-config-page-CG49_0Z6.js} +2 -2
- package/ui-dist/assets/{setting-row-CifMdz8g.js → setting-row-D5DtT6Ny.js} +1 -1
- package/ui-dist/assets/settings-CiRChctQ.js +1 -0
- package/ui-dist/assets/skeleton-CFQRIUzt.js +1 -0
- package/ui-dist/assets/{sparkles-Bo0DxmaB.js → sparkles-D1ZKWdm4.js} +1 -1
- package/ui-dist/assets/{status-dot-CS7yRd9c.js → status-dot-Dv_hiUVa.js} +1 -1
- package/ui-dist/assets/{tabs-custom-HBN-j_Kn.js → tabs-custom-CsACkVji.js} +1 -1
- package/ui-dist/assets/{tag-chip-BZSHb3cE.js → tag-chip-D9BWWgYg.js} +1 -1
- package/ui-dist/assets/theme-provider-DeBrTglS.js +1 -0
- package/ui-dist/assets/{tooltip-BMz2ki-V.js → tooltip-CI0rpNee.js} +1 -1
- package/ui-dist/assets/{trash-2-gWTb2oNS.js → trash-2-rY9ZteZX.js} +1 -1
- package/ui-dist/assets/use-config-CrWZ_TSF.js +1 -0
- package/ui-dist/assets/{use-confirm-dialog-DLVARUvb.js → use-confirm-dialog-hbynwWf2.js} +1 -1
- package/ui-dist/assets/{use-infinite-scroll-loader-BdGMvR3y.js → use-infinite-scroll-loader-Cw5qQr3-.js} +1 -1
- package/ui-dist/assets/{use-viewport-layout-DOqJ0LPT.js → use-viewport-layout-CWHVDC6z.js} +1 -1
- package/ui-dist/assets/x-DpTzXQcX.js +1 -0
- package/ui-dist/index.html +39 -35
- package/ui-dist/assets/api-BsY-53_V.js +0 -15
- package/ui-dist/assets/app-manager-provider-DTrWjVLB.js +0 -1
- package/ui-dist/assets/chat-page-BCypc4bi.js +0 -1
- package/ui-dist/assets/desktop-B9azAgEh.js +0 -2
- package/ui-dist/assets/desktop-update-config-Dm_cedSL.js +0 -1
- package/ui-dist/assets/doc-browser-eF2QWInq.js +0 -1
- package/ui-dist/assets/i18n-jGA3YQz4.js +0 -1
- package/ui-dist/assets/index-o_M3x0GR.js +0 -2
- package/ui-dist/assets/loader-circle-C3XJNZy7.js +0 -1
- package/ui-dist/assets/marketplace-page-DvmfPCAY.js +0 -1
- package/ui-dist/assets/mcp-marketplace-page-Dl8wdAtD.js +0 -1
- package/ui-dist/assets/mcp-marketplace-page-DukryaOq.js +0 -40
- package/ui-dist/assets/play-DGBx1fWI.js +0 -1
- package/ui-dist/assets/plus-CUuByV8j.js +0 -1
- package/ui-dist/assets/remote-Xzy42m-0.js +0 -1
- package/ui-dist/assets/runtime-config-page-DAMnv5Xp.js +0 -1
- package/ui-dist/assets/settings-COxdZHdu.js +0 -1
- package/ui-dist/assets/skeleton-DW5F83p8.js +0 -1
- package/ui-dist/assets/use-config-Ds7DyaYQ.js +0 -1
- package/ui-dist/assets/x-CxanI1fH.js +0 -1
- /package/ui-dist/assets/{config-hints-fDrYfl0l.js → config-hints-MogHYQ8G.js} +0 -0
package/dist/cli/app/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as
|
|
2
|
+
import { _ as resolveUiConfig, a as compareNpmRuntimeVersions, c as getPackageVersion$1, d as openBrowser, f as printAgentResponse, g as resolveUiApiBase, h as resolveServiceLogPath, i as NpmRuntimeBundleService, l as isLoopbackHost, m as resolvePublicIp, n as NpmRuntimeUpdateSourceService, o as NpmRuntimeBundleLayoutStore, p as prompt, s as findExecutableOnPath, t as NpmRuntimeUpdateStateStore, u as isProcessRunning, v as resolveUiStaticDir, y as waitForExit } from "../../npm-runtime-update-state.store-BwM_B6eP.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NextclawCore from "@nextclaw/core";
|
|
5
5
|
import { APP_NAME, APP_TAGLINE, AgentRouteResolver, BUILTIN_MAIN_AGENT_ID, ChannelManager, CommandRegistry, ConfigSchema, ContextBuilder, CronService, CronTool, DEFAULT_WORKSPACE_DIR, DEFAULT_WORKSPACE_PATH, DisposableStore, EditFileTool, ExecTool, ExtensionToolAdapter, FileLogSink, GatewayTool, InputBudgetPruner, LLMProvider, ListDirTool, MemoryGetTool, MemorySearchTool, MessageBus, MessageTool, ProviderManager, ReadFileTool, RequestedSkillsMetadataReader, SessionManager, SessionsHistoryTool, SessionsListTool, SkillsLoader, Tool, ToolRegistry, WebFetchTool, WebSearchTool, WriteFileTool, buildConfigSchema, buildMinimalSystemExecutionPrompt, buildReloadPlan, buildToolCatalogEntries, createAgentProfile, createAssistantStreamDeltaControlMessage, createAssistantStreamResetControlMessage, createGlobalTypedEventBus, createTypedEventKey, createTypingStopControlMessage, diffConfigPaths, expandHome, findEffectiveAgentProfile, getAppLogger, getConfigPath, getDataDir, getDataPath, getLoggingRuntime, getWorkspacePath, hasSecretRef, loadConfig, normalizeInlineSecretRefs, parseAgentScopedSessionKey, parseThinkingLevel, readSessionProjectRoot, redactConfigObject, removeAgentProfile, resolveAppLogPath, resolveConfigSecrets, resolveDefaultAgentProfileId, resolveEffectiveAgentProfiles, resolveLocalUiBaseUrl, resolveProviderRuntime, resolveSessionWorkspacePath, resolveThinkingLevel, saveConfig, toDisposable, updateAgentProfile } from "@nextclaw/core";
|
|
@@ -168,7 +168,7 @@ function maskToken(value) {
|
|
|
168
168
|
if (value.length <= 12) return "<redacted>";
|
|
169
169
|
return `${value.slice(0, 6)}...${value.slice(-4)}`;
|
|
170
170
|
}
|
|
171
|
-
function normalizeOptionalString$
|
|
171
|
+
function normalizeOptionalString$9(value) {
|
|
172
172
|
if (typeof value !== "string") return;
|
|
173
173
|
const trimmed = value.trim();
|
|
174
174
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -266,8 +266,8 @@ var RemotePlatformClient = class {
|
|
|
266
266
|
if (tokenState.reason === "missing") throw new Error("NextClaw platform token is missing. Run \"nextclaw login\" first.");
|
|
267
267
|
if (tokenState.reason === "expired") throw new Error("NextClaw platform token expired. Run \"nextclaw login\" or browser sign-in again.");
|
|
268
268
|
if (tokenState.reason === "malformed") throw new Error("NextClaw platform token is invalid. Run \"nextclaw login\" again.");
|
|
269
|
-
const configuredApiBase = normalizeOptionalString$
|
|
270
|
-
const rawApiBase = normalizeOptionalString$
|
|
269
|
+
const configuredApiBase = normalizeOptionalString$9(config.remote.platformApiBase) ?? (typeof nextclawProvider?.apiBase === "string" ? nextclawProvider.apiBase.trim() : "");
|
|
270
|
+
const rawApiBase = normalizeOptionalString$9(opts.apiBase) ?? configuredApiBase;
|
|
271
271
|
if (!rawApiBase) throw new Error("Platform API base is missing. Pass --api-base, run nextclaw login, or set remote.platformApiBase.");
|
|
272
272
|
return {
|
|
273
273
|
platformBase: this.deps.resolvePlatformBase(rawApiBase),
|
|
@@ -276,14 +276,14 @@ var RemotePlatformClient = class {
|
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
278
|
resolveLocalOrigin(config, opts) {
|
|
279
|
-
const explicitOrigin = normalizeOptionalString$
|
|
279
|
+
const explicitOrigin = normalizeOptionalString$9(opts.localOrigin);
|
|
280
280
|
if (explicitOrigin) return explicitOrigin.replace(/\/$/, "");
|
|
281
281
|
const state = this.deps.readManagedServiceState?.();
|
|
282
282
|
if (state && this.deps.isProcessRunning?.(state.pid) && Number.isFinite(state.uiPort)) return `http://127.0.0.1:${state.uiPort}`;
|
|
283
283
|
return `http://127.0.0.1:${typeof config.ui?.port === "number" && Number.isFinite(config.ui.port) ? config.ui.port : 55667}`;
|
|
284
284
|
}
|
|
285
285
|
resolveDisplayName(config, opts) {
|
|
286
|
-
return normalizeOptionalString$
|
|
286
|
+
return normalizeOptionalString$9(opts.name) ?? normalizeOptionalString$9(config.remote.deviceName) ?? hostname();
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
289
|
//#endregion
|
|
@@ -4493,7 +4493,7 @@ var RemoteConnector = class {
|
|
|
4493
4493
|
};
|
|
4494
4494
|
//#endregion
|
|
4495
4495
|
//#region ../nextclaw-remote/src/remote-status-store.ts
|
|
4496
|
-
function normalizeOptionalString$
|
|
4496
|
+
function normalizeOptionalString$8(value) {
|
|
4497
4497
|
if (typeof value !== "string") return;
|
|
4498
4498
|
const trimmed = value.trim();
|
|
4499
4499
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -4504,8 +4504,8 @@ function buildConfiguredRemoteState(config) {
|
|
|
4504
4504
|
enabled: Boolean(remote.enabled),
|
|
4505
4505
|
mode: "service",
|
|
4506
4506
|
state: remote.enabled ? "disconnected" : "disabled",
|
|
4507
|
-
...normalizeOptionalString$
|
|
4508
|
-
...normalizeOptionalString$
|
|
4507
|
+
...normalizeOptionalString$8(remote.deviceName) ? { deviceName: normalizeOptionalString$8(remote.deviceName) } : {},
|
|
4508
|
+
...normalizeOptionalString$8(remote.platformApiBase) ? { platformBase: normalizeOptionalString$8(remote.platformApiBase) } : {},
|
|
4509
4509
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4510
4510
|
};
|
|
4511
4511
|
}
|
|
@@ -4518,7 +4518,7 @@ function resolveRemoteStatusSnapshot(params) {
|
|
|
4518
4518
|
configuredEnabled: true,
|
|
4519
4519
|
runtime: {
|
|
4520
4520
|
...buildConfiguredRemoteState(params.config),
|
|
4521
|
-
deviceName: normalizeOptionalString$
|
|
4521
|
+
deviceName: normalizeOptionalString$8(params.config.remote.deviceName) ?? normalizeOptionalString$8(params.fallbackDeviceName) ?? hostname()
|
|
4522
4522
|
}
|
|
4523
4523
|
};
|
|
4524
4524
|
return {
|
|
@@ -5062,30 +5062,6 @@ function parseSessionKey(sessionKey) {
|
|
|
5062
5062
|
};
|
|
5063
5063
|
}
|
|
5064
5064
|
//#endregion
|
|
5065
|
-
//#region src/cli/shared/utils/runtime-helpers.ts
|
|
5066
|
-
function resolveSkillsInstallWorkdir(params) {
|
|
5067
|
-
if (params.explicitWorkdir) return expandHome(params.explicitWorkdir);
|
|
5068
|
-
return getWorkspacePath(params.configuredWorkspace);
|
|
5069
|
-
}
|
|
5070
|
-
function parseStartTimeoutMs(value) {
|
|
5071
|
-
if (value === void 0) return;
|
|
5072
|
-
const parsed = Number(value);
|
|
5073
|
-
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
5074
|
-
console.error("Invalid --start-timeout value. Provide milliseconds (e.g. 45000).");
|
|
5075
|
-
process.exit(1);
|
|
5076
|
-
}
|
|
5077
|
-
return Math.floor(parsed);
|
|
5078
|
-
}
|
|
5079
|
-
function resolveManagedServiceUiOverrides(params) {
|
|
5080
|
-
const uiOverrides = {
|
|
5081
|
-
enabled: true,
|
|
5082
|
-
host: params.forcedPublicHost,
|
|
5083
|
-
open: false
|
|
5084
|
-
};
|
|
5085
|
-
if (params.uiPort) uiOverrides.port = Number(params.uiPort);
|
|
5086
|
-
return uiOverrides;
|
|
5087
|
-
}
|
|
5088
|
-
//#endregion
|
|
5089
5065
|
//#region src/cli/shared/utils/startup-trace.ts
|
|
5090
5066
|
const STARTUP_TRACE_ENABLED = process.env.NEXTCLAW_STARTUP_TRACE === "1";
|
|
5091
5067
|
const STARTUP_TRACE_ORIGIN_MS = Date.now();
|
|
@@ -5467,49 +5443,6 @@ function readDirectoryNames(directory) {
|
|
|
5467
5443
|
return readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
5468
5444
|
}
|
|
5469
5445
|
//#endregion
|
|
5470
|
-
//#region src/cli/launcher/npm-runtime-update-source.service.ts
|
|
5471
|
-
const DEFAULT_NPM_RUNTIME_UPDATE_BASE_URL = "https://Peiiii.github.io/nextclaw/npm-runtime-updates";
|
|
5472
|
-
function normalizeOptionalString$8(value) {
|
|
5473
|
-
if (typeof value !== "string") return null;
|
|
5474
|
-
const trimmed = value.trim();
|
|
5475
|
-
return trimmed ? trimmed : null;
|
|
5476
|
-
}
|
|
5477
|
-
function normalizeChannel(value) {
|
|
5478
|
-
return typeof value === "string" && value.trim().toLowerCase() === "beta" ? "beta" : "stable";
|
|
5479
|
-
}
|
|
5480
|
-
function resolvePackagedPublicKeyPath() {
|
|
5481
|
-
return resolve(dirname(fileURLToPath(import.meta.url)), "../../..", "resources", "update-bundle-public.pem");
|
|
5482
|
-
}
|
|
5483
|
-
var NpmRuntimeUpdateSourceService = class {
|
|
5484
|
-
env;
|
|
5485
|
-
platform;
|
|
5486
|
-
arch;
|
|
5487
|
-
constructor(options = {}) {
|
|
5488
|
-
this.env = options.env ?? process.env;
|
|
5489
|
-
this.platform = options.platform ?? process.platform;
|
|
5490
|
-
this.arch = options.arch ?? process.arch;
|
|
5491
|
-
}
|
|
5492
|
-
resolveChannel = (explicitChannel) => {
|
|
5493
|
-
return normalizeChannel(explicitChannel ?? this.env.NEXTCLAW_UPDATE_CHANNEL);
|
|
5494
|
-
};
|
|
5495
|
-
resolveManifestUrl = (channel, explicitManifestUrl) => {
|
|
5496
|
-
const manifestUrl = normalizeOptionalString$8(explicitManifestUrl) ?? normalizeOptionalString$8(this.env.NEXTCLAW_UPDATE_MANIFEST_URL);
|
|
5497
|
-
if (manifestUrl) return manifestUrl;
|
|
5498
|
-
const baseUrl = normalizeOptionalString$8(this.env.NEXTCLAW_UPDATE_MANIFEST_BASE_URL) ?? DEFAULT_NPM_RUNTIME_UPDATE_BASE_URL;
|
|
5499
|
-
return new URL(`${channel}/manifest-${channel}-${this.platform}-${this.arch}.json`, `${baseUrl.replace(/\/+$/, "")}/`).toString();
|
|
5500
|
-
};
|
|
5501
|
-
resolveBundlePublicKey = () => {
|
|
5502
|
-
const explicitPublicKey = normalizeOptionalString$8(this.env.NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY);
|
|
5503
|
-
if (explicitPublicKey) return explicitPublicKey;
|
|
5504
|
-
const publicKeyPath = normalizeOptionalString$8(this.env.NEXTCLAW_UPDATE_BUNDLE_PUBLIC_KEY_PATH);
|
|
5505
|
-
if (!publicKeyPath || !existsSync(publicKeyPath)) {
|
|
5506
|
-
const packagedPublicKeyPath = resolvePackagedPublicKeyPath();
|
|
5507
|
-
return existsSync(packagedPublicKeyPath) ? readFileSync(packagedPublicKeyPath, "utf8").trim() : null;
|
|
5508
|
-
}
|
|
5509
|
-
return readFileSync(publicKeyPath, "utf8").trim();
|
|
5510
|
-
};
|
|
5511
|
-
};
|
|
5512
|
-
//#endregion
|
|
5513
5446
|
//#region src/cli/launcher/npm-runtime-update-command.service.ts
|
|
5514
5447
|
var NpmRuntimeUpdateCommandService = class {
|
|
5515
5448
|
run = async (opts) => {
|
|
@@ -5520,11 +5453,11 @@ var NpmRuntimeUpdateCommandService = class {
|
|
|
5520
5453
|
};
|
|
5521
5454
|
runManaged = async (opts) => {
|
|
5522
5455
|
const source = new NpmRuntimeUpdateSourceService();
|
|
5523
|
-
const
|
|
5456
|
+
const launcherVersion = getPackageVersion$1();
|
|
5457
|
+
const channel = source.resolveChannel(opts.channel, launcherVersion);
|
|
5524
5458
|
const manifestUrl = source.resolveManifestUrl(channel, opts.manifestUrl);
|
|
5525
5459
|
const layout = new NpmRuntimeBundleLayoutStore();
|
|
5526
|
-
const stateStore = new NpmRuntimeUpdateStateStore(layout.getStatePath());
|
|
5527
|
-
const launcherVersion = getPackageVersion$1();
|
|
5460
|
+
const stateStore = new NpmRuntimeUpdateStateStore(layout.getStatePath(), { defaultChannel: channel });
|
|
5528
5461
|
const bundleService = new NpmRuntimeBundleService({
|
|
5529
5462
|
layout,
|
|
5530
5463
|
stateStore,
|
|
@@ -14004,7 +13937,7 @@ var ServiceMarketplaceInstaller = class {
|
|
|
14004
13937
|
};
|
|
14005
13938
|
//#endregion
|
|
14006
13939
|
//#region src/cli/shared/utils/marketplace/cli-subcommand-launch.utils.ts
|
|
14007
|
-
const require$
|
|
13940
|
+
const require$3 = createRequire(import.meta.url);
|
|
14008
13941
|
const TYPESCRIPT_EXTENSIONS$1 = new Set([
|
|
14009
13942
|
".ts",
|
|
14010
13943
|
".tsx",
|
|
@@ -14012,7 +13945,7 @@ const TYPESCRIPT_EXTENSIONS$1 = new Set([
|
|
|
14012
13945
|
".cts"
|
|
14013
13946
|
]);
|
|
14014
13947
|
const isTypeScriptEntry = (entry) => TYPESCRIPT_EXTENSIONS$1.has(extname(entry).toLowerCase());
|
|
14015
|
-
const resolveTsxCliEntry = () => require$
|
|
13948
|
+
const resolveTsxCliEntry = () => require$3.resolve("tsx/cli");
|
|
14016
13949
|
const resolveCliAppEntryFromImportMeta$1 = (importMetaUrl) => {
|
|
14017
13950
|
const modulePath = fileURLToPath(importMetaUrl);
|
|
14018
13951
|
const cliRootIndex = modulePath.replace(/\\/g, "/").lastIndexOf("/cli/");
|
|
@@ -15199,6 +15132,169 @@ function createRemoteAccessHost(params) {
|
|
|
15199
15132
|
});
|
|
15200
15133
|
}
|
|
15201
15134
|
//#endregion
|
|
15135
|
+
//#region src/cli/shared/services/ui/npm-runtime-update-host.service.ts
|
|
15136
|
+
const INITIAL_DOWNLOAD_PROGRESS = {
|
|
15137
|
+
downloadedBytes: 0,
|
|
15138
|
+
totalBytes: null,
|
|
15139
|
+
percent: null
|
|
15140
|
+
};
|
|
15141
|
+
var NpmRuntimeUpdateHost = class {
|
|
15142
|
+
source = new NpmRuntimeUpdateSourceService();
|
|
15143
|
+
layout = new NpmRuntimeBundleLayoutStore();
|
|
15144
|
+
launcherVersion = getPackageVersion$1();
|
|
15145
|
+
stateStore = new NpmRuntimeUpdateStateStore(this.layout.getStatePath(), { defaultChannel: this.source.resolveChannel(void 0, this.launcherVersion) });
|
|
15146
|
+
bundleService = new NpmRuntimeBundleService({
|
|
15147
|
+
layout: this.layout,
|
|
15148
|
+
stateStore: this.stateStore,
|
|
15149
|
+
launcherVersion: this.launcherVersion
|
|
15150
|
+
});
|
|
15151
|
+
updateService = new NpmRuntimeUpdateService({
|
|
15152
|
+
layout: this.layout,
|
|
15153
|
+
bundleService: this.bundleService,
|
|
15154
|
+
launcherVersion: this.launcherVersion,
|
|
15155
|
+
bundlePublicKey: this.source.resolveBundlePublicKey() ?? void 0
|
|
15156
|
+
});
|
|
15157
|
+
snapshot;
|
|
15158
|
+
activeTask = null;
|
|
15159
|
+
automaticSyncStarted = false;
|
|
15160
|
+
constructor(deps) {
|
|
15161
|
+
this.deps = deps;
|
|
15162
|
+
this.snapshot = this.createManager().getSnapshot();
|
|
15163
|
+
this.startAutomaticSync();
|
|
15164
|
+
}
|
|
15165
|
+
getState = async () => {
|
|
15166
|
+
this.startAutomaticSync();
|
|
15167
|
+
return this.snapshot;
|
|
15168
|
+
};
|
|
15169
|
+
checkForUpdates = async () => {
|
|
15170
|
+
return this.startCheck({ autoDownload: false });
|
|
15171
|
+
};
|
|
15172
|
+
downloadUpdate = async () => {
|
|
15173
|
+
return this.startDownload();
|
|
15174
|
+
};
|
|
15175
|
+
applyDownloadedUpdate = async () => {
|
|
15176
|
+
if (this.activeTask) return this.snapshot;
|
|
15177
|
+
this.snapshot = {
|
|
15178
|
+
...this.snapshot,
|
|
15179
|
+
status: "applying",
|
|
15180
|
+
progress: null,
|
|
15181
|
+
errorMessage: null
|
|
15182
|
+
};
|
|
15183
|
+
try {
|
|
15184
|
+
this.snapshot = this.createManager().applyDownloadedUpdate();
|
|
15185
|
+
await requestManagedServiceRestart(this.deps.requestRestart, {
|
|
15186
|
+
reason: "runtime update apply",
|
|
15187
|
+
uiPort: this.deps.uiConfig.port
|
|
15188
|
+
});
|
|
15189
|
+
return this.snapshot;
|
|
15190
|
+
} catch (error) {
|
|
15191
|
+
this.snapshot = this.toFailedSnapshot(error);
|
|
15192
|
+
throw error;
|
|
15193
|
+
}
|
|
15194
|
+
};
|
|
15195
|
+
updatePreferences = async (preferences) => {
|
|
15196
|
+
const nextState = this.stateStore.update((current) => ({
|
|
15197
|
+
...current,
|
|
15198
|
+
updatePreferences: {
|
|
15199
|
+
...current.updatePreferences,
|
|
15200
|
+
...preferences
|
|
15201
|
+
}
|
|
15202
|
+
}));
|
|
15203
|
+
this.snapshot = this.createManager(nextState.channel).getSnapshot();
|
|
15204
|
+
if (nextState.updatePreferences.automaticChecks) this.startAutomaticSync({ force: true });
|
|
15205
|
+
return this.snapshot;
|
|
15206
|
+
};
|
|
15207
|
+
updateChannel = async (channel) => {
|
|
15208
|
+
const nextState = this.stateStore.update((current) => ({
|
|
15209
|
+
...current,
|
|
15210
|
+
channel
|
|
15211
|
+
}));
|
|
15212
|
+
this.snapshot = this.createManager(nextState.channel).getSnapshot();
|
|
15213
|
+
if (nextState.updatePreferences.automaticChecks) return this.startCheck({ autoDownload: nextState.updatePreferences.autoDownload });
|
|
15214
|
+
return this.snapshot;
|
|
15215
|
+
};
|
|
15216
|
+
startAutomaticSync = (options = {}) => {
|
|
15217
|
+
if (this.activeTask) return;
|
|
15218
|
+
if (this.automaticSyncStarted && !options.force) return;
|
|
15219
|
+
this.automaticSyncStarted = true;
|
|
15220
|
+
const state = this.stateStore.read();
|
|
15221
|
+
if (!state.updatePreferences.automaticChecks || state.downloadedVersion) return;
|
|
15222
|
+
this.startCheck({ autoDownload: state.updatePreferences.autoDownload });
|
|
15223
|
+
};
|
|
15224
|
+
startCheck = async (options) => {
|
|
15225
|
+
if (this.activeTask) return this.snapshot;
|
|
15226
|
+
this.snapshot = {
|
|
15227
|
+
...this.createManager().getSnapshot(),
|
|
15228
|
+
status: "checking",
|
|
15229
|
+
progress: null,
|
|
15230
|
+
errorMessage: null
|
|
15231
|
+
};
|
|
15232
|
+
this.activeTask = (async () => {
|
|
15233
|
+
try {
|
|
15234
|
+
const checkedSnapshot = await this.createManager().checkForUpdate();
|
|
15235
|
+
this.snapshot = checkedSnapshot;
|
|
15236
|
+
if (options.autoDownload && checkedSnapshot.status === "update-available") await this.runDownloadTask();
|
|
15237
|
+
} catch (error) {
|
|
15238
|
+
this.snapshot = this.toFailedSnapshot(error);
|
|
15239
|
+
} finally {
|
|
15240
|
+
this.activeTask = null;
|
|
15241
|
+
}
|
|
15242
|
+
})();
|
|
15243
|
+
return this.snapshot;
|
|
15244
|
+
};
|
|
15245
|
+
startDownload = async () => {
|
|
15246
|
+
if (this.activeTask) return this.snapshot;
|
|
15247
|
+
this.snapshot = {
|
|
15248
|
+
...this.createManager().getSnapshot(),
|
|
15249
|
+
status: "downloading",
|
|
15250
|
+
progress: INITIAL_DOWNLOAD_PROGRESS,
|
|
15251
|
+
errorMessage: null
|
|
15252
|
+
};
|
|
15253
|
+
this.activeTask = (async () => {
|
|
15254
|
+
try {
|
|
15255
|
+
await this.runDownloadTask();
|
|
15256
|
+
} catch (error) {
|
|
15257
|
+
this.snapshot = this.toFailedSnapshot(error);
|
|
15258
|
+
} finally {
|
|
15259
|
+
this.activeTask = null;
|
|
15260
|
+
}
|
|
15261
|
+
})();
|
|
15262
|
+
return this.snapshot;
|
|
15263
|
+
};
|
|
15264
|
+
runDownloadTask = async () => {
|
|
15265
|
+
this.snapshot = await this.createManager().downloadUpdate((progress) => {
|
|
15266
|
+
this.snapshot = {
|
|
15267
|
+
...this.snapshot,
|
|
15268
|
+
status: "downloading",
|
|
15269
|
+
progress,
|
|
15270
|
+
errorMessage: null
|
|
15271
|
+
};
|
|
15272
|
+
});
|
|
15273
|
+
};
|
|
15274
|
+
createManager = (channel = this.stateStore.read().channel) => {
|
|
15275
|
+
return new NpmRuntimeUpdateManager({
|
|
15276
|
+
layout: this.layout,
|
|
15277
|
+
stateStore: this.stateStore,
|
|
15278
|
+
bundleService: this.bundleService,
|
|
15279
|
+
updateService: this.updateService,
|
|
15280
|
+
resolveManifestUrl: (resolvedChannel) => this.source.resolveManifestUrl(resolvedChannel),
|
|
15281
|
+
launcherVersion: this.launcherVersion,
|
|
15282
|
+
channel
|
|
15283
|
+
});
|
|
15284
|
+
};
|
|
15285
|
+
toFailedSnapshot = (error) => {
|
|
15286
|
+
return {
|
|
15287
|
+
...this.createManager().getSnapshot(),
|
|
15288
|
+
status: "failed",
|
|
15289
|
+
progress: null,
|
|
15290
|
+
errorMessage: error instanceof Error ? error.message : String(error ?? "Unknown error")
|
|
15291
|
+
};
|
|
15292
|
+
};
|
|
15293
|
+
};
|
|
15294
|
+
function createNpmRuntimeUpdateHost(params) {
|
|
15295
|
+
return new NpmRuntimeUpdateHost(params);
|
|
15296
|
+
}
|
|
15297
|
+
//#endregion
|
|
15202
15298
|
//#region src/cli/shared/stores/pending-restart.store.ts
|
|
15203
15299
|
const clonePendingRestartState = (state) => {
|
|
15204
15300
|
if (!state) return null;
|
|
@@ -15320,12 +15416,17 @@ function createRuntimeControlHost(params) {
|
|
|
15320
15416
|
//#endregion
|
|
15321
15417
|
//#region src/cli/shared/services/ui/service-ui-hosts.service.ts
|
|
15322
15418
|
function createServiceUiHosts(params) {
|
|
15419
|
+
const { requestRestart, serviceCommands, uiConfig } = params;
|
|
15323
15420
|
return {
|
|
15324
15421
|
remoteAccess: createRemoteAccessHost(params),
|
|
15325
15422
|
runtimeControl: createRuntimeControlHost({
|
|
15326
|
-
serviceCommands
|
|
15327
|
-
requestRestart
|
|
15328
|
-
uiConfig
|
|
15423
|
+
serviceCommands,
|
|
15424
|
+
requestRestart,
|
|
15425
|
+
uiConfig
|
|
15426
|
+
}),
|
|
15427
|
+
runtimeUpdate: process.env.NEXTCLAW_DISABLE_RUNTIME_UPDATE_HOST === "1" ? void 0 : createNpmRuntimeUpdateHost({
|
|
15428
|
+
requestRestart,
|
|
15429
|
+
uiConfig
|
|
15329
15430
|
})
|
|
15330
15431
|
};
|
|
15331
15432
|
}
|
|
@@ -15665,6 +15766,9 @@ var ConfigReloader = class {
|
|
|
15665
15766
|
setReloadMcp(callback) {
|
|
15666
15767
|
this.options.reloadMcp = callback;
|
|
15667
15768
|
}
|
|
15769
|
+
setReloadCompanion(callback) {
|
|
15770
|
+
this.options.reloadCompanion = callback;
|
|
15771
|
+
}
|
|
15668
15772
|
async applyReloadPlan(nextConfig) {
|
|
15669
15773
|
const changedPaths = diffConfigPaths(this.currentConfig, nextConfig);
|
|
15670
15774
|
if (!changedPaths.length) return;
|
|
@@ -15686,6 +15790,13 @@ var ConfigReloader = class {
|
|
|
15686
15790
|
});
|
|
15687
15791
|
console.log("Config reload: MCP servers reloaded.");
|
|
15688
15792
|
}
|
|
15793
|
+
if (plan.reloadCompanion) {
|
|
15794
|
+
await this.reloadCompanion({
|
|
15795
|
+
config: nextConfig,
|
|
15796
|
+
changedPaths
|
|
15797
|
+
});
|
|
15798
|
+
console.log("Config reload: companion setting applied.");
|
|
15799
|
+
}
|
|
15689
15800
|
if (plan.restartChannels || reloadPluginsResult?.restartChannels) {
|
|
15690
15801
|
await this.reloadChannels(nextConfig, { start: true });
|
|
15691
15802
|
console.log("Config reload: channels restarted.");
|
|
@@ -15781,6 +15892,10 @@ var ConfigReloader = class {
|
|
|
15781
15892
|
if (!this.options.reloadMcp) return;
|
|
15782
15893
|
await this.options.reloadMcp(params);
|
|
15783
15894
|
}
|
|
15895
|
+
async reloadCompanion(params) {
|
|
15896
|
+
if (!this.options.reloadCompanion) return;
|
|
15897
|
+
await this.options.reloadCompanion(params);
|
|
15898
|
+
}
|
|
15784
15899
|
};
|
|
15785
15900
|
//#endregion
|
|
15786
15901
|
//#region src/cli/shared/services/gateway/cron-job-handler.service.ts
|
|
@@ -16161,7 +16276,7 @@ function createSystemSessionUpdatedPublisher(params) {
|
|
|
16161
16276
|
}
|
|
16162
16277
|
async function startUiShell(params) {
|
|
16163
16278
|
logStartupTrace("service.start_ui_shell.begin");
|
|
16164
|
-
const { applyLiveConfigReload, configPath, cronService, getBootstrapStatus, getPluginChannelBindings, getPluginUiMetadata, initializeAgentHomeDirectory, marketplace, ncpSessionService, openBrowserWindow, productVersion, remoteAccess, runtimeControl, uiConfig, uiStaticDir } = params;
|
|
16279
|
+
const { applyLiveConfigReload, configPath, cronService, getBootstrapStatus, getPluginChannelBindings, getPluginUiMetadata, initializeAgentHomeDirectory, marketplace, ncpSessionService, openBrowserWindow, productVersion, remoteAccess, runtimeControl, runtimeUpdate, uiConfig, uiStaticDir } = params;
|
|
16165
16280
|
if (!uiConfig.enabled) return null;
|
|
16166
16281
|
let publishUiEvent = null;
|
|
16167
16282
|
const deferredNcpAgent = createDeferredUiNcpAgent();
|
|
@@ -16177,6 +16292,7 @@ async function startUiShell(params) {
|
|
|
16177
16292
|
marketplace,
|
|
16178
16293
|
remoteAccess,
|
|
16179
16294
|
runtimeControl,
|
|
16295
|
+
runtimeUpdate,
|
|
16180
16296
|
getBootstrapStatus,
|
|
16181
16297
|
getPluginChannelBindings,
|
|
16182
16298
|
getPluginUiMetadata,
|
|
@@ -16962,6 +17078,165 @@ async function cleanupGatewayRuntime(params) {
|
|
|
16962
17078
|
setPluginRuntimeBridge(null);
|
|
16963
17079
|
}
|
|
16964
17080
|
//#endregion
|
|
17081
|
+
//#region src/cli/shared/stores/companion-runtime.store.ts
|
|
17082
|
+
var CompanionRuntimeStore = class {
|
|
17083
|
+
get path() {
|
|
17084
|
+
return resolve(getDataDir(), "run", "companion.json");
|
|
17085
|
+
}
|
|
17086
|
+
read = () => {
|
|
17087
|
+
if (!existsSync(this.path)) return null;
|
|
17088
|
+
try {
|
|
17089
|
+
return JSON.parse(readFileSync(this.path, "utf-8"));
|
|
17090
|
+
} catch {
|
|
17091
|
+
return null;
|
|
17092
|
+
}
|
|
17093
|
+
};
|
|
17094
|
+
write = (state) => {
|
|
17095
|
+
mkdirSync(resolve(this.path, ".."), { recursive: true });
|
|
17096
|
+
writeFileSync(this.path, JSON.stringify(state, null, 2));
|
|
17097
|
+
};
|
|
17098
|
+
clear = () => {
|
|
17099
|
+
if (existsSync(this.path)) rmSync(this.path, { force: true });
|
|
17100
|
+
};
|
|
17101
|
+
};
|
|
17102
|
+
const companionRuntimeStore = new CompanionRuntimeStore();
|
|
17103
|
+
//#endregion
|
|
17104
|
+
//#region src/cli/shared/services/ui/companion-runtime.service.ts
|
|
17105
|
+
const require$2 = createRequire(import.meta.url);
|
|
17106
|
+
var CompanionRuntimeService = class {
|
|
17107
|
+
constructor(runtimeStore = companionRuntimeStore, uiDiscoveryService = localUiDiscoveryService) {
|
|
17108
|
+
this.runtimeStore = runtimeStore;
|
|
17109
|
+
this.uiDiscoveryService = uiDiscoveryService;
|
|
17110
|
+
}
|
|
17111
|
+
getRunningState = () => {
|
|
17112
|
+
const state = this.runtimeStore.read();
|
|
17113
|
+
if (!state) return null;
|
|
17114
|
+
if (!isProcessRunning(state.pid)) {
|
|
17115
|
+
this.runtimeStore.clear();
|
|
17116
|
+
return null;
|
|
17117
|
+
}
|
|
17118
|
+
return state;
|
|
17119
|
+
};
|
|
17120
|
+
resolveDiscoveredBaseUrl = () => {
|
|
17121
|
+
return this.uiDiscoveryService.resolveApiBase();
|
|
17122
|
+
};
|
|
17123
|
+
applyConfig = async (config) => {
|
|
17124
|
+
if (!config.companion.enabled) {
|
|
17125
|
+
await this.ensureStopped();
|
|
17126
|
+
return;
|
|
17127
|
+
}
|
|
17128
|
+
await this.ensureStarted({ baseUrl: this.uiDiscoveryService.resolveLocalOrigin(config) });
|
|
17129
|
+
};
|
|
17130
|
+
updateEnabled = async (enabled, options = {}) => {
|
|
17131
|
+
const config = loadConfig(getConfigPath());
|
|
17132
|
+
const next = {
|
|
17133
|
+
...config,
|
|
17134
|
+
companion: {
|
|
17135
|
+
...config.companion,
|
|
17136
|
+
enabled
|
|
17137
|
+
}
|
|
17138
|
+
};
|
|
17139
|
+
saveConfig(next, getConfigPath());
|
|
17140
|
+
if (enabled) {
|
|
17141
|
+
const explicitBaseUrl = options.baseUrl?.trim();
|
|
17142
|
+
if (explicitBaseUrl) {
|
|
17143
|
+
await this.ensureStarted({ baseUrl: explicitBaseUrl });
|
|
17144
|
+
return next;
|
|
17145
|
+
}
|
|
17146
|
+
const discoveredBaseUrl = this.uiDiscoveryService.resolveApiBase();
|
|
17147
|
+
if (discoveredBaseUrl) await this.ensureStarted({ baseUrl: discoveredBaseUrl });
|
|
17148
|
+
return next;
|
|
17149
|
+
}
|
|
17150
|
+
await this.ensureStopped();
|
|
17151
|
+
return next;
|
|
17152
|
+
};
|
|
17153
|
+
ensureStarted = async (options) => {
|
|
17154
|
+
const baseUrl = options.baseUrl.trim().replace(/\/+$/, "");
|
|
17155
|
+
const runningState = this.getRunningState();
|
|
17156
|
+
if (runningState?.baseUrl === baseUrl) return runningState;
|
|
17157
|
+
if (runningState) {
|
|
17158
|
+
this.killProcess(runningState.pid, false);
|
|
17159
|
+
this.runtimeStore.clear();
|
|
17160
|
+
}
|
|
17161
|
+
const launchSpec = this.resolveLaunchSpec();
|
|
17162
|
+
const child = spawn(launchSpec.command, [
|
|
17163
|
+
...launchSpec.args,
|
|
17164
|
+
"--base-url",
|
|
17165
|
+
baseUrl
|
|
17166
|
+
], {
|
|
17167
|
+
detached: true,
|
|
17168
|
+
stdio: "ignore",
|
|
17169
|
+
env: {
|
|
17170
|
+
...process.env,
|
|
17171
|
+
NEXTCLAW_COMPANION_RUNTIME_STATE_PATH: this.runtimeStore.path
|
|
17172
|
+
}
|
|
17173
|
+
});
|
|
17174
|
+
child.unref();
|
|
17175
|
+
return await this.waitForRunningState(baseUrl, child.pid ?? -1);
|
|
17176
|
+
};
|
|
17177
|
+
ensureStopped = async (options = {}) => {
|
|
17178
|
+
const state = this.runtimeStore.read();
|
|
17179
|
+
if (!state) return false;
|
|
17180
|
+
if (!isProcessRunning(state.pid)) {
|
|
17181
|
+
this.runtimeStore.clear();
|
|
17182
|
+
return false;
|
|
17183
|
+
}
|
|
17184
|
+
this.killProcess(state.pid, options.force === true);
|
|
17185
|
+
this.runtimeStore.clear();
|
|
17186
|
+
return true;
|
|
17187
|
+
};
|
|
17188
|
+
printStatus = (options = {}) => {
|
|
17189
|
+
const runningState = this.getRunningState();
|
|
17190
|
+
const config = loadConfig(getConfigPath());
|
|
17191
|
+
const view = runningState ? {
|
|
17192
|
+
configuredEnabled: config.companion.enabled,
|
|
17193
|
+
running: true,
|
|
17194
|
+
...runningState
|
|
17195
|
+
} : {
|
|
17196
|
+
configuredEnabled: config.companion.enabled,
|
|
17197
|
+
running: false
|
|
17198
|
+
};
|
|
17199
|
+
if (options.json) {
|
|
17200
|
+
console.log(JSON.stringify(view, null, 2));
|
|
17201
|
+
return;
|
|
17202
|
+
}
|
|
17203
|
+
if (!runningState) {
|
|
17204
|
+
console.log(config.companion.enabled ? "Companion is enabled in config but is not running." : "Companion is disabled and not running.");
|
|
17205
|
+
return;
|
|
17206
|
+
}
|
|
17207
|
+
console.log(`Companion is running (pid ${runningState.pid}) at ${runningState.baseUrl}. Configured enabled: ${config.companion.enabled ? "yes" : "no"}.`);
|
|
17208
|
+
};
|
|
17209
|
+
printStarted = (state) => {
|
|
17210
|
+
console.log(`Started ${APP_NAME} companion (pid ${state.pid}) using ${state.baseUrl}.`);
|
|
17211
|
+
};
|
|
17212
|
+
printStopped = (stopped) => {
|
|
17213
|
+
console.log(stopped ? "Stopped companion process." : "Companion is not running.");
|
|
17214
|
+
};
|
|
17215
|
+
killProcess = (pid, force) => {
|
|
17216
|
+
process.kill(pid, force ? "SIGKILL" : "SIGTERM");
|
|
17217
|
+
};
|
|
17218
|
+
resolveLaunchSpec = () => {
|
|
17219
|
+
const packageJsonPath = require$2.resolve("@nextclaw/companion/package.json");
|
|
17220
|
+
const packageRoot = dirname(packageJsonPath);
|
|
17221
|
+
const mainPath = resolve(packageRoot, "dist", "src", "main.js");
|
|
17222
|
+
if (!existsSync(mainPath)) throw new Error(`Companion app build is missing at ${mainPath}. Build @nextclaw/companion first.`);
|
|
17223
|
+
return {
|
|
17224
|
+
command: createRequire(packageJsonPath)("electron"),
|
|
17225
|
+
args: [packageRoot]
|
|
17226
|
+
};
|
|
17227
|
+
};
|
|
17228
|
+
waitForRunningState = async (baseUrl, fallbackPid) => {
|
|
17229
|
+
const timeoutAt = Date.now() + 5e3;
|
|
17230
|
+
while (Date.now() < timeoutAt) {
|
|
17231
|
+
const state = this.getRunningState();
|
|
17232
|
+
if (state?.baseUrl === baseUrl) return state;
|
|
17233
|
+
await new Promise((resolvePromise) => setTimeout(resolvePromise, 100));
|
|
17234
|
+
}
|
|
17235
|
+
throw new Error(fallbackPid > 0 ? `Companion started but did not report a live runtime state (launcher pid ${fallbackPid}).` : "Companion started but did not report a live runtime state.");
|
|
17236
|
+
};
|
|
17237
|
+
};
|
|
17238
|
+
const companionRuntimeService = new CompanionRuntimeService();
|
|
17239
|
+
//#endregion
|
|
16965
17240
|
//#region src/cli/shared/services/runtime/runtime-command.service.ts
|
|
16966
17241
|
const { getApiBase, getConfigPath: getConfigPath$1, getProvider, getProviderName, getWorkspacePath: getWorkspacePath$1, loadConfig: loadConfig$1, LiteLLMProvider, MessageBus: MessageBus$1, resolveConfigSecrets: resolveConfigSecrets$1, SessionManager: SessionManager$1, parseAgentScopedSessionKey: parseAgentScopedSessionKey$1 } = NextclawCore;
|
|
16967
17242
|
function createSkillsLoader(workspace) {
|
|
@@ -17008,38 +17283,16 @@ var RuntimeCommandService = class {
|
|
|
17008
17283
|
runCliSubcommand: (args) => this.runCliSubcommand(args),
|
|
17009
17284
|
installBuiltinSkill: (slug, force) => this.installBuiltinMarketplaceSkill(slug, force)
|
|
17010
17285
|
}).createInstaller();
|
|
17011
|
-
const
|
|
17012
|
-
|
|
17013
|
-
requestRestart: this.deps.requestRestart,
|
|
17014
|
-
uiConfig: shellContext.uiConfig,
|
|
17015
|
-
remoteModule: shellContext.remoteModule
|
|
17016
|
-
});
|
|
17017
|
-
const uiStartup = await measureStartupAsync("service.start_ui_shell", async () => await startUiShell({
|
|
17018
|
-
uiConfig: shellContext.uiConfig,
|
|
17019
|
-
uiStaticDir: shellContext.uiStaticDir,
|
|
17020
|
-
cronService: shellContext.cron,
|
|
17021
|
-
getConfig: getRuntimeConfig,
|
|
17022
|
-
configPath: getConfigPath$1(),
|
|
17023
|
-
productVersion: getPackageVersion$1(),
|
|
17024
|
-
getPluginChannelBindings: () => runtimeState?.pluginChannelBindings ?? [],
|
|
17025
|
-
getPluginUiMetadata: () => runtimeState?.pluginUiMetadata ?? [],
|
|
17026
|
-
marketplace: {
|
|
17027
|
-
apiBaseUrl: process.env.NEXTCLAW_MARKETPLACE_API_BASE,
|
|
17028
|
-
installer: marketplaceInstaller
|
|
17029
|
-
},
|
|
17030
|
-
remoteAccess,
|
|
17031
|
-
runtimeControl,
|
|
17032
|
-
getBootstrapStatus: () => bootstrapStatus.getStatus(),
|
|
17033
|
-
openBrowserWindow: shellContext.uiConfig.open,
|
|
17286
|
+
const uiStartup = await this.startGatewayUiShell({
|
|
17287
|
+
shellContext,
|
|
17034
17288
|
applyLiveConfigReload,
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
|
|
17039
|
-
|
|
17040
|
-
setUiEventPublisher: (publish) => ncpSessionRealtimeBridge.setUiEventPublisher(publish),
|
|
17041
|
-
uiConfig: shellContext.uiConfig
|
|
17289
|
+
bootstrapStatus,
|
|
17290
|
+
marketplaceInstaller,
|
|
17291
|
+
ncpSessionRealtimeBridge,
|
|
17292
|
+
getRuntimeConfig,
|
|
17293
|
+
getRuntimeState: () => runtimeState
|
|
17042
17294
|
});
|
|
17295
|
+
await companionRuntimeService.applyConfig(shellContext.config);
|
|
17043
17296
|
bootstrapStatus.markShellReady();
|
|
17044
17297
|
await setImmediate$1();
|
|
17045
17298
|
const gateway = measureStartupSync("service.create_gateway_startup_context", () => createGatewayStartupContext({
|
|
@@ -17057,33 +17310,14 @@ var RuntimeCommandService = class {
|
|
|
17057
17310
|
const loadGatewayConfig = () => resolveConfigSecrets$1(loadConfig$1(), { configPath: gateway.runtimeConfigPath });
|
|
17058
17311
|
const gatewayRuntimeState = createGatewayRuntimeState(gateway);
|
|
17059
17312
|
runtimeState = gatewayRuntimeState;
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
payload: { path: "channels" }
|
|
17063
|
-
});
|
|
17064
|
-
uiStartup?.publish({
|
|
17065
|
-
type: "config.updated",
|
|
17066
|
-
payload: { path: "plugins" }
|
|
17313
|
+
gateway.reloader.setReloadCompanion(async ({ config: nextConfig }) => {
|
|
17314
|
+
await companionRuntimeService.applyConfig(nextConfig);
|
|
17067
17315
|
});
|
|
17068
|
-
|
|
17316
|
+
await this.hydrateGatewayRuntime({
|
|
17069
17317
|
gateway,
|
|
17070
|
-
|
|
17071
|
-
|
|
17318
|
+
gatewayRuntimeState,
|
|
17319
|
+
uiStartup
|
|
17072
17320
|
});
|
|
17073
|
-
console.log("✓ Capability hydration: scheduled in background");
|
|
17074
|
-
await measureStartupAsync("service.start_gateway_support_services", async () => await startGatewayRuntimeSupport({
|
|
17075
|
-
cronJobs: gateway.cron.status().jobs,
|
|
17076
|
-
remoteModule: gateway.remoteModule,
|
|
17077
|
-
watchConfigFile: () => watchServiceConfigFile({
|
|
17078
|
-
configPath: resolve(getConfigPath$1()),
|
|
17079
|
-
watcherRegistry: this.fileWatchers,
|
|
17080
|
-
scheduleReload: (reason) => gateway.reloader.scheduleReload(reason)
|
|
17081
|
-
}),
|
|
17082
|
-
startCron: () => gateway.cron.start(),
|
|
17083
|
-
cronStorePath: resolve(join(NextclawCore.getDataDir(), "cron", "jobs.json")),
|
|
17084
|
-
reloadCronStore: () => gateway.cron.reloadFromStore(),
|
|
17085
|
-
watcherRegistry: this.fileWatchers
|
|
17086
|
-
}));
|
|
17087
17321
|
const deferredGatewayStartupHooks = createDeferredGatewayStartupHooks({
|
|
17088
17322
|
uiStartup,
|
|
17089
17323
|
gateway,
|
|
@@ -17125,14 +17359,84 @@ var RuntimeCommandService = class {
|
|
|
17125
17359
|
this.applyLiveConfigReload = null;
|
|
17126
17360
|
this.liveUiNcpAgent = null;
|
|
17127
17361
|
},
|
|
17128
|
-
clearRealtimeBridge: () =>
|
|
17362
|
+
clearRealtimeBridge: () => {
|
|
17363
|
+
ncpSessionRealtimeBridge.clear();
|
|
17364
|
+
},
|
|
17129
17365
|
uiStartup,
|
|
17130
17366
|
remoteModule: gateway.remoteModule,
|
|
17131
17367
|
runtimeState
|
|
17132
17368
|
})
|
|
17133
17369
|
});
|
|
17370
|
+
await companionRuntimeService.ensureStopped();
|
|
17134
17371
|
logStartupTrace("service.start_gateway.end");
|
|
17135
17372
|
};
|
|
17373
|
+
startGatewayUiShell = async (params) => {
|
|
17374
|
+
const { applyLiveConfigReload, bootstrapStatus, getRuntimeConfig, getRuntimeState, marketplaceInstaller, ncpSessionRealtimeBridge, shellContext } = params;
|
|
17375
|
+
const { remoteAccess, runtimeControl, runtimeUpdate } = createServiceUiHosts({
|
|
17376
|
+
serviceCommands: this,
|
|
17377
|
+
requestRestart: this.deps.requestRestart,
|
|
17378
|
+
uiConfig: shellContext.uiConfig,
|
|
17379
|
+
remoteModule: shellContext.remoteModule
|
|
17380
|
+
});
|
|
17381
|
+
const uiStartup = await measureStartupAsync("service.start_ui_shell", async () => await startUiShell({
|
|
17382
|
+
uiConfig: shellContext.uiConfig,
|
|
17383
|
+
uiStaticDir: shellContext.uiStaticDir,
|
|
17384
|
+
cronService: shellContext.cron,
|
|
17385
|
+
getConfig: getRuntimeConfig,
|
|
17386
|
+
configPath: getConfigPath$1(),
|
|
17387
|
+
productVersion: getPackageVersion$1(),
|
|
17388
|
+
getPluginChannelBindings: () => getRuntimeState()?.pluginChannelBindings ?? [],
|
|
17389
|
+
getPluginUiMetadata: () => getRuntimeState()?.pluginUiMetadata ?? [],
|
|
17390
|
+
marketplace: {
|
|
17391
|
+
apiBaseUrl: process.env.NEXTCLAW_MARKETPLACE_API_BASE,
|
|
17392
|
+
installer: marketplaceInstaller
|
|
17393
|
+
},
|
|
17394
|
+
remoteAccess,
|
|
17395
|
+
runtimeControl,
|
|
17396
|
+
runtimeUpdate,
|
|
17397
|
+
getBootstrapStatus: () => bootstrapStatus.getStatus(),
|
|
17398
|
+
openBrowserWindow: shellContext.uiConfig.open,
|
|
17399
|
+
applyLiveConfigReload,
|
|
17400
|
+
ncpSessionService: ncpSessionRealtimeBridge.sessionService,
|
|
17401
|
+
initializeAgentHomeDirectory: this.deps.initializeAgentHomeDirectory
|
|
17402
|
+
}));
|
|
17403
|
+
finalizeLocalUiStartup({
|
|
17404
|
+
uiStartup,
|
|
17405
|
+
setUiEventPublisher: (publish) => ncpSessionRealtimeBridge.setUiEventPublisher(publish),
|
|
17406
|
+
uiConfig: shellContext.uiConfig
|
|
17407
|
+
});
|
|
17408
|
+
return uiStartup;
|
|
17409
|
+
};
|
|
17410
|
+
hydrateGatewayRuntime = async (params) => {
|
|
17411
|
+
const { gateway, gatewayRuntimeState, uiStartup } = params;
|
|
17412
|
+
uiStartup?.publish({
|
|
17413
|
+
type: "config.updated",
|
|
17414
|
+
payload: { path: "channels" }
|
|
17415
|
+
});
|
|
17416
|
+
uiStartup?.publish({
|
|
17417
|
+
type: "config.updated",
|
|
17418
|
+
payload: { path: "plugins" }
|
|
17419
|
+
});
|
|
17420
|
+
configureGatewayPluginRuntime({
|
|
17421
|
+
gateway,
|
|
17422
|
+
state: gatewayRuntimeState,
|
|
17423
|
+
getLiveUiNcpAgent: () => this.liveUiNcpAgent
|
|
17424
|
+
});
|
|
17425
|
+
console.log("✓ Capability hydration: scheduled in background");
|
|
17426
|
+
await measureStartupAsync("service.start_gateway_support_services", async () => await startGatewayRuntimeSupport({
|
|
17427
|
+
cronJobs: gateway.cron.status().jobs,
|
|
17428
|
+
remoteModule: gateway.remoteModule,
|
|
17429
|
+
watchConfigFile: () => watchServiceConfigFile({
|
|
17430
|
+
configPath: resolve(getConfigPath$1()),
|
|
17431
|
+
watcherRegistry: this.fileWatchers,
|
|
17432
|
+
scheduleReload: (reason) => gateway.reloader.scheduleReload(reason)
|
|
17433
|
+
}),
|
|
17434
|
+
startCron: () => gateway.cron.start(),
|
|
17435
|
+
cronStorePath: resolve(join(NextclawCore.getDataDir(), "cron", "jobs.json")),
|
|
17436
|
+
reloadCronStore: () => gateway.cron.reloadFromStore(),
|
|
17437
|
+
watcherRegistry: this.fileWatchers
|
|
17438
|
+
}));
|
|
17439
|
+
};
|
|
17136
17440
|
normalizeOptionalString = (value) => {
|
|
17137
17441
|
if (typeof value !== "string") return;
|
|
17138
17442
|
return value.trim() || void 0;
|
|
@@ -19035,6 +19339,30 @@ var RuntimeRestartRequestService = class {
|
|
|
19035
19339
|
};
|
|
19036
19340
|
};
|
|
19037
19341
|
//#endregion
|
|
19342
|
+
//#region src/cli/shared/utils/runtime-helpers.ts
|
|
19343
|
+
function resolveSkillsInstallWorkdir(params) {
|
|
19344
|
+
if (params.explicitWorkdir) return expandHome(params.explicitWorkdir);
|
|
19345
|
+
return getWorkspacePath(params.configuredWorkspace);
|
|
19346
|
+
}
|
|
19347
|
+
function parseStartTimeoutMs(value) {
|
|
19348
|
+
if (value === void 0) return;
|
|
19349
|
+
const parsed = Number(value);
|
|
19350
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
19351
|
+
console.error("Invalid --start-timeout value. Provide milliseconds (e.g. 45000).");
|
|
19352
|
+
process.exit(1);
|
|
19353
|
+
}
|
|
19354
|
+
return Math.floor(parsed);
|
|
19355
|
+
}
|
|
19356
|
+
function resolveManagedServiceUiOverrides(params) {
|
|
19357
|
+
const uiOverrides = {
|
|
19358
|
+
enabled: true,
|
|
19359
|
+
host: params.forcedPublicHost,
|
|
19360
|
+
open: false
|
|
19361
|
+
};
|
|
19362
|
+
if (params.uiPort) uiOverrides.port = Number(params.uiPort);
|
|
19363
|
+
return uiOverrides;
|
|
19364
|
+
}
|
|
19365
|
+
//#endregion
|
|
19038
19366
|
//#region src/cli/commands/skills/marketplace-command-options.utils.ts
|
|
19039
19367
|
function buildMarketplacePublishOptions(options) {
|
|
19040
19368
|
const { apiBaseUrl, author, description, dir, homepage, meta, name, packageName, publishedAt, scope, slug, sourceRepo, summary, tag, token, updatedAt } = options;
|
|
@@ -20127,6 +20455,74 @@ var StopCommands = class {
|
|
|
20127
20455
|
};
|
|
20128
20456
|
};
|
|
20129
20457
|
//#endregion
|
|
20458
|
+
//#region src/cli/commands/companion/services/companion-process.service.ts
|
|
20459
|
+
var CompanionProcessService = class {
|
|
20460
|
+
constructor(runtimeService = companionRuntimeService) {
|
|
20461
|
+
this.runtimeService = runtimeService;
|
|
20462
|
+
}
|
|
20463
|
+
start = async (options = {}) => {
|
|
20464
|
+
const state = await this.runtimeService.ensureStarted({ baseUrl: this.resolveBaseUrl(options) });
|
|
20465
|
+
this.runtimeService.printStarted(state);
|
|
20466
|
+
};
|
|
20467
|
+
status = async (options = {}) => {
|
|
20468
|
+
this.runtimeService.printStatus(options);
|
|
20469
|
+
};
|
|
20470
|
+
stop = async (options = {}) => {
|
|
20471
|
+
const stopped = await this.runtimeService.ensureStopped(options);
|
|
20472
|
+
this.runtimeService.printStopped(stopped);
|
|
20473
|
+
};
|
|
20474
|
+
enable = async (options = {}) => {
|
|
20475
|
+
const nextConfig = await this.runtimeService.updateEnabled(true, options);
|
|
20476
|
+
this.printConfigEnabled(nextConfig, options.baseUrl);
|
|
20477
|
+
};
|
|
20478
|
+
disable = async (_options = {}) => {
|
|
20479
|
+
const nextConfig = await this.runtimeService.updateEnabled(false);
|
|
20480
|
+
console.log(nextConfig.companion.enabled ? "Companion remains enabled." : "Companion feature disabled. It will stay off until you enable it again.");
|
|
20481
|
+
};
|
|
20482
|
+
resolveBaseUrl = (options) => {
|
|
20483
|
+
const explicitBaseUrl = options.baseUrl?.trim();
|
|
20484
|
+
if (explicitBaseUrl) return explicitBaseUrl.replace(/\/+$/, "");
|
|
20485
|
+
const discoveredBaseUrl = this.runtimeService.resolveDiscoveredBaseUrl();
|
|
20486
|
+
if (discoveredBaseUrl) return discoveredBaseUrl;
|
|
20487
|
+
const runningState = this.runtimeService.getRunningState();
|
|
20488
|
+
if (runningState) return runningState.baseUrl;
|
|
20489
|
+
throw new Error("Cannot resolve NextClaw UI base URL. Start NextClaw first or pass --base-url.");
|
|
20490
|
+
};
|
|
20491
|
+
printConfigEnabled = (config, baseUrl) => {
|
|
20492
|
+
if (this.runtimeService.getRunningState()) {
|
|
20493
|
+
console.log("Companion feature enabled and companion started.");
|
|
20494
|
+
return;
|
|
20495
|
+
}
|
|
20496
|
+
if (baseUrl?.trim()) {
|
|
20497
|
+
console.log("Companion feature enabled.");
|
|
20498
|
+
return;
|
|
20499
|
+
}
|
|
20500
|
+
console.log(config.companion.enabled ? "Companion feature enabled. It will auto-start the next time a local NextClaw runtime is available." : "Companion feature is not enabled.");
|
|
20501
|
+
};
|
|
20502
|
+
};
|
|
20503
|
+
//#endregion
|
|
20504
|
+
//#region src/cli/commands/companion/index.ts
|
|
20505
|
+
var CompanionCommands = class {
|
|
20506
|
+
constructor(companionProcessService = new CompanionProcessService()) {
|
|
20507
|
+
this.companionProcessService = companionProcessService;
|
|
20508
|
+
}
|
|
20509
|
+
start = async (options = {}) => {
|
|
20510
|
+
await this.companionProcessService.start(options);
|
|
20511
|
+
};
|
|
20512
|
+
enable = async (options = {}) => {
|
|
20513
|
+
await this.companionProcessService.enable(options);
|
|
20514
|
+
};
|
|
20515
|
+
disable = async (options = {}) => {
|
|
20516
|
+
await this.companionProcessService.disable(options);
|
|
20517
|
+
};
|
|
20518
|
+
status = async (options = {}) => {
|
|
20519
|
+
await this.companionProcessService.status(options);
|
|
20520
|
+
};
|
|
20521
|
+
stop = async (options = {}) => {
|
|
20522
|
+
await this.companionProcessService.stop(options);
|
|
20523
|
+
};
|
|
20524
|
+
};
|
|
20525
|
+
//#endregion
|
|
20130
20526
|
//#region src/cli/app/runtime.ts
|
|
20131
20527
|
const LOGO = "🤖";
|
|
20132
20528
|
const FORCED_PUBLIC_UI_HOST = "0.0.0.0";
|
|
@@ -20158,6 +20554,7 @@ var CliRuntime = class {
|
|
|
20158
20554
|
restartCommands;
|
|
20159
20555
|
serveCommands;
|
|
20160
20556
|
stopCommands;
|
|
20557
|
+
companionCommands;
|
|
20161
20558
|
constructor(options = {}) {
|
|
20162
20559
|
logStartupTrace("cli.runtime.constructor.begin");
|
|
20163
20560
|
this.logo = options.logo ?? "🤖";
|
|
@@ -20190,6 +20587,7 @@ var CliRuntime = class {
|
|
|
20190
20587
|
forcedPublicHost: FORCED_PUBLIC_UI_HOST
|
|
20191
20588
|
}));
|
|
20192
20589
|
this.stopCommands = measureStartupSync("cli.runtime.stop_commands", () => new StopCommands({ runtimeCommandService: this.runtimeCommandService }));
|
|
20590
|
+
this.companionCommands = measureStartupSync("cli.runtime.companion_commands", () => new CompanionCommands());
|
|
20193
20591
|
this.serviceCommands = measureStartupSync("cli.runtime.service_commands", () => new ServiceCommands());
|
|
20194
20592
|
this.configCommands = measureStartupSync("cli.runtime.config_commands", () => new ConfigCommands({ requestRestart: (params) => this.requestRestart(params) }));
|
|
20195
20593
|
this.mcpCommands = measureStartupSync("cli.runtime.mcp_commands", () => new McpCommands());
|
|
@@ -20422,6 +20820,21 @@ var CliRuntime = class {
|
|
|
20422
20820
|
stop = async () => {
|
|
20423
20821
|
await this.stopCommands.run();
|
|
20424
20822
|
};
|
|
20823
|
+
companionStart = async (opts = {}) => {
|
|
20824
|
+
await this.companionCommands.start(opts);
|
|
20825
|
+
};
|
|
20826
|
+
companionEnable = async (opts = {}) => {
|
|
20827
|
+
await this.companionCommands.enable(opts);
|
|
20828
|
+
};
|
|
20829
|
+
companionDisable = async (opts = {}) => {
|
|
20830
|
+
await this.companionCommands.disable(opts);
|
|
20831
|
+
};
|
|
20832
|
+
companionStatus = async (opts = {}) => {
|
|
20833
|
+
await this.companionCommands.status(opts);
|
|
20834
|
+
};
|
|
20835
|
+
companionStop = async (opts = {}) => {
|
|
20836
|
+
await this.companionCommands.stop(opts);
|
|
20837
|
+
};
|
|
20425
20838
|
agent = async (opts) => {
|
|
20426
20839
|
const configPath = getConfigPath();
|
|
20427
20840
|
const config = resolveConfigSecrets(loadConfig(), { configPath });
|
|
@@ -20594,6 +21007,16 @@ function registerAgentsCommands(program, runtime) {
|
|
|
20594
21007
|
agents.command("remove <agentId>").description("Remove an agent").option("--json", "Output JSON", false).action(async (agentId, opts) => runtime.agentsRemove(agentId, opts));
|
|
20595
21008
|
}
|
|
20596
21009
|
//#endregion
|
|
21010
|
+
//#region src/cli/app/register-companion-commands.ts
|
|
21011
|
+
function registerCompanionCommands(program, runtime) {
|
|
21012
|
+
const companion = program.command("companion").description("Manage the standalone NextClaw companion shell");
|
|
21013
|
+
companion.command("start").description("Start the companion shell in the background").option("--base-url <url>", "Explicit NextClaw UI base URL").action(async (opts) => runtime.companionStart(opts));
|
|
21014
|
+
companion.command("enable").description("Enable the companion feature and start it when a local runtime is available").option("--base-url <url>", "Explicit NextClaw UI base URL").action(async (opts) => runtime.companionEnable(opts));
|
|
21015
|
+
companion.command("disable").description("Disable the companion feature and stop any running companion process").action(async (opts) => runtime.companionDisable(opts));
|
|
21016
|
+
companion.command("status").description("Show companion process status").option("--json", "Output JSON", false).action(async (opts) => runtime.companionStatus(opts));
|
|
21017
|
+
companion.command("stop").description("Stop the companion process").option("--force", "Force kill the companion process", false).action(async (opts) => runtime.companionStop(opts));
|
|
21018
|
+
}
|
|
21019
|
+
//#endregion
|
|
20597
21020
|
//#region src/cli/app/service-command-registration.service.ts
|
|
20598
21021
|
const registerServiceCommands = ({ program, getServiceCommands }) => {
|
|
20599
21022
|
const service = program.command("service").description("Manage host service integrations");
|
|
@@ -20649,6 +21072,7 @@ program.command("start").description(`Start the ${APP_NAME} gateway + UI in the
|
|
|
20649
21072
|
program.command("restart").description(`Restart the ${APP_NAME} background service`).option("--ui-port <port>", "UI port").option("--start-timeout <ms>", "Maximum wait time for startup readiness in milliseconds").option("--open", "Open browser after restart", false).action(async (opts) => runtime.restart(opts));
|
|
20650
21073
|
program.command("serve").description(`Run the ${APP_NAME} gateway + UI in the foreground`).option("--ui-port <port>", "UI port").option("--open", "Open browser after start", false).action(async (opts) => runtime.serve(opts));
|
|
20651
21074
|
program.command("stop").description(`Stop the ${APP_NAME} background service`).action(async () => runtime.stop());
|
|
21075
|
+
registerCompanionCommands(program, runtime);
|
|
20652
21076
|
registerServiceCommands({
|
|
20653
21077
|
program,
|
|
20654
21078
|
getServiceCommands
|
|
@@ -20699,6 +21123,6 @@ const logs = program.command("logs").description("Inspect local runtime logs");
|
|
|
20699
21123
|
logs.command("path").description("Show local log file paths").action(() => runtime.logsPath());
|
|
20700
21124
|
logs.command("tail").description("Show recent local log entries").option("--lines <n>", "Number of lines to show", "40").option("--crash", "Tail crash.log instead of service.log", false).action((opts) => runtime.logsTail(opts));
|
|
20701
21125
|
program.command("usage").description("Show observed LLM usage snapshots, history, and prompt cache stats").option("--history", "Show recent usage history", false).option("--stats", "Show aggregated usage stats from local history", false).option("--limit <n>", "Maximum number of history records to show", "10").option("--json", "Output JSON", false).action(async (opts) => llmUsageCommands.show(opts));
|
|
20702
|
-
program.parseAsync(process.argv);
|
|
21126
|
+
await program.parseAsync(process.argv);
|
|
20703
21127
|
//#endregion
|
|
20704
21128
|
export {};
|