@raindrop-ai/opencode-plugin 0.1.4 → 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.
package/dist/index.cjs CHANGED
@@ -2337,7 +2337,7 @@ function resolveLocalWorkshopUrl(fileValue) {
2337
2337
  // package.json
2338
2338
  var package_default = {
2339
2339
  name: "@raindrop-ai/opencode-plugin",
2340
- version: "0.1.4",
2340
+ version: "0.2.0",
2341
2341
  description: "Raindrop observability plugin for OpenCode \u2014 automatic session/event/span tracing",
2342
2342
  type: "module",
2343
2343
  main: "dist/index.js",
@@ -2353,6 +2353,11 @@ var package_default = {
2353
2353
  types: "./dist/index.d.ts",
2354
2354
  import: "./dist/index.js",
2355
2355
  require: "./dist/index.cjs"
2356
+ },
2357
+ "./v2": {
2358
+ types: "./dist/v2.d.ts",
2359
+ import: "./dist/v2.js",
2360
+ require: "./dist/v2.cjs"
2356
2361
  }
2357
2362
  },
2358
2363
  sideEffects: false,
@@ -2367,24 +2372,38 @@ var package_default = {
2367
2372
  },
2368
2373
  peerDependencies: {
2369
2374
  "@opencode-ai/plugin": ">=1.3.0",
2370
- "@opencode-ai/sdk": ">=1.3.0"
2375
+ "@opencode-ai/sdk": ">=1.3.0",
2376
+ "@opencode/plugin": ">=2.0.0",
2377
+ "@opencode/sdk": ">=2.0.0"
2371
2378
  },
2372
2379
  peerDependenciesMeta: {
2380
+ "@opencode-ai/plugin": {
2381
+ optional: true
2382
+ },
2373
2383
  "@opencode-ai/sdk": {
2374
2384
  optional: true
2385
+ },
2386
+ "@opencode/plugin": {
2387
+ optional: true
2388
+ },
2389
+ "@opencode/sdk": {
2390
+ optional: true
2375
2391
  }
2376
2392
  },
2377
2393
  devDependencies: {
2378
2394
  "@raindrop-ai/core": "workspace:*",
2379
2395
  "@opencode-ai/plugin": "^1.3.3",
2380
2396
  "@opencode-ai/sdk": "^1.3.3",
2397
+ "@opencode/plugin": "^2.0.10",
2398
+ "@opencode/sdk": "^2.0.10",
2381
2399
  "@types/node": "^20.11.17",
2382
2400
  tsup: "^8.4.0",
2383
2401
  typescript: "^5.3.3"
2384
2402
  },
2385
2403
  tsup: {
2386
2404
  entry: [
2387
- "src/index.ts"
2405
+ "src/index.ts",
2406
+ "src/v2.ts"
2388
2407
  ],
2389
2408
  format: [
2390
2409
  "cjs",
@@ -0,0 +1,89 @@
1
+ /** Kept structural so public integration declarations do not depend on private schemas. */
2
+ type AppGitOptions = {
3
+ commitSha?: string | null;
4
+ commitDirty?: boolean | null;
5
+ branch?: string | null;
6
+ detectBranch?: boolean;
7
+ sourceDirectory?: string;
8
+ autoDetect?: boolean;
9
+ };
10
+ type IdentifyInput = {
11
+ userId: string;
12
+ traits?: Record<string, unknown>;
13
+ };
14
+ type SignalInput = {
15
+ eventId: string;
16
+ name: string;
17
+ type?: "default" | "feedback" | "edit" | "standard" | "agent" | "agent_internal";
18
+ sentiment?: "POSITIVE" | "NEGATIVE";
19
+ timestamp?: string;
20
+ properties?: Record<string, unknown>;
21
+ attachmentId?: string;
22
+ comment?: string;
23
+ after?: string;
24
+ };
25
+
26
+ /**
27
+ * Run telemetry egress with OpenTelemetry tracing suppressed.
28
+ *
29
+ * Why this exists
30
+ * ---------------
31
+ * Raindrop integrations ship spans/events over HTTP with the global `fetch`
32
+ * (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
33
+ * fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
34
+ * every Eve agent installs — that instrumentation wraps *our own* telemetry
35
+ * POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
36
+ * very exporter that issued the request, so they get shipped right back to
37
+ * Raindrop and Workshop as standalone "runs" (and, because each export issues
38
+ * another fetch, they feed back on themselves). The result is a run list
39
+ * flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
40
+ * `.../live` entries that drown out the real agent turns — especially with
41
+ * sub-agents, where every sandbox runs its own instrumentation.
42
+ *
43
+ * The OTel-blessed fix is to mark the active context as "tracing suppressed"
44
+ * around the request; instrumentations check `isTracingSuppressed` and return
45
+ * a no-op span instead of recording one. We do this through a hook stashed on
46
+ * `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
47
+ * - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
48
+ * hard-depends on them, and the hook is simply absent when they (and thus
49
+ * any instrumentation to suppress) are not installed; and
50
+ * - the browser bundle never pulls in `node:module`, mirroring how core
51
+ * injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
52
+ *
53
+ * When no hook is present the callback runs unchanged, so suppression is a
54
+ * best-effort no-op rather than a hard requirement.
55
+ */
56
+ /** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
57
+ type SuppressTracingHook = <T>(fn: () => T) => T;
58
+ declare global {
59
+ var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
60
+ }
61
+
62
+ type ParentSpanContext = {
63
+ traceIdB64: string;
64
+ spanIdB64: string;
65
+ eventId: string;
66
+ };
67
+ interface ContextSpan {
68
+ readonly traceIdB64: string;
69
+ readonly spanIdB64: string;
70
+ readonly eventId: string;
71
+ log?(data: Record<string, unknown>): void;
72
+ }
73
+ interface AsyncLocalStorageLike<T> {
74
+ getStore(): T | undefined;
75
+ run<R>(store: T, callback: () => R): R;
76
+ enterWith?(store: T): void;
77
+ }
78
+ declare abstract class ContextManager {
79
+ abstract getParentSpanIds(): ParentSpanContext | undefined;
80
+ abstract runInContext<R>(span: ContextSpan, callback: () => R): R;
81
+ abstract getCurrentSpan(): ContextSpan | undefined;
82
+ abstract isReady(): boolean;
83
+ }
84
+ declare global {
85
+ var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
86
+ var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
87
+ }
88
+
89
+ export type { AppGitOptions as A, IdentifyInput as I, SignalInput as S };
@@ -0,0 +1,89 @@
1
+ /** Kept structural so public integration declarations do not depend on private schemas. */
2
+ type AppGitOptions = {
3
+ commitSha?: string | null;
4
+ commitDirty?: boolean | null;
5
+ branch?: string | null;
6
+ detectBranch?: boolean;
7
+ sourceDirectory?: string;
8
+ autoDetect?: boolean;
9
+ };
10
+ type IdentifyInput = {
11
+ userId: string;
12
+ traits?: Record<string, unknown>;
13
+ };
14
+ type SignalInput = {
15
+ eventId: string;
16
+ name: string;
17
+ type?: "default" | "feedback" | "edit" | "standard" | "agent" | "agent_internal";
18
+ sentiment?: "POSITIVE" | "NEGATIVE";
19
+ timestamp?: string;
20
+ properties?: Record<string, unknown>;
21
+ attachmentId?: string;
22
+ comment?: string;
23
+ after?: string;
24
+ };
25
+
26
+ /**
27
+ * Run telemetry egress with OpenTelemetry tracing suppressed.
28
+ *
29
+ * Why this exists
30
+ * ---------------
31
+ * Raindrop integrations ship spans/events over HTTP with the global `fetch`
32
+ * (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
33
+ * fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
34
+ * every Eve agent installs — that instrumentation wraps *our own* telemetry
35
+ * POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
36
+ * very exporter that issued the request, so they get shipped right back to
37
+ * Raindrop and Workshop as standalone "runs" (and, because each export issues
38
+ * another fetch, they feed back on themselves). The result is a run list
39
+ * flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
40
+ * `.../live` entries that drown out the real agent turns — especially with
41
+ * sub-agents, where every sandbox runs its own instrumentation.
42
+ *
43
+ * The OTel-blessed fix is to mark the active context as "tracing suppressed"
44
+ * around the request; instrumentations check `isTracingSuppressed` and return
45
+ * a no-op span instead of recording one. We do this through a hook stashed on
46
+ * `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
47
+ * - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
48
+ * hard-depends on them, and the hook is simply absent when they (and thus
49
+ * any instrumentation to suppress) are not installed; and
50
+ * - the browser bundle never pulls in `node:module`, mirroring how core
51
+ * injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
52
+ *
53
+ * When no hook is present the callback runs unchanged, so suppression is a
54
+ * best-effort no-op rather than a hard requirement.
55
+ */
56
+ /** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
57
+ type SuppressTracingHook = <T>(fn: () => T) => T;
58
+ declare global {
59
+ var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
60
+ }
61
+
62
+ type ParentSpanContext = {
63
+ traceIdB64: string;
64
+ spanIdB64: string;
65
+ eventId: string;
66
+ };
67
+ interface ContextSpan {
68
+ readonly traceIdB64: string;
69
+ readonly spanIdB64: string;
70
+ readonly eventId: string;
71
+ log?(data: Record<string, unknown>): void;
72
+ }
73
+ interface AsyncLocalStorageLike<T> {
74
+ getStore(): T | undefined;
75
+ run<R>(store: T, callback: () => R): R;
76
+ enterWith?(store: T): void;
77
+ }
78
+ declare abstract class ContextManager {
79
+ abstract getParentSpanIds(): ParentSpanContext | undefined;
80
+ abstract runInContext<R>(span: ContextSpan, callback: () => R): R;
81
+ abstract getCurrentSpan(): ContextSpan | undefined;
82
+ abstract isReady(): boolean;
83
+ }
84
+ declare global {
85
+ var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
86
+ var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
87
+ }
88
+
89
+ export type { AppGitOptions as A, IdentifyInput as I, SignalInput as S };
package/dist/index.d.cts CHANGED
@@ -1,82 +1,6 @@
1
+ import { I as IdentifyInput, A as AppGitOptions } from './index.d-vgBcEZbX.cjs';
1
2
  import { Hooks, PluginInput } from '@opencode-ai/plugin';
2
3
 
3
- /** Kept structural so public integration declarations do not depend on private schemas. */
4
- type AppGitOptions = {
5
- commitSha?: string | null;
6
- commitDirty?: boolean | null;
7
- branch?: string | null;
8
- detectBranch?: boolean;
9
- sourceDirectory?: string;
10
- autoDetect?: boolean;
11
- };
12
- type IdentifyInput = {
13
- userId: string;
14
- traits?: Record<string, unknown>;
15
- };
16
-
17
- /**
18
- * Run telemetry egress with OpenTelemetry tracing suppressed.
19
- *
20
- * Why this exists
21
- * ---------------
22
- * Raindrop integrations ship spans/events over HTTP with the global `fetch`
23
- * (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
24
- * fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
25
- * every Eve agent installs — that instrumentation wraps *our own* telemetry
26
- * POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
27
- * very exporter that issued the request, so they get shipped right back to
28
- * Raindrop and Workshop as standalone "runs" (and, because each export issues
29
- * another fetch, they feed back on themselves). The result is a run list
30
- * flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
31
- * `.../live` entries that drown out the real agent turns — especially with
32
- * sub-agents, where every sandbox runs its own instrumentation.
33
- *
34
- * The OTel-blessed fix is to mark the active context as "tracing suppressed"
35
- * around the request; instrumentations check `isTracingSuppressed` and return
36
- * a no-op span instead of recording one. We do this through a hook stashed on
37
- * `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
38
- * - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
39
- * hard-depends on them, and the hook is simply absent when they (and thus
40
- * any instrumentation to suppress) are not installed; and
41
- * - the browser bundle never pulls in `node:module`, mirroring how core
42
- * injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
43
- *
44
- * When no hook is present the callback runs unchanged, so suppression is a
45
- * best-effort no-op rather than a hard requirement.
46
- */
47
- /** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
48
- type SuppressTracingHook = <T>(fn: () => T) => T;
49
- declare global {
50
- var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
51
- }
52
-
53
- type ParentSpanContext = {
54
- traceIdB64: string;
55
- spanIdB64: string;
56
- eventId: string;
57
- };
58
- interface ContextSpan {
59
- readonly traceIdB64: string;
60
- readonly spanIdB64: string;
61
- readonly eventId: string;
62
- log?(data: Record<string, unknown>): void;
63
- }
64
- interface AsyncLocalStorageLike<T> {
65
- getStore(): T | undefined;
66
- run<R>(store: T, callback: () => R): R;
67
- enterWith?(store: T): void;
68
- }
69
- declare abstract class ContextManager {
70
- abstract getParentSpanIds(): ParentSpanContext | undefined;
71
- abstract runInContext<R>(span: ContextSpan, callback: () => R): R;
72
- abstract getCurrentSpan(): ContextSpan | undefined;
73
- abstract isReady(): boolean;
74
- }
75
- declare global {
76
- var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
77
- var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
78
- }
79
-
80
4
  interface RaindropOpencodeOptions {
81
5
  /** Application Git identity override. false disables enrichment. */
82
6
  appGit?: AppGitOptions | false;
@@ -129,4 +53,4 @@ type RaindropOpencodeHooks = Hooks & {
129
53
  */
130
54
  declare function plugin(input: PluginInput, opts?: RaindropOpencodeOptions): Promise<RaindropOpencodeHooks>;
131
55
 
132
- export { type IdentifyInput, type RaindropOpencodeHandle, type RaindropOpencodeHooks, type RaindropOpencodeOptions, plugin as default };
56
+ export { IdentifyInput, type RaindropOpencodeHandle, type RaindropOpencodeHooks, type RaindropOpencodeOptions, plugin as default };
package/dist/index.d.ts CHANGED
@@ -1,82 +1,6 @@
1
+ import { I as IdentifyInput, A as AppGitOptions } from './index.d-vgBcEZbX.js';
1
2
  import { Hooks, PluginInput } from '@opencode-ai/plugin';
2
3
 
3
- /** Kept structural so public integration declarations do not depend on private schemas. */
4
- type AppGitOptions = {
5
- commitSha?: string | null;
6
- commitDirty?: boolean | null;
7
- branch?: string | null;
8
- detectBranch?: boolean;
9
- sourceDirectory?: string;
10
- autoDetect?: boolean;
11
- };
12
- type IdentifyInput = {
13
- userId: string;
14
- traits?: Record<string, unknown>;
15
- };
16
-
17
- /**
18
- * Run telemetry egress with OpenTelemetry tracing suppressed.
19
- *
20
- * Why this exists
21
- * ---------------
22
- * Raindrop integrations ship spans/events over HTTP with the global `fetch`
23
- * (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
24
- * fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
25
- * every Eve agent installs — that instrumentation wraps *our own* telemetry
26
- * POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
27
- * very exporter that issued the request, so they get shipped right back to
28
- * Raindrop and Workshop as standalone "runs" (and, because each export issues
29
- * another fetch, they feed back on themselves). The result is a run list
30
- * flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
31
- * `.../live` entries that drown out the real agent turns — especially with
32
- * sub-agents, where every sandbox runs its own instrumentation.
33
- *
34
- * The OTel-blessed fix is to mark the active context as "tracing suppressed"
35
- * around the request; instrumentations check `isTracingSuppressed` and return
36
- * a no-op span instead of recording one. We do this through a hook stashed on
37
- * `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
38
- * - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
39
- * hard-depends on them, and the hook is simply absent when they (and thus
40
- * any instrumentation to suppress) are not installed; and
41
- * - the browser bundle never pulls in `node:module`, mirroring how core
42
- * injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
43
- *
44
- * When no hook is present the callback runs unchanged, so suppression is a
45
- * best-effort no-op rather than a hard requirement.
46
- */
47
- /** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
48
- type SuppressTracingHook = <T>(fn: () => T) => T;
49
- declare global {
50
- var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
51
- }
52
-
53
- type ParentSpanContext = {
54
- traceIdB64: string;
55
- spanIdB64: string;
56
- eventId: string;
57
- };
58
- interface ContextSpan {
59
- readonly traceIdB64: string;
60
- readonly spanIdB64: string;
61
- readonly eventId: string;
62
- log?(data: Record<string, unknown>): void;
63
- }
64
- interface AsyncLocalStorageLike<T> {
65
- getStore(): T | undefined;
66
- run<R>(store: T, callback: () => R): R;
67
- enterWith?(store: T): void;
68
- }
69
- declare abstract class ContextManager {
70
- abstract getParentSpanIds(): ParentSpanContext | undefined;
71
- abstract runInContext<R>(span: ContextSpan, callback: () => R): R;
72
- abstract getCurrentSpan(): ContextSpan | undefined;
73
- abstract isReady(): boolean;
74
- }
75
- declare global {
76
- var RAINDROP_CONTEXT_MANAGER: (new () => ContextManager) | undefined;
77
- var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => AsyncLocalStorageLike<T>) | undefined;
78
- }
79
-
80
4
  interface RaindropOpencodeOptions {
81
5
  /** Application Git identity override. false disables enrichment. */
82
6
  appGit?: AppGitOptions | false;
@@ -129,4 +53,4 @@ type RaindropOpencodeHooks = Hooks & {
129
53
  */
130
54
  declare function plugin(input: PluginInput, opts?: RaindropOpencodeOptions): Promise<RaindropOpencodeHooks>;
131
55
 
132
- export { type IdentifyInput, type RaindropOpencodeHandle, type RaindropOpencodeHooks, type RaindropOpencodeOptions, plugin as default };
56
+ export { IdentifyInput, type RaindropOpencodeHandle, type RaindropOpencodeHooks, type RaindropOpencodeOptions, plugin as default };