@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
@@ -0,0 +1,663 @@
1
+ import { ResilientError } from '@owlmeans/error';
2
+ import { AGENT_NOT_RUNNING_MARKER, ConnectConfirmationRequired, ConnectConsentRequired, ConnectOutOfCredits, STORY_BATCH_ACTIVE_MARKER, STORY_BATCH_EMPTY_MARKER } from '@owlmeans/viable-common';
3
+ import { settingsHelper } from './settings.js';
4
+ import { CAPABILITY_LABELS, LIMIT_EXHAUSTED_FIELDS, MARKER_SHAPE, MODERATION, PROTECTED_FILE_DETAIL, STACK_FRAME } from './consts.local.js';
5
+ import { UNKNOWN_REFUSAL, UNPHRASED_REFUSAL } from './consts.js';
6
+ export const createRefusalHelper = () => {
7
+ /** The last day a purchase can still be withdrawn from — the day before its EXCLUSIVE deadline. */
8
+ const lastDayOf = (deadline) => deadline != null && !Number.isNaN(deadline.getTime())
9
+ ? new Date(deadline.getTime() - 1).toISOString().slice(0, 10)
10
+ : null;
11
+ const consentRequiredPhrase = (url, deadline) => {
12
+ const until = lastDayOf(deadline);
13
+ return 'Nothing was started. This organization bought credits less than 14 days ago, and under EU'
14
+ + ' consumer rules the platform may only start using them once a person has expressly asked it'
15
+ + ` to (until then the purchase can still be withdrawn from${until != null ? `, up to ${until}` : ''}).`
16
+ + ` Ask the user to open ${url !== '' ? url : 'Billing in the OwlMeans web application'}`
17
+ + ' and confirm there in the browser. Do not retry this call automatically — call it again only'
18
+ + ' after the user says they have confirmed.';
19
+ };
20
+ /** Credits as a person reads them: whole, with thousands separators. Never money. */
21
+ const creditsOf = (credits) => Math.round(Math.max(0, credits)).toLocaleString('en-US');
22
+ /** Where a conversion stage's estimate would come from, in the order the ledger spends it. */
23
+ const splitOf = (fields) => {
24
+ const parts = [
25
+ ...(fields.fromAllowance > 0 ? [`${creditsOf(fields.fromAllowance)} from the conversion limit`] : []),
26
+ ...(fields.fromCreditLimits > 0 ? [`${creditsOf(fields.fromCreditLimits)} from the organization's credit limits`] : []),
27
+ ...(fields.moneyUsd > 0 ? [`$${fields.moneyUsd.toFixed(2)} of topped-up credits`] : []),
28
+ ];
29
+ return parts.length > 0 ? parts.join(', ') : 'nothing from any balance yet';
30
+ };
31
+ const confirmationRequiredPhrase = (fields, retry) => {
32
+ const limited = fields.cap > 0;
33
+ const said = ['Nothing was started.'];
34
+ if (fields.action === 'convert-proceed') {
35
+ said.push(`The next conversion stage is estimated at about ${creditsOf(fields.estimate)} credits: ${splitOf(fields)}.`);
36
+ said.push(limited
37
+ ? `Conversion limit: ${creditsOf(fields.spent)} of ${creditsOf(fields.cap)} credits used,`
38
+ + ` ${creditsOf(fields.cap - fields.spent)} left (updated shortly after each stage).`
39
+ : 'No plan conversion covers this conversion, so it has no conversion limit: every stage is paid'
40
+ + ' from the organization\'s credit limits first, then from topped-up credits.');
41
+ }
42
+ else {
43
+ said.push(limited
44
+ ? 'This conversion would use the project conversion the plan includes: its AI work is free up to'
45
+ + ` ${creditsOf(fields.cap)} credits (the conversion limit). If it needs more, the rest is paid from`
46
+ + ' the organization\'s credit limits first, then from topped-up credits, and every stage shows'
47
+ + ' its estimate and asks again before it spends any of them.'
48
+ : 'This conversion is paid from the organization\'s credit limits first, then from topped-up'
49
+ + ' credits, and every stage shows its estimate first.');
50
+ if (fields.estimate > 0) {
51
+ said.push(`Its first stage is estimated at about ${creditsOf(fields.estimate)} credits: ${splitOf(fields)}.`);
52
+ }
53
+ }
54
+ said.push('Tell the user exactly this and ask whether to go ahead. Only after they agree, call'
55
+ + ` ${retry ?? 'this tool again with the same arguments and "confirm": true'} — never send confirm: true on`
56
+ + ' your own.');
57
+ return said.join(' ');
58
+ };
59
+ const unconfirmedConversionPhrase = (retry) => 'Nothing was started: the platform waits for the user\'s go-ahead. A conversion step is refused like'
60
+ + ' this when it would use the project conversion the plan includes (its AI work is free up to the'
61
+ + ' conversion limit) or spend the organization\'s credit limits or topped-up credits; conversion_status'
62
+ + ` shows the stage estimates. Tell the user and ask; only after they agree, call ${retry}. If that call is`
63
+ + ' refused the same way again, the organization bought credits less than 14 days ago and a person must'
64
+ + ' first confirm in Billing in the OwlMeans web application, in the browser — do not retry until they say'
65
+ + ' they did.';
66
+ const capabilityRequiredPhrase = (params) => {
67
+ const named = params.split('|').map(param => param.trim()).filter(param => param !== '')
68
+ .map(param => CAPABILITY_LABELS[param] ?? param);
69
+ return `Nothing was changed: this needs ${named.length > 0 ? named.join(' or ') : 'a feature'} that the`
70
+ + ' organization\'s plan does not include. Tell the user; the plan is changed in Billing in the'
71
+ + ' OwlMeans web application, and nothing you do here unlocks it.';
72
+ };
73
+ const limitExhaustedPhrase = (packed) => {
74
+ const match = LIMIT_EXHAUSTED_FIELDS.exec(packed.trim());
75
+ if (match == null) {
76
+ return 'Nothing was started: one of the plan\'s limits has no room left. Tell the user; they free'
77
+ + ' one up or change the plan in Billing in the OwlMeans web application.';
78
+ }
79
+ const [, key = '', used = '0', limit = '0', resets] = match;
80
+ const renews = resets != null && !Number.isNaN(new Date(resets).getTime())
81
+ ? `, renewed on ${new Date(resets).toISOString().slice(0, 10)}` : '';
82
+ return `Nothing was started: the plan's ${key.replace(/-/g, ' ')} limit is used up (${used} of ${limit}${renews}).`
83
+ + ' Tell the user; they free one up or change the plan in Billing in the OwlMeans web application.';
84
+ };
85
+ /** What follows `marker` in a refusal's message, or `null` when the message does not carry it. */
86
+ const detailOf = (message, marker) => {
87
+ const at = message.indexOf(marker);
88
+ return at < 0 ? null : message.slice(at + marker.length).trim();
89
+ };
90
+ const personRefusalPhrase = (e, retry) => {
91
+ if (e instanceof ConnectOutOfCredits) {
92
+ return `Not enough balance to do this — it needs about $${e.requiredUsd.toFixed(2)} and the account has `
93
+ + `$${e.balanceUsd.toFixed(2)} left. Nothing was started. Ask the user to top up here: `
94
+ + `${e.topUpUrl} — then retry.`;
95
+ }
96
+ if (e instanceof ConnectConsentRequired) {
97
+ return consentRequiredPhrase(e.consentUrl, e.deadline);
98
+ }
99
+ if (e instanceof ConnectConfirmationRequired) {
100
+ return confirmationRequiredPhrase(e, retry);
101
+ }
102
+ const message = refusalMessage(e);
103
+ const capability = detailOf(message, 'capability-required:');
104
+ if (capability != null) {
105
+ return capabilityRequiredPhrase(capability);
106
+ }
107
+ const limit = detailOf(message, 'limit-exhausted:');
108
+ if (limit != null) {
109
+ return limitExhaustedPhrase(limit);
110
+ }
111
+ return null;
112
+ };
113
+ /** `<gate>:<deadline epoch ms | 0>:<encodeURIComponent(url)>` — `ConnectConsentRequired`'s packed body. */
114
+ const consentDetail = (detail) => {
115
+ const [, ms = '0', encoded = ''] = detail.split(':');
116
+ let url = encoded;
117
+ try {
118
+ url = decodeURIComponent(encoded);
119
+ }
120
+ catch { /* keep it as it came */ }
121
+ const at = Number(ms);
122
+ return { url, ...(Number.isFinite(at) && at > 0 ? { deadline: new Date(at) } : {}) };
123
+ };
124
+ /** ` (detail)`, or nothing at all: a phrase must read as a sentence when there is no detail. */
125
+ const aside = (detail) => detail !== '' ? ` (${detail})` : '';
126
+ const refusals = [
127
+ // ── The connector itself is not signed in ───────────────────────────────────────────────────
128
+ // The detail is `<url> <code>`; the code is absent when no device sign-in is pending yet.
129
+ {
130
+ marker: 'oauth:sign-in-required:',
131
+ phrase: detail => {
132
+ const [url = '', code = ''] = detail.split(/\s+/);
133
+ return 'You are not signed in to Viable. Ask the person to open'
134
+ + ` ${url}${code !== '' ? ` and enter the code ${code}` : ''} and approve the connection with their`
135
+ + ' OwlMeans account (a browser has been opened for them where one could be). Then call this tool'
136
+ + ' again — nothing else needs configuring, and the code stays valid for ten minutes.';
137
+ },
138
+ },
139
+ {
140
+ marker: 'oauth:token-rejected:',
141
+ phrase: variable => `The token in ${variable !== '' ? variable : 'the environment'} was refused —`
142
+ + ' it is expired or was revoked. It was not replaced: signing in as somebody else behind the'
143
+ + ' person\'s back is not something this server does. Ask them to unset it to sign in with a'
144
+ + ' browser, or to export a fresh token.',
145
+ },
146
+ {
147
+ marker: 'api:auth:guard:auth-token',
148
+ phrase: () => 'The platform did not accept the access token this server presented — it is expired,'
149
+ + ' or was revoked in Settings. A token from ~/.owlmeans has been forgotten, so the next call'
150
+ + ' starts a browser sign-in; call this tool again.',
151
+ },
152
+ // ── A conversion refused by the platform ────────────────────────────────────────────────────
153
+ {
154
+ marker: 'conversion:unsupported:monorepo',
155
+ phrase: paths => 'This repository points at code that is not inside it — a git submodule, or a'
156
+ + ' workspace package that lives elsewhere. Converting needs everything in one repository.'
157
+ + (paths !== '' ? `\nunlinked: ${paths}` : ''),
158
+ },
159
+ {
160
+ marker: 'conversion:unsupported:bad-origin-url',
161
+ phrase: url => 'That is not a repository address the platform can clone. Give the repository\'s'
162
+ + ' own address, in the form https://github.com/owner/repository.'
163
+ + (url !== '' ? `\ngiven: ${url}` : ''),
164
+ },
165
+ {
166
+ marker: 'conversion:unsupported:not-linked',
167
+ phrase: () => 'The platform has no way to read that repository: no GitHub connection is'
168
+ + ' recorded for this project, or its access was revoked. The user connects it in the web'
169
+ + ' application, and the conversion is started again afterwards.',
170
+ },
171
+ {
172
+ marker: 'conversion:unsupported:no-origin',
173
+ phrase: () => 'This project was generated by the platform rather than imported, so there is'
174
+ + ' nothing to convert. develop_story is what changes a generated project.',
175
+ },
176
+ {
177
+ marker: 'conversion:unsupported:not-convertible',
178
+ phrase: () => 'The intake refused this origin: a conversion needs an application with source'
179
+ + ' code it can read, not an empty repository, a documentation site or a bundle of binaries.'
180
+ + ' check_convertible carries the reasons it gave.',
181
+ },
182
+ {
183
+ marker: 'conversion:unsupported:',
184
+ phrase: reason => `This origin cannot be converted${aside(reason)}, and no retry changes that.`
185
+ + ' check_convertible carries the reasons.',
186
+ },
187
+ {
188
+ marker: 'conversion:stage:',
189
+ phrase: asked => `That decision is not available from where the conversion stands${aside(asked)}.`
190
+ + ' Call conversion_status for the stage it is on and the decision it takes now.',
191
+ },
192
+ {
193
+ marker: 'conversion:clone-failed:',
194
+ phrase: () => 'The origin\'s sources could not be fetched. Check the repository still exists and'
195
+ + ' that the project\'s GitHub connection still reaches it, then'
196
+ + ' proceed_conversion { "decision": "retry" }.',
197
+ },
198
+ {
199
+ marker: 'conversion:purge-in-place',
200
+ phrase: () => 'Nothing to purge: the original sources are the project itself (an in-place'
201
+ + ' repair). It was converted where it stood rather than rebuilt beside a filed-away copy,'
202
+ + ' so there is no __viable_converted/ to delete and nothing has been removed.',
203
+ },
204
+ {
205
+ marker: 'conversion:publish-origin',
206
+ phrase: () => 'That would publish onto the repository this project was imported FROM, and its'
207
+ + ' original sources are still on the volume — the push would write over the user\'s own'
208
+ + ' code. purge_origin first, or publish to a different repository.',
209
+ },
210
+ {
211
+ marker: 'conversion:relocate-declined',
212
+ phrase: () => 'The conversion builds the new application around the existing code, which means'
213
+ + ' moving that code one level down into __viable_converted/; nothing is deleted. The move'
214
+ + ' was declined, so the conversion stopped here. Start it again and answer yes when it asks.',
215
+ },
216
+ // ── A conversion refused by the converter itself, usually reaching a parent on a failed run ──
217
+ {
218
+ marker: 'viable-converter:not-convertible:',
219
+ phrase: reason => `The origin is not an application this platform can convert${aside(reason)}.`,
220
+ },
221
+ {
222
+ marker: 'viable-converter:unsupported-stack:',
223
+ phrase: stack => `The origin is built on a stack this converter carries no knowledge of${aside(stack)}.`
224
+ + ' Nothing retries into a stack it cannot read.',
225
+ },
226
+ {
227
+ marker: 'viable-converter:unlinked:',
228
+ phrase: paths => 'The origin depends on code that is not inside it, so there is no one tree to'
229
+ + ' convert.' + (paths !== '' ? `\nunlinked: ${paths}` : ''),
230
+ },
231
+ {
232
+ marker: 'viable-converter:stage-order:',
233
+ phrase: asked => `A conversion stage was asked for out of order${aside(asked)}.`
234
+ + ' conversion_status says which one comes next.',
235
+ },
236
+ {
237
+ marker: 'viable-converter:capability:',
238
+ phrase: name => `The conversion needs something this deployment does not provide${aside(name)}.`
239
+ + ' Nothing the parent agent does changes that; report it.',
240
+ },
241
+ {
242
+ marker: 'viable-converter:too-large:',
243
+ phrase: bytes => 'The origin is larger than a conversion reads'
244
+ + (bytes !== '' ? ` (${bytes} bytes)` : '') + '.'
245
+ + ' Convert a sub-project of it, or bring in a smaller tree.',
246
+ },
247
+ {
248
+ marker: 'viable-converter:taxonomy-missing',
249
+ phrase: () => 'This step needs what the ANALYSIS stage records, and the volume holds none of'
250
+ + ' it. Run that stage first — proceed_conversion { "decision": "analyze" }.',
251
+ },
252
+ {
253
+ marker: 'viable-converter:stack-missing',
254
+ phrase: () => 'This step needs what the INTAKE stage records about the stack, and the volume'
255
+ + ' holds none of it. The intake is what convert_project runs.',
256
+ },
257
+ {
258
+ marker: 'viable-converter:origin-missing',
259
+ phrase: () => 'The origin\'s sources are not on the volume: the stage that brings them in has'
260
+ + ' not run. convert_project starts it.',
261
+ },
262
+ {
263
+ marker: 'viable-converter:origin-purged',
264
+ phrase: () => 'The original sources were deleted by purge_origin and this needs them. A purge'
265
+ + ' cannot be undone.',
266
+ },
267
+ // ── What the platform refuses to build, whatever asked for it ────────────────────────────────
268
+ {
269
+ marker: 'content-refused:',
270
+ phrase: category => 'The platform will not build this: it describes an application for '
271
+ + (MODERATION[category] ?? 'something the platform does not host') + '.'
272
+ + ' The refusal is about the SHAPE of the product, never its sector — say so to the user;'
273
+ + ' re-sending the same description is refused the same way.',
274
+ },
275
+ {
276
+ marker: 'reserved-name:',
277
+ phrase: brand => (brand !== ''
278
+ ? `"${brand}" is another company's name`
279
+ : 'That name belongs to another company')
280
+ + ', and a project name becomes part of its public web address. Choose a name of the user\'s'
281
+ + ' own — the product may still work with that company.',
282
+ },
283
+ {
284
+ marker: 'target-integrity:',
285
+ // A write or delete of a protected file (`<path> is part of … and cannot be edited`) is a
286
+ // refusal of that ONE file; anything else is the whole tree failing the shape check.
287
+ phrase: files => files.endsWith(PROTECTED_FILE_DETAIL)
288
+ ? `${files}: it decides how the project is built and started, so neither write_file nor`
289
+ + ' delete_file may change it. Describe the change to modify_project instead, if it is needed at all.'
290
+ : 'The files in this project are not a Viable application, so nothing will be'
291
+ + ' built or started from them.' + (files !== '' ? `\n${files}` : ''),
292
+ },
293
+ {
294
+ marker: 'viable-slot:not-found:',
295
+ phrase: () => 'This project has no workload for that yet — its preview is created when the project'
296
+ + ' is confirmed. Read project_status.',
297
+ },
298
+ {
299
+ marker: 'legacy-target:',
300
+ phrase: () => 'This project was generated with an earlier application layout the platform no'
301
+ + ' longer writes into. It keeps running, but no story or change can be applied to it.'
302
+ + ' reinitialize_project rebuilds it with the current layout and keeps its stories.',
303
+ },
304
+ {
305
+ marker: 'viable-project:missconfigured:',
306
+ phrase: () => 'This project\'s analysis is missing from its sandbox, so there is nothing to'
307
+ + ' build a story from. reinitialize_project restores it.',
308
+ },
309
+ // ── A consent or a confirmation only a person can give ───────────────────────────────────────
310
+ // Above the planning markers on purpose: a story start refused for the consent reaches a
311
+ // connector as `planning:commit-failed:<transition>:<the refusal>`, and it is the consent that
312
+ // the person has to act on. The thrown `ConnectConsentRequired` is phrased by `registerCatalogue`
313
+ // itself; this entry answers the same refusal stored as text on a run.
314
+ {
315
+ marker: 'viable-connect:consent-required:',
316
+ phrase: detail => {
317
+ const { url, deadline } = consentDetail(detail);
318
+ return consentRequiredPhrase(url, deadline);
319
+ },
320
+ },
321
+ {
322
+ // The web refusal (`@owlmeans/payment` `PerformanceConsentRequired`) reaching a connector
323
+ // through a stored run error or a planning commit: no URL travels with it.
324
+ marker: 'performance-consent-required',
325
+ phrase: () => consentRequiredPhrase(''),
326
+ },
327
+ {
328
+ // A conversion's confirmation, where the class did not survive: the fields are in the detail.
329
+ // The thrown class is phrased by the conversion tools themselves, with the call to repeat.
330
+ marker: 'viable-connect:confirmation-required:',
331
+ phrase: detail => confirmationRequiredPhrase(ConnectConfirmationRequired.decode(detail)),
332
+ },
333
+ // ── A story refused by the platform's planning ───────────────────────────────────────────────
334
+ // Stories are planning cards, and every change to one is a transition the platform validates:
335
+ // the flow decides which move is open from a status, the head decides whether the story changed
336
+ // under the caller, and a transition is durable before it has committed.
337
+ {
338
+ marker: 'viable-project:story:not-found:',
339
+ phrase: ref => `This project has no story${ref !== '' ? ` ${ref}` : ''}. list_stories shows the`
340
+ + ' codes it has; a story of another project is named together with that projectId.',
341
+ },
342
+ {
343
+ marker: 'viable-project:story:missconfigured:',
344
+ phrase: reason => `The story is not in a state that change applies to${aside(reason)}. A completed`
345
+ + ' story has generated code behind it and is neither reworded nor deleted; story_status says'
346
+ + ' where it stands.',
347
+ },
348
+ {
349
+ marker: 'planning:illegal-transition:',
350
+ phrase: move => `That move is not open from the status the story is in${aside(move)}. A story in`
351
+ + ' progress is already being developed — read story_status; only a story in progress can be'
352
+ + ' completed, and a completed one is put back with reset_story before it is developed again.'
353
+ + ' story_status says where it stands.',
354
+ },
355
+ {
356
+ marker: 'planning:workcard-conflict:',
357
+ phrase: () => 'The story changed between reading it and this change, so nothing was written. Read'
358
+ + ' it again with story_status and repeat the change if it still applies.',
359
+ },
360
+ {
361
+ marker: 'planning:workcard-not-found:',
362
+ phrase: () => 'The platform has no such story or project for this account. list_projects and'
363
+ + ' list_stories show what exists.',
364
+ },
365
+ {
366
+ marker: 'planning:fields-invalid:',
367
+ phrase: detail => `The platform refused the story as malformed${aside(detail)}. Say it again as one`
368
+ + ' plain narrative sentence.',
369
+ },
370
+ {
371
+ marker: 'planning:commit-timeout:',
372
+ phrase: () => 'The platform accepted the change and has not applied it yet. It is neither lost nor'
373
+ + ' undone: read story_status or list_stories in a moment rather than repeating the call.',
374
+ },
375
+ {
376
+ marker: 'planning:commit-failed:',
377
+ phrase: cause => `The platform accepted the change and then could not apply it${aside(cause)}.`
378
+ + ' Read story_status for where the story stands before retrying.',
379
+ },
380
+ // ── A balance, rather than a fault ───────────────────────────────────────────────────────────
381
+ {
382
+ marker: 'out-of-tokens:conversion-budget',
383
+ phrase: () => 'The account balance will not cover this conversion stage. conversion_status'
384
+ + ' carries the estimate; the balance is topped up in the web application.',
385
+ },
386
+ {
387
+ marker: 'out-of-tokens:project-budget',
388
+ phrase: () => 'The account balance is below the floor a new project needs. It is topped up in'
389
+ + ' the web application.',
390
+ },
391
+ {
392
+ marker: 'out-of-tokens:story-budget',
393
+ phrase: () => 'The account balance will not cover developing a story. It is topped up in the'
394
+ + ' web application.',
395
+ },
396
+ // ── A plan, rather than a fault ──────────────────────────────────────────────────────────────
397
+ // Thrown, both are phrased by `personRefusalPhrase` and notified; these answer the same refusal
398
+ // stored as text or wrapped in another one.
399
+ {
400
+ marker: 'capability-required:',
401
+ phrase: params => capabilityRequiredPhrase(params),
402
+ },
403
+ {
404
+ marker: 'limit-exhausted:',
405
+ phrase: packed => limitExhaustedPhrase(packed),
406
+ },
407
+ // ── GitHub, production domains and the app's own sign-in ─────────────────────────────────────
408
+ {
409
+ marker: 'github:not-connected',
410
+ phrase: () => 'This project has no GitHub connection, or its access was revoked. connect_github gives'
411
+ + ' the user an address to authorize it in their browser; once they finished there, call this tool again.',
412
+ },
413
+ {
414
+ marker: 'github:not-published',
415
+ phrase: () => 'This project is not linked to a GitHub repository yet, so there is nothing to push'
416
+ + ' to or pull from. Publish it to a repository first (publish_to_github).',
417
+ },
418
+ {
419
+ marker: 'oauth:invalid-or-expired-state',
420
+ phrase: () => 'The GitHub authorization expired or was already used. Call connect_github again'
421
+ + ' and let the user finish it in the browser.',
422
+ },
423
+ {
424
+ marker: 'viable-domain:taken:',
425
+ phrase: domain => `That domain${domain !== '' ? ` (${domain})` : ''} is already attached to another`
426
+ + ' project\'s production site. Detach it there first, or use another domain.',
427
+ },
428
+ {
429
+ // Above `iam-refused:`, which would answer it too: the staff group refuses only some changes.
430
+ marker: 'iam:group:managed:',
431
+ phrase: key => `The group${aside(key)} is the platform's own staff group: its members, bundles and existence`
432
+ + ' are kept by the platform and cannot be changed here. Its permissions can — grant or restrict them'
433
+ + ' with manage_app_grant (group). Nothing was changed.',
434
+ },
435
+ {
436
+ marker: 'iam-refused:',
437
+ phrase: code => `The application's sign-in refused this change on its own terms${aside(code)} — a`
438
+ + ' managed group or permission, the last owner, or an organization with nobody in it. Nothing'
439
+ + ' was changed.',
440
+ },
441
+ // ── The person's own records ─────────────────────────────────────────────────────────────────
442
+ {
443
+ marker: 'viable-intent:expired:',
444
+ phrase: () => 'That code answers no prompt: a prompt typed on the public site waits only two minutes,'
445
+ + ' and is gone once it was picked up. Nothing was collected — ask the user what they want built,'
446
+ + ' or to type it on the site again.',
447
+ },
448
+ {
449
+ marker: 'viable-intent:throttled:',
450
+ phrase: retry => `Too many prompt pickups from this address just now${retry !== '' ? ` — try again in ${retry} s` : ''}.`
451
+ + ' Nothing was collected.',
452
+ },
453
+ {
454
+ marker: 'marketing-consent:unknown:',
455
+ phrase: () => 'One of those consents is not one this account has, so nothing was withdrawn —'
456
+ + ' privacy_choices lists them by key.',
457
+ },
458
+ {
459
+ marker: 'authorization:forbidden:token',
460
+ phrase: () => 'None of the user\'s own access tokens has that id, so nothing was revoked —'
461
+ + ' list_access_tokens shows them.',
462
+ },
463
+ // ── The project is busy ──────────────────────────────────────────────────────────────────────
464
+ {
465
+ marker: 'viable-project:agent:occupied:',
466
+ phrase: verb => `The platform is already working on this project${aside(verb)}.`
467
+ + ' Read project_status and ask again once it settles.',
468
+ },
469
+ {
470
+ // Spelled with its package prefix, unlike every marker above: `locked:` alone is a substring of
471
+ // ordinary English and of `unlocked:`, and a false match would answer some other refusal with
472
+ // this sentence.
473
+ marker: 'viable-agent-common:locked:',
474
+ phrase: task => `The platform holds this project's lock${aside(task)}.`
475
+ + ' Read project_status and ask again once it settles.',
476
+ },
477
+ // ── The agent's controls and the story batch ─────────────────────────────────────────────────
478
+ {
479
+ marker: `${AGENT_NOT_RUNNING_MARKER}:`,
480
+ phrase: what => `Nothing is running on this project right now that this reaches${aside(what)}, so there is`
481
+ + ' nothing to stop or to send a message to. project_status shows what the agent is doing; steer_agent'
482
+ + ' reaches only an open-ended change while it works — modify_project starts one.',
483
+ },
484
+ {
485
+ marker: `${STORY_BATCH_ACTIVE_MARKER}:`,
486
+ phrase: batch => `A story batch is already running on this project${aside(batch)} — one runs at a time.`
487
+ + ' story_batch_status shows it; cancel_story_batch stops it, once the user agreed, before another starts.',
488
+ },
489
+ {
490
+ marker: STORY_BATCH_EMPTY_MARKER,
491
+ phrase: () => 'Nothing was started: the selection holds no planned story of this project, and a batch'
492
+ + ' implements planned stories only. list_stories shows where each stands; reset_story puts one back to'
493
+ + ' planned.',
494
+ },
495
+ {
496
+ marker: 'git-busy:',
497
+ phrase: () => 'A git operation is already running on this project. Retry once it settles.',
498
+ },
499
+ // ── The connector, from the platform's side of it ────────────────────────────────────────────
500
+ {
501
+ marker: 'viable-connect:local-unsupported:',
502
+ phrase: op => `That addresses infrastructure a local project does not have${aside(op)}:`
503
+ + ' sandbox lifecycle, production, preview watching and remote git are cloud-target only.',
504
+ },
505
+ {
506
+ marker: 'viable-connect:session-gone:',
507
+ phrase: () => 'No connector is attached to this project any more, and this needs one. Call the'
508
+ + ' tool again — a session is opened on demand — then resume_pipeline for the run that'
509
+ + ' stopped.',
510
+ },
511
+ {
512
+ marker: 'viable-connect:session-not-found:',
513
+ phrase: () => 'That session has expired or belongs to another profile. Call the tool again; a'
514
+ + ' session is opened on demand.',
515
+ },
516
+ {
517
+ marker: 'viable-connect:op-timeout:',
518
+ phrase: () => 'The connector did not answer within the operation\'s own deadline. Retry it.',
519
+ },
520
+ {
521
+ marker: 'viable-connect:op-refused:',
522
+ phrase: detail => `The connector ran the operation and refused it${aside(detail)}.`,
523
+ },
524
+ {
525
+ // A delegated write answered early whose outcome the platform never recorded.
526
+ marker: 'viable-connect:call-lost:',
527
+ phrase: () => 'The platform lost the outcome of this call: the process running it stopped before'
528
+ + ' it recorded an answer, so it may or may not have taken effect. Do not repeat it blindly —'
529
+ + ' first read the matching status tool (project_status for a project, story_status for a story,'
530
+ + ' conversion_status for a conversion), then repeat the call only if nothing changed.',
531
+ },
532
+ {
533
+ marker: 'viable-connect:op-unknown:',
534
+ phrase: () => 'That operation is unknown, already answered, or belongs to another session.',
535
+ },
536
+ // ── A value the platform will not store ──────────────────────────────────────────────────────
537
+ // `AuthenPayloadError(<field>)` — the web branding save's refusal, and the connector save's,
538
+ // which reuses its validation. The detail is the wire field, so a project setting is answered with
539
+ // its own rule; any other field still reads as a sentence.
540
+ {
541
+ marker: 'authen:payload:',
542
+ phrase: field => {
543
+ const setting = settingsHelper.projectSettingOf(field);
544
+ return setting != null
545
+ ? `The platform refused the ${setting.label} setting: it takes ${setting.rule}. Nothing was`
546
+ + ' changed — project_settings shows what is stored.'
547
+ : `The platform refused a value in this call as malformed${aside(field)}. Nothing was changed;`
548
+ + ' correct that value and call the tool again.';
549
+ },
550
+ },
551
+ // ── The call itself ──────────────────────────────────────────────────────────────────────────
552
+ {
553
+ marker: 'viable-api:agent:',
554
+ phrase: verb => `The platform's agent could not complete this${aside(verb)}.`
555
+ + ' project_status and conversion_status say where things stand; the call is retryable.',
556
+ },
557
+ {
558
+ marker: 'api:client:auth:',
559
+ phrase: () => 'The platform refused this access token. It is issued in the web application and'
560
+ + ' can be revoked there — check VIABLE_API_TOKEN.',
561
+ },
562
+ {
563
+ marker: 'api:client:crashed:',
564
+ phrase: () => 'The platform errored on this call. Retry it, and read project_status for where'
565
+ + ' the project actually stands before assuming nothing happened.',
566
+ },
567
+ {
568
+ marker: 'api:client:forbidden',
569
+ phrase: () => 'This token may not do that: the project belongs to another account, or the'
570
+ + ' capability is not on this plan.',
571
+ },
572
+ // A production body carries only an incident id, so a refusal whose class never reaches this
573
+ // process is known by its STATUS alone (`@owlmeans/api` `ApiStatusError`).
574
+ {
575
+ marker: 'api:client:status:428',
576
+ phrase: () => consentRequiredPhrase(''),
577
+ },
578
+ {
579
+ marker: 'api:client:status:402',
580
+ phrase: () => 'Nothing was started: the account balance will not cover this. Ask the user to top up'
581
+ + ' in Billing in the OwlMeans web application, then call this tool again.',
582
+ },
583
+ ];
584
+ /** Everything up to the first stack frame — a parent agent can act on none of what follows. */
585
+ const withoutStack = (text) => {
586
+ const lines = text.split('\n');
587
+ const frame = lines.findIndex(line => STACK_FRAME.test(line));
588
+ return (frame < 0 ? lines : lines.slice(0, frame)).join('\n').trim();
589
+ };
590
+ /**
591
+ * Whether this error is what `ResilientError.ensure` leaves when NOTHING recognised the class.
592
+ *
593
+ * Its fall-through converter is `new resilientErrorClass(err.message, err.stack)` against a
594
+ * constructor whose signature is `(type, message, stack)` — so `type` holds the original MESSAGE
595
+ * and `message` holds the original STACK, with no marshalling separator anywhere to give the shape
596
+ * away. Nothing about that path is exotic: `processResponse` in `@owlmeans/api` ensures ANY string
597
+ * response body, and an edge 502/503 answers in plain text (`upstream connect error …`), so a
598
+ * gateway failure was handed to the parent agent as a trace of the SDK's own frames.
599
+ *
600
+ * It is recognised by the head every runtime prints for a stack — `<Name>: <message>` followed by
601
+ * the frames — and what survives is the message the runtime put there, which for the plain-text
602
+ * body IS the refusal. The check is deliberately positional rather than a regex over `<Name>`: the
603
+ * type can itself be a whole marshalled string carrying newlines, and only the segment BEFORE the
604
+ * match has to be a single-line error name.
605
+ */
606
+ const baseConverted = (e) => {
607
+ if (e.type === '')
608
+ return false;
609
+ const at = e.message.indexOf(`: ${e.type}`);
610
+ if (at < 0)
611
+ return false;
612
+ const rest = e.message.slice(at + e.type.length + 2);
613
+ return !e.message.slice(0, at).includes('\n') && (rest === '' || rest.startsWith('\n'));
614
+ };
615
+ /**
616
+ * Where the marker actually is, for anything that can carry one.
617
+ *
618
+ * `ResilientError.ensure` rebuilds a class this process never registered by putting the whole
619
+ * marshalled string in `type` and its own local STACK in `message` — and every refusal the
620
+ * platform raises is such a class, since they are declared in packages the SDK does not depend on.
621
+ * So the marker can be in either field, and a stored run error carries it as a bare string.
622
+ *
623
+ * {@link baseConverted} is asked FIRST, because that rebuild is the one shape where the stack sits
624
+ * outside the marshalling and the fields are swapped: everything below reads `message` as text and
625
+ * would hand the trace straight to the reader.
626
+ */
627
+ const textOf = (e) => {
628
+ if (typeof e === 'string')
629
+ return e;
630
+ if (!(e instanceof Error))
631
+ return String(e ?? '');
632
+ if (e instanceof ResilientError && baseConverted(e))
633
+ return e.type;
634
+ const type = e instanceof ResilientError ? e.type : '';
635
+ if (e.message.includes(ResilientError.separator))
636
+ return e.message;
637
+ if (type.includes(ResilientError.separator))
638
+ return type;
639
+ return e.message !== '' ? e.message : type;
640
+ };
641
+ const refusalMessage = (e) => {
642
+ const parts = textOf(e).split(ResilientError.separator);
643
+ return parts.length > 1 ? withoutStack(parts[1] ?? '') : (parts[0] ?? '');
644
+ };
645
+ const refusalPhrase = (e) => {
646
+ const message = refusalMessage(e);
647
+ if (message === '')
648
+ return UNKNOWN_REFUSAL;
649
+ const known = refusals.find(entry => message.includes(entry.marker));
650
+ if (known == null) {
651
+ return MARKER_SHAPE.test(message) ? `${message}\n${UNPHRASED_REFUSAL}` : message;
652
+ }
653
+ const detail = message.slice(message.indexOf(known.marker) + known.marker.length)
654
+ .replace(/^:/, '').trim();
655
+ return known.phrase(detail);
656
+ };
657
+ return {
658
+ consentRequiredPhrase, confirmationRequiredPhrase, unconfirmedConversionPhrase, capabilityRequiredPhrase,
659
+ limitExhaustedPhrase, personRefusalPhrase, refusalMessage, refusalPhrase, refusals,
660
+ };
661
+ };
662
+ export const refusalHelper = createRefusalHelper();
663
+ //# sourceMappingURL=refusal.js.map