@kingsoftcloud/ksadk-web 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-HLpbjOnQ.js → AttachmentPreview-lufx89xJ.js} +174 -174
- package/dist-lib/{ConnectedComposer-CeWPgOn2.js → ConnectedComposer-Dd8ZFhfL.js} +214 -213
- package/dist-lib/{ConnectedMessageList-D3HWHCh2.js → ConnectedMessageList-CzTOJbZU.js} +582 -510
- package/dist-lib/{InteractionSchemaForm-Du9NT4E8.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-BlIAT-PA.js → cloudMaterials-D75jTrkQ.js} +823 -628
- 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/CloudTeamWorkspace.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/cloudExtendedContracts.d.ts +48 -48
- package/dist-lib/core/teams/cloudExtendedContracts.d.ts.map +1 -1
- package/dist-lib/core/teams/cloudMaterials.d.ts +2 -2
- package/dist-lib/core/teams/cloudMaterials.d.ts.map +1 -1
- 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/{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 +922 -922
- package/dist-lib/teams.js +363 -555
- 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 +3 -2
- 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
|
@@ -291,7 +291,7 @@ var m = class extends Error {
|
|
|
291
291
|
super(t), this.name = "TeamsError", this.code = e, this.status = n;
|
|
292
292
|
}
|
|
293
293
|
};
|
|
294
|
-
function
|
|
294
|
+
function h(e) {
|
|
295
295
|
let t = le.safeParse(e);
|
|
296
296
|
if (!t.success) throw new m("contract_mismatch", "群快照格式不兼容,请刷新或更新客户端。");
|
|
297
297
|
let n = t.data, r = n.group.groupId;
|
|
@@ -312,12 +312,12 @@ function me(e) {
|
|
|
312
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
313
|
return n;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function me(e) {
|
|
316
316
|
let t = ue.safeParse(e);
|
|
317
317
|
if (!t.success) throw new m("contract_mismatch", "群事件格式不兼容。");
|
|
318
318
|
return t.data;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function he(e) {
|
|
321
321
|
if (!e.name.trim()) throw new m("invalid_name", "请填写群组名称。");
|
|
322
322
|
if (!e.members.length || e.members.length > 8) throw new m("invalid_members", "请选择 1–8 位成员。");
|
|
323
323
|
if (new Set(e.members.map((e) => e.memberId)).size !== e.members.length) throw new m("duplicate_member", "成员不能重复。");
|
|
@@ -325,7 +325,7 @@ function ge(e) {
|
|
|
325
325
|
}
|
|
326
326
|
//#endregion
|
|
327
327
|
//#region src/core/teams/reducer.ts
|
|
328
|
-
function
|
|
328
|
+
function ge(e) {
|
|
329
329
|
return JSON.stringify([
|
|
330
330
|
e.authorityRef,
|
|
331
331
|
e.groupId,
|
|
@@ -336,29 +336,29 @@ function _e(e) {
|
|
|
336
336
|
e.runId
|
|
337
337
|
]);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
return JSON.stringify([
|
|
339
|
+
function _e(e) {
|
|
340
|
+
return JSON.stringify([ge(e), e.interactionId]);
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function g(e, t, n) {
|
|
343
343
|
let r = e.findIndex((e) => n(e) === n(t));
|
|
344
344
|
return r >= 0 && e[r].revision >= t.revision ? e : r < 0 ? [...e, t] : e.map((e, n) => n === r ? t : e);
|
|
345
345
|
}
|
|
346
|
-
var
|
|
346
|
+
var ve = class {
|
|
347
347
|
value;
|
|
348
348
|
seenIds = /* @__PURE__ */ new Set();
|
|
349
349
|
constructor(e) {
|
|
350
|
-
this.value =
|
|
350
|
+
this.value = h(e);
|
|
351
351
|
}
|
|
352
352
|
snapshot() {
|
|
353
353
|
return this.value;
|
|
354
354
|
}
|
|
355
355
|
replace(e) {
|
|
356
|
-
let t =
|
|
356
|
+
let t = h(e);
|
|
357
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
358
|
return t.watermark < this.value.watermark || t.group.revision < this.value.group.revision ? !1 : (this.value = t, this.seenIds.clear(), !0);
|
|
359
359
|
}
|
|
360
360
|
apply(e) {
|
|
361
|
-
let t =
|
|
361
|
+
let t = me(e), n = this.value;
|
|
362
362
|
if (t.groupId !== n.group.groupId) throw new m("scope_mismatch", "事件不属于当前群。");
|
|
363
363
|
if (t.groupSeq <= n.watermark) return !1;
|
|
364
364
|
if (t.groupSeq !== n.watermark + 1 || this.seenIds.has(t.eventId)) throw new m("reset_required", "群事件存在缺口,需要重新读取快照。");
|
|
@@ -389,23 +389,23 @@ var ye = class {
|
|
|
389
389
|
break;
|
|
390
390
|
}
|
|
391
391
|
case "run_member.updated":
|
|
392
|
-
r.runMembers =
|
|
392
|
+
r.runMembers = g(n.runMembers || [], i(f, t.payload.runMember), (e) => e.runMemberId);
|
|
393
393
|
break;
|
|
394
394
|
case "member.updated":
|
|
395
|
-
r.members =
|
|
395
|
+
r.members = g(n.members, i(d, t.payload.member), (e) => e.memberId);
|
|
396
396
|
break;
|
|
397
397
|
case "message.created":
|
|
398
398
|
case "message.updated":
|
|
399
|
-
r.messages =
|
|
399
|
+
r.messages = g(n.messages, i(p, t.payload.message), (e) => e.messageId);
|
|
400
400
|
break;
|
|
401
401
|
case "task.updated":
|
|
402
|
-
r.tasks =
|
|
402
|
+
r.tasks = g(n.tasks, i(re, t.payload.task), (e) => e.taskId);
|
|
403
403
|
break;
|
|
404
404
|
case "team_run.updated":
|
|
405
|
-
r.teamRuns =
|
|
405
|
+
r.teamRuns = g(n.teamRuns, i(oe, t.payload.teamRun), (e) => e.teamRunId);
|
|
406
406
|
break;
|
|
407
407
|
case "delivery.updated":
|
|
408
|
-
r.deliveries =
|
|
408
|
+
r.deliveries = g(n.deliveries, i(se, t.payload.delivery), (e) => e.deliveryId);
|
|
409
409
|
break;
|
|
410
410
|
case "artifact.updated": {
|
|
411
411
|
let e = i(te, t.payload.artifact);
|
|
@@ -413,18 +413,213 @@ var ye = class {
|
|
|
413
413
|
break;
|
|
414
414
|
}
|
|
415
415
|
case "interaction.updated":
|
|
416
|
-
r.interactions =
|
|
416
|
+
r.interactions = g(n.interactions, i(ce, t.payload.interaction), (e) => _e(e.ref));
|
|
417
417
|
break;
|
|
418
418
|
default: break;
|
|
419
419
|
}
|
|
420
420
|
return this.seenIds.add(t.eventId), this.seenIds.size > 2048 && this.seenIds.delete(this.seenIds.values().next().value), this.value = r, !0;
|
|
421
421
|
}
|
|
422
|
-
}
|
|
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 {
|
|
423
618
|
constructor() {
|
|
424
619
|
super("invalid_teams_canonical_json"), this.name = "TeamsCanonicalJsonError";
|
|
425
620
|
}
|
|
426
621
|
};
|
|
427
|
-
function
|
|
622
|
+
function Ce(e) {
|
|
428
623
|
for (let t = 0; t < e.length; t++) {
|
|
429
624
|
let n = e.charCodeAt(t);
|
|
430
625
|
if (n >= 55296 && n <= 56319) {
|
|
@@ -434,13 +629,13 @@ function xe(e) {
|
|
|
434
629
|
}
|
|
435
630
|
return !0;
|
|
436
631
|
}
|
|
437
|
-
function
|
|
632
|
+
function v(e) {
|
|
438
633
|
let t = /* @__PURE__ */ new Set(), n = () => {
|
|
439
|
-
throw new
|
|
634
|
+
throw new Se();
|
|
440
635
|
}, r = (e, i) => {
|
|
441
636
|
if (i > 50) return n();
|
|
442
637
|
if (e === null || typeof e == "boolean") return JSON.stringify(e);
|
|
443
|
-
if (typeof e == "string") return
|
|
638
|
+
if (typeof e == "string") return Ce(e) ? JSON.stringify(e) : n();
|
|
444
639
|
if (typeof e == "number") return !Number.isFinite(e) || Number.isInteger(e) && !Number.isSafeInteger(e) ? n() : JSON.stringify(e);
|
|
445
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();
|
|
446
641
|
t.add(e);
|
|
@@ -458,7 +653,7 @@ function g(e) {
|
|
|
458
653
|
let t = Object.keys(e).sort();
|
|
459
654
|
if (Object.getOwnPropertyNames(e).length !== t.length) return n();
|
|
460
655
|
a = `{${t.map((t) => {
|
|
461
|
-
if (!
|
|
656
|
+
if (!Ce(t)) return n();
|
|
462
657
|
let a = Object.getOwnPropertyDescriptor(e, t);
|
|
463
658
|
return !a || !("value" in a) ? n() : `${JSON.stringify(t)}:${r(a.value, i + 1)}`;
|
|
464
659
|
}).join(",")}}`;
|
|
@@ -467,28 +662,28 @@ function g(e) {
|
|
|
467
662
|
};
|
|
468
663
|
return r(e, 0);
|
|
469
664
|
}
|
|
470
|
-
async function
|
|
471
|
-
let n = await t.digest("SHA-256", new TextEncoder().encode(
|
|
665
|
+
async function y(e, t = globalThis.crypto.subtle) {
|
|
666
|
+
let n = await t.digest("SHA-256", new TextEncoder().encode(v(e)));
|
|
472
667
|
return `sha256:${Array.from(new Uint8Array(n), (e) => e.toString(16).padStart(2, "0")).join("")}`;
|
|
473
668
|
}
|
|
474
|
-
function
|
|
669
|
+
function we(e, t) {
|
|
475
670
|
let n = Array.from(e, (e) => e.codePointAt(0)), r = Array.from(t, (e) => e.codePointAt(0));
|
|
476
671
|
for (let e = 0; e < Math.min(n.length, r.length); e++) if (n[e] !== r[e]) return n[e] - r[e];
|
|
477
672
|
return n.length - r.length;
|
|
478
673
|
}
|
|
479
674
|
//#endregion
|
|
480
675
|
//#region src/core/teams/operationOutbox.ts
|
|
481
|
-
var
|
|
676
|
+
var b = class extends Error {
|
|
482
677
|
code;
|
|
483
678
|
constructor(e) {
|
|
484
679
|
super(e), this.name = "TeamsOperationOutboxError", this.code = e;
|
|
485
680
|
}
|
|
486
|
-
},
|
|
681
|
+
}, Te = "teams_operations", Ee = [
|
|
487
682
|
"scope.origin",
|
|
488
683
|
"scope.ownerScopeRef",
|
|
489
684
|
"scope.authorityId",
|
|
490
685
|
"scope.groupId"
|
|
491
|
-
],
|
|
686
|
+
], De = new Set(["confirmed", "rejected"]), Oe = new Set([
|
|
492
687
|
"authorization",
|
|
493
688
|
"proxyauthorization",
|
|
494
689
|
"cookie",
|
|
@@ -513,42 +708,42 @@ var v = class extends Error {
|
|
|
513
708
|
"runtimetoken",
|
|
514
709
|
"signedurl",
|
|
515
710
|
"presignedurl"
|
|
516
|
-
]),
|
|
711
|
+
]), ke = new Set([
|
|
517
712
|
"requestId",
|
|
518
713
|
"idempotencyKey",
|
|
519
714
|
"transportTimestamp",
|
|
520
715
|
"transportTime"
|
|
521
716
|
]);
|
|
522
|
-
function
|
|
523
|
-
throw new
|
|
717
|
+
function x(e) {
|
|
718
|
+
throw new b(e);
|
|
524
719
|
}
|
|
525
|
-
function
|
|
526
|
-
return (typeof e != "string" || !n && !e.trim() || e.length > t || Array.from(e).some((e) => e.charCodeAt(0) < 32)) &&
|
|
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;
|
|
527
722
|
}
|
|
528
|
-
function
|
|
529
|
-
(!e || Array.isArray(e) || typeof e != "object") &&
|
|
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");
|
|
530
725
|
let r;
|
|
531
726
|
try {
|
|
532
|
-
r =
|
|
727
|
+
r = v(e);
|
|
533
728
|
} catch {
|
|
534
|
-
|
|
729
|
+
x("invalid_business_payload");
|
|
535
730
|
}
|
|
536
|
-
new TextEncoder().encode(r).byteLength > t &&
|
|
731
|
+
new TextEncoder().encode(r).byteLength > t && x("payload_too_large");
|
|
537
732
|
let i = (e) => {
|
|
538
733
|
if (Array.isArray(e)) e.forEach(i);
|
|
539
|
-
else if (e && typeof e == "object") for (let [t, n] of Object.entries(e))
|
|
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);
|
|
540
735
|
};
|
|
541
736
|
return i(e), {
|
|
542
737
|
payload: JSON.parse(r),
|
|
543
738
|
json: r
|
|
544
739
|
};
|
|
545
740
|
}
|
|
546
|
-
function
|
|
741
|
+
function C(e) {
|
|
547
742
|
return new Promise((t, n) => {
|
|
548
743
|
e.onsuccess = () => t(e.result), e.onerror = () => n(e.error);
|
|
549
744
|
});
|
|
550
745
|
}
|
|
551
|
-
function
|
|
746
|
+
function w(e) {
|
|
552
747
|
return [
|
|
553
748
|
e.origin,
|
|
554
749
|
e.ownerScopeRef,
|
|
@@ -556,10 +751,10 @@ function S(e) {
|
|
|
556
751
|
e.groupId
|
|
557
752
|
];
|
|
558
753
|
}
|
|
559
|
-
function
|
|
560
|
-
return (!Number.isSafeInteger(e) || e < t || e > n) &&
|
|
754
|
+
function T(e, t, n) {
|
|
755
|
+
return (!Number.isSafeInteger(e) || e < t || e > n) && x("invalid_outbox_limit"), e;
|
|
561
756
|
}
|
|
562
|
-
var
|
|
757
|
+
var je = class {
|
|
563
758
|
scope;
|
|
564
759
|
factory;
|
|
565
760
|
cryptography;
|
|
@@ -574,22 +769,22 @@ var ke = class {
|
|
|
574
769
|
try {
|
|
575
770
|
a = new URL(t);
|
|
576
771
|
} catch {
|
|
577
|
-
|
|
772
|
+
x("invalid_operation_origin");
|
|
578
773
|
}
|
|
579
|
-
(a.origin !== t || !["http:", "https:"].includes(a.protocol)) &&
|
|
774
|
+
(a.origin !== t || !["http:", "https:"].includes(a.protocol)) && x("invalid_operation_origin"), this.scope = Object.freeze({
|
|
580
775
|
origin: t,
|
|
581
|
-
ownerScopeRef:
|
|
582
|
-
authorityId:
|
|
583
|
-
groupId:
|
|
584
|
-
}), this.factory = e.indexedDB ?? globalThis.indexedDB, this.cryptography = e.crypto ?? globalThis.crypto, (!this.factory || !this.cryptography?.subtle || !this.cryptography.randomUUID) &&
|
|
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);
|
|
585
780
|
}
|
|
586
781
|
async open() {
|
|
587
|
-
return this.closed &&
|
|
782
|
+
return this.closed && x("outbox_closed"), this.database ||= new Promise((e, t) => {
|
|
588
783
|
let n = this.factory.open(this.databaseName, 1);
|
|
589
784
|
n.onupgradeneeded = () => {
|
|
590
|
-
let e = n.result.createObjectStore(
|
|
591
|
-
e.createIndex("scope",
|
|
592
|
-
...
|
|
785
|
+
let e = n.result.createObjectStore(Te, { keyPath: [...Ee, "operationId"] });
|
|
786
|
+
e.createIndex("scope", Ee), e.createIndex("scope_key", [
|
|
787
|
+
...Ee,
|
|
593
788
|
"operation",
|
|
594
789
|
"idempotencyKey"
|
|
595
790
|
], { unique: !0 });
|
|
@@ -597,19 +792,19 @@ var ke = class {
|
|
|
597
792
|
n.result.onversionchange = () => {
|
|
598
793
|
n.result.close(), this.closed = !0;
|
|
599
794
|
}, e(n.result);
|
|
600
|
-
}, n.onerror = () => t(new
|
|
795
|
+
}, n.onerror = () => t(new b("outbox_unavailable")), n.onblocked = () => t(new b("outbox_upgrade_blocked"));
|
|
601
796
|
}), this.database;
|
|
602
797
|
}
|
|
603
798
|
key(e) {
|
|
604
|
-
return [...
|
|
799
|
+
return [...w(this.scope), S(e)];
|
|
605
800
|
}
|
|
606
801
|
async transaction(e, t) {
|
|
607
|
-
let n = (await this.open()).transaction(
|
|
608
|
-
n.oncomplete = () => e(), n.onabort = () => t(n.error ?? new
|
|
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 = () => {};
|
|
609
804
|
});
|
|
610
805
|
r.catch(() => void 0);
|
|
611
806
|
try {
|
|
612
|
-
let e = await t(n.objectStore(
|
|
807
|
+
let e = await t(n.objectStore(Te));
|
|
613
808
|
return await r, e;
|
|
614
809
|
} catch (e) {
|
|
615
810
|
try {
|
|
@@ -619,28 +814,28 @@ var ke = class {
|
|
|
619
814
|
}
|
|
620
815
|
}
|
|
621
816
|
async digest(e, t) {
|
|
622
|
-
return
|
|
817
|
+
return y({
|
|
623
818
|
operation: e,
|
|
624
819
|
payload: JSON.parse(t)
|
|
625
820
|
}, this.cryptography.subtle);
|
|
626
821
|
}
|
|
627
822
|
async enqueue(e, t = {}) {
|
|
628
|
-
let n =
|
|
629
|
-
(!/^[a-zA-Z0-9_.:/-]+$/.test(r) || r.includes("://")) &&
|
|
630
|
-
let i =
|
|
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);
|
|
631
826
|
return this.transaction("readwrite", async (o) => {
|
|
632
|
-
let c = await
|
|
633
|
-
if (c) return (c.payloadDigest !== s || c.operation !== r || e.idempotencyKey !== void 0 && c.idempotencyKey !== i) &&
|
|
634
|
-
let l = await
|
|
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));
|
|
635
830
|
if (u) return u;
|
|
636
|
-
await
|
|
637
|
-
...
|
|
831
|
+
await C(o.index("scope_key").get([
|
|
832
|
+
...w(this.scope),
|
|
638
833
|
r,
|
|
639
834
|
i
|
|
640
|
-
])) &&
|
|
641
|
-
let d = l.filter((e) =>
|
|
642
|
-
for (; f >= this.maxEntries && d.length;) await
|
|
643
|
-
f >= this.maxEntries &&
|
|
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");
|
|
644
839
|
let ee = this.now(), p = {
|
|
645
840
|
scope: { ...this.scope },
|
|
646
841
|
operationId: n,
|
|
@@ -654,23 +849,23 @@ var ke = class {
|
|
|
654
849
|
revision: 1,
|
|
655
850
|
attempts: 0
|
|
656
851
|
};
|
|
657
|
-
return await
|
|
852
|
+
return await C(o.add(p)), p;
|
|
658
853
|
});
|
|
659
854
|
}
|
|
660
855
|
async get(e) {
|
|
661
|
-
return this.transaction("readonly", async (t) => await
|
|
856
|
+
return this.transaction("readonly", async (t) => await C(t.get(this.key(e))));
|
|
662
857
|
}
|
|
663
858
|
async list(e = {}) {
|
|
664
|
-
let t =
|
|
665
|
-
return this.transaction("readonly", async (n) => (await
|
|
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));
|
|
666
861
|
}
|
|
667
862
|
async updateDraft(e, t, n) {
|
|
668
863
|
let r = await this.get(e);
|
|
669
|
-
r ||
|
|
670
|
-
let { payload: i, json: a } =
|
|
864
|
+
r || x("operation_not_found");
|
|
865
|
+
let { payload: i, json: a } = Ae(n, this.maxPayloadBytes), o = await this.digest(r.operation, a);
|
|
671
866
|
return this.transaction("readwrite", async (n) => {
|
|
672
|
-
let r = await
|
|
673
|
-
r ||
|
|
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");
|
|
674
869
|
let a = {
|
|
675
870
|
...r,
|
|
676
871
|
payload: i,
|
|
@@ -678,14 +873,14 @@ var ke = class {
|
|
|
678
873
|
revision: r.revision + 1,
|
|
679
874
|
updatedAt: this.now()
|
|
680
875
|
};
|
|
681
|
-
return await
|
|
876
|
+
return await C(n.put(a)), a;
|
|
682
877
|
});
|
|
683
878
|
}
|
|
684
879
|
async claimNext(e, t, n = /* @__PURE__ */ new Set()) {
|
|
685
|
-
|
|
880
|
+
S(e), T(t, 100, 12e4);
|
|
686
881
|
let r = this.cryptography.randomUUID();
|
|
687
882
|
return this.transaction("readwrite", async (i) => {
|
|
688
|
-
let a = this.now(), o = (await
|
|
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];
|
|
689
884
|
if (!o) return;
|
|
690
885
|
let s = {
|
|
691
886
|
...o,
|
|
@@ -697,16 +892,16 @@ var ke = class {
|
|
|
697
892
|
revision: o.revision + 1,
|
|
698
893
|
updatedAt: a
|
|
699
894
|
};
|
|
700
|
-
return await
|
|
895
|
+
return await C(i.put(s)), s;
|
|
701
896
|
});
|
|
702
897
|
}
|
|
703
898
|
owns(e, t) {
|
|
704
|
-
return !!(e &&
|
|
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());
|
|
705
900
|
}
|
|
706
901
|
async renew(e, t) {
|
|
707
|
-
return
|
|
708
|
-
let r = await
|
|
709
|
-
return this.owns(r, e) ? (await
|
|
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({
|
|
710
905
|
...r,
|
|
711
906
|
leaseExpiresAt: this.now() + t,
|
|
712
907
|
updatedAt: this.now()
|
|
@@ -719,10 +914,10 @@ var ke = class {
|
|
|
719
914
|
"rejected",
|
|
720
915
|
"uncertain",
|
|
721
916
|
"pending"
|
|
722
|
-
].includes(t.status) ||
|
|
723
|
-
let r = t.serverOperationId === void 0 ? void 0 :
|
|
724
|
-
return a !== void 0 && !/^[a-z][a-z0-9_]{0,99}$/.test(a) &&
|
|
725
|
-
let o = await
|
|
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)));
|
|
726
921
|
if (!this.owns(o, e)) return !1;
|
|
727
922
|
let s = {
|
|
728
923
|
...o,
|
|
@@ -730,27 +925,27 @@ var ke = class {
|
|
|
730
925
|
updatedAt: this.now(),
|
|
731
926
|
revision: o.revision + 1
|
|
732
927
|
};
|
|
733
|
-
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
|
|
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;
|
|
734
929
|
});
|
|
735
930
|
}
|
|
736
931
|
async close() {
|
|
737
932
|
this.closed = !0, this.database && (await this.database).close();
|
|
738
933
|
}
|
|
739
|
-
},
|
|
934
|
+
}, Me = class {
|
|
740
935
|
outbox;
|
|
741
936
|
transport;
|
|
742
937
|
tabId;
|
|
743
938
|
active;
|
|
744
939
|
deactivated = !1;
|
|
745
940
|
constructor(e, t, n = globalThis.crypto.randomUUID()) {
|
|
746
|
-
this.outbox = e, this.transport = t, this.tabId =
|
|
941
|
+
this.outbox = e, this.transport = t, this.tabId = S(n);
|
|
747
942
|
}
|
|
748
943
|
deactivate() {
|
|
749
944
|
this.deactivated = !0, this.active?.abort();
|
|
750
945
|
}
|
|
751
946
|
async drain(e = {}) {
|
|
752
|
-
this.deactivated &&
|
|
753
|
-
let t =
|
|
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();
|
|
754
949
|
this.active = a;
|
|
755
950
|
let o = () => a.abort();
|
|
756
951
|
e.signal?.addEventListener("abort", o, { once: !0 }), e.signal?.aborted && o();
|
|
@@ -786,33 +981,33 @@ var ke = class {
|
|
|
786
981
|
}, Math.floor(n / 3));
|
|
787
982
|
try {
|
|
788
983
|
let t = await this.call((t) => this.transport.lookup(structuredClone(e), t), i.signal, r);
|
|
789
|
-
return t.status === "missing" && ((i.signal.aborted || !await this.outbox.renew(e, n)) &&
|
|
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;
|
|
790
985
|
} catch (n) {
|
|
791
|
-
let r = t.aborted ? "aborted" : n instanceof
|
|
986
|
+
let r = t.aborted ? "aborted" : n instanceof b && n.code === "operation_timeout" ? "timeout" : "transport_uncertain";
|
|
792
987
|
return await this.outbox.settle(e, { status: "uncertain" }, r) ? "uncertain" : void 0;
|
|
793
988
|
} finally {
|
|
794
989
|
clearInterval(s), t.removeEventListener("abort", a), i.abort();
|
|
795
990
|
}
|
|
796
991
|
}
|
|
797
992
|
async call(e, t, n) {
|
|
798
|
-
t.aborted &&
|
|
993
|
+
t.aborted && x("operation_aborted");
|
|
799
994
|
let r = new AbortController(), i = () => void 0, a, o = new Promise((e, o) => {
|
|
800
995
|
i = () => {
|
|
801
|
-
r.abort(), o(new
|
|
996
|
+
r.abort(), o(new b("operation_aborted"));
|
|
802
997
|
}, t.addEventListener("abort", i, { once: !0 }), a = setTimeout(() => {
|
|
803
|
-
r.abort(), o(new
|
|
998
|
+
r.abort(), o(new b("operation_timeout"));
|
|
804
999
|
}, n);
|
|
805
1000
|
});
|
|
806
1001
|
try {
|
|
807
|
-
return await Promise.race([Promise.resolve().then(() => (r.signal.aborted &&
|
|
1002
|
+
return await Promise.race([Promise.resolve().then(() => (r.signal.aborted && x("operation_aborted"), e(r.signal))), o]);
|
|
808
1003
|
} finally {
|
|
809
1004
|
clearTimeout(a), t.removeEventListener("abort", i), r.abort();
|
|
810
1005
|
}
|
|
811
1006
|
}
|
|
812
|
-
},
|
|
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) => {
|
|
813
1008
|
let r = Array.from(n).length;
|
|
814
1009
|
return r >= e && r <= t;
|
|
815
|
-
}, "Invalid text length"),
|
|
1010
|
+
}, "Invalid text length"), k = O(1, 256).refine((e) => !Array.from(e).some((e) => {
|
|
816
1011
|
let t = e.codePointAt(0);
|
|
817
1012
|
return t >= 9 && t <= 13 || t === 32 || t >= 8192 && t <= 8202 || [
|
|
818
1013
|
133,
|
|
@@ -824,63 +1019,63 @@ var ke = class {
|
|
|
824
1019
|
8287,
|
|
825
1020
|
12288
|
|
826
1021
|
].includes(t);
|
|
827
|
-
}), "Identifier contains whitespace"),
|
|
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) => {
|
|
828
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;
|
|
829
1024
|
let t = new Date(e);
|
|
830
1025
|
return Number.isFinite(t.getTime()) && t.toISOString() === e;
|
|
831
|
-
}, "Expected a valid UTC timestamp with millisecond precision"),
|
|
1026
|
+
}, "Expected a valid UTC timestamp with millisecond precision"), Le = e.lazy(() => e.union([
|
|
832
1027
|
e.null(),
|
|
833
1028
|
e.boolean(),
|
|
834
|
-
|
|
1029
|
+
D,
|
|
835
1030
|
e.number().refine((e) => Number.isFinite(e) && (!Number.isInteger(e) || Number.isSafeInteger(e))),
|
|
836
|
-
e.array(
|
|
837
|
-
e.record(
|
|
838
|
-
])),
|
|
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({
|
|
839
1034
|
kind: e.literal("node"),
|
|
840
|
-
nodeId:
|
|
841
|
-
nodeGeneration:
|
|
1035
|
+
nodeId: k,
|
|
1036
|
+
nodeGeneration: P
|
|
842
1037
|
}), e.strictObject({
|
|
843
1038
|
kind: e.literal("cloud_agent"),
|
|
844
|
-
agentId:
|
|
845
|
-
versionId:
|
|
846
|
-
runtimeId:
|
|
847
|
-
agentInstanceId:
|
|
848
|
-
})]),
|
|
849
|
-
authorityId:
|
|
850
|
-
groupId:
|
|
851
|
-
teamRunId:
|
|
852
|
-
memberId:
|
|
853
|
-
runMemberId:
|
|
854
|
-
taskId:
|
|
855
|
-
attemptId:
|
|
856
|
-
deliveryId:
|
|
857
|
-
bindingRef:
|
|
858
|
-
providerRef:
|
|
859
|
-
sessionId:
|
|
860
|
-
commandId:
|
|
861
|
-
idempotencyKey:
|
|
862
|
-
schedulerEpoch:
|
|
863
|
-
leaderEpoch:
|
|
864
|
-
dispatchEpoch:
|
|
865
|
-
attemptEpoch:
|
|
866
|
-
target:
|
|
867
|
-
bundleDigest:
|
|
868
|
-
contractDigest:
|
|
869
|
-
capabilitiesDigest:
|
|
870
|
-
nativeRunId:
|
|
871
|
-
}),
|
|
872
|
-
sessionId:
|
|
873
|
-
runId:
|
|
874
|
-
commandId:
|
|
875
|
-
terminalSeq:
|
|
876
|
-
terminalEventDigest:
|
|
877
|
-
resultDigest:
|
|
878
|
-
}),
|
|
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([
|
|
879
1074
|
"succeeded",
|
|
880
1075
|
"failed",
|
|
881
1076
|
"cancelled",
|
|
882
1077
|
"interrupted"
|
|
883
|
-
]),
|
|
1078
|
+
]), He = e.strictObject({
|
|
884
1079
|
status: e.enum([
|
|
885
1080
|
"missing",
|
|
886
1081
|
"accepted",
|
|
@@ -888,12 +1083,12 @@ var ke = class {
|
|
|
888
1083
|
"rejected",
|
|
889
1084
|
"uncertain"
|
|
890
1085
|
]),
|
|
891
|
-
commandId:
|
|
892
|
-
idempotencyKey:
|
|
893
|
-
payloadDigest:
|
|
894
|
-
storeIncarnation:
|
|
895
|
-
runId:
|
|
896
|
-
acceptedSeq:
|
|
1086
|
+
commandId: M,
|
|
1087
|
+
idempotencyKey: A,
|
|
1088
|
+
payloadDigest: j,
|
|
1089
|
+
storeIncarnation: k,
|
|
1090
|
+
runId: L,
|
|
1091
|
+
acceptedSeq: N.nullable().default(null),
|
|
897
1092
|
nativeStatus: e.enum([
|
|
898
1093
|
"queued",
|
|
899
1094
|
"running",
|
|
@@ -905,7 +1100,7 @@ var ke = class {
|
|
|
905
1100
|
"cancelled",
|
|
906
1101
|
"interrupted"
|
|
907
1102
|
]).nullable().default(null),
|
|
908
|
-
terminalEvidence:
|
|
1103
|
+
terminalEvidence: Be.nullable().default(null)
|
|
909
1104
|
}).superRefine((e, t) => {
|
|
910
1105
|
e.status === "missing" && [
|
|
911
1106
|
e.runId,
|
|
@@ -915,41 +1110,41 @@ var ke = class {
|
|
|
915
1110
|
].some((e) => e !== null) && t.addIssue({
|
|
916
1111
|
code: "custom",
|
|
917
1112
|
message: "Missing receipt cannot contain execution evidence"
|
|
918
|
-
}), e.terminalEvidence && (e.commandId !== e.terminalEvidence.commandId || e.runId !== e.terminalEvidence.runId || !
|
|
1113
|
+
}), e.terminalEvidence && (e.commandId !== e.terminalEvidence.commandId || e.runId !== e.terminalEvidence.runId || !Ve.has(e.nativeStatus ?? "")) && t.addIssue({
|
|
919
1114
|
code: "custom",
|
|
920
1115
|
message: "Terminal evidence must match the original command/run and terminal status"
|
|
921
1116
|
});
|
|
922
|
-
}),
|
|
923
|
-
eventId:
|
|
924
|
-
sessionId:
|
|
925
|
-
runId:
|
|
926
|
-
seq:
|
|
927
|
-
family:
|
|
928
|
-
type:
|
|
929
|
-
payload:
|
|
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,
|
|
930
1125
|
sourceRef: e.strictObject({
|
|
931
|
-
nativeRunId:
|
|
932
|
-
parentRunId:
|
|
933
|
-
nativeEventType:
|
|
1126
|
+
nativeRunId: L,
|
|
1127
|
+
parentRunId: L,
|
|
1128
|
+
nativeEventType: L
|
|
934
1129
|
})
|
|
935
1130
|
});
|
|
936
|
-
function
|
|
1131
|
+
function We(e, t) {
|
|
937
1132
|
try {
|
|
938
|
-
if (new TextEncoder().encode(
|
|
1133
|
+
if (new TextEncoder().encode(v(e)).byteLength <= Ie) return;
|
|
939
1134
|
} catch {}
|
|
940
1135
|
t.addIssue({
|
|
941
1136
|
code: "custom",
|
|
942
1137
|
message: "Report is not safe canonical JSON within one MiB"
|
|
943
1138
|
});
|
|
944
1139
|
}
|
|
945
|
-
var
|
|
946
|
-
sessionId:
|
|
947
|
-
storeIncarnation:
|
|
948
|
-
afterSeq:
|
|
949
|
-
nextSeq:
|
|
950
|
-
snapshotUpperSeq:
|
|
1140
|
+
var Ge = e.strictObject({
|
|
1141
|
+
sessionId: k,
|
|
1142
|
+
storeIncarnation: k,
|
|
1143
|
+
afterSeq: N,
|
|
1144
|
+
nextSeq: N,
|
|
1145
|
+
snapshotUpperSeq: N,
|
|
951
1146
|
hasMore: e.boolean(),
|
|
952
|
-
items: e.array(
|
|
1147
|
+
items: e.array(Ue).max(200)
|
|
953
1148
|
}).superRefine((e, t) => {
|
|
954
1149
|
(!(e.afterSeq <= e.nextSeq && e.nextSeq <= e.snapshotUpperSeq) || e.hasMore !== e.nextSeq < e.snapshotUpperSeq || e.hasMore && e.nextSeq === e.afterSeq) && t.addIssue({
|
|
955
1150
|
code: "custom",
|
|
@@ -960,27 +1155,27 @@ var Ue = e.strictObject({
|
|
|
960
1155
|
code: "custom",
|
|
961
1156
|
message: "Events must be unique and ordered in the declared session interval"
|
|
962
1157
|
}), n = i.seq, r.add(i.eventId);
|
|
963
|
-
|
|
964
|
-
}),
|
|
1158
|
+
We(e, t);
|
|
1159
|
+
}), Ke = e.strictObject({
|
|
965
1160
|
permitKind: e.enum(["execute", "recovery"]),
|
|
966
|
-
permit:
|
|
967
|
-
grantRevision:
|
|
968
|
-
}),
|
|
969
|
-
protocolVersion: e.literal(
|
|
970
|
-
nodeCommandId:
|
|
971
|
-
operationKey:
|
|
972
|
-
ref:
|
|
973
|
-
commandDigest:
|
|
974
|
-
issuedAt:
|
|
975
|
-
claimLeaseUntil:
|
|
976
|
-
authorization:
|
|
977
|
-
},
|
|
978
|
-
contextRef:
|
|
979
|
-
contextDigest:
|
|
980
|
-
materialManifestRef:
|
|
981
|
-
}),
|
|
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({
|
|
982
1177
|
schema_version: e.literal(1).optional(),
|
|
983
|
-
command_id:
|
|
1178
|
+
command_id: M,
|
|
984
1179
|
idempotency_key: e.string(),
|
|
985
1180
|
tenant_id: e.string(),
|
|
986
1181
|
agent_instance_id: e.string(),
|
|
@@ -1005,125 +1200,125 @@ var Ue = e.strictObject({
|
|
|
1005
1200
|
causation_id: e.string().nullable().optional(),
|
|
1006
1201
|
correlation_id: e.string().nullable().optional(),
|
|
1007
1202
|
payload: e.object({
|
|
1008
|
-
content:
|
|
1203
|
+
content: Le,
|
|
1009
1204
|
reply_to: e.string().nullable().optional(),
|
|
1010
|
-
execution_grant_id:
|
|
1011
|
-
execution_grant_attempt_epoch:
|
|
1012
|
-
execution_policy_ref:
|
|
1013
|
-
teams_context_ref:
|
|
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)
|
|
1014
1209
|
}).passthrough()
|
|
1015
|
-
}).passthrough(),
|
|
1016
|
-
command:
|
|
1017
|
-
payloadDigest:
|
|
1210
|
+
}).passthrough(), Ye = e.strictObject({
|
|
1211
|
+
command: I,
|
|
1212
|
+
payloadDigest: j
|
|
1018
1213
|
}).superRefine((e, t) => {
|
|
1019
|
-
|
|
1214
|
+
Je.safeParse(e.command).success || t.addIssue({
|
|
1020
1215
|
code: "custom",
|
|
1021
1216
|
message: "Teams submit requires an original governed native enqueue envelope"
|
|
1022
1217
|
});
|
|
1023
|
-
}),
|
|
1024
|
-
grantId:
|
|
1025
|
-
expectedRevision:
|
|
1218
|
+
}), Xe = e.strictObject({
|
|
1219
|
+
grantId: k,
|
|
1220
|
+
expectedRevision: P,
|
|
1026
1221
|
state: e.enum([
|
|
1027
1222
|
"active",
|
|
1028
1223
|
"suspended",
|
|
1029
1224
|
"revoked"
|
|
1030
1225
|
]),
|
|
1031
|
-
attemptEpoch:
|
|
1032
|
-
expiresAt:
|
|
1033
|
-
renewalId:
|
|
1034
|
-
controlId:
|
|
1226
|
+
attemptEpoch: P,
|
|
1227
|
+
expiresAt: F,
|
|
1228
|
+
renewalId: A.nullable().default(null),
|
|
1229
|
+
controlId: A.nullable().default(null)
|
|
1035
1230
|
}).superRefine((e, t) => {
|
|
1036
1231
|
(e.renewalId === null == (e.controlId === null) || e.renewalId !== null && e.state !== "active") && t.addIssue({
|
|
1037
1232
|
code: "custom",
|
|
1038
1233
|
message: "Exactly one control or active renewal identity is required"
|
|
1039
1234
|
});
|
|
1040
|
-
}),
|
|
1235
|
+
}), Ze = e.discriminatedUnion("operation", [
|
|
1041
1236
|
e.strictObject({
|
|
1042
|
-
...
|
|
1237
|
+
...R,
|
|
1043
1238
|
operation: e.literal("prepare"),
|
|
1044
1239
|
lane: e.literal("execution"),
|
|
1045
|
-
payload:
|
|
1240
|
+
payload: qe
|
|
1046
1241
|
}),
|
|
1047
1242
|
e.strictObject({
|
|
1048
|
-
...
|
|
1243
|
+
...R,
|
|
1049
1244
|
operation: e.literal("submit"),
|
|
1050
1245
|
lane: e.literal("execution"),
|
|
1051
|
-
payload:
|
|
1246
|
+
payload: Ye
|
|
1052
1247
|
}),
|
|
1053
1248
|
e.strictObject({
|
|
1054
|
-
...
|
|
1249
|
+
...R,
|
|
1055
1250
|
operation: e.literal("lookup"),
|
|
1056
1251
|
lane: e.literal("control"),
|
|
1057
1252
|
payload: e.strictObject({
|
|
1058
|
-
commandId:
|
|
1059
|
-
idempotencyKey:
|
|
1060
|
-
payloadDigest:
|
|
1061
|
-
storeIncarnation:
|
|
1253
|
+
commandId: M,
|
|
1254
|
+
idempotencyKey: A,
|
|
1255
|
+
payloadDigest: j,
|
|
1256
|
+
storeIncarnation: k
|
|
1062
1257
|
})
|
|
1063
1258
|
}),
|
|
1064
1259
|
e.strictObject({
|
|
1065
|
-
...
|
|
1260
|
+
...R,
|
|
1066
1261
|
operation: e.literal("set_grant"),
|
|
1067
1262
|
lane: e.literal("control"),
|
|
1068
|
-
payload:
|
|
1263
|
+
payload: Xe
|
|
1069
1264
|
}),
|
|
1070
1265
|
e.strictObject({
|
|
1071
|
-
...
|
|
1266
|
+
...R,
|
|
1072
1267
|
operation: e.literal("set_admission"),
|
|
1073
1268
|
lane: e.literal("control"),
|
|
1074
1269
|
payload: e.strictObject({
|
|
1075
|
-
grantId:
|
|
1076
|
-
expectedAdmissionRevision:
|
|
1270
|
+
grantId: k,
|
|
1271
|
+
expectedAdmissionRevision: P,
|
|
1077
1272
|
admissionAllowed: e.boolean(),
|
|
1078
|
-
attemptEpoch:
|
|
1079
|
-
controlId:
|
|
1273
|
+
attemptEpoch: P,
|
|
1274
|
+
controlId: A
|
|
1080
1275
|
})
|
|
1081
1276
|
}),
|
|
1082
1277
|
e.strictObject({
|
|
1083
|
-
...
|
|
1278
|
+
...R,
|
|
1084
1279
|
operation: e.literal("get_grant"),
|
|
1085
1280
|
lane: e.literal("control"),
|
|
1086
1281
|
payload: e.strictObject({
|
|
1087
|
-
grantId:
|
|
1088
|
-
renewalId:
|
|
1282
|
+
grantId: k,
|
|
1283
|
+
renewalId: A.nullable().default(null)
|
|
1089
1284
|
})
|
|
1090
1285
|
}),
|
|
1091
1286
|
e.strictObject({
|
|
1092
|
-
...
|
|
1287
|
+
...R,
|
|
1093
1288
|
operation: e.literal("cancel"),
|
|
1094
1289
|
lane: e.literal("control"),
|
|
1095
1290
|
payload: e.strictObject({
|
|
1096
|
-
controlCommandId:
|
|
1097
|
-
controlIdempotencyKey:
|
|
1098
|
-
targetRunId:
|
|
1099
|
-
reason:
|
|
1291
|
+
controlCommandId: M,
|
|
1292
|
+
controlIdempotencyKey: A,
|
|
1293
|
+
targetRunId: k,
|
|
1294
|
+
reason: O(0, 2e3)
|
|
1100
1295
|
})
|
|
1101
1296
|
}),
|
|
1102
1297
|
e.strictObject({
|
|
1103
|
-
...
|
|
1298
|
+
...R,
|
|
1104
1299
|
operation: e.literal("respond_interaction"),
|
|
1105
1300
|
lane: e.literal("control"),
|
|
1106
1301
|
payload: e.strictObject({
|
|
1107
|
-
controlCommandId:
|
|
1108
|
-
controlIdempotencyKey:
|
|
1109
|
-
interactionId:
|
|
1110
|
-
expectedRevision:
|
|
1302
|
+
controlCommandId: M,
|
|
1303
|
+
controlIdempotencyKey: A,
|
|
1304
|
+
interactionId: k,
|
|
1305
|
+
expectedRevision: P,
|
|
1111
1306
|
action: e.enum([
|
|
1112
1307
|
"approve",
|
|
1113
1308
|
"reject",
|
|
1114
1309
|
"submit",
|
|
1115
1310
|
"cancel"
|
|
1116
1311
|
]),
|
|
1117
|
-
response:
|
|
1312
|
+
response: I
|
|
1118
1313
|
})
|
|
1119
1314
|
}),
|
|
1120
1315
|
e.strictObject({
|
|
1121
|
-
...
|
|
1316
|
+
...R,
|
|
1122
1317
|
operation: e.literal("observe"),
|
|
1123
1318
|
lane: e.literal("control"),
|
|
1124
1319
|
payload: e.strictObject({
|
|
1125
|
-
sessionId:
|
|
1126
|
-
afterSeq:
|
|
1320
|
+
sessionId: k,
|
|
1321
|
+
afterSeq: N,
|
|
1127
1322
|
limit: e.number().int().min(1).max(200).default(200)
|
|
1128
1323
|
})
|
|
1129
1324
|
})
|
|
@@ -1139,9 +1334,9 @@ var Ue = e.strictObject({
|
|
|
1139
1334
|
"set_admission"
|
|
1140
1335
|
].includes(e.operation) || e.operation === "set_grant" && e.payload.state !== "revoked") && e.authorization.permitKind !== "execute" && n("Recovery authorization cannot grant execution");
|
|
1141
1336
|
});
|
|
1142
|
-
async function
|
|
1337
|
+
async function Qe(e) {
|
|
1143
1338
|
let t = { ...e.ref };
|
|
1144
|
-
return delete t.schedulerEpoch,
|
|
1339
|
+
return delete t.schedulerEpoch, y({
|
|
1145
1340
|
protocolVersion: e.protocolVersion,
|
|
1146
1341
|
nodeCommandId: e.nodeCommandId,
|
|
1147
1342
|
operationKey: e.operationKey,
|
|
@@ -1151,27 +1346,27 @@ async function Xe(e) {
|
|
|
1151
1346
|
payload: e.payload
|
|
1152
1347
|
});
|
|
1153
1348
|
}
|
|
1154
|
-
async function
|
|
1155
|
-
let t =
|
|
1156
|
-
if (await
|
|
1349
|
+
async function $e(e) {
|
|
1350
|
+
let t = Ze.parse(e);
|
|
1351
|
+
if (await Qe(t) !== t.commandDigest) throw Error("node_command_digest_mismatch");
|
|
1157
1352
|
return t;
|
|
1158
1353
|
}
|
|
1159
|
-
var
|
|
1160
|
-
path:
|
|
1161
|
-
digest:
|
|
1162
|
-
sizeBytes: e.number().int().min(0).max(
|
|
1163
|
-
mediaType:
|
|
1164
|
-
}),
|
|
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 = {
|
|
1165
1360
|
kind: e.enum(["files", "git_snapshot"]),
|
|
1166
|
-
sourceCommit:
|
|
1167
|
-
entries: e.array(
|
|
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)
|
|
1168
1363
|
};
|
|
1169
|
-
function
|
|
1364
|
+
function rt(e, t) {
|
|
1170
1365
|
let n = (e) => t.addIssue({
|
|
1171
1366
|
code: "custom",
|
|
1172
1367
|
message: e
|
|
1173
1368
|
});
|
|
1174
|
-
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) >
|
|
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");
|
|
1175
1370
|
let r = new Set(e.entries.map((e) => e.path));
|
|
1176
1371
|
r.size !== e.entries.length && n("Duplicate material path");
|
|
1177
1372
|
for (let e of r) {
|
|
@@ -1179,49 +1374,49 @@ function tt(e, t) {
|
|
|
1179
1374
|
for (t.pop(); t.length;) r.has(t.join("/")) && n("A material file cannot also be a directory"), t.pop();
|
|
1180
1375
|
}
|
|
1181
1376
|
}
|
|
1182
|
-
var
|
|
1183
|
-
...
|
|
1184
|
-
idempotencyKey:
|
|
1185
|
-
}).superRefine(
|
|
1186
|
-
async function
|
|
1187
|
-
let t =
|
|
1188
|
-
return
|
|
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({
|
|
1189
1384
|
kind: t.kind,
|
|
1190
1385
|
...t.sourceCommit === null ? {} : { sourceCommit: t.sourceCommit },
|
|
1191
|
-
entries: [...t.entries].sort((e, t) =>
|
|
1386
|
+
entries: [...t.entries].sort((e, t) => we(e.path, t.path))
|
|
1192
1387
|
});
|
|
1193
1388
|
}
|
|
1194
|
-
var
|
|
1195
|
-
storeIncarnation:
|
|
1389
|
+
var ot = e.strictObject({
|
|
1390
|
+
storeIncarnation: k,
|
|
1196
1391
|
grant: e.strictObject({
|
|
1197
|
-
grantId:
|
|
1392
|
+
grantId: k,
|
|
1198
1393
|
state: e.enum([
|
|
1199
1394
|
"active",
|
|
1200
1395
|
"suspended",
|
|
1201
1396
|
"revoked"
|
|
1202
1397
|
]),
|
|
1203
|
-
revision:
|
|
1204
|
-
attemptEpoch:
|
|
1205
|
-
expiresAt:
|
|
1398
|
+
revision: P,
|
|
1399
|
+
attemptEpoch: P,
|
|
1400
|
+
expiresAt: F,
|
|
1206
1401
|
admissionAllowed: e.boolean(),
|
|
1207
|
-
admissionRevision:
|
|
1402
|
+
admissionRevision: P
|
|
1208
1403
|
}),
|
|
1209
1404
|
barrier: e.strictObject({
|
|
1210
|
-
queuedMessageIds: e.array(
|
|
1211
|
-
inFlightMessageIds: e.array(
|
|
1212
|
-
discardedMessageIds: e.array(
|
|
1213
|
-
settledMessageIds: e.array(
|
|
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([]),
|
|
1214
1409
|
commands: e.array(e.strictObject({
|
|
1215
|
-
messageId:
|
|
1216
|
-
commandId:
|
|
1217
|
-
idempotencyKey:
|
|
1410
|
+
messageId: k,
|
|
1411
|
+
commandId: M,
|
|
1412
|
+
idempotencyKey: A,
|
|
1218
1413
|
inboxState: e.enum([
|
|
1219
1414
|
"accepted",
|
|
1220
1415
|
"claimed",
|
|
1221
1416
|
"completed",
|
|
1222
1417
|
"discarded"
|
|
1223
1418
|
]),
|
|
1224
|
-
runId:
|
|
1419
|
+
runId: L,
|
|
1225
1420
|
runState: e.enum([
|
|
1226
1421
|
"pending",
|
|
1227
1422
|
"running",
|
|
@@ -1234,101 +1429,101 @@ var it = e.strictObject({
|
|
|
1234
1429
|
]).nullable().default(null)
|
|
1235
1430
|
})).max(1e4).default([])
|
|
1236
1431
|
})
|
|
1237
|
-
}),
|
|
1238
|
-
operationId:
|
|
1432
|
+
}), st = e.strictObject({
|
|
1433
|
+
operationId: A,
|
|
1239
1434
|
status: e.literal("applied").default("applied"),
|
|
1240
|
-
snapshot:
|
|
1241
|
-
}),
|
|
1435
|
+
snapshot: ot
|
|
1436
|
+
}), ct = e.strictObject({
|
|
1242
1437
|
operation: e.literal("get_grant"),
|
|
1243
|
-
storeIncarnation:
|
|
1244
|
-
current:
|
|
1245
|
-
lookupOperationId:
|
|
1246
|
-
mutationReceipt:
|
|
1438
|
+
storeIncarnation: k,
|
|
1439
|
+
current: ot.nullable().default(null),
|
|
1440
|
+
lookupOperationId: A.nullable().default(null),
|
|
1441
|
+
mutationReceipt: st.nullable().default(null)
|
|
1247
1442
|
}).superRefine((e, t) => {
|
|
1248
1443
|
(e.current && e.current.storeIncarnation !== e.storeIncarnation || e.mutationReceipt && (e.mutationReceipt.operationId !== e.lookupOperationId || e.mutationReceipt.snapshot.storeIncarnation !== e.storeIncarnation)) && t.addIssue({
|
|
1249
1444
|
code: "custom",
|
|
1250
1445
|
message: "Grant lookup must match the original store and mutation identity"
|
|
1251
1446
|
});
|
|
1252
|
-
}),
|
|
1447
|
+
}), lt = e.discriminatedUnion("operation", [
|
|
1253
1448
|
e.strictObject({
|
|
1254
1449
|
operation: e.literal("prepare"),
|
|
1255
|
-
contextRef:
|
|
1256
|
-
contextDigest:
|
|
1257
|
-
snapshot:
|
|
1450
|
+
contextRef: k,
|
|
1451
|
+
contextDigest: j,
|
|
1452
|
+
snapshot: ot
|
|
1258
1453
|
}),
|
|
1259
1454
|
e.strictObject({
|
|
1260
1455
|
operation: e.literal("set_grant"),
|
|
1261
|
-
mutationReceipt:
|
|
1456
|
+
mutationReceipt: st
|
|
1262
1457
|
}),
|
|
1263
1458
|
e.strictObject({
|
|
1264
1459
|
operation: e.literal("set_admission"),
|
|
1265
|
-
mutationReceipt:
|
|
1460
|
+
mutationReceipt: st
|
|
1266
1461
|
}),
|
|
1267
|
-
|
|
1268
|
-
]),
|
|
1269
|
-
protocolVersion: e.literal(
|
|
1270
|
-
nodeCommandId:
|
|
1462
|
+
ct
|
|
1463
|
+
]), ut = e.strictObject({
|
|
1464
|
+
protocolVersion: e.literal(E).default(E),
|
|
1465
|
+
nodeCommandId: M,
|
|
1271
1466
|
operation: e.literal("describe"),
|
|
1272
1467
|
lane: e.literal("control").default("control"),
|
|
1273
|
-
operationKey:
|
|
1274
|
-
authorityId:
|
|
1275
|
-
nodeId:
|
|
1276
|
-
bindingRef:
|
|
1277
|
-
localBindingRef:
|
|
1468
|
+
operationKey: A,
|
|
1469
|
+
authorityId: k,
|
|
1470
|
+
nodeId: k,
|
|
1471
|
+
bindingRef: k,
|
|
1472
|
+
localBindingRef: k,
|
|
1278
1473
|
expectedDigests: e.strictObject({
|
|
1279
|
-
bundle:
|
|
1280
|
-
contract:
|
|
1281
|
-
capabilities:
|
|
1474
|
+
bundle: j,
|
|
1475
|
+
contract: j,
|
|
1476
|
+
capabilities: j
|
|
1282
1477
|
}),
|
|
1283
|
-
nodeGeneration:
|
|
1284
|
-
claimLeaseUntil:
|
|
1478
|
+
nodeGeneration: P,
|
|
1479
|
+
claimLeaseUntil: F,
|
|
1285
1480
|
authorization: e.strictObject({
|
|
1286
1481
|
permitKind: e.literal("probe"),
|
|
1287
|
-
permit:
|
|
1482
|
+
permit: O(1, 16384)
|
|
1288
1483
|
}),
|
|
1289
|
-
commandDigest:
|
|
1484
|
+
commandDigest: j
|
|
1290
1485
|
});
|
|
1291
|
-
async function
|
|
1292
|
-
return
|
|
1486
|
+
async function dt(e) {
|
|
1487
|
+
return y(Object.fromEntries(Object.entries(ut.parse(e)).filter(([e]) => ![
|
|
1293
1488
|
"authorization",
|
|
1294
1489
|
"claimLeaseUntil",
|
|
1295
1490
|
"commandDigest"
|
|
1296
1491
|
].includes(e))));
|
|
1297
1492
|
}
|
|
1298
|
-
async function
|
|
1493
|
+
async function ft(e) {
|
|
1299
1494
|
if (e && typeof e == "object" && "operation" in e && e.operation === "describe") {
|
|
1300
|
-
let t =
|
|
1301
|
-
if (await
|
|
1495
|
+
let t = ut.parse(e);
|
|
1496
|
+
if (await dt(t) !== t.commandDigest) throw Error("node_probe_digest_mismatch");
|
|
1302
1497
|
return t;
|
|
1303
1498
|
}
|
|
1304
|
-
return
|
|
1499
|
+
return $e(e);
|
|
1305
1500
|
}
|
|
1306
|
-
var
|
|
1307
|
-
bindingRef:
|
|
1308
|
-
localBindingRef:
|
|
1309
|
-
agentInstanceId:
|
|
1310
|
-
storeIncarnation:
|
|
1311
|
-
capabilities:
|
|
1312
|
-
capabilitiesDigest:
|
|
1313
|
-
bundleDigest:
|
|
1314
|
-
contractDigest:
|
|
1315
|
-
}),
|
|
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({
|
|
1316
1511
|
reportKind: e.literal("probe").default("probe"),
|
|
1317
|
-
nodeCommandId:
|
|
1318
|
-
nodeGeneration:
|
|
1319
|
-
commandDigest:
|
|
1320
|
-
resultRevision:
|
|
1512
|
+
nodeCommandId: M,
|
|
1513
|
+
nodeGeneration: P,
|
|
1514
|
+
commandDigest: j,
|
|
1515
|
+
resultRevision: P,
|
|
1321
1516
|
phase: e.enum([
|
|
1322
1517
|
"described",
|
|
1323
1518
|
"uncertain",
|
|
1324
1519
|
"rejected"
|
|
1325
1520
|
]),
|
|
1326
|
-
probeResult:
|
|
1521
|
+
probeResult: pt.nullable().default(null),
|
|
1327
1522
|
error: e.strictObject({
|
|
1328
|
-
code:
|
|
1523
|
+
code: k,
|
|
1329
1524
|
retryable: e.boolean()
|
|
1330
1525
|
}).nullable().default(null)
|
|
1331
|
-
}).refine((e) => e.phase === "described" == (e.probeResult !== null), "Described probe requires exact Host result"),
|
|
1526
|
+
}).refine((e) => e.phase === "described" == (e.probeResult !== null), "Described probe requires exact Host result"), ht = (e) => mt.parse(e), gt = e.strictObject({
|
|
1332
1527
|
status: e.enum([
|
|
1333
1528
|
"succeeded",
|
|
1334
1529
|
"failed",
|
|
@@ -1336,25 +1531,25 @@ var dt = e.strictObject({
|
|
|
1336
1531
|
"interrupted"
|
|
1337
1532
|
]),
|
|
1338
1533
|
candidate: e.strictObject({
|
|
1339
|
-
result:
|
|
1340
|
-
artifacts: e.array(
|
|
1534
|
+
result: O(0, Ie),
|
|
1535
|
+
artifacts: e.array(I).max(1e3).default([])
|
|
1341
1536
|
}),
|
|
1342
|
-
usage: e.strictObject({ totalTokens:
|
|
1343
|
-
terminalEvidence:
|
|
1344
|
-
completionDigest:
|
|
1345
|
-
}).superRefine(
|
|
1346
|
-
async function
|
|
1347
|
-
let t =
|
|
1348
|
-
if (await
|
|
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");
|
|
1349
1544
|
let { completionDigest: n, ...r } = t;
|
|
1350
|
-
if (await
|
|
1545
|
+
if (await y(r) !== n) throw Error("completion_digest_mismatch");
|
|
1351
1546
|
return t;
|
|
1352
1547
|
}
|
|
1353
|
-
var
|
|
1354
|
-
nodeCommandId:
|
|
1355
|
-
nodeGeneration:
|
|
1356
|
-
commandDigest:
|
|
1357
|
-
resultRevision:
|
|
1548
|
+
var vt = e.strictObject({
|
|
1549
|
+
nodeCommandId: M,
|
|
1550
|
+
nodeGeneration: P,
|
|
1551
|
+
commandDigest: j,
|
|
1552
|
+
resultRevision: P,
|
|
1358
1553
|
phase: e.enum([
|
|
1359
1554
|
"prepared",
|
|
1360
1555
|
"submitted",
|
|
@@ -1365,18 +1560,18 @@ var gt = e.strictObject({
|
|
|
1365
1560
|
"rejected",
|
|
1366
1561
|
"control_applied"
|
|
1367
1562
|
]),
|
|
1368
|
-
receipt:
|
|
1369
|
-
eventBatch:
|
|
1563
|
+
receipt: He.nullable().default(null),
|
|
1564
|
+
eventBatch: Ge.nullable().default(null),
|
|
1370
1565
|
materialProof: e.strictObject({
|
|
1371
|
-
manifestRef:
|
|
1372
|
-
digest:
|
|
1566
|
+
manifestRef: k,
|
|
1567
|
+
digest: j
|
|
1373
1568
|
}).nullable().default(null),
|
|
1374
1569
|
error: e.strictObject({
|
|
1375
|
-
code:
|
|
1570
|
+
code: k,
|
|
1376
1571
|
retryable: e.boolean()
|
|
1377
1572
|
}).nullable().default(null),
|
|
1378
|
-
operationResult:
|
|
1379
|
-
executionResult:
|
|
1573
|
+
operationResult: lt.nullable().default(null),
|
|
1574
|
+
executionResult: gt.nullable().default(null)
|
|
1380
1575
|
}).superRefine((e, t) => {
|
|
1381
1576
|
e.phase === "prepared" && e.operationResult?.operation !== "prepare" && t.addIssue({
|
|
1382
1577
|
code: "custom",
|
|
@@ -1390,34 +1585,34 @@ var gt = e.strictObject({
|
|
|
1390
1585
|
}), e.phase === "terminal" && !e.receipt?.terminalEvidence && t.addIssue({
|
|
1391
1586
|
code: "custom",
|
|
1392
1587
|
message: "Terminal report requires canonical evidence"
|
|
1393
|
-
}), e.phase === "terminal" && (!e.executionResult || e.executionResult.status !== e.receipt?.nativeStatus ||
|
|
1588
|
+
}), e.phase === "terminal" && (!e.executionResult || e.executionResult.status !== e.receipt?.nativeStatus || v(e.executionResult.terminalEvidence) !== v(e.receipt?.terminalEvidence ?? null)) && t.addIssue({
|
|
1394
1589
|
code: "custom",
|
|
1395
1590
|
message: "Terminal report requires matching canonical completion"
|
|
1396
1591
|
}), e.phase !== "terminal" && e.executionResult !== null && t.addIssue({
|
|
1397
1592
|
code: "custom",
|
|
1398
1593
|
message: "Completion only belongs to terminal report"
|
|
1399
|
-
}),
|
|
1400
|
-
}),
|
|
1401
|
-
let t =
|
|
1402
|
-
return t.executionResult && await
|
|
1403
|
-
},
|
|
1404
|
-
text:
|
|
1405
|
-
length:
|
|
1406
|
-
identifier:
|
|
1407
|
-
operationKey:
|
|
1408
|
-
digest:
|
|
1409
|
-
commandId:
|
|
1410
|
-
sequence:
|
|
1411
|
-
revision:
|
|
1412
|
-
timestamp:
|
|
1413
|
-
relativePath:
|
|
1414
|
-
},
|
|
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 = [
|
|
1415
1610
|
"runSummaries",
|
|
1416
1611
|
"taskSummaries",
|
|
1417
1612
|
"pendingInteractions",
|
|
1418
1613
|
"recentMessages",
|
|
1419
1614
|
"artifactSummaries"
|
|
1420
|
-
],
|
|
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([
|
|
1421
1616
|
"planning",
|
|
1422
1617
|
"running",
|
|
1423
1618
|
"waiting",
|
|
@@ -1427,7 +1622,7 @@ var gt = e.strictObject({
|
|
|
1427
1622
|
"failed",
|
|
1428
1623
|
"cancel_requested",
|
|
1429
1624
|
"cancelled"
|
|
1430
|
-
]),
|
|
1625
|
+
]), Ot = e.enum([
|
|
1431
1626
|
"draft",
|
|
1432
1627
|
"ready",
|
|
1433
1628
|
"blocked",
|
|
@@ -1437,28 +1632,28 @@ var gt = e.strictObject({
|
|
|
1437
1632
|
"failed",
|
|
1438
1633
|
"cancel_requested",
|
|
1439
1634
|
"cancelled"
|
|
1440
|
-
]),
|
|
1441
|
-
authorityId:
|
|
1635
|
+
]), J = e.strictObject({
|
|
1636
|
+
authorityId: V,
|
|
1442
1637
|
ownerScopeRef: e.string().min(1).max(512),
|
|
1443
|
-
groupId:
|
|
1444
|
-
}),
|
|
1638
|
+
groupId: V
|
|
1639
|
+
}), kt = J.extend({ origin: e.string().refine((e) => {
|
|
1445
1640
|
try {
|
|
1446
1641
|
let t = new URL(e);
|
|
1447
1642
|
return ["http:", "https:"].includes(t.protocol) && t.origin === e;
|
|
1448
1643
|
} catch {
|
|
1449
1644
|
return !1;
|
|
1450
1645
|
}
|
|
1451
|
-
}, "Invalid workspace origin") }),
|
|
1452
|
-
groupId:
|
|
1646
|
+
}, "Invalid workspace origin") }), At = e.strictObject({
|
|
1647
|
+
groupId: V,
|
|
1453
1648
|
name: e.string().min(1).max(256),
|
|
1454
|
-
authorityRef:
|
|
1455
|
-
tenantId:
|
|
1456
|
-
ownerSubject:
|
|
1457
|
-
leaderMemberId:
|
|
1458
|
-
revision:
|
|
1649
|
+
authorityRef: V,
|
|
1650
|
+
tenantId: V,
|
|
1651
|
+
ownerSubject: V,
|
|
1652
|
+
leaderMemberId: V,
|
|
1653
|
+
revision: U,
|
|
1459
1654
|
status: e.enum(["active", "archived"]),
|
|
1460
|
-
createdAt:
|
|
1461
|
-
updatedAt:
|
|
1655
|
+
createdAt: W,
|
|
1656
|
+
updatedAt: W,
|
|
1462
1657
|
policy: e.strictObject({
|
|
1463
1658
|
taskAcceptance: e.enum([
|
|
1464
1659
|
"leader",
|
|
@@ -1467,43 +1662,43 @@ var gt = e.strictObject({
|
|
|
1467
1662
|
]),
|
|
1468
1663
|
peerWake: e.boolean()
|
|
1469
1664
|
})
|
|
1470
|
-
}),
|
|
1665
|
+
}), jt = e.strictObject({
|
|
1471
1666
|
enqueue: e.boolean(),
|
|
1472
1667
|
cancel: e.boolean(),
|
|
1473
1668
|
steer: e.boolean(),
|
|
1474
1669
|
restore: e.boolean(),
|
|
1475
1670
|
interaction: e.boolean(),
|
|
1476
1671
|
leader: e.boolean()
|
|
1477
|
-
}),
|
|
1478
|
-
bindingRef:
|
|
1479
|
-
providerRef:
|
|
1672
|
+
}), Mt = e.strictObject({
|
|
1673
|
+
bindingRef: V,
|
|
1674
|
+
providerRef: V,
|
|
1480
1675
|
kind: e.enum([
|
|
1481
1676
|
"local_build",
|
|
1482
1677
|
"a2a",
|
|
1483
1678
|
"cloud"
|
|
1484
1679
|
]),
|
|
1485
|
-
agentId:
|
|
1486
|
-
capabilities:
|
|
1680
|
+
agentId: V,
|
|
1681
|
+
capabilities: jt,
|
|
1487
1682
|
availability: e.strictObject({
|
|
1488
1683
|
state: e.enum([
|
|
1489
1684
|
"ready",
|
|
1490
1685
|
"unchecked",
|
|
1491
1686
|
"unavailable"
|
|
1492
1687
|
]),
|
|
1493
|
-
code:
|
|
1494
|
-
reason:
|
|
1688
|
+
code: G,
|
|
1689
|
+
reason: K,
|
|
1495
1690
|
action: e.string().max(256).nullable()
|
|
1496
1691
|
})
|
|
1497
|
-
}),
|
|
1498
|
-
memberId:
|
|
1499
|
-
groupId:
|
|
1692
|
+
}), Nt = e.strictObject({
|
|
1693
|
+
memberId: V,
|
|
1694
|
+
groupId: V,
|
|
1500
1695
|
name: e.string().min(1).max(256),
|
|
1501
1696
|
role: e.enum(["leader", "member"]),
|
|
1502
1697
|
responsibility: e.string().max(2e3),
|
|
1503
|
-
bindingRef:
|
|
1504
|
-
binding:
|
|
1505
|
-
sessionId:
|
|
1506
|
-
revision:
|
|
1698
|
+
bindingRef: V,
|
|
1699
|
+
binding: Mt,
|
|
1700
|
+
sessionId: V,
|
|
1701
|
+
revision: U,
|
|
1507
1702
|
status: e.enum([
|
|
1508
1703
|
"active",
|
|
1509
1704
|
"removed",
|
|
@@ -1517,13 +1712,13 @@ var gt = e.strictObject({
|
|
|
1517
1712
|
"needs_attention",
|
|
1518
1713
|
"unavailable"
|
|
1519
1714
|
]),
|
|
1520
|
-
activeRunId:
|
|
1521
|
-
reason:
|
|
1522
|
-
}).refine((e) => e.bindingRef === e.binding.bindingRef, "Binding identity mismatch"),
|
|
1523
|
-
runMemberId:
|
|
1524
|
-
teamRunId:
|
|
1525
|
-
groupRevision:
|
|
1526
|
-
}),
|
|
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({
|
|
1527
1722
|
state: e.enum([
|
|
1528
1723
|
"armed",
|
|
1529
1724
|
"fencing_old",
|
|
@@ -1532,53 +1727,53 @@ var gt = e.strictObject({
|
|
|
1532
1727
|
"active",
|
|
1533
1728
|
"blocked"
|
|
1534
1729
|
]),
|
|
1535
|
-
standbyBindingRef:
|
|
1536
|
-
releaseRef:
|
|
1537
|
-
takeoverId:
|
|
1538
|
-
reason:
|
|
1539
|
-
newLeaderEpoch:
|
|
1540
|
-
}),
|
|
1541
|
-
teamRunId:
|
|
1542
|
-
groupId:
|
|
1543
|
-
revision:
|
|
1544
|
-
groupRevision:
|
|
1545
|
-
goalMessageId:
|
|
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,
|
|
1546
1741
|
goal: e.string(),
|
|
1547
|
-
leaderMemberId:
|
|
1548
|
-
status:
|
|
1742
|
+
leaderMemberId: V,
|
|
1743
|
+
status: Dt,
|
|
1549
1744
|
dispatchSuspended: e.boolean(),
|
|
1550
|
-
dispatchEpoch:
|
|
1551
|
-
taskCount:
|
|
1552
|
-
pendingCount:
|
|
1553
|
-
createdAt:
|
|
1554
|
-
updatedAt:
|
|
1555
|
-
reason:
|
|
1556
|
-
leaderStandby:
|
|
1557
|
-
}),
|
|
1558
|
-
taskId:
|
|
1559
|
-
groupId:
|
|
1560
|
-
teamRunId:
|
|
1561
|
-
revision:
|
|
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,
|
|
1562
1757
|
title: e.string().min(1).max(2e3),
|
|
1563
|
-
ownerMemberId:
|
|
1564
|
-
dependencies: e.array(
|
|
1565
|
-
status:
|
|
1566
|
-
attemptCount:
|
|
1567
|
-
reason:
|
|
1568
|
-
}).refine((e) => new Set(e.dependencies).size === e.dependencies.length && !e.dependencies.includes(e.taskId), "Invalid task dependencies"),
|
|
1569
|
-
authorityRef:
|
|
1570
|
-
groupId:
|
|
1571
|
-
memberId:
|
|
1572
|
-
bindingRef:
|
|
1573
|
-
providerRef:
|
|
1574
|
-
sessionId:
|
|
1575
|
-
runId:
|
|
1576
|
-
itemId:
|
|
1577
|
-
}),
|
|
1578
|
-
ref:
|
|
1579
|
-
groupId:
|
|
1580
|
-
teamRunId:
|
|
1581
|
-
revision:
|
|
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,
|
|
1582
1777
|
title: e.string().max(2e3),
|
|
1583
1778
|
kind: e.enum(["approval", "input"]),
|
|
1584
1779
|
status: e.enum([
|
|
@@ -1588,23 +1783,23 @@ var gt = e.strictObject({
|
|
|
1588
1783
|
"cancelled",
|
|
1589
1784
|
"expired"
|
|
1590
1785
|
]),
|
|
1591
|
-
createdAt:
|
|
1592
|
-
}),
|
|
1786
|
+
createdAt: W
|
|
1787
|
+
}), Bt = e.discriminatedUnion("kind", [e.strictObject({
|
|
1593
1788
|
kind: e.literal("text"),
|
|
1594
1789
|
text: e.string()
|
|
1595
1790
|
}), e.strictObject({
|
|
1596
1791
|
kind: e.literal("attachment"),
|
|
1597
|
-
attachmentRef:
|
|
1792
|
+
attachmentRef: V,
|
|
1598
1793
|
mediaType: e.string().min(1).max(200),
|
|
1599
1794
|
name: e.string().max(4096).optional()
|
|
1600
|
-
})]),
|
|
1601
|
-
messageId:
|
|
1602
|
-
groupId:
|
|
1603
|
-
teamRunId:
|
|
1604
|
-
revision:
|
|
1605
|
-
createdSeq:
|
|
1606
|
-
createdAt:
|
|
1607
|
-
senderPrincipal:
|
|
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,
|
|
1608
1803
|
senderName: e.string().max(256),
|
|
1609
1804
|
groupRole: e.enum([
|
|
1610
1805
|
"owner",
|
|
@@ -1612,9 +1807,9 @@ var gt = e.strictObject({
|
|
|
1612
1807
|
"member",
|
|
1613
1808
|
"system"
|
|
1614
1809
|
]),
|
|
1615
|
-
memberId:
|
|
1616
|
-
parts: e.array(
|
|
1617
|
-
mentions: e.array(
|
|
1810
|
+
memberId: G,
|
|
1811
|
+
parts: e.array(Bt).max(64),
|
|
1812
|
+
mentions: e.array(V).max(8),
|
|
1618
1813
|
intent: e.enum([
|
|
1619
1814
|
"start_goal",
|
|
1620
1815
|
"followup",
|
|
@@ -1623,45 +1818,45 @@ var gt = e.strictObject({
|
|
|
1623
1818
|
"result",
|
|
1624
1819
|
"progress"
|
|
1625
1820
|
]),
|
|
1626
|
-
replyTo:
|
|
1627
|
-
sourceRefs: e.array(
|
|
1821
|
+
replyTo: G,
|
|
1822
|
+
sourceRefs: e.array(Lt).max(64),
|
|
1628
1823
|
visibility: e.enum(["public", "internal"])
|
|
1629
|
-
}),
|
|
1630
|
-
artifactId:
|
|
1631
|
-
groupId:
|
|
1632
|
-
teamRunId:
|
|
1633
|
-
revision:
|
|
1824
|
+
}), Ht = e.strictObject({
|
|
1825
|
+
artifactId: V,
|
|
1826
|
+
groupId: V,
|
|
1827
|
+
teamRunId: V,
|
|
1828
|
+
revision: U,
|
|
1634
1829
|
name: e.string().max(4096),
|
|
1635
1830
|
mediaType: e.string().min(1).max(200),
|
|
1636
|
-
source:
|
|
1831
|
+
source: Lt,
|
|
1637
1832
|
digest: e.string().regex(/^sha256:[0-9a-f]{64}$/).length(71),
|
|
1638
|
-
sizeBytes:
|
|
1833
|
+
sizeBytes: H,
|
|
1639
1834
|
state: e.enum([
|
|
1640
1835
|
"pending",
|
|
1641
1836
|
"ready",
|
|
1642
1837
|
"failed"
|
|
1643
1838
|
])
|
|
1644
1839
|
});
|
|
1645
|
-
function
|
|
1840
|
+
function Ut(e, t) {
|
|
1646
1841
|
try {
|
|
1647
|
-
if (new TextEncoder().encode(
|
|
1842
|
+
if (new TextEncoder().encode(v(e)).byteLength <= 2 * 1024 * 1024) return;
|
|
1648
1843
|
} catch {}
|
|
1649
1844
|
t.addIssue({
|
|
1650
1845
|
code: "custom",
|
|
1651
1846
|
message: "Workspace response exceeds safe JSON / two MiB boundary"
|
|
1652
1847
|
});
|
|
1653
1848
|
}
|
|
1654
|
-
function
|
|
1849
|
+
function X(e) {
|
|
1655
1850
|
return JSON.stringify([
|
|
1656
1851
|
e.authorityId,
|
|
1657
1852
|
e.ownerScopeRef,
|
|
1658
1853
|
e.groupId
|
|
1659
1854
|
]);
|
|
1660
1855
|
}
|
|
1661
|
-
function
|
|
1662
|
-
return JSON.stringify([e.origin,
|
|
1856
|
+
function Wt(e) {
|
|
1857
|
+
return JSON.stringify([e.origin, X(e)]);
|
|
1663
1858
|
}
|
|
1664
|
-
function
|
|
1859
|
+
function Gt(e) {
|
|
1665
1860
|
let t = e.ref;
|
|
1666
1861
|
return JSON.stringify([
|
|
1667
1862
|
t.authorityRef,
|
|
@@ -1674,27 +1869,27 @@ function Ut(e) {
|
|
|
1674
1869
|
t.interactionId
|
|
1675
1870
|
]);
|
|
1676
1871
|
}
|
|
1677
|
-
function
|
|
1872
|
+
function Z(e, t) {
|
|
1678
1873
|
switch (e) {
|
|
1679
1874
|
case "runSummaries": return t.teamRunId;
|
|
1680
1875
|
case "taskSummaries": return t.taskId;
|
|
1681
|
-
case "pendingInteractions": return
|
|
1876
|
+
case "pendingInteractions": return Gt(t);
|
|
1682
1877
|
case "recentMessages": return t.messageId;
|
|
1683
1878
|
case "artifactSummaries": return t.artifactId;
|
|
1684
1879
|
}
|
|
1685
1880
|
}
|
|
1686
|
-
function
|
|
1881
|
+
function Kt(e, t) {
|
|
1687
1882
|
return e.groupId === t.groupId && [
|
|
1688
1883
|
...e.ref ? [e.ref] : [],
|
|
1689
1884
|
...e.source ? [e.source] : [],
|
|
1690
1885
|
...e.sourceRefs ?? []
|
|
1691
1886
|
].every((e) => e.groupId === t.groupId && e.authorityRef === t.authorityId);
|
|
1692
1887
|
}
|
|
1693
|
-
function
|
|
1888
|
+
function qt(e, t, n, r, i) {
|
|
1694
1889
|
let a = /* @__PURE__ */ new Set();
|
|
1695
1890
|
for (let o of t) {
|
|
1696
|
-
let t =
|
|
1697
|
-
(a.has(t) || !
|
|
1891
|
+
let t = Z(e, o);
|
|
1892
|
+
(a.has(t) || !Kt(o, n)) && i.addIssue({
|
|
1698
1893
|
code: "custom",
|
|
1699
1894
|
message: "Duplicate row or foreign workspace scope"
|
|
1700
1895
|
}), a.add(t), e !== "runSummaries" && o.teamRunId !== r && i.addIssue({
|
|
@@ -1710,76 +1905,76 @@ function Wt(e, t, n, r, i) {
|
|
|
1710
1905
|
message: "Message history must be ordered by creation sequence"
|
|
1711
1906
|
});
|
|
1712
1907
|
}
|
|
1713
|
-
var
|
|
1714
|
-
runSummaries:
|
|
1715
|
-
taskSummaries:
|
|
1716
|
-
pendingInteractions:
|
|
1717
|
-
recentMessages:
|
|
1718
|
-
artifactSummaries:
|
|
1719
|
-
}),
|
|
1908
|
+
var Jt = e.strictObject({
|
|
1909
|
+
runSummaries: q,
|
|
1910
|
+
taskSummaries: q,
|
|
1911
|
+
pendingInteractions: q,
|
|
1912
|
+
recentMessages: q,
|
|
1913
|
+
artifactSummaries: q
|
|
1914
|
+
}), Yt = e.strictObject({
|
|
1720
1915
|
apiVersion: e.literal(t),
|
|
1721
|
-
viewVersion: e.literal(
|
|
1722
|
-
scope:
|
|
1723
|
-
snapshotId:
|
|
1724
|
-
watermark:
|
|
1725
|
-
group:
|
|
1726
|
-
members: e.array(
|
|
1727
|
-
runSummaries: e.array(
|
|
1728
|
-
selectedRun:
|
|
1729
|
-
selectedRunMembers: e.array(
|
|
1730
|
-
taskSummaries: e.array(
|
|
1731
|
-
pendingInteractions: e.array(
|
|
1732
|
-
recentMessages: e.array(
|
|
1733
|
-
artifactSummaries: e.array(
|
|
1734
|
-
cursors:
|
|
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
|
|
1735
1930
|
}).superRefine((e, t) => {
|
|
1736
1931
|
let n = (e) => t.addIssue({
|
|
1737
1932
|
code: "custom",
|
|
1738
1933
|
message: e
|
|
1739
1934
|
});
|
|
1740
|
-
(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) => !
|
|
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");
|
|
1741
1936
|
let r = e.selectedRun?.teamRunId ?? null;
|
|
1742
|
-
for (let n of
|
|
1743
|
-
e.selectedRun && (!
|
|
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");
|
|
1744
1939
|
let i = e.runSummaries.find((e) => e.teamRunId === r);
|
|
1745
|
-
i &&
|
|
1746
|
-
}),
|
|
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 = {
|
|
1747
1942
|
apiVersion: e.literal(t),
|
|
1748
|
-
viewVersion: e.literal(
|
|
1749
|
-
scope:
|
|
1750
|
-
snapshotId:
|
|
1751
|
-
watermark:
|
|
1752
|
-
teamRunId:
|
|
1943
|
+
viewVersion: e.literal(Et),
|
|
1944
|
+
scope: J,
|
|
1945
|
+
snapshotId: V,
|
|
1946
|
+
watermark: H,
|
|
1947
|
+
teamRunId: G,
|
|
1753
1948
|
cursor: e.string().min(1).max(4096),
|
|
1754
|
-
nextCursor:
|
|
1755
|
-
},
|
|
1949
|
+
nextCursor: q
|
|
1950
|
+
}, Zt = e.discriminatedUnion("collection", [
|
|
1756
1951
|
e.strictObject({
|
|
1757
|
-
...
|
|
1952
|
+
...Xt,
|
|
1758
1953
|
collection: e.literal("runSummaries"),
|
|
1759
|
-
items: e.array(
|
|
1954
|
+
items: e.array(Y).max(100)
|
|
1760
1955
|
}),
|
|
1761
1956
|
e.strictObject({
|
|
1762
|
-
...
|
|
1957
|
+
...Xt,
|
|
1763
1958
|
collection: e.literal("taskSummaries"),
|
|
1764
|
-
items: e.array(
|
|
1959
|
+
items: e.array(It).max(100)
|
|
1765
1960
|
}),
|
|
1766
1961
|
e.strictObject({
|
|
1767
|
-
...
|
|
1962
|
+
...Xt,
|
|
1768
1963
|
collection: e.literal("pendingInteractions"),
|
|
1769
|
-
items: e.array(
|
|
1964
|
+
items: e.array(zt).max(100)
|
|
1770
1965
|
}),
|
|
1771
1966
|
e.strictObject({
|
|
1772
|
-
...
|
|
1967
|
+
...Xt,
|
|
1773
1968
|
collection: e.literal("recentMessages"),
|
|
1774
|
-
items: e.array(
|
|
1969
|
+
items: e.array(Vt).max(100)
|
|
1775
1970
|
}),
|
|
1776
1971
|
e.strictObject({
|
|
1777
|
-
...
|
|
1972
|
+
...Xt,
|
|
1778
1973
|
collection: e.literal("artifactSummaries"),
|
|
1779
|
-
items: e.array(
|
|
1974
|
+
items: e.array(Ht).max(100)
|
|
1780
1975
|
})
|
|
1781
1976
|
]).superRefine((e, t) => {
|
|
1782
|
-
|
|
1977
|
+
qt(e.collection, e.items, e.scope, e.teamRunId, t), (e.collection === "runSummaries" ? e.teamRunId !== null : e.teamRunId === null) && t.addIssue({
|
|
1783
1978
|
code: "custom",
|
|
1784
1979
|
message: "Invalid page run scope"
|
|
1785
1980
|
}), e.cursor === e.nextCursor && t.addIssue({
|
|
@@ -1788,92 +1983,92 @@ var Gt = e.strictObject({
|
|
|
1788
1983
|
}), e.collection === "recentMessages" && e.items.some((t) => t.createdSeq > e.watermark) && t.addIssue({
|
|
1789
1984
|
code: "custom",
|
|
1790
1985
|
message: "Message creation exceeds snapshot watermark"
|
|
1791
|
-
}),
|
|
1792
|
-
}),
|
|
1793
|
-
collection: e.enum(
|
|
1794
|
-
snapshotId:
|
|
1795
|
-
watermark:
|
|
1796
|
-
teamRunId:
|
|
1986
|
+
}), Ut(e, t);
|
|
1987
|
+
}), Qt = e.strictObject({
|
|
1988
|
+
collection: e.enum(B),
|
|
1989
|
+
snapshotId: V,
|
|
1990
|
+
watermark: H,
|
|
1991
|
+
teamRunId: G,
|
|
1797
1992
|
cursor: e.string().min(1).max(4096),
|
|
1798
1993
|
limit: e.number().int().min(1).max(100).optional()
|
|
1799
|
-
}).refine((e) => e.collection === "runSummaries" ? e.teamRunId === null : e.teamRunId !== null, "Invalid collection run scope"),
|
|
1994
|
+
}).refine((e) => e.collection === "runSummaries" ? e.teamRunId === null : e.teamRunId !== null, "Invalid collection run scope"), $t = e.discriminatedUnion("kind", [
|
|
1800
1995
|
e.strictObject({
|
|
1801
1996
|
kind: e.literal("group"),
|
|
1802
|
-
group:
|
|
1997
|
+
group: At
|
|
1803
1998
|
}),
|
|
1804
1999
|
e.strictObject({
|
|
1805
2000
|
kind: e.literal("member"),
|
|
1806
|
-
member:
|
|
2001
|
+
member: Nt
|
|
1807
2002
|
}),
|
|
1808
2003
|
e.strictObject({
|
|
1809
2004
|
kind: e.literal("run_member"),
|
|
1810
|
-
runMember:
|
|
2005
|
+
runMember: Pt
|
|
1811
2006
|
}),
|
|
1812
2007
|
e.strictObject({
|
|
1813
2008
|
kind: e.literal("run"),
|
|
1814
|
-
run:
|
|
2009
|
+
run: Y
|
|
1815
2010
|
}),
|
|
1816
2011
|
e.strictObject({
|
|
1817
2012
|
kind: e.literal("task"),
|
|
1818
|
-
task:
|
|
2013
|
+
task: It
|
|
1819
2014
|
}),
|
|
1820
2015
|
e.strictObject({
|
|
1821
2016
|
kind: e.literal("interaction"),
|
|
1822
|
-
interaction:
|
|
2017
|
+
interaction: zt
|
|
1823
2018
|
}),
|
|
1824
2019
|
e.strictObject({
|
|
1825
2020
|
kind: e.literal("message"),
|
|
1826
|
-
message:
|
|
2021
|
+
message: Vt
|
|
1827
2022
|
}),
|
|
1828
2023
|
e.strictObject({
|
|
1829
2024
|
kind: e.literal("artifact"),
|
|
1830
|
-
artifact:
|
|
2025
|
+
artifact: Ht
|
|
1831
2026
|
}),
|
|
1832
2027
|
e.strictObject({
|
|
1833
2028
|
kind: e.literal("invalidate"),
|
|
1834
|
-
teamRunId:
|
|
1835
|
-
collections: e.array(e.enum(
|
|
2029
|
+
teamRunId: G,
|
|
2030
|
+
collections: e.array(e.enum(B)).min(1).max(5)
|
|
1836
2031
|
})
|
|
1837
|
-
]),
|
|
2032
|
+
]), en = e.strictObject({
|
|
1838
2033
|
apiVersion: e.literal(t),
|
|
1839
|
-
viewVersion: e.literal(
|
|
1840
|
-
scope:
|
|
1841
|
-
eventId:
|
|
1842
|
-
groupSeq:
|
|
2034
|
+
viewVersion: e.literal(Et),
|
|
2035
|
+
scope: J,
|
|
2036
|
+
eventId: V,
|
|
2037
|
+
groupSeq: U,
|
|
1843
2038
|
type: e.literal("workspace.delta"),
|
|
1844
|
-
createdAt:
|
|
1845
|
-
changes: e.array(
|
|
2039
|
+
createdAt: W,
|
|
2040
|
+
changes: e.array($t).max(32)
|
|
1846
2041
|
}).superRefine((e, t) => {
|
|
1847
|
-
for (let n of e.changes) n.kind !== "invalidate" && ((!
|
|
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({
|
|
1848
2043
|
code: "custom",
|
|
1849
2044
|
message: "Foreign row in workspace delta"
|
|
1850
2045
|
}), n.kind === "message" && n.message.createdSeq > e.groupSeq && t.addIssue({
|
|
1851
2046
|
code: "custom",
|
|
1852
2047
|
message: "Future message in workspace event"
|
|
1853
2048
|
}));
|
|
1854
|
-
|
|
2049
|
+
Ut(e, t);
|
|
1855
2050
|
});
|
|
1856
|
-
function
|
|
2051
|
+
function tn(e, t) {
|
|
1857
2052
|
try {
|
|
1858
2053
|
return e.parse(t);
|
|
1859
2054
|
} catch {
|
|
1860
2055
|
throw new m("workspace_contract_mismatch", "团队工作区数据格式不兼容,需要重新读取。");
|
|
1861
2056
|
}
|
|
1862
2057
|
}
|
|
1863
|
-
function
|
|
1864
|
-
return
|
|
2058
|
+
function nn(e) {
|
|
2059
|
+
return tn(Yt, e);
|
|
1865
2060
|
}
|
|
1866
|
-
function
|
|
1867
|
-
return Zt
|
|
2061
|
+
function rn(e) {
|
|
2062
|
+
return tn(Zt, e);
|
|
1868
2063
|
}
|
|
1869
|
-
function
|
|
1870
|
-
return
|
|
2064
|
+
function an(e) {
|
|
2065
|
+
return tn(en, e);
|
|
1871
2066
|
}
|
|
1872
2067
|
//#endregion
|
|
1873
2068
|
//#region src/core/teams/workspaceReducer.ts
|
|
1874
2069
|
var Q = (e) => {
|
|
1875
2070
|
throw new m("reset_required", e);
|
|
1876
|
-
},
|
|
2071
|
+
}, on = class {
|
|
1877
2072
|
value;
|
|
1878
2073
|
baseWatermark;
|
|
1879
2074
|
versions = /* @__PURE__ */ new Map();
|
|
@@ -1884,7 +2079,7 @@ var Q = (e) => {
|
|
|
1884
2079
|
usedCursors = /* @__PURE__ */ new Map();
|
|
1885
2080
|
maxRows;
|
|
1886
2081
|
constructor(e, t = {}) {
|
|
1887
|
-
if (this.value =
|
|
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", "工作区缓存上限无效。");
|
|
1888
2083
|
this.seedVersions();
|
|
1889
2084
|
}
|
|
1890
2085
|
snapshot() {
|
|
@@ -1908,23 +2103,23 @@ var Q = (e) => {
|
|
|
1908
2103
|
this.versions.clear();
|
|
1909
2104
|
let e = (e, t) => this.versions.set(e, {
|
|
1910
2105
|
revision: t.revision,
|
|
1911
|
-
digest:
|
|
2106
|
+
digest: v(t),
|
|
1912
2107
|
domainDigest: this.domainDigest(e, t),
|
|
1913
2108
|
observedSeq: this.baseWatermark
|
|
1914
2109
|
});
|
|
1915
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));
|
|
1916
|
-
for (let t of
|
|
2111
|
+
for (let t of B) for (let n of this.value[t]) e(`${t}:${Z(t, n)}`, n);
|
|
1917
2112
|
this.value.selectedRun && e(`runSummaries:${this.value.selectedRun.teamRunId}`, this.value.selectedRun);
|
|
1918
2113
|
}
|
|
1919
2114
|
domainDigest(e, t) {
|
|
1920
|
-
if (!e.startsWith("runSummaries:")) return
|
|
2115
|
+
if (!e.startsWith("runSummaries:")) return v(t);
|
|
1921
2116
|
let n = { ...t };
|
|
1922
|
-
return delete n.taskCount, delete n.pendingCount, delete n.leaderStandby,
|
|
2117
|
+
return delete n.taskCount, delete n.pendingCount, delete n.leaderStandby, v(n);
|
|
1923
2118
|
}
|
|
1924
2119
|
accept(e, t, n, r) {
|
|
1925
2120
|
let i = e.get(t);
|
|
1926
2121
|
if (i && (i.revision > n.revision || i.observedSeq > r)) return !1;
|
|
1927
|
-
let a =
|
|
2122
|
+
let a = v(n), o = this.domainDigest(t, n);
|
|
1928
2123
|
if (i?.revision === n.revision) {
|
|
1929
2124
|
if (i.digest === a) return !1;
|
|
1930
2125
|
(r <= i.observedSeq || i.domainDigest !== o) && Q("同一对象版本出现不同内容,需要重新读取。");
|
|
@@ -1941,26 +2136,26 @@ var Q = (e) => {
|
|
|
1941
2136
|
return r < 0 && e.length >= this.maxRows && Q("工作区缓存已达到上限,需要重新读取分页视图。"), r < 0 ? [...e, t] : e.map((e, n) => n === r ? t : e);
|
|
1942
2137
|
}
|
|
1943
2138
|
mergeRow(e, t, n, r, i) {
|
|
1944
|
-
let a =
|
|
2139
|
+
let a = Z(n, r);
|
|
1945
2140
|
if (!this.accept(t, `${n}:${a}`, r, i)) {
|
|
1946
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));
|
|
1947
2142
|
return;
|
|
1948
2143
|
}
|
|
1949
2144
|
if (n === "pendingInteractions" && !["pending", "resolving"].includes(r.status)) {
|
|
1950
|
-
e.pendingInteractions = e.pendingInteractions.filter((e) =>
|
|
2145
|
+
e.pendingInteractions = e.pendingInteractions.filter((e) => Z(n, e) !== a);
|
|
1951
2146
|
return;
|
|
1952
2147
|
}
|
|
1953
|
-
let o = this.upsert(e[n], r, (e) =>
|
|
1954
|
-
n === "recentMessages" && o.sort((e, t) => e.createdSeq - t.createdSeq ||
|
|
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 });
|
|
1955
2150
|
}
|
|
1956
2151
|
replace(e) {
|
|
1957
|
-
let t =
|
|
1958
|
-
if (
|
|
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", "刷新快照改变了工作区身份或所选协作任务。");
|
|
1959
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);
|
|
1960
2155
|
}
|
|
1961
2156
|
apply(e) {
|
|
1962
|
-
let t =
|
|
1963
|
-
if (
|
|
2157
|
+
let t = an(e);
|
|
2158
|
+
if (X(t.scope) !== X(this.value.scope)) throw new m("scope_mismatch", "事件不属于当前授权工作区。");
|
|
1964
2159
|
let n = this.seenSeq.get(t.groupSeq);
|
|
1965
2160
|
n && n !== t.eventId && Q("同一事件水位出现不同事件身份。");
|
|
1966
2161
|
let r = this.seenIds.get(t.eventId);
|
|
@@ -2015,8 +2210,8 @@ var Q = (e) => {
|
|
|
2015
2210
|
};
|
|
2016
2211
|
}
|
|
2017
2212
|
mergePage(e, t) {
|
|
2018
|
-
let n =
|
|
2019
|
-
if (
|
|
2213
|
+
let n = rn(t);
|
|
2214
|
+
if (X(n.scope) !== X(this.value.scope)) throw new m("scope_mismatch", "分页返回了其他授权工作区。");
|
|
2020
2215
|
let r = this.pageRequest(e.collection, e.limit);
|
|
2021
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", "分页与当前快照或任务不一致,需要重新读取。");
|
|
2022
2217
|
if (n.nextCursor !== null && this.usedCursors.get(n.collection)?.has(n.nextCursor)) throw new m("workspace_page_mismatch", "分页游标出现循环,需要重新读取。");
|
|
@@ -2029,12 +2224,12 @@ var Q = (e) => {
|
|
|
2029
2224
|
let o = this.usedCursors.get(n.collection) ?? /* @__PURE__ */ new Set();
|
|
2030
2225
|
return o.add(n.cursor), this.usedCursors.set(n.collection, o), !0;
|
|
2031
2226
|
}
|
|
2032
|
-
},
|
|
2227
|
+
}, sn = new Set([
|
|
2033
2228
|
"reset_required",
|
|
2034
2229
|
"snapshot_expired",
|
|
2035
2230
|
"workspace_page_mismatch",
|
|
2036
2231
|
"workspace_contract_mismatch"
|
|
2037
|
-
]),
|
|
2232
|
+
]), cn = (e, t) => new Promise((n) => {
|
|
2038
2233
|
if (t.aborted) {
|
|
2039
2234
|
n();
|
|
2040
2235
|
return;
|
|
@@ -2043,7 +2238,7 @@ var Q = (e) => {
|
|
|
2043
2238
|
clearTimeout(i), t.removeEventListener("abort", r), n();
|
|
2044
2239
|
}, i = setTimeout(r, e);
|
|
2045
2240
|
t.addEventListener("abort", r, { once: !0 });
|
|
2046
|
-
}),
|
|
2241
|
+
}), ln = class {
|
|
2047
2242
|
scope;
|
|
2048
2243
|
cacheKey;
|
|
2049
2244
|
transport;
|
|
@@ -2061,7 +2256,7 @@ var Q = (e) => {
|
|
|
2061
2256
|
resyncRequested = !1;
|
|
2062
2257
|
observingGeneration;
|
|
2063
2258
|
constructor(e, t, n = {}) {
|
|
2064
|
-
if (this.scope = Object.freeze(
|
|
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 之间。");
|
|
2065
2260
|
this.retryDelay = n.retryDelayMs ?? ((e) => Math.min(500 * 2 ** e, 1e4)), this.value = {
|
|
2066
2261
|
scope: this.scope,
|
|
2067
2262
|
selectedRunId: null,
|
|
@@ -2137,10 +2332,10 @@ var Q = (e) => {
|
|
|
2137
2332
|
signal: r.signal
|
|
2138
2333
|
});
|
|
2139
2334
|
if (!i()) return;
|
|
2140
|
-
if (
|
|
2335
|
+
if (X(e.scope) !== X(this.scope) || a !== void 0 && e.selectedRun?.teamRunId !== a) throw new m("scope_mismatch", "工作区快照与当前身份或所选任务不一致。");
|
|
2141
2336
|
if (this.reducer) {
|
|
2142
2337
|
if (!this.reducer.replace(e)) throw new m("reset_required", "工作区快照早于当前事件水位。");
|
|
2143
|
-
} else this.reducer = new
|
|
2338
|
+
} else this.reducer = new on(e);
|
|
2144
2339
|
a = e.selectedRun?.teamRunId;
|
|
2145
2340
|
let t = a ?? null, n = this.value.selectedRunId === t ? this.value.draft : this.drafts.get(t ?? "") ?? this.value.draft;
|
|
2146
2341
|
this.drafts.set(t ?? "", n), this.update({
|
|
@@ -2184,14 +2379,14 @@ var Q = (e) => {
|
|
|
2184
2379
|
401,
|
|
2185
2380
|
403,
|
|
2186
2381
|
404
|
|
2187
|
-
].includes(t.status ?? 0) || (
|
|
2382
|
+
].includes(t.status ?? 0) || (sn.has(t.code) && (o = !0), s++ >= this.maxReconnects)) throw t;
|
|
2188
2383
|
this.update({
|
|
2189
2384
|
connection: "reconnecting",
|
|
2190
2385
|
errorCode: t.code
|
|
2191
2386
|
});
|
|
2192
2387
|
let n = this.retryDelay(s - 1);
|
|
2193
2388
|
if (!Number.isFinite(n) || n < 0 || n > 6e4) throw new m("invalid_retry_delay", "工作区重试间隔无效。");
|
|
2194
|
-
await
|
|
2389
|
+
await cn(n, r.signal);
|
|
2195
2390
|
}
|
|
2196
2391
|
} catch (e) {
|
|
2197
2392
|
if (!i()) return;
|
|
@@ -2237,13 +2432,13 @@ var Q = (e) => {
|
|
|
2237
2432
|
draft: "",
|
|
2238
2433
|
connection: "offline",
|
|
2239
2434
|
errorCode: t.code
|
|
2240
|
-
}), t) : (this.update({ errorCode: t.code }),
|
|
2435
|
+
}), t) : (this.update({ errorCode: t.code }), sn.has(t.code) && this.refresh(), t);
|
|
2241
2436
|
} finally {
|
|
2242
2437
|
s() && this.pendingPages.get(e) === l && (this.pendingPages.delete(e), this.update({ loadingPages: this.value.loadingPages.filter((t) => t !== e) }));
|
|
2243
2438
|
}
|
|
2244
2439
|
})(), this.pendingPages.set(e, l), l;
|
|
2245
2440
|
}
|
|
2246
|
-
},
|
|
2441
|
+
}, un = class {
|
|
2247
2442
|
outbox;
|
|
2248
2443
|
drainer;
|
|
2249
2444
|
state = {
|
|
@@ -2258,7 +2453,7 @@ var Q = (e) => {
|
|
|
2258
2453
|
recoveryController;
|
|
2259
2454
|
controller = new AbortController();
|
|
2260
2455
|
constructor(e, t) {
|
|
2261
|
-
this.outbox = new
|
|
2456
|
+
this.outbox = new je(e), this.drainer = new Me(this.outbox, t);
|
|
2262
2457
|
}
|
|
2263
2458
|
getSnapshot = () => this.state;
|
|
2264
2459
|
subscribe = (e) => (this.listeners.add(e), () => {
|
|
@@ -2277,7 +2472,7 @@ var Q = (e) => {
|
|
|
2277
2472
|
this.writable = e, e || this.recoveryController?.abort();
|
|
2278
2473
|
}
|
|
2279
2474
|
async enqueue(e) {
|
|
2280
|
-
if (this.disposed || !this.writable) throw new
|
|
2475
|
+
if (this.disposed || !this.writable) throw new b("cloud_read_only");
|
|
2281
2476
|
let t = await this.outbox.enqueue(e, { reuseUnresolved: !0 });
|
|
2282
2477
|
return await this.refresh(), t;
|
|
2283
2478
|
}
|
|
@@ -2303,7 +2498,7 @@ var Q = (e) => {
|
|
|
2303
2498
|
maxDurationMs: 3e4
|
|
2304
2499
|
}), await this.refresh();
|
|
2305
2500
|
} catch (e) {
|
|
2306
|
-
this.update({ errorCode: e instanceof
|
|
2501
|
+
this.update({ errorCode: e instanceof b ? e.code : "outbox_unavailable" });
|
|
2307
2502
|
} finally {
|
|
2308
2503
|
this.controller.signal.removeEventListener("abort", t), this.recoveryController = void 0, this.update({ recovering: !1 }), this.work = void 0;
|
|
2309
2504
|
}
|
|
@@ -2321,47 +2516,47 @@ var Q = (e) => {
|
|
|
2321
2516
|
totalBytes: 64 * 1024 * 1024,
|
|
2322
2517
|
files: 4096,
|
|
2323
2518
|
manifestBytes: 2 * 1024 * 1024
|
|
2324
|
-
},
|
|
2519
|
+
}, dn = e.string().regex(/^sha256:[0-9a-f]{64}$/), fn = e.strictObject({
|
|
2325
2520
|
materialId: e.string().regex(/^tm_[0-9a-f]{64}$/),
|
|
2326
|
-
manifestDigest:
|
|
2521
|
+
manifestDigest: dn,
|
|
2327
2522
|
state: e.enum([
|
|
2328
2523
|
"pending",
|
|
2329
2524
|
"ready",
|
|
2330
2525
|
"expired"
|
|
2331
2526
|
]),
|
|
2332
2527
|
sizeBytes: e.number().int().min(0).max($.totalBytes),
|
|
2333
|
-
manifest:
|
|
2334
|
-
}),
|
|
2528
|
+
manifest: z
|
|
2529
|
+
}), pn = e.strictObject({
|
|
2335
2530
|
materialId: e.string().regex(/^tm_[0-9a-f]{64}$/),
|
|
2336
2531
|
state: e.literal("pending"),
|
|
2337
|
-
missingBlobs: e.array(
|
|
2338
|
-
}),
|
|
2339
|
-
digest:
|
|
2532
|
+
missingBlobs: e.array(dn).max($.files)
|
|
2533
|
+
}), mn = e.strictObject({
|
|
2534
|
+
digest: dn,
|
|
2340
2535
|
sizeBytes: e.number().int().min(0).max($.fileBytes),
|
|
2341
2536
|
state: e.literal("ready")
|
|
2342
2537
|
});
|
|
2343
|
-
async function
|
|
2344
|
-
let r =
|
|
2345
|
-
if (i !== r.manifestDigest || r.materialId !== `tm_${(await
|
|
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", "材料回执与当前身份或所选文件不一致。");
|
|
2346
2541
|
return r;
|
|
2347
2542
|
}
|
|
2348
|
-
var
|
|
2543
|
+
var gn = () => ({
|
|
2349
2544
|
state: "idle",
|
|
2350
2545
|
files: [],
|
|
2351
2546
|
completed: 0,
|
|
2352
2547
|
material: null,
|
|
2353
2548
|
error: ""
|
|
2354
|
-
}),
|
|
2549
|
+
}), _n = (e) => [
|
|
2355
2550
|
"hashing",
|
|
2356
2551
|
"creating",
|
|
2357
2552
|
"uploading",
|
|
2358
2553
|
"verifying"
|
|
2359
|
-
].includes(e),
|
|
2360
|
-
|
|
2361
|
-
scope;
|
|
2362
|
-
snapshot = fn();
|
|
2554
|
+
].includes(e), vn = () => new DOMException("Aborted", "AbortError"), yn = class {
|
|
2555
|
+
snapshot = gn();
|
|
2363
2556
|
selection = null;
|
|
2364
2557
|
listeners = /* @__PURE__ */ new Set();
|
|
2558
|
+
port;
|
|
2559
|
+
scope;
|
|
2365
2560
|
constructor(e, t) {
|
|
2366
2561
|
this.port = e, this.scope = t;
|
|
2367
2562
|
}
|
|
@@ -2378,14 +2573,14 @@ var fn = () => ({
|
|
|
2378
2573
|
}
|
|
2379
2574
|
clear() {
|
|
2380
2575
|
let e = this.selection;
|
|
2381
|
-
this.selection = null, e?.controller?.abort(), this.snapshot =
|
|
2576
|
+
this.selection = null, e?.controller?.abort(), this.snapshot = gn();
|
|
2382
2577
|
for (let e of this.listeners) e();
|
|
2383
2578
|
}
|
|
2384
2579
|
dispose() {
|
|
2385
2580
|
this.clear(), this.listeners.clear();
|
|
2386
2581
|
}
|
|
2387
2582
|
cancel() {
|
|
2388
|
-
this.selection?.controller?.abort(), this.selection &&
|
|
2583
|
+
this.selection?.controller?.abort(), this.selection && _n(this.snapshot.state) && this.update({
|
|
2389
2584
|
state: "cancelled",
|
|
2390
2585
|
material: null,
|
|
2391
2586
|
error: "上传已取消。重试或移除材料后再开始协作。"
|
|
@@ -2407,13 +2602,13 @@ var fn = () => ({
|
|
|
2407
2602
|
})) }), await this.run(n);
|
|
2408
2603
|
}
|
|
2409
2604
|
async retry() {
|
|
2410
|
-
this.selection && !
|
|
2605
|
+
this.selection && !_n(this.snapshot.state) && await this.run(this.selection);
|
|
2411
2606
|
}
|
|
2412
2607
|
async run(t) {
|
|
2413
2608
|
let n = new AbortController();
|
|
2414
2609
|
t.controller = n;
|
|
2415
2610
|
let r = () => {
|
|
2416
|
-
if (n.signal.aborted || this.selection !== t || t.controller !== n) throw
|
|
2611
|
+
if (n.signal.aborted || this.selection !== t || t.controller !== n) throw vn();
|
|
2417
2612
|
}, i = setTimeout(() => n.abort(), 10 * 6e4);
|
|
2418
2613
|
this.update({
|
|
2419
2614
|
state: "hashing",
|
|
@@ -2431,7 +2626,7 @@ var fn = () => ({
|
|
|
2431
2626
|
mediaType: e.type || "application/octet-stream",
|
|
2432
2627
|
digest: `sha256:${"0".repeat(64)}`
|
|
2433
2628
|
}));
|
|
2434
|
-
|
|
2629
|
+
z.parse({
|
|
2435
2630
|
kind: "files",
|
|
2436
2631
|
entries: e
|
|
2437
2632
|
});
|
|
@@ -2442,13 +2637,13 @@ var fn = () => ({
|
|
|
2442
2637
|
let a = await crypto.subtle.digest("SHA-256", i);
|
|
2443
2638
|
r(), e[n].digest = `sha256:${Array.from(new Uint8Array(a), (e) => e.toString(16).padStart(2, "0")).join("")}`, this.update({ completed: n + 1 });
|
|
2444
2639
|
}
|
|
2445
|
-
let i =
|
|
2640
|
+
let i = it.parse({
|
|
2446
2641
|
kind: "files",
|
|
2447
2642
|
entries: e,
|
|
2448
2643
|
idempotencyKey: t.createKey
|
|
2449
2644
|
});
|
|
2450
|
-
if (new TextEncoder().encode(
|
|
2451
|
-
let a =
|
|
2645
|
+
if (new TextEncoder().encode(v(i)).byteLength > $.manifestBytes) throw Error("文件清单超过 2 MiB,请减少文件数量或缩短文件名。");
|
|
2646
|
+
let a = z.parse({
|
|
2452
2647
|
kind: i.kind,
|
|
2453
2648
|
entries: i.entries
|
|
2454
2649
|
});
|
|
@@ -2457,14 +2652,14 @@ var fn = () => ({
|
|
|
2457
2652
|
completed: 0
|
|
2458
2653
|
});
|
|
2459
2654
|
let o = await this.port.createMaterial(this.scope, i, n.signal);
|
|
2460
|
-
if (r(), o = await
|
|
2655
|
+
if (r(), o = await hn(o, this.scope, a), r(), o.state === "expired") throw Error("材料已过期,请重新选择文件。");
|
|
2461
2656
|
if (o.state !== "ready") {
|
|
2462
2657
|
let i = /* @__PURE__ */ new Set();
|
|
2463
2658
|
for (let a = 0; a < e.length; a++) r(), this.update({
|
|
2464
2659
|
state: "uploading",
|
|
2465
2660
|
completed: a
|
|
2466
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 });
|
|
2467
|
-
this.update({ state: "verifying" }), o = await this.port.finalizeMaterial(this.scope, o, t.finalizeKey, n.signal), r(), o = await
|
|
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();
|
|
2468
2663
|
}
|
|
2469
2664
|
if (o.state !== "ready") throw Error("服务端尚未验证全部文件,请重试原上传。");
|
|
2470
2665
|
this.update({
|
|
@@ -2488,4 +2683,4 @@ var fn = () => ({
|
|
|
2488
2683
|
}
|
|
2489
2684
|
};
|
|
2490
2685
|
//#endregion
|
|
2491
|
-
export {
|
|
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 };
|