@botpress/runtime 1.0.1

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 (199) hide show
  1. package/dist/_types/actions.d.ts +3 -0
  2. package/dist/_types/actions.d.ts.map +1 -0
  3. package/dist/_types/events.d.ts +5 -0
  4. package/dist/_types/events.d.ts.map +1 -0
  5. package/dist/_types/integration-actions.d.ts +3 -0
  6. package/dist/_types/integration-actions.d.ts.map +1 -0
  7. package/dist/_types/state.d.ts +4 -0
  8. package/dist/_types/state.d.ts.map +1 -0
  9. package/dist/_types/tables.d.ts +3 -0
  10. package/dist/_types/tables.d.ts.map +1 -0
  11. package/dist/_types/triggers.d.ts +3 -0
  12. package/dist/_types/triggers.d.ts.map +1 -0
  13. package/dist/_types/workflows.d.ts +12 -0
  14. package/dist/_types/workflows.d.ts.map +1 -0
  15. package/dist/constants.d.ts +58 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/consts.d.ts +8 -0
  18. package/dist/consts.d.ts.map +1 -0
  19. package/dist/debugging/node-inspector.d.ts +5 -0
  20. package/dist/debugging/node-inspector.d.ts.map +1 -0
  21. package/dist/define-config.d.ts +70 -0
  22. package/dist/define-config.d.ts.map +1 -0
  23. package/dist/definition.d.ts +10 -0
  24. package/dist/definition.d.ts.map +1 -0
  25. package/dist/definition.js +88 -0
  26. package/dist/definition.js.map +7 -0
  27. package/dist/environment.d.ts +60 -0
  28. package/dist/environment.d.ts.map +1 -0
  29. package/dist/errors.d.ts +36 -0
  30. package/dist/errors.d.ts.map +1 -0
  31. package/dist/globals.d.ts +21 -0
  32. package/dist/globals.d.ts.map +1 -0
  33. package/dist/internal.d.ts +15 -0
  34. package/dist/internal.d.ts.map +1 -0
  35. package/dist/internal.js +46573 -0
  36. package/dist/internal.js.map +7 -0
  37. package/dist/library.d.ts +16 -0
  38. package/dist/library.d.ts.map +1 -0
  39. package/dist/library.js +45943 -0
  40. package/dist/library.js.map +7 -0
  41. package/dist/primitives/action.d.ts +37 -0
  42. package/dist/primitives/action.d.ts.map +1 -0
  43. package/dist/primitives/asset.d.ts +28 -0
  44. package/dist/primitives/asset.d.ts.map +1 -0
  45. package/dist/primitives/conversation.d.ts +104 -0
  46. package/dist/primitives/conversation.d.ts.map +1 -0
  47. package/dist/primitives/data-sources/index.d.ts +7 -0
  48. package/dist/primitives/data-sources/index.d.ts.map +1 -0
  49. package/dist/primitives/data-sources/source-base.d.ts +251 -0
  50. package/dist/primitives/data-sources/source-base.d.ts.map +1 -0
  51. package/dist/primitives/data-sources/source-directory.d.ts +119 -0
  52. package/dist/primitives/data-sources/source-directory.d.ts.map +1 -0
  53. package/dist/primitives/data-sources/source-table.d.ts +135 -0
  54. package/dist/primitives/data-sources/source-table.d.ts.map +1 -0
  55. package/dist/primitives/data-sources/source-website.d.ts +226 -0
  56. package/dist/primitives/data-sources/source-website.d.ts.map +1 -0
  57. package/dist/primitives/definition.d.ts +68 -0
  58. package/dist/primitives/definition.d.ts.map +1 -0
  59. package/dist/primitives/index.d.ts +149 -0
  60. package/dist/primitives/index.d.ts.map +1 -0
  61. package/dist/primitives/knowledge.d.ts +36 -0
  62. package/dist/primitives/knowledge.d.ts.map +1 -0
  63. package/dist/primitives/table.d.ts +153 -0
  64. package/dist/primitives/table.d.ts.map +1 -0
  65. package/dist/primitives/trigger.d.ts +26 -0
  66. package/dist/primitives/trigger.d.ts.map +1 -0
  67. package/dist/primitives/workflow-instance.d.ts +80 -0
  68. package/dist/primitives/workflow-instance.d.ts.map +1 -0
  69. package/dist/primitives/workflow-step.d.ts +184 -0
  70. package/dist/primitives/workflow-step.d.ts.map +1 -0
  71. package/dist/primitives/workflow-utils.d.ts +36 -0
  72. package/dist/primitives/workflow-utils.d.ts.map +1 -0
  73. package/dist/primitives/workflow.d.ts +86 -0
  74. package/dist/primitives/workflow.d.ts.map +1 -0
  75. package/dist/runtime/actions.d.ts +6 -0
  76. package/dist/runtime/actions.d.ts.map +1 -0
  77. package/dist/runtime/adk.d.ts +54 -0
  78. package/dist/runtime/adk.d.ts.map +1 -0
  79. package/dist/runtime/agent-registry.d.ts +33 -0
  80. package/dist/runtime/agent-registry.d.ts.map +1 -0
  81. package/dist/runtime/assets.d.ts +48 -0
  82. package/dist/runtime/assets.d.ts.map +1 -0
  83. package/dist/runtime/autonomous.d.ts +86 -0
  84. package/dist/runtime/autonomous.d.ts.map +1 -0
  85. package/dist/runtime/chat/chat.d.ts +42 -0
  86. package/dist/runtime/chat/chat.d.ts.map +1 -0
  87. package/dist/runtime/chat/citations.d.ts +9 -0
  88. package/dist/runtime/chat/citations.d.ts.map +1 -0
  89. package/dist/runtime/chat/html.d.ts +2 -0
  90. package/dist/runtime/chat/html.d.ts.map +1 -0
  91. package/dist/runtime/chat/index.d.ts +5 -0
  92. package/dist/runtime/chat/index.d.ts.map +1 -0
  93. package/dist/runtime/chat/messages.d.ts +35 -0
  94. package/dist/runtime/chat/messages.d.ts.map +1 -0
  95. package/dist/runtime/chat/transcript.d.ts +75 -0
  96. package/dist/runtime/chat/transcript.d.ts.map +1 -0
  97. package/dist/runtime/chat/truncate-object.d.ts +12 -0
  98. package/dist/runtime/chat/truncate-object.d.ts.map +1 -0
  99. package/dist/runtime/chat/truncate-transcript.d.ts +6 -0
  100. package/dist/runtime/chat/truncate-transcript.d.ts.map +1 -0
  101. package/dist/runtime/config.d.ts +19 -0
  102. package/dist/runtime/config.d.ts.map +1 -0
  103. package/dist/runtime/context/cognitive.d.ts +7 -0
  104. package/dist/runtime/context/cognitive.d.ts.map +1 -0
  105. package/dist/runtime/context/context.d.ts +59 -0
  106. package/dist/runtime/context/context.d.ts.map +1 -0
  107. package/dist/runtime/context/handlers.d.ts +14 -0
  108. package/dist/runtime/context/handlers.d.ts.map +1 -0
  109. package/dist/runtime/context/http.d.ts +38 -0
  110. package/dist/runtime/context/http.d.ts.map +1 -0
  111. package/dist/runtime/context/inspector-handler.d.ts +59 -0
  112. package/dist/runtime/context/inspector-handler.d.ts.map +1 -0
  113. package/dist/runtime/context/promises.d.ts +36 -0
  114. package/dist/runtime/context/promises.d.ts.map +1 -0
  115. package/dist/runtime/events.d.ts +89 -0
  116. package/dist/runtime/events.d.ts.map +1 -0
  117. package/dist/runtime/handlers/conversation.d.ts +3 -0
  118. package/dist/runtime/handlers/conversation.d.ts.map +1 -0
  119. package/dist/runtime/handlers/event.d.ts +3 -0
  120. package/dist/runtime/handlers/event.d.ts.map +1 -0
  121. package/dist/runtime/handlers/index.d.ts +11 -0
  122. package/dist/runtime/handlers/index.d.ts.map +1 -0
  123. package/dist/runtime/handlers/trigger.d.ts +3 -0
  124. package/dist/runtime/handlers/trigger.d.ts.map +1 -0
  125. package/dist/runtime/handlers/workflow.d.ts +3 -0
  126. package/dist/runtime/handlers/workflow.d.ts.map +1 -0
  127. package/dist/runtime/heavy-imports.d.ts +10 -0
  128. package/dist/runtime/heavy-imports.d.ts.map +1 -0
  129. package/dist/runtime/index.d.ts +13 -0
  130. package/dist/runtime/index.d.ts.map +1 -0
  131. package/dist/runtime/interfaces.d.ts +16 -0
  132. package/dist/runtime/interfaces.d.ts.map +1 -0
  133. package/dist/runtime/singletons.d.ts +21 -0
  134. package/dist/runtime/singletons.d.ts.map +1 -0
  135. package/dist/runtime/state.d.ts +8 -0
  136. package/dist/runtime/state.d.ts.map +1 -0
  137. package/dist/runtime/tracked-state-schema.d.ts +36 -0
  138. package/dist/runtime/tracked-state-schema.d.ts.map +1 -0
  139. package/dist/runtime/tracked-state.d.ts +57 -0
  140. package/dist/runtime/tracked-state.d.ts.map +1 -0
  141. package/dist/runtime/workflows/index.d.ts +7 -0
  142. package/dist/runtime/workflows/index.d.ts.map +1 -0
  143. package/dist/runtime/workflows/knowledge-indexing.d.ts +109 -0
  144. package/dist/runtime/workflows/knowledge-indexing.d.ts.map +1 -0
  145. package/dist/runtime.d.ts +22 -0
  146. package/dist/runtime.d.ts.map +1 -0
  147. package/dist/runtime.js +47545 -0
  148. package/dist/runtime.js.map +7 -0
  149. package/dist/telemetry/context-manager.d.ts +16 -0
  150. package/dist/telemetry/context-manager.d.ts.map +1 -0
  151. package/dist/telemetry/file-exporter.d.ts +11 -0
  152. package/dist/telemetry/file-exporter.d.ts.map +1 -0
  153. package/dist/telemetry/instrument-http.d.ts +4 -0
  154. package/dist/telemetry/instrument-http.d.ts.map +1 -0
  155. package/dist/telemetry/live-file-processor.d.ts +13 -0
  156. package/dist/telemetry/live-file-processor.d.ts.map +1 -0
  157. package/dist/telemetry/span-helpers.d.ts +30 -0
  158. package/dist/telemetry/span-helpers.d.ts.map +1 -0
  159. package/dist/telemetry/spans/factory.d.ts +44 -0
  160. package/dist/telemetry/spans/factory.d.ts.map +1 -0
  161. package/dist/telemetry/spans/index.d.ts +1009 -0
  162. package/dist/telemetry/spans/index.d.ts.map +1 -0
  163. package/dist/telemetry/spans/well-known-attributes.d.ts +78 -0
  164. package/dist/telemetry/spans/well-known-attributes.d.ts.map +1 -0
  165. package/dist/telemetry/structured-logging.d.ts +34 -0
  166. package/dist/telemetry/structured-logging.d.ts.map +1 -0
  167. package/dist/telemetry/tracing.d.ts +6 -0
  168. package/dist/telemetry/tracing.d.ts.map +1 -0
  169. package/dist/telemetry/utils.d.ts +3 -0
  170. package/dist/telemetry/utils.d.ts.map +1 -0
  171. package/dist/types.d.ts +17 -0
  172. package/dist/types.d.ts.map +1 -0
  173. package/dist/ui.d.ts +10 -0
  174. package/dist/ui.d.ts.map +1 -0
  175. package/dist/ui.js +749 -0
  176. package/dist/ui.js.map +7 -0
  177. package/dist/utilities/abort-signal.d.ts +41 -0
  178. package/dist/utilities/abort-signal.d.ts.map +1 -0
  179. package/dist/utilities/events.d.ts +10 -0
  180. package/dist/utilities/events.d.ts.map +1 -0
  181. package/dist/utilities/promises.d.ts +3 -0
  182. package/dist/utilities/promises.d.ts.map +1 -0
  183. package/dist/utilities/size.d.ts +12 -0
  184. package/dist/utilities/size.d.ts.map +1 -0
  185. package/dist/utilities/strings.d.ts +18 -0
  186. package/dist/utilities/strings.d.ts.map +1 -0
  187. package/dist/utilities/trigger-tags.d.ts +31 -0
  188. package/dist/utilities/trigger-tags.d.ts.map +1 -0
  189. package/dist/utilities/types.d.ts +2 -0
  190. package/dist/utilities/types.d.ts.map +1 -0
  191. package/dist/workers/dev_worker.d.ts +6 -0
  192. package/dist/workers/dev_worker.d.ts.map +1 -0
  193. package/dist/workers/index.d.ts +5 -0
  194. package/dist/workers/index.d.ts.map +1 -0
  195. package/dist/workers/parent_worker.d.ts +5 -0
  196. package/dist/workers/parent_worker.d.ts.map +1 -0
  197. package/dist/workers/worker_pool.d.ts +109 -0
  198. package/dist/workers/worker_pool.d.ts.map +1 -0
  199. package/package.json +109 -0
package/dist/ui.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/telemetry/spans/well-known-attributes.ts", "../src/telemetry/spans/factory.ts", "../src/telemetry/spans/index.ts"],
4
+ "sourcesContent": ["import { AttributeDefinition } from \"./factory\";\n\n/**\n * Type representing all well-known attribute names\n */\nexport type WellKnownAttributeName = keyof typeof WellKnownAttributes;\n\nexport const WellKnownAttributes = {\n conversationId: {\n type: \"string\",\n description: \"The current conversation the execution is part of\",\n title: \"Conversation ID\",\n default: \"\",\n },\n workflowId: {\n type: \"string\",\n description: \"The current workflow the execution is part of\",\n title: \"Workflow ID\",\n },\n eventId: {\n type: \"string\",\n description: \"The current incoming event the execution is part of\",\n title: \"Workflow ID\",\n },\n userId: {\n type: \"string\",\n description: \"The user attached to the event/message of the execution\",\n title: \"User ID\",\n },\n messageId: {\n type: \"string\",\n description: \"The message attached to the event/message of the execution\",\n title: \"Message ID\",\n },\n botId: {\n type: \"string\",\n description: \"The bot running the execution\",\n title: \"Bot ID\",\n },\n parentWorkflowId: {\n type: \"string\",\n description: \"The parent workflow the execution is part of\",\n title: \"Parent Workflow ID\",\n },\n \"event.type\": {\n type: \"string\",\n description: \"The type of the event the execution is part of\",\n title: \"Event Type\",\n },\n \"message.type\": {\n type: \"string\",\n description: \"The type of the message received\",\n title: \"Message Type\",\n },\n integration: {\n type: \"string\",\n description: \"The integration originating the event\",\n title: \"Integration\",\n },\n channel: {\n type: \"string\",\n description: \"The integration channel originating the event\",\n title: \"Channel\",\n },\n \"action.name\": {\n type: \"string\",\n description: \"The name of the action being called\",\n title: \"Action Name\",\n },\n \"event.payload\": {\n type: \"json\",\n description: \"The payload of the event received\",\n title: \"Event Payload\",\n },\n \"message.payload\": {\n type: \"json\",\n description: \"The payload of the message received\",\n title: \"Message Payload\",\n },\n} as const satisfies Record<string, Omit<AttributeDefinition, \"required\">>;\n", "import { WellKnownAttributes } from \"./well-known-attributes\";\n\nexport type RequiredWellKnownAttributes = {\n [K in keyof typeof WellKnownAttributes]: Omit<\n (typeof WellKnownAttributes)[K],\n \"required\"\n > & { required: true };\n};\n\nexport const required = <T extends keyof typeof WellKnownAttributes>(\n ...keys: T[]\n): Pick<RequiredWellKnownAttributes, T> => {\n const result: Partial<typeof WellKnownAttributes> = {};\n for (const key of keys) {\n result[key] = { ...WellKnownAttributes[key], required: true };\n }\n return result as Pick<RequiredWellKnownAttributes, T>;\n};\n\nexport const optional = <T extends keyof typeof WellKnownAttributes>(\n ...keys: T[]\n): Pick<typeof WellKnownAttributes, T> => {\n const result: Partial<typeof WellKnownAttributes> = {};\n for (const key of keys) {\n result[key] = { ...WellKnownAttributes[key], required: true };\n }\n return result as Pick<typeof WellKnownAttributes, T>;\n};\n\nexport type AttributeType =\n | \"string\"\n | \"enum\"\n | \"number\"\n | \"boolean\"\n | \"object\"\n | \"date\"\n | \"json\";\n\nexport type AttributeDefinition<\n T extends AttributeType = AttributeType,\n Enum = ReadonlyArray<string>,\n> = {\n type: T;\n enum?: Enum;\n title?: string;\n description?: string;\n required?: boolean;\n default?: TypeForAttribute<T, Enum>;\n};\n\nexport type SpanDefinition = {\n name: string;\n importance: \"debug\" | \"low\" | \"medium\" | \"high\";\n attributes: Record<string, AttributeDefinition>;\n};\n\n/**\n * Type representing valid span importance levels\n */\nexport type SpanImportanceLevel = SpanDefinition[\"importance\"];\n\nexport type TypeForAttribute<\n T extends AttributeType,\n Enum = ReadonlyArray<string>,\n> = T extends \"string\"\n ? string\n : T extends \"enum\"\n ? Enum extends ReadonlyArray<string>\n ? Enum[number]\n : never\n : T extends \"number\"\n ? number\n : T extends \"boolean\"\n ? boolean\n : T extends \"object\"\n ? Record<string, any>\n : T extends \"date\"\n ? Date\n : T extends \"json\"\n ? any\n : never;\n\nexport type GetSpanType<T extends SpanDefinition> = {\n name: T[\"name\"];\n attributes: {\n -readonly [K in keyof T[\"attributes\"] as T[\"attributes\"][K] extends {\n required: true;\n }\n ? K\n : never]: TypeForAttribute<\n T[\"attributes\"][K][\"type\"],\n T[\"attributes\"][K] extends { enum: infer E } ? E : never\n >;\n } & {\n -readonly [K in keyof T[\"attributes\"] as T[\"attributes\"][K] extends {\n required: true;\n }\n ? never\n : K]?: TypeForAttribute<\n T[\"attributes\"][K][\"type\"],\n T[\"attributes\"][K] extends { enum: infer E } ? E : never\n > | undefined;\n };\n};\n", "import { IterationStatus } from \"llmz\";\nimport { GetSpanType, optional, required, SpanDefinition } from \"./factory\";\n\ntype Name = Spans[\"name\"];\nexport type SpanOf<T extends Name> = Extract<Spans, { name: T }>;\nexport type Spans = {\n [K in keyof typeof Spans]: GetSpanType<(typeof Spans)[K]>;\n}[keyof typeof Spans];\n\nconst IncomingRequestSpan = {\n name: \"request.incoming\",\n importance: \"high\",\n attributes: {\n \"request.operation\": {\n type: \"enum\",\n enum: [\"register\", \"event_received\", \"ping\", \"action_triggered\"] as const,\n description: \"The operation being performed\",\n title: \"Operation\",\n required: true,\n },\n \"request.type\": {\n type: \"string\",\n description: \"The request type (e.g., message_created)\",\n title: \"Request Type\",\n },\n \"request.method\": {\n type: \"enum\",\n enum: [\n \"GET\",\n \"POST\",\n \"PUT\",\n \"DELETE\",\n \"PATCH\",\n \"HEAD\",\n \"OPTIONS\",\n ] as const,\n description: \"The HTTP method\",\n title: \"HTTP Method\",\n required: true,\n },\n \"request.path\": {\n type: \"string\",\n description: \"The request path\",\n title: \"Request Path\",\n required: true,\n },\n botId: {\n type: \"string\",\n description: \"The bot ID\",\n title: \"Bot ID\",\n required: true,\n },\n webhookId: {\n type: \"string\",\n description: \"The webhook ID if applicable\",\n title: \"Webhook ID\",\n },\n \"memory.rss\": {\n type: \"number\",\n description: \"The resident set size memory usage in bytes\",\n title: \"Memory RSS (bytes)\",\n },\n \"memory.heapTotal\": {\n type: \"number\",\n description: \"The total heap size memory usage in bytes\",\n title: \"Memory Heap Total (bytes)\",\n },\n \"cpu.count\": {\n type: \"number\",\n description: \"The number of CPU cores\",\n title: \"CPU Count\",\n required: true,\n },\n \"requests.total\": {\n type: \"number\",\n description: \"The total number of requests handled by the process\",\n title: \"Total Requests\",\n required: true,\n },\n },\n} as const satisfies SpanDefinition;\n\nconst CognitiveSpan = {\n name: \"cognitive.request\",\n importance: \"high\",\n attributes: {\n \"ai.model\": {\n type: \"string\",\n description: \"The AI model used for the request\",\n title: \"AI Model\",\n },\n \"ai.provider\": {\n type: \"string\",\n description: \"The AI provider used for the request\",\n title: \"AI Provider\",\n },\n \"ai.temperature\": {\n type: \"number\",\n description: \"The temperature setting for the AI model\",\n title: \"AI Temperature\",\n },\n \"ai.max_tokens\": {\n type: \"number\",\n description: \"The maximum number of tokens to generate\",\n title: \"AI Max Tokens\",\n },\n \"ai.top_p\": {\n type: \"number\",\n description: \"The top_p (nucleus sampling) parameter\",\n title: \"AI Top P\",\n },\n \"ai.system_length\": {\n type: \"number\",\n description: \"The length of the system prompt in characters\",\n title: \"AI System Prompt Length\",\n },\n \"ai.messages_count\": {\n type: \"number\",\n description: \"The number of messages in the conversation\",\n title: \"AI Messages Count\",\n },\n \"ai.input_length\": {\n type: \"number\",\n description: \"The total length of input messages in characters\",\n title: \"AI Input Length\",\n },\n \"ai.input_tokens\": {\n type: \"number\",\n description: \"The number of input tokens used for the request\",\n title: \"AI Input Tokens\",\n },\n \"ai.output_tokens\": {\n type: \"number\",\n description: \"The number of output tokens used for the request\",\n title: \"AI Output Tokens\",\n },\n \"ai.cost_input\": {\n type: \"number\",\n description: \"The cost of input tokens in USD\",\n title: \"AI Input Cost (USD)\",\n },\n \"ai.cost_output\": {\n type: \"number\",\n description: \"The cost of output tokens in USD\",\n title: \"AI Output Cost (USD)\",\n },\n \"ai.cost\": {\n type: \"number\",\n description: \"The total cost of the request in USD\",\n title: \"AI Cost (USD)\",\n },\n \"ai.cached\": {\n type: \"boolean\",\n description: \"Whether the response was served from cache\",\n title: \"AI Cached\",\n },\n \"ai.prompt_category\": {\n type: \"string\",\n description: \"The category of the prompt\",\n title: \"AI Prompt Category\",\n },\n \"ai.prompt_source\": {\n type: \"string\",\n description: \"The source of the prompt\",\n title: \"AI Prompt Source\",\n },\n \"ai.instructions\": {\n type: \"string\",\n description: \"The system prompt/instructions for the AI model\",\n title: \"AI Instructions\",\n },\n \"ai.tools\": {\n type: \"json\",\n description: \"The tools available to the AI model\",\n title: \"AI Tools\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst BotpressClientSpan = {\n name: \"botpress.client\",\n importance: \"medium\",\n attributes: {\n \"botpress.method\": {\n type: \"enum\",\n enum: [\"GET\", \"POST\", \"PUT\", \"OPTIONS\", \"DELETE\"] as const,\n required: true,\n },\n \"botpress.url\": { type: \"string\" },\n \"botpress.status_code\": { type: \"number\", default: \"\" },\n \"botpress.duration_ms\": { type: \"number\" },\n \"botpress.error\": { type: \"string\" },\n \"botpress.via\": { type: \"string\" },\n \"botpress.request.body\": { type: \"string\" },\n \"botpress.response.body\": { type: \"string\" },\n \"trace.traceparent\": { type: \"string\" },\n ...optional(\n \"conversationId\",\n \"messageId\",\n \"workflowId\",\n \"userId\",\n \"eventId\",\n \"action.name\"\n ),\n },\n} as const satisfies SpanDefinition;\n\nconst HttpSpan = {\n name: \"http.client\",\n importance: \"medium\",\n attributes: {\n \"http.method\": {\n type: \"enum\",\n enum: [\"GET\", \"POST\", \"PUT\", \"OPTIONS\", \"DELETE\"] as const,\n required: true,\n },\n \"http.url\": { type: \"string\", required: true },\n \"http.query\": { type: \"json\" },\n \"http.request.headers\": { type: \"json\" },\n \"http.response.headers\": { type: \"json\" },\n \"http.request.body\": { type: \"string\" },\n \"http.response.body\": { type: \"string\" },\n \"http.status_code\": { type: \"number\" },\n \"http.error\": { type: \"string\" },\n \"http.via\": {\n type: \"enum\",\n enum: [\"http\", \"undici\"] as const,\n required: true,\n },\n \"trace.traceparent\": { type: \"string\" },\n },\n} as const satisfies SpanDefinition;\n\nconst ConversationHandlerSpan = {\n name: \"handler.conversation\",\n importance: \"high\",\n attributes: {\n ...required(\n \"botId\",\n \"conversationId\",\n \"eventId\",\n \"integration\",\n \"channel\",\n \"event.type\"\n ),\n ...optional(\n \"messageId\",\n \"userId\",\n \"event.payload\",\n \"message.payload\",\n \"message.type\"\n ),\n },\n} as const satisfies SpanDefinition;\n\nconst TriggerHandlerSpan = {\n name: \"handler.trigger\",\n importance: \"high\",\n attributes: {\n ...required(\"botId\", \"eventId\", \"event.type\"),\n ...optional(\n \"conversationId\",\n \"messageId\",\n \"userId\",\n \"integration\",\n \"channel\",\n \"workflowId\",\n \"parentWorkflowId\"\n ),\n },\n} as const satisfies SpanDefinition;\n\nconst EventHandlerSpan = {\n name: \"handler.event\",\n importance: \"high\",\n attributes: {\n ...required(\"botId\", \"eventId\", \"event.type\"),\n ...optional(\n \"conversationId\",\n \"messageId\",\n \"userId\",\n \"integration\",\n \"channel\",\n \"workflowId\",\n \"parentWorkflowId\"\n ),\n },\n} as const satisfies SpanDefinition;\n\nconst WorkflowHandlerSpan = {\n name: \"handler.workflow\",\n importance: \"high\",\n attributes: {\n ...required(\"botId\", \"workflowId\", \"eventId\", \"event.type\"),\n ...optional(\n \"messageId\",\n \"userId\",\n \"integration\",\n \"channel\",\n \"conversationId\",\n \"parentWorkflowId\"\n ),\n \"workflow.name\": { type: \"string\" },\n \"workflow.status.initial\": {\n type: \"enum\",\n enum: [\n \"pending\",\n \"in_progress\",\n \"listening\",\n \"paused\",\n \"completed\",\n \"failed\",\n \"timedout\",\n \"cancelled\",\n ] as const,\n },\n \"workflow.status.final\": {\n type: \"enum\",\n enum: [\"continue\", \"completed\", \"failed\"] as const,\n },\n },\n} as const satisfies SpanDefinition;\n\nconst WorkflowStepSpan = {\n name: \"handler.workflow.step\",\n importance: \"high\",\n attributes: {\n ...required(\"workflowId\"),\n \"workflow.step\": { type: \"string\", required: true },\n \"workflow.step.type\": { type: \"string\", required: true },\n \"workflow.step.attempt\": { type: \"number\", required: true },\n \"workflow.step.output\": { type: \"json\" },\n \"workflow.step.max_attempts\": { type: \"number\" },\n \"workflow.step.error\": { type: \"string\" },\n },\n} as const satisfies SpanDefinition;\n\nconst ActionHandlerSpan = {\n name: \"handler.action\",\n importance: \"high\",\n attributes: {\n ...required(\"botId\", \"workflowId\", \"eventId\", \"event.type\"),\n ...optional(\n \"messageId\",\n \"userId\",\n \"integration\",\n \"channel\",\n \"conversationId\",\n \"parentWorkflowId\"\n ),\n \"action.name\": { type: \"string\", required: true },\n \"action.input\": { type: \"json\", required: true },\n },\n} as const satisfies SpanDefinition;\n\nconst AutonomousExecutionSpan = {\n name: \"autonomous.execution\",\n importance: \"high\",\n attributes: {\n \"autonomous.max_loops\": {\n type: \"number\",\n title: \"Max Loops\",\n description: \"The maximum number of loops allowed\",\n required: true,\n },\n \"autonomous.mode\": {\n type: \"enum\",\n title: \"Mode\",\n description: \"The mode LLMz is running in (chat or worker)\",\n enum: [\"chat\", \"worker\"] as const,\n required: true,\n },\n \"autonomous.message_types\": {\n type: \"json\",\n title: \"Message Types\",\n description: \"The types of messages LLMz can send\",\n },\n \"autonomous.iterations\": {\n type: \"number\",\n title: \"Iterations\",\n description: \"The number of iterations performed\",\n },\n \"autonomous.execution_id\": {\n type: \"string\",\n title: \"Execution ID\",\n description: \"The unique ID for this execution\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst AutonomousIterationSpan = {\n name: \"autonomous.iteration\",\n importance: \"high\",\n attributes: {\n \"autonomous.iteration\": {\n type: \"number\",\n title: \"Iteration\",\n description: \"The current iteration number\",\n required: true,\n },\n \"autonomous.instructions\": {\n type: \"string\",\n title: \"Instructions\",\n description: \"The instructions provided to the agent\",\n },\n \"autonomous.exits\": {\n type: \"json\",\n title: \"Exits\",\n description: \"The possible exit points for the agent\",\n },\n \"autonomous.code\": {\n type: \"string\",\n title: \"Code\",\n description: \"The code generated in this iteration\",\n },\n \"autonomous.tools\": {\n type: \"json\",\n title: \"Tools\",\n description: \"The tools available to the agent\",\n },\n \"autonomous.thoughts\": {\n type: \"string\",\n title: \"Thoughts\",\n description: \"The thoughts generated in this iteration\",\n },\n \"autonomous.status\": {\n type: \"enum\",\n enum: [\n \"pending\",\n \"generation_error\",\n \"execution_error\",\n \"invalid_code_error\",\n \"thinking_requested\",\n \"callback_requested\",\n \"exit_success\",\n \"exit_error\",\n \"aborted\",\n ] as const satisfies IterationStatus[\"type\"][],\n title: \"Error Type\",\n description: \"The type of error encountered, if any\",\n },\n \"autonomous.error\": {\n type: \"string\",\n title: \"Error Message\",\n description: \"The error message, if any\",\n },\n \"autonomous.exit.name\": {\n type: \"string\",\n title: \"Exit Name\",\n description: \"The name of the exit point if exiting\",\n },\n \"autonomous.exit.value\": {\n type: \"json\",\n title: \"Exit Value\",\n description: \"The value returned upon exit\",\n },\n \"ai.model\": {\n type: \"string\",\n title: \"AI Model\",\n description: \"The AI model used for this iteration\",\n },\n \"ai.tokens\": {\n type: \"number\",\n title: \"Input Tokens\",\n description: \"Number of input tokens used\",\n },\n \"ai.cost\": {\n type: \"number\",\n title: \"Cost\",\n description: \"Total cost of this iteration in USD\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst AutonomousToolSpan = {\n name: \"autonomous.tool\",\n importance: \"high\",\n attributes: {\n \"autonomous.tool.name\": {\n type: \"string\",\n title: \"Tool Name\",\n description: \"The name of the tool being used\",\n required: true,\n },\n \"autonomous.tool.input\": {\n type: \"json\",\n title: \"Tool Input\",\n description: \"The input provided to the tool\",\n },\n \"autonomous.tool.output\": {\n type: \"json\",\n title: \"Tool Output\",\n description: \"The output returned by the tool\",\n },\n \"autonomous.tool.status\": {\n type: \"enum\",\n enum: [\"think\", \"success\", \"error\"] as const,\n title: \"Tool Status\",\n description: \"The status of the tool execution\",\n },\n \"autonomous.tool.error\": {\n type: \"string\",\n title: \"Tool Error\",\n description: \"The error message if the tool failed\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst InterruptionCheckSpan = {\n name: \"interruption.check\",\n importance: \"medium\",\n attributes: {\n ...required(\"conversationId\"),\n \"interruption.detected\": {\n type: \"boolean\",\n title: \"Interruption Detected\",\n description: \"Whether an interruption was detected\",\n },\n \"interruption.events_count\": {\n type: \"number\",\n title: \"New Events Count\",\n description: \"The number of new events detected\",\n },\n \"interruption.event_ids\": {\n type: \"json\",\n title: \"New Event IDs\",\n description: \"The IDs of the new events that caused the interruption\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst ChatFetchTranscriptSpan = {\n name: \"chat.fetchTranscript\",\n importance: \"medium\",\n attributes: {\n ...required(\"conversationId\"),\n },\n} as const satisfies SpanDefinition;\n\nconst ChatCompactTranscriptSpan = {\n name: \"chat.compactTranscript\",\n importance: \"medium\",\n attributes: {\n ...required(\"conversationId\"),\n },\n} as const satisfies SpanDefinition;\n\nconst ChatSaveTranscriptSpan = {\n name: \"chat.saveTranscript\",\n importance: \"medium\",\n attributes: {\n ...required(\"conversationId\"),\n },\n} as const satisfies SpanDefinition;\n\nconst ChatSendMessageSpan = {\n name: \"chat.sendMessage\",\n importance: \"high\",\n attributes: {\n ...required(\"conversationId\"),\n ...optional(\"messageId\", \"integration\", \"channel\", \"userId\", \"botId\"),\n \"message.type\": {\n type: \"string\",\n description: \"The type of message being sent\",\n title: \"Message Type\",\n },\n direction: {\n type: \"enum\",\n enum: [\"incoming\", \"outgoing\"] as const,\n description: \"The direction of the message\",\n title: \"Direction\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst TrackedStateLoadSpan = {\n name: \"state.load\",\n importance: \"medium\",\n attributes: {\n type: {\n type: \"enum\",\n enum: [\"bot\", \"user\", \"conversation\", \"workflow\"] as const,\n description: \"The type of state being loaded\",\n title: \"State Type\",\n required: true,\n },\n name: {\n type: \"string\",\n description: \"The name of the state\",\n title: \"State Name\",\n required: true,\n },\n location: {\n type: \"enum\",\n enum: [\"state\", \"file\"] as const,\n description: \"Where the state is stored\",\n title: \"Storage Location\",\n },\n has_value: {\n type: \"boolean\",\n description: \"Whether the state has a value\",\n title: \"Has Value\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst TrackedStateSaveSpan = {\n name: \"state.save\",\n importance: \"medium\",\n attributes: {\n type: {\n type: \"enum\",\n enum: [\"bot\", \"user\", \"conversation\", \"workflow\"] as const,\n description: \"The type of state being saved\",\n title: \"State Type\",\n required: true,\n },\n name: {\n type: \"string\",\n description: \"The name of the state\",\n title: \"State Name\",\n required: true,\n },\n state_size_bytes: {\n type: \"number\",\n description: \"The size of the state in bytes\",\n title: \"State Size (bytes)\",\n },\n swapped_to_file: {\n type: \"boolean\",\n description: \"Whether the state was swapped to a file\",\n title: \"Swapped to File\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst TrackedStateSaveAllDirtySpan = {\n name: \"state.saveAllDirty\",\n importance: \"medium\",\n attributes: {\n states_count: {\n type: \"number\",\n description: \"The number of dirty states being saved\",\n title: \"States Count\",\n required: true,\n },\n states: {\n type: \"json\",\n description: \"The list of states being saved (type/id/name)\",\n title: \"States\",\n },\n },\n} as const satisfies SpanDefinition;\n\nconst TrackedStateLoadAllSpan = {\n name: \"state.loadAll\",\n importance: \"medium\",\n attributes: {},\n} as const satisfies SpanDefinition;\n\nexport const Spans = {\n IncomingRequestSpan,\n CognitiveSpan,\n HttpSpan,\n BotpressClientSpan,\n ConversationHandlerSpan,\n TriggerHandlerSpan,\n WorkflowHandlerSpan,\n WorkflowStepSpan,\n ActionHandlerSpan,\n EventHandlerSpan,\n AutonomousExecutionSpan,\n AutonomousIterationSpan,\n AutonomousToolSpan,\n InterruptionCheckSpan,\n ChatFetchTranscriptSpan,\n ChatCompactTranscriptSpan,\n ChatSaveTranscriptSpan,\n ChatSendMessageSpan,\n TrackedStateLoadSpan,\n TrackedStateSaveSpan,\n TrackedStateSaveAllDirtySpan,\n TrackedStateLoadAllSpan,\n} as const;\n\n// Re-export types for convenience\nexport type { WellKnownAttributeName } from \"./well-known-attributes\";\nexport type { SpanImportanceLevel } from \"./factory\";\n"],
5
+ "mappings": ";AAOO,IAAM,sBAAsB;AAAA,EACjC,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,IACP,SAAS;AAAA,EACX;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,WAAW;AAAA,IACT,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,kBAAkB;AAAA,IAChB,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,SAAS;AAAA,IACP,MAAM;AAAA,I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ACA,iBAAiB;AAAA,MACf,MAAM;AAAA,MACN,aAAa;AAAA,MACb,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,+BAA+B;AAAA,EACnC,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,YAAY;AAAA,IACV,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,OAAO;AAAA,MACP,UAAU;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,MACb,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,0BAA0B;AAAA,EAC9B,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,YAAY,CAAC;AACf;AAEO,IAAM,QAAQ;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Creates a new AbortController that aborts when any of the provided signals abort.
3
+ * This is useful for combining multiple abort conditions (e.g., user cancellation, timeout, parent operation abort).
4
+ *
5
+ * @param signals - Array of AbortSignals to listen to. Undefined/null signals are ignored.
6
+ * @returns A new AbortController that will abort if any input signal aborts
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const userController = new AbortController()
11
+ * const timeoutController = new AbortController()
12
+ *
13
+ * // Create a joined controller that aborts if either signal aborts
14
+ * const joinedController = createJoinedAbortController([
15
+ * userController.signal,
16
+ * timeoutController.signal
17
+ * ])
18
+ *
19
+ * // Use the joined signal in operations
20
+ * await fetch('/api/data', { signal: joinedController.signal })
21
+ * ```
22
+ */
23
+ export declare function createJoinedAbortController(signals: (AbortSignal | undefined | null)[]): AbortController;
24
+ /**
25
+ * Convenience function that creates a joined abort signal directly.
26
+ *
27
+ * @param signals - Array of AbortSignals to combine
28
+ * @returns The signal from the joined AbortController
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const joinedSignal = createJoinedAbortSignal([
33
+ * userController.signal,
34
+ * timeoutController.signal
35
+ * ])
36
+ *
37
+ * await someOperation({ signal: joinedSignal })
38
+ * ```
39
+ */
40
+ export declare function createJoinedAbortSignal(signals: (AbortSignal | undefined | null)[]): AbortSignal;
41
+ //# sourceMappingURL=abort-signal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-signal.d.ts","sourceRoot":"","sources":["../../src/utilities/abort-signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,CAAC,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,GAC1C,eAAe,CA8CjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,CAAC,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC,EAAE,GAC1C,WAAW,CAEb"}
@@ -0,0 +1,10 @@
1
+ import { Event, Message } from "@botpress/client";
2
+ export declare function isEvent(event: unknown): event is Event;
3
+ export declare function isEventMessage(event: Event): event is Event & {
4
+ type: "message_created";
5
+ payload: {
6
+ message: Message;
7
+ };
8
+ };
9
+ export declare function isMessage(message: unknown): message is Message;
10
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/utilities/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIlD,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAQtD;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,GACX,KAAK,IAAI,KAAK,GAAG;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,CAY7E;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,OAAO,CAQ9D"}
@@ -0,0 +1,3 @@
1
+ export declare const promiseFromSignal: (signal: AbortSignal) => Promise<unknown>;
2
+ export declare const timeout: (ms: number, signal?: AbortSignal) => Promise<unknown>;
3
+ //# sourceMappingURL=promises.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promises.d.ts","sourceRoot":"","sources":["../../src/utilities/promises.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,GAAI,QAAQ,WAAW,qBAWjD,CAAC;AAEL,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,EAAE,SAAS,WAAW,qBAiBvD,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const MaxStateSize: {
2
+ readonly bytes: number;
3
+ readonly human: string;
4
+ readonly value: 131072;
5
+ readonly unit: "bytes";
6
+ };
7
+ export declare const isStateTooBig: (state: unknown) => false | {
8
+ human: string;
9
+ bytes: number;
10
+ };
11
+ export declare const getObjectPreview: (obj: unknown, depth?: number) => unknown;
12
+ //# sourceMappingURL=size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/utilities/size.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;CAWf,CAAC;AAEX,eAAO,MAAM,aAAa,GACxB,OAAO,OAAO,KACb,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CASxC,CAAC;AAIF,eAAO,MAAM,gBAAgB,GAAI,KAAK,OAAO,EAAE,QAAO,MAAU,KAAG,OAmClE,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Inspect any JSON-serializable value so its JSON string fits within maxBytes (UTF-8).
3
+ * - Long strings are middle-truncated: "hello ... world"
4
+ * - Arrays keep the first few elements and append a tail note: "... (+N more items)"
5
+ * - Large/recursive subtrees collapse to "[...]"
6
+ * - Cycles: "[Circular]"
7
+ * - Always returns *valid JSON* when JSON.stringify()'d
8
+ */
9
+ export declare function inspectToJsonSize(input: unknown, opts: {
10
+ maxBytes: number;
11
+ minAssumedBytes?: number;
12
+ initialStringHead?: number;
13
+ initialStringTail?: number;
14
+ initialArrayItems?: number;
15
+ initialObjectKeys?: number;
16
+ maxDepth?: number;
17
+ }): string;
18
+ //# sourceMappingURL=strings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utilities/strings.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE;IACJ,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,MAAM,CAwOR"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Gets the tag name for a trigger
3
+ * @param triggerName - The name of the trigger
4
+ * @returns The tag name in format "trigger[5-char-hash]"
5
+ */
6
+ export declare const getTriggerTagName: (triggerName: string) => string;
7
+ /**
8
+ * Gets the tag value for a specific trigger match
9
+ * @param key - The specific key from the trigger match result, or undefined for wildcard
10
+ * @returns The tag value - either the specific key or "*" for wildcard
11
+ */
12
+ export declare const getTriggerTagValue: (key?: string) => string;
13
+ /**
14
+ * Helper to subscribe a conversation to a trigger
15
+ * @param triggerName - The name of the trigger to subscribe to
16
+ * @param key - Optional specific key to subscribe to (omit for wildcard subscription)
17
+ * @returns Object with tagName and tagValue to use for subscription
18
+ */
19
+ export declare const getTriggerSubscriptionTags: (triggerName: string, key?: string) => {
20
+ name: string;
21
+ value: string;
22
+ };
23
+ /**
24
+ * Checks if a conversation should handle a trigger event based on its tags
25
+ * @param conversationTags - The tags on the conversation
26
+ * @param triggerName - The name of the trigger that fired
27
+ * @param triggerKey - The key from the trigger match result
28
+ * @returns true if the conversation is subscribed to this trigger event
29
+ */
30
+ export declare const isConversationSubscribedToTrigger: (conversationTags: Record<string, string>, triggerName: string, triggerKey?: string) => boolean;
31
+ //# sourceMappingURL=trigger-tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-tags.d.ts","sourceRoot":"","sources":["../../src/utilities/trigger-tags.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,KAAG,MAEvD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAEjD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,MAAM,EACnB,MAAM,MAAM;;;CAMb,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,GAC5C,kBAAkB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,aAAa,MAAM,EACnB,aAAa,MAAM,KAClB,OAUF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type Defined<T> = T extends undefined ? never : T;
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utilities/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Bot } from "@botpress/sdk";
2
+ /**
3
+ * Main worker execution
4
+ */
5
+ export declare function runWorker(bot: Bot): void;
6
+ //# sourceMappingURL=dev_worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev_worker.d.ts","sourceRoot":"","sources":["../../src/workers/dev_worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAqDpC;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAwFxC"}
@@ -0,0 +1,5 @@
1
+ export { isMainThread } from "worker_threads";
2
+ export declare const isWorkerMode: () => boolean;
3
+ export { initializeParentWorker } from "./parent_worker";
4
+ export { runWorker } from "./dev_worker";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,YAAY,eAGxB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Initialize the main thread with worker pool
3
+ */
4
+ export declare function initializeParentWorker(bot: any): void;
5
+ //# sourceMappingURL=parent_worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parent_worker.d.ts","sourceRoot":"","sources":["../../src/workers/parent_worker.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAgCrD"}
@@ -0,0 +1,109 @@
1
+ /** Number of worker threads in the pool */
2
+ export declare const WORKER_POOL_SIZE = 10;
3
+ /** Worker lifetime in milliseconds (default: 5 minutes) */
4
+ export declare const WORKER_LIFETIME_MS: number;
5
+ /** Minimum lifetime remaining before replacing worker (default: 30 seconds) */
6
+ export declare const WORKER_MIN_LIFETIME_MS: number;
7
+ /** Timeout for worker acknowledgment in milliseconds (default: 5 seconds) */
8
+ export declare const WORKER_ACK_TIMEOUT_MS: number;
9
+ /** Timeout for worker to complete task in milliseconds (default: 2 minutes) */
10
+ export declare const WORKER_TASK_TIMEOUT_MS: number;
11
+ /** Interval for checking worker expiry (default: 10 seconds) */
12
+ export declare const WORKER_EXPIRY_CHECK_INTERVAL_MS: number;
13
+ /** Maximum time a request can wait in queue (default: 30 seconds) */
14
+ export declare const QUEUE_TIMEOUT_MS: number;
15
+ interface PoolStatistics {
16
+ requestsReceived: number;
17
+ requestsDispatched: number;
18
+ requestsQueued: number;
19
+ requestsAbandoned: number;
20
+ requestsCompleted: number;
21
+ requestsFailed: number;
22
+ requestsTimedOut: number;
23
+ currentQueueSize: number;
24
+ queueTimes: number[];
25
+ ackTimes: number[];
26
+ processingTimes: number[];
27
+ successRate: number;
28
+ timeoutRate: number;
29
+ abandonRate: number;
30
+ }
31
+ export declare class WorkerPool {
32
+ private workers;
33
+ private roundRobinIndex;
34
+ private nextWorkerId;
35
+ private workerScript;
36
+ private expiryCheckInterval?;
37
+ private requestQueue;
38
+ private pendingTasks;
39
+ private taskTimings;
40
+ private stats;
41
+ constructor(workerScript?: string);
42
+ /**
43
+ * Initialize the worker pool with the configured number of workers
44
+ */
45
+ private initialize;
46
+ /**
47
+ * Start proactive worker expiry checking
48
+ */
49
+ private startExpiryCheck;
50
+ /**
51
+ * Check all workers for expiry and proactively replace those about to expire
52
+ */
53
+ private checkWorkerExpiry;
54
+ /**
55
+ * Create a new worker and add it to the pool
56
+ */
57
+ private createWorker;
58
+ /**
59
+ * Handle messages from workers
60
+ */
61
+ private handleWorkerMessage;
62
+ /**
63
+ * Handle worker crash or unexpected termination
64
+ */
65
+ private handleWorkerCrash;
66
+ /**
67
+ * Get next available worker using round-robin strategy
68
+ */
69
+ private getNextAvailableWorker;
70
+ /**
71
+ * Replace a worker with a new one
72
+ */
73
+ private replaceWorker;
74
+ /**
75
+ * Process queued requests when workers become available
76
+ */
77
+ private processQueue;
78
+ /**
79
+ * Dispatch a task to a specific worker
80
+ */
81
+ private dispatchToWorker;
82
+ /**
83
+ * Execute a task on an available worker or queue it
84
+ */
85
+ executeTask(event: any): Promise<any>;
86
+ /**
87
+ * Shutdown the worker pool
88
+ */
89
+ shutdown(): Promise<void>;
90
+ /**
91
+ * Get basic pool statistics (worker status)
92
+ */
93
+ getWorkerStats(): {
94
+ total: number;
95
+ idle: number;
96
+ busy: number;
97
+ terminated: number;
98
+ };
99
+ /**
100
+ * Get comprehensive pool statistics with histograms
101
+ */
102
+ getStats(): PoolStatistics;
103
+ /**
104
+ * Get statistics summary with percentiles
105
+ */
106
+ getStatsSummary(): string;
107
+ }
108
+ export {};
109
+ //# sourceMappingURL=worker_pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker_pool.d.ts","sourceRoot":"","sources":["../../src/workers/worker_pool.ts"],"names":[],"mappings":"AAOA,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,QAEd,CAAC;AAElB,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,QAAY,CAAC;AAEhD,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,QAAW,CAAC;AAE9C,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,QAAgB,CAAC;AAEpD,gEAAgE;AAChE,eAAO,MAAM,+BAA+B,QAAY,CAAC;AAEzD,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,QAAY,CAAC;AAkC1C,UAAU,cAAc;IAEtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IAGzB,g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U,EAAE,MAAM,CAAC;KACpB;IAeD;;OAEG;IACI,QAAQ,IAAI,cAAc;IA6BjC;;OAEG;IACI,eAAe,IAAI,MAAM;CAkEjC"}
package/package.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "name": "@botpress/runtime",
3
+ "version": "1.0.1",
4
+ "description": "Lightweight runtime library for ADK-based Botpress agents",
5
+ "type": "module",
6
+ "files": [
7
+ "dist/**/*",
8
+ "package.json",
9
+ "README.md"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/library.d.ts",
14
+ "import": "./dist/library.js"
15
+ },
16
+ "./library": {
17
+ "types": "./dist/library.d.ts",
18
+ "import": "./dist/library.js"
19
+ },
20
+ "./runtime": {
21
+ "types": "./dist/runtime.d.ts",
22
+ "import": "./dist/runtime.js"
23
+ },
24
+ "./definition": {
25
+ "types": "./dist/definition.d.ts",
26
+ "import": "./dist/definition.js"
27
+ },
28
+ "./internal": {
29
+ "types": "./dist/internal.d.ts",
30
+ "import": "./dist/internal.js"
31
+ },
32
+ "./ui": {
33
+ "types": "./dist/ui.d.ts",
34
+ "import": "./dist/ui.js"
35
+ }
36
+ },
37
+ "scripts": {
38
+ "build": "tsc && bun esbuild.ts",
39
+ "build:watch": "tsc --watch",
40
+ "watch": "bun esbuild.ts --watch",
41
+ "clean": "rm -rf dist",
42
+ "prepublishOnly": "bun run clean && bun run build",
43
+ "test": "bun test",
44
+ "v": "tsc --version"
45
+ },
46
+ "keywords": [
47
+ "botpress",
48
+ "adk",
49
+ "agent",
50
+ "runtime",
51
+ "ai",
52
+ "chatbot",
53
+ "conversational-ai"
54
+ ],
55
+ "author": "Botpress",
56
+ "license": "MIT",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "https://github.com/botpress/adk"
60
+ },
61
+ "dependencies": {
62
+ "@botpress/client": "1.26.0",
63
+ "@botpress/cognitive": "0.1.47",
64
+ "@botpress/sdk": "4.16.0",
65
+ "@botpress/zai": "^2.1.16",
66
+ "@bpinternal/const": "^0.3.3",
67
+ "@bpinternal/thicktoken": "^1.0.0",
68
+ "@bpinternal/zui": "^1.1.0",
69
+ "@opentelemetry/api": "^1.9.0",
70
+ "@opentelemetry/context-async-hooks": "^2.1.0",
71
+ "@opentelemetry/core": "^2.1.0",
72
+ "@opentelemetry/instrumentation": "^0.205.0",
73
+ "@opentelemetry/instrumentation-http": "^0.205.0",
74
+ "@opentelemetry/resources": "^2.1.0",
75
+ "@opentelemetry/sdk-trace-base": "^2.1.0",
76
+ "@opentelemetry/sdk-trace-node": "^2.1.0",
77
+ "@opentelemetry/semantic-conventions": "^1.37.0",
78
+ "axios": "^1.11.0",
79
+ "bytes": "^3.1.2",
80
+ "dedent": "^1.6.0",
81
+ "fast-safe-stringify": "^2.1.1",
82
+ "fast-xml-parser": "^5.3.0",
83
+ "glob": "^11.0.3",
84
+ "llmz": "^0.0.26",
85
+ "lodash": "^4.17.21",
86
+ "ms": "^2.1.3",
87
+ "object-sizeof": "^2.6.5",
88
+ "pretty-bytes": "^7.0.1",
89
+ "ulid": "^3.0.1",
90
+ "undici": "^7.16.0"
91
+ },
92
+ "devDependencies": {
93
+ "@types/bun": "^1.3.0",
94
+ "@types/bytes": "^3.1.5",
95
+ "@types/glob": "^8.1.0",
96
+ "@types/lodash": "^4.17.20",
97
+ "@types/ms": "^2.1.0",
98
+ "@types/node": "^22.0.0",
99
+ "esbuild": "^0.25.10",
100
+ "typescript": "^5.9.2",
101
+ "vitest": "^2.1.8"
102
+ },
103
+ "peerDependencies": {
104
+ "typescript": ">=4.5.0"
105
+ },
106
+ "engines": {
107
+ "node": ">=22.0.0"
108
+ }
109
+ }