ultracode 5.4.0 → 5.6.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 (151) hide show
  1. package/dist/chunks/analysis-tool-handlers-GH5FDEWW.js +817 -0
  2. package/dist/chunks/analysis-tool-handlers-IXP4MWZX.js +817 -0
  3. package/dist/chunks/analysis-tool-handlers-LC2BTQYK.js +13 -0
  4. package/dist/chunks/analysis-tool-handlers-QYFKQPFL.js +817 -0
  5. package/dist/chunks/autodoc-tool-handlers-2HF6ERYN.js +1112 -0
  6. package/dist/chunks/autodoc-tool-handlers-4OGQJ7C3.js +1112 -0
  7. package/dist/chunks/autodoc-tool-handlers-N736CB56.js +138 -0
  8. package/dist/chunks/autodoc-tool-handlers-NQYBY6U4.js +1112 -0
  9. package/dist/chunks/branch-tool-handlers-KW3H4FJK.js +276 -0
  10. package/dist/chunks/branch-tool-handlers-QOUDZKJ2.js +276 -0
  11. package/dist/chunks/branch-tool-handlers-RB2U36KI.js +2 -0
  12. package/dist/chunks/branch-tool-handlers-ZHJM6PDK.js +276 -0
  13. package/dist/chunks/chunk-2Z6OQPYC.js +656 -0
  14. package/dist/chunks/chunk-3MQ7LRPN.js +322 -0
  15. package/dist/chunks/chunk-4W6QYGXZ.js +10 -0
  16. package/dist/chunks/chunk-533NFGUG.js +1 -0
  17. package/dist/chunks/chunk-5NUPOPWM.js +1 -0
  18. package/dist/chunks/chunk-AK4HIPA2.js +322 -0
  19. package/dist/chunks/chunk-B3H5NS3I.js +656 -0
  20. package/dist/chunks/chunk-DPTZHDST.js +4 -0
  21. package/dist/chunks/chunk-E5HQWLU5.js +322 -0
  22. package/dist/chunks/chunk-EOH25B5P.js +572 -0
  23. package/dist/chunks/chunk-ESV6F6E3.js +3179 -0
  24. package/dist/chunks/chunk-FPELPFER.js +924 -0
  25. package/dist/chunks/chunk-G6J42I55.js +161 -0
  26. package/dist/chunks/chunk-GCQE7ZYW.js +1 -0
  27. package/dist/chunks/chunk-GTIF6MOX.js +1 -0
  28. package/dist/chunks/chunk-I6STSSAK.js +2 -0
  29. package/dist/chunks/chunk-J2WBGTK2.js +4697 -0
  30. package/dist/chunks/chunk-KAYOX5EB.js +4697 -0
  31. package/dist/chunks/chunk-KPMTACOT.js +656 -0
  32. package/dist/chunks/chunk-L376GZ44.js +3179 -0
  33. package/dist/chunks/chunk-LCTOTHDA.js +15 -0
  34. package/dist/chunks/chunk-LEDJ7GVQ.js +316 -0
  35. package/dist/chunks/chunk-LH4OUKNZ.js +277 -0
  36. package/dist/chunks/chunk-O6IE2MEZ.js +161 -0
  37. package/dist/chunks/chunk-OEXPCY3F.js +316 -0
  38. package/dist/chunks/chunk-OMXOLFDN.js +924 -0
  39. package/dist/chunks/chunk-PLPBXWOU.js +3179 -0
  40. package/dist/chunks/chunk-PWLE5DN2.js +572 -0
  41. package/dist/chunks/chunk-PY43JPWL.js +447 -0
  42. package/dist/chunks/chunk-Q3B4EB7A.js +15 -0
  43. package/dist/chunks/chunk-Q5LPVLXA.js +337 -0
  44. package/dist/chunks/chunk-QIRZHZK2.js +5 -0
  45. package/dist/chunks/chunk-ROQ27LSL.js +924 -0
  46. package/dist/chunks/chunk-S5Q7BD6J.js +572 -0
  47. package/dist/chunks/chunk-SAMX3HJQ.js +337 -0
  48. package/dist/chunks/chunk-SV3WKUNV.js +1 -0
  49. package/dist/chunks/chunk-TCHCDCDO.js +167 -0
  50. package/dist/chunks/chunk-TR3HS7U6.js +316 -0
  51. package/dist/chunks/chunk-TUWE6FCW.js +167 -0
  52. package/dist/chunks/chunk-TVOTA7EE.js +277 -0
  53. package/dist/chunks/chunk-VS44D772.js +337 -0
  54. package/dist/chunks/chunk-WIE3G5ES.js +167 -0
  55. package/dist/chunks/chunk-XG3ACLWR.js +5 -0
  56. package/dist/chunks/chunk-XJ2Z5QQO.js +1 -0
  57. package/dist/chunks/chunk-XK2NY7RB.js +277 -0
  58. package/dist/chunks/chunk-Y4F7NZFZ.js +4700 -0
  59. package/dist/chunks/chunk-YS75L3ZS.js +161 -0
  60. package/dist/chunks/chunk-ZVG5HHI3.js +15 -0
  61. package/dist/chunks/dev-agent-DDDIVWOF.js +1 -0
  62. package/dist/chunks/dev-agent-E2VCFKXN.js +1624 -0
  63. package/dist/chunks/dev-agent-KJNSU5KQ.js +1624 -0
  64. package/dist/chunks/dev-agent-NDERYIPV.js +1624 -0
  65. package/dist/chunks/faiss-provider-7R4BQDIV.js +12 -0
  66. package/dist/chunks/faiss-provider-7ZFRSDN5.js +12 -0
  67. package/dist/chunks/faiss-provider-SXB7FTLB.js +1 -0
  68. package/dist/chunks/faiss-provider-TKLBEUSH.js +12 -0
  69. package/dist/chunks/file-tool-handlers-5DODQXGF.js +1027 -0
  70. package/dist/chunks/file-tool-handlers-KGHLE4KR.js +1027 -0
  71. package/dist/chunks/file-tool-handlers-KTOQ4NFS.js +12 -0
  72. package/dist/chunks/file-tool-handlers-V4SFUDQB.js +1027 -0
  73. package/dist/chunks/graph-metrics-tool-handlers-3AV4X4ZY.js +65 -0
  74. package/dist/chunks/graph-metrics-tool-handlers-3VMDQHJ6.js +65 -0
  75. package/dist/chunks/graph-metrics-tool-handlers-BZ6E6YHF.js +1 -0
  76. package/dist/chunks/graph-metrics-tool-handlers-IYBGSXL7.js +65 -0
  77. package/dist/chunks/graph-storage-factory-2CQ2RPDV.js +13 -0
  78. package/dist/chunks/graph-storage-factory-C5SMMYL6.js +13 -0
  79. package/dist/chunks/graph-storage-factory-EEO2V3GJ.js +1 -0
  80. package/dist/chunks/graph-storage-factory-WBCTXP34.js +13 -0
  81. package/dist/chunks/history-tool-handlers-AS7OQFZI.js +1 -0
  82. package/dist/chunks/history-tool-handlers-FSNJYXV2.js +208 -0
  83. package/dist/chunks/history-tool-handlers-JZAH4EIQ.js +208 -0
  84. package/dist/chunks/history-tool-handlers-KCSCXZ7T.js +208 -0
  85. package/dist/chunks/incremental-updater-A2EL4QXU.js +14 -0
  86. package/dist/chunks/incremental-updater-EQIKBVY2.js +14 -0
  87. package/dist/chunks/incremental-updater-JFGRPH3B.js +14 -0
  88. package/dist/chunks/incremental-updater-S5BAAGHP.js +1 -0
  89. package/dist/chunks/indexer-agent-ASKY7JPG.js +1 -0
  90. package/dist/chunks/indexer-agent-NKAOF323.js +21 -0
  91. package/dist/chunks/indexer-agent-PJN5IOKQ.js +21 -0
  92. package/dist/chunks/indexer-agent-WRJFWKZX.js +21 -0
  93. package/dist/chunks/indexing-pipeline-D4P2O72Z.js +249 -0
  94. package/dist/chunks/indexing-pipeline-L7C543N4.js +1 -0
  95. package/dist/chunks/indexing-pipeline-NHPRN3AB.js +249 -0
  96. package/dist/chunks/indexing-pipeline-ZAXCZU22.js +249 -0
  97. package/dist/chunks/layered-faiss-provider-62CNW54X.js +1 -0
  98. package/dist/chunks/layered-faiss-provider-O7L77GFX.js +12 -0
  99. package/dist/chunks/layered-faiss-provider-RVHLHLPK.js +12 -0
  100. package/dist/chunks/layered-faiss-provider-YT7EDIJI.js +12 -0
  101. package/dist/chunks/merge-agent-3RF7VFF5.js +2481 -0
  102. package/dist/chunks/merge-agent-JCKTCBCE.js +2481 -0
  103. package/dist/chunks/merge-agent-VCL7OXPN.js +2481 -0
  104. package/dist/chunks/merge-agent-ZGK24WVF.js +11 -0
  105. package/dist/chunks/merge-tool-handlers-GV2LOIKU.js +277 -0
  106. package/dist/chunks/merge-tool-handlers-TYDWU5X2.js +277 -0
  107. package/dist/chunks/merge-tool-handlers-U7X2ZO2M.js +1 -0
  108. package/dist/chunks/merge-tool-handlers-YH62ZLPJ.js +277 -0
  109. package/dist/chunks/pattern-tool-handlers-76NF5JDS.js +13 -0
  110. package/dist/chunks/pattern-tool-handlers-IJAGEIVD.js +1549 -0
  111. package/dist/chunks/pattern-tool-handlers-VA5WYA62.js +1549 -0
  112. package/dist/chunks/pattern-tool-handlers-WQ6UBMJS.js +1549 -0
  113. package/dist/chunks/query-agent-36ADGCFZ.js +1 -0
  114. package/dist/chunks/query-agent-H22CR5N5.js +191 -0
  115. package/dist/chunks/query-agent-K2UGZS4M.js +191 -0
  116. package/dist/chunks/query-agent-YJCEHOXD.js +191 -0
  117. package/dist/chunks/semantic-agent-AC7CBEDE.js +6381 -0
  118. package/dist/chunks/semantic-agent-HK5X6CKU.js +6381 -0
  119. package/dist/chunks/semantic-agent-KONIKEGW.js +6381 -0
  120. package/dist/chunks/semantic-agent-LH6IZ2L7.js +137 -0
  121. package/dist/chunks/semantic-tool-handlers-5LMSH2U7.js +3 -0
  122. package/dist/chunks/semantic-tool-handlers-735UMO7Y.js +817 -0
  123. package/dist/chunks/semantic-tool-handlers-BNUYPP7X.js +817 -0
  124. package/dist/chunks/semantic-tool-handlers-MYZPEUD2.js +817 -0
  125. package/dist/chunks/snapshot-tool-handlers-6SIHZT2F.js +201 -0
  126. package/dist/chunks/snapshot-tool-handlers-DS4P3KOT.js +201 -0
  127. package/dist/chunks/snapshot-tool-handlers-JYHRFPC7.js +201 -0
  128. package/dist/chunks/snapshot-tool-handlers-YEHMAT3L.js +1 -0
  129. package/dist/chunks/storage-paths-A3C7WHHG.js +8 -0
  130. package/dist/chunks/storage-paths-HDYH7WPM.js +1 -0
  131. package/dist/chunks/storage-paths-IMFRHBWF.js +8 -0
  132. package/dist/chunks/storage-paths-P3PUSMUD.js +8 -0
  133. package/dist/chunks/taint-tool-handlers-CWESOOMQ.js +68 -0
  134. package/dist/chunks/taint-tool-handlers-OG3NVVP3.js +1 -0
  135. package/dist/chunks/taint-tool-handlers-ON3G3FA7.js +68 -0
  136. package/dist/chunks/taint-tool-handlers-P4P5J6DB.js +68 -0
  137. package/dist/chunks/tracing-tool-handlers-4BDCXTZZ.js +3935 -0
  138. package/dist/chunks/tracing-tool-handlers-6FPNM7HX.js +3935 -0
  139. package/dist/chunks/tracing-tool-handlers-LQTQ5SKK.js +89 -0
  140. package/dist/chunks/tracing-tool-handlers-XRQX2DTS.js +3935 -0
  141. package/dist/chunks/validation-tool-handlers-DZUG7KYY.js +2 -0
  142. package/dist/chunks/validation-tool-handlers-O6TGFSH5.js +555 -0
  143. package/dist/chunks/validation-tool-handlers-RREUYKIR.js +555 -0
  144. package/dist/chunks/validation-tool-handlers-XPWSMS37.js +555 -0
  145. package/dist/index.js +13 -13
  146. package/dist/roslyn-addon/.build-hash +1 -1
  147. package/dist/roslyn-addon/ILGPU.Algorithms.dll +0 -0
  148. package/dist/roslyn-addon/ILGPU.dll +0 -0
  149. package/dist/roslyn-addon/UltraCode.CSharp.deps.json +35 -0
  150. package/dist/roslyn-addon/UltraCode.CSharp.dll +0 -0
  151. package/package.json +1 -1
@@ -0,0 +1,249 @@
1
+ import { collectFilesAsync, init_file_extensions, file_extensions_exports } from './chunk-4GYRHAKO.js';
2
+ import { getGraphStorage } from './chunk-Y4F7NZFZ.js';
3
+ import './chunk-HNDYLCWI.js';
4
+ import './chunk-CTXFPNDA.js';
5
+ import './chunk-TJSOOFXA.js';
6
+ import './chunk-AIZUHUK6.js';
7
+ import './chunk-O6IE2MEZ.js';
8
+ import './chunk-LH4OUKNZ.js';
9
+ import './chunk-HEMJHRHZ.js';
10
+ import { toError } from './chunk-5WKPA33T.js';
11
+ import './chunk-BMHPPH2B.js';
12
+ import { init_logging, log } from './chunk-VCCBEJQ5.js';
13
+ import './chunk-UN27MREV.js';
14
+ import { __require, __toCommonJS } from './chunk-NAQKA54E.js';
15
+ import { statSync } from 'fs';
16
+
17
+ // src/agents/dev/indexing-pipeline.ts
18
+ init_logging();
19
+ async function initializeIndexing(options) {
20
+ const { directory, excludePatterns = [], incremental = false, agentId } = options;
21
+ log.i("DEVAGENT", "Starting indexing", {
22
+ directory,
23
+ excludePatternsCount: excludePatterns.length,
24
+ samplePatterns: excludePatterns.slice(0, 5)
25
+ });
26
+ const collectResult = await collectFilesAsync(directory, { excludePatterns, agentId });
27
+ const allFiles = collectResult.files;
28
+ log.i("DEVAGENT", "Files collected", { count: allFiles.length });
29
+ return {
30
+ directory,
31
+ excludePatterns,
32
+ isIncremental: incremental,
33
+ agentId,
34
+ allFiles,
35
+ deletedEntityIds: []
36
+ };
37
+ }
38
+ async function detectChangedFiles(context) {
39
+ if (!context.isIncremental || context.allFiles.length === 0) {
40
+ return null;
41
+ }
42
+ const storage = await getGraphStorage();
43
+ const indexedFiles = await storage.getAllIndexedFiles();
44
+ if (indexedFiles.size === 0) {
45
+ return {
46
+ changedFiles: [],
47
+ newFiles: context.allFiles,
48
+ deletedFiles: [],
49
+ unchangedFiles: []
50
+ };
51
+ }
52
+ const changedFiles = [];
53
+ const newFiles = [];
54
+ const unchangedFiles = [];
55
+ for (const file of context.allFiles) {
56
+ const normalizedPath = file.replace(/\\/g, "/");
57
+ const lastIndexed = indexedFiles.get(normalizedPath);
58
+ if (lastIndexed === void 0) {
59
+ newFiles.push(file);
60
+ } else {
61
+ try {
62
+ const stats = statSync(file);
63
+ const mtime = stats.mtimeMs;
64
+ if (mtime > lastIndexed) {
65
+ changedFiles.push(file);
66
+ } else {
67
+ unchangedFiles.push(file);
68
+ }
69
+ } catch {
70
+ unchangedFiles.push(file);
71
+ }
72
+ }
73
+ }
74
+ const currentFilesSet = new Set(context.allFiles.map((file) => file.replace(/\\/g, "/")));
75
+ const deletedFiles = [];
76
+ for (const [indexedPath] of indexedFiles) {
77
+ if (!currentFilesSet.has(indexedPath)) {
78
+ deletedFiles.push(indexedPath);
79
+ }
80
+ }
81
+ log.i("DEVAGENT", "Smart incremental analysis", {
82
+ total: context.allFiles.length,
83
+ changed: changedFiles.length,
84
+ new: newFiles.length,
85
+ deleted: deletedFiles.length,
86
+ unchanged: unchangedFiles.length
87
+ });
88
+ return {
89
+ changedFiles,
90
+ newFiles,
91
+ deletedFiles,
92
+ unchangedFiles
93
+ };
94
+ }
95
+ async function cleanStaleEntities(filesToClean) {
96
+ if (filesToClean.length === 0) {
97
+ return [];
98
+ }
99
+ log.i("DEVAGENT", "Invalidating deleted files", {
100
+ fileCount: filesToClean.length
101
+ });
102
+ const storage = await getGraphStorage();
103
+ const deletedEntityIds = [];
104
+ for (const file of filesToClean) {
105
+ try {
106
+ const ids = await storage.deleteEntitiesByFilePath(file);
107
+ deletedEntityIds.push(...ids);
108
+ await storage.deleteFileInfo(file);
109
+ } catch (error) {
110
+ const err = toError(error);
111
+ log.w("DEVAGENT", "Failed to invalidate file", {
112
+ file,
113
+ error: err.message,
114
+ stack: err.stack
115
+ });
116
+ }
117
+ }
118
+ log.i("DEVAGENT", "Files invalidated", {
119
+ entityCount: deletedEntityIds.length
120
+ });
121
+ return deletedEntityIds;
122
+ }
123
+ async function applyChangeAnalysis(context, analysis) {
124
+ const filesToClean = [...analysis.changedFiles, ...analysis.deletedFiles];
125
+ const deletedEntityIds = await cleanStaleEntities(filesToClean);
126
+ const filesToProcess = [...analysis.changedFiles, ...analysis.newFiles];
127
+ log.i("DEVAGENT", "Files to process after analysis", {
128
+ toProcess: filesToProcess.length,
129
+ entitiesDeleted: deletedEntityIds.length
130
+ });
131
+ if (filesToProcess.length === 0) {
132
+ log.i("DEVAGENT", "No files changed, skipping indexing");
133
+ }
134
+ return {
135
+ ...context,
136
+ allFiles: filesToProcess,
137
+ deletedEntityIds
138
+ };
139
+ }
140
+ function separateCodeAndDataFiles(files) {
141
+ const codeFiles = [];
142
+ const dataFiles = [];
143
+ const { extname } = __require("path");
144
+ const { isCodeExtension } = (init_file_extensions(), __toCommonJS(file_extensions_exports));
145
+ for (const file of files) {
146
+ const ext = extname(file).toLowerCase();
147
+ if (isCodeExtension(ext)) {
148
+ codeFiles.push(file);
149
+ } else {
150
+ dataFiles.push(file);
151
+ }
152
+ }
153
+ log.i("DEVAGENT", "Files separated", {
154
+ codeFiles: codeFiles.length,
155
+ dataFiles: dataFiles.length
156
+ });
157
+ return {
158
+ codeFiles,
159
+ dataFiles
160
+ };
161
+ }
162
+ async function resolveSwaggerLinks() {
163
+ const storage = await getGraphStorage();
164
+ const allEntities = await storage.getAllEntities();
165
+ const hasSwagger = allEntities.some((e) => e.metadata?.["swaggerType"]);
166
+ if (!hasSwagger) {
167
+ return 0;
168
+ }
169
+ log.i("DEVAGENT", "swagger_link_start", { totalEntities: allEntities.length });
170
+ try {
171
+ const { analyzeSwaggerCodeLinks, buildSwaggerRelationships } = await import('./swagger-code-linker-WXUPZZEE.js');
172
+ const analysis = analyzeSwaggerCodeLinks(allEntities);
173
+ const totalLinks = analysis.producers.length + analysis.consumers.length + analysis.generatedTypes.length;
174
+ if (totalLinks === 0) {
175
+ log.i("DEVAGENT", "swagger_link_none");
176
+ return 0;
177
+ }
178
+ const swaggerRelationships = buildSwaggerRelationships(analysis);
179
+ const { nanoid } = await import('nanoid');
180
+ const relationships = swaggerRelationships.map((rel) => ({
181
+ id: nanoid(12),
182
+ fromId: `swagger:${rel.fromName}`,
183
+ toId: `swagger:${rel.toName}`,
184
+ type: rel.type,
185
+ metadata: {
186
+ ...rel.metadata,
187
+ fromFile: rel.fromFile,
188
+ toFile: rel.toFile
189
+ }
190
+ }));
191
+ const entityByName = /* @__PURE__ */ new Map();
192
+ for (const e of allEntities) {
193
+ entityByName.set(e.name, e.id);
194
+ entityByName.set(`${e.filePath}:${e.name}`, e.id);
195
+ }
196
+ for (const rel of relationships) {
197
+ const fromName = rel.fromId.replace("swagger:", "");
198
+ const toName = rel.toId.replace("swagger:", "");
199
+ const fromFile = rel.metadata?.fromFile;
200
+ const toFile = rel.metadata?.toFile;
201
+ if (fromFile) {
202
+ const fileKey = `${fromFile}:${fromName}`;
203
+ if (entityByName.has(fileKey)) {
204
+ rel.fromId = entityByName.get(fileKey);
205
+ }
206
+ }
207
+ if (!rel.fromId.startsWith("swagger:") === false && entityByName.has(fromName)) {
208
+ rel.fromId = entityByName.get(fromName);
209
+ }
210
+ if (toFile) {
211
+ const fileKey = `${toFile}:${toName}`;
212
+ if (entityByName.has(fileKey)) {
213
+ rel.toId = entityByName.get(fileKey);
214
+ }
215
+ }
216
+ if (!rel.toId.startsWith("swagger:") === false && entityByName.has(toName)) {
217
+ rel.toId = entityByName.get(toName);
218
+ }
219
+ }
220
+ const result = await storage.insertRelationships(relationships);
221
+ log.i("DEVAGENT", "swagger_link_done", {
222
+ producers: analysis.producers.length,
223
+ consumers: analysis.consumers.length,
224
+ generatedTypes: analysis.generatedTypes.length,
225
+ relationshipsCreated: result.processed,
226
+ configs: analysis.codegenConfigs
227
+ });
228
+ return result.processed;
229
+ } catch (error) {
230
+ log.w("DEVAGENT", "swagger_link_error", { error: error.message });
231
+ return 0;
232
+ }
233
+ }
234
+ function shouldUseIncrementalMode(context) {
235
+ return context.isIncremental && context.allFiles.length > 0;
236
+ }
237
+ function buildIndexingResult(context, filesProcessed, totalEntities, totalRelationships) {
238
+ return {
239
+ filesProcessed,
240
+ entitiesExtracted: totalEntities,
241
+ relationshipsCreated: totalRelationships,
242
+ totalFiles: context.allFiles.length,
243
+ deletedEntities: context.deletedEntityIds.length
244
+ };
245
+ }
246
+
247
+ export { applyChangeAnalysis, buildIndexingResult, cleanStaleEntities, detectChangedFiles, initializeIndexing, resolveSwaggerLinks, separateCodeAndDataFiles, shouldUseIncrementalMode };
248
+ //# sourceMappingURL=indexing-pipeline-NHPRN3AB.js.map
249
+ //# sourceMappingURL=indexing-pipeline-NHPRN3AB.js.map
@@ -0,0 +1,249 @@
1
+ import { collectFilesAsync, init_file_extensions, file_extensions_exports } from './chunk-4GYRHAKO.js';
2
+ import { getGraphStorage } from './chunk-KAYOX5EB.js';
3
+ import './chunk-HNDYLCWI.js';
4
+ import './chunk-CTXFPNDA.js';
5
+ import './chunk-TJSOOFXA.js';
6
+ import './chunk-AIZUHUK6.js';
7
+ import './chunk-G6J42I55.js';
8
+ import './chunk-TVOTA7EE.js';
9
+ import './chunk-HEMJHRHZ.js';
10
+ import { toError } from './chunk-5WKPA33T.js';
11
+ import './chunk-BMHPPH2B.js';
12
+ import { init_logging, log } from './chunk-VCCBEJQ5.js';
13
+ import './chunk-UN27MREV.js';
14
+ import { __require, __toCommonJS } from './chunk-NAQKA54E.js';
15
+ import { statSync } from 'fs';
16
+
17
+ // src/agents/dev/indexing-pipeline.ts
18
+ init_logging();
19
+ async function initializeIndexing(options) {
20
+ const { directory, excludePatterns = [], incremental = false, agentId } = options;
21
+ log.i("DEVAGENT", "Starting indexing", {
22
+ directory,
23
+ excludePatternsCount: excludePatterns.length,
24
+ samplePatterns: excludePatterns.slice(0, 5)
25
+ });
26
+ const collectResult = await collectFilesAsync(directory, { excludePatterns, agentId });
27
+ const allFiles = collectResult.files;
28
+ log.i("DEVAGENT", "Files collected", { count: allFiles.length });
29
+ return {
30
+ directory,
31
+ excludePatterns,
32
+ isIncremental: incremental,
33
+ agentId,
34
+ allFiles,
35
+ deletedEntityIds: []
36
+ };
37
+ }
38
+ async function detectChangedFiles(context) {
39
+ if (!context.isIncremental || context.allFiles.length === 0) {
40
+ return null;
41
+ }
42
+ const storage = await getGraphStorage();
43
+ const indexedFiles = await storage.getAllIndexedFiles();
44
+ if (indexedFiles.size === 0) {
45
+ return {
46
+ changedFiles: [],
47
+ newFiles: context.allFiles,
48
+ deletedFiles: [],
49
+ unchangedFiles: []
50
+ };
51
+ }
52
+ const changedFiles = [];
53
+ const newFiles = [];
54
+ const unchangedFiles = [];
55
+ for (const file of context.allFiles) {
56
+ const normalizedPath = file.replace(/\\/g, "/");
57
+ const lastIndexed = indexedFiles.get(normalizedPath);
58
+ if (lastIndexed === void 0) {
59
+ newFiles.push(file);
60
+ } else {
61
+ try {
62
+ const stats = statSync(file);
63
+ const mtime = stats.mtimeMs;
64
+ if (mtime > lastIndexed) {
65
+ changedFiles.push(file);
66
+ } else {
67
+ unchangedFiles.push(file);
68
+ }
69
+ } catch {
70
+ unchangedFiles.push(file);
71
+ }
72
+ }
73
+ }
74
+ const currentFilesSet = new Set(context.allFiles.map((file) => file.replace(/\\/g, "/")));
75
+ const deletedFiles = [];
76
+ for (const [indexedPath] of indexedFiles) {
77
+ if (!currentFilesSet.has(indexedPath)) {
78
+ deletedFiles.push(indexedPath);
79
+ }
80
+ }
81
+ log.i("DEVAGENT", "Smart incremental analysis", {
82
+ total: context.allFiles.length,
83
+ changed: changedFiles.length,
84
+ new: newFiles.length,
85
+ deleted: deletedFiles.length,
86
+ unchanged: unchangedFiles.length
87
+ });
88
+ return {
89
+ changedFiles,
90
+ newFiles,
91
+ deletedFiles,
92
+ unchangedFiles
93
+ };
94
+ }
95
+ async function cleanStaleEntities(filesToClean) {
96
+ if (filesToClean.length === 0) {
97
+ return [];
98
+ }
99
+ log.i("DEVAGENT", "Invalidating deleted files", {
100
+ fileCount: filesToClean.length
101
+ });
102
+ const storage = await getGraphStorage();
103
+ const deletedEntityIds = [];
104
+ for (const file of filesToClean) {
105
+ try {
106
+ const ids = await storage.deleteEntitiesByFilePath(file);
107
+ deletedEntityIds.push(...ids);
108
+ await storage.deleteFileInfo(file);
109
+ } catch (error) {
110
+ const err = toError(error);
111
+ log.w("DEVAGENT", "Failed to invalidate file", {
112
+ file,
113
+ error: err.message,
114
+ stack: err.stack
115
+ });
116
+ }
117
+ }
118
+ log.i("DEVAGENT", "Files invalidated", {
119
+ entityCount: deletedEntityIds.length
120
+ });
121
+ return deletedEntityIds;
122
+ }
123
+ async function applyChangeAnalysis(context, analysis) {
124
+ const filesToClean = [...analysis.changedFiles, ...analysis.deletedFiles];
125
+ const deletedEntityIds = await cleanStaleEntities(filesToClean);
126
+ const filesToProcess = [...analysis.changedFiles, ...analysis.newFiles];
127
+ log.i("DEVAGENT", "Files to process after analysis", {
128
+ toProcess: filesToProcess.length,
129
+ entitiesDeleted: deletedEntityIds.length
130
+ });
131
+ if (filesToProcess.length === 0) {
132
+ log.i("DEVAGENT", "No files changed, skipping indexing");
133
+ }
134
+ return {
135
+ ...context,
136
+ allFiles: filesToProcess,
137
+ deletedEntityIds
138
+ };
139
+ }
140
+ function separateCodeAndDataFiles(files) {
141
+ const codeFiles = [];
142
+ const dataFiles = [];
143
+ const { extname } = __require("path");
144
+ const { isCodeExtension } = (init_file_extensions(), __toCommonJS(file_extensions_exports));
145
+ for (const file of files) {
146
+ const ext = extname(file).toLowerCase();
147
+ if (isCodeExtension(ext)) {
148
+ codeFiles.push(file);
149
+ } else {
150
+ dataFiles.push(file);
151
+ }
152
+ }
153
+ log.i("DEVAGENT", "Files separated", {
154
+ codeFiles: codeFiles.length,
155
+ dataFiles: dataFiles.length
156
+ });
157
+ return {
158
+ codeFiles,
159
+ dataFiles
160
+ };
161
+ }
162
+ async function resolveSwaggerLinks() {
163
+ const storage = await getGraphStorage();
164
+ const allEntities = await storage.getAllEntities();
165
+ const hasSwagger = allEntities.some((e) => e.metadata?.["swaggerType"]);
166
+ if (!hasSwagger) {
167
+ return 0;
168
+ }
169
+ log.i("DEVAGENT", "swagger_link_start", { totalEntities: allEntities.length });
170
+ try {
171
+ const { analyzeSwaggerCodeLinks, buildSwaggerRelationships } = await import('./swagger-code-linker-WXUPZZEE.js');
172
+ const analysis = analyzeSwaggerCodeLinks(allEntities);
173
+ const totalLinks = analysis.producers.length + analysis.consumers.length + analysis.generatedTypes.length;
174
+ if (totalLinks === 0) {
175
+ log.i("DEVAGENT", "swagger_link_none");
176
+ return 0;
177
+ }
178
+ const swaggerRelationships = buildSwaggerRelationships(analysis);
179
+ const { nanoid } = await import('nanoid');
180
+ const relationships = swaggerRelationships.map((rel) => ({
181
+ id: nanoid(12),
182
+ fromId: `swagger:${rel.fromName}`,
183
+ toId: `swagger:${rel.toName}`,
184
+ type: rel.type,
185
+ metadata: {
186
+ ...rel.metadata,
187
+ fromFile: rel.fromFile,
188
+ toFile: rel.toFile
189
+ }
190
+ }));
191
+ const entityByName = /* @__PURE__ */ new Map();
192
+ for (const e of allEntities) {
193
+ entityByName.set(e.name, e.id);
194
+ entityByName.set(`${e.filePath}:${e.name}`, e.id);
195
+ }
196
+ for (const rel of relationships) {
197
+ const fromName = rel.fromId.replace("swagger:", "");
198
+ const toName = rel.toId.replace("swagger:", "");
199
+ const fromFile = rel.metadata?.fromFile;
200
+ const toFile = rel.metadata?.toFile;
201
+ if (fromFile) {
202
+ const fileKey = `${fromFile}:${fromName}`;
203
+ if (entityByName.has(fileKey)) {
204
+ rel.fromId = entityByName.get(fileKey);
205
+ }
206
+ }
207
+ if (!rel.fromId.startsWith("swagger:") === false && entityByName.has(fromName)) {
208
+ rel.fromId = entityByName.get(fromName);
209
+ }
210
+ if (toFile) {
211
+ const fileKey = `${toFile}:${toName}`;
212
+ if (entityByName.has(fileKey)) {
213
+ rel.toId = entityByName.get(fileKey);
214
+ }
215
+ }
216
+ if (!rel.toId.startsWith("swagger:") === false && entityByName.has(toName)) {
217
+ rel.toId = entityByName.get(toName);
218
+ }
219
+ }
220
+ const result = await storage.insertRelationships(relationships);
221
+ log.i("DEVAGENT", "swagger_link_done", {
222
+ producers: analysis.producers.length,
223
+ consumers: analysis.consumers.length,
224
+ generatedTypes: analysis.generatedTypes.length,
225
+ relationshipsCreated: result.processed,
226
+ configs: analysis.codegenConfigs
227
+ });
228
+ return result.processed;
229
+ } catch (error) {
230
+ log.w("DEVAGENT", "swagger_link_error", { error: error.message });
231
+ return 0;
232
+ }
233
+ }
234
+ function shouldUseIncrementalMode(context) {
235
+ return context.isIncremental && context.allFiles.length > 0;
236
+ }
237
+ function buildIndexingResult(context, filesProcessed, totalEntities, totalRelationships) {
238
+ return {
239
+ filesProcessed,
240
+ entitiesExtracted: totalEntities,
241
+ relationshipsCreated: totalRelationships,
242
+ totalFiles: context.allFiles.length,
243
+ deletedEntities: context.deletedEntityIds.length
244
+ };
245
+ }
246
+
247
+ export { applyChangeAnalysis, buildIndexingResult, cleanStaleEntities, detectChangedFiles, initializeIndexing, resolveSwaggerLinks, separateCodeAndDataFiles, shouldUseIncrementalMode };
248
+ //# sourceMappingURL=indexing-pipeline-ZAXCZU22.js.map
249
+ //# sourceMappingURL=indexing-pipeline-ZAXCZU22.js.map
@@ -0,0 +1 @@
1
+ export{a as LayeredFaissProvider,b as getLayeredFaissProvider,c as shutdownLayeredFaissProvider}from'./chunk-533NFGUG.js';import'./chunk-DPTZHDST.js';import'./chunk-IFKMF76K.js';import'./chunk-I6STSSAK.js';import'./chunk-SV3WKUNV.js';import'./chunk-PZF7YC35.js';import'./chunk-AIZJT6AG.js';import'./chunk-OG62YNVF.js';import'./chunk-4BI7EBPQ.js';import'./chunk-DXB73IDG.js';
@@ -0,0 +1,12 @@
1
+ export { LayeredFaissProvider, getLayeredFaissProvider, shutdownLayeredFaissProvider } from './chunk-2Z6OQPYC.js';
2
+ import './chunk-FPELPFER.js';
3
+ import './chunk-QN237S7C.js';
4
+ import './chunk-G6J42I55.js';
5
+ import './chunk-TVOTA7EE.js';
6
+ import './chunk-HEMJHRHZ.js';
7
+ import './chunk-IMQ6WSJV.js';
8
+ import './chunk-BMHPPH2B.js';
9
+ import './chunk-VCCBEJQ5.js';
10
+ import './chunk-NAQKA54E.js';
11
+ //# sourceMappingURL=layered-faiss-provider-O7L77GFX.js.map
12
+ //# sourceMappingURL=layered-faiss-provider-O7L77GFX.js.map
@@ -0,0 +1,12 @@
1
+ export { LayeredFaissProvider, getLayeredFaissProvider, shutdownLayeredFaissProvider } from './chunk-B3H5NS3I.js';
2
+ import './chunk-OMXOLFDN.js';
3
+ import './chunk-QN237S7C.js';
4
+ import './chunk-YS75L3ZS.js';
5
+ import './chunk-XK2NY7RB.js';
6
+ import './chunk-HEMJHRHZ.js';
7
+ import './chunk-IMQ6WSJV.js';
8
+ import './chunk-BMHPPH2B.js';
9
+ import './chunk-VCCBEJQ5.js';
10
+ import './chunk-NAQKA54E.js';
11
+ //# sourceMappingURL=layered-faiss-provider-RVHLHLPK.js.map
12
+ //# sourceMappingURL=layered-faiss-provider-RVHLHLPK.js.map
@@ -0,0 +1,12 @@
1
+ export { LayeredFaissProvider, getLayeredFaissProvider, shutdownLayeredFaissProvider } from './chunk-KPMTACOT.js';
2
+ import './chunk-ROQ27LSL.js';
3
+ import './chunk-QN237S7C.js';
4
+ import './chunk-O6IE2MEZ.js';
5
+ import './chunk-LH4OUKNZ.js';
6
+ import './chunk-HEMJHRHZ.js';
7
+ import './chunk-IMQ6WSJV.js';
8
+ import './chunk-BMHPPH2B.js';
9
+ import './chunk-VCCBEJQ5.js';
10
+ import './chunk-NAQKA54E.js';
11
+ //# sourceMappingURL=layered-faiss-provider-YT7EDIJI.js.map
12
+ //# sourceMappingURL=layered-faiss-provider-YT7EDIJI.js.map