@techdivision/opencode-time-tracking 0.4.0 → 0.5.0
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 +1 -1
- package/src/Plugin.ts +1 -1
- package/src/hooks/EventHook.ts +14 -1
- package/src/types/TimeTrackingConfig.ts +9 -0
package/package.json
CHANGED
package/src/Plugin.ts
CHANGED
|
@@ -69,7 +69,7 @@ export const plugin: Plugin = async ({
|
|
|
69
69
|
sessionManager,
|
|
70
70
|
ticketExtractor
|
|
71
71
|
),
|
|
72
|
-
event: createEventHook(sessionManager, csvWriter, client, ticketResolver),
|
|
72
|
+
event: createEventHook(sessionManager, csvWriter, client, ticketResolver, config),
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return hooks
|
package/src/hooks/EventHook.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { TicketResolver } from "../services/TicketResolver"
|
|
|
10
10
|
import type { MessagePartUpdatedProperties } from "../types/MessagePartUpdatedProperties"
|
|
11
11
|
import type { MessageWithParts } from "../types/MessageWithParts"
|
|
12
12
|
import type { OpencodeClient } from "../types/OpencodeClient"
|
|
13
|
+
import type { TimeTrackingConfig } from "../types/TimeTrackingConfig"
|
|
13
14
|
|
|
14
15
|
import { DescriptionGenerator } from "../utils/DescriptionGenerator"
|
|
15
16
|
|
|
@@ -85,7 +86,8 @@ export function createEventHook(
|
|
|
85
86
|
sessionManager: SessionManager,
|
|
86
87
|
csvWriter: CsvWriter,
|
|
87
88
|
client: OpencodeClient,
|
|
88
|
-
ticketResolver: TicketResolver
|
|
89
|
+
ticketResolver: TicketResolver,
|
|
90
|
+
config: TimeTrackingConfig
|
|
89
91
|
) {
|
|
90
92
|
return async ({ event }: { event: Event }): Promise<void> => {
|
|
91
93
|
// Track model and agent from assistant messages
|
|
@@ -190,6 +192,17 @@ export function createEventHook(
|
|
|
190
192
|
// Get agent name if available
|
|
191
193
|
const agentString = session.agent?.name ?? null
|
|
192
194
|
|
|
195
|
+
// Check if agent should be ignored
|
|
196
|
+
if (agentString && config.ignored_agents?.includes(agentString)) {
|
|
197
|
+
await client.tui.showToast({
|
|
198
|
+
body: {
|
|
199
|
+
message: `Time tracking skipped for ${agentString} (ignored agent)`,
|
|
200
|
+
variant: "info",
|
|
201
|
+
},
|
|
202
|
+
})
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
|
|
193
206
|
// Resolve ticket and account key with fallback hierarchy
|
|
194
207
|
const resolved = await ticketResolver.resolve(sessionID, agentString)
|
|
195
208
|
|
|
@@ -45,6 +45,15 @@ export interface TimeTrackingJsonConfig {
|
|
|
45
45
|
* default is configured.
|
|
46
46
|
*/
|
|
47
47
|
global_default?: GlobalDefaultConfig
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* List of agent names to ignore for time tracking.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Sessions triggered by these agents will not be exported to CSV.
|
|
54
|
+
* Agent names should include the "@" prefix (e.g., "@internal").
|
|
55
|
+
*/
|
|
56
|
+
ignored_agents?: string[]
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
/**
|