Commit Graph

45 Commits

Author SHA1 Message Date
Martin Aeschlimann bf8712457a use IPromptsService to provide customizations (#309873)
* use IPromptsService to provide customizations

* update

* update

* update

* update

* Update extensions/copilot/src/platform/promptFiles/test/common/mockPromptsService.ts

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

* update

* dispose MockPromptsService

* update

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-15 00:40:03 -07:00
Don Jayamanne 521013fd76 chore: update @github/copilot to version 1.0.26 and remove unused telemetry binder (#309955)
* chore: update @github/copilot to version 1.0.26 and remove unused telemetry binder

* Update tests
2026-04-15 16:38:35 +10:00
Don Jayamanne c3b16359a3 refactor(copilotcli): update session forking methods and metadata handling (#310049)
* refactor(copilotcli): update session forking methods and metadata handling

* Fix typo
2026-04-14 20:20:46 -07:00
Don Jayamanne a47cd69518 Refactor Copilot CLI session management and improve folder handling (#309779)
- Mark `onDidChangeSessions` as deprecated in `ICopilotCLISessionService`.
- Enhance session deletion logic in `ChatSessionMetadataStore`.
- Update `CopilotCLIChatSessionInitializer` to support new branch creation.
- Refine session option group handling in `SessionOptionGroupBuilder`, ensuring previous selections persist.
- Adjust tests to validate new folder handling and session state persistence.
2026-04-14 12:08:12 +02:00
Don Jayamanne f0f1768abe fix(copilotcli): update elicitation handler in copilot cli to use ask tool (#309446) 2026-04-14 14:01:12 +05:00
Don Jayamanne 3913b503a3 Update @github/copilot to version 1.0.24 in package.json and package-lock.json (#309257)
* Update Copilot SDK to version 1.0.24

* Updates

* Fix tets

* Fixes
2026-04-12 08:48:34 -07:00
Don Jayamanne edfbe283a9 feat(copilot): implement session forking using Copilot API with metadata storage and deprecate old forkSession method (#308652)
feat: implement session forking using Copilot API with metadata storage and deprecate old forkSession method
2026-04-08 20:24:20 -07:00
Don Jayamanne 0afa58dace feat(copilot): Updated the Copilot CLI options to support a model interface (#308418)
* feat(copilot): Updated the Copilot CLI optoins to support a model interface

* Fix tests
2026-04-07 21:43:05 -07:00
Don Jayamanne cc27248bda Update dependencies and improve session initialization in Copilot CLI (#4930)
* Update dependencies and improve session initialization in Copilot CLI

* Update package.json

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

* Update to 1.0.17

* Updates

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-05 15:37:26 +00:00
Josh Spicer cc6289e429 improve ChatSessionCustomizationProvider implementation (#4925)
* chat: use supportedTypes instead of unsupportedTypes

Inverted to match the vscode API change. Providers now declare what
they support (whitelist) instead of what they don't (blacklist).
- Claude: Agent, Skill, Instructions, Hook
- CLI: Agent, Skill, Instructions

* fix: use 'builtin' groupKey matching vscode BUILTIN_STORAGE constant

SDK agents with synthetic URIs (no real file) use groupKey 'builtin'
so they appear under a 'Built-in' group header in the UI.

* test: add parity tests for supportedTypes and groupKey consistency

- Verify all returned items have a type matching supportedTypes
- Verify items with synthetic URIs (non-file scheme) use groupKey 'builtin'

* fix: improve CLI agent dedup with normalized name matching

The previous dedup logic did exact name matching between SDK agents
and file agents, which failed when:
- SDK uses underscores, files use hyphens (apple_docs vs apple-docs)
- SDK appends suffixes (apple_docs_investigator vs apple-docs)
- Files have .md extension instead of .agent.md

Now normalizes names by removing hyphens/underscores and uses
startsWith matching. Also preserves file URIs when matched so
workspace agents show their real file paths instead of synthetic URIs.

* refactor: remove explicit groupKey from providers, let vscode infer

groupKey should only be used for business-logic categories that vscode
can't infer (e.g. instruction sub-categories like 'loaded on demand').
For agents, skills, etc. vscode reliably infers the group from the URI:
- file: under workspace → Workspace
- file: elsewhere → User
- vscode-userdata: → Extensions (read-only)
- non-file schemes → Built-in

* fix: use exact name matching and URI dedup for CLI agents

- Replace startsWith prefix matching with exact normalized name lookup
  to prevent two CLI agents from matching the same file agent
- Add URI-based dedup so multiple CLI agents resolving to the same
  file produce only one item (first wins)
- Filter unmatched file agents through isCLIPath() to prevent agents
  from non-CLI directories (e.g. .claude/) from leaking into output
- Add tests for dedup, exact matching, and isCLIPath filtering

* refactor: split provideChatSessionCustomizations into per-type methods

Extract getAgentItems(), getInstructionItems(), getSkillItems() from the
monolithic provideChatSessionCustomizations. Also extract normalizeName()
helper for reuse.

* rename CLI_SUBPATHS/CLI_HOME_SUBPATHS to CLI_WORKSPACE_PREFIXES/CLI_HOME_PREFIXES

* refactor: add sourceUri to CLIAgentInfo, eliminate provider cross-referencing

Introduce CLIAgentInfo type wrapping SweCustomAgent + sourceUri.
CopilotCLIAgents.getAgentsImpl() now captures URIs at the merge point:
- SDK agents get synthetic copilotcli: URIs
- Prompt file agents get their real file: URIs

This eliminates the entire cross-referencing dance in the customization
provider's getAgentItems(), which collapsed from ~40 lines to a simple
map() call. Dedup and matching now happen once in CopilotCLIAgents
instead of being duplicated in the provider.

* simplify: remove isCLIPath filtering from customization provider

The prompt file service returns the right items — no need to
second-guess with path filtering. Removes isCLIPath(), the
CLI_WORKSPACE_PREFIXES/CLI_HOME_PREFIXES constants, and the
IWorkspaceService/INativeEnvService constructor dependencies.

* revert test version

* run npm run vscode-dts:update
2026-04-02 22:29:25 +00:00
Ladislau Szomoru 3bebd9c5e7 Background - store workspace changes per session so that we can have multiple sessions with their individual changes (#4912)
* Add Repository properties

* Store workspace changes per session so that we can have multiple sessions with their individual changes

* Update src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts

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

* Pull request feedback

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-01 21:37:41 +00:00
Don Jayamanne daf4fc1b0e feat: implement multi-root folder support with additional workspace handling (#4898)
* feat: implement multi-root folder support with additional workspace handling

* Updates

* Fixes
2026-04-01 11:45:43 +00:00
Don Jayamanne 1985e31589 feat: enhance Copilot CLI session management with system message support (#4891) 2026-04-01 05:06:39 +00:00
Don Jayamanne 464d963149 refactor: update session options to use consistent naming and structure across session management (#4878) 2026-03-31 19:56:32 +00:00
Don Jayamanne bfc7d31943 refactor(CopilotCLI): streamline chat history retrieval and clean up unused imports (#4860)
* refactor(CopilotCLI): streamline chat history retrieval and clean up unused imports

* Fix test failures
2026-03-31 09:23:30 +00:00
Ladislau Szomoru ac23c840f2 Background - store repository folder information for workspace sessions (#4857)
* Revert "Background - include repositoryPath for folder sessions (#4829)"

This reverts commit ad31f89dfa.

* Background - store workspace folder information
2026-03-31 07:01:01 +00:00
Don Jayamanne ea38027635 Enhance Copilot CLI session handling with performance logging and improved session management (#4855)
* Enhance Copilot CLI session handling with performance logging and improved session management

* Fix tests
2026-03-31 06:11:42 +00:00
Don Jayamanne a2c969e0ce Copilot CLI: Use new API to get session metadata (#4848) 2026-03-31 03:12:55 +00:00
Don Jayamanne 408faf1866 Copilot CLI: Remove CopilotCLISessionOptions (#4853)
* Copilot CLI Remove CopilotCLISessionOptions

* Updates
2026-03-31 03:02:30 +00:00
Don Jayamanne 5d200c02ce Remove unused session tracking methods and related calls in CopilotCLISessionService (#4847) 2026-03-31 03:02:18 +00:00
Ladislau Szomoru ad31f89dfa Background - include repositoryPath for folder sessions (#4829) 2026-03-30 18:34:20 +00:00
Paul 41b7ef8514 Support dynamic prompt variables (#4742)
* wip

* fixes

* update

* update

* updates

* updates

* clean

* clean

* clean

* fix tests

* update

* fix test
2026-03-27 21:55:42 +00:00
Don Jayamanne b7e641a910 feat: Fix MCP server mapping integration in Copilot CLI sessions (#4709)
* feat: Fix MCP server mapping integration in Copilot CLI sessions

* Updates

* Updates

* Updates

---------

Co-authored-by: Raymond Zhao <7199958+rzhao271@users.noreply.github.com>
2026-03-27 03:48:35 +00:00
Don Jayamanne e6d2950345 refactor: remove debug logger from CopilotCLISession and update related tests (#4744)
* refactor: remove debug logger from CopilotCLISession and update related tests

* Fixes

* Update src/extension/chatSessions/copilotcli/node/test/copilotCliSessionService.spec.ts

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

* Update src/extension/chatSessions/copilotcli/node/test/copilotCliSessionService.spec.ts

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-27 02:52:23 +00:00
Zhichao Li 61a404c8c0 fix: use os.devNull for OTel null sink to prevent NUL file creation on Windows (#4748)
On Windows, passing 'NUL' as a relative path to Node's fs.openSync
creates a literal file named 'NUL' in the cwd (the VS Code install dir)
instead of opening the Windows null device. This caused a 1.4MB telemetry
data file to appear in the app install folder, triggering update errors.

Replace the platform-conditional string with os.devNull which correctly
returns '\\.\\nul' on Windows and '/dev/null' on Unix.
2026-03-27 02:50:01 +00:00
Don Jayamanne b32658f1ed Copilot CLI: Incremental updates for Controller API adoption (#4657)
* Copilot CLI: Incremental updates for Controller API adoption

* updaets

* Updates

* Updates

* Skip tests

* Run claude tests

* Restore more tests

* Updates

* Updates

* Updates

* Updates

* updates
2026-03-25 17:59:39 +00:00
Don Jayamanne 0c0efd2abe Enhance CopilotCLISessionService with session ID management and tests (#4636)
* Enhance CopilotCLISessionService with session ID management and add tests

* Apply suggestion from @Copilot

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-24 10:19:59 +00:00
Zhichao Li d2c8aa5d67 fix: always enable content capture for CLI debug panel (#4581)
Set OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true before
SDK init so the debug panel always shows full prompts, responses,
and tool arguments. Without this, users without the env var set
see empty content in the debug panel.

When user OTel is disabled, SDK spans go to /dev/null so captured
content never leaves the process.
2026-03-21 05:46:45 +00:00
Zhichao Li 4a4411e88e Native OTel instrumentation for Copilot CLI (background, terminal, debug panel) (#4507)
* add OTel instrumentation spec and plan for all agents

* feat: OTel instrumentation for Copilot CLI background agent

- Add agentOTelEnv.ts config derivation helpers (CLI + Claude)
- Enable SDK OtelLifecycle via env vars before LocalSessionManager ctor
- Add invoke_agent copilotcli wrapper span with traceparent propagation
- Forward OTel env vars to terminal CLI sessions
- Update spec and plan docs for all agents
- 33 tests passing (14 new + 19 existing)

* feat: filter debug-panel-only spans from OTLP export

Spans with non-standard gen_ai.operation.name values (content_event,
user_message) are excluded from external OTLP export while remaining
visible in the Agent Debug Log panel via onDidCompleteSpan.

Only GenAI-conventional operations (invoke_agent, chat, execute_tool,
embeddings, execute_hook) are exported to the user's collector.

* fix: add IOTelService to CopilotCLISessionService ctor in participant test

* fix: pass chatSessionId to CapturingToken for debug panel routing

The CapturingToken was created without chatSessionId, so the debug panel
couldn't route copilotcli OTel spans to the correct session view.

Also: Copilot CLI runtime only supports otlp-http (not gRPC). Terminal
CLI sessions require an HTTP-compatible OTLP endpoint.

* docs: add CLI HTTP-only limitation to spec and dual-port Aspire setup to test plan

* fix: forward OTel env vars to CLI terminal sessions

- Include OTel env vars in terminal profile provider path (dropdown)
  which previously only set shell info without auth/OTel env
- Pass empty env to deriveCopilotCliOTelEnv for terminal sessions so
  vars are always included regardless of process.env pollution from
  the in-process background agent
- Update test plan to use Grafana LGTM stack

* fix: add CHAT_SESSION_ID to attributes in CopilotCLISession

* docs: update OTel instrumentation specification for Copilot CLI and Claude Code

* feat: bridge SDK native OTel spans to Agent Debug panel

Replace synthetic span approach (PR #4494) with a bridge SpanProcessor
that forwards SDK-native spans from the Copilot CLI runtime's
BasicTracerProvider into the extension's IOTelService event stream.

This gives the debug panel the full SDK span hierarchy (subagents,
permissions, hooks, nested tool calls) — identical to what Grafana shows.

Architecture:
- Add injectCompletedSpan() to IOTelService interface for external span
  injection without OTLP re-export
- Create CopilotCliBridgeSpanProcessor that converts ReadableSpan to
  ICompletedSpanData, injects copilot_chat.chat_session_id from a
  traceId→sessionId map, and fires onDidCompleteSpan
- Install bridge on SDK's TracerProvider via internal
  MultiSpanProcessor._spanProcessors array (OTel SDK v2 removed the
  public addSpanProcessor API, but this internal array is the same
  pattern the SDK itself uses in forceFlush)
- Propagate traceparent from extension root span to SDK via
  otelLifecycle.updateParentTraceContext() so all spans share a traceId
- Filter bridge to only forward spans from registered CLI sessions

Code changes:
- copilotCliBridgeSpanProcessor.ts: new bridge processor
- copilotcliSession.ts: remove all synthetic spans (chat, tool, error),
  keep root invoke_agent span + traceparent propagation + bridge wiring
- copilotcliSessionService.ts: install bridge after first session
  creation, wire bridge + SDK trace context updater to sessions
- IOTelService: add injectCompletedSpan to interface + all impls
- Remove outdated synthetic span tests
- Add OTel data flow architecture diagram (HTML)

* fix: update span processing to use parent span context and enhance subagent event identification

* display names for tool call and subagent events

* docs: merge arch and spec into single developer guide

Combine agent_monitoring_arch.md (foreground-only) and agent-otel-spec.md
(all agents) into a single comprehensive developer reference covering all
four agent paths, bridge architecture, and SDK internal access warnings.

* docs: fix stale addSpanProcessor reference in data flow diagram

* chore: move plan and test docs to offline archive

These documents are reference material for the OTel sprint, not needed
in the shipped PR. Archived to ~/Documents/copilot-otel-archive/.

* test: add bridge SpanProcessor unit tests

13 tests covering: traceId filtering, parentSpanContext conversion,
CHAT_SESSION_ID injection, attribute flattening, event conversion,
HrTime→ms conversion, unregister/shutdown behavior.

* test: add span event identification and naming tests

7 tests covering invoke_agent identification logic: top-level skip,
SDK wrapper skip (no agent name), subagent detection (name attribute
and span name parsing), unknown/missing operation name handling.

* fix: always enable SDK OTel for debug panel regardless of user config

The CLI SDK's OtelLifecycle must always initialize so the bridge
processor can forward native spans to the debug panel. When user
OTel is disabled, COPILOT_OTEL_ENABLED is still set but no OTLP
endpoint is configured — the SDK creates spans (for debug panel)
but doesn't export to any external collector.

The bridge installation is also now unconditional — it installs
even when user OTel is disabled.

* chore: remove transient sprint plan

* fix: suppress SDK OTLP export when user OTel is disabled

When user OTel is disabled, force the SDK to use file exporter to
/dev/null instead of letting it default to OTLP. Also clear any
leftover OTEL_EXPORTER_OTLP_ENDPOINT from previous sessions to
prevent orphaned traces in Grafana.

* docs: add background agents section to user monitoring guide

Cover Copilot CLI (background + terminal) and Claude Code agent
tracing in the user-facing guide. Includes span hierarchy examples,
service.name filtering table, and CLI HTTP-only limitation note.

* docs: remove Claude Code from user guide (not yet supported)

* fixup! feat: OTel instrumentation for Copilot CLI background agent

* fix: address PR review comments

- Use GenAiOperationName constants in EXPORTABLE_OPERATION_NAMES (avoids drift)
- Remove unnecessary delete of OTEL_EXPORTER_OTLP_ENDPOINT from process.env
- Replace 'as any' OTel mocks with typed NoopOTelService in terminal tests
- Clarify comment on empty env arg for terminal OTel env derivation
- Add ExportResultCode.SUCCESS comment for clarity

* fixup! fix: always enable SDK OTel for debug panel regardless of user config

* fix: handle SDK native hook spans in debug panel

The SDK's OtelSessionTracker creates 'hook {type}' spans with
github.copilot.hook.type attributes (not gen_ai.operation.name).
These were silently dropped by completedSpanToDebugEvent. Now
detected by span name prefix and converted to Hook: {type} events.

* add execute_hook spans for Claude hook executions in monitoring documentation

* docs: add hook spans to CLI trace hierarchy in user guide
2026-03-20 22:53:20 +00:00
Don Jayamanne 86788921f8 Refactor session closure logic to simplify handling of readonly sessions and remove unused session wrappers map (#4542)
* Refactor session closure logic to simplify handling of readonly sessions and remove unused session wrappers map

* address review comments
2026-03-20 05:25:08 +00:00
Don Jayamanne a0e52e11ea Ensure session event files end with EOL when writing to the filesystem (#4541) 2026-03-20 05:03:29 +00:00
Don Jayamanne 3983e7b123 fix: streamline event truncation logic in CopilotCLISessionService (#4527) 2026-03-19 19:01:22 +00:00
Don Jayamanne ad2aa62da5 feat: Add session forking capabilities and enhance metadata handling (#4510)
* feat: Add session forking capabilities and enhance metadata handling

* feat: Add session forking capabilities and enhance metadata handling

* Update github copilot npm

* Updates

* fixes
2026-03-19 03:52:49 +00:00
Don Jayamanne c2384c79d4 feat: Enhance ChatSessionMetadataStore with request details management (#4487)
* feat: Enhance ChatSessionMetadataStore with request details management

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Updates

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Updates

* Fixes

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-18 14:50:57 +00:00
Don Jayamanne effab7e589 More updates to Copilot CLI to use Controller API (#4368)
* More updates to Copilot CLI to use Controller API

* Update src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts

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

* Updates

* fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-12 04:43:03 +00:00
Don Jayamanne 56de4298dc feat: Update usage of Controller API (#4353)
* feat: Introduce AgentSessionsWorkspace udpate usage of Controller API

* Addressed review comments
2026-03-11 08:31:46 +00:00
Don Jayamanne 3b5a809bed Refactor titleService variable name for consistency in CopilotCLISessionService tests (#4344)
* Add first user message tracking to chat session metadata store

* Updates

* Fix tests

* Fixes

* Refactor titleService variable name for consistency in CopilotCLISessionService tests
2026-03-11 00:50:05 +00:00
Don Jayamanne 140b70422a Add first user message tracking to chat session metadata store (#4328)
* Add first user message tracking to chat session metadata store

* Updates

* Fix tests

* Fixes
2026-03-10 22:44:19 +00:00
Don Jayamanne cce46b4ae6 Enhance session title management with custom service integration (#4333)
* Enhance session title management by integrating custom session title service in chat session components

* Fix tests
2026-03-10 22:15:39 +00:00
Don Jayamanne 92db8fe772 Refactor MCP support in Copilot CLI and enable by default (#4305)
* Refactor MCP support in Copilot CLI and enable by default

* Update src/extension/chatSessions/copilotcli/node/mcpHandler.ts

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

* Updates

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-10 08:23:34 +00:00
Don Jayamanne 43f3f95724 Improve performance of reading Copilot CLI session title (#4311)
* Improve performance of reading session title

* Fixes

* Fixes

* Update comments

* Fix tests
2026-03-10 02:26:52 +00:00
Don Jayamanne 6b8d0f84c1 Load a Session even if Copilot CLI SDK fails to load the session (#4283)
* Display a Session even if Copilot CLI SDK fails to load the sesion

* Updates

* Fixrs

* Fixes

* Fix tests

* Revert changes

* Reverts

* Remove
2026-03-08 19:29:20 +00:00
Don Jayamanne 79d6023696 Refactor workingDirectory, isolationEnabled and worktreeProperties and collapse into an existing single type (#4276)
* Refactor Copilot CLI session handling to utilize workspace information

- Introduced IWorkspaceInfo interface to encapsulate workspace-related data.
- Updated session creation and retrieval methods to accept workspaceInfo instead of individual parameters.
- Refactored tests to align with the new workspaceInfo structure.
- Enhanced session management by ensuring consistent handling of working directories and isolation settings.
- Improved prompt resolution by passing workspaceInfo to relevant methods.

* Updates

* Refactor CopilotCLISessionOptions to remove workingDirectory property and streamline working directory retrieval

* Fixes
2026-03-07 12:33:47 +00:00
Don Jayamanne c5a2d468fa Add skill locations support to Copilot CLI session options and service (#4098)
* Add skill locations support to Copilot CLI session options and service

* Fix tests

* Add MockSkillLocations to CopilotCLISessionService for enhanced testing

* oops

* oops

* More Revert

* Apply suggestion from @Copilot

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-02 10:38:42 +00:00
Don Jayamanne c1c606c16d Merge agents and chatsession folder (#4058) 2026-02-27 23:06:09 +00:00