commissure 0.4.0__tar.gz

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 (131) hide show
  1. commissure-0.4.0/LICENSE +21 -0
  2. commissure-0.4.0/PKG-INFO +109 -0
  3. commissure-0.4.0/README.md +69 -0
  4. commissure-0.4.0/commissure/__init__.py +5 -0
  5. commissure-0.4.0/commissure/api.py +149 -0
  6. commissure-0.4.0/commissure/chunk.py +796 -0
  7. commissure-0.4.0/commissure/cli.py +1100 -0
  8. commissure-0.4.0/commissure/deliver/__init__.py +1 -0
  9. commissure-0.4.0/commissure/deliver/html.py +450 -0
  10. commissure-0.4.0/commissure/deliver/static/chart.umd.min.js +14 -0
  11. commissure-0.4.0/commissure/deliver/static/charts.js +387 -0
  12. commissure-0.4.0/commissure/deliver/static/cytoscape.min.js +31 -0
  13. commissure-0.4.0/commissure/deliver/static/favicon.svg +16 -0
  14. commissure-0.4.0/commissure/deliver/static/htmx.min.js +1 -0
  15. commissure-0.4.0/commissure/deliver/static/licenses/chartjs.LICENSE.md +9 -0
  16. commissure-0.4.0/commissure/deliver/static/licenses/cytoscape.LICENSE.txt +19 -0
  17. commissure-0.4.0/commissure/deliver/static/licenses/htmx.LICENSE.txt +13 -0
  18. commissure-0.4.0/commissure/deliver/static/licenses/pico.LICENSE.md +21 -0
  19. commissure-0.4.0/commissure/deliver/static/logo.svg +17 -0
  20. commissure-0.4.0/commissure/deliver/static/pico.min.css +4 -0
  21. commissure-0.4.0/commissure/deliver/static/report.css +1473 -0
  22. commissure-0.4.0/commissure/deliver/static/report.js +262 -0
  23. commissure-0.4.0/commissure/deliver/templates/interface.html.j2 +19 -0
  24. commissure-0.4.0/commissure/deliver/templates/interface_busy_bar.html.j2 +60 -0
  25. commissure-0.4.0/commissure/deliver/templates/interface_root.html.j2 +199 -0
  26. commissure-0.4.0/commissure/deliver/templates/page.html.j2 +59 -0
  27. commissure-0.4.0/commissure/deliver/templates/review_index.html.j2 +96 -0
  28. commissure-0.4.0/commissure/deliver/templates/review_instance.html.j2 +80 -0
  29. commissure-0.4.0/commissure/deliver/templates/review_sample.html.j2 +51 -0
  30. commissure-0.4.0/commissure/evidence.py +280 -0
  31. commissure-0.4.0/commissure/graph.py +354 -0
  32. commissure-0.4.0/commissure/ingest.py +729 -0
  33. commissure-0.4.0/commissure/inspect.py +1148 -0
  34. commissure-0.4.0/commissure/kit/AGENTS.md +97 -0
  35. commissure-0.4.0/commissure/kit/docs/architecture.md +127 -0
  36. commissure-0.4.0/commissure/kit/docs/guide.md +360 -0
  37. commissure-0.4.0/commissure/kit/docs/solutions.md +40 -0
  38. commissure-0.4.0/commissure/kit/skills/build-recipe-stage/SKILL.md +153 -0
  39. commissure-0.4.0/commissure/kit/skills/investigate-solution/SKILL.md +47 -0
  40. commissure-0.4.0/commissure/limits.py +215 -0
  41. commissure-0.4.0/commissure/llm.py +1661 -0
  42. commissure-0.4.0/commissure/locate.py +98 -0
  43. commissure-0.4.0/commissure/parse/__init__.py +146 -0
  44. commissure-0.4.0/commissure/parse/html.py +400 -0
  45. commissure-0.4.0/commissure/parse/model.py +100 -0
  46. commissure-0.4.0/commissure/parse/ocr.py +147 -0
  47. commissure-0.4.0/commissure/parse/office.py +98 -0
  48. commissure-0.4.0/commissure/parse/pdf.py +177 -0
  49. commissure-0.4.0/commissure/parse/pool.py +288 -0
  50. commissure-0.4.0/commissure/parse/step.py +225 -0
  51. commissure-0.4.0/commissure/parse/tabular.py +259 -0
  52. commissure-0.4.0/commissure/patterns/__init__.py +140 -0
  53. commissure-0.4.0/commissure/patterns/citations.py +180 -0
  54. commissure-0.4.0/commissure/patterns/currency.py +410 -0
  55. commissure-0.4.0/commissure/patterns/fetch.py +470 -0
  56. commissure-0.4.0/commissure/patterns/table.py +216 -0
  57. commissure-0.4.0/commissure/patterns/templates/record_table.html.j2 +27 -0
  58. commissure-0.4.0/commissure/patterns/text.py +263 -0
  59. commissure-0.4.0/commissure/probe/__init__.py +123 -0
  60. commissure-0.4.0/commissure/probe/office.py +137 -0
  61. commissure-0.4.0/commissure/probe/pdf.py +367 -0
  62. commissure-0.4.0/commissure/probe/render.py +102 -0
  63. commissure-0.4.0/commissure/probe/tabular.py +283 -0
  64. commissure-0.4.0/commissure/progress.py +134 -0
  65. commissure-0.4.0/commissure/recipes.py +874 -0
  66. commissure-0.4.0/commissure/recon.py +731 -0
  67. commissure-0.4.0/commissure/records.py +95 -0
  68. commissure-0.4.0/commissure/review.py +809 -0
  69. commissure-0.4.0/commissure/review_page.py +493 -0
  70. commissure-0.4.0/commissure/runner.py +785 -0
  71. commissure-0.4.0/commissure/runs.py +74 -0
  72. commissure-0.4.0/commissure/scaffold/__init__.py +189 -0
  73. commissure-0.4.0/commissure/scaffold/example/README.md +34 -0
  74. commissure-0.4.0/commissure/scaffold/example/docs/notes.md +17 -0
  75. commissure-0.4.0/commissure/scaffold/example/intake/comments/c01.html +1 -0
  76. commissure-0.4.0/commissure/scaffold/example/intake/comments/c02.html +1 -0
  77. commissure-0.4.0/commissure/scaffold/example/intake/comments/c03.html +1 -0
  78. commissure-0.4.0/commissure/scaffold/example/intake/comments/c04.html +1 -0
  79. commissure-0.4.0/commissure/scaffold/example/intake/comments/c05.html +1 -0
  80. commissure-0.4.0/commissure/scaffold/example/intake/comments/c06.html +1 -0
  81. commissure-0.4.0/commissure/scaffold/example/intake/comments/c07.html +1 -0
  82. commissure-0.4.0/commissure/scaffold/example/intake/comments/c08.html +1 -0
  83. commissure-0.4.0/commissure/scaffold/example/intake/comments/c09.html +1 -0
  84. commissure-0.4.0/commissure/scaffold/example/intake/comments/c10.html +1 -0
  85. commissure-0.4.0/commissure/scaffold/example/intake/comments/c11.html +1 -0
  86. commissure-0.4.0/commissure/scaffold/example/intake/comments/c12.html +1 -0
  87. commissure-0.4.0/commissure/scaffold/example/intake/comments/c13.html +1 -0
  88. commissure-0.4.0/commissure/scaffold/example/intake/comments/c14.html +1 -0
  89. commissure-0.4.0/commissure/scaffold/example/intake/comments/c15.html +1 -0
  90. commissure-0.4.0/commissure/scaffold/example/intake/comments/c16.html +1 -0
  91. commissure-0.4.0/commissure/scaffold/example/intake/comments/c17.html +1 -0
  92. commissure-0.4.0/commissure/scaffold/example/intake/comments/c18.html +1 -0
  93. commissure-0.4.0/commissure/scaffold/example/intake/comments/c19.docx +0 -0
  94. commissure-0.4.0/commissure/scaffold/example/intake/comments/c20.docx +0 -0
  95. commissure-0.4.0/commissure/scaffold/example/intake/comments/c21.pdf +46 -0
  96. commissure-0.4.0/commissure/scaffold/example/intake/comments/c22.pdf +34 -0
  97. commissure-0.4.0/commissure/scaffold/example/intake/comments/c23-scan.pdf +0 -0
  98. commissure-0.4.0/commissure/scaffold/example/recipe/_AGENTS.md +38 -0
  99. commissure-0.4.0/commissure/scaffold/example/recipe/__init__.py +1 -0
  100. commissure-0.4.0/commissure/scaffold/example/recipe/extract.py +66 -0
  101. commissure-0.4.0/commissure/scaffold/example/recipe/interface.py +80 -0
  102. commissure-0.4.0/commissure/scaffold/example/recipe/recipe.py +30 -0
  103. commissure-0.4.0/commissure/scaffold/example/recipe/schema.py +33 -0
  104. commissure-0.4.0/commissure/scaffold/example/recipe/tally.py +22 -0
  105. commissure-0.4.0/commissure/scaffold/example/tests/test_recipe.py +95 -0
  106. commissure-0.4.0/commissure/scaffold/project/.claude/settings.json +9 -0
  107. commissure-0.4.0/commissure/scaffold/project/CHANGELOG.md +5 -0
  108. commissure-0.4.0/commissure/scaffold/project/README.md +47 -0
  109. commissure-0.4.0/commissure/scaffold/project/_AGENTS.md +25 -0
  110. commissure-0.4.0/commissure/scaffold/project/_CLAUDE.md +2 -0
  111. commissure-0.4.0/commissure/scaffold/project/_gitignore +38 -0
  112. commissure-0.4.0/commissure/scaffold/project/_pyproject.toml +27 -0
  113. commissure-0.4.0/commissure/scaffold/project/docs/README.md +9 -0
  114. commissure-0.4.0/commissure/scaffold/project/docs/notes.md +19 -0
  115. commissure-0.4.0/commissure/scaffold/project/intake/README.md +7 -0
  116. commissure-0.4.0/commissure/scaffold/project/recipe/_AGENTS.md +30 -0
  117. commissure-0.4.0/commissure/scaffold/project/recipe/__init__.py +1 -0
  118. commissure-0.4.0/commissure/scaffold/project/recipe/analyze.py +10 -0
  119. commissure-0.4.0/commissure/scaffold/project/recipe/deliver.py +27 -0
  120. commissure-0.4.0/commissure/scaffold/project/recipe/extract.py +10 -0
  121. commissure-0.4.0/commissure/scaffold/project/recipe/recipe.py +31 -0
  122. commissure-0.4.0/commissure/scaffold/project/recipe/schema.py +5 -0
  123. commissure-0.4.0/commissure/scaffold/project/tests/test_recipe.py +20 -0
  124. commissure-0.4.0/commissure/search.py +252 -0
  125. commissure-0.4.0/commissure/serve.py +2311 -0
  126. commissure-0.4.0/commissure/tools/__init__.py +8 -0
  127. commissure-0.4.0/commissure/tools/licenses.py +355 -0
  128. commissure-0.4.0/commissure/tools/licenses.toml +115 -0
  129. commissure-0.4.0/commissure/workspace.py +1173 -0
  130. commissure-0.4.0/pyproject.toml +110 -0
  131. commissure-0.4.0/pyproject.toml.orig +102 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sebastien Taggart
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: commissure
3
+ Version: 0.4.0
4
+ Summary: Local substrate for coding agents working on messy client data and document operations.
5
+ Keywords: cli,data-pipeline,document-processing,local-first,pdf,pydantic,sqlite
6
+ Author: Sebastien Taggart
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Office/Business
18
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
19
+ Classifier: Topic :: Text Processing
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: jinja2>=3.1.6
22
+ Requires-Dist: openpyxl>=3.1.5
23
+ Requires-Dist: packaging>=26.3
24
+ Requires-Dist: pdfplumber>=0.11.10
25
+ Requires-Dist: pydantic>=2.14.1
26
+ Requires-Dist: pydantic-ai-slim[anthropic,openrouter]>=2.61.0
27
+ Requires-Dist: pypdfium2>=5.14.0
28
+ Requires-Dist: pytesseract>=0.3.13
29
+ Requires-Dist: python-docx>=1.2.0
30
+ Requires-Dist: rapidfuzz>=3.14.6
31
+ Requires-Dist: rich>=15.0.0
32
+ Requires-Dist: typer>=0.27.3
33
+ Requires-Dist: docxtpl>=0.20.2 ; extra == 'docx'
34
+ Requires-Python: >=3.12
35
+ Project-URL: Homepage, https://www.sebastientaggart.com/projects/commisure/
36
+ Project-URL: Repository, https://github.com/sebastientaggart/commissure/
37
+ Project-URL: Issues, https://github.com/sebastientaggart/commissure/issues
38
+ Provides-Extra: docx
39
+ Description-Content-Type: text/markdown
40
+
41
+ <p align="center">
42
+ <img src="docs/logo/logo-stacked.svg" alt="Commissure" width="280">
43
+ </p>
44
+
45
+ <p align="center">
46
+ <a href="pyproject.toml"><img src="docs/logo/badge-python.svg" alt="python: 3.12+"></a>
47
+ <a href="commissure/kit/docs/architecture.md"><img src="docs/logo/badge-pydantic.svg" alt="pydantic: v2"></a>
48
+ <a href="commissure/kit/docs/architecture.md"><img src="docs/logo/badge-storage.svg" alt="storage: SQLite"></a>
49
+ <a href="pyproject.toml"><img src="docs/logo/badge-uv.svg" alt="uv: managed"></a>
50
+ <a href="LICENSE"><img src="docs/logo/badge-license.svg" alt="license: MIT"></a>
51
+ </p>
52
+
53
+ **Commissure** is an open-source tool that turns large folders of PDFs, Word files, spreadsheets, and records into checked, cited findings and local review apps.
54
+
55
+ ## The problem
56
+
57
+ Teams have to read, cross-check, and summarize thousands of public comments, policy memos, or client documents without missing unreadable scans or losing track of where a claim came from. Spreadsheets are too slow, chat tools guess and cannot cite exact passages at scale, and one-off scripts fail silently on bad files.
58
+
59
+ ## What makes it different
60
+
61
+ - **Machine-checked citations:** Every result points at the exact page and passage in the original file. Commissure verifies every span against the extracted text before saving it and sets unreadable pages aside for local OCR or human review.
62
+ - **Human sampling and error rates:** Reviewers grade a seeded random sample of results against the originals side by side, producing a statistical error rate published with the findings.
63
+ - **Offline on local hardware:** Runs on one machine in SQLite. Documents and sensitive data stay local unless a stage explicitly enables a remote model.
64
+ - **One solution per client:** Each solution is its own small project and repository; a client receives only theirs, with Commissure pinned in its lock file.
65
+
66
+ ## Why it suits AI agents
67
+
68
+ Versioned rules ([`commissure/kit/AGENTS.md`](commissure/kit/AGENTS.md)) and workflow skills ([`commissure/kit/skills/`](commissure/kit/skills/)), copied into every solution, keep coding agents within checkable limits (strict schemas, small slices, and proven-to-fail tests), so their work stays verifiable.
69
+
70
+ ## When not to use it
71
+
72
+ - **Not a hosted cloud service:** Runs where you install it; unattended runs use the OS scheduler.
73
+ - **Not unsupervised AI:** Produces cited evidence for people to judge rather than making policy decisions on its own.
74
+ - **Not a no-code builder:** Building a new solution requires a developer with an agent; running an existing solution does not.
75
+
76
+ ---
77
+
78
+ ## Getting Started
79
+
80
+ Requires [`uv`](https://docs.astral.sh/uv/) (`brew install uv`, or `curl -LsSf https://astral.sh/uv/install.sh | sh`). Nothing else: no clone, no model, no service.
81
+
82
+ **Try the example (5 minutes).** A working solution over 23 fictional public comments: positions and topics, each pointing at the words it rests on, with a scan set aside and a review page.
83
+
84
+ ```sh
85
+ uvx commissure new demo --example && cd demo && uv sync
86
+ uv run commissure run --step ingest --source intake/comments --role comment
87
+ uv run commissure run --step parse
88
+ uv run commissure run --step extract
89
+ uv run commissure run --step tally
90
+ uv run commissure serve # the results, and /review to grade a random sample
91
+ ```
92
+
93
+ **Start your own (5 more minutes).**
94
+
95
+ ```sh
96
+ uvx commissure new my-solution && cd my-solution && git init && uv sync
97
+ ```
98
+
99
+ Put documents in `intake/<batch>/`, describe the job in `docs/notes.md`, and open your coding agent in the folder: `AGENTS.md`, core's rules, and the `investigate-solution` and `build-recipe-stage` skills are already there. The lifecycle, step by step: [`solutions.md`](commissure/kit/docs/solutions.md).
100
+
101
+ ## Documentation & License
102
+
103
+ - **[Solution Developer Guide](commissure/kit/docs/solutions.md):** The lifecycle from the example to a release, operator vs. agent responsibilities, `recipe/tools/` fetchers, `intake/` curation, and roles.
104
+ - **[Operator & Recipe Reference](commissure/kit/docs/guide.md):** Solution layout, recipe authoring, CLI reference, graph entities/edges, review commands, releasing, and OCR setup.
105
+ - **[Architecture & Core Concepts](commissure/kit/docs/architecture.md):** Workspaces, source vs. parser drift, readability gates, stage staleness, `Evidence`, and `Review`.
106
+ - **[Rules for Recipe Authors](commissure/kit/AGENTS.md):** Vocabulary and the invariants every recipe follows.
107
+ - **[Contributing to Core](docs/contributing.md):** Setup, working with coding agents on `commissure/`, verification order, and how changes reach `dev`.
108
+
109
+ Licensed under the [MIT License](LICENSE).
@@ -0,0 +1,69 @@
1
+ <p align="center">
2
+ <img src="docs/logo/logo-stacked.svg" alt="Commissure" width="280">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="pyproject.toml"><img src="docs/logo/badge-python.svg" alt="python: 3.12+"></a>
7
+ <a href="commissure/kit/docs/architecture.md"><img src="docs/logo/badge-pydantic.svg" alt="pydantic: v2"></a>
8
+ <a href="commissure/kit/docs/architecture.md"><img src="docs/logo/badge-storage.svg" alt="storage: SQLite"></a>
9
+ <a href="pyproject.toml"><img src="docs/logo/badge-uv.svg" alt="uv: managed"></a>
10
+ <a href="LICENSE"><img src="docs/logo/badge-license.svg" alt="license: MIT"></a>
11
+ </p>
12
+
13
+ **Commissure** is an open-source tool that turns large folders of PDFs, Word files, spreadsheets, and records into checked, cited findings and local review apps.
14
+
15
+ ## The problem
16
+
17
+ Teams have to read, cross-check, and summarize thousands of public comments, policy memos, or client documents without missing unreadable scans or losing track of where a claim came from. Spreadsheets are too slow, chat tools guess and cannot cite exact passages at scale, and one-off scripts fail silently on bad files.
18
+
19
+ ## What makes it different
20
+
21
+ - **Machine-checked citations:** Every result points at the exact page and passage in the original file. Commissure verifies every span against the extracted text before saving it and sets unreadable pages aside for local OCR or human review.
22
+ - **Human sampling and error rates:** Reviewers grade a seeded random sample of results against the originals side by side, producing a statistical error rate published with the findings.
23
+ - **Offline on local hardware:** Runs on one machine in SQLite. Documents and sensitive data stay local unless a stage explicitly enables a remote model.
24
+ - **One solution per client:** Each solution is its own small project and repository; a client receives only theirs, with Commissure pinned in its lock file.
25
+
26
+ ## Why it suits AI agents
27
+
28
+ Versioned rules ([`commissure/kit/AGENTS.md`](commissure/kit/AGENTS.md)) and workflow skills ([`commissure/kit/skills/`](commissure/kit/skills/)), copied into every solution, keep coding agents within checkable limits (strict schemas, small slices, and proven-to-fail tests), so their work stays verifiable.
29
+
30
+ ## When not to use it
31
+
32
+ - **Not a hosted cloud service:** Runs where you install it; unattended runs use the OS scheduler.
33
+ - **Not unsupervised AI:** Produces cited evidence for people to judge rather than making policy decisions on its own.
34
+ - **Not a no-code builder:** Building a new solution requires a developer with an agent; running an existing solution does not.
35
+
36
+ ---
37
+
38
+ ## Getting Started
39
+
40
+ Requires [`uv`](https://docs.astral.sh/uv/) (`brew install uv`, or `curl -LsSf https://astral.sh/uv/install.sh | sh`). Nothing else: no clone, no model, no service.
41
+
42
+ **Try the example (5 minutes).** A working solution over 23 fictional public comments: positions and topics, each pointing at the words it rests on, with a scan set aside and a review page.
43
+
44
+ ```sh
45
+ uvx commissure new demo --example && cd demo && uv sync
46
+ uv run commissure run --step ingest --source intake/comments --role comment
47
+ uv run commissure run --step parse
48
+ uv run commissure run --step extract
49
+ uv run commissure run --step tally
50
+ uv run commissure serve # the results, and /review to grade a random sample
51
+ ```
52
+
53
+ **Start your own (5 more minutes).**
54
+
55
+ ```sh
56
+ uvx commissure new my-solution && cd my-solution && git init && uv sync
57
+ ```
58
+
59
+ Put documents in `intake/<batch>/`, describe the job in `docs/notes.md`, and open your coding agent in the folder: `AGENTS.md`, core's rules, and the `investigate-solution` and `build-recipe-stage` skills are already there. The lifecycle, step by step: [`solutions.md`](commissure/kit/docs/solutions.md).
60
+
61
+ ## Documentation & License
62
+
63
+ - **[Solution Developer Guide](commissure/kit/docs/solutions.md):** The lifecycle from the example to a release, operator vs. agent responsibilities, `recipe/tools/` fetchers, `intake/` curation, and roles.
64
+ - **[Operator & Recipe Reference](commissure/kit/docs/guide.md):** Solution layout, recipe authoring, CLI reference, graph entities/edges, review commands, releasing, and OCR setup.
65
+ - **[Architecture & Core Concepts](commissure/kit/docs/architecture.md):** Workspaces, source vs. parser drift, readability gates, stage staleness, `Evidence`, and `Review`.
66
+ - **[Rules for Recipe Authors](commissure/kit/AGENTS.md):** Vocabulary and the invariants every recipe follows.
67
+ - **[Contributing to Core](docs/contributing.md):** Setup, working with coding agents on `commissure/`, verification order, and how changes reach `dev`.
68
+
69
+ Licensed under the [MIT License](LICENSE).
@@ -0,0 +1,5 @@
1
+ """Commissure core substrate. Recipes import from `commissure.api`, not from here."""
2
+
3
+ import importlib.metadata
4
+
5
+ __version__ = importlib.metadata.version("commissure")
@@ -0,0 +1,149 @@
1
+ """The single import surface for recipes.
2
+
3
+ Recipes import from this module (and optionally `commissure.patterns`), never from
4
+ other core modules or provider SDKs.
5
+
6
+ from commissure.api import Stage, RecordEnvelope, Diagnostic
7
+
8
+ STAGES = [Stage("extract", extract, schema=Report, text="default")]
9
+
10
+ A stage function takes `(ctx, subject)`: an `Item` for item stages, a `Group` for
11
+ group and run stages. It returns a payload (an instance of its schema) or a
12
+ `RecordEnvelope` (`.valid`, `.warning`, `.quarantined`, `.skipped`). An exception it
13
+ does not handle fails the run: expected bad data is a quarantine, not a crash.
14
+
15
+ A payload points at what it rests on with `Evidence.span`, `.on_page`, or
16
+ `.whole_item`, built from an `Item` the stage received; core checks it and fills in
17
+ locator, page, and OCR trust when the record is stored (`commissure/evidence.py`).
18
+
19
+ Beside a payload, `RecordEnvelope.valid(payload, entities=..., edges=...)` emits graph
20
+ rows (`EntitySpec`, `EdgeSpec`) that core indexes against the outcome; `ctx.entities`,
21
+ `ctx.edges`, and `ctx.search` (and the same on `InterfaceView` and `ActionContext`)
22
+ read the current snapshot (`commissure/graph.py`). `InterfaceView.query` holds the GET
23
+ parameters of the page request, so a render can answer a read-only form (a search box).
24
+ """
25
+
26
+ from commissure.chunk import (
27
+ PreparedSource,
28
+ TextChunk,
29
+ VerbatimMatch,
30
+ chunk_item,
31
+ chunk_text,
32
+ find_verbatim_span,
33
+ pack_batches,
34
+ prepare_source,
35
+ reduce_tree,
36
+ renumber_chunks,
37
+ )
38
+ from commissure.deliver.html import (
39
+ count_external_resource_urls,
40
+ page_external_resource_count,
41
+ render_page,
42
+ )
43
+ from commissure.evidence import Evidence, EvidenceError
44
+ from commissure.graph import (
45
+ EdgeRow,
46
+ EdgeSpec,
47
+ EntityRow,
48
+ EntitySpec,
49
+ GraphError,
50
+ GraphFromWorker,
51
+ )
52
+ from commissure.limits import Limits
53
+ from commissure.llm import (
54
+ Completion,
55
+ Extraction,
56
+ ExtractionFailed,
57
+ InputTooLarge,
58
+ LLMConfigError,
59
+ LLMError,
60
+ LLMTransportError,
61
+ MissingAPIKeyError,
62
+ Part,
63
+ RemoteModelRefused,
64
+ SystematicModelFailure,
65
+ estimate_tokens,
66
+ )
67
+ from commissure.recipes import (
68
+ Excluded,
69
+ Group,
70
+ Interface,
71
+ Item,
72
+ Source,
73
+ Stage,
74
+ UpstreamOutcome,
75
+ )
76
+ from commissure.records import OUTCOMES, Diagnostic, RecordEnvelope
77
+ from commissure.review import Check
78
+ from commissure.runner import RunContext
79
+ from commissure.search import Hit, SearchFromWorker, SearchUsageError
80
+ from commissure.serve import (
81
+ ActionContext,
82
+ ActionError,
83
+ BusyStatus,
84
+ InterfaceView,
85
+ RecordInfo,
86
+ SourceInfo,
87
+ StepRunSummary,
88
+ StepStatus,
89
+ )
90
+
91
+ __all__ = [
92
+ "OUTCOMES",
93
+ "ActionContext",
94
+ "ActionError",
95
+ "BusyStatus",
96
+ "Check",
97
+ "Completion",
98
+ "Diagnostic",
99
+ "EdgeRow",
100
+ "EdgeSpec",
101
+ "EntityRow",
102
+ "EntitySpec",
103
+ "Evidence",
104
+ "EvidenceError",
105
+ "Excluded",
106
+ "Extraction",
107
+ "ExtractionFailed",
108
+ "GraphError",
109
+ "GraphFromWorker",
110
+ "Group",
111
+ "Hit",
112
+ "InputTooLarge",
113
+ "Interface",
114
+ "InterfaceView",
115
+ "Item",
116
+ "LLMConfigError",
117
+ "LLMError",
118
+ "LLMTransportError",
119
+ "Limits",
120
+ "MissingAPIKeyError",
121
+ "Part",
122
+ "PreparedSource",
123
+ "RecordEnvelope",
124
+ "RecordInfo",
125
+ "RemoteModelRefused",
126
+ "RunContext",
127
+ "SearchFromWorker",
128
+ "SearchUsageError",
129
+ "Source",
130
+ "SourceInfo",
131
+ "Stage",
132
+ "StepRunSummary",
133
+ "StepStatus",
134
+ "SystematicModelFailure",
135
+ "TextChunk",
136
+ "UpstreamOutcome",
137
+ "VerbatimMatch",
138
+ "chunk_item",
139
+ "chunk_text",
140
+ "count_external_resource_urls",
141
+ "estimate_tokens",
142
+ "find_verbatim_span",
143
+ "pack_batches",
144
+ "page_external_resource_count",
145
+ "prepare_source",
146
+ "reduce_tree",
147
+ "render_page",
148
+ "renumber_chunks",
149
+ ]