@ttsc/graph 0.18.2 → 0.18.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"startServer.js","sourceRoot":"","sources":["../../src/server/startServer.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAGjF,kDAA+C;AAC/C,iDAA8C;AAE9C;;;;GAIG;AACI,KAAK,sBAAsB,OAKjC;IACC,IAAI,KAAkC,CAAC;IACvC,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,GAAG,EAAE;QAC/B,KAAK,KAAK,IAAA,qBAAS,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
1
+ {"version":3,"file":"startServer.js","sourceRoot":"","sources":["../../src/server/startServer.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,gEAA6D;AAC7D,iDAA8C;AAE9C;;;;;GAKG;AACI,KAAK,sBAAsB,OAKjC;IACC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC;IACrD,IAAI,OAAqC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,KAAK,IAAI,EAAE;QACrC,OAAO,KAAK,IAAI,mCAAgB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpD,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5C,SAAS,CAAC,OAAO,GAAG,YAAY,CAAC;IACjC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACxC,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -9,14 +9,16 @@ import { ITtscGraphTrace } from "./ITtscGraphTrace";
9
9
  * ## What This MCP Is
10
10
  *
11
11
  * `inspect_typescript_graph` returns a compiler-built TypeScript graph contract
12
- * for the current source snapshot.
12
+ * for the current on-disk source snapshot. Before every non-escape call, the
13
+ * server checks project configs, root files, module-resolution inputs, and all
14
+ * resident source contents, then incrementally refreshes or safely reloads.
13
15
  *
14
16
  * Use it for architecture, runtime flow, APIs, callers/callees, code tours, and
15
17
  * type relations. It returns answer-ready index evidence: names, edges,
16
18
  * signatures, decorators, tests, spans, and anchors.
17
19
  *
18
- * Until TS source is edited, returned graph facts are sacred, infallible
19
- * compiler truth. Never verify them with files or more graph calls.
20
+ * Returned graph facts are sacred, infallible compiler truth for the snapshot
21
+ * synchronized by that call. Never verify them with files or more graph calls.
20
22
  *
21
23
  * ## Result Contract
22
24
  *
@@ -32,15 +34,17 @@ import { ITtscGraphTrace } from "./ITtscGraphTrace";
32
34
  * - Read files only for exact source body text, configs, docs, generated output,
33
35
  * exact text search, non-TypeScript files, or facts the graph marks outside
34
36
  * itself. A returned span is a citation anchor, not a reading command.
35
- * - After editing TypeScript source, the old graph no longer governs changed
36
- * code. Rebuild/reload the graph or verify changed code normally.
37
+ * - After editing TypeScript source, facts from an earlier call no longer govern
38
+ * changed code. Make a new graph call when graph evidence is still the right
39
+ * source; that call synchronizes the edit before answering.
37
40
  *
38
41
  * ## Sacred Contract
39
42
  *
40
- * Before source edits, returned graph facts are inviolable and errorless. Never
41
- * use extra graph calls, repository search, or file reads to doubt, fact-check,
42
- * humanize, re-derive, re-narrate, or re-confirm returned nodes, spans, edges,
43
- * signatures, decorators, tests, references, steps, or anchors.
43
+ * For the source snapshot synchronized by a call, returned graph facts are
44
+ * inviolable and errorless. Never use extra graph calls, repository search, or
45
+ * file reads to doubt, fact-check, humanize, re-derive, re-narrate, or
46
+ * re-confirm returned nodes, spans, edges, signatures, decorators, tests,
47
+ * references, steps, or anchors.
44
48
  *
45
49
  * ## Tour Contract
46
50
  *
@@ -101,13 +105,13 @@ export interface ITtscGraphApplication {
101
105
  *
102
106
  * Returned nodes, edges, signatures, spans, tests, anchors, and `next` are
103
107
  * the answer surface. If `next.action` is `answer`, stop tool use and answer
104
- * from that result. Before source edits, graph facts are sacred, inviolable,
105
- * complete, and infallible.
108
+ * from that result. Graph facts are sacred, inviolable, complete, and
109
+ * infallible for the source snapshot synchronized by this call.
106
110
  *
107
111
  * @param props Reasoning plus one graph request
108
112
  * @returns Matching `result` union member
109
113
  */
110
- inspect_typescript_graph(props: ITtscGraphApplication.IProps): ITtscGraphApplication.IResult;
114
+ inspect_typescript_graph(props: ITtscGraphApplication.IProps): Promise<ITtscGraphApplication.IResult>;
111
115
  }
112
116
  export declare namespace ITtscGraphApplication {
113
117
  /** Draft, review, then submit exactly one graph request or escape. */
@@ -6,9 +6,10 @@ import { ITtscGraphNode } from "./ITtscGraphNode";
6
6
  * wire contract between the Go fact-builder and the TypeScript graph engine.
7
7
  *
8
8
  * It is the complete graph with none of the per-response caps the MCP tools
9
- * apply: every node and edge the build resolved. The server parses it once at
10
- * startup (typia-validated) into an in-memory resident graph and answers every
11
- * tool call from that warm model; the bundled 3D viewer reduces the same dump.
9
+ * apply: every node and edge the build resolved. The server parses each changed
10
+ * native snapshot (typia-validated) into an in-memory resident graph and reuses
11
+ * that warm model while project inputs stay unchanged; the bundled 3D viewer
12
+ * reduces the same dump.
12
13
  *
13
14
  * Paths in `project` and `tsconfig` are absolute; `file` fields on nodes,
14
15
  * edges, and diagnostics are project-relative.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/graph",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
4
4
  "description": "Checker-resolved architecture graph over MCP for coding agents, backed by ttsc's in-process TypeScript-Go compiler.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "three": "^0.184.0",
40
40
  "three-forcegraph": "^1.43.4",
41
41
  "typescript": "^7.0.2",
42
- "ttsc": "0.18.2"
42
+ "ttsc": "0.18.4"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",
@@ -9,7 +9,9 @@ import { runTrace } from "./server/runTrace";
9
9
  import { ITtscGraphApplication } from "./structures/ITtscGraphApplication";
10
10
  import { ITtscGraphEscape } from "./structures/ITtscGraphEscape";
11
11
 
12
- export type TtscGraphSource = TtscGraphMemory | (() => TtscGraphMemory);
12
+ export type TtscGraphSource =
13
+ | TtscGraphMemory
14
+ | (() => TtscGraphMemory | Promise<TtscGraphMemory>);
13
15
 
14
16
  /**
15
17
  * The MCP tool surface as a plain class over the resident
@@ -22,20 +24,21 @@ export type TtscGraphSource = TtscGraphMemory | (() => TtscGraphMemory);
22
24
  * The method delegates to the pure graph functions in `./server`, which are
23
25
  * unit-testable without a transport; this class only binds them to the graph.
24
26
  *
25
- * Every method answers from the resident graph; none recompiles. Output is kept
27
+ * Every method answers from the current resident graph. The source may refresh
28
+ * that graph before the operation when project files changed. Output is kept
26
29
  * compact and bounded so a model can read structure without a file read, which
27
30
  * is the token win the redesign exists for.
28
31
  */
29
32
  export class TtscGraphApplication implements ITtscGraphApplication {
30
- private readonly graph: () => TtscGraphMemory;
33
+ private readonly graph: () => TtscGraphMemory | Promise<TtscGraphMemory>;
31
34
 
32
35
  public constructor(source: TtscGraphSource) {
33
36
  this.graph = typeof source === "function" ? source : () => source;
34
37
  }
35
38
 
36
- public inspect_typescript_graph(
39
+ public async inspect_typescript_graph(
37
40
  props: ITtscGraphApplication.IProps,
38
- ): ITtscGraphApplication.IResult {
41
+ ): Promise<ITtscGraphApplication.IResult> {
39
42
  if (props.request.type === "escape") {
40
43
  const result = this.escape(props.request.reason);
41
44
  if (props.request.nextStep !== undefined) {
@@ -45,30 +48,31 @@ export class TtscGraphApplication implements ITtscGraphApplication {
45
48
  result,
46
49
  };
47
50
  }
51
+ const graph = await this.graph();
48
52
  switch (props.request.type) {
49
53
  case "entrypoints":
50
54
  return {
51
- result: runEntrypoints(this.graph(), props.request),
55
+ result: runEntrypoints(graph, props.request),
52
56
  };
53
57
  case "lookup":
54
58
  return {
55
- result: runLookup(this.graph(), props.request),
59
+ result: runLookup(graph, props.request),
56
60
  };
57
61
  case "trace":
58
62
  return {
59
- result: runTrace(this.graph(), props.request),
63
+ result: runTrace(graph, props.request),
60
64
  };
61
65
  case "details":
62
66
  return {
63
- result: runDetails(this.graph(), props.request),
67
+ result: runDetails(graph, props.request),
64
68
  };
65
69
  case "overview":
66
70
  return {
67
- result: runOverview(this.graph(), props.request),
71
+ result: runOverview(graph, props.request),
68
72
  };
69
73
  case "tour":
70
74
  return {
71
- result: runTour(this.graph(), props.request),
75
+ result: runTour(graph, props.request),
72
76
  };
73
77
  default:
74
78
  props.request satisfies never;
package/src/index.ts CHANGED
@@ -38,10 +38,10 @@ function parseProjectArgs(argv: readonly string[]): {
38
38
  * - `view`: JS-orchestrated 3D viewer (dump -> reduce -> serve -> open).
39
39
  * - `dump`: pass through to the native `ttscgraph dump`, which prints the whole
40
40
  * graph as JSON for piping or the viewer.
41
- * - Default: serve the MCP graph over stdio. The TypeScript server runs
42
- * `ttscgraph dump` once to build the resident graph, then answers tool calls
43
- * from memory; the agent's MCP client speaks JSON-RPC over this process's
44
- * stdin/stdout. The process stays alive on the stdio transport.
41
+ * - Default: serve the MCP graph over stdio. The TypeScript server keeps a native
42
+ * incremental compiler session resident, checks the disk snapshot before each
43
+ * graph operation, and reuses the in-memory graph when unchanged; the agent's
44
+ * MCP client speaks JSON-RPC over this process's stdin/stdout.
45
45
  */
46
46
  export function runGraph(
47
47
  argv: readonly string[] = process.argv.slice(2),
@@ -0,0 +1,200 @@
1
+ import { ChildProcessWithoutNullStreams, spawn } from "node:child_process";
2
+ import readline from "node:readline";
3
+ import typia from "typia";
4
+
5
+ import { ensureExecutable } from "../nativeExecutable";
6
+ import { resolveGraphBinary } from "../resolveGraphBinary";
7
+ import { ITtscGraphDump } from "../structures/ITtscGraphDump";
8
+ import { TtscGraphMemory } from "./TtscGraphMemory";
9
+
10
+ interface SessionResponse {
11
+ id: number;
12
+ changed: boolean;
13
+ mode?: "initial" | "unchanged" | "incremental" | "rebuild" | "reload";
14
+ dump?: unknown;
15
+ error?: string;
16
+ }
17
+
18
+ interface Pending {
19
+ resolve: (response: SessionResponse) => void;
20
+ reject: (error: Error) => void;
21
+ }
22
+
23
+ /**
24
+ * Resident bridge to `ttscgraph serve`.
25
+ *
26
+ * Every graph request first asks the native session for the current disk
27
+ * snapshot. Unchanged requests reuse the existing {@link TtscGraphMemory}; an
28
+ * edited source reuses tsgo's resident Program through `driver.Session`, while
29
+ * config and root-file-set changes force a safe full reload.
30
+ */
31
+ export class TtscGraphSession {
32
+ private readonly cwd: string;
33
+ private readonly tsconfig: string;
34
+ private readonly binary: string;
35
+ private child: ChildProcessWithoutNullStreams | undefined;
36
+ private stderr = "";
37
+ private nextId = 0;
38
+ private readonly pending = new Map<number, Pending>();
39
+ private queue: Promise<void> = Promise.resolve();
40
+ private current: TtscGraphMemory | undefined;
41
+ private closed = false;
42
+
43
+ public constructor(options: {
44
+ cwd: string;
45
+ tsconfig: string;
46
+ binary?: string;
47
+ }) {
48
+ const binary = options.binary ?? resolveGraphBinary();
49
+ if (binary === null) {
50
+ throw new Error(
51
+ "@ttsc/graph: could not resolve the ttscgraph binary. " +
52
+ "Install `ttsc` so its platform package is present, " +
53
+ "or set TTSC_GRAPH_BINARY to an absolute path.",
54
+ );
55
+ }
56
+ ensureExecutable(binary);
57
+ this.cwd = options.cwd;
58
+ this.tsconfig = options.tsconfig;
59
+ this.binary = binary;
60
+ }
61
+
62
+ /** Return a graph for the current disk snapshot, serialized per tool call. */
63
+ public graph(): Promise<TtscGraphMemory> {
64
+ let resolve!: (graph: TtscGraphMemory) => void;
65
+ let reject!: (error: Error) => void;
66
+ const result = new Promise<TtscGraphMemory>((res, rej) => {
67
+ resolve = res;
68
+ reject = rej;
69
+ });
70
+ this.queue = this.queue
71
+ .catch(() => undefined)
72
+ .then(async () => {
73
+ try {
74
+ resolve(await this.refresh());
75
+ } catch (error) {
76
+ reject(asError(error));
77
+ }
78
+ });
79
+ return result;
80
+ }
81
+
82
+ /** Close the native session. Safe to call more than once. */
83
+ public close(): void {
84
+ this.closed = true;
85
+ const child = this.child;
86
+ this.child = undefined;
87
+ if (child !== undefined && !child.killed) child.stdin.end();
88
+ this.failPending(new Error("@ttsc/graph: native session closed"));
89
+ }
90
+
91
+ private async refresh(): Promise<TtscGraphMemory> {
92
+ const response = await this.request();
93
+ if (response.error !== undefined) {
94
+ throw new Error(`@ttsc/graph: ${response.error}`);
95
+ }
96
+ if (response.changed) {
97
+ if (response.dump === undefined) {
98
+ throw new Error(
99
+ `@ttsc/graph: native ${response.mode ?? "changed"} response omitted its dump`,
100
+ );
101
+ }
102
+ const dump = typia.assert<ITtscGraphDump>(response.dump);
103
+ this.current = TtscGraphMemory.from(dump);
104
+ }
105
+ if (this.current === undefined) {
106
+ throw new Error(
107
+ "@ttsc/graph: native session returned no initial graph snapshot",
108
+ );
109
+ }
110
+ return this.current;
111
+ }
112
+
113
+ private request(): Promise<SessionResponse> {
114
+ const child = this.ensureChild();
115
+ const id = ++this.nextId;
116
+ return new Promise<SessionResponse>((resolve, reject) => {
117
+ this.pending.set(id, { resolve, reject });
118
+ child.stdin.write(`${JSON.stringify({ id })}\n`, (error) => {
119
+ if (error === null || error === undefined) return;
120
+ this.pending.delete(id);
121
+ reject(
122
+ new Error(
123
+ `@ttsc/graph: could not request native snapshot: ${error.message}`,
124
+ ),
125
+ );
126
+ });
127
+ });
128
+ }
129
+
130
+ private ensureChild(): ChildProcessWithoutNullStreams {
131
+ if (this.closed) {
132
+ // A request queued behind the close must not respawn the native
133
+ // process; an orphaned resident compiler would outlive the MCP server.
134
+ throw new Error("@ttsc/graph: native session is closed");
135
+ }
136
+ if (this.child !== undefined && this.child.exitCode === null) {
137
+ return this.child;
138
+ }
139
+ this.stderr = "";
140
+ const child = spawn(
141
+ this.binary,
142
+ ["serve", "--cwd", this.cwd, "--tsconfig", this.tsconfig],
143
+ { stdio: ["pipe", "pipe", "pipe"], windowsHide: true },
144
+ );
145
+ this.child = child;
146
+ child.stderr.setEncoding("utf8");
147
+ child.stderr.on("data", (chunk: string) => {
148
+ this.stderr = (this.stderr + chunk).slice(-64 * 1024);
149
+ });
150
+ const lines = readline.createInterface({ input: child.stdout });
151
+ lines.on("line", (line) => this.onLine(line));
152
+ child.on("error", (error) => this.failChild(child, error));
153
+ child.on("exit", (code, signal) => {
154
+ if (this.child !== child) return;
155
+ this.child = undefined;
156
+ this.failPending(
157
+ new Error(
158
+ `@ttsc/graph: native session exited (code=${String(code)}, signal=${String(signal)})${
159
+ this.stderr.trim() === "" ? "" : `: ${this.stderr.trim()}`
160
+ }`,
161
+ ),
162
+ );
163
+ });
164
+ return child;
165
+ }
166
+
167
+ private onLine(line: string): void {
168
+ let response: SessionResponse;
169
+ try {
170
+ response = JSON.parse(line) as SessionResponse;
171
+ } catch (error) {
172
+ this.failPending(
173
+ new Error(
174
+ `@ttsc/graph: native session returned invalid JSON: ${asError(error).message}`,
175
+ ),
176
+ );
177
+ return;
178
+ }
179
+ const pending = this.pending.get(response.id);
180
+ if (pending === undefined) return;
181
+ this.pending.delete(response.id);
182
+ pending.resolve(response);
183
+ }
184
+
185
+ private failChild(child: ChildProcessWithoutNullStreams, error: Error): void {
186
+ if (this.child === child) this.child = undefined;
187
+ this.failPending(
188
+ new Error(`@ttsc/graph: native session failed: ${error.message}`),
189
+ );
190
+ }
191
+
192
+ private failPending(error: Error): void {
193
+ for (const pending of this.pending.values()) pending.reject(error);
194
+ this.pending.clear();
195
+ }
196
+ }
197
+
198
+ function asError(error: unknown): Error {
199
+ return error instanceof Error ? error : new Error(String(error));
200
+ }
@@ -13,9 +13,9 @@ const MAX_DUMP_BYTES = 1024 * 1024 * 1024;
13
13
 
14
14
  /**
15
15
  * Build the resident {@link TtscGraphMemory} for a project by running `ttscgraph
16
- * dump` once and loading its JSON. This is the cold path behind the MCP tool
17
- * calls: one type-check in Go produces the checker-resolved fact graph, then
18
- * every later tool call is answered from the in-memory model.
16
+ * dump` once and loading its JSON. This is the one-shot path for direct callers
17
+ * and the viewer. The MCP server uses `TtscGraphSession` instead so source
18
+ * edits refresh a resident compiler session.
19
19
  *
20
20
  * Throws when the binary cannot be resolved, the dump command fails, or its
21
21
  * output is not a readable graph — the server surfaces the failure rather than
@@ -1,13 +1,13 @@
1
1
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
2
 
3
- import { TtscGraphMemory } from "../model/TtscGraphMemory";
4
- import { loadGraph } from "../model/loadGraph";
3
+ import { TtscGraphSession } from "../model/TtscGraphSession";
5
4
  import { createServer } from "./createServer";
6
5
 
7
6
  /**
8
7
  * Serve the graph tools over MCP on stdio. The server answers the MCP handshake
9
- * immediately and builds the resident graph on the first tool call, so a large
10
- * project cannot make the client give up before tools are advertised.
8
+ * immediately and opens the resident incremental graph session on the first
9
+ * real tool call, so a large project cannot make the client give up before
10
+ * tools are advertised and an escape request still performs no graph work.
11
11
  */
12
12
  export async function startServer(options: {
13
13
  cwd?: string;
@@ -15,11 +15,16 @@ export async function startServer(options: {
15
15
  /** Server version reported in the MCP handshake. */
16
16
  version: string;
17
17
  }): Promise<void> {
18
- let graph: TtscGraphMemory | undefined;
19
- const server = createServer(() => {
20
- graph ??= loadGraph({ cwd: options.cwd, tsconfig: options.tsconfig });
21
- return graph;
18
+ const cwd = options.cwd ?? process.cwd();
19
+ const tsconfig = options.tsconfig ?? "tsconfig.json";
20
+ let session: TtscGraphSession | undefined;
21
+ const server = createServer(async () => {
22
+ session ??= new TtscGraphSession({ cwd, tsconfig });
23
+ return session.graph();
22
24
  }, options.version);
23
25
  const transport = new StdioServerTransport();
26
+ const closeSession = () => session?.close();
27
+ transport.onclose = closeSession;
28
+ process.stdin.once("end", closeSession);
24
29
  await server.connect(transport);
25
30
  }
@@ -10,14 +10,16 @@ import { ITtscGraphTrace } from "./ITtscGraphTrace";
10
10
  * ## What This MCP Is
11
11
  *
12
12
  * `inspect_typescript_graph` returns a compiler-built TypeScript graph contract
13
- * for the current source snapshot.
13
+ * for the current on-disk source snapshot. Before every non-escape call, the
14
+ * server checks project configs, root files, module-resolution inputs, and all
15
+ * resident source contents, then incrementally refreshes or safely reloads.
14
16
  *
15
17
  * Use it for architecture, runtime flow, APIs, callers/callees, code tours, and
16
18
  * type relations. It returns answer-ready index evidence: names, edges,
17
19
  * signatures, decorators, tests, spans, and anchors.
18
20
  *
19
- * Until TS source is edited, returned graph facts are sacred, infallible
20
- * compiler truth. Never verify them with files or more graph calls.
21
+ * Returned graph facts are sacred, infallible compiler truth for the snapshot
22
+ * synchronized by that call. Never verify them with files or more graph calls.
21
23
  *
22
24
  * ## Result Contract
23
25
  *
@@ -33,15 +35,17 @@ import { ITtscGraphTrace } from "./ITtscGraphTrace";
33
35
  * - Read files only for exact source body text, configs, docs, generated output,
34
36
  * exact text search, non-TypeScript files, or facts the graph marks outside
35
37
  * itself. A returned span is a citation anchor, not a reading command.
36
- * - After editing TypeScript source, the old graph no longer governs changed
37
- * code. Rebuild/reload the graph or verify changed code normally.
38
+ * - After editing TypeScript source, facts from an earlier call no longer govern
39
+ * changed code. Make a new graph call when graph evidence is still the right
40
+ * source; that call synchronizes the edit before answering.
38
41
  *
39
42
  * ## Sacred Contract
40
43
  *
41
- * Before source edits, returned graph facts are inviolable and errorless. Never
42
- * use extra graph calls, repository search, or file reads to doubt, fact-check,
43
- * humanize, re-derive, re-narrate, or re-confirm returned nodes, spans, edges,
44
- * signatures, decorators, tests, references, steps, or anchors.
44
+ * For the source snapshot synchronized by a call, returned graph facts are
45
+ * inviolable and errorless. Never use extra graph calls, repository search, or
46
+ * file reads to doubt, fact-check, humanize, re-derive, re-narrate, or
47
+ * re-confirm returned nodes, spans, edges, signatures, decorators, tests,
48
+ * references, steps, or anchors.
45
49
  *
46
50
  * ## Tour Contract
47
51
  *
@@ -102,15 +106,15 @@ export interface ITtscGraphApplication {
102
106
  *
103
107
  * Returned nodes, edges, signatures, spans, tests, anchors, and `next` are
104
108
  * the answer surface. If `next.action` is `answer`, stop tool use and answer
105
- * from that result. Before source edits, graph facts are sacred, inviolable,
106
- * complete, and infallible.
109
+ * from that result. Graph facts are sacred, inviolable, complete, and
110
+ * infallible for the source snapshot synchronized by this call.
107
111
  *
108
112
  * @param props Reasoning plus one graph request
109
113
  * @returns Matching `result` union member
110
114
  */
111
115
  inspect_typescript_graph(
112
116
  props: ITtscGraphApplication.IProps,
113
- ): ITtscGraphApplication.IResult;
117
+ ): Promise<ITtscGraphApplication.IResult>;
114
118
  }
115
119
 
116
120
  export namespace ITtscGraphApplication {
@@ -7,9 +7,10 @@ import { ITtscGraphNode } from "./ITtscGraphNode";
7
7
  * wire contract between the Go fact-builder and the TypeScript graph engine.
8
8
  *
9
9
  * It is the complete graph with none of the per-response caps the MCP tools
10
- * apply: every node and edge the build resolved. The server parses it once at
11
- * startup (typia-validated) into an in-memory resident graph and answers every
12
- * tool call from that warm model; the bundled 3D viewer reduces the same dump.
10
+ * apply: every node and edge the build resolved. The server parses each changed
11
+ * native snapshot (typia-validated) into an in-memory resident graph and reuses
12
+ * that warm model while project inputs stay unchanged; the bundled 3D viewer
13
+ * reduces the same dump.
13
14
  *
14
15
  * Paths in `project` and `tsconfig` are absolute; `file` fields on nodes,
15
16
  * edges, and diagnostics are project-relative.