@rachel_rotenberg/ai-contribution-tracker 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/index.ts +8 -3
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -151,11 +151,16 @@ function extractSessionId(event: any): string | null {
151
151
  return i.sessionID || i.session_id || i.id || null;
152
152
  }
153
153
 
154
+ function sanitizeAgentName(name: string): string {
155
+ // Strip zero-width and other invisible Unicode characters that break dashboard parsing
156
+ return name.replace(/[\u200b\u200c\u200d\u200e\u200f\ufeff]/g, "").trim();
157
+ }
158
+
154
159
  function getOrCreateSession(sid: string, agent?: string): SessionState {
155
160
  let sess = sessions.get(sid);
156
161
  if (sess) return sess;
157
162
  // gitDir starts null — resolved ONLY from file paths in tool.execute.after
158
- sess = { gitDir: null, isSubagent: false, agentName: agent ?? "session", pendingPrompts: 0, pendingModels: [], lastTokens: new Map() };
163
+ sess = { gitDir: null, isSubagent: false, agentName: sanitizeAgentName(agent ?? "session"), pendingPrompts: 0, pendingModels: [], lastTokens: new Map() };
159
164
  sessions.set(sid, sess);
160
165
  return sess;
161
166
  }
@@ -191,7 +196,7 @@ const AIContributionTracker: Plugin = async ({ directory, worktree }) => {
191
196
  sessions.set(sid, {
192
197
  gitDir: null, // NEVER resolve from cwd — wait for file paths
193
198
  isSubagent: Boolean(info?.parentID),
194
- agentName: info?.agent ?? "session",
199
+ agentName: sanitizeAgentName(info?.agent ?? "session"),
195
200
  pendingPrompts: 0, pendingModels: [],
196
201
  lastTokens: new Map(),
197
202
  });
@@ -254,7 +259,7 @@ const AIContributionTracker: Plugin = async ({ directory, worktree }) => {
254
259
  } else {
255
260
  // gitDir NOT known yet — buffer in memory
256
261
  sess.pendingPrompts += 1;
257
- if (input.agent) sess.agentName = input.agent;
262
+ if (input.agent) sess.agentName = sanitizeAgentName(input.agent);
258
263
  if (input.model?.modelID && !sess.pendingModels.includes(input.model.modelID)) sess.pendingModels.push(input.model.modelID);
259
264
  }
260
265
  } catch { /* never crash OpenCode */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rachel_rotenberg/ai-contribution-tracker",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "OpenCode plugin \u2014 tracks AI coding sessions and tags git commits with Impacted by AI markers",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",