@techdivision/opencode-time-tracking 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techdivision/opencode-time-tracking",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Automatic time tracking plugin for OpenCode - tracks session duration and tool usage to CSV",
5
5
  "main": "src/Plugin.ts",
6
6
  "types": "src/Plugin.ts",
@@ -86,7 +86,7 @@ export function createEventHook(
86
86
  client: OpencodeClient
87
87
  ) {
88
88
  return async ({ event }: { event: Event }): Promise<void> => {
89
- // Track model from assistant messages
89
+ // Track model and agent from assistant messages
90
90
  if (event.type === "message.updated") {
91
91
  const props = event.properties as MessageUpdatedProperties
92
92
  const message = props.info
@@ -94,27 +94,28 @@ export function createEventHook(
94
94
  if (message.role === "assistant") {
95
95
  const assistantMsg = message as AssistantMessage
96
96
 
97
+ // Track model
97
98
  if (assistantMsg.modelID && assistantMsg.providerID) {
98
99
  sessionManager.setModel(assistantMsg.sessionID, {
99
100
  modelID: assistantMsg.modelID,
100
101
  providerID: assistantMsg.providerID,
101
102
  })
102
103
  }
104
+
105
+ // Track agent from mode field
106
+ if (assistantMsg.mode) {
107
+ sessionManager.setAgent(assistantMsg.sessionID, assistantMsg.mode)
108
+ }
103
109
  }
104
110
 
105
111
  return
106
112
  }
107
113
 
108
- // Track token usage and agent from message part events
114
+ // Track token usage from message part events
109
115
  if (event.type === "message.part.updated") {
110
116
  const props = event.properties as MessagePartUpdatedProperties
111
117
  const part = props.part
112
118
 
113
- // Track agent from agent parts (only first agent is stored)
114
- if (part.type === "agent" && part.sessionID && part.name) {
115
- sessionManager.setAgent(part.sessionID, part.name)
116
- }
117
-
118
119
  // Track token usage from step-finish events
119
120
  if (part.type === "step-finish" && part.sessionID && part.tokens) {
120
121
  sessionManager.addTokenUsage(part.sessionID, {