synthadoc 0.9.1__py3-none-any.whl

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 (189) hide show
  1. synthadoc/__init__.py +12 -0
  2. synthadoc/__main__.py +6 -0
  3. synthadoc/agents/__init__.py +2 -0
  4. synthadoc/agents/_routing.py +68 -0
  5. synthadoc/agents/_utils.py +25 -0
  6. synthadoc/agents/action_agent.py +755 -0
  7. synthadoc/agents/context_agent.py +131 -0
  8. synthadoc/agents/export_agent.py +461 -0
  9. synthadoc/agents/hint_engine.py +167 -0
  10. synthadoc/agents/hints.json +162 -0
  11. synthadoc/agents/ingest_agent.py +866 -0
  12. synthadoc/agents/lint_agent.py +616 -0
  13. synthadoc/agents/query_agent.py +921 -0
  14. synthadoc/agents/rewrite_agent.py +48 -0
  15. synthadoc/agents/scaffold_agent.py +311 -0
  16. synthadoc/agents/search_decompose_agent.py +66 -0
  17. synthadoc/agents/skill_agent.py +213 -0
  18. synthadoc/agents/summarize_agent.py +39 -0
  19. synthadoc/cli/__init__.py +2 -0
  20. synthadoc/cli/_http.py +141 -0
  21. synthadoc/cli/_init.py +213 -0
  22. synthadoc/cli/_port.py +45 -0
  23. synthadoc/cli/_utils.py +11 -0
  24. synthadoc/cli/_wiki.py +85 -0
  25. synthadoc/cli/audit.py +239 -0
  26. synthadoc/cli/backup.py +262 -0
  27. synthadoc/cli/cache.py +47 -0
  28. synthadoc/cli/candidates.py +253 -0
  29. synthadoc/cli/context.py +70 -0
  30. synthadoc/cli/demo.py +177 -0
  31. synthadoc/cli/export.py +69 -0
  32. synthadoc/cli/ingest.py +104 -0
  33. synthadoc/cli/install.py +284 -0
  34. synthadoc/cli/jobs.py +144 -0
  35. synthadoc/cli/lifecycle.py +82 -0
  36. synthadoc/cli/lint.py +246 -0
  37. synthadoc/cli/logo.py +123 -0
  38. synthadoc/cli/main.py +128 -0
  39. synthadoc/cli/plugin.py +251 -0
  40. synthadoc/cli/query.py +98 -0
  41. synthadoc/cli/routing.py +98 -0
  42. synthadoc/cli/scaffold.py +75 -0
  43. synthadoc/cli/schedule.py +206 -0
  44. synthadoc/cli/serve.py +366 -0
  45. synthadoc/cli/status.py +56 -0
  46. synthadoc/cli/web.py +43 -0
  47. synthadoc/config.py +503 -0
  48. synthadoc/core/__init__.py +2 -0
  49. synthadoc/core/backup_engine.py +185 -0
  50. synthadoc/core/cache.py +115 -0
  51. synthadoc/core/cost_guard.py +50 -0
  52. synthadoc/core/hooks.py +52 -0
  53. synthadoc/core/logging_config.py +214 -0
  54. synthadoc/core/orchestrator.py +565 -0
  55. synthadoc/core/queue.py +262 -0
  56. synthadoc/core/routing.py +91 -0
  57. synthadoc/core/scheduler.py +213 -0
  58. synthadoc/data/obsidian-plugin/main.js +346 -0
  59. synthadoc/data/obsidian-plugin/manifest.json +9 -0
  60. synthadoc/demos/__init__.py +2 -0
  61. synthadoc/demos/ai-research/AGENTS.md +16 -0
  62. synthadoc/demos/ai-research/README.md +196 -0
  63. synthadoc/demos/ai-research/ROUTING.md +20 -0
  64. synthadoc/demos/ai-research/_generate_raw_sources.py +275 -0
  65. synthadoc/demos/ai-research/raw_sources/ai-fundamentals-overview.md +53 -0
  66. synthadoc/demos/ai-research/raw_sources/deep-learning-concepts.pptx +0 -0
  67. synthadoc/demos/ai-research/raw_sources/llm-benchmarks-q1-2026.pdf +74 -0
  68. synthadoc/demos/ai-research/raw_sources/model-capabilities-comparison.xlsx +0 -0
  69. synthadoc/demos/ai-research/raw_sources/neural-network-architecture.png +0 -0
  70. synthadoc/demos/ai-research/raw_sources/public-domain/andrej-karpathy-biography.txt +45 -0
  71. synthadoc/demos/ai-research/raw_sources/public-domain/attention-mechanisms.txt +64 -0
  72. synthadoc/demos/ai-research/raw_sources/public-domain/geoffrey-hinton-biography.txt +49 -0
  73. synthadoc/demos/ai-research/raw_sources/public-domain/large-language-models.txt +51 -0
  74. synthadoc/demos/ai-research/raw_sources/public-domain/llm-benchmarks-overview.txt +49 -0
  75. synthadoc/demos/ai-research/raw_sources/public-domain/reinforcement-learning-from-human-feedback.txt +51 -0
  76. synthadoc/demos/ai-research/raw_sources/public-domain/scaling-laws.txt +59 -0
  77. synthadoc/demos/ai-research/raw_sources/public-domain/training-techniques.txt +65 -0
  78. synthadoc/demos/ai-research/raw_sources/public-domain/transformer-architecture.txt +53 -0
  79. synthadoc/demos/ai-research/sources.txt +25 -0
  80. synthadoc/demos/ai-research/wiki/andrej-karpathy.md +61 -0
  81. synthadoc/demos/ai-research/wiki/attention-mechanisms.md +70 -0
  82. synthadoc/demos/ai-research/wiki/dashboard.md +69 -0
  83. synthadoc/demos/ai-research/wiki/early-neural-networks.md +28 -0
  84. synthadoc/demos/ai-research/wiki/geoffrey-hinton.md +59 -0
  85. synthadoc/demos/ai-research/wiki/index.md +38 -0
  86. synthadoc/demos/ai-research/wiki/large-language-models.md +70 -0
  87. synthadoc/demos/ai-research/wiki/llm-benchmarks.md +66 -0
  88. synthadoc/demos/ai-research/wiki/purpose.md +33 -0
  89. synthadoc/demos/ai-research/wiki/reinforcement-learning-from-human-feedback.md +62 -0
  90. synthadoc/demos/ai-research/wiki/scaling-laws.md +60 -0
  91. synthadoc/demos/ai-research/wiki/training-techniques.md +68 -0
  92. synthadoc/demos/ai-research/wiki/transformer-architecture.md +60 -0
  93. synthadoc/demos/history-of-computing/.obsidian/app.json +5 -0
  94. synthadoc/demos/history-of-computing/AGENTS.md +13 -0
  95. synthadoc/demos/history-of-computing/README.md +349 -0
  96. synthadoc/demos/history-of-computing/raw_sources/computing-pioneers-timeline.xlsx +0 -0
  97. synthadoc/demos/history-of-computing/raw_sources/cs-milestones-overview.pptx +0 -0
  98. synthadoc/demos/history-of-computing/raw_sources/first-compiler-controversy.pdf +74 -0
  99. synthadoc/demos/history-of-computing/raw_sources/konrad-zuse-z3-computer.md +59 -0
  100. synthadoc/demos/history-of-computing/raw_sources/public-domain/ceruzzi-history-modern-computing.txt +45 -0
  101. synthadoc/demos/history-of-computing/raw_sources/public-domain/hopper-biography-usn.txt +39 -0
  102. synthadoc/demos/history-of-computing/raw_sources/public-domain/leiner-brief-history-internet-2009.txt +43 -0
  103. synthadoc/demos/history-of-computing/raw_sources/public-domain/mccorduck-machines-who-think.txt +49 -0
  104. synthadoc/demos/history-of-computing/raw_sources/public-domain/raymond-cathedral-bazaar-1999.txt +43 -0
  105. synthadoc/demos/history-of-computing/raw_sources/public-domain/riordan-hoddeson-crystal-fire.txt +53 -0
  106. synthadoc/demos/history-of-computing/raw_sources/public-domain/ritchie-unix-history-1979.txt +39 -0
  107. synthadoc/demos/history-of-computing/raw_sources/public-domain/turing-wikipedia-cc0.txt +47 -0
  108. synthadoc/demos/history-of-computing/raw_sources/public-domain/vonneumann-firstdraft-1945.txt +50 -0
  109. synthadoc/demos/history-of-computing/raw_sources/public-domain/wexelblat-history-of-programming-languages-1981.txt +49 -0
  110. synthadoc/demos/history-of-computing/raw_sources/quantum-computing-primer.png +0 -0
  111. synthadoc/demos/history-of-computing/raw_sources/turing-enigma-decryption.pdf +74 -0
  112. synthadoc/demos/history-of-computing/sources.txt +20 -0
  113. synthadoc/demos/history-of-computing/wiki/alan-turing.md +36 -0
  114. synthadoc/demos/history-of-computing/wiki/artificial-intelligence-history.md +44 -0
  115. synthadoc/demos/history-of-computing/wiki/dashboard.md +82 -0
  116. synthadoc/demos/history-of-computing/wiki/grace-hopper.md +37 -0
  117. synthadoc/demos/history-of-computing/wiki/index.md +32 -0
  118. synthadoc/demos/history-of-computing/wiki/internet-origins.md +38 -0
  119. synthadoc/demos/history-of-computing/wiki/mechanical-computing.md +26 -0
  120. synthadoc/demos/history-of-computing/wiki/open-source-movement.md +40 -0
  121. synthadoc/demos/history-of-computing/wiki/personal-computer-revolution.md +38 -0
  122. synthadoc/demos/history-of-computing/wiki/programming-languages-overview.md +42 -0
  123. synthadoc/demos/history-of-computing/wiki/purpose.md +6 -0
  124. synthadoc/demos/history-of-computing/wiki/transistor-and-microchip.md +40 -0
  125. synthadoc/demos/history-of-computing/wiki/unix-history.md +38 -0
  126. synthadoc/demos/history-of-computing/wiki/von-neumann-architecture.md +38 -0
  127. synthadoc/errors.py +136 -0
  128. synthadoc/integration/__init__.py +2 -0
  129. synthadoc/integration/http_server.py +1390 -0
  130. synthadoc/integration/mcp_server.py +331 -0
  131. synthadoc/knowledge/synthadoc-export-guide.md +63 -0
  132. synthadoc/knowledge/synthadoc-ingest-guide.md +84 -0
  133. synthadoc/knowledge/synthadoc-jobs-guide.md +46 -0
  134. synthadoc/knowledge/synthadoc-lifecycle.md +116 -0
  135. synthadoc/knowledge/synthadoc-lint-guide.md +79 -0
  136. synthadoc/knowledge/synthadoc-overview.md +97 -0
  137. synthadoc/knowledge/synthadoc-schedule-guide.md +119 -0
  138. synthadoc/observability/__init__.py +2 -0
  139. synthadoc/observability/telemetry.py +60 -0
  140. synthadoc/providers/__init__.py +119 -0
  141. synthadoc/providers/anthropic.py +79 -0
  142. synthadoc/providers/base.py +44 -0
  143. synthadoc/providers/coding_tool.py +355 -0
  144. synthadoc/providers/ollama.py +67 -0
  145. synthadoc/providers/openai.py +443 -0
  146. synthadoc/providers/pricing.py +57 -0
  147. synthadoc/py.typed +0 -0
  148. synthadoc/skills/__init__.py +2 -0
  149. synthadoc/skills/base.py +76 -0
  150. synthadoc/skills/docx/SKILL.md +27 -0
  151. synthadoc/skills/docx/scripts/__init__.py +0 -0
  152. synthadoc/skills/docx/scripts/main.py +21 -0
  153. synthadoc/skills/image/SKILL.md +35 -0
  154. synthadoc/skills/image/scripts/__init__.py +0 -0
  155. synthadoc/skills/image/scripts/main.py +65 -0
  156. synthadoc/skills/markdown/SKILL.md +28 -0
  157. synthadoc/skills/markdown/scripts/__init__.py +0 -0
  158. synthadoc/skills/markdown/scripts/main.py +13 -0
  159. synthadoc/skills/pdf/SKILL.md +39 -0
  160. synthadoc/skills/pdf/references/cjk-notes.md +8 -0
  161. synthadoc/skills/pdf/scripts/__init__.py +0 -0
  162. synthadoc/skills/pdf/scripts/main.py +89 -0
  163. synthadoc/skills/pptx/SKILL.md +28 -0
  164. synthadoc/skills/pptx/scripts/__init__.py +0 -0
  165. synthadoc/skills/pptx/scripts/main.py +52 -0
  166. synthadoc/skills/registry.py +157 -0
  167. synthadoc/skills/url/SKILL.md +31 -0
  168. synthadoc/skills/url/scripts/__init__.py +0 -0
  169. synthadoc/skills/url/scripts/main.py +127 -0
  170. synthadoc/skills/web_search/SKILL.md +53 -0
  171. synthadoc/skills/web_search/assets/search-providers.json +12 -0
  172. synthadoc/skills/web_search/scripts/__init__.py +0 -0
  173. synthadoc/skills/web_search/scripts/fetcher.py +19 -0
  174. synthadoc/skills/web_search/scripts/main.py +122 -0
  175. synthadoc/skills/xlsx/SKILL.md +30 -0
  176. synthadoc/skills/xlsx/scripts/__init__.py +0 -0
  177. synthadoc/skills/xlsx/scripts/main.py +32 -0
  178. synthadoc/skills/youtube/SKILL.md +45 -0
  179. synthadoc/skills/youtube/scripts/__init__.py +0 -0
  180. synthadoc/skills/youtube/scripts/main.py +177 -0
  181. synthadoc/storage/__init__.py +2 -0
  182. synthadoc/storage/log.py +753 -0
  183. synthadoc/storage/search.py +232 -0
  184. synthadoc/storage/wiki.py +303 -0
  185. synthadoc-0.9.1.dist-info/METADATA +1263 -0
  186. synthadoc-0.9.1.dist-info/RECORD +189 -0
  187. synthadoc-0.9.1.dist-info/WHEEL +4 -0
  188. synthadoc-0.9.1.dist-info/entry_points.txt +2 -0
  189. synthadoc-0.9.1.dist-info/licenses/LICENSE +661 -0
synthadoc/__init__.py ADDED
@@ -0,0 +1,12 @@
1
+ # SPDX-License-Identifier: AGPL-3.0-or-later
2
+ # Copyright (C) 2026 Paul Chen / axoviq.com
3
+ """synthadoc — domain-agnostic LLM knowledge compilation engine."""
4
+ from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
5
+ from importlib.metadata import version as _version
6
+ from pathlib import Path as _Path
7
+
8
+ try:
9
+ __version__ = _version("synthadoc")
10
+ except _PackageNotFoundError:
11
+ # Fallback for editable installs that haven't been registered yet.
12
+ __version__ = (_Path(__file__).resolve().parent.parent / "VERSION").read_text(encoding="utf-8").strip()
synthadoc/__main__.py ADDED
@@ -0,0 +1,6 @@
1
+ # SPDX-License-Identifier: AGPL-3.0-or-later
2
+ # Copyright (C) 2026 Paul Chen / axoviq.com
3
+ """Allows running synthadoc as a module: python -m synthadoc <command>"""
4
+ from synthadoc.cli.main import app
5
+
6
+ app()
@@ -0,0 +1,2 @@
1
+ # SPDX-License-Identifier: AGPL-3.0-or-later
2
+ # Copyright (C) 2026 Paul Chen / axoviq.com
@@ -0,0 +1,68 @@
1
+ # SPDX-License-Identifier: AGPL-3.0-or-later
2
+ # Copyright (C) 2026 William Johnason / axoviq.com
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import re
7
+
8
+ from synthadoc.providers.base import Message
9
+
10
+
11
+ async def pick_routing_branches(
12
+ provider,
13
+ branches: dict[str, list[str]],
14
+ context: str,
15
+ *,
16
+ multi: bool,
17
+ ) -> list[str]:
18
+ """Ask the LLM to select branch names from a ROUTING.md index.
19
+
20
+ Args:
21
+ provider: LLM provider instance.
22
+ branches: Branch mapping from RoutingIndex.branches.
23
+ context: Free-text description of what needs to be placed/searched
24
+ (e.g. page title+tags for ingest, question text for query).
25
+ multi: False → pick exactly one branch (ingest placement).
26
+ True → pick 1-2 branches (query scoping); returns [] when
27
+ no branch is clearly relevant so caller can fall back to
28
+ full-corpus search.
29
+ """
30
+ if not branches:
31
+ return []
32
+
33
+ branch_list = "\n".join(f"- {b}" for b in branches)
34
+ if multi:
35
+ prompt = (
36
+ f"Wiki topic branches:\n{branch_list}\n\n"
37
+ f"{context}\n\n"
38
+ "Return a JSON array of the 1-2 most relevant branch names. "
39
+ "Return [] if no branch is clearly relevant."
40
+ )
41
+ else:
42
+ prompt = (
43
+ f"Wiki topic branches:\n{branch_list}\n\n"
44
+ f"{context}\n\n"
45
+ "Return the single most appropriate branch name for this page. "
46
+ "Return exactly one branch name from the list above."
47
+ )
48
+
49
+ try:
50
+ resp = await provider.complete(
51
+ messages=[Message(role="user", content=prompt)],
52
+ temperature=0.0,
53
+ )
54
+ except Exception:
55
+ return []
56
+
57
+ if multi:
58
+ m = re.search(r"\[.*?\]", resp.text, re.DOTALL)
59
+ if not m:
60
+ return []
61
+ try:
62
+ result = json.loads(m.group())
63
+ return [b for b in result if b in branches]
64
+ except Exception:
65
+ return []
66
+ else:
67
+ candidate = resp.text.strip().strip('"').strip()
68
+ return [candidate] if candidate in branches else [next(iter(branches))]
@@ -0,0 +1,25 @@
1
+ # SPDX-License-Identifier: AGPL-3.0-or-later
2
+ # Copyright (C) 2026 William Johnason / axoviq.com
3
+ from __future__ import annotations
4
+
5
+ import json
6
+
7
+
8
+ def parse_json_string_array(text: str, max_items: int) -> list[str] | None:
9
+ """Strip code fences, parse a JSON array, return non-empty strings up to max_items.
10
+
11
+ Returns None (never raises) when the text cannot be parsed as a non-empty
12
+ JSON array of strings, so callers can fall back without a try/except.
13
+ """
14
+ text = text.strip()
15
+ if text.startswith("```"):
16
+ lines = text.splitlines()
17
+ text = "\n".join(l for l in lines if not l.strip().startswith("```")).strip()
18
+ try:
19
+ parts = json.loads(text)
20
+ except (json.JSONDecodeError, ValueError):
21
+ return None
22
+ if not isinstance(parts, list) or not parts:
23
+ return None
24
+ filtered = [str(q) for q in parts[:max_items] if str(q).strip()]
25
+ return filtered or None