Files
vscode/.github
52573ace04 sessions: expose session-management tools to Agent Host sessions (#325051)
* Expose session management tools to Agent Host sessions

Add list_sessions, get_current_session, create_session and create_chat
server tools, a deterministic 'Session/Chat Created' pill, and an
agent-host-session:// opener in the Agents window.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add delete_session server tool

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Polish Open Session pill UI: unpin from thinking group, muted sentence-case label, tighter icon padding

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Hide Open Session pill outside the Agents window

The agent-host-session:// opener and session services are only wired in the
Agents window, so the pill button is dead in the editor-window chat. Gate the
pill on the containing workbench root having the .agent-sessions-workbench
class, falling back to the normal tool-call row elsewhere.

Also route the spawn-depth _meta access through a validating reader
(readSessionSpawnDepth) in sessionState.ts, and include the create_chat model
param, depth-based recursion guard, and single-source server tool group
refactor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Encapsulate session spawn-depth _meta key in sessionState reader/writer

Remove the redundant SESSION_SPAWN_DEPTH_META_KEY re-definition in
agentService.ts; use the canonical SESSION_META_SPAWN_DEPTH_KEY via the
readSessionSpawnDepth reader and a new withSessionSpawnDepth writer, matching
the withSession* convention so the key stays in one place.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Inline single-use spawn-depth accessor helpers into the session tool accessor

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Show Open Session pill in editor-window chat with a working button

Remove the Agents-window-only gate on the create_session/create_chat pill so it
renders in the editor-window chat too. Add a workbench-side opener
(AgentHostOpenSessionLinkOpenerContribution) that resolves agent-host-session://
links to the ambient/local client session resource and opens them via
IChatWidgetService.openSession. Registered only from the workbench
electron-browser chat contribution (not loaded by the Agents window), so it does
not compete with the Agents-window opener.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Explain why sessionCreated suppresses generic tool result details

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add status/workspace/withChanges filters to list_sessions

Give list_sessions optional filter properties so an agent can narrow the result
to sessions needing input or running (status), sessions in a given folder
(workspace), or sessions with pending worktree changes (withChanges), instead of
always returning every session. Validated and covered by unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Enrich list_sessions output with meaningful session metadata

Surface the metadata fields list_sessions previously dropped: activity, project
name, unread flag, last-modified timestamp, git state (branch, base/upstream
branch, ahead/behind, uncommitted changes) and GitHub info (owner, repo, PR
url), each only when present. Also fix describeSessionStatus to match the
InputNeeded superset bits correctly so a plain InProgress no longer decodes as
inputNeeded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Expose more metadata-backed filters on list_sessions input

Add unread, withPullRequest, and includeArchived filter properties (alongside the
existing status/workspace/withChanges) so an agent can query for sessions with
unseen updates, sessions linked to a GitHub PR, or exclude archived sessions.
Backed by session metadata (isRead, GitHub PR url, isArchived/status). Covered by
unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* list_sessions: hide archived by default and allow querying by creation time

Flip includeArchived to default false so archived sessions (intentionally set
aside) are omitted unless explicitly requested. Add createdAfter/createdBefore
ISO-8601 range filters over a session's creation time, and surface createdAt in
the serialized output. Covered by unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Refer to sessions (not Agent Host sessions) in session tool descriptions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Collapse the created-session pill to a single 'Created session <pill>' line

The pill previously composed a ChatToolProgressSubPart row ('Created session')
plus a separate 'Session created' heading above the button, producing several
redundant lines. Render a single compact line instead: agent icon + past-tense
label ('Created session' / 'Created chat') + the open button. Drops the
progress subpart and heading card entirely.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Simplify created-session pill to a single icon+title button

Drop the redundant 'Created session' label from the pill (the model's summary
line above already describes it) and move the agent codicon inside the button.
Removes the now-unused heading field from IChatSessionCreatedData.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Use the conversation icon for create_chat pills

Select the pill icon by tool: create_chat now shows the conversation icon
(Codicon.commentDiscussion) while create_session keeps the agent icon. Threads
an isChat flag through IChatSessionCreatedData.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Make the create_chat pill open the specific chat, not just the session

create_chat now carries the new chat's id in the open link (as a ?chat= query),
and the Agents-window opener resolves it to the peer chat (whose resource fragment
is the chat id) and navigates via ISessionsService.openChat. Previously the link
only pointed at the owning session, so clicking it opened the default chat rather
than the newly created one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix Windows test: compare URI.path not platform-specific fsPath

The 'getCreateSessionArgs accepts an absolute filesystem path' test asserted
workspace.fsPath === '/Users/me/work/repo', which fails on Windows where fsPath
uses backslashes. Assert workspace.path (always forward-slash) instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR review: parse open link once; await executeTool directly

- buildSessionCreatedToolData: parse parseOpenSessionLinkUri once and reuse,
  dropping the redundant second call and the non-null assertion.
- claudeServerToolMcpServer: await host.executeTool directly instead of storing
  the pending promise and awaiting it in the result literal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-09 00:54:48 +00:00
..
2026-07-03 17:48:37 +02:00