@thanh01.pmt/domain-kit 0.2.0 → 0.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 (50) hide show
  1. package/dist/{chunk-RAR5MUUK.mjs → chunk-LKSVTRQE.mjs} +76 -6
  2. package/dist/chunk-LKSVTRQE.mjs.map +1 -0
  3. package/dist/{chunk-KPZKPNOJ.mjs → chunk-MCHHEBH3.mjs} +5 -5
  4. package/dist/{chunk-KPZKPNOJ.mjs.map → chunk-MCHHEBH3.mjs.map} +1 -1
  5. package/dist/{chunk-HH4UX65C.mjs → chunk-MSRKUZLY.mjs} +21 -4
  6. package/dist/chunk-MSRKUZLY.mjs.map +1 -0
  7. package/dist/{chunk-WHBAGJWN.mjs → chunk-VCPIWJ7R.mjs} +4 -4
  8. package/dist/chunk-VCPIWJ7R.mjs.map +1 -0
  9. package/dist/{chunk-JE57VFWX.mjs → chunk-Y7MRFFDJ.mjs} +33 -9
  10. package/dist/chunk-Y7MRFFDJ.mjs.map +1 -0
  11. package/dist/curriculumFeedEmitter-FYAWMPE6.mjs +4 -0
  12. package/dist/{curriculumFeedEmitter-UG664SWY.mjs.map → curriculumFeedEmitter-FYAWMPE6.mjs.map} +1 -1
  13. package/dist/{curriculumFeedSchema-TEeQg2bY.d.ts → curriculumFeedSchema-C8ZP3XMi.d.cts} +8 -8
  14. package/dist/{curriculumFeedSchema-TEeQg2bY.d.cts → curriculumFeedSchema-C8ZP3XMi.d.ts} +8 -8
  15. package/dist/feed/index.cjs +92 -5
  16. package/dist/feed/index.cjs.map +1 -1
  17. package/dist/feed/index.d.cts +1 -1
  18. package/dist/feed/index.d.ts +1 -1
  19. package/dist/feed/index.mjs +2 -2
  20. package/dist/graph/index.cjs +31 -7
  21. package/dist/graph/index.cjs.map +1 -1
  22. package/dist/graph/index.d.cts +2 -2
  23. package/dist/graph/index.d.ts +2 -2
  24. package/dist/graph/index.mjs +1 -1
  25. package/dist/{hybridGraphPipeline-DmWRKYXf.d.cts → hybridGraphPipeline-BhFyh3cm.d.cts} +1 -1
  26. package/dist/{hybridGraphPipeline-DVZYLCAQ.d.ts → hybridGraphPipeline-NZAWAPt_.d.ts} +1 -1
  27. package/dist/{hybridGraphSchema-BCgXicgA.d.ts → hybridGraphSchema-nrUeSwpU.d.cts} +15 -15
  28. package/dist/{hybridGraphSchema-BCgXicgA.d.cts → hybridGraphSchema-nrUeSwpU.d.ts} +15 -15
  29. package/dist/index.cjs +125 -14
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +3 -3
  32. package/dist/index.d.ts +3 -3
  33. package/dist/index.mjs +5 -5
  34. package/dist/pipeline/index.cjs +123 -12
  35. package/dist/pipeline/index.cjs.map +1 -1
  36. package/dist/pipeline/index.d.cts +3 -3
  37. package/dist/pipeline/index.d.ts +3 -3
  38. package/dist/pipeline/index.mjs +4 -4
  39. package/dist/schemas/index.cjs +21 -4
  40. package/dist/schemas/index.cjs.map +1 -1
  41. package/dist/schemas/index.d.cts +2 -2
  42. package/dist/schemas/index.d.ts +2 -2
  43. package/dist/schemas/index.mjs +2 -2
  44. package/package.json +10 -9
  45. package/LICENSE +0 -21
  46. package/dist/chunk-HH4UX65C.mjs.map +0 -1
  47. package/dist/chunk-JE57VFWX.mjs.map +0 -1
  48. package/dist/chunk-RAR5MUUK.mjs.map +0 -1
  49. package/dist/chunk-WHBAGJWN.mjs.map +0 -1
  50. package/dist/curriculumFeedEmitter-UG664SWY.mjs +0 -4
@@ -25,8 +25,8 @@ function resolveProviderChain(config) {
25
25
  }
26
26
  push("legacy", process.env.LLM_BASE_URL || process.env.OPENAI_BASE_URL || "", process.env.LLM_API_KEY || process.env.OPENAI_API_KEY || "", process.env.LLM_MODEL || process.env.LLM_TIER_FAST || "");
27
27
  push("dashscope", process.env.DASHSCOPE_BASE_URL || process.env.ALIBABA_BASE_URL || "", process.env.DASHSCOPE_API_KEY || process.env.ALIBABA_API_KEY || "", process.env.DASHSCOPE_MODEL || process.env.DEFAULT_AI_MODEL || "");
28
- push("nvidia", "https://integrate.api.nvidia.com/v1", process.env.NVIDIA_API_KEY || "", process.env.NVIDIA_MODEL || "nvidia/nemotron-3-ultra-550b-a55b");
29
- push("openrouter", "https://openrouter.ai/api/v1", process.env.OPENROUTER_API_KEY || "", process.env.OPENROUTER_MODEL || "nvidia/nemotron-3-ultra-550b-a55b");
28
+ push("nvidia", "https://integrate.api.nvidia.com/v1", process.env.NVIDIA_API_KEY || "", process.env.NVIDIA_MODEL || "nvidia/nemotron-3-ultra-550b-a55b:free");
29
+ push("openrouter", "https://openrouter.ai/api/v1", process.env.OPENROUTER_API_KEY || "", process.env.OPENROUTER_MODEL || "nvidia/nemotron-3-ultra-550b-a55b:free");
30
30
  if (process.env.OPENROUTER_MODEL) {
31
31
  const or = chain.find((c) => c.label === "openrouter");
32
32
  if (or) {
@@ -2305,6 +2305,8 @@ function auditPhasePlan(plan, features, concepts, links, warnings, log) {
2305
2305
  const phases = [];
2306
2306
  const featurePhase = /* @__PURE__ */ new Map();
2307
2307
  const newIntroPhase = /* @__PURE__ */ new Map();
2308
+ const previewsSeen = /* @__PURE__ */ new Set();
2309
+ const previewPhase = /* @__PURE__ */ new Map();
2308
2310
  const errors = [];
2309
2311
  plan.forEach((rp, idx) => {
2310
2312
  const id = String(rp.id || "PH" + (idx + 1));
@@ -2336,7 +2338,22 @@ function auditPhasePlan(plan, features, concepts, links, warnings, log) {
2336
2338
  errors.push("Phase " + id + ": introduces unknown concept " + cid);
2337
2339
  continue;
2338
2340
  }
2339
- const aspect = String(ri.aspect || "new") === "advanced" ? "advanced" : "new";
2341
+ const rawAspect = String(ri.aspect || "new");
2342
+ const aspect = rawAspect === "advanced" || rawAspect === "preview" ? rawAspect : "new";
2343
+ if (aspect === "preview") {
2344
+ if (newIntroPhase.has(cid)) {
2345
+ errors.push("Phase " + id + ": preview of " + cid + " after its new introduction in phase " + newIntroPhase.get(cid) + " - preview must precede the anchor teach");
2346
+ continue;
2347
+ }
2348
+ if (previewsSeen.has(cid)) {
2349
+ errors.push("Phase " + id + ": duplicate preview of " + cid);
2350
+ continue;
2351
+ }
2352
+ previewsSeen.add(cid);
2353
+ previewPhase.set(cid, order);
2354
+ introductions.push({ concept_id: cid, aspect, note: String(ri.note || "") });
2355
+ continue;
2356
+ }
2340
2357
  if (aspect === "advanced") {
2341
2358
  const first = newIntroPhase.get(cid);
2342
2359
  if (first === void 0) {
@@ -2384,10 +2401,17 @@ function auditPhasePlan(plan, features, concepts, links, warnings, log) {
2384
2401
  }
2385
2402
  for (const [cid, consumerOrder] of firstConsumerPhase) {
2386
2403
  const intro = newIntroPhase.get(cid);
2387
- if (intro === void 0) {
2404
+ const prev = previewPhase.get(cid);
2405
+ if (intro === void 0 && prev === void 0) {
2388
2406
  errors.push("Concept " + cid + " is consumed from phase " + consumerOrder + " but never introduced in any phase");
2389
- } else if (intro > consumerOrder) {
2390
- errors.push("Concept " + cid + " introduced in phase " + intro + " but first consumed in phase " + consumerOrder + " - introduction must come no later than first consumption");
2407
+ } else if (intro !== void 0 && intro > consumerOrder && (prev === void 0 || prev > consumerOrder)) {
2408
+ errors.push("Concept " + cid + " introduced in phase " + intro + " but first consumed in phase " + consumerOrder + " - introduction must come no later than first consumption (or a preview must cover the dependency)");
2409
+ }
2410
+ }
2411
+ for (const [cid, pOrder] of previewPhase) {
2412
+ const anchor = newIntroPhase.get(cid);
2413
+ if (anchor !== void 0 && anchor <= pOrder) {
2414
+ errors.push("Concept " + cid + " previewed in phase " + pOrder + " but fully introduced in phase " + anchor + " - preview must precede the anchor introduction");
2391
2415
  }
2392
2416
  }
2393
2417
  return { phases, errors };
@@ -2403,7 +2427,7 @@ async function decomposePhases(args) {
2403
2427
  const linkList = links.map(
2404
2428
  (l) => "- " + l.feature_id + " -> " + l.concept_id + " (" + l.depth + ")"
2405
2429
  ).join("\n") || "(none)";
2406
- const systemPrompt = "You decompose a software project build into PROGRESSIVE COMPLETION PHASES for learning purposes.\n\nA phase is NOT a feature and NOT a milestone list: it is a cross-feature slice of the\nproduct whose completion yields a DEMONSTRABLY more complete product. Build up gradually:\nthe product grows feature by feature across phases, and each phase adds its features to\nwhat previous phases already built.\n\nRULES:\n1. Every feature must be assigned to EXACTLY ONE phase (no feature reused, none skipped).\n2. Phases are ordered; later phases depend on earlier ones and yield a more complete product.\n3. product_completion describes concretely what the product can DO once the phase is done.\n4. introduces lists which concepts the phase must teach BEFORE its feature work starts:\n - aspect new: first time the concept appears in the course\n - aspect advanced: a concept introduced in an EARLIER phase, revisited here at a\n higher depth (an advanced aspect of the same concept, e.g. validation rules on top\n of basic data modeling). Use the note field to say which aspect.\n5. A concept MUST be introduced (new) no later than the first phase that consumes it.\n6. A concept must not be introduced before its own prerequisites are introduced.\n7. Typically 3-6 phases for a small project; keep phases balanced.\n8. Phase 1 usually covers project setup/foundation features plus the first minimal slice.\n9. Return JSON only.";
2430
+ const systemPrompt = 'You decompose a software project build into PROGRESSIVE COMPLETION PHASES for learning purposes.\n\nA phase is NOT a feature and NOT a milestone list: it is a cross-feature slice of the\nproduct whose completion yields a DEMONSTRABLY more complete product. Build up gradually:\nthe product grows feature by feature across phases, and each phase adds its features to\nwhat previous phases already built.\n\nRULES:\n1. Every feature must be assigned to EXACTLY ONE phase (no feature reused, none skipped).\n2. Phases are ordered; later phases depend on earlier ones and yield a more complete product.\n3. product_completion describes concretely what the product can DO once the phase is done.\n4. introduces lists which concepts the phase must teach BEFORE its feature work starts:\n - aspect new: first time the concept appears in the course\n - aspect advanced: a concept introduced in an EARLIER phase, revisited here at a\n higher depth (an advanced aspect of the same concept, e.g. validation rules on top\n of basic data modeling). Use the note field to say which aspect.\n - aspect preview: a light awareness pass ("know it exists", ULO depth only, ~5 min)\n placed in an EARLIER phase when its feature work needs the vocabulary before the\n full teach. The anchor phase still owns the full new introduction.\n5. A concept MUST be introduced (new) no later than the first phase that consumes it.\n6. A concept must not be introduced before its own prerequisites are introduced.\n7. Typically 3-6 phases for a small project; keep phases balanced.\n8. Phase 1 usually covers project setup/foundation features plus the first minimal slice.\n9. Return JSON only.';
2407
2431
  const baseUserPrompt = "FEATURES:\n" + featureList + "\n\nCONCEPTS:\n" + conceptList + "\n\nFEATURE-CONCEPT LINKS:\n" + linkList + "\n\nReturn JSON with a phases array. Each phase: { id: PH1, name, product_completion, feature_ids: [F0, F1], introduces: [{ concept_id: C1, aspect: new or advanced, note }] }.\n";
2408
2432
  const MAX_DECOMPOSE_ATTEMPTS = 3;
2409
2433
  let auditErrors = [];