@owlmeans/viable-sdk 0.1.18-rc.8 → 0.1.18

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 (498) hide show
  1. package/README.md +29 -11
  2. package/agent-meta/manifest.json +16 -0
  3. package/agent-meta/skills/viable-sdk/SKILL.md +1033 -0
  4. package/build/api/collect/types.d.ts +30 -0
  5. package/build/api/collect/types.d.ts.map +1 -0
  6. package/build/api/collect/types.js +2 -0
  7. package/build/api/collect/types.js.map +1 -0
  8. package/build/api/collect.d.ts +14 -0
  9. package/build/api/collect.d.ts.map +1 -0
  10. package/build/api/collect.js +132 -0
  11. package/build/api/collect.js.map +1 -0
  12. package/build/api/consts.local.d.ts +21 -0
  13. package/build/api/consts.local.d.ts.map +1 -0
  14. package/build/api/consts.local.js +25 -0
  15. package/build/api/consts.local.js.map +1 -0
  16. package/build/api/index.d.ts +5 -0
  17. package/build/api/index.d.ts.map +1 -1
  18. package/build/api/index.js +2 -0
  19. package/build/api/index.js.map +1 -1
  20. package/build/api/remote.d.ts +13 -6
  21. package/build/api/remote.d.ts.map +1 -1
  22. package/build/api/remote.js +302 -35
  23. package/build/api/remote.js.map +1 -1
  24. package/build/api/transport/types.d.ts +14 -0
  25. package/build/api/transport/types.d.ts.map +1 -0
  26. package/build/api/transport/types.js +2 -0
  27. package/build/api/transport/types.js.map +1 -0
  28. package/build/api/transport.d.ts +4 -0
  29. package/build/api/transport.d.ts.map +1 -0
  30. package/build/api/transport.js +32 -0
  31. package/build/api/transport.js.map +1 -0
  32. package/build/api/types.d.ts +9 -0
  33. package/build/api/types.d.ts.map +1 -0
  34. package/build/api/types.js +2 -0
  35. package/build/api/types.js.map +1 -0
  36. package/build/api/types.local.d.ts +3 -0
  37. package/build/api/types.local.d.ts.map +1 -0
  38. package/build/api/types.local.js +2 -0
  39. package/build/api/types.local.js.map +1 -0
  40. package/build/consts.d.ts +29 -14
  41. package/build/consts.d.ts.map +1 -1
  42. package/build/consts.js +30 -14
  43. package/build/consts.js.map +1 -1
  44. package/build/context/consts.local.d.ts +18 -0
  45. package/build/context/consts.local.d.ts.map +1 -0
  46. package/build/context/consts.local.js +18 -0
  47. package/build/context/consts.local.js.map +1 -0
  48. package/build/context/index.d.ts +3 -7
  49. package/build/context/index.d.ts.map +1 -1
  50. package/build/context/index.js +58 -25
  51. package/build/context/index.js.map +1 -1
  52. package/build/context/types.d.ts +26 -0
  53. package/build/context/types.d.ts.map +1 -0
  54. package/build/context/types.js +2 -0
  55. package/build/context/types.js.map +1 -0
  56. package/build/executor/boot-check.d.ts +1 -40
  57. package/build/executor/boot-check.d.ts.map +1 -1
  58. package/build/executor/boot-check.js +22 -19
  59. package/build/executor/boot-check.js.map +1 -1
  60. package/build/executor/consts.d.ts +55 -0
  61. package/build/executor/consts.d.ts.map +1 -0
  62. package/build/executor/consts.js +66 -0
  63. package/build/executor/consts.js.map +1 -0
  64. package/build/executor/consts.local.d.ts +63 -0
  65. package/build/executor/consts.local.d.ts.map +1 -0
  66. package/build/executor/consts.local.js +69 -0
  67. package/build/executor/consts.local.js.map +1 -0
  68. package/build/executor/env/types.d.ts +40 -0
  69. package/build/executor/env/types.d.ts.map +1 -0
  70. package/build/executor/env/types.js +2 -0
  71. package/build/executor/env/types.js.map +1 -0
  72. package/build/executor/env.d.ts +11 -20
  73. package/build/executor/env.d.ts.map +1 -1
  74. package/build/executor/env.js +39 -59
  75. package/build/executor/env.js.map +1 -1
  76. package/build/executor/errors.d.ts +15 -0
  77. package/build/executor/errors.d.ts.map +1 -1
  78. package/build/executor/errors.js +19 -2
  79. package/build/executor/errors.js.map +1 -1
  80. package/build/executor/files/types.d.ts +106 -0
  81. package/build/executor/files/types.d.ts.map +1 -0
  82. package/build/executor/files/types.js +2 -0
  83. package/build/executor/files/types.js.map +1 -0
  84. package/build/executor/files.d.ts +2 -50
  85. package/build/executor/files.d.ts.map +1 -1
  86. package/build/executor/files.js +225 -68
  87. package/build/executor/files.js.map +1 -1
  88. package/build/executor/git/types.d.ts +19 -0
  89. package/build/executor/git/types.d.ts.map +1 -0
  90. package/build/executor/git/types.js +2 -0
  91. package/build/executor/git/types.js.map +1 -0
  92. package/build/executor/git.d.ts +4 -36
  93. package/build/executor/git.d.ts.map +1 -1
  94. package/build/executor/git.js +206 -241
  95. package/build/executor/git.js.map +1 -1
  96. package/build/executor/glob/types.d.ts +12 -0
  97. package/build/executor/glob/types.d.ts.map +1 -0
  98. package/build/executor/glob/types.js +2 -0
  99. package/build/executor/glob/types.js.map +1 -0
  100. package/build/executor/glob.d.ts +4 -0
  101. package/build/executor/glob.d.ts.map +1 -0
  102. package/build/executor/glob.js +11 -0
  103. package/build/executor/glob.js.map +1 -0
  104. package/build/executor/health/types.d.ts +39 -0
  105. package/build/executor/health/types.d.ts.map +1 -0
  106. package/build/executor/health/types.js +2 -0
  107. package/build/executor/health/types.js.map +1 -0
  108. package/build/executor/health.d.ts +3 -83
  109. package/build/executor/health.d.ts.map +1 -1
  110. package/build/executor/health.js +76 -91
  111. package/build/executor/health.js.map +1 -1
  112. package/build/executor/index.d.ts +14 -15
  113. package/build/executor/index.d.ts.map +1 -1
  114. package/build/executor/index.js +36 -18
  115. package/build/executor/index.js.map +1 -1
  116. package/build/executor/integrity/types.d.ts +25 -0
  117. package/build/executor/integrity/types.d.ts.map +1 -0
  118. package/build/executor/integrity/types.js +2 -0
  119. package/build/executor/integrity/types.js.map +1 -0
  120. package/build/executor/integrity.d.ts +5 -15
  121. package/build/executor/integrity.d.ts.map +1 -1
  122. package/build/executor/integrity.js +28 -39
  123. package/build/executor/integrity.js.map +1 -1
  124. package/build/executor/layout/types.d.ts +69 -0
  125. package/build/executor/layout/types.d.ts.map +1 -0
  126. package/build/executor/layout/types.js +2 -0
  127. package/build/executor/layout/types.js.map +1 -0
  128. package/build/executor/layout.d.ts +9 -56
  129. package/build/executor/layout.d.ts.map +1 -1
  130. package/build/executor/layout.js +35 -82
  131. package/build/executor/layout.js.map +1 -1
  132. package/build/executor/shell/types.d.ts +76 -0
  133. package/build/executor/shell/types.d.ts.map +1 -0
  134. package/build/executor/shell/types.js +2 -0
  135. package/build/executor/shell/types.js.map +1 -0
  136. package/build/executor/shell.d.ts +3 -78
  137. package/build/executor/shell.d.ts.map +1 -1
  138. package/build/executor/shell.js +61 -91
  139. package/build/executor/shell.js.map +1 -1
  140. package/build/executor/spawn/types.d.ts +98 -0
  141. package/build/executor/spawn/types.d.ts.map +1 -0
  142. package/build/executor/spawn/types.js +2 -0
  143. package/build/executor/spawn/types.js.map +1 -0
  144. package/build/executor/spawn.d.ts +3 -103
  145. package/build/executor/spawn.d.ts.map +1 -1
  146. package/build/executor/spawn.js +192 -274
  147. package/build/executor/spawn.js.map +1 -1
  148. package/build/executor/types.d.ts +123 -0
  149. package/build/executor/types.d.ts.map +1 -0
  150. package/build/executor/types.js +2 -0
  151. package/build/executor/types.js.map +1 -0
  152. package/build/executor/types.local.d.ts +6 -0
  153. package/build/executor/types.local.d.ts.map +1 -0
  154. package/build/executor/types.local.js +2 -0
  155. package/build/executor/types.local.js.map +1 -0
  156. package/build/index.d.ts +14 -1
  157. package/build/index.d.ts.map +1 -1
  158. package/build/index.js +5 -1
  159. package/build/index.js.map +1 -1
  160. package/build/project/consts.d.ts +17 -0
  161. package/build/project/consts.d.ts.map +1 -0
  162. package/build/project/consts.js +17 -0
  163. package/build/project/consts.js.map +1 -0
  164. package/build/project/consts.local.d.ts +4 -0
  165. package/build/project/consts.local.d.ts.map +1 -0
  166. package/build/project/consts.local.js +4 -0
  167. package/build/project/consts.local.js.map +1 -0
  168. package/build/project/dotenv/types.d.ts +39 -0
  169. package/build/project/dotenv/types.d.ts.map +1 -0
  170. package/build/project/dotenv/types.js +2 -0
  171. package/build/project/dotenv/types.js.map +1 -0
  172. package/build/project/dotenv.d.ts +4 -0
  173. package/build/project/dotenv.d.ts.map +1 -0
  174. package/build/project/dotenv.js +56 -0
  175. package/build/project/dotenv.js.map +1 -0
  176. package/build/project/env/types.d.ts +40 -0
  177. package/build/project/env/types.d.ts.map +1 -0
  178. package/build/project/env/types.js +2 -0
  179. package/build/project/env/types.js.map +1 -0
  180. package/build/project/env.d.ts +2 -98
  181. package/build/project/env.d.ts.map +1 -1
  182. package/build/project/env.js +63 -215
  183. package/build/project/env.js.map +1 -1
  184. package/build/project/marker/types.d.ts +33 -0
  185. package/build/project/marker/types.d.ts.map +1 -0
  186. package/build/project/marker/types.js +2 -0
  187. package/build/project/marker/types.js.map +1 -0
  188. package/build/project/marker.d.ts +4 -25
  189. package/build/project/marker.d.ts.map +1 -1
  190. package/build/project/marker.js +40 -43
  191. package/build/project/marker.js.map +1 -1
  192. package/build/project/probe/types.d.ts +22 -0
  193. package/build/project/probe/types.d.ts.map +1 -0
  194. package/build/project/probe/types.js +2 -0
  195. package/build/project/probe/types.js.map +1 -0
  196. package/build/project/probe.d.ts +4 -0
  197. package/build/project/probe.d.ts.map +1 -0
  198. package/build/project/probe.js +39 -0
  199. package/build/project/probe.js.map +1 -0
  200. package/build/project/report/types.d.ts +18 -0
  201. package/build/project/report/types.d.ts.map +1 -0
  202. package/build/project/report/types.js +2 -0
  203. package/build/project/report/types.js.map +1 -0
  204. package/build/project/report.d.ts +7 -0
  205. package/build/project/report.d.ts.map +1 -0
  206. package/build/project/report.js +68 -0
  207. package/build/project/report.js.map +1 -0
  208. package/build/project/setup/types.d.ts +32 -0
  209. package/build/project/setup/types.d.ts.map +1 -0
  210. package/build/project/setup/types.js +2 -0
  211. package/build/project/setup/types.js.map +1 -0
  212. package/build/project/setup.d.ts +4 -53
  213. package/build/project/setup.d.ts.map +1 -1
  214. package/build/project/setup.js +112 -175
  215. package/build/project/setup.js.map +1 -1
  216. package/build/project/types.d.ts +37 -0
  217. package/build/project/types.d.ts.map +1 -0
  218. package/build/project/types.js +2 -0
  219. package/build/project/types.js.map +1 -0
  220. package/build/run/consts.local.d.ts +3 -0
  221. package/build/run/consts.local.d.ts.map +1 -0
  222. package/build/run/consts.local.js +26 -0
  223. package/build/run/consts.local.js.map +1 -0
  224. package/build/run/index.d.ts +11 -69
  225. package/build/run/index.d.ts.map +1 -1
  226. package/build/run/index.js +9 -147
  227. package/build/run/index.js.map +1 -1
  228. package/build/run/local/types.d.ts +39 -0
  229. package/build/run/local/types.d.ts.map +1 -0
  230. package/build/run/local/types.js +2 -0
  231. package/build/run/local/types.js.map +1 -0
  232. package/build/run/local.d.ts +3 -0
  233. package/build/run/local.d.ts.map +1 -0
  234. package/build/run/local.js +130 -0
  235. package/build/run/local.js.map +1 -0
  236. package/build/run/process/types.d.ts +15 -0
  237. package/build/run/process/types.d.ts.map +1 -0
  238. package/build/run/process/types.js +2 -0
  239. package/build/run/process/types.js.map +1 -0
  240. package/build/run/process.d.ts +4 -0
  241. package/build/run/process.d.ts.map +1 -0
  242. package/build/run/process.js +20 -0
  243. package/build/run/process.js.map +1 -0
  244. package/build/run/serve.d.ts +14 -9
  245. package/build/run/serve.d.ts.map +1 -1
  246. package/build/run/serve.js +1 -25
  247. package/build/run/serve.js.map +1 -1
  248. package/build/run/state/types.d.ts +35 -0
  249. package/build/run/state/types.d.ts.map +1 -0
  250. package/build/run/state/types.js +2 -0
  251. package/build/run/state/types.js.map +1 -0
  252. package/build/run/state.d.ts +3 -62
  253. package/build/run/state.d.ts.map +1 -1
  254. package/build/run/state.js +96 -123
  255. package/build/run/state.js.map +1 -1
  256. package/build/run/types.d.ts +78 -0
  257. package/build/run/types.d.ts.map +1 -0
  258. package/build/run/types.js +2 -0
  259. package/build/run/types.js.map +1 -0
  260. package/build/session/consts.local.d.ts +5 -0
  261. package/build/session/consts.local.d.ts.map +1 -0
  262. package/build/session/consts.local.js +5 -0
  263. package/build/session/consts.local.js.map +1 -0
  264. package/build/session/index.d.ts +5 -10
  265. package/build/session/index.d.ts.map +1 -1
  266. package/build/session/index.js +84 -15
  267. package/build/session/index.js.map +1 -1
  268. package/build/session/questions.d.ts +16 -0
  269. package/build/session/questions.d.ts.map +1 -0
  270. package/build/session/questions.js +17 -0
  271. package/build/session/questions.js.map +1 -0
  272. package/build/session/queue.d.ts +61 -0
  273. package/build/session/queue.d.ts.map +1 -0
  274. package/build/session/queue.js +156 -0
  275. package/build/session/queue.js.map +1 -0
  276. package/build/session/tasks.d.ts +11 -30
  277. package/build/session/tasks.d.ts.map +1 -1
  278. package/build/session/tasks.js +18 -78
  279. package/build/session/tasks.js.map +1 -1
  280. package/build/session/types.d.ts +20 -0
  281. package/build/session/types.d.ts.map +1 -0
  282. package/build/session/types.js +2 -0
  283. package/build/session/types.js.map +1 -0
  284. package/build/task/consts.d.ts +12 -0
  285. package/build/task/consts.d.ts.map +1 -0
  286. package/build/task/consts.js +12 -0
  287. package/build/task/consts.js.map +1 -0
  288. package/build/task/consts.local.d.ts +19 -0
  289. package/build/task/consts.local.d.ts.map +1 -0
  290. package/build/task/consts.local.js +72 -0
  291. package/build/task/consts.local.js.map +1 -0
  292. package/build/task/driver.d.ts +1 -28
  293. package/build/task/driver.d.ts.map +1 -1
  294. package/build/task/driver.js +2 -9
  295. package/build/task/driver.js.map +1 -1
  296. package/build/task/envelope/types.d.ts +29 -0
  297. package/build/task/envelope/types.d.ts.map +1 -0
  298. package/build/task/envelope/types.js +2 -0
  299. package/build/task/envelope/types.js.map +1 -0
  300. package/build/task/envelope.d.ts +4 -34
  301. package/build/task/envelope.d.ts.map +1 -1
  302. package/build/task/envelope.js +103 -165
  303. package/build/task/envelope.js.map +1 -1
  304. package/build/task/index.d.ts +5 -0
  305. package/build/task/index.d.ts.map +1 -1
  306. package/build/task/index.js +2 -0
  307. package/build/task/index.js.map +1 -1
  308. package/build/task/inquiry/types.d.ts +38 -0
  309. package/build/task/inquiry/types.d.ts.map +1 -0
  310. package/build/task/inquiry/types.js +2 -0
  311. package/build/task/inquiry/types.js.map +1 -0
  312. package/build/task/inquiry.d.ts +5 -0
  313. package/build/task/inquiry.d.ts.map +1 -0
  314. package/build/task/inquiry.js +188 -0
  315. package/build/task/inquiry.js.map +1 -0
  316. package/build/task/types.d.ts +48 -0
  317. package/build/task/types.d.ts.map +1 -0
  318. package/build/task/types.js +2 -0
  319. package/build/task/types.js.map +1 -0
  320. package/build/tools/account/types.d.ts +24 -0
  321. package/build/tools/account/types.d.ts.map +1 -0
  322. package/build/tools/account/types.js +2 -0
  323. package/build/tools/account/types.js.map +1 -0
  324. package/build/tools/account.d.ts +4 -0
  325. package/build/tools/account.d.ts.map +1 -0
  326. package/build/tools/account.js +72 -0
  327. package/build/tools/account.js.map +1 -0
  328. package/build/tools/blueprints/types.d.ts +5 -0
  329. package/build/tools/blueprints/types.d.ts.map +1 -0
  330. package/build/tools/blueprints/types.js +2 -0
  331. package/build/tools/blueprints/types.js.map +1 -0
  332. package/build/tools/blueprints.d.ts +4 -0
  333. package/build/tools/blueprints.d.ts.map +1 -0
  334. package/build/tools/blueprints.js +23 -0
  335. package/build/tools/blueprints.js.map +1 -0
  336. package/build/tools/catalogue/types.d.ts +8 -0
  337. package/build/tools/catalogue/types.d.ts.map +1 -0
  338. package/build/tools/catalogue/types.js +2 -0
  339. package/build/tools/catalogue/types.js.map +1 -0
  340. package/build/tools/catalogue.d.ts +8 -6
  341. package/build/tools/catalogue.d.ts.map +1 -1
  342. package/build/tools/catalogue.js +2565 -213
  343. package/build/tools/catalogue.js.map +1 -1
  344. package/build/tools/config/types.d.ts +19 -0
  345. package/build/tools/config/types.d.ts.map +1 -0
  346. package/build/tools/config/types.js +2 -0
  347. package/build/tools/config/types.js.map +1 -0
  348. package/build/tools/config.d.ts +4 -0
  349. package/build/tools/config.d.ts.map +1 -0
  350. package/build/tools/config.js +42 -0
  351. package/build/tools/config.js.map +1 -0
  352. package/build/tools/consts.d.ts +61 -0
  353. package/build/tools/consts.d.ts.map +1 -0
  354. package/build/tools/consts.js +515 -0
  355. package/build/tools/consts.js.map +1 -0
  356. package/build/tools/consts.local.d.ts +131 -0
  357. package/build/tools/consts.local.d.ts.map +1 -0
  358. package/build/tools/consts.local.js +236 -0
  359. package/build/tools/consts.local.js.map +1 -0
  360. package/build/tools/control/types.d.ts +17 -0
  361. package/build/tools/control/types.d.ts.map +1 -0
  362. package/build/tools/control/types.js +2 -0
  363. package/build/tools/control/types.js.map +1 -0
  364. package/build/tools/control.d.ts +4 -0
  365. package/build/tools/control.d.ts.map +1 -0
  366. package/build/tools/control.js +44 -0
  367. package/build/tools/control.js.map +1 -0
  368. package/build/tools/feed/types.d.ts +21 -0
  369. package/build/tools/feed/types.d.ts.map +1 -0
  370. package/build/tools/feed/types.js +2 -0
  371. package/build/tools/feed/types.js.map +1 -0
  372. package/build/tools/feed.d.ts +4 -0
  373. package/build/tools/feed.d.ts.map +1 -0
  374. package/build/tools/feed.js +75 -0
  375. package/build/tools/feed.js.map +1 -0
  376. package/build/tools/git/types.d.ts +25 -0
  377. package/build/tools/git/types.d.ts.map +1 -0
  378. package/build/tools/git/types.js +2 -0
  379. package/build/tools/git/types.js.map +1 -0
  380. package/build/tools/git.d.ts +4 -0
  381. package/build/tools/git.d.ts.map +1 -0
  382. package/build/tools/git.js +83 -0
  383. package/build/tools/git.js.map +1 -0
  384. package/build/tools/handover/types.d.ts +49 -0
  385. package/build/tools/handover/types.d.ts.map +1 -0
  386. package/build/tools/handover/types.js +2 -0
  387. package/build/tools/handover/types.js.map +1 -0
  388. package/build/tools/handover.d.ts +8 -0
  389. package/build/tools/handover.d.ts.map +1 -0
  390. package/build/tools/handover.js +138 -0
  391. package/build/tools/handover.js.map +1 -0
  392. package/build/tools/host/types.d.ts +34 -0
  393. package/build/tools/host/types.d.ts.map +1 -0
  394. package/build/tools/host/types.js +2 -0
  395. package/build/tools/host/types.js.map +1 -0
  396. package/build/tools/host.d.ts +4 -0
  397. package/build/tools/host.d.ts.map +1 -0
  398. package/build/tools/host.js +13 -0
  399. package/build/tools/host.js.map +1 -0
  400. package/build/tools/iam/types.d.ts +44 -0
  401. package/build/tools/iam/types.d.ts.map +1 -0
  402. package/build/tools/iam/types.js +2 -0
  403. package/build/tools/iam/types.js.map +1 -0
  404. package/build/tools/iam.d.ts +4 -0
  405. package/build/tools/iam.d.ts.map +1 -0
  406. package/build/tools/iam.js +229 -0
  407. package/build/tools/iam.js.map +1 -0
  408. package/build/tools/index.d.ts +27 -1
  409. package/build/tools/index.d.ts.map +1 -1
  410. package/build/tools/index.js +14 -1
  411. package/build/tools/index.js.map +1 -1
  412. package/build/tools/inflight/types.d.ts +47 -0
  413. package/build/tools/inflight/types.d.ts.map +1 -0
  414. package/build/tools/inflight/types.js +2 -0
  415. package/build/tools/inflight/types.js.map +1 -0
  416. package/build/tools/inflight.d.ts +3 -0
  417. package/build/tools/inflight.d.ts.map +1 -0
  418. package/build/tools/inflight.js +88 -0
  419. package/build/tools/inflight.js.map +1 -0
  420. package/build/tools/kits/types.d.ts +12 -0
  421. package/build/tools/kits/types.d.ts.map +1 -0
  422. package/build/tools/kits/types.js +2 -0
  423. package/build/tools/kits/types.js.map +1 -0
  424. package/build/tools/kits.d.ts +4 -0
  425. package/build/tools/kits.d.ts.map +1 -0
  426. package/build/tools/kits.js +33 -0
  427. package/build/tools/kits.js.map +1 -0
  428. package/build/tools/mcp.d.ts +13 -19
  429. package/build/tools/mcp.d.ts.map +1 -1
  430. package/build/tools/mcp.js +117 -38
  431. package/build/tools/mcp.js.map +1 -1
  432. package/build/tools/platform.d.ts +14 -0
  433. package/build/tools/platform.d.ts.map +1 -0
  434. package/build/tools/platform.js +90 -0
  435. package/build/tools/platform.js.map +1 -0
  436. package/build/tools/production/types.d.ts +22 -0
  437. package/build/tools/production/types.d.ts.map +1 -0
  438. package/build/tools/production/types.js +2 -0
  439. package/build/tools/production/types.js.map +1 -0
  440. package/build/tools/production.d.ts +4 -0
  441. package/build/tools/production.d.ts.map +1 -0
  442. package/build/tools/production.js +80 -0
  443. package/build/tools/production.js.map +1 -0
  444. package/build/tools/refusal/types.d.ts +95 -0
  445. package/build/tools/refusal/types.d.ts.map +1 -0
  446. package/build/tools/refusal/types.js +2 -0
  447. package/build/tools/refusal/types.js.map +1 -0
  448. package/build/tools/refusal.d.ts +4 -0
  449. package/build/tools/refusal.d.ts.map +1 -0
  450. package/build/tools/refusal.js +663 -0
  451. package/build/tools/refusal.js.map +1 -0
  452. package/build/tools/settings/types.d.ts +42 -0
  453. package/build/tools/settings/types.d.ts.map +1 -0
  454. package/build/tools/settings/types.js +2 -0
  455. package/build/tools/settings/types.js.map +1 -0
  456. package/build/tools/settings.d.ts +4 -0
  457. package/build/tools/settings.d.ts.map +1 -0
  458. package/build/tools/settings.js +71 -0
  459. package/build/tools/settings.js.map +1 -0
  460. package/build/tools/status/types.d.ts +25 -0
  461. package/build/tools/status/types.d.ts.map +1 -0
  462. package/build/tools/status/types.js +2 -0
  463. package/build/tools/status/types.js.map +1 -0
  464. package/build/tools/status.d.ts +4 -0
  465. package/build/tools/status.d.ts.map +1 -0
  466. package/build/tools/status.js +183 -0
  467. package/build/tools/status.js.map +1 -0
  468. package/build/tools/stories/types.d.ts +48 -0
  469. package/build/tools/stories/types.d.ts.map +1 -0
  470. package/build/tools/stories/types.js +2 -0
  471. package/build/tools/stories/types.js.map +1 -0
  472. package/build/tools/stories.d.ts +8 -0
  473. package/build/tools/stories.d.ts.map +1 -0
  474. package/build/tools/stories.js +79 -0
  475. package/build/tools/stories.js.map +1 -0
  476. package/build/tools/types.d.ts +177 -26
  477. package/build/tools/types.d.ts.map +1 -1
  478. package/build/tools/types.js +1 -32
  479. package/build/tools/types.js.map +1 -1
  480. package/build/types.d.ts +391 -26
  481. package/build/types.d.ts.map +1 -1
  482. package/build/utils.d.ts +8 -0
  483. package/build/utils.d.ts.map +1 -0
  484. package/build/utils.js +12 -0
  485. package/build/utils.js.map +1 -0
  486. package/package.json +30 -34
  487. package/build/harness/index.d.ts +0 -28
  488. package/build/harness/index.d.ts.map +0 -1
  489. package/build/harness/index.js +0 -83
  490. package/build/harness/index.js.map +0 -1
  491. package/build/harness/templates.d.ts +0 -30
  492. package/build/harness/templates.d.ts.map +0 -1
  493. package/build/harness/templates.js +0 -154
  494. package/build/harness/templates.js.map +0 -1
  495. package/build/tools/jobs.d.ts +0 -12
  496. package/build/tools/jobs.d.ts.map +0 -1
  497. package/build/tools/jobs.js +0 -47
  498. package/build/tools/jobs.js.map +0 -1
@@ -1,16 +1,20 @@
1
1
  import { ConnectOpErrorKind, ConnectOpKind, ConnectSessionStatus } from '@owlmeans/viable-common';
2
2
  import { PULL_WAIT_MS } from '../consts.js';
3
- import { writeEnv } from '../project/env.js';
4
- import { readMarker, writeMarker } from '../project/marker.js';
3
+ import { makeProjectEnvHelper } from '../project/env.js';
4
+ import { makeMarkerHelper } from '../project/marker.js';
5
+ import { QuestionQueue } from './questions.js';
5
6
  import { TaskQueue } from './tasks.js';
7
+ import { EMPTY_PULL_PAUSE_MS, FAST_PULL_MS } from './consts.local.js';
6
8
  /**
7
9
  * One attached connector, running.
8
10
  *
9
- * The loop is deliberately simple and deliberately serial: pull operations, answer them one at a
10
- * time, put model tasks aside for the parent agent to drain. Serial because the thing on the other
11
- * end of a local operation is a filesystem the platform believes it is the only writer of — two
12
- * concurrent template writes into the same tree is not a throughput problem, it is a corrupted
13
- * tree.
11
+ * Two loops. The PULL loop never stops to execute anything: it files model tasks and questions for
12
+ * the parent agent and hands every local operation to the WORKER, which answers them one at a time.
13
+ * Serial because the thing on the other end of a local operation is a filesystem the platform
14
+ * believes it is the only writer of — two concurrent template writes into the same tree is not a
15
+ * throughput problem, it is a corrupted tree. Separate because a local command can take minutes (a
16
+ * `bun install`), and a pull loop that waited for it would leave a model task the platform is
17
+ * blocked on undelivered for exactly that long.
14
18
  *
15
19
  * Results are remembered by operation id. A connector that reconnects is handed everything still
16
20
  * outstanding, including whatever it had already answered when the connection dropped, and
@@ -32,12 +36,13 @@ const recordMarker = async (opts, projectId) => {
32
36
  const dir = opts.open.projectDir;
33
37
  if (dir == null)
34
38
  return;
39
+ const markers = makeMarkerHelper(dir);
35
40
  try {
36
- const existing = await readMarker(dir);
41
+ const existing = await markers.readMarker();
37
42
  if (existing?.projectId === projectId)
38
43
  return;
39
44
  const status = await opts.api.project.status(projectId);
40
- await writeMarker(dir, {
45
+ await markers.writeMarker({
41
46
  version: 1,
42
47
  apiUrl: opts.apiUrl ?? '',
43
48
  projectId,
@@ -55,12 +60,18 @@ export const openSession = async (opts) => {
55
60
  if (session.projectId != null)
56
61
  await recordMarker(opts, session.projectId);
57
62
  const tasks = new TaskQueue();
63
+ const questions = new QuestionQueue();
58
64
  const answered = new Map();
65
+ /** Local operations queued for or running on the worker — a redelivery of one is not queued twice. */
66
+ const working = new Set();
67
+ let worker = Promise.resolve();
59
68
  const stats = {
60
69
  opsDone: 0,
61
70
  opsFailed: 0,
62
71
  tasksDelivered: 0,
63
72
  tasksSubmitted: 0,
73
+ questionsDelivered: 0,
74
+ questionsAnswered: 0,
64
75
  lastActivityAt: Date.now(),
65
76
  transport: 'pull',
66
77
  };
@@ -92,9 +103,37 @@ export const openSession = async (opts) => {
92
103
  }
93
104
  return;
94
105
  }
106
+ if (op.kind === ConnectOpKind.Inquiry) {
107
+ // Executed by nobody: it is a decision about the user's own project, and a connector that
108
+ // answered one itself would build a whole application on a guess nobody made. Queued for
109
+ // the parent agent to put to a person, exactly as a model task is queued for its subagent.
110
+ if (questions.push(op.payload, op.id)) {
111
+ stats.questionsDelivered += 1;
112
+ stats.lastActivityAt = Date.now();
113
+ }
114
+ return;
115
+ }
116
+ // Handed to the worker and never awaited here, so the next pull still delivers the model task
117
+ // the platform may be blocked on while this one runs. A redelivery of an operation that is
118
+ // still queued or running is the same operation, and is not queued again.
119
+ if (working.has(op.id))
120
+ return;
121
+ working.add(op.id);
122
+ worker = worker.then(async () => {
123
+ try {
124
+ if (!closed)
125
+ await execute(op);
126
+ }
127
+ finally {
128
+ working.delete(op.id);
129
+ }
130
+ });
131
+ };
132
+ /** One local operation, answered. Never throws: a failure is an answer too. */
133
+ const execute = async (op) => {
95
134
  try {
96
135
  const value = op.kind === ConnectOpKind.Configure
97
- ? await writeEnv(requireExecutor().dir, op.payload)
136
+ ? await makeProjectEnvHelper(requireExecutor().dir).writeEnv(op.payload)
98
137
  : await requireExecutor().execute(op.payload);
99
138
  stats.opsDone += 1;
100
139
  await submit({ opId: op.id, sessionId: session.id, ok: true, value });
@@ -126,13 +165,13 @@ export const openSession = async (opts) => {
126
165
  /**
127
166
  * The pull loop.
128
167
  *
129
- * A long poll rather than a socket, as the first transport: it works through every proxy, needs
130
- * no reconnection logic, and is the only option the URL-configured host has at all. The socket
131
- * is an optimisation over it, not a replacement for it.
168
+ * A long poll, the connector's only transport: it works through every proxy and needs no
169
+ * reconnection logic.
132
170
  */
133
171
  const loop = async () => {
134
172
  while (!closed) {
135
173
  try {
174
+ const startedAt = Date.now();
136
175
  const ops = await opts.api.pullOps(session.id, Math.floor(PULL_WAIT_MS / 1000));
137
176
  stats.lastActivityAt = Date.now();
138
177
  for (const op of ops) {
@@ -140,6 +179,11 @@ export const openSession = async (opts) => {
140
179
  break;
141
180
  await perform(op);
142
181
  }
182
+ // A long poll that came back empty at once held nothing open — asking again straight away
183
+ // would spin against the platform.
184
+ if (ops.length < 1 && Date.now() - startedAt < FAST_PULL_MS) {
185
+ await new Promise(resolve => setTimeout(resolve, EMPTY_PULL_PAUSE_MS));
186
+ }
143
187
  }
144
188
  catch (e) {
145
189
  if (closed)
@@ -153,12 +197,13 @@ export const openSession = async (opts) => {
153
197
  return {
154
198
  session,
155
199
  stats,
156
- nextTask: async (waitMs) => {
157
- const task = await tasks.take(waitMs);
200
+ nextTask: async (waitMs, signal) => {
201
+ const task = await tasks.take(waitMs, signal);
158
202
  if (task != null)
159
203
  stats.lastActivityAt = Date.now();
160
204
  return task;
161
205
  },
206
+ taskAvailable: async (waitMs, signal) => await tasks.available(waitMs, signal),
162
207
  submitTask: async (result) => {
163
208
  const opId = tasks.opIdOf(result.taskId);
164
209
  if (opId == null) {
@@ -172,6 +217,28 @@ export const openSession = async (opts) => {
172
217
  taskById: taskId => tasks.outstandingById(taskId),
173
218
  outstandingTasks: () => tasks.outstandingTasks(),
174
219
  pendingTasks: () => tasks.size(),
220
+ nextQuestion: async (waitMs) => {
221
+ const question = await questions.take(waitMs);
222
+ if (question != null)
223
+ stats.lastActivityAt = Date.now();
224
+ return question;
225
+ },
226
+ answerQuestion: async (answer) => {
227
+ const opId = questions.opIdOf(answer.inquiryId);
228
+ if (opId == null) {
229
+ // The question outlived its operation — the run parked and stopped waiting on this
230
+ // session. The answer is not lost: it is sent by id through `connect.inquiry.answer`,
231
+ // which is the caller's fallback and the reason this reports rather than throws.
232
+ log(`no operation is waiting for question ${answer.inquiryId}`);
233
+ return;
234
+ }
235
+ questions.settle(answer.inquiryId);
236
+ stats.questionsAnswered += 1;
237
+ await submit({ opId, sessionId: session.id, ok: true, value: answer });
238
+ },
239
+ questionById: inquiryId => questions.outstandingById(inquiryId),
240
+ outstandingQuestions: () => questions.outstandingQuestions(),
241
+ pendingQuestions: () => questions.size(),
175
242
  close: async () => {
176
243
  closed = true;
177
244
  try {
@@ -184,5 +251,7 @@ export const openSession = async (opts) => {
184
251
  };
185
252
  };
186
253
  export { ConnectSessionStatus };
254
+ export * from './queue.js';
187
255
  export * from './tasks.js';
256
+ export * from './questions.js';
188
257
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAAE,aAAa,EAAE,oBAAoB,EACxD,MAAM,yBAAyB,CAAA;AAIhC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAYtC;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;GAUG;AACH,MAAM,YAAY,GAAG,KAAK,EAAE,IAAoB,EAAE,SAAiB,EAAiB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AChB,MAAM,GAAG,IAAI,CAAA;YACb,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YACzC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,GAAG,CAAC,iBAAkB,CAAW,CAAC,OAAO,EAAE,CAAC,CAAA;YAC9C,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { InquiryPayload } from '@owlmeans/viable-common';
2
+ import { OpQueue } from './queue.js';
3
+ /**
4
+ * Questions waiting for the person the parent agent is working for.
5
+ *
6
+ * The same queue as the model tasks, and deliberately a SEPARATE one: a question outranks a task
7
+ * because a person is slower than a subagent, and a parent draining one list would hand a question
8
+ * to a subagent — which is precisely the outcome the whole primitive exists to prevent. Nothing
9
+ * here executes anything: a question is delivered, and its answer comes back through the tool the
10
+ * parent calls after asking.
11
+ */
12
+ export declare class QuestionQueue extends OpQueue<InquiryPayload> {
13
+ /** Put to the parent and still unanswered, oldest first. */
14
+ outstandingQuestions(): InquiryPayload[];
15
+ }
16
+ //# sourceMappingURL=questions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/session/questions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,OAAO,CAAC,cAAc,CAAC;IACxD,4DAA4D;IAC5D,oBAAoB,IAAI,cAAc,EAAE,CAEvC;CACF"}
@@ -0,0 +1,17 @@
1
+ import { OpQueue } from './queue.js';
2
+ /**
3
+ * Questions waiting for the person the parent agent is working for.
4
+ *
5
+ * The same queue as the model tasks, and deliberately a SEPARATE one: a question outranks a task
6
+ * because a person is slower than a subagent, and a parent draining one list would hand a question
7
+ * to a subagent — which is precisely the outcome the whole primitive exists to prevent. Nothing
8
+ * here executes anything: a question is delivered, and its answer comes back through the tool the
9
+ * parent calls after asking.
10
+ */
11
+ export class QuestionQueue extends OpQueue {
12
+ /** Put to the parent and still unanswered, oldest first. */
13
+ outstandingQuestions() {
14
+ return this.outstanding();
15
+ }
16
+ }
17
+ //# sourceMappingURL=questions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"questions.js","sourceRoot":"","sources":["../../src/session/questions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAuB;IACxD,4DAA4D;IAC5D,oBAAoB;QAClB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ export declare class OpQueue<T extends {
2
+ id: string;
3
+ }> {
4
+ private readonly order?;
5
+ private readonly queue;
6
+ private readonly ops;
7
+ /**
8
+ * Every item this session has ever been handed.
9
+ *
10
+ * The platform redelivers an operation on every poll until it is answered — that is what makes a
11
+ * connector restart cost a round trip instead of a run. A model task takes a parent agent tens of
12
+ * seconds to answer, so without this the queue grew one copy per poll for the whole time it was
13
+ * being answered, and the parent then ran the same task over and over: real model calls, paid
14
+ * for, thrown away. Kept after settling too, so a redelivery that raced the platform's deletion
15
+ * is ignored rather than answered a second time.
16
+ */
17
+ private readonly seen;
18
+ /**
19
+ * Handed out and not yet answered. An answer is checked against the item that asked for it.
20
+ *
21
+ * Named `held` rather than `outstanding` so the public reading of it can carry that name: the
22
+ * two subclasses expose it as `outstandingTasks()` / `outstandingQuestions()`, and a field and
23
+ * a method cannot share one name.
24
+ */
25
+ private readonly held;
26
+ private readonly waiting;
27
+ /** Callers told when an item is QUEUED, without taking it — see {@link OpQueue.available}. */
28
+ private readonly watching;
29
+ /**
30
+ * @param order Which queued item goes first; absent, the oldest. Applied only among items that
31
+ * are queued — one pushed while a caller waits goes straight to that caller.
32
+ */
33
+ constructor(order?: ((a: T, b: T) => number) | undefined);
34
+ /** @returns whether the item was accepted — `false` for a redelivery of one already handed over. */
35
+ push(item: T, opId: string): boolean;
36
+ /**
37
+ * The next item, or null once `waitMs` elapses or `signal` aborts. Never rejects: nothing to do
38
+ * is not a failure.
39
+ *
40
+ * An aborted wait is REMOVED, not merely ignored. A caller that gave up — a tool that answered on
41
+ * something else first — would otherwise leave a waiter behind that swallows the next item: handed
42
+ * out to nobody, held as outstanding, and never shown to the parent that has to perform it.
43
+ */
44
+ take(waitMs: number, signal?: AbortSignal): Promise<T | null>;
45
+ /**
46
+ * Whether an item is queued, waiting up to `waitMs` for one; consumes nothing.
47
+ *
48
+ * For a caller that races an item against something else and must not take one it may not use:
49
+ * it learns one is there, then takes it with `take(0)` — which may still answer null when another
50
+ * caller was quicker, so the race goes on.
51
+ */
52
+ available(waitMs: number, signal?: AbortSignal): Promise<boolean>;
53
+ opIdOf(id: string): string | null;
54
+ outstandingById(id: string): T | null;
55
+ /** Handed out and still unanswered, oldest first. */
56
+ outstanding(): T[];
57
+ settle(id: string): void;
58
+ size(): number;
59
+ private shiftReady;
60
+ }
61
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/session/queue.ts"],"names":[],"mappings":"AAoBA,qBAAa,OAAO,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;IA8B/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IA7BnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA4B;IAChD;;;;;;;;;OASG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,8FAA8F;IAC9F,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAE1C;;;OAGG;IACH,YAA6B,KAAK,CAAC,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,aAAA,EAAI;IAE/D,oGAAoG;IACpG,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAgBnC;IAED;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CA+BlE;IAED;;;;;;OAMG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAyBtE;IAED,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEhC;IAED,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAEpC;IAED,qDAAqD;IACrD,WAAW,IAAI,CAAC,EAAE,CAEjB;IAED,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAGvB;IAED,IAAI,IAAI,MAAM,CAEb;IAED,OAAO,CAAC,UAAU;CASnB"}
@@ -0,0 +1,156 @@
1
+ export class OpQueue {
2
+ order;
3
+ queue = [];
4
+ ops = new Map();
5
+ /**
6
+ * Every item this session has ever been handed.
7
+ *
8
+ * The platform redelivers an operation on every poll until it is answered — that is what makes a
9
+ * connector restart cost a round trip instead of a run. A model task takes a parent agent tens of
10
+ * seconds to answer, so without this the queue grew one copy per poll for the whole time it was
11
+ * being answered, and the parent then ran the same task over and over: real model calls, paid
12
+ * for, thrown away. Kept after settling too, so a redelivery that raced the platform's deletion
13
+ * is ignored rather than answered a second time.
14
+ */
15
+ seen = new Set();
16
+ /**
17
+ * Handed out and not yet answered. An answer is checked against the item that asked for it.
18
+ *
19
+ * Named `held` rather than `outstanding` so the public reading of it can carry that name: the
20
+ * two subclasses expose it as `outstandingTasks()` / `outstandingQuestions()`, and a field and
21
+ * a method cannot share one name.
22
+ */
23
+ held = new Map();
24
+ waiting = [];
25
+ /** Callers told when an item is QUEUED, without taking it — see {@link OpQueue.available}. */
26
+ watching = [];
27
+ /**
28
+ * @param order Which queued item goes first; absent, the oldest. Applied only among items that
29
+ * are queued — one pushed while a caller waits goes straight to that caller.
30
+ */
31
+ constructor(order) {
32
+ this.order = order;
33
+ }
34
+ /** @returns whether the item was accepted — `false` for a redelivery of one already handed over. */
35
+ push(item, opId) {
36
+ // The op id is refreshed even for a known item: a redelivery carries the same id today, and
37
+ // answering the wrong operation is worse than answering none.
38
+ this.ops.set(item.id, opId);
39
+ if (this.seen.has(item.id))
40
+ return false;
41
+ this.seen.add(item.id);
42
+ const next = this.waiting.shift();
43
+ if (next != null) {
44
+ next.resolve(item);
45
+ return true;
46
+ }
47
+ this.queue.push(item);
48
+ for (const watcher of this.watching.splice(0))
49
+ watcher.resolve(true);
50
+ return true;
51
+ }
52
+ /**
53
+ * The next item, or null once `waitMs` elapses or `signal` aborts. Never rejects: nothing to do
54
+ * is not a failure.
55
+ *
56
+ * An aborted wait is REMOVED, not merely ignored. A caller that gave up — a tool that answered on
57
+ * something else first — would otherwise leave a waiter behind that swallows the next item: handed
58
+ * out to nobody, held as outstanding, and never shown to the parent that has to perform it.
59
+ */
60
+ async take(waitMs, signal) {
61
+ const ready = this.shiftReady();
62
+ if (ready != null) {
63
+ this.held.set(ready.id, ready);
64
+ return ready;
65
+ }
66
+ if (waitMs <= 0 || signal?.aborted === true)
67
+ return null;
68
+ return await new Promise(resolve => {
69
+ const leave = () => {
70
+ clearTimeout(entry.timer);
71
+ signal?.removeEventListener('abort', abandon);
72
+ const at = this.waiting.indexOf(entry);
73
+ if (at >= 0)
74
+ this.waiting.splice(at, 1);
75
+ };
76
+ const abandon = () => {
77
+ leave();
78
+ resolve(null);
79
+ };
80
+ const entry = {
81
+ resolve: item => {
82
+ leave();
83
+ if (item != null)
84
+ this.held.set(item.id, item);
85
+ resolve(item);
86
+ },
87
+ timer: setTimeout(abandon, waitMs),
88
+ };
89
+ signal?.addEventListener('abort', abandon, { once: true });
90
+ this.waiting.push(entry);
91
+ });
92
+ }
93
+ /**
94
+ * Whether an item is queued, waiting up to `waitMs` for one; consumes nothing.
95
+ *
96
+ * For a caller that races an item against something else and must not take one it may not use:
97
+ * it learns one is there, then takes it with `take(0)` — which may still answer null when another
98
+ * caller was quicker, so the race goes on.
99
+ */
100
+ async available(waitMs, signal) {
101
+ if (this.queue.length > 0)
102
+ return true;
103
+ if (waitMs <= 0 || signal?.aborted === true)
104
+ return false;
105
+ return await new Promise(resolve => {
106
+ const leave = () => {
107
+ clearTimeout(entry.timer);
108
+ signal?.removeEventListener('abort', abandon);
109
+ const at = this.watching.indexOf(entry);
110
+ if (at >= 0)
111
+ this.watching.splice(at, 1);
112
+ };
113
+ const abandon = () => {
114
+ leave();
115
+ resolve(false);
116
+ };
117
+ const entry = {
118
+ resolve: ready => {
119
+ leave();
120
+ resolve(ready);
121
+ },
122
+ timer: setTimeout(abandon, waitMs),
123
+ };
124
+ signal?.addEventListener('abort', abandon, { once: true });
125
+ this.watching.push(entry);
126
+ });
127
+ }
128
+ opIdOf(id) {
129
+ return this.ops.get(id) ?? null;
130
+ }
131
+ outstandingById(id) {
132
+ return this.held.get(id) ?? null;
133
+ }
134
+ /** Handed out and still unanswered, oldest first. */
135
+ outstanding() {
136
+ return [...this.held.values()];
137
+ }
138
+ settle(id) {
139
+ this.ops.delete(id);
140
+ this.held.delete(id);
141
+ }
142
+ size() {
143
+ return this.queue.length;
144
+ }
145
+ shiftReady() {
146
+ if (this.order == null || this.queue.length < 2)
147
+ return this.queue.shift();
148
+ let first = 0;
149
+ for (let at = 1; at < this.queue.length; at++) {
150
+ if (this.order(this.queue[at], this.queue[first]) < 0)
151
+ first = at;
152
+ }
153
+ return this.queue.splice(first, 1)[0];
154
+ }
155
+ }
156
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.js","sourceRoot":"","sources":["../../src/session/queue.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,OAAO;IA8BW,KAAK;IA7BjB,KAAK,GAAQ,EAAE,CAAA;IACf,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAA;IAChD;;;;;;;;;OASG;IACc,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IACzC;;;;;;OAMG;IACc,IAAI,GAAG,IAAI,GAAG,EAAa,CAAA;IAC3B,OAAO,GAAsB,EAAE,CAAA;IAChD,8FAA8F;IAC7E,QAAQ,GAAe,EAAE,CAAA;IAE1C;;;OAGG;IACH,YAA6B,KAA8B;qBAA9B,KAAK;IAA4B,CAAC;IAE/D,oGAAoG;IACpG,IAAI,CAAC,IAAO,EAAE,IAAY;QACxB,4FAA4F;QAC5F,8DAA8D;QAC9D,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;QAC3B,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,OAAO,KAAK,CAAA;QACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;QACjC,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAElB,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACrB,K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CAAE,CAAC,GAAG,CAAC;gBAAE,KAAK,GAAG,EAAE,CAAA;QACrE,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvC,CAAC;CACF"}
@@ -1,40 +1,21 @@
1
1
  import type { ModelTask } from '@owlmeans/viable-common';
2
+ import { OpQueue } from './queue.js';
2
3
  /**
3
4
  * Model tasks waiting for the parent agent.
4
5
  *
5
- * A queue rather than a callback because of who drains it: the parent agent asks for work when it
6
- * is ready, through a tool call, and may take minutes to answer. Nothing here pushes — the whole
7
- * point of the local-LLM mode is that the platform waits on somebody else's schedule.
8
- *
9
- * The operation id is kept beside each task and never shown to the parent. It is what an answer is
10
- * routed back on, and a parent that could name one could answer an operation it was never given.
6
+ * Everything about how they queue, redeliver and settle is {@link OpQueue}'s; what is left here is
7
+ * the name the rest of the SDK reads them under. A task is a model CALL — the parent runs it in a
8
+ * clean subagent and submits the answer back — which is a different thing from a question, and the
9
+ * two must never drain into one another's tools.
11
10
  */
12
- export declare class TaskQueue {
13
- private readonly queue;
14
- private readonly ops;
11
+ export declare class TaskQueue extends OpQueue<ModelTask> {
15
12
  /**
16
- * Every task this session has ever been handed.
17
- *
18
- * The platform redelivers an operation on every poll until it is answered — that is what makes a
19
- * connector restart cost a round trip instead of a run. A model task takes a parent agent tens of
20
- * seconds to answer, so without this the queue grew one copy per poll for the whole time it was
21
- * being answered, and the parent then ran the same task over and over: real model calls, paid
22
- * for, thrown away. Kept after settling too, so a redelivery that raced the platform's deletion
23
- * is ignored rather than answered a second time.
13
+ * The task that expires first goes first. The platform gives up on a task at its `expiresAt` —
14
+ * a synchronous check inside a blocked call within seconds, a run's call within minutes — so the
15
+ * one with the least time left is the one a parent must not find behind the others.
24
16
  */
25
- private readonly seen;
26
- /** Handed out and not yet answered. An answer is checked against the task that asked for it. */
27
- private readonly outstanding;
28
- private readonly waiting;
29
- /** @returns whether the task was accepted — `false` for a redelivery of one already handed over. */
30
- push(task: ModelTask, opId: string): boolean;
31
- /** The next task, or null once `waitMs` elapses. Never rejects: nothing to do is not a failure. */
32
- take(waitMs: number): Promise<ModelTask | null>;
33
- opIdOf(taskId: string): string | null;
34
- outstandingById(taskId: string): ModelTask | null;
35
- /** Handed out and still unanswered, oldest first. */
17
+ constructor();
18
+ /** Handed to the parent and still unanswered, oldest first. */
36
19
  outstandingTasks(): ModelTask[];
37
- settle(taskId: string): void;
38
- size(): number;
39
20
  }
40
21
  //# sourceMappingURL=tasks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/session/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAOxD;;;;;;;;;GASG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA4B;IAChD;;;;;;;;;OASG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,gGAAgG;IAChG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IAExC,oGAAoG;IACpG,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAgB3C;IAED,mGAAmG;IAC7F,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAuBpD;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEpC;IAED,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAEhD;IAED,qDAAqD;IACrD,gBAAgB,IAAI,SAAS,EAAE,CAE9B;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG3B;IAED,IAAI,IAAI,MAAM,CAEb;CACF"}
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/session/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AASpC;;;;;;;GAOG;AACH,qBAAa,SAAU,SAAQ,OAAO,CAAC,SAAS,CAAC;IAC/C;;;;OAIG;IACH,cAEC;IAED,+DAA+D;IAC/D,gBAAgB,IAAI,SAAS,EAAE,CAE9B;CACF"}