@thanh01.pmt/research-kit 1.2.3 → 1.3.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 (69) hide show
  1. package/dist/academic/index.cjs +122 -0
  2. package/dist/academic/index.cjs.map +1 -1
  3. package/dist/academic/index.d.cts +27 -4
  4. package/dist/academic/index.d.ts +27 -4
  5. package/dist/academic/index.js +2 -1
  6. package/dist/agent/index.cjs +3441 -0
  7. package/dist/agent/index.cjs.map +1 -0
  8. package/dist/agent/index.d.cts +10 -0
  9. package/dist/agent/index.d.ts +10 -0
  10. package/dist/agent/index.js +10 -0
  11. package/dist/agent/index.js.map +1 -0
  12. package/dist/{catalogBuilder-B4eiLS_S.d.cts → catalogBuilder-BBCa9jqI.d.cts} +2 -2
  13. package/dist/{catalogBuilder-BNB_gaWP.d.ts → catalogBuilder-D-UiM37y.d.ts} +2 -2
  14. package/dist/chunk-2GBXVPOQ.js +3 -0
  15. package/dist/{chunk-J3VCGH7Z.js.map → chunk-2GBXVPOQ.js.map} +1 -1
  16. package/dist/chunk-2RMBLKP5.js +581 -0
  17. package/dist/chunk-2RMBLKP5.js.map +1 -0
  18. package/dist/{chunk-2XIEWCUE.js → chunk-32B5PVTQ.js} +2 -2
  19. package/dist/{chunk-2XIEWCUE.js.map → chunk-32B5PVTQ.js.map} +1 -1
  20. package/dist/chunk-LDCZ33AC.js +3 -0
  21. package/dist/chunk-LDCZ33AC.js.map +1 -0
  22. package/dist/chunk-NSY6KU4G.js +125 -0
  23. package/dist/chunk-NSY6KU4G.js.map +1 -0
  24. package/dist/{chunk-SAHBBO3U.js → chunk-RYLZYZRF.js} +4 -580
  25. package/dist/chunk-RYLZYZRF.js.map +1 -0
  26. package/dist/{chunk-P6RHBJY2.js → chunk-S3JUCDKD.js} +62 -40
  27. package/dist/chunk-S3JUCDKD.js.map +1 -0
  28. package/dist/chunk-TYQEC24G.js +3 -0
  29. package/dist/chunk-TYQEC24G.js.map +1 -0
  30. package/dist/chunk-WWQ45RQK.js +1114 -0
  31. package/dist/chunk-WWQ45RQK.js.map +1 -0
  32. package/dist/{chunk-YICMTZS5.js → chunk-ZNGU4ZYX.js} +171 -3
  33. package/dist/chunk-ZNGU4ZYX.js.map +1 -0
  34. package/dist/config/index.d.cts +1 -1
  35. package/dist/config/index.d.ts +1 -1
  36. package/dist/evidence/index.d.cts +2 -2
  37. package/dist/evidence/index.d.ts +2 -2
  38. package/dist/evidence/index.js +2 -1
  39. package/dist/harvester/index.cjs +168 -1
  40. package/dist/harvester/index.cjs.map +1 -1
  41. package/dist/harvester/index.d.cts +5 -161
  42. package/dist/harvester/index.d.ts +5 -161
  43. package/dist/harvester/index.js +4 -2
  44. package/dist/index-CN8gei7k.d.ts +518 -0
  45. package/dist/{index-9rDiFuR4.d.ts → index-CxoD81QN.d.cts} +1 -1
  46. package/dist/{index-9rDiFuR4.d.cts → index-CxoD81QN.d.ts} +1 -1
  47. package/dist/index-onQDKDNo.d.cts +518 -0
  48. package/dist/index.cjs +1463 -36
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +11 -174
  51. package/dist/index.d.ts +11 -174
  52. package/dist/index.js +25 -10
  53. package/dist/index.js.map +1 -1
  54. package/dist/{literatureReview-DOzgm9Q2.d.ts → literatureReview-Bn2iEGRO.d.ts} +1 -1
  55. package/dist/{literatureReview-BwidpYJo.d.cts → literatureReview-Bvlqk4DB.d.cts} +1 -1
  56. package/dist/pipeline/index.cjs +59 -38
  57. package/dist/pipeline/index.cjs.map +1 -1
  58. package/dist/pipeline/index.d.cts +5 -4
  59. package/dist/pipeline/index.d.ts +5 -4
  60. package/dist/pipeline/index.js +3 -2
  61. package/dist/socialPulseHarvester-CN4MwrpY.d.cts +204 -0
  62. package/dist/socialPulseHarvester-IbdT3zD1.d.ts +204 -0
  63. package/dist/{webScraper-CAQjE46m.d.cts → webScraper-BVvNW4yj.d.cts} +1 -1
  64. package/dist/{webScraper-CXIpvyA6.d.ts → webScraper-C9pB5Rgd.d.ts} +1 -1
  65. package/package.json +6 -1
  66. package/dist/chunk-J3VCGH7Z.js +0 -3
  67. package/dist/chunk-P6RHBJY2.js.map +0 -1
  68. package/dist/chunk-SAHBBO3U.js.map +0 -1
  69. package/dist/chunk-YICMTZS5.js.map +0 -1
@@ -605,7 +605,7 @@ var MultiSourceSearchEngine = class {
605
605
  if (adapter && (!preferred || preferred === "custom")) {
606
606
  try {
607
607
  const customResults = await adapter.search(query, { limit, domainFilter: options.domainFilter });
608
- if (Array.isArray(customResults) && customResults.length > 0) {
608
+ if (Array.isArray(customResults)) {
609
609
  return customResults.map((r) => ({
610
610
  title: r.title,
611
611
  url: r.url,
@@ -2821,30 +2821,17 @@ var TechnicalGroundingEngine = class {
2821
2821
  preservedKeyExcerpts.push(...s.keyExcerpts);
2822
2822
  }
2823
2823
  }
2824
- const defaultExemplars = scrapedSnippets.length > 0 ? [
2825
- {
2826
- title: scrapedSnippets[0].title || `${topic} Practical Foundation`,
2827
- description: scrapedSnippets[0].excerpt ? scrapedSnippets[0].excerpt.slice(0, 220) : `Hands-on implementation project for ${topic}.`,
2828
- targetAudience: `Students aged ${ageBand[0]}-${ageBand[1]}`,
2829
- sourceUrl: scrapedSnippets[0].url,
2830
- hardwareRequirements: hardware ? [hardware] : void 0,
2831
- softwareRequirements: software ? [software] : void 0
2832
- }
2833
- ] : [];
2834
- const defaultBottlenecks = scrapedSnippets.length > 0 ? domain === "hardware" || Boolean(hardware) ? [
2835
- "Power supply decoupling and current sufficiency when powering sensors or actuators.",
2836
- "Logic level shifting and hardware pin mapping conflicts."
2837
- ] : [
2838
- "SDK/runtime version compatibility and local environment dependencies."
2839
- ] : [];
2824
+ const defaultExemplars = [];
2825
+ const defaultBottlenecks = [];
2840
2826
  let factsheet = {
2841
2827
  topic,
2842
2828
  domain,
2829
+ evidenceBacked: false,
2843
2830
  compatibilityMatrix: {
2844
2831
  hardwarePlatform: hardware || void 0,
2845
2832
  softwareEnv: software || void 0,
2846
2833
  verifiedCompatible: true,
2847
- notes: hardware || software ? [`Targeting ${hardware || "General Platform"} with ${software || "Standard SDK"}.`] : [`Baseline technical verification for ${topic}.`]
2834
+ notes: []
2848
2835
  },
2849
2836
  ageFeasibility: {
2850
2837
  recommendedMinAge: ageBand[0],
@@ -2854,7 +2841,7 @@ var TechnicalGroundingEngine = class {
2854
2841
  },
2855
2842
  exemplarProjects: defaultExemplars,
2856
2843
  technicalBottlenecks: defaultBottlenecks,
2857
- groundingSources: scrapedSnippets.map((s) => ({ title: s.title, url: s.url })),
2844
+ groundingSources: scrapedSnippets.filter((s) => Boolean(s.url)).map((s) => ({ title: s.title, url: s.url })),
2858
2845
  markdownReport: "",
2859
2846
  codeSnippets: preservedCodeSnippets.slice(0, 4),
2860
2847
  pinoutTables: preservedTables.slice(0, 4),
@@ -2862,9 +2849,10 @@ var TechnicalGroundingEngine = class {
2862
2849
  };
2863
2850
  if (llm && scrapedSnippets.length > 0) {
2864
2851
  try {
2852
+ const roleByDomain = domain === "hardware" ? "Hardware & Embedded Systems Curriculum Specialist" : domain === "software" ? "Software & Technology Curriculum Specialist" : "Applied Subject Matter & Curriculum Specialist";
2865
2853
  const prompt = [
2866
- `You are a Lead STEM Curriculum Engineer. Analyze these research excerpts for topic: "${topic}".`,
2867
- `Hardware: ${hardware || "N/A"}, Software/Env: ${software || "N/A"}, Student Age Band: ${ageBand[0]}-${ageBand[1]} years old.`,
2854
+ `You are a ${roleByDomain}. Analyze these verified research excerpts for topic: "${topic}".`,
2855
+ `Domain: ${domain}, Hardware: ${hardware || "N/A"}, Software/Env: ${software || "N/A"}, Student Age Band: ${ageBand[0]}-${ageBand[1]} years old.`,
2868
2856
  `
2869
2857
  Harvested Sources:
2870
2858
  ${scrapedSnippets.map((s, i) => {
@@ -2881,7 +2869,7 @@ ${c.code}
2881
2869
  return parts.join("\n");
2882
2870
  }).join("\n\n")}`,
2883
2871
  `
2884
- Synthesize a strictly valid JSON object with:`,
2872
+ Synthesize a strictly valid JSON object based ONLY on the evidence above. If no evidence exists for a field, leave it as an empty array [] without inventing facts:`,
2885
2873
  `{`,
2886
2874
  ` "compatibilityVerdict": boolean,`,
2887
2875
  ` "compatibilityNotes": string[],`,
@@ -2916,10 +2904,28 @@ Synthesize a strictly valid JSON object with:`,
2916
2904
  }));
2917
2905
  }
2918
2906
  if (Array.isArray(parsed.technicalBottlenecks)) factsheet.technicalBottlenecks = parsed.technicalBottlenecks.map(String);
2907
+ if (factsheet.exemplarProjects.length > 0 || factsheet.technicalBottlenecks.length > 0) {
2908
+ factsheet.evidenceBacked = true;
2909
+ }
2919
2910
  }
2920
2911
  } catch (err) {
2921
2912
  console.warn("[TechnicalGroundingEngine] LLM synthesis error:", err?.message || err);
2922
2913
  }
2914
+ } else if (scrapedSnippets.length > 0 && scrapedSnippets[0]?.excerpt?.trim()) {
2915
+ const first = scrapedSnippets[0];
2916
+ if (first.title || first.excerpt) {
2917
+ factsheet.exemplarProjects = [
2918
+ {
2919
+ title: first.title || `${topic} Hands-on Foundation Project`,
2920
+ description: first.excerpt.slice(0, 220),
2921
+ targetAudience: `Students aged ${ageBand[0]}-${ageBand[1]}`,
2922
+ sourceUrl: first.url,
2923
+ hardwareRequirements: hardware ? [hardware] : void 0,
2924
+ softwareRequirements: software ? [software] : void 0
2925
+ }
2926
+ ];
2927
+ factsheet.evidenceBacked = true;
2928
+ }
2923
2929
  }
2924
2930
  factsheet.markdownReport = this.renderMarkdownReport(factsheet);
2925
2931
  return factsheet;
@@ -2933,23 +2939,41 @@ Synthesize a strictly valid JSON object with:`,
2933
2939
  `- **Hardware:** ${fs.compatibilityMatrix.hardwarePlatform || "N/A"}`,
2934
2940
  `- **Software / SDK:** ${fs.compatibilityMatrix.softwareEnv || "N/A"}`,
2935
2941
  `- **Verdict:** ${fs.compatibilityMatrix.verifiedCompatible ? "\u2705 Verified Compatible" : "\u26A0\uFE0F Compatibility Warning"}`,
2936
- ...fs.compatibilityMatrix.notes.map((n) => ` - ${n}`),
2937
- `
2942
+ ...fs.compatibilityMatrix.notes.map((n) => ` - ${n}`)
2943
+ ];
2944
+ if (fs.ageFeasibility.potentialBarriers.length > 0) {
2945
+ lines.push(
2946
+ `
2938
2947
  ## 2. Age Feasibility & Learner Barriers (Ages ${fs.ageFeasibility.recommendedMinAge}\u2013${fs.ageFeasibility.recommendedMaxAge})`,
2939
- ...fs.ageFeasibility.potentialBarriers.map((b) => `- \u26A0\uFE0F ${b}`),
2940
- `
2948
+ ...fs.ageFeasibility.potentialBarriers.map((b) => `- \u26A0\uFE0F ${b}`)
2949
+ );
2950
+ }
2951
+ if (fs.exemplarProjects.length > 0) {
2952
+ lines.push(
2953
+ `
2941
2954
  ## 3. Real-World Exemplar Projects`,
2942
- ...fs.exemplarProjects.map((ex, idx) => `### Exemplar ${idx + 1}: ${ex.title}
2955
+ ...fs.exemplarProjects.map(
2956
+ (ex, idx) => `### Exemplar ${idx + 1}: ${ex.title}
2943
2957
  - **Summary:** ${ex.description}
2944
2958
  - **Audience:** ${ex.targetAudience}${ex.sourceUrl ? `
2945
- - **Reference:** [Link](${ex.sourceUrl})` : ""}`),
2946
- `
2959
+ - **Reference:** [Link](${ex.sourceUrl})` : ""}`
2960
+ )
2961
+ );
2962
+ }
2963
+ if (fs.technicalBottlenecks.length > 0) {
2964
+ lines.push(
2965
+ `
2947
2966
  ## 4. Technical Bottlenecks & Pitfalls to Avoid`,
2948
- ...fs.technicalBottlenecks.map((bn) => `- \u{1F6D1} ${bn}`),
2949
- `
2967
+ ...fs.technicalBottlenecks.map((bn) => `- \u{1F6D1} ${bn}`)
2968
+ );
2969
+ }
2970
+ if (fs.groundingSources.length > 0) {
2971
+ lines.push(
2972
+ `
2950
2973
  ## 5. Grounding Citations`,
2951
- ...fs.groundingSources.map((s, idx) => `${idx + 1}. [${s.title}](${s.url})`)
2952
- ];
2974
+ ...fs.groundingSources.map((s, idx) => `${idx + 1}. [${s.title}](${s.url})`)
2975
+ );
2976
+ }
2953
2977
  if (fs.codeSnippets && fs.codeSnippets.length > 0) {
2954
2978
  lines.push(
2955
2979
  `
@@ -2960,11 +2984,8 @@ ${c.code}
2960
2984
  );
2961
2985
  }
2962
2986
  if (fs.pinoutTables && fs.pinoutTables.length > 0) {
2963
- lines.push(
2964
- `
2965
- ## 7. Pinout & Specification Tables`,
2966
- ...fs.pinoutTables
2967
- );
2987
+ lines.push(`
2988
+ ## 7. Pinout & Specification Tables`, ...fs.pinoutTables);
2968
2989
  }
2969
2990
  return lines.join("\n");
2970
2991
  }