@nocobase/app-plugin-agents 0.1.0-beta.8 → 1.0.0-beta.15

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 (835) hide show
  1. package/CHANGELOG.md +304 -0
  2. package/README.md +94 -51
  3. package/dist/client/api/client.d.ts +25 -19
  4. package/dist/client/api/client.d.ts.map +1 -1
  5. package/dist/client/api/client.js +23 -24
  6. package/dist/client/api/client.js.map +1 -1
  7. package/dist/client/api/keys.d.ts +4 -1
  8. package/dist/client/api/keys.d.ts.map +1 -1
  9. package/dist/client/api/keys.js +4 -1
  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/ai-form.d.ts +13 -0
  16. package/dist/client/chat/ai-form.d.ts.map +1 -0
  17. package/dist/client/chat/ai-form.js +57 -0
  18. package/dist/client/chat/ai-form.js.map +1 -0
  19. package/dist/client/chat/api.d.ts +16 -14
  20. package/dist/client/chat/api.d.ts.map +1 -1
  21. package/dist/client/chat/api.js +85 -18
  22. package/dist/client/chat/api.js.map +1 -1
  23. package/dist/client/chat/client-id.d.ts +3 -0
  24. package/dist/client/chat/client-id.d.ts.map +1 -0
  25. package/dist/client/chat/client-id.js +17 -0
  26. package/dist/client/chat/client-id.js.map +1 -0
  27. package/dist/client/chat/consultation-identity.d.ts +7 -0
  28. package/dist/client/chat/consultation-identity.d.ts.map +1 -0
  29. package/dist/client/chat/consultation-identity.js +39 -0
  30. package/dist/client/chat/consultation-identity.js.map +1 -0
  31. package/dist/client/chat/context-model.d.ts +21 -3
  32. package/dist/client/chat/context-model.d.ts.map +1 -1
  33. package/dist/client/chat/context-model.js +33 -4
  34. package/dist/client/chat/context-model.js.map +1 -1
  35. package/dist/client/chat/controller.d.ts +83 -0
  36. package/dist/client/chat/controller.d.ts.map +1 -0
  37. package/dist/client/chat/controller.js +767 -0
  38. package/dist/client/chat/controller.js.map +1 -0
  39. package/dist/client/chat/extensions.d.ts +8 -3
  40. package/dist/client/chat/extensions.d.ts.map +1 -1
  41. package/dist/client/chat/extensions.js.map +1 -1
  42. package/dist/client/chat/feedback.d.ts +18 -0
  43. package/dist/client/chat/feedback.d.ts.map +1 -0
  44. package/dist/client/chat/feedback.js +38 -0
  45. package/dist/client/chat/feedback.js.map +1 -0
  46. package/dist/client/chat/form-registry.d.ts +95 -0
  47. package/dist/client/chat/form-registry.d.ts.map +1 -0
  48. package/dist/client/chat/form-registry.js +384 -0
  49. package/dist/client/chat/form-registry.js.map +1 -0
  50. package/dist/client/chat/keys.d.ts +1 -0
  51. package/dist/client/chat/keys.d.ts.map +1 -1
  52. package/dist/client/chat/keys.js +3 -1
  53. package/dist/client/chat/keys.js.map +1 -1
  54. package/dist/client/chat/message-model.d.ts +38 -44
  55. package/dist/client/chat/message-model.d.ts.map +1 -1
  56. package/dist/client/chat/message-model.js +138 -56
  57. package/dist/client/chat/message-model.js.map +1 -1
  58. package/dist/client/chat/provider.d.ts +12 -2
  59. package/dist/client/chat/provider.d.ts.map +1 -1
  60. package/dist/client/chat/provider.js +130 -4
  61. package/dist/client/chat/provider.js.map +1 -1
  62. package/dist/client/chat/submissions.d.ts +67 -0
  63. package/dist/client/chat/submissions.d.ts.map +1 -0
  64. package/dist/client/chat/submissions.js +241 -0
  65. package/dist/client/chat/submissions.js.map +1 -0
  66. package/dist/client/chat/tool-renderer.d.ts +39 -0
  67. package/dist/client/chat/tool-renderer.d.ts.map +1 -0
  68. package/dist/client/chat/tool-renderer.js +27 -0
  69. package/dist/client/chat/tool-renderer.js.map +1 -0
  70. package/dist/client/chat/use-chat-scroll.d.ts +4 -0
  71. package/dist/client/chat/use-chat-scroll.d.ts.map +1 -0
  72. package/dist/client/chat/use-chat-scroll.js +73 -0
  73. package/dist/client/chat/use-chat-scroll.js.map +1 -0
  74. package/dist/client/chat/use-chat.d.ts +13 -24
  75. package/dist/client/chat/use-chat.d.ts.map +1 -1
  76. package/dist/client/chat/use-chat.js +250 -235
  77. package/dist/client/chat/use-chat.js.map +1 -1
  78. package/dist/client/chat.d.ts +20 -8
  79. package/dist/client/chat.d.ts.map +1 -1
  80. package/dist/client/chat.js +16 -4
  81. package/dist/client/chat.js.map +1 -1
  82. package/dist/client/components/agent-picker.d.ts +6 -23
  83. package/dist/client/components/agent-picker.d.ts.map +1 -1
  84. package/dist/client/components/agent-picker.js +20 -39
  85. package/dist/client/components/agent-picker.js.map +1 -1
  86. package/dist/client/components/quota-status.d.ts +16 -0
  87. package/dist/client/components/quota-status.d.ts.map +1 -0
  88. package/dist/client/components/quota-status.js +39 -0
  89. package/dist/client/components/quota-status.js.map +1 -0
  90. package/dist/client/components/runners-refresh.d.ts.map +1 -1
  91. package/dist/client/components/runners-refresh.js +1 -0
  92. package/dist/client/components/runners-refresh.js.map +1 -1
  93. package/dist/client/components/variables/variable-dialogs.d.ts.map +1 -1
  94. package/dist/client/components/variables/variable-dialogs.js +7 -7
  95. package/dist/client/components/variables/variable-dialogs.js.map +1 -1
  96. package/dist/client/config.d.ts +2 -0
  97. package/dist/client/config.d.ts.map +1 -1
  98. package/dist/client/config.js +2 -0
  99. package/dist/client/config.js.map +1 -1
  100. package/dist/client/hooks/use-agent-picker-labels.d.ts.map +1 -1
  101. package/dist/client/hooks/use-agent-picker-labels.js +4 -12
  102. package/dist/client/hooks/use-agent-picker-labels.js.map +1 -1
  103. package/dist/client/hooks/use-quota-expiry.d.ts +7 -0
  104. package/dist/client/hooks/use-quota-expiry.d.ts.map +1 -0
  105. package/dist/client/hooks/use-quota-expiry.js +92 -0
  106. package/dist/client/hooks/use-quota-expiry.js.map +1 -0
  107. package/dist/client/hooks/use-realtime-topic.d.ts +1 -4
  108. package/dist/client/hooks/use-realtime-topic.d.ts.map +1 -1
  109. package/dist/client/hooks/use-realtime-topic.js +7 -11
  110. package/dist/client/hooks/use-realtime-topic.js.map +1 -1
  111. package/dist/client/kit.d.ts +14 -12
  112. package/dist/client/kit.d.ts.map +1 -1
  113. package/dist/client/kit.js +37 -14
  114. package/dist/client/kit.js.map +1 -1
  115. package/dist/client/lib/agents.d.ts +5 -18
  116. package/dist/client/lib/agents.d.ts.map +1 -1
  117. package/dist/client/lib/agents.js +18 -55
  118. package/dist/client/lib/agents.js.map +1 -1
  119. package/dist/client/lib/format.d.ts +3 -1
  120. package/dist/client/lib/format.d.ts.map +1 -1
  121. package/dist/client/lib/format.js +25 -0
  122. package/dist/client/lib/format.js.map +1 -1
  123. package/dist/client/lib/skill-settings-context.d.ts +9 -0
  124. package/dist/client/lib/skill-settings-context.d.ts.map +1 -0
  125. package/dist/client/lib/skill-settings-context.js +4 -0
  126. package/dist/client/lib/skill-settings-context.js.map +1 -0
  127. package/dist/client/lib/skill-settings.d.ts +12 -0
  128. package/dist/client/lib/skill-settings.d.ts.map +1 -0
  129. package/dist/client/lib/skill-settings.js +37 -0
  130. package/dist/client/lib/skill-settings.js.map +1 -0
  131. package/dist/client/locales/chat.en-US.d.ts +8 -27
  132. package/dist/client/locales/chat.en-US.d.ts.map +1 -1
  133. package/dist/client/locales/chat.en-US.js +12 -30
  134. package/dist/client/locales/chat.en-US.js.map +1 -1
  135. package/dist/client/locales/chat.zh-CN.d.ts.map +1 -1
  136. package/dist/client/locales/chat.zh-CN.js +9 -27
  137. package/dist/client/locales/chat.zh-CN.js.map +1 -1
  138. package/dist/client/locales/en-US.d.ts +87 -217
  139. package/dist/client/locales/en-US.d.ts.map +1 -1
  140. package/dist/client/locales/en-US.js +92 -218
  141. package/dist/client/locales/en-US.js.map +1 -1
  142. package/dist/client/locales/runWait.en-US.d.ts +7 -0
  143. package/dist/client/locales/runWait.en-US.d.ts.map +1 -1
  144. package/dist/client/locales/runWait.en-US.js +10 -3
  145. package/dist/client/locales/runWait.en-US.js.map +1 -1
  146. package/dist/client/locales/runWait.zh-CN.d.ts +1 -1
  147. package/dist/client/locales/runWait.zh-CN.d.ts.map +1 -1
  148. package/dist/client/locales/runWait.zh-CN.js +11 -4
  149. package/dist/client/locales/runWait.zh-CN.js.map +1 -1
  150. package/dist/client/locales/runtimes.en-US.d.ts +83 -0
  151. package/dist/client/locales/runtimes.en-US.d.ts.map +1 -1
  152. package/dist/client/locales/runtimes.en-US.js +84 -1
  153. package/dist/client/locales/runtimes.en-US.js.map +1 -1
  154. package/dist/client/locales/runtimes.zh-CN.d.ts.map +1 -1
  155. package/dist/client/locales/runtimes.zh-CN.js +83 -0
  156. package/dist/client/locales/runtimes.zh-CN.js.map +1 -1
  157. package/dist/client/locales/skills.en-US.d.ts +7 -0
  158. package/dist/client/locales/skills.en-US.d.ts.map +1 -1
  159. package/dist/client/locales/skills.en-US.js +8 -1
  160. package/dist/client/locales/skills.en-US.js.map +1 -1
  161. package/dist/client/locales/skills.zh-CN.d.ts.map +1 -1
  162. package/dist/client/locales/skills.zh-CN.js +8 -1
  163. package/dist/client/locales/skills.zh-CN.js.map +1 -1
  164. package/dist/client/locales/zh-CN.d.ts.map +1 -1
  165. package/dist/client/locales/zh-CN.js +94 -220
  166. package/dist/client/locales/zh-CN.js.map +1 -1
  167. package/dist/client/online/services.d.ts.map +1 -1
  168. package/dist/client/online/services.js +5 -6
  169. package/dist/client/online/services.js.map +1 -1
  170. package/dist/client/pages/agents/agent-dialog.d.ts +9 -0
  171. package/dist/client/pages/agents/agent-dialog.d.ts.map +1 -0
  172. package/dist/client/pages/agents/agent-dialog.js +106 -0
  173. package/dist/client/pages/agents/agent-dialog.js.map +1 -0
  174. package/dist/client/pages/agents/agent-state.d.ts +11 -0
  175. package/dist/client/pages/agents/agent-state.d.ts.map +1 -0
  176. package/dist/client/pages/agents/agent-state.js +28 -0
  177. package/dist/client/pages/agents/agent-state.js.map +1 -0
  178. package/dist/client/pages/agents/index.d.ts +1 -1
  179. package/dist/client/pages/agents/index.d.ts.map +1 -1
  180. package/dist/client/pages/agents/index.js +7 -101
  181. package/dist/client/pages/agents/index.js.map +1 -1
  182. package/dist/client/pages/agents/runner-agents.d.ts +3 -0
  183. package/dist/client/pages/agents/runner-agents.d.ts.map +1 -0
  184. package/dist/client/pages/agents/runner-agents.js +185 -0
  185. package/dist/client/pages/agents/runner-agents.js.map +1 -0
  186. package/dist/client/pages/runtimes/connect.js.map +1 -1
  187. package/dist/client/pages/runtimes/index.d.ts.map +1 -1
  188. package/dist/client/pages/runtimes/index.js +1 -1
  189. package/dist/client/pages/runtimes/index.js.map +1 -1
  190. package/dist/client/pages/runtimes/quota-targets.d.ts +4 -0
  191. package/dist/client/pages/runtimes/quota-targets.d.ts.map +1 -0
  192. package/dist/client/pages/runtimes/quota-targets.js +18 -0
  193. package/dist/client/pages/runtimes/quota-targets.js.map +1 -0
  194. package/dist/client/pages/runtimes/quota.d.ts +17 -0
  195. package/dist/client/pages/runtimes/quota.d.ts.map +1 -0
  196. package/dist/client/pages/runtimes/quota.js +50 -0
  197. package/dist/client/pages/runtimes/quota.js.map +1 -0
  198. package/dist/client/pages/runtimes/runner-cells.d.ts +11 -4
  199. package/dist/client/pages/runtimes/runner-cells.d.ts.map +1 -1
  200. package/dist/client/pages/runtimes/runner-cells.js +6 -3
  201. package/dist/client/pages/runtimes/runner-cells.js.map +1 -1
  202. package/dist/client/pages/runtimes/runner-overview.d.ts +9 -0
  203. package/dist/client/pages/runtimes/runner-overview.d.ts.map +1 -0
  204. package/dist/client/pages/runtimes/runner-overview.js +109 -0
  205. package/dist/client/pages/runtimes/runner-overview.js.map +1 -0
  206. package/dist/client/pages/runtimes/runner-runs.d.ts +5 -0
  207. package/dist/client/pages/runtimes/runner-runs.d.ts.map +1 -0
  208. package/dist/client/pages/runtimes/runner-runs.js +35 -0
  209. package/dist/client/pages/runtimes/runner-runs.js.map +1 -0
  210. package/dist/client/pages/runtimes/runner-sheet.d.ts +2 -3
  211. package/dist/client/pages/runtimes/runner-sheet.d.ts.map +1 -1
  212. package/dist/client/pages/runtimes/runner-sheet.js +43 -171
  213. package/dist/client/pages/runtimes/runner-sheet.js.map +1 -1
  214. package/dist/client/pages/runtimes/runner-tools.d.ts +17 -0
  215. package/dist/client/pages/runtimes/runner-tools.d.ts.map +1 -0
  216. package/dist/client/pages/runtimes/runner-tools.js +75 -0
  217. package/dist/client/pages/runtimes/runner-tools.js.map +1 -0
  218. package/dist/client/pages/runtimes/runner-workspaces.d.ts +6 -0
  219. package/dist/client/pages/runtimes/runner-workspaces.d.ts.map +1 -0
  220. package/dist/client/pages/runtimes/runner-workspaces.js +37 -0
  221. package/dist/client/pages/runtimes/runner-workspaces.js.map +1 -0
  222. package/dist/client/pages/runtimes/tool-slots-fields.js +1 -1
  223. package/dist/client/pages/runtimes/tool-slots-fields.js.map +1 -1
  224. package/dist/client/pages/runtimes/workspace-diagnostics.d.ts +6 -4
  225. package/dist/client/pages/runtimes/workspace-diagnostics.d.ts.map +1 -1
  226. package/dist/client/pages/runtimes/workspace-diagnostics.js +67 -33
  227. package/dist/client/pages/runtimes/workspace-diagnostics.js.map +1 -1
  228. package/dist/client/pages/skills/detail/index.d.ts.map +1 -1
  229. package/dist/client/pages/skills/detail/index.js +11 -15
  230. package/dist/client/pages/skills/detail/index.js.map +1 -1
  231. package/dist/client/pages/skills/index.d.ts.map +1 -1
  232. package/dist/client/pages/skills/index.js +2 -2
  233. package/dist/client/pages/skills/index.js.map +1 -1
  234. package/dist/client/pages/usage/index.js +2 -2
  235. package/dist/client/pages/usage/index.js.map +1 -1
  236. package/dist/client/profile/default-agent.d.ts.map +1 -1
  237. package/dist/client/profile/default-agent.js +2 -4
  238. package/dist/client/profile/default-agent.js.map +1 -1
  239. package/dist/client/routes.d.ts +1 -1
  240. package/dist/client/routes.d.ts.map +1 -1
  241. package/dist/client/routes.js +1 -13
  242. package/dist/client/routes.js.map +1 -1
  243. package/dist/client/runs/format-wait.d.ts.map +1 -1
  244. package/dist/client/runs/format-wait.js +15 -1
  245. package/dist/client/runs/format-wait.js.map +1 -1
  246. package/dist/client/runs/subject-runs.d.ts +5 -0
  247. package/dist/client/runs/subject-runs.d.ts.map +1 -1
  248. package/dist/client/runs/subject-runs.js +24 -9
  249. package/dist/client/runs/subject-runs.js.map +1 -1
  250. package/dist/client/runs/use-run-events.d.ts +1 -1
  251. package/dist/client/runs/use-run-events.d.ts.map +1 -1
  252. package/dist/client/runs/use-run-events.js +5 -2
  253. package/dist/client/runs/use-run-events.js.map +1 -1
  254. package/dist/client/runs.d.ts +1 -1
  255. package/dist/client/runs.d.ts.map +1 -1
  256. package/dist/client/runs.js +1 -1
  257. package/dist/client/runs.js.map +1 -1
  258. package/dist/database/migrations/.manifest.json +42 -2
  259. package/dist/database/migrations/202610020003_ag_create_runs.d.ts.map +1 -1
  260. package/dist/database/migrations/202610020003_ag_create_runs.js +0 -1
  261. package/dist/database/migrations/202610020003_ag_create_runs.js.map +1 -1
  262. package/dist/database/migrations/202610120001_ag_index_run_retries.d.ts +4 -0
  263. package/dist/database/migrations/202610120001_ag_index_run_retries.d.ts.map +1 -0
  264. package/dist/database/migrations/202610120001_ag_index_run_retries.js +17 -0
  265. package/dist/database/migrations/202610120001_ag_index_run_retries.js.map +1 -0
  266. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.d.ts +4 -0
  267. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.d.ts.map +1 -0
  268. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.js +50 -0
  269. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.js.map +1 -0
  270. package/dist/database/migrations/202610170001_ag_runner_quota.d.ts +4 -0
  271. package/dist/database/migrations/202610170001_ag_runner_quota.d.ts.map +1 -0
  272. package/dist/database/migrations/202610170001_ag_runner_quota.js +19 -0
  273. package/dist/database/migrations/202610170001_ag_runner_quota.js.map +1 -0
  274. package/dist/database/migrations/202610240020_ag_runner_agents.d.ts +4 -0
  275. package/dist/database/migrations/202610240020_ag_runner_agents.d.ts.map +1 -0
  276. package/dist/database/migrations/202610240020_ag_runner_agents.js +115 -0
  277. package/dist/database/migrations/202610240020_ag_runner_agents.js.map +1 -0
  278. package/dist/database/migrations/202610240040_ag_discovery_preferences.d.ts +4 -0
  279. package/dist/database/migrations/202610240040_ag_discovery_preferences.d.ts.map +1 -0
  280. package/dist/database/migrations/202610240040_ag_discovery_preferences.js +18 -0
  281. package/dist/database/migrations/202610240040_ag_discovery_preferences.js.map +1 -0
  282. package/dist/database/migrations/202610250001_ag_comment_runner_consent.d.ts +4 -0
  283. package/dist/database/migrations/202610250001_ag_comment_runner_consent.d.ts.map +1 -0
  284. package/dist/database/migrations/202610250001_ag_comment_runner_consent.js +41 -0
  285. package/dist/database/migrations/202610250001_ag_comment_runner_consent.js.map +1 -0
  286. package/dist/database/migrations/202610260001_ag_drop_directory_index.d.ts +4 -0
  287. package/dist/database/migrations/202610260001_ag_drop_directory_index.d.ts.map +1 -0
  288. package/dist/database/migrations/202610260001_ag_drop_directory_index.js +24 -0
  289. package/dist/database/migrations/202610260001_ag_drop_directory_index.js.map +1 -0
  290. package/dist/database/migrations/202610260001_ag_run_revision.d.ts +4 -0
  291. package/dist/database/migrations/202610260001_ag_run_revision.d.ts.map +1 -0
  292. package/dist/database/migrations/202610260001_ag_run_revision.js +19 -0
  293. package/dist/database/migrations/202610260001_ag_run_revision.js.map +1 -0
  294. package/dist/database/migrations/202610270001_ag_online_agent.d.ts +4 -0
  295. package/dist/database/migrations/202610270001_ag_online_agent.d.ts.map +1 -0
  296. package/dist/database/migrations/202610270001_ag_online_agent.js +43 -0
  297. package/dist/database/migrations/202610270001_ag_online_agent.js.map +1 -0
  298. package/dist/database/migrations/202610270002_ag_chat_list_visibility.d.ts +4 -0
  299. package/dist/database/migrations/202610270002_ag_chat_list_visibility.d.ts.map +1 -0
  300. package/dist/database/migrations/202610270002_ag_chat_list_visibility.js +17 -0
  301. package/dist/database/migrations/202610270002_ag_chat_list_visibility.js.map +1 -0
  302. package/dist/package.json +34 -12
  303. package/dist/server/cli/run-credential.js +1 -1
  304. package/dist/server/cli/surface.d.ts.map +1 -1
  305. package/dist/server/cli/surface.js +4 -1
  306. package/dist/server/cli/surface.js.map +1 -1
  307. package/dist/server/composition.d.ts +36 -35
  308. package/dist/server/composition.d.ts.map +1 -1
  309. package/dist/server/composition.js +99 -66
  310. package/dist/server/composition.js.map +1 -1
  311. package/dist/server/core/agents/agent.service.d.ts +51 -43
  312. package/dist/server/core/agents/agent.service.d.ts.map +1 -1
  313. package/dist/server/core/agents/agent.service.js +347 -321
  314. package/dist/server/core/agents/agent.service.js.map +1 -1
  315. package/dist/server/core/agents/agent.store.d.ts +26 -12
  316. package/dist/server/core/agents/agent.store.d.ts.map +1 -1
  317. package/dist/server/core/agents/agent.store.js +74 -66
  318. package/dist/server/core/agents/agent.store.js.map +1 -1
  319. package/dist/server/core/agents/agent.views.d.ts +29 -0
  320. package/dist/server/core/agents/agent.views.d.ts.map +1 -0
  321. package/dist/server/core/agents/agent.views.js +88 -0
  322. package/dist/server/core/agents/agent.views.js.map +1 -0
  323. package/dist/server/core/agents/discovery.d.ts +12 -0
  324. package/dist/server/core/agents/discovery.d.ts.map +1 -0
  325. package/dist/server/core/agents/discovery.js +39 -0
  326. package/dist/server/core/agents/discovery.js.map +1 -0
  327. package/dist/server/core/agents/index.d.ts +3 -2
  328. package/dist/server/core/agents/index.d.ts.map +1 -1
  329. package/dist/server/core/agents/index.js +3 -2
  330. package/dist/server/core/agents/index.js.map +1 -1
  331. package/dist/server/core/brief/brief.js +3 -3
  332. package/dist/server/core/brief/brief.js.map +1 -1
  333. package/dist/server/core/callers/index.d.ts +10 -1
  334. package/dist/server/core/callers/index.d.ts.map +1 -1
  335. package/dist/server/core/callers/index.js +15 -0
  336. package/dist/server/core/callers/index.js.map +1 -1
  337. package/dist/server/core/conversations/attachments.d.ts.map +1 -1
  338. package/dist/server/core/conversations/attachments.js +6 -1
  339. package/dist/server/core/conversations/attachments.js.map +1 -1
  340. package/dist/server/core/conversations/availability.d.ts +6 -11
  341. package/dist/server/core/conversations/availability.d.ts.map +1 -1
  342. package/dist/server/core/conversations/availability.js +11 -15
  343. package/dist/server/core/conversations/availability.js.map +1 -1
  344. package/dist/server/core/conversations/chat-settings.d.ts +2 -2
  345. package/dist/server/core/conversations/chat-settings.d.ts.map +1 -1
  346. package/dist/server/core/conversations/chat-settings.js +17 -22
  347. package/dist/server/core/conversations/chat-settings.js.map +1 -1
  348. package/dist/server/core/conversations/conversation.service.d.ts +13 -8
  349. package/dist/server/core/conversations/conversation.service.d.ts.map +1 -1
  350. package/dist/server/core/conversations/conversation.service.js +397 -383
  351. package/dist/server/core/conversations/conversation.service.js.map +1 -1
  352. package/dist/server/core/conversations/conversation.store.d.ts +3 -0
  353. package/dist/server/core/conversations/conversation.store.d.ts.map +1 -1
  354. package/dist/server/core/conversations/conversation.store.js +2 -1
  355. package/dist/server/core/conversations/conversation.store.js.map +1 -1
  356. package/dist/server/core/conversations/page-context.d.ts +8 -2
  357. package/dist/server/core/conversations/page-context.d.ts.map +1 -1
  358. package/dist/server/core/conversations/page-context.js +61 -2
  359. package/dist/server/core/conversations/page-context.js.map +1 -1
  360. package/dist/server/core/conversations/ports.d.ts +18 -20
  361. package/dist/server/core/conversations/ports.d.ts.map +1 -1
  362. package/dist/server/core/reports/model-usage.d.ts.map +1 -1
  363. package/dist/server/core/reports/model-usage.js +42 -44
  364. package/dist/server/core/reports/model-usage.js.map +1 -1
  365. package/dist/server/core/reports/prices.d.ts.map +1 -1
  366. package/dist/server/core/reports/prices.js +29 -5
  367. package/dist/server/core/reports/prices.js.map +1 -1
  368. package/dist/server/core/reports/report.service.d.ts +4 -2
  369. package/dist/server/core/reports/report.service.d.ts.map +1 -1
  370. package/dist/server/core/reports/report.service.js +148 -66
  371. package/dist/server/core/reports/report.service.js.map +1 -1
  372. package/dist/server/core/runs/access.d.ts +5 -0
  373. package/dist/server/core/runs/access.d.ts.map +1 -0
  374. package/dist/server/core/runs/access.js +10 -0
  375. package/dist/server/core/runs/access.js.map +1 -0
  376. package/dist/server/core/runs/availability.d.ts +18 -6
  377. package/dist/server/core/runs/availability.d.ts.map +1 -1
  378. package/dist/server/core/runs/availability.js +40 -34
  379. package/dist/server/core/runs/availability.js.map +1 -1
  380. package/dist/server/core/runs/claim.d.ts +30 -106
  381. package/dist/server/core/runs/claim.d.ts.map +1 -1
  382. package/dist/server/core/runs/claim.js +630 -323
  383. package/dist/server/core/runs/claim.js.map +1 -1
  384. package/dist/server/core/runs/comment-consent.d.ts +24 -0
  385. package/dist/server/core/runs/comment-consent.d.ts.map +1 -0
  386. package/dist/server/core/runs/comment-consent.js +116 -0
  387. package/dist/server/core/runs/comment-consent.js.map +1 -0
  388. package/dist/server/core/runs/eligibility.d.ts +13 -1
  389. package/dist/server/core/runs/eligibility.d.ts.map +1 -1
  390. package/dist/server/core/runs/eligibility.js +41 -10
  391. package/dist/server/core/runs/eligibility.js.map +1 -1
  392. package/dist/server/core/runs/execution-view.d.ts +8 -0
  393. package/dist/server/core/runs/execution-view.d.ts.map +1 -1
  394. package/dist/server/core/runs/execution-view.js +9 -0
  395. package/dist/server/core/runs/execution-view.js.map +1 -1
  396. package/dist/server/core/runs/execution.d.ts +1 -1
  397. package/dist/server/core/runs/execution.d.ts.map +1 -1
  398. package/dist/server/core/runs/execution.js +8 -2
  399. package/dist/server/core/runs/execution.js.map +1 -1
  400. package/dist/server/core/runs/identity.d.ts +9 -0
  401. package/dist/server/core/runs/identity.d.ts.map +1 -0
  402. package/dist/server/core/runs/identity.js +75 -0
  403. package/dist/server/core/runs/identity.js.map +1 -0
  404. package/dist/server/core/runs/index.d.ts +6 -6
  405. package/dist/server/core/runs/index.d.ts.map +1 -1
  406. package/dist/server/core/runs/index.js +6 -6
  407. package/dist/server/core/runs/index.js.map +1 -1
  408. package/dist/server/core/runs/input-gate.d.ts +1 -1
  409. package/dist/server/core/runs/input-gate.d.ts.map +1 -1
  410. package/dist/server/core/runs/input-gate.js +4 -2
  411. package/dist/server/core/runs/input-gate.js.map +1 -1
  412. package/dist/server/core/runs/lifecycle.d.ts +16 -18
  413. package/dist/server/core/runs/lifecycle.d.ts.map +1 -1
  414. package/dist/server/core/runs/lifecycle.js +146 -60
  415. package/dist/server/core/runs/lifecycle.js.map +1 -1
  416. package/dist/server/core/runs/policy.d.ts +9 -2
  417. package/dist/server/core/runs/policy.d.ts.map +1 -1
  418. package/dist/server/core/runs/policy.js +17 -8
  419. package/dist/server/core/runs/policy.js.map +1 -1
  420. package/dist/server/core/runs/ports.d.ts +41 -31
  421. package/dist/server/core/runs/ports.d.ts.map +1 -1
  422. package/dist/server/core/runs/ports.js +2 -13
  423. package/dist/server/core/runs/ports.js.map +1 -1
  424. package/dist/server/core/runs/preview.d.ts.map +1 -1
  425. package/dist/server/core/runs/preview.js +1 -3
  426. package/dist/server/core/runs/preview.js.map +1 -1
  427. package/dist/server/core/runs/run-data-purge.d.ts +15 -0
  428. package/dist/server/core/runs/run-data-purge.d.ts.map +1 -0
  429. package/dist/server/core/runs/run-data-purge.js +82 -0
  430. package/dist/server/core/runs/run-data-purge.js.map +1 -0
  431. package/dist/server/core/runs/run-requests.d.ts +25 -0
  432. package/dist/server/core/runs/run-requests.d.ts.map +1 -1
  433. package/dist/server/core/runs/run-requests.js +131 -64
  434. package/dist/server/core/runs/run-requests.js.map +1 -1
  435. package/dist/server/core/runs/run.service.d.ts +39 -3
  436. package/dist/server/core/runs/run.service.d.ts.map +1 -1
  437. package/dist/server/core/runs/run.service.js +729 -102
  438. package/dist/server/core/runs/run.service.js.map +1 -1
  439. package/dist/server/core/runs/run.store.d.ts +11 -0
  440. package/dist/server/core/runs/run.store.d.ts.map +1 -1
  441. package/dist/server/core/runs/run.store.js +39 -11
  442. package/dist/server/core/runs/run.store.js.map +1 -1
  443. package/dist/server/core/runs/runner-view.d.ts +12 -2
  444. package/dist/server/core/runs/runner-view.d.ts.map +1 -1
  445. package/dist/server/core/runs/runner-view.js +55 -13
  446. package/dist/server/core/runs/runner-view.js.map +1 -1
  447. package/dist/server/core/runs/selection.d.ts +13 -0
  448. package/dist/server/core/runs/selection.d.ts.map +1 -0
  449. package/dist/server/core/runs/selection.js +21 -0
  450. package/dist/server/core/runs/selection.js.map +1 -0
  451. package/dist/server/core/runs/sweeper.d.ts +1 -0
  452. package/dist/server/core/runs/sweeper.d.ts.map +1 -1
  453. package/dist/server/core/runs/sweeper.js +66 -17
  454. package/dist/server/core/runs/sweeper.js.map +1 -1
  455. package/dist/server/core/runs/transitions.d.ts +6 -2
  456. package/dist/server/core/runs/transitions.d.ts.map +1 -1
  457. package/dist/server/core/runs/transitions.js +73 -19
  458. package/dist/server/core/runs/transitions.js.map +1 -1
  459. package/dist/server/core/runs/workload.d.ts +17 -5
  460. package/dist/server/core/runs/workload.d.ts.map +1 -1
  461. package/dist/server/core/runs/workload.js +203 -68
  462. package/dist/server/core/runs/workload.js.map +1 -1
  463. package/dist/server/core/skills/skill.service.d.ts +6 -2
  464. package/dist/server/core/skills/skill.service.d.ts.map +1 -1
  465. package/dist/server/core/skills/skill.service.js +87 -66
  466. package/dist/server/core/skills/skill.service.js.map +1 -1
  467. package/dist/server/core/skills/skill.store.d.ts +14 -0
  468. package/dist/server/core/skills/skill.store.d.ts.map +1 -1
  469. package/dist/server/core/skills/skill.store.js +30 -0
  470. package/dist/server/core/skills/skill.store.js.map +1 -1
  471. package/dist/server/core/transaction-read.d.ts +4 -0
  472. package/dist/server/core/transaction-read.d.ts.map +1 -0
  473. package/dist/server/core/transaction-read.js +30 -0
  474. package/dist/server/core/transaction-read.js.map +1 -0
  475. package/dist/server/core/variables/index.d.ts +1 -1
  476. package/dist/server/core/variables/index.d.ts.map +1 -1
  477. package/dist/server/core/variables/index.js.map +1 -1
  478. package/dist/server/core/variables/variable.service.d.ts +18 -0
  479. package/dist/server/core/variables/variable.service.d.ts.map +1 -1
  480. package/dist/server/core/variables/variable.service.js +95 -20
  481. package/dist/server/core/variables/variable.service.js.map +1 -1
  482. package/dist/server/index.d.ts +4 -0
  483. package/dist/server/index.d.ts.map +1 -1
  484. package/dist/server/index.js +3 -0
  485. package/dist/server/index.js.map +1 -1
  486. package/dist/server/jobs/job.service.d.ts +1 -1
  487. package/dist/server/jobs/job.service.d.ts.map +1 -1
  488. package/dist/server/jobs/job.service.js +8 -2
  489. package/dist/server/jobs/job.service.js.map +1 -1
  490. package/dist/server/kernel/events.d.ts +12 -3
  491. package/dist/server/kernel/events.d.ts.map +1 -1
  492. package/dist/server/kernel/events.js.map +1 -1
  493. package/dist/server/kernel/scopes.d.ts +6 -0
  494. package/dist/server/kernel/scopes.d.ts.map +1 -1
  495. package/dist/server/kernel/scopes.js +3 -1
  496. package/dist/server/kernel/scopes.js.map +1 -1
  497. package/dist/server/online/agent/configuration.d.ts +26 -0
  498. package/dist/server/online/agent/configuration.d.ts.map +1 -0
  499. package/dist/server/online/agent/configuration.js +261 -0
  500. package/dist/server/online/agent/configuration.js.map +1 -0
  501. package/dist/server/online/agent/contracts.d.ts +87 -0
  502. package/dist/server/online/agent/contracts.d.ts.map +1 -0
  503. package/dist/server/online/agent/contracts.js +2 -0
  504. package/dist/server/online/agent/contracts.js.map +1 -0
  505. package/dist/server/online/agent/errors.d.ts +11 -0
  506. package/dist/server/online/agent/errors.d.ts.map +1 -0
  507. package/dist/server/online/agent/errors.js +21 -0
  508. package/dist/server/online/agent/errors.js.map +1 -0
  509. package/dist/server/online/agent/index.d.ts +11 -0
  510. package/dist/server/online/agent/index.d.ts.map +1 -0
  511. package/dist/server/online/agent/index.js +9 -0
  512. package/dist/server/online/agent/index.js.map +1 -0
  513. package/dist/server/online/agent/messages/json.d.ts +5 -0
  514. package/dist/server/online/agent/messages/json.d.ts.map +1 -0
  515. package/dist/server/online/agent/messages/json.js +88 -0
  516. package/dist/server/online/agent/messages/json.js.map +1 -0
  517. package/dist/server/online/agent/messages/projection.d.ts +20 -0
  518. package/dist/server/online/agent/messages/projection.d.ts.map +1 -0
  519. package/dist/server/online/agent/messages/projection.js +495 -0
  520. package/dist/server/online/agent/messages/projection.js.map +1 -0
  521. package/dist/server/online/agent/messages/validation.d.ts +7 -0
  522. package/dist/server/online/agent/messages/validation.d.ts.map +1 -0
  523. package/dist/server/online/agent/messages/validation.js +159 -0
  524. package/dist/server/online/agent/messages/validation.js.map +1 -0
  525. package/dist/server/online/agent/native/backend.d.ts +60 -0
  526. package/dist/server/online/agent/native/backend.d.ts.map +1 -0
  527. package/dist/server/online/agent/native/backend.js +411 -0
  528. package/dist/server/online/agent/native/backend.js.map +1 -0
  529. package/dist/server/online/agent/native/execution.d.ts +41 -0
  530. package/dist/server/online/agent/native/execution.d.ts.map +1 -0
  531. package/dist/server/online/agent/native/execution.js +430 -0
  532. package/dist/server/online/agent/native/execution.js.map +1 -0
  533. package/dist/server/online/agent/native/session.d.ts +40 -0
  534. package/dist/server/online/agent/native/session.d.ts.map +1 -0
  535. package/dist/server/online/agent/native/session.js +104 -0
  536. package/dist/server/online/agent/native/session.js.map +1 -0
  537. package/dist/server/online/agent/native/types.d.ts +32 -0
  538. package/dist/server/online/agent/native/types.d.ts.map +1 -0
  539. package/dist/server/online/agent/native/types.js +2 -0
  540. package/dist/server/online/agent/native/types.js.map +1 -0
  541. package/dist/server/online/agent/persistence/manager.d.ts +16 -0
  542. package/dist/server/online/agent/persistence/manager.d.ts.map +1 -0
  543. package/dist/server/online/agent/persistence/manager.js +209 -0
  544. package/dist/server/online/agent/persistence/manager.js.map +1 -0
  545. package/dist/server/online/agent/persistence/state.d.ts +11 -0
  546. package/dist/server/online/agent/persistence/state.d.ts.map +1 -0
  547. package/dist/server/online/agent/persistence/state.js +45 -0
  548. package/dist/server/online/agent/persistence/state.js.map +1 -0
  549. package/dist/server/online/agent/persistence/store.d.ts +58 -0
  550. package/dist/server/online/agent/persistence/store.d.ts.map +1 -0
  551. package/dist/server/online/agent/persistence/store.js +634 -0
  552. package/dist/server/online/agent/persistence/store.js.map +1 -0
  553. package/dist/server/online/agent/persistence/types.d.ts +44 -0
  554. package/dist/server/online/agent/persistence/types.d.ts.map +1 -0
  555. package/dist/server/online/agent/persistence/types.js +2 -0
  556. package/dist/server/online/agent/persistence/types.js.map +1 -0
  557. package/dist/server/online/agent/runner/backend.d.ts +57 -0
  558. package/dist/server/online/agent/runner/backend.d.ts.map +1 -0
  559. package/dist/server/online/agent/runner/backend.js +501 -0
  560. package/dist/server/online/agent/runner/backend.js.map +1 -0
  561. package/dist/server/online/agent/runner/projection.d.ts +10 -0
  562. package/dist/server/online/agent/runner/projection.d.ts.map +1 -0
  563. package/dist/server/online/agent/runner/projection.js +171 -0
  564. package/dist/server/online/agent/runner/projection.js.map +1 -0
  565. package/dist/server/online/agent/runner/types.d.ts +44 -0
  566. package/dist/server/online/agent/runner/types.d.ts.map +1 -0
  567. package/dist/server/online/agent/runner/types.js +2 -0
  568. package/dist/server/online/agent/runner/types.js.map +1 -0
  569. package/dist/server/online/agent/service.d.ts +47 -0
  570. package/dist/server/online/agent/service.d.ts.map +1 -0
  571. package/dist/server/online/agent/service.js +111 -0
  572. package/dist/server/online/agent/service.js.map +1 -0
  573. package/dist/server/online/agent/transport/streams.d.ts +54 -0
  574. package/dist/server/online/agent/transport/streams.d.ts.map +1 -0
  575. package/dist/server/online/agent/transport/streams.js +440 -0
  576. package/dist/server/online/agent/transport/streams.js.map +1 -0
  577. package/dist/server/online/agent/types.d.ts +155 -0
  578. package/dist/server/online/agent/types.d.ts.map +1 -0
  579. package/dist/server/online/agent/types.js +2 -0
  580. package/dist/server/online/agent/types.js.map +1 -0
  581. package/dist/server/online/index.d.ts +0 -5
  582. package/dist/server/online/index.d.ts.map +1 -1
  583. package/dist/server/online/index.js +0 -5
  584. package/dist/server/online/index.js.map +1 -1
  585. package/dist/server/online/providers.d.ts.map +1 -1
  586. package/dist/server/online/providers.js +26 -2
  587. package/dist/server/online/providers.js.map +1 -1
  588. package/dist/server/online/routes.d.ts.map +1 -1
  589. package/dist/server/online/routes.js +6 -35
  590. package/dist/server/online/routes.js.map +1 -1
  591. package/dist/server/online/services.d.ts.map +1 -1
  592. package/dist/server/online/services.js +101 -24
  593. package/dist/server/online/services.js.map +1 -1
  594. package/dist/server/providers/agents.d.ts +18 -25
  595. package/dist/server/providers/agents.d.ts.map +1 -1
  596. package/dist/server/providers/agents.js +79 -100
  597. package/dist/server/providers/agents.js.map +1 -1
  598. package/dist/server/providers/runners.d.ts +3 -1
  599. package/dist/server/providers/runners.d.ts.map +1 -1
  600. package/dist/server/providers/runners.js +38 -9
  601. package/dist/server/providers/runners.js.map +1 -1
  602. package/dist/server/routes/admin.d.ts +4 -0
  603. package/dist/server/routes/admin.d.ts.map +1 -1
  604. package/dist/server/routes/admin.js +139 -212
  605. package/dist/server/routes/admin.js.map +1 -1
  606. package/dist/server/routes/chat.d.ts.map +1 -1
  607. package/dist/server/routes/chat.js +313 -164
  608. package/dist/server/routes/chat.js.map +1 -1
  609. package/dist/server/routes/index.d.ts.map +1 -1
  610. package/dist/server/routes/index.js +8 -0
  611. package/dist/server/routes/index.js.map +1 -1
  612. package/dist/server/routes/roster.d.ts.map +1 -1
  613. package/dist/server/routes/roster.js +6 -22
  614. package/dist/server/routes/roster.js.map +1 -1
  615. package/dist/server/routes/run-requests.js +3 -3
  616. package/dist/server/routes/run-requests.js.map +1 -1
  617. package/dist/server/routes/runners/admin.d.ts.map +1 -1
  618. package/dist/server/routes/runners/admin.js +219 -25
  619. package/dist/server/routes/runners/admin.js.map +1 -1
  620. package/dist/server/routes/runners/install.d.ts.map +1 -1
  621. package/dist/server/routes/runners/install.js +7 -2
  622. package/dist/server/routes/runners/install.js.map +1 -1
  623. package/dist/server/routes/runners/runner.d.ts.map +1 -1
  624. package/dist/server/routes/runners/runner.js +2 -0
  625. package/dist/server/routes/runners/runner.js.map +1 -1
  626. package/dist/server/routes/schemas.d.ts +18 -10
  627. package/dist/server/routes/schemas.d.ts.map +1 -1
  628. package/dist/server/routes/schemas.js +498 -153
  629. package/dist/server/routes/schemas.js.map +1 -1
  630. package/dist/server/runners/runner.service.d.ts +47 -4
  631. package/dist/server/runners/runner.service.d.ts.map +1 -1
  632. package/dist/server/runners/runner.service.js +423 -79
  633. package/dist/server/runners/runner.service.js.map +1 -1
  634. package/dist/server/runners/runner.store.d.ts +8 -3
  635. package/dist/server/runners/runner.store.d.ts.map +1 -1
  636. package/dist/server/runners/runner.store.js +63 -6
  637. package/dist/server/runners/runner.store.js.map +1 -1
  638. package/dist/server/runners/slots.d.ts +5 -2
  639. package/dist/server/runners/slots.d.ts.map +1 -1
  640. package/dist/server/runners/slots.js +3 -4
  641. package/dist/server/runners/slots.js.map +1 -1
  642. package/dist/server/runners/workspaces.d.ts.map +1 -1
  643. package/dist/server/runners/workspaces.js +18 -2
  644. package/dist/server/runners/workspaces.js.map +1 -1
  645. package/dist/server/testing.d.ts +0 -2
  646. package/dist/server/testing.d.ts.map +1 -1
  647. package/dist/server/testing.js +1 -4
  648. package/dist/server/testing.js.map +1 -1
  649. package/dist/server/tokens.d.ts +8 -7
  650. package/dist/server/tokens.d.ts.map +1 -1
  651. package/dist/server/tokens.js +4 -2
  652. package/dist/server/tokens.js.map +1 -1
  653. package/dist/shared/access.d.ts +2 -6
  654. package/dist/shared/access.d.ts.map +1 -1
  655. package/dist/shared/access.js +2 -6
  656. package/dist/shared/access.js.map +1 -1
  657. package/dist/shared/agents.d.ts +131 -169
  658. package/dist/shared/agents.d.ts.map +1 -1
  659. package/dist/shared/agents.js +36 -102
  660. package/dist/shared/agents.js.map +1 -1
  661. package/dist/shared/conversations.d.ts +93 -170
  662. package/dist/shared/conversations.d.ts.map +1 -1
  663. package/dist/shared/conversations.js +8 -30
  664. package/dist/shared/conversations.js.map +1 -1
  665. package/dist/shared/model-catalog.d.ts +53 -0
  666. package/dist/shared/model-catalog.d.ts.map +1 -0
  667. package/dist/shared/model-catalog.js +182 -0
  668. package/dist/shared/model-catalog.js.map +1 -0
  669. package/dist/shared/online-agent.d.ts +3 -0
  670. package/dist/shared/online-agent.d.ts.map +1 -0
  671. package/dist/shared/online-agent.js +3 -0
  672. package/dist/shared/online-agent.js.map +1 -0
  673. package/dist/shared/page-ui-context.d.ts +26 -0
  674. package/dist/shared/page-ui-context.d.ts.map +1 -0
  675. package/dist/shared/page-ui-context.js +129 -0
  676. package/dist/shared/page-ui-context.js.map +1 -0
  677. package/dist/shared/quota.d.ts +15 -0
  678. package/dist/shared/quota.d.ts.map +1 -0
  679. package/dist/shared/quota.js +2 -0
  680. package/dist/shared/quota.js.map +1 -0
  681. package/dist/shared/runners.d.ts +132 -14
  682. package/dist/shared/runners.d.ts.map +1 -1
  683. package/dist/shared/runners.js +171 -11
  684. package/dist/shared/runners.js.map +1 -1
  685. package/dist/shared/runs.d.ts +59 -1
  686. package/dist/shared/runs.d.ts.map +1 -1
  687. package/dist/shared/runs.js +28 -0
  688. package/dist/shared/runs.js.map +1 -1
  689. package/dist/shared/skills.d.ts +11 -5
  690. package/dist/shared/skills.d.ts.map +1 -1
  691. package/dist/shared/skills.js +7 -2
  692. package/dist/shared/skills.js.map +1 -1
  693. package/dist/shared/ui-message.d.ts +80 -0
  694. package/dist/shared/ui-message.d.ts.map +1 -0
  695. package/dist/shared/ui-message.js +153 -0
  696. package/dist/shared/ui-message.js.map +1 -0
  697. package/dist/shared/variables.js +1 -1
  698. package/dist/shared/variables.js.map +1 -1
  699. package/docs/ai-forms.md +346 -0
  700. package/docs/execution-history.md +19 -0
  701. package/docs/mysql-installation-upgrade.md +7 -0
  702. package/docs/runner-agents.md +27 -0
  703. package/docs/ui-message-clients.md +80 -0
  704. package/docs/ui-messages.md +209 -0
  705. package/docs/workspace-cleanup.md +13 -0
  706. package/package.json +39 -25
  707. package/skills/nocobase-app-plugin-agents/SKILL.md +16 -13
  708. package/skills/nocobase-app-plugin-agents/references/agents.md +30 -0
  709. package/skills/nocobase-app-plugin-agents/references/extension-points.md +21 -21
  710. package/skills/nocobase-app-plugin-agents/references/model-services.md +17 -0
  711. package/skills/nocobase-app-plugin-agents/references/online-agent.md +216 -0
  712. package/skills/nocobase-app-plugin-agents/references/runners.md +12 -0
  713. package/skills/nocobase-app-plugin-agents/references/setup-and-config.md +6 -7
  714. package/skills/nocobase-app-plugin-agents/references/variables-skills-usage.md +6 -4
  715. package/skills/nocobase-app-plugin-agents/references/verification-and-troubleshooting.md +29 -32
  716. package/dist/client/chat/settings-section.d.ts +0 -5
  717. package/dist/client/chat/settings-section.d.ts.map +0 -1
  718. package/dist/client/chat/settings-section.js +0 -86
  719. package/dist/client/chat/settings-section.js.map +0 -1
  720. package/dist/client/components/agent-fields.d.ts +0 -45
  721. package/dist/client/components/agent-fields.d.ts.map +0 -1
  722. package/dist/client/components/agent-fields.js +0 -83
  723. package/dist/client/components/agent-fields.js.map +0 -1
  724. package/dist/client/components/agent-type.d.ts +0 -32
  725. package/dist/client/components/agent-type.d.ts.map +0 -1
  726. package/dist/client/components/agent-type.js +0 -80
  727. package/dist/client/components/agent-type.js.map +0 -1
  728. package/dist/client/components/model-entries.d.ts +0 -44
  729. package/dist/client/components/model-entries.d.ts.map +0 -1
  730. package/dist/client/components/model-entries.js +0 -104
  731. package/dist/client/components/model-entries.js.map +0 -1
  732. package/dist/client/hooks/use-agent-save.d.ts +0 -9
  733. package/dist/client/hooks/use-agent-save.d.ts.map +0 -1
  734. package/dist/client/hooks/use-agent-save.js +0 -40
  735. package/dist/client/hooks/use-agent-save.js.map +0 -1
  736. package/dist/client/hooks/use-model-catalog.d.ts +0 -9
  737. package/dist/client/hooks/use-model-catalog.d.ts.map +0 -1
  738. package/dist/client/hooks/use-model-catalog.js +0 -27
  739. package/dist/client/hooks/use-model-catalog.js.map +0 -1
  740. package/dist/client/lib/model-suggestions.d.ts +0 -28
  741. package/dist/client/lib/model-suggestions.d.ts.map +0 -1
  742. package/dist/client/lib/model-suggestions.js +0 -44
  743. package/dist/client/lib/model-suggestions.js.map +0 -1
  744. package/dist/client/lib/tool-policy.d.ts +0 -3
  745. package/dist/client/lib/tool-policy.d.ts.map +0 -1
  746. package/dist/client/lib/tool-policy.js +0 -5
  747. package/dist/client/lib/tool-policy.js.map +0 -1
  748. package/dist/client/online/default-model.d.ts +0 -5
  749. package/dist/client/online/default-model.d.ts.map +0 -1
  750. package/dist/client/online/default-model.js +0 -65
  751. package/dist/client/online/default-model.js.map +0 -1
  752. package/dist/client/pages/agents/agent-model.d.ts +0 -69
  753. package/dist/client/pages/agents/agent-model.d.ts.map +0 -1
  754. package/dist/client/pages/agents/agent-model.js +0 -153
  755. package/dist/client/pages/agents/agent-model.js.map +0 -1
  756. package/dist/client/pages/agents/detail/brief-preview.d.ts +0 -7
  757. package/dist/client/pages/agents/detail/brief-preview.d.ts.map +0 -1
  758. package/dist/client/pages/agents/detail/brief-preview.js +0 -43
  759. package/dist/client/pages/agents/detail/brief-preview.js.map +0 -1
  760. package/dist/client/pages/agents/detail/history.d.ts +0 -11
  761. package/dist/client/pages/agents/detail/history.d.ts.map +0 -1
  762. package/dist/client/pages/agents/detail/history.js +0 -149
  763. package/dist/client/pages/agents/detail/history.js.map +0 -1
  764. package/dist/client/pages/agents/detail/index.d.ts +0 -3
  765. package/dist/client/pages/agents/detail/index.d.ts.map +0 -1
  766. package/dist/client/pages/agents/detail/index.js +0 -241
  767. package/dist/client/pages/agents/detail/index.js.map +0 -1
  768. package/dist/client/pages/agents/detail/sections.d.ts +0 -21
  769. package/dist/client/pages/agents/detail/sections.d.ts.map +0 -1
  770. package/dist/client/pages/agents/detail/sections.js +0 -280
  771. package/dist/client/pages/agents/detail/sections.js.map +0 -1
  772. package/dist/client/pages/agents/detail/tab-draft.d.ts +0 -43
  773. package/dist/client/pages/agents/detail/tab-draft.d.ts.map +0 -1
  774. package/dist/client/pages/agents/detail/tab-draft.js +0 -115
  775. package/dist/client/pages/agents/detail/tab-draft.js.map +0 -1
  776. package/dist/client/pages/agents/detail/unsaved-bar.d.ts +0 -13
  777. package/dist/client/pages/agents/detail/unsaved-bar.d.ts.map +0 -1
  778. package/dist/client/pages/agents/detail/unsaved-bar.js +0 -21
  779. package/dist/client/pages/agents/detail/unsaved-bar.js.map +0 -1
  780. package/dist/client/pages/agents/new.d.ts +0 -3
  781. package/dist/client/pages/agents/new.d.ts.map +0 -1
  782. package/dist/client/pages/agents/new.js +0 -149
  783. package/dist/client/pages/agents/new.js.map +0 -1
  784. package/dist/client/pages/agents/preset-picker.d.ts +0 -8
  785. package/dist/client/pages/agents/preset-picker.d.ts.map +0 -1
  786. package/dist/client/pages/agents/preset-picker.js +0 -41
  787. package/dist/client/pages/agents/preset-picker.js.map +0 -1
  788. package/dist/server/core/consultations/consultation.service.d.ts +0 -59
  789. package/dist/server/core/consultations/consultation.service.d.ts.map +0 -1
  790. package/dist/server/core/consultations/consultation.service.js +0 -198
  791. package/dist/server/core/consultations/consultation.service.js.map +0 -1
  792. package/dist/server/core/consultations/index.d.ts +0 -3
  793. package/dist/server/core/consultations/index.d.ts.map +0 -1
  794. package/dist/server/core/consultations/index.js +0 -3
  795. package/dist/server/core/consultations/index.js.map +0 -1
  796. package/dist/server/core/consultations/prompt.d.ts +0 -41
  797. package/dist/server/core/consultations/prompt.d.ts.map +0 -1
  798. package/dist/server/core/consultations/prompt.js +0 -64
  799. package/dist/server/core/consultations/prompt.js.map +0 -1
  800. package/dist/server/core/presets/index.d.ts +0 -19
  801. package/dist/server/core/presets/index.d.ts.map +0 -1
  802. package/dist/server/core/presets/index.js +0 -28
  803. package/dist/server/core/presets/index.js.map +0 -1
  804. package/dist/server/online/cli-command.d.ts +0 -20
  805. package/dist/server/online/cli-command.d.ts.map +0 -1
  806. package/dist/server/online/cli-command.js +0 -345
  807. package/dist/server/online/cli-command.js.map +0 -1
  808. package/dist/server/online/consult-tool.d.ts +0 -54
  809. package/dist/server/online/consult-tool.d.ts.map +0 -1
  810. package/dist/server/online/consult-tool.js +0 -177
  811. package/dist/server/online/consult-tool.js.map +0 -1
  812. package/dist/server/online/executor.d.ts +0 -83
  813. package/dist/server/online/executor.d.ts.map +0 -1
  814. package/dist/server/online/executor.js +0 -714
  815. package/dist/server/online/executor.js.map +0 -1
  816. package/dist/server/online/sandbox.d.ts +0 -32
  817. package/dist/server/online/sandbox.d.ts.map +0 -1
  818. package/dist/server/online/sandbox.js +0 -246
  819. package/dist/server/online/sandbox.js.map +0 -1
  820. package/dist/server/online/scripted.d.ts +0 -12
  821. package/dist/server/online/scripted.d.ts.map +0 -1
  822. package/dist/server/online/scripted.js +0 -176
  823. package/dist/server/online/scripted.js.map +0 -1
  824. package/dist/server/online/tools.d.ts +0 -17
  825. package/dist/server/online/tools.d.ts.map +0 -1
  826. package/dist/server/online/tools.js +0 -31
  827. package/dist/server/online/tools.js.map +0 -1
  828. package/dist/server/vendor/THIRD_PARTY_LICENSES.txt +0 -782
  829. package/dist/server/vendor/just-bash.d.ts +0 -83
  830. package/dist/server/vendor/just-bash.js +0 -2102
  831. package/dist/shared/presets.d.ts +0 -30
  832. package/dist/shared/presets.d.ts.map +0 -1
  833. package/dist/shared/presets.js +0 -2
  834. package/dist/shared/presets.js.map +0 -1
  835. package/skills/nocobase-app-plugin-agents/references/online-agents.md +0 -31
package/README.md CHANGED
@@ -1,54 +1,59 @@
1
1
  # @nocobase/app-plugin-agents
2
2
 
3
- Agents for NocoBase applications: the agents people configure, their runs, and people's conversations with agents. Runner agents run on the runners people connect (each a runtime: a runner on a server, a VM or someone's own device), which this plugin registers, hands work to and serves the runner and CLI tarballs for; the wire protocol runners and the application's CLI speak is `@nocobase/agent-protocol`, and the runner is `@nocobase/agent-runner` (`nocobase-runner`).
3
+ Applications may restrict personal runner use for comment-origin work by supplying `EnqueueRequest.comment` only at their authenticated comment entry point and binding `SubjectBinding.commentOwnerKey` and `responsibleUserId`. Runs share their first comment run as `commentRootRunId`; independent events carry no comment fields. Unconfirmed external comment work remains queued for team runners. When no compatible team runner exists, a `personalRunner` run request releases the existing chain on confirmation instead of creating another run. The original requester can use the existing `runAsMe` endpoint from a pending or rejected personal runner request; rejection remains recorded. Claims, decisions and input merging enforce this boundary on the server without changing the runner protocol.
4
+
5
+ Agents for NocoBase applications: the agents discovered from the runners people connect, their runs, and people's conversations with agents. Agents run on runners (each a runtime: a runner on a server, a VM or someone's own device), which this plugin registers, hands work to and serves the runner and CLI tarballs for; the wire protocol runners and the application's CLI speak is `@nocobase/agent-protocol`, and the runner is `@nocobase/agent-runner` (`nocobase-runner`).
4
6
 
5
7
  Workspace cleanup supports optional application bindings for legacy subject keys (`SubjectWorkspaces.resolveKeys`) and trusted merged PR head evidence by repository (`SubjectWorkspaces.commits`). Ownership must be confirmed from saved runs; settlement never bypasses local tracked-change, commit or submodule checks. Runtime diagnostics require the existing machine-information permission and distinguish ended work, allowed cleanup and retained work, with the workspace report's timestamp. See [workspace cleanup integration](https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-agents/docs/workspace-cleanup.md) for the protocol, binding rules and compatibility behavior.
6
8
 
7
- An agent is one of two types, chosen when it is created and never changed. A **work** agent drives a coding tool on a runner, in a working directory. An **online** agent talks to a model of one of the model services this plugin keeps and is run by the application itself, on the server: it needs no runner, answers in seconds, and its tools are the application's commands. Both share everything else: runs, conversations, transcripts, permissions, usage and reports.
9
+ `GET /api/agents/runners` and `runtime list` return workspace totals only: disk capacity, directory count, unpushed count, collection time, disk measurement time and report interval. They omit `workspaceUsage.workspaces`. Open a runtime's details, call `GET /api/agents/runners/:runnerId`, or use `runtime get` to load directory diagnostics. Directory paths and cleanup evidence retain the existing machine-information permission checks; callers without that permission receive an empty directory array in the detail response. The list uses stored totals without normalizing directory entries (older reports without totals still derive them); database reads and permissions are unchanged.
10
+
11
+ Nobody creates an agent. Each coding tool and model a runner reports signed in becomes one agent (`AgentService.syncRunner`, in the transaction of the runner's report), named from the model catalog that ships with the plugin (`shared/model-catalog.ts`: `normalizeModel` makes one model reported under two spellings one agent, and `agentNameOf` names it, such as "Claude · Opus 5.5" for Claude Code's `claude-opus-5-5`; a model the catalog does not know is named after its id), and starts **pending**. Someone who manages agents writes what it is good at, starting from the catalog's suggestion, picks its default reasoning effort and enables it; only **enabled** agents are offered work, and an agent may be disabled again. An application may also keep agents of its own (`ensureSystem`, `source` `system`), such as a project manager, whose name, instructions, business actions and models it writes itself. Runner agents remain separate from server-side OnlineAgent chats. `agentsToken.onlineAgent` runs the AI SDK with registered business tools over the existing conversations and messages, and powers the original chat HTTP API and shared browser client. For configuration and integration, read the [OnlineAgent Skill reference](skills/nocobase-app-plugin-agents/references/online-agent.md).
8
12
 
9
- The plugin knows no domain of its own beyond conversations: what agents work on (subjects), the scopes variables are kept in, the business actions an agent may be given, the presets to start an agent from and the report pages are the application's, which contributes them through the extension points below; the CLI's business commands are the application's own routes, each described with `cliRoute()`. The assembling application does it in `server/agents` and `client/agents`. With nothing contributed, the plugin still runs agents in conversations on runners, with its own commands.
13
+ The plugin knows no domain of its own beyond conversations: what agents work on (subjects), the scopes variables are kept in, the business actions an agent may be given and those every discovered agent gets, and the report pages are the application's, which contributes them through the extension points below; the CLI's business commands are the application's own routes, each described with `cliRoute()`. The assembling application does it in `server/agents` and `client/agents`. With nothing contributed, the plugin still runs agents in conversations on runners, with its own commands.
10
14
 
11
15
  ## What it does
12
16
 
17
+ Registering the same runner name and hostname again revokes every active prior registration and its keys for the token's owner, leaving other owners' runners untouched. Registration uses the existing transaction without a dedicated lock or additional table. Simultaneous registrations may leave multiple active records until the next registration cleans them up. Existing tasks continue through the usual sweep and retry rules.
18
+
13
19
  Applications forward the `notice` event of type `run_secrets_not_allowed` to the run's actor and owner: a personal runner left the run because some of its variables are for team runners only. Its subject is the run, its parameters are `runId`, `agentId` and `variables` (in words), and its key is stable per run. `notice.cleared` settles it once a runner takes the run.
14
20
 
15
21
  Repository access providers that mint credentials in `prepare` implement the idempotent `discard(run, prepared)` hook to revoke them when the claim is skipped or rolled back. It runs outside the transaction and receives the same prepared value as `forRun`. The application owns code host credentials and their revocation API; providers without this hook cannot revoke externally issued credentials.
16
22
 
17
- - **Agents** (`agAgents`): who an agent is and how it works: its name, description and avatar, optional instructions (the last layer of its brief, preferences that never override the rules or the task), its type (`runner` or `online`, immutable: a patch naming one is refused), the business actions it may perform, who may wake it and how many attempts a run gets. Which tool or model it works with is an ordered list, `modelEntries`, whose first entry is its default, each entry with its own reasoning effort (`effort`, null for the default). A runner agent's entries pair a coding tool with a model (null for the tool's default) and an effort its tool takes (`TOOL_EFFORTS` of `@nocobase/agent-protocol`), and it has its skills, its tool policy (of which runners use only the idle timeout and the turn limit: they run agents with full access, see the agent-runner README), its own variables, optionally the runners it may run on, and how many runs it may have at once; it has at least one entry. An online agent's entries pair a model service with one of its models (an entry is checked against what the model catalog offers when it is added) and an effort among `ONLINE_EFFORTS`, and it has none of a runner's settings; an online agent with no entry is not configured yet: it is listed as needing a model and left out of `GET /api/agents/available` until it has one; it is offered no business action meant for runner agents only (`AgentActionOption.types`). Its configuration carries a `revision`, raised by every change (editing, archiving, restoring): `PATCH /api/agents/:agentId` names the revision it was made against (`expectedRevision`) and is refused with 409 `REVISION_CONFLICT` (`metadata.revision` the current one) when someone saved the agent since, and a patch that changes nothing raises nothing. Every change is kept in its history (`agAgentChanges`, `GET /api/agents/:agentId/history`, with `afterRevision` for what came after a revision): who, when, and the fields that changed with their values before and after, except its variables, which are named with whether they were added, changed or removed, never valued. Archiving an agent withdraws its queued runs at once; archiving and deleting it announce `agent.removed`.
23
+ - **Agents** (`agAgents`): one for each coding tool and model the runners report (`source` `runner`, its id `runnerAgentId(tool, model)`), and the application's own (`source` `system`). An agent has a name (the catalog's, or the model's id), what it is good at (`description`: the project manager hands it work by this; required to enable it), its `status` (`pending` until someone enables it, `enabled` or `disabled`), its tool and normalized model, one model entry (`modelEntries`: the tool, the model and the default reasoning effort, `medium` when the tool takes it), and when a runner last reported it (`lastReportedAt`, refreshed at most every ten minutes). Its instructions and business actions are the application's, the same for every discovered agent (`agents.setDefaults(provider)`, written to each that differs by `applyDefaults()`; actions marked `defaultOn` otherwise), and it keeps its skills, its variables and its tool policy (of which runners use only the idle timeout and the turn limit: they run agents with full access, see the agent-runner README); it may have as many runs at once as runners' slots allow. An agent no runner reported for 14 days (`AGENT_UNREPORTED_AFTER_MS`) is listed as unreported and left out of the roster until a runner reports it again. Changing an agent (`PATCH /api/agents/:agentId`, `agents.agents` manage) writes only what it is good at, its effort (one its tool takes, else 400 `EFFORT_UNSUPPORTED`) and whether it is enabled (400 `GOOD_AT_REQUIRED` without a description); an application's own agent is changed through the application (400 `AGENT_MANAGED`). Every change raises its `revision`: a patch names the revision it was made against (`expectedRevision`) and is refused with 409 `REVISION_CONFLICT` (`metadata.revision` the current one) when someone changed the agent since, and a patch that changes nothing raises nothing. Every change is kept in its history (`agAgentChanges`, `GET /api/agents/:agentId/history`, with `afterRevision` for what came after a revision): who, when, and the fields that changed with their values before and after, except its variables, which are named with whether they were added, changed or removed, never valued. Disabling an agent withdraws its queued runs at once and announces `agent.removed` (`reason` `disabled`); work for an agent that is not enabled is refused (`AGENT_NOT_ENABLED`). Nobody deletes an agent: the agents an earlier version kept were removed by the `202610240020_ag_runner_agents` migration, their rows kept with `deletedAt` for the names their runs, comments and conversations show (`GET /api/agents/agentNames` answers every agent's name, those included), their queued runs cancelled and their pending run requests withdrawn.
18
24
  - **Runners** (`agRunners`), shown as runtimes: registered with a one-time token (`POST /api/agents/runners/registrationTokens`, or `pnpm nocobase agents runner-token`). Anyone may add a personal runner (`ownerOnly`: it runs only work its owner started) and later share it with the team; adding a team runner needs `agents.runners` manage. A runner reports its system, its features, its coding tools with versions and whether each is signed in, and what its owner's local policy lets it take (`policy`); it authenticates with its key (`agRunnerCredentials`), sends heartbeats and long-polls for work. Which of its coding tools it is offered work for is chosen on the web (`enabledTools`, null for every tool), carried from "Add runtime" on the registration token (`agRegistrationTokens`). A runner speaking a protocol this application does not serve is kept connected as `upgrade_required`: it gets no work, has what it holds released, and its owner is told once per protocol through the `notice` event (`runner_upgrade_required`; `notice.cleared` once it no longer holds). Only its owner changes a runner (its name, slots, coding tools and trust), because it is their machine with their tools' sign-ins and credentials; a manager of runners changes only a runner whose owner can no longer act (none recorded, or disabled or deleted in the application's directory, `people.provide({ inactive })`). A manager of runners may still revoke anyone's runner in an emergency, and delete it once revoked: its owner is told (`runner_revoked`) and the application's `security` log records who did it. A runner whose owner can no longer act (`people.provide({ inactive })`) is refused with `RUNNER_OWNER_DISABLED`. A runner fits an agent's run only when its owner's local policy lets it take that agent's runs, on that subject, with those repositories; `availability` and the agents list count only such runners. Every heartbeat answer announces workspace reports (`workspaces`): a runner reports the working directories it keeps for this application (`POST /api/agents/runners/workspaces`, each with the last run that worked there and whether it holds unpushed work, with the free space on the disk holding them) and is told which of those runs belong to subjects whose work is over (`remove`) or goes on (`keep`), as each subject kind's `workspaces.settled` says; a kind without it never counts as over, and only the runner's own runs are answered for. The last report is kept on the runner (`agRunners.workspaceUsage`, `Runner.workspaceUsage`) with each directory's subject and what was decided, for the Runtimes page.
19
25
  - **The claim**: one long-poll (`POST /api/agents/runners/claim?wait=true`) answers `jobs` and `runs` together, at most `free` items, from the runner's slots, which jobs and runs share (`slots`): jobs first. A heartbeat reconciles both, releasing what the server no longer thinks the runner holds and asking it to stop what was cancelled.
20
26
  - **Jobs** (`agJobs`, `agJobEvents`): only for the off-by-default runner build method (such as an application's `acme.builds.method: runner`): a `build` (check out a commit, run an administrator's command, upload its outputs), of kinds the application registers (`jobs.register(kind, { validate, prepare, onEvent, onDone })`, then `jobs.enqueue`, `get` and `watch`). A runner takes a job only when it reports `jobs.build`, someone turned on "Takes build jobs" (`acceptJobs`), it is shared or belongs to who started the job, and its policy lets it check out the job's repository. Jobs retry `runnerOffline`, `leaseExpired`, `startTimeout`, `checkoutFailed` and `policyRefused` while attempts remain, and open the stored variables they name through this plugin's variables at claim, audited as delivered.
21
27
  - **Distribution**: the application serves two products as standalone tarballs that bundle Node, one per platform, or as one universal tarball (`cli build --universal`) that runs on the machine's Node.js 24 or newer and is served to every platform without one of its own, answered with `universal: true` (`server/distribution`): its CLI (`agents.cli.name`, such as `acme`) and the runner, `nocobase-runner` (`RUNNER_PRODUCT`). `pnpm nocobase cli build` of `@nocobase/app-cli` packs the CLI the application's `package.json` declares under `nocobase.cli`, and `cli build --runner` the runner, each into a directory of its own, `storage/runners/dist/<channel>/<product>/`, with a `manifest.json` of every file's SHA-256 and size, so CI builds them as separate artifacts mounted into storage, or an application builds them into its own build output and points `agents.dist.dir` there, as NocoBase Studio does. The install script installs the CLI under `~/.local/share/<cli>`: by default the CLI alone, with a download token any signed-in person mints (`POST /api/agents/dist/downloadTokens`, `agDownloadTokens`: the CLI for one platform, three downloads within 30 minutes), as `curl -fsSL <server>/api/agents/dist/installScript | sh -s -- --token <token>`; "Add runtime" shows the same line with `--runner --server <server>` and a registration token, which also installs `nocobase-runner` under `~/.local/share/nocobase-runner`, runs `nocobase-runner register` and `nocobase-runner service install` (an application that serves no CLI still gets its runtime). A token of the other kind fails before anything is installed. A runner reports the product it runs as on registration and every heartbeat (`agRunners.product`), and the heartbeat answer carries an `upgrade` notice when the channel serves a newer version of that product for the runner's platform; a runner that reports none (one from before) is offered no update, and the Runtimes page says to install it again. A product the directory has no current version of may be named on npm instead (`agents.dist.npm`: its package and exact version, which a machine installs with the Node.js 24 or later it already has): the resolve route answers `{ kind: 'npm', product, version, package, channel }` to a caller that sends `accept=npm`, and a heartbeat answer carries `npmUpgrade` to a runner with the `npm` feature when it runs an older version. Everyone else is answered as before (404, no update), and a product the directory has is always served from it. The install script, `<cli> update` and the runner's self-update all ask with `accept=npm` (the runner declares `npm`) and install an npm answer with the machine's npm into the same layout as a tarball: `npm install --prefix <prefix>/versions/<version> --no-save --no-audit --no-fund --omit=optional <package>@<version>`, then a launcher at `versions/<version>/bin/<command>` that starts `node_modules/.bin/<command>` on `<prefix>/node` (`npmLauncherScript` of `@nocobase/app-cli-client/install`).
22
28
 
23
- - **Runs** (`agRuns`): one agent working on one subject, keyed by (agent, subject, thread), with the agent's type kept on the run (`agentType`). A subject kind takes the agent types its binding names (`agentTypes`, runner only by default); a run of another type is refused (`AGENT_TYPE_NOT_ALLOWED`). New work joins the run already on it as the same person (`actorUserId`) while that run can still be told, else that person's queued one, else starts a new run: work woken by different people never shares a run, so it neither borrows another's identity nor waits for a runner that will not take it. Runs of one key are still claimed one at a time, whoever they work as. Queued runs are claimed by `priority` (lower first; 0 by default), then oldest first; a run given a `fireAt` is not claimed before that moment. Work merged into a queued run raises it to the more urgent priority and the earlier moment of the two. Runners take only runner agents' runs. A claim hands a run to a runner that fits in one transaction: one of the agent's tools enabled, installed and signed in there (the run takes the first entry of the agent's list whose tool is, recorded on the run as `tool` and `model` and passed to the tool; a model the tool's account cannot use fails the run `modelUnavailable`), the agent naming no runner or naming this one, the runner shared with the team or owned by the person who woke the agent, its features covering what the run needs (worked out from the payload: checkouts, directories, skills, secrets), a team runner when one of the variables the run gets is for team runners only (`teamRunnersOnly`), and a free slot within the agent's concurrency. The variables are checked and opened in the claim's transaction, so the runner receives what was checked; a personal runner left out for them notes on the run which variables asked for a team runner (`teamOnlyVariables`, cleared when the run is taken, requeued or given new input), and its wait is `secretsNotAllowed` with those variables. Before a run exists, `eligibility` (`runnersFor`, `canClaim`, `mayQueue`, `teamOnly`) answers by the same rules whether a runner would take an agent's work done as a person, with the scopes and features the caller names; `availability` and `GET /api/agents/available` use it for the caller. A working directory that is a directory on one runner pins the run to that runner, one run at a time per directory. The claim renders the brief (kept per run, `agRunBriefs`), mints a run token, and hands over the working directories, the merged variables, the skills and the CLI to install. Events, usage and branches are recorded as the runner reports them; completing requires every input to be handled. A runner that finds the subject's working directory held by another live run reports `workspaceBusy`: the run goes back to the queue, freeing its slot, and is tried again after 30 seconds, doubling up to two minutes; these waits do not count against the agent's attempts, and the run fails `workspaceBusy` only once it has waited six hours (`WORKSPACE_WAIT_LIMIT_MS`).
29
+ - **Runs** (`agRuns`): one agent working on one subject, keyed by (agent, subject, thread) (`agentType` is `runner`; `online` only on runs earlier versions kept). New work joins the run already on it as the same person (`actorUserId`) while that run can still be told, else that person's queued one, else starts a new run: work woken by different people never shares a run, so it neither borrows another's identity nor waits for a runner that will not take it. Runs of one key are still claimed one at a time, whoever they work as. Queued runs are claimed by `priority` (lower first; 0 by default), then oldest first; a run given a `fireAt` is not claimed before that moment. Work merged into a queued run raises it to the more urgent priority and the earlier moment of the two. A claim hands a run to a runner that fits in one transaction: the agent's tool enabled, installed and signed in there with its model among those the runner reports for the tool and not marked unavailable there (`runsEntry` in `shared/runners.ts`; recorded on the run as `tool` and `model` and passed to the tool; a model the tool's account cannot use fails the run `modelUnavailable` and marks that tool and model unavailable on the runner, `Runner.unavailableModels`, until it reports the tool's models differently), the runner shared with the team or owned by the person who woke the agent, its features covering what the run needs (worked out from the payload: checkouts, directories, skills, secrets), a team runner when one of the variables the run gets is for team runners only (`teamRunnersOnly`), and a free slot within the agent's concurrency. The variables are checked and opened in the claim's transaction, so the runner receives what was checked; a personal runner left out for them notes on the run which variables asked for a team runner (`teamOnlyVariables`, cleared when the run is taken, requeued or given new input), and its wait is `secretsNotAllowed` with those variables. Before a run exists, `eligibility` (`runnersFor`, `canClaim`, `mayQueue`, `teamOnly`) answers by the same rules whether a runner would take an agent's work done as a person, with the scopes and features the caller names; `availability` and `GET /api/agents/available` use it for the caller. A working directory that is a directory on one runner pins the run to that runner, one run at a time per directory. The claim renders the brief (kept per run, `agRunBriefs`), mints a run token, and hands over the working directories, the merged variables, the skills and the CLI to install. Events, usage and branches are recorded as the runner reports them; completing requires every input to be handled. A failed attempt is tried again after 30 seconds (`agents.runs.retryBaseDelayMs`), doubling up to ten minutes, except when the runner went away or lost its lease, which retries at once. A runner that finds the subject's working directory held by another live run reports `workspaceBusy`: the run goes back to the queue, freeing its slot, and is tried again after 30 seconds, doubling up to two minutes; these waits do not count against the agent's attempts, and the run fails `workspaceBusy` only once it has waited six hours (`WORKSPACE_WAIT_LIMIT_MS`).
24
30
  - **Run requests** (`agRunRequests`): work someone asked of an agent on a subject another person answers for, waiting for that person to confirm it (see "Work someone else causes" below).
25
- - **Workload** (`runs.workload({ subjectKind, limit? })`, `shared/runs.ts`): the open runs on one kind of subject for a board of work, without claiming anything. Held runs come with their runner, the newest input's trigger and their newest text, tool call, status or error (`lastActivity`); queued runs with their place in the claim order (among the runs claimable now, and among the agent's) and why they wait, by the claim's own rules in its order (`RUN_WAIT_REASONS`: the agent archived, delayed until a moment, no runner online, the agent's named runners offline, its tool not signed in anywhere, only other people's personal runners, missing features, only personal runners whose owner may not receive the run's variables, the same work already held, the agent's concurrency full, every fitting runner busy, preparation retrying, or next). A wait is a code and the values its words need (`params`), never text: the client words it with `formatRunWait(t, wait)` from `client/runs.ts`, in this plugin's namespace (`runWait.reasons.<reason>`), which an application may override in its locale file or replace with its own formatter. It also answers each agent's load (held, queued, its limit, whether a runner could take its work) and the runners' (online, holding work, slots and slots used). It reads a bounded number of tables, never one query per subject; the caller decides what of it a person may see.
26
- - **Online runs** (`server/online`): every application instance runs an executor that takes online agents' runs through the same claim transaction (`claims.claimServer`, the run held by `server:<instance>`, so two instances never take one run), with the entry of the agent's list the subject asks for (a conversation's choice, `ConversationPatch.model`, while the agent still lists it) or else its first, recorded on the run as `modelService` and `model`; a failing model fails the run, nothing falls back to another entry and reports through the same lifecycle a runner's requests reach (start, events, lease, complete, fail, cancel-ack), so conversations, transcripts, retries, failed-run handling and the sweeper are unchanged. No slots and no per-agent concurrency limit apply. A run is a loop of model calls through the plugin's model gateway (`online.gateway`, below): each streams its text, which a conversation shows as a draft message growing in place, and ends with the tool calls to make and what the call used, recorded at once as the run's usage (tool `chat`, the model the provider named). It has two tools (`online/sandbox.ts`): `bash`, a sandboxed shell (`just-bash`, in process: no real processes, no network, a 10-second deadline per command, its output cut to what the model reads; the build bundles the part of `just-bash` it uses into `dist/server/vendor/just-bash.js` with `THIRD_PARTY_LICENSES.txt` beside it, so the plugin does not depend on `just-bash`, and leaves out Python, JavaScript, SQLite, curl, html-to-markdown and xz/zstd archives, which answer that they are not available), and `skill`, which reads one of the run's skills (its SKILL.md and its file tree). The shell mounts the run's skills read-only at `/skills/<slug>/` (text only, at most 5 MB per run; binary files are listed but not readable, and scripts are never run) with `/tmp` as scratch, and carries the application's CLI (`online/cli-command.ts`): `acme`, built from the run's command manifest (the application's `GET /api/cli/manifest`, the actions of the person who woke the agent that the agent is configured with), each command one request sent through the application itself with the run's token, so the route checks the permission again; the line is read by the CLI's own parser (`@nocobase/app-cli-client/parse`), so flags, `--<flag>-file` and the body's `--file` (read from the shell's files), `--from-env` (the shell's exported variables), usage errors and exit codes are the CLI's; help and `acme docs` work from the manifest, `--json` prints the cli-envelope, and commands that send or save files are refused. Skills every online run gets besides its own (the CLI's) are registered with `online.skills`. A refused or failed call is a result the model reads. Input that arrives meanwhile is answered in the same run; a run that calls tools for more than `maxSteps` model calls fails `stepLimit`. The gateway's errors become failure reasons: `config` → `modelUnavailable`, `auth` → `toolAuth`, `quota` → `toolQuota`, `rateLimit` → `toolRateLimit` and `network` → `toolNetwork` (both retried while attempts remain), `contextOverflow` → `contextOverflow`, anything else `unknown`. A cancel request aborts the model call within a second; at shutdown an instance hands its runs back (`runnerOffline`), and one that stops renewing its leases loses them to the sweeper (`leaseExpired`). The brief of an online run has a system layer of its own (`onlineSystemLayer`): the CLI in its shell instead of a terminal, no workspace, its skills by name and description (`onlineSkillsSection`), and links to the pages of what it relied on.
31
+ - **Workload** (`runs.workload({ subjectKind, limit? })`, `shared/runs.ts`): the open runs on one kind of subject for a board of work, without claiming anything. Held runs come with their runner, the newest input's trigger and their newest text, tool call, status or error (`lastActivity`); queued runs with their place in the claim order (among the runs claimable now, and among the agent's) and why they wait, by the claim's own rules in its order (`RUN_WAIT_REASONS`: the agent not enabled, `agentArchived`, delayed until a moment, no runner online, the agent's named runners offline, its tool not signed in anywhere, only other people's personal runners, missing features, only personal runners whose owner may not receive the run's variables, the same work already held, the agent's concurrency full, every fitting runner busy, preparation retrying, or next). A wait is a code and the values its words need (`params`), never text: the client words it with `formatRunWait(t, wait)` from `client/runs.ts`, in this plugin's namespace (`runWait.reasons.<reason>`), which an application may override in its locale file or replace with its own formatter. It also answers each agent's load (held, queued, its limit, whether a runner could take its work) and the runners' (online, holding work, slots and slots used). It reads a bounded number of tables, never one query per subject; the caller decides what of it a person may see.
27
32
  - **Redaction**: what runners report is stored redacted. The runner redacts first; the server redacts every run event (content, output, input and meta), summary and failure detail, and every job event and failure detail again before storing them, with the protocol's redactor (`createRedactor` of `@nocobase/agent-protocol`): the secrets the claim handed out (a run's variables and token, a job's opened variables, repository token and upload headers, remembered in memory for recent claims) and the common secret patterns, each replaced with `[REDACTED]` (`server/kernel/redaction.ts`). After a restart, or on another instance, the patterns and the runner's own redaction still apply.
28
- - **The sweep** (`server/runners/sweeper.ts`, the `RunnersSweep` schedule every 30 seconds on the application's jobs service, or an in-process timer without one) marks runners not heard from for 150 s offline, takes jobs back from silent runners and fails jobs far past their timeout, and takes runs back from runners that went away, lost their lease or never started, fails runs idle for twice their idle timeout, records unacknowledged cancellations, cancels queued runs of archived agents, and fails a queued run that waited longer than its subject allows (`queuedExpiryMs` on the subject's binding, counted from the run's last change or from its `fireAt`) as `queuedExpired`.
33
+ - **The sweep** (`server/runners/sweeper.ts`, the `RunnersSweep` schedule every 30 seconds, or `agents.runners.sweepIntervalMs`, on the application's jobs service, or an in-process timer without one) marks runners not heard from for 150 s offline, takes jobs back from silent runners and fails jobs far past their timeout, and takes runs back from runners that went away, lost their lease or never started, fails runs idle for twice their idle timeout, records unacknowledged cancellations, cancels queued runs of archived agents, and fails a queued run that waited longer than its subject allows (`queuedExpiryMs` on the subject's binding, counted from the run's last change or from its `fireAt`) as `queuedExpired`.
29
34
  - **Variables** (`agSecrets`): environment variables for the agent's process, every one a secret sealed with the application's secrets service (`secrets.keys`) and bound to its scope and name, set on an agent, a working directory (`workdir`) or a scope the application registers, merged for a run in the order the subject names its scopes < its working directories < the agent, delivered only to runners with the `secrets` feature: to whichever runner takes the run, a personal runner of anyone who may use the agent included, since sharing an agent shares the tokens it works with. A variable marked `teamRunnersOnly` (off by default; `PUT /api/agents/variables/...` with `teamRunnersOnly`, and without `value` to change only that) keeps runs and jobs that get it on team runners. Jobs check the exact variables referenced by their prepared spec, including repository credentials, before opening any value in the claim transaction; a personal runner skips such a job without counting a preparation failure, leaving it queued for a team runner and continuing to other jobs. Values are write-only; reading them back and every delivery are audited (`agSecretAudits`).
30
- - **Skills** (`agSkills`, `agSkillVersions`, `agSkillAttachments`): a library of skills in the open Agent Skills format (https://agentskills.io/specification): a directory of `SKILL.md` and supporting files, conventionally under `scripts/`, `references/` and `assets/`. Only the front matter of `SKILL.md` names and describes a skill: `name` (1–64 lower-case letters, digits and single hyphens) is its slug and directory, so a save that changes it renames the skill, and `description` (1–1024 characters) is required; `license`, `compatibility` (at most 500 characters), `metadata` (string values) and `allowed-tools` are checked when present, and other keys are kept. Every create, save, restore and import is checked against these rules in the browser as it is typed and on the server (`shared/skill-markdown.ts`), which answers 400 with each problem's `field` and `reason` in `metadata.problems` (`taken` for a name another skill has; `mismatch` for an archive whose folder is named otherwise). Files under `scripts/` or marked executable are scripts (`Skill.scripts`): runners may run them, online agents only read them. Every save is a new version that runs get at once, with older versions to compare and restore. Skills are attached to agents, and as defaults to a working directory or a registered scope. A skill's revision is its current version: a save or a restore names the version it was made against (`expectedRevision`) and is refused with 409 `REVISION_CONFLICT` when another save came first. A runner fetches a run's skills from `GET /api/agents/runners/runs/:runId/skills/:slug` and places them where the run's coding tool finds them.
31
- - **Conversations** (`agConversations`, `agConversationMessages`): a person chatting with an agent they may wake, from the chat panel. A conversation's mode is the type of the agent it answers with (`mode`): it moves to an agent of the same type, except that a runner conversation may move to the online fallback agent and back. Only the owner reads a conversation, administrators included; its runs are hidden from everyone they do not involve. Each message the owner sends wakes the agent on the `conversation` subject as the owner, or joins the run already working on it; every text the agent writes becomes a message. A run resumes the session its runner kept; on another runner, or after the conversation switched agents, it starts fresh with the last 20 messages and the previous run's summary. When the agent is archived, no longer allowed, has no online signed-in runner, or (an online agent) its model is no longer offered (`modelUnavailable`), messages are still saved and the conversation reports why; the owner may switch it to the system default chat agent and back when that agent is of the same type, or else a runner conversation to the online fallback agent (`ChatSettings.onlineFallbackAgentId`). A conversation started with a runner agent that no runner may run for its owner now, such as one whose only online runner is someone else's personal one, starts on the online fallback agent when one is set, as if switched (`fallbackFrom` names the runner agent, notice `switchedToOnline`), and the owner may switch it back once the original agent can answer again; `chatAgents` says so per agent (`fallbackAgentId`). Runner availability uses claim eligibility, including required features and variables restricted to team runners. Existing runner conversations check again on the next message; if no eligible runner remains, they switch to the usable online fallback and transfer unanswered queued messages. Manual fallback skips an unavailable system default. If the configured online fallback has no offered answering model, the conversation stays on the runner and records an `onlineFallbackUnavailable` notice explaining why. The owner answers for their own conversation, so none of this asks anyone to confirm. Without an online fallback agent set, runner conversations do not switch automatically. An online conversation answers with the entry of its agent's list its owner chose in the composer (`model`, `PATCH` with `model`; null for the agent's default), from the next run on; the composer offers the agent's entries (`models`) and hides the choice when there is only one. An online agent's reply is a draft (`metadata.streaming`) rewritten in place as it streams, at the same `seq`, and made final by the run's text event; a draft whose run ended first keeps what it had written (`metadata.interrupted`). `shared/conversations` is the contract (HTTP API under `/api/agents/conversations` and `/api/agents/chat*`, page context and its limits, the per-user realtime topic `agents:conversations`); `ConversationService` is the interface other code uses, so the storage can move to a shared platform layer later.
32
- - **Chat defaults and presets**: the system default chat agent and the online fallback agent (`agSettings`), each person's default chat agent (`agChatPreferences`), "Copy as my agent" on an agent's page (a private copy of it), each agent's "confirm before changing data" (`confirmChanges`: `always` or only `larger` changes), and the agent presets the application registers to start a new agent from (`GET /api/agents/presets`).
35
+ - **Skills** (`agSkills`, `agSkillVersions`, `agSkillAttachments`): a library of skills in the open Agent Skills format (https://agentskills.io/specification): a directory of `SKILL.md` and supporting files, conventionally under `scripts/`, `references/` and `assets/`. Only the front matter of `SKILL.md` names and describes a skill: `name` (1–64 lower-case letters, digits and single hyphens) is its slug and directory, so a save that changes it renames the skill, and `description` (1–1024 characters) is required; `license`, `compatibility` (at most 500 characters), `metadata` (string values) and `allowed-tools` are checked when present, and other keys are kept. Every create, save, restore and import is checked against these rules in the browser as it is typed and on the server (`shared/skill-markdown.ts`), which answers 400 with each problem's `field` and `reason` in `metadata.problems` (`taken` for a name another skill has; `mismatch` for an archive whose folder is named otherwise). Files under `scripts/` or marked executable are scripts (`Skill.scripts`): runners may run them. Every save is a new version that runs get at once, with older versions to compare and restore. Skills are attached globally, or as defaults to a working directory or a registered scope. A skill's revision is its current version: a save or a restore names the version it was made against (`expectedRevision`) and is refused with 409 `REVISION_CONFLICT` when another save came first. A runner fetches a run's skills from `GET /api/agents/runners/runs/:runId/skills/:slug` and places them where the run's coding tool finds them.
36
+ - **Conversations** (`agConversations`, `agConversationMessages`): owner-only chats through the OnlineAgent service, with native model execution or a callable Runner binding. Existing bindings are immutable. Historical unbound conversations retain readable history and owner-authorized Stop for unfinished runs, but cannot continue chatting through HTTP. Ordinary conversations default to visible; new background sessions are hidden from lists before pagination. The [OnlineAgent reference](skills/nocobase-app-plugin-agents/references/online-agent.md) documents execution, result observation, browser configuration, notification transactions and migration from removed start/fallback/restore endpoints and CLI commands.
37
+ - **Chat defaults**: the system default chat agent (`agSettings`, `PATCH /api/agents/chatSettings` by who manages `agents.agents`, or the application), each person's default chat agent (`agChatPreferences`), and each agent's "confirm before changing data" (`confirmChanges`: `always` or only `larger` changes).
33
38
  - **No setup scripts.** Preparing a working directory is the agent's job: its brief tells it to follow each directory's own instructions (AGENTS.md, CLAUDE.md, README), to install what is missing inside the directory, and to say so (the way the subject's guidance tells it) when it cannot. A working directory's optional initialization prompt reaches the agent only when the runner prepared that directory fresh. "Clean working directory" (`POST /api/agents/workspaces/:subjectKind/:subjectId/reset`) makes the next run start from a fresh checkout.
34
39
 
35
- The configured online fallback must have an available default answering model, either its own first model entry or the system default when it has no entries. Disabled or removed model services and removed models make it unavailable. If automatic fallback cannot answer, the conversation retains its original runner agent and writes an `onlineFallbackUnavailable` system notice explaining the reason; its runner availability remains `noRunner`. `chatAgents` and the manual fallback action apply the same model check.
40
+ ## Chat integration documentation
36
41
 
37
- ## Online agents
42
+ - [OnlineAgent service and business tools](skills/nocobase-app-plugin-agents/references/online-agent.md): trusted server configuration, Native/Runner sessions, public browser transport and lifecycle boundaries.
43
+ - [UI messages](docs/ui-messages.md) and [client coordination](docs/ui-message-clients.md): SDK message ownership, safe projections, streaming, persistence and recovery.
44
+ - [UI context, tool cards and AI form adapters](docs/ai-forms.md): open `context.ui.items`, exact-name `AIToolRendererProvider` registration, `useAIForm` ref callbacks, explicit async context selection and guarded browser-draft application, with integrated Examples wiring. The plugin provides no built-in form-filling business tool/card and never submits or saves a form or continues a server tool when a user applies a local proposal.
38
45
 
39
- The plugin keeps the model services online agents call (`agModelServices`, `server/online/services.ts`): a provider type, a name agents and model prices store (made from the title, never changed), a title, a base URL (the provider's default when empty), an API key sealed with the secrets service as variables are, bound to the service's name, an on/off switch, and the models it offers. A provider may have any number of services. The key is write-only: the API answers `apiKeySet`, never the key. Every request to a provider names the plugin first in its user agent (`nocobase-agents/<version>`); a call to an OpenCode base URL (Zen or Go) additionally carries `x-opencode-session`, the same session id for every model call of a conversation (a hash of its subject and thread, `sessionOf` in `server/online/executor.ts`) and a new one for each call outside any, such as a connection test, an embedding or a rerank. Deleting a service deletes its model prices. A model's kind (chat, embedding or rerank) is guessed from its id only as a default and can always be changed; checking a model checks it as its kind, and when it fails that way but answers as another kind its provider serves, the check says so (`ModelCheck.looksLike`). The system default chat model (`agSettings` key `models`) is what an online agent that lists no model answers with: availability, the run (which records the model it used) and the conversation's model all fall back to it. It is set on the Models page; with none set, the first chat model an enabled service offers is used, and the first chat model turned on becomes it.
46
+ ## Model services
40
47
 
41
- The providers (`MODEL_PROVIDERS` in `shared/models.ts`, `server/online/providers.ts`) are Vercel AI SDK provider packages: `@ai-sdk/openai`, `@ai-sdk/anthropic`, `@ai-sdk/google`, `@ai-sdk/deepseek`, `@ai-sdk/alibaba` (Qwen), `@ai-sdk/moonshotai` (Kimi), `@ai-sdk/cohere`, `ollama-ai-provider-v2`, and `@ai-sdk/openai-compatible` for every other endpoint that speaks OpenAI's chat completions. A provider's models are read from its own list-models endpoint (`GET /models`; Anthropic's with its version header, Google's `models` that generate content, Cohere's v1 `models`, Ollama's `/tags`); a model can also be added by id.
48
+ The plugin keeps model services (`agModelServices`, `server/online/services.ts`) for the application's own model calls, such as a knowledge base's embeddings; agents do not use them. A service has a provider type, a name model prices store (made from the title, never changed), a title, a base URL (the provider's default when empty), an API key sealed with the secrets service as variables are, bound to the service's name, an on/off switch, and the models it offers. A provider may have any number of services. The key is write-only: the API answers `apiKeySet`, never the key. Every request to a provider names the plugin first in its user agent (`nocobase-agents/<version>`); a call to an OpenCode base URL (Zen or Go) additionally carries `x-opencode-session`, a new session id for each call. Deleting a service deletes its model prices. A model's kind (chat, embedding or rerank) is guessed from its id only as a default and can always be changed; checking a model checks it as its kind, and when it fails that way but answers as another kind its provider serves, the check says so (`ModelCheck.looksLike`).
42
49
 
43
- Each model of a service is of one kind (`ModelKind`), chosen in its row of the service's dialog among the kinds its provider serves (`kinds`): `chat` (what online agents talk to; the only kind agents, their pickers and the catalog's default ever see), `embedding` (texts to vectors, with an optional vector size, `dimensions`, asked through each provider's own option) or `rerank` (documents ordered by a query). OpenAI, Google, Alibaba and Ollama serve chat and embedding models; Cohere and OpenAI-compatible endpoints serve all three, an OpenAI-compatible endpoint's reranking being `POST <base>/rerank` in the shape Cohere, Jina, vLLM and SiliconFlow share (`compatibleReranking`); Anthropic, DeepSeek and Moonshot serve chat models only. A model without a kind is a chat model. Testing a model tries it as its kind says.
44
-
45
- The model gateway (`online.gateway`, `server/online/gateway.ts`) is what the executor and the admin API call: `catalog()` (the enabled services that offer a model, names only), `check(ref)` (a short `generateText`, 20 seconds, never throws), `languageModel(ref)`, the chat model an online run's loop runs over, and `stream(request)`, one `streamText` call with tools declared without an implementation, which ends at the tool calls the model made. An online run is the SDK's `ToolLoopAgent` over that model: the run's brief is its instructions, its tools are executed by the SDK step by step (a tool answers `{ ok, output }`, and the model reads `output` through `toModelOutput`), each step's usage is recorded as it finishes, and the loop stops when the model answers without a tool call or after `agents.server.maxSteps` steps (`stepLimit`); an entry's reasoning effort is the SDK's `reasoning` option. Usage is mapped to the protocol's non-overlapping counts (input without cached reads and cache writes; output with reasoning). The SDK retries a failed request twice; a failure throws `ModelError` with a code from the provider's status and error body (`config`, `auth`, `quota`, `rateLimit`, `network`, `contextOverflow`, `filtered`, `badResponse`, `aborted`, `unknown`), which become the run's failure reasons as above. A service without a key whose provider needs one fails `auth` before any request. A run's brief, and a system message marked `cache`, carry Anthropic's `cacheControl` (`ephemeral`), so the brief is read from the cache on every model call of a run after the first; OpenAI caches a long prefix by itself.
50
+ The providers (`MODEL_PROVIDERS` in `shared/models.ts`, `server/online/providers.ts`) are Vercel AI SDK provider packages: `@ai-sdk/openai`, `@ai-sdk/anthropic`, `@ai-sdk/google`, `@ai-sdk/deepseek`, `@ai-sdk/alibaba` (Qwen), `@ai-sdk/moonshotai` (Kimi), `@ai-sdk/cohere`, `ollama-ai-provider-v2`, and `@ai-sdk/openai-compatible` for every other endpoint that speaks OpenAI's chat completions. A provider's models are read from its own list-models endpoint (`GET /models`; Anthropic's with its version header, Google's `models` that generate content, Cohere's v1 `models`, Ollama's `/tags`); a model can also be added by id.
46
51
 
47
- The gateway also serves the application's own model calls outside runs, each naming who asks (`source`, such as `knowledge`): `embed({ model, values, source })` (`embedMany`, two requests at a time, answering the vectors, their size and the tokens read), `rerank({ model, query, documents, topN?, source })` (the SDK's `rerank`, answering each document's index and score, best first) and `generate({ model, system?, prompt, maxOutputTokens?, source })` (one short text from a chat model, `generateText`). Each names a model of the matching kind (`catalog(kind)` lists them) and throws `ModelError` as a run's calls do. What each used is recorded at once in `agModelUsage` (purpose `embedding`, `rerank` or `text`, the source, the model, its tokens and how many texts or documents), priced like online runs' calls from the service's model prices, and reported by `reporting.modelUsage(caller, { from, to })` (`GET /api/agents/usage/models`, behind the usage page's grant, rows only for a reader of every run): the usage page shows it below the runs as "Other model use".
52
+ Each model of a service is of one kind (`ModelKind`), chosen in its row of the service's dialog among the kinds its provider serves (`kinds`): `chat` (short texts, `generate`), `embedding` (texts to vectors, with an optional vector size, `dimensions`, asked through each provider's own option) or `rerank` (documents ordered by a query). OpenAI, Google, Alibaba and Ollama serve chat and embedding models; Cohere and OpenAI-compatible endpoints serve all three, an OpenAI-compatible endpoint's reranking being `POST <base>/rerank` in the shape Cohere, Jina, vLLM and SiliconFlow share (`compatibleReranking`); Anthropic, DeepSeek and Moonshot serve chat models only. A model without a kind is a chat model. Testing a model tries it as its kind says.
48
53
 
49
- ### Consultations
54
+ The model gateway (`models.gateway` of `agentsToken`, `server/online/gateway.ts`) is what the application and the admin API call: `catalog(kind?)` (the enabled services that offer a model of the kind, names only), `check(ref)` (a short `generateText`, 20 seconds, never throws), and the calls below. Usage is mapped to non-overlapping counts (input without cached reads and cache writes; output with reasoning). The SDK retries a failed request twice; a failure throws `ModelError` with a code from the provider's status and error body (`config`, `auth`, `quota`, `rateLimit`, `network`, `contextOverflow`, `filtered`, `badResponse`, `aborted`, `unknown`). A service without a key whose provider needs one fails `auth` before any request.
50
55
 
51
- An online run may consult another online agent synchronously, as the AI SDK's subagent pattern does: the tool `ask_agent` (`{ agent, question, context? }`, `server/online/consult-tool.ts`) is given to a run whose system prompt lists agents it may consult (`Agents you may consult`, name and the first line of the description), and only then. Those are online agents with a model that the person the run acts for may use (their "who may use it"), not already in the run's chain. The answer comes from a run of its own (`server/core/consultations`): a child of the asking run (`parentRunId`), on the subject `{ kind: 'consultation', id: <asking run> }`, one thread per tool call, one attempt, acting for the same person with its own run token. It is never claimed from the queue: the instance holding the asking run takes it at once (`claims.claimChild`) and runs it within the tool call, aborted with the asking run, within `agents.server.consult.timeoutMs` and `tokenBudget`. It only reads: the gate keeps a consultation's run to reading actions (`…/view`, `…/read`) and those the application marks `consultable` (for example, proposing an operation plan, which reaches as far as the agent and person do and is confirmed by the person in the conversation that asked, `conversations.homeOf`). Consultations go `CONSULT_MAX_DEPTH` (2) deep and never back to an agent already asked; a runner agent is refused with "use a task to delegate to a runner agent". The tool streams preliminary results, which the asking conversation shows as a card (a `consultation` notice, rewritten in place); the asking model reads only the final answer and a note of the plans proposed (`toModelOutput`). The child's transcript and usage are its own, and `RunDetail.children` lists a run's consultations.
56
+ The gateway serves the application's own model calls, each naming who asks (`source`, such as `knowledge`): `embed({ model, values, source })` (`embedMany`, two requests at a time, answering the vectors, their size and the tokens read), `rerank({ model, query, documents, topN?, source })` (the SDK's `rerank`, answering each document's index and score, best first) and `generate({ model, system?, prompt, maxOutputTokens?, source })` (one short text from a chat model, `generateText`). Each names a model of the matching kind (`catalog(kind)` lists them) and throws `ModelError` as a run's calls do. What each used is recorded at once in `agModelUsage` (purpose `embedding`, `rerank` or `text`, the source, the model, its tokens and how many texts or documents), priced from the service's model prices, and reported by `reporting.modelUsage(caller, { from, to })` (`GET /api/agents/usage/models`, behind the usage page's grant, rows only for a reader of every run): the usage page shows it below the runs as "Other model use".
52
57
 
53
58
  ## Vectors
54
59
 
@@ -65,18 +70,18 @@ An online run may consult another online agent synchronously, as the AI SDK's su
65
70
 
66
71
  ## Layout
67
72
 
68
- | Folder | What is there |
69
- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
70
- | `server/kernel` | Clock, ids, transactions, events, credentials and secret sealing, scopes, redaction, HTTP helpers |
71
- | `server/core` | What both agent types share: agents, runs and the queue (claims, lifecycle, sweeper), briefs, conversations, the custom command registry, usage, prices and reports, skills, variables, presets |
72
- | `server/online` | Online agents: the model services, the providers, the model gateway, the executor and its command tools, and the model endpoints of the admin API |
73
- | `server/vectors` | Vector collections, their embedding queue, the vector store registry, and the `sqlite-vec` and `pgvector` stores |
74
- | `server/runners`, `server/jobs`, `server/distribution` | The runners (registration, keys, heartbeats, slots, the sweeper), the build jobs, and the runner and CLI tarballs |
75
- | `server/routes/runners` | The runner protocol (with a run's `runs/:runId/*` endpoints), the tarballs, the install script and the runners' admin API |
76
- | `server/routes` | The admin, chat and CLI endpoints, and where every endpoint is mounted (`index.ts`) |
77
- | `server/providers` | The service providers that assemble and boot the plugin |
78
- | `shared` | The view models the browser and the API exchange (`models.ts` for online agents' services and catalog) |
79
- | `client` | The pages and components; `client/online` the model services UI of the Models page; `client/pages/usage/prices` the prices sheet of the Usage page |
73
+ | Folder | What is there |
74
+ | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
75
+ | `server/kernel` | Clock, ids, transactions, events, credentials and secret sealing, scopes, redaction, HTTP helpers |
76
+ | `server/core` | Agents, runs and the queue (claims, lifecycle, sweeper), briefs, conversations, the custom command registry, usage, prices and reports, skills, variables |
77
+ | `server/online` | The model services, the providers, the model gateway, and the model endpoints of the admin API |
78
+ | `server/vectors` | Vector collections, their embedding queue, the vector store registry, and the `sqlite-vec` and `pgvector` stores |
79
+ | `server/runners`, `server/jobs`, `server/distribution` | The runners (registration, keys, heartbeats, slots, the sweeper), the build jobs, and the runner and CLI tarballs |
80
+ | `server/routes/runners` | The runner protocol (with a run's `runs/:runId/*` endpoints), the tarballs, the install script and the runners' admin API |
81
+ | `server/routes` | The admin, chat and CLI endpoints, and where every endpoint is mounted (`index.ts`) |
82
+ | `server/providers` | The service providers that assemble and boot the plugin |
83
+ | `shared` | The view models the browser and the API exchange (`models.ts` for the model services and their catalog; `model-catalog.ts` for the models agents are named after) |
84
+ | `client` | The pages and components; `client/online` the model services UI of the Models page; `client/pages/usage/prices` the prices sheet of the Usage page |
80
85
 
81
86
  ## HTTP API
82
87
 
@@ -92,7 +97,7 @@ Every route lives under the plugin's namespace, `/api/agents`, and names its own
92
97
  | `/api/agents/cli/*` | Run token header, or the application's authentication | The CLI's custom commands (`CLI_ROUTES.command`); the manifest is the application's `GET /api/cli/manifest` |
93
98
  | everything else under `/api/agents` | Session and authorization context | Agents and brief previews, variables, skills, runs, the vocabulary, usage, prices, conversations, the model services and their models |
94
99
 
95
- Scoped API keys reach only the routes whose every operation is a settings check (agents, skills, model services, prices and usage); elsewhere they are refused with `SCOPED_KEY_FORBIDDEN`. The API checks four settings items, which the plugin lists under an Agent team subsection of the permission workspace: `agents.agents` (read or manage agents, their variables, skills, and every run; reading also sees every runner), `agents.runners` (read every runner; manage revokes and deletes any runner, changes a runner whose owner can no longer act and adds team runners; anyone signed in adds personal runners and changes, revokes and deletes their own, and only the owner changes a runner), `agents.prices` (the model prices) and `agents.services` (the model services: read lists them, manage adds, edits, tests and deletes them and sets their keys; a scoped key may only read them). It also declares one business action with three levels (`BUSINESS_ACTIONS` and `RELATIONS` in `shared/access.ts`), registered as the `agents` resource type under an Agent team subsection of business, one action per level (`edit.related`, `edit.all`), whose level the application tells it through `agentsAccessToken` (`scopeOf(identity, key)`; unbound, every level is `none`): `agents.agents/edit` changes agents (their settings, skills and variables; archiving, restoring and deleting them) and edits skills (saving, restoring a version), every one at `all` and at `related` the agents the caller owns and the skills they created. Managing agents reaches every one whatever the level; creating agents and skills and deleting skills still need it. Someone editing at a level, without managing agents, does not hand an agent to another owner and adds to it only business actions they hold themselves (the command gate's `allowed`). An agent and a skill answer `canEdit` for the caller. Anyone signed in reads which model services and models online agents may use (`GET /api/agents/models`, names only, chat models unless `?kind=embedding` or `rerank` asks for another kind; `shared/models.ts`), and anyone who reads agents may test one (`POST /api/agents/checkModel`). Anyone signed in reads the system default chat model (`GET /api/agents/defaultModels`), and who manages `agents.services` sets it (`PUT /api/agents/defaultModels/chat`). Anyone signed in sees, cancels and retries the runs they started or own, and reads the vocabulary (labels only). A working directory's or a registered scope's variables and default skills follow the scope's kind: it decides who reads and who changes them.
100
+ Scoped API keys reach only the routes whose every operation is a settings check (skills, model services, prices and usage); elsewhere they are refused with `SCOPED_KEY_FORBIDDEN`. The API checks four settings items, which the plugin lists under an Agent team subsection of the permission workspace: `agents.agents` (manage changes agents and their variables; read sees agents' variables, skills and every run, and every runner; anyone signed in reads the agents themselves, `GET /api/agents`, with `canEdit` for a manager), `agents.runners` (read every runner; manage revokes and deletes any runner, changes a runner whose owner can no longer act and adds team runners; anyone signed in adds personal runners and changes, revokes and deletes their own, and only the owner changes a runner), `agents.prices` (the model prices) and `agents.services` (the model services the application calls: read lists them, manage adds, edits, tests and deletes them and sets their keys; a scoped key may only read them). It also declares one business action with three levels (`BUSINESS_ACTIONS` and `RELATIONS` in `shared/access.ts`), registered as the `agents` resource type under an Agent team subsection of business, one action per level (`edit.related`, `edit.all`), whose level the application tells it through `agentsAccessToken` (`scopeOf(identity, key)`; unbound, every level is `none`): `agents.agents/edit` edits skills (saving, restoring a version), every one at `all` and at `related` the skills the caller created; agents are changed only by who manages them. Managing agents reaches every skill whatever the level; creating and deleting skills still need it. A skill answers `canEdit` for the caller. Anyone signed in reads which model services and models are offered (`GET /api/agents/models`, names only, chat models unless `?kind=embedding` or `rerank` asks for another kind; `shared/models.ts`), and anyone who reads agents may test one (`POST /api/agents/checkModel`). Anyone signed in sees, cancels and retries the runs they started or own, and reads the vocabulary (labels only). A working directory's or a registered scope's variables and default skills follow the scope's kind: it decides who reads and who changes them.
96
101
 
97
102
  Realtime announcements carry no content: `agents:runs:<runId>` when a run's status, transcript or input changes and `agents:runners` when a runner changes. A page that hears one fetches through the API.
98
103
 
@@ -102,17 +107,18 @@ Everything the application contributes goes through `agentsToken` (`server/token
102
107
 
103
108
  | Extension point | What the application gives |
104
109
  | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
105
- | `subjects.register(binding)` | A kind of subject runs work on: `kind`, `title`, `triggers` (what `input.payload.trigger` values mean, for the run panel), `preview` (a `SubjectSample`: the assembly of a made-up subject of the kind, its values marked with `sampleValue`, offered as a scenario of "Preview full prompt"), `context.assemble` (the brief's task and context, the turn, the working directories, the scopes, and `guidance`: the subject's own lines of the rules and of the environment check), `sink.onRunFinished`, `queuedExpiryMs` (how long a run may wait for a runner; forever without it), `reports.describe` (a subject's label, whether the person may see it, and its `group`), and `agentTypes` (`['runner']` by default; a kind whose runs need no working directory adds `online`). The claim tells `assemble` how the agent reaches the commands (`claim.dialect`, `cli` or `tools`): name them with `commandRef(dialect, cli, id, flag?)` (`acme issue get` in both: an online agent runs the CLI in its shell, writing files under `/tmp`). |
110
+ | `subjects.register(binding)` | A kind of subject runs work on: `kind`, `title`, `triggers` (what `input.payload.trigger` values mean, for the run panel), `preview` (a `SubjectSample`: the assembly of a made-up subject of the kind, its values marked with `sampleValue`, offered as a scenario of "Preview full prompt"), `context.assemble` (the brief's task and context, the turn, the working directories, the scopes, and `guidance`: the subject's own lines of the rules and of the environment check), `sink.onRunFinished`, `queuedExpiryMs` (how long a run may wait for a runner; forever without it), `reports.describe` (a subject's label, whether the person may see it, and its `group`). Name the commands `assemble` mentions with `commandRef(cli, id, flag?)` (`acme issue get`). |
106
111
  | `scopes.register(kind)` | A scope of variables and default skills (`key`, `title`, `description`, `access(scopeId, userId)`). `agent` is reserved; `workdir` is a core key the application registers to decide who may see and change a working directory's. |
107
- | `actions.provide(source)` | The business actions an agent may be configured with (`key`, `group`, `title`, `groupTitle`, `description`, `defaultOn` for the new-agent dialog), and those never granted to an agent, listed only to show the boundary (`grantable: false` with a `reason`). |
108
- | `presets.register(preset)` | A role a new agent can start from (`name`, `nameText`, `description`, `descriptionText`, `instructions`, `actions`). |
112
+ | `actions.provide(source)` | The business actions an agent may be configured with (`key`, `group`, `title`, `groupTitle`, `description`, `defaultOn` for the ones every discovered agent gets unless `agents.setDefaults` says otherwise), and those never granted to an agent, listed only to show the boundary (`grantable: false` with a `reason`). |
113
+ | `agents.setDefaults(provider)` | The instructions and business actions every agent discovered from runners gets (`AgentDefaults`), asked whenever one is written; `agents.applyDefaults()` writes them to every one that differs. Returns what removes the provider. |
114
+ | `agents.ensureSystem(input)` | An agent of the application's own (`SystemAgentInput`: its fixed id, name, description, instructions, business actions and the tools and models it runs with, none until it is configured), created the first time, kept as given and enabled; people do not change it. |
109
115
  | `gate.set(gate)` | Who holds which business actions: an `ActionGate` answering `allowed(identity)` for a person or a run, and optionally `consultable(action)` for what a consultation may keep besides reading. `gate.allowed` and `gate.reach` answer for a caller; the gate also bounds what a run may do over the API. |
110
- | `conversations.sources.register(source)` | A place conversations start from besides the panel (`POST …/chat/start` takes `source` and the first message as the agent should read it). |
116
+ | `conversations.sources.register(source)` | A place conversations start from besides the panel (`POST /conversations` takes `source`, then `POST /conversations/:id/messages` the first message as the agent should read it). |
111
117
  | `conversations.contextKinds.register(kind, resolver)` | A kind of object a page context may reference, resolved for the message's owner. |
112
118
  | `conversations.rules.provide(rules)` | Rules and sections added to the system layer of conversation runs. |
113
- | `conversations.deliver(tx, id, news)`, `conversations.lock(conn, id)` | A `news` notice (`type`, English `title`, `params`) written to a conversation, with input that wakes its agent. |
119
+ | `conversations.deliver(tx, id, news)`, `conversations.lock(conn, id)` | A `news` notice (`type`, English `title`, `params`) saved in the caller's transaction. Native and Runner OnlineAgent bindings ignore wake-up input and return null; unbound conversations retain the existing wake-up path. |
114
120
  | `people.provide(source)` | The application's directory: names, whom to pick from, and who can no longer act (`inactive`: their runners stop). |
115
- | `events.on('agent.removed', listener)` | An agent was archived or deleted (`agentId`, `name` then, `reason`, `byUserId`), after the transaction that withdrew its queued runs commits: the application lets go of the work it gave the agent. The assembling application clears it as executor of unfinished issues (`server/agents/removal.ts`). |
121
+ | `events.on('agent.removed', listener)` | An agent was disabled (`agentId`, `name` then, `reason` `disabled`, `byUserId`), after the transaction that withdrew its queued runs commits: the application lets go of the work it gave the agent. The assembling application clears it as executor of unfinished issues (`server/agents/removal.ts`). |
116
122
  | `events.on('notice', listener)` | People the plugin wants told (`AgentsNotice`: `key`, `type`, `userIds`, `subject`, English `title` and `body`, `params`): runner notices to their owner, `run_secrets_not_allowed` to a run's actor and owner, and `run_request_expired` to its requester. Subjects are `runner`, `run` or `runRequest`; `notice.cleared` names one that no longer holds. |
117
123
  | `jobs.register(kind, registration)` | A kind of build job, for the off-by-default runner build method (see Jobs above). |
118
124
  | `reporting.usage`, `reporting.runFigures`, `reporting.range` | What runs used and cost, grouped by agent, person, `group`, `subject`, day, model, tool or agent `type`, and how the runs of a range went with their usage by type (`usageByType`) and day by day (`daily`: runs by outcome, cost by type), for the application's report pages. The plugin serves usage over HTTP for its usage page (`GET /api/agents/usage`, behind the `usage` page grant; every run for a reader of agents, else the caller's own; `series=true` breaks each day of `daily` down by the grouping). |
@@ -169,11 +175,17 @@ A request settles once, and keeps the work's `fireAt` and `maxAttempts` for its
169
175
 
170
176
  Creating an `auto` request requires that both the source and the responsible may invoke the agent. Repeated enqueues with identical pending work reuse its request without another creation event or a renewed expiry; comparison includes the input snapshot, execution options, subject, thread and both people. Different input or scheduling options remain separate requests.
171
177
 
178
+ ### Locking on the claim path
179
+
180
+ Runners poll together, so anything a poll does per queued candidate is multiplied by the queue and the number of runners. A poll decides from reads which candidates it can take — identity, `fits()`, slots, concurrency and comment consent — and opens a transaction only for the one it is about to claim. The only row lock taken on purpose is the agent row (`lockAgentForClaim`), in that final claim transaction after `fits()` and the cheap checks; the run itself is taken with a guarded `status = 'queued'` update, and 0 rows means another claim or a decision won. PostgreSQL runs at READ COMMITTED, so every statement already reads the latest committed rows: a transaction never needs a no-op self-update to refresh its snapshot, and nothing locks a whole comment chain. Consent decisions settle the request row with a guarded update and then change the chain's runs with guarded updates on their status, so a claim that took a run first makes the decision roll back. Run as me takes the chain's agent rows, in id order, before stopping its runs, the same order claims and enqueues use. A new write or lock on the claim path, the sweeper or a run event handler needs a measured reason; `tests/claim-concurrency.test.ts` counts the writing transactions and lock waits of concurrent polls on PostgreSQL (`pnpm test:db postgres --filter @nocobase/app-plugin-agents -- tests/claim-concurrency.test.ts`).
181
+
172
182
  ## The CLI's commands
173
183
 
184
+ Native agents use the application's CLI for every operation on the management instance hosting their task, identified by the server URL in the CLI's `--help`. Its commands remain bounded by the requesting person's identity and permissions; a refusal must never be bypassed through a browser, HTTP, another identity or a test environment. Within the task's authorized scope, local builds and tests are allowed, as are Playwright, browser and test HTTP requests to an explicitly authorized PR preview or independent test instance identified separately from management, even if both products share a name. Establish the target's host, port, application base path and instance ownership from the task and existing preview information; a different URL alone does not establish independence. Use only the test instance's authorized native authentication, never management run credentials or credential files, and clarify an uncertain target before accessing it outside the CLI. Workspace and tool restrictions still apply. Online agents retain their sandboxed shell and skill tools; this native-agent boundary does not add browser or real build capabilities to their sandbox.
185
+
174
186
  The CLI's commands are the application's API routes: `GET /api/cli/manifest` (`@nocobase/app-server/router`) answers every command the API document describes for the caller, named and shaped by each route's `x-cli` extension, and this plugin tells it who calls (a run by its run token, a person by the application's authentication) and which business actions each holds (`gate.allowed`). A run token is also a credential of the application's authentication (`server/cli/run-credential.ts`): a request carrying it acts for the person who woke the agent, as a scoped session the routes accept only where their security lists `runToken`; the application bounds it by its scope (for example, `server/agents/run-principal.ts`). A route lists `runToken` and gives its `x-cli` an `action` for the commands a run may use.
175
187
 
176
- The plugin's own commands are its routes. A run uses `run self`, `run context` and `conversation title set` (`GET /api/agents/runs/current`, `/current/context`, `PATCH /current/conversation`, action `agents.runs/self`), and a run or a person `agent list` (`GET /api/agents/available`, action `agents.agents/view`: the agents the caller may give work to, with what each is good at and whether it can take work now). The rest are a person's: `agent list-all|get|create|update|archive|restore|delete|copy|history|brief`, `agent action list`, `agent preset list`, `skill …` (with `skill version …` and `skill attachment get|set`), `variable list|set|delete|reveal` and `variable audit list` (positional scope kind and scope), `runtime list|get|update|revoke|delete|work` and `runtime token create`, `model list|check|usage` and `model price get|set`, `service list|create|update|delete|discover|check`, `conversation list|get|create|update|stop|fallback|restore`, `conversation message list|send`, `conversation preferences|settings get|update`, and `run list|get|events|brief|cancel|retry|usage`, `run workspace reset` and `run request list|get|confirm|reject|withdraw|run-as-me`. The runner protocol, the downloads and the browser's helpers (the vocabulary, the people picker, the chat agent picker, starting a conversation from a page, marking one read) stay off the command line. The application's routes and custom commands are the rest.
188
+ The plugin's own commands are its routes. A run uses `run self`, `run context` and `conversation title set` (`GET /api/agents/runs/current`, `/current/context`, `PATCH /current/conversation`, action `agents.runs/self`), and a run or a person `agent list` (`GET /api/agents/available`, action `agents.agents/view`: the agents the caller may give work to, with what each is good at and whether it can take work now). The rest are a person's: `agent list-all|get|update|history|brief`, `agent action list`, `skill …` (with `skill version …` and `skill attachment get|set`), `variable list|set|delete|reveal` and `variable audit list` (positional scope kind and scope), `runtime list|get|update|revoke|delete|work` and `runtime token create`, `model list|check|usage` and `model price get|set`, `service list|create|update|delete|discover|check`, `conversation list|get|create|update|stop`, `conversation message list|send`, `conversation preferences|settings get|update`, `conversation attachment upload|download`, and `run list|get|events|brief|cancel|retry|usage`, `run workspace reset` and `run request list|get|confirm|reject|withdraw|run-as-me`. The runner protocol, the downloads and the browser's helpers (the vocabulary, the people picker, every agent's name, the chat agent picker, starting a conversation from a page, marking one read) stay off the command line. The application's routes and custom commands are the rest.
177
189
 
178
190
  ## Workspace
179
191
 
@@ -189,6 +201,10 @@ Variables and model service keys are sealed with the application's secrets servi
189
201
 
190
202
  ```yaml
191
203
  agents:
204
+ # Optional SDK UI replay across instances; omit for live responses and history only.
205
+ # uiRecovery:
206
+ # namespace: acme:online-ui
207
+ # redis: { host: 127.0.0.1, port: 6379 }
192
208
  cli: # the CLI runs get; named after app.id when left out
193
209
  name: acme
194
210
  credentialFile: .acme/run.json # .<name>/run.json by default
@@ -200,10 +216,7 @@ agents:
200
216
  versions: { acme: 0.1.0 } # pin a product instead of the channel's highest
201
217
  npm: # optional; a product with no tarball in dir is named on npm instead, to callers that understand it
202
218
  nocobase-runner: { package: '@nocobase/agent-runner', version: 1.0.0 } # an exact version, never a range
203
- server: # optional; online agents' runs, which every instance runs itself
204
- enabled: true # false leaves them to the other instances
205
- maxSteps: 16 # model calls an online run may make
206
- consult: { timeoutMs: 120000, tokenBudget: 200000 } # one agent consulting another (ask_agent)
219
+
207
220
  vectors: # optional; vector collections, apart from the application's database
208
221
  store: sqlite-vec # the default; pgvector, or false to turn vectors off
209
222
  path: storage/vectors.sqlite # sqlite-vec's file, relative to the application root
@@ -223,17 +236,17 @@ Model services are not configured here: they are added on the application's page
223
236
 
224
237
  The plugin registers no routes of its own: an application mounts its pages and joins them to the pages of the runner agents do. The assembling application puts them under "Agent team" in its sidebar.
225
238
 
226
- - `@nocobase/app-plugin-agents/client/routes` exports `agentsRoute` (`/agents`, with the `new` dialog and the `:agentId` page), `runtimesRoute` (`/runtimes`, with the `connect` dialog), `skillsRoute` (`/skills`, with `new` and `:skillId`) and `usageRoute` (`/usage`: what runs used and cost over a date range, filtered by group, agent and person and summed by one of the groupings (`?groupBy=`, agent by default), with a daily chart of tokens or cost above the table, stacked by the top five agents or models when grouped by those (the usage route's `series`), its group and subject named and linked by the vocabulary's `groupTitle`, `path` and `groupPath`; for who reads `agents.prices` a "Set prices" header button opens the prices sheet, `?prices=1`: online models by service and model, coding tools by the models their runs report, each tool with its subscription switch and price rules, changed by who manages it; the note on missing prices links to it). Each page renders its own heading, and stands behind a page grant of the same id as its route name (`agents`, `runtimes`, `skills`, `usage`, exported as `PAGES` from `shared/access`); a page grant only opens the page, and what it shows is decided by the admin API on the settings items. It also exports `modelsRoute` (`/models`), which stands behind `agents.services` read instead: the model services (a page header with "Add service", the system default chat model's select, then a table with one row per service: its name and host, provider type, status and a menu to edit it, turn it on or off or delete it; "Add service" and clicking a row open one dialog with a single form saved at once: provider type when adding, name, base URL, the write-only key as a `SecretInput` (`client/components/secret-input.tsx`: a password field whose empty value keeps the saved key), an OpenCode base URL's note on which provider type serves which of its model families (its session header is sent automatically), connection test, models fetched from the provider or added by id and checked, each with its kind, changeable before and after it is checked, and a Test that checks it as that kind, and an on/off switch), changeable by who manages `agents.services`.
239
+ - `@nocobase/app-plugin-agents/client/routes` exports `agentsRoute` (`/agents`), `runtimesRoute` (`/runtimes`, with the `connect` dialog), `skillsRoute` (`/skills`, with `new` and `:skillId`) and `usageRoute` (`/usage`: what runs used and cost over a date range, filtered by group, agent and person and summed by one of the groupings (`?groupBy=`, agent by default), with a daily chart of tokens or cost above the table, stacked by the top five agents or models when grouped by those (the usage route's `series`), its group and subject named and linked by the vocabulary's `groupTitle`, `path` and `groupPath`; for who reads `agents.prices` a "Set prices" header button opens the prices sheet, `?prices=1`: models by service and model, coding tools by the models their runs report, each tool with its subscription switch and price rules, changed by who manages it; the note on missing prices links to it). Each page renders its own heading, and stands behind a page grant of the same id as its route name (`agents`, `runtimes`, `skills`, `usage`, exported as `PAGES` from `shared/access`); a page grant only opens the page, and what it shows is decided by the admin API on the settings items. It also exports `modelsRoute` (`/models`), which stands behind `agents.services` read instead: the model services (a page header with "Add service", then a table with one row per service: its name and host, provider type, status and a menu to edit it, turn it on or off or delete it; "Add service" and clicking a row open one dialog with a single form saved at once: provider type when adding, name, base URL, the write-only key as a `SecretInput` (`client/components/secret-input.tsx`: a password field whose empty value keeps the saved key), an OpenCode base URL's note on which provider type serves which of its model families (its session header is sent automatically), connection test, models fetched from the provider or added by id and checked, each with its kind, changeable before and after it is checked, and a Test that checks it as that kind, and an on/off switch), changeable by who manages `agents.services`.
227
240
  - Runtimes (on `/api/agents/runners`): one overview row per runtime — its name with its system, its state with the slots in use ("Busy 1/1", "Offline · 3 hours ago"), its coding tools by sign-in, personal or team, its runner version (marked "Upgradable" when a newer version of the product it runs as is served, with `nocobase-runner update`, or `<cli> runner update` for a CLI that carries the runner; the runner also updates itself) and when it was last seen — with a "…" menu (Edit, then revoke or delete). A row opens the runtime's sheet: General (name, concurrent runs, personal or team after a warning, and "Allow build jobs" only when the application gives runners jobs, as an application's off-by-default runner build method does), Tools (a switch per reported tool with its version, sign-in and, when the API sent it, its path as small text), Local policy (read only: what its owner's policy on the machine lets it take) and Recent runs (`GET /agents/runners/:runnerId/runs`). Only its owner changes it (the managers of runners only a runner whose owner can no longer act); a manager of runners sees someone else's read only, with revoke or delete as the only menu items. Its owner, the managers of runners and anyone who may use an agent get its host name and its tools' paths from the API, everyone else neither. "Add runtime" asks who it works for (team only for managers of runners), which coding tools it may run (all by default) and its max concurrent runs (1 by default, carried by the token; a runner registered with its own `--slots` keeps that), then shows the one-line install and the `nocobase-runner register` command with a one-time token (copy buttons, expiry), and waits until the runtime connects, then shows the coding tools it reported.
228
- - Agents: the list (type, tools, the default model and how many more, where it runs with the runners online for it, or "on the server" and whether its model is offered, active runs, visibility; a type filter; archived ones on request; agents everyone can use first, the application's own in the order it added them, then the viewer's own (`AgentSummary.owned`), then the ones shared with them, each group by the name shown) and an agent's page, whose header sums it up in one line (type, tool or model, where it runs, free or busy, owner), with four tabs kept in `?tab=`; the new-agent dialog asks for the type first, then the fields of that type (its tools and models, model services and models for an online agent from `GET /api/agents/models`; with none, the agent uses the system default chat model, which the dialog names with a link to change it, or says none is offered). General: basics, avatar and instructions with "Preview full prompt" (a scenario switch among the subject kinds that offer a sample, the application's first and a conversation, `?scenario=` on the API; it shows the system prompt in one, with the agent's own prompt marked at its end, and the first message, all rendered on a made-up subject whose values are marked `[sample]`), and who may use it. Capabilities: the tools and models, a compact ordered list (one header row, then one row per entry) whose first row is the default, with rows added, removed and moved up or down (a runner agent's rows a coding tool, a model typed freely with the tool's common models suggested, and an effort among the tool's; an online agent's rows a model service, a model and an effort, each with a Test button; the new-agent dialog uses the same list), skills, the business capabilities grouped by the application's groups with a description each, and the ones never granted to an agent greyed out with the reason (`AgentActionOption.grantable: false`), and whether it confirms before changing data. Runtime (runner agents only): where it runs (any runner, or named ones, and concurrency) and its environment variables (write-only, revealing them is audited, saved row by row). Editable when the agent says `canEdit`; a bar appears while a tab has unsaved changes and saves them in one request against the revision the page shows, and switching tabs or following a link away asks first. When someone else saved the agent meanwhile, the page reloads and a dialog shows what they changed. History: who changed what and when, long text as a line diff, lists as what was added and removed, variables named without values.
241
+ - Agents (`client/pages/agents`, on `GET /api/agents`): one row per agent discovered from runners, filtered by All, Enabled, To enable and No runner: its name with its tool and model, what it is good at, where it can run now (the team and personal runners online with it, the caller's own counted, with a few of their names; "personal runners only", or when a runner last reported it), its default reasoning effort and its state. For who manages `agents.agents`, a pending agent offers "Fill in and enable" and the others "Edit": one dialog (`agent-dialog.tsx`) with what it is good at (started from the catalog's suggestion in the viewer's language), the effort among those its tool takes, and, when editing, whether it is enabled, saved against the revision it shows. Everyone else reads. Under the table, how to add an agent: connect a runner whose tool has the model. An application that keeps agents of its own composes `RunnerAgentsSection` (from `client/kit`) into its own page instead.
229
242
  - Skills: the library (each skill's name, description, compatibility and whether it holds scripts), and a skill as a directory: its files in a tree beside the selected one (`client/pages/skills/workbench/`), SKILL.md rendered, other text shown, images and PDFs previewed. Editing uses the same workbench: files and folders are created (in a folder chosen from the skill's and the conventional `scripts/`, `references/`, `assets/`), uploaded (also by dropping files onto a folder), renamed and deleted from the tree, never by typing a path; SKILL.md and other Markdown are written beside their preview (in tabs on a narrow pane), with the front matter's problems listed above the source as it is typed. A new skill (`/skills/new`, a covering page) starts from a template of front matter and suggested sections. Versions can be compared with the current one and restored, and the page shows where the skill is attached. When someone saved a version while the editor was open, the draft stays and a banner offers to load the latest version. A scope's default skills list the scripts of the chosen skills, which online agents do not run (`SkillScriptsNotice`).
230
- - The new agent, new skill and variable dialogs ask "Discard unsaved changes?" before closing with input in them (NP-200), through `@nocobase/app-client`'s unsaved-changes guard.
231
- - `@nocobase/app-plugin-agents/client/kit` exports `VariablesSection` and `DefaultSkillsSection` for a scope's settings on the application's pages (`scope` `workdir` or a registered key, with an optional `description`), `useRunnerOptions` for picking the runner a directory is on (with how many runners are `online`), and `useAgentOptions` for picking an agent.
243
+ - The new skill and variable dialogs ask "Discard unsaved changes?" before closing with input in them (NP-200), through `@nocobase/app-client`'s unsaved-changes guard.
244
+ - `@nocobase/app-plugin-agents/client/kit` exports `RunnerAgentsSection` (the Agent page's list, for an application's own page), `VariablesSection` and `DefaultSkillsSection` for a scope's settings on the application's pages (`scope` `workdir` or a registered key, with an optional `description`), `useRunnerOptions` for picking the runner a directory is on (with how many runners are `online`), and `useAgentOptions` for picking an agent.
232
245
  - `@nocobase/app-plugin-agents/client/runs` exports the headless parts of a subject's runs, for the application to present (the assembling application uses the UI Library's `agent-run-history`): `useSubjectRuns` and `useAgentNames`, `useRunWithTranscript` (a run and its transcript, fetched after the last `seq` seen when the run's realtime topic announces events, and polled every five seconds while the run is open), `useStopRun`, `useRetryRun`, `useRunBrief` and `useWorkspaceReset`. Each reads and writes the plugin's shared query cache.
233
246
  - `@nocobase/app-plugin-agents/client/chat` is the agents' chat without its UI. The UI — the panel beside the content area, one conversation as a page, the history and the header, floating and "Ask agent" launchers — is the UI Library's `agent-chat` block (`@nocobase/agent-chat`, installed with `shadcn add @nocobase/agent-chat` into `client/extensions/nocobase-agent-chat/`; its README is `ui-library/registry/agents/agent-chat/README.md` in the NocoBase repository), which the application owns and builds on this entry. What stays here is what has to stay consistent across upgrades: `ChatProvider` around the application's routes (panel state, ⌘J / Ctrl+J, `?chat=<id|new|history>` links, page context, the one subscription to the per-user conversations topic while the chat is available, and optionally `conversationPath`, the application's full-page route of a conversation), `useChatPanel()` (`available` is false without the provider), `chatLinkRoutes(base)` (links under a path the application chooses that open the panel), `useChatContextSource` / `useChatFilterSource` for pages to say what they show, and `ChatExtensionsContext`, with which the application adds items among a conversation's messages (`useTimelineItems`), renders under a message (`renderMessageExtra`), words the news it delivers (`newsText`) and shows a news notice as a card of its own (`renderNews`).
234
247
  - The data hooks `useChatAgents`, `useConversation`, `useConversationMessages` (the newest page first, `loadOlder`, newer messages with `messages?after=<lastSeq>` on each announcement and polled while a run is open, optimistic messages through `dispatch`), `useConversationList(query)` (an infinite query over the viewer's conversations), `useSendMessage`, `useConversationActions` and `useChatApi`, keyed by `chatKeys`; `useLiveRunEvents(runId)` (a run's transcript kept current while it runs) and `useConversationSources()` (where a conversation can start from, translated); the pure models `timelineOrder`, `newConversationAgent`, `noticeText`, `liveStepsView` and `stepLineText`, and `contextChips`, `buildPageContext`, `itemKey`, `selectionPreview`, `filterText` and `SOURCE_ATTRIBUTE` for the context chips; the panel's state helpers (`CHAT_PANEL_STORAGE_KEY`, `CHAT_PARAM`, `CHAT_DOCK_QUERY`, `CHAT_MOBILE_QUERY`, `readPanelState`, `isChatShortcut`, `modifierKeyLabel`); `ChatPanelScope`, `useChatPageTracking`, `CHAT_PANEL_ID` and `CHAT_PANEL_ATTRIBUTE` for a full-page view; and the kit's `AgentAvatar`, `useAgentText` and `useFormatters`. The data hooks read and write this plugin's cache (`agentsQueryClient()`) and word their toasts in its namespace whatever is above them, so a chat UI needs only `ChatProvider` and no `withAgents` wrapper. `client/runs` also exports `useRunEvents`, `useRealtimeTopic` and `useAgentsApi`, and `client/kit` exports `useFormatters`.
235
- - `@nocobase/app-plugin-agents/client/profile` exports `DefaultAgentPreference`: the person's default chat agent, for the application's preferences page. The agents page shows the system default chat agent and the online fallback agent (online agents only) at its top, above the list, changed there with a select by who manages `agents.agents` and shown as text to everyone else, and the new-agent dialog starts from a preset (`GET /api/agents/presets`).
236
- - `@nocobase/app-plugin-agents/client/config` exports `AgentActionCatalogContext`: the agent editor's business actions come from the server (`GET /api/agents/actions`: what the application offers, none without it) unless an application gives another catalog.
248
+ - `@nocobase/app-plugin-agents/client/profile` exports `DefaultAgentPreference`: the person's default chat agent, for the application's preferences page. The system default chat agent is the application's to set (`PATCH /api/agents/chatSettings`).
249
+ - `@nocobase/app-plugin-agents/client/config` exports `AgentActionCatalogContext`: the business actions an agent can be given, from the server (`GET /api/agents/actions`: what the application offers, none without it) unless an application gives another catalog. No page of the plugin edits an agent's actions any more; they are the application's defaults.
237
250
 
238
251
  Each exported component brings the plugin's translations and its own query cache, so it works inside another plugin's tree.
239
252
 
@@ -242,3 +255,33 @@ A subject assembly may return `inputs` to select the effective claim inputs. Use
242
255
  ### Scoped work summaries
243
256
 
244
257
  `agents.runs.workingOn(subjectKind, subjectIds)` returns each subject/agent pair with a `dispatched` or `running` run once, as `{ subjectId, agentId, working: true }`. Empty scopes return nothing. Reads are restricted to the supplied kind and IDs, without the workload board's global limit; queued and terminal runs are excluded. This service exposes no run details and does not enforce viewer permissions or approval rules: the consuming application must filter visible subjects first and apply its own waiting rules.
258
+
259
+ ## Team default skills
260
+
261
+ Managers can change global attachment from the skill editor, independently of saving a content version. `SkillSettingsContext` from `client/config` accepts an optional host component with `skillId` for application-owned defaults; `SkillMountToggle` supplies the same immediate-save list membership control. Applications can provide `ScopeKind.describe(scopeIds, userId, keyScope)` to resolve visible names and internal links in a batch on skill detail responses, preserving the credential's action and object limits when a key scope is supplied. Omitted or invisible targets retain a neutral placeholder; this callback is never used when resolving run skills.
262
+
263
+ Attach skills to `global default` to include them in every new run. The fixed scope ID is `default`; other IDs are refused. Global reads require `agents.agents` read or manage, and writes require manage. Use `nb-studio skill attachment get global default` and `nb-studio skill attachment set global default --skills <id>,<id>`; pass a JSON file containing `{ "skillIds": [] }` with `--file` to clear defaults. Registered application scopes and working directories retain their own access policies.
264
+
265
+ Runs resolve skills in global → application scopes → workdir order, with the later target winning a shared slug. Resolution reads attachment and current-version metadata with one joined query, without reading file bodies. Missing current versions still fail. Effective skills feed the existing fingerprint and workspace preparation; clearing global attachments affects later claims. Agent skill attachments are no longer accepted, read or shown; existing rows remain stored. Agent variables and CLI-packaged skills retain their existing behavior. The global name is reserved for skills and is unavailable to variables or application scope registration.
266
+
267
+ ## Run process data retention
268
+
269
+ Set `agents.runs.retentionDays` in the application's `config.yml` to a non-negative integer (default `14`); `0` disables cleanup. Invalid values fail configuration validation. The independent `RunDataPurge` job runs hourly and deletes only events and prompt snapshots belonging to completed, failed or cancelled runs whose `finishedAt` is strictly earlier than the fixed cutoff for that round. Run records, summaries, inputs, usage, repositories, chat messages, comments and deliveries remain available.
270
+
271
+ Each batch selects up to 200 runs with events or briefs, ordered by finish time and ID, then deletes both child tables in one transaction using their existing run ID indexes. Batches pause for 100 ms; a round handles at most 2,000 runs and stops starting batches after five minutes. There are no run locks, run updates, new fields, indexes or migrations. Cleanup is idempotent. Deletion makes database space reusable; it does not immediately shrink database files.
272
+
273
+ Multi-instance deployments must set `jobs.default: redis` with a shared Redis connection and namespace so the existing jobs scheduler claims each firing on one instance. Memory jobs and the in-process timer fallback when no jobs service is installed serve single-instance deployments. No additional distributed lock or exactly-once ledger is introduced.
274
+
275
+ Studio publishes `agents.runs.retentionDays` through its existing public configuration. The process view displays a retention notice only for an expired terminal run with a complete empty transcript and no brief. This uses the current retention rule, rather than a historical cleanup marker; changing or disabling the policy changes the inferred notice. Run, event and brief API contracts are unchanged.
276
+
277
+ ## Runtime quotas and detail tabs
278
+
279
+ Runtime quota marks share `unavailableModels` with model availability marks and use internal `quotaRevision` conditional writes. Known reset times restore eligibility automatically and cannot be cleared manually. Unknown limits remain until the owner or a runtime administrator clears the selected mark. Expiry and clearing never revive terminal runs or extend queue deadlines.
280
+
281
+ Usage snapshots are saved when usage changes by at least five percentage points, crosses the near-limit threshold, or changes window state. Only mark changes broadcast `runner.changed`. Quota reports use the existing events/fail transaction; ordinary heartbeats and claims add no queries, writes or locks. Final failures read only accepted quota-event metadata for deduplication, retaining the complete failure snapshot. New event sequences and new runs can mark exhaustion again.
282
+
283
+ The runtime list omits model catalogs, policy, variables, quota details and load; `takes` contains at most three entries with `takesCount`. Runtime get returns Overview and workspace totals without directory rows. Its recent-run count uses a bounded ten-row read. Workspace sizes and category counts reuse the directory snapshot already read. `GET /agents/runners/:runnerId/workspaces` accepts `status`, `page` and `pageSize` and returns directory rows in `data`, with totals and paging in `meta`. Recent runs load from `/runs` only when that tab opens.
284
+
285
+ `POST /agents/runners/:runnerId/quota/clear` takes structured `tool`, `scope`, `target` and `window` fields, without a client revision. The server rereads state transactionally and removes only that target, idempotently. A known reset returns `409 CONFLICT`; a concurrent conditional-write race returns `409 REVISION_CONFLICT`. Only revision races are retryable. Clear checks ownership or `agents.runners/manage` independently of edit permission. Owner notices include the triggering run and issue identifiers; `notice.cleared` names the selected quota key so applications settle only that notice group.
286
+
287
+ Applications can call `useAgentOption(id)` from the client kit for a system executor's viewer-scoped availability, rather than listing only discovered runner agents. The shared cache refreshes at quota reset or runtime changes.