@ttsc/graph 0.19.3 → 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 (82) hide show
  1. package/lib/TtscGraphApplication.js +3 -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 +24 -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 +402 -210
  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 +4 -4
  24. package/lib/model/loadGraph.js +233 -168
  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/server/createServer.js +17 -6
  30. package/lib/server/createServer.js.map +1 -1
  31. package/lib/server/pathPolicy.d.ts +6 -0
  32. package/lib/server/pathPolicy.js +10 -1
  33. package/lib/server/pathPolicy.js.map +1 -1
  34. package/lib/server/resolveHandle.js +22 -18
  35. package/lib/server/resolveHandle.js.map +1 -1
  36. package/lib/server/resultAudit.d.ts +41 -20
  37. package/lib/server/resultAudit.js +62 -34
  38. package/lib/server/resultAudit.js.map +1 -1
  39. package/lib/server/resultNext.d.ts +5 -0
  40. package/lib/server/resultNext.js.map +1 -1
  41. package/lib/server/runDetails.d.ts +2 -2
  42. package/lib/server/runDetails.js +54 -108
  43. package/lib/server/runDetails.js.map +1 -1
  44. package/lib/server/runEntrypoints.js +1 -1
  45. package/lib/server/runEntrypoints.js.map +1 -1
  46. package/lib/server/runLookup.js +1 -1
  47. package/lib/server/runLookup.js.map +1 -1
  48. package/lib/server/runTour.js +113 -30
  49. package/lib/server/runTour.js.map +1 -1
  50. package/lib/server/runTrace.d.ts +22 -0
  51. package/lib/server/runTrace.js +293 -63
  52. package/lib/server/runTrace.js.map +1 -1
  53. package/lib/structures/ITtscGraphDump.d.ts +13 -13
  54. package/lib/structures/ITtscGraphNode.d.ts +34 -0
  55. package/lib/structures/ITtscGraphTrace.d.ts +1 -1
  56. package/lib/view.js +18 -28
  57. package/lib/view.js.map +1 -1
  58. package/package.json +5 -5
  59. package/src/TtscGraphApplication.ts +5 -1
  60. package/src/bin.ts +13 -3
  61. package/src/index.ts +34 -27
  62. package/src/launcherArgs.ts +168 -0
  63. package/src/model/TtscGraphMemory.ts +34 -60
  64. package/src/model/TtscGraphNodeId.ts +77 -0
  65. package/src/model/TtscGraphSession.ts +228 -55
  66. package/src/model/TtscGraphSourceReader.ts +117 -0
  67. package/src/model/loadGraph.ts +4 -4
  68. package/src/reduce.ts +136 -31
  69. package/src/server/createServer.ts +12 -2
  70. package/src/server/pathPolicy.ts +10 -1
  71. package/src/server/resolveHandle.ts +21 -22
  72. package/src/server/resultAudit.ts +64 -33
  73. package/src/server/resultNext.ts +6 -0
  74. package/src/server/runDetails.ts +57 -113
  75. package/src/server/runEntrypoints.ts +1 -1
  76. package/src/server/runLookup.ts +1 -1
  77. package/src/server/runTour.ts +133 -39
  78. package/src/server/runTrace.ts +401 -65
  79. package/src/structures/ITtscGraphDump.ts +13 -13
  80. package/src/structures/ITtscGraphNode.ts +40 -0
  81. package/src/structures/ITtscGraphTrace.ts +1 -1
  82. package/src/view.ts +25 -23
@@ -43,8 +43,8 @@ const node_readline_1 = __importDefault(require("node:readline"));
43
43
  const typia_1 = __importDefault(require("typia"));
44
44
  const nativeExecutable_1 = require("../nativeExecutable");
45
45
  const resolveGraphBinary_1 = require("../resolveGraphBinary");
46
- const loadGraph_1 = require("./loadGraph");
47
46
  const TtscGraphMemory_1 = require("./TtscGraphMemory");
47
+ const loadGraph_1 = require("./loadGraph");
48
48
  /**
49
49
  * The serve protocol version this client speaks.
50
50
  *
@@ -54,6 +54,9 @@ const TtscGraphMemory_1 = require("./TtscGraphMemory");
54
54
  * constant out of this file and fails if the pair drifts.
55
55
  */
56
56
  const PROTOCOL_VERSION = 1;
57
+ const DEFAULT_REQUEST_TIMEOUT_MS = 300000;
58
+ const MAX_TIMER_MS = 2147483647;
59
+ const TERMINATION_GRACE_MS = 1000;
57
60
  /**
58
61
  * Resident bridge to `ttscgraph serve`.
59
62
  *
@@ -66,14 +69,20 @@ class TtscGraphSession {
66
69
  cwd;
67
70
  tsconfig;
68
71
  binary;
72
+ requestTimeoutMs;
69
73
  child;
70
- stderr = "";
71
74
  nextId = 0;
72
75
  pending = new Map();
73
76
  queue = Promise.resolve();
74
77
  current;
75
78
  closed = false;
76
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
+ }
77
86
  // Resolve the platform binary from the project this session serves, so the
78
87
  // MCP server started from an unrelated directory still finds the target's
79
88
  // installed `ttsc`.
@@ -87,20 +96,49 @@ class TtscGraphSession {
87
96
  this.cwd = options.cwd;
88
97
  this.tsconfig = options.tsconfig;
89
98
  this.binary = binary;
99
+ this.requestTimeoutMs = requestTimeoutMs;
90
100
  }
91
101
  /** Return a graph for the current disk snapshot, serialized per tool call. */
92
- graph() {
102
+ graph(options = {}) {
103
+ if (this.closed) {
104
+ return Promise.reject(new Error("@ttsc/graph: native session is closed"));
105
+ }
93
106
  let resolve;
94
107
  let reject;
108
+ let started = false;
109
+ let settled = false;
95
110
  const result = new Promise((res, rej) => {
96
- resolve = res;
97
- 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
+ };
98
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 });
99
133
  this.queue = this.queue
100
134
  .catch(() => undefined)
101
135
  .then(async () => {
136
+ started = true;
137
+ options.signal?.removeEventListener("abort", cancelQueued);
138
+ if (settled)
139
+ return;
102
140
  try {
103
- resolve(await this.refresh());
141
+ resolve(await this.refresh(options.signal));
104
142
  }
105
143
  catch (error) {
106
144
  reject(asError(error));
@@ -110,17 +148,19 @@ class TtscGraphSession {
110
148
  }
111
149
  /** Close the native session. Safe to call more than once. */
112
150
  close() {
151
+ if (this.closed)
152
+ return;
113
153
  this.closed = true;
114
- const child = this.child;
115
- this.child = undefined;
116
- if (child !== undefined && !child.killed)
117
- child.stdin.end();
118
- 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);
119
159
  }
120
- async refresh() {
160
+ async refresh(signal) {
121
161
  // The protocol version and the envelope shape were both settled in onLine,
122
162
  // before this frame was ever routed here.
123
- const response = await this.request();
163
+ const response = await this.request(signal);
124
164
  if (response.error !== undefined) {
125
165
  throw new Error(`@ttsc/graph: ${response.error}`);
126
166
  }
@@ -135,16 +175,37 @@ class TtscGraphSession {
135
175
  }
136
176
  return this.current;
137
177
  }
138
- request() {
178
+ request(signal) {
179
+ if (signal?.aborted)
180
+ throw cancelledError(signal);
139
181
  const child = this.ensureChild();
140
182
  const id = ++this.nextId;
141
183
  return new Promise((resolve, reject) => {
142
- this.pending.set(id, { resolve, reject });
143
- 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) => {
144
204
  if (error === null || error === undefined)
145
205
  return;
146
- this.pending.delete(id);
147
- 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}`));
148
209
  });
149
210
  });
150
211
  }
@@ -154,34 +215,37 @@ class TtscGraphSession {
154
215
  // process; an orphaned resident compiler would outlive the MCP server.
155
216
  throw new Error("@ttsc/graph: native session is closed");
156
217
  }
157
- 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) {
158
221
  return this.child;
159
222
  }
160
- this.stderr = "";
161
- 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: "" };
162
226
  this.child = child;
163
- child.stderr.setEncoding("utf8");
164
- child.stderr.on("data", (chunk) => {
165
- 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);
166
230
  });
167
- const lines = node_readline_1.default.createInterface({ input: child.stdout });
168
- lines.on("line", (line) => this.onLine(line));
169
- child.on("error", (error) => this.failChild(child, error));
170
- 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) => {
171
234
  if (this.child !== child)
172
235
  return;
173
- this.child = undefined;
174
- 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);
175
237
  });
176
238
  return child;
177
239
  }
178
- onLine(line) {
240
+ onLine(child, line) {
241
+ if (this.child !== child)
242
+ return;
179
243
  let parsed;
180
244
  try {
181
245
  parsed = JSON.parse(line);
182
246
  }
183
247
  catch (error) {
184
- 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}`));
185
249
  return;
186
250
  }
187
251
  // Read the version before the shape, because a server speaking another
@@ -198,7 +262,7 @@ class TtscGraphSession {
198
262
  if (version !== PROTOCOL_VERSION) {
199
263
  // Session-wide: a version mismatch is not one bad frame, it is the wrong
200
264
  // binary, and every request against it is equally doomed.
201
- 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)}. ` +
202
266
  "Install a matching `ttsc` (the binary resolves from the target " +
203
267
  "project, or from TTSC_GRAPH_BINARY)."));
204
268
  return;
@@ -213,19 +277,33 @@ class TtscGraphSession {
213
277
  response = (() => {
214
278
  const _ip0 = input => Array.isArray(input["capabilities"]) && input["capabilities"].every(elem => "string" === typeof elem);
215
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"]);
216
282
  const _iv0 = new Set(["class", "enum", "external_symbol", "file", "function", "interface", "method", "module", "namespace", "package", "parameter", "property", "type", "variable"]);
217
- 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));
218
290
  const _iv1 = new Set(["abstract", "async", "const", "declare", "default", "export", "optional", "private", "protected", "public", "readonly", "static"]);
219
- const _ip3 = input => undefined === input["evidence"] || "object" === typeof input["evidence"] && null !== input["evidence"] && _io13(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"]);
220
298
  const _iv2 = new Set(["accesses", "calls", "contains", "decorates", "dispatches", "exports", "extends", "implements", "imports", "instantiates", "overrides", "renders", "tests", "type_ref"]);
221
299
  const _ap0 = (input, _path, _exceptionable = true) => (Array.isArray(input["capabilities"]) || _assertGuard_1._assertGuard(_exceptionable, {
222
300
  method: "typia.assert",
223
301
  path: _path + ".capabilities",
224
302
  expected: "Array<string>",
225
303
  value: input["capabilities"]
226
- }, _errorFactory)) && input["capabilities"].every((elem, _index13) => "string" === typeof elem || _assertGuard_1._assertGuard(_exceptionable, {
304
+ }, _errorFactory)) && input["capabilities"].every((elem, _index14) => "string" === typeof elem || _assertGuard_1._assertGuard(_exceptionable, {
227
305
  method: "typia.assert",
228
- path: _path + ".capabilities[" + _index13 + "]",
306
+ path: _path + ".capabilities[" + _index14 + "]",
229
307
  expected: "string",
230
308
  value: elem
231
309
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -240,27 +318,181 @@ class TtscGraphSession {
240
318
  expected: "string",
241
319
  value: input["file"]
242
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);
243
333
  const _av0 = new Set(["class", "enum", "external_symbol", "file", "function", "interface", "method", "module", "namespace", "package", "parameter", "property", "type", "variable"]);
244
334
  const _ae0 = "(\"class\" | \"enum\" | \"external_symbol\" | \"file\" | \"function\" | \"interface\" | \"method\" | \"module\" | \"namespace\" | \"package\" | \"parameter\" | \"property\" | \"type\" | \"variable\")";
245
- 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, {
246
336
  method: "typia.assert",
247
337
  path: _path + ".name",
248
338
  expected: "string",
249
339
  value: input["name"]
250
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);
251
387
  const _av1 = new Set(["abstract", "async", "const", "declare", "default", "export", "optional", "private", "protected", "public", "readonly", "static"]);
252
388
  const _ae1 = "(\"abstract\" | \"async\" | \"const\" | \"declare\" | \"default\" | \"export\" | \"optional\" | \"private\" | \"protected\" | \"public\" | \"readonly\" | \"static\")";
253
- 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, {
254
475
  method: "typia.assert",
255
476
  path: _path + ".evidence",
256
477
  expected: "(ITtscGraphSpan | undefined)",
257
478
  value: input["evidence"]
258
- }, _errorFactory)) && _ao13(input["evidence"], _path + ".evidence", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
479
+ }, _errorFactory)) && _ao14(input["evidence"], _path + ".evidence", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
259
480
  method: "typia.assert",
260
481
  path: _path + ".evidence",
261
482
  expected: "(ITtscGraphSpan | undefined)",
262
483
  value: input["evidence"]
263
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);
264
496
  const _av2 = new Set(["accesses", "calls", "contains", "decorates", "dispatches", "exports", "extends", "implements", "imports", "instantiates", "overrides", "renders", "tests", "type_ref"]);
265
497
  const _ae2 = "(\"accesses\" | \"calls\" | \"contains\" | \"decorates\" | \"dispatches\" | \"exports\" | \"extends\" | \"implements\" | \"imports\" | \"instantiates\" | \"overrides\" | \"renders\" | \"tests\" | \"type_ref\")";
266
498
  const _ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.id || _assertGuard_1._assertGuard(_exceptionable, {
@@ -324,14 +556,14 @@ class TtscGraphSession {
324
556
  path: _path + ".diagnostics",
325
557
  expected: "Array<ITtscGraphDump.IDiagnostic>",
326
558
  value: input.diagnostics
327
- }, _errorFactory)) && input.diagnostics.every((elem, _index14) => ("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, {
328
560
  method: "typia.assert",
329
- path: _path + ".diagnostics[" + _index14 + "]",
561
+ path: _path + ".diagnostics[" + _index15 + "]",
330
562
  expected: "ITtscGraphDump.IDiagnostic",
331
563
  value: elem
332
- }, _errorFactory)) && _ao8(elem, _path + ".diagnostics[" + _index14 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
564
+ }, _errorFactory)) && _ao8(elem, _path + ".diagnostics[" + _index15 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
333
565
  method: "typia.assert",
334
- path: _path + ".diagnostics[" + _index14 + "]",
566
+ path: _path + ".diagnostics[" + _index15 + "]",
335
567
  expected: "ITtscGraphDump.IDiagnostic",
336
568
  value: elem
337
569
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -344,14 +576,14 @@ class TtscGraphSession {
344
576
  path: _path + ".nodes",
345
577
  expected: "Array<ITtscGraphDump.INode>",
346
578
  value: input.nodes
347
- }, _errorFactory)) && input.nodes.every((elem, _index15) => ("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, {
348
580
  method: "typia.assert",
349
- path: _path + ".nodes[" + _index15 + "]",
581
+ path: _path + ".nodes[" + _index16 + "]",
350
582
  expected: "ITtscGraphDump.INode",
351
583
  value: elem
352
- }, _errorFactory)) && _ao9(elem, _path + ".nodes[" + _index15 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
584
+ }, _errorFactory)) && _ao9(elem, _path + ".nodes[" + _index16 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
353
585
  method: "typia.assert",
354
- path: _path + ".nodes[" + _index15 + "]",
586
+ path: _path + ".nodes[" + _index16 + "]",
355
587
  expected: "ITtscGraphDump.INode",
356
588
  value: elem
357
589
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -364,14 +596,14 @@ class TtscGraphSession {
364
596
  path: _path + ".edges",
365
597
  expected: "Array<ITtscGraphDump.IEdge>",
366
598
  value: input.edges
367
- }, _errorFactory)) && input.edges.every((elem, _index16) => ("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, {
368
600
  method: "typia.assert",
369
- path: _path + ".edges[" + _index16 + "]",
601
+ path: _path + ".edges[" + _index17 + "]",
370
602
  expected: "ITtscGraphDump.IEdge",
371
603
  value: elem
372
- }, _errorFactory)) && _ao14(elem, _path + ".edges[" + _index16 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
604
+ }, _errorFactory)) && _ao15(elem, _path + ".edges[" + _index17 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
373
605
  method: "typia.assert",
374
- path: _path + ".edges[" + _index16 + "]",
606
+ path: _path + ".edges[" + _index17 + "]",
375
607
  expected: "ITtscGraphDump.IEdge",
376
608
  value: elem
377
609
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -380,25 +612,36 @@ class TtscGraphSession {
380
612
  expected: "Array<ITtscGraphDump.IEdge>",
381
613
  value: input.edges
382
614
  }, _errorFactory));
383
- const _ao10 = (input, _path, _exceptionable = true) => _ap2(input, _path, true && _exceptionable) && (undefined === input.value || "string" === typeof input.value || _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, {
384
616
  method: "typia.assert",
385
617
  path: _path + ".value",
386
618
  expected: "(string | undefined)",
387
619
  value: input.value
388
620
  }, _errorFactory));
389
- const _ao11 = (input, _path, _exceptionable = true) => _ap2(input, _path, true && _exceptionable) && ((Array.isArray(input.arguments) || _assertGuard_1._assertGuard(_exceptionable, {
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, {
390
633
  method: "typia.assert",
391
634
  path: _path + ".arguments",
392
635
  expected: "Array<ITtscGraphDecorator.IArgument>",
393
636
  value: input.arguments
394
- }, _errorFactory)) && input.arguments.every((elem, _index24) => ("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, {
395
638
  method: "typia.assert",
396
- path: _path + ".arguments[" + _index24 + "]",
639
+ path: _path + ".arguments[" + _index26 + "]",
397
640
  expected: "ITtscGraphDecorator.IArgument",
398
641
  value: elem
399
- }, _errorFactory)) && _ao12(elem, _path + ".arguments[" + _index24 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
642
+ }, _errorFactory)) && _ao13(elem, _path + ".arguments[" + _index26 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
400
643
  method: "typia.assert",
401
- path: _path + ".arguments[" + _index24 + "]",
644
+ path: _path + ".arguments[" + _index26 + "]",
402
645
  expected: "ITtscGraphDecorator.IArgument",
403
646
  value: elem
404
647
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -407,13 +650,13 @@ class TtscGraphSession {
407
650
  expected: "Array<ITtscGraphDecorator.IArgument>",
408
651
  value: input.arguments
409
652
  }, _errorFactory));
410
- const _ao12 = (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, {
411
654
  method: "typia.assert",
412
655
  path: _path + ".literal",
413
656
  expected: "(boolean | number | string | undefined)",
414
657
  value: input.literal
415
658
  }, _errorFactory);
416
- const _ao13 = (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, {
417
660
  method: "typia.assert",
418
661
  path: _path + ".file",
419
662
  expected: "(string | undefined)",
@@ -439,7 +682,7 @@ class TtscGraphSession {
439
682
  expected: "(number | undefined)",
440
683
  value: input.endCol
441
684
  }, _errorFactory));
442
- const _ao14 = (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, {
443
686
  method: "typia.assert",
444
687
  path: _path + ".from",
445
688
  expected: "string",
@@ -454,7 +697,7 @@ class TtscGraphSession {
454
697
  path: _path + ".kind",
455
698
  expected: _ae2,
456
699
  value: input.kind
457
- }, _errorFactory)) && _ap3(input, _path, true && _exceptionable);
700
+ }, _errorFactory)) && _ap16(input, _path, true && _exceptionable);
458
701
  const _ao2 = (input, _path, _exceptionable = true) => ("number" === typeof input.schemaVersion || _assertGuard_1._assertGuard(_exceptionable, {
459
702
  method: "typia.assert",
460
703
  path: _path + ".schemaVersion",
@@ -485,14 +728,14 @@ class TtscGraphSession {
485
728
  path: _path + ".sources",
486
729
  expected: "Array<ITtscGraphDump.ISourceDigest>",
487
730
  value: input.sources
488
- }, _errorFactory)) && input.sources.every((elem, _index17) => ("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, {
489
732
  method: "typia.assert",
490
- path: _path + ".sources[" + _index17 + "]",
733
+ path: _path + ".sources[" + _index18 + "]",
491
734
  expected: "ITtscGraphDump.ISourceDigest",
492
735
  value: elem
493
- }, _errorFactory)) && _ao7(elem, _path + ".sources[" + _index17 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
736
+ }, _errorFactory)) && _ao7(elem, _path + ".sources[" + _index18 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
494
737
  method: "typia.assert",
495
- path: _path + ".sources[" + _index17 + "]",
738
+ path: _path + ".sources[" + _index18 + "]",
496
739
  expected: "ITtscGraphDump.ISourceDigest",
497
740
  value: elem
498
741
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -522,14 +765,14 @@ class TtscGraphSession {
522
765
  path: _path + ".configs",
523
766
  expected: "Array<ITtscGraphDump.IFileDigest>",
524
767
  value: input.configs
525
- }, _errorFactory)) && input.configs.every((elem, _index18) => ("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, {
526
769
  method: "typia.assert",
527
- path: _path + ".configs[" + _index18 + "]",
770
+ path: _path + ".configs[" + _index19 + "]",
528
771
  expected: "ITtscGraphDump.IFileDigest",
529
772
  value: elem
530
- }, _errorFactory)) && _ao5(elem, _path + ".configs[" + _index18 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
773
+ }, _errorFactory)) && _ao5(elem, _path + ".configs[" + _index19 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
531
774
  method: "typia.assert",
532
- path: _path + ".configs[" + _index18 + "]",
775
+ path: _path + ".configs[" + _index19 + "]",
533
776
  expected: "ITtscGraphDump.IFileDigest",
534
777
  value: elem
535
778
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -542,14 +785,14 @@ class TtscGraphSession {
542
785
  path: _path + ".roots",
543
786
  expected: "Array<ITtscGraphDump.IRootFile>",
544
787
  value: input.roots
545
- }, _errorFactory)) && input.roots.every((elem, _index19) => ("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, {
546
789
  method: "typia.assert",
547
- path: _path + ".roots[" + _index19 + "]",
790
+ path: _path + ".roots[" + _index20 + "]",
548
791
  expected: "ITtscGraphDump.IRootFile",
549
792
  value: elem
550
- }, _errorFactory)) && _ao6(elem, _path + ".roots[" + _index19 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
793
+ }, _errorFactory)) && _ao6(elem, _path + ".roots[" + _index20 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
551
794
  method: "typia.assert",
552
- path: _path + ".roots[" + _index19 + "]",
795
+ path: _path + ".roots[" + _index20 + "]",
553
796
  expected: "ITtscGraphDump.IRootFile",
554
797
  value: elem
555
798
  }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
@@ -607,129 +850,15 @@ class TtscGraphSession {
607
850
  expected: "string",
608
851
  value: input.message
609
852
  }, _errorFactory));
610
- const _ao9 = (input, _path, _exceptionable = true) => ("string" === typeof input.id || _assertGuard_1._assertGuard(_exceptionable, {
611
- method: "typia.assert",
612
- path: _path + ".id",
613
- expected: "string",
614
- value: input.id
615
- }, _errorFactory)) && (true === _av0.has(input.kind) || _assertGuard_1._assertGuard(_exceptionable, {
616
- method: "typia.assert",
617
- path: _path + ".kind",
618
- expected: _ae0,
619
- value: input.kind
620
- }, _errorFactory)) && _ap2(input, _path, true && _exceptionable) && (undefined === input.qualifiedName || "string" === typeof input.qualifiedName || _assertGuard_1._assertGuard(_exceptionable, {
621
- method: "typia.assert",
622
- path: _path + ".qualifiedName",
623
- expected: "(string | undefined)",
624
- value: input.qualifiedName
625
- }, _errorFactory)) && _ap1(input, _path, true && _exceptionable) && ("boolean" === typeof input.external || _assertGuard_1._assertGuard(_exceptionable, {
626
- method: "typia.assert",
627
- path: _path + ".external",
628
- expected: "boolean",
629
- value: input.external
630
- }, _errorFactory)) && (undefined === input.ignored || "boolean" === typeof input.ignored || _assertGuard_1._assertGuard(_exceptionable, {
631
- method: "typia.assert",
632
- path: _path + ".ignored",
633
- expected: "(boolean | undefined)",
634
- value: input.ignored
635
- }, _errorFactory)) && (undefined === input.exported || "boolean" === typeof input.exported || _assertGuard_1._assertGuard(_exceptionable, {
636
- method: "typia.assert",
637
- path: _path + ".exported",
638
- expected: "(boolean | undefined)",
639
- value: input.exported
640
- }, _errorFactory)) && (undefined === input.closure || "boolean" === typeof input.closure || _assertGuard_1._assertGuard(_exceptionable, {
641
- method: "typia.assert",
642
- path: _path + ".closure",
643
- expected: "(boolean | undefined)",
644
- value: input.closure
645
- }, _errorFactory)) && (undefined === input.modifiers || (Array.isArray(input.modifiers) || _assertGuard_1._assertGuard(_exceptionable, {
646
- method: "typia.assert",
647
- path: _path + ".modifiers",
648
- expected: "(Array<TtscGraphNodeModifier> | undefined)",
649
- value: input.modifiers
650
- }, _errorFactory)) && input.modifiers.every((elem, _index20) => true === _av1.has(elem) || _assertGuard_1._assertGuard(_exceptionable, {
651
- method: "typia.assert",
652
- path: _path + ".modifiers[" + _index20 + "]",
653
- expected: _ae1,
654
- value: elem
655
- }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
656
- method: "typia.assert",
657
- path: _path + ".modifiers",
658
- expected: "(Array<TtscGraphNodeModifier> | undefined)",
659
- value: input.modifiers
660
- }, _errorFactory)) && (undefined === input.literals || (Array.isArray(input.literals) || _assertGuard_1._assertGuard(_exceptionable, {
661
- method: "typia.assert",
662
- path: _path + ".literals",
663
- expected: "(Array<string> | undefined)",
664
- value: input.literals
665
- }, _errorFactory)) && input.literals.every((elem, _index21) => "string" === typeof elem || _assertGuard_1._assertGuard(_exceptionable, {
666
- method: "typia.assert",
667
- path: _path + ".literals[" + _index21 + "]",
668
- expected: "string",
669
- value: elem
670
- }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
671
- method: "typia.assert",
672
- path: _path + ".literals",
673
- expected: "(Array<string> | undefined)",
674
- value: input.literals
675
- }, _errorFactory)) && (undefined === input.enumMembers || (Array.isArray(input.enumMembers) || _assertGuard_1._assertGuard(_exceptionable, {
676
- method: "typia.assert",
677
- path: _path + ".enumMembers",
678
- expected: "(Array<ITtscGraphNode.IEnumMember> | undefined)",
679
- value: input.enumMembers
680
- }, _errorFactory)) && input.enumMembers.every((elem, _index22) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
681
- method: "typia.assert",
682
- path: _path + ".enumMembers[" + _index22 + "]",
683
- expected: "ITtscGraphNode.IEnumMember",
684
- value: elem
685
- }, _errorFactory)) && _ao10(elem, _path + ".enumMembers[" + _index22 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
686
- method: "typia.assert",
687
- path: _path + ".enumMembers[" + _index22 + "]",
688
- expected: "ITtscGraphNode.IEnumMember",
689
- value: elem
690
- }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
691
- method: "typia.assert",
692
- path: _path + ".enumMembers",
693
- expected: "(Array<ITtscGraphNode.IEnumMember> | undefined)",
694
- value: input.enumMembers
695
- }, _errorFactory)) && (undefined === input.decorators || (Array.isArray(input.decorators) || _assertGuard_1._assertGuard(_exceptionable, {
696
- method: "typia.assert",
697
- path: _path + ".decorators",
698
- expected: "(Array<ITtscGraphDecorator> | undefined)",
699
- value: input.decorators
700
- }, _errorFactory)) && input.decorators.every((elem, _index23) => ("object" === typeof elem && null !== elem || _assertGuard_1._assertGuard(_exceptionable, {
701
- method: "typia.assert",
702
- path: _path + ".decorators[" + _index23 + "]",
703
- expected: "ITtscGraphDecorator",
704
- value: elem
705
- }, _errorFactory)) && _ao11(elem, _path + ".decorators[" + _index23 + "]", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
706
- method: "typia.assert",
707
- path: _path + ".decorators[" + _index23 + "]",
708
- expected: "ITtscGraphDecorator",
709
- value: elem
710
- }, _errorFactory)) || _assertGuard_1._assertGuard(_exceptionable, {
711
- method: "typia.assert",
712
- path: _path + ".decorators",
713
- expected: "(Array<ITtscGraphDecorator> | undefined)",
714
- value: input.decorators
715
- }, _errorFactory)) && _ap3(input, _path, true && _exceptionable) && (undefined === input.implementation || ("object" === typeof input.implementation && null !== input.implementation || _assertGuard_1._assertGuard(_exceptionable, {
716
- method: "typia.assert",
717
- path: _path + ".implementation",
718
- expected: "(ITtscGraphSpan | undefined)",
719
- value: input.implementation
720
- }, _errorFactory)) && _ao13(input.implementation, _path + ".implementation", true && _exceptionable) || _assertGuard_1._assertGuard(_exceptionable, {
721
- method: "typia.assert",
722
- path: _path + ".implementation",
723
- expected: "(ITtscGraphSpan | undefined)",
724
- value: input.implementation
725
- }, _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);
726
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);
727
- 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 && _io14(elem)));
728
- const _io10 = input => _ip2(input) && (undefined === input.value || "string" === typeof input.value);
729
- const _io11 = input => _ip2(input) && (Array.isArray(input.arguments) && input.arguments.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && _io12(elem)));
730
- const _io12 = input => undefined === input.literal || "string" === typeof input.literal || "number" === typeof input.literal || "boolean" === typeof input.literal;
731
- const _io13 = 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);
732
- const _io14 = 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);
733
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)));
734
863
  const _io3 = input => "string" === typeof input.tool && "string" === typeof input.version && "string" === typeof input.typescript;
735
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)));
@@ -737,7 +866,7 @@ class TtscGraphSession {
737
866
  const _io6 = input => "string" === typeof input.config && _ip1(input);
738
867
  const _io7 = input => _ip1(input) && "string" === typeof input.checkerDigest && "string" === typeof input.diskDigest;
739
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;
740
- 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.literals || Array.isArray(input.literals) && input.literals.every(elem => "string" === typeof elem)) && (undefined === input.enumMembers || Array.isArray(input.enumMembers) && input.enumMembers.every(elem => "object" === typeof elem && null !== elem && _io10(elem))) && (undefined === input.decorators || Array.isArray(input.decorators) && input.decorators.every(elem => "object" === typeof elem && null !== elem && _io11(elem))) && _ip3(input) && (undefined === input.implementation || "object" === typeof input.implementation && null !== input.implementation && _io13(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);
741
870
  const __is = input => "object" === typeof input && null !== input && _io0(input);
742
871
  let _errorFactory;
743
872
  return (input, errorFactory) => {
@@ -760,7 +889,7 @@ class TtscGraphSession {
760
889
  })()(parsed);
761
890
  }
762
891
  catch (error) {
763
- 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}`));
764
893
  return;
765
894
  }
766
895
  // The envelope's version is not the body's, and only the envelope has been
@@ -775,29 +904,92 @@ class TtscGraphSession {
775
904
  response.dump.provenance.schemaVersion !== loadGraph_1.DUMP_SCHEMA_VERSION) {
776
905
  // Session-wide, for the same reason the protocol mismatch above is: it is
777
906
  // the wrong binary, not one bad frame.
778
- this.failPending(new Error(`@ttsc/graph: ttscgraph sends dump schema v${String(response.dump.provenance.schemaVersion)}, this client reads v${String(loadGraph_1.DUMP_SCHEMA_VERSION)}. ` +
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)}. ` +
779
908
  "Install a matching `ttsc` (the binary resolves from the target " +
780
909
  "project, or from TTSC_GRAPH_BINARY)."));
781
910
  return;
782
911
  }
783
912
  const pending = this.pending.get(response.id);
784
- if (pending === undefined)
913
+ if (pending === undefined || pending.child !== child)
785
914
  return;
786
- this.pending.delete(response.id);
787
- pending.resolve(response);
915
+ this.settlePending(response.id, pending, response);
788
916
  }
789
- failChild(child, error) {
790
- if (this.child === child)
791
- this.child = undefined;
792
- this.failPending(new Error(`@ttsc/graph: native session failed: ${error.message}`));
917
+ failChild(child, error, terminate = true) {
918
+ if (this.child !== child)
919
+ return;
920
+ this.child = undefined;
921
+ this.current = undefined;
922
+ child.lines.close();
923
+ this.failPending(error, child);
924
+ if (terminate)
925
+ terminateChild(child.process);
926
+ }
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
+ }
793
933
  }
794
- failPending(error) {
795
- for (const pending of this.pending.values())
796
- pending.reject(error);
797
- 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);
798
946
  }
799
947
  }
800
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
+ }
801
993
  function asError(error) {
802
994
  return error instanceof Error ? error : new Error(String(error));
803
995
  }