dsh-botgroup 0.0.0-stage → 0.6.7

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 (810) hide show
  1. package/LICENSE +18 -0
  2. package/README.en.md +180 -0
  3. package/README.md +179 -2
  4. package/THIRD_PARTY_NOTICES.txt +212 -0
  5. package/assets/logo-1024.png +0 -0
  6. package/cordis.patch.yml +13 -0
  7. package/icon.svg +9 -0
  8. package/lib/client.js +28298 -0
  9. package/lib/client.js.map +7 -0
  10. package/lib/host/activity/first-user.d.ts +16 -0
  11. package/lib/host/activity/first-user.js +25 -0
  12. package/lib/host/activity/first-user.js.map +1 -0
  13. package/lib/host/activity/preview.d.ts +2 -0
  14. package/lib/host/activity/preview.js +5 -0
  15. package/lib/host/activity/preview.js.map +1 -0
  16. package/lib/host/activity/remote.d.ts +15 -0
  17. package/lib/host/activity/remote.js +66 -0
  18. package/lib/host/activity/remote.js.map +1 -0
  19. package/lib/host/activity/tracker.d.ts +12 -0
  20. package/lib/host/activity/tracker.js +157 -0
  21. package/lib/host/activity/tracker.js.map +1 -0
  22. package/lib/host/automation/coordinator.d.ts +26 -0
  23. package/lib/host/automation/coordinator.js +58 -0
  24. package/lib/host/automation/coordinator.js.map +1 -0
  25. package/lib/host/automation/delivery.d.ts +16 -0
  26. package/lib/host/automation/delivery.js +65 -0
  27. package/lib/host/automation/delivery.js.map +1 -0
  28. package/lib/host/automation/errors.d.ts +16 -0
  29. package/lib/host/automation/errors.js +19 -0
  30. package/lib/host/automation/errors.js.map +1 -0
  31. package/lib/host/automation/index.d.ts +2 -0
  32. package/lib/host/automation/index.js +4 -0
  33. package/lib/host/automation/index.js.map +1 -0
  34. package/lib/host/automation/remote.d.ts +280 -0
  35. package/lib/host/automation/remote.js +152 -0
  36. package/lib/host/automation/remote.js.map +1 -0
  37. package/lib/host/automation/store.d.ts +297 -0
  38. package/lib/host/automation/store.js +286 -0
  39. package/lib/host/automation/store.js.map +1 -0
  40. package/lib/host/bot-context.d.ts +11 -0
  41. package/lib/host/bot-context.js +318 -0
  42. package/lib/host/bot-context.js.map +1 -0
  43. package/lib/host/capabilities/platform.d.ts +17 -0
  44. package/lib/host/capabilities/platform.js +17 -0
  45. package/lib/host/capabilities/platform.js.map +1 -0
  46. package/lib/host/capabilities/remote.d.ts +94 -0
  47. package/lib/host/capabilities/remote.js +59 -0
  48. package/lib/host/capabilities/remote.js.map +1 -0
  49. package/lib/host/capabilities/service.d.ts +82 -0
  50. package/lib/host/capabilities/service.js +144 -0
  51. package/lib/host/capabilities/service.js.map +1 -0
  52. package/lib/host/collaboration/remote.d.ts +89 -0
  53. package/lib/host/collaboration/remote.js +109 -0
  54. package/lib/host/collaboration/remote.js.map +1 -0
  55. package/lib/host/collaboration/service.d.ts +61 -0
  56. package/lib/host/collaboration/service.js +191 -0
  57. package/lib/host/collaboration/service.js.map +1 -0
  58. package/lib/host/common/integration-stores.d.ts +162 -0
  59. package/lib/host/common/integration-stores.js +50 -0
  60. package/lib/host/common/integration-stores.js.map +1 -0
  61. package/lib/host/common/operations.d.ts +23 -0
  62. package/lib/host/common/operations.js +38 -0
  63. package/lib/host/common/operations.js.map +1 -0
  64. package/lib/host/composer.d.ts +15 -0
  65. package/lib/host/composer.js +102 -0
  66. package/lib/host/composer.js.map +1 -0
  67. package/lib/host/connectors/remote.d.ts +215 -0
  68. package/lib/host/connectors/remote.js +111 -0
  69. package/lib/host/connectors/remote.js.map +1 -0
  70. package/lib/host/connectors/service.d.ts +150 -0
  71. package/lib/host/connectors/service.js +491 -0
  72. package/lib/host/connectors/service.js.map +1 -0
  73. package/lib/host/data-flow/agent-binding.d.ts +8 -0
  74. package/lib/host/data-flow/agent-binding.js +4 -0
  75. package/lib/host/data-flow/agent-binding.js.map +1 -0
  76. package/lib/host/data-flow/connector-boundary.d.ts +7 -0
  77. package/lib/host/data-flow/connector-boundary.js +33 -0
  78. package/lib/host/data-flow/connector-boundary.js.map +1 -0
  79. package/lib/host/data-flow/delegation.d.ts +6 -0
  80. package/lib/host/data-flow/delegation.js +72 -0
  81. package/lib/host/data-flow/delegation.js.map +1 -0
  82. package/lib/host/data-flow/egress.d.ts +26 -0
  83. package/lib/host/data-flow/egress.js +118 -0
  84. package/lib/host/data-flow/egress.js.map +1 -0
  85. package/lib/host/data-flow/grants.d.ts +18 -0
  86. package/lib/host/data-flow/grants.js +39 -0
  87. package/lib/host/data-flow/grants.js.map +1 -0
  88. package/lib/host/data-flow/graph-capability.d.ts +3 -0
  89. package/lib/host/data-flow/graph-capability.js +21 -0
  90. package/lib/host/data-flow/graph-capability.js.map +1 -0
  91. package/lib/host/data-flow/labels.d.ts +6 -0
  92. package/lib/host/data-flow/labels.js +30 -0
  93. package/lib/host/data-flow/labels.js.map +1 -0
  94. package/lib/host/data-flow/lineage.d.ts +10 -0
  95. package/lib/host/data-flow/lineage.js +35 -0
  96. package/lib/host/data-flow/lineage.js.map +1 -0
  97. package/lib/host/data-flow/managed-copies.d.ts +208 -0
  98. package/lib/host/data-flow/managed-copies.js +37 -0
  99. package/lib/host/data-flow/managed-copies.js.map +1 -0
  100. package/lib/host/data-flow/native-policy.d.ts +26 -0
  101. package/lib/host/data-flow/native-policy.js +86 -0
  102. package/lib/host/data-flow/native-policy.js.map +1 -0
  103. package/lib/host/data-flow/outlets.d.ts +55 -0
  104. package/lib/host/data-flow/outlets.js +307 -0
  105. package/lib/host/data-flow/outlets.js.map +1 -0
  106. package/lib/host/data-flow/tool-guard.d.ts +13 -0
  107. package/lib/host/data-flow/tool-guard.js +114 -0
  108. package/lib/host/data-flow/tool-guard.js.map +1 -0
  109. package/lib/host/delegate/continuation.d.ts +5 -0
  110. package/lib/host/delegate/continuation.js +44 -0
  111. package/lib/host/delegate/continuation.js.map +1 -0
  112. package/lib/host/delegate/guard.d.ts +7 -0
  113. package/lib/host/delegate/guard.js +49 -0
  114. package/lib/host/delegate/guard.js.map +1 -0
  115. package/lib/host/delegate/tool.d.ts +3 -0
  116. package/lib/host/delegate/tool.js +180 -0
  117. package/lib/host/delegate/tool.js.map +1 -0
  118. package/lib/host/errors.d.ts +9 -0
  119. package/lib/host/errors.js +17 -0
  120. package/lib/host/errors.js.map +1 -0
  121. package/lib/host/groups/concurrent.d.ts +29 -0
  122. package/lib/host/groups/concurrent.js +272 -0
  123. package/lib/host/groups/concurrent.js.map +1 -0
  124. package/lib/host/groups/data-flow.d.ts +21 -0
  125. package/lib/host/groups/data-flow.js +54 -0
  126. package/lib/host/groups/data-flow.js.map +1 -0
  127. package/lib/host/groups/failure.d.ts +10 -0
  128. package/lib/host/groups/failure.js +36 -0
  129. package/lib/host/groups/failure.js.map +1 -0
  130. package/lib/host/groups/members.d.ts +105 -0
  131. package/lib/host/groups/members.js +204 -0
  132. package/lib/host/groups/members.js.map +1 -0
  133. package/lib/host/groups/messages.d.ts +335 -0
  134. package/lib/host/groups/messages.js +148 -0
  135. package/lib/host/groups/messages.js.map +1 -0
  136. package/lib/host/groups/model-selection.d.ts +15 -0
  137. package/lib/host/groups/model-selection.js +12 -0
  138. package/lib/host/groups/model-selection.js.map +1 -0
  139. package/lib/host/groups/model.d.ts +266 -0
  140. package/lib/host/groups/model.js +22 -0
  141. package/lib/host/groups/model.js.map +1 -0
  142. package/lib/host/groups/owner-follow-up.d.ts +4 -0
  143. package/lib/host/groups/owner-follow-up.js +34 -0
  144. package/lib/host/groups/owner-follow-up.js.map +1 -0
  145. package/lib/host/groups/recall-sessions.d.ts +32 -0
  146. package/lib/host/groups/recall-sessions.js +145 -0
  147. package/lib/host/groups/recall-sessions.js.map +1 -0
  148. package/lib/host/groups/recall-tool.d.ts +9 -0
  149. package/lib/host/groups/recall-tool.js +275 -0
  150. package/lib/host/groups/recall-tool.js.map +1 -0
  151. package/lib/host/groups/recall.d.ts +37 -0
  152. package/lib/host/groups/recall.js +406 -0
  153. package/lib/host/groups/recall.js.map +1 -0
  154. package/lib/host/groups/remote.d.ts +902 -0
  155. package/lib/host/groups/remote.js +146 -0
  156. package/lib/host/groups/remote.js.map +1 -0
  157. package/lib/host/groups/root-guard.d.ts +26 -0
  158. package/lib/host/groups/root-guard.js +59 -0
  159. package/lib/host/groups/root-guard.js.map +1 -0
  160. package/lib/host/groups/roots.d.ts +25 -0
  161. package/lib/host/groups/roots.js +225 -0
  162. package/lib/host/groups/roots.js.map +1 -0
  163. package/lib/host/groups/round-robin.d.ts +2 -0
  164. package/lib/host/groups/round-robin.js +7 -0
  165. package/lib/host/groups/round-robin.js.map +1 -0
  166. package/lib/host/groups/routing.d.ts +8 -0
  167. package/lib/host/groups/routing.js +62 -0
  168. package/lib/host/groups/routing.js.map +1 -0
  169. package/lib/host/groups/service.d.ts +1204 -0
  170. package/lib/host/groups/service.js +286 -0
  171. package/lib/host/groups/service.js.map +1 -0
  172. package/lib/host/groups/state.d.ts +818 -0
  173. package/lib/host/groups/state.js +227 -0
  174. package/lib/host/groups/state.js.map +1 -0
  175. package/lib/host/groups/turn-runner.d.ts +181 -0
  176. package/lib/host/groups/turn-runner.js +578 -0
  177. package/lib/host/groups/turn-runner.js.map +1 -0
  178. package/lib/host/groups/turns.d.ts +657 -0
  179. package/lib/host/groups/turns.js +480 -0
  180. package/lib/host/groups/turns.js.map +1 -0
  181. package/lib/host/groups/worker-tool.d.ts +43 -0
  182. package/lib/host/groups/worker-tool.js +86 -0
  183. package/lib/host/groups/worker-tool.js.map +1 -0
  184. package/lib/host/home.d.ts +27 -0
  185. package/lib/host/home.js +221 -0
  186. package/lib/host/home.js.map +1 -0
  187. package/lib/host/im/service.d.ts +4 -0
  188. package/lib/host/im/service.js +20 -0
  189. package/lib/host/im/service.js.map +1 -0
  190. package/lib/host/index.d.ts +9 -0
  191. package/lib/host/index.js +270 -0
  192. package/lib/host/index.js.map +1 -0
  193. package/lib/host/live-persona.d.ts +9 -0
  194. package/lib/host/live-persona.js +102 -0
  195. package/lib/host/live-persona.js.map +1 -0
  196. package/lib/host/main-session.d.ts +45 -0
  197. package/lib/host/main-session.js +249 -0
  198. package/lib/host/main-session.js.map +1 -0
  199. package/lib/host/memory/admission.d.ts +46 -0
  200. package/lib/host/memory/admission.js +269 -0
  201. package/lib/host/memory/admission.js.map +1 -0
  202. package/lib/host/memory/auto-share.d.ts +36 -0
  203. package/lib/host/memory/auto-share.js +38 -0
  204. package/lib/host/memory/auto-share.js.map +1 -0
  205. package/lib/host/memory/confirmation.d.ts +145 -0
  206. package/lib/host/memory/confirmation.js +88 -0
  207. package/lib/host/memory/confirmation.js.map +1 -0
  208. package/lib/host/memory/conflicts.d.ts +16 -0
  209. package/lib/host/memory/conflicts.js +87 -0
  210. package/lib/host/memory/conflicts.js.map +1 -0
  211. package/lib/host/memory/context.d.ts +16 -0
  212. package/lib/host/memory/context.js +96 -0
  213. package/lib/host/memory/context.js.map +1 -0
  214. package/lib/host/memory/domain-v2.d.ts +338 -0
  215. package/lib/host/memory/domain-v2.js +21 -0
  216. package/lib/host/memory/domain-v2.js.map +1 -0
  217. package/lib/host/memory/facade.d.ts +31 -0
  218. package/lib/host/memory/facade.js +182 -0
  219. package/lib/host/memory/facade.js.map +1 -0
  220. package/lib/host/memory/forget-preview.d.ts +27 -0
  221. package/lib/host/memory/forget-preview.js +100 -0
  222. package/lib/host/memory/forget-preview.js.map +1 -0
  223. package/lib/host/memory/forget-runner.d.ts +31 -0
  224. package/lib/host/memory/forget-runner.js +167 -0
  225. package/lib/host/memory/forget-runner.js.map +1 -0
  226. package/lib/host/memory/forget-service.d.ts +65 -0
  227. package/lib/host/memory/forget-service.js +169 -0
  228. package/lib/host/memory/forget-service.js.map +1 -0
  229. package/lib/host/memory/history-proof.d.ts +5 -0
  230. package/lib/host/memory/history-proof.js +37 -0
  231. package/lib/host/memory/history-proof.js.map +1 -0
  232. package/lib/host/memory/history.d.ts +31 -0
  233. package/lib/host/memory/history.js +45 -0
  234. package/lib/host/memory/history.js.map +1 -0
  235. package/lib/host/memory/layout-upgrade.d.ts +8 -0
  236. package/lib/host/memory/layout-upgrade.js +51 -0
  237. package/lib/host/memory/layout-upgrade.js.map +1 -0
  238. package/lib/host/memory/migration.d.ts +23 -0
  239. package/lib/host/memory/migration.js +105 -0
  240. package/lib/host/memory/migration.js.map +1 -0
  241. package/lib/host/memory/op-log.d.ts +44 -0
  242. package/lib/host/memory/op-log.js +155 -0
  243. package/lib/host/memory/op-log.js.map +1 -0
  244. package/lib/host/memory/open-v2.d.ts +7 -0
  245. package/lib/host/memory/open-v2.js +30 -0
  246. package/lib/host/memory/open-v2.js.map +1 -0
  247. package/lib/host/memory/owner-lease.d.ts +9 -0
  248. package/lib/host/memory/owner-lease.js +105 -0
  249. package/lib/host/memory/owner-lease.js.map +1 -0
  250. package/lib/host/memory/persistent-map.d.ts +40 -0
  251. package/lib/host/memory/persistent-map.js +88 -0
  252. package/lib/host/memory/persistent-map.js.map +1 -0
  253. package/lib/host/memory/port.d.ts +10 -0
  254. package/lib/host/memory/port.js +3 -0
  255. package/lib/host/memory/port.js.map +1 -0
  256. package/lib/host/memory/preserve-inbox.d.ts +7 -0
  257. package/lib/host/memory/preserve-inbox.js +45 -0
  258. package/lib/host/memory/preserve-inbox.js.map +1 -0
  259. package/lib/host/memory/projection.d.ts +22 -0
  260. package/lib/host/memory/projection.js +89 -0
  261. package/lib/host/memory/projection.js.map +1 -0
  262. package/lib/host/memory/prompt.d.ts +3 -0
  263. package/lib/host/memory/prompt.js +56 -0
  264. package/lib/host/memory/prompt.js.map +1 -0
  265. package/lib/host/memory/query.d.ts +5 -0
  266. package/lib/host/memory/query.js +8 -0
  267. package/lib/host/memory/query.js.map +1 -0
  268. package/lib/host/memory/quota-replay.d.ts +4 -0
  269. package/lib/host/memory/quota-replay.js +22 -0
  270. package/lib/host/memory/quota-replay.js.map +1 -0
  271. package/lib/host/memory/quota.d.ts +152 -0
  272. package/lib/host/memory/quota.js +101 -0
  273. package/lib/host/memory/quota.js.map +1 -0
  274. package/lib/host/memory/remote.d.ts +164 -0
  275. package/lib/host/memory/remote.js +191 -0
  276. package/lib/host/memory/remote.js.map +1 -0
  277. package/lib/host/memory/retrieval-aliases.json +55 -0
  278. package/lib/host/memory/retrieval-config.d.ts +15 -0
  279. package/lib/host/memory/retrieval-config.js +17 -0
  280. package/lib/host/memory/retrieval-config.js.map +1 -0
  281. package/lib/host/memory/retrieval-rank.d.ts +16 -0
  282. package/lib/host/memory/retrieval-rank.js +88 -0
  283. package/lib/host/memory/retrieval-rank.js.map +1 -0
  284. package/lib/host/memory/retrieval-text.d.ts +3 -0
  285. package/lib/host/memory/retrieval-text.js +34 -0
  286. package/lib/host/memory/retrieval-text.js.map +1 -0
  287. package/lib/host/memory/root-instructions.d.ts +4 -0
  288. package/lib/host/memory/root-instructions.js +21 -0
  289. package/lib/host/memory/root-instructions.js.map +1 -0
  290. package/lib/host/memory/secrets.d.ts +6 -0
  291. package/lib/host/memory/secrets.js +12 -0
  292. package/lib/host/memory/secrets.js.map +1 -0
  293. package/lib/host/memory/service.d.ts +59 -0
  294. package/lib/host/memory/service.js +148 -0
  295. package/lib/host/memory/service.js.map +1 -0
  296. package/lib/host/memory/shards.d.ts +4 -0
  297. package/lib/host/memory/shards.js +12 -0
  298. package/lib/host/memory/shards.js.map +1 -0
  299. package/lib/host/memory/store-v2.d.ts +37 -0
  300. package/lib/host/memory/store-v2.js +156 -0
  301. package/lib/host/memory/store-v2.js.map +1 -0
  302. package/lib/host/memory/temporal.d.ts +18 -0
  303. package/lib/host/memory/temporal.js +53 -0
  304. package/lib/host/memory/temporal.js.map +1 -0
  305. package/lib/host/memory/tool-guidance.d.ts +3 -0
  306. package/lib/host/memory/tool-guidance.js +11 -0
  307. package/lib/host/memory/tool-guidance.js.map +1 -0
  308. package/lib/host/memory/tools.d.ts +6 -0
  309. package/lib/host/memory/tools.js +121 -0
  310. package/lib/host/memory/tools.js.map +1 -0
  311. package/lib/host/memory/trusted-ingress.d.ts +14 -0
  312. package/lib/host/memory/trusted-ingress.js +13 -0
  313. package/lib/host/memory/trusted-ingress.js.map +1 -0
  314. package/lib/host/memory/version.d.ts +135 -0
  315. package/lib/host/memory/version.js +17 -0
  316. package/lib/host/memory/version.js.map +1 -0
  317. package/lib/host/messaging/config.d.ts +55 -0
  318. package/lib/host/messaging/config.js +44 -0
  319. package/lib/host/messaging/config.js.map +1 -0
  320. package/lib/host/messaging/core.d.ts +279 -0
  321. package/lib/host/messaging/core.js +109 -0
  322. package/lib/host/messaging/core.js.map +1 -0
  323. package/lib/host/messaging/delivery.d.ts +6 -0
  324. package/lib/host/messaging/delivery.js +237 -0
  325. package/lib/host/messaging/delivery.js.map +1 -0
  326. package/lib/host/messaging/evidence.d.ts +15 -0
  327. package/lib/host/messaging/evidence.js +63 -0
  328. package/lib/host/messaging/evidence.js.map +1 -0
  329. package/lib/host/messaging/interrupt.d.ts +3 -0
  330. package/lib/host/messaging/interrupt.js +15 -0
  331. package/lib/host/messaging/interrupt.js.map +1 -0
  332. package/lib/host/messaging/recovery.d.ts +19 -0
  333. package/lib/host/messaging/recovery.js +114 -0
  334. package/lib/host/messaging/recovery.js.map +1 -0
  335. package/lib/host/messaging/remote.d.ts +92 -0
  336. package/lib/host/messaging/remote.js +119 -0
  337. package/lib/host/messaging/remote.js.map +1 -0
  338. package/lib/host/messaging/reply-routing.d.ts +6 -0
  339. package/lib/host/messaging/reply-routing.js +203 -0
  340. package/lib/host/messaging/reply-routing.js.map +1 -0
  341. package/lib/host/messaging/safety.d.ts +29 -0
  342. package/lib/host/messaging/safety.js +78 -0
  343. package/lib/host/messaging/safety.js.map +1 -0
  344. package/lib/host/messaging/service.d.ts +22 -0
  345. package/lib/host/messaging/service.js +56 -0
  346. package/lib/host/messaging/service.js.map +1 -0
  347. package/lib/host/messaging/store.d.ts +732 -0
  348. package/lib/host/messaging/store.js +310 -0
  349. package/lib/host/messaging/store.js.map +1 -0
  350. package/lib/host/messaging/tool.d.ts +3 -0
  351. package/lib/host/messaging/tool.js +100 -0
  352. package/lib/host/messaging/tool.js.map +1 -0
  353. package/lib/host/messaging/wake.d.ts +5 -0
  354. package/lib/host/messaging/wake.js +14 -0
  355. package/lib/host/messaging/wake.js.map +1 -0
  356. package/lib/host/native-schedule/outcomes.d.ts +30 -0
  357. package/lib/host/native-schedule/outcomes.js +31 -0
  358. package/lib/host/native-schedule/outcomes.js.map +1 -0
  359. package/lib/host/native-schedule/service.d.ts +47 -0
  360. package/lib/host/native-schedule/service.js +164 -0
  361. package/lib/host/native-schedule/service.js.map +1 -0
  362. package/lib/host/notifications/data-flow.d.ts +6 -0
  363. package/lib/host/notifications/data-flow.js +56 -0
  364. package/lib/host/notifications/data-flow.js.map +1 -0
  365. package/lib/host/notifications/remote.d.ts +111 -0
  366. package/lib/host/notifications/remote.js +78 -0
  367. package/lib/host/notifications/remote.js.map +1 -0
  368. package/lib/host/notifications/service.d.ts +443 -0
  369. package/lib/host/notifications/service.js +466 -0
  370. package/lib/host/notifications/service.js.map +1 -0
  371. package/lib/host/notifications/time.d.ts +6 -0
  372. package/lib/host/notifications/time.js +21 -0
  373. package/lib/host/notifications/time.js.map +1 -0
  374. package/lib/host/notifications/tool.d.ts +4 -0
  375. package/lib/host/notifications/tool.js +97 -0
  376. package/lib/host/notifications/tool.js.map +1 -0
  377. package/lib/host/onboarding/coordinator.d.ts +87 -0
  378. package/lib/host/onboarding/coordinator.js +332 -0
  379. package/lib/host/onboarding/coordinator.js.map +1 -0
  380. package/lib/host/onboarding/guard.d.ts +5 -0
  381. package/lib/host/onboarding/guard.js +71 -0
  382. package/lib/host/onboarding/guard.js.map +1 -0
  383. package/lib/host/proactive/auto-admission.d.ts +17 -0
  384. package/lib/host/proactive/auto-admission.js +51 -0
  385. package/lib/host/proactive/auto-admission.js.map +1 -0
  386. package/lib/host/proactive/config.d.ts +192 -0
  387. package/lib/host/proactive/config.js +78 -0
  388. package/lib/host/proactive/config.js.map +1 -0
  389. package/lib/host/proactive/coordinator-client.d.ts +17 -0
  390. package/lib/host/proactive/coordinator-client.js +143 -0
  391. package/lib/host/proactive/coordinator-client.js.map +1 -0
  392. package/lib/host/proactive/deferred-notices.d.ts +21 -0
  393. package/lib/host/proactive/deferred-notices.js +147 -0
  394. package/lib/host/proactive/deferred-notices.js.map +1 -0
  395. package/lib/host/proactive/execution-prompt.d.ts +4 -0
  396. package/lib/host/proactive/execution-prompt.js +23 -0
  397. package/lib/host/proactive/execution-prompt.js.map +1 -0
  398. package/lib/host/proactive/execution.d.ts +36 -0
  399. package/lib/host/proactive/execution.js +607 -0
  400. package/lib/host/proactive/execution.js.map +1 -0
  401. package/lib/host/proactive/executors/command.d.ts +49 -0
  402. package/lib/host/proactive/executors/command.js +117 -0
  403. package/lib/host/proactive/executors/command.js.map +1 -0
  404. package/lib/host/proactive/executors/json-command-bridge-entry.d.ts +1 -0
  405. package/lib/host/proactive/executors/json-command-bridge-entry.js +29 -0
  406. package/lib/host/proactive/executors/json-command-bridge-entry.js.map +1 -0
  407. package/lib/host/proactive/executors/json-command-bridge.d.ts +46 -0
  408. package/lib/host/proactive/executors/json-command-bridge.js +135 -0
  409. package/lib/host/proactive/executors/json-command-bridge.js.map +1 -0
  410. package/lib/host/proactive/executors/loopback.d.ts +23 -0
  411. package/lib/host/proactive/executors/loopback.js +136 -0
  412. package/lib/host/proactive/executors/loopback.js.map +1 -0
  413. package/lib/host/proactive/feedback-workflow.d.ts +1336 -0
  414. package/lib/host/proactive/feedback-workflow.js +194 -0
  415. package/lib/host/proactive/feedback-workflow.js.map +1 -0
  416. package/lib/host/proactive/feedback.d.ts +25 -0
  417. package/lib/host/proactive/feedback.js +107 -0
  418. package/lib/host/proactive/feedback.js.map +1 -0
  419. package/lib/host/proactive/follow-up-events.d.ts +45 -0
  420. package/lib/host/proactive/follow-up-events.js +328 -0
  421. package/lib/host/proactive/follow-up-events.js.map +1 -0
  422. package/lib/host/proactive/follow-up-facts.d.ts +5 -0
  423. package/lib/host/proactive/follow-up-facts.js +34 -0
  424. package/lib/host/proactive/follow-up-facts.js.map +1 -0
  425. package/lib/host/proactive/follow-up-tool.d.ts +4 -0
  426. package/lib/host/proactive/follow-up-tool.js +195 -0
  427. package/lib/host/proactive/follow-up-tool.js.map +1 -0
  428. package/lib/host/proactive/governance-artifacts.d.ts +8 -0
  429. package/lib/host/proactive/governance-artifacts.js +182 -0
  430. package/lib/host/proactive/governance-artifacts.js.map +1 -0
  431. package/lib/host/proactive/governance-service.d.ts +39 -0
  432. package/lib/host/proactive/governance-service.js +146 -0
  433. package/lib/host/proactive/governance-service.js.map +1 -0
  434. package/lib/host/proactive/group-budget.d.ts +25 -0
  435. package/lib/host/proactive/group-budget.js +145 -0
  436. package/lib/host/proactive/group-budget.js.map +1 -0
  437. package/lib/host/proactive/group-follow-up.d.ts +10 -0
  438. package/lib/host/proactive/group-follow-up.js +95 -0
  439. package/lib/host/proactive/group-follow-up.js.map +1 -0
  440. package/lib/host/proactive/group-repair.d.ts +93 -0
  441. package/lib/host/proactive/group-repair.js +283 -0
  442. package/lib/host/proactive/group-repair.js.map +1 -0
  443. package/lib/host/proactive/index.d.ts +10 -0
  444. package/lib/host/proactive/index.js +26 -0
  445. package/lib/host/proactive/index.js.map +1 -0
  446. package/lib/host/proactive/lifecycle.d.ts +24 -0
  447. package/lib/host/proactive/lifecycle.js +187 -0
  448. package/lib/host/proactive/lifecycle.js.map +1 -0
  449. package/lib/host/proactive/method-evaluation.d.ts +5 -0
  450. package/lib/host/proactive/method-evaluation.js +41 -0
  451. package/lib/host/proactive/method-evaluation.js.map +1 -0
  452. package/lib/host/proactive/method-package.d.ts +33 -0
  453. package/lib/host/proactive/method-package.js +25 -0
  454. package/lib/host/proactive/method-package.js.map +1 -0
  455. package/lib/host/proactive/method-skill.d.ts +7 -0
  456. package/lib/host/proactive/method-skill.js +20 -0
  457. package/lib/host/proactive/method-skill.js.map +1 -0
  458. package/lib/host/proactive/model-budget.d.ts +10 -0
  459. package/lib/host/proactive/model-budget.js +48 -0
  460. package/lib/host/proactive/model-budget.js.map +1 -0
  461. package/lib/host/proactive/notice-pump.d.ts +16 -0
  462. package/lib/host/proactive/notice-pump.js +174 -0
  463. package/lib/host/proactive/notice-pump.js.map +1 -0
  464. package/lib/host/proactive/notification-bridge.d.ts +3 -0
  465. package/lib/host/proactive/notification-bridge.js +26 -0
  466. package/lib/host/proactive/notification-bridge.js.map +1 -0
  467. package/lib/host/proactive/read-query.d.ts +4 -0
  468. package/lib/host/proactive/read-query.js +53 -0
  469. package/lib/host/proactive/read-query.js.map +1 -0
  470. package/lib/host/proactive/remote.d.ts +4910 -0
  471. package/lib/host/proactive/remote.js +351 -0
  472. package/lib/host/proactive/remote.js.map +1 -0
  473. package/lib/host/proactive/repair.d.ts +48 -0
  474. package/lib/host/proactive/repair.js +205 -0
  475. package/lib/host/proactive/repair.js.map +1 -0
  476. package/lib/host/proactive/result-journal.d.ts +215 -0
  477. package/lib/host/proactive/result-journal.js +132 -0
  478. package/lib/host/proactive/result-journal.js.map +1 -0
  479. package/lib/host/proactive/service.d.ts +30446 -0
  480. package/lib/host/proactive/service.js +1632 -0
  481. package/lib/host/proactive/service.js.map +1 -0
  482. package/lib/host/proactive/setup.d.ts +13 -0
  483. package/lib/host/proactive/setup.js +94 -0
  484. package/lib/host/proactive/setup.js.map +1 -0
  485. package/lib/host/proactive/sources/ci-feed.d.ts +21 -0
  486. package/lib/host/proactive/sources/ci-feed.js +86 -0
  487. package/lib/host/proactive/sources/ci-feed.js.map +1 -0
  488. package/lib/host/proactive/sources/ci.d.ts +35 -0
  489. package/lib/host/proactive/sources/ci.js +72 -0
  490. package/lib/host/proactive/sources/ci.js.map +1 -0
  491. package/lib/host/proactive/sources/github-ci.d.ts +16 -0
  492. package/lib/host/proactive/sources/github-ci.js +117 -0
  493. package/lib/host/proactive/sources/github-ci.js.map +1 -0
  494. package/lib/host/proactive/task-cost.d.ts +10 -0
  495. package/lib/host/proactive/task-cost.js +70 -0
  496. package/lib/host/proactive/task-cost.js.map +1 -0
  497. package/lib/host/proactive/wire.d.ts +5 -0
  498. package/lib/host/proactive/wire.js +48 -0
  499. package/lib/host/proactive/wire.js.map +1 -0
  500. package/lib/host/proactive/work-continuation.d.ts +21 -0
  501. package/lib/host/proactive/work-continuation.js +66 -0
  502. package/lib/host/proactive/work-continuation.js.map +1 -0
  503. package/lib/host/proactive/workspace-process.d.ts +25 -0
  504. package/lib/host/proactive/workspace-process.js +80 -0
  505. package/lib/host/proactive/workspace-process.js.map +1 -0
  506. package/lib/host/proactive/workspace-repair.d.ts +425 -0
  507. package/lib/host/proactive/workspace-repair.js +352 -0
  508. package/lib/host/proactive/workspace-repair.js.map +1 -0
  509. package/lib/host/reference-memory/backend.d.ts +13 -0
  510. package/lib/host/reference-memory/backend.js +134 -0
  511. package/lib/host/reference-memory/backend.js.map +1 -0
  512. package/lib/host/reference-memory/cleanup-files.d.ts +7 -0
  513. package/lib/host/reference-memory/cleanup-files.js +36 -0
  514. package/lib/host/reference-memory/cleanup-files.js.map +1 -0
  515. package/lib/host/reference-memory/copies.d.ts +87 -0
  516. package/lib/host/reference-memory/copies.js +218 -0
  517. package/lib/host/reference-memory/copies.js.map +1 -0
  518. package/lib/host/reference-memory/files.d.ts +4 -0
  519. package/lib/host/reference-memory/files.js +43 -0
  520. package/lib/host/reference-memory/files.js.map +1 -0
  521. package/lib/host/reference-memory/model.d.ts +195 -0
  522. package/lib/host/reference-memory/model.js +66 -0
  523. package/lib/host/reference-memory/model.js.map +1 -0
  524. package/lib/host/reference-memory/service.d.ts +157 -0
  525. package/lib/host/reference-memory/service.js +124 -0
  526. package/lib/host/reference-memory/service.js.map +1 -0
  527. package/lib/host/reference-memory/writer.d.ts +55 -0
  528. package/lib/host/reference-memory/writer.js +265 -0
  529. package/lib/host/reference-memory/writer.js.map +1 -0
  530. package/lib/host/registry/identity.d.ts +3 -0
  531. package/lib/host/registry/identity.js +9 -0
  532. package/lib/host/registry/identity.js.map +1 -0
  533. package/lib/host/registry/lifecycle.d.ts +118 -0
  534. package/lib/host/registry/lifecycle.js +226 -0
  535. package/lib/host/registry/lifecycle.js.map +1 -0
  536. package/lib/host/registry/mutations.d.ts +7 -0
  537. package/lib/host/registry/mutations.js +25 -0
  538. package/lib/host/registry/mutations.js.map +1 -0
  539. package/lib/host/registry/presets.d.ts +13 -0
  540. package/lib/host/registry/presets.js +169 -0
  541. package/lib/host/registry/presets.js.map +1 -0
  542. package/lib/host/registry/types.d.ts +11 -0
  543. package/lib/host/registry/types.js +3 -0
  544. package/lib/host/registry/types.js.map +1 -0
  545. package/lib/host/registry-config.d.ts +66 -0
  546. package/lib/host/registry-config.js +123 -0
  547. package/lib/host/registry-config.js.map +1 -0
  548. package/lib/host/registry.d.ts +142 -0
  549. package/lib/host/registry.js +489 -0
  550. package/lib/host/registry.js.map +1 -0
  551. package/lib/host/shadow/budget.d.ts +106 -0
  552. package/lib/host/shadow/budget.js +112 -0
  553. package/lib/host/shadow/budget.js.map +1 -0
  554. package/lib/host/shadow/config.d.ts +13 -0
  555. package/lib/host/shadow/config.js +13 -0
  556. package/lib/host/shadow/config.js.map +1 -0
  557. package/lib/host/shadow/notification-adapter.d.ts +5 -0
  558. package/lib/host/shadow/notification-adapter.js +16 -0
  559. package/lib/host/shadow/notification-adapter.js.map +1 -0
  560. package/lib/host/shadow/planner.d.ts +39 -0
  561. package/lib/host/shadow/planner.js +76 -0
  562. package/lib/host/shadow/planner.js.map +1 -0
  563. package/lib/host/shadow/schedule-adapter.d.ts +23 -0
  564. package/lib/host/shadow/schedule-adapter.js +15 -0
  565. package/lib/host/shadow/schedule-adapter.js.map +1 -0
  566. package/lib/host/shadow/service.d.ts +23 -0
  567. package/lib/host/shadow/service.js +25 -0
  568. package/lib/host/shadow/service.js.map +1 -0
  569. package/lib/host/store.d.ts +25 -0
  570. package/lib/host/store.js +74 -0
  571. package/lib/host/store.js.map +1 -0
  572. package/lib/host/stores/activity.d.ts +35 -0
  573. package/lib/host/stores/activity.js +188 -0
  574. package/lib/host/stores/activity.js.map +1 -0
  575. package/lib/host/stores/bots.d.ts +21 -0
  576. package/lib/host/stores/bots.js +128 -0
  577. package/lib/host/stores/bots.js.map +1 -0
  578. package/lib/host/stores/domain.d.ts +343 -0
  579. package/lib/host/stores/domain.js +98 -0
  580. package/lib/host/stores/domain.js.map +1 -0
  581. package/lib/host/stores/memory.d.ts +29 -0
  582. package/lib/host/stores/memory.js +139 -0
  583. package/lib/host/stores/memory.js.map +1 -0
  584. package/lib/host/tools/bot-manage.d.ts +14 -0
  585. package/lib/host/tools/bot-manage.js +436 -0
  586. package/lib/host/tools/bot-manage.js.map +1 -0
  587. package/lib/host/workspace/remote.d.ts +194 -0
  588. package/lib/host/workspace/remote.js +98 -0
  589. package/lib/host/workspace/remote.js.map +1 -0
  590. package/lib/host/workspace/service.d.ts +185 -0
  591. package/lib/host/workspace/service.js +261 -0
  592. package/lib/host/workspace/service.js.map +1 -0
  593. package/lib/index.d.ts +10 -0
  594. package/lib/index.js +58 -0
  595. package/lib/index.js.map +1 -0
  596. package/lib/module-manifest.json +262 -0
  597. package/lib/proactive-coordinator/LICENSE +21 -0
  598. package/lib/proactive-coordinator/core.mjs +19067 -0
  599. package/lib/proactive-coordinator/main.mjs +22196 -0
  600. package/lib/proactive-coordinator/package.json +1 -0
  601. package/lib/proactive-coordinator/prompts/admission.md +68 -0
  602. package/lib/proactive-coordinator/prompts/cli.md +17 -0
  603. package/lib/proactive-coordinator/prompts/dispatch.md +59 -0
  604. package/lib/proactive-coordinator/prompts/handoff-orchestrator.md +4 -0
  605. package/lib/proactive-coordinator/prompts/handoff-worker.md +7 -0
  606. package/lib/proactive-coordinator/prompts/handoff.md +6 -0
  607. package/lib/proactive-coordinator/prompts/orchestrator.md +16 -0
  608. package/lib/proactive-coordinator/prompts/replies.md +35 -0
  609. package/lib/proactive-coordinator/prompts/shared.md +7 -0
  610. package/lib/proactive-coordinator/prompts/subscriptions.md +13 -0
  611. package/lib/proactive-coordinator/prompts/team/communication.md +97 -0
  612. package/lib/proactive-coordinator/prompts/team/delivery.md +28 -0
  613. package/lib/proactive-coordinator/prompts/team/scope.md +22 -0
  614. package/lib/proactive-coordinator/prompts/work.md +49 -0
  615. package/lib/proactive-coordinator/prompts/worker.md +10 -0
  616. package/lib/proactive-coordinator/provenance.json +7 -0
  617. package/lib/proactive-coordinator/skills/dsh-superagent-feishu/SKILL.md +12 -0
  618. package/lib/proactive-coordinator/skills/dsh-superagent-github/SKILL.md +14 -0
  619. package/lib/shared/activity-preview.d.ts +5 -0
  620. package/lib/shared/activity-preview.js +40 -0
  621. package/lib/shared/activity-preview.js.map +1 -0
  622. package/lib/shared/activity.d.ts +107 -0
  623. package/lib/shared/activity.js +50 -0
  624. package/lib/shared/activity.js.map +1 -0
  625. package/lib/shared/automation-contract.d.ts +1138 -0
  626. package/lib/shared/automation-contract.js +63 -0
  627. package/lib/shared/automation-contract.js.map +1 -0
  628. package/lib/shared/automation.d.ts +336 -0
  629. package/lib/shared/automation.js +244 -0
  630. package/lib/shared/automation.js.map +1 -0
  631. package/lib/shared/bot-brand.d.ts +20 -0
  632. package/lib/shared/bot-brand.js +26 -0
  633. package/lib/shared/bot-brand.js.map +1 -0
  634. package/lib/shared/capabilities-contract.d.ts +685 -0
  635. package/lib/shared/capabilities-contract.js +38 -0
  636. package/lib/shared/capabilities-contract.js.map +1 -0
  637. package/lib/shared/collaboration-contract.d.ts +614 -0
  638. package/lib/shared/collaboration-contract.js +52 -0
  639. package/lib/shared/collaboration-contract.js.map +1 -0
  640. package/lib/shared/collaboration.d.ts +132 -0
  641. package/lib/shared/collaboration.js +63 -0
  642. package/lib/shared/collaboration.js.map +1 -0
  643. package/lib/shared/connectors.d.ts +216 -0
  644. package/lib/shared/connectors.js +121 -0
  645. package/lib/shared/connectors.js.map +1 -0
  646. package/lib/shared/data-flow.d.ts +135 -0
  647. package/lib/shared/data-flow.js +53 -0
  648. package/lib/shared/data-flow.js.map +1 -0
  649. package/lib/shared/eval-budget.d.ts +100 -0
  650. package/lib/shared/eval-budget.js +34 -0
  651. package/lib/shared/eval-budget.js.map +1 -0
  652. package/lib/shared/group-recall-reads.d.ts +35 -0
  653. package/lib/shared/group-recall-reads.js +12 -0
  654. package/lib/shared/group-recall-reads.js.map +1 -0
  655. package/lib/shared/group-recall.d.ts +132 -0
  656. package/lib/shared/group-recall.js +52 -0
  657. package/lib/shared/group-recall.js.map +1 -0
  658. package/lib/shared/groups-contract.d.ts +4128 -0
  659. package/lib/shared/groups-contract.js +97 -0
  660. package/lib/shared/groups-contract.js.map +1 -0
  661. package/lib/shared/groups.d.ts +966 -0
  662. package/lib/shared/groups.js +240 -0
  663. package/lib/shared/groups.js.map +1 -0
  664. package/lib/shared/identity.d.ts +14 -0
  665. package/lib/shared/identity.js +13 -0
  666. package/lib/shared/identity.js.map +1 -0
  667. package/lib/shared/ids.d.ts +5 -0
  668. package/lib/shared/ids.js +6 -0
  669. package/lib/shared/ids.js.map +1 -0
  670. package/lib/shared/integrations-contract.d.ts +1916 -0
  671. package/lib/shared/integrations-contract.js +71 -0
  672. package/lib/shared/integrations-contract.js.map +1 -0
  673. package/lib/shared/integrations.d.ts +216 -0
  674. package/lib/shared/integrations.js +20 -0
  675. package/lib/shared/integrations.js.map +1 -0
  676. package/lib/shared/managed-flow.d.ts +199 -0
  677. package/lib/shared/managed-flow.js +15 -0
  678. package/lib/shared/managed-flow.js.map +1 -0
  679. package/lib/shared/memory-forget.d.ts +122 -0
  680. package/lib/shared/memory-forget.js +32 -0
  681. package/lib/shared/memory-forget.js.map +1 -0
  682. package/lib/shared/memory-management.d.ts +588 -0
  683. package/lib/shared/memory-management.js +40 -0
  684. package/lib/shared/memory-management.js.map +1 -0
  685. package/lib/shared/memory-ops.d.ts +274 -0
  686. package/lib/shared/memory-ops.js +35 -0
  687. package/lib/shared/memory-ops.js.map +1 -0
  688. package/lib/shared/memory-tool-names.d.ts +2 -0
  689. package/lib/shared/memory-tool-names.js +9 -0
  690. package/lib/shared/memory-tool-names.js.map +1 -0
  691. package/lib/shared/memory-v2.d.ts +268 -0
  692. package/lib/shared/memory-v2.js +51 -0
  693. package/lib/shared/memory-v2.js.map +1 -0
  694. package/lib/shared/messaging-contract.d.ts +161 -0
  695. package/lib/shared/messaging-contract.js +24 -0
  696. package/lib/shared/messaging-contract.js.map +1 -0
  697. package/lib/shared/messaging.d.ts +797 -0
  698. package/lib/shared/messaging.js +229 -0
  699. package/lib/shared/messaging.js.map +1 -0
  700. package/lib/shared/native-schedule.d.ts +35 -0
  701. package/lib/shared/native-schedule.js +25 -0
  702. package/lib/shared/native-schedule.js.map +1 -0
  703. package/lib/shared/notifications.d.ts +167 -0
  704. package/lib/shared/notifications.js +104 -0
  705. package/lib/shared/notifications.js.map +1 -0
  706. package/lib/shared/onboarding-source.d.ts +19 -0
  707. package/lib/shared/onboarding-source.js +9 -0
  708. package/lib/shared/onboarding-source.js.map +1 -0
  709. package/lib/shared/onboarding.d.ts +115 -0
  710. package/lib/shared/onboarding.js +14 -0
  711. package/lib/shared/onboarding.js.map +1 -0
  712. package/lib/shared/operation-errors.d.ts +15 -0
  713. package/lib/shared/operation-errors.js +15 -0
  714. package/lib/shared/operation-errors.js.map +1 -0
  715. package/lib/shared/proactive/activity.d.ts +152 -0
  716. package/lib/shared/proactive/activity.js +23 -0
  717. package/lib/shared/proactive/activity.js.map +1 -0
  718. package/lib/shared/proactive/document.d.ts +31 -0
  719. package/lib/shared/proactive/document.js +17 -0
  720. package/lib/shared/proactive/document.js.map +1 -0
  721. package/lib/shared/proactive/feedback.d.ts +2315 -0
  722. package/lib/shared/proactive/feedback.js +177 -0
  723. package/lib/shared/proactive/feedback.js.map +1 -0
  724. package/lib/shared/proactive/follow-up.d.ts +781 -0
  725. package/lib/shared/proactive/follow-up.js +164 -0
  726. package/lib/shared/proactive/follow-up.js.map +1 -0
  727. package/lib/shared/proactive/governance.d.ts +147 -0
  728. package/lib/shared/proactive/governance.js +92 -0
  729. package/lib/shared/proactive/governance.js.map +1 -0
  730. package/lib/shared/proactive/group-follow-up.d.ts +228 -0
  731. package/lib/shared/proactive/group-follow-up.js +24 -0
  732. package/lib/shared/proactive/group-follow-up.js.map +1 -0
  733. package/lib/shared/proactive/group-repair.d.ts +185 -0
  734. package/lib/shared/proactive/group-repair.js +95 -0
  735. package/lib/shared/proactive/group-repair.js.map +1 -0
  736. package/lib/shared/proactive/handoff.d.ts +17 -0
  737. package/lib/shared/proactive/handoff.js +15 -0
  738. package/lib/shared/proactive/handoff.js.map +1 -0
  739. package/lib/shared/proactive/method-evaluation.d.ts +187 -0
  740. package/lib/shared/proactive/method-evaluation.js +46 -0
  741. package/lib/shared/proactive/method-evaluation.js.map +1 -0
  742. package/lib/shared/proactive/method-package.d.ts +131 -0
  743. package/lib/shared/proactive/method-package.js +28 -0
  744. package/lib/shared/proactive/method-package.js.map +1 -0
  745. package/lib/shared/proactive/notices.d.ts +126 -0
  746. package/lib/shared/proactive/notices.js +64 -0
  747. package/lib/shared/proactive/notices.js.map +1 -0
  748. package/lib/shared/proactive/outcomes.d.ts +23 -0
  749. package/lib/shared/proactive/outcomes.js +41 -0
  750. package/lib/shared/proactive/outcomes.js.map +1 -0
  751. package/lib/shared/proactive/protocol.d.ts +12103 -0
  752. package/lib/shared/proactive/protocol.js +688 -0
  753. package/lib/shared/proactive/protocol.js.map +1 -0
  754. package/lib/shared/proactive/remote-contract.d.ts +29534 -0
  755. package/lib/shared/proactive/remote-contract.js +248 -0
  756. package/lib/shared/proactive/remote-contract.js.map +1 -0
  757. package/lib/shared/proactive/repair.d.ts +65 -0
  758. package/lib/shared/proactive/repair.js +55 -0
  759. package/lib/shared/proactive/repair.js.map +1 -0
  760. package/lib/shared/proactive/responsibility.d.ts +1085 -0
  761. package/lib/shared/proactive/responsibility.js +222 -0
  762. package/lib/shared/proactive/responsibility.js.map +1 -0
  763. package/lib/shared/proactive/setup.d.ts +167 -0
  764. package/lib/shared/proactive/setup.js +26 -0
  765. package/lib/shared/proactive/setup.js.map +1 -0
  766. package/lib/shared/proactive/work-progress.d.ts +14 -0
  767. package/lib/shared/proactive/work-progress.js +22 -0
  768. package/lib/shared/proactive/work-progress.js.map +1 -0
  769. package/lib/shared/proactive/work.d.ts +2887 -0
  770. package/lib/shared/proactive/work.js +250 -0
  771. package/lib/shared/proactive/work.js.map +1 -0
  772. package/lib/shared/proactive/workspace-repair.d.ts +283 -0
  773. package/lib/shared/proactive/workspace-repair.js +195 -0
  774. package/lib/shared/proactive/workspace-repair.js.map +1 -0
  775. package/lib/shared/reference-memory.d.ts +517 -0
  776. package/lib/shared/reference-memory.js +188 -0
  777. package/lib/shared/reference-memory.js.map +1 -0
  778. package/lib/shared/remote-contract.d.ts +4586 -0
  779. package/lib/shared/remote-contract.js +205 -0
  780. package/lib/shared/remote-contract.js.map +1 -0
  781. package/lib/shared/routine-outcomes.d.ts +20 -0
  782. package/lib/shared/routine-outcomes.js +9 -0
  783. package/lib/shared/routine-outcomes.js.map +1 -0
  784. package/lib/shared/schema.d.ts +785 -0
  785. package/lib/shared/schema.js +203 -0
  786. package/lib/shared/schema.js.map +1 -0
  787. package/lib/shared/secrets.d.ts +2 -0
  788. package/lib/shared/secrets.js +15 -0
  789. package/lib/shared/secrets.js.map +1 -0
  790. package/lib/shared/shadow.d.ts +12 -0
  791. package/lib/shared/shadow.js +8 -0
  792. package/lib/shared/shadow.js.map +1 -0
  793. package/lib/shared/version.d.ts +1 -0
  794. package/lib/shared/version.js +3 -0
  795. package/lib/shared/version.js.map +1 -0
  796. package/lib/shared/workspace-contract.d.ts +2284 -0
  797. package/lib/shared/workspace-contract.js +37 -0
  798. package/lib/shared/workspace-contract.js.map +1 -0
  799. package/lib/shared/workspace.d.ts +496 -0
  800. package/lib/shared/workspace.js +120 -0
  801. package/lib/shared/workspace.js.map +1 -0
  802. package/lib/typert.host.d.ts +12 -0
  803. package/lib/typert.host.js +13 -0
  804. package/lib/typert.host.js.map +1 -0
  805. package/lib/typert.remote-client.d.ts +4 -0
  806. package/lib/typert.remote-client.js +9 -0
  807. package/lib/typert.remote-client.js.map +1 -0
  808. package/locale/en.json +1644 -0
  809. package/locale/zh.json +1644 -0
  810. package/package.json +176 -3
@@ -0,0 +1,578 @@
1
+ import { groupMemberModel, proactiveMemberModel } from './model-selection.js';
2
+ import { verifyOwnerFollowUpChoice } from './owner-follow-up.js';
3
+ import { ConcurrentGroups } from './concurrent.js';
4
+ import { workerReservations } from './worker-tool.js';
5
+ import { randomUUID } from 'node:crypto';
6
+ import { SessionId } from '@deepseek-ai/dsh-session';
7
+ import { setSandboxMode } from '@deepseek-ai/dsh-sandbox-policy';
8
+ import { proactiveGroupInputs, waitIdle } from '../proactive/execution.js';
9
+ import { assertModelBudget } from '../proactive/model-budget.js';
10
+ import { groupChild, groupResult } from './data-flow.js';
11
+ import { outlets } from '../data-flow/tool-guard.js';
12
+ import { nextRoundRobinMember } from './round-robin.js';
13
+ import { hasOperationCode } from '../../shared/operation-errors.js';
14
+ import { ReasoningEffortId, createUserMessage } from '@deepseek-ai/dsh-llm';
15
+ import { OperationError, need, digest } from '../common/operations.js';
16
+ import { groupContext } from './routing.js';
17
+ import { blocks, textOf, terminal } from './model.js';
18
+ import { memberRunFailure } from './failure.js';
19
+ export class GroupTurnRunner {
20
+ state;
21
+ roots;
22
+ messages;
23
+ concurrent;
24
+ constructor(state, roots, messages) {
25
+ this.state = state;
26
+ this.roots = roots;
27
+ this.messages = messages;
28
+ this.concurrent = new ConcurrentGroups(state, roots, messages, this);
29
+ }
30
+ /** Called inside the service queue. A delivery receipt is the durable acceptance point. */
31
+ async enqueue(t, memberId, triggerMessageId, id, returnMemberId, requestDigest) {
32
+ if (t.ownerFollowUp)
33
+ throw new OperationError('approval-denied');
34
+ const old = this.state.table('deliveries').get(id);
35
+ if (old) {
36
+ if (requestDigest && old.requestDigest !== requestDigest)
37
+ throw new OperationError('conflict');
38
+ return old;
39
+ }
40
+ const g = this.state.record(t.group), rows = this.state.deliveries(t.id);
41
+ const timeout = t.protocol === 2 ? this.state.registry.config.groupTaskTimeoutMs : this.state.registry.config.groupRoundTimeoutMs;
42
+ if (this.state.cancelledTurns.has(t.id) || (terminal(need(this.state.table('turns').get(t.id))) && !(t.protocol === 2 && this.state.table('turns').get(t.id)?.state === 'paused')) ||
43
+ (timeout > 0 && Date.now() >= t.createdAt + timeout))
44
+ throw new OperationError('unavailable');
45
+ if (t.protocol !== 2 && rows.length >= t.orderedMemberIds.length + this.state.registry.config.groupMaxContinuations)
46
+ throw new OperationError('invalid');
47
+ if (t.protocol === 2 && rows.some(row => row.memberId === memberId && row.state === 'unknown'))
48
+ throw new OperationError('recovery-needed');
49
+ if (g.membershipRevision !== t.membershipRevision)
50
+ throw new OperationError('conflict');
51
+ const member = this.state.members(g).find(m => m.id === memberId && m.enabled && m.removedAt === undefined);
52
+ if (!member)
53
+ throw new OperationError('invalid');
54
+ const bot = await this.state.bot(member.bot), status = need((await this.state.registry.status()).find(s => s.id === bot.id));
55
+ const row = { id, turnId: t.id, memberId, ordinal: rows.length, bot: member.bot,
56
+ botRevision: bot.updatedAt, presetId: status.presetId, triggerMessageId, returnMemberId, requestDigest,
57
+ contextOutputMessageIds: [], contextTruncated: false, state: 'pending', ...(t.protocol === 2 ? { automatic: true } : {}) };
58
+ await this.state.putDelivery(row);
59
+ return row;
60
+ }
61
+ async groupMessage(agent, binding, input, callId, signal) {
62
+ if (this.state.table('turns').get(binding.turnId)?.protocol === 2)
63
+ return this.concurrent.message(agent, binding, input, callId, signal);
64
+ return this.state.queue.run(async () => {
65
+ signal.throwIfAborted();
66
+ const t = need(this.state.table('turns').get(binding.turnId)), g = this.state.record(t.group), d = need(this.state.table('deliveries').get(binding.deliveryId));
67
+ if (this.state.workers.get(agent.session.id) !== binding || this.state.cancelledTurns.has(t.id) ||
68
+ !['starting', 'running'].includes(d.state))
69
+ throw new OperationError('approval-denied');
70
+ if (input.action === 'skip') {
71
+ await this.state.putDelivery({ ...d, skipped: true });
72
+ return { status: 'skipped' };
73
+ }
74
+ if (d.skipped)
75
+ throw new OperationError('invalid');
76
+ const root = need(this.state.roots.get(g.id)), bot = await this.state.bot(d.bot), id = `group-message:${digest([d.id, callId])}`, hash = digest(input);
77
+ const old = this.state.table('deliveries').get(id);
78
+ if (old) {
79
+ if (old.requestDigest !== hash)
80
+ throw new OperationError('conflict');
81
+ return { status: old.state === 'unknown' ? 'unknown' : 'accepted', messageId: old.triggerMessageId };
82
+ }
83
+ const messages = this.messages.messages(g), reply = input.replyTo ? messages.find(m => m.id === input.replyTo) : undefined;
84
+ if (input.replyTo && (!reply || (reply.seq > t.contextThroughSeq && reply.turnId !== t.id && !t.predecessorTurnIds?.includes(reply.turnId))))
85
+ throw new OperationError('invalid');
86
+ const target = input.to ?? (reply?.speaker && this.state.members(g).find(m => m.bot.botId === reply.speaker?.bot.botId && m.bot.botCreatedAt === reply.speaker.bot.botCreatedAt)?.id);
87
+ if (this.state.deliveries(t.id).length >= t.orderedMemberIds.length + this.state.registry.config.groupMaxContinuations)
88
+ throw new OperationError('invalid');
89
+ if (input.requestReply && !target)
90
+ throw new OperationError('invalid');
91
+ const message = createUserMessage({ source: { kind: 'dsh-bot-group', group: t.group, turnId: t.id,
92
+ memberId: d.memberId, speaker: { bot: d.bot, name: bot.name, ...(bot.avatar ? { avatar: bot.avatar } : {}), ...(bot.avatarColor ? { avatarColor: bot.avatarColor } : {}), ...(bot.avatarVariant ? { avatarVariant: bot.avatarVariant } : {}) },
93
+ childSessionId: binding.childId, stopReason: 'group-message', replyTo: input.replyTo ?? d.triggerMessageId ?? t.inputMessageId, causeId: t.id }, content: blocks(input.text) });
94
+ // A receipt is written before the native append. Unknown append outcomes are never replayed.
95
+ const receipt = target ? await this.enqueue(t, target, message.id, id, input.requestReply ? d.memberId : undefined, hash) :
96
+ { ...d, id, ordinal: this.state.deliveries(t.id).length, triggerMessageId: message.id, requestDigest: hash, returnMemberId: undefined, state: 'skipped' };
97
+ if (!target)
98
+ await this.state.putDelivery(receipt);
99
+ try {
100
+ await groupResult(this.state, g, d.bot, binding.childId, root.agent, JSON.stringify(message), id, () => root.agent.session.append('user/message', message, { surfaceOp: 'append' }), signal);
101
+ await this.roots.flush(root);
102
+ }
103
+ catch {
104
+ await this.state.putDelivery({ ...receipt, state: 'unknown', reasonCode: 'message-append-unknown' });
105
+ throw new OperationError('recovery-needed');
106
+ }
107
+ return { status: 'accepted', messageId: message.id };
108
+ });
109
+ }
110
+ async prepareDelivery(t, deliveryId, signal) {
111
+ return this.state.queue.run(async () => {
112
+ const d = need(this.state.table('deliveries').get(deliveryId)), g = this.state.record(t.group);
113
+ const member = this.state.members(g).find((m) => m.id === d.memberId);
114
+ if (this.state.stopped ||
115
+ this.state.cancelledTurns.has(t.id) ||
116
+ d.state !== 'pending' ||
117
+ ((t.proactive || t.ownerFollowUp) && g.membershipRevision !== t.membershipRevision) ||
118
+ signal.aborted ||
119
+ !member?.enabled ||
120
+ member.removedAt !== undefined ||
121
+ g.archived ||
122
+ this.state.table('turns').get(t.id)?.stoppedMemberIds?.includes(d.memberId)) {
123
+ await this.state.putDelivery({ ...d, state: 'cancelled' });
124
+ return;
125
+ }
126
+ const bot = await this.state.bot(d.bot);
127
+ const status = (await this.state.registry.status()).find((s) => s.id === bot.id);
128
+ if (bot.updatedAt !== d.botRevision || status?.presetId !== d.presetId || status.preset.state !== 'ok')
129
+ throw new OperationError('conflict');
130
+ const root = need(this.state.roots.get(g.id));
131
+ const messages = this.messages.messages(g);
132
+ const question = need(messages.find((m) => m.id === (d.triggerMessageId ?? t.inputMessageId)));
133
+ const previous = t.proactive || t.ownerFollowUp ? [] : this.state
134
+ .turns(g).filter(prior => prior.id === t.id || t.predecessorTurnIds?.includes(prior.id))
135
+ .flatMap(prior => this.state.deliveries(prior.id))
136
+ .filter((row) => t.protocol === 2 ? row.turnId !== t.id : row.ordinal < d.ordinal || row.turnId !== t.id)
137
+ .filter((d) => d.outputMessageId)
138
+ .map((d) => need(messages.find((m) => m.id === d.outputMessageId)));
139
+ const participantNames = await Promise.all(this.state.members(g).filter(m => m.enabled && m.removedAt === undefined).map(async (d) => {
140
+ try {
141
+ const b = await this.state.bot(d.bot);
142
+ return `${b.name} (botId=${b.id}, memberId=${d.id})`;
143
+ }
144
+ catch {
145
+ return d.bot.botId;
146
+ }
147
+ }));
148
+ const context = groupContext(g.name, bot.name, participantNames, question, messages.filter((m) => m.seq <= t.contextThroughSeq), [...previous, ...messages.filter(m => m.id === (d.triggerMessageId ? question.replyTo : t.replyTo))], this.state.registry.config.groupContextMaxBytes);
149
+ if (t.protocol === 2 && d.automatic) {
150
+ const current = need(this.state.table('turns').get(t.id));
151
+ if ((current.automaticExecutions ?? 0) >= (current.continuationAllowance ?? 0))
152
+ return;
153
+ await this.state.putTurn({ ...current, automaticExecutions: (current.automaticExecutions ?? 0) + 1 });
154
+ }
155
+ await this.state.putDelivery({
156
+ ...d,
157
+ startedAt: Date.now(),
158
+ state: 'starting',
159
+ contextOutputMessageIds: context.outputIds,
160
+ contextTruncated: context.truncated,
161
+ });
162
+ const attachmentBlocks = [...new Map([question, ...messages.filter(m => m.id === question.replyTo || context.outputIds.includes(m.id))]
163
+ .flatMap(m => m.attachments ?? []).map(block => [`${block.type}:${block.attachment.attachmentId}`, block])).values()];
164
+ const modelSelection = t.memberModelSelections?.find(row => row.memberId === d.memberId)?.modelSelection ?? t.modelSelection;
165
+ const selected = t.ownerFollowUp?.modelSelection ??
166
+ (t.proactive ? proactiveMemberModel(t.proactive, d.memberId) : groupMemberModel(t, d.memberId, bot, () => this.state.route()));
167
+ const route = selected ? { ...selected,
168
+ // Explicit undefined clears a same-route effort inherited from the root's creation options.
169
+ reasoningEffort: selected.reasoningEffort === undefined ? undefined : ReasoningEffortId(selected.reasoningEffort) } : this.state.route();
170
+ return { root, bot, d, context, attachmentBlocks, route, modelSelection };
171
+ });
172
+ }
173
+ async recordDeliveryResult(t, deliveryId, prepared, childId, result, signal, verify) {
174
+ await this.state.queue.run(async () => {
175
+ const g = this.state.record(t.group), d = need(this.state.table('deliveries').get(deliveryId));
176
+ if ((t.proactive || t.ownerFollowUp) && g.membershipRevision !== t.membershipRevision)
177
+ throw new OperationError('conflict');
178
+ const text = textOf(result.output);
179
+ const hasContent = !d.skipped && !signal.aborted && (Boolean(text.trim()) || result.output.some((b) => b.type !== 'text'));
180
+ const state = signal.aborted
181
+ ? 'cancelled'
182
+ : d.skipped && result.stopReason === 'completed'
183
+ ? 'skipped'
184
+ : result.stopReason === 'completed' && hasContent
185
+ ? 'completed'
186
+ : 'failed';
187
+ // Native local results carry no failure detail; read the child's own failed turn/end.
188
+ const failure = state === 'failed' && result.stopReason === 'error'
189
+ ? memberRunFailure(this.state.workers.get(childId)?.agent ?? this.state.ctx.agents.get(SessionId(childId)), d.startedAt ?? 0)
190
+ : undefined;
191
+ let output;
192
+ if (hasContent) {
193
+ const b = prepared.bot;
194
+ const speaker = {
195
+ bot: d.bot,
196
+ name: b.name,
197
+ ...(b.avatar ? { avatar: b.avatar } : {}),
198
+ ...(b.avatarColor ? { avatarColor: b.avatarColor } : {}),
199
+ ...(b.avatarVariant ? { avatarVariant: b.avatarVariant } : {}),
200
+ };
201
+ const message = createUserMessage({
202
+ source: {
203
+ kind: 'dsh-bot-group',
204
+ group: t.group,
205
+ turnId: t.id,
206
+ memberId: d.memberId,
207
+ speaker,
208
+ childSessionId: childId,
209
+ stopReason: result.stopReason,
210
+ ...(failure ? { failure } : {}),
211
+ replyTo: d.triggerMessageId ?? t.replyTo ?? t.inputMessageId,
212
+ causeId: t.id,
213
+ },
214
+ content: [...result.output],
215
+ });
216
+ const append = () => prepared.root.agent.session.append('user/message', message, { surfaceOp: 'append' });
217
+ const send = verify ? async () => { await verify(); return append(); } : append;
218
+ const event = await groupResult(this.state, g, d.bot, childId, prepared.root.agent, JSON.stringify(message), `${deliveryId}:result`, send, signal);
219
+ await this.roots.flush(prepared.root);
220
+ output = { outputMessageId: message.id, outputSeq: Number(event.seq) };
221
+ }
222
+ await this.state.putDelivery({
223
+ ...d,
224
+ state,
225
+ endedAt: Date.now(),
226
+ ...output,
227
+ stopReason: result.stopReason,
228
+ ...(failure ? { failure } : {}),
229
+ ...(state !== 'completed' && state !== 'skipped'
230
+ ? {
231
+ reasonCode: signal.aborted ? String(signal.reason ?? 'user-stop') : text.trim() ? 'partial-output' : 'empty-or-failed',
232
+ }
233
+ : {}),
234
+ });
235
+ if (t.protocol === 2 && state === 'completed' && output && !this.state.cancelledTurns.has(t.id) && g.membershipRevision === t.membershipRevision) {
236
+ const requests = [d, ...this.state.deliveries(t.id).filter(row => row.joinedDeliveryId === d.id && row.reasonCode === 'inbox-accepted')];
237
+ for (const request of requests)
238
+ if (request.returnMemberId && !this.state.table('turns').get(t.id)?.stoppedMemberIds?.includes(request.returnMemberId)) {
239
+ const next = await this.enqueue(need(this.state.table('turns').get(t.id)), request.returnMemberId, output.outputMessageId, `group-return:${digest(request.id)}`);
240
+ await this.concurrent.returnToActive(t, next, text, d.memberId, signal);
241
+ }
242
+ }
243
+ if (t.protocol !== 2 && state === 'completed' && output && d.returnMemberId &&
244
+ this.state.deliveries(t.id).length < t.orderedMemberIds.length + this.state.registry.config.groupMaxContinuations &&
245
+ (this.state.registry.config.groupRoundTimeoutMs === 0 || Date.now() < t.createdAt + this.state.registry.config.groupRoundTimeoutMs) && g.membershipRevision === t.membershipRevision)
246
+ await this.enqueue(t, d.returnMemberId, output.outputMessageId, `group-return:${digest(d.id)}`);
247
+ if (state === 'completed' && output && !t.proactive && !t.ownerFollowUp) {
248
+ await this.state.putGroup({
249
+ ...g,
250
+ nextMemberId: nextRoundRobinMember(this.state.members(g), d.memberId),
251
+ revision: g.revision + 1,
252
+ updatedAt: Date.now(),
253
+ });
254
+ }
255
+ });
256
+ }
257
+ async deliverProactive(t, d, deadline) {
258
+ const review = t.proactive, owner = t.ownerFollowUp;
259
+ const approvedModel = owner?.modelSelection ?? proactiveMemberModel(need(review), d.memberId);
260
+ const requestBudget = review?.requestBudget ?? review?.repair;
261
+ if (owner && (t.orderedMemberIds.length !== 1 || d.memberId !== owner.memberId))
262
+ throw new OperationError('conflict');
263
+ if (requestBudget)
264
+ deadline = Math.min(deadline, Date.parse(requestBudget.deadlineAt));
265
+ const check = need(this.state.proactiveChecks.get(t.id));
266
+ const controller = new AbortController();
267
+ const signal = AbortSignal.any([
268
+ controller.signal, this.state.startup.signal,
269
+ AbortSignal.timeout(Math.max(1, Math.min(300000, deadline - Date.now()))),
270
+ ]);
271
+ this.state.controllers.set(d.id, controller);
272
+ let child;
273
+ let inputSent = false;
274
+ let createAttempted = false;
275
+ let restrictedChild;
276
+ try {
277
+ const prepared = await this.prepareDelivery(t, d.id, signal);
278
+ if (!prepared)
279
+ return;
280
+ const verify = async () => {
281
+ signal.throwIfAborted();
282
+ const group = this.state.record(t.group);
283
+ if (group.archived || group.membershipRevision !== t.membershipRevision ||
284
+ (review?.modelRevision !== undefined && (group.modelRevision ?? 0) !== review.modelRevision) ||
285
+ (await this.state.bot(d.bot)).updatedAt !== d.botRevision)
286
+ throw new OperationError('conflict');
287
+ if (owner)
288
+ await verifyOwnerFollowUpChoice(this.state, t.group, owner);
289
+ if (review?.followUp) {
290
+ await this.state.validateMembers(this.state.members(group)
291
+ .filter(member => member.enabled && member.removedAt === undefined).map(member => member.bot));
292
+ }
293
+ await check();
294
+ signal.throwIfAborted();
295
+ };
296
+ await verify();
297
+ const group = this.state.record(t.group);
298
+ const input = await groupChild(this.state, group, prepared.root.agent, d.bot, prepared.context.text, d.id, signal);
299
+ const childId = input?.childId ?? SessionId(randomUUID());
300
+ const source = owner ? { kind: 'dsh-bot-group-owner-followup', group: t.group, turnId: t.id,
301
+ cardId: owner.cardId, predecessorTurnId: owner.predecessorTurnId, } : { kind: 'dsh-bot-group-proactive', group: t.group, turnId: t.id,
302
+ ticketId: need(review).ticketId, assignmentId: need(review).assignmentId,
303
+ ...(review?.repair ? { repairPhase: review.repair.phase } : {}),
304
+ ...(review?.followUp ? { factId: review.followUp.factId, predecessorTurnId: review.followUp.predecessorTurnId } : {}), };
305
+ const message = createUserMessage({
306
+ source,
307
+ content: blocks(prepared.context.text),
308
+ });
309
+ if (owner) {
310
+ const reservation = { turnId: t.id, deliveryId: d.id, childId, rootId: prepared.root.agent.session.id,
311
+ presetId: d.presetId, modelSelection: owner.modelSelection, restrictedInputId: message.id,
312
+ audience: this.state.members(group).filter(member => member.enabled && member.removedAt === undefined).map(member => member.bot),
313
+ isActive: () => !signal.aborted && !this.state.stopped && !this.state.cancelledTurns.has(t.id),
314
+ };
315
+ if (workerReservations.has(childId))
316
+ throw new OperationError('conflict');
317
+ this.state.workers.set(childId, reservation);
318
+ workerReservations.set(childId, reservation);
319
+ restrictedChild = childId;
320
+ }
321
+ const outputTokens = owner ? this.state.registry.config.proactiveModelOutputTokens ?? 1024 : requestBudget?.outputTokens ?? 1024;
322
+ const options = { provider: approvedModel.provider, model: approvedModel.model, ...(approvedModel.reasoningEffort ? { reasoningEffort: ReasoningEffortId(approvedModel.reasoningEffort) } : {}), maxTokens: outputTokens };
323
+ let requested = false, dispatched = false;
324
+ const create = (dispatchSignal) => {
325
+ createAttempted = true;
326
+ return this.state.ctx.agents.create({
327
+ sessionId: childId,
328
+ parentAgent: prepared.root.agent,
329
+ meta: { cwd: group.cwd, parentSession: prepared.root.agent.session.id,
330
+ origin: 'subagent', delegationDepth: 1, agentPreset: d.presetId },
331
+ agentOptions: options,
332
+ signal: dispatchSignal,
333
+ setup: agentCtx => {
334
+ agentCtx.effect(() => agentCtx.tools.restrict({ allow: [] }));
335
+ agentCtx.effect(() => agentCtx.tools.guard(() => 'Proactive group review is read-only'));
336
+ agentCtx.effect(() => agentCtx.on('agent/pre-step', async ({ messages }, next) => {
337
+ const input = messages[0];
338
+ if (messages.length !== 1 || input?.id !== message.id || input.source.kind !== source.kind)
339
+ return { kind: 'reject' };
340
+ return next();
341
+ }, { prepend: true }));
342
+ agentCtx.effect(() => agentCtx.on('agent/request', async () => {
343
+ if (requested)
344
+ throw new OperationError('approval-denied');
345
+ await verify();
346
+ requested = true;
347
+ return options;
348
+ }, { prepend: true }));
349
+ agentCtx.effect(() => agentCtx.on('agent/request-error', async () => undefined, { prepend: true }));
350
+ if (owner)
351
+ agentCtx.effect(() => agentCtx.on('llm/stream', async function* (request, next) {
352
+ if (request.sessionId === childId) {
353
+ if (dispatched || request.provider !== approvedModel.provider || request.model !== approvedModel.model ||
354
+ (approvedModel.reasoningEffort !== undefined && request.reasoningEffort !== approvedModel.reasoningEffort) ||
355
+ !request.maxTokens || request.maxTokens > outputTokens || (request.tools?.length ?? 0) > 0)
356
+ throw new OperationError('approval-denied');
357
+ dispatched = true;
358
+ await verify();
359
+ }
360
+ yield* next();
361
+ }, { prepend: true }));
362
+ if (requestBudget)
363
+ agentCtx.effect(() => agentCtx.on('llm/stream', (options, next) => {
364
+ if (options.sessionId === childId) {
365
+ const allowance = assertModelBudget(options, requestBudget.maxTokens);
366
+ this.state.recordProactiveAllowance(d.id, allowance);
367
+ }
368
+ return next();
369
+ }, { prepend: true }));
370
+ },
371
+ });
372
+ };
373
+ const flow = outlets(this.state.registry);
374
+ child = input ? await need(flow).dispatch(input.id, (_envelope, s) => create(s), signal) : await create(signal);
375
+ setSandboxMode(child.agent.session, 'read-only');
376
+ if (this.state.ctx.tools.schemas(child.agent).length)
377
+ throw new OperationError('approval-denied');
378
+ await this.state.queue.run(async () => {
379
+ const current = need(this.state.table('deliveries').get(d.id));
380
+ await this.state.putDelivery({ ...current, state: 'running', childSessionId: childId, childMessageId: message.id });
381
+ });
382
+ await verify();
383
+ inputSent = true;
384
+ if (!owner)
385
+ proactiveGroupInputs.set(child.agent.id, message.id);
386
+ child.agent.followup(message);
387
+ await waitIdle(child.agent, signal);
388
+ await verify();
389
+ const events = child.agent.session.snapshotEvents();
390
+ const accepted = events.find(event => event.type === 'user/message' && event.data.id === message.id &&
391
+ event.data.source.kind === source.kind);
392
+ const end = events.findLast(event => event.type === 'turn/end');
393
+ if (!accepted || end?.type !== 'turn/end' || !(await this.state.ctx.sessions.flush(child.agent.session)))
394
+ throw new OperationError('unavailable');
395
+ if (end.data.reason.kind === 'error') {
396
+ await this.recordDeliveryResult(t, d.id, prepared, childId, { output: [], stopReason: 'error' }, signal);
397
+ return;
398
+ }
399
+ const answer = events.findLast(event => event.type === 'assistant/message');
400
+ if (end.data.reason.kind !== 'completed' || answer?.type !== 'assistant/message' ||
401
+ answer.data.turn !== end.data.turn || answer.data.interrupted ||
402
+ answer.data.message.source.provider !== approvedModel.provider || answer.data.message.source.model !== approvedModel.model)
403
+ throw new OperationError('unavailable');
404
+ await this.recordDeliveryResult(t, d.id, prepared, childId, {
405
+ output: answer.data.message.content.filter(block => block.type === 'text'),
406
+ stopReason: 'completed',
407
+ }, signal, verify);
408
+ }
409
+ catch {
410
+ await this.state.queue.run(async () => {
411
+ const current = need(this.state.table('deliveries').get(d.id));
412
+ await this.state.putDelivery({ ...current, state: inputSent ? 'unknown' : signal.aborted ? 'cancelled' : 'failed',
413
+ reasonCode: inputSent ? 'recovery-needed' : 'native-failure' });
414
+ });
415
+ }
416
+ finally {
417
+ this.state.controllers.delete(d.id);
418
+ let drained = false;
419
+ try {
420
+ await child?.dispose();
421
+ if (child) {
422
+ await child.agent.whenIdle();
423
+ drained = true;
424
+ }
425
+ }
426
+ finally {
427
+ this.state.recordProactiveDrain(d.id, !createAttempted || drained);
428
+ if (child)
429
+ proactiveGroupInputs.delete(child.agent.id);
430
+ if (restrictedChild) {
431
+ this.state.workers.delete(restrictedChild);
432
+ workerReservations.delete(restrictedChild);
433
+ }
434
+ }
435
+ }
436
+ }
437
+ async deliver(t, d0, deadline) {
438
+ if (t.proactive || t.ownerFollowUp)
439
+ return this.deliverProactive(t, d0, deadline);
440
+ const controller = new AbortController();
441
+ const inputAdmission = new AbortController();
442
+ this.state.inputAdmissions.set(d0.id, inputAdmission);
443
+ this.state.controllers.set(d0.id, controller);
444
+ const timer = Number.isFinite(deadline) ? setTimeout(() => controller.abort('configured-timeout'), Math.max(1, deadline - Date.now())) : undefined;
445
+ let activation;
446
+ let reservedChild;
447
+ let disposal;
448
+ const stopNative = () => {
449
+ if (activation) {
450
+ disposal ??= activation.dispose();
451
+ void disposal.catch(() => { });
452
+ }
453
+ };
454
+ controller.signal.addEventListener('abort', stopNative, { once: true });
455
+ try {
456
+ const prepared = await this.prepareDelivery(t, d0.id, controller.signal);
457
+ if (!prepared)
458
+ return;
459
+ // A member can be removed while native startup awaits: signal remains authoritative.
460
+ const g = this.state.record(t.group);
461
+ const flow = outlets(this.state.registry);
462
+ const input = await groupChild(this.state, g, prepared.root.agent, prepared.d.bot, prepared.context.text, d0.id, controller.signal);
463
+ const childId = input?.childId ?? SessionId(randomUUID());
464
+ reservedChild = childId;
465
+ this.state.workers.set(childId, { turnId: t.id, deliveryId: d0.id, childId, rootId: g.rootSessionId, presetId: prepared.d.presetId, modelSelection: prepared.modelSelection, isActive: () => !this.state.stopped && !this.state.cancelledTurns.has(t.id) && !controller.signal.aborted && this.state.workers.get(childId)?.deliveryId === d0.id, audience: this.state.members(g).filter(m => m.enabled && m.removedAt === undefined).map(m => m.bot) });
466
+ workerReservations.set(childId, need(this.state.workers.get(childId)));
467
+ const start = (dispatchSignal = controller.signal) => this.state.ctx.subagents.startActivation({
468
+ childId,
469
+ provider: 'spawn',
470
+ delivery: 'caller',
471
+ label: prepared.bot.name,
472
+ signal: dispatchSignal,
473
+ request: {
474
+ parent: prepared.root.agent,
475
+ agentPreset: prepared.d.presetId,
476
+ agentOptions: prepared.route,
477
+ prompt: [...blocks(prepared.context.text), ...prepared.attachmentBlocks],
478
+ maxDepth: this.state.registry.config.groupMaxDepth,
479
+ },
480
+ });
481
+ activation = input ? await need(flow).dispatch(input.id, (_envelope, signal) => start(signal), controller.signal) : await start();
482
+ // Observe settlement independently of the shared queue and delivery-result persistence.
483
+ // This closes only supplemental inbox admission; a successful result remains successful.
484
+ void activation.result.then(() => inputAdmission.abort(), () => inputAdmission.abort());
485
+ this.state.activations.set(d0.id, activation);
486
+ if (controller.signal.aborted)
487
+ stopNative();
488
+ const currentBot = await this.state.bot(prepared.d.bot);
489
+ if (currentBot.updatedAt !== prepared.d.botRevision) {
490
+ controller.abort();
491
+ throw new OperationError('conflict');
492
+ }
493
+ await this.state.queue.run(async () => {
494
+ await this.state.putDelivery({
495
+ ...need(this.state.table('deliveries').get(d0.id)),
496
+ state: 'running',
497
+ childSessionId: activation?.childId,
498
+ });
499
+ });
500
+ const result = await activation.result;
501
+ // Close supplementation before waiting for the shared persistence queue.
502
+ this.state.settledInputs.add(d0.id);
503
+ await this.recordDeliveryResult(t, d0.id, prepared, activation.childId, result, controller.signal);
504
+ }
505
+ catch (error) {
506
+ await this.state.queue.run(async () => {
507
+ const d = need(this.state.table('deliveries').get(d0.id));
508
+ await this.state.putDelivery({
509
+ ...d,
510
+ ...(activation ? { childSessionId: activation.childId } : {}),
511
+ state: error instanceof OperationError && hasOperationCode(error, 'recovery-needed')
512
+ ? 'unknown'
513
+ : controller.signal.aborted
514
+ ? 'cancelled'
515
+ : 'failed',
516
+ reasonCode: error instanceof OperationError ? error.code : 'native-failure',
517
+ });
518
+ });
519
+ }
520
+ finally {
521
+ inputAdmission.abort();
522
+ clearTimeout(timer);
523
+ controller.signal.removeEventListener('abort', stopNative);
524
+ if (activation) {
525
+ disposal ??= activation.dispose();
526
+ await disposal;
527
+ }
528
+ if (reservedChild) {
529
+ this.state.workers.delete(reservedChild);
530
+ workerReservations.delete(reservedChild);
531
+ }
532
+ this.state.inputAdmissions.delete(d0.id);
533
+ this.state.settledInputs.delete(d0.id);
534
+ this.state.activations.delete(d0.id);
535
+ this.state.controllers.delete(d0.id);
536
+ }
537
+ }
538
+ async execute(id) {
539
+ let t = need(this.state.table('turns').get(id));
540
+ if (t.protocol === 2)
541
+ return this.concurrent.execute(id);
542
+ if (terminal(t)) {
543
+ this.state.cancelledTurns.delete(id);
544
+ return;
545
+ }
546
+ await this.state.queue.run(async () => {
547
+ t = await this.state.putTurn({ ...t, state: 'running' });
548
+ });
549
+ const deadline = this.state.registry.config.groupRoundTimeoutMs ? t.createdAt + this.state.registry.config.groupRoundTimeoutMs : Infinity;
550
+ for (;;) {
551
+ const d0 = this.state.deliveries(id).find(d => d.state === 'pending');
552
+ if (!d0)
553
+ break;
554
+ await this.deliver(t, d0, deadline);
555
+ if (this.state.table('deliveries').get(d0.id)?.state === 'unknown') {
556
+ await this.state.queue.run(async () => {
557
+ for (const rest of this.state.deliveries(id).filter((d) => d.state === 'pending'))
558
+ await this.state.putDelivery({ ...rest, state: 'cancelled', reasonCode: 'previous-result-unknown' });
559
+ });
560
+ break;
561
+ }
562
+ }
563
+ await this.state.queue.run(async () => {
564
+ const current = need(this.state.table('turns').get(id)), rows = this.state.deliveries(id);
565
+ const state = rows.some((d) => d.state === 'unknown')
566
+ ? 'recovery_needed'
567
+ : this.state.cancelledTurns.has(id) || rows.every((d) => d.state === 'cancelled')
568
+ ? 'cancelled'
569
+ : rows.every((d) => d.state === 'completed' || d.state === 'skipped')
570
+ ? 'completed'
571
+ : 'partial';
572
+ await this.state.putTurn({ ...current, state });
573
+ this.state.cancelledTurns.delete(id);
574
+ });
575
+ }
576
+ }
577
+ //# sourceMappingURL=turn-runner.js.map
578
+ export const DSH_BOT_MODULE_VERSION = '0.6.7';