@evref-bl/plexus 0.20.0 → 0.21.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 (87) hide show
  1. package/dist/answers/index.d.ts +36 -12
  2. package/dist/answers/index.d.ts.map +1 -1
  3. package/dist/answers/index.js +97 -46
  4. package/dist/answers/index.js.map +1 -1
  5. package/dist/answers/texts.d.ts +28 -5
  6. package/dist/answers/texts.d.ts.map +1 -1
  7. package/dist/answers/texts.js +46 -10
  8. package/dist/answers/texts.js.map +1 -1
  9. package/dist/commandLine.d.ts +5 -1
  10. package/dist/commandLine.d.ts.map +1 -1
  11. package/dist/commandLine.js +6 -4
  12. package/dist/commandLine.js.map +1 -1
  13. package/dist/config/pharoMcpVersion.d.ts +1 -1
  14. package/dist/config/pharoMcpVersion.js +1 -1
  15. package/dist/forward/index.d.ts +6 -0
  16. package/dist/forward/index.d.ts.map +1 -1
  17. package/dist/forward/index.js +1 -0
  18. package/dist/forward/index.js.map +1 -1
  19. package/dist/forward/jsonRpc.d.ts +3 -1
  20. package/dist/forward/jsonRpc.d.ts.map +1 -1
  21. package/dist/forward/jsonRpc.js +8 -2
  22. package/dist/forward/jsonRpc.js.map +1 -1
  23. package/dist/home.d.ts +6 -1
  24. package/dist/home.d.ts.map +1 -1
  25. package/dist/home.js +7 -2
  26. package/dist/home.js.map +1 -1
  27. package/dist/images/bases.d.ts +25 -7
  28. package/dist/images/bases.d.ts.map +1 -1
  29. package/dist/images/bases.js +158 -36
  30. package/dist/images/bases.js.map +1 -1
  31. package/dist/images/create.d.ts +2 -1
  32. package/dist/images/create.d.ts.map +1 -1
  33. package/dist/images/create.js +9 -6
  34. package/dist/images/create.js.map +1 -1
  35. package/dist/images/endpoint.d.ts +7 -5
  36. package/dist/images/endpoint.d.ts.map +1 -1
  37. package/dist/images/endpoint.js +5 -2
  38. package/dist/images/endpoint.js.map +1 -1
  39. package/dist/images/index.d.ts +13 -3
  40. package/dist/images/index.d.ts.map +1 -1
  41. package/dist/images/index.js +27 -7
  42. package/dist/images/index.js.map +1 -1
  43. package/dist/images/list.d.ts +24 -1
  44. package/dist/images/list.d.ts.map +1 -1
  45. package/dist/images/list.js +80 -2
  46. package/dist/images/list.js.map +1 -1
  47. package/dist/images/prepare.d.ts +9 -2
  48. package/dist/images/prepare.d.ts.map +1 -1
  49. package/dist/images/prepare.js +46 -3
  50. package/dist/images/prepare.js.map +1 -1
  51. package/dist/images/scripts.d.ts +18 -6
  52. package/dist/images/scripts.d.ts.map +1 -1
  53. package/dist/images/scripts.js +63 -15
  54. package/dist/images/scripts.js.map +1 -1
  55. package/dist/images/start.d.ts +10 -3
  56. package/dist/images/start.d.ts.map +1 -1
  57. package/dist/images/start.js +29 -14
  58. package/dist/images/start.js.map +1 -1
  59. package/dist/images/stop.js +2 -2
  60. package/dist/images/stop.js.map +1 -1
  61. package/dist/images/store.d.ts +7 -1
  62. package/dist/images/store.d.ts.map +1 -1
  63. package/dist/images/store.js +34 -0
  64. package/dist/images/store.js.map +1 -1
  65. package/dist/mcp/server.d.ts +15 -1
  66. package/dist/mcp/server.d.ts.map +1 -1
  67. package/dist/mcp/server.js +171 -47
  68. package/dist/mcp/server.js.map +1 -1
  69. package/dist/telemetry/reachability.d.ts +21 -3
  70. package/dist/telemetry/reachability.d.ts.map +1 -1
  71. package/dist/telemetry/reachability.js +50 -9
  72. package/dist/telemetry/reachability.js.map +1 -1
  73. package/dist/telemetry/sdk.d.ts +17 -6
  74. package/dist/telemetry/sdk.d.ts.map +1 -1
  75. package/dist/telemetry/sdk.js +18 -9
  76. package/dist/telemetry/sdk.js.map +1 -1
  77. package/dist/telemetry/settings.d.ts +11 -7
  78. package/dist/telemetry/settings.d.ts.map +1 -1
  79. package/dist/telemetry/settings.js +35 -19
  80. package/dist/telemetry/settings.js.map +1 -1
  81. package/dist/telemetry/trace.d.ts +18 -12
  82. package/dist/telemetry/trace.d.ts.map +1 -1
  83. package/dist/telemetry/trace.js +39 -8
  84. package/dist/telemetry/trace.js.map +1 -1
  85. package/dist/types.d.ts +26 -0
  86. package/dist/types.d.ts.map +1 -1
  87. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import type { LauncherProcess } from "../launcher/pharoLauncherMcpClient.js";
2
- import type { ImageInfo } from "../types.js";
2
+ import type { Endpoint, ImageInfo, ImageTelemetry } from "../types.js";
3
3
  import type { ImagesContext } from "./context.js";
4
+ import { type EndpointObservation } from "./endpoint.js";
4
5
  import { type ImageFiles } from "./store.js";
5
6
  /**
6
7
  * The images in scope, or the one named, with what runs them now: one look
@@ -8,5 +9,27 @@ import { type ImageFiles } from "./store.js";
8
9
  * nothing.
9
10
  */
10
11
  export declare function list(context: ImagesContext, name?: string): Promise<ImageInfo[]>;
12
+ /** Where a forwarded call goes: the image and its endpoint. */
13
+ export interface Answering {
14
+ name: string;
15
+ endpoint: Endpoint;
16
+ }
17
+ /**
18
+ * The image a forwarded call goes to when the endpoint files alone can say:
19
+ * the image named, or, naming none, the only image whose endpoint names a
20
+ * live process, when that process is the VM an earlier look saw running the
21
+ * image (`seen`, by image name). Undefined whenever only the look `list`
22
+ * takes can say, refusals included. Listing the host's processes reads every
23
+ * process's command line, tens of milliseconds where there are many, which
24
+ * each call would pay; a VM keeps its pid and its endpoint while it runs.
25
+ */
26
+ export declare function answeringFromEndpoints(context: ImagesContext, seen: ReadonlyMap<string, number>, name?: string): Answering | undefined;
11
27
  export declare function describe(files: ImageFiles, processes: readonly LauncherProcess[]): ImageInfo;
28
+ /**
29
+ * Whether the image records its calls: running, what its start said, else
30
+ * what its create said. A server with no backend to record with, in an image
31
+ * whose create said why it has none, is said by that reason, which says what
32
+ * to do.
33
+ */
34
+ export declare function imageTelemetry(observed: EndpointObservation | undefined, created: ImageTelemetry | undefined): ImageTelemetry | undefined;
12
35
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/images/list.ts"],"names":[],"mappings":"A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,GAAG,SAAS,CAsCvB;AA4BD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,CAyB5F;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,mBAAmB,GAAG,SAAS,EACzC,OAAO,EAAE,cAAc,GAAG,SAAS,GAClC,cAAc,GAAG,SAAS,CAQ5B"}
@@ -2,10 +2,11 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { readImageDirectory, readLauncherImage, } from "@evref-bl/pharo-launcher-mcp/launcher";
4
4
  import { storeRoot } from "../home.js";
5
- import { observeEndpoint } from "./endpoint.js";
5
+ import { parseEndpointHandoff } from "../forward/endpointHandoffFormat.js";
6
+ import { endpointUrl, observeEndpoint } from "./endpoint.js";
6
7
  import { nameOfDisk } from "./names.js";
7
8
  import { displayOf, hostProcesses, vmsOn } from "./processes.js";
8
- import { existingImage, filesOfDirectory, isImage, mcpSourceOf, readFirstLine, readProperties, } from "./store.js";
9
+ import { existingImage, filesOfDirectory, isImage, mcpSourceOf, readFirstLine, readProperties, telemetryOf, } from "./store.js";
9
10
  /**
10
11
  * The images in scope, or the one named, with what runs them now: one look
11
12
  * at the store and one at the host's processes. It pings nothing and writes
@@ -19,6 +20,66 @@ export async function list(context, name) {
19
20
  const processes = await hostProcesses(context);
20
21
  return images.map((files) => describe(files, processes));
21
22
  }
23
+ /**
24
+ * The image a forwarded call goes to when the endpoint files alone can say:
25
+ * the image named, or, naming none, the only image whose endpoint names a
26
+ * live process, when that process is the VM an earlier look saw running the
27
+ * image (`seen`, by image name). Undefined whenever only the look `list`
28
+ * takes can say, refusals included. Listing the host's processes reads every
29
+ * process's command line, tens of milliseconds where there are many, which
30
+ * each call would pay; a VM keeps its pid and its endpoint while it runs.
31
+ */
32
+ export function answeringFromEndpoints(context, seen, name) {
33
+ let images;
34
+ try {
35
+ images = name === undefined ? imagesInScope(context) : [existingImage(context, name)];
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ const live = [];
41
+ for (const files of images) {
42
+ if (fs.existsSync(files.building)) {
43
+ if (name !== undefined) {
44
+ return undefined;
45
+ }
46
+ continue;
47
+ }
48
+ let text;
49
+ try {
50
+ text = fs.readFileSync(files.endpoint, "utf8");
51
+ }
52
+ catch {
53
+ continue;
54
+ }
55
+ let handoff;
56
+ try {
57
+ handoff = parseEndpointHandoff(text);
58
+ }
59
+ catch {
60
+ return undefined;
61
+ }
62
+ if (handoff.pid === undefined) {
63
+ return undefined;
64
+ }
65
+ if (isAlive(handoff.pid)) {
66
+ live.push({ files, url: endpointUrl(handoff), pid: handoff.pid });
67
+ }
68
+ }
69
+ if (live.length !== 1 || seen.get(live[0].files.name) !== live[0].pid) {
70
+ return undefined;
71
+ }
72
+ return { name: live[0].files.name, endpoint: { url: live[0].url, pid: live[0].pid } };
73
+ }
74
+ function isAlive(pid) {
75
+ try {
76
+ process.kill(pid, 0);
77
+ return true;
78
+ }
79
+ catch (error) {
80
+ return error.code === "EPERM";
81
+ }
82
+ }
22
83
  function imagesInScope(context) {
23
84
  const store = storeRoot(context.home);
24
85
  let entries;
@@ -45,6 +106,7 @@ export function describe(files, processes) {
45
106
  const mcp = mcpSourceOf(created?.mcp);
46
107
  const everyStart = readFirstLine(files.onStart) !== undefined;
47
108
  const observed = vms.length > 0 ? observeEndpoint(files, vms) : undefined;
109
+ const telemetry = imageTelemetry(observed, telemetryOf(created));
48
110
  return {
49
111
  name: files.name,
50
112
  path: files.imagePath,
@@ -57,8 +119,24 @@ export function describe(files, processes) {
57
119
  ...(template === undefined ? {} : { template }),
58
120
  ...(pharoVersion === undefined ? {} : { pharoVersion: pharoVersionOf(pharoVersion) }),
59
121
  ...(mcp === undefined ? {} : { mcp: mcp.source === "script" && everyStart ? { ...mcp, everyStart: true } : mcp }),
122
+ ...(telemetry === undefined ? {} : { telemetry }),
60
123
  };
61
124
  }
125
+ /**
126
+ * Whether the image records its calls: running, what its start said, else
127
+ * what its create said. A server with no backend to record with, in an image
128
+ * whose create said why it has none, is said by that reason, which says what
129
+ * to do.
130
+ */
131
+ export function imageTelemetry(observed, created) {
132
+ const started = observed !== undefined && "endpoint" in observed ? observed.telemetry : undefined;
133
+ if (started === undefined) {
134
+ return created;
135
+ }
136
+ return !started.on && started.reason === "no-backend" && created?.on === false && created.reason !== undefined
137
+ ? created
138
+ : started;
139
+ }
62
140
  /**
63
141
  * A create still making the image wins whatever VM runs it: a script
64
142
  * create's own VM runs the image it prepares.
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/images/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAElB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,eAAe,EAA4B,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,aAAa,EACb,cAAc,GAEf,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAsB,EAAE,IAAa;IAC9D,MAAM,MAAM,GACV,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,aAA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AAC;AAClG,CAAC;AAED,iGAAiG;AACjG,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,KAAiB;IACvC,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9E,OAAO,SAAS,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrF,CAAC"}
@@ -12,7 +12,14 @@ export declare function createFromTemplate(context: ImagesContext, files: ImageF
12
12
  /**
13
13
  * Run the preparation in the image, which loads MCP, saves and quits. What
14
14
  * failed, when it did: the image's own report first, since it names the
15
- * Smalltalk error, then the launcher's.
15
+ * Smalltalk error, then the launcher's. Otherwise whether MCP has its
16
+ * OpenTelemetry backend, as the image said, once the clones it forgot are
17
+ * deleted.
16
18
  */
17
- export declare function prepare(context: ImagesContext, files: ImageFiles, source: PrepareSource): Promise<string | undefined>;
19
+ export declare function prepare(context: ImagesContext, files: ImageFiles, source: PrepareSource): Promise<{
20
+ failure: string;
21
+ } | {
22
+ failure?: undefined;
23
+ telemetry?: boolean;
24
+ }>;
18
25
  //# sourceMappingURL=prepare.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../src/images/prepare.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAiB,KAAK,aAAa,E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from "node:path";
2
3
  import { launcherFailureMessage, launchLogPaths, launchOutputTail, } from "../launcher/pharoLauncherMcpClient.js";
3
4
  import { prepareScript } from "./scripts.js";
4
5
  import { readProperties } from "./store.js";
@@ -17,7 +18,9 @@ export async function createFromTemplate(context, files, template) {
17
18
  /**
18
19
  * Run the preparation in the image, which loads MCP, saves and quits. What
19
20
  * failed, when it did: the image's own report first, since it names the
20
- * Smalltalk error, then the launcher's.
21
+ * Smalltalk error, then the launcher's. Otherwise whether MCP has its
22
+ * OpenTelemetry backend, as the image said, once the clones it forgot are
23
+ * deleted.
21
24
  */
22
25
  export async function prepare(context, files, source) {
23
26
  fs.mkdirSync(files.plexusDir, { recursive: true });
@@ -31,9 +34,10 @@ export async function prepare(context, files, source) {
31
34
  });
32
35
  const status = readProperties(files.prepareStatus);
33
36
  if (result.ok && status?.status === "ok") {
37
+ deleteForgottenClones(files);
34
38
  fs.rmSync(files.prepareScript, { force: true });
35
39
  fs.rmSync(files.prepareStatus, { force: true });
36
- return undefined;
40
+ return status.telemetry === "on" || status.telemetry === "off" ? { telemetry: status.telemetry === "on" } : {};
37
41
  }
38
42
  const reasons = [
39
43
  status?.status === "failed"
@@ -42,7 +46,7 @@ export async function prepare(context, files, source) {
42
46
  result.ok ? undefined : launcherFailureMessage("startImage", result),
43
47
  ].filter((reason) => reason !== undefined);
44
48
  const logs = launchLogPaths(result);
45
- return [
49
+ const failure = [
46
50
  // A launch that failed says how in its own message. One that ended well
47
51
  // without a status leaves only what the VM printed to say why.
48
52
  ...(reasons.length > 0
@@ -50,5 +54,44 @@ export async function prepare(context, files, source) {
50
54
  : ["The preparation ended without saying whether MCP loaded.", ...launchOutputTail(result)]),
51
55
  ...(logs.length > 0 ? [`Launcher logs: ${logs.join(", ")}`] : []),
52
56
  ].join("\n");
57
+ return { failure };
58
+ }
59
+ /**
60
+ * Deletes the clones the preparation forgot, which its status names one per
61
+ * `clone=` line: each within the image's directory, and nothing else. A clone
62
+ * that cannot be deleted is left.
63
+ */
64
+ function deleteForgottenClones(files) {
65
+ let text;
66
+ try {
67
+ text = fs.readFileSync(files.prepareStatus, "utf8");
68
+ }
69
+ catch {
70
+ return;
71
+ }
72
+ const dir = realPath(files.dir);
73
+ for (const line of text.split(/\r\n|\n|\r/)) {
74
+ if (!line.startsWith("clone=")) {
75
+ continue;
76
+ }
77
+ const clone = realPath(line.slice("clone=".length).trim());
78
+ const inside = path.relative(dir, clone);
79
+ if (inside !== "" && !inside.startsWith("..") && !path.isAbsolute(inside)) {
80
+ try {
81
+ fs.rmSync(clone, { recursive: true, force: true, maxRetries: 3 });
82
+ }
83
+ catch {
84
+ // Left: a later load of that project may then need it deleted by hand.
85
+ }
86
+ }
87
+ }
88
+ }
89
+ function realPath(file) {
90
+ try {
91
+ return fs.realpathSync.native(file);
92
+ }
93
+ catch {
94
+ return path.resolve(file);
95
+ }
53
96
  }
54
97
  //# sourceMappingURL=prepare.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/images/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,gBAAgB,GACjB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,cAAc,EAAmB,MAAM,YAAY,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAsB,EACtB,KAAiB,EACjB,QAA4C;IAE5C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC;QAClD,YAAY,EAAE,QAAQ,CAAC,IAAI;QAC3B,gBAAgB,EAAE,QAAQ,CAAC,QAAQ;QACnC,YAAY,EAAE,KAAK,CAAC,QAAQ;KAC7B,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,C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AAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,MAAM,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1E,IAAI,CAAC;gBACH,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;YACpE,CAAC;YAAC,MAAM,CAAC;gBACP,uEAAuE;YACzE,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
@@ -22,11 +22,19 @@ export type PrepareSource = {
22
22
  * Get MCP into a fresh image, save it and quit. The pinned release is loaded
23
23
  * with the Metacello expression PLexus has always used, with its `Telemetry`
24
24
  * group beside its default one when telemetry is asked for; a script is filed
25
- * in instead.
25
+ * in instead. The status says whether MCP then has its OpenTelemetry backend
26
+ * (`telemetry=on`), which a script may or may not have loaded.
26
27
  *
27
- * A pinned load forgets the Iceberg repositories it registered: their
28
- * locations name the build directory, which a base is renamed away from. A
29
- * script's are kept, since its image is built where it stays.
28
+ * The image clones `github://` repositories over HTTPS, as a public one needs
29
+ * no credentials that way, before it loads anything and in the image saved.
30
+ *
31
+ * A pinned load forgets the Iceberg repositories it registered whose clone is
32
+ * in the build directory, which a base is renamed away from, and the status
33
+ * names those clones (`clone=`) for PLexus to delete once the image has quit:
34
+ * a clone left without its repository is taken by a later load of the same
35
+ * project for one it must not overwrite, which then fails. A clone elsewhere,
36
+ * in a location every image shares, stays registered. A script's are kept,
37
+ * since its image is built where it stays.
30
38
  */
31
39
  export declare function prepareScript(source: PrepareSource): string;
32
40
  /**
@@ -36,11 +44,15 @@ export declare function prepareScript(source: PrepareSource): string;
36
44
  *
37
45
  * Port 0 asks the system for a free port; the file names the port bound and
38
46
  * the pid that bound it, written under another name and renamed so that a
39
- * reader never sees half of it. It never saves the image.
47
+ * reader never sees half of it. The pid is `LibC>>#getpid`'s where the image
48
+ * has it, else `LibC>>#currentProcessId`'s, which Pharo 10 has. It never
49
+ * saves the image.
40
50
  *
41
51
  * With telemetry, a server that has an OpenTelemetry backend is switched to
42
52
  * it before it starts; one without is started as it is, and a backend that
43
- * fails to switch leaves it so too.
53
+ * fails to switch leaves it so too. The file says whether the server records
54
+ * through OpenTelemetry (`telemetry=on`), and when not, why
55
+ * (`telemetry.reason`, `telemetry.detail`): see `TelemetryOffReason`.
44
56
  */
45
57
  export declare function startScript(options?: {
46
58
  telemetry?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../src/images/scripts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM;;;;;;EAQjD;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAuBvC;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAiD3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CA+CzE"}
1
+ {"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../src/images/scripts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM;;;;;;EAQjD;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA0BvC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA8D3D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAoEzE"}
@@ -20,6 +20,8 @@ function smalltalkPath(value) {
20
20
  }
21
21
  // A properties value is one line.
22
22
  const errorText = "((error description copyReplaceAll: String cr with: ' ') copyReplaceAll: String lf with: ' ')";
23
+ /** The longest error a start script writes as why the server records nothing. */
24
+ const detailLength = 300;
23
25
  function failureWriter(file, indent) {
24
26
  return [
25
27
  `${indent}${file} ensureDelete.`,
@@ -32,11 +34,19 @@ function failureWriter(file, indent) {
32
34
  * Get MCP into a fresh image, save it and quit. The pinned release is loaded
33
35
  * with the Metacello expression PLexus has always used, with its `Telemetry`
34
36
  * group beside its default one when telemetry is asked for; a script is filed
35
- * in instead.
37
+ * in instead. The status says whether MCP then has its OpenTelemetry backend
38
+ * (`telemetry=on`), which a script may or may not have loaded.
36
39
  *
37
- * A pinned load forgets the Iceberg repositories it registered: their
38
- * locations name the build directory, which a base is renamed away from. A
39
- * script's are kept, since its image is built where it stays.
40
+ * The image clones `github://` repositories over HTTPS, as a public one needs
41
+ * no credentials that way, before it loads anything and in the image saved.
42
+ *
43
+ * A pinned load forgets the Iceberg repositories it registered whose clone is
44
+ * in the build directory, which a base is renamed away from, and the status
45
+ * names those clones (`clone=`) for PLexus to delete once the image has quit:
46
+ * a clone left without its repository is taken by a later load of the same
47
+ * project for one it must not overwrite, which then fails. A clone elsewhere,
48
+ * in a location every image shares, stays registered. A script's are kept,
49
+ * since its image is built where it stays.
40
50
  */
41
51
  export function prepareScript(source) {
42
52
  const load = source.kind === "pin"
@@ -60,16 +70,24 @@ export function prepareScript(source) {
60
70
  const forget = source.kind === "pin"
61
71
  ? [
62
72
  ` (Smalltalk globals at: #IceRepository ifAbsent: [ nil ]) ifNotNil: [ :class |`,
63
- ` (class registry reject: [ :each | repositoriesBefore includes: each ])`,
64
- ` do: [ :each | class registry remove: each ifAbsent: [ ] ] ].`,
73
+ ` (class registry reject: [ :each | repositoriesBefore includes: each ]) do: [ :each |`,
74
+ ` | location |`,
75
+ ` location := [ each location ifNotNil: [ :place | place asFileReference ] ]`,
76
+ ` on: Error do: [ :error | nil ].`,
77
+ ` (location isNil or: [ FileLocator imageDirectory asFileReference contains: location ]) ifTrue: [`,
78
+ ` class registry remove: each ifAbsent: [ ].`,
79
+ ` location ifNotNil: [ clones add: location fullName ] ] ] ].`,
65
80
  ].join("\n")
66
81
  : "";
67
82
  return `"Written by PLexus to prepare this image. Do not edit."
68
- | dir status repositoriesBefore |
83
+ | dir status repositoriesBefore clones |
69
84
  dir := FileLocator imageDirectory asFileReference / 'plexus'.
70
85
  dir ensureCreateDirectory.
71
86
  status := dir / 'prepare-status.properties'.
87
+ clones := OrderedCollection new.
72
88
  [
89
+ (Smalltalk globals at: #Iceberg ifAbsent: [ nil ]) ifNotNil: [ :class |
90
+ (class respondsTo: #remoteTypeSelector:) ifTrue: [ class remoteTypeSelector: #httpsUrl ] ].
73
91
  repositoriesBefore := (Smalltalk globals at: #IceRepository ifAbsent: [ nil ])
74
92
  ifNil: [ #() ] ifNotNil: [ :class | class registry copy ].
75
93
  ${load}
@@ -77,7 +95,12 @@ ${load}
77
95
  ifFalse: [ Error signal: 'MCP is not in the image after loading.' ].
78
96
  ${forget}
79
97
  status ensureDelete.
80
- status writeStreamDo: [ :stream | stream nextPutAll: 'status=ok'; cr ].
98
+ status writeStreamDo: [ :stream |
99
+ stream nextPutAll: 'status=ok'; cr;
100
+ nextPutAll: 'telemetry=';
101
+ nextPutAll: (((Smalltalk globals at: #MCP) canUnderstand: #useOpenTelemetryObservability)
102
+ ifTrue: [ 'on' ] ifFalse: [ 'off' ]); cr.
103
+ clones do: [ :each | stream nextPutAll: 'clone='; nextPutAll: each; cr ] ].
81
104
  Smalltalk snapshot: true andQuit: true ]
82
105
  on: Error
83
106
  do: [ :error |
@@ -92,22 +115,29 @@ ${failureWriter("status", " ")}
92
115
  *
93
116
  * Port 0 asks the system for a free port; the file names the port bound and
94
117
  * the pid that bound it, written under another name and renamed so that a
95
- * reader never sees half of it. It never saves the image.
118
+ * reader never sees half of it. The pid is `LibC>>#getpid`'s where the image
119
+ * has it, else `LibC>>#currentProcessId`'s, which Pharo 10 has. It never
120
+ * saves the image.
96
121
  *
97
122
  * With telemetry, a server that has an OpenTelemetry backend is switched to
98
123
  * it before it starts; one without is started as it is, and a backend that
99
- * fails to switch leaves it so too.
124
+ * fails to switch leaves it so too. The file says whether the server records
125
+ * through OpenTelemetry (`telemetry=on`), and when not, why
126
+ * (`telemetry.reason`, `telemetry.detail`): see `TelemetryOffReason`.
100
127
  */
101
128
  export function startScript(options = {}) {
102
129
  const observability = options.telemetry
103
130
  ? [
131
+ ` telemetry := 'no-backend'.`,
104
132
  ` (mcp respondsTo: #useOpenTelemetryObservability) ifTrue: [`,
105
- ` [ mcp useOpenTelemetryObservability ] on: Error do: [ :error | nil ] ].`,
133
+ ` telemetry := [ mcp useOpenTelemetryObservability. nil ]`,
134
+ ` on: Error`,
135
+ ` do: [ :error | failure := ${errorText}. 'switch-failed' ] ].`,
106
136
  ``,
107
137
  ].join("\n")
108
- : "";
138
+ : ` telemetry := 'not-asked'.\n`;
109
139
  return `"Written by PLexus to start this image's MCP server. Do not edit."
110
- | dir status mcp port pid endpoint temporary |
140
+ | dir status mcp port pid endpoint temporary telemetry failure records |
111
141
  dir := FileLocator imageDirectory asFileReference / 'plexus'.
112
142
  status := dir / 'start-status.properties'.
113
143
  [
@@ -119,7 +149,12 @@ status := dir / 'start-status.properties'.
119
149
  ifFalse: [ Error signal: 'MCP is not in the image.' ].
120
150
  (Smalltalk globals at: #PLexusMCPServer ifAbsent: [ nil ])
121
151
  ifNotNil: [ :previous | [ previous stop ] on: Error do: [ :error | nil ] ].
122
- pid := [ (Smalltalk globals at: #LibC) uniqueInstance getpid ]
152
+ pid := [
153
+ | libc |
154
+ libc := (Smalltalk globals at: #LibC) uniqueInstance.
155
+ (libc respondsTo: #getpid)
156
+ ifTrue: [ libc getpid ]
157
+ ifFalse: [ libc currentProcessId ] ]
123
158
  on: Error do: [ :error | nil ].
124
159
  mcp := (Smalltalk globals at: #MCP) new.
125
160
  ${observability} mcp port: 0.
@@ -128,6 +163,12 @@ ${observability} mcp port: 0.
128
163
  (port isInteger and: [ port > 0 ])
129
164
  ifFalse: [ Error signal: 'MCP did not report a bound port after starting.' ].
130
165
  Smalltalk globals at: #PLexusMCPServer put: mcp.
166
+ records := [
167
+ (mcp respondsTo: #observability) and: [
168
+ (Smalltalk globals at: #MCPOpenTelemetryObservabilityBackend ifAbsent: [ nil ])
169
+ ifNil: [ false ]
170
+ ifNotNil: [ :backend | mcp observability isKindOf: backend ] ] ]
171
+ on: Error do: [ :error | false ].
131
172
  endpoint := dir / 'endpoint.properties'.
132
173
  temporary := dir / 'endpoint.properties.tmp'.
133
174
  temporary ensureDelete.
@@ -136,7 +177,14 @@ ${observability} mcp port: 0.
136
177
  stream nextPutAll: 'host=127.0.0.1'; cr.
137
178
  stream nextPutAll: 'port='; nextPutAll: port asString; cr.
138
179
  stream nextPutAll: 'path=/'; cr.
139
- pid ifNotNil: [ :value | stream nextPutAll: 'pid='; nextPutAll: value asString; cr ] ].
180
+ pid ifNotNil: [ :value | stream nextPutAll: 'pid='; nextPutAll: value asString; cr ].
181
+ records
182
+ ifTrue: [ stream nextPutAll: 'telemetry=on'; cr ]
183
+ ifFalse: [
184
+ stream nextPutAll: 'telemetry=off'; cr.
185
+ telemetry ifNotNil: [ :reason | stream nextPutAll: 'telemetry.reason='; nextPutAll: reason; cr ].
186
+ failure ifNotNil: [ :text |
187
+ stream nextPutAll: 'telemetry.detail='; nextPutAll: (text first: (text size min: ${detailLength})); cr ] ] ].
140
188
  endpoint ensureDelete.
141
189
  temporary renameTo: endpoint basename ]
142
190
  on: Error
@@ -1 +1 @@
1
- {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../src/images/scripts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,OAAO;QACL,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,IAAI,OAAO,EAAE;QACxB,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,KAAK;KACP,CAAC;AACb,CAAC;AAMD,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;AAC5C,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,kCAAkC;AACl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AAwG;YACxG,oDAAoD;YACpD,qEAAqE;SACtE,CAAC,IAAI,CAAC,IAAI,CAAC;QACd,CAAC,CAAC,EAAE,CAAC;IAET,OAAO;;;;;;;;;;;EAWP,IAAI;;;EAGJ,MAAM;;;;;;;;;;;EAWN,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC;;CAElC,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,UAAmC,EAAE;IAC/D,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS;QACrC,CAAC,CAAC;YACE,8BAA8B;YAC9B,8DAA8D;YAC9D,6DAA6D;YAC7D,iBAAiB;YACjB,mCAAmC,SAAS,wBAAwB;YACpE,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC;QACd,CAAC,CAAC,+BAA+B,CAAC;IACpC,OAAO;;;;;;;;;;;;;;;;;;;;;EAqBP,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;6FA2B8E,YAAY;;;;;EAKvG,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC;;;CAGlC,CAAC;AACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { PlexusError } from "../errors.js";
2
- import type { Display, Endpoint, StartOptions } from "../types.js";
2
+ import type { Display, Endpoint, ImageTelemetry, StartOptions } from "../types.js";
3
3
  import { type ClaimHolder, type ClaimState } from "./claims.js";
4
4
  import type { ImagesContext } from "./context.js";
5
5
  import { type ImageFiles } from "./store.js";
@@ -10,11 +10,18 @@ export interface StartResult {
10
10
  endpoint: Endpoint;
11
11
  display: Display;
12
12
  seconds: number;
13
+ /** Whether its server records its calls through OpenTelemetry, and why not: see `ImageInfo.telemetry`. */
14
+ telemetry?: ImageTelemetry;
15
+ /** The image was already running and answering, and was left as it was. */
16
+ alreadyRunning?: true;
13
17
  }
14
18
  /**
15
19
  * Launch the image with the start script and wait until its MCP server
16
- * answers, or fail as soon as the VM reports a failure or exits. Nothing is
17
- * recorded: the next look at the host is what says it runs.
20
+ * answers, or fail as soon as the VM reports a failure or exits. An image
21
+ * whose server already answers is what a start is for, and is answered as
22
+ * it is (`alreadyRunning`); one a VM runs that does not answer is refused.
23
+ * Nothing is recorded: the next look at the host is what says it runs, and
24
+ * whether it records its calls.
18
25
  */
19
26
  export declare function start(context: ImagesContext, name: string, options?: StartOptions): Promise<StartResult>;
20
27
  /** Whether a start holds this image's launch lock now. */
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/images/start.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAQ3C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAwB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,qBAAqB,SAAU,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,KAAK,CACzB,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CA4EtB;AA4GD,0DAA0D;AAC1D,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAErF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,CAM5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