@robota-sdk/agent-core 3.0.0-beta.9 → 3.0.0-beta.90

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 (557) hide show
  1. package/CHANGELOG.md +1083 -0
  2. package/LICENSE +661 -21
  3. package/README.md +261 -50
  4. package/dist/browser/bounded-output-BdWv9SX3.js +2 -0
  5. package/dist/browser/bounded-output-BdWv9SX3.js.map +1 -0
  6. package/dist/browser/command-executor-DIXaSMrr.js +2 -0
  7. package/dist/browser/command-executor-DIXaSMrr.js.map +1 -0
  8. package/dist/browser/http-executor-B4YgCJg7.js +2 -0
  9. package/dist/browser/http-executor-B4YgCJg7.js.map +1 -0
  10. package/dist/browser/index.d.ts +6834 -3348
  11. package/dist/browser/index.d.ts.map +1 -0
  12. package/dist/browser/index.js +14 -5
  13. package/dist/browser/index.js.map +1 -0
  14. package/dist/browser/verdict-decoder-Dz_rjoIZ.js +2 -0
  15. package/dist/browser/verdict-decoder-Dz_rjoIZ.js.map +1 -0
  16. package/dist/node/bounded-output-BdWv9SX3.js +2 -0
  17. package/dist/node/bounded-output-BdWv9SX3.js.map +1 -0
  18. package/dist/node/command-executor-D_UBZHxh.js +2 -0
  19. package/dist/node/command-executor-D_UBZHxh.js.map +1 -0
  20. package/dist/node/command-executor-wBgBdWXr.cjs +1 -0
  21. package/dist/node/http-executor-ADn4locH.js +2 -0
  22. package/dist/node/http-executor-ADn4locH.js.map +1 -0
  23. package/dist/node/http-executor-CeAAZotH.cjs +1 -0
  24. package/dist/node/index-CagopdzH.d.cts +7393 -0
  25. package/dist/node/index-CagopdzH.d.cts.map +1 -0
  26. package/dist/node/index-CjyNzgQN.d.ts +7393 -0
  27. package/dist/node/index-CjyNzgQN.d.ts.map +1 -0
  28. package/dist/node/index.cjs +13 -5
  29. package/dist/node/index.d.cts +3 -4238
  30. package/dist/node/index.d.ts +3 -4238
  31. package/dist/node/index.js +14 -5
  32. package/dist/node/index.js.map +1 -0
  33. package/dist/node/node.cjs +1 -0
  34. package/dist/node/node.d.cts +247 -0
  35. package/dist/node/node.d.cts.map +1 -0
  36. package/dist/node/node.d.ts +247 -0
  37. package/dist/node/node.d.ts.map +1 -0
  38. package/dist/node/node.js +2 -0
  39. package/dist/node/node.js.map +1 -0
  40. package/dist/node/project-tool-schema-DrDjGKnH.cjs +1 -0
  41. package/dist/node/project-tool-schema-_UKfY7yO.js +2 -0
  42. package/dist/node/project-tool-schema-_UKfY7yO.js.map +1 -0
  43. package/dist/node/rolldown-runtime-DK3Fl9T5.js +1 -0
  44. package/dist/node/rolldown-runtime-DWNI8pZO.cjs +1 -0
  45. package/dist/node/testing/index.cjs +1 -0
  46. package/dist/node/testing/index.d.cts +96 -0
  47. package/dist/node/testing/index.d.cts.map +1 -0
  48. package/dist/node/testing/index.d.ts +96 -0
  49. package/dist/node/testing/index.d.ts.map +1 -0
  50. package/dist/node/testing/index.js +2 -0
  51. package/dist/node/testing/index.js.map +1 -0
  52. package/dist/node/types-Ge2XB-y-.d.cts +334 -0
  53. package/dist/node/types-Ge2XB-y-.d.cts.map +1 -0
  54. package/dist/node/types-Ge2XB-y-.d.ts +334 -0
  55. package/dist/node/types-Ge2XB-y-.d.ts.map +1 -0
  56. package/dist/node/verdict-decoder-DQqwwDE7.cjs +1 -0
  57. package/dist/node/verdict-decoder-Dz_rjoIZ.js +2 -0
  58. package/dist/node/verdict-decoder-Dz_rjoIZ.js.map +1 -0
  59. package/package.json +103 -33
  60. package/dist/abstracts/abstract-agent.d.ts +0 -56
  61. package/dist/abstracts/abstract-agent.d.ts.map +0 -1
  62. package/dist/abstracts/abstract-agent.js +0 -55
  63. package/dist/abstracts/abstract-agent.js.map +0 -1
  64. package/dist/abstracts/abstract-ai-provider.d.ts +0 -187
  65. package/dist/abstracts/abstract-ai-provider.d.ts.map +0 -1
  66. package/dist/abstracts/abstract-ai-provider.js +0 -252
  67. package/dist/abstracts/abstract-ai-provider.js.map +0 -1
  68. package/dist/abstracts/abstract-executor.d.ts +0 -110
  69. package/dist/abstracts/abstract-executor.d.ts.map +0 -1
  70. package/dist/abstracts/abstract-executor.js +0 -156
  71. package/dist/abstracts/abstract-executor.js.map +0 -1
  72. package/dist/abstracts/abstract-manager.d.ts +0 -42
  73. package/dist/abstracts/abstract-manager.d.ts.map +0 -1
  74. package/dist/abstracts/abstract-manager.js +0 -49
  75. package/dist/abstracts/abstract-manager.js.map +0 -1
  76. package/dist/abstracts/abstract-module.d.ts +0 -365
  77. package/dist/abstracts/abstract-module.d.ts.map +0 -1
  78. package/dist/abstracts/abstract-module.js +0 -474
  79. package/dist/abstracts/abstract-module.js.map +0 -1
  80. package/dist/abstracts/abstract-plugin.d.ts +0 -369
  81. package/dist/abstracts/abstract-plugin.d.ts.map +0 -1
  82. package/dist/abstracts/abstract-plugin.js +0 -258
  83. package/dist/abstracts/abstract-plugin.js.map +0 -1
  84. package/dist/abstracts/abstract-tool.d.ts +0 -175
  85. package/dist/abstracts/abstract-tool.d.ts.map +0 -1
  86. package/dist/abstracts/abstract-tool.js +0 -140
  87. package/dist/abstracts/abstract-tool.js.map +0 -1
  88. package/dist/abstracts/abstract-workflow-converter.d.ts +0 -136
  89. package/dist/abstracts/abstract-workflow-converter.d.ts.map +0 -1
  90. package/dist/abstracts/abstract-workflow-converter.js +0 -252
  91. package/dist/abstracts/abstract-workflow-converter.js.map +0 -1
  92. package/dist/abstracts/abstract-workflow-validator.d.ts +0 -203
  93. package/dist/abstracts/abstract-workflow-validator.d.ts.map +0 -1
  94. package/dist/abstracts/abstract-workflow-validator.js +0 -447
  95. package/dist/abstracts/abstract-workflow-validator.js.map +0 -1
  96. package/dist/abstracts/index.d.ts +0 -6
  97. package/dist/abstracts/index.d.ts.map +0 -1
  98. package/dist/abstracts/index.js +0 -9
  99. package/dist/abstracts/index.js.map +0 -1
  100. package/dist/agents/constants.d.ts +0 -23
  101. package/dist/agents/constants.d.ts.map +0 -1
  102. package/dist/agents/constants.js +0 -22
  103. package/dist/agents/constants.js.map +0 -1
  104. package/dist/agents/index.d.ts +0 -1
  105. package/dist/agents/index.d.ts.map +0 -1
  106. package/dist/agents/index.js +0 -4
  107. package/dist/agents/index.js.map +0 -1
  108. package/dist/agents/robota.test.d.ts +0 -2
  109. package/dist/agents/robota.test.d.ts.map +0 -1
  110. package/dist/agents/robota.test.js +0 -416
  111. package/dist/agents/robota.test.js.map +0 -1
  112. package/dist/browser/builtin-templates.json +0 -107
  113. package/dist/core/robota.d.ts +0 -694
  114. package/dist/core/robota.d.ts.map +0 -1
  115. package/dist/core/robota.js +0 -1277
  116. package/dist/core/robota.js.map +0 -1
  117. package/dist/executors/local-executor.d.ts +0 -96
  118. package/dist/executors/local-executor.d.ts.map +0 -1
  119. package/dist/executors/local-executor.js +0 -197
  120. package/dist/executors/local-executor.js.map +0 -1
  121. package/dist/executors/local-executor.test.d.ts +0 -2
  122. package/dist/executors/local-executor.test.d.ts.map +0 -1
  123. package/dist/executors/local-executor.test.js +0 -192
  124. package/dist/executors/local-executor.test.js.map +0 -1
  125. package/dist/index.d.ts +0 -274
  126. package/dist/index.d.ts.map +0 -1
  127. package/dist/index.js +0 -235
  128. package/dist/index.js.map +0 -1
  129. package/dist/interfaces/agent.d.ts +0 -198
  130. package/dist/interfaces/agent.d.ts.map +0 -1
  131. package/dist/interfaces/agent.js +0 -2
  132. package/dist/interfaces/agent.js.map +0 -1
  133. package/dist/interfaces/event-service.d.ts +0 -79
  134. package/dist/interfaces/event-service.d.ts.map +0 -1
  135. package/dist/interfaces/event-service.js +0 -2
  136. package/dist/interfaces/event-service.js.map +0 -1
  137. package/dist/interfaces/executor.d.ts +0 -128
  138. package/dist/interfaces/executor.d.ts.map +0 -1
  139. package/dist/interfaces/executor.js +0 -2
  140. package/dist/interfaces/executor.js.map +0 -1
  141. package/dist/interfaces/history-module.d.ts +0 -19
  142. package/dist/interfaces/history-module.d.ts.map +0 -1
  143. package/dist/interfaces/history-module.js +0 -2
  144. package/dist/interfaces/history-module.js.map +0 -1
  145. package/dist/interfaces/index.d.ts +0 -13
  146. package/dist/interfaces/index.d.ts.map +0 -1
  147. package/dist/interfaces/index.js +0 -4
  148. package/dist/interfaces/index.js.map +0 -1
  149. package/dist/interfaces/manager.d.ts +0 -142
  150. package/dist/interfaces/manager.d.ts.map +0 -1
  151. package/dist/interfaces/manager.js +0 -2
  152. package/dist/interfaces/manager.js.map +0 -1
  153. package/dist/interfaces/messages.d.ts +0 -75
  154. package/dist/interfaces/messages.d.ts.map +0 -1
  155. package/dist/interfaces/messages.js +0 -29
  156. package/dist/interfaces/messages.js.map +0 -1
  157. package/dist/interfaces/progress-reporting.d.ts +0 -86
  158. package/dist/interfaces/progress-reporting.d.ts.map +0 -1
  159. package/dist/interfaces/progress-reporting.js +0 -37
  160. package/dist/interfaces/progress-reporting.js.map +0 -1
  161. package/dist/interfaces/provider.d.ts +0 -217
  162. package/dist/interfaces/provider.d.ts.map +0 -1
  163. package/dist/interfaces/provider.js +0 -2
  164. package/dist/interfaces/provider.js.map +0 -1
  165. package/dist/interfaces/service.d.ts +0 -205
  166. package/dist/interfaces/service.d.ts.map +0 -1
  167. package/dist/interfaces/service.js +0 -6
  168. package/dist/interfaces/service.js.map +0 -1
  169. package/dist/interfaces/tool.d.ts +0 -248
  170. package/dist/interfaces/tool.d.ts.map +0 -1
  171. package/dist/interfaces/tool.js +0 -2
  172. package/dist/interfaces/tool.js.map +0 -1
  173. package/dist/interfaces/types.d.ts +0 -71
  174. package/dist/interfaces/types.d.ts.map +0 -1
  175. package/dist/interfaces/types.js +0 -33
  176. package/dist/interfaces/types.js.map +0 -1
  177. package/dist/interfaces/workflow-converter.d.ts +0 -193
  178. package/dist/interfaces/workflow-converter.d.ts.map +0 -1
  179. package/dist/interfaces/workflow-converter.js +0 -11
  180. package/dist/interfaces/workflow-converter.js.map +0 -1
  181. package/dist/interfaces/workflow-validator.d.ts +0 -209
  182. package/dist/interfaces/workflow-validator.d.ts.map +0 -1
  183. package/dist/interfaces/workflow-validator.js +0 -16
  184. package/dist/interfaces/workflow-validator.js.map +0 -1
  185. package/dist/managers/agent-factory.d.ts +0 -132
  186. package/dist/managers/agent-factory.d.ts.map +0 -1
  187. package/dist/managers/agent-factory.js +0 -284
  188. package/dist/managers/agent-factory.js.map +0 -1
  189. package/dist/managers/agent-factory.test.d.ts +0 -2
  190. package/dist/managers/agent-factory.test.d.ts.map +0 -1
  191. package/dist/managers/agent-factory.test.js +0 -249
  192. package/dist/managers/agent-factory.test.js.map +0 -1
  193. package/dist/managers/agent-templates.d.ts +0 -84
  194. package/dist/managers/agent-templates.d.ts.map +0 -1
  195. package/dist/managers/agent-templates.js +0 -159
  196. package/dist/managers/agent-templates.js.map +0 -1
  197. package/dist/managers/ai-provider-manager.d.ts +0 -80
  198. package/dist/managers/ai-provider-manager.d.ts.map +0 -1
  199. package/dist/managers/ai-provider-manager.js +0 -226
  200. package/dist/managers/ai-provider-manager.js.map +0 -1
  201. package/dist/managers/conversation-history-manager.d.ts +0 -455
  202. package/dist/managers/conversation-history-manager.d.ts.map +0 -1
  203. package/dist/managers/conversation-history-manager.js +0 -578
  204. package/dist/managers/conversation-history-manager.js.map +0 -1
  205. package/dist/managers/conversation-history-manager.test.d.ts +0 -2
  206. package/dist/managers/conversation-history-manager.test.d.ts.map +0 -1
  207. package/dist/managers/conversation-history-manager.test.js +0 -374
  208. package/dist/managers/conversation-history-manager.test.js.map +0 -1
  209. package/dist/managers/index.d.ts +0 -8
  210. package/dist/managers/index.d.ts.map +0 -1
  211. package/dist/managers/index.js +0 -8
  212. package/dist/managers/index.js.map +0 -1
  213. package/dist/managers/module-registry.d.ts +0 -161
  214. package/dist/managers/module-registry.d.ts.map +0 -1
  215. package/dist/managers/module-registry.js +0 -519
  216. package/dist/managers/module-registry.js.map +0 -1
  217. package/dist/managers/module-type-registry.d.ts +0 -113
  218. package/dist/managers/module-type-registry.d.ts.map +0 -1
  219. package/dist/managers/module-type-registry.js +0 -439
  220. package/dist/managers/module-type-registry.js.map +0 -1
  221. package/dist/managers/plugins.d.ts +0 -166
  222. package/dist/managers/plugins.d.ts.map +0 -1
  223. package/dist/managers/plugins.js +0 -339
  224. package/dist/managers/plugins.js.map +0 -1
  225. package/dist/managers/tool-manager.d.ts +0 -70
  226. package/dist/managers/tool-manager.d.ts.map +0 -1
  227. package/dist/managers/tool-manager.js +0 -138
  228. package/dist/managers/tool-manager.js.map +0 -1
  229. package/dist/managers/tool-manager.test.d.ts +0 -2
  230. package/dist/managers/tool-manager.test.d.ts.map +0 -1
  231. package/dist/managers/tool-manager.test.js +0 -186
  232. package/dist/managers/tool-manager.test.js.map +0 -1
  233. package/dist/node/builtin-templates.json +0 -107
  234. package/dist/plugins/conversation-history/conversation-history-plugin.d.ts +0 -67
  235. package/dist/plugins/conversation-history/conversation-history-plugin.d.ts.map +0 -1
  236. package/dist/plugins/conversation-history/conversation-history-plugin.js +0 -270
  237. package/dist/plugins/conversation-history/conversation-history-plugin.js.map +0 -1
  238. package/dist/plugins/conversation-history/index.d.ts +0 -3
  239. package/dist/plugins/conversation-history/index.d.ts.map +0 -1
  240. package/dist/plugins/conversation-history/index.js +0 -2
  241. package/dist/plugins/conversation-history/index.js.map +0 -1
  242. package/dist/plugins/conversation-history/storages/database-storage.d.ts +0 -19
  243. package/dist/plugins/conversation-history/storages/database-storage.d.ts.map +0 -1
  244. package/dist/plugins/conversation-history/storages/database-storage.js +0 -94
  245. package/dist/plugins/conversation-history/storages/database-storage.js.map +0 -1
  246. package/dist/plugins/conversation-history/storages/file-storage.d.ts +0 -15
  247. package/dist/plugins/conversation-history/storages/file-storage.d.ts.map +0 -1
  248. package/dist/plugins/conversation-history/storages/file-storage.js +0 -94
  249. package/dist/plugins/conversation-history/storages/file-storage.js.map +0 -1
  250. package/dist/plugins/conversation-history/storages/index.d.ts +0 -4
  251. package/dist/plugins/conversation-history/storages/index.d.ts.map +0 -1
  252. package/dist/plugins/conversation-history/storages/index.js +0 -4
  253. package/dist/plugins/conversation-history/storages/index.js.map +0 -1
  254. package/dist/plugins/conversation-history/storages/memory-storage.d.ts +0 -15
  255. package/dist/plugins/conversation-history/storages/memory-storage.d.ts.map +0 -1
  256. package/dist/plugins/conversation-history/storages/memory-storage.js +0 -33
  257. package/dist/plugins/conversation-history/storages/memory-storage.js.map +0 -1
  258. package/dist/plugins/conversation-history/types.d.ts +0 -61
  259. package/dist/plugins/conversation-history/types.d.ts.map +0 -1
  260. package/dist/plugins/conversation-history/types.js +0 -2
  261. package/dist/plugins/conversation-history/types.js.map +0 -1
  262. package/dist/plugins/error-handling/context-adapter.d.ts +0 -30
  263. package/dist/plugins/error-handling/context-adapter.d.ts.map +0 -1
  264. package/dist/plugins/error-handling/context-adapter.js +0 -41
  265. package/dist/plugins/error-handling/context-adapter.js.map +0 -1
  266. package/dist/plugins/error-handling/error-handling-plugin.d.ts +0 -49
  267. package/dist/plugins/error-handling/error-handling-plugin.d.ts.map +0 -1
  268. package/dist/plugins/error-handling/error-handling-plugin.js +0 -229
  269. package/dist/plugins/error-handling/error-handling-plugin.js.map +0 -1
  270. package/dist/plugins/error-handling/index.d.ts +0 -10
  271. package/dist/plugins/error-handling/index.d.ts.map +0 -1
  272. package/dist/plugins/error-handling/index.js +0 -10
  273. package/dist/plugins/error-handling/index.js.map +0 -1
  274. package/dist/plugins/error-handling/types.d.ts +0 -73
  275. package/dist/plugins/error-handling/types.d.ts.map +0 -1
  276. package/dist/plugins/error-handling/types.js +0 -14
  277. package/dist/plugins/error-handling/types.js.map +0 -1
  278. package/dist/plugins/event-emitter/metrics.d.ts +0 -17
  279. package/dist/plugins/event-emitter/metrics.d.ts.map +0 -1
  280. package/dist/plugins/event-emitter/metrics.js +0 -17
  281. package/dist/plugins/event-emitter/metrics.js.map +0 -1
  282. package/dist/plugins/event-emitter/types.d.ts +0 -112
  283. package/dist/plugins/event-emitter/types.d.ts.map +0 -1
  284. package/dist/plugins/event-emitter/types.js +0 -65
  285. package/dist/plugins/event-emitter/types.js.map +0 -1
  286. package/dist/plugins/event-emitter-plugin.d.ts +0 -222
  287. package/dist/plugins/event-emitter-plugin.d.ts.map +0 -1
  288. package/dist/plugins/event-emitter-plugin.js +0 -432
  289. package/dist/plugins/event-emitter-plugin.js.map +0 -1
  290. package/dist/plugins/event-emitter-plugin.test.d.ts +0 -2
  291. package/dist/plugins/event-emitter-plugin.test.d.ts.map +0 -1
  292. package/dist/plugins/event-emitter-plugin.test.js +0 -94
  293. package/dist/plugins/event-emitter-plugin.test.js.map +0 -1
  294. package/dist/plugins/execution/execution-analytics-plugin.d.ts +0 -129
  295. package/dist/plugins/execution/execution-analytics-plugin.d.ts.map +0 -1
  296. package/dist/plugins/execution/execution-analytics-plugin.js +0 -517
  297. package/dist/plugins/execution/execution-analytics-plugin.js.map +0 -1
  298. package/dist/plugins/execution/index.d.ts +0 -3
  299. package/dist/plugins/execution/index.d.ts.map +0 -1
  300. package/dist/plugins/execution/index.js +0 -2
  301. package/dist/plugins/execution/index.js.map +0 -1
  302. package/dist/plugins/execution/types.d.ts +0 -90
  303. package/dist/plugins/execution/types.d.ts.map +0 -1
  304. package/dist/plugins/execution/types.js +0 -2
  305. package/dist/plugins/execution/types.js.map +0 -1
  306. package/dist/plugins/index.d.ts +0 -10
  307. package/dist/plugins/index.d.ts.map +0 -1
  308. package/dist/plugins/index.js +0 -11
  309. package/dist/plugins/index.js.map +0 -1
  310. package/dist/plugins/limits/types.d.ts +0 -61
  311. package/dist/plugins/limits/types.d.ts.map +0 -1
  312. package/dist/plugins/limits/types.js +0 -2
  313. package/dist/plugins/limits/types.js.map +0 -1
  314. package/dist/plugins/limits-plugin.d.ts +0 -113
  315. package/dist/plugins/limits-plugin.d.ts.map +0 -1
  316. package/dist/plugins/limits-plugin.js +0 -380
  317. package/dist/plugins/limits-plugin.js.map +0 -1
  318. package/dist/plugins/logging/formatters.d.ts +0 -14
  319. package/dist/plugins/logging/formatters.d.ts.map +0 -1
  320. package/dist/plugins/logging/formatters.js +0 -24
  321. package/dist/plugins/logging/formatters.js.map +0 -1
  322. package/dist/plugins/logging/index.d.ts +0 -3
  323. package/dist/plugins/logging/index.d.ts.map +0 -1
  324. package/dist/plugins/logging/index.js +0 -2
  325. package/dist/plugins/logging/index.js.map +0 -1
  326. package/dist/plugins/logging/logging-plugin.d.ts +0 -91
  327. package/dist/plugins/logging/logging-plugin.d.ts.map +0 -1
  328. package/dist/plugins/logging/logging-plugin.js +0 -335
  329. package/dist/plugins/logging/logging-plugin.js.map +0 -1
  330. package/dist/plugins/logging/storages/console-storage.d.ts +0 -14
  331. package/dist/plugins/logging/storages/console-storage.d.ts.map +0 -1
  332. package/dist/plugins/logging/storages/console-storage.js +0 -38
  333. package/dist/plugins/logging/storages/console-storage.js.map +0 -1
  334. package/dist/plugins/logging/storages/file-storage.d.ts +0 -14
  335. package/dist/plugins/logging/storages/file-storage.d.ts.map +0 -1
  336. package/dist/plugins/logging/storages/file-storage.js +0 -41
  337. package/dist/plugins/logging/storages/file-storage.js.map +0 -1
  338. package/dist/plugins/logging/storages/index.d.ts +0 -5
  339. package/dist/plugins/logging/storages/index.d.ts.map +0 -1
  340. package/dist/plugins/logging/storages/index.js +0 -5
  341. package/dist/plugins/logging/storages/index.js.map +0 -1
  342. package/dist/plugins/logging/storages/remote-storage.d.ts +0 -20
  343. package/dist/plugins/logging/storages/remote-storage.d.ts.map +0 -1
  344. package/dist/plugins/logging/storages/remote-storage.js +0 -61
  345. package/dist/plugins/logging/storages/remote-storage.js.map +0 -1
  346. package/dist/plugins/logging/storages/silent-storage.d.ts +0 -10
  347. package/dist/plugins/logging/storages/silent-storage.d.ts.map +0 -1
  348. package/dist/plugins/logging/storages/silent-storage.js +0 -15
  349. package/dist/plugins/logging/storages/silent-storage.js.map +0 -1
  350. package/dist/plugins/logging/types.d.ts +0 -84
  351. package/dist/plugins/logging/types.d.ts.map +0 -1
  352. package/dist/plugins/logging/types.js +0 -2
  353. package/dist/plugins/logging/types.js.map +0 -1
  354. package/dist/plugins/performance/collectors/system-metrics-collector.d.ts +0 -12
  355. package/dist/plugins/performance/collectors/system-metrics-collector.d.ts.map +0 -1
  356. package/dist/plugins/performance/collectors/system-metrics-collector.js +0 -65
  357. package/dist/plugins/performance/collectors/system-metrics-collector.js.map +0 -1
  358. package/dist/plugins/performance/index.d.ts +0 -5
  359. package/dist/plugins/performance/index.d.ts.map +0 -1
  360. package/dist/plugins/performance/index.js +0 -4
  361. package/dist/plugins/performance/index.js.map +0 -1
  362. package/dist/plugins/performance/performance-plugin.d.ts +0 -49
  363. package/dist/plugins/performance/performance-plugin.d.ts.map +0 -1
  364. package/dist/plugins/performance/performance-plugin.js +0 -293
  365. package/dist/plugins/performance/performance-plugin.js.map +0 -1
  366. package/dist/plugins/performance/storages/index.d.ts +0 -2
  367. package/dist/plugins/performance/storages/index.d.ts.map +0 -1
  368. package/dist/plugins/performance/storages/index.js +0 -4
  369. package/dist/plugins/performance/storages/index.js.map +0 -1
  370. package/dist/plugins/performance/storages/memory-storage.d.ts +0 -19
  371. package/dist/plugins/performance/storages/memory-storage.d.ts.map +0 -1
  372. package/dist/plugins/performance/storages/memory-storage.js +0 -69
  373. package/dist/plugins/performance/storages/memory-storage.js.map +0 -1
  374. package/dist/plugins/performance/types.d.ts +0 -154
  375. package/dist/plugins/performance/types.d.ts.map +0 -1
  376. package/dist/plugins/performance/types.js +0 -2
  377. package/dist/plugins/performance/types.js.map +0 -1
  378. package/dist/plugins/usage/aggregate-usage-stats.d.ts +0 -12
  379. package/dist/plugins/usage/aggregate-usage-stats.d.ts.map +0 -1
  380. package/dist/plugins/usage/aggregate-usage-stats.js +0 -115
  381. package/dist/plugins/usage/aggregate-usage-stats.js.map +0 -1
  382. package/dist/plugins/usage/index.d.ts +0 -5
  383. package/dist/plugins/usage/index.d.ts.map +0 -1
  384. package/dist/plugins/usage/index.js +0 -4
  385. package/dist/plugins/usage/index.js.map +0 -1
  386. package/dist/plugins/usage/storages/file-storage.d.ts +0 -22
  387. package/dist/plugins/usage/storages/file-storage.d.ts.map +0 -1
  388. package/dist/plugins/usage/storages/file-storage.js +0 -111
  389. package/dist/plugins/usage/storages/file-storage.js.map +0 -1
  390. package/dist/plugins/usage/storages/index.d.ts +0 -5
  391. package/dist/plugins/usage/storages/index.d.ts.map +0 -1
  392. package/dist/plugins/usage/storages/index.js +0 -5
  393. package/dist/plugins/usage/storages/index.js.map +0 -1
  394. package/dist/plugins/usage/storages/memory-storage.d.ts +0 -22
  395. package/dist/plugins/usage/storages/memory-storage.d.ts.map +0 -1
  396. package/dist/plugins/usage/storages/memory-storage.js +0 -42
  397. package/dist/plugins/usage/storages/memory-storage.js.map +0 -1
  398. package/dist/plugins/usage/storages/remote-storage.d.ts +0 -26
  399. package/dist/plugins/usage/storages/remote-storage.d.ts.map +0 -1
  400. package/dist/plugins/usage/storages/remote-storage.js +0 -115
  401. package/dist/plugins/usage/storages/remote-storage.js.map +0 -1
  402. package/dist/plugins/usage/storages/silent-storage.d.ts +0 -19
  403. package/dist/plugins/usage/storages/silent-storage.d.ts.map +0 -1
  404. package/dist/plugins/usage/storages/silent-storage.js +0 -26
  405. package/dist/plugins/usage/storages/silent-storage.js.map +0 -1
  406. package/dist/plugins/usage/types.d.ts +0 -127
  407. package/dist/plugins/usage/types.d.ts.map +0 -1
  408. package/dist/plugins/usage/types.js +0 -2
  409. package/dist/plugins/usage/types.js.map +0 -1
  410. package/dist/plugins/usage/usage-plugin.d.ts +0 -67
  411. package/dist/plugins/usage/usage-plugin.d.ts.map +0 -1
  412. package/dist/plugins/usage/usage-plugin.js +0 -309
  413. package/dist/plugins/usage/usage-plugin.js.map +0 -1
  414. package/dist/plugins/webhook/http-client.d.ts +0 -30
  415. package/dist/plugins/webhook/http-client.d.ts.map +0 -1
  416. package/dist/plugins/webhook/http-client.js +0 -110
  417. package/dist/plugins/webhook/http-client.js.map +0 -1
  418. package/dist/plugins/webhook/index.d.ts +0 -9
  419. package/dist/plugins/webhook/index.d.ts.map +0 -1
  420. package/dist/plugins/webhook/index.js +0 -9
  421. package/dist/plugins/webhook/index.js.map +0 -1
  422. package/dist/plugins/webhook/transformer.d.ts +0 -63
  423. package/dist/plugins/webhook/transformer.d.ts.map +0 -1
  424. package/dist/plugins/webhook/transformer.js +0 -157
  425. package/dist/plugins/webhook/transformer.js.map +0 -1
  426. package/dist/plugins/webhook/types.d.ts +0 -183
  427. package/dist/plugins/webhook/types.d.ts.map +0 -1
  428. package/dist/plugins/webhook/types.js +0 -2
  429. package/dist/plugins/webhook/types.js.map +0 -1
  430. package/dist/plugins/webhook/webhook-plugin.d.ts +0 -92
  431. package/dist/plugins/webhook/webhook-plugin.d.ts.map +0 -1
  432. package/dist/plugins/webhook/webhook-plugin.js +0 -328
  433. package/dist/plugins/webhook/webhook-plugin.js.map +0 -1
  434. package/dist/schemas/agent-template-schema.d.ts +0 -137
  435. package/dist/schemas/agent-template-schema.d.ts.map +0 -1
  436. package/dist/schemas/agent-template-schema.js +0 -87
  437. package/dist/schemas/agent-template-schema.js.map +0 -1
  438. package/dist/services/conversation-service/index.d.ts +0 -88
  439. package/dist/services/conversation-service/index.d.ts.map +0 -1
  440. package/dist/services/conversation-service/index.js +0 -441
  441. package/dist/services/conversation-service/index.js.map +0 -1
  442. package/dist/services/conversation-service/types.d.ts +0 -32
  443. package/dist/services/conversation-service/types.d.ts.map +0 -1
  444. package/dist/services/conversation-service/types.js +0 -8
  445. package/dist/services/conversation-service/types.js.map +0 -1
  446. package/dist/services/event-service.d.ts +0 -61
  447. package/dist/services/event-service.d.ts.map +0 -1
  448. package/dist/services/event-service.js +0 -110
  449. package/dist/services/event-service.js.map +0 -1
  450. package/dist/services/event-service.test.d.ts +0 -2
  451. package/dist/services/event-service.test.d.ts.map +0 -1
  452. package/dist/services/event-service.test.js +0 -86
  453. package/dist/services/event-service.test.js.map +0 -1
  454. package/dist/services/execution-service.d.ts +0 -151
  455. package/dist/services/execution-service.d.ts.map +0 -1
  456. package/dist/services/execution-service.js +0 -1262
  457. package/dist/services/execution-service.js.map +0 -1
  458. package/dist/services/execution-service.test.d.ts +0 -2
  459. package/dist/services/execution-service.test.d.ts.map +0 -1
  460. package/dist/services/execution-service.test.js +0 -338
  461. package/dist/services/execution-service.test.js.map +0 -1
  462. package/dist/services/history-module.d.ts +0 -15
  463. package/dist/services/history-module.d.ts.map +0 -1
  464. package/dist/services/history-module.js +0 -42
  465. package/dist/services/history-module.js.map +0 -1
  466. package/dist/services/in-memory-history-store.d.ts +0 -12
  467. package/dist/services/in-memory-history-store.d.ts.map +0 -1
  468. package/dist/services/in-memory-history-store.js +0 -41
  469. package/dist/services/in-memory-history-store.js.map +0 -1
  470. package/dist/services/index.d.ts +0 -7
  471. package/dist/services/index.d.ts.map +0 -1
  472. package/dist/services/index.js +0 -13
  473. package/dist/services/index.js.map +0 -1
  474. package/dist/services/task-events.d.ts +0 -6
  475. package/dist/services/task-events.d.ts.map +0 -1
  476. package/dist/services/task-events.js +0 -6
  477. package/dist/services/task-events.js.map +0 -1
  478. package/dist/services/tool-execution-service.d.ts +0 -74
  479. package/dist/services/tool-execution-service.d.ts.map +0 -1
  480. package/dist/services/tool-execution-service.js +0 -189
  481. package/dist/services/tool-execution-service.js.map +0 -1
  482. package/dist/services/user-events.d.ts +0 -7
  483. package/dist/services/user-events.d.ts.map +0 -1
  484. package/dist/services/user-events.js +0 -6
  485. package/dist/services/user-events.js.map +0 -1
  486. package/dist/tools/implementations/function-tool/index.d.ts +0 -9
  487. package/dist/tools/implementations/function-tool/index.d.ts.map +0 -1
  488. package/dist/tools/implementations/function-tool/index.js +0 -13
  489. package/dist/tools/implementations/function-tool/index.js.map +0 -1
  490. package/dist/tools/implementations/function-tool/schema-converter.d.ts +0 -32
  491. package/dist/tools/implementations/function-tool/schema-converter.d.ts.map +0 -1
  492. package/dist/tools/implementations/function-tool/schema-converter.js +0 -164
  493. package/dist/tools/implementations/function-tool/schema-converter.js.map +0 -1
  494. package/dist/tools/implementations/function-tool/types.d.ts +0 -72
  495. package/dist/tools/implementations/function-tool/types.d.ts.map +0 -1
  496. package/dist/tools/implementations/function-tool/types.js +0 -14
  497. package/dist/tools/implementations/function-tool/types.js.map +0 -1
  498. package/dist/tools/implementations/function-tool.d.ts +0 -49
  499. package/dist/tools/implementations/function-tool.d.ts.map +0 -1
  500. package/dist/tools/implementations/function-tool.js +0 -223
  501. package/dist/tools/implementations/function-tool.js.map +0 -1
  502. package/dist/tools/implementations/index.d.ts +0 -4
  503. package/dist/tools/implementations/index.d.ts.map +0 -1
  504. package/dist/tools/implementations/index.js +0 -5
  505. package/dist/tools/implementations/index.js.map +0 -1
  506. package/dist/tools/implementations/mcp-tool.d.ts +0 -72
  507. package/dist/tools/implementations/mcp-tool.d.ts.map +0 -1
  508. package/dist/tools/implementations/mcp-tool.js +0 -246
  509. package/dist/tools/implementations/mcp-tool.js.map +0 -1
  510. package/dist/tools/implementations/openapi-tool.d.ts +0 -56
  511. package/dist/tools/implementations/openapi-tool.d.ts.map +0 -1
  512. package/dist/tools/implementations/openapi-tool.js +0 -324
  513. package/dist/tools/implementations/openapi-tool.js.map +0 -1
  514. package/dist/tools/implementations/relay-mcp-tool.d.ts +0 -38
  515. package/dist/tools/implementations/relay-mcp-tool.d.ts.map +0 -1
  516. package/dist/tools/implementations/relay-mcp-tool.js +0 -46
  517. package/dist/tools/implementations/relay-mcp-tool.js.map +0 -1
  518. package/dist/tools/index.d.ts +0 -3
  519. package/dist/tools/index.d.ts.map +0 -1
  520. package/dist/tools/index.js +0 -4
  521. package/dist/tools/index.js.map +0 -1
  522. package/dist/tools/registry/index.d.ts +0 -2
  523. package/dist/tools/registry/index.d.ts.map +0 -1
  524. package/dist/tools/registry/index.js +0 -3
  525. package/dist/tools/registry/index.js.map +0 -1
  526. package/dist/tools/registry/tool-registry.d.ts +0 -54
  527. package/dist/tools/registry/tool-registry.d.ts.map +0 -1
  528. package/dist/tools/registry/tool-registry.js +0 -146
  529. package/dist/tools/registry/tool-registry.js.map +0 -1
  530. package/dist/utils/errors.d.ts +0 -155
  531. package/dist/utils/errors.d.ts.map +0 -1
  532. package/dist/utils/errors.js +0 -203
  533. package/dist/utils/errors.js.map +0 -1
  534. package/dist/utils/execution-proxy.d.ts +0 -75
  535. package/dist/utils/execution-proxy.d.ts.map +0 -1
  536. package/dist/utils/execution-proxy.js +0 -230
  537. package/dist/utils/execution-proxy.js.map +0 -1
  538. package/dist/utils/index.d.ts +0 -11
  539. package/dist/utils/index.d.ts.map +0 -1
  540. package/dist/utils/index.js +0 -7
  541. package/dist/utils/index.js.map +0 -1
  542. package/dist/utils/logger.d.ts +0 -74
  543. package/dist/utils/logger.d.ts.map +0 -1
  544. package/dist/utils/logger.js +0 -143
  545. package/dist/utils/logger.js.map +0 -1
  546. package/dist/utils/message-converter.d.ts +0 -68
  547. package/dist/utils/message-converter.d.ts.map +0 -1
  548. package/dist/utils/message-converter.js +0 -87
  549. package/dist/utils/message-converter.js.map +0 -1
  550. package/dist/utils/periodic-task.d.ts +0 -14
  551. package/dist/utils/periodic-task.d.ts.map +0 -1
  552. package/dist/utils/periodic-task.js +0 -26
  553. package/dist/utils/periodic-task.js.map +0 -1
  554. package/dist/utils/validation.d.ts +0 -40
  555. package/dist/utils/validation.d.ts.map +0 -1
  556. package/dist/utils/validation.js +0 -162
  557. package/dist/utils/validation.js.map +0 -1
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./command-executor-wBgBdWXr.cjs"),t=require("./http-executor-CeAAZotH.cjs");let n=require("node:fs"),r=require("node:path"),i=require("node:dns/promises"),a=require("node:net"),o=require("undici/index.js");function s(e){if(typeof e!=`string`)throw TypeError(`executionRoot must be a string`);if(e.trim().length===0)throw TypeError(`executionRoot must be a non-empty string`);if(!(0,r.isAbsolute)(e))throw TypeError(`executionRoot must be an absolute path`);let t;try{t=(0,n.realpathSync)(e)}catch{throw TypeError(`executionRoot must name an existing accessible directory`)}if(!(0,n.statSync)(t).isDirectory())throw TypeError(`executionRoot must name a directory`);try{(0,n.accessSync)(t,n.constants.R_OK|n.constants.X_OK)}catch{throw TypeError(`executionRoot directory must be readable and traversable`)}return t}function c(e){let t=[],i=(0,r.resolve)(e);for(;;)try{return(0,r.join)((0,n.realpathSync)(i),...t)}catch{let n=(0,r.dirname)(i);if(n===i)return(0,r.resolve)(e);t.unshift((0,r.basename)(i)),i=n}}function l(e,t){let n=c(e),i=c(t);return i===n||i.startsWith(n+r.sep)}var u=class extends Error{constructor(e){super(e),this.name=`OwnerOnlyModeError`}};function d(e=process.platform){return e===`win32`?`windows-acl`:`posix-mode`}function f(e,t){let n=(0,r.relative)(e,t);if(n.startsWith(`..`)||(0,r.isAbsolute)(n))throw new u(`withinRoot ${e} is not an ancestor of ${t}, so this call cannot own the path between them.`);let i=n.split(r.sep).filter(e=>e.length>0),a=[e],o=e;for(let e of i)o=(0,r.join)(o,e),a.push(o);return a}function p(e,t,r={}){if(d()!==`posix-mode`)return;let i=(r.readMode??(e=>(0,n.statSync)(e).mode&4095))(e);if(i&63)throw new u(`${t} ${e} is mode 0${i.toString(8)} after being set owner-only; group or other permissions survived, so its contents are readable by another account.`)}function m(e,t={}){let r=t.makeDirectory??((e,t)=>{(0,n.mkdirSync)(e,{recursive:!0,mode:t})}),i=t.setMode??((e,t)=>(0,n.chmodSync)(e,t));r(e,448);let a=t.withinRoot===void 0?[e]:f(t.withinRoot,e);for(let e of a)d()===`posix-mode`&&i(e,448),p(e,`directory`,t)}function h(e,t){m((0,r.dirname)(e));let i=`${e}.${process.pid}.tmp`;(0,n.rmSync)(i,{force:!0}),(0,n.writeFileSync)(i,t,{encoding:`utf8`,mode:384,flag:`wx`});try{p(i,`file`),(0,n.renameSync)(i,e)}catch(e){try{(0,n.unlinkSync)(i)}catch{}throw e}p(e,`file`)}function g(e){if(d()!==`posix-mode`)return;let t;try{t=(0,n.statSync)(e).mode&4095}catch{return}t&63&&((0,n.chmodSync)(e,384),p(e,`file`))}function _(e){let t=(0,a.isIP)(e);return t===4?v(e.split(`.`).map(Number)):t!==6||y(e)}function v(e){let[t=0,n=0,r=0]=e;return t===0||t===10||t===127||t===100&&n>=64&&n<=127||t===169&&n===254||t===172&&n>=16&&n<=31||t===192&&n===0&&r===0||t===192&&n===168||t===198&&(n===18||n===19)||t>=224}function y(e){let t=x(e);if(t===void 0)return!0;let[n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0]=t;return n===0&&r===0&&i===0&&a===0&&o===0&&s===65535||n===100&&r===65435&&i===0&&a===0&&o===0&&s===0?v([c>>8,c&255,l>>8,l&255]):n===0&&r===0&&i===0&&a===0&&o===0&&s===0||(n&65024)==64512||(n&65472)==65152||(n&65472)==65216||(n&65280)==65280}function b(e){let t=e.lastIndexOf(`:`),n=e.slice(t+1);if(!n.includes(`.`))return e;if(t<0||(0,a.isIP)(n)!==4)return;let[r=0,i=0,o=0,s=0]=n.split(`.`).map(Number),c=(r<<8|i).toString(16),l=(o<<8|s).toString(16);return`${e.slice(0,t+1)}${c}:${l}`}function x(e){let t=b(e.split(`%`)[0]??e);if(t===void 0)return;let n=t.split(`::`);if(n.length>2)return;let r=e=>e.length===0?[]:e.split(`:`).map(e=>Number.parseInt(e,16)),i=r(n[0]??``),a=n.length===2?r(n[1]??``):[],o=8-i.length-a.length;if(o<0||n.length===1&&o!==0)return;let s=[...i,...Array(o).fill(0),...a];return s.some(e=>Number.isNaN(e)||e<0||e>65535)?void 0:s}const S=3e4,C=5e6,w=new Set([301,302,303,307,308]),T=new Set([`localhost`,`metadata`,`metadata.google.internal`,`metadata.goog`,`instance-data`,`instance-data.ec2.internal`]),E=async e=>(await(0,i.lookup)(e,{all:!0,verbatim:!0})).map(e=>e.address);async function D(e,t={},n=E){let r=e.href;if(e.protocol!==`http:`&&e.protocol!==`https:`)return{reason:`unsupported_scheme`,url:r,message:`Only http(s) URLs may be fetched.`};if(t.allowPrivateAddresses===!0)return;let i=e.hostname.replace(/^\[|\]$/g,``).toLowerCase();if(t.allowedHosts?.includes(i))return;if(T.has(i)||i.endsWith(`.localhost`))return{reason:`metadata_host`,url:r,message:`Destination "${i}" is a loopback or cloud-metadata host and is not reachable from tools.`};let o=(0,a.isIP)(i)?[i]:await O(i,n);if(o===void 0||o.length===0)return{reason:`unresolvable`,url:r,message:`Destination "${i}" did not resolve.`};let s=o.find(_);if(s!==void 0)return{reason:`private_destination`,url:r,message:`Destination "${i}" resolves to ${s}, a private, loopback or link-local address, and is not reachable from tools.`}}async function O(e,t){try{return await t(e)}catch{return}}async function k(e,t,n){n.throwIfAborted();let r;try{return await Promise.race([t(e),new Promise((e,t)=>{r=()=>t(n.reason),n.addEventListener(`abort`,r,{once:!0}),n.aborted&&r()})])}finally{r&&n.removeEventListener(`abort`,r)}}async function A(e,t,n,r,i){let s=e.hostname.replace(/^\[|\]$/g,``).toLowerCase(),c,l=async e=>{let t=await k(e,r.lookup??E,i);if(t.length===0||t.some(e=>(0,a.isIP)(e)===0))throw Error(`Invalid DNS answer`);return c=Object.freeze([...t]),c},u=await D(e,n,l);if(i.throwIfAborted(),u)return u;if(r.fetch){let n=await r.fetch(e.href,{...t,signal:i,redirect:`manual`});return{response:n,close:async()=>{n.body&&!n.body.locked&&await n.body.cancel().catch(()=>void 0)}}}if(c??=(0,a.isIP)(s)?[s]:await O(s,l),i.throwIfAborted(),!c||c.length===0)return{reason:`unresolvable`,url:e.href,message:`Destination did not resolve to valid IP addresses.`};let d=c.map(e=>({address:e,family:(0,a.isIP)(e)})),f=new o.Agent({connections:1,pipelining:0,connect:{lookup:(e,t,n)=>{if(e.toLowerCase()!==s||i.aborted){n(Error(`Connection authority unavailable`),``,4);return}let r=typeof t==`number`?t:t.family,a=d.filter(e=>!r||e.family===r);if(a.length===0){n(Error(`No validated address family`),``,4);return}typeof t==`object`&&t.all?n(null,a):n(null,a[0].address,a[0].family)}}});if(typeof f.dispatch!=`function`||typeof f.destroy!=`function`)throw Error(`Pinned HTTP transport is unavailable in this runtime`);try{return{response:await(0,o.fetch)(e.href,{...t,signal:i,redirect:`manual`,dispatcher:f}),close:async()=>{await f.destroy()}}}catch(e){throw await f.destroy(),e}}async function j(e,t={},n={},r={}){let i=t.maxResponseBytes??C,a=n.maxRedirects??5,o=AbortSignal.timeout(t.timeoutMs??S),s=t.signal?AbortSignal.any([o,t.signal]):o,c=new URL(e),l={...t.headers??{}};for(let e=0;;e+=1){let t=await A(c,{headers:l,signal:s,redirect:`manual`},n,r,s);if(!(`response`in t))return{ok:!1,rejection:t};try{let n=t.response;if(!w.has(n.status))return await P(n,c.href,i,s);let r=n.headers.get(`location`);if(r===null)return{ok:!1,rejection:{reason:`redirect_without_location`,url:c.href,message:`HTTP ${n.status} without a Location header.`}};if(e>=a)return{ok:!1,rejection:{reason:`redirect_limit`,url:c.href,message:`More than ${a} redirects.`}};let o=new URL(r,c);o.origin!==c.origin&&(l=N(l)),c=o}finally{await t.close()}}}async function M(e,t,n={},r={}){let i=t.maxResponseBytes??C,a=AbortSignal.timeout(t.timeoutMs??S),o=t.signal?AbortSignal.any([a,t.signal]):a,s=new URL(e),c=await A(s,{method:`POST`,headers:{...t.headers??{}},body:t.body,signal:o,redirect:`manual`},n,r,o);if(!(`response`in c))return{ok:!1,rejection:c};try{let e=c.response;return e.status>=300&&e.status<400?(await e.body?.cancel().catch(()=>void 0),{ok:!1,rejection:{reason:`redirect_refused`,url:s.href,message:`HTTP ${e.status}: a POST is never redirected.`}}):await P(e,s.href,i,o)}finally{await c.close()}}function N(e){let t={};for(let[n,r]of Object.entries(e))n.toLowerCase()===`user-agent`&&(t[n]=r);return t}async function P(e,t,n,r){let i=e=>({ok:!1,rejection:{reason:`response_too_large`,url:t,message:`Response exceeds ${n} bytes (${e} seen).`}}),a=Number(e.headers.get(`content-length`));if(Number.isFinite(a)&&a>n)return await e.body?.cancel(),i(a);let o=[],s=0;if(!e.body&&typeof e.arrayBuffer==`function`){let t=new Uint8Array(await e.arrayBuffer());if(t.byteLength>n)return i(t.byteLength);o.push(t),s=t.byteLength}else if(e.body){let t=e.body.getReader();for(;;){r.throwIfAborted();let{done:e,value:a}=await t.read();if(e)break;if(s+=a.byteLength,s>n)return await t.cancel(),i(s);o.push(a)}}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.byteLength;return{ok:!0,status:e.status,statusText:e.statusText,headers:e.headers,body:c,finalUrl:t}}exports.BLOCKED_HOSTNAMES=T,exports.CommandExecutor=e.t,exports.HttpExecutor=t.t,exports.OWNER_ONLY_DIRECTORY_MODE=448,exports.OWNER_ONLY_FILE_MODE=384,exports.OwnerOnlyModeError=u,exports.canonicalizePath=c,exports.ensureOwnerOnlyDirectory=m,exports.fetchWithEgressPolicy=j,exports.isPathInside=l,exports.isPrivateAddress=_,exports.openEgressExchange=A,exports.ownerOnlyGuarantee=d,exports.postWithEgressPolicy=M,exports.rejectDestination=D,exports.resolveTrustedExecutionRoot=s,exports.tightenExistingFile=g,exports.writeOwnerOnlyFile=h;
@@ -0,0 +1,247 @@
1
+ import { c as IHookTypeExecutor, l as IHttpHookDefinition, m as THookOutcome, n as ICommandHookDefinition, s as IHookInput, y as ISubprocessTraceEnv } from "./types-Ge2XB-y-.cjs";
2
+ //#region src/utils/path-containment.d.ts
3
+ /**
4
+ * Validate an authority root more strictly than candidate-path canonicalization.
5
+ *
6
+ * Candidate write paths may have a missing tail, but an authority root must already exist and be a
7
+ * traversable directory. Keeping the contracts separate prevents a typo in a root from degrading to
8
+ * a lexical boundary that the caller did not actually select.
9
+ */
10
+ declare function resolveTrustedExecutionRoot(input: unknown): string;
11
+ /**
12
+ * Resolve `p` to its canonical form, following symlinks, tolerating a path that does not exist yet.
13
+ *
14
+ * `realpathSync` throws on a missing path, but callers legitimately ask about files they are about to
15
+ * CREATE (a write or an edit). So we walk up to the deepest ancestor that does exist, canonicalize
16
+ * that, and re-attach the remaining segments — the re-attached tail cannot itself be a symlink,
17
+ * because it does not exist.
18
+ */
19
+ declare function canonicalizePath(p: string): string;
20
+ /**
21
+ * Whether `candidate` is `root` itself or lies beneath it, decided on the CANONICAL form of both.
22
+ *
23
+ * Canonicalizing the root as well as the candidate matters: a root that is itself reached through a
24
+ * symlink (macOS `/tmp` -> `/private/tmp`, or a workspace under a symlinked home) would otherwise
25
+ * spuriously reject every path inside it.
26
+ */
27
+ declare function isPathInside(root: string, candidate: string): boolean;
28
+ //#endregion
29
+ //#region src/utils/owner-only-store.d.ts
30
+ /**
31
+ * SEC-020 (issue #2021) — creating a host directory or file that only its owner can read.
32
+ *
33
+ * A host application persists session records, logs, settings and device credentials under a directory
34
+ * of its own choosing. They carry prompts, model output, tool results and, in the settings case,
35
+ * provider credentials. On a shared workstation or a CI host, every other local account reads them
36
+ * unless the mode says otherwise.
37
+ *
38
+ * WHERE that directory is belongs to the host, not here — this module knows only what has to be true
39
+ * of whatever path it is handed, which is what lets it be tested without a filesystem layout.
40
+ *
41
+ * ## Why this is one module and not a constant each caller repeats
42
+ *
43
+ * `0o600` and `0o700` were already spelled out in five separate files before this existed, and the
44
+ * repository had already learned — in `guarded-directory.ts`, for a pairing rendezvous — that the
45
+ * constants are the easy half. The load-bearing part is that **`mkdirSync(path, { mode })` does not
46
+ * set the mode of a directory that already exists.** `recursive: true` returns successfully and
47
+ * silently adopts whatever mode is there. A directory left at 0777 by an earlier version, by a
48
+ * shared CI checkout, or by another local user who pre-created it, becomes ours with no signal.
49
+ *
50
+ * Measured under umask 022 before this module existed: a session log directory pre-created at 0777
51
+ * stayed 0777 through `mkdirSync(dir, { recursive: true, mode: 0o700 })`, and its 0600 records were
52
+ * then removable and replaceable by any local account.
53
+ *
54
+ * The same holds for files. `writeFileSync(path, data, { mode })` applies the mode only when the
55
+ * file is CREATED; an existing 0644 record keeps 0644 forever, so a store written by an older
56
+ * version is never repaired by a newer one.
57
+ *
58
+ * So: create, then set the mode unconditionally, then VERIFY — and verification is what makes the
59
+ * first two checkable rather than hopeful. It is also the only step that catches an owner we did not
60
+ * expect, which `mkdir` and `chmod` between them cannot.
61
+ *
62
+ * ## Windows
63
+ *
64
+ * `chmodSync` on win32 toggles the read-only attribute and cannot express "owner only"; NTFS ACL
65
+ * inheritance governs instead, and a user's profile directory is not readable by other unprivileged
66
+ * accounts by default. The POSIX assertion is therefore not made there, and `ownerOnlyGuarantee()` reports which
67
+ * guarantee is in force so a caller — and a test — can state the platform's actual claim rather than
68
+ * assume the POSIX one everywhere. A store directory placed inside a world-writable parent on
69
+ * Windows is NOT protected by this module, and that is recorded rather than papered over.
70
+ */
71
+ /** Owner read/write. Nothing for group, nothing for other. */
72
+ declare const OWNER_ONLY_FILE_MODE = 384;
73
+ /** Owner read/write/traverse. The traverse bit is what keeps another account out of the directory. */
74
+ declare const OWNER_ONLY_DIRECTORY_MODE = 448;
75
+ /** Raised when a path cannot be made owner-only. Never swallowed into a weaker mode. */
76
+ declare class OwnerOnlyModeError extends Error {
77
+ constructor(message: string);
78
+ }
79
+ /**
80
+ * Which guarantee this platform can actually make.
81
+ *
82
+ * `posix-mode` — the mode bits are asserted after every create and every write.
83
+ * `windows-acl` — inherited NTFS ACLs govern; the POSIX assertion is not made and not claimed.
84
+ */
85
+ declare function ownerOnlyGuarantee(platform?: string): 'posix-mode' | 'windows-acl';
86
+ /**
87
+ * Seams for the failure paths, injected for the reason `guarded-directory.ts` states: a filesystem
88
+ * that silently ignores `chmod` is a real condition — some network and FAT mounts do exactly that —
89
+ * and it is the ONLY condition the verification step catches that create-then-chmod does not. Without
90
+ * a seam that case is unreachable from a test, and a guard no test can reach is a guard nobody knows
91
+ * is there. Measured: with these absent, deleting the verification entirely changed no test result.
92
+ */
93
+ interface IOwnerOnlyIo {
94
+ readonly makeDirectory?: (target: string, mode: number) => void;
95
+ readonly setMode?: (target: string, mode: number) => void;
96
+ readonly readMode?: (target: string) => number;
97
+ }
98
+ interface IEnsureOwnerOnlyOptions extends IOwnerOnlyIo {
99
+ /**
100
+ * An ANCESTOR of `directory` that the caller also owns, tightened along with every segment between
101
+ * them.
102
+ *
103
+ * Needed because `mkdirSync(path, { recursive: true, mode })` applies the mode only to the
104
+ * directories it CREATES. A store root an older version already made sits at whatever mode it was
105
+ * given and this call would leave it there — which is the module's own headline defect surviving
106
+ * one level up, on the very path it exists to protect. Found in review of PR #2224.
107
+ *
108
+ * It is a parameter rather than a walk up to some inferred boundary because WHICH ancestors belong
109
+ * to the caller is the caller's knowledge. This module must not guess that a parent is ours; it
110
+ * would eventually chmod someone's home directory.
111
+ */
112
+ readonly withinRoot?: string;
113
+ }
114
+ /**
115
+ * Ensure `directory` exists and only its owner can enter it.
116
+ *
117
+ * The `chmod` is unconditional because `mkdir` does not touch an existing directory's mode, and the
118
+ * `stat` afterwards is what turns two hopeful calls into a checked one.
119
+ */
120
+ declare function ensureOwnerOnlyDirectory(directory: string, options?: IEnsureOwnerOnlyOptions): void;
121
+ /**
122
+ * Replace `filePath` atomically with content only its owner can read.
123
+ *
124
+ * The temp file carries the mode from the moment it is created — writing it at the umask's default
125
+ * and tightening afterwards leaves a window in which the full content is world-readable on disk, and
126
+ * `rename` preserves whatever mode the temp file had. The `chmod` after the write is for the case
127
+ * where the temp path already existed at a wider mode.
128
+ */
129
+ declare function writeOwnerOnlyFile(filePath: string, content: string): void;
130
+ /**
131
+ * Tighten a file that already exists — the repair path for a record an older version left at 0644.
132
+ *
133
+ * A no-op on a path that does not exist, because "there is nothing to tighten" and "we tightened it"
134
+ * are the same outcome for the caller, and throwing would make every writer branch on existence.
135
+ */
136
+ declare function tightenExistingFile(filePath: string): void;
137
+ //#endregion
138
+ //#region src/hooks/executors/command-executor.d.ts
139
+ declare class CommandExecutor implements IHookTypeExecutor {
140
+ private readonly shellExecutable?;
141
+ readonly type: "command";
142
+ constructor(shellExecutable?: string | undefined);
143
+ /**
144
+ * `traceEnv` is the prompt's trace for this child, handed separately so it never reaches the
145
+ * stdin JSON. The child sees `process.env`, then ConversationAgent's value, then the hook's own `env`; a hook
146
+ * that sets its own `TRACEPARENT` wins and gets the ambient environment unchanged.
147
+ */
148
+ execute(definition: ICommandHookDefinition, input: IHookInput, traceEnv?: ISubprocessTraceEnv): Promise<THookOutcome>;
149
+ }
150
+ //#endregion
151
+ //#region src/hooks/executors/http-executor.d.ts
152
+ declare class HttpExecutor implements IHookTypeExecutor {
153
+ readonly type: "http";
154
+ execute(definition: IHttpHookDefinition, input: IHookInput): Promise<THookOutcome>;
155
+ }
156
+ //#endregion
157
+ //#region src/utils/ip-address.d.ts
158
+ /**
159
+ * Address classification for the egress boundary (#2026) — the "is this address public unicast?"
160
+ * half of `egress-policy.ts`, split out so each module holds one job: that one owns the FETCH
161
+ * (scheme, redirects, headers, deadline, byte cap), this one owns the ARITHMETIC of an address.
162
+ *
163
+ * The awkward part lives here on purpose. A literal destination reaches the policy already
164
+ * normalized by `URL` (`2130706433`, `0x7f.1` and `[::ffff:7f00:1]` all collapse to one hostname),
165
+ * but a RESOLVED one does not: `dns.lookup` renders an IPv4-mapped AAAA answer through `inet_ntop`,
166
+ * which prints the dotted spelling `::ffff:127.0.0.1`. So the expansion below accepts BOTH
167
+ * spellings rather than trusting any normalizer to have run — on the resolution path an attacker
168
+ * controls the record. Every "cannot parse" answer is `undefined`/`true`, i.e. NOT public: an
169
+ * address this module cannot read is never treated as reachable.
170
+ *
171
+ * Node-only (`node:net`): reached through `egress-policy.ts`, never the browser barrel.
172
+ */
173
+ /** True when `ip` (v4 or v6 text) is not a public unicast address. */
174
+ declare function isPrivateAddress(ip: string): boolean;
175
+ //#endregion
176
+ //#region src/utils/egress-policy.d.ts
177
+ type TEgressLookup = (hostname: string) => Promise<readonly string[]>;
178
+ interface IEgressPolicy {
179
+ /** Exact lowercase hostnames that may be reached even when they resolve to a private address. */
180
+ readonly allowedHosts?: readonly string[];
181
+ /** Explicit enterprise opt-out from private/loopback/metadata blocking. Default `false`. */
182
+ readonly allowPrivateAddresses?: boolean;
183
+ /** Redirect hops followed before refusing. Default 5. */
184
+ readonly maxRedirects?: number;
185
+ }
186
+ interface IEgressFetchOptions {
187
+ readonly headers?: Readonly<Record<string, string>>;
188
+ readonly signal?: AbortSignal;
189
+ /** Deadline for the WHOLE exchange, redirects and body included. Default 30 000 ms. */
190
+ readonly timeoutMs?: number;
191
+ /** Byte cap enforced on `Content-Length` and again while streaming. Default 5 000 000. */
192
+ readonly maxResponseBytes?: number;
193
+ }
194
+ interface IEgressDeps {
195
+ /** Trusted owner/test carrier: this override owns connect-time policy and socket lifetime. */
196
+ readonly fetch?: typeof globalThis.fetch;
197
+ readonly lookup?: TEgressLookup;
198
+ }
199
+ type TEgressRejectionReason = 'unsupported_scheme' | 'private_destination' | 'metadata_host' | 'unresolvable' | 'redirect_limit' | 'redirect_without_location' | 'redirect_refused' | 'response_too_large';
200
+ interface IEgressRejection {
201
+ readonly reason: TEgressRejectionReason;
202
+ readonly url: string;
203
+ readonly message: string;
204
+ }
205
+ type TEgressFetchResult = {
206
+ ok: true;
207
+ status: number;
208
+ statusText: string;
209
+ headers: Headers;
210
+ body: Uint8Array;
211
+ finalUrl: string;
212
+ } | {
213
+ ok: false;
214
+ rejection: IEgressRejection;
215
+ };
216
+ /** Hostnames that are metadata services or loopback by convention, whatever they resolve to. */
217
+ declare const BLOCKED_HOSTNAMES: ReadonlySet<string>;
218
+ /** Validate ONE destination URL against the policy. `undefined` means it may be reached. */
219
+ declare function rejectDestination(url: URL, policy?: IEgressPolicy, lookup?: TEgressLookup): Promise<IEgressRejection | undefined>;
220
+ interface IEgressExchange {
221
+ readonly response: Response;
222
+ close(): Promise<void>;
223
+ }
224
+ /**
225
+ * Open one manually redirected exchange without buffering its response. A streaming owner supplies
226
+ * the lifetime/deadline signal and must close the exchange on completion, cancellation and failure.
227
+ * No ambient dispatcher, second DNS resolution, URL rewrite or transport downgrade is selected.
228
+ */
229
+ declare function openEgressExchange(url: URL, init: RequestInit, policy: IEgressPolicy, deps: IEgressDeps, signal: AbortSignal): Promise<IEgressExchange | IEgressRejection>;
230
+ /**
231
+ * Fetch `url` under the egress policy. Policy outcomes are RETURNED (`ok: false`); transport errors
232
+ * (DNS failure at connect, refused connection, TLS, abort) are THROWN, as `fetch` throws them, so the
233
+ * caller's own error classification keeps working.
234
+ */
235
+ declare function fetchWithEgressPolicy(url: string, options?: IEgressFetchOptions, policy?: IEgressPolicy, deps?: IEgressDeps): Promise<TEgressFetchResult>;
236
+ interface IEgressPostOptions extends IEgressFetchOptions {
237
+ /** Sent as-is; a `URLSearchParams` or JSON string, never a stream, so it is never re-sent. */
238
+ readonly body: string | URLSearchParams;
239
+ }
240
+ /**
241
+ * POST `url` under the egress policy. The destination is validated as for a GET, but a redirect is
242
+ * REFUSED (`redirect_refused`), never followed: the body is the caller's to send to this URL alone.
243
+ */
244
+ declare function postWithEgressPolicy(url: string, options: IEgressPostOptions, policy?: IEgressPolicy, deps?: IEgressDeps): Promise<TEgressFetchResult>;
245
+ //#endregion
246
+ export { BLOCKED_HOSTNAMES, CommandExecutor, HttpExecutor, type IEgressDeps, type IEgressExchange, type IEgressFetchOptions, type IEgressPolicy, type IEgressPostOptions, type IEgressRejection, type IOwnerOnlyIo, OWNER_ONLY_DIRECTORY_MODE, OWNER_ONLY_FILE_MODE, OwnerOnlyModeError, type TEgressFetchResult, type TEgressLookup, type TEgressRejectionReason, canonicalizePath, ensureOwnerOnlyDirectory, fetchWithEgressPolicy, isPathInside, isPrivateAddress, openEgressExchange, ownerOnlyGuarantee, postWithEgressPolicy, rejectDestination, resolveTrustedExecutionRoot, tightenExistingFile, writeOwnerOnlyFile };
247
+ //# sourceMappingURL=node.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.cts","names":[],"sources":["../../src/utils/path-containment.ts","../../src/utils/owner-only-store.ts","../../src/hooks/executors/command-executor.ts","../../src/hooks/executors/http-executor.ts","../../src/utils/ip-address.ts","../../src/utils/egress-policy.ts"],"mappings":";;;;;;;;;iBA2BgB,4BAA4B;;;;;;;;;iBAoC5B,iBAAiB;;;;;;;;iBAwBjB,aAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCjC9B;;cAEA;;cAMA,2BAA2B;EAC1B,YAAA;;;;;;;;iBAYE,mBACd;;;;;;;;UAYe;WACN,iBAAiB,gBAAgB;WACjC,WAAW,gBAAgB;WAC3B,YAAY;;UAGN,gCAAgC;;;;;;;;;;;;;;WActC;;;;;;;;iBAsCK,yBACd,mBACA,UAAS;;;;;;;;;iBA8BK,mBAAmB,kBAAkB;;;;;;;iBA2CrC,oBAAoB;;;cCnIvB,2BAA2B;mBAGT;WAFpB;EAEoB,YAAA;;;;;;EAO7B,QACE,YAAY,wBACZ,OAAO,YACP,WAAW,sBACV,QAAQ;;;;cC1EA,wBAAwB;WAC1B;EAEH,QAAQ,YAAY,qBAAqB,OAAO,aAAa,QAAQ;;;;;;;;;;;;;;;;;;;;iBCP7D,iBAAiB;;;KCWrB,iBAAiB,qBAAqB;UAEjC;;WAEN;;WAEA;;WAEA;;UAGM;WACN,UAAU,SAAS;WACnB,SAAS;;WAET;;WAEA;;UAGM;;WAEN,eAAe,WAAW;WAC1B,SAAS;;KAGR;UAUK;WACN,QAAQ;WACR;WACA;;KAGC;EAEN;EACA;EACA;EACA,SAAS;EACT,MAAM;EACN;;EAEA;EAAW,WAAW;;;cAWf,mBAAmB;;iBAaV,kBACpB,KAAK,KACL,SAAQ,eACR,SAAQ,gBACP,QAAQ;UAmDM;WACN,UAAU;EACnB,SAAS;;;;;;;iBA8BW,mBACpB,KAAK,KACL,MAAM,aACN,QAAQ,eACR,MAAM,aACN,QAAQ,cACP,QAAQ,kBAAkB;;;;;;iBA6EP,sBACpB,aACA,UAAS,qBACT,SAAQ,eACR,OAAM,cACL,QAAQ;UAqDM,2BAA2B;;WAEjC,eAAe;;;;;;iBAOJ,qBACpB,aACA,SAAS,oBACT,SAAQ,eACR,OAAM,cACL,QAAQ"}
@@ -0,0 +1,247 @@
1
+ import { c as IHookTypeExecutor, l as IHttpHookDefinition, m as THookOutcome, n as ICommandHookDefinition, s as IHookInput, y as ISubprocessTraceEnv } from "./types-Ge2XB-y-.js";
2
+ //#region src/utils/path-containment.d.ts
3
+ /**
4
+ * Validate an authority root more strictly than candidate-path canonicalization.
5
+ *
6
+ * Candidate write paths may have a missing tail, but an authority root must already exist and be a
7
+ * traversable directory. Keeping the contracts separate prevents a typo in a root from degrading to
8
+ * a lexical boundary that the caller did not actually select.
9
+ */
10
+ declare function resolveTrustedExecutionRoot(input: unknown): string;
11
+ /**
12
+ * Resolve `p` to its canonical form, following symlinks, tolerating a path that does not exist yet.
13
+ *
14
+ * `realpathSync` throws on a missing path, but callers legitimately ask about files they are about to
15
+ * CREATE (a write or an edit). So we walk up to the deepest ancestor that does exist, canonicalize
16
+ * that, and re-attach the remaining segments — the re-attached tail cannot itself be a symlink,
17
+ * because it does not exist.
18
+ */
19
+ declare function canonicalizePath(p: string): string;
20
+ /**
21
+ * Whether `candidate` is `root` itself or lies beneath it, decided on the CANONICAL form of both.
22
+ *
23
+ * Canonicalizing the root as well as the candidate matters: a root that is itself reached through a
24
+ * symlink (macOS `/tmp` -> `/private/tmp`, or a workspace under a symlinked home) would otherwise
25
+ * spuriously reject every path inside it.
26
+ */
27
+ declare function isPathInside(root: string, candidate: string): boolean;
28
+ //#endregion
29
+ //#region src/utils/owner-only-store.d.ts
30
+ /**
31
+ * SEC-020 (issue #2021) — creating a host directory or file that only its owner can read.
32
+ *
33
+ * A host application persists session records, logs, settings and device credentials under a directory
34
+ * of its own choosing. They carry prompts, model output, tool results and, in the settings case,
35
+ * provider credentials. On a shared workstation or a CI host, every other local account reads them
36
+ * unless the mode says otherwise.
37
+ *
38
+ * WHERE that directory is belongs to the host, not here — this module knows only what has to be true
39
+ * of whatever path it is handed, which is what lets it be tested without a filesystem layout.
40
+ *
41
+ * ## Why this is one module and not a constant each caller repeats
42
+ *
43
+ * `0o600` and `0o700` were already spelled out in five separate files before this existed, and the
44
+ * repository had already learned — in `guarded-directory.ts`, for a pairing rendezvous — that the
45
+ * constants are the easy half. The load-bearing part is that **`mkdirSync(path, { mode })` does not
46
+ * set the mode of a directory that already exists.** `recursive: true` returns successfully and
47
+ * silently adopts whatever mode is there. A directory left at 0777 by an earlier version, by a
48
+ * shared CI checkout, or by another local user who pre-created it, becomes ours with no signal.
49
+ *
50
+ * Measured under umask 022 before this module existed: a session log directory pre-created at 0777
51
+ * stayed 0777 through `mkdirSync(dir, { recursive: true, mode: 0o700 })`, and its 0600 records were
52
+ * then removable and replaceable by any local account.
53
+ *
54
+ * The same holds for files. `writeFileSync(path, data, { mode })` applies the mode only when the
55
+ * file is CREATED; an existing 0644 record keeps 0644 forever, so a store written by an older
56
+ * version is never repaired by a newer one.
57
+ *
58
+ * So: create, then set the mode unconditionally, then VERIFY — and verification is what makes the
59
+ * first two checkable rather than hopeful. It is also the only step that catches an owner we did not
60
+ * expect, which `mkdir` and `chmod` between them cannot.
61
+ *
62
+ * ## Windows
63
+ *
64
+ * `chmodSync` on win32 toggles the read-only attribute and cannot express "owner only"; NTFS ACL
65
+ * inheritance governs instead, and a user's profile directory is not readable by other unprivileged
66
+ * accounts by default. The POSIX assertion is therefore not made there, and `ownerOnlyGuarantee()` reports which
67
+ * guarantee is in force so a caller — and a test — can state the platform's actual claim rather than
68
+ * assume the POSIX one everywhere. A store directory placed inside a world-writable parent on
69
+ * Windows is NOT protected by this module, and that is recorded rather than papered over.
70
+ */
71
+ /** Owner read/write. Nothing for group, nothing for other. */
72
+ declare const OWNER_ONLY_FILE_MODE = 384;
73
+ /** Owner read/write/traverse. The traverse bit is what keeps another account out of the directory. */
74
+ declare const OWNER_ONLY_DIRECTORY_MODE = 448;
75
+ /** Raised when a path cannot be made owner-only. Never swallowed into a weaker mode. */
76
+ declare class OwnerOnlyModeError extends Error {
77
+ constructor(message: string);
78
+ }
79
+ /**
80
+ * Which guarantee this platform can actually make.
81
+ *
82
+ * `posix-mode` — the mode bits are asserted after every create and every write.
83
+ * `windows-acl` — inherited NTFS ACLs govern; the POSIX assertion is not made and not claimed.
84
+ */
85
+ declare function ownerOnlyGuarantee(platform?: string): 'posix-mode' | 'windows-acl';
86
+ /**
87
+ * Seams for the failure paths, injected for the reason `guarded-directory.ts` states: a filesystem
88
+ * that silently ignores `chmod` is a real condition — some network and FAT mounts do exactly that —
89
+ * and it is the ONLY condition the verification step catches that create-then-chmod does not. Without
90
+ * a seam that case is unreachable from a test, and a guard no test can reach is a guard nobody knows
91
+ * is there. Measured: with these absent, deleting the verification entirely changed no test result.
92
+ */
93
+ interface IOwnerOnlyIo {
94
+ readonly makeDirectory?: (target: string, mode: number) => void;
95
+ readonly setMode?: (target: string, mode: number) => void;
96
+ readonly readMode?: (target: string) => number;
97
+ }
98
+ interface IEnsureOwnerOnlyOptions extends IOwnerOnlyIo {
99
+ /**
100
+ * An ANCESTOR of `directory` that the caller also owns, tightened along with every segment between
101
+ * them.
102
+ *
103
+ * Needed because `mkdirSync(path, { recursive: true, mode })` applies the mode only to the
104
+ * directories it CREATES. A store root an older version already made sits at whatever mode it was
105
+ * given and this call would leave it there — which is the module's own headline defect surviving
106
+ * one level up, on the very path it exists to protect. Found in review of PR #2224.
107
+ *
108
+ * It is a parameter rather than a walk up to some inferred boundary because WHICH ancestors belong
109
+ * to the caller is the caller's knowledge. This module must not guess that a parent is ours; it
110
+ * would eventually chmod someone's home directory.
111
+ */
112
+ readonly withinRoot?: string;
113
+ }
114
+ /**
115
+ * Ensure `directory` exists and only its owner can enter it.
116
+ *
117
+ * The `chmod` is unconditional because `mkdir` does not touch an existing directory's mode, and the
118
+ * `stat` afterwards is what turns two hopeful calls into a checked one.
119
+ */
120
+ declare function ensureOwnerOnlyDirectory(directory: string, options?: IEnsureOwnerOnlyOptions): void;
121
+ /**
122
+ * Replace `filePath` atomically with content only its owner can read.
123
+ *
124
+ * The temp file carries the mode from the moment it is created — writing it at the umask's default
125
+ * and tightening afterwards leaves a window in which the full content is world-readable on disk, and
126
+ * `rename` preserves whatever mode the temp file had. The `chmod` after the write is for the case
127
+ * where the temp path already existed at a wider mode.
128
+ */
129
+ declare function writeOwnerOnlyFile(filePath: string, content: string): void;
130
+ /**
131
+ * Tighten a file that already exists — the repair path for a record an older version left at 0644.
132
+ *
133
+ * A no-op on a path that does not exist, because "there is nothing to tighten" and "we tightened it"
134
+ * are the same outcome for the caller, and throwing would make every writer branch on existence.
135
+ */
136
+ declare function tightenExistingFile(filePath: string): void;
137
+ //#endregion
138
+ //#region src/hooks/executors/command-executor.d.ts
139
+ declare class CommandExecutor implements IHookTypeExecutor {
140
+ private readonly shellExecutable?;
141
+ readonly type: "command";
142
+ constructor(shellExecutable?: string | undefined);
143
+ /**
144
+ * `traceEnv` is the prompt's trace for this child, handed separately so it never reaches the
145
+ * stdin JSON. The child sees `process.env`, then ConversationAgent's value, then the hook's own `env`; a hook
146
+ * that sets its own `TRACEPARENT` wins and gets the ambient environment unchanged.
147
+ */
148
+ execute(definition: ICommandHookDefinition, input: IHookInput, traceEnv?: ISubprocessTraceEnv): Promise<THookOutcome>;
149
+ }
150
+ //#endregion
151
+ //#region src/hooks/executors/http-executor.d.ts
152
+ declare class HttpExecutor implements IHookTypeExecutor {
153
+ readonly type: "http";
154
+ execute(definition: IHttpHookDefinition, input: IHookInput): Promise<THookOutcome>;
155
+ }
156
+ //#endregion
157
+ //#region src/utils/ip-address.d.ts
158
+ /**
159
+ * Address classification for the egress boundary (#2026) — the "is this address public unicast?"
160
+ * half of `egress-policy.ts`, split out so each module holds one job: that one owns the FETCH
161
+ * (scheme, redirects, headers, deadline, byte cap), this one owns the ARITHMETIC of an address.
162
+ *
163
+ * The awkward part lives here on purpose. A literal destination reaches the policy already
164
+ * normalized by `URL` (`2130706433`, `0x7f.1` and `[::ffff:7f00:1]` all collapse to one hostname),
165
+ * but a RESOLVED one does not: `dns.lookup` renders an IPv4-mapped AAAA answer through `inet_ntop`,
166
+ * which prints the dotted spelling `::ffff:127.0.0.1`. So the expansion below accepts BOTH
167
+ * spellings rather than trusting any normalizer to have run — on the resolution path an attacker
168
+ * controls the record. Every "cannot parse" answer is `undefined`/`true`, i.e. NOT public: an
169
+ * address this module cannot read is never treated as reachable.
170
+ *
171
+ * Node-only (`node:net`): reached through `egress-policy.ts`, never the browser barrel.
172
+ */
173
+ /** True when `ip` (v4 or v6 text) is not a public unicast address. */
174
+ declare function isPrivateAddress(ip: string): boolean;
175
+ //#endregion
176
+ //#region src/utils/egress-policy.d.ts
177
+ type TEgressLookup = (hostname: string) => Promise<readonly string[]>;
178
+ interface IEgressPolicy {
179
+ /** Exact lowercase hostnames that may be reached even when they resolve to a private address. */
180
+ readonly allowedHosts?: readonly string[];
181
+ /** Explicit enterprise opt-out from private/loopback/metadata blocking. Default `false`. */
182
+ readonly allowPrivateAddresses?: boolean;
183
+ /** Redirect hops followed before refusing. Default 5. */
184
+ readonly maxRedirects?: number;
185
+ }
186
+ interface IEgressFetchOptions {
187
+ readonly headers?: Readonly<Record<string, string>>;
188
+ readonly signal?: AbortSignal;
189
+ /** Deadline for the WHOLE exchange, redirects and body included. Default 30 000 ms. */
190
+ readonly timeoutMs?: number;
191
+ /** Byte cap enforced on `Content-Length` and again while streaming. Default 5 000 000. */
192
+ readonly maxResponseBytes?: number;
193
+ }
194
+ interface IEgressDeps {
195
+ /** Trusted owner/test carrier: this override owns connect-time policy and socket lifetime. */
196
+ readonly fetch?: typeof globalThis.fetch;
197
+ readonly lookup?: TEgressLookup;
198
+ }
199
+ type TEgressRejectionReason = 'unsupported_scheme' | 'private_destination' | 'metadata_host' | 'unresolvable' | 'redirect_limit' | 'redirect_without_location' | 'redirect_refused' | 'response_too_large';
200
+ interface IEgressRejection {
201
+ readonly reason: TEgressRejectionReason;
202
+ readonly url: string;
203
+ readonly message: string;
204
+ }
205
+ type TEgressFetchResult = {
206
+ ok: true;
207
+ status: number;
208
+ statusText: string;
209
+ headers: Headers;
210
+ body: Uint8Array;
211
+ finalUrl: string;
212
+ } | {
213
+ ok: false;
214
+ rejection: IEgressRejection;
215
+ };
216
+ /** Hostnames that are metadata services or loopback by convention, whatever they resolve to. */
217
+ declare const BLOCKED_HOSTNAMES: ReadonlySet<string>;
218
+ /** Validate ONE destination URL against the policy. `undefined` means it may be reached. */
219
+ declare function rejectDestination(url: URL, policy?: IEgressPolicy, lookup?: TEgressLookup): Promise<IEgressRejection | undefined>;
220
+ interface IEgressExchange {
221
+ readonly response: Response;
222
+ close(): Promise<void>;
223
+ }
224
+ /**
225
+ * Open one manually redirected exchange without buffering its response. A streaming owner supplies
226
+ * the lifetime/deadline signal and must close the exchange on completion, cancellation and failure.
227
+ * No ambient dispatcher, second DNS resolution, URL rewrite or transport downgrade is selected.
228
+ */
229
+ declare function openEgressExchange(url: URL, init: RequestInit, policy: IEgressPolicy, deps: IEgressDeps, signal: AbortSignal): Promise<IEgressExchange | IEgressRejection>;
230
+ /**
231
+ * Fetch `url` under the egress policy. Policy outcomes are RETURNED (`ok: false`); transport errors
232
+ * (DNS failure at connect, refused connection, TLS, abort) are THROWN, as `fetch` throws them, so the
233
+ * caller's own error classification keeps working.
234
+ */
235
+ declare function fetchWithEgressPolicy(url: string, options?: IEgressFetchOptions, policy?: IEgressPolicy, deps?: IEgressDeps): Promise<TEgressFetchResult>;
236
+ interface IEgressPostOptions extends IEgressFetchOptions {
237
+ /** Sent as-is; a `URLSearchParams` or JSON string, never a stream, so it is never re-sent. */
238
+ readonly body: string | URLSearchParams;
239
+ }
240
+ /**
241
+ * POST `url` under the egress policy. The destination is validated as for a GET, but a redirect is
242
+ * REFUSED (`redirect_refused`), never followed: the body is the caller's to send to this URL alone.
243
+ */
244
+ declare function postWithEgressPolicy(url: string, options: IEgressPostOptions, policy?: IEgressPolicy, deps?: IEgressDeps): Promise<TEgressFetchResult>;
245
+ //#endregion
246
+ export { BLOCKED_HOSTNAMES, CommandExecutor, HttpExecutor, type IEgressDeps, type IEgressExchange, type IEgressFetchOptions, type IEgressPolicy, type IEgressPostOptions, type IEgressRejection, type IOwnerOnlyIo, OWNER_ONLY_DIRECTORY_MODE, OWNER_ONLY_FILE_MODE, OwnerOnlyModeError, type TEgressFetchResult, type TEgressLookup, type TEgressRejectionReason, canonicalizePath, ensureOwnerOnlyDirectory, fetchWithEgressPolicy, isPathInside, isPrivateAddress, openEgressExchange, ownerOnlyGuarantee, postWithEgressPolicy, rejectDestination, resolveTrustedExecutionRoot, tightenExistingFile, writeOwnerOnlyFile };
247
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","names":[],"sources":["../../src/utils/path-containment.ts","../../src/utils/owner-only-store.ts","../../src/hooks/executors/command-executor.ts","../../src/hooks/executors/http-executor.ts","../../src/utils/ip-address.ts","../../src/utils/egress-policy.ts"],"mappings":";;;;;;;;;iBA2BgB,4BAA4B;;;;;;;;;iBAoC5B,iBAAiB;;;;;;;;iBAwBjB,aAAa,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCjC9B;;cAEA;;cAMA,2BAA2B;EAC1B,YAAA;;;;;;;;iBAYE,mBACd;;;;;;;;UAYe;WACN,iBAAiB,gBAAgB;WACjC,WAAW,gBAAgB;WAC3B,YAAY;;UAGN,gCAAgC;;;;;;;;;;;;;;WActC;;;;;;;;iBAsCK,yBACd,mBACA,UAAS;;;;;;;;;iBA8BK,mBAAmB,kBAAkB;;;;;;;iBA2CrC,oBAAoB;;;cCnIvB,2BAA2B;mBAGT;WAFpB;EAEoB,YAAA;;;;;;EAO7B,QACE,YAAY,wBACZ,OAAO,YACP,WAAW,sBACV,QAAQ;;;;cC1EA,wBAAwB;WAC1B;EAEH,QAAQ,YAAY,qBAAqB,OAAO,aAAa,QAAQ;;;;;;;;;;;;;;;;;;;;iBCP7D,iBAAiB;;;KCWrB,iBAAiB,qBAAqB;UAEjC;;WAEN;;WAEA;;WAEA;;UAGM;WACN,UAAU,SAAS;WACnB,SAAS;;WAET;;WAEA;;UAGM;;WAEN,eAAe,WAAW;WAC1B,SAAS;;KAGR;UAUK;WACN,QAAQ;WACR;WACA;;KAGC;EAEN;EACA;EACA;EACA,SAAS;EACT,MAAM;EACN;;EAEA;EAAW,WAAW;;;cAWf,mBAAmB;;iBAaV,kBACpB,KAAK,KACL,SAAQ,eACR,SAAQ,gBACP,QAAQ;UAmDM;WACN,UAAU;EACnB,SAAS;;;;;;;iBA8BW,mBACpB,KAAK,KACL,MAAM,aACN,QAAQ,eACR,MAAM,aACN,QAAQ,cACP,QAAQ,kBAAkB;;;;;;iBA6EP,sBACpB,aACA,UAAS,qBACT,SAAQ,eACR,OAAM,cACL,QAAQ;UAqDM,2BAA2B;;WAEjC,eAAe;;;;;;iBAOJ,qBACpB,aACA,SAAS,oBACT,SAAQ,eACR,OAAM,cACL,QAAQ"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./command-executor-D_UBZHxh.js";import{t}from"./http-executor-ADn4locH.js";import{accessSync as n,chmodSync as r,constants as i,mkdirSync as a,realpathSync as o,renameSync as s,rmSync as c,statSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";import{basename as f,dirname as p,isAbsolute as m,join as h,relative as g,resolve as _,sep as v}from"node:path";import{lookup as y}from"node:dns/promises";import{isIP as b}from"node:net";import{Agent as x,fetch as S}from"undici/index.js";function C(e){if(typeof e!=`string`)throw TypeError(`executionRoot must be a string`);if(e.trim().length===0)throw TypeError(`executionRoot must be a non-empty string`);if(!m(e))throw TypeError(`executionRoot must be an absolute path`);let t;try{t=o(e)}catch{throw TypeError(`executionRoot must name an existing accessible directory`)}if(!l(t).isDirectory())throw TypeError(`executionRoot must name a directory`);try{n(t,i.R_OK|i.X_OK)}catch{throw TypeError(`executionRoot directory must be readable and traversable`)}return t}function w(e){let t=[],n=_(e);for(;;)try{return h(o(n),...t)}catch{let r=p(n);if(r===n)return _(e);t.unshift(f(n)),n=r}}function T(e,t){let n=w(e),r=w(t);return r===n||r.startsWith(n+v)}const E=384,D=448;var O=class extends Error{constructor(e){super(e),this.name=`OwnerOnlyModeError`}};function k(e=process.platform){return e===`win32`?`windows-acl`:`posix-mode`}function A(e,t){let n=g(e,t);if(n.startsWith(`..`)||m(n))throw new O(`withinRoot ${e} is not an ancestor of ${t}, so this call cannot own the path between them.`);let r=n.split(v).filter(e=>e.length>0),i=[e],a=e;for(let e of r)a=h(a,e),i.push(a);return i}function j(e,t,n={}){if(k()!==`posix-mode`)return;let r=(n.readMode??(e=>l(e).mode&4095))(e);if(r&63)throw new O(`${t} ${e} is mode 0${r.toString(8)} after being set owner-only; group or other permissions survived, so its contents are readable by another account.`)}function M(e,t={}){let n=t.makeDirectory??((e,t)=>{a(e,{recursive:!0,mode:t})}),i=t.setMode??((e,t)=>r(e,t));n(e,448);let o=t.withinRoot===void 0?[e]:A(t.withinRoot,e);for(let e of o)k()===`posix-mode`&&i(e,448),j(e,`directory`,t)}function N(e,t){M(p(e));let n=`${e}.${process.pid}.tmp`;c(n,{force:!0}),d(n,t,{encoding:`utf8`,mode:384,flag:`wx`});try{j(n,`file`),s(n,e)}catch(e){try{u(n)}catch{}throw e}j(e,`file`)}function P(e){if(k()!==`posix-mode`)return;let t;try{t=l(e).mode&4095}catch{return}t&63&&(r(e,384),j(e,`file`))}function F(e){let t=b(e);return t===4?I(e.split(`.`).map(Number)):t!==6||L(e)}function I(e){let[t=0,n=0,r=0]=e;return t===0||t===10||t===127||t===100&&n>=64&&n<=127||t===169&&n===254||t===172&&n>=16&&n<=31||t===192&&n===0&&r===0||t===192&&n===168||t===198&&(n===18||n===19)||t>=224}function L(e){let t=z(e);if(t===void 0)return!0;let[n=0,r=0,i=0,a=0,o=0,s=0,c=0,l=0]=t;return n===0&&r===0&&i===0&&a===0&&o===0&&s===65535||n===100&&r===65435&&i===0&&a===0&&o===0&&s===0?I([c>>8,c&255,l>>8,l&255]):n===0&&r===0&&i===0&&a===0&&o===0&&s===0||(n&65024)==64512||(n&65472)==65152||(n&65472)==65216||(n&65280)==65280}function R(e){let t=e.lastIndexOf(`:`),n=e.slice(t+1);if(!n.includes(`.`))return e;if(t<0||b(n)!==4)return;let[r=0,i=0,a=0,o=0]=n.split(`.`).map(Number),s=(r<<8|i).toString(16),c=(a<<8|o).toString(16);return`${e.slice(0,t+1)}${s}:${c}`}function z(e){let t=R(e.split(`%`)[0]??e);if(t===void 0)return;let n=t.split(`::`);if(n.length>2)return;let r=e=>e.length===0?[]:e.split(`:`).map(e=>Number.parseInt(e,16)),i=r(n[0]??``),a=n.length===2?r(n[1]??``):[],o=8-i.length-a.length;if(o<0||n.length===1&&o!==0)return;let s=[...i,...Array(o).fill(0),...a];return s.some(e=>Number.isNaN(e)||e<0||e>65535)?void 0:s}const B=3e4,V=5e6,H=new Set([301,302,303,307,308]),U=new Set([`localhost`,`metadata`,`metadata.google.internal`,`metadata.goog`,`instance-data`,`instance-data.ec2.internal`]),W=async e=>(await y(e,{all:!0,verbatim:!0})).map(e=>e.address);async function G(e,t={},n=W){let r=e.href;if(e.protocol!==`http:`&&e.protocol!==`https:`)return{reason:`unsupported_scheme`,url:r,message:`Only http(s) URLs may be fetched.`};if(t.allowPrivateAddresses===!0)return;let i=e.hostname.replace(/^\[|\]$/g,``).toLowerCase();if(t.allowedHosts?.includes(i))return;if(U.has(i)||i.endsWith(`.localhost`))return{reason:`metadata_host`,url:r,message:`Destination "${i}" is a loopback or cloud-metadata host and is not reachable from tools.`};let a=b(i)?[i]:await K(i,n);if(a===void 0||a.length===0)return{reason:`unresolvable`,url:r,message:`Destination "${i}" did not resolve.`};let o=a.find(F);if(o!==void 0)return{reason:`private_destination`,url:r,message:`Destination "${i}" resolves to ${o}, a private, loopback or link-local address, and is not reachable from tools.`}}async function K(e,t){try{return await t(e)}catch{return}}async function q(e,t,n){n.throwIfAborted();let r;try{return await Promise.race([t(e),new Promise((e,t)=>{r=()=>t(n.reason),n.addEventListener(`abort`,r,{once:!0}),n.aborted&&r()})])}finally{r&&n.removeEventListener(`abort`,r)}}async function J(e,t,n,r,i){let a=e.hostname.replace(/^\[|\]$/g,``).toLowerCase(),o,s=async e=>{let t=await q(e,r.lookup??W,i);if(t.length===0||t.some(e=>b(e)===0))throw Error(`Invalid DNS answer`);return o=Object.freeze([...t]),o},c=await G(e,n,s);if(i.throwIfAborted(),c)return c;if(r.fetch){let n=await r.fetch(e.href,{...t,signal:i,redirect:`manual`});return{response:n,close:async()=>{n.body&&!n.body.locked&&await n.body.cancel().catch(()=>void 0)}}}if(o??=b(a)?[a]:await K(a,s),i.throwIfAborted(),!o||o.length===0)return{reason:`unresolvable`,url:e.href,message:`Destination did not resolve to valid IP addresses.`};let l=o.map(e=>({address:e,family:b(e)})),u=new x({connections:1,pipelining:0,connect:{lookup:(e,t,n)=>{if(e.toLowerCase()!==a||i.aborted){n(Error(`Connection authority unavailable`),``,4);return}let r=typeof t==`number`?t:t.family,o=l.filter(e=>!r||e.family===r);if(o.length===0){n(Error(`No validated address family`),``,4);return}typeof t==`object`&&t.all?n(null,o):n(null,o[0].address,o[0].family)}}});if(typeof u.dispatch!=`function`||typeof u.destroy!=`function`)throw Error(`Pinned HTTP transport is unavailable in this runtime`);try{return{response:await S(e.href,{...t,signal:i,redirect:`manual`,dispatcher:u}),close:async()=>{await u.destroy()}}}catch(e){throw await u.destroy(),e}}async function Y(e,t={},n={},r={}){let i=t.maxResponseBytes??V,a=n.maxRedirects??5,o=AbortSignal.timeout(t.timeoutMs??B),s=t.signal?AbortSignal.any([o,t.signal]):o,c=new URL(e),l={...t.headers??{}};for(let e=0;;e+=1){let t=await J(c,{headers:l,signal:s,redirect:`manual`},n,r,s);if(!(`response`in t))return{ok:!1,rejection:t};try{let n=t.response;if(!H.has(n.status))return await Q(n,c.href,i,s);let r=n.headers.get(`location`);if(r===null)return{ok:!1,rejection:{reason:`redirect_without_location`,url:c.href,message:`HTTP ${n.status} without a Location header.`}};if(e>=a)return{ok:!1,rejection:{reason:`redirect_limit`,url:c.href,message:`More than ${a} redirects.`}};let o=new URL(r,c);o.origin!==c.origin&&(l=Z(l)),c=o}finally{await t.close()}}}async function X(e,t,n={},r={}){let i=t.maxResponseBytes??V,a=AbortSignal.timeout(t.timeoutMs??B),o=t.signal?AbortSignal.any([a,t.signal]):a,s=new URL(e),c=await J(s,{method:`POST`,headers:{...t.headers??{}},body:t.body,signal:o,redirect:`manual`},n,r,o);if(!(`response`in c))return{ok:!1,rejection:c};try{let e=c.response;return e.status>=300&&e.status<400?(await e.body?.cancel().catch(()=>void 0),{ok:!1,rejection:{reason:`redirect_refused`,url:s.href,message:`HTTP ${e.status}: a POST is never redirected.`}}):await Q(e,s.href,i,o)}finally{await c.close()}}function Z(e){let t={};for(let[n,r]of Object.entries(e))n.toLowerCase()===`user-agent`&&(t[n]=r);return t}async function Q(e,t,n,r){let i=e=>({ok:!1,rejection:{reason:`response_too_large`,url:t,message:`Response exceeds ${n} bytes (${e} seen).`}}),a=Number(e.headers.get(`content-length`));if(Number.isFinite(a)&&a>n)return await e.body?.cancel(),i(a);let o=[],s=0;if(!e.body&&typeof e.arrayBuffer==`function`){let t=new Uint8Array(await e.arrayBuffer());if(t.byteLength>n)return i(t.byteLength);o.push(t),s=t.byteLength}else if(e.body){let t=e.body.getReader();for(;;){r.throwIfAborted();let{done:e,value:a}=await t.read();if(e)break;if(s+=a.byteLength,s>n)return await t.cancel(),i(s);o.push(a)}}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.byteLength;return{ok:!0,status:e.status,statusText:e.statusText,headers:e.headers,body:c,finalUrl:t}}export{U as BLOCKED_HOSTNAMES,e as CommandExecutor,t as HttpExecutor,D as OWNER_ONLY_DIRECTORY_MODE,E as OWNER_ONLY_FILE_MODE,O as OwnerOnlyModeError,w as canonicalizePath,M as ensureOwnerOnlyDirectory,Y as fetchWithEgressPolicy,T as isPathInside,F as isPrivateAddress,J as openEgressExchange,k as ownerOnlyGuarantee,X as postWithEgressPolicy,G as rejectDestination,C as resolveTrustedExecutionRoot,P as tightenExistingFile,N as writeOwnerOnlyFile};
2
+ //# sourceMappingURL=node.js.map