@nextclaw/service 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli/commands/agent/agent-runtime.utils.d.ts +15 -0
  3. package/dist/cli/commands/agent/agent-runtime.utils.js +85 -0
  4. package/dist/cli/commands/agent/cli-agent-runner.utils.d.ts +21 -0
  5. package/dist/cli/commands/agent/cli-agent-runner.utils.js +89 -0
  6. package/dist/cli/commands/agent/index.d.ts +3 -0
  7. package/dist/cli/commands/agent/index.js +3 -0
  8. package/dist/cli/commands/agent/services/agent-commands.service.d.ts +17 -0
  9. package/dist/cli/commands/agent/services/agent-commands.service.js +112 -0
  10. package/dist/cli/commands/companion/index.d.ts +15 -0
  11. package/dist/cli/commands/companion/index.js +24 -0
  12. package/dist/cli/commands/companion/services/companion-process.service.d.ts +17 -0
  13. package/dist/cli/commands/companion/services/companion-process.service.js +49 -0
  14. package/dist/cli/commands/config/index.d.ts +2 -0
  15. package/dist/cli/commands/config/index.js +2 -0
  16. package/dist/cli/commands/config/services/config-commands.service.d.ts +18 -0
  17. package/dist/cli/commands/config/services/config-commands.service.js +133 -0
  18. package/dist/cli/commands/cron/index.d.ts +2 -0
  19. package/dist/cli/commands/cron/index.js +2 -0
  20. package/dist/cli/commands/cron/services/cron-commands.service.d.ts +22 -0
  21. package/dist/cli/commands/cron/services/cron-commands.service.js +107 -0
  22. package/dist/cli/commands/cron/services/cron-local.service.d.ts +25 -0
  23. package/dist/cli/commands/cron/services/cron-local.service.js +95 -0
  24. package/dist/cli/commands/cron/utils/cron-job.utils.d.ts +31 -0
  25. package/dist/cli/commands/cron/utils/cron-job.utils.js +15 -0
  26. package/dist/cli/commands/diagnostics/index.d.ts +2 -0
  27. package/dist/cli/commands/diagnostics/index.js +2 -0
  28. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.d.ts +22 -0
  29. package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.js +319 -0
  30. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.d.ts +23 -0
  31. package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.js +66 -0
  32. package/dist/cli/commands/gateway/index.d.ts +14 -0
  33. package/dist/cli/commands/gateway/index.js +15 -0
  34. package/dist/cli/commands/logs/index.d.ts +12 -0
  35. package/dist/cli/commands/logs/index.js +29 -0
  36. package/dist/cli/commands/mcp/index.d.ts +14 -0
  37. package/dist/cli/commands/mcp/index.js +193 -0
  38. package/dist/cli/commands/restart/index.d.ts +20 -0
  39. package/dist/cli/commands/restart/index.js +88 -0
  40. package/dist/cli/commands/secrets/index.d.ts +22 -0
  41. package/dist/cli/commands/secrets/index.js +280 -0
  42. package/dist/cli/commands/serve/index.d.ts +14 -0
  43. package/dist/cli/commands/serve/index.js +19 -0
  44. package/dist/cli/commands/skills/index.d.ts +26 -0
  45. package/dist/cli/commands/skills/index.js +147 -0
  46. package/dist/cli/commands/skills/marketplace-client.d.ts +31 -0
  47. package/dist/cli/commands/skills/marketplace-client.js +84 -0
  48. package/dist/cli/commands/skills/marketplace-command-options.utils.d.ts +25 -0
  49. package/dist/cli/commands/skills/marketplace-command-options.utils.js +31 -0
  50. package/dist/cli/commands/skills/marketplace-identity.utils.d.ts +14 -0
  51. package/dist/cli/commands/skills/marketplace-identity.utils.js +77 -0
  52. package/dist/cli/commands/skills/marketplace-network-retry.d.ts +4 -0
  53. package/dist/cli/commands/skills/marketplace-network-retry.js +32 -0
  54. package/dist/cli/commands/skills/marketplace.metadata.d.ts +29 -0
  55. package/dist/cli/commands/skills/marketplace.metadata.js +158 -0
  56. package/dist/cli/commands/skills/marketplace.service.d.ts +46 -0
  57. package/dist/cli/commands/skills/marketplace.service.js +238 -0
  58. package/dist/cli/commands/skills/skills-query.service.d.ts +141 -0
  59. package/dist/cli/commands/skills/skills-query.service.js +212 -0
  60. package/dist/cli/commands/start/index.d.ts +18 -0
  61. package/dist/cli/commands/start/index.js +25 -0
  62. package/dist/cli/commands/stop/index.d.ts +12 -0
  63. package/dist/cli/commands/stop/index.js +11 -0
  64. package/dist/cli/commands/ui/index.d.ts +14 -0
  65. package/dist/cli/commands/ui/index.js +17 -0
  66. package/dist/cli/commands/usage/index.d.ts +2 -0
  67. package/dist/cli/commands/usage/index.js +2 -0
  68. package/dist/cli/commands/usage/services/llm-usage-command.service.d.ts +22 -0
  69. package/dist/cli/commands/usage/services/llm-usage-command.service.js +160 -0
  70. package/dist/cli/commands/usage/services/llm-usage-query.service.d.ts +43 -0
  71. package/dist/cli/commands/usage/services/llm-usage-query.service.js +85 -0
  72. package/dist/commands/channel/channel-config-view.d.ts +7 -0
  73. package/dist/commands/channel/channel-config-view.js +7 -0
  74. package/dist/commands/channel/index.d.ts +28 -0
  75. package/dist/commands/channel/index.js +224 -0
  76. package/dist/commands/platform-auth/index.d.ts +2 -0
  77. package/dist/commands/platform-auth/index.js +2 -0
  78. package/dist/commands/platform-auth/services/account-status.service.d.ts +18 -0
  79. package/dist/commands/platform-auth/services/account-status.service.js +34 -0
  80. package/dist/commands/platform-auth/services/platform-auth-commands.service.d.ts +77 -0
  81. package/dist/commands/platform-auth/services/platform-auth-commands.service.js +295 -0
  82. package/dist/commands/platform-auth/utils/payload.utils.d.ts +28 -0
  83. package/dist/commands/platform-auth/utils/payload.utils.js +87 -0
  84. package/dist/commands/plugin/development-source/dev-plugin-overrides.utils.d.ts +18 -0
  85. package/dist/commands/plugin/development-source/dev-plugin-overrides.utils.js +111 -0
  86. package/dist/commands/plugin/development-source/first-party-plugin-load-paths.d.ts +9 -0
  87. package/dist/commands/plugin/development-source/first-party-plugin-load-paths.js +183 -0
  88. package/dist/commands/plugin/index.d.ts +30 -0
  89. package/dist/commands/plugin/index.js +266 -0
  90. package/dist/commands/plugin/plugin-command-utils.d.ts +13 -0
  91. package/dist/commands/plugin/plugin-command-utils.js +37 -0
  92. package/dist/commands/plugin/plugin-extension-registry.d.ts +10 -0
  93. package/dist/commands/plugin/plugin-extension-registry.js +35 -0
  94. package/dist/commands/plugin/plugin-mutation-actions.d.ts +15 -0
  95. package/dist/commands/plugin/plugin-mutation-actions.js +162 -0
  96. package/dist/commands/plugin/plugin-registry-loader.d.ts +15 -0
  97. package/dist/commands/plugin/plugin-registry-loader.js +43 -0
  98. package/dist/commands/plugin/plugin-reload.d.ts +13 -0
  99. package/dist/commands/plugin/plugin-reload.js +42 -0
  100. package/dist/commands/remote/index.d.ts +47 -0
  101. package/dist/commands/remote/index.js +174 -0
  102. package/dist/commands/remote/services/remote-access-host.service.d.ts +41 -0
  103. package/dist/commands/remote/services/remote-access-host.service.js +126 -0
  104. package/dist/commands/remote/services/remote-runtime-support.service.d.ts +15 -0
  105. package/dist/commands/remote/services/remote-runtime-support.service.js +79 -0
  106. package/dist/commands/remote/services/remote-service-control.service.d.ts +33 -0
  107. package/dist/commands/remote/services/remote-service-control.service.js +188 -0
  108. package/dist/commands/remote/utils/platform-api-base.utils.d.ts +14 -0
  109. package/dist/commands/remote/utils/platform-api-base.utils.js +39 -0
  110. package/dist/commands/service/index.d.ts +16 -0
  111. package/dist/commands/service/index.js +31 -0
  112. package/dist/commands/service/services/autostart/host-autostart-command.service.d.ts +29 -0
  113. package/dist/commands/service/services/autostart/host-autostart-command.service.js +158 -0
  114. package/dist/commands/service/services/autostart/host-autostart-runtime.service.d.ts +23 -0
  115. package/dist/commands/service/services/autostart/host-autostart-runtime.service.js +53 -0
  116. package/dist/commands/service/services/autostart/host-autostart.service.d.ts +41 -0
  117. package/dist/commands/service/services/autostart/host-autostart.service.js +48 -0
  118. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.d.ts +48 -0
  119. package/dist/commands/service/services/autostart/linux-systemd-autostart.service.js +433 -0
  120. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.d.ts +54 -0
  121. package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.js +405 -0
  122. package/dist/commands/service/services/autostart/windows-task-autostart.service.d.ts +54 -0
  123. package/dist/commands/service/services/autostart/windows-task-autostart.service.js +403 -0
  124. package/dist/commands/service/types/autostart/host-autostart.types.d.ts +64 -0
  125. package/dist/commands/service/types/autostart/host-autostart.types.js +1 -0
  126. package/dist/index.d.ts +4 -0
  127. package/dist/index.js +3 -0
  128. package/dist/launcher/npm-runtime-bundle-layout.store.d.ts +23 -0
  129. package/dist/launcher/npm-runtime-bundle-layout.store.js +37 -0
  130. package/dist/launcher/npm-runtime-bundle-manifest.service.d.ts +9 -0
  131. package/dist/launcher/npm-runtime-bundle-manifest.service.js +39 -0
  132. package/dist/launcher/npm-runtime-bundle.service.d.ts +47 -0
  133. package/dist/launcher/npm-runtime-bundle.service.js +150 -0
  134. package/dist/launcher/npm-runtime-bundle.types.d.ts +49 -0
  135. package/dist/launcher/npm-runtime-bundle.types.js +1 -0
  136. package/dist/launcher/npm-runtime-launcher.service.d.ts +19 -0
  137. package/dist/launcher/npm-runtime-launcher.service.js +57 -0
  138. package/dist/launcher/npm-runtime-update-command.service.d.ts +12 -0
  139. package/dist/launcher/npm-runtime-update-command.service.js +87 -0
  140. package/dist/launcher/npm-runtime-update-source.service.d.ts +19 -0
  141. package/dist/launcher/npm-runtime-update-source.service.js +57 -0
  142. package/dist/launcher/npm-runtime-update-state.store.d.ts +17 -0
  143. package/dist/launcher/npm-runtime-update-state.store.js +92 -0
  144. package/dist/launcher/npm-runtime-update.manager.d.ts +42 -0
  145. package/dist/launcher/npm-runtime-update.manager.js +179 -0
  146. package/dist/launcher/npm-runtime-update.service.d.ts +54 -0
  147. package/dist/launcher/npm-runtime-update.service.js +183 -0
  148. package/dist/service-runtime.service.d.ts +91 -0
  149. package/dist/service-runtime.service.js +392 -0
  150. package/dist/shared/controllers/gateway.controller.d.ts +61 -0
  151. package/dist/shared/controllers/gateway.controller.js +318 -0
  152. package/dist/shared/services/extensions/extension-lifecycle.service.d.ts +56 -0
  153. package/dist/shared/services/extensions/extension-lifecycle.service.js +143 -0
  154. package/dist/shared/services/extensions/service-extension-runtime.service.d.ts +51 -0
  155. package/dist/shared/services/extensions/service-extension-runtime.service.js +338 -0
  156. package/dist/shared/services/gateway/cron-job-handler.service.d.ts +26 -0
  157. package/dist/shared/services/gateway/cron-job-handler.service.js +100 -0
  158. package/dist/shared/services/gateway/gateway-restart-wake.service.d.ts +12 -0
  159. package/dist/shared/services/gateway/gateway-restart-wake.service.js +91 -0
  160. package/dist/shared/services/gateway/managers/gateway-plugin.manager.d.ts +37 -0
  161. package/dist/shared/services/gateway/managers/gateway-plugin.manager.js +218 -0
  162. package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts +20 -0
  163. package/dist/shared/services/gateway/managers/gateway-remote.manager.js +25 -0
  164. package/dist/shared/services/gateway/nextclaw-app.service.d.ts +22 -0
  165. package/dist/shared/services/gateway/nextclaw-app.service.js +53 -0
  166. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts +89 -0
  167. package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js +337 -0
  168. package/dist/shared/services/gateway/service-bootstrap-status.d.ts +33 -0
  169. package/dist/shared/services/gateway/service-bootstrap-status.js +152 -0
  170. package/dist/shared/services/gateway/service-startup-support.service.d.ts +42 -0
  171. package/dist/shared/services/gateway/service-startup-support.service.js +96 -0
  172. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts +9 -0
  173. package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js +10 -0
  174. package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts +31 -0
  175. package/dist/shared/services/marketplace/service-marketplace-installer.service.js +99 -0
  176. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.d.ts +39 -0
  177. package/dist/shared/services/marketplace/service-mcp-marketplace-ops.js +67 -0
  178. package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.d.ts +24 -0
  179. package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.js +117 -0
  180. package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.d.ts +6 -0
  181. package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.js +96 -0
  182. package/dist/shared/services/restart/restart-coordinator.service.d.ts +30 -0
  183. package/dist/shared/services/restart/restart-coordinator.service.js +51 -0
  184. package/dist/shared/services/restart/restart-sentinel.service.d.ts +39 -0
  185. package/dist/shared/services/restart/restart-sentinel.service.js +88 -0
  186. package/dist/shared/services/restart/runtime-restart-request.service.d.ts +24 -0
  187. package/dist/shared/services/restart/runtime-restart-request.service.js +42 -0
  188. package/dist/shared/services/runtime/runtime-command.service.d.ts +37 -0
  189. package/dist/shared/services/runtime/runtime-command.service.js +163 -0
  190. package/dist/shared/services/runtime/runtime-config-init.service.d.ts +4 -0
  191. package/dist/shared/services/runtime/runtime-config-init.service.js +10 -0
  192. package/dist/shared/services/runtime/service-managed-startup.service.d.ts +146 -0
  193. package/dist/shared/services/runtime/service-managed-startup.service.js +426 -0
  194. package/dist/shared/services/runtime/service-remote-runtime.service.d.ts +53 -0
  195. package/dist/shared/services/runtime/service-remote-runtime.service.js +173 -0
  196. package/dist/shared/services/runtime/utils/skills-loader.utils.d.ts +12 -0
  197. package/dist/shared/services/runtime/utils/skills-loader.utils.js +9 -0
  198. package/dist/shared/services/session/service-deferred-ncp-agent.service.d.ts +14 -0
  199. package/dist/shared/services/session/service-deferred-ncp-agent.service.js +85 -0
  200. package/dist/shared/services/ui/companion-runtime.service.d.ts +33 -0
  201. package/dist/shared/services/ui/companion-runtime.service.js +145 -0
  202. package/dist/shared/services/ui/local-ui-discovery.service.d.ts +19 -0
  203. package/dist/shared/services/ui/local-ui-discovery.service.js +41 -0
  204. package/dist/shared/services/ui/npm-runtime-update-host.service.d.ts +40 -0
  205. package/dist/shared/services/ui/npm-runtime-update-host.service.js +181 -0
  206. package/dist/shared/services/ui/runtime-control-host.service.d.ts +28 -0
  207. package/dist/shared/services/ui/runtime-control-host.service.js +89 -0
  208. package/dist/shared/services/ui/service-remote-access.service.d.ts +25 -0
  209. package/dist/shared/services/ui/service-remote-access.service.js +38 -0
  210. package/dist/shared/services/ui/ui-bridge-api.service.d.ts +16 -0
  211. package/dist/shared/services/ui/ui-bridge-api.service.js +43 -0
  212. package/dist/shared/services/workspace/workspace-manager.service.d.ts +19 -0
  213. package/dist/shared/services/workspace/workspace-manager.service.js +135 -0
  214. package/dist/shared/stores/companion-runtime.store.d.ts +15 -0
  215. package/dist/shared/stores/companion-runtime.store.js +27 -0
  216. package/dist/shared/stores/local-ui-runtime.store.d.ts +25 -0
  217. package/dist/shared/stores/local-ui-runtime.store.js +54 -0
  218. package/dist/shared/stores/managed-service-state.store.d.ts +28 -0
  219. package/dist/shared/stores/managed-service-state.store.js +38 -0
  220. package/dist/shared/stores/pending-restart.store.d.ts +21 -0
  221. package/dist/shared/stores/pending-restart.store.js +35 -0
  222. package/dist/shared/types/cli.types.d.ts +295 -0
  223. package/dist/shared/types/cli.types.js +1 -0
  224. package/dist/shared/utils/cli.utils.d.ts +34 -0
  225. package/dist/shared/utils/cli.utils.js +262 -0
  226. package/dist/shared/utils/config-path.d.ts +15 -0
  227. package/dist/shared/utils/config-path.js +167 -0
  228. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.d.ts +16 -0
  229. package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.js +46 -0
  230. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.d.ts +9 -0
  231. package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.js +33 -0
  232. package/dist/shared/utils/package/package-manifest.utils.d.ts +8 -0
  233. package/dist/shared/utils/package/package-manifest.utils.js +48 -0
  234. package/dist/shared/utils/runtime-helpers.d.ts +14 -0
  235. package/dist/shared/utils/runtime-helpers.js +26 -0
  236. package/dist/shared/utils/service-port-probe.utils.d.ts +41 -0
  237. package/dist/shared/utils/service-port-probe.utils.js +164 -0
  238. package/dist/shared/utils/startup-trace.d.ts +7 -0
  239. package/dist/shared/utils/startup-trace.js +37 -0
  240. package/dist/shared/utils/top-level-nextclaw-command-env.utils.d.ts +4 -0
  241. package/dist/shared/utils/top-level-nextclaw-command-env.utils.js +10 -0
  242. package/package.json +68 -0
@@ -0,0 +1,183 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import path from "node:path";
3
+ import { getDataPath } from "@nextclaw/core";
4
+ import fs from "node:fs";
5
+ //#region src/commands/plugin/development-source/first-party-plugin-load-paths.ts
6
+ const readJsonFile = (filePath) => {
7
+ try {
8
+ const raw = fs.readFileSync(filePath, "utf-8");
9
+ const parsed = JSON.parse(raw);
10
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ };
15
+ const readString = (value) => {
16
+ if (typeof value !== "string") return;
17
+ return value.trim() || void 0;
18
+ };
19
+ const toPluginIdFromPackageName = (packageName) => {
20
+ const trimmed = packageName.trim();
21
+ if (!trimmed) return "";
22
+ return trimmed.includes("/") ? trimmed.split("/").pop() ?? trimmed : trimmed;
23
+ };
24
+ const normalizeInstallRecordPath = (value) => {
25
+ const filePath = readString(value);
26
+ return filePath ? path.resolve(filePath) : void 0;
27
+ };
28
+ const resolveDevFirstPartyPluginDir = (explicitDir, moduleDir = path.dirname(fileURLToPath(import.meta.url))) => {
29
+ const configured = explicitDir?.trim();
30
+ if (configured) return configured;
31
+ const inferred = path.resolve(moduleDir, "../../../../../extensions");
32
+ return fs.existsSync(inferred) ? inferred : void 0;
33
+ };
34
+ const hasOpenClawExtensions = (pkg) => {
35
+ const openclaw = pkg.openclaw;
36
+ if (!openclaw || typeof openclaw !== "object" || Array.isArray(openclaw)) return false;
37
+ const extensions = openclaw.extensions;
38
+ return Array.isArray(extensions) && extensions.some((entry) => typeof entry === "string" && entry.trim().length > 0);
39
+ };
40
+ const hasOpenClawDevelopmentExtensions = (pkg) => {
41
+ const openclaw = pkg.openclaw;
42
+ if (!openclaw || typeof openclaw !== "object" || Array.isArray(openclaw)) return false;
43
+ const development = openclaw.development;
44
+ if (!development || typeof development !== "object" || Array.isArray(development)) return false;
45
+ const extensions = development.extensions;
46
+ return Array.isArray(extensions) && extensions.some((entry) => typeof entry === "string" && entry.trim().length > 0);
47
+ };
48
+ const normalizePackageSpec = (spec) => {
49
+ const trimmed = spec.trim();
50
+ if (!trimmed) return;
51
+ if (trimmed.startsWith("@")) {
52
+ const slashIndex = trimmed.indexOf("/");
53
+ if (slashIndex < 0) return;
54
+ const secondAtIndex = trimmed.indexOf("@", slashIndex + 1);
55
+ return secondAtIndex < 0 ? trimmed : trimmed.slice(0, secondAtIndex);
56
+ }
57
+ const versionIndex = trimmed.indexOf("@");
58
+ return versionIndex < 0 ? trimmed : trimmed.slice(0, versionIndex);
59
+ };
60
+ const readWorkspacePluginPackages = (workspaceExtensionsDir) => {
61
+ if (!workspaceExtensionsDir.trim() || !fs.existsSync(workspaceExtensionsDir)) return [];
62
+ const entries = fs.readdirSync(workspaceExtensionsDir, { withFileTypes: true });
63
+ const packages = [];
64
+ for (const entry of entries) {
65
+ if (!entry.isDirectory()) continue;
66
+ const packageDir = path.join(workspaceExtensionsDir, entry.name);
67
+ const pkg = readJsonFile(path.join(packageDir, "package.json"));
68
+ if (!pkg || !hasOpenClawExtensions(pkg)) continue;
69
+ const packageName = readString(pkg.name);
70
+ if (!packageName?.startsWith("@nextclaw/")) continue;
71
+ packages.push({
72
+ pluginId: toPluginIdFromPackageName(packageName),
73
+ packageName,
74
+ dir: packageDir,
75
+ supportsDevelopmentSource: hasOpenClawDevelopmentExtensions(pkg)
76
+ });
77
+ }
78
+ return packages;
79
+ };
80
+ const readInstalledFirstPartyPluginMatches = (workspaceExtensionsDir) => {
81
+ const workspacePackages = readWorkspacePluginPackages(workspaceExtensionsDir);
82
+ if (workspacePackages.length === 0) return [];
83
+ const globalExtensionsDir = path.join(getDataPath(), "extensions");
84
+ if (!fs.existsSync(globalExtensionsDir)) return [];
85
+ const workspacePackageByName = new Map(workspacePackages.map((entry) => [entry.packageName, entry]));
86
+ const entries = fs.readdirSync(globalExtensionsDir, { withFileTypes: true });
87
+ const matches = [];
88
+ for (const entry of entries) {
89
+ if (!entry.isDirectory()) continue;
90
+ const packageDir = path.join(globalExtensionsDir, entry.name);
91
+ const packageName = readString(readJsonFile(path.join(packageDir, "package.json"))?.name);
92
+ if (!packageName) continue;
93
+ const workspacePackage = workspacePackageByName.get(packageName);
94
+ if (!workspacePackage) continue;
95
+ matches.push({
96
+ packageName,
97
+ workspaceDir: workspacePackage.dir,
98
+ installPath: packageDir
99
+ });
100
+ }
101
+ return matches;
102
+ };
103
+ const mergeLoadPaths = (existingLoadPaths, devLoadPaths) => {
104
+ const mergedLoadPaths = [...devLoadPaths];
105
+ for (const entry of existingLoadPaths) if (!mergedLoadPaths.includes(entry)) mergedLoadPaths.push(entry);
106
+ return mergedLoadPaths;
107
+ };
108
+ const findWorkspacePackageForInstallRecord = (installRecord, workspacePackages, packageByName) => {
109
+ const packageName = normalizePackageSpec(readString(installRecord.spec) ?? "");
110
+ if (packageName) {
111
+ const matchedByPackageName = packageByName.get(packageName);
112
+ if (matchedByPackageName) return matchedByPackageName;
113
+ }
114
+ const installPathCandidates = new Set([installRecord.sourcePath, installRecord.installPath].map(normalizeInstallRecordPath).filter((entry) => Boolean(entry)));
115
+ if (installPathCandidates.size === 0) return;
116
+ return workspacePackages.find((workspacePackage) => installPathCandidates.has(path.resolve(workspacePackage.dir)));
117
+ };
118
+ const resolveDevFirstPartyPluginLoadPaths = (config, workspaceExtensionsDir) => {
119
+ const rootDir = resolveDevFirstPartyPluginDir(workspaceExtensionsDir);
120
+ if (!rootDir) return [];
121
+ const workspacePackages = readWorkspacePluginPackages(rootDir);
122
+ if (workspacePackages.length === 0) return [];
123
+ const installedPluginMatches = readInstalledFirstPartyPluginMatches(rootDir);
124
+ const packageDirByName = new Map(workspacePackages.map((entry) => [entry.packageName, entry.dir]));
125
+ const packageByName = new Map(workspacePackages.map((entry) => [entry.packageName, entry]));
126
+ const loadPaths = [];
127
+ const installs = config.plugins.installs ?? {};
128
+ for (const installRecord of Object.values(installs)) {
129
+ const matchedWorkspacePackage = findWorkspacePackageForInstallRecord(installRecord, workspacePackages, packageByName);
130
+ const packageDir = matchedWorkspacePackage ? matchedWorkspacePackage.dir : packageDirByName.get(normalizePackageSpec(readString(installRecord.spec) ?? "") ?? "");
131
+ if (!packageDir || loadPaths.includes(packageDir)) continue;
132
+ loadPaths.push(packageDir);
133
+ }
134
+ for (const installedPlugin of installedPluginMatches) {
135
+ if (loadPaths.includes(installedPlugin.workspaceDir)) continue;
136
+ loadPaths.push(installedPlugin.workspaceDir);
137
+ }
138
+ return loadPaths;
139
+ };
140
+ const resolveDevFirstPartyPluginInstallRoots = (config, workspaceExtensionsDir) => {
141
+ const rootDir = resolveDevFirstPartyPluginDir(workspaceExtensionsDir);
142
+ if (!rootDir) return [];
143
+ const workspacePackages = readWorkspacePluginPackages(rootDir);
144
+ if (workspacePackages.length === 0) return [];
145
+ const packageNames = new Set(workspacePackages.map((entry) => entry.packageName));
146
+ const packageByName = new Map(workspacePackages.map((entry) => [entry.packageName, entry]));
147
+ const installRoots = [];
148
+ const installedPluginMatches = readInstalledFirstPartyPluginMatches(rootDir);
149
+ for (const installedPlugin of installedPluginMatches) {
150
+ if (installRoots.includes(installedPlugin.installPath)) continue;
151
+ installRoots.push(installedPlugin.installPath);
152
+ }
153
+ for (const installRecord of Object.values(config.plugins.installs ?? {})) {
154
+ const workspacePackage = findWorkspacePackageForInstallRecord(installRecord, workspacePackages, packageByName);
155
+ const packageName = normalizePackageSpec(readString(installRecord.spec) ?? "");
156
+ if (!workspacePackage && (!packageName || !packageNames.has(packageName))) continue;
157
+ const installPath = readString(installRecord.installPath);
158
+ if (!installPath || installRoots.includes(installPath)) continue;
159
+ if (workspacePackage && path.resolve(installPath) === path.resolve(workspacePackage.dir)) continue;
160
+ installRoots.push(installPath);
161
+ }
162
+ return installRoots;
163
+ };
164
+ const applyDevFirstPartyPluginLoadPaths = (config, workspaceExtensionsDir) => {
165
+ const rootDir = resolveDevFirstPartyPluginDir(workspaceExtensionsDir);
166
+ if (!rootDir) return config;
167
+ if (readWorkspacePluginPackages(rootDir).length === 0) return config;
168
+ const devLoadPaths = resolveDevFirstPartyPluginLoadPaths(config, rootDir);
169
+ if (devLoadPaths.length === 0) return config;
170
+ const mergedLoadPaths = mergeLoadPaths(Array.isArray(config.plugins.load?.paths) ? config.plugins.load.paths.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [], devLoadPaths);
171
+ return {
172
+ ...config,
173
+ plugins: {
174
+ ...config.plugins,
175
+ load: {
176
+ ...config.plugins.load,
177
+ paths: mergedLoadPaths
178
+ }
179
+ }
180
+ };
181
+ };
182
+ //#endregion
183
+ export { applyDevFirstPartyPluginLoadPaths, resolveDevFirstPartyPluginDir, resolveDevFirstPartyPluginInstallRoots, resolveDevFirstPartyPluginLoadPaths };
@@ -0,0 +1,30 @@
1
+ import { PluginsInfoOptions, PluginsInstallOptions, PluginsListOptions, PluginsUninstallOptions } from "../../shared/types/cli.types.js";
2
+ import { NextclawExtensionRegistry, toExtensionRegistry } from "./plugin-extension-registry.js";
3
+ import { createEmptyPluginRegistry } from "./plugin-registry-loader.js";
4
+ import { Config } from "@nextclaw/core";
5
+ import { PluginRegistry, mergePluginConfigView, toPluginConfigView } from "@nextclaw/openclaw-compat";
6
+
7
+ //#region src/commands/plugin/index.d.ts
8
+ declare function loadPluginRegistry(config: Config, workspaceDir: string): PluginRegistry;
9
+ declare function logPluginDiagnostics(registry: PluginRegistry): void;
10
+ declare class PluginCommands {
11
+ list: (opts?: PluginsListOptions) => void;
12
+ info: (id: string, opts?: PluginsInfoOptions) => void;
13
+ enable: (id: string) => Promise<void>;
14
+ disable: (id: string) => Promise<void>;
15
+ uninstall: (id: string, opts?: PluginsUninstallOptions) => Promise<void>;
16
+ install: (pathOrSpec: string, opts?: PluginsInstallOptions) => Promise<void>;
17
+ doctor: () => void;
18
+ private confirmYesNo;
19
+ private confirmUninstall;
20
+ private runUninstallMutation;
21
+ private loadStatusReport;
22
+ private buildPluginInfoLines;
23
+ private buildPluginSummaryLines;
24
+ private pushOptionalLine;
25
+ private assertPluginCanUninstall;
26
+ private buildUninstallPreview;
27
+ private buildUninstallConfigPreview;
28
+ }
29
+ //#endregion
30
+ export { type NextclawExtensionRegistry, PluginCommands, createEmptyPluginRegistry, loadPluginRegistry, logPluginDiagnostics, mergePluginConfigView, toExtensionRegistry, toPluginConfigView };
@@ -0,0 +1,266 @@
1
+ import { appendPluginCapabilityLines, buildReservedPluginLoadOptions } from "./plugin-command-utils.js";
2
+ import { disablePluginMutation, enablePluginMutation, installPluginMutation, uninstallPluginMutation } from "./plugin-mutation-actions.js";
3
+ import { resolveDevFirstPartyPluginDir } from "./development-source/first-party-plugin-load-paths.js";
4
+ import { resolveDevPluginLoadingContext } from "./development-source/dev-plugin-overrides.utils.js";
5
+ import { toExtensionRegistry } from "./plugin-extension-registry.js";
6
+ import { createEmptyPluginRegistry } from "./plugin-registry-loader.js";
7
+ import { resolve } from "node:path";
8
+ import { getWorkspacePath, loadConfig } from "@nextclaw/core";
9
+ import { createInterface } from "node:readline";
10
+ import { buildPluginStatusReport, loadOpenClawPlugins, mergePluginConfigView, resolveUninstallDirectoryTargets, toPluginConfigView } from "@nextclaw/openclaw-compat";
11
+ //#region src/commands/plugin/index.ts
12
+ function loadPluginRegistry(config, workspaceDir) {
13
+ const { configWithDevPluginOverrides, excludedRoots } = resolveDevPluginLoadingContext(config, resolveDevFirstPartyPluginDir(process.env.NEXTCLAW_DEV_FIRST_PARTY_PLUGIN_DIR));
14
+ return loadOpenClawPlugins({
15
+ config: configWithDevPluginOverrides,
16
+ workspaceDir,
17
+ excludeRoots: excludedRoots,
18
+ ...buildReservedPluginLoadOptions(),
19
+ logger: {
20
+ info: (message) => console.log(message),
21
+ warn: (message) => console.warn(message),
22
+ error: (message) => console.error(message),
23
+ debug: (message) => console.debug(message)
24
+ }
25
+ });
26
+ }
27
+ function logPluginDiagnostics(registry) {
28
+ for (const diag of registry.diagnostics) {
29
+ const text = `${diag.pluginId ? `${diag.pluginId}: ` : ""}${diag.message}`;
30
+ if (diag.level === "error") console.error(`[plugins] ${text}`);
31
+ else console.warn(`[plugins] ${text}`);
32
+ }
33
+ }
34
+ var PluginCommands = class {
35
+ list = (opts = {}) => {
36
+ const { report, workspaceDir } = this.loadStatusReport();
37
+ const list = opts.enabled ? report.plugins.filter((plugin) => plugin.status === "loaded") : report.plugins;
38
+ if (opts.json) {
39
+ console.log(JSON.stringify({
40
+ workspaceDir,
41
+ plugins: list,
42
+ diagnostics: report.diagnostics
43
+ }, null, 2));
44
+ return;
45
+ }
46
+ if (list.length === 0) {
47
+ console.log("No plugins discovered.");
48
+ return;
49
+ }
50
+ for (const plugin of list) {
51
+ const status = plugin.status === "loaded" ? "loaded" : plugin.status === "disabled" ? "disabled" : "error";
52
+ const title = plugin.name && plugin.name !== plugin.id ? `${plugin.name} (${plugin.id})` : plugin.id;
53
+ if (!opts.verbose) {
54
+ const desc = plugin.description ? plugin.description.length > 80 ? `${plugin.description.slice(0, 77)}...` : plugin.description : "(no description)";
55
+ console.log(`${title} ${status} - ${desc}`);
56
+ continue;
57
+ }
58
+ console.log(`${title} ${status}`);
59
+ console.log(` source: ${plugin.source}`);
60
+ console.log(` origin: ${plugin.origin}`);
61
+ if (plugin.version) console.log(` version: ${plugin.version}`);
62
+ const capabilityLines = [];
63
+ appendPluginCapabilityLines(capabilityLines, plugin);
64
+ for (const line of capabilityLines) console.log(` ${line.toLowerCase()}`);
65
+ if (plugin.error) console.log(` error: ${plugin.error}`);
66
+ console.log("");
67
+ }
68
+ };
69
+ info = (id, opts = {}) => {
70
+ const { config, report } = this.loadStatusReport();
71
+ const plugin = report.plugins.find((entry) => entry.id === id || entry.name === id);
72
+ if (!plugin) {
73
+ console.error(`Plugin not found: ${id}`);
74
+ process.exit(1);
75
+ }
76
+ if (opts.json) {
77
+ console.log(JSON.stringify(plugin, null, 2));
78
+ return;
79
+ }
80
+ console.log(this.buildPluginInfoLines(plugin, config).join("\n"));
81
+ };
82
+ enable = async (id) => {
83
+ try {
84
+ const result = await enablePluginMutation(id);
85
+ console.log(result.message);
86
+ } catch (error) {
87
+ console.error(error instanceof Error ? error.message : String(error));
88
+ process.exit(1);
89
+ }
90
+ console.log("If gateway is running, plugin changes are hot-applied automatically.");
91
+ };
92
+ disable = async (id) => {
93
+ try {
94
+ const result = await disablePluginMutation(id);
95
+ console.log(result.message);
96
+ } catch (error) {
97
+ console.error(error instanceof Error ? error.message : String(error));
98
+ process.exit(1);
99
+ }
100
+ console.log("If gateway is running, plugin changes are hot-applied automatically.");
101
+ };
102
+ uninstall = async (id, opts = {}) => {
103
+ if (opts.keepConfig) console.log("`--keep-config` is deprecated, use `--keep-files`.");
104
+ const { config, report } = this.loadStatusReport();
105
+ const keepFiles = Boolean(opts.keepFiles || opts.keepConfig);
106
+ const plugin = report.plugins.find((entry) => entry.id === id || entry.name === id);
107
+ const pluginId = plugin?.id ?? id;
108
+ const hasEntry = pluginId in (config.plugins.entries ?? {});
109
+ const hasInstall = pluginId in (config.plugins.installs ?? {});
110
+ this.assertPluginCanUninstall(id, pluginId, plugin, hasEntry, hasInstall);
111
+ const install = config.plugins.installs?.[pluginId];
112
+ const preview = this.buildUninstallPreview({
113
+ config,
114
+ hasEntry,
115
+ hasInstall,
116
+ install,
117
+ keepFiles,
118
+ pluginId
119
+ });
120
+ const pluginName = plugin?.name || pluginId;
121
+ const pluginTitle = pluginName !== pluginId ? `${pluginName} (${pluginId})` : pluginName;
122
+ console.log(`Plugin: ${pluginTitle}`);
123
+ console.log(`Will remove: ${preview.length > 0 ? preview.join(", ") : "(nothing)"}`);
124
+ if (opts.dryRun) {
125
+ console.log("Dry run, no changes made.");
126
+ return;
127
+ }
128
+ if (!await this.confirmUninstall(pluginId, opts)) return;
129
+ await this.runUninstallMutation(id, opts);
130
+ console.log("If gateway is running, plugin changes are hot-applied automatically.");
131
+ };
132
+ install = async (pathOrSpec, opts = {}) => {
133
+ try {
134
+ const result = await installPluginMutation(pathOrSpec, opts);
135
+ console.log(result.message);
136
+ } catch (error) {
137
+ console.error(error instanceof Error ? error.message : String(error));
138
+ process.exit(1);
139
+ }
140
+ console.log("If gateway is running, plugin changes are hot-applied automatically.");
141
+ };
142
+ doctor = () => {
143
+ const { report } = this.loadStatusReport();
144
+ const pluginErrors = report.plugins.filter((plugin) => plugin.status === "error");
145
+ const diagnostics = report.diagnostics.filter((diag) => diag.level === "error");
146
+ if (pluginErrors.length === 0 && diagnostics.length === 0) {
147
+ console.log("No plugin issues detected.");
148
+ return;
149
+ }
150
+ if (pluginErrors.length > 0) {
151
+ console.log("Plugin errors:");
152
+ for (const entry of pluginErrors) console.log(`- ${entry.id}: ${entry.error ?? "failed to load"} (${entry.source})`);
153
+ }
154
+ if (diagnostics.length > 0) {
155
+ if (pluginErrors.length > 0) console.log("");
156
+ console.log("Diagnostics:");
157
+ for (const diag of diagnostics) {
158
+ const prefix = diag.pluginId ? `${diag.pluginId}: ` : "";
159
+ console.log(`- ${prefix}${diag.message}`);
160
+ }
161
+ }
162
+ };
163
+ confirmYesNo = async (question) => {
164
+ const rl = createInterface({
165
+ input: process.stdin,
166
+ output: process.stdout
167
+ });
168
+ const answer = await new Promise((resolve) => {
169
+ rl.question(`${question} [y/N] `, (line) => resolve(line));
170
+ });
171
+ rl.close();
172
+ const normalized = answer.trim().toLowerCase();
173
+ return normalized === "y" || normalized === "yes";
174
+ };
175
+ confirmUninstall = async (pluginId, opts) => {
176
+ if (opts.force) return true;
177
+ const confirmed = await this.confirmYesNo(`Uninstall plugin "${pluginId}"?`);
178
+ if (!confirmed) console.log("Cancelled.");
179
+ return confirmed;
180
+ };
181
+ runUninstallMutation = async (id, opts) => {
182
+ try {
183
+ const result = await uninstallPluginMutation(id, opts);
184
+ for (const warning of result.warnings) console.warn(warning);
185
+ console.log(result.message);
186
+ } catch (error) {
187
+ console.error(error instanceof Error ? error.message : String(error));
188
+ process.exit(1);
189
+ }
190
+ };
191
+ loadStatusReport = () => {
192
+ const config = loadConfig();
193
+ const workspaceDir = getWorkspacePath(config.agents.defaults.workspace);
194
+ return {
195
+ config,
196
+ workspaceDir,
197
+ report: buildPluginStatusReport({
198
+ config,
199
+ workspaceDir,
200
+ ...buildReservedPluginLoadOptions()
201
+ })
202
+ };
203
+ };
204
+ buildPluginInfoLines = (plugin, config) => {
205
+ const install = config.plugins.installs?.[plugin.id];
206
+ const lines = this.buildPluginSummaryLines(plugin);
207
+ if (install) {
208
+ lines.push("");
209
+ lines.push(`Install: ${install.source}`);
210
+ this.pushOptionalLine(lines, "Spec", install.spec);
211
+ this.pushOptionalLine(lines, "Source path", install.sourcePath);
212
+ this.pushOptionalLine(lines, "Install path", install.installPath);
213
+ this.pushOptionalLine(lines, "Recorded version", install.version);
214
+ this.pushOptionalLine(lines, "Installed at", install.installedAt);
215
+ }
216
+ return lines;
217
+ };
218
+ buildPluginSummaryLines = (plugin) => {
219
+ const lines = [plugin.name || plugin.id];
220
+ if (plugin.name && plugin.name !== plugin.id) lines.push(`id: ${plugin.id}`);
221
+ if (plugin.description) lines.push(plugin.description);
222
+ lines.push("", `Status: ${plugin.status}`, `Source: ${plugin.source}`, `Origin: ${plugin.origin}`);
223
+ this.pushOptionalLine(lines, "Version", plugin.version);
224
+ appendPluginCapabilityLines(lines, plugin);
225
+ this.pushOptionalLine(lines, "Error", plugin.error);
226
+ return lines;
227
+ };
228
+ pushOptionalLine = (lines, label, value) => {
229
+ if (value) lines.push(`${label}: ${value}`);
230
+ };
231
+ assertPluginCanUninstall = (requestedId, pluginId, plugin, hasEntry, hasInstall) => {
232
+ if (hasEntry || hasInstall) return;
233
+ if (plugin) console.error(`Plugin "${pluginId}" is not managed by plugins config/install records and cannot be uninstalled.`);
234
+ else console.error(`Plugin not found: ${requestedId}`);
235
+ process.exit(1);
236
+ };
237
+ buildUninstallPreview = (params) => {
238
+ const { config, hasEntry, hasInstall, install, keepFiles, pluginId } = params;
239
+ const preview = this.buildUninstallConfigPreview({
240
+ config,
241
+ hasEntry,
242
+ hasInstall,
243
+ install,
244
+ pluginId
245
+ });
246
+ if (!keepFiles) for (const deleteTarget of resolveUninstallDirectoryTargets({
247
+ config,
248
+ pluginId,
249
+ hasInstall,
250
+ installRecord: install
251
+ })) preview.push(`directory: ${deleteTarget}`);
252
+ return preview;
253
+ };
254
+ buildUninstallConfigPreview = (params) => {
255
+ const { config, hasEntry, hasInstall, install, pluginId } = params;
256
+ const preview = [];
257
+ const isLinked = install?.source === "path" && (!install.installPath || !install.sourcePath || resolve(install.installPath) === resolve(install.sourcePath));
258
+ if (hasEntry) preview.push("config entry");
259
+ if (hasInstall) preview.push("install record");
260
+ if (config.plugins.allow?.includes(pluginId)) preview.push("allowlist entry");
261
+ if (isLinked && install?.sourcePath && config.plugins.load?.paths?.includes(install.sourcePath)) preview.push("load path");
262
+ return preview;
263
+ };
264
+ };
265
+ //#endregion
266
+ export { PluginCommands, createEmptyPluginRegistry, loadPluginRegistry, logPluginDiagnostics, mergePluginConfigView, toExtensionRegistry, toPluginConfigView };
@@ -0,0 +1,13 @@
1
+ import { PluginRegistry } from "@nextclaw/openclaw-compat";
2
+
3
+ //#region src/commands/plugin/plugin-command-utils.d.ts
4
+ declare const RESERVED_PROVIDER_IDS: string[];
5
+ declare function buildReservedPluginLoadOptions(): {
6
+ reservedToolNames: ("cron" | "read_file" | "write_file" | "edit_file" | "list_dir" | "exec" | "web_search" | "web_fetch" | "message" | "spawn" | "sessions_list" | "sessions_history" | "memory_search" | "memory_get" | "subagents" | "gateway")[];
7
+ reservedChannelIds: string[];
8
+ reservedProviderIds: string[];
9
+ reservedNcpAgentRuntimeKinds: string[];
10
+ };
11
+ declare function appendPluginCapabilityLines(lines: string[], plugin: PluginRegistry["plugins"][number]): void;
12
+ //#endregion
13
+ export { RESERVED_PROVIDER_IDS, appendPluginCapabilityLines, buildReservedPluginLoadOptions };
@@ -0,0 +1,37 @@
1
+ import { builtinProviderIds } from "@nextclaw/runtime";
2
+ //#region src/commands/plugin/plugin-command-utils.ts
3
+ const RESERVED_PROVIDER_IDS = builtinProviderIds();
4
+ const RESERVED_TOOL_NAMES = [
5
+ "read_file",
6
+ "write_file",
7
+ "edit_file",
8
+ "list_dir",
9
+ "exec",
10
+ "web_search",
11
+ "web_fetch",
12
+ "message",
13
+ "spawn",
14
+ "sessions_list",
15
+ "sessions_history",
16
+ "memory_search",
17
+ "memory_get",
18
+ "subagents",
19
+ "gateway",
20
+ "cron"
21
+ ];
22
+ function buildReservedPluginLoadOptions() {
23
+ return {
24
+ reservedToolNames: [...RESERVED_TOOL_NAMES],
25
+ reservedChannelIds: [],
26
+ reservedProviderIds: RESERVED_PROVIDER_IDS,
27
+ reservedNcpAgentRuntimeKinds: ["native"]
28
+ };
29
+ }
30
+ function appendPluginCapabilityLines(lines, plugin) {
31
+ if (plugin.toolNames.length > 0) lines.push(`Tools: ${plugin.toolNames.join(", ")}`);
32
+ if (plugin.channelIds.length > 0) lines.push(`Channels: ${plugin.channelIds.join(", ")}`);
33
+ if (plugin.providerIds.length > 0) lines.push(`Providers: ${plugin.providerIds.join(", ")}`);
34
+ if (plugin.ncpAgentRuntimeKinds.length > 0) lines.push(`NCP runtimes: ${plugin.ncpAgentRuntimeKinds.join(", ")}`);
35
+ }
36
+ //#endregion
37
+ export { RESERVED_PROVIDER_IDS, appendPluginCapabilityLines, buildReservedPluginLoadOptions };
@@ -0,0 +1,10 @@
1
+ import { ExtensionRegistry } from "@nextclaw/core";
2
+ import { PluginNcpAgentRuntimeRegistration, PluginRegistry } from "@nextclaw/openclaw-compat";
3
+
4
+ //#region src/commands/plugin/plugin-extension-registry.d.ts
5
+ type NextclawExtensionRegistry = ExtensionRegistry & {
6
+ ncpAgentRuntimes: PluginNcpAgentRuntimeRegistration[];
7
+ };
8
+ declare function toExtensionRegistry(pluginRegistry: PluginRegistry): NextclawExtensionRegistry;
9
+ //#endregion
10
+ export { NextclawExtensionRegistry, toExtensionRegistry };
@@ -0,0 +1,35 @@
1
+ //#region src/commands/plugin/plugin-extension-registry.ts
2
+ function toExtensionRegistry(pluginRegistry) {
3
+ return {
4
+ tools: pluginRegistry.tools.map((tool) => ({
5
+ extensionId: tool.pluginId,
6
+ factory: tool.factory,
7
+ names: tool.names,
8
+ optional: tool.optional,
9
+ source: tool.source
10
+ })),
11
+ channels: pluginRegistry.channels.map((channel) => ({
12
+ extensionId: channel.pluginId,
13
+ channel: channel.channel,
14
+ source: channel.source
15
+ })),
16
+ ncpAgentRuntimes: pluginRegistry.ncpAgentRuntimes.map((runtime) => ({
17
+ pluginId: runtime.pluginId,
18
+ kind: runtime.kind,
19
+ label: runtime.label,
20
+ createRuntime: runtime.createRuntime,
21
+ createRuntimeForEntry: runtime.createRuntimeForEntry,
22
+ describeSessionType: runtime.describeSessionType,
23
+ describeSessionTypeForEntry: runtime.describeSessionTypeForEntry,
24
+ source: runtime.source
25
+ })),
26
+ diagnostics: pluginRegistry.diagnostics.map((diag) => ({
27
+ level: diag.level,
28
+ message: diag.message,
29
+ extensionId: diag.pluginId,
30
+ source: diag.source
31
+ }))
32
+ };
33
+ }
34
+ //#endregion
35
+ export { toExtensionRegistry };
@@ -0,0 +1,15 @@
1
+ import { PluginsInstallOptions, PluginsUninstallOptions } from "../../shared/types/cli.types.js";
2
+
3
+ //#region src/commands/plugin/plugin-mutation-actions.d.ts
4
+ type PluginMutationResult = {
5
+ message: string;
6
+ };
7
+ type PluginUninstallMutationResult = PluginMutationResult & {
8
+ warnings: string[];
9
+ };
10
+ declare function enablePluginMutation(id: string): Promise<PluginMutationResult>;
11
+ declare function disablePluginMutation(id: string): Promise<PluginMutationResult>;
12
+ declare function uninstallPluginMutation(id: string, opts?: PluginsUninstallOptions): Promise<PluginUninstallMutationResult>;
13
+ declare function installPluginMutation(pathOrSpec: string, opts?: PluginsInstallOptions): Promise<PluginMutationResult>;
14
+ //#endregion
15
+ export { PluginMutationResult, PluginUninstallMutationResult, disablePluginMutation, enablePluginMutation, installPluginMutation, uninstallPluginMutation };