@kingsoftcloud/ksadk-web 0.3.11 → 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.
- package/CHANGELOG.md +23 -0
- package/README.md +7 -4
- package/RELEASE_PROVENANCE.json +2 -2
- package/dist-ksadk/assets/{ArtifactsPanel-C1YoaKhx.js → ArtifactsPanel-CILaW-fC.js} +1 -1
- package/dist-ksadk/assets/{CodeBlock-DHuAWfr5.js → CodeBlock-BVrNVtJC.js} +1 -1
- package/dist-ksadk/assets/{MathMessageMarkdown-cvdrBwYr.js → MathMessageMarkdown-Dp7c4wWD.js} +1 -1
- package/dist-ksadk/assets/{MermaidBlock-DeBkbJvI.js → MermaidBlock-Dxop8Rd7.js} +6 -6
- package/dist-ksadk/assets/{NativeTerminalPanel-oJj44_sV.js → NativeTerminalPanel-Cjjz8B30.js} +1 -1
- package/dist-ksadk/assets/{abnfDiagram-VCTEODGH-Dhfv25o2.js → abnfDiagram-VCTEODGH-ckWDmOzw.js} +1 -1
- package/dist-ksadk/assets/{arc-C35w-pn1.js → arc-DqxJede-.js} +1 -1
- package/dist-ksadk/assets/architecture-7GRP2DOG-pn_DuLy6.js +1 -0
- package/dist-ksadk/assets/{architectureDiagram-5GKGNRK7-FoMY_u6D.js → architectureDiagram-5GKGNRK7-SEQA4bVi.js} +1 -1
- package/dist-ksadk/assets/{blockDiagram-NRAW4CY4-zD4Rt7oE.js → blockDiagram-NRAW4CY4-pM0B-6NJ.js} +1 -1
- package/dist-ksadk/assets/{c4Diagram-UCG6FXSJ-BCtGGkhN.js → c4Diagram-UCG6FXSJ-m2tuCNVq.js} +1 -1
- package/dist-ksadk/assets/channel-fySsnkft.js +1 -0
- package/dist-ksadk/assets/chunk-2Q5K7J3B-BheGxKRQ.js +1 -0
- package/dist-ksadk/assets/{chunk-5VM5RSS4-C2Ms13_k.js → chunk-5VM5RSS4-GJHDr9Ww.js} +1 -1
- package/dist-ksadk/assets/{chunk-F27PBJKO-BoTj-qgx.js → chunk-F27PBJKO-CbAN45AV.js} +1 -1
- package/dist-ksadk/assets/{chunk-G27WJ6UU-DOMyyjHH.js → chunk-G27WJ6UU-D5ngbbzF.js} +1 -1
- package/dist-ksadk/assets/{chunk-JWPE2WC7-DbJJqDli.js → chunk-JWPE2WC7-Cc5IwuYC.js} +1 -1
- package/dist-ksadk/assets/{chunk-LCL6LL3I-CLuRCt_W.js → chunk-LCL6LL3I-CprgDDdJ.js} +1 -1
- package/dist-ksadk/assets/{chunk-POPQ4Y6H-D0Dz847e.js → chunk-POPQ4Y6H-CDZhSy82.js} +1 -1
- package/dist-ksadk/assets/{chunk-RHFEMEQ7-BWSRzEcd.js → chunk-RHFEMEQ7-CZchUNro.js} +1 -1
- package/dist-ksadk/assets/{chunk-SVP7TREG-CPoHqkCY.js → chunk-SVP7TREG-BVruqk6T.js} +1 -1
- package/dist-ksadk/assets/{chunk-XXDRQBXY-Bx1jS-X-.js → chunk-XXDRQBXY-4ld9SxPN.js} +1 -1
- package/dist-ksadk/assets/classDiagram-DTDB5LWJ-DSfLtNYm.js +1 -0
- package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-DSfLtNYm.js +1 -0
- package/dist-ksadk/assets/{cose-bilkent-JH36ORCC-LzyWm4m0.js → cose-bilkent-JH36ORCC-Dmyyk_Vp.js} +1 -1
- package/dist-ksadk/assets/cynefin-OW5HDTMX-PFWIGtvA.js +1 -0
- package/dist-ksadk/assets/{cynefinDiagram-5FMLGOSQ-BlW_bHED.js → cynefinDiagram-5FMLGOSQ-BIyq3EJb.js} +1 -1
- package/dist-ksadk/assets/{dagre-3AP2YEHR-Bu_S86_i.js → dagre-3AP2YEHR-eBw08Qdk.js} +1 -1
- package/dist-ksadk/assets/{dagre-B7nCawed.js → dagre-DfvnEf45.js} +1 -1
- package/dist-ksadk/assets/{diagram-S7CK7UJ4-W_Zow2Km.js → diagram-S7CK7UJ4-CUSrE3Mg.js} +1 -1
- package/dist-ksadk/assets/{diagram-UQ7AKVKN-CLIKAHON.js → diagram-UQ7AKVKN-Dq5Zw2gy.js} +1 -1
- package/dist-ksadk/assets/{diagram-VSXAHHWV-Dv6_QAlN.js → diagram-VSXAHHWV-DyUHfNwT.js} +1 -1
- package/dist-ksadk/assets/{diagram-VX7I27RA-BWAWRDtZ.js → diagram-VX7I27RA-CREmM89O.js} +1 -1
- package/dist-ksadk/assets/{diagram-Z3DM3KII-XA_rWMss.js → diagram-Z3DM3KII-Dw9zhHUK.js} +1 -1
- package/dist-ksadk/assets/{dist-CGt_UGeO.js → dist-0uJ4tdx6.js} +1 -1
- package/dist-ksadk/assets/{dist-C0J5_3qM.js → dist-AEv-vXf-.js} +1 -1
- package/dist-ksadk/assets/{dist-CIpWk_5f.js → dist-B49GzZDb.js} +1 -1
- package/dist-ksadk/assets/{dist-B3bA05-e.js → dist-B8Myiet9.js} +1 -1
- package/dist-ksadk/assets/{dist-DWfdmz9s.js → dist-BBsYarrI.js} +1 -1
- package/dist-ksadk/assets/{dist-BLpRy_Yx.js → dist-BQMrUwdI.js} +1 -1
- package/dist-ksadk/assets/{dist-CIRMvUM4.js → dist-BX_-FENW.js} +1 -1
- package/dist-ksadk/assets/{dist-BdNFAney.js → dist-CD4L6ymH.js} +1 -1
- package/dist-ksadk/assets/{dist-n3n6t_FO.js → dist-CHpW1BHj.js} +1 -1
- package/dist-ksadk/assets/{dist-DppE_r-D.js → dist-CVPau3tn.js} +1 -1
- package/dist-ksadk/assets/{dist-qe8xjesy.js → dist-C_qdxcSH.js} +1 -1
- package/dist-ksadk/assets/{dist-2vL2sAdF.js → dist-Co68Apq4.js} +1 -1
- package/dist-ksadk/assets/{dist-1nXCdsej.js → dist-Cp2PaOMY.js} +1 -1
- package/dist-ksadk/assets/{dist-DNKuMzWc.js → dist-CuR5Bgme.js} +1 -1
- package/dist-ksadk/assets/{dist-t6MzE0jU.js → dist-DDSyLEOX.js} +1 -1
- package/dist-ksadk/assets/{dist-CPyieXEf.js → dist-DUxO0R99.js} +1 -1
- package/dist-ksadk/assets/{dist-DyG6Ya-z.js → dist-QzbGrED_.js} +1 -1
- package/dist-ksadk/assets/{dist-0X_j2Rcc.js → dist-bupkyEBZ.js} +1 -1
- package/dist-ksadk/assets/{dist-mqD5TZup.js → dist-cxTGfdqx.js} +1 -1
- package/dist-ksadk/assets/{dist-M-SrdhhZ.js → dist-hL5p1til.js} +1 -1
- package/dist-ksadk/assets/{dist-D-92S-Fd.js → dist-lOy23y43.js} +1 -1
- package/dist-ksadk/assets/{dist-BO_UwatH.js → dist-pq-nD33R.js} +1 -1
- package/dist-ksadk/assets/{ebnfDiagram-PWID7BFC-BfCzF1Xi.js → ebnfDiagram-PWID7BFC-BS5LdNoR.js} +1 -1
- package/dist-ksadk/assets/{erDiagram-SSCWMZ5O-Dpz9_0zn.js → erDiagram-SSCWMZ5O-Bv1QtiY-.js} +1 -1
- package/dist-ksadk/assets/eventmodeling-NTZA5JFV-DsM4upQX.js +1 -0
- package/dist-ksadk/assets/flowDiagram-A5DVABFB-D5NA16k9.js +1 -0
- package/dist-ksadk/assets/{ganttDiagram-EL5Y4UJY-DDaG1f4_.js → ganttDiagram-EL5Y4UJY-musi-e0G.js} +1 -1
- package/dist-ksadk/assets/gitGraph-4MIJSDKK-DUCVz-ih.js +1 -0
- package/dist-ksadk/assets/{gitGraphDiagram-WWUBYQGX-DcxzRwYC.js → gitGraphDiagram-WWUBYQGX-DH37EGkG.js} +1 -1
- package/dist-ksadk/assets/index-CZdkAvsv.js +244 -0
- package/dist-ksadk/assets/index-CvXdHgF3.css +2 -0
- package/dist-ksadk/assets/info-A6RAGUB7-rw0ZNHZp.js +1 -0
- package/dist-ksadk/assets/{infoDiagram-RXCK75RN-CYMdn6lQ.js → infoDiagram-RXCK75RN-C1kEtv2y.js} +1 -1
- package/dist-ksadk/assets/{ishikawaDiagram-5VMMS53U-CLHFAD6c.js → ishikawaDiagram-5VMMS53U-BCNPyMka.js} +1 -1
- package/dist-ksadk/assets/{journeyDiagram-EYS64GPL-BHSKQGAl.js → journeyDiagram-EYS64GPL--cDbKnjP.js} +1 -1
- package/dist-ksadk/assets/{kanban-definition-3QL26DDD-D5W3tjTT.js → kanban-definition-3QL26DDD-R1rAVw2f.js} +1 -1
- package/dist-ksadk/assets/{katex-mtjOi4KM.js → katex-BT-X-V7U.js} +1 -1
- package/dist-ksadk/assets/{linear-BETqsxE_.js → linear-DTR631iG.js} +1 -1
- package/dist-ksadk/assets/{mermaid-parser.core-DPWrvs90.js → mermaid-parser.core-DfFzJhX8.js} +2 -2
- package/dist-ksadk/assets/{mindmap-definition-FBJOCRG2-CJG2mfBP.js → mindmap-definition-FBJOCRG2-D4by_rmk.js} +1 -1
- package/dist-ksadk/assets/packet-AYTQ26CC-Ca4Hvki9.js +1 -0
- package/dist-ksadk/assets/{pegDiagram-XKGWAZYB-GjAPNaqn.js → pegDiagram-XKGWAZYB-xWXPEh0c.js} +1 -1
- package/dist-ksadk/assets/pie-WAS4IAKB-hwiz6fbw.js +1 -0
- package/dist-ksadk/assets/{pieDiagram-E7YTZNPT-ToIewrqr.js → pieDiagram-E7YTZNPT-BudBDlCI.js} +1 -1
- package/dist-ksadk/assets/{quadrantDiagram-AXDQQJYC-4d78KiEY.js → quadrantDiagram-AXDQQJYC-DXZ0PCJF.js} +1 -1
- package/dist-ksadk/assets/radar-RG4KPBEZ-BR1oZXLM.js +1 -0
- package/dist-ksadk/assets/railroad-74A4TZTK-DfgEISfX.js +1 -0
- package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-CWOC3rdk.js +1 -0
- package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-CiRvHCLY.js +1 -0
- package/dist-ksadk/assets/railroad-peg-WCYAUIDC-DSDDyJ2f.js +1 -0
- package/dist-ksadk/assets/{railroadDiagram-O6MQD6OU-DKzx4xfv.js → railroadDiagram-O6MQD6OU-BdAYRYB8.js} +1 -1
- package/dist-ksadk/assets/{requirementDiagram-EFPCY7ZU-CJYljxQS.js → requirementDiagram-EFPCY7ZU-CBBmaL70.js} +1 -1
- package/dist-ksadk/assets/{sankeyDiagram-P5KCCOFB-DLU2fV1w.js → sankeyDiagram-P5KCCOFB-Doc3rdwp.js} +1 -1
- package/dist-ksadk/assets/{sequenceDiagram-WJ2MYXX4-CVqysrA9.js → sequenceDiagram-WJ2MYXX4-0J8R8hWW.js} +1 -1
- package/dist-ksadk/assets/{sizeCapture-X5ZJPWSS-BUxfmTHc.js → sizeCapture-X5ZJPWSS-CfFLlWsK.js} +1 -1
- package/dist-ksadk/assets/{stateDiagram-HBIQ2CUA-CNFgYI9E.js → stateDiagram-HBIQ2CUA-jBwkjtTy.js} +1 -1
- package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-Cw1fPb5w.js +1 -0
- package/dist-ksadk/assets/{swimlanes-XN3QIQJK-B6qCMe8N.js → swimlanes-XN3QIQJK-B0WxTQf8.js} +1 -1
- package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-Cc3JMBAF.js +8 -0
- package/dist-ksadk/assets/{timeline-definition-24CTP7MA-CMD3x_U_.js → timeline-definition-24CTP7MA-BfCT_75A.js} +1 -1
- package/dist-ksadk/assets/treeView-Q6P3EWNA-C05SJHxo.js +1 -0
- package/dist-ksadk/assets/treemap-WGGIJYW6-BqNLAhc3.js +1 -0
- package/dist-ksadk/assets/{vennDiagram-4TSXK5OY-BqtUqvXM.js → vennDiagram-4TSXK5OY-9gX1VMDC.js} +1 -1
- package/dist-ksadk/assets/wardley-WFR3VGLG-DokNktqB.js +1 -0
- package/dist-ksadk/assets/{wardleyDiagram-VM6X3IG4-B5KfDjI-.js → wardleyDiagram-VM6X3IG4-sEs_BP6O.js} +1 -1
- package/dist-ksadk/assets/{xychartDiagram-S5SC5T6Z-BaUlSZrn.js → xychartDiagram-S5SC5T6Z-Ll4jvUN9.js} +1 -1
- package/dist-ksadk/index.html +2 -2
- package/dist-lib/App.d.ts.map +1 -1
- package/dist-lib/{AttachmentPreview-tjd7Ufsh.js → AttachmentPreview-lufx89xJ.js} +174 -174
- package/dist-lib/{ConnectedComposer-BaRxxvhk.js → ConnectedComposer-Dd8ZFhfL.js} +214 -213
- package/dist-lib/{ConnectedMessageList-XLBootgU.js → ConnectedMessageList-CzTOJbZU.js} +582 -510
- package/dist-lib/{InteractionSchemaForm-BNoW5wzt.js → InteractionSchemaForm-ChYkHPop.js} +88 -71
- package/dist-lib/{WorkspacePanelContainer-B2mk7udj.js → WorkspacePanelContainer-BDbgHg1_.js} +2 -2
- package/dist-lib/{a2ui-BEQoW34n.js → a2ui-DfAshhMK.js} +8 -3
- package/dist-lib/api/messages.d.ts +88 -0
- package/dist-lib/api/messages.d.ts.map +1 -0
- package/dist-lib/chat-composer.js +2 -2
- package/dist-lib/chat-timeline.js +3 -3
- package/dist-lib/cloudMaterials-D75jTrkQ.js +2686 -0
- package/dist-lib/components/chat/AgentBlockView.d.ts +9 -0
- package/dist-lib/components/chat/AgentBlockView.d.ts.map +1 -0
- package/dist-lib/components/chat/ChatComposer.d.ts.map +1 -1
- package/dist-lib/components/chat/ChatMessageList.d.ts +4 -2
- package/dist-lib/components/chat/ChatMessageList.d.ts.map +1 -1
- package/dist-lib/components/chat/ConnectedComposer.d.ts +1 -1
- package/dist-lib/components/chat/ConnectedComposer.d.ts.map +1 -1
- package/dist-lib/components/chat/ConnectedMessageList.d.ts +4 -1
- package/dist-lib/components/chat/ConnectedMessageList.d.ts.map +1 -1
- package/dist-lib/components/chat/InteractionSchemaForm.d.ts.map +1 -1
- package/dist-lib/components/chat/InteractionTray.d.ts.map +1 -1
- package/dist-lib/components/chat/ProcessingBlocksView.d.ts +2 -2
- package/dist-lib/components/chat/ProcessingBlocksView.d.ts.map +1 -1
- package/dist-lib/components/chat/StatusBanner.d.ts.map +1 -1
- package/dist-lib/components/chat/approval-status.d.ts +5 -0
- package/dist-lib/components/chat/approval-status.d.ts.map +1 -0
- package/dist-lib/components/chat/types.d.ts +13 -1
- package/dist-lib/components/chat/types.d.ts.map +1 -1
- package/dist-lib/components/teams/CloudEffectsPanel.d.ts +15 -0
- package/dist-lib/components/teams/CloudEffectsPanel.d.ts.map +1 -0
- package/dist-lib/components/teams/CloudTeamWorkspace.d.ts +38 -0
- package/dist-lib/components/teams/CloudTeamWorkspace.d.ts.map +1 -0
- package/dist-lib/components/teams/CreateGroupDialog.d.ts +3 -1
- package/dist-lib/components/teams/CreateGroupDialog.d.ts.map +1 -1
- package/dist-lib/components/teams/TeamWorkspace.d.ts.map +1 -1
- package/dist-lib/components.js +6 -6
- package/dist-lib/conversation.js +8 -34
- package/dist-lib/core/api/facade.d.ts +18 -10
- package/dist-lib/core/api/facade.d.ts.map +1 -1
- package/dist-lib/core/api/types.d.ts +28 -3
- package/dist-lib/core/api/types.d.ts.map +1 -1
- package/dist-lib/core/conversation/agent.d.ts +49 -0
- package/dist-lib/core/conversation/agent.d.ts.map +1 -0
- package/dist-lib/core/conversation/client.d.ts +2 -0
- package/dist-lib/core/conversation/client.d.ts.map +1 -1
- package/dist-lib/core/conversation/contracts.d.ts.map +1 -1
- package/dist-lib/core/conversation/hosted.d.ts.map +1 -1
- package/dist-lib/core/conversation/index.d.ts +4 -1
- package/dist-lib/core/conversation/index.d.ts.map +1 -1
- package/dist-lib/core/conversation/presentation.d.ts.map +1 -1
- package/dist-lib/core/conversation/reducer.d.ts.map +1 -1
- package/dist-lib/core/conversation/renderer-registry.d.ts +1 -0
- package/dist-lib/core/conversation/renderer-registry.d.ts.map +1 -1
- package/dist-lib/core/conversation/runtime-ingress.d.ts +22 -0
- package/dist-lib/core/conversation/runtime-ingress.d.ts.map +1 -0
- package/dist-lib/core/conversation/safe-tool-value.d.ts +8 -0
- package/dist-lib/core/conversation/safe-tool-value.d.ts.map +1 -0
- package/dist-lib/core/conversation/scoped-cancel.d.ts +16 -0
- package/dist-lib/core/conversation/scoped-cancel.d.ts.map +1 -0
- package/dist-lib/core/conversation/types.d.ts +6 -1
- package/dist-lib/core/conversation/types.d.ts.map +1 -1
- package/dist-lib/core/interaction/adapters/legacy-runtime-events.d.ts +8 -0
- package/dist-lib/core/interaction/adapters/legacy-runtime-events.d.ts.map +1 -0
- package/dist-lib/core/interaction/adapters/responses.d.ts +1 -0
- package/dist-lib/core/interaction/adapters/responses.d.ts.map +1 -1
- package/dist-lib/core/interaction/adapters/session-events.d.ts.map +1 -1
- package/dist-lib/core/interaction/client.d.ts +3 -2
- package/dist-lib/core/interaction/client.d.ts.map +1 -1
- package/dist-lib/core/interaction/index.d.ts +4 -0
- package/dist-lib/core/interaction/index.d.ts.map +1 -1
- package/dist-lib/core/interaction/legacy-history.d.ts +5 -0
- package/dist-lib/core/interaction/legacy-history.d.ts.map +1 -0
- package/dist-lib/core/interaction/store.d.ts +4 -0
- package/dist-lib/core/interaction/store.d.ts.map +1 -1
- package/dist-lib/core/interaction/types.d.ts +2 -0
- package/dist-lib/core/interaction/types.d.ts.map +1 -1
- package/dist-lib/core/run/blocks.d.ts +2 -1
- package/dist-lib/core/run/blocks.d.ts.map +1 -1
- package/dist-lib/core/run/dispatcher.d.ts.map +1 -1
- package/dist-lib/core/run/engine.d.ts +2 -0
- package/dist-lib/core/run/engine.d.ts.map +1 -1
- package/dist-lib/core/run/types.d.ts +7 -1
- package/dist-lib/core/run/types.d.ts.map +1 -1
- package/dist-lib/core/stream/kernel-events.d.ts +2 -0
- package/dist-lib/core/stream/kernel-events.d.ts.map +1 -1
- package/dist-lib/core/stream/responses-protocol.d.ts.map +1 -1
- package/dist-lib/core/stream/runtime-items.d.ts +2 -2
- package/dist-lib/core/stream/runtime-items.d.ts.map +1 -1
- package/dist-lib/core/stream/types.d.ts +4 -0
- package/dist-lib/core/stream/types.d.ts.map +1 -1
- package/dist-lib/core/teams/cloudCanonical.d.ts +11 -0
- package/dist-lib/core/teams/cloudCanonical.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudClient.d.ts +30 -0
- package/dist-lib/core/teams/cloudClient.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudContracts.d.ts +1499 -0
- package/dist-lib/core/teams/cloudContracts.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudEffects.d.ts +167 -0
- package/dist-lib/core/teams/cloudEffects.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudExtendedContracts.d.ts +1014 -0
- package/dist-lib/core/teams/cloudExtendedContracts.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudMaterials.d.ts +83 -0
- package/dist-lib/core/teams/cloudMaterials.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudOperations.d.ts +30 -0
- package/dist-lib/core/teams/cloudOperations.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudProductClient.d.ts +177 -0
- package/dist-lib/core/teams/cloudProductClient.d.ts.map +1 -0
- package/dist-lib/core/teams/cloudScope.d.ts +6 -0
- package/dist-lib/core/teams/cloudScope.d.ts.map +1 -0
- package/dist-lib/core/teams/operationOutbox.d.ts +138 -0
- package/dist-lib/core/teams/operationOutbox.d.ts.map +1 -0
- package/dist-lib/core/teams/workspaceContracts.d.ts +1696 -0
- package/dist-lib/core/teams/workspaceContracts.d.ts.map +1 -0
- package/dist-lib/core/teams/workspaceObserver.d.ts +49 -0
- package/dist-lib/core/teams/workspaceObserver.d.ts.map +1 -0
- package/dist-lib/core/teams/workspaceReducer.d.ts +37 -0
- package/dist-lib/core/teams/workspaceReducer.d.ts.map +1 -0
- package/dist-lib/hooks/useAgentChat.d.ts +2 -7
- package/dist-lib/hooks/useAgentChat.d.ts.map +1 -1
- package/dist-lib/hooks/useFeedback.d.ts +2 -2
- package/dist-lib/hooks/useFeedback.d.ts.map +1 -1
- package/dist-lib/hooks/useImeComposition.d.ts +21 -0
- package/dist-lib/hooks/useImeComposition.d.ts.map +1 -0
- package/dist-lib/hooks/useInteractions.d.ts +1 -1
- package/dist-lib/hooks/useInteractions.d.ts.map +1 -1
- package/dist-lib/hooks/useRunAgent.d.ts +3 -1
- package/dist-lib/hooks/useRunAgent.d.ts.map +1 -1
- package/dist-lib/hooks/useSessionLifecycle.d.ts +1 -1
- package/dist-lib/hooks/useSessionLifecycle.d.ts.map +1 -1
- package/dist-lib/hooks.js +9 -9
- package/dist-lib/{permission-CcMWqN8Y.js → permission-B2MuVypC.js} +1 -1
- package/dist-lib/persisted-session-history-CBk_ypXo.js +2888 -0
- package/dist-lib/public/chat-timeline.d.ts +2 -0
- package/dist-lib/public/chat-timeline.d.ts.map +1 -1
- package/dist-lib/public/conversation.d.ts +3 -1
- package/dist-lib/public/conversation.d.ts.map +1 -1
- package/dist-lib/public/team-components.d.ts +1 -0
- package/dist-lib/public/team-components.d.ts.map +1 -1
- package/dist-lib/public/teams.d.ts +11 -0
- package/dist-lib/public/teams.d.ts.map +1 -1
- package/dist-lib/{reducer-BP8YVv-Q.js → reducer-mbYiX0wz.js} +81 -13
- package/dist-lib/{runtime-items-q6tMjfGU.js → runtime-items-VPq7711E.js} +0 -0
- package/dist-lib/runtime.js +287 -226
- package/dist-lib/stores/session.d.ts +20 -11
- package/dist-lib/stores/session.d.ts.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/dist-lib/team-components.js +1877 -752
- package/dist-lib/teams.css +54 -0
- package/dist-lib/teams.js +677 -215
- package/dist-lib/types/agent-control.d.ts +2 -0
- package/dist-lib/types/agent-control.d.ts.map +1 -1
- package/dist-lib/types/capabilities.d.ts +6 -0
- package/dist-lib/types/capabilities.d.ts.map +1 -1
- package/dist-lib/types/session-events.d.ts +1 -0
- package/dist-lib/types/session-events.d.ts.map +1 -1
- package/dist-lib/{useSessionLifecycle-DQXKeBm9.js → useSessionLifecycle-DS3PPoWK.js} +1316 -1041
- package/dist-lib/utils/history-preparation.d.ts +8 -0
- package/dist-lib/utils/history-preparation.d.ts.map +1 -0
- package/dist-lib/utils/messages.d.ts +8 -4
- package/dist-lib/utils/messages.d.ts.map +1 -1
- package/dist-lib/utils/persisted-session-history.d.ts +1 -1
- package/dist-lib/utils/persisted-session-history.d.ts.map +1 -1
- package/dist-lib/utils/session-events.d.ts.map +1 -1
- package/dist-lib/utils/transcript-order.d.ts +10 -0
- package/dist-lib/utils/transcript-order.d.ts.map +1 -0
- package/package.json +4 -2
- package/schemas/teams-cloud/v1/binding-probe-permit.schema.json +1 -0
- package/schemas/teams-cloud/v1/build-artifact-lookup-input.schema.json +1 -0
- package/schemas/teams-cloud/v1/build-artifact-lookup-result.schema.json +1 -0
- package/schemas/teams-cloud/v1/build-artifact-receipt.schema.json +1 -0
- package/schemas/teams-cloud/v1/build-manifest.schema.json +1 -0
- package/schemas/teams-cloud/v1/callback-permit.schema.json +1 -0
- package/schemas/teams-cloud/v1/canonical-event-batch.schema.json +1 -0
- package/schemas/teams-cloud/v1/deployment-artifact-receipt.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-outcome.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-prepared-receipt.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-projection-page.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-projection.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-reconcile-input.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-record.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-report-receipt.schema.json +1 -0
- package/schemas/teams-cloud/v1/effect-request.schema.json +1 -0
- package/schemas/teams-cloud/v1/execution-effects-page.schema.json +1 -0
- package/schemas/teams-cloud/v1/execution-effects-request.schema.json +1 -0
- package/schemas/teams-cloud/v1/execution-permit.schema.json +1 -0
- package/schemas/teams-cloud/v1/execution-reference.schema.json +1 -0
- package/schemas/teams-cloud/v1/execution-result.schema.json +1 -0
- package/schemas/teams-cloud/v1/host-operation-result.schema.json +1 -0
- package/schemas/teams-cloud/v1/host-receipt.schema.json +1 -0
- package/schemas/teams-cloud/v1/loaded-build-evidence.schema.json +1 -0
- package/schemas/teams-cloud/v1/manifest.json +43 -0
- package/schemas/teams-cloud/v1/material-create.schema.json +1 -0
- package/schemas/teams-cloud/v1/material-manifest.schema.json +1 -0
- package/schemas/teams-cloud/v1/node-command.schema.json +1 -0
- package/schemas/teams-cloud/v1/node-probe-command.schema.json +1 -0
- package/schemas/teams-cloud/v1/node-probe-report.schema.json +1 -0
- package/schemas/teams-cloud/v1/node-report.schema.json +1 -0
- package/schemas/teams-cloud/v1/release-verification-receipt.schema.json +1 -0
- package/schemas/teams-cloud/v1/release-verify-input.schema.json +1 -0
- package/dist-ksadk/assets/architecture-7GRP2DOG-BCsa26zi.js +0 -1
- package/dist-ksadk/assets/channel-_KDifNys.js +0 -1
- package/dist-ksadk/assets/chunk-2Q5K7J3B-HdVkJ9F0.js +0 -1
- package/dist-ksadk/assets/classDiagram-DTDB5LWJ-BVCW3ZqZ.js +0 -1
- package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-BVCW3ZqZ.js +0 -1
- package/dist-ksadk/assets/cynefin-OW5HDTMX-CNXjFctL.js +0 -1
- package/dist-ksadk/assets/eventmodeling-NTZA5JFV-B5-8RH9c.js +0 -1
- package/dist-ksadk/assets/flowDiagram-A5DVABFB-BppFxEKw.js +0 -1
- package/dist-ksadk/assets/gitGraph-4MIJSDKK-B-AhYj4C.js +0 -1
- package/dist-ksadk/assets/index-BMd2mucF.css +0 -2
- package/dist-ksadk/assets/index-D5qyyhTH.js +0 -244
- package/dist-ksadk/assets/info-A6RAGUB7-0uiKrC35.js +0 -1
- package/dist-ksadk/assets/packet-AYTQ26CC-BVTmZ_cw.js +0 -1
- package/dist-ksadk/assets/pie-WAS4IAKB-DyfxBU7V.js +0 -1
- package/dist-ksadk/assets/radar-RG4KPBEZ-FFontjL2.js +0 -1
- package/dist-ksadk/assets/railroad-74A4TZTK-D0Uidzen.js +0 -1
- package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-BOo_9T2h.js +0 -1
- package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-D6-BjW7Z.js +0 -1
- package/dist-ksadk/assets/railroad-peg-WCYAUIDC-CXx__yMm.js +0 -1
- package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-BXAFScz8.js +0 -1
- package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-uIQ2lJKH.js +0 -8
- package/dist-ksadk/assets/treeView-Q6P3EWNA-CK5GgucZ.js +0 -1
- package/dist-ksadk/assets/treemap-WGGIJYW6-Bq1u1SpG.js +0 -1
- package/dist-ksadk/assets/wardley-WFR3VGLG-QAt06uEz.js +0 -1
- package/dist-lib/persisted-session-history-ClsfDfGs.js +0 -1991
- package/dist-lib/reducer-gQmR9Qb9.js +0 -424
|
@@ -0,0 +1,2686 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
//#region src/core/teams/types.ts
|
|
3
|
+
var t = "teams.ksadk.io/v1", n = e.string().min(1).max(2048), r = e.number().int().nonnegative(), i = e.string().min(1), a = e.enum([
|
|
4
|
+
"planning",
|
|
5
|
+
"running",
|
|
6
|
+
"waiting",
|
|
7
|
+
"needs_attention",
|
|
8
|
+
"awaiting_acceptance",
|
|
9
|
+
"succeeded",
|
|
10
|
+
"failed",
|
|
11
|
+
"cancel_requested",
|
|
12
|
+
"cancelled"
|
|
13
|
+
]), o = e.enum([
|
|
14
|
+
"draft",
|
|
15
|
+
"ready",
|
|
16
|
+
"blocked",
|
|
17
|
+
"running",
|
|
18
|
+
"awaiting_acceptance",
|
|
19
|
+
"succeeded",
|
|
20
|
+
"failed",
|
|
21
|
+
"cancel_requested",
|
|
22
|
+
"cancelled"
|
|
23
|
+
]), s = e.object({
|
|
24
|
+
authorityRef: n,
|
|
25
|
+
groupId: n,
|
|
26
|
+
memberId: n,
|
|
27
|
+
bindingRef: n,
|
|
28
|
+
providerRef: n,
|
|
29
|
+
sessionId: n,
|
|
30
|
+
runId: n,
|
|
31
|
+
itemId: n.optional()
|
|
32
|
+
}).passthrough(), c = s.extend({ interactionId: n }), l = e.object({
|
|
33
|
+
enqueue: e.boolean(),
|
|
34
|
+
cancel: e.boolean(),
|
|
35
|
+
steer: e.boolean(),
|
|
36
|
+
restore: e.boolean(),
|
|
37
|
+
interaction: e.boolean(),
|
|
38
|
+
leader: e.boolean()
|
|
39
|
+
}).passthrough(), u = e.object({
|
|
40
|
+
groupId: n,
|
|
41
|
+
name: e.string().min(1),
|
|
42
|
+
authorityRef: n,
|
|
43
|
+
tenantId: n,
|
|
44
|
+
ownerSubject: n,
|
|
45
|
+
policy: e.object({
|
|
46
|
+
taskAcceptance: e.enum([
|
|
47
|
+
"leader",
|
|
48
|
+
"human",
|
|
49
|
+
"result"
|
|
50
|
+
]),
|
|
51
|
+
peerWake: e.boolean()
|
|
52
|
+
}).optional(),
|
|
53
|
+
leaderMemberId: n,
|
|
54
|
+
revision: r,
|
|
55
|
+
status: e.enum(["active", "archived"]),
|
|
56
|
+
createdAt: i,
|
|
57
|
+
updatedAt: i
|
|
58
|
+
}).passthrough(), d = e.object({
|
|
59
|
+
memberId: n,
|
|
60
|
+
groupId: n,
|
|
61
|
+
name: e.string().min(1),
|
|
62
|
+
role: e.enum(["leader", "member"]),
|
|
63
|
+
responsibility: e.string().max(2e3).optional(),
|
|
64
|
+
bindingRef: n,
|
|
65
|
+
binding: e.object({
|
|
66
|
+
bindingRef: n,
|
|
67
|
+
providerRef: n,
|
|
68
|
+
kind: e.enum([
|
|
69
|
+
"local_build",
|
|
70
|
+
"a2a",
|
|
71
|
+
"cloud"
|
|
72
|
+
]),
|
|
73
|
+
agentId: n,
|
|
74
|
+
capabilities: l
|
|
75
|
+
}).passthrough(),
|
|
76
|
+
sessionId: n,
|
|
77
|
+
revision: r,
|
|
78
|
+
status: e.enum([
|
|
79
|
+
"active",
|
|
80
|
+
"removed",
|
|
81
|
+
"unavailable"
|
|
82
|
+
]),
|
|
83
|
+
executionStatus: e.enum([
|
|
84
|
+
"idle",
|
|
85
|
+
"queued",
|
|
86
|
+
"running",
|
|
87
|
+
"waiting",
|
|
88
|
+
"needs_attention",
|
|
89
|
+
"unavailable"
|
|
90
|
+
])
|
|
91
|
+
}).passthrough(), f = d.extend({
|
|
92
|
+
runMemberId: n,
|
|
93
|
+
teamRunId: n,
|
|
94
|
+
groupRevision: r
|
|
95
|
+
}), ee = e.discriminatedUnion("kind", [e.object({
|
|
96
|
+
kind: e.literal("text"),
|
|
97
|
+
text: e.string()
|
|
98
|
+
}), e.object({
|
|
99
|
+
kind: e.literal("attachment"),
|
|
100
|
+
attachmentRef: n,
|
|
101
|
+
mediaType: n,
|
|
102
|
+
name: e.string().optional()
|
|
103
|
+
})]), p = e.object({
|
|
104
|
+
messageId: n,
|
|
105
|
+
groupId: n,
|
|
106
|
+
revision: r,
|
|
107
|
+
createdAt: i,
|
|
108
|
+
senderPrincipal: n,
|
|
109
|
+
senderName: e.string(),
|
|
110
|
+
groupRole: e.enum([
|
|
111
|
+
"owner",
|
|
112
|
+
"leader",
|
|
113
|
+
"member",
|
|
114
|
+
"system"
|
|
115
|
+
]),
|
|
116
|
+
parts: e.array(ee),
|
|
117
|
+
mentions: e.array(n),
|
|
118
|
+
intent: e.enum([
|
|
119
|
+
"start_goal",
|
|
120
|
+
"followup",
|
|
121
|
+
"directed",
|
|
122
|
+
"note",
|
|
123
|
+
"result",
|
|
124
|
+
"progress"
|
|
125
|
+
]),
|
|
126
|
+
sourceRefs: e.array(s).optional(),
|
|
127
|
+
visibility: e.enum(["public", "internal"])
|
|
128
|
+
}).passthrough(), te = e.object({
|
|
129
|
+
artifactId: n,
|
|
130
|
+
name: e.string(),
|
|
131
|
+
mediaType: n,
|
|
132
|
+
source: s
|
|
133
|
+
}).passthrough(), ne = e.object({
|
|
134
|
+
attemptId: n,
|
|
135
|
+
attemptNumber: r,
|
|
136
|
+
executionEpoch: r,
|
|
137
|
+
status: o,
|
|
138
|
+
source: s.optional(),
|
|
139
|
+
artifacts: e.array(te)
|
|
140
|
+
}).passthrough(), re = e.object({
|
|
141
|
+
taskId: n,
|
|
142
|
+
groupId: n,
|
|
143
|
+
teamRunId: n,
|
|
144
|
+
revision: r,
|
|
145
|
+
title: e.string().min(1),
|
|
146
|
+
description: e.string(),
|
|
147
|
+
ownerMemberId: n.nullable(),
|
|
148
|
+
dependencies: e.array(n),
|
|
149
|
+
status: o,
|
|
150
|
+
acceptanceCriteria: e.string(),
|
|
151
|
+
attempts: e.array(ne)
|
|
152
|
+
}).passthrough(), ie = e.object({
|
|
153
|
+
sourcePath: e.string().min(1),
|
|
154
|
+
baseRef: e.string().optional(),
|
|
155
|
+
inputs: e.array(e.string()).optional(),
|
|
156
|
+
mode: e.enum(["auto", "directory"]).optional()
|
|
157
|
+
}).passthrough(), ae = e.object({
|
|
158
|
+
groupId: n,
|
|
159
|
+
teamRunId: n,
|
|
160
|
+
state: e.enum([
|
|
161
|
+
"armed",
|
|
162
|
+
"blocked",
|
|
163
|
+
"active"
|
|
164
|
+
]),
|
|
165
|
+
primaryNodeId: n,
|
|
166
|
+
primarySessionId: n,
|
|
167
|
+
primaryBindingRef: n,
|
|
168
|
+
standbyNodeId: n,
|
|
169
|
+
standbyBindingRef: n,
|
|
170
|
+
buildDigest: n,
|
|
171
|
+
epoch: r,
|
|
172
|
+
reason: e.string().nullable().optional(),
|
|
173
|
+
automaticFailback: e.literal(!1),
|
|
174
|
+
sessionId: n.optional(),
|
|
175
|
+
checkpointId: n.optional()
|
|
176
|
+
}).passthrough(), oe = e.object({
|
|
177
|
+
teamRunId: n,
|
|
178
|
+
groupId: n,
|
|
179
|
+
groupRevision: r,
|
|
180
|
+
policy: u.shape.policy,
|
|
181
|
+
revision: r,
|
|
182
|
+
goalMessageId: n,
|
|
183
|
+
goal: e.string(),
|
|
184
|
+
result: e.string().optional(),
|
|
185
|
+
resultHistory: e.array(e.object({
|
|
186
|
+
result: e.string(),
|
|
187
|
+
reason: e.string(),
|
|
188
|
+
revision: r,
|
|
189
|
+
requestedAt: i
|
|
190
|
+
}).passthrough()).optional(),
|
|
191
|
+
workspace: ie.nullable().optional(),
|
|
192
|
+
leaderStandby: ae.nullable().optional(),
|
|
193
|
+
leaderMemberId: n,
|
|
194
|
+
status: a,
|
|
195
|
+
dispatchSuspended: e.boolean(),
|
|
196
|
+
dispatchEpoch: r,
|
|
197
|
+
budget: e.object({
|
|
198
|
+
maxMembers: r,
|
|
199
|
+
maxConcurrent: r,
|
|
200
|
+
maxStarts: r,
|
|
201
|
+
startsUsed: r,
|
|
202
|
+
maxHops: r
|
|
203
|
+
}).passthrough(),
|
|
204
|
+
createdAt: i,
|
|
205
|
+
updatedAt: i
|
|
206
|
+
}).passthrough(), se = e.object({
|
|
207
|
+
deliveryId: n,
|
|
208
|
+
groupId: n,
|
|
209
|
+
teamRunId: n,
|
|
210
|
+
messageId: n,
|
|
211
|
+
memberId: n,
|
|
212
|
+
revision: r,
|
|
213
|
+
status: e.enum([
|
|
214
|
+
"pending",
|
|
215
|
+
"accepted",
|
|
216
|
+
"rejected",
|
|
217
|
+
"uncertain",
|
|
218
|
+
"cancelled"
|
|
219
|
+
])
|
|
220
|
+
}).passthrough(), ce = e.object({
|
|
221
|
+
ref: c,
|
|
222
|
+
revision: r,
|
|
223
|
+
title: e.string(),
|
|
224
|
+
message: e.string(),
|
|
225
|
+
kind: e.enum(["approval", "input"]),
|
|
226
|
+
status: e.enum([
|
|
227
|
+
"pending",
|
|
228
|
+
"resolving",
|
|
229
|
+
"resolved",
|
|
230
|
+
"cancelled",
|
|
231
|
+
"expired"
|
|
232
|
+
]),
|
|
233
|
+
createdAt: i
|
|
234
|
+
}).passthrough(), le = e.object({
|
|
235
|
+
apiVersion: e.literal(t),
|
|
236
|
+
group: u,
|
|
237
|
+
watermark: r,
|
|
238
|
+
members: e.array(d),
|
|
239
|
+
runMembers: e.array(f).optional(),
|
|
240
|
+
messages: e.array(p),
|
|
241
|
+
tasks: e.array(re),
|
|
242
|
+
teamRuns: e.array(oe),
|
|
243
|
+
deliveries: e.array(se),
|
|
244
|
+
interactions: e.array(ce),
|
|
245
|
+
artifacts: e.array(te).optional()
|
|
246
|
+
}).passthrough(), ue = e.object({
|
|
247
|
+
apiVersion: e.literal(t),
|
|
248
|
+
eventId: n,
|
|
249
|
+
groupId: n,
|
|
250
|
+
groupSeq: e.number().int().positive(),
|
|
251
|
+
type: n,
|
|
252
|
+
createdAt: i,
|
|
253
|
+
payload: e.record(e.string(), e.unknown())
|
|
254
|
+
}).passthrough(), de = e.object({
|
|
255
|
+
nodeId: n,
|
|
256
|
+
kind: e.enum([
|
|
257
|
+
"task",
|
|
258
|
+
"run",
|
|
259
|
+
"child_invocation"
|
|
260
|
+
]),
|
|
261
|
+
title: e.string(),
|
|
262
|
+
status: n,
|
|
263
|
+
taskId: n.optional(),
|
|
264
|
+
memberId: n.nullable().optional(),
|
|
265
|
+
attemptId: n.optional(),
|
|
266
|
+
source: s.nullable().optional(),
|
|
267
|
+
parentNodeId: n.optional(),
|
|
268
|
+
reason: e.string().nullable().optional()
|
|
269
|
+
}).passthrough(), fe = e.object({
|
|
270
|
+
groupId: n,
|
|
271
|
+
teamRunId: n,
|
|
272
|
+
watermark: r,
|
|
273
|
+
nodes: e.array(de),
|
|
274
|
+
edges: e.array(e.object({
|
|
275
|
+
source: n,
|
|
276
|
+
target: n,
|
|
277
|
+
kind: e.enum(["dependency", "invocation"])
|
|
278
|
+
}).passthrough())
|
|
279
|
+
}).passthrough();
|
|
280
|
+
function pe(e) {
|
|
281
|
+
let t = fe.safeParse(e);
|
|
282
|
+
if (!t.success) throw new m("contract_mismatch", "执行视图格式不兼容,请刷新或更新客户端。");
|
|
283
|
+
let n = t.data, r = new Set(n.nodes.map((e) => e.nodeId));
|
|
284
|
+
if (r.size !== n.nodes.length || n.edges.some((e) => !r.has(e.source) || !r.has(e.target)) || n.nodes.some((e) => e.source && e.source.groupId !== n.groupId)) throw new m("scope_mismatch", "执行视图包含无效的节点引用。");
|
|
285
|
+
return n;
|
|
286
|
+
}
|
|
287
|
+
var m = class extends Error {
|
|
288
|
+
code;
|
|
289
|
+
status;
|
|
290
|
+
constructor(e, t, n) {
|
|
291
|
+
super(t), this.name = "TeamsError", this.code = e, this.status = n;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
function h(e) {
|
|
295
|
+
let t = le.safeParse(e);
|
|
296
|
+
if (!t.success) throw new m("contract_mismatch", "群快照格式不兼容,请刷新或更新客户端。");
|
|
297
|
+
let n = t.data, r = n.group.groupId;
|
|
298
|
+
if ([
|
|
299
|
+
n.runMembers || [],
|
|
300
|
+
n.members,
|
|
301
|
+
n.messages,
|
|
302
|
+
n.tasks,
|
|
303
|
+
n.teamRuns,
|
|
304
|
+
n.deliveries
|
|
305
|
+
].some((e) => e.some((e) => e.groupId !== r)) || n.interactions.some((e) => e.ref.groupId !== r || e.ref.authorityRef !== n.group.authorityRef)) throw new m("scope_mismatch", "群快照包含其他作用域的数据。");
|
|
306
|
+
if ([
|
|
307
|
+
...(n.artifacts || []).map((e) => e.source),
|
|
308
|
+
...n.messages.flatMap((e) => e.sourceRefs || []),
|
|
309
|
+
...n.tasks.flatMap((e) => e.attempts.flatMap((e) => [...e.source ? [e.source] : [], ...e.artifacts.map((e) => e.source)]))
|
|
310
|
+
].some((e) => e.groupId !== r || e.authorityRef !== n.group.authorityRef)) throw new m("scope_mismatch", "群快照的产物或执行来源跨越作用域。");
|
|
311
|
+
let i = (e) => new Set(e).size === e.length;
|
|
312
|
+
if (!i((n.runMembers || []).map((e) => e.runMemberId)) || (n.runMembers || []).some((e) => !n.teamRuns.some((t) => t.teamRunId === e.teamRunId)) || !i((n.artifacts || []).map((e) => e.artifactId)) || !i(n.members.map((e) => e.memberId)) || !i(n.messages.map((e) => e.messageId)) || !i(n.tasks.map((e) => e.taskId)) || !i(n.teamRuns.map((e) => e.teamRunId)) || !i(n.deliveries.map((e) => e.deliveryId)) || !i(n.interactions.map((e) => JSON.stringify(e.ref)))) throw new m("contract_mismatch", "群快照存在重复身份。");
|
|
313
|
+
return n;
|
|
314
|
+
}
|
|
315
|
+
function me(e) {
|
|
316
|
+
let t = ue.safeParse(e);
|
|
317
|
+
if (!t.success) throw new m("contract_mismatch", "群事件格式不兼容。");
|
|
318
|
+
return t.data;
|
|
319
|
+
}
|
|
320
|
+
function he(e) {
|
|
321
|
+
if (!e.name.trim()) throw new m("invalid_name", "请填写群组名称。");
|
|
322
|
+
if (!e.members.length || e.members.length > 8) throw new m("invalid_members", "请选择 1–8 位成员。");
|
|
323
|
+
if (new Set(e.members.map((e) => e.memberId)).size !== e.members.length) throw new m("duplicate_member", "成员不能重复。");
|
|
324
|
+
if (!e.members.some((t) => t.memberId === e.leaderMemberId)) throw new m("invalid_leader", "Leader 必须是已选成员。");
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/core/teams/reducer.ts
|
|
328
|
+
function ge(e) {
|
|
329
|
+
return JSON.stringify([
|
|
330
|
+
e.authorityRef,
|
|
331
|
+
e.groupId,
|
|
332
|
+
e.memberId,
|
|
333
|
+
e.bindingRef,
|
|
334
|
+
e.providerRef,
|
|
335
|
+
e.sessionId,
|
|
336
|
+
e.runId
|
|
337
|
+
]);
|
|
338
|
+
}
|
|
339
|
+
function _e(e) {
|
|
340
|
+
return JSON.stringify([ge(e), e.interactionId]);
|
|
341
|
+
}
|
|
342
|
+
function g(e, t, n) {
|
|
343
|
+
let r = e.findIndex((e) => n(e) === n(t));
|
|
344
|
+
return r >= 0 && e[r].revision >= t.revision ? e : r < 0 ? [...e, t] : e.map((e, n) => n === r ? t : e);
|
|
345
|
+
}
|
|
346
|
+
var ve = class {
|
|
347
|
+
value;
|
|
348
|
+
seenIds = /* @__PURE__ */ new Set();
|
|
349
|
+
constructor(e) {
|
|
350
|
+
this.value = h(e);
|
|
351
|
+
}
|
|
352
|
+
snapshot() {
|
|
353
|
+
return this.value;
|
|
354
|
+
}
|
|
355
|
+
replace(e) {
|
|
356
|
+
let t = h(e);
|
|
357
|
+
if (t.group.groupId !== this.value.group.groupId || t.group.authorityRef !== this.value.group.authorityRef || t.group.tenantId !== this.value.group.tenantId) throw new m("scope_mismatch", "不能把另一个群或授权域的快照用于当前会话。");
|
|
358
|
+
return t.watermark < this.value.watermark || t.group.revision < this.value.group.revision ? !1 : (this.value = t, this.seenIds.clear(), !0);
|
|
359
|
+
}
|
|
360
|
+
apply(e) {
|
|
361
|
+
let t = me(e), n = this.value;
|
|
362
|
+
if (t.groupId !== n.group.groupId) throw new m("scope_mismatch", "事件不属于当前群。");
|
|
363
|
+
if (t.groupSeq <= n.watermark) return !1;
|
|
364
|
+
if (t.groupSeq !== n.watermark + 1 || this.seenIds.has(t.eventId)) throw new m("reset_required", "群事件存在缺口,需要重新读取快照。");
|
|
365
|
+
let r = {
|
|
366
|
+
...n,
|
|
367
|
+
watermark: t.groupSeq
|
|
368
|
+
}, i = (e, t) => {
|
|
369
|
+
let r;
|
|
370
|
+
try {
|
|
371
|
+
r = e.parse(t);
|
|
372
|
+
} catch {
|
|
373
|
+
throw new m("contract_mismatch", "群事件内容格式不兼容。");
|
|
374
|
+
}
|
|
375
|
+
let i = r;
|
|
376
|
+
if (i.groupId && i.groupId !== n.group.groupId || i.ref && (i.ref.groupId !== n.group.groupId || i.ref.authorityRef !== n.group.authorityRef)) throw new m("scope_mismatch", "群事件引用了其他作用域。");
|
|
377
|
+
if ([
|
|
378
|
+
...i.source ? [i.source] : [],
|
|
379
|
+
...i.sourceRefs || [],
|
|
380
|
+
...(i.attempts || []).flatMap((e) => [...e.source ? [e.source] : [], ...e.artifacts.map((e) => e.source)])
|
|
381
|
+
].some((e) => e.groupId !== n.group.groupId || e.authorityRef !== n.group.authorityRef)) throw new m("scope_mismatch", "群事件的产物或执行来源跨越作用域。");
|
|
382
|
+
return r;
|
|
383
|
+
};
|
|
384
|
+
switch (t.type) {
|
|
385
|
+
case "group.updated": {
|
|
386
|
+
let e = i(u, t.payload.group);
|
|
387
|
+
if (e.groupId !== n.group.groupId || e.authorityRef !== n.group.authorityRef || e.tenantId !== n.group.tenantId) throw new m("scope_mismatch", "群事件改变了授权域。");
|
|
388
|
+
e.revision > n.group.revision && (r.group = e);
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
case "run_member.updated":
|
|
392
|
+
r.runMembers = g(n.runMembers || [], i(f, t.payload.runMember), (e) => e.runMemberId);
|
|
393
|
+
break;
|
|
394
|
+
case "member.updated":
|
|
395
|
+
r.members = g(n.members, i(d, t.payload.member), (e) => e.memberId);
|
|
396
|
+
break;
|
|
397
|
+
case "message.created":
|
|
398
|
+
case "message.updated":
|
|
399
|
+
r.messages = g(n.messages, i(p, t.payload.message), (e) => e.messageId);
|
|
400
|
+
break;
|
|
401
|
+
case "task.updated":
|
|
402
|
+
r.tasks = g(n.tasks, i(re, t.payload.task), (e) => e.taskId);
|
|
403
|
+
break;
|
|
404
|
+
case "team_run.updated":
|
|
405
|
+
r.teamRuns = g(n.teamRuns, i(oe, t.payload.teamRun), (e) => e.teamRunId);
|
|
406
|
+
break;
|
|
407
|
+
case "delivery.updated":
|
|
408
|
+
r.deliveries = g(n.deliveries, i(se, t.payload.delivery), (e) => e.deliveryId);
|
|
409
|
+
break;
|
|
410
|
+
case "artifact.updated": {
|
|
411
|
+
let e = i(te, t.payload.artifact);
|
|
412
|
+
r.artifacts = [...new Map([...n.artifacts || [], e].map((e) => [e.artifactId, e])).values()];
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
case "interaction.updated":
|
|
416
|
+
r.interactions = g(n.interactions, i(ce, t.payload.interaction), (e) => _e(e.ref));
|
|
417
|
+
break;
|
|
418
|
+
default: break;
|
|
419
|
+
}
|
|
420
|
+
return this.seenIds.add(t.eventId), this.seenIds.size > 2048 && this.seenIds.delete(this.seenIds.values().next().value), this.value = r, !0;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/core/teams/client.ts
|
|
425
|
+
function _(e) {
|
|
426
|
+
if (e?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
427
|
+
}
|
|
428
|
+
function ye(e, t) {
|
|
429
|
+
return new Promise((n, r) => {
|
|
430
|
+
_(t);
|
|
431
|
+
let i = () => t.removeEventListener("abort", o), a = setTimeout(() => {
|
|
432
|
+
i(), n();
|
|
433
|
+
}, e), o = () => {
|
|
434
|
+
clearTimeout(a), i(), r(new DOMException("Aborted", "AbortError"));
|
|
435
|
+
};
|
|
436
|
+
t.addEventListener("abort", o, { once: !0 });
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
async function be(e, t, n) {
|
|
440
|
+
if (!e.body || !e.headers.get("content-type")?.includes("text/event-stream")) throw new m("contract_mismatch", "服务没有返回事件流。");
|
|
441
|
+
let r = e.body.getReader(), i = new TextDecoder(), a = "", o = () => {
|
|
442
|
+
r.cancel().catch(() => {});
|
|
443
|
+
};
|
|
444
|
+
t.addEventListener("abort", o, { once: !0 });
|
|
445
|
+
let s = (e) => {
|
|
446
|
+
_(t);
|
|
447
|
+
let r = "message", i = [];
|
|
448
|
+
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());
|
|
449
|
+
if (!i.length) return;
|
|
450
|
+
let a;
|
|
451
|
+
try {
|
|
452
|
+
a = JSON.parse(i.join("\n"));
|
|
453
|
+
} catch {
|
|
454
|
+
throw new m("contract_mismatch", "无法解析群事件。");
|
|
455
|
+
}
|
|
456
|
+
n(r, a);
|
|
457
|
+
};
|
|
458
|
+
try {
|
|
459
|
+
for (;;) {
|
|
460
|
+
_(t);
|
|
461
|
+
let { done: e, value: n } = await r.read();
|
|
462
|
+
if (_(t), a += e ? i.decode() : i.decode(n, { stream: !0 }), a.length > 8e6) throw new m("event_too_large", "群事件超过客户端大小限制。");
|
|
463
|
+
let o = /\r?\n\r?\n/.exec(a);
|
|
464
|
+
for (; o;) s(a.slice(0, o.index)), a = a.slice(o.index + o[0].length), o = /\r?\n\r?\n/.exec(a);
|
|
465
|
+
if (e) {
|
|
466
|
+
a.trim() && s(a);
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
} finally {
|
|
471
|
+
t.removeEventListener("abort", o), await r.cancel().catch(() => {}), r.releaseLock();
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
var xe = class {
|
|
475
|
+
fetcher;
|
|
476
|
+
baseUrl;
|
|
477
|
+
reconnects;
|
|
478
|
+
retryDelay;
|
|
479
|
+
constructor(e = {}) {
|
|
480
|
+
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 m("invalid_reconnect_limit", "重连次数必须在 0–32 之间。");
|
|
481
|
+
this.retryDelay = e.retryDelayMs ?? ((e) => Math.min(500 * 2 ** e, 1e4));
|
|
482
|
+
}
|
|
483
|
+
path(e, t = "") {
|
|
484
|
+
return `/${encodeURIComponent(e)}${t}`;
|
|
485
|
+
}
|
|
486
|
+
async request(e, t = {}) {
|
|
487
|
+
_(t.signal ?? void 0);
|
|
488
|
+
let n = await this.fetcher(`${this.baseUrl}${e}`, t);
|
|
489
|
+
if (!n.ok) {
|
|
490
|
+
let e = await n.json().catch(() => ({}));
|
|
491
|
+
throw new m(e.error?.code ?? e.code ?? "http_error", e.error?.message ?? e.message ?? `群服务请求失败(${n.status})`, n.status);
|
|
492
|
+
}
|
|
493
|
+
return n;
|
|
494
|
+
}
|
|
495
|
+
async json(e, t = {}) {
|
|
496
|
+
let n = await this.request(e, t);
|
|
497
|
+
return n.status === 204 ? void 0 : n.json();
|
|
498
|
+
}
|
|
499
|
+
post(e, t, n) {
|
|
500
|
+
return this.json(e, {
|
|
501
|
+
method: "POST",
|
|
502
|
+
headers: { "Content-Type": "application/json" },
|
|
503
|
+
body: JSON.stringify(t),
|
|
504
|
+
signal: n
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
list(e = {}) {
|
|
508
|
+
let t = new URLSearchParams();
|
|
509
|
+
return e.cursor && t.set("cursor", e.cursor), e.limit && t.set("limit", String(e.limit)), this.json(t.size ? `?${t}` : "", { signal: e.signal });
|
|
510
|
+
}
|
|
511
|
+
async snapshot(e, t) {
|
|
512
|
+
let n = h(await this.json(this.path(e), { signal: t }));
|
|
513
|
+
if (n.group.groupId !== e) throw new m("scope_mismatch", "服务返回了另一个群。");
|
|
514
|
+
return n;
|
|
515
|
+
}
|
|
516
|
+
async create(e, t) {
|
|
517
|
+
return he(e), h(await this.post("", e, t));
|
|
518
|
+
}
|
|
519
|
+
async update(e, t, n) {
|
|
520
|
+
let r = h(await this.json(this.path(e), {
|
|
521
|
+
method: "PATCH",
|
|
522
|
+
headers: { "Content-Type": "application/json" },
|
|
523
|
+
body: JSON.stringify(t),
|
|
524
|
+
signal: n
|
|
525
|
+
}));
|
|
526
|
+
if (r.group.groupId !== e) throw new m("scope_mismatch", "群更新返回了另一个群。");
|
|
527
|
+
return r;
|
|
528
|
+
}
|
|
529
|
+
send(e, t, n) {
|
|
530
|
+
if (!t.parts.some((e) => e.kind !== "text" || e.text.trim())) throw new m("empty_message", "请输入消息。");
|
|
531
|
+
if (t.workspace && t.intent !== "start_goal") throw new m("invalid_workspace_scope", "工作目录只能在新建任务时指定。");
|
|
532
|
+
if (t.intent === "directed" && !t.mentions.length) throw new m("missing_recipient", "请选择接收成员。");
|
|
533
|
+
return this.post(this.path(e, "/messages"), t, n);
|
|
534
|
+
}
|
|
535
|
+
start(e, t, n) {
|
|
536
|
+
return this.post(this.path(e, "/team-runs"), t, n);
|
|
537
|
+
}
|
|
538
|
+
taskAction(e, t, n, r) {
|
|
539
|
+
return this.post(this.path(e, `/tasks/${encodeURIComponent(t)}/actions`), n, r);
|
|
540
|
+
}
|
|
541
|
+
control(e, t, n, r) {
|
|
542
|
+
return this.post(this.path(e, `/team-runs/${encodeURIComponent(t)}/control`), n, r);
|
|
543
|
+
}
|
|
544
|
+
acceptRun(e, t, n, r) {
|
|
545
|
+
return this.post(this.path(e, `/team-runs/${encodeURIComponent(t)}/acceptance`), n, r);
|
|
546
|
+
}
|
|
547
|
+
async configureLeaderStandby(e, t, n, r) {
|
|
548
|
+
if (!n.bindingRef.trim()) throw new m("missing_binding", "请选择云端备用节点。");
|
|
549
|
+
let i = await this.post(this.path(e, `/team-runs/${encodeURIComponent(t)}/leader-standby`), n, r);
|
|
550
|
+
if (i.groupId !== e || i.teamRunId !== t || i.standbyBindingRef !== n.bindingRef || ![
|
|
551
|
+
"armed",
|
|
552
|
+
"blocked",
|
|
553
|
+
"active"
|
|
554
|
+
].includes(i.state)) throw new m("scope_mismatch", "备用节点确认不属于当前任务或所选节点。");
|
|
555
|
+
return i;
|
|
556
|
+
}
|
|
557
|
+
interaction(e, t, n) {
|
|
558
|
+
if (t.ref.groupId !== e) throw new m("scope_mismatch", "审批不属于当前群。");
|
|
559
|
+
return this.post(this.path(e, "/interactions"), t, n);
|
|
560
|
+
}
|
|
561
|
+
cancelMember(e, t, n, r) {
|
|
562
|
+
if (n.ref.groupId !== e || n.ref.memberId !== t) throw new m("scope_mismatch", "停止请求不属于当前成员。");
|
|
563
|
+
return this.post(this.path(e, `/members/${encodeURIComponent(t)}/cancel`), n, r);
|
|
564
|
+
}
|
|
565
|
+
async execution(e, t, n) {
|
|
566
|
+
let r = pe(await this.json(this.path(e, `/execution${t ? `?teamRunId=${encodeURIComponent(t)}` : ""}`), { signal: n }));
|
|
567
|
+
if (r.groupId !== e || t && r.teamRunId !== t) throw new m("scope_mismatch", "执行视图不属于当前协作轮次。");
|
|
568
|
+
return r;
|
|
569
|
+
}
|
|
570
|
+
markRead(e, t, n) {
|
|
571
|
+
return this.post(this.path(e, "/read"), { watermark: t }, n);
|
|
572
|
+
}
|
|
573
|
+
async reconciliation(e, t) {
|
|
574
|
+
let n = await this.json(this.path(e, "/reconciliation"));
|
|
575
|
+
if (n.groupId !== e || !Array.isArray(n.items)) throw new m("scope_mismatch", "原单核查结果不属于当前团队。");
|
|
576
|
+
return n.items.filter((e) => e.teamRunId === t);
|
|
577
|
+
}
|
|
578
|
+
reconcile(e, t, n) {
|
|
579
|
+
return this.post(this.path(e, `/reconciliation/${encodeURIComponent(t)}`), n);
|
|
580
|
+
}
|
|
581
|
+
async watch(e, t) {
|
|
582
|
+
let { signal: n, onSnapshot: r, onConnection: i, onError: a } = t, o, s = !0, c = 0;
|
|
583
|
+
i?.("connecting");
|
|
584
|
+
try {
|
|
585
|
+
for (; !n.aborted;) try {
|
|
586
|
+
if (s) {
|
|
587
|
+
let t = await this.snapshot(e, n);
|
|
588
|
+
if (o) {
|
|
589
|
+
if (!o.replace(t)) throw new m("reset_required", "服务返回的快照早于当前状态,正在重新核对。");
|
|
590
|
+
} else o = new ve(t);
|
|
591
|
+
s = !1, _(n), r(o.snapshot());
|
|
592
|
+
}
|
|
593
|
+
if (!o) throw new m("reset_required", "群快照尚未就绪。");
|
|
594
|
+
let t = await this.request(this.path(e, `/events?after=${o.snapshot().watermark}`), { signal: n });
|
|
595
|
+
throw i?.("connected"), await be(t, n, (e, t) => {
|
|
596
|
+
if (e === "reset_required") throw new m("reset_required", "群事件游标已过期。");
|
|
597
|
+
e === "heartbeat" || e === "ping" || o.apply(me(t)) && (c = 0, r(o.snapshot()));
|
|
598
|
+
}), _(n), new m("stream_ended", "群事件连接已断开。");
|
|
599
|
+
} catch (e) {
|
|
600
|
+
if (n.aborted) break;
|
|
601
|
+
let t = e instanceof m ? e : new m("network_error", e instanceof Error ? e.message : "无法连接群服务。");
|
|
602
|
+
if (t.code === "reset_required") s = !0;
|
|
603
|
+
else if (t.status === 401 || t.status === 403 || t.status === 404 || t.code === "contract_mismatch" || t.code === "scope_mismatch") throw t;
|
|
604
|
+
if (c++ >= this.reconnects) throw t;
|
|
605
|
+
i?.("reconnecting"), await ye(this.retryDelay(c - 1), n);
|
|
606
|
+
}
|
|
607
|
+
} catch (e) {
|
|
608
|
+
if (!n.aborted) {
|
|
609
|
+
i?.("offline");
|
|
610
|
+
let t = e instanceof m ? e : new m("network_error", String(e));
|
|
611
|
+
throw a?.(t), t;
|
|
612
|
+
}
|
|
613
|
+
} finally {
|
|
614
|
+
n.aborted && i?.("closed");
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}, Se = class extends Error {
|
|
618
|
+
constructor() {
|
|
619
|
+
super("invalid_teams_canonical_json"), this.name = "TeamsCanonicalJsonError";
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
function Ce(e) {
|
|
623
|
+
for (let t = 0; t < e.length; t++) {
|
|
624
|
+
let n = e.charCodeAt(t);
|
|
625
|
+
if (n >= 55296 && n <= 56319) {
|
|
626
|
+
let n = e.charCodeAt(++t);
|
|
627
|
+
if (!(n >= 56320 && n <= 57343)) return !1;
|
|
628
|
+
} else if (n >= 56320 && n <= 57343) return !1;
|
|
629
|
+
}
|
|
630
|
+
return !0;
|
|
631
|
+
}
|
|
632
|
+
function v(e) {
|
|
633
|
+
let t = /* @__PURE__ */ new Set(), n = () => {
|
|
634
|
+
throw new Se();
|
|
635
|
+
}, r = (e, i) => {
|
|
636
|
+
if (i > 50) return n();
|
|
637
|
+
if (e === null || typeof e == "boolean") return JSON.stringify(e);
|
|
638
|
+
if (typeof e == "string") return Ce(e) ? JSON.stringify(e) : n();
|
|
639
|
+
if (typeof e == "number") return !Number.isFinite(e) || Number.isInteger(e) && !Number.isSafeInteger(e) ? n() : JSON.stringify(e);
|
|
640
|
+
if (!e || typeof e != "object" || t.has(e) || Object.getOwnPropertySymbols(e).length || !Array.isArray(e) && Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null) return n();
|
|
641
|
+
t.add(e);
|
|
642
|
+
let a;
|
|
643
|
+
if (Array.isArray(e)) {
|
|
644
|
+
if (Object.getOwnPropertyNames(e).length !== e.length + 1) return n();
|
|
645
|
+
let t = [];
|
|
646
|
+
for (let a = 0; a < e.length; a++) {
|
|
647
|
+
let o = Object.getOwnPropertyDescriptor(e, a);
|
|
648
|
+
if (!o || !("value" in o)) return n();
|
|
649
|
+
t.push(r(o.value, i + 1));
|
|
650
|
+
}
|
|
651
|
+
a = `[${t.join(",")}]`;
|
|
652
|
+
} else {
|
|
653
|
+
let t = Object.keys(e).sort();
|
|
654
|
+
if (Object.getOwnPropertyNames(e).length !== t.length) return n();
|
|
655
|
+
a = `{${t.map((t) => {
|
|
656
|
+
if (!Ce(t)) return n();
|
|
657
|
+
let a = Object.getOwnPropertyDescriptor(e, t);
|
|
658
|
+
return !a || !("value" in a) ? n() : `${JSON.stringify(t)}:${r(a.value, i + 1)}`;
|
|
659
|
+
}).join(",")}}`;
|
|
660
|
+
}
|
|
661
|
+
return t.delete(e), a;
|
|
662
|
+
};
|
|
663
|
+
return r(e, 0);
|
|
664
|
+
}
|
|
665
|
+
async function y(e, t = globalThis.crypto.subtle) {
|
|
666
|
+
let n = await t.digest("SHA-256", new TextEncoder().encode(v(e)));
|
|
667
|
+
return `sha256:${Array.from(new Uint8Array(n), (e) => e.toString(16).padStart(2, "0")).join("")}`;
|
|
668
|
+
}
|
|
669
|
+
function we(e, t) {
|
|
670
|
+
let n = Array.from(e, (e) => e.codePointAt(0)), r = Array.from(t, (e) => e.codePointAt(0));
|
|
671
|
+
for (let e = 0; e < Math.min(n.length, r.length); e++) if (n[e] !== r[e]) return n[e] - r[e];
|
|
672
|
+
return n.length - r.length;
|
|
673
|
+
}
|
|
674
|
+
//#endregion
|
|
675
|
+
//#region src/core/teams/operationOutbox.ts
|
|
676
|
+
var b = class extends Error {
|
|
677
|
+
code;
|
|
678
|
+
constructor(e) {
|
|
679
|
+
super(e), this.name = "TeamsOperationOutboxError", this.code = e;
|
|
680
|
+
}
|
|
681
|
+
}, Te = "teams_operations", Ee = [
|
|
682
|
+
"scope.origin",
|
|
683
|
+
"scope.ownerScopeRef",
|
|
684
|
+
"scope.authorityId",
|
|
685
|
+
"scope.groupId"
|
|
686
|
+
], De = new Set(["confirmed", "rejected"]), Oe = new Set([
|
|
687
|
+
"authorization",
|
|
688
|
+
"proxyauthorization",
|
|
689
|
+
"cookie",
|
|
690
|
+
"setcookie",
|
|
691
|
+
"credentials",
|
|
692
|
+
"headers",
|
|
693
|
+
"password",
|
|
694
|
+
"secret",
|
|
695
|
+
"secretkey",
|
|
696
|
+
"accesskey",
|
|
697
|
+
"accesskeyid",
|
|
698
|
+
"accesskeysecret",
|
|
699
|
+
"apikey",
|
|
700
|
+
"token",
|
|
701
|
+
"tokenref",
|
|
702
|
+
"accesstoken",
|
|
703
|
+
"refreshtoken",
|
|
704
|
+
"refreshsecret",
|
|
705
|
+
"privatekey",
|
|
706
|
+
"clientsecret",
|
|
707
|
+
"nodecredential",
|
|
708
|
+
"runtimetoken",
|
|
709
|
+
"signedurl",
|
|
710
|
+
"presignedurl"
|
|
711
|
+
]), ke = new Set([
|
|
712
|
+
"requestId",
|
|
713
|
+
"idempotencyKey",
|
|
714
|
+
"transportTimestamp",
|
|
715
|
+
"transportTime"
|
|
716
|
+
]);
|
|
717
|
+
function x(e) {
|
|
718
|
+
throw new b(e);
|
|
719
|
+
}
|
|
720
|
+
function S(e, t = 200, n = !1) {
|
|
721
|
+
return (typeof e != "string" || !n && !e.trim() || e.length > t || Array.from(e).some((e) => e.charCodeAt(0) < 32)) && x("invalid_operation_identity"), e;
|
|
722
|
+
}
|
|
723
|
+
function Ae(e, t, n = !0) {
|
|
724
|
+
(!e || Array.isArray(e) || typeof e != "object") && x("invalid_business_payload"), n && Object.keys(e).some((e) => ke.has(e)) && x("transport_metadata_not_allowed");
|
|
725
|
+
let r;
|
|
726
|
+
try {
|
|
727
|
+
r = v(e);
|
|
728
|
+
} catch {
|
|
729
|
+
x("invalid_business_payload");
|
|
730
|
+
}
|
|
731
|
+
new TextEncoder().encode(r).byteLength > t && x("payload_too_large");
|
|
732
|
+
let i = (e) => {
|
|
733
|
+
if (Array.isArray(e)) e.forEach(i);
|
|
734
|
+
else if (e && typeof e == "object") for (let [t, n] of Object.entries(e)) Oe.has(t.toLowerCase().replace(/[^a-z0-9]/g, "")) && x("credentials_not_allowed"), i(n);
|
|
735
|
+
};
|
|
736
|
+
return i(e), {
|
|
737
|
+
payload: JSON.parse(r),
|
|
738
|
+
json: r
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
function C(e) {
|
|
742
|
+
return new Promise((t, n) => {
|
|
743
|
+
e.onsuccess = () => t(e.result), e.onerror = () => n(e.error);
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
function w(e) {
|
|
747
|
+
return [
|
|
748
|
+
e.origin,
|
|
749
|
+
e.ownerScopeRef,
|
|
750
|
+
e.authorityId,
|
|
751
|
+
e.groupId
|
|
752
|
+
];
|
|
753
|
+
}
|
|
754
|
+
function T(e, t, n) {
|
|
755
|
+
return (!Number.isSafeInteger(e) || e < t || e > n) && x("invalid_outbox_limit"), e;
|
|
756
|
+
}
|
|
757
|
+
var je = class {
|
|
758
|
+
scope;
|
|
759
|
+
factory;
|
|
760
|
+
cryptography;
|
|
761
|
+
now;
|
|
762
|
+
databaseName;
|
|
763
|
+
maxEntries;
|
|
764
|
+
maxPayloadBytes;
|
|
765
|
+
database;
|
|
766
|
+
closed = !1;
|
|
767
|
+
constructor(e) {
|
|
768
|
+
let { origin: t, ownerScopeRef: n, authorityId: r, groupId: i } = e.scope, a;
|
|
769
|
+
try {
|
|
770
|
+
a = new URL(t);
|
|
771
|
+
} catch {
|
|
772
|
+
x("invalid_operation_origin");
|
|
773
|
+
}
|
|
774
|
+
(a.origin !== t || !["http:", "https:"].includes(a.protocol)) && x("invalid_operation_origin"), this.scope = Object.freeze({
|
|
775
|
+
origin: t,
|
|
776
|
+
ownerScopeRef: S(n, 512),
|
|
777
|
+
authorityId: S(r),
|
|
778
|
+
groupId: S(i, 200, !0)
|
|
779
|
+
}), this.factory = e.indexedDB ?? globalThis.indexedDB, this.cryptography = e.crypto ?? globalThis.crypto, (!this.factory || !this.cryptography?.subtle || !this.cryptography.randomUUID) && x("outbox_unavailable"), this.now = e.now ?? Date.now, this.databaseName = e.databaseName ?? "ksadk-teams-operations", this.maxEntries = T(e.maxEntries ?? 1e3, 1, 1e4), this.maxPayloadBytes = T(e.maxPayloadBytes ?? 1048576, 1, 2097152);
|
|
780
|
+
}
|
|
781
|
+
async open() {
|
|
782
|
+
return this.closed && x("outbox_closed"), this.database ||= new Promise((e, t) => {
|
|
783
|
+
let n = this.factory.open(this.databaseName, 1);
|
|
784
|
+
n.onupgradeneeded = () => {
|
|
785
|
+
let e = n.result.createObjectStore(Te, { keyPath: [...Ee, "operationId"] });
|
|
786
|
+
e.createIndex("scope", Ee), e.createIndex("scope_key", [
|
|
787
|
+
...Ee,
|
|
788
|
+
"operation",
|
|
789
|
+
"idempotencyKey"
|
|
790
|
+
], { unique: !0 });
|
|
791
|
+
}, n.onsuccess = () => {
|
|
792
|
+
n.result.onversionchange = () => {
|
|
793
|
+
n.result.close(), this.closed = !0;
|
|
794
|
+
}, e(n.result);
|
|
795
|
+
}, n.onerror = () => t(new b("outbox_unavailable")), n.onblocked = () => t(new b("outbox_upgrade_blocked"));
|
|
796
|
+
}), this.database;
|
|
797
|
+
}
|
|
798
|
+
key(e) {
|
|
799
|
+
return [...w(this.scope), S(e)];
|
|
800
|
+
}
|
|
801
|
+
async transaction(e, t) {
|
|
802
|
+
let n = (await this.open()).transaction(Te, e, { durability: e === "readwrite" ? "strict" : "default" }), r = new Promise((e, t) => {
|
|
803
|
+
n.oncomplete = () => e(), n.onabort = () => t(n.error ?? new b("outbox_transaction_aborted")), n.onerror = () => {};
|
|
804
|
+
});
|
|
805
|
+
r.catch(() => void 0);
|
|
806
|
+
try {
|
|
807
|
+
let e = await t(n.objectStore(Te));
|
|
808
|
+
return await r, e;
|
|
809
|
+
} catch (e) {
|
|
810
|
+
try {
|
|
811
|
+
n.abort();
|
|
812
|
+
} catch {}
|
|
813
|
+
throw await r.catch(() => void 0), e;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
async digest(e, t) {
|
|
817
|
+
return y({
|
|
818
|
+
operation: e,
|
|
819
|
+
payload: JSON.parse(t)
|
|
820
|
+
}, this.cryptography.subtle);
|
|
821
|
+
}
|
|
822
|
+
async enqueue(e, t = {}) {
|
|
823
|
+
let n = S(e.operationId ?? this.cryptography.randomUUID()), r = S(e.operation, 512);
|
|
824
|
+
(!/^[a-zA-Z0-9_.:/-]+$/.test(r) || r.includes("://")) && x("invalid_business_operation");
|
|
825
|
+
let i = S(e.idempotencyKey ?? this.cryptography.randomUUID()), { payload: a, json: o } = Ae(e.payload, this.maxPayloadBytes), s = await this.digest(r, o);
|
|
826
|
+
return this.transaction("readwrite", async (o) => {
|
|
827
|
+
let c = await C(o.get(this.key(n)));
|
|
828
|
+
if (c) return (c.payloadDigest !== s || c.operation !== r || e.idempotencyKey !== void 0 && c.idempotencyKey !== i) && x("operation_payload_conflict"), c;
|
|
829
|
+
let l = await C(o.index("scope").getAll(w(this.scope))), u = t.reuseUnresolved && l.find((e) => e.operation === r && e.payloadDigest === s && !De.has(e.status));
|
|
830
|
+
if (u) return u;
|
|
831
|
+
await C(o.index("scope_key").get([
|
|
832
|
+
...w(this.scope),
|
|
833
|
+
r,
|
|
834
|
+
i
|
|
835
|
+
])) && x("idempotency_key_conflict");
|
|
836
|
+
let d = l.filter((e) => De.has(e.status)).sort((e, t) => e.updatedAt - t.updatedAt), f = l.length;
|
|
837
|
+
for (; f >= this.maxEntries && d.length;) await C(o.delete(this.key(d.shift().operationId))), f--;
|
|
838
|
+
f >= this.maxEntries && x("outbox_capacity");
|
|
839
|
+
let ee = this.now(), p = {
|
|
840
|
+
scope: { ...this.scope },
|
|
841
|
+
operationId: n,
|
|
842
|
+
operation: r,
|
|
843
|
+
idempotencyKey: i,
|
|
844
|
+
payload: a,
|
|
845
|
+
payloadDigest: s,
|
|
846
|
+
createdAt: ee,
|
|
847
|
+
updatedAt: ee,
|
|
848
|
+
status: "queued",
|
|
849
|
+
revision: 1,
|
|
850
|
+
attempts: 0
|
|
851
|
+
};
|
|
852
|
+
return await C(o.add(p)), p;
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
async get(e) {
|
|
856
|
+
return this.transaction("readonly", async (t) => await C(t.get(this.key(e))));
|
|
857
|
+
}
|
|
858
|
+
async list(e = {}) {
|
|
859
|
+
let t = T(e.limit ?? 100, 1, 1e4);
|
|
860
|
+
return this.transaction("readonly", async (n) => (await C(n.index("scope").getAll(w(this.scope)))).filter((t) => !e.statuses || e.statuses.includes(t.status)).sort((e, t) => e.createdAt - t.createdAt || e.operationId.localeCompare(t.operationId)).slice(0, t));
|
|
861
|
+
}
|
|
862
|
+
async updateDraft(e, t, n) {
|
|
863
|
+
let r = await this.get(e);
|
|
864
|
+
r || x("operation_not_found");
|
|
865
|
+
let { payload: i, json: a } = Ae(n, this.maxPayloadBytes), o = await this.digest(r.operation, a);
|
|
866
|
+
return this.transaction("readwrite", async (n) => {
|
|
867
|
+
let r = await C(n.get(this.key(e)));
|
|
868
|
+
r || x("operation_not_found"), r.revision !== t && x("operation_revision_conflict"), (r.status !== "queued" || r.attempts !== 0) && x("operation_already_sent");
|
|
869
|
+
let a = {
|
|
870
|
+
...r,
|
|
871
|
+
payload: i,
|
|
872
|
+
payloadDigest: o,
|
|
873
|
+
revision: r.revision + 1,
|
|
874
|
+
updatedAt: this.now()
|
|
875
|
+
};
|
|
876
|
+
return await C(n.put(a)), a;
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
async claimNext(e, t, n = /* @__PURE__ */ new Set()) {
|
|
880
|
+
S(e), T(t, 100, 12e4);
|
|
881
|
+
let r = this.cryptography.randomUUID();
|
|
882
|
+
return this.transaction("readwrite", async (i) => {
|
|
883
|
+
let a = this.now(), o = (await C(i.index("scope").getAll(w(this.scope)))).filter((e) => !De.has(e.status) && !n.has(e.operationId) && (!e.leaseExpiresAt || e.leaseExpiresAt <= a)).sort((e, t) => e.attempts - t.attempts || e.createdAt - t.createdAt || e.operationId.localeCompare(t.operationId))[0];
|
|
884
|
+
if (!o) return;
|
|
885
|
+
let s = {
|
|
886
|
+
...o,
|
|
887
|
+
status: "sending",
|
|
888
|
+
leaseOwner: e,
|
|
889
|
+
leaseToken: r,
|
|
890
|
+
leaseExpiresAt: a + t,
|
|
891
|
+
attempts: o.attempts + 1,
|
|
892
|
+
revision: o.revision + 1,
|
|
893
|
+
updatedAt: a
|
|
894
|
+
};
|
|
895
|
+
return await C(i.put(s)), s;
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
owns(e, t) {
|
|
899
|
+
return !!(e && w(t.scope).every((e, t) => e === w(this.scope)[t]) && e.status === "sending" && e.leaseOwner === t.leaseOwner && e.leaseToken === t.leaseToken && e.leaseExpiresAt > this.now());
|
|
900
|
+
}
|
|
901
|
+
async renew(e, t) {
|
|
902
|
+
return T(t, 100, 12e4), this.transaction("readwrite", async (n) => {
|
|
903
|
+
let r = await C(n.get(this.key(e.operationId)));
|
|
904
|
+
return this.owns(r, e) ? (await C(n.put({
|
|
905
|
+
...r,
|
|
906
|
+
leaseExpiresAt: this.now() + t,
|
|
907
|
+
updatedAt: this.now()
|
|
908
|
+
})), !0) : !1;
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
async settle(e, t, n) {
|
|
912
|
+
[
|
|
913
|
+
"confirmed",
|
|
914
|
+
"rejected",
|
|
915
|
+
"uncertain",
|
|
916
|
+
"pending"
|
|
917
|
+
].includes(t.status) || x("invalid_operation_receipt");
|
|
918
|
+
let r = t.serverOperationId === void 0 ? void 0 : S(t.serverOperationId), i = "receipt" in t && t.receipt !== void 0 ? Ae(t.receipt, this.maxPayloadBytes, !1).payload : void 0, a = t.status === "rejected" ? t.code : n ?? (t.status === "pending" ? "pending" : void 0);
|
|
919
|
+
return a !== void 0 && !/^[a-z][a-z0-9_]{0,99}$/.test(a) && x("invalid_operation_error_code"), this.transaction("readwrite", async (n) => {
|
|
920
|
+
let o = await C(n.get(this.key(e.operationId)));
|
|
921
|
+
if (!this.owns(o, e)) return !1;
|
|
922
|
+
let s = {
|
|
923
|
+
...o,
|
|
924
|
+
status: t.status === "pending" ? "uncertain" : t.status,
|
|
925
|
+
updatedAt: this.now(),
|
|
926
|
+
revision: o.revision + 1
|
|
927
|
+
};
|
|
928
|
+
return delete s.leaseOwner, delete s.leaseToken, delete s.leaseExpiresAt, delete s.errorCode, delete s.receipt, r !== void 0 && (s.serverOperationId = r), i !== void 0 && (s.receipt = i), a !== void 0 && (s.errorCode = a), await C(n.put(s)), !0;
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
async close() {
|
|
932
|
+
this.closed = !0, this.database && (await this.database).close();
|
|
933
|
+
}
|
|
934
|
+
}, Me = class {
|
|
935
|
+
outbox;
|
|
936
|
+
transport;
|
|
937
|
+
tabId;
|
|
938
|
+
active;
|
|
939
|
+
deactivated = !1;
|
|
940
|
+
constructor(e, t, n = globalThis.crypto.randomUUID()) {
|
|
941
|
+
this.outbox = e, this.transport = t, this.tabId = S(n);
|
|
942
|
+
}
|
|
943
|
+
deactivate() {
|
|
944
|
+
this.deactivated = !0, this.active?.abort();
|
|
945
|
+
}
|
|
946
|
+
async drain(e = {}) {
|
|
947
|
+
this.deactivated && x("outbox_identity_inactive"), this.active && x("outbox_drain_in_progress");
|
|
948
|
+
let t = T(e.maxOperations ?? 50, 1, 1e3), n = T(e.maxDurationMs ?? 3e4, 1, 12e4), r = T(e.requestTimeoutMs ?? 1e4, 1, 12e4), i = T(e.leaseMs ?? 15e3, 100, 12e4), a = new AbortController();
|
|
949
|
+
this.active = a;
|
|
950
|
+
let o = () => a.abort();
|
|
951
|
+
e.signal?.addEventListener("abort", o, { once: !0 }), e.signal?.aborted && o();
|
|
952
|
+
let s = setTimeout(o, n), c = {
|
|
953
|
+
processed: 0,
|
|
954
|
+
confirmed: 0,
|
|
955
|
+
rejected: 0,
|
|
956
|
+
uncertain: 0,
|
|
957
|
+
aborted: !1
|
|
958
|
+
}, l = /* @__PURE__ */ new Set();
|
|
959
|
+
try {
|
|
960
|
+
for (; !a.signal.aborted && c.processed < t;) {
|
|
961
|
+
let e = await this.outbox.claimNext(this.tabId, i, l);
|
|
962
|
+
if (!e) break;
|
|
963
|
+
l.add(e.operationId), c.processed++;
|
|
964
|
+
let t = await this.recover(e, a.signal, i, r);
|
|
965
|
+
t !== void 0 && c[t]++;
|
|
966
|
+
}
|
|
967
|
+
return c.aborted = a.signal.aborted, c;
|
|
968
|
+
} finally {
|
|
969
|
+
clearTimeout(s), e.signal?.removeEventListener("abort", o), this.active = void 0;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
async recover(e, t, n, r) {
|
|
973
|
+
let i = new AbortController(), a = () => i.abort();
|
|
974
|
+
t.addEventListener("abort", a, { once: !0 }), t.aborted && a();
|
|
975
|
+
let o = !1, s = setInterval(() => {
|
|
976
|
+
o || i.signal.aborted || (o = !0, this.outbox.renew(e, n).then((e) => {
|
|
977
|
+
e || a();
|
|
978
|
+
}, a).finally(() => {
|
|
979
|
+
o = !1;
|
|
980
|
+
}));
|
|
981
|
+
}, Math.floor(n / 3));
|
|
982
|
+
try {
|
|
983
|
+
let t = await this.call((t) => this.transport.lookup(structuredClone(e), t), i.signal, r);
|
|
984
|
+
return t.status === "missing" && ((i.signal.aborted || !await this.outbox.renew(e, n)) && x("operation_aborted"), t = await this.call((t) => this.transport.send(structuredClone(e), t), i.signal, r)), i.signal.aborted && x("operation_aborted"), await this.outbox.settle(e, t) ? t.status === "pending" ? "uncertain" : t.status : void 0;
|
|
985
|
+
} catch (n) {
|
|
986
|
+
let r = t.aborted ? "aborted" : n instanceof b && n.code === "operation_timeout" ? "timeout" : "transport_uncertain";
|
|
987
|
+
return await this.outbox.settle(e, { status: "uncertain" }, r) ? "uncertain" : void 0;
|
|
988
|
+
} finally {
|
|
989
|
+
clearInterval(s), t.removeEventListener("abort", a), i.abort();
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
async call(e, t, n) {
|
|
993
|
+
t.aborted && x("operation_aborted");
|
|
994
|
+
let r = new AbortController(), i = () => void 0, a, o = new Promise((e, o) => {
|
|
995
|
+
i = () => {
|
|
996
|
+
r.abort(), o(new b("operation_aborted"));
|
|
997
|
+
}, t.addEventListener("abort", i, { once: !0 }), a = setTimeout(() => {
|
|
998
|
+
r.abort(), o(new b("operation_timeout"));
|
|
999
|
+
}, n);
|
|
1000
|
+
});
|
|
1001
|
+
try {
|
|
1002
|
+
return await Promise.race([Promise.resolve().then(() => (r.signal.aborted && x("operation_aborted"), e(r.signal))), o]);
|
|
1003
|
+
} finally {
|
|
1004
|
+
clearTimeout(a), t.removeEventListener("abort", i), r.abort();
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}, E = "teams-node/v1", Ne = "teams-host/v1", Pe = 20 * 1024 * 1024, Fe = 64 * 1024 * 1024, Ie = 1024 * 1024, D = e.string().refine(Ce, "Invalid Unicode scalar string"), O = (e, t) => D.refine((n) => {
|
|
1008
|
+
let r = Array.from(n).length;
|
|
1009
|
+
return r >= e && r <= t;
|
|
1010
|
+
}, "Invalid text length"), k = O(1, 256).refine((e) => !Array.from(e).some((e) => {
|
|
1011
|
+
let t = e.codePointAt(0);
|
|
1012
|
+
return t >= 9 && t <= 13 || t === 32 || t >= 8192 && t <= 8202 || [
|
|
1013
|
+
133,
|
|
1014
|
+
160,
|
|
1015
|
+
5760,
|
|
1016
|
+
8232,
|
|
1017
|
+
8233,
|
|
1018
|
+
8239,
|
|
1019
|
+
8287,
|
|
1020
|
+
12288
|
|
1021
|
+
].includes(t);
|
|
1022
|
+
}), "Identifier contains whitespace"), A = O(1, 200), j = D.length(71).regex(/^sha256:[0-9a-f]{64}$/), M = D.length(36).regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/), N = e.number().int().min(0).max(2 ** 53 - 1), P = N.min(1), F = D.refine((e) => {
|
|
1023
|
+
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e) || e.startsWith("0000")) return !1;
|
|
1024
|
+
let t = new Date(e);
|
|
1025
|
+
return Number.isFinite(t.getTime()) && t.toISOString() === e;
|
|
1026
|
+
}, "Expected a valid UTC timestamp with millisecond precision"), Le = e.lazy(() => e.union([
|
|
1027
|
+
e.null(),
|
|
1028
|
+
e.boolean(),
|
|
1029
|
+
D,
|
|
1030
|
+
e.number().refine((e) => Number.isFinite(e) && (!Number.isInteger(e) || Number.isSafeInteger(e))),
|
|
1031
|
+
e.array(Le),
|
|
1032
|
+
e.record(D, Le)
|
|
1033
|
+
])), I = e.record(D, Le), L = k.nullable().default(null), Re = e.discriminatedUnion("kind", [e.strictObject({
|
|
1034
|
+
kind: e.literal("node"),
|
|
1035
|
+
nodeId: k,
|
|
1036
|
+
nodeGeneration: P
|
|
1037
|
+
}), e.strictObject({
|
|
1038
|
+
kind: e.literal("cloud_agent"),
|
|
1039
|
+
agentId: k,
|
|
1040
|
+
versionId: k,
|
|
1041
|
+
runtimeId: k,
|
|
1042
|
+
agentInstanceId: k
|
|
1043
|
+
})]), ze = e.strictObject({
|
|
1044
|
+
authorityId: k,
|
|
1045
|
+
groupId: k,
|
|
1046
|
+
teamRunId: k,
|
|
1047
|
+
memberId: k,
|
|
1048
|
+
runMemberId: k,
|
|
1049
|
+
taskId: L,
|
|
1050
|
+
attemptId: k,
|
|
1051
|
+
deliveryId: k,
|
|
1052
|
+
bindingRef: k,
|
|
1053
|
+
providerRef: k,
|
|
1054
|
+
sessionId: k,
|
|
1055
|
+
commandId: M,
|
|
1056
|
+
idempotencyKey: A,
|
|
1057
|
+
schedulerEpoch: P,
|
|
1058
|
+
leaderEpoch: P,
|
|
1059
|
+
dispatchEpoch: P,
|
|
1060
|
+
attemptEpoch: P,
|
|
1061
|
+
target: Re,
|
|
1062
|
+
bundleDigest: j,
|
|
1063
|
+
contractDigest: j,
|
|
1064
|
+
capabilitiesDigest: j,
|
|
1065
|
+
nativeRunId: L
|
|
1066
|
+
}), Be = e.strictObject({
|
|
1067
|
+
sessionId: k,
|
|
1068
|
+
runId: k,
|
|
1069
|
+
commandId: M,
|
|
1070
|
+
terminalSeq: N,
|
|
1071
|
+
terminalEventDigest: j,
|
|
1072
|
+
resultDigest: j.nullable().default(null)
|
|
1073
|
+
}), Ve = new Set([
|
|
1074
|
+
"succeeded",
|
|
1075
|
+
"failed",
|
|
1076
|
+
"cancelled",
|
|
1077
|
+
"interrupted"
|
|
1078
|
+
]), He = e.strictObject({
|
|
1079
|
+
status: e.enum([
|
|
1080
|
+
"missing",
|
|
1081
|
+
"accepted",
|
|
1082
|
+
"duplicate",
|
|
1083
|
+
"rejected",
|
|
1084
|
+
"uncertain"
|
|
1085
|
+
]),
|
|
1086
|
+
commandId: M,
|
|
1087
|
+
idempotencyKey: A,
|
|
1088
|
+
payloadDigest: j,
|
|
1089
|
+
storeIncarnation: k,
|
|
1090
|
+
runId: L,
|
|
1091
|
+
acceptedSeq: N.nullable().default(null),
|
|
1092
|
+
nativeStatus: e.enum([
|
|
1093
|
+
"queued",
|
|
1094
|
+
"running",
|
|
1095
|
+
"waiting",
|
|
1096
|
+
"awaiting_approval",
|
|
1097
|
+
"waiting_for_node",
|
|
1098
|
+
"succeeded",
|
|
1099
|
+
"failed",
|
|
1100
|
+
"cancelled",
|
|
1101
|
+
"interrupted"
|
|
1102
|
+
]).nullable().default(null),
|
|
1103
|
+
terminalEvidence: Be.nullable().default(null)
|
|
1104
|
+
}).superRefine((e, t) => {
|
|
1105
|
+
e.status === "missing" && [
|
|
1106
|
+
e.runId,
|
|
1107
|
+
e.acceptedSeq,
|
|
1108
|
+
e.nativeStatus,
|
|
1109
|
+
e.terminalEvidence
|
|
1110
|
+
].some((e) => e !== null) && t.addIssue({
|
|
1111
|
+
code: "custom",
|
|
1112
|
+
message: "Missing receipt cannot contain execution evidence"
|
|
1113
|
+
}), e.terminalEvidence && (e.commandId !== e.terminalEvidence.commandId || e.runId !== e.terminalEvidence.runId || !Ve.has(e.nativeStatus ?? "")) && t.addIssue({
|
|
1114
|
+
code: "custom",
|
|
1115
|
+
message: "Terminal evidence must match the original command/run and terminal status"
|
|
1116
|
+
});
|
|
1117
|
+
}), Ue = e.strictObject({
|
|
1118
|
+
eventId: k,
|
|
1119
|
+
sessionId: k,
|
|
1120
|
+
runId: k,
|
|
1121
|
+
seq: N,
|
|
1122
|
+
family: k,
|
|
1123
|
+
type: k,
|
|
1124
|
+
payload: I,
|
|
1125
|
+
sourceRef: e.strictObject({
|
|
1126
|
+
nativeRunId: L,
|
|
1127
|
+
parentRunId: L,
|
|
1128
|
+
nativeEventType: L
|
|
1129
|
+
})
|
|
1130
|
+
});
|
|
1131
|
+
function We(e, t) {
|
|
1132
|
+
try {
|
|
1133
|
+
if (new TextEncoder().encode(v(e)).byteLength <= Ie) return;
|
|
1134
|
+
} catch {}
|
|
1135
|
+
t.addIssue({
|
|
1136
|
+
code: "custom",
|
|
1137
|
+
message: "Report is not safe canonical JSON within one MiB"
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
var Ge = e.strictObject({
|
|
1141
|
+
sessionId: k,
|
|
1142
|
+
storeIncarnation: k,
|
|
1143
|
+
afterSeq: N,
|
|
1144
|
+
nextSeq: N,
|
|
1145
|
+
snapshotUpperSeq: N,
|
|
1146
|
+
hasMore: e.boolean(),
|
|
1147
|
+
items: e.array(Ue).max(200)
|
|
1148
|
+
}).superRefine((e, t) => {
|
|
1149
|
+
(!(e.afterSeq <= e.nextSeq && e.nextSeq <= e.snapshotUpperSeq) || e.hasMore !== e.nextSeq < e.snapshotUpperSeq || e.hasMore && e.nextSeq === e.afterSeq) && t.addIssue({
|
|
1150
|
+
code: "custom",
|
|
1151
|
+
message: "Invalid frozen canonical session cursor interval"
|
|
1152
|
+
});
|
|
1153
|
+
let n = e.afterSeq, r = /* @__PURE__ */ new Set();
|
|
1154
|
+
for (let i of e.items) (i.sessionId !== e.sessionId || !(n < i.seq && i.seq <= e.nextSeq) || r.has(i.eventId)) && t.addIssue({
|
|
1155
|
+
code: "custom",
|
|
1156
|
+
message: "Events must be unique and ordered in the declared session interval"
|
|
1157
|
+
}), n = i.seq, r.add(i.eventId);
|
|
1158
|
+
We(e, t);
|
|
1159
|
+
}), Ke = e.strictObject({
|
|
1160
|
+
permitKind: e.enum(["execute", "recovery"]),
|
|
1161
|
+
permit: O(1, 16384),
|
|
1162
|
+
grantRevision: P.nullable().default(null)
|
|
1163
|
+
}), R = {
|
|
1164
|
+
protocolVersion: e.literal(E).default(E),
|
|
1165
|
+
nodeCommandId: M,
|
|
1166
|
+
operationKey: A,
|
|
1167
|
+
ref: ze,
|
|
1168
|
+
commandDigest: j,
|
|
1169
|
+
issuedAt: F,
|
|
1170
|
+
claimLeaseUntil: F,
|
|
1171
|
+
authorization: Ke
|
|
1172
|
+
}, qe = e.strictObject({
|
|
1173
|
+
contextRef: k,
|
|
1174
|
+
contextDigest: j,
|
|
1175
|
+
materialManifestRef: L
|
|
1176
|
+
}), Je = e.object({
|
|
1177
|
+
schema_version: e.literal(1).optional(),
|
|
1178
|
+
command_id: M,
|
|
1179
|
+
idempotency_key: e.string(),
|
|
1180
|
+
tenant_id: e.string(),
|
|
1181
|
+
agent_instance_id: e.string(),
|
|
1182
|
+
session_id: e.string(),
|
|
1183
|
+
command_type: e.literal("enqueue"),
|
|
1184
|
+
source: e.object({
|
|
1185
|
+
kind: e.enum([
|
|
1186
|
+
"studio",
|
|
1187
|
+
"responses",
|
|
1188
|
+
"agui",
|
|
1189
|
+
"a2a",
|
|
1190
|
+
"parent_agent",
|
|
1191
|
+
"scheduler",
|
|
1192
|
+
"workflow",
|
|
1193
|
+
"channel",
|
|
1194
|
+
"system"
|
|
1195
|
+
]),
|
|
1196
|
+
ref: e.string()
|
|
1197
|
+
}).passthrough(),
|
|
1198
|
+
authorization_ref: e.string(),
|
|
1199
|
+
submitted_at: e.string(),
|
|
1200
|
+
causation_id: e.string().nullable().optional(),
|
|
1201
|
+
correlation_id: e.string().nullable().optional(),
|
|
1202
|
+
payload: e.object({
|
|
1203
|
+
content: Le,
|
|
1204
|
+
reply_to: e.string().nullable().optional(),
|
|
1205
|
+
execution_grant_id: O(1, 512),
|
|
1206
|
+
execution_grant_attempt_epoch: P.nullable().optional(),
|
|
1207
|
+
execution_policy_ref: O(1, 2 ** 53 - 1),
|
|
1208
|
+
teams_context_ref: O(1, 2 ** 53 - 1)
|
|
1209
|
+
}).passthrough()
|
|
1210
|
+
}).passthrough(), Ye = e.strictObject({
|
|
1211
|
+
command: I,
|
|
1212
|
+
payloadDigest: j
|
|
1213
|
+
}).superRefine((e, t) => {
|
|
1214
|
+
Je.safeParse(e.command).success || t.addIssue({
|
|
1215
|
+
code: "custom",
|
|
1216
|
+
message: "Teams submit requires an original governed native enqueue envelope"
|
|
1217
|
+
});
|
|
1218
|
+
}), Xe = e.strictObject({
|
|
1219
|
+
grantId: k,
|
|
1220
|
+
expectedRevision: P,
|
|
1221
|
+
state: e.enum([
|
|
1222
|
+
"active",
|
|
1223
|
+
"suspended",
|
|
1224
|
+
"revoked"
|
|
1225
|
+
]),
|
|
1226
|
+
attemptEpoch: P,
|
|
1227
|
+
expiresAt: F,
|
|
1228
|
+
renewalId: A.nullable().default(null),
|
|
1229
|
+
controlId: A.nullable().default(null)
|
|
1230
|
+
}).superRefine((e, t) => {
|
|
1231
|
+
(e.renewalId === null == (e.controlId === null) || e.renewalId !== null && e.state !== "active") && t.addIssue({
|
|
1232
|
+
code: "custom",
|
|
1233
|
+
message: "Exactly one control or active renewal identity is required"
|
|
1234
|
+
});
|
|
1235
|
+
}), Ze = e.discriminatedUnion("operation", [
|
|
1236
|
+
e.strictObject({
|
|
1237
|
+
...R,
|
|
1238
|
+
operation: e.literal("prepare"),
|
|
1239
|
+
lane: e.literal("execution"),
|
|
1240
|
+
payload: qe
|
|
1241
|
+
}),
|
|
1242
|
+
e.strictObject({
|
|
1243
|
+
...R,
|
|
1244
|
+
operation: e.literal("submit"),
|
|
1245
|
+
lane: e.literal("execution"),
|
|
1246
|
+
payload: Ye
|
|
1247
|
+
}),
|
|
1248
|
+
e.strictObject({
|
|
1249
|
+
...R,
|
|
1250
|
+
operation: e.literal("lookup"),
|
|
1251
|
+
lane: e.literal("control"),
|
|
1252
|
+
payload: e.strictObject({
|
|
1253
|
+
commandId: M,
|
|
1254
|
+
idempotencyKey: A,
|
|
1255
|
+
payloadDigest: j,
|
|
1256
|
+
storeIncarnation: k
|
|
1257
|
+
})
|
|
1258
|
+
}),
|
|
1259
|
+
e.strictObject({
|
|
1260
|
+
...R,
|
|
1261
|
+
operation: e.literal("set_grant"),
|
|
1262
|
+
lane: e.literal("control"),
|
|
1263
|
+
payload: Xe
|
|
1264
|
+
}),
|
|
1265
|
+
e.strictObject({
|
|
1266
|
+
...R,
|
|
1267
|
+
operation: e.literal("set_admission"),
|
|
1268
|
+
lane: e.literal("control"),
|
|
1269
|
+
payload: e.strictObject({
|
|
1270
|
+
grantId: k,
|
|
1271
|
+
expectedAdmissionRevision: P,
|
|
1272
|
+
admissionAllowed: e.boolean(),
|
|
1273
|
+
attemptEpoch: P,
|
|
1274
|
+
controlId: A
|
|
1275
|
+
})
|
|
1276
|
+
}),
|
|
1277
|
+
e.strictObject({
|
|
1278
|
+
...R,
|
|
1279
|
+
operation: e.literal("get_grant"),
|
|
1280
|
+
lane: e.literal("control"),
|
|
1281
|
+
payload: e.strictObject({
|
|
1282
|
+
grantId: k,
|
|
1283
|
+
renewalId: A.nullable().default(null)
|
|
1284
|
+
})
|
|
1285
|
+
}),
|
|
1286
|
+
e.strictObject({
|
|
1287
|
+
...R,
|
|
1288
|
+
operation: e.literal("cancel"),
|
|
1289
|
+
lane: e.literal("control"),
|
|
1290
|
+
payload: e.strictObject({
|
|
1291
|
+
controlCommandId: M,
|
|
1292
|
+
controlIdempotencyKey: A,
|
|
1293
|
+
targetRunId: k,
|
|
1294
|
+
reason: O(0, 2e3)
|
|
1295
|
+
})
|
|
1296
|
+
}),
|
|
1297
|
+
e.strictObject({
|
|
1298
|
+
...R,
|
|
1299
|
+
operation: e.literal("respond_interaction"),
|
|
1300
|
+
lane: e.literal("control"),
|
|
1301
|
+
payload: e.strictObject({
|
|
1302
|
+
controlCommandId: M,
|
|
1303
|
+
controlIdempotencyKey: A,
|
|
1304
|
+
interactionId: k,
|
|
1305
|
+
expectedRevision: P,
|
|
1306
|
+
action: e.enum([
|
|
1307
|
+
"approve",
|
|
1308
|
+
"reject",
|
|
1309
|
+
"submit",
|
|
1310
|
+
"cancel"
|
|
1311
|
+
]),
|
|
1312
|
+
response: I
|
|
1313
|
+
})
|
|
1314
|
+
}),
|
|
1315
|
+
e.strictObject({
|
|
1316
|
+
...R,
|
|
1317
|
+
operation: e.literal("observe"),
|
|
1318
|
+
lane: e.literal("control"),
|
|
1319
|
+
payload: e.strictObject({
|
|
1320
|
+
sessionId: k,
|
|
1321
|
+
afterSeq: N,
|
|
1322
|
+
limit: e.number().int().min(1).max(200).default(200)
|
|
1323
|
+
})
|
|
1324
|
+
})
|
|
1325
|
+
]).superRefine((e, t) => {
|
|
1326
|
+
let n = (e) => t.addIssue({
|
|
1327
|
+
code: "custom",
|
|
1328
|
+
message: e
|
|
1329
|
+
});
|
|
1330
|
+
(e.ref.target.kind !== "node" || e.nodeCommandId === e.ref.commandId || e.claimLeaseUntil <= e.issuedAt) && n("Invalid node target, operation identity or claim interval"), e.operation === "submit" && (e.payload.command.command_id !== e.ref.commandId || e.payload.command.idempotency_key !== e.ref.idempotencyKey || e.payload.command.session_id !== e.ref.sessionId) && n("Submit differs from frozen enqueue reference"), e.operation === "lookup" && (e.payload.commandId !== e.ref.commandId || e.payload.idempotencyKey !== e.ref.idempotencyKey) && n("Lookup must target the original enqueue"), (e.operation === "cancel" || e.operation === "respond_interaction") && (([e.nodeCommandId, e.ref.commandId].includes(e.payload.controlCommandId) || e.payload.controlIdempotencyKey === e.ref.idempotencyKey || e.ref.nativeRunId === null) && n("Control requires original native run and independent identity"), e.operation === "cancel" && e.payload.targetRunId !== e.ref.nativeRunId && n("Cancel must target the exact original native run")), e.operation === "observe" && e.payload.sessionId !== e.ref.sessionId && n("Observe must target the original session"), e.operation === "set_admission" && (e.payload.attemptEpoch !== e.ref.attemptEpoch || e.payload.controlId === e.ref.idempotencyKey) && n("Admission requires the original attempt and an independent control identity"), ([
|
|
1331
|
+
"prepare",
|
|
1332
|
+
"submit",
|
|
1333
|
+
"respond_interaction",
|
|
1334
|
+
"set_admission"
|
|
1335
|
+
].includes(e.operation) || e.operation === "set_grant" && e.payload.state !== "revoked") && e.authorization.permitKind !== "execute" && n("Recovery authorization cannot grant execution");
|
|
1336
|
+
});
|
|
1337
|
+
async function Qe(e) {
|
|
1338
|
+
let t = { ...e.ref };
|
|
1339
|
+
return delete t.schedulerEpoch, y({
|
|
1340
|
+
protocolVersion: e.protocolVersion,
|
|
1341
|
+
nodeCommandId: e.nodeCommandId,
|
|
1342
|
+
operationKey: e.operationKey,
|
|
1343
|
+
operation: e.operation,
|
|
1344
|
+
lane: e.lane,
|
|
1345
|
+
ref: t,
|
|
1346
|
+
payload: e.payload
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
async function $e(e) {
|
|
1350
|
+
let t = Ze.parse(e);
|
|
1351
|
+
if (await Qe(t) !== t.commandDigest) throw Error("node_command_digest_mismatch");
|
|
1352
|
+
return t;
|
|
1353
|
+
}
|
|
1354
|
+
var et = D.refine((e) => !e || Array.from(e).length > 4096 || e.startsWith("/") || e.includes("\\") || /^[A-Za-z]:/.test(e) || Array.from(e).some((e) => e.codePointAt(0) < 32 || e.codePointAt(0) === 127) ? !1 : e.split("/").every((e) => e !== "" && e !== "." && e !== ".."), "Material path must be a normalized relative file path"), tt = e.strictObject({
|
|
1355
|
+
path: et,
|
|
1356
|
+
digest: j,
|
|
1357
|
+
sizeBytes: e.number().int().min(0).max(Pe),
|
|
1358
|
+
mediaType: O(1, 200)
|
|
1359
|
+
}), nt = {
|
|
1360
|
+
kind: e.enum(["files", "git_snapshot"]),
|
|
1361
|
+
sourceCommit: D.refine((e) => [40, 64].includes(e.length) && /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)).nullable().default(null),
|
|
1362
|
+
entries: e.array(tt).min(1).max(4096)
|
|
1363
|
+
};
|
|
1364
|
+
function rt(e, t) {
|
|
1365
|
+
let n = (e) => t.addIssue({
|
|
1366
|
+
code: "custom",
|
|
1367
|
+
message: e
|
|
1368
|
+
});
|
|
1369
|
+
e.kind === "git_snapshot" != (e.sourceCommit !== null) && n("Only Git snapshots require a full source commit"), e.entries.reduce((e, t) => e + t.sizeBytes, 0) > Fe && n("Material exceeds 64 MiB");
|
|
1370
|
+
let r = new Set(e.entries.map((e) => e.path));
|
|
1371
|
+
r.size !== e.entries.length && n("Duplicate material path");
|
|
1372
|
+
for (let e of r) {
|
|
1373
|
+
let t = e.split("/");
|
|
1374
|
+
for (t.pop(); t.length;) r.has(t.join("/")) && n("A material file cannot also be a directory"), t.pop();
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
var z = e.strictObject(nt).superRefine(rt), it = e.strictObject({
|
|
1378
|
+
...nt,
|
|
1379
|
+
idempotencyKey: A
|
|
1380
|
+
}).superRefine(rt);
|
|
1381
|
+
async function at(e) {
|
|
1382
|
+
let t = z.parse(e);
|
|
1383
|
+
return y({
|
|
1384
|
+
kind: t.kind,
|
|
1385
|
+
...t.sourceCommit === null ? {} : { sourceCommit: t.sourceCommit },
|
|
1386
|
+
entries: [...t.entries].sort((e, t) => we(e.path, t.path))
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
var ot = e.strictObject({
|
|
1390
|
+
storeIncarnation: k,
|
|
1391
|
+
grant: e.strictObject({
|
|
1392
|
+
grantId: k,
|
|
1393
|
+
state: e.enum([
|
|
1394
|
+
"active",
|
|
1395
|
+
"suspended",
|
|
1396
|
+
"revoked"
|
|
1397
|
+
]),
|
|
1398
|
+
revision: P,
|
|
1399
|
+
attemptEpoch: P,
|
|
1400
|
+
expiresAt: F,
|
|
1401
|
+
admissionAllowed: e.boolean(),
|
|
1402
|
+
admissionRevision: P
|
|
1403
|
+
}),
|
|
1404
|
+
barrier: e.strictObject({
|
|
1405
|
+
queuedMessageIds: e.array(k).max(1e4).default([]),
|
|
1406
|
+
inFlightMessageIds: e.array(k).max(1e4).default([]),
|
|
1407
|
+
discardedMessageIds: e.array(k).max(1e4).default([]),
|
|
1408
|
+
settledMessageIds: e.array(k).max(1e4).default([]),
|
|
1409
|
+
commands: e.array(e.strictObject({
|
|
1410
|
+
messageId: k,
|
|
1411
|
+
commandId: M,
|
|
1412
|
+
idempotencyKey: A,
|
|
1413
|
+
inboxState: e.enum([
|
|
1414
|
+
"accepted",
|
|
1415
|
+
"claimed",
|
|
1416
|
+
"completed",
|
|
1417
|
+
"discarded"
|
|
1418
|
+
]),
|
|
1419
|
+
runId: L,
|
|
1420
|
+
runState: e.enum([
|
|
1421
|
+
"pending",
|
|
1422
|
+
"running",
|
|
1423
|
+
"paused",
|
|
1424
|
+
"waiting",
|
|
1425
|
+
"completed",
|
|
1426
|
+
"failed",
|
|
1427
|
+
"cancelled",
|
|
1428
|
+
"interrupted"
|
|
1429
|
+
]).nullable().default(null)
|
|
1430
|
+
})).max(1e4).default([])
|
|
1431
|
+
})
|
|
1432
|
+
}), st = e.strictObject({
|
|
1433
|
+
operationId: A,
|
|
1434
|
+
status: e.literal("applied").default("applied"),
|
|
1435
|
+
snapshot: ot
|
|
1436
|
+
}), ct = e.strictObject({
|
|
1437
|
+
operation: e.literal("get_grant"),
|
|
1438
|
+
storeIncarnation: k,
|
|
1439
|
+
current: ot.nullable().default(null),
|
|
1440
|
+
lookupOperationId: A.nullable().default(null),
|
|
1441
|
+
mutationReceipt: st.nullable().default(null)
|
|
1442
|
+
}).superRefine((e, t) => {
|
|
1443
|
+
(e.current && e.current.storeIncarnation !== e.storeIncarnation || e.mutationReceipt && (e.mutationReceipt.operationId !== e.lookupOperationId || e.mutationReceipt.snapshot.storeIncarnation !== e.storeIncarnation)) && t.addIssue({
|
|
1444
|
+
code: "custom",
|
|
1445
|
+
message: "Grant lookup must match the original store and mutation identity"
|
|
1446
|
+
});
|
|
1447
|
+
}), lt = e.discriminatedUnion("operation", [
|
|
1448
|
+
e.strictObject({
|
|
1449
|
+
operation: e.literal("prepare"),
|
|
1450
|
+
contextRef: k,
|
|
1451
|
+
contextDigest: j,
|
|
1452
|
+
snapshot: ot
|
|
1453
|
+
}),
|
|
1454
|
+
e.strictObject({
|
|
1455
|
+
operation: e.literal("set_grant"),
|
|
1456
|
+
mutationReceipt: st
|
|
1457
|
+
}),
|
|
1458
|
+
e.strictObject({
|
|
1459
|
+
operation: e.literal("set_admission"),
|
|
1460
|
+
mutationReceipt: st
|
|
1461
|
+
}),
|
|
1462
|
+
ct
|
|
1463
|
+
]), ut = e.strictObject({
|
|
1464
|
+
protocolVersion: e.literal(E).default(E),
|
|
1465
|
+
nodeCommandId: M,
|
|
1466
|
+
operation: e.literal("describe"),
|
|
1467
|
+
lane: e.literal("control").default("control"),
|
|
1468
|
+
operationKey: A,
|
|
1469
|
+
authorityId: k,
|
|
1470
|
+
nodeId: k,
|
|
1471
|
+
bindingRef: k,
|
|
1472
|
+
localBindingRef: k,
|
|
1473
|
+
expectedDigests: e.strictObject({
|
|
1474
|
+
bundle: j,
|
|
1475
|
+
contract: j,
|
|
1476
|
+
capabilities: j
|
|
1477
|
+
}),
|
|
1478
|
+
nodeGeneration: P,
|
|
1479
|
+
claimLeaseUntil: F,
|
|
1480
|
+
authorization: e.strictObject({
|
|
1481
|
+
permitKind: e.literal("probe"),
|
|
1482
|
+
permit: O(1, 16384)
|
|
1483
|
+
}),
|
|
1484
|
+
commandDigest: j
|
|
1485
|
+
});
|
|
1486
|
+
async function dt(e) {
|
|
1487
|
+
return y(Object.fromEntries(Object.entries(ut.parse(e)).filter(([e]) => ![
|
|
1488
|
+
"authorization",
|
|
1489
|
+
"claimLeaseUntil",
|
|
1490
|
+
"commandDigest"
|
|
1491
|
+
].includes(e))));
|
|
1492
|
+
}
|
|
1493
|
+
async function ft(e) {
|
|
1494
|
+
if (e && typeof e == "object" && "operation" in e && e.operation === "describe") {
|
|
1495
|
+
let t = ut.parse(e);
|
|
1496
|
+
if (await dt(t) !== t.commandDigest) throw Error("node_probe_digest_mismatch");
|
|
1497
|
+
return t;
|
|
1498
|
+
}
|
|
1499
|
+
return $e(e);
|
|
1500
|
+
}
|
|
1501
|
+
var pt = e.strictObject({
|
|
1502
|
+
bindingRef: k,
|
|
1503
|
+
localBindingRef: k,
|
|
1504
|
+
agentInstanceId: k,
|
|
1505
|
+
storeIncarnation: k,
|
|
1506
|
+
capabilities: I,
|
|
1507
|
+
capabilitiesDigest: j,
|
|
1508
|
+
bundleDigest: j,
|
|
1509
|
+
contractDigest: j
|
|
1510
|
+
}), mt = e.strictObject({
|
|
1511
|
+
reportKind: e.literal("probe").default("probe"),
|
|
1512
|
+
nodeCommandId: M,
|
|
1513
|
+
nodeGeneration: P,
|
|
1514
|
+
commandDigest: j,
|
|
1515
|
+
resultRevision: P,
|
|
1516
|
+
phase: e.enum([
|
|
1517
|
+
"described",
|
|
1518
|
+
"uncertain",
|
|
1519
|
+
"rejected"
|
|
1520
|
+
]),
|
|
1521
|
+
probeResult: pt.nullable().default(null),
|
|
1522
|
+
error: e.strictObject({
|
|
1523
|
+
code: k,
|
|
1524
|
+
retryable: e.boolean()
|
|
1525
|
+
}).nullable().default(null)
|
|
1526
|
+
}).refine((e) => e.phase === "described" == (e.probeResult !== null), "Described probe requires exact Host result"), ht = (e) => mt.parse(e), gt = e.strictObject({
|
|
1527
|
+
status: e.enum([
|
|
1528
|
+
"succeeded",
|
|
1529
|
+
"failed",
|
|
1530
|
+
"cancelled",
|
|
1531
|
+
"interrupted"
|
|
1532
|
+
]),
|
|
1533
|
+
candidate: e.strictObject({
|
|
1534
|
+
result: O(0, Ie),
|
|
1535
|
+
artifacts: e.array(I).max(1e3).default([])
|
|
1536
|
+
}),
|
|
1537
|
+
usage: e.strictObject({ totalTokens: N }),
|
|
1538
|
+
terminalEvidence: Be,
|
|
1539
|
+
completionDigest: j
|
|
1540
|
+
}).superRefine(We);
|
|
1541
|
+
async function _t(e) {
|
|
1542
|
+
let t = gt.parse(e);
|
|
1543
|
+
if (await y(t.candidate) !== t.terminalEvidence.resultDigest) throw Error("candidate_digest_mismatch");
|
|
1544
|
+
let { completionDigest: n, ...r } = t;
|
|
1545
|
+
if (await y(r) !== n) throw Error("completion_digest_mismatch");
|
|
1546
|
+
return t;
|
|
1547
|
+
}
|
|
1548
|
+
var vt = e.strictObject({
|
|
1549
|
+
nodeCommandId: M,
|
|
1550
|
+
nodeGeneration: P,
|
|
1551
|
+
commandDigest: j,
|
|
1552
|
+
resultRevision: P,
|
|
1553
|
+
phase: e.enum([
|
|
1554
|
+
"prepared",
|
|
1555
|
+
"submitted",
|
|
1556
|
+
"running",
|
|
1557
|
+
"waiting",
|
|
1558
|
+
"terminal",
|
|
1559
|
+
"uncertain",
|
|
1560
|
+
"rejected",
|
|
1561
|
+
"control_applied"
|
|
1562
|
+
]),
|
|
1563
|
+
receipt: He.nullable().default(null),
|
|
1564
|
+
eventBatch: Ge.nullable().default(null),
|
|
1565
|
+
materialProof: e.strictObject({
|
|
1566
|
+
manifestRef: k,
|
|
1567
|
+
digest: j
|
|
1568
|
+
}).nullable().default(null),
|
|
1569
|
+
error: e.strictObject({
|
|
1570
|
+
code: k,
|
|
1571
|
+
retryable: e.boolean()
|
|
1572
|
+
}).nullable().default(null),
|
|
1573
|
+
operationResult: lt.nullable().default(null),
|
|
1574
|
+
executionResult: gt.nullable().default(null)
|
|
1575
|
+
}).superRefine((e, t) => {
|
|
1576
|
+
e.phase === "prepared" && e.operationResult?.operation !== "prepare" && t.addIssue({
|
|
1577
|
+
code: "custom",
|
|
1578
|
+
message: "Prepared report requires durable preparation result"
|
|
1579
|
+
}), e.phase === "control_applied" && (!e.operationResult || e.operationResult.operation === "prepare") && t.addIssue({
|
|
1580
|
+
code: "custom",
|
|
1581
|
+
message: "Control report requires a typed mutation or lookup result"
|
|
1582
|
+
}), e.operationResult !== null && !["prepared", "control_applied"].includes(e.phase) && t.addIssue({
|
|
1583
|
+
code: "custom",
|
|
1584
|
+
message: "Operation result only belongs to preparation or control reports"
|
|
1585
|
+
}), e.phase === "terminal" && !e.receipt?.terminalEvidence && t.addIssue({
|
|
1586
|
+
code: "custom",
|
|
1587
|
+
message: "Terminal report requires canonical evidence"
|
|
1588
|
+
}), e.phase === "terminal" && (!e.executionResult || e.executionResult.status !== e.receipt?.nativeStatus || v(e.executionResult.terminalEvidence) !== v(e.receipt?.terminalEvidence ?? null)) && t.addIssue({
|
|
1589
|
+
code: "custom",
|
|
1590
|
+
message: "Terminal report requires matching canonical completion"
|
|
1591
|
+
}), e.phase !== "terminal" && e.executionResult !== null && t.addIssue({
|
|
1592
|
+
code: "custom",
|
|
1593
|
+
message: "Completion only belongs to terminal report"
|
|
1594
|
+
}), We(e, t);
|
|
1595
|
+
}), yt = (e) => ze.parse(e), bt = (e) => He.parse(e), xt = (e) => Ge.parse(e), St = (e) => z.parse(e), Ct = async (e) => {
|
|
1596
|
+
let t = vt.parse(e);
|
|
1597
|
+
return t.executionResult && await _t(t.executionResult), t;
|
|
1598
|
+
}, wt = (e) => lt.parse(e), Tt = {
|
|
1599
|
+
text: D,
|
|
1600
|
+
length: O,
|
|
1601
|
+
identifier: k,
|
|
1602
|
+
operationKey: A,
|
|
1603
|
+
digest: j,
|
|
1604
|
+
commandId: M,
|
|
1605
|
+
sequence: N,
|
|
1606
|
+
revision: P,
|
|
1607
|
+
timestamp: F,
|
|
1608
|
+
relativePath: et
|
|
1609
|
+
}, Et = "workspace/v1", B = [
|
|
1610
|
+
"runSummaries",
|
|
1611
|
+
"taskSummaries",
|
|
1612
|
+
"pendingInteractions",
|
|
1613
|
+
"recentMessages",
|
|
1614
|
+
"artifactSummaries"
|
|
1615
|
+
], V = e.string().min(1).max(256), H = e.number().int().min(0).max(2 ** 53 - 1), U = H.min(1), W = e.iso.datetime({ offset: !0 }).max(40).refine((e) => !e.startsWith("0000") && Number.isFinite(Date.parse(e)), "Invalid timestamp"), G = V.nullable(), K = e.string().max(2e3).nullable(), q = e.string().min(1).max(4096).nullable(), Dt = e.enum([
|
|
1616
|
+
"planning",
|
|
1617
|
+
"running",
|
|
1618
|
+
"waiting",
|
|
1619
|
+
"needs_attention",
|
|
1620
|
+
"awaiting_acceptance",
|
|
1621
|
+
"succeeded",
|
|
1622
|
+
"failed",
|
|
1623
|
+
"cancel_requested",
|
|
1624
|
+
"cancelled"
|
|
1625
|
+
]), Ot = e.enum([
|
|
1626
|
+
"draft",
|
|
1627
|
+
"ready",
|
|
1628
|
+
"blocked",
|
|
1629
|
+
"running",
|
|
1630
|
+
"awaiting_acceptance",
|
|
1631
|
+
"succeeded",
|
|
1632
|
+
"failed",
|
|
1633
|
+
"cancel_requested",
|
|
1634
|
+
"cancelled"
|
|
1635
|
+
]), J = e.strictObject({
|
|
1636
|
+
authorityId: V,
|
|
1637
|
+
ownerScopeRef: e.string().min(1).max(512),
|
|
1638
|
+
groupId: V
|
|
1639
|
+
}), kt = J.extend({ origin: e.string().refine((e) => {
|
|
1640
|
+
try {
|
|
1641
|
+
let t = new URL(e);
|
|
1642
|
+
return ["http:", "https:"].includes(t.protocol) && t.origin === e;
|
|
1643
|
+
} catch {
|
|
1644
|
+
return !1;
|
|
1645
|
+
}
|
|
1646
|
+
}, "Invalid workspace origin") }), At = e.strictObject({
|
|
1647
|
+
groupId: V,
|
|
1648
|
+
name: e.string().min(1).max(256),
|
|
1649
|
+
authorityRef: V,
|
|
1650
|
+
tenantId: V,
|
|
1651
|
+
ownerSubject: V,
|
|
1652
|
+
leaderMemberId: V,
|
|
1653
|
+
revision: U,
|
|
1654
|
+
status: e.enum(["active", "archived"]),
|
|
1655
|
+
createdAt: W,
|
|
1656
|
+
updatedAt: W,
|
|
1657
|
+
policy: e.strictObject({
|
|
1658
|
+
taskAcceptance: e.enum([
|
|
1659
|
+
"leader",
|
|
1660
|
+
"human",
|
|
1661
|
+
"result"
|
|
1662
|
+
]),
|
|
1663
|
+
peerWake: e.boolean()
|
|
1664
|
+
})
|
|
1665
|
+
}), jt = e.strictObject({
|
|
1666
|
+
enqueue: e.boolean(),
|
|
1667
|
+
cancel: e.boolean(),
|
|
1668
|
+
steer: e.boolean(),
|
|
1669
|
+
restore: e.boolean(),
|
|
1670
|
+
interaction: e.boolean(),
|
|
1671
|
+
leader: e.boolean()
|
|
1672
|
+
}), Mt = e.strictObject({
|
|
1673
|
+
bindingRef: V,
|
|
1674
|
+
providerRef: V,
|
|
1675
|
+
kind: e.enum([
|
|
1676
|
+
"local_build",
|
|
1677
|
+
"a2a",
|
|
1678
|
+
"cloud"
|
|
1679
|
+
]),
|
|
1680
|
+
agentId: V,
|
|
1681
|
+
capabilities: jt,
|
|
1682
|
+
availability: e.strictObject({
|
|
1683
|
+
state: e.enum([
|
|
1684
|
+
"ready",
|
|
1685
|
+
"unchecked",
|
|
1686
|
+
"unavailable"
|
|
1687
|
+
]),
|
|
1688
|
+
code: G,
|
|
1689
|
+
reason: K,
|
|
1690
|
+
action: e.string().max(256).nullable()
|
|
1691
|
+
})
|
|
1692
|
+
}), Nt = e.strictObject({
|
|
1693
|
+
memberId: V,
|
|
1694
|
+
groupId: V,
|
|
1695
|
+
name: e.string().min(1).max(256),
|
|
1696
|
+
role: e.enum(["leader", "member"]),
|
|
1697
|
+
responsibility: e.string().max(2e3),
|
|
1698
|
+
bindingRef: V,
|
|
1699
|
+
binding: Mt,
|
|
1700
|
+
sessionId: V,
|
|
1701
|
+
revision: U,
|
|
1702
|
+
status: e.enum([
|
|
1703
|
+
"active",
|
|
1704
|
+
"removed",
|
|
1705
|
+
"unavailable"
|
|
1706
|
+
]),
|
|
1707
|
+
executionStatus: e.enum([
|
|
1708
|
+
"idle",
|
|
1709
|
+
"queued",
|
|
1710
|
+
"running",
|
|
1711
|
+
"waiting",
|
|
1712
|
+
"needs_attention",
|
|
1713
|
+
"unavailable"
|
|
1714
|
+
]),
|
|
1715
|
+
activeRunId: G,
|
|
1716
|
+
reason: K
|
|
1717
|
+
}).refine((e) => e.bindingRef === e.binding.bindingRef, "Binding identity mismatch"), Pt = Nt.safeExtend({
|
|
1718
|
+
runMemberId: V,
|
|
1719
|
+
teamRunId: V,
|
|
1720
|
+
groupRevision: U
|
|
1721
|
+
}), Ft = e.strictObject({
|
|
1722
|
+
state: e.enum([
|
|
1723
|
+
"armed",
|
|
1724
|
+
"fencing_old",
|
|
1725
|
+
"waiting_old_grant",
|
|
1726
|
+
"activating",
|
|
1727
|
+
"active",
|
|
1728
|
+
"blocked"
|
|
1729
|
+
]),
|
|
1730
|
+
standbyBindingRef: V,
|
|
1731
|
+
releaseRef: V,
|
|
1732
|
+
takeoverId: G,
|
|
1733
|
+
reason: K,
|
|
1734
|
+
newLeaderEpoch: U.nullable()
|
|
1735
|
+
}), Y = e.strictObject({
|
|
1736
|
+
teamRunId: V,
|
|
1737
|
+
groupId: V,
|
|
1738
|
+
revision: U,
|
|
1739
|
+
groupRevision: U,
|
|
1740
|
+
goalMessageId: V,
|
|
1741
|
+
goal: e.string(),
|
|
1742
|
+
leaderMemberId: V,
|
|
1743
|
+
status: Dt,
|
|
1744
|
+
dispatchSuspended: e.boolean(),
|
|
1745
|
+
dispatchEpoch: U,
|
|
1746
|
+
taskCount: H,
|
|
1747
|
+
pendingCount: H,
|
|
1748
|
+
createdAt: W,
|
|
1749
|
+
updatedAt: W,
|
|
1750
|
+
reason: K,
|
|
1751
|
+
leaderStandby: Ft.optional()
|
|
1752
|
+
}), It = e.strictObject({
|
|
1753
|
+
taskId: V,
|
|
1754
|
+
groupId: V,
|
|
1755
|
+
teamRunId: V,
|
|
1756
|
+
revision: U,
|
|
1757
|
+
title: e.string().min(1).max(2e3),
|
|
1758
|
+
ownerMemberId: G,
|
|
1759
|
+
dependencies: e.array(V).max(4096),
|
|
1760
|
+
status: Ot,
|
|
1761
|
+
attemptCount: H,
|
|
1762
|
+
reason: K
|
|
1763
|
+
}).refine((e) => new Set(e.dependencies).size === e.dependencies.length && !e.dependencies.includes(e.taskId), "Invalid task dependencies"), Lt = e.strictObject({
|
|
1764
|
+
authorityRef: V,
|
|
1765
|
+
groupId: V,
|
|
1766
|
+
memberId: V,
|
|
1767
|
+
bindingRef: V,
|
|
1768
|
+
providerRef: V,
|
|
1769
|
+
sessionId: V,
|
|
1770
|
+
runId: V,
|
|
1771
|
+
itemId: V.optional()
|
|
1772
|
+
}), Rt = Lt.extend({ interactionId: V }), zt = e.strictObject({
|
|
1773
|
+
ref: Rt,
|
|
1774
|
+
groupId: V,
|
|
1775
|
+
teamRunId: V,
|
|
1776
|
+
revision: U,
|
|
1777
|
+
title: e.string().max(2e3),
|
|
1778
|
+
kind: e.enum(["approval", "input"]),
|
|
1779
|
+
status: e.enum([
|
|
1780
|
+
"pending",
|
|
1781
|
+
"resolving",
|
|
1782
|
+
"resolved",
|
|
1783
|
+
"cancelled",
|
|
1784
|
+
"expired"
|
|
1785
|
+
]),
|
|
1786
|
+
createdAt: W
|
|
1787
|
+
}), Bt = e.discriminatedUnion("kind", [e.strictObject({
|
|
1788
|
+
kind: e.literal("text"),
|
|
1789
|
+
text: e.string()
|
|
1790
|
+
}), e.strictObject({
|
|
1791
|
+
kind: e.literal("attachment"),
|
|
1792
|
+
attachmentRef: V,
|
|
1793
|
+
mediaType: e.string().min(1).max(200),
|
|
1794
|
+
name: e.string().max(4096).optional()
|
|
1795
|
+
})]), Vt = e.strictObject({
|
|
1796
|
+
messageId: V,
|
|
1797
|
+
groupId: V,
|
|
1798
|
+
teamRunId: G,
|
|
1799
|
+
revision: U,
|
|
1800
|
+
createdSeq: U,
|
|
1801
|
+
createdAt: W,
|
|
1802
|
+
senderPrincipal: V,
|
|
1803
|
+
senderName: e.string().max(256),
|
|
1804
|
+
groupRole: e.enum([
|
|
1805
|
+
"owner",
|
|
1806
|
+
"leader",
|
|
1807
|
+
"member",
|
|
1808
|
+
"system"
|
|
1809
|
+
]),
|
|
1810
|
+
memberId: G,
|
|
1811
|
+
parts: e.array(Bt).max(64),
|
|
1812
|
+
mentions: e.array(V).max(8),
|
|
1813
|
+
intent: e.enum([
|
|
1814
|
+
"start_goal",
|
|
1815
|
+
"followup",
|
|
1816
|
+
"directed",
|
|
1817
|
+
"note",
|
|
1818
|
+
"result",
|
|
1819
|
+
"progress"
|
|
1820
|
+
]),
|
|
1821
|
+
replyTo: G,
|
|
1822
|
+
sourceRefs: e.array(Lt).max(64),
|
|
1823
|
+
visibility: e.enum(["public", "internal"])
|
|
1824
|
+
}), Ht = e.strictObject({
|
|
1825
|
+
artifactId: V,
|
|
1826
|
+
groupId: V,
|
|
1827
|
+
teamRunId: V,
|
|
1828
|
+
revision: U,
|
|
1829
|
+
name: e.string().max(4096),
|
|
1830
|
+
mediaType: e.string().min(1).max(200),
|
|
1831
|
+
source: Lt,
|
|
1832
|
+
digest: e.string().regex(/^sha256:[0-9a-f]{64}$/).length(71),
|
|
1833
|
+
sizeBytes: H,
|
|
1834
|
+
state: e.enum([
|
|
1835
|
+
"pending",
|
|
1836
|
+
"ready",
|
|
1837
|
+
"failed"
|
|
1838
|
+
])
|
|
1839
|
+
});
|
|
1840
|
+
function Ut(e, t) {
|
|
1841
|
+
try {
|
|
1842
|
+
if (new TextEncoder().encode(v(e)).byteLength <= 2 * 1024 * 1024) return;
|
|
1843
|
+
} catch {}
|
|
1844
|
+
t.addIssue({
|
|
1845
|
+
code: "custom",
|
|
1846
|
+
message: "Workspace response exceeds safe JSON / two MiB boundary"
|
|
1847
|
+
});
|
|
1848
|
+
}
|
|
1849
|
+
function X(e) {
|
|
1850
|
+
return JSON.stringify([
|
|
1851
|
+
e.authorityId,
|
|
1852
|
+
e.ownerScopeRef,
|
|
1853
|
+
e.groupId
|
|
1854
|
+
]);
|
|
1855
|
+
}
|
|
1856
|
+
function Wt(e) {
|
|
1857
|
+
return JSON.stringify([e.origin, X(e)]);
|
|
1858
|
+
}
|
|
1859
|
+
function Gt(e) {
|
|
1860
|
+
let t = e.ref;
|
|
1861
|
+
return JSON.stringify([
|
|
1862
|
+
t.authorityRef,
|
|
1863
|
+
t.groupId,
|
|
1864
|
+
t.memberId,
|
|
1865
|
+
t.bindingRef,
|
|
1866
|
+
t.providerRef,
|
|
1867
|
+
t.sessionId,
|
|
1868
|
+
t.runId,
|
|
1869
|
+
t.interactionId
|
|
1870
|
+
]);
|
|
1871
|
+
}
|
|
1872
|
+
function Z(e, t) {
|
|
1873
|
+
switch (e) {
|
|
1874
|
+
case "runSummaries": return t.teamRunId;
|
|
1875
|
+
case "taskSummaries": return t.taskId;
|
|
1876
|
+
case "pendingInteractions": return Gt(t);
|
|
1877
|
+
case "recentMessages": return t.messageId;
|
|
1878
|
+
case "artifactSummaries": return t.artifactId;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
function Kt(e, t) {
|
|
1882
|
+
return e.groupId === t.groupId && [
|
|
1883
|
+
...e.ref ? [e.ref] : [],
|
|
1884
|
+
...e.source ? [e.source] : [],
|
|
1885
|
+
...e.sourceRefs ?? []
|
|
1886
|
+
].every((e) => e.groupId === t.groupId && e.authorityRef === t.authorityId);
|
|
1887
|
+
}
|
|
1888
|
+
function qt(e, t, n, r, i) {
|
|
1889
|
+
let a = /* @__PURE__ */ new Set();
|
|
1890
|
+
for (let o of t) {
|
|
1891
|
+
let t = Z(e, o);
|
|
1892
|
+
(a.has(t) || !Kt(o, n)) && i.addIssue({
|
|
1893
|
+
code: "custom",
|
|
1894
|
+
message: "Duplicate row or foreign workspace scope"
|
|
1895
|
+
}), a.add(t), e !== "runSummaries" && o.teamRunId !== r && i.addIssue({
|
|
1896
|
+
code: "custom",
|
|
1897
|
+
message: "Collection belongs to another selected run"
|
|
1898
|
+
}), e === "pendingInteractions" && !["pending", "resolving"].includes(o.status) && i.addIssue({
|
|
1899
|
+
code: "custom",
|
|
1900
|
+
message: "Pending collection contains a terminal interaction"
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
e === "recentMessages" && t.some((e, n) => n > 0 && t[n - 1].createdSeq >= e.createdSeq) && i.addIssue({
|
|
1904
|
+
code: "custom",
|
|
1905
|
+
message: "Message history must be ordered by creation sequence"
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
var Jt = e.strictObject({
|
|
1909
|
+
runSummaries: q,
|
|
1910
|
+
taskSummaries: q,
|
|
1911
|
+
pendingInteractions: q,
|
|
1912
|
+
recentMessages: q,
|
|
1913
|
+
artifactSummaries: q
|
|
1914
|
+
}), Yt = e.strictObject({
|
|
1915
|
+
apiVersion: e.literal(t),
|
|
1916
|
+
viewVersion: e.literal(Et),
|
|
1917
|
+
scope: J,
|
|
1918
|
+
snapshotId: V,
|
|
1919
|
+
watermark: H,
|
|
1920
|
+
group: At,
|
|
1921
|
+
members: e.array(Nt).max(8),
|
|
1922
|
+
runSummaries: e.array(Y).max(20),
|
|
1923
|
+
selectedRun: Y.nullable(),
|
|
1924
|
+
selectedRunMembers: e.array(Pt).max(8),
|
|
1925
|
+
taskSummaries: e.array(It).max(100),
|
|
1926
|
+
pendingInteractions: e.array(zt).max(50),
|
|
1927
|
+
recentMessages: e.array(Vt).max(50),
|
|
1928
|
+
artifactSummaries: e.array(Ht).max(50),
|
|
1929
|
+
cursors: Jt
|
|
1930
|
+
}).superRefine((e, t) => {
|
|
1931
|
+
let n = (e) => t.addIssue({
|
|
1932
|
+
code: "custom",
|
|
1933
|
+
message: e
|
|
1934
|
+
});
|
|
1935
|
+
(e.group.groupId !== e.scope.groupId || e.group.authorityRef !== e.scope.authorityId) && n("Group scope mismatch"), (new Set(e.members.map((e) => e.memberId)).size !== e.members.length || e.members.some((t) => !Kt(t, e.scope))) && n("Invalid group roster"), e.members.some((t) => t.memberId === e.group.leaderMemberId) || n("Missing group Leader");
|
|
1936
|
+
let r = e.selectedRun?.teamRunId ?? null;
|
|
1937
|
+
for (let n of B) qt(n, e[n], e.scope, r, t);
|
|
1938
|
+
e.selectedRun && (!Kt(e.selectedRun, e.scope) || !e.selectedRunMembers.some((t) => t.memberId === e.selectedRun.leaderMemberId)) && n("Invalid selected run or frozen Leader roster");
|
|
1939
|
+
let i = e.runSummaries.find((e) => e.teamRunId === r);
|
|
1940
|
+
i && v(i) !== v(e.selectedRun) && n("Selected run and summary differ at snapshot watermark"), (new Set(e.selectedRunMembers.map((e) => e.runMemberId)).size !== e.selectedRunMembers.length || new Set(e.selectedRunMembers.map((e) => e.memberId)).size !== e.selectedRunMembers.length || e.selectedRunMembers.some((t) => !Kt(t, e.scope) || t.teamRunId !== r || t.groupRevision !== e.selectedRun?.groupRevision)) && n("Invalid frozen run roster"), r === null && (e.selectedRunMembers.length || B.slice(1).some((t) => e[t].length || e.cursors[t] !== null)) && n("Unselected view cannot contain run-specific rows"), e.recentMessages.some((t) => t.createdSeq > e.watermark) && n("Message creation is newer than snapshot watermark"), Ut(e, t);
|
|
1941
|
+
}), Xt = {
|
|
1942
|
+
apiVersion: e.literal(t),
|
|
1943
|
+
viewVersion: e.literal(Et),
|
|
1944
|
+
scope: J,
|
|
1945
|
+
snapshotId: V,
|
|
1946
|
+
watermark: H,
|
|
1947
|
+
teamRunId: G,
|
|
1948
|
+
cursor: e.string().min(1).max(4096),
|
|
1949
|
+
nextCursor: q
|
|
1950
|
+
}, Zt = e.discriminatedUnion("collection", [
|
|
1951
|
+
e.strictObject({
|
|
1952
|
+
...Xt,
|
|
1953
|
+
collection: e.literal("runSummaries"),
|
|
1954
|
+
items: e.array(Y).max(100)
|
|
1955
|
+
}),
|
|
1956
|
+
e.strictObject({
|
|
1957
|
+
...Xt,
|
|
1958
|
+
collection: e.literal("taskSummaries"),
|
|
1959
|
+
items: e.array(It).max(100)
|
|
1960
|
+
}),
|
|
1961
|
+
e.strictObject({
|
|
1962
|
+
...Xt,
|
|
1963
|
+
collection: e.literal("pendingInteractions"),
|
|
1964
|
+
items: e.array(zt).max(100)
|
|
1965
|
+
}),
|
|
1966
|
+
e.strictObject({
|
|
1967
|
+
...Xt,
|
|
1968
|
+
collection: e.literal("recentMessages"),
|
|
1969
|
+
items: e.array(Vt).max(100)
|
|
1970
|
+
}),
|
|
1971
|
+
e.strictObject({
|
|
1972
|
+
...Xt,
|
|
1973
|
+
collection: e.literal("artifactSummaries"),
|
|
1974
|
+
items: e.array(Ht).max(100)
|
|
1975
|
+
})
|
|
1976
|
+
]).superRefine((e, t) => {
|
|
1977
|
+
qt(e.collection, e.items, e.scope, e.teamRunId, t), (e.collection === "runSummaries" ? e.teamRunId !== null : e.teamRunId === null) && t.addIssue({
|
|
1978
|
+
code: "custom",
|
|
1979
|
+
message: "Invalid page run scope"
|
|
1980
|
+
}), e.cursor === e.nextCursor && t.addIssue({
|
|
1981
|
+
code: "custom",
|
|
1982
|
+
message: "Page cursor did not advance"
|
|
1983
|
+
}), e.collection === "recentMessages" && e.items.some((t) => t.createdSeq > e.watermark) && t.addIssue({
|
|
1984
|
+
code: "custom",
|
|
1985
|
+
message: "Message creation exceeds snapshot watermark"
|
|
1986
|
+
}), Ut(e, t);
|
|
1987
|
+
}), Qt = e.strictObject({
|
|
1988
|
+
collection: e.enum(B),
|
|
1989
|
+
snapshotId: V,
|
|
1990
|
+
watermark: H,
|
|
1991
|
+
teamRunId: G,
|
|
1992
|
+
cursor: e.string().min(1).max(4096),
|
|
1993
|
+
limit: e.number().int().min(1).max(100).optional()
|
|
1994
|
+
}).refine((e) => e.collection === "runSummaries" ? e.teamRunId === null : e.teamRunId !== null, "Invalid collection run scope"), $t = e.discriminatedUnion("kind", [
|
|
1995
|
+
e.strictObject({
|
|
1996
|
+
kind: e.literal("group"),
|
|
1997
|
+
group: At
|
|
1998
|
+
}),
|
|
1999
|
+
e.strictObject({
|
|
2000
|
+
kind: e.literal("member"),
|
|
2001
|
+
member: Nt
|
|
2002
|
+
}),
|
|
2003
|
+
e.strictObject({
|
|
2004
|
+
kind: e.literal("run_member"),
|
|
2005
|
+
runMember: Pt
|
|
2006
|
+
}),
|
|
2007
|
+
e.strictObject({
|
|
2008
|
+
kind: e.literal("run"),
|
|
2009
|
+
run: Y
|
|
2010
|
+
}),
|
|
2011
|
+
e.strictObject({
|
|
2012
|
+
kind: e.literal("task"),
|
|
2013
|
+
task: It
|
|
2014
|
+
}),
|
|
2015
|
+
e.strictObject({
|
|
2016
|
+
kind: e.literal("interaction"),
|
|
2017
|
+
interaction: zt
|
|
2018
|
+
}),
|
|
2019
|
+
e.strictObject({
|
|
2020
|
+
kind: e.literal("message"),
|
|
2021
|
+
message: Vt
|
|
2022
|
+
}),
|
|
2023
|
+
e.strictObject({
|
|
2024
|
+
kind: e.literal("artifact"),
|
|
2025
|
+
artifact: Ht
|
|
2026
|
+
}),
|
|
2027
|
+
e.strictObject({
|
|
2028
|
+
kind: e.literal("invalidate"),
|
|
2029
|
+
teamRunId: G,
|
|
2030
|
+
collections: e.array(e.enum(B)).min(1).max(5)
|
|
2031
|
+
})
|
|
2032
|
+
]), en = e.strictObject({
|
|
2033
|
+
apiVersion: e.literal(t),
|
|
2034
|
+
viewVersion: e.literal(Et),
|
|
2035
|
+
scope: J,
|
|
2036
|
+
eventId: V,
|
|
2037
|
+
groupSeq: U,
|
|
2038
|
+
type: e.literal("workspace.delta"),
|
|
2039
|
+
createdAt: W,
|
|
2040
|
+
changes: e.array($t).max(32)
|
|
2041
|
+
}).superRefine((e, t) => {
|
|
2042
|
+
for (let n of e.changes) n.kind !== "invalidate" && ((!Kt(n.kind === "group" ? n.group : n.kind === "member" ? n.member : n.kind === "run_member" ? n.runMember : n.kind === "run" ? n.run : n.kind === "task" ? n.task : n.kind === "interaction" ? n.interaction : n.kind === "message" ? n.message : n.artifact, e.scope) || n.kind === "group" && n.group.authorityRef !== e.scope.authorityId) && t.addIssue({
|
|
2043
|
+
code: "custom",
|
|
2044
|
+
message: "Foreign row in workspace delta"
|
|
2045
|
+
}), n.kind === "message" && n.message.createdSeq > e.groupSeq && t.addIssue({
|
|
2046
|
+
code: "custom",
|
|
2047
|
+
message: "Future message in workspace event"
|
|
2048
|
+
}));
|
|
2049
|
+
Ut(e, t);
|
|
2050
|
+
});
|
|
2051
|
+
function tn(e, t) {
|
|
2052
|
+
try {
|
|
2053
|
+
return e.parse(t);
|
|
2054
|
+
} catch {
|
|
2055
|
+
throw new m("workspace_contract_mismatch", "团队工作区数据格式不兼容,需要重新读取。");
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
function nn(e) {
|
|
2059
|
+
return tn(Yt, e);
|
|
2060
|
+
}
|
|
2061
|
+
function rn(e) {
|
|
2062
|
+
return tn(Zt, e);
|
|
2063
|
+
}
|
|
2064
|
+
function an(e) {
|
|
2065
|
+
return tn(en, e);
|
|
2066
|
+
}
|
|
2067
|
+
//#endregion
|
|
2068
|
+
//#region src/core/teams/workspaceReducer.ts
|
|
2069
|
+
var Q = (e) => {
|
|
2070
|
+
throw new m("reset_required", e);
|
|
2071
|
+
}, on = class {
|
|
2072
|
+
value;
|
|
2073
|
+
baseWatermark;
|
|
2074
|
+
versions = /* @__PURE__ */ new Map();
|
|
2075
|
+
seenSeq = /* @__PURE__ */ new Map();
|
|
2076
|
+
seenIds = /* @__PURE__ */ new Map();
|
|
2077
|
+
dirty = /* @__PURE__ */ new Set();
|
|
2078
|
+
dirtyRuns = /* @__PURE__ */ new Set();
|
|
2079
|
+
usedCursors = /* @__PURE__ */ new Map();
|
|
2080
|
+
maxRows;
|
|
2081
|
+
constructor(e, t = {}) {
|
|
2082
|
+
if (this.value = nn(e), this.baseWatermark = this.value.watermark, this.maxRows = t.maxRowsPerCollection ?? 5e3, !Number.isSafeInteger(this.maxRows) || this.maxRows < 100 || this.maxRows > 5e4) throw new m("invalid_workspace_limit", "工作区缓存上限无效。");
|
|
2083
|
+
this.seedVersions();
|
|
2084
|
+
}
|
|
2085
|
+
snapshot() {
|
|
2086
|
+
return structuredClone(this.value);
|
|
2087
|
+
}
|
|
2088
|
+
watermark() {
|
|
2089
|
+
return this.value.watermark;
|
|
2090
|
+
}
|
|
2091
|
+
snapshotId() {
|
|
2092
|
+
return this.value.snapshotId;
|
|
2093
|
+
}
|
|
2094
|
+
projection() {
|
|
2095
|
+
return {
|
|
2096
|
+
snapshot: this.snapshot(),
|
|
2097
|
+
snapshotWatermark: this.baseWatermark,
|
|
2098
|
+
dirtyCollections: [...this.dirty],
|
|
2099
|
+
dirtyRunIds: [...this.dirtyRuns]
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2102
|
+
seedVersions() {
|
|
2103
|
+
this.versions.clear();
|
|
2104
|
+
let e = (e, t) => this.versions.set(e, {
|
|
2105
|
+
revision: t.revision,
|
|
2106
|
+
digest: v(t),
|
|
2107
|
+
domainDigest: this.domainDigest(e, t),
|
|
2108
|
+
observedSeq: this.baseWatermark
|
|
2109
|
+
});
|
|
2110
|
+
e("group", this.value.group), this.value.members.forEach((t) => e(`members:${t.memberId}`, t)), this.value.selectedRunMembers.forEach((t) => e(`runMembers:${t.runMemberId}`, t));
|
|
2111
|
+
for (let t of B) for (let n of this.value[t]) e(`${t}:${Z(t, n)}`, n);
|
|
2112
|
+
this.value.selectedRun && e(`runSummaries:${this.value.selectedRun.teamRunId}`, this.value.selectedRun);
|
|
2113
|
+
}
|
|
2114
|
+
domainDigest(e, t) {
|
|
2115
|
+
if (!e.startsWith("runSummaries:")) return v(t);
|
|
2116
|
+
let n = { ...t };
|
|
2117
|
+
return delete n.taskCount, delete n.pendingCount, delete n.leaderStandby, v(n);
|
|
2118
|
+
}
|
|
2119
|
+
accept(e, t, n, r) {
|
|
2120
|
+
let i = e.get(t);
|
|
2121
|
+
if (i && (i.revision > n.revision || i.observedSeq > r)) return !1;
|
|
2122
|
+
let a = v(n), o = this.domainDigest(t, n);
|
|
2123
|
+
if (i?.revision === n.revision) {
|
|
2124
|
+
if (i.digest === a) return !1;
|
|
2125
|
+
(r <= i.observedSeq || i.domainDigest !== o) && Q("同一对象版本出现不同内容,需要重新读取。");
|
|
2126
|
+
}
|
|
2127
|
+
return e.set(t, {
|
|
2128
|
+
revision: n.revision,
|
|
2129
|
+
digest: a,
|
|
2130
|
+
domainDigest: o,
|
|
2131
|
+
observedSeq: r
|
|
2132
|
+
}), !0;
|
|
2133
|
+
}
|
|
2134
|
+
upsert(e, t, n) {
|
|
2135
|
+
let r = e.findIndex((e) => n(e) === n(t));
|
|
2136
|
+
return r < 0 && e.length >= this.maxRows && Q("工作区缓存已达到上限,需要重新读取分页视图。"), r < 0 ? [...e, t] : e.map((e, n) => n === r ? t : e);
|
|
2137
|
+
}
|
|
2138
|
+
mergeRow(e, t, n, r, i) {
|
|
2139
|
+
let a = Z(n, r);
|
|
2140
|
+
if (!this.accept(t, `${n}:${a}`, r, i)) {
|
|
2141
|
+
n === "runSummaries" && e.selectedRun?.teamRunId === a && !e.runSummaries.some((e) => e.teamRunId === a) && (e.runSummaries = this.upsert(e.runSummaries, e.selectedRun, (e) => e.teamRunId));
|
|
2142
|
+
return;
|
|
2143
|
+
}
|
|
2144
|
+
if (n === "pendingInteractions" && !["pending", "resolving"].includes(r.status)) {
|
|
2145
|
+
e.pendingInteractions = e.pendingInteractions.filter((e) => Z(n, e) !== a);
|
|
2146
|
+
return;
|
|
2147
|
+
}
|
|
2148
|
+
let o = this.upsert(e[n], r, (e) => Z(n, e));
|
|
2149
|
+
n === "recentMessages" && o.sort((e, t) => e.createdSeq - t.createdSeq || Z(n, e).localeCompare(Z(n, t))), Object.assign(e, { [n]: o });
|
|
2150
|
+
}
|
|
2151
|
+
replace(e) {
|
|
2152
|
+
let t = nn(e);
|
|
2153
|
+
if (X(t.scope) !== X(this.value.scope) || t.selectedRun?.teamRunId !== this.value.selectedRun?.teamRunId) throw new m("scope_mismatch", "刷新快照改变了工作区身份或所选协作任务。");
|
|
2154
|
+
return t.watermark < this.value.watermark || t.group.revision < this.value.group.revision || t.selectedRun && this.value.selectedRun && t.selectedRun.revision < this.value.selectedRun.revision ? !1 : (this.value = t, this.baseWatermark = t.watermark, this.seenSeq.clear(), this.seenIds.clear(), this.dirty.clear(), this.dirtyRuns.clear(), this.usedCursors.clear(), this.seedVersions(), !0);
|
|
2155
|
+
}
|
|
2156
|
+
apply(e) {
|
|
2157
|
+
let t = an(e);
|
|
2158
|
+
if (X(t.scope) !== X(this.value.scope)) throw new m("scope_mismatch", "事件不属于当前授权工作区。");
|
|
2159
|
+
let n = this.seenSeq.get(t.groupSeq);
|
|
2160
|
+
n && n !== t.eventId && Q("同一事件水位出现不同事件身份。");
|
|
2161
|
+
let r = this.seenIds.get(t.eventId);
|
|
2162
|
+
if (r !== void 0 && r !== t.groupSeq && Q("同一事件身份被用于不同水位。"), t.groupSeq <= this.value.watermark) return !1;
|
|
2163
|
+
t.groupSeq !== this.value.watermark + 1 && Q("团队事件存在缺口,需要重新读取工作区。");
|
|
2164
|
+
let i = { ...this.value }, a = new Map(this.versions), o = new Set(this.dirty), s = new Set(this.dirtyRuns), c = /* @__PURE__ */ new Set(), l = i.selectedRun?.teamRunId ?? null;
|
|
2165
|
+
for (let e of t.changes) {
|
|
2166
|
+
if (e.kind === "invalidate") {
|
|
2167
|
+
e.teamRunId === l || e.teamRunId === null ? e.collections.forEach((e) => o.add(e)) : s.add(e.teamRunId);
|
|
2168
|
+
continue;
|
|
2169
|
+
}
|
|
2170
|
+
if (e.kind === "group") {
|
|
2171
|
+
if (e.group.tenantId !== i.group.tenantId || e.group.ownerSubject !== i.group.ownerSubject) throw new m("scope_mismatch", "群事件改变了原始租户或主体。");
|
|
2172
|
+
this.accept(a, "group", e.group, t.groupSeq) && (i.group = e.group);
|
|
2173
|
+
} else if (e.kind === "member") this.accept(a, `members:${e.member.memberId}`, e.member, t.groupSeq) && (i.members = this.upsert(i.members, e.member, (e) => e.memberId));
|
|
2174
|
+
else if (e.kind === "run_member") {
|
|
2175
|
+
if (e.runMember.teamRunId !== l) {
|
|
2176
|
+
s.add(e.runMember.teamRunId);
|
|
2177
|
+
continue;
|
|
2178
|
+
}
|
|
2179
|
+
this.accept(a, `runMembers:${e.runMember.runMemberId}`, e.runMember, t.groupSeq) && (i.selectedRunMembers = this.upsert(i.selectedRunMembers, e.runMember, (e) => e.runMemberId));
|
|
2180
|
+
} else if (e.kind === "run") {
|
|
2181
|
+
let n = e.run;
|
|
2182
|
+
this.accept(a, `runSummaries:${n.teamRunId}`, n, t.groupSeq) && (i.runSummaries = this.upsert(i.runSummaries, n, (e) => e.teamRunId), n.teamRunId === l && (i.selectedRun = n)), c.add(n.teamRunId);
|
|
2183
|
+
} else {
|
|
2184
|
+
let [n, r] = e.kind === "task" ? ["taskSummaries", e.task] : e.kind === "interaction" ? ["pendingInteractions", e.interaction] : e.kind === "message" ? ["recentMessages", e.message] : ["artifactSummaries", e.artifact];
|
|
2185
|
+
if (r.teamRunId !== l) {
|
|
2186
|
+
r.teamRunId && s.add(r.teamRunId);
|
|
2187
|
+
continue;
|
|
2188
|
+
}
|
|
2189
|
+
this.mergeRow(i, a, n, r, t.groupSeq), (n === "taskSummaries" || n === "pendingInteractions") && (o.add("runSummaries"), r.teamRunId && s.add(r.teamRunId));
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
if (c.forEach((e) => s.delete(e)), (!i.members.some((e) => e.memberId === i.group.leaderMemberId) || i.selectedRun && (!i.selectedRunMembers.some((e) => e.memberId === i.selectedRun.leaderMemberId) || i.selectedRunMembers.some((e) => e.groupRevision !== i.selectedRun.groupRevision))) && Q("Leader 变更缺少匹配成员投影。"), i.watermark = t.groupSeq, this.value = i, this.versions = a, this.dirty = o, this.dirtyRuns = s, this.seenSeq.set(t.groupSeq, t.eventId), this.seenIds.set(t.eventId, t.groupSeq), this.seenSeq.size > 1e4) {
|
|
2193
|
+
let e = this.seenSeq.entries().next().value;
|
|
2194
|
+
this.seenSeq.delete(e[0]), this.seenIds.delete(e[1]);
|
|
2195
|
+
}
|
|
2196
|
+
return !0;
|
|
2197
|
+
}
|
|
2198
|
+
pageRequest(e, t) {
|
|
2199
|
+
let n = this.value.cursors[e];
|
|
2200
|
+
if (n === null) return null;
|
|
2201
|
+
let r = e === "runSummaries" ? null : this.value.selectedRun?.teamRunId ?? null;
|
|
2202
|
+
if (e !== "runSummaries" && r === null) throw new m("scope_mismatch", "未选择任务,无法读取任务分页。");
|
|
2203
|
+
return {
|
|
2204
|
+
collection: e,
|
|
2205
|
+
snapshotId: this.value.snapshotId,
|
|
2206
|
+
watermark: this.baseWatermark,
|
|
2207
|
+
teamRunId: r,
|
|
2208
|
+
cursor: n,
|
|
2209
|
+
...t === void 0 ? {} : { limit: t }
|
|
2210
|
+
};
|
|
2211
|
+
}
|
|
2212
|
+
mergePage(e, t) {
|
|
2213
|
+
let n = rn(t);
|
|
2214
|
+
if (X(n.scope) !== X(this.value.scope)) throw new m("scope_mismatch", "分页返回了其他授权工作区。");
|
|
2215
|
+
let r = this.pageRequest(e.collection, e.limit);
|
|
2216
|
+
if (!r || e.snapshotId !== r.snapshotId || e.watermark !== r.watermark || e.cursor !== r.cursor || e.teamRunId !== r.teamRunId || n.snapshotId !== r.snapshotId || n.watermark !== r.watermark || n.cursor !== r.cursor || n.teamRunId !== r.teamRunId || n.collection !== r.collection) throw new m("workspace_page_mismatch", "分页与当前快照或任务不一致,需要重新读取。");
|
|
2217
|
+
if (n.nextCursor !== null && this.usedCursors.get(n.collection)?.has(n.nextCursor)) throw new m("workspace_page_mismatch", "分页游标出现循环,需要重新读取。");
|
|
2218
|
+
let i = {
|
|
2219
|
+
...this.value,
|
|
2220
|
+
cursors: { ...this.value.cursors }
|
|
2221
|
+
}, a = new Map(this.versions);
|
|
2222
|
+
for (let e of n.items) this.mergeRow(i, a, n.collection, e, n.watermark);
|
|
2223
|
+
i.cursors[n.collection] = n.nextCursor, this.value = i, this.versions = a;
|
|
2224
|
+
let o = this.usedCursors.get(n.collection) ?? /* @__PURE__ */ new Set();
|
|
2225
|
+
return o.add(n.cursor), this.usedCursors.set(n.collection, o), !0;
|
|
2226
|
+
}
|
|
2227
|
+
}, sn = new Set([
|
|
2228
|
+
"reset_required",
|
|
2229
|
+
"snapshot_expired",
|
|
2230
|
+
"workspace_page_mismatch",
|
|
2231
|
+
"workspace_contract_mismatch"
|
|
2232
|
+
]), cn = (e, t) => new Promise((n) => {
|
|
2233
|
+
if (t.aborted) {
|
|
2234
|
+
n();
|
|
2235
|
+
return;
|
|
2236
|
+
}
|
|
2237
|
+
let r = () => {
|
|
2238
|
+
clearTimeout(i), t.removeEventListener("abort", r), n();
|
|
2239
|
+
}, i = setTimeout(r, e);
|
|
2240
|
+
t.addEventListener("abort", r, { once: !0 });
|
|
2241
|
+
}), ln = class {
|
|
2242
|
+
scope;
|
|
2243
|
+
cacheKey;
|
|
2244
|
+
transport;
|
|
2245
|
+
maxReconnects;
|
|
2246
|
+
retryDelay;
|
|
2247
|
+
value;
|
|
2248
|
+
reducer;
|
|
2249
|
+
listeners = /* @__PURE__ */ new Set();
|
|
2250
|
+
drafts = /* @__PURE__ */ new Map();
|
|
2251
|
+
pendingPages = /* @__PURE__ */ new Map();
|
|
2252
|
+
controller;
|
|
2253
|
+
streamController;
|
|
2254
|
+
generation = 0;
|
|
2255
|
+
disposed = !1;
|
|
2256
|
+
resyncRequested = !1;
|
|
2257
|
+
observingGeneration;
|
|
2258
|
+
constructor(e, t, n = {}) {
|
|
2259
|
+
if (this.scope = Object.freeze(kt.parse(e)), this.cacheKey = Wt(this.scope), this.transport = t, this.maxReconnects = n.maxReconnects ?? 6, !Number.isSafeInteger(this.maxReconnects) || this.maxReconnects < 0 || this.maxReconnects > 32) throw new m("invalid_reconnect_limit", "重连次数必须在 0–32 之间。");
|
|
2260
|
+
this.retryDelay = n.retryDelayMs ?? ((e) => Math.min(500 * 2 ** e, 1e4)), this.value = {
|
|
2261
|
+
scope: this.scope,
|
|
2262
|
+
selectedRunId: null,
|
|
2263
|
+
projection: null,
|
|
2264
|
+
connection: "closed",
|
|
2265
|
+
draft: "",
|
|
2266
|
+
errorCode: null,
|
|
2267
|
+
loadingPages: []
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
getSnapshot = () => this.value;
|
|
2271
|
+
subscribe = (e) => (this.listeners.add(e), () => this.listeners.delete(e));
|
|
2272
|
+
update(e) {
|
|
2273
|
+
this.disposed || (this.value = {
|
|
2274
|
+
...this.value,
|
|
2275
|
+
...e
|
|
2276
|
+
}, this.listeners.forEach((e) => e()));
|
|
2277
|
+
}
|
|
2278
|
+
setDraft(e) {
|
|
2279
|
+
this.drafts.set(this.value.selectedRunId ?? "", e), this.update({ draft: e });
|
|
2280
|
+
}
|
|
2281
|
+
acknowledgeDraft(e, t) {
|
|
2282
|
+
if (this.disposed) return !1;
|
|
2283
|
+
let n = e ?? "", r = this.value.selectedRunId === e ? this.value.draft : this.drafts.get(n);
|
|
2284
|
+
return r === void 0 || r.trim() !== t ? !1 : (this.drafts.set(n, ""), this.value.selectedRunId === e && this.update({ draft: "" }), !0);
|
|
2285
|
+
}
|
|
2286
|
+
disconnect() {
|
|
2287
|
+
this.generation++, this.controller?.abort(), this.streamController?.abort(), this.controller = void 0, this.observingGeneration = void 0, this.pendingPages.clear(), this.update({
|
|
2288
|
+
connection: "closed",
|
|
2289
|
+
loadingPages: []
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
dispose() {
|
|
2293
|
+
this.disconnect(), this.reducer = void 0, this.drafts.clear(), this.update({
|
|
2294
|
+
projection: null,
|
|
2295
|
+
draft: "",
|
|
2296
|
+
selectedRunId: null,
|
|
2297
|
+
errorCode: null
|
|
2298
|
+
}), this.disposed = !0, this.listeners.clear();
|
|
2299
|
+
}
|
|
2300
|
+
refresh() {
|
|
2301
|
+
if (!this.disposed) {
|
|
2302
|
+
if (this.observingGeneration === void 0) {
|
|
2303
|
+
this.observe(this.value.selectedRunId ?? void 0);
|
|
2304
|
+
return;
|
|
2305
|
+
}
|
|
2306
|
+
this.resyncRequested = !0, this.update({ connection: "reconnecting" }), this.streamController?.abort();
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
async observe(e) {
|
|
2310
|
+
if (this.disposed) throw new m("scope_disposed", "工作区观察已关闭。");
|
|
2311
|
+
let t = this.value.selectedRunId;
|
|
2312
|
+
this.disconnect();
|
|
2313
|
+
let n = ++this.generation;
|
|
2314
|
+
this.observingGeneration = n;
|
|
2315
|
+
let r = new AbortController();
|
|
2316
|
+
this.controller = r;
|
|
2317
|
+
let i = () => !this.disposed && n === this.generation && !r.signal.aborted;
|
|
2318
|
+
e !== t && (this.reducer = void 0), this.resyncRequested = !1, this.update({
|
|
2319
|
+
selectedRunId: e ?? null,
|
|
2320
|
+
projection: this.reducer?.projection() ?? null,
|
|
2321
|
+
draft: this.drafts.get(e ?? "") ?? "",
|
|
2322
|
+
connection: "connecting",
|
|
2323
|
+
errorCode: null
|
|
2324
|
+
});
|
|
2325
|
+
let a = e, o = !0, s = 0;
|
|
2326
|
+
try {
|
|
2327
|
+
for (; i();) try {
|
|
2328
|
+
if (o) {
|
|
2329
|
+
this.resyncRequested = !1, this.pendingPages.clear(), this.update({ loadingPages: [] });
|
|
2330
|
+
let e = await this.transport.read(this.scope, {
|
|
2331
|
+
teamRunId: a,
|
|
2332
|
+
signal: r.signal
|
|
2333
|
+
});
|
|
2334
|
+
if (!i()) return;
|
|
2335
|
+
if (X(e.scope) !== X(this.scope) || a !== void 0 && e.selectedRun?.teamRunId !== a) throw new m("scope_mismatch", "工作区快照与当前身份或所选任务不一致。");
|
|
2336
|
+
if (this.reducer) {
|
|
2337
|
+
if (!this.reducer.replace(e)) throw new m("reset_required", "工作区快照早于当前事件水位。");
|
|
2338
|
+
} else this.reducer = new on(e);
|
|
2339
|
+
a = e.selectedRun?.teamRunId;
|
|
2340
|
+
let t = a ?? null, n = this.value.selectedRunId === t ? this.value.draft : this.drafts.get(t ?? "") ?? this.value.draft;
|
|
2341
|
+
this.drafts.set(t ?? "", n), this.update({
|
|
2342
|
+
selectedRunId: t,
|
|
2343
|
+
projection: this.reducer.projection(),
|
|
2344
|
+
draft: n
|
|
2345
|
+
}), o = !1, this.resyncRequested = !1;
|
|
2346
|
+
}
|
|
2347
|
+
let e = this.reducer, t = new AbortController();
|
|
2348
|
+
this.streamController = t;
|
|
2349
|
+
let n = () => t.abort();
|
|
2350
|
+
r.signal.addEventListener("abort", n, { once: !0 }), this.update({
|
|
2351
|
+
connection: "connected",
|
|
2352
|
+
errorCode: null
|
|
2353
|
+
});
|
|
2354
|
+
try {
|
|
2355
|
+
await this.transport.subscribe(this.scope, e.watermark(), t.signal, (n) => {
|
|
2356
|
+
if (!(!i() || t.signal.aborted || this.reducer !== e) && e.apply(n)) {
|
|
2357
|
+
s = 0;
|
|
2358
|
+
let t = e.projection();
|
|
2359
|
+
this.update({ projection: t }), t.dirtyCollections.length && this.refresh();
|
|
2360
|
+
}
|
|
2361
|
+
});
|
|
2362
|
+
} finally {
|
|
2363
|
+
r.signal.removeEventListener("abort", n), t.abort();
|
|
2364
|
+
}
|
|
2365
|
+
if (!i()) return;
|
|
2366
|
+
if (this.resyncRequested) {
|
|
2367
|
+
o = !0;
|
|
2368
|
+
continue;
|
|
2369
|
+
}
|
|
2370
|
+
throw new m("stream_ended", "工作区事件连接已断开。");
|
|
2371
|
+
} catch (e) {
|
|
2372
|
+
if (!i()) return;
|
|
2373
|
+
if (this.resyncRequested) {
|
|
2374
|
+
o = !0;
|
|
2375
|
+
continue;
|
|
2376
|
+
}
|
|
2377
|
+
let t = e instanceof m ? e : new m("network_error", "工作区暂时无法连接。");
|
|
2378
|
+
if (t.code === "scope_mismatch" || [
|
|
2379
|
+
401,
|
|
2380
|
+
403,
|
|
2381
|
+
404
|
|
2382
|
+
].includes(t.status ?? 0) || (sn.has(t.code) && (o = !0), s++ >= this.maxReconnects)) throw t;
|
|
2383
|
+
this.update({
|
|
2384
|
+
connection: "reconnecting",
|
|
2385
|
+
errorCode: t.code
|
|
2386
|
+
});
|
|
2387
|
+
let n = this.retryDelay(s - 1);
|
|
2388
|
+
if (!Number.isFinite(n) || n < 0 || n > 6e4) throw new m("invalid_retry_delay", "工作区重试间隔无效。");
|
|
2389
|
+
await cn(n, r.signal);
|
|
2390
|
+
}
|
|
2391
|
+
} catch (e) {
|
|
2392
|
+
if (!i()) return;
|
|
2393
|
+
let t = e instanceof m ? e : new m("network_error", "工作区无法连接。");
|
|
2394
|
+
(t.code === "scope_mismatch" || [
|
|
2395
|
+
401,
|
|
2396
|
+
403,
|
|
2397
|
+
404
|
|
2398
|
+
].includes(t.status ?? 0)) && (this.reducer = void 0, this.drafts.clear(), this.update({
|
|
2399
|
+
projection: null,
|
|
2400
|
+
draft: ""
|
|
2401
|
+
})), this.update({
|
|
2402
|
+
connection: "offline",
|
|
2403
|
+
errorCode: t.code
|
|
2404
|
+
});
|
|
2405
|
+
} finally {
|
|
2406
|
+
this.observingGeneration === n && (this.observingGeneration = void 0);
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
loadMore(e, t) {
|
|
2410
|
+
if (this.disposed) return Promise.reject(new m("scope_disposed", "工作区观察已关闭。"));
|
|
2411
|
+
let n = this.pendingPages.get(e);
|
|
2412
|
+
if (n) return n;
|
|
2413
|
+
let r = this.reducer, i = this.controller, a = this.generation;
|
|
2414
|
+
if (!r || !i || i.signal.aborted) return Promise.reject(new m("workspace_not_ready", "工作区尚未就绪。"));
|
|
2415
|
+
let o = r.pageRequest(e, t);
|
|
2416
|
+
if (!o) return Promise.resolve(!1);
|
|
2417
|
+
let s = () => !this.disposed && a === this.generation && !i.signal.aborted && r === this.reducer, c = () => s() && r.snapshotId() === o.snapshotId, l;
|
|
2418
|
+
return l = (async () => {
|
|
2419
|
+
this.update({ loadingPages: [...new Set([...this.value.loadingPages, e])] });
|
|
2420
|
+
try {
|
|
2421
|
+
let e = await this.transport.page(this.scope, o, i.signal);
|
|
2422
|
+
return c() ? (r.mergePage(o, e), this.update({ projection: r.projection() }), !0) : !1;
|
|
2423
|
+
} catch (e) {
|
|
2424
|
+
if (!c()) return !1;
|
|
2425
|
+
let t = e instanceof m ? e : new m("network_error", "分页加载失败。");
|
|
2426
|
+
throw t.code === "scope_mismatch" || [
|
|
2427
|
+
401,
|
|
2428
|
+
403,
|
|
2429
|
+
404
|
|
2430
|
+
].includes(t.status ?? 0) ? (this.disconnect(), this.reducer = void 0, this.drafts.clear(), this.update({
|
|
2431
|
+
projection: null,
|
|
2432
|
+
draft: "",
|
|
2433
|
+
connection: "offline",
|
|
2434
|
+
errorCode: t.code
|
|
2435
|
+
}), t) : (this.update({ errorCode: t.code }), sn.has(t.code) && this.refresh(), t);
|
|
2436
|
+
} finally {
|
|
2437
|
+
s() && this.pendingPages.get(e) === l && (this.pendingPages.delete(e), this.update({ loadingPages: this.value.loadingPages.filter((t) => t !== e) }));
|
|
2438
|
+
}
|
|
2439
|
+
})(), this.pendingPages.set(e, l), l;
|
|
2440
|
+
}
|
|
2441
|
+
}, un = class {
|
|
2442
|
+
outbox;
|
|
2443
|
+
drainer;
|
|
2444
|
+
state = {
|
|
2445
|
+
operations: [],
|
|
2446
|
+
recovering: !1,
|
|
2447
|
+
errorCode: null
|
|
2448
|
+
};
|
|
2449
|
+
listeners = /* @__PURE__ */ new Set();
|
|
2450
|
+
work;
|
|
2451
|
+
disposed = !1;
|
|
2452
|
+
writable = !0;
|
|
2453
|
+
recoveryController;
|
|
2454
|
+
controller = new AbortController();
|
|
2455
|
+
constructor(e, t) {
|
|
2456
|
+
this.outbox = new je(e), this.drainer = new Me(this.outbox, t);
|
|
2457
|
+
}
|
|
2458
|
+
getSnapshot = () => this.state;
|
|
2459
|
+
subscribe = (e) => (this.listeners.add(e), () => {
|
|
2460
|
+
this.listeners.delete(e);
|
|
2461
|
+
});
|
|
2462
|
+
update(e) {
|
|
2463
|
+
this.disposed || (this.state = {
|
|
2464
|
+
...this.state,
|
|
2465
|
+
...e
|
|
2466
|
+
}, this.listeners.forEach((e) => e()));
|
|
2467
|
+
}
|
|
2468
|
+
async refresh() {
|
|
2469
|
+
this.disposed || this.update({ operations: await this.outbox.list({ limit: 1e4 }) });
|
|
2470
|
+
}
|
|
2471
|
+
setWritable(e) {
|
|
2472
|
+
this.writable = e, e || this.recoveryController?.abort();
|
|
2473
|
+
}
|
|
2474
|
+
async enqueue(e) {
|
|
2475
|
+
if (this.disposed || !this.writable) throw new b("cloud_read_only");
|
|
2476
|
+
let t = await this.outbox.enqueue(e, { reuseUnresolved: !0 });
|
|
2477
|
+
return await this.refresh(), t;
|
|
2478
|
+
}
|
|
2479
|
+
async recover() {
|
|
2480
|
+
if (this.disposed) return;
|
|
2481
|
+
if (this.work) return this.work;
|
|
2482
|
+
if (!this.writable) {
|
|
2483
|
+
await this.refresh();
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2486
|
+
this.update({
|
|
2487
|
+
recovering: !0,
|
|
2488
|
+
errorCode: null
|
|
2489
|
+
});
|
|
2490
|
+
let e = new AbortController();
|
|
2491
|
+
this.recoveryController = e;
|
|
2492
|
+
let t = () => e.abort();
|
|
2493
|
+
return this.controller.signal.addEventListener("abort", t, { once: !0 }), this.work = (async () => {
|
|
2494
|
+
try {
|
|
2495
|
+
await this.drainer.drain({
|
|
2496
|
+
signal: e.signal,
|
|
2497
|
+
maxOperations: 50,
|
|
2498
|
+
maxDurationMs: 3e4
|
|
2499
|
+
}), await this.refresh();
|
|
2500
|
+
} catch (e) {
|
|
2501
|
+
this.update({ errorCode: e instanceof b ? e.code : "outbox_unavailable" });
|
|
2502
|
+
} finally {
|
|
2503
|
+
this.controller.signal.removeEventListener("abort", t), this.recoveryController = void 0, this.update({ recovering: !1 }), this.work = void 0;
|
|
2504
|
+
}
|
|
2505
|
+
})(), this.work;
|
|
2506
|
+
}
|
|
2507
|
+
async submit(e) {
|
|
2508
|
+
let t = await this.enqueue(e);
|
|
2509
|
+
return await this.recover(), await this.outbox.get(t.operationId) ?? t;
|
|
2510
|
+
}
|
|
2511
|
+
dispose() {
|
|
2512
|
+
this.disposed = !0, this.controller.abort(), this.drainer.deactivate(), this.listeners.clear(), this.outbox.close().catch(() => void 0);
|
|
2513
|
+
}
|
|
2514
|
+
}, $ = {
|
|
2515
|
+
fileBytes: 20 * 1024 * 1024,
|
|
2516
|
+
totalBytes: 64 * 1024 * 1024,
|
|
2517
|
+
files: 4096,
|
|
2518
|
+
manifestBytes: 2 * 1024 * 1024
|
|
2519
|
+
}, dn = e.string().regex(/^sha256:[0-9a-f]{64}$/), fn = e.strictObject({
|
|
2520
|
+
materialId: e.string().regex(/^tm_[0-9a-f]{64}$/),
|
|
2521
|
+
manifestDigest: dn,
|
|
2522
|
+
state: e.enum([
|
|
2523
|
+
"pending",
|
|
2524
|
+
"ready",
|
|
2525
|
+
"expired"
|
|
2526
|
+
]),
|
|
2527
|
+
sizeBytes: e.number().int().min(0).max($.totalBytes),
|
|
2528
|
+
manifest: z
|
|
2529
|
+
}), pn = e.strictObject({
|
|
2530
|
+
materialId: e.string().regex(/^tm_[0-9a-f]{64}$/),
|
|
2531
|
+
state: e.literal("pending"),
|
|
2532
|
+
missingBlobs: e.array(dn).max($.files)
|
|
2533
|
+
}), mn = e.strictObject({
|
|
2534
|
+
digest: dn,
|
|
2535
|
+
sizeBytes: e.number().int().min(0).max($.fileBytes),
|
|
2536
|
+
state: e.literal("ready")
|
|
2537
|
+
});
|
|
2538
|
+
async function hn(e, t, n) {
|
|
2539
|
+
let r = fn.parse(e), i = await at(r.manifest);
|
|
2540
|
+
if (i !== r.manifestDigest || r.materialId !== `tm_${(await y([t.authorityId, i])).slice(7)}` || r.sizeBytes !== r.manifest.entries.reduce((e, t) => e + t.sizeBytes, 0) || n && i !== await at(n)) throw new m("material_identity_conflict", "材料回执与当前身份或所选文件不一致。");
|
|
2541
|
+
return r;
|
|
2542
|
+
}
|
|
2543
|
+
var gn = () => ({
|
|
2544
|
+
state: "idle",
|
|
2545
|
+
files: [],
|
|
2546
|
+
completed: 0,
|
|
2547
|
+
material: null,
|
|
2548
|
+
error: ""
|
|
2549
|
+
}), _n = (e) => [
|
|
2550
|
+
"hashing",
|
|
2551
|
+
"creating",
|
|
2552
|
+
"uploading",
|
|
2553
|
+
"verifying"
|
|
2554
|
+
].includes(e), vn = () => new DOMException("Aborted", "AbortError"), yn = class {
|
|
2555
|
+
snapshot = gn();
|
|
2556
|
+
selection = null;
|
|
2557
|
+
listeners = /* @__PURE__ */ new Set();
|
|
2558
|
+
port;
|
|
2559
|
+
scope;
|
|
2560
|
+
constructor(e, t) {
|
|
2561
|
+
this.port = e, this.scope = t;
|
|
2562
|
+
}
|
|
2563
|
+
getSnapshot = () => this.snapshot;
|
|
2564
|
+
subscribe = (e) => (this.listeners.add(e), () => {
|
|
2565
|
+
this.listeners.delete(e);
|
|
2566
|
+
});
|
|
2567
|
+
update(e) {
|
|
2568
|
+
this.snapshot = {
|
|
2569
|
+
...this.snapshot,
|
|
2570
|
+
...e
|
|
2571
|
+
};
|
|
2572
|
+
for (let e of this.listeners) e();
|
|
2573
|
+
}
|
|
2574
|
+
clear() {
|
|
2575
|
+
let e = this.selection;
|
|
2576
|
+
this.selection = null, e?.controller?.abort(), this.snapshot = gn();
|
|
2577
|
+
for (let e of this.listeners) e();
|
|
2578
|
+
}
|
|
2579
|
+
dispose() {
|
|
2580
|
+
this.clear(), this.listeners.clear();
|
|
2581
|
+
}
|
|
2582
|
+
cancel() {
|
|
2583
|
+
this.selection?.controller?.abort(), this.selection && _n(this.snapshot.state) && this.update({
|
|
2584
|
+
state: "cancelled",
|
|
2585
|
+
material: null,
|
|
2586
|
+
error: "上传已取消。重试或移除材料后再开始协作。"
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
async select(e) {
|
|
2590
|
+
this.clear();
|
|
2591
|
+
let t = Array.from(e);
|
|
2592
|
+
if (!t.length) return;
|
|
2593
|
+
let n = {
|
|
2594
|
+
files: t,
|
|
2595
|
+
createKey: `material-create:${crypto.randomUUID()}`,
|
|
2596
|
+
finalizeKey: `material-finalize:${crypto.randomUUID()}`,
|
|
2597
|
+
controller: null
|
|
2598
|
+
};
|
|
2599
|
+
this.selection = n, this.update({ files: t.map((e) => ({
|
|
2600
|
+
name: e.name,
|
|
2601
|
+
size: e.size
|
|
2602
|
+
})) }), await this.run(n);
|
|
2603
|
+
}
|
|
2604
|
+
async retry() {
|
|
2605
|
+
this.selection && !_n(this.snapshot.state) && await this.run(this.selection);
|
|
2606
|
+
}
|
|
2607
|
+
async run(t) {
|
|
2608
|
+
let n = new AbortController();
|
|
2609
|
+
t.controller = n;
|
|
2610
|
+
let r = () => {
|
|
2611
|
+
if (n.signal.aborted || this.selection !== t || t.controller !== n) throw vn();
|
|
2612
|
+
}, i = setTimeout(() => n.abort(), 10 * 6e4);
|
|
2613
|
+
this.update({
|
|
2614
|
+
state: "hashing",
|
|
2615
|
+
completed: 0,
|
|
2616
|
+
error: "",
|
|
2617
|
+
material: null
|
|
2618
|
+
});
|
|
2619
|
+
try {
|
|
2620
|
+
if (t.files.length > $.files) throw Error("最多选择 4096 个文件。");
|
|
2621
|
+
if (t.files.some((e) => e.size > $.fileBytes)) throw Error("单个文件不能超过 20 MiB。");
|
|
2622
|
+
if (t.files.reduce((e, t) => e + t.size, 0) > $.totalBytes) throw Error("材料总大小不能超过 64 MiB。");
|
|
2623
|
+
let e = t.files.map((e) => ({
|
|
2624
|
+
path: e.name,
|
|
2625
|
+
sizeBytes: e.size,
|
|
2626
|
+
mediaType: e.type || "application/octet-stream",
|
|
2627
|
+
digest: `sha256:${"0".repeat(64)}`
|
|
2628
|
+
}));
|
|
2629
|
+
z.parse({
|
|
2630
|
+
kind: "files",
|
|
2631
|
+
entries: e
|
|
2632
|
+
});
|
|
2633
|
+
for (let n = 0; n < t.files.length; n++) {
|
|
2634
|
+
r();
|
|
2635
|
+
let i = await t.files[n].arrayBuffer();
|
|
2636
|
+
r();
|
|
2637
|
+
let a = await crypto.subtle.digest("SHA-256", i);
|
|
2638
|
+
r(), e[n].digest = `sha256:${Array.from(new Uint8Array(a), (e) => e.toString(16).padStart(2, "0")).join("")}`, this.update({ completed: n + 1 });
|
|
2639
|
+
}
|
|
2640
|
+
let i = it.parse({
|
|
2641
|
+
kind: "files",
|
|
2642
|
+
entries: e,
|
|
2643
|
+
idempotencyKey: t.createKey
|
|
2644
|
+
});
|
|
2645
|
+
if (new TextEncoder().encode(v(i)).byteLength > $.manifestBytes) throw Error("文件清单超过 2 MiB,请减少文件数量或缩短文件名。");
|
|
2646
|
+
let a = z.parse({
|
|
2647
|
+
kind: i.kind,
|
|
2648
|
+
entries: i.entries
|
|
2649
|
+
});
|
|
2650
|
+
this.update({
|
|
2651
|
+
state: "creating",
|
|
2652
|
+
completed: 0
|
|
2653
|
+
});
|
|
2654
|
+
let o = await this.port.createMaterial(this.scope, i, n.signal);
|
|
2655
|
+
if (r(), o = await hn(o, this.scope, a), r(), o.state === "expired") throw Error("材料已过期,请重新选择文件。");
|
|
2656
|
+
if (o.state !== "ready") {
|
|
2657
|
+
let i = /* @__PURE__ */ new Set();
|
|
2658
|
+
for (let a = 0; a < e.length; a++) r(), this.update({
|
|
2659
|
+
state: "uploading",
|
|
2660
|
+
completed: a
|
|
2661
|
+
}), i.has(e[a].digest) || (await this.port.uploadMaterialBlob(this.scope, o, e[a], t.files[a], n.signal), r(), i.add(e[a].digest)), this.update({ completed: a + 1 });
|
|
2662
|
+
this.update({ state: "verifying" }), o = await this.port.finalizeMaterial(this.scope, o, t.finalizeKey, n.signal), r(), o = await hn(o, this.scope, a), r();
|
|
2663
|
+
}
|
|
2664
|
+
if (o.state !== "ready") throw Error("服务端尚未验证全部文件,请重试原上传。");
|
|
2665
|
+
this.update({
|
|
2666
|
+
state: "ready",
|
|
2667
|
+
material: o
|
|
2668
|
+
});
|
|
2669
|
+
} catch (r) {
|
|
2670
|
+
if (this.selection !== t || t.controller !== n) return;
|
|
2671
|
+
n.signal.aborted ? this.update({
|
|
2672
|
+
state: "cancelled",
|
|
2673
|
+
material: null,
|
|
2674
|
+
error: "上传已取消或超时。重试或移除材料后再开始协作。"
|
|
2675
|
+
}) : this.update({
|
|
2676
|
+
state: "failed",
|
|
2677
|
+
material: null,
|
|
2678
|
+
error: r instanceof m ? `材料上传未完成(${r.code}),请重试原上传。` : r instanceof e.ZodError ? "文件名、类型或清单无效;同名文件不能同时上传。" : r instanceof Error ? r.message : "材料上传失败,请重试。"
|
|
2679
|
+
});
|
|
2680
|
+
} finally {
|
|
2681
|
+
clearTimeout(i), t.controller === n && (t.controller = null);
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
};
|
|
2685
|
+
//#endregion
|
|
2686
|
+
export { Re as $, Pt as A, pe as At, wt as B, ce as Bt, zt as C, xe as Ct, Qt as D, ge as Dt, Vt as E, _e as Et, Ne as F, fe as Ft, $e as G, re as Gt, St as H, s as Ht, E as I, ue as It, Ue as J, t as Jt, ft as K, oe as Kt, xt as L, u as Lt, X as M, h as Mt, J as N, se as Nt, Zt as O, m as Ot, It as P, de as Pt, gt as Q, yt as R, le as Rt, Gt as S, Ce as St, Nt as T, ve as Tt, ht as U, p as Ut, bt as V, d as Vt, Ct as W, f as Wt, ot as X, Tt as Y, ze as Z, $t as _, b as _t, hn as a, at, en as b, we as bt, on as c, Ze as ct, nn as d, mt as dt, st as et, an as f, pt as ft, Mt as g, je as gt, Ht as h, Me as ht, _n as i, tt as it, Y as j, me as jt, Z as k, te as kt, Et as l, ut as lt, Yt as m, Be as mt, mn as n, He as nt, un as o, z as ot, rn as p, vt as pt, Ge as q, he as qt, pn as r, it as rt, ln as s, Qe as st, yn as t, lt as tt, B as u, dt as ut, Wt as v, Se as vt, Ft as w, be as wt, At as x, y as xt, kt as y, v as yt, _t as z, c as zt };
|