@ramarivera/coding-agent-langfuse 0.1.0 → 0.1.4
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/README.md +13 -0
- package/bin/coding-agent-langfuse.mjs +1 -1
- package/dist/backfill.d.ts +64 -0
- package/dist/backfill.js +1000 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +9 -7
- package/src/backfill.ts +0 -1200
- package/src/index.ts +0 -9
package/README.md
CHANGED
|
@@ -10,3 +10,16 @@ estimated cost details. Tool calls remain child spans under the same session.
|
|
|
10
10
|
```sh
|
|
11
11
|
coding-agent-langfuse-backfill --agents codex,claude,grok,pi,opencode
|
|
12
12
|
```
|
|
13
|
+
|
|
14
|
+
Use the public Langfuse OTLP hostname for real imports from any host:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npx @ramarivera/coding-agent-langfuse@latest \
|
|
18
|
+
--agents claude,codex,grok,pi,opencode \
|
|
19
|
+
--endpoint https://langfuse.ai.roxasroot.net/otel/v1/traces \
|
|
20
|
+
--state "$HOME/.local/state/coding-agent-langfuse/backfill-v6.json" \
|
|
21
|
+
--batch-size 1000
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The importer is fail-fast: the first failed OTLP POST stops the run, prints the
|
|
25
|
+
real network cause, and preserves local state so reruns resume cleanly.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
|
|
4
|
-
const moduleUrl = pathToFileURL(new URL("../
|
|
4
|
+
const moduleUrl = pathToFileURL(new URL("../dist/backfill.js", import.meta.url).pathname);
|
|
5
5
|
const { main } = await import(moduleUrl.href);
|
|
6
6
|
|
|
7
7
|
await main(process.argv.slice(2));
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
type AgentName = "claude" | "codex" | "grok" | "opencode" | "pi";
|
|
3
|
+
type Usage = {
|
|
4
|
+
input?: number;
|
|
5
|
+
output?: number;
|
|
6
|
+
reasoning?: number;
|
|
7
|
+
cacheRead?: number;
|
|
8
|
+
cacheWrite?: number;
|
|
9
|
+
total?: number;
|
|
10
|
+
cost?: number;
|
|
11
|
+
};
|
|
12
|
+
type BackfillEvent = {
|
|
13
|
+
agent: AgentName;
|
|
14
|
+
sourcePath: string;
|
|
15
|
+
sessionId: string;
|
|
16
|
+
recordId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
role?: string;
|
|
19
|
+
model?: string;
|
|
20
|
+
provider?: string;
|
|
21
|
+
cwd?: string;
|
|
22
|
+
startMs: number;
|
|
23
|
+
endMs?: number;
|
|
24
|
+
input?: unknown;
|
|
25
|
+
output?: unknown;
|
|
26
|
+
usage?: Usage;
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
parentRecordId?: string;
|
|
29
|
+
};
|
|
30
|
+
type BackfillOptions = {
|
|
31
|
+
agents: Set<AgentName>;
|
|
32
|
+
endpoint: string;
|
|
33
|
+
statePath: string;
|
|
34
|
+
homeDir: string;
|
|
35
|
+
dryRun: boolean;
|
|
36
|
+
limit?: number;
|
|
37
|
+
sinceMs?: number;
|
|
38
|
+
untilMs?: number;
|
|
39
|
+
batchSize: number;
|
|
40
|
+
};
|
|
41
|
+
type RunSummary = {
|
|
42
|
+
discovered: Record<string, number>;
|
|
43
|
+
sent: number;
|
|
44
|
+
skipped: number;
|
|
45
|
+
failed: number;
|
|
46
|
+
notAttempted: number;
|
|
47
|
+
aborted: boolean;
|
|
48
|
+
error?: string;
|
|
49
|
+
dryRun: boolean;
|
|
50
|
+
endpoint: string;
|
|
51
|
+
statePath: string;
|
|
52
|
+
};
|
|
53
|
+
declare function parseArgs(argv: string[]): BackfillOptions;
|
|
54
|
+
declare function codexEvents(homeDir: string): BackfillEvent[];
|
|
55
|
+
declare function claudeEvents(homeDir: string): BackfillEvent[];
|
|
56
|
+
declare function piEvents(homeDir: string): BackfillEvent[];
|
|
57
|
+
declare function grokEvents(homeDir: string): BackfillEvent[];
|
|
58
|
+
declare function opencodeEvents(homeDir: string, rowLimit?: number): BackfillEvent[];
|
|
59
|
+
declare function fingerprint(event: BackfillEvent): string;
|
|
60
|
+
declare function toOtlp(events: BackfillEvent[]): Record<string, unknown>;
|
|
61
|
+
declare function discoverEvents(options: BackfillOptions): BackfillEvent[];
|
|
62
|
+
declare function run(options: BackfillOptions): Promise<RunSummary>;
|
|
63
|
+
declare function main(argv?: string[]): Promise<RunSummary>;
|
|
64
|
+
export { type BackfillEvent, type BackfillOptions, claudeEvents, codexEvents, discoverEvents, fingerprint, grokEvents, main, opencodeEvents, parseArgs, piEvents, run, toOtlp, };
|