Hook inputs: expose the active chat model

Ouverte
#2,851 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript

Piste de recherche

Start from the shared hook input type (BaseHookInput) and the event-specific inputs the issue names: UserPromptSubmit, PreToolUse and PostToolUse. Find where the session and timestamp fields are populated, and check whether the host already supplies any model data before adding an optional model object shaped like { id, vendor, family? }. Done means every hook event carries the field, or the issue records that the host cannot provide it.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Context
This continues a request originally filed against VS Code - microsoft/vscode#301152 ("Add model field to Copilot agent hook inputs") — which was closed as the hooks surface moved to the Copilot SDK. The underlying gap wasn't resolved, only relocated. A related sibling request, #2810 ("expose the active agent and the approval mode"), covers agent identity and approval mode but not the model — this issue is specifically about the LLM model.

Problem
Hook inputs (BaseHookInput and the event-specific types, e.g. UserPromptSubmit, PreToolUse, PostToolUse) carry sessionId, timestamp, workingDirectory, etc., but no identifier for which chat model is active for that call. There is currently no reliable way for an external hook process to determine this:

vscode.lm.selectChatModels() returns models matching a selector, not the one currently selected in the chat UI.
The Chat Participant API's request.model is accurate, but only available inside a chat participant's own request handler, not to hooks, which fire on all chat activity regardless of whether a participant is invoked.
Reading transcript_path / host storage is an undocumented, fragile workaround that can silently break on any host update.

Use case
We build developer tooling on top of UserPromptSubmit that needs to behave differently depending on which chat model is active (e.g., adjusting behavior to a model's known characteristics, or attributing telemetry per model). This is a different use case from the original issue's security/policy-enforcement angle (model allow/denylisting), but hits the identical missing field: there's currently no supported way to know which model is active from a hook.

Proposed solution
Add a model field to the common hook input fields sent to all hook events:

model?: {
  id: string;
  vendor: string;
  family?: string;
};

Matches the shape already returned by vscode.lm's LanguageModelChat objects, so existing model metadata concepts carry over directly.

Why it matters
Without this, any hook-based tool that wants to reason about "which model is this developer using right now" has no supported way to find out - only fragile, undocumented workarounds that can break without notice.

Langage dominant
Java
Étoiles
10.7k
Forks
1.5k
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de github/copilot-sdk

Toutes les issues de github/copilot-sdk

Issues similaires

Plus d'issues Java

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.