@evref-bl/plexus 0.15.1 → 0.16.0

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 (255) hide show
  1. package/README.md +8 -12
  2. package/dist/cli.js +8 -183
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commandLine.d.ts +13 -0
  5. package/dist/commandLine.d.ts.map +1 -0
  6. package/dist/commandLine.js +247 -0
  7. package/dist/commandLine.js.map +1 -0
  8. package/dist/config/pharoMcpVersion.d.ts +6 -7
  9. package/dist/config/pharoMcpVersion.d.ts.map +1 -1
  10. package/dist/config/pharoMcpVersion.js +6 -7
  11. package/dist/config/pharoMcpVersion.js.map +1 -1
  12. package/dist/errors.d.ts +11 -0
  13. package/dist/errors.d.ts.map +1 -0
  14. package/dist/errors.js +17 -0
  15. package/dist/errors.js.map +1 -0
  16. package/dist/forward/endpointHandoffFormat.d.ts +23 -0
  17. package/dist/forward/endpointHandoffFormat.d.ts.map +1 -0
  18. package/dist/forward/endpointHandoffFormat.js.map +1 -0
  19. package/dist/forward/index.d.ts +20 -0
  20. package/dist/forward/index.d.ts.map +1 -0
  21. package/dist/forward/index.js +77 -0
  22. package/dist/forward/index.js.map +1 -0
  23. package/dist/forward/jsonRpc.d.ts +20 -0
  24. package/dist/forward/jsonRpc.d.ts.map +1 -0
  25. package/dist/forward/jsonRpc.js +141 -0
  26. package/dist/forward/jsonRpc.js.map +1 -0
  27. package/dist/home.d.ts +15 -0
  28. package/dist/home.d.ts.map +1 -0
  29. package/dist/home.js +30 -0
  30. package/dist/home.js.map +1 -0
  31. package/dist/images/bases.d.ts +40 -0
  32. package/dist/images/bases.d.ts.map +1 -0
  33. package/dist/images/bases.js +190 -0
  34. package/dist/images/bases.js.map +1 -0
  35. package/dist/images/claims.d.ts +34 -0
  36. package/dist/images/claims.d.ts.map +1 -0
  37. package/dist/images/claims.js +119 -0
  38. package/dist/images/claims.js.map +1 -0
  39. package/dist/images/context.d.ts +22 -0
  40. package/dist/images/context.d.ts.map +1 -0
  41. package/dist/images/context.js +26 -0
  42. package/dist/images/context.js.map +1 -0
  43. package/dist/images/create.d.ts +19 -0
  44. package/dist/images/create.d.ts.map +1 -0
  45. package/dist/images/create.js +121 -0
  46. package/dist/images/create.js.map +1 -0
  47. package/dist/images/delete.d.ts +10 -0
  48. package/dist/images/delete.d.ts.map +1 -0
  49. package/dist/images/delete.js +31 -0
  50. package/dist/images/delete.js.map +1 -0
  51. package/dist/images/endpoint.d.ts +17 -0
  52. package/dist/images/endpoint.d.ts.map +1 -0
  53. package/dist/images/endpoint.js +58 -0
  54. package/dist/images/endpoint.js.map +1 -0
  55. package/dist/images/index.d.ts +28 -0
  56. package/dist/images/index.d.ts.map +1 -0
  57. package/dist/images/index.js +51 -0
  58. package/dist/images/index.js.map +1 -0
  59. package/dist/images/leftovers.d.ts +9 -0
  60. package/dist/images/leftovers.d.ts.map +1 -0
  61. package/dist/images/leftovers.js +38 -0
  62. package/dist/images/leftovers.js.map +1 -0
  63. package/dist/images/list.d.ts +12 -0
  64. package/dist/images/list.d.ts.map +1 -0
  65. package/dist/images/list.js +74 -0
  66. package/dist/images/list.js.map +1 -0
  67. package/dist/images/names.d.ts +15 -0
  68. package/dist/images/names.d.ts.map +1 -0
  69. package/dist/images/names.js +53 -0
  70. package/dist/images/names.js.map +1 -0
  71. package/dist/images/prepare.d.ts +18 -0
  72. package/dist/images/prepare.d.ts.map +1 -0
  73. package/dist/images/prepare.js +58 -0
  74. package/dist/images/prepare.js.map +1 -0
  75. package/dist/images/processes.d.ts +21 -0
  76. package/dist/images/processes.d.ts.map +1 -0
  77. package/dist/images/processes.js +83 -0
  78. package/dist/images/processes.js.map +1 -0
  79. package/dist/images/scripts.d.ts +39 -0
  80. package/dist/images/scripts.d.ts.map +1 -0
  81. package/dist/images/scripts.js +127 -0
  82. package/dist/images/scripts.js.map +1 -0
  83. package/dist/images/start.d.ts +23 -0
  84. package/dist/images/start.d.ts.map +1 -0
  85. package/dist/images/start.js +173 -0
  86. package/dist/images/start.js.map +1 -0
  87. package/dist/images/stop.d.ts +11 -0
  88. package/dist/images/stop.d.ts.map +1 -0
  89. package/dist/images/stop.js +42 -0
  90. package/dist/images/stop.js.map +1 -0
  91. package/dist/images/store.d.ts +62 -0
  92. package/dist/images/store.d.ts.map +1 -0
  93. package/dist/images/store.js +180 -0
  94. package/dist/images/store.js.map +1 -0
  95. package/dist/images/templates.d.ts +14 -0
  96. package/dist/images/templates.d.ts.map +1 -0
  97. package/dist/images/templates.js +84 -0
  98. package/dist/images/templates.js.map +1 -0
  99. package/dist/index.d.ts +12 -22
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +8 -22
  102. package/dist/index.js.map +1 -1
  103. package/dist/launcher/pharoLauncherMcpClient.d.ts +22 -59
  104. package/dist/launcher/pharoLauncherMcpClient.d.ts.map +1 -1
  105. package/dist/launcher/pharoLauncherMcpClient.js +128 -87
  106. package/dist/launcher/pharoLauncherMcpClient.js.map +1 -1
  107. package/dist/launcher/pharoLauncherProfile.d.ts +7 -29
  108. package/dist/launcher/pharoLauncherProfile.d.ts.map +1 -1
  109. package/dist/launcher/pharoLauncherProfile.js +19 -111
  110. package/dist/launcher/pharoLauncherProfile.js.map +1 -1
  111. package/dist/launcher/vmRenewal.d.ts +30 -0
  112. package/dist/launcher/vmRenewal.d.ts.map +1 -0
  113. package/dist/launcher/vmRenewal.js +58 -0
  114. package/dist/launcher/vmRenewal.js.map +1 -0
  115. package/dist/mcp/server.d.ts +18 -0
  116. package/dist/mcp/server.d.ts.map +1 -0
  117. package/dist/mcp/server.js +206 -0
  118. package/dist/mcp/server.js.map +1 -0
  119. package/dist/types.d.ts +68 -0
  120. package/dist/types.d.ts.map +1 -0
  121. package/dist/types.js +2 -0
  122. package/dist/types.js.map +1 -0
  123. package/dist/version.d.ts +2 -0
  124. package/dist/version.d.ts.map +1 -0
  125. package/dist/version.js +5 -0
  126. package/dist/version.js.map +1 -0
  127. package/package.json +3 -12
  128. package/dist/config/config.d.ts +0 -15
  129. package/dist/config/config.d.ts.map +0 -1
  130. package/dist/config/config.js +0 -74
  131. package/dist/config/config.js.map +0 -1
  132. package/dist/config/plexusHome.d.ts +0 -17
  133. package/dist/config/plexusHome.d.ts.map +0 -1
  134. package/dist/config/plexusHome.js +0 -30
  135. package/dist/config/plexusHome.js.map +0 -1
  136. package/dist/config/projectConfig.d.ts +0 -141
  137. package/dist/config/projectConfig.d.ts.map +0 -1
  138. package/dist/config/projectConfig.js +0 -722
  139. package/dist/config/projectConfig.js.map +0 -1
  140. package/dist/config/projectConfigAuthoring.d.ts +0 -53
  141. package/dist/config/projectConfigAuthoring.d.ts.map +0 -1
  142. package/dist/config/projectConfigAuthoring.js +0 -159
  143. package/dist/config/projectConfigAuthoring.js.map +0 -1
  144. package/dist/gateway/projectImageMcpEndpoint.d.ts +0 -23
  145. package/dist/gateway/projectImageMcpEndpoint.d.ts.map +0 -1
  146. package/dist/gateway/projectImageMcpEndpoint.js +0 -40
  147. package/dist/gateway/projectImageMcpEndpoint.js.map +0 -1
  148. package/dist/gateway/server/index.d.ts +0 -8
  149. package/dist/gateway/server/index.d.ts.map +0 -1
  150. package/dist/gateway/server/index.js +0 -34
  151. package/dist/gateway/server/index.js.map +0 -1
  152. package/dist/gateway/server/mcp/server.d.ts +0 -66
  153. package/dist/gateway/server/mcp/server.d.ts.map +0 -1
  154. package/dist/gateway/server/mcp/server.js +0 -458
  155. package/dist/gateway/server/mcp/server.js.map +0 -1
  156. package/dist/gateway/server/routing/endpointHandoffFormat.d.ts +0 -26
  157. package/dist/gateway/server/routing/endpointHandoffFormat.d.ts.map +0 -1
  158. package/dist/gateway/server/routing/endpointHandoffFormat.js.map +0 -1
  159. package/dist/gateway/server/routing/gateway.d.ts +0 -167
  160. package/dist/gateway/server/routing/gateway.d.ts.map +0 -1
  161. package/dist/gateway/server/routing/gateway.js +0 -863
  162. package/dist/gateway/server/routing/gateway.js.map +0 -1
  163. package/dist/gateway/server/routing/imageMcpRouter.d.ts +0 -59
  164. package/dist/gateway/server/routing/imageMcpRouter.d.ts.map +0 -1
  165. package/dist/gateway/server/routing/imageMcpRouter.js +0 -253
  166. package/dist/gateway/server/routing/imageMcpRouter.js.map +0 -1
  167. package/dist/gateway/server/routing/pharoFacade.d.ts +0 -12
  168. package/dist/gateway/server/routing/pharoFacade.d.ts.map +0 -1
  169. package/dist/gateway/server/routing/pharoFacade.js +0 -67
  170. package/dist/gateway/server/routing/pharoFacade.js.map +0 -1
  171. package/dist/gateway/server/routing/routeDiscovery.d.ts +0 -26
  172. package/dist/gateway/server/routing/routeDiscovery.d.ts.map +0 -1
  173. package/dist/gateway/server/routing/routeDiscovery.js +0 -46
  174. package/dist/gateway/server/routing/routeDiscovery.js.map +0 -1
  175. package/dist/gateway/server/routing/routingTable.d.ts +0 -120
  176. package/dist/gateway/server/routing/routingTable.d.ts.map +0 -1
  177. package/dist/gateway/server/routing/routingTable.js +0 -215
  178. package/dist/gateway/server/routing/routingTable.js.map +0 -1
  179. package/dist/gateway/server/support/processLiveness.d.ts +0 -10
  180. package/dist/gateway/server/support/processLiveness.d.ts.map +0 -1
  181. package/dist/gateway/server/support/processLiveness.js +0 -25
  182. package/dist/gateway/server/support/processLiveness.js.map +0 -1
  183. package/dist/gateway/server/support/sourceBuildPreflight.d.ts +0 -15
  184. package/dist/gateway/server/support/sourceBuildPreflight.d.ts.map +0 -1
  185. package/dist/gateway/server/support/sourceBuildPreflight.js +0 -88
  186. package/dist/gateway/server/support/sourceBuildPreflight.js.map +0 -1
  187. package/dist/gateway/server/support/toolResultFormatting.d.ts +0 -8
  188. package/dist/gateway/server/support/toolResultFormatting.d.ts.map +0 -1
  189. package/dist/gateway/server/support/toolResultFormatting.js +0 -74
  190. package/dist/gateway/server/support/toolResultFormatting.js.map +0 -1
  191. package/dist/images/homeImageCache.d.ts +0 -302
  192. package/dist/images/homeImageCache.d.ts.map +0 -1
  193. package/dist/images/homeImageCache.js +0 -1024
  194. package/dist/images/homeImageCache.js.map +0 -1
  195. package/dist/images/imageRescue.d.ts +0 -151
  196. package/dist/images/imageRescue.d.ts.map +0 -1
  197. package/dist/images/imageRescue.js +0 -748
  198. package/dist/images/imageRescue.js.map +0 -1
  199. package/dist/images/imageRuntime.d.ts +0 -60
  200. package/dist/images/imageRuntime.d.ts.map +0 -1
  201. package/dist/images/imageRuntime.js +0 -90
  202. package/dist/images/imageRuntime.js.map +0 -1
  203. package/dist/images/preparedImageCache.d.ts +0 -86
  204. package/dist/images/preparedImageCache.d.ts.map +0 -1
  205. package/dist/images/preparedImageCache.js +0 -229
  206. package/dist/images/preparedImageCache.js.map +0 -1
  207. package/dist/images/scopedTemplateCatalog.d.ts +0 -33
  208. package/dist/images/scopedTemplateCatalog.d.ts.map +0 -1
  209. package/dist/images/scopedTemplateCatalog.js +0 -363
  210. package/dist/images/scopedTemplateCatalog.js.map +0 -1
  211. package/dist/internal.d.ts +0 -20
  212. package/dist/internal.d.ts.map +0 -1
  213. package/dist/internal.js +0 -20
  214. package/dist/internal.js.map +0 -1
  215. package/dist/launcher/scopedPharoLauncherServer.d.ts +0 -349
  216. package/dist/launcher/scopedPharoLauncherServer.d.ts.map +0 -1
  217. package/dist/launcher/scopedPharoLauncherServer.js +0 -1307
  218. package/dist/launcher/scopedPharoLauncherServer.js.map +0 -1
  219. package/dist/lifecycle/startProjectImage.d.ts +0 -94
  220. package/dist/lifecycle/startProjectImage.d.ts.map +0 -1
  221. package/dist/lifecycle/startProjectImage.js +0 -1008
  222. package/dist/lifecycle/startProjectImage.js.map +0 -1
  223. package/dist/lifecycle/stopProjectImage.d.ts +0 -31
  224. package/dist/lifecycle/stopProjectImage.d.ts.map +0 -1
  225. package/dist/lifecycle/stopProjectImage.js +0 -201
  226. package/dist/lifecycle/stopProjectImage.js.map +0 -1
  227. package/dist/mcp/agentServer.d.ts +0 -15
  228. package/dist/mcp/agentServer.d.ts.map +0 -1
  229. package/dist/mcp/agentServer.js +0 -67
  230. package/dist/mcp/agentServer.js.map +0 -1
  231. package/dist/mcp/imageOperations.d.ts +0 -54
  232. package/dist/mcp/imageOperations.d.ts.map +0 -1
  233. package/dist/mcp/imageOperations.js +0 -223
  234. package/dist/mcp/imageOperations.js.map +0 -1
  235. package/dist/mcp/pharoMcpHealth.d.ts +0 -26
  236. package/dist/mcp/pharoMcpHealth.d.ts.map +0 -1
  237. package/dist/mcp/pharoMcpHealth.js +0 -97
  238. package/dist/mcp/pharoMcpHealth.js.map +0 -1
  239. package/dist/support/pathStyle.d.ts +0 -11
  240. package/dist/support/pathStyle.d.ts.map +0 -1
  241. package/dist/support/pathStyle.js +0 -61
  242. package/dist/support/pathStyle.js.map +0 -1
  243. package/dist/support/toolResultFormatting.d.ts +0 -8
  244. package/dist/support/toolResultFormatting.d.ts.map +0 -1
  245. package/dist/support/toolResultFormatting.js +0 -74
  246. package/dist/support/toolResultFormatting.js.map +0 -1
  247. package/dist/workspace/projectStartupScript.d.ts +0 -73
  248. package/dist/workspace/projectStartupScript.d.ts.map +0 -1
  249. package/dist/workspace/projectStartupScript.js +0 -607
  250. package/dist/workspace/projectStartupScript.js.map +0 -1
  251. package/dist/workspace/projectState.d.ts +0 -216
  252. package/dist/workspace/projectState.d.ts.map +0 -1
  253. package/dist/workspace/projectState.js +0 -172
  254. package/dist/workspace/projectState.js.map +0 -1
  255. /package/dist/{gateway/server/routing → forward}/endpointHandoffFormat.js +0 -0
@@ -1,115 +1,23 @@
1
- import { projectConfigId, resolveProjectRuntimePolicy, } from "../config/projectConfig.js";
2
- import { joinPathLike, resolvePathLike } from "../support/pathStyle.js";
3
- import { resolvePlexusHomePath } from "../config/plexusHome.js";
4
- import { sanitizeRuntimeId } from "../workspace/projectState.js";
5
- const launcherProfileEnvironmentKeys = [
6
- "PHARO_LAUNCHER_MCP_PROFILE",
7
- "PHARO_LAUNCHER_MCP_STATE_ROOT",
8
- "PHARO_LAUNCHER_MCP_LAUNCHER_IMAGE",
9
- "PHARO_LAUNCHER_MCP_IMAGES_DIR",
10
- "PHARO_LAUNCHER_MCP_VMS_DIR",
11
- "PHARO_LAUNCHER_MCP_TEMPLATE_SOURCES_DIR",
12
- "PHARO_LAUNCHER_MCP_INIT_SCRIPTS_DIR",
13
- "PHARO_LAUNCHER_MCP_LOGS_DIR",
14
- "PHARO_LAUNCHER_MCP_LAUNCHER_CONFIGURATION",
15
- ];
16
- function profileName(config) {
17
- return ["plexus", sanitizeRuntimeId(projectConfigId(config))].join("-");
18
- }
19
- function defaultProfileRoot(config, env) {
20
- // Shared across projects: the launcher image, VMs and templates are large and identical.
21
- return joinPathLike(resolvePlexusHomePath({ config, env }), "profiles");
22
- }
23
- function projectOwnedPaths(options) {
24
- const runtime = resolveProjectRuntimePolicy(options.config);
25
- const policy = runtime.launcherProfile;
26
- const stateRoot = policy.root
27
- ? resolvePathLike(policy.root)
28
- : defaultProfileRoot(options.config, options.env);
29
- return {
30
- profileName: policy.name ?? profileName(options.config),
31
- stateRoot,
32
- launcherImage: joinPathLike(stateRoot, "launcher", "PharoLauncher.image"),
33
- imagesDir: joinPathLike(stateRoot, "images"),
34
- vmsDir: joinPathLike(stateRoot, "vms"),
35
- templateSourcesDir: joinPathLike(stateRoot, "templates"),
36
- initScriptsDir: joinPathLike(stateRoot, "init-scripts"),
37
- logsDir: joinPathLike(stateRoot, "logs"),
38
- launcherConfiguration: joinPathLike(stateRoot, "launcher", "pharo-launcher-cli-config.ston"),
39
- };
40
- }
41
- function environmentFromPaths(paths) {
42
- return {
43
- PHARO_LAUNCHER_MCP_PROFILE: paths.profileName,
44
- PHARO_LAUNCHER_MCP_STATE_ROOT: paths.stateRoot,
45
- PHARO_LAUNCHER_MCP_LAUNCHER_IMAGE: paths.launcherImage,
46
- PHARO_LAUNCHER_MCP_IMAGES_DIR: paths.imagesDir,
47
- PHARO_LAUNCHER_MCP_VMS_DIR: paths.vmsDir,
48
- PHARO_LAUNCHER_MCP_TEMPLATE_SOURCES_DIR: paths.templateSourcesDir,
49
- PHARO_LAUNCHER_MCP_INIT_SCRIPTS_DIR: paths.initScriptsDir,
50
- PHARO_LAUNCHER_MCP_LOGS_DIR: paths.logsDir,
51
- PHARO_LAUNCHER_MCP_LAUNCHER_CONFIGURATION: paths.launcherConfiguration,
52
- };
53
- }
54
- function externallySuppliedPaths(env) {
55
- return {
56
- profileName: env.PHARO_LAUNCHER_MCP_PROFILE,
57
- stateRoot: env.PHARO_LAUNCHER_MCP_STATE_ROOT,
58
- launcherImage: env.PHARO_LAUNCHER_MCP_LAUNCHER_IMAGE,
59
- imagesDir: env.PHARO_LAUNCHER_MCP_IMAGES_DIR,
60
- vmsDir: env.PHARO_LAUNCHER_MCP_VMS_DIR,
61
- templateSourcesDir: env.PHARO_LAUNCHER_MCP_TEMPLATE_SOURCES_DIR,
62
- initScriptsDir: env.PHARO_LAUNCHER_MCP_INIT_SCRIPTS_DIR,
63
- logsDir: env.PHARO_LAUNCHER_MCP_LOGS_DIR,
64
- launcherConfiguration: env.PHARO_LAUNCHER_MCP_LAUNCHER_CONFIGURATION,
65
- };
66
- }
67
- function presentEnvironmentKeys(env) {
68
- return launcherProfileEnvironmentKeys.filter((key) => env[key] !== undefined);
69
- }
70
- export function pharoLauncherMcpProfileEnvironment(options) {
71
- const runtime = resolveProjectRuntimePolicy(options.config);
72
- if (runtime.launcherProfile.mode !== "project-owned") {
73
- return undefined;
74
- }
75
- return environmentFromPaths(projectOwnedPaths(options));
76
- }
77
- export function describePharoLauncherMcpProfile(options) {
78
- const runtime = resolveProjectRuntimePolicy(options.config);
79
- if (runtime.launcherProfile.mode === "project-owned") {
80
- const paths = projectOwnedPaths(options);
81
- const profileScope = runtime.launcherProfile.name || runtime.launcherProfile.root
82
- ? "explicit-override"
83
- : "project";
84
- return {
85
- ownership: "plexus-owned",
86
- mode: "project-owned",
87
- profileScope,
88
- ...paths,
89
- environmentKeys: Object.keys(environmentFromPaths(paths)).sort((left, right) => left.localeCompare(right)),
90
- reason: profileScope === "project"
91
- ? "PLexus derives and passes a project-scoped pharo-launcher-mcp profile."
92
- : "PLexus passes an explicitly configured project-owned pharo-launcher-mcp profile override.",
93
- };
94
- }
95
- const env = options.env ?? process.env;
96
- const environmentKeys = presentEnvironmentKeys(env).sort((left, right) => left.localeCompare(right));
97
- if (environmentKeys.length === 0) {
98
- return {
99
- ownership: "unknown",
100
- mode: "external",
101
- profileScope: "unknown",
102
- environmentKeys,
103
- reason: "runtime.launcherProfile.mode is external, but no pharo-launcher-mcp profile environment is visible.",
104
- };
105
- }
1
+ import path from "node:path";
2
+ import { profileRoot } from "../home.js";
3
+ /**
4
+ * PLexus's one launcher profile, as the launcher's own variables.
5
+ *
6
+ * One profile, so the launcher image, the VMs and the templates, which are
7
+ * large and the same for every image, exist once per home.
8
+ */
9
+ export function homeProfileEnvironment(home) {
10
+ const root = profileRoot(home);
106
11
  return {
107
- ownership: "external",
108
- mode: "external",
109
- profileScope: "external",
110
- ...externallySuppliedPaths(env),
111
- environmentKeys,
112
- reason: "runtime.launcherProfile.mode is external, so PLexus preserves the supplied pharo-launcher-mcp profile environment.",
12
+ PHARO_LAUNCHER_MCP_PROFILE: "plexus",
13
+ PHARO_LAUNCHER_MCP_STATE_ROOT: root,
14
+ PHARO_LAUNCHER_MCP_LAUNCHER_IMAGE: path.join(root, "launcher", "PharoLauncher.image"),
15
+ PHARO_LAUNCHER_MCP_IMAGES_DIR: path.join(root, "images"),
16
+ PHARO_LAUNCHER_MCP_VMS_DIR: path.join(root, "vms"),
17
+ PHARO_LAUNCHER_MCP_TEMPLATE_SOURCES_DIR: path.join(root, "templates"),
18
+ PHARO_LAUNCHER_MCP_INIT_SCRIPTS_DIR: path.join(root, "init-scripts"),
19
+ PHARO_LAUNCHER_MCP_LOGS_DIR: path.join(root, "logs"),
20
+ PHARO_LAUNCHER_MCP_LAUNCHER_CONFIGURATION: path.join(root, "launcher", "pharo-launcher-cli-config.ston"),
113
21
  };
114
22
  }
115
23
  //# sourceMappingURL=pharoLauncherProfile.js.map
@@ -1 +1 @@
1
- {"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AAI,EAAE,KAAK,CAAC;QAClD,uCAAuC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;QACrE,mCAAmC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;QACpE,2BAA2B,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QACpD,yCAAyC,EAAE,IAAI,CAAC,IAAI,CAClD,IAAI,EACJ,UAAU,EACV,gCAAgC,CACjC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * What to do about a Pharo VM that cannot run an image.
3
+ *
4
+ * A launcher fills a VM slot (`140-x64`) once and runs from it for good, so a
5
+ * VM gets old, and a system update can leave it unable to start an image: the
6
+ * one PLexus built its image cache with aborted on macOS 27 while allocating
7
+ * the heap. It still answers `--version`, so nothing short of a launch shows
8
+ * it. Removing the slot is the repair: the launcher installs a VM that is
9
+ * missing, the current one. PLexus says so rather than doing it, since a VM
10
+ * error from another cause would remove a VM that running images use.
11
+ */
12
+ /**
13
+ * The VM slot a profile-scoped launch ran, from the launcher's report of it,
14
+ * and whether the launch installed that VM itself, which makes it the current
15
+ * one.
16
+ */
17
+ export declare function launchedVmSlot(launcherReport: string): {
18
+ vmId: string;
19
+ slot: string;
20
+ installedNow: boolean;
21
+ } | undefined;
22
+ /**
23
+ * The repair for a launch whose VM stopped with its fatal-error report, or
24
+ * nothing when the output shows no such report or the slot is unknown.
25
+ *
26
+ * @param vmOutput what the VM wrote before it stopped
27
+ * @param launcherReport the launcher's report of the launch, naming the VM
28
+ */
29
+ export declare function vmRenewalHint(vmOutput: string, launcherReport: string): string | undefined;
30
+ //# sourceMappingURL=vmRenewal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vmRenewal.d.ts","sourceRoot":"","sources":["../../src/launcher/vmRenewal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAWnE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,MAAM,GAAG,SAAS,CAepB"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * What to do about a Pharo VM that cannot run an image.
3
+ *
4
+ * A launcher fills a VM slot (`140-x64`) once and runs from it for good, so a
5
+ * VM gets old, and a system update can leave it unable to start an image: the
6
+ * one PLexus built its image cache with aborted on macOS 27 while allocating
7
+ * the heap. It still answers `--version`, so nothing short of a launch shows
8
+ * it. Removing the slot is the repair: the launcher installs a VM that is
9
+ * missing, the current one. PLexus says so rather than doing it, since a VM
10
+ * error from another cause would remove a VM that running images use.
11
+ */
12
+ // The Pharo VM's own report of a fatal error, printed before it exits, so
13
+ // before any image code could have run.
14
+ const vmFatalErrorBanner = "VM Error";
15
+ /**
16
+ * The VM slot a profile-scoped launch ran, from the launcher's report of it,
17
+ * and whether the launch installed that VM itself, which makes it the current
18
+ * one.
19
+ */
20
+ export function launchedVmSlot(launcherReport) {
21
+ const vmPath = /^vm: (.+)$/m.exec(launcherReport)?.[1]?.trim();
22
+ const vmId = /^vmId: (.+)$/m.exec(launcherReport)?.[1]?.trim();
23
+ if (!vmPath || !vmId) {
24
+ return undefined;
25
+ }
26
+ const match = new RegExp(`^(.*[\\\\/]${escapeRegExp(vmId)})[\\\\/]`).exec(vmPath);
27
+ if (!match) {
28
+ return undefined;
29
+ }
30
+ return { vmId, slot: match[1], installedNow: /^vmUpdated: true$/m.test(launcherReport) };
31
+ }
32
+ /**
33
+ * The repair for a launch whose VM stopped with its fatal-error report, or
34
+ * nothing when the output shows no such report or the slot is unknown.
35
+ *
36
+ * @param vmOutput what the VM wrote before it stopped
37
+ * @param launcherReport the launcher's report of the launch, naming the VM
38
+ */
39
+ export function vmRenewalHint(vmOutput, launcherReport) {
40
+ if (!vmOutput.includes(vmFatalErrorBanner)) {
41
+ return undefined;
42
+ }
43
+ const vm = launchedVmSlot(launcherReport);
44
+ if (!vm) {
45
+ return undefined;
46
+ }
47
+ if (vm.installedNow) {
48
+ // Removing it again would download the same VM and fail the same way.
49
+ return `The Pharo VM ${vm.vmId} was installed by this launch, so it is the current one,`
50
+ + " and it still stopped before its image ran: renewing it will not help on this system.";
51
+ }
52
+ return `The Pharo VM ${vm.vmId} stopped before its image ran, which a VM older than this system can do.`
53
+ + ` Remove ${vm.slot} and start again: the current VM is installed in its place.`;
54
+ }
55
+ function escapeRegExp(text) {
56
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
57
+ }
58
+ //# sourceMappingURL=vmRenewal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vmRenewal.js","sourceRoot":"","sources":["../../src/launcher/vmRenewal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0EAA0E;AAC1E,wCAAwC;AACxC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,cAAsB;IAEtB,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAC/D,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAC/D,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,cAAc,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClF,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;AAC3F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAgB,EAChB,cAAsB;IAEtB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;IAC1C,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,EAAE,CAAC,YAAY,EAAE,CAAC;QACpB,sEAAsE;QACtE,OAAO,gBAAgB,EAAE,CAAC,IAAI,0DAA0D;cACpF,uFAAuF,CAAC;IAC9F,CAAC;IACD,OAAO,gBAAgB,EAAE,CAAC,IAAI,0EAA0E;UACpG,WAAW,EAAE,CAAC,IAAI,6DAA6D,CAAC;AACtF,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `plexus mcp`: the image tools, and the tools of the images running in
3
+ * scope, each forwarded to the image it names.
4
+ */
5
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
+ import { type CallToolResult, type Tool } from "@modelcontextprotocol/sdk/types.js";
7
+ import type { Images } from "../images/index.js";
8
+ import type { Endpoint } from "../types.js";
9
+ export type ImagesApi = Pick<Images, "templates" | "list" | "create" | "start" | "stop" | "delete">;
10
+ export interface PlexusMcpServerOptions {
11
+ images: ImagesApi;
12
+ listTools?: (endpoint: Endpoint) => Promise<Tool[]>;
13
+ callTool?: (endpoint: Endpoint, name: string, args: Record<string, unknown>) => Promise<CallToolResult>;
14
+ }
15
+ export declare const imageTools: Tool[];
16
+ export declare function createPlexusMcpServer(options: PlexusMcpServerOptions): Server;
17
+ export declare function runPlexusMcpServer(options: PlexusMcpServerOptions): Promise<void>;
18
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,IAAI,EACV,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAW,QAAQ,EAAa,MAAM,aAAa,CAAC;AAGhE,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,MAAM,EACN,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAC9D,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,QAAQ,CAAC,EAAE,CACT,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9B;AAWD,eAAO,MAAM,UAAU,EAAE,IAAI,EAwD5B,CAAC;AAIF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAoD7E;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvF"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * `plexus mcp`: the image tools, and the tools of the images running in
3
+ * scope, each forwarded to the image it names.
4
+ */
5
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
8
+ import { PlexusError } from "../errors.js";
9
+ import { callTool, listTools } from "../forward/index.js";
10
+ import { plexusVersion } from "../version.js";
11
+ const nameProperty = { type: "string", description: "The image's name." };
12
+ function schema(properties, required = []) {
13
+ return { type: "object", properties, required, additionalProperties: false };
14
+ }
15
+ export const imageTools = [
16
+ {
17
+ name: "image_templates",
18
+ description: "List the templates an image can be created from, with their category. A template marked ambiguous is in several categories, so a create from it must name one.",
19
+ inputSchema: schema({}),
20
+ },
21
+ {
22
+ name: "image_create",
23
+ description: "Create an image from a template, with MCP loaded and saved in it. It is not started.",
24
+ inputSchema: schema({
25
+ name: nameProperty,
26
+ template: { type: "string", description: "The template's name." },
27
+ category: {
28
+ type: "string",
29
+ description: "The template's category, needed when its name is ambiguous.",
30
+ },
31
+ }, ["name", "template"]),
32
+ },
33
+ {
34
+ name: "image_start",
35
+ description: "Start an image and wait until its MCP server answers; its tools are then listed here. It refuses an image that is already running.",
36
+ inputSchema: schema({
37
+ name: nameProperty,
38
+ display: {
39
+ type: "string",
40
+ enum: ["headless", "interactive"],
41
+ description: "headless unless interactive is asked for.",
42
+ },
43
+ }, ["name"]),
44
+ },
45
+ {
46
+ name: "image_stop",
47
+ description: "Stop an image by killing every VM that runs it. It kills without saving, so save through the image first to keep its changes.",
48
+ inputSchema: schema({ name: nameProperty }, ["name"]),
49
+ },
50
+ {
51
+ name: "image_delete",
52
+ description: "Delete an image and its directory. It refuses an image that is running.",
53
+ inputSchema: schema({ name: nameProperty }, ["name"]),
54
+ },
55
+ {
56
+ name: "image_list",
57
+ description: "List the images, whether each is running and where its MCP server answers. Name one to see only that one.",
58
+ inputSchema: schema({ name: nameProperty }),
59
+ },
60
+ ];
61
+ const imageToolNames = new Set(imageTools.map((tool) => tool.name));
62
+ export function createPlexusMcpServer(options) {
63
+ const images = options.images;
64
+ const listToolsOf = options.listTools ?? ((endpoint) => listTools(endpoint));
65
+ const callToolOn = options.callTool ??
66
+ ((endpoint, name, args) => callTool(endpoint, name, args));
67
+ const server = new Server({ name: "plexus", version: plexusVersion }, { capabilities: { tools: { listChanged: true } } });
68
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
69
+ const running = forwardable(await images.list().catch(() => []));
70
+ const names = running.map((image) => image.name);
71
+ const listings = await Promise.allSettled(running.map((image) => listToolsOf(image.endpoint)));
72
+ const forwarded = new Map();
73
+ for (const listing of listings) {
74
+ // An image that cannot list its tools now leaves the others listed.
75
+ if (listing.status !== "fulfilled") {
76
+ continue;
77
+ }
78
+ for (const tool of listing.value) {
79
+ if (!imageToolNames.has(tool.name) && !forwarded.has(tool.name)) {
80
+ forwarded.set(tool.name, withImageArgument(tool, names));
81
+ }
82
+ }
83
+ }
84
+ return { tools: [...imageTools, ...forwarded.values()] };
85
+ });
86
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
87
+ const name = request.params.name;
88
+ const args = (request.params.arguments ?? {});
89
+ if (!imageToolNames.has(name)) {
90
+ return forward(images, callToolOn, name, args);
91
+ }
92
+ try {
93
+ const result = await callImageTool(images, name, args);
94
+ if (name === "image_start" || name === "image_stop" || name === "image_delete") {
95
+ await server.sendToolListChanged();
96
+ }
97
+ return text(JSON.stringify(result, null, 2));
98
+ }
99
+ catch (error) {
100
+ return failure(error);
101
+ }
102
+ });
103
+ return server;
104
+ }
105
+ export async function runPlexusMcpServer(options) {
106
+ await createPlexusMcpServer(options).connect(new StdioServerTransport());
107
+ }
108
+ async function callImageTool(images, name, args) {
109
+ const image = args.name;
110
+ switch (name) {
111
+ case "image_templates":
112
+ return images.templates();
113
+ case "image_create":
114
+ return images.create(image, {
115
+ template: args.template,
116
+ ...(typeof args.category === "string" ? { category: args.category } : {}),
117
+ });
118
+ case "image_start":
119
+ return images.start(image, displayOption(args.display));
120
+ case "image_stop":
121
+ return images.stop(image);
122
+ case "image_delete":
123
+ return images.delete(image);
124
+ default:
125
+ return images.list(args.name === undefined ? undefined : image);
126
+ }
127
+ }
128
+ function displayOption(value) {
129
+ if (value === undefined) {
130
+ return {};
131
+ }
132
+ if (value !== "headless" && value !== "interactive") {
133
+ throw new Error(`display must be headless or interactive, not ${JSON.stringify(value)}`);
134
+ }
135
+ return { display: value };
136
+ }
137
+ function forwardable(rows) {
138
+ return rows.filter((row) => row.running && row.endpoint !== undefined);
139
+ }
140
+ function withImageArgument(tool, running) {
141
+ const required = tool.inputSchema.required ?? [];
142
+ return {
143
+ ...tool,
144
+ inputSchema: {
145
+ ...tool.inputSchema,
146
+ properties: {
147
+ ...tool.inputSchema.properties,
148
+ image: {
149
+ type: "string",
150
+ description: running.length === 1
151
+ ? `The image to call, ${running[0]} unless named.`
152
+ : `The image to call: one of ${running.join(", ")}.`,
153
+ },
154
+ },
155
+ required: running.length === 1 ? required : [...required, "image"],
156
+ },
157
+ };
158
+ }
159
+ async function forward(images, callToolOn, name, args) {
160
+ const { image, ...rest } = args;
161
+ let rows;
162
+ try {
163
+ rows = await images.list();
164
+ }
165
+ catch (error) {
166
+ return failure(error);
167
+ }
168
+ let target;
169
+ if (image !== undefined) {
170
+ target = rows.find((row) => row.name === image);
171
+ if (target === undefined) {
172
+ return text(`There is no image ${JSON.stringify(image)}.`, true);
173
+ }
174
+ }
175
+ else {
176
+ const running = forwardable(rows);
177
+ if (running.length === 0) {
178
+ return text(`Unknown tool: ${name}`, true);
179
+ }
180
+ if (running.length > 1) {
181
+ return text(`Several images are running (${running.map((row) => row.name).join(", ")}): name one with the image argument.`, true);
182
+ }
183
+ target = running[0];
184
+ }
185
+ if (!target.running) {
186
+ return text(`Image ${target.name} is not running.`, true);
187
+ }
188
+ if (target.endpoint === undefined) {
189
+ return text(`Image ${target.name} runs, but has no endpoint to forward to: ${target.endpointProblem}.`, true);
190
+ }
191
+ try {
192
+ return await callToolOn(target.endpoint, name, rest);
193
+ }
194
+ catch (error) {
195
+ return text(error instanceof Error ? error.message : String(error), true);
196
+ }
197
+ }
198
+ function failure(error) {
199
+ return text(JSON.stringify(error instanceof PlexusError
200
+ ? { ok: false, code: error.code, error: error.message, ...(error.details ? { details: error.details } : {}) }
201
+ : { ok: false, error: error instanceof Error ? error.message : String(error) }, null, 2), true);
202
+ }
203
+ function text(value, isError = false) {
204
+ return { content: [{ type: "text", text: value }], ...(isError ? { isError: true } : {}) };
205
+ }
206
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAGvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAiB9C,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAW,CAAC;AAEnF,SAAS,MAAM,CACb,UAAkC,EAClC,WAAqB,EAAE;IAEvB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AAC/E,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,gKAAgK;QAClK,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC;KACxB;IACD;QACE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} from "./launcher/pharoLauncherMcpClient.js";
2
+ export type Display = "headless" | "interactive";
3
+ /** An MCP server an image runs: `http://127.0.0.1:<port><path>`. */
4
+ export interface Endpoint {
5
+ url: string;
6
+ /** The VM that wrote it, when the image could tell. */
7
+ pid?: number;
8
+ }
9
+ export interface Template {
10
+ name: string;
11
+ category: string;
12
+ /** The name is in more than one category, so a create must say which. */
13
+ ambiguous?: true;
14
+ }
15
+ /** One image, as observed when asked. */
16
+ export interface ImageInfo {
17
+ /** The name the caller uses, without the scope. */
18
+ name: string;
19
+ /** Its directory and file base name in the store. */
20
+ diskName: string;
21
+ /** The absolute path of `<diskName>.image`. */
22
+ path: string;
23
+ /** A VM runs this image file now. */
24
+ running: boolean;
25
+ pids: number[];
26
+ display?: Display;
27
+ /** Only when it belongs to a VM running this image. */
28
+ endpoint?: Endpoint;
29
+ /** Why a running image has no endpoint. */
30
+ endpointProblem?: string;
31
+ /** A create is still preparing it. */
32
+ building?: true;
33
+ template?: string;
34
+ pharoVersion?: string;
35
+ /** How MCP got into it: the pinned release, or a script. */
36
+ mcp?: {
37
+ source: "pin";
38
+ version: string;
39
+ } | {
40
+ source: "script";
41
+ script: string;
42
+ };
43
+ /** The script every start files in before MCP starts. */
44
+ everyStart?: string;
45
+ }
46
+ export interface CreateOptions {
47
+ template: string;
48
+ /** Resolved from the template list when absent. */
49
+ category?: string;
50
+ /** Filed in instead of loading the pinned MCP; relative to the working directory. */
51
+ script?: string;
52
+ /** File the script in at every start as well. */
53
+ everyStart?: boolean;
54
+ }
55
+ export interface StartOptions {
56
+ display?: Display;
57
+ /** How long the image has to answer: 300000 unless given. */
58
+ timeoutMs?: number;
59
+ }
60
+ export interface ImagesOptions {
61
+ /** `plexusHome()` unless given. */
62
+ home?: string;
63
+ /** A name prefix, without dashes: image `dev` is the directory `<scope>-dev`. */
64
+ scope?: string;
65
+ /** The launcher on the home's profile unless given. */
66
+ launcher?: LauncherPort;
67
+ }
68
+ //# sourceMappingURL=types.d.ts.map
@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W,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export declare const plexusVersion: string;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,EAAE,MAInB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import fs from "node:fs";
2
+ // The manifest is outside the compiled root, so it is read, not imported.
3
+ // Source and build both sit one directory below it.
4
+ export const plexusVersion = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
5
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,0EAA0E;AAC1E,oDAAoD;AACpD,MAAM,CAAC,MAAM,aAAa,GACxB,IAAI,CAAC,KAAK,CACR,EAAE,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAEvE,CAAC,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@evref-bl/plexus",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "private": false,
5
- "description": "PLexus: project-scoped Pharo runtime orchestration and MCP gateway.",
5
+ "description": "PLexus: Pharo images as directories and processes, and forwarding to the MCP servers they run.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -16,20 +16,11 @@
16
16
  "types": "./dist/index.d.ts",
17
17
  "import": "./dist/index.js"
18
18
  },
19
- "./internal": {
20
- "types": "./dist/internal.d.ts",
21
- "import": "./dist/internal.js"
22
- },
23
- "./gateway": {
24
- "types": "./dist/gateway/server/index.d.ts",
25
- "import": "./dist/gateway/server/index.js"
26
- },
27
19
  "./package.json": "./package.json"
28
20
  },
29
21
  "types": "./dist/index.d.ts",
30
22
  "bin": {
31
- "plexus": "dist/cli.js",
32
- "plexus-gateway": "dist/gateway/server/index.js"
23
+ "plexus": "dist/cli.js"
33
24
  },
34
25
  "files": [
35
26
  "README.md",
@@ -1,15 +0,0 @@
1
- export interface PharoLauncherMcpConfig {
2
- source: "env" | "package" | "command";
3
- command: string;
4
- args: string[];
5
- entry?: string;
6
- packageDir?: string;
7
- repoDir?: string;
8
- }
9
- export interface LoadPharoLauncherMcpConfigOptions {
10
- resolveInstalledEntry?: () => string | undefined;
11
- }
12
- export declare const pharoLauncherMcpPackageName: "@evref-bl/pharo-launcher-mcp";
13
- export declare const pharoLauncherMcpCommandName: "pharo-launcher-mcp";
14
- export declare function loadPharoLauncherMcpConfig(env?: NodeJS.ProcessEnv, options?: LoadPharoLauncherMcpConfigOptions): PharoLauncherMcpConfig;
15
- //# sourceMappingURL=config.d.ts.map