-
Notifications
You must be signed in to change notification settings - Fork 513
Expand file tree
/
Copy pathdeepseek_tui_provider.go
More file actions
66 lines (60 loc) · 1.9 KB
/
Copy pathdeepseek_tui_provider.go
File metadata and controls
66 lines (60 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package parser
import (
"context"
"path/filepath"
)
// DeepSeek TUI stores each session as a single JSON file in a directory. It is
// a directory-of-files provider: discovery, watching, change classification,
// lookup, and fingerprinting come from JSONLSourceSet, and the ParseFile option
// makes that source set a full SourceSet so it rides the generic factory.
func newDeepSeekTUIProviderFactory(def AgentDef) ProviderFactory {
return newSourceSetFactory(
def,
deepSeekTUIProviderCapabilities(),
func(cfg ProviderConfig) SourceSet { return newDeepSeekTUISourceSet(cfg.Roots) },
)
}
func newDeepSeekTUISourceSet(roots []string) JSONLSourceSet {
return newJSONLSourceSet(AgentDeepSeekTUI, roots,
withExtensions(".json"),
withFollowSymlinkFiles(),
withContentHashing(),
withIncludePath(isDeepSeekTUISourcePath),
withSessionIDFromPath(func(root, path string) string {
return deepSeekTUISessionIDFromPath(path)
}),
withParseFile(deepSeekTUIParseFile),
)
}
func deepSeekTUIParseFile(
_ context.Context, path string, req ParseRequest,
) ([]ParseResult, []string, error) {
sess, msgs, err := parseDeepSeekTUISession(path, req.Machine)
if err != nil {
return nil, nil, err
}
if sess == nil {
return nil, nil, nil
}
if req.Fingerprint.Hash != "" {
sess.File.Hash = req.Fingerprint.Hash
}
return []ParseResult{{Session: *sess, Messages: msgs}}, nil, nil
}
func isDeepSeekTUISourcePath(root, path string) bool {
return isDeepSeekTUISessionFile(filepath.Base(path))
}
func deepSeekTUIProviderCapabilities() Capabilities {
return Capabilities{
Source: jsonlFileProviderSourceCapabilities(),
Content: ContentCapabilities{
FirstMessage: CapabilitySupported,
SessionName: CapabilitySupported,
Cwd: CapabilitySupported,
Model: CapabilitySupported,
Thinking: CapabilitySupported,
ToolCalls: CapabilitySupported,
ToolResults: CapabilitySupported,
},
}
}