@rachel_rotenberg/ai-contribution-tracker 1.0.11 → 1.0.13
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/index.ts +5 -4
- 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) =>
|
|
51
|
+
s.mainAgentTypes = (s.mainAgentTypes ?? []).map((a: string) => a.replace(/[\p{Cf}]/gu, "")); 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();
|
|
@@ -84,12 +84,13 @@ function writeFlag(g: string, s: TrackerState) {
|
|
|
84
84
|
if (ex.includes("Inline")) {
|
|
85
85
|
// Merge: preserve Inline marker, add agent data
|
|
86
86
|
const inner = marker.match(/\((.+)\)$/)?.[1];
|
|
87
|
-
|
|
87
|
+
const merged = inner ? `Impacted by AI (Inline + ${inner})` : "Impacted by AI (Inline)";
|
|
88
|
+
fs.writeFileSync(fp, merged.replace(/[^\x20-\x7E\n]/g, ""));
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
// Always overwrite with latest state — state only grows, never shrinks
|
|
91
92
|
}
|
|
92
|
-
fs.writeFileSync(fp,
|
|
93
|
+
fs.writeFileSync(fp, marker.replace(/[^\x20-\x7E\n]/g, ""));
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
// ─── Plugin ─────────────────────────────────────────────────
|
|
@@ -153,7 +154,7 @@ function extractSessionId(event: any): string | null {
|
|
|
153
154
|
|
|
154
155
|
function sanitizeAgentName(name: string): string {
|
|
155
156
|
// Strip zero-width and other invisible Unicode characters that break dashboard parsing
|
|
156
|
-
return
|
|
157
|
+
return name.replace(/[\p{Cf}]/gu, "").trim();
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
function getOrCreateSession(sid: string, agent?: string): SessionState {
|
package/package.json
CHANGED