@raindrop-ai/deep-agents 0.0.2 → 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/README.md CHANGED
@@ -120,4 +120,4 @@ The dashboard token comes from `app.raindrop.ai` → DevTools → Network → an
120
120
 
121
121
  ## Python
122
122
 
123
- A Python version of this integration is available as `raindrop-deep-agents` on PyPI. See [the Python package](https://github.com/invisible-tools/dawn/tree/main/packages/deep-agents-python) for details.
123
+ A Python version of this integration is available as `raindrop-deep-agents` on PyPI. See [the Python package](https://pypi.org/project/raindrop-deep-agents/) for details.
package/dist/index.d.mts CHANGED
@@ -90,6 +90,13 @@ type EventShipperOptions = {
90
90
  * Pass `null` to opt out of all mirroring (including auto-detect).
91
91
  */
92
92
  localDebuggerUrl?: string | null;
93
+ /**
94
+ * Optional project slug. When set, every outbound cloud request includes an
95
+ * `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
96
+ * values are ignored. Slug format is validated on construction but never
97
+ * throws — the backend returns 400 on invalid values.
98
+ */
99
+ projectId?: string;
93
100
  /**
94
101
  * Per-field character cap applied to event input/output BEFORE buffering
95
102
  * or serialization, so oversized payloads cost the cap — not the payload —
@@ -108,6 +115,7 @@ declare class EventShipper {
108
115
  private sdkName;
109
116
  private prefix;
110
117
  private defaultEventName;
118
+ private projectId;
111
119
  private context;
112
120
  private buffers;
113
121
  private sticky;
@@ -131,6 +139,7 @@ declare class EventShipper {
131
139
  constructor(opts: EventShipperOptions);
132
140
  isDebugEnabled(): boolean;
133
141
  private authHeaders;
142
+ private requestHeaders;
134
143
  /**
135
144
  * Build the retry/timeout options for one POST, honoring the shutdown
136
145
  * deadline. Returns `null` when the shutdown drain window is exhausted —
@@ -202,6 +211,13 @@ type TraceShipperOptions = {
202
211
  * Pass `null` to opt out of all mirroring (including auto-detect).
203
212
  */
204
213
  localDebuggerUrl?: string | null;
214
+ /**
215
+ * Optional project slug. When set, every OTLP trace export includes an
216
+ * `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
217
+ * values are ignored. Slug format is validated on construction but never
218
+ * throws — the backend returns 400 on invalid values.
219
+ */
220
+ projectId?: string;
205
221
  /**
206
222
  * Per-span hook that fires for every OTLP span right before the span is
207
223
  * shipped (both to the Raindrop API and to a local debugger). Lets callers
@@ -259,6 +275,7 @@ declare class TraceShipper {
259
275
  private flushIntervalMs;
260
276
  private maxBatchSize;
261
277
  private maxQueueSize;
278
+ private projectId;
262
279
  private queue;
263
280
  private timer;
264
281
  private inFlight;
@@ -309,6 +326,7 @@ declare class TraceShipper {
309
326
  private redactSpan;
310
327
  isDebugEnabled(): boolean;
311
328
  private authHeaders;
329
+ private requestHeaders;
312
330
  startSpan(args: {
313
331
  name: string;
314
332
  parent?: {
@@ -427,6 +445,12 @@ interface DeepAgentsOptions {
427
445
  debug?: boolean;
428
446
  userId?: string;
429
447
  convoId?: string;
448
+ /**
449
+ * Optional Raindrop project slug. When set, every outbound cloud request
450
+ * carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
451
+ * resolves to `default` server-side; byte-identical to prior behavior).
452
+ */
453
+ projectId?: string;
430
454
  traceChains?: boolean;
431
455
  }
432
456
  type RaindropDeepAgentsClient = {
package/dist/index.d.ts CHANGED
@@ -90,6 +90,13 @@ type EventShipperOptions = {
90
90
  * Pass `null` to opt out of all mirroring (including auto-detect).
91
91
  */
92
92
  localDebuggerUrl?: string | null;
93
+ /**
94
+ * Optional project slug. When set, every outbound cloud request includes an
95
+ * `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
96
+ * values are ignored. Slug format is validated on construction but never
97
+ * throws — the backend returns 400 on invalid values.
98
+ */
99
+ projectId?: string;
93
100
  /**
94
101
  * Per-field character cap applied to event input/output BEFORE buffering
95
102
  * or serialization, so oversized payloads cost the cap — not the payload —
@@ -108,6 +115,7 @@ declare class EventShipper {
108
115
  private sdkName;
109
116
  private prefix;
110
117
  private defaultEventName;
118
+ private projectId;
111
119
  private context;
112
120
  private buffers;
113
121
  private sticky;
@@ -131,6 +139,7 @@ declare class EventShipper {
131
139
  constructor(opts: EventShipperOptions);
132
140
  isDebugEnabled(): boolean;
133
141
  private authHeaders;
142
+ private requestHeaders;
134
143
  /**
135
144
  * Build the retry/timeout options for one POST, honoring the shutdown
136
145
  * deadline. Returns `null` when the shutdown drain window is exhausted —
@@ -202,6 +211,13 @@ type TraceShipperOptions = {
202
211
  * Pass `null` to opt out of all mirroring (including auto-detect).
203
212
  */
204
213
  localDebuggerUrl?: string | null;
214
+ /**
215
+ * Optional project slug. When set, every OTLP trace export includes an
216
+ * `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
217
+ * values are ignored. Slug format is validated on construction but never
218
+ * throws — the backend returns 400 on invalid values.
219
+ */
220
+ projectId?: string;
205
221
  /**
206
222
  * Per-span hook that fires for every OTLP span right before the span is
207
223
  * shipped (both to the Raindrop API and to a local debugger). Lets callers
@@ -259,6 +275,7 @@ declare class TraceShipper {
259
275
  private flushIntervalMs;
260
276
  private maxBatchSize;
261
277
  private maxQueueSize;
278
+ private projectId;
262
279
  private queue;
263
280
  private timer;
264
281
  private inFlight;
@@ -309,6 +326,7 @@ declare class TraceShipper {
309
326
  private redactSpan;
310
327
  isDebugEnabled(): boolean;
311
328
  private authHeaders;
329
+ private requestHeaders;
312
330
  startSpan(args: {
313
331
  name: string;
314
332
  parent?: {
@@ -427,6 +445,12 @@ interface DeepAgentsOptions {
427
445
  debug?: boolean;
428
446
  userId?: string;
429
447
  convoId?: string;
448
+ /**
449
+ * Optional Raindrop project slug. When set, every outbound cloud request
450
+ * carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
451
+ * resolves to `default` server-side; byte-identical to prior behavior).
452
+ */
453
+ projectId?: string;
430
454
  traceChains?: boolean;
431
455
  }
432
456
  type RaindropDeepAgentsClient = {
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-U5HUTMR5.js
31
+ // ../core/dist/chunk-SK6EJEO7.js
32
32
  function getCrypto() {
33
33
  const c = globalThis.crypto;
34
34
  return c;
@@ -380,6 +380,25 @@ function mirrorPartialEventToLocalDebugger(event, options = {}) {
380
380
  }).catch(() => {
381
381
  });
382
382
  }
383
+ var PROJECT_ID_HEADER = "X-Raindrop-Project-Id";
384
+ var PROJECT_ID_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
385
+ function isValidProjectIdSlug(value) {
386
+ return PROJECT_ID_SLUG_PATTERN.test(value);
387
+ }
388
+ function normalizeProjectId(raw, opts) {
389
+ if (typeof raw !== "string") return void 0;
390
+ const trimmed = raw.trim();
391
+ if (!trimmed) return void 0;
392
+ if (!isValidProjectIdSlug(trimmed) && opts.debug) {
393
+ console.warn(
394
+ `${opts.prefix} projectId "${trimmed}" does not match slug ${PROJECT_ID_SLUG_PATTERN.source}; sending anyway \u2014 backend may reject with HTTP 400`
395
+ );
396
+ }
397
+ return trimmed;
398
+ }
399
+ function projectIdHeaders(projectId) {
400
+ return projectId ? { [PROJECT_ID_HEADER]: projectId } : {};
401
+ }
383
402
  var SHUTDOWN_DEADLINE_MS = 1e4;
384
403
  var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
385
404
  function mergePatches(target, source) {
@@ -414,6 +433,10 @@ var EventShipper = class {
414
433
  if (this.debug && this.localDebuggerUrl) {
415
434
  console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
416
435
  }
436
+ this.projectId = normalizeProjectId(opts.projectId, {
437
+ debug: this.debug,
438
+ prefix: this.prefix
439
+ });
417
440
  const isNode = typeof process !== "undefined" && typeof process.version === "string";
418
441
  this.context = {
419
442
  library: {
@@ -432,6 +455,9 @@ var EventShipper = class {
432
455
  authHeaders() {
433
456
  return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};
434
457
  }
458
+ requestHeaders() {
459
+ return { ...this.authHeaders(), ...projectIdHeaders(this.projectId) };
460
+ }
435
461
  /**
436
462
  * Build the retry/timeout options for one POST, honoring the shutdown
437
463
  * deadline. Returns `null` when the shutdown drain window is exhausted —
@@ -561,7 +587,7 @@ var EventShipper = class {
561
587
  return;
562
588
  }
563
589
  try {
564
- await postJson(url, body, this.authHeaders(), opts);
590
+ await postJson(url, body, this.requestHeaders(), opts);
565
591
  } catch (err) {
566
592
  const msg = err instanceof Error ? err.message : String(err);
567
593
  rateLimitedLog(
@@ -597,7 +623,7 @@ var EventShipper = class {
597
623
  return;
598
624
  }
599
625
  try {
600
- await postJson(url, body, this.authHeaders(), opts);
626
+ await postJson(url, body, this.requestHeaders(), opts);
601
627
  } catch (err) {
602
628
  const msg = err instanceof Error ? err.message : String(err);
603
629
  rateLimitedLog(
@@ -693,7 +719,7 @@ var EventShipper = class {
693
719
  if (!isPending) this.sticky.delete(eventId);
694
720
  return;
695
721
  }
696
- const p = postJson(url, payload, this.authHeaders(), opts);
722
+ const p = postJson(url, payload, this.requestHeaders(), opts);
697
723
  this.inFlight.add(p);
698
724
  try {
699
725
  try {
@@ -840,6 +866,10 @@ var TraceShipper = class {
840
866
  if (this.debug && this.localDebuggerUrl) {
841
867
  console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
842
868
  }
869
+ this.projectId = normalizeProjectId(opts.projectId, {
870
+ debug: this.debug,
871
+ prefix: this.prefix
872
+ });
843
873
  this.transformSpanHook = opts.transformSpan;
844
874
  this.disableDefaultRedaction = opts.disableDefaultRedaction === true;
845
875
  this.maxTextFieldCharsOpt = opts.maxTextFieldChars;
@@ -916,6 +946,9 @@ var TraceShipper = class {
916
946
  authHeaders() {
917
947
  return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};
918
948
  }
949
+ requestHeaders() {
950
+ return { ...this.authHeaders(), ...projectIdHeaders(this.projectId) };
951
+ }
919
952
  startSpan(args) {
920
953
  var _a, _b;
921
954
  const ids = createSpanIds(args.parent);
@@ -1047,7 +1080,7 @@ var TraceShipper = class {
1047
1080
  endpoint: url
1048
1081
  });
1049
1082
  }
1050
- const p = postJson(url, body, this.authHeaders(), opts);
1083
+ const p = postJson(url, body, this.requestHeaders(), opts);
1051
1084
  this.inFlight.add(p);
1052
1085
  try {
1053
1086
  try {
@@ -1671,6 +1704,7 @@ function createRaindropDeepAgents(opts) {
1671
1704
  endpoint: opts.endpoint,
1672
1705
  enabled,
1673
1706
  debug: opts.debug ?? false,
1707
+ projectId: opts.projectId,
1674
1708
  sdkName: "deep-agents",
1675
1709
  libraryName,
1676
1710
  libraryVersion
@@ -1680,6 +1714,7 @@ function createRaindropDeepAgents(opts) {
1680
1714
  endpoint: opts.endpoint,
1681
1715
  enabled,
1682
1716
  debug: opts.debug ?? false,
1717
+ projectId: opts.projectId,
1683
1718
  sdkName: "deep-agents",
1684
1719
  serviceName: "raindrop.deep-agents",
1685
1720
  serviceVersion: libraryVersion
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-U5HUTMR5.js
4
+ // ../core/dist/chunk-SK6EJEO7.js
5
5
  function getCrypto() {
6
6
  const c = globalThis.crypto;
7
7
  return c;
@@ -353,6 +353,25 @@ function mirrorPartialEventToLocalDebugger(event, options = {}) {
353
353
  }).catch(() => {
354
354
  });
355
355
  }
356
+ var PROJECT_ID_HEADER = "X-Raindrop-Project-Id";
357
+ var PROJECT_ID_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
358
+ function isValidProjectIdSlug(value) {
359
+ return PROJECT_ID_SLUG_PATTERN.test(value);
360
+ }
361
+ function normalizeProjectId(raw, opts) {
362
+ if (typeof raw !== "string") return void 0;
363
+ const trimmed = raw.trim();
364
+ if (!trimmed) return void 0;
365
+ if (!isValidProjectIdSlug(trimmed) && opts.debug) {
366
+ console.warn(
367
+ `${opts.prefix} projectId "${trimmed}" does not match slug ${PROJECT_ID_SLUG_PATTERN.source}; sending anyway \u2014 backend may reject with HTTP 400`
368
+ );
369
+ }
370
+ return trimmed;
371
+ }
372
+ function projectIdHeaders(projectId) {
373
+ return projectId ? { [PROJECT_ID_HEADER]: projectId } : {};
374
+ }
356
375
  var SHUTDOWN_DEADLINE_MS = 1e4;
357
376
  var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
358
377
  function mergePatches(target, source) {
@@ -387,6 +406,10 @@ var EventShipper = class {
387
406
  if (this.debug && this.localDebuggerUrl) {
388
407
  console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
389
408
  }
409
+ this.projectId = normalizeProjectId(opts.projectId, {
410
+ debug: this.debug,
411
+ prefix: this.prefix
412
+ });
390
413
  const isNode = typeof process !== "undefined" && typeof process.version === "string";
391
414
  this.context = {
392
415
  library: {
@@ -405,6 +428,9 @@ var EventShipper = class {
405
428
  authHeaders() {
406
429
  return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};
407
430
  }
431
+ requestHeaders() {
432
+ return { ...this.authHeaders(), ...projectIdHeaders(this.projectId) };
433
+ }
408
434
  /**
409
435
  * Build the retry/timeout options for one POST, honoring the shutdown
410
436
  * deadline. Returns `null` when the shutdown drain window is exhausted —
@@ -534,7 +560,7 @@ var EventShipper = class {
534
560
  return;
535
561
  }
536
562
  try {
537
- await postJson(url, body, this.authHeaders(), opts);
563
+ await postJson(url, body, this.requestHeaders(), opts);
538
564
  } catch (err) {
539
565
  const msg = err instanceof Error ? err.message : String(err);
540
566
  rateLimitedLog(
@@ -570,7 +596,7 @@ var EventShipper = class {
570
596
  return;
571
597
  }
572
598
  try {
573
- await postJson(url, body, this.authHeaders(), opts);
599
+ await postJson(url, body, this.requestHeaders(), opts);
574
600
  } catch (err) {
575
601
  const msg = err instanceof Error ? err.message : String(err);
576
602
  rateLimitedLog(
@@ -666,7 +692,7 @@ var EventShipper = class {
666
692
  if (!isPending) this.sticky.delete(eventId);
667
693
  return;
668
694
  }
669
- const p = postJson(url, payload, this.authHeaders(), opts);
695
+ const p = postJson(url, payload, this.requestHeaders(), opts);
670
696
  this.inFlight.add(p);
671
697
  try {
672
698
  try {
@@ -813,6 +839,10 @@ var TraceShipper = class {
813
839
  if (this.debug && this.localDebuggerUrl) {
814
840
  console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
815
841
  }
842
+ this.projectId = normalizeProjectId(opts.projectId, {
843
+ debug: this.debug,
844
+ prefix: this.prefix
845
+ });
816
846
  this.transformSpanHook = opts.transformSpan;
817
847
  this.disableDefaultRedaction = opts.disableDefaultRedaction === true;
818
848
  this.maxTextFieldCharsOpt = opts.maxTextFieldChars;
@@ -889,6 +919,9 @@ var TraceShipper = class {
889
919
  authHeaders() {
890
920
  return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};
891
921
  }
922
+ requestHeaders() {
923
+ return { ...this.authHeaders(), ...projectIdHeaders(this.projectId) };
924
+ }
892
925
  startSpan(args) {
893
926
  var _a, _b;
894
927
  const ids = createSpanIds(args.parent);
@@ -1020,7 +1053,7 @@ var TraceShipper = class {
1020
1053
  endpoint: url
1021
1054
  });
1022
1055
  }
1023
- const p = postJson(url, body, this.authHeaders(), opts);
1056
+ const p = postJson(url, body, this.requestHeaders(), opts);
1024
1057
  this.inFlight.add(p);
1025
1058
  try {
1026
1059
  try {
@@ -1644,6 +1677,7 @@ function createRaindropDeepAgents(opts) {
1644
1677
  endpoint: opts.endpoint,
1645
1678
  enabled,
1646
1679
  debug: opts.debug ?? false,
1680
+ projectId: opts.projectId,
1647
1681
  sdkName: "deep-agents",
1648
1682
  libraryName,
1649
1683
  libraryVersion
@@ -1653,6 +1687,7 @@ function createRaindropDeepAgents(opts) {
1653
1687
  endpoint: opts.endpoint,
1654
1688
  enabled,
1655
1689
  debug: opts.debug ?? false,
1690
+ projectId: opts.projectId,
1656
1691
  sdkName: "deep-agents",
1657
1692
  serviceName: "raindrop.deep-agents",
1658
1693
  serviceVersion: libraryVersion
package/package.json CHANGED
@@ -1,19 +1,14 @@
1
1
  {
2
2
  "name": "@raindrop-ai/deep-agents",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Raindrop integration for LangChain Deep Agents",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "license": "MIT",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/raindrop-ai/raindrop-js.git",
12
- "directory": "packages/deep-agents"
13
- },
14
- "homepage": "https://github.com/raindrop-ai/raindrop-js/tree/main/packages/deep-agents#readme",
9
+ "homepage": "https://www.raindrop.ai/docs/integrations/deepagents/",
15
10
  "bugs": {
16
- "url": "https://github.com/raindrop-ai/raindrop-js/issues"
11
+ "url": "https://www.raindrop.ai/docs/support/"
17
12
  },
18
13
  "exports": {
19
14
  ".": {
@@ -41,7 +36,7 @@
41
36
  "typescript": "^5.3.3",
42
37
  "vitest": "^2.1.9",
43
38
  "zod": "^3.23.0",
44
- "@raindrop-ai/core": "0.0.3"
39
+ "@raindrop-ai/core": "0.0.4"
45
40
  },
46
41
  "tsup": {
47
42
  "entry": [