* Small ChatModel optimizations
Identified by copilot
1. Lazy _responseRepr — Changed from eagerly rebuilt on every streaming token to computed on demand in toString(). This avoids running the expensive partsToRepr() (which iterates all parts and builds strings) on every incoming token during streaming. It's only computed when actually needed (copy, accessibility, telemetry, history).
2. Lazy _markdownContent — Same pattern: computed on demand in getMarkdown(). During streaming, getMarkdown() is called via countWords() in the view model, but crucially the string is only built once per invalidation cycle rather than eagerly on every updateContent call. If multiple parts are updated before getMarkdown() is accessed, only one computation happens.
3. _invalidateRepr() — New method that simply sets both cached strings to undefined, replacing the old _updateRepr() which did the expensive computation.
4. Response._contentChanged(quiet?) — Replaces the old _updateRepr(quiet?) override. Calls _invalidateRepr() and fires the change event when not quiet. The citation append logic moved into a computeRepr() override so it's part of the lazy computation.
* Fix leak on LabelWithHighlights
* Fix leak in chat thinking part. The titleDetailPart is just for consistency
* More optimizations
* Enhance image handling in chat attachments
- Introduced coerceImageBuffer function to standardize image data handling.
- Updated ImageAttachmentWidget to utilize coerced image data for carousel display.
- Enhanced collectCarouselSections to merge request and response images.
- Added extractImagesFromChatRequest function for extracting user-attached images.
- Expanded test coverage for image extraction and carousel section collection.
* resolve comments.
* Refine image extraction details in AGENTS.md for clarity and accuracy
---------
Co-authored-by: Justin Chen <54879025+justschen@users.noreply.github.com>
Fixes#301677
We need to pass the cancellation token as the last param for main thread <-> ext host or else it doesn't get revived, so any callers checking it would fail
* Fix delete action visibility for read-only customizations
- Add context key overlays (type, storage, URI) when rendering list
items and context menus so when-clauses are properly evaluated
- Add when-clause to delete menu items: hide for extension, plugin,
and built-in storage types
- Update delete action handler to also block BUILTIN_STORAGE items
- Move item context key constants to shared aiCustomizationManagement.ts
- Fixes Run Prompt and Reveal in OS actions that were also broken
because the context keys were never set on the scoped service
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix delete failing when telemetry throws and trash is unsupported
Two issues caused the delete action to silently fail:
1. The telemetry call (publicLog2) was throwing an exception that
propagated uncaught, preventing the fileService.del() call from
ever executing. Wrap telemetry in try/catch so it cannot block
deletion.
2. fileService.del() was called with useTrash: true unconditionally,
but some file system providers don't support trash, causing an
error. Check hasCapability() before choosing useTrash.
Fixes both the management editor and sessions tree view delete actions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Implement image carousel service and integrate with chat attachments
- Introduced `ChatImageCarouselService` to manage image carousels in chat.
- Updated `ImageAttachmentWidget` to utilize the new carousel service for image display.
- Enhanced image extraction logic to support inline references and tool invocations.
- Added tests for carousel service functionality and image extraction.
What's missing is pills rendered in other places like `pastTenseMessage` and `invocationMessage`... maybe more?
* Support past tense & invocation message
* feedback
* feat: add prompt for adding a run action to the current session
* feat: enhance run script action with Copilot assistance option
* feat: update Copilot prompt handling in run script action
* feat: update accessibility options and placeholder types in monaco editor
* feat: rename Copilot action label and description for clarity
* feat: add generate new action option via Copilot in run script action
* Fix 'Generate New Action...' on new session page
On the new session page, chatService.sendRequest() cannot be used because
the chat session hasn't been initialized yet. Detect isUntitled sessions and
route through NewChatViewPane.sendQuery() instead, which sets the editor
value and triggers the normal _send() flow (including slash command expansion).
Also adds prefillInput/sendQuery public methods to NewChatWidget and
NewChatViewPane, and injects IViewsService into RunScriptContribution.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename slash command to /generate-run-commands and improve prompt
- Rename add-run-action.prompt.md → generate-run-commands.prompt.md
- Update runScriptAction.ts to send /generate-run-commands
- Rewrite prompt with:
- Two task schema fields: inSessions (required) and
runOptions.runOn: worktreeCreated (optional, for setup commands)
- Smart inference: reads project files to determine commands;
only asks the user if ambiguous
- Modify mode: if run commands already exist, treat as an update
- Merge-safe: always preserves existing tasks.json entries
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* tidy
* Clear editor after successful send on new session page
After sendRequestForNewSession completes successfully, clear the editor
value so it doesn't persist when the user navigates back to a new session.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix prompt not activating: use chatWidget.acceptInput() for active sessions
chatService.sendRequest() bypasses the chat widget's prompt file resolution
logic (_applyPromptFileIfSet). Use IChatWidgetService.getWidgetBySessionResource()
and call acceptInput('/generate-run-commands') instead, which goes through
the full input pipeline including slash command parsing and prompt file
attachment.
Also removes now-unused IChatService and ChatAgentLocation imports.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add new prompt for adding run actions
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* tidy
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* sessions: add built-in skills infrastructure
Add a 'built-in skills' concept mirroring the existing 'built-in prompts'
pattern, so that skills bundled with the Sessions app are always available.
- Create src/vs/sessions/skills/ directory for bundled SKILL.md files
- Bundle vs/sessions/skills/**/SKILL.md in build config
- AgenticPromptsService: discover and parse built-in skills from the
bundled directory, override findAgentSkills() to merge them at lowest
priority (user/workspace skills override by name), extend listPromptFiles
and listPromptFilesForStorage for skill type
- Tree view: handle BUILTIN_STORAGE group for skills category
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: add built-in 'update-skills' skill
First built-in skill that guides the agent to capture major repository
learnings by creating or updating skills and instructions. Triggered
when the user says 'learn!' or when significant reusable knowledge is
discovered during a session.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: support edit-and-save-to-override for built-in skills
Extend the built-in prompt save-to-override flow to also work for
built-in skills. When editing a built-in skill, users can save it to
workspace or user location, which overrides the built-in version.
- Gate the in-memory editing session on both prompt and skill types
- Resolve save target directories using the actual prompt type
- Preserve skill directory structure ({name}/SKILL.md) when saving
- Generalize UI labels from 'prompt override' to 'override'
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: address PR review feedback for built-in skills
- Sanitize built-in skill name/description (strip XML tags, truncate)
to match the same safety applied to other skill sources
- Fix JSDoc: all sources override built-ins, not just user/workspace
- Remove unnecessary 'as unknown as PromptsStorage' cast in tree view
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* sessions: refine editor options types for accessibility and font settings
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Updates js-debug extension from version 1.110.0 to 1.112.0
- Updates corresponding sha256 hash for verification
(Commit message generated by Copilot)
* feat: auto-select single source folder in prompt selection
* Show directory picker when creating customizations with multiple source folders
When the Sessions app creates a new customization (agent, skill,
instructions, prompt), the target directory was always auto-resolved
to the first default location (e.g., .github/agents). This ignored
that the system may be reading from multiple directories (e.g.,
.github/agents and .claude/agents).
Now, if multiple source folders exist for the target storage type,
a quick pick is shown to let the user choose. If only one folder
exists, it is used directly without prompting.
This applies to both the manual creation flow (createNewItemManual)
and the AI-guided creation flow (createWithAI) in the management
editor.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: update accessibilitySupport and fontInfo types to any, and placeholder type to string | undefined
* Fix regression: pass undefined targetDir through to command
When no matching folder exists for the requested storage type (e.g.
skills have no user-storage folder), the previous code silently
aborted. The original behavior passed undefined through, letting
the command show its own folder picker via askForPromptSourceFolder.
Use null to signal user cancellation (dismiss picker) vs undefined
to signal no folder available. Also address review feedback:
- Use folder directly when length=1 in customizationCreatorService
- Use generic localized placeholder string
- Revert unrelated askForPromptSourceFolder.ts change
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Filter workspace picker to project root children only
getSourceFolders() tags tilde-expanded user paths (e.g. ~/.claude/agents)
as PromptsStorage.local, causing them to appear in the workspace picker.
Filter local folders to only those under the active project root so only
actual workspace directories are shown.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add 'New AGENTS.md' option to Instructions dropdown in Sessions
When in the Instructions section of the Sessions app, the + button
dropdown now includes a 'New AGENTS.md' option that creates the file
at the workspace root. Uses the AGENT_MD_FILENAME constant from
promptFileLocations.ts — no hardcoded filenames.
If the file already exists, it opens it in the embedded editor.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix: prevent unfiltered folder picker when no matching storage exists
When the user clicks 'New Skill (User)' but no user-storage folder
exists for skills, the fallback returned undefined which was passed
through to the command. The command's askForPromptSourceFolder then
showed ALL folders including workspace-scoped ones.
Now when both the storage filter and the legacy fallback return
nothing, we return null (cancellation) instead of undefined
(pass-through), preventing the unfiltered picker from appearing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix: use project root as boundary instead of unreliable storage tags
The storage tags from getSourceFolders() are unreliable — tilde-expanded
user paths like ~/.copilot/skills get tagged PromptsStorage.local by
getConfigBasedSourceFolders(). This caused the user picker to show
workspace folders and vice versa.
Instead, partition folders by whether they're under the active project
root: children of project root are workspace, everything else is user.
This correctly handles all customization types including skills.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix duplicate user dirs: prefer ~/.copilot as creation target
getSourceFolders() returns both ~/.claude/agents and ~/.copilot/agents
for user targets. The Sessions app's canonical creation target is
~/.copilot (per AgenticPromptsService design). Use the workspace
service's first includedUserFileRoot (~/.copilot) to filter user
folders for creation, and deduplicate by URI to remove duplicates
from config-based and override sources.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Show all user targets, just deduplicate by URI
Don't filter out user directories — show everything we read from.
The only issue was duplicates (e.g. ~/.copilot/agents appearing twice
from config-based and override sources), which the URI dedup handles.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback: dedup, telemetry, empty folder handling
- customizationCreatorService: deduplicate workspace folders by URI
before length checks to avoid unnecessary picker with duplicates
- managementEditor: normalize workspace-root to workspace in telemetry
to avoid breaking the documented schema
- managementEditor: return undefined (not null) when no matching folders
exist, so the command can fall back to askForPromptSourceFolder
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix: update accessibilitySupport and fontInfo types to any, and placeholder type to string | undefined
* Remove monaco.d.ts from branch diff
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactor session handling in ChatService to capture session options before loading remote sessions
This makes sure `initialSessionOptions` is defined during the request handler.
* add tests
* Initial plan
* Fix agent-run tasks incorrectly prompting "press any key" input request
Remove the `isTaskInactive` check in `OutputMonitor._handleIdleState()`.
When the execution is a task and the output contains a VS Code task finish
message, always treat it as a stop signal regardless of the task's active
state (which can be stale from `getBusyTasks()`). The generic "press any
key" prompt is now only shown for non-task executions.
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>