longguard 0.1.4__tar.gz → 0.2.1.dev0__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.
- longguard-0.2.1.dev0/.github/ISSUE_TEMPLATE/bug_report.yml +64 -0
- longguard-0.2.1.dev0/.github/ISSUE_TEMPLATE/config.yml +12 -0
- longguard-0.2.1.dev0/.github/ISSUE_TEMPLATE/feature_request.yml +44 -0
- longguard-0.2.1.dev0/.github/PR_v0.2.0_DRAFT.md +31 -0
- longguard-0.2.1.dev0/.github/PULL_REQUEST_TEMPLATE.md +24 -0
- longguard-0.2.1.dev0/.github/dependabot.yml +20 -0
- longguard-0.2.1.dev0/.github/workflows/ci.yml +83 -0
- longguard-0.2.1.dev0/.github/workflows/release-on-merge.yml +102 -0
- longguard-0.2.1.dev0/.github/workflows/release.yml +75 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/.gitignore +6 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/CHANGELOG.md +58 -1
- longguard-0.2.1.dev0/CODE_OF_CONDUCT.md +120 -0
- longguard-0.2.1.dev0/CONTRIBUTING.md +96 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/PKG-INFO +48 -48
- {longguard-0.1.4 → longguard-0.2.1.dev0}/README.md +41 -42
- {longguard-0.1.4 → longguard-0.2.1.dev0}/SECURITY.md +1 -0
- longguard-0.2.1.dev0/SUPPORT.md +49 -0
- longguard-0.2.1.dev0/assets/LongGuard-Logo.png +0 -0
- longguard-0.2.1.dev0/docs/assets/LongGuard-Logo.png +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/concepts/how-it-works.md +1 -1
- longguard-0.2.1.dev0/docs/guides/benchmarks.md +82 -0
- longguard-0.2.1.dev0/docs/guides/compatibility.md +59 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/guides/configuration.md +1 -1
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/guides/decorator.md +5 -0
- longguard-0.2.1.dev0/docs/guides/development-evidence.md +186 -0
- longguard-0.2.1.dev0/docs/guides/model-pricing-sources.md +245 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/guides/reporting.md +13 -1
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/index.md +7 -3
- longguard-0.2.1.dev0/docs/integrations/crewai.md +44 -0
- longguard-0.2.1.dev0/docs/integrations/langgraph.md +123 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/integrations/raw-client.md +37 -5
- longguard-0.2.1.dev0/examples/crewai_guarded.py +66 -0
- longguard-0.2.1.dev0/examples/langgraph_resume.py +60 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/mkdocs.yml +4 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/pyproject.toml +13 -7
- longguard-0.2.1.dev0/scripts/prepare_merge_release.py +114 -0
- longguard-0.2.1.dev0/scripts/release_notes.py +67 -0
- longguard-0.2.1.dev0/scripts/verify_release.py +91 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/__init__.py +10 -4
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/breaker.py +129 -52
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/decorator.py +54 -9
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/reporter.py +34 -18
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/step.py +1 -1
- longguard-0.2.1.dev0/src/longguard/integrations/crewai.py +436 -0
- longguard-0.2.1.dev0/src/longguard/integrations/graph_runner.py +231 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/integrations/langchain.py +5 -7
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/integrations/langgraph.py +99 -34
- longguard-0.2.1.dev0/src/longguard/integrations/messages.py +150 -0
- longguard-0.2.1.dev0/src/longguard/pricing.py +235 -0
- longguard-0.2.1.dev0/tests/benchmarks/LABEL_REVIEW.md +22 -0
- longguard-0.2.1.dev0/tests/benchmarks/corpus.json +2781 -0
- longguard-0.2.1.dev0/tests/benchmarks/results/baseline-hash.json +3149 -0
- longguard-0.2.1.dev0/tests/benchmarks/results/current-hash.json +3277 -0
- longguard-0.2.1.dev0/tests/benchmarks/run.py +257 -0
- longguard-0.2.1.dev0/tests/fixtures/report_v014.json +11 -0
- longguard-0.2.1.dev0/tests/test_benchmark.py +78 -0
- longguard-0.2.1.dev0/tests/test_crewai_callback_contracts.py +48 -0
- longguard-0.2.1.dev0/tests/test_crewai_execution.py +292 -0
- longguard-0.2.1.dev0/tests/test_decorator_contracts.py +302 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_langchain_integration.py +0 -9
- longguard-0.2.1.dev0/tests/test_langgraph_node_contracts.py +166 -0
- longguard-0.2.1.dev0/tests/test_langgraph_resume.py +381 -0
- longguard-0.2.1.dev0/tests/test_merge_release_workflow.py +99 -0
- longguard-0.2.1.dev0/tests/test_policy_edge_contracts.py +138 -0
- longguard-0.2.1.dev0/tests/test_prepare_merge_release.py +88 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_pricing.py +78 -12
- longguard-0.2.1.dev0/tests/test_public_exports.py +32 -0
- longguard-0.2.1.dev0/tests/test_release_notes.py +52 -0
- longguard-0.2.1.dev0/tests/test_terminal_state.py +106 -0
- longguard-0.2.1.dev0/tests/test_tool_cleanup.py +129 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/uv.lock +48 -888
- longguard-0.1.4/.github/workflows/ci.yml +0 -48
- longguard-0.1.4/.github/workflows/release.yml +0 -126
- longguard-0.1.4/CONTRIBUTING.md +0 -64
- longguard-0.1.4/docs/integrations/crewai.md +0 -141
- longguard-0.1.4/docs/integrations/langgraph.md +0 -80
- longguard-0.1.4/src/longguard/integrations/crewai.py +0 -254
- longguard-0.1.4/src/longguard/pricing.py +0 -188
- {longguard-0.1.4 → longguard-0.2.1.dev0}/.github/release.yml +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/.github/workflows/docs.yml +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/LICENSE +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/assets/architecture.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/assets/icon.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/assets/linkedin_card.png +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/assets/linkedin_launch.jpg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/assets/logo-dark.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/assets/logo-light.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/assets/logo.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/assets/architecture.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/assets/icon.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/assets/logo-dark.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/assets/logo-light.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/assets/logo.svg +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/changelog.md +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/concepts/detectors.md +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/concepts/reflect-and-pivot.md +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/contributing.md +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/getting-started.md +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/docs/integrations/langchain.md +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/examples/custom_detector.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/examples/langchain_agent.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/examples/langgraph_basic.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/examples/openai_raw_guard.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/config.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/__init__.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/detectors/__init__.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/detectors/base.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/detectors/dead_end.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/detectors/semantic_osc.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/detectors/token_velocity.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/detectors/tool_repeat.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/core/pivot.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/integrations/__init__.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/integrations/strands.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/src/longguard/py.typed +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/__init__.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/conftest.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_breaker.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_config.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_crewai_integration.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_dead_end.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_decorator.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_langgraph_integration.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_pivot.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_report_persistence.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_reporter.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_semantic_osc.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_step.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_step_adapters.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_strands_integration.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_token_velocity.py +0 -0
- {longguard-0.1.4 → longguard-0.2.1.dev0}/tests/test_tool_repeat.py +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a reproducible problem or unexpected behavior in LongGuard
|
|
3
|
+
title: "[Bug]: "
|
|
4
|
+
labels: ["bug"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thank you for reporting an issue! Please check if a similar issue already exists before submitting.
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: description
|
|
12
|
+
attributes:
|
|
13
|
+
label: Description
|
|
14
|
+
description: A clear and concise description of what the bug is.
|
|
15
|
+
placeholder: What happened vs what you expected to happen...
|
|
16
|
+
validations:
|
|
17
|
+
required: true
|
|
18
|
+
- type: textarea
|
|
19
|
+
id: reproduction
|
|
20
|
+
attributes:
|
|
21
|
+
label: Minimal Reproduction Code
|
|
22
|
+
description: Provide a minimal, self-contained Python script to reproduce the issue (without API keys).
|
|
23
|
+
placeholder: |
|
|
24
|
+
```python
|
|
25
|
+
from longguard import CircuitBreaker, GuardConfig, AgentStep
|
|
26
|
+
...
|
|
27
|
+
```
|
|
28
|
+
render: python
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: telemetry
|
|
33
|
+
attributes:
|
|
34
|
+
label: Telemetry / GuardReport Output
|
|
35
|
+
description: If applicable, attach redacted `GuardReport.summary()` or JSON output.
|
|
36
|
+
render: json
|
|
37
|
+
validations:
|
|
38
|
+
required: false
|
|
39
|
+
- type: input
|
|
40
|
+
id: environment
|
|
41
|
+
attributes:
|
|
42
|
+
label: Environment Details
|
|
43
|
+
description: "Versions: LongGuard version, Python version, OS (e.g. LongGuard 0.2.0, Python 3.12.3, Ubuntu 22.04)"
|
|
44
|
+
placeholder: "LongGuard 0.2.0, Python 3.12.3, Ubuntu 22.04"
|
|
45
|
+
validations:
|
|
46
|
+
required: true
|
|
47
|
+
- type: input
|
|
48
|
+
id: framework_versions
|
|
49
|
+
attributes:
|
|
50
|
+
label: Framework Versions (if relevant)
|
|
51
|
+
description: "e.g. LangGraph 1.0.0, LangChain 1.0.2, CrewAI 0.28.0"
|
|
52
|
+
placeholder: "LangGraph 1.0.0"
|
|
53
|
+
validations:
|
|
54
|
+
required: false
|
|
55
|
+
- type: checkboxes
|
|
56
|
+
id: checklist
|
|
57
|
+
attributes:
|
|
58
|
+
label: Confirmations
|
|
59
|
+
options:
|
|
60
|
+
- label: I have verified this is not a duplicate of an existing issue.
|
|
61
|
+
required: true
|
|
62
|
+
- label: I have verified that no sensitive information (API keys, secrets, private data) is included.
|
|
63
|
+
required: true
|
|
64
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: GitHub Discussions
|
|
4
|
+
url: https://github.com/ENDEVSOLS/LongGuard/discussions
|
|
5
|
+
about: Ask questions, get help, or share how you are using LongGuard.
|
|
6
|
+
- name: Documentation
|
|
7
|
+
url: https://endevsols.github.io/LongGuard/
|
|
8
|
+
about: Read user guides, API references, and tutorials.
|
|
9
|
+
- name: Security Vulnerability Reporting
|
|
10
|
+
url: https://github.com/ENDEVSOLS/LongGuard/blob/main/SECURITY.md
|
|
11
|
+
about: Privately disclose potential security vulnerabilities.
|
|
12
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Propose a new feature, adapter, detector, or enhancement for LongGuard
|
|
3
|
+
title: "[Feature]: "
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Have an idea to make LongGuard better? Let us know!
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: problem
|
|
12
|
+
attributes:
|
|
13
|
+
label: Problem Statement
|
|
14
|
+
description: Is your feature request related to a problem or limitation? A clear and concise description of what the problem is.
|
|
15
|
+
placeholder: "I am always frustrated when..."
|
|
16
|
+
validations:
|
|
17
|
+
required: true
|
|
18
|
+
- type: textarea
|
|
19
|
+
id: proposed_solution
|
|
20
|
+
attributes:
|
|
21
|
+
label: Proposed Solution / API Design
|
|
22
|
+
description: Describe what you would like to happen and provide sample API usage if applicable.
|
|
23
|
+
placeholder: |
|
|
24
|
+
```python
|
|
25
|
+
# Proposed API usage:
|
|
26
|
+
...
|
|
27
|
+
```
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
- type: textarea
|
|
31
|
+
id: alternatives
|
|
32
|
+
attributes:
|
|
33
|
+
label: Alternatives Considered
|
|
34
|
+
description: Any alternative solutions or workarounds you've considered.
|
|
35
|
+
validations:
|
|
36
|
+
required: false
|
|
37
|
+
- type: textarea
|
|
38
|
+
id: context
|
|
39
|
+
attributes:
|
|
40
|
+
label: Additional Context
|
|
41
|
+
description: Add any other context, screenshots, or framework documentation links here.
|
|
42
|
+
validations:
|
|
43
|
+
required: false
|
|
44
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Framework coverage and controlled continuation for the v0.2.0 preview
|
|
2
|
+
|
|
3
|
+
A detector trip could return `continue` on the next clean observation, CrewAI advice was stored
|
|
4
|
+
without delivered recovery, and LangGraph termination could leave pending calls or dispatch
|
|
5
|
+
excluded tools. This preview keeps OPEN terminal, bounds advice across recoveries, delivers
|
|
6
|
+
advice in the supported CrewAI ReAct mode, and adds explicit checkpoint continuation using the
|
|
7
|
+
existing breaker with cumulative consumption and original-ID skipped tool results.
|
|
8
|
+
|
|
9
|
+
It preserves core APIs/defaults, optional dependencies, old report loading, provider converters,
|
|
10
|
+
decorator APIs and estimated pricing. New reporting fields are additive. The graph controller
|
|
11
|
+
supports one synchronous agent/tools cycle in the same process. CrewAI support requires the
|
|
12
|
+
tested public sequential ReAct executor; unsupported modes fail clearly.
|
|
13
|
+
|
|
14
|
+
Validation: original baseline suite, Python 3.10/3.11 core checks, real framework contract tests,
|
|
15
|
+
Ruff, strict MyPy, documentation/build checks, local examples and clean-install/upgrade checks.
|
|
16
|
+
The latest combined suite passed 403 tests with 97.60% statement coverage; current core-only
|
|
17
|
+
Python 3.11 checks passed. Earlier clean wheel/sdist/upgrade checks are recorded separately. Exact current results and commands are in `docs/guides/development-evidence.md` and generated
|
|
18
|
+
`release-evidence.json`. Hash/Jaccard benchmark counts are unchanged from baseline; weak classes
|
|
19
|
+
are disclosed. Synthetic labels still require human review.
|
|
20
|
+
|
|
21
|
+
Release workflow generates literal notes, verifies requested source/tag/version, runs actual
|
|
22
|
+
gates and creates candidate-aware drafts. This is unpublished `0.2.0.dev0`, not stable release
|
|
23
|
+
approval. Human labels/quality acceptance, hosted CI and candidate feedback remain maintainer gates.
|
|
24
|
+
|
|
25
|
+
The coverage follow-up adds 96 behavioral cases and enforces a 95% aggregate statement
|
|
26
|
+
coverage minimum in full-framework CI and release verification. It also fixes decorator
|
|
27
|
+
dispatch after termination and stale async/generator report references after reset.
|
|
28
|
+
|
|
29
|
+
The CI path regression is repaired: benchmarks remain tracked under `tests/benchmarks/`,
|
|
30
|
+
all active references use this location, and a new CLI regression checks the default corpus.
|
|
31
|
+
The benchmark command and full release gates pass locally; hosted CI must rerun after pushing.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
<!-- Provide a brief explanation of the motivation and context for this change. -->
|
|
4
|
+
|
|
5
|
+
Fixes #(issue)
|
|
6
|
+
|
|
7
|
+
## Type of Change
|
|
8
|
+
|
|
9
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
10
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
11
|
+
- [ ] Documentation update
|
|
12
|
+
- [ ] Refactoring / performance improvement (no behavior change)
|
|
13
|
+
- [ ] CI / infrastructure / release tooling
|
|
14
|
+
|
|
15
|
+
## Checklist
|
|
16
|
+
|
|
17
|
+
- [ ] Code follows the style guidelines of this project
|
|
18
|
+
- [ ] `uv run ruff check src/ tests/` passes
|
|
19
|
+
- [ ] `uv run mypy src/longguard/` passes with no errors
|
|
20
|
+
- [ ] `uv run pytest tests/` passes with all tests green
|
|
21
|
+
- [ ] Added tests for new features or bug fixes
|
|
22
|
+
- [ ] Documentation and `CHANGELOG.md` have been updated if applicable
|
|
23
|
+
- [ ] Runtime behavior is preserved (or explicitly documented if changed)
|
|
24
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
day: "monday"
|
|
8
|
+
commit-message:
|
|
9
|
+
prefix: "chore(deps):"
|
|
10
|
+
open-pull-requests-limit: 10
|
|
11
|
+
|
|
12
|
+
- package-ecosystem: "github-actions"
|
|
13
|
+
directory: "/"
|
|
14
|
+
schedule:
|
|
15
|
+
interval: "weekly"
|
|
16
|
+
day: "monday"
|
|
17
|
+
commit-message:
|
|
18
|
+
prefix: "chore(deps):"
|
|
19
|
+
open-pull-requests-limit: 10
|
|
20
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test on Python ${{ matrix.python-version }} (${{ matrix.os }})
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest]
|
|
17
|
+
python-version: ["3.11", "3.12"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v3
|
|
24
|
+
with:
|
|
25
|
+
version: "latest"
|
|
26
|
+
|
|
27
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
28
|
+
run: uv python install ${{ matrix.python-version }}
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: |
|
|
32
|
+
uv sync --python ${{ matrix.python-version }} --extra dev
|
|
33
|
+
|
|
34
|
+
- name: Run Ruff Linter & Formatter
|
|
35
|
+
run: |
|
|
36
|
+
uv run --python ${{ matrix.python-version }} ruff check src/ tests/
|
|
37
|
+
|
|
38
|
+
- name: Run MyPy Type Checker
|
|
39
|
+
run: |
|
|
40
|
+
uv run --python ${{ matrix.python-version }} mypy src/
|
|
41
|
+
|
|
42
|
+
- name: Run Pytest Suite with Coverage
|
|
43
|
+
run: |
|
|
44
|
+
uv run --python ${{ matrix.python-version }} pytest tests/ --cov=longguard --cov-report=xml --cov-report=term-missing
|
|
45
|
+
|
|
46
|
+
- name: Verify Package Build
|
|
47
|
+
run: |
|
|
48
|
+
uv build
|
|
49
|
+
|
|
50
|
+
frameworks:
|
|
51
|
+
name: Real frameworks (${{ matrix.dependencies }})
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
strategy:
|
|
54
|
+
fail-fast: false
|
|
55
|
+
matrix:
|
|
56
|
+
dependencies: [locked, newest]
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
- uses: astral-sh/setup-uv@v3
|
|
60
|
+
- run: uv python install 3.12
|
|
61
|
+
- name: Install framework contracts
|
|
62
|
+
run: uv sync --locked --python 3.12 --extra dev --extra langgraph --extra langchain --extra crewai
|
|
63
|
+
- name: Exercise newest compatible frameworks without changing the lockfile
|
|
64
|
+
if: matrix.dependencies == 'newest'
|
|
65
|
+
run: uv pip install --upgrade 'langgraph>=1.0.0' 'langchain>=1.0.0' 'crewai>=0.28.0,<1.15.29'
|
|
66
|
+
- name: Require framework presence
|
|
67
|
+
run: >-
|
|
68
|
+
uv run --no-sync python -c "from importlib.metadata import version; print({n: version(n) for n in ('langgraph', 'langchain', 'crewai')})"
|
|
69
|
+
- name: Execute gates and require real framework tests
|
|
70
|
+
run: uv run --no-sync python scripts/verify_release.py
|
|
71
|
+
- uses: actions/upload-artifact@v4
|
|
72
|
+
if: always()
|
|
73
|
+
with:
|
|
74
|
+
name: checks-${{ matrix.dependencies }}
|
|
75
|
+
path: |
|
|
76
|
+
release-evidence.json
|
|
77
|
+
release-coverage.json
|
|
78
|
+
- name: Reproduce provisional benchmark
|
|
79
|
+
run: uv run --no-sync python tests/benchmarks/run.py --output /tmp/benchmark.json
|
|
80
|
+
- uses: actions/upload-artifact@v4
|
|
81
|
+
with:
|
|
82
|
+
name: benchmark-${{ matrix.dependencies }}
|
|
83
|
+
path: /tmp/benchmark.json
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
name: Release merged PR
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
pr_number:
|
|
9
|
+
description: Merged PR number to release or retry
|
|
10
|
+
required: true
|
|
11
|
+
type: string
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
pull-requests: read
|
|
16
|
+
|
|
17
|
+
# Keep independent merges from cancelling each other's release runs.
|
|
18
|
+
concurrency:
|
|
19
|
+
group: release-merge-${{ github.event.inputs.pr_number || github.sha }}
|
|
20
|
+
cancel-in-progress: false
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
prepare:
|
|
24
|
+
if: github.ref == 'refs/heads/main'
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
outputs:
|
|
27
|
+
tag: ${{ steps.prepare.outputs.tag }}
|
|
28
|
+
steps:
|
|
29
|
+
- name: Find merged PR
|
|
30
|
+
id: pr
|
|
31
|
+
uses: actions/github-script@v8
|
|
32
|
+
with:
|
|
33
|
+
script: |
|
|
34
|
+
const { owner, repo } = context.repo;
|
|
35
|
+
let number;
|
|
36
|
+
if (context.eventName === 'workflow_dispatch') {
|
|
37
|
+
const input = context.payload.inputs.pr_number;
|
|
38
|
+
if (!/^[1-9]\d*$/.test(input)) {
|
|
39
|
+
throw new Error('Enter a positive merged PR number');
|
|
40
|
+
}
|
|
41
|
+
number = Number(input);
|
|
42
|
+
} else {
|
|
43
|
+
const associated = await github.paginate(
|
|
44
|
+
github.rest.repos.listPullRequestsAssociatedWithCommit,
|
|
45
|
+
{ owner, repo, commit_sha: context.sha, per_page: 100 }
|
|
46
|
+
);
|
|
47
|
+
const match = associated.find(pr =>
|
|
48
|
+
pr.merged_at && pr.merge_commit_sha === context.sha &&
|
|
49
|
+
pr.base.ref === 'main' &&
|
|
50
|
+
pr.base.repo.full_name.toLowerCase() === `${owner}/${repo}`.toLowerCase()
|
|
51
|
+
);
|
|
52
|
+
if (!match) {
|
|
53
|
+
core.info('No PR merged into main at this commit; skipping release.');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
number = match.number;
|
|
57
|
+
}
|
|
58
|
+
const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: number });
|
|
59
|
+
if (!pr.merged || !pr.merge_commit_sha || pr.base.ref !== 'main' ||
|
|
60
|
+
pr.base.repo.full_name.toLowerCase() !== `${owner}/${repo}`.toLowerCase()) {
|
|
61
|
+
throw new Error('Only PRs merged into this repository main branch can release');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Check if the PR has a 'release' label for stable release
|
|
65
|
+
const labels = (pr.labels || []).map(l => (typeof l === 'string' ? l : (l.name || '')).toLowerCase());
|
|
66
|
+
const isStable = labels.includes('release');
|
|
67
|
+
core.setOutput('stable', isStable ? 'true' : 'false');
|
|
68
|
+
core.info(`Release mode: ${isStable ? 'STABLE' : 'dev'}`);
|
|
69
|
+
|
|
70
|
+
require('fs').writeFileSync(
|
|
71
|
+
`${process.env.RUNNER_TEMP}/release-pr.json`, JSON.stringify({ pull_request: pr })
|
|
72
|
+
);
|
|
73
|
+
core.setOutput('sha', pr.merge_commit_sha);
|
|
74
|
+
# A push to main is trusted repository code, including merges from forks.
|
|
75
|
+
- uses: actions/checkout@v6
|
|
76
|
+
if: steps.pr.outputs.sha != ''
|
|
77
|
+
with:
|
|
78
|
+
ref: ${{ steps.pr.outputs.sha }}
|
|
79
|
+
fetch-depth: 0
|
|
80
|
+
- uses: actions/setup-python@v6
|
|
81
|
+
if: steps.pr.outputs.sha != ''
|
|
82
|
+
with:
|
|
83
|
+
python-version: '3.12'
|
|
84
|
+
- name: Prepare versioned release source
|
|
85
|
+
id: prepare
|
|
86
|
+
if: steps.pr.outputs.sha != ''
|
|
87
|
+
env:
|
|
88
|
+
RELEASE_STABLE: ${{ steps.pr.outputs.stable }}
|
|
89
|
+
run: GITHUB_EVENT_PATH="$RUNNER_TEMP/release-pr.json" python scripts/prepare_merge_release.py
|
|
90
|
+
- name: Push release tag
|
|
91
|
+
if: steps.pr.outputs.sha != ''
|
|
92
|
+
env:
|
|
93
|
+
RELEASE_TAG: ${{ steps.prepare.outputs.tag }}
|
|
94
|
+
run: git push origin "refs/tags/$RELEASE_TAG"
|
|
95
|
+
|
|
96
|
+
release:
|
|
97
|
+
needs: prepare
|
|
98
|
+
if: needs.prepare.outputs.tag != ''
|
|
99
|
+
uses: ./.github/workflows/release.yml
|
|
100
|
+
with:
|
|
101
|
+
tag: ${{ needs.prepare.outputs.tag }}
|
|
102
|
+
publish: true
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
tag:
|
|
7
|
+
required: true
|
|
8
|
+
type: string
|
|
9
|
+
publish:
|
|
10
|
+
default: false
|
|
11
|
+
type: boolean
|
|
12
|
+
push:
|
|
13
|
+
tags: ["v*"]
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
inputs:
|
|
16
|
+
tag:
|
|
17
|
+
description: "Existing version tag to release (for example v0.2.0 or v0.2.0rc1)"
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: write
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build-and-release:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v6
|
|
28
|
+
with:
|
|
29
|
+
ref: ${{ inputs.tag || github.ref }}
|
|
30
|
+
fetch-depth: 0
|
|
31
|
+
- uses: astral-sh/setup-uv@v3
|
|
32
|
+
- run: uv python install 3.12
|
|
33
|
+
- run: uv sync --locked --python 3.12 --extra dev --extra langgraph --extra langchain --extra crewai
|
|
34
|
+
- name: Verify tag and source identity
|
|
35
|
+
env:
|
|
36
|
+
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
|
|
37
|
+
run: |
|
|
38
|
+
git show-ref --verify "refs/tags/$RELEASE_TAG"
|
|
39
|
+
test "$(git rev-list -n 1 "$RELEASE_TAG")" = "$(git rev-parse HEAD)"
|
|
40
|
+
- name: Execute and record release gates
|
|
41
|
+
env:
|
|
42
|
+
UV_CACHE_DIR: /tmp/longguard-uv-cache
|
|
43
|
+
run: uv run --no-sync python scripts/verify_release.py
|
|
44
|
+
- name: Build distribution packages
|
|
45
|
+
run: uv build
|
|
46
|
+
- name: Generate literal release notes
|
|
47
|
+
id: notes
|
|
48
|
+
env:
|
|
49
|
+
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
|
|
50
|
+
run: >-
|
|
51
|
+
uv run --no-sync python scripts/release_notes.py --tag "$RELEASE_TAG"
|
|
52
|
+
--evidence release-evidence.json --output release_body.md
|
|
53
|
+
--github-output "$GITHUB_OUTPUT"
|
|
54
|
+
- name: Upload check evidence
|
|
55
|
+
if: always()
|
|
56
|
+
uses: actions/upload-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: release-evidence
|
|
59
|
+
path: |
|
|
60
|
+
release-evidence.json
|
|
61
|
+
release-coverage.json
|
|
62
|
+
- name: Create GitHub release
|
|
63
|
+
uses: softprops/action-gh-release@v2
|
|
64
|
+
with:
|
|
65
|
+
tag_name: ${{ steps.notes.outputs.tag }}
|
|
66
|
+
name: LongGuard ${{ steps.notes.outputs.tag }}
|
|
67
|
+
files: |
|
|
68
|
+
dist/*.whl
|
|
69
|
+
dist/*.tar.gz
|
|
70
|
+
release-evidence.json
|
|
71
|
+
release-coverage.json
|
|
72
|
+
body_path: release_body.md
|
|
73
|
+
draft: ${{ inputs.publish != true }}
|
|
74
|
+
prerelease: ${{ steps.notes.outputs.prerelease == 'true' }}
|
|
75
|
+
make_latest: ${{ steps.notes.outputs.latest }}
|
|
@@ -7,13 +7,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
## [
|
|
10
|
+
## [0.2.1] - 2026-11-09
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- GitHub issue templates (bug reports, feature requests), issue configuration linking to Discussions and Docs, and pull request template with pre-merge checklist.
|
|
15
|
+
- Community governance and support infrastructure (`CODE_OF_CONDUCT.md` and `SUPPORT.md`).
|
|
16
|
+
- Weekly Dependabot configuration (`.github/dependabot.yml`) for `pip` and `github-actions`.
|
|
17
|
+
- `Changelog` and `Discussions` links under `[project.urls]` in `pyproject.toml`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Corrected README and documentation claims to match code reality (Python 3.11+ requirement, CrewAI integration, `@guarded` decorator, guarded LangGraph resume, and removed stale v0.1.3 labels and static test count badges).
|
|
22
|
+
|
|
23
|
+
### Compatibility and limits
|
|
24
|
+
|
|
25
|
+
- No runtime change: detectors, circuit breaker state machine, defaults, budget boundaries, and report schemas are identical to 0.2.0.
|
|
26
|
+
- Baseline 0.2.0 was published to PyPI on 2026-11-03.
|
|
27
|
+
|
|
28
|
+
## [0.2.0] - 2026-10-07
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- Explicit, cumulative same-process LangGraph continuation via `compile_guarded_graph`
|
|
33
|
+
and `GuardedGraph.resume`, with checkpoint identity checks and independent run reports.
|
|
34
|
+
- Original-ID tool-call cleanup for LangChain, OpenAI and Anthropic histories.
|
|
35
|
+
- Additive report fields for run identity, continuation history, skipped tools and usage warnings.
|
|
36
|
+
- Reproducible held-out detector evaluation, raw counts, latency and baseline comparison.
|
|
37
|
+
Synthetic labels await human review; results are provisional.
|
|
38
|
+
- Real framework contract tests, credential-free examples, compatibility documentation and
|
|
39
|
+
version-matched release draft generation with executed check evidence.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Minimum supported Python version is now 3.11; package metadata, tooling and CI match.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- OPEN remains terminal on clean observations; repeated recoveries retain their reflection limit.
|
|
48
|
+
- Guarded synchronous, asynchronous and generator calls stop before body execution when
|
|
49
|
+
the circuit is already OPEN; async/generator reset refreshes reports and reflection advice.
|
|
50
|
+
- Excluded LangGraph tool nodes cannot dispatch after a trip.
|
|
51
|
+
- Supported CrewAI synchronous ReAct executions receive recovery advice before the next model
|
|
52
|
+
request, preserve callbacks, count complete actions once and use execution-scoped hooks.
|
|
53
|
+
|
|
54
|
+
### Compatibility and limits
|
|
55
|
+
|
|
56
|
+
- Existing core imports, detector defaults, budget boundaries, report loading and optional extras
|
|
57
|
+
are preserved. Reports are telemetry, not executable checkpoints.
|
|
58
|
+
- Controlled graph resume supports one synchronous agent/tools cycle in the same process.
|
|
59
|
+
- CrewAI execution support is explicitly bounded to the tested sequential ReAct executor.
|
|
60
|
+
Unsupported execution modes fail clearly; callback-only `CrewGuard` remains available.
|
|
61
|
+
- No stable release, PyPI publication, production savings or broad dependency-range claim.
|
|
11
62
|
|
|
12
63
|
---
|
|
13
64
|
|
|
14
65
|
## [0.1.4] - 2026-09-24
|
|
15
66
|
|
|
16
67
|
### 🚀 Added
|
|
68
|
+
|
|
17
69
|
- **CrewAI Integration (`CrewGuard` & `add_guard_to_crew`)**: Added native CrewAI support in `longguard.integrations.crewai`. Protects multi-agent crews from delegation loops and repetitive tool calls via `step_callback` and 1-line `add_guard_to_crew(crew)`.
|
|
18
70
|
- **Universal `@guarded` Decorator**: Added `@guarded` decorator in `longguard.core.decorator` (exported top-level as `longguard.guarded`). Wraps arbitrary Python functions, SDK calls, generators, and async coroutines with circuit breaker protection in 1 line.
|
|
19
71
|
- **PEP 561 Typing Support (`py.typed`)**: Added `src/longguard/py.typed` marker file and `Typing :: Typed` package classifier for strict IDE and static analysis support (MyPy, Pyright, VS Code Pylance).
|
|
@@ -21,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
21
73
|
- **Documentation & Theme Polish**: Enhanced MkDocs configuration with logo, favicon, GitHub repository icon, back-to-top navigation, tab synchronization, social footer, and new documentation guides for CrewAI and the `@guarded` decorator.
|
|
22
74
|
|
|
23
75
|
### 🔄 Changed
|
|
76
|
+
|
|
24
77
|
- **PyPI Metadata & SEO Optimization**: Updated official documentation URL to `https://endevsols.github.io/LongGuard/`, expanded keywords to 15 high-intent discovery tags, and added `Operating System :: OS Independent` and `Topic :: System :: Monitoring` classifiers.
|
|
25
78
|
- **README Links**: Converted relative markdown links to absolute GitHub URLs to prevent 404 errors when rendered on PyPI.
|
|
26
79
|
- **Expanded Test Suite**: Added 16 new test cases (271 tests total, 100% passing) covering `@guarded` (sync, async, generators, cost limits, fallbacks) and `CrewGuard` (action/finish parsing, crew wrapping, callback chaining).
|
|
@@ -30,6 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
30
83
|
## [0.1.3] - 2026-09-05
|
|
31
84
|
|
|
32
85
|
### 🚀 Added
|
|
86
|
+
|
|
33
87
|
- **Raw Client Integration (OpenAI & Anthropic)**: Added `AgentStep.from_openai_response()` and `AgentStep.from_anthropic_response()` class methods. Enables using LongGuard directly with standard `openai` and `anthropic` SDK client loops without requiring LangGraph or LangChain.
|
|
34
88
|
- **Dollar Cost Tracking**: Built-in pricing engine (`PRICING_TABLE`, `compute_cost`, `list_supported_models`) supporting 40+ major LLM models (OpenAI GPT-4o/o1/o3, Anthropic Claude 3.5/4, Gemini 1.5/2.0/2.5, LLaMA 3.1/3.3, Mistral, Cohere).
|
|
35
89
|
- **Budget Hard Cap (`max_cost_usd`)**: Configure hard dollar spend limits on agent runs (`max_cost_usd`) to immediately trip the circuit breaker and prevent runaway API bills.
|
|
@@ -38,6 +92,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
38
92
|
- **Runnable Examples & Docs**: Added standalone example in `examples/openai_raw_guard.py` and documentation in `docs/integrations/raw-client.md`.
|
|
39
93
|
|
|
40
94
|
### 🔄 Changed
|
|
95
|
+
|
|
41
96
|
- **GuardReport Telemetry**: `GuardReport.summary()` now displays `Estimated Cost: $X.XXXX USD (model)` when cost tracking is configured.
|
|
42
97
|
- **Expanded Test Suite**: Added 76 new test cases (255 tests total, 100% passing) covering SDK response parsing, pricing calculations, breaker cost limits, and report serialization.
|
|
43
98
|
- **Automated GitHub Releases**: Enhanced GitHub Actions workflow to parse release notes directly from `CHANGELOG.md` and exclude internal build metadata from release assets.
|
|
@@ -47,6 +102,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
47
102
|
## [0.1.2] - 2026-09-05
|
|
48
103
|
|
|
49
104
|
### 🎨 Changed
|
|
105
|
+
|
|
50
106
|
- **Dual-Theme Branding**: Added dual-theme vector logos (`logo-light.svg` and `logo-dark.svg`) ensuring crystal-clear visibility across GitHub Dark, GitHub Light, and PyPI.
|
|
51
107
|
- **Clean Architecture Diagram**: Replaced architecture diagram with high-contrast, professional SVG asset.
|
|
52
108
|
- **Contact Updates**: Updated repository contact and security email addresses to `technology@endevsols.com`.
|
|
@@ -57,6 +113,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
57
113
|
## [0.1.1] - 2026-09-05
|
|
58
114
|
|
|
59
115
|
### 🚀 Added
|
|
116
|
+
|
|
60
117
|
- **Initial Public Release** of LongGuard: Production-grade in-flight circuit breaker for autonomous AI agents.
|
|
61
118
|
- **Circuit Breaker State Machine**: 4-state lifecycle (`CLOSED`, `REFLECTING`, `HALF_OPEN`, `OPEN`).
|
|
62
119
|
- **4 Autonomous Loop Detectors**:
|