Extract agent session management, run-manager, and usage stats to @studio/common#3987
Open
youknowriad wants to merge 4 commits into
Open
Extract agent session management, run-manager, and usage stats to @studio/common#3987youknowriad wants to merge 4 commits into
youknowriad wants to merge 4 commits into
Conversation
…udio/common Moves session listing/creation (manage), the agent run lifecycle (run-manager), site placement (placement), Studio Code usage stats (agent-stats + app-bump-stats), and a Sentry reporting helper (error-reporting) into transport-agnostic @studio/common modules. Desktop's ai-agent/run-manager, ai-session-placement, bump-stats, and the session IPC handlers now delegate to them. Adds @sentry/core + atomically to tools/common. No behavior change; this is the shared backend the studio ui local server will reuse. Part of splitting #3953. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
📊 Performance Test ResultsComparing 78783f2 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
…ents Deletes the desktop src/lib/ai-session-placement re-export and points its importers at @studio/common/ai/sessions/placement directly; trims the app-bump-stats header to its behavioral notes and fixes a stale recordAgentSend comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- run-manager routing: key the desktop binding by the unique runId (carried on both RunManagerOutput kinds) instead of sessionId, fixing two races where an interrupt-then-restart or a rejected concurrent start on the same session silenced a run's events. - agent-stats: report weekly/monthly unique-stat bump failures to Sentry via the shared captureException instead of swallowing them (matches the app-wide convention); make getPlatformMetric module-private. - bump-stats: lastBumpStatsProvider is now module-private with an accurate comment (the shared agent stats use appBumpStatsProvider, not this). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Proposed Changes
Behavior-preserving refactor. Moves the agent-session backend into transport-agnostic modules under
@studio/commonso the desktop app and the upcomingstudio uilocal web server share one implementation:ai/sessions/manage— session listing + creation (hydrated with star/archive + site placement)ai/sessions/run-manager— the agent run lifecycle (fork CLI, relay events, interrupt policy)ai/sessions/placement— which local site a session owns (app.json)ai/sessions/agent-stats+lib/app-bump-stats— Studio Code usage statslib/error-reporting— SDK-agnostic Sentry reporting helperThe desktop side now delegates:
ai-agent/run-manager,ai-session-placement,bump-stats, and the session IPC handlers. Adds@sentry/core+atomicallytotools/common. No user-facing change.Independent of the site-operations PR; based on
trunk. Part of splitting thestudio uiproof-of-concept (#3953).Testing Instructions
npm run typecheckclean fortools/common,apps/studio,apps/cli.npm test -- tools/common/ai/sessions/tests/(17 tests pass).Pre-merge Checklist