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

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 (649) hide show
  1. package/CHANGELOG.md +398 -0
  2. package/README.md +129 -67
  3. package/dist/client/api/client.d.ts +25 -17
  4. package/dist/client/api/client.d.ts.map +1 -1
  5. package/dist/client/api/client.js +29 -27
  6. package/dist/client/api/client.js.map +1 -1
  7. package/dist/client/api/keys.d.ts +1 -1
  8. package/dist/client/api/keys.d.ts.map +1 -1
  9. package/dist/client/api/keys.js +1 -1
  10. package/dist/client/api/keys.js.map +1 -1
  11. package/dist/client/chat/api.d.ts +2 -7
  12. package/dist/client/chat/api.d.ts.map +1 -1
  13. package/dist/client/chat/api.js +0 -7
  14. package/dist/client/chat/api.js.map +1 -1
  15. package/dist/client/chat/consultation-identity.d.ts +7 -0
  16. package/dist/client/chat/consultation-identity.d.ts.map +1 -0
  17. package/dist/client/chat/consultation-identity.js +39 -0
  18. package/dist/client/chat/consultation-identity.js.map +1 -0
  19. package/dist/client/chat/message-model.d.ts +4 -2
  20. package/dist/client/chat/message-model.d.ts.map +1 -1
  21. package/dist/client/chat/message-model.js +28 -3
  22. package/dist/client/chat/message-model.js.map +1 -1
  23. package/dist/client/chat/use-chat.d.ts +2 -10
  24. package/dist/client/chat/use-chat.d.ts.map +1 -1
  25. package/dist/client/chat/use-chat.js +3 -10
  26. package/dist/client/chat/use-chat.js.map +1 -1
  27. package/dist/client/chat.d.ts +4 -1
  28. package/dist/client/chat.d.ts.map +1 -1
  29. package/dist/client/chat.js +3 -0
  30. package/dist/client/chat.js.map +1 -1
  31. package/dist/client/components/agent-picker.d.ts +6 -23
  32. package/dist/client/components/agent-picker.d.ts.map +1 -1
  33. package/dist/client/components/agent-picker.js +19 -39
  34. package/dist/client/components/agent-picker.js.map +1 -1
  35. package/dist/client/components/variables/variable-dialogs.d.ts +6 -1
  36. package/dist/client/components/variables/variable-dialogs.d.ts.map +1 -1
  37. package/dist/client/components/variables/variable-dialogs.js +27 -11
  38. package/dist/client/components/variables/variable-dialogs.js.map +1 -1
  39. package/dist/client/components/variables/variables-panel.d.ts.map +1 -1
  40. package/dist/client/components/variables/variables-panel.js +9 -2
  41. package/dist/client/components/variables/variables-panel.js.map +1 -1
  42. package/dist/client/hooks/use-agent-picker-labels.d.ts.map +1 -1
  43. package/dist/client/hooks/use-agent-picker-labels.js +3 -12
  44. package/dist/client/hooks/use-agent-picker-labels.js.map +1 -1
  45. package/dist/client/kit.d.ts +9 -12
  46. package/dist/client/kit.d.ts.map +1 -1
  47. package/dist/client/kit.js +12 -14
  48. package/dist/client/kit.js.map +1 -1
  49. package/dist/client/lib/agents.d.ts +5 -13
  50. package/dist/client/lib/agents.d.ts.map +1 -1
  51. package/dist/client/lib/agents.js +17 -32
  52. package/dist/client/lib/agents.js.map +1 -1
  53. package/dist/client/lib/install.js +1 -1
  54. package/dist/client/locales/chat.en-US.d.ts +9 -22
  55. package/dist/client/locales/chat.en-US.d.ts.map +1 -1
  56. package/dist/client/locales/chat.en-US.js +13 -25
  57. package/dist/client/locales/chat.en-US.js.map +1 -1
  58. package/dist/client/locales/chat.zh-CN.d.ts.map +1 -1
  59. package/dist/client/locales/chat.zh-CN.js +10 -22
  60. package/dist/client/locales/chat.zh-CN.js.map +1 -1
  61. package/dist/client/locales/en-US.d.ts +101 -219
  62. package/dist/client/locales/en-US.d.ts.map +1 -1
  63. package/dist/client/locales/en-US.js +106 -219
  64. package/dist/client/locales/en-US.js.map +1 -1
  65. package/dist/client/locales/runWait.en-US.d.ts +38 -0
  66. package/dist/client/locales/runWait.en-US.d.ts.map +1 -0
  67. package/dist/client/locales/runWait.en-US.js +37 -0
  68. package/dist/client/locales/runWait.en-US.js.map +1 -0
  69. package/dist/client/locales/runWait.zh-CN.d.ts +5 -0
  70. package/dist/client/locales/runWait.zh-CN.d.ts.map +1 -0
  71. package/dist/client/locales/runWait.zh-CN.js +32 -0
  72. package/dist/client/locales/runWait.zh-CN.js.map +1 -0
  73. package/dist/client/locales/runtimes.en-US.d.ts +54 -0
  74. package/dist/client/locales/runtimes.en-US.d.ts.map +1 -1
  75. package/dist/client/locales/runtimes.en-US.js +57 -3
  76. package/dist/client/locales/runtimes.en-US.js.map +1 -1
  77. package/dist/client/locales/runtimes.zh-CN.d.ts.map +1 -1
  78. package/dist/client/locales/runtimes.zh-CN.js +57 -3
  79. package/dist/client/locales/runtimes.zh-CN.js.map +1 -1
  80. package/dist/client/locales/skills.en-US.d.ts +1 -0
  81. package/dist/client/locales/skills.en-US.d.ts.map +1 -1
  82. package/dist/client/locales/skills.en-US.js +2 -1
  83. package/dist/client/locales/skills.en-US.js.map +1 -1
  84. package/dist/client/locales/skills.zh-CN.d.ts.map +1 -1
  85. package/dist/client/locales/skills.zh-CN.js +2 -1
  86. package/dist/client/locales/skills.zh-CN.js.map +1 -1
  87. package/dist/client/locales/zh-CN.d.ts.map +1 -1
  88. package/dist/client/locales/zh-CN.js +108 -221
  89. package/dist/client/locales/zh-CN.js.map +1 -1
  90. package/dist/client/online/services.d.ts.map +1 -1
  91. package/dist/client/online/services.js +5 -6
  92. package/dist/client/online/services.js.map +1 -1
  93. package/dist/client/pages/agents/agent-dialog.d.ts +9 -0
  94. package/dist/client/pages/agents/agent-dialog.d.ts.map +1 -0
  95. package/dist/client/pages/agents/agent-dialog.js +106 -0
  96. package/dist/client/pages/agents/agent-dialog.js.map +1 -0
  97. package/dist/client/pages/agents/agent-state.d.ts +11 -0
  98. package/dist/client/pages/agents/agent-state.d.ts.map +1 -0
  99. package/dist/client/pages/agents/agent-state.js +28 -0
  100. package/dist/client/pages/agents/agent-state.js.map +1 -0
  101. package/dist/client/pages/agents/index.d.ts +1 -1
  102. package/dist/client/pages/agents/index.d.ts.map +1 -1
  103. package/dist/client/pages/agents/index.js +6 -100
  104. package/dist/client/pages/agents/index.js.map +1 -1
  105. package/dist/client/pages/agents/runner-agents.d.ts +3 -0
  106. package/dist/client/pages/agents/runner-agents.d.ts.map +1 -0
  107. package/dist/client/pages/agents/runner-agents.js +172 -0
  108. package/dist/client/pages/agents/runner-agents.js.map +1 -0
  109. package/dist/client/pages/runtimes/connect.js +1 -1
  110. package/dist/client/pages/runtimes/connect.js.map +1 -1
  111. package/dist/client/pages/runtimes/index.d.ts.map +1 -1
  112. package/dist/client/pages/runtimes/index.js +3 -2
  113. package/dist/client/pages/runtimes/index.js.map +1 -1
  114. package/dist/client/pages/runtimes/runner-cells.d.ts +1 -1
  115. package/dist/client/pages/runtimes/runner-cells.d.ts.map +1 -1
  116. package/dist/client/pages/runtimes/runner-cells.js +4 -1
  117. package/dist/client/pages/runtimes/runner-cells.js.map +1 -1
  118. package/dist/client/pages/runtimes/runner-sheet.d.ts.map +1 -1
  119. package/dist/client/pages/runtimes/runner-sheet.js +12 -3
  120. package/dist/client/pages/runtimes/runner-sheet.js.map +1 -1
  121. package/dist/client/pages/runtimes/workspace-diagnostics.d.ts +9 -0
  122. package/dist/client/pages/runtimes/workspace-diagnostics.d.ts.map +1 -0
  123. package/dist/client/pages/runtimes/workspace-diagnostics.js +68 -0
  124. package/dist/client/pages/runtimes/workspace-diagnostics.js.map +1 -0
  125. package/dist/client/pages/skills/detail/index.d.ts.map +1 -1
  126. package/dist/client/pages/skills/detail/index.js +7 -10
  127. package/dist/client/pages/skills/detail/index.js.map +1 -1
  128. package/dist/client/pages/skills/index.d.ts.map +1 -1
  129. package/dist/client/pages/skills/index.js +2 -2
  130. package/dist/client/pages/skills/index.js.map +1 -1
  131. package/dist/client/pages/usage/index.js +2 -2
  132. package/dist/client/pages/usage/index.js.map +1 -1
  133. package/dist/client/profile/default-agent.d.ts.map +1 -1
  134. package/dist/client/profile/default-agent.js +2 -4
  135. package/dist/client/profile/default-agent.js.map +1 -1
  136. package/dist/client/routes.d.ts +1 -1
  137. package/dist/client/routes.d.ts.map +1 -1
  138. package/dist/client/routes.js +1 -13
  139. package/dist/client/routes.js.map +1 -1
  140. package/dist/client/runs/format-wait.d.ts +21 -0
  141. package/dist/client/runs/format-wait.d.ts.map +1 -0
  142. package/dist/client/runs/format-wait.js +90 -0
  143. package/dist/client/runs/format-wait.js.map +1 -0
  144. package/dist/client/runs/subject-runs.d.ts +5 -0
  145. package/dist/client/runs/subject-runs.d.ts.map +1 -1
  146. package/dist/client/runs/subject-runs.js +13 -7
  147. package/dist/client/runs/subject-runs.js.map +1 -1
  148. package/dist/client/runs.d.ts +3 -1
  149. package/dist/client/runs.d.ts.map +1 -1
  150. package/dist/client/runs.js +3 -1
  151. package/dist/client/runs.js.map +1 -1
  152. package/dist/database/migrations/.manifest.json +62 -2
  153. package/dist/database/migrations/202610020003_ag_create_runs.d.ts.map +1 -1
  154. package/dist/database/migrations/202610020003_ag_create_runs.js +0 -1
  155. package/dist/database/migrations/202610020003_ag_create_runs.js.map +1 -1
  156. package/dist/database/migrations/202610090001_ag_add_team_runner_variables.d.ts +9 -0
  157. package/dist/database/migrations/202610090001_ag_add_team_runner_variables.d.ts.map +1 -0
  158. package/dist/database/migrations/202610090001_ag_add_team_runner_variables.js +28 -0
  159. package/dist/database/migrations/202610090001_ag_add_team_runner_variables.js.map +1 -0
  160. package/dist/database/migrations/202610090002_ag_create_run_requests.d.ts +10 -0
  161. package/dist/database/migrations/202610090002_ag_create_run_requests.d.ts.map +1 -0
  162. package/dist/database/migrations/202610090002_ag_create_run_requests.js +105 -0
  163. package/dist/database/migrations/202610090002_ag_create_run_requests.js.map +1 -0
  164. package/dist/database/migrations/202610090003_ag_add_execution_history.d.ts +4 -0
  165. package/dist/database/migrations/202610090003_ag_add_execution_history.d.ts.map +1 -0
  166. package/dist/database/migrations/202610090003_ag_add_execution_history.js +17 -0
  167. package/dist/database/migrations/202610090003_ag_add_execution_history.js.map +1 -0
  168. package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.d.ts +9 -0
  169. package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.d.ts.map +1 -0
  170. package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.js +22 -0
  171. package/dist/database/migrations/202610090004_ag_add_runner_workspace_usage.js.map +1 -0
  172. package/dist/database/migrations/202610090005_ag_add_runner_variables.d.ts +10 -0
  173. package/dist/database/migrations/202610090005_ag_add_runner_variables.d.ts.map +1 -0
  174. package/dist/database/migrations/202610090005_ag_add_runner_variables.js +36 -0
  175. package/dist/database/migrations/202610090005_ag_add_runner_variables.js.map +1 -0
  176. package/dist/database/migrations/202610100001_ag_index_run_event_types.d.ts +4 -0
  177. package/dist/database/migrations/202610100001_ag_index_run_event_types.d.ts.map +1 -0
  178. package/dist/database/migrations/202610100001_ag_index_run_event_types.js +17 -0
  179. package/dist/database/migrations/202610100001_ag_index_run_event_types.js.map +1 -0
  180. package/dist/database/migrations/202610100002_ag_add_run_git_credentials.d.ts +9 -0
  181. package/dist/database/migrations/202610100002_ag_add_run_git_credentials.d.ts.map +1 -0
  182. package/dist/database/migrations/202610100002_ag_add_run_git_credentials.js +30 -0
  183. package/dist/database/migrations/202610100002_ag_add_run_git_credentials.js.map +1 -0
  184. package/dist/database/migrations/202610110001_ag_add_fresh_sessions.d.ts +4 -0
  185. package/dist/database/migrations/202610110001_ag_add_fresh_sessions.d.ts.map +1 -0
  186. package/dist/database/migrations/202610110001_ag_add_fresh_sessions.js +23 -0
  187. package/dist/database/migrations/202610110001_ag_add_fresh_sessions.js.map +1 -0
  188. package/dist/database/migrations/202610120001_ag_index_run_retries.d.ts +4 -0
  189. package/dist/database/migrations/202610120001_ag_index_run_retries.d.ts.map +1 -0
  190. package/dist/database/migrations/202610120001_ag_index_run_retries.js +17 -0
  191. package/dist/database/migrations/202610120001_ag_index_run_retries.js.map +1 -0
  192. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.d.ts +4 -0
  193. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.d.ts.map +1 -0
  194. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.js +50 -0
  195. package/dist/database/migrations/202610120002_ag_add_queue_entered_at.js.map +1 -0
  196. package/dist/database/migrations/202610240020_ag_runner_agents.d.ts +4 -0
  197. package/dist/database/migrations/202610240020_ag_runner_agents.d.ts.map +1 -0
  198. package/dist/database/migrations/202610240020_ag_runner_agents.js +115 -0
  199. package/dist/database/migrations/202610240020_ag_runner_agents.js.map +1 -0
  200. package/dist/database/migrations/202610240040_ag_discovery_preferences.d.ts +4 -0
  201. package/dist/database/migrations/202610240040_ag_discovery_preferences.d.ts.map +1 -0
  202. package/dist/database/migrations/202610240040_ag_discovery_preferences.js +18 -0
  203. package/dist/database/migrations/202610240040_ag_discovery_preferences.js.map +1 -0
  204. package/dist/database/migrations/202610250001_ag_comment_runner_consent.d.ts +4 -0
  205. package/dist/database/migrations/202610250001_ag_comment_runner_consent.d.ts.map +1 -0
  206. package/dist/database/migrations/202610250001_ag_comment_runner_consent.js +41 -0
  207. package/dist/database/migrations/202610250001_ag_comment_runner_consent.js.map +1 -0
  208. package/dist/database/migrations/202610260001_ag_drop_directory_index.d.ts +4 -0
  209. package/dist/database/migrations/202610260001_ag_drop_directory_index.d.ts.map +1 -0
  210. package/dist/database/migrations/202610260001_ag_drop_directory_index.js +24 -0
  211. package/dist/database/migrations/202610260001_ag_drop_directory_index.js.map +1 -0
  212. package/dist/database/migrations/202610260001_ag_run_revision.d.ts +4 -0
  213. package/dist/database/migrations/202610260001_ag_run_revision.d.ts.map +1 -0
  214. package/dist/database/migrations/202610260001_ag_run_revision.js +19 -0
  215. package/dist/database/migrations/202610260001_ag_run_revision.js.map +1 -0
  216. package/dist/package.json +8 -10
  217. package/dist/server/cli/run-credential.js +1 -1
  218. package/dist/server/composition.d.ts +41 -37
  219. package/dist/server/composition.d.ts.map +1 -1
  220. package/dist/server/composition.js +66 -66
  221. package/dist/server/composition.js.map +1 -1
  222. package/dist/server/core/agents/agent.service.d.ts +51 -43
  223. package/dist/server/core/agents/agent.service.d.ts.map +1 -1
  224. package/dist/server/core/agents/agent.service.js +342 -317
  225. package/dist/server/core/agents/agent.service.js.map +1 -1
  226. package/dist/server/core/agents/agent.store.d.ts +24 -12
  227. package/dist/server/core/agents/agent.store.d.ts.map +1 -1
  228. package/dist/server/core/agents/agent.store.js +64 -66
  229. package/dist/server/core/agents/agent.store.js.map +1 -1
  230. package/dist/server/core/agents/agent.views.d.ts +29 -0
  231. package/dist/server/core/agents/agent.views.d.ts.map +1 -0
  232. package/dist/server/core/agents/agent.views.js +86 -0
  233. package/dist/server/core/agents/agent.views.js.map +1 -0
  234. package/dist/server/core/agents/discovery.d.ts +12 -0
  235. package/dist/server/core/agents/discovery.d.ts.map +1 -0
  236. package/dist/server/core/agents/discovery.js +39 -0
  237. package/dist/server/core/agents/discovery.js.map +1 -0
  238. package/dist/server/core/agents/index.d.ts +2 -1
  239. package/dist/server/core/agents/index.d.ts.map +1 -1
  240. package/dist/server/core/agents/index.js +2 -1
  241. package/dist/server/core/agents/index.js.map +1 -1
  242. package/dist/server/core/brief/brief.js +1 -1
  243. package/dist/server/core/brief/brief.js.map +1 -1
  244. package/dist/server/core/callers/index.d.ts +1 -1
  245. package/dist/server/core/conversations/availability.d.ts +11 -10
  246. package/dist/server/core/conversations/availability.d.ts.map +1 -1
  247. package/dist/server/core/conversations/availability.js +14 -32
  248. package/dist/server/core/conversations/availability.js.map +1 -1
  249. package/dist/server/core/conversations/chat-settings.d.ts.map +1 -1
  250. package/dist/server/core/conversations/chat-settings.js +5 -3
  251. package/dist/server/core/conversations/chat-settings.js.map +1 -1
  252. package/dist/server/core/conversations/conversation.service.d.ts +3 -5
  253. package/dist/server/core/conversations/conversation.service.d.ts.map +1 -1
  254. package/dist/server/core/conversations/conversation.service.js +161 -221
  255. package/dist/server/core/conversations/conversation.service.js.map +1 -1
  256. package/dist/server/core/conversations/ports.d.ts +3 -17
  257. package/dist/server/core/conversations/ports.d.ts.map +1 -1
  258. package/dist/server/core/reports/report.service.d.ts.map +1 -1
  259. package/dist/server/core/reports/report.service.js +5 -2
  260. package/dist/server/core/reports/report.service.js.map +1 -1
  261. package/dist/server/core/runs/availability.d.ts +18 -7
  262. package/dist/server/core/runs/availability.d.ts.map +1 -1
  263. package/dist/server/core/runs/availability.js +35 -24
  264. package/dist/server/core/runs/availability.js.map +1 -1
  265. package/dist/server/core/runs/claim.d.ts +47 -67
  266. package/dist/server/core/runs/claim.d.ts.map +1 -1
  267. package/dist/server/core/runs/claim.js +805 -313
  268. package/dist/server/core/runs/claim.js.map +1 -1
  269. package/dist/server/core/runs/comment-consent.d.ts +24 -0
  270. package/dist/server/core/runs/comment-consent.d.ts.map +1 -0
  271. package/dist/server/core/runs/comment-consent.js +116 -0
  272. package/dist/server/core/runs/comment-consent.js.map +1 -0
  273. package/dist/server/core/runs/eligibility.d.ts +51 -0
  274. package/dist/server/core/runs/eligibility.d.ts.map +1 -0
  275. package/dist/server/core/runs/eligibility.js +44 -0
  276. package/dist/server/core/runs/eligibility.js.map +1 -0
  277. package/dist/server/core/runs/execution-view.d.ts +10 -0
  278. package/dist/server/core/runs/execution-view.d.ts.map +1 -0
  279. package/dist/server/core/runs/execution-view.js +25 -0
  280. package/dist/server/core/runs/execution-view.js.map +1 -0
  281. package/dist/server/core/runs/execution.d.ts +13 -0
  282. package/dist/server/core/runs/execution.d.ts.map +1 -0
  283. package/dist/server/core/runs/execution.js +85 -0
  284. package/dist/server/core/runs/execution.js.map +1 -0
  285. package/dist/server/core/runs/extensions.d.ts +59 -4
  286. package/dist/server/core/runs/extensions.d.ts.map +1 -1
  287. package/dist/server/core/runs/extensions.js +45 -9
  288. package/dist/server/core/runs/extensions.js.map +1 -1
  289. package/dist/server/core/runs/git-credentials.d.ts +43 -0
  290. package/dist/server/core/runs/git-credentials.d.ts.map +1 -0
  291. package/dist/server/core/runs/git-credentials.js +129 -0
  292. package/dist/server/core/runs/git-credentials.js.map +1 -0
  293. package/dist/server/core/runs/identity.d.ts +9 -0
  294. package/dist/server/core/runs/identity.d.ts.map +1 -0
  295. package/dist/server/core/runs/identity.js +75 -0
  296. package/dist/server/core/runs/identity.js.map +1 -0
  297. package/dist/server/core/runs/index.d.ts +9 -5
  298. package/dist/server/core/runs/index.d.ts.map +1 -1
  299. package/dist/server/core/runs/index.js +9 -5
  300. package/dist/server/core/runs/index.js.map +1 -1
  301. package/dist/server/core/runs/input-gate.d.ts +34 -0
  302. package/dist/server/core/runs/input-gate.d.ts.map +1 -0
  303. package/dist/server/core/runs/input-gate.js +58 -0
  304. package/dist/server/core/runs/input-gate.js.map +1 -0
  305. package/dist/server/core/runs/lifecycle.d.ts +9 -19
  306. package/dist/server/core/runs/lifecycle.d.ts.map +1 -1
  307. package/dist/server/core/runs/lifecycle.js +98 -50
  308. package/dist/server/core/runs/lifecycle.js.map +1 -1
  309. package/dist/server/core/runs/policy.d.ts +8 -0
  310. package/dist/server/core/runs/policy.d.ts.map +1 -1
  311. package/dist/server/core/runs/policy.js +10 -0
  312. package/dist/server/core/runs/policy.js.map +1 -1
  313. package/dist/server/core/runs/ports.d.ts +91 -28
  314. package/dist/server/core/runs/ports.d.ts.map +1 -1
  315. package/dist/server/core/runs/ports.js +2 -13
  316. package/dist/server/core/runs/ports.js.map +1 -1
  317. package/dist/server/core/runs/preview.d.ts.map +1 -1
  318. package/dist/server/core/runs/preview.js +3 -3
  319. package/dist/server/core/runs/preview.js.map +1 -1
  320. package/dist/server/core/runs/run-data-purge.d.ts +15 -0
  321. package/dist/server/core/runs/run-data-purge.d.ts.map +1 -0
  322. package/dist/server/core/runs/run-data-purge.js +82 -0
  323. package/dist/server/core/runs/run-data-purge.js.map +1 -0
  324. package/dist/server/core/runs/run-requests.d.ts +245 -0
  325. package/dist/server/core/runs/run-requests.d.ts.map +1 -0
  326. package/dist/server/core/runs/run-requests.js +543 -0
  327. package/dist/server/core/runs/run-requests.js.map +1 -0
  328. package/dist/server/core/runs/run.service.d.ts +96 -11
  329. package/dist/server/core/runs/run.service.d.ts.map +1 -1
  330. package/dist/server/core/runs/run.service.js +921 -96
  331. package/dist/server/core/runs/run.service.js.map +1 -1
  332. package/dist/server/core/runs/run.store.d.ts +25 -3
  333. package/dist/server/core/runs/run.store.d.ts.map +1 -1
  334. package/dist/server/core/runs/run.store.js +52 -2
  335. package/dist/server/core/runs/run.store.js.map +1 -1
  336. package/dist/server/core/runs/runner-view.d.ts +6 -4
  337. package/dist/server/core/runs/runner-view.d.ts.map +1 -1
  338. package/dist/server/core/runs/runner-view.js +13 -11
  339. package/dist/server/core/runs/runner-view.js.map +1 -1
  340. package/dist/server/core/runs/selection.d.ts +13 -0
  341. package/dist/server/core/runs/selection.d.ts.map +1 -0
  342. package/dist/server/core/runs/selection.js +21 -0
  343. package/dist/server/core/runs/selection.js.map +1 -0
  344. package/dist/server/core/runs/sweeper.d.ts +1 -0
  345. package/dist/server/core/runs/sweeper.d.ts.map +1 -1
  346. package/dist/server/core/runs/sweeper.js +55 -10
  347. package/dist/server/core/runs/sweeper.js.map +1 -1
  348. package/dist/server/core/runs/transitions.d.ts +2 -2
  349. package/dist/server/core/runs/transitions.d.ts.map +1 -1
  350. package/dist/server/core/runs/transitions.js +80 -8
  351. package/dist/server/core/runs/transitions.js.map +1 -1
  352. package/dist/server/core/runs/workload.d.ts +3 -3
  353. package/dist/server/core/runs/workload.d.ts.map +1 -1
  354. package/dist/server/core/runs/workload.js +154 -45
  355. package/dist/server/core/runs/workload.js.map +1 -1
  356. package/dist/server/core/skills/skill.service.d.ts +6 -2
  357. package/dist/server/core/skills/skill.service.d.ts.map +1 -1
  358. package/dist/server/core/skills/skill.service.js +43 -58
  359. package/dist/server/core/skills/skill.service.js.map +1 -1
  360. package/dist/server/core/skills/skill.store.d.ts +14 -0
  361. package/dist/server/core/skills/skill.store.d.ts.map +1 -1
  362. package/dist/server/core/skills/skill.store.js +30 -0
  363. package/dist/server/core/skills/skill.store.js.map +1 -1
  364. package/dist/server/core/variables/index.d.ts +1 -1
  365. package/dist/server/core/variables/index.d.ts.map +1 -1
  366. package/dist/server/core/variables/index.js +1 -1
  367. package/dist/server/core/variables/index.js.map +1 -1
  368. package/dist/server/core/variables/variable.service.d.ts +38 -6
  369. package/dist/server/core/variables/variable.service.d.ts.map +1 -1
  370. package/dist/server/core/variables/variable.service.js +201 -30
  371. package/dist/server/core/variables/variable.service.js.map +1 -1
  372. package/dist/server/distribution/dist.service.d.ts +27 -5
  373. package/dist/server/distribution/dist.service.d.ts.map +1 -1
  374. package/dist/server/distribution/dist.service.js +41 -5
  375. package/dist/server/distribution/dist.service.js.map +1 -1
  376. package/dist/server/distribution/download-tokens.d.ts +1 -1
  377. package/dist/server/distribution/download-tokens.d.ts.map +1 -1
  378. package/dist/server/distribution/download-tokens.js +7 -4
  379. package/dist/server/distribution/download-tokens.js.map +1 -1
  380. package/dist/server/distribution/index.d.ts +11 -3
  381. package/dist/server/distribution/index.d.ts.map +1 -1
  382. package/dist/server/distribution/index.js +31 -8
  383. package/dist/server/distribution/index.js.map +1 -1
  384. package/dist/server/jobs/index.d.ts +1 -1
  385. package/dist/server/jobs/index.d.ts.map +1 -1
  386. package/dist/server/jobs/index.js +1 -1
  387. package/dist/server/jobs/index.js.map +1 -1
  388. package/dist/server/jobs/job.service.d.ts +3 -1
  389. package/dist/server/jobs/job.service.d.ts.map +1 -1
  390. package/dist/server/jobs/job.service.js +11 -3
  391. package/dist/server/jobs/job.service.js.map +1 -1
  392. package/dist/server/jobs/spec.d.ts +4 -0
  393. package/dist/server/jobs/spec.d.ts.map +1 -1
  394. package/dist/server/jobs/spec.js +6 -0
  395. package/dist/server/jobs/spec.js.map +1 -1
  396. package/dist/server/kernel/errors.d.ts +1 -1
  397. package/dist/server/kernel/errors.d.ts.map +1 -1
  398. package/dist/server/kernel/errors.js +1 -0
  399. package/dist/server/kernel/errors.js.map +1 -1
  400. package/dist/server/kernel/events.d.ts +34 -9
  401. package/dist/server/kernel/events.d.ts.map +1 -1
  402. package/dist/server/kernel/events.js.map +1 -1
  403. package/dist/server/kernel/redaction.d.ts +2 -0
  404. package/dist/server/kernel/redaction.d.ts.map +1 -1
  405. package/dist/server/kernel/redaction.js +17 -0
  406. package/dist/server/kernel/redaction.js.map +1 -1
  407. package/dist/server/kernel/scopes.d.ts.map +1 -1
  408. package/dist/server/kernel/scopes.js +3 -1
  409. package/dist/server/kernel/scopes.js.map +1 -1
  410. package/dist/server/online/index.d.ts +0 -5
  411. package/dist/server/online/index.d.ts.map +1 -1
  412. package/dist/server/online/index.js +0 -5
  413. package/dist/server/online/index.js.map +1 -1
  414. package/dist/server/online/routes.d.ts.map +1 -1
  415. package/dist/server/online/routes.js +6 -35
  416. package/dist/server/online/routes.js.map +1 -1
  417. package/dist/server/providers/agents.d.ts +8 -25
  418. package/dist/server/providers/agents.d.ts.map +1 -1
  419. package/dist/server/providers/agents.js +11 -75
  420. package/dist/server/providers/agents.js.map +1 -1
  421. package/dist/server/providers/runners.d.ts.map +1 -1
  422. package/dist/server/providers/runners.js +23 -0
  423. package/dist/server/providers/runners.js.map +1 -1
  424. package/dist/server/routes/admin.d.ts.map +1 -1
  425. package/dist/server/routes/admin.js +158 -209
  426. package/dist/server/routes/admin.js.map +1 -1
  427. package/dist/server/routes/chat.d.ts.map +1 -1
  428. package/dist/server/routes/chat.js +12 -70
  429. package/dist/server/routes/chat.js.map +1 -1
  430. package/dist/server/routes/index.d.ts.map +1 -1
  431. package/dist/server/routes/index.js +11 -1
  432. package/dist/server/routes/index.js.map +1 -1
  433. package/dist/server/routes/roster.d.ts.map +1 -1
  434. package/dist/server/routes/roster.js +6 -21
  435. package/dist/server/routes/roster.js.map +1 -1
  436. package/dist/server/routes/run-requests.d.ts +6 -0
  437. package/dist/server/routes/run-requests.d.ts.map +1 -0
  438. package/dist/server/routes/run-requests.js +216 -0
  439. package/dist/server/routes/run-requests.js.map +1 -0
  440. package/dist/server/routes/runners/admin.d.ts +9 -1
  441. package/dist/server/routes/runners/admin.d.ts.map +1 -1
  442. package/dist/server/routes/runners/admin.js +62 -24
  443. package/dist/server/routes/runners/admin.js.map +1 -1
  444. package/dist/server/routes/runners/dist.d.ts +5 -1
  445. package/dist/server/routes/runners/dist.d.ts.map +1 -1
  446. package/dist/server/routes/runners/dist.js +36 -9
  447. package/dist/server/routes/runners/dist.js.map +1 -1
  448. package/dist/server/routes/runners/install.d.ts.map +1 -1
  449. package/dist/server/routes/runners/install.js +98 -15
  450. package/dist/server/routes/runners/install.js.map +1 -1
  451. package/dist/server/routes/runners/runner.d.ts.map +1 -1
  452. package/dist/server/routes/runners/runner.js +27 -7
  453. package/dist/server/routes/runners/runner.js.map +1 -1
  454. package/dist/server/routes/runners/runs.d.ts +1 -1
  455. package/dist/server/routes/runners/runs.d.ts.map +1 -1
  456. package/dist/server/routes/runners/runs.js +23 -3
  457. package/dist/server/routes/runners/runs.js.map +1 -1
  458. package/dist/server/routes/schemas.d.ts +37 -8
  459. package/dist/server/routes/schemas.d.ts.map +1 -1
  460. package/dist/server/routes/schemas.js +381 -84
  461. package/dist/server/routes/schemas.js.map +1 -1
  462. package/dist/server/runners/index.d.ts +1 -0
  463. package/dist/server/runners/index.d.ts.map +1 -1
  464. package/dist/server/runners/index.js +1 -0
  465. package/dist/server/runners/index.js.map +1 -1
  466. package/dist/server/runners/runner.service.d.ts +32 -8
  467. package/dist/server/runners/runner.service.d.ts.map +1 -1
  468. package/dist/server/runners/runner.service.js +130 -14
  469. package/dist/server/runners/runner.service.js.map +1 -1
  470. package/dist/server/runners/runner.store.d.ts +10 -1
  471. package/dist/server/runners/runner.store.d.ts.map +1 -1
  472. package/dist/server/runners/runner.store.js +117 -4
  473. package/dist/server/runners/runner.store.js.map +1 -1
  474. package/dist/server/runners/sweeper.d.ts +5 -0
  475. package/dist/server/runners/sweeper.d.ts.map +1 -1
  476. package/dist/server/runners/sweeper.js +4 -2
  477. package/dist/server/runners/sweeper.js.map +1 -1
  478. package/dist/server/runners/workspaces.d.ts +33 -0
  479. package/dist/server/runners/workspaces.d.ts.map +1 -0
  480. package/dist/server/runners/workspaces.js +248 -0
  481. package/dist/server/runners/workspaces.js.map +1 -0
  482. package/dist/server/testing.d.ts +0 -2
  483. package/dist/server/testing.d.ts.map +1 -1
  484. package/dist/server/testing.js +1 -4
  485. package/dist/server/testing.js.map +1 -1
  486. package/dist/server/tokens.d.ts +13 -9
  487. package/dist/server/tokens.d.ts.map +1 -1
  488. package/dist/server/tokens.js +7 -2
  489. package/dist/server/tokens.js.map +1 -1
  490. package/dist/shared/access.d.ts +2 -6
  491. package/dist/shared/access.d.ts.map +1 -1
  492. package/dist/shared/access.js +2 -6
  493. package/dist/shared/access.js.map +1 -1
  494. package/dist/shared/agents.d.ts +128 -167
  495. package/dist/shared/agents.d.ts.map +1 -1
  496. package/dist/shared/agents.js +46 -97
  497. package/dist/shared/agents.js.map +1 -1
  498. package/dist/shared/conversations.d.ts +43 -89
  499. package/dist/shared/conversations.d.ts.map +1 -1
  500. package/dist/shared/conversations.js +5 -24
  501. package/dist/shared/conversations.js.map +1 -1
  502. package/dist/shared/model-catalog.d.ts +48 -0
  503. package/dist/shared/model-catalog.d.ts.map +1 -0
  504. package/dist/shared/model-catalog.js +148 -0
  505. package/dist/shared/model-catalog.js.map +1 -0
  506. package/dist/shared/models.js +1 -1
  507. package/dist/shared/models.js.map +1 -1
  508. package/dist/shared/runners.d.ts +107 -17
  509. package/dist/shared/runners.d.ts.map +1 -1
  510. package/dist/shared/runners.js +49 -7
  511. package/dist/shared/runners.js.map +1 -1
  512. package/dist/shared/runs.d.ts +213 -1
  513. package/dist/shared/runs.d.ts.map +1 -1
  514. package/dist/shared/runs.js +24 -0
  515. package/dist/shared/runs.js.map +1 -1
  516. package/dist/shared/skills.d.ts +8 -4
  517. package/dist/shared/skills.d.ts.map +1 -1
  518. package/dist/shared/skills.js +7 -2
  519. package/dist/shared/skills.js.map +1 -1
  520. package/dist/shared/variables.d.ts +22 -0
  521. package/dist/shared/variables.d.ts.map +1 -1
  522. package/dist/shared/variables.js +10 -2
  523. package/dist/shared/variables.js.map +1 -1
  524. package/package.json +24 -26
  525. package/skills/nocobase-app-plugin-agents/SKILL.md +8 -7
  526. package/skills/nocobase-app-plugin-agents/references/agents.md +30 -0
  527. package/skills/nocobase-app-plugin-agents/references/distribution.md +21 -4
  528. package/skills/nocobase-app-plugin-agents/references/extension-points.md +30 -20
  529. package/skills/nocobase-app-plugin-agents/references/model-services.md +17 -0
  530. package/skills/nocobase-app-plugin-agents/references/runners.md +15 -1
  531. package/skills/nocobase-app-plugin-agents/references/setup-and-config.md +4 -7
  532. package/skills/nocobase-app-plugin-agents/references/variables-skills-usage.md +6 -4
  533. package/skills/nocobase-app-plugin-agents/references/verification-and-troubleshooting.md +33 -32
  534. package/dist/client/chat/settings-section.d.ts +0 -5
  535. package/dist/client/chat/settings-section.d.ts.map +0 -1
  536. package/dist/client/chat/settings-section.js +0 -76
  537. package/dist/client/chat/settings-section.js.map +0 -1
  538. package/dist/client/components/agent-fields.d.ts +0 -45
  539. package/dist/client/components/agent-fields.d.ts.map +0 -1
  540. package/dist/client/components/agent-fields.js +0 -83
  541. package/dist/client/components/agent-fields.js.map +0 -1
  542. package/dist/client/components/agent-type.d.ts +0 -32
  543. package/dist/client/components/agent-type.d.ts.map +0 -1
  544. package/dist/client/components/agent-type.js +0 -80
  545. package/dist/client/components/agent-type.js.map +0 -1
  546. package/dist/client/components/model-entries.d.ts +0 -35
  547. package/dist/client/components/model-entries.d.ts.map +0 -1
  548. package/dist/client/components/model-entries.js +0 -82
  549. package/dist/client/components/model-entries.js.map +0 -1
  550. package/dist/client/hooks/use-agent-save.d.ts +0 -9
  551. package/dist/client/hooks/use-agent-save.d.ts.map +0 -1
  552. package/dist/client/hooks/use-agent-save.js +0 -40
  553. package/dist/client/hooks/use-agent-save.js.map +0 -1
  554. package/dist/client/hooks/use-model-catalog.d.ts +0 -9
  555. package/dist/client/hooks/use-model-catalog.d.ts.map +0 -1
  556. package/dist/client/hooks/use-model-catalog.js +0 -27
  557. package/dist/client/hooks/use-model-catalog.js.map +0 -1
  558. package/dist/client/lib/tool-policy.d.ts +0 -5
  559. package/dist/client/lib/tool-policy.d.ts.map +0 -1
  560. package/dist/client/lib/tool-policy.js +0 -10
  561. package/dist/client/lib/tool-policy.js.map +0 -1
  562. package/dist/client/online/default-model.d.ts +0 -5
  563. package/dist/client/online/default-model.d.ts.map +0 -1
  564. package/dist/client/online/default-model.js +0 -65
  565. package/dist/client/online/default-model.js.map +0 -1
  566. package/dist/client/pages/agents/agent-model.d.ts +0 -73
  567. package/dist/client/pages/agents/agent-model.d.ts.map +0 -1
  568. package/dist/client/pages/agents/agent-model.js +0 -172
  569. package/dist/client/pages/agents/agent-model.js.map +0 -1
  570. package/dist/client/pages/agents/detail/brief-preview.d.ts +0 -7
  571. package/dist/client/pages/agents/detail/brief-preview.d.ts.map +0 -1
  572. package/dist/client/pages/agents/detail/brief-preview.js +0 -43
  573. package/dist/client/pages/agents/detail/brief-preview.js.map +0 -1
  574. package/dist/client/pages/agents/detail/history.d.ts +0 -11
  575. package/dist/client/pages/agents/detail/history.d.ts.map +0 -1
  576. package/dist/client/pages/agents/detail/history.js +0 -149
  577. package/dist/client/pages/agents/detail/history.js.map +0 -1
  578. package/dist/client/pages/agents/detail/index.d.ts +0 -3
  579. package/dist/client/pages/agents/detail/index.d.ts.map +0 -1
  580. package/dist/client/pages/agents/detail/index.js +0 -241
  581. package/dist/client/pages/agents/detail/index.js.map +0 -1
  582. package/dist/client/pages/agents/detail/sections.d.ts +0 -22
  583. package/dist/client/pages/agents/detail/sections.d.ts.map +0 -1
  584. package/dist/client/pages/agents/detail/sections.js +0 -311
  585. package/dist/client/pages/agents/detail/sections.js.map +0 -1
  586. package/dist/client/pages/agents/detail/tab-draft.d.ts +0 -43
  587. package/dist/client/pages/agents/detail/tab-draft.d.ts.map +0 -1
  588. package/dist/client/pages/agents/detail/tab-draft.js +0 -115
  589. package/dist/client/pages/agents/detail/tab-draft.js.map +0 -1
  590. package/dist/client/pages/agents/detail/unsaved-bar.d.ts +0 -13
  591. package/dist/client/pages/agents/detail/unsaved-bar.d.ts.map +0 -1
  592. package/dist/client/pages/agents/detail/unsaved-bar.js +0 -21
  593. package/dist/client/pages/agents/detail/unsaved-bar.js.map +0 -1
  594. package/dist/client/pages/agents/new.d.ts +0 -3
  595. package/dist/client/pages/agents/new.d.ts.map +0 -1
  596. package/dist/client/pages/agents/new.js +0 -149
  597. package/dist/client/pages/agents/new.js.map +0 -1
  598. package/dist/client/pages/agents/preset-picker.d.ts +0 -8
  599. package/dist/client/pages/agents/preset-picker.d.ts.map +0 -1
  600. package/dist/client/pages/agents/preset-picker.js +0 -41
  601. package/dist/client/pages/agents/preset-picker.js.map +0 -1
  602. package/dist/server/core/consultations/consultation.service.d.ts +0 -59
  603. package/dist/server/core/consultations/consultation.service.d.ts.map +0 -1
  604. package/dist/server/core/consultations/consultation.service.js +0 -195
  605. package/dist/server/core/consultations/consultation.service.js.map +0 -1
  606. package/dist/server/core/consultations/index.d.ts +0 -3
  607. package/dist/server/core/consultations/index.d.ts.map +0 -1
  608. package/dist/server/core/consultations/index.js +0 -3
  609. package/dist/server/core/consultations/index.js.map +0 -1
  610. package/dist/server/core/consultations/prompt.d.ts +0 -41
  611. package/dist/server/core/consultations/prompt.d.ts.map +0 -1
  612. package/dist/server/core/consultations/prompt.js +0 -64
  613. package/dist/server/core/consultations/prompt.js.map +0 -1
  614. package/dist/server/core/presets/index.d.ts +0 -19
  615. package/dist/server/core/presets/index.d.ts.map +0 -1
  616. package/dist/server/core/presets/index.js +0 -28
  617. package/dist/server/core/presets/index.js.map +0 -1
  618. package/dist/server/online/cli-command.d.ts +0 -20
  619. package/dist/server/online/cli-command.d.ts.map +0 -1
  620. package/dist/server/online/cli-command.js +0 -345
  621. package/dist/server/online/cli-command.js.map +0 -1
  622. package/dist/server/online/consult-tool.d.ts +0 -54
  623. package/dist/server/online/consult-tool.d.ts.map +0 -1
  624. package/dist/server/online/consult-tool.js +0 -177
  625. package/dist/server/online/consult-tool.js.map +0 -1
  626. package/dist/server/online/executor.d.ts +0 -83
  627. package/dist/server/online/executor.d.ts.map +0 -1
  628. package/dist/server/online/executor.js +0 -714
  629. package/dist/server/online/executor.js.map +0 -1
  630. package/dist/server/online/sandbox.d.ts +0 -32
  631. package/dist/server/online/sandbox.d.ts.map +0 -1
  632. package/dist/server/online/sandbox.js +0 -246
  633. package/dist/server/online/sandbox.js.map +0 -1
  634. package/dist/server/online/scripted.d.ts +0 -12
  635. package/dist/server/online/scripted.d.ts.map +0 -1
  636. package/dist/server/online/scripted.js +0 -176
  637. package/dist/server/online/scripted.js.map +0 -1
  638. package/dist/server/online/tools.d.ts +0 -17
  639. package/dist/server/online/tools.d.ts.map +0 -1
  640. package/dist/server/online/tools.js +0 -31
  641. package/dist/server/online/tools.js.map +0 -1
  642. package/dist/server/vendor/THIRD_PARTY_LICENSES.txt +0 -782
  643. package/dist/server/vendor/just-bash.d.ts +0 -83
  644. package/dist/server/vendor/just-bash.js +0 -2102
  645. package/dist/shared/presets.d.ts +0 -30
  646. package/dist/shared/presets.d.ts.map +0 -1
  647. package/dist/shared/presets.js +0 -2
  648. package/dist/shared/presets.js.map +0 -1
  649. package/skills/nocobase-app-plugin-agents/references/online-agents.md +0 -31
@@ -13,7 +13,10 @@
13
13
  *
14
14
  * - Repository access is asked per run (`forRun`, in the claim's transaction) once the run has repositories to check
15
15
  * out. Its credentials are minted in `prepare` (a network call is fine there), handed to the runner in the payload
16
- * and never stored; the claim remembers them as secrets, so nothing the run reports carries them.
16
+ * and never stored; the claim remembers them as secrets, so nothing the run reports carries them. When the runner
17
+ * asks for credentials on demand (the `gitCredentials` feature, `RepoAccessContext.onDemand`), a provider that can
18
+ * `issue` one lists its repositories in `RunGit.onDemand` instead and mints nothing at the claim: the runner asks
19
+ * for each credential whenever git needs one, for as long as it holds the run (`git-credentials.ts`).
17
20
  *
18
21
  * Inside the claim's transaction a provider reads through the claim's connection only: on SQLite that transaction
19
22
  * holds the one connection there is, so anything else (a person's permissions, another plugin's services) would wait
@@ -100,13 +103,63 @@ export interface RepoAccessContext {
100
103
  readonly claim: ClaimContext;
101
104
  /** The run's checkouts, as the runner receives them. */
102
105
  readonly repos: readonly RepoDir[];
106
+ /**
107
+ * Whether the runner asks for credentials on demand (the `gitCredentials` feature). Then a provider that implements
108
+ * `issue` answers `onDemand` with the URLs it issues for, and no `credentials`.
109
+ */
110
+ readonly onDemand: boolean;
111
+ }
112
+ /** What a repository access provider's `prepare` is told besides the run. */
113
+ export interface RepoPrepareOptions {
114
+ /** As `RepoAccessContext.onDemand`: when true, a provider that implements `issue` has nothing to mint now. */
115
+ readonly onDemand: boolean;
116
+ }
117
+ /** A runner asks for the credential of one of its run's on-demand repositories. */
118
+ export interface RepoCredentialRequest {
119
+ /** The run, held by `runnerId` under a live lease: the server checked before asking. */
120
+ readonly run: Run;
121
+ readonly runnerId: string;
122
+ readonly attempt: number;
123
+ /** Exactly as the run's `RepoDir` names it, and listed in `RunGit.onDemand` at the claim. */
124
+ readonly url: string;
125
+ /** The runner's last credential for it was refused by the remote: issue a new one rather than a cached one. */
126
+ readonly refresh: boolean;
127
+ /** Aborted when the server stops waiting (`ISSUE_TIMEOUT_MS`). */
128
+ readonly signal: AbortSignal;
129
+ }
130
+ /** A credential for one repository and when it stops working. */
131
+ export interface RepoCredentialGrant {
132
+ readonly username: string;
133
+ readonly password: string;
134
+ /** RFC 3339, in the future. */
135
+ readonly expiresAt: string;
136
+ }
137
+ /**
138
+ * What a provider throws from `issue` when it cannot give a credential, with a message safe to show the run's people
139
+ * and the agent (no credential, no internal detail): `unavailable` when its code host is down or slow and asking again
140
+ * later may work, `denied` when it will not issue one (no access to the repository, an installation gone).
141
+ */
142
+ export declare class RepoAccessError extends Error {
143
+ name: string;
144
+ readonly kind: 'unavailable' | 'denied';
145
+ constructor(kind: 'unavailable' | 'denied', message: string);
103
146
  }
104
147
  export interface RepoAccessProvider {
105
148
  /** Unique among the providers. */
106
149
  readonly key: string;
107
- readonly prepare?: ExtensionPrepare;
150
+ readonly prepare?: (run: Run, options: RepoPrepareOptions) => Promise<unknown>;
151
+ /** Outside the transaction: revoke credentials prepared for a claim that was not delivered. Required when prepare mints credentials; idempotent. */
152
+ readonly discard?: (run: Run, prepared: unknown) => Promise<void>;
108
153
  /** In the claim's transaction, through its connection: database reads only. Null gives nothing. */
109
154
  forRun(conn: DatabaseConnection, context: RepoAccessContext, prepared: unknown): Promise<RunGit | null>;
155
+ /**
156
+ * Outside any transaction (a network call is fine): a credential for `request.url`, a repository this provider listed
157
+ * in `onDemand`, or null when it is not this provider's. Throws `RepoAccessError` when it cannot issue one. Called
158
+ * whenever the run's git needs a credential the runner does not hold, so a provider decides itself whether to answer
159
+ * from a cache (and for how long a cached credential still has to last) or to issue a new one; with `refresh` it
160
+ * issues a new one.
161
+ */
162
+ readonly issue?: (request: RepoCredentialRequest) => Promise<RepoCredentialGrant | null>;
110
163
  }
111
164
  export interface RepoAccessRegistry {
112
165
  /** Returns what removes the provider. */
@@ -116,7 +169,9 @@ export interface RepoAccessRegistry {
116
169
  export declare function createRepoAccessRegistry(): RepoAccessRegistry;
117
170
  /**
118
171
  * The run's git, from every provider: the first author given, every trailer and credential in order (one credential
119
- * per URL, the first).
172
+ * per URL, the first). With `context.onDemand`, the URLs any provider lists in `onDemand` (only repositories of the
173
+ * run) are asked for on demand, and no credential of the claim is handed out for them; without it, `onDemand` is
174
+ * dropped.
120
175
  */
121
176
  export declare function repoAccessFor(conn: DatabaseConnection, registry: RepoAccessRegistry | undefined, context: RepoAccessContext, prepared: Prepared): Promise<RunGit | null>;
122
177
  /** What the providers prepared for one run, by `section:<key>`, `mount:<name>` and `repo:<key>`. */
@@ -125,5 +180,5 @@ export type Prepared = ReadonlyMap<string, unknown>;
125
180
  * Runs every provider's `prepare` for `run`, outside any transaction. A provider whose preparation fails gets
126
181
  * undefined, and is told so by its own absent answer; the claim goes on.
127
182
  */
128
- export declare function prepareExtensions(run: Run, sections: BriefSectionRegistry | undefined, mounts: RunMountRegistry | undefined, onError?: (error: unknown) => void, repoAccess?: RepoAccessRegistry): Promise<Prepared>;
183
+ export declare function prepareExtensions(run: Run, sections: BriefSectionRegistry | undefined, mounts: RunMountRegistry | undefined, onError?: (error: unknown) => void, repoAccess?: RepoAccessRegistry, repoOptions?: RepoPrepareOptions): Promise<Prepared>;
129
184
  //# sourceMappingURL=extensions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../../server/core/runs/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,QAAQ,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE,iGAAiG;AACjG,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,+EAA+E;IAC/E,OAAO,CACL,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;IACrD,IAAI,IAAI,SAAS,oBAAoB,EAAE,CAAC;CACzC;AAED,w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0CnB"}
@@ -13,7 +13,10 @@
13
13
  *
14
14
  * - Repository access is asked per run (`forRun`, in the claim's transaction) once the run has repositories to check
15
15
  * out. Its credentials are minted in `prepare` (a network call is fine there), handed to the runner in the payload
16
- * and never stored; the claim remembers them as secrets, so nothing the run reports carries them.
16
+ * and never stored; the claim remembers them as secrets, so nothing the run reports carries them. When the runner
17
+ * asks for credentials on demand (the `gitCredentials` feature, `RepoAccessContext.onDemand`), a provider that can
18
+ * `issue` one lists its repositories in `RunGit.onDemand` instead and mints nothing at the claim: the runner asks
19
+ * for each credential whenever git needs one, for as long as it holds the run (`git-credentials.ts`).
17
20
  *
18
21
  * Inside the claim's transaction a provider reads through the claim's connection only: on SQLite that transaction
19
22
  * holds the one connection there is, so anything else (a person's permissions, another plugin's services) would wait
@@ -104,6 +107,19 @@ export async function mountsFor(conn, registry, context, prepared) {
104
107
  }
105
108
  return { mounts, resumeNotes };
106
109
  }
110
+ /**
111
+ * What a provider throws from `issue` when it cannot give a credential, with a message safe to show the run's people
112
+ * and the agent (no credential, no internal detail): `unavailable` when its code host is down or slow and asking again
113
+ * later may work, `denied` when it will not issue one (no access to the repository, an installation gone).
114
+ */
115
+ export class RepoAccessError extends Error {
116
+ name = 'RepoAccessError';
117
+ kind;
118
+ constructor(kind, message) {
119
+ super(message);
120
+ this.kind = kind;
121
+ }
122
+ }
107
123
  export function createRepoAccessRegistry() {
108
124
  const providers = new Map();
109
125
  return {
@@ -121,7 +137,9 @@ export function createRepoAccessRegistry() {
121
137
  }
122
138
  /**
123
139
  * The run's git, from every provider: the first author given, every trailer and credential in order (one credential
124
- * per URL, the first).
140
+ * per URL, the first). With `context.onDemand`, the URLs any provider lists in `onDemand` (only repositories of the
141
+ * run) are asked for on demand, and no credential of the claim is handed out for them; without it, `onDemand` is
142
+ * dropped.
125
143
  */
126
144
  export async function repoAccessFor(conn, registry, context, prepared) {
127
145
  if (context.repos.length === 0)
@@ -129,6 +147,8 @@ export async function repoAccessFor(conn, registry, context, prepared) {
129
147
  let author;
130
148
  const trailers = [];
131
149
  const credentials = new Map();
150
+ const repoUrls = new Set(context.repos.map((repo) => repo.url));
151
+ const onDemand = new Set();
132
152
  for (const provider of registry?.list() ?? []) {
133
153
  const given = await provider.forRun(conn, context, prepared.get(`repo:${provider.key}`));
134
154
  if (!given)
@@ -140,20 +160,30 @@ export async function repoAccessFor(conn, registry, context, prepared) {
140
160
  for (const credential of given.credentials ?? [])
141
161
  if (!credentials.has(credential.url))
142
162
  credentials.set(credential.url, credential);
163
+ if (context.onDemand)
164
+ for (const url of given.onDemand ?? [])
165
+ if (repoUrls.has(url))
166
+ onDemand.add(url);
143
167
  }
144
- if (!author && trailers.length === 0 && credentials.size === 0)
168
+ for (const url of onDemand)
169
+ credentials.delete(url);
170
+ if (!author &&
171
+ trailers.length === 0 &&
172
+ credentials.size === 0 &&
173
+ onDemand.size === 0)
145
174
  return null;
146
175
  return {
147
176
  ...(author ? { author } : {}),
148
177
  ...(trailers.length > 0 ? { trailers } : {}),
149
178
  ...(credentials.size > 0 ? { credentials: [...credentials.values()] } : {}),
179
+ ...(onDemand.size > 0 ? { onDemand: [...onDemand] } : {}),
150
180
  };
151
181
  }
152
182
  /**
153
183
  * Runs every provider's `prepare` for `run`, outside any transaction. A provider whose preparation fails gets
154
184
  * undefined, and is told so by its own absent answer; the claim goes on.
155
185
  */
156
- export async function prepareExtensions(run, sections, mounts, onError, repoAccess) {
186
+ export async function prepareExtensions(run, sections, mounts, onError, repoAccess, repoOptions = { onDemand: false }) {
157
187
  const prepared = new Map();
158
188
  const hooks = [
159
189
  ...(sections?.list() ?? []).flatMap((provider) => provider.prepare
@@ -166,11 +196,17 @@ export async function prepareExtensions(run, sections, mounts, onError, repoAcce
166
196
  [`mount:${provider.name}`, provider.prepare],
167
197
  ]
168
198
  : []),
169
- ...(repoAccess?.list() ?? []).flatMap((provider) => provider.prepare
170
- ? [
171
- [`repo:${provider.key}`, provider.prepare],
172
- ]
173
- : []),
199
+ ...(repoAccess?.list() ?? []).flatMap((provider) => {
200
+ const prepare = provider.prepare;
201
+ return prepare
202
+ ? [
203
+ [
204
+ `repo:${provider.key}`,
205
+ (each) => prepare(each, repoOptions),
206
+ ],
207
+ ]
208
+ : [];
209
+ }),
174
210
  ];
175
211
  for (const [key, prepare] of hooks)
176
212
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../../server/core/runs/extensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,aAAa,GAKd,MAAM,0BAA0B,CAAC;AA8BlC,MAAM,UAAU,0BAA0B;IACxC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC1D,OAAO;QACL,QAAQ,CAAC,QAAQ;YACf,IAAI,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAC7B,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;YACvE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACtC,OAAO,GAAG,EAAE;gBACV,IAAI,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,QAAQ;oBAC1C,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,EAAE,GAAG,EAAE,CACT,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;aACpB,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;aAC/C,IAAI,CACH,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,IAAI,MAAM,CAAC,iBAAiB,CAA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CAAC,EAAE,CACP;QACD,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;YACjC,OAAO,OAAO;gBACZ,CAAC,CAAC;oBACE;wBACE,QAAQ,QAAQ,CAAC,GAAG,EAAE;wBACtB,CAAC,IAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC;qBACZ;iBAChC;gBACH,CAAC,CAAC,EAAE,CAAC;QACT,CAAC,CAAC;KACH,CAAC;IACF,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,KAAK;QAChC,IAAI,CAAC;YACH,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Repository credentials on demand (`RUNNER_ROUTES.gitCredential`, the `gitCredentials` feature): a runner asks for the
3
+ * credential of one of its run's repositories whenever git needs one, instead of keeping the one a claim handed out
4
+ * for the whole run, which a long run outlives.
5
+ *
6
+ * The answer is given only while the asking runner holds the run (`reports.holds`), for the attempt it names, under a
7
+ * lease that has not run out, and for a URL the claim listed in `RunGit.onDemand` (`agRuns.gitCredentialUrls`),
8
+ * compared exactly: case, a trailing `.git` and anything else the runner sends must match what it was given. Anything
9
+ * else is refused, so a run that ended, went back to the queue or was taken by another attempt gets nothing.
10
+ *
11
+ * The application issues the credential (`RepoAccessProvider.issue`), outside any transaction, within
12
+ * `ISSUE_TIMEOUT_MS`; whether a cached one is still good enough is its decision. Every credential handed out is added
13
+ * to the run's remembered secrets, so what the run reports afterwards is redacted of it too. A failure is answered
14
+ * with a reason the runner can act on and a message safe to show: `REPO_ACCESS_UNAVAILABLE` (try again later) or
15
+ * `REPO_ACCESS_DENIED` (the application will not issue one).
16
+ */
17
+ import { type GitCredential, type GitCredentialRequest } from '@nocobase/agent-protocol';
18
+ import type { Clock } from '../../kernel/clock.js';
19
+ import { type SecretMemory } from '../../kernel/redaction.js';
20
+ import type { TxRunner } from '../../kernel/tx.js';
21
+ import type { Runner } from '../../../shared/runners.js';
22
+ import { type RepoAccessRegistry } from './extensions.js';
23
+ import type { RunnerReports } from './lifecycle.js';
24
+ import { type RunRecord } from './run.store.js';
25
+ /** How long the server waits for the application to issue a credential before answering `REPO_ACCESS_UNAVAILABLE`. */
26
+ export declare const ISSUE_TIMEOUT_MS = 15000;
27
+ export interface GitCredentialService {
28
+ issue(runner: Pick<Runner, 'id'>, runId: string, request: GitCredentialRequest): Promise<GitCredential>;
29
+ }
30
+ export interface GitCredentialDeps {
31
+ readonly tx: TxRunner;
32
+ readonly clock: Clock;
33
+ readonly reports: Pick<RunnerReports, 'holds'>;
34
+ readonly repoAccess: RepoAccessRegistry;
35
+ readonly secrets?: SecretMemory;
36
+ /** Told what went wrong when a provider failed in a way it did not explain (`RepoAccessError`). */
37
+ readonly onError?: (message: string, error: unknown) => void;
38
+ readonly timeoutMs?: number;
39
+ }
40
+ /** The URLs a claim listed for on-demand credentials, as stored on the run. */
41
+ export declare function gitCredentialUrls(run: Pick<RunRecord, 'gitCredentialUrls'>): string[];
42
+ export declare function createGitCredentialService(deps: GitCredentialDeps): GitCredentialService;
43
+ //# sourceMappingURL=git-credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-credentials.d.ts","sourceRoot":"","sources":["../../../../server/core/runs/git-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,KAAK,EA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BAAiB,GACtB,oBAAoB,CAwJtB"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Repository credentials on demand (`RUNNER_ROUTES.gitCredential`, the `gitCredentials` feature): a runner asks for the
3
+ * credential of one of its run's repositories whenever git needs one, instead of keeping the one a claim handed out
4
+ * for the whole run, which a long run outlives.
5
+ *
6
+ * The answer is given only while the asking runner holds the run (`reports.holds`), for the attempt it names, under a
7
+ * lease that has not run out, and for a URL the claim listed in `RunGit.onDemand` (`agRuns.gitCredentialUrls`),
8
+ * compared exactly: case, a trailing `.git` and anything else the runner sends must match what it was given. Anything
9
+ * else is refused, so a run that ended, went back to the queue or was taken by another attempt gets nothing.
10
+ *
11
+ * The application issues the credential (`RepoAccessProvider.issue`), outside any transaction, within
12
+ * `ISSUE_TIMEOUT_MS`; whether a cached one is still good enough is its decision. Every credential handed out is added
13
+ * to the run's remembered secrets, so what the run reports afterwards is redacted of it too. A failure is answered
14
+ * with a reason the runner can act on and a message safe to show: `REPO_ACCESS_UNAVAILABLE` (try again later) or
15
+ * `REPO_ACCESS_DENIED` (the application will not issue one).
16
+ */
17
+ import { ProtocolError, } from '@nocobase/agent-protocol';
18
+ import { runSecretsKey } from '../../kernel/redaction.js';
19
+ import { stringArray } from '../../kernel/values.js';
20
+ import { RepoAccessError, } from './extensions.js';
21
+ import { findRunRecord, toRun } from './run.store.js';
22
+ /** How long the server waits for the application to issue a credential before answering `REPO_ACCESS_UNAVAILABLE`. */
23
+ export const ISSUE_TIMEOUT_MS = 15_000;
24
+ /** The URLs a claim listed for on-demand credentials, as stored on the run. */
25
+ export function gitCredentialUrls(run) {
26
+ return stringArray(run.gitCredentialUrls);
27
+ }
28
+ export function createGitCredentialService(deps) {
29
+ const timeoutMs = deps.timeoutMs ?? ISSUE_TIMEOUT_MS;
30
+ const lost = (message, status) => new ProtocolError('LEASE_LOST', message, { status });
31
+ async function withTimeout(issue) {
32
+ const controller = new AbortController();
33
+ let timer;
34
+ const timeout = new Promise((_, reject) => {
35
+ timer = setTimeout(() => {
36
+ controller.abort();
37
+ reject(new RepoAccessError('unavailable', 'The application did not issue a credential in time.'));
38
+ }, timeoutMs);
39
+ });
40
+ try {
41
+ return await Promise.race([issue(controller.signal), timeout]);
42
+ }
43
+ finally {
44
+ clearTimeout(timer);
45
+ }
46
+ }
47
+ function checked(grant, now) {
48
+ const expires = Date.parse(grant.expiresAt);
49
+ if (typeof grant.username !== 'string' ||
50
+ grant.username === '' ||
51
+ typeof grant.password !== 'string' ||
52
+ grant.password === '' ||
53
+ Number.isNaN(expires) ||
54
+ expires <= now.getTime())
55
+ throw new RepoAccessError('unavailable', 'The application issued a credential that is incomplete or already expired.');
56
+ return grant;
57
+ }
58
+ /**
59
+ * The run while `runner` still holds this attempt of it under a live lease and the claim listed `url`; the protocol
60
+ * reason otherwise. Checked before the application is asked and again once it answered, since issuing may take long
61
+ * enough for the run to end, be taken back or move to another attempt.
62
+ */
63
+ async function held(runner, runId, request) {
64
+ await deps.reports.holds(runner, runId);
65
+ const run = await findRunRecord(deps.tx.read(), runId);
66
+ if (!run)
67
+ throw new ProtocolError('RUN_NOT_FOUND', 'No such run.');
68
+ if (Number(run.attempt) !== request.attempt)
69
+ throw lost(`Attempt ${request.attempt} of the run is over; it is on attempt ${Number(run.attempt)}.`, run.status);
70
+ if (run.leaseExpiresAt === null ||
71
+ Date.parse(run.leaseExpiresAt) <= deps.clock.now().getTime())
72
+ throw lost('The run’s lease ran out.', run.status);
73
+ if (!gitCredentialUrls(run).includes(request.url))
74
+ throw new ProtocolError('INVALID_REQUEST', 'This repository is not one the run asks credentials for on demand.', { url: request.url });
75
+ return run;
76
+ }
77
+ /** The first answer of a provider that issues for the URL; null when none does. */
78
+ async function ask(run, runner, request) {
79
+ const providers = deps.repoAccess
80
+ .list()
81
+ .filter((provider) => provider.issue !== undefined);
82
+ try {
83
+ for (const provider of providers) {
84
+ const grant = await withTimeout((signal) => provider.issue({
85
+ run: toRun(run),
86
+ runnerId: runner.id,
87
+ attempt: request.attempt,
88
+ url: request.url,
89
+ refresh: request.refresh === true,
90
+ signal,
91
+ }));
92
+ if (grant)
93
+ return grant;
94
+ }
95
+ return null;
96
+ }
97
+ catch (error) {
98
+ if (error instanceof RepoAccessError)
99
+ throw new ProtocolError(error.kind === 'denied'
100
+ ? 'REPO_ACCESS_DENIED'
101
+ : 'REPO_ACCESS_UNAVAILABLE', error.message, { url: request.url });
102
+ deps.onError?.(`Agents could not issue a repository credential for run ${run.id}.`, error);
103
+ throw new ProtocolError('REPO_ACCESS_UNAVAILABLE', 'The application could not issue a credential for this repository.', { url: request.url });
104
+ }
105
+ }
106
+ return {
107
+ async issue(runner, runId, request) {
108
+ const run = await held(runner, runId, request);
109
+ const grant = await ask(run, runner, request);
110
+ if (!grant)
111
+ throw new ProtocolError('REPO_ACCESS_DENIED', 'The application issues no credential for this repository.', { url: request.url });
112
+ // The run may have ended, been taken back or moved to another attempt while the application issued: then the
113
+ // credential is dropped, never remembered, and the runner told why.
114
+ await held(runner, runId, request);
115
+ let valid;
116
+ try {
117
+ // Checked against the time it came back, not the time it was asked for.
118
+ valid = checked(grant, deps.clock.now());
119
+ }
120
+ catch (error) {
121
+ throw new ProtocolError('REPO_ACCESS_UNAVAILABLE', error instanceof Error ? error.message : String(error), { url: request.url });
122
+ }
123
+ const { username, password, expiresAt } = valid;
124
+ deps.secrets?.add(runSecretsKey(run.id), [password]);
125
+ return { username, password, expiresAt };
126
+ },
127
+ };
128
+ }
129
+ //# sourceMappingURL=git-credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-credentials.js","sourceRoot":"","sources":["../../../../server/core/runs/git-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,aAAa,GAGd,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,aAAa,EAAqB,MAAM,2BAA2B,CAAC;AAE7E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EACL,eAAe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AAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;QAC3C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Subject-selected identities, refreshed before a queued run can borrow a runner or credentials. */
2
+ import type { DatabaseConnection } from '@nocobase/db';
3
+ import type { Tx } from '../../kernel/tx.js';
4
+ import type { TransitionDeps } from './transitions.js';
5
+ import { type RunRecord } from './run.store.js';
6
+ /** Whether a queued run's identity is current; a claim refreshes it in a transaction only when it is not. */
7
+ export declare function queuedIdentityCurrent(conn: DatabaseConnection, deps: TransitionDeps, run: RunRecord): Promise<boolean>;
8
+ export declare function refreshQueuedIdentity(unit: Tx, deps: TransitionDeps, run: RunRecord): Promise<RunRecord | null>;
9
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../server/core/runs/identity.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAML,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAsDxB,6GAA6G;AAC7G,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,SAAS,GACb,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,EAAE,EACR,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,SAAS,GACb,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAwB3B"}
@@ -0,0 +1,75 @@
1
+ import { currentCommentOwner } from './comment-consent.js';
2
+ import { finishRun } from './transitions.js';
3
+ import { inputsRepo, findRunRecord, runsRepo, toInput, toExecutions, } from './run.store.js';
4
+ /** What refreshing would do, read without writing, so a claim poll opens no transaction for current work. */
5
+ async function planQueuedIdentity(conn, deps, run) {
6
+ if (run.commentRootRunId && run.status === 'queued') {
7
+ const root = await findRunRecord(conn, run.commentRootRunId);
8
+ if (!root || !(await currentCommentOwner(conn, deps.subjects, root)))
9
+ return {
10
+ kind: 'cancel',
11
+ detail: 'The comment belongs to an earlier owner assignment.',
12
+ };
13
+ }
14
+ const resolve = deps.subjects.get(run.subjectKind)?.actsAs;
15
+ // A run returned to the queue after a lease loss has already fixed its identity.
16
+ if (!resolve ||
17
+ run.status !== 'queued' ||
18
+ run.dispatchedAt ||
19
+ Number(run.attempt) > 1 ||
20
+ toExecutions(run).length > 0)
21
+ return { kind: 'keep' };
22
+ const inputs = await inputsRepo(conn).findMany({
23
+ filter: { runId: run.id },
24
+ });
25
+ const identity = await resolve(conn, {
26
+ subjectId: run.subjectId,
27
+ agentId: run.agentId,
28
+ causedByRunId: run.retryOfRunId ?? undefined,
29
+ commentExecution: run.commentExecution,
30
+ actorUserId: run.actorUserId,
31
+ inputs: inputs.map(toInput),
32
+ });
33
+ if (!identity)
34
+ return { kind: 'keep' };
35
+ if (!identity.actorUserId)
36
+ return { kind: 'cancel', detail: identity.reason ?? 'noOwner' };
37
+ if (run.commentExecution === 'requester')
38
+ return { kind: 'keep' };
39
+ if (run.actorUserId === identity.actorUserId &&
40
+ run.ownerUserId === identity.actorUserId)
41
+ return { kind: 'keep' };
42
+ return { kind: 'update', actorUserId: identity.actorUserId };
43
+ }
44
+ /** Whether a queued run's identity is current; a claim refreshes it in a transaction only when it is not. */
45
+ export async function queuedIdentityCurrent(conn, deps, run) {
46
+ return (await planQueuedIdentity(conn, deps, run)).kind === 'keep';
47
+ }
48
+ export async function refreshQueuedIdentity(unit, deps, run) {
49
+ const plan = await planQueuedIdentity(unit.conn, deps, run);
50
+ if (plan.kind === 'keep')
51
+ return run;
52
+ if (plan.kind === 'cancel') {
53
+ await finishRun(unit, deps, run, {
54
+ status: 'cancelled',
55
+ reason: null,
56
+ detail: plan.detail,
57
+ });
58
+ return null;
59
+ }
60
+ const values = {
61
+ actorUserId: plan.actorUserId,
62
+ ownerUserId: plan.actorUserId,
63
+ requestedByUserId: run.requestedByUserId ?? run.actorUserId,
64
+ updatedAt: deps.clock.now().toISOString(),
65
+ };
66
+ const updated = await runsRepo(unit.conn).updateMany({
67
+ filter: { id: run.id, status: 'queued', actorUserId: run.actorUserId },
68
+ values,
69
+ });
70
+ if (updated.updatedCount !== 1)
71
+ return null;
72
+ unit.emit({ type: 'run.changed', runId: run.id, status: 'queued' });
73
+ return { ...run, ...values };
74
+ }
75
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../../server/core/runs/identity.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,OAAO,EACP,YAAY,GAEb,MAAM,gBAAgB,CAAC;AAOxB,6GAA6G;AAC7G,KAAK,UAAU,kBAAkB,CAC/B,IAAwB,EACxB,IAAoB,EACpB,GAAc;IAEd,IAAI,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAClE,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,qDAAqD;aAC9D,CAAC;IACN,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CA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AAQ,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE;QACtE,MAAM;KACP,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,YAAY,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5C,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACpE,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;AAC/B,CAAC"}
@@ -1,15 +1,19 @@
1
- export { briefOf, createClaimService, fits, hasTool, onlineEntryOf, pickEntry, isServerHolder, payloadDirs, payloadRequires, skillTargets, variableTargets, type ClaimService, type RenderedBrief, type ServerClaim, type ServerHolder, } from './claim.js';
1
+ export { briefOf, createClaimService, fits, fitsActor, hasTool, pickEntry, payloadDirs, payloadRequires, skillTargets, variableTargets, type ClaimService, type RenderedBrief, } from './claim.js';
2
2
  export { resolveAgentCli, type AgentCli } from './policy.js';
3
- export { createBriefSectionRegistry, createRepoAccessRegistry, createRunMountRegistry, sessionKeyOf, type BriefSectionProvider, type BriefSectionRegistry, type ExtensionPrepare, type MountContext, type MountOffer, type RepoAccessContext, type RepoAccessProvider, type RepoAccessRegistry, type RunMountProvider, type RunMountRegistry, } from './extensions.js';
3
+ export { createClaimEligibility, type ClaimEligibility, type EligibilityRequest, } from './eligibility.js';
4
+ export { createBriefSectionRegistry, createRepoAccessRegistry, createRunMountRegistry, sessionKeyOf, type BriefSectionProvider, type BriefSectionRegistry, type ExtensionPrepare, type MountContext, type MountOffer, RepoAccessError, type RepoAccessContext, type RepoAccessProvider, type RepoAccessRegistry, type RepoCredentialGrant, type RepoCredentialRequest, type RepoPrepareOptions, type RunMountProvider, type RunMountRegistry, } from './extensions.js';
5
+ export { createGitCredentialService, ISSUE_TIMEOUT_MS, type GitCredentialService, } from './git-credentials.js';
4
6
  export { createBriefPreviewer, type BriefPreviewer } from './preview.js';
5
7
  export { findBrief, requestReset } from './workspace.store.js';
6
- export { createRunnerReports, type OnlineUsageRecord, type RunnerReports, } from './lifecycle.js';
7
- export { commandRef, createSubjectRegistry, dialectOf, takesType, type ClaimContext, type CommandDialect, type ContextProvider, type SubjectAssembly, type SubjectSample, type SubjectBinding, type SubjectDir, type SubjectFacts, type SubjectRegistry, type SubjectReports, type SubjectScope, type WorkSink, } from './ports.js';
8
+ export { createRunnerReports, type RunnerReports } from './lifecycle.js';
9
+ export { commandRef, createSubjectRegistry, type ClaimContext, type ContextProvider, type SubjectAssembly, type SubjectSample, type SubjectBinding, type SubjectDir, type SubjectFacts, type SubjectRegistry, type SubjectReports, type SubjectWorkspaces, type SubjectScope, type WorkSink, } from './ports.js';
8
10
  export { DEFAULT_TOOL_POLICY, MAX_CLAIM_FAILURES, retryDelayMs, toolPolicyFor, } from './policy.js';
9
11
  export type { RunTokenIdentity } from './run-tokens.js';
10
12
  export { countActive, eventsAfter, hasSession, inputsOnSince, lastSummary, openCounts, openRunsOn, openRunsOnEach, pendingInputs, type EventRecord, } from './run.store.js';
11
- export { createRunService, DEFAULT_THREAD, type EnqueueRequest, type EnqueueResult, type NewInput, type RunFilter, type RunService, } from './run.service.js';
13
+ export { createRunService, DEFAULT_THREAD, queuedRun, type EnqueueRequest, type EnqueueResult, type NewInput, type RunEnqueued, type RunFilter, type RunRequestPending, type RunService, } from './run.service.js';
14
+ export { RUN_REQUEST_TTL_MS, type RequestedRun, type RunRequestFilter, type RunRequestReassignment, type RunRequestService, } from './run-requests.js';
12
15
  export { createSweeper, type Sweeper, type SweepReport } from './sweeper.js';
16
+ export { executionForViewer, runForViewer, type RunMachineViewer, } from './execution-view.js';
13
17
  export { createAvailability, type AgentAvailability, type Availability, } from './availability.js';
14
18
  export { cliPackageFor, type AgentCliSource } from './cli-package.js';
15
19
  export { createRunnerView, runsHeldBy, runsHeldByTool, type RunnerView, } from './runner-view.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/core/runs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,IAAI,EACJ,OAAO,EACP,aAAa,EACb,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,EACZ,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,QAAQ,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,aAAa,EACb,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/core/runs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,IAAI,EACJ,SAAS,EACT,OAAO,EACP,SAAS,EACT,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,EACZ,KAAK,oBAAoB,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AAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC"}
@@ -1,14 +1,18 @@
1
- export { briefOf, createClaimService, fits, hasTool, onlineEntryOf, pickEntry, isServerHolder, payloadDirs, payloadRequires, skillTargets, variableTargets, } from './claim.js';
1
+ export { briefOf, createClaimService, fits, fitsActor, hasTool, pickEntry, payloadDirs, payloadRequires, skillTargets, variableTargets, } from './claim.js';
2
2
  export { resolveAgentCli } from './policy.js';
3
- export { createBriefSectionRegistry, createRepoAccessRegistry, createRunMountRegistry, sessionKeyOf, } from './extensions.js';
3
+ export { createClaimEligibility, } from './eligibility.js';
4
+ export { createBriefSectionRegistry, createRepoAccessRegistry, createRunMountRegistry, sessionKeyOf, RepoAccessError, } from './extensions.js';
5
+ export { createGitCredentialService, ISSUE_TIMEOUT_MS, } from './git-credentials.js';
4
6
  export { createBriefPreviewer } from './preview.js';
5
7
  export { findBrief, requestReset } from './workspace.store.js';
6
- export { createRunnerReports, } from './lifecycle.js';
7
- export { commandRef, createSubjectRegistry, dialectOf, takesType, } from './ports.js';
8
+ export { createRunnerReports } from './lifecycle.js';
9
+ export { commandRef, createSubjectRegistry, } from './ports.js';
8
10
  export { DEFAULT_TOOL_POLICY, MAX_CLAIM_FAILURES, retryDelayMs, toolPolicyFor, } from './policy.js';
9
11
  export { countActive, eventsAfter, hasSession, inputsOnSince, lastSummary, openCounts, openRunsOn, openRunsOnEach, pendingInputs, } from './run.store.js';
10
- export { createRunService, DEFAULT_THREAD, } from './run.service.js';
12
+ export { createRunService, DEFAULT_THREAD, queuedRun, } from './run.service.js';
13
+ export { RUN_REQUEST_TTL_MS, } from './run-requests.js';
11
14
  export { createSweeper } from './sweeper.js';
15
+ export { executionForViewer, runForViewer, } from './execution-view.js';
12
16
  export { createAvailability, } from './availability.js';
13
17
  export { cliPackageFor } from './cli-package.js';
14
18
  export { createRunnerView, runsHeldBy, runsHeldByTool, } from './runner-view.js';