Commit graph

52 commits

Author SHA1 Message Date
林 駿甫 (Shunsuke Hayashi)
9bf1b5e24c fix(core): address review findings F1-F4 + add 10 missing tests
F1: Add depth limit (max 5) to find_note_by_name and
    collect_obsidian_matches to prevent stack overflow on large vaults
F2: Fix bus_enqueue to use store_path parent instead of cwd
F3: Fix update_skill_md_from_patterns to preserve sections after
    the auto-generated marker instead of truncating them
F4: Fix extract_wikilinks to consume chars after | in [[Note|Display]]
    so subsequent links parse correctly

Tests added:
- extract_wikilinks: basic, display text, empty/broken
- find_note_by_name: depth limit enforcement
- resolve_wikilink: direct, nested, non-existent
- build_rejection_section: empty, sorted by count desc
- update_skill_md_from_patterns: append, replace preserving following sections

955 tests GREEN, clippy zero.

Closes #109

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:36:44 +09:00
林 駿甫 (Shunsuke Hayashi)
263adf87cd feat(protocol): expand Obsidian wikilinks in attach_context
When attaching Obsidian notes, extract [[wikilinks]] from the note
content and resolve them to actual vault files. Linked notes are
attached as "obsidian_wikilink" type, bounded by remaining_tokens.

Supports both [[Note]] and [[Note|Display]] syntax.

Closes #102

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:21:01 +09:00
林 駿甫 (Shunsuke Hayashi)
7976886bc5 test(core): add proptest property-based tests for lock and store
Adds proptest to dev-dependencies and 6 property-based tests:
- lock: acquire→release always clears, two tasks can't lock same file,
  wrong owner renew always fails
- store: CAS rejects stale version, upsert is idempotent,
  event replay is deterministic

945 tests all GREEN.

Closes #100

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:18:41 +09:00
林 駿甫 (Shunsuke Hayashi)
b058632481
Merge pull request #99 from Miyabi-G-K/feature/issue-96-theta-skill-update
feat(dream): θ6 auto-update SKILL.md from rejections
2026-04-10 10:16:25 +09:00
林 駿甫 (Shunsuke Hayashi)
2733aa9552
Merge pull request #94 from Miyabi-G-K/feature/issue-91-obsidian-utf8-fix
fix(protocol): handle non-UTF-8 in Obsidian vault
2026-04-10 10:16:01 +09:00
林 駿甫 (Shunsuke Hayashi)
5c1852f25e
Merge pull request #90 from Miyabi-G-K/feature/issue-89-depth1-attach
feat(protocol): attach depth-1 impact files
2026-04-10 10:15:54 +09:00
林 駿甫 (Shunsuke Hayashi)
9a6e98b8ab feat(dream): auto-update SKILL.md from gate rejection patterns
θ6 self-improving: When dream detects gate rejections, automatically
appends/refreshes a "Common Rejection Patterns" section in
polaris-ops/SKILL.md with gate names, counts, and remedies.

This closes the feedback loop: agents learn from their own mistakes
without human intervention.

Closes #96

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:13:40 +09:00
林 駿甫 (Shunsuke Hayashi)
6045f67647 fix(protocol): handle non-UTF-8 files in read_file_snippet
When reading Obsidian vault notes or source files, non-UTF-8 bytes
caused a hard error. Now gracefully breaks on invalid UTF-8 lines
and returns whatever was read so far.

Closes #91

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:07:45 +09:00
林 駿甫 (Shunsuke Hayashi)
5ac86dccad feat(protocol): attach GNI depth-1 impact files to context
When build_context_attachments runs, it now also includes files from
TaskImpact.depth1 as "impact_depth1" attachments. Files already
attached via locked_files are skipped to avoid duplication.

This improves context accuracy by giving agents visibility into
direct callers/importers that may be affected by their changes.

Closes #89

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:00:25 +09:00
林 駿甫 (Shunsuke Hayashi)
a470d60126 test(core): add comprehensive tests for lock.rs and store.rs
Day 1 improvement cycle: reinforce test coverage for deterministic
task protocol primitives.

lock.rs: +6 tests (acquire unknown task, wrong owner renew, release
noop, no-conflict check, multi-file lock/release, empty sweep)
store.rs: +6 tests (replay since_id, empty replay, upsert replace,
remove task, legacy file loading, lock release event rebuild,
lease_expiry calculation)

Closes #87

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 09:58:28 +09:00
林 駿甫 (Shunsuke Hayashi)
17ad33a96a [追加] Sprint 5: Issue自動作成 + git同期 + Telegram + Heartbeat + Obsidian検索 (#77-81) 2026-04-10 09:48:49 +09:00
林 駿甫 (Shunsuke Hayashi)
a965bd3b62 [追加] verify_merge + escape hatch (force_unlock, manual_complete) 2026-04-10 08:11:29 +09:00
林 駿甫 (Shunsuke Hayashi)
59be218b20 [整備] ライセンスを MIT → BSL 1.1 に変更
Licensor: 合同会社みやび (Miyabi G.K.)
非商用・教育目的のみ無料。商用利用は別途ライセンス。
4年後に Apache 2.0 に自動移行。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 07:50:40 +09:00
林 駿甫 (Shunsuke Hayashi)
70cd906776 [追加] ドリーミング: event log → 学び抽出 (#59) 2026-04-10 07:29:03 +09:00
林 駿甫 (Shunsuke Hayashi)
ec1d25887e [文書] Playbook v4: ビジョン全38要素をカバーする完全版
v3 から追加:
  Sprint 3: 記憶アタッチメント (#58) + ドリーミング (#59) + Web ダッシュボード (#63)
  Sprint 4: シータサイクル (#60) + Obsidian (#62)
  Sprint 2: Bus データパス統合 (#65) + ブランチ戦略 (#64)

新規 Issue:
  #64: 並列Codexブランチ戦略 (worktree + PR)
  #65: Bus データパス統合

ビジョン達成度推移:
  現在 32% → Sprint1後 38% → Sprint2後 47% → Sprint3後 72% → Sprint4後 93%

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 06:54:20 +09:00
林 駿甫 (Shunsuke Hayashi)
a1febb67eb [修正] GATE 0+5: Issue=0 拒否 + ブランチ名バリデーション (#52, #53) 2026-04-10 06:51:39 +09:00
林 駿甫 (Shunsuke Hayashi)
58c8bf71e1 [修正] exit code: GATE拒否=1, 入力エラー=2 に統一 (#56, #57) 2026-04-10 06:48:55 +09:00
林 駿甫 (Shunsuke Hayashi)
89d2ab3c12 [文書] DTP Playbook v3 完全版 — Sprint 1〜5 の全タスク網羅
Sprint 1 (今日): clippy修正 + Phase C + GNI確認
Sprint 2 (今週): OpenClawドッキング (JSON標準化/hooks/memory sync/サブエージェント)
Sprint 3 (来週): 運用基盤 (Heartbeat/git自動同期/Telegram/VOICEBOX/Maestro)
Sprint 4 (今月): 品質ゲート多層化 (rust-ai-pipeline/proptest/cargo-mutants)
Sprint 5 (来月): 移行+公開 (TS→Rust/OpenClawプラグイン/npm配布)

各Sprint: DAG依存/承認ゲート/ロールバックポイント定義済み

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 06:21:31 +09:00
林 駿甫 (Shunsuke Hayashi)
273c416344 feat: [日本語] DTP Phase B CLI 追加 2026-04-10 06:17:01 +09:00
林 駿甫 (Shunsuke Hayashi)
986d907e5b feat: [日本語] DTP Phase A 基盤追加 2026-04-10 01:35:17 +09:00
Shunsuke Hayashi
0e37360f8b feat: add OpenClaw integration module to miyabi-core
- Add openclaw.rs module for cluster communication
- Expand CLI with OpenClaw-related commands (264 lines)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 06:35:05 +09:00
Shunsuke Hayashi
c3c3400bb2 fix: Resolve clippy warnings in dag.rs and workflow.rs
- Replace ok_or_else with ok_or for non-lazy error construction
- Derive Default for StepCondition and FailurePolicy enums
- Allow clippy::only_used_in_recursion for visit_step method

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 01:46:46 +09:00
Shunsuke Hayashi
22672b2d65 test(config): Add comprehensive config module tests
Add 16 new tests for configuration functionality:
- Path/directory helpers (default_path, default_dir)
- API key retrieval methods
- Sub-config defaults (ApiConfig, UiConfig, SessionConfig, ToolConfig)
- Save/load operations and roundtrip
- Edge cases (invalid TOML, empty file, nested dirs)
- Debug and Clone trait implementations

Total miyabi-core tests: 387 (was 371)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 01:33:43 +09:00
Shunsuke Hayashi
810eb43128 test(retry): Add comprehensive retry module tests
Add 12 new tests for retry functionality:
- RetryConfig constructors (new, aggressive, conservative)
- calculate_delay exponential backoff and capping
- retry_with_backoff behavior (exhaustion, zero attempts, success/error)
- Config traits (Clone, Debug)

Total miyabi-core tests: 371 (was 359)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 01:04:05 +09:00
Shunsuke Hayashi
671b04e4f8 test(hooks): Add comprehensive hooks module tests
- Add 24 new tests for HookEvent, HookAction, Hook, HookContext
- Test HookManager registration, enable/disable, get_hooks
- Test HooksConfig save/load
- Test hook execution with Log, Notify actions
- Test conditional hook execution
- Test variable expansion in hook messages

Core tests: 359 passed (+24 new)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:56:37 +09:00
Shunsuke Hayashi
2b27a4a667 test(rules): Add comprehensive rules module tests
- Add 23 new tests for Rule, AgentPreferences, MiyabiRules
- Test validation logic (version, name, suggestion, severity)
- Test file matching and pattern matching
- Test RulesLoader file discovery and loading
- Test serialization and error handling

Core tests: 335 passed (+23 new)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:54:50 +09:00
Shunsuke Hayashi
f740f07c23 test: Add comprehensive cache and error_policy tests
Cache tests (18 new):
- Test CacheEntry creation and expiration
- Test TTLCache insert, remove, clear, stats
- Test custom TTL, concurrent access
- Test LLMCacheKey and ApiCacheKey creation
- Test cache factories and serialization

Error policy tests (18 new):
- Test FallbackStrategy variants and defaults
- Test CircuitState equality
- Test CircuitBreaker default, reset, counters
- Test circuit transitions and thresholds

Core tests: 312 passed (52 new this phase)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:45:42 +09:00
Shunsuke Hayashi
c84c9d6c25 test(mcp): Add comprehensive MCP integration tests
- Add 16 new tests for MCP server configuration, request/response handling
- Test McpServerConfig defaults and serialization
- Test McpConfig save/load and multiple servers
- Test McpRequest with params, McpResponse success/error
- Test McpError with data, McpTool deserialization
- Test McpManager creation and state checking

Core tests: 276 passed (16 new)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:43:16 +09:00
Shunsuke Hayashi
7738f10965 feat(streaming): Add real-time streaming support for Agent
- Add StreamingAgent with run_stream() and run_with_callback() methods
- Add AgentStreamEvent enum with 11 event types (Started, TextChunk, ToolDetected, etc.)
- Add StreamProcessor for handling API streaming events
- Add StreamingConfig for buffer_size and emit_chunks settings
- Add 10 comprehensive unit tests

Core tests: 260 passed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:40:03 +09:00
Shunsuke Hayashi
2ccf8267ac feat(orchestration): Add multi-agent orchestration module
- ParallelConfig for concurrency, timeout, fail-fast settings
- Orchestrator for parallel and sequential agent execution
- OrchestratorTask for task definition with optional system prompts
- ParallelResult with success tracking and metrics
- TaskResult for individual execution results

Features:
- Semaphore-based concurrency control
- Timeout per task execution
- Success rate and total token tracking
- Helper function for quick orchestrator creation

Total: 752 tests passing (9 new orchestration tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:34:44 +09:00
Shunsuke Hayashi
f6215765b3 test(session): Add comprehensive session tests
- Test session creation with custom ID
- Test system prompt builder pattern
- Test tags management
- Test preview truncation and empty preview
- Test storage default directory
- Test storage exists/load/delete operations
- Test metadata conversion and preview
- Test timestamp updates

Total: 23 session tests (13 new)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:31:37 +09:00
Shunsuke Hayashi
364dfd9da3 test: Add comprehensive Workflow and DAG tests
Workflow tests (14 new tests):
- Test StepCondition, RetryConfig, FailurePolicy defaults
- Test StepStatus and WorkflowStatus equality
- Test WorkflowContext with variables and results
- Test StepResult and WorkflowResult creation
- Test Workflow with output variables
- Test step and failure policy variants

DAG tests (23 new tests):
- Test TaskId creation and display
- Test Task with priority and estimated time
- Test TaskNode operations (add/remove dependencies)
- Test TaskLevel creation and management
- Test TaskGraph operations (count, parallelism, levels)
- Test TaskGraphBuilder with priority
- Test DAGError variants
- Test complex parallel graphs

Total: 730 tests passing (228 core, 498 TUI, 4 CLI)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:28:39 +09:00
Shunsuke Hayashi
5cfd656dbc test(agent): Add comprehensive agent integration tests
- Add approval_integration_tests module with 10 tests
- Add executor_registry_tests module with 5 tests
- Add agent_event_tests module with 2 tests
- Test ApprovalCallback implementations (AutoApproveAll, RejectHighRisk)
- Test ChannelApprover async communication
- Test RiskLevel ordering and approval requirements
- Test ExecutorRegistry tool registration and risk levels

Total: 17 new tests, all passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:24:40 +09:00
Shunsuke Hayashi
6ac4d539d4 feat(dag): Add DAG-based task graph for parallel execution
- Add TaskGraph with topological sort using Kahn's algorithm
- Add TaskLevel for grouping independent tasks for parallel execution
- Add TaskGraphBuilder for fluent API construction
- Support dependency tracking and cycle detection
- Include 7 comprehensive tests

Ported and simplified from miyabi-private/miyabi-dag.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:20:16 +09:00
Shunsuke Hayashi
5935dae7dd feat(agent): Add approval callback system for tool execution
- Add ApprovalCallback trait with ApprovalDecision (Approved, Rejected, ModifyInput)
- Implement AutoApproveAll, RejectHighRisk, and ChannelApprover callbacks
- Integrate approval callback into Agent execution loop
- Support interactive approval via channel-based communication
- Include comprehensive tests for all approval scenarios

All 167 tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:16:55 +09:00
Shunsuke Hayashi
57820166f9 feat: Add MCP and GitHub Tools integration to ExecutorRegistry
MCP Integration:
- Add McpToolExecutor for executing MCP server tools
- Add register_mcp_tools method to ExecutorRegistry
- Dynamic tool registration from MCP servers
- Async mutex for thread-safe MCP manager access

GitHub Tools Integration:
- Add register_github_tools method to ExecutorRegistry
- Register 7 GitHub tools with appropriate risk levels:
  - Low: ListIssues, GetIssue, ListPullRequests
  - Medium: CreateIssue, AddComment, AddLabels, CreatePullRequest

All 662 tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 00:04:05 +09:00
Shunsuke Hayashi
f64faa6f09 feat: Integrate Hooks and Workflow with Agent execution
Hooks Integration:
- Add HookManager field to Agent struct
- Load hooks from HooksConfig on Agent creation
- Execute SessionStart hook at agent start
- Execute PreTool/PostTool hooks around tool execution
- Execute OnError hook on tool failures
- Execute SessionEnd hook on completion

Workflow Integration:
- Add execute_with_agent method to WorkflowManager
- Create Agent instance for each workflow step
- Execute actual tasks instead of placeholders
- Proper error handling and result tracking

All 662 tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:59:59 +09:00
Shunsuke Hayashi
48dfa915c7 feat: Add hooks, workflow, MCP support and core modules
Phase 2: Hooks System
- Event-driven execution with HookEvent/HookAction types
- HookManager for registration and execution

Phase 3: Multi-Agent Workflow
- Workflow orchestration with dependency graphs
- WorkflowStep with conditions and retry support

Phase 4: MCP (Model Context Protocol) Support
- McpServer for external tool servers
- McpManager for multiple server management

Also includes core modules: cache, error_policy, feature_flags,
git, logger, plugin, retry, rules

662 tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:37:14 +09:00
Shunsuke Hayashi
3f6fbeb498 feat: Add GitHub API integration and tools
Phase 1 of feature extensions.

- Add GitHubClient for GitHub API interactions
- Add GitHub tools for agent execution:
  - github_list_issues: List repository issues
  - github_get_issue: Get issue details
  - github_create_issue: Create new issues
  - github_add_comment: Comment on issues/PRs
  - github_list_prs: List pull requests
  - github_create_pr: Create pull requests
  - github_add_labels: Add labels to issues
- Support for GITHUB_TOKEN and GITHUB_REPOSITORY env vars
- Create tool registry for GitHub operations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:26:40 +09:00
Shunsuke Hayashi
25d358f96e feat: Add config system, agent mode, and session management
- Add comprehensive Config system with TOML support (~/.miyabi/config.toml)
- Add Agent module for autonomous task execution with tool approval
- Add Session management for conversation persistence
- Extend CLI with new commands: init, sessions, agent, version
- Add CLI flags: --model, --max-tokens, --thinking, --config, --session
- Fix all clippy warnings (16 → 0)
- Improve code quality with collapsible pattern matching

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:22:11 +09:00
Shunsuke Hayashi
e0207e8649 feat: Add comprehensive test coverage and fix tests
Sprint 9-10 changes:
- Add 42 tests for help.rs (HelpViewer, CheatSheet, QuickRef)
- Add 55 tests for resume_picker.rs (SessionEntry, ResumePicker, SessionManager)
- Add 73 tests for ui.rs (colors, styles, layout, Modal, Toast, Breadcrumb, etc.)
- Fix markdown_stream tests (proper markdown paragraph separation)
- Add help.rs and ui.rs modules to miyabi-tui

Total: 585 tests passing across all crates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 19:24:05 +09:00
Shunsuke Hayashi
62d312796a feat(core): add tool result formatting methods
- Add ToolOutput formatting methods:
  - format_display(): Format output for display
  - summary(max_len): Truncated summary with ...
  - as_text(): Extract text from common fields
  - format_duration(): Human-readable duration (ms/s)
  - status_indicator(): ✓/✗ indicator
  - has_error_code(): Check for non-zero exit code

- Handle different content types (string, object, array)
- Pretty print JSON objects and arrays
- Add 10 comprehensive tests for formatting

Closes #28

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:31:42 +09:00
Shunsuke Hayashi
84f57e1431 feat(core): add configurable RetryConfig for API requests
- Add RetryConfig struct with configurable:
  - max_retries, base_delay_ms, max_delay_ms
  - retry_on_network_error, retry_on_rate_limit
  - Builder pattern methods

- Add delay_for_attempt() for exponential backoff
- Export RetryConfig from lib.rs
- Add 7 tests for retry configuration
  - Default values, builder, no retries
  - Delay calculation with exponential backoff
  - Delay capping at max
  - Error types validation
  - Tool definition serialization

Closes #23

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:29:54 +09:00
Shunsuke Hayashi
c82ad45b36 feat(core): implement Glob and Grep search tools
- Add GlobTool for finding files matching glob patterns
  - Supports ** recursive patterns
  - Configurable max results (default 1000)
  - Base directory support

- Add GrepTool for searching file contents with regex
  - Regex pattern matching
  - Case insensitive option
  - File glob filtering
  - Directory recursive search
  - Max matches limit (default 100)

- Add glob and regex dependencies to workspace
- Export GlobTool and GrepTool from lib.rs
- Update create_file_tool_registry (5 tools)
- Update create_standard_tool_registry (6 tools)
- Add 7 tests for Glob and Grep tools

Closes #27

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:25:00 +09:00
Shunsuke Hayashi
d6ac8c8273 feat(core): add comprehensive tool definition tests
- Export anthropic::Tool as ApiTool for API tool definitions
- Add 6 comprehensive tests for tool schema validation:
  - test_tool_schema_format: JSON Schema format validation
  - test_tool_schema_required_params: required/optional param handling
  - test_to_anthropic_tools: Anthropic API format conversion
  - test_registry_schemas: ToolRegistry::schemas() method
  - test_standard_registry_has_all_tools: all 4 tools registered
  - test_tool_default_values_in_schema: default value handling

Closes #22

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:20:39 +09:00
Shunsuke Hayashi
554b2f7f99 feat(core): implement Bash tool with sandboxing
- Add BashTool struct with timeout, working directory, and output truncation
- Implement dangerous command checking (rm -rf /, format, mkfs, etc.)
- Add tokio::select! for timeout handling
- Add create_standard_tool_registry() including BashTool
- Export BashTool and create_standard_tool_registry from lib.rs
- Add 5 tests for bash functionality

Closes #26

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:17:45 +09:00
Shunsuke Hayashi
277d0e4858 feat(core): implement token counting and context window management
Add token.rs with:
- TokenCounter for estimating token usage
- ModelLimits for Claude model configurations
- ContextManager for automatic context pruning
- TokenUsage and ContextUsage statistics
- Support for 200k context window
- Automatic oldest message pruning
- 10 unit tests

Closes #21

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:13:44 +09:00
Shunsuke Hayashi
29d1335c7e feat(core): implement file operation tools (Read, Write, Edit)
Add tools.rs with:
- ReadTool - Read files with offset/limit, line numbers
- WriteTool - Write files with auto directory creation
- EditTool - Replace text with replace_all option
- Security checks for path traversal
- Base directory configuration
- create_file_tool_registry() helper
- 10 unit tests with tempfile

Closes #25

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:07:51 +09:00
Shunsuke Hayashi
5aae11a0cb feat(core): implement conversation state and message history
Add conversation.rs with:
- Conversation struct with full state management
- ConversationMessage with timestamps and metadata
- ConversationMetadata (title, tags, model, tokens)
- ConversationManager for handling multiple conversations
- System prompt support
- Serialization/deserialization for persistence
- Truncate and clear functionality
- File save/load operations
- 14 unit tests

Closes #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:05:28 +09:00
Shunsuke Hayashi
4440302e3b feat(core): implement Tool trait and registry system
Add tool.rs with complete tool abstraction:
- Tool trait with async_trait for tool definitions
- ToolRegistry for managing and executing tools
- ParameterDef for declarative parameter schemas
- Automatic JSON schema generation
- Input validation before execution
- Integration with Anthropic tool format
- ToolOutput for structured results
- Comprehensive error types (NotFound, ValidationError, etc.)
- 12 unit tests covering registration, lookup, execution

Dependencies added: async-trait

Closes #24

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 17:58:31 +09:00