@thanh01.pmt/research-kit 1.2.4 → 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-GK5KI5PB.js → chunk-S3JUCDKD.js} +62 -43
  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 -39
  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 -41
  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-GK5KI5PB.js.map +0 -1
  67. package/dist/chunk-J3VCGH7Z.js +0 -3
  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,33 +2821,17 @@ var TechnicalGroundingEngine = class {
2821
2821
  preservedKeyExcerpts.push(...s.keyExcerpts);
2822
2822
  }
2823
2823
  }
2824
- const defaultExemplars = [
2825
- {
2826
- title: scrapedSnippets[0]?.title || `${topic} Hands-on Foundation Project`,
2827
- description: scrapedSnippets[0]?.excerpt ? scrapedSnippets[0].excerpt.slice(0, 220) : `Verified practical implementation integrating ${hardware || "core principles"} and ${software || "standard development tools"}.`,
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 = domain === "hardware" || Boolean(hardware) ? [
2835
- "Power supply decoupling and current surge when powering sensors or actuators.",
2836
- "Logic level shifting and hardware pin mapping conflicts."
2837
- ] : domain === "academic" ? [
2838
- "Cognitive load pacing and abstract concept grounding with physical analogies."
2839
- ] : [
2840
- "SDK/runtime version compatibility and local environment dependencies.",
2841
- "Syntax confusion between asynchronous event handling and blocking calls."
2842
- ];
2824
+ const defaultExemplars = [];
2825
+ const defaultBottlenecks = [];
2843
2826
  let factsheet = {
2844
2827
  topic,
2845
2828
  domain,
2829
+ evidenceBacked: false,
2846
2830
  compatibilityMatrix: {
2847
2831
  hardwarePlatform: hardware || void 0,
2848
2832
  softwareEnv: software || void 0,
2849
2833
  verifiedCompatible: true,
2850
- notes: hardware || software ? [`Targeting ${hardware || "General Platform"} with ${software || "Standard SDK"}.`] : [`Baseline technical verification for ${topic}.`]
2834
+ notes: []
2851
2835
  },
2852
2836
  ageFeasibility: {
2853
2837
  recommendedMinAge: ageBand[0],
@@ -2857,7 +2841,7 @@ var TechnicalGroundingEngine = class {
2857
2841
  },
2858
2842
  exemplarProjects: defaultExemplars,
2859
2843
  technicalBottlenecks: defaultBottlenecks,
2860
- 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 })),
2861
2845
  markdownReport: "",
2862
2846
  codeSnippets: preservedCodeSnippets.slice(0, 4),
2863
2847
  pinoutTables: preservedTables.slice(0, 4),
@@ -2865,9 +2849,10 @@ var TechnicalGroundingEngine = class {
2865
2849
  };
2866
2850
  if (llm && scrapedSnippets.length > 0) {
2867
2851
  try {
2852
+ const roleByDomain = domain === "hardware" ? "Hardware & Embedded Systems Curriculum Specialist" : domain === "software" ? "Software & Technology Curriculum Specialist" : "Applied Subject Matter & Curriculum Specialist";
2868
2853
  const prompt = [
2869
- `You are a Lead STEM Curriculum Engineer. Analyze these research excerpts for topic: "${topic}".`,
2870
- `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.`,
2871
2856
  `
2872
2857
  Harvested Sources:
2873
2858
  ${scrapedSnippets.map((s, i) => {
@@ -2884,7 +2869,7 @@ ${c.code}
2884
2869
  return parts.join("\n");
2885
2870
  }).join("\n\n")}`,
2886
2871
  `
2887
- 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:`,
2888
2873
  `{`,
2889
2874
  ` "compatibilityVerdict": boolean,`,
2890
2875
  ` "compatibilityNotes": string[],`,
@@ -2919,10 +2904,28 @@ Synthesize a strictly valid JSON object with:`,
2919
2904
  }));
2920
2905
  }
2921
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
+ }
2922
2910
  }
2923
2911
  } catch (err) {
2924
2912
  console.warn("[TechnicalGroundingEngine] LLM synthesis error:", err?.message || err);
2925
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
+ }
2926
2929
  }
2927
2930
  factsheet.markdownReport = this.renderMarkdownReport(factsheet);
2928
2931
  return factsheet;
@@ -2936,23 +2939,41 @@ Synthesize a strictly valid JSON object with:`,
2936
2939
  `- **Hardware:** ${fs.compatibilityMatrix.hardwarePlatform || "N/A"}`,
2937
2940
  `- **Software / SDK:** ${fs.compatibilityMatrix.softwareEnv || "N/A"}`,
2938
2941
  `- **Verdict:** ${fs.compatibilityMatrix.verifiedCompatible ? "\u2705 Verified Compatible" : "\u26A0\uFE0F Compatibility Warning"}`,
2939
- ...fs.compatibilityMatrix.notes.map((n) => ` - ${n}`),
2940
- `
2942
+ ...fs.compatibilityMatrix.notes.map((n) => ` - ${n}`)
2943
+ ];
2944
+ if (fs.ageFeasibility.potentialBarriers.length > 0) {
2945
+ lines.push(
2946
+ `
2941
2947
  ## 2. Age Feasibility & Learner Barriers (Ages ${fs.ageFeasibility.recommendedMinAge}\u2013${fs.ageFeasibility.recommendedMaxAge})`,
2942
- ...fs.ageFeasibility.potentialBarriers.map((b) => `- \u26A0\uFE0F ${b}`),
2943
- `
2948
+ ...fs.ageFeasibility.potentialBarriers.map((b) => `- \u26A0\uFE0F ${b}`)
2949
+ );
2950
+ }
2951
+ if (fs.exemplarProjects.length > 0) {
2952
+ lines.push(
2953
+ `
2944
2954
  ## 3. Real-World Exemplar Projects`,
2945
- ...fs.exemplarProjects.map((ex, idx) => `### Exemplar ${idx + 1}: ${ex.title}
2955
+ ...fs.exemplarProjects.map(
2956
+ (ex, idx) => `### Exemplar ${idx + 1}: ${ex.title}
2946
2957
  - **Summary:** ${ex.description}
2947
2958
  - **Audience:** ${ex.targetAudience}${ex.sourceUrl ? `
2948
- - **Reference:** [Link](${ex.sourceUrl})` : ""}`),
2949
- `
2959
+ - **Reference:** [Link](${ex.sourceUrl})` : ""}`
2960
+ )
2961
+ );
2962
+ }
2963
+ if (fs.technicalBottlenecks.length > 0) {
2964
+ lines.push(
2965
+ `
2950
2966
  ## 4. Technical Bottlenecks & Pitfalls to Avoid`,
2951
- ...fs.technicalBottlenecks.map((bn) => `- \u{1F6D1} ${bn}`),
2952
- `
2967
+ ...fs.technicalBottlenecks.map((bn) => `- \u{1F6D1} ${bn}`)
2968
+ );
2969
+ }
2970
+ if (fs.groundingSources.length > 0) {
2971
+ lines.push(
2972
+ `
2953
2973
  ## 5. Grounding Citations`,
2954
- ...fs.groundingSources.map((s, idx) => `${idx + 1}. [${s.title}](${s.url})`)
2955
- ];
2974
+ ...fs.groundingSources.map((s, idx) => `${idx + 1}. [${s.title}](${s.url})`)
2975
+ );
2976
+ }
2956
2977
  if (fs.codeSnippets && fs.codeSnippets.length > 0) {
2957
2978
  lines.push(
2958
2979
  `
@@ -2963,11 +2984,8 @@ ${c.code}
2963
2984
  );
2964
2985
  }
2965
2986
  if (fs.pinoutTables && fs.pinoutTables.length > 0) {
2966
- lines.push(
2967
- `
2968
- ## 7. Pinout & Specification Tables`,
2969
- ...fs.pinoutTables
2970
- );
2987
+ lines.push(`
2988
+ ## 7. Pinout & Specification Tables`, ...fs.pinoutTables);
2971
2989
  }
2972
2990
  return lines.join("\n");
2973
2991
  }