-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(daemon): refactor session init endpoints #6252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
to simplify the diff on this one only adds the new endpoints and uses them in a followup pr for #6251 will cleanup unused methods |
7fab58e to
6c5a99d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors session initialization endpoints to provide cleaner separation of concerns and consolidate extension loading. It introduces three new REST endpoints (POST /sessions, POST /sessions/{id}/open, POST /sessions/{id}/extensions) and replaces the old startAgent/resumeAgent paradigm with createSession/openSession. The refactor also extracts extension loading logic into a shared utility that handles progressive loading with toast notifications, ensuring consistent behavior whether creating a new session or switching to an existing one.
Key changes:
- New session lifecycle endpoints with proper separation between creating and opening sessions
- Consolidated extension loading logic now shared between new windows and session history switching
- Backend
setup_agent_for_sessionhelper centralizes provider/model/recipe setup for both create and open flows
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
ui/desktop/src/utils/extensionUtils.ts |
New shared utility for progressive extension loading with toast notifications |
ui/desktop/src/hooks/useChatStream.ts |
Updated to use openSession endpoint; removed legacy updateFromSession call |
ui/desktop/src/hooks/useAgent.ts |
Refactored to use createSession/openSession APIs instead of startAgent/resumeAgent |
ui/desktop/src/components/BaseChat.tsx |
Added onSessionLoaded callback to trigger extension loading when switching sessions |
ui/desktop/src/api/types.gen.ts |
Generated TypeScript types for new API request/response schemas |
ui/desktop/src/api/sdk.gen.ts |
Generated SDK client functions for new endpoints |
ui/desktop/openapi.json |
OpenAPI schema definitions for new session management endpoints |
crates/goose-server/src/routes/session.rs |
Implemented create_session, open_session, and add_session_extension endpoints with shared setup_agent_for_session helper |
crates/goose-server/src/openapi.rs |
Registered new endpoint handlers and request/response types in OpenAPI schema |
d1a07c3 to
e6cee25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
add new API endpoints for session lifecycle management:
- POST /sessions/create: Create and initialize a new session with provider,
model, recipe, and extensions in a single call
- POST /sessions/{id}/open: Open an existing session and setup agent
- POST /sessions/{id}/extensions: Add extensions to an active session
Consolidates both new window and load from history to use the same extension
management and show the toast in both cases
e6cee25 to
83e2db6
Compare
|
|
||
| const MAX_NAME_LENGTH: usize = 200; | ||
|
|
||
| async fn setup_agent_for_session( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we move this to routes/agents.rs and then hook it up to agent/start and agent/resume you get the same effect, but less duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes agree! it's on the next pr #6260
|
yep this looks ok to me - I like it so far. Doesn't break anything yet! over to you @DOsinga |
add new API endpoints for session lifecycle management:
Consolidates both new window and load from history to use the same extension management and show the toast in both cases
Part 1 of #6251
Screen.Recording.2025-12-23.at.10.26.29.AM.mov