agent-tool-parser 0.1.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.
- agent_tool_parser-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
- agent_tool_parser-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
- agent_tool_parser-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- agent_tool_parser-0.1.0/.github/workflows/ci.yml +77 -0
- agent_tool_parser-0.1.0/.github/workflows/pages.yml +41 -0
- agent_tool_parser-0.1.0/.github/workflows/release.yml +177 -0
- agent_tool_parser-0.1.0/.gitignore +25 -0
- agent_tool_parser-0.1.0/CHANGELOG.md +41 -0
- agent_tool_parser-0.1.0/CODE_OF_CONDUCT.md +66 -0
- agent_tool_parser-0.1.0/CONTRIBUTING.md +183 -0
- agent_tool_parser-0.1.0/Cargo.lock +447 -0
- agent_tool_parser-0.1.0/Cargo.toml +23 -0
- agent_tool_parser-0.1.0/DCO.md +32 -0
- agent_tool_parser-0.1.0/DISCLAIMER.md +37 -0
- agent_tool_parser-0.1.0/LICENSE +21 -0
- agent_tool_parser-0.1.0/PKG-INFO +432 -0
- agent_tool_parser-0.1.0/README.md +392 -0
- agent_tool_parser-0.1.0/SECURITY.md +59 -0
- agent_tool_parser-0.1.0/bindings/go/agenttoolparser/go.mod +3 -0
- agent_tool_parser-0.1.0/bindings/go/agenttoolparser/parser.go +101 -0
- agent_tool_parser-0.1.0/bindings/go/agenttoolparser/parser_test.go +42 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-c/Cargo.toml +15 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-c/include/agent_tool_parser.h +62 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-c/src/lib.rs +194 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-core/Cargo.toml +18 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-core/src/cleaners.rs +317 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-core/src/lib.rs +117 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-core/src/models.rs +130 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-core/src/parser.rs +1334 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-core/tests/benchmark_tests.rs +282 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-core/tests/degenerate_tests.rs +326 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-py/Cargo.toml +18 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-py/src/lib.rs +251 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-wasm/Cargo.toml +17 -0
- agent_tool_parser-0.1.0/crates/agent-tool-parser-wasm/src/lib.rs +57 -0
- agent_tool_parser-0.1.0/docs/index.html +922 -0
- agent_tool_parser-0.1.0/examples/go/go.mod +7 -0
- agent_tool_parser-0.1.0/examples/go/main.go +21 -0
- agent_tool_parser-0.1.0/go.work +3 -0
- agent_tool_parser-0.1.0/pyproject.toml +113 -0
- agent_tool_parser-0.1.0/src/agent_tool_parser/__init__.py +70 -0
- agent_tool_parser-0.1.0/src/agent_tool_parser/cleaners.py +283 -0
- agent_tool_parser-0.1.0/src/agent_tool_parser/models.py +36 -0
- agent_tool_parser-0.1.0/src/agent_tool_parser/parser.py +1219 -0
- agent_tool_parser-0.1.0/src/agent_tool_parser/py.typed +1 -0
- agent_tool_parser-0.1.0/tests/test_benchmark_formats.py +289 -0
- agent_tool_parser-0.1.0/tests/test_degenerate_inputs.py +306 -0
- agent_tool_parser-0.1.0/tests/test_parity.py +334 -0
- agent_tool_parser-0.1.0/tests/test_parser.py +549 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Create a report to help us improve agent-tool-parser
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### Describe the Bug
|
|
10
|
+
A clear and concise description of what the bug is.
|
|
11
|
+
|
|
12
|
+
### Engine Mode
|
|
13
|
+
- [ ] Pure Python (`AGENT_TOOL_PARSER_NO_EXT=1`)
|
|
14
|
+
- [ ] Accelerated PyO3 (`_accelerated`)
|
|
15
|
+
- [ ] Rust Core (`agent-tool-parser-core`)
|
|
16
|
+
- [ ] Go bindings / C-ABI / WASM
|
|
17
|
+
|
|
18
|
+
### Minimal Reproducible Example
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from agent_tool_parser import parse_tool_calls
|
|
22
|
+
|
|
23
|
+
raw_model_output = """
|
|
24
|
+
<paste sample model completion here>
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
calls = parse_tool_calls(raw_model_output)
|
|
28
|
+
print(calls)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Expected Behavior
|
|
32
|
+
A clear description of what tool calls, names, or arguments you expected to be parsed.
|
|
33
|
+
|
|
34
|
+
### Actual Output or Error
|
|
35
|
+
Include tracebacks or unexpected parsed outputs here.
|
|
36
|
+
|
|
37
|
+
### Environment
|
|
38
|
+
- OS: [e.g., Linux Ubuntu 24.04, macOS Sonoma, Windows 11]
|
|
39
|
+
- Python version: [e.g., 3.11.8]
|
|
40
|
+
- Rust version (if building from source): [e.g., 1.80.0]
|
|
41
|
+
- Library version: [e.g., 0.1.0]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request / Format Extension
|
|
3
|
+
about: Suggest an idea or new LLM tool call format for agent-tool-parser
|
|
4
|
+
title: "[FEAT] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### Problem Description
|
|
10
|
+
Is your feature request related to a specific model provider, format, or edge case? Please describe the problem.
|
|
11
|
+
|
|
12
|
+
### Proposed Format Specification
|
|
13
|
+
Provide sample outputs produced by the target model:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
<paste representative model output here>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Desired ToolCall Extraction
|
|
20
|
+
How should the sample above be normalized into a `ToolCall`?
|
|
21
|
+
- **Name**: `...`
|
|
22
|
+
- **Args**: `{...}`
|
|
23
|
+
|
|
24
|
+
### Additional Context
|
|
25
|
+
Link to official model documentation, technical report, or Hugging Face tokenizer configs if available.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## Summary of Changes
|
|
2
|
+
Provide a brief explanation of what this pull request does and why it is needed.
|
|
3
|
+
|
|
4
|
+
## Dual-Engine Parity Verification
|
|
5
|
+
`agent-tool-parser` enforces strict Dual-Engine Parity between the pure-Python reference engine and the compiled Rust core.
|
|
6
|
+
|
|
7
|
+
- [ ] I have implemented all parsing/cleaning changes in both `src/agent_tool_parser/` and `crates/agent-tool-parser-core/`.
|
|
8
|
+
- [ ] *OR* If parity is not technically possible, I have included the mandatory **Dual-Engine Parity Analysis** section below.
|
|
9
|
+
|
|
10
|
+
### Dual-Engine Parity Analysis (only required if engines diverge)
|
|
11
|
+
*Root Cause, Impact Assessment, and Mitigation Strategy.*
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Contributor Legal & DCO Checklist
|
|
16
|
+
- [ ] All commits in this pull request are signed off (`git commit -s`) per the [Developer Certificate of Origin (DCO 1.1)](DCO.md).
|
|
17
|
+
- [ ] I confirm that this submission contains no proprietary, leaked, or license-incompatible code.
|
|
18
|
+
- [ ] I have read and agree to the [Contributing Guide](CONTRIBUTING.md) and Contributor Indemnification terms (Section 3.2.3).
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Test & Verification Checklist
|
|
23
|
+
- [ ] Unit tests added to both `tests/test_parser.py` (Python) and `crates/agent-tool-parser-core/` (Rust).
|
|
24
|
+
- [ ] `cargo test --all-targets` passes with zero errors.
|
|
25
|
+
- [ ] Pure-Python test suite passes: `AGENT_TOOL_PARSER_NO_EXT=1 python -m unittest discover -s tests`
|
|
26
|
+
- [ ] Accelerated PyO3 test suite passes: `python -m unittest discover -s tests`
|
|
27
|
+
- [ ] Rust formatting & linting: `cargo fmt --all -- --check` and `cargo clippy --all-targets -- -D warnings`
|
|
28
|
+
- [ ] Python formatting & linting: `ruff check .` and `ruff format --check .` and `mypy src`
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
pip install ruff mypy pytest
|
|
26
|
+
pip install -e .
|
|
27
|
+
|
|
28
|
+
- name: Run Ruff Linter & Format Check
|
|
29
|
+
run: |
|
|
30
|
+
ruff check src tests
|
|
31
|
+
ruff format --check src tests
|
|
32
|
+
|
|
33
|
+
- name: Run Mypy Type Checker
|
|
34
|
+
run: |
|
|
35
|
+
mypy src
|
|
36
|
+
|
|
37
|
+
- name: Run Unit Tests (Accelerated / Native if built)
|
|
38
|
+
run: |
|
|
39
|
+
python -m unittest discover -s tests
|
|
40
|
+
|
|
41
|
+
- name: Run Unit Tests (Pure-Python Universal Fallback)
|
|
42
|
+
run: |
|
|
43
|
+
AGENT_TOOL_PARSER_NO_EXT=1 python -m unittest discover -s tests
|
|
44
|
+
|
|
45
|
+
rust-test:
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
50
|
+
with:
|
|
51
|
+
components: clippy, rustfmt
|
|
52
|
+
targets: wasm32-unknown-unknown
|
|
53
|
+
- name: Set up Go
|
|
54
|
+
uses: actions/setup-go@v5
|
|
55
|
+
with:
|
|
56
|
+
go-version: "1.22"
|
|
57
|
+
- name: Run Rustfmt Check
|
|
58
|
+
run: cargo fmt --all -- --check
|
|
59
|
+
- name: Run Clippy
|
|
60
|
+
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
61
|
+
- name: Run Cargo Tests
|
|
62
|
+
run: cargo test --all-targets
|
|
63
|
+
- name: Build C Library
|
|
64
|
+
run: cargo build --release -p agent-tool-parser-c
|
|
65
|
+
- name: Run Go Binding Tests
|
|
66
|
+
run: LD_LIBRARY_PATH="$(pwd)/target/release:$LD_LIBRARY_PATH" go test -v ./bindings/go/agenttoolparser/...
|
|
67
|
+
- name: Build WebAssembly Target
|
|
68
|
+
run: cargo build --target wasm32-unknown-unknown --release -p agent-tool-parser-wasm
|
|
69
|
+
- name: Set up Python for PyO3 Parity Verification
|
|
70
|
+
uses: actions/setup-python@v5
|
|
71
|
+
with:
|
|
72
|
+
python-version: "3.11"
|
|
73
|
+
- name: Build PyO3 Native Extension & Run Dual-Engine Parity Tests
|
|
74
|
+
run: |
|
|
75
|
+
cargo build --release -p agent-tool-parser-py
|
|
76
|
+
cp target/release/lib_accelerated.so src/agent_tool_parser/_accelerated.so
|
|
77
|
+
PYTHONPATH=src python -m unittest discover -s tests -v
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Deploy Documentation to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- '.github/workflows/pages.yml'
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: "pages"
|
|
19
|
+
cancel-in-progress: false
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
deploy:
|
|
23
|
+
environment:
|
|
24
|
+
name: github-pages
|
|
25
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: Setup Pages
|
|
32
|
+
uses: actions/configure-pages@v4
|
|
33
|
+
|
|
34
|
+
- name: Upload artifact
|
|
35
|
+
uses: actions/upload-pages-artifact@v3
|
|
36
|
+
with:
|
|
37
|
+
path: './docs'
|
|
38
|
+
|
|
39
|
+
- name: Deploy to GitHub Pages
|
|
40
|
+
id: deployment
|
|
41
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
tag_name:
|
|
10
|
+
description: "Release tag (e.g. v0.1.0)"
|
|
11
|
+
required: false
|
|
12
|
+
default: ""
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build-python:
|
|
20
|
+
name: Build Python Package
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.11"
|
|
30
|
+
|
|
31
|
+
- name: Install build dependencies
|
|
32
|
+
run: |
|
|
33
|
+
python -m pip install --upgrade pip
|
|
34
|
+
pip install build
|
|
35
|
+
|
|
36
|
+
- name: Build sdist and wheel
|
|
37
|
+
run: python -m build
|
|
38
|
+
|
|
39
|
+
- name: Upload Python distribution artifacts
|
|
40
|
+
uses: actions/upload-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: python-dist
|
|
43
|
+
path: dist/*
|
|
44
|
+
if-no-files-found: error
|
|
45
|
+
retention-days: 1
|
|
46
|
+
|
|
47
|
+
build-c-binaries:
|
|
48
|
+
name: Build C Libraries (${{ matrix.target_name }})
|
|
49
|
+
runs-on: ${{ matrix.os }}
|
|
50
|
+
strategy:
|
|
51
|
+
fail-fast: false
|
|
52
|
+
matrix:
|
|
53
|
+
include:
|
|
54
|
+
- os: ubuntu-latest
|
|
55
|
+
target_name: linux-x86_64
|
|
56
|
+
lib_file: libagent_tool_parser_c.so
|
|
57
|
+
is_windows: false
|
|
58
|
+
- os: macos-latest
|
|
59
|
+
target_name: macos-universal
|
|
60
|
+
lib_file: libagent_tool_parser_c.dylib
|
|
61
|
+
is_windows: false
|
|
62
|
+
- os: windows-latest
|
|
63
|
+
target_name: windows-x86_64
|
|
64
|
+
lib_file: agent_tool_parser_c.dll
|
|
65
|
+
is_windows: true
|
|
66
|
+
|
|
67
|
+
steps:
|
|
68
|
+
- name: Checkout repository
|
|
69
|
+
uses: actions/checkout@v4
|
|
70
|
+
|
|
71
|
+
- name: Install Rust toolchain
|
|
72
|
+
uses: dtolnay/rust-toolchain@stable
|
|
73
|
+
|
|
74
|
+
- name: Build C shared library
|
|
75
|
+
run: cargo build --release -p agent-tool-parser-c
|
|
76
|
+
|
|
77
|
+
- name: Package C distribution (Unix)
|
|
78
|
+
if: ${{ !matrix.is_windows }}
|
|
79
|
+
run: |
|
|
80
|
+
mkdir -p c-dist/include c-dist/lib
|
|
81
|
+
cp crates/agent-tool-parser-c/include/agent_tool_parser.h c-dist/include/
|
|
82
|
+
cp target/release/${{ matrix.lib_file }} c-dist/lib/
|
|
83
|
+
cp LICENSE README.md c-dist/
|
|
84
|
+
tar -czvf agent-tool-parser-c-${{ matrix.target_name }}.tar.gz -C c-dist .
|
|
85
|
+
|
|
86
|
+
- name: Package C distribution (Windows)
|
|
87
|
+
if: ${{ matrix.is_windows }}
|
|
88
|
+
shell: pwsh
|
|
89
|
+
run: |
|
|
90
|
+
New-Item -ItemType Directory -Path c-dist/include, c-dist/lib -Force
|
|
91
|
+
Copy-Item crates/agent-tool-parser-c/include/agent_tool_parser.h c-dist/include/
|
|
92
|
+
Copy-Item target/release/${{ matrix.lib_file }} c-dist/lib/
|
|
93
|
+
Copy-Item LICENSE, README.md c-dist/
|
|
94
|
+
Compress-Archive -Path c-dist/* -DestinationPath agent-tool-parser-c-${{ matrix.target_name }}.zip
|
|
95
|
+
|
|
96
|
+
- name: Upload C binary artifacts (Unix)
|
|
97
|
+
if: ${{ !matrix.is_windows }}
|
|
98
|
+
uses: actions/upload-artifact@v4
|
|
99
|
+
with:
|
|
100
|
+
name: c-binaries-${{ matrix.target_name }}
|
|
101
|
+
path: agent-tool-parser-c-${{ matrix.target_name }}.tar.gz
|
|
102
|
+
retention-days: 1
|
|
103
|
+
|
|
104
|
+
- name: Upload C binary artifacts (Windows)
|
|
105
|
+
if: ${{ matrix.is_windows }}
|
|
106
|
+
uses: actions/upload-artifact@v4
|
|
107
|
+
with:
|
|
108
|
+
name: c-binaries-${{ matrix.target_name }}
|
|
109
|
+
path: agent-tool-parser-c-${{ matrix.target_name }}.zip
|
|
110
|
+
retention-days: 1
|
|
111
|
+
|
|
112
|
+
github-release:
|
|
113
|
+
name: Create GitHub Release
|
|
114
|
+
needs: [build-python, build-c-binaries]
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
steps:
|
|
117
|
+
- name: Checkout repository
|
|
118
|
+
uses: actions/checkout@v4
|
|
119
|
+
|
|
120
|
+
- name: Create release assets directory
|
|
121
|
+
run: mkdir -p release-assets
|
|
122
|
+
|
|
123
|
+
- name: Download all build artifacts
|
|
124
|
+
uses: actions/download-artifact@v4
|
|
125
|
+
with:
|
|
126
|
+
path: downloaded-artifacts
|
|
127
|
+
|
|
128
|
+
- name: Gather release assets
|
|
129
|
+
run: |
|
|
130
|
+
find downloaded-artifacts -type f -exec cp {} release-assets/ \;
|
|
131
|
+
cd release-assets
|
|
132
|
+
sha256sum * > SHA256SUMS.txt
|
|
133
|
+
cat SHA256SUMS.txt
|
|
134
|
+
|
|
135
|
+
- name: Publish GitHub Release
|
|
136
|
+
uses: softprops/action-gh-release@v2
|
|
137
|
+
with:
|
|
138
|
+
files: release-assets/*
|
|
139
|
+
generate_release_notes: true
|
|
140
|
+
draft: false
|
|
141
|
+
prerelease: false
|
|
142
|
+
|
|
143
|
+
publish-pypi:
|
|
144
|
+
name: Publish to PyPI
|
|
145
|
+
needs: [build-python, github-release]
|
|
146
|
+
runs-on: ubuntu-latest
|
|
147
|
+
steps:
|
|
148
|
+
- name: Download Python distribution
|
|
149
|
+
uses: actions/download-artifact@v4
|
|
150
|
+
with:
|
|
151
|
+
name: python-dist
|
|
152
|
+
path: dist
|
|
153
|
+
|
|
154
|
+
- name: Publish package to PyPI
|
|
155
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
156
|
+
with:
|
|
157
|
+
packages-dir: dist/
|
|
158
|
+
skip-existing: true
|
|
159
|
+
continue-on-error: true
|
|
160
|
+
|
|
161
|
+
publish-crates:
|
|
162
|
+
name: Publish Rust Core Crate
|
|
163
|
+
needs: [github-release]
|
|
164
|
+
runs-on: ubuntu-latest
|
|
165
|
+
env:
|
|
166
|
+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
167
|
+
steps:
|
|
168
|
+
- name: Checkout repository
|
|
169
|
+
uses: actions/checkout@v4
|
|
170
|
+
|
|
171
|
+
- name: Install Rust toolchain
|
|
172
|
+
uses: dtolnay/rust-toolchain@stable
|
|
173
|
+
|
|
174
|
+
- name: Publish to crates.io
|
|
175
|
+
if: env.CARGO_REGISTRY_TOKEN != ''
|
|
176
|
+
run: cargo publish -p agent-tool-parser-core
|
|
177
|
+
continue-on-error: true
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg-info/
|
|
9
|
+
.eggs/
|
|
10
|
+
venv/
|
|
11
|
+
.env
|
|
12
|
+
|
|
13
|
+
# Rust build artifacts
|
|
14
|
+
target/
|
|
15
|
+
|
|
16
|
+
# Local editor & agent artifacts
|
|
17
|
+
.antigravity/
|
|
18
|
+
.agents/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
.DS_Store
|
|
22
|
+
|
|
23
|
+
# Release and distribution packaging
|
|
24
|
+
c-dist/
|
|
25
|
+
release-assets/
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-09-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Dual-Engine Architecture**:
|
|
12
|
+
- Pure-Python zero-dependency fallback engine with transparent native acceleration detection.
|
|
13
|
+
- High-throughput Rust core engine (`agent-tool-parser-core`) with sub-millisecond execution.
|
|
14
|
+
- PyO3 native module (`_accelerated`) with zero-copy Python deserialization.
|
|
15
|
+
- C-ABI dynamic library (`agent-tool-parser-c`) and standard C header (`agent_tool_parser.h`).
|
|
16
|
+
- WebAssembly bindings (`agent-tool-parser-wasm`) for browser and Node.js runtimes.
|
|
17
|
+
- Native Go binding module (`bindings/go/agenttoolparser`) using C-ABI via cgo.
|
|
18
|
+
- **Heterogeneous Format Support**:
|
|
19
|
+
- OpenAI function call objects and `tool_calls` arrays (including multi-call batches).
|
|
20
|
+
- Anthropic Claude XML tags (`<tool_use>`, `<invoke>`, `<ant_tool_use>`) and parameter markup.
|
|
21
|
+
- DeepSeek DSML tags (`<|DSML|invoke>`) with unquoted and quoted attribute syntax.
|
|
22
|
+
- DeepSeek native streaming delimiter tokens (`<|tool call begin|>`).
|
|
23
|
+
- Qwen-Agent tokens (`<|action_start|>`, `<|action_name|>`, `<|action_args|>`).
|
|
24
|
+
- ChatGLM function call formats (`✿FUNCTION✿`).
|
|
25
|
+
- Llama 3.x Python AST expressions (`call:tool(arg=val)` and positional argument mappings).
|
|
26
|
+
- ReAct agent text patterns (`Action: ... Action Input: ...`).
|
|
27
|
+
- **Resilient Cleaners & Heuristic Repairs**:
|
|
28
|
+
- Bracket-stack depth tracking for truncated JSON payloads, automatically balancing unclosed nested objects `{` and arrays `[` at stream EOF.
|
|
29
|
+
- Single-quoted JSON repair preserving inner double quotes.
|
|
30
|
+
- Two-step reasoning/thinking block extraction (`<think>...</think>`, `<thought>`, `<reasoning>`), safely stripping internal reasoning and preventing premature tool execution.
|
|
31
|
+
- CDATA unwrapping (`<![CDATA[...]]>`) preserving whitespace, indentation, and unified diffs.
|
|
32
|
+
- HTML entity unescaping (`<`, `>`, `&`, `"`, `'`).
|
|
33
|
+
- **Verification & Parity**:
|
|
34
|
+
- 98 Python unit tests passing on both pure-Python and accelerated engines.
|
|
35
|
+
- 56 Rust core integration tests passing with 100% format parity.
|
|
36
|
+
- 25 dedicated pathological, degenerate, and adversarial input tests.
|
|
37
|
+
- Complete ReDoS resilience test with 50,000 repeating characters executed in <10ms.
|
|
38
|
+
- **Project Infrastructure**:
|
|
39
|
+
- Developer Certificate of Origin (DCO 1.1) enforcement policy and contributor indemnification.
|
|
40
|
+
- PEP 561 typing compliance (`py.typed`).
|
|
41
|
+
- GitHub Actions CI/CD workflows for automated multi-runtime testing and multi-platform binary releases.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
* Public or private harassment
|
|
24
|
+
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **boostcode.sg@gmail.com**. All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
+
|
|
43
|
+
## Enforcement Guidelines
|
|
44
|
+
|
|
45
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
+
|
|
47
|
+
### 1. Correction
|
|
48
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
49
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
50
|
+
|
|
51
|
+
### 2. Warning
|
|
52
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
53
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
54
|
+
|
|
55
|
+
### 3. Temporary Ban
|
|
56
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
57
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
58
|
+
|
|
59
|
+
### 4. Permanent Ban
|
|
60
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
61
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
62
|
+
|
|
63
|
+
## Attribution
|
|
64
|
+
|
|
65
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1,
|
|
66
|
+
available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|