agent: move TokenUsage and SkillEvent to the leaf types package · Entire
agent: move TokenUsage and SkillEvent to the leaf types package
7017397·
Soph·4w ago·5 files·+120 added/-82 removed
The checkpoint contract DTOs embed TokenUsage and SkillEvent, but both lived in the heavy agent package — so any package referencing the checkpoint metadata types transitively pulled in agent (and its TUI/launch/review dependencies). That blocks relocating the contract to a standalone api/checkpoint package.
Move the type definitions (and the SkillEvent string constants) into the existing leaf agent/types package (which has no imports) and leave transparent aliases in agent:
type TokenUsage = types.TokenUsage type SkillEvent = types.SkillEvent (+ the four Skill* sub-types) const SkillEventTypePromptInvocation = types.SkillEventTypePromptInvocation (+ the rest)
All ~34 existing agent.TokenUsage / agent.SkillEvent references keep compiling unchanged via the aliases. The SkillEventExtractor interface stays in agent (it's agent-implementation behavior, not contract data); the constants move alongside the structs so the leaf package is self-contained for constructing skill events. checkpoint.go now references types.* and no longer imports agent — the prerequisite for the api/checkpoint relocation (next in the stack).
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
44f690c46059View transcript
Changes
5
cmd/entire/cli
agent
Mskill_events.go+21/-58
Mtypes.go+9/-17
types
Askill_events.go+66
Atoken_usage.go+18
checkpoint
Mcheckpoint.go+6/-7
1
2
3
4
5
6
7
3
4
9
5
6
7
8
9
11
12
13
14
10
11
12
16
17
18
19
13
14
15
16
21
22
23
24
17
18
19
20
21
22
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
23
24
25
26
27
28
29
30
31
32
package agent
// Skill event types recorded in checkpoint metadata. const ( SkillEventTypePromptInvocation = "prompt_invocation" SkillEventTypeToolInvocation = "tool_invocation" ) import "github.com/entireio/cli/cmd/entire/cli/agent/types"
// Skill event source signals. // The skill-event types and their constants live in the leaf agent/types // package so the checkpoint contract can construct and reference skill events // without importing the full agent package. These aliases keep existing // agent.SkillEvent* references working. const ( SkillSignalPiInputSlashCommand = "input_slash_command" SkillSignalPromptSlashCommand = "prompt_slash_command" SkillSignalClaudeSkillToolUse = "skill_tool_use" ) SkillEventTypePromptInvocation = types.SkillEventTypePromptInvocation SkillEventTypeToolInvocation = types.SkillEventTypeToolInvocation
// Skill event confidence values. const ( SkillConfidenceExplicit = "explicit" ) SkillSignalPiInputSlashCommand = types.SkillSignalPiInputSlashCommand SkillSignalPromptSlashCommand = types.SkillSignalPromptSlashCommand SkillSignalClaudeSkillToolUse = types.SkillSignalClaudeSkillToolUse
// Skill event collapse targets. const ( SkillCollapseTargetUserMessage = "user_message" SkillCollapseTargetToolPair = "tool_pair" SkillConfidenceExplicit = types.SkillConfidenceExplicit
SkillCollapseTargetUserMessage = types.SkillCollapseTargetUserMessage SkillCollapseTargetToolPair = types.SkillCollapseTargetToolPair )
// SkillEvent records a native agent skill signal without rewriting the raw transcript.
// Consumers use TranscriptAnchor/Native to locate the underlying raw event and Collapse
// to decide whether/how to hide verbose skill material by default.
type SkillEvent struct {
ID string json:"id,omitempty"
EventType string json:"event_type"
Skill SkillEventSkill json:"skill"
Source SkillEventSource json:"source"
TurnID string json:"turn_id,omitempty"
Timestamp string json:"timestamp,omitempty"
TranscriptAnchor *SkillEventTranscriptAnchor json:"transcript_anchor,omitempty"
Native map[string]string json:"native,omitempty"
Collapse SkillEventCollapse json:"collapse"
}
type SkillEventSkill struct {
Name string json:"name"
}
type SkillEventSource struct {
Agent string json:"agent"
Signal string json:"signal"
Confidence string json:"confidence"
}
type SkillEventTranscriptAnchor struct {
Unit string json:"unit,omitempty"
Start int json:"start,omitempty"
End int json:"end,omitempty"
EntryIDs []string json:"entry_ids,omitempty"
ToolUseID string json:"tool_use_id,omitempty"
}
type SkillEventCollapse struct {
Target string json:"target"
Label string json:"label,omitempty"
DefaultCollapsed bool json:"default_collapsed"
}
type (
SkillEvent = types.SkillEvent
SkillEventSkill = types.SkillEventSkill
SkillEventSource = types.SkillEventSource
SkillEventTranscriptAnchor = types.SkillEventTranscriptAnchor
SkillEventCollapse = types.SkillEventCollapse
)
// SkillEventExtractor is implemented by agents that can derive native skill events // from their transcript format.