@evref-bl/plexus 0.10.1 → 0.12.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.
- package/README.md +1 -1
- package/dist/config/projectConfigAuthoring.d.ts +48 -0
- package/dist/config/projectConfigAuthoring.d.ts.map +1 -0
- package/dist/config/projectConfigAuthoring.js +159 -0
- package/dist/config/projectConfigAuthoring.js.map +1 -0
- package/dist/gateway/server/support/toolResultFormatting.d.ts.map +1 -1
- package/dist/gateway/server/support/toolResultFormatting.js +7 -14
- package/dist/gateway/server/support/toolResultFormatting.js.map +1 -1
- package/dist/images/homeImageCache.d.ts.map +1 -1
- package/dist/images/homeImageCache.js +13 -5
- package/dist/images/homeImageCache.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/launcher/scopedPharoLauncherServer.d.ts +24 -49
- package/dist/launcher/scopedPharoLauncherServer.d.ts.map +1 -1
- package/dist/launcher/scopedPharoLauncherServer.js +68 -87
- package/dist/launcher/scopedPharoLauncherServer.js.map +1 -1
- package/dist/lifecycle/{projectOpen.d.ts → startProjectImage.d.ts} +14 -23
- package/dist/lifecycle/startProjectImage.d.ts.map +1 -0
- package/dist/lifecycle/{projectOpen.js → startProjectImage.js} +33 -51
- package/dist/lifecycle/startProjectImage.js.map +1 -0
- package/dist/lifecycle/stopProjectImage.d.ts +31 -0
- package/dist/lifecycle/stopProjectImage.d.ts.map +1 -0
- package/dist/lifecycle/{projectClose.js → stopProjectImage.js} +60 -76
- package/dist/lifecycle/stopProjectImage.js.map +1 -0
- package/dist/support/toolResultFormatting.d.ts.map +1 -1
- package/dist/support/toolResultFormatting.js +7 -14
- package/dist/support/toolResultFormatting.js.map +1 -1
- package/package.json +1 -1
- package/dist/lifecycle/projectClose.d.ts +0 -39
- package/dist/lifecycle/projectClose.d.ts.map +0 -1
- package/dist/lifecycle/projectClose.js.map +0 -1
- package/dist/lifecycle/projectOpen.d.ts.map +0 -1
- package/dist/lifecycle/projectOpen.js.map +0 -1
|
@@ -2,8 +2,8 @@ import type { LauncherTemplate } from "@evref-bl/pharo-launcher-mcp/launcher";
|
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
import { type CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
4
4
|
import { type ProjectImageDisplayMode } from "../config/projectConfig.js";
|
|
5
|
-
import { stopProjectImage } from "../lifecycle/
|
|
6
|
-
import { startProjectImage } from "../lifecycle/
|
|
5
|
+
import { stopProjectImage } from "../lifecycle/stopProjectImage.js";
|
|
6
|
+
import { startProjectImage } from "../lifecycle/startProjectImage.js";
|
|
7
7
|
import { type HomeImageCacheMutationApproval } from "../images/homeImageCache.js";
|
|
8
8
|
import { type ImageRuntimeObservation, type ImageRuntimeStatus } from "../images/imageRuntime.js";
|
|
9
9
|
import { type PharoLauncherMcpToolClient } from "./pharoLauncherMcpClient.js";
|
|
@@ -61,13 +61,15 @@ interface WorkspaceImageSummary {
|
|
|
61
61
|
status: ImageRuntimeStatus;
|
|
62
62
|
runtime: ImageRuntimeObservation;
|
|
63
63
|
displayMode: ProjectImageDisplayMode;
|
|
64
|
+
/**
|
|
65
|
+
* What this image's display mode is configured to be, and what it was last
|
|
66
|
+
* set to. `start`, `show` and `hide` used to be here too, reporting the
|
|
67
|
+
* mode each tool would produce — a constant per tool name, repeated on
|
|
68
|
+
* every row, that told a caller nothing the tool list does not.
|
|
69
|
+
*/
|
|
64
70
|
displayModes: {
|
|
65
71
|
default: ProjectImageDisplayMode;
|
|
66
72
|
current?: ProjectImageDisplayMode;
|
|
67
|
-
start: ProjectImageDisplayMode;
|
|
68
|
-
interactiveOpen: "interactive";
|
|
69
|
-
show: "interactive";
|
|
70
|
-
hide: "headless";
|
|
71
73
|
};
|
|
72
74
|
pharoMcpContract?: ProjectImageState["pharoMcpContract"];
|
|
73
75
|
lease?: ProjectImageLeaseState;
|
|
@@ -189,12 +191,15 @@ export declare class ScopedPharoLauncher {
|
|
|
189
191
|
launcherProfile: LauncherProfileSummary;
|
|
190
192
|
templates: ScopedLauncherTemplate[];
|
|
191
193
|
}>;
|
|
192
|
-
listTemplateCategories(): Promise<{
|
|
193
|
-
scope: WorkspaceScopeSummary;
|
|
194
|
-
launcherProfile: LauncherProfileSummary;
|
|
195
|
-
templateCategories: string[];
|
|
196
|
-
}>;
|
|
197
194
|
private templateScopeSummary;
|
|
195
|
+
/**
|
|
196
|
+
* The launcher resolves a bare template name against its default group only,
|
|
197
|
+
* so an image naming a template from any other group could not be created
|
|
198
|
+
* until something said which group that was. `listTemplates` already walks
|
|
199
|
+
* the groups and stamps each row, so the answer was here all along and every
|
|
200
|
+
* consumer was finding it for itself.
|
|
201
|
+
*/
|
|
202
|
+
private templateCategoryFor;
|
|
198
203
|
createImage(imageId: string, profileId?: string): Promise<{
|
|
199
204
|
scope: WorkspaceScopeSummary;
|
|
200
205
|
launcherProfile: LauncherProfileSummary;
|
|
@@ -206,9 +211,9 @@ export declare class ScopedPharoLauncher {
|
|
|
206
211
|
image: WorkspaceImageSummary;
|
|
207
212
|
}>;
|
|
208
213
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* the image, which tool frees it
|
|
214
|
+
* Raise the failure as this surface's own error, so a tool call reports it
|
|
215
|
+
* the way it reports every other refusal. The message already names what
|
|
216
|
+
* happened — which VM holds the image, which tool frees it.
|
|
212
217
|
*/
|
|
213
218
|
private startingImage;
|
|
214
219
|
setImageDisplayMode(imageId: string, displayMode: ProjectImageDisplayMode): Promise<{
|
|
@@ -221,9 +226,6 @@ export declare class ScopedPharoLauncher {
|
|
|
221
226
|
runtimeStateUnchanged: boolean;
|
|
222
227
|
snapshotBeforeRestart?: DisplayModeRestartSnapshot;
|
|
223
228
|
}>;
|
|
224
|
-
openImageInteractive(imageId: string): Promise<Awaited<ReturnType<ScopedPharoLauncher["setImageDisplayMode"]>>>;
|
|
225
|
-
showImage(imageId: string): Promise<Awaited<ReturnType<ScopedPharoLauncher["setImageDisplayMode"]>>>;
|
|
226
|
-
hideImage(imageId: string): Promise<Awaited<ReturnType<ScopedPharoLauncher["setImageDisplayMode"]>>>;
|
|
227
229
|
stopImage(imageId: string): Promise<{
|
|
228
230
|
scope: WorkspaceScopeSummary;
|
|
229
231
|
launcherProfile: LauncherProfileSummary;
|
|
@@ -272,16 +274,7 @@ export declare const scopedPharoLauncherTools: readonly [{
|
|
|
272
274
|
};
|
|
273
275
|
}, {
|
|
274
276
|
readonly name: "pharo_launcher_template_list";
|
|
275
|
-
readonly description:
|
|
276
|
-
readonly inputSchema: {
|
|
277
|
-
readonly type: "object";
|
|
278
|
-
readonly properties: Record<string, unknown>;
|
|
279
|
-
readonly required: string[];
|
|
280
|
-
readonly additionalProperties: false;
|
|
281
|
-
};
|
|
282
|
-
}, {
|
|
283
|
-
readonly name: "pharo_launcher_template_category_list";
|
|
284
|
-
readonly description: "List the Pharo Launcher template categories available to the current PLexus project scope.";
|
|
277
|
+
readonly description: string;
|
|
285
278
|
readonly inputSchema: {
|
|
286
279
|
readonly type: "object";
|
|
287
280
|
readonly properties: Record<string, unknown>;
|
|
@@ -299,25 +292,7 @@ export declare const scopedPharoLauncherTools: readonly [{
|
|
|
299
292
|
};
|
|
300
293
|
}, {
|
|
301
294
|
readonly name: "pharo_launcher_image_start";
|
|
302
|
-
readonly description: "Start
|
|
303
|
-
readonly inputSchema: {
|
|
304
|
-
readonly type: "object";
|
|
305
|
-
readonly properties: Record<string, unknown>;
|
|
306
|
-
readonly required: string[];
|
|
307
|
-
readonly additionalProperties: false;
|
|
308
|
-
};
|
|
309
|
-
}, {
|
|
310
|
-
readonly name: "pharo_launcher_image_open_interactive";
|
|
311
|
-
readonly description: "Explicitly open a workspace-scoped active image in interactive display mode for human image work.";
|
|
312
|
-
readonly inputSchema: {
|
|
313
|
-
readonly type: "object";
|
|
314
|
-
readonly properties: Record<string, unknown>;
|
|
315
|
-
readonly required: string[];
|
|
316
|
-
readonly additionalProperties: false;
|
|
317
|
-
};
|
|
318
|
-
}, {
|
|
319
|
-
readonly name: "pharo_launcher_image_show";
|
|
320
|
-
readonly description: "Switch a workspace-scoped active image to interactive display mode through PLexus lifecycle policy.";
|
|
295
|
+
readonly description: "Start one image this project declares, in the project's launcher profile.";
|
|
321
296
|
readonly inputSchema: {
|
|
322
297
|
readonly type: "object";
|
|
323
298
|
readonly properties: Record<string, unknown>;
|
|
@@ -325,8 +300,8 @@ export declare const scopedPharoLauncherTools: readonly [{
|
|
|
325
300
|
readonly additionalProperties: false;
|
|
326
301
|
};
|
|
327
302
|
}, {
|
|
328
|
-
readonly name: "
|
|
329
|
-
readonly description:
|
|
303
|
+
readonly name: "pharo_launcher_image_display";
|
|
304
|
+
readonly description: string;
|
|
330
305
|
readonly inputSchema: {
|
|
331
306
|
readonly type: "object";
|
|
332
307
|
readonly properties: Record<string, unknown>;
|
|
@@ -353,7 +328,7 @@ export declare const scopedPharoLauncherTools: readonly [{
|
|
|
353
328
|
};
|
|
354
329
|
}, {
|
|
355
330
|
readonly name: "pharo_launcher_image_reset";
|
|
356
|
-
readonly description: "
|
|
331
|
+
readonly description: "Replace one image with a fresh one from its template: stop it, delete it, create it again, and start it unless start is false.";
|
|
357
332
|
readonly inputSchema: {
|
|
358
333
|
readonly type: "object";
|
|
359
334
|
readonly properties: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopedPharoLauncherServer.d.ts","sourceRoot":"","sources":["../../src/launcher/scopedPharoLauncherServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAG9E,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAOL,KAAK,uBAAuB,EAE7B,MAAM,4BAA4B,CAAC;AAC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E,qBAAqB,CAAC;KAC9B,CAAC;IAwBF,OAAO,CAAC,sBAAsB;YAahB,mBAAmB;IAc3B,UAAU,CACd,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC;QACT,KAAK,EAAE,qBAAqB,CAAC;QAC7B,eAAe,EAAE,sBAAsB,CAAC;QACxC,KAAK,EAAE,qBAAqB,CAAC;QAC7B,KAAK,EAAE,uBAAuB,CAAC;KAChC,CAAC;IA2FF;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAC1C,KAAK,EAAE,qBAAqB,CAAC;QAC7B,eAAe,EAAE,sBAAsB,CAAC;QACxC,OAAO,EAAE;YACP,OAAO,EAAE,MAAM,CAAC;YAChB,aAAa,EAAE,OAAO,CAAC;YACvB,aAAa,EAAE,OAAO,CAAC;SACxB,CAAC;KACH,CAAC;CA0DH;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkG3B,CAAC;AAEX,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAuBR;AAED,yEAAyE;AACzE;;;;GAIG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAClD,OAAO,CAAC,cAAc,CAAC,CA0FzB;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -3,8 +3,8 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { loadProjectConfig, projectImageCreateCleanupPolicy, projectImageDisplayMode, projectConfigId, resolveProjectRuntimePolicy, } from "../config/projectConfig.js";
|
|
6
|
-
import {
|
|
7
|
-
import { hostPharoProcesses, processesOnImage,
|
|
6
|
+
import { StopProjectImageError, stopProjectImage, } from "../lifecycle/stopProjectImage.js";
|
|
7
|
+
import { hostPharoProcesses, processesOnImage, StartProjectImageError, startProjectImage, } from "../lifecycle/startProjectImage.js";
|
|
8
8
|
import { formatToolResultPayload, toolResultDetailFromArguments, toolResultDetailSchema, } from "../support/toolResultFormatting.js";
|
|
9
9
|
import { homeImageCacheNetworkPolicy } from "../config/plexusHome.js";
|
|
10
10
|
import { materializeProjectImageFromHomeCache, } from "../images/homeImageCache.js";
|
|
@@ -121,6 +121,13 @@ function optionalBoolean(input, key) {
|
|
|
121
121
|
}
|
|
122
122
|
return value;
|
|
123
123
|
}
|
|
124
|
+
function requireDisplayMode(input, key) {
|
|
125
|
+
const value = optionalDisplayMode(input, key);
|
|
126
|
+
if (value === undefined) {
|
|
127
|
+
throw new ScopedPharoLauncherError(`${key} is required`);
|
|
128
|
+
}
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
124
131
|
function optionalDisplayMode(input, key) {
|
|
125
132
|
const value = input[key];
|
|
126
133
|
if (value === undefined) {
|
|
@@ -131,11 +138,6 @@ function optionalDisplayMode(input, key) {
|
|
|
131
138
|
}
|
|
132
139
|
throw new ScopedPharoLauncherError(`${key} must be headless or interactive`);
|
|
133
140
|
}
|
|
134
|
-
function requireConfirm(input) {
|
|
135
|
-
if (input.confirm !== true) {
|
|
136
|
-
throw new ScopedPharoLauncherError("confirm: true is required");
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
141
|
const leaseOwnerKinds = new Set([
|
|
140
142
|
"target",
|
|
141
143
|
"workspace",
|
|
@@ -262,10 +264,6 @@ function imageSummary(imageConfig, imageState, runtime) {
|
|
|
262
264
|
displayModes: {
|
|
263
265
|
default: defaultDisplayMode,
|
|
264
266
|
...(imageState?.displayMode ? { current: imageState.displayMode } : {}),
|
|
265
|
-
start: defaultDisplayMode,
|
|
266
|
-
interactiveOpen: "interactive",
|
|
267
|
-
show: "interactive",
|
|
268
|
-
hide: "headless",
|
|
269
267
|
},
|
|
270
268
|
...(imageState?.pharoMcpContract
|
|
271
269
|
? { pharoMcpContract: imageState.pharoMcpContract }
|
|
@@ -528,12 +526,13 @@ function routeStatus(image, imageState) {
|
|
|
528
526
|
...(contractStatus ? { contractStatus } : {}),
|
|
529
527
|
};
|
|
530
528
|
}
|
|
531
|
-
function
|
|
529
|
+
function resetStopError(imageId, error) {
|
|
532
530
|
const failure = error.result.failures.find((record) => record.imageId === imageId);
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
531
|
+
// Say why, not only that: the reset stops the image first, so the stop's own
|
|
532
|
+
// message is what tells a caller which process is in the way.
|
|
533
|
+
return new ScopedPharoLauncherError(failure
|
|
534
|
+
? `Image ${imageId} reset could not stop the image: ${failure.message}`
|
|
535
|
+
: `Image ${imageId} reset could not stop the image cleanly`);
|
|
537
536
|
}
|
|
538
537
|
function resetSummary(imageId, closeResult, deleted, started, image, imageState) {
|
|
539
538
|
return {
|
|
@@ -861,26 +860,6 @@ export class ScopedPharoLauncher {
|
|
|
861
860
|
templates,
|
|
862
861
|
};
|
|
863
862
|
}
|
|
864
|
-
async listTemplateCategories() {
|
|
865
|
-
const scope = resolveScope(this.options);
|
|
866
|
-
const projectConfig = loadProjectConfig(scope.projectRoot);
|
|
867
|
-
const templateCategories = await this.withLauncherClient(scope, projectConfig, async (client) => {
|
|
868
|
-
await ensureScopedTemplateCatalogReady({
|
|
869
|
-
client,
|
|
870
|
-
scope,
|
|
871
|
-
projectConfig,
|
|
872
|
-
fetch: this.options.fetch,
|
|
873
|
-
});
|
|
874
|
-
const result = await client.callTool("pharo_launcher_template_category_list", {});
|
|
875
|
-
assertLauncherOk(result, "pharo_launcher_template_category_list");
|
|
876
|
-
const data = result?.data ?? result;
|
|
877
|
-
return Array.isArray(data) ? data : [];
|
|
878
|
-
});
|
|
879
|
-
return {
|
|
880
|
-
...this.templateScopeSummary(scope, projectConfig),
|
|
881
|
-
templateCategories,
|
|
882
|
-
};
|
|
883
|
-
}
|
|
884
863
|
templateScopeSummary(scope, projectConfig) {
|
|
885
864
|
return {
|
|
886
865
|
scope: scopeSummary(scope),
|
|
@@ -892,6 +871,30 @@ export class ScopedPharoLauncher {
|
|
|
892
871
|
})),
|
|
893
872
|
};
|
|
894
873
|
}
|
|
874
|
+
/**
|
|
875
|
+
* The launcher resolves a bare template name against its default group only,
|
|
876
|
+
* so an image naming a template from any other group could not be created
|
|
877
|
+
* until something said which group that was. `listTemplates` already walks
|
|
878
|
+
* the groups and stamps each row, so the answer was here all along and every
|
|
879
|
+
* consumer was finding it for itself.
|
|
880
|
+
*/
|
|
881
|
+
async templateCategoryFor(templateName) {
|
|
882
|
+
const { templates } = await this.listTemplates();
|
|
883
|
+
const categories = [
|
|
884
|
+
...new Set(templates
|
|
885
|
+
.filter((template) => template.name === templateName)
|
|
886
|
+
.map((template) => template.templateCategory)
|
|
887
|
+
.filter((category) => Boolean(category))),
|
|
888
|
+
];
|
|
889
|
+
if (categories.length === 0) {
|
|
890
|
+
throw new ScopedPharoLauncherError(`No template named ${templateName} in any category`);
|
|
891
|
+
}
|
|
892
|
+
if (categories.length > 1) {
|
|
893
|
+
throw new ScopedPharoLauncherError(`Template ${templateName} exists in several categories: ${categories.join(", ")}. `
|
|
894
|
+
+ "Set create.templateCategory to choose one.");
|
|
895
|
+
}
|
|
896
|
+
return categories[0];
|
|
897
|
+
}
|
|
895
898
|
async createImage(imageId, profileId) {
|
|
896
899
|
const scope = resolveScope(this.options);
|
|
897
900
|
const projectConfig = loadProjectConfig(scope.projectRoot);
|
|
@@ -946,12 +949,12 @@ export class ScopedPharoLauncher {
|
|
|
946
949
|
projectConfig,
|
|
947
950
|
fetch: this.options.fetch,
|
|
948
951
|
});
|
|
952
|
+
const templateCategory = createPolicy.templateCategory ??
|
|
953
|
+
(await this.templateCategoryFor(createPolicy.templateName));
|
|
949
954
|
const result = await client.callTool("pharo_launcher_image_create", {
|
|
950
955
|
newImageName: renderedImageName(scope, imageConfig),
|
|
951
956
|
templateName: createPolicy.templateName,
|
|
952
|
-
...(
|
|
953
|
-
? { templateCategory: createPolicy.templateCategory }
|
|
954
|
-
: {}),
|
|
957
|
+
...(templateCategory ? { templateCategory } : {}),
|
|
955
958
|
noLaunch: true,
|
|
956
959
|
});
|
|
957
960
|
assertLauncherOk(result, "pharo_launcher_image_create");
|
|
@@ -985,16 +988,16 @@ export class ScopedPharoLauncher {
|
|
|
985
988
|
return await this.imageInfo(imageId);
|
|
986
989
|
}
|
|
987
990
|
/**
|
|
988
|
-
*
|
|
989
|
-
*
|
|
990
|
-
* the image, which tool frees it
|
|
991
|
+
* Raise the failure as this surface's own error, so a tool call reports it
|
|
992
|
+
* the way it reports every other refusal. The message already names what
|
|
993
|
+
* happened — which VM holds the image, which tool frees it.
|
|
991
994
|
*/
|
|
992
995
|
async startingImage(imageId, start) {
|
|
993
996
|
try {
|
|
994
997
|
return await start();
|
|
995
998
|
}
|
|
996
999
|
catch (error) {
|
|
997
|
-
if (!(error instanceof
|
|
1000
|
+
if (!(error instanceof StartProjectImageError)) {
|
|
998
1001
|
throw error;
|
|
999
1002
|
}
|
|
1000
1003
|
const failure = error.result.failures.find((candidate) => candidate.imageId === imageId);
|
|
@@ -1041,15 +1044,6 @@ export class ScopedPharoLauncher {
|
|
|
1041
1044
|
...(snapshotBeforeRestart ? { snapshotBeforeRestart } : {}),
|
|
1042
1045
|
};
|
|
1043
1046
|
}
|
|
1044
|
-
async openImageInteractive(imageId) {
|
|
1045
|
-
return this.setImageDisplayMode(imageId, "interactive");
|
|
1046
|
-
}
|
|
1047
|
-
async showImage(imageId) {
|
|
1048
|
-
return this.setImageDisplayMode(imageId, "interactive");
|
|
1049
|
-
}
|
|
1050
|
-
async hideImage(imageId) {
|
|
1051
|
-
return this.setImageDisplayMode(imageId, "headless");
|
|
1052
|
-
}
|
|
1053
1047
|
async stopImage(imageId) {
|
|
1054
1048
|
await this.imageInfo(imageId);
|
|
1055
1049
|
const scope = resolveScope(this.options);
|
|
@@ -1103,8 +1097,8 @@ export class ScopedPharoLauncher {
|
|
|
1103
1097
|
});
|
|
1104
1098
|
}
|
|
1105
1099
|
catch (error) {
|
|
1106
|
-
if (error instanceof
|
|
1107
|
-
throw
|
|
1100
|
+
if (error instanceof StopProjectImageError) {
|
|
1101
|
+
throw resetStopError(imageId, error);
|
|
1108
1102
|
}
|
|
1109
1103
|
throw error;
|
|
1110
1104
|
}
|
|
@@ -1188,17 +1182,13 @@ export const scopedPharoLauncherTools = [
|
|
|
1188
1182
|
},
|
|
1189
1183
|
{
|
|
1190
1184
|
name: "pharo_launcher_template_list",
|
|
1191
|
-
description: "List the Pharo Launcher image templates
|
|
1185
|
+
description: "List the Pharo Launcher image templates this project can create from. "
|
|
1186
|
+
+ "Each row names its category, so there is no separate category list.",
|
|
1192
1187
|
inputSchema: objectSchema({
|
|
1193
1188
|
templateCategory: stringSchema,
|
|
1194
1189
|
detail: toolResultDetailSchema,
|
|
1195
1190
|
}),
|
|
1196
1191
|
},
|
|
1197
|
-
{
|
|
1198
|
-
name: "pharo_launcher_template_category_list",
|
|
1199
|
-
description: "List the Pharo Launcher template categories available to the current PLexus project scope.",
|
|
1200
|
-
inputSchema: objectSchema({ detail: toolResultDetailSchema }),
|
|
1201
|
-
},
|
|
1202
1192
|
{
|
|
1203
1193
|
name: "pharo_launcher_image_create",
|
|
1204
1194
|
description: "Create a declared workspace-scoped image from an approved PLexus project create policy.",
|
|
@@ -1210,23 +1200,22 @@ export const scopedPharoLauncherTools = [
|
|
|
1210
1200
|
},
|
|
1211
1201
|
{
|
|
1212
1202
|
name: "pharo_launcher_image_start",
|
|
1213
|
-
description: "Start
|
|
1214
|
-
inputSchema: objectSchema({
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
inputSchema: objectSchema({ imageId: stringSchema, detail: toolResultDetailSchema }, ["imageId"]),
|
|
1220
|
-
},
|
|
1221
|
-
{
|
|
1222
|
-
name: "pharo_launcher_image_show",
|
|
1223
|
-
description: "Switch a workspace-scoped active image to interactive display mode through PLexus lifecycle policy.",
|
|
1224
|
-
inputSchema: objectSchema({ imageId: stringSchema, detail: toolResultDetailSchema }, ["imageId"]),
|
|
1203
|
+
description: "Start one image this project declares, in the project's launcher profile.",
|
|
1204
|
+
inputSchema: objectSchema({
|
|
1205
|
+
imageId: stringSchema,
|
|
1206
|
+
displayMode: displayModeSchema,
|
|
1207
|
+
detail: toolResultDetailSchema,
|
|
1208
|
+
}, ["imageId"]),
|
|
1225
1209
|
},
|
|
1226
1210
|
{
|
|
1227
|
-
name: "
|
|
1228
|
-
description: "
|
|
1229
|
-
|
|
1211
|
+
name: "pharo_launcher_image_display",
|
|
1212
|
+
description: "Show or hide one image's window. A running image is restarted in the "
|
|
1213
|
+
+ "requested display mode; a stopped one starts in it next time.",
|
|
1214
|
+
inputSchema: objectSchema({
|
|
1215
|
+
imageId: stringSchema,
|
|
1216
|
+
displayMode: displayModeSchema,
|
|
1217
|
+
detail: toolResultDetailSchema,
|
|
1218
|
+
}, ["imageId", "displayMode"]),
|
|
1230
1219
|
},
|
|
1231
1220
|
{
|
|
1232
1221
|
name: "pharo_launcher_image_stop",
|
|
@@ -1243,14 +1232,13 @@ export const scopedPharoLauncherTools = [
|
|
|
1243
1232
|
},
|
|
1244
1233
|
{
|
|
1245
1234
|
name: "pharo_launcher_image_reset",
|
|
1246
|
-
description: "
|
|
1235
|
+
description: "Replace one image with a fresh one from its template: stop it, delete it, create it again, and start it unless start is false.",
|
|
1247
1236
|
inputSchema: objectSchema({
|
|
1248
1237
|
imageId: stringSchema,
|
|
1249
|
-
confirm: { type: "boolean" },
|
|
1250
1238
|
start: { type: "boolean" },
|
|
1251
1239
|
displayMode: displayModeSchema,
|
|
1252
1240
|
detail: toolResultDetailSchema,
|
|
1253
|
-
}, ["imageId"
|
|
1241
|
+
}, ["imageId"]),
|
|
1254
1242
|
},
|
|
1255
1243
|
];
|
|
1256
1244
|
export function createScopedPharoLauncherServer(options) {
|
|
@@ -1288,24 +1276,17 @@ export async function callScopedPharoLauncherTool(facade, name, argumentsValue)
|
|
|
1288
1276
|
return textResult(await facade.imageInfo(requireString(input, "imageId")), false, detail);
|
|
1289
1277
|
case "pharo_launcher_template_list":
|
|
1290
1278
|
return textResult(await facade.listTemplates(optionalString(input, "templateCategory")), false, detail);
|
|
1291
|
-
case "pharo_launcher_template_category_list":
|
|
1292
|
-
return textResult(await facade.listTemplateCategories(), false, detail);
|
|
1293
1279
|
case "pharo_launcher_image_create":
|
|
1294
1280
|
return textResult(await facade.createImage(requireString(input, "imageId"), optionalString(input, "profileId")), false, detail);
|
|
1295
1281
|
case "pharo_launcher_image_start":
|
|
1296
1282
|
return textResult(await facade.startImage(requireString(input, "imageId"), optionalDisplayMode(input, "displayMode")), false, detail);
|
|
1297
|
-
case "
|
|
1298
|
-
return textResult(await facade.
|
|
1299
|
-
case "pharo_launcher_image_show":
|
|
1300
|
-
return textResult(await facade.showImage(requireString(input, "imageId")), false, detail);
|
|
1301
|
-
case "pharo_launcher_image_hide":
|
|
1302
|
-
return textResult(await facade.hideImage(requireString(input, "imageId")), false, detail);
|
|
1283
|
+
case "pharo_launcher_image_display":
|
|
1284
|
+
return textResult(await facade.setImageDisplayMode(requireString(input, "imageId"), requireDisplayMode(input, "displayMode")), false, detail);
|
|
1303
1285
|
case "pharo_launcher_image_stop":
|
|
1304
1286
|
return textResult(await facade.stopImage(requireString(input, "imageId")), false, detail);
|
|
1305
1287
|
case "pharo_launcher_image_delete":
|
|
1306
1288
|
return textResult(await facade.deleteImage(requireString(input, "imageId")), false, detail);
|
|
1307
1289
|
case "pharo_launcher_image_reset":
|
|
1308
|
-
requireConfirm(input);
|
|
1309
1290
|
return textResult(await facade.resetImage(requireString(input, "imageId"), {
|
|
1310
1291
|
start: optionalBoolean(input, "start"),
|
|
1311
1292
|
displayMode: optionalDisplayMode(input, "displayMode"),
|