@nocobase/app-plugin-agents 0.1.0-beta.11 → 0.1.0-beta.13

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 (330) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +22 -2
  3. package/dist/client/api/client.d.ts +9 -4
  4. package/dist/client/api/client.d.ts.map +1 -1
  5. package/dist/client/api/client.js +9 -0
  6. package/dist/client/api/client.js.map +1 -1
  7. package/dist/client/api/keys.d.ts +3 -0
  8. package/dist/client/api/keys.d.ts.map +1 -1
  9. package/dist/client/api/keys.js +3 -0
  10. package/dist/client/api/keys.js.map +1 -1
  11. package/dist/client/api/runners.d.ts +8 -4
  12. package/dist/client/api/runners.d.ts.map +1 -1
  13. package/dist/client/api/runners.js +9 -0
  14. package/dist/client/api/runners.js.map +1 -1
  15. package/dist/client/chat/keys.d.ts.map +1 -1
  16. package/dist/client/chat/keys.js +2 -1
  17. package/dist/client/chat/keys.js.map +1 -1
  18. package/dist/client/chat/use-chat.d.ts.map +1 -1
  19. package/dist/client/chat/use-chat.js +8 -1
  20. package/dist/client/chat/use-chat.js.map +1 -1
  21. package/dist/client/components/quota-status.d.ts +16 -0
  22. package/dist/client/components/quota-status.d.ts.map +1 -0
  23. package/dist/client/components/quota-status.js +39 -0
  24. package/dist/client/components/quota-status.js.map +1 -0
  25. package/dist/client/components/runners-refresh.d.ts.map +1 -1
  26. package/dist/client/components/runners-refresh.js +1 -0
  27. package/dist/client/components/runners-refresh.js.map +1 -1
  28. package/dist/client/components/variables/variable-dialogs.d.ts.map +1 -1
  29. package/dist/client/components/variables/variable-dialogs.js +7 -7
  30. package/dist/client/components/variables/variable-dialogs.js.map +1 -1
  31. package/dist/client/config.d.ts +2 -0
  32. package/dist/client/config.d.ts.map +1 -1
  33. package/dist/client/config.js +2 -0
  34. package/dist/client/config.js.map +1 -1
  35. package/dist/client/hooks/use-quota-expiry.d.ts +7 -0
  36. package/dist/client/hooks/use-quota-expiry.d.ts.map +1 -0
  37. package/dist/client/hooks/use-quota-expiry.js +92 -0
  38. package/dist/client/hooks/use-quota-expiry.js.map +1 -0
  39. package/dist/client/kit.d.ts +5 -0
  40. package/dist/client/kit.d.ts.map +1 -1
  41. package/dist/client/kit.js +25 -0
  42. package/dist/client/kit.js.map +1 -1
  43. package/dist/client/lib/agents.d.ts +1 -1
  44. package/dist/client/lib/agents.d.ts.map +1 -1
  45. package/dist/client/lib/agents.js +2 -1
  46. package/dist/client/lib/agents.js.map +1 -1
  47. package/dist/client/lib/format.d.ts +3 -1
  48. package/dist/client/lib/format.d.ts.map +1 -1
  49. package/dist/client/lib/format.js +25 -0
  50. package/dist/client/lib/format.js.map +1 -1
  51. package/dist/client/lib/skill-settings-context.d.ts +9 -0
  52. package/dist/client/lib/skill-settings-context.d.ts.map +1 -0
  53. package/dist/client/lib/skill-settings-context.js +4 -0
  54. package/dist/client/lib/skill-settings-context.js.map +1 -0
  55. package/dist/client/lib/skill-settings.d.ts +12 -0
  56. package/dist/client/lib/skill-settings.d.ts.map +1 -0
  57. package/dist/client/lib/skill-settings.js +37 -0
  58. package/dist/client/lib/skill-settings.js.map +1 -0
  59. package/dist/client/locales/en-US.d.ts +1 -0
  60. package/dist/client/locales/en-US.d.ts.map +1 -1
  61. package/dist/client/locales/en-US.js +1 -0
  62. package/dist/client/locales/en-US.js.map +1 -1
  63. package/dist/client/locales/runtimes.en-US.d.ts +72 -0
  64. package/dist/client/locales/runtimes.en-US.d.ts.map +1 -1
  65. package/dist/client/locales/runtimes.en-US.js +73 -1
  66. package/dist/client/locales/runtimes.en-US.js.map +1 -1
  67. package/dist/client/locales/runtimes.zh-CN.d.ts.map +1 -1
  68. package/dist/client/locales/runtimes.zh-CN.js +72 -0
  69. package/dist/client/locales/runtimes.zh-CN.js.map +1 -1
  70. package/dist/client/locales/skills.en-US.d.ts +6 -0
  71. package/dist/client/locales/skills.en-US.d.ts.map +1 -1
  72. package/dist/client/locales/skills.en-US.js +6 -0
  73. package/dist/client/locales/skills.en-US.js.map +1 -1
  74. package/dist/client/locales/skills.zh-CN.d.ts.map +1 -1
  75. package/dist/client/locales/skills.zh-CN.js +6 -0
  76. package/dist/client/locales/skills.zh-CN.js.map +1 -1
  77. package/dist/client/locales/zh-CN.d.ts.map +1 -1
  78. package/dist/client/locales/zh-CN.js +1 -0
  79. package/dist/client/locales/zh-CN.js.map +1 -1
  80. package/dist/client/pages/agents/agent-dialog.d.ts.map +1 -1
  81. package/dist/client/pages/agents/agent-dialog.js +4 -4
  82. package/dist/client/pages/agents/agent-dialog.js.map +1 -1
  83. package/dist/client/pages/agents/runner-agents.d.ts.map +1 -1
  84. package/dist/client/pages/agents/runner-agents.js +23 -10
  85. package/dist/client/pages/agents/runner-agents.js.map +1 -1
  86. package/dist/client/pages/runtimes/connect.js.map +1 -1
  87. package/dist/client/pages/runtimes/index.d.ts.map +1 -1
  88. package/dist/client/pages/runtimes/index.js +1 -1
  89. package/dist/client/pages/runtimes/index.js.map +1 -1
  90. package/dist/client/pages/runtimes/quota-targets.d.ts +4 -0
  91. package/dist/client/pages/runtimes/quota-targets.d.ts.map +1 -0
  92. package/dist/client/pages/runtimes/quota-targets.js +18 -0
  93. package/dist/client/pages/runtimes/quota-targets.js.map +1 -0
  94. package/dist/client/pages/runtimes/quota.d.ts +17 -0
  95. package/dist/client/pages/runtimes/quota.d.ts.map +1 -0
  96. package/dist/client/pages/runtimes/quota.js +48 -0
  97. package/dist/client/pages/runtimes/quota.js.map +1 -0
  98. package/dist/client/pages/runtimes/runner-cells.d.ts +11 -4
  99. package/dist/client/pages/runtimes/runner-cells.d.ts.map +1 -1
  100. package/dist/client/pages/runtimes/runner-cells.js +2 -2
  101. package/dist/client/pages/runtimes/runner-cells.js.map +1 -1
  102. package/dist/client/pages/runtimes/runner-overview.d.ts +9 -0
  103. package/dist/client/pages/runtimes/runner-overview.d.ts.map +1 -0
  104. package/dist/client/pages/runtimes/runner-overview.js +109 -0
  105. package/dist/client/pages/runtimes/runner-overview.js.map +1 -0
  106. package/dist/client/pages/runtimes/runner-runs.d.ts +5 -0
  107. package/dist/client/pages/runtimes/runner-runs.d.ts.map +1 -0
  108. package/dist/client/pages/runtimes/runner-runs.js +35 -0
  109. package/dist/client/pages/runtimes/runner-runs.js.map +1 -0
  110. package/dist/client/pages/runtimes/runner-sheet.d.ts +2 -3
  111. package/dist/client/pages/runtimes/runner-sheet.d.ts.map +1 -1
  112. package/dist/client/pages/runtimes/runner-sheet.js +43 -171
  113. package/dist/client/pages/runtimes/runner-sheet.js.map +1 -1
  114. package/dist/client/pages/runtimes/runner-tools.d.ts +17 -0
  115. package/dist/client/pages/runtimes/runner-tools.d.ts.map +1 -0
  116. package/dist/client/pages/runtimes/runner-tools.js +75 -0
  117. package/dist/client/pages/runtimes/runner-tools.js.map +1 -0
  118. package/dist/client/pages/runtimes/runner-workspaces.d.ts +6 -0
  119. package/dist/client/pages/runtimes/runner-workspaces.d.ts.map +1 -0
  120. package/dist/client/pages/runtimes/runner-workspaces.js +37 -0
  121. package/dist/client/pages/runtimes/runner-workspaces.js.map +1 -0
  122. package/dist/client/pages/runtimes/tool-slots-fields.js +1 -1
  123. package/dist/client/pages/runtimes/tool-slots-fields.js.map +1 -1
  124. package/dist/client/pages/runtimes/workspace-diagnostics.d.ts +6 -4
  125. package/dist/client/pages/runtimes/workspace-diagnostics.d.ts.map +1 -1
  126. package/dist/client/pages/runtimes/workspace-diagnostics.js +61 -37
  127. package/dist/client/pages/runtimes/workspace-diagnostics.js.map +1 -1
  128. package/dist/client/pages/skills/detail/index.d.ts.map +1 -1
  129. package/dist/client/pages/skills/detail/index.js +11 -12
  130. package/dist/client/pages/skills/detail/index.js.map +1 -1
  131. package/dist/database/migrations/.manifest.json +4 -0
  132. package/dist/database/migrations/202610170001_ag_runner_quota.d.ts +4 -0
  133. package/dist/database/migrations/202610170001_ag_runner_quota.d.ts.map +1 -0
  134. package/dist/database/migrations/202610170001_ag_runner_quota.js +19 -0
  135. package/dist/database/migrations/202610170001_ag_runner_quota.js.map +1 -0
  136. package/dist/package.json +1 -1
  137. package/dist/server/cli/surface.d.ts.map +1 -1
  138. package/dist/server/cli/surface.js +4 -1
  139. package/dist/server/cli/surface.js.map +1 -1
  140. package/dist/server/composition.d.ts +2 -0
  141. package/dist/server/composition.d.ts.map +1 -1
  142. package/dist/server/composition.js +15 -4
  143. package/dist/server/composition.js.map +1 -1
  144. package/dist/server/core/agents/agent.service.d.ts.map +1 -1
  145. package/dist/server/core/agents/agent.service.js +5 -1
  146. package/dist/server/core/agents/agent.service.js.map +1 -1
  147. package/dist/server/core/agents/agent.store.d.ts +2 -0
  148. package/dist/server/core/agents/agent.store.d.ts.map +1 -1
  149. package/dist/server/core/agents/agent.store.js +10 -0
  150. package/dist/server/core/agents/agent.store.js.map +1 -1
  151. package/dist/server/core/agents/agent.views.d.ts.map +1 -1
  152. package/dist/server/core/agents/agent.views.js +2 -0
  153. package/dist/server/core/agents/agent.views.js.map +1 -1
  154. package/dist/server/core/agents/index.d.ts +1 -1
  155. package/dist/server/core/agents/index.d.ts.map +1 -1
  156. package/dist/server/core/agents/index.js +1 -1
  157. package/dist/server/core/agents/index.js.map +1 -1
  158. package/dist/server/core/brief/brief.js +2 -2
  159. package/dist/server/core/brief/brief.js.map +1 -1
  160. package/dist/server/core/callers/index.d.ts +9 -0
  161. package/dist/server/core/callers/index.d.ts.map +1 -1
  162. package/dist/server/core/callers/index.js +15 -0
  163. package/dist/server/core/callers/index.js.map +1 -1
  164. package/dist/server/core/conversations/chat-settings.d.ts.map +1 -1
  165. package/dist/server/core/conversations/chat-settings.js +12 -2
  166. package/dist/server/core/conversations/chat-settings.js.map +1 -1
  167. package/dist/server/core/conversations/conversation.service.d.ts +1 -1
  168. package/dist/server/core/conversations/conversation.service.d.ts.map +1 -1
  169. package/dist/server/core/conversations/conversation.service.js +32 -4
  170. package/dist/server/core/conversations/conversation.service.js.map +1 -1
  171. package/dist/server/core/reports/model-usage.d.ts.map +1 -1
  172. package/dist/server/core/reports/model-usage.js +42 -44
  173. package/dist/server/core/reports/model-usage.js.map +1 -1
  174. package/dist/server/core/reports/prices.d.ts.map +1 -1
  175. package/dist/server/core/reports/prices.js +29 -5
  176. package/dist/server/core/reports/prices.js.map +1 -1
  177. package/dist/server/core/reports/report.service.d.ts +4 -2
  178. package/dist/server/core/reports/report.service.d.ts.map +1 -1
  179. package/dist/server/core/reports/report.service.js +147 -68
  180. package/dist/server/core/reports/report.service.js.map +1 -1
  181. package/dist/server/core/runs/availability.d.ts +5 -1
  182. package/dist/server/core/runs/availability.d.ts.map +1 -1
  183. package/dist/server/core/runs/availability.js +8 -2
  184. package/dist/server/core/runs/availability.js.map +1 -1
  185. package/dist/server/core/runs/claim.d.ts +7 -48
  186. package/dist/server/core/runs/claim.d.ts.map +1 -1
  187. package/dist/server/core/runs/claim.js +93 -71
  188. package/dist/server/core/runs/claim.js.map +1 -1
  189. package/dist/server/core/runs/eligibility.d.ts +11 -1
  190. package/dist/server/core/runs/eligibility.d.ts.map +1 -1
  191. package/dist/server/core/runs/eligibility.js +38 -7
  192. package/dist/server/core/runs/eligibility.js.map +1 -1
  193. package/dist/server/core/runs/execution-view.d.ts +8 -0
  194. package/dist/server/core/runs/execution-view.d.ts.map +1 -1
  195. package/dist/server/core/runs/execution-view.js +9 -0
  196. package/dist/server/core/runs/execution-view.js.map +1 -1
  197. package/dist/server/core/runs/execution.d.ts +1 -1
  198. package/dist/server/core/runs/execution.d.ts.map +1 -1
  199. package/dist/server/core/runs/execution.js +8 -2
  200. package/dist/server/core/runs/execution.js.map +1 -1
  201. package/dist/server/core/runs/index.d.ts +3 -3
  202. package/dist/server/core/runs/index.d.ts.map +1 -1
  203. package/dist/server/core/runs/index.js +3 -3
  204. package/dist/server/core/runs/index.js.map +1 -1
  205. package/dist/server/core/runs/lifecycle.d.ts +9 -0
  206. package/dist/server/core/runs/lifecycle.d.ts.map +1 -1
  207. package/dist/server/core/runs/lifecycle.js +102 -18
  208. package/dist/server/core/runs/lifecycle.js.map +1 -1
  209. package/dist/server/core/runs/policy.d.ts +9 -2
  210. package/dist/server/core/runs/policy.d.ts.map +1 -1
  211. package/dist/server/core/runs/policy.js +17 -8
  212. package/dist/server/core/runs/policy.js.map +1 -1
  213. package/dist/server/core/runs/run.service.d.ts +11 -1
  214. package/dist/server/core/runs/run.service.d.ts.map +1 -1
  215. package/dist/server/core/runs/run.service.js +32 -2
  216. package/dist/server/core/runs/run.service.js.map +1 -1
  217. package/dist/server/core/runs/run.store.d.ts +5 -0
  218. package/dist/server/core/runs/run.store.d.ts.map +1 -1
  219. package/dist/server/core/runs/run.store.js +35 -11
  220. package/dist/server/core/runs/run.store.js.map +1 -1
  221. package/dist/server/core/runs/runner-view.d.ts +11 -1
  222. package/dist/server/core/runs/runner-view.d.ts.map +1 -1
  223. package/dist/server/core/runs/runner-view.js +51 -6
  224. package/dist/server/core/runs/runner-view.js.map +1 -1
  225. package/dist/server/core/runs/sweeper.d.ts.map +1 -1
  226. package/dist/server/core/runs/sweeper.js +12 -8
  227. package/dist/server/core/runs/sweeper.js.map +1 -1
  228. package/dist/server/core/runs/transitions.d.ts +5 -1
  229. package/dist/server/core/runs/transitions.d.ts.map +1 -1
  230. package/dist/server/core/runs/transitions.js +31 -11
  231. package/dist/server/core/runs/transitions.js.map +1 -1
  232. package/dist/server/core/runs/workload.d.ts +17 -6
  233. package/dist/server/core/runs/workload.d.ts.map +1 -1
  234. package/dist/server/core/runs/workload.js +186 -129
  235. package/dist/server/core/runs/workload.js.map +1 -1
  236. package/dist/server/core/skills/skill.service.d.ts.map +1 -1
  237. package/dist/server/core/skills/skill.service.js +44 -8
  238. package/dist/server/core/skills/skill.service.js.map +1 -1
  239. package/dist/server/core/transaction-read.d.ts +4 -0
  240. package/dist/server/core/transaction-read.d.ts.map +1 -0
  241. package/dist/server/core/transaction-read.js +30 -0
  242. package/dist/server/core/transaction-read.js.map +1 -0
  243. package/dist/server/core/variables/index.d.ts +1 -1
  244. package/dist/server/core/variables/index.d.ts.map +1 -1
  245. package/dist/server/core/variables/index.js.map +1 -1
  246. package/dist/server/core/variables/variable.service.d.ts +18 -0
  247. package/dist/server/core/variables/variable.service.d.ts.map +1 -1
  248. package/dist/server/core/variables/variable.service.js +95 -20
  249. package/dist/server/core/variables/variable.service.js.map +1 -1
  250. package/dist/server/index.d.ts +2 -0
  251. package/dist/server/index.d.ts.map +1 -1
  252. package/dist/server/index.js +2 -0
  253. package/dist/server/index.js.map +1 -1
  254. package/dist/server/kernel/events.d.ts +4 -2
  255. package/dist/server/kernel/events.d.ts.map +1 -1
  256. package/dist/server/kernel/events.js.map +1 -1
  257. package/dist/server/kernel/scopes.d.ts +6 -0
  258. package/dist/server/kernel/scopes.d.ts.map +1 -1
  259. package/dist/server/kernel/scopes.js.map +1 -1
  260. package/dist/server/online/services.d.ts.map +1 -1
  261. package/dist/server/online/services.js +101 -24
  262. package/dist/server/online/services.js.map +1 -1
  263. package/dist/server/providers/agents.d.ts +9 -1
  264. package/dist/server/providers/agents.d.ts.map +1 -1
  265. package/dist/server/providers/agents.js +3 -0
  266. package/dist/server/providers/agents.js.map +1 -1
  267. package/dist/server/providers/runners.d.ts +3 -1
  268. package/dist/server/providers/runners.d.ts.map +1 -1
  269. package/dist/server/providers/runners.js +12 -3
  270. package/dist/server/providers/runners.js.map +1 -1
  271. package/dist/server/routes/admin.d.ts +2 -0
  272. package/dist/server/routes/admin.d.ts.map +1 -1
  273. package/dist/server/routes/admin.js +18 -5
  274. package/dist/server/routes/admin.js.map +1 -1
  275. package/dist/server/routes/chat.d.ts.map +1 -1
  276. package/dist/server/routes/chat.js +27 -6
  277. package/dist/server/routes/chat.js.map +1 -1
  278. package/dist/server/routes/index.d.ts.map +1 -1
  279. package/dist/server/routes/index.js +3 -0
  280. package/dist/server/routes/index.js.map +1 -1
  281. package/dist/server/routes/runners/admin.d.ts.map +1 -1
  282. package/dist/server/routes/runners/admin.js +219 -25
  283. package/dist/server/routes/runners/admin.js.map +1 -1
  284. package/dist/server/routes/runners/install.d.ts.map +1 -1
  285. package/dist/server/routes/runners/install.js +7 -2
  286. package/dist/server/routes/runners/install.js.map +1 -1
  287. package/dist/server/routes/schemas.d.ts +13 -6
  288. package/dist/server/routes/schemas.d.ts.map +1 -1
  289. package/dist/server/routes/schemas.js +350 -66
  290. package/dist/server/routes/schemas.js.map +1 -1
  291. package/dist/server/runners/runner.service.d.ts +27 -3
  292. package/dist/server/runners/runner.service.d.ts.map +1 -1
  293. package/dist/server/runners/runner.service.js +336 -83
  294. package/dist/server/runners/runner.service.js.map +1 -1
  295. package/dist/server/runners/runner.store.d.ts +4 -2
  296. package/dist/server/runners/runner.store.d.ts.map +1 -1
  297. package/dist/server/runners/runner.store.js +24 -5
  298. package/dist/server/runners/runner.store.js.map +1 -1
  299. package/dist/server/runners/slots.d.ts +5 -2
  300. package/dist/server/runners/slots.d.ts.map +1 -1
  301. package/dist/server/runners/slots.js +3 -4
  302. package/dist/server/runners/slots.js.map +1 -1
  303. package/dist/shared/agents.d.ts +3 -0
  304. package/dist/shared/agents.d.ts.map +1 -1
  305. package/dist/shared/agents.js +0 -15
  306. package/dist/shared/agents.js.map +1 -1
  307. package/dist/shared/conversations.d.ts +6 -0
  308. package/dist/shared/conversations.d.ts.map +1 -1
  309. package/dist/shared/conversations.js.map +1 -1
  310. package/dist/shared/model-catalog.d.ts +5 -0
  311. package/dist/shared/model-catalog.d.ts.map +1 -1
  312. package/dist/shared/model-catalog.js +35 -1
  313. package/dist/shared/model-catalog.js.map +1 -1
  314. package/dist/shared/quota.d.ts +15 -0
  315. package/dist/shared/quota.d.ts.map +1 -0
  316. package/dist/shared/quota.js +2 -0
  317. package/dist/shared/quota.js.map +1 -0
  318. package/dist/shared/runners.d.ts +88 -5
  319. package/dist/shared/runners.d.ts.map +1 -1
  320. package/dist/shared/runners.js +126 -8
  321. package/dist/shared/runners.js.map +1 -1
  322. package/dist/shared/runs.d.ts +10 -0
  323. package/dist/shared/runs.d.ts.map +1 -1
  324. package/dist/shared/runs.js +22 -0
  325. package/dist/shared/runs.js.map +1 -1
  326. package/dist/shared/skills.d.ts +3 -1
  327. package/dist/shared/skills.d.ts.map +1 -1
  328. package/dist/shared/skills.js.map +1 -1
  329. package/package.json +14 -14
  330. package/skills/nocobase-app-plugin-agents/references/runners.md +12 -0
@@ -2,8 +2,10 @@
2
2
  * The path parameters, query strings and small bodies of the plugin's routes. Bodies the services own (an agent, a
3
3
  * skill, a model service) keep their schemas beside the service, strict there too.
4
4
  */
5
+ import { RUNNER_LIST_FIELDS } from '../../shared/runners.js';
5
6
  import { ACTOR_KINDS, AGENT_TOOLS, AgentToolSchema, FailureReasonSchema, PERMISSION_MODES, RUN_INPUT_TYPES, RUN_EVENT_TYPES, RUN_STATUSES, RunEventSchema, RunnerFeatureSchema, RunnerPolicySchema, RunStatusSchema, ToolInfoSchema, ToolLoadSchema, ToolSlotsSchema, WorkspaceDecisionSchema, WorkspaceCleanupResultSchema, } from '@nocobase/agent-protocol';
6
7
  import { z } from 'zod';
8
+ import { QuotaReportSchema } from '@nocobase/agent-protocol';
7
9
  import { AGENT_CHANGE_ACTIONS, AGENT_SOURCES, AGENT_STATUSES, AGENT_UNUSABLE_REASONS, CONFIRM_CHANGES, } from '../../shared/agents.js';
8
10
  import { CONSULTATION_STATES, CONVERSATION_SOURCE_PATTERN, MESSAGE_ROLES, OFFLINE_REASONS, TITLE_SOURCES, } from '../../shared/conversations.js';
9
11
  import { MODEL_KINDS, MODEL_PROVIDER_NAMES, } from '../../shared/models.js';
@@ -20,39 +22,83 @@ const pageToken = z.string().min(1).max(2000).optional();
20
22
  function pageSize(fallback, max) {
21
23
  return z.coerce.number().int().min(1).max(max).default(fallback);
22
24
  }
25
+ export const QuotaLocationSchema = z
26
+ .object({
27
+ runnerId: z.string().describe('The visible runtime with the quota mark.'),
28
+ runnerName: z.string().describe('The runtime display name.'),
29
+ resetsAt: z
30
+ .string()
31
+ .nullable()
32
+ .describe('The known reset time, or null for an unknown reset.'),
33
+ })
34
+ .meta({
35
+ ref: 'AgentsQuotaLocation',
36
+ description: 'A runtime whose quota blocks this agent for the viewer.',
37
+ });
23
38
  export const AgentParams = z.object({
24
- agentId: id,
39
+ agentId: id.describe('The agent identifier.'),
25
40
  });
26
41
  export const RunParams = z.object({
27
- runId: id,
42
+ runId: id.describe('The run identifier.'),
28
43
  });
29
44
  export const SkillParams = z.object({
30
- skillId: id,
45
+ skillId: id.describe('The skill identifier.'),
31
46
  });
32
- export const SkillVersionParams = z.object({ skillId: id, version: z.coerce.number().int().min(1) });
33
- export const ScopeParams = z.object({ scopeKind: id, scopeId: id });
34
- export const VariableParams = z.object({ scopeKind: id, scopeId: id, variableName: id });
35
- export const WorkspaceParams = z.object({ subjectKind: id, subjectId: id });
36
- export const ConversationParams = z.object({ conversationId: id });
47
+ export const SkillVersionParams = z.object({
48
+ skillId: id.describe('The skill identifier.'),
49
+ version: z.coerce
50
+ .number()
51
+ .int()
52
+ .min(1)
53
+ .describe('The version to read or restore.'),
54
+ });
55
+ export const ScopeParams = z.object({ scopeKind: id, scopeId: id.describe('The scope identifier.') });
56
+ export const VariableParams = z.object({
57
+ scopeKind: id,
58
+ scopeId: id.describe('The scope identifier.'),
59
+ variableName: id.describe('The variable name.'),
60
+ });
61
+ export const WorkspaceParams = z.object({
62
+ subjectKind: id.describe('The kind of subject.'),
63
+ subjectId: id.describe('The subject identifier.'),
64
+ });
65
+ export const ConversationParams = z.object({ conversationId: id.describe('The conversation identifier.') });
37
66
  export const ServiceParams = z.object({
38
- serviceName: id,
67
+ serviceName: id.describe('The configured model service name.'),
39
68
  });
40
69
  export const RunnerParams = z.object({
41
- runnerId: id,
70
+ runnerId: id.describe('The runner identifier.'),
71
+ });
72
+ export const JobParams = z.object({
73
+ jobId: id.describe('The job identifier.'),
74
+ });
75
+ export const RunSkillParams = z.object({
76
+ runId: id.describe('The run identifier.'),
77
+ slug: id.describe('The document’s stable URL slug.'),
78
+ });
79
+ export const RunMountParams = z.object({
80
+ runId: id.describe('The run identifier.'),
81
+ name: id.describe('The name to display.'),
42
82
  });
43
- export const JobParams = z.object({ jobId: id });
44
- export const RunSkillParams = z.object({ runId: id, slug: id });
45
- export const RunMountParams = z.object({ runId: id, name: id });
46
83
  export const CommandParams = z.object({
47
- commandId: id,
84
+ commandId: id.describe('The command identifier.'),
48
85
  });
49
86
  export const DistTargetParams = z.object({ product: id, target: id });
50
- export const DistFileParams = z.object({ product: id, version: id, file: id });
87
+ export const DistFileParams = z.object({
88
+ product: id,
89
+ version: id.describe('The version to read or restore.'),
90
+ file: id.describe('The file to upload.'),
91
+ });
51
92
  export const AgentListQuery = z.object({ includeArchived: queryBoolean.optional() });
52
93
  export const AgentHistoryQuery = z.object({
53
- afterRevision: z.coerce.number().int().min(0).optional(),
54
- pageSize: pageSize(50, 100),
55
- pageToken,
94
+ afterRevision: z.coerce
95
+ .number()
96
+ .int()
97
+ .min(0)
98
+ .optional()
99
+ .describe('Return history after this revision.'),
100
+ pageSize: pageSize(50, 100).describe('The maximum number of records to return.'),
101
+ pageToken: pageToken.describe('The continuation token returned by the previous page.'),
56
102
  });
57
103
  export const PreviewBriefQuery = z.object({
58
104
  scenario: id.optional().meta({
@@ -60,23 +106,31 @@ export const PreviewBriefQuery = z.object({
60
106
  }),
61
107
  });
62
108
  export const AuditListQuery = z.object({
63
- pageSize: pageSize(50, 100),
64
- pageToken,
109
+ pageSize: pageSize(50, 100).describe('The maximum number of records to return.'),
110
+ pageToken: pageToken.describe('The continuation token returned by the previous page.'),
65
111
  });
66
112
  export const RunListQuery = z.object({
67
- subjectKind: id.optional(),
68
- subjectId: id.optional(),
69
- agentId: id.optional(),
70
- status: z.enum(RUN_STATUSES).optional(),
71
- pageSize: pageSize(50, 100),
72
- pageToken,
113
+ subjectKind: id.optional().describe('The kind of subject.'),
114
+ subjectId: id.optional().describe('The subject identifier.'),
115
+ agentId: id.optional().describe('The agent identifier.'),
116
+ status: z
117
+ .enum(RUN_STATUSES)
118
+ .optional()
119
+ .describe('The status to set or filter by.'),
120
+ pageSize: pageSize(50, 100).describe('The maximum number of records to return.'),
121
+ pageToken: pageToken.describe('The continuation token returned by the previous page.'),
73
122
  });
74
123
  /**
75
124
  * A run's transcript after `after` (a `seq`). The run panel reads a transcript whole, so a page holds up to 1000
76
125
  * events, beyond the usual cap of 100.
77
126
  */
78
127
  export const RunEventsQuery = z.object({
79
- after: z.coerce.number().int().min(0).optional(),
128
+ after: z.coerce
129
+ .number()
130
+ .int()
131
+ .min(0)
132
+ .optional()
133
+ .describe('Return messages after this cursor.'),
80
134
  // Hono represents one query value as a string and repeated values as an array.
81
135
  type: z
82
136
  .preprocess((value) => (typeof value === 'string' ? [value] : value), z.array(z.enum(RUN_EVENT_TYPES)).min(1).max(100))
@@ -86,40 +140,78 @@ export const RunEventsQuery = z.object({
86
140
  items: { type: 'string', enum: [...RUN_EVENT_TYPES] },
87
141
  description: 'Only these raw event types (repeat for more). Omit to read every type.',
88
142
  }),
89
- pageSize: pageSize(500, 1000),
90
- pageToken,
143
+ pageSize: pageSize(500, 1000).describe('The maximum number of records to return.'),
144
+ pageToken: pageToken.describe('The continuation token returned by the previous page.'),
91
145
  });
92
146
  export const UsageQuerySchema = z.object({
93
- from: z.string().min(1).max(40).optional(),
94
- to: z.string().min(1).max(40).optional(),
95
- groupBy: z.enum(USAGE_GROUP_BYS).default('agent'),
96
- groupId: id.optional(),
97
- agentId: id.optional(),
98
- userId: id.optional(),
147
+ from: z
148
+ .string()
149
+ .min(1)
150
+ .max(40)
151
+ .optional()
152
+ .describe('The beginning of the reporting period.'),
153
+ to: z
154
+ .string()
155
+ .min(1)
156
+ .max(40)
157
+ .optional()
158
+ .describe('The end of the reporting period.'),
159
+ groupBy: z
160
+ .enum(USAGE_GROUP_BYS)
161
+ .default('agent')
162
+ .describe('The dimension to group usage by.'),
163
+ groupId: id.optional().describe('The group identifier.'),
164
+ agentId: id.optional().describe('The agent identifier.'),
165
+ userId: id.optional().describe('The user identifier.'),
99
166
  series: queryBoolean.optional().meta({
100
167
  description: 'Also break each day of `daily` down by the `groupBy` key (`daily[].series`).',
101
168
  }),
102
169
  });
103
170
  export const ModelUsageQuery = z.object({
104
- from: z.string().min(1).max(40).optional(),
105
- to: z.string().min(1).max(40).optional(),
171
+ from: z
172
+ .string()
173
+ .min(1)
174
+ .max(40)
175
+ .optional()
176
+ .describe('The beginning of the reporting period.'),
177
+ to: z
178
+ .string()
179
+ .min(1)
180
+ .max(40)
181
+ .optional()
182
+ .describe('The end of the reporting period.'),
106
183
  });
107
184
  export const ConversationListQuerySchema = z.object({
108
- q: z.string().max(200).optional(),
109
- archived: z.enum(['true', 'false', 'all']).optional(),
110
- agentId: id.optional(),
111
- source: z.string().regex(CONVERSATION_SOURCE_PATTERN).optional(),
112
- pageSize: pageSize(30, 100),
113
- pageToken,
185
+ q: z.string().max(200).optional().describe('Text to search for.'),
186
+ archived: z
187
+ .enum(['true', 'false', 'all'])
188
+ .optional()
189
+ .describe('Filter by archive state.'),
190
+ agentId: id.optional().describe('The agent identifier.'),
191
+ source: z
192
+ .string()
193
+ .regex(CONVERSATION_SOURCE_PATTERN)
194
+ .optional()
195
+ .describe('The source context associated with this record.'),
196
+ pageSize: pageSize(30, 100).describe('The maximum number of records to return.'),
197
+ pageToken: pageToken.describe('The continuation token returned by the previous page.'),
114
198
  });
115
199
  /** Messages, newest page first; `after` reads what arrived since a `seq`. Up to 200 for a whole short chat. */
116
200
  export const MessageListQuerySchema = z.object({
117
- after: z.coerce.number().int().min(0).optional(),
118
- pageSize: pageSize(50, 200),
119
- pageToken,
201
+ after: z.coerce
202
+ .number()
203
+ .int()
204
+ .min(0)
205
+ .optional()
206
+ .describe('Return messages after this cursor.'),
207
+ pageSize: pageSize(50, 200).describe('The maximum number of records to return.'),
208
+ pageToken: pageToken.describe('The continuation token returned by the previous page.'),
120
209
  });
121
210
  export const ModelCatalogQuery = z.object({
122
- kind: z.enum(MODEL_KINDS).default('chat'),
211
+ kind: z
212
+ .enum(MODEL_KINDS)
213
+ .default('chat')
214
+ .describe('The model capability: chat, embedding, or rerank.'),
123
215
  });
124
216
  export const ClaimQuery = z.object({
125
217
  wait: queryBoolean.optional(),
@@ -141,27 +233,43 @@ export const VariableValueInput = z.strictObject({
141
233
  description: 'Take it from the runner: no value is kept here, and the runner that takes the run provides it (`nocobase-runner env set NAME`, or `--pass-env NAME`). Leave `value` out.',
142
234
  }),
143
235
  });
144
- export const SkillRestoreInput = z.strictObject({ expectedRevision: z.number().int().min(1) });
236
+ export const SkillRestoreInput = z.strictObject({
237
+ expectedRevision: z
238
+ .number()
239
+ .int()
240
+ .min(1)
241
+ .describe('The revision last read; reject if the record has changed.'),
242
+ });
145
243
  export const RunnerPatchInput = z
146
244
  .strictObject({
147
- name: z.string().trim().min(1).max(200),
148
- trust: z.enum(RUNNER_TRUST),
149
- slots: z.number().int().min(1).max(64),
245
+ name: z.string().trim().min(1).max(200).describe('The name to display.'),
246
+ trust: z.enum(RUNNER_TRUST).describe('The runner trust level.'),
247
+ slots: z
248
+ .number()
249
+ .int()
250
+ .min(1)
251
+ .max(64)
252
+ .describe('The maximum number of concurrent runs.'),
150
253
  toolSlots: ToolSlotsSchema.nullable().meta({
151
254
  description: 'How many runs of each coding tool it may hold at once, beside `slots`; null, or a tool left out, for no limit of its own.',
152
255
  }),
153
- enabledTools: z.array(AgentToolSchema).max(AGENT_TOOLS.length).nullable(),
154
- acceptJobs: z.boolean(),
256
+ enabledTools: z
257
+ .array(AgentToolSchema)
258
+ .max(AGENT_TOOLS.length)
259
+ .nullable()
260
+ .describe('The agent tools this runner accepts.'),
261
+ acceptJobs: z.boolean().describe('Whether the runner accepts new work.'),
155
262
  })
156
263
  .partial();
157
264
  export const RegistrationTokenInputSchema = z.strictObject({
158
- trust: z.enum(RUNNER_TRUST).optional(),
265
+ trust: z.enum(RUNNER_TRUST).optional().describe('The runner trust level.'),
159
266
  enabledTools: z
160
267
  .array(AgentToolSchema)
161
268
  .min(1)
162
269
  .max(AGENT_TOOLS.length)
163
270
  .nullable()
164
- .optional(),
271
+ .optional()
272
+ .describe('The agent tools this runner accepts.'),
165
273
  slots: z.number().int().min(1).max(64).nullable().optional().meta({
166
274
  description: "How many runs at once the runner takes; omitted or null leaves it to the runner. A runner's own `--slots` overrides it.",
167
275
  }),
@@ -287,6 +395,10 @@ export const AgentViewSchema = agentObject
287
395
  .meta({
288
396
  description: 'The online runners that have its tool and model: team ones, personal ones, the caller’s own, and a few names.',
289
397
  }),
398
+ quota: z
399
+ .array(QuotaLocationSchema)
400
+ .optional()
401
+ .describe('Viewer-visible runtime quota blocks; an empty list means no quota block.'),
290
402
  personalOnly: z.boolean().meta({
291
403
  description: 'Only personal runners have it.',
292
404
  }),
@@ -317,6 +429,10 @@ export const AvailableAgentSchema = z
317
429
  online: z.boolean().meta({
318
430
  description: 'Whether a runner would take the caller’s work now.',
319
431
  }),
432
+ quota: z
433
+ .array(QuotaLocationSchema)
434
+ .optional()
435
+ .describe('Viewer-visible runtime quota blocks; an empty list means no quota block.'),
320
436
  personalOnly: z.boolean().meta({
321
437
  description: 'Only personal runners have it.',
322
438
  }),
@@ -493,6 +609,7 @@ const skillDetailObject = skillObject.extend({
493
609
  scope: z.string(),
494
610
  scopeId: z.string(),
495
611
  name: z.string().nullable(),
612
+ href: z.string().optional(),
496
613
  })),
497
614
  });
498
615
  export const SkillDetailSchema = skillDetailObject;
@@ -547,6 +664,7 @@ const RunEffortReportSchema = z
547
664
  .meta({ ref: 'AgentsRunEffortReport' });
548
665
  export const RunExecutionSnapshotSchema = z
549
666
  .object({
667
+ quota: QuotaReportSchema.optional(),
550
668
  selection: z
551
669
  .object({
552
670
  reason: z.enum(['preferredQueued', 'preferredUnavailable']),
@@ -577,6 +695,9 @@ export const RunExecutionSnapshotSchema = z
577
695
  dispatchedAt: dateTime,
578
696
  finishedAt: dateTime.nullable(),
579
697
  failureReason: z.string().nullable(),
698
+ failureSource: z.literal('sweeper').optional().meta({
699
+ description: 'The server reclaimed this pre-start attempt; absent on runner-reported failures.',
700
+ }),
580
701
  })
581
702
  .meta({ ref: 'AgentsRunExecutionSnapshot' });
582
703
  const runObject = z.object({
@@ -992,7 +1113,7 @@ export const ChatAttachmentContentQuery = z.object({
992
1113
  .transform((value) => value === 'true')
993
1114
  .meta({ description: '`true` to save the file rather than show it.' }),
994
1115
  });
995
- export const ChatAttachmentParams = z.object({ attachmentId: id });
1116
+ export const ChatAttachmentParams = z.object({ attachmentId: id.describe('The attachment identifier.') });
996
1117
  const messageObject = z.object({
997
1118
  id: z.string(),
998
1119
  conversationId: z.string(),
@@ -1048,6 +1169,9 @@ export const SendMessageResultSchema = z
1048
1169
  })
1049
1170
  .meta({ ref: 'AgentsSendMessageResult' });
1050
1171
  export const ChatAgentSchema = z.object({
1172
+ runnerNames: z
1173
+ .array(z.string())
1174
+ .describe('Eligible runtime display names visible to this caller.'),
1051
1175
  id: z.string(),
1052
1176
  name: z.string(),
1053
1177
  description: z.string().nullable(),
@@ -1056,6 +1180,7 @@ export const ChatAgentSchema = z.object({
1056
1180
  avatar: z.string().nullable(),
1057
1181
  isSystemDefault: z.boolean(),
1058
1182
  isMyDefault: z.boolean(),
1183
+ quota: z.array(QuotaLocationSchema).optional(),
1059
1184
  availability,
1060
1185
  personalOnly: z.boolean().meta({
1061
1186
  description: 'Only personal runners have it.',
@@ -1070,7 +1195,7 @@ export const ChatSettingsSchema = z.object({
1070
1195
  }),
1071
1196
  });
1072
1197
  // A runner's working directories, as it last reported them.
1073
- const RunnerWorkspaceSchema = z.object({
1198
+ export const RunnerWorkspaceSchema = z.object({
1074
1199
  subjectKey: z.string().optional(),
1075
1200
  sizeBytes: z.number().int().nonnegative().optional(),
1076
1201
  decision: WorkspaceDecisionSchema.optional(),
@@ -1105,6 +1230,25 @@ const RunnerWorkspaceUsageSchema = z
1105
1230
  description: "The disk holding the runner's working directories; null when it did not say.",
1106
1231
  }),
1107
1232
  intervalMs: z.number().int().positive().optional(),
1233
+ totalBytes: z
1234
+ .number()
1235
+ .nonnegative()
1236
+ .optional()
1237
+ .describe('Sum of measured directory sizes in bytes.'),
1238
+ sizeUnknownCount: z
1239
+ .number()
1240
+ .int()
1241
+ .nonnegative()
1242
+ .optional()
1243
+ .describe('Directories without a measured size.'),
1244
+ counts: z
1245
+ .object({
1246
+ all: z.number().int(),
1247
+ active: z.number().int(),
1248
+ retained: z.number().int(),
1249
+ ended: z.number().int(),
1250
+ })
1251
+ .optional(),
1108
1252
  count: z.number().int(),
1109
1253
  unpushedCount: z.number().int(),
1110
1254
  measuredAt: dateTime.nullable(),
@@ -1151,6 +1295,68 @@ const runnerObject = z.object({
1151
1295
  variables: z.array(z.string()).nullable().optional().meta({
1152
1296
  description: 'The names of the variables it provides to runs that take them from the runner, as it last reported them; null when it reported none. Names only.',
1153
1297
  }),
1298
+ quotaRevision: z
1299
+ .number()
1300
+ .int()
1301
+ .describe('The server quota-state revision; clearing does not require it.'),
1302
+ quotaUsage: z
1303
+ .array(z.object({
1304
+ tool: AgentToolSchema.describe('The coding tool whose quota was observed.'),
1305
+ window: z
1306
+ .string()
1307
+ .describe('The tool-reported usage window identifier.'),
1308
+ scope: z
1309
+ .enum(['tool', 'provider', 'model'])
1310
+ .describe('The affected quota scope.'),
1311
+ target: z
1312
+ .string()
1313
+ .describe('Provider or model identifier; empty for the whole tool.'),
1314
+ usedPercent: z
1315
+ .number()
1316
+ .optional()
1317
+ .describe('Observed usage percentage, when the tool reports it.'),
1318
+ resetsAt: z
1319
+ .string()
1320
+ .nullable()
1321
+ .describe('Known reset instant; null means manual recovery.'),
1322
+ observedAt: z
1323
+ .string()
1324
+ .describe('When the usage snapshot was accepted.'),
1325
+ exhausted: z
1326
+ .boolean()
1327
+ .optional()
1328
+ .describe('Whether the observed window was exhausted.'),
1329
+ }))
1330
+ .nullable()
1331
+ .optional()
1332
+ .describe('Throttled usage snapshots, persisted at five-point changes or state transitions.'),
1333
+ unavailableModels: z
1334
+ .array(z.object({
1335
+ tool: AgentToolSchema.describe('The coding tool whose quota was observed.'),
1336
+ model: z
1337
+ .string()
1338
+ .describe('Affected model or provider; empty for a tool-wide mark.'),
1339
+ at: z.string().describe('When the unavailable mark was observed.'),
1340
+ reported: z
1341
+ .array(z.string())
1342
+ .describe('Models reported by the tool when the mark was recorded.'),
1343
+ reason: z
1344
+ .enum(['modelUnavailable', 'toolQuota'])
1345
+ .optional()
1346
+ .describe('The reason this scope cannot accept work.'),
1347
+ scope: z
1348
+ .enum(['tool', 'provider', 'model'])
1349
+ .optional()
1350
+ .describe('The marked scope; legacy marks target one model.'),
1351
+ window: z.string().optional().describe('The exhausted usage window.'),
1352
+ resetsAt: z
1353
+ .string()
1354
+ .nullable()
1355
+ .optional()
1356
+ .describe('Automatic recovery instant; absent or null means unknown.'),
1357
+ }))
1358
+ .nullable()
1359
+ .optional(),
1154
1360
  workspaceUsage: RunnerWorkspaceUsageSchema.nullable().optional().meta({
1155
1361
  description: 'The working directories it keeps for this application and the free space on the disk holding them, as it last reported them; null or absent before it reports.',
1156
1362
  }),
@@ -1158,10 +1364,11 @@ const runnerObject = z.object({
1158
1364
  createdAt: dateTime,
1159
1365
  updatedAt: dateTime,
1160
1366
  });
1161
- export const RunnerSchema = runnerObject.meta({
1367
+ export const RunnerSchema = runnerObject.omit({ quotaRevision: true }).meta({
1162
1368
  ref: 'AgentsRunner',
1163
1369
  });
1164
- export const RunnerSummarySchema = runnerObject
1370
+ const runnerSummaryObject = runnerObject
1371
+ .omit({ quotaRevision: true })
1165
1372
  .extend({
1166
1373
  hostname: z.string().nullable().meta({
1167
1374
  description: 'The host name it reported; null for a caller who may not manage it.',
@@ -1179,6 +1386,14 @@ export const RunnerSummarySchema = runnerObject
1179
1386
  canManage: z.boolean(),
1180
1387
  canChangeTrust: z.boolean(),
1181
1388
  canRevoke: z.boolean(),
1389
+ canClearQuota: z
1390
+ .boolean()
1391
+ .describe('The viewer may clear an unknown-reset quota mark.'),
1392
+ recentRunsCount: z
1393
+ .number()
1394
+ .int()
1395
+ .nonnegative()
1396
+ .describe('Recent run rows shown by the Runs tab, bounded to ten.'),
1182
1397
  updateVersion: z.string().nullable(),
1183
1398
  requiredProtocol: z.object({
1184
1399
  min: z.number().int(),
@@ -1189,8 +1404,60 @@ export const RunnerSummarySchema = runnerObject
1189
1404
  }),
1190
1405
  })
1191
1406
  .meta({ ref: 'AgentsRunnerSummary' });
1407
+ export const RunnerSummarySchema = runnerSummaryObject;
1408
+ export const RunnerListItemSchema = runnerSummaryObject
1409
+ .pick(RUNNER_LIST_FIELDS)
1410
+ .extend({
1411
+ tools: z
1412
+ .array(z
1413
+ .object({
1414
+ kind: AgentToolSchema,
1415
+ version: z.string().optional(),
1416
+ authenticated: z.boolean(),
1417
+ })
1418
+ .meta({
1419
+ ref: 'AgentsRunnerToolSummary',
1420
+ description: 'Tool identity, version and sign-in state; model catalogs and machine paths belong to runtime get.',
1421
+ }))
1422
+ .describe('Compact coding tool states for this list.'),
1423
+ takesCount: z
1424
+ .number()
1425
+ .int()
1426
+ .describe('Total eligible agents; takes contains at most three.'),
1427
+ workspaceUsage: RunnerWorkspaceUsageSchema.omit({ workspaces: true })
1428
+ .nullable()
1429
+ .optional()
1430
+ .describe('Directory and disk totals without directory rows.'),
1431
+ })
1432
+ .meta({ ref: 'AgentsRunnerListItem' });
1433
+ export const RunnerWorkspacePageMetaSchema = z
1434
+ .object({
1435
+ total: z
1436
+ .number()
1437
+ .int()
1438
+ .describe('Directories matching the selected status.'),
1439
+ page: z.number().int().min(1).describe('The requested one-based page.'),
1440
+ pageSize: z.number().int().min(1).describe('Maximum rows per page.'),
1441
+ usage: RunnerWorkspaceUsageSchema.omit({ workspaces: true })
1442
+ .nullable()
1443
+ .describe('Disk and directory totals, without directory rows.'),
1444
+ })
1445
+ .meta({
1446
+ ref: 'AgentsRunnerWorkspacePageMeta',
1447
+ description: 'Paging and shared runtime workspace totals.',
1448
+ });
1192
1449
  export const RunnerRecentRunSchema = z
1193
1450
  .object({
1451
+ subjectLabel: z
1452
+ .string()
1453
+ .nullable()
1454
+ .optional()
1455
+ .describe('The visible task or conversation label.'),
1456
+ failureReason: z
1457
+ .string()
1458
+ .nullable()
1459
+ .optional()
1460
+ .describe('Terminal failure classification, including toolQuota.'),
1194
1461
  id: z.string(),
1195
1462
  title: z.string(),
1196
1463
  status: RunStatusSchema,
@@ -1219,6 +1486,20 @@ export const RegistrationTokenSchema = z.object({
1219
1486
  toolSlots: ToolSlotsSchema.nullable(),
1220
1487
  expiresAt: dateTime,
1221
1488
  });
1489
+ export const RegistrationTokenListQuery = z.object({
1490
+ page: z.coerce.number().int().min(1).default(1).describe('The page number.'),
1491
+ pageSize: pageSize(50, 100).describe('The maximum number of registration tokens to return.'),
1492
+ });
1493
+ export const RegistrationTokenSummarySchema = z.object({
1494
+ id: z.string(),
1495
+ createdById: z.string().nullable(),
1496
+ trust: z.enum(RUNNER_TRUST),
1497
+ enabledTools: z.array(AgentToolSchema).nullable(),
1498
+ slots: z.number().int().nullable(),
1499
+ toolSlots: ToolSlotsSchema.nullable().optional(),
1500
+ createdAt: dateTime,
1501
+ expiresAt: dateTime,
1502
+ });
1222
1503
  export const DownloadTokenSchema = z.object({
1223
1504
  token: z.string().meta({
1224
1505
  description: 'The download token, shown only in this answer; the install script downloads the CLI with it.',
@@ -1236,18 +1517,21 @@ export const RunContextSchema = z
1236
1517
  });
1237
1518
  // Run requests: work someone asked of an agent on a subject another person answers for.
1238
1519
  export const RunRequestParams = z.object({
1239
- requestId: id,
1520
+ requestId: id.describe('The request identifier.'),
1240
1521
  });
1241
1522
  export const RunRequestListQuery = z.object({
1242
1523
  role: z.enum(['responsible', 'requester']).optional().meta({
1243
1524
  description: '`responsible`: the requests the caller answers for (to confirm); `requester`: the ones the caller asked. Both when left out.',
1244
1525
  }),
1245
- status: z.enum(RUN_REQUEST_STATUSES).optional(),
1246
- subjectKind: id.optional(),
1247
- subjectId: id.optional(),
1248
- agentId: id.optional(),
1249
- pageSize: pageSize(50, 200),
1250
- pageToken,
1526
+ status: z
1527
+ .enum(RUN_REQUEST_STATUSES)
1528
+ .optional()
1529
+ .describe('The status to set or filter by.'),
1530
+ subjectKind: id.optional().describe('The kind of subject.'),
1531
+ subjectId: id.optional().describe('The subject identifier.'),
1532
+ agentId: id.optional().describe('The agent identifier.'),
1533
+ pageSize: pageSize(50, 200).describe('The maximum number of records to return.'),
1534
+ pageToken: pageToken.describe('The continuation token returned by the previous page.'),
1251
1535
  });
1252
1536
  export const RunRequestRejectInput = z.strictObject({
1253
1537
  note: z.string().max(2000).optional().meta({