opencode-otel-plugin 0.1.0 → 0.2.0

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.
@@ -22,5 +22,7 @@ export declare function startFileEditSpan(tracer: Tracer, opts: {
22
22
  linesRemoved: number;
23
23
  sessionID: string;
24
24
  branch?: string;
25
+ gitAuthor?: string;
26
+ repoUrl?: string;
25
27
  }, parentContext?: Context): Span;
26
- export declare function startCompactionSpan(tracer: Tracer, sessionID: string, parentContext?: Context, branch?: string): Span;
28
+ export declare function startCompactionSpan(tracer: Tracer, sessionID: string, parentContext?: Context, branch?: string, gitAuthor?: string, repoUrl?: string): Span;
package/dist/types.d.ts CHANGED
@@ -5,6 +5,7 @@ export interface SessionSpanState {
5
5
  context: Context;
6
6
  sessionID: string;
7
7
  requestCount: number;
8
+ lastActivityAt: number;
8
9
  }
9
10
  /** Model/provider info captured in chat.params, used when ending chat spans. */
10
11
  export interface ChatRequestInfo {
@@ -19,8 +20,13 @@ export interface FileChangeStats {
19
20
  filepath: string;
20
21
  language: string;
21
22
  }
23
+ export interface ToolSpanEntry {
24
+ span: Span;
25
+ sessionID: string;
26
+ createdAt: number;
27
+ }
22
28
  /** In-flight tool span keyed by callID. */
23
- export type ToolSpanMap = Map<string, Span>;
29
+ export type ToolSpanMap = Map<string, ToolSpanEntry>;
24
30
  /** Plugin-wide mutable state shared across hooks. */
25
31
  export interface PluginState {
26
32
  sessionSpans: Map<string, SessionSpanState>;
@@ -28,4 +34,9 @@ export interface PluginState {
28
34
  pendingChatRequests: Map<string, ChatRequestInfo>;
29
35
  currentBranch: string | undefined;
30
36
  opencodeVersion: string | undefined;
37
+ gitAuthor: string | undefined;
38
+ repoUrl: string | undefined;
39
+ sweepInterval?: ReturnType<typeof setInterval>;
40
+ lastFlushTime?: number;
41
+ gitReady: Promise<void>;
31
42
  }
@@ -1,3 +1,4 @@
1
1
  export { detectLanguage } from "./language";
2
2
  export { extractFileChanges } from "./diff";
3
3
  export { getGitAuthor, getRepoUrl, getCurrentBranch, getHostname } from "./git";
4
+ export { truncate } from "./truncate";
@@ -0,0 +1,2 @@
1
+ /** Truncate a string to at most `max` code units, appending `…` if truncated. */
2
+ export declare function truncate(s: string, max?: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-otel-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "OpenTelemetry instrumentation plugin for OpenCode — traces and metrics for AI coding sessions via OTLP/HTTP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,7 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "scripts": {
12
- "build": "bun build ./src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --outDir dist",
12
+ "build": "bun build ./src/index.ts --outdir dist --target bun --minify && tsc --emitDeclarationOnly --outDir dist",
13
13
  "prepublishOnly": "bun run build",
14
14
  "test": "bun test",
15
15
  "typecheck": "tsc --noEmit"
@@ -43,8 +43,7 @@
43
43
  "@opentelemetry/sdk-metrics": "2.6.0",
44
44
  "@opentelemetry/exporter-trace-otlp-http": "0.213.0",
45
45
  "@opentelemetry/exporter-metrics-otlp-http": "0.213.0",
46
- "@opentelemetry/resources": "2.6.0",
47
- "@opentelemetry/semantic-conventions": "1.40.0"
46
+ "@opentelemetry/resources": "2.6.0"
48
47
  },
49
48
  "devDependencies": {
50
49
  "@opencode-ai/plugin": "latest",