@mka-rainmaker/ama 0.1.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 (211) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -0
  3. package/dist/analyzers/baseline/analyzer.d.ts +47 -0
  4. package/dist/analyzers/baseline/analyzer.d.ts.map +1 -0
  5. package/dist/analyzers/baseline/analyzer.js +84 -0
  6. package/dist/analyzers/baseline/analyzer.js.map +1 -0
  7. package/dist/analyzers/baseline/c.d.ts +12 -0
  8. package/dist/analyzers/baseline/c.d.ts.map +1 -0
  9. package/dist/analyzers/baseline/c.js +56 -0
  10. package/dist/analyzers/baseline/c.js.map +1 -0
  11. package/dist/analyzers/baseline/config.d.ts +21 -0
  12. package/dist/analyzers/baseline/config.d.ts.map +1 -0
  13. package/dist/analyzers/baseline/config.js +32 -0
  14. package/dist/analyzers/baseline/config.js.map +1 -0
  15. package/dist/analyzers/baseline/csharp.d.ts +9 -0
  16. package/dist/analyzers/baseline/csharp.d.ts.map +1 -0
  17. package/dist/analyzers/baseline/csharp.js +107 -0
  18. package/dist/analyzers/baseline/csharp.js.map +1 -0
  19. package/dist/analyzers/baseline/go.d.ts +11 -0
  20. package/dist/analyzers/baseline/go.d.ts.map +1 -0
  21. package/dist/analyzers/baseline/go.js +66 -0
  22. package/dist/analyzers/baseline/go.js.map +1 -0
  23. package/dist/analyzers/baseline/java.d.ts +9 -0
  24. package/dist/analyzers/baseline/java.d.ts.map +1 -0
  25. package/dist/analyzers/baseline/java.js +50 -0
  26. package/dist/analyzers/baseline/java.js.map +1 -0
  27. package/dist/analyzers/baseline/javascript.d.ts +10 -0
  28. package/dist/analyzers/baseline/javascript.d.ts.map +1 -0
  29. package/dist/analyzers/baseline/javascript.js +55 -0
  30. package/dist/analyzers/baseline/javascript.js.map +1 -0
  31. package/dist/analyzers/baseline/kotlin.d.ts +11 -0
  32. package/dist/analyzers/baseline/kotlin.d.ts.map +1 -0
  33. package/dist/analyzers/baseline/kotlin.js +67 -0
  34. package/dist/analyzers/baseline/kotlin.js.map +1 -0
  35. package/dist/analyzers/baseline/paths.d.ts +6 -0
  36. package/dist/analyzers/baseline/paths.d.ts.map +1 -0
  37. package/dist/analyzers/baseline/paths.js +17 -0
  38. package/dist/analyzers/baseline/paths.js.map +1 -0
  39. package/dist/analyzers/baseline/php.d.ts +11 -0
  40. package/dist/analyzers/baseline/php.d.ts.map +1 -0
  41. package/dist/analyzers/baseline/php.js +76 -0
  42. package/dist/analyzers/baseline/php.js.map +1 -0
  43. package/dist/analyzers/baseline/python.d.ts +10 -0
  44. package/dist/analyzers/baseline/python.d.ts.map +1 -0
  45. package/dist/analyzers/baseline/python.js +63 -0
  46. package/dist/analyzers/baseline/python.js.map +1 -0
  47. package/dist/analyzers/baseline/rust.d.ts +10 -0
  48. package/dist/analyzers/baseline/rust.d.ts.map +1 -0
  49. package/dist/analyzers/baseline/rust.js +45 -0
  50. package/dist/analyzers/baseline/rust.js.map +1 -0
  51. package/dist/analyzers/baseline/swift.d.ts +11 -0
  52. package/dist/analyzers/baseline/swift.d.ts.map +1 -0
  53. package/dist/analyzers/baseline/swift.js +19 -0
  54. package/dist/analyzers/baseline/swift.js.map +1 -0
  55. package/dist/analyzers/baseline/treesitter.d.ts +11 -0
  56. package/dist/analyzers/baseline/treesitter.d.ts.map +1 -0
  57. package/dist/analyzers/baseline/treesitter.js +87 -0
  58. package/dist/analyzers/baseline/treesitter.js.map +1 -0
  59. package/dist/analyzers/baseline/walk.d.ts +26 -0
  60. package/dist/analyzers/baseline/walk.d.ts.map +1 -0
  61. package/dist/analyzers/baseline/walk.js +76 -0
  62. package/dist/analyzers/baseline/walk.js.map +1 -0
  63. package/dist/analyzers/registry.d.ts +19 -0
  64. package/dist/analyzers/registry.d.ts.map +1 -0
  65. package/dist/analyzers/registry.js +43 -0
  66. package/dist/analyzers/registry.js.map +1 -0
  67. package/dist/analyzers/sfc/analyzer.d.ts +17 -0
  68. package/dist/analyzers/sfc/analyzer.d.ts.map +1 -0
  69. package/dist/analyzers/sfc/analyzer.js +141 -0
  70. package/dist/analyzers/sfc/analyzer.js.map +1 -0
  71. package/dist/analyzers/sidecar/analyzer.d.ts +29 -0
  72. package/dist/analyzers/sidecar/analyzer.d.ts.map +1 -0
  73. package/dist/analyzers/sidecar/analyzer.js +114 -0
  74. package/dist/analyzers/sidecar/analyzer.js.map +1 -0
  75. package/dist/analyzers/sidecar/protocol.d.ts +508 -0
  76. package/dist/analyzers/sidecar/protocol.d.ts.map +1 -0
  77. package/dist/analyzers/sidecar/protocol.js +102 -0
  78. package/dist/analyzers/sidecar/protocol.js.map +1 -0
  79. package/dist/analyzers/types.d.ts +46 -0
  80. package/dist/analyzers/types.d.ts.map +1 -0
  81. package/dist/analyzers/types.js +2 -0
  82. package/dist/analyzers/types.js.map +1 -0
  83. package/dist/analyzers/typescript/analyzer.d.ts +126 -0
  84. package/dist/analyzers/typescript/analyzer.d.ts.map +1 -0
  85. package/dist/analyzers/typescript/analyzer.js +1600 -0
  86. package/dist/analyzers/typescript/analyzer.js.map +1 -0
  87. package/dist/cli/commands/cycles.d.ts +6 -0
  88. package/dist/cli/commands/cycles.d.ts.map +1 -0
  89. package/dist/cli/commands/cycles.js +27 -0
  90. package/dist/cli/commands/cycles.js.map +1 -0
  91. package/dist/cli/commands/files.d.ts +6 -0
  92. package/dist/cli/commands/files.d.ts.map +1 -0
  93. package/dist/cli/commands/files.js +33 -0
  94. package/dist/cli/commands/files.js.map +1 -0
  95. package/dist/cli/commands/impact.d.ts +18 -0
  96. package/dist/cli/commands/impact.d.ts.map +1 -0
  97. package/dist/cli/commands/impact.js +113 -0
  98. package/dist/cli/commands/impact.js.map +1 -0
  99. package/dist/cli/commands/lifecycle.d.ts +5 -0
  100. package/dist/cli/commands/lifecycle.d.ts.map +1 -0
  101. package/dist/cli/commands/lifecycle.js +83 -0
  102. package/dist/cli/commands/lifecycle.js.map +1 -0
  103. package/dist/cli/commands/query.d.ts +31 -0
  104. package/dist/cli/commands/query.d.ts.map +1 -0
  105. package/dist/cli/commands/query.js +187 -0
  106. package/dist/cli/commands/query.js.map +1 -0
  107. package/dist/cli/commands/search.d.ts +21 -0
  108. package/dist/cli/commands/search.d.ts.map +1 -0
  109. package/dist/cli/commands/search.js +160 -0
  110. package/dist/cli/commands/search.js.map +1 -0
  111. package/dist/cli/commands/status.d.ts +6 -0
  112. package/dist/cli/commands/status.d.ts.map +1 -0
  113. package/dist/cli/commands/status.js +63 -0
  114. package/dist/cli/commands/status.js.map +1 -0
  115. package/dist/cli/commands/sync.d.ts +6 -0
  116. package/dist/cli/commands/sync.d.ts.map +1 -0
  117. package/dist/cli/commands/sync.js +57 -0
  118. package/dist/cli/commands/sync.js.map +1 -0
  119. package/dist/cli/emit.d.ts +9 -0
  120. package/dist/cli/emit.d.ts.map +1 -0
  121. package/dist/cli/emit.js +10 -0
  122. package/dist/cli/emit.js.map +1 -0
  123. package/dist/cli/index.d.ts +37 -0
  124. package/dist/cli/index.d.ts.map +1 -0
  125. package/dist/cli/index.js +128 -0
  126. package/dist/cli/index.js.map +1 -0
  127. package/dist/cli/paths.d.ts +7 -0
  128. package/dist/cli/paths.d.ts.map +1 -0
  129. package/dist/cli/paths.js +10 -0
  130. package/dist/cli/paths.js.map +1 -0
  131. package/dist/cli/query-runner.d.ts +13 -0
  132. package/dist/cli/query-runner.d.ts.map +1 -0
  133. package/dist/cli/query-runner.js +33 -0
  134. package/dist/cli/query-runner.js.map +1 -0
  135. package/dist/graph/dispatch.d.ts +17 -0
  136. package/dist/graph/dispatch.d.ts.map +1 -0
  137. package/dist/graph/dispatch.js +82 -0
  138. package/dist/graph/dispatch.js.map +1 -0
  139. package/dist/graph/id.d.ts +19 -0
  140. package/dist/graph/id.d.ts.map +1 -0
  141. package/dist/graph/id.js +17 -0
  142. package/dist/graph/id.js.map +1 -0
  143. package/dist/graph/index.d.ts +6 -0
  144. package/dist/graph/index.d.ts.map +1 -0
  145. package/dist/graph/index.js +4 -0
  146. package/dist/graph/index.js.map +1 -0
  147. package/dist/graph/types.d.ts +71 -0
  148. package/dist/graph/types.d.ts.map +1 -0
  149. package/dist/graph/types.js +52 -0
  150. package/dist/graph/types.js.map +1 -0
  151. package/dist/indexer/debouncer.d.ts +32 -0
  152. package/dist/indexer/debouncer.d.ts.map +1 -0
  153. package/dist/indexer/debouncer.js +81 -0
  154. package/dist/indexer/debouncer.js.map +1 -0
  155. package/dist/indexer/ignore.d.ts +55 -0
  156. package/dist/indexer/ignore.d.ts.map +1 -0
  157. package/dist/indexer/ignore.js +170 -0
  158. package/dist/indexer/ignore.js.map +1 -0
  159. package/dist/indexer/indexer.d.ts +112 -0
  160. package/dist/indexer/indexer.d.ts.map +1 -0
  161. package/dist/indexer/indexer.js +392 -0
  162. package/dist/indexer/indexer.js.map +1 -0
  163. package/dist/indexer/watcher.d.ts +50 -0
  164. package/dist/indexer/watcher.d.ts.map +1 -0
  165. package/dist/indexer/watcher.js +86 -0
  166. package/dist/indexer/watcher.js.map +1 -0
  167. package/dist/mcp/build-info.d.ts +16 -0
  168. package/dist/mcp/build-info.d.ts.map +1 -0
  169. package/dist/mcp/build-info.js +54 -0
  170. package/dist/mcp/build-info.js.map +1 -0
  171. package/dist/mcp/http.d.ts +18 -0
  172. package/dist/mcp/http.d.ts.map +1 -0
  173. package/dist/mcp/http.js +145 -0
  174. package/dist/mcp/http.js.map +1 -0
  175. package/dist/mcp/server.d.ts +22 -0
  176. package/dist/mcp/server.d.ts.map +1 -0
  177. package/dist/mcp/server.js +401 -0
  178. package/dist/mcp/server.js.map +1 -0
  179. package/dist/mcp/session.d.ts +155 -0
  180. package/dist/mcp/session.d.ts.map +1 -0
  181. package/dist/mcp/session.js +319 -0
  182. package/dist/mcp/session.js.map +1 -0
  183. package/dist/query/service.d.ts +329 -0
  184. package/dist/query/service.d.ts.map +1 -0
  185. package/dist/query/service.js +959 -0
  186. package/dist/query/service.js.map +1 -0
  187. package/dist/runtime/entrypoint.d.ts +11 -0
  188. package/dist/runtime/entrypoint.d.ts.map +1 -0
  189. package/dist/runtime/entrypoint.js +22 -0
  190. package/dist/runtime/entrypoint.js.map +1 -0
  191. package/dist/runtime/quiet-sqlite-warning.d.ts +14 -0
  192. package/dist/runtime/quiet-sqlite-warning.d.ts.map +1 -0
  193. package/dist/runtime/quiet-sqlite-warning.js +26 -0
  194. package/dist/runtime/quiet-sqlite-warning.js.map +1 -0
  195. package/dist/runtime/wasm-tier.d.ts +2 -0
  196. package/dist/runtime/wasm-tier.d.ts.map +1 -0
  197. package/dist/runtime/wasm-tier.js +54 -0
  198. package/dist/runtime/wasm-tier.js.map +1 -0
  199. package/dist/store/memory.d.ts +54 -0
  200. package/dist/store/memory.d.ts.map +1 -0
  201. package/dist/store/memory.js +210 -0
  202. package/dist/store/memory.js.map +1 -0
  203. package/dist/store/sqlite.d.ts +38 -0
  204. package/dist/store/sqlite.d.ts.map +1 -0
  205. package/dist/store/sqlite.js +298 -0
  206. package/dist/store/sqlite.js.map +1 -0
  207. package/dist/store/types.d.ts +76 -0
  208. package/dist/store/types.d.ts.map +1 -0
  209. package/dist/store/types.js +2 -0
  210. package/dist/store/types.js.map +1 -0
  211. package/package.json +59 -0
@@ -0,0 +1,329 @@
1
+ import type { EdgeKind, EdgeProvenance, GraphNode, NodeKind } from "../graph/index.js";
2
+ import type { FileMeta, Store } from "../store/types.js";
3
+ export interface SearchOptions {
4
+ /** Maximum number of hits to return (default 50). */
5
+ limit?: number;
6
+ /** Restrict to a single node kind. */
7
+ kind?: NodeKind;
8
+ }
9
+ /** A search plus a confidence signal (ama-b79). */
10
+ export interface SearchResult {
11
+ results: GraphNode[];
12
+ /** True when there are results but none is an exact or name-prefix match — the
13
+ * best is only a loose substring/qualified hit, so the caller should refine. */
14
+ lowConfidence: boolean;
15
+ }
16
+ export interface Snippet {
17
+ id: string;
18
+ file: string;
19
+ startLine: number;
20
+ endLine: number;
21
+ text: string;
22
+ }
23
+ /** A neighbour reached across one edge, carrying that edge's metadata: the
24
+ * call-site location (ama-hft.9) and provenance (ama-m8k.1). Returned by
25
+ * find_callers/find_callees so an agent sees not just who, but where. */
26
+ export interface EdgeNeighbor {
27
+ /** The symbol at the other end of the edge (the caller, or the callee). */
28
+ symbol: GraphNode;
29
+ /** Which edge kind connected them — e.g. `Calls` vs `Instantiates` (a `new X()`
30
+ * construction), so the two are separable in one result. (ama-hft.11) */
31
+ via: EdgeKind;
32
+ /** The call-site line/column, when the edge records one. */
33
+ at?: {
34
+ line: number;
35
+ column: number;
36
+ };
37
+ /** Every call site, when the caller invokes the target more than once
38
+ * (`sites[0] === at`). Absent for single-site edges. (ama-hft.10) */
39
+ sites?: {
40
+ line: number;
41
+ column: number;
42
+ }[];
43
+ /** How the edge was derived; absent ⇒ resolved. */
44
+ provenance?: EdgeProvenance;
45
+ }
46
+ /** Everything about one node in a single answer — the higher-order `node` query. */
47
+ export interface NodeView {
48
+ /** The resolved node itself (most-specific match for the ref). */
49
+ node: GraphNode;
50
+ /** Verbatim source, when the node has a known location. */
51
+ snippet?: Snippet;
52
+ /** Symbols this node defines, in source order — a class's methods/properties, an
53
+ * interface's members, a namespace's or file's symbols. Empty for a leaf, so a
54
+ * class is a complete structured outline without re-reading the snippet. (ama-as5) */
55
+ members: GraphNode[];
56
+ /** Symbols that call it. */
57
+ callers: GraphNode[];
58
+ /** Symbols it calls. */
59
+ callees: GraphNode[];
60
+ /** Symbols that reference it via a References edge — variable readers, the
61
+ * routes that map to a handler, and other dispatch references. */
62
+ referrers: GraphNode[];
63
+ /** Files that import (or re-export) it. */
64
+ dependents: GraphNode[];
65
+ /** Inheritance, so the overview is complete for OOP symbols (each empty when N/A):
66
+ * for a method, the supertype methods it overrides and the subtype methods that
67
+ * override it; for a class, the interfaces it implements; for an interface, the
68
+ * classes that implement it. (ama-vtp) */
69
+ overrides: GraphNode[];
70
+ overriddenBy: GraphNode[];
71
+ interfaces: GraphNode[];
72
+ implementations: GraphNode[];
73
+ /** Other symbols that matched the same ref but weren't chosen as the primary —
74
+ * so an ambiguous ref (e.g. "analyze" across an interface and its implementations)
75
+ * surfaces its alternatives instead of silently hiding them. Empty when the ref
76
+ * was unique. Pick one by its id/qualifiedName to inspect it directly. (ama-ceh) */
77
+ alternatives: GraphNode[];
78
+ }
79
+ /** A file's structure in one answer: the symbols it defines and what depends on
80
+ * it — a structured, cheaper stand-in for reading the whole file. */
81
+ export interface FileSkeleton {
82
+ /** The resolved File node. */
83
+ file: GraphNode;
84
+ /** Symbols the file defines, in source order (its outline). */
85
+ symbols: GraphNode[];
86
+ /** Files this file imports from — its outgoing dependencies, deduped to the file
87
+ * level (find_imports has the per-symbol detail). Bounded by the file, so uncapped.
88
+ * The symmetric counterpart to `dependents`. (ama-1jv) */
89
+ imports: GraphNode[];
90
+ /** Files that import (or re-export) this file — capped to keep the skeleton light.
91
+ * See `dependentsTotal` for the full count, or use find_importers for the list. */
92
+ dependents: GraphNode[];
93
+ /** Total number of dependents (`dependents` may be a capped preview). (ama-2by) */
94
+ dependentsTotal: number;
95
+ }
96
+ /** A census of the graph's node and edge kinds — what the index actually contains. */
97
+ export interface GraphSchema {
98
+ /** Count of nodes per kind (e.g. Class, Function, Method, Interface, File). */
99
+ nodes: Record<string, number>;
100
+ /** Count of edges per kind (e.g. Defines, Calls, Imports, Implements, UsesType). */
101
+ edges: Record<string, number>;
102
+ /** How many edges are checker-`resolved` vs `heuristic` (route/synthesized) vs
103
+ * `dispatch` (interface/override fan-out) — edge-level tier honesty (ama-m8k.1,
104
+ * ama-tr1). */
105
+ edgeProvenance: {
106
+ resolved: number;
107
+ heuristic: number;
108
+ dispatch: number;
109
+ };
110
+ }
111
+ /** A one-call overview of a question: matching symbols grouped by file, their
112
+ * caller/callee relationships, and the combined transitive blast radius. */
113
+ export interface Exploration {
114
+ question: string;
115
+ /** Top matching symbols (capped by the output budget), grouped by their file. */
116
+ byFile: Record<string, GraphNode[]>;
117
+ /** For each shown match: who calls it and what it calls. */
118
+ relationships: {
119
+ symbol: string;
120
+ callers: GraphNode[];
121
+ callees: GraphNode[];
122
+ }[];
123
+ /** Transitive callers of the shown matches — what changing them would affect
124
+ * (capped by the output budget). */
125
+ blastRadius: GraphNode[];
126
+ /** Total matches before the budget cap — when > shown, refine the query. (ama-m8k.4) */
127
+ totalMatches: number;
128
+ /** Total blast-radius symbols before the budget cap. (ama-m8k.4) */
129
+ totalBlastRadius: number;
130
+ }
131
+ /** A search query split into free text and structured filters (ama-m8k.3). */
132
+ export interface SearchQuery {
133
+ /** Free text matched against symbol name / qualified name. */
134
+ text: string;
135
+ /** File-path substring filter (`path:src/api`). */
136
+ path?: string;
137
+ /** Node-kind filter (`kind:Function`), matched case-insensitively. */
138
+ kind?: string;
139
+ /** Language filter (`lang:python`), derived from the file extension. */
140
+ lang?: string;
141
+ /** Explicit name-substring filter (`name:handler`), in addition to free text. */
142
+ name?: string;
143
+ }
144
+ /**
145
+ * Parse a search string into free text plus `path:`/`kind:`/`lang:`/`name:`
146
+ * filters, honouring quotes for values with spaces. Unknown `key:value` tokens
147
+ * (e.g. a `http://…` URL) are kept verbatim as free text rather than dropped.
148
+ */
149
+ export declare function parseSearchQuery(raw: string): SearchQuery;
150
+ /** Whether a path looks like a test file — `tests/`/`__tests__/` dirs or a
151
+ * `.test.`/`.spec.` name. Used by test-impact filtering (ama-5gs.9) and search
152
+ * demotion. */
153
+ export declare function isTestFile(file: string): boolean;
154
+ /** Default result cap for search_symbol/search_code — shared so the MCP layer can
155
+ * request one extra and tell the agent when the result was truncated. (ama-b4q) */
156
+ export declare const DEFAULT_SEARCH_LIMIT = 50;
157
+ /** Cap on the secondary `dependents` preview in a file skeleton. The outline
158
+ * (symbols) stays complete; dependents is bounded so a foundational file's skeleton
159
+ * doesn't dwarf the file it summarizes — `dependentsTotal` carries the full count
160
+ * and find_importers gives the complete list. (ama-2by) */
161
+ export declare const SKELETON_DEPENDENTS_LIMIT = 25;
162
+ /**
163
+ * Read-side of the graph: the four MVP questions an agent asks, answered from
164
+ * the store. A "symbol reference" is either an exact node id (e.g.
165
+ * "src/a.ts#Foo.bar") or a bare name ("bar"); names may resolve to several nodes.
166
+ */
167
+ export declare class QueryService {
168
+ private readonly store;
169
+ /** Absolute repo root, used to read source for snippets. */
170
+ private readonly root;
171
+ constructor(store: Store,
172
+ /** Absolute repo root, used to read source for snippets. */
173
+ root: string);
174
+ /**
175
+ * Symbols whose name matches `query`, answered by the store's name index
176
+ * (substring in-memory, FTS5 prefix in SQLite). Kind is filtered on top.
177
+ */
178
+ searchSymbol(query: string, opts?: SearchOptions): GraphNode[];
179
+ /**
180
+ * searchSymbol plus a confidence signal: low-confidence when there is a free-text
181
+ * term and results, but none is an exact or name-prefix match — the matches are
182
+ * loose substring/qualified hits, so the caller likely mistyped or should refine
183
+ * rather than trust the top hit. (ama-b79)
184
+ */
185
+ searchSymbolWithConfidence(query: string, opts?: SearchOptions): SearchResult;
186
+ /** Every indexed file's metadata, sorted by repo-relative path. */
187
+ files(): FileMeta[];
188
+ /**
189
+ * Full-text search over symbol *bodies* (not names): symbols whose verbatim
190
+ * source contains `query`, case-insensitively. Each file is read once and
191
+ * sliced per symbol; File nodes are excluded so a hit points at the containing
192
+ * symbol. This is the in-memory tier — a plain substring scan, not an FTS
193
+ * index (the SQLite store can specialize it later).
194
+ */
195
+ searchCode(query: string, opts?: {
196
+ limit?: number;
197
+ }): GraphNode[];
198
+ /** search_code that also reports whether it fell back from an exact-phrase match to
199
+ * term-matching (the literal phrase wasn't found) — so the MCP layer can warn the
200
+ * agent that the hits match the query's words separately, not the phrase. (ama-dve) */
201
+ searchCodeWithConfidence(query: string, opts?: {
202
+ limit?: number;
203
+ }): {
204
+ results: GraphNode[];
205
+ viaTerms: boolean;
206
+ };
207
+ private scanCode;
208
+ /** Symbols that call or construct the referenced symbol, each labelled by the
209
+ * edge kind (`Calls` / `Instantiates`) and its call-site location. */
210
+ findCallers(ref: string): EdgeNeighbor[];
211
+ /** Symbols the referenced symbol calls or constructs, each labelled by the edge
212
+ * kind (`Calls` / `Instantiates`) and its call-site location. */
213
+ findCallees(ref: string): EdgeNeighbor[];
214
+ /** The handler symbols a route refers to (route → References → handler). */
215
+ findHandlers(ref: string): EdgeNeighbor[];
216
+ /**
217
+ * Everything that points at a symbol via a References edge: the readers of a
218
+ * module-level Variable (ama-6k0), the routes that map to a handler (rme.1), and
219
+ * any other dispatch reference. The general "who refers to this" — answers the
220
+ * question `find_callers` can't, since reads aren't calls. (ama-pfm)
221
+ */
222
+ findReferrers(ref: string): EdgeNeighbor[];
223
+ /** The routes that map to a handler — the route-domain framing of
224
+ * {@link findReferrers} (a route References its handler). */
225
+ findRoutes(ref: string): EdgeNeighbor[];
226
+ /** The supertype methods a method overrides or implements (method → super). */
227
+ findOverrides(ref: string): EdgeNeighbor[];
228
+ /** The subtype methods that override a method (who overrides this — incoming). */
229
+ findOverriddenBy(ref: string): EdgeNeighbor[];
230
+ /** Classes that implement the referenced interface. */
231
+ findImplementations(ref: string): GraphNode[];
232
+ /** Interfaces the referenced class implements. */
233
+ findInterfaces(ref: string): GraphNode[];
234
+ /** Edges representing an import of/by `id` — value (`Imports`) and type-only
235
+ * (`ImportsType`) alike — so importer/dependent/affected queries still count an
236
+ * `import type` (it's a compile-time dependency). (ama-bhf) */
237
+ private importEdgesTo;
238
+ private importEdgesFrom;
239
+ /** Files that import (or re-export) the referenced symbol. */
240
+ findImporters(ref: string): GraphNode[];
241
+ /** Symbols the referenced file imports (or re-exports). */
242
+ findImports(ref: string): GraphNode[];
243
+ /** Symbols that use the referenced type in a parameter, return, or property. */
244
+ findTypeUsers(ref: string): GraphNode[];
245
+ /** Types the referenced symbol uses in a parameter, return, or property. */
246
+ findTypesUsed(ref: string): GraphNode[];
247
+ /** The named types a symbol returns (function/method → its return type). */
248
+ findReturns(ref: string): GraphNode[];
249
+ /**
250
+ * Everything about one node in a single call: its definition plus full
251
+ * source, callers, callees, and dependents — a higher-order composition of
252
+ * the individual query methods so an agent gets the whole picture at once.
253
+ * Undefined when the ref resolves to nothing.
254
+ */
255
+ node(ref: string): NodeView | undefined;
256
+ /** The symbols a node directly defines — its `Defines` targets (a class's
257
+ * methods/properties, an interface's members, …) — in source order. (ama-as5) */
258
+ private definedBy;
259
+ /**
260
+ * A file's skeleton: the symbols it defines (its outline, in source order) plus
261
+ * the files that depend on it — so an agent grasps a file's shape and reverse
262
+ * dependencies from one call instead of reading the whole file. `ref` is a File
263
+ * id (repo-relative path) or basename; non-file matches are ignored.
264
+ */
265
+ fileSkeleton(ref: string): FileSkeleton | undefined;
266
+ /**
267
+ * The transitive blast radius of a symbol: everything affected by changing it,
268
+ * found by walking the reverse dependency edges breadth-first (callers, type
269
+ * users, referrers, implementers, subclasses, …). `maxDepth` bounds the traversal
270
+ * (default unbounded); a visited set makes cycles and recursion safe. The seed
271
+ * symbol(s) the ref resolves to are excluded. Following every {@link
272
+ * IMPACT_EDGE_KINDS} edge — not just `Calls` — is what lets the blast radius of a
273
+ * type/interface/constant surface, since those are referenced, not called. (ama-8sw)
274
+ */
275
+ impactAnalysis(ref: string, maxDepth?: number): GraphNode[];
276
+ /**
277
+ * A census of the graph: how many nodes of each kind and edges of each kind
278
+ * the index holds. Each edge is counted once, at its source node.
279
+ */
280
+ getGraphSchema(): GraphSchema;
281
+ /**
282
+ * The files affected by changing the given files: the transitive set of files
283
+ * that import from them — directly (a module import) or by importing a symbol
284
+ * they define — walked breadth-first. The input files are excluded. Answers
285
+ * "which files (and tests) should I recheck?". Non-file refs and unknowns
286
+ * contribute nothing.
287
+ */
288
+ affected(refs: string[], opts?: {
289
+ testsOnly?: boolean;
290
+ }): GraphNode[];
291
+ /**
292
+ * Files that import from `fileId`: importers of the module itself (a star
293
+ * re-export or namespace import targets the File node) plus importers of each
294
+ * symbol the file defines.
295
+ */
296
+ private fileImporters;
297
+ /** The files this file imports: each Imports edge's target resolved to the file
298
+ * it lives in (a File node's id is its path, so that file is the target). */
299
+ private fileImports;
300
+ /**
301
+ * File-level import cycles, each a strongly-connected component of two or more
302
+ * files that (transitively) import each other — the high-signal answer for
303
+ * untangling a module graph. Tarjan's SCC over the file import graph; a
304
+ * single-node component (no self-import) is not a cycle and is omitted. (ama-m8k.7)
305
+ */
306
+ circularImports(): GraphNode[][];
307
+ /**
308
+ * A one-call overview answering "what's going on around X?": symbols whose
309
+ * name matches `question`, grouped by file, each with its callers and callees,
310
+ * plus the combined transitive blast radius. Composes searchSymbol,
311
+ * findCallers/findCallees, and impactAnalysis — no new graph logic.
312
+ */
313
+ explore(question: string, opts?: {
314
+ limit?: number;
315
+ }): Exploration;
316
+ /** Search each term and union the hits, ranked by how many distinct terms a
317
+ * symbol matches (a symbol hitting several is more on-topic), then by its best
318
+ * per-term relevance position. Each per-term `searchSymbol` keeps its own
319
+ * relevance order, so a single-term question behaves exactly as before. (ama-30q) */
320
+ private searchByTerms;
321
+ /** Verbatim source for a symbol, or undefined if it has no known location. */
322
+ getCodeSnippet(ref: string): Snippet | undefined;
323
+ /**
324
+ * Resolve a reference to node(s), most-specific first: exact id, then simple
325
+ * name (e.g. "compute"), then dotted qualified name (e.g. "Service.compute").
326
+ */
327
+ private resolve;
328
+ }
329
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/query/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAa,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAmBzD,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB;qFACiF;IACjF,aAAa,EAAE,OAAO,CAAC;CAC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