@rachel_rotenberg/ai-contribution-tracker 1.0.9 → 1.0.11

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 +4 -3
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -48,7 +48,7 @@ function loadState(g: string): TrackerState {
48
48
  const p = getStatePath(g);
49
49
  if (fs.existsSync(p)) { try {
50
50
  const s = JSON.parse(fs.readFileSync(p, "utf8")) as TrackerState;
51
- s.mainAgentTypes = (s.mainAgentTypes ?? []).map((a: string) => a.replace(/[\p{Cf}]/gu, "")); s.subagentTypes ??= []; s.models ??= []; s.subagentModels ??= []; s.tokensByModel ??= {};
51
+ s.mainAgentTypes = (s.mainAgentTypes ?? []).map((a: string) => [...a].filter(c => c.charCodeAt(0) < 128 || c.charCodeAt(0) > 255).join("")); s.subagentTypes ??= []; s.models ??= []; s.subagentModels ??= []; s.tokensByModel ??= {};
52
52
  if (typeof s.subagentCount !== "number") s.subagentCount = 0;
53
53
  if (typeof s.activeSubagents !== "number") s.activeSubagents = 0;
54
54
  if (typeof s.stateCreatedAt !== "string") s.stateCreatedAt = s.lastUpdated || new Date().toISOString();
@@ -89,7 +89,7 @@ function writeFlag(g: string, s: TrackerState) {
89
89
  }
90
90
  // Always overwrite with latest state — state only grows, never shrinks
91
91
  }
92
- fs.writeFileSync(fp, marker.replace(/[\p{Cf}]/gu, ""));
92
+ fs.writeFileSync(fp, [...marker].filter(c => c.charCodeAt(0) < 128 || c.charCodeAt(0) > 255).join(""));
93
93
  }
94
94
 
95
95
  // ─── Plugin ─────────────────────────────────────────────────
@@ -153,7 +153,7 @@ function extractSessionId(event: any): string | null {
153
153
 
154
154
  function sanitizeAgentName(name: string): string {
155
155
  // Strip zero-width and other invisible Unicode characters that break dashboard parsing
156
- return name.replace(/[\p{Cf}]/gu, "").trim();
156
+ return [...name].filter(c => c.charCodeAt(0) < 128 || c.charCodeAt(0) > 255).join("").trim();
157
157
  }
158
158
 
159
159
  function getOrCreateSession(sid: string, agent?: string): SessionState {
@@ -290,6 +290,7 @@ const AIContributionTracker: Plugin = async ({ directory, worktree }) => {
290
290
  state.subagentCount += 1;
291
291
  if (!state.subagentTypes.includes(agentType)) state.subagentTypes.push(agentType);
292
292
  saveState(sess.gitDir, state);
293
+ writeFlag(sess.gitDir, state);
293
294
  writeFlag(sess.gitDir, state); // keep flag current for commit-before-idle
294
295
  }
295
296
  } 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.9",
3
+ "version": "1.0.11",
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",