@ttsc/graph 0.19.2 → 0.20.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 (92) hide show
  1. package/lib/TtscGraphApplication.js +5 -1
  2. package/lib/TtscGraphApplication.js.map +1 -1
  3. package/lib/bin.js +15 -3
  4. package/lib/bin.js.map +1 -1
  5. package/lib/index.d.ts +13 -2
  6. package/lib/index.js +25 -30
  7. package/lib/index.js.map +1 -1
  8. package/lib/launcherArgs.d.ts +24 -0
  9. package/lib/launcherArgs.js +136 -0
  10. package/lib/launcherArgs.js.map +1 -0
  11. package/lib/model/TtscGraphMemory.d.ts +9 -5
  12. package/lib/model/TtscGraphMemory.js +35 -58
  13. package/lib/model/TtscGraphMemory.js.map +1 -1
  14. package/lib/model/TtscGraphNodeId.d.ts +17 -0
  15. package/lib/model/TtscGraphNodeId.js +69 -0
  16. package/lib/model/TtscGraphNodeId.js.map +1 -0
  17. package/lib/model/TtscGraphSession.d.ts +23 -7
  18. package/lib/model/TtscGraphSession.js +423 -171
  19. package/lib/model/TtscGraphSession.js.map +1 -1
  20. package/lib/model/TtscGraphSourceReader.d.ts +27 -0
  21. package/lib/model/TtscGraphSourceReader.js +97 -0
  22. package/lib/model/TtscGraphSourceReader.js.map +1 -0
  23. package/lib/model/loadGraph.d.ts +14 -0
  24. package/lib/model/loadGraph.js +256 -143
  25. package/lib/model/loadGraph.js.map +1 -1
  26. package/lib/reduce.d.ts +4 -1
  27. package/lib/reduce.js +112 -29
  28. package/lib/reduce.js.map +1 -1
  29. package/lib/resolveGraphBinary.d.ts +9 -3
  30. package/lib/resolveGraphBinary.js +9 -3
  31. package/lib/resolveGraphBinary.js.map +1 -1
  32. package/lib/server/createServer.js +22 -11
  33. package/lib/server/createServer.js.map +1 -1
  34. package/lib/server/pathPolicy.d.ts +6 -0
  35. package/lib/server/pathPolicy.js +10 -1
  36. package/lib/server/pathPolicy.js.map +1 -1
  37. package/lib/server/resolveHandle.js +22 -18
  38. package/lib/server/resolveHandle.js.map +1 -1
  39. package/lib/server/resultAudit.d.ts +56 -14
  40. package/lib/server/resultAudit.js +90 -24
  41. package/lib/server/resultAudit.js.map +1 -1
  42. package/lib/server/resultNext.d.ts +5 -0
  43. package/lib/server/resultNext.js.map +1 -1
  44. package/lib/server/runDetails.d.ts +9 -2
  45. package/lib/server/runDetails.js +132 -157
  46. package/lib/server/runDetails.js.map +1 -1
  47. package/lib/server/runEntrypoints.js +1 -1
  48. package/lib/server/runEntrypoints.js.map +1 -1
  49. package/lib/server/runLookup.js +1 -1
  50. package/lib/server/runLookup.js.map +1 -1
  51. package/lib/server/runTour.js +113 -30
  52. package/lib/server/runTour.js.map +1 -1
  53. package/lib/server/runTrace.d.ts +22 -0
  54. package/lib/server/runTrace.js +293 -63
  55. package/lib/server/runTrace.js.map +1 -1
  56. package/lib/structures/ITtscGraphApplication.d.ts +8 -7
  57. package/lib/structures/ITtscGraphDetails.d.ts +18 -8
  58. package/lib/structures/ITtscGraphDump.d.ts +13 -13
  59. package/lib/structures/ITtscGraphNode.d.ts +71 -0
  60. package/lib/structures/ITtscGraphTour.d.ts +1 -1
  61. package/lib/structures/ITtscGraphTrace.d.ts +1 -1
  62. package/lib/view.js +18 -28
  63. package/lib/view.js.map +1 -1
  64. package/package.json +7 -4
  65. package/src/TtscGraphApplication.ts +8 -1
  66. package/src/bin.ts +13 -3
  67. package/src/index.ts +35 -27
  68. package/src/launcherArgs.ts +168 -0
  69. package/src/model/TtscGraphMemory.ts +34 -60
  70. package/src/model/TtscGraphNodeId.ts +77 -0
  71. package/src/model/TtscGraphSession.ts +253 -53
  72. package/src/model/TtscGraphSourceReader.ts +117 -0
  73. package/src/model/loadGraph.ts +6 -1
  74. package/src/reduce.ts +136 -31
  75. package/src/resolveGraphBinary.ts +9 -3
  76. package/src/server/createServer.ts +12 -2
  77. package/src/server/pathPolicy.ts +10 -1
  78. package/src/server/resolveHandle.ts +21 -22
  79. package/src/server/resultAudit.ts +93 -23
  80. package/src/server/resultNext.ts +6 -0
  81. package/src/server/runDetails.ts +134 -165
  82. package/src/server/runEntrypoints.ts +1 -1
  83. package/src/server/runLookup.ts +1 -1
  84. package/src/server/runTour.ts +133 -39
  85. package/src/server/runTrace.ts +401 -65
  86. package/src/structures/ITtscGraphApplication.ts +8 -7
  87. package/src/structures/ITtscGraphDetails.ts +18 -8
  88. package/src/structures/ITtscGraphDump.ts +13 -13
  89. package/src/structures/ITtscGraphNode.ts +80 -0
  90. package/src/structures/ITtscGraphTour.ts +1 -1
  91. package/src/structures/ITtscGraphTrace.ts +1 -1
  92. package/src/view.ts +25 -23
@@ -44,6 +44,7 @@ const typia_1 = __importDefault(require("typia"));
44
44
  const nativeExecutable_1 = require("../nativeExecutable");
45
45
  const resolveGraphBinary_1 = require("../resolveGraphBinary");
46
46
  const TtscGraphMemory_1 = require("./TtscGraphMemory");
47
+ const loadGraph_1 = require("./loadGraph");
47
48
  /**
48
49
  * The serve protocol version this client speaks.
49
50
  *
@@ -53,6 +54,9 @@ const TtscGraphMemory_1 = require("./TtscGraphMemory");
53
54
  * constant out of this file and fails if the pair drifts.
54
55
  */
55
56
  const PROTOCOL_VERSION = 1;
57
+ const DEFAULT_REQUEST_TIMEOUT_MS = 300000;
58
+ const MAX_TIMER_MS = 2147483647;
59
+ const TERMINATION_GRACE_MS = 1000;
56
60
  /**
57
61
  * Resident bridge to `ttscgraph serve`.
58
62
  *
@@ -65,14 +69,20 @@ class TtscGraphSession {
65
69
  cwd;
66
70
  tsconfig;
67
71
  binary;
72
+ requestTimeoutMs;
68
73
  child;
69
- stderr = "";
70
74
  nextId = 0;
71
75
  pending = new Map();
72
76
  queue = Promise.resolve();
73
77
  current;
74
78
  closed = false;
75
79
  constructor(options) {
80
+ const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
81
+ if (!Number.isSafeInteger(requestTimeoutMs) ||
82
+ requestTimeoutMs <= 0 ||
83
+ requestTimeoutMs > MAX_TIMER_MS) {
84
+ throw new TypeError(`@ttsc/graph: requestTimeoutMs must be an integer between 1 and ${String(MAX_TIMER_MS)}`);
85
+ }
76
86
  // Resolve the platform binary from the project this session serves, so the
77
87
  // MCP server started from an unrelated directory still finds the target's
78
88
  // installed `ttsc`.
@@ -86,20 +96,49 @@ class TtscGraphSession {
86
96
  this.cwd = options.cwd;
87
97
  this.tsconfig = options.tsconfig;
88
98
  this.binary = binary;
99
+ this.requestTimeoutMs = requestTimeoutMs;
89
100
  }
90
101
  /** Return a graph for the current disk snapshot, serialized per tool call. */
91
- graph() {
102
+ graph(options = {}) {
103
+ if (this.closed) {
104
+ return Promise.reject(new Error("@ttsc/graph: native session is closed"));
105
+ }
92
106
  let resolve;
93
107
  let reject;
108
+ let started = false;
109
+ let settled = false;
94
110
  const result = new Promise((res, rej) => {
95
- resolve = res;
96
- reject = rej;
111
+ resolve = (graph) => {
112
+ if (settled)
113
+ return;
114
+ settled = true;
115
+ res(graph);
116
+ };
117
+ reject = (error) => {
118
+ if (settled)
119
+ return;
120
+ settled = true;
121
+ rej(error);
122
+ };
97
123
  });
124
+ const cancelQueued = () => {
125
+ if (!started)
126
+ reject(cancelledError(options.signal));
127
+ };
128
+ if (options.signal?.aborted) {
129
+ reject(cancelledError(options.signal));
130
+ return result;
131
+ }
132
+ options.signal?.addEventListener("abort", cancelQueued, { once: true });
98
133
  this.queue = this.queue
99
134
  .catch(() => undefined)
100
135
  .then(async () => {
136
+ started = true;
137
+ options.signal?.removeEventListener("abort", cancelQueued);
138
+ if (settled)
139
+ return;
101
140
  try {
102
- resolve(await this.refresh());
141
+ resolve(await this.refresh(options.signal));
103
142
  }
104
143
  catch (error) {
105
144
  reject(asError(error));
@@ -109,17 +148,19 @@ class TtscGraphSession {
109
148
  }
110
149
  /** Close the native session. Safe to call more than once. */
111
150
  close() {
151
+ if (this.closed)
152
+ return;
112
153
  this.closed = true;
113
- const child = this.child;
114
- this.child = undefined;
115
- if (child !== undefined && !child.killed)
116
- child.stdin.end();
117
- this.failPending(new Error("@ttsc/graph: native session closed"));
154
+ const error = new Error("@ttsc/graph: native session closed");
155
+ if (this.child !== undefined)
156
+ this.failChild(this.child, error);
157
+ else
158
+ this.failPending(error);
118
159
  }
119
- async refresh() {
160
+ async refresh(signal) {
120
161
  // The protocol version and the envelope shape were both settled in onLine,
121
162
  // before this frame was ever routed here.
122
- const response = await this.request();
163
+ const response = await this.request(signal);
123
164
  if (response.error !== undefined) {
124
165
  throw new Error(`@ttsc/graph: ${response.error}`);
125
166
  }
@@ -134,16 +175,37 @@ class TtscGraphSession {
134
175
  }
135
176
  return this.current;
136
177
  }
137
- request() {
178
+ request(signal) {
179
+ if (signal?.aborted)
180
+ throw cancelledError(signal);
138
181
  const child = this.ensureChild();
139
182
  const id = ++this.nextId;
140
183
  return new Promise((resolve, reject) => {
141
- this.pending.set(id, { resolve, reject });
142
- child.stdin.write(`${JSON.stringify({ id })}\n`, (error) => {
184
+ const pending = {
185
+ child,
186
+ resolve,
187
+ reject,
188
+ timer: setTimeout(() => {
189
+ this.failChild(child, new Error(`@ttsc/graph: native snapshot request timed out after ${String(this.requestTimeoutMs)} ms${stderrSuffix(child)}`));
190
+ }, this.requestTimeoutMs),
191
+ signal,
192
+ };
193
+ pending.timer.unref();
194
+ if (signal !== undefined) {
195
+ pending.abort = () => this.failChild(child, cancelledError(signal, child));
196
+ signal.addEventListener("abort", pending.abort, { once: true });
197
+ }
198
+ this.pending.set(id, pending);
199
+ if (signal?.aborted) {
200
+ pending.abort();
201
+ return;
202
+ }
203
+ child.process.stdin.write(`${JSON.stringify({ id })}\n`, (error) => {
143
204
  if (error === null || error === undefined)
144
205
  return;
145
- this.pending.delete(id);
146
- reject(new Error(`@ttsc/graph: could not request native snapshot: ${error.message}`));
206
+ if (this.pending.get(id) !== pending)
207
+ return;
208
+ this.failChild(child, new Error(`@ttsc/graph: could not request native snapshot: ${error.message}`));
147
209
  });
148
210
  });
149
211
  }
@@ -153,34 +215,37 @@ class TtscGraphSession {
153
215
  // process; an orphaned resident compiler would outlive the MCP server.
154
216
  throw new Error("@ttsc/graph: native session is closed");
155
217
  }
156
- if (this.child !== undefined && this.child.exitCode === null) {
218
+ if (this.child !== undefined &&
219
+ this.child.process.exitCode === null &&
220
+ this.child.process.signalCode === null) {
157
221
  return this.child;
158
222
  }
159
- this.stderr = "";
160
- const child = (0, node_child_process_1.spawn)(this.binary, ["serve", "--cwd", this.cwd, "--tsconfig", this.tsconfig], { stdio: ["pipe", "pipe", "pipe"], windowsHide: true });
223
+ const process = (0, node_child_process_1.spawn)(this.binary, ["serve", "--cwd", this.cwd, "--tsconfig", this.tsconfig], { stdio: ["pipe", "pipe", "pipe"], windowsHide: true });
224
+ const lines = node_readline_1.default.createInterface({ input: process.stdout });
225
+ const child = { process, lines, stderr: "" };
161
226
  this.child = child;
162
- child.stderr.setEncoding("utf8");
163
- child.stderr.on("data", (chunk) => {
164
- this.stderr = (this.stderr + chunk).slice(-64 * 1024);
227
+ process.stderr.setEncoding("utf8");
228
+ process.stderr.on("data", (chunk) => {
229
+ child.stderr = (child.stderr + chunk).slice(-64 * 1024);
165
230
  });
166
- const lines = node_readline_1.default.createInterface({ input: child.stdout });
167
- lines.on("line", (line) => this.onLine(line));
168
- child.on("error", (error) => this.failChild(child, error));
169
- child.on("exit", (code, signal) => {
231
+ lines.on("line", (line) => this.onLine(child, line));
232
+ process.on("error", (error) => this.failChild(child, new Error(`@ttsc/graph: native session failed: ${error.message}`)));
233
+ process.on("exit", (code, signal) => {
170
234
  if (this.child !== child)
171
235
  return;
172
- this.child = undefined;
173
- this.failPending(new Error(`@ttsc/graph: native session exited (code=${String(code)}, signal=${String(signal)})${this.stderr.trim() === "" ? "" : `: ${this.stderr.trim()}`}`));
236
+ this.failChild(child, new Error(`@ttsc/graph: native session exited (code=${String(code)}, signal=${String(signal)})${stderrSuffix(child)}`), false);
174
237
  });
175
238
  return child;
176
239
  }
177
- onLine(line) {
240
+ onLine(child, line) {
241
+ if (this.child !== child)
242
+ return;
178
243
  let parsed;
179
244
  try {
180
245
  parsed = JSON.parse(line);
181
246
  }
182
247
  catch (error) {
183
- this.failPending(new Error(`@ttsc/graph: native session returned invalid JSON: ${asError(error).message}`));
248
+ this.failChild(child, new Error(`@ttsc/graph: native session returned invalid JSON: ${asError(error).message}`));
184
249
  return;
185
250
  }
186
251
  // Read the version before the shape, because a server speaking another
@@ -197,7 +262,7 @@ class TtscGraphSession {
197
262
  if (version !== PROTOCOL_VERSION) {
198
263
  // Session-wide: a version mismatch is not one bad frame, it is the wrong
199
264
  // binary, and every request against it is equally doomed.
200
- this.failPending(new Error(`@ttsc/graph: ttscgraph speaks serve protocol ${version === undefined ? "an unknown version" : `v${String(version)}`}, this client speaks v${String(PROTOCOL_VERSION)}. ` +
265
+ this.failChild(child, new Error(`@ttsc/graph: ttscgraph speaks serve protocol ${version === undefined ? "an unknown version" : `v${String(version)}`}, this client speaks v${String(PROTOCOL_VERSION)}. ` +
201
266
  "Install a matching `ttsc` (the binary resolves from the target " +
202
267
  "project, or from TTSC_GRAPH_BINARY)."));
203
268
  return;
@@ -212,19 +277,33 @@ class TtscGraphSession {
212
277
  response = (() => {
213
278
  const _ip0 = input => Array.isArray(input["capabilities"]) && input["capabilities"].every(elem => "string" === typeof elem);
214
279
  const _ip1 = input => "string" === typeof input["file"];
280
+ const _ip2 = input => "string" === typeof input["id"];
281
+ const _ip3 = input => true === _iv0.has(input["kind"]);
215
282
  const _iv0 = new Set(["class", "enum", "external_symbol", "file", "function", "interface", "method", "module", "namespace", "package", "parameter", "property", "type", "variable"]);
216
- const _ip2 = input => "string" === typeof input["name"];
283
+ const _ip4 = input => "string" === typeof input["name"];
284
+ const _ip5 = input => undefined === input["qualifiedName"] || "string" === typeof input["qualifiedName"];
285
+ const _ip6 = input => "boolean" === typeof input["external"];
286
+ const _ip7 = input => undefined === input["ignored"] || "boolean" === typeof input["ignored"];
287
+ const _ip8 = input => undefined === input["exported"] || "boolean" === typeof input["exported"];
288
+ const _ip9 = input => undefined === input["closure"] || "boolean" === typeof input["closure"];
289
+ const _ip10 = input => undefined === input["modifiers"] || Array.isArray(input["modifiers"]) && input["modifiers"].every(elem => true === _iv1.has(elem));
217
290
  const _iv1 = new Set(["abstract", "async", "const", "declare", "default", "export", "optional", "private", "protected", "public", "readonly", "static"]);
218
- const _ip3 = input => undefined === input["evidence"] || "object" === typeof input["evidence"] && null !== input["evidence"] && _io12(input["evidence"]);
291
+ const _ip11 = input => undefined === input["literals"] || Array.isArray(input["literals"]) && input["literals"].every(elem => "string" === typeof elem);
292
+ const _ip12 = input => undefined === input["enumMembers"] || Array.isArray(input["enumMembers"]) && input["enumMembers"].every(elem => "object" === typeof elem && null !== elem && _io10(elem));
293
+ const _ip13 = input => undefined === input["objectMembers"] || Array.isArray(input["objectMembers"]) && input["objectMembers"].every(elem => "object" === typeof elem && null !== elem && _io11(elem));
294
+ const _ip14 = input => undefined === input["decorators"] || Array.isArray(input["decorators"]) && input["decorators"].every(elem => "object" === typeof elem && null !== elem && _io12(elem));
295
+ const _ip15 = input => undefined === input["signature"] || "string" === typeof input["signature"];
296
+ const _ip16 = input => undefined === input["evidence"] || "object" === typeof input["evidence"] && null !== input["evidence"] && _io14(input["evidence"]);
297
+ const _ip17 = input => undefined === input["implementation"] || "object" === typeof input["implementation"] && null !== input["implementation"] && _io14(input["implementation"]);
219
298
  const _iv2 = new Set(["accesses", "calls", "contains", "decorates", "dispatches", "exports", "extends", "implements", "imports", "instantiates", "overrides", "renders", "tests", "type_ref"]);
220
299
  const _ap0 = (input, _path, _exceptionable = true) => (Array.isArray(input["capabilities"]) || _assertGuard_1._assertGuard(_exceptionable, {
221
300
  method: "typia.assert",
222
301
  path: _path + ".capabilities",
223
302
  expected: "Array<string>",
224
303
  value: input["capabilities"]
225
- }, _errorFactory)) && input["capabilities"].every((elem, _index11) => "string" === typeof elem || _assertGuard_1._assertGuard(_exceptionable, {
304
+ }, _errorFactory)) && input["capabilities"].every((elem, _index14) => "string" === typeof elem || _assertGuard_1._assertGuard(_exceptionable, {
226
305
  method: "typia.assert",
227
- path: _path + ".capabilities[" + _index11 + "]",
306
+ path: _path + ".capabilities[" + _index14 + "]",
228
307
  expected: "string",
229
308
  value: elem
230
309
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -239,27 +318,181 @@ class TtscGraphSession {
239
318
  expected: "string",
240
319
  value: input["file"]
241
320
  }, _errorFactory);
321
+ const _ap2 = (input, _path, _exceptionable = true) => "string" === typeof input["id"] || _assertGuard_1._assertGuard(_exceptionable, {
322
+ method: "typia.assert",
323
+ path: _path + ".id",
324
+ expected: "string",
325
+ value: input["id"]
326
+ }, _errorFactory);
327
+ const _ap3 = (input, _path, _exceptionable = true) => true === _av0.has(input["kind"]) || _assertGuard_1._assertGuard(_exceptionable, {
328
+ method: "typia.assert",
329
+ path: _path + ".kind",
330
+ expected: _ae0,
331
+ value: input["kind"]
332
+ }, _errorFactory);
242
333
  const _av0 = new Set(["class", "enum", "external_symbol", "file", "function", "interface", "method", "module", "namespace", "package", "parameter", "property", "type", "variable"]);
243
334
  const _ae0 = "(\"class\" | \"enum\" | \"external_symbol\" | \"file\" | \"function\" | \"interface\" | \"method\" | \"module\" | \"namespace\" | \"package\" | \"parameter\" | \"property\" | \"type\" | \"variable\")";
244
- const _ap2 = (input, _path, _exceptionable = true) => "string" === typeof input["name"] || _assertGuard_1._assertGuard(_exceptionable, {
335
+ const _ap4 = (input, _path, _exceptionable = true) => "string" === typeof input["name"] || _assertGuard_1._assertGuard(_exceptionable, {
245
336
  method: "typia.assert",
246
337
  path: _path + ".name",
247
338
  expected: "string",
248
339
  value: input["name"]
249
340
  }, _errorFactory);
341
+ const _ap5 = (input, _path, _exceptionable = true) => undefined === input["qualifiedName"] || "string" === typeof input["qualifiedName"] || _assertGuard_1._assertGuard(_exceptionable, {
342
+ method: "typia.assert",
343
+ path: _path + ".qualifiedName",
344
+ expected: "(string | undefined)",
345
+ value: input["qualifiedName"]
346
+ }, _errorFactory);
347
+ const _ap6 = (input, _path, _exceptionable = true) => "boolean" === typeof input["external"] || _assertGuard_1._assertGuard(_exceptionable, {
348
+ method: "typia.assert",
349
+ path: _path + ".external",
350
+ expected: "boolean",
351
+ value: input["external"]
352
+ }, _errorFactory);
353
+ const _ap7 = (input, _path, _exceptionable = true) => undefined === input["ignored"] || "boolean" === typeof input["ignored"] || _assertGuard_1._assertGuard(_exceptionable, {
354
+ method: "typia.assert",
355
+ path: _path + ".ignored",
356
+ expected: "(boolean | undefined)",
357
+ value: input["ignored"]
358
+ }, _errorFactory);
359
+ const _ap8 = (input, _path, _exceptionable = true) => undefined === input["exported"] || "boolean" === typeof input["exported"] || _assertGuard_1._assertGuard(_exceptionable, {
360
+ method: "typia.assert",
361
+ path: _path + ".exported",
362
+ expected: "(boolean | undefined)",
363
+ value: input["exported"]
364
+ }, _errorFactory);
365
+ const _ap9 = (input, _path, _exceptionable = true) => undefined === input["closure"] || "boolean" === typeof input["closure"] || _assertGuard_1._assertGuard(_exceptionable, {
366
+ method: "typia.assert",
367
+ path: _path + ".closure",
368
+ expected: "(boolean | undefined)",
369
+ value: input["closure"]
370
+ }, _errorFactory);
371
+ const _ap10 = (input, _path, _exceptionable = true) => undefined === input["modifiers"] || (Array.isArray(input["modifiers"]) || _assertGuard_1._assertGuard(_exceptionable, {
372
+ method: "typia.assert",
373
+ path: _path + ".modifiers",
374
+ expected: "(Array<TtscGraphNodeModifier> | undefined)",
375
+ value: input["modifiers"]
376
+ }, _errorFactory)) && input["modifiers"].every((elem, _index21) => true === _av1.has(elem) || _assertGuard_1._assertGuard(_exceptionable, {
377
+ method: "typia.assert",
378
+ path: _path + ".modifiers[" + _index21 + "]",
379
+ expected: _ae1,
380
+ value: elem
381
+ }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
382
+ method: "typia.assert",
383
+ path: _path + ".modifiers",
384
+ expected: "(Array<TtscGraphNodeModifier> | undefined)",
385
+ value: input["modifiers"]
386
+ }, _errorFactory);
250
387
  const _av1 = new Set(["abstract", "async", "const", "declare", "default", "export", "optional", "private", "protected", "public", "readonly", "static"]);
251
388
  const _ae1 = "(\"abstract\" | \"async\" | \"const\" | \"declare\" | \"default\" | \"export\" | \"optional\" | \"private\" | \"protected\" | \"public\" | \"readonly\" | \"static\")";
252
- const _ap3 = (input, _path, _exceptionable = true) => undefined === input["evidence"] || ("object" === typeof input["evidence"] && null !== input["evidence"] || _assertGuard_1._assertGuard(_exceptionable, {
389
+ const _ap11 = (input, _path, _exceptionable = true) => undefined === input["literals"] || (Array.isArray(input["literals"]) || _assertGuard_1._assertGuard(_exceptionable, {
390
+ method: "typia.assert",
391
+ path: _path + ".literals",
392
+ expected: "(Array<string> | undefined)",
393
+ value: input["literals"]
394
+ }, _errorFactory)) && input["literals"].every((elem, _index22) => "string" === typeof elem || _assertGuard_1._assertGuard(_exceptionable, {
395
+ method: "typia.assert",
396
+ path: _path + ".literals[" + _index22 + "]",
397
+ expected: "string",
398
+ value: elem
399
+ }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
400
+ method: "typia.assert",
401
+ path: _path + ".literals",
402
+ expected: "(Array<string> | undefined)",
403
+ value: input["literals"]
404
+ }, _errorFactory);
405
+ const _ap12 = (input, _path, _exceptionable = true) => undefined === input["enumMembers"] || (Array.isArray(input["enumMembers"]) || _assertGuard_1._assertGuard(_exceptionable, {
406
+ method: "typia.assert",
407
+ path: _path + ".enumMembers",
408
+ expected: "(Array<ITtscGraphNode.IEnumMember> | undefined)",
409
+ value: input["enumMembers"]
410
+ }, _errorFactory)) && input["enumMembers"].every((elem, _index23) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
411
+ method: "typia.assert",
412
+ path: _path + ".enumMembers[" + _index23 + "]",
413
+ expected: "ITtscGraphNode.IEnumMember",
414
+ value: elem
415
+ }, _errorFactory)) && _ao10(elem, _path + ".enumMembers[" + _index23 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
416
+ method: "typia.assert",
417
+ path: _path + ".enumMembers[" + _index23 + "]",
418
+ expected: "ITtscGraphNode.IEnumMember",
419
+ value: elem
420
+ }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
421
+ method: "typia.assert",
422
+ path: _path + ".enumMembers",
423
+ expected: "(Array<ITtscGraphNode.IEnumMember> | undefined)",
424
+ value: input["enumMembers"]
425
+ }, _errorFactory);
426
+ const _ap13 = (input, _path, _exceptionable = true) => undefined === input["objectMembers"] || (Array.isArray(input["objectMembers"]) || _assertGuard_1._assertGuard(_exceptionable, {
427
+ method: "typia.assert",
428
+ path: _path + ".objectMembers",
429
+ expected: "(Array<ITtscGraphNode.IObjectMember> | undefined)",
430
+ value: input["objectMembers"]
431
+ }, _errorFactory)) && input["objectMembers"].every((elem, _index24) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
432
+ method: "typia.assert",
433
+ path: _path + ".objectMembers[" + _index24 + "]",
434
+ expected: "ITtscGraphNode.IObjectMember",
435
+ value: elem
436
+ }, _errorFactory)) && _ao11(elem, _path + ".objectMembers[" + _index24 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
437
+ method: "typia.assert",
438
+ path: _path + ".objectMembers[" + _index24 + "]",
439
+ expected: "ITtscGraphNode.IObjectMember",
440
+ value: elem
441
+ }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
442
+ method: "typia.assert",
443
+ path: _path + ".objectMembers",
444
+ expected: "(Array<ITtscGraphNode.IObjectMember> | undefined)",
445
+ value: input["objectMembers"]
446
+ }, _errorFactory);
447
+ const _ap14 = (input, _path, _exceptionable = true) => undefined === input["decorators"] || (Array.isArray(input["decorators"]) || _assertGuard_1._assertGuard(_exceptionable, {
448
+ method: "typia.assert",
449
+ path: _path + ".decorators",
450
+ expected: "(Array<ITtscGraphDecorator> | undefined)",
451
+ value: input["decorators"]
452
+ }, _errorFactory)) && input["decorators"].every((elem, _index25) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
453
+ method: "typia.assert",
454
+ path: _path + ".decorators[" + _index25 + "]",
455
+ expected: "ITtscGraphDecorator",
456
+ value: elem
457
+ }, _errorFactory)) && _ao12(elem, _path + ".decorators[" + _index25 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
458
+ method: "typia.assert",
459
+ path: _path + ".decorators[" + _index25 + "]",
460
+ expected: "ITtscGraphDecorator",
461
+ value: elem
462
+ }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
463
+ method: "typia.assert",
464
+ path: _path + ".decorators",
465
+ expected: "(Array<ITtscGraphDecorator> | undefined)",
466
+ value: input["decorators"]
467
+ }, _errorFactory);
468
+ const _ap15 = (input, _path, _exceptionable = true) => undefined === input["signature"] || "string" === typeof input["signature"] || _assertGuard_1._assertGuard(_exceptionable, {
469
+ method: "typia.assert",
470
+ path: _path + ".signature",
471
+ expected: "(string | undefined)",
472
+ value: input["signature"]
473
+ }, _errorFactory);
474
+ const _ap16 = (input, _path, _exceptionable = true) => undefined === input["evidence"] || ("object" === typeof input["evidence"] && null !== input["evidence"] || _assertGuard_1._assertGuard(_exceptionable, {
253
475
  method: "typia.assert",
254
476
  path: _path + ".evidence",
255
477
  expected: "(ITtscGraphSpan | undefined)",
256
478
  value: input["evidence"]
257
- }, _errorFactory)) && _ao12(input["evidence"], _path + ".evidence", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
479
+ }, _errorFactory)) && _ao14(input["evidence"], _path + ".evidence", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
258
480
  method: "typia.assert",
259
481
  path: _path + ".evidence",
260
482
  expected: "(ITtscGraphSpan | undefined)",
261
483
  value: input["evidence"]
262
484
  }, _errorFactory);
485
+ const _ap17 = (input, _path, _exceptionable = true) => undefined === input["implementation"] || ("object" === typeof input["implementation"] && null !== input["implementation"] || _assertGuard_1._assertGuard(_exceptionable, {
486
+ method: "typia.assert",
487
+ path: _path + ".implementation",
488
+ expected: "(ITtscGraphSpan | undefined)",
489
+ value: input["implementation"]
490
+ }, _errorFactory)) && _ao14(input["implementation"], _path + ".implementation", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
491
+ method: "typia.assert",
492
+ path: _path + ".implementation",
493
+ expected: "(ITtscGraphSpan | undefined)",
494
+ value: input["implementation"]
495
+ }, _errorFactory);
263
496
  const _av2 = new Set(["accesses", "calls", "contains", "decorates", "dispatches", "exports", "extends", "implements", "imports", "instantiates", "overrides", "renders", "tests", "type_ref"]);
264
497
  const _ae2 = "(\"accesses\" | \"calls\" | \"contains\" | \"decorates\" | \"dispatches\" | \"exports\" | \"extends\" | \"implements\" | \"imports\" | \"instantiates\" | \"overrides\" | \"renders\" | \"tests\" | \"type_ref\")";
265
498
  const _ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.id || _assertGuard_1._assertGuard(_exceptionable, {
@@ -323,14 +556,14 @@ class TtscGraphSession {
323
556
  path: _path + ".diagnostics",
324
557
  expected: "Array<ITtscGraphDump.IDiagnostic>",
325
558
  value: input.diagnostics
326
- }, _errorFactory)) && input.diagnostics.every((elem, _index12) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
559
+ }, _errorFactory)) && input.diagnostics.every((elem, _index15) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
327
560
  method: "typia.assert",
328
- path: _path + ".diagnostics[" + _index12 + "]",
561
+ path: _path + ".diagnostics[" + _index15 + "]",
329
562
  expected: "ITtscGraphDump.IDiagnostic",
330
563
  value: elem
331
- }, _errorFactory)) && _ao8(elem, _path + ".diagnostics[" + _index12 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
564
+ }, _errorFactory)) && _ao8(elem, _path + ".diagnostics[" + _index15 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
332
565
  method: "typia.assert",
333
- path: _path + ".diagnostics[" + _index12 + "]",
566
+ path: _path + ".diagnostics[" + _index15 + "]",
334
567
  expected: "ITtscGraphDump.IDiagnostic",
335
568
  value: elem
336
569
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -343,14 +576,14 @@ class TtscGraphSession {
343
576
  path: _path + ".nodes",
344
577
  expected: "Array<ITtscGraphDump.INode>",
345
578
  value: input.nodes
346
- }, _errorFactory)) && input.nodes.every((elem, _index13) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
579
+ }, _errorFactory)) && input.nodes.every((elem, _index16) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
347
580
  method: "typia.assert",
348
- path: _path + ".nodes[" + _index13 + "]",
581
+ path: _path + ".nodes[" + _index16 + "]",
349
582
  expected: "ITtscGraphDump.INode",
350
583
  value: elem
351
- }, _errorFactory)) && _ao9(elem, _path + ".nodes[" + _index13 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
584
+ }, _errorFactory)) && _ao9(elem, _path + ".nodes[" + _index16 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
352
585
  method: "typia.assert",
353
- path: _path + ".nodes[" + _index13 + "]",
586
+ path: _path + ".nodes[" + _index16 + "]",
354
587
  expected: "ITtscGraphDump.INode",
355
588
  value: elem
356
589
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -363,14 +596,14 @@ class TtscGraphSession {
363
596
  path: _path + ".edges",
364
597
  expected: "Array<ITtscGraphDump.IEdge>",
365
598
  value: input.edges
366
- }, _errorFactory)) && input.edges.every((elem, _index14) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
599
+ }, _errorFactory)) && input.edges.every((elem, _index17) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
367
600
  method: "typia.assert",
368
- path: _path + ".edges[" + _index14 + "]",
601
+ path: _path + ".edges[" + _index17 + "]",
369
602
  expected: "ITtscGraphDump.IEdge",
370
603
  value: elem
371
- }, _errorFactory)) && _ao13(elem, _path + ".edges[" + _index14 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
604
+ }, _errorFactory)) && _ao15(elem, _path + ".edges[" + _index17 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
372
605
  method: "typia.assert",
373
- path: _path + ".edges[" + _index14 + "]",
606
+ path: _path + ".edges[" + _index17 + "]",
374
607
  expected: "ITtscGraphDump.IEdge",
375
608
  value: elem
376
609
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -379,19 +612,36 @@ class TtscGraphSession {
379
612
  expected: "Array<ITtscGraphDump.IEdge>",
380
613
  value: input.edges
381
614
  }, _errorFactory));
382
- const _ao10 = (input, _path, _exceptionable = true) => _ap2(input, _path, true && _exceptionable) && ((Array.isArray(input.arguments) || _assertGuard_1._assertGuard(_exceptionable, {
615
+ const _ao10 = (input, _path, _exceptionable = true) => _ap4(input, _path, true && _exceptionable) && (undefined === input.value || "string" === typeof input.value || _assertGuard_1._assertGuard(_exceptionable, {
616
+ method: "typia.assert",
617
+ path: _path + ".value",
618
+ expected: "(string | undefined)",
619
+ value: input.value
620
+ }, _errorFactory));
621
+ const _ao11 = (input, _path, _exceptionable = true) => _ap4(input, _path, true && _exceptionable) && ("method" === input.kind || "property" === input.kind || _assertGuard_1._assertGuard(_exceptionable, {
622
+ method: "typia.assert",
623
+ path: _path + ".kind",
624
+ expected: "(\"method\" | \"property\")",
625
+ value: input.kind
626
+ }, _errorFactory)) && (undefined === input.line || "number" === typeof input.line || _assertGuard_1._assertGuard(_exceptionable, {
627
+ method: "typia.assert",
628
+ path: _path + ".line",
629
+ expected: "(number | undefined)",
630
+ value: input.line
631
+ }, _errorFactory)) && _ap15(input, _path, true && _exceptionable);
632
+ const _ao12 = (input, _path, _exceptionable = true) => _ap4(input, _path, true && _exceptionable) && ((Array.isArray(input.arguments) || _assertGuard_1._assertGuard(_exceptionable, {
383
633
  method: "typia.assert",
384
634
  path: _path + ".arguments",
385
635
  expected: "Array<ITtscGraphDecorator.IArgument>",
386
636
  value: input.arguments
387
- }, _errorFactory)) && input.arguments.every((elem, _index20) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _assertGuard_1._assertGuard(_exceptionable, {
637
+ }, _errorFactory)) && input.arguments.every((elem, _index26) => ("object" === typeof elem && null !== elem && false === Array.isArray(elem) || _assertGuard_1._assertGuard(_exceptionable, {
388
638
  method: "typia.assert",
389
- path: _path + ".arguments[" + _index20 + "]",
639
+ path: _path + ".arguments[" + _index26 + "]",
390
640
  expected: "ITtscGraphDecorator.IArgument",
391
641
  value: elem
392
- }, _errorFactory)) && _ao11(elem, _path + ".arguments[" + _index20 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
642
+ }, _errorFactory)) && _ao13(elem, _path + ".arguments[" + _index26 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
393
643
  method: "typia.assert",
394
- path: _path + ".arguments[" + _index20 + "]",
644
+ path: _path + ".arguments[" + _index26 + "]",
395
645
  expected: "ITtscGraphDecorator.IArgument",
396
646
  value: elem
397
647
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -400,13 +650,13 @@ class TtscGraphSession {
400
650
  expected: "Array<ITtscGraphDecorator.IArgument>",
401
651
  value: input.arguments
402
652
  }, _errorFactory));
403
- const _ao11 = (input, _path, _exceptionable = true) => undefined === input.literal || "string" === typeof input.literal || "number" === typeof input.literal || "boolean" === typeof input.literal || _assertGuard_1._assertGuard(_exceptionable, {
653
+ const _ao13 = (input, _path, _exceptionable = true) => undefined === input.literal || "string" === typeof input.literal || "number" === typeof input.literal || "boolean" === typeof input.literal || _assertGuard_1._assertGuard(_exceptionable, {
404
654
  method: "typia.assert",
405
655
  path: _path + ".literal",
406
656
  expected: "(boolean | number | string | undefined)",
407
657
  value: input.literal
408
658
  }, _errorFactory);
409
- const _ao12 = (input, _path, _exceptionable = true) => (undefined === input.file || "string" === typeof input.file || _assertGuard_1._assertGuard(_exceptionable, {
659
+ const _ao14 = (input, _path, _exceptionable = true) => (undefined === input.file || "string" === typeof input.file || _assertGuard_1._assertGuard(_exceptionable, {
410
660
  method: "typia.assert",
411
661
  path: _path + ".file",
412
662
  expected: "(string | undefined)",
@@ -432,7 +682,7 @@ class TtscGraphSession {
432
682
  expected: "(number | undefined)",
433
683
  value: input.endCol
434
684
  }, _errorFactory));
435
- const _ao13 = (input, _path, _exceptionable = true) => ("string" === typeof input.from || _assertGuard_1._assertGuard(_exceptionable, {
685
+ const _ao15 = (input, _path, _exceptionable = true) => ("string" === typeof input.from || _assertGuard_1._assertGuard(_exceptionable, {
436
686
  method: "typia.assert",
437
687
  path: _path + ".from",
438
688
  expected: "string",
@@ -447,7 +697,7 @@ class TtscGraphSession {
447
697
  path: _path + ".kind",
448
698
  expected: _ae2,
449
699
  value: input.kind
450
- }, _errorFactory)) && _ap3(input, _path, true && _exceptionable);
700
+ }, _errorFactory)) && _ap16(input, _path, true && _exceptionable);
451
701
  const _ao2 = (input, _path, _exceptionable = true) => ("number" === typeof input.schemaVersion || _assertGuard_1._assertGuard(_exceptionable, {
452
702
  method: "typia.assert",
453
703
  path: _path + ".schemaVersion",
@@ -478,14 +728,14 @@ class TtscGraphSession {
478
728
  path: _path + ".sources",
479
729
  expected: "Array<ITtscGraphDump.ISourceDigest>",
480
730
  value: input.sources
481
- }, _errorFactory)) && input.sources.every((elem, _index15) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
731
+ }, _errorFactory)) && input.sources.every((elem, _index18) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
482
732
  method: "typia.assert",
483
- path: _path + ".sources[" + _index15 + "]",
733
+ path: _path + ".sources[" + _index18 + "]",
484
734
  expected: "ITtscGraphDump.ISourceDigest",
485
735
  value: elem
486
- }, _errorFactory)) && _ao7(elem, _path + ".sources[" + _index15 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
736
+ }, _errorFactory)) && _ao7(elem, _path + ".sources[" + _index18 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
487
737
  method: "typia.assert",
488
- path: _path + ".sources[" + _index15 + "]",
738
+ path: _path + ".sources[" + _index18 + "]",
489
739
  expected: "ITtscGraphDump.ISourceDigest",
490
740
  value: elem
491
741
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -515,14 +765,14 @@ class TtscGraphSession {
515
765
  path: _path + ".configs",
516
766
  expected: "Array<ITtscGraphDump.IFileDigest>",
517
767
  value: input.configs
518
- }, _errorFactory)) && input.configs.every((elem, _index16) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
768
+ }, _errorFactory)) && input.configs.every((elem, _index19) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
519
769
  method: "typia.assert",
520
- path: _path + ".configs[" + _index16 + "]",
770
+ path: _path + ".configs[" + _index19 + "]",
521
771
  expected: "ITtscGraphDump.IFileDigest",
522
772
  value: elem
523
- }, _errorFactory)) && _ao5(elem, _path + ".configs[" + _index16 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
773
+ }, _errorFactory)) && _ao5(elem, _path + ".configs[" + _index19 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
524
774
  method: "typia.assert",
525
- path: _path + ".configs[" + _index16 + "]",
775
+ path: _path + ".configs[" + _index19 + "]",
526
776
  expected: "ITtscGraphDump.IFileDigest",
527
777
  value: elem
528
778
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -535,14 +785,14 @@ class TtscGraphSession {
535
785
  path: _path + ".roots",
536
786
  expected: "Array<ITtscGraphDump.IRootFile>",
537
787
  value: input.roots
538
- }, _errorFactory)) && input.roots.every((elem, _index17) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
788
+ }, _errorFactory)) && input.roots.every((elem, _index20) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
539
789
  method: "typia.assert",
540
- path: _path + ".roots[" + _index17 + "]",
790
+ path: _path + ".roots[" + _index20 + "]",
541
791
  expected: "ITtscGraphDump.IRootFile",
542
792
  value: elem
543
- }, _errorFactory)) && _ao6(elem, _path + ".roots[" + _index17 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
793
+ }, _errorFactory)) && _ao6(elem, _path + ".roots[" + _index20 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
544
794
  method: "typia.assert",
545
- path: _path + ".roots[" + _index17 + "]",
795
+ path: _path + ".roots[" + _index20 + "]",
546
796
  expected: "ITtscGraphDump.IRootFile",
547
797
  value: elem
548
798
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -600,93 +850,15 @@ class TtscGraphSession {
600
850
  expected: "string",
601
851
  value: input.message
602
852
  }, _errorFactory));
603
- const _ao9 = (input, _path, _exceptionable = true) => ("string" === typeof input.id || _assertGuard_1._assertGuard(_exceptionable, {
604
- method: "typia.assert",
605
- path: _path + ".id",
606
- expected: "string",
607
- value: input.id
608
- }, _errorFactory)) && (true === _av0.has(input.kind) || _assertGuard_1._assertGuard(_exceptionable, {
609
- method: "typia.assert",
610
- path: _path + ".kind",
611
- expected: _ae0,
612
- value: input.kind
613
- }, _errorFactory)) && _ap2(input, _path, true && _exceptionable) && (undefined === input.qualifiedName || "string" === typeof input.qualifiedName || _assertGuard_1._assertGuard(_exceptionable, {
614
- method: "typia.assert",
615
- path: _path + ".qualifiedName",
616
- expected: "(string | undefined)",
617
- value: input.qualifiedName
618
- }, _errorFactory)) && _ap1(input, _path, true && _exceptionable) && ("boolean" === typeof input.external || _assertGuard_1._assertGuard(_exceptionable, {
619
- method: "typia.assert",
620
- path: _path + ".external",
621
- expected: "boolean",
622
- value: input.external
623
- }, _errorFactory)) && (undefined === input.ignored || "boolean" === typeof input.ignored || _assertGuard_1._assertGuard(_exceptionable, {
624
- method: "typia.assert",
625
- path: _path + ".ignored",
626
- expected: "(boolean | undefined)",
627
- value: input.ignored
628
- }, _errorFactory)) && (undefined === input.exported || "boolean" === typeof input.exported || _assertGuard_1._assertGuard(_exceptionable, {
629
- method: "typia.assert",
630
- path: _path + ".exported",
631
- expected: "(boolean | undefined)",
632
- value: input.exported
633
- }, _errorFactory)) && (undefined === input.closure || "boolean" === typeof input.closure || _assertGuard_1._assertGuard(_exceptionable, {
634
- method: "typia.assert",
635
- path: _path + ".closure",
636
- expected: "(boolean | undefined)",
637
- value: input.closure
638
- }, _errorFactory)) && (undefined === input.modifiers || (Array.isArray(input.modifiers) || _assertGuard_1._assertGuard(_exceptionable, {
639
- method: "typia.assert",
640
- path: _path + ".modifiers",
641
- expected: "(Array<TtscGraphNodeModifier> | undefined)",
642
- value: input.modifiers
643
- }, _errorFactory)) && input.modifiers.every((elem, _index18) => true === _av1.has(elem) || _assertGuard_1._assertGuard(_exceptionable, {
644
- method: "typia.assert",
645
- path: _path + ".modifiers[" + _index18 + "]",
646
- expected: _ae1,
647
- value: elem
648
- }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
649
- method: "typia.assert",
650
- path: _path + ".modifiers",
651
- expected: "(Array<TtscGraphNodeModifier> | undefined)",
652
- value: input.modifiers
653
- }, _errorFactory)) && (undefined === input.decorators || (Array.isArray(input.decorators) || _assertGuard_1._assertGuard(_exceptionable, {
654
- method: "typia.assert",
655
- path: _path + ".decorators",
656
- expected: "(Array<ITtscGraphDecorator> | undefined)",
657
- value: input.decorators
658
- }, _errorFactory)) && input.decorators.every((elem, _index19) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
659
- method: "typia.assert",
660
- path: _path + ".decorators[" + _index19 + "]",
661
- expected: "ITtscGraphDecorator",
662
- value: elem
663
- }, _errorFactory)) && _ao10(elem, _path + ".decorators[" + _index19 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
664
- method: "typia.assert",
665
- path: _path + ".decorators[" + _index19 + "]",
666
- expected: "ITtscGraphDecorator",
667
- value: elem
668
- }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
669
- method: "typia.assert",
670
- path: _path + ".decorators",
671
- expected: "(Array<ITtscGraphDecorator> | undefined)",
672
- value: input.decorators
673
- }, _errorFactory)) && _ap3(input, _path, true && _exceptionable) && (undefined === input.implementation || ("object" === typeof input.implementation && null !== input.implementation || _assertGuard_1._assertGuard(_exceptionable, {
674
- method: "typia.assert",
675
- path: _path + ".implementation",
676
- expected: "(ITtscGraphSpan | undefined)",
677
- value: input.implementation
678
- }, _errorFactory)) && _ao12(input.implementation, _path + ".implementation", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
679
- method: "typia.assert",
680
- path: _path + ".implementation",
681
- expected: "(ITtscGraphSpan | undefined)",
682
- value: input.implementation
683
- }, _errorFactory));
853
+ const _ao9 = (input, _path, _exceptionable = true) => _ap2(input, _path, true && _exceptionable) && _ap3(input, _path, true && _exceptionable) && _ap4(input, _path, true && _exceptionable) && _ap5(input, _path, true && _exceptionable) && _ap1(input, _path, true && _exceptionable) && _ap6(input, _path, true && _exceptionable) && _ap7(input, _path, true && _exceptionable) && _ap8(input, _path, true && _exceptionable) && _ap9(input, _path, true && _exceptionable) && _ap10(input, _path, true && _exceptionable) && _ap11(input, _path, true && _exceptionable) && _ap12(input, _path, true && _exceptionable) && _ap13(input, _path, true && _exceptionable) && _ap14(input, _path, true && _exceptionable) && _ap15(input, _path, true && _exceptionable) && _ap16(input, _path, true && _exceptionable) && _ap17(input, _path, true && _exceptionable);
684
854
  const _io0 = input => "number" === typeof input.id && "number" === typeof input.protocolVersion && ("error" === input.mode || "incremental" === input.mode || "initial" === input.mode || "rebuild" === input.mode || "reload" === input.mode || "unchanged" === input.mode) && _ip0(input) && "boolean" === typeof input.changed && (undefined === input.dump || "object" === typeof input.dump && null !== input.dump && _io1(input.dump)) && (undefined === input.error || "string" === typeof input.error);
685
- const _io1 = input => "string" === typeof input.project && "string" === typeof input.tsconfig && ("object" === typeof input.provenance && null !== input.provenance && _io2(input.provenance)) && (Array.isArray(input.diagnostics) && input.diagnostics.every(elem => "object" === typeof elem && null !== elem && _io8(elem))) && (Array.isArray(input.nodes) && input.nodes.every(elem => "object" === typeof elem && null !== elem && _io9(elem))) && (Array.isArray(input.edges) && input.edges.every(elem => "object" === typeof elem && null !== elem && _io13(elem)));
686
- const _io10 = input => _ip2(input) && (Array.isArray(input.arguments) && input.arguments.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io11(elem)));
687
- const _io11 = input => undefined === input.literal || "string" === typeof input.literal || "number" === typeof input.literal || "boolean" === typeof input.literal;
688
- const _io12 = input => (undefined === input.file || "string" === typeof input.file) && "number" === typeof input.startLine && (undefined === input.startCol || "number" === typeof input.startCol) && (undefined === input.endLine || "number" === typeof input.endLine) && (undefined === input.endCol || "number" === typeof input.endCol);
689
- const _io13 = input => "string" === typeof input.from && "string" === typeof input.to && true === _iv2.has(input.kind) && _ip3(input);
855
+ const _io1 = input => "string" === typeof input.project && "string" === typeof input.tsconfig && ("object" === typeof input.provenance && null !== input.provenance && _io2(input.provenance)) && (Array.isArray(input.diagnostics) && input.diagnostics.every(elem => "object" === typeof elem && null !== elem && _io8(elem))) && (Array.isArray(input.nodes) && input.nodes.every(elem => "object" === typeof elem && null !== elem && _io9(elem))) && (Array.isArray(input.edges) && input.edges.every(elem => "object" === typeof elem && null !== elem && _io15(elem)));
856
+ const _io10 = input => _ip4(input) && (undefined === input.value || "string" === typeof input.value);
857
+ const _io11 = input => _ip4(input) && ("method" === input.kind || "property" === input.kind) && (undefined === input.line || "number" === typeof input.line) && _ip15(input);
858
+ const _io12 = input => _ip4(input) && (Array.isArray(input.arguments) && input.arguments.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io13(elem)));
859
+ const _io13 = input => undefined === input.literal || "string" === typeof input.literal || "number" === typeof input.literal || "boolean" === typeof input.literal;
860
+ const _io14 = input => (undefined === input.file || "string" === typeof input.file) && "number" === typeof input.startLine && (undefined === input.startCol || "number" === typeof input.startCol) && (undefined === input.endLine || "number" === typeof input.endLine) && (undefined === input.endCol || "number" === typeof input.endCol);
861
+ const _io15 = input => "string" === typeof input.from && "string" === typeof input.to && true === _iv2.has(input.kind) && _ip16(input);
690
862
  const _io2 = input => "number" === typeof input.schemaVersion && _ip0(input) && ("object" === typeof input.producer && null !== input.producer && _io3(input.producer)) && ("object" === typeof input.universe && null !== input.universe && _io4(input.universe)) && (Array.isArray(input.sources) && input.sources.every(elem => "object" === typeof elem && null !== elem && _io7(elem)));
691
863
  const _io3 = input => "string" === typeof input.tool && "string" === typeof input.version && "string" === typeof input.typescript;
692
864
  const _io4 = input => Array.isArray(input.configs) && input.configs.every(elem => "object" === typeof elem && null !== elem && _io5(elem)) && (Array.isArray(input.roots) && input.roots.every(elem => "object" === typeof elem && null !== elem && _io6(elem)));
@@ -694,7 +866,7 @@ class TtscGraphSession {
694
866
  const _io6 = input => "string" === typeof input.config && _ip1(input);
695
867
  const _io7 = input => _ip1(input) && "string" === typeof input.checkerDigest && "string" === typeof input.diskDigest;
696
868
  const _io8 = input => _ip1(input) && "number" === typeof input.line && "number" === typeof input.column && "number" === typeof input.code && ("error" === input.category || "warning" === input.category) && "string" === typeof input.message;
697
- const _io9 = input => "string" === typeof input.id && true === _iv0.has(input.kind) && _ip2(input) && (undefined === input.qualifiedName || "string" === typeof input.qualifiedName) && _ip1(input) && "boolean" === typeof input.external && (undefined === input.ignored || "boolean" === typeof input.ignored) && (undefined === input.exported || "boolean" === typeof input.exported) && (undefined === input.closure || "boolean" === typeof input.closure) && (undefined === input.modifiers || Array.isArray(input.modifiers) && input.modifiers.every(elem => true === _iv1.has(elem))) && (undefined === input.decorators || Array.isArray(input.decorators) && input.decorators.every(elem => "object" === typeof elem && null !== elem && _io10(elem))) && _ip3(input) && (undefined === input.implementation || "object" === typeof input.implementation && null !== input.implementation && _io12(input.implementation));
869
+ const _io9 = input => _ip2(input) && _ip3(input) && _ip4(input) && _ip5(input) && _ip1(input) && _ip6(input) && _ip7(input) && _ip8(input) && _ip9(input) && _ip10(input) && _ip11(input) && _ip12(input) && _ip13(input) && _ip14(input) && _ip15(input) && _ip16(input) && _ip17(input);
698
870
  const __is = input => "object" === typeof input && null !== input && _io0(input);
699
871
  let _errorFactory;
700
872
  return (input, errorFactory) => {
@@ -717,27 +889,107 @@ class TtscGraphSession {
717
889
  })()(parsed);
718
890
  }
719
891
  catch (error) {
720
- this.failPending(new Error(`@ttsc/graph: native session returned an unreadable response: ${asError(error).message}`));
892
+ this.failChild(child, new Error(`@ttsc/graph: native session returned an unreadable response: ${asError(error).message}`));
893
+ return;
894
+ }
895
+ // The envelope's version is not the body's, and only the envelope has been
896
+ // held to one so far. A producer can speak this protocol and still carry a
897
+ // dump from another schema — the two move apart the moment a node field is
898
+ // added without the frame around it changing — and then the facts that field
899
+ // holds are silently absent rather than refused. `literals` is exactly that
900
+ // shape: an older producer resolves no value set, so a union comes back
901
+ // looking like a type with no members. Hold the body to its own number too,
902
+ // once the frame is understood.
903
+ if (response.dump !== undefined &&
904
+ response.dump.provenance.schemaVersion !== loadGraph_1.DUMP_SCHEMA_VERSION) {
905
+ // Session-wide, for the same reason the protocol mismatch above is: it is
906
+ // the wrong binary, not one bad frame.
907
+ this.failChild(child, new Error(`@ttsc/graph: ttscgraph sends dump schema v${String(response.dump.provenance.schemaVersion)}, this client reads v${String(loadGraph_1.DUMP_SCHEMA_VERSION)}. ` +
908
+ "Install a matching `ttsc` (the binary resolves from the target " +
909
+ "project, or from TTSC_GRAPH_BINARY)."));
721
910
  return;
722
911
  }
723
912
  const pending = this.pending.get(response.id);
724
- if (pending === undefined)
913
+ if (pending === undefined || pending.child !== child)
914
+ return;
915
+ this.settlePending(response.id, pending, response);
916
+ }
917
+ failChild(child, error, terminate = true) {
918
+ if (this.child !== child)
725
919
  return;
726
- this.pending.delete(response.id);
727
- pending.resolve(response);
920
+ this.child = undefined;
921
+ this.current = undefined;
922
+ child.lines.close();
923
+ this.failPending(error, child);
924
+ if (terminate)
925
+ terminateChild(child.process);
728
926
  }
729
- failChild(child, error) {
730
- if (this.child === child)
731
- this.child = undefined;
732
- this.failPending(new Error(`@ttsc/graph: native session failed: ${error.message}`));
927
+ failPending(error, child) {
928
+ for (const [id, pending] of this.pending) {
929
+ if (child === undefined || pending.child === child) {
930
+ this.settlePending(id, pending, error);
931
+ }
932
+ }
733
933
  }
734
- failPending(error) {
735
- for (const pending of this.pending.values())
736
- pending.reject(error);
737
- this.pending.clear();
934
+ settlePending(id, pending, result) {
935
+ if (this.pending.get(id) !== pending)
936
+ return;
937
+ this.pending.delete(id);
938
+ clearTimeout(pending.timer);
939
+ if (pending.signal !== undefined && pending.abort !== undefined) {
940
+ pending.signal.removeEventListener("abort", pending.abort);
941
+ }
942
+ if (result instanceof Error)
943
+ pending.reject(result);
944
+ else
945
+ pending.resolve(result);
738
946
  }
739
947
  }
740
948
  exports.TtscGraphSession = TtscGraphSession;
949
+ function terminateChild(child) {
950
+ if (!child.stdin.destroyed)
951
+ child.stdin.destroy();
952
+ if (child.exitCode !== null || child.signalCode !== null)
953
+ return;
954
+ try {
955
+ child.kill();
956
+ }
957
+ catch {
958
+ return;
959
+ }
960
+ const force = setTimeout(() => {
961
+ if (child.exitCode !== null || child.signalCode !== null)
962
+ return;
963
+ try {
964
+ child.kill("SIGKILL");
965
+ }
966
+ catch {
967
+ // The process exited between the liveness check and the signal.
968
+ }
969
+ }, TERMINATION_GRACE_MS);
970
+ force.unref();
971
+ child.once("exit", () => clearTimeout(force));
972
+ }
973
+ function cancelledError(signal, child) {
974
+ const error = new Error(`@ttsc/graph: native snapshot request cancelled${abortDetail(signal)}${child === undefined ? "" : stderrSuffix(child)}`);
975
+ error.name = "AbortError";
976
+ return error;
977
+ }
978
+ function abortDetail(signal) {
979
+ const reason = signal?.reason;
980
+ if (reason === undefined)
981
+ return "";
982
+ try {
983
+ return `: ${reason instanceof Error ? reason.message : String(reason)}`;
984
+ }
985
+ catch {
986
+ return "";
987
+ }
988
+ }
989
+ function stderrSuffix(child) {
990
+ const stderr = child.stderr.trim();
991
+ return stderr === "" ? "" : `: ${stderr}`;
992
+ }
741
993
  function asError(error) {
742
994
  return error instanceof Error ? error : new Error(String(error));
743
995
  }