feat(my-deepagent): v0.1.0 Step 0~5 — scaffolding through deepagent + OpenRouter
Python rewrite of the agent harness on top of deepagents 0.6.1 + langchain 1.x, replacing the abandoned TS attempt in packages/. 388 unit/integration tests pass. Steps ----- 0. Scaffolding — uv workspace, ruff/mypy/pre-commit/alembic, src/tests/docs trees with docs/schemas/ seeded from my-deepagent-seed/. 1. Core — config (pydantic-settings with MYDEEPAGENT_ env prefix and TOML source), enums (Backend, Capability, RiskLevel, ApprovalDecisionAction, ApprovalState, RunState, RunPhaseState, SessionState, ErrorClass), errors (MyDeepAgentError + BudgetExhaustedError with PEP-3134 cause + context suppression), hash (canonical JSON + sha256). 2. Persona/Workflow/Binding — pydantic v2 schemas with tuple-based deep immutability (post-construction hash drift prevented), YAML loaders, deterministic auto-select (preferred_backends → version → name → hash), override resolution with ineligibility diagnostics, PersonaConsentStore with fcntl.flock + tmp+fsync+rename atomic write. 3. Artifact schema registry — Draft202012Validator, multi-root resolution, structured ValidationFinding output. 4. Persistence — 18 SQLAlchemy 2.0 async ORM models with FK CASCADE/RESTRICT, WAL + busy_timeout + foreign_keys PRAGMA, alembic baseline + ux_active_run_repo_base partial unique index, LangGraph SqliteSaver as context manager only (lifecycle safety). 5. DeepAgent session — build_agent wires Persona → create_deep_agent with LocalShellBackend / FilesystemBackend / StateBackend / CompositeBackend, ChatOpenAI(base_url=openrouter) for openrouter: model strings, and 4 middleware classes (cost / audit-tool / safety-shell / fallback-model). Critical workarounds -------------------- - deepagents 0.6.1 rejects FilesystemPermission together with backends that implement SandboxBackendProtocol (LocalShellBackend). SafetyShellMiddleware enforces destructive-command and secret-path policy at the tool layer instead, and build_agent strips the permissions kwarg when the persona's deepagents_backend is local_shell. - FilesystemOperation in deepagents is Literal['read', 'write'] only; _map_operations collapses our richer schema (read/write/edit/ls) safely. Real OpenRouter smoke --------------------- test_openrouter_deepagents_local_shell_smoke calls DeepSeek via deepagents + LocalShellBackend + SafetyShellMiddleware end-to-end. PASS, ~$0.000001 cost, input=9 / output=1 tokens with content "OK". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
name: code-investigation
|
||||
version: 1
|
||||
description: "코드베이스 탐색 → 요약 보고서 생성. 구조 파악·의존성 분석·이슈 발굴."
|
||||
roles:
|
||||
- id: explorer
|
||||
required_capabilities:
|
||||
- evidence_check
|
||||
- code_review
|
||||
preferred_backends:
|
||||
- openrouter
|
||||
fallback_personas:
|
||||
- "openrouter-claude-code-reviewer@1"
|
||||
- "openrouter-deepseek-verifier@1"
|
||||
- id: summarizer
|
||||
required_capabilities:
|
||||
- evidence_check
|
||||
- final_report_compose
|
||||
preferred_backends:
|
||||
- openrouter
|
||||
fallback_personas:
|
||||
- "openrouter-claude-spec-writer@1"
|
||||
phases:
|
||||
- key: explore
|
||||
title: "코드베이스 탐색 및 정보 수집"
|
||||
risk: low
|
||||
role: explorer
|
||||
expected_artifact:
|
||||
path: artifacts/exploration.json
|
||||
schema: dev/spec@1
|
||||
gates: []
|
||||
timeout_seconds: 600
|
||||
instructions: |
|
||||
코드베이스를 체계적으로 탐색합니다.
|
||||
glob으로 전체 파일 구조를 파악하고 read_file로 핵심 파일을 읽습니다.
|
||||
grep으로 주요 패턴·의존성·진입점을 검색합니다.
|
||||
발견한 내용 (구조, 주요 컴포넌트, 의존성, 잠재적 이슈)을
|
||||
dev/spec@1 형식으로 artifacts/exploration.json에 write_file로 저장합니다.
|
||||
requirements 필드: 탐색 목적
|
||||
approach 필드: 탐색한 파일 목록 및 방법
|
||||
acceptance_criteria 필드: 발견한 핵심 사실들
|
||||
risks 필드: 발견한 잠재적 이슈들
|
||||
max_budget_usd: 0.50
|
||||
- key: summarize
|
||||
title: "탐색 결과 최종 보고서 작성"
|
||||
risk: low
|
||||
role: summarizer
|
||||
expected_artifact:
|
||||
path: artifacts/report.json
|
||||
schema: common/final-report@1
|
||||
gates:
|
||||
- report_approved
|
||||
timeout_seconds: 300
|
||||
instructions: |
|
||||
artifacts/exploration.json을 read_file로 읽고 common/final-report@1 형식으로
|
||||
최종 보고서를 작성합니다.
|
||||
status: "completed"
|
||||
phases: explore와 summarize 단계 정보
|
||||
findings: exploration.json의 risks 항목을 finding으로 변환
|
||||
artifacts: exploration.json 경로 포함
|
||||
보고서를 write_file로 artifacts/report.json에 저장합니다.
|
||||
max_budget_usd: 0.30
|
||||
default_gates: []
|
||||
max_total_budget_usd: 1.0
|
||||
Reference in New Issue
Block a user