mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 10:00:29 -05:00
sessions - AI customizations for selfhost (#299053)
* sessions - AI customizations for selfhost * more * Update .github/hooks/hooks.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update .github/skills/sessions/SKILL.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
2
.github/copilot-instructions.md
vendored
2
.github/copilot-instructions.md
vendored
@@ -24,6 +24,7 @@ Visual Studio Code is built with a layered architecture using TypeScript, web AP
|
||||
- `workbench/api/` - Extension host and VS Code API implementation
|
||||
- `src/vs/code/` - Electron main process specific implementation
|
||||
- `src/vs/server/` - Server specific implementation
|
||||
- `src/vs/sessions/` - Agent sessions window, a dedicated workbench layer for agentic workflows (sits alongside `vs/workbench`, may import from it but not vice versa)
|
||||
|
||||
The core architecture follows these principles:
|
||||
- **Layered architecture** - from `base`, `platform`, `editor`, to `workbench`
|
||||
@@ -135,6 +136,7 @@ function f(x: number, y: string): void { }
|
||||
- Prefer regex capture groups with names over numbered capture groups.
|
||||
- If you create any temporary new files, scripts, or helper files for iteration, clean up these files by removing them at the end of the task
|
||||
- Never duplicate imports. Always reuse existing imports if they are present.
|
||||
- When removing an import, do not leave behind blank lines where the import was. Ensure the surrounding code remains compact.
|
||||
- Do not use `any` or `unknown` as the type for variables, parameters, or return values unless absolutely necessary. If they need type annotations, they should have proper types or interfaces defined.
|
||||
- When adding file watching, prefer correlated file watchers (via fileService.createWatcher) to shared ones.
|
||||
- When adding tooltips to UI elements, prefer the use of IHoverService service.
|
||||
|
||||
3
.github/hooks/hooks.json
vendored
3
.github/hooks/hooks.json
vendored
@@ -4,7 +4,8 @@
|
||||
"sessionStart": [
|
||||
{
|
||||
"type": "command",
|
||||
"bash": "if [ -f ~/.vscode-worktree-setup ]; then nohup bash -c 'npm ci && npm run compile' > /tmp/worktree-setup-$(date +%Y-%m-%d_%H-%M-%S).log 2>&1 & fi"
|
||||
"bash": "if [ -f ~/.vscode-worktree-setup ]; then nohup bash -c 'npm ci && npm run compile' > /tmp/worktree-setup-$(date +%Y-%m-%d_%H-%M-%S).log 2>&1 & fi",
|
||||
"powershell": "if (Test-Path \"$env:USERPROFILE\\.vscode-worktree-setup\") { $log = \"$env:TEMP\\worktree-setup-$(Get-Date -Format 'yyyy-MM-dd_HH-mm-ss').log\"; $dir = $PWD.Path; Start-Job -ScriptBlock { param($d, $l) Set-Location $d; & { npm ci; if ($LASTEXITCODE -eq 0) { npm run compile } } *> $l } -ArgumentList $dir, $log | Out-Null }"
|
||||
}
|
||||
],
|
||||
"sessionEnd": [
|
||||
|
||||
18
.github/skills/agent-sessions-layout/SKILL.md
vendored
18
.github/skills/agent-sessions-layout/SKILL.md
vendored
@@ -45,7 +45,7 @@ When proposing or implementing changes, follow these rules from the spec:
|
||||
4. **New parts go in the right section** — Any new parts should be added to the horizontal branch alongside Chat Bar and Auxiliary Bar
|
||||
5. **Preserve no-op methods** — Unsupported features (zen mode, centered layout, etc.) should remain as no-ops, not throw errors
|
||||
6. **Handle pane composite lifecycle** — When hiding/showing parts, manage the associated pane composites
|
||||
7. **Use agent session parts** — New part functionality goes in the agent session part classes (`SidebarPart`, `AuxiliaryBarPart`, `PanelPart`, `ChatBarPart`), not the standard workbench parts
|
||||
7. **Use agent session parts** — New part functionality goes in the agent session part classes (`SidebarPart`, `AuxiliaryBarPart`, `PanelPart`, `ChatBarPart`, `ProjectBarPart`), not the standard workbench parts
|
||||
8. **Use separate storage keys** — Agent session parts use their own storage keys (prefixed with `workbench.agentsession.` or `workbench.chatbar.`) to avoid conflicts with regular workbench state
|
||||
9. **Use agent session menu IDs** — Actions should use `Menus.*` menu IDs (from `sessions/browser/menus.ts`), not shared `MenuId.*` constants
|
||||
|
||||
@@ -53,20 +53,24 @@ When proposing or implementing changes, follow these rules from the spec:
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `sessions/LAYOUT.md` | Authoritative specification |
|
||||
| `sessions/LAYOUT.md` | Authoritative layout specification |
|
||||
| `sessions/browser/workbench.ts` | Main layout implementation (`Workbench` class) |
|
||||
| `sessions/browser/menus.ts` | Agent sessions menu IDs (`Menus` export) |
|
||||
| `sessions/browser/layoutActions.ts` | Layout actions (toggle sidebar, panel, secondary sidebar) |
|
||||
| `sessions/browser/paneCompositePartService.ts` | `AgenticPaneCompositePartService` |
|
||||
| `sessions/browser/style.css` | Layout-specific styles |
|
||||
| `sessions/browser/parts/` | Agent session part implementations |
|
||||
| `sessions/browser/media/style.css` | Layout-specific styles |
|
||||
| `sessions/browser/parts/parts.ts` | `AgenticParts` enum |
|
||||
| `sessions/browser/parts/titlebarPart.ts` | Titlebar part, MainTitlebarPart, AuxiliaryTitlebarPart, TitleService |
|
||||
| `sessions/browser/parts/sidebarPart.ts` | Sidebar part (with footer) |
|
||||
| `sessions/browser/parts/sidebarPart.ts` | Sidebar part (with footer and macOS traffic light spacer) |
|
||||
| `sessions/browser/parts/chatBarPart.ts` | Chat Bar part |
|
||||
| `sessions/browser/widget/` | Agent sessions chat widget |
|
||||
| `sessions/browser/parts/auxiliaryBarPart.ts` | Auxiliary Bar part (with run script dropdown) |
|
||||
| `sessions/browser/parts/panelPart.ts` | Panel part |
|
||||
| `sessions/browser/parts/projectBarPart.ts` | Project Bar part (folder entries, icon customization) |
|
||||
| `sessions/contrib/configuration/browser/configuration.contribution.ts` | Sets `workbench.editor.useModal` to `'all'` for modal editor overlay |
|
||||
| `sessions/contrib/sessions/browser/sessionsTitleBarWidget.ts` | Title bar widget and session picker |
|
||||
| `sessions/contrib/chat/browser/runScriptAction.ts` | Run script contribution |
|
||||
| `sessions/contrib/chat/browser/runScriptAction.ts` | Run script split button for titlebar |
|
||||
| `sessions/contrib/accountMenu/browser/account.contribution.ts` | Account widget for sidebar footer |
|
||||
| `sessions/electron-browser/parts/titlebarPart.ts` | Desktop (Electron) titlebar part |
|
||||
|
||||
## 5. Testing Changes
|
||||
|
||||
|
||||
109
.github/skills/sessions/SKILL.md
vendored
109
.github/skills/sessions/SKILL.md
vendored
@@ -15,8 +15,6 @@ The `src/vs/sessions/` directory contains authoritative specification documents.
|
||||
| Layout spec | `src/vs/sessions/LAYOUT.md` | Grid structure, part positions, sizing, CSS classes, API reference |
|
||||
| AI Customizations | `src/vs/sessions/AI_CUSTOMIZATIONS.md` | AI customization editor and tree view design |
|
||||
| Chat Widget | `src/vs/sessions/browser/widget/AGENTS_CHAT_WIDGET.md` | Chat widget wrapper architecture, deferred session creation, option delivery |
|
||||
| AI Customization Mgmt | `src/vs/sessions/contrib/aiCustomizationManagement/browser/SPEC.md` | Management editor specification |
|
||||
| AI Customization Tree | `src/vs/sessions/contrib/aiCustomizationTreeView/browser/SPEC.md` | Tree view specification |
|
||||
|
||||
If you modify the implementation, you **must** update the corresponding spec to keep it in sync. Update the Revision History table at the bottom of `LAYOUT.md` with a dated entry.
|
||||
|
||||
@@ -62,44 +60,57 @@ src/vs/sessions/
|
||||
├── AI_CUSTOMIZATIONS.md # AI customization design document
|
||||
├── sessions.common.main.ts # Common (browser + desktop) entry point
|
||||
├── sessions.desktop.main.ts # Desktop entry point (imports all contributions)
|
||||
├── common/ # Shared types and context keys
|
||||
│ └── contextkeys.ts # ChatBar context keys
|
||||
├── common/ # Shared types, context keys, and theme
|
||||
│ ├── categories.ts # Command categories
|
||||
│ ├── contextkeys.ts # ChatBar and welcome context keys
|
||||
│ └── theme.ts # Theme contributions
|
||||
├── browser/ # Core workbench implementation
|
||||
│ ├── workbench.ts # Main Workbench class (implements IWorkbenchLayoutService)
|
||||
│ ├── menus.ts # Agent sessions menu IDs (Menus export)
|
||||
│ ├── layoutActions.ts # Layout toggle actions (sidebar, panel, auxiliary bar)
|
||||
│ ├── paneCompositePartService.ts # AgenticPaneCompositePartService
|
||||
│ ├── style.css # Layout-specific styles
|
||||
│ ├── widget/ # Agent sessions chat widget
|
||||
│ │ ├── AGENTS_CHAT_WIDGET.md # Chat widget architecture doc
|
||||
│ │ ├── agentSessionsChatWidget.ts # Main wrapper around ChatWidget
|
||||
│ │ ├── agentSessionsChatTargetConfig.ts # Observable target state
|
||||
│ │ ├── agentSessionsTargetPickerActionItem.ts # Target picker for input toolbar
|
||||
│ │ └── media/
|
||||
│ └── parts/ # Workbench part implementations
|
||||
│ ├── parts.ts # AgenticParts enum
|
||||
│ ├── titlebarPart.ts # Titlebar (3-section toolbar layout)
|
||||
│ ├── sidebarPart.ts # Sidebar (with footer for account widget)
|
||||
│ ├── chatBarPart.ts # Chat Bar (primary chat surface)
|
||||
│ ├── auxiliaryBarPart.ts # Auxiliary Bar (with run script dropdown)
|
||||
│ ├── panelPart.ts # Panel (terminal, output, etc.)
|
||||
│ ├── projectBarPart.ts # Project bar (folder entries)
|
||||
│ ├── agentSessionsChatInputPart.ts # Chat input part adapter
|
||||
│ ├── agentSessionsChatWelcomePart.ts # Welcome view (mascot + target buttons + pickers)
|
||||
│ └── media/ # Part CSS files
|
||||
│ │ └── AGENTS_CHAT_WIDGET.md # Chat widget architecture doc
|
||||
│ ├── parts/ # Workbench part implementations
|
||||
│ │ ├── parts.ts # AgenticParts enum
|
||||
│ │ ├── titlebarPart.ts # Titlebar (3-section toolbar layout)
|
||||
│ │ ├── sidebarPart.ts # Sidebar (with footer for account widget)
|
||||
│ │ ├── chatBarPart.ts # Chat Bar (primary chat surface)
|
||||
│ │ ├── auxiliaryBarPart.ts # Auxiliary Bar
|
||||
│ │ ├── panelPart.ts # Panel (terminal, output, etc.)
|
||||
│ │ ├── projectBarPart.ts # Project bar (folder entries)
|
||||
│ │ └── media/ # Part CSS files
|
||||
│ └── media/ # Layout-specific styles
|
||||
├── electron-browser/ # Desktop-specific entry points
|
||||
│ ├── sessions.main.ts # Desktop main bootstrap
|
||||
│ ├── sessions.ts # Electron process entry
|
||||
│ ├── sessions.html # Production HTML shell
|
||||
│ └── sessions-dev.html # Development HTML shell
|
||||
│ ├── sessions-dev.html # Development HTML shell
|
||||
│ ├── titleService.ts # Desktop title service override
|
||||
│ └── parts/
|
||||
│ └── titlebarPart.ts # Desktop titlebar part
|
||||
├── services/ # Service overrides
|
||||
│ ├── configuration/browser/ # Configuration service overrides
|
||||
│ └── workspace/browser/ # Workspace service overrides
|
||||
├── test/ # Unit tests
|
||||
│ └── browser/
|
||||
│ └── layoutActions.test.ts
|
||||
└── contrib/ # Feature contributions
|
||||
├── accountMenu/browser/ # Account widget for sidebar footer
|
||||
├── aiCustomizationManagement/browser/ # AI customization management editor
|
||||
├── agentFeedback/browser/ # Agent feedback attachments, overlays, hover
|
||||
├── aiCustomizationTreeView/browser/ # AI customization tree view sidebar
|
||||
├── applyToParentRepo/browser/ # Apply changes to parent repo
|
||||
├── changesView/browser/ # File changes view
|
||||
├── chat/browser/ # Chat actions (run script, branch, prompts)
|
||||
├── configuration/browser/ # Configuration overrides
|
||||
└── sessions/browser/ # Sessions view, title bar widget, active session service
|
||||
├── files/browser/ # File-related contributions
|
||||
├── fileTreeView/browser/ # File tree view (filesystem provider)
|
||||
├── gitSync/browser/ # Git sync contributions
|
||||
├── logs/browser/ # Log contributions
|
||||
├── sessions/browser/ # Sessions view, title bar widget, active session service
|
||||
├── terminal/browser/ # Terminal contributions
|
||||
├── welcome/browser/ # Welcome view contribution
|
||||
└── workspace/browser/ # Workspace contributions
|
||||
```
|
||||
|
||||
## 4. Layout
|
||||
@@ -165,18 +176,21 @@ The agent sessions window uses **its own menu IDs** defined in `browser/menus.ts
|
||||
|
||||
| Menu ID | Purpose |
|
||||
|---------|---------|
|
||||
| `Menus.TitleBarLeft` | Left toolbar (toggle sidebar) |
|
||||
| `Menus.TitleBarCenter` | Not used directly (see CommandCenter) |
|
||||
| `Menus.TitleBarRight` | Right toolbar (run script, open, toggle auxiliary bar) |
|
||||
| `Menus.ChatBarTitle` | Chat bar title actions |
|
||||
| `Menus.CommandCenter` | Center toolbar with session picker widget |
|
||||
| `Menus.TitleBarControlMenu` | Submenu intercepted to render `SessionsTitleBarWidget` |
|
||||
| `Menus.CommandCenterCenter` | Center section of command center |
|
||||
| `Menus.TitleBarContext` | Titlebar context menu |
|
||||
| `Menus.TitleBarLeftLayout` | Left layout toolbar |
|
||||
| `Menus.TitleBarSessionTitle` | Session title in titlebar |
|
||||
| `Menus.TitleBarSessionMenu` | Session menu in titlebar |
|
||||
| `Menus.TitleBarRightLayout` | Right layout toolbar |
|
||||
| `Menus.PanelTitle` | Panel title bar actions |
|
||||
| `Menus.SidebarTitle` | Sidebar title bar actions |
|
||||
| `Menus.SidebarFooter` | Sidebar footer (account widget) |
|
||||
| `Menus.SidebarCustomizations` | Sidebar customizations menu |
|
||||
| `Menus.AuxiliaryBarTitle` | Auxiliary bar title actions |
|
||||
| `Menus.AuxiliaryBarTitleLeft` | Auxiliary bar left title actions |
|
||||
| `Menus.OpenSubMenu` | "Open..." split button (Open Terminal, Open in VS Code) |
|
||||
| `Menus.ChatBarTitle` | Chat bar title actions |
|
||||
| `Menus.AgentFeedbackEditorContent` | Agent feedback editor content menu |
|
||||
|
||||
## 7. Context Keys
|
||||
|
||||
@@ -187,7 +201,7 @@ Defined in `common/contextkeys.ts`:
|
||||
| `activeChatBar` | `string` | ID of the active chat bar panel |
|
||||
| `chatBarFocus` | `boolean` | Whether chat bar has keyboard focus |
|
||||
| `chatBarVisible` | `boolean` | Whether chat bar is visible |
|
||||
|
||||
| `sessionsWelcomeVisible` | `boolean` | Whether the sessions welcome overlay is visible |
|
||||
## 8. Contributions
|
||||
|
||||
Feature contributions live under `contrib/<featureName>/browser/` and are registered via imports in `sessions.desktop.main.ts` (desktop) or `sessions.common.main.ts` (browser-compatible).
|
||||
@@ -199,13 +213,18 @@ Feature contributions live under `contrib/<featureName>/browser/` and are regist
|
||||
| **Sessions View** | `contrib/sessions/browser/` | Sessions list in sidebar, session picker, active session service |
|
||||
| **Title Bar Widget** | `contrib/sessions/browser/sessionsTitleBarWidget.ts` | Session picker in titlebar center |
|
||||
| **Account Widget** | `contrib/accountMenu/browser/` | Account button in sidebar footer |
|
||||
| **Run Script** | `contrib/chat/browser/runScriptAction.ts` | Run configured script in terminal |
|
||||
| **Branch Chat Session** | `contrib/chat/browser/branchChatSessionAction.ts` | Branch a chat session |
|
||||
| **Open in VS Code / Terminal** | `contrib/chat/browser/chat.contribution.ts` | Open worktree in VS Code or terminal |
|
||||
| **Prompts Service** | `contrib/chat/browser/promptsService.ts` | Agentic prompts service override |
|
||||
| **Chat Actions** | `contrib/chat/browser/` | Chat actions (run script, branch, prompts, customizations debug log) |
|
||||
| **Changes View** | `contrib/changesView/browser/` | File changes in auxiliary bar |
|
||||
| **AI Customization Editor** | `contrib/aiCustomizationManagement/browser/` | Management editor for prompts, hooks, MCP, etc. |
|
||||
| **Agent Feedback** | `contrib/agentFeedback/browser/` | Agent feedback attachments, editor overlays, hover |
|
||||
| **AI Customization Tree** | `contrib/aiCustomizationTreeView/browser/` | Sidebar tree for AI customizations |
|
||||
| **Apply to Parent Repo** | `contrib/applyToParentRepo/browser/` | Apply changes to parent repo |
|
||||
| **Files** | `contrib/files/browser/` | File-related contributions |
|
||||
| **File Tree View** | `contrib/fileTreeView/browser/` | File tree view (filesystem provider) |
|
||||
| **Git Sync** | `contrib/gitSync/browser/` | Git sync contributions |
|
||||
| **Logs** | `contrib/logs/browser/` | Log contributions |
|
||||
| **Terminal** | `contrib/terminal/browser/` | Terminal contributions |
|
||||
| **Welcome** | `contrib/welcome/browser/` | Welcome view contribution |
|
||||
| **Workspace** | `contrib/workspace/browser/` | Workspace contributions |
|
||||
| **Configuration** | `contrib/configuration/browser/` | Configuration overrides |
|
||||
|
||||
### 8.2 Service Overrides
|
||||
@@ -216,6 +235,10 @@ The agent sessions window registers its own implementations for:
|
||||
- `IPromptsService` → `AgenticPromptsService` (scopes prompt discovery to active session worktree)
|
||||
- `IActiveSessionService` → `ActiveSessionService` (tracks active session)
|
||||
|
||||
Service overrides also live under `services/`:
|
||||
- `services/configuration/browser/` - configuration service overrides
|
||||
- `services/workspace/browser/` - workspace service overrides
|
||||
|
||||
### 8.3 `WindowVisibility.Sessions`
|
||||
|
||||
Views and contributions that should only appear in the agent sessions window (not in regular VS Code) use `WindowVisibility.Sessions` in their registration.
|
||||
@@ -224,12 +247,14 @@ Views and contributions that should only appear in the agent sessions window (no
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `sessions.common.main.ts` | Common entry — imports browser-compatible services, workbench contributions |
|
||||
| `sessions.desktop.main.ts` | Desktop entry — imports desktop services, electron contributions, all `contrib/` modules |
|
||||
| `sessions.common.main.ts` | Common entry; imports browser-compatible services, workbench contributions |
|
||||
| `sessions.desktop.main.ts` | Desktop entry; imports desktop services, electron contributions, all `contrib/` modules |
|
||||
| `electron-browser/sessions.main.ts` | Desktop bootstrap |
|
||||
| `electron-browser/sessions.ts` | Electron process entry |
|
||||
| `electron-browser/sessions.html` | Production HTML shell |
|
||||
| `electron-browser/sessions-dev.html` | Development HTML shell |
|
||||
| `electron-browser/titleService.ts` | Desktop title service override |
|
||||
| `electron-browser/parts/titlebarPart.ts` | Desktop titlebar part |
|
||||
|
||||
## 10. Development Guidelines
|
||||
|
||||
@@ -243,7 +268,13 @@ Views and contributions that should only appear in the agent sessions window (no
|
||||
6. Use agent session part classes, not standard workbench parts
|
||||
7. Mark views with `WindowVisibility.Sessions` so they only appear in this window
|
||||
|
||||
### 10.2 Layout Changes
|
||||
### 10.2 Validating Changes
|
||||
|
||||
1. Run `npm run compile-check-ts-native` to run a repo-wide TypeScript compilation check (including `src/vs/sessions/`). This is a fast way to catch TypeScript errors introduced by your changes.
|
||||
2. Run `npm run valid-layers-check` to verify layering rules are not violated.
|
||||
3. Run tests under `src/vs/sessions/test/` to confirm nothing is broken.
|
||||
|
||||
### 10.3 Layout Changes
|
||||
|
||||
1. **Read `LAYOUT.md` first** — it's the authoritative spec
|
||||
2. Use the `agent-sessions-layout` skill for detailed implementation guidance
|
||||
|
||||
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@@ -225,8 +225,7 @@
|
||||
"windows": {
|
||||
"command": ".\\scripts\\code.bat"
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"inSessions": true
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Run Dev Sessions",
|
||||
@@ -238,7 +237,6 @@
|
||||
"args": [
|
||||
"--sessions"
|
||||
],
|
||||
"inSessions": true,
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user