docketry 0.1.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.
- docketry/__init__.py +8 -0
- docketry/cite.py +253 -0
- docketry/cite_client.py +68 -0
- docketry/classify.py +60 -0
- docketry/cli.py +634 -0
- docketry/config.py +77 -0
- docketry/envelope.py +166 -0
- docketry/extract.py +195 -0
- docketry/gates/__init__.py +28 -0
- docketry/gates/builtin.py +164 -0
- docketry/gates/classifier.py +28 -0
- docketry/gates/notice.py +59 -0
- docketry/lint.py +172 -0
- docketry/mailbox.py +77 -0
- docketry/manifest.py +105 -0
- docketry/notices.py +268 -0
- docketry/pipeline.py +157 -0
- docketry/store.py +340 -0
- docketry/webui.py +202 -0
- docketry-0.1.0.dist-info/METADATA +343 -0
- docketry-0.1.0.dist-info/RECORD +25 -0
- docketry-0.1.0.dist-info/WHEEL +4 -0
- docketry-0.1.0.dist-info/entry_points.txt +2 -0
- docketry-0.1.0.dist-info/licenses/LICENSE +202 -0
- docketry-0.1.0.dist-info/licenses/NOTICE +4 -0
docketry/webui.py
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"""Local review dashboard: the queue/approve flow in a browser.
|
|
2
|
+
|
|
3
|
+
Same store, same validated paths as the CLI — approvals go through the same
|
|
4
|
+
binding/authority checks, so the UI is a window, never a bypass. Serves on
|
|
5
|
+
127.0.0.1 ONLY: this is a single-user local tool, not a web app; there is no
|
|
6
|
+
auth layer and it must never be bound to a public interface. POSTs carry a
|
|
7
|
+
per-process random token so a stray cross-site request can't approve
|
|
8
|
+
anything.
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import html
|
|
13
|
+
import json
|
|
14
|
+
import secrets
|
|
15
|
+
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
|
16
|
+
from urllib.parse import parse_qs
|
|
17
|
+
|
|
18
|
+
from . import store as st
|
|
19
|
+
from .pipeline import Runner
|
|
20
|
+
from .store import Store
|
|
21
|
+
|
|
22
|
+
_PAGE = """<!doctype html><html><head><meta charset="utf-8">
|
|
23
|
+
<meta http-equiv="refresh" content="60">
|
|
24
|
+
<title>Docketry</title><style>
|
|
25
|
+
body{{font-family:system-ui,sans-serif;margin:2rem auto;max-width:60rem;padding:0 1rem;color:#1a1a1a;background:#fafaf7}}
|
|
26
|
+
h1{{font-size:1.3rem}} h2{{font-size:1.05rem;margin-top:2rem;border-bottom:1px solid #ddd;padding-bottom:.3rem}}
|
|
27
|
+
table{{border-collapse:collapse;width:100%;font-size:.9rem}} td,th{{text-align:left;padding:.35rem .5rem;border-bottom:1px solid #eee;vertical-align:top}}
|
|
28
|
+
.f{{color:#a11;font-weight:600}} .w{{color:#a60}} .i{{color:#567}}
|
|
29
|
+
.badge{{display:inline-block;padding:.1rem .45rem;border-radius:.6rem;font-size:.75rem;background:#eee}}
|
|
30
|
+
.badge.held{{background:#fde3e3}} .badge.done{{background:#e3f2e3}}
|
|
31
|
+
form.inline{{display:inline}} input[type=text]{{width:7rem}} button{{cursor:pointer}}
|
|
32
|
+
.counts span{{margin-right:1.2rem}}
|
|
33
|
+
</style></head><body>
|
|
34
|
+
<h1>Docketry — local review</h1>
|
|
35
|
+
<p class="counts">{counts}</p>
|
|
36
|
+
<h2>Held for review</h2>{queue}
|
|
37
|
+
<h2>Doc-type proposals</h2>{classq}
|
|
38
|
+
<h2>Recent notices</h2>{notices}
|
|
39
|
+
<p style="color:#888;font-size:.8rem">127.0.0.1 only · refreshes every 60s ·
|
|
40
|
+
approvals are recorded with the name and role you enter</p>
|
|
41
|
+
</body></html>"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _esc(v) -> str:
|
|
45
|
+
return html.escape(str(v), quote=True)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _render(store: Store, pipeline, token: str) -> str:
|
|
49
|
+
counts = store.counts() or {}
|
|
50
|
+
counts_html = "".join(
|
|
51
|
+
f'<span class="badge {"held" if k in (st.PENDING_REVIEW, st.BLOCKED) else "done" if k == st.DONE else ""}">{_esc(k)}: {v}</span>'
|
|
52
|
+
for k, v in sorted(counts.items())
|
|
53
|
+
) or "no messages yet"
|
|
54
|
+
|
|
55
|
+
rows = []
|
|
56
|
+
for row in store.list_by_status(st.PENDING_REVIEW) + store.list_by_status(st.BLOCKED):
|
|
57
|
+
env = json.loads(row["envelope_json"])
|
|
58
|
+
findings = "<br>".join(
|
|
59
|
+
f'<span class="{"f" if f["severity"] == "fail" else "w"}">[{_esc(f["gate_id"])}] {_esc(f["summary"])}</span>'
|
|
60
|
+
for f in store.findings_for(row["id"]) if f["severity"] != "info"
|
|
61
|
+
)
|
|
62
|
+
gates = sorted({f["gate_id"] for f in store.findings_for(row["id"])
|
|
63
|
+
if f["severity"] == "fail"})
|
|
64
|
+
auth = {b.gate.id: b.authority for b in pipeline.bindings_for(row["stage"])}
|
|
65
|
+
forms = "".join(
|
|
66
|
+
f'<form class="inline" method="post" action="/approve">'
|
|
67
|
+
f'<input type="hidden" name="token" value="{token}">'
|
|
68
|
+
f'<input type="hidden" name="message" value="{row["id"]}">'
|
|
69
|
+
f'<input type="hidden" name="gate" value="{_esc(g)}">'
|
|
70
|
+
f'<input type="text" name="by" placeholder="your name" required> '
|
|
71
|
+
f'<button>approve {_esc(g)} as {_esc(auth.get(g, "?"))}</button>'
|
|
72
|
+
f'<input type="hidden" name="role" value="{_esc(auth.get(g, ""))}">'
|
|
73
|
+
f'</form> '
|
|
74
|
+
for g in gates
|
|
75
|
+
)
|
|
76
|
+
rows.append(
|
|
77
|
+
f'<tr><td>{row["id"]}</td><td>{_esc(env["subject"])}<br>'
|
|
78
|
+
f'<small>from {_esc(env["from_addr"])}</small></td>'
|
|
79
|
+
f'<td>{findings}</td><td>{forms}</td></tr>'
|
|
80
|
+
)
|
|
81
|
+
queue_html = (
|
|
82
|
+
"<table><tr><th>#</th><th>message</th><th>held by</th><th>release</th></tr>"
|
|
83
|
+
+ "".join(rows) + "</table>"
|
|
84
|
+
) if rows else "<p>queue empty</p>"
|
|
85
|
+
|
|
86
|
+
crows = []
|
|
87
|
+
for r in store.open_classifications():
|
|
88
|
+
current = f' <small>(current: {_esc(r["doc_type"])})</small>' if r["doc_type"] else ""
|
|
89
|
+
crows.append(
|
|
90
|
+
f'<tr><td>{r["id"]}</td><td>{_esc(r["filename"])}</td>'
|
|
91
|
+
f'<td>{_esc(r["label"])} ({_esc(r["tier"])}){current}</td>'
|
|
92
|
+
f'<td><form class="inline" method="post" action="/class-apply">'
|
|
93
|
+
f'<input type="hidden" name="token" value="{token}">'
|
|
94
|
+
f'<input type="hidden" name="id" value="{r["id"]}">'
|
|
95
|
+
f'<input type="text" name="by" placeholder="your name" required> '
|
|
96
|
+
f'<input type="text" name="role" placeholder="role" required> '
|
|
97
|
+
f'<button>apply (fill-only)</button></form></td></tr>'
|
|
98
|
+
)
|
|
99
|
+
class_html = (
|
|
100
|
+
"<table><tr><th>#</th><th>file</th><th>proposal</th><th></th></tr>"
|
|
101
|
+
+ "".join(crows) + "</table>"
|
|
102
|
+
) if crows else "<p>none staged</p>"
|
|
103
|
+
|
|
104
|
+
nrows = []
|
|
105
|
+
for r in store.list_notices()[-25:][::-1]:
|
|
106
|
+
fields = json.loads(r["fields_json"])
|
|
107
|
+
missing = json.loads(r["missing_json"])
|
|
108
|
+
detail = ", ".join(f"{_esc(k)}={_esc(v)}" for k, v in fields.items())
|
|
109
|
+
if missing:
|
|
110
|
+
detail += f' <span class="f">MISSING: {_esc(", ".join(missing))}</span>'
|
|
111
|
+
nrows.append(
|
|
112
|
+
f'<tr><td>{r["message_id"]}</td><td>{_esc(r["notice_type"])}</td>'
|
|
113
|
+
f'<td>{_esc(r["adapter"])}</td><td>{detail}</td></tr>'
|
|
114
|
+
)
|
|
115
|
+
notices_html = (
|
|
116
|
+
"<table><tr><th>msg</th><th>type</th><th>adapter</th><th>fields</th></tr>"
|
|
117
|
+
+ "".join(nrows) + "</table>"
|
|
118
|
+
) if nrows else "<p>none parsed yet</p>"
|
|
119
|
+
|
|
120
|
+
return _PAGE.format(counts=counts_html, queue=queue_html,
|
|
121
|
+
classq=class_html, notices=notices_html)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def make_server(store_path, pipeline, host="127.0.0.1", port=8642):
|
|
125
|
+
if host != "127.0.0.1":
|
|
126
|
+
raise ValueError("the review UI is local-only; refusing to bind " + host)
|
|
127
|
+
token = secrets.token_urlsafe(24)
|
|
128
|
+
|
|
129
|
+
class Handler(BaseHTTPRequestHandler):
|
|
130
|
+
def log_message(self, *a): # quiet
|
|
131
|
+
pass
|
|
132
|
+
|
|
133
|
+
def _store(self) -> Store:
|
|
134
|
+
return Store(store_path)
|
|
135
|
+
|
|
136
|
+
def _html(self, body: str, code: int = 200):
|
|
137
|
+
data = body.encode()
|
|
138
|
+
self.send_response(code)
|
|
139
|
+
self.send_header("Content-Type", "text/html; charset=utf-8")
|
|
140
|
+
self.send_header("Content-Length", str(len(data)))
|
|
141
|
+
self.end_headers()
|
|
142
|
+
self.wfile.write(data)
|
|
143
|
+
|
|
144
|
+
def _redirect(self):
|
|
145
|
+
self.send_response(303)
|
|
146
|
+
self.send_header("Location", "/")
|
|
147
|
+
self.end_headers()
|
|
148
|
+
|
|
149
|
+
def do_GET(self):
|
|
150
|
+
if self.path not in ("/", ""):
|
|
151
|
+
self._html("not found", 404)
|
|
152
|
+
return
|
|
153
|
+
store = self._store()
|
|
154
|
+
try:
|
|
155
|
+
self._html(_render(store, pipeline, token))
|
|
156
|
+
finally:
|
|
157
|
+
store.close()
|
|
158
|
+
|
|
159
|
+
def do_POST(self):
|
|
160
|
+
length = int(self.headers.get("Content-Length", 0))
|
|
161
|
+
form = {k: v[0] for k, v in parse_qs(self.rfile.read(length).decode()).items()}
|
|
162
|
+
if form.get("token") != token:
|
|
163
|
+
self._html("bad token", 403)
|
|
164
|
+
return
|
|
165
|
+
store = self._store()
|
|
166
|
+
try:
|
|
167
|
+
if self.path == "/approve":
|
|
168
|
+
msg_id = int(form["message"])
|
|
169
|
+
row = store.get_message(msg_id)
|
|
170
|
+
bindings = {b.gate.id: b for b in pipeline.bindings_for(row["stage"])}
|
|
171
|
+
binding = bindings.get(form.get("gate", ""))
|
|
172
|
+
if row is None or binding is None or form.get("role") != binding.authority:
|
|
173
|
+
self._html("approval refused: unknown gate or wrong role", 400)
|
|
174
|
+
return
|
|
175
|
+
if not form.get("by", "").strip():
|
|
176
|
+
self._html("approval refused: approver name required", 400)
|
|
177
|
+
return
|
|
178
|
+
store.add_approval(msg_id, row["stage"], binding.gate.id,
|
|
179
|
+
approved_by=form["by"].strip(),
|
|
180
|
+
role=binding.authority, note="via local ui")
|
|
181
|
+
runner = Runner(pipeline, store)
|
|
182
|
+
try:
|
|
183
|
+
status = runner.advance(msg_id)
|
|
184
|
+
while status == st.OK:
|
|
185
|
+
status = runner.advance(msg_id)
|
|
186
|
+
except Exception:
|
|
187
|
+
pass # still held by another gate; queue shows it
|
|
188
|
+
self._redirect()
|
|
189
|
+
elif self.path == "/class-apply":
|
|
190
|
+
if not form.get("by", "").strip() or not form.get("role", "").strip():
|
|
191
|
+
self._html("refused: name and role required", 400)
|
|
192
|
+
return
|
|
193
|
+
store.apply_classification(int(form["id"]),
|
|
194
|
+
by=form["by"].strip(),
|
|
195
|
+
role=form["role"].strip())
|
|
196
|
+
self._redirect()
|
|
197
|
+
else:
|
|
198
|
+
self._html("not found", 404)
|
|
199
|
+
finally:
|
|
200
|
+
store.close()
|
|
201
|
+
|
|
202
|
+
return ThreadingHTTPServer((host, port), Handler)
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: docketry
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A local, gate-enforced port that a law firm's email flows into. Base layer for small composable legal workflow tools.
|
|
5
|
+
License:
|
|
6
|
+
Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright [yyyy] [name of copyright owner]
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
|
207
|
+
License-File: LICENSE
|
|
208
|
+
License-File: NOTICE
|
|
209
|
+
Keywords: email,guardrails,law,legal,pipeline
|
|
210
|
+
Classifier: Intended Audience :: Legal Industry
|
|
211
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
212
|
+
Classifier: Programming Language :: Python :: 3
|
|
213
|
+
Requires-Python: >=3.11
|
|
214
|
+
Provides-Extra: cite
|
|
215
|
+
Requires-Dist: eyecite>=2; extra == 'cite'
|
|
216
|
+
Requires-Dist: httpx>=0.27; extra == 'cite'
|
|
217
|
+
Provides-Extra: docx
|
|
218
|
+
Requires-Dist: python-docx>=1; extra == 'docx'
|
|
219
|
+
Provides-Extra: ocr
|
|
220
|
+
Requires-Dist: pillow>=10; extra == 'ocr'
|
|
221
|
+
Requires-Dist: pytesseract>=0.3; extra == 'ocr'
|
|
222
|
+
Provides-Extra: pdf
|
|
223
|
+
Requires-Dist: pypdf>=4; extra == 'pdf'
|
|
224
|
+
Description-Content-Type: text/markdown
|
|
225
|
+
|
|
226
|
+
# Docketry
|
|
227
|
+
|
|
228
|
+
*Working name — a local, gate-enforced port that a law firm's email flows into.*
|
|
229
|
+
|
|
230
|
+
Most firms work out of their email. Docketry meets them there — without going
|
|
231
|
+
into their email. The firm creates a **dedicated intake mailbox** (for example
|
|
232
|
+
`intake@yourfirm.com`), points forwarding rules at it, and Docketry drains that
|
|
233
|
+
one mailbox with credentials the firm holds. Nothing enters the pipeline that
|
|
234
|
+
the firm didn't send across the boundary.
|
|
235
|
+
|
|
236
|
+
Docketry is the **base layer** of a family of small, composable open-source
|
|
237
|
+
legal workflow tools (document classification, e-service notice parsing,
|
|
238
|
+
citation verification, draft linting). Each plugs into the port as a **gate**
|
|
239
|
+
in a declared pipeline.
|
|
240
|
+
|
|
241
|
+
## What makes it different
|
|
242
|
+
|
|
243
|
+
Best practices here are **code, not suggestions**:
|
|
244
|
+
|
|
245
|
+
- A message cannot cross a stage boundary without passing its gates or
|
|
246
|
+
carrying a recorded approval from the role the manifest names. `advance()`
|
|
247
|
+
is the only forward path and it re-checks every time. There is no advisory
|
|
248
|
+
mode and no bypass flag.
|
|
249
|
+
- Gates declare which pipeline stages they are meant for; binding one
|
|
250
|
+
elsewhere is a load-time error, not a footnote in documentation.
|
|
251
|
+
- Every finding and every human approval lands in an audit table on the
|
|
252
|
+
firm's own disk.
|
|
253
|
+
|
|
254
|
+
## What it is not
|
|
255
|
+
|
|
256
|
+
- **Not hosted.** Docketry runs on the firm's machine. We never hold, transit,
|
|
257
|
+
or store anyone's email.
|
|
258
|
+
- **Not a security product.** Docketry makes no malware, phishing, or other
|
|
259
|
+
cybersecurity claims. Its attachment and sender gates are pipeline-hygiene
|
|
260
|
+
policy — what the *pipeline* accepts — nothing more. Get real security from
|
|
261
|
+
your mail provider and endpoint tooling.
|
|
262
|
+
- **Not legal advice, and not a currency service.** Docketry never claims any
|
|
263
|
+
rule, deadline, or authority is up to date. It checks the inputs you give
|
|
264
|
+
it against the sources you point it at, and it fails loudly.
|
|
265
|
+
|
|
266
|
+
## Data at rest
|
|
267
|
+
|
|
268
|
+
Docketry stores messages and attachments in plaintext SQLite and files in
|
|
269
|
+
its home directory, protected by file permissions (config is written 0600).
|
|
270
|
+
It does NOT do application-level encryption, deliberately: an encrypted
|
|
271
|
+
database whose key sits on the same disk is comfort, not protection. Protect
|
|
272
|
+
a Docketry home the way you protect the rest of the client file system —
|
|
273
|
+
OS full-disk encryption (BitLocker / FileVault / LUKS) and OS accounts.
|
|
274
|
+
Nothing is ever copied off the machine.
|
|
275
|
+
|
|
276
|
+
## Try it in sixty seconds
|
|
277
|
+
|
|
278
|
+
```console
|
|
279
|
+
$ pip install docketry
|
|
280
|
+
$ docketry demo
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
`demo` seeds a disposable home with sample traffic — a clean service notice,
|
|
284
|
+
a federal NEF, a hearing notice, a drifted portal template, and an unknown
|
|
285
|
+
sender — and opens the local dashboard so you can watch the gates hold the
|
|
286
|
+
right three and release them yourself. No mailbox, no configuration, nothing
|
|
287
|
+
saved. (Downloadable one-file executables for Windows/macOS/Linux attach to
|
|
288
|
+
tagged releases — double-clicking one opens this same demo.)
|
|
289
|
+
|
|
290
|
+
## Quickstart
|
|
291
|
+
|
|
292
|
+
```console
|
|
293
|
+
$ pip install docketry
|
|
294
|
+
$ docketry init --host imap.gmail.com --user intake@yourfirm.com
|
|
295
|
+
$ export DOCKETRY_IMAP_PASSWORD='app-password-here'
|
|
296
|
+
$ docketry poll # sweep the intake mailbox once
|
|
297
|
+
$ docketry queue # see anything a gate held for review
|
|
298
|
+
$ docketry approve 3 --gate sender-scope --by "Dana" --role paralegal
|
|
299
|
+
$ docketry status
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The pipeline is declared in `guardrails.toml` in your Docketry home directory
|
|
303
|
+
(see `examples/guardrails.toml`). Reading the intake mailbox is strictly
|
|
304
|
+
read-only: messages are never marked, moved, or deleted.
|
|
305
|
+
|
|
306
|
+
## Skills starter pack
|
|
307
|
+
|
|
308
|
+
`skills/` ships three agent skills for Claude Code (or any Agent
|
|
309
|
+
Skills-compatible harness): `review-draft` (runs verify-draft + lint on a
|
|
310
|
+
draft), `classify-document`, and `intake-triage`. Install by copying into
|
|
311
|
+
your project:
|
|
312
|
+
|
|
313
|
+
```console
|
|
314
|
+
$ cp -r skills/* .claude/skills/
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
The skills are a front door, not a bypass: each one drives the same CLI
|
|
318
|
+
commands and gates the pipeline uses, and each carries hard rules — a skill
|
|
319
|
+
never verifies a citation from model knowledge, never applies a
|
|
320
|
+
classification without a named human approver, and never releases a hold
|
|
321
|
+
itself. `examples/` includes three guardrail manifests to start from
|
|
322
|
+
(default, solo-strict, litigation-team).
|
|
323
|
+
|
|
324
|
+
## Evals
|
|
325
|
+
|
|
326
|
+
Each skill ships an eval suite (`skills/<name>/evals/`) in the
|
|
327
|
+
`claude plugin eval` format. The graders encode the hard rules as tests:
|
|
328
|
+
`tool_used` asserts the agent actually RAN `docketry verify-draft` (answering
|
|
329
|
+
from model knowledge fails the eval even when the answer is right),
|
|
330
|
+
`min: 0, max: 0` graders assert approvals were never executed by the agent,
|
|
331
|
+
and judge graders check the honesty of degraded-mode reporting. The eval
|
|
332
|
+
runner is currently in early access; the suites are validated for shape in
|
|
333
|
+
CI and runnable wherever `claude plugin eval` is enabled.
|
|
334
|
+
|
|
335
|
+
## Requirements
|
|
336
|
+
|
|
337
|
+
Python 3.11+. The core is stdlib-only. Feature plugins declare extras
|
|
338
|
+
(`pip install "docketry[pdf,ocr]"` etc.) — see [FEATURES.md](FEATURES.md)
|
|
339
|
+
for the feature manifest and its dependency graph.
|
|
340
|
+
|
|
341
|
+
## License
|
|
342
|
+
|
|
343
|
+
Apache-2.0.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
docketry/__init__.py,sha256=t8S3uKKqmU3Nt8jayMVGFFczVOz026JFBXcP0OKzbkE,392
|
|
2
|
+
docketry/cite.py,sha256=vKYjznY6LmPZS4VDyeWIYgxXSZHdBispVS4G-vV7Sg0,9738
|
|
3
|
+
docketry/cite_client.py,sha256=heyG9g8Mc66pleJbAn-zgg7xADMRjcLCF0a2fYKYS0Y,2599
|
|
4
|
+
docketry/classify.py,sha256=XcvDGvUIczhoxHu0YKJnyCx_vE9fXQocZ_v_RyKp78s,2830
|
|
5
|
+
docketry/cli.py,sha256=WO-coWU0Ti4f1rNiL9CgQSYA6vtvHFp7hhc2B0QYNkw,24607
|
|
6
|
+
docketry/config.py,sha256=vIozEe6VSCqWAWDBgAj_rY7qRZ5ts8qmDEXQW2tnHtc,2105
|
|
7
|
+
docketry/envelope.py,sha256=Xvo3lacL1E1Fo9U9XBh7CHv2FcnJXChSeIuFvmJsIW4,4981
|
|
8
|
+
docketry/extract.py,sha256=VGvwfCUtqSv6KkTKeasf0yProGQ5NOti_j6g2b8UOJQ,6932
|
|
9
|
+
docketry/lint.py,sha256=xxbmAaihQG6zB8F-yX2XLgoUGpXND8FnqG8rykF-tio,6425
|
|
10
|
+
docketry/mailbox.py,sha256=ON9jgabrWpDbTGqsb_LLoIEwJ_phpKwqHq-OViKMJ-I,2617
|
|
11
|
+
docketry/manifest.py,sha256=4YYHYBxn0v_QZyX3ryKP2_T2UI7ajgWexgWt_HIdEgY,3406
|
|
12
|
+
docketry/notices.py,sha256=SafBWAYKBLqpPUjBs1xpaNOOLnWaOHYLCmxDnVGM5TI,11903
|
|
13
|
+
docketry/pipeline.py,sha256=56sUt10b9UdCEqQcdY8DmFeAZOLDgWTWCQYI7JlrCwY,5547
|
|
14
|
+
docketry/store.py,sha256=FMyq01Vyh5h03x9n53_rT4Rq2o32kyPfzR2iuJygVl8,13480
|
|
15
|
+
docketry/webui.py,sha256=HKm6iFScA7bvgy0Hk2hcWMbF3b1UBl4TbOVtf7nBsUA,9199
|
|
16
|
+
docketry/gates/__init__.py,sha256=hB3fa7vVahfK9qoiIeKulZUdFsyZi7_knopff-TW3D4,716
|
|
17
|
+
docketry/gates/builtin.py,sha256=dFpa-E3zjahX3ubQJbaMAp7lhLLaKCGXYZv9OarxACQ,6164
|
|
18
|
+
docketry/gates/classifier.py,sha256=zfdA2G8xzZ2GNrmSlIc7tzaY8J7l6vg2i3uC9kOwFMA,924
|
|
19
|
+
docketry/gates/notice.py,sha256=UEsdiuNUa1FOK46Am-nFV4kG6w50aNeyC5stn7BdLdI,2030
|
|
20
|
+
docketry-0.1.0.dist-info/METADATA,sha256=KpQibXdhiYYueavYApZhyKS9pxCoa1PDV8MVuMxv-7g,18835
|
|
21
|
+
docketry-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
22
|
+
docketry-0.1.0.dist-info/entry_points.txt,sha256=1ZHJ5TAKg23bzEZH8DQPT4gfSKay07oDAlEJB7yTaPU,47
|
|
23
|
+
docketry-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
24
|
+
docketry-0.1.0.dist-info/licenses/NOTICE,sha256=CNbx_Eo0nVlj68YgxdVdQt86YKRhBzLBKa8eNAHl4cQ,124
|
|
25
|
+
docketry-0.1.0.dist-info/RECORD,,
|