commissure 0.4.0__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 (131) hide show
  1. commissure/__init__.py +5 -0
  2. commissure/api.py +149 -0
  3. commissure/chunk.py +796 -0
  4. commissure/cli.py +1100 -0
  5. commissure/deliver/__init__.py +1 -0
  6. commissure/deliver/html.py +450 -0
  7. commissure/deliver/static/chart.umd.min.js +14 -0
  8. commissure/deliver/static/charts.js +387 -0
  9. commissure/deliver/static/cytoscape.min.js +31 -0
  10. commissure/deliver/static/favicon.svg +16 -0
  11. commissure/deliver/static/htmx.min.js +1 -0
  12. commissure/deliver/static/licenses/chartjs.LICENSE.md +9 -0
  13. commissure/deliver/static/licenses/cytoscape.LICENSE.txt +19 -0
  14. commissure/deliver/static/licenses/htmx.LICENSE.txt +13 -0
  15. commissure/deliver/static/licenses/pico.LICENSE.md +21 -0
  16. commissure/deliver/static/logo.svg +17 -0
  17. commissure/deliver/static/pico.min.css +4 -0
  18. commissure/deliver/static/report.css +1473 -0
  19. commissure/deliver/static/report.js +262 -0
  20. commissure/deliver/templates/interface.html.j2 +19 -0
  21. commissure/deliver/templates/interface_busy_bar.html.j2 +60 -0
  22. commissure/deliver/templates/interface_root.html.j2 +199 -0
  23. commissure/deliver/templates/page.html.j2 +59 -0
  24. commissure/deliver/templates/review_index.html.j2 +96 -0
  25. commissure/deliver/templates/review_instance.html.j2 +80 -0
  26. commissure/deliver/templates/review_sample.html.j2 +51 -0
  27. commissure/evidence.py +280 -0
  28. commissure/graph.py +354 -0
  29. commissure/ingest.py +729 -0
  30. commissure/inspect.py +1148 -0
  31. commissure/kit/AGENTS.md +97 -0
  32. commissure/kit/docs/architecture.md +127 -0
  33. commissure/kit/docs/guide.md +360 -0
  34. commissure/kit/docs/solutions.md +40 -0
  35. commissure/kit/skills/build-recipe-stage/SKILL.md +153 -0
  36. commissure/kit/skills/investigate-solution/SKILL.md +47 -0
  37. commissure/limits.py +215 -0
  38. commissure/llm.py +1661 -0
  39. commissure/locate.py +98 -0
  40. commissure/parse/__init__.py +146 -0
  41. commissure/parse/html.py +400 -0
  42. commissure/parse/model.py +100 -0
  43. commissure/parse/ocr.py +147 -0
  44. commissure/parse/office.py +98 -0
  45. commissure/parse/pdf.py +177 -0
  46. commissure/parse/pool.py +288 -0
  47. commissure/parse/step.py +225 -0
  48. commissure/parse/tabular.py +259 -0
  49. commissure/patterns/__init__.py +140 -0
  50. commissure/patterns/citations.py +180 -0
  51. commissure/patterns/currency.py +410 -0
  52. commissure/patterns/fetch.py +470 -0
  53. commissure/patterns/table.py +216 -0
  54. commissure/patterns/templates/record_table.html.j2 +27 -0
  55. commissure/patterns/text.py +263 -0
  56. commissure/probe/__init__.py +123 -0
  57. commissure/probe/office.py +137 -0
  58. commissure/probe/pdf.py +367 -0
  59. commissure/probe/render.py +102 -0
  60. commissure/probe/tabular.py +283 -0
  61. commissure/progress.py +134 -0
  62. commissure/recipes.py +874 -0
  63. commissure/recon.py +731 -0
  64. commissure/records.py +95 -0
  65. commissure/review.py +809 -0
  66. commissure/review_page.py +493 -0
  67. commissure/runner.py +785 -0
  68. commissure/runs.py +74 -0
  69. commissure/scaffold/__init__.py +189 -0
  70. commissure/scaffold/example/README.md +34 -0
  71. commissure/scaffold/example/docs/notes.md +17 -0
  72. commissure/scaffold/example/intake/comments/c01.html +1 -0
  73. commissure/scaffold/example/intake/comments/c02.html +1 -0
  74. commissure/scaffold/example/intake/comments/c03.html +1 -0
  75. commissure/scaffold/example/intake/comments/c04.html +1 -0
  76. commissure/scaffold/example/intake/comments/c05.html +1 -0
  77. commissure/scaffold/example/intake/comments/c06.html +1 -0
  78. commissure/scaffold/example/intake/comments/c07.html +1 -0
  79. commissure/scaffold/example/intake/comments/c08.html +1 -0
  80. commissure/scaffold/example/intake/comments/c09.html +1 -0
  81. commissure/scaffold/example/intake/comments/c10.html +1 -0
  82. commissure/scaffold/example/intake/comments/c11.html +1 -0
  83. commissure/scaffold/example/intake/comments/c12.html +1 -0
  84. commissure/scaffold/example/intake/comments/c13.html +1 -0
  85. commissure/scaffold/example/intake/comments/c14.html +1 -0
  86. commissure/scaffold/example/intake/comments/c15.html +1 -0
  87. commissure/scaffold/example/intake/comments/c16.html +1 -0
  88. commissure/scaffold/example/intake/comments/c17.html +1 -0
  89. commissure/scaffold/example/intake/comments/c18.html +1 -0
  90. commissure/scaffold/example/intake/comments/c19.docx +0 -0
  91. commissure/scaffold/example/intake/comments/c20.docx +0 -0
  92. commissure/scaffold/example/intake/comments/c21.pdf +46 -0
  93. commissure/scaffold/example/intake/comments/c22.pdf +34 -0
  94. commissure/scaffold/example/intake/comments/c23-scan.pdf +0 -0
  95. commissure/scaffold/example/recipe/_AGENTS.md +38 -0
  96. commissure/scaffold/example/recipe/__init__.py +1 -0
  97. commissure/scaffold/example/recipe/extract.py +66 -0
  98. commissure/scaffold/example/recipe/interface.py +80 -0
  99. commissure/scaffold/example/recipe/recipe.py +30 -0
  100. commissure/scaffold/example/recipe/schema.py +33 -0
  101. commissure/scaffold/example/recipe/tally.py +22 -0
  102. commissure/scaffold/example/tests/test_recipe.py +95 -0
  103. commissure/scaffold/project/.claude/settings.json +9 -0
  104. commissure/scaffold/project/CHANGELOG.md +5 -0
  105. commissure/scaffold/project/README.md +47 -0
  106. commissure/scaffold/project/_AGENTS.md +25 -0
  107. commissure/scaffold/project/_CLAUDE.md +2 -0
  108. commissure/scaffold/project/_gitignore +38 -0
  109. commissure/scaffold/project/_pyproject.toml +27 -0
  110. commissure/scaffold/project/docs/README.md +9 -0
  111. commissure/scaffold/project/docs/notes.md +19 -0
  112. commissure/scaffold/project/intake/README.md +7 -0
  113. commissure/scaffold/project/recipe/_AGENTS.md +30 -0
  114. commissure/scaffold/project/recipe/__init__.py +1 -0
  115. commissure/scaffold/project/recipe/analyze.py +10 -0
  116. commissure/scaffold/project/recipe/deliver.py +27 -0
  117. commissure/scaffold/project/recipe/extract.py +10 -0
  118. commissure/scaffold/project/recipe/recipe.py +31 -0
  119. commissure/scaffold/project/recipe/schema.py +5 -0
  120. commissure/scaffold/project/tests/test_recipe.py +20 -0
  121. commissure/search.py +252 -0
  122. commissure/serve.py +2311 -0
  123. commissure/tools/__init__.py +8 -0
  124. commissure/tools/licenses.py +355 -0
  125. commissure/tools/licenses.toml +115 -0
  126. commissure/workspace.py +1173 -0
  127. commissure-0.4.0.dist-info/METADATA +109 -0
  128. commissure-0.4.0.dist-info/RECORD +131 -0
  129. commissure-0.4.0.dist-info/WHEEL +4 -0
  130. commissure-0.4.0.dist-info/entry_points.txt +3 -0
  131. commissure-0.4.0.dist-info/licenses/LICENSE +21 -0
commissure/__init__.py ADDED
@@ -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")
commissure/api.py ADDED
@@ -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
+ ]