osr-forge 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.
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.4
2
+ Name: osr-forge
3
+ Version: 0.1.0
4
+ Summary: Convert tabletop adventure module PDFs into playable osrlib Adventure documents.
5
+ Keywords: bx,osr,ttrpg,adventure-module,pdf-conversion,llm,osrlib,dungeon,old-school-essentials
6
+ Author: Marsh Macy
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Topic :: Games/Entertainment :: Role-Playing
15
+ Classifier: Typing :: Typed
16
+ Requires-Dist: osrlib>=1.2,<2
17
+ Requires-Dist: pydantic>=2
18
+ Requires-Dist: pypdfium2>=5
19
+ Requires-Dist: pillow>=11
20
+ Requires-Dist: pyyaml>=6
21
+ Requires-Dist: jsonschema>=4
22
+ Requires-Dist: openai>=2.44
23
+ Requires-Dist: azure-identity>=1 ; extra == 'entra'
24
+ Requires-Python: >=3.14
25
+ Project-URL: Changelog, https://github.com/mmacy/osr-forge/blob/main/CHANGELOG.md
26
+ Project-URL: Documentation, https://mmacy.github.io/osr-forge/
27
+ Project-URL: Issues, https://github.com/mmacy/osr-forge/issues
28
+ Project-URL: Repository, https://github.com/mmacy/osr-forge
29
+ Provides-Extra: entra
30
+ Description-Content-Type: text/markdown
31
+
32
+ # osr-forge
33
+
34
+ Convert tabletop adventure module PDFs into playable [osrlib](https://github.com/mmacy/osrlib-python) `Adventure` documents: an LLM-assisted extraction pipeline, deterministic map-geometry synthesis, a human correction loop built on an overrides file, and validation against the real osrlib models.
35
+
36
+ Standalone package + CLI. Consumers need only its artifacts — `adventure.json`, `report.json`, `overrides.yaml`, SVG map previews — or its CLI, regardless of their own tech stack.
37
+
38
+ **Status:** released — install from PyPI, docs at <https://mmacy.github.io/osr-forge/>:
39
+
40
+ ```sh
41
+ uv pip install osr-forge # or: pip install osr-forge
42
+ ```
43
+
44
+ The package runs the whole pipeline — preprocessing, the survey (chunked past `survey_max_pages`) and content extraction stages, monster resolution against the osrlib catalog, deterministic geometry synthesis (doors and secret doors on the stating room's wall, stair and trapdoor transitions from keyed and level-shaped links, guessed landings flagged), and assembly — plus the human correction loop (overrides application, `rerun`/resume, the playability lint with its smoke delve, cost estimation) and the eval harness that keeps extraction quality a measured number (`tools/eval/`). The roadmap's phase plans live in [docs/](docs/spec.md) beside [the specification](docs/spec.md).
45
+
46
+ The library entry points are `convert()`, `assemble()`, `check()`, and `estimate()`; the `osrforge` console script wraps them:
47
+
48
+ ```sh
49
+ osrforge estimate my-module.pdf # preprocess only; rough token/cost estimate
50
+ osrforge convert my-module.pdf # full pipeline into ./my-module.forge
51
+ osrforge assemble --workdir my-module.forge # stage caches + overrides → artifacts, pure
52
+ osrforge check --workdir my-module.forge # validate_adventure + the playability lint
53
+ osrforge preview --workdir my-module.forge # regenerate the SVG maps only
54
+ osrforge rerun assemble --workdir my-module.forge # resume any stage through assemble
55
+ ```
56
+
57
+ Recording sessions and live verification runs are driven via `tools/extract/run_extraction.py` (see [tools/extract/README.md](tools/extract/README.md)); the on-demand eval harness — corpus, scorer, and scoreboard — lives in `tools/eval/` (see [tools/eval/README.md](tools/eval/README.md)). The harness also measures your own retail modules: a private corpus directory side-loads with `--corpus DIR` (integrity via a local hash sidecar, truth authored per [tools/eval/AUTHORING.md](tools/eval/AUTHORING.md)), and an explicit `publish` step copies aggregate-only scores — never module text — onto the committed BYOM scoreboard.
58
+
59
+ ## The correction loop
60
+
61
+ Conversion produces a *draft* — every gap and guess called out in `report.json` — and corrections live in `overrides.yaml`, never in hand-edits to generated output (a fresh `convert` leaves a commented template there). The loop:
62
+
63
+ 1. Read `report.json` (flags, findings, the monsters summary) and eyeball `previews/*.svg` against the printed map.
64
+ 2. Edit `overrides.yaml`: monster remaps, per-area field replacement, area adds and removes, geometry (cells, edges, entrance, transitions), town/module metadata. Every entry carries a `reason`, and every entry must take effect — a typo'd address fails assembly loudly instead of silently doing nothing.
65
+ 3. `osrforge assemble && osrforge check` — re-assembly is pure and instant (no model calls), and `check` exits 0 once validation passes and no error-severity finding remains.
66
+ 4. Repeat until publishable.
67
+
68
+ Settings changes on an existing workdir go through `rerun --set` — for example, `osrforge rerun preprocess --set 'blank_page_renders=[21]'` blanks a render Azure's content filter rejects, or `osrforge rerun assemble --set unresolved_fallback=omit` flips the stand-in policy without re-rolling the model.
69
+
70
+ ## Development quickstart
71
+
72
+ Requires Python ≥ 3.14 and [uv](https://docs.astral.sh/uv/).
73
+
74
+ ```sh
75
+ uv sync
76
+ uv run pytest
77
+ ```
78
+
79
+ The full check suite, as CI runs it:
80
+
81
+ ```sh
82
+ uv run ruff format --check && uv run ruff check && uv run pyright && uv run pytest
83
+ ```
84
+
85
+ Tests use no network — model interactions replay from recorded fixtures. The only live-network activity in the repo is manual: the Foundry capability spike (`tools/spike/`) and the extraction runner (`tools/extract/`).
86
+
87
+ ## Pipeline settings
88
+
89
+ `ConversionSettings` holds the deterministic knobs, echoed into each workdir's `run.json`:
90
+
91
+ | Knob | Default | Meaning |
92
+ | --- | --- | --- |
93
+ | `render_dpi` | 150 | Page-render resolution (a legibility knob, not a cost knob — see `docs/foundry-capabilities.md`) |
94
+ | `max_pages` | 200 | Source page-count guardrail |
95
+ | `max_source_bytes` | 100 MiB | Source file-size guardrail |
96
+ | `blank_page_renders` | `()` | Page numbers whose renders are emitted as blank white PNGs (text layer still extracted) — the content-safety-filter workaround; each blanked page is flagged `page_unreadable` in the report |
97
+ | `content_batch_pages` | 8 | Content-pass batch size in pages (floor 2) |
98
+ | `survey_max_pages` | 50 | The survey chunk size — the service's measured 50-images-per-request cap: a source at or under it surveys in one request; a larger source surveys in page windows of this size, merged before normalization |
99
+ | `monster_fuzzy_threshold` | 0.85 | Monster resolution's fuzzy-tier auto-accept floor, pinned against measured catalog pairs |
100
+ | `monster_llm_top_k` | 8 | Candidate templates offered per name in the monster-resolution LLM tier |
101
+ | `custom_monsters` | `emit` | Whether the monsters stage runs the stat-block pass feeding custom-template emission: `emit` gives unresolved names the module's own creatures; `off` skips the per-unresolved-name model spend and keeps the draft SRD-catalog-pure (monsters-stage-owned — toggling it re-runs monsters, including its LLM tier) |
102
+ | `unresolved_fallback` | `best-effort` | Where resolution or parsing came up empty and no usable stat block exists: flagged level-band monster stand-ins and unguarded-treasure rolls (`best-effort`), or leave the gap (`omit`) |
103
+
104
+ On an existing workdir, change a knob with `rerun --set KEY=VALUE`: the update lands in the `run.json` settings echo before the chain runs, and a knob owned by a stage upstream of the rerun stage is rejected with the stage to rerun instead.
105
+
106
+ ## Provider configuration
107
+
108
+ The Azure AI Foundry adapter reads its connection from `OSRFORGE_FOUNDRY_*` environment variables (an osr-forge-specific prefix, deliberately not `AZURE_OPENAI_*`, to avoid colliding with other tools' conventions):
109
+
110
+ | Variable | Azure meaning | Required |
111
+ | --- | --- | --- |
112
+ | `OSRFORGE_FOUNDRY_ENDPOINT` | The Azure OpenAI resource endpoint (`https://<resource>.openai.azure.com`) | yes |
113
+ | `OSRFORGE_FOUNDRY_DEPLOYMENT` | The model deployment name | yes |
114
+ | `OSRFORGE_FOUNDRY_API_KEY` | The API key. Omit to use Entra ID via `DefaultAzureCredential`, which needs the `osr-forge[entra]` extra | no |
115
+
116
+ ## Licensing
117
+
118
+ Package code is MIT (see [LICENSE](LICENSE)). osr-forge ships no game content: osrlib's OGL data stays in osrlib, and test assets live under `tests/assets/` outside the built distribution, each with its provenance and license documented in [tests/assets/README.md](tests/assets/README.md).
119
+
120
+ These fences govern what this repository redistributes, not what you convert: bringing your own purchased, non-redistributable module is the primary use case. Conversion runs locally and everything derived from your module stays in your own workdir — nothing is shared unless you share it.
@@ -0,0 +1,34 @@
1
+ osrforge/__init__.py,sha256=AQkdePlBHubWdHO0JFZZEillcbKZqEq0VYsUXI3OfVc,512
2
+ osrforge/assemble.py,sha256=i27J8dKdAJlXR9_HhzJzktWozsHNAM0LxHoh2BWQLCc,67882
3
+ osrforge/check.py,sha256=pMuUSjTEQb29uKYZXpeCzFkf4IO7WOjjxTBQWVix2Go,22487
4
+ osrforge/cli.py,sha256=pdaSruI0vrAPmeCzwQ24IOn8ShRPGztEUqJd2yJQ6Sk,11023
5
+ osrforge/content.py,sha256=94PHthQhtpfV1vv9l9VScYBs2zNPH6mjUM0hSGQ7rVg,20748
6
+ osrforge/contracts/__init__.py,sha256=ZGoeAM6fmFxHzTaBe6jQY0lfcoZf1a74DGjt-cHVdHw,368
7
+ osrforge/contracts/overrides.py,sha256=pEm8xH99n_7CGLgj96DRK3FL_rOGVOZbGiOVilsArlo,11134
8
+ osrforge/contracts/report.py,sha256=-xdrhgzT0X3e6jZQJSi_xb_n-ZRu3-E30CX_Q4LFgKg,12569
9
+ osrforge/contracts/run.py,sha256=E-qHwaXLbkoTojYo1iKFYoeqcuqVy-lYzDJT0sCPNTw,3975
10
+ osrforge/contracts/stages.py,sha256=-8_jJdWZfgH_rfVicN10yyxWcdHGoJ91zAntac4tefk,19195
11
+ osrforge/convert.py,sha256=dPELxE85m1q7OuO9Mi03fIbIFJzt22HleSSxLMKqVzI,11315
12
+ osrforge/errors.py,sha256=0uuFegFPUFwzZ0rdFNkqV-C4k5dFntV8X3TESEXWToU,1973
13
+ osrforge/estimate.py,sha256=PjZQAzgmPotRfQyF4Fe6WVIQJ9d8ze3nGNRA2Cp_Hx8,8357
14
+ osrforge/evals.py,sha256=kqUGt6FTaTdmweua7HWSgUGHq0Pawht1HggTRBi2d_A,49055
15
+ osrforge/geometry.py,sha256=z7kewZv5c8O6OplghkafgB08LLrHYppbNufGLLuMRZU,51876
16
+ osrforge/monsters.py,sha256=g184AMBy8pAxfd5fBoPkpw10fNadT1XyHys39WYk1HY,26447
17
+ osrforge/overrides.py,sha256=mWf6w29uEppZVGNnR-VdC4lJgERLwRV7wSok3j_fXXQ,23205
18
+ osrforge/pages.py,sha256=zyu0LX8LKowx1vRZT8gxrnpocSciY9HZN17kSl3xjdY,3163
19
+ osrforge/preprocess.py,sha256=zXFGZSaG-g9t7_3JEnDzRHI2qBJsxdmA6zDgrEpzBuE,5730
20
+ osrforge/previews.py,sha256=ghAfNOA7-uxS6HPpL2m_wa3oyC1OUiSOV3qcs78csqs,6121
21
+ osrforge/providers/__init__.py,sha256=AYYcctMZcOTfnHtZnTlqsqKQBhUfu9H3UzhFR5iw8ak,412
22
+ osrforge/providers/base.py,sha256=locbYsORYXAdAk1KwLa0vulJUNdeqneYgkGbT046cms,5662
23
+ osrforge/providers/fixtures.py,sha256=xnDi7ucfCpnOXvP2IhQCWe-bXbUaPI0KaRd-t4D-LaM,6468
24
+ osrforge/providers/foundry.py,sha256=zqaQ-uClLVpHZEslksWFheDvrqzH1b2AEcKDIWmzuiM,10449
25
+ osrforge/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ osrforge/settings.py,sha256=COfPNWZL4XSq-xWU_rVHvkGBeRYMuWE99Fd19ss8tl4,4872
27
+ osrforge/survey.py,sha256=hQVfeutHp_CtoCsZSgXcnX_F4YypGcd1g1OtQdgUhg8,27846
28
+ osrforge/versioning.py,sha256=OcOWPxwntqTvxGbKv7HqV_f1F5UK7CFLXq0KBLMhdpk,1005
29
+ osrforge/workdir.py,sha256=sRhsuVLLf-bXAsIHeljauFfRqO1htuBqyR6w0EZ7dhU,9478
30
+ osr_forge-0.1.0.dist-info/licenses/LICENSE,sha256=VilPtgJh_TlCG79BW1ZucsC3EGbjwtsJA_SnA8gGoUc,1067
31
+ osr_forge-0.1.0.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
32
+ osr_forge-0.1.0.dist-info/entry_points.txt,sha256=91ABm3BPg_LOM1bRn-nzQPqG9PsjLfSknu8_xFT2Egs,48
33
+ osr_forge-0.1.0.dist-info/METADATA,sha256=6HHQ0tmzN7BHu1OLaaabJVg_oZtxK7xlqHsmht1k1CE,8737
34
+ osr_forge-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.8.24
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ osrforge = osrforge.cli:main
3
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marsh Macy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
osrforge/__init__.py ADDED
@@ -0,0 +1,13 @@
1
+ """osr-forge: convert tabletop adventure module PDFs into playable osrlib adventures.
2
+
3
+ The public façade re-exports only the names the library API promises. Everything
4
+ else is imported from its home module — one home per symbol.
5
+ """
6
+
7
+ from osrforge.assemble import assemble
8
+ from osrforge.check import check
9
+ from osrforge.convert import convert
10
+ from osrforge.estimate import estimate
11
+ from osrforge.settings import ConversionSettings
12
+
13
+ __all__ = ["ConversionSettings", "assemble", "check", "convert", "estimate"]