Implement chat compaction API and separate resume endpoints - #30
Merged
Conversation
- Add `POST /compact` endpoint to summarize conversation history - Implement compaction service with LLM-based summary merging logic - Add request and response validation schemas (`CompactRequest`, `CompactResponse`) - Create integration tests for schema validation and message ordering
…validation
Replace generic /stream/resume endpoint with type-specific endpoints for permission and clarification responses. Emit dedicated event types (permission.required, clarification.required) instead of generic input.required.
Breaking Changes:
- Remove /generate/{thread_id}/stream/resume endpoint
- Remove input.required event type
- Remove ResumeRequest schema
New Endpoints:
- POST /generate/{thread_id}/resume/permission
- Validates request_id matches pending permission request
- Returns 409 on request_id mismatch (prevents race conditions)
- Accepts: decision (allow|deny), request_id, llm
- POST /generate/{thread_id}/resume/clarification
- No request_id required (low-risk, simpler API)
- Accepts: answer (string), llm
New Event Types:
- permission.required: Emits request_id, command, cmd_type, message, source
- clarification.required: Emits question, source
Benefits:
- Type safety: Explicit Literal["allow", "deny"] for permissions
- Race condition prevention: request_id validation ensures correct question answered
- Clear API contracts: Separate endpoints for different interrupt types
- Better error messages: 409 Conflict with specific validation failures
- Extensible: Easy to add new interrupt types (confirmation.required, choice.required)
- Add `reasoning_effort` configuration to `LLMConfig` to control thinking budget - Introduce `assistant.thinking` event type to stream reasoning text - Emit thinking events in Planner, Generator, and Analyzer nodes - Centralize raw response unwrapping and retry handling in LLM resilience wrapper - Update unit and integration tests to support async execution and verify thinking events
- Refactor `writer_node` to support a two-phase state machine: Phase 1 emits the generated YAML draft event (`yaml.draft`) for preview and prompts for write permission, pausing the graph. Phase 2 checks the user's decision (writes to disk on allow; routes to planner on deny). - Update the supervisor node conditional routing to direct draft completions to `writer_node` instead of terminating. - Update the planner node to detect when a draft is rejected (`write_rejected`), prompting the user for clarification on what to change. - Centralize `permission_answer_for_request` logic inside tools permission protocol module. - Add comprehensive unit tests covering the two-phase writer flow (draft preview, approval write, denial replan).
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.
No description provided.