petfishframework 0.2.0__tar.gz → 0.2.2__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.
- petfishframework-0.2.2/.sisyphus/plans/v0.2.0-plan.md +167 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/CHANGELOG.md +42 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/PKG-INFO +9 -3
- {petfishframework-0.2.0 → petfishframework-0.2.2}/README.md +8 -2
- petfishframework-0.2.2/SECURITY.md +46 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/api.md +2 -2
- petfishframework-0.2.2/docs/enterprise-expense-demo.md +92 -0
- petfishframework-0.2.2/docs/feedbacks/petfishframework_v0_2_1_review.md +687 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/pyproject.toml +1 -1
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/__init__.py +1 -1
- petfishframework-0.2.2/src/petfishframework/reliability/audit_report.py +213 -0
- petfishframework-0.2.2/tests/test_audit_report_v2.py +120 -0
- petfishframework-0.2.2/tests/test_enterprise_demo.py +333 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/uv.lock +1 -1
- petfishframework-0.2.0/src/petfishframework/reliability/audit_report.py +0 -140
- {petfishframework-0.2.0 → petfishframework-0.2.2}/.env.example +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/.github/workflows/ci.yml +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/.gitignore +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/.sisyphus/plans/v0.1.6-plan.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/AGENTS.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/AGENTS.md.new +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/CONTRIBUTING.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/LICENSE +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/conftest.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/architecture.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/benchmark-results.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/development-plan.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/development.md +0 -0
- {petfishframework-0.2.0/docs/feedbacks → petfishframework-0.2.2/docs/feedbacks/archives}/petfishframework_0_1_4_playground_recommendations.md +0 -0
- {petfishframework-0.2.0/docs/feedbacks → petfishframework-0.2.2/docs/feedbacks/archives}/petfishframework_playground_report.md +0 -0
- {petfishframework-0.2.0/docs/feedbacks → petfishframework-0.2.2/docs/feedbacks/archives}/petfishframework_production_readiness_roadmap.md +0 -0
- {petfishframework-0.2.0/docs/feedbacks → petfishframework-0.2.2/docs/feedbacks/archives}/petfishframework_recommendations.md +0 -0
- {petfishframework-0.2.0/docs/feedbacks → petfishframework-0.2.2/docs/feedbacks/archives}/petfishframework_v0_1_6_playground_review.md +0 -0
- {petfishframework-0.2.0/docs/feedbacks → petfishframework-0.2.2/docs/feedbacks/archives}/petfishframework_v0_1_7_review.md +0 -0
- {petfishframework-0.2.0/docs/feedbacks → petfishframework-0.2.2/docs/feedbacks/archives}/petfishframework_v0_1_8_review.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/competitor-analysis/README.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/competitor-analysis/competitor-matrix.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/competitor-analysis/market-brief.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/competitor-analysis/positioning-map.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/competitor-analysis/swot-analysis.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/literature-review/inclusion-exclusion-criteria.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/literature-review/literature-matrix.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/literature-review/literature-review.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/literature-review/search-strategy.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/research/reference-repos-absorption.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/skeleton-completeness-checklist.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/test-results-report.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/usage-guide.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/docs/validation-roadmap.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/initialization-report.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/mcp/README.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/mcp/connection-checklist.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/mcp/mcp-config.example.json +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/opencode.json +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/qa/code-review-checklist.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/qa/qa-review.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/qa/qc-gate-decision.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/qa/test-plan.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/config.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/agent.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/compiled.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/contracts.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/conversation.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/environment.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/events.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/session.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/structured.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/core/types.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/mcp/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/mcp/client.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/mcp/server.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/mcp/stdio_transport.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/mcp/wrapper.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/models/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/models/anthropic.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/models/fake.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/models/openai.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/observability/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/observability/sinks.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/permissions/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/permissions/model.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reasoning/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reasoning/lats.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reasoning/llm_plus_p.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reasoning/react.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reliability/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reliability/cost.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reliability/cost_report.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reliability/pass_at_k.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reliability/replay.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reliability/retry.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/reliability/timeout.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/retrieval/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/retrieval/adaptive.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/retrieval/crag.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/retrieval/memory_store.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/tools/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/tools/agent_tool.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/tools/base.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/tools/calculator.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/tools/path_planner.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/tools/registry.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/src/petfishframework/tools/word_sorter.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tasks/backlog.md +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/integration/__init__.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/integration/test_anthropic_integration.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/integration/test_openai_integration.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_agent_tool.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_anthropic_adapter.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_api_agent_lifecycle.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_api_edge_cases.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_api_integration.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_api_public_surface.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_api_type_safety.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_async.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_conversation.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_degrade.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_degrade_failclosed.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_m2_m3_m4.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_mcp.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_openai_adapter.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_pass_at_k.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_permission_semantics.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_quickstart_smoke.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_replay.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_retrieval.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_retry.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_skeleton.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_stdio_transport.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_streaming.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_structured.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_tool_registry.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_v016_semantics.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_v018.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_v019.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_v2_interface_compatibility.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_v2_lats.py +0 -0
- {petfishframework-0.2.0 → petfishframework-0.2.2}/tests/test_v2_llm_plus_p.py +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# petfishFramework v0.2.0 开发计划
|
|
2
|
+
|
|
3
|
+
> 基于 5 轮用户反馈 + 生产可用路线图 + v0.1.9 状态
|
|
4
|
+
> 目标:从 Alpha runtime control skeleton 进入企业 PoC 可用阶段
|
|
5
|
+
> 原则:**不堆 feature,聚焦企业 PoC 可信度闭环**
|
|
6
|
+
|
|
7
|
+
## v0.2.0 使命
|
|
8
|
+
|
|
9
|
+
> 让一个企业开发者能在 30 分钟内:安装 → 配置权限策略 → 运行一个受控 Agent → 导出审计报告。
|
|
10
|
+
|
|
11
|
+
## 任务清单
|
|
12
|
+
|
|
13
|
+
### Phase A: 企业 PoC Demo(证明差异化,非 calculator)
|
|
14
|
+
|
|
15
|
+
#### A1: Enterprise Expense Approval Agent(端到端 demo)
|
|
16
|
+
|
|
17
|
+
**目标**:一个完整可运行示例,展示全部 6 种 DecisionEffect + Budget + AuditReport。
|
|
18
|
+
|
|
19
|
+
**文件**:`examples/05_enterprise_expense.py`
|
|
20
|
+
|
|
21
|
+
**场景**:报销审批 Agent,处理员工报销请求。
|
|
22
|
+
|
|
23
|
+
**覆盖**:
|
|
24
|
+
- 报销金额 < $500 → ALLOW(auto-approve)
|
|
25
|
+
- 报销金额 $500-$5000 → REQUIRE_APPROVAL
|
|
26
|
+
- 报销金额 > $5000 → DEGRADE 到 dry-run(无 fallback → fail-closed)
|
|
27
|
+
- 员工 SSN → MASK(input + output + event)
|
|
28
|
+
- 非财务角色 → DENY 特定工具
|
|
29
|
+
- Budget 限制总 token 消耗
|
|
30
|
+
- AuditReport 导出 Markdown + JSON
|
|
31
|
+
|
|
32
|
+
**TDD 测试先行**:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
# tests/test_enterprise_demo.py
|
|
36
|
+
|
|
37
|
+
def test_expense_under_500_auto_approved():
|
|
38
|
+
"""$350 team lunch → ALLOW, auto-approved."""
|
|
39
|
+
|
|
40
|
+
def test_expense_500_to_5000_requires_approval():
|
|
41
|
+
"""$2000 conference → REQUIRE_APPROVAL."""
|
|
42
|
+
|
|
43
|
+
def test_expense_over_5000_degrade_fail_closed():
|
|
44
|
+
"""$8000 equipment → DEGRADE, no fallback → blocked."""
|
|
45
|
+
|
|
46
|
+
def test_ssn_masked_in_input_output_and_event():
|
|
47
|
+
"""SSN masked before tool, in result, and in audit log."""
|
|
48
|
+
|
|
49
|
+
def test_non_finance_role_denied():
|
|
50
|
+
"""Non-finance role cannot call approve_payment."""
|
|
51
|
+
|
|
52
|
+
def test_budget_enforced():
|
|
53
|
+
"""Total token budget enforced."""
|
|
54
|
+
|
|
55
|
+
def test_audit_report_generated():
|
|
56
|
+
"""Markdown audit report contains all decisions."""
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**实现**:
|
|
60
|
+
- PolicyChecker tool(金额检查)
|
|
61
|
+
- ApprovePayment tool(审批工具,side_effect=True)
|
|
62
|
+
- ExpensePolicy(使用 tool metadata 做决策)
|
|
63
|
+
- FakeModel 驱动(无需 API key)
|
|
64
|
+
|
|
65
|
+
#### A2: Structured Audit Report 增强
|
|
66
|
+
|
|
67
|
+
**目标**:AuditReport 从 MVP 升级为可读、可审计的完整报告。
|
|
68
|
+
|
|
69
|
+
**新增字段**:
|
|
70
|
+
- Budget section(used vs limit)
|
|
71
|
+
- Event count by type
|
|
72
|
+
- Permission count by effect
|
|
73
|
+
- Masked fields summary
|
|
74
|
+
- Degraded calls summary
|
|
75
|
+
- Blocked calls summary
|
|
76
|
+
- Model call count + token summary
|
|
77
|
+
- Error section
|
|
78
|
+
|
|
79
|
+
**TDD 测试先行**:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
# tests/test_audit_report_v2.py
|
|
83
|
+
|
|
84
|
+
def test_report_contains_budget_section():
|
|
85
|
+
"""Report has budget table with used/limit."""
|
|
86
|
+
|
|
87
|
+
def test_report_counts_events_by_type():
|
|
88
|
+
"""Report has event count breakdown."""
|
|
89
|
+
|
|
90
|
+
def test_report_summarizes_permission_decisions():
|
|
91
|
+
"""Report has permission summary by effect."""
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Phase B: 供应链可信度
|
|
95
|
+
|
|
96
|
+
#### B1: SECURITY.md
|
|
97
|
+
|
|
98
|
+
**文件**:`SECURITY.md`
|
|
99
|
+
|
|
100
|
+
**内容**:
|
|
101
|
+
- 支持的版本
|
|
102
|
+
- 漏洞报告流程
|
|
103
|
+
- 响应时间承诺
|
|
104
|
+
- 安全联系人
|
|
105
|
+
|
|
106
|
+
#### B2: GitHub Actions CI 增强
|
|
107
|
+
|
|
108
|
+
**目标**:CI badge 可见 + 自动化质量门禁。
|
|
109
|
+
|
|
110
|
+
**新增**:
|
|
111
|
+
- pytest-cov 覆盖率报告
|
|
112
|
+
- README badge 自动更新(test count)
|
|
113
|
+
- Coverage badge
|
|
114
|
+
|
|
115
|
+
#### B3: PyPI Trusted Publishing
|
|
116
|
+
|
|
117
|
+
**目标**:从 twine 上传切换到 GitHub Actions OIDC Trusted Publishing。
|
|
118
|
+
|
|
119
|
+
**步骤**:
|
|
120
|
+
- PyPI 项目设置 → Trusted Publisher
|
|
121
|
+
- GitHub Actions workflow `publish.yml`
|
|
122
|
+
- Release trigger: tag push
|
|
123
|
+
|
|
124
|
+
### Phase C: 文档最终同步
|
|
125
|
+
|
|
126
|
+
#### C1: CHANGELOG 更新
|
|
127
|
+
|
|
128
|
+
- v0.2.0 完整变更日志
|
|
129
|
+
- 明确标注 Alpha → 企业 PoC 可用
|
|
130
|
+
|
|
131
|
+
#### C2: README 企业 PoC 段落
|
|
132
|
+
|
|
133
|
+
- 新增 "Enterprise PoC" section
|
|
134
|
+
- 链接到 examples/05_enterprise_expense.py
|
|
135
|
+
- 强调差异化:runtime control, not orchestration
|
|
136
|
+
|
|
137
|
+
## 执行顺序与依赖
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
A1 (企业 demo) → A2 (审计报告增强)
|
|
141
|
+
↓
|
|
142
|
+
B1 (SECURITY.md) → B2 (CI 增强) → B3 (Trusted Publishing)
|
|
143
|
+
↓
|
|
144
|
+
C1 (CHANGELOG) → C2 (README) → 发布 v0.2.0
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 验收标准
|
|
148
|
+
|
|
149
|
+
| # | 标准 | 验证方法 |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| V1 | 企业 demo 可运行(FakeModel,零成本) | `python examples/05_enterprise_expense.py` |
|
|
152
|
+
| V2 | 全部 6 种 DecisionEffect 在 demo 中展示 | 代码审查 + 运行输出 |
|
|
153
|
+
| V3 | AuditReport 包含 budget/permission/mask 摘要 | TDD test |
|
|
154
|
+
| V4 | SECURITY.md 存在 | 文件存在 |
|
|
155
|
+
| V5 | CI badge 可见 | GitHub Actions 运行 |
|
|
156
|
+
| V6 | Trusted Publishing 启用 | PyPI 元数据显示 |
|
|
157
|
+
| V7 | 所有测试通过 + ruff clean | pytest + ruff |
|
|
158
|
+
| V8 | CHANGELOG + README 同步 | 文档审查 |
|
|
159
|
+
|
|
160
|
+
## 不做清单(v0.2.0 明确排除)
|
|
161
|
+
|
|
162
|
+
- ❌ YAML Policy Engine(v0.3.0)
|
|
163
|
+
- ❌ CredentialBroker(v0.3.0)
|
|
164
|
+
- ❌ Deterministic rerun/resume(v0.4.0)
|
|
165
|
+
- ❌ MCP server mode(v0.5.0)
|
|
166
|
+
- ❌ 新 reasoning strategy
|
|
167
|
+
- ❌ 新 model adapter
|
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to petfishFramework will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.0] — 2026-07-08
|
|
6
|
+
|
|
7
|
+
### v0.2.0 Enterprise PoC Release
|
|
8
|
+
|
|
9
|
+
Enterprise Expense Approval Agent demo:
|
|
10
|
+
- 6 TDD tests covering ALL 6 DecisionEffects in enterprise scenario
|
|
11
|
+
- PolicyChecker, ApprovePayment (side_effect=True), DryRunPayment tools
|
|
12
|
+
- ExpensePolicy using tool metadata + amount thresholds
|
|
13
|
+
- Zero-cost (FakeModel driven, no API key needed)
|
|
14
|
+
|
|
15
|
+
AuditReport v2 enhancement:
|
|
16
|
+
- Budget section (input/output/total tokens, cost, elapsed)
|
|
17
|
+
- Event count by type table
|
|
18
|
+
- Permission summary by effect table
|
|
19
|
+
- Masked fields summary section
|
|
20
|
+
- Errors section for failed tool calls
|
|
21
|
+
- 5 new TDD tests
|
|
22
|
+
|
|
23
|
+
Supply chain:
|
|
24
|
+
- SECURITY.md (vulnerability reporting policy)
|
|
25
|
+
- CI badge in README (Python 3.10-3.12, ruff + pytest)
|
|
26
|
+
- Trusted Publishing: deferred (requires PyPI OIDC setup)
|
|
27
|
+
|
|
28
|
+
### v0.1.6-v0.1.9 (merged into 0.2.0 baseline)
|
|
29
|
+
|
|
30
|
+
Permission semantics:
|
|
31
|
+
- DEGRADE: fallback tool switching + fail-closed when no fallback
|
|
32
|
+
- MASK: input mask (pre-execution) + output mask (post) + event mask (audit log) + nested dot-path
|
|
33
|
+
- PARTIAL_ALLOW: pre-execution arg filtering
|
|
34
|
+
- REQUIRE_APPROVAL: pre-execution block
|
|
35
|
+
- All 6 DecisionEffects enforced with side-effect verification tests
|
|
36
|
+
|
|
37
|
+
Tool metadata:
|
|
38
|
+
- BaseTool: side_effect, idempotent, external_egress, requires_credentials
|
|
39
|
+
- SafeByDefaultPolicy example using metadata
|
|
40
|
+
|
|
41
|
+
Audit infrastructure:
|
|
42
|
+
- AuditReport with to_markdown() and to_json()
|
|
43
|
+
- audit_report_from_session(session, result=None)
|
|
44
|
+
- Event duration_ms + error capture
|
|
45
|
+
- Granular event types: tool.blocked/approval_required/called/masked/partial_allowed/degraded/degrade_failed
|
|
46
|
+
|
|
5
47
|
## [0.1.0a1] — 2026-07-06 (Alpha)
|
|
6
48
|
|
|
7
49
|
### Added — Core Framework
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: petfishframework
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A lightweight runtime framework for reliable, auditable, budget-aware, and permission-aware AI agents.
|
|
5
5
|
Project-URL: Homepage, https://github.com/kylecui/petfishFramework
|
|
6
6
|
Project-URL: Documentation, https://github.com/kylecui/petfishFramework/tree/master/docs
|
|
@@ -33,7 +33,7 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
|
|
34
34
|
[](https://www.python.org/downloads/)
|
|
35
35
|
[](https://github.com/kylecui/petfishFramework/blob/master/LICENSE)
|
|
36
|
-
[](https://github.com/kylecui/petfishFramework/tree/master/tests/)
|
|
37
37
|
|
|
38
38
|
**Status: Alpha** — API may change. Core runtime works; see [Roadmap](#roadmap).
|
|
39
39
|
|
|
@@ -208,6 +208,12 @@ print(result.summary())
|
|
|
208
208
|
- [Benchmark Results](https://github.com/kylecui/petfishFramework/blob/master/docs/benchmark-results.md) — 3-tier strategy
|
|
209
209
|
- [Examples](https://github.com/kylecui/petfishFramework/tree/master/examples/) — quickstart, tools+retrieval, multi-agent
|
|
210
210
|
|
|
211
|
+
## Enterprise PoC
|
|
212
|
+
|
|
213
|
+
See `examples/05_enterprise_expense.py` and `tests/test_enterprise_demo.py` for a complete enterprise expense approval scenario demonstrating all 6 DecisionEffects.
|
|
214
|
+
|
|
215
|
+
Run: `python examples/05_enterprise_expense.py`
|
|
216
|
+
|
|
211
217
|
## Roadmap
|
|
212
218
|
|
|
213
219
|
- **v0.1.x** (current): Core runtime, permission semantics, quickstart verified ✅
|
|
@@ -242,7 +248,7 @@ petfishFramework is **Alpha**. API may change before v1.0.
|
|
|
242
248
|
git clone https://github.com/kylecui/petfishFramework.git
|
|
243
249
|
cd petfishFramework
|
|
244
250
|
uv sync --all-extras
|
|
245
|
-
uv run pytest #
|
|
251
|
+
uv run pytest # 234 tests
|
|
246
252
|
uv run ruff check src/ tests/
|
|
247
253
|
```
|
|
248
254
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.python.org/downloads/)
|
|
6
6
|
[](https://github.com/kylecui/petfishFramework/blob/master/LICENSE)
|
|
7
|
-
[](https://github.com/kylecui/petfishFramework/tree/master/tests/)
|
|
8
8
|
|
|
9
9
|
**Status: Alpha** — API may change. Core runtime works; see [Roadmap](#roadmap).
|
|
10
10
|
|
|
@@ -179,6 +179,12 @@ print(result.summary())
|
|
|
179
179
|
- [Benchmark Results](https://github.com/kylecui/petfishFramework/blob/master/docs/benchmark-results.md) — 3-tier strategy
|
|
180
180
|
- [Examples](https://github.com/kylecui/petfishFramework/tree/master/examples/) — quickstart, tools+retrieval, multi-agent
|
|
181
181
|
|
|
182
|
+
## Enterprise PoC
|
|
183
|
+
|
|
184
|
+
See `examples/05_enterprise_expense.py` and `tests/test_enterprise_demo.py` for a complete enterprise expense approval scenario demonstrating all 6 DecisionEffects.
|
|
185
|
+
|
|
186
|
+
Run: `python examples/05_enterprise_expense.py`
|
|
187
|
+
|
|
182
188
|
## Roadmap
|
|
183
189
|
|
|
184
190
|
- **v0.1.x** (current): Core runtime, permission semantics, quickstart verified ✅
|
|
@@ -213,7 +219,7 @@ petfishFramework is **Alpha**. API may change before v1.0.
|
|
|
213
219
|
git clone https://github.com/kylecui/petfishFramework.git
|
|
214
220
|
cd petfishFramework
|
|
215
221
|
uv sync --all-extras
|
|
216
|
-
uv run pytest #
|
|
222
|
+
uv run pytest # 234 tests
|
|
217
223
|
uv run ruff check src/ tests/
|
|
218
224
|
```
|
|
219
225
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
|---------|--------------------|
|
|
7
|
+
| 0.2.x | ✅ Active development |
|
|
8
|
+
| < 0.2 | ❌ Not supported |
|
|
9
|
+
|
|
10
|
+
## Reporting a Vulnerability
|
|
11
|
+
|
|
12
|
+
If you discover a security vulnerability in petfishFramework:
|
|
13
|
+
|
|
14
|
+
1. **DO NOT** open a public GitHub issue.
|
|
15
|
+
2. Email **security@kylecui.dev** with:
|
|
16
|
+
- Description of the vulnerability
|
|
17
|
+
- Steps to reproduce
|
|
18
|
+
- Potential impact
|
|
19
|
+
- Suggested fix (if any)
|
|
20
|
+
3. You will receive an acknowledgment within **48 hours**.
|
|
21
|
+
4. We will investigate and provide a fix timeline within **7 days**.
|
|
22
|
+
|
|
23
|
+
## Security Features
|
|
24
|
+
|
|
25
|
+
petfishFramework provides runtime access control for AI agents:
|
|
26
|
+
|
|
27
|
+
- **6 DecisionEffects**: ALLOW, DENY, REQUIRE_APPROVAL, PARTIAL_ALLOW, MASK, DEGRADE
|
|
28
|
+
- **Fail-closed DEGRADE**: no fallback → block, never execute original
|
|
29
|
+
- **Input/Output/Event masking**: prevent sensitive data leakage at all layers
|
|
30
|
+
- **Budget enforcement**: hard token/cost/steps limits
|
|
31
|
+
- **Event-sourced audit**: every action recorded for compliance
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
**In scope**: Runtime permission bypass, tool execution without authorization,
|
|
36
|
+
audit log tampering, sensitive data leakage in events.
|
|
37
|
+
|
|
38
|
+
**Out of scope**: LLM model vulnerabilities, prompt injection (mitigated by
|
|
39
|
+
runtime controls but not eliminated), infrastructure security.
|
|
40
|
+
|
|
41
|
+
## Disclosure Timeline
|
|
42
|
+
|
|
43
|
+
- Day 0: Report received
|
|
44
|
+
- Day 1-2: Acknowledgment + initial assessment
|
|
45
|
+
- Day 3-7: Fix development
|
|
46
|
+
- Day 7-14: Fix release + public disclosure (after fix is available)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# petfishFramework API Reference
|
|
2
2
|
|
|
3
|
-
This document is the authoritative reference for the public API of `petfishFramework` v0.
|
|
3
|
+
This document is the authoritative reference for the public API of `petfishFramework` v0.2.2. Every signature, field, and example below is derived from the source code and from the tests that exercise it.
|
|
4
4
|
|
|
5
5
|
## 1. Overview
|
|
6
6
|
|
|
@@ -327,7 +327,7 @@ class Session:
|
|
|
327
327
|
|
|
328
328
|
`run` builds the `RuntimeEnvironment` and `RunContext`, emits `session.start`, executes the strategy, attaches accumulated `Usage` and `session_id`, and emits `session.end`.
|
|
329
329
|
|
|
330
|
-
`replay` accepts an optional `ReplayMode` argument. In v0.
|
|
330
|
+
`replay` accepts an optional `ReplayMode` argument. In v0.2.2 all modes return the stored event log; full deterministic replay via `RecordingEnvironment` and `ReplayEnvironment` is available in `petfishframework.reliability.replay`.
|
|
331
331
|
|
|
332
332
|
```python
|
|
333
333
|
agent = Agent(model=FakeModel(responses=(ModelResponse(content="ok"),)))
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Enterprise Expense Approval Demo
|
|
2
|
+
|
|
3
|
+
> Demonstrates ALL 6 DecisionEffects in a single enterprise scenario.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This demo shows petfishFramework as a **runtime control framework** — not a calculator framework. An enterprise expense approval agent processes reimbursement requests with full permission gating, budget enforcement, and audit reporting.
|
|
8
|
+
|
|
9
|
+
## Run
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
python examples/05_enterprise_expense.py
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
No API key required — uses FakeModel for deterministic, zero-cost execution.
|
|
16
|
+
|
|
17
|
+
## Scenarios
|
|
18
|
+
|
|
19
|
+
### 1. ALLOW + PARTIAL_ALLOW
|
|
20
|
+
|
|
21
|
+
**Scenario**: Employee submits $350 team lunch expense.
|
|
22
|
+
|
|
23
|
+
- `check_policy` tool executes (ALLOW)
|
|
24
|
+
- Only `amount` field passed to tool; `secret` field filtered (PARTIAL_ALLOW)
|
|
25
|
+
- Tool sees: `{"amount": 350}` — no sensitive data leaked
|
|
26
|
+
|
|
27
|
+
### 2. MASK
|
|
28
|
+
|
|
29
|
+
**Scenario**: Payment approval with recipient email.
|
|
30
|
+
|
|
31
|
+
- `approve_payment` has `side_effect=True` → blocked by REQUIRE_APPROVAL first
|
|
32
|
+
- When MASK policy is applied: `recipient` field masked in input args, tool result, and audit log
|
|
33
|
+
- Tool sees: `{"recipient": "[MASKED]", "amount": 300}`
|
|
34
|
+
|
|
35
|
+
### 3. REQUIRE_APPROVAL
|
|
36
|
+
|
|
37
|
+
**Scenario**: $2000 conference expense.
|
|
38
|
+
|
|
39
|
+
- `approve_payment` has `side_effect=True`
|
|
40
|
+
- Policy returns REQUIRE_APPROVAL before execution
|
|
41
|
+
- Tool does NOT execute — `approve_calls == 0`
|
|
42
|
+
- Event: `tool.approval_required`
|
|
43
|
+
|
|
44
|
+
### 4. DENY
|
|
45
|
+
|
|
46
|
+
**Scenario**: Non-finance user attempts to approve payment.
|
|
47
|
+
|
|
48
|
+
- Policy checks `subject.roles` for "finance"
|
|
49
|
+
- Non-finance user → DENY
|
|
50
|
+
- Tool does NOT execute
|
|
51
|
+
- Event: `tool.blocked`
|
|
52
|
+
|
|
53
|
+
### 5. DEGRADE with fallback
|
|
54
|
+
|
|
55
|
+
**Scenario**: $8000 equipment expense.
|
|
56
|
+
|
|
57
|
+
- Amount > $5000 → DEGRADE
|
|
58
|
+
- `fallback_tool="dry_run_payment"` → original tool NOT executed
|
|
59
|
+
- Fallback tool executes instead
|
|
60
|
+
- Event: `tool.degraded` with `original_executed=False, fallback_executed=True`
|
|
61
|
+
|
|
62
|
+
## AuditReport
|
|
63
|
+
|
|
64
|
+
After each scenario, an AuditReport is generated with:
|
|
65
|
+
|
|
66
|
+
- Summary (session ID, tokens, cost, steps)
|
|
67
|
+
- Event Count by Type
|
|
68
|
+
- Permission Summary (by effect)
|
|
69
|
+
- Budget (input/output tokens, cost)
|
|
70
|
+
- Timeline (tool events with duration)
|
|
71
|
+
- Masked Fields summary
|
|
72
|
+
- Permission Decisions
|
|
73
|
+
- Errors (if any)
|
|
74
|
+
- Final Output
|
|
75
|
+
|
|
76
|
+
## Policy Design
|
|
77
|
+
|
|
78
|
+
The `ExpensePolicy` uses tool metadata for decisions:
|
|
79
|
+
|
|
80
|
+
| Condition | Effect | Reason |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| Non-finance + approve_payment | DENY | role-based access control |
|
|
83
|
+
| Tool with side_effect=True | REQUIRE_APPROVAL | safety gate |
|
|
84
|
+
| Amount > $5000 | DEGRADE → dry-run | risk threshold |
|
|
85
|
+
| PII in args (recipient) | MASK | data protection |
|
|
86
|
+
| check_policy | PARTIAL_ALLOW (amount only) | least privilege |
|
|
87
|
+
| Otherwise | ALLOW | default |
|
|
88
|
+
|
|
89
|
+
## Files
|
|
90
|
+
|
|
91
|
+
- `examples/05_enterprise_expense.py` — runnable demo
|
|
92
|
+
- `tests/test_enterprise_demo.py` — TDD tests (6 tests)
|