@@ -22,6 +22,7 @@ import (
2222 "github.com/ActiveMemory/ctx/internal/config/file"
2323 "github.com/ActiveMemory/ctx/internal/config/session"
2424 "github.com/ActiveMemory/ctx/internal/config/token"
25+ "github.com/ActiveMemory/ctx/internal/entity"
2526)
2627
2728// copilotKeyRequests is the key path segment for request arrays.
@@ -94,7 +95,7 @@ func (p *CopilotParser) Matches(path string) bool {
9495//
9596// Reconstructs the session by reading the initial snapshot (kind=0) and
9697// applying incremental patches (kind=1 for scalar, kind=2 for array/object).
97- func (p * CopilotParser ) ParseFile (path string ) ([]* Session , error ) {
98+ func (p * CopilotParser ) ParseFile (path string ) ([]* entity. Session , error ) {
9899 file , openErr := os .Open (filepath .Clean (path ))
99100 if openErr != nil {
100101 return nil , fmt .Errorf ("open file: %w" , openErr )
@@ -157,12 +158,12 @@ func (p *CopilotParser) ParseFile(path string) ([]*Session, error) {
157158 return nil , nil
158159 }
159160
160- return []* Session {result }, nil
161+ return []* entity. Session {result }, nil
161162}
162163
163164// ParseLine is not meaningful for Copilot sessions since they use patches.
164165// Returns nil for all lines.
165- func (p * CopilotParser ) ParseLine (_ []byte ) (* Message , string , error ) {
166+ func (p * CopilotParser ) ParseLine (_ []byte ) (* entity. Message , string , error ) {
166167 return nil , "" , nil
167168}
168169
@@ -240,12 +241,12 @@ func (p *CopilotParser) parseKeyPath(keys []json.RawMessage) []string {
240241// buildSession converts a reconstructed copilotRawSession into a Session.
241242func (p * CopilotParser ) buildSession (
242243 raw * copilotRawSession , sourcePath string , cwd string ,
243- ) * Session {
244+ ) * entity. Session {
244245 if len (raw .Requests ) == 0 {
245246 return nil
246247 }
247248
248- session := & Session {
249+ session := & entity. Session {
249250 ID : raw .SessionID ,
250251 Tool : session .ToolCopilot ,
251252 SourceFile : sourcePath ,
@@ -260,7 +261,7 @@ func (p *CopilotParser) buildSession(
260261
261262 for _ , req := range raw .Requests {
262263 // User message
263- userMsg := Message {
264+ userMsg := entity. Message {
264265 ID : req .RequestID ,
265266 Timestamp : time .UnixMilli (req .Timestamp ),
266267 Role : claude .RoleUser ,
@@ -319,12 +320,12 @@ func (p *CopilotParser) buildSession(
319320// buildAssistantMessage extracts the assistant response from a request.
320321func (p * CopilotParser ) buildAssistantMessage (
321322 req copilotRawRequest ,
322- ) * Message {
323+ ) * entity. Message {
323324 if len (req .Response ) == 0 {
324325 return nil
325326 }
326327
327- msg := & Message {
328+ msg := & entity. Message {
328329 ID : req .RequestID + "-response" ,
329330 Timestamp : time .UnixMilli (req .Timestamp ),
330331 Role : claude .RoleAssistant ,
@@ -380,7 +381,7 @@ func (p *CopilotParser) buildAssistantMessage(
380381}
381382
382383// parseToolInvocation extracts a ToolUse from a toolInvocationSerialized item.
383- func (p * CopilotParser ) parseToolInvocation (item copilotRawRespItem ) * ToolUse {
384+ func (p * CopilotParser ) parseToolInvocation (item copilotRawRespItem ) * entity. ToolUse {
384385 toolID := item .ToolID
385386 if toolID == "" {
386387 return nil
@@ -409,7 +410,7 @@ func (p *CopilotParser) parseToolInvocation(item copilotRawRespItem) *ToolUse {
409410 }
410411 }
411412
412- return & ToolUse {
413+ return & entity. ToolUse {
413414 ID : item .ToolCallID ,
414415 Name : name ,
415416 Input : inputStr ,
0 commit comments