maf-sandbox-document 0.2.0__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.
- maf_sandbox_document-0.2.0/LICENSE +21 -0
- maf_sandbox_document-0.2.0/PKG-INFO +91 -0
- maf_sandbox_document-0.2.0/README.md +66 -0
- maf_sandbox_document-0.2.0/pyproject.toml +85 -0
- maf_sandbox_document-0.2.0/pyproject.toml.orig +57 -0
- maf_sandbox_document-0.2.0/src/maf_sandbox_document/__init__.py +33 -0
- maf_sandbox_document-0.2.0/src/maf_sandbox_document/_guest.py +393 -0
- maf_sandbox_document-0.2.0/src/maf_sandbox_document/_pdf_guard.py +362 -0
- maf_sandbox_document-0.2.0/src/maf_sandbox_document/_tool.py +344 -0
- maf_sandbox_document-0.2.0/src/maf_sandbox_document/py.typed +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SOKOLAI BV
|
|
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.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maf-sandbox-document
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Guarded PDF, DOCX, PPTX and RTF extraction in disposable sandboxes.
|
|
5
|
+
Keywords: document,pdf,sandbox,agent-framework
|
|
6
|
+
Author: SOKOLAI BV
|
|
7
|
+
Author-email: SOKOLAI BV <info@sokolai.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Requires-Dist: maf-sandbox>=0.52.0,<0.53
|
|
19
|
+
Requires-Dist: agent-framework-core>=1.23.0,<1.24
|
|
20
|
+
Requires-Python: >=3.12, <3.15
|
|
21
|
+
Project-URL: Homepage, https://www.sokol.ai
|
|
22
|
+
Project-URL: Source, https://github.com/sokolaidev/maf-extensions
|
|
23
|
+
Project-URL: Issues, https://github.com/sokolaidev/maf-extensions/issues
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# maf-sandbox-document
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/maf-sandbox-document/) [](https://pypi.org/project/maf-sandbox-document/) [](https://github.com/sokolaidev/maf-extensions/blob/main/packages/maf-sandbox-document/LICENSE)
|
|
29
|
+
|
|
30
|
+
> **Experimental.** Releases before 1.0 may change or remove APIs. Importing this package emits `MafSandboxDocumentExperimentalWarning`.
|
|
31
|
+
|
|
32
|
+
Read PDF, DOCX, PPTX and RTF files through a fixed converter in a disposable sandbox. The model chooses a listed file, output format and optional page range; it supplies no converter code. Parsers and archive/XML guards run in the guest.
|
|
33
|
+
|
|
34
|
+
This package is experimental and not yet published. Its first release requires the core release containing binary file-store reads; release core before this package. The image must also have a completed, currently eligible `document` release before the kind publishes.
|
|
35
|
+
|
|
36
|
+
## Attach the tool
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from maf_sandbox_document import make_document_tools
|
|
40
|
+
|
|
41
|
+
[document_read] = make_document_tools(
|
|
42
|
+
router,
|
|
43
|
+
file_store,
|
|
44
|
+
"document-reader",
|
|
45
|
+
context,
|
|
46
|
+
sink,
|
|
47
|
+
image=verified_document_image,
|
|
48
|
+
formats=("text", "markdown"), # Enable images only for a host that can consume them.
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The host supplies a store with `async read(name) -> bytes | None`, and `context.list_files(store)` returns authorized `ListedFile` entries. Text-only AgentFileStore implementations need a binary adapter. Names are matched exactly, never interpreted as host paths, guest paths or URLs. The host must bound ingress bytes before the store returns them; the kind independently checks its 16 MiB input limit.
|
|
53
|
+
|
|
54
|
+
Use `file_store_provenance` for stores that may change during a call and `requires_file_integrity` when admission requires an established source label. Completion and the `extracted`/`refused` verdict are trusted. Document text, metadata, images, delivery references and converter diagnostics are guest-derived output. Core derives their effective label from the file read, model arguments and conversation.
|
|
55
|
+
|
|
56
|
+
The router must allow at least container isolation and supply POSIX `EXEC`, `FILES_IN` and `FILES_OUT` with closed egress. Every call requires its own sandbox and disposal, including refusal, failure and cancellation.
|
|
57
|
+
|
|
58
|
+
## Tool contract
|
|
59
|
+
|
|
60
|
+
`document_read(file, format="text", pages=None)` accepts `text`, `markdown` or `images`. `pages` is a positive, 1-based inclusive range such as `"2-5"` or `"3"`. PDF ranges select pages; PPTX ranges select slides. Both endpoints clamp to the available last page. DOCX has no reliable pagination without a layout engine, so an explicit range is refused. RTF ignores ranges.
|
|
61
|
+
|
|
62
|
+
| Input | Text / Markdown | Images | Limits |
|
|
63
|
+
|---|---|---|---|
|
|
64
|
+
| PDF | PDFium text in reading order; Markdown retains that text | PNG pages at the host's fixed DPI | Supported PDF subset below; no OCR |
|
|
65
|
+
| DOCX | Mammoth text or Markdown conversion | Refused | No pagination or faithful layout |
|
|
66
|
+
| PPTX | Slide text, table cells and notes; Markdown slide headings | Refused | No office renderer |
|
|
67
|
+
| RTF (`application/rtf`, `text/rtf`) | striprtf text, also usable as plain Markdown | Refused | Page range ignored |
|
|
68
|
+
|
|
69
|
+
Outputs are `document.txt` (`text/plain`), `document.md` (`text/markdown`) or `page-N.png` (`image/png`), plus `document.json` (`application/json`). Image names preserve original page numbers. An extracted verdict requires delivery of every requested output. Guard refusals deliver only the metadata and diagnostic. Invalid arguments, missing files, acquisition failures, timeouts, operational exits and incomplete delivery return `completed=False` with no verdict.
|
|
70
|
+
|
|
71
|
+
Metadata schema version 1 contains `media_type`, `format`, `supported_formats`, `pages` (a page/slide count, or null), `selected_pages`, `characters`, `truncated` (always false), `range_clamped`, `verdict`, `reason` and `files`. A refusal never represents capped content as a successful extraction.
|
|
72
|
+
|
|
73
|
+
## Host options and guards
|
|
74
|
+
|
|
75
|
+
| Option | Default | Allowed |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `exec_timeout_seconds` | 60 | Finite number greater than 0, at most 300 |
|
|
78
|
+
| `max_pages` | 200 | 1–10,000 |
|
|
79
|
+
| `max_chars` | 1,000,000 | 1–8,000,000 |
|
|
80
|
+
| `image_dpi` | 96 | 1–600 |
|
|
81
|
+
| `max_image_pixels` | 16,000,000 | 1–32,000,000 per page |
|
|
82
|
+
| `max_image_pages` | 20 | 1–100 per call |
|
|
83
|
+
| `formats` | text, markdown, images | Nonempty tuple of distinct enabled formats |
|
|
84
|
+
|
|
85
|
+
OOXML is checked before Mammoth or python-pptx opens it: at most 2,048 ZIP entries, 16 MiB per expanded member, 64 MiB total, and a declared expansion ratio at most 200. Absolute/traversing/duplicate names, symlinks, encryption, unsupported compression and nested archives are refused. Bounded decompression verifies stream completion, actual lengths and CRCs independently of declared member sizes; converters receive a rebuilt, stored-only ZIP. XML preflight refuses DTDs and entity declarations, including UTF-16 declarations and XML in nonstandard member names. python-pptx uses a parser with entity resolution, DTD loading and network access disabled. Mammoth's pinned minidom path receives only the preflighted XML; external file access and embedded style maps are disabled.
|
|
86
|
+
|
|
87
|
+
PDF preflight admits a single classic cross-reference table, bounded objects and streams with no compression, Flate, ASCII85 or ASCIIHex. Each decoded stream is at most 32 MiB, with 64 MiB total. Drawing syntax is checked in page content, forms, annotation appearances, tiling patterns and Type 3 glyph programs, with at most 64 MiB of content including repeated uses; binary image and font bytes are not interpreted as drawing commands. Object/cross-reference streams, incremental or encrypted PDFs, external streams, inline images, other filters (including JPEG/JPEG2000) and decoding parameters are refused. ASCII85 streams containing NUL or form-feed whitespace are also refused because the pinned PDFium decoder stops at those bytes. This deliberately restricts compatibility: PDFium has no public per-stream allocation limit, so unsupported structures are not passed to it. A host can prepare an accepted PDF before ingress; this kind never silently falls back to an unbounded parser. Text is capped at 100,000 characters per PDF page or PPTX slide as well as the configured total.
|
|
88
|
+
|
|
89
|
+
Outputs are capped at 32 MiB per file and 64 MiB total including metadata, independently of backend transfer limits. The execution deadline covers preflight and conversion together. Backend resource limits remain necessary for native parser allocations, CPU and temporary storage; these guards do not establish immunity to parser exploits.
|
|
90
|
+
|
|
91
|
+
See the [document contract](https://github.com/sokolaidev/maf-extensions/blob/main/docs/sandbox/kinds/document.md) and [image guide](https://github.com/sokolaidev/maf-extensions/blob/main/images/document-sandbox/README.md) for verification and release evidence.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# maf-sandbox-document
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/maf-sandbox-document/) [](https://pypi.org/project/maf-sandbox-document/) [](https://github.com/sokolaidev/maf-extensions/blob/main/packages/maf-sandbox-document/LICENSE)
|
|
4
|
+
|
|
5
|
+
> **Experimental.** Releases before 1.0 may change or remove APIs. Importing this package emits `MafSandboxDocumentExperimentalWarning`.
|
|
6
|
+
|
|
7
|
+
Read PDF, DOCX, PPTX and RTF files through a fixed converter in a disposable sandbox. The model chooses a listed file, output format and optional page range; it supplies no converter code. Parsers and archive/XML guards run in the guest.
|
|
8
|
+
|
|
9
|
+
This package is experimental and not yet published. Its first release requires the core release containing binary file-store reads; release core before this package. The image must also have a completed, currently eligible `document` release before the kind publishes.
|
|
10
|
+
|
|
11
|
+
## Attach the tool
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from maf_sandbox_document import make_document_tools
|
|
15
|
+
|
|
16
|
+
[document_read] = make_document_tools(
|
|
17
|
+
router,
|
|
18
|
+
file_store,
|
|
19
|
+
"document-reader",
|
|
20
|
+
context,
|
|
21
|
+
sink,
|
|
22
|
+
image=verified_document_image,
|
|
23
|
+
formats=("text", "markdown"), # Enable images only for a host that can consume them.
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The host supplies a store with `async read(name) -> bytes | None`, and `context.list_files(store)` returns authorized `ListedFile` entries. Text-only AgentFileStore implementations need a binary adapter. Names are matched exactly, never interpreted as host paths, guest paths or URLs. The host must bound ingress bytes before the store returns them; the kind independently checks its 16 MiB input limit.
|
|
28
|
+
|
|
29
|
+
Use `file_store_provenance` for stores that may change during a call and `requires_file_integrity` when admission requires an established source label. Completion and the `extracted`/`refused` verdict are trusted. Document text, metadata, images, delivery references and converter diagnostics are guest-derived output. Core derives their effective label from the file read, model arguments and conversation.
|
|
30
|
+
|
|
31
|
+
The router must allow at least container isolation and supply POSIX `EXEC`, `FILES_IN` and `FILES_OUT` with closed egress. Every call requires its own sandbox and disposal, including refusal, failure and cancellation.
|
|
32
|
+
|
|
33
|
+
## Tool contract
|
|
34
|
+
|
|
35
|
+
`document_read(file, format="text", pages=None)` accepts `text`, `markdown` or `images`. `pages` is a positive, 1-based inclusive range such as `"2-5"` or `"3"`. PDF ranges select pages; PPTX ranges select slides. Both endpoints clamp to the available last page. DOCX has no reliable pagination without a layout engine, so an explicit range is refused. RTF ignores ranges.
|
|
36
|
+
|
|
37
|
+
| Input | Text / Markdown | Images | Limits |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| PDF | PDFium text in reading order; Markdown retains that text | PNG pages at the host's fixed DPI | Supported PDF subset below; no OCR |
|
|
40
|
+
| DOCX | Mammoth text or Markdown conversion | Refused | No pagination or faithful layout |
|
|
41
|
+
| PPTX | Slide text, table cells and notes; Markdown slide headings | Refused | No office renderer |
|
|
42
|
+
| RTF (`application/rtf`, `text/rtf`) | striprtf text, also usable as plain Markdown | Refused | Page range ignored |
|
|
43
|
+
|
|
44
|
+
Outputs are `document.txt` (`text/plain`), `document.md` (`text/markdown`) or `page-N.png` (`image/png`), plus `document.json` (`application/json`). Image names preserve original page numbers. An extracted verdict requires delivery of every requested output. Guard refusals deliver only the metadata and diagnostic. Invalid arguments, missing files, acquisition failures, timeouts, operational exits and incomplete delivery return `completed=False` with no verdict.
|
|
45
|
+
|
|
46
|
+
Metadata schema version 1 contains `media_type`, `format`, `supported_formats`, `pages` (a page/slide count, or null), `selected_pages`, `characters`, `truncated` (always false), `range_clamped`, `verdict`, `reason` and `files`. A refusal never represents capped content as a successful extraction.
|
|
47
|
+
|
|
48
|
+
## Host options and guards
|
|
49
|
+
|
|
50
|
+
| Option | Default | Allowed |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `exec_timeout_seconds` | 60 | Finite number greater than 0, at most 300 |
|
|
53
|
+
| `max_pages` | 200 | 1–10,000 |
|
|
54
|
+
| `max_chars` | 1,000,000 | 1–8,000,000 |
|
|
55
|
+
| `image_dpi` | 96 | 1–600 |
|
|
56
|
+
| `max_image_pixels` | 16,000,000 | 1–32,000,000 per page |
|
|
57
|
+
| `max_image_pages` | 20 | 1–100 per call |
|
|
58
|
+
| `formats` | text, markdown, images | Nonempty tuple of distinct enabled formats |
|
|
59
|
+
|
|
60
|
+
OOXML is checked before Mammoth or python-pptx opens it: at most 2,048 ZIP entries, 16 MiB per expanded member, 64 MiB total, and a declared expansion ratio at most 200. Absolute/traversing/duplicate names, symlinks, encryption, unsupported compression and nested archives are refused. Bounded decompression verifies stream completion, actual lengths and CRCs independently of declared member sizes; converters receive a rebuilt, stored-only ZIP. XML preflight refuses DTDs and entity declarations, including UTF-16 declarations and XML in nonstandard member names. python-pptx uses a parser with entity resolution, DTD loading and network access disabled. Mammoth's pinned minidom path receives only the preflighted XML; external file access and embedded style maps are disabled.
|
|
61
|
+
|
|
62
|
+
PDF preflight admits a single classic cross-reference table, bounded objects and streams with no compression, Flate, ASCII85 or ASCIIHex. Each decoded stream is at most 32 MiB, with 64 MiB total. Drawing syntax is checked in page content, forms, annotation appearances, tiling patterns and Type 3 glyph programs, with at most 64 MiB of content including repeated uses; binary image and font bytes are not interpreted as drawing commands. Object/cross-reference streams, incremental or encrypted PDFs, external streams, inline images, other filters (including JPEG/JPEG2000) and decoding parameters are refused. ASCII85 streams containing NUL or form-feed whitespace are also refused because the pinned PDFium decoder stops at those bytes. This deliberately restricts compatibility: PDFium has no public per-stream allocation limit, so unsupported structures are not passed to it. A host can prepare an accepted PDF before ingress; this kind never silently falls back to an unbounded parser. Text is capped at 100,000 characters per PDF page or PPTX slide as well as the configured total.
|
|
63
|
+
|
|
64
|
+
Outputs are capped at 32 MiB per file and 64 MiB total including metadata, independently of backend transfer limits. The execution deadline covers preflight and conversion together. Backend resource limits remain necessary for native parser allocations, CPU and temporary storage; these guards do not establish immunity to parser exploits.
|
|
65
|
+
|
|
66
|
+
See the [document contract](https://github.com/sokolaidev/maf-extensions/blob/main/docs/sandbox/kinds/document.md) and [image guide](https://github.com/sokolaidev/maf-extensions/blob/main/images/document-sandbox/README.md) for verification and release evidence.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "maf-sandbox-document"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Guarded PDF, DOCX, PPTX and RTF extraction in disposable sandboxes."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12,<3.15"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
keywords = [
|
|
10
|
+
"document",
|
|
11
|
+
"pdf",
|
|
12
|
+
"sandbox",
|
|
13
|
+
"agent-framework",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"maf-sandbox>=0.52.0,<0.53",
|
|
27
|
+
"agent-framework-core>=1.23.0,<1.24",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[[project.authors]]
|
|
31
|
+
name = "SOKOLAI BV"
|
|
32
|
+
email = "info@sokolai.com"
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://www.sokol.ai"
|
|
36
|
+
Source = "https://github.com/sokolaidev/maf-extensions"
|
|
37
|
+
Issues = "https://github.com/sokolaidev/maf-extensions/issues"
|
|
38
|
+
|
|
39
|
+
[tool.uv.sources.maf-sandbox]
|
|
40
|
+
workspace = true
|
|
41
|
+
|
|
42
|
+
[tool.uv.build-backend]
|
|
43
|
+
module-name = "maf_sandbox_document"
|
|
44
|
+
module-root = "src"
|
|
45
|
+
|
|
46
|
+
[tool.ruff]
|
|
47
|
+
line-length = 100
|
|
48
|
+
target-version = "py312"
|
|
49
|
+
|
|
50
|
+
[tool.ruff.lint]
|
|
51
|
+
extend-select = [
|
|
52
|
+
"I",
|
|
53
|
+
"UP",
|
|
54
|
+
"D100",
|
|
55
|
+
"D101",
|
|
56
|
+
"D103",
|
|
57
|
+
"D104",
|
|
58
|
+
"E501",
|
|
59
|
+
"W505",
|
|
60
|
+
"TD",
|
|
61
|
+
"FIX",
|
|
62
|
+
"ERA001",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint.per-file-ignores]
|
|
66
|
+
"tests/**" = [
|
|
67
|
+
"D101",
|
|
68
|
+
"D103",
|
|
69
|
+
"E501",
|
|
70
|
+
"W505",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[tool.ruff.lint.pycodestyle]
|
|
74
|
+
max-doc-length = 100
|
|
75
|
+
|
|
76
|
+
[tool.pyright]
|
|
77
|
+
include = ["src"]
|
|
78
|
+
typeCheckingMode = "strict"
|
|
79
|
+
|
|
80
|
+
[tool.pytest.ini_options]
|
|
81
|
+
testpaths = ["tests"]
|
|
82
|
+
|
|
83
|
+
[build-system]
|
|
84
|
+
requires = ["uv_build>=0.11.24,<0.12.0"]
|
|
85
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "maf-sandbox-document"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Guarded PDF, DOCX, PPTX and RTF extraction in disposable sandboxes."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12,<3.15"
|
|
7
|
+
authors = [{ name = "SOKOLAI BV", email = "info@sokolai.com" }]
|
|
8
|
+
license = "MIT"
|
|
9
|
+
license-files = ["LICENSE"]
|
|
10
|
+
keywords = ["document", "pdf", "sandbox", "agent-framework"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Typing :: Typed",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
]
|
|
21
|
+
dependencies = ["maf-sandbox>=0.52.0,<0.53", "agent-framework-core>=1.23.0,<1.24"]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://www.sokol.ai"
|
|
25
|
+
Source = "https://github.com/sokolaidev/maf-extensions"
|
|
26
|
+
Issues = "https://github.com/sokolaidev/maf-extensions/issues"
|
|
27
|
+
|
|
28
|
+
[tool.uv.sources]
|
|
29
|
+
maf-sandbox = { workspace = true }
|
|
30
|
+
|
|
31
|
+
[tool.uv.build-backend]
|
|
32
|
+
module-name = "maf_sandbox_document"
|
|
33
|
+
module-root = "src"
|
|
34
|
+
|
|
35
|
+
[tool.ruff]
|
|
36
|
+
line-length = 100
|
|
37
|
+
target-version = "py312"
|
|
38
|
+
|
|
39
|
+
[tool.ruff.lint]
|
|
40
|
+
extend-select = ["I", "UP", "D100", "D101", "D103", "D104", "E501", "W505", "TD", "FIX", "ERA001"]
|
|
41
|
+
|
|
42
|
+
[tool.ruff.lint.per-file-ignores]
|
|
43
|
+
"tests/**" = ["D101", "D103", "E501", "W505"]
|
|
44
|
+
|
|
45
|
+
[tool.ruff.lint.pycodestyle]
|
|
46
|
+
max-doc-length = 100
|
|
47
|
+
|
|
48
|
+
[tool.pyright]
|
|
49
|
+
include = ["src"]
|
|
50
|
+
typeCheckingMode = "strict"
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests"]
|
|
54
|
+
|
|
55
|
+
[build-system]
|
|
56
|
+
requires = ["uv_build>=0.11.24,<0.12.0"]
|
|
57
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Guarded document extraction in disposable sandboxes."""
|
|
2
|
+
|
|
3
|
+
import warnings as _warnings
|
|
4
|
+
|
|
5
|
+
from ._tool import (
|
|
6
|
+
DOCUMENT_KIND,
|
|
7
|
+
DOCUMENT_READ_TOOL_NAME,
|
|
8
|
+
document_sandbox_spec,
|
|
9
|
+
make_document_tools,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"DOCUMENT_KIND",
|
|
14
|
+
"DOCUMENT_READ_TOOL_NAME",
|
|
15
|
+
"MafSandboxDocumentExperimentalWarning",
|
|
16
|
+
"document_sandbox_spec",
|
|
17
|
+
"make_document_tools",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class MafSandboxDocumentExperimentalWarning(UserWarning):
|
|
22
|
+
"""Warning category for the experimental document kind."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
try:
|
|
26
|
+
_warnings.warn(
|
|
27
|
+
"maf_sandbox_document is experimental and may change or be removed without notice.",
|
|
28
|
+
category=MafSandboxDocumentExperimentalWarning,
|
|
29
|
+
stacklevel=2,
|
|
30
|
+
)
|
|
31
|
+
except MafSandboxDocumentExperimentalWarning:
|
|
32
|
+
# The pre-1.0 notice must not prevent imports under -W error.
|
|
33
|
+
pass
|