ttsc 0.32.0 → 0.32.1

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 (164) hide show
  1. package/lib/TtscCompiler.js +1 -1
  2. package/lib/TtscCompiler.js.map +1 -1
  3. package/lib/compiler/internal/ResidentCheckProcess.d.ts +74 -96
  4. package/lib/compiler/internal/ResidentCheckProcess.js +150 -335
  5. package/lib/compiler/internal/ResidentCheckProcess.js.map +1 -1
  6. package/lib/compiler/internal/ResidentCheckProcessHost.d.ts +127 -0
  7. package/lib/compiler/internal/ResidentCheckProcessHost.js +447 -0
  8. package/lib/compiler/internal/ResidentCheckProcessHost.js.map +1 -0
  9. package/lib/compiler/internal/ResidentCheckProcessProtocol.d.ts +64 -0
  10. package/lib/compiler/internal/ResidentCheckProcessProtocol.js +3 -0
  11. package/lib/compiler/internal/ResidentCheckProcessProtocol.js.map +1 -0
  12. package/lib/compiler/internal/build/BuildExecution.d.ts +103 -1
  13. package/lib/compiler/internal/build/BuildExecution.js +91 -11
  14. package/lib/compiler/internal/build/BuildExecution.js.map +1 -1
  15. package/lib/compiler/internal/build/ResidentCheckWatchSession.d.ts +16 -11
  16. package/lib/compiler/internal/build/ResidentCheckWatchSession.js +37 -21
  17. package/lib/compiler/internal/build/ResidentCheckWatchSession.js.map +1 -1
  18. package/lib/compiler/internal/build/RunBuildOptions.d.ts +6 -5
  19. package/lib/compiler/internal/build/WatchInputPublication.d.ts +59 -0
  20. package/lib/compiler/internal/build/WatchInputPublication.js +93 -0
  21. package/lib/compiler/internal/build/WatchInputPublication.js.map +1 -0
  22. package/lib/compiler/internal/build/runBuild.d.ts +29 -2
  23. package/lib/compiler/internal/build/runBuild.js +45 -19
  24. package/lib/compiler/internal/build/runBuild.js.map +1 -1
  25. package/lib/compiler/internal/buildNativeCompiler.d.ts +2 -0
  26. package/lib/compiler/internal/buildNativeCompiler.js +1 -0
  27. package/lib/compiler/internal/buildNativeCompiler.js.map +1 -1
  28. package/lib/compiler/internal/compileProjectInMemory.js +4 -2
  29. package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
  30. package/lib/compiler/internal/project/resolveOwningProjectConfig.d.ts +7 -2
  31. package/lib/compiler/internal/project/resolveOwningProjectConfig.js +6 -3
  32. package/lib/compiler/internal/project/resolveOwningProjectConfig.js.map +1 -1
  33. package/lib/compiler/internal/readEffectiveCompilerOptions.js +1 -1
  34. package/lib/compiler/internal/readEffectiveCompilerOptions.js.map +1 -1
  35. package/lib/compiler/internal/resolveBinary.d.ts +1 -0
  36. package/lib/compiler/internal/resolveBinary.js.map +1 -1
  37. package/lib/compiler/internal/resolveTsgo.d.ts +6 -0
  38. package/lib/compiler/internal/resolveTsgo.js.map +1 -1
  39. package/lib/compiler/internal/runSingleFileEmit.d.ts +28 -1
  40. package/lib/compiler/internal/runSingleFileEmit.js +120 -86
  41. package/lib/compiler/internal/runSingleFileEmit.js.map +1 -1
  42. package/lib/compiler/internal/startResidentTransform.js +8 -2
  43. package/lib/compiler/internal/startResidentTransform.js.map +1 -1
  44. package/lib/compiler/internal/transformProjectInMemory.js +11 -3
  45. package/lib/compiler/internal/transformProjectInMemory.js.map +1 -1
  46. package/lib/compiler/internal/transformProjectInWorker.d.ts +1 -1
  47. package/lib/compiler/internal/transformProjectInWorker.js +3 -2
  48. package/lib/compiler/internal/transformProjectInWorker.js.map +1 -1
  49. package/lib/internal/workerModuleUrl.d.ts +28 -0
  50. package/lib/internal/workerModuleUrl.js +40 -0
  51. package/lib/internal/workerModuleUrl.js.map +1 -0
  52. package/lib/launcher/internal/buildSingleRootProject.js +2 -1
  53. package/lib/launcher/internal/buildSingleRootProject.js.map +1 -1
  54. package/lib/launcher/internal/getCompilerVersionText.js +3 -2
  55. package/lib/launcher/internal/getCompilerVersionText.js.map +1 -1
  56. package/lib/launcher/internal/prepareExecution.js +2 -1
  57. package/lib/launcher/internal/prepareExecution.js.map +1 -1
  58. package/lib/launcher/internal/runTtsc.js +91 -41
  59. package/lib/launcher/internal/runTtsc.js.map +1 -1
  60. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.d.ts +10 -6
  61. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js +11 -9
  62. package/lib/launcher/internal/runtime/CommonJsRuntimeSource.js.map +1 -1
  63. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.d.ts +20 -0
  64. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.js +27 -0
  65. package/lib/launcher/internal/runtime/advertiseTypeScriptExtensions.js.map +1 -0
  66. package/lib/launcher/internal/runtime/installRuntimeHooks.d.ts +5 -3
  67. package/lib/launcher/internal/runtime/installRuntimeHooks.js +7 -3
  68. package/lib/launcher/internal/runtime/installRuntimeHooks.js.map +1 -1
  69. package/lib/launcher/internal/watch/AsyncWatchTopology.d.ts +113 -0
  70. package/lib/launcher/internal/watch/AsyncWatchTopology.js +232 -0
  71. package/lib/launcher/internal/watch/AsyncWatchTopology.js.map +1 -0
  72. package/lib/launcher/internal/watch/WatchSettlement.d.ts +49 -0
  73. package/lib/launcher/internal/watch/WatchSettlement.js +70 -0
  74. package/lib/launcher/internal/watch/WatchSettlement.js.map +1 -0
  75. package/lib/launcher/internal/watch/WatchTopology.d.ts +29 -1
  76. package/lib/launcher/internal/watch/WatchTopology.js +86 -10
  77. package/lib/launcher/internal/watch/WatchTopology.js.map +1 -1
  78. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.d.ts +121 -0
  79. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.js +3 -0
  80. package/lib/launcher/internal/watch/WatchTopologyWorkerProtocol.js.map +1 -0
  81. package/lib/launcher/internal/watch/serveWatchTopologyWorker.d.ts +19 -0
  82. package/lib/launcher/internal/watch/serveWatchTopologyWorker.js +62 -0
  83. package/lib/launcher/internal/watch/serveWatchTopologyWorker.js.map +1 -0
  84. package/lib/launcher/internal/watch/watchTopologyWorker.d.ts +1 -0
  85. package/lib/launcher/internal/watch/watchTopologyWorker.js +22 -0
  86. package/lib/launcher/internal/watch/watchTopologyWorker.js.map +1 -0
  87. package/lib/plugin/CapabilityPluginResolver.d.ts +1 -1
  88. package/lib/plugin/CapabilityPluginResolver.js +3 -2
  89. package/lib/plugin/CapabilityPluginResolver.js.map +1 -1
  90. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.d.ts +15 -12
  91. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js +13 -11
  92. package/lib/plugin/internal/load/PluginDescriptorEvaluationCache.js.map +1 -1
  93. package/lib/plugin/internal/load/PluginPackageResolution.d.ts +2 -2
  94. package/lib/plugin/internal/load/PluginPackageResolution.js +13 -7
  95. package/lib/plugin/internal/load/PluginPackageResolution.js.map +1 -1
  96. package/lib/plugin/internal/load/ProjectPluginEntries.d.ts +23 -7
  97. package/lib/plugin/internal/load/ProjectPluginEntries.js +36 -14
  98. package/lib/plugin/internal/load/ProjectPluginEntries.js.map +1 -1
  99. package/lib/plugin/internal/load/collectProjectHostInputs.d.ts +3 -1
  100. package/lib/plugin/internal/load/collectProjectHostInputs.js +5 -2
  101. package/lib/plugin/internal/load/collectProjectHostInputs.js.map +1 -1
  102. package/lib/plugin/internal/load/hasProjectPluginEntries.d.ts +3 -1
  103. package/lib/plugin/internal/load/hasProjectPluginEntries.js +4 -2
  104. package/lib/plugin/internal/load/hasProjectPluginEntries.js.map +1 -1
  105. package/lib/plugin/internal/load/loadProjectPlugins.d.ts +36 -5
  106. package/lib/plugin/internal/load/loadProjectPlugins.js +466 -416
  107. package/lib/plugin/internal/load/loadProjectPlugins.js.map +1 -1
  108. package/lib/plugin/internal/load/pluginResolutionFailure.d.ts +18 -0
  109. package/lib/plugin/internal/load/pluginResolutionFailure.js +32 -0
  110. package/lib/plugin/internal/load/pluginResolutionFailure.js.map +1 -0
  111. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.d.ts +1 -1
  112. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js +3 -2
  113. package/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js.map +1 -1
  114. package/lib/structures/ITtscCompilerContext.d.ts +12 -12
  115. package/lib/structures/ITtscPlugin.d.ts +7 -5
  116. package/lib/structures/ITtscPluginFactoryContext.d.ts +9 -8
  117. package/lib/structures/internal/TtscSingleFileEmitOptions.d.ts +12 -6
  118. package/package.json +9 -9
  119. package/src/TtscCompiler.ts +1 -1
  120. package/src/compiler/internal/ResidentCheckProcess.ts +159 -374
  121. package/src/compiler/internal/ResidentCheckProcessHost.ts +502 -0
  122. package/src/compiler/internal/ResidentCheckProcessProtocol.ts +53 -0
  123. package/src/compiler/internal/build/BuildExecution.ts +118 -9
  124. package/src/compiler/internal/build/ResidentCheckWatchSession.ts +41 -24
  125. package/src/compiler/internal/build/RunBuildOptions.ts +9 -5
  126. package/src/compiler/internal/build/WatchInputPublication.ts +106 -0
  127. package/src/compiler/internal/build/runBuild.ts +58 -34
  128. package/src/compiler/internal/buildNativeCompiler.ts +4 -0
  129. package/src/compiler/internal/compileProjectInMemory.ts +8 -2
  130. package/src/compiler/internal/project/resolveOwningProjectConfig.ts +16 -5
  131. package/src/compiler/internal/readEffectiveCompilerOptions.ts +1 -1
  132. package/src/compiler/internal/resolveBinary.ts +4 -1
  133. package/src/compiler/internal/resolveTsgo.ts +7 -0
  134. package/src/compiler/internal/runSingleFileEmit.ts +139 -99
  135. package/src/compiler/internal/startResidentTransform.ts +9 -2
  136. package/src/compiler/internal/transformProjectInMemory.ts +12 -3
  137. package/src/compiler/internal/transformProjectInWorker.ts +10 -2
  138. package/src/internal/workerModuleUrl.ts +34 -0
  139. package/src/launcher/internal/buildSingleRootProject.ts +2 -0
  140. package/src/launcher/internal/getCompilerVersionText.ts +3 -2
  141. package/src/launcher/internal/prepareExecution.ts +2 -0
  142. package/src/launcher/internal/runTtsc.ts +123 -45
  143. package/src/launcher/internal/runtime/CommonJsRuntimeSource.ts +11 -9
  144. package/src/launcher/internal/runtime/advertiseTypeScriptExtensions.ts +25 -0
  145. package/src/launcher/internal/runtime/installRuntimeHooks.ts +7 -3
  146. package/src/launcher/internal/watch/AsyncWatchTopology.ts +267 -0
  147. package/src/launcher/internal/watch/WatchSettlement.ts +67 -0
  148. package/src/launcher/internal/watch/WatchTopology.ts +84 -13
  149. package/src/launcher/internal/watch/WatchTopologyWorkerProtocol.ts +106 -0
  150. package/src/launcher/internal/watch/serveWatchTopologyWorker.ts +75 -0
  151. package/src/launcher/internal/watch/watchTopologyWorker.ts +29 -0
  152. package/src/plugin/CapabilityPluginResolver.ts +9 -2
  153. package/src/plugin/internal/load/PluginDescriptorEvaluationCache.ts +17 -12
  154. package/src/plugin/internal/load/PluginPackageResolution.ts +14 -9
  155. package/src/plugin/internal/load/ProjectPluginEntries.ts +40 -15
  156. package/src/plugin/internal/load/collectProjectHostInputs.ts +7 -1
  157. package/src/plugin/internal/load/hasProjectPluginEntries.ts +8 -3
  158. package/src/plugin/internal/load/loadProjectPlugins.ts +672 -594
  159. package/src/plugin/internal/load/pluginResolutionFailure.ts +37 -0
  160. package/src/plugin/internal/source/PluginBuildEnvironmentReadings.ts +8 -2
  161. package/src/structures/ITtscCompilerContext.ts +12 -12
  162. package/src/structures/ITtscPlugin.ts +7 -5
  163. package/src/structures/ITtscPluginFactoryContext.ts +9 -8
  164. package/src/structures/internal/TtscSingleFileEmitOptions.ts +22 -11
@@ -1,156 +1,118 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.ResidentCheckProcess = void 0;
4
- const node_child_process_1 = require("node:child_process");
5
- const node_readline_1 = require("node:readline");
6
- const E2ETrace_1 = require("../../internal/E2ETrace");
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const node_worker_threads_1 = require("node:worker_threads");
9
+ const workerModuleUrl_1 = require("../../internal/workerModuleUrl");
7
10
  /**
8
- * FIFO JSON-line client for a check-stage `check-serve` sidecar.
11
+ * FIFO check client whose worker owns the child and its complete pipe lifetime.
9
12
  *
10
- * A watch session serializes cycles, but the client still queues replies so a
11
- * caller cannot accidentally pair a late response with the next request. Any
12
- * framing failure retires the process; the launcher can fall back to an
13
- * ordinary one-shot command after joining the original child. An unjoined child
14
- * cannot authorize that replacement.
13
+ * Watch topology can block the launcher's loop after shutdown timers start.
14
+ * Keeping spawn, EOF, signals, output draining and close on one independent
15
+ * loop prevents that work from spending a live child's shutdown grace or
16
+ * overtaking its pending close. An exit code alone never proves pipe closure: a
17
+ * living descendant can retain inherited stdout or stderr (#1758).
15
18
  *
16
- * The caller owns disposal. Requests have no deadline, and outstanding request
17
- * count and reply-line size are not capped; a slow live check remains pending.
18
- * Retirement ends stdin and waits for actual close. A one-second grace period
19
- * starts after stdin finishes, followed by forced termination and a one-second
20
- * join deadline. Pending stdin writes have a one-second flush deadline once the
21
- * retiring call stack yields. An unjoined deadline releases this client's
22
- * pipes, request listeners, timers and event-loop process reference while
23
- * keeping joining failed; the client object still holds its ChildProcess. It
24
- * neither kills unrelated descendants nor certifies their termination. A forced
25
- * or unjoined process is not a graceful shutdown. These delays are event-loop
26
- * timer policies, not hard elapsed-time bounds; synchronous blocking or
27
- * callback starvation can postpone their delivery.
19
+ * The caller owns disposal. Retirement uses the host's one-second input flush,
20
+ * EOF grace and forced-join policies. Only its actual-close receipt authorizes
21
+ * replacement; worker failure leaves joining unknown and rejected. Strict close
22
+ * additionally requires a graceful zero exit. Neither worker nor client claims
23
+ * termination of unrelated descendants. Abrupt process exit can still interrupt
24
+ * cleanup.
28
25
  *
29
- * @evidence contracts/common.md#principled-implementation One positional reply consumes one queued cycle; invalid framing or shape retires the stream so a delayed reply cannot answer a different cycle.
30
- * @evidence contracts/common.md#clear-and-simple-design One client owns its child, line reader, FIFO and failure state; private parsing and settlement keep transport policy separate from the watch coordinator's fallback.
31
- * @evidence contracts/common.md#prohibited-implementation-shortcuts Protocol validation uses the declared reply fields, and transport failure is rejection rather than a fabricated successful check or a consumer-specific recovery.
32
- * @evidence contracts/common.md#meaningful-documentation Native paragraphs explain FIFO ownership, retirement, caller disposal and the absence of request bounds, following the documentation skill.
33
- * @evidence contracts/portability.md#os-neutral-implementation Node spawns the supplied native executable with an argv array and pipe streams, without shell quoting; cwd and environment retain caller-provided native semantics.
34
- * @evidence contracts/performance.md#efficient-algorithms A head cursor consumes replies with amortized constant queue work and failure drains outstanding requests once. Encoding/decoding visit data and text bytes; caller-defined serialization can add arbitrary work. Stderr decoding and concatenation scan the new chunk plus retained tail before truncation. Native spawn, check execution and shutdown completion remain delegated and event-loop scheduled.
35
- * @evidence contracts/performance.md#reuse-equivalent-work One startup-selected child is shared across FIFO cycles, but its native session can update or reconstruct Program generations. Changed/external paths travel with each request and the watch owner replaces the process on configuration/plugin identity changes; the client does not reuse a response or certify every custom host's internal Program cache.
36
- * @evidence contracts/performance.md#bound-retention-and-release-resources Each settled slot releases its request; retirement clears the queue and drains replies until actual close or the failed join deadline. That deadline releases owned transport handles and callbacks without claiming the physical child or unrelated descendants joined; live request count and line bytes have no fixed cap.
26
+ * One worker serves one child across requests. Messages copy serialized request
27
+ * and reply bytes; pending request count and reply size have no fixed cap.
28
+ * Retirement rejects pending callers immediately and joins its worker after the
29
+ * terminal receipt. The client retains the Worker object.
30
+ *
31
+ * @evidence contracts/common.md#principled-implementation The independent loop owns every observation needed for retirement, and only its actual child-close receipt permits replacement, keeping parent event-loop blocking outside shutdown timing.
32
+ * @evidence contracts/common.md#clear-and-simple-design The client owns caller serialization and settlement; its worker owns the native transport and shutdown state machine.
33
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No elapsed parent deadline, worker exit, signal attempt or exit code fabricates a joined child; unknown worker failure rejects joining.
34
+ * @evidence contracts/common.md#meaningful-documentation Native prose documents the blocking hazard, inherited-pipe authority, disposal, failure effects and unbounded request population.
35
+ * @evidence contracts/portability.md#os-neutral-implementation Node loads a sibling worker using the current source or emitted extension and inherited loader arguments; the host uses native executable argv and pipes without shell commands.
36
+ * @evidence contracts/performance.md#efficient-algorithms Serialization and structured cloning visit message bytes; a request-id map gives constant-time settlement without scanning earlier requests. Worker startup and one thread per active child are additional costs; no speedup is claimed.
37
+ * @evidence contracts/performance.md#reuse-equivalent-work One worker and child serve the startup-selected check process across FIFO requests; each request remains effectful and receives its own result.
38
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The client owns one worker and one resolver pair per pending request. Results or retirement remove resolvers; joining waits for the terminal receipt and worker exit. Unexpected worker failure rejects callers and joining and removes worker liveness. Request count and bytes are uncapped, and the client object retains its Worker reference.
37
39
  */
38
40
  class ResidentCheckProcess {
39
- child;
40
- pending = [];
41
- pendingHead = 0;
42
- reader;
41
+ worker;
42
+ pending = new Map();
43
+ ordinal = 0;
43
44
  failure;
44
- stderr = "";
45
+ closeError;
46
+ joinError;
47
+ terminal = false;
45
48
  exited;
46
- closing = false;
47
- didClose = false;
48
- forced = false;
49
- flushDeadline;
50
- terminationTimer;
51
- terminationDeadline;
52
- releaseTransport;
49
+ resolveExit;
50
+ rejectExit;
53
51
  constructor(options) {
54
- const nativeArgs = [...options.args];
55
- const trace = E2ETrace_1.E2ETrace.begin(options.binary, nativeArgs, options, "resident-check");
56
- this.child = (0, node_child_process_1.spawn)(options.binary, nativeArgs, {
57
- cwd: options.cwd,
58
- env: options.env,
59
- windowsHide: true,
60
- });
61
- E2ETrace_1.E2ETrace.asynchronous(trace, this.child);
62
- let onChildClose;
63
52
  this.exited = new Promise((resolve, reject) => {
64
- onChildClose = () => {
65
- this.didClose = true;
66
- clearTimeout(this.flushDeadline);
67
- clearTimeout(this.terminationTimer);
68
- clearTimeout(this.terminationDeadline);
69
- this.releaseTransport = undefined;
70
- this.reader?.close();
71
- resolve();
72
- };
73
- this.child.once("close", onChildClose);
53
+ this.resolveExit = resolve;
74
54
  this.rejectExit = reject;
75
55
  });
76
- // Legacy dispose initiates retirement without returning a promise. Keep its
77
- // rejected join observable to awaiters without an unhandled rejection.
78
56
  void this.exited.catch(() => { });
79
- const stdin = this.child.stdin;
80
- const stdout = this.child.stdout;
81
- if (stdin === null || stdout === null) {
82
- this.child.kill();
83
- throw new Error("ttsc: resident check host has no stdio pipes");
84
- }
85
- this.reader = (0, node_readline_1.createInterface)({ input: stdout });
86
- const onLine = (line) => this.onLine(line);
87
- const onReaderClose = () => {
88
- if (this.failure === undefined)
89
- this.fail(this.exitError());
90
- };
91
- const onStderr = (chunk) => {
92
- const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
93
- this.stderr = (this.stderr + text).slice(-STDERR_TAIL_LIMIT);
94
- };
95
- const onError = (error) => this.fail(error);
96
- this.reader.on("line", onLine);
97
- this.reader.on("close", onReaderClose);
98
- this.child.stderr?.on("data", onStderr);
99
- this.child.on("error", onError);
100
- stdin.on("error", onError);
101
- stdout.on("error", onError);
102
- this.child.stderr?.on("error", ResidentCheckProcess.ignoreTransportError);
103
- this.releaseTransport = () => {
104
- clearTimeout(this.flushDeadline);
105
- clearTimeout(this.terminationTimer);
106
- clearTimeout(this.terminationDeadline);
107
- this.reader.off("line", onLine);
108
- this.reader.off("close", onReaderClose);
109
- this.reader.close();
110
- if (onChildClose !== undefined)
111
- this.child.off("close", onChildClose);
112
- this.child.off("error", onError);
113
- this.child.on("error", ResidentCheckProcess.ignoreTransportError);
114
- this.child.stderr?.off("data", onStderr);
115
- for (const stream of [stdin, stdout, this.child.stderr]) {
116
- stream?.off("error", onError);
117
- stream?.off("error", ResidentCheckProcess.ignoreTransportError);
118
- stream?.on("error", ResidentCheckProcess.ignoreTransportError);
119
- stream?.destroy();
57
+ this.worker = new node_worker_threads_1.Worker((0, workerModuleUrl_1.workerModuleUrl)(node_path_1.default.join(__dirname, `ResidentCheckProcessHost${node_path_1.default.extname(__filename)}`)), {
58
+ workerData: {
59
+ ...options,
60
+ args: [...options.args],
61
+ env: { ...options.env },
62
+ },
63
+ });
64
+ this.worker.on("message", (reply) => {
65
+ if (this.terminal)
66
+ return;
67
+ if (reply.kind === "terminal") {
68
+ this.terminal = true;
69
+ this.joinError = reply.joinError;
70
+ this.closeError = reply.closeError;
71
+ this.fail(reply.joinError ??
72
+ reply.closeError ??
73
+ new Error("ttsc: resident check host exited"));
120
74
  }
121
- this.child.unref();
122
- };
75
+ else {
76
+ const pending = this.pending.get(reply.id);
77
+ if (pending === undefined)
78
+ return;
79
+ this.pending.delete(reply.id);
80
+ if (reply.kind === "result")
81
+ pending.resolve(reply.result);
82
+ else {
83
+ pending.reject(reply.error);
84
+ this.fail(reply.error);
85
+ }
86
+ }
87
+ });
88
+ this.worker.on("error", (error) => this.workerFailed(asError(error)));
89
+ this.worker.once("exit", (code) => {
90
+ if (!this.terminal)
91
+ this.workerFailed(new Error(`ttsc: resident check process owner exited before child retirement (code ${code})`));
92
+ else if (this.joinError === undefined)
93
+ this.resolveExit();
94
+ else
95
+ this.rejectExit(this.joinError);
96
+ });
123
97
  }
124
98
  /**
125
- * Send one watch cycle and wait for its reply.
126
- *
127
- * Replies are paired with requests in FIFO order. A request made after the
128
- * process failed, or whose line cannot be written, rejects with the failure
129
- * that retired the process, so the caller can fall back to a one-shot check
130
- * for that cycle.
99
+ * Serialize one cycle before admission and pair its reply with this caller.
100
+ * Serialization failure rejects only this call when its thrown value can be
101
+ * normalized to an Error; normalization itself can throw synchronously. A
102
+ * retired transport rejects all admitted calls and every later request.
131
103
  *
132
- * Serialization precedes enqueueing and normally rejects only this call;
133
- * exceptional thrown-value conversion can itself fail during normalization. A
134
- * closed input retires the host and rejects its other pending calls.
135
- *
136
- * @evidence contracts/common.md#principled-implementation Serialization precedes enqueueing, and each successfully enqueued call keeps its own FIFO slot until a validated reply or shared retirement settles it.
137
- * @evidence contracts/common.md#clear-and-simple-design Pre-write validation remains local; write failures use the same settlement and retirement operations as pipe and protocol failure.
138
- * @evidence contracts/common.md#prohibited-implementation-shortcuts Failed serialization cannot consume a reply slot, and a closed pipe is not treated as a healthy host with one exceptional caller.
139
- * @evidence contracts/common.md#meaningful-documentation Separate paragraphs document reply ordering, rejection scope and closed-input effects, applying the documentation skill.
140
- * @evidence contracts/portability.md#os-neutral-implementation JSON lines pass native change paths as data over Node's stdin stream, without constructing a shell command or converting native separators.
141
- * @evidence contracts/performance.md#efficient-algorithms Encoding visits supplied properties and output bytes, with caller-defined conversion not bounded by final JSON size; enqueueing and settlement have amortized constant queue work plus reply parsing. Native check work is delegated rather than bounded by transport cost.
142
- * @evidence contracts/performance.md#reuse-equivalent-work Each cycle is sent to the existing fixed-configuration Program owner; changes are effectful transitions and are not coalesced merely because request values match.
143
- * @evidence contracts/performance.md#bound-retention-and-release-resources The client retains one resolver pair per outstanding call until reply or retirement; serialization allocates one request line, and live requests wait without an implicit timeout or population limit.
104
+ * @evidence contracts/common.md#principled-implementation Serialization precedes worker admission; identifiers pair results with their admitted callers while the host preserves FIFO check execution.
105
+ * @evidence contracts/common.md#clear-and-simple-design Caller serialization stays in the client, and the host alone validates native replies and retires a failed transport.
106
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts A failed conversion adds no request slot; worker failure rejects rather than fabricating a check result.
107
+ * @evidence contracts/common.md#meaningful-documentation Native prose distinguishes serialization rejection and synchronous normalization failure from terminal transport failure.
108
+ * @evidence contracts/portability.md#os-neutral-implementation Native input paths remain JSON data across the message and pipe boundaries without shell interpolation.
109
+ * @evidence contracts/performance.md#efficient-algorithms JSON conversion and message copying visit input bytes, caller-defined conversion can add arbitrary work, and map admission and settlement use constant-time key operations.
110
+ * @evidence contracts/performance.md#reuse-equivalent-work Each effectful cycle owns a request and reply even when its payload matches an earlier cycle.
111
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Each admitted call retains resolver callbacks until its result or shared retirement; request population and serialized bytes have no fixed cap.
144
112
  */
145
113
  request(payload) {
146
114
  if (this.failure !== undefined)
147
115
  return Promise.reject(this.failure);
148
- const stdin = this.child.stdin;
149
- if (stdin === null || stdin.destroyed) {
150
- const error = new Error("ttsc: resident check host stdin is closed");
151
- this.fail(error);
152
- return Promise.reject(error);
153
- }
154
116
  let line;
155
117
  try {
156
118
  line = `${JSON.stringify(payload)}\n`;
@@ -159,244 +121,97 @@ class ResidentCheckProcess {
159
121
  return Promise.reject(asError(error));
160
122
  }
161
123
  return new Promise((resolve, reject) => {
162
- const pending = { reject, resolve, settled: false };
163
- this.pending.push(pending);
124
+ const id = ++this.ordinal;
125
+ this.pending.set(id, { resolve, reject });
164
126
  try {
165
- stdin.write(line, (error) => {
166
- if (error === null || error === undefined || pending.settled)
167
- return;
168
- this.settle(pending, error);
169
- this.fail(error);
127
+ this.worker.postMessage({
128
+ kind: "request",
129
+ id,
130
+ line,
170
131
  });
171
132
  }
172
133
  catch (error) {
173
- const reason = asError(error);
174
- this.settle(pending, reason);
175
- this.fail(reason);
134
+ this.workerFailed(asError(error));
176
135
  }
177
136
  });
178
137
  }
179
138
  /**
180
- * Retire the sidecar: reject pending requests and close its request stream.
181
- * Idempotent; a process that already failed is left as is.
139
+ * Retire once and reject pending callers without waiting for native close.
182
140
  *
183
- * @evidence contracts/common.md#principled-implementation Setting failure before rejecting the detached FIFO makes disposal terminal; subsequent replies and requests cannot revive the child.
184
- * @evidence contracts/common.md#clear-and-simple-design Disposal enters the same retirement path as transport failure instead of maintaining a second cleanup sequence.
185
- * @evidence contracts/common.md#prohibited-implementation-shortcuts Cleanup ends the actual owned streams and attempts child termination; it does not disguise a pending request as a successful result.
186
- * @evidence contracts/common.md#meaningful-documentation The native comment states terminal rejection and repeated-call behavior, following the documentation skill's ownership guidance.
187
- * @evidence contracts/portability.md#os-neutral-implementation Owned stream EOF and forced signaling use Node's supported APIs without shell or POSIX process-tree commands.
188
- * @evidence contracts/performance.md#efficient-algorithms Retirement visits each outstanding request once and releases the queue in linear time rather than repeatedly shifting all remaining entries.
189
- *
190
- * @evidenceExclude contracts/performance.md#reuse-equivalent-work Disposal ends the owner and produces no computation that another request may reuse.
191
- *
192
- * @evidence contracts/performance.md#bound-retention-and-release-resources Disposal clears pending callbacks and requests stdin EOF while preserving output until actual close or a failed join timer. Failed join destroys/unrefs owned transport and removes request listeners without proving child/descendant termination; timer delivery depends on the event loop, and the client object can still retain its ChildProcess.
141
+ * @evidence contracts/common.md#principled-implementation Terminal caller failure is set before rejection, and one retire command delegates EOF and joining to the owner.
142
+ * @evidence contracts/common.md#clear-and-simple-design Disposal initiates the host's existing retirement state machine rather than maintaining parent-side timers.
143
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Repeated disposal cannot revive a request or authorize replacement before actual joining.
144
+ * @evidence contracts/common.md#meaningful-documentation Native prose identifies immediate rejection and asynchronous native retirement.
145
+ * @evidence contracts/portability.md#os-neutral-implementation A Node message delegates native EOF and signaling without platform-specific PID commands.
146
+ * @evidence contracts/performance.md#efficient-algorithms Rejection visits the outstanding request map once and posts one constant-size retirement command.
147
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Disposal invalidates an owner without creating a reusable computation.
148
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Pending callbacks are released immediately; the referenced worker keeps cleanup alive until its terminal receipt and exit, and unknown ownership remains failure.
193
149
  */
194
150
  dispose() {
151
+ if (this.failure !== undefined)
152
+ return;
195
153
  this.fail(new Error("ttsc: resident check host disposed"));
154
+ try {
155
+ this.worker.postMessage({
156
+ kind: "retire",
157
+ });
158
+ }
159
+ catch (error) {
160
+ this.workerFailed(asError(error));
161
+ }
196
162
  }
197
163
  /**
198
- * End the request stream and await the owned child's actual close event. A
199
- * forced, signalled or nonzero exit rejects; repeated calls share
200
- * retirement.
164
+ * Await actual child close and the owner thread, requiring graceful zero
165
+ * exit. Repeated calls share retirement but retain strict shutdown failure.
201
166
  *
202
- * @evidence contracts/common.md#principled-implementation EOF is sent on the owned input and success requires the child's actual close with status zero, never merely a successful kill request.
203
- * @evidence contracts/common.md#clear-and-simple-design Retirement and join are shared with dispose; this awaitable boundary adds exit validation for callers that must release process ownership.
204
- * @evidence contracts/common.md#prohibited-implementation-shortcuts Forced and unknown termination remain failures rather than fabricated graceful completion.
205
- * @evidence contracts/common.md#meaningful-documentation Native prose states the child-close authority, success condition and repeated-call behavior.
206
- * @evidence contracts/portability.md#os-neutral-implementation Native stdin EOF and child close events work through Node's process API; forced signalling is a failure rather than a portable graceful-stop assumption.
207
- * @evidence contracts/performance.md#efficient-algorithms Closing performs one retirement traversal and constant-time exit validation; no polling population grows over the lifetime.
208
- * @evidence contracts/performance.md#reuse-equivalent-work Repeated closes reuse the single actual-exit promise but never reuse an earlier process's exit as proof for another child.
209
- * @evidence contracts/performance.md#bound-retention-and-release-resources Actual close clears termination timers. A failed event-loop-scheduled join deadline destroys/unrefs transport and removes request listeners while retaining terminal failure; unref releases event-loop liveness, not the client object's ChildProcess reference or proof of physical child/descendant termination.
167
+ * @evidence contracts/common.md#principled-implementation Success requires the host's actual-close receipt, strict status validation and owner-thread exit.
168
+ * @evidence contracts/common.md#clear-and-simple-design Strict shutdown adds status validation to the same joining promise used by recovery.
169
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Neither worker disappearance nor requested forced termination substitutes for graceful child close.
170
+ * @evidence contracts/common.md#meaningful-documentation Native prose states child and thread joining, strict zero exit and repeated failure behavior.
171
+ * @evidence contracts/portability.md#os-neutral-implementation Node worker messages carry the native host's observed close outcome without interpreting a PID or shell status.
172
+ * @evidence contracts/performance.md#efficient-algorithms Closing reuses retirement and performs constant-time outcome validation after its one pending-request traversal.
173
+ * @evidence contracts/performance.md#reuse-equivalent-work Repeated closes await this owner's single terminal promise while retaining strict status independently from recovery joining.
174
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The host releases its pipes and timers on actual close or failed joining; the client awaits worker exit, releases pending callbacks, and preserves unknown ownership as rejection.
210
175
  */
211
176
  async close() {
212
177
  this.dispose();
213
178
  await this.exited;
214
- if (this.forced)
215
- throw new Error("ttsc: resident check host required forced termination");
216
- if (this.child.exitCode !== 0 || this.child.signalCode !== null)
217
- throw this.exitError();
179
+ if (this.closeError !== undefined)
180
+ throw this.closeError;
218
181
  }
219
182
  /**
220
- * Await actual retirement before a transport-failure fallback starts. A known
221
- * failed child may be replaced; an unjoined child may not.
183
+ * Join a known failed child and its owner before replacement. Waiting alone
184
+ * starts no retirement deadline; unknown ownership rejects.
222
185
  *
223
- * @evidence contracts/common.md#principled-implementation A replacement can start only after the original child's close event releases its native ownership.
224
- * @evidence contracts/common.md#clear-and-simple-design The transport owner exposes joining separately from graceful status validation for the supported recovery policy.
225
- * @evidence contracts/common.md#prohibited-implementation-shortcuts An elapsed deadline rejects instead of treating a still-live process as retired.
226
- * @evidence contracts/common.md#meaningful-documentation Native prose distinguishes recovery's known failed exit from shutdown's graceful success requirement.
227
- * @evidence contracts/portability.md#os-neutral-implementation The actual close event, rather than a signal result or native PID spelling, establishes retirement on each platform.
228
- * @evidence contracts/performance.md#efficient-algorithms This accessor returns the existing promise without adding a child listener or polling filesystem/process state; subscriber work belongs to the caller.
229
- * @evidence contracts/performance.md#reuse-equivalent-work Every waiter shares this child's terminal event; a replacement always owns a new promise.
230
- * @evidence contracts/performance.md#bound-retention-and-release-resources Waiters share actual close or, after retirement begins, its event-loop-scheduled failed join deadline. Waiting alone starts no termination timer; a live unretired child can remain pending without a deadline, and an unjoined owner remains failure.
186
+ * @evidence contracts/common.md#principled-implementation A known failed child can be replaced only after its actual-close receipt and worker exit.
187
+ * @evidence contracts/common.md#clear-and-simple-design Recovery consumes joining separately from strict shutdown status.
188
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Unknown worker or pipe ownership remains rejection rather than successful retirement.
189
+ * @evidence contracts/common.md#meaningful-documentation Native prose states replacement authority, passive waiting and unknown failure.
190
+ * @evidence contracts/portability.md#os-neutral-implementation The owner observes native close through Node APIs instead of treating signals or process IDs as portable joining proof.
191
+ * @evidence contracts/performance.md#efficient-algorithms The accessor returns an existing promise without timers, native probes or additional listeners.
192
+ * @evidence contracts/performance.md#reuse-equivalent-work All waiters share the same owner's terminal promise; replacement owns a new worker and promise.
193
+ * @evidence contracts/performance.md#bound-retention-and-release-resources Passive waiting can remain pending for a live unretired host; active retirement releases owned resources through its existing deadlines and terminal worker exit.
231
194
  */
232
195
  waitForExit() {
233
196
  return this.exited;
234
197
  }
235
- rejectExit;
236
- onLine(line) {
237
- if (this.failure !== undefined || line.trim().length === 0)
238
- return;
239
- const pending = this.pending[this.pendingHead];
240
- if (pending === undefined) {
241
- this.fail(new Error("ttsc: resident check host sent an unsolicited reply"));
242
- return;
243
- }
244
- const result = parseResidentCheckResult(line);
245
- if (result === undefined) {
246
- const error = new Error(`ttsc: resident check host sent a malformed reply: ${echoLine(line)}`);
247
- this.settle(pending, error);
248
- this.fail(error);
249
- return;
250
- }
251
- this.settle(pending, result);
252
- }
253
- settle(pending, result) {
254
- if (pending.settled)
255
- return;
256
- pending.settled = true;
257
- if (this.pending[this.pendingHead] === pending) {
258
- this.pending[this.pendingHead++] = undefined;
259
- if (this.pendingHead * 2 >= this.pending.length) {
260
- this.pending.splice(0, this.pendingHead);
261
- this.pendingHead = 0;
262
- }
263
- }
264
- if (result instanceof Error)
265
- pending.reject(result);
266
- else
267
- pending.resolve(result);
268
- }
269
198
  fail(error) {
270
- if (this.failure !== undefined)
271
- return;
272
- this.failure = error;
273
- const pending = this.pending.splice(0);
274
- this.pendingHead = 0;
275
- for (const request of pending) {
276
- if (request !== undefined)
277
- this.settle(request, error);
278
- }
279
- this.terminate();
280
- }
281
- terminate() {
282
- if (this.closing)
283
- return;
284
- this.closing = true;
285
- const stdin = this.child.stdin;
286
- if (stdin !== null && !stdin.destroyed) {
287
- try {
288
- // EOF cannot reach the child until the owned writable pipe finishes.
289
- // A blocked parent event loop must not spend the child's shutdown grace
290
- // before that delivery can happen.
291
- stdin.end(() => this.startTerminationGrace());
292
- // Start delivery's own deadline after the caller gives Node control.
293
- // This bounds an unread full pipe without charging synchronous caller
294
- // work against either delivery or the child's later EOF grace.
295
- queueMicrotask(() => {
296
- if (this.didClose || this.terminationTimer !== undefined)
297
- return;
298
- this.flushDeadline = setTimeout(() => this.forceTerminationAndJoin(), TERMINATION_GRACE_MS);
299
- });
300
- return;
301
- }
302
- catch {
303
- stdin.destroy();
304
- }
305
- }
306
- this.startTerminationGrace();
307
- }
308
- startTerminationGrace() {
309
- clearTimeout(this.flushDeadline);
310
- // Keep output pipes readable until close: destroying them would discard the
311
- // last reply and confuse a requested EOF with transport truncation.
312
- if (this.didClose ||
313
- this.terminationTimer !== undefined ||
314
- this.terminationDeadline !== undefined)
315
- return;
316
- this.terminationTimer = setTimeout(() => this.forceTerminationAndJoin(), TERMINATION_GRACE_MS);
199
+ this.failure ??= error;
200
+ for (const pending of this.pending.values())
201
+ pending.reject(this.failure);
202
+ this.pending.clear();
317
203
  }
318
- forceTerminationAndJoin() {
319
- if (this.didClose || this.terminationDeadline !== undefined)
204
+ workerFailed(error) {
205
+ if (this.terminal)
320
206
  return;
321
- if (this.child.exitCode === null && this.child.signalCode === null) {
322
- this.forced = true;
323
- try {
324
- this.child.kill("SIGKILL");
325
- }
326
- catch {
327
- // The deadline still requires actual close, even if kill fails.
328
- }
329
- }
330
- this.terminationDeadline = setTimeout(() => {
331
- this.rejectExit?.(new Error("ttsc: resident check host did not close after termination"));
332
- // Reject first: destroying inherited pipes can cause Node's close event,
333
- // but releasing our handles cannot prove a graceful physical join.
334
- this.releaseTransport?.();
335
- this.releaseTransport = undefined;
336
- }, TERMINATION_GRACE_MS);
337
- }
338
- static ignoreTransportError() { }
339
- exitError() {
340
- const detail = this.stderr.trim();
341
- if (detail.length !== 0)
342
- return new Error(detail);
343
- const signal = this.child.signalCode === null ? "" : `, signal ${this.child.signalCode}`;
344
- return new Error(`ttsc: resident check host exited (code ${this.child.exitCode ?? "null"}${signal})`);
207
+ this.terminal = true;
208
+ this.joinError = error;
209
+ this.fail(error);
210
+ this.rejectExit(error);
211
+ this.worker.unref();
345
212
  }
346
213
  }
347
214
  exports.ResidentCheckProcess = ResidentCheckProcess;
348
- const STDERR_TAIL_LIMIT = 64 * 1024;
349
- const REPLY_ECHO_LIMIT = 200;
350
- const TERMINATION_GRACE_MS = 1_000;
351
- function parseResidentCheckResult(line) {
352
- let value;
353
- try {
354
- value = JSON.parse(line);
355
- }
356
- catch {
357
- return undefined;
358
- }
359
- if (!isRecord(value) ||
360
- typeof value.status !== "number" ||
361
- !Number.isInteger(value.status)) {
362
- return undefined;
363
- }
364
- if (typeof value.stdout !== "string" || typeof value.stderr !== "string") {
365
- return undefined;
366
- }
367
- const telemetry = value.telemetry;
368
- if (!isRecord(telemetry) ||
369
- typeof telemetry.pid !== "number" ||
370
- !Number.isSafeInteger(telemetry.pid) ||
371
- typeof telemetry.programLoads !== "number" ||
372
- !Number.isSafeInteger(telemetry.programLoads) ||
373
- typeof telemetry.programUpdates !== "number" ||
374
- !Number.isSafeInteger(telemetry.programUpdates) ||
375
- typeof telemetry.reused !== "boolean") {
376
- return undefined;
377
- }
378
- return {
379
- diagnostics: [],
380
- status: value.status,
381
- stderr: value.stderr,
382
- stdout: value.stdout,
383
- telemetry: {
384
- pid: telemetry.pid,
385
- programLoads: telemetry.programLoads,
386
- programUpdates: telemetry.programUpdates,
387
- reused: telemetry.reused,
388
- },
389
- };
390
- }
391
- function isRecord(value) {
392
- return typeof value === "object" && value !== null && !Array.isArray(value);
393
- }
394
- function echoLine(line) {
395
- const trimmed = line.trim();
396
- return JSON.stringify(trimmed.length <= REPLY_ECHO_LIMIT
397
- ? trimmed
398
- : `${trimmed.slice(0, REPLY_ECHO_LIMIT)}…`);
399
- }
400
215
  function asError(error) {
401
216
  return error instanceof Error ? error : new Error(String(error));
402
217
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ResidentCheckProcess.js","sourceRoot":"","sources":["../../../src/compiler/internal/ResidentCheckProcess.ts"],"names":[],"mappings":";;;AAAA,2DAA8D;AAC9D,iDAAgE;AAEhE,sDAAmD;AAKnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;IACmB,KAAK,CAAe;IACpB,OAAO,GAAmC,EAAE,CAAC;IACtD,WAAW,GAAG,CAAC,CAAC;IACP,MAAM,C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