agent-pdf-workspace 0.1.1__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.
- agent_pdf_workspace-0.1.1/.github/workflows/ci.yml +76 -0
- agent_pdf_workspace-0.1.1/.gitignore +11 -0
- agent_pdf_workspace-0.1.1/CONTRIBUTING.md +11 -0
- agent_pdf_workspace-0.1.1/LICENSE +201 -0
- agent_pdf_workspace-0.1.1/PKG-INFO +173 -0
- agent_pdf_workspace-0.1.1/README.md +148 -0
- agent_pdf_workspace-0.1.1/SECURITY.md +29 -0
- agent_pdf_workspace-0.1.1/benchmarks/parsebench/README.md +13 -0
- agent_pdf_workspace-0.1.1/benchmarks/parsebench/agent_pdf_workspace.py +312 -0
- agent_pdf_workspace-0.1.1/benchmarks/parsebench/results/2026-07-15-chart-test.md +53 -0
- agent_pdf_workspace-0.1.1/benchmarks/parsebench/results/2026-07-15-test-suite.md +47 -0
- agent_pdf_workspace-0.1.1/docs/format-v1.md +54 -0
- agent_pdf_workspace-0.1.1/docs/release.md +18 -0
- agent_pdf_workspace-0.1.1/pyproject.toml +79 -0
- agent_pdf_workspace-0.1.1/scripts/generate_schemas.py +94 -0
- agent_pdf_workspace-0.1.1/scripts/no_network/sitecustomize.py +24 -0
- agent_pdf_workspace-0.1.1/scripts/smoke_wheel.py +105 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/__init__.py +48 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/_io.py +97 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/assets/opencode/agent_pdf_workspace.ts +237 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/cli.py +322 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/config.py +39 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/errors.py +33 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/extraction/__init__.py +1 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/extraction/geometry.py +647 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/extraction/liteparse_backend.py +152 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/extraction/pdf_inventory.py +166 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/extraction/worker.py +50 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/ids.py +35 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/models.py +195 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/opencode.py +134 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/audit-region-v1.schema.json +53 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/diagnostic-v1.schema.json +45 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/ingest-config-v1.schema.json +89 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/page-v1.schema.json +271 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/page-visual-audit-v1.schema.json +127 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/search-hit-v1.schema.json +73 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/table-v1.schema.json +55 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/text-block-v1.schema.json +78 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/verification-result-v1.schema.json +44 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/visual-description-v1.schema.json +99 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/visual-occurrence-v1.schema.json +65 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/visual-task-v1.schema.json +153 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/schemas/workspace-v1.schema.json +111 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/search.py +287 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/skill/agent-pdf-workspace/SKILL.md +97 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/skill/agent-pdf-workspace/agents/openai.yaml +4 -0
- agent_pdf_workspace-0.1.1/src/agent_pdf_workspace/workspace.py +1352 -0
- agent_pdf_workspace-0.1.1/tests/conftest.py +233 -0
- agent_pdf_workspace-0.1.1/tests/test_bundled_contracts.py +72 -0
- agent_pdf_workspace-0.1.1/tests/test_cli.py +220 -0
- agent_pdf_workspace-0.1.1/tests/test_golden_fixtures.py +140 -0
- agent_pdf_workspace-0.1.1/tests/test_models_and_ids.py +152 -0
- agent_pdf_workspace-0.1.1/tests/test_opencode.py +86 -0
- agent_pdf_workspace-0.1.1/tests/test_package.py +14 -0
- agent_pdf_workspace-0.1.1/tests/test_security.py +326 -0
- agent_pdf_workspace-0.1.1/tests/test_semantic_markdown.py +75 -0
- agent_pdf_workspace-0.1.1/tests/test_visual_candidates.py +21 -0
- agent_pdf_workspace-0.1.1/tests/test_workspace_exploration.py +393 -0
- agent_pdf_workspace-0.1.1/tests/test_workspace_ingest.py +437 -0
- agent_pdf_workspace-0.1.1/uv.lock +1266 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
strategy:
|
|
10
|
+
fail-fast: false
|
|
11
|
+
matrix:
|
|
12
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
13
|
+
python: ["3.11", "3.12", "3.13", "3.14"]
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: astral-sh/setup-uv@v6
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python }}
|
|
20
|
+
enable-cache: true
|
|
21
|
+
- if: runner.os == 'Linux'
|
|
22
|
+
run: |
|
|
23
|
+
sudo apt-get update
|
|
24
|
+
sudo apt-get install -y tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng
|
|
25
|
+
tesseract --list-langs | grep -qx deu
|
|
26
|
+
- if: runner.os == 'macOS'
|
|
27
|
+
run: |
|
|
28
|
+
brew install tesseract tesseract-lang
|
|
29
|
+
tesseract --list-langs | grep -qx deu
|
|
30
|
+
- if: runner.os == 'Windows'
|
|
31
|
+
run: |
|
|
32
|
+
choco install tesseract --no-progress -y
|
|
33
|
+
$language = "C:\Program Files\Tesseract-OCR\tessdata\deu.traineddata"
|
|
34
|
+
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/tesseract-ocr/tessdata_fast/87416418657359cb625c412a48b6e1d6d41c29bd/deu.traineddata" -OutFile $language
|
|
35
|
+
if ((Get-FileHash -Algorithm SHA256 $language).Hash -ne "19D219BBB6672C869D20A9636C6816A81EB9A71796CB93EBE0CB1530E2CDB22D") { throw "German OCR data checksum mismatch" }
|
|
36
|
+
echo "C:\Program Files\Tesseract-OCR" >> $env:GITHUB_PATH
|
|
37
|
+
& "C:\Program Files\Tesseract-OCR\tesseract.exe" --list-langs | Select-String -Pattern '^deu$'
|
|
38
|
+
- run: uv sync --frozen
|
|
39
|
+
- run: uv run pytest
|
|
40
|
+
- run: uv run ruff check .
|
|
41
|
+
- run: uv run ruff format --check .
|
|
42
|
+
- run: uv run mypy src/agent_pdf_workspace
|
|
43
|
+
- run: uv run python -m build
|
|
44
|
+
|
|
45
|
+
coverage:
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- uses: astral-sh/setup-uv@v6
|
|
50
|
+
with:
|
|
51
|
+
python-version: "3.12"
|
|
52
|
+
enable-cache: true
|
|
53
|
+
- run: sudo apt-get update && sudo apt-get install -y tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng
|
|
54
|
+
- run: uv sync --frozen
|
|
55
|
+
- run: uv run pytest --cov=agent_pdf_workspace --cov-fail-under=80
|
|
56
|
+
|
|
57
|
+
release-smoke:
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
strategy:
|
|
60
|
+
fail-fast: false
|
|
61
|
+
matrix:
|
|
62
|
+
python: ["3.11", "3.12", "3.13", "3.14"]
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
- uses: astral-sh/setup-uv@v6
|
|
66
|
+
with:
|
|
67
|
+
python-version: ${{ matrix.python }}
|
|
68
|
+
enable-cache: true
|
|
69
|
+
- run: uv build
|
|
70
|
+
- name: Install wheel in an empty environment
|
|
71
|
+
run: |
|
|
72
|
+
uv venv --python ${{ matrix.python }} .smoke-venv
|
|
73
|
+
wheel=$(find dist -name '*.whl' -type f -print -quit)
|
|
74
|
+
uv pip install --python .smoke-venv/bin/python "$wheel"
|
|
75
|
+
- name: Run installed CLI without network access
|
|
76
|
+
run: .smoke-venv/bin/python scripts/smoke_wheel.py
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Use Python 3.11–3.14 and `uv`. Every behavior change starts with a failing test and ends with the
|
|
4
|
+
full test, lint, type, and build gates from the README.
|
|
5
|
+
|
|
6
|
+
Keep the runtime offline and model-free. Do not add URL ingestion, telemetry, automatic link
|
|
7
|
+
following, attachment execution, LLM clients, embedding clients, or hidden network fallbacks.
|
|
8
|
+
Changes to public models require matching JSON Schema and compatibility tests. Changes to the
|
|
9
|
+
bundled skill require validation with the skill creator's `quick_validate.py`.
|
|
10
|
+
|
|
11
|
+
Synthetic fixtures belong in `tests/`; never commit private or copyrighted source PDFs.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Dark Light
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-pdf-workspace
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Offline, agent-oriented PDF exploration workspaces
|
|
5
|
+
Author-email: Dark Light <darklight@noreply.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: agents,document-processing,ocr,offline,pdf
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Requires-Python: <3.15,>=3.11
|
|
17
|
+
Requires-Dist: liteparse<2.7,>=2.6
|
|
18
|
+
Requires-Dist: pdfplumber<0.12,>=0.11
|
|
19
|
+
Requires-Dist: pydantic<3,>=2.11
|
|
20
|
+
Requires-Dist: pypdf<7,>=5.7
|
|
21
|
+
Requires-Dist: pyyaml<7,>=6
|
|
22
|
+
Requires-Dist: regex<2027,>=2024.11
|
|
23
|
+
Requires-Dist: typer<1,>=0.16
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# agent-pdf-workspace
|
|
27
|
+
|
|
28
|
+
`agent-pdf-workspace` converts one local PDF into a persistent, agent-oriented workspace. Text,
|
|
29
|
+
layout, tables, OCR, metadata, exact/regex/full-text search, rendering, and integrity checks run
|
|
30
|
+
locally. The package contains no LLM, vision-model, embedding, or network client.
|
|
31
|
+
|
|
32
|
+
An external agent can inspect queued image crops with its own vision capability and return short,
|
|
33
|
+
schema-validated descriptions. PDF content is always treated as untrusted data.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
Python 3.11–3.14 is supported.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
uv tool install .
|
|
41
|
+
# or, for development from this checkout
|
|
42
|
+
uv sync
|
|
43
|
+
uv run pdfws --version
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
LiteParse supplies local PDF parsing and OCR. Check the OCR languages available on the machine when
|
|
47
|
+
using non-English scans:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
tesseract --list-langs
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
In `auto` mode the package first inspects native extraction and sends only image-dominated or
|
|
54
|
+
text-empty complex pages through local OCR; both layers retain their provenance when merged.
|
|
55
|
+
|
|
56
|
+
## Quick start
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pdfws ingest report.pdf --target ./report-workspace --ocr auto --language deu+eng --json
|
|
60
|
+
pdfws inspect ./report-workspace --json
|
|
61
|
+
pdfws search ./report-workspace "operating income" --json
|
|
62
|
+
pdfws read ./report-workspace --page 12 --json
|
|
63
|
+
pdfws visuals next ./report-workspace --json
|
|
64
|
+
pdfws verify ./report-workspace --json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For encrypted input, provide the password through standard input so it is not exposed in process
|
|
68
|
+
arguments or persisted:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
printf '%s\n' "$PDF_PASSWORD" | pdfws ingest protected.pdf --target ./workspace --password-stdin
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Visual descriptions
|
|
75
|
+
|
|
76
|
+
`pdfws visuals next` returns either a `describe_region` task or an annotated `audit_page` task.
|
|
77
|
+
For a region, have the calling agent inspect `asset_path` and submit JSON like:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"visual_id": "visual-p0001-…",
|
|
82
|
+
"crop_sha256": "…",
|
|
83
|
+
"kind": "chart",
|
|
84
|
+
"decorative": false,
|
|
85
|
+
"short_description": "Revenue rises through Q3 and dips slightly in Q4.",
|
|
86
|
+
"text_in_visual": "| Quarter | Revenue (EUR m) |\n|---|---:|\n| Q1 | 12 |\n| Q2 | 15 |",
|
|
87
|
+
"agent_id": "document-agent",
|
|
88
|
+
"model_id": "vision-model"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pdfws visuals submit ./workspace --task-id TASK --input description.json --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For charts and plots, `text_in_visual` should be a Markdown table with one row per visible data
|
|
97
|
+
point and explicit series/category, value, and unit columns. Preserve signs, decimals, years, and
|
|
98
|
+
label/value associations. Mark estimates as estimates instead of inventing precision. To correct an
|
|
99
|
+
already submitted description, recheck the crop and existing JSON and pass `--replace`; a
|
|
100
|
+
formatting-only revision must not recompute or change verified values.
|
|
101
|
+
|
|
102
|
+
Page audits can add bboxes missed by deterministic raster/vector detection; every added region then
|
|
103
|
+
becomes its own description task. Accepted descriptions are persisted as both readable Markdown
|
|
104
|
+
and a versioned JSON sidecar under `visuals/descriptions/`.
|
|
105
|
+
|
|
106
|
+
## Python API
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from agent_pdf_workspace import Workspace
|
|
110
|
+
|
|
111
|
+
workspace = Workspace.ingest(
|
|
112
|
+
"report.pdf",
|
|
113
|
+
"report-workspace",
|
|
114
|
+
ocr="auto",
|
|
115
|
+
ocr_languages=("deu", "eng"),
|
|
116
|
+
)
|
|
117
|
+
hits = workspace.search("cash flow", mode="fts")
|
|
118
|
+
page = workspace.read_page(hits[0].page)
|
|
119
|
+
crop_path = workspace.render_region(hits[0].page, (72, 90, 520, 420))
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Search hits include a stable hit ID, page, page-coordinate bounding box, kind, and snippet. Custom
|
|
123
|
+
ingestion limits supplied with `IngestConfig` are persisted without secrets and remain effective
|
|
124
|
+
when the workspace is reopened.
|
|
125
|
+
|
|
126
|
+
The main public contracts are Pydantic models exported from `agent_pdf_workspace`. Versioned JSON
|
|
127
|
+
Schemas and the bundled agent skill are included in the wheel; export the latter with
|
|
128
|
+
`pdfws skill export TARGET`.
|
|
129
|
+
|
|
130
|
+
### OpenCode installation
|
|
131
|
+
|
|
132
|
+
OpenCode calls its configurable home `OPENCODE_CONFIG_DIR`. The installer reads that variable
|
|
133
|
+
first and otherwise asks the installed CLI via `opencode debug paths`; it does not assume that
|
|
134
|
+
`~/.config/opencode` is the active directory.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pdfws opencode path --json
|
|
138
|
+
pdfws opencode install --json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The install command writes the skill to `<config>/skills/agent-pdf-workspace` and native tools to
|
|
142
|
+
`<config>/tools/agent_pdf_workspace.ts`. Use `--config-dir DIR` for an explicit directory or
|
|
143
|
+
`--force` to replace only those two package-owned artifacts. The OpenCode tools invoke `pdfws`
|
|
144
|
+
without a shell and expose bounded inspect, search, page-read, region-render, and visual-task
|
|
145
|
+
operations.
|
|
146
|
+
|
|
147
|
+
## Workspace format
|
|
148
|
+
|
|
149
|
+
The source PDF is copied unchanged to `source/original.pdf`. Human-readable Markdown provides
|
|
150
|
+
navigation while JSON sidecars preserve coordinates and provenance. Tables are also emitted as CSV.
|
|
151
|
+
SQLite FTS and rendered query crops live under `cache/` and are regenerable.
|
|
152
|
+
|
|
153
|
+
The layout is OKF-inspired but does not claim compliance with a separate OKF standard. ODT/ODF
|
|
154
|
+
export is intentionally outside version 1.
|
|
155
|
+
|
|
156
|
+
The reproducible local comparison and its limitations are documented in
|
|
157
|
+
[benchmarks/parsebench/results/2026-07-15-test-suite.md](benchmarks/parsebench/results/2026-07-15-test-suite.md).
|
|
158
|
+
|
|
159
|
+
See [docs/format-v1.md](docs/format-v1.md) for the format contract and
|
|
160
|
+
[SECURITY.md](SECURITY.md) for the trust model.
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
uv sync --python 3.12
|
|
166
|
+
uv run pytest --cov=agent_pdf_workspace --cov-fail-under=80
|
|
167
|
+
uv run ruff check .
|
|
168
|
+
uv run ruff format --check .
|
|
169
|
+
uv run mypy src/agent_pdf_workspace
|
|
170
|
+
uv run python -m build
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
No public PyPI release or remote repository is created automatically.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# agent-pdf-workspace
|
|
2
|
+
|
|
3
|
+
`agent-pdf-workspace` converts one local PDF into a persistent, agent-oriented workspace. Text,
|
|
4
|
+
layout, tables, OCR, metadata, exact/regex/full-text search, rendering, and integrity checks run
|
|
5
|
+
locally. The package contains no LLM, vision-model, embedding, or network client.
|
|
6
|
+
|
|
7
|
+
An external agent can inspect queued image crops with its own vision capability and return short,
|
|
8
|
+
schema-validated descriptions. PDF content is always treated as untrusted data.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
Python 3.11–3.14 is supported.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uv tool install .
|
|
16
|
+
# or, for development from this checkout
|
|
17
|
+
uv sync
|
|
18
|
+
uv run pdfws --version
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
LiteParse supplies local PDF parsing and OCR. Check the OCR languages available on the machine when
|
|
22
|
+
using non-English scans:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
tesseract --list-langs
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
In `auto` mode the package first inspects native extraction and sends only image-dominated or
|
|
29
|
+
text-empty complex pages through local OCR; both layers retain their provenance when merged.
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pdfws ingest report.pdf --target ./report-workspace --ocr auto --language deu+eng --json
|
|
35
|
+
pdfws inspect ./report-workspace --json
|
|
36
|
+
pdfws search ./report-workspace "operating income" --json
|
|
37
|
+
pdfws read ./report-workspace --page 12 --json
|
|
38
|
+
pdfws visuals next ./report-workspace --json
|
|
39
|
+
pdfws verify ./report-workspace --json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For encrypted input, provide the password through standard input so it is not exposed in process
|
|
43
|
+
arguments or persisted:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
printf '%s\n' "$PDF_PASSWORD" | pdfws ingest protected.pdf --target ./workspace --password-stdin
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Visual descriptions
|
|
50
|
+
|
|
51
|
+
`pdfws visuals next` returns either a `describe_region` task or an annotated `audit_page` task.
|
|
52
|
+
For a region, have the calling agent inspect `asset_path` and submit JSON like:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"visual_id": "visual-p0001-…",
|
|
57
|
+
"crop_sha256": "…",
|
|
58
|
+
"kind": "chart",
|
|
59
|
+
"decorative": false,
|
|
60
|
+
"short_description": "Revenue rises through Q3 and dips slightly in Q4.",
|
|
61
|
+
"text_in_visual": "| Quarter | Revenue (EUR m) |\n|---|---:|\n| Q1 | 12 |\n| Q2 | 15 |",
|
|
62
|
+
"agent_id": "document-agent",
|
|
63
|
+
"model_id": "vision-model"
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pdfws visuals submit ./workspace --task-id TASK --input description.json --json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For charts and plots, `text_in_visual` should be a Markdown table with one row per visible data
|
|
72
|
+
point and explicit series/category, value, and unit columns. Preserve signs, decimals, years, and
|
|
73
|
+
label/value associations. Mark estimates as estimates instead of inventing precision. To correct an
|
|
74
|
+
already submitted description, recheck the crop and existing JSON and pass `--replace`; a
|
|
75
|
+
formatting-only revision must not recompute or change verified values.
|
|
76
|
+
|
|
77
|
+
Page audits can add bboxes missed by deterministic raster/vector detection; every added region then
|
|
78
|
+
becomes its own description task. Accepted descriptions are persisted as both readable Markdown
|
|
79
|
+
and a versioned JSON sidecar under `visuals/descriptions/`.
|
|
80
|
+
|
|
81
|
+
## Python API
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from agent_pdf_workspace import Workspace
|
|
85
|
+
|
|
86
|
+
workspace = Workspace.ingest(
|
|
87
|
+
"report.pdf",
|
|
88
|
+
"report-workspace",
|
|
89
|
+
ocr="auto",
|
|
90
|
+
ocr_languages=("deu", "eng"),
|
|
91
|
+
)
|
|
92
|
+
hits = workspace.search("cash flow", mode="fts")
|
|
93
|
+
page = workspace.read_page(hits[0].page)
|
|
94
|
+
crop_path = workspace.render_region(hits[0].page, (72, 90, 520, 420))
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Search hits include a stable hit ID, page, page-coordinate bounding box, kind, and snippet. Custom
|
|
98
|
+
ingestion limits supplied with `IngestConfig` are persisted without secrets and remain effective
|
|
99
|
+
when the workspace is reopened.
|
|
100
|
+
|
|
101
|
+
The main public contracts are Pydantic models exported from `agent_pdf_workspace`. Versioned JSON
|
|
102
|
+
Schemas and the bundled agent skill are included in the wheel; export the latter with
|
|
103
|
+
`pdfws skill export TARGET`.
|
|
104
|
+
|
|
105
|
+
### OpenCode installation
|
|
106
|
+
|
|
107
|
+
OpenCode calls its configurable home `OPENCODE_CONFIG_DIR`. The installer reads that variable
|
|
108
|
+
first and otherwise asks the installed CLI via `opencode debug paths`; it does not assume that
|
|
109
|
+
`~/.config/opencode` is the active directory.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pdfws opencode path --json
|
|
113
|
+
pdfws opencode install --json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The install command writes the skill to `<config>/skills/agent-pdf-workspace` and native tools to
|
|
117
|
+
`<config>/tools/agent_pdf_workspace.ts`. Use `--config-dir DIR` for an explicit directory or
|
|
118
|
+
`--force` to replace only those two package-owned artifacts. The OpenCode tools invoke `pdfws`
|
|
119
|
+
without a shell and expose bounded inspect, search, page-read, region-render, and visual-task
|
|
120
|
+
operations.
|
|
121
|
+
|
|
122
|
+
## Workspace format
|
|
123
|
+
|
|
124
|
+
The source PDF is copied unchanged to `source/original.pdf`. Human-readable Markdown provides
|
|
125
|
+
navigation while JSON sidecars preserve coordinates and provenance. Tables are also emitted as CSV.
|
|
126
|
+
SQLite FTS and rendered query crops live under `cache/` and are regenerable.
|
|
127
|
+
|
|
128
|
+
The layout is OKF-inspired but does not claim compliance with a separate OKF standard. ODT/ODF
|
|
129
|
+
export is intentionally outside version 1.
|
|
130
|
+
|
|
131
|
+
The reproducible local comparison and its limitations are documented in
|
|
132
|
+
[benchmarks/parsebench/results/2026-07-15-test-suite.md](benchmarks/parsebench/results/2026-07-15-test-suite.md).
|
|
133
|
+
|
|
134
|
+
See [docs/format-v1.md](docs/format-v1.md) for the format contract and
|
|
135
|
+
[SECURITY.md](SECURITY.md) for the trust model.
|
|
136
|
+
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
uv sync --python 3.12
|
|
141
|
+
uv run pytest --cov=agent_pdf_workspace --cov-fail-under=80
|
|
142
|
+
uv run ruff check .
|
|
143
|
+
uv run ruff format --check .
|
|
144
|
+
uv run mypy src/agent_pdf_workspace
|
|
145
|
+
uv run python -m build
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
No public PyPI release or remote repository is created automatically.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Trust model
|
|
4
|
+
|
|
5
|
+
PDFs are hostile input. Text, metadata, links, annotations, forms, images, QR codes, JavaScript,
|
|
6
|
+
actions, attachments, and OCR results are data and never instructions.
|
|
7
|
+
|
|
8
|
+
The package:
|
|
9
|
+
|
|
10
|
+
- accepts local `.pdf` paths only and makes no network requests;
|
|
11
|
+
- validates file header, size, page count, target structure, bboxes, schemas, and search limits;
|
|
12
|
+
- parses through abortable LiteParse, pypdf, and pdfplumber workers with time and resource caps;
|
|
13
|
+
- blocks network access inside every parser and renderer worker process;
|
|
14
|
+
- inventories active actions and attachments without executing or extracting them;
|
|
15
|
+
- uses parameterized SQLite statements and bounded regex evaluation;
|
|
16
|
+
- keeps raw table cells in JSON/CSV as untrusted data; do not open CSV output in a mode that
|
|
17
|
+
evaluates spreadsheet formulas;
|
|
18
|
+
- never persists a PDF password;
|
|
19
|
+
- prevents concurrent writers and refuses symlink workspace targets;
|
|
20
|
+
- refuses symlinks anywhere inside a reopened workspace;
|
|
21
|
+
- hashes canonical output for later integrity verification.
|
|
22
|
+
|
|
23
|
+
The caller is responsible for deciding whether a visual crop may be sent to an external agent or
|
|
24
|
+
service. The bundled skill requires applying the caller's privacy and authorization policy first.
|
|
25
|
+
|
|
26
|
+
## Reporting
|
|
27
|
+
|
|
28
|
+
Do not open a public issue containing a sensitive PDF. Report the package version, platform, a
|
|
29
|
+
minimal synthetic reproducer, and the output of `pdfws verify` without secrets or document content.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# ParseBench adapter
|
|
2
|
+
|
|
3
|
+
`agent_pdf_workspace.py` is the local ParseBench provider used to normalize a persistent workspace
|
|
4
|
+
to ParseBench Markdown and layout IR. Copy it into ParseBench's parse-provider package, register the
|
|
5
|
+
provider and a pipeline named `agent_pdf_workspace`, and install this checkout in ParseBench's
|
|
6
|
+
environment.
|
|
7
|
+
|
|
8
|
+
Set `AGENT_PDF_WORKSPACE_BENCHMARK_CACHE` to reuse completed workspaces. Visual descriptions are
|
|
9
|
+
read only when their `crop_sha256` still matches the visual occurrence. The package itself does not
|
|
10
|
+
call a vision model; the recorded chart experiment used an external agent through OpenCode.
|
|
11
|
+
|
|
12
|
+
See [results/2026-07-15-chart-test.md](results/2026-07-15-chart-test.md) for the first same-fixture
|
|
13
|
+
comparison with local Docling.
|