@orkestrel/probe 0.0.13 → 0.0.14

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.
@@ -871,7 +871,7 @@ export declare function parseRevisionOwner(revision: string): number | undefined
871
871
  * const probe = new Probe({ workspace: process.cwd() })
872
872
  * const verdict = await probe.prove(claim)
873
873
  * verdict.digest // 'fcb88a2dee987b8673c1fc7107979470'
874
- * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.82.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
874
+ * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.83.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
875
875
  * await probe.destroy()
876
876
  * ```
877
877
  */
@@ -895,9 +895,11 @@ export declare class Probe implements ProbeInterface {
895
895
  * stdio transport.
896
896
  *
897
897
  * @remarks
898
- * Construction creates the probe, publishes the `prove` tool, and binds the dual-era dispatcher to
899
- * the stdio transport. The probe begins warming there, so a harness that spawns the entry pays
900
- * arming while its client is still handshaking.
898
+ * Construction snapshots the probe options, publishes the `prove` tool, and binds the dual-era
899
+ * dispatcher to the stdio transport. An admitted `prove` call creates the probe and begins
900
+ * workspace arming, so discovery does not depend on the workspace toolchain. Construction is held
901
+ * before it begins, so teardown entered through a construction callback waits for the resulting
902
+ * probe and releases it. A constructor refusal clears that held operation for a later retry.
901
903
  *
902
904
  * `start` seizes standard input and registers the signals a harness ends a child with, and records
903
905
  * whether standard input was already flowing. Every listener it attaches is held as a field, and
@@ -921,9 +923,10 @@ export declare class Probe implements ProbeInterface {
921
923
  export declare class ProbeServer implements ProbeServerInterface {
922
924
  #private;
923
925
  /**
924
- * Creates the probe this server publishes and binds it to this process's stdio transport.
926
+ * Snapshots the probe options this server will use and binds the published schema to this
927
+ * process's stdio transport. An admitted `prove` call creates the probe.
925
928
  *
926
- * @param options - Workspace, deadline, and initial observation hooks for the probe it creates
929
+ * @param options - Workspace, deadline, and initial observation hooks for the deferred probe
927
930
  */
928
931
  constructor(options?: ProbeOptions);
929
932
  start(): void;
@@ -934,11 +937,17 @@ export declare class ProbeServer implements ProbeServerInterface {
934
937
  * Serves one probe over this process's Model Context Protocol stdio transport.
935
938
  *
936
939
  * @remarks
940
+ * Construction snapshots the options and resolves the workspace against the current working
941
+ * directory without loading its toolchain. Discovery can therefore answer before an admitted
942
+ * `prove` call creates the real probe and starts arming. Invalid claims do not create it.
943
+ *
937
944
  * The server owns the process it runs in. `start` seizes standard input and standard output for
938
945
  * the transport and registers the termination handlers a harness signals, so a host that starts one
939
946
  * has already given the process to it. `destroy` reverses all of that and tears the probe down with
940
- * it, which is why there is no verb that stops serving and leaves the stages standing: a probe
941
- * nothing is reading from holds its tools and its mirror for nobody.
947
+ * it when an admitted call created it. When teardown begins during admitted construction, it waits
948
+ * for that construction and releases the resulting probe before it settles. Destruction before
949
+ * admission loads no workspace tools, which is why there is no verb that stops serving and leaves
950
+ * the stages standing: a probe nothing is reading from holds its tools and its mirror for nobody.
942
951
  *
943
952
  * @example
944
953
  * ```ts
@@ -971,14 +980,15 @@ export declare interface ProbeServerInterface {
971
980
  *
972
981
  * @remarks
973
982
  * Settling is idempotent: a call made while teardown is running joins it and returns the same
974
- * promise, and a call made afterwards returns that settled promise. The server removes exactly the
975
- * listeners it attached, holding each one as a field rather than choosing by absence from a
976
- * capture, so a host that keeps running after this call reads its own standard input again and
977
- * receives its own signals, and a listener the host registered while
978
- * the server was serving is still attached and still fires. That covers the stream's flow as
979
- * well as its listeners: standard input is left flowing when it was already flowing before
980
- * `start` and when something else is reading it at release, and a stream nothing had read yet
981
- * and nothing else reads is paused.
983
+ * promise, and a call made afterwards returns that settled promise. An admitted probe construction
984
+ * is part of teardown ownership even when a callback begins teardown before that construction
985
+ * returns. The server removes exactly the listeners it attached, holding each one as a field
986
+ * instead of choosing by absence from a capture. A host that keeps running after this call reads
987
+ * its own standard input again and receives its own signals, and a listener the host registered
988
+ * while the server was serving is still attached and still fires. That covers the stream's flow
989
+ * as well as its listeners: standard input is left flowing when it was already flowing before
990
+ * `start` and when something else is reading it at release, and a stream nothing had read yet and
991
+ * nothing else reads is paused.
982
992
  *
983
993
  * @returns A promise that settles after the probe releases every stage's tool and mirror
984
994
  */
@@ -1273,6 +1283,9 @@ export declare class RuntimeStage implements StageInterface {
1273
1283
  /**
1274
1284
  * Starts warming the target workspace's Vitest service.
1275
1285
  *
1286
+ * @remarks Loading starts during this call. A loader refusal rejects the owned warm operation
1287
+ * rather than construction, so `inspect` reports it and `destroy` remains available.
1288
+ *
1276
1289
  * @param workspace - The target workspace root. Default: the current working directory
1277
1290
  */
1278
1291
  constructor(workspace?: string);
@@ -871,7 +871,7 @@ export declare function parseRevisionOwner(revision: string): number | undefined
871
871
  * const probe = new Probe({ workspace: process.cwd() })
872
872
  * const verdict = await probe.prove(claim)
873
873
  * verdict.digest // 'fcb88a2dee987b8673c1fc7107979470'
874
- * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.82.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
874
+ * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.83.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
875
875
  * await probe.destroy()
876
876
  * ```
877
877
  */
@@ -895,9 +895,11 @@ export declare class Probe implements ProbeInterface {
895
895
  * stdio transport.
896
896
  *
897
897
  * @remarks
898
- * Construction creates the probe, publishes the `prove` tool, and binds the dual-era dispatcher to
899
- * the stdio transport. The probe begins warming there, so a harness that spawns the entry pays
900
- * arming while its client is still handshaking.
898
+ * Construction snapshots the probe options, publishes the `prove` tool, and binds the dual-era
899
+ * dispatcher to the stdio transport. An admitted `prove` call creates the probe and begins
900
+ * workspace arming, so discovery does not depend on the workspace toolchain. Construction is held
901
+ * before it begins, so teardown entered through a construction callback waits for the resulting
902
+ * probe and releases it. A constructor refusal clears that held operation for a later retry.
901
903
  *
902
904
  * `start` seizes standard input and registers the signals a harness ends a child with, and records
903
905
  * whether standard input was already flowing. Every listener it attaches is held as a field, and
@@ -921,9 +923,10 @@ export declare class Probe implements ProbeInterface {
921
923
  export declare class ProbeServer implements ProbeServerInterface {
922
924
  #private;
923
925
  /**
924
- * Creates the probe this server publishes and binds it to this process's stdio transport.
926
+ * Snapshots the probe options this server will use and binds the published schema to this
927
+ * process's stdio transport. An admitted `prove` call creates the probe.
925
928
  *
926
- * @param options - Workspace, deadline, and initial observation hooks for the probe it creates
929
+ * @param options - Workspace, deadline, and initial observation hooks for the deferred probe
927
930
  */
928
931
  constructor(options?: ProbeOptions);
929
932
  start(): void;
@@ -934,11 +937,17 @@ export declare class ProbeServer implements ProbeServerInterface {
934
937
  * Serves one probe over this process's Model Context Protocol stdio transport.
935
938
  *
936
939
  * @remarks
940
+ * Construction snapshots the options and resolves the workspace against the current working
941
+ * directory without loading its toolchain. Discovery can therefore answer before an admitted
942
+ * `prove` call creates the real probe and starts arming. Invalid claims do not create it.
943
+ *
937
944
  * The server owns the process it runs in. `start` seizes standard input and standard output for
938
945
  * the transport and registers the termination handlers a harness signals, so a host that starts one
939
946
  * has already given the process to it. `destroy` reverses all of that and tears the probe down with
940
- * it, which is why there is no verb that stops serving and leaves the stages standing: a probe
941
- * nothing is reading from holds its tools and its mirror for nobody.
947
+ * it when an admitted call created it. When teardown begins during admitted construction, it waits
948
+ * for that construction and releases the resulting probe before it settles. Destruction before
949
+ * admission loads no workspace tools, which is why there is no verb that stops serving and leaves
950
+ * the stages standing: a probe nothing is reading from holds its tools and its mirror for nobody.
942
951
  *
943
952
  * @example
944
953
  * ```ts
@@ -971,14 +980,15 @@ export declare interface ProbeServerInterface {
971
980
  *
972
981
  * @remarks
973
982
  * Settling is idempotent: a call made while teardown is running joins it and returns the same
974
- * promise, and a call made afterwards returns that settled promise. The server removes exactly the
975
- * listeners it attached, holding each one as a field rather than choosing by absence from a
976
- * capture, so a host that keeps running after this call reads its own standard input again and
977
- * receives its own signals, and a listener the host registered while
978
- * the server was serving is still attached and still fires. That covers the stream's flow as
979
- * well as its listeners: standard input is left flowing when it was already flowing before
980
- * `start` and when something else is reading it at release, and a stream nothing had read yet
981
- * and nothing else reads is paused.
983
+ * promise, and a call made afterwards returns that settled promise. An admitted probe construction
984
+ * is part of teardown ownership even when a callback begins teardown before that construction
985
+ * returns. The server removes exactly the listeners it attached, holding each one as a field
986
+ * instead of choosing by absence from a capture. A host that keeps running after this call reads
987
+ * its own standard input again and receives its own signals, and a listener the host registered
988
+ * while the server was serving is still attached and still fires. That covers the stream's flow
989
+ * as well as its listeners: standard input is left flowing when it was already flowing before
990
+ * `start` and when something else is reading it at release, and a stream nothing had read yet and
991
+ * nothing else reads is paused.
982
992
  *
983
993
  * @returns A promise that settles after the probe releases every stage's tool and mirror
984
994
  */
@@ -1273,6 +1283,9 @@ export declare class RuntimeStage implements StageInterface {
1273
1283
  /**
1274
1284
  * Starts warming the target workspace's Vitest service.
1275
1285
  *
1286
+ * @remarks Loading starts during this call. A loader refusal rejects the owned warm operation
1287
+ * rather than construction, so `inspect` reports it and `destroy` remains available.
1288
+ *
1276
1289
  * @param workspace - The target workspace root. Default: the current working directory
1277
1290
  */
1278
1291
  constructor(workspace?: string);
@@ -1103,7 +1103,7 @@ var Overlay = class {
1103
1103
  };
1104
1104
  //#endregion
1105
1105
  //#region package.json
1106
- var version = "0.0.13";
1106
+ var version = "0.0.14";
1107
1107
  var peerDependencies = {
1108
1108
  "oxlint": "^1.82.0",
1109
1109
  "typescript": "^6.0.3",
@@ -1386,12 +1386,14 @@ var RuntimeStage = class {
1386
1386
  /**
1387
1387
  * Starts warming the target workspace's Vitest service.
1388
1388
  *
1389
+ * @remarks Loading starts during this call. A loader refusal rejects the owned warm operation
1390
+ * rather than construction, so `inspect` reports it and `destroy` remains available.
1391
+ *
1389
1392
  * @param workspace - The target workspace root. Default: the current working directory
1390
1393
  */
1391
1394
  constructor(workspace = process.cwd()) {
1392
1395
  this.#workspace = workspace;
1393
- const vitest = loadWorkspaceVitest(this.#workspace);
1394
- this.#store(this.#warm(vitest.createVitest));
1396
+ this.#store(this.#warm());
1395
1397
  }
1396
1398
  get stage() {
1397
1399
  return "runtime";
@@ -1522,13 +1524,14 @@ var RuntimeStage = class {
1522
1524
  }
1523
1525
  }
1524
1526
  async #warm(create) {
1527
+ const factory = create ?? loadWorkspaceVitest(this.#workspace).createVitest;
1525
1528
  this.#sweep();
1526
1529
  const output = new PassThrough();
1527
1530
  output.resume();
1528
1531
  const signals = captureListeners(process, ["SIGINT", "SIGTERM"]);
1529
1532
  let warming;
1530
1533
  try {
1531
- warming = create("test", {
1534
+ warming = factory("test", {
1532
1535
  root: this.#workspace,
1533
1536
  config: resolveWorkspaceFile(this.#workspace, "vite.config.ts"),
1534
1537
  watch: false,
@@ -2481,7 +2484,7 @@ var TypeStage = class {
2481
2484
  * const probe = new Probe({ workspace: process.cwd() })
2482
2485
  * const verdict = await probe.prove(claim)
2483
2486
  * verdict.digest // 'fcb88a2dee987b8673c1fc7107979470'
2484
- * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.82.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
2487
+ * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.83.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
2485
2488
  * await probe.destroy()
2486
2489
  * ```
2487
2490
  */
@@ -2919,9 +2922,11 @@ var Probe = class {
2919
2922
  * stdio transport.
2920
2923
  *
2921
2924
  * @remarks
2922
- * Construction creates the probe, publishes the `prove` tool, and binds the dual-era dispatcher to
2923
- * the stdio transport. The probe begins warming there, so a harness that spawns the entry pays
2924
- * arming while its client is still handshaking.
2925
+ * Construction snapshots the probe options, publishes the `prove` tool, and binds the dual-era
2926
+ * dispatcher to the stdio transport. An admitted `prove` call creates the probe and begins
2927
+ * workspace arming, so discovery does not depend on the workspace toolchain. Construction is held
2928
+ * before it begins, so teardown entered through a construction callback waits for the resulting
2929
+ * probe and releases it. A constructor refusal clears that held operation for a later retry.
2925
2930
  *
2926
2931
  * `start` seizes standard input and registers the signals a harness ends a child with, and records
2927
2932
  * whether standard input was already flowing. Every listener it attaches is held as a field, and
@@ -2943,7 +2948,7 @@ var Probe = class {
2943
2948
  * ```
2944
2949
  */
2945
2950
  var ProbeServer = class {
2946
- #probe;
2951
+ #options;
2947
2952
  #stream;
2948
2953
  #transport;
2949
2954
  #data;
@@ -2952,14 +2957,25 @@ var ProbeServer = class {
2952
2957
  #signal;
2953
2958
  #server;
2954
2959
  #owns;
2960
+ #construction;
2955
2961
  #closing;
2956
2962
  /**
2957
- * Creates the probe this server publishes and binds it to this process's stdio transport.
2963
+ * Snapshots the probe options this server will use and binds the published schema to this
2964
+ * process's stdio transport. An admitted `prove` call creates the probe.
2958
2965
  *
2959
- * @param options - Workspace, deadline, and initial observation hooks for the probe it creates
2966
+ * @param options - Workspace, deadline, and initial observation hooks for the deferred probe
2960
2967
  */
2961
2968
  constructor(options) {
2962
- this.#probe = new Probe(options);
2969
+ const workspace = options?.workspace;
2970
+ const deadline = options?.deadline;
2971
+ const on = options?.on;
2972
+ const error = options?.error;
2973
+ this.#options = Object.freeze({
2974
+ workspace: resolve(workspace ?? process.cwd()),
2975
+ ...deadline === void 0 ? {} : { deadline },
2976
+ ...on === void 0 ? {} : { on: Object.freeze({ ...on }) },
2977
+ ...error === void 0 ? {} : { error }
2978
+ });
2963
2979
  this.#stream = new PassThrough();
2964
2980
  this.#server = this.#publish();
2965
2981
  this.#transport = createStdioServer(createMCPLegacy(this.#server), { input: this.#stream });
@@ -2994,7 +3010,10 @@ var ProbeServer = class {
2994
3010
  if (this.#owns === true && process.stdin.listenerCount("data") === 0) process.stdin.pause();
2995
3011
  this.#owns = void 0;
2996
3012
  this.#stream.destroy();
2997
- await this.#probe.destroy();
3013
+ const construction = this.#construction;
3014
+ if (construction === void 0) return;
3015
+ const probe = await construction.catch(() => void 0);
3016
+ if (probe !== void 0) await probe.destroy();
2998
3017
  }
2999
3018
  #receive(chunk) {
3000
3019
  this.#stream.write(chunk);
@@ -3040,7 +3059,20 @@ var ProbeServer = class {
3040
3059
  context: { value: input }
3041
3060
  });
3042
3061
  }
3043
- return this.#probe.prove(input);
3062
+ return (await this.#resolveProbe()).prove(input);
3063
+ }
3064
+ async #resolveProbe() {
3065
+ if (this.#closing !== void 0) throw createDestroyedError("probe server");
3066
+ const current = this.#construction;
3067
+ if (current !== void 0) return await current;
3068
+ const construction = Promise.resolve().then(() => new Probe(this.#options));
3069
+ this.#construction = construction;
3070
+ try {
3071
+ return await construction;
3072
+ } catch (error) {
3073
+ if (this.#construction === construction) this.#construction = void 0;
3074
+ throw error;
3075
+ }
3044
3076
  }
3045
3077
  async #execute(context) {
3046
3078
  const result = await context.tools.execute(context.call);