Documentation
¶
Overview ¶
Package copilot captures GitHub Copilot sessions, from Copilot CLI and from the Copilot agent in VS Code, through the Copilot hook files and the session event log that Copilot keeps on disk.
Index ¶
- Constants
- type Provider
- func (p *Provider) AnnouncePromptSubmit(string) error
- func (p *Provider) AnnounceSessionStart(msg trace.SessionStartMessage) error
- func (p *Provider) AnnounceToUser(msg string) error
- func (p *Provider) CaptureFileSnapshot(store *state.Store, input *trace.HookInput) error
- func (p *Provider) CleanupAfterEdit(store *state.Store, input *trace.HookInput)
- func (p *Provider) CopySessionData(store *state.Store, loc trace.SessionLocation) error
- func (p *Provider) HooksInstalled(repoRoot string) (bool, error)
- func (p *Provider) InstallHooks(repoRoot string) error
- func (p *Provider) InstallHooksForTraceRun(repoRoot string) error
- func (p *Provider) IsCommandTool(toolName string) bool
- func (p *Provider) IsFileWritingTool(toolName string) bool
- func (p *Provider) Name() string
- func (p *Provider) NewSkillLoads(store *state.Store, input *trace.HookInput) []string
- func (p *Provider) ParseSession(ctx context.Context, opts *trace.ParseOpts) (*aicodingsession.Evidence, error)
- func (p *Provider) PastedImages(raw map[string][]json.RawMessage) []trace.PastedImage
- func (p *Provider) ReadHookInput(r io.Reader) (*trace.HookInput, error)
- func (p *Provider) ReplaceSpecCopies(raw map[string][]json.RawMessage, sources pointer.Sources) pointer.Report
- func (p *Provider) ResolveBeforeContent(store *state.Store, input *trace.HookInput, _ []byte) []byte
- func (p *Provider) SessionSkills(opts *trace.ParseOpts) ([]trace.SkillUse, []string, error)
- func (p *Provider) SettingsFile(repoRoot string) string
- func (p *Provider) SkillRoots(repoRoot string) skill.Roots
- func (p *Provider) SupportsPromptReminder() bool
- func (p *Provider) SupportsSessionStartBanner() bool
- func (p *Provider) SupportsSessionStartInstruction() bool
- func (p *Provider) UninstallHooks(repoRoot string) error
Constants ¶
const Name = "copilot"
Name is the identifier stored in session records and evidence.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider connects GitHub Copilot to Trace. It holds no session state.
func (*Provider) AnnouncePromptSubmit ¶
AnnouncePromptSubmit does nothing: Copilot drops the output of the hook.
func (*Provider) AnnounceSessionStart ¶
func (p *Provider) AnnounceSessionStart(msg trace.SessionStartMessage) error
AnnounceSessionStart shows the banner to the user and gives the instruction to the model.
func (*Provider) AnnounceToUser ¶
AnnounceToUser shows the message to the user as a progress line. The model gets no copy: it would show the message to the user a second time.
func (*Provider) CaptureFileSnapshot ¶
CaptureFileSnapshot stores the content of input.FilePath before a file tool runs. A missing file (a new file) is not an error.
func (*Provider) CleanupAfterEdit ¶
CleanupAfterEdit deletes the snapshot of the edit.
func (*Provider) CopySessionData ¶
CopySessionData refreshes the private copy of the session event log. The copy is atomic, so a failed copy keeps the previous one. A missing log is not an error. Only files inside the Copilot session-state folder are read.
func (*Provider) HooksInstalled ¶
HooksInstalled reports whether the hook file holds a Chainloop hook.
func (*Provider) InstallHooks ¶
InstallHooks writes the Trace hook file.
func (*Provider) InstallHooksForTraceRun ¶
InstallHooksForTraceRun writes the hook file without session end. trace run ends the session itself, and it restores the previous file after the run, so it can replace a file that Trace does not own.
func (*Provider) IsCommandTool ¶
IsCommandTool returns true if the named tool runs a shell command.
func (*Provider) IsFileWritingTool ¶
IsFileWritingTool returns true if the named tool writes one file.
func (*Provider) NewSkillLoads ¶
NewSkillLoads returns the folders of the skills that the session loaded since the last call, from the live event log. It reads only a log inside the Copilot session-state folder, and never fails.
func (*Provider) ParseSession ¶
func (p *Provider) ParseSession(ctx context.Context, opts *trace.ParseOpts) (*aicodingsession.Evidence, error)
ParseSession reads only the private copy of the event log. Unknown event types stay in the raw session, because the format can change.
func (*Provider) PastedImages ¶
func (p *Provider) PastedImages(raw map[string][]json.RawMessage) []trace.PastedImage
PastedImages returns each distinct image that the user attached to a message. An image that a tool gave the model, such as a view of an image file, is not a pasted image (spec issue-3800 R-009).
func (*Provider) ReadHookInput ¶
ReadHookInput reads a Copilot hook payload in either form.
The pre-tool payload of a batch of calls cannot pair one call with its post-tool payload, so the input never carries a tool call ID, also when the post-tool payload has one. The pre and post hooks of a shell tool then share the snapshot key of the session (TRC-006).
func (*Provider) ReplaceSpecCopies ¶
func (p *Provider) ReplaceSpecCopies(raw map[string][]json.RawMessage, sources pointer.Sources) pointer.Report
ReplaceSpecCopies replaces each exact copy of a stored source with a pointer to its material: the full view or shell read of a source file, the text of a create call or of a patch that adds one file, and the data of an image that the user attached. Partial reads, changed content, failed tool calls, and data that cannot be decoded stay inline (spec issue-3800 R-009).
func (*Provider) ResolveBeforeContent ¶
func (p *Provider) ResolveBeforeContent(store *state.Store, input *trace.HookInput, _ []byte) []byte
ResolveBeforeContent returns the snapshot that CaptureFileSnapshot saved.
func (*Provider) SessionSkills ¶
SessionSkills reads the skills from the private copy of the event log. Only a skill.invoked event counts as a use: Copilot writes it when it loads a skill into the session, not when it lists the skills (spec issue-3800 R-008).
func (*Provider) SettingsFile ¶
SettingsFile returns the absolute path of the hook file that Trace owns.
func (*Provider) SkillRoots ¶
SkillRoots returns the skill folders that Copilot reads, which tell where a skill came from. Copilot reads project skills in .github/skills, .agents/skills and .claude/skills, all under the repository.
func (*Provider) SupportsPromptReminder ¶
SupportsPromptReminder is false: Copilot drops the output of a userPromptSubmitted command hook.
func (*Provider) SupportsSessionStartBanner ¶
SupportsSessionStartBanner is true: Copilot shows the progress messages of a hook to the user.
func (*Provider) SupportsSessionStartInstruction ¶
SupportsSessionStartInstruction is true: Copilot adds the additionalContext of a sessionStart hook to the session.
func (*Provider) UninstallHooks ¶
UninstallHooks deletes the hook file, but only when every hook in it is a Chainloop hook. Other hook files are never touched.