@botpress/runtime 1.6.2 → 1.6.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.
Files changed (187) hide show
  1. package/dist/_types/actions.d.ts +1 -1
  2. package/dist/_types/actions.d.ts.map +1 -1
  3. package/dist/_types/channels.d.ts +1 -1
  4. package/dist/_types/channels.d.ts.map +1 -1
  5. package/dist/_types/conversations.d.ts +3 -3
  6. package/dist/_types/conversations.d.ts.map +1 -1
  7. package/dist/_types/events.d.ts +1 -1
  8. package/dist/_types/events.d.ts.map +1 -1
  9. package/dist/_types/integration-actions.d.ts +1 -1
  10. package/dist/_types/integration-actions.d.ts.map +1 -1
  11. package/dist/_types/integrations.d.ts +1 -1
  12. package/dist/_types/integrations.d.ts.map +1 -1
  13. package/dist/_types/state.d.ts +1 -1
  14. package/dist/_types/state.d.ts.map +1 -1
  15. package/dist/_types/tables.d.ts +1 -1
  16. package/dist/_types/tables.d.ts.map +1 -1
  17. package/dist/_types/triggers.d.ts +1 -1
  18. package/dist/_types/triggers.d.ts.map +1 -1
  19. package/dist/_types/workflows.d.ts +4 -4
  20. package/dist/_types/workflows.d.ts.map +1 -1
  21. package/dist/constants.d.ts.map +1 -1
  22. package/dist/consts.d.ts.map +1 -1
  23. package/dist/debugging/node-inspector.d.ts +1 -1
  24. package/dist/debugging/node-inspector.d.ts.map +1 -1
  25. package/dist/define-config.d.ts +3 -3
  26. package/dist/define-config.d.ts.map +1 -1
  27. package/dist/definition.d.ts +4 -4
  28. package/dist/definition.d.ts.map +1 -1
  29. package/dist/definition.js +137 -494
  30. package/dist/definition.js.map +2 -2
  31. package/dist/environment.d.ts +17 -17
  32. package/dist/environment.d.ts.map +1 -1
  33. package/dist/errors.d.ts +1 -1
  34. package/dist/errors.d.ts.map +1 -1
  35. package/dist/globals.d.ts.map +1 -1
  36. package/dist/internal.d.ts +9 -9
  37. package/dist/internal.d.ts.map +1 -1
  38. package/dist/internal.js +156 -549
  39. package/dist/internal.js.map +2 -2
  40. package/dist/library.d.ts +18 -18
  41. package/dist/library.d.ts.map +1 -1
  42. package/dist/library.js +141 -506
  43. package/dist/library.js.map +2 -2
  44. package/dist/primitives/action.d.ts +7 -7
  45. package/dist/primitives/action.d.ts.map +1 -1
  46. package/dist/primitives/asset.d.ts.map +1 -1
  47. package/dist/primitives/conversation-instance.d.ts +6 -6
  48. package/dist/primitives/conversation-instance.d.ts.map +1 -1
  49. package/dist/primitives/conversation.d.ts +15 -15
  50. package/dist/primitives/conversation.d.ts.map +1 -1
  51. package/dist/primitives/data-sources/index.d.ts +5 -5
  52. package/dist/primitives/data-sources/index.d.ts.map +1 -1
  53. package/dist/primitives/data-sources/source-base.d.ts +3 -3
  54. package/dist/primitives/data-sources/source-base.d.ts.map +1 -1
  55. package/dist/primitives/data-sources/source-directory.d.ts +1 -1
  56. package/dist/primitives/data-sources/source-directory.d.ts.map +1 -1
  57. package/dist/primitives/data-sources/source-table.d.ts +2 -2
  58. package/dist/primitives/data-sources/source-table.d.ts.map +1 -1
  59. package/dist/primitives/data-sources/source-website.d.ts +2 -2
  60. package/dist/primitives/data-sources/source-website.d.ts.map +1 -1
  61. package/dist/primitives/definition.d.ts +8 -8
  62. package/dist/primitives/definition.d.ts.map +1 -1
  63. package/dist/primitives/index.d.ts +18 -18
  64. package/dist/primitives/index.d.ts.map +1 -1
  65. package/dist/primitives/knowledge.d.ts +2 -2
  66. package/dist/primitives/knowledge.d.ts.map +1 -1
  67. package/dist/primitives/table.d.ts +31 -31
  68. package/dist/primitives/table.d.ts.map +1 -1
  69. package/dist/primitives/trigger.d.ts +5 -5
  70. package/dist/primitives/trigger.d.ts.map +1 -1
  71. package/dist/primitives/workflow-instance.d.ts +8 -8
  72. package/dist/primitives/workflow-instance.d.ts.map +1 -1
  73. package/dist/primitives/workflow-step.d.ts +4 -4
  74. package/dist/primitives/workflow-step.d.ts.map +1 -1
  75. package/dist/primitives/workflow-utils.d.ts +5 -5
  76. package/dist/primitives/workflow-utils.d.ts.map +1 -1
  77. package/dist/primitives/workflow.d.ts +13 -13
  78. package/dist/primitives/workflow.d.ts.map +1 -1
  79. package/dist/runtime/actions.d.ts +2 -2
  80. package/dist/runtime/actions.d.ts.map +1 -1
  81. package/dist/runtime/adk.d.ts +7 -7
  82. package/dist/runtime/adk.d.ts.map +1 -1
  83. package/dist/runtime/agent-registry.d.ts +1 -1
  84. package/dist/runtime/agent-registry.d.ts.map +1 -1
  85. package/dist/runtime/assets.d.ts.map +1 -1
  86. package/dist/runtime/autonomous.d.ts +16 -16
  87. package/dist/runtime/autonomous.d.ts.map +1 -1
  88. package/dist/runtime/chat/chat.d.ts +4 -4
  89. package/dist/runtime/chat/chat.d.ts.map +1 -1
  90. package/dist/runtime/chat/citations.d.ts +1 -1
  91. package/dist/runtime/chat/citations.d.ts.map +1 -1
  92. package/dist/runtime/chat/components.d.ts +21 -21
  93. package/dist/runtime/chat/components.d.ts.map +1 -1
  94. package/dist/runtime/chat/html.d.ts.map +1 -1
  95. package/dist/runtime/chat/index.d.ts +4 -4
  96. package/dist/runtime/chat/index.d.ts.map +1 -1
  97. package/dist/runtime/chat/messages.d.ts +2 -2
  98. package/dist/runtime/chat/messages.d.ts.map +1 -1
  99. package/dist/runtime/chat/transcript.d.ts +5 -5
  100. package/dist/runtime/chat/transcript.d.ts.map +1 -1
  101. package/dist/runtime/chat/truncate-object.d.ts.map +1 -1
  102. package/dist/runtime/chat/truncate-transcript.d.ts +1 -1
  103. package/dist/runtime/chat/truncate-transcript.d.ts.map +1 -1
  104. package/dist/runtime/config.d.ts.map +1 -1
  105. package/dist/runtime/context/cognitive.d.ts +1 -1
  106. package/dist/runtime/context/cognitive.d.ts.map +1 -1
  107. package/dist/runtime/context/context.d.ts +10 -10
  108. package/dist/runtime/context/context.d.ts.map +1 -1
  109. package/dist/runtime/context/handlers.d.ts +5 -5
  110. package/dist/runtime/context/handlers.d.ts.map +1 -1
  111. package/dist/runtime/context/http.d.ts +4 -4
  112. package/dist/runtime/context/http.d.ts.map +1 -1
  113. package/dist/runtime/context/inspector-handler.d.ts.map +1 -1
  114. package/dist/runtime/context/promises.d.ts.map +1 -1
  115. package/dist/runtime/events.d.ts.map +1 -1
  116. package/dist/runtime/handlers/conversation-matching.d.ts.map +1 -1
  117. package/dist/runtime/handlers/conversation.d.ts +1 -1
  118. package/dist/runtime/handlers/conversation.d.ts.map +1 -1
  119. package/dist/runtime/handlers/event.d.ts +1 -1
  120. package/dist/runtime/handlers/event.d.ts.map +1 -1
  121. package/dist/runtime/handlers/index.d.ts +4 -4
  122. package/dist/runtime/handlers/index.d.ts.map +1 -1
  123. package/dist/runtime/handlers/trigger.d.ts +1 -1
  124. package/dist/runtime/handlers/trigger.d.ts.map +1 -1
  125. package/dist/runtime/handlers/workflow.d.ts +1 -1
  126. package/dist/runtime/handlers/workflow.d.ts.map +1 -1
  127. package/dist/runtime/heavy-imports.d.ts.map +1 -1
  128. package/dist/runtime/index.d.ts +11 -11
  129. package/dist/runtime/index.d.ts.map +1 -1
  130. package/dist/runtime/interfaces.d.ts.map +1 -1
  131. package/dist/runtime/singletons.d.ts.map +1 -1
  132. package/dist/runtime/state.d.ts +1 -1
  133. package/dist/runtime/state.d.ts.map +1 -1
  134. package/dist/runtime/tracked-state-schema.d.ts.map +1 -1
  135. package/dist/runtime/tracked-state.d.ts +5 -5
  136. package/dist/runtime/tracked-state.d.ts.map +1 -1
  137. package/dist/runtime/workflows/index.d.ts +1 -1
  138. package/dist/runtime/workflows/index.d.ts.map +1 -1
  139. package/dist/runtime/workflows/knowledge-indexing.d.ts +1 -1
  140. package/dist/runtime/workflows/knowledge-indexing.d.ts.map +1 -1
  141. package/dist/runtime.d.ts +13 -13
  142. package/dist/runtime.d.ts.map +1 -1
  143. package/dist/runtime.js +223 -666
  144. package/dist/runtime.js.map +2 -2
  145. package/dist/telemetry/context-manager.d.ts +2 -2
  146. package/dist/telemetry/context-manager.d.ts.map +1 -1
  147. package/dist/telemetry/file-exporter.d.ts +1 -1
  148. package/dist/telemetry/file-exporter.d.ts.map +1 -1
  149. package/dist/telemetry/instrument-http.d.ts +1 -1
  150. package/dist/telemetry/instrument-http.d.ts.map +1 -1
  151. package/dist/telemetry/live-file-processor.d.ts +2 -2
  152. package/dist/telemetry/live-file-processor.d.ts.map +1 -1
  153. package/dist/telemetry/span-helpers.d.ts +8 -8
  154. package/dist/telemetry/span-helpers.d.ts.map +1 -1
  155. package/dist/telemetry/spans/factory.d.ts +11 -11
  156. package/dist/telemetry/spans/factory.d.ts.map +1 -1
  157. package/dist/telemetry/spans/index.d.ts +98 -98
  158. package/dist/telemetry/spans/index.d.ts.map +1 -1
  159. package/dist/telemetry/spans/well-known-attributes.d.ts +5 -5
  160. package/dist/telemetry/spans/well-known-attributes.d.ts.map +1 -1
  161. package/dist/telemetry/structured-logging.d.ts.map +1 -1
  162. package/dist/telemetry/tracing.d.ts +3 -3
  163. package/dist/telemetry/tracing.d.ts.map +1 -1
  164. package/dist/telemetry/utils.d.ts +1 -1
  165. package/dist/telemetry/utils.d.ts.map +1 -1
  166. package/dist/types.d.ts +4 -4
  167. package/dist/types.d.ts.map +1 -1
  168. package/dist/ui.d.ts +4 -4
  169. package/dist/ui.d.ts.map +1 -1
  170. package/dist/ui.js +9 -76
  171. package/dist/ui.js.map +2 -2
  172. package/dist/utilities/abort-signal.d.ts.map +1 -1
  173. package/dist/utilities/events.d.ts +2 -2
  174. package/dist/utilities/events.d.ts.map +1 -1
  175. package/dist/utilities/promises.d.ts.map +1 -1
  176. package/dist/utilities/size.d.ts.map +1 -1
  177. package/dist/utilities/strings.d.ts.map +1 -1
  178. package/dist/utilities/trigger-tags.d.ts.map +1 -1
  179. package/dist/utilities/types.d.ts.map +1 -1
  180. package/dist/workers/dev_worker.d.ts +1 -1
  181. package/dist/workers/dev_worker.d.ts.map +1 -1
  182. package/dist/workers/index.d.ts +3 -3
  183. package/dist/workers/index.d.ts.map +1 -1
  184. package/dist/workers/parent_worker.d.ts +1 -1
  185. package/dist/workers/parent_worker.d.ts.map +1 -1
  186. package/dist/workers/worker_pool.d.ts.map +1 -1
  187. package/package.json +3 -6
@@ -48,7 +48,7 @@ var init_define_BUILD = __esm({
48
48
  var define_PACKAGE_VERSIONS_default;
49
49
  var init_define_PACKAGE_VERSIONS = __esm({
50
50
  "<define:__PACKAGE_VERSIONS__>"() {
51
- define_PACKAGE_VERSIONS_default = { runtime: "1.6.2", adk: "not-installed", sdk: "4.17.3", llmz: "0.0.27", zai: "2.3.0", cognitive: "0.1.50" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.6.4", adk: "not-installed", sdk: "4.17.3", llmz: "0.0.27", zai: "2.4.0", cognitive: "0.2.0" };
52
52
  }
53
53
  });
54
54
 
@@ -34304,12 +34304,7 @@ var AttachmentSchema = z.object({
34304
34304
  });
34305
34305
  var TranscriptItemSchema = z.object({
34306
34306
  id: z.string(),
34307
- role: z.union([
34308
- z.literal("assistant"),
34309
- z.literal("user"),
34310
- z.literal("event"),
34311
- z.literal("summary")
34312
- ]),
34307
+ role: z.union([z.literal("assistant"), z.literal("user"), z.literal("event"), z.literal("summary")]),
34313
34308
  name: z.string().optional(),
34314
34309
  createdAt: z.string().optional(),
34315
34310
  content: z.string().optional(),
@@ -38230,10 +38225,7 @@ var INDEX_DIR2 = path2.join(DIR2, "index");
38230
38225
  var append2 = (o) => fs2.appendFile(LIVE, JSON.stringify(o) + "\n", () => {
38231
38226
  });
38232
38227
  var appendToDay = (o) => {
38233
- const dayFile2 = path2.join(
38234
- DIR2,
38235
- `${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.ndjson`
38236
- );
38228
+ const dayFile2 = path2.join(DIR2, `${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.ndjson`);
38237
38229
  fs2.appendFile(dayFile2, JSON.stringify(o) + "\n", () => {
38238
38230
  });
38239
38231
  };
@@ -38243,10 +38235,7 @@ var appendToTrace = (traceId, o) => {
38243
38235
  });
38244
38236
  };
38245
38237
  var appendToIndex = (o) => {
38246
- const indexFile2 = path2.join(
38247
- INDEX_DIR2,
38248
- `${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.ndjson`
38249
- );
38238
+ const indexFile2 = path2.join(INDEX_DIR2, `${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.ndjson`);
38250
38239
  fs2.appendFile(indexFile2, JSON.stringify(o) + "\n", () => {
38251
38240
  });
38252
38241
  };
@@ -38260,8 +38249,7 @@ var LiveFileSpanProcessor = class {
38260
38249
  this.timer = setInterval(() => {
38261
38250
  if (!this.active.size) return;
38262
38251
  const ts = nowNs();
38263
- for (const [spanId, traceId] of this.active)
38264
- append2({ t: "beat", traceId, spanId, ts });
38252
+ for (const [spanId, traceId] of this.active) append2({ t: "beat", traceId, spanId, ts });
38265
38253
  }, beatMs);
38266
38254
  this.timer.unref?.();
38267
38255
  }
@@ -38271,9 +38259,7 @@ var LiveFileSpanProcessor = class {
38271
38259
  onStart(span2, _ctx) {
38272
38260
  const ctx = span2.spanContext();
38273
38261
  this.active.set(ctx.spanId, ctx.traceId);
38274
- const startNs = Number(
38275
- span2.startTime?.[0] != null ? span2.startTime[0] * 1e9 + span2.startTime[1] : nowNs()
38276
- );
38262
+ const startNs = Number(span2.startTime?.[0] != null ? span2.startTime[0] * 1e9 + span2.startTime[1] : nowNs());
38277
38263
  const startEvent = {
38278
38264
  t: "start",
38279
38265
  traceId: ctx.traceId,
@@ -38298,13 +38284,7 @@ var LiveFileSpanProcessor = class {
38298
38284
  handler: span2.name
38299
38285
  // Use span name as handler
38300
38286
  };
38301
- const trackedIds = [
38302
- "conversationId",
38303
- "messageId",
38304
- "eventId",
38305
- "userId",
38306
- "workflowId"
38307
- ];
38287
+ const trackedIds = ["conversationId", "messageId", "eventId", "userId", "workflowId"];
38308
38288
  for (const idKey of trackedIds) {
38309
38289
  if (span2.attributes[idKey]) {
38310
38290
  indexEntry[idKey] = span2.attributes[idKey];
@@ -38406,8 +38386,7 @@ function extractIds(fullUrl, body) {
38406
38386
  if (userMatch?.[1]) ids.userId = userMatch[1];
38407
38387
  if (eventMatch?.[1]) ids.eventId = eventMatch[1];
38408
38388
  if (body && typeof body === "object") {
38409
- if (body.conversationId && !ids.conversationId)
38410
- ids.conversationId = body.conversationId;
38389
+ if (body.conversationId && !ids.conversationId) ids.conversationId = body.conversationId;
38411
38390
  if (body.messageId && !ids.messageId) ids.messageId = body.messageId;
38412
38391
  if (body.workflowId && !ids.workflowId) ids.workflowId = body.workflowId;
38413
38392
  if (body.userId && !ids.userId) ids.userId = body.userId;
@@ -38415,9 +38394,7 @@ function extractIds(fullUrl, body) {
38415
38394
  }
38416
38395
  return ids;
38417
38396
  }
38418
- function installHttpClientInstrumentation({
38419
- injectTraceHeader = true
38420
- } = {}) {
38397
+ function installHttpClientInstrumentation({ injectTraceHeader = true } = {}) {
38421
38398
  const restores = [];
38422
38399
  const genId = (n) => randomBytes(n).toString("hex");
38423
38400
  const makeTraceparent = () => `00-${genId(16)}-${genId(8)}-01`;
@@ -38487,8 +38464,7 @@ function installHttpClientInstrumentation({
38487
38464
  },
38488
38465
  context.active()
38489
38466
  );
38490
- if (injectTraceHeader && !("traceparent" in options.headers))
38491
- options.headers.traceparent = traceparent;
38467
+ if (injectTraceHeader && !("traceparent" in options.headers)) options.headers.traceparent = traceparent;
38492
38468
  let req;
38493
38469
  if (typeof args[0] === "string" || args[0] instanceof URL) {
38494
38470
  req = requestFn.call(this, args[0], options, cb);
@@ -38510,18 +38486,12 @@ function installHttpClientInstrumentation({
38510
38486
  }
38511
38487
  if (requestBodyChunks.length > 0) {
38512
38488
  const bodyString = Buffer.concat(requestBodyChunks).toString("utf-8");
38513
- span2.setAttribute(
38514
- isBotpress ? "botpress.request.body" : "http.request.body",
38515
- bodyString
38516
- );
38489
+ span2.setAttribute(isBotpress ? "botpress.request.body" : "http.request.body", bodyString);
38517
38490
  }
38518
38491
  return origEnd(chunk, ...args2);
38519
38492
  };
38520
38493
  req.on("response", (res) => {
38521
- span2.setAttribute(
38522
- isBotpress ? "botpress.status_code" : "http.status_code",
38523
- res.statusCode || 0
38524
- );
38494
+ span2.setAttribute(isBotpress ? "botpress.status_code" : "http.status_code", res.statusCode || 0);
38525
38495
  const responseBodyChunks = [];
38526
38496
  res.on("data", (chunk) => {
38527
38497
  responseBodyChunks.push(chunk);
@@ -38529,10 +38499,7 @@ function installHttpClientInstrumentation({
38529
38499
  res.on("end", () => {
38530
38500
  if (responseBodyChunks.length > 0) {
38531
38501
  const bodyString = Buffer.concat(responseBodyChunks).toString("utf-8");
38532
- span2.setAttribute(
38533
- isBotpress ? "botpress.response.body" : "http.response.body",
38534
- bodyString
38535
- );
38502
+ span2.setAttribute(isBotpress ? "botpress.response.body" : "http.response.body", bodyString);
38536
38503
  }
38537
38504
  if ((res.statusCode || 0) >= 400) {
38538
38505
  span2.setStatus({
@@ -38544,10 +38511,7 @@ function installHttpClientInstrumentation({
38544
38511
  });
38545
38512
  });
38546
38513
  req.on("error", (err) => {
38547
- span2.setAttribute(
38548
- isBotpress ? "botpress.error" : "http.error",
38549
- err.message
38550
- );
38514
+ span2.setAttribute(isBotpress ? "botpress.error" : "http.error", err.message);
38551
38515
  span2.recordException(err);
38552
38516
  span2.setStatus({
38553
38517
  code: SpanStatusCode.ERROR,
@@ -38565,6 +38529,7 @@ function installHttpClientInstrumentation({
38565
38529
  httpsRequest: https2.request,
38566
38530
  httpsGet: https2.get
38567
38531
  };
38532
+ ;
38568
38533
  http2.request = wrapRequest2(orig.httpRequest);
38569
38534
  https2.request = wrapRequest2(orig.httpsRequest);
38570
38535
  http2.get = function wrappedGet(...a) {
@@ -38658,10 +38623,7 @@ function installHttpClientInstrumentation({
38658
38623
  }
38659
38624
  }
38660
38625
  if (requestBody) {
38661
- span2.setAttribute(
38662
- isBotpress ? "botpress.request.body" : "http.request.body",
38663
- requestBody
38664
- );
38626
+ span2.setAttribute(isBotpress ? "botpress.request.body" : "http.request.body", requestBody);
38665
38627
  }
38666
38628
  }
38667
38629
  const traceparent = makeTraceparent();
@@ -38669,10 +38631,7 @@ function installHttpClientInstrumentation({
38669
38631
  if (Array.isArray(opts.headers)) {
38670
38632
  headers.push(...opts.headers);
38671
38633
  } else if (opts.headers && typeof opts.headers === "object") {
38672
- for (const [k, v] of Object.entries(
38673
- opts.headers
38674
- ))
38675
- headers.push(k, String(v));
38634
+ for (const [k, v] of Object.entries(opts.headers)) headers.push(k, String(v));
38676
38635
  }
38677
38636
  headers.push(INSTRUMENTED_HEADER, "true");
38678
38637
  if (injectTraceHeader) {
@@ -38690,10 +38649,7 @@ function installHttpClientInstrumentation({
38690
38649
  onConnect: handler.onConnect?.bind(handler),
38691
38650
  onUpgrade: handler.onUpgrade?.bind(handler),
38692
38651
  onHeaders: (statusCode, rawHeaders, resume) => {
38693
- span2.setAttribute(
38694
- isBotpress ? "botpress.status_code" : "http.status_code",
38695
- statusCode
38696
- );
38652
+ span2.setAttribute(isBotpress ? "botpress.status_code" : "http.status_code", statusCode);
38697
38653
  if (statusCode >= 500) {
38698
38654
  span2.setStatus({
38699
38655
  code: SpanStatusCode.ERROR,
@@ -38708,10 +38664,7 @@ function installHttpClientInstrumentation({
38708
38664
  handler.onHeaders?.(statusCode, rawHeaders, resume);
38709
38665
  },
38710
38666
  onError: (err) => {
38711
- span2.setAttribute(
38712
- isBotpress ? "botpress.error" : "http.error",
38713
- err.message
38714
- );
38667
+ span2.setAttribute(isBotpress ? "botpress.error" : "http.error", err.message);
38715
38668
  span2.recordException(err);
38716
38669
  span2.setStatus({
38717
38670
  code: SpanStatusCode.ERROR,
@@ -38728,10 +38681,7 @@ function installHttpClientInstrumentation({
38728
38681
  onComplete: (trailers) => {
38729
38682
  if (responseBodyChunks.length > 0) {
38730
38683
  const bodyString = Buffer.concat(responseBodyChunks).toString("utf-8");
38731
- span2.setAttribute(
38732
- isBotpress ? "botpress.response.body" : "http.response.body",
38733
- bodyString
38734
- );
38684
+ span2.setAttribute(isBotpress ? "botpress.response.body" : "http.response.body", bodyString);
38735
38685
  }
38736
38686
  span2.end();
38737
38687
  handler.onComplete?.(trailers);
@@ -38768,6 +38718,7 @@ init_define_BUILD();
38768
38718
  init_define_PACKAGE_VERSIONS();
38769
38719
  function getSingleton(key, factory2) {
38770
38720
  if (!globalThis[key]) {
38721
+ ;
38771
38722
  globalThis[key] = factory2();
38772
38723
  }
38773
38724
  return globalThis[key];
@@ -38915,10 +38866,8 @@ function inspectToJsonSize(input, opts) {
38915
38866
  if (value === null) return null;
38916
38867
  const t = typeof value;
38917
38868
  if (t === "boolean" || t === "number") return value;
38918
- if (t === "string")
38919
- return elideString(value, limits2.head, limits2.tail);
38920
- if (t === "bigint")
38921
- return elideString(String(value), limits2.head, limits2.tail);
38869
+ if (t === "string") return elideString(value, limits2.head, limits2.tail);
38870
+ if (t === "bigint") return elideString(String(value), limits2.head, limits2.tail);
38922
38871
  if (t === "symbol" || t === "function" || t === "undefined") {
38923
38872
  return null;
38924
38873
  }
@@ -38973,8 +38922,7 @@ function inspectToJsonSize(input, opts) {
38973
38922
  const k = keys[i];
38974
38923
  props[k] = summarize(value[k], seen, nextLimits);
38975
38924
  }
38976
- if (keys.length > keep)
38977
- props["__truncated__"] = `+${keys.length - keep} keys`;
38925
+ if (keys.length > keep) props["__truncated__"] = `+${keys.length - keep} keys`;
38978
38926
  seen.delete(value);
38979
38927
  return { [`<${tag}>`]: props };
38980
38928
  }
@@ -39076,10 +39024,7 @@ init_define_PACKAGE_VERSIONS();
39076
39024
  init_define_BUILD();
39077
39025
  init_define_PACKAGE_VERSIONS();
39078
39026
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
39079
- var storage = getSingleton(
39080
- "__ADK_GLOBAL_CTX_STORAGE",
39081
- () => new AsyncLocalStorage2()
39082
- );
39027
+ var storage = getSingleton("__ADK_GLOBAL_CTX_STORAGE", () => new AsyncLocalStorage2());
39083
39028
  var context2 = {
39084
39029
  enterWith: (data) => {
39085
39030
  storage.enterWith(data);
@@ -39094,10 +39039,7 @@ var context2 = {
39094
39039
  },
39095
39040
  getAll: () => {
39096
39041
  const store = storage.getStore();
39097
- if (!store)
39098
- throw new Error(
39099
- "No context found. Did you forget to call `context.run()`?"
39100
- );
39042
+ if (!store) throw new Error("No context found. Did you forget to call `context.run()`?");
39101
39043
  return store;
39102
39044
  },
39103
39045
  get: (key, opts) => {
@@ -39137,9 +39079,7 @@ var getPromiseTracker = () => {
39137
39079
  if (tracker) {
39138
39080
  return tracker;
39139
39081
  }
39140
- throw new Error(
39141
- "PromiseTracker not found in context. Make sure to initialize it in your runtime setup."
39142
- );
39082
+ throw new Error("PromiseTracker not found in context. Make sure to initialize it in your runtime setup.");
39143
39083
  };
39144
39084
  function trackPromise(promise) {
39145
39085
  return getPromiseTracker().register(promise);
@@ -39203,16 +39143,11 @@ var AgentRegistry = class {
39203
39143
  }
39204
39144
  ensureInitialized() {
39205
39145
  if (!this._data) {
39206
- throw new Error(
39207
- "Agent registry not initialized. Call agentRegistry.initialize() during bot startup."
39208
- );
39146
+ throw new Error("Agent registry not initialized. Call agentRegistry.initialize() during bot startup.");
39209
39147
  }
39210
39148
  }
39211
39149
  };
39212
- var agentRegistry = getSingleton(
39213
- "__ADK_GLOBAL_AGENT_REGISTRY",
39214
- () => new AgentRegistry()
39215
- );
39150
+ var agentRegistry = getSingleton("__ADK_GLOBAL_AGENT_REGISTRY", () => new AgentRegistry());
39216
39151
 
39217
39152
  // src/runtime/heavy-imports.ts
39218
39153
  init_define_BUILD();
@@ -39300,11 +39235,7 @@ init_define_PACKAGE_VERSIONS();
39300
39235
  // src/runtime/chat/chat.ts
39301
39236
  init_define_BUILD();
39302
39237
  init_define_PACKAGE_VERSIONS();
39303
- import {
39304
- Chat,
39305
- DefaultComponents,
39306
- isAnyComponent as isAnyComponent2
39307
- } from "llmz";
39238
+ import { Chat, DefaultComponents, isAnyComponent as isAnyComponent2 } from "llmz";
39308
39239
 
39309
39240
  // src/runtime/chat/truncate-transcript.ts
39310
39241
  init_define_BUILD();
@@ -39633,9 +39564,7 @@ init_define_PACKAGE_VERSIONS();
39633
39564
  init_define_BUILD();
39634
39565
  init_define_PACKAGE_VERSIONS();
39635
39566
  init_esm();
39636
- import {
39637
- getValue
39638
- } from "llmz";
39567
+ import { getValue } from "llmz";
39639
39568
  import {
39640
39569
  Tool as LlmzTool,
39641
39570
  ThinkSignal as _ThinkSignal,
@@ -39653,9 +39582,7 @@ init_define_BUILD();
39653
39582
  init_define_PACKAGE_VERSIONS();
39654
39583
  function createJoinedAbortController(signals) {
39655
39584
  const controller = new AbortController();
39656
- const validSignals = signals.filter(
39657
- (signal) => signal != null
39658
- );
39585
+ const validSignals = signals.filter((signal) => signal != null);
39659
39586
  if (validSignals.length === 0) {
39660
39587
  return controller;
39661
39588
  }
@@ -39780,9 +39707,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
39780
39707
  const client = context2.get("client");
39781
39708
  const citations = context2.get("citations");
39782
39709
  if (!client) {
39783
- throw new Error(
39784
- "Client is not available in this context. Make sure to run in a context with a client."
39785
- );
39710
+ throw new Error("Client is not available in this context. Make sure to run in a context with a client.");
39786
39711
  }
39787
39712
  const { passages } = await client.searchFiles({
39788
39713
  query,
@@ -39832,9 +39757,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
39832
39757
  citationMetadata.sourceId = tags[WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID];
39833
39758
  }
39834
39759
  const { tag } = citations.registerSource(citationMetadata);
39835
- message.push(
39836
- `<${tag} file="${p.file.key}" title="${citationMetadata.title || p.file.key}">`
39837
- );
39760
+ message.push(`<${tag} file="${p.file.key}" title="${citationMetadata.title || p.file.key}">`);
39838
39761
  message.push(p.content);
39839
39762
  message.push(`</${tag}>`);
39840
39763
  }
@@ -39850,9 +39773,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
39850
39773
  return async (props) => {
39851
39774
  const cognitive = context2.get("cognitive");
39852
39775
  if (!cognitive) {
39853
- throw new Error(
39854
- "Cognitive client is not available in this context. Make sure to run in a cognitive context."
39855
- );
39776
+ throw new Error("Cognitive client is not available in this context. Make sure to run in a cognitive context.");
39856
39777
  }
39857
39778
  const defaultTemperature = 0.7;
39858
39779
  const maxLoops = import_lodash2.default.clamp(props.iterations ?? 10, 1, 100);
@@ -39864,10 +39785,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
39864
39785
  "autonomous.mode": options.mode
39865
39786
  },
39866
39787
  async (execSpan) => {
39867
- const joinedSignal = createJoinedAbortSignal([
39868
- props.signal,
39869
- options.interruption
39870
- ]);
39788
+ const joinedSignal = createJoinedAbortSignal([props.signal, options.interruption]);
39871
39789
  const llmz_execute = (await import("llmz")).execute;
39872
39790
  const asyncResource = new AsyncResource("autonomous.execution");
39873
39791
  const getNewIteration = (index) => createSpan(
@@ -39885,17 +39803,11 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
39885
39803
  );
39886
39804
  const _chat = options.mode === "chat" ? context2.get("chat") : void 0;
39887
39805
  if (options.mode === "chat" && !_chat) {
39888
- throw new Error(
39889
- "Chat is not available in this context. Make sure to run in chat mode with a chat context."
39890
- );
39806
+ throw new Error("Chat is not available in this context. Make sure to run in chat mode with a chat context.");
39891
39807
  }
39892
39808
  const chat = _chat ? {
39893
- components: bindContext(
39894
- (ctx) => getValue(_chat.components, ctx)
39895
- ),
39896
- transcript: bindContext(
39897
- (ctx) => getValue(_chat.transcript, ctx)
39898
- ),
39809
+ components: bindContext((ctx) => getValue(_chat.components, ctx)),
39810
+ transcript: bindContext((ctx) => getValue(_chat.transcript, ctx)),
39899
39811
  handler: bindContext(_chat.handler),
39900
39812
  onExecutionDone: bindContext(_chat.onExecutionDone)
39901
39813
  } : void 0;
@@ -39930,10 +39842,7 @@ Always prefer information from the knowledge bases over general knowledge when a
39930
39842
  ...props.objects && {
39931
39843
  objects: async (ctx) => {
39932
39844
  const objs = await getValue(props.objects, ctx) ?? [];
39933
- iterationSpan?.setAttribute(
39934
- "autonomous.objects",
39935
- objs.map((o) => o.name).join(", ")
39936
- );
39845
+ iterationSpan?.setAttribute("autonomous.objects", objs.map((o) => o.name).join(", "));
39937
39846
  for (const obj of objs) {
39938
39847
  obj.tools = obj.tools?.map(
39939
39848
  (tool) => tool.clone({
@@ -39997,10 +39906,7 @@ Always prefer information from the knowledge bases over general knowledge when a
39997
39906
  if (search_knowledge) {
39998
39907
  allTools.push(search_knowledge);
39999
39908
  }
40000
- iterationSpan?.setAttribute(
40001
- "autonomous.tools",
40002
- allTools?.map((t) => t.name).join(", ")
40003
- );
39909
+ iterationSpan?.setAttribute("autonomous.tools", allTools?.map((t) => t.name).join(", "));
40004
39910
  return allTools.map(
40005
39911
  (tool) => tool.clone({
40006
39912
  handler: asyncResource.bind((args, ctx2) => {
@@ -40062,9 +39968,7 @@ Always prefer information from the knowledge bases over general knowledge when a
40062
39968
  onAfterTool: asyncResource.bind(props.hooks.onAfterTool)
40063
39969
  },
40064
39970
  ...props.hooks?.onBeforeExecution && {
40065
- onBeforeExecution: asyncResource.bind(
40066
- props.hooks.onBeforeExecution
40067
- )
39971
+ onBeforeExecution: asyncResource.bind(props.hooks.onBeforeExecution)
40068
39972
  },
40069
39973
  ...props.hooks?.onExit && {
40070
39974
  onExit: asyncResource.bind(props.hooks.onExit)
@@ -40083,9 +39987,7 @@ Always prefer information from the knowledge bases over general knowledge when a
40083
39987
  });
40084
39988
  }
40085
39989
  if (props.hooks?.onTrace) {
40086
- return asyncResource.runInAsyncScope(
40087
- () => props.hooks.onTrace({ trace: trace2, iteration })
40088
- );
39990
+ return asyncResource.runInAsyncScope(() => props.hooks.onTrace({ trace: trace2, iteration }));
40089
39991
  }
40090
39992
  },
40091
39993
  onIterationEnd: async (iteration, controller) => {
@@ -40111,9 +40013,7 @@ ${iteration.status.execution_error.stack}`;
40111
40013
  } else if (iteration.status.type === "invalid_code_error") {
40112
40014
  message = `Iteration failed due to invalid code: ${iteration.status.invalid_code_error.message}`;
40113
40015
  }
40114
- iterationSpan?.recordException(
40115
- iteration.error ?? new Error(message)
40116
- );
40016
+ iterationSpan?.recordException(iteration.error ?? new Error(message));
40117
40017
  iterationSpan?.setStatus({
40118
40018
  code: SpanStatusCode.ERROR,
40119
40019
  message
@@ -40135,16 +40035,11 @@ ${iteration.status.execution_error.stack}`;
40135
40035
  }
40136
40036
  iterationSpan?.end();
40137
40037
  if (props.hooks?.onIterationEnd) {
40138
- return await asyncResource.runInAsyncScope(
40139
- () => props.hooks.onIterationEnd(iteration, controller)
40140
- );
40038
+ return await asyncResource.runInAsyncScope(() => props.hooks.onIterationEnd(iteration, controller));
40141
40039
  }
40142
40040
  }
40143
40041
  });
40144
- execSpan.setAttribute(
40145
- "autonomous.execution_id",
40146
- execution.context.id
40147
- );
40042
+ execSpan.setAttribute("autonomous.execution_id", execution.context.id);
40148
40043
  return execution;
40149
40044
  }
40150
40045
  );
@@ -40187,22 +40082,16 @@ var actions = new Proxy({}, {
40187
40082
  }
40188
40083
  integrations ??= context2.get("integrations", { optional: true });
40189
40084
  client ??= context2.get("client", { optional: true });
40190
- const integration = integrations.find(
40191
- (i) => i.alias === integrationName
40192
- );
40085
+ const integration = integrations.find((i) => i.alias === integrationName);
40193
40086
  const actionDef = integration?.definition.actions?.[actionName];
40194
40087
  const handler = async (params) => {
40195
40088
  integrations ??= context2.get("integrations", { optional: true });
40196
40089
  client ??= context2.get("client", { optional: true });
40197
40090
  if (!integration || !actionDef) {
40198
- throw new Error(
40199
- `Could not find integration "${integrationName}" and action "${actionName}"`
40200
- );
40091
+ throw new Error(`Could not find integration "${integrationName}" and action "${actionName}"`);
40201
40092
  }
40202
40093
  if (!integration.definition.actions?.[actionName]) {
40203
- throw new Error(
40204
- `Action "${actionName}" not found in integration "${integrationName}"`
40205
- );
40094
+ throw new Error(`Action "${actionName}" not found in integration "${integrationName}"`);
40206
40095
  }
40207
40096
  return client.callAction({
40208
40097
  type: `${integration.alias}:${actionName}`,
@@ -40211,9 +40100,7 @@ var actions = new Proxy({}, {
40211
40100
  };
40212
40101
  handler.asTool = () => {
40213
40102
  if (!integration || !actionDef) {
40214
- throw new Error(
40215
- `Could not find integration "${integrationName}" and action "${actionName}"`
40216
- );
40103
+ throw new Error(`Could not find integration "${integrationName}" and action "${actionName}"`);
40217
40104
  }
40218
40105
  return new Autonomous.Tool({
40219
40106
  name: actionName,
@@ -40231,9 +40118,7 @@ var actions = new Proxy({}, {
40231
40118
  optional: true
40232
40119
  });
40233
40120
  if (!integrations2) return [];
40234
- const integration = integrations2.find(
40235
- (i) => i.alias === integrationName
40236
- );
40121
+ const integration = integrations2.find((i) => i.alias === integrationName);
40237
40122
  if (!integration?.definition?.actions) return [];
40238
40123
  return Object.keys(integration.definition.actions);
40239
40124
  } catch {
@@ -40246,9 +40131,7 @@ var actions = new Proxy({}, {
40246
40131
  optional: true
40247
40132
  });
40248
40133
  if (!integrations2) return false;
40249
- const integration = integrations2.find(
40250
- (i) => i.alias === integrationName
40251
- );
40134
+ const integration = integrations2.find((i) => i.alias === integrationName);
40252
40135
  return !!integration?.definition?.actions?.[actionName];
40253
40136
  } catch {
40254
40137
  return false;
@@ -40556,11 +40439,7 @@ var BaseConversationInstance = class {
40556
40439
  * Start typing indicator
40557
40440
  */
40558
40441
  async startTyping() {
40559
- const mapping = InterfaceMappings.getIntegrationAction(
40560
- "typingIndicator",
40561
- "startTypingIndicator",
40562
- this.integration
40563
- );
40442
+ const mapping = InterfaceMappings.getIntegrationAction("typingIndicator", "startTypingIndicator", this.integration);
40564
40443
  if (mapping) {
40565
40444
  const message = context2.get("message", { optional: true });
40566
40445
  await this.client.callAction({
@@ -40577,11 +40456,7 @@ var BaseConversationInstance = class {
40577
40456
  * Stop typing indicator
40578
40457
  */
40579
40458
  async stopTyping() {
40580
- const mapping = InterfaceMappings.getIntegrationAction(
40581
- "typingIndicator",
40582
- "stopTypingIndicator",
40583
- this.integration
40584
- );
40459
+ const mapping = InterfaceMappings.getIntegrationAction("typingIndicator", "stopTypingIndicator", this.integration);
40585
40460
  if (mapping) {
40586
40461
  const message = context2.get("message", { optional: true });
40587
40462
  await this.client.callAction({
@@ -40657,10 +40532,7 @@ var Definitions;
40657
40532
  });
40658
40533
  const actionDefinitionSchema = z7.object({
40659
40534
  type: z7.literal("action"),
40660
- name: z7.string().min(1, "Name must be a non-empty string").max(255, "Name must be less than 255 characters").regex(
40661
- /^[a-zA-Z][a-zA-Z0-9]*$/,
40662
- "Name must be alphanumeric with no special characters"
40663
- ),
40535
+ name: z7.string().min(1, "Name must be a non-empty string").max(255, "Name must be less than 255 characters").regex(/^[a-zA-Z][a-zA-Z0-9]*$/, "Name must be alphanumeric with no special characters"),
40664
40536
  title: z7.string().optional(),
40665
40537
  description: z7.string().optional(),
40666
40538
  attributes: z7.record(z7.string()).optional(),
@@ -40761,9 +40633,7 @@ var createSyncWorkflow = (props) => new BaseWorkflow({
40761
40633
  }
40762
40634
  const source = kb.sources.find((s) => s.id === sourceId);
40763
40635
  if (!source) {
40764
- throw new Error(
40765
- `Data source with ID '${sourceId}' not found in knowledge base '${kbName}'`
40766
- );
40636
+ throw new Error(`Data source with ID '${sourceId}' not found in knowledge base '${kbName}'`);
40767
40637
  }
40768
40638
  console.log(
40769
40639
  `\u{1F504} Starting sync for data source '${sourceId}' of type '${source.type}' in knowledge base '${kbName}'`
@@ -42303,17 +42173,8 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42303
42173
  this.urls = options.urls ?? void 0;
42304
42174
  this.filterFn = "filter" in options ? options.filter : void 0;
42305
42175
  this.customFetch = options.fetch ?? void 0;
42306
- this.maxPages = Math.max(
42307
- 1,
42308
- Math.min(
42309
- ("maxPages" in options ? options.maxPages : void 0) ?? 5e4,
42310
- 5e4
42311
- )
42312
- );
42313
- this.maxDepth = Math.max(
42314
- 1,
42315
- Math.min(("maxDepth" in options ? options.maxDepth : void 0) ?? 20, 20)
42316
- );
42176
+ this.maxPages = Math.max(1, Math.min(("maxPages" in options ? options.maxPages : void 0) ?? 5e4, 5e4));
42177
+ this.maxDepth = Math.max(1, Math.min(("maxDepth" in options ? options.maxDepth : void 0) ?? 20, 20));
42317
42178
  }
42318
42179
  isBrowserIntegrationAvailable() {
42319
42180
  return !!adk.project.integrations.get("browser");
@@ -42477,9 +42338,7 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42477
42338
  }
42478
42339
  return passed;
42479
42340
  });
42480
- console.log(
42481
- `Applied filter: ${filteredUrls.length} URLs passed, ${skippedCount} URLs filtered out`
42482
- );
42341
+ console.log(`Applied filter: ${filteredUrls.length} URLs passed, ${skippedCount} URLs filtered out`);
42483
42342
  }
42484
42343
  return filteredUrls.map((url2) => ({ loc: url2 }));
42485
42344
  }
@@ -42511,20 +42370,14 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42511
42370
  await step2(`processing sitemap ${item.url}`, async () => {
42512
42371
  try {
42513
42372
  const { content, contentType } = await this.fetchSitemap(item.url);
42514
- console.log(
42515
- `Fetched sitemap ${item.url} (${content.length} bytes), processing... ${contentType}`
42516
- );
42373
+ console.log(`Fetched sitemap ${item.url} (${content.length} bytes), processing... ${contentType}`);
42517
42374
  console.log(content, contentType);
42518
42375
  try {
42519
42376
  const { urls, sitemaps } = this.parseSitemapXml(content);
42520
- console.log(
42521
- `Parsed ${urls.length} URLs and ${sitemaps.length} sub-sitemaps from ${item.url}`
42522
- );
42377
+ console.log(`Parsed ${urls.length} URLs and ${sitemaps.length} sub-sitemaps from ${item.url}`);
42523
42378
  for (const url2 of urls) {
42524
42379
  if (state.urls.length >= this.maxPages) {
42525
- console.log(
42526
- `Reached maxPages limit (${this.maxPages}), stopping URL discovery`
42527
- );
42380
+ console.log(`Reached maxPages limit (${this.maxPages}), stopping URL discovery`);
42528
42381
  break;
42529
42382
  }
42530
42383
  const filterContext = {
@@ -42545,20 +42398,14 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42545
42398
  state.queue.push({ url: sitemapUrl, depth: item.depth + 1 });
42546
42399
  }
42547
42400
  } else if (sitemaps.length > 0) {
42548
- console.log(
42549
- `Reached maxDepth limit (${this.maxDepth}), skipping ${sitemaps.length} sub-sitemaps`
42550
- );
42401
+ console.log(`Reached maxDepth limit (${this.maxDepth}), skipping ${sitemaps.length} sub-sitemaps`);
42551
42402
  }
42552
42403
  } catch (xmlErr) {
42553
- console.log(
42554
- `XML parsing failed for ${item.url}, trying TXT format...`
42555
- );
42404
+ console.log(`XML parsing failed for ${item.url}, trying TXT format...`);
42556
42405
  const { urls } = this.parseSitemapTxt(content);
42557
42406
  for (const url2 of urls) {
42558
42407
  if (state.urls.length >= this.maxPages) {
42559
- console.log(
42560
- `Reached maxPages limit (${this.maxPages}), stopping URL discovery`
42561
- );
42408
+ console.log(`Reached maxPages limit (${this.maxPages}), stopping URL discovery`);
42562
42409
  break;
42563
42410
  }
42564
42411
  const filterContext = { url: url2.loc };
@@ -42576,13 +42423,9 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42576
42423
  }
42577
42424
  });
42578
42425
  }
42579
- console.log(
42580
- `URL discovery complete: ${state.urls.length} URLs discovered, ${skippedCount} URLs skipped by filter`
42581
- );
42426
+ console.log(`URL discovery complete: ${state.urls.length} URLs discovered, ${skippedCount} URLs skipped by filter`);
42582
42427
  if (state.urls.length >= this.maxPages) {
42583
- console.log(
42584
- `Note: Discovery stopped at maxPages limit (${this.maxPages})`
42585
- );
42428
+ console.log(`Note: Discovery stopped at maxPages limit (${this.maxPages})`);
42586
42429
  }
42587
42430
  return state.urls.slice(0, this.maxPages);
42588
42431
  }
@@ -42595,13 +42438,9 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42595
42438
  console.log(
42596
42439
  `Starting sync for WebsiteSource [${this.id}] in mode [${this.mode}, maxPages=${this.maxPages}, maxDepth=${this.maxDepth}, baseUrl=${this.baseUrl}, sitemapUrl=${this.sitemapUrl}]`
42597
42440
  );
42598
- console.log(
42599
- `Using knowledge base: ${input.kbName}, force reindex: ${!!input.force}, ${input.sourceId}`
42600
- );
42441
+ console.log(`Using knowledge base: ${input.kbName}, force reindex: ${!!input.force}, ${input.sourceId}`);
42601
42442
  if (input.force) {
42602
- console.log(
42603
- "\u{1F504} FORCE MODE: Re-indexing all files regardless of changes"
42604
- );
42443
+ console.log("\u{1F504} FORCE MODE: Re-indexing all files regardless of changes");
42605
42444
  }
42606
42445
  const tags = {
42607
42446
  [WellKnownTags.knowledge.KNOWLEDGE]: "true",
@@ -42609,10 +42448,7 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42609
42448
  [WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE]: this.type,
42610
42449
  [WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]: input.kbName
42611
42450
  };
42612
- const discoveredUrls = await step2(
42613
- "discover urls from sitemap",
42614
- () => this.discoverUrls(step2, state)
42615
- );
42451
+ const discoveredUrls = await step2("discover urls from sitemap", () => this.discoverUrls(step2, state));
42616
42452
  console.log(`Discovered ${discoveredUrls.length} URLs from sitemap`);
42617
42453
  console.log(`Will process up to ${this.maxPages} pages`);
42618
42454
  const existingFiles = await step2(
@@ -42622,15 +42458,10 @@ var WebsiteSource = class _WebsiteSource extends DataSource {
42622
42458
  }).collect()
42623
42459
  );
42624
42460
  const existingFileMap = new Map(
42625
- existingFiles.map((f) => [
42626
- f.metadata?.[WellKnownMetadata.knowledge.URL],
42627
- f
42628
- ])
42461
+ existingFiles.map((f) => [f.metadata?.[WellKnownMetadata.knowledge.URL], f])
42629
42462
  );
42630
42463
  const toRemove = existingFiles.filter(
42631
- (f) => !discoveredUrls.find(
42632
- (u) => u.loc === f.metadata?.[WellKnownMetadata.knowledge.URL]
42633
- )
42464
+ (f) => !discoveredUrls.find((u) => u.loc === f.metadata?.[WellKnownMetadata.knowledge.URL])
42634
42465
  );
42635
42466
  const toFetch = [];
42636
42467
  let skippedUnchanged = 0;
@@ -42777,9 +42608,7 @@ var DirectorySource = class _DirectorySource extends DataSource {
42777
42608
  state: z11.object({}),
42778
42609
  handler: async ({ input, step: step2, client }) => {
42779
42610
  if (!adk.environment.isDevelopment()) {
42780
- console.log(
42781
- "Directory ingestion is only supported in development environment"
42782
- );
42611
+ console.log("Directory ingestion is only supported in development environment");
42783
42612
  return {
42784
42613
  added: [],
42785
42614
  updated: [],
@@ -42795,10 +42624,7 @@ var DirectorySource = class _DirectorySource extends DataSource {
42795
42624
  const path4 = await import("path");
42796
42625
  const fs3 = await import("fs/promises");
42797
42626
  const crypto3 = await import("crypto");
42798
- const directory = path4.resolve(
42799
- adk.environment.agent.directory,
42800
- this.directoryPath
42801
- );
42627
+ const directory = path4.resolve(adk.environment.agent.directory, this.directoryPath);
42802
42628
  const tags = {
42803
42629
  [WellKnownTags.knowledge.KNOWLEDGE]: "true",
42804
42630
  [WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID]: this.id,
@@ -42838,11 +42664,7 @@ var DirectorySource = class _DirectorySource extends DataSource {
42838
42664
  const toRemove = existingFiles.filter(
42839
42665
  (f) => !allFiles.find((af) => af.rel === f.metadata?.relPath)
42840
42666
  );
42841
- const toAdd = allFiles.filter(
42842
- (af) => !existingFiles.find(
42843
- (f) => f.metadata?.relPath === af.rel
42844
- )
42845
- );
42667
+ const toAdd = allFiles.filter((af) => !existingFiles.find((f) => f.metadata?.relPath === af.rel));
42846
42668
  const toUpdate = allFiles.filter(
42847
42669
  (af) => existingFiles.find((f) => f.metadata?.relPath === af.rel)
42848
42670
  );
@@ -42904,18 +42726,11 @@ var DirectorySource = class _DirectorySource extends DataSource {
42904
42726
  size: uploaded.file.size ?? -1
42905
42727
  };
42906
42728
  };
42907
- const added = await step2.map(
42908
- "to add files",
42909
- toAdd,
42910
- (f) => upsertFile(f),
42911
- { concurrency: 5, maxAttempts: 2 }
42912
- );
42913
- const updated = await step2.map(
42914
- "to update files",
42915
- toUpdate,
42916
- (f) => upsertFile(f),
42917
- { concurrency: 5, maxAttempts: 2 }
42918
- );
42729
+ const added = await step2.map("to add files", toAdd, (f) => upsertFile(f), { concurrency: 5, maxAttempts: 2 });
42730
+ const updated = await step2.map("to update files", toUpdate, (f) => upsertFile(f), {
42731
+ concurrency: 5,
42732
+ maxAttempts: 2
42733
+ });
42919
42734
  return {
42920
42735
  processed: allFiles.length,
42921
42736
  deleted,
@@ -42986,10 +42801,7 @@ var BaseConversation = class {
42986
42801
  const chat = context2.get("chat");
42987
42802
  const client = context2.get("client");
42988
42803
  const botpressConversation = context2.get("conversation");
42989
- const conversationInstance = new BaseConversationInstance(
42990
- botpressConversation,
42991
- client
42992
- );
42804
+ const conversationInstance = new BaseConversationInstance(botpressConversation, client);
42993
42805
  let type;
42994
42806
  let requestObject = void 0;
42995
42807
  if (message) {
@@ -43028,9 +42840,7 @@ var BaseConversation = class {
43028
42840
  conversationId: conversationInstance.id,
43029
42841
  status: "pending"
43030
42842
  });
43031
- const newEvents = events.filter(
43032
- (e) => e.createdAt > event?.createdAt && e.id !== event?.id
43033
- );
42843
+ const newEvents = events.filter((e) => e.createdAt > event?.createdAt && e.id !== event?.id);
43034
42844
  if (newEvents.length) {
43035
42845
  s.setAttributes({
43036
42846
  "interruption.detected": true,
@@ -43058,9 +42868,7 @@ var BaseConversation = class {
43058
42868
  }
43059
42869
  }
43060
42870
  if (newEvents.length) {
43061
- controller.abort(
43062
- `More messages were received during processing, aborting current processing.`
43063
- );
42871
+ controller.abort(`More messages were received during processing, aborting current processing.`);
43064
42872
  } else {
43065
42873
  s.setAttribute("interruption.detected", false);
43066
42874
  }
@@ -43157,9 +42965,7 @@ var BaseKnowledge = class {
43157
42965
  async refreshSource(sourceId, options) {
43158
42966
  const source = this.sources.find((s) => s.id === sourceId);
43159
42967
  if (!source) {
43160
- throw new Error(
43161
- `Data source with id "${sourceId}" not found in knowledge base "${this.name}"`
43162
- );
42968
+ throw new Error(`Data source with id "${sourceId}" not found in knowledge base "${this.name}"`);
43163
42969
  }
43164
42970
  await source.syncWorkflow.getOrCreate({
43165
42971
  key: `${this.name}:${sourceId}`,
@@ -43191,9 +42997,7 @@ var BaseAction = class {
43191
42997
  handler;
43192
42998
  constructor(props) {
43193
42999
  if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(props.name)) {
43194
- throw new Error(
43195
- `Action name "${props.name}" must be alphanumeric with no special characters or spaces`
43196
- );
43000
+ throw new Error(`Action name "${props.name}" must be alphanumeric with no special characters or spaces`);
43197
43001
  }
43198
43002
  this.name = props.name;
43199
43003
  if (props.title !== void 0) {
@@ -43239,9 +43043,7 @@ var BaseAction = class {
43239
43043
  /**
43240
43044
  * Execute the action with input validation and output validation
43241
43045
  */
43242
- async execute({
43243
- input
43244
- }) {
43046
+ async execute({ input }) {
43245
43047
  return this.handler(input);
43246
43048
  }
43247
43049
  };
@@ -43329,6 +43131,7 @@ var BaseTable = class {
43329
43131
  for (const col of Object.keys(this.columns)) {
43330
43132
  if (this.computedColumns.has(col) || this.nullableColumns.has(col)) {
43331
43133
  if ("properties" in schema && schema.properties && col in schema.properties && typeof schema.properties[col] === "object" && schema.properties[col] !== null) {
43134
+ ;
43332
43135
  schema.properties[col].nullable = true;
43333
43136
  }
43334
43137
  if ("required" in schema && Array.isArray(schema.required)) {
@@ -43454,10 +43257,7 @@ var Typings6;
43454
43257
  Typings8.Primitive = "trigger";
43455
43258
  })(Typings6 || (Typings6 = {}));
43456
43259
  var TriggerSchema = z15.object({
43457
- name: z15.string().min(3, "Trigger name must be at least 3 characters").max(255, "Trigger name must be less than 255 characters").regex(
43458
- /^[a-zA-Z0-9_]+$/,
43459
- "Trigger name must contain only alphanumeric characters and underscores"
43460
- ),
43260
+ name: z15.string().min(3, "Trigger name must be at least 3 characters").max(255, "Trigger name must be less than 255 characters").regex(/^[a-zA-Z0-9_]+$/, "Trigger name must contain only alphanumeric characters and underscores"),
43461
43261
  description: z15.string().max(1024, "Description must be less than 1024 characters").optional(),
43462
43262
  events: z15.array(z15.string()),
43463
43263
  handler: z15.function().describe("Handler function for the trigger")
@@ -43470,10 +43270,7 @@ var Trigger = class {
43470
43270
  constructor(props) {
43471
43271
  const result = TriggerSchema.safeParse(props);
43472
43272
  if (!result.success) {
43473
- throw new Errors.InvalidPrimitiveError(
43474
- "Trigger validation failed",
43475
- result.error
43476
- );
43273
+ throw new Errors.InvalidPrimitiveError("Trigger validation failed", result.error);
43477
43274
  }
43478
43275
  this.name = result.data.name;
43479
43276
  this.description = result.data.description;
@@ -43529,15 +43326,14 @@ init_define_PACKAGE_VERSIONS();
43529
43326
  // src/globals.ts
43530
43327
  init_define_BUILD();
43531
43328
  init_define_PACKAGE_VERSIONS();
43532
- var DefinedGlobalObjects = [
43533
- "__PACKAGE_VERSIONS__",
43534
- "__BUILD__"
43535
- ];
43329
+ var DefinedGlobalObjects = ["__PACKAGE_VERSIONS__", "__BUILD__"];
43536
43330
  for (const key of Object.keys(DefinedGlobalObjects)) {
43537
43331
  if (typeof globalThis[key] === "string") {
43538
43332
  try {
43333
+ ;
43539
43334
  globalThis[key] = JSON.parse(globalThis[key]);
43540
43335
  } catch {
43336
+ ;
43541
43337
  globalThis[key] = DefinedGlobalObjects[key];
43542
43338
  }
43543
43339
  }
@@ -43717,10 +43513,7 @@ import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
43717
43513
  import { transforms as transforms3 } from "@botpress/sdk";
43718
43514
  var DEFAULT_MAX_ATTEMPTS = 5;
43719
43515
  var MIN_STEP_REMAINING_TIME_MS = 1e4;
43720
- var storage2 = getSingleton(
43721
- "__ADK_GLOBAL_CTX_WORKFLOW_STEP",
43722
- () => new AsyncLocalStorage3()
43723
- );
43516
+ var storage2 = getSingleton("__ADK_GLOBAL_CTX_WORKFLOW_STEP", () => new AsyncLocalStorage3());
43724
43517
  async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
43725
43518
  spanFunc,
43726
43519
  stepType
@@ -43738,9 +43531,7 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
43738
43531
  }
43739
43532
  const remainingTime = context2.get("runtime").getRemainingExecutionTimeInMs();
43740
43533
  if (remainingTime <= MIN_STEP_REMAINING_TIME_MS) {
43741
- await new Promise(
43742
- (resolve) => setTimeout(resolve, MIN_STEP_REMAINING_TIME_MS)
43743
- );
43534
+ await new Promise((resolve) => setTimeout(resolve, MIN_STEP_REMAINING_TIME_MS));
43744
43535
  throw createStepSignal();
43745
43536
  }
43746
43537
  const stepContext = storage2.getStore();
@@ -43820,13 +43611,7 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
43820
43611
  }
43821
43612
  if (shouldRetry) {
43822
43613
  await new Promise(
43823
- (resolve) => setTimeout(
43824
- resolve,
43825
- Math.min(
43826
- 100 * Math.exp(state.value?.steps?.[name]?.attempts ?? 1),
43827
- 5e3
43828
- )
43829
- )
43614
+ (resolve) => setTimeout(resolve, Math.min(100 * Math.exp(state.value?.steps?.[name]?.attempts ?? 1), 5e3))
43830
43615
  );
43831
43616
  continue;
43832
43617
  }
@@ -43931,10 +43716,7 @@ step.sleep = async (name, ms3) => {
43931
43716
  );
43932
43717
  };
43933
43718
  step.sleepUntil = async (name, date) => {
43934
- const ms3 = Math.max(
43935
- 0,
43936
- new Date(date).getTime() - Date.now() - MIN_STEP_REMAINING_TIME_MS
43937
- );
43719
+ const ms3 = Math.max(0, new Date(date).getTime() - Date.now() - MIN_STEP_REMAINING_TIME_MS);
43938
43720
  await step.sleep(name, ms3);
43939
43721
  };
43940
43722
  step.waitForWorkflow = async (name, workflowId) => {
@@ -43980,10 +43762,9 @@ step.executeWorkflow = async (name, workflow, input) => _step(
43980
43762
  // Ensures idempotency
43981
43763
  })).id
43982
43764
  );
43983
- return _step(
43984
- `${name}-wait`,
43985
- async () => step.waitForWorkflow(`${name}-wait`, wfId)
43986
- ).then((finishedWorkflow) => finishedWorkflow.output);
43765
+ return _step(`${name}-wait`, async () => step.waitForWorkflow(`${name}-wait`, wfId)).then(
43766
+ (finishedWorkflow) => finishedWorkflow.output
43767
+ );
43987
43768
  },
43988
43769
  {}
43989
43770
  );
@@ -44000,9 +43781,7 @@ async function processWithConcurrency(items, processor, maxConcurrency = 5) {
44000
43781
  }
44001
43782
  const remainingTime = context2.get("runtime").getRemainingExecutionTimeInMs();
44002
43783
  if (remainingTime <= MIN_STEP_REMAINING_TIME_MS) {
44003
- await new Promise(
44004
- (resolve) => setTimeout(resolve, MIN_STEP_REMAINING_TIME_MS)
44005
- );
43784
+ await new Promise((resolve) => setTimeout(resolve, MIN_STEP_REMAINING_TIME_MS));
44006
43785
  throw createStepSignal();
44007
43786
  }
44008
43787
  const promise = processor(items[i], i).then((result) => {
@@ -44070,17 +43849,11 @@ step.request = async (request, message, stepName) => {
44070
43849
  const workflowControlContext = context2.get("workflowControlContext");
44071
43850
  const client = context2.get("client");
44072
43851
  if (!workflowControlContext.workflow.conversationId) {
44073
- throw new Error(
44074
- `Cannot request data: workflow ${workflowControlContext.workflow.id} has no conversationId`
44075
- );
43852
+ throw new Error(`Cannot request data: workflow ${workflowControlContext.workflow.id} has no conversationId`);
44076
43853
  }
44077
- const workflowDef = adk.project.workflows.find(
44078
- (w) => w.name === workflowControlContext.workflow.name
44079
- );
43854
+ const workflowDef = adk.project.workflows.find((w) => w.name === workflowControlContext.workflow.name);
44080
43855
  if (!workflowDef) {
44081
- throw new Error(
44082
- `Workflow definition not found for "${workflowControlContext.workflow.name}"`
44083
- );
43856
+ throw new Error(`Workflow definition not found for "${workflowControlContext.workflow.name}"`);
44084
43857
  }
44085
43858
  const requestSchema = workflowDef._requestsSchemas?.[request];
44086
43859
  if (!requestSchema) {
@@ -44088,10 +43861,7 @@ step.request = async (request, message, stepName) => {
44088
43861
  `Request "${request}" not found in workflow "${workflowDef.name}". Available requests: ${Object.keys(workflowDef._requestsSchemas || {}).join(", ") || "none"}`
44089
43862
  );
44090
43863
  }
44091
- const state = createWorkflowExecutionState(
44092
- client._inner,
44093
- workflowControlContext.workflow.id
44094
- );
43864
+ const state = createWorkflowExecutionState(client._inner, workflowControlContext.workflow.id);
44095
43865
  if (!state.value) {
44096
43866
  throw new Error("Workflow execution state not loaded");
44097
43867
  }
@@ -44171,9 +43941,7 @@ var BaseWorkflowInstance = class _BaseWorkflowInstance {
44171
43941
  // @internal
44172
43942
  TrackedState;
44173
43943
  constructor(workflow, client) {
44174
- const definition = adk.project.workflows.find(
44175
- (w) => w.name === workflow.name
44176
- );
43944
+ const definition = adk.project.workflows.find((w) => w.name === workflow.name);
44177
43945
  this.TrackedState = TrackedState.create({
44178
43946
  type: "workflow",
44179
43947
  client: client._inner,
@@ -44196,9 +43964,7 @@ var BaseWorkflowInstance = class _BaseWorkflowInstance {
44196
43964
  const client = context2.get("client");
44197
43965
  const workflow = props.workflow ? props.workflow : await client.getWorkflow({ id: props.id }).then((x) => x.workflow);
44198
43966
  if (!adk.project.workflows.find((w) => w.name === workflow.name)) {
44199
- throw new Error(
44200
- `No ADK Workflow definition found for "${workflow.name}"`
44201
- );
43967
+ throw new Error(`No ADK Workflow definition found for "${workflow.name}"`);
44202
43968
  }
44203
43969
  return new _BaseWorkflowInstance(workflow, client);
44204
43970
  }
@@ -44225,10 +43991,7 @@ var BaseWorkflowInstance = class _BaseWorkflowInstance {
44225
43991
  */
44226
43992
  async provide(request, data) {
44227
43993
  const client = context2.get("client");
44228
- const state = createWorkflowExecutionState(
44229
- client._inner,
44230
- this.id
44231
- );
43994
+ const state = createWorkflowExecutionState(client._inner, this.id);
44232
43995
  await state.load();
44233
43996
  if (!state.value) {
44234
43997
  throw new Error(`Workflow execution state not found for workflow ${this.id}`);
@@ -44255,13 +44018,9 @@ var BaseWorkflowInstance = class _BaseWorkflowInstance {
44255
44018
  }
44256
44019
  // @internal
44257
44020
  async handle() {
44258
- const handler = adk.project.workflows.find(
44259
- (w) => w.name === this.name
44260
- )._handler;
44021
+ const handler = adk.project.workflows.find((w) => w.name === this.name)._handler;
44261
44022
  if (!handler) {
44262
- throw new Error(
44263
- `No ADK Workflow handler found for "${this.name}"`
44264
- );
44023
+ throw new Error(`No ADK Workflow handler found for "${this.name}"`);
44265
44024
  }
44266
44025
  await TrackedState.loadAll();
44267
44026
  const workflowControlContext = {
@@ -44286,9 +44045,7 @@ var BaseWorkflowInstance = class _BaseWorkflowInstance {
44286
44045
  }
44287
44046
  const eventId = context2.get("event")?.id;
44288
44047
  if (!eventId) {
44289
- throw new Error(
44290
- `Event ID not found in context. Cannot ack workflow ${this.id}`
44291
- );
44048
+ throw new Error(`Event ID not found in context. Cannot ack workflow ${this.id}`);
44292
44049
  }
44293
44050
  workflowControlContext.acked = true;
44294
44051
  await updateWorkflow({
@@ -44300,15 +44057,9 @@ var BaseWorkflowInstance = class _BaseWorkflowInstance {
44300
44057
  };
44301
44058
  try {
44302
44059
  const ctx = context2.getAll();
44303
- const workflowExecutionState = createWorkflowExecutionState(
44304
- ctx.client._inner,
44305
- this.id
44306
- );
44060
+ const workflowExecutionState = createWorkflowExecutionState(ctx.client._inner, this.id);
44307
44061
  await workflowExecutionState.load();
44308
- assert2(
44309
- workflowExecutionState.value,
44310
- "Workflow execution state is not loaded"
44311
- );
44062
+ assert2(workflowExecutionState.value, "Workflow execution state is not loaded");
44312
44063
  workflowExecutionState.value.executionCount++;
44313
44064
  if (!this.TrackedState.value) {
44314
44065
  this.TrackedState.value = {};
@@ -44475,12 +44226,7 @@ var BaseWorkflow = class {
44475
44226
  */
44476
44227
  async getOrCreate(props) {
44477
44228
  const client = context2.get("client");
44478
- const statuses = props.statuses || [
44479
- "pending",
44480
- "in_progress",
44481
- "listening",
44482
- "paused"
44483
- ];
44229
+ const statuses = props.statuses || ["pending", "in_progress", "listening", "paused"];
44484
44230
  const validatedInput = this._inputSchema.parse(props.input);
44485
44231
  const tags = {};
44486
44232
  if (props.key) {
@@ -44494,9 +44240,7 @@ var BaseWorkflow = class {
44494
44240
  tags,
44495
44241
  conversationId: context2.get("conversation", { optional: true })?.id,
44496
44242
  parentWorkflowId: context2.get("workflow", { optional: true })?.id,
44497
- timeoutAt: new Date(
44498
- Date.now() + (this.timeout ?? (0, import_ms.default)("5m"))
44499
- ).toISOString(),
44243
+ timeoutAt: new Date(Date.now() + (this.timeout ?? (0, import_ms.default)("5m"))).toISOString(),
44500
44244
  ...discriminator && { discriminateBy: { tags: discriminator } }
44501
44245
  };
44502
44246
  let { workflow } = await client._inner.getOrCreateWorkflow(createArgs);
@@ -44522,21 +44266,12 @@ var BaseWorkflow = class {
44522
44266
  async provide(event, data) {
44523
44267
  const client = context2.get("client");
44524
44268
  const { workflowId, stepName } = event.payload;
44525
- const state = createWorkflowExecutionState(
44526
- client._inner,
44527
- workflowId
44528
- );
44269
+ const state = createWorkflowExecutionState(client._inner, workflowId);
44529
44270
  await state.load();
44530
44271
  if (!state.value) {
44531
- throw new Error(
44532
- `Workflow execution state not found for workflow ${workflowId}`
44533
- );
44272
+ throw new Error(`Workflow execution state not found for workflow ${workflowId}`);
44534
44273
  }
44535
- console.log(
44536
- `Providing data to workflow ${workflowId} step ${stepName}`,
44537
- data,
44538
- stepName
44539
- );
44274
+ console.log(`Providing data to workflow ${workflowId} step ${stepName}`, data, stepName);
44540
44275
  if (!state.value.steps[stepName]) {
44541
44276
  state.value.steps[stepName] = {
44542
44277
  output: data,
@@ -44568,9 +44303,7 @@ var BaseWorkflow = class {
44568
44303
  input: validatedInput,
44569
44304
  parentWorkflowId: workflow?.id,
44570
44305
  conversationId: context2.get("conversation", { optional: true })?.id,
44571
- timeoutAt: new Date(
44572
- Date.now() + (this.timeout ?? (0, import_ms.default)("5m"))
44573
- ).toISOString()
44306
+ timeoutAt: new Date(Date.now() + (this.timeout ?? (0, import_ms.default)("5m"))).toISOString()
44574
44307
  });
44575
44308
  return await BaseWorkflowInstance.load({
44576
44309
  id: res.workflow.id,
@@ -44662,12 +44395,8 @@ var adk = {
44662
44395
  config: state.projectConfig,
44663
44396
  integrations: Object.assign(state.primitives.integrations, {
44664
44397
  get(name) {
44665
- const byAlias = state.primitives.integrations.find(
44666
- (int) => int.alias === name
44667
- );
44668
- const byName = state.primitives.integrations.find(
44669
- (int) => int.definition.name === name
44670
- );
44398
+ const byAlias = state.primitives.integrations.find((int) => int.alias === name);
44399
+ const byName = state.primitives.integrations.find((int) => int.definition.name === name);
44671
44400
  return byAlias || byName;
44672
44401
  }
44673
44402
  }),
@@ -44845,15 +44574,7 @@ var IncomingRequestSpan = {
44845
44574
  },
44846
44575
  "request.method": {
44847
44576
  type: "enum",
44848
- enum: [
44849
- "GET",
44850
- "POST",
44851
- "PUT",
44852
- "DELETE",
44853
- "PATCH",
44854
- "HEAD",
44855
- "OPTIONS"
44856
- ],
44577
+ enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"],
44857
44578
  description: "The HTTP method",
44858
44579
  title: "HTTP Method",
44859
44580
  required: true
@@ -45012,14 +44733,7 @@ var BotpressClientSpan = {
45012
44733
  "botpress.request.body": { type: "string" },
45013
44734
  "botpress.response.body": { type: "string" },
45014
44735
  "trace.traceparent": { type: "string" },
45015
- ...optional(
45016
- "conversationId",
45017
- "messageId",
45018
- "workflowId",
45019
- "userId",
45020
- "eventId",
45021
- "action.name"
45022
- )
44736
+ ...optional("conversationId", "messageId", "workflowId", "userId", "eventId", "action.name")
45023
44737
  }
45024
44738
  };
45025
44739
  var HttpSpan = {
@@ -45051,21 +44765,8 @@ var ConversationHandlerSpan = {
45051
44765
  name: "handler.conversation",
45052
44766
  importance: "high",
45053
44767
  attributes: {
45054
- ...required(
45055
- "botId",
45056
- "conversationId",
45057
- "eventId",
45058
- "integration",
45059
- "channel",
45060
- "event.type"
45061
- ),
45062
- ...optional(
45063
- "messageId",
45064
- "userId",
45065
- "event.payload",
45066
- "message.payload",
45067
- "message.type"
45068
- )
44768
+ ...required("botId", "conversationId", "eventId", "integration", "channel", "event.type"),
44769
+ ...optional("messageId", "userId", "event.payload", "message.payload", "message.type")
45069
44770
  }
45070
44771
  };
45071
44772
  var TriggerHandlerSpan = {
@@ -45073,15 +44774,7 @@ var TriggerHandlerSpan = {
45073
44774
  importance: "high",
45074
44775
  attributes: {
45075
44776
  ...required("botId", "eventId", "event.type"),
45076
- ...optional(
45077
- "conversationId",
45078
- "messageId",
45079
- "userId",
45080
- "integration",
45081
- "channel",
45082
- "workflowId",
45083
- "parentWorkflowId"
45084
- )
44777
+ ...optional("conversationId", "messageId", "userId", "integration", "channel", "workflowId", "parentWorkflowId")
45085
44778
  }
45086
44779
  };
45087
44780
  var EventHandlerSpan = {
@@ -45089,15 +44782,7 @@ var EventHandlerSpan = {
45089
44782
  importance: "high",
45090
44783
  attributes: {
45091
44784
  ...required("botId", "eventId", "event.type"),
45092
- ...optional(
45093
- "conversationId",
45094
- "messageId",
45095
- "userId",
45096
- "integration",
45097
- "channel",
45098
- "workflowId",
45099
- "parentWorkflowId"
45100
- )
44785
+ ...optional("conversationId", "messageId", "userId", "integration", "channel", "workflowId", "parentWorkflowId")
45101
44786
  }
45102
44787
  };
45103
44788
  var WorkflowHandlerSpan = {
@@ -45105,27 +44790,11 @@ var WorkflowHandlerSpan = {
45105
44790
  importance: "high",
45106
44791
  attributes: {
45107
44792
  ...required("botId", "workflowId", "eventId", "event.type"),
45108
- ...optional(
45109
- "messageId",
45110
- "userId",
45111
- "integration",
45112
- "channel",
45113
- "conversationId",
45114
- "parentWorkflowId"
45115
- ),
44793
+ ...optional("messageId", "userId", "integration", "channel", "conversationId", "parentWorkflowId"),
45116
44794
  "workflow.name": { type: "string" },
45117
44795
  "workflow.status.initial": {
45118
44796
  type: "enum",
45119
- enum: [
45120
- "pending",
45121
- "in_progress",
45122
- "listening",
45123
- "paused",
45124
- "completed",
45125
- "failed",
45126
- "timedout",
45127
- "cancelled"
45128
- ]
44797
+ enum: ["pending", "in_progress", "listening", "paused", "completed", "failed", "timedout", "cancelled"]
45129
44798
  },
45130
44799
  "workflow.status.final": {
45131
44800
  type: "enum",
@@ -45151,14 +44820,7 @@ var ActionHandlerSpan = {
45151
44820
  importance: "high",
45152
44821
  attributes: {
45153
44822
  ...required("botId", "workflowId", "eventId", "event.type"),
45154
- ...optional(
45155
- "messageId",
45156
- "userId",
45157
- "integration",
45158
- "channel",
45159
- "conversationId",
45160
- "parentWorkflowId"
45161
- ),
44823
+ ...optional("messageId", "userId", "integration", "channel", "conversationId", "parentWorkflowId"),
45162
44824
  "action.name": { type: "string", required: true },
45163
44825
  "action.input": { type: "json", required: true }
45164
44826
  }
@@ -45543,9 +45205,7 @@ function span(name, attributes, optionsOrF, f) {
45543
45205
  options = optionsOrF;
45544
45206
  handler = f;
45545
45207
  }
45546
- const spanDef = Object.values(Spans).find(
45547
- (def) => def.name === name
45548
- );
45208
+ const spanDef = Object.values(Spans).find((def) => def.name === name);
45549
45209
  const attrsWithImportance = {
45550
45210
  ...attributes
45551
45211
  };
@@ -45574,20 +45234,13 @@ function span(name, attributes, optionsOrF, f) {
45574
45234
  }
45575
45235
  };
45576
45236
  if (parentContext) {
45577
- return tracer.startActiveSpan(
45578
- name,
45579
- spanOptions,
45580
- parentContext,
45581
- executeInSpan
45582
- );
45237
+ return tracer.startActiveSpan(name, spanOptions, parentContext, executeInSpan);
45583
45238
  } else {
45584
45239
  return tracer.startActiveSpan(name, spanOptions, executeInSpan);
45585
45240
  }
45586
45241
  }
45587
45242
  var createSpan = (name, attributes, { parentContext } = {}) => {
45588
- const spanDef = Object.values(Spans).find(
45589
- (def) => def.name === name
45590
- );
45243
+ const spanDef = Object.values(Spans).find((def) => def.name === name);
45591
45244
  const attrsWithImportance = {
45592
45245
  ...attributes
45593
45246
  };
@@ -45716,9 +45369,7 @@ var TrackedState = class _TrackedState {
45716
45369
  }
45717
45370
  static create(props) {
45718
45371
  const states = context2.get("states", { optional: true });
45719
- const match2 = states?.find(
45720
- (x) => x.id === props.id && x.type === props.type && x.name === (props.name || "state")
45721
- );
45372
+ const match2 = states?.find((x) => x.id === props.id && x.type === props.type && x.name === (props.name || "state"));
45722
45373
  if (match2) {
45723
45374
  return match2;
45724
45375
  }
@@ -45798,9 +45449,7 @@ var TrackedState = class _TrackedState {
45798
45449
  });
45799
45450
  }
45800
45451
  const states = context2.get("states", { optional: true });
45801
- const promises = Promise.allSettled(
45802
- states?.map((state) => state.load()) ?? []
45803
- );
45452
+ const promises = Promise.allSettled(states?.map((state) => state.load()) ?? []);
45804
45453
  void importScheduledHeavyImports();
45805
45454
  await promises;
45806
45455
  });
@@ -45835,9 +45484,7 @@ var TrackedState = class _TrackedState {
45835
45484
  const { data } = await axios_default.get(file.url);
45836
45485
  this.value = typeof data === "string" ? JSON.parse(data) : data;
45837
45486
  } catch (err) {
45838
- console.error(
45839
- `Failed to load swapped state from file: ${err instanceof Error ? err.message : String(err)}`
45840
- );
45487
+ console.error(`Failed to load swapped state from file: ${err instanceof Error ? err.message : String(err)}`);
45841
45488
  this.value = void 0;
45842
45489
  }
45843
45490
  } else {
@@ -45923,9 +45570,7 @@ var TrackedState = class _TrackedState {
45923
45570
  contentType: "application/json",
45924
45571
  content: JSON.stringify(this.value),
45925
45572
  accessPolicies: [],
45926
- expiresAt: new Date(
45927
- Date.now() + 30 * 24 * 60 * 60 * 1e3
45928
- ).toISOString(),
45573
+ expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1e3).toISOString(),
45929
45574
  tags: {
45930
45575
  system: "true",
45931
45576
  purpose: "swap"
@@ -45945,9 +45590,7 @@ var TrackedState = class _TrackedState {
45945
45590
  error: err instanceof Error ? err.message : String(err),
45946
45591
  size_bytes: stateSize
45947
45592
  });
45948
- console.error(
45949
- `Failed to swap state: ${err instanceof Error ? err.message : String(err)}`
45950
- );
45593
+ console.error(`Failed to swap state: ${err instanceof Error ? err.message : String(err)}`);
45951
45594
  payload = {
45952
45595
  value: this.value,
45953
45596
  location: { type: "state" }