@orkestrel/probe 0.0.13 → 0.0.15

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.
@@ -1104,7 +1104,7 @@ var Overlay = class {
1104
1104
  };
1105
1105
  //#endregion
1106
1106
  //#region package.json
1107
- var version = "0.0.13";
1107
+ var version = "0.0.15";
1108
1108
  var peerDependencies = {
1109
1109
  "oxlint": "^1.82.0",
1110
1110
  "typescript": "^6.0.3",
@@ -1387,12 +1387,14 @@ var RuntimeStage = class {
1387
1387
  /**
1388
1388
  * Starts warming the target workspace's Vitest service.
1389
1389
  *
1390
+ * @remarks Loading starts during this call. A loader refusal rejects the owned warm operation
1391
+ * rather than construction, so `inspect` reports it and `destroy` remains available.
1392
+ *
1390
1393
  * @param workspace - The target workspace root. Default: the current working directory
1391
1394
  */
1392
1395
  constructor(workspace = process.cwd()) {
1393
1396
  this.#workspace = workspace;
1394
- const vitest = loadWorkspaceVitest(this.#workspace);
1395
- this.#store(this.#warm(vitest.createVitest));
1397
+ this.#store(this.#warm());
1396
1398
  }
1397
1399
  get stage() {
1398
1400
  return "runtime";
@@ -1523,13 +1525,14 @@ var RuntimeStage = class {
1523
1525
  }
1524
1526
  }
1525
1527
  async #warm(create) {
1528
+ const factory = create ?? loadWorkspaceVitest(this.#workspace).createVitest;
1526
1529
  this.#sweep();
1527
1530
  const output = new node_stream.PassThrough();
1528
1531
  output.resume();
1529
1532
  const signals = captureListeners(process, ["SIGINT", "SIGTERM"]);
1530
1533
  let warming;
1531
1534
  try {
1532
- warming = create("test", {
1535
+ warming = factory("test", {
1533
1536
  root: this.#workspace,
1534
1537
  config: resolveWorkspaceFile(this.#workspace, "vite.config.ts"),
1535
1538
  watch: false,
@@ -2482,7 +2485,7 @@ var TypeStage = class {
2482
2485
  * const probe = new Probe({ workspace: process.cwd() })
2483
2486
  * const verdict = await probe.prove(claim)
2484
2487
  * verdict.digest // 'fcb88a2dee987b8673c1fc7107979470'
2485
- * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.82.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
2488
+ * verdict.receipt // 'probe:fcb88a2dee987b8673c1fc7107979470:type:typescript@6.0.3:oxlint@1.83.0:vitest@4.1.11:configs/src/tsconfig.core.json@434f59254d58cf2683d453a26bd0d837'
2486
2489
  * await probe.destroy()
2487
2490
  * ```
2488
2491
  */
@@ -2920,9 +2923,11 @@ var Probe = class {
2920
2923
  * stdio transport.
2921
2924
  *
2922
2925
  * @remarks
2923
- * Construction creates the probe, publishes the `prove` tool, and binds the dual-era dispatcher to
2924
- * the stdio transport. The probe begins warming there, so a harness that spawns the entry pays
2925
- * arming while its client is still handshaking.
2926
+ * Construction snapshots the probe options, publishes the `prove` tool, and binds the dual-era
2927
+ * dispatcher to the stdio transport. An admitted `prove` call creates the probe and begins
2928
+ * workspace arming, so discovery does not depend on the workspace toolchain. Construction is held
2929
+ * before it begins, so teardown entered through a construction callback waits for the resulting
2930
+ * probe and releases it. A constructor refusal clears that held operation for a later retry.
2926
2931
  *
2927
2932
  * `start` seizes standard input and registers the signals a harness ends a child with, and records
2928
2933
  * whether standard input was already flowing. Every listener it attaches is held as a field, and
@@ -2944,7 +2949,7 @@ var Probe = class {
2944
2949
  * ```
2945
2950
  */
2946
2951
  var ProbeServer = class {
2947
- #probe;
2952
+ #options;
2948
2953
  #stream;
2949
2954
  #transport;
2950
2955
  #data;
@@ -2953,14 +2958,25 @@ var ProbeServer = class {
2953
2958
  #signal;
2954
2959
  #server;
2955
2960
  #owns;
2961
+ #construction;
2956
2962
  #closing;
2957
2963
  /**
2958
- * Creates the probe this server publishes and binds it to this process's stdio transport.
2964
+ * Snapshots the probe options this server will use and binds the published schema to this
2965
+ * process's stdio transport. An admitted `prove` call creates the probe.
2959
2966
  *
2960
- * @param options - Workspace, deadline, and initial observation hooks for the probe it creates
2967
+ * @param options - Workspace, deadline, and initial observation hooks for the deferred probe
2961
2968
  */
2962
2969
  constructor(options) {
2963
- this.#probe = new Probe(options);
2970
+ const workspace = options?.workspace;
2971
+ const deadline = options?.deadline;
2972
+ const on = options?.on;
2973
+ const error = options?.error;
2974
+ this.#options = Object.freeze({
2975
+ workspace: (0, node_path.resolve)(workspace ?? process.cwd()),
2976
+ ...deadline === void 0 ? {} : { deadline },
2977
+ ...on === void 0 ? {} : { on: Object.freeze({ ...on }) },
2978
+ ...error === void 0 ? {} : { error }
2979
+ });
2964
2980
  this.#stream = new node_stream.PassThrough();
2965
2981
  this.#server = this.#publish();
2966
2982
  this.#transport = (0, _orkestrel_mcp_server.createStdioServer)((0, _orkestrel_mcp.createMCPLegacy)(this.#server), { input: this.#stream });
@@ -2995,7 +3011,10 @@ var ProbeServer = class {
2995
3011
  if (this.#owns === true && process.stdin.listenerCount("data") === 0) process.stdin.pause();
2996
3012
  this.#owns = void 0;
2997
3013
  this.#stream.destroy();
2998
- await this.#probe.destroy();
3014
+ const construction = this.#construction;
3015
+ if (construction === void 0) return;
3016
+ const probe = await construction.catch(() => void 0);
3017
+ if (probe !== void 0) await probe.destroy();
2999
3018
  }
3000
3019
  #receive(chunk) {
3001
3020
  this.#stream.write(chunk);
@@ -3041,7 +3060,20 @@ var ProbeServer = class {
3041
3060
  context: { value: input }
3042
3061
  });
3043
3062
  }
3044
- return this.#probe.prove(input);
3063
+ return (await this.#resolveProbe()).prove(input);
3064
+ }
3065
+ async #resolveProbe() {
3066
+ if (this.#closing !== void 0) throw (0, _src_core.createDestroyedError)("probe server");
3067
+ const current = this.#construction;
3068
+ if (current !== void 0) return await current;
3069
+ const construction = Promise.resolve().then(() => new Probe(this.#options));
3070
+ this.#construction = construction;
3071
+ try {
3072
+ return await construction;
3073
+ } catch (error) {
3074
+ if (this.#construction === construction) this.#construction = void 0;
3075
+ throw error;
3076
+ }
3045
3077
  }
3046
3078
  async #execute(context) {
3047
3079
  const result = await context.tools.execute(context.call);