Repository navigation
Conversation
Add an agent selector to the new-session composer. Picking a profile starts a top-level session with the profile's prompt, tools, model and thinking, reusing the isolated resources subagents already run with. - persist the profile in a pi-web:agent-profile custom entry so reopening the session restores it, and expose it on GET /api/sessions/[id] - POST /api/agent/new accepts agentProfile; a profile fixes the tools, so set_tools is refused and the tool preset control is hidden - extract resolveProfileActiveTools() shared with the subagent runtime - completion notifications stay on for these sessions (they have no parent)
This branch has not been deployed
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
Agent profiles could only run as subagents, dispatched by the default agent through the
Agenttool. There was no way to talk to a specialized agent directly: every conversation started as the default agent. This adds an Agent selector to the new-session composer. Picking a profile starts a top-level session that runs as that profile from its first message.It reuses what subagent sessions already do rather than adding a second mechanism.
startRpcSessionalready restores a persisted subagent's isolated resources (exact or appended prompt, fixed tools, skill/extension switches) from its resource snapshot; a profile session pins the same snapshot, without a parent.Server
POST /api/agent/newacceptsagentProfile. The profile is resolved withresolveSubagentProfile()(enabled profiles only, same precedence asAgent); an unknown or disabled name is refused.buildSubagentPromptPlan()), tools, model and thinking level. The snapshot is written to a newpi-web:agent-profilecustom entry once the profile's extension tools are resolved.readSubagentSessionResources()also reads that entry, so reopening the session restores the profile,set_toolsis refused ("fixed by its profile"), andnavigate_treekeeps the restored loadout, exactly as for subagents.readSubagentRun()ignores it, so the session is never filed under a parent.GET /api/sessions/[id]returnsagentProfile.resolveProfileActiveTools(), shared with the subagent runtime (no behavior change there).Client
components/AgentProfileSelector.tsx: a searchable dropdown (profile lists can be long), filtering on name, display name and description. It is editable only before the first message; afterwards it shows the session's profile read-only.ensure_session) to load commands. Changing the profile drops it; it was never persisted or listed. The nextensureNewSessionthen starts one with the chosen profile.en,zh-CN,zh-TW.Test plan
tsc --noEmit,npm run lint,npm run buildnpm test: 2285/2285 pass, including newlib/subagents.test.mjscases. They check that an agent-profile entry restores its resources and is not read as a subagent run, and that a malformed entry is ignored.ensure_sessionwithagentProfile→get_state.systemPromptcarries the profile's prompt;set_toolsis refused, and an unknown profile is rejected;pi-web:agent-profileentry, andGET /api/sessions/[id]returnsagentProfile;