@digimakers/core 0.1.4 → 0.3.20

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 (60) hide show
  1. package/dist/agents/code-formatter.d.ts +2 -0
  2. package/dist/agents/code-formatter.d.ts.map +1 -0
  3. package/dist/agents/code-formatter.js +23 -0
  4. package/dist/agents/code-formatter.js.map +1 -0
  5. package/dist/docling-cleaner/cleaner.py +34 -0
  6. package/dist/docling-cleaner/pyproject.toml +10 -0
  7. package/dist/docling-cleaner/uv.lock +2077 -0
  8. package/dist/index.d.ts +2 -3
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -5
  11. package/dist/index.js.map +1 -1
  12. package/dist/parsing/docling-parser.d.ts +17 -0
  13. package/dist/parsing/docling-parser.d.ts.map +1 -0
  14. package/dist/parsing/docling-parser.js +109 -0
  15. package/dist/parsing/docling-parser.js.map +1 -0
  16. package/dist/parsing/docling-runners.d.ts +2 -0
  17. package/dist/parsing/docling-runners.d.ts.map +1 -0
  18. package/dist/parsing/docling-runners.js +85 -0
  19. package/dist/parsing/docling-runners.js.map +1 -0
  20. package/dist/parsing/docx-parser.d.ts +2 -2
  21. package/dist/parsing/docx-parser.d.ts.map +1 -1
  22. package/dist/parsing/docx-parser.js +130 -37
  23. package/dist/parsing/docx-parser.js.map +1 -1
  24. package/dist/parsing/footer-parser.d.ts +7 -0
  25. package/dist/parsing/footer-parser.d.ts.map +1 -0
  26. package/dist/parsing/footer-parser.js +49 -0
  27. package/dist/parsing/footer-parser.js.map +1 -0
  28. package/dist/parsing/index.d.ts +3 -0
  29. package/dist/parsing/index.d.ts.map +1 -1
  30. package/dist/parsing/index.js +2 -0
  31. package/dist/parsing/index.js.map +1 -1
  32. package/dist/parsing/normalise.d.ts +3 -0
  33. package/dist/parsing/normalise.d.ts.map +1 -0
  34. package/dist/parsing/normalise.js +52 -0
  35. package/dist/parsing/normalise.js.map +1 -0
  36. package/dist/parsing/post-processors.d.ts +6 -0
  37. package/dist/parsing/post-processors.d.ts.map +1 -0
  38. package/dist/parsing/post-processors.js +217 -0
  39. package/dist/parsing/post-processors.js.map +1 -0
  40. package/dist/parsing/prompts.d.ts +5 -0
  41. package/dist/parsing/prompts.d.ts.map +1 -0
  42. package/dist/parsing/prompts.js +24 -0
  43. package/dist/parsing/prompts.js.map +1 -0
  44. package/dist/pdf-generator.d.ts +18 -6
  45. package/dist/pdf-generator.d.ts.map +1 -1
  46. package/dist/pdf-generator.js +80 -70
  47. package/dist/pdf-generator.js.map +1 -1
  48. package/dist/sample-data.d.ts +2 -2
  49. package/dist/sample-data.d.ts.map +1 -1
  50. package/dist/sample-data.js +16 -10
  51. package/dist/sample-data.js.map +1 -1
  52. package/dist/schemas/index.d.ts +1 -1
  53. package/dist/schemas/index.d.ts.map +1 -1
  54. package/dist/schemas/index.js +1 -1
  55. package/dist/schemas/index.js.map +1 -1
  56. package/dist/schemas/lesson.d.ts +404 -44
  57. package/dist/schemas/lesson.d.ts.map +1 -1
  58. package/dist/schemas/lesson.js +117 -34
  59. package/dist/schemas/lesson.js.map +1 -1
  60. package/package.json +6 -3
@@ -0,0 +1,2 @@
1
+ export declare function formatDocumentCode(document: string, footerLanguage: string | null): Promise<string>;
2
+ //# sourceMappingURL=code-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-formatter.d.ts","sourceRoot":"","sources":["../../src/agents/code-formatter.ts"],"names":[],"mappings":"AASA,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,mBAcvF"}
@@ -0,0 +1,23 @@
1
+ import { generateText } from 'ai';
2
+ import { createGoogleGenerativeAI } from '@ai-sdk/google';
3
+ import { codeFormatterPrompt, codeFormatterSystemPrompt } from '../parsing/prompts.js';
4
+ import { logger } from '../logger.js';
5
+ const google = createGoogleGenerativeAI({
6
+ apiKey: process.env.GEMINI_API_KEY,
7
+ });
8
+ export async function formatDocumentCode(document, footerLanguage) {
9
+ logger.debug('Formatting document code blocks with code formatter LLM');
10
+ if (!footerLanguage || footerLanguage != 'scratch') {
11
+ const { text } = await generateText({
12
+ model: google('gemini-2.0-flash'),
13
+ system: codeFormatterSystemPrompt,
14
+ prompt: codeFormatterPrompt(document),
15
+ temperature: 0,
16
+ });
17
+ logger.debug('Done formatting document code blocks');
18
+ return text;
19
+ }
20
+ logger.debug("Did not format document code blcoks because it's a scratch lesson");
21
+ return document;
22
+ }
23
+ //# sourceMappingURL=code-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-formatter.js","sourceRoot":"","sources":["../../src/agents/code-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,MAAM,GAAG,wBAAwB,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAgB,EAAE,cAA6B;IACtF,MAAM,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;IACxE,IAAI,CAAC,cAAc,IAAI,cAAc,IAAI,SAAS,EAAE,CAAC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,YAAY,CAAC;YAClC,KAAK,EAAE,MAAM,CAAC,kBAAkB,CAAC;YACjC,MAAM,EAAE,yBAAyB;YACjC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC;YACrC,WAAW,EAAE,CAAC;SACf,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;IAClF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Convert DOCX to markdown with image placeholders using Docling.
4
+
5
+ Usage:
6
+ python cleaner.py <path-to-docx>
7
+
8
+ Outputs markdown to stdout with <!-- image --> markers for images.
9
+ """
10
+
11
+ import sys
12
+ import logging
13
+ from pathlib import Path
14
+ from docling.document_converter import DocumentConverter
15
+
16
+ logging.getLogger('docling.backend.msword_backend').setLevel(logging.ERROR)
17
+
18
+ def main():
19
+ if len(sys.argv) < 2:
20
+ print("Usage: python cleaner.py <path-to-docx>", file=sys.stderr)
21
+ sys.exit(1)
22
+
23
+ src = Path(sys.argv[1])
24
+ if not src.exists():
25
+ print(f"Error: File not found: {src}", file=sys.stderr)
26
+ sys.exit(1)
27
+
28
+ conv = DocumentConverter()
29
+ result = conv.convert(src)
30
+ markdown = result.document.export_to_markdown()
31
+ print(markdown)
32
+
33
+ if __name__ == "__main__":
34
+ main()
@@ -0,0 +1,10 @@
1
+ [project]
2
+ name = "docling-cleaner"
3
+ version = "0.1.0"
4
+ description = "Clean content output from docx files"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ dependencies = [
8
+ "docling==2.68.0",
9
+ "pydantic>=2.12.5",
10
+ ]