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