@1agents/acp-service 0.9.0 → 0.10.0

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 (274) hide show
  1. package/README.md +19 -13
  2. package/dist/bin/a2a.js +6 -2
  3. package/dist/bin/acp-service.js +25 -1
  4. package/dist/bin/process.d.ts +4 -0
  5. package/dist/bin/process.js +57 -0
  6. package/dist/bin/roles.js +21 -18
  7. package/dist/bin/rsi.d.ts +3 -0
  8. package/dist/bin/rsi.js +114 -0
  9. package/dist/bin/ticket.d.ts +13 -0
  10. package/dist/bin/ticket.js +97 -0
  11. package/dist/bin/trail.d.ts +4 -0
  12. package/dist/bin/trail.js +62 -0
  13. package/dist/src/a2a/artifact-content.d.ts +9 -0
  14. package/dist/src/a2a/artifact-content.js +45 -0
  15. package/dist/src/a2a/desktop-notify.d.ts +1 -0
  16. package/dist/src/a2a/desktop-notify.js +12 -0
  17. package/dist/src/a2a/execution-binding.d.ts +9 -0
  18. package/dist/src/a2a/execution-binding.js +19 -0
  19. package/dist/src/a2a/executor.d.ts +7 -2
  20. package/dist/src/a2a/executor.js +127 -60
  21. package/dist/src/a2a/gateway.d.ts +581 -10
  22. package/dist/src/a2a/gateway.js +1018 -95
  23. package/dist/src/a2a/index.d.ts +8 -1
  24. package/dist/src/a2a/index.js +4 -0
  25. package/dist/src/a2a/job-directory.d.ts +6 -0
  26. package/dist/src/a2a/job-directory.js +19 -0
  27. package/dist/src/a2a/preflight.js +16 -1
  28. package/dist/src/a2a/resubmit.d.ts +46 -0
  29. package/dist/src/a2a/resubmit.js +82 -0
  30. package/dist/src/a2a/result-metadata.d.ts +3 -0
  31. package/dist/src/a2a/result-metadata.js +27 -5
  32. package/dist/src/a2a/server.d.ts +10 -0
  33. package/dist/src/a2a/server.js +125 -1
  34. package/dist/src/a2a/session-lifecycle.d.ts +40 -0
  35. package/dist/src/a2a/session-lifecycle.js +54 -0
  36. package/dist/src/a2a/store.d.ts +4 -0
  37. package/dist/src/a2a/store.js +70 -1
  38. package/dist/src/a2a/types.d.ts +46 -6
  39. package/dist/src/a2a/types.js +4 -6
  40. package/dist/src/a2a/workbench-ui.d.ts +28 -0
  41. package/dist/src/a2a/workbench-ui.js +182 -0
  42. package/dist/src/acp-connection.js +27 -3
  43. package/dist/src/bridge.d.ts +1 -0
  44. package/dist/src/bridge.js +191 -39
  45. package/dist/src/capacity-queue.d.ts +35 -0
  46. package/dist/src/capacity-queue.js +139 -2
  47. package/dist/src/capacity.d.ts +25 -0
  48. package/dist/src/capacity.js +48 -9
  49. package/dist/src/dsh.js +1 -1
  50. package/dist/src/execution/agent-files.d.ts +25 -0
  51. package/dist/src/execution/agent-files.js +90 -0
  52. package/dist/src/execution/agent-registry.d.ts +164 -0
  53. package/dist/src/execution/agent-registry.js +275 -0
  54. package/dist/src/execution/human-review.d.ts +2 -0
  55. package/dist/src/execution/human-review.js +3 -1
  56. package/dist/src/execution/ledger.d.ts +52 -0
  57. package/dist/src/execution/ledger.js +83 -5
  58. package/dist/src/execution/ppt-delivery.d.ts +0 -5
  59. package/dist/src/execution/ppt-delivery.js +0 -26
  60. package/dist/src/execution/process-request.d.ts +151 -0
  61. package/dist/src/execution/process-request.js +177 -0
  62. package/dist/src/execution/targets.d.ts +64 -5
  63. package/dist/src/execution/targets.js +58 -7
  64. package/dist/src/execution/ticket-executor.d.ts +25 -0
  65. package/dist/src/execution/ticket-executor.js +27 -0
  66. package/dist/src/execution/ticket.d.ts +326 -0
  67. package/dist/src/execution/ticket.js +301 -0
  68. package/dist/src/execution/workbench-chat.d.ts +25 -0
  69. package/dist/src/execution/workbench-chat.js +54 -0
  70. package/dist/src/execution/workbench.d.ts +32 -1
  71. package/dist/src/execution/workbench.js +113 -22
  72. package/dist/src/roles/index.d.ts +1 -1
  73. package/dist/src/roles/index.js +1 -1
  74. package/dist/src/roles/skills.d.ts +27 -58
  75. package/dist/src/roles/skills.js +89 -404
  76. package/dist/src/rsi/gate.d.ts +25 -0
  77. package/dist/src/rsi/gate.js +59 -0
  78. package/dist/src/rsi/outline-run.d.ts +107 -0
  79. package/dist/src/rsi/outline-run.js +443 -0
  80. package/dist/workbench-ui/app.css +453 -0
  81. package/dist/workbench-ui/app.js +13 -0
  82. package/dist/workbench-ui/chunk-23JHGYT3.js +1 -0
  83. package/dist/workbench-ui/chunk-3H6STGPV.js +1 -0
  84. package/dist/workbench-ui/chunk-3SNBBMGH.js +1 -0
  85. package/dist/workbench-ui/chunk-3XJZ6DIE.js +1 -0
  86. package/dist/workbench-ui/chunk-44KDLLKJ.js +1 -0
  87. package/dist/workbench-ui/chunk-46H7FU5Y.js +7 -0
  88. package/dist/workbench-ui/chunk-4N44QPL7.js +1 -0
  89. package/dist/workbench-ui/chunk-4YN4BS7I.js +1 -0
  90. package/dist/workbench-ui/chunk-53EG4IVQ.js +96 -0
  91. package/dist/workbench-ui/chunk-5FIPUNR4.js +1 -0
  92. package/dist/workbench-ui/chunk-6DWWYA6G.js +2 -0
  93. package/dist/workbench-ui/chunk-6FU3T633.js +99 -0
  94. package/dist/workbench-ui/chunk-6XKIHRA4.js +1 -0
  95. package/dist/workbench-ui/chunk-7GIX43Y5.js +1 -0
  96. package/dist/workbench-ui/chunk-7Q4WBGX6.js +4 -0
  97. package/dist/workbench-ui/chunk-A3BQM7HR.js +1 -0
  98. package/dist/workbench-ui/chunk-AFCFDDOP.js +24 -0
  99. package/dist/workbench-ui/chunk-AG67EUYD.js +89 -0
  100. package/dist/workbench-ui/chunk-AGJHMMTN.js +1 -0
  101. package/dist/workbench-ui/chunk-AO6JUBV6.js +41 -0
  102. package/dist/workbench-ui/chunk-AUSLTP43.js +72 -0
  103. package/dist/workbench-ui/chunk-AVZL46TT.js +1 -0
  104. package/dist/workbench-ui/chunk-AZRIGIV2.js +168 -0
  105. package/dist/workbench-ui/chunk-B2LIVH37.js +1 -0
  106. package/dist/workbench-ui/chunk-B7YX5TR5.js +1 -0
  107. package/dist/workbench-ui/chunk-BCB4X4XX.js +1 -0
  108. package/dist/workbench-ui/chunk-BCRQUL2A.js +88 -0
  109. package/dist/workbench-ui/chunk-BI6UHHQP.js +1 -0
  110. package/dist/workbench-ui/chunk-BLSLQ4AQ.js +120 -0
  111. package/dist/workbench-ui/chunk-C3QSRS6E.js +1 -0
  112. package/dist/workbench-ui/chunk-CK7M2PJ3.js +62 -0
  113. package/dist/workbench-ui/chunk-CM6LZ7TU.js +1 -0
  114. package/dist/workbench-ui/chunk-CP63H27F.js +36 -0
  115. package/dist/workbench-ui/chunk-CPUMMIS2.js +70 -0
  116. package/dist/workbench-ui/chunk-CSEIBI5U.js +2 -0
  117. package/dist/workbench-ui/chunk-CUS65DKZ.js +161 -0
  118. package/dist/workbench-ui/chunk-CVQY7TNC.js +1 -0
  119. package/dist/workbench-ui/chunk-D6S3XBIX.js +106 -0
  120. package/dist/workbench-ui/chunk-E253Y562.js +1 -0
  121. package/dist/workbench-ui/chunk-EADDJUDC.js +1 -0
  122. package/dist/workbench-ui/chunk-EBGJ3YXG.js +206 -0
  123. package/dist/workbench-ui/chunk-EKPVZ3WY.js +8 -0
  124. package/dist/workbench-ui/chunk-EQDCEAFY.js +1 -0
  125. package/dist/workbench-ui/chunk-ES3SSDJY.js +40 -0
  126. package/dist/workbench-ui/chunk-ESFD2H7N.js +231 -0
  127. package/dist/workbench-ui/chunk-FVOHPMS6.js +1 -0
  128. package/dist/workbench-ui/chunk-FXMQAGVT.js +1 -0
  129. package/dist/workbench-ui/chunk-GGTADRXD.js +24 -0
  130. package/dist/workbench-ui/chunk-GHIVPGNQ.js +1 -0
  131. package/dist/workbench-ui/chunk-GLU2YQV2.js +1 -0
  132. package/dist/workbench-ui/chunk-GOCKBYSM.js +1 -0
  133. package/dist/workbench-ui/chunk-H2KMMTJB.js +1 -0
  134. package/dist/workbench-ui/chunk-HGVLDNPP.js +39 -0
  135. package/dist/workbench-ui/chunk-HSAVC5GY.js +1 -0
  136. package/dist/workbench-ui/chunk-HSEAD2JH.js +1 -0
  137. package/dist/workbench-ui/chunk-HSIHOBTY.js +1 -0
  138. package/dist/workbench-ui/chunk-IZXOKUGG.js +67 -0
  139. package/dist/workbench-ui/chunk-JFT2LC2T.js +1 -0
  140. package/dist/workbench-ui/chunk-JHL3ZDYK.js +3 -0
  141. package/dist/workbench-ui/chunk-JMORLCZG.js +257 -0
  142. package/dist/workbench-ui/chunk-JR4SIX7A.js +1 -0
  143. package/dist/workbench-ui/chunk-K23HAGEH.js +30 -0
  144. package/dist/workbench-ui/chunk-K43JDCBH.js +1 -0
  145. package/dist/workbench-ui/chunk-KINKFJY7.js +1 -0
  146. package/dist/workbench-ui/chunk-KKQSA4LI.js +2 -0
  147. package/dist/workbench-ui/chunk-KOUZX3UX.js +1 -0
  148. package/dist/workbench-ui/chunk-KR4DRHW2.js +78 -0
  149. package/dist/workbench-ui/chunk-KT4DJNOR.js +1 -0
  150. package/dist/workbench-ui/chunk-KTPNKRRZ.js +292 -0
  151. package/dist/workbench-ui/chunk-LFHIPGSU.js +7 -0
  152. package/dist/workbench-ui/chunk-LWDL4HZB.js +125 -0
  153. package/dist/workbench-ui/chunk-MVYC3CY4.js +1 -0
  154. package/dist/workbench-ui/chunk-NWUPALCY.js +129 -0
  155. package/dist/workbench-ui/chunk-NY7C662Z.js +1 -0
  156. package/dist/workbench-ui/chunk-O76WTHWP.js +1 -0
  157. package/dist/workbench-ui/chunk-OTF7YHRE.js +162 -0
  158. package/dist/workbench-ui/chunk-P6TKKRKP.js +1 -0
  159. package/dist/workbench-ui/chunk-PFHOOWV3.js +1 -0
  160. package/dist/workbench-ui/chunk-PUQLANIM.js +1 -0
  161. package/dist/workbench-ui/chunk-PZCGBYVO.js +1 -0
  162. package/dist/workbench-ui/chunk-QOHUZGP4.js +1 -0
  163. package/dist/workbench-ui/chunk-QSEG3OFF.js +1 -0
  164. package/dist/workbench-ui/chunk-QYPOXZIA.js +84 -0
  165. package/dist/workbench-ui/chunk-R6SOF3JC.js +1 -0
  166. package/dist/workbench-ui/chunk-RCLOYU5F.js +1 -0
  167. package/dist/workbench-ui/chunk-RSRUP64S.js +1 -0
  168. package/dist/workbench-ui/chunk-RVAIT6JW.js +1 -0
  169. package/dist/workbench-ui/chunk-S2CCN3II.js +1 -0
  170. package/dist/workbench-ui/chunk-S2Q52W46.js +1 -0
  171. package/dist/workbench-ui/chunk-S2W5THJ5.js +1 -0
  172. package/dist/workbench-ui/chunk-S6ZQZNOX.js +1 -0
  173. package/dist/workbench-ui/chunk-S74PLMMS.js +1 -0
  174. package/dist/workbench-ui/chunk-S7C4HKEY.js +1 -0
  175. package/dist/workbench-ui/chunk-SDTB3Q65.js +1 -0
  176. package/dist/workbench-ui/chunk-SLPRGYUV.js +32 -0
  177. package/dist/workbench-ui/chunk-SQE76S5B.js +1 -0
  178. package/dist/workbench-ui/chunk-SSDZPVPW.js +1 -0
  179. package/dist/workbench-ui/chunk-SVI7DGIE.js +1 -0
  180. package/dist/workbench-ui/chunk-T6QKLZ4H.js +62 -0
  181. package/dist/workbench-ui/chunk-TJNRPTFL.js +1 -0
  182. package/dist/workbench-ui/chunk-TP6U4EDH.js +2 -0
  183. package/dist/workbench-ui/chunk-TYAAT3GQ.js +1 -0
  184. package/dist/workbench-ui/chunk-U6OCY4ZH.js +1 -0
  185. package/dist/workbench-ui/chunk-UAN3NLRF.js +1 -0
  186. package/dist/workbench-ui/chunk-UMLU3FIX.js +1 -0
  187. package/dist/workbench-ui/chunk-URIY2OTM.js +1 -0
  188. package/dist/workbench-ui/chunk-V2NUKAA7.js +38 -0
  189. package/dist/workbench-ui/chunk-V4QLL4TE.js +139 -0
  190. package/dist/workbench-ui/chunk-VASHXUK4.js +2 -0
  191. package/dist/workbench-ui/chunk-VJLIWNIU.js +1 -0
  192. package/dist/workbench-ui/chunk-VQNQFBID.js +1 -0
  193. package/dist/workbench-ui/chunk-VSIWU7XA.js +3 -0
  194. package/dist/workbench-ui/chunk-VSJASPUZ.js +321 -0
  195. package/dist/workbench-ui/chunk-VXPNUNUX.js +3 -0
  196. package/dist/workbench-ui/chunk-WBKLDCV6.js +1 -0
  197. package/dist/workbench-ui/chunk-WOKJM3FY.js +1 -0
  198. package/dist/workbench-ui/chunk-X3U3NA3X.js +34 -0
  199. package/dist/workbench-ui/chunk-XBYU7M4J.js +1 -0
  200. package/dist/workbench-ui/chunk-XBZAO4ID.js +10 -0
  201. package/dist/workbench-ui/chunk-XLLPZ2WO.js +1 -0
  202. package/dist/workbench-ui/chunk-YFVL4NJL.js +1 -0
  203. package/dist/workbench-ui/chunk-YRFQENM4.js +1 -0
  204. package/dist/workbench-ui/chunk-YUADQVB2.js +1 -0
  205. package/dist/workbench-ui/chunk-Z3TCAKM5.js +1 -0
  206. package/dist/workbench-ui/chunk-Z6QR6FRE.js +10 -0
  207. package/dist/workbench-ui/chunk-ZJPSORPP.js +3 -0
  208. package/dist/workbench-ui/chunk-ZLGCSTR2.js +15 -0
  209. package/dist/workbench-ui/chunk-ZLR4SG5X.js +1 -0
  210. package/dist/workbench-ui/chunk-ZND3TTGF.js +1 -0
  211. package/dist/workbench-ui/chunk-ZOP3ZYH7.js +2 -0
  212. package/dist/workbench-ui/index.html +14 -0
  213. package/package.json +19 -8
  214. package/skills/acp-service/SKILL.md +4 -2
  215. package/skills/acp-service/references/a2a.md +18 -6
  216. package/skills/acp-service/references/dsh.md +2 -0
  217. package/skills/acp-service/references/roles-and-tasks.md +10 -10
  218. package/skills/rsi-coach/SKILL.md +134 -0
  219. package/vendor/dsh/README.md +10 -6
  220. package/vendor/dsh/a2a-executor.d.ts +56 -2
  221. package/vendor/dsh/a2a-executor.js +163 -17
  222. package/vendor/dsh/a2a.d.ts +12 -2
  223. package/vendor/dsh/a2a.js +9 -2
  224. package/vendor/dsh/adapter.d.ts +52 -3
  225. package/vendor/dsh/adapter.js +297 -30
  226. package/vendor/dsh/client.js +67 -11
  227. package/vendor/dsh/index.js +55 -3
  228. package/vendor/dsh/native-approvals.d.ts +4 -0
  229. package/vendor/dsh/native-approvals.js +44 -0
  230. package/vendor/dsh/preset-route.d.ts +49 -0
  231. package/vendor/dsh/preset-route.js +51 -0
  232. package/vendor/dsh/preset.js +10 -3
  233. package/vendor/dsh/process-admission.d.ts +25 -0
  234. package/vendor/dsh/process-admission.js +87 -0
  235. package/vendor/dsh/process-requests.d.ts +57 -0
  236. package/vendor/dsh/process-requests.js +49 -0
  237. package/vendor/dsh/review-mcp.d.ts +1 -0
  238. package/vendor/dsh/review-mcp.js +56 -0
  239. package/vendor/dsh/review.d.ts +30 -0
  240. package/vendor/dsh/review.js +149 -0
  241. package/vendor/dsh/session-settings.d.ts +34 -0
  242. package/vendor/dsh/session-settings.js +114 -0
  243. package/vendor/dsh/ticket-spec.d.ts +30 -0
  244. package/vendor/dsh/ticket-spec.js +10 -0
  245. package/vendor/dsh/ticket-tools.d.ts +21 -0
  246. package/vendor/dsh/ticket-tools.js +43 -0
  247. package/vendor/dsh/workbench.d.ts +18 -0
  248. package/vendor/dsh/workbench.js +91 -0
  249. package/vendor/runtime/README.md +6 -4
  250. package/vendor/runtime/dist/docs-site/CLI.html +2 -2
  251. package/vendor/runtime/dist/docs-site/VISION.html +2 -2
  252. package/vendor/runtime/dist/docs-site/agents.html +2 -2
  253. package/vendor/runtime/dist/docs-site/compare.html +2 -2
  254. package/vendor/runtime/dist/docs-site/config.html +2 -2
  255. package/vendor/runtime/dist/docs-site/custom-agents.html +2 -2
  256. package/vendor/runtime/dist/docs-site/exit-codes.html +2 -2
  257. package/vendor/runtime/dist/docs-site/flows.html +2 -2
  258. package/vendor/runtime/dist/docs-site/index.html +1 -1
  259. package/vendor/runtime/dist/docs-site/install.html +2 -2
  260. package/vendor/runtime/dist/docs-site/llms.txt +1 -1
  261. package/vendor/runtime/dist/docs-site/output-formats.html +2 -2
  262. package/vendor/runtime/dist/docs-site/permissions.html +2 -2
  263. package/vendor/runtime/dist/docs-site/prompting.html +2 -2
  264. package/vendor/runtime/dist/docs-site/quickstart.html +2 -2
  265. package/vendor/runtime/dist/docs-site/releasing.html +2 -2
  266. package/vendor/runtime/dist/docs-site/runtime-environment.html +2 -2
  267. package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +2 -2
  268. package/vendor/runtime/dist/docs-site/safe-errors.html +2 -2
  269. package/vendor/runtime/dist/docs-site/session-control.html +2 -2
  270. package/vendor/runtime/dist/docs-site/session-watch.html +2 -2
  271. package/vendor/runtime/dist/docs-site/sessions.html +2 -2
  272. package/vendor/runtime/dist/docs-site/shared-sessions.html +2 -2
  273. package/vendor/runtime/package.json +6 -4
  274. package/vendor/runtime/skills/acpx/SKILL.md +2 -0
@@ -0,0 +1,54 @@
1
+ /** Turns the A2A tasks behind one workbench job into the chat view's transcript items, newest page first. */
2
+ import { Role, Task } from '@a2a-js/sdk';
3
+ /** Queue and progress notices the executor writes into A2A history on every poll; they are status, not conversation. */
4
+ const STATUS_NOTICE = /^(CAPACITY_PENDING|Pending: waiting\b)/;
5
+ const fence = (value) => '```json\n' + JSON.stringify(value, null, 2) + '\n```';
6
+ /**
7
+ * One item per message: text parts joined, structured data fenced, file parts as links. Status notices are
8
+ * dropped and repeats collapse; the agent's final answer lives in the task's text artifacts, not its history.
9
+ */
10
+ export function chatItems(tasks) {
11
+ const items = [], seen = new Set();
12
+ for (const { attemptId, task: raw } of tasks) {
13
+ const task = Task.fromJSON(raw);
14
+ const messages = [...task.history, ...(task.status?.message ? [task.status.message] : [])];
15
+ for (const message of messages) {
16
+ const key = `${task.id}:${message.messageId}`;
17
+ if (seen.has(key))
18
+ continue;
19
+ seen.add(key);
20
+ const blocks = message.parts.flatMap(part => {
21
+ const content = part.content;
22
+ if (!content)
23
+ return [];
24
+ if (content.$case === 'text')
25
+ return content.value.trim() ? [content.value] : [];
26
+ if (content.$case === 'data')
27
+ return [fence(content.value)];
28
+ if (content.$case === 'url')
29
+ return [`[${part.filename || content.value}](${content.value})`];
30
+ return [];
31
+ });
32
+ const content = blocks.join('\n\n');
33
+ const role = message.role === Role.ROLE_USER ? 'user' : 'assistant_text';
34
+ if (!content || role === 'assistant_text' && STATUS_NOTICE.test(content.trim()))
35
+ continue;
36
+ if (items.at(-1)?.kind === role && items.at(-1).content === content)
37
+ continue;
38
+ // Ordinals, not clocks: A2A history carries no timestamps, and ids must stay stable as history grows.
39
+ items.push({ id: `${attemptId ?? task.id}:${message.messageId}`, createdAt: items.length, kind: role, content });
40
+ }
41
+ for (const artifact of task.artifacts) {
42
+ const answer = artifact.parts.flatMap(part => part.content?.$case === 'text' && part.content.value.trim() ? [part.content.value] : []).join('\n\n');
43
+ if (!answer || items.some(item => item.kind === 'assistant_text' && item.content === answer))
44
+ continue;
45
+ items.push({ id: `${attemptId ?? task.id}:artifact:${artifact.artifactId}`, createdAt: items.length, kind: 'assistant_text', content: answer });
46
+ }
47
+ }
48
+ return items;
49
+ }
50
+ /** `before` is the index the previous page started at; pages walk from the newest toward the oldest. */
51
+ export function pageChat(items, query = {}) {
52
+ const end = Math.min(query.before ?? items.length, items.length), start = Math.max(0, end - (query.limit ?? 40));
53
+ return { items: items.slice(start, end), hasMore: start > 0, ...(start > 0 ? { nextCursor: String(start) } : {}), total: items.length };
54
+ }
@@ -1,9 +1,11 @@
1
1
  /** Human-readable projections of the execution ledger. Reading never dispatches or acknowledges work. */
2
- import type { JobRef, LedgerAttempt, LedgerEvent, LedgerState } from './ledger.js';
2
+ import type { BusinessAcceptance, JobRef, LedgerActor, LedgerAttempt, LedgerEvent, LedgerState } from './ledger.js';
3
3
  import type { ReportReviewRun } from './report-review.js';
4
4
  import type { PptDeliveryRun } from './ppt-delivery.js';
5
5
  import { deliveryProgress } from './delivery-progress.js';
6
6
  import type { HumanReviewRequest, HumanReviewStatus } from './human-review.js';
7
+ import { type ProcessRequest } from './process-request.js';
8
+ import { type AgentDraft, type AgentRelease, type ResidentAgentRef, type WorkbenchAgentRow } from './agent-registry.js';
7
9
  export interface WorkbenchServiceInfo {
8
10
  kind: 'a2a' | 'gateway_workflow' | 'activepieces' | 'unknown';
9
11
  source: 'backend_run' | 'target_snapshot' | 'workflow_run' | 'unrecorded';
@@ -42,10 +44,24 @@ export interface AcpTaskSummary {
42
44
  stale: boolean;
43
45
  reviewStatus?: HumanReviewStatus;
44
46
  pendingReviewId?: string;
47
+ pendingProcessRequestId?: string;
45
48
  progressSummary: string;
49
+ channel: 'trial' | 'formal' | 'standalone';
50
+ agentId?: string;
51
+ agentName?: string;
52
+ agentPhase?: 'developing' | 'published';
46
53
  inFlightAttemptIds: string[];
47
54
  unresolvedAttemptIds: string[];
48
55
  execution: WorkbenchExecution;
56
+ /** The origin session's execution_review for the current result, if one was recorded. */
57
+ businessAcceptance?: BusinessAcceptance;
58
+ /** Tools the finished attempt asked for that nobody approved; its result may be incomplete. */
59
+ blockedTools?: string[];
60
+ /** The round failed and nothing else drives this task, so a person can send it another round from the workbench. */
61
+ canContinue?: boolean;
62
+ /** A finished top-level result with no conclusion yet and no review flow of its own, so a person can mark it read. */
63
+ canAccept?: boolean;
64
+ initiatedBy?: LedgerActor;
49
65
  }
50
66
  export interface WorkbenchStage {
51
67
  stage: string;
@@ -78,16 +94,22 @@ export type WorkbenchReview = HumanReviewRequest & {
78
94
  resumeStatus?: 'pending' | 'applied';
79
95
  resumeError?: string;
80
96
  };
97
+ export type WorkbenchProcessRequest = ProcessRequest & {
98
+ canAnswer: boolean;
99
+ };
81
100
  export type WorkbenchAttempt = Omit<LedgerAttempt, 'input' | 'targetSnapshot' | 'backendRunRef'> & {
82
101
  backendRunRef?: Record<string, string>;
83
102
  execution: WorkbenchExecution;
84
103
  };
85
104
  export interface AcpTaskDetail extends AcpTaskSummary {
105
+ /** The first attempt's prompt: what the task was asked to do. Other input fields stay private. */
106
+ description?: string;
86
107
  attempts: WorkbenchAttempt[];
87
108
  children: AcpTaskSummary[];
88
109
  ancestors: AcpTaskSummary[];
89
110
  progress: WorkbenchProgress;
90
111
  reviews: WorkbenchReview[];
112
+ processRequests: WorkbenchProcessRequest[];
91
113
  events: LedgerEvent[];
92
114
  dependencies: WorkbenchDependency[];
93
115
  artifacts: {
@@ -101,10 +123,12 @@ export interface WorkbenchSource {
101
123
  runs: readonly PptDeliveryRun[];
102
124
  reviews: readonly HumanReviewRequest[];
103
125
  reportRuns?: readonly ReportReviewRun[];
126
+ processRequests?: readonly ProcessRequest[];
104
127
  actorId: string;
105
128
  allowedOrigins?: readonly string[];
106
129
  now?: number;
107
130
  }
131
+ export type { AgentDraft, AgentRelease, WorkbenchAgentRow };
108
132
  export interface WorkbenchSnapshot {
109
133
  sourceId: string;
110
134
  tasks: AcpTaskSummary[];
@@ -128,4 +152,11 @@ export declare function listWorkbenchTasks(snapshot: WorkbenchSnapshot, query?:
128
152
  offset: number;
129
153
  limit: number;
130
154
  };
155
+ export declare function listWorkbenchAgents(snapshot: WorkbenchSnapshot, catalog: {
156
+ drafts: readonly AgentDraft[];
157
+ releases: readonly AgentRelease[];
158
+ }, residents?: readonly ResidentAgentRef[]): {
159
+ developing: WorkbenchAgentRow[];
160
+ published: WorkbenchAgentRow[];
161
+ };
131
162
  export declare function getWorkbenchTask(snapshot: WorkbenchSnapshot, jobId: string): AcpTaskDetail;
@@ -1,4 +1,6 @@
1
1
  import { deliveryProgress } from './delivery-progress.js';
2
+ import { projectProcessRequest } from './process-request.js';
3
+ import { describeTaskDevelopment, projectWorkbenchAgents } from './agent-registry.js';
2
4
  const stageNames = { summary: '文稿生成', human_review: '人工审核', make: '设计制作', validate: '机器校验', review: '独立验收', finished: '交付完成' };
3
5
  const purposeNames = { project_script: '文稿生成', ppt_production: '设计制作', independent_review: '独立验收' };
4
6
  const terminal = new Set(['completed', 'failed', 'canceled', 'rejected']);
@@ -101,9 +103,10 @@ function safeArtifact(input) {
101
103
  if (!input || typeof input !== 'object')
102
104
  return undefined;
103
105
  const value = input;
104
- if (typeof value.url !== 'string' || !safeArtifact(value.url))
106
+ // Path-only artifacts (no url) are listed by name/path without a link; a present but unsafe url is still dropped.
107
+ if (value.url !== undefined ? typeof value.url !== 'string' || !safeArtifact(value.url) : typeof value.path !== 'string')
105
108
  return undefined;
106
- const result = { url: value.url };
109
+ const result = value.url !== undefined ? { url: value.url } : {};
107
110
  for (const key of ['name', 'path', 'mediaType', 'size', 'sha256'])
108
111
  if (['string', 'number'].includes(typeof value[key]))
109
112
  result[key] = value[key];
@@ -156,28 +159,94 @@ function progress(job, run, reviews, attempt, now) {
156
159
  executionElapsedMs: run.metrics.elapsedMs, humanWaitingMs: (human.humanWaitingMs ?? 0) + (human.humanWaitStartedAt && Number.isFinite(Date.parse(human.humanWaitStartedAt)) ? Math.max(0, now - Date.parse(human.humanWaitStartedAt)) : 0),
157
160
  availableResults: deliveryProgress(run).availableResults, updatedAt: run.updatedAt };
158
161
  }
159
- function summary(job, run, reviews, ledger, actorId) {
162
+ function pendingProcessRequest(requests, job, now) {
163
+ return requests.filter(request => request.jobId === job.jobId && request.attemptId === job.currentAttemptId)
164
+ .map(request => projectProcessRequest(request, now)).filter(request => request.status === 'pending')
165
+ .sort((a, b) => b.createdAt.localeCompare(a.createdAt))[0];
166
+ }
167
+ /** Same rule as the ledger view: acceptance counts only for the current completed result revision and digest. */
168
+ function currentAcceptance(job, ledger) {
169
+ const attempt = ledger.attempts[job.currentAttemptId], result = attempt?.result;
170
+ if (attempt?.executionStatus !== 'completed' || !result?.resultAvailable)
171
+ return undefined;
172
+ return (ledger.acceptances[job.jobId] ?? []).findLast(item => item.attemptId === attempt.attemptId
173
+ && item.resultRevision === result.resultRevision && item.resultDigest === result.resultDigest);
174
+ }
175
+ /** A tool is blocked when its latest request was not approved; an agent's retry that a person allowed clears it. */
176
+ function blockedTools(requests, job, now) {
177
+ if (job.executionStatus !== 'completed')
178
+ return [];
179
+ const latest = new Map();
180
+ for (const request of requests.filter(request => request.kind === 'permission' && request.jobId === job.jobId && request.attemptId === job.currentAttemptId)
181
+ .map(request => projectProcessRequest(request, now)).sort((a, b) => a.createdAt.localeCompare(b.createdAt))) {
182
+ latest.set(JSON.stringify([request.toolTitle ?? '', request.toolDetail ?? '']), request);
183
+ }
184
+ return [...latest.values()].filter(request => request.answer?.outcome !== 'approved')
185
+ .map(request => request.toolTitle ?? '').filter((name, index, all) => name && all.indexOf(name) === index);
186
+ }
187
+ function summary(job, run, reviews, ledger, actorId, requests, now) {
160
188
  const attempt = ledger.attempts[job.currentAttemptId], review = latestReview(reviews, job), pending = review?.status === 'pending' && !terminal.has(job.executionStatus) && (!run || !terminal.has(run.executionStatus));
189
+ const pendingRequest = terminal.has(job.executionStatus) ? undefined : pendingProcessRequest(requests, job, now);
161
190
  const awaitingResume = review?.resume?.status === 'pending' && !terminal.has(job.executionStatus);
162
191
  const resumeError = awaitingResume ? run?.diagnostics?.findLast(item => item.startsWith('Human continuation deferred:')) : undefined;
163
- const displayStatus = pending ? 'awaiting_human' : awaitingResume && !resumeError ? 'resuming' : review?.status === 'changes_requested' && !terminal.has(job.executionStatus) ? 'changes_requested' : job.executionStatus;
164
- const phase = pending ? 'human_review' : awaitingResume ? 'human_resume' : run?.phase ?? attempt?.phase ?? job.purpose ?? '';
192
+ const acceptance = currentAcceptance(job, ledger), blocked = blockedTools(requests, job, now);
193
+ const toolBlocked = blocked.length > 0 && acceptance?.reviewStatus !== 'accepted';
194
+ const unwatched = attempt?.unwatched && !terminal.has(job.executionStatus) ? attempt.unwatched : undefined;
195
+ const displayStatus = toolBlocked ? 'tool_blocked' : pending || pendingRequest ? 'awaiting_human' : unwatched ? 'unwatched' : awaitingResume && !resumeError ? 'resuming' : review?.status === 'changes_requested' && !terminal.has(job.executionStatus) ? 'changes_requested' : job.executionStatus;
196
+ const phase = pending ? 'human_review' : pendingRequest ? 'process_request' : awaitingResume ? 'human_resume' : run?.phase ?? attempt?.phase ?? job.purpose ?? '';
165
197
  const progressSummary = pending ? `${review.title}已形成,等待确认 ${review.revision};通过后开始设计制作。`
166
- : awaitingResume ? resumeError ? `决定已保存,继续执行受阻:${resumeError.slice('Human continuation deferred:'.length).trim()}` : '本版决定已保存,等待系统继续处理。'
167
- : review?.status === 'changes_requested' && !terminal.has(job.executionStatus) ? run?.summaryRevisionPending ? '修改意见已保存,正在提交原作者。' : '修改意见已提交原作者,等待新版本。'
168
- : attempt?.diagnostic || (run ? runDescription(run) : attempt?.result?.resultSummary || stateDescriptions[job.executionStatus] || '等待同步执行进展。');
198
+ : pendingRequest ? (pendingRequest.kind === 'plan' ? '计划待批准,请在过程请求里提交。' : pendingRequest.kind === 'permission' ? `工具「${pendingRequest.toolTitle}」待批准,请在过程请求里提交。` : '有待回答的问题,请在过程请求里提交。')
199
+ : awaitingResume ? resumeError ? `决定已保存,继续执行受阻:${resumeError.slice('Human continuation deferred:'.length).trim()}` : '本版决定已保存,等待系统继续处理。'
200
+ : review?.status === 'changes_requested' && !terminal.has(job.executionStatus) ? run?.summaryRevisionPending ? '修改意见已保存,正在提交原作者。' : '修改意见已提交原作者,等待新版本。'
201
+ : toolBlocked ? `执行已结束,但有 ${blocked.length} 个工具调用未获批准,结果可能不完整,请核对后再验收。`
202
+ : unwatched ? `发起方在 ${unwatched.at} 停止等待(${unwatched.reason})。任务可能仍在执行或已经结束,请重新查询执行宿主。`
203
+ : attempt?.diagnostic || (run ? runDescription(run) : attempt?.result?.resultSummary || stateDescriptions[job.executionStatus] || '等待同步执行进展。');
204
+ const execution = executionView(attempt, job.targetId, Boolean(run));
205
+ const development = describeTaskDevelopment(attempt?.targetSnapshot?.development, { targetId: job.targetId, resident: execution.kind === 'resident', residentName: execution.targetName });
169
206
  return { sourceId: job.sourceId, jobId: job.jobId, title: job.title ?? `${purposeNames[job.purpose ?? ''] ?? '执行任务'} ${job.jobId.slice(0, 8)}`,
207
+ channel: development.channel, ...(development.agentId ? { agentId: development.agentId, agentName: development.name, agentPhase: development.phase } : {}),
170
208
  originSessionId: job.originSessionId, ...(job.parentJobRef ? { parentJobRef: job.parentJobRef } : {}), ...(job.parentAttemptId ? { parentAttemptId: job.parentAttemptId } : {}),
171
209
  ...(job.purpose ? { purpose: job.purpose } : {}), targetId: job.targetId, currentAttemptId: job.currentAttemptId, executionStatus: job.executionStatus, displayStatus, phase,
172
- createdAt: job.createdAt, updatedAt: review && review.updatedAt > job.updatedAt ? review.updatedAt : job.updatedAt, stale: attempt?.stale ?? true,
173
- inFlightAttemptIds: [...job.inFlightAttemptIds], unresolvedAttemptIds: [...job.unresolvedAttemptIds], execution: executionView(attempt, job.targetId, Boolean(run)),
174
- ...(review ? { reviewStatus: review.status } : {}), ...(pending && review.reviewerId === actorId ? { pendingReviewId: review.reviewId } : {}), progressSummary };
210
+ createdAt: job.createdAt, updatedAt: [job.updatedAt, review?.updatedAt, pendingRequest?.updatedAt].filter((value) => Boolean(value)).sort().at(-1), stale: attempt?.stale ?? true,
211
+ inFlightAttemptIds: [...job.inFlightAttemptIds], unresolvedAttemptIds: [...job.unresolvedAttemptIds], execution,
212
+ ...(review ? { reviewStatus: review.status } : {}), ...(pending && review.reviewerId === actorId ? { pendingReviewId: review.reviewId } : {}),
213
+ ...(pendingRequest ? { pendingProcessRequestId: pendingRequest.requestId } : {}), progressSummary,
214
+ ...(acceptance ? { businessAcceptance: structuredClone(acceptance) } : {}), ...(blocked.length ? { blockedTools: blocked } : {}),
215
+ ...(job.executionStatus === 'failed' && !run && !job.parentJobRef && !job.unresolvedAttemptIds.length ? { canContinue: true } : {}),
216
+ ...(job.executionStatus === 'completed' && !run && !job.parentJobRef && !acceptance && attempt?.result?.resultAvailable && attempt.result.resultRevision && attempt.result.resultDigest ? { canAccept: true } : {}),
217
+ ...(job.initiatedBy ? { initiatedBy: job.initiatedBy } : {}) };
218
+ }
219
+ function bubbleProcessWait(summaries) {
220
+ const tasks = [...summaries.values()];
221
+ for (let depth = 0; depth < 5; depth++) {
222
+ let changed = false;
223
+ for (const task of tasks) {
224
+ if (task.pendingReviewId || task.pendingProcessRequestId || terminal.has(task.executionStatus))
225
+ continue;
226
+ const child = tasks.filter(item => item.parentJobRef?.jobId === task.jobId && item.pendingProcessRequestId).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))[0];
227
+ if (!child?.pendingProcessRequestId)
228
+ continue;
229
+ task.pendingProcessRequestId = child.pendingProcessRequestId;
230
+ if (!['awaiting_human', 'resuming', 'changes_requested'].includes(task.displayStatus)) {
231
+ task.displayStatus = 'awaiting_human';
232
+ task.phase = 'process_request';
233
+ task.progressSummary = child.progressSummary;
234
+ if (child.updatedAt > task.updatedAt)
235
+ task.updatedAt = child.updatedAt;
236
+ }
237
+ changed = true;
238
+ }
239
+ if (!changed)
240
+ break;
241
+ }
175
242
  }
176
243
  export function workbenchSnapshot(source) {
177
244
  const { ledger, actorId } = source, allowed = source.allowedOrigins ? new Set(source.allowedOrigins) : undefined;
178
245
  const jobs = Object.values(ledger.jobs).filter(job => !allowed || allowed.has(job.originSessionId));
179
246
  const visible = new Set(jobs.map(job => job.jobId)), runFor = (job) => source.runs.find(run => run.jobId === job.jobId && run.attemptId === job.currentAttemptId);
180
- const summaries = new Map(jobs.map(job => [job.jobId, summary(job, runFor(job), source.reviews, ledger, actorId)]));
247
+ const now = source.now ?? Date.now();
248
+ const summaries = new Map(jobs.map(job => [job.jobId, summary(job, runFor(job), source.reviews, ledger, actorId, source.processRequests ?? [], now)]));
249
+ bubbleProcessWait(summaries);
181
250
  const details = {};
182
251
  for (const job of jobs) {
183
252
  const run = runFor(job), ownReviews = source.reviews.filter(r => r.jobId === job.jobId || r.authorJobId === job.jobId && visible.has(r.jobId));
@@ -211,13 +280,24 @@ export function workbenchSnapshot(source) {
211
280
  const attempts = Object.values(ledger.attempts).filter(attempt => attempt.jobId === job.jobId)
212
281
  .map(attempt => attemptView(attempt, source.runs.some(item => item.jobId === job.jobId && item.attemptId === attempt.attemptId)));
213
282
  if (!run)
214
- for (const attempt of attempts)
215
- if (attempt.result?.artifactLinks.length)
216
- artifacts.push({ revision: attempt.result.resultRevision ?? attempt.attemptId, digest: attempt.result.resultDigest, artifacts: attempt.result.artifactLinks });
283
+ for (const attempt of attempts) {
284
+ const pathOnly = (attempt.result?.resultArtifacts ?? []).filter(item => !item.url);
285
+ const links = [...(attempt.result?.artifactLinks ?? []), ...pathOnly];
286
+ if (links.length)
287
+ artifacts.push({ revision: attempt.result.resultRevision ?? attempt.attemptId, digest: attempt.result.resultDigest, artifacts: links });
288
+ }
217
289
  const humanEvents = ownReviews.flatMap(review => review.history.map((decision, index) => ({ eventId: decision.decisionId, sourceId: ledger.sourceId, sequence: -(index + 1), jobId: review.jobId,
218
290
  attemptId: review.attemptId, jobVersion: 0, type: `human_review.${decision.action}`, observedAt: decision.at,
219
291
  data: { reviewId: review.reviewId, revision: review.revision, actor: decision.actor, ...(decision.note ? { note: decision.note } : {}) } })));
220
- details[job.jobId] = { ...summaries.get(job.jobId), attempts, children, ancestors, progress: progress(job, run, source.reviews, ledger.attempts[job.currentAttemptId], source.now ?? Date.now()),
292
+ const asked = Object.values(ledger.attempts).filter(attempt => attempt.jobId === job.jobId)
293
+ .sort((a, b) => (a.createdAt ?? '').localeCompare(b.createdAt ?? ''))[0]?.input;
294
+ const description = typeof asked?.prompt === 'string' && asked.prompt.trim() ? asked.prompt.slice(0, 20_000) : undefined;
295
+ details[job.jobId] = { ...summaries.get(job.jobId), ...(description ? { description } : {}), attempts, children, ancestors, progress: progress(job, run, source.reviews, ledger.attempts[job.currentAttemptId], source.now ?? Date.now()),
296
+ processRequests: (source.processRequests ?? []).filter(request => request.jobId === job.jobId || children.some(child => child.jobId === request.jobId)).map(request => {
297
+ const projected = projectProcessRequest(request, now);
298
+ const owner = ledger.jobs[request.jobId];
299
+ return { ...projected, canAnswer: projected.status === 'pending' && owner?.currentAttemptId === request.attemptId && !terminal.has(owner.executionStatus) };
300
+ }),
221
301
  reviews: ownReviews.map(review => {
222
302
  const ownerRun = source.runs.find(item => item.jobId === review.jobId && item.attemptId === review.attemptId);
223
303
  const resumeError = review.resume?.status === 'pending' ? ownerRun?.diagnostics?.findLast(item => item.startsWith('Human continuation deferred:')) : undefined;
@@ -232,6 +312,10 @@ export function workbenchSnapshot(source) {
232
312
  const detail = details[report.jobId], task = summaries.get(report.jobId);
233
313
  if (!detail || !task || detail.currentAttemptId !== report.attemptId)
234
314
  continue;
315
+ delete task.canContinue;
316
+ delete detail.canContinue;
317
+ delete task.canAccept;
318
+ delete detail.canAccept;
235
319
  const pending = report.humanReviews.at(-1), author = report.child;
236
320
  const stages = [
237
321
  { stage: 'research', name: '临时智能体分析', status: author ? ledger.attempts[author.attemptId]?.executionStatus ?? 'unknown' : 'not_started', planned: !author,
@@ -239,8 +323,10 @@ export function workbenchSnapshot(source) {
239
323
  { stage: 'file_check', name: '报告文件检查', status: report.fileCheck ? report.fileCheck.passed ? 'completed' : 'failed' : 'not_started', planned: !report.fileCheck },
240
324
  { stage: 'human_review', name: '人工最终确认', status: pending?.status ?? 'not_started', planned: !pending, jobId: report.jobId, attemptId: report.attemptId },
241
325
  ];
242
- task.progressSummary = report.resultSummary ?? '临时智能体正在分析项目,输出报告后进行文件检查与人工最终确认。';
243
- detail.progressSummary = task.progressSummary;
326
+ if (!detail.pendingProcessRequestId) {
327
+ task.progressSummary = report.resultSummary ?? '临时智能体正在分析项目,输出报告后进行文件检查与人工最终确认。';
328
+ detail.progressSummary = task.progressSummary;
329
+ }
244
330
  detail.progress = { stage: report.stage, phase: report.phase, stages,
245
331
  completedStages: stages.filter(stage => ['completed', 'approved'].includes(stage.status)).map(stage => stage.name),
246
332
  remainingStages: stages.filter(stage => !['completed', 'approved'].includes(stage.status)).map(stage => stage.name), updatedAt: report.updatedAt };
@@ -250,13 +336,18 @@ export function workbenchSnapshot(source) {
250
336
  export function listWorkbenchTasks(snapshot, query = {}) {
251
337
  const filter = query.filter ?? 'all', offset = Math.max(0, Math.trunc(query.offset ?? 0)), limit = Math.min(200, Math.max(1, Math.trunc(query.limit ?? 50)));
252
338
  const rootIds = new Set(snapshot.tasks.filter(task => !task.parentJobRef || !Object.hasOwn(snapshot.details, task.parentJobRef.jobId)).map(task => task.jobId));
253
- const isWorking = (task) => task.displayStatus === 'resuming' || !task.pendingReviewId && ['working', 'submitted', 'not_started'].includes(task.executionStatus);
254
- const isFailed = (task) => task.unresolvedAttemptIds.length > 0 || ['failed', 'rejected', 'unknown', 'auth_required', 'input_required'].includes(task.executionStatus) && !['awaiting_human', 'resuming'].includes(task.displayStatus);
339
+ const needsPerson = (task) => Boolean(task.pendingReviewId || task.pendingProcessRequestId);
340
+ const isWorking = (task) => task.displayStatus === 'resuming' || !needsPerson(task) && task.displayStatus !== 'unwatched' && ['working', 'submitted', 'not_started'].includes(task.executionStatus);
341
+ const isFailed = (task) => task.unresolvedAttemptIds.length > 0 || task.displayStatus === 'tool_blocked' || task.displayStatus === 'unwatched' || ['failed', 'rejected', 'unknown', 'auth_required', 'input_required'].includes(task.executionStatus) && !['awaiting_human', 'resuming'].includes(task.displayStatus);
255
342
  const roots = snapshot.tasks.filter(task => rootIds.has(task.jobId));
256
- const counts = { all: roots.length, pending: roots.filter(task => Boolean(task.pendingReviewId)).length, working: roots.filter(isWorking).length, failed: roots.filter(isFailed).length };
257
- const matches = snapshot.tasks.filter(task => filter === 'all' ? true : filter === 'pending' ? Boolean(task.pendingReviewId) : filter === 'working' ? isWorking(task) : isFailed(task));
343
+ const counts = { all: roots.length, pending: roots.filter(needsPerson).length, working: roots.filter(isWorking).length, failed: roots.filter(isFailed).length };
344
+ const matches = snapshot.tasks.filter(task => filter === 'all' ? true : filter === 'pending' ? needsPerson(task) : filter === 'working' ? isWorking(task) : isFailed(task));
258
345
  return { items: structuredClone(matches.slice(offset, offset + limit)), total: matches.length, counts, offset, limit };
259
346
  }
347
+ export function listWorkbenchAgents(snapshot, catalog, residents = []) {
348
+ const tasks = snapshot.tasks.map(task => ({ ...(task.agentId ? { agentId: task.agentId } : {}), ...(task.pendingReviewId ? { pendingReviewId: task.pendingReviewId } : {}), ...(task.pendingProcessRequestId ? { pendingProcessRequestId: task.pendingProcessRequestId } : {}) }));
349
+ return projectWorkbenchAgents({ ...catalog, residents }, tasks);
350
+ }
260
351
  export function getWorkbenchTask(snapshot, jobId) {
261
352
  const detail = Object.hasOwn(snapshot.details, jobId) ? snapshot.details[jobId] : undefined;
262
353
  if (!detail)
@@ -1 +1 @@
1
- export { resolveRoleSkills, roleSkillProfileSchema, roleSkillLockSchema, skillContentRevision, type RoleSkillProfile, type RoleSkillLock } from './skills.js';
1
+ export { loadRoleSkills, syncRoleSkills, linkClaudeSkills, roleSkillProfileSchema, SKILLS_DIRECTORY, CLAUDE_SKILLS_DIRECTORY, type RoleSkillProfile, type RoleSkillsLoad } from './skills.js';
@@ -1 +1 @@
1
- export { resolveRoleSkills, roleSkillProfileSchema, roleSkillLockSchema, skillContentRevision } from './skills.js';
1
+ export { loadRoleSkills, syncRoleSkills, linkClaudeSkills, roleSkillProfileSchema, SKILLS_DIRECTORY, CLAUDE_SKILLS_DIRECTORY } from './skills.js';
@@ -3,69 +3,38 @@ export declare const roleSkillProfileSchema: z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  version: z.ZodString;
5
5
  instructionsPath: z.ZodOptional<z.ZodString>;
6
- network: z.ZodObject<{
7
- agentUrl: z.ZodString;
8
- timeoutMs: z.ZodDefault<z.ZodNumber>;
9
- }, z.core.$strict>;
10
6
  skills: z.ZodArray<z.ZodObject<{
11
7
  key: z.ZodString;
12
8
  name: z.ZodString;
13
- nodeUrl: z.ZodOptional<z.ZodString>;
14
- skillId: z.ZodOptional<z.ZodString>;
15
- sourceId: z.ZodOptional<z.ZodString>;
16
- assetsManifest: z.ZodOptional<z.ZodString>;
17
9
  }, z.core.$strict>>;
18
10
  entrySkill: z.ZodOptional<z.ZodString>;
19
11
  }, z.core.$strict>;
20
12
  export type RoleSkillProfile = z.infer<typeof roleSkillProfileSchema>;
21
- export declare const roleSkillLockSchema: z.ZodObject<{
22
- schemaVersion: z.ZodLiteral<1>;
23
- roleId: z.ZodString;
24
- roleVersion: z.ZodString;
25
- profilePath: z.ZodString;
26
- profileSha256: z.ZodString;
27
- cacheRoot: z.ZodString;
28
- roleDirectory: z.ZodString;
29
- createdAt: z.ZodString;
30
- instructionsPath: z.ZodOptional<z.ZodString>;
31
- instructionsSha256: z.ZodOptional<z.ZodString>;
32
- instructionsBytes: z.ZodOptional<z.ZodNumber>;
33
- entrySkill: z.ZodOptional<z.ZodString>;
34
- entryGuidePath: z.ZodOptional<z.ZodString>;
35
- skills: z.ZodArray<z.ZodObject<{
36
- key: z.ZodString;
37
- nodeUrl: z.ZodString;
38
- skillId: z.ZodString;
39
- sourceId: z.ZodString;
40
- name: z.ZodString;
41
- revision: z.ZodString;
42
- cacheDirectory: z.ZodString;
43
- directory: z.ZodString;
44
- guidePath: z.ZodString;
45
- guideResource: z.ZodString;
46
- files: z.ZodArray<z.ZodObject<{
47
- path: z.ZodString;
48
- bytes: z.ZodNumber;
49
- sha256: z.ZodString;
50
- }, z.core.$strict>>;
51
- assets: z.ZodArray<z.ZodObject<{
52
- path: z.ZodString;
53
- bytes: z.ZodNumber;
54
- sha256: z.ZodString;
55
- url: z.ZodString;
56
- }, z.core.$strict>>;
57
- }, z.core.$strict>>;
58
- }, z.core.$strict>;
59
- export type RoleSkillLock = z.infer<typeof roleSkillLockSchema>;
60
- /** Same content revision as Skill Manager: paths sorted by UTF-8 bytes, then path\0length\0 + file bytes. */
61
- export declare function skillContentRevision(files: {
62
- path: string;
63
- bytes: Uint8Array;
64
- }[]): string;
65
- /** New lock => latest catalogue revisions; existing lock => checked, fully offline reuse even if the source/profile changed. */
66
- export declare function resolveRoleSkills(options: {
13
+ export declare const SKILLS_DIRECTORY = ".agents/skills";
14
+ export declare const CLAUDE_SKILLS_DIRECTORY = ".claude/skills";
15
+ export interface RoleSkillsLoad {
16
+ roleId: string;
17
+ roleVersion: string;
18
+ roleDirectory: string;
19
+ instructions: string;
20
+ entryGuidePath?: string;
21
+ skills: {
22
+ key: string;
23
+ name: string;
24
+ directory: string;
25
+ guidePath: string;
26
+ }[];
27
+ }
28
+ /** Make `.claude/skills` reach `.agents/skills`. An existing real `.claude/skills` directory only gains links for the named skills. */
29
+ export declare function linkClaudeSkills(cwd: string, names: string[]): Promise<void>;
30
+ /** Check that every skill the profile names is present under `<cwd>/.agents/skills`, link it for Claude Code and return what the prompt needs. */
31
+ export declare function loadRoleSkills(options: {
32
+ profilePath: string;
33
+ cwd: string;
34
+ }): Promise<RoleSkillsLoad>;
35
+ /** Copy the profile's skills from a distribution directory into `<cwd>/.agents/skills`, then verify and link them. No network, no model. */
36
+ export declare function syncRoleSkills(options: {
67
37
  profilePath: string;
68
- cacheRoot: string;
69
- lockPath: string;
70
- signal?: AbortSignal;
71
- }): Promise<RoleSkillLock>;
38
+ source: string;
39
+ cwd: string;
40
+ }): Promise<RoleSkillsLoad>;