@thanh01.pmt/domain-kit 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 (108) hide show
  1. package/README.md +1101 -0
  2. package/dist/assembly/index.cjs +213 -0
  3. package/dist/assembly/index.cjs.map +1 -0
  4. package/dist/assembly/index.d.cts +66 -0
  5. package/dist/assembly/index.d.ts +66 -0
  6. package/dist/assembly/index.mjs +4 -0
  7. package/dist/assembly/index.mjs.map +1 -0
  8. package/dist/chunk-3H2HX7PR.mjs +324 -0
  9. package/dist/chunk-3H2HX7PR.mjs.map +1 -0
  10. package/dist/chunk-3VVPSRAM.mjs +1297 -0
  11. package/dist/chunk-3VVPSRAM.mjs.map +1 -0
  12. package/dist/chunk-DRVOV5ZD.mjs +314 -0
  13. package/dist/chunk-DRVOV5ZD.mjs.map +1 -0
  14. package/dist/chunk-F4RZNBOE.mjs +3 -0
  15. package/dist/chunk-F4RZNBOE.mjs.map +1 -0
  16. package/dist/chunk-GEUDHZE7.mjs +446 -0
  17. package/dist/chunk-GEUDHZE7.mjs.map +1 -0
  18. package/dist/chunk-HH4UX65C.mjs +100 -0
  19. package/dist/chunk-HH4UX65C.mjs.map +1 -0
  20. package/dist/chunk-KMYENICQ.mjs +3 -0
  21. package/dist/chunk-KMYENICQ.mjs.map +1 -0
  22. package/dist/chunk-KNDBODUQ.mjs +153 -0
  23. package/dist/chunk-KNDBODUQ.mjs.map +1 -0
  24. package/dist/chunk-MM2RWYNW.mjs +3 -0
  25. package/dist/chunk-MM2RWYNW.mjs.map +1 -0
  26. package/dist/chunk-MOKNFLUD.mjs +851 -0
  27. package/dist/chunk-MOKNFLUD.mjs.map +1 -0
  28. package/dist/chunk-ONQHJ4OH.mjs +211 -0
  29. package/dist/chunk-ONQHJ4OH.mjs.map +1 -0
  30. package/dist/chunk-PM42MMDJ.mjs +516 -0
  31. package/dist/chunk-PM42MMDJ.mjs.map +1 -0
  32. package/dist/chunk-RKRNOVKO.mjs +166 -0
  33. package/dist/chunk-RKRNOVKO.mjs.map +1 -0
  34. package/dist/chunk-VFART56O.mjs +884 -0
  35. package/dist/chunk-VFART56O.mjs.map +1 -0
  36. package/dist/chunk-XMHKWHVK.mjs +218 -0
  37. package/dist/chunk-XMHKWHVK.mjs.map +1 -0
  38. package/dist/conceptEscalator-YfMKIKCZ.d.ts +40 -0
  39. package/dist/conceptEscalator-ltRLtPhf.d.cts +40 -0
  40. package/dist/concepts/index.cjs +155 -0
  41. package/dist/concepts/index.cjs.map +1 -0
  42. package/dist/concepts/index.d.cts +79 -0
  43. package/dist/concepts/index.d.ts +79 -0
  44. package/dist/concepts/index.mjs +4 -0
  45. package/dist/concepts/index.mjs.map +1 -0
  46. package/dist/curriculumFeedSchema-TEeQg2bY.d.cts +549 -0
  47. package/dist/curriculumFeedSchema-TEeQg2bY.d.ts +549 -0
  48. package/dist/detector/index.cjs +889 -0
  49. package/dist/detector/index.cjs.map +1 -0
  50. package/dist/detector/index.d.cts +112 -0
  51. package/dist/detector/index.d.ts +112 -0
  52. package/dist/detector/index.mjs +3 -0
  53. package/dist/detector/index.mjs.map +1 -0
  54. package/dist/domainProfileSchema-CwT3Ffsw.d.cts +105 -0
  55. package/dist/domainProfileSchema-CwT3Ffsw.d.ts +105 -0
  56. package/dist/extractors/index.cjs +387 -0
  57. package/dist/extractors/index.cjs.map +1 -0
  58. package/dist/extractors/index.d.cts +46 -0
  59. package/dist/extractors/index.d.ts +46 -0
  60. package/dist/extractors/index.mjs +4 -0
  61. package/dist/extractors/index.mjs.map +1 -0
  62. package/dist/feed/index.cjs +421 -0
  63. package/dist/feed/index.cjs.map +1 -0
  64. package/dist/feed/index.d.cts +23 -0
  65. package/dist/feed/index.d.ts +23 -0
  66. package/dist/feed/index.mjs +4 -0
  67. package/dist/feed/index.mjs.map +1 -0
  68. package/dist/graph/index.cjs +2167 -0
  69. package/dist/graph/index.cjs.map +1 -0
  70. package/dist/graph/index.d.cts +226 -0
  71. package/dist/graph/index.d.ts +226 -0
  72. package/dist/graph/index.mjs +4 -0
  73. package/dist/graph/index.mjs.map +1 -0
  74. package/dist/graphVerifier-DsTP9uAN.d.ts +37 -0
  75. package/dist/graphVerifier-QjgDAJce.d.cts +37 -0
  76. package/dist/hybridGraphSchema-BCgXicgA.d.cts +2840 -0
  77. package/dist/hybridGraphSchema-BCgXicgA.d.ts +2840 -0
  78. package/dist/index.cjs +5539 -0
  79. package/dist/index.cjs.map +1 -0
  80. package/dist/index.d.cts +18 -0
  81. package/dist/index.d.ts +18 -0
  82. package/dist/index.mjs +17 -0
  83. package/dist/index.mjs.map +1 -0
  84. package/dist/keywordExtractor-CKaXqSku.d.ts +34 -0
  85. package/dist/keywordExtractor-zPAz2isq.d.cts +34 -0
  86. package/dist/llmClient-ysPhLjcH.d.cts +16 -0
  87. package/dist/llmClient-ysPhLjcH.d.ts +16 -0
  88. package/dist/parsers/index.cjs +323 -0
  89. package/dist/parsers/index.cjs.map +1 -0
  90. package/dist/parsers/index.d.cts +98 -0
  91. package/dist/parsers/index.d.ts +98 -0
  92. package/dist/parsers/index.mjs +4 -0
  93. package/dist/parsers/index.mjs.map +1 -0
  94. package/dist/pipeline/index.cjs +2166 -0
  95. package/dist/pipeline/index.cjs.map +1 -0
  96. package/dist/pipeline/index.d.cts +45 -0
  97. package/dist/pipeline/index.d.ts +45 -0
  98. package/dist/pipeline/index.mjs +8 -0
  99. package/dist/pipeline/index.mjs.map +1 -0
  100. package/dist/projectGraphSchema-DnD7orZV.d.cts +2581 -0
  101. package/dist/projectGraphSchema-DnD7orZV.d.ts +2581 -0
  102. package/dist/schemas/index.cjs +675 -0
  103. package/dist/schemas/index.cjs.map +1 -0
  104. package/dist/schemas/index.d.cts +253 -0
  105. package/dist/schemas/index.d.ts +253 -0
  106. package/dist/schemas/index.mjs +4 -0
  107. package/dist/schemas/index.mjs.map +1 -0
  108. package/package.json +71 -0
@@ -0,0 +1,884 @@
1
+ // src/detector/inputTypeDetector.ts
2
+ var CODE_EXTENSIONS = /* @__PURE__ */ new Set([
3
+ ".swift",
4
+ ".ts",
5
+ ".tsx",
6
+ ".js",
7
+ ".jsx",
8
+ ".py",
9
+ ".ino",
10
+ ".cpp",
11
+ ".c",
12
+ ".h",
13
+ ".hpp",
14
+ ".kt",
15
+ ".kts",
16
+ ".java",
17
+ ".cs",
18
+ ".rb",
19
+ ".go",
20
+ ".rs",
21
+ ".php",
22
+ ".lua",
23
+ ".r",
24
+ ".m"
25
+ ]);
26
+ var NON_CODE_EXTENSIONS = /* @__PURE__ */ new Set([
27
+ ".stl",
28
+ ".obj",
29
+ ".step",
30
+ ".stp",
31
+ ".iges",
32
+ ".igs",
33
+ // 3D models
34
+ ".png",
35
+ ".jpg",
36
+ ".jpeg",
37
+ ".gif",
38
+ ".svg",
39
+ ".bmp",
40
+ // Images
41
+ ".pdf",
42
+ ".doc",
43
+ ".docx",
44
+ ".pptx",
45
+ ".xlsx",
46
+ // Documents
47
+ ".tc3",
48
+ ".f3d",
49
+ // CAD files
50
+ ".mp3",
51
+ ".wav",
52
+ ".midi",
53
+ // Audio
54
+ ".mp4",
55
+ ".avi",
56
+ ".mov"
57
+ // Video
58
+ ]);
59
+ function detectInputType(options) {
60
+ const evidence = [];
61
+ let repoScore = 0;
62
+ let syllabusScore = 0;
63
+ let filesScore = 0;
64
+ let descriptionScore = 0;
65
+ if (options.repoUrl) {
66
+ repoScore += 0.5;
67
+ evidence.push(`repoUrl provided: ${options.repoUrl}`);
68
+ }
69
+ if (options.repoDir) {
70
+ repoScore += 0.5;
71
+ evidence.push(`repoDir provided: ${options.repoDir}`);
72
+ }
73
+ if (options.syllabusText && options.syllabusText.length > 50) {
74
+ syllabusScore += 0.6;
75
+ evidence.push(`syllabusText provided (${options.syllabusText.length} chars)`);
76
+ }
77
+ if (options.chapters && options.chapters.length > 0) {
78
+ syllabusScore += 0.4;
79
+ evidence.push(`${options.chapters.length} chapters provided`);
80
+ }
81
+ if (options.fileExtensions && options.fileExtensions.length > 0) {
82
+ const codeCount = options.fileExtensions.filter((ext) => CODE_EXTENSIONS.has(ext)).length;
83
+ const nonCodeCount = options.fileExtensions.filter((ext) => NON_CODE_EXTENSIONS.has(ext)).length;
84
+ if (nonCodeCount > 0) {
85
+ filesScore += 0.7;
86
+ evidence.push(`${nonCodeCount} non-code files detected: ${options.fileExtensions.filter((ext) => NON_CODE_EXTENSIONS.has(ext)).join(", ")}`);
87
+ }
88
+ if (codeCount > 0 && repoScore === 0) {
89
+ repoScore += 0.3;
90
+ evidence.push(`${codeCount} source code files detected`);
91
+ }
92
+ }
93
+ if (options.description && options.description.length > 100) {
94
+ descriptionScore += 0.5;
95
+ evidence.push(`description provided (${options.description.length} chars)`);
96
+ }
97
+ if (options.goal && options.goal.length > 20) {
98
+ descriptionScore += 0.3;
99
+ evidence.push(`goal provided (${options.goal.length} chars)`);
100
+ }
101
+ const scores = [
102
+ { type: "repository", score: repoScore },
103
+ { type: "syllabus", score: syllabusScore },
104
+ { type: "files", score: filesScore },
105
+ { type: "description", score: descriptionScore }
106
+ ];
107
+ scores.sort((a, b) => b.score - a.score);
108
+ const winner = scores[0];
109
+ const activeTypes = scores.filter((s) => s.score >= 0.3);
110
+ if (activeTypes.length >= 2) {
111
+ return {
112
+ inputType: "mixed",
113
+ confidence: 0.7,
114
+ evidence: [...evidence, `Mixed input detected: ${activeTypes.map((t) => t.type).join(" + ")}`]
115
+ };
116
+ }
117
+ if (winner.score === 0) {
118
+ return {
119
+ inputType: "description",
120
+ confidence: 0.3,
121
+ evidence: [...evidence, "No strong signals \u2014 defaulting to description"]
122
+ };
123
+ }
124
+ return {
125
+ inputType: winner.type,
126
+ confidence: Math.min(winner.score, 1),
127
+ evidence
128
+ };
129
+ }
130
+
131
+ // src/detector/domainDetector.ts
132
+ var DOMAIN_KEYWORDS = {
133
+ software: [
134
+ "app",
135
+ "web",
136
+ "api",
137
+ "database",
138
+ "frontend",
139
+ "backend",
140
+ "mobile",
141
+ "swift",
142
+ "react",
143
+ "vue",
144
+ "angular",
145
+ "node",
146
+ "python",
147
+ "java",
148
+ "typescript",
149
+ "javascript",
150
+ "html",
151
+ "css",
152
+ "sql",
153
+ "rest",
154
+ "graphql",
155
+ "git",
156
+ "docker",
157
+ "kubernetes",
158
+ "ci/cd",
159
+ "deploy",
160
+ "swiftui",
161
+ "uikit",
162
+ "flutter",
163
+ "kotlin",
164
+ "android",
165
+ "ios",
166
+ "nextjs",
167
+ "nuxt",
168
+ "svelte",
169
+ "django",
170
+ "flask",
171
+ "express"
172
+ ],
173
+ hardware_iot: [
174
+ "arduino",
175
+ "robot",
176
+ "sensor",
177
+ "motor",
178
+ "esp32",
179
+ "gpio",
180
+ "raspberry pi",
181
+ "iot",
182
+ "firmware",
183
+ "embedded",
184
+ "microcontroller",
185
+ "led",
186
+ "servo",
187
+ "potentiometer",
188
+ "breadboard",
189
+ "soldering",
190
+ "i2c",
191
+ "spi",
192
+ "pwm",
193
+ "uart",
194
+ "analog",
195
+ "digital",
196
+ "ultrasonic",
197
+ "infrared",
198
+ "bluetooth",
199
+ "wifi module",
200
+ "pin",
201
+ "voltage",
202
+ "resistor",
203
+ "capacitor",
204
+ "circuit"
205
+ ],
206
+ "3d_design": [
207
+ "tinkercad",
208
+ "3d model",
209
+ "cad",
210
+ "parametric",
211
+ "stl",
212
+ "obj",
213
+ "fusion360",
214
+ "blender",
215
+ "solidworks",
216
+ "autocad",
217
+ "freecad",
218
+ "shape",
219
+ "dimension",
220
+ "extrude",
221
+ "revolve",
222
+ "fillet",
223
+ "chamfer",
224
+ "assembly",
225
+ "constraint",
226
+ "sketch",
227
+ "plane",
228
+ "axis",
229
+ "render",
230
+ "mesh",
231
+ "nurbs",
232
+ "surface",
233
+ "volume"
234
+ ],
235
+ math: [
236
+ // Vietnamese
237
+ "h\xECnh h\u1ECDc",
238
+ "\u0111\u1EA1i s\u1ED1",
239
+ "gi\u1EA3i t\xEDch",
240
+ "x\xE1c su\u1EA5t",
241
+ "th\u1ED1ng k\xEA",
242
+ "tam gi\xE1c",
243
+ "\u0111\u01B0\u1EDDng tr\xF2n",
244
+ "ph\u01B0\u01A1ng tr\xECnh",
245
+ "b\u1EA5t ph\u01B0\u01A1ng tr\xECnh",
246
+ "s\u1ED1 h\u1ECDc",
247
+ "t\u1ED5 h\u1EE3p",
248
+ "ho\xE1n v\u1ECB",
249
+ "\u0111\u1ED9 \u0111o",
250
+ "g\xF3c",
251
+ "c\u1EA1nh",
252
+ "di\u1EC7n t\xEDch",
253
+ "th\u1EC3 t\xEDch",
254
+ "chu vi",
255
+ "\u0111\u01B0\u1EDDng cao",
256
+ "trung tuy\u1EBFn",
257
+ // English
258
+ "geometry",
259
+ "algebra",
260
+ "calculus",
261
+ "trigonometry",
262
+ "logarithm",
263
+ "probability",
264
+ "statistics",
265
+ "derivative",
266
+ "integral",
267
+ "matrix",
268
+ "vector",
269
+ "theorem",
270
+ "proof",
271
+ "angle",
272
+ "perimeter",
273
+ "area",
274
+ // Chinese
275
+ "\u51E0\u4F55",
276
+ "\u4EE3\u6570",
277
+ "\u5FAE\u79EF\u5206",
278
+ "\u6982\u7387",
279
+ "\u7EDF\u8BA1",
280
+ "\u4E09\u89D2\u5F62",
281
+ "\u5706",
282
+ "\u65B9\u7A0B",
283
+ // Japanese
284
+ "\u5E7E\u4F55",
285
+ "\u4EE3\u6570",
286
+ "\u5FAE\u5206",
287
+ "\u7A4D\u5206",
288
+ "\u78BA\u7387",
289
+ "\u7D71\u8A08",
290
+ // French
291
+ "g\xE9om\xE9trie",
292
+ "alg\xE8bre",
293
+ "calcul",
294
+ "trigonom\xE9trie",
295
+ "probabilit\xE9"
296
+ ],
297
+ science: [
298
+ // Vietnamese
299
+ "l\xFD thuy\u1EBFt",
300
+ "nguy\xEAn l\xFD",
301
+ "th\xED nghi\u1EC7m",
302
+ "\u0111i\u1EC7n",
303
+ "l\u1EF1c",
304
+ "h\xF3a h\u1ECDc",
305
+ "sinh h\u1ECDc",
306
+ "v\u1EADt l\xFD",
307
+ "\u0111\u1ECBa l\xFD",
308
+ "ph\u1EA3n \u1EE9ng",
309
+ "nguy\xEAn t\u1ED1",
310
+ "ph\xE2n t\u1EED",
311
+ "n\u0103ng l\u01B0\u1EE3ng",
312
+ "c\u1EA3m \u1EE9ng",
313
+ "t\u1EEB tr\u01B0\u1EDDng",
314
+ "quang h\u1ECDc",
315
+ "m\xF4i tr\u01B0\u1EDDng",
316
+ "sinh th\xE1i",
317
+ // English
318
+ "physics",
319
+ "chemistry",
320
+ "biology",
321
+ "earth science",
322
+ "cell",
323
+ "gene",
324
+ "evolution",
325
+ "ecosystem",
326
+ "molecule",
327
+ "atom",
328
+ // Chinese
329
+ "\u7269\u7406",
330
+ "\u5316\u5B66",
331
+ "\u751F\u7269",
332
+ "\u5730\u7406",
333
+ // Japanese
334
+ "\u7269\u7406",
335
+ "\u5316\u5B66",
336
+ "\u751F\u7269",
337
+ // French
338
+ "physique",
339
+ "chimie",
340
+ "biologie"
341
+ ],
342
+ language: [
343
+ // Vietnamese
344
+ "ti\u1EBFng anh",
345
+ "ti\u1EBFng vi\u1EC7t",
346
+ "ng\u1EEF ph\xE1p",
347
+ "t\u1EEB v\u1EF1ng",
348
+ "\u0111\u1ECDc",
349
+ "vi\u1EBFt",
350
+ "n\xF3i",
351
+ "nghe",
352
+ // English
353
+ "grammar",
354
+ "vocabulary",
355
+ "writing",
356
+ "reading",
357
+ "speaking",
358
+ "listening",
359
+ "pronunciation",
360
+ "essay",
361
+ "paragraph",
362
+ "sentence",
363
+ "verb",
364
+ "noun",
365
+ "adjective",
366
+ "ielts",
367
+ "toeic",
368
+ "toefl",
369
+ // Chinese
370
+ "\u82F1\u8BED",
371
+ "\u8BED\u6CD5",
372
+ "\u8BCD\u6C47",
373
+ "\u9605\u8BFB",
374
+ "\u5199\u4F5C",
375
+ // Japanese
376
+ "\u82F1\u8A9E",
377
+ "\u6587\u6CD5",
378
+ "\u8A9E\u5F59",
379
+ "\u8AAD\u89E3",
380
+ "\u4F5C\u6587",
381
+ // French
382
+ "anglais",
383
+ "grammaire",
384
+ "vocabulaire",
385
+ "lecture",
386
+ "\xE9criture"
387
+ ],
388
+ arts: [
389
+ // Vietnamese
390
+ "\xE2m nh\u1EA1c",
391
+ "nh\u1EA1c l\xFD",
392
+ "solf\xE8ge",
393
+ "\u0111\xE0n",
394
+ "piano",
395
+ "guitar",
396
+ "h\u1ED9i h\u1ECDa",
397
+ "thi\u1EBFt k\u1EBF",
398
+ "nhi\u1EBFp \u1EA3nh",
399
+ "tranh",
400
+ "m\xE0u",
401
+ "s\xE1ng t\xE1c",
402
+ "bi\xEAn kh\xFAc",
403
+ // English
404
+ "music",
405
+ "art",
406
+ "painting",
407
+ "drawing",
408
+ "sketch",
409
+ "photography",
410
+ "color theory",
411
+ "composition",
412
+ "typography",
413
+ "layout",
414
+ "digital art",
415
+ "illustration",
416
+ "figma",
417
+ // Chinese
418
+ "\u97F3\u4E50",
419
+ "\u7F8E\u672F",
420
+ "\u7ED8\u753B",
421
+ "\u6444\u5F71",
422
+ "\u8BBE\u8BA1",
423
+ // Japanese
424
+ "\u97F3\u697D",
425
+ "\u7F8E\u8853",
426
+ "\u7D75\u753B",
427
+ "\u5199\u771F",
428
+ "\u30C7\u30B6\u30A4\u30F3",
429
+ // French
430
+ "musique",
431
+ "art",
432
+ "peinture",
433
+ "dessin",
434
+ "photographie"
435
+ ],
436
+ research: [
437
+ // Vietnamese
438
+ "nghi\xEAn c\u1EE9u",
439
+ "th\u1ED1ng k\xEA",
440
+ "ph\u01B0\u01A1ng ph\xE1p lu\u1EADn",
441
+ "ph\xE2n t\xEDch d\u1EEF li\u1EC7u",
442
+ "\u0111\u1ECBnh t\xEDnh",
443
+ "\u0111\u1ECBnh l\u01B0\u1EE3ng",
444
+ "gi\u1EA3 thuy\u1EBFt",
445
+ "m\u1EABu",
446
+ "t\u1ED5ng th\u1EC3",
447
+ "t\u01B0\u01A1ng quan",
448
+ "h\u1ED3i quy",
449
+ "t\xE0i li\u1EC7u tham kh\u1EA3o",
450
+ "tr\xEDch d\u1EABn",
451
+ "t\xF3m t\u1EAFt",
452
+ // English
453
+ "research",
454
+ "survey",
455
+ "methodology",
456
+ "data analysis",
457
+ "qualitative",
458
+ "quantitative",
459
+ "hypothesis",
460
+ "experiment",
461
+ "sample",
462
+ "population",
463
+ "correlation",
464
+ "regression",
465
+ "literature review",
466
+ "citation",
467
+ "abstract",
468
+ // Chinese
469
+ "\u7814\u7A76",
470
+ "\u8C03\u67E5",
471
+ "\u65B9\u6CD5\u8BBA",
472
+ "\u6570\u636E\u5206\u6790",
473
+ // Japanese
474
+ "\u7814\u7A76",
475
+ "\u8ABF\u67FB",
476
+ "\u65B9\u6CD5\u8AD6",
477
+ "\u30C7\u30FC\u30BF\u5206\u6790",
478
+ // French
479
+ "recherche",
480
+ "enqu\xEAte",
481
+ "m\xE9thodologie",
482
+ "analyse de donn\xE9es"
483
+ ],
484
+ business: [
485
+ // Vietnamese
486
+ "kinh doanh",
487
+ "t\xE0i ch\xEDnh",
488
+ "qu\u1EA3n l\xFD",
489
+ "marketing",
490
+ "b\xE1n h\xE0ng",
491
+ "kh\u1EDFi nghi\u1EC7p",
492
+ "k\u1EBF ho\u1EA1ch kinh doanh",
493
+ "doanh thu",
494
+ "l\u1EE3i nhu\u1EADn",
495
+ "qu\u1EA3n tr\u1ECB",
496
+ "t\xE0i kho\u1EA3n",
497
+ "\u0111\u1EA7u t\u01B0",
498
+ "ng\xE2n s\xE1ch",
499
+ // English
500
+ "business",
501
+ "finance",
502
+ "accounting",
503
+ "investment",
504
+ "budget",
505
+ "startup",
506
+ "revenue",
507
+ "profit",
508
+ "roi",
509
+ "sales",
510
+ "product management",
511
+ "agile",
512
+ "scrum",
513
+ "kanban",
514
+ // Chinese
515
+ "\u5546\u4E1A",
516
+ "\u91D1\u878D",
517
+ "\u4F1A\u8BA1",
518
+ "\u6295\u8D44",
519
+ "\u8425\u9500",
520
+ // Japanese
521
+ "\u30D3\u30B8\u30CD\u30B9",
522
+ "\u91D1\u878D",
523
+ "\u4F1A\u8A08",
524
+ "\u6295\u8CC7",
525
+ "\u30DE\u30FC\u30B1\u30C6\u30A3\u30F3\u30B0",
526
+ // French
527
+ "affaires",
528
+ "finance",
529
+ "comptabilit\xE9",
530
+ "investissement"
531
+ ],
532
+ other: []
533
+ };
534
+ var EXTENSION_DOMAIN = {
535
+ ".swift": "software",
536
+ ".ts": "software",
537
+ ".tsx": "software",
538
+ ".js": "software",
539
+ ".jsx": "software",
540
+ ".py": "software",
541
+ ".kt": "software",
542
+ ".kts": "software",
543
+ ".java": "software",
544
+ ".cs": "software",
545
+ ".go": "software",
546
+ ".rs": "software",
547
+ ".rb": "software",
548
+ ".php": "software",
549
+ ".lua": "software",
550
+ ".r": "software",
551
+ // .ino is ALWAYS hardware
552
+ ".ino": "hardware_iot",
553
+ // .cpp/.c/.h are CONTEXT-DEPENDENT → resolve in detection logic
554
+ ".stl": "3d_design",
555
+ ".obj": "3d_design",
556
+ ".step": "3d_design",
557
+ ".stp": "3d_design",
558
+ ".tc3": "3d_design",
559
+ ".f3d": "3d_design"
560
+ };
561
+ var AMBIGUOUS_EXTENSIONS = /* @__PURE__ */ new Set([".cpp", ".c", ".h", ".hpp"]);
562
+ var LANG_PATTERNS = [
563
+ { lang: "vi", patterns: [/[ạảãàáạảãạ]/i, /\bgiải\b/, /\btính\b/] },
564
+ { lang: "zh", patterns: [/[\u4e00-\u9fff]{2,}/] },
565
+ { lang: "ja", patterns: [/[\u3040-\u309f\u30a0-\u30ff]{2,}/] },
566
+ { lang: "ko", patterns: [/[\uac00-\ud7af]{2,}/] },
567
+ { lang: "fr", patterns: [/\b(la|le|les|des|une|est|sont|avec|pour|dans)\b/i] }
568
+ ];
569
+ function detectSyllabusLanguage(text) {
570
+ for (const { lang, patterns } of LANG_PATTERNS) {
571
+ if (patterns.some((p) => p.test(text))) return lang;
572
+ }
573
+ return "en";
574
+ }
575
+ function detectDomain(options) {
576
+ const evidence = [];
577
+ const detectedTechStack = [];
578
+ let detectedSubject = "";
579
+ let ambiguous;
580
+ const scores = {
581
+ software: 0,
582
+ hardware_iot: 0,
583
+ "3d_design": 0,
584
+ math: 0,
585
+ science: 0,
586
+ language: 0,
587
+ arts: 0,
588
+ research: 0,
589
+ business: 0,
590
+ other: 0
591
+ };
592
+ const hasHardwareContext = !!(options.techStack?.toLowerCase().match(/arduino|esp32|raspberry|embedded|iot/) || options.description?.toLowerCase().match(/arduino|robot|sensor|motor|circuit/) || options.goal?.toLowerCase().match(/arduino|robot|sensor|motor|circuit/));
593
+ const hasSoftwareContext = !!(options.techStack?.toLowerCase().match(/swift|react|vue|angular|python|java|typescript|javascript/) || options.description?.toLowerCase().match(/app|web|api|frontend|backend|mobile/) || options.goal?.toLowerCase().match(/app|web|api|frontend|backend|mobile/));
594
+ if (options.fileExtensions) {
595
+ for (const ext of options.fileExtensions) {
596
+ const extLower = ext.toLowerCase();
597
+ if (extLower === ".ino") {
598
+ scores.hardware_iot += 0.5;
599
+ evidence.push(`File extension ${ext} \u2192 hardware_iot (always)`);
600
+ continue;
601
+ }
602
+ if (AMBIGUOUS_EXTENSIONS.has(extLower)) {
603
+ if (hasHardwareContext && !hasSoftwareContext) {
604
+ scores.hardware_iot += 0.3;
605
+ evidence.push(`File extension ${ext} \u2192 hardware_iot (hardware context)`);
606
+ } else if (hasSoftwareContext && !hasHardwareContext) {
607
+ scores.software += 0.3;
608
+ evidence.push(`File extension ${ext} \u2192 software (software context)`);
609
+ } else if (hasHardwareContext && hasSoftwareContext) {
610
+ scores.software += 0.15;
611
+ scores.hardware_iot += 0.15;
612
+ evidence.push(`File extension ${ext} \u2192 ambiguous (both software and hardware context)`);
613
+ ambiguous = {
614
+ domain1: "software",
615
+ domain2: "hardware_iot",
616
+ reason: `.cpp/.c/.h files present with both software and hardware context keywords`
617
+ };
618
+ } else {
619
+ scores.software += 0.2;
620
+ evidence.push(`File extension ${ext} \u2192 software (default, no context)`);
621
+ }
622
+ continue;
623
+ }
624
+ const domain = EXTENSION_DOMAIN[extLower];
625
+ if (domain) {
626
+ scores[domain] += 0.3;
627
+ evidence.push(`File extension ${ext} \u2192 ${domain}`);
628
+ }
629
+ }
630
+ }
631
+ const textContent = [
632
+ options.description || "",
633
+ options.goal || "",
634
+ options.syllabusText || ""
635
+ ].join(" ").toLowerCase();
636
+ for (const [domain, keywords] of Object.entries(DOMAIN_KEYWORDS)) {
637
+ const cat = domain;
638
+ for (const kw of keywords) {
639
+ if (textContent.includes(kw.toLowerCase())) {
640
+ scores[cat] += 0.1;
641
+ if (!evidence.some((e) => e.includes(`"${kw}"`))) {
642
+ evidence.push(`Keyword "${kw}" \u2192 ${cat}`);
643
+ }
644
+ }
645
+ }
646
+ }
647
+ if (options.techStack) {
648
+ const techItems = options.techStack.split(",").map((t) => t.trim());
649
+ for (const tech of techItems) {
650
+ const techL = tech.toLowerCase();
651
+ if (["swift", "swiftui", "uikit", "ios"].some((k) => techL.includes(k))) {
652
+ scores.software += 0.4;
653
+ detectedTechStack.push(tech);
654
+ } else if (["react", "vue", "angular", "next", "nuxt", "typescript", "javascript"].some((k) => techL.includes(k))) {
655
+ scores.software += 0.4;
656
+ detectedTechStack.push(tech);
657
+ } else if (["python", "django", "flask"].some((k) => techL.includes(k))) {
658
+ scores.software += 0.3;
659
+ detectedTechStack.push(tech);
660
+ } else if (["arduino", "esp32", "raspberry"].some((k) => techL.includes(k))) {
661
+ scores.hardware_iot += 0.5;
662
+ detectedTechStack.push(tech);
663
+ } else if (["tinkercad", "fusion360", "blender"].some((k) => techL.includes(k))) {
664
+ scores["3d_design"] += 0.5;
665
+ detectedTechStack.push(tech);
666
+ } else if (["c++", "c", "cpp"].some((k) => techL === k || techL.endsWith(k))) {
667
+ if (hasHardwareContext) {
668
+ scores.hardware_iot += 0.3;
669
+ } else {
670
+ scores.software += 0.3;
671
+ }
672
+ detectedTechStack.push(tech);
673
+ }
674
+ }
675
+ }
676
+ if (options.syllabusText) {
677
+ const syllabusLang = detectSyllabusLanguage(options.syllabusText);
678
+ const syllabusLower = options.syllabusText.toLowerCase();
679
+ if (syllabusLower.includes("h\xECnh h\u1ECDc") || syllabusLower.includes("\u0111\u1EA1i s\u1ED1") || syllabusLower.includes("geometry") || syllabusLower.includes("algebra") || syllabusLower.includes("\u51E0\u4F55") || syllabusLower.includes("\u4EE3\u6570") || syllabusLower.includes("\u5E7E\u4F55") || syllabusLower.includes("\u4EE3\u6570") || syllabusLower.includes("g\xE9om\xE9trie") || syllabusLower.includes("alg\xE8bre")) {
680
+ scores.math += 0.5;
681
+ detectedSubject = "Mathematics";
682
+ } else if (syllabusLower.includes("v\u1EADt l\xFD") || syllabusLower.includes("h\xF3a") || syllabusLower.includes("sinh") || syllabusLower.includes("physics") || syllabusLower.includes("chemistry") || syllabusLower.includes("biology") || syllabusLower.includes("\u7269\u7406") || syllabusLower.includes("\u5316\u5B66") || syllabusLower.includes("\u7269\u7406") || syllabusLower.includes("\u5316\u5B66") || syllabusLower.includes("physique") || syllabusLower.includes("chimie")) {
683
+ scores.science += 0.5;
684
+ detectedSubject = "Natural Science";
685
+ } else if (syllabusLower.includes("ti\u1EBFng anh") || syllabusLower.includes("english") || syllabusLower.includes("grammar") || syllabusLower.includes("\u82F1\u8BED") || syllabusLower.includes("\u82F1\u8A9E") || syllabusLower.includes("anglais")) {
686
+ scores.language += 0.5;
687
+ detectedSubject = "English Language";
688
+ }
689
+ evidence.push(`Syllabus language detected: ${syllabusLang}`);
690
+ }
691
+ const entries = Object.entries(scores).filter(([k]) => k !== "other");
692
+ entries.sort((a, b) => b[1] - a[1]);
693
+ const [winner, winnerScore] = entries[0];
694
+ if (winnerScore === 0) {
695
+ return {
696
+ domainCategory: "other",
697
+ confidence: 0.2,
698
+ evidence: [...evidence, "No domain signals detected"],
699
+ detectedTechStack,
700
+ detectedSubject
701
+ };
702
+ }
703
+ const second = entries[1];
704
+ if (second && winnerScore - second[1] < 0.15 && winnerScore > 0) {
705
+ ambiguous = {
706
+ domain1: winner,
707
+ domain2: second[0],
708
+ reason: `Scores very close: ${winner}=${winnerScore.toFixed(2)}, ${second[0]}=${second[1].toFixed(2)}`
709
+ };
710
+ }
711
+ const totalScore = entries.reduce((sum, [, s]) => sum + s, 0);
712
+ const confidence = totalScore > 0 ? Math.min(winnerScore / totalScore + 0.3, 1) : 0.3;
713
+ return {
714
+ domainCategory: winner,
715
+ confidence,
716
+ evidence: evidence.slice(0, 20),
717
+ detectedTechStack,
718
+ detectedSubject,
719
+ ambiguous
720
+ };
721
+ }
722
+
723
+ // src/detector/learningModeDetector.ts
724
+ var BUILD_VERBS = [
725
+ "build",
726
+ "create",
727
+ "develop",
728
+ "implement",
729
+ "construct",
730
+ "make",
731
+ "x\xE2y d\u1EF1ng",
732
+ "t\u1EA1o",
733
+ "ph\xE1t tri\u1EC3n",
734
+ "tri\u1EC3n khai",
735
+ "l\u1EAFp r\xE1p",
736
+ "code",
737
+ "program",
738
+ "design a",
739
+ "set up",
740
+ "deploy"
741
+ ];
742
+ var UNDERSTAND_VERBS = [
743
+ "understand",
744
+ "learn",
745
+ "grasp",
746
+ "comprehend",
747
+ "master",
748
+ "hi\u1EC3u",
749
+ "n\u1EAFm v\u1EEFng",
750
+ "h\u1ECDc",
751
+ "ti\u1EBFp thu",
752
+ "am hi\u1EC3u",
753
+ "v\u1EADn d\u1EE5ng",
754
+ "ph\xE2n t\xEDch",
755
+ "\u0111\xE1nh gi\xE1",
756
+ "so s\xE1nh",
757
+ "explain",
758
+ "describe",
759
+ "analyze",
760
+ "evaluate",
761
+ "compare"
762
+ ];
763
+ var CONCEPT_DOMAINS = ["math", "science", "language", "arts", "research", "business"];
764
+ var PRODUCT_DOMAINS = ["software", "hardware_iot", "3d_design"];
765
+ function detectLearningMode(options) {
766
+ const evidence = [];
767
+ const text = [options.goal || "", options.description || ""].join(" ").toLowerCase();
768
+ let productScore = 0;
769
+ let conceptScore = 0;
770
+ if (options.hasRepo) {
771
+ productScore += 0.3;
772
+ evidence.push("Repository present \u2192 product signal");
773
+ }
774
+ if (options.hasSyllabus) {
775
+ conceptScore += 0.3;
776
+ evidence.push("Syllabus present \u2192 concept signal");
777
+ }
778
+ if (PRODUCT_DOMAINS.includes(options.domainCategory)) {
779
+ productScore += 0.2;
780
+ evidence.push(`Domain ${options.domainCategory} \u2192 product\u503E\u5411`);
781
+ }
782
+ if (CONCEPT_DOMAINS.includes(options.domainCategory)) {
783
+ conceptScore += 0.2;
784
+ evidence.push(`Domain ${options.domainCategory} \u2192 concept\u503E\u5411`);
785
+ }
786
+ const hasBuildVerbs = BUILD_VERBS.some((v) => text.includes(v));
787
+ const hasUnderstandVerbs = UNDERSTAND_VERBS.some((v) => text.includes(v));
788
+ if (hasBuildVerbs) {
789
+ productScore += 0.3;
790
+ evidence.push("Build verbs detected in goal/description");
791
+ }
792
+ if (hasUnderstandVerbs) {
793
+ conceptScore += 0.3;
794
+ evidence.push("Understand verbs detected in goal/description");
795
+ }
796
+ const total = productScore + conceptScore;
797
+ if (total === 0) {
798
+ return {
799
+ learningMode: "product",
800
+ confidence: 0.3,
801
+ evidence: [...evidence, "No signals \u2014 defaulting to product"]
802
+ };
803
+ }
804
+ if (productScore >= 0.3 && conceptScore >= 0.3) {
805
+ const hybridConf = Math.min((productScore + conceptScore) / 2, 1);
806
+ return {
807
+ learningMode: "hybrid",
808
+ confidence: hybridConf,
809
+ evidence: [...evidence, `Mixed signals: product=${productScore.toFixed(2)}, concept=${conceptScore.toFixed(2)} \u2192 hybrid`]
810
+ };
811
+ }
812
+ if (productScore > conceptScore) {
813
+ const raw2 = total > 0 ? productScore / total : 0.5;
814
+ return {
815
+ learningMode: "product",
816
+ confidence: Math.min(Math.max(raw2, 0) + 0.2, 1),
817
+ evidence
818
+ };
819
+ }
820
+ const raw = total > 0 ? conceptScore / total : 0.5;
821
+ return {
822
+ learningMode: "concept",
823
+ confidence: Math.min(Math.max(raw, 0) + 0.2, 1),
824
+ evidence
825
+ };
826
+ }
827
+
828
+ // src/detector/domainProfileDetector.ts
829
+ function detectDomainProfile(options) {
830
+ const inputResult = detectInputType(options);
831
+ const domainResult = detectDomain({
832
+ description: options.description,
833
+ goal: options.goal,
834
+ syllabusText: options.syllabusText,
835
+ techStack: options.techStack,
836
+ fileExtensions: options.fileExtensions,
837
+ repoUrl: options.repoUrl
838
+ });
839
+ const modeResult = detectLearningMode({
840
+ inputType: inputResult.inputType,
841
+ domainCategory: domainResult.domainCategory,
842
+ goal: options.goal,
843
+ description: options.description,
844
+ hasRepo: !!(options.repoUrl || options.repoDir),
845
+ hasSyllabus: !!(options.syllabusText || options.chapters && options.chapters.length > 0)
846
+ });
847
+ const graphType = determineGraphType(modeResult.learningMode);
848
+ return {
849
+ inputType: inputResult.inputType,
850
+ domainCategory: domainResult.domainCategory,
851
+ learningMode: modeResult.learningMode,
852
+ graphType,
853
+ confidence: {
854
+ inputType: inputResult.confidence,
855
+ domainCategory: domainResult.confidence,
856
+ learningMode: modeResult.confidence
857
+ },
858
+ evidence: [...inputResult.evidence, ...domainResult.evidence, ...modeResult.evidence],
859
+ detectedTechStack: domainResult.detectedTechStack,
860
+ detectedSubject: domainResult.detectedSubject,
861
+ detectedDomain: domainResult.domainCategory,
862
+ goal: options.goal || "",
863
+ description: options.description || "",
864
+ repoUrl: options.repoUrl || "",
865
+ repoDir: options.repoDir || "",
866
+ syllabusText: options.syllabusText || ""
867
+ };
868
+ }
869
+ function determineGraphType(learningMode) {
870
+ switch (learningMode) {
871
+ case "product":
872
+ return "project_graph";
873
+ case "concept":
874
+ return "knowledge_graph";
875
+ case "hybrid":
876
+ return "hybrid_graph";
877
+ default:
878
+ return "project_graph";
879
+ }
880
+ }
881
+
882
+ export { detectDomain, detectDomainProfile, detectInputType, detectLearningMode };
883
+ //# sourceMappingURL=chunk-VFART56O.mjs.map
884
+ //# sourceMappingURL=chunk-VFART56O.mjs.map