@raindrop-ai/claude-code 0.0.3 → 0.0.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/dist/cli.js CHANGED
@@ -653,7 +653,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
653
653
 
654
654
  // src/package-info.ts
655
655
  var PACKAGE_NAME = "@raindrop-ai/claude-code";
656
- var PACKAGE_VERSION = "0.0.1";
656
+ var PACKAGE_VERSION = "0.0.4";
657
657
 
658
658
  // src/shipper.ts
659
659
  var EventShipper2 = class extends EventShipper {
@@ -796,6 +796,7 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
796
796
  var _a;
797
797
  const convoId = payload.session_id;
798
798
  const baseProperties = {
799
+ ...config.customProperties,
799
800
  cwd: payload.cwd,
800
801
  permission_mode: payload.permission_mode,
801
802
  plugin_version: PACKAGE_VERSION,
@@ -870,7 +871,7 @@ async function handleUserPromptSubmit(payload, convoId, config, properties, even
870
871
  isPending: true,
871
872
  userId: config.userId,
872
873
  convoId,
873
- eventName: "claude_code_session",
874
+ eventName: config.eventName,
874
875
  input: payload.prompt,
875
876
  model,
876
877
  properties
@@ -990,7 +991,7 @@ async function handlePostCompact(payload, eventId, config, properties, eventShip
990
991
  isPending: true,
991
992
  userId: config.userId,
992
993
  convoId: payload.session_id,
993
- eventName: "claude_code_session",
994
+ eventName: config.eventName,
994
995
  properties: {
995
996
  ...properties,
996
997
  compaction_trigger: payload.trigger,
@@ -999,15 +1000,19 @@ async function handlePostCompact(payload, eventId, config, properties, eventShip
999
1000
  });
1000
1001
  }
1001
1002
  async function handleStop(payload, eventId, config, properties, eventShipper) {
1002
- await eventShipper.finish(eventId, {
1003
+ await eventShipper.patch(eventId, {
1004
+ isPending: false,
1003
1005
  userId: config.userId,
1006
+ eventName: config.eventName,
1004
1007
  output: payload.last_assistant_message,
1005
1008
  properties
1006
1009
  });
1007
1010
  }
1008
1011
  async function handleStopFailure(payload, eventId, config, properties, eventShipper) {
1009
- await eventShipper.finish(eventId, {
1012
+ await eventShipper.patch(eventId, {
1013
+ isPending: false,
1010
1014
  userId: config.userId,
1015
+ eventName: config.eventName,
1011
1016
  output: payload.last_assistant_message,
1012
1017
  properties: {
1013
1018
  ...properties,
@@ -1017,8 +1022,10 @@ async function handleStopFailure(payload, eventId, config, properties, eventShip
1017
1022
  });
1018
1023
  }
1019
1024
  async function handleSessionEnd(payload, eventId, config, properties, eventShipper) {
1020
- await eventShipper.finish(eventId, {
1025
+ await eventShipper.patch(eventId, {
1026
+ isPending: false,
1021
1027
  userId: config.userId,
1028
+ eventName: config.eventName,
1022
1029
  properties: {
1023
1030
  ...properties,
1024
1031
  session_end_reason: payload.reason
@@ -1032,7 +1039,7 @@ import { homedir, userInfo } from "os";
1032
1039
  import { dirname, join as join2 } from "path";
1033
1040
  var CONFIG_PATH = join2(homedir(), ".config", "raindrop", "config.json");
1034
1041
  function loadConfig() {
1035
- var _a, _b, _c, _d, _e, _f, _g, _h;
1042
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1036
1043
  let file = {};
1037
1044
  try {
1038
1045
  if (existsSync2(CONFIG_PATH)) {
@@ -1047,12 +1054,25 @@ function loadConfig() {
1047
1054
  return "unknown";
1048
1055
  }
1049
1056
  })();
1057
+ let customProperties = (_a = file.custom_properties) != null ? _a : {};
1058
+ const envProps = process.env["RAINDROP_PROPERTIES"];
1059
+ if (envProps) {
1060
+ try {
1061
+ const parsed = JSON.parse(envProps);
1062
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
1063
+ customProperties = { ...customProperties, ...parsed };
1064
+ }
1065
+ } catch (e) {
1066
+ }
1067
+ }
1050
1068
  return {
1051
- writeKey: (_b = (_a = process.env["RAINDROP_WRITE_KEY"]) != null ? _a : file.write_key) != null ? _b : "",
1052
- endpoint: (_d = (_c = process.env["RAINDROP_API_URL"]) != null ? _c : file.api_url) != null ? _d : "https://api.raindrop.ai/v1",
1053
- userId: (_f = (_e = process.env["RAINDROP_USER_ID"]) != null ? _e : file.user_id) != null ? _f : systemUser,
1054
- debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_g = file.debug) != null ? _g : false,
1055
- enabled: (_h = file.enabled) != null ? _h : true
1069
+ writeKey: (_c = (_b = process.env["RAINDROP_WRITE_KEY"]) != null ? _b : file.write_key) != null ? _c : "",
1070
+ endpoint: (_e = (_d = process.env["RAINDROP_API_URL"]) != null ? _d : file.api_url) != null ? _e : "https://api.raindrop.ai/v1",
1071
+ userId: (_g = (_f = process.env["RAINDROP_USER_ID"]) != null ? _f : file.user_id) != null ? _g : systemUser,
1072
+ debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_h = file.debug) != null ? _h : false,
1073
+ enabled: (_i = file.enabled) != null ? _i : true,
1074
+ eventName: (_k = (_j = process.env["RAINDROP_EVENT_NAME"]) != null ? _j : file.event_name) != null ? _k : "claude_code_session",
1075
+ customProperties
1056
1076
  };
1057
1077
  }
1058
1078
  function getConfigPath() {
@@ -1223,7 +1243,9 @@ async function handleHook() {
1223
1243
  }
1224
1244
  const mapperConfig = {
1225
1245
  userId: config.userId,
1226
- debug: config.debug
1246
+ debug: config.debug,
1247
+ eventName: config.eventName,
1248
+ customProperties: config.customProperties
1227
1249
  };
1228
1250
  const eventShipper = new EventShipper2({
1229
1251
  writeKey: config.writeKey,
@@ -1569,6 +1591,8 @@ async function main() {
1569
1591
  Environment:
1570
1592
  RAINDROP_WRITE_KEY API write key (alternative to --write-key or config file)
1571
1593
  RAINDROP_USER_ID User ID override
1594
+ RAINDROP_EVENT_NAME Custom event name (default: "claude_code_session")
1595
+ RAINDROP_PROPERTIES JSON object merged into every event's properties
1572
1596
  RAINDROP_API_URL Custom API endpoint
1573
1597
  RAINDROP_LOCAL_DEBUGGER Local debugger URL (auto-detected if running on :5899)
1574
1598
  RAINDROP_DEBUG Set to "true" for verbose logging
package/dist/index.cjs CHANGED
@@ -680,7 +680,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = import_async_hooks.AsyncLocalStorage;
680
680
 
681
681
  // src/package-info.ts
682
682
  var PACKAGE_NAME = "@raindrop-ai/claude-code";
683
- var PACKAGE_VERSION = "0.0.1";
683
+ var PACKAGE_VERSION = "0.0.4";
684
684
 
685
685
  // src/shipper.ts
686
686
  var EventShipper2 = class extends EventShipper {
@@ -723,7 +723,7 @@ var import_node_os = require("os");
723
723
  var import_node_path = require("path");
724
724
  var CONFIG_PATH = (0, import_node_path.join)((0, import_node_os.homedir)(), ".config", "raindrop", "config.json");
725
725
  function loadConfig() {
726
- var _a, _b, _c, _d, _e, _f, _g, _h;
726
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
727
727
  let file = {};
728
728
  try {
729
729
  if ((0, import_node_fs.existsSync)(CONFIG_PATH)) {
@@ -738,12 +738,25 @@ function loadConfig() {
738
738
  return "unknown";
739
739
  }
740
740
  })();
741
+ let customProperties = (_a = file.custom_properties) != null ? _a : {};
742
+ const envProps = process.env["RAINDROP_PROPERTIES"];
743
+ if (envProps) {
744
+ try {
745
+ const parsed = JSON.parse(envProps);
746
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
747
+ customProperties = { ...customProperties, ...parsed };
748
+ }
749
+ } catch (e) {
750
+ }
751
+ }
741
752
  return {
742
- writeKey: (_b = (_a = process.env["RAINDROP_WRITE_KEY"]) != null ? _a : file.write_key) != null ? _b : "",
743
- endpoint: (_d = (_c = process.env["RAINDROP_API_URL"]) != null ? _c : file.api_url) != null ? _d : "https://api.raindrop.ai/v1",
744
- userId: (_f = (_e = process.env["RAINDROP_USER_ID"]) != null ? _e : file.user_id) != null ? _f : systemUser,
745
- debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_g = file.debug) != null ? _g : false,
746
- enabled: (_h = file.enabled) != null ? _h : true
753
+ writeKey: (_c = (_b = process.env["RAINDROP_WRITE_KEY"]) != null ? _b : file.write_key) != null ? _c : "",
754
+ endpoint: (_e = (_d = process.env["RAINDROP_API_URL"]) != null ? _d : file.api_url) != null ? _e : "https://api.raindrop.ai/v1",
755
+ userId: (_g = (_f = process.env["RAINDROP_USER_ID"]) != null ? _f : file.user_id) != null ? _g : systemUser,
756
+ debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_h = file.debug) != null ? _h : false,
757
+ enabled: (_i = file.enabled) != null ? _i : true,
758
+ eventName: (_k = (_j = process.env["RAINDROP_EVENT_NAME"]) != null ? _j : file.event_name) != null ? _k : "claude_code_session",
759
+ customProperties
747
760
  };
748
761
  }
749
762
  function getConfigPath() {
@@ -872,6 +885,7 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
872
885
  var _a;
873
886
  const convoId = payload.session_id;
874
887
  const baseProperties = {
888
+ ...config.customProperties,
875
889
  cwd: payload.cwd,
876
890
  permission_mode: payload.permission_mode,
877
891
  plugin_version: PACKAGE_VERSION,
@@ -946,7 +960,7 @@ async function handleUserPromptSubmit(payload, convoId, config, properties, even
946
960
  isPending: true,
947
961
  userId: config.userId,
948
962
  convoId,
949
- eventName: "claude_code_session",
963
+ eventName: config.eventName,
950
964
  input: payload.prompt,
951
965
  model,
952
966
  properties
@@ -1066,7 +1080,7 @@ async function handlePostCompact(payload, eventId, config, properties, eventShip
1066
1080
  isPending: true,
1067
1081
  userId: config.userId,
1068
1082
  convoId: payload.session_id,
1069
- eventName: "claude_code_session",
1083
+ eventName: config.eventName,
1070
1084
  properties: {
1071
1085
  ...properties,
1072
1086
  compaction_trigger: payload.trigger,
@@ -1075,15 +1089,19 @@ async function handlePostCompact(payload, eventId, config, properties, eventShip
1075
1089
  });
1076
1090
  }
1077
1091
  async function handleStop(payload, eventId, config, properties, eventShipper) {
1078
- await eventShipper.finish(eventId, {
1092
+ await eventShipper.patch(eventId, {
1093
+ isPending: false,
1079
1094
  userId: config.userId,
1095
+ eventName: config.eventName,
1080
1096
  output: payload.last_assistant_message,
1081
1097
  properties
1082
1098
  });
1083
1099
  }
1084
1100
  async function handleStopFailure(payload, eventId, config, properties, eventShipper) {
1085
- await eventShipper.finish(eventId, {
1101
+ await eventShipper.patch(eventId, {
1102
+ isPending: false,
1086
1103
  userId: config.userId,
1104
+ eventName: config.eventName,
1087
1105
  output: payload.last_assistant_message,
1088
1106
  properties: {
1089
1107
  ...properties,
@@ -1093,8 +1111,10 @@ async function handleStopFailure(payload, eventId, config, properties, eventShip
1093
1111
  });
1094
1112
  }
1095
1113
  async function handleSessionEnd(payload, eventId, config, properties, eventShipper) {
1096
- await eventShipper.finish(eventId, {
1114
+ await eventShipper.patch(eventId, {
1115
+ isPending: false,
1097
1116
  userId: config.userId,
1117
+ eventName: config.eventName,
1098
1118
  properties: {
1099
1119
  ...properties,
1100
1120
  session_end_reason: payload.reason
package/dist/index.d.cts CHANGED
@@ -227,6 +227,8 @@ interface ConfigFile {
227
227
  user_id?: string;
228
228
  debug?: boolean;
229
229
  enabled?: boolean;
230
+ event_name?: string;
231
+ custom_properties?: Record<string, unknown>;
230
232
  }
231
233
  interface RaindropConfig {
232
234
  writeKey: string;
@@ -234,6 +236,8 @@ interface RaindropConfig {
234
236
  userId: string;
235
237
  debug: boolean;
236
238
  enabled: boolean;
239
+ eventName: string;
240
+ customProperties: Record<string, unknown>;
237
241
  }
238
242
  /**
239
243
  * Load config with precedence (low -> high):
@@ -275,11 +279,13 @@ interface HookPayload {
275
279
  interface MapperConfig {
276
280
  userId: string;
277
281
  debug: boolean;
282
+ eventName: string;
283
+ customProperties: Record<string, unknown>;
278
284
  }
279
285
  declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, eventShipper: EventShipper, traceShipper: TraceShipper): Promise<void>;
280
286
 
281
287
  declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
282
- declare const PACKAGE_VERSION = "0.0.1";
288
+ declare const PACKAGE_VERSION = "0.0.4";
283
289
 
284
290
  interface LocalDebuggerResult {
285
291
  /** The resolved base URL (e.g. "http://localhost:5899/v1/"), or null if not detected. */
package/dist/index.d.ts CHANGED
@@ -227,6 +227,8 @@ interface ConfigFile {
227
227
  user_id?: string;
228
228
  debug?: boolean;
229
229
  enabled?: boolean;
230
+ event_name?: string;
231
+ custom_properties?: Record<string, unknown>;
230
232
  }
231
233
  interface RaindropConfig {
232
234
  writeKey: string;
@@ -234,6 +236,8 @@ interface RaindropConfig {
234
236
  userId: string;
235
237
  debug: boolean;
236
238
  enabled: boolean;
239
+ eventName: string;
240
+ customProperties: Record<string, unknown>;
237
241
  }
238
242
  /**
239
243
  * Load config with precedence (low -> high):
@@ -275,11 +279,13 @@ interface HookPayload {
275
279
  interface MapperConfig {
276
280
  userId: string;
277
281
  debug: boolean;
282
+ eventName: string;
283
+ customProperties: Record<string, unknown>;
278
284
  }
279
285
  declare function mapHookToRaindrop(payload: HookPayload, config: MapperConfig, eventShipper: EventShipper, traceShipper: TraceShipper): Promise<void>;
280
286
 
281
287
  declare const PACKAGE_NAME = "@raindrop-ai/claude-code";
282
- declare const PACKAGE_VERSION = "0.0.1";
288
+ declare const PACKAGE_VERSION = "0.0.4";
283
289
 
284
290
  interface LocalDebuggerResult {
285
291
  /** The resolved base URL (e.g. "http://localhost:5899/v1/"), or null if not detected. */
package/dist/index.js CHANGED
@@ -645,7 +645,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
645
645
 
646
646
  // src/package-info.ts
647
647
  var PACKAGE_NAME = "@raindrop-ai/claude-code";
648
- var PACKAGE_VERSION = "0.0.1";
648
+ var PACKAGE_VERSION = "0.0.4";
649
649
 
650
650
  // src/shipper.ts
651
651
  var EventShipper2 = class extends EventShipper {
@@ -688,7 +688,7 @@ import { homedir, userInfo } from "os";
688
688
  import { dirname, join } from "path";
689
689
  var CONFIG_PATH = join(homedir(), ".config", "raindrop", "config.json");
690
690
  function loadConfig() {
691
- var _a, _b, _c, _d, _e, _f, _g, _h;
691
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
692
692
  let file = {};
693
693
  try {
694
694
  if (existsSync(CONFIG_PATH)) {
@@ -703,12 +703,25 @@ function loadConfig() {
703
703
  return "unknown";
704
704
  }
705
705
  })();
706
+ let customProperties = (_a = file.custom_properties) != null ? _a : {};
707
+ const envProps = process.env["RAINDROP_PROPERTIES"];
708
+ if (envProps) {
709
+ try {
710
+ const parsed = JSON.parse(envProps);
711
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
712
+ customProperties = { ...customProperties, ...parsed };
713
+ }
714
+ } catch (e) {
715
+ }
716
+ }
706
717
  return {
707
- writeKey: (_b = (_a = process.env["RAINDROP_WRITE_KEY"]) != null ? _a : file.write_key) != null ? _b : "",
708
- endpoint: (_d = (_c = process.env["RAINDROP_API_URL"]) != null ? _c : file.api_url) != null ? _d : "https://api.raindrop.ai/v1",
709
- userId: (_f = (_e = process.env["RAINDROP_USER_ID"]) != null ? _e : file.user_id) != null ? _f : systemUser,
710
- debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_g = file.debug) != null ? _g : false,
711
- enabled: (_h = file.enabled) != null ? _h : true
718
+ writeKey: (_c = (_b = process.env["RAINDROP_WRITE_KEY"]) != null ? _b : file.write_key) != null ? _c : "",
719
+ endpoint: (_e = (_d = process.env["RAINDROP_API_URL"]) != null ? _d : file.api_url) != null ? _e : "https://api.raindrop.ai/v1",
720
+ userId: (_g = (_f = process.env["RAINDROP_USER_ID"]) != null ? _f : file.user_id) != null ? _g : systemUser,
721
+ debug: process.env["RAINDROP_DEBUG"] === "true" ? true : (_h = file.debug) != null ? _h : false,
722
+ enabled: (_i = file.enabled) != null ? _i : true,
723
+ eventName: (_k = (_j = process.env["RAINDROP_EVENT_NAME"]) != null ? _j : file.event_name) != null ? _k : "claude_code_session",
724
+ customProperties
712
725
  };
713
726
  }
714
727
  function getConfigPath() {
@@ -837,6 +850,7 @@ async function mapHookToRaindrop(payload, config, eventShipper, traceShipper) {
837
850
  var _a;
838
851
  const convoId = payload.session_id;
839
852
  const baseProperties = {
853
+ ...config.customProperties,
840
854
  cwd: payload.cwd,
841
855
  permission_mode: payload.permission_mode,
842
856
  plugin_version: PACKAGE_VERSION,
@@ -911,7 +925,7 @@ async function handleUserPromptSubmit(payload, convoId, config, properties, even
911
925
  isPending: true,
912
926
  userId: config.userId,
913
927
  convoId,
914
- eventName: "claude_code_session",
928
+ eventName: config.eventName,
915
929
  input: payload.prompt,
916
930
  model,
917
931
  properties
@@ -1031,7 +1045,7 @@ async function handlePostCompact(payload, eventId, config, properties, eventShip
1031
1045
  isPending: true,
1032
1046
  userId: config.userId,
1033
1047
  convoId: payload.session_id,
1034
- eventName: "claude_code_session",
1048
+ eventName: config.eventName,
1035
1049
  properties: {
1036
1050
  ...properties,
1037
1051
  compaction_trigger: payload.trigger,
@@ -1040,15 +1054,19 @@ async function handlePostCompact(payload, eventId, config, properties, eventShip
1040
1054
  });
1041
1055
  }
1042
1056
  async function handleStop(payload, eventId, config, properties, eventShipper) {
1043
- await eventShipper.finish(eventId, {
1057
+ await eventShipper.patch(eventId, {
1058
+ isPending: false,
1044
1059
  userId: config.userId,
1060
+ eventName: config.eventName,
1045
1061
  output: payload.last_assistant_message,
1046
1062
  properties
1047
1063
  });
1048
1064
  }
1049
1065
  async function handleStopFailure(payload, eventId, config, properties, eventShipper) {
1050
- await eventShipper.finish(eventId, {
1066
+ await eventShipper.patch(eventId, {
1067
+ isPending: false,
1051
1068
  userId: config.userId,
1069
+ eventName: config.eventName,
1052
1070
  output: payload.last_assistant_message,
1053
1071
  properties: {
1054
1072
  ...properties,
@@ -1058,8 +1076,10 @@ async function handleStopFailure(payload, eventId, config, properties, eventShip
1058
1076
  });
1059
1077
  }
1060
1078
  async function handleSessionEnd(payload, eventId, config, properties, eventShipper) {
1061
- await eventShipper.finish(eventId, {
1079
+ await eventShipper.patch(eventId, {
1080
+ isPending: false,
1062
1081
  userId: config.userId,
1082
+ eventName: config.eventName,
1063
1083
  properties: {
1064
1084
  ...properties,
1065
1085
  session_end_reason: payload.reason
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raindrop-ai/claude-code",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Raindrop observability for Claude Code CLI — automatic session, tool call, and prompt tracing via hooks",
5
5
  "license": "MIT",
6
6
  "type": "module",