@nextclaw/service 0.1.17 → 0.1.18-beta.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/dist/cli/commands/agent/cli-agent-runner.utils.d.ts.map +1 -1
- package/dist/cli/commands/agent/cli-agent-runner.utils.js +9 -5
- package/dist/cli/commands/agent/cli-agent-runner.utils.js.map +1 -1
- package/dist/cli/commands/config/services/config-commands.service.d.ts +0 -2
- package/dist/cli/commands/config/services/config-commands.service.d.ts.map +1 -1
- package/dist/cli/commands/config/services/config-commands.service.js +7 -25
- package/dist/cli/commands/config/services/config-commands.service.js.map +1 -1
- package/dist/commands/channel/channel-config-view.utils.d.ts +7 -0
- package/dist/commands/channel/channel-config-view.utils.d.ts.map +1 -0
- package/dist/commands/channel/channel-config-view.utils.js +9 -0
- package/dist/commands/channel/channel-config-view.utils.js.map +1 -0
- package/dist/commands/channel/channel-list-view.service.d.ts +0 -4
- package/dist/commands/channel/channel-list-view.service.d.ts.map +1 -1
- package/dist/commands/channel/channel-list-view.service.js +6 -19
- package/dist/commands/channel/channel-list-view.service.js.map +1 -1
- package/dist/commands/channel/index.d.ts +1 -12
- package/dist/commands/channel/index.d.ts.map +1 -1
- package/dist/commands/channel/index.js +26 -160
- package/dist/commands/channel/index.js.map +1 -1
- package/dist/service-runtime.service.d.ts +0 -2
- package/dist/service-runtime.service.d.ts.map +1 -1
- package/dist/service-runtime.service.js +10 -28
- package/dist/service-runtime.service.js.map +1 -1
- package/dist/shared/services/gateway/managers/gateway-extension.manager.d.ts +23 -0
- package/dist/shared/services/gateway/managers/gateway-extension.manager.d.ts.map +1 -0
- package/dist/shared/services/gateway/managers/gateway-extension.manager.js +77 -0
- package/dist/shared/services/gateway/managers/gateway-extension.manager.js.map +1 -0
- package/dist/shared/services/gateway/nextclaw-app.service.d.ts.map +1 -1
- package/dist/shared/services/gateway/nextclaw-app.service.js +2 -3
- package/dist/shared/services/gateway/nextclaw-app.service.js.map +1 -1
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts +4 -5
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts.map +1 -1
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js +13 -38
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js.map +1 -1
- package/dist/shared/services/gateway/service-bootstrap-status.service.d.ts +9 -9
- package/dist/shared/services/gateway/service-bootstrap-status.service.d.ts.map +1 -1
- package/dist/shared/services/gateway/service-bootstrap-status.service.js +24 -24
- package/dist/shared/services/gateway/service-bootstrap-status.service.js.map +1 -1
- package/dist/shared/services/gateway/service-startup-support.service.d.ts +1 -9
- package/dist/shared/services/gateway/service-startup-support.service.d.ts.map +1 -1
- package/dist/shared/services/gateway/service-startup-support.service.js +1 -14
- package/dist/shared/services/gateway/service-startup-support.service.js.map +1 -1
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.d.ts +2 -2
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.d.ts.map +1 -1
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.js +7 -14
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.js.map +1 -1
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js +1 -1
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js.map +1 -1
- package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts +0 -4
- package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts.map +1 -1
- package/dist/shared/services/marketplace/service-marketplace-installer.service.js +0 -27
- package/dist/shared/services/marketplace/service-marketplace-installer.service.js.map +1 -1
- package/dist/shared/services/workspace/workspace-manager.service.d.ts +0 -7
- package/dist/shared/services/workspace/workspace-manager.service.d.ts.map +1 -1
- package/dist/shared/services/workspace/workspace-manager.service.js +2 -50
- package/dist/shared/services/workspace/workspace-manager.service.js.map +1 -1
- package/package.json +33 -20
- package/dist/commands/channel/channel-config-view.d.ts +0 -8
- package/dist/commands/channel/channel-config-view.d.ts.map +0 -1
- package/dist/commands/channel/channel-config-view.js +0 -9
- package/dist/commands/channel/channel-config-view.js.map +0 -1
- package/dist/commands/plugin/index.d.ts +0 -29
- package/dist/commands/plugin/index.d.ts.map +0 -1
- package/dist/commands/plugin/index.js +0 -256
- package/dist/commands/plugin/index.js.map +0 -1
- package/dist/commands/plugin/plugin-command.utils.d.ts +0 -13
- package/dist/commands/plugin/plugin-command.utils.d.ts.map +0 -1
- package/dist/commands/plugin/plugin-command.utils.js +0 -37
- package/dist/commands/plugin/plugin-command.utils.js.map +0 -1
- package/dist/commands/plugin/plugin-mutation-actions.utils.d.ts +0 -16
- package/dist/commands/plugin/plugin-mutation-actions.utils.d.ts.map +0 -1
- package/dist/commands/plugin/plugin-mutation-actions.utils.js +0 -164
- package/dist/commands/plugin/plugin-mutation-actions.utils.js.map +0 -1
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.d.ts +0 -32
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.d.ts.map +0 -1
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.js +0 -176
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.js.map +0 -1
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.d.ts +0 -25
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.d.ts.map +0 -1
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.js +0 -119
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.js.map +0 -1
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.d.ts +0 -7
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.d.ts.map +0 -1
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.js +0 -97
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-runtime-lifecycle.utils.js","names":[],"sources":["../../../../../src/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.ts"],"sourcesContent":["import type { ServiceBootstrapStatusStore } from \"../service-bootstrap-status.service.js\";\n\nexport function handleGatewayDeferredStartupError(params: {\n bootstrapStatus: ServiceBootstrapStatusStore;\n error: unknown;\n}): void {\n const { bootstrapStatus, error } = params;\n const message = error instanceof Error ? error.message : String(error);\n bootstrapStatus.markError(message);\n if (bootstrapStatus.getStatus().
|
|
1
|
+
{"version":3,"file":"gateway-runtime-lifecycle.utils.js","names":[],"sources":["../../../../../src/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.ts"],"sourcesContent":["import type { ServiceBootstrapStatusStore } from \"../service-bootstrap-status.service.js\";\n\nexport function handleGatewayDeferredStartupError(params: {\n bootstrapStatus: ServiceBootstrapStatusStore;\n error: unknown;\n}): void {\n const { bootstrapStatus, error } = params;\n const message = error instanceof Error ? error.message : String(error);\n bootstrapStatus.markError(message);\n if (bootstrapStatus.getStatus().extensionLoading.state === \"running\") {\n bootstrapStatus.markExtensionLoadingError(message);\n }\n console.error(\n `Deferred startup failed: ${message}`,\n );\n}\n"],"mappings":";AAEA,SAAgB,kCAAkC,QAGzC;CACP,MAAM,EAAE,iBAAiB,UAAU;CACnC,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACtE,iBAAgB,UAAU,QAAQ;AAClC,KAAI,gBAAgB,WAAW,CAAC,iBAAiB,UAAU,UACzD,iBAAgB,0BAA0B,QAAQ;AAEpD,SAAQ,MACN,4BAA4B,UAC7B"}
|
|
@@ -14,12 +14,8 @@ declare class ServiceMarketplaceInstaller {
|
|
|
14
14
|
installBuiltinSkill: (slug: string, force?: boolean) => BuiltinSkillInstallResult;
|
|
15
15
|
});
|
|
16
16
|
createInstaller(): MarketplaceInstaller;
|
|
17
|
-
private installPlugin;
|
|
18
17
|
private installSkill;
|
|
19
18
|
private installMcp;
|
|
20
|
-
private enablePlugin;
|
|
21
|
-
private disablePlugin;
|
|
22
|
-
private uninstallPlugin;
|
|
23
19
|
private uninstallSkill;
|
|
24
20
|
private enableMcp;
|
|
25
21
|
private disableMcp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-marketplace-installer.service.d.ts","names":[],"sources":["../../../../src/shared/services/marketplace/service-marketplace-installer.service.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"service-marketplace-installer.service.d.ts","names":[],"sources":["../../../../src/shared/services/marketplace/service-marketplace-installer.service.ts"],"mappings":";;;KAYK,gBAAA;EACH,OAAA;EACA,MAAA;AAAA;AAAA,KAGG,yBAAA,GAA4B,gBAAA;AAAA,cAEpB,2BAAA;EAAA,iBAEQ,IAAA;cAAA,IAAA;IACf,qBAAA,SAA8B,OAAA;IAC9B,gBAAA,GAAmB,IAAA,eAAmB,OAAA;IACtC,mBAAA,GAAsB,IAAA,UAAc,KAAA,eAAoB,yBAAA;EAAA;EAI5D,eAAA,CAAA,GAAmB,oBAAA;EAAA,QAYL,YAAA;EAAA,QAiCA,UAAA;EAAA,QAIA,cAAA;EAAA,QAeA,SAAA;EAAA,QAIA,UAAA;EAAA,QAIA,SAAA;EAAA,QAIA,SAAA;EAAA,QAIN,uBAAA;AAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { disablePluginMutation, enablePluginMutation, installPluginMutation, uninstallPluginMutation } from "../../../commands/plugin/plugin-mutation-actions.utils.js";
|
|
2
1
|
import { buildMarketplaceSkillInstallArgs, pickUserFacingCommandSummary } from "../../utils/marketplace/service-marketplace-helpers.utils.js";
|
|
3
2
|
import { ServiceMcpMarketplaceOps } from "./service-mcp-marketplace-ops.js";
|
|
4
3
|
import { getSkillsPath, getWorkspacePath, loadConfig } from "@nextclaw/core";
|
|
@@ -11,12 +10,8 @@ var ServiceMarketplaceInstaller = class {
|
|
|
11
10
|
}
|
|
12
11
|
createInstaller() {
|
|
13
12
|
return {
|
|
14
|
-
installPlugin: (spec) => this.installPlugin(spec),
|
|
15
13
|
installSkill: (params) => this.installSkill(params),
|
|
16
14
|
installMcp: (params) => this.installMcp(params),
|
|
17
|
-
enablePlugin: (id) => this.enablePlugin(id),
|
|
18
|
-
disablePlugin: (id) => this.disablePlugin(id),
|
|
19
|
-
uninstallPlugin: (id) => this.uninstallPlugin(id),
|
|
20
15
|
uninstallSkill: (slug) => this.uninstallSkill(slug),
|
|
21
16
|
enableMcp: (name) => this.enableMcp(name),
|
|
22
17
|
disableMcp: (name) => this.disableMcp(name),
|
|
@@ -24,11 +19,6 @@ var ServiceMarketplaceInstaller = class {
|
|
|
24
19
|
doctorMcp: (name) => this.doctorMcp(name)
|
|
25
20
|
};
|
|
26
21
|
}
|
|
27
|
-
async installPlugin(spec) {
|
|
28
|
-
const result = await installPluginMutation(spec);
|
|
29
|
-
await this.deps.applyLiveConfigReload?.();
|
|
30
|
-
return { message: result.message };
|
|
31
|
-
}
|
|
32
22
|
async installSkill(params) {
|
|
33
23
|
if (params.kind === "builtin") {
|
|
34
24
|
const result = this.deps.installBuiltinSkill(params.slug, params.force);
|
|
@@ -53,23 +43,6 @@ var ServiceMarketplaceInstaller = class {
|
|
|
53
43
|
async installMcp(params) {
|
|
54
44
|
return await this.createMcpMarketplaceOps().install(params);
|
|
55
45
|
}
|
|
56
|
-
async enablePlugin(id) {
|
|
57
|
-
const result = await enablePluginMutation(id);
|
|
58
|
-
await this.deps.applyLiveConfigReload?.();
|
|
59
|
-
return { message: result.message };
|
|
60
|
-
}
|
|
61
|
-
async disablePlugin(id) {
|
|
62
|
-
const result = await disablePluginMutation(id);
|
|
63
|
-
await this.deps.applyLiveConfigReload?.();
|
|
64
|
-
return { message: result.message };
|
|
65
|
-
}
|
|
66
|
-
async uninstallPlugin(id) {
|
|
67
|
-
await disablePluginMutation(id);
|
|
68
|
-
await this.deps.applyLiveConfigReload?.();
|
|
69
|
-
const result = await uninstallPluginMutation(id, { force: true });
|
|
70
|
-
await this.deps.applyLiveConfigReload?.();
|
|
71
|
-
return { message: result.message };
|
|
72
|
-
}
|
|
73
46
|
async uninstallSkill(slug) {
|
|
74
47
|
const targetDir = join(getSkillsPath(getWorkspacePath(loadConfig().agents.defaults.workspace)), slug);
|
|
75
48
|
if (!existsSync(targetDir)) throw new Error(`Skill not installed in workspace: ${slug}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-marketplace-installer.service.js","names":[],"sources":["../../../../src/shared/services/marketplace/service-marketplace-installer.service.ts"],"sourcesContent":["import { getSkillsPath, getWorkspacePath, loadConfig } from \"@nextclaw/core\";\nimport type {\n MarketplaceInstallSkillParams,\n MarketplaceInstaller,\n MarketplaceMcpDoctorResult,\n MarketplaceMcpInstallRequest\n} from \"@nextclaw/server\";\nimport { existsSync, rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {
|
|
1
|
+
{"version":3,"file":"service-marketplace-installer.service.js","names":[],"sources":["../../../../src/shared/services/marketplace/service-marketplace-installer.service.ts"],"sourcesContent":["import { getSkillsPath, getWorkspacePath, loadConfig } from \"@nextclaw/core\";\nimport type {\n MarketplaceInstallSkillParams,\n MarketplaceInstaller,\n MarketplaceMcpDoctorResult,\n MarketplaceMcpInstallRequest\n} from \"@nextclaw/server\";\nimport { existsSync, rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { buildMarketplaceSkillInstallArgs, pickUserFacingCommandSummary } from \"@nextclaw-service/shared/utils/marketplace/service-marketplace-helpers.utils.js\";\nimport { ServiceMcpMarketplaceOps } from \"@nextclaw-service/shared/services/marketplace/service-mcp-marketplace-ops.js\";\n\ntype UserFacingResult = {\n message: string;\n output?: string;\n};\n\ntype BuiltinSkillInstallResult = UserFacingResult | null;\n\nexport class ServiceMarketplaceInstaller {\n constructor(\n private readonly deps: {\n applyLiveConfigReload?: () => Promise<void>;\n runCliSubcommand: (args: string[]) => Promise<string>;\n installBuiltinSkill: (slug: string, force?: boolean) => BuiltinSkillInstallResult;\n }\n ) {}\n\n createInstaller(): MarketplaceInstaller {\n return {\n installSkill: (params) => this.installSkill(params),\n installMcp: (params) => this.installMcp(params),\n uninstallSkill: (slug) => this.uninstallSkill(slug),\n enableMcp: (name) => this.enableMcp(name),\n disableMcp: (name) => this.disableMcp(name),\n removeMcp: (name) => this.removeMcp(name),\n doctorMcp: (name) => this.doctorMcp(name)\n };\n }\n\n private async installSkill(params: MarketplaceInstallSkillParams): Promise<UserFacingResult> {\n if (params.kind === \"builtin\") {\n const result = this.deps.installBuiltinSkill(params.slug, params.force);\n if (!result) {\n throw new Error(`Builtin skill not found: ${params.slug}`);\n }\n return result;\n }\n\n if (params.kind && params.kind !== \"marketplace\") {\n throw new Error(`Unsupported marketplace skill kind: ${params.kind}`);\n }\n\n const workspace = getWorkspacePath(loadConfig().agents.defaults.workspace);\n const args = buildMarketplaceSkillInstallArgs({\n slug: params.slug,\n workspace,\n force: params.force\n });\n\n try {\n const output = await this.deps.runCliSubcommand(args);\n const summary = pickUserFacingCommandSummary(output, `Installed skill: ${params.slug}`);\n return { message: summary };\n } catch (error) {\n const fallback = this.deps.installBuiltinSkill(params.slug, params.force);\n if (!fallback) {\n throw error;\n }\n return fallback;\n }\n }\n\n private async installMcp(params: MarketplaceMcpInstallRequest): Promise<{ name: string; message: string; output?: string }> {\n return await this.createMcpMarketplaceOps().install(params);\n }\n\n private async uninstallSkill(slug: string): Promise<UserFacingResult> {\n const workspace = getWorkspacePath(loadConfig().agents.defaults.workspace);\n const targetDir = join(getSkillsPath(workspace), slug);\n\n if (!existsSync(targetDir)) {\n throw new Error(`Skill not installed in workspace: ${slug}`);\n }\n\n rmSync(targetDir, { recursive: true, force: true });\n\n return {\n message: `Uninstalled skill: ${slug}`\n };\n }\n\n private async enableMcp(name: string): Promise<UserFacingResult> {\n return await this.createMcpMarketplaceOps().enable(name);\n }\n\n private async disableMcp(name: string): Promise<UserFacingResult> {\n return await this.createMcpMarketplaceOps().disable(name);\n }\n\n private async removeMcp(name: string): Promise<UserFacingResult> {\n return await this.createMcpMarketplaceOps().remove(name);\n }\n\n private async doctorMcp(name: string): Promise<MarketplaceMcpDoctorResult> {\n return await this.createMcpMarketplaceOps().doctor(name);\n }\n\n private createMcpMarketplaceOps(): ServiceMcpMarketplaceOps {\n return new ServiceMcpMarketplaceOps({\n applyLiveConfigReload: this.deps.applyLiveConfigReload\n });\n }\n}\n"],"mappings":";;;;;;AAmBA,IAAa,8BAAb,MAAyC;CACvC,YACE,MAKA;AALiB,OAAA,OAAA;;CAOnB,kBAAwC;AACtC,SAAO;GACL,eAAe,WAAW,KAAK,aAAa,OAAO;GACnD,aAAa,WAAW,KAAK,WAAW,OAAO;GAC/C,iBAAiB,SAAS,KAAK,eAAe,KAAK;GACnD,YAAY,SAAS,KAAK,UAAU,KAAK;GACzC,aAAa,SAAS,KAAK,WAAW,KAAK;GAC3C,YAAY,SAAS,KAAK,UAAU,KAAK;GACzC,YAAY,SAAS,KAAK,UAAU,KAAK;GAC1C;;CAGH,MAAc,aAAa,QAAkE;AAC3F,MAAI,OAAO,SAAS,WAAW;GAC7B,MAAM,SAAS,KAAK,KAAK,oBAAoB,OAAO,MAAM,OAAO,MAAM;AACvE,OAAI,CAAC,OACH,OAAM,IAAI,MAAM,4BAA4B,OAAO,OAAO;AAE5D,UAAO;;AAGT,MAAI,OAAO,QAAQ,OAAO,SAAS,cACjC,OAAM,IAAI,MAAM,uCAAuC,OAAO,OAAO;EAGvE,MAAM,YAAY,iBAAiB,YAAY,CAAC,OAAO,SAAS,UAAU;EAC1E,MAAM,OAAO,iCAAiC;GAC5C,MAAM,OAAO;GACb;GACA,OAAO,OAAO;GACf,CAAC;AAEF,MAAI;AAGF,UAAO,EAAE,SADO,6BADD,MAAM,KAAK,KAAK,iBAAiB,KAAK,EACA,oBAAoB,OAAO,OAAO,EAC5D;WACpB,OAAO;GACd,MAAM,WAAW,KAAK,KAAK,oBAAoB,OAAO,MAAM,OAAO,MAAM;AACzE,OAAI,CAAC,SACH,OAAM;AAER,UAAO;;;CAIX,MAAc,WAAW,QAAmG;AAC1H,SAAO,MAAM,KAAK,yBAAyB,CAAC,QAAQ,OAAO;;CAG7D,MAAc,eAAe,MAAyC;EAEpE,MAAM,YAAY,KAAK,cADL,iBAAiB,YAAY,CAAC,OAAO,SAAS,UAAU,CAC3B,EAAE,KAAK;AAEtD,MAAI,CAAC,WAAW,UAAU,CACxB,OAAM,IAAI,MAAM,qCAAqC,OAAO;AAG9D,SAAO,WAAW;GAAE,WAAW;GAAM,OAAO;GAAM,CAAC;AAEnD,SAAO,EACL,SAAS,sBAAsB,QAChC;;CAGH,MAAc,UAAU,MAAyC;AAC/D,SAAO,MAAM,KAAK,yBAAyB,CAAC,OAAO,KAAK;;CAG1D,MAAc,WAAW,MAAyC;AAChE,SAAO,MAAM,KAAK,yBAAyB,CAAC,QAAQ,KAAK;;CAG3D,MAAc,UAAU,MAAyC;AAC/D,SAAO,MAAM,KAAK,yBAAyB,CAAC,OAAO,KAAK;;CAG1D,MAAc,UAAU,MAAmD;AACzE,SAAO,MAAM,KAAK,yBAAyB,CAAC,OAAO,KAAK;;CAG1D,0BAA4D;AAC1D,SAAO,IAAI,yBAAyB,EAClC,uBAAuB,KAAK,KAAK,uBAClC,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
//#region src/shared/services/workspace/workspace-manager.service.d.ts
|
|
2
2
|
declare class WorkspaceManager {
|
|
3
|
-
private logo;
|
|
4
|
-
constructor(logo: string);
|
|
5
3
|
private readonly pkgRoot;
|
|
6
4
|
readonly createWorkspaceTemplates: (workspace: string, options?: {
|
|
7
5
|
force?: boolean;
|
|
@@ -9,11 +7,6 @@ declare class WorkspaceManager {
|
|
|
9
7
|
created: string[];
|
|
10
8
|
};
|
|
11
9
|
private readonly resolveTemplateDir;
|
|
12
|
-
readonly getBridgeDir: () => string;
|
|
13
|
-
private readonly resolveBridgeSource;
|
|
14
|
-
private readonly assertCommandAvailable;
|
|
15
|
-
private readonly runBridgeCommand;
|
|
16
|
-
private readonly exitWithError;
|
|
17
10
|
}
|
|
18
11
|
//#endregion
|
|
19
12
|
export { WorkspaceManager };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-manager.service.d.ts","names":[],"sources":["../../../../src/shared/services/workspace/workspace-manager.service.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"workspace-manager.service.d.ts","names":[],"sources":["../../../../src/shared/services/workspace/workspace-manager.service.ts"],"mappings":";cAKa,gBAAA;EAAA,iBACM,OAAA;EAAA,SASR,wBAAA,GAA4B,SAAA,UAAmB,OAAA;IAAW,KAAA;EAAA;IAA2B,OAAA;EAAA;EAAA,iBAoD7E,kBAAA;AAAA"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { spawnSync } from "node:child_process";
|
|
1
|
+
import { APP_NAME, DEFAULT_SKILLS_DIR } from "@nextclaw/core";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
3
|
import { dirname, join, resolve } from "node:path";
|
|
6
4
|
import { fileURLToPath } from "node:url";
|
|
7
5
|
//#region src/shared/services/workspace/workspace-manager.service.ts
|
|
8
6
|
var WorkspaceManager = class {
|
|
9
|
-
constructor(logo) {
|
|
10
|
-
this.logo = logo;
|
|
11
|
-
}
|
|
12
7
|
pkgRoot = resolve(fileURLToPath(new URL(".", import.meta.url)), "..", "..", "..", "..", "..");
|
|
13
8
|
createWorkspaceTemplates = (workspace, options = {}) => {
|
|
14
9
|
const created = [];
|
|
@@ -85,49 +80,6 @@ var WorkspaceManager = class {
|
|
|
85
80
|
for (const candidate of candidates) if (existsSync(candidate)) return candidate;
|
|
86
81
|
return null;
|
|
87
82
|
};
|
|
88
|
-
getBridgeDir = () => {
|
|
89
|
-
const userBridge = join(getDataDir(), "bridge");
|
|
90
|
-
if (existsSync(join(userBridge, "dist", "index.js"))) return userBridge;
|
|
91
|
-
this.assertCommandAvailable("npm");
|
|
92
|
-
const source = this.resolveBridgeSource();
|
|
93
|
-
console.log(`${this.logo} Setting up bridge...`);
|
|
94
|
-
mkdirSync(resolve(userBridge, ".."), { recursive: true });
|
|
95
|
-
if (existsSync(userBridge)) rmSync(userBridge, {
|
|
96
|
-
recursive: true,
|
|
97
|
-
force: true
|
|
98
|
-
});
|
|
99
|
-
cpSync(source, userBridge, {
|
|
100
|
-
recursive: true,
|
|
101
|
-
filter: (src) => !src.includes("node_modules") && !src.includes("dist")
|
|
102
|
-
});
|
|
103
|
-
this.runBridgeCommand(userBridge, ["install"], "install");
|
|
104
|
-
this.runBridgeCommand(userBridge, ["run", "build"], "build");
|
|
105
|
-
console.log("✓ Bridge ready\n");
|
|
106
|
-
return userBridge;
|
|
107
|
-
};
|
|
108
|
-
resolveBridgeSource = () => {
|
|
109
|
-
const candidates = [join(this.pkgRoot, "bridge"), join(this.pkgRoot, "..", "..", "bridge")];
|
|
110
|
-
for (const candidate of candidates) if (existsSync(join(candidate, "package.json"))) return candidate;
|
|
111
|
-
return this.exitWithError(`Bridge source not found. Try reinstalling ${APP_NAME}.`);
|
|
112
|
-
};
|
|
113
|
-
assertCommandAvailable = (command) => {
|
|
114
|
-
if (findExecutableOnPath(command)) return;
|
|
115
|
-
this.exitWithError(`${command} not found. Please install Node.js >= 18.`);
|
|
116
|
-
};
|
|
117
|
-
runBridgeCommand = (cwd, args, step) => {
|
|
118
|
-
const result = spawnSync("npm", args, {
|
|
119
|
-
cwd,
|
|
120
|
-
stdio: "pipe"
|
|
121
|
-
});
|
|
122
|
-
if (result.status === 0) return;
|
|
123
|
-
const stderr = result.stderr ? String(result.stderr).slice(0, 500) : null;
|
|
124
|
-
this.exitWithError(`Bridge ${step} failed: ${result.status ?? 1}`, stderr);
|
|
125
|
-
};
|
|
126
|
-
exitWithError = (message, detail) => {
|
|
127
|
-
console.error(message);
|
|
128
|
-
if (detail) console.error(detail);
|
|
129
|
-
process.exit(1);
|
|
130
|
-
};
|
|
131
83
|
};
|
|
132
84
|
//#endregion
|
|
133
85
|
export { WorkspaceManager };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-manager.service.js","names":[],"sources":["../../../../src/shared/services/workspace/workspace-manager.service.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"workspace-manager.service.js","names":[],"sources":["../../../../src/shared/services/workspace/workspace-manager.service.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { APP_NAME, DEFAULT_SKILLS_DIR } from \"@nextclaw/core\";\n\nexport class WorkspaceManager {\n private readonly pkgRoot = resolve(\n fileURLToPath(new URL(\".\", import.meta.url)),\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"..\"\n );\n\n readonly createWorkspaceTemplates = (workspace: string, options: { force?: boolean } = {}): { created: string[] } => {\n const created: string[] = [];\n const force = Boolean(options.force);\n const templateDir = this.resolveTemplateDir();\n if (!templateDir) {\n console.warn(\"Warning: Template directory not found. Skipping workspace templates.\");\n }\n const templateFiles = [\n { source: \"AGENTS.md\", target: \"AGENTS.md\" },\n { source: \"SOUL.md\", target: \"SOUL.md\" },\n { source: \"USER.md\", target: \"USER.md\" },\n { source: \"IDENTITY.md\", target: \"IDENTITY.md\" },\n { source: \"TOOLS.md\", target: \"TOOLS.md\" },\n { source: \"BOOT.md\", target: \"BOOT.md\" },\n { source: \"BOOTSTRAP.md\", target: \"BOOTSTRAP.md\" },\n { source: \"MEMORY.md\", target: \"MEMORY.md\" },\n { source: \"memory/MEMORY.md\", target: \"memory/MEMORY.md\" }\n ];\n\n if (templateDir) {\n for (const entry of templateFiles) {\n const filePath = join(workspace, entry.target);\n if (!force && existsSync(filePath)) {\n continue;\n }\n const templatePath = join(templateDir, entry.source);\n if (!existsSync(templatePath)) {\n console.warn(`Warning: Template file missing: ${templatePath}`);\n continue;\n }\n const raw = readFileSync(templatePath, \"utf-8\");\n const content = raw.replace(/\\$\\{APP_NAME\\}/g, APP_NAME);\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, content);\n created.push(entry.target);\n }\n }\n\n const memoryDir = join(workspace, \"memory\");\n if (!existsSync(memoryDir)) {\n mkdirSync(memoryDir, { recursive: true });\n created.push(join(\"memory\", \"\"));\n }\n\n const skillsDir = join(workspace, DEFAULT_SKILLS_DIR);\n if (!existsSync(skillsDir)) {\n mkdirSync(skillsDir, { recursive: true });\n created.push(join(DEFAULT_SKILLS_DIR, \"\"));\n }\n return { created };\n };\n\n private readonly resolveTemplateDir = (): string | null => {\n const override = process.env.NEXTCLAW_TEMPLATE_DIR?.trim();\n if (override) {\n return override;\n }\n const candidates = [join(this.pkgRoot, \"templates\")];\n for (const candidate of candidates) {\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n return null;\n };\n\n}\n"],"mappings":";;;;;AAKA,IAAa,mBAAb,MAA8B;CAC5B,UAA2B,QACzB,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC,EAC5C,MACA,MACA,MACA,MACA,KACD;CAED,4BAAqC,WAAmB,UAA+B,EAAE,KAA4B;EACnH,MAAM,UAAoB,EAAE;EAC5B,MAAM,QAAQ,QAAQ,QAAQ,MAAM;EACpC,MAAM,cAAc,KAAK,oBAAoB;AAC7C,MAAI,CAAC,YACH,SAAQ,KAAK,uEAAuE;EAEtF,MAAM,gBAAgB;GACpB;IAAE,QAAQ;IAAa,QAAQ;IAAa;GAC5C;IAAE,QAAQ;IAAW,QAAQ;IAAW;GACxC;IAAE,QAAQ;IAAW,QAAQ;IAAW;GACxC;IAAE,QAAQ;IAAe,QAAQ;IAAe;GAChD;IAAE,QAAQ;IAAY,QAAQ;IAAY;GAC1C;IAAE,QAAQ;IAAW,QAAQ;IAAW;GACxC;IAAE,QAAQ;IAAgB,QAAQ;IAAgB;GAClD;IAAE,QAAQ;IAAa,QAAQ;IAAa;GAC5C;IAAE,QAAQ;IAAoB,QAAQ;IAAoB;GAC3D;AAED,MAAI,YACF,MAAK,MAAM,SAAS,eAAe;GACjC,MAAM,WAAW,KAAK,WAAW,MAAM,OAAO;AAC9C,OAAI,CAAC,SAAS,WAAW,SAAS,CAChC;GAEF,MAAM,eAAe,KAAK,aAAa,MAAM,OAAO;AACpD,OAAI,CAAC,WAAW,aAAa,EAAE;AAC7B,YAAQ,KAAK,mCAAmC,eAAe;AAC/D;;GAGF,MAAM,UADM,aAAa,cAAc,QAAQ,CAC3B,QAAQ,mBAAmB,SAAS;AACxD,aAAU,QAAQ,SAAS,EAAE,EAAE,WAAW,MAAM,CAAC;AACjD,iBAAc,UAAU,QAAQ;AAChC,WAAQ,KAAK,MAAM,OAAO;;EAI9B,MAAM,YAAY,KAAK,WAAW,SAAS;AAC3C,MAAI,CAAC,WAAW,UAAU,EAAE;AAC1B,aAAU,WAAW,EAAE,WAAW,MAAM,CAAC;AACzC,WAAQ,KAAK,KAAK,UAAU,GAAG,CAAC;;EAGlC,MAAM,YAAY,KAAK,WAAW,mBAAmB;AACrD,MAAI,CAAC,WAAW,UAAU,EAAE;AAC1B,aAAU,WAAW,EAAE,WAAW,MAAM,CAAC;AACzC,WAAQ,KAAK,KAAK,oBAAoB,GAAG,CAAC;;AAE5C,SAAO,EAAE,SAAS;;CAGpB,2BAA2D;EACzD,MAAM,WAAW,QAAQ,IAAI,uBAAuB,MAAM;AAC1D,MAAI,SACF,QAAO;EAET,MAAM,aAAa,CAAC,KAAK,KAAK,SAAS,YAAY,CAAC;AACpD,OAAK,MAAM,aAAa,WACtB,KAAI,WAAW,UAAU,CACvB,QAAO;AAGX,SAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/service",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NextClaw long-running service host and runtime lifecycle.",
|
|
6
6
|
"type": "module",
|
|
@@ -26,33 +26,46 @@
|
|
|
26
26
|
],
|
|
27
27
|
"nextclaw": {
|
|
28
28
|
"builtinExtensions": [
|
|
29
|
+
"@nextclaw/channel-extension-dingtalk",
|
|
30
|
+
"@nextclaw/channel-extension-discord",
|
|
31
|
+
"@nextclaw/channel-extension-email",
|
|
29
32
|
"@nextclaw/channel-extension-feishu",
|
|
30
33
|
"@nextclaw/channel-extension-qq",
|
|
31
|
-
"@nextclaw/channel-extension-
|
|
34
|
+
"@nextclaw/channel-extension-slack",
|
|
35
|
+
"@nextclaw/channel-extension-telegram",
|
|
36
|
+
"@nextclaw/channel-extension-wecom",
|
|
37
|
+
"@nextclaw/channel-extension-weixin",
|
|
38
|
+
"@nextclaw/channel-extension-whatsapp"
|
|
32
39
|
]
|
|
33
40
|
},
|
|
34
41
|
"dependencies": {
|
|
35
42
|
"chokidar": "^3.6.0",
|
|
36
43
|
"commander": "^12.1.0",
|
|
37
44
|
"jszip": "^3.10.1",
|
|
38
|
-
"@nextclaw/channel-extension-
|
|
39
|
-
"@nextclaw/channel-extension-
|
|
40
|
-
"@nextclaw/channel-extension-
|
|
41
|
-
"@nextclaw/
|
|
42
|
-
"@nextclaw/
|
|
43
|
-
"@nextclaw/
|
|
44
|
-
"@nextclaw/
|
|
45
|
-
"@nextclaw/
|
|
46
|
-
"@nextclaw/
|
|
47
|
-
"@nextclaw/
|
|
48
|
-
"@nextclaw/
|
|
49
|
-
"@nextclaw/
|
|
50
|
-
"@nextclaw/ncp": "0.5.
|
|
51
|
-
"@nextclaw/
|
|
52
|
-
"@nextclaw/
|
|
53
|
-
"@nextclaw/
|
|
54
|
-
"@nextclaw/
|
|
55
|
-
"@nextclaw/
|
|
45
|
+
"@nextclaw/channel-extension-dingtalk": "0.1.1-beta.1",
|
|
46
|
+
"@nextclaw/channel-extension-email": "0.1.1-beta.1",
|
|
47
|
+
"@nextclaw/channel-extension-feishu": "0.1.9-beta.1",
|
|
48
|
+
"@nextclaw/channel-extension-discord": "0.1.1-beta.1",
|
|
49
|
+
"@nextclaw/channel-extension-slack": "0.1.1-beta.1",
|
|
50
|
+
"@nextclaw/channel-extension-telegram": "0.1.1-beta.1",
|
|
51
|
+
"@nextclaw/channel-extension-qq": "0.1.6-beta.1",
|
|
52
|
+
"@nextclaw/channel-extension-whatsapp": "0.1.1-beta.1",
|
|
53
|
+
"@nextclaw/core": "0.12.25-beta.1",
|
|
54
|
+
"@nextclaw/channel-extension-weixin": "0.1.12-beta.1",
|
|
55
|
+
"@nextclaw/mcp": "0.1.90-beta.1",
|
|
56
|
+
"@nextclaw/channel-extension-wecom": "0.1.1-beta.1",
|
|
57
|
+
"@nextclaw/ncp": "0.5.18-beta.1",
|
|
58
|
+
"@nextclaw/ncp-mcp": "0.1.92-beta.1",
|
|
59
|
+
"@nextclaw/ncp-toolkit": "0.5.23-beta.1",
|
|
60
|
+
"@nextclaw/nextclaw-hermes-acp-bridge": "0.1.17-beta.1",
|
|
61
|
+
"@nextclaw/nextclaw-ncp-runtime-http-client": "0.1.17-beta.1",
|
|
62
|
+
"@nextclaw/kernel": "0.1.15-beta.1",
|
|
63
|
+
"@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.1.18-beta.1",
|
|
64
|
+
"@nextclaw/remote": "0.1.103-beta.1",
|
|
65
|
+
"@nextclaw/runtime": "0.2.57-beta.1",
|
|
66
|
+
"@nextclaw/server": "0.12.26-beta.1",
|
|
67
|
+
"@nextclaw/shared": "0.1.12-beta.1",
|
|
68
|
+
"@nextclaw/ncp-agent-runtime": "0.3.29-beta.1"
|
|
56
69
|
},
|
|
57
70
|
"devDependencies": {
|
|
58
71
|
"@types/node": "^20.17.6",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Config } from "@nextclaw/core";
|
|
2
|
-
import { PluginChannelBinding } from "@nextclaw/openclaw-compat";
|
|
3
|
-
|
|
4
|
-
//#region src/commands/channel/channel-config-view.d.ts
|
|
5
|
-
declare function resolveChannelConfigView(config: Config, bindings: PluginChannelBinding[]): Config;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { resolveChannelConfigView };
|
|
8
|
-
//# sourceMappingURL=channel-config-view.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel-config-view.d.ts","names":[],"sources":["../../../src/commands/channel/channel-config-view.ts"],"mappings":";;;;iBAGgB,wBAAA,CAAyB,MAAA,EAAQ,MAAA,EAAQ,QAAA,EAAU,oBAAA,KAAyB,MAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { toPluginConfigView } from "@nextclaw/openclaw-compat";
|
|
2
|
-
//#region src/commands/channel/channel-config-view.ts
|
|
3
|
-
function resolveChannelConfigView(config, bindings) {
|
|
4
|
-
return toPluginConfigView(config, bindings);
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { resolveChannelConfigView };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=channel-config-view.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel-config-view.js","names":[],"sources":["../../../src/commands/channel/channel-config-view.ts"],"sourcesContent":["import type { Config } from \"@nextclaw/core\";\nimport { toPluginConfigView, type PluginChannelBinding } from \"@nextclaw/openclaw-compat\";\n\nexport function resolveChannelConfigView(config: Config, bindings: PluginChannelBinding[]): Config {\n return toPluginConfigView(config, bindings) as Config;\n}\n"],"mappings":";;AAGA,SAAgB,yBAAyB,QAAgB,UAA0C;AACjG,QAAO,mBAAmB,QAAQ,SAAS"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PluginsInfoOptions, PluginsInstallOptions, PluginsListOptions, PluginsUninstallOptions } from "../../shared/types/cli.types.js";
|
|
2
|
-
import { Config } from "@nextclaw/core";
|
|
3
|
-
import { PluginRegistry, mergePluginConfigView, toPluginConfigView } from "@nextclaw/openclaw-compat";
|
|
4
|
-
|
|
5
|
-
//#region src/commands/plugin/index.d.ts
|
|
6
|
-
declare function loadPluginRegistry(config: Config, workspaceDir: string): PluginRegistry;
|
|
7
|
-
declare function logPluginDiagnostics(registry: Pick<PluginRegistry, "diagnostics">): void;
|
|
8
|
-
declare class PluginCommands {
|
|
9
|
-
list: (opts?: PluginsListOptions) => void;
|
|
10
|
-
info: (id: string, opts?: PluginsInfoOptions) => void;
|
|
11
|
-
enable: (id: string) => Promise<void>;
|
|
12
|
-
disable: (id: string) => Promise<void>;
|
|
13
|
-
uninstall: (id: string, opts?: PluginsUninstallOptions) => Promise<void>;
|
|
14
|
-
install: (pathOrSpec: string, opts?: PluginsInstallOptions) => Promise<void>;
|
|
15
|
-
doctor: () => void;
|
|
16
|
-
private confirmYesNo;
|
|
17
|
-
private confirmUninstall;
|
|
18
|
-
private runUninstallMutation;
|
|
19
|
-
private loadStatusReport;
|
|
20
|
-
private buildPluginInfoLines;
|
|
21
|
-
private buildPluginSummaryLines;
|
|
22
|
-
private pushOptionalLine;
|
|
23
|
-
private assertPluginCanUninstall;
|
|
24
|
-
private buildUninstallPreview;
|
|
25
|
-
private buildUninstallConfigPreview;
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
export { PluginCommands, loadPluginRegistry, logPluginDiagnostics, mergePluginConfigView, toPluginConfigView };
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/commands/plugin/index.ts"],"mappings":";;;;;iBAmCgB,kBAAA,CAAmB,MAAA,EAAQ,MAAA,EAAQ,YAAA,WAAuB,cAAA;AAAA,iBAO1D,oBAAA,CAAqB,QAAA,EAAU,IAAA,CAAK,cAAA;AAAA,cAYvC,cAAA;EACX,IAAA,GAAQ,IAAA,GAAM,kBAAA;EAwDd,IAAA,GAAQ,EAAA,UAAY,IAAA,GAAM,kBAAA;EAgB1B,MAAA,GAAgB,EAAA,aAAa,OAAA;EAW7B,OAAA,GAAiB,EAAA,aAAa,OAAA;EAW9B,SAAA,GAAmB,EAAA,UAAY,IAAA,GAAM,uBAAA,KAA+B,OAAA;EAoCpE,OAAA,GAAiB,UAAA,UAAoB,IAAA,GAAM,qBAAA,KAA6B,OAAA;EAWxE,MAAA;EAAA,QA8BQ,YAAA;EAAA,QAeA,gBAAA;EAAA,QAWA,oBAAA;EAAA,QAaA,gBAAA;EAAA,QAcA,oBAAA;EAAA,QAeA,uBAAA;EAAA,QAeA,gBAAA;EAAA,QAMA,wBAAA;EAAA,QAkBA,qBAAA;EAAA,QAkBA,2BAAA;AAAA"}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { appendPluginCapabilityLines, buildReservedPluginLoadOptions } from "./plugin-command.utils.js";
|
|
2
|
-
import { disablePluginMutation, enablePluginMutation, installPluginMutation, uninstallPluginMutation } from "./plugin-mutation-actions.utils.js";
|
|
3
|
-
import { getWorkspacePath, loadConfig } from "@nextclaw/core";
|
|
4
|
-
import { ExtensionPluginRegistryService } from "@nextclaw/kernel";
|
|
5
|
-
import { buildPluginStatusReport, mergePluginConfigView, resolveUninstallDirectoryTargets, toPluginConfigView } from "@nextclaw/openclaw-compat";
|
|
6
|
-
import { resolve } from "node:path";
|
|
7
|
-
import { createInterface } from "node:readline";
|
|
8
|
-
//#region src/commands/plugin/index.ts
|
|
9
|
-
function loadPluginRegistry(config, workspaceDir) {
|
|
10
|
-
return new ExtensionPluginRegistryService().load({
|
|
11
|
-
config,
|
|
12
|
-
workspace: workspaceDir
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function logPluginDiagnostics(registry) {
|
|
16
|
-
for (const diag of registry.diagnostics) {
|
|
17
|
-
const text = `${diag.pluginId ? `${diag.pluginId}: ` : ""}${diag.message}`;
|
|
18
|
-
if (diag.level === "error") console.error(`[plugins] ${text}`);
|
|
19
|
-
else console.warn(`[plugins] ${text}`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
var PluginCommands = class {
|
|
23
|
-
list = (opts = {}) => {
|
|
24
|
-
const { report, workspaceDir } = this.loadStatusReport();
|
|
25
|
-
const list = opts.enabled ? report.plugins.filter((plugin) => plugin.status === "loaded") : report.plugins;
|
|
26
|
-
if (opts.json) {
|
|
27
|
-
console.log(JSON.stringify({
|
|
28
|
-
workspaceDir,
|
|
29
|
-
plugins: list,
|
|
30
|
-
diagnostics: report.diagnostics
|
|
31
|
-
}, null, 2));
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (list.length === 0) {
|
|
35
|
-
console.log("No plugins discovered.");
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
for (const plugin of list) {
|
|
39
|
-
const status = plugin.status === "loaded" ? "loaded" : plugin.status === "disabled" ? "disabled" : "error";
|
|
40
|
-
const title = plugin.name && plugin.name !== plugin.id ? `${plugin.name} (${plugin.id})` : plugin.id;
|
|
41
|
-
if (!opts.verbose) {
|
|
42
|
-
const desc = plugin.description ? plugin.description.length > 80 ? `${plugin.description.slice(0, 77)}...` : plugin.description : "(no description)";
|
|
43
|
-
console.log(`${title} ${status} - ${desc}`);
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
console.log(`${title} ${status}`);
|
|
47
|
-
console.log(` source: ${plugin.source}`);
|
|
48
|
-
console.log(` origin: ${plugin.origin}`);
|
|
49
|
-
if (plugin.version) console.log(` version: ${plugin.version}`);
|
|
50
|
-
const capabilityLines = [];
|
|
51
|
-
appendPluginCapabilityLines(capabilityLines, plugin);
|
|
52
|
-
for (const line of capabilityLines) console.log(` ${line.toLowerCase()}`);
|
|
53
|
-
if (plugin.error) console.log(` error: ${plugin.error}`);
|
|
54
|
-
console.log("");
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
info = (id, opts = {}) => {
|
|
58
|
-
const { config, report } = this.loadStatusReport();
|
|
59
|
-
const plugin = report.plugins.find((entry) => entry.id === id || entry.name === id);
|
|
60
|
-
if (!plugin) {
|
|
61
|
-
console.error(`Plugin not found: ${id}`);
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
if (opts.json) {
|
|
65
|
-
console.log(JSON.stringify(plugin, null, 2));
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
console.log(this.buildPluginInfoLines(plugin, config).join("\n"));
|
|
69
|
-
};
|
|
70
|
-
enable = async (id) => {
|
|
71
|
-
try {
|
|
72
|
-
const result = await enablePluginMutation(id);
|
|
73
|
-
console.log(result.message);
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
76
|
-
process.exit(1);
|
|
77
|
-
}
|
|
78
|
-
console.log("If gateway is running, plugin changes are hot-applied automatically.");
|
|
79
|
-
};
|
|
80
|
-
disable = async (id) => {
|
|
81
|
-
try {
|
|
82
|
-
const result = await disablePluginMutation(id);
|
|
83
|
-
console.log(result.message);
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
console.log("If gateway is running, plugin changes are hot-applied automatically.");
|
|
89
|
-
};
|
|
90
|
-
uninstall = async (id, opts = {}) => {
|
|
91
|
-
if (opts.keepConfig) console.log("`--keep-config` is deprecated, use `--keep-files`.");
|
|
92
|
-
const { config, report } = this.loadStatusReport();
|
|
93
|
-
const keepFiles = Boolean(opts.keepFiles || opts.keepConfig);
|
|
94
|
-
const plugin = report.plugins.find((entry) => entry.id === id || entry.name === id);
|
|
95
|
-
const pluginId = plugin?.id ?? id;
|
|
96
|
-
const hasEntry = pluginId in (config.plugins.entries ?? {});
|
|
97
|
-
const hasInstall = pluginId in (config.plugins.installs ?? {});
|
|
98
|
-
this.assertPluginCanUninstall(id, pluginId, plugin, hasEntry, hasInstall);
|
|
99
|
-
const install = config.plugins.installs?.[pluginId];
|
|
100
|
-
const preview = this.buildUninstallPreview({
|
|
101
|
-
config,
|
|
102
|
-
hasEntry,
|
|
103
|
-
hasInstall,
|
|
104
|
-
install,
|
|
105
|
-
keepFiles,
|
|
106
|
-
pluginId
|
|
107
|
-
});
|
|
108
|
-
const pluginName = plugin?.name || pluginId;
|
|
109
|
-
const pluginTitle = pluginName !== pluginId ? `${pluginName} (${pluginId})` : pluginName;
|
|
110
|
-
console.log(`Plugin: ${pluginTitle}`);
|
|
111
|
-
console.log(`Will remove: ${preview.length > 0 ? preview.join(", ") : "(nothing)"}`);
|
|
112
|
-
if (opts.dryRun) {
|
|
113
|
-
console.log("Dry run, no changes made.");
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (!await this.confirmUninstall(pluginId, opts)) return;
|
|
117
|
-
await this.runUninstallMutation(id, opts);
|
|
118
|
-
console.log("If gateway is running, plugin changes are hot-applied automatically.");
|
|
119
|
-
};
|
|
120
|
-
install = async (pathOrSpec, opts = {}) => {
|
|
121
|
-
try {
|
|
122
|
-
const result = await installPluginMutation(pathOrSpec, opts);
|
|
123
|
-
console.log(result.message);
|
|
124
|
-
} catch (error) {
|
|
125
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
126
|
-
process.exit(1);
|
|
127
|
-
}
|
|
128
|
-
console.log("If gateway is running, plugin changes are hot-applied automatically.");
|
|
129
|
-
};
|
|
130
|
-
doctor = () => {
|
|
131
|
-
const { report } = this.loadStatusReport();
|
|
132
|
-
const pluginErrors = report.plugins.filter((plugin) => plugin.status === "error");
|
|
133
|
-
const diagnostics = report.diagnostics.filter((diag) => diag.level === "error");
|
|
134
|
-
if (pluginErrors.length === 0 && diagnostics.length === 0) {
|
|
135
|
-
console.log("No plugin issues detected.");
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (pluginErrors.length > 0) {
|
|
139
|
-
console.log("Plugin errors:");
|
|
140
|
-
for (const entry of pluginErrors) console.log(`- ${entry.id}: ${entry.error ?? "failed to load"} (${entry.source})`);
|
|
141
|
-
}
|
|
142
|
-
if (diagnostics.length > 0) {
|
|
143
|
-
if (pluginErrors.length > 0) console.log("");
|
|
144
|
-
console.log("Diagnostics:");
|
|
145
|
-
for (const diag of diagnostics) {
|
|
146
|
-
const prefix = diag.pluginId ? `${diag.pluginId}: ` : "";
|
|
147
|
-
console.log(`- ${prefix}${diag.message}`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
confirmYesNo = async (question) => {
|
|
152
|
-
const rl = createInterface({
|
|
153
|
-
input: process.stdin,
|
|
154
|
-
output: process.stdout
|
|
155
|
-
});
|
|
156
|
-
const answer = await new Promise((resolve) => {
|
|
157
|
-
rl.question(`${question} [y/N] `, (line) => resolve(line));
|
|
158
|
-
});
|
|
159
|
-
rl.close();
|
|
160
|
-
const normalized = answer.trim().toLowerCase();
|
|
161
|
-
return normalized === "y" || normalized === "yes";
|
|
162
|
-
};
|
|
163
|
-
confirmUninstall = async (pluginId, opts) => {
|
|
164
|
-
if (opts.force) return true;
|
|
165
|
-
const confirmed = await this.confirmYesNo(`Uninstall plugin "${pluginId}"?`);
|
|
166
|
-
if (!confirmed) console.log("Cancelled.");
|
|
167
|
-
return confirmed;
|
|
168
|
-
};
|
|
169
|
-
runUninstallMutation = async (id, opts) => {
|
|
170
|
-
try {
|
|
171
|
-
const result = await uninstallPluginMutation(id, opts);
|
|
172
|
-
for (const warning of result.warnings) console.warn(warning);
|
|
173
|
-
console.log(result.message);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
176
|
-
process.exit(1);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
loadStatusReport = () => {
|
|
180
|
-
const config = loadConfig();
|
|
181
|
-
const workspaceDir = getWorkspacePath(config.agents.defaults.workspace);
|
|
182
|
-
return {
|
|
183
|
-
config,
|
|
184
|
-
workspaceDir,
|
|
185
|
-
report: buildPluginStatusReport({
|
|
186
|
-
config,
|
|
187
|
-
workspaceDir,
|
|
188
|
-
...buildReservedPluginLoadOptions()
|
|
189
|
-
})
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
buildPluginInfoLines = (plugin, config) => {
|
|
193
|
-
const install = config.plugins.installs?.[plugin.id];
|
|
194
|
-
const lines = this.buildPluginSummaryLines(plugin);
|
|
195
|
-
if (install) {
|
|
196
|
-
lines.push("");
|
|
197
|
-
lines.push(`Install: ${install.source}`);
|
|
198
|
-
this.pushOptionalLine(lines, "Spec", install.spec);
|
|
199
|
-
this.pushOptionalLine(lines, "Source path", install.sourcePath);
|
|
200
|
-
this.pushOptionalLine(lines, "Install path", install.installPath);
|
|
201
|
-
this.pushOptionalLine(lines, "Recorded version", install.version);
|
|
202
|
-
this.pushOptionalLine(lines, "Installed at", install.installedAt);
|
|
203
|
-
}
|
|
204
|
-
return lines;
|
|
205
|
-
};
|
|
206
|
-
buildPluginSummaryLines = (plugin) => {
|
|
207
|
-
const lines = [plugin.name || plugin.id];
|
|
208
|
-
if (plugin.name && plugin.name !== plugin.id) lines.push(`id: ${plugin.id}`);
|
|
209
|
-
if (plugin.description) lines.push(plugin.description);
|
|
210
|
-
lines.push("", `Status: ${plugin.status}`, `Source: ${plugin.source}`, `Origin: ${plugin.origin}`);
|
|
211
|
-
this.pushOptionalLine(lines, "Version", plugin.version);
|
|
212
|
-
appendPluginCapabilityLines(lines, plugin);
|
|
213
|
-
this.pushOptionalLine(lines, "Error", plugin.error);
|
|
214
|
-
return lines;
|
|
215
|
-
};
|
|
216
|
-
pushOptionalLine = (lines, label, value) => {
|
|
217
|
-
if (value) lines.push(`${label}: ${value}`);
|
|
218
|
-
};
|
|
219
|
-
assertPluginCanUninstall = (requestedId, pluginId, plugin, hasEntry, hasInstall) => {
|
|
220
|
-
if (hasEntry || hasInstall) return;
|
|
221
|
-
if (plugin) console.error(`Plugin "${pluginId}" is not managed by plugins config/install records and cannot be uninstalled.`);
|
|
222
|
-
else console.error(`Plugin not found: ${requestedId}`);
|
|
223
|
-
process.exit(1);
|
|
224
|
-
};
|
|
225
|
-
buildUninstallPreview = (params) => {
|
|
226
|
-
const { config, hasEntry, hasInstall, install, keepFiles, pluginId } = params;
|
|
227
|
-
const preview = this.buildUninstallConfigPreview({
|
|
228
|
-
config,
|
|
229
|
-
hasEntry,
|
|
230
|
-
hasInstall,
|
|
231
|
-
install,
|
|
232
|
-
pluginId
|
|
233
|
-
});
|
|
234
|
-
if (!keepFiles) for (const deleteTarget of resolveUninstallDirectoryTargets({
|
|
235
|
-
config,
|
|
236
|
-
pluginId,
|
|
237
|
-
hasInstall,
|
|
238
|
-
installRecord: install
|
|
239
|
-
})) preview.push(`directory: ${deleteTarget}`);
|
|
240
|
-
return preview;
|
|
241
|
-
};
|
|
242
|
-
buildUninstallConfigPreview = (params) => {
|
|
243
|
-
const { config, hasEntry, hasInstall, install, pluginId } = params;
|
|
244
|
-
const preview = [];
|
|
245
|
-
const isLinked = install?.source === "path" && (!install.installPath || !install.sourcePath || resolve(install.installPath) === resolve(install.sourcePath));
|
|
246
|
-
if (hasEntry) preview.push("config entry");
|
|
247
|
-
if (hasInstall) preview.push("install record");
|
|
248
|
-
if (config.plugins.allow?.includes(pluginId)) preview.push("allowlist entry");
|
|
249
|
-
if (isLinked && install?.sourcePath && config.plugins.load?.paths?.includes(install.sourcePath)) preview.push("load path");
|
|
250
|
-
return preview;
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
//#endregion
|
|
254
|
-
export { PluginCommands, loadPluginRegistry, logPluginDiagnostics, mergePluginConfigView, toPluginConfigView };
|
|
255
|
-
|
|
256
|
-
//# sourceMappingURL=index.js.map
|