@raindrop-ai/langchain 0.0.2 → 0.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raindrop AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.mts CHANGED
@@ -155,6 +155,8 @@ declare class TraceShipper {
155
155
  private queue;
156
156
  private timer;
157
157
  private inFlight;
158
+ /** URL of the local debugger (from RAINDROP_LOCAL_DEBUGGER env var). */
159
+ private localDebuggerUrl;
158
160
  constructor(opts: TraceShipperOptions);
159
161
  isDebugEnabled(): boolean;
160
162
  private authHeaders;
package/dist/index.d.ts CHANGED
@@ -155,6 +155,8 @@ declare class TraceShipper {
155
155
  private queue;
156
156
  private timer;
157
157
  private inFlight;
158
+ /** URL of the local debugger (from RAINDROP_LOCAL_DEBUGGER env var). */
159
+ private localDebuggerUrl;
158
160
  constructor(opts: TraceShipperOptions);
159
161
  isDebugEnabled(): boolean;
160
162
  private authHeaders;
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(index_exports);
28
28
  // src/callback-handler.ts
29
29
  var import_base = require("@langchain/core/callbacks/base");
30
30
 
31
- // ../core/dist/chunk-FOHDGBT5.js
31
+ // ../core/dist/chunk-4UCYIEH4.js
32
32
  function getCrypto() {
33
33
  const c = globalThis.crypto;
34
34
  return c;
@@ -475,11 +475,28 @@ var EventShipper = class {
475
475
  }
476
476
  }
477
477
  };
478
+ var LOCAL_DEBUGGER_ENV_VAR = "RAINDROP_LOCAL_DEBUGGER";
479
+ function resolveLocalDebuggerBaseUrl(baseUrl) {
480
+ var _a, _b, _c;
481
+ const resolved = (_b = baseUrl != null ? baseUrl : typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a[LOCAL_DEBUGGER_ENV_VAR] : void 0) != null ? _b : null;
482
+ return resolved ? (_c = formatEndpoint(resolved)) != null ? _c : null : null;
483
+ }
484
+ function mirrorTraceExportToLocalDebugger(body, options = {}) {
485
+ var _a;
486
+ const baseUrl = resolveLocalDebuggerBaseUrl(options.baseUrl);
487
+ if (!baseUrl) return;
488
+ void postJson(`${baseUrl}traces`, body, {}, {
489
+ maxAttempts: 1,
490
+ debug: (_a = options.debug) != null ? _a : false,
491
+ sdkName: options.sdkName
492
+ }).catch(() => {
493
+ });
494
+ }
478
495
  var TraceShipper = class {
479
496
  constructor(opts) {
480
497
  this.queue = [];
481
498
  this.inFlight = /* @__PURE__ */ new Set();
482
- var _a, _b, _c, _d, _e, _f, _g, _h;
499
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
483
500
  this.writeKey = (_a = opts.writeKey) == null ? void 0 : _a.trim();
484
501
  this.baseUrl = (_b = formatEndpoint(opts.endpoint)) != null ? _b : "https://api.raindrop.ai/v1/";
485
502
  this.enabled = opts.enabled !== false;
@@ -492,6 +509,13 @@ var TraceShipper = class {
492
509
  this.prefix = `[raindrop-ai/${this.sdkName}]`;
493
510
  this.serviceName = (_g = opts.serviceName) != null ? _g : "raindrop.core";
494
511
  this.serviceVersion = (_h = opts.serviceVersion) != null ? _h : "0.0.0";
512
+ const localDebugger = typeof process !== "undefined" ? (_i = process.env) == null ? void 0 : _i.RAINDROP_LOCAL_DEBUGGER : void 0;
513
+ if (localDebugger) {
514
+ this.localDebuggerUrl = (_j = resolveLocalDebuggerBaseUrl(localDebugger)) != null ? _j : void 0;
515
+ if (this.debug) {
516
+ console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
517
+ }
518
+ }
495
519
  }
496
520
  isDebugEnabled() {
497
521
  return this.debug;
@@ -508,7 +532,25 @@ var TraceShipper = class {
508
532
  attrString("ai.operationId", args.operationId)
509
533
  ];
510
534
  if ((_b = args.attributes) == null ? void 0 : _b.length) attrs.push(...args.attributes);
511
- return { ids, name: args.name, startTimeUnixNano: started, attributes: attrs };
535
+ const span = { ids, name: args.name, startTimeUnixNano: started, attributes: attrs };
536
+ if (this.localDebuggerUrl) {
537
+ const openSpan = buildOtlpSpan({
538
+ ids: span.ids,
539
+ name: span.name,
540
+ startTimeUnixNano: span.startTimeUnixNano,
541
+ endTimeUnixNano: span.startTimeUnixNano,
542
+ // placeholder — will be updated on endSpan
543
+ attributes: span.attributes,
544
+ status: { code: SpanStatusCode.UNSET }
545
+ });
546
+ const body = buildExportTraceServiceRequest([openSpan], this.serviceName, this.serviceVersion);
547
+ mirrorTraceExportToLocalDebugger(body, {
548
+ baseUrl: this.localDebuggerUrl,
549
+ debug: false,
550
+ sdkName: this.sdkName
551
+ });
552
+ }
553
+ return span;
512
554
  }
513
555
  endSpan(span, extra) {
514
556
  var _a, _b;
@@ -531,6 +573,14 @@ var TraceShipper = class {
531
573
  status
532
574
  });
533
575
  this.enqueue(otlp);
576
+ if (this.localDebuggerUrl) {
577
+ const body = buildExportTraceServiceRequest([otlp], this.serviceName, this.serviceVersion);
578
+ mirrorTraceExportToLocalDebugger(body, {
579
+ baseUrl: this.localDebuggerUrl,
580
+ debug: false,
581
+ sdkName: this.sdkName
582
+ });
583
+ }
534
584
  }
535
585
  createSpan(args) {
536
586
  var _a;
@@ -548,6 +598,14 @@ var TraceShipper = class {
548
598
  status: args.status
549
599
  });
550
600
  this.enqueue(otlp);
601
+ if (this.localDebuggerUrl) {
602
+ const body = buildExportTraceServiceRequest([otlp], this.serviceName, this.serviceVersion);
603
+ mirrorTraceExportToLocalDebugger(body, {
604
+ baseUrl: this.localDebuggerUrl,
605
+ debug: false,
606
+ sdkName: this.sdkName
607
+ });
608
+ }
551
609
  }
552
610
  enqueue(span) {
553
611
  if (!this.enabled) return;
@@ -622,6 +680,10 @@ var TraceShipper = class {
622
680
  }
623
681
  };
624
682
 
683
+ // ../core/dist/index.node.js
684
+ var import_async_hooks = require("async_hooks");
685
+ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = import_async_hooks.AsyncLocalStorage;
686
+
625
687
  // src/callback-handler.ts
626
688
  var LANGGRAPH_INTERNAL_NAMES = /* @__PURE__ */ new Set([
627
689
  "LangGraph",
@@ -1023,11 +1085,21 @@ function extractLLMMetadata(output) {
1023
1085
  // package.json
1024
1086
  var package_default = {
1025
1087
  name: "@raindrop-ai/langchain",
1026
- version: "0.0.2",
1088
+ version: "0.0.3",
1027
1089
  description: "Raindrop integration for LangChain",
1028
1090
  main: "dist/index.js",
1029
1091
  module: "dist/index.mjs",
1030
1092
  types: "dist/index.d.ts",
1093
+ license: "MIT",
1094
+ repository: {
1095
+ type: "git",
1096
+ url: "git+https://github.com/raindrop-ai/raindrop-js.git",
1097
+ directory: "packages/langchain"
1098
+ },
1099
+ homepage: "https://github.com/raindrop-ai/raindrop-js/tree/main/packages/langchain#readme",
1100
+ bugs: {
1101
+ url: "https://github.com/raindrop-ai/raindrop-js/issues"
1102
+ },
1031
1103
  exports: {
1032
1104
  ".": {
1033
1105
  types: "./dist/index.d.ts",
@@ -1036,7 +1108,9 @@ var package_default = {
1036
1108
  }
1037
1109
  },
1038
1110
  sideEffects: false,
1039
- files: ["dist/**"],
1111
+ files: [
1112
+ "dist/**"
1113
+ ],
1040
1114
  scripts: {
1041
1115
  build: "tsup",
1042
1116
  dev: "tsup --watch",
@@ -1056,11 +1130,20 @@ var package_default = {
1056
1130
  vitest: "^2.1.9"
1057
1131
  },
1058
1132
  tsup: {
1059
- entry: ["src/index.ts"],
1060
- format: ["cjs", "esm"],
1061
- dts: { resolve: true },
1133
+ entry: [
1134
+ "src/index.ts"
1135
+ ],
1136
+ format: [
1137
+ "cjs",
1138
+ "esm"
1139
+ ],
1140
+ dts: {
1141
+ resolve: true
1142
+ },
1062
1143
  clean: true,
1063
- noExternal: ["@raindrop-ai/core"]
1144
+ noExternal: [
1145
+ "@raindrop-ai/core"
1146
+ ]
1064
1147
  },
1065
1148
  publishConfig: {
1066
1149
  access: "public"
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/callback-handler.ts
2
2
  import { BaseCallbackHandler } from "@langchain/core/callbacks/base";
3
3
 
4
- // ../core/dist/chunk-FOHDGBT5.js
4
+ // ../core/dist/chunk-4UCYIEH4.js
5
5
  function getCrypto() {
6
6
  const c = globalThis.crypto;
7
7
  return c;
@@ -448,11 +448,28 @@ var EventShipper = class {
448
448
  }
449
449
  }
450
450
  };
451
+ var LOCAL_DEBUGGER_ENV_VAR = "RAINDROP_LOCAL_DEBUGGER";
452
+ function resolveLocalDebuggerBaseUrl(baseUrl) {
453
+ var _a, _b, _c;
454
+ const resolved = (_b = baseUrl != null ? baseUrl : typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a[LOCAL_DEBUGGER_ENV_VAR] : void 0) != null ? _b : null;
455
+ return resolved ? (_c = formatEndpoint(resolved)) != null ? _c : null : null;
456
+ }
457
+ function mirrorTraceExportToLocalDebugger(body, options = {}) {
458
+ var _a;
459
+ const baseUrl = resolveLocalDebuggerBaseUrl(options.baseUrl);
460
+ if (!baseUrl) return;
461
+ void postJson(`${baseUrl}traces`, body, {}, {
462
+ maxAttempts: 1,
463
+ debug: (_a = options.debug) != null ? _a : false,
464
+ sdkName: options.sdkName
465
+ }).catch(() => {
466
+ });
467
+ }
451
468
  var TraceShipper = class {
452
469
  constructor(opts) {
453
470
  this.queue = [];
454
471
  this.inFlight = /* @__PURE__ */ new Set();
455
- var _a, _b, _c, _d, _e, _f, _g, _h;
472
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
456
473
  this.writeKey = (_a = opts.writeKey) == null ? void 0 : _a.trim();
457
474
  this.baseUrl = (_b = formatEndpoint(opts.endpoint)) != null ? _b : "https://api.raindrop.ai/v1/";
458
475
  this.enabled = opts.enabled !== false;
@@ -465,6 +482,13 @@ var TraceShipper = class {
465
482
  this.prefix = `[raindrop-ai/${this.sdkName}]`;
466
483
  this.serviceName = (_g = opts.serviceName) != null ? _g : "raindrop.core";
467
484
  this.serviceVersion = (_h = opts.serviceVersion) != null ? _h : "0.0.0";
485
+ const localDebugger = typeof process !== "undefined" ? (_i = process.env) == null ? void 0 : _i.RAINDROP_LOCAL_DEBUGGER : void 0;
486
+ if (localDebugger) {
487
+ this.localDebuggerUrl = (_j = resolveLocalDebuggerBaseUrl(localDebugger)) != null ? _j : void 0;
488
+ if (this.debug) {
489
+ console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
490
+ }
491
+ }
468
492
  }
469
493
  isDebugEnabled() {
470
494
  return this.debug;
@@ -481,7 +505,25 @@ var TraceShipper = class {
481
505
  attrString("ai.operationId", args.operationId)
482
506
  ];
483
507
  if ((_b = args.attributes) == null ? void 0 : _b.length) attrs.push(...args.attributes);
484
- return { ids, name: args.name, startTimeUnixNano: started, attributes: attrs };
508
+ const span = { ids, name: args.name, startTimeUnixNano: started, attributes: attrs };
509
+ if (this.localDebuggerUrl) {
510
+ const openSpan = buildOtlpSpan({
511
+ ids: span.ids,
512
+ name: span.name,
513
+ startTimeUnixNano: span.startTimeUnixNano,
514
+ endTimeUnixNano: span.startTimeUnixNano,
515
+ // placeholder — will be updated on endSpan
516
+ attributes: span.attributes,
517
+ status: { code: SpanStatusCode.UNSET }
518
+ });
519
+ const body = buildExportTraceServiceRequest([openSpan], this.serviceName, this.serviceVersion);
520
+ mirrorTraceExportToLocalDebugger(body, {
521
+ baseUrl: this.localDebuggerUrl,
522
+ debug: false,
523
+ sdkName: this.sdkName
524
+ });
525
+ }
526
+ return span;
485
527
  }
486
528
  endSpan(span, extra) {
487
529
  var _a, _b;
@@ -504,6 +546,14 @@ var TraceShipper = class {
504
546
  status
505
547
  });
506
548
  this.enqueue(otlp);
549
+ if (this.localDebuggerUrl) {
550
+ const body = buildExportTraceServiceRequest([otlp], this.serviceName, this.serviceVersion);
551
+ mirrorTraceExportToLocalDebugger(body, {
552
+ baseUrl: this.localDebuggerUrl,
553
+ debug: false,
554
+ sdkName: this.sdkName
555
+ });
556
+ }
507
557
  }
508
558
  createSpan(args) {
509
559
  var _a;
@@ -521,6 +571,14 @@ var TraceShipper = class {
521
571
  status: args.status
522
572
  });
523
573
  this.enqueue(otlp);
574
+ if (this.localDebuggerUrl) {
575
+ const body = buildExportTraceServiceRequest([otlp], this.serviceName, this.serviceVersion);
576
+ mirrorTraceExportToLocalDebugger(body, {
577
+ baseUrl: this.localDebuggerUrl,
578
+ debug: false,
579
+ sdkName: this.sdkName
580
+ });
581
+ }
524
582
  }
525
583
  enqueue(span) {
526
584
  if (!this.enabled) return;
@@ -595,6 +653,10 @@ var TraceShipper = class {
595
653
  }
596
654
  };
597
655
 
656
+ // ../core/dist/index.node.js
657
+ import { AsyncLocalStorage } from "async_hooks";
658
+ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
659
+
598
660
  // src/callback-handler.ts
599
661
  var LANGGRAPH_INTERNAL_NAMES = /* @__PURE__ */ new Set([
600
662
  "LangGraph",
@@ -996,11 +1058,21 @@ function extractLLMMetadata(output) {
996
1058
  // package.json
997
1059
  var package_default = {
998
1060
  name: "@raindrop-ai/langchain",
999
- version: "0.0.2",
1061
+ version: "0.0.3",
1000
1062
  description: "Raindrop integration for LangChain",
1001
1063
  main: "dist/index.js",
1002
1064
  module: "dist/index.mjs",
1003
1065
  types: "dist/index.d.ts",
1066
+ license: "MIT",
1067
+ repository: {
1068
+ type: "git",
1069
+ url: "git+https://github.com/raindrop-ai/raindrop-js.git",
1070
+ directory: "packages/langchain"
1071
+ },
1072
+ homepage: "https://github.com/raindrop-ai/raindrop-js/tree/main/packages/langchain#readme",
1073
+ bugs: {
1074
+ url: "https://github.com/raindrop-ai/raindrop-js/issues"
1075
+ },
1004
1076
  exports: {
1005
1077
  ".": {
1006
1078
  types: "./dist/index.d.ts",
@@ -1009,7 +1081,9 @@ var package_default = {
1009
1081
  }
1010
1082
  },
1011
1083
  sideEffects: false,
1012
- files: ["dist/**"],
1084
+ files: [
1085
+ "dist/**"
1086
+ ],
1013
1087
  scripts: {
1014
1088
  build: "tsup",
1015
1089
  dev: "tsup --watch",
@@ -1029,11 +1103,20 @@ var package_default = {
1029
1103
  vitest: "^2.1.9"
1030
1104
  },
1031
1105
  tsup: {
1032
- entry: ["src/index.ts"],
1033
- format: ["cjs", "esm"],
1034
- dts: { resolve: true },
1106
+ entry: [
1107
+ "src/index.ts"
1108
+ ],
1109
+ format: [
1110
+ "cjs",
1111
+ "esm"
1112
+ ],
1113
+ dts: {
1114
+ resolve: true
1115
+ },
1035
1116
  clean: true,
1036
- noExternal: ["@raindrop-ai/core"]
1117
+ noExternal: [
1118
+ "@raindrop-ai/core"
1119
+ ]
1037
1120
  },
1038
1121
  publishConfig: {
1039
1122
  access: "public"
package/package.json CHANGED
@@ -1,10 +1,20 @@
1
1
  {
2
2
  "name": "@raindrop-ai/langchain",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Raindrop integration for LangChain",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/raindrop-ai/raindrop-js.git",
12
+ "directory": "packages/langchain"
13
+ },
14
+ "homepage": "https://github.com/raindrop-ai/raindrop-js/tree/main/packages/langchain#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/raindrop-ai/raindrop-js/issues"
17
+ },
8
18
  "exports": {
9
19
  ".": {
10
20
  "types": "./dist/index.d.ts",
@@ -13,33 +23,44 @@
13
23
  }
14
24
  },
15
25
  "sideEffects": false,
16
- "files": ["dist/**"],
17
- "scripts": {
18
- "build": "tsup",
19
- "dev": "tsup --watch",
20
- "clean": "rm -rf dist",
21
- "test": "vitest run"
22
- },
26
+ "files": [
27
+ "dist/**"
28
+ ],
23
29
  "peerDependencies": {
24
30
  "@langchain/core": ">=0.3.0 <1.0.0"
25
31
  },
26
32
  "devDependencies": {
27
- "@raindrop-ai/core": "workspace:*",
28
33
  "@langchain/core": ">=0.3.0",
29
34
  "@types/node": "^20.11.17",
30
35
  "msw": "^2.12.7",
31
36
  "tsup": "^8.4.0",
32
37
  "typescript": "^5.3.3",
33
- "vitest": "^2.1.9"
38
+ "vitest": "^2.1.9",
39
+ "@raindrop-ai/core": "0.0.1"
34
40
  },
35
41
  "tsup": {
36
- "entry": ["src/index.ts"],
37
- "format": ["cjs", "esm"],
38
- "dts": { "resolve": true },
42
+ "entry": [
43
+ "src/index.ts"
44
+ ],
45
+ "format": [
46
+ "cjs",
47
+ "esm"
48
+ ],
49
+ "dts": {
50
+ "resolve": true
51
+ },
39
52
  "clean": true,
40
- "noExternal": ["@raindrop-ai/core"]
53
+ "noExternal": [
54
+ "@raindrop-ai/core"
55
+ ]
41
56
  },
42
57
  "publishConfig": {
43
58
  "access": "public"
59
+ },
60
+ "scripts": {
61
+ "build": "tsup",
62
+ "dev": "tsup --watch",
63
+ "clean": "rm -rf dist",
64
+ "test": "vitest run"
44
65
  }
45
- }
66
+ }