@raindrop-ai/opencode-plugin 0.2.0 → 0.3.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/v2.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  EventShipper,
3
3
  PLUGIN_NAME,
4
4
  PLUGIN_VERSION,
5
+ SELF_DIAGNOSTICS_ACK,
5
6
  TraceShipper,
6
7
  attrString,
7
8
  boundedStringify,
@@ -10,8 +11,11 @@ import {
10
11
  createAppGitContext,
11
12
  generateId,
12
13
  loadConfig,
13
- resolveLocalDebuggerBaseUrl
14
- } from "./chunk-4DAI6CYK.js";
14
+ normalizeSelfDiagnosticsConfig,
15
+ resolveLocalDebuggerBaseUrl,
16
+ selfDiagnosticsInputJsonSchema,
17
+ trackSelfDiagnosticsSignal
18
+ } from "./chunk-FCORH4YS.js";
15
19
 
16
20
  // src/v2.ts
17
21
  import { Plugin } from "@opencode/plugin";
@@ -654,7 +658,7 @@ function raindrop(opts = {}) {
654
658
  }
655
659
  }
656
660
  function createShared(ctx) {
657
- var _a, _b, _c;
661
+ var _a, _b, _c, _d;
658
662
  const config = loadConfig((_a = opts.directory) != null ? _a : ctx.location.directory);
659
663
  const resolvedLocalUrl = resolveLocalDebuggerBaseUrl(config.localWorkshopUrl);
660
664
  const hasLocalDestination = resolvedLocalUrl !== null;
@@ -687,9 +691,20 @@ function raindrop(opts = {}) {
687
691
  };
688
692
  const eventShipper = new EventShipper(shipperOptions);
689
693
  const traceShipper = new TraceShipper(shipperOptions);
694
+ const selfDiagnostics = normalizeSelfDiagnosticsConfig(
695
+ (_d = opts.selfDiagnostics) != null ? _d : config.selfDiagnostics
696
+ );
697
+ if (selfDiagnostics && !config.writeKey.trim()) {
698
+ appLog(
699
+ "warn",
700
+ `selfDiagnostics enabled but RAINDROP_WRITE_KEY is not set \u2014 the ${selfDiagnostics.toolName} tool is not registered (signals require the cloud destination).`
701
+ );
702
+ }
690
703
  const s = {
691
704
  eventShipper,
692
705
  traceShipper,
706
+ config,
707
+ selfDiagnostics: config.writeKey.trim() ? selfDiagnostics : void 0,
693
708
  appGitContext,
694
709
  abort: new AbortController(),
695
710
  instances: /* @__PURE__ */ new Set(),
@@ -741,6 +756,34 @@ function raindrop(opts = {}) {
741
756
  const directory = ctx.location.directory;
742
757
  instance.disposables.push(await ctx.session.hook("prompt", (e) => runtime.onPrompt(e, directory)));
743
758
  instance.disposables.push(await ctx.session.hook("context", (e) => runtime.onContext(e)));
759
+ const selfDiagnostics = s.selfDiagnostics;
760
+ if (selfDiagnostics) {
761
+ const cfg = selfDiagnostics;
762
+ const eventShipper = s.eventShipper;
763
+ const debug = s.config.debug;
764
+ instance.disposables.push(
765
+ await ctx.tool.transform(
766
+ (editor) => editor.add({
767
+ name: cfg.toolName,
768
+ description: cfg.toolDescription,
769
+ input: selfDiagnosticsInputJsonSchema(cfg),
770
+ // Direct tool — the host routes everything else through the
771
+ // codemode `execute` wrapper, where this name isn't callable.
772
+ options: { codemode: false },
773
+ async execute(input, context) {
774
+ await trackSelfDiagnosticsSignal(
775
+ input,
776
+ cfg,
777
+ eventShipper,
778
+ runtime.currentEventId(context.sessionID),
779
+ debug
780
+ );
781
+ return { content: SELF_DIAGNOSTICS_ACK };
782
+ }
783
+ })
784
+ )
785
+ );
786
+ }
744
787
  if (isFirst) void runEventLoop(s);
745
788
  const owner = s;
746
789
  return async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raindrop-ai/opencode-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Raindrop observability plugin for OpenCode — automatic session/event/span tracing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",