@circuitwall/jarela 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +4 -4
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  13. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  14. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  15. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  16. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  18. package/.next/standalone/.next/server/app/api/v1/access/[identity]/route.js +7 -0
  19. package/.next/standalone/.next/server/app/api/v1/access/route.js +7 -0
  20. package/.next/standalone/.next/server/app/api/v1/agents/[id]/compact/route.js +7 -0
  21. package/.next/standalone/.next/server/app/api/v1/agents/[id]/display-filters/route.js +17 -5
  22. package/.next/standalone/.next/server/app/api/v1/agents/[id]/route.js +7 -0
  23. package/.next/standalone/.next/server/app/api/v1/agents/[id]/thread/route.js +17 -5
  24. package/.next/standalone/.next/server/app/api/v1/agents/route.js +7 -0
  25. package/.next/standalone/.next/server/app/api/v1/allowed-sites/[hostname]/route.js +7 -0
  26. package/.next/standalone/.next/server/app/api/v1/allowed-sites/route.js +7 -0
  27. package/.next/standalone/.next/server/app/api/v1/artifacts/lifecycle/route.js +7 -0
  28. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +26 -32
  29. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/[remote_jid]/route.js +18 -7
  31. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/ignores/route.js +18 -7
  32. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +26 -32
  33. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +27 -33
  35. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +26 -32
  37. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/[route_id]/route.js +28 -12
  39. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/routes/route.js +28 -12
  40. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +26 -32
  41. package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js +9 -2
  43. package/.next/standalone/.next/server/app/api/v1/bridges/kinds/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/v1/bridges/route.js +19 -7
  45. package/.next/standalone/.next/server/app/api/v1/bridges/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/v1/dashboard/metrics/route.js +17 -5
  47. package/.next/standalone/.next/server/app/api/v1/dashboard/pricing/route.js +7 -0
  48. package/.next/standalone/.next/server/app/api/v1/documents/search/route.js +7 -0
  49. package/.next/standalone/.next/server/app/api/v1/documents/settings/route.js +7 -0
  50. package/.next/standalone/.next/server/app/api/v1/env-sync/allowlist/route.js +7 -0
  51. package/.next/standalone/.next/server/app/api/v1/env-sync/route.js +7 -0
  52. package/.next/standalone/.next/server/app/api/v1/events/route.js +26 -32
  53. package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/v1/extension/browser/activate/route.js +7 -0
  55. package/.next/standalone/.next/server/app/api/v1/extension/browser/foreground/route.js +7 -0
  56. package/.next/standalone/.next/server/app/api/v1/extension/browser/history/route.js +7 -0
  57. package/.next/standalone/.next/server/app/api/v1/extension/browser/poll/route.js +7 -0
  58. package/.next/standalone/.next/server/app/api/v1/extension/browser/progress/route.js +7 -0
  59. package/.next/standalone/.next/server/app/api/v1/extension/browser/result/route.js +7 -0
  60. package/.next/standalone/.next/server/app/api/v1/extension/browser/retry/route.js +7 -0
  61. package/.next/standalone/.next/server/app/api/v1/extension/browser/status/route.js +7 -0
  62. package/.next/standalone/.next/server/app/api/v1/extension/browser/tabs/route.js +7 -0
  63. package/.next/standalone/.next/server/app/api/v1/harnesses/[id]/route.js +7 -0
  64. package/.next/standalone/.next/server/app/api/v1/harnesses/default/route.js +7 -0
  65. package/.next/standalone/.next/server/app/api/v1/harnesses/route.js +7 -0
  66. package/.next/standalone/.next/server/app/api/v1/health/route.js +17 -5
  67. package/.next/standalone/.next/server/app/api/v1/integrations/[name]/route.js +7 -0
  68. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +7 -0
  69. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +7 -0
  70. package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +7 -0
  71. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +7 -0
  72. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +7 -0
  73. package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +7 -0
  74. package/.next/standalone/.next/server/app/api/v1/integrations/route.js +7 -0
  75. package/.next/standalone/.next/server/app/api/v1/lifecycle/adoption/route.js +17 -5
  76. package/.next/standalone/.next/server/app/api/v1/maps/embed/route.js +7 -0
  77. package/.next/standalone/.next/server/app/api/v1/mcp-servers/[name]/route.js +17 -5
  78. package/.next/standalone/.next/server/app/api/v1/mcp-servers/route.js +17 -5
  79. package/.next/standalone/.next/server/app/api/v1/memory/[namespace]/[key]/route.js +7 -0
  80. package/.next/standalone/.next/server/app/api/v1/memory/policy/route.js +7 -0
  81. package/.next/standalone/.next/server/app/api/v1/memory/route.js +7 -0
  82. package/.next/standalone/.next/server/app/api/v1/memory/search/route.js +7 -0
  83. package/.next/standalone/.next/server/app/api/v1/models/[name]/compact-threads/route.js +7 -0
  84. package/.next/standalone/.next/server/app/api/v1/models/[name]/route.js +7 -0
  85. package/.next/standalone/.next/server/app/api/v1/models/route.js +7 -0
  86. package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +27 -12
  87. package/.next/standalone/.next/server/app/api/v1/profile/location/route.js +7 -0
  88. package/.next/standalone/.next/server/app/api/v1/profile/route.js +7 -0
  89. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/models/route.js +7 -0
  90. package/.next/standalone/.next/server/app/api/v1/providers/[provider]/probe/route.js +7 -0
  91. package/.next/standalone/.next/server/app/api/v1/providers/github-copilot/auth/route.js +7 -0
  92. package/.next/standalone/.next/server/app/api/v1/providers/route.js +7 -0
  93. package/.next/standalone/.next/server/app/api/v1/proxy-config/route.js +7 -0
  94. package/.next/standalone/.next/server/app/api/v1/redaction/init/route.js +7 -0
  95. package/.next/standalone/.next/server/app/api/v1/redaction/route.js +7 -0
  96. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/route.js +17 -5
  97. package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/route.js +7 -0
  98. package/.next/standalone/.next/server/app/api/v1/security/idle-timeout/route.js +7 -0
  99. package/.next/standalone/.next/server/app/api/v1/security/pin/route.js +7 -0
  100. package/.next/standalone/.next/server/app/api/v1/security/state/route.js +7 -0
  101. package/.next/standalone/.next/server/app/api/v1/security/unlock/route.js +7 -0
  102. package/.next/standalone/.next/server/app/api/v1/security/verify-pin/route.js +7 -0
  103. package/.next/standalone/.next/server/app/api/v1/skills/[id]/route.js +7 -0
  104. package/.next/standalone/.next/server/app/api/v1/skills/repos/[id]/route.js +7 -0
  105. package/.next/standalone/.next/server/app/api/v1/skills/repos/route.js +7 -0
  106. package/.next/standalone/.next/server/app/api/v1/skills/route.js +7 -0
  107. package/.next/standalone/.next/server/app/api/v1/tasks/[agent_id]/route.js +7 -0
  108. package/.next/standalone/.next/server/app/api/v1/tasks/route.js +7 -0
  109. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/activity/route.js +7 -0
  110. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/context-pin/route.js +12 -6
  111. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/route.js +7 -0
  112. package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +0 -1
  113. package/.next/standalone/.next/server/app/api/v1/threads/route.js +17 -5
  114. package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/api/v1/voice/transcribe/route.js +17 -5
  116. package/.next/standalone/.next/server/app/api/v1/voice/tts/route.js +17 -5
  117. package/.next/standalone/.next/server/app/api/v1/watchers/[id]/route.js +17 -5
  118. package/.next/standalone/.next/server/app/page.js +322 -275
  119. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/app/setup/page.js +8 -0
  121. package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  122. package/.next/standalone/.next/server/app-paths-manifest.json +4 -4
  123. package/.next/standalone/.next/server/chunks/1388.js +106 -36
  124. package/.next/standalone/.next/server/chunks/2068.js +47 -10
  125. package/.next/standalone/.next/server/chunks/210.js +6 -6
  126. package/.next/standalone/.next/server/chunks/2447.js +10 -5
  127. package/.next/standalone/.next/server/chunks/2471.js +17 -17
  128. package/.next/standalone/.next/server/chunks/3042.js +10 -8
  129. package/.next/standalone/.next/server/chunks/{4540.js → 309.js} +104 -38
  130. package/.next/standalone/.next/server/chunks/{2350.js → 3272.js} +104 -37
  131. package/.next/standalone/.next/server/chunks/3399.js +525 -525
  132. package/.next/standalone/.next/server/chunks/3524.js +150 -67
  133. package/.next/standalone/.next/server/chunks/4189.js +1 -1
  134. package/.next/standalone/.next/server/chunks/4508.js +2 -2
  135. package/.next/standalone/.next/server/chunks/46.js +73 -28
  136. package/.next/standalone/.next/server/chunks/5908.js +63 -42
  137. package/.next/standalone/.next/server/chunks/6142.js +10 -2
  138. package/.next/standalone/.next/server/chunks/6649.js +1 -1
  139. package/.next/standalone/.next/server/chunks/8461.js +10 -8
  140. package/.next/standalone/.next/server/chunks/9032.js +5 -5
  141. package/.next/standalone/.next/server/chunks/9164.js +435 -176
  142. package/.next/standalone/.next/server/chunks/9304.js +51 -12
  143. package/.next/standalone/.next/server/chunks/{423.js → 9590.js} +66 -21
  144. package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
  145. package/.next/standalone/.next/server/middleware.js +71 -18
  146. package/.next/standalone/.next/server/pages/404.html +2 -2
  147. package/.next/standalone/.next/server/pages/500.html +1 -1
  148. package/.next/standalone/.next/server/preview-props.json +3 -3
  149. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  150. package/.next/standalone/.next/static/chunks/app/{page-213a623b37226452.js → page-04748847c6ff866f.js} +171 -132
  151. package/.next/standalone/.next/static/css/{312542a5725ba0d5.css → 2669e8744cc8c212.css} +2 -2
  152. package/.next/standalone/docs/adoption/changesets.json +49 -0
  153. package/.next/standalone/package.json +1 -1
  154. package/CHANGELOG.md +19 -0
  155. package/app/api/v1/threads/[thread_id]/run/route.ts +0 -1
  156. package/components/chat/MessageBubble.tsx +12 -0
  157. package/components/integrations/NetworkSection.tsx +2 -2
  158. package/lib/agents/citation-checker.test.ts +40 -2
  159. package/lib/agents/citation-checker.ts +56 -11
  160. package/lib/agents/context-boundary.ts +5 -6
  161. package/lib/agents/instruction-edits.test.ts +120 -0
  162. package/lib/agents/instruction-edits.ts +65 -42
  163. package/lib/agents/prepare/request.ts +0 -2
  164. package/lib/agents/prepare/system-prompt.test.ts +10 -0
  165. package/lib/agents/prepare/system-prompt.ts +8 -2
  166. package/lib/agents/proposals.test.ts +76 -0
  167. package/lib/agents/proposals.ts +13 -5
  168. package/lib/agents/run-thread.auto-boundary.test.ts +125 -5
  169. package/lib/agents/run-thread.ts +24 -9
  170. package/lib/agents/sqlite-checkpoint-saver.test.ts +91 -0
  171. package/lib/agents/warm-summary-background.ts +22 -2
  172. package/lib/agents/warm-topics.test.ts +155 -1
  173. package/lib/agents/warm-topics.ts +27 -7
  174. package/lib/bridges/dispatcher.ts +1 -0
  175. package/lib/bridges/message-role.test.ts +81 -0
  176. package/lib/bridges/message-role.ts +23 -10
  177. package/lib/bridges/types.ts +6 -0
  178. package/lib/bridges/whatsapp-link.test.ts +32 -0
  179. package/lib/bridges/whatsapp-link.ts +21 -0
  180. package/lib/bridges/whatsapp.inbound.test.ts +239 -0
  181. package/lib/bridges/whatsapp.sender.test.ts +80 -1
  182. package/lib/bridges/whatsapp.ts +76 -38
  183. package/lib/pricing/snapshot.test.ts +70 -0
  184. package/lib/pricing/snapshot.ts +10 -2
  185. package/lib/proxy/dispatcher.test.ts +119 -1
  186. package/lib/proxy/dispatcher.ts +22 -9
  187. package/lib/stores/agent-configs.ts +10 -5
  188. package/lib/stores/bridges.test.ts +81 -0
  189. package/lib/stores/bridges.ts +9 -8
  190. package/lib/stores/proxy-config.test.ts +120 -0
  191. package/lib/stores/proxy-config.ts +22 -4
  192. package/lib/stores/threads.ts +12 -8
  193. package/lib/tools/communications/calendar.test.ts +43 -2
  194. package/lib/tools/communications/calendar.ts +2 -0
  195. package/lib/tools/communications/gmail.test.ts +51 -1
  196. package/lib/tools/communications/gmail.ts +44 -2
  197. package/lib/tools/communications/outlook-calendar.ts +2 -0
  198. package/lib/tools/communications/outlook.test.ts +33 -2
  199. package/lib/tools/communications/outlook.ts +2 -0
  200. package/lib/tools/filesystem/edit-match.test.ts +133 -0
  201. package/lib/tools/filesystem/edit-match.ts +7 -2
  202. package/lib/tools/support/result-refs.test.ts +131 -0
  203. package/lib/tools/support/result-refs.ts +41 -9
  204. package/lib/utils/source-link.test.ts +51 -0
  205. package/lib/utils/source-link.ts +45 -0
  206. package/package.json +1 -1
  207. /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → hwujW4hR1b-r3k5WdMxZO}/_buildManifest.js +0 -0
  208. /package/.next/standalone/.next/static/{bMRK5y3ruT7c3WtBfCQOG → hwujW4hR1b-r3k5WdMxZO}/_ssgManifest.js +0 -0
@@ -21102,506 +21102,110 @@ __exportStar(__webpack_require__(78904), exports);
21102
21102
 
21103
21103
  /***/ }),
21104
21104
 
21105
- /***/ 49585:
21106
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
21107
-
21108
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21109
- /* harmony export */ Ou: () => (/* binding */ StructuredTool),
21110
- /* harmony export */ on: () => (/* binding */ tools_exports),
21111
- /* harmony export */ z6: () => (/* binding */ tool)
21112
- /* harmony export */ });
21113
- /* unused harmony exports BaseToolkit, DynamicStructuredTool, DynamicTool, Tool */
21114
- /* harmony import */ var _virtual_rolldown_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27217);
21115
- /* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(39954);
21116
- /* harmony import */ var _messages_tool_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42512);
21117
- /* harmony import */ var _callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21764);
21118
- /* harmony import */ var _singletons_async_local_storage_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21291);
21119
- /* harmony import */ var _singletons_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55856);
21120
- /* harmony import */ var _runnables_config_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(21436);
21121
- /* harmony import */ var _utils_signal_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7409);
21122
- /* harmony import */ var _utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(30898);
21123
- /* harmony import */ var _utils_json_schema_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(12668);
21124
- /* harmony import */ var _runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(12588);
21125
- /* harmony import */ var _language_models_base_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(51322);
21126
- /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(56862);
21127
- /* harmony import */ var zod_v3__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(67106);
21128
- /* harmony import */ var _cfworker_json_schema__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(55209);
21129
- /* harmony import */ var zod_v4__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(11230);
21130
-
21131
-
21132
-
21133
-
21134
-
21135
-
21136
-
21137
-
21138
-
21105
+ /***/ 59189:
21106
+ /***/ ((__unused_webpack_module, exports) => {
21139
21107
 
21140
21108
 
21109
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
21110
+ exports.seededRandom = seededRandom;
21111
+ /**
21112
+ * Computes a numeric hash from a given string
21113
+ * @param {string} str A value to hash
21114
+ * @returns {number} A numeric hash computed from the given value
21115
+ */
21116
+ function xfnv1a(str) {
21117
+ let h = 2166136261 >>> 0;
21118
+ for (let i = 0; i < str.length; i++) {
21119
+ h ^= str.charCodeAt(i);
21120
+ h = Math.imul(h, 16777619);
21121
+ }
21122
+ return () => h >>> 0;
21123
+ }
21124
+ /**
21125
+ * Initialize a new PRNG using a given seed
21126
+ * @param {number} seed The seed used to initialize the PRNG
21127
+ * @returns {PRNG} A random number generator
21128
+ */
21129
+ function mulberry32(seed) {
21130
+ return () => {
21131
+ let t = (seed += 0x6d2b79f5);
21132
+ t = Math.imul(t ^ (t >>> 15), t | 1);
21133
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
21134
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
21135
+ };
21136
+ }
21137
+ /**
21138
+ * Generates a PRNG using a given seed. When not provided, the seed is randomly generated
21139
+ * @param {string} str A string to derive the seed from
21140
+ * @returns {PRNG} A random number generator correctly seeded
21141
+ */
21142
+ function seededRandom(str) {
21143
+ const seed = str ? xfnv1a(str)() : Math.floor(Math.random() * 10_000_000_000);
21144
+ return mulberry32(seed);
21145
+ }
21141
21146
 
21142
21147
 
21148
+ /***/ }),
21143
21149
 
21150
+ /***/ 60370:
21151
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
21144
21152
 
21145
21153
 
21146
- //#region src/tools/index.ts
21147
- var tools_exports = /* @__PURE__ */ (0,_virtual_rolldown_runtime_js__WEBPACK_IMPORTED_MODULE_0__/* .__exportAll */ .I)({
21148
- BaseToolkit: () => BaseToolkit,
21149
- DynamicStructuredTool: () => DynamicStructuredTool,
21150
- DynamicTool: () => DynamicTool,
21151
- StructuredTool: () => StructuredTool,
21152
- Tool: () => Tool,
21153
- ToolInputParsingException: () => _utils_js__WEBPACK_IMPORTED_MODULE_1__/* .ToolInputParsingException */ .qe,
21154
- isLangChainTool: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isLangChainTool */ .qG,
21155
- isRunnableToolLike: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isRunnableToolLike */ .Lx,
21156
- isStructuredTool: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isStructuredTool */ .Yn,
21157
- isStructuredToolParams: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isStructuredToolParams */ .Am,
21158
- tool: () => tool
21159
- });
21160
- /**
21161
- * Base class for Tools that accept input of any shape defined by a Zod schema.
21162
- */
21163
- var StructuredTool = class extends _language_models_base_js__WEBPACK_IMPORTED_MODULE_9__/* .BaseLangChain */ .ZE {
21164
- /**
21165
- * Optional provider-specific extra fields for the tool.
21166
- *
21167
- * This is used to pass provider-specific configuration that doesn't fit into
21168
- * standard tool fields.
21169
- */
21170
- extras;
21171
- /**
21172
- * Whether to return the tool's output directly.
21173
- *
21174
- * Setting this to true means that after the tool is called,
21175
- * an agent should stop looping.
21176
- */
21177
- returnDirect = false;
21178
- verboseParsingErrors = false;
21179
- get lc_namespace() {
21180
- return ["langchain", "tools"];
21181
- }
21182
- /**
21183
- * The tool response format.
21184
- *
21185
- * If "content" then the output of the tool is interpreted as the contents of a
21186
- * ToolMessage. If "content_and_artifact" then the output is expected to be a
21187
- * two-tuple corresponding to the (content, artifact) of a ToolMessage.
21188
- *
21189
- * @default "content"
21190
- */
21191
- responseFormat = "content";
21192
- /**
21193
- * Default config object for the tool runnable.
21194
- */
21195
- defaultConfig;
21196
- constructor(fields) {
21197
- super(fields ?? {});
21198
- this.verboseParsingErrors = fields?.verboseParsingErrors ?? this.verboseParsingErrors;
21199
- this.responseFormat = fields?.responseFormat ?? this.responseFormat;
21200
- this.defaultConfig = fields?.defaultConfig ?? this.defaultConfig;
21201
- this.metadata = fields?.metadata ?? this.metadata;
21202
- this.extras = fields?.extras ?? this.extras;
21203
- }
21204
- /**
21205
- * Invokes the tool with the provided input and configuration.
21206
- * @param input The input for the tool.
21207
- * @param config Optional configuration for the tool.
21208
- * @returns A Promise that resolves with the tool's output.
21209
- */
21210
- async invoke(input, config) {
21211
- let toolInput;
21212
- let enrichedConfig = (0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .ensureConfig */ .ZI)((0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .mergeConfigs */ .SV)(this.defaultConfig, config));
21213
- if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._isToolCall */ .Ky)(input)) {
21214
- toolInput = input.args;
21215
- enrichedConfig = {
21216
- ...enrichedConfig,
21217
- toolCall: input
21218
- };
21219
- } else toolInput = input;
21220
- return this.call(toolInput, enrichedConfig);
21221
- }
21222
- /**
21223
- * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
21224
- *
21225
- * Calls the tool with the provided argument, configuration, and tags. It
21226
- * parses the input according to the schema, handles any errors, and
21227
- * manages callbacks.
21228
- * @param arg The input argument for the tool.
21229
- * @param configArg Optional configuration or callbacks for the tool.
21230
- * @param tags Optional tags for the tool.
21231
- * @returns A Promise that resolves with a string.
21232
- */
21233
- async call(arg, configArg, tags) {
21234
- const inputForValidation = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._isToolCall */ .Ky)(arg) ? arg.args : arg;
21235
- let parsed;
21236
- if ((0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .isInteropZodSchema */ .c9)(this.schema)) try {
21237
- parsed = await (0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .interopParseAsync */ .hZ)(this.schema, inputForValidation);
21238
- } catch (e) {
21239
- let message = `Received tool input did not match expected schema`;
21240
- if (this.verboseParsingErrors) message = `${message}\nDetails: ${e.message}`;
21241
- if ((0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .isInteropZodError */ .BZ)(e)) message = `${message}\n\n${zod_v4__WEBPACK_IMPORTED_MODULE_13__/* .prettifyError */ .S1(e)}`;
21242
- throw new _utils_js__WEBPACK_IMPORTED_MODULE_1__/* .ToolInputParsingException */ .qe(message, JSON.stringify(arg));
21243
- }
21244
- else {
21245
- const result = (0,_cfworker_json_schema__WEBPACK_IMPORTED_MODULE_11__/* .validate */ .tf)(inputForValidation, this.schema);
21246
- if (!result.valid) {
21247
- let message = `Received tool input did not match expected schema`;
21248
- if (this.verboseParsingErrors) message = `${message}\nDetails: ${result.errors.map((e) => `${e.keywordLocation}: ${e.error}`).join("\n")}`;
21249
- throw new _utils_js__WEBPACK_IMPORTED_MODULE_1__/* .ToolInputParsingException */ .qe(message, JSON.stringify(arg));
21250
- }
21251
- parsed = inputForValidation;
21252
- }
21253
- const config = (0,_callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .parseCallbackConfigArg */ .H_)(configArg);
21254
- const callbackManager_ = _callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .CallbackManager */ .Td.configure(config.callbacks, this.callbacks, config.tags || tags, this.tags, config.metadata, this.metadata, { verbose: this.verbose });
21255
- let toolCallId;
21256
- if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._isToolCall */ .Ky)(arg)) toolCallId = arg.id;
21257
- if (!toolCallId && (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._configHasToolCallId */ .hR)(config)) toolCallId = config.toolCall.id;
21258
- let callbackInput;
21259
- if (typeof inputForValidation === "object" && inputForValidation !== null && !Array.isArray(inputForValidation)) callbackInput = inputForValidation;
21260
- if (!callbackInput) callbackInput = typeof arg === "string" ? arg : JSON.stringify(arg);
21261
- const runManager = await callbackManager_?.handleToolStart(this.toJSON(), callbackInput, config.runId, void 0, void 0, void 0, config.runName, toolCallId);
21262
- delete config.runId;
21263
- let result;
21264
- try {
21265
- const raw = await this._call(parsed, runManager, config);
21266
- result = (0,_runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__/* .isAsyncGenerator */ .aU)(raw) ? await (0,_runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__/* .consumeAsyncGenerator */ .Et)(raw, async (chunk) => {
21267
- try {
21268
- await runManager?.handleToolEvent(chunk);
21269
- } catch (streamError) {
21270
- await runManager?.handleToolError(streamError);
21271
- }
21272
- }) : raw;
21273
- } catch (e) {
21274
- await runManager?.handleToolError(e);
21275
- throw e;
21276
- }
21277
- let content;
21278
- let artifact;
21279
- if (this.responseFormat === "content_and_artifact") {
21280
- if (Array.isArray(result) && result.length === 2) [content, artifact] = result;
21281
- else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.\nResult: ${JSON.stringify(result)}`);
21282
- } else content = result;
21283
- const formattedOutput = _formatToolOutput({
21284
- content,
21285
- artifact,
21286
- toolCallId,
21287
- name: this.name,
21288
- metadata: this.metadata
21289
- });
21290
- await runManager?.handleToolEnd(formattedOutput);
21291
- return formattedOutput;
21292
- }
21293
- };
21294
- /**
21295
- * Base class for Tools that accept input as a string.
21296
- */
21297
- var Tool = class extends StructuredTool {
21298
- schema = zod_v3__WEBPACK_IMPORTED_MODULE_14__/* .object */ .Ik({ input: zod_v3__WEBPACK_IMPORTED_MODULE_14__/* .string */ .Yj().optional() }).transform((obj) => obj.input);
21299
- constructor(fields) {
21300
- super(fields);
21301
- }
21302
- /**
21303
- * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
21304
- *
21305
- * Calls the tool with the provided argument and callbacks. It handles
21306
- * string inputs specifically.
21307
- * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
21308
- * @param callbacks Optional callbacks for the tool.
21309
- * @returns A Promise that resolves with a string.
21310
- */
21311
- call(arg, callbacks) {
21312
- const structuredArg = typeof arg === "string" || arg == null ? { input: arg } : arg;
21313
- return super.call(structuredArg, callbacks);
21314
- }
21315
- };
21316
- /**
21317
- * A tool that can be created dynamically from a function, name, and description.
21318
- */
21319
- var DynamicTool = class extends Tool {
21320
- static lc_name() {
21321
- return "DynamicTool";
21322
- }
21323
- name;
21324
- description;
21325
- func;
21326
- constructor(fields) {
21327
- super(fields);
21328
- this.name = fields.name;
21329
- this.description = fields.description;
21330
- this.func = fields.func;
21331
- this.returnDirect = fields.returnDirect ?? this.returnDirect;
21332
- }
21333
- /**
21334
- * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
21335
- */
21336
- async call(arg, configArg) {
21337
- const config = (0,_callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .parseCallbackConfigArg */ .H_)(configArg);
21338
- if (config.runName === void 0) config.runName = this.name;
21339
- return super.call(arg, config);
21340
- }
21341
- /** @ignore */
21342
- _call(input, runManager, parentConfig) {
21343
- return this.func(input, runManager, parentConfig);
21344
- }
21345
- };
21346
- /**
21347
- * A tool that can be created dynamically from a function, name, and
21348
- * description, designed to work with structured data. It extends the
21349
- * StructuredTool class and overrides the _call method to execute the
21350
- * provided function when the tool is called.
21351
- *
21352
- * Schema can be passed as Zod or JSON schema. The tool will not validate
21353
- * input if JSON schema is passed.
21354
- *
21355
- * @template SchemaT The input schema type for the tool (Zod schema or JSON schema). Defaults to `ToolInputSchemaBase`.
21356
- * @template SchemaOutputT The output type derived from the schema after parsing/validation. Defaults to `ToolInputSchemaOutputType<SchemaT>`.
21357
- * @template SchemaInputT The input type derived from the schema before parsing. Defaults to `ToolInputSchemaInputType<SchemaT>`.
21358
- * @template ToolOutputT The return type of the tool's function. Defaults to `ToolOutputType`.
21359
- * @template NameT The literal type of the tool name (for discriminated union support). Defaults to `string`.
21360
- */
21361
- var DynamicStructuredTool = class extends StructuredTool {
21362
- static lc_name() {
21363
- return "DynamicStructuredTool";
21364
- }
21365
- description;
21366
- func;
21367
- schema;
21368
- constructor(fields) {
21369
- super(fields);
21370
- this.name = fields.name;
21371
- this.description = fields.description;
21372
- this.func = fields.func;
21373
- this.returnDirect = fields.returnDirect ?? this.returnDirect;
21374
- this.schema = fields.schema;
21375
- }
21376
- /**
21377
- * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
21378
- */
21379
- async call(arg, configArg, tags) {
21380
- const config = (0,_callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .parseCallbackConfigArg */ .H_)(configArg);
21381
- if (config.runName === void 0) config.runName = this.name;
21382
- return super.call(arg, config, tags);
21383
- }
21384
- _call(arg, runManager, parentConfig) {
21385
- return this.func(arg, runManager, parentConfig);
21386
- }
21387
- };
21388
- /**
21389
- * Abstract base class for toolkits in LangChain. Toolkits are collections
21390
- * of tools that agents can use. Subclasses must implement the `tools`
21391
- * property to provide the specific tools for the toolkit.
21392
- */
21393
- var BaseToolkit = class {
21394
- getTools() {
21395
- return this.tools;
21396
- }
21397
- };
21398
- function tool(func, fields) {
21399
- const isSimpleStringSchema = (0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .isSimpleStringZodSchema */ .yQ)(fields.schema);
21400
- const isStringJSONSchema = (0,_utils_json_schema_js__WEBPACK_IMPORTED_MODULE_7__/* .validatesOnlyStrings */ .y0)(fields.schema);
21401
- if (!fields.schema || isSimpleStringSchema || isStringJSONSchema) return new DynamicTool({
21402
- ...fields,
21403
- description: fields.description ?? fields.schema?.description ?? `${fields.name} tool`,
21404
- func: async (input, runManager, config) => {
21405
- return new Promise((resolve, reject) => {
21406
- const childConfig = (0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .patchConfig */ .tn)(config, { callbacks: runManager?.getChild() });
21407
- _singletons_async_local_storage_index_js__WEBPACK_IMPORTED_MODULE_4__/* .AsyncLocalStorageProviderSingleton */ .N.runWithConfig((0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .pickRunnableConfigKeys */ .DY)(childConfig), async () => {
21408
- try {
21409
- resolve(func(input, childConfig));
21410
- } catch (e) {
21411
- reject(e);
21412
- }
21413
- });
21414
- });
21415
- }
21416
- });
21417
- const schema = fields.schema;
21418
- const description = fields.description ?? fields.schema.description ?? `${fields.name} tool`;
21419
- return new DynamicStructuredTool({
21420
- ...fields,
21421
- description,
21422
- schema,
21423
- func: async (input, runManager, config) => {
21424
- return new Promise((resolve, reject) => {
21425
- let listener;
21426
- const cleanup = () => {
21427
- if (config?.signal && listener) config.signal.removeEventListener("abort", listener);
21428
- };
21429
- if (config?.signal) {
21430
- listener = () => {
21431
- cleanup();
21432
- reject((0,_utils_signal_js__WEBPACK_IMPORTED_MODULE_15__/* .getAbortSignalError */ .F)(config.signal));
21433
- };
21434
- config.signal.addEventListener("abort", listener, { once: true });
21435
- }
21436
- const childConfig = (0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .patchConfig */ .tn)(config, { callbacks: runManager?.getChild() });
21437
- _singletons_async_local_storage_index_js__WEBPACK_IMPORTED_MODULE_4__/* .AsyncLocalStorageProviderSingleton */ .N.runWithConfig((0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .pickRunnableConfigKeys */ .DY)(childConfig), async () => {
21438
- try {
21439
- const result = await func(input, childConfig);
21440
- if ((0,_runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__/* .isAsyncGenerator */ .aU)(result)) {
21441
- resolve(result);
21442
- return;
21443
- }
21444
- /**
21445
- * If the signal is aborted, we don't want to resolve the promise
21446
- * as the promise is already rejected.
21447
- */
21448
- if (config?.signal?.aborted) {
21449
- cleanup();
21450
- return;
21451
- }
21452
- cleanup();
21453
- resolve(result);
21454
- } catch (e) {
21455
- cleanup();
21456
- reject(e);
21457
- }
21458
- });
21459
- });
21460
- }
21461
- });
21462
- }
21463
- function _isMessageContentBlockShaped(item) {
21464
- return typeof item === "object" && item !== null && "type" in item;
21465
- }
21466
- function _formatToolOutput(params) {
21467
- const { content, artifact, toolCallId, metadata } = params;
21468
- if (toolCallId && !(0,_messages_tool_js__WEBPACK_IMPORTED_MODULE_2__/* .isDirectToolOutput */ .fK)(content)) {
21469
- if (typeof content === "string" || Array.isArray(content) && content.every(_isMessageContentBlockShaped)) return new _messages_tool_js__WEBPACK_IMPORTED_MODULE_2__/* .ToolMessage */ .uf({
21470
- status: "success",
21471
- content,
21472
- artifact,
21473
- tool_call_id: toolCallId,
21474
- name: params.name,
21475
- metadata
21476
- });
21477
- else return new _messages_tool_js__WEBPACK_IMPORTED_MODULE_2__/* .ToolMessage */ .uf({
21478
- status: "success",
21479
- content: _stringify(content),
21480
- artifact,
21481
- tool_call_id: toolCallId,
21482
- name: params.name,
21483
- metadata
21484
- });
21485
- } else return content;
21486
- }
21487
- function _stringify(content) {
21488
- try {
21489
- return JSON.stringify(content) ?? "";
21490
- } catch (_noOp) {
21491
- return `${content}`;
21492
- }
21493
- }
21494
- //#endregion
21495
-
21496
-
21497
- //# sourceMappingURL=index.js.map
21498
-
21499
- /***/ }),
21500
-
21501
- /***/ 59189:
21502
- /***/ ((__unused_webpack_module, exports) => {
21503
-
21504
-
21505
- Object.defineProperty(exports, "__esModule", ({ value: true }));
21506
- exports.seededRandom = seededRandom;
21507
- /**
21508
- * Computes a numeric hash from a given string
21509
- * @param {string} str A value to hash
21510
- * @returns {number} A numeric hash computed from the given value
21511
- */
21512
- function xfnv1a(str) {
21513
- let h = 2166136261 >>> 0;
21514
- for (let i = 0; i < str.length; i++) {
21515
- h ^= str.charCodeAt(i);
21516
- h = Math.imul(h, 16777619);
21517
- }
21518
- return () => h >>> 0;
21519
- }
21520
- /**
21521
- * Initialize a new PRNG using a given seed
21522
- * @param {number} seed The seed used to initialize the PRNG
21523
- * @returns {PRNG} A random number generator
21524
- */
21525
- function mulberry32(seed) {
21526
- return () => {
21527
- let t = (seed += 0x6d2b79f5);
21528
- t = Math.imul(t ^ (t >>> 15), t | 1);
21529
- t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
21530
- return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
21531
- };
21532
- }
21533
- /**
21534
- * Generates a PRNG using a given seed. When not provided, the seed is randomly generated
21535
- * @param {string} str A string to derive the seed from
21536
- * @returns {PRNG} A random number generator correctly seeded
21537
- */
21538
- function seededRandom(str) {
21539
- const seed = str ? xfnv1a(str)() : Math.floor(Math.random() * 10_000_000_000);
21540
- return mulberry32(seed);
21541
- }
21542
-
21543
-
21544
- /***/ }),
21545
-
21546
- /***/ 60370:
21547
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
21548
-
21549
-
21550
- Object.defineProperty(exports, "__esModule", ({ value: true }));
21551
- exports.CronExpressionParser = exports.DayOfWeek = exports.Months = exports.CronUnit = exports.PredefinedExpressions = void 0;
21552
- const CronFieldCollection_1 = __webpack_require__(92974);
21553
- const CronExpression_1 = __webpack_require__(85896);
21554
- const random_1 = __webpack_require__(59189);
21555
- const fields_1 = __webpack_require__(47924);
21556
- var PredefinedExpressions;
21557
- (function (PredefinedExpressions) {
21558
- PredefinedExpressions["@yearly"] = "0 0 0 1 1 *";
21559
- PredefinedExpressions["@annually"] = "0 0 0 1 1 *";
21560
- PredefinedExpressions["@monthly"] = "0 0 0 1 * *";
21561
- PredefinedExpressions["@weekly"] = "0 0 0 * * 0";
21562
- PredefinedExpressions["@daily"] = "0 0 0 * * *";
21563
- PredefinedExpressions["@hourly"] = "0 0 * * * *";
21564
- PredefinedExpressions["@minutely"] = "0 * * * * *";
21565
- PredefinedExpressions["@secondly"] = "* * * * * *";
21566
- PredefinedExpressions["@weekdays"] = "0 0 0 * * 1-5";
21567
- PredefinedExpressions["@weekends"] = "0 0 0 * * 0,6";
21568
- })(PredefinedExpressions || (exports.PredefinedExpressions = PredefinedExpressions = {}));
21569
- var CronUnit;
21570
- (function (CronUnit) {
21571
- CronUnit["Second"] = "Second";
21572
- CronUnit["Minute"] = "Minute";
21573
- CronUnit["Hour"] = "Hour";
21574
- CronUnit["DayOfMonth"] = "DayOfMonth";
21575
- CronUnit["Month"] = "Month";
21576
- CronUnit["DayOfWeek"] = "DayOfWeek";
21577
- })(CronUnit || (exports.CronUnit = CronUnit = {}));
21578
- // these need to be lowercase for the parser to work
21579
- var Months;
21580
- (function (Months) {
21581
- Months[Months["jan"] = 1] = "jan";
21582
- Months[Months["feb"] = 2] = "feb";
21583
- Months[Months["mar"] = 3] = "mar";
21584
- Months[Months["apr"] = 4] = "apr";
21585
- Months[Months["may"] = 5] = "may";
21586
- Months[Months["jun"] = 6] = "jun";
21587
- Months[Months["jul"] = 7] = "jul";
21588
- Months[Months["aug"] = 8] = "aug";
21589
- Months[Months["sep"] = 9] = "sep";
21590
- Months[Months["oct"] = 10] = "oct";
21591
- Months[Months["nov"] = 11] = "nov";
21592
- Months[Months["dec"] = 12] = "dec";
21593
- })(Months || (exports.Months = Months = {}));
21594
- // these need to be lowercase for the parser to work
21595
- var DayOfWeek;
21596
- (function (DayOfWeek) {
21597
- DayOfWeek[DayOfWeek["sun"] = 0] = "sun";
21598
- DayOfWeek[DayOfWeek["mon"] = 1] = "mon";
21599
- DayOfWeek[DayOfWeek["tue"] = 2] = "tue";
21600
- DayOfWeek[DayOfWeek["wed"] = 3] = "wed";
21601
- DayOfWeek[DayOfWeek["thu"] = 4] = "thu";
21602
- DayOfWeek[DayOfWeek["fri"] = 5] = "fri";
21603
- DayOfWeek[DayOfWeek["sat"] = 6] = "sat";
21604
- })(DayOfWeek || (exports.DayOfWeek = DayOfWeek = {}));
21154
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
21155
+ exports.CronExpressionParser = exports.DayOfWeek = exports.Months = exports.CronUnit = exports.PredefinedExpressions = void 0;
21156
+ const CronFieldCollection_1 = __webpack_require__(92974);
21157
+ const CronExpression_1 = __webpack_require__(85896);
21158
+ const random_1 = __webpack_require__(59189);
21159
+ const fields_1 = __webpack_require__(47924);
21160
+ var PredefinedExpressions;
21161
+ (function (PredefinedExpressions) {
21162
+ PredefinedExpressions["@yearly"] = "0 0 0 1 1 *";
21163
+ PredefinedExpressions["@annually"] = "0 0 0 1 1 *";
21164
+ PredefinedExpressions["@monthly"] = "0 0 0 1 * *";
21165
+ PredefinedExpressions["@weekly"] = "0 0 0 * * 0";
21166
+ PredefinedExpressions["@daily"] = "0 0 0 * * *";
21167
+ PredefinedExpressions["@hourly"] = "0 0 * * * *";
21168
+ PredefinedExpressions["@minutely"] = "0 * * * * *";
21169
+ PredefinedExpressions["@secondly"] = "* * * * * *";
21170
+ PredefinedExpressions["@weekdays"] = "0 0 0 * * 1-5";
21171
+ PredefinedExpressions["@weekends"] = "0 0 0 * * 0,6";
21172
+ })(PredefinedExpressions || (exports.PredefinedExpressions = PredefinedExpressions = {}));
21173
+ var CronUnit;
21174
+ (function (CronUnit) {
21175
+ CronUnit["Second"] = "Second";
21176
+ CronUnit["Minute"] = "Minute";
21177
+ CronUnit["Hour"] = "Hour";
21178
+ CronUnit["DayOfMonth"] = "DayOfMonth";
21179
+ CronUnit["Month"] = "Month";
21180
+ CronUnit["DayOfWeek"] = "DayOfWeek";
21181
+ })(CronUnit || (exports.CronUnit = CronUnit = {}));
21182
+ // these need to be lowercase for the parser to work
21183
+ var Months;
21184
+ (function (Months) {
21185
+ Months[Months["jan"] = 1] = "jan";
21186
+ Months[Months["feb"] = 2] = "feb";
21187
+ Months[Months["mar"] = 3] = "mar";
21188
+ Months[Months["apr"] = 4] = "apr";
21189
+ Months[Months["may"] = 5] = "may";
21190
+ Months[Months["jun"] = 6] = "jun";
21191
+ Months[Months["jul"] = 7] = "jul";
21192
+ Months[Months["aug"] = 8] = "aug";
21193
+ Months[Months["sep"] = 9] = "sep";
21194
+ Months[Months["oct"] = 10] = "oct";
21195
+ Months[Months["nov"] = 11] = "nov";
21196
+ Months[Months["dec"] = 12] = "dec";
21197
+ })(Months || (exports.Months = Months = {}));
21198
+ // these need to be lowercase for the parser to work
21199
+ var DayOfWeek;
21200
+ (function (DayOfWeek) {
21201
+ DayOfWeek[DayOfWeek["sun"] = 0] = "sun";
21202
+ DayOfWeek[DayOfWeek["mon"] = 1] = "mon";
21203
+ DayOfWeek[DayOfWeek["tue"] = 2] = "tue";
21204
+ DayOfWeek[DayOfWeek["wed"] = 3] = "wed";
21205
+ DayOfWeek[DayOfWeek["thu"] = 4] = "thu";
21206
+ DayOfWeek[DayOfWeek["fri"] = 5] = "fri";
21207
+ DayOfWeek[DayOfWeek["sat"] = 6] = "sat";
21208
+ })(DayOfWeek || (exports.DayOfWeek = DayOfWeek = {}));
21605
21209
  /**
21606
21210
  * Static class that parses a cron expression and returns a CronExpression object.
21607
21211
  * @static
@@ -27457,7 +27061,7 @@ var testing_exports = /* @__PURE__ */ (0,runtime/* __exportAll */.I)({
27457
27061
 
27458
27062
  //# sourceMappingURL=index.js.map
27459
27063
  // EXTERNAL MODULE: ./node_modules/@langchain/core/dist/tools/index.js
27460
- var tools = __webpack_require__(49585);
27064
+ var tools = __webpack_require__(71966);
27461
27065
  ;// ./node_modules/@langchain/core/dist/tracers/run_collector.js
27462
27066
 
27463
27067
 
@@ -31899,40 +31503,436 @@ const MIN_MINUTE = 0;
31899
31503
  const MAX_MINUTE = 59;
31900
31504
  const MINUTE_CHARS = Object.freeze([]);
31901
31505
  /**
31902
- * Represents the "second" field within a cron expression.
31903
- * @class CronSecond
31904
- * @extends CronField
31905
- */
31906
- class CronMinute extends CronField_1.CronField {
31907
- static get min() {
31908
- return MIN_MINUTE;
31909
- }
31910
- static get max() {
31911
- return MAX_MINUTE;
31912
- }
31913
- static get chars() {
31914
- return MINUTE_CHARS;
31915
- }
31916
- /**
31917
- * CronSecond constructor. Initializes the "second" field with the provided values.
31918
- * @param {SixtyRange[]} values - Values for the "second" field
31919
- * @param {CronFieldOptions} [options] - Options provided by the parser
31920
- */
31921
- constructor(values, options) {
31922
- super(values, options);
31923
- this.validate();
31924
- }
31925
- /**
31926
- * Returns an array of allowed values for the "second" field.
31927
- * @returns {SixtyRange[]}
31928
- */
31929
- get values() {
31930
- return super.values;
31931
- }
31506
+ * Represents the "second" field within a cron expression.
31507
+ * @class CronSecond
31508
+ * @extends CronField
31509
+ */
31510
+ class CronMinute extends CronField_1.CronField {
31511
+ static get min() {
31512
+ return MIN_MINUTE;
31513
+ }
31514
+ static get max() {
31515
+ return MAX_MINUTE;
31516
+ }
31517
+ static get chars() {
31518
+ return MINUTE_CHARS;
31519
+ }
31520
+ /**
31521
+ * CronSecond constructor. Initializes the "second" field with the provided values.
31522
+ * @param {SixtyRange[]} values - Values for the "second" field
31523
+ * @param {CronFieldOptions} [options] - Options provided by the parser
31524
+ */
31525
+ constructor(values, options) {
31526
+ super(values, options);
31527
+ this.validate();
31528
+ }
31529
+ /**
31530
+ * Returns an array of allowed values for the "second" field.
31531
+ * @returns {SixtyRange[]}
31532
+ */
31533
+ get values() {
31534
+ return super.values;
31535
+ }
31536
+ }
31537
+ exports.CronMinute = CronMinute;
31538
+
31539
+
31540
+ /***/ }),
31541
+
31542
+ /***/ 71966:
31543
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
31544
+
31545
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31546
+ /* harmony export */ Ou: () => (/* binding */ StructuredTool),
31547
+ /* harmony export */ on: () => (/* binding */ tools_exports),
31548
+ /* harmony export */ z6: () => (/* binding */ tool)
31549
+ /* harmony export */ });
31550
+ /* unused harmony exports BaseToolkit, DynamicStructuredTool, DynamicTool, Tool */
31551
+ /* harmony import */ var _virtual_rolldown_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27217);
31552
+ /* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(39954);
31553
+ /* harmony import */ var _messages_tool_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42512);
31554
+ /* harmony import */ var _callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21764);
31555
+ /* harmony import */ var _singletons_async_local_storage_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21291);
31556
+ /* harmony import */ var _singletons_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55856);
31557
+ /* harmony import */ var _runnables_config_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(21436);
31558
+ /* harmony import */ var _utils_signal_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7409);
31559
+ /* harmony import */ var _utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(30898);
31560
+ /* harmony import */ var _utils_json_schema_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(12668);
31561
+ /* harmony import */ var _runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(12588);
31562
+ /* harmony import */ var _language_models_base_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(51322);
31563
+ /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(56862);
31564
+ /* harmony import */ var zod_v3__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(67106);
31565
+ /* harmony import */ var _cfworker_json_schema__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(55209);
31566
+ /* harmony import */ var zod_v4__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(11230);
31567
+
31568
+
31569
+
31570
+
31571
+
31572
+
31573
+
31574
+
31575
+
31576
+
31577
+
31578
+
31579
+
31580
+
31581
+
31582
+
31583
+ //#region src/tools/index.ts
31584
+ var tools_exports = /* @__PURE__ */ (0,_virtual_rolldown_runtime_js__WEBPACK_IMPORTED_MODULE_0__/* .__exportAll */ .I)({
31585
+ BaseToolkit: () => BaseToolkit,
31586
+ DynamicStructuredTool: () => DynamicStructuredTool,
31587
+ DynamicTool: () => DynamicTool,
31588
+ StructuredTool: () => StructuredTool,
31589
+ Tool: () => Tool,
31590
+ ToolInputParsingException: () => _utils_js__WEBPACK_IMPORTED_MODULE_1__/* .ToolInputParsingException */ .qe,
31591
+ isLangChainTool: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isLangChainTool */ .qG,
31592
+ isRunnableToolLike: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isRunnableToolLike */ .Lx,
31593
+ isStructuredTool: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isStructuredTool */ .Yn,
31594
+ isStructuredToolParams: () => _types_js__WEBPACK_IMPORTED_MODULE_10__/* .isStructuredToolParams */ .Am,
31595
+ tool: () => tool
31596
+ });
31597
+ /**
31598
+ * Base class for Tools that accept input of any shape defined by a Zod schema.
31599
+ */
31600
+ var StructuredTool = class extends _language_models_base_js__WEBPACK_IMPORTED_MODULE_9__/* .BaseLangChain */ .ZE {
31601
+ /**
31602
+ * Optional provider-specific extra fields for the tool.
31603
+ *
31604
+ * This is used to pass provider-specific configuration that doesn't fit into
31605
+ * standard tool fields.
31606
+ */
31607
+ extras;
31608
+ /**
31609
+ * Whether to return the tool's output directly.
31610
+ *
31611
+ * Setting this to true means that after the tool is called,
31612
+ * an agent should stop looping.
31613
+ */
31614
+ returnDirect = false;
31615
+ verboseParsingErrors = false;
31616
+ get lc_namespace() {
31617
+ return ["langchain", "tools"];
31618
+ }
31619
+ /**
31620
+ * The tool response format.
31621
+ *
31622
+ * If "content" then the output of the tool is interpreted as the contents of a
31623
+ * ToolMessage. If "content_and_artifact" then the output is expected to be a
31624
+ * two-tuple corresponding to the (content, artifact) of a ToolMessage.
31625
+ *
31626
+ * @default "content"
31627
+ */
31628
+ responseFormat = "content";
31629
+ /**
31630
+ * Default config object for the tool runnable.
31631
+ */
31632
+ defaultConfig;
31633
+ constructor(fields) {
31634
+ super(fields ?? {});
31635
+ this.verboseParsingErrors = fields?.verboseParsingErrors ?? this.verboseParsingErrors;
31636
+ this.responseFormat = fields?.responseFormat ?? this.responseFormat;
31637
+ this.defaultConfig = fields?.defaultConfig ?? this.defaultConfig;
31638
+ this.metadata = fields?.metadata ?? this.metadata;
31639
+ this.extras = fields?.extras ?? this.extras;
31640
+ }
31641
+ /**
31642
+ * Invokes the tool with the provided input and configuration.
31643
+ * @param input The input for the tool.
31644
+ * @param config Optional configuration for the tool.
31645
+ * @returns A Promise that resolves with the tool's output.
31646
+ */
31647
+ async invoke(input, config) {
31648
+ let toolInput;
31649
+ let enrichedConfig = (0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .ensureConfig */ .ZI)((0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .mergeConfigs */ .SV)(this.defaultConfig, config));
31650
+ if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._isToolCall */ .Ky)(input)) {
31651
+ toolInput = input.args;
31652
+ enrichedConfig = {
31653
+ ...enrichedConfig,
31654
+ toolCall: input
31655
+ };
31656
+ } else toolInput = input;
31657
+ return this.call(toolInput, enrichedConfig);
31658
+ }
31659
+ /**
31660
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
31661
+ *
31662
+ * Calls the tool with the provided argument, configuration, and tags. It
31663
+ * parses the input according to the schema, handles any errors, and
31664
+ * manages callbacks.
31665
+ * @param arg The input argument for the tool.
31666
+ * @param configArg Optional configuration or callbacks for the tool.
31667
+ * @param tags Optional tags for the tool.
31668
+ * @returns A Promise that resolves with a string.
31669
+ */
31670
+ async call(arg, configArg, tags) {
31671
+ const inputForValidation = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._isToolCall */ .Ky)(arg) ? arg.args : arg;
31672
+ let parsed;
31673
+ if ((0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .isInteropZodSchema */ .c9)(this.schema)) try {
31674
+ parsed = await (0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .interopParseAsync */ .hZ)(this.schema, inputForValidation);
31675
+ } catch (e) {
31676
+ let message = `Received tool input did not match expected schema`;
31677
+ if (this.verboseParsingErrors) message = `${message}\nDetails: ${e.message}`;
31678
+ if ((0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .isInteropZodError */ .BZ)(e)) message = `${message}\n\n${zod_v4__WEBPACK_IMPORTED_MODULE_13__/* .prettifyError */ .S1(e)}`;
31679
+ throw new _utils_js__WEBPACK_IMPORTED_MODULE_1__/* .ToolInputParsingException */ .qe(message, JSON.stringify(arg));
31680
+ }
31681
+ else {
31682
+ const result = (0,_cfworker_json_schema__WEBPACK_IMPORTED_MODULE_11__/* .validate */ .tf)(inputForValidation, this.schema);
31683
+ if (!result.valid) {
31684
+ let message = `Received tool input did not match expected schema`;
31685
+ if (this.verboseParsingErrors) message = `${message}\nDetails: ${result.errors.map((e) => `${e.keywordLocation}: ${e.error}`).join("\n")}`;
31686
+ throw new _utils_js__WEBPACK_IMPORTED_MODULE_1__/* .ToolInputParsingException */ .qe(message, JSON.stringify(arg));
31687
+ }
31688
+ parsed = inputForValidation;
31689
+ }
31690
+ const config = (0,_callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .parseCallbackConfigArg */ .H_)(configArg);
31691
+ const callbackManager_ = _callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .CallbackManager */ .Td.configure(config.callbacks, this.callbacks, config.tags || tags, this.tags, config.metadata, this.metadata, { verbose: this.verbose });
31692
+ let toolCallId;
31693
+ if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._isToolCall */ .Ky)(arg)) toolCallId = arg.id;
31694
+ if (!toolCallId && (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__/* ._configHasToolCallId */ .hR)(config)) toolCallId = config.toolCall.id;
31695
+ let callbackInput;
31696
+ if (typeof inputForValidation === "object" && inputForValidation !== null && !Array.isArray(inputForValidation)) callbackInput = inputForValidation;
31697
+ if (!callbackInput) callbackInput = typeof arg === "string" ? arg : JSON.stringify(arg);
31698
+ const runManager = await callbackManager_?.handleToolStart(this.toJSON(), callbackInput, config.runId, void 0, void 0, void 0, config.runName, toolCallId);
31699
+ delete config.runId;
31700
+ let result;
31701
+ try {
31702
+ const raw = await this._call(parsed, runManager, config);
31703
+ result = (0,_runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__/* .isAsyncGenerator */ .aU)(raw) ? await (0,_runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__/* .consumeAsyncGenerator */ .Et)(raw, async (chunk) => {
31704
+ try {
31705
+ await runManager?.handleToolEvent(chunk);
31706
+ } catch (streamError) {
31707
+ await runManager?.handleToolError(streamError);
31708
+ }
31709
+ }) : raw;
31710
+ } catch (e) {
31711
+ await runManager?.handleToolError(e);
31712
+ throw e;
31713
+ }
31714
+ let content;
31715
+ let artifact;
31716
+ if (this.responseFormat === "content_and_artifact") {
31717
+ if (Array.isArray(result) && result.length === 2) [content, artifact] = result;
31718
+ else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.\nResult: ${JSON.stringify(result)}`);
31719
+ } else content = result;
31720
+ const formattedOutput = _formatToolOutput({
31721
+ content,
31722
+ artifact,
31723
+ toolCallId,
31724
+ name: this.name,
31725
+ metadata: this.metadata
31726
+ });
31727
+ await runManager?.handleToolEnd(formattedOutput);
31728
+ return formattedOutput;
31729
+ }
31730
+ };
31731
+ /**
31732
+ * Base class for Tools that accept input as a string.
31733
+ */
31734
+ var Tool = class extends StructuredTool {
31735
+ schema = zod_v3__WEBPACK_IMPORTED_MODULE_14__/* .object */ .Ik({ input: zod_v3__WEBPACK_IMPORTED_MODULE_14__/* .string */ .Yj().optional() }).transform((obj) => obj.input);
31736
+ constructor(fields) {
31737
+ super(fields);
31738
+ }
31739
+ /**
31740
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
31741
+ *
31742
+ * Calls the tool with the provided argument and callbacks. It handles
31743
+ * string inputs specifically.
31744
+ * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.
31745
+ * @param callbacks Optional callbacks for the tool.
31746
+ * @returns A Promise that resolves with a string.
31747
+ */
31748
+ call(arg, callbacks) {
31749
+ const structuredArg = typeof arg === "string" || arg == null ? { input: arg } : arg;
31750
+ return super.call(structuredArg, callbacks);
31751
+ }
31752
+ };
31753
+ /**
31754
+ * A tool that can be created dynamically from a function, name, and description.
31755
+ */
31756
+ var DynamicTool = class extends Tool {
31757
+ static lc_name() {
31758
+ return "DynamicTool";
31759
+ }
31760
+ name;
31761
+ description;
31762
+ func;
31763
+ constructor(fields) {
31764
+ super(fields);
31765
+ this.name = fields.name;
31766
+ this.description = fields.description;
31767
+ this.func = fields.func;
31768
+ this.returnDirect = fields.returnDirect ?? this.returnDirect;
31769
+ }
31770
+ /**
31771
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
31772
+ */
31773
+ async call(arg, configArg) {
31774
+ const config = (0,_callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .parseCallbackConfigArg */ .H_)(configArg);
31775
+ if (config.runName === void 0) config.runName = this.name;
31776
+ return super.call(arg, config);
31777
+ }
31778
+ /** @ignore */
31779
+ _call(input, runManager, parentConfig) {
31780
+ return this.func(input, runManager, parentConfig);
31781
+ }
31782
+ };
31783
+ /**
31784
+ * A tool that can be created dynamically from a function, name, and
31785
+ * description, designed to work with structured data. It extends the
31786
+ * StructuredTool class and overrides the _call method to execute the
31787
+ * provided function when the tool is called.
31788
+ *
31789
+ * Schema can be passed as Zod or JSON schema. The tool will not validate
31790
+ * input if JSON schema is passed.
31791
+ *
31792
+ * @template SchemaT The input schema type for the tool (Zod schema or JSON schema). Defaults to `ToolInputSchemaBase`.
31793
+ * @template SchemaOutputT The output type derived from the schema after parsing/validation. Defaults to `ToolInputSchemaOutputType<SchemaT>`.
31794
+ * @template SchemaInputT The input type derived from the schema before parsing. Defaults to `ToolInputSchemaInputType<SchemaT>`.
31795
+ * @template ToolOutputT The return type of the tool's function. Defaults to `ToolOutputType`.
31796
+ * @template NameT The literal type of the tool name (for discriminated union support). Defaults to `string`.
31797
+ */
31798
+ var DynamicStructuredTool = class extends StructuredTool {
31799
+ static lc_name() {
31800
+ return "DynamicStructuredTool";
31801
+ }
31802
+ description;
31803
+ func;
31804
+ schema;
31805
+ constructor(fields) {
31806
+ super(fields);
31807
+ this.name = fields.name;
31808
+ this.description = fields.description;
31809
+ this.func = fields.func;
31810
+ this.returnDirect = fields.returnDirect ?? this.returnDirect;
31811
+ this.schema = fields.schema;
31812
+ }
31813
+ /**
31814
+ * @deprecated Use .invoke() instead. Will be removed in 0.3.0.
31815
+ */
31816
+ async call(arg, configArg, tags) {
31817
+ const config = (0,_callbacks_manager_js__WEBPACK_IMPORTED_MODULE_3__/* .parseCallbackConfigArg */ .H_)(configArg);
31818
+ if (config.runName === void 0) config.runName = this.name;
31819
+ return super.call(arg, config, tags);
31820
+ }
31821
+ _call(arg, runManager, parentConfig) {
31822
+ return this.func(arg, runManager, parentConfig);
31823
+ }
31824
+ };
31825
+ /**
31826
+ * Abstract base class for toolkits in LangChain. Toolkits are collections
31827
+ * of tools that agents can use. Subclasses must implement the `tools`
31828
+ * property to provide the specific tools for the toolkit.
31829
+ */
31830
+ var BaseToolkit = class {
31831
+ getTools() {
31832
+ return this.tools;
31833
+ }
31834
+ };
31835
+ function tool(func, fields) {
31836
+ const isSimpleStringSchema = (0,_utils_types_zod_js__WEBPACK_IMPORTED_MODULE_12__/* .isSimpleStringZodSchema */ .yQ)(fields.schema);
31837
+ const isStringJSONSchema = (0,_utils_json_schema_js__WEBPACK_IMPORTED_MODULE_7__/* .validatesOnlyStrings */ .y0)(fields.schema);
31838
+ if (!fields.schema || isSimpleStringSchema || isStringJSONSchema) return new DynamicTool({
31839
+ ...fields,
31840
+ description: fields.description ?? fields.schema?.description ?? `${fields.name} tool`,
31841
+ func: async (input, runManager, config) => {
31842
+ return new Promise((resolve, reject) => {
31843
+ const childConfig = (0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .patchConfig */ .tn)(config, { callbacks: runManager?.getChild() });
31844
+ _singletons_async_local_storage_index_js__WEBPACK_IMPORTED_MODULE_4__/* .AsyncLocalStorageProviderSingleton */ .N.runWithConfig((0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .pickRunnableConfigKeys */ .DY)(childConfig), async () => {
31845
+ try {
31846
+ resolve(func(input, childConfig));
31847
+ } catch (e) {
31848
+ reject(e);
31849
+ }
31850
+ });
31851
+ });
31852
+ }
31853
+ });
31854
+ const schema = fields.schema;
31855
+ const description = fields.description ?? fields.schema.description ?? `${fields.name} tool`;
31856
+ return new DynamicStructuredTool({
31857
+ ...fields,
31858
+ description,
31859
+ schema,
31860
+ func: async (input, runManager, config) => {
31861
+ return new Promise((resolve, reject) => {
31862
+ let listener;
31863
+ const cleanup = () => {
31864
+ if (config?.signal && listener) config.signal.removeEventListener("abort", listener);
31865
+ };
31866
+ if (config?.signal) {
31867
+ listener = () => {
31868
+ cleanup();
31869
+ reject((0,_utils_signal_js__WEBPACK_IMPORTED_MODULE_15__/* .getAbortSignalError */ .F)(config.signal));
31870
+ };
31871
+ config.signal.addEventListener("abort", listener, { once: true });
31872
+ }
31873
+ const childConfig = (0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .patchConfig */ .tn)(config, { callbacks: runManager?.getChild() });
31874
+ _singletons_async_local_storage_index_js__WEBPACK_IMPORTED_MODULE_4__/* .AsyncLocalStorageProviderSingleton */ .N.runWithConfig((0,_runnables_config_js__WEBPACK_IMPORTED_MODULE_6__/* .pickRunnableConfigKeys */ .DY)(childConfig), async () => {
31875
+ try {
31876
+ const result = await func(input, childConfig);
31877
+ if ((0,_runnables_iter_js__WEBPACK_IMPORTED_MODULE_8__/* .isAsyncGenerator */ .aU)(result)) {
31878
+ resolve(result);
31879
+ return;
31880
+ }
31881
+ /**
31882
+ * If the signal is aborted, we don't want to resolve the promise
31883
+ * as the promise is already rejected.
31884
+ */
31885
+ if (config?.signal?.aborted) {
31886
+ cleanup();
31887
+ return;
31888
+ }
31889
+ cleanup();
31890
+ resolve(result);
31891
+ } catch (e) {
31892
+ cleanup();
31893
+ reject(e);
31894
+ }
31895
+ });
31896
+ });
31897
+ }
31898
+ });
31932
31899
  }
31933
- exports.CronMinute = CronMinute;
31900
+ function _isMessageContentBlockShaped(item) {
31901
+ return typeof item === "object" && item !== null && "type" in item;
31902
+ }
31903
+ function _formatToolOutput(params) {
31904
+ const { content, artifact, toolCallId, metadata } = params;
31905
+ if (toolCallId && !(0,_messages_tool_js__WEBPACK_IMPORTED_MODULE_2__/* .isDirectToolOutput */ .fK)(content)) {
31906
+ if (typeof content === "string" || Array.isArray(content) && content.every(_isMessageContentBlockShaped)) return new _messages_tool_js__WEBPACK_IMPORTED_MODULE_2__/* .ToolMessage */ .uf({
31907
+ status: "success",
31908
+ content,
31909
+ artifact,
31910
+ tool_call_id: toolCallId,
31911
+ name: params.name,
31912
+ metadata
31913
+ });
31914
+ else return new _messages_tool_js__WEBPACK_IMPORTED_MODULE_2__/* .ToolMessage */ .uf({
31915
+ status: "success",
31916
+ content: _stringify(content),
31917
+ artifact,
31918
+ tool_call_id: toolCallId,
31919
+ name: params.name,
31920
+ metadata
31921
+ });
31922
+ } else return content;
31923
+ }
31924
+ function _stringify(content) {
31925
+ try {
31926
+ return JSON.stringify(content) ?? "";
31927
+ } catch (_noOp) {
31928
+ return `${content}`;
31929
+ }
31930
+ }
31931
+ //#endregion
31934
31932
 
31935
31933
 
31934
+ //# sourceMappingURL=index.js.map
31935
+
31936
31936
  /***/ }),
31937
31937
 
31938
31938
  /***/ 76835: