fix: plugin event shape mismatches, nav highlight bug, and README update

- Fix session.created/deleted reading props.info.id instead of props.id
- Fix session.diff reading FileDiff[] array instead of string
- Fix file.edited reading props.file instead of props.filePath
- Add auto-session creation fallback from tool/chat hooks
- Add flushSession() for intermediate trace sends on session.idle
- Fix dashboard nav: /dashboard exact match prevents false active state
- Update README with TypeScript SDK and OpenCode plugin sections
This commit is contained in:
Vectry
2026-02-10 11:23:33 +00:00
parent 5b388484f8
commit dcc32f36d3
5 changed files with 196 additions and 33 deletions

View File

@@ -4,6 +4,7 @@ import {
SpanStatus,
DecisionType,
nowISO,
getClient,
} from "agentlens-sdk";
import type { JsonValue, TraceStatus } from "agentlens-sdk";
import { extractToolMetadata, safeJsonValue } from "./utils.js";
@@ -180,4 +181,22 @@ export class SessionState {
getRootSpanId(sessionId: string): string | undefined {
return this.rootSpans.get(sessionId);
}
getActiveSessionIds(): string[] {
return Array.from(this.traces.keys());
}
/**
* Send the current trace state without ending the session.
* This creates a snapshot so data isn't lost if the process exits unexpectedly.
*/
flushSession(sessionId: string): void {
const trace = this.traces.get(sessionId);
if (!trace) return;
const transport = getClient();
if (transport) {
transport.add(trace.toPayload());
}
}
}