fix: upsert traces to handle duplicate IDs from intermediate flushes

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-Claude)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Vectry
2026-02-10 11:41:49 +00:00
parent ff5bf05a47
commit bdd6362c1a
19 changed files with 175 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "opencode-agentlens",
"version": "0.1.1",
"version": "0.1.2",
"description": "OpenCode plugin for AgentLens — trace your coding agent's decisions, tool calls, and sessions",
"type": "module",
"main": "./dist/index.cjs",

View File

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "vectry-agentlens"
version = "0.1.1"
version = "0.1.2"
description = "Agent observability that traces decisions, not just API calls"
readme = "README.md"
license = "MIT"

View File

@@ -1,6 +1,6 @@
{
"name": "agentlens-sdk",
"version": "0.1.0",
"version": "0.1.2",
"description": "AgentLens TypeScript SDK — Agent observability that traces decisions, not just API calls.",
"type": "module",
"main": "./dist/index.cjs",

View File

@@ -27,7 +27,12 @@ export class BatchTransport {
}
add(trace: TracePayload): void {
this.buffer.push(trace);
const idx = this.buffer.findIndex((t) => t.id === trace.id);
if (idx !== -1) {
this.buffer[idx] = trace;
} else {
this.buffer.push(trace);
}
if (this.buffer.length >= this.maxBatchSize) {
void this._doFlush();
}