Phase 2.1: CLI Core Agent Loop — Query → API → Tools → Repeat#359
Merged
Phase 2.1: CLI Core Agent Loop — Query → API → Tools → Repeat#359
Conversation
Build the core agent loop: Query input → API call → Tool execution → Response loop. - NDJSON streaming: Full event emission (status, thinking, text_delta, tool_call_start/end, tool_result, error, retry, context_compressed, turn_complete, session_start/end) - Error handling with retry logic: Exponential backoff with jitter for transient errors (rate limits, timeouts, network errors); non-transient errors fail immediately - Tool result processing: Tool calls detected, executed via registry, results re-injected into context for next LLM turn - Context window management: Auto-compression when utilization exceeds threshold, system message preservation, priority-based message retention - Continuous loop: Runs until no more tool calls or max iterations reached, with cancellation support - Fixed pre-existing bug in context_mgmt/compressor.ts (originalTokens not passed to sub-methods) - 33 comprehensive tests covering all acceptance criteria Closes #340
4 tasks
Member
Author
|
✅ Already implemented via sin-claude integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/opensin-sdk/src/agent_loop/ToolRegistry, results re-injected into context for next LLM turn — loop continues until no more tool callscontext_mgmt/compressor.tswhereoriginalTokenswas computed but never passed to sub-methodsArchitecture
Acceptance Criteria
Test Results
33 new tests covering: