@raindrop-ai/deep-agents 0.0.6 → 0.1.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.d.mts CHANGED
@@ -60,6 +60,7 @@ type Patch = {
60
60
  output?: string;
61
61
  model?: string;
62
62
  properties?: Record<string, unknown>;
63
+ featureFlags?: Record<string, string>;
63
64
  attachments?: Attachment[];
64
65
  isPending?: boolean;
65
66
  timestamp?: string;
@@ -160,6 +161,7 @@ declare class EventShipper {
160
161
  output?: string;
161
162
  model?: string;
162
163
  properties?: Record<string, unknown>;
164
+ featureFlags?: Record<string, string>;
163
165
  userId?: string;
164
166
  }): Promise<void>;
165
167
  flush(): Promise<void>;
@@ -432,6 +434,8 @@ interface RaindropDeepAgentsHandlerOptions {
432
434
  traceShipper: TraceShipper;
433
435
  userId?: string;
434
436
  convoId?: string;
437
+ eventName?: string;
438
+ eventId?: () => string;
435
439
  traceChains?: boolean;
436
440
  }
437
441
  declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
@@ -440,6 +444,8 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
440
444
  private traceShipper;
441
445
  private userId?;
442
446
  private convoId?;
447
+ private eventName?;
448
+ private eventIdSource?;
443
449
  private traceChains;
444
450
  private spans;
445
451
  private rootRunIds;
@@ -481,6 +487,18 @@ interface DeepAgentsOptions {
481
487
  debug?: boolean;
482
488
  userId?: string;
483
489
  convoId?: string;
490
+ /**
491
+ * Event name stamped on every captured event, replacing core's hardcoded
492
+ * `"ai_generation"` default (DEV-1167).
493
+ */
494
+ eventName?: string;
495
+ /**
496
+ * Per-call event-id source, invoked once per captured root agent invocation
497
+ * to mint that event's id (and the linked spans' id), replacing the
498
+ * handler-minted UUID (DEV-1174). A throwing/empty/absent source falls back
499
+ * to a random UUID, so telemetry never crashes the caller.
500
+ */
501
+ eventId?: () => string;
484
502
  /**
485
503
  * Optional Raindrop project slug. When set, every outbound cloud request
486
504
  * carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
package/dist/index.d.ts CHANGED
@@ -60,6 +60,7 @@ type Patch = {
60
60
  output?: string;
61
61
  model?: string;
62
62
  properties?: Record<string, unknown>;
63
+ featureFlags?: Record<string, string>;
63
64
  attachments?: Attachment[];
64
65
  isPending?: boolean;
65
66
  timestamp?: string;
@@ -160,6 +161,7 @@ declare class EventShipper {
160
161
  output?: string;
161
162
  model?: string;
162
163
  properties?: Record<string, unknown>;
164
+ featureFlags?: Record<string, string>;
163
165
  userId?: string;
164
166
  }): Promise<void>;
165
167
  flush(): Promise<void>;
@@ -432,6 +434,8 @@ interface RaindropDeepAgentsHandlerOptions {
432
434
  traceShipper: TraceShipper;
433
435
  userId?: string;
434
436
  convoId?: string;
437
+ eventName?: string;
438
+ eventId?: () => string;
435
439
  traceChains?: boolean;
436
440
  }
437
441
  declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
@@ -440,6 +444,8 @@ declare class RaindropDeepAgentsHandler extends BaseCallbackHandler {
440
444
  private traceShipper;
441
445
  private userId?;
442
446
  private convoId?;
447
+ private eventName?;
448
+ private eventIdSource?;
443
449
  private traceChains;
444
450
  private spans;
445
451
  private rootRunIds;
@@ -481,6 +487,18 @@ interface DeepAgentsOptions {
481
487
  debug?: boolean;
482
488
  userId?: string;
483
489
  convoId?: string;
490
+ /**
491
+ * Event name stamped on every captured event, replacing core's hardcoded
492
+ * `"ai_generation"` default (DEV-1167).
493
+ */
494
+ eventName?: string;
495
+ /**
496
+ * Per-call event-id source, invoked once per captured root agent invocation
497
+ * to mint that event's id (and the linked spans' id), replacing the
498
+ * handler-minted UUID (DEV-1174). A throwing/empty/absent source falls back
499
+ * to a random UUID, so telemetry never crashes the caller.
500
+ */
501
+ eventId?: () => string;
484
502
  /**
485
503
  * Optional Raindrop project slug. When set, every outbound cloud request
486
504
  * carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
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-WKRW55KX.js
31
+ // ../core/dist/chunk-267IXHO5.js
32
32
  function getCrypto() {
33
33
  const c = globalThis.crypto;
34
34
  return c;
@@ -418,13 +418,16 @@ function projectIdHeaders(projectId) {
418
418
  var SHUTDOWN_DEADLINE_MS = 1e4;
419
419
  var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
420
420
  function mergePatches(target, source) {
421
- var _a, _b, _c, _d;
421
+ var _a, _b, _c, _d, _e, _f;
422
422
  const out = { ...target, ...source };
423
423
  if (target.properties || source.properties) {
424
424
  out.properties = { ...(_a = target.properties) != null ? _a : {}, ...(_b = source.properties) != null ? _b : {} };
425
425
  }
426
+ if (target.featureFlags || source.featureFlags) {
427
+ out.featureFlags = { ...(_c = target.featureFlags) != null ? _c : {}, ...(_d = source.featureFlags) != null ? _d : {} };
428
+ }
426
429
  if (target.attachments || source.attachments) {
427
- out.attachments = [...(_c = target.attachments) != null ? _c : [], ...(_d = source.attachments) != null ? _d : []];
430
+ out.attachments = [...(_e = target.attachments) != null ? _e : [], ...(_f = source.attachments) != null ? _f : []];
428
431
  }
429
432
  return out;
430
433
  }
@@ -694,6 +697,7 @@ var EventShipper = class {
694
697
  ...wizardSession ? { "raindrop.wizardSession": wizardSession } : {},
695
698
  $context: this.context
696
699
  },
700
+ ...accumulated.featureFlags && Object.keys(accumulated.featureFlags).length > 0 ? { feature_flags: accumulated.featureFlags } : {},
697
701
  attachments: accumulated.attachments,
698
702
  is_pending: isPending
699
703
  };
@@ -1192,6 +1196,15 @@ function installTracingSuppressionHook() {
1192
1196
  installTracingSuppressionHook();
1193
1197
 
1194
1198
  // src/callback-handler.ts
1199
+ function resolveEventId(source) {
1200
+ if (typeof source !== "function") return randomUUID();
1201
+ try {
1202
+ const id = source();
1203
+ return typeof id === "string" && id.trim() !== "" ? id : randomUUID();
1204
+ } catch {
1205
+ return randomUUID();
1206
+ }
1207
+ }
1195
1208
  function isInternalName(name) {
1196
1209
  if (name.startsWith("Branch:")) return true;
1197
1210
  if (name.startsWith("ChannelWrite")) return true;
@@ -1240,13 +1253,15 @@ var RaindropDeepAgentsHandler = class extends import_base.BaseCallbackHandler {
1240
1253
  this.traceShipper = opts.traceShipper;
1241
1254
  this.userId = opts.userId;
1242
1255
  this.convoId = opts.convoId;
1256
+ this.eventName = opts.eventName;
1257
+ this.eventIdSource = opts.eventId;
1243
1258
  this.traceChains = opts.traceChains ?? true;
1244
1259
  }
1245
1260
  getEventId(runId, parentRunId) {
1246
1261
  const rootId = parentRunId ? this.rootRunIds.get(parentRunId) ?? parentRunId : runId;
1247
1262
  this.rootRunIds.set(runId, rootId);
1248
1263
  if (!this.eventIds.has(rootId)) {
1249
- this.eventIds.set(rootId, randomUUID());
1264
+ this.eventIds.set(rootId, resolveEventId(this.eventIdSource));
1250
1265
  }
1251
1266
  return this.eventIds.get(rootId);
1252
1267
  }
@@ -1275,10 +1290,11 @@ var RaindropDeepAgentsHandler = class extends import_base.BaseCallbackHandler {
1275
1290
  const eventId = this.eventIds.get(rootId);
1276
1291
  if (!eventId) return;
1277
1292
  if (isRoot) {
1278
- if (this.convoId) {
1293
+ if (this.convoId || this.eventName) {
1279
1294
  await this.eventShipper.patch(eventId, {
1280
1295
  userId: this.userId,
1281
1296
  convoId: this.convoId,
1297
+ eventName: this.eventName,
1282
1298
  isPending: true
1283
1299
  });
1284
1300
  }
@@ -1287,6 +1303,7 @@ var RaindropDeepAgentsHandler = class extends import_base.BaseCallbackHandler {
1287
1303
  await this.eventShipper.patch(eventId, {
1288
1304
  userId: this.userId,
1289
1305
  convoId: this.convoId,
1306
+ eventName: this.eventName,
1290
1307
  ...patch,
1291
1308
  isPending: true
1292
1309
  });
@@ -1313,6 +1330,7 @@ var RaindropDeepAgentsHandler = class extends import_base.BaseCallbackHandler {
1313
1330
  await this.eventShipper.patch(eventId, {
1314
1331
  userId: this.userId,
1315
1332
  convoId: this.convoId,
1333
+ eventName: this.eventName,
1316
1334
  input: truncate(prompts.join("\n"), CHAIN_TEXT_MAX_LEN),
1317
1335
  properties: buildProperties(tags, metadata),
1318
1336
  isPending: true
@@ -1346,6 +1364,7 @@ var RaindropDeepAgentsHandler = class extends import_base.BaseCallbackHandler {
1346
1364
  await this.eventShipper.patch(eventId, {
1347
1365
  userId: this.userId,
1348
1366
  convoId: this.convoId,
1367
+ eventName: this.eventName,
1349
1368
  input: inputText,
1350
1369
  properties: buildProperties(tags, metadata),
1351
1370
  isPending: true
@@ -1765,6 +1784,8 @@ function createRaindropDeepAgents(opts) {
1765
1784
  traceShipper,
1766
1785
  userId: opts.userId,
1767
1786
  convoId: opts.convoId,
1787
+ eventName: opts.eventName,
1788
+ eventId: opts.eventId,
1768
1789
  traceChains: opts.traceChains
1769
1790
  });
1770
1791
  return {
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-WKRW55KX.js
4
+ // ../core/dist/chunk-267IXHO5.js
5
5
  function getCrypto() {
6
6
  const c = globalThis.crypto;
7
7
  return c;
@@ -391,13 +391,16 @@ function projectIdHeaders(projectId) {
391
391
  var SHUTDOWN_DEADLINE_MS = 1e4;
392
392
  var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
393
393
  function mergePatches(target, source) {
394
- var _a, _b, _c, _d;
394
+ var _a, _b, _c, _d, _e, _f;
395
395
  const out = { ...target, ...source };
396
396
  if (target.properties || source.properties) {
397
397
  out.properties = { ...(_a = target.properties) != null ? _a : {}, ...(_b = source.properties) != null ? _b : {} };
398
398
  }
399
+ if (target.featureFlags || source.featureFlags) {
400
+ out.featureFlags = { ...(_c = target.featureFlags) != null ? _c : {}, ...(_d = source.featureFlags) != null ? _d : {} };
401
+ }
399
402
  if (target.attachments || source.attachments) {
400
- out.attachments = [...(_c = target.attachments) != null ? _c : [], ...(_d = source.attachments) != null ? _d : []];
403
+ out.attachments = [...(_e = target.attachments) != null ? _e : [], ...(_f = source.attachments) != null ? _f : []];
401
404
  }
402
405
  return out;
403
406
  }
@@ -667,6 +670,7 @@ var EventShipper = class {
667
670
  ...wizardSession ? { "raindrop.wizardSession": wizardSession } : {},
668
671
  $context: this.context
669
672
  },
673
+ ...accumulated.featureFlags && Object.keys(accumulated.featureFlags).length > 0 ? { feature_flags: accumulated.featureFlags } : {},
670
674
  attachments: accumulated.attachments,
671
675
  is_pending: isPending
672
676
  };
@@ -1165,6 +1169,15 @@ function installTracingSuppressionHook() {
1165
1169
  installTracingSuppressionHook();
1166
1170
 
1167
1171
  // src/callback-handler.ts
1172
+ function resolveEventId(source) {
1173
+ if (typeof source !== "function") return randomUUID();
1174
+ try {
1175
+ const id = source();
1176
+ return typeof id === "string" && id.trim() !== "" ? id : randomUUID();
1177
+ } catch {
1178
+ return randomUUID();
1179
+ }
1180
+ }
1168
1181
  function isInternalName(name) {
1169
1182
  if (name.startsWith("Branch:")) return true;
1170
1183
  if (name.startsWith("ChannelWrite")) return true;
@@ -1213,13 +1226,15 @@ var RaindropDeepAgentsHandler = class extends BaseCallbackHandler {
1213
1226
  this.traceShipper = opts.traceShipper;
1214
1227
  this.userId = opts.userId;
1215
1228
  this.convoId = opts.convoId;
1229
+ this.eventName = opts.eventName;
1230
+ this.eventIdSource = opts.eventId;
1216
1231
  this.traceChains = opts.traceChains ?? true;
1217
1232
  }
1218
1233
  getEventId(runId, parentRunId) {
1219
1234
  const rootId = parentRunId ? this.rootRunIds.get(parentRunId) ?? parentRunId : runId;
1220
1235
  this.rootRunIds.set(runId, rootId);
1221
1236
  if (!this.eventIds.has(rootId)) {
1222
- this.eventIds.set(rootId, randomUUID());
1237
+ this.eventIds.set(rootId, resolveEventId(this.eventIdSource));
1223
1238
  }
1224
1239
  return this.eventIds.get(rootId);
1225
1240
  }
@@ -1248,10 +1263,11 @@ var RaindropDeepAgentsHandler = class extends BaseCallbackHandler {
1248
1263
  const eventId = this.eventIds.get(rootId);
1249
1264
  if (!eventId) return;
1250
1265
  if (isRoot) {
1251
- if (this.convoId) {
1266
+ if (this.convoId || this.eventName) {
1252
1267
  await this.eventShipper.patch(eventId, {
1253
1268
  userId: this.userId,
1254
1269
  convoId: this.convoId,
1270
+ eventName: this.eventName,
1255
1271
  isPending: true
1256
1272
  });
1257
1273
  }
@@ -1260,6 +1276,7 @@ var RaindropDeepAgentsHandler = class extends BaseCallbackHandler {
1260
1276
  await this.eventShipper.patch(eventId, {
1261
1277
  userId: this.userId,
1262
1278
  convoId: this.convoId,
1279
+ eventName: this.eventName,
1263
1280
  ...patch,
1264
1281
  isPending: true
1265
1282
  });
@@ -1286,6 +1303,7 @@ var RaindropDeepAgentsHandler = class extends BaseCallbackHandler {
1286
1303
  await this.eventShipper.patch(eventId, {
1287
1304
  userId: this.userId,
1288
1305
  convoId: this.convoId,
1306
+ eventName: this.eventName,
1289
1307
  input: truncate(prompts.join("\n"), CHAIN_TEXT_MAX_LEN),
1290
1308
  properties: buildProperties(tags, metadata),
1291
1309
  isPending: true
@@ -1319,6 +1337,7 @@ var RaindropDeepAgentsHandler = class extends BaseCallbackHandler {
1319
1337
  await this.eventShipper.patch(eventId, {
1320
1338
  userId: this.userId,
1321
1339
  convoId: this.convoId,
1340
+ eventName: this.eventName,
1322
1341
  input: inputText,
1323
1342
  properties: buildProperties(tags, metadata),
1324
1343
  isPending: true
@@ -1738,6 +1757,8 @@ function createRaindropDeepAgents(opts) {
1738
1757
  traceShipper,
1739
1758
  userId: opts.userId,
1740
1759
  convoId: opts.convoId,
1760
+ eventName: opts.eventName,
1761
+ eventId: opts.eventId,
1741
1762
  traceChains: opts.traceChains
1742
1763
  });
1743
1764
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raindrop-ai/deep-agents",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "description": "Raindrop integration for LangChain Deep Agents",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -36,7 +36,7 @@
36
36
  "typescript": "^5.3.3",
37
37
  "vitest": "^2.1.9",
38
38
  "zod": "^3.23.0",
39
- "@raindrop-ai/core": "0.0.5"
39
+ "@raindrop-ai/core": "0.1.2"
40
40
  },
41
41
  "tsup": {
42
42
  "entry": [