@kingsoftcloud/ksadk-web 0.3.12 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +7 -4
  3. package/RELEASE_PROVENANCE.json +2 -2
  4. package/dist-ksadk/assets/{ArtifactsPanel-C1YoaKhx.js → ArtifactsPanel-CILaW-fC.js} +1 -1
  5. package/dist-ksadk/assets/{CodeBlock-DHuAWfr5.js → CodeBlock-BVrNVtJC.js} +1 -1
  6. package/dist-ksadk/assets/{MathMessageMarkdown-cvdrBwYr.js → MathMessageMarkdown-Dp7c4wWD.js} +1 -1
  7. package/dist-ksadk/assets/{MermaidBlock-DeBkbJvI.js → MermaidBlock-Dxop8Rd7.js} +6 -6
  8. package/dist-ksadk/assets/{NativeTerminalPanel-oJj44_sV.js → NativeTerminalPanel-Cjjz8B30.js} +1 -1
  9. package/dist-ksadk/assets/{abnfDiagram-VCTEODGH-Dhfv25o2.js → abnfDiagram-VCTEODGH-ckWDmOzw.js} +1 -1
  10. package/dist-ksadk/assets/{arc-C35w-pn1.js → arc-DqxJede-.js} +1 -1
  11. package/dist-ksadk/assets/architecture-7GRP2DOG-pn_DuLy6.js +1 -0
  12. package/dist-ksadk/assets/{architectureDiagram-5GKGNRK7-FoMY_u6D.js → architectureDiagram-5GKGNRK7-SEQA4bVi.js} +1 -1
  13. package/dist-ksadk/assets/{blockDiagram-NRAW4CY4-zD4Rt7oE.js → blockDiagram-NRAW4CY4-pM0B-6NJ.js} +1 -1
  14. package/dist-ksadk/assets/{c4Diagram-UCG6FXSJ-BCtGGkhN.js → c4Diagram-UCG6FXSJ-m2tuCNVq.js} +1 -1
  15. package/dist-ksadk/assets/channel-fySsnkft.js +1 -0
  16. package/dist-ksadk/assets/chunk-2Q5K7J3B-BheGxKRQ.js +1 -0
  17. package/dist-ksadk/assets/{chunk-5VM5RSS4-C2Ms13_k.js → chunk-5VM5RSS4-GJHDr9Ww.js} +1 -1
  18. package/dist-ksadk/assets/{chunk-F27PBJKO-BoTj-qgx.js → chunk-F27PBJKO-CbAN45AV.js} +1 -1
  19. package/dist-ksadk/assets/{chunk-G27WJ6UU-DOMyyjHH.js → chunk-G27WJ6UU-D5ngbbzF.js} +1 -1
  20. package/dist-ksadk/assets/{chunk-JWPE2WC7-DbJJqDli.js → chunk-JWPE2WC7-Cc5IwuYC.js} +1 -1
  21. package/dist-ksadk/assets/{chunk-LCL6LL3I-CLuRCt_W.js → chunk-LCL6LL3I-CprgDDdJ.js} +1 -1
  22. package/dist-ksadk/assets/{chunk-POPQ4Y6H-D0Dz847e.js → chunk-POPQ4Y6H-CDZhSy82.js} +1 -1
  23. package/dist-ksadk/assets/{chunk-RHFEMEQ7-BWSRzEcd.js → chunk-RHFEMEQ7-CZchUNro.js} +1 -1
  24. package/dist-ksadk/assets/{chunk-SVP7TREG-CPoHqkCY.js → chunk-SVP7TREG-BVruqk6T.js} +1 -1
  25. package/dist-ksadk/assets/{chunk-XXDRQBXY-Bx1jS-X-.js → chunk-XXDRQBXY-4ld9SxPN.js} +1 -1
  26. package/dist-ksadk/assets/classDiagram-DTDB5LWJ-DSfLtNYm.js +1 -0
  27. package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-DSfLtNYm.js +1 -0
  28. package/dist-ksadk/assets/{cose-bilkent-JH36ORCC-LzyWm4m0.js → cose-bilkent-JH36ORCC-Dmyyk_Vp.js} +1 -1
  29. package/dist-ksadk/assets/cynefin-OW5HDTMX-PFWIGtvA.js +1 -0
  30. package/dist-ksadk/assets/{cynefinDiagram-5FMLGOSQ-BlW_bHED.js → cynefinDiagram-5FMLGOSQ-BIyq3EJb.js} +1 -1
  31. package/dist-ksadk/assets/{dagre-3AP2YEHR-Bu_S86_i.js → dagre-3AP2YEHR-eBw08Qdk.js} +1 -1
  32. package/dist-ksadk/assets/{dagre-B7nCawed.js → dagre-DfvnEf45.js} +1 -1
  33. package/dist-ksadk/assets/{diagram-S7CK7UJ4-W_Zow2Km.js → diagram-S7CK7UJ4-CUSrE3Mg.js} +1 -1
  34. package/dist-ksadk/assets/{diagram-UQ7AKVKN-CLIKAHON.js → diagram-UQ7AKVKN-Dq5Zw2gy.js} +1 -1
  35. package/dist-ksadk/assets/{diagram-VSXAHHWV-Dv6_QAlN.js → diagram-VSXAHHWV-DyUHfNwT.js} +1 -1
  36. package/dist-ksadk/assets/{diagram-VX7I27RA-BWAWRDtZ.js → diagram-VX7I27RA-CREmM89O.js} +1 -1
  37. package/dist-ksadk/assets/{diagram-Z3DM3KII-XA_rWMss.js → diagram-Z3DM3KII-Dw9zhHUK.js} +1 -1
  38. package/dist-ksadk/assets/{dist-CGt_UGeO.js → dist-0uJ4tdx6.js} +1 -1
  39. package/dist-ksadk/assets/{dist-C0J5_3qM.js → dist-AEv-vXf-.js} +1 -1
  40. package/dist-ksadk/assets/{dist-CIpWk_5f.js → dist-B49GzZDb.js} +1 -1
  41. package/dist-ksadk/assets/{dist-B3bA05-e.js → dist-B8Myiet9.js} +1 -1
  42. package/dist-ksadk/assets/{dist-DWfdmz9s.js → dist-BBsYarrI.js} +1 -1
  43. package/dist-ksadk/assets/{dist-BLpRy_Yx.js → dist-BQMrUwdI.js} +1 -1
  44. package/dist-ksadk/assets/{dist-CIRMvUM4.js → dist-BX_-FENW.js} +1 -1
  45. package/dist-ksadk/assets/{dist-BdNFAney.js → dist-CD4L6ymH.js} +1 -1
  46. package/dist-ksadk/assets/{dist-n3n6t_FO.js → dist-CHpW1BHj.js} +1 -1
  47. package/dist-ksadk/assets/{dist-DppE_r-D.js → dist-CVPau3tn.js} +1 -1
  48. package/dist-ksadk/assets/{dist-qe8xjesy.js → dist-C_qdxcSH.js} +1 -1
  49. package/dist-ksadk/assets/{dist-2vL2sAdF.js → dist-Co68Apq4.js} +1 -1
  50. package/dist-ksadk/assets/{dist-1nXCdsej.js → dist-Cp2PaOMY.js} +1 -1
  51. package/dist-ksadk/assets/{dist-DNKuMzWc.js → dist-CuR5Bgme.js} +1 -1
  52. package/dist-ksadk/assets/{dist-t6MzE0jU.js → dist-DDSyLEOX.js} +1 -1
  53. package/dist-ksadk/assets/{dist-CPyieXEf.js → dist-DUxO0R99.js} +1 -1
  54. package/dist-ksadk/assets/{dist-DyG6Ya-z.js → dist-QzbGrED_.js} +1 -1
  55. package/dist-ksadk/assets/{dist-0X_j2Rcc.js → dist-bupkyEBZ.js} +1 -1
  56. package/dist-ksadk/assets/{dist-mqD5TZup.js → dist-cxTGfdqx.js} +1 -1
  57. package/dist-ksadk/assets/{dist-M-SrdhhZ.js → dist-hL5p1til.js} +1 -1
  58. package/dist-ksadk/assets/{dist-D-92S-Fd.js → dist-lOy23y43.js} +1 -1
  59. package/dist-ksadk/assets/{dist-BO_UwatH.js → dist-pq-nD33R.js} +1 -1
  60. package/dist-ksadk/assets/{ebnfDiagram-PWID7BFC-BfCzF1Xi.js → ebnfDiagram-PWID7BFC-BS5LdNoR.js} +1 -1
  61. package/dist-ksadk/assets/{erDiagram-SSCWMZ5O-Dpz9_0zn.js → erDiagram-SSCWMZ5O-Bv1QtiY-.js} +1 -1
  62. package/dist-ksadk/assets/eventmodeling-NTZA5JFV-DsM4upQX.js +1 -0
  63. package/dist-ksadk/assets/flowDiagram-A5DVABFB-D5NA16k9.js +1 -0
  64. package/dist-ksadk/assets/{ganttDiagram-EL5Y4UJY-DDaG1f4_.js → ganttDiagram-EL5Y4UJY-musi-e0G.js} +1 -1
  65. package/dist-ksadk/assets/gitGraph-4MIJSDKK-DUCVz-ih.js +1 -0
  66. package/dist-ksadk/assets/{gitGraphDiagram-WWUBYQGX-DcxzRwYC.js → gitGraphDiagram-WWUBYQGX-DH37EGkG.js} +1 -1
  67. package/dist-ksadk/assets/index-CZdkAvsv.js +244 -0
  68. package/dist-ksadk/assets/index-CvXdHgF3.css +2 -0
  69. package/dist-ksadk/assets/info-A6RAGUB7-rw0ZNHZp.js +1 -0
  70. package/dist-ksadk/assets/{infoDiagram-RXCK75RN-CYMdn6lQ.js → infoDiagram-RXCK75RN-C1kEtv2y.js} +1 -1
  71. package/dist-ksadk/assets/{ishikawaDiagram-5VMMS53U-CLHFAD6c.js → ishikawaDiagram-5VMMS53U-BCNPyMka.js} +1 -1
  72. package/dist-ksadk/assets/{journeyDiagram-EYS64GPL-BHSKQGAl.js → journeyDiagram-EYS64GPL--cDbKnjP.js} +1 -1
  73. package/dist-ksadk/assets/{kanban-definition-3QL26DDD-D5W3tjTT.js → kanban-definition-3QL26DDD-R1rAVw2f.js} +1 -1
  74. package/dist-ksadk/assets/{katex-mtjOi4KM.js → katex-BT-X-V7U.js} +1 -1
  75. package/dist-ksadk/assets/{linear-BETqsxE_.js → linear-DTR631iG.js} +1 -1
  76. package/dist-ksadk/assets/{mermaid-parser.core-DPWrvs90.js → mermaid-parser.core-DfFzJhX8.js} +2 -2
  77. package/dist-ksadk/assets/{mindmap-definition-FBJOCRG2-CJG2mfBP.js → mindmap-definition-FBJOCRG2-D4by_rmk.js} +1 -1
  78. package/dist-ksadk/assets/packet-AYTQ26CC-Ca4Hvki9.js +1 -0
  79. package/dist-ksadk/assets/{pegDiagram-XKGWAZYB-GjAPNaqn.js → pegDiagram-XKGWAZYB-xWXPEh0c.js} +1 -1
  80. package/dist-ksadk/assets/pie-WAS4IAKB-hwiz6fbw.js +1 -0
  81. package/dist-ksadk/assets/{pieDiagram-E7YTZNPT-ToIewrqr.js → pieDiagram-E7YTZNPT-BudBDlCI.js} +1 -1
  82. package/dist-ksadk/assets/{quadrantDiagram-AXDQQJYC-4d78KiEY.js → quadrantDiagram-AXDQQJYC-DXZ0PCJF.js} +1 -1
  83. package/dist-ksadk/assets/radar-RG4KPBEZ-BR1oZXLM.js +1 -0
  84. package/dist-ksadk/assets/railroad-74A4TZTK-DfgEISfX.js +1 -0
  85. package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-CWOC3rdk.js +1 -0
  86. package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-CiRvHCLY.js +1 -0
  87. package/dist-ksadk/assets/railroad-peg-WCYAUIDC-DSDDyJ2f.js +1 -0
  88. package/dist-ksadk/assets/{railroadDiagram-O6MQD6OU-DKzx4xfv.js → railroadDiagram-O6MQD6OU-BdAYRYB8.js} +1 -1
  89. package/dist-ksadk/assets/{requirementDiagram-EFPCY7ZU-CJYljxQS.js → requirementDiagram-EFPCY7ZU-CBBmaL70.js} +1 -1
  90. package/dist-ksadk/assets/{sankeyDiagram-P5KCCOFB-DLU2fV1w.js → sankeyDiagram-P5KCCOFB-Doc3rdwp.js} +1 -1
  91. package/dist-ksadk/assets/{sequenceDiagram-WJ2MYXX4-CVqysrA9.js → sequenceDiagram-WJ2MYXX4-0J8R8hWW.js} +1 -1
  92. package/dist-ksadk/assets/{sizeCapture-X5ZJPWSS-BUxfmTHc.js → sizeCapture-X5ZJPWSS-CfFLlWsK.js} +1 -1
  93. package/dist-ksadk/assets/{stateDiagram-HBIQ2CUA-CNFgYI9E.js → stateDiagram-HBIQ2CUA-jBwkjtTy.js} +1 -1
  94. package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-Cw1fPb5w.js +1 -0
  95. package/dist-ksadk/assets/{swimlanes-XN3QIQJK-B6qCMe8N.js → swimlanes-XN3QIQJK-B0WxTQf8.js} +1 -1
  96. package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-Cc3JMBAF.js +8 -0
  97. package/dist-ksadk/assets/{timeline-definition-24CTP7MA-CMD3x_U_.js → timeline-definition-24CTP7MA-BfCT_75A.js} +1 -1
  98. package/dist-ksadk/assets/treeView-Q6P3EWNA-C05SJHxo.js +1 -0
  99. package/dist-ksadk/assets/treemap-WGGIJYW6-BqNLAhc3.js +1 -0
  100. package/dist-ksadk/assets/{vennDiagram-4TSXK5OY-BqtUqvXM.js → vennDiagram-4TSXK5OY-9gX1VMDC.js} +1 -1
  101. package/dist-ksadk/assets/wardley-WFR3VGLG-DokNktqB.js +1 -0
  102. package/dist-ksadk/assets/{wardleyDiagram-VM6X3IG4-B5KfDjI-.js → wardleyDiagram-VM6X3IG4-sEs_BP6O.js} +1 -1
  103. package/dist-ksadk/assets/{xychartDiagram-S5SC5T6Z-BaUlSZrn.js → xychartDiagram-S5SC5T6Z-Ll4jvUN9.js} +1 -1
  104. package/dist-ksadk/index.html +2 -2
  105. package/dist-lib/App.d.ts.map +1 -1
  106. package/dist-lib/{AttachmentPreview-HLpbjOnQ.js → AttachmentPreview-lufx89xJ.js} +174 -174
  107. package/dist-lib/{ConnectedComposer-CeWPgOn2.js → ConnectedComposer-Dd8ZFhfL.js} +214 -213
  108. package/dist-lib/{ConnectedMessageList-D3HWHCh2.js → ConnectedMessageList-CzTOJbZU.js} +582 -510
  109. package/dist-lib/{InteractionSchemaForm-Du9NT4E8.js → InteractionSchemaForm-ChYkHPop.js} +88 -71
  110. package/dist-lib/{WorkspacePanelContainer-B2mk7udj.js → WorkspacePanelContainer-BDbgHg1_.js} +2 -2
  111. package/dist-lib/{a2ui-BEQoW34n.js → a2ui-DfAshhMK.js} +8 -3
  112. package/dist-lib/api/messages.d.ts +88 -0
  113. package/dist-lib/api/messages.d.ts.map +1 -0
  114. package/dist-lib/chat-composer.js +2 -2
  115. package/dist-lib/chat-timeline.js +3 -3
  116. package/dist-lib/{cloudMaterials-BlIAT-PA.js → cloudMaterials-D75jTrkQ.js} +823 -628
  117. package/dist-lib/components/chat/AgentBlockView.d.ts +9 -0
  118. package/dist-lib/components/chat/AgentBlockView.d.ts.map +1 -0
  119. package/dist-lib/components/chat/ChatComposer.d.ts.map +1 -1
  120. package/dist-lib/components/chat/ChatMessageList.d.ts +4 -2
  121. package/dist-lib/components/chat/ChatMessageList.d.ts.map +1 -1
  122. package/dist-lib/components/chat/ConnectedComposer.d.ts +1 -1
  123. package/dist-lib/components/chat/ConnectedComposer.d.ts.map +1 -1
  124. package/dist-lib/components/chat/ConnectedMessageList.d.ts +4 -1
  125. package/dist-lib/components/chat/ConnectedMessageList.d.ts.map +1 -1
  126. package/dist-lib/components/chat/InteractionSchemaForm.d.ts.map +1 -1
  127. package/dist-lib/components/chat/InteractionTray.d.ts.map +1 -1
  128. package/dist-lib/components/chat/ProcessingBlocksView.d.ts +2 -2
  129. package/dist-lib/components/chat/ProcessingBlocksView.d.ts.map +1 -1
  130. package/dist-lib/components/chat/StatusBanner.d.ts.map +1 -1
  131. package/dist-lib/components/chat/approval-status.d.ts +5 -0
  132. package/dist-lib/components/chat/approval-status.d.ts.map +1 -0
  133. package/dist-lib/components/chat/types.d.ts +13 -1
  134. package/dist-lib/components/chat/types.d.ts.map +1 -1
  135. package/dist-lib/components/teams/CloudTeamWorkspace.d.ts.map +1 -1
  136. package/dist-lib/components/teams/TeamWorkspace.d.ts.map +1 -1
  137. package/dist-lib/components.js +6 -6
  138. package/dist-lib/conversation.js +8 -34
  139. package/dist-lib/core/api/facade.d.ts +18 -10
  140. package/dist-lib/core/api/facade.d.ts.map +1 -1
  141. package/dist-lib/core/api/types.d.ts +28 -3
  142. package/dist-lib/core/api/types.d.ts.map +1 -1
  143. package/dist-lib/core/conversation/agent.d.ts +49 -0
  144. package/dist-lib/core/conversation/agent.d.ts.map +1 -0
  145. package/dist-lib/core/conversation/client.d.ts +2 -0
  146. package/dist-lib/core/conversation/client.d.ts.map +1 -1
  147. package/dist-lib/core/conversation/contracts.d.ts.map +1 -1
  148. package/dist-lib/core/conversation/hosted.d.ts.map +1 -1
  149. package/dist-lib/core/conversation/index.d.ts +4 -1
  150. package/dist-lib/core/conversation/index.d.ts.map +1 -1
  151. package/dist-lib/core/conversation/presentation.d.ts.map +1 -1
  152. package/dist-lib/core/conversation/reducer.d.ts.map +1 -1
  153. package/dist-lib/core/conversation/renderer-registry.d.ts +1 -0
  154. package/dist-lib/core/conversation/renderer-registry.d.ts.map +1 -1
  155. package/dist-lib/core/conversation/runtime-ingress.d.ts +22 -0
  156. package/dist-lib/core/conversation/runtime-ingress.d.ts.map +1 -0
  157. package/dist-lib/core/conversation/safe-tool-value.d.ts +8 -0
  158. package/dist-lib/core/conversation/safe-tool-value.d.ts.map +1 -0
  159. package/dist-lib/core/conversation/scoped-cancel.d.ts +16 -0
  160. package/dist-lib/core/conversation/scoped-cancel.d.ts.map +1 -0
  161. package/dist-lib/core/conversation/types.d.ts +6 -1
  162. package/dist-lib/core/conversation/types.d.ts.map +1 -1
  163. package/dist-lib/core/interaction/adapters/legacy-runtime-events.d.ts +8 -0
  164. package/dist-lib/core/interaction/adapters/legacy-runtime-events.d.ts.map +1 -0
  165. package/dist-lib/core/interaction/adapters/responses.d.ts +1 -0
  166. package/dist-lib/core/interaction/adapters/responses.d.ts.map +1 -1
  167. package/dist-lib/core/interaction/adapters/session-events.d.ts.map +1 -1
  168. package/dist-lib/core/interaction/client.d.ts +3 -2
  169. package/dist-lib/core/interaction/client.d.ts.map +1 -1
  170. package/dist-lib/core/interaction/index.d.ts +4 -0
  171. package/dist-lib/core/interaction/index.d.ts.map +1 -1
  172. package/dist-lib/core/interaction/legacy-history.d.ts +5 -0
  173. package/dist-lib/core/interaction/legacy-history.d.ts.map +1 -0
  174. package/dist-lib/core/interaction/store.d.ts +4 -0
  175. package/dist-lib/core/interaction/store.d.ts.map +1 -1
  176. package/dist-lib/core/interaction/types.d.ts +2 -0
  177. package/dist-lib/core/interaction/types.d.ts.map +1 -1
  178. package/dist-lib/core/run/blocks.d.ts +2 -1
  179. package/dist-lib/core/run/blocks.d.ts.map +1 -1
  180. package/dist-lib/core/run/dispatcher.d.ts.map +1 -1
  181. package/dist-lib/core/run/engine.d.ts +2 -0
  182. package/dist-lib/core/run/engine.d.ts.map +1 -1
  183. package/dist-lib/core/run/types.d.ts +7 -1
  184. package/dist-lib/core/run/types.d.ts.map +1 -1
  185. package/dist-lib/core/stream/kernel-events.d.ts +2 -0
  186. package/dist-lib/core/stream/kernel-events.d.ts.map +1 -1
  187. package/dist-lib/core/stream/responses-protocol.d.ts.map +1 -1
  188. package/dist-lib/core/stream/runtime-items.d.ts +2 -2
  189. package/dist-lib/core/stream/runtime-items.d.ts.map +1 -1
  190. package/dist-lib/core/stream/types.d.ts +4 -0
  191. package/dist-lib/core/stream/types.d.ts.map +1 -1
  192. package/dist-lib/core/teams/cloudExtendedContracts.d.ts +48 -48
  193. package/dist-lib/core/teams/cloudExtendedContracts.d.ts.map +1 -1
  194. package/dist-lib/core/teams/cloudMaterials.d.ts +2 -2
  195. package/dist-lib/core/teams/cloudMaterials.d.ts.map +1 -1
  196. package/dist-lib/hooks/useAgentChat.d.ts +2 -7
  197. package/dist-lib/hooks/useAgentChat.d.ts.map +1 -1
  198. package/dist-lib/hooks/useFeedback.d.ts +2 -2
  199. package/dist-lib/hooks/useFeedback.d.ts.map +1 -1
  200. package/dist-lib/hooks/useImeComposition.d.ts +21 -0
  201. package/dist-lib/hooks/useImeComposition.d.ts.map +1 -0
  202. package/dist-lib/hooks/useInteractions.d.ts +1 -1
  203. package/dist-lib/hooks/useInteractions.d.ts.map +1 -1
  204. package/dist-lib/hooks/useRunAgent.d.ts +3 -1
  205. package/dist-lib/hooks/useRunAgent.d.ts.map +1 -1
  206. package/dist-lib/hooks/useSessionLifecycle.d.ts +1 -1
  207. package/dist-lib/hooks/useSessionLifecycle.d.ts.map +1 -1
  208. package/dist-lib/hooks.js +9 -9
  209. package/dist-lib/{permission-CcMWqN8Y.js → permission-B2MuVypC.js} +1 -1
  210. package/dist-lib/persisted-session-history-CBk_ypXo.js +2888 -0
  211. package/dist-lib/public/chat-timeline.d.ts +2 -0
  212. package/dist-lib/public/chat-timeline.d.ts.map +1 -1
  213. package/dist-lib/public/conversation.d.ts +3 -1
  214. package/dist-lib/public/conversation.d.ts.map +1 -1
  215. package/dist-lib/{reducer-BP8YVv-Q.js → reducer-mbYiX0wz.js} +81 -13
  216. package/dist-lib/{runtime-items-q6tMjfGU.js → runtime-items-VPq7711E.js} +0 -0
  217. package/dist-lib/runtime.js +287 -226
  218. package/dist-lib/stores/session.d.ts +20 -11
  219. package/dist-lib/stores/session.d.ts.map +1 -1
  220. package/dist-lib/styles.css +1 -1
  221. package/dist-lib/team-components.js +922 -922
  222. package/dist-lib/teams.js +363 -555
  223. package/dist-lib/types/agent-control.d.ts +2 -0
  224. package/dist-lib/types/agent-control.d.ts.map +1 -1
  225. package/dist-lib/types/capabilities.d.ts +6 -0
  226. package/dist-lib/types/capabilities.d.ts.map +1 -1
  227. package/dist-lib/types/session-events.d.ts +1 -0
  228. package/dist-lib/types/session-events.d.ts.map +1 -1
  229. package/dist-lib/{useSessionLifecycle-DQXKeBm9.js → useSessionLifecycle-DS3PPoWK.js} +1316 -1041
  230. package/dist-lib/utils/history-preparation.d.ts +8 -0
  231. package/dist-lib/utils/history-preparation.d.ts.map +1 -0
  232. package/dist-lib/utils/messages.d.ts +8 -4
  233. package/dist-lib/utils/messages.d.ts.map +1 -1
  234. package/dist-lib/utils/persisted-session-history.d.ts +1 -1
  235. package/dist-lib/utils/persisted-session-history.d.ts.map +1 -1
  236. package/dist-lib/utils/session-events.d.ts.map +1 -1
  237. package/dist-lib/utils/transcript-order.d.ts +10 -0
  238. package/dist-lib/utils/transcript-order.d.ts.map +1 -0
  239. package/package.json +3 -2
  240. package/dist-ksadk/assets/architecture-7GRP2DOG-BCsa26zi.js +0 -1
  241. package/dist-ksadk/assets/channel-_KDifNys.js +0 -1
  242. package/dist-ksadk/assets/chunk-2Q5K7J3B-HdVkJ9F0.js +0 -1
  243. package/dist-ksadk/assets/classDiagram-DTDB5LWJ-BVCW3ZqZ.js +0 -1
  244. package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-BVCW3ZqZ.js +0 -1
  245. package/dist-ksadk/assets/cynefin-OW5HDTMX-CNXjFctL.js +0 -1
  246. package/dist-ksadk/assets/eventmodeling-NTZA5JFV-B5-8RH9c.js +0 -1
  247. package/dist-ksadk/assets/flowDiagram-A5DVABFB-BppFxEKw.js +0 -1
  248. package/dist-ksadk/assets/gitGraph-4MIJSDKK-B-AhYj4C.js +0 -1
  249. package/dist-ksadk/assets/index-BMd2mucF.css +0 -2
  250. package/dist-ksadk/assets/index-D5qyyhTH.js +0 -244
  251. package/dist-ksadk/assets/info-A6RAGUB7-0uiKrC35.js +0 -1
  252. package/dist-ksadk/assets/packet-AYTQ26CC-BVTmZ_cw.js +0 -1
  253. package/dist-ksadk/assets/pie-WAS4IAKB-DyfxBU7V.js +0 -1
  254. package/dist-ksadk/assets/radar-RG4KPBEZ-FFontjL2.js +0 -1
  255. package/dist-ksadk/assets/railroad-74A4TZTK-D0Uidzen.js +0 -1
  256. package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-BOo_9T2h.js +0 -1
  257. package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-D6-BjW7Z.js +0 -1
  258. package/dist-ksadk/assets/railroad-peg-WCYAUIDC-CXx__yMm.js +0 -1
  259. package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-BXAFScz8.js +0 -1
  260. package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-uIQ2lJKH.js +0 -8
  261. package/dist-ksadk/assets/treeView-Q6P3EWNA-CK5GgucZ.js +0 -1
  262. package/dist-ksadk/assets/treemap-WGGIJYW6-Bq1u1SpG.js +0 -1
  263. package/dist-ksadk/assets/wardley-WFR3VGLG-QAt06uEz.js +0 -1
  264. package/dist-lib/persisted-session-history-ClsfDfGs.js +0 -1991
package/dist-lib/teams.js CHANGED
@@ -1,201 +1,9 @@
1
- import { o as e, t } from "./reducer-BP8YVv-Q.js";
2
- import { $ as n, A as r, At as i, B as a, Bt as o, C as s, Ct as c, D as l, Dt as u, E as d, Et as f, F as p, Ft as ee, G as te, Gt as ne, H as re, Ht as ie, I as ae, It as oe, J as se, K as ce, Kt as m, L as le, Lt as ue, M as h, Mt as de, N as g, Nt as fe, O as pe, Ot as me, P as he, Pt as ge, Q as _e, R as ve, Rt as ye, S as be, St as xe, T as Se, Tt as _, U as Ce, Ut as we, V as Te, Vt as Ee, W as De, Wt as Oe, X as ke, Y as v, Z as Ae, _ as je, _t as Me, a as y, at as Ne, b as Pe, bt as Fe, c as Ie, ct as Le, d as Re, dt as ze, et as Be, f as Ve, ft as He, g as Ue, gt as We, h as Ge, ht as Ke, it as qe, j as Je, jt as Ye, k as Xe, kt as Ze, l as b, lt as Qe, m as $e, mt as et, n as tt, nt, o as rt, ot as it, p as at, pt as ot, q as st, r as ct, rt as lt, s as ut, st as dt, tt as ft, u as pt, ut as mt, v as ht, vt as gt, w as _t, wt as vt, x as yt, xt as bt, y as xt, yt as x, z as St, zt as Ct } from "./cloudMaterials-BlIAT-PA.js";
3
- import { a as wt, i as Tt, n as Et, o as Dt, r as Ot, s as kt, t as At } from "./presentation-yYw7xK60.js";
4
- import { z as S } from "zod";
5
- //#region src/core/teams/client.ts
6
- function C(e) {
7
- if (e?.aborted) throw new DOMException("Aborted", "AbortError");
8
- }
9
- function jt(e, t) {
10
- return new Promise((n, r) => {
11
- C(t);
12
- let i = () => t.removeEventListener("abort", o), a = setTimeout(() => {
13
- i(), n();
14
- }, e), o = () => {
15
- clearTimeout(a), i(), r(new DOMException("Aborted", "AbortError"));
16
- };
17
- t.addEventListener("abort", o, { once: !0 });
18
- });
19
- }
20
- async function w(e, t, n) {
21
- if (!e.body || !e.headers.get("content-type")?.includes("text/event-stream")) throw new f("contract_mismatch", "服务没有返回事件流。");
22
- let r = e.body.getReader(), i = new TextDecoder(), a = "", o = () => {
23
- r.cancel().catch(() => {});
24
- };
25
- t.addEventListener("abort", o, { once: !0 });
26
- let s = (e) => {
27
- C(t);
28
- let r = "message", i = [];
29
- for (let t of e.split(/\r?\n/)) t.startsWith("event:") && (r = t.slice(6).trim()), t.startsWith("data:") && i.push(t.slice(5).trimStart());
30
- if (!i.length) return;
31
- let a;
32
- try {
33
- a = JSON.parse(i.join("\n"));
34
- } catch {
35
- throw new f("contract_mismatch", "无法解析群事件。");
36
- }
37
- n(r, a);
38
- };
39
- try {
40
- for (;;) {
41
- C(t);
42
- let { done: e, value: n } = await r.read();
43
- if (C(t), a += e ? i.decode() : i.decode(n, { stream: !0 }), a.length > 8e6) throw new f("event_too_large", "群事件超过客户端大小限制。");
44
- let o = /\r?\n\r?\n/.exec(a);
45
- for (; o;) s(a.slice(0, o.index)), a = a.slice(o.index + o[0].length), o = /\r?\n\r?\n/.exec(a);
46
- if (e) {
47
- a.trim() && s(a);
48
- break;
49
- }
50
- }
51
- } finally {
52
- t.removeEventListener("abort", o), await r.cancel().catch(() => {}), r.releaseLock();
53
- }
54
- }
55
- var Mt = class {
56
- fetcher;
57
- baseUrl;
58
- reconnects;
59
- retryDelay;
60
- constructor(e = {}) {
61
- if (this.fetcher = e.fetch ?? ((e, t) => globalThis.fetch(e, t)), this.baseUrl = (e.baseUrl ?? "/api/v1/groups").replace(/\/+$/, ""), this.reconnects = e.maxReconnects ?? 6, !Number.isSafeInteger(this.reconnects) || this.reconnects < 0 || this.reconnects > 32) throw new f("invalid_reconnect_limit", "重连次数必须在 0–32 之间。");
62
- this.retryDelay = e.retryDelayMs ?? ((e) => Math.min(500 * 2 ** e, 1e4));
63
- }
64
- path(e, t = "") {
65
- return `/${encodeURIComponent(e)}${t}`;
66
- }
67
- async request(e, t = {}) {
68
- C(t.signal ?? void 0);
69
- let n = await this.fetcher(`${this.baseUrl}${e}`, t);
70
- if (!n.ok) {
71
- let e = await n.json().catch(() => ({}));
72
- throw new f(e.error?.code ?? e.code ?? "http_error", e.error?.message ?? e.message ?? `群服务请求失败(${n.status})`, n.status);
73
- }
74
- return n;
75
- }
76
- async json(e, t = {}) {
77
- let n = await this.request(e, t);
78
- return n.status === 204 ? void 0 : n.json();
79
- }
80
- post(e, t, n) {
81
- return this.json(e, {
82
- method: "POST",
83
- headers: { "Content-Type": "application/json" },
84
- body: JSON.stringify(t),
85
- signal: n
86
- });
87
- }
88
- list(e = {}) {
89
- let t = new URLSearchParams();
90
- return e.cursor && t.set("cursor", e.cursor), e.limit && t.set("limit", String(e.limit)), this.json(t.size ? `?${t}` : "", { signal: e.signal });
91
- }
92
- async snapshot(e, t) {
93
- let n = i(await this.json(this.path(e), { signal: t }));
94
- if (n.group.groupId !== e) throw new f("scope_mismatch", "服务返回了另一个群。");
95
- return n;
96
- }
97
- async create(e, t) {
98
- return ne(e), i(await this.post("", e, t));
99
- }
100
- async update(e, t, n) {
101
- let r = i(await this.json(this.path(e), {
102
- method: "PATCH",
103
- headers: { "Content-Type": "application/json" },
104
- body: JSON.stringify(t),
105
- signal: n
106
- }));
107
- if (r.group.groupId !== e) throw new f("scope_mismatch", "群更新返回了另一个群。");
108
- return r;
109
- }
110
- send(e, t, n) {
111
- if (!t.parts.some((e) => e.kind !== "text" || e.text.trim())) throw new f("empty_message", "请输入消息。");
112
- if (t.workspace && t.intent !== "start_goal") throw new f("invalid_workspace_scope", "工作目录只能在新建任务时指定。");
113
- if (t.intent === "directed" && !t.mentions.length) throw new f("missing_recipient", "请选择接收成员。");
114
- return this.post(this.path(e, "/messages"), t, n);
115
- }
116
- start(e, t, n) {
117
- return this.post(this.path(e, "/team-runs"), t, n);
118
- }
119
- taskAction(e, t, n, r) {
120
- return this.post(this.path(e, `/tasks/${encodeURIComponent(t)}/actions`), n, r);
121
- }
122
- control(e, t, n, r) {
123
- return this.post(this.path(e, `/team-runs/${encodeURIComponent(t)}/control`), n, r);
124
- }
125
- acceptRun(e, t, n, r) {
126
- return this.post(this.path(e, `/team-runs/${encodeURIComponent(t)}/acceptance`), n, r);
127
- }
128
- async configureLeaderStandby(e, t, n, r) {
129
- if (!n.bindingRef.trim()) throw new f("missing_binding", "请选择云端备用节点。");
130
- let i = await this.post(this.path(e, `/team-runs/${encodeURIComponent(t)}/leader-standby`), n, r);
131
- if (i.groupId !== e || i.teamRunId !== t || i.standbyBindingRef !== n.bindingRef || ![
132
- "armed",
133
- "blocked",
134
- "active"
135
- ].includes(i.state)) throw new f("scope_mismatch", "备用节点确认不属于当前任务或所选节点。");
136
- return i;
137
- }
138
- interaction(e, t, n) {
139
- if (t.ref.groupId !== e) throw new f("scope_mismatch", "审批不属于当前群。");
140
- return this.post(this.path(e, "/interactions"), t, n);
141
- }
142
- cancelMember(e, t, n, r) {
143
- if (n.ref.groupId !== e || n.ref.memberId !== t) throw new f("scope_mismatch", "停止请求不属于当前成员。");
144
- return this.post(this.path(e, `/members/${encodeURIComponent(t)}/cancel`), n, r);
145
- }
146
- async execution(e, t, n) {
147
- let r = me(await this.json(this.path(e, `/execution${t ? `?teamRunId=${encodeURIComponent(t)}` : ""}`), { signal: n }));
148
- if (r.groupId !== e || t && r.teamRunId !== t) throw new f("scope_mismatch", "执行视图不属于当前协作轮次。");
149
- return r;
150
- }
151
- markRead(e, t, n) {
152
- return this.post(this.path(e, "/read"), { watermark: t }, n);
153
- }
154
- async reconciliation(e, t) {
155
- let n = await this.json(this.path(e, "/reconciliation"));
156
- if (n.groupId !== e || !Array.isArray(n.items)) throw new f("scope_mismatch", "原单核查结果不属于当前团队。");
157
- return n.items.filter((e) => e.teamRunId === t);
158
- }
159
- reconcile(e, t, n) {
160
- return this.post(this.path(e, `/reconciliation/${encodeURIComponent(t)}`), n);
161
- }
162
- async watch(e, t) {
163
- let { signal: n, onSnapshot: r, onConnection: i, onError: a } = t, o, s = !0, l = 0;
164
- i?.("connecting");
165
- try {
166
- for (; !n.aborted;) try {
167
- if (s) {
168
- let t = await this.snapshot(e, n);
169
- if (o) {
170
- if (!o.replace(t)) throw new f("reset_required", "服务返回的快照早于当前状态,正在重新核对。");
171
- } else o = new c(t);
172
- s = !1, C(n), r(o.snapshot());
173
- }
174
- if (!o) throw new f("reset_required", "群快照尚未就绪。");
175
- let t = await this.request(this.path(e, `/events?after=${o.snapshot().watermark}`), { signal: n });
176
- throw i?.("connected"), await w(t, n, (e, t) => {
177
- if (e === "reset_required") throw new f("reset_required", "群事件游标已过期。");
178
- e === "heartbeat" || e === "ping" || o.apply(Ze(t)) && (l = 0, r(o.snapshot()));
179
- }), C(n), new f("stream_ended", "群事件连接已断开。");
180
- } catch (e) {
181
- if (n.aborted) break;
182
- let t = e instanceof f ? e : new f("network_error", e instanceof Error ? e.message : "无法连接群服务。");
183
- if (t.code === "reset_required") s = !0;
184
- else if (t.status === 401 || t.status === 403 || t.status === 404 || t.code === "contract_mismatch" || t.code === "scope_mismatch") throw t;
185
- if (l++ >= this.reconnects) throw t;
186
- i?.("reconnecting"), await jt(this.retryDelay(l - 1), n);
187
- }
188
- } catch (e) {
189
- if (!n.aborted) {
190
- i?.("offline");
191
- let t = e instanceof f ? e : new f("network_error", String(e));
192
- throw a?.(t), t;
193
- }
194
- } finally {
195
- n.aborted && i?.("closed");
196
- }
197
- }
198
- }, Nt = class {
1
+ import { l as e, t } from "./reducer-mbYiX0wz.js";
2
+ import { $ as n, A as r, At as i, B as a, Bt as o, C as s, Ct as c, D as l, Dt as u, E as d, Et as f, F as ee, Ft as te, G as ne, Gt as re, H as ie, Ht as p, I as ae, It as oe, J as se, Jt as m, K as ce, Kt as le, L as ue, Lt as de, M as h, Mt as fe, N as g, Nt as pe, O as me, Ot as _, P as he, Pt as ge, Q as _e, R as ve, Rt as ye, S as be, St as xe, T as Se, Tt as Ce, U as we, Ut as Te, V as Ee, Vt as De, W as Oe, Wt as ke, X as Ae, Y as v, Z as y, _ as je, _t as Me, a as b, at as Ne, b as Pe, bt as x, c as Fe, ct as Ie, d as Le, dt as Re, et as ze, f as Be, ft as Ve, g as He, gt as Ue, h as We, ht as Ge, it as Ke, j as qe, jt as Je, k as Ye, kt as Xe, l as S, lt as Ze, m as Qe, mt as $e, n as et, nt as tt, o as nt, ot as rt, p as it, pt as at, q as ot, qt as st, r as ct, rt as lt, s as ut, st as dt, tt as ft, u as pt, ut as mt, v as ht, vt as gt, w as _t, wt as C, x as vt, xt as yt, y as bt, yt as w, z as xt, zt as St } from "./cloudMaterials-D75jTrkQ.js";
3
+ import { a as Ct, i as wt, n as Tt, o as Et, r as Dt, s as Ot, t as kt } from "./presentation-yYw7xK60.js";
4
+ import { z as T } from "zod";
5
+ //#region src/core/teams/observer.ts
6
+ var At = class {
199
7
  ref;
200
8
  value;
201
9
  reducer = new t();
@@ -204,8 +12,8 @@ var Mt = class {
204
12
  generation = 0;
205
13
  disposed = !1;
206
14
  constructor(e) {
207
- let t = o.safeParse(e);
208
- if (!t.success) throw new f("invalid_member_ref", "成员观察需要完整的运行引用。");
15
+ let t = p.safeParse(e);
16
+ if (!t.success) throw new _("invalid_member_ref", "成员观察需要完整的运行引用。");
209
17
  this.ref = Object.freeze({ ...t.data }), this.value = {
210
18
  ref: this.ref,
211
19
  items: [],
@@ -227,17 +35,17 @@ var Mt = class {
227
35
  this.update({ draft: e });
228
36
  }
229
37
  assertRef(e) {
230
- if (_(e) !== _(this.ref)) throw new f("scope_mismatch", "成员事件的执行身份不匹配。");
38
+ if (u(e) !== u(this.ref)) throw new _("scope_mismatch", "成员事件的执行身份不匹配。");
231
39
  }
232
40
  decode(t) {
233
41
  let n = e(t);
234
- if (!n) throw new f("contract_mismatch", "成员会话内容格式不兼容。");
235
- if (n.sessionId !== this.ref.sessionId || n.runId !== this.ref.runId) throw new f("scope_mismatch", "成员事件引用了其他会话或运行。");
42
+ if (!n) throw new _("contract_mismatch", "成员会话内容格式不兼容。");
43
+ if (n.sessionId !== this.ref.sessionId || n.runId !== this.ref.runId) throw new _("scope_mismatch", "成员事件引用了其他会话或运行。");
236
44
  return n;
237
45
  }
238
46
  ingest(e) {
239
47
  if (!this.disposed) {
240
- if (this.assertRef(e.ref), !Number.isSafeInteger(e.cursor) || e.cursor < 0) throw new f("contract_mismatch", "成员事件游标无效。");
48
+ if (this.assertRef(e.ref), !Number.isSafeInteger(e.cursor) || e.cursor < 0) throw new _("contract_mismatch", "成员事件游标无效。");
241
49
  e.cursor <= this.value.cursor || (this.reducer.apply(this.decode(e.item)), this.update({
242
50
  items: this.reducer.snapshot().items,
243
51
  cursor: e.cursor
@@ -245,7 +53,7 @@ var Mt = class {
245
53
  }
246
54
  }
247
55
  restore(e) {
248
- if (this.assertRef(e.ref), !Number.isSafeInteger(e.cursor) || e.cursor < 0) throw new f("contract_mismatch", "成员历史游标无效。");
56
+ if (this.assertRef(e.ref), !Number.isSafeInteger(e.cursor) || e.cursor < 0) throw new _("contract_mismatch", "成员历史游标无效。");
249
57
  if (e.cursor < this.value.cursor) return;
250
58
  let n = new t();
251
59
  for (let t of e.items) n.apply(this.decode(t));
@@ -255,7 +63,7 @@ var Mt = class {
255
63
  });
256
64
  }
257
65
  async observe(e) {
258
- if (this.disposed) throw new f("scope_disposed", "成员会话已关闭。");
66
+ if (this.disposed) throw new _("scope_disposed", "成员会话已关闭。");
259
67
  this.disconnect();
260
68
  let t = ++this.generation, n = new AbortController();
261
69
  this.abort = n;
@@ -278,15 +86,15 @@ var Mt = class {
278
86
  }), await e.subscribe(this.ref, this.value.cursor, n.signal, (e) => {
279
87
  r() && (this.ingest(e), i = 0);
280
88
  }), !r()) return;
281
- throw new f("stream_ended", "成员事件连接已断开。");
89
+ throw new _("stream_ended", "成员事件连接已断开。");
282
90
  } catch (e) {
283
91
  if (!r()) return;
284
- if (e instanceof f && (["scope_mismatch", "contract_mismatch"].includes(e.code) || [
92
+ if (e instanceof _ && (["scope_mismatch", "contract_mismatch"].includes(e.code) || [
285
93
  401,
286
94
  403,
287
95
  404
288
96
  ].includes(e.status ?? 0)) || i++ >= 6) throw e;
289
- e instanceof f && e.code === "reset_required" && (t = !0), this.update({ connection: "reconnecting" }), await new Promise((e) => {
97
+ e instanceof _ && e.code === "reset_required" && (t = !0), this.update({ connection: "reconnecting" }), await new Promise((e) => {
290
98
  let t = n.signal, r = () => {
291
99
  clearTimeout(a), t.removeEventListener("abort", r), e();
292
100
  }, a = setTimeout(() => {
@@ -318,10 +126,10 @@ var Mt = class {
318
126
  };
319
127
  }
320
128
  };
321
- function Pt(e) {
322
- return new Nt(e);
129
+ function jt(e) {
130
+ return new At(e);
323
131
  }
324
- function Ft(e = {}) {
132
+ function Mt(e = {}) {
325
133
  let t = e.fetch ?? ((e, t) => globalThis.fetch(e, t)), n = (e.baseUrl ?? "/api/v1/groups").replace(/\/+$/, ""), r = (e, t, r) => {
326
134
  let i = new URLSearchParams({
327
135
  sessionId: e.sessionId,
@@ -336,7 +144,7 @@ function Ft(e = {}) {
336
144
  });
337
145
  if (!r.ok) {
338
146
  let e = await r.json().catch(() => ({}));
339
- throw new f(e.error?.code ?? "member_observation_failed", e.error?.message ?? `成员详情请求失败(${r.status})`, r.status);
147
+ throw new _(e.error?.code ?? "member_observation_failed", e.error?.message ?? `成员详情请求失败(${r.status})`, r.status);
340
148
  }
341
149
  return r;
342
150
  };
@@ -345,9 +153,9 @@ function Ft(e = {}) {
345
153
  return (await i(r(e, "conversation"), t)).json();
346
154
  },
347
155
  async subscribe(e, t, n, a) {
348
- await w(await i(r(e, "conversation/events", t), n), n, (e, t) => {
156
+ await C(await i(r(e, "conversation/events", t), n), n, (e, t) => {
349
157
  if (!(e === "heartbeat" || e === "ping")) {
350
- if (e === "reset_required") throw new f("reset_required", "成员历史已变化,请重新连接。");
158
+ if (e === "reset_required") throw new _("reset_required", "成员历史已变化,请重新连接。");
351
159
  a(t);
352
160
  }
353
161
  });
@@ -356,146 +164,146 @@ function Ft(e = {}) {
356
164
  }
357
165
  //#endregion
358
166
  //#region src/core/teams/cloudEffects.ts
359
- var T = S.string().min(1).max(256), E = S.number().int().min(1).max(2 ** 53 - 1), D = S.string().regex(/^sha256:[0-9a-f]{64}$/), O = S.strictObject({
360
- phase: S.enum(["completed", "failed"]),
361
- external_ref: T.nullable(),
362
- evidence_ref: T,
363
- result_digest: D.nullable(),
364
- definitively_not_applied: S.boolean()
365
- }).refine((e) => e.phase === "failed" === e.definitively_not_applied, "Unproven effect outcome"), It = S.strictObject({
366
- resolutionId: T,
367
- expectedRevision: E,
368
- expectedEvidenceDigest: D,
369
- decision: S.enum([
167
+ var E = T.string().min(1).max(256), D = T.number().int().min(1).max(2 ** 53 - 1), O = T.string().regex(/^sha256:[0-9a-f]{64}$/), k = T.strictObject({
168
+ phase: T.enum(["completed", "failed"]),
169
+ external_ref: E.nullable(),
170
+ evidence_ref: E,
171
+ result_digest: O.nullable(),
172
+ definitively_not_applied: T.boolean()
173
+ }).refine((e) => e.phase === "failed" === e.definitively_not_applied, "Unproven effect outcome"), Nt = T.strictObject({
174
+ resolutionId: E,
175
+ expectedRevision: D,
176
+ expectedEvidenceDigest: O,
177
+ decision: T.enum([
370
178
  "confirmed_applied",
371
179
  "confirmed_not_applied",
372
180
  "accept_risk"
373
181
  ]),
374
- evidenceRef: T,
375
- reason: S.string().min(1).max(1e3),
376
- kind: S.enum(["manual_risk_acceptance", "external_evidence"]),
377
- actorSubject: T,
378
- ownerScopeRef: T,
379
- verifiedOutcome: O.nullable()
380
- }).refine((e) => e.decision === "accept_risk" ? e.kind === "manual_risk_acceptance" && e.verifiedOutcome === null : e.kind === "external_evidence" && e.verifiedOutcome?.phase === (e.decision === "confirmed_applied" ? "completed" : "failed"), "Unverified effect resolution"), k = S.strictObject({
381
- effectKey: T,
382
- groupId: T,
383
- teamRunId: T,
384
- toolName: T,
385
- effectClass: S.enum(["external_idempotent", "external_reconcilable"]),
386
- phase: S.enum([
182
+ evidenceRef: E,
183
+ reason: T.string().min(1).max(1e3),
184
+ kind: T.enum(["manual_risk_acceptance", "external_evidence"]),
185
+ actorSubject: E,
186
+ ownerScopeRef: E,
187
+ verifiedOutcome: k.nullable()
188
+ }).refine((e) => e.decision === "accept_risk" ? e.kind === "manual_risk_acceptance" && e.verifiedOutcome === null : e.kind === "external_evidence" && e.verifiedOutcome?.phase === (e.decision === "confirmed_applied" ? "completed" : "failed"), "Unverified effect resolution"), A = T.strictObject({
189
+ effectKey: E,
190
+ groupId: E,
191
+ teamRunId: E,
192
+ toolName: E,
193
+ effectClass: T.enum(["external_idempotent", "external_reconcilable"]),
194
+ phase: T.enum([
387
195
  "prepared",
388
196
  "unknown",
389
197
  "completed",
390
198
  "failed",
391
199
  "resolved"
392
200
  ]),
393
- revision: E,
394
- evidenceDigest: D,
395
- resolution: It.nullable(),
396
- resolutionConflict: S.boolean(),
397
- outcome: O.nullable()
398
- }).refine((e) => e.phase === "resolved" ? e.resolution !== null : e.resolution === null && !e.resolutionConflict && (["completed", "failed"].includes(e.phase) ? e.outcome?.phase === e.phase : e.outcome === null), "Inconsistent effect projection"), A = S.strictObject({
201
+ revision: D,
202
+ evidenceDigest: O,
203
+ resolution: Nt.nullable(),
204
+ resolutionConflict: T.boolean(),
205
+ outcome: k.nullable()
206
+ }).refine((e) => e.phase === "resolved" ? e.resolution !== null : e.resolution === null && !e.resolutionConflict && (["completed", "failed"].includes(e.phase) ? e.outcome?.phase === e.phase : e.outcome === null), "Inconsistent effect projection"), j = T.strictObject({
399
207
  scope: g,
400
- teamRunId: T,
401
- items: S.array(k).max(100),
402
- nextCursor: E.nullable()
403
- }).refine((e) => new Set(e.items.map((e) => e.effectKey)).size === e.items.length, "Duplicate effect identity"), Lt = "teams-effects/v1", j = "teams-build/v1", M = "teams-loaded-build/v1", { identifier: N, operationKey: P, digest: F, revision: I, timestamp: L, commandId: Rt, relativePath: zt, length: R } = v, Bt = S.enum([
208
+ teamRunId: E,
209
+ items: T.array(A).max(100),
210
+ nextCursor: D.nullable()
211
+ }).refine((e) => new Set(e.items.map((e) => e.effectKey)).size === e.items.length, "Duplicate effect identity"), Pt = "teams-effects/v1", M = "teams-build/v1", N = "teams-loaded-build/v1", { identifier: P, operationKey: F, digest: I, revision: L, timestamp: R, commandId: Ft, relativePath: It, length: z } = v, Lt = T.enum([
404
212
  "prepared",
405
213
  "unknown",
406
214
  "completed",
407
215
  "failed",
408
216
  "resolved"
409
- ]), Vt = S.enum(["external_idempotent", "external_reconcilable"]), z = S.strictObject({
410
- ref: Ae,
411
- context_ref: N,
412
- store_incarnation: N,
413
- journal_incarnation: N,
414
- native_run_id: N,
415
- tool_call_id: N,
416
- effect_index: S.number().int().min(0).max(1023),
417
- tool_name: N,
418
- adapter_version: N,
419
- effect_class: Vt,
420
- payload_digest: F
421
- }).refine((e) => e.ref.nativeRunId === null || e.ref.nativeRunId === e.native_run_id, "effect_native_run_mismatch"), B = S.strictObject({
422
- phase: S.enum(["completed", "failed"]),
423
- external_ref: N.nullable().default(null),
424
- evidence_ref: N,
425
- result_digest: F.nullable().default(null),
426
- definitively_not_applied: S.boolean().default(!1)
427
- }).refine((e) => e.phase === "failed" === e.definitively_not_applied, "effect_outcome_not_proven"), Ht = S.strictObject({
428
- effect_key: N,
429
- payload_digest: F,
430
- request_digest: F,
431
- revision: I,
432
- phase: Bt
433
- }), V = S.strictObject({
434
- request: z,
435
- phase: S.enum([
217
+ ]), Rt = T.enum(["external_idempotent", "external_reconcilable"]), B = T.strictObject({
218
+ ref: y,
219
+ context_ref: P,
220
+ store_incarnation: P,
221
+ journal_incarnation: P,
222
+ native_run_id: P,
223
+ tool_call_id: P,
224
+ effect_index: T.number().int().min(0).max(1023),
225
+ tool_name: P,
226
+ adapter_version: P,
227
+ effect_class: Rt,
228
+ payload_digest: I
229
+ }).refine((e) => e.ref.nativeRunId === null || e.ref.nativeRunId === e.native_run_id, "effect_native_run_mismatch"), V = T.strictObject({
230
+ phase: T.enum(["completed", "failed"]),
231
+ external_ref: P.nullable().default(null),
232
+ evidence_ref: P,
233
+ result_digest: I.nullable().default(null),
234
+ definitively_not_applied: T.boolean().default(!1)
235
+ }).refine((e) => e.phase === "failed" === e.definitively_not_applied, "effect_outcome_not_proven"), zt = T.strictObject({
236
+ effect_key: P,
237
+ payload_digest: I,
238
+ request_digest: I,
239
+ revision: L,
240
+ phase: Lt
241
+ }), H = T.strictObject({
242
+ request: B,
243
+ phase: T.enum([
436
244
  "prepared",
437
245
  "unknown",
438
246
  "completed",
439
247
  "failed"
440
248
  ]),
441
- revision: I,
442
- evidence_digest: F,
443
- outcome: B.nullable().default(null)
444
- }).refine((e) => ["completed", "failed"].includes(e.phase) ? e.outcome?.phase === e.phase : e.outcome === null, "effect_outcome_inconsistent"), Ut = S.strictObject({
445
- effectKey: N,
446
- journalRevision: I,
447
- evidenceDigest: F,
448
- authorityRevision: I,
449
- phase: Bt
450
- }), Wt = S.strictObject({
451
- expectedRevision: I,
452
- expectedEvidenceDigest: F,
453
- decision: S.enum([
249
+ revision: L,
250
+ evidence_digest: I,
251
+ outcome: V.nullable().default(null)
252
+ }).refine((e) => ["completed", "failed"].includes(e.phase) ? e.outcome?.phase === e.phase : e.outcome === null, "effect_outcome_inconsistent"), Bt = T.strictObject({
253
+ effectKey: P,
254
+ journalRevision: L,
255
+ evidenceDigest: I,
256
+ authorityRevision: L,
257
+ phase: Lt
258
+ }), Vt = T.strictObject({
259
+ expectedRevision: L,
260
+ expectedEvidenceDigest: I,
261
+ decision: T.enum([
454
262
  "confirmed_applied",
455
263
  "confirmed_not_applied",
456
264
  "accept_risk"
457
265
  ]),
458
- evidenceRef: N,
459
- reason: R(1, 1e3),
460
- idempotencyKey: P
461
- }), Gt = S.strictObject({
462
- resolutionId: N,
463
- expectedRevision: I,
464
- expectedEvidenceDigest: F,
465
- decision: S.enum([
266
+ evidenceRef: P,
267
+ reason: z(1, 1e3),
268
+ idempotencyKey: F
269
+ }), Ht = V.required(), Ut = T.strictObject({
270
+ resolutionId: P,
271
+ expectedRevision: L,
272
+ expectedEvidenceDigest: I,
273
+ decision: T.enum([
466
274
  "confirmed_applied",
467
275
  "confirmed_not_applied",
468
276
  "accept_risk"
469
277
  ]),
470
- evidenceRef: N,
471
- reason: R(1, 1e3),
472
- kind: S.enum(["manual_risk_acceptance", "external_evidence"]),
473
- actorSubject: N,
474
- ownerScopeRef: N,
475
- verifiedOutcome: B.nullable()
476
- }).refine((e) => e.decision === "accept_risk" ? e.kind === "manual_risk_acceptance" && e.verifiedOutcome === null : e.kind === "external_evidence" && e.verifiedOutcome?.phase === (e.decision === "confirmed_applied" ? "completed" : "failed"), "effect_resolution_not_verified"), H = k.safeExtend({
477
- effectKey: N,
478
- groupId: N,
479
- teamRunId: N,
480
- toolName: N,
481
- resolution: Gt.nullable(),
482
- outcome: B.nullable()
483
- }), Kt = A.safeExtend({
484
- scope: S.strictObject({
485
- authorityId: R(1, 256),
486
- ownerScopeRef: R(1, 512),
487
- groupId: R(1, 256)
278
+ evidenceRef: P,
279
+ reason: z(1, 1e3),
280
+ kind: T.enum(["manual_risk_acceptance", "external_evidence"]),
281
+ actorSubject: P,
282
+ ownerScopeRef: P,
283
+ verifiedOutcome: Ht.nullable()
284
+ }).refine((e) => e.decision === "accept_risk" ? e.kind === "manual_risk_acceptance" && e.verifiedOutcome === null : e.kind === "external_evidence" && e.verifiedOutcome?.phase === (e.decision === "confirmed_applied" ? "completed" : "failed"), "effect_resolution_not_verified"), U = A.safeExtend({
285
+ effectKey: P,
286
+ groupId: P,
287
+ teamRunId: P,
288
+ toolName: P,
289
+ resolution: Ut.nullable(),
290
+ outcome: Ht.nullable()
291
+ }), Wt = j.safeExtend({
292
+ scope: T.strictObject({
293
+ authorityId: z(1, 256),
294
+ ownerScopeRef: z(1, 512),
295
+ groupId: z(1, 256)
488
296
  }),
489
- teamRunId: N,
490
- items: S.array(H).max(100)
491
- }), qt = S.strictObject({
492
- contextRef: N,
493
- storeIncarnation: N,
494
- nativeRunId: N,
495
- journalIncarnation: N,
496
- items: S.array(V).max(100),
297
+ teamRunId: P,
298
+ items: T.array(U).max(100)
299
+ }), Gt = T.strictObject({
300
+ contextRef: P,
301
+ storeIncarnation: P,
302
+ nativeRunId: P,
303
+ journalIncarnation: P,
304
+ items: T.array(H).max(100),
497
305
  nextCursor: v.text.nullable().default(null)
498
- }), Jt = new Set([
306
+ }), Kt = new Set([
499
307
  "ensure_session",
500
308
  "prepare",
501
309
  "enqueue",
@@ -504,135 +312,135 @@ var T = S.string().min(1).max(256), E = S.number().int().min(1).max(2 ** 53 - 1)
504
312
  "set_admission",
505
313
  "invoke",
506
314
  "respond_interaction"
507
- ]), Yt = new Set([
315
+ ]), qt = new Set([
508
316
  "lookup",
509
317
  "get_result",
510
318
  "observe",
511
319
  "get_grant",
512
320
  "revoke",
513
321
  "cancel"
514
- ]), Xt = S.strictObject({
515
- schemaVersion: S.literal(1).default(1),
516
- issuer: N,
517
- kid: N,
518
- authorityId: N,
519
- issuedAt: L,
520
- expiresAt: L,
521
- nonce: N,
522
- signature: R(0, 128).default(""),
523
- audience: S.literal("agentengine-teams-runtime").default("agentengine-teams-runtime"),
524
- permitKind: S.enum(["execute", "recovery"]),
525
- subjectRef: N,
526
- agentInstanceId: N,
527
- sessionId: N,
528
- commandId: Rt,
529
- allowedOperations: S.array(v.text).min(1).max(16),
530
- payloadDigest: F,
531
- policyDigest: F,
532
- leaderEpoch: I,
533
- dispatchEpoch: I,
534
- attemptEpoch: I,
535
- grantRevision: I
322
+ ]), Jt = T.strictObject({
323
+ schemaVersion: T.literal(1).default(1),
324
+ issuer: P,
325
+ kid: P,
326
+ authorityId: P,
327
+ issuedAt: R,
328
+ expiresAt: R,
329
+ nonce: P,
330
+ signature: z(0, 128).default(""),
331
+ audience: T.literal("agentengine-teams-runtime").default("agentengine-teams-runtime"),
332
+ permitKind: T.enum(["execute", "recovery"]),
333
+ subjectRef: P,
334
+ agentInstanceId: P,
335
+ sessionId: P,
336
+ commandId: Ft,
337
+ allowedOperations: T.array(v.text).min(1).max(16),
338
+ payloadDigest: I,
339
+ policyDigest: I,
340
+ leaderEpoch: L,
341
+ dispatchEpoch: L,
342
+ attemptEpoch: L,
343
+ grantRevision: L
536
344
  }).refine((e) => {
537
345
  let t = Date.parse(e.expiresAt) - Date.parse(e.issuedAt);
538
346
  return t > 0 && t <= 6e4;
539
- }, "invalid_permit_lifetime").refine((e) => new Set(e.allowedOperations).size === e.allowedOperations.length && e.allowedOperations.every((t) => (e.permitKind === "execute" ? Jt : Yt).has(t)), "invalid_permit_operations"), Zt = S.strictObject({
540
- contextRef: R(1, 2 ** 53 - 1),
541
- expectedIncarnation: R(1, 2 ** 53 - 1),
542
- permit: Xt,
543
- after: R(0, 256).default(""),
544
- limit: S.number().int().min(1).max(100).default(100)
545
- }), Qt = {
347
+ }, "invalid_permit_lifetime").refine((e) => new Set(e.allowedOperations).size === e.allowedOperations.length && e.allowedOperations.every((t) => (e.permitKind === "execute" ? Kt : qt).has(t)), "invalid_permit_operations"), Yt = T.strictObject({
348
+ contextRef: z(1, 2 ** 53 - 1),
349
+ expectedIncarnation: z(1, 2 ** 53 - 1),
350
+ permit: Jt,
351
+ after: z(0, 256).default(""),
352
+ limit: T.number().int().min(1).max(100).default(100)
353
+ }), Xt = {
546
354
  agentDefinitionDigest: ".teams/agent-definition.json",
547
355
  toolsPolicyDigest: ".teams/tools-policy.json",
548
356
  behaviorConfigDigest: ".teams/behavior-config.json",
549
357
  dependencyLockDigest: ".teams/dependency.lock"
550
- }, $t = {
551
- agentDefinitionDigest: F,
552
- toolsPolicyDigest: F,
553
- dependencyLockDigest: F,
554
- behaviorConfigDigest: F
555
- }, U = S.strictObject({
556
- schemaVersion: S.literal(j).default(j),
557
- entrypoint: zt,
558
- ...$t,
559
- materialContractVersion: S.literal("materials/v1").default("materials/v1"),
560
- files: S.array(S.strictObject({
561
- path: zt,
562
- digest: F,
563
- sizeBytes: S.number().int().min(0).max(20 * 1024 * 1024)
358
+ }, Zt = {
359
+ agentDefinitionDigest: I,
360
+ toolsPolicyDigest: I,
361
+ dependencyLockDigest: I,
362
+ behaviorConfigDigest: I
363
+ }, W = T.strictObject({
364
+ schemaVersion: T.literal(M).default(M),
365
+ entrypoint: It,
366
+ ...Zt,
367
+ materialContractVersion: T.literal("materials/v1").default("materials/v1"),
368
+ files: T.array(T.strictObject({
369
+ path: It,
370
+ digest: I,
371
+ sizeBytes: T.number().int().min(0).max(20 * 1024 * 1024)
564
372
  })).min(1).max(4096)
565
373
  }).superRefine((e, t) => {
566
374
  let n = new Map(e.files.map((e) => [e.path, e])), r = e.files.map((e) => e.path);
567
- n.size === r.length && !n.has(".teams/build-manifest.json") && r.every((e, t) => t === 0 || Fe(r[t - 1], e) < 0) && n.has(e.entrypoint) && !e.entrypoint.startsWith(".teams/") && e.files.reduce((e, t) => e + t.sizeBytes, 0) <= 64 * 1024 * 1024 && Object.entries(Qt).every(([t, r]) => n.get(r)?.digest === e[t]) && r.every((e) => e.split("/").every((e, t, r) => t === 0 || !n.has(r.slice(0, t).join("/")))) || t.addIssue({
375
+ n.size === r.length && !n.has(".teams/build-manifest.json") && r.every((e, t) => t === 0 || x(r[t - 1], e) < 0) && n.has(e.entrypoint) && !e.entrypoint.startsWith(".teams/") && e.files.reduce((e, t) => e + t.sizeBytes, 0) <= 64 * 1024 * 1024 && Object.entries(Xt).every(([t, r]) => n.get(r)?.digest === e[t]) && r.every((e) => e.split("/").every((e, t, r) => t === 0 || !n.has(r.slice(0, t).join("/")))) || t.addIssue({
568
376
  code: "custom",
569
377
  message: "invalid_build_manifest"
570
378
  });
571
- }), en = S.strictObject({
572
- schemaVersion: S.literal(M).default(M),
573
- codeArtifactDigest: F,
574
- buildManifestDigest: F,
575
- ...$t,
576
- materialContractVersion: S.literal("materials/v1").default("materials/v1"),
577
- immutableWorkspace: S.literal(!0),
578
- externalMutableInputs: S.literal(!1)
579
- }), W = S.strictObject({
580
- buildArtifactRef: N,
581
- state: S.literal("verified"),
582
- authorityId: N,
583
- codeArtifactDigest: F,
584
- buildManifestDigest: F,
585
- sizeBytes: S.number().int().min(1).max(20 * 1024 * 1024),
586
- manifest: U
587
- }), tn = S.strictObject({ idempotencyKey: P }), nn = S.union([S.strictObject({ status: S.literal("missing") }), W.extend({ status: S.literal("recorded") })]), rn = S.strictObject({
588
- agentId: N,
589
- versionId: N,
590
- instanceId: N,
591
- codeArtifactDigest: F,
592
- buildManifestDigest: F,
593
- bundleDigest: F,
594
- contractDigest: F,
379
+ }), Qt = T.strictObject({
380
+ schemaVersion: T.literal(N).default(N),
381
+ codeArtifactDigest: I,
382
+ buildManifestDigest: I,
383
+ ...Zt,
384
+ materialContractVersion: T.literal("materials/v1").default("materials/v1"),
385
+ immutableWorkspace: T.literal(!0),
386
+ externalMutableInputs: T.literal(!1)
387
+ }), G = T.strictObject({
388
+ buildArtifactRef: P,
389
+ state: T.literal("verified"),
390
+ authorityId: P,
391
+ codeArtifactDigest: I,
392
+ buildManifestDigest: I,
393
+ sizeBytes: T.number().int().min(1).max(20 * 1024 * 1024),
394
+ manifest: W
395
+ }), $t = T.strictObject({ idempotencyKey: F }), en = T.union([T.strictObject({ status: T.literal("missing") }), G.extend({ status: T.literal("recorded") })]), K = T.strictObject({
396
+ agentId: P,
397
+ versionId: P,
398
+ instanceId: P,
399
+ codeArtifactDigest: I,
400
+ buildManifestDigest: I,
401
+ bundleDigest: I,
402
+ contractDigest: I,
595
403
  deployedAt: v.text
596
- }), an = S.strictObject({
597
- buildArtifactRef: N,
598
- localBindingRef: N,
599
- cloudBindingRef: N,
600
- idempotencyKey: P
601
- }), on = S.strictObject({
602
- releaseRef: N,
603
- buildArtifactRef: N,
604
- localBindingRef: N,
605
- cloudBindingRef: N,
606
- evidenceDigest: F,
607
- verifiedAt: L
608
- }), G = {
609
- "effect-request": z,
610
- "effect-outcome": B,
611
- "effect-prepared-receipt": Ht,
612
- "effect-record": V,
613
- "effect-report-receipt": Ut,
614
- "effect-reconcile-input": Wt,
615
- "effect-projection": H,
616
- "effect-projection-page": Kt,
617
- "execution-effects-request": Zt,
618
- "execution-effects-page": qt,
619
- "build-manifest": U,
620
- "loaded-build-evidence": en,
621
- "build-artifact-receipt": W,
622
- "build-artifact-lookup-input": tn,
623
- "build-artifact-lookup-result": nn,
624
- "deployment-artifact-receipt": rn,
625
- "release-verify-input": an,
626
- "release-verification-receipt": on
404
+ }), tn = T.strictObject({
405
+ buildArtifactRef: P,
406
+ localBindingRef: P,
407
+ cloudBindingRef: P,
408
+ idempotencyKey: F
409
+ }), nn = T.strictObject({
410
+ releaseRef: P,
411
+ buildArtifactRef: P,
412
+ localBindingRef: P,
413
+ cloudBindingRef: P,
414
+ evidenceDigest: I,
415
+ verifiedAt: R
416
+ }), q = {
417
+ "effect-request": B,
418
+ "effect-outcome": V,
419
+ "effect-prepared-receipt": zt,
420
+ "effect-record": H,
421
+ "effect-report-receipt": Bt,
422
+ "effect-reconcile-input": Vt,
423
+ "effect-projection": U,
424
+ "effect-projection-page": Wt,
425
+ "execution-effects-request": Yt,
426
+ "execution-effects-page": Gt,
427
+ "build-manifest": W,
428
+ "loaded-build-evidence": Qt,
429
+ "build-artifact-receipt": G,
430
+ "build-artifact-lookup-input": $t,
431
+ "build-artifact-lookup-result": en,
432
+ "deployment-artifact-receipt": K,
433
+ "release-verify-input": tn,
434
+ "release-verification-receipt": nn
627
435
  };
628
- function sn(e, t) {
629
- if (!Object.hasOwn(G, e)) throw Error("unknown_teams_contract");
630
- return G[e].parse(t);
436
+ function rn(e, t) {
437
+ if (!Object.hasOwn(q, e)) throw Error("unknown_teams_contract");
438
+ return q[e].parse(t);
631
439
  }
632
440
  //#endregion
633
441
  //#region src/core/teams/cloudScope.ts
634
- function K(e) {
635
- if (!/^[\x21-\x7e]{1,256}$/.test(e.authorityId) || !/^[\x21-\x7e]{1,512}$/.test(e.ownerScopeRef)) throw new f("scope_mismatch", "云端身份引用无效,请重新连接服务。");
442
+ function J(e) {
443
+ if (!/^[\x21-\x7e]{1,256}$/.test(e.authorityId) || !/^[\x21-\x7e]{1,512}$/.test(e.ownerScopeRef)) throw new _("scope_mismatch", "云端身份引用无效,请重新连接服务。");
636
444
  return {
637
445
  "X-Teams-Authority-Id": e.authorityId,
638
446
  "X-Teams-Owner-Scope-Ref": e.ownerScopeRef
@@ -640,13 +448,13 @@ function K(e) {
640
448
  }
641
449
  //#endregion
642
450
  //#region src/core/teams/cloudClient.ts
643
- function q(e) {
451
+ function Y(e) {
644
452
  if (e.aborted) throw new DOMException("Aborted", "AbortError");
645
453
  }
646
- async function J(e, t, n) {
454
+ async function X(e, t, n) {
647
455
  let r = e.headers.get("content-length");
648
- if (r !== null && Number(r) > n) throw await e.body?.cancel().catch(() => void 0), new f("workspace_response_too_large", "工作区响应超过大小限制。");
649
- if (!e.body) throw new f("workspace_contract_mismatch", "工作区服务未返回数据。");
456
+ if (r !== null && Number(r) > n) throw await e.body?.cancel().catch(() => void 0), new _("workspace_response_too_large", "工作区响应超过大小限制。");
457
+ if (!e.body) throw new _("workspace_contract_mismatch", "工作区服务未返回数据。");
650
458
  let i = e.body.getReader(), a = () => {
651
459
  i.cancel().catch(() => void 0);
652
460
  };
@@ -654,39 +462,39 @@ async function J(e, t, n) {
654
462
  let o = new TextDecoder("utf-8", { fatal: !0 }), s = "", c = 0;
655
463
  try {
656
464
  for (;;) {
657
- q(t);
465
+ Y(t);
658
466
  let e = await i.read();
659
- if (q(t), e.done) {
467
+ if (Y(t), e.done) {
660
468
  s += o.decode();
661
469
  break;
662
470
  }
663
- if (c += e.value.byteLength, c > n) throw new f("workspace_response_too_large", "工作区响应超过大小限制。");
471
+ if (c += e.value.byteLength, c > n) throw new _("workspace_response_too_large", "工作区响应超过大小限制。");
664
472
  s += o.decode(e.value, { stream: !0 });
665
473
  }
666
474
  try {
667
475
  return JSON.parse(s);
668
476
  } catch {
669
- throw new f("workspace_contract_mismatch", "工作区响应不是有效 JSON。");
477
+ throw new _("workspace_contract_mismatch", "工作区响应不是有效 JSON。");
670
478
  }
671
479
  } finally {
672
480
  t.removeEventListener("abort", a), await i.cancel().catch(() => void 0), i.releaseLock();
673
481
  }
674
482
  }
675
- var cn = class {
483
+ var an = class {
676
484
  origin;
677
485
  base;
678
486
  fetcher;
679
487
  constructor(e) {
680
488
  let t = new URL(e.origin), n = new URL(e.baseUrl ?? "/api/v1/groups", t);
681
- if (!["https:", "http:"].includes(t.protocol) || t.origin !== e.origin || n.origin !== t.origin || n.search || n.hash || n.username || n.password) throw new f("invalid_workspace_origin", "工作区客户端必须固定到同一服务来源。");
489
+ if (!["https:", "http:"].includes(t.protocol) || t.origin !== e.origin || n.origin !== t.origin || n.search || n.hash || n.username || n.password) throw new _("invalid_workspace_origin", "工作区客户端必须固定到同一服务来源。");
682
490
  this.origin = t.origin, this.base = n.href.replace(/\/+$/, ""), this.fetcher = e.fetch ?? ((e, t) => globalThis.fetch(e, t));
683
491
  }
684
492
  path(e, t) {
685
- if (e.origin !== this.origin) throw new f("scope_mismatch", "工作区来源与客户端不一致。");
493
+ if (e.origin !== this.origin) throw new _("scope_mismatch", "工作区来源与客户端不一致。");
686
494
  return `${this.base}/${encodeURIComponent(e.groupId)}${t}`;
687
495
  }
688
496
  async get(e, t, n) {
689
- q(t);
497
+ Y(t);
690
498
  let r = await this.fetcher(e, {
691
499
  method: "GET",
692
500
  signal: t,
@@ -694,130 +502,130 @@ var cn = class {
694
502
  redirect: "error",
695
503
  cache: "no-store",
696
504
  headers: {
697
- ...K(n),
505
+ ...J(n),
698
506
  Accept: "application/json, text/event-stream"
699
507
  }
700
508
  });
701
- if (q(t), !r.ok) {
702
- let e = await J(r, t, 64 * 1024).catch(() => ({})), n = e.error?.code ?? e.code;
703
- throw new f(typeof n == "string" && /^[a-z][a-z0-9_]{0,99}$/.test(n) ? n : "workspace_http_error", `工作区请求失败(${r.status})。`, r.status);
509
+ if (Y(t), !r.ok) {
510
+ let e = await X(r, t, 64 * 1024).catch(() => ({})), n = e.error?.code ?? e.code;
511
+ throw new _(typeof n == "string" && /^[a-z][a-z0-9_]{0,99}$/.test(n) ? n : "workspace_http_error", `工作区请求失败(${r.status})。`, r.status);
704
512
  }
705
513
  return r;
706
514
  }
707
515
  async read(e, t) {
708
- let n = new URLSearchParams({ viewVersion: b });
516
+ let n = new URLSearchParams({ viewVersion: S });
709
517
  t.teamRunId !== void 0 && n.set("teamRunId", t.teamRunId);
710
- let r = Re(await J(await this.get(this.path(e, `/workspace?${n}`), t.signal, e), t.signal, 2 * 1024 * 1024));
711
- if (h(e) !== h(r.scope) || t.teamRunId !== void 0 && r.selectedRun?.teamRunId !== t.teamRunId) throw new f("scope_mismatch", "服务返回了其他身份或任务的工作区。");
518
+ let r = Le(await X(await this.get(this.path(e, `/workspace?${n}`), t.signal, e), t.signal, 2 * 1024 * 1024));
519
+ if (h(e) !== h(r.scope) || t.teamRunId !== void 0 && r.selectedRun?.teamRunId !== t.teamRunId) throw new _("scope_mismatch", "服务返回了其他身份或任务的工作区。");
712
520
  return r;
713
521
  }
714
522
  async page(e, t, n) {
715
- if (!l.safeParse(t).success) throw new f("invalid_workspace_page", "工作区分页参数无效。");
716
- if (t.collection !== "runSummaries" && t.teamRunId === null) throw new f("scope_mismatch", "任务分页需要指定协作任务。");
523
+ if (!l.safeParse(t).success) throw new _("invalid_workspace_page", "工作区分页参数无效。");
524
+ if (t.collection !== "runSummaries" && t.teamRunId === null) throw new _("scope_mismatch", "任务分页需要指定协作任务。");
717
525
  let r = t.collection === "runSummaries" ? "/team-runs" : `/team-runs/${encodeURIComponent(t.teamRunId)}/${{
718
526
  taskSummaries: "tasks",
719
527
  pendingInteractions: "interactions",
720
528
  recentMessages: "messages",
721
529
  artifactSummaries: "artifacts"
722
530
  }[t.collection]}`, i = new URLSearchParams({
723
- viewVersion: b,
531
+ viewVersion: S,
724
532
  snapshotId: t.snapshotId,
725
533
  watermark: String(t.watermark),
726
534
  cursor: t.cursor,
727
535
  limit: String(t.limit ?? 100)
728
- }), a = at(await J(await this.get(this.path(e, `${r}?${i}`), n, e), n, 2 * 1024 * 1024));
729
- if (h(e) !== h(a.scope)) throw new f("scope_mismatch", "服务返回了其他身份的分页。");
730
- if (a.snapshotId !== t.snapshotId || a.watermark !== t.watermark || a.teamRunId !== t.teamRunId || a.collection !== t.collection || a.cursor !== t.cursor) throw new f("workspace_page_mismatch", "服务分页与请求的只读快照不一致。");
536
+ }), a = it(await X(await this.get(this.path(e, `${r}?${i}`), n, e), n, 2 * 1024 * 1024));
537
+ if (h(e) !== h(a.scope)) throw new _("scope_mismatch", "服务返回了其他身份的分页。");
538
+ if (a.snapshotId !== t.snapshotId || a.watermark !== t.watermark || a.teamRunId !== t.teamRunId || a.collection !== t.collection || a.cursor !== t.cursor) throw new _("workspace_page_mismatch", "服务分页与请求的只读快照不一致。");
731
539
  return a;
732
540
  }
733
541
  async subscribe(e, t, n, r) {
734
- if (!Number.isSafeInteger(t) || t < 0) throw new f("invalid_workspace_cursor", "工作区事件水位无效。");
542
+ if (!Number.isSafeInteger(t) || t < 0) throw new _("invalid_workspace_cursor", "工作区事件水位无效。");
735
543
  let i = new URLSearchParams({
736
544
  after: String(t),
737
- viewVersion: b
545
+ viewVersion: S
738
546
  }), a = await this.get(this.path(e, `/events?${i}`), n, e);
739
547
  try {
740
- await w(a, n, (t, n) => {
548
+ await C(a, n, (t, n) => {
741
549
  if (t === "heartbeat" || t === "ping") return;
742
- if (t === "reset_required" || t === "snapshot_expired") throw new f("reset_required", "工作区历史需要重新同步。");
550
+ if (t === "reset_required" || t === "snapshot_expired") throw new _("reset_required", "工作区历史需要重新同步。");
743
551
  if (![
744
552
  "workspace.delta",
745
553
  "workspace.event",
746
554
  "message"
747
- ].includes(t)) throw new f("workspace_contract_mismatch", "未知工作区事件,需要重新读取。");
748
- let i = Ve(n);
749
- if (h(e) !== h(i.scope)) throw new f("scope_mismatch", "服务事件属于其他授权工作区。");
555
+ ].includes(t)) throw new _("workspace_contract_mismatch", "未知工作区事件,需要重新读取。");
556
+ let i = Be(n);
557
+ if (h(e) !== h(i.scope)) throw new _("scope_mismatch", "服务事件属于其他授权工作区。");
750
558
  r(i);
751
559
  });
752
560
  } catch (e) {
753
- throw e instanceof f && ["contract_mismatch", "event_too_large"].includes(e.code) ? new f("workspace_contract_mismatch", "工作区事件无法验证,需要重新读取。") : e;
561
+ throw e instanceof _ && ["contract_mismatch", "event_too_large"].includes(e.code) ? new _("workspace_contract_mismatch", "工作区事件无法验证,需要重新读取。") : e;
754
562
  }
755
563
  }
756
- }, Y = S.string().min(1).max(256), X = S.number().int().min(0).max(2 ** 53 - 1), ln = S.strictObject({
757
- apiVersion: S.literal(m),
564
+ }, Z = T.string().min(1).max(256), Q = T.number().int().min(0).max(2 ** 53 - 1), on = T.strictObject({
565
+ apiVersion: T.literal(m),
758
566
  scope: g.omit({ groupId: !0 }),
759
- items: S.array(yt.extend({
760
- memberCount: X,
761
- pendingCount: X,
762
- unreadCount: X,
763
- lastMessage: S.string().default("")
567
+ items: T.array(vt.extend({
568
+ memberCount: Q,
569
+ pendingCount: Q,
570
+ unreadCount: Q,
571
+ lastMessage: T.string().default("")
764
572
  })).max(100),
765
- nextCursor: S.string().min(1).max(4096).nullable()
766
- }).refine((e) => new Set(e.items.map((e) => e.groupId)).size === e.items.length, "Duplicate group identity"), Z = Ue.extend({
767
- name: S.string().min(1).max(256),
768
- revision: X.min(1),
769
- authorityRef: Y
770
- }), un = S.strictObject({
771
- apiVersion: S.literal(m),
573
+ nextCursor: T.string().min(1).max(4096).nullable()
574
+ }).refine((e) => new Set(e.items.map((e) => e.groupId)).size === e.items.length, "Duplicate group identity"), sn = He.extend({
575
+ name: T.string().min(1).max(256),
576
+ revision: Q.min(1),
577
+ authorityRef: Z
578
+ }), cn = T.strictObject({
579
+ apiVersion: T.literal(m),
772
580
  scope: g.omit({ groupId: !0 }),
773
- items: S.array(Z).max(100),
774
- nextCursor: S.string().min(1).max(4096).nullable()
775
- }).refine((e) => new Set(e.items.map((e) => e.bindingRef)).size === e.items.length, "Duplicate binding identity"), Q = s.extend({
776
- message: S.string(),
777
- requestSchema: S.record(S.string(), S.unknown()).nullable()
778
- }), dn = S.strictObject({
779
- status: S.enum([
581
+ items: T.array(sn).max(100),
582
+ nextCursor: T.string().min(1).max(4096).nullable()
583
+ }).refine((e) => new Set(e.items.map((e) => e.bindingRef)).size === e.items.length, "Duplicate binding identity"), ln = s.extend({
584
+ message: T.string(),
585
+ requestSchema: T.record(T.string(), T.unknown()).nullable()
586
+ }), un = T.strictObject({
587
+ status: T.enum([
780
588
  "accepted",
781
589
  "duplicate",
782
590
  "rejected",
783
591
  "uncertain"
784
592
  ]),
785
- groupId: Y.optional(),
786
- teamRunId: Y.optional(),
787
- messageId: Y.optional(),
788
- watermark: X.optional(),
789
- reason: S.string().max(2e3).optional(),
790
- effectKey: Y.optional(),
791
- phase: S.literal("resolved").optional(),
792
- revision: X.min(1).optional(),
793
- resolutionId: Y.optional(),
794
- decision: S.enum([
593
+ groupId: Z.optional(),
594
+ teamRunId: Z.optional(),
595
+ messageId: Z.optional(),
596
+ watermark: Q.optional(),
597
+ reason: T.string().max(2e3).optional(),
598
+ effectKey: Z.optional(),
599
+ phase: T.literal("resolved").optional(),
600
+ revision: Q.min(1).optional(),
601
+ resolutionId: Z.optional(),
602
+ decision: T.enum([
795
603
  "confirmed_applied",
796
604
  "confirmed_not_applied",
797
605
  "accept_risk"
798
606
  ]).optional(),
799
- evidenceDigest: S.string().regex(/^sha256:[0-9a-f]{64}$/).optional()
800
- }), fn = S.strictObject({
801
- status: S.enum([
607
+ evidenceDigest: T.string().regex(/^sha256:[0-9a-f]{64}$/).optional()
608
+ }), dn = T.strictObject({
609
+ status: T.enum([
802
610
  "confirmed",
803
611
  "rejected",
804
612
  "pending",
805
613
  "uncertain"
806
614
  ]),
807
- operationId: Y,
808
- payloadDigest: S.string().regex(/^sha256:[0-9a-f]{64}$/),
809
- receipt: dn.nullable(),
810
- code: S.string().max(100).optional()
811
- }), pn = S.strictObject({ status: S.literal("missing") }), $ = encodeURIComponent, mn = class {
615
+ operationId: Z,
616
+ payloadDigest: T.string().regex(/^sha256:[0-9a-f]{64}$/),
617
+ receipt: un.nullable(),
618
+ code: T.string().max(100).optional()
619
+ }), fn = T.strictObject({ status: T.literal("missing") }), $ = encodeURIComponent, pn = class {
812
620
  origin;
813
621
  fetcher;
814
622
  groupsBase;
815
623
  teamsBase;
816
624
  constructor(e) {
817
- if (this.origin = new URL(e.origin).origin, e.origin !== this.origin || !/^https?:/.test(this.origin)) throw new f("invalid_workspace_origin", "团队服务来源无效。");
625
+ if (this.origin = new URL(e.origin).origin, e.origin !== this.origin || !/^https?:/.test(this.origin)) throw new _("invalid_workspace_origin", "团队服务来源无效。");
818
626
  let t = (e) => {
819
627
  let t = new URL(e, this.origin);
820
- if (t.origin !== this.origin || t.search || t.hash || t.username || t.password) throw new f("invalid_workspace_origin", "团队接口必须使用同一服务来源。");
628
+ if (t.origin !== this.origin || t.search || t.hash || t.username || t.password) throw new _("invalid_workspace_origin", "团队接口必须使用同一服务来源。");
821
629
  return t.href.replace(/\/+$/, "");
822
630
  };
823
631
  this.groupsBase = t(e.groupsBase ?? "/api/v1/groups"), this.teamsBase = t(e.teamsBase ?? "/api/v1/teams"), this.fetcher = e.fetch ?? globalThis.fetch.bind(globalThis);
@@ -831,16 +639,16 @@ var cn = class {
831
639
  redirect: "error",
832
640
  cache: "no-store",
833
641
  headers: {
834
- ...K(n),
642
+ ...J(n),
835
643
  Accept: "application/json",
836
644
  ...i ? { "Content-Type": "application/octet-stream" } : r === void 0 ? {} : { "Content-Type": "application/json" }
837
645
  },
838
646
  ...i ? { body: i } : r === void 0 ? {} : { body: JSON.stringify(r) }
839
647
  });
840
648
  if (t.aborted) throw new DOMException("Aborted", "AbortError");
841
- if (Number(a.headers.get("content-length")) > 2 * 1024 * 1024) throw await a.body?.cancel(), new f("cloud_contract_mismatch", "团队响应超过大小限制。");
649
+ if (Number(a.headers.get("content-length")) > 2 * 1024 * 1024) throw await a.body?.cancel(), new _("cloud_contract_mismatch", "团队响应超过大小限制。");
842
650
  let o = a.body?.getReader();
843
- if (!o) throw new f("cloud_contract_mismatch", "团队服务未返回数据。");
651
+ if (!o) throw new _("cloud_contract_mismatch", "团队服务未返回数据。");
844
652
  let s = 0, c = [], l = () => {
845
653
  o.cancel();
846
654
  };
@@ -850,7 +658,7 @@ var cn = class {
850
658
  let e = await o.read();
851
659
  if (t.aborted) throw new DOMException("Aborted", "AbortError");
852
660
  if (e.done) break;
853
- if (s += e.value.byteLength, s > 2 * 1024 * 1024) throw new f("cloud_contract_mismatch", "团队响应超过大小限制。");
661
+ if (s += e.value.byteLength, s > 2 * 1024 * 1024) throw new _("cloud_contract_mismatch", "团队响应超过大小限制。");
854
662
  c.push(e.value);
855
663
  }
856
664
  } finally {
@@ -858,45 +666,45 @@ var cn = class {
858
666
  }
859
667
  let u = new Uint8Array(s), d = 0;
860
668
  for (let e of c) u.set(e, d), d += e.byteLength;
861
- let p;
669
+ let f;
862
670
  try {
863
- p = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(u)), x(p);
671
+ f = JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(u)), w(f);
864
672
  } catch {
865
- throw new f("cloud_contract_mismatch", "团队响应格式无效。");
673
+ throw new _("cloud_contract_mismatch", "团队响应格式无效。");
866
674
  }
867
675
  if (!a.ok) {
868
- let e = p.error?.code;
869
- throw new f(typeof e == "string" && /^[a-z][a-z0-9_]{0,99}$/.test(e) ? e : "cloud_http_error", `团队请求失败(${a.status})。`, a.status);
676
+ let e = f.error?.code;
677
+ throw new _(typeof e == "string" && /^[a-z][a-z0-9_]{0,99}$/.test(e) ? e : "cloud_http_error", `团队请求失败(${a.status})。`, a.status);
870
678
  }
871
- return p;
679
+ return f;
872
680
  }
873
681
  async list(e, t, n) {
874
- if (e.origin !== this.origin) throw new f("scope_mismatch", "团队来源不一致。");
682
+ if (e.origin !== this.origin) throw new _("scope_mismatch", "团队来源不一致。");
875
683
  let r = new URLSearchParams({ limit: "50" });
876
684
  n && r.set("cursor", n);
877
- let i = ln.parse(await this.json(`${this.groupsBase}?${r}`, t, e));
878
- if (i.scope.authorityId !== e.authorityId || i.scope.ownerScopeRef !== e.ownerScopeRef || i.items.some((t) => t.authorityRef !== e.authorityId)) throw new f("scope_mismatch", "团队目录属于其他身份。");
879
- if (n && i.nextCursor === n) throw new f("cloud_contract_mismatch", "团队目录游标未前进。");
685
+ let i = on.parse(await this.json(`${this.groupsBase}?${r}`, t, e));
686
+ if (i.scope.authorityId !== e.authorityId || i.scope.ownerScopeRef !== e.ownerScopeRef || i.items.some((t) => t.authorityRef !== e.authorityId)) throw new _("scope_mismatch", "团队目录属于其他身份。");
687
+ if (n && i.nextCursor === n) throw new _("cloud_contract_mismatch", "团队目录游标未前进。");
880
688
  return i;
881
689
  }
882
690
  async bindings(e, t, n) {
883
- if (e.origin !== this.origin) throw new f("scope_mismatch", "成员目录来源不一致。");
691
+ if (e.origin !== this.origin) throw new _("scope_mismatch", "成员目录来源不一致。");
884
692
  let r = new URLSearchParams({ limit: "100" });
885
693
  n && r.set("cursor", n);
886
- let i = un.parse(await this.json(`${this.groupsBase}/bindings?${r}`, t, e));
887
- if (i.scope.authorityId !== e.authorityId || i.scope.ownerScopeRef !== e.ownerScopeRef || i.items.some((t) => t.authorityRef !== e.authorityId)) throw new f("scope_mismatch", "成员目录属于其他身份。");
888
- if (n && i.nextCursor === n) throw new f("cloud_contract_mismatch", "成员目录游标未前进。");
694
+ let i = cn.parse(await this.json(`${this.groupsBase}/bindings?${r}`, t, e));
695
+ if (i.scope.authorityId !== e.authorityId || i.scope.ownerScopeRef !== e.ownerScopeRef || i.items.some((t) => t.authorityRef !== e.authorityId)) throw new _("scope_mismatch", "成员目录属于其他身份。");
696
+ if (n && i.nextCursor === n) throw new _("cloud_contract_mismatch", "成员目录游标未前进。");
889
697
  return i;
890
698
  }
891
699
  target(e) {
892
- if (e.scope.origin !== this.origin) throw new f("scope_mismatch", "操作来源不一致。");
700
+ if (e.scope.origin !== this.origin) throw new _("scope_mismatch", "操作来源不一致。");
893
701
  let t = e.scope.groupId;
894
702
  if (!t && e.operation === "groups") return {
895
703
  path: this.groupsBase,
896
704
  targetId: ""
897
705
  };
898
706
  let n = `groups/${t}/`, r = e.operation.slice(n.length);
899
- if (!t || !e.operation.startsWith(n) || !/^(messages|interactions|team-runs\/[^/]+\/(control|acceptance)|tasks\/[^/]+\/actions|effects\/[^/]+\/reconcile)$/.test(r)) throw new f("invalid_cloud_operation", "不支持的团队操作。");
707
+ if (!t || !e.operation.startsWith(n) || !/^(messages|interactions|team-runs\/[^/]+\/(control|acceptance)|tasks\/[^/]+\/actions|effects\/[^/]+\/reconcile)$/.test(r)) throw new _("invalid_cloud_operation", "不支持的团队操作。");
900
708
  let i = r.split("/");
901
709
  return {
902
710
  path: `${this.groupsBase}/${$(t)}/${i.map($).join("/")}`,
@@ -904,14 +712,14 @@ var cn = class {
904
712
  };
905
713
  }
906
714
  outcome(e, t) {
907
- let n = fn.parse(e);
908
- if (n.payloadDigest !== t.payloadDigest || n.receipt?.groupId && t.scope.groupId && n.receipt.groupId !== t.scope.groupId) throw new f("scope_mismatch", "操作回执与原始意图不一致。");
909
- if (n.status === "confirmed" && (!n.receipt || !["accepted", "duplicate"].includes(n.receipt.status))) throw new f("cloud_contract_mismatch", "操作尚未被事务接受。");
715
+ let n = dn.parse(e);
716
+ if (n.payloadDigest !== t.payloadDigest || n.receipt?.groupId && t.scope.groupId && n.receipt.groupId !== t.scope.groupId) throw new _("scope_mismatch", "操作回执与原始意图不一致。");
717
+ if (n.status === "confirmed" && (!n.receipt || !["accepted", "duplicate"].includes(n.receipt.status))) throw new _("cloud_contract_mismatch", "操作尚未被事务接受。");
910
718
  let r = /^groups\/[^/]+\/team-runs\/([^/]+)\//.exec(t.operation)?.[1], i = typeof t.payload.teamRunId == "string" ? t.payload.teamRunId : r;
911
- if (n.receipt?.teamRunId && i && n.receipt.teamRunId !== i) throw new f("scope_mismatch", "操作回执属于其他协作任务。");
912
- if (n.status === "confirmed" && (!n.receipt?.groupId || t.payload.intent === "start_goal" && !n.receipt.teamRunId)) throw new f("cloud_contract_mismatch", "原单缺少已创建的资源标识。");
719
+ if (n.receipt?.teamRunId && i && n.receipt.teamRunId !== i) throw new _("scope_mismatch", "操作回执属于其他协作任务。");
720
+ if (n.status === "confirmed" && (!n.receipt?.groupId || t.payload.intent === "start_goal" && !n.receipt.teamRunId)) throw new _("cloud_contract_mismatch", "原单缺少已创建的资源标识。");
913
721
  let a = /^groups\/[^/]+\/effects\/([^/]+)\/reconcile$/.exec(t.operation)?.[1];
914
- if (n.status === "confirmed" && a && (n.receipt?.effectKey !== a || n.receipt?.phase !== "resolved" || !n.receipt.resolutionId || !n.receipt.revision || !n.receipt.evidenceDigest || n.receipt.decision !== t.payload.decision)) throw new f("scope_mismatch", "核查回执与原操作不一致。");
722
+ if (n.status === "confirmed" && a && (n.receipt?.effectKey !== a || n.receipt?.phase !== "resolved" || !n.receipt.resolutionId || !n.receipt.revision || !n.receipt.evidenceDigest || n.receipt.decision !== t.payload.decision)) throw new _("scope_mismatch", "核查回执与原操作不一致。");
915
723
  if (n.status === "pending" || n.status === "uncertain") return {
916
724
  status: n.status,
917
725
  serverOperationId: n.operationId
@@ -934,7 +742,7 @@ var cn = class {
934
742
  operation: e.operation,
935
743
  targetId: n
936
744
  });
937
- return pn.safeParse(r).success ? { status: "missing" } : this.outcome(r, e);
745
+ return fn.safeParse(r).success ? { status: "missing" } : this.outcome(r, e);
938
746
  }
939
747
  async send(e, t) {
940
748
  let { path: n } = this.target(e);
@@ -944,61 +752,61 @@ var cn = class {
944
752
  }), e);
945
753
  }
946
754
  async interaction(e, t, n) {
947
- if (e.origin !== this.origin || t.groupId !== e.groupId) throw new f("scope_mismatch", "审批不属于当前团队。");
755
+ if (e.origin !== this.origin || t.groupId !== e.groupId) throw new _("scope_mismatch", "审批不属于当前团队。");
948
756
  let r = new URLSearchParams({
949
757
  teamRunId: t.teamRunId,
950
758
  ...t.ref
951
- }), i = await this.json(`${this.groupsBase}/${$(e.groupId)}/interactions/${$(t.ref.interactionId)}?${r}`, n, e), a = Q.parse(i);
952
- if (x(a.ref) !== x(t.ref) || a.teamRunId !== t.teamRunId || a.groupId !== e.groupId || a.revision !== t.revision) throw new f("stale_interaction", "审批已更新,请刷新后查看。");
759
+ }), i = await this.json(`${this.groupsBase}/${$(e.groupId)}/interactions/${$(t.ref.interactionId)}?${r}`, n, e), a = ln.parse(i);
760
+ if (w(a.ref) !== w(t.ref) || a.teamRunId !== t.teamRunId || a.groupId !== e.groupId || a.revision !== t.revision) throw new _("stale_interaction", "审批已更新,请刷新后查看。");
953
761
  return a;
954
762
  }
955
763
  async task(e, t, n, r) {
956
- if (e.origin !== this.origin) throw new f("scope_mismatch", "任务来源不一致。");
957
- let i = we.parse(await this.json(`${this.groupsBase}/${$(e.groupId)}/tasks/${$(t)}?teamRunId=${$(n)}`, r, e));
958
- if (i.taskId !== t || i.groupId !== e.groupId || i.teamRunId !== n) throw new f("scope_mismatch", "任务详情不属于当前协作。");
764
+ if (e.origin !== this.origin) throw new _("scope_mismatch", "任务来源不一致。");
765
+ let i = re.parse(await this.json(`${this.groupsBase}/${$(e.groupId)}/tasks/${$(t)}?teamRunId=${$(n)}`, r, e));
766
+ if (i.taskId !== t || i.groupId !== e.groupId || i.teamRunId !== n) throw new _("scope_mismatch", "任务详情不属于当前协作。");
959
767
  return i;
960
768
  }
961
769
  async effects(e, t, n, r = 0) {
962
- if (e.origin !== this.origin || !t || !Number.isSafeInteger(r) || r < 0) throw new f("scope_mismatch", "执行核查不属于当前工作区。");
770
+ if (e.origin !== this.origin || !t || !Number.isSafeInteger(r) || r < 0) throw new _("scope_mismatch", "执行核查不属于当前工作区。");
963
771
  let i = new URLSearchParams({
964
772
  after: String(r),
965
773
  limit: "50"
966
- }), a = A.parse(await this.json(`${this.groupsBase}/${$(e.groupId)}/team-runs/${$(t)}/effects?${i}`, n, e));
967
- if (a.scope.authorityId !== e.authorityId || a.scope.ownerScopeRef !== e.ownerScopeRef || a.scope.groupId !== e.groupId || a.teamRunId !== t || a.items.some((n) => n.groupId !== e.groupId || n.teamRunId !== t || n.resolution && n.resolution.ownerScopeRef !== e.ownerScopeRef)) throw new f("scope_mismatch", "执行核查记录属于其他任务或身份。");
968
- if (a.nextCursor !== null && a.nextCursor <= r) throw new f("cloud_contract_mismatch", "执行核查游标未前进。");
774
+ }), a = j.parse(await this.json(`${this.groupsBase}/${$(e.groupId)}/team-runs/${$(t)}/effects?${i}`, n, e));
775
+ if (a.scope.authorityId !== e.authorityId || a.scope.ownerScopeRef !== e.ownerScopeRef || a.scope.groupId !== e.groupId || a.teamRunId !== t || a.items.some((n) => n.groupId !== e.groupId || n.teamRunId !== t || n.resolution && n.resolution.ownerScopeRef !== e.ownerScopeRef)) throw new _("scope_mismatch", "执行核查记录属于其他任务或身份。");
776
+ if (a.nextCursor !== null && a.nextCursor <= r) throw new _("cloud_contract_mismatch", "执行核查游标未前进。");
969
777
  return a;
970
778
  }
971
779
  async createMaterial(e, t, n) {
972
- if (e.origin !== this.origin) throw new f("scope_mismatch", "材料来源不一致。");
780
+ if (e.origin !== this.origin) throw new _("scope_mismatch", "材料来源不一致。");
973
781
  let r = lt.parse(t);
974
- return y(await this.json(`${this.teamsBase}/materials`, n, e, r), e, {
782
+ return b(await this.json(`${this.teamsBase}/materials`, n, e, r), e, {
975
783
  kind: r.kind,
976
784
  entries: r.entries,
977
- ...r.sourceCommit ? { sourceCommit: r.sourceCommit } : {}
785
+ sourceCommit: r.sourceCommit
978
786
  });
979
787
  }
980
788
  async uploadMaterialBlob(e, t, n, r, i) {
981
- if (e.origin !== this.origin) throw new f("scope_mismatch", "材料来源不一致。");
982
- let a = await y(t, e);
983
- if (r.size !== n.sizeBytes || !a.manifest.entries.some((e) => x(e) === x(n))) throw new f("material_identity_conflict", "文件与原材料清单不一致。");
984
- let o = tt.parse(await this.json(`${this.teamsBase}/materials/${$(a.materialId)}/blobs/${$(n.digest)}`, i, e, void 0, r));
985
- if (o.digest !== n.digest || o.sizeBytes !== n.sizeBytes) throw new f("material_identity_conflict", "上传回执与原文件不一致。");
789
+ if (e.origin !== this.origin) throw new _("scope_mismatch", "材料来源不一致。");
790
+ let a = await b(t, e);
791
+ if (r.size !== n.sizeBytes || !a.manifest.entries.some((e) => w(e) === w(n))) throw new _("material_identity_conflict", "文件与原材料清单不一致。");
792
+ let o = et.parse(await this.json(`${this.teamsBase}/materials/${$(a.materialId)}/blobs/${$(n.digest)}`, i, e, void 0, r));
793
+ if (o.digest !== n.digest || o.sizeBytes !== n.sizeBytes) throw new _("material_identity_conflict", "上传回执与原文件不一致。");
986
794
  }
987
795
  async finalizeMaterial(e, t, n, r) {
988
- if (e.origin !== this.origin) throw new f("scope_mismatch", "材料来源不一致。");
989
- let i = await y(t, e), a = await this.json(`${this.teamsBase}/materials/${$(i.materialId)}/finalize`, r, e, {
796
+ if (e.origin !== this.origin) throw new _("scope_mismatch", "材料来源不一致。");
797
+ let i = await b(t, e), a = await this.json(`${this.teamsBase}/materials/${$(i.materialId)}/finalize`, r, e, {
990
798
  manifestDigest: i.manifestDigest,
991
799
  idempotencyKey: n
992
800
  }), o = ct.safeParse(a);
993
801
  if (o.success) {
994
802
  let e = o.data.missingBlobs;
995
- throw o.data.materialId !== i.materialId || !e.length || new Set(e).size !== e.length || e.some((e) => !i.manifest.entries.some((t) => t.digest === e)) ? new f("material_identity_conflict", "待上传文件与原材料清单不一致。") : Error("服务端尚未确认所有文件,请重试原上传。");
803
+ throw o.data.materialId !== i.materialId || !e.length || new Set(e).size !== e.length || e.some((e) => !i.manifest.entries.some((t) => t.digest === e)) ? new _("material_identity_conflict", "待上传文件与原材料清单不一致。") : Error("服务端尚未确认所有文件,请重试原上传。");
996
804
  }
997
- return y(a, e, i.manifest);
805
+ return b(a, e, i.manifest);
998
806
  }
999
807
  artifactUrl(e, t, n) {
1000
- if (e.origin !== this.origin || !n) throw new f("scope_mismatch", "交付物来源不一致。");
1001
- K(e);
808
+ if (e.origin !== this.origin || !n) throw new _("scope_mismatch", "交付物来源不一致。");
809
+ J(e);
1002
810
  let r = new URLSearchParams({
1003
811
  expectAuthorityId: e.authorityId,
1004
812
  expectOwnerScopeRef: e.ownerScopeRef,
@@ -1008,4 +816,4 @@ var cn = class {
1008
816
  }
1009
817
  };
1010
818
  //#endregion
1011
- export { rt as CloudOperations, c as GroupReducer, mn as HttpCloudTeamsProductClient, cn as HttpCloudWorkspaceClient, Mt as HttpTeamsClient, Nt as MemberChatScope, m as TEAMS_API_VERSION, j as TEAMS_BUILD_VERSION, Lt as TEAMS_EFFECTS_PORT_VERSION, p as TEAMS_HOST_VERSION, M as TEAMS_LOADED_BUILD_VERSION, ae as TEAMS_NODE_VERSION, b as TEAMS_WORKSPACE_VERSION, At as TEAM_STATUS_LABELS, gt as TeamsCanonicalJsonError, f as TeamsError, Ke as TeamsOperationDrainer, We as TeamsOperationOutbox, Me as TeamsOperationOutboxError, pt as WORKSPACE_COLLECTIONS, ut as WorkspaceObserver, Ie as WorkspaceReducer, u as artifactSchema, x as canonicalTeamsJson, un as cloudBindingDirectorySchema, Z as cloudDirectoryBindingSchema, ln as cloudDirectorySchema, O as cloudEffectOutcomeSchema, A as cloudEffectPageSchema, It as cloudEffectResolutionSchema, k as cloudEffectSchema, Q as cloudInteractionDetailSchema, Fe as compareTeamsMaterialPaths, w as consumeTeamsSse, Pt as createChatScope, Ft as createHttpMemberTransport, Et as currentTeamRun, me as decodeExecutionSnapshot, Ze as decodeGroupEvent, i as decodeGroupSnapshot, Re as decodeTeamWorkspaceSnapshot, le as decodeTeamsCanonicalEventBatch, ve as decodeTeamsExecutionRef, St as decodeTeamsExecutionResult, sn as decodeTeamsExtendedContract, a as decodeTeamsHostOperationResult, Te as decodeTeamsHostReceipt, re as decodeTeamsMaterialManifest, Ce as decodeTeamsNodeProbeReport, De as decodeTeamsNodeReport, Ve as decodeWorkspaceEvent, at as decodeWorkspacePage, Ye as deliverySchema, bt as digestTeamsJson, de as executionNodeSchema, fe as executionSnapshotSchema, ge as groupEventSchema, ee as groupSchema, oe as groupSnapshotSchema, vt as interactionRefKey, ue as interactionRefSchema, ye as interactionSchema, Ot as isTeamRunActive, xe as isTeamsUnicodeScalarString, Ct as memberSchema, _ as memberStreamKey, o as memberStreamRefSchema, Ee as messageSchema, te as parseTeamsNodeCommand, ce as parseTeamsNodeMessage, ie as runMemberSchema, Tt as safeArtifactUri, wt as taskDependencyLevels, Dt as taskDisplayReason, we as taskSchema, kt as taskSection, Oe as teamRunSchema, $e as teamWorkspaceSnapshotSchema, tn as teamsBuildArtifactLookupInputSchema, nn as teamsBuildArtifactLookupResultSchema, W as teamsBuildArtifactReceiptSchema, U as teamsBuildManifestSchema, st as teamsCanonicalEventBatchSchema, se as teamsCanonicalEventSchema, v as teamsCloudScalarSchemas, rn as teamsDeploymentArtifactReceiptSchema, B as teamsEffectOutcomeSchema, Ht as teamsEffectPreparedReceiptSchema, Kt as teamsEffectProjectionPageSchema, H as teamsEffectProjectionSchema, Wt as teamsEffectReconcileInputSchema, V as teamsEffectRecordSchema, Ut as teamsEffectReportReceiptSchema, z as teamsEffectRequestSchema, qt as teamsExecutionEffectsPageSchema, Zt as teamsExecutionEffectsRequestSchema, ke as teamsExecutionGrantSnapshotSchema, Ae as teamsExecutionRefSchema, _e as teamsExecutionResultSchema, n as teamsExecutionTargetSchema, G as teamsExtendedContractSchemas, Be as teamsGrantMutationReceiptSchema, ft as teamsHostOperationResultSchema, nt as teamsHostReceiptSchema, en as teamsLoadedBuildEvidenceSchema, lt as teamsMaterialCreateSchema, qe as teamsMaterialEntrySchema, Ne as teamsMaterialManifestDigest, it as teamsMaterialManifestSchema, dt as teamsNodeCommandDigest, Le as teamsNodeCommandSchema, Qe as teamsNodeProbeCommandSchema, mt as teamsNodeProbeDigest, ze as teamsNodeProbeReportSchema, He as teamsNodeProbeResultSchema, ot as teamsNodeReportSchema, on as teamsReleaseVerificationReceiptSchema, an as teamsReleaseVerifyInputSchema, et as teamsTerminalEvidenceSchema, ne as validateGroupCreate, Ge as workspaceArtifactSchema, Ue as workspaceBindingSchema, je as workspaceChangeSchema, ht as workspaceClientScopeKey, xt as workspaceClientScopeSchema, Pe as workspaceEventSchema, yt as workspaceGroupSchema, be as workspaceInteractionKey, s as workspaceInteractionSchema, _t as workspaceLeaderStandbySchema, Se as workspaceMemberSchema, d as workspaceMessageSchema, l as workspacePageRequestSchema, pe as workspacePageSchema, Xe as workspaceRowKey, r as workspaceRunMemberSchema, Je as workspaceRunSummarySchema, h as workspaceScopeKey, g as workspaceScopeSchema, he as workspaceTaskSummarySchema };
819
+ export { nt as CloudOperations, Ce as GroupReducer, pn as HttpCloudTeamsProductClient, an as HttpCloudWorkspaceClient, c as HttpTeamsClient, At as MemberChatScope, m as TEAMS_API_VERSION, M as TEAMS_BUILD_VERSION, Pt as TEAMS_EFFECTS_PORT_VERSION, ee as TEAMS_HOST_VERSION, N as TEAMS_LOADED_BUILD_VERSION, ae as TEAMS_NODE_VERSION, S as TEAMS_WORKSPACE_VERSION, kt as TEAM_STATUS_LABELS, gt as TeamsCanonicalJsonError, _ as TeamsError, Ge as TeamsOperationDrainer, Ue as TeamsOperationOutbox, Me as TeamsOperationOutboxError, pt as WORKSPACE_COLLECTIONS, ut as WorkspaceObserver, Fe as WorkspaceReducer, Xe as artifactSchema, w as canonicalTeamsJson, cn as cloudBindingDirectorySchema, sn as cloudDirectoryBindingSchema, on as cloudDirectorySchema, k as cloudEffectOutcomeSchema, j as cloudEffectPageSchema, Nt as cloudEffectResolutionSchema, A as cloudEffectSchema, ln as cloudInteractionDetailSchema, x as compareTeamsMaterialPaths, C as consumeTeamsSse, jt as createChatScope, Mt as createHttpMemberTransport, Tt as currentTeamRun, i as decodeExecutionSnapshot, Je as decodeGroupEvent, fe as decodeGroupSnapshot, Le as decodeTeamWorkspaceSnapshot, ue as decodeTeamsCanonicalEventBatch, ve as decodeTeamsExecutionRef, xt as decodeTeamsExecutionResult, rn as decodeTeamsExtendedContract, a as decodeTeamsHostOperationResult, Ee as decodeTeamsHostReceipt, ie as decodeTeamsMaterialManifest, we as decodeTeamsNodeProbeReport, Oe as decodeTeamsNodeReport, Be as decodeWorkspaceEvent, it as decodeWorkspacePage, pe as deliverySchema, yt as digestTeamsJson, ge as executionNodeSchema, te as executionSnapshotSchema, oe as groupEventSchema, de as groupSchema, ye as groupSnapshotSchema, f as interactionRefKey, St as interactionRefSchema, o as interactionSchema, Dt as isTeamRunActive, xe as isTeamsUnicodeScalarString, De as memberSchema, u as memberStreamKey, p as memberStreamRefSchema, Te as messageSchema, ne as parseTeamsNodeCommand, ce as parseTeamsNodeMessage, ke as runMemberSchema, wt as safeArtifactUri, Ct as taskDependencyLevels, Et as taskDisplayReason, re as taskSchema, Ot as taskSection, le as teamRunSchema, Qe as teamWorkspaceSnapshotSchema, $t as teamsBuildArtifactLookupInputSchema, en as teamsBuildArtifactLookupResultSchema, G as teamsBuildArtifactReceiptSchema, W as teamsBuildManifestSchema, ot as teamsCanonicalEventBatchSchema, se as teamsCanonicalEventSchema, v as teamsCloudScalarSchemas, K as teamsDeploymentArtifactReceiptSchema, V as teamsEffectOutcomeSchema, zt as teamsEffectPreparedReceiptSchema, Wt as teamsEffectProjectionPageSchema, U as teamsEffectProjectionSchema, Vt as teamsEffectReconcileInputSchema, H as teamsEffectRecordSchema, Bt as teamsEffectReportReceiptSchema, B as teamsEffectRequestSchema, Gt as teamsExecutionEffectsPageSchema, Yt as teamsExecutionEffectsRequestSchema, Ae as teamsExecutionGrantSnapshotSchema, y as teamsExecutionRefSchema, _e as teamsExecutionResultSchema, n as teamsExecutionTargetSchema, q as teamsExtendedContractSchemas, ze as teamsGrantMutationReceiptSchema, ft as teamsHostOperationResultSchema, tt as teamsHostReceiptSchema, Qt as teamsLoadedBuildEvidenceSchema, lt as teamsMaterialCreateSchema, Ke as teamsMaterialEntrySchema, Ne as teamsMaterialManifestDigest, rt as teamsMaterialManifestSchema, dt as teamsNodeCommandDigest, Ie as teamsNodeCommandSchema, Ze as teamsNodeProbeCommandSchema, mt as teamsNodeProbeDigest, Re as teamsNodeProbeReportSchema, Ve as teamsNodeProbeResultSchema, at as teamsNodeReportSchema, nn as teamsReleaseVerificationReceiptSchema, tn as teamsReleaseVerifyInputSchema, $e as teamsTerminalEvidenceSchema, st as validateGroupCreate, We as workspaceArtifactSchema, He as workspaceBindingSchema, je as workspaceChangeSchema, ht as workspaceClientScopeKey, bt as workspaceClientScopeSchema, Pe as workspaceEventSchema, vt as workspaceGroupSchema, be as workspaceInteractionKey, s as workspaceInteractionSchema, _t as workspaceLeaderStandbySchema, Se as workspaceMemberSchema, d as workspaceMessageSchema, l as workspacePageRequestSchema, me as workspacePageSchema, Ye as workspaceRowKey, r as workspaceRunMemberSchema, qe as workspaceRunSummarySchema, h as workspaceScopeKey, g as workspaceScopeSchema, he as workspaceTaskSummarySchema };