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.
- commissure/__init__.py +5 -0
- commissure/api.py +149 -0
- commissure/chunk.py +796 -0
- commissure/cli.py +1100 -0
- commissure/deliver/__init__.py +1 -0
- commissure/deliver/html.py +450 -0
- commissure/deliver/static/chart.umd.min.js +14 -0
- commissure/deliver/static/charts.js +387 -0
- commissure/deliver/static/cytoscape.min.js +31 -0
- commissure/deliver/static/favicon.svg +16 -0
- commissure/deliver/static/htmx.min.js +1 -0
- commissure/deliver/static/licenses/chartjs.LICENSE.md +9 -0
- commissure/deliver/static/licenses/cytoscape.LICENSE.txt +19 -0
- commissure/deliver/static/licenses/htmx.LICENSE.txt +13 -0
- commissure/deliver/static/licenses/pico.LICENSE.md +21 -0
- commissure/deliver/static/logo.svg +17 -0
- commissure/deliver/static/pico.min.css +4 -0
- commissure/deliver/static/report.css +1473 -0
- commissure/deliver/static/report.js +262 -0
- commissure/deliver/templates/interface.html.j2 +19 -0
- commissure/deliver/templates/interface_busy_bar.html.j2 +60 -0
- commissure/deliver/templates/interface_root.html.j2 +199 -0
- commissure/deliver/templates/page.html.j2 +59 -0
- commissure/deliver/templates/review_index.html.j2 +96 -0
- commissure/deliver/templates/review_instance.html.j2 +80 -0
- commissure/deliver/templates/review_sample.html.j2 +51 -0
- commissure/evidence.py +280 -0
- commissure/graph.py +354 -0
- commissure/ingest.py +729 -0
- commissure/inspect.py +1148 -0
- commissure/kit/AGENTS.md +97 -0
- commissure/kit/docs/architecture.md +127 -0
- commissure/kit/docs/guide.md +360 -0
- commissure/kit/docs/solutions.md +40 -0
- commissure/kit/skills/build-recipe-stage/SKILL.md +153 -0
- commissure/kit/skills/investigate-solution/SKILL.md +47 -0
- commissure/limits.py +215 -0
- commissure/llm.py +1661 -0
- commissure/locate.py +98 -0
- commissure/parse/__init__.py +146 -0
- commissure/parse/html.py +400 -0
- commissure/parse/model.py +100 -0
- commissure/parse/ocr.py +147 -0
- commissure/parse/office.py +98 -0
- commissure/parse/pdf.py +177 -0
- commissure/parse/pool.py +288 -0
- commissure/parse/step.py +225 -0
- commissure/parse/tabular.py +259 -0
- commissure/patterns/__init__.py +140 -0
- commissure/patterns/citations.py +180 -0
- commissure/patterns/currency.py +410 -0
- commissure/patterns/fetch.py +470 -0
- commissure/patterns/table.py +216 -0
- commissure/patterns/templates/record_table.html.j2 +27 -0
- commissure/patterns/text.py +263 -0
- commissure/probe/__init__.py +123 -0
- commissure/probe/office.py +137 -0
- commissure/probe/pdf.py +367 -0
- commissure/probe/render.py +102 -0
- commissure/probe/tabular.py +283 -0
- commissure/progress.py +134 -0
- commissure/recipes.py +874 -0
- commissure/recon.py +731 -0
- commissure/records.py +95 -0
- commissure/review.py +809 -0
- commissure/review_page.py +493 -0
- commissure/runner.py +785 -0
- commissure/runs.py +74 -0
- commissure/scaffold/__init__.py +189 -0
- commissure/scaffold/example/README.md +34 -0
- commissure/scaffold/example/docs/notes.md +17 -0
- commissure/scaffold/example/intake/comments/c01.html +1 -0
- commissure/scaffold/example/intake/comments/c02.html +1 -0
- commissure/scaffold/example/intake/comments/c03.html +1 -0
- commissure/scaffold/example/intake/comments/c04.html +1 -0
- commissure/scaffold/example/intake/comments/c05.html +1 -0
- commissure/scaffold/example/intake/comments/c06.html +1 -0
- commissure/scaffold/example/intake/comments/c07.html +1 -0
- commissure/scaffold/example/intake/comments/c08.html +1 -0
- commissure/scaffold/example/intake/comments/c09.html +1 -0
- commissure/scaffold/example/intake/comments/c10.html +1 -0
- commissure/scaffold/example/intake/comments/c11.html +1 -0
- commissure/scaffold/example/intake/comments/c12.html +1 -0
- commissure/scaffold/example/intake/comments/c13.html +1 -0
- commissure/scaffold/example/intake/comments/c14.html +1 -0
- commissure/scaffold/example/intake/comments/c15.html +1 -0
- commissure/scaffold/example/intake/comments/c16.html +1 -0
- commissure/scaffold/example/intake/comments/c17.html +1 -0
- commissure/scaffold/example/intake/comments/c18.html +1 -0
- commissure/scaffold/example/intake/comments/c19.docx +0 -0
- commissure/scaffold/example/intake/comments/c20.docx +0 -0
- commissure/scaffold/example/intake/comments/c21.pdf +46 -0
- commissure/scaffold/example/intake/comments/c22.pdf +34 -0
- commissure/scaffold/example/intake/comments/c23-scan.pdf +0 -0
- commissure/scaffold/example/recipe/_AGENTS.md +38 -0
- commissure/scaffold/example/recipe/__init__.py +1 -0
- commissure/scaffold/example/recipe/extract.py +66 -0
- commissure/scaffold/example/recipe/interface.py +80 -0
- commissure/scaffold/example/recipe/recipe.py +30 -0
- commissure/scaffold/example/recipe/schema.py +33 -0
- commissure/scaffold/example/recipe/tally.py +22 -0
- commissure/scaffold/example/tests/test_recipe.py +95 -0
- commissure/scaffold/project/.claude/settings.json +9 -0
- commissure/scaffold/project/CHANGELOG.md +5 -0
- commissure/scaffold/project/README.md +47 -0
- commissure/scaffold/project/_AGENTS.md +25 -0
- commissure/scaffold/project/_CLAUDE.md +2 -0
- commissure/scaffold/project/_gitignore +38 -0
- commissure/scaffold/project/_pyproject.toml +27 -0
- commissure/scaffold/project/docs/README.md +9 -0
- commissure/scaffold/project/docs/notes.md +19 -0
- commissure/scaffold/project/intake/README.md +7 -0
- commissure/scaffold/project/recipe/_AGENTS.md +30 -0
- commissure/scaffold/project/recipe/__init__.py +1 -0
- commissure/scaffold/project/recipe/analyze.py +10 -0
- commissure/scaffold/project/recipe/deliver.py +27 -0
- commissure/scaffold/project/recipe/extract.py +10 -0
- commissure/scaffold/project/recipe/recipe.py +31 -0
- commissure/scaffold/project/recipe/schema.py +5 -0
- commissure/scaffold/project/tests/test_recipe.py +20 -0
- commissure/search.py +252 -0
- commissure/serve.py +2311 -0
- commissure/tools/__init__.py +8 -0
- commissure/tools/licenses.py +355 -0
- commissure/tools/licenses.toml +115 -0
- commissure/workspace.py +1173 -0
- commissure-0.4.0.dist-info/METADATA +109 -0
- commissure-0.4.0.dist-info/RECORD +131 -0
- commissure-0.4.0.dist-info/WHEEL +4 -0
- commissure-0.4.0.dist-info/entry_points.txt +3 -0
- commissure-0.4.0.dist-info/licenses/LICENSE +21 -0
commissure/__init__.py
ADDED
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
|
+
]
|